Commit 2a0f726f authored by techird's avatar techird

Merge branch 'dev' of github.com:kitygraph/kityminder into dev

parents 4098dc3a 26207f8d
//dropmenu 类
KM.ui.define('dropmenu', {
tmpl: '<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >' +
this.subTmpl +
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>' +
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active|| \'\' %> <%=ci.disabled||\'\' %>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">' +
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' +
'</li><%}}%>' +
'<%}%>'+
'</ul>',
subTmpl: '<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
subTmpl:'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>' +
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active|| \'\' %> <%=ci.disabled||\'\' %>" <%}%> data-value="<%= ci.value%>" data-label="<%= ci.label%>">' +
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' +
......@@ -16,7 +21,7 @@ KM.ui.define('dropmenu', {
},
setData:function(items){
this.root().html($.parseTmpl(this.subTmpl,items))
this.root().html($.parseTmpl(this.subTmpl,items));
return this;
},
......@@ -27,15 +32,15 @@ KM.ui.define('dropmenu', {
});
return this;
},
// show:function(){
// if(this.trigger('beforeshow') === false){
// return;
// }else{
// this.root().css({display:'block'});
// this.trigger('aftershow');
// }
// return this;
// },
show:function(){
if(this.trigger('beforeshow') === false){
return;
}else{
this.root().css({display:'block'});
this.trigger('aftershow');
}
return this;
},
init: function (options) {
var me = this;
var eventName = {
......
//menu 类
KM.ui.define('menu',{
show : function($obj,dir,fnname,topOffset,leftOffset){
fnname = fnname || 'position';
if(this.trigger('beforeshow') === false){
return;
}else{
this.root().css($.extend({display:'block'},$obj ? {
top : $obj[fnname]().top + ( dir == 'right' ? 0 : $obj.outerHeight()) - (topOffset || 0),
left : $obj[fnname]().left + (dir == 'right' ? $obj.outerWidth() : 0) - (leftOffset || 0)
......@@ -32,7 +32,7 @@ KM.ui.define('menu',{
if(!$obj.data('$mergeObj')){
$obj.data('$mergeObj',me.root());
$obj.on('wrapclick',function(evt){
me.show()
me.supper.show.call(me,$obj,'','offset')
});
me.register('click',$obj,function(evt){
me.hide()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment