From: Alan Knowles Date: Wed, 31 Jul 2019 04:11:45 +0000 (+0800) Subject: roojs-ui.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=d797239a600c927a721556694e9ca3faf26a3337 roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js --- diff --git a/roojs-all.js b/roojs-all.js index 2c448a5558..20c67115df 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1612,7 +1612,7 @@ Roo.form.TextField=function(A){Roo.form.TextField.superclass.constructor.call(th }Roo.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(this.validate,this);this.el.on('keyup',this.filterValidation,this);}else if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay} );}if(this.selectOnFocus){this.on("focus",this.preFocus,this);}if(!this.allowLeadingSpace){this.on('blur',this.cleanLeadingSpace,this);}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+'Mask']))){this.el.on("keypress",this.filterKeys,this); }if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this);}if(this.el.is('input[type=password]')&&Roo.isSafari){this.el.on('keydown',this.SafariOnKeyDown,this);}},processValue:function(A){if(this.stripCharsRe){var B=A.replace(this.stripCharsRe,''); -if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},cleanLeadingSpace:function(e){if(this.inputType=='file'){return; +if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},cleanLeadingSpace:function(e){if(this.constructor==Roo.Form.TextField&&this.inputType=='file'){return; }this.setValue((this.getValue()+'').replace(/^\s+/,''));},reset:function(){Roo.form.TextField.superclass.reset.call(this);},preFocus:function(){if(this.selectOnFocus){this.el.dom.select();}},filterKeys:function(e){var k=e.getKey();if(!Roo.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE&&e.button==-1))){return; }var c=e.getCharCode(),cc=String.fromCharCode(c);if(Roo.isIE&&(e.isSpecialKey()||!cc)){return;}if(!this.maskRe.test(cc)){e.stopEvent();}},setValue:function(v){Roo.form.TextField.superclass.setValue.apply(this,arguments);this.autoSize();},validateValue:function(A){if(A.length<1){if(this.allowBlank){this.clearInvalid(); return true;}else{this.markInvalid(this.blankText);return false;}}if(A.lengththis.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength)); diff --git a/roojs-debug.js b/roojs-debug.js index 5fb01cc41a..9f9518232b 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -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.constructor == Roo.Form.TextField && 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-ui-debug.js b/roojs-ui-debug.js index 1b261d389d..8e00541f52 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -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.constructor == Roo.Form.TextField && 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-ui.js b/roojs-ui.js index 4bbdd575b6..e8d477c6f0 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -743,7 +743,7 @@ Roo.form.TextField=function(A){Roo.form.TextField.superclass.constructor.call(th }Roo.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(this.validate,this);this.el.on('keyup',this.filterValidation,this);}else if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay} );}if(this.selectOnFocus){this.on("focus",this.preFocus,this);}if(!this.allowLeadingSpace){this.on('blur',this.cleanLeadingSpace,this);}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+'Mask']))){this.el.on("keypress",this.filterKeys,this); }if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this);}if(this.el.is('input[type=password]')&&Roo.isSafari){this.el.on('keydown',this.SafariOnKeyDown,this);}},processValue:function(A){if(this.stripCharsRe){var B=A.replace(this.stripCharsRe,''); -if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},cleanLeadingSpace:function(e){if(this.inputType=='file'){return; +if(B!==A){this.setRawValue(B);return B;}}return A;},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},onKeyUp:function(e){if(!e.isNavKeyPress()){this.autoSize();}},cleanLeadingSpace:function(e){if(this.constructor==Roo.Form.TextField&&this.inputType=='file'){return; }this.setValue((this.getValue()+'').replace(/^\s+/,''));},reset:function(){Roo.form.TextField.superclass.reset.call(this);},preFocus:function(){if(this.selectOnFocus){this.el.dom.select();}},filterKeys:function(e){var k=e.getKey();if(!Roo.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE&&e.button==-1))){return; }var c=e.getCharCode(),cc=String.fromCharCode(c);if(Roo.isIE&&(e.isSpecialKey()||!cc)){return;}if(!this.maskRe.test(cc)){e.stopEvent();}},setValue:function(v){Roo.form.TextField.superclass.setValue.apply(this,arguments);this.autoSize();},validateValue:function(A){if(A.length<1){if(this.allowBlank){this.clearInvalid(); return true;}else{this.markInvalid(this.blankText);return false;}}if(A.lengththis.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));