2023-05-25 08:53:29 +00:00
|
|
|
<script>
|
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
|
|
import { useStyle } from 'primevue/usestyle';
|
|
|
|
|
|
|
|
const styles = `
|
|
|
|
.p-password {
|
|
|
|
display: inline-flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password .p-password-panel {
|
|
|
|
min-width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-meter {
|
|
|
|
height: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-strength {
|
|
|
|
height: 100%;
|
|
|
|
width: 0;
|
|
|
|
transition: width 1s ease-in-out;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-fluid .p-password {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-password-input::-ms-reveal,
|
|
|
|
.p-password-input::-ms-clear {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const inlineStyles = {
|
|
|
|
root: ({ props }) => ({ position: props.appendTo === 'self' ? 'relative' : undefined })
|
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props }) => [
|
|
|
|
'p-password p-component p-inputwrapper',
|
|
|
|
{
|
|
|
|
'p-inputwrapper-filled': instance.filled,
|
|
|
|
'p-inputwrapper-focus': instance.focused,
|
|
|
|
'p-input-icon-right': props.toggleMask
|
|
|
|
}
|
|
|
|
],
|
|
|
|
input: ({ props }) => [
|
|
|
|
'p-password-input',
|
|
|
|
{
|
|
|
|
'p-disabled': props.disabled
|
|
|
|
}
|
|
|
|
],
|
|
|
|
hiddenAccesible: 'p-hidden-accessible',
|
|
|
|
panel: ({ instance }) => [
|
|
|
|
'p-password-panel p-component',
|
|
|
|
{
|
|
|
|
'p-input-filled': instance.$primevue.config.inputStyle === 'filled',
|
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
meter: 'p-password-meter',
|
|
|
|
meterLabel: ({ instance }) => `p-password-strength ${instance.meter ? instance.meter.strength : ''}`,
|
|
|
|
info: 'p-password-info'
|
|
|
|
};
|
|
|
|
|
2023-05-30 11:06:57 +00:00
|
|
|
const { load: loadStyle } = useStyle(styles, { id: 'primevue_password_style', manual: true });
|
2023-05-25 08:53:29 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BasePassword',
|
|
|
|
extends: BaseComponent,
|
|
|
|
props: {
|
|
|
|
modelValue: String,
|
|
|
|
promptLabel: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
mediumRegex: {
|
|
|
|
type: String,
|
|
|
|
default: '^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})' // eslint-disable-line
|
|
|
|
},
|
|
|
|
strongRegex: {
|
|
|
|
type: String,
|
|
|
|
default: '^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})' // eslint-disable-line
|
|
|
|
},
|
|
|
|
weakLabel: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
mediumLabel: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
strongLabel: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
feedback: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
appendTo: {
|
|
|
|
type: String,
|
|
|
|
default: 'body'
|
|
|
|
},
|
|
|
|
toggleMask: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
hideIcon: {
|
|
|
|
type: String,
|
|
|
|
default: undefined
|
|
|
|
},
|
|
|
|
showIcon: {
|
|
|
|
type: String,
|
|
|
|
default: undefined
|
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
placeholder: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
required: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
inputId: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
inputClass: {
|
|
|
|
type: [String, Object],
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
inputStyle: {
|
|
|
|
type: Object,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
inputProps: {
|
|
|
|
type: null,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
panelId: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
panelClass: {
|
|
|
|
type: [String, Object],
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
panelStyle: {
|
|
|
|
type: Object,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
panelProps: {
|
|
|
|
type: null,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
'aria-labelledby': {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
'aria-label': {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
classes,
|
2023-05-30 11:06:57 +00:00
|
|
|
inlineStyles,
|
|
|
|
loadStyle
|
2023-05-25 08:53:29 +00:00
|
|
|
},
|
2023-05-30 11:06:57 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-25 08:53:29 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|