@nutui/nutui-react 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 (90) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/esm/ActionSheet.js +2 -2
  3. package/dist/esm/Calendar/style/style.css +1 -1
  4. package/dist/esm/Calendar.js +8 -6
  5. package/dist/esm/CalendarItem.js +288 -291
  6. package/dist/esm/ConfigProvider.js +6 -483
  7. package/dist/esm/Dialog/style/style.css +1 -1
  8. package/dist/esm/Elevator.js +4 -4
  9. package/dist/esm/Menu.js +0 -1
  10. package/dist/esm/NavBar.js +2 -2
  11. package/dist/esm/NoticeBar.js +2 -2
  12. package/dist/esm/NumberKeyboard.js +2 -2
  13. package/dist/esm/Popover.js +6 -7
  14. package/dist/esm/SearchBar.js +2 -2
  15. package/dist/esm/ShortPassword.js +4 -4
  16. package/dist/esm/TrendArrow.js +11 -11
  17. package/dist/esm/Uploader.js +4 -4
  18. package/dist/esm/VirtualList.js +3 -8
  19. package/dist/esm/cascader2.js +2 -2
  20. package/dist/esm/configprovider2.js +486 -0
  21. package/dist/esm/date.js +103 -2
  22. package/dist/esm/nutui-react.es.js +30 -30
  23. package/dist/esm/popup2.js +5 -5
  24. package/dist/esm/types/src/packages/calendar/calendar.d.ts +4 -6
  25. package/dist/esm/types/src/packages/calendar/calendar.taro.d.ts +4 -6
  26. package/dist/esm/types/src/packages/calendar/type.d.ts +13 -0
  27. package/dist/esm/types/src/packages/calendar/utils.d.ts +8 -0
  28. package/dist/esm/types/src/packages/calendaritem/calendaritem.d.ts +25 -27
  29. package/dist/esm/types/src/packages/calendaritem/calendaritem.taro.d.ts +26 -28
  30. package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
  31. package/dist/esm/types/src/packages/elevator/elevator.d.ts +2 -2
  32. package/dist/esm/types/src/packages/elevator/elevator.taro.d.ts +2 -2
  33. package/dist/esm/types/src/packages/navbar/demo.d.ts +1 -0
  34. package/dist/esm/types/src/packages/navbar/demo.taro.d.ts +1 -0
  35. package/dist/esm/types/src/packages/navbar/navbar.d.ts +1 -1
  36. package/dist/esm/types/src/packages/navbar/navbar.taro.d.ts +1 -1
  37. package/dist/esm/types/src/packages/noticebar/noticebar.d.ts +1 -1
  38. package/dist/esm/types/src/packages/noticebar/noticebar.taro.d.ts +1 -1
  39. package/dist/esm/types/src/packages/nutui.react.build.d.ts +3 -3
  40. package/dist/esm/types/src/packages/nutui.react.d.ts +5 -5
  41. package/dist/esm/types/src/packages/nutui.react.scss.d.ts +2 -2
  42. package/dist/esm/types/src/packages/nutui.react.taro.d.ts +5 -5
  43. package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +2 -2
  44. package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +3 -3
  45. package/dist/esm/types/src/packages/popover/popover.d.ts +2 -2
  46. package/dist/esm/types/src/packages/popover/popover.taro.d.ts +2 -2
  47. package/dist/esm/types/src/packages/popup/popup.d.ts +2 -2
  48. package/dist/esm/types/src/packages/popup/popup.taro.d.ts +2 -2
  49. package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +1 -1
  50. package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +1 -1
  51. package/dist/esm/types/src/packages/trendarrow/trendarrow.d.ts +3 -3
  52. package/dist/esm/types/src/packages/trendarrow/trendarrow.taro.d.ts +3 -3
  53. package/dist/esm/types/src/packages/uploader/uploader.d.ts +1 -1
  54. package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +1 -1
  55. package/dist/esm/types/src/packages/virtuallist/virtuallist.d.ts +2 -2
  56. package/dist/esm/types/src/packages/virtuallist/virtuallist.taro.d.ts +2 -2
  57. package/dist/esm/types/src/utils/date.d.ts +19 -3
  58. package/dist/locales/base.js +1 -1
  59. package/dist/locales/en-US.js +1 -1
  60. package/dist/locales/id-ID.js +1 -1
  61. package/dist/locales/tr-TR.js +1 -1
  62. package/dist/locales/zh-CN.js +1 -1
  63. package/dist/locales/zh-TW.js +1 -1
  64. package/dist/locales/zh-UG.js +1 -1
  65. package/dist/nutui.react.es.js +788 -700
  66. package/dist/nutui.react.umd.js +788 -700
  67. package/dist/packages/calendar/calendar.scss +4 -0
  68. package/dist/packages/dialog/dialog.scss +1 -1
  69. package/dist/style.css +1 -1
  70. package/dist/style.mjs +1 -1
  71. package/dist/styles/themes/default.scss +2 -2
  72. package/dist/styles/variables-jmapp.scss +2 -2
  73. package/dist/styles/variables.scss +2 -2
  74. package/dist/types/index.d.ts +3 -3
  75. package/dist/types/packages/calendar/calendar.d.ts +8 -6
  76. package/dist/types/packages/calendar/type.d.ts +13 -0
  77. package/dist/types/packages/calendar/utils.d.ts +8 -0
  78. package/dist/types/packages/calendaritem/calendaritem.d.ts +25 -27
  79. package/dist/types/packages/configprovider/types.d.ts +1 -1
  80. package/dist/types/packages/elevator/elevator.d.ts +2 -2
  81. package/dist/types/packages/navbar/navbar.d.ts +1 -1
  82. package/dist/types/packages/noticebar/noticebar.d.ts +1 -1
  83. package/dist/types/packages/popover/popover.d.ts +2 -2
  84. package/dist/types/packages/popup/popup.d.ts +2 -2
  85. package/dist/types/packages/searchbar/searchbar.d.ts +1 -1
  86. package/dist/types/packages/trendarrow/trendarrow.d.ts +3 -3
  87. package/dist/types/packages/uploader/uploader.d.ts +1 -1
  88. package/dist/types/packages/virtuallist/virtuallist.d.ts +2 -2
  89. package/dist/types/utils/date.d.ts +19 -3
  90. package/package.json +1 -1
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  return value;
10
10
  };
11
11
  /*!
12
- * @nutui/nutui-react v2.0.0-beta.1 Wed Jun 21 2023 15:03:52 GMT+0800 (China Standard Time)
12
+ * @nutui/nutui-react v2.0.0-beta.2 Wed Jun 28 2023 16:06:00 GMT+0800 (China Standard Time)
13
13
  * (c) 2023 @jdf2e.
14
14
  * Released under the MIT License.
15
15
  */
@@ -9015,8 +9015,8 @@ Please add \`${key}Action\` when creating your handler.`);
9015
9015
  showKeys,
9016
9016
  className,
9017
9017
  style,
9018
- onClickItem,
9019
- onClickIndex,
9018
+ onItemClick,
9019
+ onIndexClick,
9020
9020
  children,
9021
9021
  ...rest
9022
9022
  } = {
@@ -9098,12 +9098,12 @@ Please add \`${key}Action\` when creating your handler.`);
9098
9098
  }
9099
9099
  });
9100
9100
  const handleClickItem = (key, item) => {
9101
- onClickItem && onClickItem(key, item);
9101
+ onItemClick && onItemClick(key, item);
9102
9102
  setCurrentData(item);
9103
9103
  setCurrentKey(key);
9104
9104
  };
9105
9105
  const handleClickIndex = (key) => {
9106
- onClickIndex && onClickIndex(key);
9106
+ onIndexClick && onIndexClick(key);
9107
9107
  };
9108
9108
  const setListGroup = () => {
9109
9109
  if (listview.current) {
@@ -9301,7 +9301,7 @@ Please add \`${key}Action\` when creating your handler.`);
9301
9301
  safeAreaInsetTop,
9302
9302
  placeholder,
9303
9303
  zIndex,
9304
- onClickBack
9304
+ onBackClick
9305
9305
  } = {
9306
9306
  ...defaultProps$1b,
9307
9307
  ...props
@@ -9319,7 +9319,7 @@ Please add \`${key}Action\` when creating your handler.`);
9319
9319
  "div",
9320
9320
  {
9321
9321
  className: `${classPrefix2}__left__back`,
9322
- onClick: (e) => onClickBack(e)
9322
+ onClick: (e) => onBackClick(e)
9323
9323
  },
9324
9324
  back
9325
9325
  ), left);
@@ -11100,8 +11100,8 @@ Please add \`${key}Action\` when creating your handler.`);
11100
11100
  },
11101
11101
  onClose: () => {
11102
11102
  },
11103
- onClickOverlay: (e) => true,
11104
- onClickCloseIcon: (e) => true,
11103
+ onOverlayClick: (e) => true,
11104
+ onCloseIconClick: (e) => true,
11105
11105
  ...defaultOverlayProps
11106
11106
  };
11107
11107
  let _zIndex = 1e3;
@@ -11130,8 +11130,8 @@ Please add \`${key}Action\` when creating your handler.`);
11130
11130
  portal,
11131
11131
  onOpen,
11132
11132
  onClose,
11133
- onClickOverlay,
11134
- onClickCloseIcon,
11133
+ onOverlayClick,
11134
+ onCloseIconClick,
11135
11135
  afterShow,
11136
11136
  afterClose,
11137
11137
  onClick
@@ -11187,7 +11187,7 @@ Please add \`${key}Action\` when creating your handler.`);
11187
11187
  const onHandleClickOverlay = (e) => {
11188
11188
  e.stopPropagation();
11189
11189
  if (closeOnOverlayClick) {
11190
- const closed = onClickOverlay && onClickOverlay(e);
11190
+ const closed = onOverlayClick && onOverlayClick(e);
11191
11191
  closed && close();
11192
11192
  }
11193
11193
  };
@@ -11195,7 +11195,7 @@ Please add \`${key}Action\` when creating your handler.`);
11195
11195
  onClick && onClick(e);
11196
11196
  };
11197
11197
  const onHandleClickCloseIcon = (e) => {
11198
- const closed = onClickCloseIcon && onClickCloseIcon(e);
11198
+ const closed = onCloseIconClick && onCloseIconClick(e);
11199
11199
  closed && close();
11200
11200
  };
11201
11201
  const onHandleOpened = (e) => {
@@ -12290,8 +12290,8 @@ Please add \`${key}Action\` when creating your handler.`);
12290
12290
  closeIconPosition,
12291
12291
  title: popup && props.title,
12292
12292
  left: props.left,
12293
- onClickOverlay: closePopup,
12294
- onClickCloseIcon: closePopup
12293
+ onOverlayClick: closePopup,
12294
+ onCloseIconClick: closePopup
12295
12295
  },
12296
12296
  renderTabs()
12297
12297
  ) : renderTabs());
@@ -12543,7 +12543,7 @@ Please add \`${key}Action\` when creating your handler.`);
12543
12543
  return dayNames[index];
12544
12544
  },
12545
12545
  /**
12546
- * 返回星期数
12546
+ * 返回上一个月在当前面板中的天数
12547
12547
  * @return {Number}
12548
12548
  */
12549
12549
  getMonthPreDay(year, month) {
@@ -12632,9 +12632,140 @@ Please add \`${key}Action\` when creating your handler.`);
12632
12632
  return true;
12633
12633
  }
12634
12634
  return false;
12635
+ },
12636
+ getMonthWeek(year, month, date2, firstDayOfWeek = 0) {
12637
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
12638
+ let w = dateNow.getDay();
12639
+ const d = dateNow.getDate();
12640
+ let remainder = 6 - w;
12641
+ if (firstDayOfWeek !== 0) {
12642
+ w = w === 0 ? 7 : w;
12643
+ remainder = 7 - w;
12644
+ }
12645
+ return Math.ceil((d + remainder) / 7);
12646
+ },
12647
+ getYearWeek(year, month, date2, firstDayOfWeek = 0) {
12648
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
12649
+ const dateFirst = new Date(Number(year), 0, 1);
12650
+ const dataNumber = Math.round(
12651
+ (dateNow.valueOf() - dateFirst.valueOf()) / 864e5
12652
+ );
12653
+ return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
12654
+ },
12655
+ getWeekDate(year, month, date2, firstDayOfWeek = 0) {
12656
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date2));
12657
+ const nowTime = dateNow.getTime();
12658
+ let day = dateNow.getDay();
12659
+ if (firstDayOfWeek === 0) {
12660
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
12661
+ const SundayTime2 = nowTime - day * oneDayTime2;
12662
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
12663
+ const sunday2 = this.date2Str(new Date(SundayTime2));
12664
+ const saturday = this.date2Str(new Date(SaturdayTime));
12665
+ return [sunday2, saturday];
12666
+ }
12667
+ day = day === 0 ? 7 : day;
12668
+ const oneDayTime = 24 * 60 * 60 * 1e3;
12669
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
12670
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
12671
+ const monday = this.date2Str(new Date(MondayTime));
12672
+ const sunday = this.date2Str(new Date(SundayTime));
12673
+ return [monday, sunday];
12674
+ },
12675
+ formatResultDate(date2) {
12676
+ const days = [...date2.split("-")];
12677
+ days[2] = Utils.getNumTwoBit(Number(days[2]));
12678
+ days[3] = `${days[0]}-${days[1]}-${days[2]}`;
12679
+ days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
12680
+ return days;
12681
+ }
12682
+ };
12683
+ const getCurrMonthData = (type2, year, month) => {
12684
+ switch (type2) {
12685
+ case "prev":
12686
+ month === 1 && (year -= 1);
12687
+ month = month === 1 ? 12 : --month;
12688
+ break;
12689
+ case "next":
12690
+ month === 12 && (year += 1);
12691
+ month = month === 12 ? 1 : ++month;
12692
+ break;
12693
+ }
12694
+ return [
12695
+ year,
12696
+ Utils.getNumTwoBit(month),
12697
+ Utils.getMonthDays(String(year), String(month))
12698
+ ];
12699
+ };
12700
+ const getDaysStatus = (type2, year, month) => {
12701
+ let days = Utils.getMonthDays(`${year}`, `${month}`);
12702
+ if (type2 === "prev" && days >= 7) {
12703
+ days -= 7;
12704
+ }
12705
+ return Array.from(Array(days), (v, k2) => {
12706
+ return {
12707
+ day: k2 + 1,
12708
+ type: type2,
12709
+ year,
12710
+ month
12711
+ };
12712
+ });
12713
+ };
12714
+ const getPreMonthDates = (type2, year, month, firstDayOfWeek) => {
12715
+ let preMonth = +month - 1;
12716
+ let preYear = year;
12717
+ if (preMonth <= 0) {
12718
+ preMonth = 12;
12719
+ preYear += 1;
12720
+ }
12721
+ let days = Utils.getMonthPreDay(+year, +month);
12722
+ days -= firstDayOfWeek;
12723
+ if (type2 === "prev" && days >= 7) {
12724
+ days -= 7;
12725
+ }
12726
+ const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
12727
+ const months = Array.from(Array(preDates), (v, k2) => {
12728
+ return {
12729
+ day: k2 + 1,
12730
+ type: type2,
12731
+ preYear,
12732
+ preMonth
12733
+ };
12734
+ });
12735
+ return months.slice(preDates - days);
12736
+ };
12737
+ const splitDate = (date2) => {
12738
+ const split = date2.indexOf("-") !== -1 ? "-" : "/";
12739
+ return date2.split(split);
12740
+ };
12741
+ const isMultiple = (day, days) => {
12742
+ if (days.length > 0) {
12743
+ return days.some((item) => {
12744
+ return Utils.isEqual(item, day);
12745
+ });
12635
12746
  }
12747
+ return false;
12748
+ };
12749
+ const isCurrDay = (month, day) => {
12750
+ const date2 = `${month.curData[0]}/${month.curData[1]}/${day}`;
12751
+ return Utils.isEqual(date2, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
12752
+ };
12753
+ const getCurrDate = (day, month) => {
12754
+ return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
12755
+ +day.day
12756
+ )}`;
12757
+ };
12758
+ const isStart = (day, days) => {
12759
+ return Utils.isEqual(days[0], day);
12760
+ };
12761
+ const isEnd = (day, days) => {
12762
+ return Utils.isEqual(days[1], day);
12763
+ };
12764
+ const isStartAndEnd = (days) => {
12765
+ return days.length >= 2 && Utils.isEqual(days[0], days[1]);
12636
12766
  };
12637
12767
  const defaultProps$_ = {
12768
+ ...ComponentDefaults,
12638
12769
  type: "single",
12639
12770
  autoBackfill: false,
12640
12771
  popup: true,
@@ -12648,6 +12779,7 @@ Please add \`${key}Action\` when creating your handler.`);
12648
12779
  showTitle: true,
12649
12780
  showSubTitle: true,
12650
12781
  scrollAnimation: true,
12782
+ firstDayOfWeek: 0,
12651
12783
  renderHeaderButtons: void 0,
12652
12784
  renderDay: void 0,
12653
12785
  renderDayTop: void 0,
@@ -12656,7 +12788,7 @@ Please add \`${key}Action\` when creating your handler.`);
12656
12788
  },
12657
12789
  onUpdate: () => {
12658
12790
  },
12659
- onClickDay: (data) => {
12791
+ onDayClick: (data) => {
12660
12792
  },
12661
12793
  onPageChange: (data) => {
12662
12794
  }
@@ -12664,11 +12796,13 @@ Please add \`${key}Action\` when creating your handler.`);
12664
12796
  const CalendarItem = React.forwardRef((props, ref) => {
12665
12797
  const { locale } = useConfig();
12666
12798
  const {
12799
+ popup,
12667
12800
  type: type2,
12668
12801
  autoBackfill,
12669
- popup,
12670
12802
  title,
12671
12803
  defaultValue,
12804
+ startDate,
12805
+ endDate,
12672
12806
  showToday,
12673
12807
  startText,
12674
12808
  endText,
@@ -12676,28 +12810,29 @@ Please add \`${key}Action\` when creating your handler.`);
12676
12810
  showTitle,
12677
12811
  showSubTitle,
12678
12812
  scrollAnimation,
12813
+ firstDayOfWeek,
12679
12814
  renderHeaderButtons,
12680
12815
  renderDay,
12681
12816
  renderDayTop,
12682
12817
  renderDayBottom,
12683
12818
  onConfirm,
12684
12819
  onUpdate,
12685
- onClickDay,
12820
+ onDayClick,
12686
12821
  onPageChange
12687
12822
  } = { ...defaultProps$_, ...props };
12688
- const weeks = locale.calendaritem.weekdays;
12823
+ const weekdays = locale.calendaritem.weekdays;
12824
+ const weeks = [
12825
+ ...weekdays.slice(firstDayOfWeek, 7),
12826
+ ...weekdays.slice(0, firstDayOfWeek)
12827
+ ];
12689
12828
  const monthTitle = locale.calendaritem.monthTitle;
12690
12829
  const [yearMonthTitle, setYearMonthTitle] = React.useState("");
12691
12830
  const [monthsData, setMonthsData] = React.useState([]);
12692
12831
  const [monthsNum, setMonthsNum] = React.useState(0);
12693
12832
  const [translateY, setTranslateY] = React.useState(0);
12694
12833
  const [monthDefaultRange, setMonthDefaultRange] = React.useState([]);
12695
- const propStartDate = props.startDate || Utils.getDay(0);
12696
- const propEndDate = props.endDate || Utils.getDay(365);
12697
- const splitDate = (date2) => {
12698
- const split = date2.indexOf("-") !== -1 ? "-" : "/";
12699
- return date2.split(split);
12700
- };
12834
+ const propStartDate = startDate || Utils.getDay(0);
12835
+ const propEndDate = endDate || Utils.getDay(365);
12701
12836
  const startDates = splitDate(propStartDate);
12702
12837
  const endDates = splitDate(propEndDate);
12703
12838
  const [state] = React.useState({
@@ -12724,171 +12859,49 @@ Please add \`${key}Action\` when creating your handler.`);
12724
12859
  let viewHeight = 0;
12725
12860
  const classPrefix2 = "nut-calendar";
12726
12861
  const dayPrefix = "nut-calendar-day";
12727
- const classes = classNames(
12728
- {
12729
- [`${classPrefix2}-title`]: !popup,
12730
- [`${classPrefix2}-nofooter`]: !!autoBackfill
12731
- },
12732
- classPrefix2
12733
- );
12734
- const headerClasses = classNames({
12735
- [`${classPrefix2}-header`]: true,
12736
- [`${classPrefix2}-header-title`]: !popup
12737
- });
12738
- const isMultiple = (d) => {
12739
- if (currentDate.length > 0) {
12740
- return currentDate.some((item) => {
12741
- return Utils.isEqual(item, d);
12742
- });
12743
- }
12744
- return false;
12745
- };
12746
- const getCurrDate = (day, month) => {
12747
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
12748
- +day.day
12749
- )}`;
12750
- };
12751
- const getClasses = (day, month) => {
12752
- const dateStr = getCurrDate(day, month);
12753
- if (day.type === "active") {
12754
- if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
12755
- return `${dayPrefix}-disabled`;
12756
- }
12757
- if (type2 === "range") {
12758
- if (isStart(dateStr) || isEnd(dateStr)) {
12759
- return `${dayPrefix}-active ${isStart(dateStr) ? "active-start" : ""} ${isEnd(dateStr) ? "active-end" : ""}`;
12760
- }
12761
- if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
12762
- return `${dayPrefix}-choose`;
12763
- }
12764
- return null;
12765
- }
12766
- if (type2 === "multiple" && isMultiple(dateStr) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
12767
- return `${dayPrefix}-active`;
12768
- }
12769
- return null;
12770
- }
12771
- return `${dayPrefix}-disabled`;
12772
- };
12773
- const isCurrDay = (month, day) => {
12774
- const date2 = `${month.curData[0]}/${month.curData[1]}/${day}`;
12775
- return Utils.isEqual(date2, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
12776
- };
12777
- const isStart = (d) => {
12778
- return Utils.isEqual(currentDate[0], d);
12779
- };
12780
- const isEnd = (d) => {
12781
- return Utils.isEqual(currentDate[1], d);
12782
- };
12783
- const isStartTip = (day, month) => {
12784
- return type2 === "range" && day.type === "active" && isStart(getCurrDate(day, month));
12785
- };
12786
- const isEndTip = (day, month) => {
12787
- return currentDate.length >= 2 && type2 === "range" && day.type === "active" && isEnd(getCurrDate(day, month));
12788
- };
12789
- const isStartAndEnd = () => {
12790
- return currentDate.length >= 2 && Utils.isEqual(currentDate[0], currentDate[1]);
12791
- };
12792
- const getCurrMonthData = (type22) => {
12793
- const monthData = type22 === "prev" ? monthsData[0] : monthsData[monthsData.length - 1];
12794
- let year = parseInt(monthData.curData[0]);
12795
- let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
12796
- switch (type22) {
12797
- case "prev":
12798
- month === 1 && (year -= 1);
12799
- month = month === 1 ? 12 : --month;
12800
- break;
12801
- case "next":
12802
- month === 12 && (year += 1);
12803
- month = month === 12 ? 1 : ++month;
12804
- break;
12805
- }
12806
- return [
12807
- year,
12808
- Utils.getNumTwoBit(month),
12809
- Utils.getMonthDays(String(year), String(month))
12810
- ];
12811
- };
12812
- const getDaysStatus = (days, type22, year, month) => {
12813
- if (type22 === "prev" && days >= 7) {
12814
- days -= 7;
12815
- }
12816
- return Array.from(Array(days), (v, k2) => {
12817
- return {
12818
- day: k2 + 1,
12819
- type: type22,
12820
- year,
12821
- month
12822
- };
12823
- });
12824
- };
12825
- const getPreDaysStatus = (days, type22, year, month, preCurrMonthDays) => {
12826
- if (type22 === "prev" && days >= 7) {
12827
- days -= 7;
12828
- }
12829
- const months = Array.from(Array(preCurrMonthDays), (v, k2) => {
12830
- return {
12831
- day: k2 + 1,
12832
- type: type22,
12833
- year,
12834
- month
12862
+ const getMonthData = (curData, monthNum, type22) => {
12863
+ let i = 0;
12864
+ let date2 = curData;
12865
+ const monthData = monthsData;
12866
+ do {
12867
+ const y2 = parseInt(date2[0], 10);
12868
+ const m = parseInt(date2[1], 10);
12869
+ const days = [
12870
+ ...getPreMonthDates("prev", y2, m, firstDayOfWeek),
12871
+ ...getDaysStatus("active", y2, m)
12872
+ ];
12873
+ const cssHeight = 39 + (days.length > 35 ? 384 : 320);
12874
+ let scrollTop = 0;
12875
+ if (monthData.length > 0) {
12876
+ const monthEle = monthData[monthData.length - 1];
12877
+ scrollTop = monthEle.scrollTop + monthEle.cssHeight;
12878
+ }
12879
+ const monthInfo = {
12880
+ curData: date2,
12881
+ title: monthTitle(y2, m),
12882
+ monthData: days,
12883
+ cssHeight,
12884
+ scrollTop
12835
12885
  };
12836
- });
12837
- return months.slice(preCurrMonthDays - days);
12838
- };
12839
- const getMonthData = (curData, type22) => {
12840
- let preMonth = +curData[1] - 1;
12841
- let preYear = curData[0];
12842
- if (preMonth <= 0) {
12843
- preMonth = 12;
12844
- preYear += 1;
12845
- }
12846
- const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
12847
- const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
12848
- const preCurrMonthDays = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
12849
- const monthInfo = {
12850
- curData,
12851
- title: monthTitle(curData[0], curData[1]),
12852
- monthData: [
12853
- ...getPreDaysStatus(
12854
- preMonthDays,
12855
- "prev",
12856
- `${preMonth}`,
12857
- preYear,
12858
- preCurrMonthDays
12859
- ),
12860
- ...getDaysStatus(
12861
- currMonthDays,
12862
- "active",
12863
- curData[0],
12864
- curData[1]
12865
- )
12866
- ]
12867
- };
12868
- monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
12869
- let scrollTop = 0;
12870
- if (monthsData.length > 0) {
12871
- const monthEle = monthsData[monthsData.length - 1];
12872
- scrollTop = monthEle.scrollTop + monthEle.cssHeight;
12873
- }
12874
- monthInfo.scrollTop = scrollTop;
12875
- if (type22 === "next") {
12876
- if (!endDates || !Utils.compareDate(
12877
- `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
12878
- endDates[0],
12879
- endDates[1]
12880
- )}`,
12881
- `${curData[0]}/${curData[1]}/${curData[2]}`
12886
+ if (type22 === "next") {
12887
+ if (!endDates || !Utils.compareDate(
12888
+ `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
12889
+ endDates[0],
12890
+ endDates[1]
12891
+ )}`,
12892
+ `${curData[0]}/${curData[1]}/${curData[2]}`
12893
+ )) {
12894
+ monthData.push(monthInfo);
12895
+ }
12896
+ } else if (!startDates || !Utils.compareDate(
12897
+ `${curData[0]}/${curData[1]}/${curData[2]}`,
12898
+ `${startDates[0]}/${startDates[1]}/01`
12882
12899
  )) {
12883
- monthsData.push(monthInfo);
12900
+ monthData.unshift(monthInfo);
12884
12901
  }
12885
- } else if (!startDates || !Utils.compareDate(
12886
- `${curData[0]}/${curData[1]}/${curData[2]}`,
12887
- `${startDates[0]}/${startDates[1]}/01`
12888
- )) {
12889
- monthsData.unshift(monthInfo);
12890
- }
12891
- setMonthsData(monthsData);
12902
+ date2 = getCurrMonthData("next", y2, m);
12903
+ } while (i++ < monthNum);
12904
+ setMonthsData(monthData);
12892
12905
  };
12893
12906
  const setReachedYearMonthInfo = (current) => {
12894
12907
  const currentMonthsData = monthsData[current];
@@ -12920,48 +12933,11 @@ Please add \`${key}Action\` when creating your handler.`);
12920
12933
  setTranslateY(monthsData[start2].scrollTop);
12921
12934
  setReachedYearMonthInfo(current);
12922
12935
  };
12923
- const monthsViewScroll = (e) => {
12924
- if (monthsData.length <= 1) {
12925
- return;
12926
- }
12927
- const scrollTop = e.target.scrollTop;
12928
- let current = Math.floor(scrollTop / avgHeight);
12929
- const nextTop = monthsData[current + 1].scrollTop;
12930
- const nextHeight = monthsData[current + 1].cssHeight;
12931
- if (current === 0) {
12932
- if (scrollTop >= nextTop) {
12933
- current += 1;
12934
- }
12935
- } else if (current > 0 && current < monthsNum - 1) {
12936
- if (scrollTop >= nextTop) {
12937
- current += 1;
12938
- }
12939
- if (scrollTop < monthsData[current].scrollTop) {
12940
- current -= 1;
12941
- }
12942
- } else {
12943
- const viewPosition = Math.round(scrollTop + viewHeight);
12944
- if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
12945
- current += 1;
12946
- }
12947
- if (current >= 1 && scrollTop < monthsData[current - 1].scrollTop) {
12948
- current -= 1;
12949
- }
12950
- }
12951
- setDefaultRange(monthsNum, current);
12952
- };
12953
12936
  const getMonthNum = () => {
12954
- const startDate = {
12955
- year: Number(startDates[0]),
12956
- month: Number(startDates[1])
12957
- };
12958
- const endDate = {
12959
- year: Number(endDates[0]),
12960
- month: Number(endDates[1])
12961
- };
12962
- let monthNum = endDate.month - startDate.month;
12963
- if (endDate.year - startDate.year > 0) {
12964
- monthNum += 12 * (endDate.year - startDate.year);
12937
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
12938
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
12939
+ if (yearNum > 0) {
12940
+ monthNum += 12 * yearNum;
12965
12941
  }
12966
12942
  if (monthNum <= 0) {
12967
12943
  monthNum = 1;
@@ -12969,26 +12945,7 @@ Please add \`${key}Action\` when creating your handler.`);
12969
12945
  setMonthsNum(monthNum);
12970
12946
  return monthNum;
12971
12947
  };
12972
- const getMonthsData = (monthNum) => {
12973
- getMonthData(startDates, "next");
12974
- let i = 1;
12975
- do {
12976
- getMonthData(getCurrMonthData("next"), "next");
12977
- } while (i++ < monthNum);
12978
- };
12979
- const requestAniFrameFunc = (current, monthNum) => {
12980
- const lastItem = monthsData[monthsData.length - 1];
12981
- const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
12982
- requestAniFrame$1(() => {
12983
- if (monthsRef && monthsPanel && viewAreaRef) {
12984
- viewHeight = monthsRef.current.clientHeight;
12985
- monthsPanel.current.style.height = `${containerHeight}px`;
12986
- monthsRef.current.scrollTop = monthsData[current].scrollTop;
12987
- }
12988
- });
12989
- setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
12990
- };
12991
- const renderCurrentDate = () => {
12948
+ const setDefaultDate = () => {
12992
12949
  let defaultData = [];
12993
12950
  if (type2 === "range" && Array.isArray(currentDate)) {
12994
12951
  if (currentDate.length > 0) {
@@ -13003,7 +12960,7 @@ Please add \`${key}Action\` when creating your handler.`);
13003
12960
  ...splitDate(currentDate[1])
13004
12961
  ];
13005
12962
  }
13006
- } else if (props.type === "multiple" && Array.isArray(currentDate)) {
12963
+ } else if (type2 === "multiple" && Array.isArray(currentDate)) {
13007
12964
  if (currentDate.length > 0) {
13008
12965
  const defaultArr = [];
13009
12966
  const obj = {};
@@ -13018,6 +12975,22 @@ Please add \`${key}Action\` when creating your handler.`);
13018
12975
  currentDate.splice(0) && currentDate.push(...defaultArr);
13019
12976
  defaultData = [...splitDate(defaultArr[0])];
13020
12977
  }
12978
+ } else if (type2 === "week" && Array.isArray(currentDate)) {
12979
+ if (currentDate.length > 0) {
12980
+ const [y2, m, d] = splitDate(currentDate[0]);
12981
+ const weekArr = Utils.getWeekDate(y2, m, d, firstDayOfWeek);
12982
+ currentDate.splice(0) && currentDate.push(...weekArr);
12983
+ if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
12984
+ currentDate.splice(0, 1, propStartDate);
12985
+ }
12986
+ if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
12987
+ currentDate.splice(1, 1, propEndDate);
12988
+ }
12989
+ defaultData = [
12990
+ ...splitDate(currentDate[0]),
12991
+ ...splitDate(currentDate[1])
12992
+ ];
12993
+ }
13021
12994
  } else if (currentDate) {
13022
12995
  if (currentDate.length > 0) {
13023
12996
  if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
@@ -13031,6 +13004,9 @@ Please add \`${key}Action\` when creating your handler.`);
13031
13004
  defaultData = [];
13032
13005
  }
13033
13006
  }
13007
+ return defaultData;
13008
+ };
13009
+ const getCurrentIndex = (defaultData) => {
13034
13010
  let current = 0;
13035
13011
  let lastCurrent = 0;
13036
13012
  if (defaultData.length > 0) {
@@ -13038,38 +13014,53 @@ Please add \`${key}Action\` when creating your handler.`);
13038
13014
  if (item.title === monthTitle(defaultData[0], defaultData[1])) {
13039
13015
  current = index;
13040
13016
  }
13041
- if (props.type === "range") {
13017
+ if (type2 === "range" || type2 === "week") {
13042
13018
  if (item.title === monthTitle(defaultData[3], defaultData[4])) {
13043
13019
  lastCurrent = index;
13044
13020
  }
13045
13021
  }
13046
13022
  });
13047
13023
  } else {
13048
- const currentYear2 = (/* @__PURE__ */ new Date()).getFullYear();
13049
- const currentMonth = (/* @__PURE__ */ new Date()).getMonth() + 1;
13050
- const currentYearMonthIndex = monthsData.findIndex((item) => {
13051
- return +item.curData[0] === currentYear2 && +item.curData[1] === currentMonth;
13024
+ const date2 = /* @__PURE__ */ new Date();
13025
+ const year = date2.getFullYear();
13026
+ const month = date2.getMonth() + 1;
13027
+ const index = monthsData.findIndex((item) => {
13028
+ return +item.curData[0] === year && +item.curData[1] === month;
13052
13029
  });
13053
- if (currentYearMonthIndex > -1) {
13054
- current = currentYearMonthIndex;
13030
+ if (index > -1) {
13031
+ current = index;
13055
13032
  }
13056
13033
  }
13034
+ return {
13035
+ current,
13036
+ lastCurrent
13037
+ };
13038
+ };
13039
+ const renderCurrentDate = () => {
13040
+ const defaultData = setDefaultDate();
13041
+ const current = getCurrentIndex(defaultData);
13057
13042
  if (defaultData.length > 0) {
13058
13043
  if (type2 === "range") {
13059
13044
  chooseDay(
13060
13045
  { day: defaultData[2], type: "active" },
13061
- monthsData[current],
13046
+ monthsData[current.current],
13062
13047
  true
13063
13048
  );
13064
13049
  chooseDay(
13065
13050
  { day: defaultData[5], type: "active" },
13066
- monthsData[lastCurrent],
13051
+ monthsData[current.lastCurrent],
13052
+ true
13053
+ );
13054
+ } else if (props.type === "week") {
13055
+ chooseDay(
13056
+ { day: defaultData[2], type: "curr" },
13057
+ monthsData[current.current],
13067
13058
  true
13068
13059
  );
13069
13060
  } else if (type2 === "multiple") {
13070
13061
  [...currentDate].forEach((item) => {
13071
13062
  const dateArr = splitDate(item);
13072
- let currentIndex = current;
13063
+ let currentIndex = current.current;
13073
13064
  monthsData.forEach((item2, index) => {
13074
13065
  if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
13075
13066
  currentIndex = index;
@@ -13084,25 +13075,44 @@ Please add \`${key}Action\` when creating your handler.`);
13084
13075
  } else {
13085
13076
  chooseDay(
13086
13077
  { day: defaultData[2], type: "active" },
13087
- monthsData[current],
13078
+ monthsData[current.current],
13088
13079
  true
13089
13080
  );
13090
13081
  }
13091
13082
  }
13092
- return current;
13083
+ return current.current;
13084
+ };
13085
+ const requestAniFrameFunc = (current, monthNum) => {
13086
+ const lastItem = monthsData[monthsData.length - 1];
13087
+ const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
13088
+ requestAniFrame$1(() => {
13089
+ if (monthsRef && monthsPanel && viewAreaRef) {
13090
+ viewHeight = monthsRef.current.clientHeight;
13091
+ monthsPanel.current.style.height = `${containerHeight}px`;
13092
+ monthsRef.current.scrollTop = monthsData[current].scrollTop;
13093
+ }
13094
+ });
13095
+ setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
13093
13096
  };
13094
13097
  const initData = () => {
13095
13098
  const monthNum = getMonthNum();
13096
- getMonthsData(monthNum);
13099
+ getMonthData(startDates, monthNum, "next");
13097
13100
  const current = renderCurrentDate();
13098
13101
  setDefaultRange(monthNum, current);
13099
13102
  requestAniFrameFunc(current, monthNum);
13100
13103
  };
13104
+ React.useEffect(() => {
13105
+ initData();
13106
+ }, []);
13101
13107
  const resetRender = () => {
13102
13108
  state.currDateArray.splice(0);
13103
13109
  monthsData.splice(0);
13104
13110
  initData();
13105
13111
  };
13112
+ React.useEffect(() => {
13113
+ setCurrentDate(resetDefaultValue() || []);
13114
+ popup && resetRender();
13115
+ }, [defaultValue]);
13106
13116
  const scrollToDate = (date2) => {
13107
13117
  if (Utils.compareDate(date2, propStartDate)) {
13108
13118
  date2 = propStartDate;
@@ -13137,30 +13147,67 @@ Please add \`${key}Action\` when creating your handler.`);
13137
13147
  }
13138
13148
  });
13139
13149
  };
13140
- React.useEffect(() => {
13141
- initData();
13142
- }, []);
13143
- React.useEffect(() => {
13144
- setCurrentDate(resetDefaultValue() || []);
13145
- popup && resetRender();
13146
- }, [defaultValue]);
13150
+ const monthsViewScroll = (e) => {
13151
+ if (monthsData.length <= 1) {
13152
+ return;
13153
+ }
13154
+ const scrollTop = e.target.scrollTop;
13155
+ let current = Math.floor(scrollTop / avgHeight);
13156
+ const nextTop = monthsData[current + 1].scrollTop;
13157
+ const nextHeight = monthsData[current + 1].cssHeight;
13158
+ if (current === 0) {
13159
+ if (scrollTop >= nextTop) {
13160
+ current += 1;
13161
+ }
13162
+ } else if (current > 0 && current < monthsNum - 1) {
13163
+ if (scrollTop >= nextTop) {
13164
+ current += 1;
13165
+ }
13166
+ if (scrollTop < monthsData[current].scrollTop) {
13167
+ current -= 1;
13168
+ }
13169
+ } else {
13170
+ const viewPosition = Math.round(scrollTop + viewHeight);
13171
+ if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
13172
+ current += 1;
13173
+ }
13174
+ if (current >= 1 && scrollTop < monthsData[current - 1].scrollTop) {
13175
+ current -= 1;
13176
+ }
13177
+ }
13178
+ setDefaultRange(monthsNum, current);
13179
+ };
13147
13180
  React.useImperativeHandle(ref, () => ({
13148
13181
  scrollToDate
13149
13182
  }));
13150
- const confirm2 = () => {
13151
- if (type2 === "range" && state.currDateArray.length === 2 || type2 !== "range") {
13152
- const chooseData = state.currDateArray.slice(0);
13153
- onConfirm && onConfirm(chooseData);
13154
- if (popup) {
13155
- onUpdate && onUpdate();
13183
+ const getClasses = (day, month) => {
13184
+ const dateStr = getCurrDate(day, month);
13185
+ if (day.type === "active") {
13186
+ if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
13187
+ return `${dayPrefix}-disabled`;
13188
+ }
13189
+ if (type2 === "range" || type2 === "week") {
13190
+ if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
13191
+ return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
13192
+ }
13193
+ if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
13194
+ return `${dayPrefix}-choose`;
13195
+ }
13196
+ return null;
13197
+ }
13198
+ if (type2 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
13199
+ return `${dayPrefix}-active`;
13156
13200
  }
13201
+ return null;
13157
13202
  }
13203
+ return `${dayPrefix}-disabled`;
13158
13204
  };
13159
13205
  const chooseDay = (day, month, isFirst) => {
13160
13206
  if (getClasses(day, month) === `${dayPrefix}-disabled`) {
13161
13207
  return;
13162
13208
  }
13163
13209
  const days = [...month.curData];
13210
+ const [y2, m] = month.curData;
13164
13211
  days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
13165
13212
  days[3] = `${days[0]}/${days[1]}/${days[2]}`;
13166
13213
  days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
@@ -13197,67 +13244,109 @@ Please add \`${key}Action\` when creating your handler.`);
13197
13244
  Array.isArray(currentDate) && currentDate.unshift(days[3]);
13198
13245
  state.currDateArray = [[...days], ...state.currDateArray];
13199
13246
  }
13247
+ } else if (type2 === "week") {
13248
+ const weekArr = Utils.getWeekDate(y2, m, `${day.day}`, firstDayOfWeek);
13249
+ if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
13250
+ weekArr.splice(0, 1, propStartDate);
13251
+ }
13252
+ if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
13253
+ weekArr.splice(1, 1, propEndDate);
13254
+ }
13255
+ Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
13256
+ state.currDateArray = [
13257
+ Utils.formatResultDate(weekArr[0]),
13258
+ Utils.formatResultDate(weekArr[1])
13259
+ ];
13200
13260
  } else {
13201
13261
  setCurrentDate(days[3]);
13202
13262
  state.currDateArray = [...days];
13203
13263
  }
13204
13264
  if (!isFirst) {
13205
- onClickDay && onClickDay(state.currDateArray);
13265
+ onDayClick && onDayClick(state.currDateArray);
13206
13266
  if (autoBackfill || !popup) {
13207
13267
  confirm2();
13208
13268
  }
13209
13269
  }
13210
13270
  setMonthsData(monthsData.slice());
13211
13271
  };
13212
- 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(
13213
- "div",
13272
+ const confirm2 = () => {
13273
+ if (type2 === "range" && state.currDateArray.length === 2 || type2 !== "range") {
13274
+ const chooseData = state.currDateArray.slice(0);
13275
+ onConfirm && onConfirm(chooseData);
13276
+ if (popup) {
13277
+ onUpdate && onUpdate();
13278
+ }
13279
+ }
13280
+ };
13281
+ const classes = classNames(
13214
13282
  {
13215
- className: `${classPrefix2}-content`,
13216
- onScroll: monthsViewScroll,
13217
- ref: monthsRef
13283
+ [`${classPrefix2}-title`]: !popup,
13284
+ [`${classPrefix2}-nofooter`]: !!autoBackfill
13218
13285
  },
13219
- /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React.createElement(
13286
+ classPrefix2
13287
+ );
13288
+ const headerClasses = classNames({
13289
+ [`${classPrefix2}-header`]: true,
13290
+ [`${classPrefix2}-header-title`]: !popup
13291
+ });
13292
+ const isStartTip = (day, month) => {
13293
+ return (type2 === "range" || type2 === "week") && day.type === "active" && isStart(getCurrDate(day, month), currentDate);
13294
+ };
13295
+ const isEndTip = (day, month) => {
13296
+ return currentDate.length >= 2 && (type2 === "range" || type2 === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
13297
+ };
13298
+ const renderHeader = () => {
13299
+ 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))));
13300
+ };
13301
+ const renderContent = () => {
13302
+ return /* @__PURE__ */ React.createElement(
13220
13303
  "div",
13221
13304
  {
13222
- className: "viewArea",
13223
- ref: viewAreaRef,
13224
- style: { transform: `translateY(${translateY}px)` }
13305
+ className: `${classPrefix2}-content`,
13306
+ onScroll: monthsViewScroll,
13307
+ ref: monthsRef
13225
13308
  },
13226
- monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
13227
- 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(
13228
- "div",
13229
- {
13230
- className: [
13231
- `${classPrefix2}-day`,
13232
- getClasses(day, month)
13233
- ].join(" "),
13234
- onClick: () => {
13235
- chooseDay(day, month);
13236
- },
13237
- key: i
13238
- },
13239
- /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
13240
- !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
13241
- !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React.createElement(
13242
- "div",
13243
- {
13244
- className: `${classPrefix2}-day-info-bottom`
13245
- },
13246
- renderDayBottom(day)
13247
- ),
13248
- !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
13249
- isStartTip(day, month) && /* @__PURE__ */ React.createElement(
13309
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React.createElement(
13310
+ "div",
13311
+ {
13312
+ className: "viewArea",
13313
+ ref: viewAreaRef,
13314
+ style: { transform: `translateY(${translateY}px)` }
13315
+ },
13316
+ monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
13317
+ 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(
13250
13318
  "div",
13251
13319
  {
13252
- className: `${classPrefix2}-day-info ${isStartAndEnd() ? `${classPrefix2}-day-info-top` : ""}`
13320
+ className: [
13321
+ `${classPrefix2}-day`,
13322
+ getClasses(day, month)
13323
+ ].join(" "),
13324
+ onClick: () => {
13325
+ chooseDay(day, month);
13326
+ },
13327
+ key: i
13253
13328
  },
13254
- startText || locale.calendaritem.start
13255
- ),
13256
- isEndTip(day, month) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
13257
- ))));
13258
- })
13259
- ))
13260
- ), popup && !autoBackfill ? /* @__PURE__ */ React.createElement("div", { className: "nut-calendar-footer" }, /* @__PURE__ */ React.createElement("div", { className: "calendar-confirm-btn", onClick: confirm2 }, confirmText || locale.confirm)) : ""));
13329
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
13330
+ !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
13331
+ !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
13332
+ !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
13333
+ isStartTip(day, month) && /* @__PURE__ */ React.createElement(
13334
+ "div",
13335
+ {
13336
+ className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
13337
+ },
13338
+ startText || locale.calendaritem.start
13339
+ ),
13340
+ isEndTip(day, month) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
13341
+ ))));
13342
+ })
13343
+ ))
13344
+ );
13345
+ };
13346
+ const renderFooter = () => {
13347
+ return /* @__PURE__ */ React.createElement("div", { className: "nut-calendar-footer" }, /* @__PURE__ */ React.createElement("div", { className: "calendar-confirm-btn", onClick: confirm2 }, confirmText || locale.confirm));
13348
+ };
13349
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: classes }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : ""));
13261
13350
  });
13262
13351
  CalendarItem.defaultProps = defaultProps$_;
13263
13352
  CalendarItem.displayName = "NutCalendarItem";
@@ -13277,6 +13366,7 @@ Please add \`${key}Action\` when creating your handler.`);
13277
13366
  showTitle: true,
13278
13367
  showSubTitle: true,
13279
13368
  scrollAnimation: true,
13369
+ firstDayOfWeek: 0,
13280
13370
  renderHeaderButtons: void 0,
13281
13371
  renderDay: void 0,
13282
13372
  renderDayTop: void 0,
@@ -13285,7 +13375,7 @@ Please add \`${key}Action\` when creating your handler.`);
13285
13375
  },
13286
13376
  onConfirm: (param) => {
13287
13377
  },
13288
- onClickDay: (data) => {
13378
+ onDayClick: (data) => {
13289
13379
  },
13290
13380
  onPageChange: (param) => {
13291
13381
  }
@@ -13308,13 +13398,14 @@ Please add \`${key}Action\` when creating your handler.`);
13308
13398
  showTitle,
13309
13399
  showSubTitle,
13310
13400
  scrollAnimation,
13401
+ firstDayOfWeek,
13311
13402
  renderHeaderButtons,
13312
13403
  renderDay,
13313
13404
  renderDayTop,
13314
13405
  renderDayBottom,
13315
13406
  onClose,
13316
13407
  onConfirm,
13317
- onClickDay,
13408
+ onDayClick,
13318
13409
  onPageChange
13319
13410
  } = { ...defaultProps$Z, ...props };
13320
13411
  const calendarRef = React.useRef(null);
@@ -13329,7 +13420,7 @@ Please add \`${key}Action\` when creating your handler.`);
13329
13420
  close();
13330
13421
  };
13331
13422
  const select = (param) => {
13332
- onClickDay && onClickDay(param);
13423
+ onDayClick && onDayClick(param);
13333
13424
  };
13334
13425
  const scrollToDate = (date2) => {
13335
13426
  var _a2;
@@ -13360,12 +13451,13 @@ Please add \`${key}Action\` when creating your handler.`);
13360
13451
  showTitle,
13361
13452
  showSubTitle,
13362
13453
  scrollAnimation,
13454
+ firstDayOfWeek,
13363
13455
  renderHeaderButtons,
13364
13456
  renderDay,
13365
13457
  renderDayTop,
13366
13458
  renderDayBottom,
13367
13459
  onConfirm: choose,
13368
- onClickDay: select,
13460
+ onDayClick: select,
13369
13461
  onPageChange: yearMonthChange
13370
13462
  }
13371
13463
  );
@@ -13379,8 +13471,8 @@ Please add \`${key}Action\` when creating your handler.`);
13379
13471
  duration: 0.5,
13380
13472
  closeable: true,
13381
13473
  destroyOnClose: true,
13382
- onClickOverlay: closePopup,
13383
- onClickCloseIcon: closePopup,
13474
+ onOverlayClick: closePopup,
13475
+ onCloseIconClick: closePopup,
13384
13476
  style: { height: "85vh" }
13385
13477
  },
13386
13478
  renderItem()
@@ -16347,7 +16439,6 @@ Please add \`${key}Action\` when creating your handler.`);
16347
16439
  };
16348
16440
  const hideMenuItem = (index) => {
16349
16441
  showMenuItem[index] = false;
16350
- console.log([...showMenuItem]);
16351
16442
  setShowMenuItem([...showMenuItem]);
16352
16443
  };
16353
16444
  const updateTitle = (text, index) => {
@@ -16759,8 +16850,8 @@ Please add \`${key}Action\` when creating your handler.`);
16759
16850
  {
16760
16851
  visible,
16761
16852
  position: "bottom",
16762
- onClickOverlay: onClose,
16763
- onClickCloseIcon: onClose,
16853
+ onOverlayClick: onClose,
16854
+ onCloseIconClick: onClose,
16764
16855
  overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" },
16765
16856
  ...rest
16766
16857
  },
@@ -17438,7 +17529,7 @@ Please add \`${key}Action\` when creating your handler.`);
17438
17529
  onBlur,
17439
17530
  onClear,
17440
17531
  onSearch,
17441
- onClickInput
17532
+ onInputClick
17442
17533
  } = {
17443
17534
  ...defaultProps$J,
17444
17535
  ...props
@@ -17489,7 +17580,7 @@ Please add \`${key}Action\` when creating your handler.`);
17489
17580
  );
17490
17581
  };
17491
17582
  const clickInput = (e) => {
17492
- onClickInput && onClickInput(e);
17583
+ onInputClick && onInputClick(e);
17493
17584
  };
17494
17585
  const renderLeftIn = () => {
17495
17586
  if (!leftIn)
@@ -17593,8 +17684,8 @@ Please add \`${key}Action\` when creating your handler.`);
17593
17684
  onCancel,
17594
17685
  onClose,
17595
17686
  onComplete,
17596
- onClickOverlay,
17597
- onClickCloseIcon,
17687
+ onOverlayClick,
17688
+ onCloseIconClick,
17598
17689
  ...rest
17599
17690
  } = {
17600
17691
  ...defaultProps$I,
@@ -17633,8 +17724,8 @@ Please add \`${key}Action\` when creating your handler.`);
17633
17724
  },
17634
17725
  visible,
17635
17726
  closeable: true,
17636
- onClickOverlay: onClose,
17637
- onClickCloseIcon: onClose,
17727
+ onOverlayClick: onClose,
17728
+ onCloseIconClick: onClose,
17638
17729
  ...rest
17639
17730
  },
17640
17731
  /* @__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) => {
@@ -18144,7 +18235,7 @@ Please add \`${key}Action\` when creating your handler.`);
18144
18235
  url: "",
18145
18236
  maxCount: 1,
18146
18237
  previewType: "picture",
18147
- imageFit: "cover",
18238
+ fit: "cover",
18148
18239
  name: "file",
18149
18240
  accept: "*",
18150
18241
  disabled: false,
@@ -18189,7 +18280,7 @@ Please add \`${key}Action\` when creating your handler.`);
18189
18280
  defaultValue,
18190
18281
  value,
18191
18282
  previewType,
18192
- imageFit,
18283
+ fit,
18193
18284
  disabled,
18194
18285
  multiple,
18195
18286
  url,
@@ -18481,7 +18572,7 @@ Please add \`${key}Action\` when creating your handler.`);
18481
18572
  "img",
18482
18573
  {
18483
18574
  className: "nut-uploader__preview-img__c",
18484
- style: { objectFit: imageFit },
18575
+ style: { objectFit: fit },
18485
18576
  src: item.url,
18486
18577
  alt: "",
18487
18578
  onClick: () => handleItemClick(item)
@@ -18596,7 +18687,7 @@ Please add \`${key}Action\` when creating your handler.`);
18596
18687
  onCancel && onCancel();
18597
18688
  };
18598
18689
  const chooseItem = (item, index) => {
18599
- if (!item.disable) {
18690
+ if (!item.disabled) {
18600
18691
  onSelect && onSelect(item, index);
18601
18692
  }
18602
18693
  };
@@ -18616,7 +18707,7 @@ Please add \`${key}Action\` when creating your handler.`);
18616
18707
  return /* @__PURE__ */ React.createElement(
18617
18708
  "div",
18618
18709
  {
18619
- className: `${classPrefix2}__item ${item.disable ? "disabled" : ""} ${item.danger ? "danger" : ""}`,
18710
+ className: `${classPrefix2}__item ${item.disabled ? "disabled" : ""} ${item.danger ? "danger" : ""}`,
18620
18711
  key: index,
18621
18712
  onClick: () => chooseItem(item, index)
18622
18713
  },
@@ -19298,7 +19389,7 @@ Please add \`${key}Action\` when creating your handler.`);
19298
19389
  click,
19299
19390
  onClose,
19300
19391
  onClick,
19301
- onClickItem
19392
+ onItemClick
19302
19393
  } = {
19303
19394
  ...defaultProps$x,
19304
19395
  ...props
@@ -19529,7 +19620,7 @@ Please add \`${key}Action\` when creating your handler.`);
19529
19620
  });
19530
19621
  };
19531
19622
  const handleItemClick = (event, value) => {
19532
- onClickItem && onClickItem(event, value);
19623
+ onItemClick && onItemClick(event, value);
19533
19624
  };
19534
19625
  const getStyle = (moveOffset = offset) => {
19535
19626
  const target = innerRef.current;
@@ -19823,10 +19914,9 @@ Please add \`${key}Action\` when creating your handler.`);
19823
19914
  visible: false,
19824
19915
  offset: [0, 12],
19825
19916
  targetId: "",
19826
- className: "",
19827
19917
  showArrow: true,
19828
- closeOnClickOutside: true,
19829
- closeOnClickAction: true,
19918
+ closeOnOutsideClick: true,
19919
+ closeOnActionClick: true,
19830
19920
  overlay: false,
19831
19921
  onClick: () => {
19832
19922
  },
@@ -19845,8 +19935,8 @@ Please add \`${key}Action\` when creating your handler.`);
19845
19935
  offset,
19846
19936
  targetId,
19847
19937
  overlay,
19848
- closeOnClickOutside,
19849
- closeOnClickAction,
19938
+ closeOnOutsideClick,
19939
+ closeOnActionClick,
19850
19940
  className,
19851
19941
  showArrow,
19852
19942
  style,
@@ -19886,7 +19976,7 @@ Please add \`${key}Action\` when creating your handler.`);
19886
19976
  "touchstart",
19887
19977
  true,
19888
19978
  visible,
19889
- closeOnClickOutside
19979
+ closeOnOutsideClick
19890
19980
  );
19891
19981
  const getContentWidth = () => {
19892
19982
  let rect = getRect(popoverRef.current);
@@ -19980,7 +20070,7 @@ Please add \`${key}Action\` when creating your handler.`);
19980
20070
  if (!item.disabled) {
19981
20071
  onSelect && onSelect(item, index);
19982
20072
  }
19983
- if (closeOnClickAction) {
20073
+ if (closeOnActionClick) {
19984
20074
  props.onClick && props.onClick();
19985
20075
  onClose && onClose();
19986
20076
  }
@@ -22694,342 +22784,43 @@ Please add \`${key}Action\` when creating your handler.`);
22694
22784
  };
22695
22785
  ImagePreview.defaultProps = defaultProps$d;
22696
22786
  ImagePreview.displayName = "NutImagePreview";
22697
- const initPositinoCache = (reaItemSize, length = 0) => {
22698
- let index = 0;
22699
- const positions = Array(length);
22700
- while (index < length) {
22701
- positions[index] = {
22702
- index,
22703
- height: reaItemSize,
22704
- width: reaItemSize,
22705
- top: index * reaItemSize,
22706
- bottom: (index + 1) * reaItemSize,
22707
- left: index * reaItemSize,
22708
- right: (index + 1) * reaItemSize
22709
- };
22710
- index++;
22711
- }
22712
- return positions;
22713
- };
22714
- const getListTotalSize = (positions, horizontal) => {
22715
- const index = positions.length - 1;
22716
- let size = 0;
22717
- if (index < 0) {
22718
- size = 0;
22719
- } else {
22720
- size = horizontal ? positions[index].right : positions[index].bottom;
22721
- }
22722
- return size;
22723
- };
22724
- const binarySearch = (positionsList, value = 0, horizontal) => {
22725
- let start2 = 0;
22726
- let end = positionsList.length - 1;
22727
- let tempIndex = null;
22728
- const key = horizontal ? "right" : "bottom";
22729
- while (start2 <= end) {
22730
- const midIndex = Math.floor((start2 + end) / 2);
22731
- const midValue = positionsList[midIndex][key];
22732
- if (midValue === value) {
22733
- return midIndex + 1;
22734
- }
22735
- if (midValue < value) {
22736
- start2 = midIndex + 1;
22737
- } else if (midValue > value) {
22738
- if (tempIndex === null || tempIndex > midIndex) {
22739
- tempIndex = midIndex;
22740
- }
22741
- end = midIndex - 1;
22742
- }
22743
- }
22744
- tempIndex = tempIndex || 0;
22745
- return tempIndex;
22746
- };
22747
- const getEndIndex = ({
22748
- list,
22749
- startIndex,
22750
- visibleCount,
22751
- itemEqual = true,
22752
- positions,
22753
- offSetSize,
22754
- overscan,
22755
- sizeKey = "width"
22756
- }) => {
22757
- const dataLength = list.length;
22758
- let tempIndex = null;
22759
- if (itemEqual) {
22760
- const endIndex = startIndex + visibleCount;
22761
- tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
22762
- } else {
22763
- let sizeNum = 0;
22764
- for (let i = startIndex; i < dataLength; i++) {
22765
- sizeNum += positions[i][sizeKey] || 0;
22766
- if (sizeNum > offSetSize) {
22767
- const endIndex = i + overscan;
22768
- tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
22769
- break;
22770
- }
22771
- }
22772
- if (sizeNum < offSetSize) {
22773
- tempIndex = dataLength;
22774
- }
22775
- }
22776
- tempIndex = tempIndex || 0;
22777
- return tempIndex;
22778
- };
22779
- const updateItemSize = (positions, items, sizeKey) => {
22780
- const newPos = positions.concat();
22781
- Array.from(items).forEach((item) => {
22782
- const index = Number(item.getAttribute("data-index"));
22783
- const styleVal = item.getAttribute("style");
22784
- if (styleVal && styleVal.includes("none"))
22785
- return;
22786
- const nowSize = item.getBoundingClientRect()[sizeKey];
22787
- const oldSize = positions[index][sizeKey];
22788
- const dValue = oldSize - nowSize;
22789
- if (dValue) {
22790
- if (sizeKey === "width") {
22791
- newPos[index].right -= dValue;
22792
- newPos[index][sizeKey] = nowSize;
22793
- for (let k2 = index + 1; k2 < positions.length; k2++) {
22794
- newPos[k2].left = positions[k2 - 1].right;
22795
- newPos[k2].right -= dValue;
22796
- }
22797
- } else if (sizeKey === "height") {
22798
- newPos[index].bottom -= dValue;
22799
- newPos[index][sizeKey] = nowSize;
22800
- for (let k2 = index + 1; k2 < positions.length; k2++) {
22801
- newPos[k2].top = positions[k2 - 1].bottom;
22802
- newPos[k2].bottom -= dValue;
22803
- }
22804
- }
22805
- }
22806
- });
22807
- };
22808
22787
  const defaultProps$c = {
22809
22788
  ...ComponentDefaults,
22810
- list: [],
22811
- itemHeight: 66,
22812
- itemEqual: true,
22813
- direction: "vertical",
22814
- overscan: 2
22789
+ defaultValue: 1,
22790
+ mode: "multi",
22791
+ prev: null,
22792
+ next: null,
22793
+ total: 50,
22794
+ pageSize: 10,
22795
+ itemSize: 5,
22796
+ ellipse: false
22815
22797
  };
22816
- const VirtualList = (props) => {
22798
+ const Pagination = (props) => {
22799
+ const { locale } = useConfig();
22817
22800
  const {
22818
- list,
22819
- ItemRender,
22820
- itemEqual,
22821
- itemHeight,
22822
- direction,
22823
- overscan,
22824
- key,
22825
- onScroll,
22801
+ value,
22802
+ mode,
22803
+ prev,
22804
+ next,
22805
+ total,
22806
+ pageSize,
22807
+ itemSize,
22808
+ onChange,
22809
+ ellipse,
22810
+ itemRender,
22811
+ defaultValue,
22826
22812
  className,
22827
- containerHeight,
22828
22813
  ...rest
22829
22814
  } = {
22830
22815
  ...defaultProps$c,
22831
22816
  ...props
22832
22817
  };
22833
- const horizontal = direction === "horizontal";
22834
- const sizeKey = horizontal ? "width" : "height";
22835
- const scrollKey = horizontal ? "scrollLeft" : "scrollTop";
22836
- const offsetKey = horizontal ? "left" : "top";
22837
- const scrollRef = React.useRef(null);
22838
- const itemsRef = React.useRef(null);
22839
- const firstItemRef = React.useRef(null);
22840
- const [positions, setPositions] = React.useState([
22841
- {
22842
- index: 0,
22843
- left: 0,
22844
- top: 0,
22845
- bottom: 0,
22846
- width: 0,
22847
- height: 0,
22848
- right: 0
22849
- }
22850
- ]);
22851
- const [listTotalSize, setListTotalSize] = React.useState(99999999);
22852
- const [visibleCount, setVisibleCount] = React.useState(0);
22853
- const [offSetSize, setOffSetSize] = React.useState(containerHeight || 0);
22854
- const [options2, setOptions] = React.useState({
22855
- startOffset: 0,
22856
- // 可视区域距离顶部的偏移量
22857
- startIndex: 0,
22858
- // 可视区域开始索引
22859
- overStart: 0,
22860
- endIndex: 10
22861
- // 可视区域结束索引
22862
- });
22863
- React.useEffect(() => {
22864
- const pos = initPositinoCache(itemHeight, list.length);
22865
- setPositions(pos);
22866
- const totalSize = getListTotalSize(pos, horizontal);
22867
- setListTotalSize(totalSize);
22868
- }, [list, itemHeight, horizontal]);
22869
- const getElement = React.useCallback(() => {
22870
- var _a2;
22871
- return ((_a2 = scrollRef.current) == null ? void 0 : _a2.parentElement) || document.body;
22872
- }, []);
22873
- React.useEffect(() => {
22874
- if (containerHeight)
22875
- return;
22876
- const size = horizontal ? getElement().offsetWidth : getElement().offsetHeight;
22877
- setOffSetSize(size);
22878
- }, [getElement, horizontal, containerHeight]);
22879
- React.useEffect(() => {
22880
- if (offSetSize === 0)
22881
- return;
22882
- const count = Math.ceil(offSetSize / itemHeight) + overscan;
22883
- setVisibleCount(count);
22884
- setOptions((options22) => {
22885
- return { ...options22, endIndex: count };
22886
- });
22887
- }, [getElement, horizontal, itemHeight, overscan, offSetSize]);
22888
- const updateTotalSize = React.useCallback(() => {
22889
- if (!itemsRef.current)
22890
- return;
22891
- const items = itemsRef.current.children;
22892
- if (!items.length)
22893
- return;
22894
- updateItemSize(positions, items, sizeKey);
22895
- const totalSize = getListTotalSize(positions, horizontal);
22896
- setListTotalSize(totalSize);
22897
- }, [positions, sizeKey, horizontal]);
22898
- const scroll = React.useCallback(() => {
22899
- requestAnimationFrame((e) => {
22900
- const scrollSize = getElement()[scrollKey];
22901
- const startIndex = binarySearch(positions, scrollSize, horizontal);
22902
- const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
22903
- if (!itemEqual) {
22904
- updateTotalSize();
22905
- }
22906
- const endIndex = getEndIndex({
22907
- list,
22908
- startIndex,
22909
- visibleCount,
22910
- itemEqual,
22911
- positions,
22912
- offSetSize,
22913
- sizeKey,
22914
- overscan
22915
- });
22916
- const startOffset = positions[startIndex][offsetKey];
22917
- setOptions({ startOffset, startIndex, overStart, endIndex });
22918
- if (endIndex > list.length - 1) {
22919
- if (onScroll) {
22920
- onScroll();
22921
- }
22922
- }
22923
- });
22924
- }, [
22925
- positions,
22926
- getElement,
22927
- list,
22928
- visibleCount,
22929
- itemEqual,
22930
- updateTotalSize,
22931
- offsetKey,
22932
- sizeKey,
22933
- scrollKey,
22934
- horizontal,
22935
- overscan,
22936
- offSetSize
22937
- ]);
22938
- React.useEffect(() => {
22939
- const element = getElement();
22940
- element.addEventListener("scroll", scroll, false);
22941
- return () => {
22942
- element.removeEventListener("scroll", scroll, false);
22943
- };
22944
- }, [getElement, scroll]);
22945
- return /* @__PURE__ */ React.createElement(
22946
- "div",
22947
- {
22948
- className: className ? `${className} nut-virtualList-box` : "nut-virtualList-box",
22949
- ...rest,
22950
- style: {
22951
- [sizeKey]: containerHeight ? `${offSetSize}px` : ""
22952
- }
22953
- },
22954
- /* @__PURE__ */ React.createElement(
22955
- "div",
22956
- {
22957
- ref: scrollRef,
22958
- className: horizontal ? "nut-horizontal-box" : "nut-vertical-box",
22959
- style: {
22960
- position: "relative",
22961
- [sizeKey]: `${listTotalSize}px`
22962
- }
22963
- },
22964
- /* @__PURE__ */ React.createElement(
22965
- "ul",
22966
- {
22967
- className: horizontal ? "nut-virtuallist-items nut-horizontal-items" : "nut-virtuallist-items nut-vertical-items",
22968
- ref: itemsRef,
22969
- style: {
22970
- transform: horizontal ? `translate3d(${options2.startOffset}px,0,0)` : `translate3d(0,${options2.startOffset}px,0)`
22971
- }
22972
- },
22973
- list.slice(options2.overStart, options2.endIndex).map((data, index) => {
22974
- const { startIndex, overStart } = options2;
22975
- const dataIndex = overStart + index;
22976
- const styleVal = dataIndex < startIndex ? "none" : "block";
22977
- const keyVal = key && data[key] ? data[key] : dataIndex;
22978
- return /* @__PURE__ */ React.createElement(
22979
- "li",
22980
- {
22981
- ref: dataIndex === 0 ? firstItemRef : null,
22982
- "data-index": `${dataIndex}`,
22983
- className: dataIndex % 2 === 0 ? "nut-virtuallist-item even" : "nut-virtuallist-item odd",
22984
- key: `${keyVal}`,
22985
- style: { display: styleVal }
22986
- },
22987
- ItemRender ? /* @__PURE__ */ React.createElement(ItemRender, { data, index: `${dataIndex}` }) : data
22988
- );
22989
- })
22990
- )
22991
- )
22992
- );
22993
- };
22994
- VirtualList.defaultProps = defaultProps$c;
22995
- VirtualList.displayName = "NutVirtualList";
22996
- const defaultProps$b = {
22997
- ...ComponentDefaults,
22998
- defaultValue: 1,
22999
- mode: "multi",
23000
- prev: null,
23001
- next: null,
23002
- total: 50,
23003
- pageSize: 10,
23004
- itemSize: 5,
23005
- ellipse: false
23006
- };
23007
- const Pagination = (props) => {
23008
- const { locale } = useConfig();
23009
- const {
23010
- value,
23011
- mode,
23012
- prev,
23013
- next,
23014
- total,
23015
- pageSize,
23016
- itemSize,
23017
- onChange,
23018
- ellipse,
23019
- itemRender,
23020
- defaultValue,
23021
- className,
23022
- ...rest
23023
- } = {
23024
- ...defaultProps$b,
23025
- ...props
23026
- };
23027
- const classPrefix2 = "nut-pagination";
23028
- const [currentPage, setCurrentPage] = usePropsValue({
23029
- value,
23030
- defaultValue,
23031
- finalValue: 1,
23032
- onChange
22818
+ const classPrefix2 = "nut-pagination";
22819
+ const [currentPage, setCurrentPage] = usePropsValue({
22820
+ value,
22821
+ defaultValue,
22822
+ finalValue: 1,
22823
+ onChange
23033
22824
  });
23034
22825
  const pageCount = React.useMemo(() => {
23035
22826
  const num = Math.ceil(total / pageSize);
@@ -23103,9 +22894,9 @@ Please add \`${key}Action\` when creating your handler.`);
23103
22894
  next || locale.pagination.next
23104
22895
  ));
23105
22896
  };
23106
- Pagination.defaultProps = defaultProps$b;
22897
+ Pagination.defaultProps = defaultProps$c;
23107
22898
  Pagination.displayName = "NutPagination";
23108
- const defaultProps$a = {
22899
+ const defaultProps$b = {
23109
22900
  ...ComponentDefaults,
23110
22901
  price: 0,
23111
22902
  symbol: "&yen;",
@@ -23128,7 +22919,7 @@ Please add \`${key}Action\` when creating your handler.`);
23128
22919
  style,
23129
22920
  ...rest
23130
22921
  } = {
23131
- ...defaultProps$a,
22922
+ ...defaultProps$b,
23132
22923
  ...props
23133
22924
  };
23134
22925
  const classPrefix2 = "nut-price";
@@ -23208,10 +22999,10 @@ Please add \`${key}Action\` when creating your handler.`);
23208
22999
  symbol && position === "after" ? renderSymbol() : null
23209
23000
  );
23210
23001
  };
23211
- Price.defaultProps = defaultProps$a;
23002
+ Price.defaultProps = defaultProps$b;
23212
23003
  Price.displayName = "NutPrice";
23213
23004
  const DataContext = React.createContext({});
23214
- const defaultProps$9 = {
23005
+ const defaultProps$a = {
23215
23006
  ...ComponentDefaults,
23216
23007
  title: "",
23217
23008
  description: "",
@@ -23220,7 +23011,7 @@ Please add \`${key}Action\` when creating your handler.`);
23220
23011
  };
23221
23012
  const Step = (props) => {
23222
23013
  const { children, title, description, value, icon, className, ...restProps } = {
23223
- ...defaultProps$9,
23014
+ ...defaultProps$a,
23224
23015
  ...props
23225
23016
  };
23226
23017
  const parent = React.useContext(DataContext);
@@ -23254,16 +23045,16 @@ Please add \`${key}Action\` when creating your handler.`);
23254
23045
  };
23255
23046
  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)));
23256
23047
  };
23257
- Step.defaultProps = defaultProps$9;
23048
+ Step.defaultProps = defaultProps$a;
23258
23049
  Step.displayName = "NutStep";
23259
- const defaultProps$8 = {
23050
+ const defaultProps$9 = {
23260
23051
  ...ComponentDefaults,
23261
23052
  value: 0,
23262
23053
  direction: "horizontal",
23263
23054
  dot: false
23264
23055
  };
23265
23056
  const Steps = (props) => {
23266
- const propSteps = { ...defaultProps$8, ...props };
23057
+ const propSteps = { ...defaultProps$9, ...props };
23267
23058
  const {
23268
23059
  children,
23269
23060
  value,
@@ -23294,9 +23085,9 @@ Please add \`${key}Action\` when creating your handler.`);
23294
23085
  children
23295
23086
  ));
23296
23087
  };
23297
- Steps.defaultProps = defaultProps$8;
23088
+ Steps.defaultProps = defaultProps$9;
23298
23089
  Steps.displayName = "NutSteps";
23299
- const defaultProps$7 = {
23090
+ const defaultProps$8 = {
23300
23091
  ...ComponentDefaults,
23301
23092
  columns: [],
23302
23093
  data: [],
@@ -23308,7 +23099,7 @@ Please add \`${key}Action\` when creating your handler.`);
23308
23099
  };
23309
23100
  const Table = (props) => {
23310
23101
  const { locale } = useConfig();
23311
- defaultProps$7.noData = locale.noData;
23102
+ defaultProps$8.noData = locale.noData;
23312
23103
  const {
23313
23104
  children,
23314
23105
  className,
@@ -23324,7 +23115,7 @@ Please add \`${key}Action\` when creating your handler.`);
23324
23115
  onSort,
23325
23116
  ...rest
23326
23117
  } = {
23327
- ...defaultProps$7,
23118
+ ...defaultProps$8,
23328
23119
  ...props
23329
23120
  };
23330
23121
  const [curData, setCurData] = React.useState(data);
@@ -23407,9 +23198,9 @@ Please add \`${key}Action\` when creating your handler.`);
23407
23198
  /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__main__body` }, renderBoyTrs())
23408
23199
  ), (summary || curData.length === 0) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__summary` }, summary || noData));
23409
23200
  };
23410
- Table.defaultProps = defaultProps$7;
23201
+ Table.defaultProps = defaultProps$8;
23411
23202
  Table.displayName = "NutTable";
23412
- const defaultProps$6 = {
23203
+ const defaultProps$7 = {
23413
23204
  ...ComponentDefaults,
23414
23205
  type: "default",
23415
23206
  background: "",
@@ -23440,7 +23231,7 @@ Please add \`${key}Action\` when creating your handler.`);
23440
23231
  onClick,
23441
23232
  onClose
23442
23233
  } = {
23443
- ...defaultProps$6,
23234
+ ...defaultProps$7,
23444
23235
  ...props
23445
23236
  };
23446
23237
  const [tagClass, setTagClass] = React.useState("");
@@ -23516,8 +23307,305 @@ Please add \`${key}Action\` when creating your handler.`);
23516
23307
  children && /* @__PURE__ */ React.createElement("span", { className: `${classPrefix2}-text` }, children)
23517
23308
  ));
23518
23309
  };
23519
- Tag.defaultProps = defaultProps$6;
23310
+ Tag.defaultProps = defaultProps$7;
23520
23311
  Tag.displayName = "NutTag";
23312
+ const initPositinoCache = (reaItemSize, length = 0) => {
23313
+ let index = 0;
23314
+ const positions = Array(length);
23315
+ while (index < length) {
23316
+ positions[index] = {
23317
+ index,
23318
+ height: reaItemSize,
23319
+ width: reaItemSize,
23320
+ top: index * reaItemSize,
23321
+ bottom: (index + 1) * reaItemSize,
23322
+ left: index * reaItemSize,
23323
+ right: (index + 1) * reaItemSize
23324
+ };
23325
+ index++;
23326
+ }
23327
+ return positions;
23328
+ };
23329
+ const getListTotalSize = (positions, horizontal) => {
23330
+ const index = positions.length - 1;
23331
+ let size = 0;
23332
+ if (index < 0) {
23333
+ size = 0;
23334
+ } else {
23335
+ size = horizontal ? positions[index].right : positions[index].bottom;
23336
+ }
23337
+ return size;
23338
+ };
23339
+ const binarySearch = (positionsList, value = 0, horizontal) => {
23340
+ let start2 = 0;
23341
+ let end = positionsList.length - 1;
23342
+ let tempIndex = null;
23343
+ const key = horizontal ? "right" : "bottom";
23344
+ while (start2 <= end) {
23345
+ const midIndex = Math.floor((start2 + end) / 2);
23346
+ const midValue = positionsList[midIndex][key];
23347
+ if (midValue === value) {
23348
+ return midIndex + 1;
23349
+ }
23350
+ if (midValue < value) {
23351
+ start2 = midIndex + 1;
23352
+ } else if (midValue > value) {
23353
+ if (tempIndex === null || tempIndex > midIndex) {
23354
+ tempIndex = midIndex;
23355
+ }
23356
+ end = midIndex - 1;
23357
+ }
23358
+ }
23359
+ tempIndex = tempIndex || 0;
23360
+ return tempIndex;
23361
+ };
23362
+ const getEndIndex = ({
23363
+ list,
23364
+ startIndex,
23365
+ visibleCount,
23366
+ itemEqual = true,
23367
+ positions,
23368
+ offSetSize,
23369
+ overscan,
23370
+ sizeKey = "width"
23371
+ }) => {
23372
+ const dataLength = list.length;
23373
+ let tempIndex = null;
23374
+ if (itemEqual) {
23375
+ const endIndex = startIndex + visibleCount;
23376
+ tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
23377
+ } else {
23378
+ let sizeNum = 0;
23379
+ for (let i = startIndex; i < dataLength; i++) {
23380
+ sizeNum += positions[i][sizeKey] || 0;
23381
+ if (sizeNum > offSetSize) {
23382
+ const endIndex = i + overscan;
23383
+ tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
23384
+ break;
23385
+ }
23386
+ }
23387
+ if (sizeNum < offSetSize) {
23388
+ tempIndex = dataLength;
23389
+ }
23390
+ }
23391
+ tempIndex = tempIndex || 0;
23392
+ return tempIndex;
23393
+ };
23394
+ const updateItemSize = (positions, items, sizeKey) => {
23395
+ const newPos = positions.concat();
23396
+ Array.from(items).forEach((item) => {
23397
+ const index = Number(item.getAttribute("data-index"));
23398
+ const styleVal = item.getAttribute("style");
23399
+ if (styleVal && styleVal.includes("none"))
23400
+ return;
23401
+ const nowSize = item.getBoundingClientRect()[sizeKey];
23402
+ const oldSize = positions[index][sizeKey];
23403
+ const dValue = oldSize - nowSize;
23404
+ if (dValue) {
23405
+ if (sizeKey === "width") {
23406
+ newPos[index].right -= dValue;
23407
+ newPos[index][sizeKey] = nowSize;
23408
+ for (let k2 = index + 1; k2 < positions.length; k2++) {
23409
+ newPos[k2].left = positions[k2 - 1].right;
23410
+ newPos[k2].right -= dValue;
23411
+ }
23412
+ } else if (sizeKey === "height") {
23413
+ newPos[index].bottom -= dValue;
23414
+ newPos[index][sizeKey] = nowSize;
23415
+ for (let k2 = index + 1; k2 < positions.length; k2++) {
23416
+ newPos[k2].top = positions[k2 - 1].bottom;
23417
+ newPos[k2].bottom -= dValue;
23418
+ }
23419
+ }
23420
+ }
23421
+ });
23422
+ };
23423
+ const defaultProps$6 = {
23424
+ ...ComponentDefaults,
23425
+ list: [],
23426
+ itemHeight: 66,
23427
+ itemEqual: true,
23428
+ direction: "vertical",
23429
+ overscan: 2
23430
+ };
23431
+ const VirtualList = (props) => {
23432
+ const {
23433
+ list,
23434
+ itemRender,
23435
+ itemEqual,
23436
+ itemHeight,
23437
+ direction,
23438
+ overscan,
23439
+ key,
23440
+ onScroll,
23441
+ className,
23442
+ containerHeight,
23443
+ ...rest
23444
+ } = {
23445
+ ...defaultProps$6,
23446
+ ...props
23447
+ };
23448
+ const horizontal = direction === "horizontal";
23449
+ const sizeKey = horizontal ? "width" : "height";
23450
+ const scrollKey = horizontal ? "scrollLeft" : "scrollTop";
23451
+ const offsetKey = horizontal ? "left" : "top";
23452
+ const scrollRef = React.useRef(null);
23453
+ const itemsRef = React.useRef(null);
23454
+ const [positions, setPositions] = React.useState([
23455
+ {
23456
+ index: 0,
23457
+ left: 0,
23458
+ top: 0,
23459
+ bottom: 0,
23460
+ width: 0,
23461
+ height: 0,
23462
+ right: 0
23463
+ }
23464
+ ]);
23465
+ const [listTotalSize, setListTotalSize] = React.useState(99999999);
23466
+ const [visibleCount, setVisibleCount] = React.useState(0);
23467
+ const [offSetSize, setOffSetSize] = React.useState(containerHeight || 0);
23468
+ const [options2, setOptions] = React.useState({
23469
+ startOffset: 0,
23470
+ // 可视区域距离顶部的偏移量
23471
+ startIndex: 0,
23472
+ // 可视区域开始索引
23473
+ overStart: 0,
23474
+ endIndex: 10
23475
+ // 可视区域结束索引
23476
+ });
23477
+ React.useEffect(() => {
23478
+ const pos = initPositinoCache(itemHeight, list.length);
23479
+ setPositions(pos);
23480
+ const totalSize = getListTotalSize(pos, horizontal);
23481
+ setListTotalSize(totalSize);
23482
+ }, [list, itemHeight, horizontal]);
23483
+ const getElement = React.useCallback(() => {
23484
+ var _a2;
23485
+ return ((_a2 = scrollRef.current) == null ? void 0 : _a2.parentElement) || document.body;
23486
+ }, []);
23487
+ React.useEffect(() => {
23488
+ if (containerHeight)
23489
+ return;
23490
+ const size = horizontal ? getElement().offsetWidth : getElement().offsetHeight;
23491
+ setOffSetSize(size);
23492
+ }, [getElement, horizontal, containerHeight]);
23493
+ React.useEffect(() => {
23494
+ if (offSetSize === 0)
23495
+ return;
23496
+ const count = Math.ceil(offSetSize / itemHeight) + overscan;
23497
+ setVisibleCount(count);
23498
+ setOptions((options22) => {
23499
+ return { ...options22, endIndex: count };
23500
+ });
23501
+ }, [getElement, horizontal, itemHeight, overscan, offSetSize]);
23502
+ const updateTotalSize = React.useCallback(() => {
23503
+ if (!itemsRef.current)
23504
+ return;
23505
+ const items = itemsRef.current.children;
23506
+ if (!items.length)
23507
+ return;
23508
+ updateItemSize(positions, items, sizeKey);
23509
+ const totalSize = getListTotalSize(positions, horizontal);
23510
+ setListTotalSize(totalSize);
23511
+ }, [positions, sizeKey, horizontal]);
23512
+ const scroll = React.useCallback(() => {
23513
+ requestAnimationFrame((e) => {
23514
+ const scrollSize = getElement()[scrollKey];
23515
+ const startIndex = binarySearch(positions, scrollSize, horizontal);
23516
+ const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
23517
+ if (!itemEqual) {
23518
+ updateTotalSize();
23519
+ }
23520
+ const endIndex = getEndIndex({
23521
+ list,
23522
+ startIndex,
23523
+ visibleCount,
23524
+ itemEqual,
23525
+ positions,
23526
+ offSetSize,
23527
+ sizeKey,
23528
+ overscan
23529
+ });
23530
+ const startOffset = positions[startIndex][offsetKey];
23531
+ setOptions({ startOffset, startIndex, overStart, endIndex });
23532
+ if (endIndex > list.length - 1) {
23533
+ if (onScroll) {
23534
+ onScroll();
23535
+ }
23536
+ }
23537
+ });
23538
+ }, [
23539
+ positions,
23540
+ getElement,
23541
+ list,
23542
+ visibleCount,
23543
+ itemEqual,
23544
+ updateTotalSize,
23545
+ offsetKey,
23546
+ sizeKey,
23547
+ scrollKey,
23548
+ horizontal,
23549
+ overscan,
23550
+ offSetSize
23551
+ ]);
23552
+ React.useEffect(() => {
23553
+ const element = getElement();
23554
+ element.addEventListener("scroll", scroll, false);
23555
+ return () => {
23556
+ element.removeEventListener("scroll", scroll, false);
23557
+ };
23558
+ }, [getElement, scroll]);
23559
+ return /* @__PURE__ */ React.createElement(
23560
+ "div",
23561
+ {
23562
+ className: className ? `${className} nut-virtualList-box` : "nut-virtualList-box",
23563
+ ...rest,
23564
+ style: {
23565
+ [sizeKey]: containerHeight ? `${offSetSize}px` : ""
23566
+ }
23567
+ },
23568
+ /* @__PURE__ */ React.createElement(
23569
+ "div",
23570
+ {
23571
+ ref: scrollRef,
23572
+ className: horizontal ? "nut-horizontal-box" : "nut-vertical-box",
23573
+ style: {
23574
+ position: "relative",
23575
+ [sizeKey]: `${listTotalSize}px`
23576
+ }
23577
+ },
23578
+ /* @__PURE__ */ React.createElement(
23579
+ "ul",
23580
+ {
23581
+ className: horizontal ? "nut-virtuallist-items nut-horizontal-items" : "nut-virtuallist-items nut-vertical-items",
23582
+ ref: itemsRef,
23583
+ style: {
23584
+ transform: horizontal ? `translate3d(${options2.startOffset}px,0,0)` : `translate3d(0,${options2.startOffset}px,0)`
23585
+ }
23586
+ },
23587
+ list.slice(options2.overStart, options2.endIndex).map((data, index) => {
23588
+ const { startIndex, overStart } = options2;
23589
+ const dataIndex = overStart + index;
23590
+ const styleVal = dataIndex < startIndex ? "none" : "block";
23591
+ const keyVal = key && data[key] ? data[key] : dataIndex;
23592
+ return /* @__PURE__ */ React.createElement(
23593
+ "li",
23594
+ {
23595
+ "data-index": `${dataIndex}`,
23596
+ className: dataIndex % 2 === 0 ? "nut-virtuallist-item even" : "nut-virtuallist-item odd",
23597
+ key: `${keyVal}`,
23598
+ style: { display: styleVal }
23599
+ },
23600
+ itemRender ? itemRender(data, dataIndex, index) : data
23601
+ );
23602
+ })
23603
+ )
23604
+ )
23605
+ );
23606
+ };
23607
+ VirtualList.defaultProps = defaultProps$6;
23608
+ VirtualList.displayName = "NutVirtualList";
23521
23609
  const defaultProps$5 = {
23522
23610
  ...ComponentDefaults,
23523
23611
  list: [],
@@ -23851,13 +23939,13 @@ Please add \`${key}Action\` when creating your handler.`);
23851
23939
  digits: 2,
23852
23940
  symbol: false,
23853
23941
  zero: false,
23854
- arrowLeft: false,
23855
- syncColor: true,
23942
+ left: false,
23943
+ sync: true,
23856
23944
  color: "#333",
23857
23945
  riseColor: "#fa2c19",
23858
23946
  dropColor: "#64b578",
23859
23947
  riseIcon: null,
23860
- downIcon: null
23948
+ dropIcon: null
23861
23949
  };
23862
23950
  const TrendArrow = (props) => {
23863
23951
  const {
@@ -23865,13 +23953,13 @@ Please add \`${key}Action\` when creating your handler.`);
23865
23953
  digits,
23866
23954
  symbol,
23867
23955
  zero,
23868
- arrowLeft,
23869
- syncColor,
23956
+ left,
23957
+ sync: sync2,
23870
23958
  color,
23871
23959
  riseColor,
23872
23960
  dropColor,
23873
23961
  riseIcon,
23874
- downIcon,
23962
+ dropIcon,
23875
23963
  className,
23876
23964
  style,
23877
23965
  children,
@@ -23889,7 +23977,7 @@ Please add \`${key}Action\` when creating your handler.`);
23889
23977
  };
23890
23978
  const calcStyle = (() => {
23891
23979
  const arrowColor = rateTrend.current ? riseColor : dropColor;
23892
- const textEquArrowColor = syncColor ? arrowColor : color;
23980
+ const textEquArrowColor = sync2 ? arrowColor : color;
23893
23981
  const style2 = {
23894
23982
  color: value === 0 ? color : textEquArrowColor
23895
23983
  };
@@ -23911,8 +23999,8 @@ Please add \`${key}Action\` when creating your handler.`);
23911
23999
  };
23912
24000
  return iconProps;
23913
24001
  })();
23914
- const renderContent = (arrowLeft2) => {
23915
- const classNameSuffix = !arrowLeft2 ? "icon-after" : "icon-before";
24002
+ const renderContent = (left2) => {
24003
+ const classNameSuffix = !left2 ? "icon-after" : "icon-before";
23916
24004
  return /* @__PURE__ */ React.createElement(
23917
24005
  "span",
23918
24006
  {
@@ -23922,7 +24010,7 @@ Please add \`${key}Action\` when creating your handler.`);
23922
24010
  calcRate
23923
24011
  );
23924
24012
  };
23925
- 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(y, { color: calcIconProps.color })) : /* @__PURE__ */ React.createElement(React.Fragment, null, downIcon || /* @__PURE__ */ React.createElement(y$1, { color: calcIconProps.color }))), arrowLeft && renderContent(!arrowLeft));
24013
+ 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(y, { color: calcIconProps.color })) : /* @__PURE__ */ React.createElement(React.Fragment, null, dropIcon || /* @__PURE__ */ React.createElement(y$1, { color: calcIconProps.color }))), left && renderContent(!left));
23926
24014
  };
23927
24015
  TrendArrow.defaultProps = defaultProps$1;
23928
24016
  TrendArrow.displayName = "NutTrendArrow";