diff --git a/packages/nc-gui/components/cell/MultiSelect.vue b/packages/nc-gui/components/cell/MultiSelect.vue index fc59e3e07e..971e190d78 100644 --- a/packages/nc-gui/components/cell/MultiSelect.vue +++ b/packages/nc-gui/components/cell/MultiSelect.vue @@ -231,7 +231,7 @@ const search = () => { :bordered="false" :show-arrow="!readOnly" :show-search="active || editable" - :open="isOpen" + :open="isOpen && (active || editable)" :disabled="readOnly" :class="{ '!ml-[-8px]': readOnly }" :dropdown-class-name="`nc-dropdown-multi-select-cell ${isOpen ? 'active' : ''}`" diff --git a/packages/nc-gui/components/cell/SingleSelect.vue b/packages/nc-gui/components/cell/SingleSelect.vue index c478a3c015..298ba065a4 100644 --- a/packages/nc-gui/components/cell/SingleSelect.vue +++ b/packages/nc-gui/components/cell/SingleSelect.vue @@ -57,7 +57,7 @@ const options = computed<(SelectOptionType & { value: string })[]>(() => { if (column?.value.colOptions) { const opts = column.value.colOptions ? // todo: fix colOptions type, options does not exist as a property - (column.value.colOptions as any).options.filter((el: SelectOptionType) => el.title !== '') || [] + (column.value.colOptions as any).options.filter((el: SelectOptionType) => el.title !== '') || [] : [] for (const op of opts.filter((el: any) => el.order === null)) { op.title = op.title.replace(/^'/, '').replace(/'$/, '') @@ -135,6 +135,20 @@ async function addIfMissingAndSave() { const search = () => { searchVal.value = aselect.value?.$el?.querySelector('.ant-select-selection-search-input')?.value } + +const toggleMenu = (e: Event) => { + // todo: refactor + if ( + (e.target as HTMLElement)?.classList.contains('ant-select-clear') || + (e.target as HTMLElement)?.parentElement?.classList.contains('ant-select-clear') || + (e.target as HTMLElement)?.parentElement?.parentElement?.classList.contains('ant-select-clear') || + (e.target as HTMLElement)?.parentElement?.parentElement?.parentElement?.classList.contains('ant-select-clear') + ) { + vModel.value = '' + return + } + isOpen.value = (active.value || editable.value) && !isOpen.value +}