fix(VnSelect): refs #8224 improve focus handling and update selected item template
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-04-23 14:59:41 +02:00
parent 4ad9a3e613
commit f509616f86
1 changed files with 14 additions and 7 deletions

View File

@ -397,13 +397,15 @@ function getOptionLabel(property) {
@keydown="handleKeyDown" @keydown="handleKeyDown"
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'" :data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
:data-url="url" :data-url="url"
@focus=" @blur="hasFocus = false"
@update:model-value="() => vnSelectRef.blur()"
@popup-show="
async () => { async () => {
hasFocus = true; hasFocus = true;
await $nextTick();
vnSelectRef?.$el?.querySelector('input')?.focus();
} }
" "
@blur="() => (hasFocus = false)"
@update:model-value="vnSelectRef.blur()"
> >
<template #append> <template #append>
<QIcon <QIcon
@ -412,7 +414,6 @@ function getOptionLabel(property) {
@click=" @click="
() => { () => {
value = null; value = null;
vnSelectRef.blur();
emit('remove'); emit('remove');
} }
" "
@ -454,9 +455,15 @@ function getOptionLabel(property) {
</QItemSection> </QItemSection>
</QItem> </QItem>
</template> </template>
<template #selected-item="scope" v-if="valueIsObject"> <template #selected v-if="valueIsObject">
<span class="nowrap" @click="vnSelectRef.showPopup()"> <span class="nowrap">
<s class="nowrap" v-if="scope?.opt.neq" v-text="getOptionLabel('neq')" /> <s
class="nowrap"
v-if="modelValue?.neq"
v-text="getOptionLabel('neq')"
:title="getOptionLabel('neq')"
/>
<span v-else>{{ JSON.stringify(modelValue) }}</span>
</span> </span>
</template> </template>
</QSelect> </QSelect>