@uzum-tech/ui 1.12.21 → 1.13.0
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 +2789 -510
- package/dist/index.prod.js +4 -4
- package/es/_styles/common/dark.js +1 -1
- package/es/_styles/common/light.d.ts +1 -0
- package/es/_styles/common/light.js +1 -1
- package/es/chat/src/ChatMessages.js +6 -1
- package/es/chat/src/styles/index.cssr.js +5 -1
- package/es/components.d.ts +1 -0
- package/es/components.js +1 -0
- package/es/config-provider/src/internal-interface.d.ts +3 -0
- package/es/date-picker-v2/index.d.ts +5 -0
- package/es/date-picker-v2/index.js +2 -0
- package/es/date-picker-v2/src/DatePickerV2.d.ts +4765 -0
- package/es/date-picker-v2/src/DatePickerV2.js +750 -0
- package/es/date-picker-v2/src/composables/useCalendarScroll.d.ts +1133 -0
- package/es/date-picker-v2/src/composables/useCalendarScroll.js +61 -0
- package/es/date-picker-v2/src/config.d.ts +14 -0
- package/es/date-picker-v2/src/config.js +34 -0
- package/es/date-picker-v2/src/interface.d.ts +42 -0
- package/es/date-picker-v2/src/interface.js +1 -0
- package/es/date-picker-v2/src/panel/CalendarPanel.d.ts +1222 -0
- package/es/date-picker-v2/src/panel/CalendarPanel.js +186 -0
- package/es/date-picker-v2/src/panel/CalendarRangePanel.d.ts +1246 -0
- package/es/date-picker-v2/src/panel/CalendarRangePanel.js +205 -0
- package/es/date-picker-v2/src/styles/index.cssr.d.ts +2 -0
- package/es/date-picker-v2/src/styles/index.cssr.js +190 -0
- package/es/date-picker-v2/src/utils.d.ts +12 -0
- package/es/date-picker-v2/src/utils.js +92 -0
- package/es/date-picker-v2/styles/dark.d.ts +447 -0
- package/es/date-picker-v2/styles/dark.js +19 -0
- package/es/date-picker-v2/styles/index.d.ts +3 -0
- package/es/date-picker-v2/styles/index.js +2 -0
- package/es/date-picker-v2/styles/light.d.ts +477 -0
- package/es/date-picker-v2/styles/light.js +56 -0
- package/es/dialog/src/DialogProvider.d.ts +2 -0
- package/es/header/src/Header.js +4 -1
- package/es/header/src/HeaderSearchDesktop.d.ts +12 -0
- package/es/header/src/HeaderSearchDesktop.js +21 -4
- package/es/header/src/HeaderSearchMobile.d.ts +12 -0
- package/es/header/src/HeaderSearchMobile.js +8 -2
- package/es/header/src/mobile/HeaderMobile.js +18 -3
- package/es/locales/common/enUS.js +1 -1
- package/es/theme-editor/src/ThemeEditor.d.ts +1 -0
- package/es/themes/dark.js +2 -0
- package/es/themes/light.js +2 -0
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_styles/common/dark.js +1 -1
- package/lib/_styles/common/light.d.ts +1 -0
- package/lib/_styles/common/light.js +1 -1
- package/lib/chat/src/ChatMessages.js +6 -1
- package/lib/chat/src/styles/index.cssr.js +5 -1
- package/lib/components.d.ts +1 -0
- package/lib/components.js +1 -0
- package/lib/config-provider/src/internal-interface.d.ts +3 -0
- package/lib/date-picker-v2/index.d.ts +5 -0
- package/lib/date-picker-v2/index.js +11 -0
- package/lib/date-picker-v2/src/DatePickerV2.d.ts +4765 -0
- package/lib/date-picker-v2/src/DatePickerV2.js +756 -0
- package/lib/date-picker-v2/src/composables/useCalendarScroll.d.ts +1133 -0
- package/lib/date-picker-v2/src/composables/useCalendarScroll.js +64 -0
- package/lib/date-picker-v2/src/config.d.ts +14 -0
- package/lib/date-picker-v2/src/config.js +37 -0
- package/lib/date-picker-v2/src/interface.d.ts +42 -0
- package/lib/date-picker-v2/src/interface.js +4 -0
- package/lib/date-picker-v2/src/panel/CalendarPanel.d.ts +1222 -0
- package/lib/date-picker-v2/src/panel/CalendarPanel.js +188 -0
- package/lib/date-picker-v2/src/panel/CalendarRangePanel.d.ts +1246 -0
- package/lib/date-picker-v2/src/panel/CalendarRangePanel.js +207 -0
- package/lib/date-picker-v2/src/styles/index.cssr.d.ts +2 -0
- package/lib/date-picker-v2/src/styles/index.cssr.js +195 -0
- package/lib/date-picker-v2/src/utils.d.ts +12 -0
- package/lib/date-picker-v2/src/utils.js +101 -0
- package/lib/date-picker-v2/styles/dark.d.ts +447 -0
- package/lib/date-picker-v2/styles/dark.js +21 -0
- package/lib/date-picker-v2/styles/index.d.ts +3 -0
- package/lib/date-picker-v2/styles/index.js +10 -0
- package/lib/date-picker-v2/styles/light.d.ts +477 -0
- package/lib/date-picker-v2/styles/light.js +60 -0
- package/lib/dialog/src/DialogProvider.d.ts +2 -0
- package/lib/header/src/Header.js +4 -1
- package/lib/header/src/HeaderSearchDesktop.d.ts +12 -0
- package/lib/header/src/HeaderSearchDesktop.js +20 -3
- package/lib/header/src/HeaderSearchMobile.d.ts +12 -0
- package/lib/header/src/HeaderSearchMobile.js +7 -1
- package/lib/header/src/mobile/HeaderMobile.js +18 -3
- package/lib/locales/common/enUS.js +1 -1
- package/lib/theme-editor/src/ThemeEditor.d.ts +1 -0
- package/lib/themes/dark.js +2 -0
- package/lib/themes/light.js +2 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/volar.d.ts +1 -0
- package/web-types.json +161 -1
|
@@ -0,0 +1,750 @@
|
|
|
1
|
+
import { h, defineComponent, ref, computed, provide, withDirectives, toRef, Transition, watch, nextTick } from 'vue';
|
|
2
|
+
import { VBinder, VTarget, VFollower } from 'vueuc';
|
|
3
|
+
import { clickoutside } from 'vdirs';
|
|
4
|
+
import { format, parse, getYear, getMonth, startOfDay, getTime, isValid } from 'date-fns';
|
|
5
|
+
import { useIsMounted, useMergedState } from 'vooks';
|
|
6
|
+
import { getPreciseEventTarget } from 'seemly';
|
|
7
|
+
import { DateIcon } from '../../_internal/icons';
|
|
8
|
+
import { UInput } from '../../input';
|
|
9
|
+
import { UBaseIcon, UInternalSelection } from '../../_internal';
|
|
10
|
+
import { useFormItem, useTheme, useConfig, useLocale, useThemeClass } from '../../_mixins';
|
|
11
|
+
import { call, useAdjustedTo } from '../../_utils';
|
|
12
|
+
import { UButton } from '../../button';
|
|
13
|
+
import { datePickerV2Light } from '../styles';
|
|
14
|
+
import { datePickerV2InjectionKey } from './interface';
|
|
15
|
+
import CalendarPanel from './panel/CalendarPanel';
|
|
16
|
+
import CalendarRangePanel from './panel/CalendarRangePanel';
|
|
17
|
+
import style from './styles/index.cssr';
|
|
18
|
+
export const datePickerV2Props = Object.assign(Object.assign({}, useTheme.props), { to: useAdjustedTo.propTo, type: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'date'
|
|
21
|
+
}, bordered: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: undefined
|
|
24
|
+
}, round: Boolean, clearable: Boolean, defaultValue: [Number, Array], disabled: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: undefined
|
|
27
|
+
}, placement: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'bottom-start'
|
|
30
|
+
}, value: [Number, Array], size: String, placeholder: String, startPlaceholder: String, endPlaceholder: String, separator: String, format: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'DD.MM.YYYY'
|
|
33
|
+
}, triggerPreset: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'input'
|
|
36
|
+
}, isDateDisabled: Function, show: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: undefined
|
|
39
|
+
}, status: String, inputReadonly: Boolean, 'onUpdate:show': [Function, Array], onUpdateShow: [Function, Array], 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array], onFocus: [Function, Array], onBlur: [Function, Array] });
|
|
40
|
+
export default defineComponent({
|
|
41
|
+
name: 'DatePickerV2',
|
|
42
|
+
props: datePickerV2Props,
|
|
43
|
+
setup(props) {
|
|
44
|
+
var _a;
|
|
45
|
+
const { localeRef, dateLocaleRef } = useLocale('DatePicker');
|
|
46
|
+
const formItem = useFormItem(props);
|
|
47
|
+
const { mergedSizeRef, mergedDisabledRef, mergedStatusRef } = formItem;
|
|
48
|
+
const { mergedClsPrefixRef, mergedBorderedRef, namespaceRef, inlineThemeDisabled } = useConfig(props);
|
|
49
|
+
const triggerElRef = ref(null);
|
|
50
|
+
const inputInstRef = ref(null);
|
|
51
|
+
const panelRef = ref(null);
|
|
52
|
+
const uncontrolledShowRef = ref(false);
|
|
53
|
+
const controlledShowRef = toRef(props, 'show');
|
|
54
|
+
const mergedShowRef = useMergedState(controlledShowRef, uncontrolledShowRef);
|
|
55
|
+
const isRange = computed(() => props.type === 'daterange');
|
|
56
|
+
const dateFnsOptionsRef = computed(() => {
|
|
57
|
+
return {
|
|
58
|
+
locale: dateLocaleRef.value.locale
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
function normalizeFormat(format) {
|
|
62
|
+
return format
|
|
63
|
+
.replace(/Y{4}/g, 'yyyy')
|
|
64
|
+
.replace(/Y{2}/g, 'yy')
|
|
65
|
+
.replace(/D{2}/g, 'dd')
|
|
66
|
+
.replace(/D{1}/g, 'd');
|
|
67
|
+
}
|
|
68
|
+
const mergedFormatRef = computed(() => normalizeFormat(props.format));
|
|
69
|
+
const uncontrolledValueRef = ref((_a = props.defaultValue) !== null && _a !== void 0 ? _a : null);
|
|
70
|
+
const controlledValueRef = toRef(props, 'value');
|
|
71
|
+
const mergedValueRef = useMergedState(controlledValueRef, uncontrolledValueRef);
|
|
72
|
+
// Состояние панели календаря
|
|
73
|
+
const now = Date.now();
|
|
74
|
+
const initialDate = computed(() => {
|
|
75
|
+
const value = mergedValueRef.value;
|
|
76
|
+
if (value === null || value === undefined)
|
|
77
|
+
return now;
|
|
78
|
+
return Array.isArray(value) ? value[0] : value;
|
|
79
|
+
});
|
|
80
|
+
const displayYearRef = ref(getYear(initialDate.value));
|
|
81
|
+
const displayMonthRef = ref(getMonth(initialDate.value));
|
|
82
|
+
const showYearDropdownRef = ref(false);
|
|
83
|
+
const singleInputValueRef = ref('');
|
|
84
|
+
const rangeStartInputValueRef = ref('');
|
|
85
|
+
const rangeEndInputValueRef = ref('');
|
|
86
|
+
const skipInputSyncRef = ref(false);
|
|
87
|
+
const rangeEditedPartRef = ref(null);
|
|
88
|
+
// Состояние для range
|
|
89
|
+
const isSelectingRef = ref(false);
|
|
90
|
+
const startDateRef = ref(null);
|
|
91
|
+
const endDateRef = ref(null);
|
|
92
|
+
const hoverDateRef = ref(null);
|
|
93
|
+
// Инициализация range из value
|
|
94
|
+
if (isRange.value && Array.isArray(mergedValueRef.value)) {
|
|
95
|
+
startDateRef.value = mergedValueRef.value[0];
|
|
96
|
+
endDateRef.value = mergedValueRef.value[1];
|
|
97
|
+
}
|
|
98
|
+
// Вычисляем текущий rangeValue для отображения (с preview)
|
|
99
|
+
const currentRangeValueRef = computed(() => {
|
|
100
|
+
var _a;
|
|
101
|
+
if (!isRange.value)
|
|
102
|
+
return null;
|
|
103
|
+
if (isSelectingRef.value && startDateRef.value !== null) {
|
|
104
|
+
// В процессе выбора - показываем preview
|
|
105
|
+
const start = startDateRef.value;
|
|
106
|
+
const end = (_a = hoverDateRef.value) !== null && _a !== void 0 ? _a : startDateRef.value;
|
|
107
|
+
return [Math.min(start, end), Math.max(start, end)];
|
|
108
|
+
}
|
|
109
|
+
if (startDateRef.value !== null && endDateRef.value !== null) {
|
|
110
|
+
return [startDateRef.value, endDateRef.value];
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
});
|
|
114
|
+
const singlePlaceholderRef = computed(() => {
|
|
115
|
+
var _a;
|
|
116
|
+
return (_a = props.placeholder) !== null && _a !== void 0 ? _a : localeRef.value.selectDate;
|
|
117
|
+
});
|
|
118
|
+
const startPlaceholderRef = computed(() => {
|
|
119
|
+
var _a;
|
|
120
|
+
return (_a = props.startPlaceholder) !== null && _a !== void 0 ? _a : localeRef.value.startDatePlaceholder;
|
|
121
|
+
});
|
|
122
|
+
const endPlaceholderRef = computed(() => {
|
|
123
|
+
var _a;
|
|
124
|
+
return (_a = props.endPlaceholder) !== null && _a !== void 0 ? _a : localeRef.value.endDatePlaceholder;
|
|
125
|
+
});
|
|
126
|
+
function syncInputValue(value) {
|
|
127
|
+
if (Array.isArray(value)) {
|
|
128
|
+
rangeStartInputValueRef.value =
|
|
129
|
+
value[0] === null || value[0] === undefined
|
|
130
|
+
? ''
|
|
131
|
+
: format(value[0], mergedFormatRef.value);
|
|
132
|
+
rangeEndInputValueRef.value =
|
|
133
|
+
value[1] === null || value[1] === undefined
|
|
134
|
+
? ''
|
|
135
|
+
: format(value[1], mergedFormatRef.value);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
singleInputValueRef.value =
|
|
139
|
+
value === null || value === undefined
|
|
140
|
+
? ''
|
|
141
|
+
: format(value, mergedFormatRef.value);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
watch(mergedValueRef, (value) => {
|
|
145
|
+
const skipSync = skipInputSyncRef.value;
|
|
146
|
+
if (skipSync) {
|
|
147
|
+
skipInputSyncRef.value = false;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
syncInputValue(value);
|
|
151
|
+
}
|
|
152
|
+
if (isRange.value &&
|
|
153
|
+
Array.isArray(value) &&
|
|
154
|
+
value.length >= 2 &&
|
|
155
|
+
value[0] != null &&
|
|
156
|
+
value[1] != null) {
|
|
157
|
+
startDateRef.value = value[0];
|
|
158
|
+
endDateRef.value = value[1];
|
|
159
|
+
}
|
|
160
|
+
else if (value === null ||
|
|
161
|
+
value === undefined ||
|
|
162
|
+
!Array.isArray(value)) {
|
|
163
|
+
startDateRef.value = null;
|
|
164
|
+
endDateRef.value = null;
|
|
165
|
+
}
|
|
166
|
+
if (value === null || value === undefined)
|
|
167
|
+
return;
|
|
168
|
+
const target = Array.isArray(value)
|
|
169
|
+
? rangeEditedPartRef.value === 'end' &&
|
|
170
|
+
value[1] !== null &&
|
|
171
|
+
value[1] !== undefined
|
|
172
|
+
? value[1]
|
|
173
|
+
: value[0]
|
|
174
|
+
: value;
|
|
175
|
+
if (target === null || target === undefined)
|
|
176
|
+
return;
|
|
177
|
+
displayYearRef.value = getYear(target);
|
|
178
|
+
displayMonthRef.value = getMonth(target);
|
|
179
|
+
if (mergedShowRef.value) {
|
|
180
|
+
setTimeout(() => {
|
|
181
|
+
if (panelRef.value) {
|
|
182
|
+
if (!showYearDropdownRef.value) {
|
|
183
|
+
panelRef.value.scrollToMonthInMonthList(displayYearRef.value, displayMonthRef.value);
|
|
184
|
+
}
|
|
185
|
+
panelRef.value.scrollToMonthInCalendar(displayMonthRef.value);
|
|
186
|
+
}
|
|
187
|
+
}, 50);
|
|
188
|
+
}
|
|
189
|
+
}, { immediate: true });
|
|
190
|
+
// merged isDateDisabled для одиночного режима (type='date')
|
|
191
|
+
function mergedIsDateDisabledSingle(ts) {
|
|
192
|
+
const fn = props.isDateDisabled;
|
|
193
|
+
if (!fn)
|
|
194
|
+
return false;
|
|
195
|
+
return fn(ts);
|
|
196
|
+
}
|
|
197
|
+
// merged isDateDisabled для диапазона (type='daterange')
|
|
198
|
+
function mergedIsDateDisabledRange(ts) {
|
|
199
|
+
var _a;
|
|
200
|
+
const fn = props.isDateDisabled;
|
|
201
|
+
if (!fn)
|
|
202
|
+
return false;
|
|
203
|
+
// если передали (date) => boolean — ведём себя как в single
|
|
204
|
+
if (fn.length <= 1) {
|
|
205
|
+
return fn(ts);
|
|
206
|
+
}
|
|
207
|
+
const rangeFn = fn;
|
|
208
|
+
const mergedValue = mergedValueRef.value;
|
|
209
|
+
if (!Array.isArray(mergedValue)) {
|
|
210
|
+
return rangeFn(ts, 'start', null);
|
|
211
|
+
}
|
|
212
|
+
if (!isSelectingRef.value) {
|
|
213
|
+
// как selectingPhaseRef === 'start' в старом компоненте
|
|
214
|
+
return rangeFn(ts, 'start', null);
|
|
215
|
+
}
|
|
216
|
+
const memorizedStart = (_a = startDateRef.value) !== null && _a !== void 0 ? _a : mergedValue[0];
|
|
217
|
+
if (memorizedStart == null) {
|
|
218
|
+
return rangeFn(ts, 'start', null);
|
|
219
|
+
}
|
|
220
|
+
if (ts < memorizedStart) {
|
|
221
|
+
return rangeFn(ts, 'start', [memorizedStart, memorizedStart]);
|
|
222
|
+
}
|
|
223
|
+
return rangeFn(ts, 'end', [memorizedStart, memorizedStart]);
|
|
224
|
+
}
|
|
225
|
+
const displayValueRef = computed(() => {
|
|
226
|
+
const value = mergedValueRef.value;
|
|
227
|
+
if (value === null || value === undefined)
|
|
228
|
+
return '';
|
|
229
|
+
if (Array.isArray(value))
|
|
230
|
+
return '';
|
|
231
|
+
return format(value, mergedFormatRef.value);
|
|
232
|
+
});
|
|
233
|
+
const displayStartValueRef = computed(() => {
|
|
234
|
+
const value = mergedValueRef.value;
|
|
235
|
+
if (!Array.isArray(value) || value === null || value === undefined) {
|
|
236
|
+
return '';
|
|
237
|
+
}
|
|
238
|
+
return format(value[0], mergedFormatRef.value);
|
|
239
|
+
});
|
|
240
|
+
const displayEndValueRef = computed(() => {
|
|
241
|
+
const value = mergedValueRef.value;
|
|
242
|
+
if (!Array.isArray(value) || value === null || value === undefined) {
|
|
243
|
+
return '';
|
|
244
|
+
}
|
|
245
|
+
return format(value[1], mergedFormatRef.value);
|
|
246
|
+
});
|
|
247
|
+
const triggerDisplayValueRef = computed(() => {
|
|
248
|
+
if (isRange.value) {
|
|
249
|
+
const start = displayStartValueRef.value || startPlaceholderRef.value;
|
|
250
|
+
const end = displayEndValueRef.value || endPlaceholderRef.value;
|
|
251
|
+
return `${start} — ${end}`;
|
|
252
|
+
}
|
|
253
|
+
return displayValueRef.value || singlePlaceholderRef.value;
|
|
254
|
+
});
|
|
255
|
+
const hasDisplayValueRef = computed(() => {
|
|
256
|
+
const value = mergedValueRef.value;
|
|
257
|
+
if (isRange.value) {
|
|
258
|
+
return Array.isArray(value) && (value[0] !== null || value[1] !== null);
|
|
259
|
+
}
|
|
260
|
+
return value !== null && value !== undefined;
|
|
261
|
+
});
|
|
262
|
+
const themeRef = useTheme('DatePickerV2', '-date-picker-v2', style, datePickerV2Light, props, mergedClsPrefixRef);
|
|
263
|
+
provide(datePickerV2InjectionKey, {
|
|
264
|
+
mergedClsPrefixRef,
|
|
265
|
+
mergedThemeRef: themeRef,
|
|
266
|
+
localeRef,
|
|
267
|
+
dateLocaleRef,
|
|
268
|
+
isDateDisabledRef: toRef(props, 'isDateDisabled')
|
|
269
|
+
});
|
|
270
|
+
function doUpdateShow(show) {
|
|
271
|
+
const { 'onUpdate:show': _onUpdateShow, onUpdateShow } = props;
|
|
272
|
+
if (_onUpdateShow)
|
|
273
|
+
call(_onUpdateShow, show);
|
|
274
|
+
if (onUpdateShow)
|
|
275
|
+
call(onUpdateShow, show);
|
|
276
|
+
uncontrolledShowRef.value = show;
|
|
277
|
+
}
|
|
278
|
+
function doUpdateValue(value) {
|
|
279
|
+
const { 'onUpdate:value': _onUpdateValue, onUpdateValue } = props;
|
|
280
|
+
const { triggerFormChange, triggerFormInput } = formItem;
|
|
281
|
+
if (_onUpdateValue)
|
|
282
|
+
call(_onUpdateValue, value);
|
|
283
|
+
if (onUpdateValue)
|
|
284
|
+
call(onUpdateValue, value);
|
|
285
|
+
uncontrolledValueRef.value = value;
|
|
286
|
+
triggerFormChange();
|
|
287
|
+
triggerFormInput();
|
|
288
|
+
}
|
|
289
|
+
function doFocus(e) {
|
|
290
|
+
const { onFocus } = props;
|
|
291
|
+
const { triggerFormFocus } = formItem;
|
|
292
|
+
if (onFocus)
|
|
293
|
+
call(onFocus, e);
|
|
294
|
+
triggerFormFocus();
|
|
295
|
+
}
|
|
296
|
+
function doBlur(e) {
|
|
297
|
+
const { onBlur } = props;
|
|
298
|
+
const { triggerFormBlur } = formItem;
|
|
299
|
+
if (onBlur)
|
|
300
|
+
call(onBlur, e);
|
|
301
|
+
triggerFormBlur();
|
|
302
|
+
}
|
|
303
|
+
function handleTriggerClick() {
|
|
304
|
+
if (mergedDisabledRef.value)
|
|
305
|
+
return;
|
|
306
|
+
if (!mergedShowRef.value) {
|
|
307
|
+
doUpdateShow(true);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function handleInputFocus(e) {
|
|
311
|
+
if (mergedDisabledRef.value)
|
|
312
|
+
return;
|
|
313
|
+
doFocus(e);
|
|
314
|
+
}
|
|
315
|
+
function handleInputBlur(e) {
|
|
316
|
+
doBlur(e);
|
|
317
|
+
}
|
|
318
|
+
function handleClickOutside(e) {
|
|
319
|
+
var _a;
|
|
320
|
+
if (mergedShowRef.value &&
|
|
321
|
+
!((_a = triggerElRef.value) === null || _a === void 0 ? void 0 : _a.contains(getPreciseEventTarget(e)))) {
|
|
322
|
+
doUpdateShow(false);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function handleClear() {
|
|
326
|
+
doUpdateValue(null);
|
|
327
|
+
doUpdateShow(false);
|
|
328
|
+
singleInputValueRef.value = '';
|
|
329
|
+
rangeStartInputValueRef.value = '';
|
|
330
|
+
rangeEndInputValueRef.value = '';
|
|
331
|
+
// Сброс состояния range
|
|
332
|
+
if (isRange.value) {
|
|
333
|
+
isSelectingRef.value = false;
|
|
334
|
+
startDateRef.value = null;
|
|
335
|
+
endDateRef.value = null;
|
|
336
|
+
hoverDateRef.value = null;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function handleSelect(value) {
|
|
340
|
+
doUpdateValue(value);
|
|
341
|
+
doUpdateShow(false);
|
|
342
|
+
}
|
|
343
|
+
function handleKeydown(e) {
|
|
344
|
+
if (e.key === 'Escape' && mergedShowRef.value) {
|
|
345
|
+
doUpdateShow(false);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function strictParse(string, pattern, backup, option) {
|
|
349
|
+
const result = parse(string, pattern, backup, option);
|
|
350
|
+
if (!isValid(result))
|
|
351
|
+
return result;
|
|
352
|
+
if (format(result, pattern, option) === string)
|
|
353
|
+
return result;
|
|
354
|
+
return new Date(NaN);
|
|
355
|
+
}
|
|
356
|
+
function handleSingleUpdateValue(v) {
|
|
357
|
+
singleInputValueRef.value = v;
|
|
358
|
+
if (v === '') {
|
|
359
|
+
doUpdateValue(null);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const parsedDate = strictParse(v, mergedFormatRef.value, new Date(), dateFnsOptionsRef.value);
|
|
363
|
+
if (isValid(parsedDate)) {
|
|
364
|
+
skipInputSyncRef.value = true;
|
|
365
|
+
doUpdateValue(getTime(startOfDay(parsedDate)));
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
singleInputValueRef.value = v;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function focusRangeInputAndMoveCursorToEnd(which) {
|
|
372
|
+
void nextTick(() => {
|
|
373
|
+
var _a;
|
|
374
|
+
const inst = inputInstRef.value;
|
|
375
|
+
const ref = which === 'start' ? inst === null || inst === void 0 ? void 0 : inst.inputElRef : inst === null || inst === void 0 ? void 0 : inst.inputEl2Ref;
|
|
376
|
+
const el = ref
|
|
377
|
+
? typeof ref === 'object' && ref !== null && 'value' in ref
|
|
378
|
+
? ref.value
|
|
379
|
+
: ref
|
|
380
|
+
: undefined;
|
|
381
|
+
if (el === null || el === void 0 ? void 0 : el.focus) {
|
|
382
|
+
el.focus();
|
|
383
|
+
const len = (el.value || '').length;
|
|
384
|
+
(_a = el.setSelectionRange) === null || _a === void 0 ? void 0 : _a.call(el, len, len);
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
function handleRangeUpdateValue(v) {
|
|
389
|
+
const prevStart = rangeStartInputValueRef.value;
|
|
390
|
+
const prevEnd = rangeEndInputValueRef.value;
|
|
391
|
+
if (v[0] === '' && v[1] === '') {
|
|
392
|
+
doUpdateValue(null);
|
|
393
|
+
rangeStartInputValueRef.value = '';
|
|
394
|
+
rangeEndInputValueRef.value = '';
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const [startStr, endStr] = v;
|
|
398
|
+
const startDate = strictParse(startStr, mergedFormatRef.value, new Date(), dateFnsOptionsRef.value);
|
|
399
|
+
const endDate = strictParse(endStr, mergedFormatRef.value, new Date(), dateFnsOptionsRef.value);
|
|
400
|
+
const startValid = isValid(startDate);
|
|
401
|
+
const endValid = isValid(endDate);
|
|
402
|
+
const changedStart = startStr !== prevStart;
|
|
403
|
+
const changedEnd = endStr !== prevEnd;
|
|
404
|
+
if (changedStart)
|
|
405
|
+
rangeEditedPartRef.value = 'start';
|
|
406
|
+
if (changedEnd)
|
|
407
|
+
rangeEditedPartRef.value = 'end';
|
|
408
|
+
const startTs = startValid ? getTime(startOfDay(startDate)) : 0;
|
|
409
|
+
const endTs = endValid ? getTime(startOfDay(endDate)) : 0;
|
|
410
|
+
const rangeInvalid = startValid && endValid && endTs < startTs;
|
|
411
|
+
if (changedEnd && endValid && !rangeInvalid) {
|
|
412
|
+
displayYearRef.value = getYear(endTs);
|
|
413
|
+
displayMonthRef.value = getMonth(endTs);
|
|
414
|
+
}
|
|
415
|
+
else if (changedStart && startValid && !rangeInvalid) {
|
|
416
|
+
displayYearRef.value = getYear(startTs);
|
|
417
|
+
displayMonthRef.value = getMonth(startTs);
|
|
418
|
+
}
|
|
419
|
+
if (startValid && endValid && !rangeInvalid) {
|
|
420
|
+
;
|
|
421
|
+
[rangeStartInputValueRef.value, rangeEndInputValueRef.value] = v;
|
|
422
|
+
skipInputSyncRef.value = true;
|
|
423
|
+
doUpdateValue([startTs, endTs]);
|
|
424
|
+
if (mergedShowRef.value) {
|
|
425
|
+
setTimeout(() => {
|
|
426
|
+
if (panelRef.value) {
|
|
427
|
+
if (!showYearDropdownRef.value) {
|
|
428
|
+
panelRef.value.scrollToMonthInMonthList(displayYearRef.value, displayMonthRef.value);
|
|
429
|
+
}
|
|
430
|
+
panelRef.value.scrollToMonthInCalendar(displayMonthRef.value);
|
|
431
|
+
}
|
|
432
|
+
}, 50);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
else if (rangeInvalid) {
|
|
436
|
+
const currentValue = mergedValueRef.value;
|
|
437
|
+
const restoredStart = Array.isArray(currentValue) && currentValue[0] != null
|
|
438
|
+
? format(currentValue[0], mergedFormatRef.value)
|
|
439
|
+
: '';
|
|
440
|
+
const restoredEnd = Array.isArray(currentValue) && currentValue[1] != null
|
|
441
|
+
? format(currentValue[1], mergedFormatRef.value)
|
|
442
|
+
: '';
|
|
443
|
+
if (changedEnd) {
|
|
444
|
+
rangeEndInputValueRef.value = restoredEnd;
|
|
445
|
+
rangeStartInputValueRef.value = startStr;
|
|
446
|
+
focusRangeInputAndMoveCursorToEnd('end');
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
rangeStartInputValueRef.value = restoredStart;
|
|
450
|
+
rangeEndInputValueRef.value = endStr;
|
|
451
|
+
focusRangeInputAndMoveCursorToEnd('start');
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
;
|
|
456
|
+
[rangeStartInputValueRef.value, rangeEndInputValueRef.value] = v;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
// Обработчик ввода в инпут
|
|
460
|
+
function handleInputUpdateValue(value) {
|
|
461
|
+
if (isRange.value) {
|
|
462
|
+
if (!Array.isArray(value))
|
|
463
|
+
return;
|
|
464
|
+
handleRangeUpdateValue(value);
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
if (typeof value !== 'string')
|
|
468
|
+
return;
|
|
469
|
+
handleSingleUpdateValue(value);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
// Обработчики для панели календаря
|
|
473
|
+
function handleDateClick(ts) {
|
|
474
|
+
// Не даём кликать по disabled датам (учитываем single/range логику)
|
|
475
|
+
if (isRange.value) {
|
|
476
|
+
if (mergedIsDateDisabledRange(ts))
|
|
477
|
+
return;
|
|
478
|
+
// Логика для range
|
|
479
|
+
const normalizedTs = getTime(startOfDay(ts));
|
|
480
|
+
if (!isSelectingRef.value) {
|
|
481
|
+
// Первый клик - начинаем выбор
|
|
482
|
+
isSelectingRef.value = true;
|
|
483
|
+
startDateRef.value = normalizedTs;
|
|
484
|
+
endDateRef.value = null;
|
|
485
|
+
hoverDateRef.value = null;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
// Второй клик - завершаем выбор
|
|
489
|
+
isSelectingRef.value = false;
|
|
490
|
+
const start = startDateRef.value;
|
|
491
|
+
if (start === null)
|
|
492
|
+
return;
|
|
493
|
+
const end = normalizedTs;
|
|
494
|
+
// Устанавливаем правильный порядок
|
|
495
|
+
if (start <= end) {
|
|
496
|
+
startDateRef.value = start;
|
|
497
|
+
endDateRef.value = end;
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
startDateRef.value = end;
|
|
501
|
+
endDateRef.value = start;
|
|
502
|
+
}
|
|
503
|
+
hoverDateRef.value = null;
|
|
504
|
+
// Обновляем значение и закрываем
|
|
505
|
+
if (startDateRef.value !== null && endDateRef.value !== null) {
|
|
506
|
+
rangeEditedPartRef.value = 'end';
|
|
507
|
+
handleSelect([startDateRef.value, endDateRef.value]);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
if (mergedIsDateDisabledSingle(ts))
|
|
513
|
+
return;
|
|
514
|
+
// Логика для single date
|
|
515
|
+
handleSelect(ts);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
function handleDateMouseEnter(ts) {
|
|
519
|
+
if (isRange.value && isSelectingRef.value) {
|
|
520
|
+
hoverDateRef.value = getTime(startOfDay(ts));
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function handleMonthSelect(year, month) {
|
|
524
|
+
displayYearRef.value = year;
|
|
525
|
+
displayMonthRef.value = month;
|
|
526
|
+
// Скроллим к выбранному месяцу в календаре (ждём пока DOM обновится после смены года)
|
|
527
|
+
setTimeout(() => {
|
|
528
|
+
if (panelRef.value) {
|
|
529
|
+
panelRef.value.scrollToMonthInCalendar(month);
|
|
530
|
+
}
|
|
531
|
+
}, 50);
|
|
532
|
+
}
|
|
533
|
+
function handleYearSelect(year) {
|
|
534
|
+
displayYearRef.value = year;
|
|
535
|
+
showYearDropdownRef.value = false;
|
|
536
|
+
// После закрытия dropdown нужно проскроллить к выбранному году и месяцу
|
|
537
|
+
setTimeout(() => {
|
|
538
|
+
if (panelRef.value) {
|
|
539
|
+
panelRef.value.scrollToMonthInMonthList(year, displayMonthRef.value);
|
|
540
|
+
panelRef.value.scrollToMonthInCalendar(displayMonthRef.value);
|
|
541
|
+
}
|
|
542
|
+
}, 50);
|
|
543
|
+
}
|
|
544
|
+
function handleToggleYearDropdown() {
|
|
545
|
+
showYearDropdownRef.value = !showYearDropdownRef.value;
|
|
546
|
+
// При открытии dropdown скроллим к текущему году
|
|
547
|
+
setTimeout(() => {
|
|
548
|
+
if (panelRef.value) {
|
|
549
|
+
panelRef.value.scrollToYear(displayYearRef.value);
|
|
550
|
+
panelRef.value.scrollToMonthInMonthList(displayYearRef.value, displayMonthRef.value);
|
|
551
|
+
}
|
|
552
|
+
}, 50);
|
|
553
|
+
}
|
|
554
|
+
function handleMonthScroll(year) {
|
|
555
|
+
displayYearRef.value = year;
|
|
556
|
+
}
|
|
557
|
+
// Watch для открытия панели - скроллим к выбранному году и месяцу
|
|
558
|
+
watch(mergedShowRef, (newShow) => {
|
|
559
|
+
if (newShow) {
|
|
560
|
+
// Обновляем displayYear и displayMonth из выбранной даты (или текущей)
|
|
561
|
+
const targetDate = initialDate.value;
|
|
562
|
+
displayYearRef.value = getYear(targetDate);
|
|
563
|
+
displayMonthRef.value = getMonth(targetDate);
|
|
564
|
+
// Используем setTimeout чтобы дать время панели отрендериться
|
|
565
|
+
setTimeout(() => {
|
|
566
|
+
if (panelRef.value) {
|
|
567
|
+
// Скроллим к месяцу в списке месяцев (левая колонка)
|
|
568
|
+
if (!showYearDropdownRef.value) {
|
|
569
|
+
panelRef.value.scrollToMonthInMonthList(displayYearRef.value, displayMonthRef.value);
|
|
570
|
+
}
|
|
571
|
+
// Скроллим к месяцу в календаре (правая колонка - только 12 месяцев)
|
|
572
|
+
panelRef.value.scrollToMonthInCalendar(displayMonthRef.value);
|
|
573
|
+
}
|
|
574
|
+
}, 50);
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
const cssVarsRef = computed(() => {
|
|
578
|
+
const theme = themeRef.value;
|
|
579
|
+
const { common: { cubicBezierEaseInOut }, self: { panelColor, panelBoxShadow, panelBorderRadius, panelTextColor, dividerColor, itemTextColor, itemTextColorOtherMonth, itemTextColorDisabled, itemColorHover, itemColorActive, itemTextColorActive, itemColorIncluded, itemBorderRadius, iconColor, iconColorDisabled, weekdayTextColor, weekendTextColor, monthItemHeight, monthItemColorHover, monthItemColorActive, monthItemTextColorActive, yearTriggerColor, yearTriggerColorHover, yearTriggerTextColor, currentDateIndicatorColor } } = theme;
|
|
580
|
+
return {
|
|
581
|
+
'--u-bezier': cubicBezierEaseInOut,
|
|
582
|
+
'--u-panel-color': panelColor,
|
|
583
|
+
'--u-panel-box-shadow': panelBoxShadow,
|
|
584
|
+
'--u-panel-border-radius': panelBorderRadius,
|
|
585
|
+
'--u-panel-text-color': panelTextColor,
|
|
586
|
+
'--u-divider-color': dividerColor,
|
|
587
|
+
'--u-item-text-color': itemTextColor,
|
|
588
|
+
'--u-item-text-color-other-month': itemTextColorOtherMonth,
|
|
589
|
+
'--u-item-text-color-disabled': itemTextColorDisabled,
|
|
590
|
+
'--u-item-color-hover': itemColorHover,
|
|
591
|
+
'--u-item-color-active': itemColorActive,
|
|
592
|
+
'--u-item-text-color-active': itemTextColorActive,
|
|
593
|
+
'--u-item-color-included': itemColorIncluded,
|
|
594
|
+
'--u-item-border-radius': itemBorderRadius,
|
|
595
|
+
'--u-icon-color': iconColor,
|
|
596
|
+
'--u-icon-color-disabled': iconColorDisabled,
|
|
597
|
+
'--u-weekday-text-color': weekdayTextColor,
|
|
598
|
+
'--u-weekend-text-color': weekendTextColor,
|
|
599
|
+
'--u-month-item-height': monthItemHeight,
|
|
600
|
+
'--u-month-item-color-hover': monthItemColorHover,
|
|
601
|
+
'--u-month-item-color-active': monthItemColorActive,
|
|
602
|
+
'--u-month-item-text-color-active': monthItemTextColorActive,
|
|
603
|
+
'--u-year-trigger-color': yearTriggerColor,
|
|
604
|
+
'--u-year-trigger-color-hover': yearTriggerColorHover,
|
|
605
|
+
'--u-year-trigger-text-color': yearTriggerTextColor,
|
|
606
|
+
'--u-current-date-indicator-color': currentDateIndicatorColor
|
|
607
|
+
};
|
|
608
|
+
});
|
|
609
|
+
const themeClassHandle = inlineThemeDisabled
|
|
610
|
+
? useThemeClass('date-picker-v2', undefined, cssVarsRef, props)
|
|
611
|
+
: undefined;
|
|
612
|
+
return {
|
|
613
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
614
|
+
mergedBordered: mergedBorderedRef,
|
|
615
|
+
mergedDisabled: mergedDisabledRef,
|
|
616
|
+
mergedStatus: mergedStatusRef,
|
|
617
|
+
mergedSize: mergedSizeRef,
|
|
618
|
+
mergedShow: mergedShowRef,
|
|
619
|
+
mergedValue: mergedValueRef,
|
|
620
|
+
isRange,
|
|
621
|
+
displayValue: displayValueRef,
|
|
622
|
+
displayStartValue: displayStartValueRef,
|
|
623
|
+
displayEndValue: displayEndValueRef,
|
|
624
|
+
namespace: namespaceRef,
|
|
625
|
+
adjustedTo: useAdjustedTo(props),
|
|
626
|
+
isMounted: useIsMounted(),
|
|
627
|
+
triggerElRef,
|
|
628
|
+
inputInstRef,
|
|
629
|
+
panelRef,
|
|
630
|
+
mergedTheme: themeRef,
|
|
631
|
+
displayYear: displayYearRef,
|
|
632
|
+
displayMonth: displayMonthRef,
|
|
633
|
+
showYearDropdown: showYearDropdownRef,
|
|
634
|
+
currentRangeValue: currentRangeValueRef,
|
|
635
|
+
isSelecting: isSelectingRef,
|
|
636
|
+
handleTriggerClick,
|
|
637
|
+
handleInputFocus,
|
|
638
|
+
handleInputBlur,
|
|
639
|
+
handleClickOutside,
|
|
640
|
+
handleClear,
|
|
641
|
+
handleSelect,
|
|
642
|
+
handleKeydown,
|
|
643
|
+
handleInputUpdateValue,
|
|
644
|
+
handleSingleUpdateValue,
|
|
645
|
+
handleRangeUpdateValue,
|
|
646
|
+
handleDateClick,
|
|
647
|
+
handleDateMouseEnter,
|
|
648
|
+
handleMonthSelect,
|
|
649
|
+
handleYearSelect,
|
|
650
|
+
handleToggleYearDropdown,
|
|
651
|
+
handleMonthScroll,
|
|
652
|
+
mergedIsDateDisabledSingle,
|
|
653
|
+
mergedIsDateDisabledRange,
|
|
654
|
+
triggerDisplayValue: triggerDisplayValueRef,
|
|
655
|
+
hasDisplayValue: hasDisplayValueRef,
|
|
656
|
+
singlePlaceholder: singlePlaceholderRef,
|
|
657
|
+
startPlaceholder: startPlaceholderRef,
|
|
658
|
+
endPlaceholder: endPlaceholderRef,
|
|
659
|
+
singleInputValue: singleInputValueRef,
|
|
660
|
+
rangeStartInputValue: rangeStartInputValueRef,
|
|
661
|
+
rangeEndInputValue: rangeEndInputValueRef,
|
|
662
|
+
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
663
|
+
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
664
|
+
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
665
|
+
};
|
|
666
|
+
},
|
|
667
|
+
render() {
|
|
668
|
+
var _a;
|
|
669
|
+
const { mergedClsPrefix, clearable, isRange } = this;
|
|
670
|
+
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
671
|
+
const commonInputProps = {
|
|
672
|
+
bordered: this.mergedBordered,
|
|
673
|
+
round: this.round,
|
|
674
|
+
size: this.mergedSize,
|
|
675
|
+
passivelyActivated: true,
|
|
676
|
+
disabled: this.mergedDisabled,
|
|
677
|
+
readonly: this.inputReadonly || this.mergedDisabled,
|
|
678
|
+
clearable,
|
|
679
|
+
onClear: this.handleClear,
|
|
680
|
+
onClick: this.handleTriggerClick,
|
|
681
|
+
onFocus: this.handleInputFocus,
|
|
682
|
+
onBlur: this.handleInputBlur,
|
|
683
|
+
onUpdateValue: this.handleInputUpdateValue
|
|
684
|
+
};
|
|
685
|
+
return (h("div", { ref: "triggerElRef", class: [
|
|
686
|
+
`${mergedClsPrefix}-date-picker-v2`,
|
|
687
|
+
this.mergedDisabled && `${mergedClsPrefix}-date-picker-v2--disabled`,
|
|
688
|
+
isRange && `${mergedClsPrefix}-date-picker-v2--range`,
|
|
689
|
+
this.themeClass
|
|
690
|
+
], style: this.cssVars, onKeydown: this.handleKeydown },
|
|
691
|
+
h(VBinder, null, {
|
|
692
|
+
default: () => [
|
|
693
|
+
h(VTarget, null, {
|
|
694
|
+
default: () => {
|
|
695
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
696
|
+
if (this.$slots.trigger) {
|
|
697
|
+
return this.$slots.trigger({
|
|
698
|
+
open: this.handleTriggerClick,
|
|
699
|
+
value: this.triggerDisplayValue
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
if (this.triggerPreset === 'select') {
|
|
703
|
+
return (h(UInternalSelection, { ref: "inputInstRef", selectedOption: this.hasDisplayValue
|
|
704
|
+
? {
|
|
705
|
+
label: this.triggerDisplayValue,
|
|
706
|
+
value: this.triggerDisplayValue
|
|
707
|
+
}
|
|
708
|
+
: null, round: this.round, status: this.mergedStatus, clsPrefix: mergedClsPrefix, bordered: this.mergedBordered, size: this.mergedSize, theme: (_b = (_a = this.mergedTheme) === null || _a === void 0 ? void 0 : _a.peers) === null || _b === void 0 ? void 0 : _b.Select, themeOverrides: (_d = (_c = this.mergedTheme) === null || _c === void 0 ? void 0 : _c.peerOverrides) === null || _d === void 0 ? void 0 : _d.Select, placeholder: isRange
|
|
709
|
+
? `${this.startPlaceholder} — ${this.endPlaceholder}`
|
|
710
|
+
: this.singlePlaceholder, active: this.mergedShow, clearable: this.clearable, disabled: this.mergedDisabled, onFocus: this.handleInputFocus, onBlur: this.handleInputBlur, onClick: this.handleTriggerClick, onClear: this.handleClear }, {
|
|
711
|
+
arrow: () => { var _a, _b; return (_b = (_a = this.$slots).arrow) === null || _b === void 0 ? void 0 : _b.call(_a); }
|
|
712
|
+
}));
|
|
713
|
+
}
|
|
714
|
+
if (this.triggerPreset === 'button') {
|
|
715
|
+
return (h(UButton, { round: this.round, size: this.mergedSize, theme: (_f = (_e = this.mergedTheme) === null || _e === void 0 ? void 0 : _e.peers) === null || _f === void 0 ? void 0 : _f.Button, themeOverrides: (_h = (_g = this.mergedTheme) === null || _g === void 0 ? void 0 : _g.peerOverrides) === null || _h === void 0 ? void 0 : _h.Button, onClick: this.handleTriggerClick }, this.triggerDisplayValue));
|
|
716
|
+
}
|
|
717
|
+
return isRange ? (h(UInput, Object.assign({ ref: "inputInstRef", status: this.mergedStatus, value: [
|
|
718
|
+
this.rangeStartInputValue,
|
|
719
|
+
this.rangeEndInputValue
|
|
720
|
+
], placeholder: [
|
|
721
|
+
this.startPlaceholder,
|
|
722
|
+
this.endPlaceholder
|
|
723
|
+
], pair: true, theme: this.mergedTheme.peers.Input, themeOverrides: this.mergedTheme.peerOverrides.Input, internalForceFocus: this.mergedShow }, commonInputProps), {
|
|
724
|
+
separator: () => this.separator === undefined ? (h("span", { class: `${mergedClsPrefix}-date-picker-v2__separator` }, "\u2014")) : (this.separator),
|
|
725
|
+
[clearable ? 'clear-icon-placeholder' : 'suffix']: () => (h(UBaseIcon, { clsPrefix: mergedClsPrefix, class: `${mergedClsPrefix}-date-picker-v2-icon` }, { default: () => h(DateIcon, null) }))
|
|
726
|
+
})) : (h(UInput, Object.assign({ ref: "inputInstRef", status: this.mergedStatus, value: this.singleInputValue, placeholder: this.singlePlaceholder, theme: this.mergedTheme.peers.Input, themeOverrides: this.mergedTheme.peerOverrides.Input, internalForceFocus: this.mergedShow }, commonInputProps), {
|
|
727
|
+
[clearable ? 'clear-icon-placeholder' : 'suffix']: () => (h(UBaseIcon, { clsPrefix: mergedClsPrefix, class: `${mergedClsPrefix}-date-picker-v2-icon` }, { default: () => h(DateIcon, null) }))
|
|
728
|
+
}));
|
|
729
|
+
}
|
|
730
|
+
}),
|
|
731
|
+
h(VFollower, { show: this.mergedShow, containerClass: this.namespace, to: this.adjustedTo, teleportDisabled: this.adjustedTo === useAdjustedTo.tdkey, placement: this.placement }, {
|
|
732
|
+
default: () => (h(Transition, { name: "fade-in-scale-up-transition", appear: this.isMounted }, {
|
|
733
|
+
default: () => {
|
|
734
|
+
if (!this.mergedShow)
|
|
735
|
+
return null;
|
|
736
|
+
return withDirectives(isRange ? (h(CalendarRangePanel, { ref: "panelRef", value: this.currentRangeValue, displayYear: this.displayYear, displayMonth: this.displayMonth, showYearDropdown: this.showYearDropdown, isSelecting: this.isSelecting, isDateDisabled: this.mergedIsDateDisabledRange, onDateClick: this.handleDateClick, onDateMouseEnter: this.handleDateMouseEnter, onMonthSelect: this.handleMonthSelect, onYearSelect: this.handleYearSelect, onToggleYearDropdown: this.handleToggleYearDropdown, onMonthScroll: this.handleMonthScroll, style: this.cssVars, themeClass: this.themeClass })) : (h(CalendarPanel, { ref: "panelRef", value: this.mergedValue, displayYear: this.displayYear, displayMonth: this.displayMonth, showYearDropdown: this.showYearDropdown, isDateDisabled: this.mergedIsDateDisabledSingle, onDateClick: this.handleDateClick, onMonthSelect: this.handleMonthSelect, onYearSelect: this.handleYearSelect, onToggleYearDropdown: this.handleToggleYearDropdown, onMonthScroll: this.handleMonthScroll, style: this.cssVars, themeClass: this.themeClass })), [
|
|
737
|
+
[
|
|
738
|
+
clickoutside,
|
|
739
|
+
this.handleClickOutside,
|
|
740
|
+
undefined,
|
|
741
|
+
{ capture: true }
|
|
742
|
+
]
|
|
743
|
+
]);
|
|
744
|
+
}
|
|
745
|
+
}))
|
|
746
|
+
})
|
|
747
|
+
]
|
|
748
|
+
})));
|
|
749
|
+
}
|
|
750
|
+
});
|