|
|
@ -1,6 +1,16 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
<script setup lang="ts"> |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import { ActiveCellInj, ColumnInj, ReadonlyInj, computed, inject, ref, useSelectedCellKeyupListener, watch } from '#imports' |
|
|
|
import { |
|
|
|
|
|
|
|
ActiveCellInj, |
|
|
|
|
|
|
|
ColumnInj, |
|
|
|
|
|
|
|
EditModeInj, |
|
|
|
|
|
|
|
ReadonlyInj, |
|
|
|
|
|
|
|
computed, |
|
|
|
|
|
|
|
inject, |
|
|
|
|
|
|
|
ref, |
|
|
|
|
|
|
|
useSelectedCellKeyupListener, |
|
|
|
|
|
|
|
watch, |
|
|
|
|
|
|
|
} from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
interface Props { |
|
|
|
modelValue?: string | null |
|
|
|
modelValue?: string | null |
|
|
@ -17,6 +27,8 @@ const readOnly = inject(ReadonlyInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
const active = inject(ActiveCellInj, ref(false)) |
|
|
|
const active = inject(ActiveCellInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const editable = inject(EditModeInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
let isDateInvalid = $ref(false) |
|
|
|
let isDateInvalid = $ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const dateFormat = $computed(() => columnMeta?.value?.meta?.date_format ?? 'YYYY-MM-DD') |
|
|
|
const dateFormat = $computed(() => columnMeta?.value?.meta?.date_format ?? 'YYYY-MM-DD') |
|
|
@ -84,8 +96,8 @@ useSelectedCellKeyupListener(active, (e: KeyboardEvent) => { |
|
|
|
:allow-clear="!readOnly && !localState && !isPk" |
|
|
|
:allow-clear="!readOnly && !localState && !isPk" |
|
|
|
:input-read-only="true" |
|
|
|
:input-read-only="true" |
|
|
|
:dropdown-class-name="`${randomClass} nc-picker-date ${open ? 'active' : ''}`" |
|
|
|
:dropdown-class-name="`${randomClass} nc-picker-date ${open ? 'active' : ''}`" |
|
|
|
:open="(readOnly || (localState && isPk)) && !active ? false : open" |
|
|
|
:open="(readOnly || (localState && isPk)) && !active && !editable ? false : open" |
|
|
|
@click="open = !open" |
|
|
|
@click="open = (active || editable) && !open" |
|
|
|
> |
|
|
|
> |
|
|
|
<template #suffixIcon></template> |
|
|
|
<template #suffixIcon></template> |
|
|
|
</a-date-picker> |
|
|
|
</a-date-picker> |
|
|
|