|
|
@ -1,7 +1,7 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import type { Select as AntSelect } from 'ant-design-vue' |
|
|
|
import type { Select as AntSelect } from 'ant-design-vue' |
|
|
|
import type { SelectOptionsType } from 'nocodb-sdk' |
|
|
|
import type { SelectOptionsType } from 'nocodb-sdk' |
|
|
|
import { ActiveCellInj, ColumnInj, EditModeInj, computed, inject, ref, useEventListener, watch } from '#imports' |
|
|
|
import { ActiveCellInj, ColumnInj, ReadonlyInj, computed, inject, ref, useEventListener, watch } from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
interface Props { |
|
|
|
modelValue?: string | undefined |
|
|
|
modelValue?: string | undefined |
|
|
@ -13,7 +13,7 @@ const emit = defineEmits(['update:modelValue']) |
|
|
|
|
|
|
|
|
|
|
|
const column = inject(ColumnInj)! |
|
|
|
const column = inject(ColumnInj)! |
|
|
|
|
|
|
|
|
|
|
|
const editEnabled = inject(EditModeInj)! |
|
|
|
const readOnly = inject(ReadonlyInj)! |
|
|
|
|
|
|
|
|
|
|
|
const active = inject(ActiveCellInj, ref(false)) |
|
|
|
const active = inject(ActiveCellInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
@ -69,11 +69,11 @@ watch(isOpen, (n, _o) => { |
|
|
|
v-model:value="vModel" |
|
|
|
v-model:value="vModel" |
|
|
|
class="w-full" |
|
|
|
class="w-full" |
|
|
|
:allow-clear="!column.rqd && active" |
|
|
|
:allow-clear="!column.rqd && active" |
|
|
|
placeholder="Select an option" |
|
|
|
:placeholder="!readOnly ? 'Select an option' : ''" |
|
|
|
:bordered="false" |
|
|
|
:bordered="false" |
|
|
|
:open="isOpen" |
|
|
|
:open="isOpen" |
|
|
|
:disabled="!editEnabled" |
|
|
|
:disabled="readOnly" |
|
|
|
:show-arrow="active || vModel === null" |
|
|
|
:show-arrow="!readOnly && (active || vModel === null)" |
|
|
|
@select="isOpen = false" |
|
|
|
@select="isOpen = false" |
|
|
|
@keydown="handleKeys" |
|
|
|
@keydown="handleKeys" |
|
|
|
@click="isOpen = !isOpen" |
|
|
|
@click="isOpen = !isOpen" |
|
|
|