@uzum-tech/ui 2.0.0-beta.1 → 2.0.0-beta.3
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/dist/index.js +136 -75
- package/dist/index.mjs +137 -76
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/calendar/src/Calendar.d.ts +3 -0
- package/es/calendar/src/Calendar.mjs +4 -3
- package/es/checkbox/src/Checkbox.mjs +4 -4
- package/es/collapse/src/CollapseItem.mjs +5 -5
- package/es/config-provider/src/ConfigProvider.d.ts +3 -0
- package/es/config-provider/src/ConfigProvider.mjs +26 -12
- package/es/config-provider/src/internal-interface.d.ts +1 -0
- package/es/data-table/src/DataTable.mjs +3 -3
- package/es/date-picker/src/DatePicker.d.ts +3 -0
- package/es/date-picker/src/DatePicker.mjs +2 -0
- package/es/date-picker/src/panel/date.d.ts +2 -0
- package/es/date-picker/src/panel/daterange.d.ts +2 -0
- package/es/date-picker/src/panel/datetime.d.ts +2 -0
- package/es/date-picker/src/panel/datetimerange.d.ts +2 -0
- package/es/date-picker/src/panel/panelMonth.d.ts +4 -0
- package/es/date-picker/src/panel/panelMonthContent.d.ts +2 -0
- package/es/date-picker/src/panel/panelYear.d.ts +4 -0
- package/es/date-picker/src/panel/panelYearContent.d.ts +2 -0
- package/es/date-picker/src/panel/use-calendar.d.ts +1 -0
- package/es/date-picker/src/panel/use-calendar.mjs +10 -5
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +1 -0
- package/es/date-picker/src/panel/use-dual-calendar.mjs +17 -13
- package/es/date-picker/src/panel/use-panel-common.d.ts +1 -0
- package/es/date-picker/src/panel/use-panel-common.mjs +1 -0
- package/es/date-picker/src/utils.d.ts +4 -4
- package/es/date-picker/src/utils.mjs +4 -4
- package/es/date-picker-v2/src/panel/CalendarPanel.d.ts +0 -1
- package/es/date-picker-v2/src/panel/CalendarPanel.mjs +7 -5
- package/es/date-picker-v2/src/panel/CalendarRangePanel.d.ts +0 -1
- package/es/date-picker-v2/src/panel/CalendarRangePanel.mjs +7 -5
- package/es/date-picker-v2/src/utils.d.ts +1 -1
- package/es/date-picker-v2/src/utils.mjs +1 -1
- package/es/dialog/src/DialogProvider.mjs +4 -3
- package/es/dynamic-input/src/DynamicInput.mjs +9 -7
- package/es/form/src/FormItem.mjs +6 -4
- package/es/grid/src/Grid.mjs +7 -1
- package/es/header/src/HeaderNavigation.d.ts +3 -3292
- package/es/header/src/HeaderNavigation.mjs +3 -2
- package/es/heatmap/src/Heatmap.mjs +4 -3
- package/es/image/src/Image.mjs +3 -4
- package/es/image/src/ImageGroup.d.ts +1 -1
- package/es/image/src/ImageGroup.mjs +5 -6
- package/es/menu/src/Menu.mjs +2 -3
- package/es/message/src/MessageProvider.mjs +4 -3
- package/es/modal/src/ModalProvider.mjs +4 -3
- package/es/notification/src/NotificationProvider.mjs +4 -3
- package/es/time/src/Time.d.ts +3 -0
- package/es/time/src/Time.mjs +3 -1
- package/es/time-picker/src/Panel.mjs +9 -2
- package/es/upload/src/Upload.mjs +10 -4
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/calendar/src/Calendar.d.ts +3 -0
- package/lib/calendar/src/Calendar.js +4 -4
- package/lib/checkbox/src/Checkbox.js +3 -3
- package/lib/collapse/src/CollapseItem.js +3 -3
- package/lib/config-provider/src/ConfigProvider.d.ts +3 -0
- package/lib/config-provider/src/ConfigProvider.js +33 -18
- package/lib/config-provider/src/internal-interface.d.ts +1 -0
- package/lib/data-table/src/DataTable.js +2 -2
- package/lib/date-picker/src/DatePicker.d.ts +3 -0
- package/lib/date-picker/src/DatePicker.js +2 -1
- package/lib/date-picker/src/panel/date.d.ts +2 -0
- package/lib/date-picker/src/panel/daterange.d.ts +2 -0
- package/lib/date-picker/src/panel/datetime.d.ts +2 -0
- package/lib/date-picker/src/panel/datetimerange.d.ts +2 -0
- package/lib/date-picker/src/panel/panelMonth.d.ts +4 -0
- package/lib/date-picker/src/panel/panelMonthContent.d.ts +2 -0
- package/lib/date-picker/src/panel/panelYear.d.ts +4 -0
- package/lib/date-picker/src/panel/panelYearContent.d.ts +2 -0
- package/lib/date-picker/src/panel/use-calendar.d.ts +1 -0
- package/lib/date-picker/src/panel/use-calendar.js +9 -4
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +1 -0
- package/lib/date-picker/src/panel/use-dual-calendar.js +17 -13
- package/lib/date-picker/src/panel/use-panel-common.d.ts +1 -0
- package/lib/date-picker/src/panel/use-panel-common.js +1 -0
- package/lib/date-picker/src/utils.d.ts +4 -4
- package/lib/date-picker/src/utils.js +4 -4
- package/lib/date-picker-v2/src/panel/CalendarPanel.d.ts +0 -1
- package/lib/date-picker-v2/src/panel/CalendarPanel.js +6 -4
- package/lib/date-picker-v2/src/panel/CalendarRangePanel.d.ts +0 -1
- package/lib/date-picker-v2/src/panel/CalendarRangePanel.js +6 -4
- package/lib/date-picker-v2/src/utils.d.ts +1 -1
- package/lib/date-picker-v2/src/utils.js +1 -1
- package/lib/dialog/src/DialogProvider.js +3 -2
- package/lib/dynamic-input/src/DynamicInput.js +8 -6
- package/lib/form/src/FormItem.js +5 -3
- package/lib/grid/src/Grid.js +8 -1
- package/lib/header/src/HeaderNavigation.d.ts +3 -3292
- package/lib/header/src/HeaderNavigation.js +2 -1
- package/lib/heatmap/src/Heatmap.js +4 -3
- package/lib/image/src/Image.js +2 -3
- package/lib/image/src/ImageGroup.d.ts +1 -1
- package/lib/image/src/ImageGroup.js +4 -5
- package/lib/menu/src/Menu.js +1 -2
- package/lib/message/src/MessageProvider.js +3 -2
- package/lib/modal/src/ModalProvider.js +3 -2
- package/lib/notification/src/NotificationProvider.js +3 -2
- package/lib/time/src/Time.d.ts +3 -0
- package/lib/time/src/Time.js +3 -1
- package/lib/time-picker/src/Panel.js +8 -1
- package/lib/upload/src/Upload.js +9 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +30 -30
- package/web-types.json +32 -4
|
@@ -3,6 +3,7 @@ import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
|
|
|
3
3
|
import type { DateItem, OnPanelChange, OnUpdateValue } from './interface';
|
|
4
4
|
export declare const calendarProps: {
|
|
5
5
|
readonly isDateDisabled: PropType<(date: number) => boolean | undefined>;
|
|
6
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
6
7
|
readonly value: NumberConstructor;
|
|
7
8
|
readonly defaultValue: {
|
|
8
9
|
readonly type: PropType<number | null>;
|
|
@@ -741,6 +742,7 @@ export declare const calendarProps: {
|
|
|
741
742
|
export type CalendarProps = ExtractPublicPropTypes<typeof calendarProps>;
|
|
742
743
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
743
744
|
readonly isDateDisabled: PropType<(date: number) => boolean | undefined>;
|
|
745
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
744
746
|
readonly value: NumberConstructor;
|
|
745
747
|
readonly defaultValue: {
|
|
746
748
|
readonly type: PropType<number | null>;
|
|
@@ -1827,6 +1829,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1827
1829
|
onRender: (() => void) | undefined;
|
|
1828
1830
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1829
1831
|
readonly isDateDisabled: PropType<(date: number) => boolean | undefined>;
|
|
1832
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
1830
1833
|
readonly value: NumberConstructor;
|
|
1831
1834
|
readonly defaultValue: {
|
|
1832
1835
|
readonly type: PropType<number | null>;
|
|
@@ -12,6 +12,7 @@ import { calendarLight } from "../styles/index.mjs";
|
|
|
12
12
|
import style from "./styles/index.cssr.mjs";
|
|
13
13
|
export const calendarProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
14
14
|
isDateDisabled: Function,
|
|
15
|
+
ssrCurrentTimestamp: Number,
|
|
15
16
|
value: Number,
|
|
16
17
|
defaultValue: {
|
|
17
18
|
type: Number,
|
|
@@ -25,7 +26,7 @@ export default defineComponent({
|
|
|
25
26
|
name: 'Calendar',
|
|
26
27
|
props: calendarProps,
|
|
27
28
|
setup(props) {
|
|
28
|
-
var _a;
|
|
29
|
+
var _a, _b;
|
|
29
30
|
const {
|
|
30
31
|
mergedClsPrefixRef,
|
|
31
32
|
inlineThemeDisabled
|
|
@@ -35,9 +36,9 @@ export default defineComponent({
|
|
|
35
36
|
localeRef,
|
|
36
37
|
dateLocaleRef
|
|
37
38
|
} = useLocale('DatePicker');
|
|
38
|
-
const now = Date.now();
|
|
39
|
+
const now = (_a = props.ssrCurrentTimestamp) !== null && _a !== void 0 ? _a : Date.now();
|
|
39
40
|
// ts => timestamp
|
|
40
|
-
const monthTsRef = ref(startOfMonth((
|
|
41
|
+
const monthTsRef = ref(startOfMonth((_b = props.defaultValue) !== null && _b !== void 0 ? _b : now).valueOf());
|
|
41
42
|
const uncontrolledValueRef = ref(props.defaultValue || null);
|
|
42
43
|
const mergedValueRef = useMergedState(toRef(props, 'value'), uncontrolledValueRef);
|
|
43
44
|
function doUpdateValue(value, time) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { on } from 'evtd';
|
|
2
|
-
import {
|
|
3
|
-
import { computed, defineComponent, h, watchEffect } from 'vue';
|
|
2
|
+
import { computed, defineComponent, h, useId, watchEffect } from 'vue';
|
|
4
3
|
import { checkboxBaseProps, UIconSwitchTransition, useCheckbox } from "../../_internal/index.mjs";
|
|
5
4
|
import { useConfig, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
6
5
|
import { useRtl } from "../../_mixins/use-rtl.mjs";
|
|
@@ -150,11 +149,12 @@ export default defineComponent({
|
|
|
150
149
|
};
|
|
151
150
|
});
|
|
152
151
|
const themeClassHandle = inlineThemeDisabled ? useThemeClass('checkbox', computed(() => checkbox.mergedSize.value[0]), cssVarsRef, props) : undefined;
|
|
152
|
+
const labelId = useId();
|
|
153
153
|
return Object.assign(checkbox, {
|
|
154
154
|
rtlEnabled: rtlEnabledRef,
|
|
155
155
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
156
156
|
mergedTheme: themeRef,
|
|
157
|
-
labelId
|
|
157
|
+
labelId,
|
|
158
158
|
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
159
159
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
160
160
|
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
@@ -206,7 +206,7 @@ export default defineComponent({
|
|
|
206
206
|
tabindex: mergedDisabled || !focusable ? undefined : 0,
|
|
207
207
|
role: "checkbox",
|
|
208
208
|
"aria-checked": indeterminate ? 'mixed' : renderedChecked,
|
|
209
|
-
"aria-labelledby": labelId,
|
|
209
|
+
"aria-labelledby": labelNode ? labelId : undefined,
|
|
210
210
|
style: cssVars,
|
|
211
211
|
onKeyup: handleKeyUp,
|
|
212
212
|
onKeydown: handleKeyDown,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { happensIn } from 'seemly';
|
|
2
2
|
import { useMemo } from 'vooks';
|
|
3
|
-
import { computed, defineComponent, h, inject, toRef } from 'vue';
|
|
3
|
+
import { computed, defineComponent, h, inject, toRef, useId } from 'vue';
|
|
4
4
|
import { UBaseIcon } from "../../_internal/index.mjs";
|
|
5
5
|
import { ChevronLeftIcon as ArrowLeftIcon, ChevronRightIcon as ArrowRightIcon } from "../../_internal/icons/index.mjs";
|
|
6
6
|
import { useConfig } from "../../_mixins/index.mjs";
|
|
@@ -16,10 +16,10 @@ export default defineComponent({
|
|
|
16
16
|
const {
|
|
17
17
|
mergedRtlRef
|
|
18
18
|
} = useConfig(props);
|
|
19
|
-
const
|
|
19
|
+
const generatedName = useId();
|
|
20
20
|
const mergedNameRef = useMemo(() => {
|
|
21
21
|
var _a;
|
|
22
|
-
return (_a = props.name) !== null && _a !== void 0 ? _a :
|
|
22
|
+
return (_a = props.name) !== null && _a !== void 0 ? _a : generatedName;
|
|
23
23
|
});
|
|
24
24
|
const UCollapse = inject(collapseInjectionKey);
|
|
25
25
|
if (!UCollapse) {
|
|
@@ -65,7 +65,7 @@ export default defineComponent({
|
|
|
65
65
|
return {
|
|
66
66
|
rtlEnabled: rtlEnabledRef,
|
|
67
67
|
collapseSlots,
|
|
68
|
-
randomName,
|
|
68
|
+
randomName: generatedName,
|
|
69
69
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
70
70
|
collapsed: collapsedRef,
|
|
71
71
|
triggerAreas: toRef(collapseProps, 'triggerAreas'),
|
|
@@ -35,6 +35,7 @@ export declare const configProviderProps: {
|
|
|
35
35
|
readonly type: PropType<BreakpointMode>;
|
|
36
36
|
readonly default: "desktop-first";
|
|
37
37
|
};
|
|
38
|
+
readonly ssrBreakpointWidth: NumberConstructor;
|
|
38
39
|
readonly preflightStyleDisabled: BooleanConstructor;
|
|
39
40
|
readonly styleMountTarget: PropType<ParentNode | null>;
|
|
40
41
|
readonly inlineThemeDisabled: {
|
|
@@ -79,6 +80,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
79
80
|
readonly type: PropType<BreakpointMode>;
|
|
80
81
|
readonly default: "desktop-first";
|
|
81
82
|
};
|
|
83
|
+
readonly ssrBreakpointWidth: NumberConstructor;
|
|
82
84
|
readonly preflightStyleDisabled: BooleanConstructor;
|
|
83
85
|
readonly styleMountTarget: PropType<ParentNode | null>;
|
|
84
86
|
readonly inlineThemeDisabled: {
|
|
@@ -127,6 +129,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
127
129
|
readonly type: PropType<BreakpointMode>;
|
|
128
130
|
readonly default: "desktop-first";
|
|
129
131
|
};
|
|
132
|
+
readonly ssrBreakpointWidth: NumberConstructor;
|
|
130
133
|
readonly preflightStyleDisabled: BooleanConstructor;
|
|
131
134
|
readonly styleMountTarget: PropType<ParentNode | null>;
|
|
132
135
|
readonly inlineThemeDisabled: {
|
|
@@ -36,6 +36,7 @@ export const configProviderProps = {
|
|
|
36
36
|
type: String,
|
|
37
37
|
default: 'desktop-first'
|
|
38
38
|
},
|
|
39
|
+
ssrBreakpointWidth: Number,
|
|
39
40
|
preflightStyleDisabled: Boolean,
|
|
40
41
|
styleMountTarget: Object,
|
|
41
42
|
inlineThemeDisabled: {
|
|
@@ -57,6 +58,7 @@ export default defineComponent({
|
|
|
57
58
|
alias: ['App'],
|
|
58
59
|
props: configProviderProps,
|
|
59
60
|
setup(props) {
|
|
61
|
+
var _a;
|
|
60
62
|
const UConfigProvider = inject(configProviderInjectionKey, null);
|
|
61
63
|
const mergedThemeRef = computed(() => {
|
|
62
64
|
const {
|
|
@@ -72,12 +74,22 @@ export default defineComponent({
|
|
|
72
74
|
} = props;
|
|
73
75
|
return breakpointMode || (UConfigProvider === null || UConfigProvider === void 0 ? void 0 : UConfigProvider.mergedBreakpointModeRef.value) || 'desktop-first';
|
|
74
76
|
});
|
|
75
|
-
const
|
|
77
|
+
const mergedSsrBreakpointWidthRef = computed(() => {
|
|
78
|
+
const {
|
|
79
|
+
ssrBreakpointWidth
|
|
80
|
+
} = props;
|
|
81
|
+
return ssrBreakpointWidth !== undefined ? ssrBreakpointWidth : UConfigProvider === null || UConfigProvider === void 0 ? void 0 : UConfigProvider.mergedSsrBreakpointWidthRef.value;
|
|
82
|
+
});
|
|
83
|
+
const getSortedBreakpointWidths = breakpointMap => {
|
|
84
|
+
return Object.keys(breakpointMap).map(Number).sort((leftWidth, rightWidth) => leftWidth - rightWidth);
|
|
85
|
+
};
|
|
86
|
+
const getMergedBreakpointValues = (breakpointMap, mode = 'desktop-first') => {
|
|
76
87
|
if (!breakpointMap) return;
|
|
77
|
-
const breakpointWidths =
|
|
88
|
+
const breakpointWidths = getSortedBreakpointWidths(breakpointMap);
|
|
89
|
+
const orderedWidths = mode === 'mobile-first' ? breakpointWidths : [...breakpointWidths].reverse();
|
|
78
90
|
const mergedMap = {};
|
|
79
91
|
let previousValue;
|
|
80
|
-
for (const width of
|
|
92
|
+
for (const width of orderedWidths) {
|
|
81
93
|
if (previousValue !== undefined) {
|
|
82
94
|
mergedMap[width] = merge({}, previousValue, breakpointMap[width]);
|
|
83
95
|
} else {
|
|
@@ -87,23 +99,24 @@ export default defineComponent({
|
|
|
87
99
|
}
|
|
88
100
|
return mergedMap;
|
|
89
101
|
};
|
|
90
|
-
const windowWidthRef = ref(isBrowser ? window.innerWidth :
|
|
102
|
+
const windowWidthRef = ref((_a = mergedSsrBreakpointWidthRef.value) !== null && _a !== void 0 ? _a : isBrowser ? window.innerWidth : undefined);
|
|
91
103
|
const getActiveBreakpointValue = (breakpointMap, mode = 'desktop-first') => {
|
|
92
|
-
if (!breakpointMap
|
|
93
|
-
const mergedMap = getMergedBreakpointValues(breakpointMap);
|
|
94
|
-
if (!mergedMap) return;
|
|
104
|
+
if (!breakpointMap) return;
|
|
95
105
|
const currentWidth = windowWidthRef.value;
|
|
96
|
-
|
|
106
|
+
if (currentWidth === undefined) return;
|
|
107
|
+
const mergedMap = getMergedBreakpointValues(breakpointMap, mode);
|
|
108
|
+
if (!mergedMap) return;
|
|
109
|
+
const breakpointWidths = getSortedBreakpointWidths(mergedMap);
|
|
97
110
|
let matchingBreakpoints;
|
|
98
111
|
if (mode === 'mobile-first') {
|
|
99
|
-
matchingBreakpoints = breakpointWidths.filter(width => width
|
|
112
|
+
matchingBreakpoints = breakpointWidths.filter(width => width <= currentWidth).reverse();
|
|
100
113
|
if (matchingBreakpoints.length === 0) {
|
|
101
|
-
matchingBreakpoints = [breakpointWidths[
|
|
114
|
+
matchingBreakpoints = [breakpointWidths[0]];
|
|
102
115
|
}
|
|
103
116
|
} else {
|
|
104
|
-
matchingBreakpoints = breakpointWidths.filter(width => width
|
|
117
|
+
matchingBreakpoints = breakpointWidths.filter(width => width >= currentWidth);
|
|
105
118
|
if (matchingBreakpoints.length === 0) {
|
|
106
|
-
matchingBreakpoints = [breakpointWidths[
|
|
119
|
+
matchingBreakpoints = [breakpointWidths[breakpointWidths.length - 1]];
|
|
107
120
|
}
|
|
108
121
|
}
|
|
109
122
|
const activeBreakpoint = matchingBreakpoints[0];
|
|
@@ -265,6 +278,7 @@ export default defineComponent({
|
|
|
265
278
|
provide(configProviderInjectionKey, {
|
|
266
279
|
mergedThemeHashRef,
|
|
267
280
|
mergedBreakpointsRef,
|
|
281
|
+
mergedSsrBreakpointWidthRef,
|
|
268
282
|
mergedRtlRef,
|
|
269
283
|
mergedIconsRef,
|
|
270
284
|
mergedComponentPropsRef,
|
|
@@ -449,6 +449,7 @@ export type BreakpointThemeOverrides = Record<number, GlobalThemeOverrides> | un
|
|
|
449
449
|
export type BreakpointMode = 'mobile-first' | 'desktop-first';
|
|
450
450
|
export interface ConfigProviderInjection {
|
|
451
451
|
mergedBreakpointsRef: Ref<Breakpoints | undefined>;
|
|
452
|
+
mergedSsrBreakpointWidthRef: Ref<number | undefined>;
|
|
452
453
|
mergedClsPrefixRef: Ref<string>;
|
|
453
454
|
mergedBorderedRef: Ref<boolean | undefined>;
|
|
454
455
|
mergedNamespaceRef: Ref<string | undefined>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { computed, defineComponent, h, onMounted, provide, ref, toRef, Transition, watch, watchEffect } from 'vue';
|
|
1
|
+
import { computed, defineComponent, h, onMounted, provide, ref, toRef, Transition, useId, watch, watchEffect } from 'vue';
|
|
3
2
|
import { UBaseLoading } from "../../_internal/index.mjs";
|
|
4
3
|
import { useConfig, useLocale, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
5
4
|
import { createKey, download, resolveSlot, warnOnce } from "../../_utils/index.mjs";
|
|
@@ -25,6 +24,7 @@ export default defineComponent({
|
|
|
25
24
|
slots,
|
|
26
25
|
emit
|
|
27
26
|
}) {
|
|
27
|
+
const componentId = useId();
|
|
28
28
|
if (process.env.NODE_ENV !== 'production') {
|
|
29
29
|
watchEffect(() => {
|
|
30
30
|
if (props.onPageChange !== undefined) {
|
|
@@ -379,7 +379,7 @@ export default defineComponent({
|
|
|
379
379
|
indentRef: toRef(props, 'indent'),
|
|
380
380
|
childTriggerColIndexRef,
|
|
381
381
|
bodyWidthRef,
|
|
382
|
-
componentId
|
|
382
|
+
componentId,
|
|
383
383
|
hoverKeyRef,
|
|
384
384
|
mergedClsPrefixRef,
|
|
385
385
|
mergedThemeRef: themeRef,
|
|
@@ -66,6 +66,7 @@ export declare const datePickerProps: {
|
|
|
66
66
|
readonly onConfirm: PropType<OnConfirm>;
|
|
67
67
|
readonly defaultCalendarStartTime: NumberConstructor;
|
|
68
68
|
readonly defaultCalendarEndTime: NumberConstructor;
|
|
69
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
69
70
|
readonly bindCalendarMonths: BooleanConstructor;
|
|
70
71
|
readonly triggerPreset: {
|
|
71
72
|
readonly type: PropType<TriggerPreset>;
|
|
@@ -2655,6 +2656,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
2655
2656
|
readonly onConfirm: PropType<OnConfirm>;
|
|
2656
2657
|
readonly defaultCalendarStartTime: NumberConstructor;
|
|
2657
2658
|
readonly defaultCalendarEndTime: NumberConstructor;
|
|
2659
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
2658
2660
|
readonly bindCalendarMonths: BooleanConstructor;
|
|
2659
2661
|
readonly triggerPreset: {
|
|
2660
2662
|
readonly type: PropType<TriggerPreset>;
|
|
@@ -6717,6 +6719,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
6717
6719
|
readonly onConfirm: PropType<OnConfirm>;
|
|
6718
6720
|
readonly defaultCalendarStartTime: NumberConstructor;
|
|
6719
6721
|
readonly defaultCalendarEndTime: NumberConstructor;
|
|
6722
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
6720
6723
|
readonly bindCalendarMonths: BooleanConstructor;
|
|
6721
6724
|
readonly triggerPreset: {
|
|
6722
6725
|
readonly type: PropType<TriggerPreset>;
|
|
@@ -75,6 +75,7 @@ export const datePickerProps = Object.assign(Object.assign({}, useTheme.props),
|
|
|
75
75
|
onConfirm: Function,
|
|
76
76
|
defaultCalendarStartTime: Number,
|
|
77
77
|
defaultCalendarEndTime: Number,
|
|
78
|
+
ssrCurrentTimestamp: Number,
|
|
78
79
|
bindCalendarMonths: Boolean,
|
|
79
80
|
triggerPreset: {
|
|
80
81
|
type: String,
|
|
@@ -958,6 +959,7 @@ export default defineComponent({
|
|
|
958
959
|
shortcuts: this.defaultShortcuts ? this.getDefaultShortcuts() : this.shortcuts,
|
|
959
960
|
style: this.cssVars,
|
|
960
961
|
defaultTime: this.defaultTime,
|
|
962
|
+
ssrCurrentTimestamp: this.ssrCurrentTimestamp,
|
|
961
963
|
themeClass: this.themeClass,
|
|
962
964
|
panel: this.panel,
|
|
963
965
|
onRender: this.onRender
|
|
@@ -27,6 +27,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
27
27
|
readonly onClear: FunctionConstructor;
|
|
28
28
|
readonly onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
29
29
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
30
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
30
31
|
readonly onTabOut: FunctionConstructor;
|
|
31
32
|
readonly onUpdateValue: {
|
|
32
33
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -2527,6 +2528,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2527
2528
|
readonly onClear: FunctionConstructor;
|
|
2528
2529
|
readonly onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
2529
2530
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
2531
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
2530
2532
|
readonly onTabOut: FunctionConstructor;
|
|
2531
2533
|
readonly onUpdateValue: {
|
|
2532
2534
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -24,6 +24,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
24
24
|
readonly onClear: FunctionConstructor;
|
|
25
25
|
readonly onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
26
26
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
27
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
27
28
|
readonly onTabOut: FunctionConstructor;
|
|
28
29
|
readonly onUpdateValue: {
|
|
29
30
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -2566,6 +2567,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2566
2567
|
readonly onClear: FunctionConstructor;
|
|
2567
2568
|
readonly onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
2568
2569
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
2570
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
2569
2571
|
readonly onTabOut: FunctionConstructor;
|
|
2570
2572
|
readonly onUpdateValue: {
|
|
2571
2573
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -25,6 +25,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
25
25
|
readonly onClear: FunctionConstructor;
|
|
26
26
|
readonly onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
27
27
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
28
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
28
29
|
readonly onTabOut: FunctionConstructor;
|
|
29
30
|
readonly onUpdateValue: {
|
|
30
31
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -2520,6 +2521,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2520
2521
|
readonly onClear: FunctionConstructor;
|
|
2521
2522
|
readonly onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
2522
2523
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
2524
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
2523
2525
|
readonly onTabOut: FunctionConstructor;
|
|
2524
2526
|
readonly onUpdateValue: {
|
|
2525
2527
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -22,6 +22,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
22
22
|
readonly onClear: FunctionConstructor;
|
|
23
23
|
readonly onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
24
24
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
25
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
25
26
|
readonly onTabOut: FunctionConstructor;
|
|
26
27
|
readonly onUpdateValue: {
|
|
27
28
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -2557,6 +2558,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2557
2558
|
readonly onClear: FunctionConstructor;
|
|
2558
2559
|
readonly onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
2559
2560
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
2561
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
2560
2562
|
readonly onTabOut: FunctionConstructor;
|
|
2561
2563
|
readonly onUpdateValue: {
|
|
2562
2564
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -46,6 +46,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
46
46
|
onClear: FunctionConstructor;
|
|
47
47
|
onConfirm: PropType<(value: import("../interface").Value | null) => void>;
|
|
48
48
|
onClose: PropType<import("../interface").OnClose>;
|
|
49
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
49
50
|
onTabOut: FunctionConstructor;
|
|
50
51
|
onUpdateValue: {
|
|
51
52
|
readonly type: PropType<OnPanelUpdateValue>;
|
|
@@ -2556,6 +2557,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2556
2557
|
onClear: FunctionConstructor;
|
|
2557
2558
|
onConfirm: PropType<(value: import("../interface").Value | null) => void>;
|
|
2558
2559
|
onClose: PropType<import("../interface").OnClose>;
|
|
2560
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
2559
2561
|
onTabOut: FunctionConstructor;
|
|
2560
2562
|
onUpdateValue: {
|
|
2561
2563
|
readonly type: PropType<OnPanelUpdateValue>;
|
|
@@ -5059,6 +5061,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
5059
5061
|
onClear: FunctionConstructor;
|
|
5060
5062
|
onConfirm: PropType<(value: import("../interface").Value | null) => void>;
|
|
5061
5063
|
onClose: PropType<import("../interface").OnClose>;
|
|
5064
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
5062
5065
|
onTabOut: FunctionConstructor;
|
|
5063
5066
|
onUpdateValue: {
|
|
5064
5067
|
readonly type: PropType<OnPanelUpdateValue>;
|
|
@@ -7569,6 +7572,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
7569
7572
|
onClear: FunctionConstructor;
|
|
7570
7573
|
onConfirm: PropType<(value: import("../interface").Value | null) => void>;
|
|
7571
7574
|
onClose: PropType<import("../interface").OnClose>;
|
|
7575
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
7572
7576
|
onTabOut: FunctionConstructor;
|
|
7573
7577
|
onUpdateValue: {
|
|
7574
7578
|
readonly type: PropType<OnPanelUpdateValue>;
|
|
@@ -28,6 +28,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
28
28
|
onClear: FunctionConstructor;
|
|
29
29
|
onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
30
30
|
onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
31
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
31
32
|
onTabOut: FunctionConstructor;
|
|
32
33
|
onUpdateValue: {
|
|
33
34
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -2525,6 +2526,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2525
2526
|
onClear: FunctionConstructor;
|
|
2526
2527
|
onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
2527
2528
|
onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
2529
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
2528
2530
|
onTabOut: FunctionConstructor;
|
|
2529
2531
|
onUpdateValue: {
|
|
2530
2532
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -46,6 +46,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
46
46
|
onClear: FunctionConstructor;
|
|
47
47
|
onConfirm: PropType<(value: import("../interface").Value | null) => void>;
|
|
48
48
|
onClose: PropType<import("../interface").OnClose>;
|
|
49
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
49
50
|
onTabOut: FunctionConstructor;
|
|
50
51
|
onUpdateValue: {
|
|
51
52
|
readonly type: PropType<OnPanelUpdateValue>;
|
|
@@ -2556,6 +2557,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2556
2557
|
onClear: FunctionConstructor;
|
|
2557
2558
|
onConfirm: PropType<(value: import("../interface").Value | null) => void>;
|
|
2558
2559
|
onClose: PropType<import("../interface").OnClose>;
|
|
2560
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
2559
2561
|
onTabOut: FunctionConstructor;
|
|
2560
2562
|
onUpdateValue: {
|
|
2561
2563
|
readonly type: PropType<OnPanelUpdateValue>;
|
|
@@ -5059,6 +5061,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
5059
5061
|
onClear: FunctionConstructor;
|
|
5060
5062
|
onConfirm: PropType<(value: import("../interface").Value | null) => void>;
|
|
5061
5063
|
onClose: PropType<import("../interface").OnClose>;
|
|
5064
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
5062
5065
|
onTabOut: FunctionConstructor;
|
|
5063
5066
|
onUpdateValue: {
|
|
5064
5067
|
readonly type: PropType<OnPanelUpdateValue>;
|
|
@@ -7569,6 +7572,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
7569
7572
|
onClear: FunctionConstructor;
|
|
7570
7573
|
onConfirm: PropType<(value: import("../interface").Value | null) => void>;
|
|
7571
7574
|
onClose: PropType<import("../interface").OnClose>;
|
|
7575
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
7572
7576
|
onTabOut: FunctionConstructor;
|
|
7573
7577
|
onUpdateValue: {
|
|
7574
7578
|
readonly type: PropType<OnPanelUpdateValue>;
|
|
@@ -28,6 +28,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
28
28
|
onClear: FunctionConstructor;
|
|
29
29
|
onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
30
30
|
onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
31
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
31
32
|
onTabOut: FunctionConstructor;
|
|
32
33
|
onUpdateValue: {
|
|
33
34
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -2525,6 +2526,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2525
2526
|
onClear: FunctionConstructor;
|
|
2526
2527
|
onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
2527
2528
|
onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
2529
|
+
ssrCurrentTimestamp: NumberConstructor;
|
|
2528
2530
|
onTabOut: FunctionConstructor;
|
|
2529
2531
|
onUpdateValue: {
|
|
2530
2532
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -24,6 +24,7 @@ declare const useCalendarProps: {
|
|
|
24
24
|
readonly onClear: FunctionConstructor;
|
|
25
25
|
readonly onConfirm: PropType<(value: import("../interface").Value | null) => void>;
|
|
26
26
|
readonly onClose: PropType<import("../interface").OnClose>;
|
|
27
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
27
28
|
readonly onTabOut: FunctionConstructor;
|
|
28
29
|
readonly onUpdateValue: {
|
|
29
30
|
readonly type: PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addMonths, addYears, format, getDate, getMonth, getTime, getYear, isSameMonth, isValid, set, setMonth, setQuarter, setYear, startOfDay, startOfMonth, startOfQuarter, startOfSecond, startOfYear } from 'date-fns'; //
|
|
2
|
-
import { computed, inject, ref, watch } from 'vue';
|
|
2
|
+
import { computed, inject, onMounted, ref, watch } from 'vue';
|
|
3
3
|
import { MONTH_ITEM_GAP, MONTH_ITEM_HEIGHT, START_YEAR } from "../config.mjs";
|
|
4
4
|
import { datePickerInjectionKey } from "../interface.mjs";
|
|
5
5
|
import { dateArray, extractSingleDefaultTime, getDefaultTime, monthArray, quarterArray, strictParse, yearArray } from "../utils.mjs";
|
|
@@ -11,6 +11,7 @@ const useCalendarProps = Object.assign(Object.assign({}, usePanelCommonProps), {
|
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
function useCalendar(props, type) {
|
|
14
|
+
var _a, _b;
|
|
14
15
|
const panelCommon = usePanelCommon(props);
|
|
15
16
|
const {
|
|
16
17
|
isValueInvalidRef,
|
|
@@ -37,11 +38,15 @@ function useCalendar(props, type) {
|
|
|
37
38
|
isSecondDisabled: isSecondDisabledRef
|
|
38
39
|
};
|
|
39
40
|
const mergedDateFormatRef = computed(() => props.dateFormat || localeRef.value.dateFormat);
|
|
41
|
+
const initialCurrentTimestamp = (_a = props.ssrCurrentTimestamp) !== null && _a !== void 0 ? _a : Date.now();
|
|
40
42
|
const dateInputValueRef = ref(props.value === null || Array.isArray(props.value) ? '' : format(props.value, mergedDateFormatRef.value));
|
|
41
|
-
const calendarValueRef = ref(props.value === null || Array.isArray(props.value) ?
|
|
43
|
+
const calendarValueRef = ref(props.value === null || Array.isArray(props.value) ? initialCurrentTimestamp : props.value);
|
|
42
44
|
const yearVlRef = ref(null);
|
|
43
45
|
const yearScrollbarRef = ref(null);
|
|
44
|
-
const nowRef = ref(
|
|
46
|
+
const nowRef = ref((_b = props.ssrCurrentTimestamp) !== null && _b !== void 0 ? _b : null);
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
nowRef.value = Date.now();
|
|
49
|
+
});
|
|
45
50
|
const dateArrayRef = computed(() => {
|
|
46
51
|
var _a;
|
|
47
52
|
return dateArray(calendarValueRef.value, props.value, nowRef.value, (_a = firstDayOfWeekRef.value) !== null && _a !== void 0 ? _a : localeRef.value.firstDayOfWeek);
|
|
@@ -170,7 +175,7 @@ function useCalendar(props, type) {
|
|
|
170
175
|
if (props.value !== null && !Array.isArray(props.value)) {
|
|
171
176
|
newValue = props.value;
|
|
172
177
|
} else {
|
|
173
|
-
newValue =
|
|
178
|
+
newValue = calendarValueRef.value;
|
|
174
179
|
}
|
|
175
180
|
if (type === 'datetime' && props.defaultTime !== null && !Array.isArray(props.defaultTime)) {
|
|
176
181
|
let time;
|
|
@@ -210,7 +215,7 @@ function useCalendar(props, type) {
|
|
|
210
215
|
if (props.value !== null && !Array.isArray(props.value)) {
|
|
211
216
|
newValue = props.value;
|
|
212
217
|
} else {
|
|
213
|
-
newValue =
|
|
218
|
+
newValue = calendarValueRef.value;
|
|
214
219
|
}
|
|
215
220
|
newValue = getTime(dateItem.type === 'month' ? setMonth(newValue, dateItem.dateObject.month) : setYear(newValue, dateItem.dateObject.year));
|
|
216
221
|
updatePanelValue(newValue);
|
|
@@ -27,6 +27,7 @@ declare const useDualCalendarProps: {
|
|
|
27
27
|
readonly onClear: FunctionConstructor;
|
|
28
28
|
readonly onConfirm: import("vue").PropType<(value: import("../interface").Value | null) => void>;
|
|
29
29
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
30
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
30
31
|
readonly onTabOut: FunctionConstructor;
|
|
31
32
|
readonly onUpdateValue: {
|
|
32
33
|
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addMonths, format, getDate, getMonth, getTime, getYear, isValid, set, startOfDay, startOfMonth, startOfQuarter, startOfSecond } from 'date-fns'; //
|
|
2
|
-
import { computed, inject, ref, watch } from 'vue';
|
|
2
|
+
import { computed, inject, onMounted, ref, watch } from 'vue';
|
|
3
3
|
import { MONTH_ITEM_HEIGHT, START_YEAR } from "../config.mjs";
|
|
4
4
|
import { datePickerInjectionKey } from "../interface.mjs";
|
|
5
5
|
import { dateArray, extractRangeDefaultTime, getDefaultTime, monthArray, pluckValueFromRange, quarterArray, strictParse, yearArray } from "../utils.mjs";
|
|
@@ -14,7 +14,7 @@ const useDualCalendarProps = Object.assign(Object.assign({}, usePanelCommonProps
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
function useDualCalendar(props, type) {
|
|
17
|
-
var _a, _b;
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
18
|
const {
|
|
19
19
|
isDateDisabledRef,
|
|
20
20
|
maxDateRef,
|
|
@@ -66,11 +66,15 @@ function useDualCalendar(props, type) {
|
|
|
66
66
|
const {
|
|
67
67
|
value
|
|
68
68
|
} = props;
|
|
69
|
-
const
|
|
69
|
+
const initialCurrentTimestamp = (_a = props.ssrCurrentTimestamp) !== null && _a !== void 0 ? _a : Date.now();
|
|
70
|
+
const defaultCalendarStartTime = (_b = props.defaultCalendarStartTime) !== null && _b !== void 0 ? _b : Array.isArray(value) && typeof value[0] === 'number' ? value[0] : initialCurrentTimestamp;
|
|
70
71
|
const startCalendarDateTimeRef = ref(defaultCalendarStartTime);
|
|
71
|
-
const endCalendarDateTimeRef = ref((
|
|
72
|
+
const endCalendarDateTimeRef = ref((_c = props.defaultCalendarEndTime) !== null && _c !== void 0 ? _c : Array.isArray(value) && typeof value[1] === 'number' ? value[1] : getTime(addMonths(defaultCalendarStartTime, 1)));
|
|
72
73
|
adjustCalendarTimes(true);
|
|
73
|
-
const nowRef = ref(
|
|
74
|
+
const nowRef = ref((_d = props.ssrCurrentTimestamp) !== null && _d !== void 0 ? _d : null);
|
|
75
|
+
onMounted(() => {
|
|
76
|
+
nowRef.value = Date.now();
|
|
77
|
+
});
|
|
74
78
|
const isSelectingRef = ref(false);
|
|
75
79
|
const memorizedStartDateTimeRef = ref(0);
|
|
76
80
|
const mergedDateFormatRef = computed(() => props.dateFormat || localeRef.value.dateFormat);
|
|
@@ -136,19 +140,19 @@ function useDualCalendar(props, type) {
|
|
|
136
140
|
});
|
|
137
141
|
const startQuarterArrayRef = computed(() => {
|
|
138
142
|
const startValue = pluckValueFromRange(props.value, 'start');
|
|
139
|
-
return quarterArray(startValue !== null && startValue !== void 0 ? startValue :
|
|
143
|
+
return quarterArray(startValue !== null && startValue !== void 0 ? startValue : startCalendarDateTimeRef.value, startValue, nowRef.value);
|
|
140
144
|
});
|
|
141
145
|
const endQuarterArrayRef = computed(() => {
|
|
142
146
|
const endValue = pluckValueFromRange(props.value, 'end');
|
|
143
|
-
return quarterArray(endValue !== null && endValue !== void 0 ? endValue :
|
|
147
|
+
return quarterArray(endValue !== null && endValue !== void 0 ? endValue : endCalendarDateTimeRef.value, endValue, nowRef.value);
|
|
144
148
|
});
|
|
145
149
|
const startMonthArrayRef = computed(() => {
|
|
146
150
|
const startValue = pluckValueFromRange(props.value, 'start');
|
|
147
|
-
return monthArray(startValue !== null && startValue !== void 0 ? startValue :
|
|
151
|
+
return monthArray(startValue !== null && startValue !== void 0 ? startValue : startCalendarDateTimeRef.value, startValue, nowRef.value);
|
|
148
152
|
});
|
|
149
153
|
const endMonthArrayRef = computed(() => {
|
|
150
154
|
const endValue = pluckValueFromRange(props.value, 'end');
|
|
151
|
-
return monthArray(endValue !== null && endValue !== void 0 ? endValue :
|
|
155
|
+
return monthArray(endValue !== null && endValue !== void 0 ? endValue : endCalendarDateTimeRef.value, endValue, nowRef.value);
|
|
152
156
|
});
|
|
153
157
|
watch(computed(() => props.value), value => {
|
|
154
158
|
if (value !== null && Array.isArray(value)) {
|
|
@@ -502,7 +506,7 @@ function useDualCalendar(props, type) {
|
|
|
502
506
|
const mergedValue = value === undefined ? props.value : value;
|
|
503
507
|
if (value === undefined || type === 'start') {
|
|
504
508
|
if (startMonthScrollbarRef.value) {
|
|
505
|
-
const monthIndex = !Array.isArray(mergedValue) ? getMonth(
|
|
509
|
+
const monthIndex = !Array.isArray(mergedValue) ? getMonth(startCalendarDateTimeRef.value) : getMonth(mergedValue[0]);
|
|
506
510
|
startMonthScrollbarRef.value.scrollTo({
|
|
507
511
|
debounce: false,
|
|
508
512
|
index: monthIndex,
|
|
@@ -510,7 +514,7 @@ function useDualCalendar(props, type) {
|
|
|
510
514
|
});
|
|
511
515
|
}
|
|
512
516
|
if (startYearVlRef.value) {
|
|
513
|
-
const yearIndex = (!Array.isArray(mergedValue) ? getYear(
|
|
517
|
+
const yearIndex = (!Array.isArray(mergedValue) ? getYear(startCalendarDateTimeRef.value) : getYear(mergedValue[0])) - START_YEAR;
|
|
514
518
|
startYearVlRef.value.scrollTo({
|
|
515
519
|
index: yearIndex,
|
|
516
520
|
debounce: false
|
|
@@ -519,7 +523,7 @@ function useDualCalendar(props, type) {
|
|
|
519
523
|
}
|
|
520
524
|
if (value === undefined || type === 'end') {
|
|
521
525
|
if (endMonthScrollbarRef.value) {
|
|
522
|
-
const monthIndex = !Array.isArray(mergedValue) ? getMonth(
|
|
526
|
+
const monthIndex = !Array.isArray(mergedValue) ? getMonth(endCalendarDateTimeRef.value) : getMonth(mergedValue[1]);
|
|
523
527
|
endMonthScrollbarRef.value.scrollTo({
|
|
524
528
|
debounce: false,
|
|
525
529
|
index: monthIndex,
|
|
@@ -527,7 +531,7 @@ function useDualCalendar(props, type) {
|
|
|
527
531
|
});
|
|
528
532
|
}
|
|
529
533
|
if (endYearVlRef.value) {
|
|
530
|
-
const yearIndex = (!Array.isArray(mergedValue) ? getYear(
|
|
534
|
+
const yearIndex = (!Array.isArray(mergedValue) ? getYear(endCalendarDateTimeRef.value) : getYear(mergedValue[1])) - START_YEAR;
|
|
531
535
|
endYearVlRef.value.scrollTo({
|
|
532
536
|
index: yearIndex,
|
|
533
537
|
debounce: false
|
|
@@ -18,6 +18,7 @@ declare const usePanelCommonProps: {
|
|
|
18
18
|
readonly onClear: FunctionConstructor;
|
|
19
19
|
readonly onConfirm: PropType<(value: Value | null) => void>;
|
|
20
20
|
readonly onClose: PropType<OnClose>;
|
|
21
|
+
readonly ssrCurrentTimestamp: NumberConstructor;
|
|
21
22
|
readonly onTabOut: FunctionConstructor;
|
|
22
23
|
readonly onUpdateValue: {
|
|
23
24
|
readonly type: PropType<OnPanelUpdateValue>;
|