Fix up password customfield

- passwd->et2-password custom field type
- passwordToggle attribute (changed name, icon didn't change)
This commit is contained in:
nathan 2023-08-02 15:05:33 -06:00
parent b92d45c44a
commit afdca98629
2 changed files with 6 additions and 4 deletions

View File

@ -68,7 +68,7 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox)
if(attrs.viewable) if(attrs.viewable)
{ {
attrs['toggle-password'] = true; attrs['passwordToggle'] = true;
} }
super.transformAttributes(attrs); super.transformAttributes(attrs);
@ -151,6 +151,7 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox)
if (!this.visible || !this.encrypted) if (!this.visible || !this.encrypted)
{ {
this.type = this.visible ? 'text' : 'password';
return; return;
} }
@ -295,11 +296,11 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox)
part="password-toggle-button" part="password-toggle-button"
class="input__password-toggle" class="input__password-toggle"
type="button" type="button"
aria-label=${this.localize.term(this.passwordVisible ? 'hidePassword' : 'showPassword')} aria-label=${this.localize.term(this.isPasswordVisible ? 'hidePassword' : 'showPassword')}
@click=${this.handlePasswordToggle} @click=${this.handlePasswordToggle}
tabindex="-1" tabindex="-1"
> >
${this.passwordVisible ${this.isPasswordVisible
? html` ? html`
<slot name="show-password-icon"> <slot name="show-password-icon">
<sl-icon name="eye-slash" library="system"></sl-icon> <sl-icon name="eye-slash" library="system"></sl-icon>
@ -335,7 +336,7 @@ export class Et2Password extends Et2InvokerMixin(Et2Textbox)
{ {
if(!this.readonly) if(!this.readonly)
{ {
this.shadowRoot.querySelector("input[type='password']").removeAttribute("readonly"); this.shadowRoot.querySelector("input").removeAttribute("readonly");
} }
super.handleFocus(e); super.handleFocus(e);
} }

View File

@ -563,6 +563,7 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
{ {
// No label on the widget itself // No label on the widget itself
delete (attrs.label); delete (attrs.label);
attrs.type = "password";
let defaults = { let defaults = {
viewable:true, viewable:true,
plaintext: false, plaintext: false,