From 79bd3d52a193f29a604d9ab5ed12125a7c6b0a5c Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 1 Aug 2019 16:31:26 +0800 Subject: [PATCH] Fix #5963 - white space strip only on text fields --- Roo/form/ComboBox.js | 2 +- Roo/form/DateField.js | 9 ++++++++- Roo/form/TextField.js | 10 +++++----- roojs-all.js | 2 +- roojs-debug.js | 21 ++++++++++++++------- roojs-ui-debug.js | 21 ++++++++++++++------- roojs-ui.js | 2 +- 7 files changed, 44 insertions(+), 23 deletions(-) diff --git a/Roo/form/ComboBox.js b/Roo/form/ComboBox.js index 957f67cd18..0117cc201c 100644 --- a/Roo/form/ComboBox.js +++ b/Roo/form/ComboBox.js @@ -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 diff --git a/Roo/form/DateField.js b/Roo/form/DateField.js index deaf5fa7f4..34ec5791fd 100644 --- a/Roo/form/DateField.js +++ b/Roo/form/DateField.js @@ -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 diff --git a/Roo/form/TextField.js b/Roo/form/TextField.js index a50d6ca2ec..de50897fa2 100644 --- a/Roo/form/TextField.js +++ b/Roo/form/TextField.js @@ -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. diff --git a/roojs-all.js b/roojs-all.js index 2c448a5558..2aaf17e559 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -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