sync
authorjohn <john@roojs.com>
Tue, 2 Oct 2018 05:07:50 +0000 (13:07 +0800)
committerjohn <john@roojs.com>
Tue, 2 Oct 2018 05:07:50 +0000 (13:07 +0800)
Roo/bootstrap/Modal.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 0c2816a..9a526fa 100644 (file)
@@ -278,11 +278,22 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
             
             var w = Math.min(this.max_width, Roo.lib.Dom.getViewportWidth(true) - 30);
             
-            if(this.height) {
+            if(
+                this.height &&
+                this.height <= Roo.lib.Dom.getViewportHeight(true) - 60
+            ) {
                 this.setSize(w, this.height);
                 return;
             }
             
+            if(
+                this.height &&
+                this.height > Roo.lib.Dom.getViewportHeight(true) - 60
+            ) {
+                this.setSize(w, Roo.lib.Dom.getViewportHeight(true) - 60);
+                return;
+            }
+            
             if(!this.fit_content) {
                 this.setSize(w, Roo.lib.Dom.getViewportHeight(true) - 60);
                 return;
index b8c816b..70aaa9c 100644 (file)
@@ -2839,11 +2839,22 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
             
             var w = Math.min(this.max_width, Roo.lib.Dom.getViewportWidth(true) - 30);
             
-            if(this.height) {
+            if(
+                this.height &&
+                this.height <= Roo.lib.Dom.getViewportHeight(true) - 60
+            ) {
                 this.setSize(w, this.height);
                 return;
             }
             
+            if(
+                this.height &&
+                this.height > Roo.lib.Dom.getViewportHeight(true) - 60
+            ) {
+                this.setSize(w, Roo.lib.Dom.getViewportHeight(true) - 60);
+                return;
+            }
+            
             if(!this.fit_content) {
                 this.setSize(w, Roo.lib.Dom.getViewportHeight(true) - 60);
                 return;
index 6dcc698..8c2b7c0 100644 (file)
@@ -112,17 +112,18 @@ for(var i=0;i<D.length;i++){C.push(this.addxtype(Roo.apply({},D[i])));}}this.ite
 };var C=[];if(this.allow_close){C.push({tag:'button',cls:'close',html:'&times'});}C.push(B);var D='';if(this.size.length){D='modal-'+this.size;}var E={cls:"modal",cn:[{cls:"modal-dialog "+D,cn:[{cls:"modal-content",cn:[{cls:'modal-header',cn:C},A,{cls:'modal-footer',cn:[{tag:'div',cls:'btn-'+this.buttonPosition}
 ]}]}]}]};if(this.animate){E.cls+=' fade';}return E;},getChildContainer:function(){return this.bodyEl;},getButtonContainer:function(){return this.el.select('.modal-footer div',true).first();},initEvents:function(){if(this.allow_close){this.closeEl.on('click',this.hide,this);
 }Roo.EventManager.onWindowResize(this.resize,this,true);},resize:function(){this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));if(this.fitwindow){this.setSize(this.width||Roo.lib.Dom.getViewportWidth(true)-30,this.height||Roo.lib.Dom.getViewportHeight(true)-60);
-return;}if(this.max_width!==0){var w=Math.min(this.max_width,Roo.lib.Dom.getViewportWidth(true)-30);if(this.height){this.setSize(w,this.height);return;}if(!this.fit_content){this.setSize(w,Roo.lib.Dom.getViewportHeight(true)-60);return;}var A=this.bodyEl.dom.childNodes;
-var B=60+this.headerEl.getHeight()+this.footerEl.getHeight();for(var i=0;i<A.length;i++){B+=A[i].offsetHeight;}this.setSize(w,Math.min(B,Roo.lib.Dom.getViewportHeight(true)-60));}},setSize:function(w,h){if(!w&&!h){return;}this.resizeTo(w,h);},show:function(){if(!this.rendered){this.render();
-}this.el.removeClass('hideing');this.el.addClass('show');if(this.animate){var A=this;(function(){this.el.addClass('in');}).defer(50,this);}else{this.el.addClass('in');}Roo.get(document.body).addClass("x-body-masked");this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));
-this.maskEl.setStyle('z-index',Roo.bootstrap.Modal.zIndex++);this.maskEl.addClass('show');this.resize();this.fireEvent('show',this);this.el.setStyle('z-index',Roo.bootstrap.Modal.zIndex++);(function(){this.items.forEach(function(e){e.layout?e.layout():false;
-});}).defer(100,this);},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.maskEl.removeClass('show');Roo.get(document.body).removeClass("x-body-masked");this.el.removeClass('in');this.el.select('.modal-dialog',true).first().setStyle('transform','');
-if(this.animate){this.el.addClass('hideing');(function(){if(!this.el.hasClass('hideing')){return;}this.el.removeClass('show');this.el.removeClass('hideing');}).defer(150,this);}else{this.el.removeClass('show');}this.fireEvent('hide',this);}},isVisible:function(){return this.el.hasClass('show')&&!this.el.hasClass('hideing');
-},addButton:function(A,cb){var b=Roo.apply({},{html:A});b.xns=b.xns||Roo.bootstrap;b.xtype=b.xtype||'Button';if(typeof(b.listeners)=='undefined'){b.listeners={click:cb.createDelegate(this)};}var B=Roo.factory(b);B.render(this.el.select('.modal-footer div').first());
-return B;},setDefaultButton:function(A){},diff:false,resizeTo:function(w,h){this.dialogEl.setWidth(w);if(this.diff===false){this.diff=this.dialogEl.getHeight()-this.bodyEl.getHeight();}this.bodyEl.setHeight(h-this.diff);this.fireEvent('resize',this);},setContentSize:function(w,h){}
-,onButtonClick:function(A,e){this.fireEvent('btnclick',A.name,e);},setTitle:function(A){this.titleEl.dom.innerHTML=A;},setBody:function(A){this.bodyEl.dom.innerHTML=A;},applyBody:function(A){if(!this.tmpl){Roo.log("Error - using apply Body without a template");
-}this.tmpl.overwrite(this.bodyEl,A);}});Roo.apply(Roo.bootstrap.Modal,{OK:[{name:'ok',weight:'primary',html:'OK'}],YESNO:[{name:'no',html:'No'},{name:'yes',weight:'primary',html:'Yes'}],OKCANCEL:[{name:'cancel',html:'Cancel'},{name:'ok',weight:'primary',html:'OK'}
-],YESNOCANCEL:[{name:'yes',weight:'primary',html:'Yes'},{name:'no',html:'No'},{name:'cancel',html:'Cancel'}],zIndex:10001});
+return;}if(this.max_width!==0){var w=Math.min(this.max_width,Roo.lib.Dom.getViewportWidth(true)-30);if(this.height&&this.height<=Roo.lib.Dom.getViewportHeight(true)-60){this.setSize(w,this.height);return;}if(this.height&&this.height>Roo.lib.Dom.getViewportHeight(true)-60){this.setSize(w,Roo.lib.Dom.getViewportHeight(true)-60);
+return;}if(!this.fit_content){this.setSize(w,Roo.lib.Dom.getViewportHeight(true)-60);return;}var A=this.bodyEl.dom.childNodes;var B=60+this.headerEl.getHeight()+this.footerEl.getHeight();for(var i=0;i<A.length;i++){B+=A[i].offsetHeight;}this.setSize(w,Math.min(B,Roo.lib.Dom.getViewportHeight(true)-60));
+}},setSize:function(w,h){if(!w&&!h){return;}this.resizeTo(w,h);},show:function(){if(!this.rendered){this.render();}this.el.removeClass('hideing');this.el.addClass('show');if(this.animate){var A=this;(function(){this.el.addClass('in');}).defer(50,this);}else{this.el.addClass('in');
+}Roo.get(document.body).addClass("x-body-masked");this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.maskEl.setStyle('z-index',Roo.bootstrap.Modal.zIndex++);this.maskEl.addClass('show');this.resize();this.fireEvent('show',this);
+this.el.setStyle('z-index',Roo.bootstrap.Modal.zIndex++);(function(){this.items.forEach(function(e){e.layout?e.layout():false;});}).defer(100,this);},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.maskEl.removeClass('show');Roo.get(document.body).removeClass("x-body-masked");
+this.el.removeClass('in');this.el.select('.modal-dialog',true).first().setStyle('transform','');if(this.animate){this.el.addClass('hideing');(function(){if(!this.el.hasClass('hideing')){return;}this.el.removeClass('show');this.el.removeClass('hideing');}).defer(150,this);
+}else{this.el.removeClass('show');}this.fireEvent('hide',this);}},isVisible:function(){return this.el.hasClass('show')&&!this.el.hasClass('hideing');},addButton:function(A,cb){var b=Roo.apply({},{html:A});b.xns=b.xns||Roo.bootstrap;b.xtype=b.xtype||'Button';
+if(typeof(b.listeners)=='undefined'){b.listeners={click:cb.createDelegate(this)};}var B=Roo.factory(b);B.render(this.el.select('.modal-footer div').first());return B;},setDefaultButton:function(A){},diff:false,resizeTo:function(w,h){this.dialogEl.setWidth(w);
+if(this.diff===false){this.diff=this.dialogEl.getHeight()-this.bodyEl.getHeight();}this.bodyEl.setHeight(h-this.diff);this.fireEvent('resize',this);},setContentSize:function(w,h){},onButtonClick:function(A,e){this.fireEvent('btnclick',A.name,e);},setTitle:function(A){this.titleEl.dom.innerHTML=A;
+},setBody:function(A){this.bodyEl.dom.innerHTML=A;},applyBody:function(A){if(!this.tmpl){Roo.log("Error - using apply Body without a template");}this.tmpl.overwrite(this.bodyEl,A);}});Roo.apply(Roo.bootstrap.Modal,{OK:[{name:'ok',weight:'primary',html:'OK'}
+],YESNO:[{name:'no',html:'No'},{name:'yes',weight:'primary',html:'Yes'}],OKCANCEL:[{name:'cancel',html:'Cancel'},{name:'ok',weight:'primary',html:'OK'}],YESNOCANCEL:[{name:'yes',weight:'primary',html:'Yes'},{name:'no',html:'No'},{name:'cancel',html:'Cancel'}
+],zIndex:10001});
 // Roo/bootstrap/MessageBox.js
 Roo.bootstrap.MessageBox=function(){var A,B,C,D;var E,F,G,H,I,pp;var J,K,L;var M=function(Q){A.hide();Roo.callback(B.fn,B.scope||window,[Q,K.dom.value],1);};var N=function(){if(B&&B.cls){A.el.removeClass(B.cls);}};var O=function(b){var Q=0;if(!b){J["ok"].hide();
 J["cancel"].hide();J["yes"].hide();J["no"].hide();return Q;}A.footerEl.dom.style.display='';for(var k in J){if(typeof J[k]!="function"){if(b[k]){J[k].show();J[k].setText(typeof b[k]=="string"?b[k]:Roo.bootstrap.MessageBox.buttonText[k]);Q+=J[k].el.getWidth()+15;