|
|
@ -74,36 +74,19 @@ const selectedTitles = computed(() => |
|
|
|
? typeof modelValue === 'string' |
|
|
|
? typeof modelValue === 'string' |
|
|
|
? isMysql |
|
|
|
? isMysql |
|
|
|
? modelValue.split(',').sort((a, b) => { |
|
|
|
? modelValue.split(',').sort((a, b) => { |
|
|
|
const opa = options.value.find((el) => el.title === a) |
|
|
|
const opa = options.value.find((el) => el.title === a) |
|
|
|
const opb = options.value.find((el) => el.title === b) |
|
|
|
const opb = options.value.find((el) => el.title === b) |
|
|
|
if (opa && opb) { |
|
|
|
if (opa && opb) { |
|
|
|
return opa.order! - opb.order! |
|
|
|
return opa.order! - opb.order! |
|
|
|
} |
|
|
|
} |
|
|
|
return 0 |
|
|
|
return 0 |
|
|
|
}) |
|
|
|
}) |
|
|
|
: modelValue.split(',') |
|
|
|
: modelValue.split(',') |
|
|
|
: modelValue |
|
|
|
: modelValue |
|
|
|
: [], |
|
|
|
: [], |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const v = Math.floor(Math.random() * 1000) |
|
|
|
const v = Math.floor(Math.random() *1000) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleKeys = (e: KeyboardEvent) => { |
|
|
|
|
|
|
|
console.log(`handleKeys ${v}`, e.key) |
|
|
|
|
|
|
|
if (!active.value) return true |
|
|
|
|
|
|
|
switch (e.key) { |
|
|
|
|
|
|
|
case 'ArrowDown': |
|
|
|
|
|
|
|
case 'ArrowUp': |
|
|
|
|
|
|
|
if (isOpen.value) { |
|
|
|
|
|
|
|
e.stopPropagation() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
case 'Enter': |
|
|
|
|
|
|
|
e.stopPropagation() |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleClose = (e: MouseEvent) => { |
|
|
|
const handleClose = (e: MouseEvent) => { |
|
|
|
if (aselect.value && !aselect.value.$el.contains(e.target)) { |
|
|
|
if (aselect.value && !aselect.value.$el.contains(e.target)) { |
|
|
@ -146,17 +129,14 @@ watch(isOpen, (n, _o) => { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useSelectedCellKeyupListener(active, (e) => { |
|
|
|
useSelectedCellKeyupListener(active, (e) => { |
|
|
|
switch (e.key) { |
|
|
|
switch (e.key) { |
|
|
|
case 'Escape': |
|
|
|
case 'Escape': |
|
|
|
isOpen.value = false |
|
|
|
isOpen.value = false |
|
|
|
select?.value?.blur() |
|
|
|
|
|
|
|
break |
|
|
|
break |
|
|
|
case 'Enter': |
|
|
|
case 'Enter': |
|
|
|
if (active.value && !isOpen.value) { |
|
|
|
if (active.value && !isOpen.value) { |
|
|
|
isOpen.value = true |
|
|
|
isOpen.value = true |
|
|
|
e.stopPropagation() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
@ -167,15 +147,16 @@ useSelectedCellKeyupListener(active, (e) => { |
|
|
|
<a-select |
|
|
|
<a-select |
|
|
|
ref="aselect" |
|
|
|
ref="aselect" |
|
|
|
v-model:value="vModel" |
|
|
|
v-model:value="vModel" |
|
|
|
|
|
|
|
v-model:open="isOpen" |
|
|
|
mode="multiple" |
|
|
|
mode="multiple" |
|
|
|
class="w-full" |
|
|
|
class="w-full" |
|
|
|
:bordered="false" |
|
|
|
:bordered="false" |
|
|
|
:show-arrow="!readOnly" |
|
|
|
:show-arrow="!readOnly" |
|
|
|
:show-search="false" |
|
|
|
:show-search="false" |
|
|
|
v-model:open="isOpen" |
|
|
|
|
|
|
|
:disabled="readOnly" |
|
|
|
:disabled="readOnly" |
|
|
|
:class="{ '!ml-[-8px]': readOnly }" |
|
|
|
:class="{ '!ml-[-8px]': readOnly }" |
|
|
|
:dropdown-class-name="`nc-dropdown-multi-select-cell ${isOpen ? 'active' : ''}`" |
|
|
|
:dropdown-class-name="`nc-dropdown-multi-select-cell ${isOpen ? 'active' : ''}`" |
|
|
|
|
|
|
|
@keydown.enter.stop |
|
|
|
@click="isOpen = active && !isOpen" |
|
|
|
@click="isOpen = active && !isOpen" |
|
|
|
> |
|
|
|
> |
|
|
|
<a-select-option |
|
|
|
<a-select-option |
|
|
|