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.
Files changed (48) hide show
  1. package/README.md +7 -5
  2. package/es/calendar/Calendar.d.ts +16 -10
  3. package/es/calendar/Calendar.mjs +83 -53
  4. package/es/calendar/CalendarHeader.d.ts +16 -1
  5. package/es/calendar/CalendarHeader.mjs +71 -7
  6. package/es/calendar/CalendarMonth.d.ts +6 -24
  7. package/es/calendar/CalendarMonth.mjs +6 -4
  8. package/es/calendar/index.css +1 -1
  9. package/es/calendar/index.d.ts +11 -7
  10. package/es/calendar/types.d.ts +4 -0
  11. package/es/calendar/utils.d.ts +6 -0
  12. package/es/calendar/utils.mjs +20 -0
  13. package/es/highlight/Highlight.mjs +7 -0
  14. package/es/image-preview/ImagePreviewItem.mjs +2 -0
  15. package/es/index-bar/IndexBar.mjs +10 -2
  16. package/es/index.d.ts +1 -1
  17. package/es/index.mjs +1 -1
  18. package/es/picker-group/PickerGroup.d.ts +13 -0
  19. package/es/picker-group/PickerGroup.mjs +5 -4
  20. package/es/picker-group/index.d.ts +9 -0
  21. package/es/utils/basic.d.ts +1 -1
  22. package/lib/calendar/Calendar.d.ts +16 -10
  23. package/lib/calendar/Calendar.js +82 -52
  24. package/lib/calendar/CalendarHeader.d.ts +16 -1
  25. package/lib/calendar/CalendarHeader.js +68 -4
  26. package/lib/calendar/CalendarMonth.d.ts +6 -24
  27. package/lib/calendar/CalendarMonth.js +6 -4
  28. package/lib/calendar/index.css +1 -1
  29. package/lib/calendar/index.d.ts +11 -7
  30. package/lib/calendar/types.d.ts +4 -0
  31. package/lib/calendar/utils.d.ts +6 -0
  32. package/lib/calendar/utils.js +20 -0
  33. package/lib/highlight/Highlight.js +7 -0
  34. package/lib/image-preview/ImagePreviewItem.js +2 -0
  35. package/lib/index-bar/IndexBar.js +10 -2
  36. package/lib/index.css +1 -1
  37. package/lib/index.d.ts +1 -1
  38. package/lib/index.js +1 -1
  39. package/lib/picker-group/PickerGroup.d.ts +13 -0
  40. package/lib/picker-group/PickerGroup.js +4 -3
  41. package/lib/picker-group/index.d.ts +9 -0
  42. package/lib/utils/basic.d.ts +1 -1
  43. package/lib/vant.cjs.js +193 -66
  44. package/lib/vant.es.js +193 -66
  45. package/lib/vant.js +194 -67
  46. package/lib/vant.min.js +3 -3
  47. package/lib/web-types.json +1 -1
  48. package/package.json +15 -15
package/lib/vant.js CHANGED
@@ -2369,7 +2369,7 @@
2369
2369
  return propRef;
2370
2370
  };
2371
2371
  /**
2372
- * @vue/shared v3.4.21
2372
+ * @vue/shared v3.4.26
2373
2373
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
2374
2374
  * @license MIT
2375
2375
  **/
@@ -3734,7 +3734,8 @@
3734
3734
  const pickerGroupProps = extend({
3735
3735
  tabs: makeArrayProp(),
3736
3736
  activeTab: makeNumericProp(0),
3737
- nextStepText: String
3737
+ nextStepText: String,
3738
+ showToolbar: truthProp
3738
3739
  }, pickerToolbarProps);
3739
3740
  var stdin_default$1A = vue.defineComponent({
3740
3741
  name: name$1p,
@@ -3773,13 +3774,13 @@
3773
3774
  const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
3774
3775
  return vue.createVNode("div", {
3775
3776
  "class": bem$1l()
3776
- }, [vue.createVNode(stdin_default$1H, {
3777
+ }, [props2.showToolbar ? vue.createVNode(stdin_default$1H, {
3777
3778
  "title": props2.title,
3778
3779
  "cancelButtonText": props2.cancelButtonText,
3779
3780
  "confirmButtonText": confirmButtonText,
3780
3781
  "onConfirm": onConfirm,
3781
3782
  "onCancel": onCancel
3782
- }, pick(slots, pickerToolbarSlots)), vue.createVNode(Tabs, {
3783
+ }, pick(slots, pickerToolbarSlots)) : null, vue.createVNode(Tabs, {
3783
3784
  "active": activeTab.value,
3784
3785
  "onUpdate:active": ($event) => activeTab.value = $event,
3785
3786
  "class": bem$1l("tabs"),
@@ -6613,8 +6614,22 @@
6613
6614
  cloned.setDate(cloned.getDate() + offset2);
6614
6615
  return cloned;
6615
6616
  }
6617
+ function getMonthByOffset(date, offset2) {
6618
+ const cloned = cloneDate(date);
6619
+ cloned.setMonth(cloned.getMonth() + offset2);
6620
+ return cloned;
6621
+ }
6622
+ function getYearByOffset(date, offset2) {
6623
+ const cloned = cloneDate(date);
6624
+ cloned.setFullYear(cloned.getFullYear() + offset2);
6625
+ return cloned;
6626
+ }
6616
6627
  const getPrevDay = (date) => getDayByOffset(date, -1);
6617
6628
  const getNextDay = (date) => getDayByOffset(date, 1);
6629
+ const getPrevMonth = (date) => getMonthByOffset(date, -1);
6630
+ const getNextMonth = (date) => getMonthByOffset(date, 1);
6631
+ const getPrevYear = (date) => getYearByOffset(date, -1);
6632
+ const getNextYear = (date) => getYearByOffset(date, 1);
6618
6633
  const getToday = () => {
6619
6634
  const today = /* @__PURE__ */ new Date();
6620
6635
  today.setHours(0, 0, 0, 0);
@@ -6794,8 +6809,8 @@
6794
6809
  date: makeRequiredProp(Date),
6795
6810
  type: String,
6796
6811
  color: String,
6797
- minDate: makeRequiredProp(Date),
6798
- maxDate: makeRequiredProp(Date),
6812
+ minDate: Date,
6813
+ maxDate: Date,
6799
6814
  showMark: Boolean,
6800
6815
  rowHeight: numericProp,
6801
6816
  formatter: Function,
@@ -6821,7 +6836,9 @@
6821
6836
  const title = vue.computed(() => formatMonthTitle(props2.date));
6822
6837
  const rowHeight = vue.computed(() => addUnit(props2.rowHeight));
6823
6838
  const offset2 = vue.computed(() => {
6824
- const realDay = props2.date.getDay();
6839
+ const date = props2.date.getDate();
6840
+ const day = props2.date.getDay();
6841
+ const realDay = (day - date % 7 + 8) % 7;
6825
6842
  if (props2.firstDayOfWeek) {
6826
6843
  return (realDay + 7 - props2.firstDayOfWeek) % 7;
6827
6844
  }
@@ -6881,7 +6898,7 @@
6881
6898
  maxDate,
6882
6899
  currentDate
6883
6900
  } = props2;
6884
- if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
6901
+ if (minDate && compareDay(day, minDate) < 0 || maxDate && compareDay(day, maxDate) > 0) {
6885
6902
  return "disabled";
6886
6903
  }
6887
6904
  if (currentDate === null) {
@@ -6994,17 +7011,36 @@
6994
7011
  name: name$16,
6995
7012
  props: {
6996
7013
  date: Date,
7014
+ minDate: Date,
7015
+ maxDate: Date,
6997
7016
  title: String,
6998
7017
  subtitle: String,
6999
7018
  showTitle: Boolean,
7000
7019
  showSubtitle: Boolean,
7001
- firstDayOfWeek: Number
7020
+ firstDayOfWeek: Number,
7021
+ switchMode: makeStringProp("none")
7002
7022
  },
7003
- emits: ["clickSubtitle"],
7023
+ emits: ["clickSubtitle", "panelChange"],
7004
7024
  setup(props2, {
7005
7025
  slots,
7006
7026
  emit
7007
7027
  }) {
7028
+ const prevMonthDisabled = vue.computed(() => {
7029
+ const prevMonth = getPrevMonth(props2.date);
7030
+ return props2.minDate && prevMonth < props2.minDate;
7031
+ });
7032
+ const prevYearDisabled = vue.computed(() => {
7033
+ const prevYear = getPrevYear(props2.date);
7034
+ return props2.minDate && prevYear < props2.minDate;
7035
+ });
7036
+ const nextMonthDisabled = vue.computed(() => {
7037
+ const nextMonth = getNextMonth(props2.date);
7038
+ return props2.maxDate && nextMonth > props2.maxDate;
7039
+ });
7040
+ const nextYearDisabled = vue.computed(() => {
7041
+ const nextYear = getNextYear(props2.date);
7042
+ return props2.maxDate && nextYear > props2.maxDate;
7043
+ });
7008
7044
  const renderTitle = () => {
7009
7045
  if (props2.showTitle) {
7010
7046
  const text = props2.title || t$g("title");
@@ -7015,16 +7051,60 @@
7015
7051
  }
7016
7052
  };
7017
7053
  const onClickSubtitle = (event) => emit("clickSubtitle", event);
7054
+ const onPanelChange = (date) => emit("panelChange", date);
7055
+ const renderAction = (isNext) => {
7056
+ const showYearAction = props2.switchMode === "year-month";
7057
+ const monthSlot = slots[isNext ? "next-month" : "prev-month"];
7058
+ const yearSlot = slots[isNext ? "next-year" : "prev-year"];
7059
+ const monthDisabled = isNext ? nextMonthDisabled.value : prevMonthDisabled.value;
7060
+ const yearDisabled = isNext ? nextYearDisabled.value : prevYearDisabled.value;
7061
+ const monthIconName = isNext ? "arrow" : "arrow-left";
7062
+ const yearIconName = isNext ? "arrow-double-right" : "arrow-double-left";
7063
+ const onMonthChange = () => onPanelChange((isNext ? getNextMonth : getPrevMonth)(props2.date));
7064
+ const onYearChange = () => onPanelChange((isNext ? getNextYear : getPrevYear)(props2.date));
7065
+ const MonthAction = vue.createVNode("view", {
7066
+ "class": bem$15("header-action", {
7067
+ disabled: monthDisabled
7068
+ }),
7069
+ "onClick": monthDisabled ? void 0 : onMonthChange
7070
+ }, [monthSlot ? monthSlot({
7071
+ disabled: monthDisabled
7072
+ }) : vue.createVNode(Icon, {
7073
+ "class": {
7074
+ [HAPTICS_FEEDBACK]: !monthDisabled
7075
+ },
7076
+ "name": monthIconName
7077
+ }, null)]);
7078
+ const YearAction = showYearAction && vue.createVNode("view", {
7079
+ "class": bem$15("header-action", {
7080
+ disabled: yearDisabled
7081
+ }),
7082
+ "onClick": yearDisabled ? void 0 : onYearChange
7083
+ }, [yearSlot ? yearSlot({
7084
+ disabled: yearDisabled
7085
+ }) : vue.createVNode(Icon, {
7086
+ "class": {
7087
+ [HAPTICS_FEEDBACK]: !yearDisabled
7088
+ },
7089
+ "name": yearIconName
7090
+ }, null)]);
7091
+ return isNext ? [MonthAction, YearAction] : [YearAction, MonthAction];
7092
+ };
7018
7093
  const renderSubtitle = () => {
7019
7094
  if (props2.showSubtitle) {
7020
7095
  const title = slots.subtitle ? slots.subtitle({
7021
7096
  date: props2.date,
7022
7097
  text: props2.subtitle
7023
7098
  }) : props2.subtitle;
7099
+ const canSwitch = props2.switchMode !== "none";
7024
7100
  return vue.createVNode("div", {
7025
- "class": bem$15("header-subtitle"),
7101
+ "class": bem$15("header-subtitle", {
7102
+ "with-swicth": canSwitch
7103
+ }),
7026
7104
  "onClick": onClickSubtitle
7027
- }, [title]);
7105
+ }, [canSwitch ? [renderAction(), vue.createVNode("div", {
7106
+ "class": bem$15("header-subtitle-text")
7107
+ }, [title]), renderAction(true)] : title]);
7028
7108
  }
7029
7109
  };
7030
7110
  const renderWeekDays = () => {
@@ -7047,6 +7127,7 @@
7047
7127
  const calendarProps = {
7048
7128
  show: Boolean,
7049
7129
  type: makeStringProp("single"),
7130
+ switchMode: makeStringProp("none"),
7050
7131
  title: String,
7051
7132
  color: String,
7052
7133
  round: truthProp,
@@ -7074,16 +7155,11 @@
7074
7155
  safeAreaInsetBottom: truthProp,
7075
7156
  minDate: {
7076
7157
  type: Date,
7077
- validator: isDate,
7078
- default: getToday
7158
+ validator: isDate
7079
7159
  },
7080
7160
  maxDate: {
7081
7161
  type: Date,
7082
- validator: isDate,
7083
- default: () => {
7084
- const now = getToday();
7085
- return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
7086
- }
7162
+ validator: isDate
7087
7163
  },
7088
7164
  firstDayOfWeek: {
7089
7165
  type: numericProp,
@@ -7094,25 +7170,36 @@
7094
7170
  var stdin_default$1f = vue.defineComponent({
7095
7171
  name: name$19,
7096
7172
  props: calendarProps,
7097
- emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate"],
7173
+ emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate", "panelChange"],
7098
7174
  setup(props2, {
7099
7175
  emit,
7100
7176
  slots
7101
7177
  }) {
7102
- const limitDateRange = (date, minDate = props2.minDate, maxDate = props2.maxDate) => {
7103
- if (compareDay(date, minDate) === -1) {
7104
- return minDate;
7178
+ const canSwitch = vue.computed(() => props2.switchMode !== "none");
7179
+ const minDate = vue.computed(() => {
7180
+ if (!props2.minDate && !canSwitch.value) {
7181
+ return getToday();
7182
+ }
7183
+ return props2.minDate;
7184
+ });
7185
+ const maxDate = vue.computed(() => {
7186
+ if (!props2.maxDate && !canSwitch.value) {
7187
+ return getMonthByOffset(getToday(), 6);
7188
+ }
7189
+ return props2.maxDate;
7190
+ });
7191
+ const limitDateRange = (date, min = minDate.value, max = maxDate.value) => {
7192
+ if (min && compareDay(date, min) === -1) {
7193
+ return min;
7105
7194
  }
7106
- if (compareDay(date, maxDate) === 1) {
7107
- return maxDate;
7195
+ if (max && compareDay(date, max) === 1) {
7196
+ return max;
7108
7197
  }
7109
7198
  return date;
7110
7199
  };
7111
7200
  const getInitialDate = (defaultDate = props2.defaultDate) => {
7112
7201
  const {
7113
7202
  type,
7114
- minDate,
7115
- maxDate,
7116
7203
  allowSameDay
7117
7204
  } = props2;
7118
7205
  if (defaultDate === null) {
@@ -7123,8 +7210,10 @@
7123
7210
  if (!Array.isArray(defaultDate)) {
7124
7211
  defaultDate = [];
7125
7212
  }
7126
- const start2 = limitDateRange(defaultDate[0] || now, minDate, allowSameDay ? maxDate : getPrevDay(maxDate));
7127
- const end2 = limitDateRange(defaultDate[1] || now, allowSameDay ? minDate : getNextDay(minDate));
7213
+ const min = minDate.value;
7214
+ const max = maxDate.value;
7215
+ const start2 = limitDateRange(defaultDate[0] || now, min, max ? allowSameDay ? max : getPrevDay(max) : void 0);
7216
+ const end2 = limitDateRange(defaultDate[1] || (allowSameDay ? now : getNextDay(now)), min ? allowSameDay ? min : getNextDay(min) : void 0);
7128
7217
  return [start2, end2];
7129
7218
  }
7130
7219
  if (type === "multiple") {
@@ -7138,23 +7227,28 @@
7138
7227
  }
7139
7228
  return limitDateRange(defaultDate);
7140
7229
  };
7230
+ const getInitialPanelDate = () => {
7231
+ const date = Array.isArray(currentDate.value) ? currentDate.value[0] : currentDate.value;
7232
+ return date ? date : limitDateRange(getToday());
7233
+ };
7141
7234
  let bodyHeight;
7142
7235
  const bodyRef = vue.ref();
7143
- const subtitle = vue.ref({
7144
- textFn: () => "",
7145
- date: void 0
7146
- });
7147
7236
  const currentDate = vue.ref(getInitialDate());
7237
+ const currentPanelDate = vue.ref(getInitialPanelDate());
7238
+ const currentMonthRef = vue.ref();
7148
7239
  const [monthRefs, setMonthRefs] = useRefs();
7149
7240
  const dayOffset = vue.computed(() => props2.firstDayOfWeek ? +props2.firstDayOfWeek % 7 : 0);
7150
7241
  const months = vue.computed(() => {
7151
7242
  const months2 = [];
7152
- const cursor = new Date(props2.minDate);
7243
+ if (!minDate.value || !maxDate.value) {
7244
+ return months2;
7245
+ }
7246
+ const cursor = new Date(minDate.value);
7153
7247
  cursor.setDate(1);
7154
7248
  do {
7155
7249
  months2.push(new Date(cursor));
7156
7250
  cursor.setMonth(cursor.getMonth() + 1);
7157
- } while (compareMonth(cursor, props2.maxDate) !== 1);
7251
+ } while (compareMonth(cursor, maxDate.value) !== 1);
7158
7252
  return months2;
7159
7253
  });
7160
7254
  const buttonDisabled = vue.computed(() => {
@@ -7204,25 +7298,26 @@
7204
7298
  monthRefs.value[index].setVisible(visible);
7205
7299
  });
7206
7300
  if (currentMonth) {
7207
- subtitle.value = {
7208
- textFn: currentMonth.getTitle,
7209
- date: currentMonth.date
7210
- };
7301
+ currentMonthRef.value = currentMonth;
7211
7302
  }
7212
7303
  };
7213
7304
  const scrollToDate = (targetDate) => {
7214
- raf(() => {
7215
- months.value.some((month, index) => {
7216
- if (compareMonth(month, targetDate) === 0) {
7217
- if (bodyRef.value) {
7218
- monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
7305
+ if (canSwitch.value) {
7306
+ currentPanelDate.value = targetDate;
7307
+ } else {
7308
+ raf(() => {
7309
+ months.value.some((month, index) => {
7310
+ if (compareMonth(month, targetDate) === 0) {
7311
+ if (bodyRef.value) {
7312
+ monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
7313
+ }
7314
+ return true;
7219
7315
  }
7220
- return true;
7221
- }
7222
- return false;
7316
+ return false;
7317
+ });
7318
+ onScroll();
7223
7319
  });
7224
- onScroll();
7225
- });
7320
+ }
7226
7321
  };
7227
7322
  const scrollToCurrentDate = () => {
7228
7323
  if (props2.poppable && !props2.show) {
@@ -7233,7 +7328,7 @@
7233
7328
  if (isDate(targetDate)) {
7234
7329
  scrollToDate(targetDate);
7235
7330
  }
7236
- } else {
7331
+ } else if (!canSwitch.value) {
7237
7332
  raf(onScroll);
7238
7333
  }
7239
7334
  };
@@ -7241,9 +7336,11 @@
7241
7336
  if (props2.poppable && !props2.show) {
7242
7337
  return;
7243
7338
  }
7244
- raf(() => {
7245
- bodyHeight = Math.floor(useRect(bodyRef).height);
7246
- });
7339
+ if (!canSwitch.value) {
7340
+ raf(() => {
7341
+ bodyHeight = Math.floor(useRect(bodyRef).height);
7342
+ });
7343
+ }
7247
7344
  scrollToCurrentDate();
7248
7345
  };
7249
7346
  const reset = (date = getInitialDate()) => {
@@ -7265,6 +7362,12 @@
7265
7362
  }
7266
7363
  return true;
7267
7364
  };
7365
+ const onPanelChange = (date) => {
7366
+ currentPanelDate.value = date;
7367
+ emit("panelChange", {
7368
+ date
7369
+ });
7370
+ };
7268
7371
  const onConfirm = () => {
7269
7372
  var _a;
7270
7373
  return emit("confirm", (_a = currentDate.value) != null ? _a : cloneDates(currentDate.value));
@@ -7356,12 +7459,15 @@
7356
7459
  const renderMonth = (date, index) => {
7357
7460
  const showMonthTitle = index !== 0 || !props2.showSubtitle;
7358
7461
  return vue.createVNode(stdin_default$1h, vue.mergeProps({
7359
- "ref": setMonthRefs(index),
7462
+ "ref": canSwitch.value ? currentMonthRef : setMonthRefs(index),
7360
7463
  "date": date,
7361
7464
  "currentDate": currentDate.value,
7362
7465
  "showMonthTitle": showMonthTitle,
7363
- "firstDayOfWeek": dayOffset.value
7364
- }, pick(props2, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
7466
+ "firstDayOfWeek": dayOffset.value,
7467
+ "lazyRender": canSwitch.value ? false : props2.lazyRender,
7468
+ "maxDate": maxDate.value,
7469
+ "minDate": minDate.value
7470
+ }, pick(props2, ["type", "color", "showMark", "formatter", "rowHeight", "showSubtitle", "allowSameDay"]), {
7365
7471
  "onClick": onClickDay,
7366
7472
  "onClickDisabledDate": (item) => emit("clickDisabledDate", item)
7367
7473
  }), pick(slots, ["top-info", "bottom-info", "month-title"]));
@@ -7396,25 +7502,29 @@
7396
7502
  }]
7397
7503
  }, [renderFooterButton()]);
7398
7504
  const renderCalendar = () => {
7399
- const subTitle = subtitle.value.textFn();
7505
+ var _a, _b;
7400
7506
  return vue.createVNode("div", {
7401
7507
  "class": bem$15()
7402
7508
  }, [vue.createVNode(stdin_default$1g, {
7403
- "date": subtitle.value.date,
7509
+ "date": (_a = currentMonthRef.value) == null ? void 0 : _a.date,
7510
+ "maxDate": maxDate.value,
7511
+ "minDate": minDate.value,
7404
7512
  "title": props2.title,
7405
- "subtitle": subTitle,
7513
+ "subtitle": (_b = currentMonthRef.value) == null ? void 0 : _b.getTitle(),
7406
7514
  "showTitle": props2.showTitle,
7407
7515
  "showSubtitle": props2.showSubtitle,
7516
+ "switchMode": props2.switchMode,
7408
7517
  "firstDayOfWeek": dayOffset.value,
7409
- "onClickSubtitle": (event) => emit("clickSubtitle", event)
7410
- }, pick(slots, ["title", "subtitle"])), vue.createVNode("div", {
7518
+ "onClickSubtitle": (event) => emit("clickSubtitle", event),
7519
+ "onPanelChange": onPanelChange
7520
+ }, pick(slots, ["title", "subtitle", "prev-month", "prev-year", "next-month", "next-year"])), vue.createVNode("div", {
7411
7521
  "ref": bodyRef,
7412
7522
  "class": bem$15("body"),
7413
- "onScroll": onScroll
7414
- }, [months.value.map(renderMonth)]), renderFooter()]);
7523
+ "onScroll": canSwitch.value ? void 0 : onScroll
7524
+ }, [canSwitch.value ? renderMonth(currentPanelDate.value, 0) : months.value.map(renderMonth)]), renderFooter()]);
7415
7525
  };
7416
7526
  vue.watch(() => props2.show, init);
7417
- vue.watch(() => [props2.type, props2.minDate, props2.maxDate], () => reset(getInitialDate(currentDate.value)));
7527
+ vue.watch(() => [props2.type, props2.minDate, props2.maxDate, props2.switchMode], () => reset(getInitialDate(currentDate.value)));
7418
7528
  vue.watch(() => props2.defaultDate, (value = null) => {
7419
7529
  currentDate.value = value;
7420
7530
  scrollToCurrentDate();
@@ -10915,6 +11025,13 @@
10915
11025
  return chunks2;
10916
11026
  }, []);
10917
11027
  const lastChunk = chunks[chunks.length - 1];
11028
+ if (!lastChunk) {
11029
+ chunks.push({
11030
+ start: 0,
11031
+ end: sourceString.length,
11032
+ highlight: false
11033
+ });
11034
+ }
10918
11035
  if (lastChunk && lastChunk.end < sourceString.length) {
10919
11036
  chunks.push({
10920
11037
  start: lastChunk.end,
@@ -11150,6 +11267,8 @@
11150
11267
  const checkClose = (event) => {
11151
11268
  var _a;
11152
11269
  const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
11270
+ if (!swipeItemEl)
11271
+ return;
11153
11272
  const imageEl = swipeItemEl.firstElementChild;
11154
11273
  const isClickOverlay = event.target === swipeItemEl;
11155
11274
  const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
@@ -11619,7 +11738,11 @@
11619
11738
  const match = getMatchAnchor(selectActiveIndex);
11620
11739
  if (match) {
11621
11740
  const rect = match.getRect(scrollParent.value, scrollParentRect);
11622
- active = getActiveAnchor(rect.top, rects);
11741
+ if (props2.sticky && props2.stickyOffsetTop) {
11742
+ active = getActiveAnchor(rect.top - props2.stickyOffsetTop, rects);
11743
+ } else {
11744
+ active = getActiveAnchor(rect.top, rects);
11745
+ }
11623
11746
  }
11624
11747
  } else {
11625
11748
  active = getActiveAnchor(scrollTop, rects);
@@ -11692,7 +11815,11 @@
11692
11815
  return;
11693
11816
  }
11694
11817
  if (props2.sticky && props2.stickyOffsetTop) {
11695
- setRootScrollTop(getRootScrollTop() - props2.stickyOffsetTop);
11818
+ if (getRootScrollTop() === offsetHeight - scrollParentRect.height) {
11819
+ setRootScrollTop(getRootScrollTop());
11820
+ } else {
11821
+ setRootScrollTop(getRootScrollTop() - props2.stickyOffsetTop);
11822
+ }
11696
11823
  }
11697
11824
  emit("select", match.index);
11698
11825
  }
@@ -18087,7 +18214,7 @@
18087
18214
  });
18088
18215
  }
18089
18216
  };
18090
- const version = "4.8.11";
18217
+ const version = "4.9.0";
18091
18218
  function install(app) {
18092
18219
  const components = [
18093
18220
  ActionBar,