diff --git a/packages/nc-gui-v2/components/cell/DatePicker.vue b/packages/nc-gui-v2/components/cell/DatePicker.vue index d69202b6ee..8bb9bee22e 100644 --- a/packages/nc-gui-v2/components/cell/DatePicker.vue +++ b/packages/nc-gui-v2/components/cell/DatePicker.vue @@ -5,6 +5,7 @@ import { ColumnInj, ReadonlyInj } from '~/context' interface Props { modelValue: string | null } + const { modelValue } = defineProps() const emit = defineEmits(['update:modelValue']) @@ -39,6 +40,18 @@ const localState = $computed({ } }, }) +const open = ref(false) + +const randomClass = `picker_${Math.floor(Math.random() * 99999)}` +watch( + open, + (next) => { + if (next) { + onClickOutside(document.querySelector(`.${randomClass}`)! as HTMLDivElement, () => (open.value = false)) + } + }, + { flush: 'post' }, +)