#8448 - devToTest #1254

Merged
alexm merged 365 commits from 8448-devToTest into test 2025-01-21 10:44:46 +00:00
2 changed files with 31 additions and 38 deletions
Showing only changes of commit f0364124cc - Show all commits

View File

@ -76,48 +76,42 @@ defineExpose({ show: () => changePassDialog.value.show() });
v-if="props.askOldPass" v-if="props.askOldPass"
:label="t('Old password')" :label="t('Old password')"
v-model="passwords.oldPassword" v-model="passwords.oldPassword"
:type="showPwd ? 'password' : 'text'" type="password"
:required="true" :required="true"
autofocus autofocus
> :clearable="true"
<template #append> :show-pwd="showPwd"
<QIcon @update:show-pwd="showPwd = $event"
:name="showPwd ? 'visibility_off' : 'visibility'"
class="cursor-pointer"
@click="showPwd = !showPwd"
/> />
</template>
</VnInput>
<VnInput <VnInput
:required="true" :required="true"
autofocus autofocus
v-model="passwords.newPassword" v-model="passwords.newPassword"
:label="$t('New password')" :label="$t('New password')"
:type="showPwd ? 'password' : 'text'" :show-pwd="showPwd"
hint="" @update:show-pwd="showPwd = $event"
> >
<template #append> <!-- <template #append>
<QIcon <QIcon
:name="showPwd ? 'visibility_off' : 'visibility'" :name="showPwd ? 'visibility_off' : 'visibility'"
class="cursor-pointer" class="cursor-pointer"
@click="showPwd = !showPwd" @click="showPwd = !showPwd"
/> />
</template> </template> -->
</VnInput> </VnInput>
<VnInput <VnInput
:label="t('Repeat password')" :label="t('Repeat password')"
v-model="passwords.repeatPassword" v-model="passwords.repeatPassword"
:type="showRpPwd ? 'password' : 'text'" type="password"
hint="" :toggle-visibility="true"
> />
<template #append> <!-- <template #append>
<QIcon <QIcon
:name="showRpPwd ? 'visibility_off' : 'visibility'" :name="showRpPwd ? 'visibility_off' : 'visibility'"
class="cursor-pointer" class="cursor-pointer"
@click="showRpPwd = !showRpPwd" @click="showRpPwd = !showRpPwd"
/> />
</template> </template> -->
</VnInput>
</QCardSection> </QCardSection>
</QForm> </QForm>
<QCardActions> <QCardActions>

View File

@ -42,9 +42,15 @@ const $props = defineProps({
type: Number, type: Number,
default: null, default: null,
}, },
toggleVisibility: {
// Nueva propiedad
type: Boolean,
default: false,
},
}); });
const vnInputRef = ref(null); const vnInputRef = ref(null);
const showPassword = ref(false); // Estado para la visibilidad de contraseña
const value = computed({ const value = computed({
get() { get() {
return $props.modelValue; return $props.modelValue;
@ -124,7 +130,7 @@ const handleInsertMode = (e) => {
ref="vnInputRef" ref="vnInputRef"
v-model="value" v-model="value"
v-bind="{ ...$attrs, ...styleAttrs }" v-bind="{ ...$attrs, ...styleAttrs }"
:type="$attrs.type" :type="toggleVisibility ? (showPassword ? 'text' : 'password') : $attrs.type"
:class="{ required: isRequired }" :class="{ required: isRequired }"
@keyup.enter="emit('keyup.enter')" @keyup.enter="emit('keyup.enter')"
@keydown="handleKeydown" @keydown="handleKeydown"
@ -134,10 +140,18 @@ const handleInsertMode = (e) => {
hide-bottom-space hide-bottom-space
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'" :data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
> >
<template v-if="$slots.prepend" #prepend> <template #prepend>
<slot name="prepend" /> <slot name="prepend" />
</template> </template>
<template #append> <template #append>
<!-- Icono para mostrar/ocultar contraseña -->
<QIcon
v-if="toggleVisibility"
:name="showPassword ? 'visibility_off' : 'visibility'"
class="cursor-pointer"
@click="showPassword = !showPassword"
/>
<!-- Ícono para borrar el valor -->
<QIcon <QIcon
name="close" name="close"
size="xs" size="xs"
@ -155,7 +169,7 @@ const handleInsertMode = (e) => {
emit('remove'); emit('remove');
} }
" "
></QIcon> />
<slot name="append" v-if="$slots.append && !$attrs.disabled" /> <slot name="append" v-if="$slots.append && !$attrs.disabled" />
<QIcon v-if="info" name="info"> <QIcon v-if="info" name="info">
<QTooltip max-width="350px"> <QTooltip max-width="350px">
@ -166,18 +180,3 @@ const handleInsertMode = (e) => {
</QInput> </QInput>
</div> </div>
</template> </template>
<i18n>
en:
inputMin: Must be more than {value}
maxLength: The value exceeds {value} characters
inputMax: Must be less than {value}
es:
inputMin: Debe ser mayor a {value}
maxLength: El valor excede los {value} carácteres
inputMax: Debe ser menor a {value}
</i18n>
<style lang="scss">
.q-field__append {
padding-inline: 0;
}
</style>