From afdca9862975245cdb4831c6e503b36986f5e20e Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 2 Aug 2023 15:05:33 -0600 Subject: [PATCH] Fix up password customfield - passwd->et2-password custom field type - passwordToggle attribute (changed name, icon didn't change) --- api/js/etemplate/Et2Textbox/Et2Password.ts | 9 +++++---- api/js/etemplate/et2_extension_customfields.ts | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/js/etemplate/Et2Textbox/Et2Password.ts b/api/js/etemplate/Et2Textbox/Et2Password.ts index 7db20bb879..84e8dec7c3 100644 --- a/api/js/etemplate/Et2Textbox/Et2Password.ts +++ b/api/js/etemplate/Et2Textbox/Et2Password.ts @@ -68,7 +68,7 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox) if(attrs.viewable) { - attrs['toggle-password'] = true; + attrs['passwordToggle'] = true; } super.transformAttributes(attrs); @@ -151,6 +151,7 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox) if (!this.visible || !this.encrypted) { + this.type = this.visible ? 'text' : 'password'; return; } @@ -295,11 +296,11 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox) part="password-toggle-button" class="input__password-toggle" type="button" - aria-label=${this.localize.term(this.passwordVisible ? 'hidePassword' : 'showPassword')} + aria-label=${this.localize.term(this.isPasswordVisible ? 'hidePassword' : 'showPassword')} @click=${this.handlePasswordToggle} tabindex="-1" > - ${this.passwordVisible + ${this.isPasswordVisible ? html` @@ -335,7 +336,7 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox) { if(!this.readonly) { - this.shadowRoot.querySelector("input[type='password']").removeAttribute("readonly"); + this.shadowRoot.querySelector("input").removeAttribute("readonly"); } super.handleFocus(e); } diff --git a/api/js/etemplate/et2_extension_customfields.ts b/api/js/etemplate/et2_extension_customfields.ts index 1f9d3dbe6b..9b8dee9cea 100644 --- a/api/js/etemplate/et2_extension_customfields.ts +++ b/api/js/etemplate/et2_extension_customfields.ts @@ -563,6 +563,7 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac { // No label on the widget itself delete (attrs.label); + attrs.type = "password"; let defaults = { viewable:true, plaintext: false,