Roo/bootstrap/form/Input.js
authorleon <leon@roojs.com>
Wed, 19 Jul 2023 06:57:57 +0000 (14:57 +0800)
committerleon <leon@roojs.com>
Wed, 19 Jul 2023 06:57:57 +0000 (14:57 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/form/Input.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index a322569..9cdfb59 100644 (file)
@@ -1011,7 +1011,6 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component,  {
      */
     markInvalid : function(msg)
     {
-        Roo.log('MARK INVALID');
         if(!this.el  || this.preventMark){ // not rendered
             return;
         }
@@ -1053,14 +1052,10 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component,  {
             var feedback = this.el.select('.form-control-feedback', true).first();
             
             if(feedback){
-                Roo.log('MARK');
                 this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
                 
                 this.el.select('.form-control-feedback', true).first().addClass([this.invalidFeedbackClass]);
 
-                Roo.log(msg);
-                Roo.log(feedback);
-
                 feedback.update(typeof(msg) == 'undefined' ? this.invalidText : msg);
 
                 if(!this.allowBlank && !this.getRawValue().length){
index df201df..102e17f 100644 (file)
@@ -13292,7 +13292,6 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component,  {
      */
     markInvalid : function(msg)
     {
-        Roo.log('MARK INVALID');
         if(!this.el  || this.preventMark){ // not rendered
             return;
         }
@@ -13334,14 +13333,10 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component,  {
             var feedback = this.el.select('.form-control-feedback', true).first();
             
             if(feedback){
-                Roo.log('MARK');
                 this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
                 
                 this.el.select('.form-control-feedback', true).first().addClass([this.invalidFeedbackClass]);
 
-                Roo.log(msg);
-                Roo.log(feedback);
-
                 feedback.update(typeof(msg) == 'undefined' ? this.invalidText : msg);
 
                 if(!this.allowBlank && !this.getRawValue().length){
@@ -25916,8 +25911,8 @@ Roo.extend(Roo.bootstrap.form.SecurePass, Roo.bootstrap.form.Input, {
                 return true;
             }
 
-            this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdEmpty);
-            this.errorMsg = Roo.bootstrap.form.SecurePass.errors.PwdEmpty;
+            // this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdEmpty);
+            this.invalidText = Roo.bootstrap.form.SecurePass.errors.PwdEmpty;
             return false;
         }
         
@@ -25931,7 +25926,6 @@ Roo.extend(Roo.bootstrap.form.SecurePass, Roo.bootstrap.form.Input, {
             return false;
         }
         if (value.length < 6) {
-            Roo.log(Roo.bootstrap.form.SecurePass.errors);
             this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdShort);
             this.errorMsg = Roo.bootstrap.form.SecurePass.errors.PwdShort;
             return false;
index f2286a2..367c529 100644 (file)
@@ -565,12 +565,11 @@ A.update('');A.hide();}}if(this.indicator){this.indicator.removeClass('visible')
 this.inputEl().removeClass(['is-valid','is-invalid']);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();
 }if(this.indicator){this.indicator.removeClass('visible');this.indicator.addClass(this.indicatorpos=='right'?'hidden':'invisible');}if(this.disabled){return;}if(this.allowBlank&&!this.getRawValue().length){return;}if(Roo.bootstrap.version==3){this.el.addClass(this.validClass);
 }else{this.inputEl().addClass('is-valid');}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]);
-this.el.select('.form-control-feedback',true).first().addClass([this.validFeedbackClass]);}}this.fireEvent('valid',this);},markInvalid:function(A){Roo.log('MARK INVALID');if(!this.el||this.preventMark){return;}this.el.removeClass([this.invalidClass,this.validClass]);
-this.inputEl().removeClass(['is-valid','is-invalid']);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){Roo.log('MARK');this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);
-this.el.select('.form-control-feedback',true).first().addClass([this.invalidFeedbackClass]);Roo.log(A);Roo.log(B);B.update(typeof(A)=='undefined'?this.invalidText:A);if(!this.allowBlank&&!this.getRawValue().length){B.update(this.blankText);}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;
+this.el.select('.form-control-feedback',true).first().addClass([this.validFeedbackClass]);}}this.fireEvent('valid',this);},markInvalid:function(A){if(!this.el||this.preventMark){return;}this.el.removeClass([this.invalidClass,this.validClass]);this.inputEl().removeClass(['is-valid','is-invalid']);
+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(typeof(A)=='undefined'?this.invalidText:A);
+if(!this.allowBlank&&!this.getRawValue().length){B.update(this.blankText);}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;
@@ -1105,16 +1104,16 @@ if(this.el.is('input[type=password]')&&Roo.isSafari){this.el.on('keydown',this.S
 if(A==this._lastPwd){return;}var B;if(this.ClientSideStrongPassword(A)){B=3;}else if(this.ClientSideMediumPassword(A)){B=2;}else if(this.ClientSideWeakPassword(A)){B=1;}else{B=0;}Roo.log('strength1: '+B);var pm=this.trigger.child('div/div');pm.removeClass(Roo.bootstrap.form.SecurePass.meterClass);
 pm.addClass(Roo.bootstrap.form.SecurePass.meterClass[B]);var pt=this.trigger.child('/div').child('>*[class=roo-password-meter-text]').dom;pt.innerHTML=Roo.bootstrap.form.SecurePass.meterLabel+'&nbsp;'+Roo.bootstrap.form.SecurePass.pwdStrengths[B];this._lastPwd=A;
 },reset:function(){Roo.bootstrap.form.SecurePass.superclass.reset.call(this);this._lastPwd='';var pm=this.trigger.child('div/div');pm.removeClass(Roo.bootstrap.form.SecurePass.meterClass);pm.addClass('roo-password-meter-grey');var pt=this.trigger.child('/div').child('>*[class=roo-password-meter-text]').dom;
-pt.innerHTML='';this.inputEl().dom.type='password';},validateValue:function(A){if(!Roo.bootstrap.form.SecurePass.superclass.validateValue.call(this,A)){return false;}if(A.length==0){if(this.allowBlank){this.clearInvalid();return true;}this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdEmpty);
-this.errorMsg=Roo.bootstrap.form.SecurePass.errors.PwdEmpty;return false;}if(this.insecure){return true;}if(!A.match(/[\x21-\x7e]+/)){this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdBadChar);this.errorMsg=Roo.bootstrap.form.SecurePass.errors.PwdBadChar;
-return false;}if(A.length<6){Roo.log(Roo.bootstrap.form.SecurePass.errors);this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdShort);this.errorMsg=Roo.bootstrap.form.SecurePass.errors.PwdShort;return false;}if(A.length>16){this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdLong);
-this.errorMsg=Roo.bootstrap.form.SecurePass.errors.PwdLong;return false;}var B;if(this.ClientSideStrongPassword(A)){B=3;}else if(this.ClientSideMediumPassword(A)){B=2;}else if(this.ClientSideWeakPassword(A)){B=1;}else{B=0;}if(B<2){this.errorMsg=Roo.bootstrap.form.SecurePass.errors.TooWeak;
-}console.log('strength2: '+B);var pm=this.trigger.child('div/div');pm.removeClass(Roo.bootstrap.form.SecurePass.meterClass);pm.addClass(Roo.bootstrap.form.SecurePass.meterClass[B]);var pt=this.trigger.child('/div').child('>*[class=roo-password-meter-text]').dom;
-pt.innerHTML=Roo.bootstrap.form.SecurePass.meterLabel+'&nbsp;'+Roo.bootstrap.form.SecurePass.pwdStrengths[B];this.errorMsg='';return true;},CharacterSetChecks:function(A){this.type=A;this.fResult=false;},isctype:function(A,B){switch(B){case this.kCapitalLetter:if(A>='A'&&A<='Z'){return true;
-}break;case this.kSmallLetter:if(A>='a'&&A<='z'){return true;}break;case this.kDigit:if(A>='0'&&A<='9'){return true;}break;case this.kPunctuation:if('!@#$%^&*()_+-=\'";:[{]}|.>,</?`~'.indexOf(A)>=0){return true;}break;default:return false;}},IsLongEnough:function(A,B){return !(A==null||isNaN(B)||A.length<B);
-},SpansEnoughCharacterSets:function(A,nb){if(!this.IsLongEnough(A,nb)){return false;}var B=new Array(new this.CharacterSetChecks(this.kCapitalLetter),new this.CharacterSetChecks(this.kSmallLetter),new this.CharacterSetChecks(this.kDigit),new this.CharacterSetChecks(this.kPunctuation));
-for(var C=0;C<A.length;++C){for(var D=0;D<B.length;++D){if(!B[D].fResult&&this.isctype(A.charAt(C),B[D].type)){B[D].fResult=true;break;}}}var E=0;for(var D=0;D<B.length;++D){if(B[D].fResult){++E;}}if(E<nb){return false;}return true;},ClientSideStrongPassword:function(A){return this.IsLongEnough(A,8)&&this.SpansEnoughCharacterSets(A,3);
-},ClientSideMediumPassword:function(A){return this.IsLongEnough(A,7)&&this.SpansEnoughCharacterSets(A,2);},ClientSideWeakPassword:function(A){return this.IsLongEnough(A,6)||!this.IsLongEnough(A,0);}});Roo.bootstrap.form.SecurePass.errors={PwdEmpty:"Please type a password, and then retype it to confirm.",PwdShort:"Your password must be at least 6 characters long. Please type a different password.",PwdLong:"Your password can't contain more than 16 characters. Please type a different password.",PwdBadChar:"The password contains characters that aren't allowed. Please type a different password.",IDInPwd:"Your password can't include the part of your ID. Please type a different password.",FNInPwd:"Your password can't contain your first name. Please type a different password.",LNInPwd:"Your password can't contain your last name. Please type a different password.",TooWeak:"Your password is Too Weak."}
+pt.innerHTML='';this.inputEl().dom.type='password';},validateValue:function(A){if(!Roo.bootstrap.form.SecurePass.superclass.validateValue.call(this,A)){return false;}if(A.length==0){if(this.allowBlank){this.clearInvalid();return true;}this.invalidText=Roo.bootstrap.form.SecurePass.errors.PwdEmpty;
+return false;}if(this.insecure){return true;}if(!A.match(/[\x21-\x7e]+/)){this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdBadChar);this.errorMsg=Roo.bootstrap.form.SecurePass.errors.PwdBadChar;return false;}if(A.length<6){this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdShort);
+this.errorMsg=Roo.bootstrap.form.SecurePass.errors.PwdShort;return false;}if(A.length>16){this.markInvalid(Roo.bootstrap.form.SecurePass.errors.PwdLong);this.errorMsg=Roo.bootstrap.form.SecurePass.errors.PwdLong;return false;}var B;if(this.ClientSideStrongPassword(A)){B=3;
+}else if(this.ClientSideMediumPassword(A)){B=2;}else if(this.ClientSideWeakPassword(A)){B=1;}else{B=0;}if(B<2){this.errorMsg=Roo.bootstrap.form.SecurePass.errors.TooWeak;}console.log('strength2: '+B);var pm=this.trigger.child('div/div');pm.removeClass(Roo.bootstrap.form.SecurePass.meterClass);
+pm.addClass(Roo.bootstrap.form.SecurePass.meterClass[B]);var pt=this.trigger.child('/div').child('>*[class=roo-password-meter-text]').dom;pt.innerHTML=Roo.bootstrap.form.SecurePass.meterLabel+'&nbsp;'+Roo.bootstrap.form.SecurePass.pwdStrengths[B];this.errorMsg='';
+return true;},CharacterSetChecks:function(A){this.type=A;this.fResult=false;},isctype:function(A,B){switch(B){case this.kCapitalLetter:if(A>='A'&&A<='Z'){return true;}break;case this.kSmallLetter:if(A>='a'&&A<='z'){return true;}break;case this.kDigit:if(A>='0'&&A<='9'){return true;
+}break;case this.kPunctuation:if('!@#$%^&*()_+-=\'";:[{]}|.>,</?`~'.indexOf(A)>=0){return true;}break;default:return false;}},IsLongEnough:function(A,B){return !(A==null||isNaN(B)||A.length<B);},SpansEnoughCharacterSets:function(A,nb){if(!this.IsLongEnough(A,nb)){return false;
+}var B=new Array(new this.CharacterSetChecks(this.kCapitalLetter),new this.CharacterSetChecks(this.kSmallLetter),new this.CharacterSetChecks(this.kDigit),new this.CharacterSetChecks(this.kPunctuation));for(var C=0;C<A.length;++C){for(var D=0;D<B.length;++D){if(!B[D].fResult&&this.isctype(A.charAt(C),B[D].type)){B[D].fResult=true;
+break;}}}var E=0;for(var D=0;D<B.length;++D){if(B[D].fResult){++E;}}if(E<nb){return false;}return true;},ClientSideStrongPassword:function(A){return this.IsLongEnough(A,8)&&this.SpansEnoughCharacterSets(A,3);},ClientSideMediumPassword:function(A){return this.IsLongEnough(A,7)&&this.SpansEnoughCharacterSets(A,2);
+},ClientSideWeakPassword:function(A){return this.IsLongEnough(A,6)||!this.IsLongEnough(A,0);}});Roo.bootstrap.form.SecurePass.errors={PwdEmpty:"Please type a password, and then retype it to confirm.",PwdShort:"Your password must be at least 6 characters long. Please type a different password.",PwdLong:"Your password can't contain more than 16 characters. Please type a different password.",PwdBadChar:"The password contains characters that aren't allowed. Please type a different password.",IDInPwd:"Your password can't include the part of your ID. Please type a different password.",FNInPwd:"Your password can't contain your first name. Please type a different password.",LNInPwd:"Your password can't contain your last name. Please type a different password.",TooWeak:"Your password is Too Weak."}
 ;Roo.bootstrap.form.SecurePass.meterLabel="Password strength:";Roo.bootstrap.form.SecurePass.pwdStrengths=["Too Weak","Weak","Medium","Strong"];Roo.bootstrap.form.SecurePass.meterClass=["roo-password-meter-tooweak","roo-password-meter-weak","roo-password-meter-medium","roo-password-meter-strong","roo-password-meter-grey"];
 
 // Roo/bootstrap/form/Password.js