@nutui/nutui-react-taro 2.0.0-beta.1 → 2.0.0-beta.2

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 (114) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/esm/ActionSheet.js +2 -2
  3. package/dist/esm/Address.js +3 -3
  4. package/dist/esm/Calendar/style/style.css +1 -1
  5. package/dist/esm/Calendar.js +3 -3
  6. package/dist/esm/CalendarItem.js +2 -1
  7. package/dist/esm/Cascader.js +2 -2
  8. package/dist/esm/DatePicker.js +3 -3
  9. package/dist/esm/Dialog/style/style.css +1 -1
  10. package/dist/esm/Elevator.js +1 -1
  11. package/dist/esm/ImagePreview.js +2 -2
  12. package/dist/esm/NavBar.js +1 -1
  13. package/dist/esm/NoticeBar.js +1 -1
  14. package/dist/esm/NumberKeyboard.js +2 -2
  15. package/dist/esm/Picker.js +2 -2
  16. package/dist/esm/Popover.js +3 -3
  17. package/dist/esm/Popup.js +1 -1
  18. package/dist/esm/SearchBar.js +1 -1
  19. package/dist/esm/ShortPassword.js +2 -2
  20. package/dist/esm/SideNavBar.js +2 -2
  21. package/dist/esm/TimeSelect.js +2 -2
  22. package/dist/esm/TrendArrow.js +1 -1
  23. package/dist/esm/Uploader.js +1 -1
  24. package/dist/esm/VirtualList.js +1 -1
  25. package/dist/esm/{actionsheet.taro-06df0e47.js → actionsheet.taro-0fecc929.js} +3 -3
  26. package/dist/esm/{address.taro-09392335.js → address.taro-d4299225.js} +2 -2
  27. package/dist/esm/{calendar.taro-63544d95.js → calendar.taro-8bb4cb34.js} +8 -7
  28. package/dist/esm/{calendaritem.taro-c222ea25.js → calendaritem.taro-0262d6ab.js} +381 -281
  29. package/dist/esm/{cascader.taro-b5c1f5c6.js → cascader.taro-e929f24d.js} +3 -3
  30. package/dist/esm/{datepicker.taro-d04fc491.js → datepicker.taro-604222f0.js} +1 -1
  31. package/dist/esm/{elevator.taro-df8fde9d.js → elevator.taro-459f7322.js} +3 -3
  32. package/dist/esm/{imagepreview.taro-9e0c5171.js → imagepreview.taro-fad0448a.js} +1 -1
  33. package/dist/esm/{navbar.taro-5e1a0835.js → navbar.taro-f2d4215d.js} +2 -2
  34. package/dist/esm/{noticebar.taro-dc895cc5.js → noticebar.taro-2720ca1e.js} +2 -2
  35. package/dist/esm/{numberkeyboard.taro-f245cb85.js → numberkeyboard.taro-04a2f2c8.js} +2 -2
  36. package/dist/esm/nutui-react.es.js +27 -27
  37. package/dist/esm/{picker.taro-69fb40fe.js → picker.taro-86564e14.js} +1 -2
  38. package/dist/esm/{popover.taro-ae72d2de.js → popover.taro-cec3a7a0.js} +6 -6
  39. package/dist/esm/{popup.taro-23f882b0.js → popup.taro-1cd1f9d2.js} +5 -5
  40. package/dist/esm/{searchbar.taro-450d361d.js → searchbar.taro-842e985f.js} +2 -2
  41. package/dist/esm/{shortpassword.taro-ac22a29e.js → shortpassword.taro-b1b6c076.js} +3 -3
  42. package/dist/esm/{sidenavbar.taro-7bf8d265.js → sidenavbar.taro-61eaa60b.js} +1 -1
  43. package/dist/esm/{timeselect.taro-df7477a3.js → timeselect.taro-45ab9d52.js} +1 -1
  44. package/dist/esm/{trendarrow.taro-253025d2.js → trendarrow.taro-fa177b5c.js} +10 -10
  45. package/dist/esm/types/src/packages/calendar/calendar.d.ts +4 -6
  46. package/dist/esm/types/src/packages/calendar/calendar.taro.d.ts +4 -6
  47. package/dist/esm/types/src/packages/calendar/type.d.ts +13 -0
  48. package/dist/esm/types/src/packages/calendar/utils.d.ts +8 -0
  49. package/dist/esm/types/src/packages/calendaritem/calendaritem.d.ts +25 -27
  50. package/dist/esm/types/src/packages/calendaritem/calendaritem.taro.d.ts +26 -28
  51. package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
  52. package/dist/esm/types/src/packages/elevator/elevator.d.ts +2 -2
  53. package/dist/esm/types/src/packages/elevator/elevator.taro.d.ts +2 -2
  54. package/dist/esm/types/src/packages/navbar/demo.d.ts +1 -0
  55. package/dist/esm/types/src/packages/navbar/demo.taro.d.ts +1 -0
  56. package/dist/esm/types/src/packages/navbar/navbar.d.ts +1 -1
  57. package/dist/esm/types/src/packages/navbar/navbar.taro.d.ts +1 -1
  58. package/dist/esm/types/src/packages/noticebar/noticebar.d.ts +1 -1
  59. package/dist/esm/types/src/packages/noticebar/noticebar.taro.d.ts +1 -1
  60. package/dist/esm/types/src/packages/nutui.react.build.d.ts +3 -3
  61. package/dist/esm/types/src/packages/nutui.react.d.ts +5 -5
  62. package/dist/esm/types/src/packages/nutui.react.scss.d.ts +2 -2
  63. package/dist/esm/types/src/packages/nutui.react.taro.d.ts +5 -5
  64. package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +2 -2
  65. package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +3 -3
  66. package/dist/esm/types/src/packages/popover/popover.d.ts +2 -2
  67. package/dist/esm/types/src/packages/popover/popover.taro.d.ts +2 -2
  68. package/dist/esm/types/src/packages/popup/popup.d.ts +2 -2
  69. package/dist/esm/types/src/packages/popup/popup.taro.d.ts +2 -2
  70. package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +1 -1
  71. package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +1 -1
  72. package/dist/esm/types/src/packages/trendarrow/trendarrow.d.ts +3 -3
  73. package/dist/esm/types/src/packages/trendarrow/trendarrow.taro.d.ts +3 -3
  74. package/dist/esm/types/src/packages/uploader/uploader.d.ts +1 -1
  75. package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +1 -1
  76. package/dist/esm/types/src/packages/virtuallist/virtuallist.d.ts +2 -2
  77. package/dist/esm/types/src/packages/virtuallist/virtuallist.taro.d.ts +2 -2
  78. package/dist/esm/types/src/utils/date.d.ts +19 -3
  79. package/dist/esm/{uploader.taro-ea2c7ab9.js → uploader.taro-d9add90e.js} +4 -4
  80. package/dist/esm/{virtuallist.taro-97d3403a.js → virtuallist.taro-1de01855.js} +3 -4
  81. package/dist/locales/base.js +1 -1
  82. package/dist/locales/en-US.js +1 -1
  83. package/dist/locales/id-ID.js +1 -1
  84. package/dist/locales/tr-TR.js +1 -1
  85. package/dist/locales/zh-CN.js +1 -1
  86. package/dist/locales/zh-TW.js +1 -1
  87. package/dist/locales/zh-UG.js +1 -1
  88. package/dist/nutui.react.es.js +767 -677
  89. package/dist/nutui.react.umd.js +767 -677
  90. package/dist/packages/calendar/calendar.scss +4 -0
  91. package/dist/packages/dialog/dialog.scss +1 -1
  92. package/dist/style.css +1 -1
  93. package/dist/style.mjs +1 -1
  94. package/dist/styles/themes/default.scss +2 -2
  95. package/dist/styles/variables-jmapp.scss +2 -2
  96. package/dist/styles/variables.scss +2 -2
  97. package/dist/types/index.d.ts +3 -3
  98. package/dist/types/packages/calendar/calendar.taro.d.ts +8 -6
  99. package/dist/types/packages/calendar/type.d.ts +13 -0
  100. package/dist/types/packages/calendar/utils.d.ts +8 -0
  101. package/dist/types/packages/calendaritem/calendaritem.taro.d.ts +26 -28
  102. package/dist/types/packages/configprovider/types.d.ts +1 -1
  103. package/dist/types/packages/elevator/elevator.taro.d.ts +2 -2
  104. package/dist/types/packages/navbar/navbar.taro.d.ts +1 -1
  105. package/dist/types/packages/noticebar/noticebar.taro.d.ts +1 -1
  106. package/dist/types/packages/popover/popover.taro.d.ts +2 -2
  107. package/dist/types/packages/popup/popup.d.ts +2 -2
  108. package/dist/types/packages/popup/popup.taro.d.ts +2 -2
  109. package/dist/types/packages/searchbar/searchbar.taro.d.ts +1 -1
  110. package/dist/types/packages/trendarrow/trendarrow.taro.d.ts +3 -3
  111. package/dist/types/packages/uploader/uploader.taro.d.ts +1 -1
  112. package/dist/types/packages/virtuallist/virtuallist.taro.d.ts +2 -2
  113. package/dist/types/utils/date.d.ts +19 -3
  114. package/package.json +1 -1
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
8
8
  return value;
9
9
  };
10
10
  /*!
11
- * @nutui/nutui-react-taro v2.0.0-beta.1 Wed Jun 21 2023 15:10:48 GMT+0800 (China Standard Time)
11
+ * @nutui/nutui-react-taro v2.0.0-beta.2 Wed Jun 28 2023 16:09:22 GMT+0800 (China Standard Time)
12
12
  * (c) 2023 @jdf2e.
13
13
  * Released under the MIT License.
14
14
  */
@@ -3225,8 +3225,8 @@ var __publicField = (obj, key, value) => {
3225
3225
  showKeys,
3226
3226
  className,
3227
3227
  style,
3228
- onClickItem,
3229
- onClickIndex,
3228
+ onItemClick,
3229
+ onIndexClick,
3230
3230
  children,
3231
3231
  ...rest
3232
3232
  } = {
@@ -3321,12 +3321,12 @@ var __publicField = (obj, key, value) => {
3321
3321
  scrollTo(index);
3322
3322
  };
3323
3323
  const handleClickItem = (key, item) => {
3324
- onClickItem && onClickItem(key, item);
3324
+ onItemClick && onItemClick(key, item);
3325
3325
  setCurrentData(item);
3326
3326
  setCurrentKey(key);
3327
3327
  };
3328
3328
  const handleClickIndex = (key) => {
3329
- onClickIndex && onClickIndex(key);
3329
+ onIndexClick && onIndexClick(key);
3330
3330
  };
3331
3331
  const setListGroup = () => {
3332
3332
  if (listview.current) {
@@ -3548,7 +3548,7 @@ var __publicField = (obj, key, value) => {
3548
3548
  safeAreaInsetTop,
3549
3549
  placeholder,
3550
3550
  zIndex,
3551
- onClickBack
3551
+ onBackClick
3552
3552
  } = {
3553
3553
  ...defaultProps$1d,
3554
3554
  ...props
@@ -3566,7 +3566,7 @@ var __publicField = (obj, key, value) => {
3566
3566
  "div",
3567
3567
  {
3568
3568
  className: `${classPrefix2}__left__back`,
3569
- onClick: (e) => onClickBack(e)
3569
+ onClick: (e) => onBackClick(e)
3570
3570
  },
3571
3571
  back
3572
3572
  ), left);
@@ -5347,8 +5347,8 @@ var __publicField = (obj, key, value) => {
5347
5347
  },
5348
5348
  onClose: () => {
5349
5349
  },
5350
- onClickOverlay: (e) => true,
5351
- onClickCloseIcon: (e) => true,
5350
+ onOverlayClick: (e) => true,
5351
+ onCloseIconClick: (e) => true,
5352
5352
  ...defaultOverlayProps
5353
5353
  };
5354
5354
  let _zIndex = 2e3;
@@ -5377,8 +5377,8 @@ var __publicField = (obj, key, value) => {
5377
5377
  portal,
5378
5378
  onOpen,
5379
5379
  onClose,
5380
- onClickOverlay,
5381
- onClickCloseIcon,
5380
+ onOverlayClick,
5381
+ onCloseIconClick,
5382
5382
  afterShow,
5383
5383
  afterClose,
5384
5384
  onClick
@@ -5434,7 +5434,7 @@ var __publicField = (obj, key, value) => {
5434
5434
  const onHandleClickOverlay = (e) => {
5435
5435
  e.stopPropagation();
5436
5436
  if (closeOnOverlayClick) {
5437
- const closed = onClickOverlay && onClickOverlay(e);
5437
+ const closed = onOverlayClick && onOverlayClick(e);
5438
5438
  closed && close();
5439
5439
  }
5440
5440
  };
@@ -5442,7 +5442,7 @@ var __publicField = (obj, key, value) => {
5442
5442
  onClick && onClick(e);
5443
5443
  };
5444
5444
  const onHandleClickCloseIcon = (e) => {
5445
- const closed = onClickCloseIcon && onClickCloseIcon(e);
5445
+ const closed = onCloseIconClick && onCloseIconClick(e);
5446
5446
  closed && close();
5447
5447
  };
5448
5448
  const onHandleOpened = (e) => {
@@ -6559,8 +6559,8 @@ var __publicField = (obj, key, value) => {
6559
6559
  closeIconPosition,
6560
6560
  title: popup && props.title,
6561
6561
  left: props.left,
6562
- onClickOverlay: closePopup,
6563
- onClickCloseIcon: closePopup
6562
+ onOverlayClick: closePopup,
6563
+ onCloseIconClick: closePopup
6564
6564
  },
6565
6565
  renderTabs()
6566
6566
  ) : renderTabs());
@@ -6768,7 +6768,7 @@ var __publicField = (obj, key, value) => {
6768
6768
  return dayNames[index];
6769
6769
  },
6770
6770
  /**
6771
- * 返回星期数
6771
+ * 返回上一个月在当前面板中的天数
6772
6772
  * @return {Number}
6773
6773
  */
6774
6774
  getMonthPreDay(year, month) {
@@ -6857,7 +6857,107 @@ var __publicField = (obj, key, value) => {
6857
6857
  return true;
6858
6858
  }
6859
6859
  return false;
6860
+ },
6861
+ getMonthWeek(year, month, date2, firstDayOfWeek = 0) {
6862
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6863
+ let w2 = dateNow.getDay();
6864
+ const d = dateNow.getDate();
6865
+ let remainder = 6 - w2;
6866
+ if (firstDayOfWeek !== 0) {
6867
+ w2 = w2 === 0 ? 7 : w2;
6868
+ remainder = 7 - w2;
6869
+ }
6870
+ return Math.ceil((d + remainder) / 7);
6871
+ },
6872
+ getYearWeek(year, month, date2, firstDayOfWeek = 0) {
6873
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6874
+ const dateFirst = new Date(Number(year), 0, 1);
6875
+ const dataNumber = Math.round(
6876
+ (dateNow.valueOf() - dateFirst.valueOf()) / 864e5
6877
+ );
6878
+ return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
6879
+ },
6880
+ getWeekDate(year, month, date2, firstDayOfWeek = 0) {
6881
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
6882
+ const nowTime = dateNow.getTime();
6883
+ let day = dateNow.getDay();
6884
+ if (firstDayOfWeek === 0) {
6885
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
6886
+ const SundayTime2 = nowTime - day * oneDayTime2;
6887
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
6888
+ const sunday2 = this.date2Str(new Date(SundayTime2));
6889
+ const saturday = this.date2Str(new Date(SaturdayTime));
6890
+ return [sunday2, saturday];
6891
+ }
6892
+ day = day === 0 ? 7 : day;
6893
+ const oneDayTime = 24 * 60 * 60 * 1e3;
6894
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
6895
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
6896
+ const monday = this.date2Str(new Date(MondayTime));
6897
+ const sunday = this.date2Str(new Date(SundayTime));
6898
+ return [monday, sunday];
6899
+ },
6900
+ formatResultDate(date2) {
6901
+ const days = [...date2.split("-")];
6902
+ days[2] = Utils.getNumTwoBit(Number(days[2]));
6903
+ days[3] = `${days[0]}-${days[1]}-${days[2]}`;
6904
+ days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
6905
+ return days;
6906
+ }
6907
+ };
6908
+ const getCurrMonthData = (type2, year, month) => {
6909
+ switch (type2) {
6910
+ case "prev":
6911
+ month === 1 && (year -= 1);
6912
+ month = month === 1 ? 12 : --month;
6913
+ break;
6914
+ case "next":
6915
+ month === 12 && (year += 1);
6916
+ month = month === 12 ? 1 : ++month;
6917
+ break;
6918
+ }
6919
+ return [
6920
+ year,
6921
+ Utils.getNumTwoBit(month),
6922
+ Utils.getMonthDays(String(year), String(month))
6923
+ ];
6924
+ };
6925
+ const getDaysStatus = (type2, year, month) => {
6926
+ let days = Utils.getMonthDays(`${year}`, `${month}`);
6927
+ if (type2 === "prev" && days >= 7) {
6928
+ days -= 7;
6929
+ }
6930
+ return Array.from(Array(days), (v, k) => {
6931
+ return {
6932
+ day: k + 1,
6933
+ type: type2,
6934
+ year,
6935
+ month
6936
+ };
6937
+ });
6938
+ };
6939
+ const getPreMonthDates = (type2, year, month, firstDayOfWeek) => {
6940
+ let preMonth = +month - 1;
6941
+ let preYear = year;
6942
+ if (preMonth <= 0) {
6943
+ preMonth = 12;
6944
+ preYear += 1;
6945
+ }
6946
+ let days = Utils.getMonthPreDay(+year, +month);
6947
+ days -= firstDayOfWeek;
6948
+ if (type2 === "prev" && days >= 7) {
6949
+ days -= 7;
6860
6950
  }
6951
+ const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
6952
+ const months = Array.from(Array(preDates), (v, k) => {
6953
+ return {
6954
+ day: k + 1,
6955
+ type: type2,
6956
+ preYear,
6957
+ preMonth
6958
+ };
6959
+ });
6960
+ return months.slice(preDates - days);
6861
6961
  };
6862
6962
  const _window = window;
6863
6963
  function requestAniFrame() {
@@ -6871,7 +6971,38 @@ var __publicField = (obj, key, value) => {
6871
6971
  };
6872
6972
  }
6873
6973
  const requestAniFrame$1 = requestAniFrame();
6974
+ const splitDate = (date2) => {
6975
+ const split = date2.indexOf("-") !== -1 ? "-" : "/";
6976
+ return date2.split(split);
6977
+ };
6978
+ const isMultiple = (day, days) => {
6979
+ if (days.length > 0) {
6980
+ return days.some((item) => {
6981
+ return Utils.isEqual(item, day);
6982
+ });
6983
+ }
6984
+ return false;
6985
+ };
6986
+ const isCurrDay = (month, day) => {
6987
+ const date2 = `${month.curData[0]}/${month.curData[1]}/${day}`;
6988
+ return Utils.isEqual(date2, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
6989
+ };
6990
+ const getCurrDate = (day, month) => {
6991
+ return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
6992
+ +day.day
6993
+ )}`;
6994
+ };
6995
+ const isStart = (day, days) => {
6996
+ return Utils.isEqual(days[0], day);
6997
+ };
6998
+ const isEnd = (day, days) => {
6999
+ return Utils.isEqual(days[1], day);
7000
+ };
7001
+ const isStartAndEnd = (days) => {
7002
+ return days.length >= 2 && Utils.isEqual(days[0], days[1]);
7003
+ };
6874
7004
  const defaultProps$10 = {
7005
+ ...ComponentDefaults,
6875
7006
  type: "single",
6876
7007
  autoBackfill: false,
6877
7008
  popup: true,
@@ -6885,6 +7016,7 @@ var __publicField = (obj, key, value) => {
6885
7016
  showTitle: true,
6886
7017
  showSubTitle: true,
6887
7018
  scrollAnimation: true,
7019
+ firstDayOfWeek: 0,
6888
7020
  renderHeaderButtons: void 0,
6889
7021
  renderDay: void 0,
6890
7022
  renderDayTop: void 0,
@@ -6893,7 +7025,7 @@ var __publicField = (obj, key, value) => {
6893
7025
  },
6894
7026
  onUpdate: () => {
6895
7027
  },
6896
- onClickDay: (data) => {
7028
+ onDayClick: (data) => {
6897
7029
  },
6898
7030
  onPageChange: (data) => {
6899
7031
  }
@@ -6901,11 +7033,13 @@ var __publicField = (obj, key, value) => {
6901
7033
  const CalendarItem = React.forwardRef((props, ref) => {
6902
7034
  const { locale } = useConfig();
6903
7035
  const {
7036
+ popup,
6904
7037
  type: type2,
6905
7038
  autoBackfill,
6906
- popup,
6907
7039
  title,
6908
7040
  defaultValue,
7041
+ startDate,
7042
+ endDate,
6909
7043
  showToday,
6910
7044
  startText,
6911
7045
  endText,
@@ -6913,16 +7047,21 @@ var __publicField = (obj, key, value) => {
6913
7047
  showTitle,
6914
7048
  showSubTitle,
6915
7049
  scrollAnimation,
7050
+ firstDayOfWeek,
6916
7051
  renderHeaderButtons,
6917
7052
  renderDay,
6918
7053
  renderDayTop,
6919
7054
  renderDayBottom,
6920
7055
  onConfirm,
6921
7056
  onUpdate,
6922
- onClickDay,
7057
+ onDayClick,
6923
7058
  onPageChange
6924
7059
  } = { ...defaultProps$10, ...props };
6925
- const weeks = locale.calendaritem.weekdays;
7060
+ const weekdays = locale.calendaritem.weekdays;
7061
+ const weeks = [
7062
+ ...weekdays.slice(firstDayOfWeek, 7),
7063
+ ...weekdays.slice(0, firstDayOfWeek)
7064
+ ];
6926
7065
  const monthTitle = locale.calendaritem.monthTitle;
6927
7066
  const [yearMonthTitle, setYearMonthTitle] = React.useState("");
6928
7067
  const [monthsData, setMonthsData] = React.useState([]);
@@ -6931,12 +7070,8 @@ var __publicField = (obj, key, value) => {
6931
7070
  const [monthDefaultRange, setMonthDefaultRange] = React.useState([]);
6932
7071
  const [scrollTop, setScrollTop] = React.useState(0);
6933
7072
  const [scrollWithAnimation, setScrollWithAnimation] = React.useState(false);
6934
- const propStartDate = props.startDate || Utils.getDay(0);
6935
- const propEndDate = props.endDate || Utils.getDay(365);
6936
- const splitDate = (date2) => {
6937
- const split = date2.indexOf("-") !== -1 ? "-" : "/";
6938
- return date2.split(split);
6939
- };
7073
+ const propStartDate = startDate || Utils.getDay(0);
7074
+ const propEndDate = endDate || Utils.getDay(365);
6940
7075
  const startDates = splitDate(propStartDate);
6941
7076
  const endDates = splitDate(propEndDate);
6942
7077
  const [state] = React.useState({
@@ -6963,171 +7098,49 @@ var __publicField = (obj, key, value) => {
6963
7098
  let viewHeight = 0;
6964
7099
  const classPrefix2 = "nut-calendar";
6965
7100
  const dayPrefix = "nut-calendar-day";
6966
- const classes = classNames(
6967
- {
6968
- [`${classPrefix2}-title`]: !popup,
6969
- [`${classPrefix2}-nofooter`]: !!autoBackfill
6970
- },
6971
- classPrefix2
6972
- );
6973
- const headerClasses = classNames({
6974
- [`${classPrefix2}-header`]: true,
6975
- [`${classPrefix2}-header-title`]: !popup
6976
- });
6977
- const isMultiple = (d) => {
6978
- if (currentDate.length > 0) {
6979
- return currentDate.some((item) => {
6980
- return Utils.isEqual(item, d);
6981
- });
6982
- }
6983
- return false;
6984
- };
6985
- const getCurrDate = (day, month) => {
6986
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
6987
- +day.day
6988
- )}`;
6989
- };
6990
- const getClasses = (day, month) => {
6991
- const dateStr = getCurrDate(day, month);
6992
- if (day.type === "active") {
6993
- if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
6994
- return `${dayPrefix}-disabled`;
6995
- }
6996
- if (type2 === "range") {
6997
- if (isStart(dateStr) || isEnd(dateStr)) {
6998
- return `${dayPrefix}-active ${isStart(dateStr) ? "active-start" : ""} ${isEnd(dateStr) ? "active-end" : ""}`;
6999
- }
7000
- if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
7001
- return `${dayPrefix}-choose`;
7002
- }
7003
- return null;
7004
- }
7005
- if (type2 === "multiple" && isMultiple(dateStr) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
7006
- return `${dayPrefix}-active`;
7007
- }
7008
- return null;
7009
- }
7010
- return `${dayPrefix}-disabled`;
7011
- };
7012
- const isCurrDay = (month, day) => {
7013
- const date2 = `${month.curData[0]}/${month.curData[1]}/${day}`;
7014
- return Utils.isEqual(date2, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
7015
- };
7016
- const isStart = (d) => {
7017
- return Utils.isEqual(currentDate[0], d);
7018
- };
7019
- const isEnd = (d) => {
7020
- return Utils.isEqual(currentDate[1], d);
7021
- };
7022
- const isStartTip = (day, month) => {
7023
- return type2 === "range" && day.type === "active" && isStart(getCurrDate(day, month));
7024
- };
7025
- const isEndTip = (day, month) => {
7026
- return currentDate.length >= 2 && type2 === "range" && day.type === "active" && isEnd(getCurrDate(day, month));
7027
- };
7028
- const isStartAndEnd = () => {
7029
- return currentDate.length >= 2 && Utils.isEqual(currentDate[0], currentDate[1]);
7030
- };
7031
- const getCurrMonthData = (type22) => {
7032
- const monthData = type22 === "prev" ? monthsData[0] : monthsData[monthsData.length - 1];
7033
- let year = parseInt(monthData.curData[0]);
7034
- let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
7035
- switch (type22) {
7036
- case "prev":
7037
- month === 1 && (year -= 1);
7038
- month = month === 1 ? 12 : --month;
7039
- break;
7040
- case "next":
7041
- month === 12 && (year += 1);
7042
- month = month === 12 ? 1 : ++month;
7043
- break;
7044
- }
7045
- return [
7046
- year,
7047
- Utils.getNumTwoBit(month),
7048
- Utils.getMonthDays(String(year), String(month))
7049
- ];
7050
- };
7051
- const getDaysStatus = (days, type22, year, month) => {
7052
- if (type22 === "prev" && days >= 7) {
7053
- days -= 7;
7054
- }
7055
- return Array.from(Array(days), (v, k) => {
7056
- return {
7057
- day: k + 1,
7058
- type: type22,
7059
- year,
7060
- month
7061
- };
7062
- });
7063
- };
7064
- const getPreDaysStatus = (days, type22, year, month, preCurrMonthDays) => {
7065
- if (type22 === "prev" && days >= 7) {
7066
- days -= 7;
7067
- }
7068
- const months = Array.from(Array(preCurrMonthDays), (v, k) => {
7069
- return {
7070
- day: k + 1,
7071
- type: type22,
7072
- year,
7073
- month
7101
+ const getMonthData = (curData, monthNum, type22) => {
7102
+ let i = 0;
7103
+ let date2 = curData;
7104
+ const monthData = monthsData;
7105
+ do {
7106
+ const y2 = parseInt(date2[0], 10);
7107
+ const m = parseInt(date2[1], 10);
7108
+ const days = [
7109
+ ...getPreMonthDates("prev", y2, m, firstDayOfWeek),
7110
+ ...getDaysStatus("active", y2, m)
7111
+ ];
7112
+ const cssHeight = 39 + (days.length > 35 ? 384 : 320);
7113
+ let scrollTop2 = 0;
7114
+ if (monthData.length > 0) {
7115
+ const monthEle = monthData[monthData.length - 1];
7116
+ scrollTop2 = monthEle.scrollTop + monthEle.cssHeight;
7117
+ }
7118
+ const monthInfo = {
7119
+ curData: date2,
7120
+ title: monthTitle(y2, m),
7121
+ monthData: days,
7122
+ cssHeight,
7123
+ scrollTop: scrollTop2
7074
7124
  };
7075
- });
7076
- return months.slice(preCurrMonthDays - days);
7077
- };
7078
- const getMonthData = (curData, type22) => {
7079
- let preMonth = +curData[1] - 1;
7080
- let preYear = curData[0];
7081
- if (preMonth <= 0) {
7082
- preMonth = 12;
7083
- preYear += 1;
7084
- }
7085
- const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
7086
- const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
7087
- const preCurrMonthDays = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
7088
- const monthInfo = {
7089
- curData,
7090
- title: monthTitle(curData[0], curData[1]),
7091
- monthData: [
7092
- ...getPreDaysStatus(
7093
- preMonthDays,
7094
- "prev",
7095
- `${preMonth}`,
7096
- preYear,
7097
- preCurrMonthDays
7098
- ),
7099
- ...getDaysStatus(
7100
- currMonthDays,
7101
- "active",
7102
- curData[0],
7103
- curData[1]
7104
- )
7105
- ]
7106
- };
7107
- monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
7108
- let scrollTop2 = 0;
7109
- if (monthsData.length > 0) {
7110
- const monthEle = monthsData[monthsData.length - 1];
7111
- scrollTop2 = monthEle.scrollTop + monthEle.cssHeight;
7112
- }
7113
- monthInfo.scrollTop = scrollTop2;
7114
- if (type22 === "next") {
7115
- if (!endDates || !Utils.compareDate(
7116
- `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
7117
- endDates[0],
7118
- endDates[1]
7119
- )}`,
7120
- `${curData[0]}/${curData[1]}/${curData[2]}`
7125
+ if (type22 === "next") {
7126
+ if (!endDates || !Utils.compareDate(
7127
+ `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
7128
+ endDates[0],
7129
+ endDates[1]
7130
+ )}`,
7131
+ `${curData[0]}/${curData[1]}/${curData[2]}`
7132
+ )) {
7133
+ monthData.push(monthInfo);
7134
+ }
7135
+ } else if (!startDates || !Utils.compareDate(
7136
+ `${curData[0]}/${curData[1]}/${curData[2]}`,
7137
+ `${startDates[0]}/${startDates[1]}/01`
7121
7138
  )) {
7122
- monthsData.push(monthInfo);
7139
+ monthData.unshift(monthInfo);
7123
7140
  }
7124
- } else if (!startDates || !Utils.compareDate(
7125
- `${curData[0]}/${curData[1]}/${curData[2]}`,
7126
- `${startDates[0]}/${startDates[1]}/01`
7127
- )) {
7128
- monthsData.unshift(monthInfo);
7129
- }
7130
- setMonthsData(monthsData);
7141
+ date2 = getCurrMonthData("next", y2, m);
7142
+ } while (i++ < monthNum);
7143
+ setMonthsData(monthData);
7131
7144
  };
7132
7145
  const setReachedYearMonthInfo = (current) => {
7133
7146
  const currentMonthsData = monthsData[current];
@@ -7159,48 +7172,11 @@ var __publicField = (obj, key, value) => {
7159
7172
  setTranslateY(monthsData[start].scrollTop);
7160
7173
  setReachedYearMonthInfo(current);
7161
7174
  };
7162
- const monthsViewScroll = (e) => {
7163
- if (monthsData.length <= 1) {
7164
- return;
7165
- }
7166
- const scrollTop2 = e.target.scrollTop;
7167
- let current = Math.floor(scrollTop2 / avgHeight);
7168
- const nextTop = monthsData[current + 1].scrollTop;
7169
- const nextHeight = monthsData[current + 1].cssHeight;
7170
- if (current === 0) {
7171
- if (scrollTop2 >= nextTop) {
7172
- current += 1;
7173
- }
7174
- } else if (current > 0 && current < monthsNum - 1) {
7175
- if (scrollTop2 >= nextTop) {
7176
- current += 1;
7177
- }
7178
- if (scrollTop2 < monthsData[current].scrollTop) {
7179
- current -= 1;
7180
- }
7181
- } else {
7182
- const viewPosition = Math.round(scrollTop2 + viewHeight);
7183
- if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
7184
- current += 1;
7185
- }
7186
- if (current >= 1 && scrollTop2 < monthsData[current - 1].scrollTop) {
7187
- current -= 1;
7188
- }
7189
- }
7190
- setDefaultRange(monthsNum, current);
7191
- };
7192
7175
  const getMonthNum = () => {
7193
- const startDate = {
7194
- year: Number(startDates[0]),
7195
- month: Number(startDates[1])
7196
- };
7197
- const endDate = {
7198
- year: Number(endDates[0]),
7199
- month: Number(endDates[1])
7200
- };
7201
- let monthNum = endDate.month - startDate.month;
7202
- if (endDate.year - startDate.year > 0) {
7203
- monthNum += 12 * (endDate.year - startDate.year);
7176
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
7177
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
7178
+ if (yearNum > 0) {
7179
+ monthNum += 12 * yearNum;
7204
7180
  }
7205
7181
  if (monthNum <= 0) {
7206
7182
  monthNum = 1;
@@ -7208,27 +7184,7 @@ var __publicField = (obj, key, value) => {
7208
7184
  setMonthsNum(monthNum);
7209
7185
  return monthNum;
7210
7186
  };
7211
- const getMonthsData = (monthNum) => {
7212
- getMonthData(startDates, "next");
7213
- let i = 1;
7214
- do {
7215
- getMonthData(getCurrMonthData("next"), "next");
7216
- } while (i++ < monthNum);
7217
- };
7218
- const requestAniFrameFunc = (current, monthNum) => {
7219
- const lastItem = monthsData[monthsData.length - 1];
7220
- const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
7221
- requestAniFrame$1(() => {
7222
- if (monthsRef && monthsPanel && viewAreaRef) {
7223
- viewHeight = monthsRef.current.clientHeight;
7224
- monthsPanel.current.style.height = `${containerHeight}px`;
7225
- setScrollTop(monthsData[current].scrollTop);
7226
- Taro.nextTick(() => setScrollWithAnimation(true));
7227
- }
7228
- });
7229
- setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
7230
- };
7231
- const renderCurrentDate = () => {
7187
+ const setDefaultDate = () => {
7232
7188
  let defaultData = [];
7233
7189
  if (type2 === "range" && Array.isArray(currentDate)) {
7234
7190
  if (currentDate.length > 0) {
@@ -7243,7 +7199,7 @@ var __publicField = (obj, key, value) => {
7243
7199
  ...splitDate(currentDate[1])
7244
7200
  ];
7245
7201
  }
7246
- } else if (props.type === "multiple" && Array.isArray(currentDate)) {
7202
+ } else if (type2 === "multiple" && Array.isArray(currentDate)) {
7247
7203
  if (currentDate.length > 0) {
7248
7204
  const defaultArr = [];
7249
7205
  const obj = {};
@@ -7258,6 +7214,22 @@ var __publicField = (obj, key, value) => {
7258
7214
  currentDate.splice(0) && currentDate.push(...defaultArr);
7259
7215
  defaultData = [...splitDate(defaultArr[0])];
7260
7216
  }
7217
+ } else if (type2 === "week" && Array.isArray(currentDate)) {
7218
+ if (currentDate.length > 0) {
7219
+ const [y2, m, d] = splitDate(currentDate[0]);
7220
+ const weekArr = Utils.getWeekDate(y2, m, d, firstDayOfWeek);
7221
+ currentDate.splice(0) && currentDate.push(...weekArr);
7222
+ if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
7223
+ currentDate.splice(0, 1, propStartDate);
7224
+ }
7225
+ if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
7226
+ currentDate.splice(1, 1, propEndDate);
7227
+ }
7228
+ defaultData = [
7229
+ ...splitDate(currentDate[0]),
7230
+ ...splitDate(currentDate[1])
7231
+ ];
7232
+ }
7261
7233
  } else if (currentDate) {
7262
7234
  if (currentDate.length > 0) {
7263
7235
  if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
@@ -7271,6 +7243,9 @@ var __publicField = (obj, key, value) => {
7271
7243
  defaultData = [];
7272
7244
  }
7273
7245
  }
7246
+ return defaultData;
7247
+ };
7248
+ const getCurrentIndex = (defaultData) => {
7274
7249
  let current = 0;
7275
7250
  let lastCurrent = 0;
7276
7251
  if (defaultData.length > 0) {
@@ -7278,38 +7253,53 @@ var __publicField = (obj, key, value) => {
7278
7253
  if (item.title === monthTitle(defaultData[0], defaultData[1])) {
7279
7254
  current = index;
7280
7255
  }
7281
- if (props.type === "range") {
7256
+ if (type2 === "range" || type2 === "week") {
7282
7257
  if (item.title === monthTitle(defaultData[3], defaultData[4])) {
7283
7258
  lastCurrent = index;
7284
7259
  }
7285
7260
  }
7286
7261
  });
7287
7262
  } else {
7288
- const currentYear2 = (/* @__PURE__ */ new Date()).getFullYear();
7289
- const currentMonth = (/* @__PURE__ */ new Date()).getMonth() + 1;
7290
- const currentYearMonthIndex = monthsData.findIndex((item) => {
7291
- return +item.curData[0] === currentYear2 && +item.curData[1] === currentMonth;
7263
+ const date2 = /* @__PURE__ */ new Date();
7264
+ const year = date2.getFullYear();
7265
+ const month = date2.getMonth() + 1;
7266
+ const index = monthsData.findIndex((item) => {
7267
+ return +item.curData[0] === year && +item.curData[1] === month;
7292
7268
  });
7293
- if (currentYearMonthIndex > -1) {
7294
- current = currentYearMonthIndex;
7269
+ if (index > -1) {
7270
+ current = index;
7295
7271
  }
7296
7272
  }
7273
+ return {
7274
+ current,
7275
+ lastCurrent
7276
+ };
7277
+ };
7278
+ const renderCurrentDate = () => {
7279
+ const defaultData = setDefaultDate();
7280
+ const current = getCurrentIndex(defaultData);
7297
7281
  if (defaultData.length > 0) {
7298
7282
  if (type2 === "range") {
7299
7283
  chooseDay(
7300
7284
  { day: defaultData[2], type: "active" },
7301
- monthsData[current],
7285
+ monthsData[current.current],
7302
7286
  true
7303
7287
  );
7304
7288
  chooseDay(
7305
7289
  { day: defaultData[5], type: "active" },
7306
- monthsData[lastCurrent],
7290
+ monthsData[current.lastCurrent],
7291
+ true
7292
+ );
7293
+ } else if (props.type === "week") {
7294
+ chooseDay(
7295
+ { day: defaultData[2], type: "curr" },
7296
+ monthsData[current.current],
7307
7297
  true
7308
7298
  );
7309
7299
  } else if (type2 === "multiple") {
7310
7300
  [...currentDate].forEach((item) => {
7311
7301
  const dateArr = splitDate(item);
7312
- let currentIndex = current;
7302
+ let currentIndex = current.current;
7313
7303
  monthsData.forEach((item2, index) => {
7314
7304
  if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
7315
7305
  currentIndex = index;
@@ -7324,25 +7314,46 @@ var __publicField = (obj, key, value) => {
7324
7314
  } else {
7325
7315
  chooseDay(
7326
7316
  { day: defaultData[2], type: "active" },
7327
- monthsData[current],
7317
+ monthsData[current.current],
7328
7318
  true
7329
7319
  );
7330
7320
  }
7331
7321
  }
7332
- return current;
7322
+ return current.current;
7323
+ };
7324
+ const requestAniFrameFunc = (current, monthNum) => {
7325
+ const lastItem = monthsData[monthsData.length - 1];
7326
+ const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
7327
+ requestAniFrame$1(() => {
7328
+ if (monthsRef && monthsPanel && viewAreaRef) {
7329
+ viewHeight = monthsRef.current.clientHeight;
7330
+ monthsPanel.current.style.height = `${containerHeight}px`;
7331
+ monthsRef.current.scrollTop = monthsData[current].scrollTop;
7332
+ setScrollTop(monthsData[current].scrollTop);
7333
+ Taro.nextTick(() => setScrollWithAnimation(true));
7334
+ }
7335
+ });
7336
+ setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
7333
7337
  };
7334
7338
  const initData = () => {
7335
7339
  const monthNum = getMonthNum();
7336
- getMonthsData(monthNum);
7340
+ getMonthData(startDates, monthNum, "next");
7337
7341
  const current = renderCurrentDate();
7338
7342
  setDefaultRange(monthNum, current);
7339
7343
  requestAniFrameFunc(current, monthNum);
7340
7344
  };
7345
+ React.useEffect(() => {
7346
+ initData();
7347
+ }, []);
7341
7348
  const resetRender = () => {
7342
7349
  state.currDateArray.splice(0);
7343
7350
  monthsData.splice(0);
7344
7351
  initData();
7345
7352
  };
7353
+ React.useEffect(() => {
7354
+ setCurrentDate(resetDefaultValue() || []);
7355
+ popup && resetRender();
7356
+ }, [defaultValue]);
7346
7357
  const scrollToDate = (date2) => {
7347
7358
  if (Utils.compareDate(date2, propStartDate)) {
7348
7359
  date2 = propStartDate;
@@ -7379,30 +7390,68 @@ var __publicField = (obj, key, value) => {
7379
7390
  }
7380
7391
  });
7381
7392
  };
7382
- React.useEffect(() => {
7383
- initData();
7384
- }, []);
7385
- React.useEffect(() => {
7386
- setCurrentDate(resetDefaultValue() || []);
7387
- popup && resetRender();
7388
- }, [defaultValue]);
7393
+ const monthsViewScroll = (e) => {
7394
+ if (monthsData.length <= 1) {
7395
+ return;
7396
+ }
7397
+ const scrollTop2 = e.detail.scrollTop;
7398
+ Taro.getEnv() === "WEB" && setScrollTop(scrollTop2);
7399
+ let current = Math.floor(scrollTop2 / avgHeight);
7400
+ const nextTop = monthsData[current + 1].scrollTop;
7401
+ const nextHeight = monthsData[current + 1].cssHeight;
7402
+ if (current === 0) {
7403
+ if (scrollTop2 >= nextTop) {
7404
+ current += 1;
7405
+ }
7406
+ } else if (current > 0 && current < monthsNum - 1) {
7407
+ if (scrollTop2 >= nextTop) {
7408
+ current += 1;
7409
+ }
7410
+ if (scrollTop2 < monthsData[current].scrollTop) {
7411
+ current -= 1;
7412
+ }
7413
+ } else {
7414
+ const viewPosition = Math.round(scrollTop2 + viewHeight);
7415
+ if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
7416
+ current += 1;
7417
+ }
7418
+ if (current >= 1 && scrollTop2 < monthsData[current - 1].scrollTop) {
7419
+ current -= 1;
7420
+ }
7421
+ }
7422
+ setDefaultRange(monthsNum, current);
7423
+ };
7389
7424
  React.useImperativeHandle(ref, () => ({
7390
7425
  scrollToDate
7391
7426
  }));
7392
- const confirm = () => {
7393
- if (type2 === "range" && state.currDateArray.length === 2 || type2 !== "range") {
7394
- const chooseData = state.currDateArray.slice(0);
7395
- onConfirm && onConfirm(chooseData);
7396
- if (popup) {
7397
- onUpdate && onUpdate();
7427
+ const getClasses = (day, month) => {
7428
+ const dateStr = getCurrDate(day, month);
7429
+ if (day.type === "active") {
7430
+ if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
7431
+ return `${dayPrefix}-disabled`;
7432
+ }
7433
+ if (type2 === "range" || type2 === "week") {
7434
+ if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
7435
+ return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
7436
+ }
7437
+ if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
7438
+ return `${dayPrefix}-choose`;
7439
+ }
7440
+ return null;
7398
7441
  }
7442
+ if (type2 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
7443
+ return `${dayPrefix}-active`;
7444
+ }
7445
+ return null;
7399
7446
  }
7447
+ return `${dayPrefix}-disabled`;
7400
7448
  };
7401
7449
  const chooseDay = (day, month, isFirst) => {
7402
7450
  if (getClasses(day, month) === `${dayPrefix}-disabled`) {
7403
7451
  return;
7404
7452
  }
7405
7453
  const days = [...month.curData];
7454
+ const [y2, m] = month.curData;
7406
7455
  days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
7407
7456
  days[3] = `${days[0]}/${days[1]}/${days[2]}`;
7408
7457
  days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
@@ -7439,71 +7488,113 @@ var __publicField = (obj, key, value) => {
7439
7488
  Array.isArray(currentDate) && currentDate.unshift(days[3]);
7440
7489
  state.currDateArray = [[...days], ...state.currDateArray];
7441
7490
  }
7491
+ } else if (type2 === "week") {
7492
+ const weekArr = Utils.getWeekDate(y2, m, `${day.day}`, firstDayOfWeek);
7493
+ if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
7494
+ weekArr.splice(0, 1, propStartDate);
7495
+ }
7496
+ if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
7497
+ weekArr.splice(1, 1, propEndDate);
7498
+ }
7499
+ Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
7500
+ state.currDateArray = [
7501
+ Utils.formatResultDate(weekArr[0]),
7502
+ Utils.formatResultDate(weekArr[1])
7503
+ ];
7442
7504
  } else {
7443
7505
  setCurrentDate(days[3]);
7444
7506
  state.currDateArray = [...days];
7445
7507
  }
7446
7508
  if (!isFirst) {
7447
- onClickDay && onClickDay(state.currDateArray);
7509
+ onDayClick && onDayClick(state.currDateArray);
7448
7510
  if (autoBackfill || !popup) {
7449
7511
  confirm();
7450
7512
  }
7451
7513
  }
7452
7514
  setMonthsData(monthsData.slice());
7453
7515
  };
7454
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: classes }, /* @__PURE__ */ React.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-weeks`, ref: weeksPanel }, weeks.map((item) => /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item)))), /* @__PURE__ */ React.createElement(
7455
- components.ScrollView,
7516
+ const confirm = () => {
7517
+ if (type2 === "range" && state.currDateArray.length === 2 || type2 !== "range") {
7518
+ const chooseData = state.currDateArray.slice(0);
7519
+ onConfirm && onConfirm(chooseData);
7520
+ if (popup) {
7521
+ onUpdate && onUpdate();
7522
+ }
7523
+ }
7524
+ };
7525
+ const classes = classNames(
7456
7526
  {
7457
- scrollTop,
7458
- scrollY: true,
7459
- type: "list",
7460
- scrollWithAnimation,
7461
- className: `${classPrefix2}-content`,
7462
- onScroll: monthsViewScroll,
7463
- ref: monthsRef
7527
+ [`${classPrefix2}-title`]: !popup,
7528
+ [`${classPrefix2}-nofooter`]: !!autoBackfill
7464
7529
  },
7465
- /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React.createElement(
7466
- "div",
7530
+ classPrefix2
7531
+ );
7532
+ const headerClasses = classNames({
7533
+ [`${classPrefix2}-header`]: true,
7534
+ [`${classPrefix2}-header-title`]: !popup
7535
+ });
7536
+ const isStartTip = (day, month) => {
7537
+ return (type2 === "range" || type2 === "week") && day.type === "active" && isStart(getCurrDate(day, month), currentDate);
7538
+ };
7539
+ const isEndTip = (day, month) => {
7540
+ return currentDate.length >= 2 && (type2 === "range" || type2 === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
7541
+ };
7542
+ const renderHeader = () => {
7543
+ return /* @__PURE__ */ React.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-weeks`, ref: weeksPanel }, weeks.map((item) => /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))));
7544
+ };
7545
+ const renderContent = () => {
7546
+ return /* @__PURE__ */ React.createElement(
7547
+ components.ScrollView,
7467
7548
  {
7468
- className: "viewArea",
7469
- ref: viewAreaRef,
7470
- style: { transform: `translateY(${translateY}px)` }
7549
+ scrollTop,
7550
+ scrollY: true,
7551
+ type: "list",
7552
+ scrollWithAnimation,
7553
+ className: `${classPrefix2}-content`,
7554
+ onScroll: monthsViewScroll,
7555
+ ref: monthsRef
7471
7556
  },
7472
- monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
7473
- return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map((day, i) => /* @__PURE__ */ React.createElement(
7474
- "div",
7475
- {
7476
- className: [
7477
- `${classPrefix2}-day`,
7478
- getClasses(day, month)
7479
- ].join(" "),
7480
- onClick: () => {
7481
- chooseDay(day, month);
7482
- },
7483
- key: i
7484
- },
7485
- /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
7486
- !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
7487
- !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React.createElement(
7488
- "div",
7489
- {
7490
- className: `${classPrefix2}-day-info-bottom`
7491
- },
7492
- renderDayBottom(day)
7493
- ),
7494
- !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
7495
- isStartTip(day, month) && /* @__PURE__ */ React.createElement(
7557
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React.createElement(
7558
+ "div",
7559
+ {
7560
+ className: "viewArea",
7561
+ ref: viewAreaRef,
7562
+ style: { transform: `translateY(${translateY}px)` }
7563
+ },
7564
+ monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
7565
+ return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map((day, i) => /* @__PURE__ */ React.createElement(
7496
7566
  "div",
7497
7567
  {
7498
- className: `${classPrefix2}-day-info ${isStartAndEnd() ? `${classPrefix2}-day-info-top` : ""}`
7568
+ className: [
7569
+ `${classPrefix2}-day`,
7570
+ getClasses(day, month)
7571
+ ].join(" "),
7572
+ onClick: () => {
7573
+ chooseDay(day, month);
7574
+ },
7575
+ key: i
7499
7576
  },
7500
- startText || locale.calendaritem.start
7501
- ),
7502
- isEndTip(day, month) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
7503
- ))));
7504
- })
7505
- ))
7506
- ), popup && !autoBackfill ? /* @__PURE__ */ React.createElement("div", { className: "nut-calendar-footer" }, /* @__PURE__ */ React.createElement("div", { className: "calendar-confirm-btn", onClick: confirm }, confirmText || locale.confirm)) : ""));
7577
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
7578
+ !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
7579
+ !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
7580
+ !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
7581
+ isStartTip(day, month) && /* @__PURE__ */ React.createElement(
7582
+ "div",
7583
+ {
7584
+ className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
7585
+ },
7586
+ startText || locale.calendaritem.start
7587
+ ),
7588
+ isEndTip(day, month) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
7589
+ ))));
7590
+ })
7591
+ ))
7592
+ );
7593
+ };
7594
+ const renderFooter = () => {
7595
+ return /* @__PURE__ */ React.createElement("div", { className: "nut-calendar-footer" }, /* @__PURE__ */ React.createElement("div", { className: "calendar-confirm-btn", onClick: confirm }, confirmText || locale.confirm));
7596
+ };
7597
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: classes }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : ""));
7507
7598
  });
7508
7599
  CalendarItem.defaultProps = defaultProps$10;
7509
7600
  CalendarItem.displayName = "NutCalendarItem";
@@ -7523,6 +7614,7 @@ var __publicField = (obj, key, value) => {
7523
7614
  showTitle: true,
7524
7615
  showSubTitle: true,
7525
7616
  scrollAnimation: true,
7617
+ firstDayOfWeek: 0,
7526
7618
  renderHeaderButtons: void 0,
7527
7619
  renderDay: void 0,
7528
7620
  renderDayTop: void 0,
@@ -7531,7 +7623,7 @@ var __publicField = (obj, key, value) => {
7531
7623
  },
7532
7624
  onConfirm: (param) => {
7533
7625
  },
7534
- onClickDay: (data) => {
7626
+ onDayClick: (data) => {
7535
7627
  },
7536
7628
  onPageChange: (param) => {
7537
7629
  }
@@ -7539,7 +7631,6 @@ var __publicField = (obj, key, value) => {
7539
7631
  const Calendar = React.forwardRef((props, ref) => {
7540
7632
  const { locale } = useConfig();
7541
7633
  const {
7542
- children,
7543
7634
  popup,
7544
7635
  visible,
7545
7636
  type: type2,
@@ -7555,13 +7646,14 @@ var __publicField = (obj, key, value) => {
7555
7646
  showTitle,
7556
7647
  showSubTitle,
7557
7648
  scrollAnimation,
7649
+ firstDayOfWeek,
7558
7650
  renderHeaderButtons,
7559
7651
  renderDay,
7560
7652
  renderDayTop,
7561
7653
  renderDayBottom,
7562
7654
  onClose,
7563
7655
  onConfirm,
7564
- onClickDay,
7656
+ onDayClick,
7565
7657
  onPageChange
7566
7658
  } = { ...defaultProps$$, ...props };
7567
7659
  const calendarRef = React.useRef(null);
@@ -7576,7 +7668,7 @@ var __publicField = (obj, key, value) => {
7576
7668
  close();
7577
7669
  };
7578
7670
  const select = (param) => {
7579
- onClickDay && onClickDay(param);
7671
+ onDayClick && onDayClick(param);
7580
7672
  };
7581
7673
  const scrollToDate = (date2) => {
7582
7674
  var _a;
@@ -7607,12 +7699,13 @@ var __publicField = (obj, key, value) => {
7607
7699
  showTitle,
7608
7700
  showSubTitle,
7609
7701
  scrollAnimation,
7702
+ firstDayOfWeek,
7610
7703
  renderHeaderButtons,
7611
7704
  renderDay,
7612
7705
  renderDayTop,
7613
7706
  renderDayBottom,
7614
7707
  onConfirm: choose,
7615
- onClickDay: select,
7708
+ onDayClick: select,
7616
7709
  onPageChange: yearMonthChange
7617
7710
  }
7618
7711
  );
@@ -7626,8 +7719,8 @@ var __publicField = (obj, key, value) => {
7626
7719
  duration: 0.5,
7627
7720
  closeable: true,
7628
7721
  destroyOnClose: true,
7629
- onClickOverlay: closePopup,
7630
- onClickCloseIcon: closePopup,
7722
+ onOverlayClick: closePopup,
7723
+ onCloseIconClick: closePopup,
7631
7724
  style: { height: "85vh" }
7632
7725
  },
7633
7726
  renderItem()
@@ -8397,7 +8490,6 @@ var __publicField = (obj, key, value) => {
8397
8490
  if (moving) {
8398
8491
  isConfirmEvent.current = true;
8399
8492
  } else {
8400
- console.log("picker confirmed", innerValue);
8401
8493
  setSelectedValue(innerValue);
8402
8494
  closePicker();
8403
8495
  }
@@ -11101,8 +11193,8 @@ var __publicField = (obj, key, value) => {
11101
11193
  {
11102
11194
  visible,
11103
11195
  position: "bottom",
11104
- onClickOverlay: onClose,
11105
- onClickCloseIcon: onClose,
11196
+ onOverlayClick: onClose,
11197
+ onCloseIconClick: onClose,
11106
11198
  overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" },
11107
11199
  ...rest
11108
11200
  },
@@ -11780,7 +11872,7 @@ var __publicField = (obj, key, value) => {
11780
11872
  onBlur,
11781
11873
  onClear,
11782
11874
  onSearch,
11783
- onClickInput
11875
+ onInputClick
11784
11876
  } = {
11785
11877
  ...defaultProps$L,
11786
11878
  ...props
@@ -11832,7 +11924,7 @@ var __publicField = (obj, key, value) => {
11832
11924
  );
11833
11925
  };
11834
11926
  const clickInput = (e) => {
11835
- onClickInput && onClickInput(e);
11927
+ onInputClick && onInputClick(e);
11836
11928
  };
11837
11929
  const renderLeftIn = () => {
11838
11930
  if (!leftIn)
@@ -11935,8 +12027,8 @@ var __publicField = (obj, key, value) => {
11935
12027
  onCancel,
11936
12028
  onClose,
11937
12029
  onComplete,
11938
- onClickOverlay,
11939
- onClickCloseIcon,
12030
+ onOverlayClick,
12031
+ onCloseIconClick,
11940
12032
  ...rest
11941
12033
  } = {
11942
12034
  ...defaultProps$K,
@@ -11975,8 +12067,8 @@ var __publicField = (obj, key, value) => {
11975
12067
  },
11976
12068
  visible,
11977
12069
  closeable: true,
11978
- onClickOverlay: onClose,
11979
- onClickCloseIcon: onClose,
12070
+ onOverlayClick: onClose,
12071
+ onCloseIconClick: onClose,
11980
12072
  ...rest
11981
12073
  },
11982
12074
  /* @__PURE__ */ React.createElement("div", { className: classNames(className, classPrefix2), style }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || locale.shortpassword.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__description` }, description || locale.shortpassword.description), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__input`, onClick: onFocus }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__input-site` }), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__input-fake` }, [...new Array(comLen).keys()].map((item, index) => {
@@ -12539,7 +12631,7 @@ var __publicField = (obj, key, value) => {
12539
12631
  uploadIcon: null,
12540
12632
  uploadLabel: "",
12541
12633
  previewType: "picture",
12542
- imageFit: "cover",
12634
+ fit: "cover",
12543
12635
  name: "file",
12544
12636
  accept: "*",
12545
12637
  disabled: false,
@@ -12584,7 +12676,7 @@ var __publicField = (obj, key, value) => {
12584
12676
  defaultValue,
12585
12677
  value,
12586
12678
  previewType,
12587
- imageFit,
12679
+ fit,
12588
12680
  disabled,
12589
12681
  multiple,
12590
12682
  url,
@@ -12665,7 +12757,7 @@ var __publicField = (obj, key, value) => {
12665
12757
  document.body.appendChild(obj);
12666
12758
  }
12667
12759
  }
12668
- if (Taro.getEnv() === "WEAPP") {
12760
+ if (Taro.getEnv() === "WEAPP" && Taro.chooseMedia) {
12669
12761
  Taro.chooseMedia({
12670
12762
  /** 最多可以选择的文件个数 */
12671
12763
  count: multiple ? maxCount * 1 - fileList.length : 1,
@@ -12891,7 +12983,7 @@ var __publicField = (obj, key, value) => {
12891
12983
  components.Image,
12892
12984
  {
12893
12985
  className: "nut-uploader__preview-img__c",
12894
- style: { objectFit: imageFit },
12986
+ style: { objectFit: fit },
12895
12987
  mode: "aspectFit",
12896
12988
  src: item.url,
12897
12989
  onClick: () => handleItemClick(item)
@@ -12983,7 +13075,7 @@ var __publicField = (obj, key, value) => {
12983
13075
  onCancel && onCancel();
12984
13076
  };
12985
13077
  const chooseItem = (item, index) => {
12986
- if (!item.disable) {
13078
+ if (!item.disabled) {
12987
13079
  onSelect && onSelect(item, index);
12988
13080
  }
12989
13081
  };
@@ -13003,7 +13095,7 @@ var __publicField = (obj, key, value) => {
13003
13095
  return /* @__PURE__ */ React.createElement(
13004
13096
  "div",
13005
13097
  {
13006
- className: `${classPrefix2}__item ${item.disable ? "disabled" : ""} ${item.danger ? "danger" : ""}`,
13098
+ className: `${classPrefix2}__item ${item.disabled ? "disabled" : ""} ${item.danger ? "danger" : ""}`,
13007
13099
  key: index,
13008
13100
  onClick: () => chooseItem(item, index)
13009
13101
  },
@@ -13545,7 +13637,7 @@ var __publicField = (obj, key, value) => {
13545
13637
  click,
13546
13638
  onClose,
13547
13639
  onClick,
13548
- onClickItem
13640
+ onItemClick
13549
13641
  } = {
13550
13642
  ...defaultProps$z,
13551
13643
  ...props
@@ -13787,7 +13879,7 @@ var __publicField = (obj, key, value) => {
13787
13879
  });
13788
13880
  };
13789
13881
  const handleItemClick = (event, value) => {
13790
- onClickItem && onClickItem(event, value);
13882
+ onItemClick && onItemClick(event, value);
13791
13883
  };
13792
13884
  const getStyle = (moveOffset = offset) => {
13793
13885
  const target = innerRef.current;
@@ -14014,8 +14106,8 @@ var __publicField = (obj, key, value) => {
14014
14106
  className: "",
14015
14107
  showArrow: true,
14016
14108
  overlay: false,
14017
- closeOnClickOutside: true,
14018
- closeOnClickAction: true,
14109
+ closeOnOutsideClick: true,
14110
+ closeOnActionClick: true,
14019
14111
  onClick: () => {
14020
14112
  },
14021
14113
  onOpen: () => {
@@ -14033,8 +14125,8 @@ var __publicField = (obj, key, value) => {
14033
14125
  offset,
14034
14126
  targetId,
14035
14127
  overlay,
14036
- closeOnClickOutside,
14037
- closeOnClickAction,
14128
+ closeOnOutsideClick,
14129
+ closeOnActionClick,
14038
14130
  className,
14039
14131
  showArrow,
14040
14132
  style,
@@ -14098,7 +14190,7 @@ var __publicField = (obj, key, value) => {
14098
14190
  setElHeight(rectContent.height);
14099
14191
  };
14100
14192
  const clickAway = () => {
14101
- if (closeOnClickOutside) {
14193
+ if (closeOnOutsideClick) {
14102
14194
  props.onClick && props.onClick();
14103
14195
  onClose && onClose();
14104
14196
  }
@@ -14171,7 +14263,7 @@ var __publicField = (obj, key, value) => {
14171
14263
  if (!item.disabled) {
14172
14264
  onSelect && onSelect(item, index);
14173
14265
  }
14174
- if (closeOnClickAction) {
14266
+ if (closeOnActionClick) {
14175
14267
  props.onClick && props.onClick();
14176
14268
  onClose && onClose();
14177
14269
  }
@@ -16519,311 +16611,78 @@ var __publicField = (obj, key, value) => {
16519
16611
  };
16520
16612
  ImagePreview.defaultProps = defaultProps$e;
16521
16613
  ImagePreview.displayName = "NutImagePreview";
16522
- const initPositinoCache = (reaItemSize, length = 0) => {
16523
- let index = 0;
16524
- const positions = Array(length);
16525
- while (index < length) {
16526
- positions[index] = {
16527
- index,
16528
- height: reaItemSize,
16529
- width: reaItemSize,
16530
- top: index * reaItemSize,
16531
- bottom: (index + 1) * reaItemSize,
16532
- left: index * reaItemSize,
16533
- right: (index + 1) * reaItemSize
16534
- };
16535
- index++;
16536
- }
16537
- return positions;
16538
- };
16539
- const binarySearch = (positionsList, value = 0, horizontal) => {
16540
- let start = 0;
16541
- let end = positionsList.length - 1;
16542
- let tempIndex = null;
16543
- const key = horizontal ? "right" : "bottom";
16544
- while (start <= end) {
16545
- const midIndex = Math.floor((start + end) / 2);
16546
- const midValue = positionsList[midIndex][key];
16547
- if (midValue === value) {
16548
- return midIndex + 1;
16549
- }
16550
- if (midValue < value) {
16551
- start = midIndex + 1;
16552
- } else if (midValue > value) {
16553
- if (tempIndex === null || tempIndex > midIndex) {
16554
- tempIndex = midIndex;
16555
- }
16556
- end = midIndex - 1;
16557
- }
16558
- }
16559
- tempIndex = tempIndex || 0;
16560
- return tempIndex;
16561
- };
16562
- const updateItemSize = (positions, items, sizeKey) => {
16563
- const newPos = positions.concat();
16564
- Array.from(items).forEach((item) => {
16565
- const index = Number(item.getAttribute("data-index"));
16566
- const styleVal = item.getAttribute("style");
16567
- if (styleVal && styleVal.includes("none"))
16568
- return;
16569
- const nowSize = item.getBoundingClientRect()[sizeKey];
16570
- const oldSize = positions[index][sizeKey];
16571
- const dValue = oldSize - nowSize;
16572
- if (dValue) {
16573
- if (sizeKey === "width") {
16574
- newPos[index].right -= dValue;
16575
- newPos[index][sizeKey] = nowSize;
16576
- for (let k = index + 1; k < positions.length; k++) {
16577
- newPos[k].left = positions[k - 1].right;
16578
- newPos[k].right -= dValue;
16579
- }
16580
- } else if (sizeKey === "height") {
16581
- newPos[index].bottom -= dValue;
16582
- newPos[index][sizeKey] = nowSize;
16583
- for (let k = index + 1; k < positions.length; k++) {
16584
- newPos[k].top = positions[k - 1].bottom;
16585
- newPos[k].bottom -= dValue;
16586
- }
16587
- }
16588
- }
16589
- });
16590
- };
16591
- const clientHeight = Taro.getSystemInfoSync().windowHeight - 5 || 667;
16592
16614
  const defaultProps$d = {
16593
16615
  ...ComponentDefaults,
16594
- list: [],
16595
- containerHeight: clientHeight,
16596
- itemHeight: 66,
16597
- itemEqual: true,
16598
- overscan: 2
16616
+ defaultValue: 1,
16617
+ mode: "multi",
16618
+ prev: null,
16619
+ next: null,
16620
+ total: 50,
16621
+ pageSize: 10,
16622
+ itemSize: 5,
16623
+ ellipse: false
16599
16624
  };
16600
- const VirtualList = (props) => {
16625
+ const Pagination = (props) => {
16626
+ const { locale } = useConfig();
16601
16627
  const {
16602
- list,
16603
- ItemRender,
16604
- itemHeight,
16605
- itemEqual,
16606
- overscan,
16607
- key,
16608
- onScroll,
16628
+ value,
16629
+ mode,
16630
+ prev,
16631
+ next,
16632
+ total,
16633
+ pageSize,
16634
+ itemSize,
16635
+ onChange,
16636
+ ellipse,
16637
+ itemRender,
16638
+ defaultValue,
16609
16639
  className,
16610
- containerHeight,
16611
16640
  ...rest
16612
16641
  } = {
16613
16642
  ...defaultProps$d,
16614
16643
  ...props
16615
16644
  };
16616
- const [startOffset, setStartOffset] = React.useState(0);
16617
- const [start, setStart] = React.useState(0);
16618
- const scrollRef = React.useRef(null);
16619
- const itemsRef = React.useRef(null);
16620
- const firstItemRef = React.useRef(null);
16621
- const [positions, setPositions] = React.useState([
16622
- {
16623
- index: 0,
16624
- left: 0,
16625
- top: 0,
16626
- bottom: 0,
16627
- width: 0,
16628
- height: 0,
16629
- right: 0
16630
- }
16631
- ]);
16632
- const [offSetSize, setOffSetSize] = React.useState(containerHeight || 0);
16633
- const [options, setOptions] = React.useState({
16634
- startOffset: 0,
16635
- // 可视区域距离顶部的偏移量
16636
- startIndex: 0,
16637
- // 可视区域开始索引
16638
- overStart: 0,
16639
- endIndex: 10
16640
- // 可视区域结束索引
16645
+ const classPrefix2 = "nut-pagination";
16646
+ const [currentPage, setCurrentPage] = usePropsValue({
16647
+ value,
16648
+ defaultValue,
16649
+ finalValue: 1,
16650
+ onChange
16641
16651
  });
16642
- React.useEffect(() => {
16643
- setPositions((options2) => {
16644
- return { ...options2, endIndex: visibleCount() };
16645
- });
16646
- }, [itemHeight, overscan, offSetSize]);
16647
- React.useEffect(() => {
16648
- if (containerHeight)
16652
+ const pageCount = React.useMemo(() => {
16653
+ const num = Math.ceil(total / pageSize);
16654
+ return Number.isNaN(num) ? 1 : Math.max(1, num);
16655
+ }, [total, pageSize]);
16656
+ const pages = React.useMemo(() => {
16657
+ const items = [];
16658
+ let startPage = 1;
16659
+ let endPage = pageCount;
16660
+ const partialShow = pageCount > itemSize;
16661
+ if (partialShow) {
16662
+ startPage = Math.max(currentPage - Math.floor(itemSize / 2), 1);
16663
+ endPage = startPage + itemSize - 1;
16664
+ if (endPage > pageCount) {
16665
+ endPage = pageCount;
16666
+ startPage = endPage - itemSize + 1;
16667
+ }
16668
+ }
16669
+ for (let i = startPage; i <= endPage; i++) {
16670
+ items.push({ number: i, text: i });
16671
+ }
16672
+ if (partialShow && itemSize > 0 && ellipse) {
16673
+ if (startPage > 1) {
16674
+ items.unshift({ number: startPage - 1, text: "..." });
16675
+ }
16676
+ if (endPage < pageCount) {
16677
+ items.push({ number: endPage + 1, text: "..." });
16678
+ }
16679
+ }
16680
+ return items;
16681
+ }, [currentPage, itemSize, pageCount]);
16682
+ const handleSelectPage = (curPage) => {
16683
+ if (curPage > pageCount || curPage < 1)
16649
16684
  return;
16650
- setOffSetSize(getContainerHeight());
16651
- }, [containerHeight]);
16652
- React.useEffect(() => {
16653
- const pos = initPositinoCache(itemHeight, list.length);
16654
- setPositions(pos);
16655
- }, [itemHeight, list]);
16656
- const getContainerHeight = () => {
16657
- const initH = itemHeight * list.length;
16658
- return initH < clientHeight ? initH + overscan * itemHeight - 5 : Math.min(containerHeight, clientHeight);
16659
- };
16660
- const visibleCount = () => {
16661
- return Math.ceil(getContainerHeight() / itemHeight) + overscan;
16662
- };
16663
- const end = () => {
16664
- return start + visibleCount();
16665
- };
16666
- const listHeight = () => {
16667
- return list.length * itemHeight;
16668
- };
16669
- const visibleData = () => {
16670
- return list.slice(start, Math.min(end(), list.length));
16671
- };
16672
- const updateTotalSize = React.useCallback(() => {
16673
- if (!itemsRef.current)
16674
- return;
16675
- const items = itemsRef.current.children;
16676
- if (!items.length)
16677
- return;
16678
- updateItemSize(positions, items, "height");
16679
- }, [positions]);
16680
- const listScroll = (e) => {
16681
- const scrollTop = e.detail ? e.detail.scrollTop : e.target.scrollTop;
16682
- const scrollSize = Math.floor(scrollTop);
16683
- const startIndex = binarySearch(positions, scrollSize, false);
16684
- const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
16685
- const endIndex = end();
16686
- if (!itemEqual) {
16687
- updateTotalSize();
16688
- }
16689
- setStart(Math.floor(scrollTop / itemHeight));
16690
- setOptions({ startOffset, startIndex, overStart, endIndex });
16691
- if (end() > list.length - 1) {
16692
- onScroll && onScroll();
16693
- }
16694
- setStartOffset(scrollTop - scrollTop % itemHeight);
16695
- };
16696
- return /* @__PURE__ */ React.createElement(
16697
- "div",
16698
- {
16699
- className: className ? `${className} nut-virtualList-box` : "nut-virtualList-box",
16700
- ...rest,
16701
- style: {
16702
- height: containerHeight ? `${offSetSize}px` : ""
16703
- }
16704
- },
16705
- /* @__PURE__ */ React.createElement(
16706
- components.ScrollView,
16707
- {
16708
- scrollY: true,
16709
- type: "list",
16710
- ref: scrollRef,
16711
- className: "nut-virtuallist",
16712
- style: {
16713
- height: `${getContainerHeight()}px`
16714
- },
16715
- onScroll: listScroll
16716
- },
16717
- /* @__PURE__ */ React.createElement(
16718
- "div",
16719
- {
16720
- className: "nut-virtuallist-phantom",
16721
- style: { height: `${listHeight()}px` }
16722
- }
16723
- ),
16724
- /* @__PURE__ */ React.createElement(
16725
- "div",
16726
- {
16727
- className: "nut-virtuallist-container",
16728
- ref: itemsRef,
16729
- style: { transform: `translate3d(0, ${startOffset}px, 0)` }
16730
- },
16731
- visibleData().map((data, index) => {
16732
- const { overStart } = options;
16733
- const dataIndex = overStart + index;
16734
- key && data[key] ? data[key] : dataIndex;
16735
- return /* @__PURE__ */ React.createElement(
16736
- "div",
16737
- {
16738
- ref: dataIndex === 0 ? firstItemRef : null,
16739
- "data-index": `${dataIndex}`,
16740
- className: "nut-virtuallist-item",
16741
- key: `${data}`,
16742
- style: {
16743
- height: `${itemEqual ? `${itemHeight}px` : "auto"}`
16744
- }
16745
- },
16746
- ItemRender ? /* @__PURE__ */ React.createElement(ItemRender, { data, index: `${index}` }) : data
16747
- );
16748
- })
16749
- )
16750
- )
16751
- );
16752
- };
16753
- VirtualList.defaultProps = defaultProps$d;
16754
- VirtualList.displayName = "NutVirtualList";
16755
- const defaultProps$c = {
16756
- ...ComponentDefaults,
16757
- defaultValue: 1,
16758
- mode: "multi",
16759
- prev: null,
16760
- next: null,
16761
- total: 50,
16762
- pageSize: 10,
16763
- itemSize: 5,
16764
- ellipse: false
16765
- };
16766
- const Pagination = (props) => {
16767
- const { locale } = useConfig();
16768
- const {
16769
- value,
16770
- mode,
16771
- prev,
16772
- next,
16773
- total,
16774
- pageSize,
16775
- itemSize,
16776
- onChange,
16777
- ellipse,
16778
- itemRender,
16779
- defaultValue,
16780
- className,
16781
- ...rest
16782
- } = {
16783
- ...defaultProps$c,
16784
- ...props
16785
- };
16786
- const classPrefix2 = "nut-pagination";
16787
- const [currentPage, setCurrentPage] = usePropsValue({
16788
- value,
16789
- defaultValue,
16790
- finalValue: 1,
16791
- onChange
16792
- });
16793
- const pageCount = React.useMemo(() => {
16794
- const num = Math.ceil(total / pageSize);
16795
- return Number.isNaN(num) ? 1 : Math.max(1, num);
16796
- }, [total, pageSize]);
16797
- const pages = React.useMemo(() => {
16798
- const items = [];
16799
- let startPage = 1;
16800
- let endPage = pageCount;
16801
- const partialShow = pageCount > itemSize;
16802
- if (partialShow) {
16803
- startPage = Math.max(currentPage - Math.floor(itemSize / 2), 1);
16804
- endPage = startPage + itemSize - 1;
16805
- if (endPage > pageCount) {
16806
- endPage = pageCount;
16807
- startPage = endPage - itemSize + 1;
16808
- }
16809
- }
16810
- for (let i = startPage; i <= endPage; i++) {
16811
- items.push({ number: i, text: i });
16812
- }
16813
- if (partialShow && itemSize > 0 && ellipse) {
16814
- if (startPage > 1) {
16815
- items.unshift({ number: startPage - 1, text: "..." });
16816
- }
16817
- if (endPage < pageCount) {
16818
- items.push({ number: endPage + 1, text: "..." });
16819
- }
16820
- }
16821
- return items;
16822
- }, [currentPage, itemSize, pageCount]);
16823
- const handleSelectPage = (curPage) => {
16824
- if (curPage > pageCount || curPage < 1)
16825
- return;
16826
- setCurrentPage(curPage);
16685
+ setCurrentPage(curPage);
16827
16686
  };
16828
16687
  return /* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix2, className), ...rest }, /* @__PURE__ */ React.createElement(
16829
16688
  "div",
@@ -16862,9 +16721,9 @@ var __publicField = (obj, key, value) => {
16862
16721
  next || locale.pagination.next
16863
16722
  ));
16864
16723
  };
16865
- Pagination.defaultProps = defaultProps$c;
16724
+ Pagination.defaultProps = defaultProps$d;
16866
16725
  Pagination.displayName = "NutPagination";
16867
- const defaultProps$b = {
16726
+ const defaultProps$c = {
16868
16727
  ...ComponentDefaults,
16869
16728
  price: 0,
16870
16729
  symbol: "&yen;",
@@ -16887,7 +16746,7 @@ var __publicField = (obj, key, value) => {
16887
16746
  style,
16888
16747
  ...rest
16889
16748
  } = {
16890
- ...defaultProps$b,
16749
+ ...defaultProps$c,
16891
16750
  ...props
16892
16751
  };
16893
16752
  const classPrefix2 = "nut-price";
@@ -16976,10 +16835,10 @@ var __publicField = (obj, key, value) => {
16976
16835
  symbol && position === "after" ? renderSymbol() : null
16977
16836
  );
16978
16837
  };
16979
- Price.defaultProps = defaultProps$b;
16838
+ Price.defaultProps = defaultProps$c;
16980
16839
  Price.displayName = "NutPrice";
16981
16840
  const DataContext = React.createContext({});
16982
- const defaultProps$a = {
16841
+ const defaultProps$b = {
16983
16842
  ...ComponentDefaults,
16984
16843
  title: "",
16985
16844
  description: "",
@@ -16988,7 +16847,7 @@ var __publicField = (obj, key, value) => {
16988
16847
  };
16989
16848
  const Step = (props) => {
16990
16849
  const { children, title, description, value, icon, className, ...restProps } = {
16991
- ...defaultProps$a,
16850
+ ...defaultProps$b,
16992
16851
  ...props
16993
16852
  };
16994
16853
  const parent = React.useContext(DataContext);
@@ -17022,16 +16881,16 @@ var __publicField = (obj, key, value) => {
17022
16881
  };
17023
16882
  return /* @__PURE__ */ React.createElement("div", { className: classes, ...restProps, onClick: handleClickStep }, /* @__PURE__ */ React.createElement("div", { className: "nut-step-head" }, /* @__PURE__ */ React.createElement("div", { className: "nut-step-line" }), /* @__PURE__ */ React.createElement("div", { className: renderIconClass() }, icon || !dot && /* @__PURE__ */ React.createElement("span", { className: "nut-step-inner" }, value))), /* @__PURE__ */ React.createElement("div", { className: "nut-step-main" }, /* @__PURE__ */ React.createElement("span", { className: "nut-step-title" }, title), description && /* @__PURE__ */ React.createElement("span", { className: "nut-step-description" }, description)));
17024
16883
  };
17025
- Step.defaultProps = defaultProps$a;
16884
+ Step.defaultProps = defaultProps$b;
17026
16885
  Step.displayName = "NutStep";
17027
- const defaultProps$9 = {
16886
+ const defaultProps$a = {
17028
16887
  ...ComponentDefaults,
17029
16888
  value: 0,
17030
16889
  direction: "horizontal",
17031
16890
  dot: false
17032
16891
  };
17033
16892
  const Steps = (props) => {
17034
- const propSteps = { ...defaultProps$9, ...props };
16893
+ const propSteps = { ...defaultProps$a, ...props };
17035
16894
  const {
17036
16895
  children,
17037
16896
  value,
@@ -17062,9 +16921,9 @@ var __publicField = (obj, key, value) => {
17062
16921
  children
17063
16922
  ));
17064
16923
  };
17065
- Steps.defaultProps = defaultProps$9;
16924
+ Steps.defaultProps = defaultProps$a;
17066
16925
  Steps.displayName = "NutSteps";
17067
- const defaultProps$8 = {
16926
+ const defaultProps$9 = {
17068
16927
  ...ComponentDefaults,
17069
16928
  columns: [],
17070
16929
  data: [],
@@ -17076,7 +16935,7 @@ var __publicField = (obj, key, value) => {
17076
16935
  };
17077
16936
  const Table = (props) => {
17078
16937
  const { locale } = useConfig();
17079
- defaultProps$8.noData = locale.noData;
16938
+ defaultProps$9.noData = locale.noData;
17080
16939
  const {
17081
16940
  children,
17082
16941
  className,
@@ -17092,7 +16951,7 @@ var __publicField = (obj, key, value) => {
17092
16951
  onSort,
17093
16952
  ...rest
17094
16953
  } = {
17095
- ...defaultProps$8,
16954
+ ...defaultProps$9,
17096
16955
  ...props
17097
16956
  };
17098
16957
  const [curData, setCurData] = React.useState(data);
@@ -17175,9 +17034,9 @@ var __publicField = (obj, key, value) => {
17175
17034
  /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__main__body` }, renderBoyTrs())
17176
17035
  ), (summary || curData.length === 0) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__summary` }, summary || noData));
17177
17036
  };
17178
- Table.defaultProps = defaultProps$8;
17037
+ Table.defaultProps = defaultProps$9;
17179
17038
  Table.displayName = "NutTable";
17180
- const defaultProps$7 = {
17039
+ const defaultProps$8 = {
17181
17040
  ...ComponentDefaults,
17182
17041
  type: "default",
17183
17042
  background: "",
@@ -17208,7 +17067,7 @@ var __publicField = (obj, key, value) => {
17208
17067
  onClick,
17209
17068
  onClose
17210
17069
  } = {
17211
- ...defaultProps$7,
17070
+ ...defaultProps$8,
17212
17071
  ...props
17213
17072
  };
17214
17073
  const [tagClass, setTagClass] = React.useState("");
@@ -17283,9 +17142,9 @@ var __publicField = (obj, key, value) => {
17283
17142
  children && /* @__PURE__ */ React.createElement("span", { className: `${classPrefix2}-text` }, children)
17284
17143
  ));
17285
17144
  };
17286
- Tag.defaultProps = defaultProps$7;
17145
+ Tag.defaultProps = defaultProps$8;
17287
17146
  Tag.displayName = "NutTag";
17288
- const defaultProps$6 = {
17147
+ const defaultProps$7 = {
17289
17148
  ...ComponentDefaults,
17290
17149
  source: {
17291
17150
  type: {},
@@ -17313,7 +17172,7 @@ var __publicField = (obj, key, value) => {
17313
17172
  onPlayEnd,
17314
17173
  ...restProps
17315
17174
  } = {
17316
- ...defaultProps$6,
17175
+ ...defaultProps$7,
17317
17176
  ...props
17318
17177
  };
17319
17178
  const classes = classNames(className, classPrefix$1);
@@ -17333,8 +17192,239 @@ var __publicField = (obj, key, value) => {
17333
17192
  }
17334
17193
  ));
17335
17194
  };
17336
- Video.defaultProps = defaultProps$6;
17195
+ Video.defaultProps = defaultProps$7;
17337
17196
  Video.displayName = "NutVideo";
17197
+ const initPositinoCache = (reaItemSize, length = 0) => {
17198
+ let index = 0;
17199
+ const positions = Array(length);
17200
+ while (index < length) {
17201
+ positions[index] = {
17202
+ index,
17203
+ height: reaItemSize,
17204
+ width: reaItemSize,
17205
+ top: index * reaItemSize,
17206
+ bottom: (index + 1) * reaItemSize,
17207
+ left: index * reaItemSize,
17208
+ right: (index + 1) * reaItemSize
17209
+ };
17210
+ index++;
17211
+ }
17212
+ return positions;
17213
+ };
17214
+ const binarySearch = (positionsList, value = 0, horizontal) => {
17215
+ let start = 0;
17216
+ let end = positionsList.length - 1;
17217
+ let tempIndex = null;
17218
+ const key = horizontal ? "right" : "bottom";
17219
+ while (start <= end) {
17220
+ const midIndex = Math.floor((start + end) / 2);
17221
+ const midValue = positionsList[midIndex][key];
17222
+ if (midValue === value) {
17223
+ return midIndex + 1;
17224
+ }
17225
+ if (midValue < value) {
17226
+ start = midIndex + 1;
17227
+ } else if (midValue > value) {
17228
+ if (tempIndex === null || tempIndex > midIndex) {
17229
+ tempIndex = midIndex;
17230
+ }
17231
+ end = midIndex - 1;
17232
+ }
17233
+ }
17234
+ tempIndex = tempIndex || 0;
17235
+ return tempIndex;
17236
+ };
17237
+ const updateItemSize = (positions, items, sizeKey) => {
17238
+ const newPos = positions.concat();
17239
+ Array.from(items).forEach((item) => {
17240
+ const index = Number(item.getAttribute("data-index"));
17241
+ const styleVal = item.getAttribute("style");
17242
+ if (styleVal && styleVal.includes("none"))
17243
+ return;
17244
+ const nowSize = item.getBoundingClientRect()[sizeKey];
17245
+ const oldSize = positions[index][sizeKey];
17246
+ const dValue = oldSize - nowSize;
17247
+ if (dValue) {
17248
+ if (sizeKey === "width") {
17249
+ newPos[index].right -= dValue;
17250
+ newPos[index][sizeKey] = nowSize;
17251
+ for (let k = index + 1; k < positions.length; k++) {
17252
+ newPos[k].left = positions[k - 1].right;
17253
+ newPos[k].right -= dValue;
17254
+ }
17255
+ } else if (sizeKey === "height") {
17256
+ newPos[index].bottom -= dValue;
17257
+ newPos[index][sizeKey] = nowSize;
17258
+ for (let k = index + 1; k < positions.length; k++) {
17259
+ newPos[k].top = positions[k - 1].bottom;
17260
+ newPos[k].bottom -= dValue;
17261
+ }
17262
+ }
17263
+ }
17264
+ });
17265
+ };
17266
+ const clientHeight = Taro.getSystemInfoSync().windowHeight - 5 || 667;
17267
+ const defaultProps$6 = {
17268
+ ...ComponentDefaults,
17269
+ list: [],
17270
+ containerHeight: clientHeight,
17271
+ itemHeight: 66,
17272
+ itemEqual: true,
17273
+ overscan: 2
17274
+ };
17275
+ const VirtualList = (props) => {
17276
+ const {
17277
+ list,
17278
+ itemRender,
17279
+ itemHeight,
17280
+ itemEqual,
17281
+ overscan,
17282
+ key,
17283
+ onScroll,
17284
+ className,
17285
+ containerHeight,
17286
+ ...rest
17287
+ } = {
17288
+ ...defaultProps$6,
17289
+ ...props
17290
+ };
17291
+ const [startOffset, setStartOffset] = React.useState(0);
17292
+ const [start, setStart] = React.useState(0);
17293
+ const scrollRef = React.useRef(null);
17294
+ const itemsRef = React.useRef(null);
17295
+ const [positions, setPositions] = React.useState([
17296
+ {
17297
+ index: 0,
17298
+ left: 0,
17299
+ top: 0,
17300
+ bottom: 0,
17301
+ width: 0,
17302
+ height: 0,
17303
+ right: 0
17304
+ }
17305
+ ]);
17306
+ const [offSetSize, setOffSetSize] = React.useState(containerHeight || 0);
17307
+ const [options, setOptions] = React.useState({
17308
+ startOffset: 0,
17309
+ // 可视区域距离顶部的偏移量
17310
+ startIndex: 0,
17311
+ // 可视区域开始索引
17312
+ overStart: 0,
17313
+ endIndex: 10
17314
+ // 可视区域结束索引
17315
+ });
17316
+ React.useEffect(() => {
17317
+ setPositions((options2) => {
17318
+ return { ...options2, endIndex: visibleCount() };
17319
+ });
17320
+ }, [itemHeight, overscan, offSetSize]);
17321
+ React.useEffect(() => {
17322
+ if (containerHeight)
17323
+ return;
17324
+ setOffSetSize(getContainerHeight());
17325
+ }, [containerHeight]);
17326
+ React.useEffect(() => {
17327
+ const pos = initPositinoCache(itemHeight, list.length);
17328
+ setPositions(pos);
17329
+ }, [itemHeight, list]);
17330
+ const getContainerHeight = () => {
17331
+ const initH = itemHeight * list.length;
17332
+ return initH < clientHeight ? initH + overscan * itemHeight - 5 : Math.min(containerHeight, clientHeight);
17333
+ };
17334
+ const visibleCount = () => {
17335
+ return Math.ceil(getContainerHeight() / itemHeight) + overscan;
17336
+ };
17337
+ const end = () => {
17338
+ return start + visibleCount();
17339
+ };
17340
+ const listHeight = () => {
17341
+ return list.length * itemHeight;
17342
+ };
17343
+ const visibleData = () => {
17344
+ return list.slice(start, Math.min(end(), list.length));
17345
+ };
17346
+ const updateTotalSize = React.useCallback(() => {
17347
+ if (!itemsRef.current)
17348
+ return;
17349
+ const items = itemsRef.current.children;
17350
+ if (!items.length)
17351
+ return;
17352
+ updateItemSize(positions, items, "height");
17353
+ }, [positions]);
17354
+ const listScroll = (e) => {
17355
+ const scrollTop = e.detail ? e.detail.scrollTop : e.target.scrollTop;
17356
+ const scrollSize = Math.floor(scrollTop);
17357
+ const startIndex = binarySearch(positions, scrollSize, false);
17358
+ const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
17359
+ const endIndex = end();
17360
+ if (!itemEqual) {
17361
+ updateTotalSize();
17362
+ }
17363
+ setStart(Math.floor(scrollTop / itemHeight));
17364
+ setOptions({ startOffset, startIndex, overStart, endIndex });
17365
+ if (end() > list.length - 1) {
17366
+ onScroll && onScroll();
17367
+ }
17368
+ setStartOffset(scrollTop - scrollTop % itemHeight);
17369
+ };
17370
+ return /* @__PURE__ */ React.createElement(
17371
+ "div",
17372
+ {
17373
+ className: className ? `${className} nut-virtualList-box` : "nut-virtualList-box",
17374
+ ...rest,
17375
+ style: {
17376
+ height: containerHeight ? `${offSetSize}px` : ""
17377
+ }
17378
+ },
17379
+ /* @__PURE__ */ React.createElement(
17380
+ components.ScrollView,
17381
+ {
17382
+ scrollY: true,
17383
+ type: "list",
17384
+ ref: scrollRef,
17385
+ className: "nut-virtuallist",
17386
+ style: {
17387
+ height: `${getContainerHeight()}px`
17388
+ },
17389
+ onScroll: listScroll
17390
+ },
17391
+ /* @__PURE__ */ React.createElement(
17392
+ "div",
17393
+ {
17394
+ className: "nut-virtuallist-phantom",
17395
+ style: { height: `${listHeight()}px` }
17396
+ }
17397
+ ),
17398
+ /* @__PURE__ */ React.createElement(
17399
+ "div",
17400
+ {
17401
+ className: "nut-virtuallist-container",
17402
+ ref: itemsRef,
17403
+ style: { transform: `translate3d(0, ${startOffset}px, 0)` }
17404
+ },
17405
+ visibleData().map((data, index) => {
17406
+ const { overStart } = options;
17407
+ const dataIndex = overStart + index;
17408
+ key && data[key] ? data[key] : dataIndex;
17409
+ return /* @__PURE__ */ React.createElement(
17410
+ "div",
17411
+ {
17412
+ "data-index": `${dataIndex}`,
17413
+ className: "nut-virtuallist-item",
17414
+ key: `${data}`,
17415
+ style: {
17416
+ height: `${itemEqual ? `${itemHeight}px` : "auto"}`
17417
+ }
17418
+ },
17419
+ itemRender ? itemRender(data, dataIndex, index) : data
17420
+ );
17421
+ })
17422
+ )
17423
+ )
17424
+ );
17425
+ };
17426
+ VirtualList.defaultProps = defaultProps$6;
17427
+ VirtualList.displayName = "NutVirtualList";
17338
17428
  const defaultProps$5 = {
17339
17429
  ...ComponentDefaults,
17340
17430
  list: [],
@@ -17675,13 +17765,13 @@ var __publicField = (obj, key, value) => {
17675
17765
  digits: 2,
17676
17766
  symbol: false,
17677
17767
  zero: false,
17678
- arrowLeft: false,
17679
- syncColor: true,
17768
+ left: false,
17769
+ sync: true,
17680
17770
  color: "#333",
17681
17771
  riseColor: "#fa2c19",
17682
17772
  dropColor: "#64b578",
17683
17773
  riseIcon: null,
17684
- downIcon: null
17774
+ dropIcon: null
17685
17775
  };
17686
17776
  const TrendArrow = (props) => {
17687
17777
  const {
@@ -17689,13 +17779,13 @@ var __publicField = (obj, key, value) => {
17689
17779
  digits,
17690
17780
  symbol,
17691
17781
  zero,
17692
- arrowLeft,
17693
- syncColor,
17782
+ left,
17783
+ sync,
17694
17784
  color,
17695
17785
  riseColor,
17696
17786
  dropColor,
17697
17787
  riseIcon,
17698
- downIcon,
17788
+ dropIcon,
17699
17789
  className,
17700
17790
  style,
17701
17791
  children,
@@ -17713,7 +17803,7 @@ var __publicField = (obj, key, value) => {
17713
17803
  };
17714
17804
  const calcStyle = (() => {
17715
17805
  const arrowColor = rateTrend.current ? riseColor : dropColor;
17716
- const textEquArrowColor = syncColor ? arrowColor : color;
17806
+ const textEquArrowColor = sync ? arrowColor : color;
17717
17807
  const style2 = {
17718
17808
  color: value === 0 ? color : textEquArrowColor
17719
17809
  };
@@ -17735,8 +17825,8 @@ var __publicField = (obj, key, value) => {
17735
17825
  };
17736
17826
  return iconProps;
17737
17827
  })();
17738
- const renderContent = (arrowLeft2) => {
17739
- const classNameSuffix = !arrowLeft2 ? "icon-after" : "icon-before";
17828
+ const renderContent = (left2) => {
17829
+ const classNameSuffix = !left2 ? "icon-after" : "icon-before";
17740
17830
  return /* @__PURE__ */ React.createElement(
17741
17831
  "span",
17742
17832
  {
@@ -17746,7 +17836,7 @@ var __publicField = (obj, key, value) => {
17746
17836
  calcRate
17747
17837
  );
17748
17838
  };
17749
- return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className}`, style, ...rest }, !arrowLeft && renderContent(!arrowLeft), Number(value) !== 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, rateTrend.current ? /* @__PURE__ */ React.createElement(React.Fragment, null, riseIcon || /* @__PURE__ */ React.createElement(a, { color: calcIconProps.color })) : /* @__PURE__ */ React.createElement(React.Fragment, null, downIcon || /* @__PURE__ */ React.createElement(a$1, { color: calcIconProps.color }))), arrowLeft && renderContent(!arrowLeft));
17839
+ return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className}`, style, ...rest }, !left && renderContent(!left), Number(value) !== 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, rateTrend.current ? /* @__PURE__ */ React.createElement(React.Fragment, null, riseIcon || /* @__PURE__ */ React.createElement(a, { color: calcIconProps.color })) : /* @__PURE__ */ React.createElement(React.Fragment, null, dropIcon || /* @__PURE__ */ React.createElement(a$1, { color: calcIconProps.color }))), left && renderContent(!left));
17750
17840
  };
17751
17841
  TrendArrow.defaultProps = defaultProps$1;
17752
17842
  TrendArrow.displayName = "NutTrendArrow";