From ab54638359902a075b3ad2290d4cede3ff6191fb Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 11 Feb 2021 11:49:33 +0800 Subject: [PATCH] roojs-bootstrap.js roojs-bootstrap-debug.js --- roojs-bootstrap-debug.js | 30 ++++++++---------------------- roojs-bootstrap.js | 10 +++++----- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 5a8472bd94..9d4bfacd4f 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -19891,29 +19891,10 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, { this.headerEl.hide(); } - // why make it so complicated... - we used to support functional calls for this .. why ? - - - /* - var autoToken = /\s?auto?\s?/i; /// not sure how this was supposed to work? right auto ? what? - - // I think 'auto right' - but - - var autoPlace = autoToken.test(placement); - if (autoPlace) { - placement = placement.replace(autoToken, '') || 'top'; - } - */ - - + this.el.show(); - this.el.dom.style.display='block'; - - //this.el.appendTo(on_el); - - var p = this.getPosition(); - var box = this.el.getBox(); - + this.el.dom.style.display = 'block'; + this.el.addClass(placement + ' roo-popover-' + placement); @@ -19956,9 +19937,14 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, { */ updatePosition : function() { + this.el.addClass(placement + ' roo-popover-' + placement); + if (!this.alignEl || !this.alignment) { return; } + + + this.el.alignTo(this.alignEl , this.alignment[0],this.alignment[1]); // work out the pointy position. diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 857403a656..474beafc58 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -820,11 +820,11 @@ var B=this.trigger?this.trigger.split(' '):[];Roo.each(B,function(C){if(C=='clic }},this);},timeout:null,hoverState:null,toggle:function(){this.hoverState=='in'?this.leave():this.enter();},enter:function(){clearTimeout(this.timeout);this.hoverState='in';if(!this.delay||!this.delay.show){this.show();return;}var _t=this;this.timeout=setTimeout(function(){if(_t.hoverState=='in'){_t.show(); }},this.delay.show)},leave:function(){clearTimeout(this.timeout);this.hoverState='out';if(!this.delay||!this.delay.hide){this.hide();return;}var _t=this;this.timeout=setTimeout(function(){if(_t.hoverState=='out'){_t.hide();}},this.delay.hide)},show:function(A,B){this.placement=typeof(B)=='undefined'?this.placement:B; A=A||false;if(!A){if(this.parent()&&(this.over=='parent'||(this.over===false))){A=this.parent().el;}else if(this.over){Roo.get(this.over);}}if(!this.el){this.render(document.body);}this.el.removeClass(['fade','top','bottom','left','right','in','bs-popover-top','bs-popover-bottom','bs-popover-left','bs-popover-right']); -if(this.title===false){this.headerEl.hide();}this.el.show();this.el.dom.style.display='block';var p=this.getPosition();var C=this.el.getBox();this.el.addClass(B+' roo-popover-'+B);if(A){this.updatePosition();}else{var es=this.el.getSize();var x=Roo.lib.Dom.getViewWidth()/2; -var y=Roo.lib.Dom.getViewHeight()/2;this.el.setXY([x-(es.width/2),y-(es.height/2)]);}this.el.addClass('in');this.hoverState='in';if(this.modal){this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.maskEl.setStyle('z-index',Roo.bootstrap.Popover.zIndex++); -this.maskEl.dom.style.display='block';this.maskEl.addClass('show');}this.el.setStyle('z-index',Roo.bootstrap.Popover.zIndex++);this.fireEvent('show',this);},updatePosition:function(){if(!this.alignEl||!this.alignment){return;}this.el.alignTo(this.alignEl,this.alignment[0],this.alignment[1]); -var p1=this.alignment[0].split('-').pop().replace('?','');var xy=this.alignEl.getAnchorXY(p1,false);xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);},hide:function(){this.el.setXY([0,0]);this.el.removeClass('in');this.el.hide();this.hoverState=null;this.maskEl.hide(); -this.fireEvent('hide',this);}});Roo.apply(Roo.bootstrap.Popover,{alignment:{'left':['r-l',[-10,0],'left bs-popover-left'],'right':['l-br',[10,0],'right bs-popover-right'],'bottom':['t-b',[0,10],'top bs-popover-top'],'top':['b-t',[0,-10],'bottom bs-popover-bottom']} +if(this.title===false){this.headerEl.hide();}this.el.show();this.el.dom.style.display='block';this.el.addClass(B+' roo-popover-'+B);if(A){this.updatePosition();}else{var es=this.el.getSize();var x=Roo.lib.Dom.getViewWidth()/2;var y=Roo.lib.Dom.getViewHeight()/2; +this.el.setXY([x-(es.width/2),y-(es.height/2)]);}this.el.addClass('in');this.hoverState='in';if(this.modal){this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.maskEl.setStyle('z-index',Roo.bootstrap.Popover.zIndex++); +this.maskEl.dom.style.display='block';this.maskEl.addClass('show');}this.el.setStyle('z-index',Roo.bootstrap.Popover.zIndex++);this.fireEvent('show',this);},updatePosition:function(){this.el.addClass(placement+' roo-popover-'+placement);if(!this.alignEl||!this.alignment){return; +}this.el.alignTo(this.alignEl,this.alignment[0],this.alignment[1]);var p1=this.alignment[0].split('-').pop().replace('?','');var xy=this.alignEl.getAnchorXY(p1,false);xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);},hide:function(){this.el.setXY([0,0]);this.el.removeClass('in'); +this.el.hide();this.hoverState=null;this.maskEl.hide();this.fireEvent('hide',this);}});Roo.apply(Roo.bootstrap.Popover,{alignment:{'left':['r-l',[-10,0],'left bs-popover-left'],'right':['l-br',[10,0],'right bs-popover-right'],'bottom':['t-b',[0,10],'top bs-popover-top'],'top':['b-t',[0,-10],'bottom bs-popover-bottom']} ,zIndex:20001,clickHander:false,onMouseDown:function(e){if(!e.getTarget(".roo-popover")){this.hideAll();}},popups:[],register:function(A){if(!Roo.bootstrap.Popover.clickHandler){Roo.bootstrap.Popover.clickHandler=Roo.get(document).on("mousedown",Roo.bootstrap.Popover.onMouseDown,Roo.bootstrap.Popover); }this.hideAll();this.popups.push(A);},hideAll:function(){this.popups.forEach(function(p){p.hide();});}}); // Roo/bootstrap/PopoverNav.js -- 2.39.2