@veltra/desktop 1.7.6 → 1.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import { Fragment, Transition, computed, createBlock, createElementBlock, create
5
5
  import { useFormFallbackProps, useUserAction } from "@veltra/compositions";
6
6
  import { FORM_EMPTY_CONTENT, bem, injectFormContext } from "@veltra/utils";
7
7
  import { Calendar, Close } from "@veltra/icons/normal";
8
- import { date } from "@cat-kit/core";
8
+ import { Dater, date } from "@cat-kit/core";
9
9
  //#region src/components/date-range-picker/date-range-picker.vue
10
10
  const _hoisted_1 = ["value", "placeholder"];
11
11
  const _hoisted_2 = ["value", "placeholder"];
@@ -19,6 +19,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
19
19
  type: { default: "date" },
20
20
  format: {},
21
21
  valueFormat: {},
22
+ dataType: { default: "string" },
22
23
  disabledDate: {},
23
24
  clearable: {
24
25
  type: Boolean,
@@ -39,7 +40,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
39
40
  rules: {},
40
41
  size: {}
41
42
  },
42
- emits: ["update:modelValue"],
43
+ emits: ["update:modelValue", "change"],
43
44
  setup(__props, { emit: __emit }) {
44
45
  const props = __props;
45
46
  const emit = __emit;
@@ -62,12 +63,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
62
63
  const dropdownRef = shallowRef();
63
64
  const { userAction, isUserActive } = useUserAction();
64
65
  const currentRangeDate = shallowRef();
65
- const displayedOfStart = computed(() => {
66
- return props.modelValue?.[0];
67
- });
68
- const displayedOfEnd = computed(() => {
69
- return props.modelValue?.[1];
70
- });
71
66
  const formatStr = computed(() => {
72
67
  const { format, type } = props;
73
68
  if (format) return format;
@@ -76,16 +71,54 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
76
71
  if (type === "year") return "yyyy";
77
72
  return "yyyy-MM-dd";
78
73
  });
74
+ const displayedOfStart = computed(() => {
75
+ return currentRangeDate.value?.[0]?.format(formatStr.value) ?? "";
76
+ });
77
+ const displayedOfEnd = computed(() => {
78
+ return currentRangeDate.value?.[1]?.format(formatStr.value) ?? "";
79
+ });
80
+ function parseDateValue(val) {
81
+ if (val == null || val === "") return void 0;
82
+ if (val instanceof Date || typeof val === "number") {
83
+ const d = date(val);
84
+ return isNaN(d.timestamp) ? void 0 : d;
85
+ }
86
+ if (typeof val === "string") {
87
+ if (props.dataType === "string" && props.valueFormat) {
88
+ const parsed = Dater.parse(val, props.valueFormat);
89
+ if (!isNaN(parsed.timestamp)) return parsed;
90
+ }
91
+ const fallback = date(val);
92
+ return isNaN(fallback.timestamp) ? void 0 : fallback;
93
+ }
94
+ }
79
95
  watch(() => props.modelValue, (val) => {
80
96
  if (isUserActive()) return;
81
- if (val?.length === 2) currentRangeDate.value = [date(val[0]), date(val[1])];
82
- else currentRangeDate.value = void 0;
97
+ if (val && val.length === 2) {
98
+ const d1 = parseDateValue(val[0]);
99
+ const d2 = parseDateValue(val[1]);
100
+ if (d1 && d2) {
101
+ currentRangeDate.value = [d1, d2];
102
+ return;
103
+ }
104
+ }
105
+ currentRangeDate.value = void 0;
83
106
  }, { immediate: true });
107
+ function formatDateValue(d) {
108
+ if (props.dataType === "date") return d.raw;
109
+ if (props.dataType === "timestamp") return d.timestamp;
110
+ return d.format(props.valueFormat ?? formatStr.value);
111
+ }
112
+ function formatModelValue(range) {
113
+ return [formatDateValue(range[0]), formatDateValue(range[1])];
114
+ }
84
115
  const commitSelectedRange = userAction((rangeDate) => {
85
116
  currentRangeDate.value = rangeDate;
86
- emit("update:modelValue", rangeDate?.map((d) => d.format(formatStr.value)));
117
+ emit("update:modelValue", formatModelValue(rangeDate));
118
+ emit("change", [rangeDate[0].raw, rangeDate[1].raw]);
87
119
  });
88
120
  async function handleSelect(rangeDate) {
121
+ if (!rangeDate) return;
89
122
  await commitSelectedRange(rangeDate);
90
123
  dropdownRef.value?.close();
91
124
  }
@@ -93,6 +126,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
93
126
  function handleClear() {
94
127
  currentRangeDate.value = void 0;
95
128
  emit("update:modelValue", void 0);
129
+ emit("change", void 0);
96
130
  }
97
131
  return (_ctx, _cache) => {
98
132
  return !unref(readonly) ? (openBlock(), createBlock(unref(_sfc_main$2), mergeProps({ key: 0 }, _ctx.$attrs, {
@@ -127,7 +161,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
127
161
  name: "zoom-in",
128
162
  mode: "out-in"
129
163
  }, {
130
- default: withCtx(() => [__props.clearable && __props.modelValue && hovered.value && !unref(disabled) ? (openBlock(), createBlock(unref(_sfc_main$1), {
164
+ default: withCtx(() => [__props.clearable && (__props.modelValue?.length || currentRangeDate.value) && hovered.value && !unref(disabled) ? (openBlock(), createBlock(unref(_sfc_main$1), {
131
165
  key: 0,
132
166
  class: normalizeClass([unref(cls).e("icon"), unref(cls).e("clear")]),
133
167
  title: "清除",
@@ -1 +1 @@
1
- {"version":3,"file":"date-range-picker.js","names":["$attrs"],"sources":["../../../src/components/date-range-picker/date-range-picker.vue"],"sourcesContent":["<template>\n <u-dropdown\n v-if=\"!readonly\"\n v-bind=\"$attrs\"\n :class=\"className\"\n trigger=\"click\"\n :content-class=\"[cls.e('panel'), cls.em('panel', size)]\"\n width=\"auto\"\n ref=\"dropdownRef\"\n :disabled=\"disabled\"\n @mouseenter.native=\"hovered = true\"\n @mouseleave.native=\"hovered = false\"\n @update:visible=\"dropdownVisible = $event\"\n >\n <template #trigger>\n <input\n type=\"text\"\n :class=\"cls.e('input')\"\n :value=\"displayedOfStart\"\n :placeholder=\"placeholder[0]\"\n readonly\n />\n <span :class=\"cls.e('separator')\">至</span>\n <input\n type=\"text\"\n :class=\"cls.e('input')\"\n :value=\"displayedOfEnd\"\n :placeholder=\"placeholder[1]\"\n readonly\n />\n\n <Transition name=\"zoom-in\" mode=\"out-in\">\n <UIcon\n v-if=\"clearable && modelValue && hovered && !disabled\"\n :class=\"[cls.e('icon'), cls.e('clear')]\"\n title=\"清除\"\n @click.stop=\"handleClear\"\n >\n <Close />\n </UIcon>\n\n <u-icon :class=\"cls.e('icon')\" v-else><Calendar /></u-icon>\n </Transition>\n </template>\n\n <template #content>\n <UDatePanel\n range\n :type\n :disabled-date\n :size\n :range-date=\"currentRangeDate\"\n @select:range-date=\"handleSelect\"\n />\n </template>\n </u-dropdown>\n\n <template v-else>\n {{ displayedOfStart || FORM_EMPTY_CONTENT }} 至\n {{ displayedOfEnd || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { date, type Dater } from '@cat-kit/core'\nimport { useFormFallbackProps, useUserAction } from '@veltra/compositions'\nimport { Calendar, Close } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, shallowRef, watch } from 'vue'\n\nimport type { DateRangePickerEmits, DateRangePickerProps, DropdownExposed } from '../../types'\nimport { UDatePanel } from '../date-panel'\nimport { UDropdown } from '../dropdown'\nimport { UIcon } from '../icon'\n\ndefineOptions({ name: 'UDateRangePicker', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<DateRangePickerProps>(), {\n placeholder: () => ['起始日期', '结束日期'],\n type: 'date',\n disabled: undefined,\n readonly: undefined,\n clearable: true\n})\n\nconst emit = defineEmits<DateRangePickerEmits>()\n\nconst cls = bem('date-range-picker')\n\nconst dropdownVisible = shallowRef(false)\n\nconst className = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n bem.is('disabled', disabled.value),\n bem.is('focus', dropdownVisible.value)\n ]\n})\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst dropdownRef = shallowRef<DropdownExposed>()\n\nconst { userAction, isUserActive } = useUserAction()\n\nconst currentRangeDate = shallowRef<[Dater, Dater]>()\n\nconst displayedOfStart = computed(() => {\n return props.modelValue?.[0]\n})\n\nconst displayedOfEnd = computed(() => {\n return props.modelValue?.[1]\n})\n\nconst formatStr = computed(() => {\n const { format, type } = props\n if (format) return format\n if (type === 'date') return 'yyyy-MM-dd'\n if (type === 'month') return 'yyyy-MM'\n if (type === 'year') return 'yyyy'\n return 'yyyy-MM-dd'\n})\n\nwatch(\n () => props.modelValue,\n (val) => {\n if (isUserActive()) return\n if (val?.length === 2) {\n currentRangeDate.value = [date(val[0]), date(val[1])]\n } else {\n currentRangeDate.value = undefined\n }\n },\n { immediate: true }\n)\n\nconst commitSelectedRange = userAction((rangeDate: [Dater, Dater] | undefined) => {\n currentRangeDate.value = rangeDate\n emit('update:modelValue', rangeDate?.map((d) => d.format(formatStr.value)) as [string, string])\n})\n\nasync function handleSelect(rangeDate: [Dater, Dater] | undefined) {\n await commitSelectedRange(rangeDate)\n dropdownRef.value?.close()\n}\n\nconst hovered = shallowRef(false)\n\nfunction handleClear() {\n currentRangeDate.value = undefined\n emit('update:modelValue', undefined)\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8EA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,mBAAmB;EAEnC,MAAM,kBAAkB,WAAW,KAAK;EAExC,MAAM,YAAY,eAAe;GAC/B,OAAO;IACL,IAAI;IACJ,IAAI,EAAE,KAAK,KAAK;IAChB,IAAI,GAAG,YAAY,SAAS,KAAK;IACjC,IAAI,GAAG,SAAS,gBAAgB,KAAK;GACvC;EACF,CAAC;EAED,MAAM,EAAE,cAAc,kBAAkB;EAExC,MAAM,EAAE,MAAM,UAAU,aAAa,qBAAqB,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG;GAClF,MAAM;GACN,UAAU;GACV,UAAU;EACZ,CAAC;EAED,MAAM,cAAc,WAA4B;EAEhD,MAAM,EAAE,YAAY,iBAAiB,cAAc;EAEnD,MAAM,mBAAmB,WAA2B;EAEpD,MAAM,mBAAmB,eAAe;GACtC,OAA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,MAAA,MAAA,IAAA;KACA,cAAY,iBAAA;KACZ,sBAAmB;;;;;;;;;;;;GAK1B,CAAA,MAAA,UAAA,GAAA,mBAGW,UAAA,EAAA,KAAA,EAAA,GAAA,CAFN,gBAAA,gBAAA,iBAAA,SAAoB,MAAA,kBAAA,CAAkB,IAAG,QAC5C,gBAAG,eAAA,SAAkB,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"date-range-picker.js","names":["$attrs"],"sources":["../../../src/components/date-range-picker/date-range-picker.vue"],"sourcesContent":["<template>\n <u-dropdown\n v-if=\"!readonly\"\n v-bind=\"$attrs\"\n :class=\"className\"\n trigger=\"click\"\n :content-class=\"[cls.e('panel'), cls.em('panel', size)]\"\n width=\"auto\"\n ref=\"dropdownRef\"\n :disabled=\"disabled\"\n @mouseenter.native=\"hovered = true\"\n @mouseleave.native=\"hovered = false\"\n @update:visible=\"dropdownVisible = $event\"\n >\n <template #trigger>\n <input\n type=\"text\"\n :class=\"cls.e('input')\"\n :value=\"displayedOfStart\"\n :placeholder=\"placeholder[0]\"\n readonly\n />\n <span :class=\"cls.e('separator')\">至</span>\n <input\n type=\"text\"\n :class=\"cls.e('input')\"\n :value=\"displayedOfEnd\"\n :placeholder=\"placeholder[1]\"\n readonly\n />\n\n <Transition name=\"zoom-in\" mode=\"out-in\">\n <UIcon\n v-if=\"clearable && (modelValue?.length || currentRangeDate) && hovered && !disabled\"\n :class=\"[cls.e('icon'), cls.e('clear')]\"\n title=\"清除\"\n @click.stop=\"handleClear\"\n >\n <Close />\n </UIcon>\n\n <u-icon :class=\"cls.e('icon')\" v-else><Calendar /></u-icon>\n </Transition>\n </template>\n\n <template #content>\n <UDatePanel\n range\n :type\n :disabled-date\n :size\n :range-date=\"currentRangeDate\"\n @select:range-date=\"handleSelect\"\n />\n </template>\n </u-dropdown>\n\n <template v-else>\n {{ displayedOfStart || FORM_EMPTY_CONTENT }} 至\n {{ displayedOfEnd || FORM_EMPTY_CONTENT }}\n </template>\n</template>\n\n<script lang=\"ts\" setup>\nimport { date, Dater } from '@cat-kit/core'\nimport { useFormFallbackProps, useUserAction } from '@veltra/compositions'\nimport { Calendar, Close } from '@veltra/icons/normal'\nimport { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'\nimport { injectFormContext } from '@veltra/utils'\nimport { computed, shallowRef, watch } from 'vue'\n\nimport type {\n DateRangePickerEmits,\n DateRangePickerProps,\n DateRangeValue,\n DropdownExposed\n} from '../../types'\nimport { UDatePanel } from '../date-panel'\nimport { UDropdown } from '../dropdown'\nimport { UIcon } from '../icon'\n\ndefineOptions({ name: 'UDateRangePicker', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<DateRangePickerProps>(), {\n placeholder: () => ['起始日期', '结束日期'],\n type: 'date',\n dataType: 'string',\n disabled: undefined,\n readonly: undefined,\n clearable: true\n})\n\nconst emit = defineEmits<DateRangePickerEmits>()\n\nconst cls = bem('date-range-picker')\n\nconst dropdownVisible = shallowRef(false)\n\nconst className = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n bem.is('disabled', disabled.value),\n bem.is('focus', dropdownVisible.value)\n ]\n})\n\nconst { formProps } = injectFormContext()\n\nconst { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {\n size: 'default',\n disabled: false,\n readonly: false\n})\n\nconst dropdownRef = shallowRef<DropdownExposed>()\n\nconst { userAction, isUserActive } = useUserAction()\n\nconst currentRangeDate = shallowRef<[Dater, Dater]>()\n\nconst formatStr = computed(() => {\n const { format, type } = props\n if (format) return format\n if (type === 'date') return 'yyyy-MM-dd'\n if (type === 'month') return 'yyyy-MM'\n if (type === 'year') return 'yyyy'\n return 'yyyy-MM-dd'\n})\n\nconst displayedOfStart = computed(() => {\n return currentRangeDate.value?.[0]?.format(formatStr.value) ?? ''\n})\n\nconst displayedOfEnd = computed(() => {\n return currentRangeDate.value?.[1]?.format(formatStr.value) ?? ''\n})\n\nfunction parseDateValue(val?: string | number | Date): Dater | undefined {\n if (val == null || val === '') return undefined\n if (val instanceof Date || typeof val === 'number') {\n const d = date(val)\n return isNaN(d.timestamp) ? undefined : d\n }\n if (typeof val === 'string') {\n if (props.dataType === 'string' && props.valueFormat) {\n const parsed = Dater.parse(val, props.valueFormat)\n if (!isNaN(parsed.timestamp)) return parsed\n }\n const fallback = date(val)\n return isNaN(fallback.timestamp) ? undefined : fallback\n }\n return undefined\n}\n\nwatch(\n () => props.modelValue,\n (val) => {\n if (isUserActive()) return\n if (val && val.length === 2) {\n const d1 = parseDateValue(val[0])\n const d2 = parseDateValue(val[1])\n if (d1 && d2) {\n currentRangeDate.value = [d1, d2]\n return\n }\n }\n currentRangeDate.value = undefined\n },\n { immediate: true }\n)\n\nfunction formatDateValue(d: Dater) {\n if (props.dataType === 'date') {\n return d.raw\n }\n if (props.dataType === 'timestamp') {\n return d.timestamp\n }\n return d.format(props.valueFormat ?? formatStr.value)\n}\n\nfunction formatModelValue(range: [Dater, Dater]): DateRangeValue {\n return [formatDateValue(range[0]), formatDateValue(range[1])] as DateRangeValue\n}\n\nconst commitSelectedRange = userAction((rangeDate: [Dater, Dater]) => {\n currentRangeDate.value = rangeDate\n emit('update:modelValue', formatModelValue(rangeDate))\n emit('change', [rangeDate[0].raw, rangeDate[1].raw])\n})\n\nasync function handleSelect(rangeDate: [Dater, Dater] | undefined) {\n if (!rangeDate) return\n await commitSelectedRange(rangeDate)\n dropdownRef.value?.close()\n}\n\nconst hovered = shallowRef(false)\n\nfunction handleClear() {\n currentRangeDate.value = undefined\n emit('update:modelValue', undefined)\n emit('change', undefined)\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmFA,MAAM,QAAQ;EASd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,mBAAmB;EAEnC,MAAM,kBAAkB,WAAW,KAAK;EAExC,MAAM,YAAY,eAAe;GAC/B,OAAO;IACL,IAAI;IACJ,IAAI,EAAE,KAAK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AAA,CAAA;;OAAiB,SAAA,cAAY,CAAZ,YAAY,MAAA,QAAA,CAAA,CAAA,CAAA;;;;;;IAI3C,SAAO,cAQd,CAPF,YAOE,MAAA,WAAA,GAAA;KANA,OAAA;KACC,MAAA,QAAA;KACA,iBAAA,QAAA;KACA,MAAA,MAAA,IAAA;KACA,cAAY,iBAAA;KACZ,sBAAmB;;;;;;;;;;;;GAK1B,CAAA,MAAA,UAAA,GAAA,mBAGW,UAAA,EAAA,KAAA,EAAA,GAAA,CAFN,gBAAA,gBAAA,iBAAA,SAAoB,MAAA,kBAAA,CAAkB,IAAG,QAC5C,gBAAG,eAAA,SAAkB,MAAA,kBAAA,CAAkB,GAAA,CAAA,CAAA,GAAA,EAAA"}
package/dist/index.d.ts CHANGED
@@ -95,7 +95,7 @@ import { TreeEmit, TreeExposed, TreeNode, TreeNodeProps, TreeProps, _TreeExposed
95
95
  import { TreeSelectEmits, TreeSelectExposed, TreeSelectProps, _TreeSelectExposed } from "./types/tree-select.js";
96
96
  import { LayoutEmits, LayoutExposed, LayoutProps, _LayoutExposed } from "./types/layout.js";
97
97
  import { TagEmits, TagExposed, TagProps } from "./types/tag.js";
98
- import { DateRangePickerEmits, DateRangePickerExposed, DateRangePickerProps, _DateRangePickerExposed } from "./types/date-range-picker.js";
98
+ import { DateRangePickerDataType, DateRangePickerEmits, DateRangePickerExposed, DateRangePickerProps, DateRangeValue, _DateRangePickerExposed } from "./types/date-range-picker.js";
99
99
  import { RadioGroupEmits, RadioGroupExposed, RadioGroupProps, _RadioGroupExposed } from "./types/radio-group.js";
100
100
  import { ScrollEmits, ScrollExposed, ScrollPosition, ScrollProps, _ScrollExposed } from "./types/scroll.js";
101
101
  import { WatermarkEmits, WatermarkExposed, WatermarkProps, _WatermarkExposed } from "./types/watermark.js";
@@ -183,4 +183,4 @@ import { defineBatchEditColumns } from "./components/batch-edit/helper.js";
183
183
  import { defineTableColumns } from "./components/table/use-columns.js";
184
184
  import "./components/index.js";
185
185
  export * from "@veltra/utils";
186
- export { type ActionEmits, type ActionExposed, type ActionGroupExposed, type ActionGroupProps, type ActionProps, type AnimationEmits, type AnimationExposed, type AnimationProps, type AutoCompleteEmits, type AutoCompleteExposed, type AutoCompleteProps, type BadgeEmits, type BadgeExposed, type BadgeProps, type BarType, type BatchEditColumn, type BatchEditEmits, type BatchEditExposed, type BatchEditFeature, type BatchEditFormStatus, type BatchEditProps, type BatchEditSlots, type BatchEditStates, type BreadcrumbEmits, type BreadcrumbExposed, type BreadcrumbItem, type BreadcrumbProps, type BreadcrumbSlotScope, type BreakCols, type Breakpoint, type ButtonEmits, type ButtonExposed, type ButtonProps, type ButtonType, type CalendarDay, type CalendarEmits, type CalendarExposed, type CalendarMonth, type CalendarProps, type CalendarYear, type CardActionProps, type CardContentProps, type CardCoverProps, type CardEmits, type CardExposed, type CardProps, type CascadeEmits, type CascadeExposed, type CascadeNode, type CascadeProps, type CheckTagEmits, type CheckTagExposed, type CheckTagProps, type CheckboxButtonEmits, type CheckboxButtonProps, type CheckboxEmits, type CheckboxExposed, type CheckboxGroupEmits, type CheckboxGroupExposed, type CheckboxGroupProps, type CheckboxProps, type CodeEditorEmits, type CodeEditorExposed, type CodeEditorLang, type CodeEditorProps, type CollapseEmits, type CollapseItemEmits, type CollapseItemProps, type CollapseModelValue, type CollapseProps, type CollapseValue, type ConditionConnector, type ConditionEditorEmits, type ConditionEditorExposed, type ConditionEditorProps, type EvaluateOptions as ConditionEvaluateOptions, type ConditionExpression, type ConditionField, type ConditionGroup, type ConditionLeaf, type ConditionNode, type ConditionValue, type ContextmenuEmits, type ContextmenuExposed, type ContextmenuItem, ContextmenuPanelDIKey, type ContextmenuProps, ContextmenuRootDIKey, type CssTransitionEmits, type CssTransitionExposed, type CssTransitionProps, type DatePanelEmits, type DatePanelProps, type DatePickerDataType, type DatePickerEmits, type DatePickerExposed, type DatePickerProps, type DateRangePickerEmits, type DateRangePickerExposed, type DateRangePickerProps, type DialogEmits, type DialogExposed, type DialogProps, type DialogTransition, type DrawerDirection, type DrawerEmits, type DrawerExposed, type DrawerMode, type DrawerProps, type DropdownEmits, type DropdownExposed, type DropdownProps, type DualNavEmits, type DualNavExposed, type DualNavProps, type DualNavRailVariant, type DualNavRootItem, type EmptyEmits, type EmptyExposed, type EmptyProps, type ExpressionEditorEmits, type ExpressionEditorExposed, type ExpressionEditorProps, type ExpressionSelectableLevels, type FileViewerEmits, type FileViewerExposed, type FileViewerItem, type FileViewerKind, type FileViewerProps, type FloatButtonEmits, type FloatButtonExposed, type FloatButtonItem, type FloatButtonProps, type FormEmits, type FormExposed, type FormItemEmits, type FormItemExposed, type FormItemProps, type FormProps, type GanttChartEmits, type GanttChartExposed, type GanttChartProps, type GridEmits, type GridExposed, type GridInputEmits, type GridInputExposed, type GridInputProps, type GridItemProps, type GridProps, type GroupInputEmits, type GroupInputExposed, type GroupInputProps, type GroupNavEmits, type GroupNavGroup, type GroupNavProps, type IconEmits, type IconExposed, type IconProps, type InputEmits, type InputExposed, type InputProps, type LayoutEmits, type LayoutExposed, type LayoutProps, type ListEmits, type ListExposed, type ListProps, type LoadingEmits, type LoadingExposed, type LoadingProps, type LoadingType, type Message, type MessageConfirm, type MessageConfirmAction, type MessageConfirmEmits, type MessageConfirmExposed, type MessageConfirmInstance, type MessageConfirmOptions, type MessageConfirmProps, type MessageEmits, type MessageExposed, type MessageInstance, type MessageOptions, type MessageProps, type MessageType, type MultiAutoCompleteEmits, type MultiAutoCompleteExposed, type MultiAutoCompleteProps, type MultiSelectEmits, type MultiSelectExposed, type MultiSelectProps, type MultiTreeSelectEmits, type MultiTreeSelectExposed, type MultiTreeSelectProps, type NavEmits, type NavExposed, type NavItem, type NavProps, type NodeRenderExposed, type NodeRenderProps, type Notification, type NotificationEmits, type NotificationExposed, type NotificationInstance, type NotificationOptions, type NotificationPosition, type NotificationProps, type NumberEmits, type NumberExposed, type NumberInputEmits, type NumberInputExposed, type NumberInputProps, type NumberProps, type NumberRangeInputEmits, type NumberRangeInputExposed, type NumberRangeInputProps, type NumberRangeTuple, type PaginatorEmits, type PaginatorExposed, type PaginatorProps, type PaletteColorType, type PaletteEmits, type PaletteExposed, type PaletteHSV, type PaletteProps, type PaletteRGB, type PanelItem, type PanelType, type PasswordInputEmits, type PasswordInputExposed, type PasswordInputProps, type PopConfirmEmits, type PopConfirmExposed, type PopConfirmProps, type PopEmits, type PopExposed, type PopProps, type ProgressEmits, type ProgressExposed, type ProgressNodesEmits, type ProgressNodesExposed, type ProgressNodesProps, type ProgressProps, type QuickBatchEditEmits, type QuickBatchEditExposed, type QuickBatchEditProps, type RadioEmits, type RadioExposed, type RadioGroupEmits, type RadioGroupExposed, type RadioGroupProps, type RadioProps, type RichTextEditorEmits, type RichTextEditorExposed, type RichTextEditorProps, type RichTextFormat, type ScrollEmits, type ScrollExposed, type ScrollPosition, type ScrollProps, type SegmentEmits, type SegmentExposed, type SegmentItem, type SegmentProps, type SelectEmits, type SelectExposed, type SelectProps, type SliderEmits, type SliderExposed, type SliderProps, type StepsEmits, type StepsExposed, type StepsProps, type StepsSlotScope, type SwitchEmits, type SwitchExposed, type SwitchProps, type TabItem, type TableColumn, type TableColumnAlign, type TableColumnNode, type TableColumnRenderContext, type TableColumnSlotsScope, type TableEditorEmits, type TableEditorExposed, type TableEditorProps, type TableEmits, type TableExposed, type TableProps, type TableRow, type TableRowSlotsScope, type TableSummaryContext, type TabsEmits, type TabsExposed, type TabsHorizontalEmits, type TabsHorizontalExposed, type TabsHorizontalProps, type TabsProps, type TabsVerticalEmits, type TabsVerticalExposed, type TabsVerticalProps, type TagEmits, type TagExposed, type TagProps, type TextEditorEmits, type TextEditorExposed, type TextEditorProps, type TextEmits, type TextExposed, type TextProps, type TextareaEmits, type TextareaExposed, type TextareaProps, type ThemeExposed, type ThemeProps, type TipAlign, type TipDirection, type TipEmits, type TipExposed, type TipProps, type ToolbarItem, type TreeEmit, type TreeExposed, type TreeNode, type TreeNodeProps, type TreeProps, type TreeSelectEmits, type TreeSelectExposed, type TreeSelectProps, _sfc_main as UAction, action_group_default as UActionGroup, _sfc_main$1 as UAutoComplete, _sfc_main$2 as UBadge, _sfc_main$3 as UBatchEdit, _sfc_main$4 as UBreadcrumb, _sfc_main$5 as UButton, _sfc_main$6 as UButtonGroup, _sfc_main$7 as UCalendar, _sfc_main$8 as UCard, _sfc_main$9 as UCardAction, _sfc_main$10 as UCardContent, _sfc_main$11 as UCardCover, _sfc_main$12 as UCardHeader, _sfc_main$13 as UCascade, _sfc_main$14 as UCheckTag, _sfc_main$15 as UCheckbox, _sfc_main$16 as UCheckboxButton, _sfc_main$17 as UCheckboxGroup, _sfc_main$18 as UCodeEditor, _sfc_main$19 as UCollapse, _sfc_main$20 as UCollapseItem, _sfc_main$21 as UConditionEditor, _sfc_main$22 as UContextmenu, _sfc_main$23 as UDatePanel, _sfc_main$24 as UDatePicker, _sfc_main$25 as UDateRangePicker, _sfc_main$26 as UDialog, _sfc_main$27 as UDrawer, _sfc_main$28 as UDropdown, _sfc_main$29 as UDualNav, _sfc_main$30 as UEmpty, _sfc_main$31 as UExpressionEditor, _sfc_main$32 as UFilePicker, _sfc_main$33 as UFileViewer, _sfc_main$34 as UFloatButton, form_default as UForm, form_item_default as UFormItem, _sfc_main$35 as UGanttChart, _sfc_main$36 as UGrid, _sfc_main$37 as UGridInput, _sfc_main$38 as UGridItem, _sfc_main$39 as UGroupInput, _sfc_main$40 as UGroupNav, _sfc_main$41 as UIcon, input_default as UInput, _sfc_main$42 as UKbd, _sfc_main$43 as ULayout, _sfc_main$44 as UList, _sfc_main$45 as UListItem, _sfc_main$46 as ULoading, _sfc_main$47 as UMessage, _sfc_main$48 as UMessageConfirm, _sfc_main$49 as UMultiSelect, _sfc_main$50 as UMultiTreeSelect, _sfc_main$51 as UNav, _sfc_main$52 as UNavItem, _sfc_main$53 as UNavSub, NodeRender as UNodeRender, _sfc_main$54 as UNotification, _sfc_main$55 as UNumber, _sfc_main$56 as UNumberInput, _sfc_main$57 as UNumberRangeInput, _sfc_main$58 as UPaginator, _sfc_main$59 as UPalette, _sfc_main$60 as UPasswordInput, _sfc_main$61 as UPopConfirm, _sfc_main$62 as UProgress, _sfc_main$63 as UProgressNodes, _sfc_main$64 as URadio, _sfc_main$65 as URadioGroup, _sfc_main$66 as URichTextEditor, _sfc_main$67 as UScroll, _sfc_main$68 as USegment, _sfc_main$69 as USelect, _sfc_main$70 as USlider, _sfc_main$71 as USteps, _sfc_main$72 as USwitch, _sfc_main$73 as UTable, _sfc_main$74 as UTableEditor, _sfc_main$75 as UTabs, _sfc_main$76 as UTabsHorizontal, _sfc_main$77 as UTabsVertical, _sfc_main$78 as UTag, _sfc_main$79 as UText, _sfc_main$80 as UTextarea, _sfc_main$81 as UTheme, _sfc_main$82 as UTip, _sfc_main$83 as UTree, _sfc_main$84 as UTreeSelect, _sfc_main$85 as UWatermark, type UploaderEmits, type UploaderExposed, type UploaderProps, type VariableItem, type WatermarkEmits, type WatermarkExposed, type WatermarkProps, type _ActionExposed, type _ActionGroupExposed, type _AnimationExposed, type _AutoCompleteExposed, type _BadgeExposed, type _BatchEditExposed, type _BreadcrumbExposed, type _ButtonExposed, type _CalendarExposed, type _CardExposed, type _CascadeExposed, type _CheckTagExposed, type _CodeEditorExposed, type _ConditionEditorExposed, type _ContextmenuExposed, type _CssTransitionExposed, type _DatePickerExposed, type _DateRangePickerExposed, type _DialogExposed, type _DrawerExposed, type _DropdownExposed, type _DualNavExposed, type _EmptyExposed, type _ExpressionEditorExposed, type _FileViewerExposed, type _FloatButtonExposed, type _FormExposed, type _GanttChartExposed, type _GridExposed, type _GridInputExposed, type _GroupInputExposed, type _InputExposed, type _LayoutExposed, type _ListExposed, type _LoadingExposed, type _MessageConfirmExposed, type _MessageExposed, type _MultiAutoCompleteExposed, type _MultiSelectExposed, type _MultiTreeSelectExposed, type _NavExposed, type _NotificationExposed, type _PaginatorExposed, type _PaletteExposed, type _PasswordInputExposed, type _PopConfirmExposed, type _PopExposed, type _ProgressExposed, type _ProgressNodesExposed, type _QuickBatchEditExposed, type _RadioExposed, type _RadioGroupExposed, type _RichTextEditorExposed, type _ScrollExposed, type _SegmentExposed, type _SelectExposed, type _SliderExposed, type _StepsExposed, type _SwitchExposed, type _TableEditorExposed, type _TableExposed, type _TabsExposed, type _TabsHorizontalExposed, type _TabsVerticalExposed, type _TextEditorExposed, type _TextExposed, type _TextareaExposed, type _ThemeExposed, type _TipExposed, type _TreeExposed, type _TreeSelectExposed, type _UploaderExposed, type _WatermarkExposed, contextmenu, createEmptyGroup, createEmptyLeaf, defineBatchEditColumns, defineTableColumns, evaluate as evaluateConditionExpression, message, messageConfirm, notification, vLoading };
186
+ export { type ActionEmits, type ActionExposed, type ActionGroupExposed, type ActionGroupProps, type ActionProps, type AnimationEmits, type AnimationExposed, type AnimationProps, type AutoCompleteEmits, type AutoCompleteExposed, type AutoCompleteProps, type BadgeEmits, type BadgeExposed, type BadgeProps, type BarType, type BatchEditColumn, type BatchEditEmits, type BatchEditExposed, type BatchEditFeature, type BatchEditFormStatus, type BatchEditProps, type BatchEditSlots, type BatchEditStates, type BreadcrumbEmits, type BreadcrumbExposed, type BreadcrumbItem, type BreadcrumbProps, type BreadcrumbSlotScope, type BreakCols, type Breakpoint, type ButtonEmits, type ButtonExposed, type ButtonProps, type ButtonType, type CalendarDay, type CalendarEmits, type CalendarExposed, type CalendarMonth, type CalendarProps, type CalendarYear, type CardActionProps, type CardContentProps, type CardCoverProps, type CardEmits, type CardExposed, type CardProps, type CascadeEmits, type CascadeExposed, type CascadeNode, type CascadeProps, type CheckTagEmits, type CheckTagExposed, type CheckTagProps, type CheckboxButtonEmits, type CheckboxButtonProps, type CheckboxEmits, type CheckboxExposed, type CheckboxGroupEmits, type CheckboxGroupExposed, type CheckboxGroupProps, type CheckboxProps, type CodeEditorEmits, type CodeEditorExposed, type CodeEditorLang, type CodeEditorProps, type CollapseEmits, type CollapseItemEmits, type CollapseItemProps, type CollapseModelValue, type CollapseProps, type CollapseValue, type ConditionConnector, type ConditionEditorEmits, type ConditionEditorExposed, type ConditionEditorProps, type EvaluateOptions as ConditionEvaluateOptions, type ConditionExpression, type ConditionField, type ConditionGroup, type ConditionLeaf, type ConditionNode, type ConditionValue, type ContextmenuEmits, type ContextmenuExposed, type ContextmenuItem, ContextmenuPanelDIKey, type ContextmenuProps, ContextmenuRootDIKey, type CssTransitionEmits, type CssTransitionExposed, type CssTransitionProps, type DatePanelEmits, type DatePanelProps, type DatePickerDataType, type DatePickerEmits, type DatePickerExposed, type DatePickerProps, type DateRangePickerDataType, type DateRangePickerEmits, type DateRangePickerExposed, type DateRangePickerProps, type DateRangeValue, type DialogEmits, type DialogExposed, type DialogProps, type DialogTransition, type DrawerDirection, type DrawerEmits, type DrawerExposed, type DrawerMode, type DrawerProps, type DropdownEmits, type DropdownExposed, type DropdownProps, type DualNavEmits, type DualNavExposed, type DualNavProps, type DualNavRailVariant, type DualNavRootItem, type EmptyEmits, type EmptyExposed, type EmptyProps, type ExpressionEditorEmits, type ExpressionEditorExposed, type ExpressionEditorProps, type ExpressionSelectableLevels, type FileViewerEmits, type FileViewerExposed, type FileViewerItem, type FileViewerKind, type FileViewerProps, type FloatButtonEmits, type FloatButtonExposed, type FloatButtonItem, type FloatButtonProps, type FormEmits, type FormExposed, type FormItemEmits, type FormItemExposed, type FormItemProps, type FormProps, type GanttChartEmits, type GanttChartExposed, type GanttChartProps, type GridEmits, type GridExposed, type GridInputEmits, type GridInputExposed, type GridInputProps, type GridItemProps, type GridProps, type GroupInputEmits, type GroupInputExposed, type GroupInputProps, type GroupNavEmits, type GroupNavGroup, type GroupNavProps, type IconEmits, type IconExposed, type IconProps, type InputEmits, type InputExposed, type InputProps, type LayoutEmits, type LayoutExposed, type LayoutProps, type ListEmits, type ListExposed, type ListProps, type LoadingEmits, type LoadingExposed, type LoadingProps, type LoadingType, type Message, type MessageConfirm, type MessageConfirmAction, type MessageConfirmEmits, type MessageConfirmExposed, type MessageConfirmInstance, type MessageConfirmOptions, type MessageConfirmProps, type MessageEmits, type MessageExposed, type MessageInstance, type MessageOptions, type MessageProps, type MessageType, type MultiAutoCompleteEmits, type MultiAutoCompleteExposed, type MultiAutoCompleteProps, type MultiSelectEmits, type MultiSelectExposed, type MultiSelectProps, type MultiTreeSelectEmits, type MultiTreeSelectExposed, type MultiTreeSelectProps, type NavEmits, type NavExposed, type NavItem, type NavProps, type NodeRenderExposed, type NodeRenderProps, type Notification, type NotificationEmits, type NotificationExposed, type NotificationInstance, type NotificationOptions, type NotificationPosition, type NotificationProps, type NumberEmits, type NumberExposed, type NumberInputEmits, type NumberInputExposed, type NumberInputProps, type NumberProps, type NumberRangeInputEmits, type NumberRangeInputExposed, type NumberRangeInputProps, type NumberRangeTuple, type PaginatorEmits, type PaginatorExposed, type PaginatorProps, type PaletteColorType, type PaletteEmits, type PaletteExposed, type PaletteHSV, type PaletteProps, type PaletteRGB, type PanelItem, type PanelType, type PasswordInputEmits, type PasswordInputExposed, type PasswordInputProps, type PopConfirmEmits, type PopConfirmExposed, type PopConfirmProps, type PopEmits, type PopExposed, type PopProps, type ProgressEmits, type ProgressExposed, type ProgressNodesEmits, type ProgressNodesExposed, type ProgressNodesProps, type ProgressProps, type QuickBatchEditEmits, type QuickBatchEditExposed, type QuickBatchEditProps, type RadioEmits, type RadioExposed, type RadioGroupEmits, type RadioGroupExposed, type RadioGroupProps, type RadioProps, type RichTextEditorEmits, type RichTextEditorExposed, type RichTextEditorProps, type RichTextFormat, type ScrollEmits, type ScrollExposed, type ScrollPosition, type ScrollProps, type SegmentEmits, type SegmentExposed, type SegmentItem, type SegmentProps, type SelectEmits, type SelectExposed, type SelectProps, type SliderEmits, type SliderExposed, type SliderProps, type StepsEmits, type StepsExposed, type StepsProps, type StepsSlotScope, type SwitchEmits, type SwitchExposed, type SwitchProps, type TabItem, type TableColumn, type TableColumnAlign, type TableColumnNode, type TableColumnRenderContext, type TableColumnSlotsScope, type TableEditorEmits, type TableEditorExposed, type TableEditorProps, type TableEmits, type TableExposed, type TableProps, type TableRow, type TableRowSlotsScope, type TableSummaryContext, type TabsEmits, type TabsExposed, type TabsHorizontalEmits, type TabsHorizontalExposed, type TabsHorizontalProps, type TabsProps, type TabsVerticalEmits, type TabsVerticalExposed, type TabsVerticalProps, type TagEmits, type TagExposed, type TagProps, type TextEditorEmits, type TextEditorExposed, type TextEditorProps, type TextEmits, type TextExposed, type TextProps, type TextareaEmits, type TextareaExposed, type TextareaProps, type ThemeExposed, type ThemeProps, type TipAlign, type TipDirection, type TipEmits, type TipExposed, type TipProps, type ToolbarItem, type TreeEmit, type TreeExposed, type TreeNode, type TreeNodeProps, type TreeProps, type TreeSelectEmits, type TreeSelectExposed, type TreeSelectProps, _sfc_main as UAction, action_group_default as UActionGroup, _sfc_main$1 as UAutoComplete, _sfc_main$2 as UBadge, _sfc_main$3 as UBatchEdit, _sfc_main$4 as UBreadcrumb, _sfc_main$5 as UButton, _sfc_main$6 as UButtonGroup, _sfc_main$7 as UCalendar, _sfc_main$8 as UCard, _sfc_main$9 as UCardAction, _sfc_main$10 as UCardContent, _sfc_main$11 as UCardCover, _sfc_main$12 as UCardHeader, _sfc_main$13 as UCascade, _sfc_main$14 as UCheckTag, _sfc_main$15 as UCheckbox, _sfc_main$16 as UCheckboxButton, _sfc_main$17 as UCheckboxGroup, _sfc_main$18 as UCodeEditor, _sfc_main$19 as UCollapse, _sfc_main$20 as UCollapseItem, _sfc_main$21 as UConditionEditor, _sfc_main$22 as UContextmenu, _sfc_main$23 as UDatePanel, _sfc_main$24 as UDatePicker, _sfc_main$25 as UDateRangePicker, _sfc_main$26 as UDialog, _sfc_main$27 as UDrawer, _sfc_main$28 as UDropdown, _sfc_main$29 as UDualNav, _sfc_main$30 as UEmpty, _sfc_main$31 as UExpressionEditor, _sfc_main$32 as UFilePicker, _sfc_main$33 as UFileViewer, _sfc_main$34 as UFloatButton, form_default as UForm, form_item_default as UFormItem, _sfc_main$35 as UGanttChart, _sfc_main$36 as UGrid, _sfc_main$37 as UGridInput, _sfc_main$38 as UGridItem, _sfc_main$39 as UGroupInput, _sfc_main$40 as UGroupNav, _sfc_main$41 as UIcon, input_default as UInput, _sfc_main$42 as UKbd, _sfc_main$43 as ULayout, _sfc_main$44 as UList, _sfc_main$45 as UListItem, _sfc_main$46 as ULoading, _sfc_main$47 as UMessage, _sfc_main$48 as UMessageConfirm, _sfc_main$49 as UMultiSelect, _sfc_main$50 as UMultiTreeSelect, _sfc_main$51 as UNav, _sfc_main$52 as UNavItem, _sfc_main$53 as UNavSub, NodeRender as UNodeRender, _sfc_main$54 as UNotification, _sfc_main$55 as UNumber, _sfc_main$56 as UNumberInput, _sfc_main$57 as UNumberRangeInput, _sfc_main$58 as UPaginator, _sfc_main$59 as UPalette, _sfc_main$60 as UPasswordInput, _sfc_main$61 as UPopConfirm, _sfc_main$62 as UProgress, _sfc_main$63 as UProgressNodes, _sfc_main$64 as URadio, _sfc_main$65 as URadioGroup, _sfc_main$66 as URichTextEditor, _sfc_main$67 as UScroll, _sfc_main$68 as USegment, _sfc_main$69 as USelect, _sfc_main$70 as USlider, _sfc_main$71 as USteps, _sfc_main$72 as USwitch, _sfc_main$73 as UTable, _sfc_main$74 as UTableEditor, _sfc_main$75 as UTabs, _sfc_main$76 as UTabsHorizontal, _sfc_main$77 as UTabsVertical, _sfc_main$78 as UTag, _sfc_main$79 as UText, _sfc_main$80 as UTextarea, _sfc_main$81 as UTheme, _sfc_main$82 as UTip, _sfc_main$83 as UTree, _sfc_main$84 as UTreeSelect, _sfc_main$85 as UWatermark, type UploaderEmits, type UploaderExposed, type UploaderProps, type VariableItem, type WatermarkEmits, type WatermarkExposed, type WatermarkProps, type _ActionExposed, type _ActionGroupExposed, type _AnimationExposed, type _AutoCompleteExposed, type _BadgeExposed, type _BatchEditExposed, type _BreadcrumbExposed, type _ButtonExposed, type _CalendarExposed, type _CardExposed, type _CascadeExposed, type _CheckTagExposed, type _CodeEditorExposed, type _ConditionEditorExposed, type _ContextmenuExposed, type _CssTransitionExposed, type _DatePickerExposed, type _DateRangePickerExposed, type _DialogExposed, type _DrawerExposed, type _DropdownExposed, type _DualNavExposed, type _EmptyExposed, type _ExpressionEditorExposed, type _FileViewerExposed, type _FloatButtonExposed, type _FormExposed, type _GanttChartExposed, type _GridExposed, type _GridInputExposed, type _GroupInputExposed, type _InputExposed, type _LayoutExposed, type _ListExposed, type _LoadingExposed, type _MessageConfirmExposed, type _MessageExposed, type _MultiAutoCompleteExposed, type _MultiSelectExposed, type _MultiTreeSelectExposed, type _NavExposed, type _NotificationExposed, type _PaginatorExposed, type _PaletteExposed, type _PasswordInputExposed, type _PopConfirmExposed, type _PopExposed, type _ProgressExposed, type _ProgressNodesExposed, type _QuickBatchEditExposed, type _RadioExposed, type _RadioGroupExposed, type _RichTextEditorExposed, type _ScrollExposed, type _SegmentExposed, type _SelectExposed, type _SliderExposed, type _StepsExposed, type _SwitchExposed, type _TableEditorExposed, type _TableExposed, type _TabsExposed, type _TabsHorizontalExposed, type _TabsVerticalExposed, type _TextEditorExposed, type _TextExposed, type _TextareaExposed, type _ThemeExposed, type _TipExposed, type _TreeExposed, type _TreeSelectExposed, type _UploaderExposed, type _WatermarkExposed, contextmenu, createEmptyGroup, createEmptyLeaf, defineBatchEditColumns, defineTableColumns, evaluate as evaluateConditionExpression, message, messageConfirm, notification, vLoading };
@@ -1,9 +1,13 @@
1
1
  import { DeconstructValue, FormComponentProps } from "@veltra/utils";
2
2
  import { Dater } from "@cat-kit/core";
3
3
  //#region src/types/date-range-picker.d.ts
4
+ /** 绑定值类型 */
5
+ type DateRangePickerDataType = 'date' | 'timestamp' | 'string';
6
+ /** 日期范围绑定值 */
7
+ type DateRangeValue = [string, string] | [number, number] | [Date, Date];
4
8
  /** date-range-picker组件属性 */
5
9
  interface DateRangePickerProps extends FormComponentProps {
6
- modelValue?: [string, string];
10
+ modelValue?: DateRangeValue;
7
11
  /** 占位 */
8
12
  placeholder?: [string, string];
9
13
  /** 日期类型 */
@@ -12,6 +16,11 @@ interface DateRangePickerProps extends FormComponentProps {
12
16
  format?: string;
13
17
  /** 日期值格式化, 当没有指定时默认使用format属性,仅当值和显示的内容不一致时才需要使用到该属性 */
14
18
  valueFormat?: string;
19
+ /**
20
+ * 绑定值的类型,默认为字符串。
21
+ * 当 dataType 没有指定为字符串时,valueFormat 属性不生效
22
+ */
23
+ dataType?: DateRangePickerDataType;
15
24
  /** 最小可选日期 */
16
25
  disabledDate?: (date: Dater, raw: Date) => boolean;
17
26
  /** 是否显示清除按钮 */
@@ -19,12 +28,13 @@ interface DateRangePickerProps extends FormComponentProps {
19
28
  }
20
29
  /** date-range-picker组件定义的事件 */
21
30
  interface DateRangePickerEmits {
22
- (e: 'update:modelValue', value?: [string, string]): void;
31
+ (e: 'update:modelValue', value?: DateRangeValue): void;
32
+ (e: 'change', dates?: [Date, Date]): void;
23
33
  }
24
34
  /** date-range-picker组件暴露的属性和方法(组件内部使用) */
25
35
  interface _DateRangePickerExposed {}
26
36
  /** date-range-picker组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
27
37
  type DateRangePickerExposed = DeconstructValue<_DateRangePickerExposed>;
28
38
  //#endregion
29
- export { DateRangePickerEmits, DateRangePickerExposed, DateRangePickerProps, _DateRangePickerExposed };
39
+ export { DateRangePickerDataType, DateRangePickerEmits, DateRangePickerExposed, DateRangePickerProps, DateRangeValue, _DateRangePickerExposed };
30
40
  //# sourceMappingURL=date-range-picker.d.ts.map
@@ -5,7 +5,7 @@ import { TreeEmit, TreeExposed, TreeNode, TreeNodeProps, TreeProps, _TreeExposed
5
5
  import { TreeSelectEmits, TreeSelectExposed, TreeSelectProps, _TreeSelectExposed } from "./tree-select.js";
6
6
  import { LayoutEmits, LayoutExposed, LayoutProps, _LayoutExposed } from "./layout.js";
7
7
  import { TagEmits, TagExposed, TagProps } from "./tag.js";
8
- import { DateRangePickerEmits, DateRangePickerExposed, DateRangePickerProps, _DateRangePickerExposed } from "./date-range-picker.js";
8
+ import { DateRangePickerDataType, DateRangePickerEmits, DateRangePickerExposed, DateRangePickerProps, DateRangeValue, _DateRangePickerExposed } from "./date-range-picker.js";
9
9
  import { RadioGroupEmits, RadioGroupExposed, RadioGroupProps, _RadioGroupExposed } from "./radio-group.js";
10
10
  import { ScrollEmits, ScrollExposed, ScrollPosition, ScrollProps, _ScrollExposed } from "./scroll.js";
11
11
  import { WatermarkEmits, WatermarkExposed, WatermarkProps, _WatermarkExposed } from "./watermark.js";
@@ -81,4 +81,4 @@ import { FileViewerEmits, FileViewerExposed, FileViewerItem, FileViewerKind, Fil
81
81
  import { CollapseEmits, CollapseItemEmits, CollapseItemProps, CollapseModelValue, CollapseProps, CollapseValue } from "./collapse.js";
82
82
  import { SegmentEmits, SegmentExposed, SegmentItem, SegmentProps, _SegmentExposed } from "./segment.js";
83
83
  export type * from "@veltra/utils";
84
- export { ActionEmits, ActionExposed, ActionGroupExposed, ActionGroupProps, ActionProps, AnimationEmits, AnimationExposed, AnimationProps, AutoCompleteEmits, AutoCompleteExposed, AutoCompleteProps, BadgeEmits, BadgeExposed, BadgeProps, BarType, BatchEditColumn, BatchEditEmits, BatchEditExposed, BatchEditFeature, BatchEditFormStatus, BatchEditProps, BatchEditSlots, BatchEditStates, BreadcrumbEmits, BreadcrumbExposed, BreadcrumbItem, BreadcrumbProps, BreadcrumbSlotScope, BreakCols, Breakpoint, ButtonEmits, ButtonExposed, ButtonProps, ButtonType, CalendarDay, CalendarEmits, CalendarExposed, CalendarMonth, CalendarProps, CalendarYear, CardActionProps, CardContentProps, CardCoverProps, CardEmits, CardExposed, CardProps, CascadeEmits, CascadeExposed, CascadeNode, CascadeProps, CheckTagEmits, CheckTagExposed, CheckTagProps, CheckboxButtonEmits, CheckboxButtonProps, CheckboxEmits, CheckboxExposed, CheckboxGroupEmits, CheckboxGroupExposed, CheckboxGroupProps, CheckboxProps, CodeEditorEmits, CodeEditorExposed, CodeEditorLang, CodeEditorProps, CollapseEmits, CollapseItemEmits, CollapseItemProps, CollapseModelValue, CollapseProps, CollapseValue, ConditionConnector, ConditionEditorEmits, ConditionEditorExposed, ConditionEditorProps, ConditionExpression, ConditionField, ConditionGroup, ConditionLeaf, ConditionNode, ConditionValue, ContextmenuEmits, ContextmenuExposed, ContextmenuItem, ContextmenuProps, CssTransitionEmits, CssTransitionExposed, CssTransitionProps, DatePanelEmits, DatePanelProps, DatePickerDataType, DatePickerEmits, DatePickerExposed, DatePickerProps, DateRangePickerEmits, DateRangePickerExposed, DateRangePickerProps, DialogEmits, DialogExposed, DialogProps, DialogTransition, DrawerDirection, DrawerEmits, DrawerExposed, DrawerMode, DrawerProps, DropdownEmits, DropdownExposed, DropdownProps, DualNavEmits, DualNavExposed, DualNavProps, DualNavRailVariant, DualNavRootItem, EmptyEmits, EmptyExposed, EmptyProps, ExpressionEditorEmits, ExpressionEditorExposed, ExpressionEditorProps, ExpressionSelectableLevels, FileViewerEmits, FileViewerExposed, FileViewerItem, FileViewerKind, FileViewerProps, FloatButtonEmits, FloatButtonExposed, FloatButtonItem, FloatButtonProps, FormEmits, FormExposed, FormItemEmits, FormItemExposed, FormItemProps, FormProps, GanttChartEmits, GanttChartExposed, GanttChartProps, GridEmits, GridExposed, GridInputEmits, GridInputExposed, GridInputProps, GridItemProps, GridProps, GroupInputEmits, GroupInputExposed, GroupInputProps, GroupNavEmits, GroupNavGroup, GroupNavProps, IconEmits, IconExposed, IconProps, InputEmits, InputExposed, InputProps, LayoutEmits, LayoutExposed, LayoutProps, ListEmits, ListExposed, ListProps, LoadingEmits, LoadingExposed, LoadingProps, LoadingType, Message, MessageConfirm, MessageConfirmAction, MessageConfirmEmits, MessageConfirmExposed, MessageConfirmInstance, MessageConfirmOptions, MessageConfirmProps, MessageEmits, MessageExposed, MessageInstance, MessageOptions, MessageProps, MessageType, MultiAutoCompleteEmits, MultiAutoCompleteExposed, MultiAutoCompleteProps, MultiSelectEmits, MultiSelectExposed, MultiSelectProps, MultiTreeSelectEmits, MultiTreeSelectExposed, MultiTreeSelectProps, NavEmits, NavExposed, NavItem, NavProps, NodeRenderExposed, NodeRenderProps, Notification, NotificationEmits, NotificationExposed, NotificationInstance, NotificationOptions, NotificationPosition, NotificationProps, NumberEmits, NumberExposed, NumberInputEmits, NumberInputExposed, NumberInputProps, NumberProps, NumberRangeInputEmits, NumberRangeInputExposed, NumberRangeInputProps, NumberRangeTuple, PaginatorEmits, PaginatorExposed, PaginatorProps, PaletteColorType, PaletteEmits, PaletteExposed, PaletteHSV, PaletteProps, PaletteRGB, PanelItem, PanelType, PasswordInputEmits, PasswordInputExposed, PasswordInputProps, PopConfirmEmits, PopConfirmExposed, PopConfirmProps, PopEmits, PopExposed, PopProps, ProgressEmits, ProgressExposed, ProgressNodesEmits, ProgressNodesExposed, ProgressNodesProps, ProgressProps, QuickBatchEditEmits, QuickBatchEditExposed, QuickBatchEditProps, RadioEmits, RadioExposed, RadioGroupEmits, RadioGroupExposed, RadioGroupProps, RadioProps, RichTextEditorEmits, RichTextEditorExposed, RichTextEditorProps, RichTextFormat, ScrollEmits, ScrollExposed, ScrollPosition, ScrollProps, SegmentEmits, SegmentExposed, SegmentItem, SegmentProps, SelectEmits, SelectExposed, SelectProps, SliderEmits, SliderExposed, SliderProps, StepsEmits, StepsExposed, StepsProps, StepsSlotScope, SwitchEmits, SwitchExposed, SwitchProps, TabItem, TableColumn, TableColumnAlign, TableColumnNode, TableColumnRenderContext, TableColumnSlotsScope, TableEditorEmits, TableEditorExposed, TableEditorProps, TableEmits, TableExposed, TableProps, TableRow, TableRowSlotsScope, TableSummaryContext, TabsEmits, TabsExposed, TabsHorizontalEmits, TabsHorizontalExposed, TabsHorizontalProps, TabsProps, TabsVerticalEmits, TabsVerticalExposed, TabsVerticalProps, TagEmits, TagExposed, TagProps, TextEditorEmits, TextEditorExposed, TextEditorProps, TextEmits, TextExposed, TextProps, TextareaEmits, TextareaExposed, TextareaProps, ThemeExposed, ThemeProps, TipAlign, TipDirection, TipEmits, TipExposed, TipProps, ToolbarItem, TreeEmit, TreeExposed, TreeNode, TreeNodeProps, TreeProps, TreeSelectEmits, TreeSelectExposed, TreeSelectProps, UploaderEmits, UploaderExposed, UploaderProps, VariableItem, WatermarkEmits, WatermarkExposed, WatermarkProps, _ActionExposed, _ActionGroupExposed, _AnimationExposed, _AutoCompleteExposed, _BadgeExposed, _BatchEditExposed, _BreadcrumbExposed, _ButtonExposed, _CalendarExposed, _CardExposed, _CascadeExposed, _CheckTagExposed, _CodeEditorExposed, _ConditionEditorExposed, _ContextmenuExposed, _CssTransitionExposed, _DatePickerExposed, _DateRangePickerExposed, _DialogExposed, _DrawerExposed, _DropdownExposed, _DualNavExposed, _EmptyExposed, _ExpressionEditorExposed, _FileViewerExposed, _FloatButtonExposed, _FormExposed, _GanttChartExposed, _GridExposed, _GridInputExposed, _GroupInputExposed, _InputExposed, _LayoutExposed, _ListExposed, _LoadingExposed, _MessageConfirmExposed, _MessageExposed, _MultiAutoCompleteExposed, _MultiSelectExposed, _MultiTreeSelectExposed, _NavExposed, _NotificationExposed, _PaginatorExposed, _PaletteExposed, _PasswordInputExposed, _PopConfirmExposed, _PopExposed, _ProgressExposed, _ProgressNodesExposed, _QuickBatchEditExposed, _RadioExposed, _RadioGroupExposed, _RichTextEditorExposed, _ScrollExposed, _SegmentExposed, _SelectExposed, _SliderExposed, _StepsExposed, _SwitchExposed, _TableEditorExposed, _TableExposed, _TabsExposed, _TabsHorizontalExposed, _TabsVerticalExposed, _TextEditorExposed, _TextExposed, _TextareaExposed, _ThemeExposed, _TipExposed, _TreeExposed, _TreeSelectExposed, _UploaderExposed, _WatermarkExposed };
84
+ export { ActionEmits, ActionExposed, ActionGroupExposed, ActionGroupProps, ActionProps, AnimationEmits, AnimationExposed, AnimationProps, AutoCompleteEmits, AutoCompleteExposed, AutoCompleteProps, BadgeEmits, BadgeExposed, BadgeProps, BarType, BatchEditColumn, BatchEditEmits, BatchEditExposed, BatchEditFeature, BatchEditFormStatus, BatchEditProps, BatchEditSlots, BatchEditStates, BreadcrumbEmits, BreadcrumbExposed, BreadcrumbItem, BreadcrumbProps, BreadcrumbSlotScope, BreakCols, Breakpoint, ButtonEmits, ButtonExposed, ButtonProps, ButtonType, CalendarDay, CalendarEmits, CalendarExposed, CalendarMonth, CalendarProps, CalendarYear, CardActionProps, CardContentProps, CardCoverProps, CardEmits, CardExposed, CardProps, CascadeEmits, CascadeExposed, CascadeNode, CascadeProps, CheckTagEmits, CheckTagExposed, CheckTagProps, CheckboxButtonEmits, CheckboxButtonProps, CheckboxEmits, CheckboxExposed, CheckboxGroupEmits, CheckboxGroupExposed, CheckboxGroupProps, CheckboxProps, CodeEditorEmits, CodeEditorExposed, CodeEditorLang, CodeEditorProps, CollapseEmits, CollapseItemEmits, CollapseItemProps, CollapseModelValue, CollapseProps, CollapseValue, ConditionConnector, ConditionEditorEmits, ConditionEditorExposed, ConditionEditorProps, ConditionExpression, ConditionField, ConditionGroup, ConditionLeaf, ConditionNode, ConditionValue, ContextmenuEmits, ContextmenuExposed, ContextmenuItem, ContextmenuProps, CssTransitionEmits, CssTransitionExposed, CssTransitionProps, DatePanelEmits, DatePanelProps, DatePickerDataType, DatePickerEmits, DatePickerExposed, DatePickerProps, DateRangePickerDataType, DateRangePickerEmits, DateRangePickerExposed, DateRangePickerProps, DateRangeValue, DialogEmits, DialogExposed, DialogProps, DialogTransition, DrawerDirection, DrawerEmits, DrawerExposed, DrawerMode, DrawerProps, DropdownEmits, DropdownExposed, DropdownProps, DualNavEmits, DualNavExposed, DualNavProps, DualNavRailVariant, DualNavRootItem, EmptyEmits, EmptyExposed, EmptyProps, ExpressionEditorEmits, ExpressionEditorExposed, ExpressionEditorProps, ExpressionSelectableLevels, FileViewerEmits, FileViewerExposed, FileViewerItem, FileViewerKind, FileViewerProps, FloatButtonEmits, FloatButtonExposed, FloatButtonItem, FloatButtonProps, FormEmits, FormExposed, FormItemEmits, FormItemExposed, FormItemProps, FormProps, GanttChartEmits, GanttChartExposed, GanttChartProps, GridEmits, GridExposed, GridInputEmits, GridInputExposed, GridInputProps, GridItemProps, GridProps, GroupInputEmits, GroupInputExposed, GroupInputProps, GroupNavEmits, GroupNavGroup, GroupNavProps, IconEmits, IconExposed, IconProps, InputEmits, InputExposed, InputProps, LayoutEmits, LayoutExposed, LayoutProps, ListEmits, ListExposed, ListProps, LoadingEmits, LoadingExposed, LoadingProps, LoadingType, Message, MessageConfirm, MessageConfirmAction, MessageConfirmEmits, MessageConfirmExposed, MessageConfirmInstance, MessageConfirmOptions, MessageConfirmProps, MessageEmits, MessageExposed, MessageInstance, MessageOptions, MessageProps, MessageType, MultiAutoCompleteEmits, MultiAutoCompleteExposed, MultiAutoCompleteProps, MultiSelectEmits, MultiSelectExposed, MultiSelectProps, MultiTreeSelectEmits, MultiTreeSelectExposed, MultiTreeSelectProps, NavEmits, NavExposed, NavItem, NavProps, NodeRenderExposed, NodeRenderProps, Notification, NotificationEmits, NotificationExposed, NotificationInstance, NotificationOptions, NotificationPosition, NotificationProps, NumberEmits, NumberExposed, NumberInputEmits, NumberInputExposed, NumberInputProps, NumberProps, NumberRangeInputEmits, NumberRangeInputExposed, NumberRangeInputProps, NumberRangeTuple, PaginatorEmits, PaginatorExposed, PaginatorProps, PaletteColorType, PaletteEmits, PaletteExposed, PaletteHSV, PaletteProps, PaletteRGB, PanelItem, PanelType, PasswordInputEmits, PasswordInputExposed, PasswordInputProps, PopConfirmEmits, PopConfirmExposed, PopConfirmProps, PopEmits, PopExposed, PopProps, ProgressEmits, ProgressExposed, ProgressNodesEmits, ProgressNodesExposed, ProgressNodesProps, ProgressProps, QuickBatchEditEmits, QuickBatchEditExposed, QuickBatchEditProps, RadioEmits, RadioExposed, RadioGroupEmits, RadioGroupExposed, RadioGroupProps, RadioProps, RichTextEditorEmits, RichTextEditorExposed, RichTextEditorProps, RichTextFormat, ScrollEmits, ScrollExposed, ScrollPosition, ScrollProps, SegmentEmits, SegmentExposed, SegmentItem, SegmentProps, SelectEmits, SelectExposed, SelectProps, SliderEmits, SliderExposed, SliderProps, StepsEmits, StepsExposed, StepsProps, StepsSlotScope, SwitchEmits, SwitchExposed, SwitchProps, TabItem, TableColumn, TableColumnAlign, TableColumnNode, TableColumnRenderContext, TableColumnSlotsScope, TableEditorEmits, TableEditorExposed, TableEditorProps, TableEmits, TableExposed, TableProps, TableRow, TableRowSlotsScope, TableSummaryContext, TabsEmits, TabsExposed, TabsHorizontalEmits, TabsHorizontalExposed, TabsHorizontalProps, TabsProps, TabsVerticalEmits, TabsVerticalExposed, TabsVerticalProps, TagEmits, TagExposed, TagProps, TextEditorEmits, TextEditorExposed, TextEditorProps, TextEmits, TextExposed, TextProps, TextareaEmits, TextareaExposed, TextareaProps, ThemeExposed, ThemeProps, TipAlign, TipDirection, TipEmits, TipExposed, TipProps, ToolbarItem, TreeEmit, TreeExposed, TreeNode, TreeNodeProps, TreeProps, TreeSelectEmits, TreeSelectExposed, TreeSelectProps, UploaderEmits, UploaderExposed, UploaderProps, VariableItem, WatermarkEmits, WatermarkExposed, WatermarkProps, _ActionExposed, _ActionGroupExposed, _AnimationExposed, _AutoCompleteExposed, _BadgeExposed, _BatchEditExposed, _BreadcrumbExposed, _ButtonExposed, _CalendarExposed, _CardExposed, _CascadeExposed, _CheckTagExposed, _CodeEditorExposed, _ConditionEditorExposed, _ContextmenuExposed, _CssTransitionExposed, _DatePickerExposed, _DateRangePickerExposed, _DialogExposed, _DrawerExposed, _DropdownExposed, _DualNavExposed, _EmptyExposed, _ExpressionEditorExposed, _FileViewerExposed, _FloatButtonExposed, _FormExposed, _GanttChartExposed, _GridExposed, _GridInputExposed, _GroupInputExposed, _InputExposed, _LayoutExposed, _ListExposed, _LoadingExposed, _MessageConfirmExposed, _MessageExposed, _MultiAutoCompleteExposed, _MultiSelectExposed, _MultiTreeSelectExposed, _NavExposed, _NotificationExposed, _PaginatorExposed, _PaletteExposed, _PasswordInputExposed, _PopConfirmExposed, _PopExposed, _ProgressExposed, _ProgressNodesExposed, _QuickBatchEditExposed, _RadioExposed, _RadioGroupExposed, _RichTextEditorExposed, _ScrollExposed, _SegmentExposed, _SelectExposed, _SliderExposed, _StepsExposed, _SwitchExposed, _TableEditorExposed, _TableExposed, _TabsExposed, _TabsHorizontalExposed, _TabsVerticalExposed, _TextEditorExposed, _TextExposed, _TextareaExposed, _ThemeExposed, _TipExposed, _TreeExposed, _TreeSelectExposed, _UploaderExposed, _WatermarkExposed };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltra/desktop",
3
- "version": "1.7.6",
3
+ "version": "1.7.7",
4
4
  "homepage": "https://github.com/cabinet-fe/ultra-ui#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/cabinet-fe/ultra-ui/issues"
@@ -80,12 +80,12 @@
80
80
  "peerDependencies": {
81
81
  "@cat-kit/core": ">=1.2.1",
82
82
  "@cat-kit/fe": ">=1.2.1",
83
- "@veltra/compositions": "^1.7.6",
84
- "@veltra/directives": "^1.7.6",
83
+ "@veltra/compositions": "^1.7.7",
84
+ "@veltra/directives": "^1.7.7",
85
85
  "@veltra/icons": "^1.5.0",
86
86
  "@veltra/sheet-core": "^2.5.4",
87
- "@veltra/styles": "^1.7.6",
88
- "@veltra/utils": "^1.7.6",
87
+ "@veltra/styles": "^1.7.7",
88
+ "@veltra/utils": "^1.7.7",
89
89
  "vue": ">=3.5.42"
90
90
  },
91
91
  "peerDependenciesMeta": {
@@ -0,0 +1,278 @@
1
+ import { date } from '@cat-kit/core'
2
+ import { describe, expect, it } from 'vitest'
3
+ import { createApp, h, nextTick, ref } from 'vue'
4
+
5
+ import UDateRangePicker from '../date-range-picker.vue'
6
+
7
+ function mountDateRangePicker(
8
+ props: Record<string, unknown> = {},
9
+ emits: Record<string, Function> = {}
10
+ ) {
11
+ const host = document.createElement('div')
12
+ document.body.appendChild(host)
13
+
14
+ const model = ref(props.modelValue)
15
+ const app = createApp({
16
+ render() {
17
+ return h(UDateRangePicker, {
18
+ ...props,
19
+ modelValue: model.value,
20
+ 'onUpdate:modelValue': (value: unknown) => {
21
+ model.value = value
22
+ emits['update:modelValue']?.(value)
23
+ },
24
+ onChange: (dates?: [Date, Date]) => {
25
+ emits.change?.(dates)
26
+ }
27
+ })
28
+ }
29
+ })
30
+
31
+ app.component('Transition', (_, { slots }) => slots.default?.())
32
+
33
+ app.mount(host)
34
+
35
+ return {
36
+ host,
37
+ model,
38
+ app,
39
+ unmount() {
40
+ app.unmount()
41
+ host.remove()
42
+ }
43
+ }
44
+ }
45
+
46
+ describe('UDateRangePicker', () => {
47
+ it('defaults dataType to string and emits change with native Date tuple', async () => {
48
+ let changedDates: [Date, Date] | undefined
49
+ let updatedVal: unknown
50
+
51
+ const { host, unmount } = mountDateRangePicker(
52
+ {},
53
+ {
54
+ 'update:modelValue': (val: unknown) => {
55
+ updatedVal = val
56
+ },
57
+ change: (d?: [Date, Date]) => {
58
+ changedDates = d
59
+ }
60
+ }
61
+ )
62
+
63
+ try {
64
+ const inputEl = host.querySelector('input')
65
+ expect(inputEl).not.toBeNull()
66
+ inputEl?.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }))
67
+ await nextTick()
68
+ await nextTick()
69
+
70
+ const cells = document.querySelectorAll<HTMLElement>('.u-date-panel__cell:not(.is-disabled)')
71
+ expect(cells.length).toBeGreaterThanOrEqual(20)
72
+
73
+ cells[10]!.click()
74
+ await nextTick()
75
+ cells[15]!.click()
76
+ await nextTick()
77
+
78
+ expect(Array.isArray(updatedVal)).toBe(true)
79
+ const range = updatedVal as string[]
80
+ expect(range.length).toBe(2)
81
+ expect(typeof range[0]).toBe('string')
82
+ expect(typeof range[1]).toBe('string')
83
+ expect(range[0]).toMatch(/^\d{4}-\d{2}-\d{2}$/)
84
+ expect(range[1]).toMatch(/^\d{4}-\d{2}-\d{2}$/)
85
+
86
+ expect(Array.isArray(changedDates)).toBe(true)
87
+ expect(changedDates![0] instanceof Date).toBe(true)
88
+ expect(changedDates![1] instanceof Date).toBe(true)
89
+ } finally {
90
+ unmount()
91
+ }
92
+ })
93
+
94
+ it('supports dataType="date" and emits native Date tuple for modelValue and change', async () => {
95
+ let changedDates: [Date, Date] | undefined
96
+ let updatedVal: unknown
97
+
98
+ const { host, unmount } = mountDateRangePicker(
99
+ { dataType: 'date', valueFormat: 'yyyyMMdd' },
100
+ {
101
+ 'update:modelValue': (val: unknown) => {
102
+ updatedVal = val
103
+ },
104
+ change: (d?: [Date, Date]) => {
105
+ changedDates = d
106
+ }
107
+ }
108
+ )
109
+
110
+ try {
111
+ const inputEl = host.querySelector('input')
112
+ inputEl?.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }))
113
+ await nextTick()
114
+ await nextTick()
115
+
116
+ const cells = document.querySelectorAll<HTMLElement>('.u-date-panel__cell:not(.is-disabled)')
117
+ cells[10]!.click()
118
+ await nextTick()
119
+ cells[15]!.click()
120
+ await nextTick()
121
+
122
+ expect(Array.isArray(updatedVal)).toBe(true)
123
+ const range = updatedVal as unknown[]
124
+ expect(range[0] instanceof Date).toBe(true)
125
+ expect(range[1] instanceof Date).toBe(true)
126
+
127
+ expect(Array.isArray(changedDates)).toBe(true)
128
+ expect(changedDates![0] instanceof Date).toBe(true)
129
+ expect(changedDates![1] instanceof Date).toBe(true)
130
+ } finally {
131
+ unmount()
132
+ }
133
+ })
134
+
135
+ it('supports dataType="timestamp" and emits timestamp tuple for modelValue and native Date tuple for change', async () => {
136
+ let changedDates: [Date, Date] | undefined
137
+ let updatedVal: unknown
138
+
139
+ const { host, unmount } = mountDateRangePicker(
140
+ { dataType: 'timestamp', valueFormat: 'yyyyMMdd' },
141
+ {
142
+ 'update:modelValue': (val: unknown) => {
143
+ updatedVal = val
144
+ },
145
+ change: (d?: [Date, Date]) => {
146
+ changedDates = d
147
+ }
148
+ }
149
+ )
150
+
151
+ try {
152
+ const inputEl = host.querySelector('input')
153
+ inputEl?.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }))
154
+ await nextTick()
155
+ await nextTick()
156
+
157
+ const cells = document.querySelectorAll<HTMLElement>('.u-date-panel__cell:not(.is-disabled)')
158
+ cells[10]!.click()
159
+ await nextTick()
160
+ cells[15]!.click()
161
+ await nextTick()
162
+
163
+ expect(Array.isArray(updatedVal)).toBe(true)
164
+ const range = updatedVal as number[]
165
+ expect(typeof range[0]).toBe('number')
166
+ expect(typeof range[1]).toBe('number')
167
+ expect(range[0]).toBeGreaterThan(0)
168
+ expect(range[1]).toBeGreaterThan(0)
169
+
170
+ expect(Array.isArray(changedDates)).toBe(true)
171
+ expect(changedDates![0] instanceof Date).toBe(true)
172
+ expect(changedDates![1] instanceof Date).toBe(true)
173
+ } finally {
174
+ unmount()
175
+ }
176
+ })
177
+
178
+ it('applies valueFormat when dataType="string"', async () => {
179
+ let changedDates: [Date, Date] | undefined
180
+ let updatedVal: unknown
181
+
182
+ const { host, unmount } = mountDateRangePicker(
183
+ { dataType: 'string', valueFormat: 'yyyy/MM/dd' },
184
+ {
185
+ 'update:modelValue': (val: unknown) => {
186
+ updatedVal = val
187
+ },
188
+ change: (d?: [Date, Date]) => {
189
+ changedDates = d
190
+ }
191
+ }
192
+ )
193
+
194
+ try {
195
+ const inputEl = host.querySelector('input')
196
+ inputEl?.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }))
197
+ await nextTick()
198
+ await nextTick()
199
+
200
+ const cells = document.querySelectorAll<HTMLElement>('.u-date-panel__cell:not(.is-disabled)')
201
+ cells[10]!.click()
202
+ await nextTick()
203
+ cells[15]!.click()
204
+ await nextTick()
205
+
206
+ expect(Array.isArray(updatedVal)).toBe(true)
207
+ const range = updatedVal as string[]
208
+ expect(range[0]).toMatch(/^\d{4}\/\d{2}\/\d{2}$/)
209
+ expect(range[1]).toMatch(/^\d{4}\/\d{2}\/\d{2}$/)
210
+ expect(changedDates![0] instanceof Date).toBe(true)
211
+ expect(changedDates![1] instanceof Date).toBe(true)
212
+ } finally {
213
+ unmount()
214
+ }
215
+ })
216
+
217
+ it('emits undefined for modelValue and change when cleared', async () => {
218
+ let changedDates: [Date, Date] | undefined = [new Date(), new Date()]
219
+ let updatedVal: unknown = ['2024-05-01', '2024-05-10']
220
+
221
+ const { host, unmount } = mountDateRangePicker(
222
+ { modelValue: ['2024-05-01', '2024-05-10'], clearable: true },
223
+ {
224
+ 'update:modelValue': (val: unknown) => {
225
+ updatedVal = val
226
+ },
227
+ change: (d?: [Date, Date]) => {
228
+ changedDates = d
229
+ }
230
+ }
231
+ )
232
+
233
+ try {
234
+ const dropdown = host.firstElementChild as HTMLElement
235
+ dropdown.dispatchEvent(new MouseEvent('mouseenter', { bubbles: true }))
236
+ await new Promise((r) => setTimeout(r, 50))
237
+
238
+ const clearBtn = host.querySelector('.u-date-range-picker__clear') as HTMLElement
239
+ expect(clearBtn).not.toBeNull()
240
+ clearBtn.click()
241
+ await nextTick()
242
+
243
+ expect(updatedVal).toBeUndefined()
244
+ expect(changedDates).toBeUndefined()
245
+ } finally {
246
+ unmount()
247
+ }
248
+ })
249
+
250
+ it('correctly parses modelValue of Date tuple, timestamp tuple, and custom formatted strings', async () => {
251
+ const dates: [Date, Date] = [new Date(2024, 4, 15), new Date(2024, 4, 20)]
252
+ const d1 = mountDateRangePicker({ modelValue: dates })
253
+ await nextTick()
254
+ const inputs1 = d1.host.querySelectorAll('input')
255
+ expect(inputs1[0]?.value).toBe('2024-05-15')
256
+ expect(inputs1[1]?.value).toBe('2024-05-20')
257
+ d1.unmount()
258
+
259
+ const ts1 = date('2024-06-20').timestamp
260
+ const ts2 = date('2024-06-25').timestamp
261
+ const d2 = mountDateRangePicker({ modelValue: [ts1, ts2] })
262
+ await nextTick()
263
+ const inputs2 = d2.host.querySelectorAll('input')
264
+ expect(inputs2[0]?.value).toBe('2024-06-20')
265
+ expect(inputs2[1]?.value).toBe('2024-06-25')
266
+ d2.unmount()
267
+
268
+ const d3 = mountDateRangePicker({
269
+ modelValue: ['20240725', '20240730'],
270
+ valueFormat: 'yyyyMMdd'
271
+ })
272
+ await nextTick()
273
+ const inputs3 = d3.host.querySelectorAll('input')
274
+ expect(inputs3[0]?.value).toBe('2024-07-25')
275
+ expect(inputs3[1]?.value).toBe('2024-07-30')
276
+ d3.unmount()
277
+ })
278
+ })
@@ -31,7 +31,7 @@
31
31
 
32
32
  <Transition name="zoom-in" mode="out-in">
33
33
  <UIcon
34
- v-if="clearable && modelValue && hovered && !disabled"
34
+ v-if="clearable && (modelValue?.length || currentRangeDate) && hovered && !disabled"
35
35
  :class="[cls.e('icon'), cls.e('clear')]"
36
36
  title="清除"
37
37
  @click.stop="handleClear"
@@ -62,14 +62,19 @@
62
62
  </template>
63
63
 
64
64
  <script lang="ts" setup>
65
- import { date, type Dater } from '@cat-kit/core'
65
+ import { date, Dater } from '@cat-kit/core'
66
66
  import { useFormFallbackProps, useUserAction } from '@veltra/compositions'
67
67
  import { Calendar, Close } from '@veltra/icons/normal'
68
68
  import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
69
69
  import { injectFormContext } from '@veltra/utils'
70
70
  import { computed, shallowRef, watch } from 'vue'
71
71
 
72
- import type { DateRangePickerEmits, DateRangePickerProps, DropdownExposed } from '../../types'
72
+ import type {
73
+ DateRangePickerEmits,
74
+ DateRangePickerProps,
75
+ DateRangeValue,
76
+ DropdownExposed
77
+ } from '../../types'
73
78
  import { UDatePanel } from '../date-panel'
74
79
  import { UDropdown } from '../dropdown'
75
80
  import { UIcon } from '../icon'
@@ -79,6 +84,7 @@ defineOptions({ name: 'UDateRangePicker', inheritAttrs: false })
79
84
  const props = withDefaults(defineProps<DateRangePickerProps>(), {
80
85
  placeholder: () => ['起始日期', '结束日期'],
81
86
  type: 'date',
87
+ dataType: 'string',
82
88
  disabled: undefined,
83
89
  readonly: undefined,
84
90
  clearable: true
@@ -113,14 +119,6 @@ const { userAction, isUserActive } = useUserAction()
113
119
 
114
120
  const currentRangeDate = shallowRef<[Dater, Dater]>()
115
121
 
116
- const displayedOfStart = computed(() => {
117
- return props.modelValue?.[0]
118
- })
119
-
120
- const displayedOfEnd = computed(() => {
121
- return props.modelValue?.[1]
122
- })
123
-
124
122
  const formatStr = computed(() => {
125
123
  const { format, type } = props
126
124
  if (format) return format
@@ -130,25 +128,70 @@ const formatStr = computed(() => {
130
128
  return 'yyyy-MM-dd'
131
129
  })
132
130
 
131
+ const displayedOfStart = computed(() => {
132
+ return currentRangeDate.value?.[0]?.format(formatStr.value) ?? ''
133
+ })
134
+
135
+ const displayedOfEnd = computed(() => {
136
+ return currentRangeDate.value?.[1]?.format(formatStr.value) ?? ''
137
+ })
138
+
139
+ function parseDateValue(val?: string | number | Date): Dater | undefined {
140
+ if (val == null || val === '') return undefined
141
+ if (val instanceof Date || typeof val === 'number') {
142
+ const d = date(val)
143
+ return isNaN(d.timestamp) ? undefined : d
144
+ }
145
+ if (typeof val === 'string') {
146
+ if (props.dataType === 'string' && props.valueFormat) {
147
+ const parsed = Dater.parse(val, props.valueFormat)
148
+ if (!isNaN(parsed.timestamp)) return parsed
149
+ }
150
+ const fallback = date(val)
151
+ return isNaN(fallback.timestamp) ? undefined : fallback
152
+ }
153
+ return undefined
154
+ }
155
+
133
156
  watch(
134
157
  () => props.modelValue,
135
158
  (val) => {
136
159
  if (isUserActive()) return
137
- if (val?.length === 2) {
138
- currentRangeDate.value = [date(val[0]), date(val[1])]
139
- } else {
140
- currentRangeDate.value = undefined
160
+ if (val && val.length === 2) {
161
+ const d1 = parseDateValue(val[0])
162
+ const d2 = parseDateValue(val[1])
163
+ if (d1 && d2) {
164
+ currentRangeDate.value = [d1, d2]
165
+ return
166
+ }
141
167
  }
168
+ currentRangeDate.value = undefined
142
169
  },
143
170
  { immediate: true }
144
171
  )
145
172
 
146
- const commitSelectedRange = userAction((rangeDate: [Dater, Dater] | undefined) => {
173
+ function formatDateValue(d: Dater) {
174
+ if (props.dataType === 'date') {
175
+ return d.raw
176
+ }
177
+ if (props.dataType === 'timestamp') {
178
+ return d.timestamp
179
+ }
180
+ return d.format(props.valueFormat ?? formatStr.value)
181
+ }
182
+
183
+ function formatModelValue(range: [Dater, Dater]): DateRangeValue {
184
+ return [formatDateValue(range[0]), formatDateValue(range[1])] as DateRangeValue
185
+ }
186
+
187
+ const commitSelectedRange = userAction((rangeDate: [Dater, Dater]) => {
147
188
  currentRangeDate.value = rangeDate
148
- emit('update:modelValue', rangeDate?.map((d) => d.format(formatStr.value)) as [string, string])
189
+ emit('update:modelValue', formatModelValue(rangeDate))
190
+ emit('change', [rangeDate[0].raw, rangeDate[1].raw])
149
191
  })
150
192
 
151
193
  async function handleSelect(rangeDate: [Dater, Dater] | undefined) {
194
+ if (!rangeDate) return
152
195
  await commitSelectedRange(rangeDate)
153
196
  dropdownRef.value?.close()
154
197
  }
@@ -158,5 +201,6 @@ const hovered = shallowRef(false)
158
201
  function handleClear() {
159
202
  currentRangeDate.value = undefined
160
203
  emit('update:modelValue', undefined)
204
+ emit('change', undefined)
161
205
  }
162
206
  </script>
@@ -1,9 +1,15 @@
1
1
  import type { Dater } from '@cat-kit/core'
2
2
  import type { DeconstructValue, FormComponentProps } from '@veltra/utils'
3
3
 
4
+ /** 绑定值类型 */
5
+ export type DateRangePickerDataType = 'date' | 'timestamp' | 'string'
6
+
7
+ /** 日期范围绑定值 */
8
+ export type DateRangeValue = [string, string] | [number, number] | [Date, Date]
9
+
4
10
  /** date-range-picker组件属性 */
5
11
  export interface DateRangePickerProps extends FormComponentProps {
6
- modelValue?: [string, string]
12
+ modelValue?: DateRangeValue
7
13
  /** 占位 */
8
14
  placeholder?: [string, string]
9
15
  /** 日期类型 */
@@ -12,6 +18,11 @@ export interface DateRangePickerProps extends FormComponentProps {
12
18
  format?: string
13
19
  /** 日期值格式化, 当没有指定时默认使用format属性,仅当值和显示的内容不一致时才需要使用到该属性 */
14
20
  valueFormat?: string
21
+ /**
22
+ * 绑定值的类型,默认为字符串。
23
+ * 当 dataType 没有指定为字符串时,valueFormat 属性不生效
24
+ */
25
+ dataType?: DateRangePickerDataType
15
26
  /** 最小可选日期 */
16
27
  disabledDate?: (date: Dater, raw: Date) => boolean
17
28
  /** 是否显示清除按钮 */
@@ -20,7 +31,8 @@ export interface DateRangePickerProps extends FormComponentProps {
20
31
 
21
32
  /** date-range-picker组件定义的事件 */
22
33
  export interface DateRangePickerEmits {
23
- (e: 'update:modelValue', value?: [string, string]): void
34
+ (e: 'update:modelValue', value?: DateRangeValue): void
35
+ (e: 'change', dates?: [Date, Date]): void
24
36
  }
25
37
 
26
38
  /** date-range-picker组件暴露的属性和方法(组件内部使用) */