zartui 3.1.2 → 3.1.4

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.
Files changed (60) hide show
  1. package/README.md +25 -0
  2. package/es/cascader/index.css +1 -1
  3. package/es/date-time-picker/DateTimePickerWrapper.mjs +6 -4
  4. package/es/date-time-picker/utils.d.ts +1 -0
  5. package/es/date-time-picker/utils.mjs +11 -1
  6. package/es/index.d.ts +2 -1
  7. package/es/index.mjs +4 -1
  8. package/es/lazyload/vue-lazyload/index.d.ts +55 -55
  9. package/es/radio-picker/RadioPicker.d.ts +207 -0
  10. package/es/radio-picker/RadioPicker.mjs +290 -0
  11. package/es/radio-picker/RadioPickerColumn.d.ts +70 -0
  12. package/es/radio-picker/RadioPickerColumn.mjs +237 -0
  13. package/es/radio-picker/RadioPickerToolbar.d.ts +18 -0
  14. package/es/radio-picker/RadioPickerToolbar.mjs +54 -0
  15. package/es/radio-picker/index.css +1 -0
  16. package/es/radio-picker/index.d.ts +136 -0
  17. package/es/radio-picker/index.mjs +10 -0
  18. package/es/radio-picker/style/index.d.ts +1 -0
  19. package/es/radio-picker/style/index.mjs +16 -0
  20. package/es/radio-picker/types.d.ts +44 -0
  21. package/es/radio-picker/types.mjs +0 -0
  22. package/es/radio-picker/utils.d.ts +13 -0
  23. package/es/radio-picker/utils.mjs +80 -0
  24. package/es/utils/debounce.d.ts +46 -0
  25. package/es/utils/debounce.mjs +65 -0
  26. package/es/vue-sfc-shim.d.ts +6 -6
  27. package/es/vue-tsx-shim.d.ts +23 -23
  28. package/lib/cascader/index.css +1 -1
  29. package/lib/date-time-picker/DateTimePickerWrapper.js +5 -3
  30. package/lib/date-time-picker/utils.d.ts +1 -0
  31. package/lib/date-time-picker/utils.js +10 -0
  32. package/lib/index.css +1 -1
  33. package/lib/index.d.ts +2 -1
  34. package/lib/index.js +4 -1
  35. package/lib/lazyload/vue-lazyload/index.d.ts +55 -55
  36. package/lib/radio-picker/RadioPicker.d.ts +207 -0
  37. package/lib/radio-picker/RadioPicker.js +319 -0
  38. package/lib/radio-picker/RadioPickerColumn.d.ts +70 -0
  39. package/lib/radio-picker/RadioPickerColumn.js +266 -0
  40. package/lib/radio-picker/RadioPickerToolbar.d.ts +18 -0
  41. package/lib/radio-picker/RadioPickerToolbar.js +73 -0
  42. package/lib/radio-picker/index.css +1 -0
  43. package/lib/radio-picker/index.d.ts +136 -0
  44. package/lib/radio-picker/index.js +39 -0
  45. package/lib/radio-picker/style/index.d.ts +1 -0
  46. package/lib/radio-picker/style/index.js +16 -0
  47. package/lib/radio-picker/types.d.ts +44 -0
  48. package/lib/radio-picker/types.js +15 -0
  49. package/lib/radio-picker/utils.d.ts +13 -0
  50. package/lib/radio-picker/utils.js +99 -0
  51. package/lib/utils/debounce.d.ts +46 -0
  52. package/lib/utils/debounce.js +84 -0
  53. package/lib/vue-sfc-shim.d.ts +6 -6
  54. package/lib/vue-tsx-shim.d.ts +23 -23
  55. package/lib/web-types.json +1 -1
  56. package/lib/zartui.cjs.js +1676 -999
  57. package/lib/zartui.es.js +1676 -999
  58. package/lib/zartui.js +1682 -1005
  59. package/lib/zartui.min.js +1 -1
  60. package/package.json +67 -67
@@ -0,0 +1,136 @@
1
+ import { RadioPickerProps } from './RadioPicker';
2
+ export declare const RadioPicker: import("../utils").WithInstall<import("vue").DefineComponent<{
3
+ loading: BooleanConstructor;
4
+ readonly: BooleanConstructor;
5
+ allowHtml: BooleanConstructor;
6
+ showToolbar: {
7
+ type: BooleanConstructor;
8
+ default: true;
9
+ };
10
+ showTitle: {
11
+ type: BooleanConstructor;
12
+ default: true;
13
+ };
14
+ swipeDuration: {
15
+ type: (NumberConstructor | StringConstructor)[];
16
+ default: number;
17
+ };
18
+ title: {
19
+ type: import("vue").PropType<string>;
20
+ default: string;
21
+ };
22
+ } & {
23
+ cancelButtonText: StringConstructor;
24
+ confirmButtonText: StringConstructor;
25
+ } & {
26
+ columns: {
27
+ type: import("vue").PropType<(import("./types").PickerColumn | import("./types").RadioPickerOption)[]>;
28
+ default: () => (import("./types").PickerColumn | import("./types").RadioPickerOption)[];
29
+ };
30
+ modelValue: {
31
+ type: import("vue").PropType<import("../utils").Numeric[]>;
32
+ default: () => import("../utils").Numeric[];
33
+ };
34
+ columnsFieldNames: import("vue").PropType<import("./types").PickerFieldNames>;
35
+ wrapHeight: {
36
+ type: (NumberConstructor | StringConstructor)[];
37
+ default: string;
38
+ };
39
+ showPicker: BooleanConstructor;
40
+ popup: {
41
+ type: BooleanConstructor;
42
+ default: true;
43
+ };
44
+ searchable: BooleanConstructor;
45
+ autoSearch: {
46
+ type: BooleanConstructor;
47
+ default: true;
48
+ };
49
+ searchPlaceholder: {
50
+ type: import("vue").PropType<string>;
51
+ default: string;
52
+ };
53
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm" | "clickOption" | "update:showPicker")[], "update:modelValue" | "cancel" | "change" | "confirm" | "clickOption" | "update:showPicker", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
54
+ loading: BooleanConstructor;
55
+ readonly: BooleanConstructor;
56
+ allowHtml: BooleanConstructor;
57
+ showToolbar: {
58
+ type: BooleanConstructor;
59
+ default: true;
60
+ };
61
+ showTitle: {
62
+ type: BooleanConstructor;
63
+ default: true;
64
+ };
65
+ swipeDuration: {
66
+ type: (NumberConstructor | StringConstructor)[];
67
+ default: number;
68
+ };
69
+ title: {
70
+ type: import("vue").PropType<string>;
71
+ default: string;
72
+ };
73
+ } & {
74
+ cancelButtonText: StringConstructor;
75
+ confirmButtonText: StringConstructor;
76
+ } & {
77
+ columns: {
78
+ type: import("vue").PropType<(import("./types").PickerColumn | import("./types").RadioPickerOption)[]>;
79
+ default: () => (import("./types").PickerColumn | import("./types").RadioPickerOption)[];
80
+ };
81
+ modelValue: {
82
+ type: import("vue").PropType<import("../utils").Numeric[]>;
83
+ default: () => import("../utils").Numeric[];
84
+ };
85
+ columnsFieldNames: import("vue").PropType<import("./types").PickerFieldNames>;
86
+ wrapHeight: {
87
+ type: (NumberConstructor | StringConstructor)[];
88
+ default: string;
89
+ };
90
+ showPicker: BooleanConstructor;
91
+ popup: {
92
+ type: BooleanConstructor;
93
+ default: true;
94
+ };
95
+ searchable: BooleanConstructor;
96
+ autoSearch: {
97
+ type: BooleanConstructor;
98
+ default: true;
99
+ };
100
+ searchPlaceholder: {
101
+ type: import("vue").PropType<string>;
102
+ default: string;
103
+ };
104
+ }>> & {
105
+ onChange?: ((...args: any[]) => any) | undefined;
106
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
107
+ onCancel?: ((...args: any[]) => any) | undefined;
108
+ onConfirm?: ((...args: any[]) => any) | undefined;
109
+ onClickOption?: ((...args: any[]) => any) | undefined;
110
+ "onUpdate:showPicker"?: ((...args: any[]) => any) | undefined;
111
+ }, {
112
+ title: string;
113
+ modelValue: import("../utils").Numeric[];
114
+ readonly: boolean;
115
+ popup: boolean;
116
+ loading: boolean;
117
+ showTitle: boolean;
118
+ columns: (import("./types").PickerColumn | import("./types").RadioPickerOption)[];
119
+ allowHtml: boolean;
120
+ showToolbar: boolean;
121
+ swipeDuration: string | number;
122
+ showPicker: boolean;
123
+ wrapHeight: string | number;
124
+ searchable: boolean;
125
+ autoSearch: boolean;
126
+ searchPlaceholder: string;
127
+ }, {}>>;
128
+ export default RadioPicker;
129
+ export { radioPickerProps } from './RadioPicker';
130
+ export type { PickerCancelEventParams as RadioPickerCancelEventParams, PickerChangeEventParams as RadioPickerChangeEventParams, PickerColumn as RadioPickerColumn, PickerConfirmEventParams as RadioPickerConfirmEventParams, PickerFieldNames as RadioPickerFieldNames, RadioPickerInstance, RadioPickerOption, PickerToolbarPosition as RadioPickerToolbarPosition, } from './types';
131
+ export type { RadioPickerProps };
132
+ declare module 'vue' {
133
+ interface GlobalComponents {
134
+ ZtRadioPicker: typeof RadioPicker;
135
+ }
136
+ }
@@ -0,0 +1,10 @@
1
+ import { withInstall } from "../utils/index.mjs";
2
+ import _RadioPicker from "./RadioPicker.mjs";
3
+ const RadioPicker = withInstall(_RadioPicker);
4
+ var stdin_default = RadioPicker;
5
+ import { radioPickerProps } from "./RadioPicker.mjs";
6
+ export {
7
+ RadioPicker,
8
+ stdin_default as default,
9
+ radioPickerProps
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import "../../style/base.css";
2
+ import "../../badge/index.css";
3
+ import "../../icon/index.css";
4
+ import "../../cell/index.css";
5
+ import "../../field/index.css";
6
+ import "../../search/index.css";
7
+ import "../../overlay/index.css";
8
+ import "../../popup/index.css";
9
+ import "../../loading/index.css";
10
+ import "../../button/index.css";
11
+ import "../../divider/index.css";
12
+ import "../../checkbox/index.css";
13
+ import "../../empty/index.css";
14
+ import "../../radio-group/index.css";
15
+ import "../../radio/index.css";
16
+ import "../index.css";
@@ -0,0 +1,44 @@
1
+ import type { ComponentPublicInstance } from 'vue';
2
+ import type { Numeric } from '../utils';
3
+ import type { RadioPickerProps } from './RadioPicker';
4
+ export type PickerToolbarPosition = 'top' | 'bottom';
5
+ export type PickerFieldNames = {
6
+ text?: string;
7
+ value?: string;
8
+ children?: string;
9
+ };
10
+ export type RadioPickerOption = {
11
+ text?: Numeric;
12
+ value?: Numeric;
13
+ disabled?: boolean;
14
+ children?: PickerColumn;
15
+ className?: unknown;
16
+ [key: PropertyKey]: any;
17
+ };
18
+ export type PickerColumn = RadioPickerOption[];
19
+ export type PickerExpose = {
20
+ confirm: () => void;
21
+ getSelectedOptions: () => Array<RadioPickerOption | undefined>;
22
+ };
23
+ export type PickerColumnProvide = {
24
+ state: {
25
+ index: number;
26
+ offset: number;
27
+ duration: number;
28
+ options: RadioPickerOption[];
29
+ };
30
+ setIndex: (index: number, emitChange?: boolean | undefined) => void;
31
+ getValue: () => RadioPickerOption;
32
+ setValue: (value: string) => void;
33
+ setOptions: (options: RadioPickerOption[]) => void;
34
+ stopMomentum: () => void;
35
+ };
36
+ export type RadioPickerInstance = ComponentPublicInstance<RadioPickerProps, PickerExpose>;
37
+ export type PickerConfirmEventParams = {
38
+ selectedValues: Numeric[];
39
+ selectedOptions: Array<RadioPickerOption | undefined>;
40
+ };
41
+ export type PickerCancelEventParams = PickerConfirmEventParams;
42
+ export type PickerChangeEventParams = PickerConfirmEventParams & {
43
+ columnIndex: number;
44
+ };
File without changes
@@ -0,0 +1,13 @@
1
+ import type { Ref } from 'vue';
2
+ import type { Numeric } from '../utils';
3
+ import type { PickerColumn, PickerFieldNames, RadioPickerOption } from './types';
4
+ declare const name: string, bem: (el?: import("../utils").Mods | undefined, mods?: import("../utils").Mods | undefined) => import("../utils").Mods, t: (path: string, ...args: unknown[]) => any;
5
+ export { bem, name, t };
6
+ export declare const getFirstEnabledOption: (options: RadioPickerOption[]) => RadioPickerOption | undefined;
7
+ export declare function getColumnsType(columns: PickerColumn | PickerColumn[], fields: Required<PickerFieldNames>): "default" | "multiple" | "cascade";
8
+ export declare function findIndexOfEnabledOption(options: RadioPickerOption[], index: number): number;
9
+ export declare const isOptionExist: (options: RadioPickerOption[], value: Numeric | undefined, fields: Required<PickerFieldNames>) => boolean;
10
+ export declare function findOptionByValue(options: RadioPickerOption[], value: Numeric, fields: Required<PickerFieldNames>): RadioPickerOption | undefined;
11
+ export declare function formatCascadeColumns(columns: PickerColumn | PickerColumn[], fields: Required<PickerFieldNames>, selectedValues: Ref<Numeric[]>): PickerColumn[];
12
+ export declare function getElementTranslateY(element: Element): number;
13
+ export declare function assignDefaultFields(fields: PickerFieldNames | undefined): Required<PickerFieldNames>;
@@ -0,0 +1,80 @@
1
+ import { clamp, createNamespace, extend, isDef } from "../utils/index.mjs";
2
+ const [name, bem, t] = createNamespace("radio-picker");
3
+ const getFirstEnabledOption = (options) => options.find((option) => !option.disabled) || options[0];
4
+ function getColumnsType(columns, fields) {
5
+ const firstColumn = columns[0];
6
+ if (firstColumn) {
7
+ if (Array.isArray(firstColumn)) {
8
+ return "multiple";
9
+ }
10
+ if (fields.children in firstColumn) {
11
+ return "cascade";
12
+ }
13
+ }
14
+ return "default";
15
+ }
16
+ function findIndexOfEnabledOption(options, index) {
17
+ index = clamp(index, 0, options.length);
18
+ for (let i = index; i < options.length; i++) {
19
+ if (!options[i].disabled)
20
+ return i;
21
+ }
22
+ for (let i = index - 1; i >= 0; i--) {
23
+ if (!options[i].disabled)
24
+ return i;
25
+ }
26
+ return 0;
27
+ }
28
+ const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
29
+ function findOptionByValue(options, value, fields) {
30
+ const index = options.findIndex((option) => option[fields.value] === value);
31
+ const enabledIndex = findIndexOfEnabledOption(options, index);
32
+ return options[enabledIndex];
33
+ }
34
+ function formatCascadeColumns(columns, fields, selectedValues) {
35
+ const formatted = [];
36
+ let cursor = {
37
+ [fields.children]: columns
38
+ };
39
+ let columnIndex = 0;
40
+ while (cursor && cursor[fields.children]) {
41
+ const options = cursor[fields.children];
42
+ const value = selectedValues.value[columnIndex];
43
+ cursor = isDef(value) ? findOptionByValue(options, value, fields) : void 0;
44
+ if (!cursor && options.length) {
45
+ const firstValue = getFirstEnabledOption(options)[fields.value];
46
+ cursor = findOptionByValue(options, firstValue, fields);
47
+ }
48
+ columnIndex++;
49
+ formatted.push(options);
50
+ }
51
+ return formatted;
52
+ }
53
+ function getElementTranslateY(element) {
54
+ const { transform } = window.getComputedStyle(element);
55
+ const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
56
+ return Number(translateY);
57
+ }
58
+ function assignDefaultFields(fields) {
59
+ return extend(
60
+ {
61
+ text: "text",
62
+ value: "value",
63
+ children: "children"
64
+ },
65
+ fields
66
+ );
67
+ }
68
+ export {
69
+ assignDefaultFields,
70
+ bem,
71
+ findIndexOfEnabledOption,
72
+ findOptionByValue,
73
+ formatCascadeColumns,
74
+ getColumnsType,
75
+ getElementTranslateY,
76
+ getFirstEnabledOption,
77
+ isOptionExist,
78
+ name,
79
+ t
80
+ };
@@ -0,0 +1,46 @@
1
+ import { Ref } from 'vue';
2
+ export interface FunctionWrapperOptions<Args extends any[] = any[], This = any> {
3
+ fn: FunctionArgs<Args, This>;
4
+ args: Args;
5
+ thisArg: This;
6
+ }
7
+ export type EventFilter<Args extends any[] = any[], This = any, Invoke extends AnyFn = AnyFn> = (invoke: Invoke, options: FunctionWrapperOptions<Args, This>) => ReturnType<Invoke> | Promise<ReturnType<Invoke>>;
8
+ export type AnyFn = (...args: any[]) => any;
9
+ export type MaybeRef<T> = T | Ref<T>;
10
+ export type FunctionArgs<Args extends any[] = any[], Return = void> = (...args: Args) => Return;
11
+ export type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T);
12
+ export type ArgumentsType<T> = T extends (...args: infer U) => any ? U : never;
13
+ export type PromisifyFn<T extends AnyFn> = (...args: ArgumentsType<T>) => Promise<ReturnType<T>>;
14
+ export interface DebounceFilterOptions {
15
+ /**
16
+ * The maximum time allowed to be delayed before it's invoked.
17
+ * In milliseconds.
18
+ */
19
+ maxWait?: MaybeRefOrGetter<number>;
20
+ /**
21
+ * Whether to reject the last call if it's been cancel.
22
+ *
23
+ * @default false
24
+ */
25
+ rejectOnCancel?: boolean;
26
+ }
27
+ /**
28
+ * Get the value of value/ref/getter.
29
+ */
30
+ export declare function toValue<T>(r: MaybeRefOrGetter<T>): T;
31
+ /**
32
+ * Create an EventFilter that debounce the events
33
+ */
34
+ export declare function debounceFilter(ms: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): EventFilter<any[], any, AnyFn>;
35
+ export declare function createFilterWrapper<T extends AnyFn>(filter: EventFilter, fn: T): (this: any, ...args: ArgumentsType<T>) => Promise<ReturnType<T>>;
36
+ /**
37
+ * Debounce execution of a function.
38
+ *
39
+ * @see https://vueuse.org/useDebounceFn
40
+ * @param fn A function to be executed after delay milliseconds debounced.
41
+ * @param ms A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
42
+ * @param opts options
43
+ *
44
+ * @return A new, debounce, function.
45
+ */
46
+ export declare function useDebounceFn<T extends FunctionArgs>(fn: T, ms?: MaybeRefOrGetter<number>, options?: DebounceFilterOptions): PromisifyFn<T>;
@@ -0,0 +1,65 @@
1
+ import { unref } from "vue";
2
+ import { noop } from "../utils/index.mjs";
3
+ function toValue(r) {
4
+ return typeof r === "function" ? r() : unref(r);
5
+ }
6
+ function debounceFilter(ms, options = {}) {
7
+ let timer;
8
+ let maxTimer;
9
+ let lastRejector = noop;
10
+ const _clearTimeout = (timer2) => {
11
+ clearTimeout(timer2);
12
+ lastRejector();
13
+ lastRejector = noop;
14
+ };
15
+ const filter = (invoke) => {
16
+ const duration = toValue(ms);
17
+ const maxDuration = toValue(options.maxWait);
18
+ if (timer)
19
+ _clearTimeout(timer);
20
+ if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
21
+ if (maxTimer) {
22
+ _clearTimeout(maxTimer);
23
+ maxTimer = null;
24
+ }
25
+ return Promise.resolve(invoke());
26
+ }
27
+ return new Promise((resolve, reject) => {
28
+ lastRejector = options.rejectOnCancel ? reject : resolve;
29
+ if (maxDuration && !maxTimer) {
30
+ maxTimer = setTimeout(() => {
31
+ if (timer)
32
+ _clearTimeout(timer);
33
+ maxTimer = null;
34
+ resolve(invoke());
35
+ }, maxDuration);
36
+ }
37
+ timer = setTimeout(() => {
38
+ if (maxTimer)
39
+ _clearTimeout(maxTimer);
40
+ maxTimer = null;
41
+ resolve(invoke());
42
+ }, duration);
43
+ });
44
+ };
45
+ return filter;
46
+ }
47
+ function createFilterWrapper(filter, fn) {
48
+ function wrapper(...args) {
49
+ return new Promise((resolve, reject) => {
50
+ Promise.resolve(
51
+ filter(() => fn.apply(this, args), { fn, thisArg: this, args })
52
+ ).then(resolve).catch(reject);
53
+ });
54
+ }
55
+ return wrapper;
56
+ }
57
+ function useDebounceFn(fn, ms = 200, options = {}) {
58
+ return createFilterWrapper(debounceFilter(ms, options), fn);
59
+ }
60
+ export {
61
+ createFilterWrapper,
62
+ debounceFilter,
63
+ toValue,
64
+ useDebounceFn
65
+ };
@@ -1,6 +1,6 @@
1
- declare module '*.vue' {
2
- // eslint-disable-next-line
3
- import { DefineComponent } from 'vue';
4
- const Component: DefineComponent;
5
- export default Component;
6
- }
1
+ declare module '*.vue' {
2
+ // eslint-disable-next-line
3
+ import { DefineComponent } from 'vue';
4
+ const Component: DefineComponent;
5
+ export default Component;
6
+ }
@@ -1,23 +1,23 @@
1
- import 'vue';
2
-
3
- type EventHandler = (...args: any[]) => void;
4
-
5
- declare module 'vue' {
6
- interface ComponentCustomProps {
7
- id?: string;
8
- role?: string;
9
- tabindex?: number;
10
- onClick?: EventHandler;
11
- onTouchend?: EventHandler;
12
- onTouchmove?: EventHandler;
13
- onTouchstart?: EventHandler;
14
- onTouchcancel?: EventHandler;
15
- onTouchmovePassive?: EventHandler;
16
- onTouchstartPassive?: EventHandler;
17
- }
18
-
19
- interface HTMLAttributes {
20
- onTouchmovePassive?: EventHandler;
21
- onTouchstartPassive?: EventHandler;
22
- }
23
- }
1
+ import 'vue';
2
+
3
+ type EventHandler = (...args: any[]) => void;
4
+
5
+ declare module 'vue' {
6
+ interface ComponentCustomProps {
7
+ id?: string;
8
+ role?: string;
9
+ tabindex?: number;
10
+ onClick?: EventHandler;
11
+ onTouchend?: EventHandler;
12
+ onTouchmove?: EventHandler;
13
+ onTouchstart?: EventHandler;
14
+ onTouchcancel?: EventHandler;
15
+ onTouchmovePassive?: EventHandler;
16
+ onTouchstartPassive?: EventHandler;
17
+ }
18
+
19
+ interface HTMLAttributes {
20
+ onTouchmovePassive?: EventHandler;
21
+ onTouchstartPassive?: EventHandler;
22
+ }
23
+ }
@@ -1 +1 @@
1
- :root{--zt-cascader-header-height: 44px;--zt-cascader-header-padding: 0 var(--zt-padding-sm);--zt-cascader-title-font-size: var(--zt-font-size-md);--zt-cascader-title-line-height: 44px;--zt-cascader-title-color: var(--zt-gray-a4);--zt-cascader-close-icon-size: 24px;--zt-cascader-close-icon-color: var(--zt-gray-5);--zt-cascader-selected-icon-size: 18px;--zt-cascader-tabs-height: 44px;--zt-cascader-active-color: var(--zt-primary-color);--zt-cascader-height: 75vh;--zt-cascader-option-disabled-color: var(--zt-text-color-3);--zt-cascader-tab-color: var(--zt-text-color);--zt-cascader-unselected-tab-color: var(--zt-gray-a4);--zt-cascader-tabs-margin: 0 8px;--zt-cascader-tabs-padding: 8px;--zt-cascader-tabs-line-height: 44px;--zt-cascader-option-disabled-active-color: rgba(0, 0, 0, .04);--zt-cascader-cancel-margin: 8px 16px;--zt-cascader-cancel-background: rgba(45, 75, 115, .04);--zt-cascader-cancel-width:calc(100% - 32px);--zt-cascader-cancel-border-radius: 20.5px}.zt-cascader{display:flex;justify-content:space-between;flex-direction:column;height:var(--zt-cascader-height)}.zt-cascader__header{display:flex;align-items:center;justify-content:center;flex-shrink:0;height:var(--zt-cascader-header-height);padding:var(--zt-cascader-header-padding)}.zt-cascader__title{font-size:var(--zt-cascader-title-font-size);line-height:var(--zt-cascader-title-line-height);color:var(--zt-cascader-title-color)}.zt-cascader__close-icon{color:var(--zt-cascader-close-icon-color);font-size:var(--zt-cascader-close-icon-size)}.zt-cascader__tabs{flex:1}.zt-cascader__tabs .zt-tab{flex:none;margin:var(--zt-cascader-tabs-margin);padding:0}.zt-cascader__tabs .zt-tabs__wrap{position:relative;height:var(--zt-cascader-tabs-height)}.zt-cascader__tabs .zt-tabs__wrap:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;right:0;bottom:0;left:0;border-bottom:1px solid var(--zt-border-color);transform:scaleY(.5)}.zt-cascader__tabs .zt-tabs__nav--complete{padding-right:var(--zt-cascader-tabs-padding);padding-left:var(--zt-cascader-tabs-padding)}.zt-cascader__tab{color:var(--zt-cascader-tab-color);font-weight:var(--zt-font-bold);line-height:var(--zt-cascader-tabs-line-height);font-size:var(--zt-font-size-md)}.zt-cascader__tab--unselected{color:var(--zt-cascader-unselected-tab-color);font-weight:400}.zt-cascader__option{display:flex;align-items:center;justify-content:space-between;color:var(--zt-text-color);padding:0 var(--zt-padding-md);font-size:var(--zt-font-size-md);line-height:var(--zt-cascader-tabs-line-height);cursor:pointer;font-weight:400}.zt-cascader__option:active{background-color:var(--zt-active-color)}.zt-cascader__option--selected{color:var(--zt-cascader-active-color);font-weight:var(--zt-font-bold)}.zt-cascader__option--disabled{color:var(--zt-cascader-option-disabled-color);cursor:not-allowed}.zt-cascader__option--disabled:active{background-color:var(--zt-cascader-option-disabled-active-color)}.zt-cascader__selected-icon{font-size:var(--zt-cascader-selected-icon-size)}.zt-cascader__options{box-sizing:border-box;overflow-y:auto;-webkit-overflow-scrolling:touch}.zt-cascader .zt-tabs__nav{background:var(--zt-background-2)}.zt-cascader__cancel{margin:var(--zt-cascader-cancel-margin);width:var(--zt-cascader-cancel-width);background:var(--zt-cascader-cancel-background);border-radius:var(--zt-cascader-cancel-border-radius);color:var(--zt-text-color);border:0}.zt-theme-dark{--zt-cascader-cancel-background: var(--zt-background-card)}
1
+ :root{--zt-cascader-header-height: 44px;--zt-cascader-header-padding: 0 var(--zt-padding-sm);--zt-cascader-title-font-size: var(--zt-font-size-md);--zt-cascader-title-line-height: 44px;--zt-cascader-title-color: var(--zt-gray-a4);--zt-cascader-close-icon-size: 24px;--zt-cascader-close-icon-color: var(--zt-gray-5);--zt-cascader-selected-icon-size: 18px;--zt-cascader-tabs-height: 44px;--zt-cascader-active-color: var(--zt-primary-color);--zt-cascader-height: 75vh;--zt-cascader-option-disabled-color: var(--zt-text-color-3);--zt-cascader-tab-color: var(--zt-text-color);--zt-cascader-unselected-tab-color: var(--zt-gray-a4);--zt-cascader-tabs-margin: 0 8px;--zt-cascader-tabs-padding: 8px;--zt-cascader-tabs-line-height: 44px;--zt-cascader-option-disabled-active-color: rgba(0, 0, 0, .04);--zt-cascader-cancel-margin: 8px 16px;--zt-cascader-cancel-background: rgba(45, 75, 115, .04);--zt-cascader-cancel-width:calc(100% - 32px);--zt-cascader-cancel-border-radius: 20.5px}.zt-cascader{display:flex;justify-content:space-between;flex-direction:column;height:var(--zt-cascader-height)}.zt-cascader__header{display:flex;align-items:center;justify-content:center;flex-shrink:0;height:var(--zt-cascader-header-height);padding:var(--zt-cascader-header-padding)}.zt-cascader__title{font-size:var(--zt-cascader-title-font-size);line-height:var(--zt-cascader-title-line-height);color:var(--zt-cascader-title-color)}.zt-cascader__close-icon{color:var(--zt-cascader-close-icon-color);font-size:var(--zt-cascader-close-icon-size)}.zt-cascader__tabs{flex:1;min-height:0}.zt-cascader__tabs .zt-tab{flex:none;margin:var(--zt-cascader-tabs-margin);padding:0}.zt-cascader__tabs .zt-tabs__wrap{position:relative;height:var(--zt-cascader-tabs-height)}.zt-cascader__tabs .zt-tabs__wrap:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;right:0;bottom:0;left:0;border-bottom:1px solid var(--zt-border-color);transform:scaleY(.5)}.zt-cascader__tabs .zt-tabs__nav--complete{padding-right:var(--zt-cascader-tabs-padding);padding-left:var(--zt-cascader-tabs-padding)}.zt-cascader__tabs .zt-tabs__content{height:calc(100% - var(--zt-cascader-tabs-height))}.zt-cascader__tabs .zt-tab__panel{height:100%}.zt-cascader__tab{color:var(--zt-cascader-tab-color);font-weight:var(--zt-font-bold);line-height:var(--zt-cascader-tabs-line-height);font-size:var(--zt-font-size-md)}.zt-cascader__tab--unselected{color:var(--zt-cascader-unselected-tab-color);font-weight:400}.zt-cascader__option{display:flex;align-items:center;justify-content:space-between;color:var(--zt-text-color);padding:0 var(--zt-padding-md);font-size:var(--zt-font-size-md);line-height:var(--zt-cascader-tabs-line-height);cursor:pointer;font-weight:400}.zt-cascader__option:active{background-color:var(--zt-active-color)}.zt-cascader__option--selected{color:var(--zt-cascader-active-color);font-weight:var(--zt-font-bold)}.zt-cascader__option--disabled{color:var(--zt-cascader-option-disabled-color);cursor:not-allowed}.zt-cascader__option--disabled:active{background-color:var(--zt-cascader-option-disabled-active-color)}.zt-cascader__selected-icon{font-size:var(--zt-cascader-selected-icon-size)}.zt-cascader__options{height:100%;box-sizing:border-box;overflow-y:auto;-webkit-overflow-scrolling:touch}.zt-cascader .zt-tabs__nav{background:var(--zt-background-2)}.zt-cascader__cancel{margin:var(--zt-cascader-cancel-margin);width:var(--zt-cascader-cancel-width);background:var(--zt-cascader-cancel-background);border-radius:var(--zt-cascader-cancel-border-radius);color:var(--zt-text-color);border:0}.zt-theme-dark{--zt-cascader-cancel-background: var(--zt-background-card)}
@@ -211,10 +211,12 @@ var stdin_default = (0, import_vue2.defineComponent)({
211
211
  });
212
212
  return result;
213
213
  });
214
- (0, import_vue2.watch)(dateValuesRef, (newValues) => {
214
+ (0, import_vue2.watch)(dateValuesRef, (newValues, oldValues) => {
215
215
  const date = parseDateValues(props.modelValue);
216
- if (!(0, import_utils.isSameValue)(newValues, date)) {
217
- currentValuesRef.value = genResult(newValues, timeValuesRef.value);
216
+ if (!(0, import_utils.isSameValue)(newValues, date) && !(0, import_utils.isSameValue)(newValues, oldValues)) {
217
+ const formatRangeNewValues = (0, import_utils2.formatValueRange)(newValues, dateColumns.value);
218
+ currentValuesRef.value = genResult(formatRangeNewValues, timeValuesRef.value);
219
+ dateValuesRef.value = formatRangeNewValues;
218
220
  }
219
221
  });
220
222
  (0, import_vue2.watch)(timeValuesRef, (newValues) => {
@@ -50,4 +50,5 @@ export declare const pickerInheritKeys: ("title" | "readonly" | "loading" | "sho
50
50
  export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
51
51
  export declare const getMonthEndDay: (year: number, month: number) => number;
52
52
  export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter?: Filter) => PickerOption[];
53
+ export declare const formatValueRange: (values: string[], columns: PickerOption[][]) => string[];
53
54
  export {};
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var stdin_exports = {};
19
19
  __export(stdin_exports, {
20
+ formatValueRange: () => formatValueRange,
20
21
  genOptions: () => genOptions,
21
22
  getMonthEndDay: () => getMonthEndDay,
22
23
  pickerInheritKeys: () => pickerInheritKeys,
@@ -59,3 +60,12 @@ const genOptions = (min, max, type, formatter, filter) => {
59
60
  });
60
61
  return filter ? filter(type, options) : options;
61
62
  };
63
+ const formatValueRange = (values, columns) => values.map((value, index) => {
64
+ const column = columns[index];
65
+ if (column.length) {
66
+ const minValue = +column[0].value;
67
+ const maxValue = +column[column.length - 1].value;
68
+ return (0, import_utils.padZero)((0, import_utils.clamp)(+value, minValue, maxValue));
69
+ }
70
+ return value;
71
+ });