parent
c1c9953939
commit
730d16d260
|
@ -68,13 +68,13 @@ const PasswordProps = [
|
||||||
{
|
{
|
||||||
name: 'hideIcon',
|
name: 'hideIcon',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: 'pi pi-eye-slash',
|
default: 'null',
|
||||||
description: 'Icon to hide displaying the password as plain text.'
|
description: 'Icon to hide displaying the password as plain text.'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'showIcon',
|
name: 'showIcon',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: 'pi pi-eye',
|
default: 'null',
|
||||||
description: 'Icon to show displaying the password as plain text.'
|
description: 'Icon to show displaying the password as plain text.'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -142,15 +142,23 @@ const PasswordProps = [
|
||||||
const PasswordSlots = [
|
const PasswordSlots = [
|
||||||
{
|
{
|
||||||
name: 'header',
|
name: 'header',
|
||||||
description: "Custom content for the component's header"
|
description: "Custom content for the component's header."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'content',
|
name: 'content',
|
||||||
description: 'Custom content for the component'
|
description: 'Custom content for the component.'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'footer',
|
name: 'footer',
|
||||||
description: "Custom content for the component's footer"
|
description: "Custom content for the component's footer."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'hideicon',
|
||||||
|
description: 'Custom content for the hide icon.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'showicon',
|
||||||
|
description: 'Custom content for the show icon.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -61,12 +61,10 @@ export interface PasswordProps extends InputHTMLAttributes {
|
||||||
toggleMask?: boolean | undefined;
|
toggleMask?: boolean | undefined;
|
||||||
/**
|
/**
|
||||||
* Icon to hide displaying the password as plain text.
|
* Icon to hide displaying the password as plain text.
|
||||||
* @defaultValue pi pi-eye-slash
|
|
||||||
*/
|
*/
|
||||||
hideIcon?: string | undefined;
|
hideIcon?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Icon to show displaying the password as plain text.
|
* Icon to show displaying the password as plain text.
|
||||||
* @defaultValue pi pi-eye
|
|
||||||
*/
|
*/
|
||||||
showIcon?: string | undefined;
|
showIcon?: string | undefined;
|
||||||
/**
|
/**
|
||||||
|
@ -141,6 +139,14 @@ export interface PasswordSlots {
|
||||||
* Custom content template.
|
* Custom content template.
|
||||||
*/
|
*/
|
||||||
content(): VNode[];
|
content(): VNode[];
|
||||||
|
/**
|
||||||
|
* Custom hide icon template.
|
||||||
|
*/
|
||||||
|
hideicon(): VNode[];
|
||||||
|
/**
|
||||||
|
* Custom show icon template.
|
||||||
|
*/
|
||||||
|
showicon(): VNode[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,7 +21,12 @@
|
||||||
@invalid="onInvalid"
|
@invalid="onInvalid"
|
||||||
v-bind="inputProps"
|
v-bind="inputProps"
|
||||||
/>
|
/>
|
||||||
<i v-if="toggleMask" :class="toggleIconClass" @click="onMaskToggle" />
|
<slot v-if="toggleMask && unmasked" name="hideicon">
|
||||||
|
<component :is="hideIcon ? 'i' : 'EyeSlashIcon'" :class="hideIcon" @click="onMaskToggle" />
|
||||||
|
</slot>
|
||||||
|
<slot v-if="toggleMask && !unmasked" name="showicon">
|
||||||
|
<component :is="showIcon ? 'i' : 'EyeIcon'" :class="showIcon" @click="onMaskToggle" />
|
||||||
|
</slot>
|
||||||
<span class="p-hidden-accessible" aria-live="polite">
|
<span class="p-hidden-accessible" aria-live="polite">
|
||||||
{{ infoText }}
|
{{ infoText }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -43,6 +48,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import EyeIcon from 'primevue/icon/eye';
|
||||||
|
import EyeSlashIcon from 'primevue/icon/eyeslash';
|
||||||
import InputText from 'primevue/inputtext';
|
import InputText from 'primevue/inputtext';
|
||||||
import OverlayEventBus from 'primevue/overlayeventbus';
|
import OverlayEventBus from 'primevue/overlayeventbus';
|
||||||
import Portal from 'primevue/portal';
|
import Portal from 'primevue/portal';
|
||||||
|
@ -91,11 +98,11 @@ export default {
|
||||||
},
|
},
|
||||||
hideIcon: {
|
hideIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'pi pi-eye-slash'
|
default: undefined
|
||||||
},
|
},
|
||||||
showIcon: {
|
showIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'pi pi-eye'
|
default: undefined
|
||||||
},
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -383,9 +390,6 @@ export default {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
toggleIconClass() {
|
|
||||||
return this.unmasked ? this.hideIcon : this.showIcon;
|
|
||||||
},
|
|
||||||
strengthClass() {
|
strengthClass() {
|
||||||
return `p-password-strength ${this.meter ? this.meter.strength : ''}`;
|
return `p-password-strength ${this.meter ? this.meter.strength : ''}`;
|
||||||
},
|
},
|
||||||
|
@ -413,7 +417,9 @@ export default {
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
PInputText: InputText,
|
PInputText: InputText,
|
||||||
Portal: Portal
|
Portal: Portal,
|
||||||
|
EyeSlashIcon: EyeSlashIcon,
|
||||||
|
EyeIcon: EyeIcon
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue