roojs-bootstrap.js
authorAlan Knowles <alan@roojs.com>
Thu, 11 Feb 2021 04:10:58 +0000 (12:10 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 11 Feb 2021 04:10:58 +0000 (12:10 +0800)
roojs-bootstrap-debug.js
Roo/bootstrap/Popover.js

Roo/bootstrap/Popover.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 305e1a9..1f09e1c 100644 (file)
@@ -338,7 +338,8 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
      */
     updatePosition : function(placement, try_move)
     {
-        placement = placement
+        placement = placement === false ? this.placement : placement;
+        
         this.el.removeClass([
             'fade','top','bottom', 'left', 'right','in',
             'bs-popover-top','bs-popover-bottom', 'bs-popover-left', 'bs-popover-right'
index 85f9c9f..2f42775 100644 (file)
@@ -19895,7 +19895,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
         
  
         if (on_el) {
-            this.updatePosition(placement);
+            this.updatePosition(this.placement, true);
              
         } else {
             // this is usually just done by the builder = to show the popoup in the middle of the scren.
@@ -19929,11 +19929,13 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
     },
     /**
      * fire this manually after loading a grid in the table for example
-     * @param {string} (left|right|top|bottom) where to try and put it
+     * @param {string} (left|right|top|bottom) where to try and put it (use false to use the last one)
      * @param {Boolean} try and move it if we cant get right position.
      */
     updatePosition : function(placement, try_move)
     {
+        placement = placement === false ? this.placement : placement;
+        
         this.el.removeClass([
             'fade','top','bottom', 'left', 'right','in',
             'bs-popover-top','bs-popover-bottom', 'bs-popover-left', 'bs-popover-right'
index 4a62b51..eeda1f9 100644 (file)
@@ -820,14 +820,14 @@ 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);}if(this.title===false){this.headerEl.hide();}this.el.show();this.el.dom.style.display='block';
-if(A){this.updatePosition(B);}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(A,B){this.el.removeClass(['fade','top','bottom','left','right','in','bs-popover-top','bs-popover-bottom','bs-popover-left','bs-popover-right']);
-this.el.addClass(A+' roo-popover-'+A);if(!this.alignEl){return false;}switch(A){case 'right':var C=this.el.getAlignToXY(this.alignEl,'tl-tr',[10,0]);var D=this.el.getAlignToXY(this.alignEl,'tl-tr?',[10,0]);if(!B||C.equals(D)||C[0]==D[0]){this.setXY(D);var xy=this.alignEl.getAnchorXY('tr',false);
-xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);return true;}B=false;case 'left':var C=this.el.getAlignToXY(this.alignEl,'tr-tl',[-10,0]);var D=this.el.getAlignToXY(this.alignEl,'tr-tl?',[-10,0]);if(!B||C.equals(D)||C[0]==D[0]){this.setXY(D);var xy=this.alignEl.getAnchorXY('tl',false);
-xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);return true;}return this.updatePosition('right',false);case 'top':var C=this.el.getAlignToXY(this.alignEl,'t-b',[0,-10]);var D=this.el.getAlignToXY(this.alignEl,'t-b?',[0,-10]);if(!B||C.equals(D)||C[1]==D[1]){this.setXY(D);
-var xy=this.alignEl.getAnchorXY('b',false);xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);return true;}B=false;case 'bottom':var C=this.el.getAlignToXY(this.alignEl,'b-t',[0,10]);var D=this.el.getAlignToXY(this.alignEl,'b-t?',[0,10]);if(!B||C.equals(D)||C[1]==D[1]){this.setXY(D);
-var xy=this.alignEl.getAnchorXY('t',false);xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);return true;}return this.updatePosition('top',false);}return false;},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(A){this.updatePosition(this.placement,true);}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(A,B){A=A===false?this.placement:A;
+this.el.removeClass(['fade','top','bottom','left','right','in','bs-popover-top','bs-popover-bottom','bs-popover-left','bs-popover-right']);this.el.addClass(A+' roo-popover-'+A);if(!this.alignEl){return false;}switch(A){case 'right':var C=this.el.getAlignToXY(this.alignEl,'tl-tr',[10,0]);
+var D=this.el.getAlignToXY(this.alignEl,'tl-tr?',[10,0]);if(!B||C.equals(D)||C[0]==D[0]){this.setXY(D);var xy=this.alignEl.getAnchorXY('tr',false);xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);return true;}B=false;case 'left':var C=this.el.getAlignToXY(this.alignEl,'tr-tl',[-10,0]);
+var D=this.el.getAlignToXY(this.alignEl,'tr-tl?',[-10,0]);if(!B||C.equals(D)||C[0]==D[0]){this.setXY(D);var xy=this.alignEl.getAnchorXY('tl',false);xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);return true;}return this.updatePosition('right',false);case 'top':var C=this.el.getAlignToXY(this.alignEl,'t-b',[0,-10]);
+var D=this.el.getAlignToXY(this.alignEl,'t-b?',[0,-10]);if(!B||C.equals(D)||C[1]==D[1]){this.setXY(D);var xy=this.alignEl.getAnchorXY('b',false);xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);return true;}B=false;case 'bottom':var C=this.el.getAlignToXY(this.alignEl,'b-t',[0,10]);
+var D=this.el.getAlignToXY(this.alignEl,'b-t?',[0,10]);if(!B||C.equals(D)||C[1]==D[1]){this.setXY(D);var xy=this.alignEl.getAnchorXY('t',false);xy[0]+=2;xy[1]+=5;this.arrowEl.setXY(xy);return true;}return this.updatePosition('top',false);}return false;},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