-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rightMenu #88
base: master
Are you sure you want to change the base?
rightMenu #88
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,79 @@ | |
display: block; | ||
} | ||
} | ||
|
||
.endpoint-tips-menu{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个menu应该是能支持所有的节点,名字有问题 |
||
position: fixed; | ||
background: #fff; | ||
z-index: 1000; | ||
min-width: 220px; | ||
border-radius: 3px; | ||
.endpoint-tips-menu-title{ | ||
padding: 3px 10px; | ||
border-bottom: 1px solid #dcdcdc | ||
} | ||
.endpoint-tips-menu-content{ | ||
padding: 3px 10px; | ||
.yellow-point{ | ||
background: yellowgreen; | ||
display: inline-block; | ||
width: 6px; | ||
height: 6px; | ||
border-radius: 50%; | ||
margin-right: 5px; | ||
} | ||
} | ||
} | ||
.node-menu, .label-menu { | ||
position: fixed; | ||
min-width: 90px; | ||
background-color: #fff; | ||
background-clip: padding-box; | ||
text-align: center; | ||
color:#333333; | ||
z-index: 200; | ||
border-top: 1px solid #DCDCDC; | ||
border-right: 1px solid #DCDCDC; | ||
border-left: 1px solid #DCDCDC; | ||
.link-menu-item:hover{ | ||
background: #7C93A0; | ||
color: #fff; | ||
} | ||
.node-menu-item{ | ||
text-align: left; | ||
padding: 6px 10px 6px 10px; | ||
cursor: pointer; | ||
width: auto; | ||
min-width: 90px; | ||
height: 30px; | ||
} | ||
.node-menu-item-bottm{ | ||
border-bottom: none; | ||
padding: 6px 10px 6px 10px; | ||
height: 30px; | ||
} | ||
.node-menu-item:last-child{ | ||
border-bottom: 1px solid #DCDCDC; | ||
} | ||
.node-menu-item:hover{ | ||
background: #00C1DE; | ||
color: #fff; | ||
} | ||
&.dag-node-menu{ | ||
padding: 3px 0; | ||
border-bottom: 1px solid #DCDCDC; | ||
.node-menu-item{ | ||
text-align: left; | ||
padding: 3px 10px 3px 10px; | ||
cursor: pointer; | ||
width: auto; | ||
min-width: 90px; | ||
height: 24px; | ||
} | ||
.node-menu-item:last-child{ | ||
border-bottom: none; | ||
} | ||
} | ||
} | ||
.butterfly-gird-canvas { | ||
position: absolute; | ||
top: 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const $ = require('jquery'); | ||
const _ = require('lodash'); | ||
|
||
|
||
function createMenuList(param, callBack, e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 抽象库不能这样写。。。event是业务或者外部耦合的,不应该传进来处理 |
||
/** | ||
* param.type: | ||
* 若tips: param是个对象: {type: 'tips', title: '必须有', contente: '必须有'} | ||
* 其他: param是: {list: [{code: '', title: ''}]} 里面的字段必须传的 | ||
* | ||
*/ | ||
let evt = e || window.event; | ||
let pos = { | ||
left: evt.clientX, | ||
top: evt.clientY | ||
}; | ||
if (param.type === 'tips') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我建议分开2个方法吧,不要耦合在一起 |
||
$(document.body).find('.endpoint-tips-menu').remove(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个使用方法上有问题 |
||
let _content = $('<div class="endpoint-tips-menu-content"><div class="content-box"><span class="yellow-point"></span><span class="text">' + param.content + '</span></div></div>'); | ||
let _dom = $('<div class="endpoint-tips-menu"></div>').css('top', pos.top + 5).css('left', pos.left - 100); | ||
let _title = $('<div class="endpoint-tips-menu-title"></div>') | ||
.text(param.title); | ||
_title.appendTo(_dom); | ||
_content.appendTo(_dom); | ||
_dom.appendTo($(document.body)); | ||
} else { | ||
$(document.body).find('.node-menu').remove(); | ||
let nodeMenu = $('<ul class="node-menu"></ul>').css('top', pos.top).css('left', pos.left); | ||
_.get(param, 'list', []).forEach((item) => { | ||
$('<li class="node-menu-item"></li>') | ||
.attr('key', item.code) | ||
.text(item.title) | ||
.on('click', (e) => { | ||
e.stopPropagation(); | ||
if (typeof callBack === 'function') { | ||
return callBack(item); | ||
} | ||
}) | ||
.appendTo(nodeMenu); | ||
}); | ||
nodeMenu.appendTo($(document.body)); | ||
} | ||
} | ||
function hideMenuList(type) { | ||
if (type === 'tips') { | ||
$(document.body).find('.endpoint-tips-menu').remove(); | ||
} else { | ||
$(document.body).find('.node-menu').remove(); | ||
} | ||
} | ||
|
||
module.exports = { | ||
createMenuList, | ||
hideMenuList | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个应该叫MenuService