@sdata/web-vue 2.2.1 → 2.3.1
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.
- package/es/_components/picker/input-range.vue.d.ts +2 -2
- package/es/_utils/date.d.ts +10 -9
- package/es/_utils/date.js +23 -7
- package/es/anchor/anchor.vue.d.ts +52 -2
- package/es/anchor/anchor.vue_vue_type_script_setup_true_lang.js +75 -15
- package/es/anchor/index.d.ts +75 -0
- package/es/button/button.vue.d.ts +16 -3
- package/es/button/button.vue_vue_type_script_setup_true_lang.js +39 -9
- package/es/button/index.d.ts +19 -0
- package/es/button/interface.d.ts +1 -0
- package/es/config-provider/config-provider.vue.d.ts +9 -0
- package/es/config-provider/config-provider.vue_vue_type_script_setup_true_lang.js +10 -1
- package/es/config-provider/context.d.ts +1 -0
- package/es/config-provider/index.d.ts +15 -0
- package/es/copy/copy.vue_vue_type_script_setup_true_lang.js +1 -0
- package/es/date-picker/hooks/use-cell-class-name.d.ts +1 -0
- package/es/date-picker/hooks/use-cell-class-name.js +3 -2
- package/es/date-picker/hooks/use-header-value.d.ts +2 -0
- package/es/date-picker/hooks/use-header-value.js +23 -19
- package/es/date-picker/hooks/use-picker-state.d.ts +2 -0
- package/es/date-picker/hooks/use-picker-state.js +3 -3
- package/es/date-picker/hooks/use-range-header-value.d.ts +2 -0
- package/es/date-picker/hooks/use-range-header-value.js +5 -1
- package/es/date-picker/hooks/use-range-picker-state.d.ts +2 -0
- package/es/date-picker/hooks/use-range-picker-state.js +3 -3
- package/es/date-picker/hooks/use-value-format.d.ts +5 -3
- package/es/date-picker/hooks/use-value-format.js +10 -8
- package/es/date-picker/index.d.ts +1361 -0
- package/es/date-picker/interface.d.ts +7 -0
- package/es/date-picker/panels/body.vue.d.ts +24 -6
- package/es/date-picker/panels/body.vue_vue_type_script_setup_true_lang.js +13 -12
- package/es/date-picker/panels/date/index.vue.d.ts +26 -8
- package/es/date-picker/panels/date/index.vue_vue_type_script_setup_true_lang.js +18 -9
- package/es/date-picker/panels/header.vue_vue_type_script_setup_true_lang.js +13 -20
- package/es/date-picker/panels/month/index.vue.d.ts +13 -8
- package/es/date-picker/panels/month/index.vue_vue_type_script_setup_true_lang.js +6 -6
- package/es/date-picker/panels/quarter/index.vue.d.ts +13 -8
- package/es/date-picker/panels/quarter/index.vue_vue_type_script_setup_true_lang.js +6 -6
- package/es/date-picker/panels/shortcuts.vue_vue_type_script_setup_true_lang.js +2 -6
- package/es/date-picker/panels/week/index.vue.d.ts +13 -1
- package/es/date-picker/panels/week/index.vue_vue_type_script_setup_true_lang.js +5 -2
- package/es/date-picker/panels/year/index.vue.d.ts +13 -8
- package/es/date-picker/panels/year/index.vue_vue_type_script_setup_true_lang.js +25 -15
- package/es/date-picker/picker-panel.vue.d.ts +56 -14
- package/es/date-picker/picker-panel.vue_vue_type_script_setup_true_lang.js +36 -19
- package/es/date-picker/picker.vue.d.ts +949 -1
- package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +91 -29
- package/es/date-picker/range-picker-panel.vue.d.ts +77 -15
- package/es/date-picker/range-picker-panel.vue_vue_type_script_setup_true_lang.js +52 -28
- package/es/date-picker/range-picker.vue.d.ts +1345 -1
- package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +114 -34
- package/es/image/preview-toolbar.vue.d.ts +2 -3
- package/es/image/preview-toolbar.vue_vue_type_script_setup_true_lang.js +2 -3
- package/es/locale/interface.d.ts +2 -0
- package/es/locale/lang/ar-eg.js +46 -0
- package/es/locale/lang/de-de.js +46 -0
- package/es/locale/lang/es-es.js +46 -0
- package/es/locale/lang/fr-fr.js +46 -0
- package/es/locale/lang/id-id.js +46 -0
- package/es/locale/lang/it-it.js +46 -0
- package/es/locale/lang/km-kh.js +46 -0
- package/es/locale/lang/ko-kr.js +46 -0
- package/es/locale/lang/ms-my.js +46 -0
- package/es/locale/lang/pt-pt.js +46 -0
- package/es/locale/lang/th-th.js +46 -0
- package/es/locale/lang/vi-vn.js +46 -0
- package/es/mention/mention.js +2 -0
- package/es/menu/sub-menu-pop.vue_vue_type_script_setup_true_lang.js +3 -4
- package/es/modal/index.d.ts +7 -5
- package/es/modal/index.js +47 -11
- package/es/modal/interface.d.ts +5 -0
- package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/tree/base-node.vue_vue_type_script_setup_true_lang.js +6 -21
- package/es/tree/node-switcher.vue.d.ts +0 -11
- package/es/tree/node-switcher.vue_vue_type_script_lang.js +1 -5
- package/es/trigger/trigger.js +2 -1
- package/es/verification-code/verification-code.js +17 -7
- package/json/vetur-attributes.json +53 -0
- package/json/vetur-tags.json +14 -0
- package/json/web-types.json +113 -1
- package/package.json +1 -1
- package/es/_components/render-function.d.ts +0 -14
- package/es/_components/render-function.js +0 -14
package/es/button/index.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ declare const Button: {
|
|
|
24
24
|
type: BooleanConstructor;
|
|
25
25
|
default: boolean;
|
|
26
26
|
};
|
|
27
|
+
loadingFixedWidth: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
27
31
|
disabled: {
|
|
28
32
|
type: BooleanConstructor;
|
|
29
33
|
};
|
|
@@ -45,6 +49,7 @@ declare const Button: {
|
|
|
45
49
|
disabled: boolean;
|
|
46
50
|
loading: boolean;
|
|
47
51
|
long: boolean;
|
|
52
|
+
loadingFixedWidth: boolean;
|
|
48
53
|
htmlType: "reset" | "submit" | "button";
|
|
49
54
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
50
55
|
P: {};
|
|
@@ -74,6 +79,10 @@ declare const Button: {
|
|
|
74
79
|
type: BooleanConstructor;
|
|
75
80
|
default: boolean;
|
|
76
81
|
};
|
|
82
|
+
loadingFixedWidth: {
|
|
83
|
+
type: BooleanConstructor;
|
|
84
|
+
default: boolean;
|
|
85
|
+
};
|
|
77
86
|
disabled: {
|
|
78
87
|
type: BooleanConstructor;
|
|
79
88
|
};
|
|
@@ -93,6 +102,7 @@ declare const Button: {
|
|
|
93
102
|
disabled: boolean;
|
|
94
103
|
loading: boolean;
|
|
95
104
|
long: boolean;
|
|
105
|
+
loadingFixedWidth: boolean;
|
|
96
106
|
htmlType: "reset" | "submit" | "button";
|
|
97
107
|
}>;
|
|
98
108
|
__isFragment?: never;
|
|
@@ -119,6 +129,10 @@ declare const Button: {
|
|
|
119
129
|
type: BooleanConstructor;
|
|
120
130
|
default: boolean;
|
|
121
131
|
};
|
|
132
|
+
loadingFixedWidth: {
|
|
133
|
+
type: BooleanConstructor;
|
|
134
|
+
default: boolean;
|
|
135
|
+
};
|
|
122
136
|
disabled: {
|
|
123
137
|
type: BooleanConstructor;
|
|
124
138
|
};
|
|
@@ -140,16 +154,21 @@ declare const Button: {
|
|
|
140
154
|
disabled: boolean;
|
|
141
155
|
loading: boolean;
|
|
142
156
|
long: boolean;
|
|
157
|
+
loadingFixedWidth: boolean;
|
|
143
158
|
htmlType: "reset" | "submit" | "button";
|
|
144
159
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
145
160
|
$slots: {
|
|
146
161
|
icon?: (props: {}) => any;
|
|
147
162
|
} & {
|
|
148
163
|
default?: (props: {}) => any;
|
|
164
|
+
} & {
|
|
165
|
+
default?: (props: {}) => any;
|
|
149
166
|
} & {
|
|
150
167
|
icon?: (props: {}) => any;
|
|
151
168
|
} & {
|
|
152
169
|
default?: (props: {}) => any;
|
|
170
|
+
} & {
|
|
171
|
+
default?: (props: {}) => any;
|
|
153
172
|
};
|
|
154
173
|
}) & {
|
|
155
174
|
Group: {
|
package/es/button/interface.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
23
23
|
type: BooleanConstructor;
|
|
24
24
|
default: boolean;
|
|
25
25
|
};
|
|
26
|
+
autoInsertSpaceInButton: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
26
30
|
allowSearch: {
|
|
27
31
|
type: BooleanConstructor;
|
|
28
32
|
default: boolean;
|
|
@@ -83,6 +87,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
83
87
|
type: BooleanConstructor;
|
|
84
88
|
default: boolean;
|
|
85
89
|
};
|
|
90
|
+
autoInsertSpaceInButton: {
|
|
91
|
+
type: BooleanConstructor;
|
|
92
|
+
default: boolean;
|
|
93
|
+
};
|
|
86
94
|
allowSearch: {
|
|
87
95
|
type: BooleanConstructor;
|
|
88
96
|
default: boolean;
|
|
@@ -137,6 +145,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
137
145
|
allowSearch: boolean;
|
|
138
146
|
exchangeTime: boolean;
|
|
139
147
|
global: boolean;
|
|
148
|
+
autoInsertSpaceInButton: boolean;
|
|
140
149
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
141
150
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
142
151
|
declare const _default: typeof __VLS_export;
|
|
@@ -35,6 +35,14 @@ var config_provider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
35
35
|
default: false
|
|
36
36
|
},
|
|
37
37
|
/**
|
|
38
|
+
* @zh 当按钮中是两个汉字时,自动在两个汉字中添加一个空格。
|
|
39
|
+
* @en When there are two Chinese characters in the button, a space is automatically added between two Chinese characters.
|
|
40
|
+
*/
|
|
41
|
+
autoInsertSpaceInButton: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
38
46
|
* @zh 是否默认开启搜索
|
|
39
47
|
* @en Whether to enable search by default
|
|
40
48
|
*/
|
|
@@ -138,13 +146,14 @@ var config_provider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
138
146
|
* @version 2.28.0
|
|
139
147
|
*/
|
|
140
148
|
const slots = useSlots();
|
|
141
|
-
const { prefixCls, locale, size, allowClear, allowSearch, virtualListProps, updateAtScroll, scrollToClose, exchangeTime, rtl, datePicker, modal, drawer } = toRefs(props);
|
|
149
|
+
const { prefixCls, locale, size, allowClear, autoInsertSpaceInButton, allowSearch, virtualListProps, updateAtScroll, scrollToClose, exchangeTime, rtl, datePicker, modal, drawer } = toRefs(props);
|
|
142
150
|
const config = reactive({
|
|
143
151
|
slots,
|
|
144
152
|
prefixCls,
|
|
145
153
|
locale,
|
|
146
154
|
size,
|
|
147
155
|
allowClear,
|
|
156
|
+
autoInsertSpaceInButton,
|
|
148
157
|
allowSearch,
|
|
149
158
|
virtualListProps,
|
|
150
159
|
updateAtScroll,
|
|
@@ -17,6 +17,10 @@ declare const ConfigProvider: {
|
|
|
17
17
|
type: BooleanConstructor;
|
|
18
18
|
default: boolean;
|
|
19
19
|
};
|
|
20
|
+
autoInsertSpaceInButton: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
20
24
|
allowSearch: {
|
|
21
25
|
type: BooleanConstructor;
|
|
22
26
|
default: boolean;
|
|
@@ -71,6 +75,7 @@ declare const ConfigProvider: {
|
|
|
71
75
|
allowSearch: boolean;
|
|
72
76
|
exchangeTime: boolean;
|
|
73
77
|
global: boolean;
|
|
78
|
+
autoInsertSpaceInButton: boolean;
|
|
74
79
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
75
80
|
P: {};
|
|
76
81
|
B: {};
|
|
@@ -93,6 +98,10 @@ declare const ConfigProvider: {
|
|
|
93
98
|
type: BooleanConstructor;
|
|
94
99
|
default: boolean;
|
|
95
100
|
};
|
|
101
|
+
autoInsertSpaceInButton: {
|
|
102
|
+
type: BooleanConstructor;
|
|
103
|
+
default: boolean;
|
|
104
|
+
};
|
|
96
105
|
allowSearch: {
|
|
97
106
|
type: BooleanConstructor;
|
|
98
107
|
default: boolean;
|
|
@@ -147,6 +156,7 @@ declare const ConfigProvider: {
|
|
|
147
156
|
allowSearch: boolean;
|
|
148
157
|
exchangeTime: boolean;
|
|
149
158
|
global: boolean;
|
|
159
|
+
autoInsertSpaceInButton: boolean;
|
|
150
160
|
}>;
|
|
151
161
|
__isFragment?: never;
|
|
152
162
|
__isTeleport?: never;
|
|
@@ -166,6 +176,10 @@ declare const ConfigProvider: {
|
|
|
166
176
|
type: BooleanConstructor;
|
|
167
177
|
default: boolean;
|
|
168
178
|
};
|
|
179
|
+
autoInsertSpaceInButton: {
|
|
180
|
+
type: BooleanConstructor;
|
|
181
|
+
default: boolean;
|
|
182
|
+
};
|
|
169
183
|
allowSearch: {
|
|
170
184
|
type: BooleanConstructor;
|
|
171
185
|
default: boolean;
|
|
@@ -220,6 +234,7 @@ declare const ConfigProvider: {
|
|
|
220
234
|
allowSearch: boolean;
|
|
221
235
|
exchangeTime: boolean;
|
|
222
236
|
global: boolean;
|
|
237
|
+
autoInsertSpaceInButton: boolean;
|
|
223
238
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
224
239
|
$slots: {
|
|
225
240
|
default?: (props: {}) => any;
|
|
@@ -6,6 +6,7 @@ interface CellClassNameProps {
|
|
|
6
6
|
rangeValues?: Array<Dayjs | undefined>;
|
|
7
7
|
isSameTime: IsSameTime;
|
|
8
8
|
mode?: Mode;
|
|
9
|
+
now?: Dayjs;
|
|
9
10
|
}
|
|
10
11
|
export default function useCellClassName(props: CellClassNameProps): {
|
|
11
12
|
getCellClassName: (cellData: Cell, disabled: boolean) => (string | {
|
|
@@ -17,8 +17,9 @@ function useCellClassName(props) {
|
|
|
17
17
|
const { value, isSameTime, mode, prefixCls } = props;
|
|
18
18
|
const isInView = !cellData.isPrev && !cellData.isNext;
|
|
19
19
|
const isSelected = value && isSameTime(cellData.value, value);
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const currentNow = props.now || getNow();
|
|
21
|
+
let isToday = isSameTime(cellData.value, currentNow);
|
|
22
|
+
if (mode === "week") isToday = currentNow.isSame(cellData.value, "date");
|
|
22
23
|
const isRangeStart = isInView && rangeStart.value && isSameTime(cellData.value, rangeStart.value);
|
|
23
24
|
const isRangeEnd = isInView && rangeEnd.value && isSameTime(cellData.value, rangeEnd.value);
|
|
24
25
|
const isInRange = isInView && rangeStart.value && rangeEnd.value && (isRangeStart || isRangeEnd || cellData.value.isBetween(rangeStart.value, rangeEnd.value, null, "[]"));
|
|
@@ -3,16 +3,17 @@ import usePanelSpan from "./use-panel-span.js";
|
|
|
3
3
|
import { computed, reactive, ref, toRefs, watch } from "vue";
|
|
4
4
|
//#region components/date-picker/hooks/use-header-value.ts
|
|
5
5
|
function useHeaderValue(props) {
|
|
6
|
-
const { mode, value, defaultValue, selectedValue, format, onChange } = toRefs(props);
|
|
6
|
+
const { mode, value, defaultValue, selectedValue, format, utcOffset, timezone, onChange } = toRefs(props);
|
|
7
7
|
const computedMode = computed(() => (mode === null || mode === void 0 ? void 0 : mode.value) || "date");
|
|
8
|
+
const MIN_YEAR = 0;
|
|
8
9
|
const { span, superSpan } = usePanelSpan(reactive({ mode: computedMode }));
|
|
9
10
|
const isSame = (current, target) => {
|
|
10
11
|
const unit = computedMode.value === "date" || computedMode.value === "week" ? "M" : "y";
|
|
11
12
|
return current.isSame(target, unit);
|
|
12
13
|
};
|
|
13
|
-
const computedValue = computed(() => getDayjsValue(value === null || value === void 0 ? void 0 : value.value, format.value));
|
|
14
|
-
const computedDefaultValue = computed(() => getDayjsValue(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value, format.value));
|
|
15
|
-
const localValue = ref(computedDefaultValue.value || getNow());
|
|
14
|
+
const computedValue = computed(() => getDayjsValue(value === null || value === void 0 ? void 0 : value.value, format.value, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value));
|
|
15
|
+
const computedDefaultValue = computed(() => getDayjsValue(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value, format.value, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value));
|
|
16
|
+
const localValue = ref(computedDefaultValue.value || getNow(utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value));
|
|
16
17
|
const headerValue = computed(() => computedValue.value || localValue.value);
|
|
17
18
|
const setLocalValue = (newVal) => {
|
|
18
19
|
if (!newVal) return;
|
|
@@ -31,7 +32,7 @@ function useHeaderValue(props) {
|
|
|
31
32
|
setHeaderValue(newVal);
|
|
32
33
|
});
|
|
33
34
|
function getDefaultLocalValue() {
|
|
34
|
-
return (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.value) || computedDefaultValue.value || getNow();
|
|
35
|
+
return (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.value) || computedDefaultValue.value || getNow(utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value);
|
|
35
36
|
}
|
|
36
37
|
function resetHeaderValue(emitChange = true) {
|
|
37
38
|
const defaultLocalValue = getDefaultLocalValue();
|
|
@@ -39,23 +40,26 @@ function useHeaderValue(props) {
|
|
|
39
40
|
else setLocalValue(defaultLocalValue);
|
|
40
41
|
}
|
|
41
42
|
const showSingleBtn = computed(() => span.value !== superSpan.value);
|
|
43
|
+
const canMovePrev = (months) => methods.subtract(headerValue.value, months, "M").year() >= MIN_YEAR;
|
|
42
44
|
return {
|
|
43
45
|
headerValue,
|
|
44
46
|
setHeaderValue,
|
|
45
|
-
headerOperations: computed(() =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
headerOperations: computed(() => {
|
|
48
|
+
return {
|
|
49
|
+
onSuperPrev: canMovePrev(superSpan.value) ? () => {
|
|
50
|
+
setHeaderValue(methods.subtract(headerValue.value, superSpan.value, "M"));
|
|
51
|
+
} : void 0,
|
|
52
|
+
onPrev: showSingleBtn.value && canMovePrev(span.value) ? () => {
|
|
53
|
+
setHeaderValue(methods.subtract(headerValue.value, span.value, "M"));
|
|
54
|
+
} : void 0,
|
|
55
|
+
onNext: showSingleBtn.value ? () => {
|
|
56
|
+
setHeaderValue(methods.add(headerValue.value, span.value, "M"));
|
|
57
|
+
} : void 0,
|
|
58
|
+
onSuperNext: () => {
|
|
59
|
+
setHeaderValue(methods.add(headerValue.value, superSpan.value, "M"));
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
59
63
|
resetHeaderValue,
|
|
60
64
|
getDefaultLocalValue
|
|
61
65
|
};
|
|
@@ -4,6 +4,8 @@ interface PickerStateProps {
|
|
|
4
4
|
modelValue: CalendarValue | undefined;
|
|
5
5
|
defaultValue: CalendarValue | undefined;
|
|
6
6
|
format: string;
|
|
7
|
+
utcOffset?: number;
|
|
8
|
+
timezone?: string;
|
|
7
9
|
}
|
|
8
10
|
export default function usePickerState(props: PickerStateProps): {
|
|
9
11
|
value: import("vue").ComputedRef<Dayjs | undefined>;
|
|
@@ -4,12 +4,12 @@ import { getDayjsValue } from "../../_utils/date.js";
|
|
|
4
4
|
import { computed, toRefs, watch } from "vue";
|
|
5
5
|
//#region components/date-picker/hooks/use-picker-state.ts
|
|
6
6
|
function usePickerState(props) {
|
|
7
|
-
const { modelValue, defaultValue, format } = toRefs(props);
|
|
7
|
+
const { modelValue, defaultValue, format, utcOffset, timezone } = toRefs(props);
|
|
8
8
|
const computedModelValue = computed(() => {
|
|
9
|
-
return getDayjsValue(modelValue.value, format.value);
|
|
9
|
+
return getDayjsValue(modelValue.value, format.value, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value);
|
|
10
10
|
});
|
|
11
11
|
const computedDefaultValue = computed(() => {
|
|
12
|
-
return getDayjsValue(defaultValue.value, format.value);
|
|
12
|
+
return getDayjsValue(defaultValue.value, format.value, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value);
|
|
13
13
|
});
|
|
14
14
|
const [localValue, setLocalValue] = useState(!isUndefined(computedModelValue.value) ? computedModelValue.value : !isUndefined(computedDefaultValue.value) ? computedDefaultValue.value : void 0);
|
|
15
15
|
watch(computedModelValue, () => {
|
|
@@ -8,6 +8,8 @@ interface RangeHeaderValueProps {
|
|
|
8
8
|
defaultValue: CalendarValue[] | undefined;
|
|
9
9
|
selectedValue: (Dayjs | undefined)[];
|
|
10
10
|
format: string;
|
|
11
|
+
utcOffset?: number;
|
|
12
|
+
timezone?: string;
|
|
11
13
|
onChange?: (newVal: Dayjs[]) => void;
|
|
12
14
|
}
|
|
13
15
|
export default function useRangeHeaderValue(props: RangeHeaderValueProps): {
|
|
@@ -5,7 +5,7 @@ import useHeaderValue from "./use-header-value.js";
|
|
|
5
5
|
import { computed, nextTick, reactive, toRefs } from "vue";
|
|
6
6
|
//#region components/date-picker/hooks/use-range-header-value.ts
|
|
7
7
|
function useRangeHeaderValue(props) {
|
|
8
|
-
const { startHeaderMode, endHeaderMode, mode, value, defaultValue, selectedValue, format, onChange } = toRefs(props);
|
|
8
|
+
const { startHeaderMode, endHeaderMode, mode, value, defaultValue, selectedValue, format, utcOffset, timezone, onChange } = toRefs(props);
|
|
9
9
|
const isDateOrWeek = computed(() => ["date", "week"].includes(mode.value));
|
|
10
10
|
const unit = computed(() => isDateOrWeek.value ? "M" : "y");
|
|
11
11
|
const isSame = (current, target) => current.isSame(target, unit.value);
|
|
@@ -37,6 +37,8 @@ function useRangeHeaderValue(props) {
|
|
|
37
37
|
defaultValue: startDefaultValue,
|
|
38
38
|
selectedValue: void 0,
|
|
39
39
|
format,
|
|
40
|
+
utcOffset,
|
|
41
|
+
timezone,
|
|
40
42
|
onChange: (newVal) => {
|
|
41
43
|
emitChange([newVal, endHeaderValue.value]);
|
|
42
44
|
}
|
|
@@ -47,6 +49,8 @@ function useRangeHeaderValue(props) {
|
|
|
47
49
|
defaultValue: endDefaultValue,
|
|
48
50
|
selectedValue: void 0,
|
|
49
51
|
format,
|
|
52
|
+
utcOffset,
|
|
53
|
+
timezone,
|
|
50
54
|
onChange: (newVal) => {
|
|
51
55
|
emitChange([startHeaderValue.value, newVal]);
|
|
52
56
|
}
|
|
@@ -4,6 +4,8 @@ interface PickerStateProps {
|
|
|
4
4
|
modelValue: (CalendarValue | undefined)[] | undefined;
|
|
5
5
|
defaultValue: (CalendarValue | undefined)[] | undefined;
|
|
6
6
|
format: string;
|
|
7
|
+
utcOffset?: number;
|
|
8
|
+
timezone?: string;
|
|
7
9
|
}
|
|
8
10
|
export default function useRangePickerState(props: PickerStateProps): {
|
|
9
11
|
value: import("vue").ComputedRef<(Dayjs | undefined)[]>;
|
|
@@ -5,12 +5,12 @@ import { normalizeRangeValue } from "../utils/index.js";
|
|
|
5
5
|
import { computed, toRefs, watch } from "vue";
|
|
6
6
|
//#region components/date-picker/hooks/use-range-picker-state.ts
|
|
7
7
|
function useRangePickerState(props) {
|
|
8
|
-
const { modelValue, defaultValue, format } = toRefs(props);
|
|
8
|
+
const { modelValue, defaultValue, format, utcOffset, timezone } = toRefs(props);
|
|
9
9
|
const computedModelValue = computed(() => {
|
|
10
|
-
return getDayjsValue(normalizeRangeValue(modelValue.value), format.value);
|
|
10
|
+
return getDayjsValue(normalizeRangeValue(modelValue.value), format.value, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value);
|
|
11
11
|
});
|
|
12
12
|
const computedDefaultValue = computed(() => {
|
|
13
|
-
return getDayjsValue(normalizeRangeValue(defaultValue.value), format.value);
|
|
13
|
+
return getDayjsValue(normalizeRangeValue(defaultValue.value), format.value, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value);
|
|
14
14
|
});
|
|
15
15
|
const [localValue, setLocalValue] = useState(!isUndefined(computedModelValue.value) ? computedModelValue.value : !isUndefined(computedDefaultValue.value) ? computedDefaultValue.value : []);
|
|
16
16
|
watch(computedModelValue, () => {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
2
|
import { CalendarValue, ValueFormat } from '../interface';
|
|
3
|
-
export declare function getReturnValue(date: Dayjs, format: ValueFormat): string | number | Date;
|
|
3
|
+
export declare function getReturnValue(date: Dayjs, format: ValueFormat, utcOffset?: number, timezone?: string): string | number | Date;
|
|
4
4
|
export declare function useReturnValue(props: {
|
|
5
5
|
format: ValueFormat;
|
|
6
|
+
utcOffset?: number;
|
|
7
|
+
timezone?: string;
|
|
6
8
|
}): (date: Dayjs) => string | number | Date;
|
|
7
|
-
export declare function getReturnRangeValue(dates: Dayjs[], format: ValueFormat): CalendarValue[];
|
|
8
|
-
export declare function getReturnRangeValue(dates: (Dayjs | undefined)[], format: ValueFormat): (CalendarValue | undefined)[];
|
|
9
|
+
export declare function getReturnRangeValue(dates: Dayjs[], format: ValueFormat, utcOffset?: number, timezone?: string): CalendarValue[];
|
|
10
|
+
export declare function getReturnRangeValue(dates: (Dayjs | undefined)[], format: ValueFormat, utcOffset?: number, timezone?: string): (CalendarValue | undefined)[];
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { toLocal } from "../../_utils/date.js";
|
|
1
2
|
import { toRefs } from "vue";
|
|
2
3
|
//#region components/date-picker/hooks/use-value-format.ts
|
|
3
|
-
function getReturnValue(date, format) {
|
|
4
|
-
|
|
5
|
-
if (format === "
|
|
6
|
-
return
|
|
4
|
+
function getReturnValue(date, format, utcOffset, timezone) {
|
|
5
|
+
const localDate = toLocal(date, utcOffset, timezone);
|
|
6
|
+
if (format === "timestamp") return localDate.toDate().getTime();
|
|
7
|
+
if (format === "Date") return localDate.toDate();
|
|
8
|
+
return localDate.format(format);
|
|
7
9
|
}
|
|
8
10
|
function useReturnValue(props) {
|
|
9
|
-
const { format } = toRefs(props);
|
|
10
|
-
return (date) => getReturnValue(date, format.value);
|
|
11
|
+
const { format, utcOffset, timezone } = toRefs(props);
|
|
12
|
+
return (date) => getReturnValue(date, format.value, utcOffset === null || utcOffset === void 0 ? void 0 : utcOffset.value, timezone === null || timezone === void 0 ? void 0 : timezone.value);
|
|
11
13
|
}
|
|
12
|
-
function getReturnRangeValue(dates, format) {
|
|
13
|
-
return dates.map((date) => date ? getReturnValue(date, format) : void 0);
|
|
14
|
+
function getReturnRangeValue(dates, format, utcOffset, timezone) {
|
|
15
|
+
return dates.map((date) => date ? getReturnValue(date, format, utcOffset, timezone) : void 0);
|
|
14
16
|
}
|
|
15
17
|
//#endregion
|
|
16
18
|
export { getReturnRangeValue, useReturnValue };
|