From 530d6650a75ea7b416a5ec6a065e4de2833d8007 Mon Sep 17 00:00:00 2001 From: john Date: Wed, 26 Sep 2018 11:22:22 +0800 Subject: [PATCH] Roo/bootstrap/Modal.js roojs-bootstrap.js roojs-bootstrap-debug.js --- Roo/bootstrap/Modal.js | 4 ++-- roojs-bootstrap-debug.js | 16 ++++++++++++---- roojs-bootstrap.js | 14 +++++++------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Roo/bootstrap/Modal.js b/Roo/bootstrap/Modal.js index e0df308ca4..51433b212f 100644 --- a/Roo/bootstrap/Modal.js +++ b/Roo/bootstrap/Modal.js @@ -280,9 +280,9 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component, { this.headerEl.getHeight() + this.bodyEl.getHeight() + this.footerEl.getHeight() - ) > Roo.lib.Dom.getViewportHeight(true) - 60) { + ) > view_height) { } { - this.setSize(w,Roo.lib.Dom.getViewportHeight(true) - 60); + this.setSize(w,view_height); } } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 8c2ee593f7..32e56823b3 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -2831,12 +2831,20 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component, { if(!this.fitwindow && this.max_width !== 0){ var w = Math.min(this.max_width, Roo.lib.Dom.getViewportWidth(true) - 30); + // var h = this.height || Roo.lib.Dom.getViewportHeight(true) - 60; + this.setSize(w,this.height); - Roo.log(this.height); - Roo.log(Roo.lib.Dom.getViewportHeight(true)); + var view_height = Roo.lib.Dom.getViewportHeight(true) - 60; - var h = this.height || Roo.lib.Dom.getViewportHeight(true) - 60; - this.setSize(w,h); + if( + ( + this.headerEl.getHeight() + + this.bodyEl.getHeight() + + this.footerEl.getHeight() + ) > view_height) { + } { + this.setSize(w,view_height); + } } }, diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 36fd472cb3..1e13137eea 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -112,13 +112,13 @@ for(var i=0;iA){} +{this.setSize(w,A);}}},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'} -- 2.39.2