Fix #5963 - white space strip only on text fields
authorAlan Knowles <alan@roojs.com>
Thu, 1 Aug 2019 08:31:26 +0000 (16:31 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 1 Aug 2019 08:31:26 +0000 (16:31 +0800)
Roo/form/ComboBox.js
Roo/form/DateField.js
Roo/form/TextField.js
roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 957f67c..0117cc2 100644 (file)
@@ -1065,7 +1065,7 @@ Roo.extend(Roo.form.ComboBox, Roo.form.TriggerField, {
         this.view.select(match);
         var sn = Roo.get(this.view.getSelectedNodes()[0]);
         sn.scrollIntoView(sn.dom.parentNode, false);
-    }
+    } 
 
     /** 
     * @cfg {Boolean} grow 
index deaf5fa..34ec579 100644 (file)
@@ -17,7 +17,8 @@
 * Create a new DateField
 * @param {Object} config
  */
-Roo.form.DateField = function(config){
+Roo.form.DateField = function(config)
+{
     Roo.form.DateField.superclass.constructor.call(this, config);
     
       this.addEvents({
@@ -365,5 +366,11 @@ dateField.setValue('2006-5-4');
         
         return String(this.getValue()) !== String(this.startValue);
         
+    },
+    // @overide
+    cleanLeadingSpace : function(e)
+    {
+       return;
     }
+    
 });
\ No newline at end of file
index a50d6ca..de50897 100644 (file)
@@ -174,11 +174,11 @@ Roo.extend(Roo.form.TextField, Roo.form.Field,  {
     // private - clean the leading white space
     cleanLeadingSpace : function(e)
     {
-       if (this.inputType == 'file') {
-           return;
-       }
-       
-       this.setValue((this.getValue() + '').replace(/^\s+/,''));
+        if ( this.inputType == 'file') {
+            return;
+        }
+        
+        this.setValue((this.getValue() + '').replace(/^\s+/,''));
     },
     /**
      * Resets the current field value to the originally-loaded value and clears any validation messages.
index 2c448a5..2aaf17e 100644 (file)
@@ -1667,7 +1667,7 @@ return false;}}}var E=this.formatDate(A);if(this.ddMatch&&this.ddMatch.test(E)){
 },menuListeners:{select:function(m,d){this.setValue(d);this.fireEvent('select',this,d);},show:function(){this.onFocus();},hide:function(){this.focus.defer(10,this);var ml=this.menuListeners;this.menu.un("select",ml.select,this);this.menu.un("show",ml.show,this);
 this.menu.un("hide",ml.hide,this);}},onTriggerClick:function(){if(this.disabled){return;}if(this.menu==null){this.menu=new Roo.menu.DateMenu();}Roo.apply(this.menu.picker,{showClear:this.allowBlank,minDate:this.minValue,maxDate:this.maxValue,disabledDatesRE:this.ddMatch,disabledDatesText:this.disabledDatesText,disabledDays:this.disabledDays,disabledDaysText:this.disabledDaysText,format:this.useIso?'Y-m-d':this.format,minText:String.format(this.minText,this.formatDate(this.minValue)),maxText:String.format(this.maxText,this.formatDate(this.maxValue))}
 );this.menu.on(Roo.apply({},this.menuListeners,{scope:this}));this.menu.picker.setValue(this.getValue()||new Date());this.menu.show(this.el,"tl-bl?");},beforeBlur:function(){var v=this.parseDate(this.getRawValue());if(v){this.setValue(v);}},isDirty:function(){if(this.disabled){return false;
-}if(typeof(this.startValue)==='undefined'){return false;}return String(this.getValue())!==String(this.startValue);}});
+}if(typeof(this.startValue)==='undefined'){return false;}return String(this.getValue())!==String(this.startValue);},cleanLeadingSpace:function(e){return;}});
 // Roo/form/MonthField.js
 Roo.form.MonthField=function(A){Roo.form.MonthField.superclass.constructor.call(this,A);this.addEvents({'select':true});if(typeof this.minValue=="string"){this.minValue=this.parseDate(this.minValue);}if(typeof this.maxValue=="string"){this.maxValue=this.parseDate(this.maxValue);
 }this.ddMatch=null;if(this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1){re+="|";}}this.ddMatch=new RegExp(re+")");}};Roo.extend(Roo.form.MonthField,Roo.form.TriggerField,{format:"M Y",altFormats:"M Y|m/Y|m-y|m-Y|my|mY",disabledDays:[0,1,2,3,4,5,6],disabledDaysText:"Disabled",disabledDates:null,disabledDatesText:"Disabled",minValue:null,maxValue:null,minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:'x-form-date-trigger',useIso:true,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"new-password"}
index 5fb01cc..2b33154 100644 (file)
@@ -39532,11 +39532,11 @@ Roo.extend(Roo.form.TextField, Roo.form.Field,  {
     // private - clean the leading white space
     cleanLeadingSpace : function(e)
     {
-       if (this.inputType == 'file') {
-           return;
-       }
-       
-       this.setValue((this.getValue() + '').replace(/^\s+/,''));
+        if ( this.inputType == 'file') {
+            return;
+        }
+        
+        this.setValue((this.getValue() + '').replace(/^\s+/,''));
     },
     /**
      * Resets the current field value to the originally-loaded value and clears any validation messages.
@@ -40297,7 +40297,8 @@ Roo.extend(Roo.form.NumberField, Roo.form.TextField,  {
 * Create a new DateField
 * @param {Object} config
  */
-Roo.form.DateField = function(config){
+Roo.form.DateField = function(config)
+{
     Roo.form.DateField.superclass.constructor.call(this, config);
     
       this.addEvents({
@@ -40645,7 +40646,13 @@ dateField.setValue('2006-5-4');
         
         return String(this.getValue()) !== String(this.startValue);
         
+    },
+    // @overide
+    cleanLeadingSpace : function(e)
+    {
+       return;
     }
+    
 });/*
  * Based on:
  * Ext JS Library 1.1.1
@@ -42119,7 +42126,7 @@ Roo.extend(Roo.form.ComboBox, Roo.form.TriggerField, {
         this.view.select(match);
         var sn = Roo.get(this.view.getSelectedNodes()[0]);
         sn.scrollIntoView(sn.dom.parentNode, false);
-    }
+    } 
 
     /** 
     * @cfg {Boolean} grow 
index 1b261d3..2b80d0b 100644 (file)
@@ -17081,11 +17081,11 @@ Roo.extend(Roo.form.TextField, Roo.form.Field,  {
     // private - clean the leading white space
     cleanLeadingSpace : function(e)
     {
-       if (this.inputType == 'file') {
-           return;
-       }
-       
-       this.setValue((this.getValue() + '').replace(/^\s+/,''));
+        if ( this.inputType == 'file') {
+            return;
+        }
+        
+        this.setValue((this.getValue() + '').replace(/^\s+/,''));
     },
     /**
      * Resets the current field value to the originally-loaded value and clears any validation messages.
@@ -17846,7 +17846,8 @@ Roo.extend(Roo.form.NumberField, Roo.form.TextField,  {
 * Create a new DateField
 * @param {Object} config
  */
-Roo.form.DateField = function(config){
+Roo.form.DateField = function(config)
+{
     Roo.form.DateField.superclass.constructor.call(this, config);
     
       this.addEvents({
@@ -18194,7 +18195,13 @@ dateField.setValue('2006-5-4');
         
         return String(this.getValue()) !== String(this.startValue);
         
+    },
+    // @overide
+    cleanLeadingSpace : function(e)
+    {
+       return;
     }
+    
 });/*
  * Based on:
  * Ext JS Library 1.1.1
@@ -19668,7 +19675,7 @@ Roo.extend(Roo.form.ComboBox, Roo.form.TriggerField, {
         this.view.select(match);
         var sn = Roo.get(this.view.getSelectedNodes()[0]);
         sn.scrollIntoView(sn.dom.parentNode, false);
-    }
+    } 
 
     /** 
     * @cfg {Boolean} grow 
index 4bbdd57..945eb21 100644 (file)
@@ -798,7 +798,7 @@ return false;}}}var E=this.formatDate(A);if(this.ddMatch&&this.ddMatch.test(E)){
 },menuListeners:{select:function(m,d){this.setValue(d);this.fireEvent('select',this,d);},show:function(){this.onFocus();},hide:function(){this.focus.defer(10,this);var ml=this.menuListeners;this.menu.un("select",ml.select,this);this.menu.un("show",ml.show,this);
 this.menu.un("hide",ml.hide,this);}},onTriggerClick:function(){if(this.disabled){return;}if(this.menu==null){this.menu=new Roo.menu.DateMenu();}Roo.apply(this.menu.picker,{showClear:this.allowBlank,minDate:this.minValue,maxDate:this.maxValue,disabledDatesRE:this.ddMatch,disabledDatesText:this.disabledDatesText,disabledDays:this.disabledDays,disabledDaysText:this.disabledDaysText,format:this.useIso?'Y-m-d':this.format,minText:String.format(this.minText,this.formatDate(this.minValue)),maxText:String.format(this.maxText,this.formatDate(this.maxValue))}
 );this.menu.on(Roo.apply({},this.menuListeners,{scope:this}));this.menu.picker.setValue(this.getValue()||new Date());this.menu.show(this.el,"tl-bl?");},beforeBlur:function(){var v=this.parseDate(this.getRawValue());if(v){this.setValue(v);}},isDirty:function(){if(this.disabled){return false;
-}if(typeof(this.startValue)==='undefined'){return false;}return String(this.getValue())!==String(this.startValue);}});
+}if(typeof(this.startValue)==='undefined'){return false;}return String(this.getValue())!==String(this.startValue);},cleanLeadingSpace:function(e){return;}});
 // Roo/form/MonthField.js
 Roo.form.MonthField=function(A){Roo.form.MonthField.superclass.constructor.call(this,A);this.addEvents({'select':true});if(typeof this.minValue=="string"){this.minValue=this.parseDate(this.minValue);}if(typeof this.maxValue=="string"){this.maxValue=this.parseDate(this.maxValue);
 }this.ddMatch=null;if(this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1){re+="|";}}this.ddMatch=new RegExp(re+")");}};Roo.extend(Roo.form.MonthField,Roo.form.TriggerField,{format:"M Y",altFormats:"M Y|m/Y|m-y|m-Y|my|mY",disabledDays:[0,1,2,3,4,5,6],disabledDaysText:"Disabled",disabledDates:null,disabledDatesText:"Disabled",minValue:null,maxValue:null,minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:'x-form-date-trigger',useIso:true,defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"new-password"}