From 3a4fa524cffdc0b1e6b51b4329e905255ad6f6cc Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 15 May 2023 10:20:37 +0800 Subject: [PATCH] fix #7642 - password creattion dialog bar --- Roo/bootstrap/form/Input.js | 16 +++++++++++++++- roojs-bootstrap-debug.js | 16 +++++++++++++++- roojs-bootstrap.js | 5 +++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Roo/bootstrap/form/Input.js b/Roo/bootstrap/form/Input.js index 6dc7097af5..bb88ec9030 100644 --- a/Roo/bootstrap/form/Input.js +++ b/Roo/bootstrap/form/Input.js @@ -813,6 +813,18 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { // this.validate(); this.el.removeClass([this.invalidClass, this.validClass]); this.inputEl().removeClass(['is-valid', 'is-invalid']); + + if(this.hasFeedback && this.inputType != 'hidden'){ + + var feedback = this.el.select('.form-control-feedback', true).first(); + + if(feedback){ + this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); + feedback.hide(); + } + + } }, /** * Returns the name of the field @@ -1050,7 +1062,9 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { feedback.update(this.blankText); } - feedback.show(); + if(feedback.dom.innerHTML) { + feedback.show(); + } } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 5ee57dc699..8167422c97 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -13086,6 +13086,18 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { // this.validate(); this.el.removeClass([this.invalidClass, this.validClass]); this.inputEl().removeClass(['is-valid', 'is-invalid']); + + if(this.hasFeedback && this.inputType != 'hidden'){ + + var feedback = this.el.select('.form-control-feedback', true).first(); + + if(feedback){ + this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); + feedback.hide(); + } + + } }, /** * Returns the name of the field @@ -13323,7 +13335,9 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { feedback.update(this.blankText); } - feedback.show(); + if(feedback.dom.innerHTML) { + feedback.show(); + } } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index f5cfd45beb..9bf0110564 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -555,7 +555,8 @@ if(!vt[this.vtype](A,this)){return false;}}if(typeof this.validator=="function") }},focus:function(A){if(this.rendered){this.inputEl().focus();if(A===true){this.inputEl().dom.select();}}return this;},onFocus:function(){if(!Roo.isOpera&&this.focusClass){}if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this); }},beforeBlur:Roo.emptyFn,onBlur:function(){this.beforeBlur();if(!Roo.isOpera&&this.focusClass){}this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate();}var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent('change',this,v,this.startValue); }this.fireEvent("blur",this);},onChange:function(e){var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent('change',this,v,this.startValue);}},reset:function(){this.setValue(this.originalValue);this.el.removeClass([this.invalidClass,this.validClass]); -this.inputEl().removeClass(['is-valid','is-invalid']);},getName:function(){return this.name;},getValue:function(){var v=this.inputEl().getValue();return v;},getRawValue:function(){var v=this.inputEl().getValue();return v;},setRawValue:function(v){return this.inputEl().dom.value=(v===null||v===undefined?'':v); +this.inputEl().removeClass(['is-valid','is-invalid']);if(this.hasFeedback&&this.inputType!='hidden'){var A=this.el.select('.form-control-feedback',true).first();if(A){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]); +A.update('');A.hide();}}},getName:function(){return this.name;},getValue:function(){var v=this.inputEl().getValue();return v;},getRawValue:function(){var v=this.inputEl().getValue();return v;},setRawValue:function(v){return this.inputEl().dom.value=(v===null||v===undefined?'':v); },selectText:function(A,B){var v=this.getRawValue();if(v.length>0){A=A===undefined?0:A;B=B===undefined?v.length:B;var d=this.inputEl().dom;if(d.setSelectionRange){d.setSelectionRange(A,B);}else if(d.createTextRange){var C=d.createTextRange();C.moveStart("character",A); C.moveEnd("character",v.length-B);C.select();}}},setValue:function(v){this.value=v;if(this.rendered){this.inputEl().dom.value=(v===null||v===undefined?'':v);this.validate();}},preFocus:function(){if(this.selectOnFocus){this.inputEl().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();}},clearInvalid:function(){if(!this.el||this.preventMark){return; @@ -568,7 +569,7 @@ this.el.select('.form-control-feedback',true).first().addClass([this.validFeedba var B=this.el.select('.form-control-feedback',true).first();if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);B.update('');B.hide();}if(this.disabled){return;}if(this.allowBlank&&!this.getRawValue().length){return; }if(this.indicator){this.indicator.removeClass(this.indicatorpos=='right'?'hidden':'invisible');this.indicator.addClass('visible');}if(Roo.bootstrap.version==3){this.el.addClass(this.invalidClass);}else{this.inputEl().addClass('is-invalid');}if(this.hasFeedback&&this.inputType!='hidden'){var B=this.el.select('.form-control-feedback',true).first(); if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);this.el.select('.form-control-feedback',true).first().addClass([this.invalidFeedbackClass]);B.update(this.invalidText);if(!this.allowBlank&&!this.getRawValue().length){B.update(this.blankText); -}B.show();}}this.fireEvent('invalid',this,A);},SafariOnKeyDown:function(A){if(this.inputEl().dom.type!='password'){return;}var B=false;if(this.inputEl().dom.selectionEnd>0){B=(this.inputEl().dom.selectionEnd-this.inputEl().dom.selectionStart-this.getValue().length==0)?true:false; +}if(B.dom.innerHTML){B.show();}}}this.fireEvent('invalid',this,A);},SafariOnKeyDown:function(A){if(this.inputEl().dom.type!='password'){return;}var B=false;if(this.inputEl().dom.selectionEnd>0){B=(this.inputEl().dom.selectionEnd-this.inputEl().dom.selectionStart-this.getValue().length==0)?true:false; }if(((A.getKey()==8||A.getKey()==46)&&this.getValue().length==1)){A.preventDefault();this.setValue('');return;}if(B&&A.getCharCode()>31&&!A.ctrlKey){A.preventDefault();var cc=String.fromCharCode(A.getCharCode());this.setValue(A.shiftKey?cc:cc.toLowerCase()); }},adjustWidth:function(A,w){A=A.toLowerCase();if(typeof w=='number'&&Roo.isStrict&&!Roo.isSafari){if(Roo.isIE&&(A=='input'||A=='textarea')){if(A=='input'){return w+2;}if(A=='textarea'){return w-2;}}else if(Roo.isOpera){if(A=='input'){return w+2;}if(A=='textarea'){return w-2; }}}return w;},setFieldLabel:function(v){if(!this.rendered){return;}if(this.indicatorEl()){var ar=this.el.select('label > span',true);if(ar.elements.length){this.el.select('label > span',true).first().dom.innerHTML=(v===null||v===undefined?'':v);this.fieldLabel=v; -- 2.39.2