From e562d951b84e429a92bc0d988446a0da3f943d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 21 May 2021 12:25:49 +0300 Subject: [PATCH] Fixed #1286 - hideIcon and showIcon for Password --- src/components/password/Password.d.ts | 2 ++ src/components/password/Password.vue | 10 +++++++++- src/views/password/PasswordDoc.vue | 12 ++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/components/password/Password.d.ts b/src/components/password/Password.d.ts index c36a3102da..146150eba3 100755 --- a/src/components/password/Password.d.ts +++ b/src/components/password/Password.d.ts @@ -13,6 +13,8 @@ declare class Password extends Vue { toggleMask?: boolean; inputStyle?: any; inputClass?: string; + hideIcon?: string; + showIcon?: string; $emit(eventName: 'input', value: any): this; $emit(eventName: 'focus', event: Event): this; $emit(eventName: 'blur', event: Event): this; diff --git a/src/components/password/Password.vue b/src/components/password/Password.vue index 436efd7b0f..ae6d0ba879 100755 --- a/src/components/password/Password.vue +++ b/src/components/password/Password.vue @@ -61,6 +61,14 @@ export default { type: Boolean, default: false }, + hideIcon: { + type: String, + default: 'pi pi-eye-slash' + }, + showIcon: { + type: String, + default: 'pi pi-eye' + }, inputClass: null, inputStyle: null, styles: null, @@ -256,7 +264,7 @@ export default { }]; }, toggleIconClass() { - return this.unmasked ? 'pi pi-eye-slash' : 'pi pi-eye'; + return this.unmasked ? this.hideIcon : this.showIcon; }, strengthClass() { return `p-password-strength ${this.meter ? this.meter.strength : ''}`; diff --git a/src/views/password/PasswordDoc.vue b/src/views/password/PasswordDoc.vue index 977cfc5261..f117d861b9 100755 --- a/src/views/password/PasswordDoc.vue +++ b/src/views/password/PasswordDoc.vue @@ -142,6 +142,18 @@ import Password from 'primevue/password'; string null Style class of the input field. + + + hideIcon + string + pi pi-eye-slash + Icon to hide displaying the password as plain text. + + + showIcon + string + pi pi-eye + Icon to show displaying the password as plain text.