forked from verdnatura/salix-front
fix: refs #7699 fix vnInputPassword
This commit is contained in:
parent
0d9ba62d37
commit
4c57e55f25
|
@ -2,9 +2,9 @@
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnRow from '../ui/VnRow.vue';
|
import VnRow from '../ui/VnRow.vue';
|
||||||
import VnInput from './VnInput.vue';
|
|
||||||
import FetchData from '../FetchData.vue';
|
import FetchData from '../FetchData.vue';
|
||||||
import useNotify from 'src/composables/useNotify';
|
import useNotify from 'src/composables/useNotify';
|
||||||
|
import VnInputPassword from './VnInputPassword.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
submitFn: { type: Function, default: () => {} },
|
submitFn: { type: Function, default: () => {} },
|
||||||
|
@ -70,19 +70,17 @@ defineExpose({ show: () => changePassDialog.value.show() });
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QForm ref="form">
|
<QForm ref="form">
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<VnInput
|
<VnInputPassword
|
||||||
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="password"
|
|
||||||
:required="true"
|
:required="true"
|
||||||
autofocus
|
|
||||||
:toggle-visibility="true"
|
:toggle-visibility="true"
|
||||||
|
autofocus
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInputPassword
|
||||||
:label="t('New password')"
|
:label="t('New password')"
|
||||||
v-model="passwords.newPassword"
|
v-model="passwords.newPassword"
|
||||||
type="password"
|
|
||||||
:required="true"
|
:required="true"
|
||||||
:toggle-visibility="true"
|
:toggle-visibility="true"
|
||||||
:info="
|
:info="
|
||||||
|
@ -97,10 +95,9 @@ defineExpose({ show: () => changePassDialog.value.show() });
|
||||||
autofocus
|
autofocus
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnInput
|
<VnInputPassword
|
||||||
:label="t('Repeat password')"
|
:label="t('Repeat password')"
|
||||||
v-model="passwords.repeatPassword"
|
v-model="passwords.repeatPassword"
|
||||||
type="password"
|
|
||||||
:toggle-visibility="true"
|
:toggle-visibility="true"
|
||||||
/>
|
/>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
|
|
|
@ -42,10 +42,6 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
toggleVisibility: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const vnInputRef = ref(null);
|
const vnInputRef = ref(null);
|
||||||
|
@ -129,7 +125,7 @@ const handleInsertMode = (e) => {
|
||||||
ref="vnInputRef"
|
ref="vnInputRef"
|
||||||
v-model="value"
|
v-model="value"
|
||||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||||
:type="toggleVisibility ? (showPassword ? 'text' : 'password') : $attrs.type"
|
:type="$attrs.type"
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
@keyup.enter="emit('keyup.enter')"
|
@keyup.enter="emit('keyup.enter')"
|
||||||
@keydown="handleKeydown"
|
@keydown="handleKeydown"
|
||||||
|
@ -143,12 +139,6 @@ const handleInsertMode = (e) => {
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
</template>
|
</template>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
|
||||||
v-if="toggleVisibility"
|
|
||||||
:name="showPassword ? 'visibility_off' : 'visibility'"
|
|
||||||
class="cursor-pointer"
|
|
||||||
@click="showPassword = !showPassword"
|
|
||||||
/>
|
|
||||||
<QIcon
|
<QIcon
|
||||||
name="close"
|
name="close"
|
||||||
size="xs"
|
size="xs"
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<script setup>
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
modelValue: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
toggleVisibility: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const showPassword = ref(false);
|
||||||
|
const model = defineModel({ type: [Number, String] });
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnInput
|
||||||
|
v-bind="{ ...$attrs }"
|
||||||
|
v-model.number="model"
|
||||||
|
:type="
|
||||||
|
$props.toggleVisibility ? (showPassword ? 'text' : 'password') : $attrs.type
|
||||||
|
"
|
||||||
|
hint=""
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<QIcon
|
||||||
|
:name="showPassword ? 'visibility_off' : 'visibility'"
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="showPassword = !showPassword"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
|
</template>
|
Loading…
Reference in New Issue