|
|
@ -2,14 +2,14 @@ |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import { ColumnInj, ReadonlyInj } from '~/context' |
|
|
|
import { ColumnInj, ReadonlyInj } from '~/context' |
|
|
|
|
|
|
|
|
|
|
|
const { modelValue } = defineProps<Props>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['update:modelValue']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
interface Props { |
|
|
|
modelValue: string | null |
|
|
|
modelValue: string | null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { modelValue } = defineProps<Props>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['update:modelValue']) |
|
|
|
|
|
|
|
|
|
|
|
const columnMeta = inject(ColumnInj, null) |
|
|
|
const columnMeta = inject(ColumnInj, null) |
|
|
|
const readOnlyMode = inject(ReadonlyInj, false) |
|
|
|
const readOnlyMode = inject(ReadonlyInj, false) |
|
|
|
|
|
|
|
|
|
|
@ -42,12 +42,12 @@ const localState = $computed({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
const open = ref(false) |
|
|
|
const open = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const randonClass = `picker_${Math.floor(Math.random() * 99999)}` |
|
|
|
const randomClass = `picker_${Math.floor(Math.random() * 99999)}` |
|
|
|
watch( |
|
|
|
watch( |
|
|
|
open, |
|
|
|
open, |
|
|
|
(next) => { |
|
|
|
(next) => { |
|
|
|
if (next) { |
|
|
|
if (next) { |
|
|
|
onClickOutside(document.querySelector(`.${randonClass}`)! as HTMLDivElement, () => (open.value = false)) |
|
|
|
onClickOutside(document.querySelector(`.${randomClass}`)! as HTMLDivElement, () => (open.value = false)) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ flush: 'post' }, |
|
|
|
{ flush: 'post' }, |
|
|
@ -63,7 +63,7 @@ watch( |
|
|
|
:placeholder="isDateInvalid ? 'Invalid date' : !readOnlyMode ? 'Select date' : ''" |
|
|
|
:placeholder="isDateInvalid ? 'Invalid date' : !readOnlyMode ? 'Select date' : ''" |
|
|
|
:allow-clear="!readOnlyMode" |
|
|
|
:allow-clear="!readOnlyMode" |
|
|
|
:input-read-only="true" |
|
|
|
:input-read-only="true" |
|
|
|
:dropdown-class-name="randonClass" |
|
|
|
:dropdown-class-name="randomClass" |
|
|
|
:open="readOnlyMode ? false : open" |
|
|
|
:open="readOnlyMode ? false : open" |
|
|
|
@click="open = !open" |
|
|
|
@click="open = !open" |
|
|
|
> |
|
|
|
> |
|
|
|