vant 4.8.10 → 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 (58) 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/dropdown-item/DropdownItem.mjs +10 -3
  14. package/es/dropdown-item/index.css +1 -1
  15. package/es/dropdown-item/types.d.ts +1 -0
  16. package/es/dropdown-menu/index.css +1 -1
  17. package/es/dropdown-menu/types.d.ts +1 -0
  18. package/es/highlight/Highlight.mjs +7 -0
  19. package/es/image-preview/ImagePreviewItem.mjs +2 -0
  20. package/es/index-bar/IndexBar.mjs +10 -2
  21. package/es/index.d.ts +1 -1
  22. package/es/index.mjs +1 -1
  23. package/es/picker-group/PickerGroup.d.ts +13 -0
  24. package/es/picker-group/PickerGroup.mjs +5 -4
  25. package/es/picker-group/index.d.ts +9 -0
  26. package/es/utils/basic.d.ts +1 -1
  27. package/lib/calendar/Calendar.d.ts +16 -10
  28. package/lib/calendar/Calendar.js +82 -52
  29. package/lib/calendar/CalendarHeader.d.ts +16 -1
  30. package/lib/calendar/CalendarHeader.js +68 -4
  31. package/lib/calendar/CalendarMonth.d.ts +6 -24
  32. package/lib/calendar/CalendarMonth.js +6 -4
  33. package/lib/calendar/index.css +1 -1
  34. package/lib/calendar/index.d.ts +11 -7
  35. package/lib/calendar/types.d.ts +4 -0
  36. package/lib/calendar/utils.d.ts +6 -0
  37. package/lib/calendar/utils.js +20 -0
  38. package/lib/dropdown-item/DropdownItem.js +10 -3
  39. package/lib/dropdown-item/index.css +1 -1
  40. package/lib/dropdown-item/types.d.ts +1 -0
  41. package/lib/dropdown-menu/index.css +1 -1
  42. package/lib/dropdown-menu/types.d.ts +1 -0
  43. package/lib/highlight/Highlight.js +7 -0
  44. package/lib/image-preview/ImagePreviewItem.js +2 -0
  45. package/lib/index-bar/IndexBar.js +10 -2
  46. package/lib/index.css +1 -1
  47. package/lib/index.d.ts +1 -1
  48. package/lib/index.js +1 -1
  49. package/lib/picker-group/PickerGroup.d.ts +13 -0
  50. package/lib/picker-group/PickerGroup.js +4 -3
  51. package/lib/picker-group/index.d.ts +9 -0
  52. package/lib/utils/basic.d.ts +1 -1
  53. package/lib/vant.cjs.js +203 -69
  54. package/lib/vant.es.js +203 -69
  55. package/lib/vant.js +204 -70
  56. package/lib/vant.min.js +3 -3
  57. package/lib/web-types.json +1 -1
  58. package/package.json +13 -13
package/lib/vant.es.js CHANGED
@@ -3270,7 +3270,8 @@ const PICKER_GROUP_KEY = Symbol(name$1p);
3270
3270
  const pickerGroupProps = extend({
3271
3271
  tabs: makeArrayProp(),
3272
3272
  activeTab: makeNumericProp(0),
3273
- nextStepText: String
3273
+ nextStepText: String,
3274
+ showToolbar: truthProp
3274
3275
  }, pickerToolbarProps);
3275
3276
  var stdin_default$1A = defineComponent({
3276
3277
  name: name$1p,
@@ -3309,13 +3310,13 @@ var stdin_default$1A = defineComponent({
3309
3310
  const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
3310
3311
  return createVNode("div", {
3311
3312
  "class": bem$1l()
3312
- }, [createVNode(stdin_default$1H, {
3313
+ }, [props2.showToolbar ? createVNode(stdin_default$1H, {
3313
3314
  "title": props2.title,
3314
3315
  "cancelButtonText": props2.cancelButtonText,
3315
3316
  "confirmButtonText": confirmButtonText,
3316
3317
  "onConfirm": onConfirm,
3317
3318
  "onCancel": onCancel
3318
- }, pick(slots, pickerToolbarSlots)), createVNode(Tabs, {
3319
+ }, pick(slots, pickerToolbarSlots)) : null, createVNode(Tabs, {
3319
3320
  "active": activeTab.value,
3320
3321
  "onUpdate:active": ($event) => activeTab.value = $event,
3321
3322
  "class": bem$1l("tabs"),
@@ -6152,8 +6153,22 @@ function getDayByOffset(date, offset) {
6152
6153
  cloned.setDate(cloned.getDate() + offset);
6153
6154
  return cloned;
6154
6155
  }
6156
+ function getMonthByOffset(date, offset) {
6157
+ const cloned = cloneDate(date);
6158
+ cloned.setMonth(cloned.getMonth() + offset);
6159
+ return cloned;
6160
+ }
6161
+ function getYearByOffset(date, offset) {
6162
+ const cloned = cloneDate(date);
6163
+ cloned.setFullYear(cloned.getFullYear() + offset);
6164
+ return cloned;
6165
+ }
6155
6166
  const getPrevDay = (date) => getDayByOffset(date, -1);
6156
6167
  const getNextDay = (date) => getDayByOffset(date, 1);
6168
+ const getPrevMonth = (date) => getMonthByOffset(date, -1);
6169
+ const getNextMonth = (date) => getMonthByOffset(date, 1);
6170
+ const getPrevYear = (date) => getYearByOffset(date, -1);
6171
+ const getNextYear = (date) => getYearByOffset(date, 1);
6157
6172
  const getToday = () => {
6158
6173
  const today = /* @__PURE__ */ new Date();
6159
6174
  today.setHours(0, 0, 0, 0);
@@ -6333,8 +6348,8 @@ const calendarMonthProps = {
6333
6348
  date: makeRequiredProp(Date),
6334
6349
  type: String,
6335
6350
  color: String,
6336
- minDate: makeRequiredProp(Date),
6337
- maxDate: makeRequiredProp(Date),
6351
+ minDate: Date,
6352
+ maxDate: Date,
6338
6353
  showMark: Boolean,
6339
6354
  rowHeight: numericProp,
6340
6355
  formatter: Function,
@@ -6360,7 +6375,9 @@ var stdin_default$1h = defineComponent({
6360
6375
  const title = computed(() => formatMonthTitle(props2.date));
6361
6376
  const rowHeight = computed(() => addUnit(props2.rowHeight));
6362
6377
  const offset = computed(() => {
6363
- const realDay = props2.date.getDay();
6378
+ const date = props2.date.getDate();
6379
+ const day = props2.date.getDay();
6380
+ const realDay = (day - date % 7 + 8) % 7;
6364
6381
  if (props2.firstDayOfWeek) {
6365
6382
  return (realDay + 7 - props2.firstDayOfWeek) % 7;
6366
6383
  }
@@ -6420,7 +6437,7 @@ var stdin_default$1h = defineComponent({
6420
6437
  maxDate,
6421
6438
  currentDate
6422
6439
  } = props2;
6423
- if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
6440
+ if (minDate && compareDay(day, minDate) < 0 || maxDate && compareDay(day, maxDate) > 0) {
6424
6441
  return "disabled";
6425
6442
  }
6426
6443
  if (currentDate === null) {
@@ -6533,17 +6550,36 @@ var stdin_default$1g = defineComponent({
6533
6550
  name: name$16,
6534
6551
  props: {
6535
6552
  date: Date,
6553
+ minDate: Date,
6554
+ maxDate: Date,
6536
6555
  title: String,
6537
6556
  subtitle: String,
6538
6557
  showTitle: Boolean,
6539
6558
  showSubtitle: Boolean,
6540
- firstDayOfWeek: Number
6559
+ firstDayOfWeek: Number,
6560
+ switchMode: makeStringProp("none")
6541
6561
  },
6542
- emits: ["clickSubtitle"],
6562
+ emits: ["clickSubtitle", "panelChange"],
6543
6563
  setup(props2, {
6544
6564
  slots,
6545
6565
  emit
6546
6566
  }) {
6567
+ const prevMonthDisabled = computed(() => {
6568
+ const prevMonth = getPrevMonth(props2.date);
6569
+ return props2.minDate && prevMonth < props2.minDate;
6570
+ });
6571
+ const prevYearDisabled = computed(() => {
6572
+ const prevYear = getPrevYear(props2.date);
6573
+ return props2.minDate && prevYear < props2.minDate;
6574
+ });
6575
+ const nextMonthDisabled = computed(() => {
6576
+ const nextMonth = getNextMonth(props2.date);
6577
+ return props2.maxDate && nextMonth > props2.maxDate;
6578
+ });
6579
+ const nextYearDisabled = computed(() => {
6580
+ const nextYear = getNextYear(props2.date);
6581
+ return props2.maxDate && nextYear > props2.maxDate;
6582
+ });
6547
6583
  const renderTitle = () => {
6548
6584
  if (props2.showTitle) {
6549
6585
  const text = props2.title || t$g("title");
@@ -6554,16 +6590,60 @@ var stdin_default$1g = defineComponent({
6554
6590
  }
6555
6591
  };
6556
6592
  const onClickSubtitle = (event) => emit("clickSubtitle", event);
6593
+ const onPanelChange = (date) => emit("panelChange", date);
6594
+ const renderAction = (isNext) => {
6595
+ const showYearAction = props2.switchMode === "year-month";
6596
+ const monthSlot = slots[isNext ? "next-month" : "prev-month"];
6597
+ const yearSlot = slots[isNext ? "next-year" : "prev-year"];
6598
+ const monthDisabled = isNext ? nextMonthDisabled.value : prevMonthDisabled.value;
6599
+ const yearDisabled = isNext ? nextYearDisabled.value : prevYearDisabled.value;
6600
+ const monthIconName = isNext ? "arrow" : "arrow-left";
6601
+ const yearIconName = isNext ? "arrow-double-right" : "arrow-double-left";
6602
+ const onMonthChange = () => onPanelChange((isNext ? getNextMonth : getPrevMonth)(props2.date));
6603
+ const onYearChange = () => onPanelChange((isNext ? getNextYear : getPrevYear)(props2.date));
6604
+ const MonthAction = createVNode("view", {
6605
+ "class": bem$15("header-action", {
6606
+ disabled: monthDisabled
6607
+ }),
6608
+ "onClick": monthDisabled ? void 0 : onMonthChange
6609
+ }, [monthSlot ? monthSlot({
6610
+ disabled: monthDisabled
6611
+ }) : createVNode(Icon, {
6612
+ "class": {
6613
+ [HAPTICS_FEEDBACK]: !monthDisabled
6614
+ },
6615
+ "name": monthIconName
6616
+ }, null)]);
6617
+ const YearAction = showYearAction && createVNode("view", {
6618
+ "class": bem$15("header-action", {
6619
+ disabled: yearDisabled
6620
+ }),
6621
+ "onClick": yearDisabled ? void 0 : onYearChange
6622
+ }, [yearSlot ? yearSlot({
6623
+ disabled: yearDisabled
6624
+ }) : createVNode(Icon, {
6625
+ "class": {
6626
+ [HAPTICS_FEEDBACK]: !yearDisabled
6627
+ },
6628
+ "name": yearIconName
6629
+ }, null)]);
6630
+ return isNext ? [MonthAction, YearAction] : [YearAction, MonthAction];
6631
+ };
6557
6632
  const renderSubtitle = () => {
6558
6633
  if (props2.showSubtitle) {
6559
6634
  const title = slots.subtitle ? slots.subtitle({
6560
6635
  date: props2.date,
6561
6636
  text: props2.subtitle
6562
6637
  }) : props2.subtitle;
6638
+ const canSwitch = props2.switchMode !== "none";
6563
6639
  return createVNode("div", {
6564
- "class": bem$15("header-subtitle"),
6640
+ "class": bem$15("header-subtitle", {
6641
+ "with-swicth": canSwitch
6642
+ }),
6565
6643
  "onClick": onClickSubtitle
6566
- }, [title]);
6644
+ }, [canSwitch ? [renderAction(), createVNode("div", {
6645
+ "class": bem$15("header-subtitle-text")
6646
+ }, [title]), renderAction(true)] : title]);
6567
6647
  }
6568
6648
  };
6569
6649
  const renderWeekDays = () => {
@@ -6586,6 +6666,7 @@ var stdin_default$1g = defineComponent({
6586
6666
  const calendarProps = {
6587
6667
  show: Boolean,
6588
6668
  type: makeStringProp("single"),
6669
+ switchMode: makeStringProp("none"),
6589
6670
  title: String,
6590
6671
  color: String,
6591
6672
  round: truthProp,
@@ -6613,16 +6694,11 @@ const calendarProps = {
6613
6694
  safeAreaInsetBottom: truthProp,
6614
6695
  minDate: {
6615
6696
  type: Date,
6616
- validator: isDate,
6617
- default: getToday
6697
+ validator: isDate
6618
6698
  },
6619
6699
  maxDate: {
6620
6700
  type: Date,
6621
- validator: isDate,
6622
- default: () => {
6623
- const now = getToday();
6624
- return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
6625
- }
6701
+ validator: isDate
6626
6702
  },
6627
6703
  firstDayOfWeek: {
6628
6704
  type: numericProp,
@@ -6633,25 +6709,36 @@ const calendarProps = {
6633
6709
  var stdin_default$1f = defineComponent({
6634
6710
  name: name$19,
6635
6711
  props: calendarProps,
6636
- emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate"],
6712
+ emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate", "panelChange"],
6637
6713
  setup(props2, {
6638
6714
  emit,
6639
6715
  slots
6640
6716
  }) {
6641
- const limitDateRange = (date, minDate = props2.minDate, maxDate = props2.maxDate) => {
6642
- if (compareDay(date, minDate) === -1) {
6643
- return minDate;
6717
+ const canSwitch = computed(() => props2.switchMode !== "none");
6718
+ const minDate = computed(() => {
6719
+ if (!props2.minDate && !canSwitch.value) {
6720
+ return getToday();
6721
+ }
6722
+ return props2.minDate;
6723
+ });
6724
+ const maxDate = computed(() => {
6725
+ if (!props2.maxDate && !canSwitch.value) {
6726
+ return getMonthByOffset(getToday(), 6);
6727
+ }
6728
+ return props2.maxDate;
6729
+ });
6730
+ const limitDateRange = (date, min = minDate.value, max = maxDate.value) => {
6731
+ if (min && compareDay(date, min) === -1) {
6732
+ return min;
6644
6733
  }
6645
- if (compareDay(date, maxDate) === 1) {
6646
- return maxDate;
6734
+ if (max && compareDay(date, max) === 1) {
6735
+ return max;
6647
6736
  }
6648
6737
  return date;
6649
6738
  };
6650
6739
  const getInitialDate = (defaultDate = props2.defaultDate) => {
6651
6740
  const {
6652
6741
  type,
6653
- minDate,
6654
- maxDate,
6655
6742
  allowSameDay
6656
6743
  } = props2;
6657
6744
  if (defaultDate === null) {
@@ -6662,8 +6749,10 @@ var stdin_default$1f = defineComponent({
6662
6749
  if (!Array.isArray(defaultDate)) {
6663
6750
  defaultDate = [];
6664
6751
  }
6665
- const start = limitDateRange(defaultDate[0] || now, minDate, allowSameDay ? maxDate : getPrevDay(maxDate));
6666
- const end = limitDateRange(defaultDate[1] || now, allowSameDay ? minDate : getNextDay(minDate));
6752
+ const min = minDate.value;
6753
+ const max = maxDate.value;
6754
+ const start = limitDateRange(defaultDate[0] || now, min, max ? allowSameDay ? max : getPrevDay(max) : void 0);
6755
+ const end = limitDateRange(defaultDate[1] || (allowSameDay ? now : getNextDay(now)), min ? allowSameDay ? min : getNextDay(min) : void 0);
6667
6756
  return [start, end];
6668
6757
  }
6669
6758
  if (type === "multiple") {
@@ -6677,23 +6766,28 @@ var stdin_default$1f = defineComponent({
6677
6766
  }
6678
6767
  return limitDateRange(defaultDate);
6679
6768
  };
6769
+ const getInitialPanelDate = () => {
6770
+ const date = Array.isArray(currentDate.value) ? currentDate.value[0] : currentDate.value;
6771
+ return date ? date : limitDateRange(getToday());
6772
+ };
6680
6773
  let bodyHeight;
6681
6774
  const bodyRef = ref();
6682
- const subtitle = ref({
6683
- textFn: () => "",
6684
- date: void 0
6685
- });
6686
6775
  const currentDate = ref(getInitialDate());
6776
+ const currentPanelDate = ref(getInitialPanelDate());
6777
+ const currentMonthRef = ref();
6687
6778
  const [monthRefs, setMonthRefs] = useRefs();
6688
6779
  const dayOffset = computed(() => props2.firstDayOfWeek ? +props2.firstDayOfWeek % 7 : 0);
6689
6780
  const months = computed(() => {
6690
6781
  const months2 = [];
6691
- const cursor = new Date(props2.minDate);
6782
+ if (!minDate.value || !maxDate.value) {
6783
+ return months2;
6784
+ }
6785
+ const cursor = new Date(minDate.value);
6692
6786
  cursor.setDate(1);
6693
6787
  do {
6694
6788
  months2.push(new Date(cursor));
6695
6789
  cursor.setMonth(cursor.getMonth() + 1);
6696
- } while (compareMonth(cursor, props2.maxDate) !== 1);
6790
+ } while (compareMonth(cursor, maxDate.value) !== 1);
6697
6791
  return months2;
6698
6792
  });
6699
6793
  const buttonDisabled = computed(() => {
@@ -6743,25 +6837,26 @@ var stdin_default$1f = defineComponent({
6743
6837
  monthRefs.value[index].setVisible(visible);
6744
6838
  });
6745
6839
  if (currentMonth) {
6746
- subtitle.value = {
6747
- textFn: currentMonth.getTitle,
6748
- date: currentMonth.date
6749
- };
6840
+ currentMonthRef.value = currentMonth;
6750
6841
  }
6751
6842
  };
6752
6843
  const scrollToDate = (targetDate) => {
6753
- raf(() => {
6754
- months.value.some((month, index) => {
6755
- if (compareMonth(month, targetDate) === 0) {
6756
- if (bodyRef.value) {
6757
- monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
6844
+ if (canSwitch.value) {
6845
+ currentPanelDate.value = targetDate;
6846
+ } else {
6847
+ raf(() => {
6848
+ months.value.some((month, index) => {
6849
+ if (compareMonth(month, targetDate) === 0) {
6850
+ if (bodyRef.value) {
6851
+ monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
6852
+ }
6853
+ return true;
6758
6854
  }
6759
- return true;
6760
- }
6761
- return false;
6855
+ return false;
6856
+ });
6857
+ onScroll();
6762
6858
  });
6763
- onScroll();
6764
- });
6859
+ }
6765
6860
  };
6766
6861
  const scrollToCurrentDate = () => {
6767
6862
  if (props2.poppable && !props2.show) {
@@ -6772,7 +6867,7 @@ var stdin_default$1f = defineComponent({
6772
6867
  if (isDate(targetDate)) {
6773
6868
  scrollToDate(targetDate);
6774
6869
  }
6775
- } else {
6870
+ } else if (!canSwitch.value) {
6776
6871
  raf(onScroll);
6777
6872
  }
6778
6873
  };
@@ -6780,9 +6875,11 @@ var stdin_default$1f = defineComponent({
6780
6875
  if (props2.poppable && !props2.show) {
6781
6876
  return;
6782
6877
  }
6783
- raf(() => {
6784
- bodyHeight = Math.floor(useRect(bodyRef).height);
6785
- });
6878
+ if (!canSwitch.value) {
6879
+ raf(() => {
6880
+ bodyHeight = Math.floor(useRect(bodyRef).height);
6881
+ });
6882
+ }
6786
6883
  scrollToCurrentDate();
6787
6884
  };
6788
6885
  const reset = (date = getInitialDate()) => {
@@ -6804,6 +6901,12 @@ var stdin_default$1f = defineComponent({
6804
6901
  }
6805
6902
  return true;
6806
6903
  };
6904
+ const onPanelChange = (date) => {
6905
+ currentPanelDate.value = date;
6906
+ emit("panelChange", {
6907
+ date
6908
+ });
6909
+ };
6807
6910
  const onConfirm = () => {
6808
6911
  var _a;
6809
6912
  return emit("confirm", (_a = currentDate.value) != null ? _a : cloneDates(currentDate.value));
@@ -6895,12 +6998,15 @@ var stdin_default$1f = defineComponent({
6895
6998
  const renderMonth = (date, index) => {
6896
6999
  const showMonthTitle = index !== 0 || !props2.showSubtitle;
6897
7000
  return createVNode(stdin_default$1h, mergeProps({
6898
- "ref": setMonthRefs(index),
7001
+ "ref": canSwitch.value ? currentMonthRef : setMonthRefs(index),
6899
7002
  "date": date,
6900
7003
  "currentDate": currentDate.value,
6901
7004
  "showMonthTitle": showMonthTitle,
6902
- "firstDayOfWeek": dayOffset.value
6903
- }, pick(props2, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
7005
+ "firstDayOfWeek": dayOffset.value,
7006
+ "lazyRender": canSwitch.value ? false : props2.lazyRender,
7007
+ "maxDate": maxDate.value,
7008
+ "minDate": minDate.value
7009
+ }, pick(props2, ["type", "color", "showMark", "formatter", "rowHeight", "showSubtitle", "allowSameDay"]), {
6904
7010
  "onClick": onClickDay,
6905
7011
  "onClickDisabledDate": (item) => emit("clickDisabledDate", item)
6906
7012
  }), pick(slots, ["top-info", "bottom-info", "month-title"]));
@@ -6935,25 +7041,29 @@ var stdin_default$1f = defineComponent({
6935
7041
  }]
6936
7042
  }, [renderFooterButton()]);
6937
7043
  const renderCalendar = () => {
6938
- const subTitle = subtitle.value.textFn();
7044
+ var _a, _b;
6939
7045
  return createVNode("div", {
6940
7046
  "class": bem$15()
6941
7047
  }, [createVNode(stdin_default$1g, {
6942
- "date": subtitle.value.date,
7048
+ "date": (_a = currentMonthRef.value) == null ? void 0 : _a.date,
7049
+ "maxDate": maxDate.value,
7050
+ "minDate": minDate.value,
6943
7051
  "title": props2.title,
6944
- "subtitle": subTitle,
7052
+ "subtitle": (_b = currentMonthRef.value) == null ? void 0 : _b.getTitle(),
6945
7053
  "showTitle": props2.showTitle,
6946
7054
  "showSubtitle": props2.showSubtitle,
7055
+ "switchMode": props2.switchMode,
6947
7056
  "firstDayOfWeek": dayOffset.value,
6948
- "onClickSubtitle": (event) => emit("clickSubtitle", event)
6949
- }, pick(slots, ["title", "subtitle"])), createVNode("div", {
7057
+ "onClickSubtitle": (event) => emit("clickSubtitle", event),
7058
+ "onPanelChange": onPanelChange
7059
+ }, pick(slots, ["title", "subtitle", "prev-month", "prev-year", "next-month", "next-year"])), createVNode("div", {
6950
7060
  "ref": bodyRef,
6951
7061
  "class": bem$15("body"),
6952
- "onScroll": onScroll
6953
- }, [months.value.map(renderMonth)]), renderFooter()]);
7062
+ "onScroll": canSwitch.value ? void 0 : onScroll
7063
+ }, [canSwitch.value ? renderMonth(currentPanelDate.value, 0) : months.value.map(renderMonth)]), renderFooter()]);
6954
7064
  };
6955
7065
  watch(() => props2.show, init);
6956
- watch(() => [props2.type, props2.minDate, props2.maxDate], () => reset(getInitialDate(currentDate.value)));
7066
+ watch(() => [props2.type, props2.minDate, props2.maxDate, props2.switchMode], () => reset(getInitialDate(currentDate.value)));
6957
7067
  watch(() => props2.defaultDate, (value = null) => {
6958
7068
  currentDate.value = value;
6959
7069
  scrollToCurrentDate();
@@ -9831,8 +9941,14 @@ var stdin_default$T = defineComponent({
9831
9941
  const {
9832
9942
  activeColor
9833
9943
  } = parent.props;
9944
+ const {
9945
+ disabled
9946
+ } = option;
9834
9947
  const active = option.value === props2.modelValue;
9835
9948
  const onClick = () => {
9949
+ if (disabled) {
9950
+ return;
9951
+ }
9836
9952
  state.showPopup = false;
9837
9953
  if (option.value !== props2.modelValue) {
9838
9954
  emit("update:modelValue", option.value);
@@ -9843,7 +9959,7 @@ var stdin_default$T = defineComponent({
9843
9959
  if (active) {
9844
9960
  return createVNode(Icon, {
9845
9961
  "class": bem$K("icon"),
9846
- "color": activeColor,
9962
+ "color": disabled ? void 0 : activeColor,
9847
9963
  "name": "success"
9848
9964
  }, null);
9849
9965
  }
@@ -9854,13 +9970,14 @@ var stdin_default$T = defineComponent({
9854
9970
  "icon": option.icon,
9855
9971
  "title": option.text,
9856
9972
  "class": bem$K("option", {
9857
- active
9973
+ active,
9974
+ disabled
9858
9975
  }),
9859
9976
  "style": {
9860
9977
  color: active ? activeColor : ""
9861
9978
  },
9862
9979
  "tabindex": active ? 0 : -1,
9863
- "clickable": true,
9980
+ "clickable": !disabled,
9864
9981
  "onClick": onClick
9865
9982
  }, {
9866
9983
  value: renderIcon
@@ -10473,6 +10590,13 @@ var stdin_default$O = defineComponent({
10473
10590
  return chunks2;
10474
10591
  }, []);
10475
10592
  const lastChunk = chunks[chunks.length - 1];
10593
+ if (!lastChunk) {
10594
+ chunks.push({
10595
+ start: 0,
10596
+ end: sourceString.length,
10597
+ highlight: false
10598
+ });
10599
+ }
10476
10600
  if (lastChunk && lastChunk.end < sourceString.length) {
10477
10601
  chunks.push({
10478
10602
  start: lastChunk.end,
@@ -10708,6 +10832,8 @@ var stdin_default$N = defineComponent({
10708
10832
  const checkClose = (event) => {
10709
10833
  var _a;
10710
10834
  const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
10835
+ if (!swipeItemEl)
10836
+ return;
10711
10837
  const imageEl = swipeItemEl.firstElementChild;
10712
10838
  const isClickOverlay = event.target === swipeItemEl;
10713
10839
  const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
@@ -11177,7 +11303,11 @@ var stdin_default$L = defineComponent({
11177
11303
  const match = getMatchAnchor(selectActiveIndex);
11178
11304
  if (match) {
11179
11305
  const rect = match.getRect(scrollParent.value, scrollParentRect);
11180
- active = getActiveAnchor(rect.top, rects);
11306
+ if (props2.sticky && props2.stickyOffsetTop) {
11307
+ active = getActiveAnchor(rect.top - props2.stickyOffsetTop, rects);
11308
+ } else {
11309
+ active = getActiveAnchor(rect.top, rects);
11310
+ }
11181
11311
  }
11182
11312
  } else {
11183
11313
  active = getActiveAnchor(scrollTop, rects);
@@ -11250,7 +11380,11 @@ var stdin_default$L = defineComponent({
11250
11380
  return;
11251
11381
  }
11252
11382
  if (props2.sticky && props2.stickyOffsetTop) {
11253
- setRootScrollTop(getRootScrollTop() - props2.stickyOffsetTop);
11383
+ if (getRootScrollTop() === offsetHeight - scrollParentRect.height) {
11384
+ setRootScrollTop(getRootScrollTop());
11385
+ } else {
11386
+ setRootScrollTop(getRootScrollTop() - props2.stickyOffsetTop);
11387
+ }
11254
11388
  }
11255
11389
  emit("select", match.index);
11256
11390
  }
@@ -16865,7 +16999,7 @@ const Lazyload = {
16865
16999
  });
16866
17000
  }
16867
17001
  };
16868
- const version = "4.8.10";
17002
+ const version = "4.9.0";
16869
17003
  function install(app) {
16870
17004
  const components = [
16871
17005
  ActionBar,