vant 4.8.11 → 4.9.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/README.md +7 -5
- package/es/calendar/Calendar.d.ts +16 -10
- package/es/calendar/Calendar.mjs +83 -53
- package/es/calendar/CalendarHeader.d.ts +16 -1
- package/es/calendar/CalendarHeader.mjs +71 -7
- package/es/calendar/CalendarMonth.d.ts +6 -24
- package/es/calendar/CalendarMonth.mjs +6 -4
- package/es/calendar/index.css +1 -1
- package/es/calendar/index.d.ts +11 -7
- package/es/calendar/types.d.ts +4 -0
- package/es/calendar/utils.d.ts +6 -0
- package/es/calendar/utils.mjs +20 -0
- package/es/highlight/Highlight.mjs +7 -0
- package/es/image-preview/ImagePreviewItem.mjs +2 -0
- package/es/index-bar/IndexBar.mjs +10 -2
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/picker-group/PickerGroup.d.ts +13 -0
- package/es/picker-group/PickerGroup.mjs +5 -4
- package/es/picker-group/index.d.ts +9 -0
- package/es/utils/basic.d.ts +1 -1
- package/lib/calendar/Calendar.d.ts +16 -10
- package/lib/calendar/Calendar.js +82 -52
- package/lib/calendar/CalendarHeader.d.ts +16 -1
- package/lib/calendar/CalendarHeader.js +68 -4
- package/lib/calendar/CalendarMonth.d.ts +6 -24
- package/lib/calendar/CalendarMonth.js +6 -4
- package/lib/calendar/index.css +1 -1
- package/lib/calendar/index.d.ts +11 -7
- package/lib/calendar/types.d.ts +4 -0
- package/lib/calendar/utils.d.ts +6 -0
- package/lib/calendar/utils.js +20 -0
- package/lib/highlight/Highlight.js +7 -0
- package/lib/image-preview/ImagePreviewItem.js +2 -0
- package/lib/index-bar/IndexBar.js +10 -2
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/picker-group/PickerGroup.d.ts +13 -0
- package/lib/picker-group/PickerGroup.js +4 -3
- package/lib/picker-group/index.d.ts +9 -0
- package/lib/utils/basic.d.ts +1 -1
- package/lib/vant.cjs.js +193 -66
- package/lib/vant.es.js +193 -66
- package/lib/vant.js +194 -67
- package/lib/vant.min.js +3 -3
- package/lib/web-types.json +1 -1
- package/package.json +15 -15
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -226,7 +226,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
|
|
226
226
|
__reExport(stdin_exports, require("./tree-select"), module.exports);
|
227
227
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
228
228
|
__reExport(stdin_exports, require("./watermark"), module.exports);
|
229
|
-
const version = "4.
|
229
|
+
const version = "4.9.0";
|
230
230
|
function install(app) {
|
231
231
|
const components = [
|
232
232
|
import_action_bar.ActionBar,
|
@@ -11,6 +11,10 @@ export declare const pickerGroupProps: {
|
|
11
11
|
default: number;
|
12
12
|
};
|
13
13
|
nextStepText: StringConstructor;
|
14
|
+
showToolbar: {
|
15
|
+
type: BooleanConstructor;
|
16
|
+
default: true;
|
17
|
+
};
|
14
18
|
} & {
|
15
19
|
title: StringConstructor;
|
16
20
|
cancelButtonText: StringConstructor;
|
@@ -27,6 +31,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
27
31
|
default: number;
|
28
32
|
};
|
29
33
|
nextStepText: StringConstructor;
|
34
|
+
showToolbar: {
|
35
|
+
type: BooleanConstructor;
|
36
|
+
default: true;
|
37
|
+
};
|
30
38
|
} & {
|
31
39
|
title: StringConstructor;
|
32
40
|
cancelButtonText: StringConstructor;
|
@@ -41,6 +49,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
41
49
|
default: number;
|
42
50
|
};
|
43
51
|
nextStepText: StringConstructor;
|
52
|
+
showToolbar: {
|
53
|
+
type: BooleanConstructor;
|
54
|
+
default: true;
|
55
|
+
};
|
44
56
|
} & {
|
45
57
|
title: StringConstructor;
|
46
58
|
cancelButtonText: StringConstructor;
|
@@ -50,6 +62,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
50
62
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
51
63
|
"onUpdate:activeTab"?: ((...args: any[]) => any) | undefined;
|
52
64
|
}, {
|
65
|
+
showToolbar: boolean;
|
53
66
|
tabs: string[];
|
54
67
|
activeTab: string | number;
|
55
68
|
}, {}>;
|
@@ -45,7 +45,8 @@ const PICKER_GROUP_KEY = Symbol(name);
|
|
45
45
|
const pickerGroupProps = (0, import_utils.extend)({
|
46
46
|
tabs: (0, import_utils.makeArrayProp)(),
|
47
47
|
activeTab: (0, import_utils.makeNumericProp)(0),
|
48
|
-
nextStepText: String
|
48
|
+
nextStepText: String,
|
49
|
+
showToolbar: import_utils.truthProp
|
49
50
|
}, import_PickerToolbar.pickerToolbarProps);
|
50
51
|
var stdin_default = (0, import_vue2.defineComponent)({
|
51
52
|
name,
|
@@ -84,13 +85,13 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
84
85
|
const confirmButtonText = showNextButton() ? props.nextStepText : props.confirmButtonText;
|
85
86
|
return (0, import_vue.createVNode)("div", {
|
86
87
|
"class": bem()
|
87
|
-
}, [(0, import_vue.createVNode)(import_PickerToolbar.default, {
|
88
|
+
}, [props.showToolbar ? (0, import_vue.createVNode)(import_PickerToolbar.default, {
|
88
89
|
"title": props.title,
|
89
90
|
"cancelButtonText": props.cancelButtonText,
|
90
91
|
"confirmButtonText": confirmButtonText,
|
91
92
|
"onConfirm": onConfirm,
|
92
93
|
"onCancel": onCancel
|
93
|
-
}, (0, import_utils.pick)(slots, import_PickerToolbar.pickerToolbarSlots)), (0, import_vue.createVNode)(import_tabs.Tabs, {
|
94
|
+
}, (0, import_utils.pick)(slots, import_PickerToolbar.pickerToolbarSlots)) : null, (0, import_vue.createVNode)(import_tabs.Tabs, {
|
94
95
|
"active": activeTab.value,
|
95
96
|
"onUpdate:active": ($event) => activeTab.value = $event,
|
96
97
|
"class": bem("tabs"),
|
@@ -9,6 +9,10 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
|
|
9
9
|
default: number;
|
10
10
|
};
|
11
11
|
nextStepText: StringConstructor;
|
12
|
+
showToolbar: {
|
13
|
+
type: BooleanConstructor;
|
14
|
+
default: true;
|
15
|
+
};
|
12
16
|
} & {
|
13
17
|
title: StringConstructor;
|
14
18
|
cancelButtonText: StringConstructor;
|
@@ -23,6 +27,10 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
|
|
23
27
|
default: number;
|
24
28
|
};
|
25
29
|
nextStepText: StringConstructor;
|
30
|
+
showToolbar: {
|
31
|
+
type: BooleanConstructor;
|
32
|
+
default: true;
|
33
|
+
};
|
26
34
|
} & {
|
27
35
|
title: StringConstructor;
|
28
36
|
cancelButtonText: StringConstructor;
|
@@ -32,6 +40,7 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
|
|
32
40
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
33
41
|
"onUpdate:activeTab"?: ((...args: any[]) => any) | undefined;
|
34
42
|
}, {
|
43
|
+
showToolbar: boolean;
|
35
44
|
tabs: string[];
|
36
45
|
activeTab: string | number;
|
37
46
|
}, {}>>;
|
package/lib/utils/basic.d.ts
CHANGED
@@ -27,4 +27,4 @@ export type RequiredParams<T> = T extends (...args: infer P) => infer R ? (...ar
|
|
27
27
|
export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>, ignoreUndefined?: boolean): Writeable<Pick<T, U>>;
|
28
28
|
export declare const isSameValue: (newValue: unknown, oldValue: unknown) => boolean;
|
29
29
|
export declare const toArray: <T>(item: T | T[]) => T[];
|
30
|
-
export declare const flat: <T>(arr:
|
30
|
+
export declare const flat: <T>(arr: Array<T | T[]>) => T[];
|
package/lib/vant.cjs.js
CHANGED
@@ -3272,7 +3272,8 @@ const PICKER_GROUP_KEY = Symbol(name$1p);
|
|
3272
3272
|
const pickerGroupProps = extend({
|
3273
3273
|
tabs: makeArrayProp(),
|
3274
3274
|
activeTab: makeNumericProp(0),
|
3275
|
-
nextStepText: String
|
3275
|
+
nextStepText: String,
|
3276
|
+
showToolbar: truthProp
|
3276
3277
|
}, pickerToolbarProps);
|
3277
3278
|
var stdin_default$1A = vue.defineComponent({
|
3278
3279
|
name: name$1p,
|
@@ -3311,13 +3312,13 @@ var stdin_default$1A = vue.defineComponent({
|
|
3311
3312
|
const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
|
3312
3313
|
return vue.createVNode("div", {
|
3313
3314
|
"class": bem$1l()
|
3314
|
-
}, [vue.createVNode(stdin_default$1H, {
|
3315
|
+
}, [props2.showToolbar ? vue.createVNode(stdin_default$1H, {
|
3315
3316
|
"title": props2.title,
|
3316
3317
|
"cancelButtonText": props2.cancelButtonText,
|
3317
3318
|
"confirmButtonText": confirmButtonText,
|
3318
3319
|
"onConfirm": onConfirm,
|
3319
3320
|
"onCancel": onCancel
|
3320
|
-
}, pick(slots, pickerToolbarSlots)), vue.createVNode(Tabs, {
|
3321
|
+
}, pick(slots, pickerToolbarSlots)) : null, vue.createVNode(Tabs, {
|
3321
3322
|
"active": activeTab.value,
|
3322
3323
|
"onUpdate:active": ($event) => activeTab.value = $event,
|
3323
3324
|
"class": bem$1l("tabs"),
|
@@ -6154,8 +6155,22 @@ function getDayByOffset(date, offset) {
|
|
6154
6155
|
cloned.setDate(cloned.getDate() + offset);
|
6155
6156
|
return cloned;
|
6156
6157
|
}
|
6158
|
+
function getMonthByOffset(date, offset) {
|
6159
|
+
const cloned = cloneDate(date);
|
6160
|
+
cloned.setMonth(cloned.getMonth() + offset);
|
6161
|
+
return cloned;
|
6162
|
+
}
|
6163
|
+
function getYearByOffset(date, offset) {
|
6164
|
+
const cloned = cloneDate(date);
|
6165
|
+
cloned.setFullYear(cloned.getFullYear() + offset);
|
6166
|
+
return cloned;
|
6167
|
+
}
|
6157
6168
|
const getPrevDay = (date) => getDayByOffset(date, -1);
|
6158
6169
|
const getNextDay = (date) => getDayByOffset(date, 1);
|
6170
|
+
const getPrevMonth = (date) => getMonthByOffset(date, -1);
|
6171
|
+
const getNextMonth = (date) => getMonthByOffset(date, 1);
|
6172
|
+
const getPrevYear = (date) => getYearByOffset(date, -1);
|
6173
|
+
const getNextYear = (date) => getYearByOffset(date, 1);
|
6159
6174
|
const getToday = () => {
|
6160
6175
|
const today = /* @__PURE__ */ new Date();
|
6161
6176
|
today.setHours(0, 0, 0, 0);
|
@@ -6335,8 +6350,8 @@ const calendarMonthProps = {
|
|
6335
6350
|
date: makeRequiredProp(Date),
|
6336
6351
|
type: String,
|
6337
6352
|
color: String,
|
6338
|
-
minDate:
|
6339
|
-
maxDate:
|
6353
|
+
minDate: Date,
|
6354
|
+
maxDate: Date,
|
6340
6355
|
showMark: Boolean,
|
6341
6356
|
rowHeight: numericProp,
|
6342
6357
|
formatter: Function,
|
@@ -6362,7 +6377,9 @@ var stdin_default$1h = vue.defineComponent({
|
|
6362
6377
|
const title = vue.computed(() => formatMonthTitle(props2.date));
|
6363
6378
|
const rowHeight = vue.computed(() => addUnit(props2.rowHeight));
|
6364
6379
|
const offset = vue.computed(() => {
|
6365
|
-
const
|
6380
|
+
const date = props2.date.getDate();
|
6381
|
+
const day = props2.date.getDay();
|
6382
|
+
const realDay = (day - date % 7 + 8) % 7;
|
6366
6383
|
if (props2.firstDayOfWeek) {
|
6367
6384
|
return (realDay + 7 - props2.firstDayOfWeek) % 7;
|
6368
6385
|
}
|
@@ -6422,7 +6439,7 @@ var stdin_default$1h = vue.defineComponent({
|
|
6422
6439
|
maxDate,
|
6423
6440
|
currentDate
|
6424
6441
|
} = props2;
|
6425
|
-
if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
|
6442
|
+
if (minDate && compareDay(day, minDate) < 0 || maxDate && compareDay(day, maxDate) > 0) {
|
6426
6443
|
return "disabled";
|
6427
6444
|
}
|
6428
6445
|
if (currentDate === null) {
|
@@ -6535,17 +6552,36 @@ var stdin_default$1g = vue.defineComponent({
|
|
6535
6552
|
name: name$16,
|
6536
6553
|
props: {
|
6537
6554
|
date: Date,
|
6555
|
+
minDate: Date,
|
6556
|
+
maxDate: Date,
|
6538
6557
|
title: String,
|
6539
6558
|
subtitle: String,
|
6540
6559
|
showTitle: Boolean,
|
6541
6560
|
showSubtitle: Boolean,
|
6542
|
-
firstDayOfWeek: Number
|
6561
|
+
firstDayOfWeek: Number,
|
6562
|
+
switchMode: makeStringProp("none")
|
6543
6563
|
},
|
6544
|
-
emits: ["clickSubtitle"],
|
6564
|
+
emits: ["clickSubtitle", "panelChange"],
|
6545
6565
|
setup(props2, {
|
6546
6566
|
slots,
|
6547
6567
|
emit
|
6548
6568
|
}) {
|
6569
|
+
const prevMonthDisabled = vue.computed(() => {
|
6570
|
+
const prevMonth = getPrevMonth(props2.date);
|
6571
|
+
return props2.minDate && prevMonth < props2.minDate;
|
6572
|
+
});
|
6573
|
+
const prevYearDisabled = vue.computed(() => {
|
6574
|
+
const prevYear = getPrevYear(props2.date);
|
6575
|
+
return props2.minDate && prevYear < props2.minDate;
|
6576
|
+
});
|
6577
|
+
const nextMonthDisabled = vue.computed(() => {
|
6578
|
+
const nextMonth = getNextMonth(props2.date);
|
6579
|
+
return props2.maxDate && nextMonth > props2.maxDate;
|
6580
|
+
});
|
6581
|
+
const nextYearDisabled = vue.computed(() => {
|
6582
|
+
const nextYear = getNextYear(props2.date);
|
6583
|
+
return props2.maxDate && nextYear > props2.maxDate;
|
6584
|
+
});
|
6549
6585
|
const renderTitle = () => {
|
6550
6586
|
if (props2.showTitle) {
|
6551
6587
|
const text = props2.title || t$g("title");
|
@@ -6556,16 +6592,60 @@ var stdin_default$1g = vue.defineComponent({
|
|
6556
6592
|
}
|
6557
6593
|
};
|
6558
6594
|
const onClickSubtitle = (event) => emit("clickSubtitle", event);
|
6595
|
+
const onPanelChange = (date) => emit("panelChange", date);
|
6596
|
+
const renderAction = (isNext) => {
|
6597
|
+
const showYearAction = props2.switchMode === "year-month";
|
6598
|
+
const monthSlot = slots[isNext ? "next-month" : "prev-month"];
|
6599
|
+
const yearSlot = slots[isNext ? "next-year" : "prev-year"];
|
6600
|
+
const monthDisabled = isNext ? nextMonthDisabled.value : prevMonthDisabled.value;
|
6601
|
+
const yearDisabled = isNext ? nextYearDisabled.value : prevYearDisabled.value;
|
6602
|
+
const monthIconName = isNext ? "arrow" : "arrow-left";
|
6603
|
+
const yearIconName = isNext ? "arrow-double-right" : "arrow-double-left";
|
6604
|
+
const onMonthChange = () => onPanelChange((isNext ? getNextMonth : getPrevMonth)(props2.date));
|
6605
|
+
const onYearChange = () => onPanelChange((isNext ? getNextYear : getPrevYear)(props2.date));
|
6606
|
+
const MonthAction = vue.createVNode("view", {
|
6607
|
+
"class": bem$15("header-action", {
|
6608
|
+
disabled: monthDisabled
|
6609
|
+
}),
|
6610
|
+
"onClick": monthDisabled ? void 0 : onMonthChange
|
6611
|
+
}, [monthSlot ? monthSlot({
|
6612
|
+
disabled: monthDisabled
|
6613
|
+
}) : vue.createVNode(Icon, {
|
6614
|
+
"class": {
|
6615
|
+
[HAPTICS_FEEDBACK]: !monthDisabled
|
6616
|
+
},
|
6617
|
+
"name": monthIconName
|
6618
|
+
}, null)]);
|
6619
|
+
const YearAction = showYearAction && vue.createVNode("view", {
|
6620
|
+
"class": bem$15("header-action", {
|
6621
|
+
disabled: yearDisabled
|
6622
|
+
}),
|
6623
|
+
"onClick": yearDisabled ? void 0 : onYearChange
|
6624
|
+
}, [yearSlot ? yearSlot({
|
6625
|
+
disabled: yearDisabled
|
6626
|
+
}) : vue.createVNode(Icon, {
|
6627
|
+
"class": {
|
6628
|
+
[HAPTICS_FEEDBACK]: !yearDisabled
|
6629
|
+
},
|
6630
|
+
"name": yearIconName
|
6631
|
+
}, null)]);
|
6632
|
+
return isNext ? [MonthAction, YearAction] : [YearAction, MonthAction];
|
6633
|
+
};
|
6559
6634
|
const renderSubtitle = () => {
|
6560
6635
|
if (props2.showSubtitle) {
|
6561
6636
|
const title = slots.subtitle ? slots.subtitle({
|
6562
6637
|
date: props2.date,
|
6563
6638
|
text: props2.subtitle
|
6564
6639
|
}) : props2.subtitle;
|
6640
|
+
const canSwitch = props2.switchMode !== "none";
|
6565
6641
|
return vue.createVNode("div", {
|
6566
|
-
"class": bem$15("header-subtitle"
|
6642
|
+
"class": bem$15("header-subtitle", {
|
6643
|
+
"with-swicth": canSwitch
|
6644
|
+
}),
|
6567
6645
|
"onClick": onClickSubtitle
|
6568
|
-
}, [
|
6646
|
+
}, [canSwitch ? [renderAction(), vue.createVNode("div", {
|
6647
|
+
"class": bem$15("header-subtitle-text")
|
6648
|
+
}, [title]), renderAction(true)] : title]);
|
6569
6649
|
}
|
6570
6650
|
};
|
6571
6651
|
const renderWeekDays = () => {
|
@@ -6588,6 +6668,7 @@ var stdin_default$1g = vue.defineComponent({
|
|
6588
6668
|
const calendarProps = {
|
6589
6669
|
show: Boolean,
|
6590
6670
|
type: makeStringProp("single"),
|
6671
|
+
switchMode: makeStringProp("none"),
|
6591
6672
|
title: String,
|
6592
6673
|
color: String,
|
6593
6674
|
round: truthProp,
|
@@ -6615,16 +6696,11 @@ const calendarProps = {
|
|
6615
6696
|
safeAreaInsetBottom: truthProp,
|
6616
6697
|
minDate: {
|
6617
6698
|
type: Date,
|
6618
|
-
validator: isDate
|
6619
|
-
default: getToday
|
6699
|
+
validator: isDate
|
6620
6700
|
},
|
6621
6701
|
maxDate: {
|
6622
6702
|
type: Date,
|
6623
|
-
validator: isDate
|
6624
|
-
default: () => {
|
6625
|
-
const now = getToday();
|
6626
|
-
return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
|
6627
|
-
}
|
6703
|
+
validator: isDate
|
6628
6704
|
},
|
6629
6705
|
firstDayOfWeek: {
|
6630
6706
|
type: numericProp,
|
@@ -6635,25 +6711,36 @@ const calendarProps = {
|
|
6635
6711
|
var stdin_default$1f = vue.defineComponent({
|
6636
6712
|
name: name$19,
|
6637
6713
|
props: calendarProps,
|
6638
|
-
emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate"],
|
6714
|
+
emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate", "panelChange"],
|
6639
6715
|
setup(props2, {
|
6640
6716
|
emit,
|
6641
6717
|
slots
|
6642
6718
|
}) {
|
6643
|
-
const
|
6644
|
-
|
6645
|
-
|
6719
|
+
const canSwitch = vue.computed(() => props2.switchMode !== "none");
|
6720
|
+
const minDate = vue.computed(() => {
|
6721
|
+
if (!props2.minDate && !canSwitch.value) {
|
6722
|
+
return getToday();
|
6723
|
+
}
|
6724
|
+
return props2.minDate;
|
6725
|
+
});
|
6726
|
+
const maxDate = vue.computed(() => {
|
6727
|
+
if (!props2.maxDate && !canSwitch.value) {
|
6728
|
+
return getMonthByOffset(getToday(), 6);
|
6729
|
+
}
|
6730
|
+
return props2.maxDate;
|
6731
|
+
});
|
6732
|
+
const limitDateRange = (date, min = minDate.value, max = maxDate.value) => {
|
6733
|
+
if (min && compareDay(date, min) === -1) {
|
6734
|
+
return min;
|
6646
6735
|
}
|
6647
|
-
if (compareDay(date,
|
6648
|
-
return
|
6736
|
+
if (max && compareDay(date, max) === 1) {
|
6737
|
+
return max;
|
6649
6738
|
}
|
6650
6739
|
return date;
|
6651
6740
|
};
|
6652
6741
|
const getInitialDate = (defaultDate = props2.defaultDate) => {
|
6653
6742
|
const {
|
6654
6743
|
type,
|
6655
|
-
minDate,
|
6656
|
-
maxDate,
|
6657
6744
|
allowSameDay
|
6658
6745
|
} = props2;
|
6659
6746
|
if (defaultDate === null) {
|
@@ -6664,8 +6751,10 @@ var stdin_default$1f = vue.defineComponent({
|
|
6664
6751
|
if (!Array.isArray(defaultDate)) {
|
6665
6752
|
defaultDate = [];
|
6666
6753
|
}
|
6667
|
-
const
|
6668
|
-
const
|
6754
|
+
const min = minDate.value;
|
6755
|
+
const max = maxDate.value;
|
6756
|
+
const start = limitDateRange(defaultDate[0] || now, min, max ? allowSameDay ? max : getPrevDay(max) : void 0);
|
6757
|
+
const end = limitDateRange(defaultDate[1] || (allowSameDay ? now : getNextDay(now)), min ? allowSameDay ? min : getNextDay(min) : void 0);
|
6669
6758
|
return [start, end];
|
6670
6759
|
}
|
6671
6760
|
if (type === "multiple") {
|
@@ -6679,23 +6768,28 @@ var stdin_default$1f = vue.defineComponent({
|
|
6679
6768
|
}
|
6680
6769
|
return limitDateRange(defaultDate);
|
6681
6770
|
};
|
6771
|
+
const getInitialPanelDate = () => {
|
6772
|
+
const date = Array.isArray(currentDate.value) ? currentDate.value[0] : currentDate.value;
|
6773
|
+
return date ? date : limitDateRange(getToday());
|
6774
|
+
};
|
6682
6775
|
let bodyHeight;
|
6683
6776
|
const bodyRef = vue.ref();
|
6684
|
-
const subtitle = vue.ref({
|
6685
|
-
textFn: () => "",
|
6686
|
-
date: void 0
|
6687
|
-
});
|
6688
6777
|
const currentDate = vue.ref(getInitialDate());
|
6778
|
+
const currentPanelDate = vue.ref(getInitialPanelDate());
|
6779
|
+
const currentMonthRef = vue.ref();
|
6689
6780
|
const [monthRefs, setMonthRefs] = useRefs();
|
6690
6781
|
const dayOffset = vue.computed(() => props2.firstDayOfWeek ? +props2.firstDayOfWeek % 7 : 0);
|
6691
6782
|
const months = vue.computed(() => {
|
6692
6783
|
const months2 = [];
|
6693
|
-
|
6784
|
+
if (!minDate.value || !maxDate.value) {
|
6785
|
+
return months2;
|
6786
|
+
}
|
6787
|
+
const cursor = new Date(minDate.value);
|
6694
6788
|
cursor.setDate(1);
|
6695
6789
|
do {
|
6696
6790
|
months2.push(new Date(cursor));
|
6697
6791
|
cursor.setMonth(cursor.getMonth() + 1);
|
6698
|
-
} while (compareMonth(cursor,
|
6792
|
+
} while (compareMonth(cursor, maxDate.value) !== 1);
|
6699
6793
|
return months2;
|
6700
6794
|
});
|
6701
6795
|
const buttonDisabled = vue.computed(() => {
|
@@ -6745,25 +6839,26 @@ var stdin_default$1f = vue.defineComponent({
|
|
6745
6839
|
monthRefs.value[index].setVisible(visible);
|
6746
6840
|
});
|
6747
6841
|
if (currentMonth) {
|
6748
|
-
|
6749
|
-
textFn: currentMonth.getTitle,
|
6750
|
-
date: currentMonth.date
|
6751
|
-
};
|
6842
|
+
currentMonthRef.value = currentMonth;
|
6752
6843
|
}
|
6753
6844
|
};
|
6754
6845
|
const scrollToDate = (targetDate) => {
|
6755
|
-
|
6756
|
-
|
6757
|
-
|
6758
|
-
|
6759
|
-
|
6846
|
+
if (canSwitch.value) {
|
6847
|
+
currentPanelDate.value = targetDate;
|
6848
|
+
} else {
|
6849
|
+
use.raf(() => {
|
6850
|
+
months.value.some((month, index) => {
|
6851
|
+
if (compareMonth(month, targetDate) === 0) {
|
6852
|
+
if (bodyRef.value) {
|
6853
|
+
monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
|
6854
|
+
}
|
6855
|
+
return true;
|
6760
6856
|
}
|
6761
|
-
return
|
6762
|
-
}
|
6763
|
-
|
6857
|
+
return false;
|
6858
|
+
});
|
6859
|
+
onScroll();
|
6764
6860
|
});
|
6765
|
-
|
6766
|
-
});
|
6861
|
+
}
|
6767
6862
|
};
|
6768
6863
|
const scrollToCurrentDate = () => {
|
6769
6864
|
if (props2.poppable && !props2.show) {
|
@@ -6774,7 +6869,7 @@ var stdin_default$1f = vue.defineComponent({
|
|
6774
6869
|
if (isDate(targetDate)) {
|
6775
6870
|
scrollToDate(targetDate);
|
6776
6871
|
}
|
6777
|
-
} else {
|
6872
|
+
} else if (!canSwitch.value) {
|
6778
6873
|
use.raf(onScroll);
|
6779
6874
|
}
|
6780
6875
|
};
|
@@ -6782,9 +6877,11 @@ var stdin_default$1f = vue.defineComponent({
|
|
6782
6877
|
if (props2.poppable && !props2.show) {
|
6783
6878
|
return;
|
6784
6879
|
}
|
6785
|
-
|
6786
|
-
|
6787
|
-
|
6880
|
+
if (!canSwitch.value) {
|
6881
|
+
use.raf(() => {
|
6882
|
+
bodyHeight = Math.floor(use.useRect(bodyRef).height);
|
6883
|
+
});
|
6884
|
+
}
|
6788
6885
|
scrollToCurrentDate();
|
6789
6886
|
};
|
6790
6887
|
const reset = (date = getInitialDate()) => {
|
@@ -6806,6 +6903,12 @@ var stdin_default$1f = vue.defineComponent({
|
|
6806
6903
|
}
|
6807
6904
|
return true;
|
6808
6905
|
};
|
6906
|
+
const onPanelChange = (date) => {
|
6907
|
+
currentPanelDate.value = date;
|
6908
|
+
emit("panelChange", {
|
6909
|
+
date
|
6910
|
+
});
|
6911
|
+
};
|
6809
6912
|
const onConfirm = () => {
|
6810
6913
|
var _a;
|
6811
6914
|
return emit("confirm", (_a = currentDate.value) != null ? _a : cloneDates(currentDate.value));
|
@@ -6897,12 +7000,15 @@ var stdin_default$1f = vue.defineComponent({
|
|
6897
7000
|
const renderMonth = (date, index) => {
|
6898
7001
|
const showMonthTitle = index !== 0 || !props2.showSubtitle;
|
6899
7002
|
return vue.createVNode(stdin_default$1h, vue.mergeProps({
|
6900
|
-
"ref": setMonthRefs(index),
|
7003
|
+
"ref": canSwitch.value ? currentMonthRef : setMonthRefs(index),
|
6901
7004
|
"date": date,
|
6902
7005
|
"currentDate": currentDate.value,
|
6903
7006
|
"showMonthTitle": showMonthTitle,
|
6904
|
-
"firstDayOfWeek": dayOffset.value
|
6905
|
-
|
7007
|
+
"firstDayOfWeek": dayOffset.value,
|
7008
|
+
"lazyRender": canSwitch.value ? false : props2.lazyRender,
|
7009
|
+
"maxDate": maxDate.value,
|
7010
|
+
"minDate": minDate.value
|
7011
|
+
}, pick(props2, ["type", "color", "showMark", "formatter", "rowHeight", "showSubtitle", "allowSameDay"]), {
|
6906
7012
|
"onClick": onClickDay,
|
6907
7013
|
"onClickDisabledDate": (item) => emit("clickDisabledDate", item)
|
6908
7014
|
}), pick(slots, ["top-info", "bottom-info", "month-title"]));
|
@@ -6937,25 +7043,29 @@ var stdin_default$1f = vue.defineComponent({
|
|
6937
7043
|
}]
|
6938
7044
|
}, [renderFooterButton()]);
|
6939
7045
|
const renderCalendar = () => {
|
6940
|
-
|
7046
|
+
var _a, _b;
|
6941
7047
|
return vue.createVNode("div", {
|
6942
7048
|
"class": bem$15()
|
6943
7049
|
}, [vue.createVNode(stdin_default$1g, {
|
6944
|
-
"date":
|
7050
|
+
"date": (_a = currentMonthRef.value) == null ? void 0 : _a.date,
|
7051
|
+
"maxDate": maxDate.value,
|
7052
|
+
"minDate": minDate.value,
|
6945
7053
|
"title": props2.title,
|
6946
|
-
"subtitle":
|
7054
|
+
"subtitle": (_b = currentMonthRef.value) == null ? void 0 : _b.getTitle(),
|
6947
7055
|
"showTitle": props2.showTitle,
|
6948
7056
|
"showSubtitle": props2.showSubtitle,
|
7057
|
+
"switchMode": props2.switchMode,
|
6949
7058
|
"firstDayOfWeek": dayOffset.value,
|
6950
|
-
"onClickSubtitle": (event) => emit("clickSubtitle", event)
|
6951
|
-
|
7059
|
+
"onClickSubtitle": (event) => emit("clickSubtitle", event),
|
7060
|
+
"onPanelChange": onPanelChange
|
7061
|
+
}, pick(slots, ["title", "subtitle", "prev-month", "prev-year", "next-month", "next-year"])), vue.createVNode("div", {
|
6952
7062
|
"ref": bodyRef,
|
6953
7063
|
"class": bem$15("body"),
|
6954
|
-
"onScroll": onScroll
|
6955
|
-
}, [months.value.map(renderMonth)]), renderFooter()]);
|
7064
|
+
"onScroll": canSwitch.value ? void 0 : onScroll
|
7065
|
+
}, [canSwitch.value ? renderMonth(currentPanelDate.value, 0) : months.value.map(renderMonth)]), renderFooter()]);
|
6956
7066
|
};
|
6957
7067
|
vue.watch(() => props2.show, init);
|
6958
|
-
vue.watch(() => [props2.type, props2.minDate, props2.maxDate], () => reset(getInitialDate(currentDate.value)));
|
7068
|
+
vue.watch(() => [props2.type, props2.minDate, props2.maxDate, props2.switchMode], () => reset(getInitialDate(currentDate.value)));
|
6959
7069
|
vue.watch(() => props2.defaultDate, (value = null) => {
|
6960
7070
|
currentDate.value = value;
|
6961
7071
|
scrollToCurrentDate();
|
@@ -10482,6 +10592,13 @@ var stdin_default$O = vue.defineComponent({
|
|
10482
10592
|
return chunks2;
|
10483
10593
|
}, []);
|
10484
10594
|
const lastChunk = chunks[chunks.length - 1];
|
10595
|
+
if (!lastChunk) {
|
10596
|
+
chunks.push({
|
10597
|
+
start: 0,
|
10598
|
+
end: sourceString.length,
|
10599
|
+
highlight: false
|
10600
|
+
});
|
10601
|
+
}
|
10485
10602
|
if (lastChunk && lastChunk.end < sourceString.length) {
|
10486
10603
|
chunks.push({
|
10487
10604
|
start: lastChunk.end,
|
@@ -10717,6 +10834,8 @@ var stdin_default$N = vue.defineComponent({
|
|
10717
10834
|
const checkClose = (event) => {
|
10718
10835
|
var _a;
|
10719
10836
|
const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
|
10837
|
+
if (!swipeItemEl)
|
10838
|
+
return;
|
10720
10839
|
const imageEl = swipeItemEl.firstElementChild;
|
10721
10840
|
const isClickOverlay = event.target === swipeItemEl;
|
10722
10841
|
const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
|
@@ -11186,7 +11305,11 @@ var stdin_default$L = vue.defineComponent({
|
|
11186
11305
|
const match = getMatchAnchor(selectActiveIndex);
|
11187
11306
|
if (match) {
|
11188
11307
|
const rect = match.getRect(scrollParent.value, scrollParentRect);
|
11189
|
-
|
11308
|
+
if (props2.sticky && props2.stickyOffsetTop) {
|
11309
|
+
active = getActiveAnchor(rect.top - props2.stickyOffsetTop, rects);
|
11310
|
+
} else {
|
11311
|
+
active = getActiveAnchor(rect.top, rects);
|
11312
|
+
}
|
11190
11313
|
}
|
11191
11314
|
} else {
|
11192
11315
|
active = getActiveAnchor(scrollTop, rects);
|
@@ -11259,7 +11382,11 @@ var stdin_default$L = vue.defineComponent({
|
|
11259
11382
|
return;
|
11260
11383
|
}
|
11261
11384
|
if (props2.sticky && props2.stickyOffsetTop) {
|
11262
|
-
|
11385
|
+
if (getRootScrollTop() === offsetHeight - scrollParentRect.height) {
|
11386
|
+
setRootScrollTop(getRootScrollTop());
|
11387
|
+
} else {
|
11388
|
+
setRootScrollTop(getRootScrollTop() - props2.stickyOffsetTop);
|
11389
|
+
}
|
11263
11390
|
}
|
11264
11391
|
emit("select", match.index);
|
11265
11392
|
}
|
@@ -16874,7 +17001,7 @@ const Lazyload = {
|
|
16874
17001
|
});
|
16875
17002
|
}
|
16876
17003
|
};
|
16877
|
-
const version = "4.
|
17004
|
+
const version = "4.9.0";
|
16878
17005
|
function install(app) {
|
16879
17006
|
const components = [
|
16880
17007
|
ActionBar,
|