@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
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  var _a;
8
8
  /*!
9
- * @nutui/nutui-react v2.0.0-beta.1 Wed Jun 21 2023 15:03:52 GMT+0800 (China Standard Time)
9
+ * @nutui/nutui-react v2.0.0-beta.2 Wed Jun 28 2023 16:06:00 GMT+0800 (China Standard Time)
10
10
  * (c) 2023 @jdf2e.
11
11
  * Released under the MIT License.
12
12
  */
@@ -8997,8 +8997,8 @@ const Elevator = (props) => {
8997
8997
  showKeys,
8998
8998
  className,
8999
8999
  style,
9000
- onClickItem,
9001
- onClickIndex,
9000
+ onItemClick,
9001
+ onIndexClick,
9002
9002
  children,
9003
9003
  ...rest
9004
9004
  } = {
@@ -9080,12 +9080,12 @@ const Elevator = (props) => {
9080
9080
  }
9081
9081
  });
9082
9082
  const handleClickItem = (key, item) => {
9083
- onClickItem && onClickItem(key, item);
9083
+ onItemClick && onItemClick(key, item);
9084
9084
  setCurrentData(item);
9085
9085
  setCurrentKey(key);
9086
9086
  };
9087
9087
  const handleClickIndex = (key) => {
9088
- onClickIndex && onClickIndex(key);
9088
+ onIndexClick && onIndexClick(key);
9089
9089
  };
9090
9090
  const setListGroup = () => {
9091
9091
  if (listview.current) {
@@ -9283,7 +9283,7 @@ const NavBar = (props) => {
9283
9283
  safeAreaInsetTop,
9284
9284
  placeholder,
9285
9285
  zIndex,
9286
- onClickBack
9286
+ onBackClick
9287
9287
  } = {
9288
9288
  ...defaultProps$1b,
9289
9289
  ...props
@@ -9301,7 +9301,7 @@ const NavBar = (props) => {
9301
9301
  "div",
9302
9302
  {
9303
9303
  className: `${classPrefix2}__left__back`,
9304
- onClick: (e) => onClickBack(e)
9304
+ onClick: (e) => onBackClick(e)
9305
9305
  },
9306
9306
  back
9307
9307
  ), left);
@@ -11082,8 +11082,8 @@ const defaultProps$1a = {
11082
11082
  },
11083
11083
  onClose: () => {
11084
11084
  },
11085
- onClickOverlay: (e) => true,
11086
- onClickCloseIcon: (e) => true,
11085
+ onOverlayClick: (e) => true,
11086
+ onCloseIconClick: (e) => true,
11087
11087
  ...defaultOverlayProps
11088
11088
  };
11089
11089
  let _zIndex = 1e3;
@@ -11112,8 +11112,8 @@ const Popup = (props) => {
11112
11112
  portal,
11113
11113
  onOpen,
11114
11114
  onClose,
11115
- onClickOverlay,
11116
- onClickCloseIcon,
11115
+ onOverlayClick,
11116
+ onCloseIconClick,
11117
11117
  afterShow,
11118
11118
  afterClose,
11119
11119
  onClick
@@ -11169,7 +11169,7 @@ const Popup = (props) => {
11169
11169
  const onHandleClickOverlay = (e) => {
11170
11170
  e.stopPropagation();
11171
11171
  if (closeOnOverlayClick) {
11172
- const closed = onClickOverlay && onClickOverlay(e);
11172
+ const closed = onOverlayClick && onOverlayClick(e);
11173
11173
  closed && close();
11174
11174
  }
11175
11175
  };
@@ -11177,7 +11177,7 @@ const Popup = (props) => {
11177
11177
  onClick && onClick(e);
11178
11178
  };
11179
11179
  const onHandleClickCloseIcon = (e) => {
11180
- const closed = onClickCloseIcon && onClickCloseIcon(e);
11180
+ const closed = onCloseIconClick && onCloseIconClick(e);
11181
11181
  closed && close();
11182
11182
  };
11183
11183
  const onHandleOpened = (e) => {
@@ -12272,8 +12272,8 @@ const InternalCascader = (props, ref) => {
12272
12272
  closeIconPosition,
12273
12273
  title: popup && props.title,
12274
12274
  left: props.left,
12275
- onClickOverlay: closePopup,
12276
- onClickCloseIcon: closePopup
12275
+ onOverlayClick: closePopup,
12276
+ onCloseIconClick: closePopup
12277
12277
  },
12278
12278
  renderTabs()
12279
12279
  ) : renderTabs());
@@ -12525,7 +12525,7 @@ const Utils = {
12525
12525
  return dayNames[index];
12526
12526
  },
12527
12527
  /**
12528
- * 返回星期数
12528
+ * 返回上一个月在当前面板中的天数
12529
12529
  * @return {Number}
12530
12530
  */
12531
12531
  getMonthPreDay(year, month) {
@@ -12614,9 +12614,140 @@ const Utils = {
12614
12614
  return true;
12615
12615
  }
12616
12616
  return false;
12617
+ },
12618
+ getMonthWeek(year, month, date4, firstDayOfWeek = 0) {
12619
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
12620
+ let w = dateNow.getDay();
12621
+ const d = dateNow.getDate();
12622
+ let remainder = 6 - w;
12623
+ if (firstDayOfWeek !== 0) {
12624
+ w = w === 0 ? 7 : w;
12625
+ remainder = 7 - w;
12626
+ }
12627
+ return Math.ceil((d + remainder) / 7);
12628
+ },
12629
+ getYearWeek(year, month, date4, firstDayOfWeek = 0) {
12630
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
12631
+ const dateFirst = new Date(Number(year), 0, 1);
12632
+ const dataNumber = Math.round(
12633
+ (dateNow.valueOf() - dateFirst.valueOf()) / 864e5
12634
+ );
12635
+ return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
12636
+ },
12637
+ getWeekDate(year, month, date4, firstDayOfWeek = 0) {
12638
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date4));
12639
+ const nowTime = dateNow.getTime();
12640
+ let day = dateNow.getDay();
12641
+ if (firstDayOfWeek === 0) {
12642
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
12643
+ const SundayTime2 = nowTime - day * oneDayTime2;
12644
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
12645
+ const sunday2 = this.date2Str(new Date(SundayTime2));
12646
+ const saturday = this.date2Str(new Date(SaturdayTime));
12647
+ return [sunday2, saturday];
12648
+ }
12649
+ day = day === 0 ? 7 : day;
12650
+ const oneDayTime = 24 * 60 * 60 * 1e3;
12651
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
12652
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
12653
+ const monday = this.date2Str(new Date(MondayTime));
12654
+ const sunday = this.date2Str(new Date(SundayTime));
12655
+ return [monday, sunday];
12656
+ },
12657
+ formatResultDate(date4) {
12658
+ const days = [...date4.split("-")];
12659
+ days[2] = Utils.getNumTwoBit(Number(days[2]));
12660
+ days[3] = `${days[0]}-${days[1]}-${days[2]}`;
12661
+ days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
12662
+ return days;
12663
+ }
12664
+ };
12665
+ const getCurrMonthData = (type4, year, month) => {
12666
+ switch (type4) {
12667
+ case "prev":
12668
+ month === 1 && (year -= 1);
12669
+ month = month === 1 ? 12 : --month;
12670
+ break;
12671
+ case "next":
12672
+ month === 12 && (year += 1);
12673
+ month = month === 12 ? 1 : ++month;
12674
+ break;
12675
+ }
12676
+ return [
12677
+ year,
12678
+ Utils.getNumTwoBit(month),
12679
+ Utils.getMonthDays(String(year), String(month))
12680
+ ];
12681
+ };
12682
+ const getDaysStatus = (type4, year, month) => {
12683
+ let days = Utils.getMonthDays(`${year}`, `${month}`);
12684
+ if (type4 === "prev" && days >= 7) {
12685
+ days -= 7;
12686
+ }
12687
+ return Array.from(Array(days), (v, k2) => {
12688
+ return {
12689
+ day: k2 + 1,
12690
+ type: type4,
12691
+ year,
12692
+ month
12693
+ };
12694
+ });
12695
+ };
12696
+ const getPreMonthDates = (type4, year, month, firstDayOfWeek) => {
12697
+ let preMonth = +month - 1;
12698
+ let preYear = year;
12699
+ if (preMonth <= 0) {
12700
+ preMonth = 12;
12701
+ preYear += 1;
12702
+ }
12703
+ let days = Utils.getMonthPreDay(+year, +month);
12704
+ days -= firstDayOfWeek;
12705
+ if (type4 === "prev" && days >= 7) {
12706
+ days -= 7;
12707
+ }
12708
+ const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
12709
+ const months = Array.from(Array(preDates), (v, k2) => {
12710
+ return {
12711
+ day: k2 + 1,
12712
+ type: type4,
12713
+ preYear,
12714
+ preMonth
12715
+ };
12716
+ });
12717
+ return months.slice(preDates - days);
12718
+ };
12719
+ const splitDate = (date4) => {
12720
+ const split = date4.indexOf("-") !== -1 ? "-" : "/";
12721
+ return date4.split(split);
12722
+ };
12723
+ const isMultiple = (day, days) => {
12724
+ if (days.length > 0) {
12725
+ return days.some((item) => {
12726
+ return Utils.isEqual(item, day);
12727
+ });
12617
12728
  }
12729
+ return false;
12730
+ };
12731
+ const isCurrDay = (month, day) => {
12732
+ const date4 = `${month.curData[0]}/${month.curData[1]}/${day}`;
12733
+ return Utils.isEqual(date4, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
12734
+ };
12735
+ const getCurrDate = (day, month) => {
12736
+ return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
12737
+ +day.day
12738
+ )}`;
12739
+ };
12740
+ const isStart = (day, days) => {
12741
+ return Utils.isEqual(days[0], day);
12742
+ };
12743
+ const isEnd = (day, days) => {
12744
+ return Utils.isEqual(days[1], day);
12745
+ };
12746
+ const isStartAndEnd = (days) => {
12747
+ return days.length >= 2 && Utils.isEqual(days[0], days[1]);
12618
12748
  };
12619
12749
  const defaultProps$_ = {
12750
+ ...ComponentDefaults,
12620
12751
  type: "single",
12621
12752
  autoBackfill: false,
12622
12753
  popup: true,
@@ -12630,6 +12761,7 @@ const defaultProps$_ = {
12630
12761
  showTitle: true,
12631
12762
  showSubTitle: true,
12632
12763
  scrollAnimation: true,
12764
+ firstDayOfWeek: 0,
12633
12765
  renderHeaderButtons: void 0,
12634
12766
  renderDay: void 0,
12635
12767
  renderDayTop: void 0,
@@ -12638,7 +12770,7 @@ const defaultProps$_ = {
12638
12770
  },
12639
12771
  onUpdate: () => {
12640
12772
  },
12641
- onClickDay: (data) => {
12773
+ onDayClick: (data) => {
12642
12774
  },
12643
12775
  onPageChange: (data) => {
12644
12776
  }
@@ -12646,11 +12778,13 @@ const defaultProps$_ = {
12646
12778
  const CalendarItem = React__default.forwardRef((props, ref) => {
12647
12779
  const { locale } = useConfig();
12648
12780
  const {
12781
+ popup,
12649
12782
  type: type4,
12650
12783
  autoBackfill,
12651
- popup,
12652
12784
  title,
12653
12785
  defaultValue,
12786
+ startDate,
12787
+ endDate,
12654
12788
  showToday,
12655
12789
  startText,
12656
12790
  endText,
@@ -12658,28 +12792,29 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
12658
12792
  showTitle,
12659
12793
  showSubTitle,
12660
12794
  scrollAnimation,
12795
+ firstDayOfWeek,
12661
12796
  renderHeaderButtons,
12662
12797
  renderDay,
12663
12798
  renderDayTop,
12664
12799
  renderDayBottom,
12665
12800
  onConfirm,
12666
12801
  onUpdate,
12667
- onClickDay,
12802
+ onDayClick,
12668
12803
  onPageChange
12669
12804
  } = { ...defaultProps$_, ...props };
12670
- const weeks = locale.calendaritem.weekdays;
12805
+ const weekdays = locale.calendaritem.weekdays;
12806
+ const weeks = [
12807
+ ...weekdays.slice(firstDayOfWeek, 7),
12808
+ ...weekdays.slice(0, firstDayOfWeek)
12809
+ ];
12671
12810
  const monthTitle = locale.calendaritem.monthTitle;
12672
12811
  const [yearMonthTitle, setYearMonthTitle] = useState("");
12673
12812
  const [monthsData, setMonthsData] = useState([]);
12674
12813
  const [monthsNum, setMonthsNum] = useState(0);
12675
12814
  const [translateY, setTranslateY] = useState(0);
12676
12815
  const [monthDefaultRange, setMonthDefaultRange] = useState([]);
12677
- const propStartDate = props.startDate || Utils.getDay(0);
12678
- const propEndDate = props.endDate || Utils.getDay(365);
12679
- const splitDate = (date4) => {
12680
- const split = date4.indexOf("-") !== -1 ? "-" : "/";
12681
- return date4.split(split);
12682
- };
12816
+ const propStartDate = startDate || Utils.getDay(0);
12817
+ const propEndDate = endDate || Utils.getDay(365);
12683
12818
  const startDates = splitDate(propStartDate);
12684
12819
  const endDates = splitDate(propEndDate);
12685
12820
  const [state] = useState({
@@ -12706,171 +12841,49 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
12706
12841
  let viewHeight = 0;
12707
12842
  const classPrefix2 = "nut-calendar";
12708
12843
  const dayPrefix = "nut-calendar-day";
12709
- const classes = classNames(
12710
- {
12711
- [`${classPrefix2}-title`]: !popup,
12712
- [`${classPrefix2}-nofooter`]: !!autoBackfill
12713
- },
12714
- classPrefix2
12715
- );
12716
- const headerClasses = classNames({
12717
- [`${classPrefix2}-header`]: true,
12718
- [`${classPrefix2}-header-title`]: !popup
12719
- });
12720
- const isMultiple = (d) => {
12721
- if (currentDate.length > 0) {
12722
- return currentDate.some((item) => {
12723
- return Utils.isEqual(item, d);
12724
- });
12725
- }
12726
- return false;
12727
- };
12728
- const getCurrDate = (day, month) => {
12729
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
12730
- +day.day
12731
- )}`;
12732
- };
12733
- const getClasses = (day, month) => {
12734
- const dateStr = getCurrDate(day, month);
12735
- if (day.type === "active") {
12736
- if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
12737
- return `${dayPrefix}-disabled`;
12738
- }
12739
- if (type4 === "range") {
12740
- if (isStart(dateStr) || isEnd(dateStr)) {
12741
- return `${dayPrefix}-active ${isStart(dateStr) ? "active-start" : ""} ${isEnd(dateStr) ? "active-end" : ""}`;
12742
- }
12743
- if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
12744
- return `${dayPrefix}-choose`;
12745
- }
12746
- return null;
12747
- }
12748
- if (type4 === "multiple" && isMultiple(dateStr) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
12749
- return `${dayPrefix}-active`;
12750
- }
12751
- return null;
12752
- }
12753
- return `${dayPrefix}-disabled`;
12754
- };
12755
- const isCurrDay = (month, day) => {
12756
- const date4 = `${month.curData[0]}/${month.curData[1]}/${day}`;
12757
- return Utils.isEqual(date4, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
12758
- };
12759
- const isStart = (d) => {
12760
- return Utils.isEqual(currentDate[0], d);
12761
- };
12762
- const isEnd = (d) => {
12763
- return Utils.isEqual(currentDate[1], d);
12764
- };
12765
- const isStartTip = (day, month) => {
12766
- return type4 === "range" && day.type === "active" && isStart(getCurrDate(day, month));
12767
- };
12768
- const isEndTip = (day, month) => {
12769
- return currentDate.length >= 2 && type4 === "range" && day.type === "active" && isEnd(getCurrDate(day, month));
12770
- };
12771
- const isStartAndEnd = () => {
12772
- return currentDate.length >= 2 && Utils.isEqual(currentDate[0], currentDate[1]);
12773
- };
12774
- const getCurrMonthData = (type22) => {
12775
- const monthData = type22 === "prev" ? monthsData[0] : monthsData[monthsData.length - 1];
12776
- let year = parseInt(monthData.curData[0]);
12777
- let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
12778
- switch (type22) {
12779
- case "prev":
12780
- month === 1 && (year -= 1);
12781
- month = month === 1 ? 12 : --month;
12782
- break;
12783
- case "next":
12784
- month === 12 && (year += 1);
12785
- month = month === 12 ? 1 : ++month;
12786
- break;
12787
- }
12788
- return [
12789
- year,
12790
- Utils.getNumTwoBit(month),
12791
- Utils.getMonthDays(String(year), String(month))
12792
- ];
12793
- };
12794
- const getDaysStatus = (days, type22, year, month) => {
12795
- if (type22 === "prev" && days >= 7) {
12796
- days -= 7;
12797
- }
12798
- return Array.from(Array(days), (v, k2) => {
12799
- return {
12800
- day: k2 + 1,
12801
- type: type22,
12802
- year,
12803
- month
12804
- };
12805
- });
12806
- };
12807
- const getPreDaysStatus = (days, type22, year, month, preCurrMonthDays) => {
12808
- if (type22 === "prev" && days >= 7) {
12809
- days -= 7;
12810
- }
12811
- const months = Array.from(Array(preCurrMonthDays), (v, k2) => {
12812
- return {
12813
- day: k2 + 1,
12814
- type: type22,
12815
- year,
12816
- month
12844
+ const getMonthData = (curData, monthNum, type22) => {
12845
+ let i = 0;
12846
+ let date4 = curData;
12847
+ const monthData = monthsData;
12848
+ do {
12849
+ const y2 = parseInt(date4[0], 10);
12850
+ const m = parseInt(date4[1], 10);
12851
+ const days = [
12852
+ ...getPreMonthDates("prev", y2, m, firstDayOfWeek),
12853
+ ...getDaysStatus("active", y2, m)
12854
+ ];
12855
+ const cssHeight = 39 + (days.length > 35 ? 384 : 320);
12856
+ let scrollTop = 0;
12857
+ if (monthData.length > 0) {
12858
+ const monthEle = monthData[monthData.length - 1];
12859
+ scrollTop = monthEle.scrollTop + monthEle.cssHeight;
12860
+ }
12861
+ const monthInfo = {
12862
+ curData: date4,
12863
+ title: monthTitle(y2, m),
12864
+ monthData: days,
12865
+ cssHeight,
12866
+ scrollTop
12817
12867
  };
12818
- });
12819
- return months.slice(preCurrMonthDays - days);
12820
- };
12821
- const getMonthData = (curData, type22) => {
12822
- let preMonth = +curData[1] - 1;
12823
- let preYear = curData[0];
12824
- if (preMonth <= 0) {
12825
- preMonth = 12;
12826
- preYear += 1;
12827
- }
12828
- const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
12829
- const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
12830
- const preCurrMonthDays = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
12831
- const monthInfo = {
12832
- curData,
12833
- title: monthTitle(curData[0], curData[1]),
12834
- monthData: [
12835
- ...getPreDaysStatus(
12836
- preMonthDays,
12837
- "prev",
12838
- `${preMonth}`,
12839
- preYear,
12840
- preCurrMonthDays
12841
- ),
12842
- ...getDaysStatus(
12843
- currMonthDays,
12844
- "active",
12845
- curData[0],
12846
- curData[1]
12847
- )
12848
- ]
12849
- };
12850
- monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
12851
- let scrollTop = 0;
12852
- if (monthsData.length > 0) {
12853
- const monthEle = monthsData[monthsData.length - 1];
12854
- scrollTop = monthEle.scrollTop + monthEle.cssHeight;
12855
- }
12856
- monthInfo.scrollTop = scrollTop;
12857
- if (type22 === "next") {
12858
- if (!endDates || !Utils.compareDate(
12859
- `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
12860
- endDates[0],
12861
- endDates[1]
12862
- )}`,
12863
- `${curData[0]}/${curData[1]}/${curData[2]}`
12868
+ if (type22 === "next") {
12869
+ if (!endDates || !Utils.compareDate(
12870
+ `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
12871
+ endDates[0],
12872
+ endDates[1]
12873
+ )}`,
12874
+ `${curData[0]}/${curData[1]}/${curData[2]}`
12875
+ )) {
12876
+ monthData.push(monthInfo);
12877
+ }
12878
+ } else if (!startDates || !Utils.compareDate(
12879
+ `${curData[0]}/${curData[1]}/${curData[2]}`,
12880
+ `${startDates[0]}/${startDates[1]}/01`
12864
12881
  )) {
12865
- monthsData.push(monthInfo);
12882
+ monthData.unshift(monthInfo);
12866
12883
  }
12867
- } else if (!startDates || !Utils.compareDate(
12868
- `${curData[0]}/${curData[1]}/${curData[2]}`,
12869
- `${startDates[0]}/${startDates[1]}/01`
12870
- )) {
12871
- monthsData.unshift(monthInfo);
12872
- }
12873
- setMonthsData(monthsData);
12884
+ date4 = getCurrMonthData("next", y2, m);
12885
+ } while (i++ < monthNum);
12886
+ setMonthsData(monthData);
12874
12887
  };
12875
12888
  const setReachedYearMonthInfo = (current) => {
12876
12889
  const currentMonthsData = monthsData[current];
@@ -12902,48 +12915,11 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
12902
12915
  setTranslateY(monthsData[start2].scrollTop);
12903
12916
  setReachedYearMonthInfo(current);
12904
12917
  };
12905
- const monthsViewScroll = (e) => {
12906
- if (monthsData.length <= 1) {
12907
- return;
12908
- }
12909
- const scrollTop = e.target.scrollTop;
12910
- let current = Math.floor(scrollTop / avgHeight);
12911
- const nextTop = monthsData[current + 1].scrollTop;
12912
- const nextHeight = monthsData[current + 1].cssHeight;
12913
- if (current === 0) {
12914
- if (scrollTop >= nextTop) {
12915
- current += 1;
12916
- }
12917
- } else if (current > 0 && current < monthsNum - 1) {
12918
- if (scrollTop >= nextTop) {
12919
- current += 1;
12920
- }
12921
- if (scrollTop < monthsData[current].scrollTop) {
12922
- current -= 1;
12923
- }
12924
- } else {
12925
- const viewPosition = Math.round(scrollTop + viewHeight);
12926
- if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
12927
- current += 1;
12928
- }
12929
- if (current >= 1 && scrollTop < monthsData[current - 1].scrollTop) {
12930
- current -= 1;
12931
- }
12932
- }
12933
- setDefaultRange(monthsNum, current);
12934
- };
12935
12918
  const getMonthNum = () => {
12936
- const startDate = {
12937
- year: Number(startDates[0]),
12938
- month: Number(startDates[1])
12939
- };
12940
- const endDate = {
12941
- year: Number(endDates[0]),
12942
- month: Number(endDates[1])
12943
- };
12944
- let monthNum = endDate.month - startDate.month;
12945
- if (endDate.year - startDate.year > 0) {
12946
- monthNum += 12 * (endDate.year - startDate.year);
12919
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
12920
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
12921
+ if (yearNum > 0) {
12922
+ monthNum += 12 * yearNum;
12947
12923
  }
12948
12924
  if (monthNum <= 0) {
12949
12925
  monthNum = 1;
@@ -12951,26 +12927,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
12951
12927
  setMonthsNum(monthNum);
12952
12928
  return monthNum;
12953
12929
  };
12954
- const getMonthsData = (monthNum) => {
12955
- getMonthData(startDates, "next");
12956
- let i = 1;
12957
- do {
12958
- getMonthData(getCurrMonthData("next"), "next");
12959
- } while (i++ < monthNum);
12960
- };
12961
- const requestAniFrameFunc = (current, monthNum) => {
12962
- const lastItem = monthsData[monthsData.length - 1];
12963
- const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
12964
- requestAniFrame$1(() => {
12965
- if (monthsRef && monthsPanel && viewAreaRef) {
12966
- viewHeight = monthsRef.current.clientHeight;
12967
- monthsPanel.current.style.height = `${containerHeight}px`;
12968
- monthsRef.current.scrollTop = monthsData[current].scrollTop;
12969
- }
12970
- });
12971
- setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
12972
- };
12973
- const renderCurrentDate = () => {
12930
+ const setDefaultDate = () => {
12974
12931
  let defaultData = [];
12975
12932
  if (type4 === "range" && Array.isArray(currentDate)) {
12976
12933
  if (currentDate.length > 0) {
@@ -12985,7 +12942,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
12985
12942
  ...splitDate(currentDate[1])
12986
12943
  ];
12987
12944
  }
12988
- } else if (props.type === "multiple" && Array.isArray(currentDate)) {
12945
+ } else if (type4 === "multiple" && Array.isArray(currentDate)) {
12989
12946
  if (currentDate.length > 0) {
12990
12947
  const defaultArr = [];
12991
12948
  const obj = {};
@@ -13000,6 +12957,22 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
13000
12957
  currentDate.splice(0) && currentDate.push(...defaultArr);
13001
12958
  defaultData = [...splitDate(defaultArr[0])];
13002
12959
  }
12960
+ } else if (type4 === "week" && Array.isArray(currentDate)) {
12961
+ if (currentDate.length > 0) {
12962
+ const [y2, m, d] = splitDate(currentDate[0]);
12963
+ const weekArr = Utils.getWeekDate(y2, m, d, firstDayOfWeek);
12964
+ currentDate.splice(0) && currentDate.push(...weekArr);
12965
+ if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
12966
+ currentDate.splice(0, 1, propStartDate);
12967
+ }
12968
+ if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
12969
+ currentDate.splice(1, 1, propEndDate);
12970
+ }
12971
+ defaultData = [
12972
+ ...splitDate(currentDate[0]),
12973
+ ...splitDate(currentDate[1])
12974
+ ];
12975
+ }
13003
12976
  } else if (currentDate) {
13004
12977
  if (currentDate.length > 0) {
13005
12978
  if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
@@ -13013,6 +12986,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
13013
12986
  defaultData = [];
13014
12987
  }
13015
12988
  }
12989
+ return defaultData;
12990
+ };
12991
+ const getCurrentIndex = (defaultData) => {
13016
12992
  let current = 0;
13017
12993
  let lastCurrent = 0;
13018
12994
  if (defaultData.length > 0) {
@@ -13020,38 +12996,53 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
13020
12996
  if (item.title === monthTitle(defaultData[0], defaultData[1])) {
13021
12997
  current = index;
13022
12998
  }
13023
- if (props.type === "range") {
12999
+ if (type4 === "range" || type4 === "week") {
13024
13000
  if (item.title === monthTitle(defaultData[3], defaultData[4])) {
13025
13001
  lastCurrent = index;
13026
13002
  }
13027
13003
  }
13028
13004
  });
13029
13005
  } else {
13030
- const currentYear2 = (/* @__PURE__ */ new Date()).getFullYear();
13031
- const currentMonth = (/* @__PURE__ */ new Date()).getMonth() + 1;
13032
- const currentYearMonthIndex = monthsData.findIndex((item) => {
13033
- return +item.curData[0] === currentYear2 && +item.curData[1] === currentMonth;
13006
+ const date4 = /* @__PURE__ */ new Date();
13007
+ const year = date4.getFullYear();
13008
+ const month = date4.getMonth() + 1;
13009
+ const index = monthsData.findIndex((item) => {
13010
+ return +item.curData[0] === year && +item.curData[1] === month;
13034
13011
  });
13035
- if (currentYearMonthIndex > -1) {
13036
- current = currentYearMonthIndex;
13012
+ if (index > -1) {
13013
+ current = index;
13037
13014
  }
13038
13015
  }
13016
+ return {
13017
+ current,
13018
+ lastCurrent
13019
+ };
13020
+ };
13021
+ const renderCurrentDate = () => {
13022
+ const defaultData = setDefaultDate();
13023
+ const current = getCurrentIndex(defaultData);
13039
13024
  if (defaultData.length > 0) {
13040
13025
  if (type4 === "range") {
13041
13026
  chooseDay(
13042
13027
  { day: defaultData[2], type: "active" },
13043
- monthsData[current],
13028
+ monthsData[current.current],
13044
13029
  true
13045
13030
  );
13046
13031
  chooseDay(
13047
13032
  { day: defaultData[5], type: "active" },
13048
- monthsData[lastCurrent],
13033
+ monthsData[current.lastCurrent],
13034
+ true
13035
+ );
13036
+ } else if (props.type === "week") {
13037
+ chooseDay(
13038
+ { day: defaultData[2], type: "curr" },
13039
+ monthsData[current.current],
13049
13040
  true
13050
13041
  );
13051
13042
  } else if (type4 === "multiple") {
13052
13043
  [...currentDate].forEach((item) => {
13053
13044
  const dateArr = splitDate(item);
13054
- let currentIndex = current;
13045
+ let currentIndex = current.current;
13055
13046
  monthsData.forEach((item2, index) => {
13056
13047
  if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
13057
13048
  currentIndex = index;
@@ -13066,25 +13057,44 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
13066
13057
  } else {
13067
13058
  chooseDay(
13068
13059
  { day: defaultData[2], type: "active" },
13069
- monthsData[current],
13060
+ monthsData[current.current],
13070
13061
  true
13071
13062
  );
13072
13063
  }
13073
13064
  }
13074
- return current;
13065
+ return current.current;
13066
+ };
13067
+ const requestAniFrameFunc = (current, monthNum) => {
13068
+ const lastItem = monthsData[monthsData.length - 1];
13069
+ const containerHeight = lastItem.cssHeight + lastItem.scrollTop;
13070
+ requestAniFrame$1(() => {
13071
+ if (monthsRef && monthsPanel && viewAreaRef) {
13072
+ viewHeight = monthsRef.current.clientHeight;
13073
+ monthsPanel.current.style.height = `${containerHeight}px`;
13074
+ monthsRef.current.scrollTop = monthsData[current].scrollTop;
13075
+ }
13076
+ });
13077
+ setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
13075
13078
  };
13076
13079
  const initData = () => {
13077
13080
  const monthNum = getMonthNum();
13078
- getMonthsData(monthNum);
13081
+ getMonthData(startDates, monthNum, "next");
13079
13082
  const current = renderCurrentDate();
13080
13083
  setDefaultRange(monthNum, current);
13081
13084
  requestAniFrameFunc(current, monthNum);
13082
13085
  };
13086
+ useEffect(() => {
13087
+ initData();
13088
+ }, []);
13083
13089
  const resetRender = () => {
13084
13090
  state.currDateArray.splice(0);
13085
13091
  monthsData.splice(0);
13086
13092
  initData();
13087
13093
  };
13094
+ useEffect(() => {
13095
+ setCurrentDate(resetDefaultValue() || []);
13096
+ popup && resetRender();
13097
+ }, [defaultValue]);
13088
13098
  const scrollToDate = (date4) => {
13089
13099
  if (Utils.compareDate(date4, propStartDate)) {
13090
13100
  date4 = propStartDate;
@@ -13119,30 +13129,67 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
13119
13129
  }
13120
13130
  });
13121
13131
  };
13122
- useEffect(() => {
13123
- initData();
13124
- }, []);
13125
- useEffect(() => {
13126
- setCurrentDate(resetDefaultValue() || []);
13127
- popup && resetRender();
13128
- }, [defaultValue]);
13132
+ const monthsViewScroll = (e) => {
13133
+ if (monthsData.length <= 1) {
13134
+ return;
13135
+ }
13136
+ const scrollTop = e.target.scrollTop;
13137
+ let current = Math.floor(scrollTop / avgHeight);
13138
+ const nextTop = monthsData[current + 1].scrollTop;
13139
+ const nextHeight = monthsData[current + 1].cssHeight;
13140
+ if (current === 0) {
13141
+ if (scrollTop >= nextTop) {
13142
+ current += 1;
13143
+ }
13144
+ } else if (current > 0 && current < monthsNum - 1) {
13145
+ if (scrollTop >= nextTop) {
13146
+ current += 1;
13147
+ }
13148
+ if (scrollTop < monthsData[current].scrollTop) {
13149
+ current -= 1;
13150
+ }
13151
+ } else {
13152
+ const viewPosition = Math.round(scrollTop + viewHeight);
13153
+ if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
13154
+ current += 1;
13155
+ }
13156
+ if (current >= 1 && scrollTop < monthsData[current - 1].scrollTop) {
13157
+ current -= 1;
13158
+ }
13159
+ }
13160
+ setDefaultRange(monthsNum, current);
13161
+ };
13129
13162
  React__default.useImperativeHandle(ref, () => ({
13130
13163
  scrollToDate
13131
13164
  }));
13132
- const confirm2 = () => {
13133
- if (type4 === "range" && state.currDateArray.length === 2 || type4 !== "range") {
13134
- const chooseData = state.currDateArray.slice(0);
13135
- onConfirm && onConfirm(chooseData);
13136
- if (popup) {
13137
- onUpdate && onUpdate();
13165
+ const getClasses = (day, month) => {
13166
+ const dateStr = getCurrDate(day, month);
13167
+ if (day.type === "active") {
13168
+ if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
13169
+ return `${dayPrefix}-disabled`;
13170
+ }
13171
+ if (type4 === "range" || type4 === "week") {
13172
+ if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
13173
+ return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
13174
+ }
13175
+ if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
13176
+ return `${dayPrefix}-choose`;
13177
+ }
13178
+ return null;
13179
+ }
13180
+ if (type4 === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
13181
+ return `${dayPrefix}-active`;
13138
13182
  }
13183
+ return null;
13139
13184
  }
13185
+ return `${dayPrefix}-disabled`;
13140
13186
  };
13141
13187
  const chooseDay = (day, month, isFirst) => {
13142
13188
  if (getClasses(day, month) === `${dayPrefix}-disabled`) {
13143
13189
  return;
13144
13190
  }
13145
13191
  const days = [...month.curData];
13192
+ const [y2, m] = month.curData;
13146
13193
  days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
13147
13194
  days[3] = `${days[0]}/${days[1]}/${days[2]}`;
13148
13195
  days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
@@ -13179,67 +13226,109 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
13179
13226
  Array.isArray(currentDate) && currentDate.unshift(days[3]);
13180
13227
  state.currDateArray = [[...days], ...state.currDateArray];
13181
13228
  }
13229
+ } else if (type4 === "week") {
13230
+ const weekArr = Utils.getWeekDate(y2, m, `${day.day}`, firstDayOfWeek);
13231
+ if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
13232
+ weekArr.splice(0, 1, propStartDate);
13233
+ }
13234
+ if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
13235
+ weekArr.splice(1, 1, propEndDate);
13236
+ }
13237
+ Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
13238
+ state.currDateArray = [
13239
+ Utils.formatResultDate(weekArr[0]),
13240
+ Utils.formatResultDate(weekArr[1])
13241
+ ];
13182
13242
  } else {
13183
13243
  setCurrentDate(days[3]);
13184
13244
  state.currDateArray = [...days];
13185
13245
  }
13186
13246
  if (!isFirst) {
13187
- onClickDay && onClickDay(state.currDateArray);
13247
+ onDayClick && onDayClick(state.currDateArray);
13188
13248
  if (autoBackfill || !popup) {
13189
13249
  confirm2();
13190
13250
  }
13191
13251
  }
13192
13252
  setMonthsData(monthsData.slice());
13193
13253
  };
13194
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: classes }, /* @__PURE__ */ React__default.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-weeks`, ref: weeksPanel }, weeks.map((item) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item)))), /* @__PURE__ */ React__default.createElement(
13195
- "div",
13254
+ const confirm2 = () => {
13255
+ if (type4 === "range" && state.currDateArray.length === 2 || type4 !== "range") {
13256
+ const chooseData = state.currDateArray.slice(0);
13257
+ onConfirm && onConfirm(chooseData);
13258
+ if (popup) {
13259
+ onUpdate && onUpdate();
13260
+ }
13261
+ }
13262
+ };
13263
+ const classes = classNames(
13196
13264
  {
13197
- className: `${classPrefix2}-content`,
13198
- onScroll: monthsViewScroll,
13199
- ref: monthsRef
13265
+ [`${classPrefix2}-title`]: !popup,
13266
+ [`${classPrefix2}-nofooter`]: !!autoBackfill
13200
13267
  },
13201
- /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React__default.createElement(
13268
+ classPrefix2
13269
+ );
13270
+ const headerClasses = classNames({
13271
+ [`${classPrefix2}-header`]: true,
13272
+ [`${classPrefix2}-header-title`]: !popup
13273
+ });
13274
+ const isStartTip = (day, month) => {
13275
+ return (type4 === "range" || type4 === "week") && day.type === "active" && isStart(getCurrDate(day, month), currentDate);
13276
+ };
13277
+ const isEndTip = (day, month) => {
13278
+ return currentDate.length >= 2 && (type4 === "range" || type4 === "week") && day.type === "active" && isEnd(getCurrDate(day, month), currentDate);
13279
+ };
13280
+ const renderHeader = () => {
13281
+ return /* @__PURE__ */ React__default.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-weeks`, ref: weeksPanel }, weeks.map((item) => /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))));
13282
+ };
13283
+ const renderContent = () => {
13284
+ return /* @__PURE__ */ React__default.createElement(
13202
13285
  "div",
13203
13286
  {
13204
- className: "viewArea",
13205
- ref: viewAreaRef,
13206
- style: { transform: `translateY(${translateY}px)` }
13287
+ className: `${classPrefix2}-content`,
13288
+ onScroll: monthsViewScroll,
13289
+ ref: monthsRef
13207
13290
  },
13208
- monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
13209
- return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map((day, i) => /* @__PURE__ */ React__default.createElement(
13210
- "div",
13211
- {
13212
- className: [
13213
- `${classPrefix2}-day`,
13214
- getClasses(day, month)
13215
- ].join(" "),
13216
- onClick: () => {
13217
- chooseDay(day, month);
13218
- },
13219
- key: i
13220
- },
13221
- /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
13222
- !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
13223
- !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React__default.createElement(
13224
- "div",
13225
- {
13226
- className: `${classPrefix2}-day-info-bottom`
13227
- },
13228
- renderDayBottom(day)
13229
- ),
13230
- !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
13231
- isStartTip(day, month) && /* @__PURE__ */ React__default.createElement(
13291
+ /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-pannel`, ref: monthsPanel }, /* @__PURE__ */ React__default.createElement(
13292
+ "div",
13293
+ {
13294
+ className: "viewArea",
13295
+ ref: viewAreaRef,
13296
+ style: { transform: `translateY(${translateY}px)` }
13297
+ },
13298
+ monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
13299
+ return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map((day, i) => /* @__PURE__ */ React__default.createElement(
13232
13300
  "div",
13233
13301
  {
13234
- className: `${classPrefix2}-day-info ${isStartAndEnd() ? `${classPrefix2}-day-info-top` : ""}`
13302
+ className: [
13303
+ `${classPrefix2}-day`,
13304
+ getClasses(day, month)
13305
+ ].join(" "),
13306
+ onClick: () => {
13307
+ chooseDay(day, month);
13308
+ },
13309
+ key: i
13235
13310
  },
13236
- startText || locale.calendaritem.start
13237
- ),
13238
- isEndTip(day, month) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
13239
- ))));
13240
- })
13241
- ))
13242
- ), popup && !autoBackfill ? /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendar-footer" }, /* @__PURE__ */ React__default.createElement("div", { className: "calendar-confirm-btn", onClick: confirm2 }, confirmText || locale.confirm)) : ""));
13311
+ /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
13312
+ !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
13313
+ !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
13314
+ !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
13315
+ isStartTip(day, month) && /* @__PURE__ */ React__default.createElement(
13316
+ "div",
13317
+ {
13318
+ className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
13319
+ },
13320
+ startText || locale.calendaritem.start
13321
+ ),
13322
+ isEndTip(day, month) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
13323
+ ))));
13324
+ })
13325
+ ))
13326
+ );
13327
+ };
13328
+ const renderFooter = () => {
13329
+ return /* @__PURE__ */ React__default.createElement("div", { className: "nut-calendar-footer" }, /* @__PURE__ */ React__default.createElement("div", { className: "calendar-confirm-btn", onClick: confirm2 }, confirmText || locale.confirm));
13330
+ };
13331
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: classes }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : ""));
13243
13332
  });
13244
13333
  CalendarItem.defaultProps = defaultProps$_;
13245
13334
  CalendarItem.displayName = "NutCalendarItem";
@@ -13259,6 +13348,7 @@ const defaultProps$Z = {
13259
13348
  showTitle: true,
13260
13349
  showSubTitle: true,
13261
13350
  scrollAnimation: true,
13351
+ firstDayOfWeek: 0,
13262
13352
  renderHeaderButtons: void 0,
13263
13353
  renderDay: void 0,
13264
13354
  renderDayTop: void 0,
@@ -13267,7 +13357,7 @@ const defaultProps$Z = {
13267
13357
  },
13268
13358
  onConfirm: (param) => {
13269
13359
  },
13270
- onClickDay: (data) => {
13360
+ onDayClick: (data) => {
13271
13361
  },
13272
13362
  onPageChange: (param) => {
13273
13363
  }
@@ -13290,13 +13380,14 @@ const Calendar = React__default.forwardRef((props, ref) => {
13290
13380
  showTitle,
13291
13381
  showSubTitle,
13292
13382
  scrollAnimation,
13383
+ firstDayOfWeek,
13293
13384
  renderHeaderButtons,
13294
13385
  renderDay,
13295
13386
  renderDayTop,
13296
13387
  renderDayBottom,
13297
13388
  onClose,
13298
13389
  onConfirm,
13299
- onClickDay,
13390
+ onDayClick,
13300
13391
  onPageChange
13301
13392
  } = { ...defaultProps$Z, ...props };
13302
13393
  const calendarRef = useRef(null);
@@ -13311,7 +13402,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
13311
13402
  close();
13312
13403
  };
13313
13404
  const select = (param) => {
13314
- onClickDay && onClickDay(param);
13405
+ onDayClick && onDayClick(param);
13315
13406
  };
13316
13407
  const scrollToDate = (date4) => {
13317
13408
  var _a2;
@@ -13342,12 +13433,13 @@ const Calendar = React__default.forwardRef((props, ref) => {
13342
13433
  showTitle,
13343
13434
  showSubTitle,
13344
13435
  scrollAnimation,
13436
+ firstDayOfWeek,
13345
13437
  renderHeaderButtons,
13346
13438
  renderDay,
13347
13439
  renderDayTop,
13348
13440
  renderDayBottom,
13349
13441
  onConfirm: choose,
13350
- onClickDay: select,
13442
+ onDayClick: select,
13351
13443
  onPageChange: yearMonthChange
13352
13444
  }
13353
13445
  );
@@ -13361,8 +13453,8 @@ const Calendar = React__default.forwardRef((props, ref) => {
13361
13453
  duration: 0.5,
13362
13454
  closeable: true,
13363
13455
  destroyOnClose: true,
13364
- onClickOverlay: closePopup,
13365
- onClickCloseIcon: closePopup,
13456
+ onOverlayClick: closePopup,
13457
+ onCloseIconClick: closePopup,
13366
13458
  style: { height: "85vh" }
13367
13459
  },
13368
13460
  renderItem()
@@ -16329,7 +16421,6 @@ const Menu = (props) => {
16329
16421
  };
16330
16422
  const hideMenuItem = (index) => {
16331
16423
  showMenuItem[index] = false;
16332
- console.log([...showMenuItem]);
16333
16424
  setShowMenuItem([...showMenuItem]);
16334
16425
  };
16335
16426
  const updateTitle = (text, index) => {
@@ -16741,8 +16832,8 @@ const NumberKeyboard = (props) => {
16741
16832
  {
16742
16833
  visible,
16743
16834
  position: "bottom",
16744
- onClickOverlay: onClose,
16745
- onClickCloseIcon: onClose,
16835
+ onOverlayClick: onClose,
16836
+ onCloseIconClick: onClose,
16746
16837
  overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" },
16747
16838
  ...rest
16748
16839
  },
@@ -17420,7 +17511,7 @@ const SearchBar = (props) => {
17420
17511
  onBlur,
17421
17512
  onClear,
17422
17513
  onSearch,
17423
- onClickInput
17514
+ onInputClick
17424
17515
  } = {
17425
17516
  ...defaultProps$J,
17426
17517
  ...props
@@ -17471,7 +17562,7 @@ const SearchBar = (props) => {
17471
17562
  );
17472
17563
  };
17473
17564
  const clickInput = (e) => {
17474
- onClickInput && onClickInput(e);
17565
+ onInputClick && onInputClick(e);
17475
17566
  };
17476
17567
  const renderLeftIn = () => {
17477
17568
  if (!leftIn)
@@ -17575,8 +17666,8 @@ const ShortPassword = (props) => {
17575
17666
  onCancel,
17576
17667
  onClose,
17577
17668
  onComplete,
17578
- onClickOverlay,
17579
- onClickCloseIcon,
17669
+ onOverlayClick,
17670
+ onCloseIconClick,
17580
17671
  ...rest
17581
17672
  } = {
17582
17673
  ...defaultProps$I,
@@ -17615,8 +17706,8 @@ const ShortPassword = (props) => {
17615
17706
  },
17616
17707
  visible,
17617
17708
  closeable: true,
17618
- onClickOverlay: onClose,
17619
- onClickCloseIcon: onClose,
17709
+ onOverlayClick: onClose,
17710
+ onCloseIconClick: onClose,
17620
17711
  ...rest
17621
17712
  },
17622
17713
  /* @__PURE__ */ React__default.createElement("div", { className: classNames(className, classPrefix2), style }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__title` }, title || locale.shortpassword.title), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__description` }, description || locale.shortpassword.description), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__input`, onClick: onFocus }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__input-site` }), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__input-fake` }, [...new Array(comLen).keys()].map((item, index) => {
@@ -18126,7 +18217,7 @@ const defaultProps$D = {
18126
18217
  url: "",
18127
18218
  maxCount: 1,
18128
18219
  previewType: "picture",
18129
- imageFit: "cover",
18220
+ fit: "cover",
18130
18221
  name: "file",
18131
18222
  accept: "*",
18132
18223
  disabled: false,
@@ -18171,7 +18262,7 @@ const InternalUploader = (props, ref) => {
18171
18262
  defaultValue,
18172
18263
  value,
18173
18264
  previewType,
18174
- imageFit,
18265
+ fit,
18175
18266
  disabled,
18176
18267
  multiple,
18177
18268
  url: url2,
@@ -18463,7 +18554,7 @@ const InternalUploader = (props, ref) => {
18463
18554
  "img",
18464
18555
  {
18465
18556
  className: "nut-uploader__preview-img__c",
18466
- style: { objectFit: imageFit },
18557
+ style: { objectFit: fit },
18467
18558
  src: item.url,
18468
18559
  alt: "",
18469
18560
  onClick: () => handleItemClick(item)
@@ -18578,7 +18669,7 @@ const ActionSheet = (props) => {
18578
18669
  onCancel && onCancel();
18579
18670
  };
18580
18671
  const chooseItem = (item, index) => {
18581
- if (!item.disable) {
18672
+ if (!item.disabled) {
18582
18673
  onSelect && onSelect(item, index);
18583
18674
  }
18584
18675
  };
@@ -18598,7 +18689,7 @@ const ActionSheet = (props) => {
18598
18689
  return /* @__PURE__ */ React__default.createElement(
18599
18690
  "div",
18600
18691
  {
18601
- className: `${classPrefix2}__item ${item.disable ? "disabled" : ""} ${item.danger ? "danger" : ""}`,
18692
+ className: `${classPrefix2}__item ${item.disabled ? "disabled" : ""} ${item.danger ? "danger" : ""}`,
18602
18693
  key: index,
18603
18694
  onClick: () => chooseItem(item, index)
18604
18695
  },
@@ -19280,7 +19371,7 @@ const NoticeBar = (props) => {
19280
19371
  click,
19281
19372
  onClose,
19282
19373
  onClick,
19283
- onClickItem
19374
+ onItemClick
19284
19375
  } = {
19285
19376
  ...defaultProps$x,
19286
19377
  ...props
@@ -19511,7 +19602,7 @@ const NoticeBar = (props) => {
19511
19602
  });
19512
19603
  };
19513
19604
  const handleItemClick = (event, value) => {
19514
- onClickItem && onClickItem(event, value);
19605
+ onItemClick && onItemClick(event, value);
19515
19606
  };
19516
19607
  const getStyle = (moveOffset = offset) => {
19517
19608
  const target = innerRef.current;
@@ -19805,10 +19896,9 @@ const defaultProps$w = {
19805
19896
  visible: false,
19806
19897
  offset: [0, 12],
19807
19898
  targetId: "",
19808
- className: "",
19809
19899
  showArrow: true,
19810
- closeOnClickOutside: true,
19811
- closeOnClickAction: true,
19900
+ closeOnOutsideClick: true,
19901
+ closeOnActionClick: true,
19812
19902
  overlay: false,
19813
19903
  onClick: () => {
19814
19904
  },
@@ -19827,8 +19917,8 @@ const Popover = (props) => {
19827
19917
  offset,
19828
19918
  targetId,
19829
19919
  overlay,
19830
- closeOnClickOutside,
19831
- closeOnClickAction,
19920
+ closeOnOutsideClick,
19921
+ closeOnActionClick,
19832
19922
  className,
19833
19923
  showArrow,
19834
19924
  style,
@@ -19868,7 +19958,7 @@ const Popover = (props) => {
19868
19958
  "touchstart",
19869
19959
  true,
19870
19960
  visible,
19871
- closeOnClickOutside
19961
+ closeOnOutsideClick
19872
19962
  );
19873
19963
  const getContentWidth = () => {
19874
19964
  let rect = getRect(popoverRef.current);
@@ -19962,7 +20052,7 @@ const Popover = (props) => {
19962
20052
  if (!item.disabled) {
19963
20053
  onSelect && onSelect(item, index);
19964
20054
  }
19965
- if (closeOnClickAction) {
20055
+ if (closeOnActionClick) {
19966
20056
  props.onClick && props.onClick();
19967
20057
  onClose && onClose();
19968
20058
  }
@@ -22676,342 +22766,43 @@ const ImagePreview = (props) => {
22676
22766
  };
22677
22767
  ImagePreview.defaultProps = defaultProps$d;
22678
22768
  ImagePreview.displayName = "NutImagePreview";
22679
- const initPositinoCache = (reaItemSize, length = 0) => {
22680
- let index = 0;
22681
- const positions = Array(length);
22682
- while (index < length) {
22683
- positions[index] = {
22684
- index,
22685
- height: reaItemSize,
22686
- width: reaItemSize,
22687
- top: index * reaItemSize,
22688
- bottom: (index + 1) * reaItemSize,
22689
- left: index * reaItemSize,
22690
- right: (index + 1) * reaItemSize
22691
- };
22692
- index++;
22693
- }
22694
- return positions;
22695
- };
22696
- const getListTotalSize = (positions, horizontal) => {
22697
- const index = positions.length - 1;
22698
- let size = 0;
22699
- if (index < 0) {
22700
- size = 0;
22701
- } else {
22702
- size = horizontal ? positions[index].right : positions[index].bottom;
22703
- }
22704
- return size;
22705
- };
22706
- const binarySearch = (positionsList, value = 0, horizontal) => {
22707
- let start2 = 0;
22708
- let end = positionsList.length - 1;
22709
- let tempIndex = null;
22710
- const key = horizontal ? "right" : "bottom";
22711
- while (start2 <= end) {
22712
- const midIndex = Math.floor((start2 + end) / 2);
22713
- const midValue = positionsList[midIndex][key];
22714
- if (midValue === value) {
22715
- return midIndex + 1;
22716
- }
22717
- if (midValue < value) {
22718
- start2 = midIndex + 1;
22719
- } else if (midValue > value) {
22720
- if (tempIndex === null || tempIndex > midIndex) {
22721
- tempIndex = midIndex;
22722
- }
22723
- end = midIndex - 1;
22724
- }
22725
- }
22726
- tempIndex = tempIndex || 0;
22727
- return tempIndex;
22728
- };
22729
- const getEndIndex = ({
22730
- list,
22731
- startIndex,
22732
- visibleCount,
22733
- itemEqual = true,
22734
- positions,
22735
- offSetSize,
22736
- overscan,
22737
- sizeKey = "width"
22738
- }) => {
22739
- const dataLength = list.length;
22740
- let tempIndex = null;
22741
- if (itemEqual) {
22742
- const endIndex = startIndex + visibleCount;
22743
- tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
22744
- } else {
22745
- let sizeNum = 0;
22746
- for (let i = startIndex; i < dataLength; i++) {
22747
- sizeNum += positions[i][sizeKey] || 0;
22748
- if (sizeNum > offSetSize) {
22749
- const endIndex = i + overscan;
22750
- tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
22751
- break;
22752
- }
22753
- }
22754
- if (sizeNum < offSetSize) {
22755
- tempIndex = dataLength;
22756
- }
22757
- }
22758
- tempIndex = tempIndex || 0;
22759
- return tempIndex;
22760
- };
22761
- const updateItemSize = (positions, items, sizeKey) => {
22762
- const newPos = positions.concat();
22763
- Array.from(items).forEach((item) => {
22764
- const index = Number(item.getAttribute("data-index"));
22765
- const styleVal = item.getAttribute("style");
22766
- if (styleVal && styleVal.includes("none"))
22767
- return;
22768
- const nowSize = item.getBoundingClientRect()[sizeKey];
22769
- const oldSize = positions[index][sizeKey];
22770
- const dValue = oldSize - nowSize;
22771
- if (dValue) {
22772
- if (sizeKey === "width") {
22773
- newPos[index].right -= dValue;
22774
- newPos[index][sizeKey] = nowSize;
22775
- for (let k2 = index + 1; k2 < positions.length; k2++) {
22776
- newPos[k2].left = positions[k2 - 1].right;
22777
- newPos[k2].right -= dValue;
22778
- }
22779
- } else if (sizeKey === "height") {
22780
- newPos[index].bottom -= dValue;
22781
- newPos[index][sizeKey] = nowSize;
22782
- for (let k2 = index + 1; k2 < positions.length; k2++) {
22783
- newPos[k2].top = positions[k2 - 1].bottom;
22784
- newPos[k2].bottom -= dValue;
22785
- }
22786
- }
22787
- }
22788
- });
22789
- };
22790
22769
  const defaultProps$c = {
22791
22770
  ...ComponentDefaults,
22792
- list: [],
22793
- itemHeight: 66,
22794
- itemEqual: true,
22795
- direction: "vertical",
22796
- overscan: 2
22771
+ defaultValue: 1,
22772
+ mode: "multi",
22773
+ prev: null,
22774
+ next: null,
22775
+ total: 50,
22776
+ pageSize: 10,
22777
+ itemSize: 5,
22778
+ ellipse: false
22797
22779
  };
22798
- const VirtualList = (props) => {
22780
+ const Pagination = (props) => {
22781
+ const { locale } = useConfig();
22799
22782
  const {
22800
- list,
22801
- ItemRender,
22802
- itemEqual,
22803
- itemHeight,
22804
- direction,
22805
- overscan,
22806
- key,
22807
- onScroll,
22783
+ value,
22784
+ mode,
22785
+ prev,
22786
+ next,
22787
+ total,
22788
+ pageSize,
22789
+ itemSize,
22790
+ onChange,
22791
+ ellipse,
22792
+ itemRender,
22793
+ defaultValue,
22808
22794
  className,
22809
- containerHeight,
22810
22795
  ...rest
22811
22796
  } = {
22812
22797
  ...defaultProps$c,
22813
22798
  ...props
22814
22799
  };
22815
- const horizontal = direction === "horizontal";
22816
- const sizeKey = horizontal ? "width" : "height";
22817
- const scrollKey = horizontal ? "scrollLeft" : "scrollTop";
22818
- const offsetKey = horizontal ? "left" : "top";
22819
- const scrollRef = useRef(null);
22820
- const itemsRef = useRef(null);
22821
- const firstItemRef = useRef(null);
22822
- const [positions, setPositions] = useState([
22823
- {
22824
- index: 0,
22825
- left: 0,
22826
- top: 0,
22827
- bottom: 0,
22828
- width: 0,
22829
- height: 0,
22830
- right: 0
22831
- }
22832
- ]);
22833
- const [listTotalSize, setListTotalSize] = useState(99999999);
22834
- const [visibleCount, setVisibleCount] = useState(0);
22835
- const [offSetSize, setOffSetSize] = useState(containerHeight || 0);
22836
- const [options2, setOptions] = useState({
22837
- startOffset: 0,
22838
- // 可视区域距离顶部的偏移量
22839
- startIndex: 0,
22840
- // 可视区域开始索引
22841
- overStart: 0,
22842
- endIndex: 10
22843
- // 可视区域结束索引
22844
- });
22845
- useEffect(() => {
22846
- const pos = initPositinoCache(itemHeight, list.length);
22847
- setPositions(pos);
22848
- const totalSize = getListTotalSize(pos, horizontal);
22849
- setListTotalSize(totalSize);
22850
- }, [list, itemHeight, horizontal]);
22851
- const getElement = useCallback(() => {
22852
- var _a2;
22853
- return ((_a2 = scrollRef.current) == null ? void 0 : _a2.parentElement) || document.body;
22854
- }, []);
22855
- useEffect(() => {
22856
- if (containerHeight)
22857
- return;
22858
- const size = horizontal ? getElement().offsetWidth : getElement().offsetHeight;
22859
- setOffSetSize(size);
22860
- }, [getElement, horizontal, containerHeight]);
22861
- useEffect(() => {
22862
- if (offSetSize === 0)
22863
- return;
22864
- const count = Math.ceil(offSetSize / itemHeight) + overscan;
22865
- setVisibleCount(count);
22866
- setOptions((options22) => {
22867
- return { ...options22, endIndex: count };
22868
- });
22869
- }, [getElement, horizontal, itemHeight, overscan, offSetSize]);
22870
- const updateTotalSize = useCallback(() => {
22871
- if (!itemsRef.current)
22872
- return;
22873
- const items = itemsRef.current.children;
22874
- if (!items.length)
22875
- return;
22876
- updateItemSize(positions, items, sizeKey);
22877
- const totalSize = getListTotalSize(positions, horizontal);
22878
- setListTotalSize(totalSize);
22879
- }, [positions, sizeKey, horizontal]);
22880
- const scroll = useCallback(() => {
22881
- requestAnimationFrame((e) => {
22882
- const scrollSize = getElement()[scrollKey];
22883
- const startIndex = binarySearch(positions, scrollSize, horizontal);
22884
- const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
22885
- if (!itemEqual) {
22886
- updateTotalSize();
22887
- }
22888
- const endIndex = getEndIndex({
22889
- list,
22890
- startIndex,
22891
- visibleCount,
22892
- itemEqual,
22893
- positions,
22894
- offSetSize,
22895
- sizeKey,
22896
- overscan
22897
- });
22898
- const startOffset = positions[startIndex][offsetKey];
22899
- setOptions({ startOffset, startIndex, overStart, endIndex });
22900
- if (endIndex > list.length - 1) {
22901
- if (onScroll) {
22902
- onScroll();
22903
- }
22904
- }
22905
- });
22906
- }, [
22907
- positions,
22908
- getElement,
22909
- list,
22910
- visibleCount,
22911
- itemEqual,
22912
- updateTotalSize,
22913
- offsetKey,
22914
- sizeKey,
22915
- scrollKey,
22916
- horizontal,
22917
- overscan,
22918
- offSetSize
22919
- ]);
22920
- useEffect(() => {
22921
- const element = getElement();
22922
- element.addEventListener("scroll", scroll, false);
22923
- return () => {
22924
- element.removeEventListener("scroll", scroll, false);
22925
- };
22926
- }, [getElement, scroll]);
22927
- return /* @__PURE__ */ React__default.createElement(
22928
- "div",
22929
- {
22930
- className: className ? `${className} nut-virtualList-box` : "nut-virtualList-box",
22931
- ...rest,
22932
- style: {
22933
- [sizeKey]: containerHeight ? `${offSetSize}px` : ""
22934
- }
22935
- },
22936
- /* @__PURE__ */ React__default.createElement(
22937
- "div",
22938
- {
22939
- ref: scrollRef,
22940
- className: horizontal ? "nut-horizontal-box" : "nut-vertical-box",
22941
- style: {
22942
- position: "relative",
22943
- [sizeKey]: `${listTotalSize}px`
22944
- }
22945
- },
22946
- /* @__PURE__ */ React__default.createElement(
22947
- "ul",
22948
- {
22949
- className: horizontal ? "nut-virtuallist-items nut-horizontal-items" : "nut-virtuallist-items nut-vertical-items",
22950
- ref: itemsRef,
22951
- style: {
22952
- transform: horizontal ? `translate3d(${options2.startOffset}px,0,0)` : `translate3d(0,${options2.startOffset}px,0)`
22953
- }
22954
- },
22955
- list.slice(options2.overStart, options2.endIndex).map((data, index) => {
22956
- const { startIndex, overStart } = options2;
22957
- const dataIndex = overStart + index;
22958
- const styleVal = dataIndex < startIndex ? "none" : "block";
22959
- const keyVal = key && data[key] ? data[key] : dataIndex;
22960
- return /* @__PURE__ */ React__default.createElement(
22961
- "li",
22962
- {
22963
- ref: dataIndex === 0 ? firstItemRef : null,
22964
- "data-index": `${dataIndex}`,
22965
- className: dataIndex % 2 === 0 ? "nut-virtuallist-item even" : "nut-virtuallist-item odd",
22966
- key: `${keyVal}`,
22967
- style: { display: styleVal }
22968
- },
22969
- ItemRender ? /* @__PURE__ */ React__default.createElement(ItemRender, { data, index: `${dataIndex}` }) : data
22970
- );
22971
- })
22972
- )
22973
- )
22974
- );
22975
- };
22976
- VirtualList.defaultProps = defaultProps$c;
22977
- VirtualList.displayName = "NutVirtualList";
22978
- const defaultProps$b = {
22979
- ...ComponentDefaults,
22980
- defaultValue: 1,
22981
- mode: "multi",
22982
- prev: null,
22983
- next: null,
22984
- total: 50,
22985
- pageSize: 10,
22986
- itemSize: 5,
22987
- ellipse: false
22988
- };
22989
- const Pagination = (props) => {
22990
- const { locale } = useConfig();
22991
- const {
22992
- value,
22993
- mode,
22994
- prev,
22995
- next,
22996
- total,
22997
- pageSize,
22998
- itemSize,
22999
- onChange,
23000
- ellipse,
23001
- itemRender,
23002
- defaultValue,
23003
- className,
23004
- ...rest
23005
- } = {
23006
- ...defaultProps$b,
23007
- ...props
23008
- };
23009
- const classPrefix2 = "nut-pagination";
23010
- const [currentPage, setCurrentPage] = usePropsValue({
23011
- value,
23012
- defaultValue,
23013
- finalValue: 1,
23014
- onChange
22800
+ const classPrefix2 = "nut-pagination";
22801
+ const [currentPage, setCurrentPage] = usePropsValue({
22802
+ value,
22803
+ defaultValue,
22804
+ finalValue: 1,
22805
+ onChange
23015
22806
  });
23016
22807
  const pageCount = useMemo(() => {
23017
22808
  const num = Math.ceil(total / pageSize);
@@ -23085,9 +22876,9 @@ const Pagination = (props) => {
23085
22876
  next || locale.pagination.next
23086
22877
  ));
23087
22878
  };
23088
- Pagination.defaultProps = defaultProps$b;
22879
+ Pagination.defaultProps = defaultProps$c;
23089
22880
  Pagination.displayName = "NutPagination";
23090
- const defaultProps$a = {
22881
+ const defaultProps$b = {
23091
22882
  ...ComponentDefaults,
23092
22883
  price: 0,
23093
22884
  symbol: "&yen;",
@@ -23110,7 +22901,7 @@ const Price = (props) => {
23110
22901
  style,
23111
22902
  ...rest
23112
22903
  } = {
23113
- ...defaultProps$a,
22904
+ ...defaultProps$b,
23114
22905
  ...props
23115
22906
  };
23116
22907
  const classPrefix2 = "nut-price";
@@ -23190,10 +22981,10 @@ const Price = (props) => {
23190
22981
  symbol && position === "after" ? renderSymbol() : null
23191
22982
  );
23192
22983
  };
23193
- Price.defaultProps = defaultProps$a;
22984
+ Price.defaultProps = defaultProps$b;
23194
22985
  Price.displayName = "NutPrice";
23195
22986
  const DataContext = createContext({});
23196
- const defaultProps$9 = {
22987
+ const defaultProps$a = {
23197
22988
  ...ComponentDefaults,
23198
22989
  title: "",
23199
22990
  description: "",
@@ -23202,7 +22993,7 @@ const defaultProps$9 = {
23202
22993
  };
23203
22994
  const Step = (props) => {
23204
22995
  const { children, title, description, value, icon, className, ...restProps } = {
23205
- ...defaultProps$9,
22996
+ ...defaultProps$a,
23206
22997
  ...props
23207
22998
  };
23208
22999
  const parent = useContext(DataContext);
@@ -23236,16 +23027,16 @@ const Step = (props) => {
23236
23027
  };
23237
23028
  return /* @__PURE__ */ React__default.createElement("div", { className: classes, ...restProps, onClick: handleClickStep }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-step-head" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-step-line" }), /* @__PURE__ */ React__default.createElement("div", { className: renderIconClass() }, icon || !dot && /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-inner" }, value))), /* @__PURE__ */ React__default.createElement("div", { className: "nut-step-main" }, /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-title" }, title), description && /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-description" }, description)));
23238
23029
  };
23239
- Step.defaultProps = defaultProps$9;
23030
+ Step.defaultProps = defaultProps$a;
23240
23031
  Step.displayName = "NutStep";
23241
- const defaultProps$8 = {
23032
+ const defaultProps$9 = {
23242
23033
  ...ComponentDefaults,
23243
23034
  value: 0,
23244
23035
  direction: "horizontal",
23245
23036
  dot: false
23246
23037
  };
23247
23038
  const Steps = (props) => {
23248
- const propSteps = { ...defaultProps$8, ...props };
23039
+ const propSteps = { ...defaultProps$9, ...props };
23249
23040
  const {
23250
23041
  children,
23251
23042
  value,
@@ -23276,9 +23067,9 @@ const Steps = (props) => {
23276
23067
  children
23277
23068
  ));
23278
23069
  };
23279
- Steps.defaultProps = defaultProps$8;
23070
+ Steps.defaultProps = defaultProps$9;
23280
23071
  Steps.displayName = "NutSteps";
23281
- const defaultProps$7 = {
23072
+ const defaultProps$8 = {
23282
23073
  ...ComponentDefaults,
23283
23074
  columns: [],
23284
23075
  data: [],
@@ -23290,7 +23081,7 @@ const defaultProps$7 = {
23290
23081
  };
23291
23082
  const Table = (props) => {
23292
23083
  const { locale } = useConfig();
23293
- defaultProps$7.noData = locale.noData;
23084
+ defaultProps$8.noData = locale.noData;
23294
23085
  const {
23295
23086
  children,
23296
23087
  className,
@@ -23306,7 +23097,7 @@ const Table = (props) => {
23306
23097
  onSort,
23307
23098
  ...rest
23308
23099
  } = {
23309
- ...defaultProps$7,
23100
+ ...defaultProps$8,
23310
23101
  ...props
23311
23102
  };
23312
23103
  const [curData, setCurData] = useState(data);
@@ -23389,9 +23180,9 @@ const Table = (props) => {
23389
23180
  /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__main__body` }, renderBoyTrs())
23390
23181
  ), (summary || curData.length === 0) && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__summary` }, summary || noData));
23391
23182
  };
23392
- Table.defaultProps = defaultProps$7;
23183
+ Table.defaultProps = defaultProps$8;
23393
23184
  Table.displayName = "NutTable";
23394
- const defaultProps$6 = {
23185
+ const defaultProps$7 = {
23395
23186
  ...ComponentDefaults,
23396
23187
  type: "default",
23397
23188
  background: "",
@@ -23422,7 +23213,7 @@ const Tag = (props) => {
23422
23213
  onClick,
23423
23214
  onClose
23424
23215
  } = {
23425
- ...defaultProps$6,
23216
+ ...defaultProps$7,
23426
23217
  ...props
23427
23218
  };
23428
23219
  const [tagClass, setTagClass] = useState("");
@@ -23498,8 +23289,305 @@ const Tag = (props) => {
23498
23289
  children && /* @__PURE__ */ React__default.createElement("span", { className: `${classPrefix2}-text` }, children)
23499
23290
  ));
23500
23291
  };
23501
- Tag.defaultProps = defaultProps$6;
23292
+ Tag.defaultProps = defaultProps$7;
23502
23293
  Tag.displayName = "NutTag";
23294
+ const initPositinoCache = (reaItemSize, length = 0) => {
23295
+ let index = 0;
23296
+ const positions = Array(length);
23297
+ while (index < length) {
23298
+ positions[index] = {
23299
+ index,
23300
+ height: reaItemSize,
23301
+ width: reaItemSize,
23302
+ top: index * reaItemSize,
23303
+ bottom: (index + 1) * reaItemSize,
23304
+ left: index * reaItemSize,
23305
+ right: (index + 1) * reaItemSize
23306
+ };
23307
+ index++;
23308
+ }
23309
+ return positions;
23310
+ };
23311
+ const getListTotalSize = (positions, horizontal) => {
23312
+ const index = positions.length - 1;
23313
+ let size = 0;
23314
+ if (index < 0) {
23315
+ size = 0;
23316
+ } else {
23317
+ size = horizontal ? positions[index].right : positions[index].bottom;
23318
+ }
23319
+ return size;
23320
+ };
23321
+ const binarySearch = (positionsList, value = 0, horizontal) => {
23322
+ let start2 = 0;
23323
+ let end = positionsList.length - 1;
23324
+ let tempIndex = null;
23325
+ const key = horizontal ? "right" : "bottom";
23326
+ while (start2 <= end) {
23327
+ const midIndex = Math.floor((start2 + end) / 2);
23328
+ const midValue = positionsList[midIndex][key];
23329
+ if (midValue === value) {
23330
+ return midIndex + 1;
23331
+ }
23332
+ if (midValue < value) {
23333
+ start2 = midIndex + 1;
23334
+ } else if (midValue > value) {
23335
+ if (tempIndex === null || tempIndex > midIndex) {
23336
+ tempIndex = midIndex;
23337
+ }
23338
+ end = midIndex - 1;
23339
+ }
23340
+ }
23341
+ tempIndex = tempIndex || 0;
23342
+ return tempIndex;
23343
+ };
23344
+ const getEndIndex = ({
23345
+ list,
23346
+ startIndex,
23347
+ visibleCount,
23348
+ itemEqual = true,
23349
+ positions,
23350
+ offSetSize,
23351
+ overscan,
23352
+ sizeKey = "width"
23353
+ }) => {
23354
+ const dataLength = list.length;
23355
+ let tempIndex = null;
23356
+ if (itemEqual) {
23357
+ const endIndex = startIndex + visibleCount;
23358
+ tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
23359
+ } else {
23360
+ let sizeNum = 0;
23361
+ for (let i = startIndex; i < dataLength; i++) {
23362
+ sizeNum += positions[i][sizeKey] || 0;
23363
+ if (sizeNum > offSetSize) {
23364
+ const endIndex = i + overscan;
23365
+ tempIndex = dataLength > 0 ? Math.min(dataLength, endIndex) : endIndex;
23366
+ break;
23367
+ }
23368
+ }
23369
+ if (sizeNum < offSetSize) {
23370
+ tempIndex = dataLength;
23371
+ }
23372
+ }
23373
+ tempIndex = tempIndex || 0;
23374
+ return tempIndex;
23375
+ };
23376
+ const updateItemSize = (positions, items, sizeKey) => {
23377
+ const newPos = positions.concat();
23378
+ Array.from(items).forEach((item) => {
23379
+ const index = Number(item.getAttribute("data-index"));
23380
+ const styleVal = item.getAttribute("style");
23381
+ if (styleVal && styleVal.includes("none"))
23382
+ return;
23383
+ const nowSize = item.getBoundingClientRect()[sizeKey];
23384
+ const oldSize = positions[index][sizeKey];
23385
+ const dValue = oldSize - nowSize;
23386
+ if (dValue) {
23387
+ if (sizeKey === "width") {
23388
+ newPos[index].right -= dValue;
23389
+ newPos[index][sizeKey] = nowSize;
23390
+ for (let k2 = index + 1; k2 < positions.length; k2++) {
23391
+ newPos[k2].left = positions[k2 - 1].right;
23392
+ newPos[k2].right -= dValue;
23393
+ }
23394
+ } else if (sizeKey === "height") {
23395
+ newPos[index].bottom -= dValue;
23396
+ newPos[index][sizeKey] = nowSize;
23397
+ for (let k2 = index + 1; k2 < positions.length; k2++) {
23398
+ newPos[k2].top = positions[k2 - 1].bottom;
23399
+ newPos[k2].bottom -= dValue;
23400
+ }
23401
+ }
23402
+ }
23403
+ });
23404
+ };
23405
+ const defaultProps$6 = {
23406
+ ...ComponentDefaults,
23407
+ list: [],
23408
+ itemHeight: 66,
23409
+ itemEqual: true,
23410
+ direction: "vertical",
23411
+ overscan: 2
23412
+ };
23413
+ const VirtualList = (props) => {
23414
+ const {
23415
+ list,
23416
+ itemRender,
23417
+ itemEqual,
23418
+ itemHeight,
23419
+ direction,
23420
+ overscan,
23421
+ key,
23422
+ onScroll,
23423
+ className,
23424
+ containerHeight,
23425
+ ...rest
23426
+ } = {
23427
+ ...defaultProps$6,
23428
+ ...props
23429
+ };
23430
+ const horizontal = direction === "horizontal";
23431
+ const sizeKey = horizontal ? "width" : "height";
23432
+ const scrollKey = horizontal ? "scrollLeft" : "scrollTop";
23433
+ const offsetKey = horizontal ? "left" : "top";
23434
+ const scrollRef = useRef(null);
23435
+ const itemsRef = useRef(null);
23436
+ const [positions, setPositions] = useState([
23437
+ {
23438
+ index: 0,
23439
+ left: 0,
23440
+ top: 0,
23441
+ bottom: 0,
23442
+ width: 0,
23443
+ height: 0,
23444
+ right: 0
23445
+ }
23446
+ ]);
23447
+ const [listTotalSize, setListTotalSize] = useState(99999999);
23448
+ const [visibleCount, setVisibleCount] = useState(0);
23449
+ const [offSetSize, setOffSetSize] = useState(containerHeight || 0);
23450
+ const [options2, setOptions] = useState({
23451
+ startOffset: 0,
23452
+ // 可视区域距离顶部的偏移量
23453
+ startIndex: 0,
23454
+ // 可视区域开始索引
23455
+ overStart: 0,
23456
+ endIndex: 10
23457
+ // 可视区域结束索引
23458
+ });
23459
+ useEffect(() => {
23460
+ const pos = initPositinoCache(itemHeight, list.length);
23461
+ setPositions(pos);
23462
+ const totalSize = getListTotalSize(pos, horizontal);
23463
+ setListTotalSize(totalSize);
23464
+ }, [list, itemHeight, horizontal]);
23465
+ const getElement = useCallback(() => {
23466
+ var _a2;
23467
+ return ((_a2 = scrollRef.current) == null ? void 0 : _a2.parentElement) || document.body;
23468
+ }, []);
23469
+ useEffect(() => {
23470
+ if (containerHeight)
23471
+ return;
23472
+ const size = horizontal ? getElement().offsetWidth : getElement().offsetHeight;
23473
+ setOffSetSize(size);
23474
+ }, [getElement, horizontal, containerHeight]);
23475
+ useEffect(() => {
23476
+ if (offSetSize === 0)
23477
+ return;
23478
+ const count = Math.ceil(offSetSize / itemHeight) + overscan;
23479
+ setVisibleCount(count);
23480
+ setOptions((options22) => {
23481
+ return { ...options22, endIndex: count };
23482
+ });
23483
+ }, [getElement, horizontal, itemHeight, overscan, offSetSize]);
23484
+ const updateTotalSize = useCallback(() => {
23485
+ if (!itemsRef.current)
23486
+ return;
23487
+ const items = itemsRef.current.children;
23488
+ if (!items.length)
23489
+ return;
23490
+ updateItemSize(positions, items, sizeKey);
23491
+ const totalSize = getListTotalSize(positions, horizontal);
23492
+ setListTotalSize(totalSize);
23493
+ }, [positions, sizeKey, horizontal]);
23494
+ const scroll = useCallback(() => {
23495
+ requestAnimationFrame((e) => {
23496
+ const scrollSize = getElement()[scrollKey];
23497
+ const startIndex = binarySearch(positions, scrollSize, horizontal);
23498
+ const overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
23499
+ if (!itemEqual) {
23500
+ updateTotalSize();
23501
+ }
23502
+ const endIndex = getEndIndex({
23503
+ list,
23504
+ startIndex,
23505
+ visibleCount,
23506
+ itemEqual,
23507
+ positions,
23508
+ offSetSize,
23509
+ sizeKey,
23510
+ overscan
23511
+ });
23512
+ const startOffset = positions[startIndex][offsetKey];
23513
+ setOptions({ startOffset, startIndex, overStart, endIndex });
23514
+ if (endIndex > list.length - 1) {
23515
+ if (onScroll) {
23516
+ onScroll();
23517
+ }
23518
+ }
23519
+ });
23520
+ }, [
23521
+ positions,
23522
+ getElement,
23523
+ list,
23524
+ visibleCount,
23525
+ itemEqual,
23526
+ updateTotalSize,
23527
+ offsetKey,
23528
+ sizeKey,
23529
+ scrollKey,
23530
+ horizontal,
23531
+ overscan,
23532
+ offSetSize
23533
+ ]);
23534
+ useEffect(() => {
23535
+ const element = getElement();
23536
+ element.addEventListener("scroll", scroll, false);
23537
+ return () => {
23538
+ element.removeEventListener("scroll", scroll, false);
23539
+ };
23540
+ }, [getElement, scroll]);
23541
+ return /* @__PURE__ */ React__default.createElement(
23542
+ "div",
23543
+ {
23544
+ className: className ? `${className} nut-virtualList-box` : "nut-virtualList-box",
23545
+ ...rest,
23546
+ style: {
23547
+ [sizeKey]: containerHeight ? `${offSetSize}px` : ""
23548
+ }
23549
+ },
23550
+ /* @__PURE__ */ React__default.createElement(
23551
+ "div",
23552
+ {
23553
+ ref: scrollRef,
23554
+ className: horizontal ? "nut-horizontal-box" : "nut-vertical-box",
23555
+ style: {
23556
+ position: "relative",
23557
+ [sizeKey]: `${listTotalSize}px`
23558
+ }
23559
+ },
23560
+ /* @__PURE__ */ React__default.createElement(
23561
+ "ul",
23562
+ {
23563
+ className: horizontal ? "nut-virtuallist-items nut-horizontal-items" : "nut-virtuallist-items nut-vertical-items",
23564
+ ref: itemsRef,
23565
+ style: {
23566
+ transform: horizontal ? `translate3d(${options2.startOffset}px,0,0)` : `translate3d(0,${options2.startOffset}px,0)`
23567
+ }
23568
+ },
23569
+ list.slice(options2.overStart, options2.endIndex).map((data, index) => {
23570
+ const { startIndex, overStart } = options2;
23571
+ const dataIndex = overStart + index;
23572
+ const styleVal = dataIndex < startIndex ? "none" : "block";
23573
+ const keyVal = key && data[key] ? data[key] : dataIndex;
23574
+ return /* @__PURE__ */ React__default.createElement(
23575
+ "li",
23576
+ {
23577
+ "data-index": `${dataIndex}`,
23578
+ className: dataIndex % 2 === 0 ? "nut-virtuallist-item even" : "nut-virtuallist-item odd",
23579
+ key: `${keyVal}`,
23580
+ style: { display: styleVal }
23581
+ },
23582
+ itemRender ? itemRender(data, dataIndex, index) : data
23583
+ );
23584
+ })
23585
+ )
23586
+ )
23587
+ );
23588
+ };
23589
+ VirtualList.defaultProps = defaultProps$6;
23590
+ VirtualList.displayName = "NutVirtualList";
23503
23591
  const defaultProps$5 = {
23504
23592
  ...ComponentDefaults,
23505
23593
  list: [],
@@ -23833,13 +23921,13 @@ const defaultProps$1 = {
23833
23921
  digits: 2,
23834
23922
  symbol: false,
23835
23923
  zero: false,
23836
- arrowLeft: false,
23837
- syncColor: true,
23924
+ left: false,
23925
+ sync: true,
23838
23926
  color: "#333",
23839
23927
  riseColor: "#fa2c19",
23840
23928
  dropColor: "#64b578",
23841
23929
  riseIcon: null,
23842
- downIcon: null
23930
+ dropIcon: null
23843
23931
  };
23844
23932
  const TrendArrow = (props) => {
23845
23933
  const {
@@ -23847,13 +23935,13 @@ const TrendArrow = (props) => {
23847
23935
  digits,
23848
23936
  symbol,
23849
23937
  zero,
23850
- arrowLeft,
23851
- syncColor,
23938
+ left,
23939
+ sync: sync2,
23852
23940
  color,
23853
23941
  riseColor,
23854
23942
  dropColor,
23855
23943
  riseIcon,
23856
- downIcon,
23944
+ dropIcon,
23857
23945
  className,
23858
23946
  style,
23859
23947
  children,
@@ -23871,7 +23959,7 @@ const TrendArrow = (props) => {
23871
23959
  };
23872
23960
  const calcStyle = (() => {
23873
23961
  const arrowColor = rateTrend.current ? riseColor : dropColor;
23874
- const textEquArrowColor = syncColor ? arrowColor : color;
23962
+ const textEquArrowColor = sync2 ? arrowColor : color;
23875
23963
  const style2 = {
23876
23964
  color: value === 0 ? color : textEquArrowColor
23877
23965
  };
@@ -23893,8 +23981,8 @@ const TrendArrow = (props) => {
23893
23981
  };
23894
23982
  return iconProps;
23895
23983
  })();
23896
- const renderContent = (arrowLeft2) => {
23897
- const classNameSuffix = !arrowLeft2 ? "icon-after" : "icon-before";
23984
+ const renderContent = (left2) => {
23985
+ const classNameSuffix = !left2 ? "icon-after" : "icon-before";
23898
23986
  return /* @__PURE__ */ React__default.createElement(
23899
23987
  "span",
23900
23988
  {
@@ -23904,7 +23992,7 @@ const TrendArrow = (props) => {
23904
23992
  calcRate
23905
23993
  );
23906
23994
  };
23907
- return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className}`, style, ...rest }, !arrowLeft && renderContent(!arrowLeft), Number(value) !== 0 && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, rateTrend.current ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, riseIcon || /* @__PURE__ */ React__default.createElement(y, { color: calcIconProps.color })) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, downIcon || /* @__PURE__ */ React__default.createElement(y$1, { color: calcIconProps.color }))), arrowLeft && renderContent(!arrowLeft));
23995
+ return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className}`, style, ...rest }, !left && renderContent(!left), Number(value) !== 0 && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, rateTrend.current ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, riseIcon || /* @__PURE__ */ React__default.createElement(y, { color: calcIconProps.color })) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, dropIcon || /* @__PURE__ */ React__default.createElement(y$1, { color: calcIconProps.color }))), left && renderContent(!left));
23908
23996
  };
23909
23997
  TrendArrow.defaultProps = defaultProps$1;
23910
23998
  TrendArrow.displayName = "NutTrendArrow";