From: Alan Knowles Date: Thu, 1 Dec 2016 01:57:46 +0000 (+0800) Subject: sync X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=10e03422f03d0407d2f24efe6082580b2b460d2b sync --- diff --git a/Roo/bootstrap/MenuItem.js b/Roo/bootstrap/MenuItem.js index 9b3b502b4d..5c24fcd510 100644 --- a/Roo/bootstrap/MenuItem.js +++ b/Roo/bootstrap/MenuItem.js @@ -16,6 +16,7 @@ * @cfg {Boolean} isContainer is it a container - just returns a drop down item.. * @cfg {Boolean} active used on sidebars to highlight active itesm * @cfg {String} fa favicon to show on left of menu item. + * @cfg {Roo.bootsrap.Menu} menu the child menu. * * * @constructor @@ -95,10 +96,16 @@ Roo.extend(Roo.bootstrap.MenuItem, Roo.bootstrap.Component, { return cfg; }, - initEvents: function() { + initEvents: function() + { if (this.parent().type == 'treeview') { this.el.select('a').on('click', this.onClick, this); } + if (this.menu) { + this.menu.parentType = this.xtype; + this.menu.triggerEl = this.el; + this.menu = this.addxtype(Roo.apply({}, this.menu)); + } }, onClick : function(e) diff --git a/Roo/bootstrap/MenuMgr.js b/Roo/bootstrap/MenuMgr.js index 41f81e4d60..09970bc00f 100644 --- a/Roo/bootstrap/MenuMgr.js +++ b/Roo/bootstrap/MenuMgr.js @@ -90,8 +90,9 @@ Roo.bootstrap.MenuMgr = function(){ // private this should really trigger on mouseup.. function onMouseDown(e){ Roo.log("on Mouse Up"); - if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".x-menu") && !e.getTarget('.user-menu')){ - Roo.log("hideAll"); + + if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".dropdown-menu") && !e.getTarget('.user-menu')){ + Roo.log("MenuManager hideAll"); hideAll(); e.stopEvent(); } diff --git a/Roo/bootstrap/NavItem.js b/Roo/bootstrap/NavItem.js index bd1c06e613..a0dcf893ac 100644 --- a/Roo/bootstrap/NavItem.js +++ b/Roo/bootstrap/NavItem.js @@ -141,11 +141,16 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { onClick : function(e) { + if (e.getTarget('.dropdown-menu-item')) { + // did you click on a menu itemm.... - then don't trigger onclick.. + return; + } + if( this.preventDefault || this.href == '#' ){ - + Roo.log("NavItem - prevent Default?"); e.preventDefault(); } @@ -179,7 +184,7 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { if (ael.dom.href.split("#")[0] != document.location.toString().split("#")[0]) { return; // ignore... - it's a 'hash' to another page. } - + Roo.log("NavItem - prevent Default?"); e.preventDefault(); this.scrollToElement(e); } diff --git a/docs/symbols/_calls.html b/docs/symbols/_calls.html index d3c975e1c7..12ca54af38 100644 --- a/docs/symbols/_calls.html +++ b/docs/symbols/_calls.html @@ -2824,7 +2824,7 @@
- Documentation generated by Introspection Doc Generator on Fri Sep 09 2016 14:38:15 GMT+0800 (HKT) + Documentation generated by Introspection Doc Generator on Fri Sep 09 2016 15:45:35 GMT+0800 (HKT) Based on JsDoc Toolkit
diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 955f84f5f3..f1e4aa93db 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -1745,8 +1745,9 @@ Roo.bootstrap.MenuMgr = function(){ // private this should really trigger on mouseup.. function onMouseDown(e){ Roo.log("on Mouse Up"); - if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".x-menu") && !e.getTarget('.user-menu')){ - Roo.log("hideAll"); + + if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".dropdown-menu") && !e.getTarget('.user-menu')){ + Roo.log("MenuManager hideAll"); hideAll(); e.stopEvent(); } @@ -2240,6 +2241,7 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component, { * @cfg {Boolean} isContainer is it a container - just returns a drop down item.. * @cfg {Boolean} active used on sidebars to highlight active itesm * @cfg {String} fa favicon to show on left of menu item. + * @cfg {Roo.bootsrap.Menu} menu the child menu. * * * @constructor @@ -2319,10 +2321,16 @@ Roo.extend(Roo.bootstrap.MenuItem, Roo.bootstrap.Component, { return cfg; }, - initEvents: function() { + initEvents: function() + { if (this.parent().type == 'treeview') { this.el.select('a').on('click', this.onClick, this); } + if (this.menu) { + this.menu.parentType = this.xtype; + this.menu.triggerEl = this.el; + this.menu = this.addxtype(Roo.apply({}, this.menu)); + } }, onClick : function(e) @@ -4212,11 +4220,16 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { onClick : function(e) { + if (e.getTarget('.dropdown-menu-item')) { + // did you click on a menu itemm.... - then don't trigger onclick.. + return; + } + if( this.preventDefault || this.href == '#' ){ - + Roo.log("NavItem - prevent Default?"); e.preventDefault(); } @@ -4250,7 +4263,7 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { if (ael.dom.href.split("#")[0] != document.location.toString().split("#")[0]) { return; // ignore... - it's a 'hash' to another page. } - + Roo.log("NavItem - prevent Default?"); e.preventDefault(); this.scrollToElement(e); } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 19f9c8110d..e220324718 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -69,7 +69,7 @@ Roo.bootstrap.Header=function(A){Roo.bootstrap.Header.superclass.constructor.cal Roo.bootstrap.MenuMgr=function(){var A,B,C={},D=false,E=new Date();function init(){A={};B=new Roo.util.MixedCollection();Roo.get(document).addKeyListener(27,function(){if(B.length>0){hideAll();}});}function hideAll(){if(B&&B.length>0){var c=B.clone();c.each(function(m){m.hide(); });}}function onHide(m){B.remove(m);if(B.length<1){Roo.get(document).un("mouseup",onMouseDown);D=false;}}function onShow(m){var F=B.last();E=new Date();B.add(m);if(!D){Roo.get(document).on("mouseup",onMouseDown);D=true;}if(m.parentMenu){m.parentMenu.activeChild=m; }else if(F&&F.isVisible()){}}function onBeforeHide(m){if(m.activeChild){m.activeChild.hide();}if(m.autoHideTimer){clearTimeout(m.autoHideTimer);delete m.autoHideTimer;}}function onBeforeShow(m){var pm=m.parentMenu;if(!pm&&!m.allowOtherMenus){hideAll();}else if(pm&&pm.activeChild&&B!=m){pm.activeChild.hide(); -}}function onMouseDown(e){Roo.log("on Mouse Up");if(E.getElapsed()>50&&B.length>0&&!e.getTarget(".x-menu")&&!e.getTarget('.user-menu')){Roo.log("hideAll");hideAll();e.stopEvent();}}function onBeforeCheck(mi,F){if(F){var g=C[mi.group];for(var i=0,l=g.length; +}}function onMouseDown(e){Roo.log("on Mouse Up");if(E.getElapsed()>50&&B.length>0&&!e.getTarget(".dropdown-menu")&&!e.getTarget('.user-menu')){Roo.log("MenuManager hideAll");hideAll();e.stopEvent();}}function onBeforeCheck(mi,F){if(F){var g=C[mi.group];for(var i=0,l=g.length; i '+A.cn[0].html+''} if(this.glyphicon){A.cn[0].html=' '+A.cn[0].html;}if(this.menu){A.cn[0].html+=" ";}if(this.badge!==''){A.cn[0].html+=' '+this.badge+'';}}return A; },initEvents:function(){if(typeof(this.menu)!='undefined'){this.menu.parentType=this.xtype;this.menu.triggerEl=this.el;this.menu=this.addxtype(Roo.apply({},this.menu));}this.el.select('a',true).on('click',this.onClick,this);if(this.tagtype=='span'){this.el.select('span',true).on('click',this.onClick,this); -}this.parent().register(this);},onClick:function(e){if(this.preventDefault||this.href=='#'){e.preventDefault();}if(this.disabled){return;}var tg=Roo.bootstrap.TabGroup.get(this.navId);if(tg&&tg.transition){Roo.log("waiting for the transitionend");return;} -if(this.fireEvent('click',this,e)===false){return;};if(this.tagtype=='span'){return;}var A=this.el.select('a',true).first();if(A&&this.animateRef&&this.href.indexOf('#')>-1){if(A.dom.href.split("#")[0]!=document.location.toString().split("#")[0]){return;} -e.preventDefault();this.scrollToElement(e);}var p=this.parent();if(['tabs','pills'].indexOf(p.type)!==-1){if(typeof(p.setActiveItem)!=='undefined'){p.setActiveItem(this);}}if(p.parentType=='NavHeaderbar'&&!this.menu){p.parent().el.select('.navbar-collapse',true).removeClass('in'); +}this.parent().register(this);},onClick:function(e){if(e.getTarget('.dropdown-menu-item')){return;}if(this.preventDefault||this.href=='#'){Roo.log("NavItem - prevent Default?");e.preventDefault();}if(this.disabled){return;}var tg=Roo.bootstrap.TabGroup.get(this.navId); +if(tg&&tg.transition){Roo.log("waiting for the transitionend");return;}if(this.fireEvent('click',this,e)===false){return;};if(this.tagtype=='span'){return;}var A=this.el.select('a',true).first();if(A&&this.animateRef&&this.href.indexOf('#')>-1){if(A.dom.href.split("#")[0]!=document.location.toString().split("#")[0]){return; +}Roo.log("NavItem - prevent Default?");e.preventDefault();this.scrollToElement(e);}var p=this.parent();if(['tabs','pills'].indexOf(p.type)!==-1){if(typeof(p.setActiveItem)!=='undefined'){p.setActiveItem(this);}}if(p.parentType=='NavHeaderbar'&&!this.menu){p.parent().el.select('.navbar-collapse',true).removeClass('in'); }},isActive:function(){return this.active},setActive:function(A,B,C){if(this.active&&!A&&this.navId){this.was_active=true;var nv=Roo.bootstrap.NavGroup.get(this.navId);if(nv){nv.clearWasActive(this);}}this.active=A;if(!A){this.el.removeClass('active');}else if(!this.el.hasClass('active')){this.el.addClass('active'); }if(B){this.fireEvent('changed',this,A);}if(!this.navId||!this.tabId||!A||C){return;}var tg=Roo.bootstrap.TabGroup.get(this.navId);if(!tg){return;}var D=tg.getPanelByName(this.tabId);if(!D){return;}if(false==tg.showPanel(D)){var nv=Roo.bootstrap.NavGroup.get(this.navId); if(nv){var E=nv.getWasActive();if(E){E.setActive(true,false,true);}}}},setDisabled:function(A){this.disabled=A;if(!A){this.el.removeClass('disabled');}else if(!this.el.hasClass('disabled')){this.el.addClass('disabled');}},tooltipEl:function(){return this.el.select(''+this.tagtype+'',true).first();