From 68c3df56d3855637b600683bb1593f0085bac033 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 1 Feb 2021 14:50:04 +0800 Subject: [PATCH] roojs-bootstrap.js roojs-bootstrap-debug.js Roo/bootstrap/NavItem.js --- Roo/bootstrap/NavItem.js | 6 +++--- roojs-bootstrap-debug.js | 2 +- roojs-bootstrap.js | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Roo/bootstrap/NavItem.js b/Roo/bootstrap/NavItem.js index b19a87897e..bd5d114b34 100644 --- a/Roo/bootstrap/NavItem.js +++ b/Roo/bootstrap/NavItem.js @@ -180,9 +180,9 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { this.el.select('.nav-item',true).on('click', this.onClick, this); - if(this.tagtype == 'span'){ - this.el.select('span',true).on('click', this.onClick, this); - } + //if(this.tagtype == 'span'){ + // this.el.select('span',true).on('click', this.onClick, this); + //} // at this point parent should be available.. this.parent().register(this); diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 974748e0f5..48983e6565 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -6195,7 +6195,7 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { this.menu = this.addxtype(Roo.apply({}, this.menu)); } - this.el.select('a',true).on('click', this.onClick, this); + this.el.select('.nav-item',true).on('click', this.onClick, this); if(this.tagtype == 'span'){ this.el.select('span',true).on('click', this.onClick, this); diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 78eb4c901d..7f68aa0070 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -255,10 +255,10 @@ if(this.href){A.href=this.href;}if(this.fa){A.html=' '+A.cn[0].html+'';}if(this.fa){A.cn[0].html=' '+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;},onRender:function(ct,A){if(Roo.bootstrap.version==4&&ct.dom.type!='ul'){this.tag='div';}var B=Roo.bootstrap.NavItem.superclass.onRender.call(this,ct,A);this.navLink=this.el.select('.nav-link',true).first();return B;},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(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&&p.pilltype){if(typeof(p.setActiveItem)!=='undefined'){p.setActiveItem(this);}}if(p.parentType=='NavHeaderbar'&&!this.menu){p.parent().el.select('.roo-navbar-collapse',true).removeClass('in'); +this.menu.triggerEl=this.el;this.menu=this.addxtype(Roo.apply({},this.menu));}this.el.select('.nav-item',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(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&&p.pilltype){if(typeof(p.setActiveItem)!=='undefined'){p.setActiveItem(this);}}if(p.parentType=='NavHeaderbar'&&!this.menu){p.parent().el.select('.roo-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');this.navLink?this.navLink.removeClass('active'):false; }else if(!this.el.hasClass('active')){this.el.addClass('active');if(Roo.bootstrap.version==4&&this.navLink){this.navLink.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'); -- 2.39.2