sync
authorjohn <john@roojs.com>
Thu, 27 Sep 2018 04:45:37 +0000 (12:45 +0800)
committerjohn <john@roojs.com>
Thu, 27 Sep 2018 04:45:37 +0000 (12:45 +0800)
Roo/bootstrap/Form.js
Roo/bootstrap/Modal.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 411fd99..f09af63 100644 (file)
@@ -178,6 +178,8 @@ Roo.extend(Roo.bootstrap.Form, Roo.bootstrap.Component,  {
                 return;
             }
             
+            Roo.log('invalid field: ' + f.name);
+            
             valid = false;
 
             if(!target && f.el.isVisible(true)){
index d3ca8e7..4683764 100644 (file)
@@ -272,13 +272,14 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
             
             var w = Math.min(this.max_width, Roo.lib.Dom.getViewportWidth(true) - 30);
             
+            // for fix height
             if(this.height) {
                 this.setSize(w, this.height);
                 return;
             }
             
             var body_childs = this.bodyEl.dom.childNodes;
-            var full_height = this.headerEl.getHeight() + this.footerEl.getHeight() + 60;
+            var full_height = this.headerEl.getHeight() + this.footerEl.getHeight();
             for(var i = 0; i < body_childs.length; i++) {
                 full_height += body_childs[i].offsetHeight;
             }
index 410ce33..c838d61 100644 (file)
@@ -7835,6 +7835,8 @@ Roo.extend(Roo.bootstrap.Form, Roo.bootstrap.Component,  {
                 return;
             }
             
+            Roo.log('invalid field: ' + f.name);
+            
             valid = false;
 
             if(!target && f.el.isVisible(true)){
index 9e5f36a..c5d0b34 100644 (file)
@@ -315,19 +315,20 @@ var B=rs.records&&rs.records[0]?rs.records[0].data:null;return {success:rs.succe
 Roo.bootstrap.Form=function(A){Roo.bootstrap.Form.superclass.constructor.call(this,A);Roo.bootstrap.Form.popover.apply();this.addEvents({clientvalidation:true,beforeaction:true,actionfailed:true,actioncomplete:true});};Roo.extend(Roo.bootstrap.Form,Roo.bootstrap.Component,{method:'POST',timeout:30,align:'left',activeAction:null,waitMsgTarget:false,loadMask:true,errorMask:false,maskOffset:100,maskBody:false,getAutoCreate:function(){var A={tag:'form',method:this.method||'POST',id:this.id||Roo.id(),cls:''}
 ;if(this.parent().xtype.match(/^Nav/)){A.cls='navbar-form navbar-'+this.align;}if(this.labelAlign=='left'){A.cls+=' form-horizontal';}return A;},initEvents:function(){this.el.on('submit',this.onSubmit,this);this.el.on('keypress',function(e){if(e.getCharCode()!=13){return true;
 }if(e.getTarget().nodeName.toLowerCase()==='textarea'){return true;}Roo.log("keypress blocked");e.preventDefault();return false;});},onSubmit:function(e){e.stopEvent();},isValid:function(){var A=this.getItems();var B=true;var C=false;A.each(function(f){if(f.validate()){return;
-}B=false;if(!C&&f.el.isVisible(true)){C=f;}});if(this.errorMask&&!B){Roo.bootstrap.Form.popover.mask(this,C);}return B;},isDirty:function(){var A=false;var B=this.getItems();B.each(function(f){if(f.isDirty()){A=true;return false;}return true;});return A;}
-,doAction:function(A,B){if(typeof A=='string'){A=new Roo.form.Action.ACTION_TYPES[A](this,B);}if(this.fireEvent('beforeaction',this,A)!==false){this.beforeAction(A);A.run.defer(100,A);}return this;},beforeAction:function(A){var o=A.options;if(this.loadMask){if(this.maskBody){Roo.get(document.body).mask(o.waitMsg||"Sending",'x-mask-loading')}
-else{this.el.mask(o.waitMsg||"Sending",'x-mask-loading');}}},afterAction:function(A,B){this.activeAction=null;var o=A.options;if(this.loadMask){if(this.maskBody){Roo.get(document.body).unmask();}else{this.el.unmask();}}if(B){if(o.reset){this.reset();}Roo.callback(o.success,o.scope,[this,A]);
-this.fireEvent('actioncomplete',this,A);}else{if((typeof(A.result)!='undefined')&&(typeof(A.result.errors)!='undefined')&&(typeof(A.result.errors.needs_confirm)!='undefined')){var _t=this;Roo.log("not supported yet");return;}Roo.callback(o.failure,o.scope,[this,A]);
-if(!this.hasListener('actionfailed')){Roo.log("need to add dialog support");}this.fireEvent('actionfailed',this,A);}},findField:function(id){var A=this.getItems();var B=A.get(id);if(!B){A.each(function(f){if(f.isFormField&&(f.dataIndex==id||f.id==id||f.getName()==id)){B=f;
-return false;}return true;});}return B||null;},markInvalid:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var C=A[i];var f=this.findField(C.id);if(f){f.markInvalid(C.msg);}}}else{var D,id;for(id in A){if(typeof A[id]!='function'&&(D=this.findField(id))){D.markInvalid(A[id]);
-}}}return this;},setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else{var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={}
-;sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else if(C.setFromData&&(C.store&&!C.store.isLocal)){C.setFromData(A);}else{C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();
-}}}}return this;},getValues:function(A){var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){var B=this.getItems();var C={};B.each(function(f){if(!f.getName()){return;}var v=f.getValue();
-if(f.inputType=='radio'){if(typeof(C[f.getName()])=='undefined'){C[f.getName()]='';}if(!f.el.dom.checked){return;}v=f.el.dom.value;}if(f.xtype=='MoneyField'){C[f.currencyName]=f.getCurrency();}if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!==false&&f.name!=''&&f.name!=f.getName()){C[f.name]=f.getRawValue();
-}C[f.getName()]=v;});return C;},clearInvalid:function(){var A=this.getItems();A.each(function(f){f.clearInvalid();});return this;},reset:function(){var A=this.getItems();A.each(function(f){f.reset();});Roo.each(this.childForms||[],function(f){f.reset();});
-return this;},getItems:function(){var r=new Roo.util.MixedCollection(false,function(o){return o.id||(o.id=Roo.id());});var A=function(el){if(el.inputEl){r.add(el);}if(!el.items){return;}Roo.each(el.items,function(e){A(e);});};A(this);return r;},hideFields:function(A){Roo.each(A,function(i){var f=this.findField(i);
-if(!f){return;}if(f.xtype=='DateField'){f.setVisible(false);return;}f.hide();},this);},showFields:function(A){Roo.each(A,function(i){var f=this.findField(i);if(!f){return;}if(f.xtype=='DateField'){f.setVisible(true);return;}f.show();},this);}});Roo.apply(Roo.bootstrap.Form,{popover:{padding:5,isApplied:false,isMasked:false,form:false,target:false,toolTip:false,intervalID:false,maskEl:false,apply:function(){if(this.isApplied){return;
+}Roo.log('invalid field: '+f.name);B=false;if(!C&&f.el.isVisible(true)){C=f;}});if(this.errorMask&&!B){Roo.bootstrap.Form.popover.mask(this,C);}return B;},isDirty:function(){var A=false;var B=this.getItems();B.each(function(f){if(f.isDirty()){A=true;return false;
+}return true;});return A;},doAction:function(A,B){if(typeof A=='string'){A=new Roo.form.Action.ACTION_TYPES[A](this,B);}if(this.fireEvent('beforeaction',this,A)!==false){this.beforeAction(A);A.run.defer(100,A);}return this;},beforeAction:function(A){var o=A.options;
+if(this.loadMask){if(this.maskBody){Roo.get(document.body).mask(o.waitMsg||"Sending",'x-mask-loading')}else{this.el.mask(o.waitMsg||"Sending",'x-mask-loading');}}},afterAction:function(A,B){this.activeAction=null;var o=A.options;if(this.loadMask){if(this.maskBody){Roo.get(document.body).unmask();
+}else{this.el.unmask();}}if(B){if(o.reset){this.reset();}Roo.callback(o.success,o.scope,[this,A]);this.fireEvent('actioncomplete',this,A);}else{if((typeof(A.result)!='undefined')&&(typeof(A.result.errors)!='undefined')&&(typeof(A.result.errors.needs_confirm)!='undefined')){var _t=this;
+Roo.log("not supported yet");return;}Roo.callback(o.failure,o.scope,[this,A]);if(!this.hasListener('actionfailed')){Roo.log("need to add dialog support");}this.fireEvent('actionfailed',this,A);}},findField:function(id){var A=this.getItems();var B=A.get(id);
+if(!B){A.each(function(f){if(f.isFormField&&(f.dataIndex==id||f.id==id||f.getName()==id)){B=f;return false;}return true;});}return B||null;},markInvalid:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var C=A[i];var f=this.findField(C.id);
+if(f){f.markInvalid(C.msg);}}}else{var D,id;for(id in A){if(typeof A[id]!='function'&&(D=this.findField(id))){D.markInvalid(A[id]);}}}return this;},setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);
+if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else{var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={};sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];
+sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else if(C.setFromData&&(C.store&&!C.store.isLocal)){C.setFromData(A);}else{C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();}}}}return this;},getValues:function(A){var fs=Roo.lib.Ajax.serializeForm(this.el.dom);
+if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){var B=this.getItems();var C={};B.each(function(f){if(!f.getName()){return;}var v=f.getValue();if(f.inputType=='radio'){if(typeof(C[f.getName()])=='undefined'){C[f.getName()]='';
+}if(!f.el.dom.checked){return;}v=f.el.dom.value;}if(f.xtype=='MoneyField'){C[f.currencyName]=f.getCurrency();}if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!==false&&f.name!=''&&f.name!=f.getName()){C[f.name]=f.getRawValue();}C[f.getName()]=v;
+});return C;},clearInvalid:function(){var A=this.getItems();A.each(function(f){f.clearInvalid();});return this;},reset:function(){var A=this.getItems();A.each(function(f){f.reset();});Roo.each(this.childForms||[],function(f){f.reset();});return this;},getItems:function(){var r=new Roo.util.MixedCollection(false,function(o){return o.id||(o.id=Roo.id());
+});var A=function(el){if(el.inputEl){r.add(el);}if(!el.items){return;}Roo.each(el.items,function(e){A(e);});};A(this);return r;},hideFields:function(A){Roo.each(A,function(i){var f=this.findField(i);if(!f){return;}if(f.xtype=='DateField'){f.setVisible(false);
+return;}f.hide();},this);},showFields:function(A){Roo.each(A,function(i){var f=this.findField(i);if(!f){return;}if(f.xtype=='DateField'){f.setVisible(true);return;}f.show();},this);}});Roo.apply(Roo.bootstrap.Form,{popover:{padding:5,isApplied:false,isMasked:false,form:false,target:false,toolTip:false,intervalID:false,maskEl:false,apply:function(){if(this.isApplied){return;
 }this.maskEl={top:Roo.DomHelper.append(Roo.get(document.body),{tag:"div",cls:"x-dlg-mask roo-form-top-mask"},true),left:Roo.DomHelper.append(Roo.get(document.body),{tag:"div",cls:"x-dlg-mask roo-form-left-mask"},true),bottom:Roo.DomHelper.append(Roo.get(document.body),{tag:"div",cls:"x-dlg-mask roo-form-bottom-mask"}
 ,true),right:Roo.DomHelper.append(Roo.get(document.body),{tag:"div",cls:"x-dlg-mask roo-form-right-mask"},true)};this.maskEl.top.enableDisplayMode("block");this.maskEl.left.enableDisplayMode("block");this.maskEl.bottom.enableDisplayMode("block");this.maskEl.right.enableDisplayMode("block");
 this.toolTip=new Roo.bootstrap.Tooltip({cls:'roo-form-error-popover',alignment:{'left':['r-l',[-2,0],'right'],'right':['l-r',[2,0],'left'],'bottom':['tl-bl',[0,2],'top'],'top':['bl-tl',[0,-2],'bottom']}});this.toolTip.render(Roo.get(document.body));this.toolTip.el.enableDisplayMode("block");