roojs-bootstrap.js
authorjohn <john@roojs.com>
Fri, 28 Sep 2018 04:21:12 +0000 (12:21 +0800)
committerjohn <john@roojs.com>
Fri, 28 Sep 2018 04:21:12 +0000 (12:21 +0800)
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index abdddd6..d384d96 100644 (file)
@@ -2645,7 +2645,8 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
     size: '',
     
     max_width: 0,
-
+    
+    fit_content: false,
 
     onRender : function(ct, position)
     {
@@ -2832,20 +2833,32 @@ 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);
-            this.setSize(w, this.height || Roo.lib.Dom.getViewportHeight(true) - 60);
+            
             // for fix height
             if(this.height) {
                 this.setSize(w, this.height);
                 return;
             }
             
+            if(!this.fit_content) {
+                this.setSize(w, Roo.lib.Dom.getViewportHeight(true) - 60);
+            }
+            
             var body_childs = this.bodyEl.dom.childNodes;
             var full_height = this.headerEl.getHeight() + this.footerEl.getHeight();
             for(var i = 0; i < body_childs.length; i++) {
+                
+                if(body_childs[i].classList.indexOf('roo-layout-region') * 1 != -1) {
+                    var layout_childs = body_childs[i].childNodes;
+                    for(var j = 0; j < layout_childs.length; j++) {
+                
+                    }
+                }
+                
                 full_height += body_childs[i].offsetHeight;
             }
             
-            // this.setSize(w, Math.min(full_height, Roo.lib.Dom.getViewportHeight(true) - 60));
+            this.setSize(w, Math.min(full_height, Roo.lib.Dom.getViewportHeight(true) - 60));
         }
         
     },
@@ -34692,13 +34705,13 @@ Roo.extend(Roo.bootstrap.layout.Border, Roo.bootstrap.layout.Manager, {
     bindRegion : function(r){
         this.regions[r.config.region] = r;
         
-        // r.on("visibilitychange",    this.layout, this);
-        // r.on("paneladded",          this.layout, this);
-        // r.on("panelremoved",        this.layout, this);
-        // r.on("invalidated",         this.layout, this);
-        // r.on("resized",             this.onRegionResized, this);
-        // r.on("collapsed",           this.onRegionCollapsed, this);
-        // r.on("expanded",            this.onRegionExpanded, this);
+        r.on("visibilitychange",    this.layout, this);
+        r.on("paneladded",          this.layout, this);
+        r.on("panelremoved",        this.layout, this);
+        r.on("invalidated",         this.layout, this);
+        r.on("resized",             this.onRegionResized, this);
+        r.on("collapsed",           this.onRegionCollapsed, this);
+        r.on("expanded",            this.onRegionExpanded, this);
     },
 
     /**
index 56595de..e624873 100644 (file)
@@ -103,7 +103,7 @@ this.menu=this.addxtype(Roo.apply({},this.menu));}},onClick:function(e){Roo.log(
 // Roo/bootstrap/MenuSeparator.js
 Roo.bootstrap.MenuSeparator=function(A){Roo.bootstrap.MenuSeparator.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.MenuSeparator,Roo.bootstrap.Component,{getAutoCreate:function(){var A={cls:'divider',tag:'li'};return A;}});
 // Roo/bootstrap/Modal.js
-Roo.bootstrap.Modal=function(A){Roo.bootstrap.Modal.superclass.constructor.call(this,A);this.addEvents({"btnclick":true,"resize":true});this.buttons=this.buttons||[];if(this.tmpl){this.tmpl=Roo.factory(this.tmpl);}};Roo.extend(Roo.bootstrap.Modal,Roo.bootstrap.Component,{title:'test dialog',buttons:false,html:false,tmp:false,specificTitle:false,buttonPosition:'right',allow_close:true,animate:true,fitwindow:false,dialogEl:false,bodyEl:false,footerEl:false,titleEl:false,closeEl:false,size:'',max_width:0,onRender:function(ct,A){Roo.bootstrap.Component.superclass.onRender.call(this,ct,A);
+Roo.bootstrap.Modal=function(A){Roo.bootstrap.Modal.superclass.constructor.call(this,A);this.addEvents({"btnclick":true,"resize":true});this.buttons=this.buttons||[];if(this.tmpl){this.tmpl=Roo.factory(this.tmpl);}};Roo.extend(Roo.bootstrap.Modal,Roo.bootstrap.Component,{title:'test dialog',buttons:false,html:false,tmp:false,specificTitle:false,buttonPosition:'right',allow_close:true,animate:true,fitwindow:false,dialogEl:false,bodyEl:false,footerEl:false,titleEl:false,closeEl:false,size:'',max_width:0,fit_content:false,onRender:function(ct,A){Roo.bootstrap.Component.superclass.onRender.call(this,ct,A);
 if(!this.el){var B=Roo.apply({},this.getAutoCreate());B.id=Roo.id();if(this.cls){B.cls+=' '+this.cls;}if(this.style){B.style=this.style;}this.el=Roo.get(document.body).createChild(B,A);}if(this.tabIndex!==undefined){this.el.dom.setAttribute('tabIndex',this.tabIndex);
 }this.dialogEl=this.el.select('.modal-dialog',true).first();this.bodyEl=this.el.select('.modal-body',true).first();this.closeEl=this.el.select('.modal-header .close',true).first();this.headerEl=this.el.select('.modal-header',true).first();this.titleEl=this.el.select('.modal-title',true).first();
 this.footerEl=this.el.select('.modal-footer',true).first();this.maskEl=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-dlg-mask"},true);if(this.buttons.length){Roo.each(this.buttons,function(bb){var b=Roo.apply({},bb);b.xns=b.xns||Roo.bootstrap;b.xtype=b.xtype||'Button';
@@ -112,13 +112,14 @@ 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){var w=this.width||Roo.lib.Dom.getViewportWidth(true)-30;var h=this.height||Roo.lib.Dom.getViewportHeight(true)-60;
-this.setSize(w,h);}if(!this.fitwindow&&this.max_width!==0){var w=Math.min(this.max_width,Roo.lib.Dom.getViewportWidth(true)-30);this.setSize(w,this.height||Roo.lib.Dom.getViewportHeight(true)-60);if(this.height){this.setSize(w,this.height);return;}var A=this.bodyEl.dom.childNodes;
-var B=this.headerEl.getHeight()+this.footerEl.getHeight();for(var i=0;i<A.length;i++){B+=A[i].offsetHeight;}}},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);
+this.setSize(w,h);}if(!this.fitwindow&&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);
+}var A=this.bodyEl.dom.childNodes;var B=this.headerEl.getHeight()+this.footerEl.getHeight();for(var i=0;i<A.length;i++){if(A[i].classList.indexOf('roo-layout-region')*1!=-1){var C=A[i].childNodes;for(var j=0;j<C.length;j++){}}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'}
@@ -1465,7 +1466,8 @@ this.layout();},onRegionCollapsed:function(A){this.fireEvent("regioncollapsed",A
 }}});
 // Roo/bootstrap/layout/Border.js
 Roo.bootstrap.layout.Border=function(A){A=A||{};Roo.bootstrap.layout.Border.superclass.constructor.call(this,A);Roo.each(Roo.bootstrap.layout.Border.regions,function(B){if(A[B]){A[B].region=B;this.addRegion(A[B]);}},this);};Roo.bootstrap.layout.Border.regions=["north","south","east","west","center"];
-Roo.extend(Roo.bootstrap.layout.Border,Roo.bootstrap.layout.Manager,{addRegion:function(A){if(!this.regions[A.region]){var r=this.factory(A);this.bindRegion(r);}return this.regions[A.region];},bindRegion:function(r){this.regions[r.config.region]=r;},layout:function(){if(this.updating){return;
+Roo.extend(Roo.bootstrap.layout.Border,Roo.bootstrap.layout.Manager,{addRegion:function(A){if(!this.regions[A.region]){var r=this.factory(A);this.bindRegion(r);}return this.regions[A.region];},bindRegion:function(r){this.regions[r.config.region]=r;r.on("visibilitychange",this.layout,this);
+r.on("paneladded",this.layout,this);r.on("panelremoved",this.layout,this);r.on("invalidated",this.layout,this);r.on("resized",this.onRegionResized,this);r.on("collapsed",this.onRegionCollapsed,this);r.on("expanded",this.onRegionExpanded,this);},layout:function(){if(this.updating){return;
 }Roo.each(Roo.bootstrap.layout.Border.regions,function(N){if(this.regions[N]&&!this.regions[N].bodyEl){this.regions[N].onRender(this.el)}},this);var A=this.getViewSize();var w=A.width;var h=A.height;var B=w;var C=h;var D=0;var E=0;var rs=this.regions;var F=rs["north"];
 var G=rs["south"];var H=rs["west"];var I=rs["east"];var J=rs["center"];if(F&&F.isVisible()){var b=F.getBox();var m=F.getMargins();b.width=w-(m.left+m.right);b.x=m.left;b.y=m.top;D=b.height+b.y+m.bottom;C-=D;F.updateBox(this.safeBox(b));}if(G&&G.isVisible()){var b=G.getBox();
 var m=G.getMargins();b.width=w-(m.left+m.right);b.x=m.left;var K=(b.height+m.top+m.bottom);b.y=h-K+m.top;C-=K;G.updateBox(this.safeBox(b));}if(H&&H.isVisible()){var b=H.getBox();var m=H.getMargins();b.height=C-(m.top+m.bottom);b.x=m.left;b.y=D+m.top;var L=(b.width+m.left+m.right);