roojs-bootstrap.js
authoredward <edward@roojs.com>
Tue, 20 Oct 2015 07:04:34 +0000 (15:04 +0800)
committeredward <edward@roojs.com>
Tue, 20 Oct 2015 07:04:34 +0000 (15:04 +0800)
roojs-bootstrap-debug.js

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

index 5301d45..8905928 100644 (file)
@@ -28,6 +28,20 @@ Roo.bootstrap = Roo.bootstrap || {};
 
 Roo.bootstrap.Component = function(config){
     Roo.bootstrap.Component.superclass.constructor.call(this, config);
+       
+    this.addEvents({
+        /**
+         * @event childrenrendered
+         * Fires when the children have been rendered..
+         * @param {Roo.bootstrap.Component} this
+         */
+        "childrenrendered" : true
+        
+        
+        
+    });
+    
+    
 };
 
 Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
@@ -316,11 +330,11 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
         }
         
         cn.items = nitems;
-       
+        
+        this.fireEvent('childrenrendered', this);
+        
         return cn;
-    }
-    
-    
+    } 
     
     
 });
@@ -17073,6 +17087,10 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
      */
     markValid : function()
     {
+        if(this.allowBlank){
+            return;
+        }
+        
         var _this = this;
         
         this.fireEvent('valid', this);
@@ -17110,6 +17128,10 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
      */
     markInvalid : function(msg)
     {
+        if(this.allowBlank){
+            return;
+        }
+        
         var _this = this;
         
         this.fireEvent('invalid', this, msg);
index 7aa1f6f..6b99025 100644 (file)
@@ -1,10 +1,10 @@
 //Roo/bootstrap/Component.js
-Roo.bootstrap=Roo.bootstrap||{};Roo.bootstrap.Component=function(A){Roo.bootstrap.Component.superclass.constructor.call(this,A);};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=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;}
+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=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;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(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&&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;return cn;}});
+cn.items=G;this.fireEvent('childrenrendered',this);return cn;}});
 //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){}});
 //Roo/bootstrap/ButtonGroup.js
@@ -385,7 +385,7 @@ this.setChecked(((typeof(v)=='undefined')?this.checked:(String(v)===String(this.
 this.validate();return;},validate:function(){if(this.disabled||(this.inputType=='radio'&&this.validateRadio())||(this.inputType=='checkbox'&&this.validateCheckbox())){this.markValid();return true;}
 this.markInvalid();return false;},validateRadio:function(){var A=false;Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){if(!e.dom.checked){return;}
 A=true;return false;});return A;},validateCheckbox:function(){if(!this.groupId){return (this.getValue()==this.inputValue||this.allowBlank)?true:false;}var A=Roo.bootstrap.CheckBox.get(this.groupId);if(!A){return false;}var r=false;for(var i in A){if(r){break;}
-r=(A[i].getValue()==A[i].inputValue)?true:false;}return r;},markValid:function(){var A=this;this.fireEvent('valid',this);if(this.inputType=='radio'){Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.findParent('.form-group',false,true).removeClass([A.invalidClass,A.validClass]);e.findParent('.form-group',false,true).addClass(A.validClass);});return;}if(!this.groupId){this.el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);this.el.findParent('.form-group',false,true).addClass(this.validClass);return;}var B=Roo.bootstrap.CheckBox.get(this.groupId);if(!B){return;}for(var i in B){B[i].el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);B[i].el.findParent('.form-group',false,true).addClass(this.validClass);}},markInvalid:function(A){var B=this;this.fireEvent('invalid',this,A);if(this.inputType=='radio'){Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.findParent('.form-group',false,true).removeClass([B.invalidClass,B.validClass]);e.findParent('.form-group',false,true).addClass(B.invalidClass);});return;}if(!this.groupId){this.el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);this.el.findParent('.form-group',false,true).addClass(this.invalidClass);return;}var C=Roo.bootstrap.CheckBox.get(this.groupId);if(!C){return;}for(var i in C){C[i].el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);C[i].el.findParent('.form-group',false,true).addClass(this.invalidClass);}}});Roo.apply(Roo.bootstrap.CheckBox,{groups:{},register:function(A){if(typeof(this.groups[A.groupId])=='undefined'){this.groups[A.groupId]={};}if(this.groups[A.groupId].hasOwnProperty(A.name)){return;}
+r=(A[i].getValue()==A[i].inputValue)?true:false;}return r;},markValid:function(){if(this.allowBlank){return;}var A=this;this.fireEvent('valid',this);if(this.inputType=='radio'){Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.findParent('.form-group',false,true).removeClass([A.invalidClass,A.validClass]);e.findParent('.form-group',false,true).addClass(A.validClass);});return;}if(!this.groupId){this.el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);this.el.findParent('.form-group',false,true).addClass(this.validClass);return;}var B=Roo.bootstrap.CheckBox.get(this.groupId);if(!B){return;}for(var i in B){B[i].el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);B[i].el.findParent('.form-group',false,true).addClass(this.validClass);}},markInvalid:function(A){if(this.allowBlank){return;}var B=this;this.fireEvent('invalid',this,A);if(this.inputType=='radio'){Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.findParent('.form-group',false,true).removeClass([B.invalidClass,B.validClass]);e.findParent('.form-group',false,true).addClass(B.invalidClass);});return;}if(!this.groupId){this.el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);this.el.findParent('.form-group',false,true).addClass(this.invalidClass);return;}var C=Roo.bootstrap.CheckBox.get(this.groupId);if(!C){return;}for(var i in C){C[i].el.findParent('.form-group',false,true).removeClass([this.invalidClass,this.validClass]);C[i].el.findParent('.form-group',false,true).addClass(this.invalidClass);}}});Roo.apply(Roo.bootstrap.CheckBox,{groups:{},register:function(A){if(typeof(this.groups[A.groupId])=='undefined'){this.groups[A.groupId]={};}if(this.groups[A.groupId].hasOwnProperty(A.name)){return;}
 this.groups[A.groupId][A.name]=A;},get:function(A){if(typeof(this.groups[A])=='undefined'){return false;}return this.groups[A];}});
 //Roo/bootstrap/Radio.js
 Roo.bootstrap.Radio=function(A){Roo.bootstrap.Radio.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Radio,Roo.bootstrap.CheckBox,{inputType:'radio',inputValue:'',valueOff:'',getAutoCreate:function(){var A=(!this.labelAlign)?this.parentLabelAlign():this.labelAlign;A=A||'left';var id=Roo.id();var B={tag:this.inline?'span':'div',cls:'',cn:[]};var C=this.inline?' radio-inline':'';var D={tag:'label','for':id,cls:'control-label box-label'+C,cn:[]};var E=this.labelWidth?this.labelWidth*1:100;var F={tag:'label',html:this.fieldLabel,style:'width:'+E+'px;line-height:1;vertical-align:bottom;cursor:default;'};var G={tag:'input',id:id,type:this.inputType,value:this.inputValue,cls:'roo-radio',placeholder:this.placeholder||''};if(this.weight){G.cls+=" radio-"+this.weight;}if(this.disabled){G.disabled=true;}if(this.checked){G.checked=this.checked;}if(this.name){G.name=this.name;}if(this.size){G.cls+=' input-'+this.size;}var H=this;['xs','sm','md','lg'].map(function(K){if(H[K]){B.cls+=' col-'+K+'-'+H[K];}});var I=G;if(this.before||this.after){I={cls:'input-group',tag:'span',cn:[]};if(this.before){I.cn.push({tag:'span',cls:'input-group-addon',html:this.before});}