sync
[roojs1] / roojs-bootstrap.js
index df41fc1..745cb97 100644 (file)
@@ -790,21 +790,21 @@ break;case 13:if(typeof(this.vIndex)!='undefined'&&!isNaN(this.vIndex)){this.set
 }});Roo.apply(Roo.bootstrap.MonthField,{template:{tag:'div',cls:'datepicker dropdown-menu roo-dynamic',cn:[{tag:'div',cls:'datepicker-months',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.content]}]}]}});
 // Roo/bootstrap/CheckBox.js
 Roo.bootstrap.CheckBox=function(A){Roo.bootstrap.CheckBox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.bootstrap.CheckBox,Roo.bootstrap.Input,{inputType:'checkbox',inputValue:1,valueOff:0,boxLabel:false,checked:false,weight:false,inline:false,getAutoCreate:function(){var A=(!this.labelAlign)?this.parentLabelAlign():this.labelAlign;
-var id=Roo.id();var B={};B.cls='form-group '+this.inputType;if(this.inline){B.cls+=' '+this.inputType+'-inline';}var C={tag:'input',id:id,type:this.inputType,value:this.inputType=='radio'?this.inputValue:((!this.checked)?this.valueOff:this.inputValue),cls:'roo-'+this.inputType,placeholder:this.placeholder||''}
-;if(this.weight){B.cls+=" "+this.inputType+"-"+this.weight;}if(this.disabled){C.disabled=true;}if(this.checked){C.checked=this.checked;}if(this.name){C.name=this.name;}if(this.size){C.cls+=' input-'+this.size;}var D=this;['xs','sm','md','lg'].map(function(G){if(D[G]){B.cls+=' col-'+G+'-'+D[G];
-}});var E=C;if(this.before||this.after){E={cls:'input-group',cn:[]};if(this.before){E.cn.push({tag:'span',cls:'input-group-addon',html:this.before});}E.cn.push(C);if(this.after){E.cn.push({tag:'span',cls:'input-group-addon',html:this.after});}}if(A==='left'&&this.fieldLabel.length){B.cn=[{tag:'label','for':id,cls:'control-label col-md-'+this.labelWidth,html:this.fieldLabel}
-,{cls:"col-md-"+(12-this.labelWidth),cn:[E]}];}else if(this.fieldLabel.length){B.cn=[{tag:this.boxLabel?'span':'label','for':id,cls:'control-label box-input-label',html:this.fieldLabel},E];}else{B.cn=[E];}if(this.boxLabel){var F={tag:'label',cls:'box-label',html:this.boxLabel}
-;if(this.tooltip){F.tooltip=this.tooltip;}B.cn.push(F);}return B;},inputEl:function(){return this.el.select('input.roo-'+this.inputType,true).first();},labelEl:function(){return this.el.select('label.control-label',true).first();},label:function(){return this.labelEl();
-},boxLabelEl:function(){return this.el.select('label.box-label',true).first();},initEvents:function(){this.inputEl().on('click',this.onClick,this);if(this.boxLabel){this.el.select('label.box-label',true).first().on('click',this.onClick,this);}this.startValue=this.getValue();
-if(this.groupId){Roo.bootstrap.CheckBox.register(this);}},onClick:function(){this.setChecked(!this.checked);},setChecked:function(A,B){this.startValue=this.getValue();if(this.inputType=='radio'){Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.dom.checked=false;
-});this.inputEl().dom.checked=true;this.inputEl().dom.value=this.inputValue;if(B!==true){this.fireEvent('check',this,true);}this.validate();return;}this.checked=A;this.inputEl().dom.checked=A;this.inputEl().dom.value=A?this.inputValue:this.valueOff;if(B!==true){this.fireEvent('check',this,A);
-}this.validate();},getValue:function(){if(this.inputType=='radio'){return this.getGroupValue();}return this.inputEl().getValue();},getGroupValue:function(){if(typeof(this.el.up('form').child('input[name='+this.name+']:checked',true))=='undefined'){return '';
-}return this.el.up('form').child('input[name='+this.name+']:checked',true).value;},setValue:function(v,A){if(this.inputType=='radio'){this.setGroupValue(v,A);return;}this.setChecked(((typeof(v)=='undefined')?this.checked:(String(v)===String(this.inputValue))),A);
-this.validate();},setGroupValue:function(v,A){this.startValue=this.getValue();Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.dom.checked=false;if(e.dom.value==v){e.dom.checked=true;}});if(A!==true){this.fireEvent('check',this,true);
-}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(){if(this.allowBlank){return true;
-}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(){if(this.allowBlank){return;}var A=this;this.fireEvent('valid',this);
-var B=Roo.bootstrap.FieldLabel.get(this.name+'-group');if(this.groupId){B=Roo.bootstrap.FieldLabel.get(this.groupId+'-group');}if(B){B.markValid();}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]);
+var id=Roo.id();var B={};B.cls='form-group '+this.inputType;if(this.inline){B.cls+=' '+this.inputType+'-inline';}var C={tag:'input',id:id,type:this.inputType,value:this.inputValue,cls:'roo-'+this.inputType,placeholder:this.placeholder||''};var D={tag:'input',type:'hidden',cls:'roo-hidden-value',value:this.checked?this.valueOff:this.inputValue}
+;if(this.weight){B.cls+=" "+this.inputType+"-"+this.weight;}if(this.disabled){C.disabled=true;}if(this.checked){C.checked=this.checked;}if(this.name){D.name=this.name;C.name='_hidden_'+this.name;}if(this.size){C.cls+=' input-'+this.size;}var E=this;['xs','sm','md','lg'].map(function(H){if(E[H]){B.cls+=' col-'+H+'-'+E[H];
+}});var F={tag:'span',cn:[C,D]};if(this.before||this.after){F={cls:'input-group',cn:[]};if(this.before){F.cn.push({tag:'span',cls:'input-group-addon',html:this.before});}F.cn.push(C);F.cn.push(D);if(this.after){F.cn.push({tag:'span',cls:'input-group-addon',html:this.after}
+);}}if(A==='left'&&this.fieldLabel.length){B.cn=[{tag:'label','for':id,cls:'control-label col-md-'+this.labelWidth,html:this.fieldLabel},{cls:"col-md-"+(12-this.labelWidth),cn:[F]}];}else if(this.fieldLabel.length){B.cn=[{tag:this.boxLabel?'span':'label','for':id,cls:'control-label box-input-label',html:this.fieldLabel}
+,F];}else{B.cn=[F];}if(this.boxLabel){var G={tag:'label',cls:'box-label',html:this.boxLabel};if(this.tooltip){G.tooltip=this.tooltip;}B.cn.push(G);}return B;},inputEl:function(){return this.el.select('input.roo-'+this.inputType,true).first();},hiddenEl:function(){return this.el.select('input.hidden-value',true).first();
+},labelEl:function(){return this.el.select('label.control-label',true).first();},label:function(){return this.labelEl();},boxLabelEl:function(){return this.el.select('label.box-label',true).first();},initEvents:function(){this.inputEl().on('click',this.onClick,this);
+if(this.boxLabel){this.el.select('label.box-label',true).first().on('click',this.onClick,this);}this.startValue=this.getValue();if(this.groupId){Roo.bootstrap.CheckBox.register(this);}},onClick:function(){this.setChecked(!this.checked);},setChecked:function(A,B){this.startValue=this.getValue();
+if(this.inputType=='radio'){Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.dom.checked=false;});this.inputEl().dom.checked=true;this.inputEl().dom.value=this.inputValue;if(B!==true){this.fireEvent('check',this,true);
+}this.validate();return;}this.checked=A;this.inputEl().dom.checked=A;this.hiddenEl().dom.value=A?this.inputValue:this.valueOff;if(B!==true){this.fireEvent('check',this,A);}this.validate();},getValue:function(){if(this.inputType=='radio'){return this.getGroupValue();
+}return this.hiddenEl()?this.hiddenEl().dom.value:this.value;},getGroupValue:function(){if(typeof(this.el.up('form').child('input[name='+this.name+']:checked',true))=='undefined'){return '';}return this.el.up('form').child('input[name='+this.name+']:checked',true).value;
+},setValue:function(v,A){if(this.inputType=='radio'){this.setGroupValue(v,A);return;}this.setChecked(((typeof(v)=='undefined')?this.checked:(String(v)===String(this.inputValue))),A);this.validate();},setGroupValue:function(v,A){this.startValue=this.getValue();
+Roo.each(this.el.up('form').select('input[name='+this.name+']',true).elements,function(e){e.dom.checked=false;if(e.dom.value==v){e.dom.checked=true;}});if(A!==true){this.fireEvent('check',this,true);}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(){if(this.allowBlank){return true;}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(){if(this.allowBlank){return;}var A=this;this.fireEvent('valid',this);var B=Roo.bootstrap.FieldLabel.get(this.name+'-group');if(this.groupId){B=Roo.bootstrap.FieldLabel.get(this.groupId+'-group');}if(B){B.markValid();}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 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.validClass);}},markInvalid:function(A){if(this.allowBlank){return;
 }var B=this;this.fireEvent('invalid',this,A);var C=Roo.bootstrap.FieldLabel.get(this.name+'-group');if(this.groupId){C=Roo.bootstrap.FieldLabel.get(this.groupId+'-group');}if(C){C.markInvalid();}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]);