sync
authorAlan Knowles <alan@roojs.com>
Thu, 8 Sep 2016 13:20:22 +0000 (21:20 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 8 Sep 2016 13:20:22 +0000 (21:20 +0800)
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 24193d8..885b643 100644 (file)
@@ -228,7 +228,7 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
         return ret;
     },
     
-    addxtypeChild : function (tree, cntr)
+    addxtypeChild : function (tree, cntr, is_body)
     {
         Roo.debug && Roo.log('addxtypeChild:' + cntr);
         var cn = this;
@@ -242,7 +242,7 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
         
          skip_children = false;
         // render the element if it's not BODY.
-        if (tree.xtype != 'Body') {
+        if ((!is_body) {
            
             cn = Roo.factory(tree);
            
index d9ab6ed..1fd48b7 100644 (file)
@@ -1,17 +1,19 @@
 // Roo/bootstrap/Component.js
 Roo.bootstrap=Roo.bootstrap||{};Roo.bootstrap.Component=function(A){Roo.bootstrap.Component.superclass.constructor.call(this,A);this.addEvents({"childrenrendered":true});};Roo.extend(Roo.bootstrap.Component,Roo.BoxComponent,{allowDomMove:false,cls:false,style:false,autoCreate:false,tooltip:null,initEvents:function(){}
-,xattr:false,parentId:false,can_build_overlaid:true,container_method:false,dataId:false,name:false,parent:function(){return Roo.ComponentMgr.get(this.parentId)},onRender:function(ct,A){Roo.bootstrap.Component.superclass.onRender.call(this,ct,A);if(this.el){if(this.el.attr('xtype')){this.el.attr('xtypex',this.el.attr('xtype'));
-this.el.dom.removeAttribute('xtype');this.initEvents();}return;}var B=Roo.apply({},this.getAutoCreate());B.id=this.id||Roo.id();if(this.xattr&&typeof(this.xattr)=='object'){for(var i in this.xattr){B[i]=this.xattr[i];}}if(this.dataId){B.dataId=this.dataId;
-}if(this.cls){B.cls=(typeof(B.cls)=='undefined')?this.cls:B.cls+' '+this.cls;}if(this.style){B.style=this.style;}if(this.name){B.name=this.name;}this.el=ct.createChild(B,A);if(this.tooltip){this.tooltipEl().attr('tooltip',this.tooltip);}if(this.tabIndex!==undefined){this.el.dom.setAttribute('tabIndex',this.tabIndex);
-}this.initEvents();},getChildContainer:function(){return this.el;},tooltipEl:function(){return this.el;},addxtype:function(A,B){var cn=this;cn=Roo.factory(A);cn.parentType=this.xtype;cn.parentId=this.id;B=(typeof(B)=='undefined')?'getChildContainer':B;if(typeof(cn.container_method)=='string'){B=cn.container_method;
-}var C=(typeof(A['flexy:foreach'])!='undefined');var D=(typeof(A['flexy:if'])!='undefined');var E=Roo.XComponent.build_from_html;var F=(A.xtype=='Body');var G=(Roo.get(document.body).attr('xtype')=='Roo.bootstrap.Body');var H=Roo.get(this[B](false));if((C||D||this.can_build_overlaid==false)&&E){return false;
-}if(!C||!E||F||!G){if(!D||typeof(A.name)=='undefined'||!E||F||!G){return this.addxtypeChild(A,B);}var I=H?H.child('>*[name='+A.name+']'):false;if(I){return this.addxtypeChild(Roo.apply({},A),B);}Roo.log('skipping render');return cn;}var J=false;if(!E){return false;
-}while(true){var I=H?H.child('>*[xtype]'):false;if(!I){break;}if(I&&I.attr('xtype').split('.').pop()!=cn.xtype){break;}J=this.addxtypeChild(Roo.apply({},A),B);}return J;},addxtypeChild:function(A,B){Roo.debug&&Roo.log('addxtypeChild:'+B);var cn=this;B=(typeof(B)=='undefined')?'getChildContainer':B;
-var C=(typeof(A['flexy:if'])!='undefined')||(typeof(A['flexy:foreach'])!='undefined');skip_children=false;if(A.xtype!='Body'){cn=Roo.factory(A);cn.parentType=this.xtype;cn.parentId=this.id;var D=Roo.XComponent.build_from_html;if(D&&Roo.get(document.body).attr('xtype')=='Roo.bootstrap.Body'){var E=Roo.get(this[B](false));
-var F=E?E.child('>*[xtype]'):false;if(F){}if(F&&F.attr('xtype').split('.').pop()==cn.xtype){cn.el=F;}else{Roo.debug&&Roo.log("MISSING "+cn.xtype+" on child of "+(this.el?this.el.attr('xbuilderid'):'no parent'));Roo.debug&&Roo.log(E);Roo.debug&&Roo.log(F);
-Roo.debug&&Roo.log(cn);}}if(D&&C&&!cn.el&&cn.can_build_overlaid){Roo.debug&&Roo.log('skipping render');Roo.debug&&Roo.log(A);if(!cn.el){Roo.debug&&Roo.log('skipping all children');skip_children=true;}}else{cn.render(this[B](true));}}var G=[];if(!A.items||!A.items.length){cn.items=G;
-return cn;}var H=A.items;delete A.items;if(!skip_children){for(var i=0;i<H.length;i++){G.push(cn.addxtype(Roo.apply({},H[i])));}}cn.items=G;this.fireEvent('childrenrendered',this);return cn;},show:function(){if(this.el){this.el.removeClass('hidden');}},hide:function(){if(this.el&&!this.el.hasClass('hidden')){this.el.addClass('hidden');
-}}});
+,xattr:false,parentId:false,can_build_overlaid:true,container_method:false,dataId:false,name:false,parent:function(){return Roo.ComponentMgr.get(this.parentId)},onRender:function(ct,position){Roo.bootstrap.Component.superclass.onRender.call(this,ct,position);
+if(this.el){if(this.el.attr('xtype')){this.el.attr('xtypex',this.el.attr('xtype'));this.el.dom.removeAttribute('xtype');this.initEvents();}return;}var cfg=Roo.apply({},this.getAutoCreate());cfg.id=this.id||Roo.id();if(this.xattr&&typeof(this.xattr)=='object'){for(var i in this.xattr){cfg[i]=this.xattr[i];
+}}if(this.dataId){cfg.dataId=this.dataId;}if(this.cls){cfg.cls=(typeof(cfg.cls)=='undefined')?this.cls:cfg.cls+' '+this.cls;}if(this.style){cfg.style=this.style;}if(this.name){cfg.name=this.name;}this.el=ct.createChild(cfg,position);if(this.tooltip){this.tooltipEl().attr('tooltip',this.tooltip);
+}if(this.tabIndex!==undefined){this.el.dom.setAttribute('tabIndex',this.tabIndex);}this.initEvents();},getChildContainer:function(){return this.el;},tooltipEl:function(){return this.el;},addxtype:function(tree,cntr){var cn=this;cn=Roo.factory(tree);cn.parentType=this.xtype;
+cn.parentId=this.id;cntr=(typeof(cntr)=='undefined')?'getChildContainer':cntr;if(typeof(cn.container_method)=='string'){cntr=cn.container_method;}var has_flexy_each=(typeof(tree['flexy:foreach'])!='undefined');var has_flexy_if=(typeof(tree['flexy:if'])!='undefined');
+var build_from_html=Roo.XComponent.build_from_html;var is_body=(tree.xtype=='Body');var page_has_body=(Roo.get(document.body).attr('xtype')=='Roo.bootstrap.Body');var self_cntr_el=Roo.get(this[cntr](false));if((has_flexy_each||has_flexy_if||this.can_build_overlaid==false)&&build_from_html){return false;
+}if(!has_flexy_each||!build_from_html||is_body||!page_has_body){if(!has_flexy_if||typeof(tree.name)=='undefined'||!build_from_html||is_body||!page_has_body){return this.addxtypeChild(tree,cntr);}var echild=self_cntr_el?self_cntr_el.child('>*[name='+tree.name+']'):false;
+if(echild){return this.addxtypeChild(Roo.apply({},tree),cntr);}Roo.log('skipping render');return cn;}var ret=false;if(!build_from_html){return false;}while(true){var echild=self_cntr_el?self_cntr_el.child('>*[xtype]'):false;if(!echild){break;}if(echild&&echild.attr('xtype').split('.').pop()!=cn.xtype){break;
+}ret=this.addxtypeChild(Roo.apply({},tree),cntr);}return ret;},addxtypeChild:function(tree,cntr,is_body){Roo.debug&&Roo.log('addxtypeChild:'+cntr);var cn=this;cntr=(typeof(cntr)=='undefined')?'getChildContainer':cntr;var has_flexy=(typeof(tree['flexy:if'])!='undefined')||(typeof(tree['flexy:foreach'])!='undefined');
+skip_children=false;if((!is_body){cn=Roo.factory(tree);cn.parentType=this.xtype;cn.parentId=this.id;var build_from_html=Roo.XComponent.build_from_html;if(build_from_html&&Roo.get(document.body).attr('xtype')=='Roo.bootstrap.Body'){var self_cntr_el=Roo.get(this[cntr](false));
+var echild=self_cntr_el?self_cntr_el.child('>*[xtype]'):false;if(echild){}if(echild&&echild.attr('xtype').split('.').pop()==cn.xtype){cn.el=echild;}else{Roo.debug&&Roo.log("MISSING "+cn.xtype+" on child of "+(this.el?this.el.attr('xbuilderid'):'no parent'));
+Roo.debug&&Roo.log(self_cntr_el);Roo.debug&&Roo.log(echild);Roo.debug&&Roo.log(cn);}}if(build_from_html&&has_flexy&&!cn.el&&cn.can_build_overlaid){Roo.debug&&Roo.log('skipping render');Roo.debug&&Roo.log(tree);if(!cn.el){Roo.debug&&Roo.log('skipping all children');
+skip_children=true;}}else{cn.render(this[cntr](true));}}var nitems=[];if(!tree.items||!tree.items.length){cn.items=nitems;return cn;}var items=tree.items;delete tree.items;if(!skip_children){for(var i=0;i<items.length;i++){nitems.push(cn.addxtype(Roo.apply({}
+,items[i])));}}cn.items=nitems;this.fireEvent('childrenrendered',this);return cn;},show:function(){if(this.el){this.el.removeClass('hidden');}},hide:function(){if(this.el&&!this.el.hasClass('hidden')){this.el.addClass('hidden');}}});
 // Roo/bootstrap/Body.js
 Roo.bootstrap.Body=function(A){Roo.bootstrap.Body.superclass.constructor.call(this,A);this.el=Roo.get(document.body);if(this.cls&&this.cls.length){Roo.get(document.body).addClass(this.cls);}};Roo.extend(Roo.bootstrap.Body,Roo.bootstrap.Component,{autoCreate:{cls:'container'}
 ,onRender:function(ct,A){}});