Commit f640047e authored by techird's avatar techird

dist

parent 0523e1d0
...@@ -789,6 +789,9 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", { ...@@ -789,6 +789,9 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this._paper = new kity.Paper(); this._paper = new kity.Paper();
this._paper.getNode().setAttribute( 'contenteditable', true ); this._paper.getNode().setAttribute( 'contenteditable', true );
this._paper.getNode().ondragstart = function(e) {
e.preventDefault();
};
this._addRenderContainer(); this._addRenderContainer();
...@@ -5464,16 +5467,16 @@ KM.ui.define('menu',{ ...@@ -5464,16 +5467,16 @@ KM.ui.define('menu',{
}); });
//dropmenu 类 //dropmenu 类
KM.ui.define( 'dropmenu', { KM.ui.define('dropmenu', {
tmpl: '<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >' + tmpl: '<ul class="kmui-dropdown-menu" aria-labelledby="dropdownMenu" >' +
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' + '<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>' +
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>' + '<%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%>">' + '<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>' + '<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' +
'</li><%}}%>' + '</li><%}}%>' +
'<%}%>' + '<%}%>'+
'</ul>', '</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{%>' + '<%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%>">' + '<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>' + '<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>' +
...@@ -5481,33 +5484,32 @@ KM.ui.define( 'dropmenu', { ...@@ -5481,33 +5484,32 @@ KM.ui.define( 'dropmenu', {
'<%}%>', '<%}%>',
defaultOpt: { defaultOpt: {
data: [], data: [],
click: function () {} click: function () {
}
}, },
setData: function ( items ) { setData:function(items){
this.root().html( $.parseTmpl( this.subTmpl, items ) ); this.root().html($.parseTmpl(this.subTmpl,items));
return this; return this;
}, },
position: function ( offset ) { position:function(offset){
this.root().css( { this.root().css({
left: offset.x, left:offset.x,
top: offset.y top:offset.y
} ); });
return this; return this;
}, },
show: function () { show:function(){
if ( this.trigger( 'beforeshow' ) === false ) { if(this.trigger('beforeshow') === false){
return; return;
} else { }else{
this.root().css( { this.root().css({display:'block'});
display: 'block' this.trigger('aftershow');
} );
this.trigger( 'aftershow' );
} }
return this; return this;
}, },
init: function ( options ) { init: function (options) {
var me = this; var me = this;
var eventName = { var eventName = {
click: 1, click: 1,
...@@ -5515,48 +5517,54 @@ KM.ui.define( 'dropmenu', { ...@@ -5515,48 +5517,54 @@ KM.ui.define( 'dropmenu', {
mouseout: 1 mouseout: 1
}; };
this.root( $( $.parseTmpl( this.tmpl, options ) ) ).on( 'click', 'li[class!="kmui-disabled kmui-divider kmui-dropdown-submenu"]', function ( evt ) { this.root($($.parseTmpl(this.tmpl, options))).on('click', 'li[class!="kmui-disabled kmui-divider kmui-dropdown-submenu"]',function (evt) {
$.proxy( options.click, me, evt, $( this ).data( 'value' ), $( this ).data( 'label' ), $( this ) )() $.proxy(options.click, me, evt, $(this).data('value'), $(this).data('label'),$(this))()
} ).find( 'li' ).each( function ( i, el ) { }).find('li').each(function (i, el) {
var $this = $( this ); var $this = $(this);
if ( !$this.hasClass( "kmui-disabled kmui-divider kmui-dropdown-submenu" ) ) { if (!$this.hasClass("kmui-disabled kmui-divider kmui-dropdown-submenu")) {
var data = options.data[ i ]; var data = options.data[i];
$.each( eventName, function ( k ) { $.each(eventName, function (k) {
data[ k ] && $this[ k ]( function ( evt ) { data[k] && $this[k](function (evt) {
$.proxy( data[ k ], el )( evt, data, me.root ) $.proxy(data[k], el)(evt, data, me.root)
} ) })
} ) })
} }
} ) });
}, },
disabled: function ( cb ) { _initEvent:function(){
$( 'li[class!=kmui-divider]', this.root() ).each( function () { this.root().on('mouseover','li[class="kmui-dropdown-submenu',function(e){
var $el = $( this ); var $submenu = $(this).data('widget');
if ( cb === true ) { $submenu.kmui().show($(this),'right','position',5,2)
$el.addClass( 'kmui-disabled' ) });
} else if ( $.isFunction( cb ) ) { },
$el.toggleClass( 'kmui-disabled', cb( li ) ) disabled: function (cb) {
$('li[class!=kmui-divider]', this.root()).each(function () {
var $el = $(this);
if (cb === true) {
$el.addClass('kmui-disabled')
} else if ($.isFunction(cb)) {
$el.toggleClass('kmui-disabled', cb(li))
} else { } else {
$el.removeClass( 'kmui-disabled' ) $el.removeClass('kmui-disabled')
} }
} ); });
}, },
val: function ( val ) { val: function (val) {
var currentVal; var currentVal;
$( 'li[class!="kmui-divider kmui-disabled kmui-dropdown-submenu"]', this.root() ).each( function () { $('li[class!="kmui-divider kmui-disabled kmui-dropdown-submenu"]', this.root()).each(function () {
var $el = $( this ); var $el = $(this);
if ( val === undefined ) { if (val === undefined) {
if ( $el.find( 'em.kmui-dropmenu-checked' ).length ) { if ($el.find('em.kmui-dropmenu-checked').length) {
currentVal = $el.data( 'value' ); currentVal = $el.data('value');
return false return false
} }
} else { } else {
$el.find( 'em' ).toggleClass( 'kmui-dropmenu-checked', $el.data( 'value' ) == val ) $el.find('em').toggleClass('kmui-dropmenu-checked', $el.data('value') == val)
} }
} ); });
if ( val === undefined ) { if (val === undefined) {
return currentVal return currentVal
} }
}, },
...@@ -5569,21 +5577,21 @@ KM.ui.define( 'dropmenu', { ...@@ -5569,21 +5577,21 @@ KM.ui.define( 'dropmenu', {
var $item = $( html ).click( item.click ); var $item = $( html ).click( item.click );
this.root().append( $item ); this.root().append( $item );
}, },
addSubmenu: function ( label, menu, index ) { addSubmenu: function (label, menu, index) {
index = index || 0; index = index || 0;
var $list = $( 'li[class!=kmui-divider]', this.root() ); var $list = $('li[class!=kmui-divider]', this.root());
var $node = $( '<li class="kmui-dropdown-submenu"><a tabindex="-1" href="#">' + label + '</a></li>' ).append( menu ); var $node = $('<li class="kmui-dropdown-submenu"><a tabindex="-1" href="#">' + label + '</a></li>').append(menu);
$node.data('widget',menu);
if ( index >= 0 && index < $list.length ) { if (index >= 0 && index < $list.length) {
$node.insertBefore( $list[ index ] ); $node.insertBefore($list[index]);
} else if ( index < 0 ) { } else if (index < 0) {
$node.insertBefore( $list[ 0 ] ); $node.insertBefore($list[0]);
} else if ( index >= $list.length ) { } else if (index >= $list.length) {
$node.appendTo( $list ); $node.appendTo($list);
} }
} }
}, 'menu' ); }, 'menu');
//splitbutton 类 //splitbutton 类
///import button ///import button
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<script src="social.js" charset="utf-8"></script> <script src="social.js" charset="utf-8"></script>
<script src="../kity/dist/kitygraph.all.js" charset="utf-8"></script> <script src="../kity/dist/kitygraph.all.js" charset="utf-8"></script>
<script src="../configure.js" charset="utf-8"></script> <script src="../configure.js" charset="utf-8"></script>
<script src="../dist/dev.php" charset="utf-8"></script> <script src="../dist/dev.js" charset="utf-8"></script>
<script src="../lang/zh-cn/zh-cn.js" charset="utf-8"></script> <script src="../lang/zh-cn/zh-cn.js" charset="utf-8"></script>
<link href="../themes/default/css/import.css" type="text/css" rel="stylesheet"> <link href="../themes/default/css/import.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="social.css"> <link rel="stylesheet" href="social.css">
......
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