@nutui/nutui-react-taro 1.4.7 → 1.4.8

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 (98) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/esm/Badge.js +2 -2
  3. package/dist/esm/Barrage.js +2 -2
  4. package/dist/esm/Calendar.js +3 -4
  5. package/dist/esm/CalendarItem.js +2 -3
  6. package/dist/esm/Cascader.js +4 -4
  7. package/dist/esm/Checkbox.js +2 -2
  8. package/dist/esm/CheckboxGroup.js +2 -2
  9. package/dist/esm/Col.js +3 -2
  10. package/dist/esm/Dialog.js +3 -2
  11. package/dist/esm/Ellipsis.js +2 -2
  12. package/dist/esm/InputNumber.js +2 -2
  13. package/dist/esm/Popover.js +2 -2
  14. package/dist/esm/Row.js +3 -2
  15. package/dist/esm/ShortPassword.js +2 -2
  16. package/dist/esm/Swipe.js +3 -2
  17. package/dist/esm/TabPane.js +2 -2
  18. package/dist/esm/Tabbar.js +2 -2
  19. package/dist/esm/Tabs.js +2 -2
  20. package/dist/esm/TextArea.js +2 -2
  21. package/dist/esm/Uploader.js +2 -2
  22. package/dist/esm/{badge.taro-11e2ec95.js → badge.taro-116b2521.js} +1 -0
  23. package/dist/esm/barrage.taro-5dbab093.js +94 -0
  24. package/dist/esm/calendar.taro-c95e6998.js +61 -0
  25. package/dist/esm/calendaritem.taro-86412398.js +761 -0
  26. package/dist/esm/{cascader.taro-e6610dd1.js → cascader.taro-e0fb7e63.js} +16 -22
  27. package/dist/esm/{checkbox.taro-04da7151.js → checkbox.taro-b76b1c82.js} +9 -6
  28. package/dist/esm/{col.taro-b61c7cba.js → col.taro-9e4c5cc0.js} +2 -1
  29. package/dist/esm/{dialog.taro-54df2e3f.js → dialog.taro-7608bd26.js} +7 -12
  30. package/dist/esm/{ellipsis.taro-aa39faf7.js → ellipsis.taro-5aa23940.js} +4 -3
  31. package/dist/esm/{inputnumber.taro-e909d932.js → inputnumber.taro-94c75663.js} +11 -21
  32. package/dist/esm/nutui-react.es.js +19 -19
  33. package/dist/esm/{popover.taro-fc7b9a73.js → popover.taro-f144cd02.js} +9 -7
  34. package/dist/esm/{row.taro-37a895de.js → row.taro-4e697aa2.js} +2 -1
  35. package/dist/esm/{shortpassword.taro-02ea4499.js → shortpassword.taro-53b7ee7b.js} +3 -2
  36. package/dist/esm/{swipe.taro-1eb95b21.js → swipe.taro-6532405d.js} +16 -24
  37. package/dist/esm/{tabbar.taro-08e48c43.js → tabbar.taro-17d898d9.js} +12 -7
  38. package/dist/esm/{tabpane.taro-91cd6cf4.js → tabpane.taro-9512e308.js} +3 -3
  39. package/dist/esm/{tabs.taro-5030ce68.js → tabs.taro-4629d66c.js} +5 -2
  40. package/dist/esm/{textarea.taro-42600f8c.js → textarea.taro-47addd05.js} +5 -1
  41. package/dist/esm/types/src/packages/calendar/calendar.taro.d.ts +22 -2
  42. package/dist/esm/types/src/packages/calendaritem/calendaritem.taro.d.ts +21 -3
  43. package/dist/esm/types/src/packages/cascader/cascader.d.ts +1 -0
  44. package/dist/esm/types/src/packages/cascader/cascader.taro.d.ts +1 -0
  45. package/dist/esm/types/src/packages/cascader/cascaderItem.d.ts +1 -0
  46. package/dist/esm/types/src/packages/cascader/cascaderItem.taro.d.ts +1 -0
  47. package/dist/esm/types/src/packages/checkbox/demo.d.ts +0 -1
  48. package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.d.ts +5 -0
  49. package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.taro.d.ts +5 -0
  50. package/dist/esm/types/src/packages/dialog/DialogWrap.d.ts +1 -1
  51. package/dist/esm/types/src/packages/dialog/DialogWrapper.taro.d.ts +11 -0
  52. package/dist/esm/types/src/packages/dialog/dialog.taro.d.ts +3 -2
  53. package/dist/esm/types/src/packages/dialog/index.taro.d.ts +2 -2
  54. package/dist/esm/types/src/packages/form/form.d.ts +3 -0
  55. package/dist/esm/types/src/packages/formitem/formitem.d.ts +2 -1
  56. package/dist/esm/types/src/packages/formitem/types.d.ts +1 -1
  57. package/dist/esm/types/src/packages/popover/popover.taro.d.ts +1 -1
  58. package/dist/esm/types/src/packages/shortpassword/shortpassword.d.ts +1 -0
  59. package/dist/esm/types/src/packages/shortpassword/shortpassword.taro.d.ts +1 -0
  60. package/dist/esm/types/src/packages/switch/switch.d.ts +2 -1
  61. package/dist/esm/types/src/packages/tabbar/tabbar.d.ts +1 -1
  62. package/dist/esm/types/src/packages/tabbar/tabbar.taro.d.ts +1 -1
  63. package/dist/esm/types/src/packages/tabbar/use-props-value.d.ts +7 -0
  64. package/dist/esm/types/src/packages/tabpane/tabpane.taro.d.ts +0 -1
  65. package/dist/esm/types/src/packages/tabs/tabs.d.ts +1 -0
  66. package/dist/esm/types/src/packages/tabs/tabs.taro.d.ts +1 -0
  67. package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +1 -0
  68. package/dist/esm/{uploader.taro-b7b770e6.js → uploader.taro-c830b573.js} +3 -2
  69. package/dist/locales/base.js +1 -1
  70. package/dist/locales/en-US.js +1 -1
  71. package/dist/locales/id-ID.js +1 -1
  72. package/dist/locales/zh-CN.js +1 -1
  73. package/dist/locales/zh-TW.js +1 -1
  74. package/dist/locales/zh-UG.js +1 -1
  75. package/dist/nutui.react.es.js +690 -412
  76. package/dist/nutui.react.umd.js +689 -411
  77. package/dist/packages/badge/badge.scss +11 -5
  78. package/dist/packages/barrage/barrage.scss +3 -3
  79. package/dist/packages/button/button.scss +1 -0
  80. package/dist/packages/cascader/cascader.scss +19 -5
  81. package/dist/packages/checkboxgroup/checkboxgroup.scss +33 -0
  82. package/dist/packages/collapseitem/collapseitem.scss +41 -17
  83. package/dist/packages/form/form.scss +3 -0
  84. package/dist/packages/inputnumber/inputnumber.scss +18 -1
  85. package/dist/packages/popover/popover.scss +71 -46
  86. package/dist/packages/radiogroup/radiogroup.scss +9 -8
  87. package/dist/packages/step/step.scss +135 -98
  88. package/dist/packages/switch/switch.scss +1 -1
  89. package/dist/packages/tabs/tabs.scss +24 -2
  90. package/dist/packages/textarea/textarea.scss +7 -1
  91. package/dist/style.css +1 -1
  92. package/dist/style.es.js +1 -1
  93. package/dist/styles/variables.scss +155 -33
  94. package/dist/types/index.d.ts +57 -33
  95. package/package.json +1 -1
  96. package/dist/esm/barrage.taro-e4fe81ae.js +0 -73
  97. package/dist/esm/calendar.taro-02479e8b.js +0 -38
  98. package/dist/esm/calendaritem.taro-3cfd4186.js +0 -571
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v1.4.7 Wed Feb 15 2023 16:34:56 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v1.4.8 Wed Feb 22 2023 17:16:25 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1772,7 +1772,7 @@
1772
1772
  setColStyle(getStyle);
1773
1773
  }, [span, offset, gutter]);
1774
1774
  return /* @__PURE__ */ React__default["default"].createElement("div", {
1775
- className: `${colName} ${className}`,
1775
+ className: classNames(colName, className),
1776
1776
  style: { ...style, ...colStyle },
1777
1777
  onClick: (e2) => {
1778
1778
  onClick && onClick(e2, "col");
@@ -2067,7 +2067,7 @@
2067
2067
  }, React__default["default"].createElement(
2068
2068
  "div",
2069
2069
  {
2070
- className: `${getClasses()} ${className}`,
2070
+ className: classNames(getClasses(), className),
2071
2071
  style,
2072
2072
  onClick: (e2) => {
2073
2073
  onClick && onClick(e2, "row");
@@ -3272,15 +3272,14 @@
3272
3272
  safeAreaInsetBottom: false,
3273
3273
  className: "",
3274
3274
  style: {},
3275
- tabSwitch: () => {
3276
- },
3277
- onSwitch: () => {
3275
+ onSwitch: (child, activeVisible) => {
3278
3276
  }
3279
3277
  };
3280
3278
  const Tabbar = (props) => {
3281
3279
  const {
3282
3280
  children,
3283
3281
  visible,
3282
+ activeVisible,
3284
3283
  bottom,
3285
3284
  size,
3286
3285
  activeColor,
@@ -3288,17 +3287,23 @@
3288
3287
  safeAreaInsetBottom,
3289
3288
  className,
3290
3289
  style,
3291
- tabSwitch,
3292
3290
  onSwitch
3293
3291
  } = {
3294
3292
  ...defaultProps$18,
3295
3293
  ...props
3296
3294
  };
3297
3295
  const b2 = cn("tabbar");
3298
- const [selectIndex, setSelectIndex] = React.useState(visible);
3296
+ const [selectIndex, setSelectIndex] = React.useState(activeVisible || visible);
3299
3297
  const handleClick = (idx) => {
3300
- setSelectIndex(idx);
3298
+ if (!("activeVisible" in props)) {
3299
+ setSelectIndex(idx);
3300
+ }
3301
3301
  };
3302
+ React.useEffect(() => {
3303
+ if (activeVisible !== void 0) {
3304
+ setSelectIndex(activeVisible);
3305
+ }
3306
+ }, [activeVisible]);
3302
3307
  return /* @__PURE__ */ React__default["default"].createElement("div", {
3303
3308
  className: [
3304
3309
  `${b2()}`,
@@ -3320,7 +3325,6 @@
3320
3325
  size,
3321
3326
  handleClick: () => {
3322
3327
  handleClick(idx);
3323
- tabSwitch(child, idx);
3324
3328
  onSwitch(child, idx);
3325
3329
  }
3326
3330
  };
@@ -3418,14 +3422,21 @@
3418
3422
  disabled: false
3419
3423
  };
3420
3424
  const TabPane = (props) => {
3421
- const { children, paneKey, activeKey, autoHeightClassName, className } = {
3425
+ const {
3426
+ children,
3427
+ paneKey,
3428
+ activeKey,
3429
+ autoHeightClassName,
3430
+ className,
3431
+ disabled
3432
+ } = {
3422
3433
  ...defaultProps$16,
3423
3434
  ...props
3424
3435
  };
3425
3436
  const b2 = cn("tabpane");
3426
3437
  const classes = classNames(
3427
3438
  {
3428
- active: paneKey === activeKey
3439
+ active: !disabled && paneKey === activeKey
3429
3440
  },
3430
3441
  b2(""),
3431
3442
  autoHeightClassName,
@@ -3433,7 +3444,7 @@
3433
3444
  );
3434
3445
  return /* @__PURE__ */ React__default["default"].createElement("div", {
3435
3446
  className: classes
3436
- }, children);
3447
+ }, !disabled && children);
3437
3448
  };
3438
3449
  class Title {
3439
3450
  constructor() {
@@ -3456,6 +3467,7 @@
3456
3467
  animatedTime: 300,
3457
3468
  titleGutter: 0,
3458
3469
  size: "normal",
3470
+ leftAlign: false,
3459
3471
  autoHeight: false
3460
3472
  };
3461
3473
  const pxCheck$2 = (value) => {
@@ -3474,6 +3486,7 @@
3474
3486
  animatedTime,
3475
3487
  titleGutter,
3476
3488
  size,
3489
+ leftAlign,
3477
3490
  titleNode,
3478
3491
  children,
3479
3492
  onClick,
@@ -3554,8 +3567,9 @@
3554
3567
  onClick: (e2) => tabChange(item),
3555
3568
  className: classNames(
3556
3569
  {
3557
- active: String(item.paneKey) === String(value),
3558
- disabled: item.disabled
3570
+ active: !item.disabled && String(item.paneKey) === String(value),
3571
+ disabled: item.disabled,
3572
+ "nut-tabs__titles-item-left-align": leftAlign
3559
3573
  },
3560
3574
  `${b2("")}__titles-item`
3561
3575
  ),
@@ -3705,14 +3719,25 @@
3705
3719
  defaultValue: "",
3706
3720
  startDate: Utils.getDay(0),
3707
3721
  endDate: Utils.getDay(365),
3722
+ showToday: true,
3723
+ startText: "\u5F00\u59CB",
3724
+ endText: "\u7ED3\u675F",
3725
+ confirmText: "\u786E\u8BA4",
3726
+ showTitle: true,
3727
+ showSubTitle: true,
3728
+ toDateAnimation: true,
3729
+ onBtn: void 0,
3730
+ onDay: void 0,
3731
+ onTopInfo: void 0,
3732
+ onBottomInfo: void 0,
3708
3733
  onChoose: (data) => {
3709
3734
  },
3710
3735
  onUpdate: () => {
3711
3736
  },
3712
- onClose: () => {
3737
+ onSelected: (data) => {
3713
3738
  }
3714
3739
  };
3715
- const CalendarItem = (props) => {
3740
+ const CalendarItem = React__default["default"].forwardRef((props, ref) => {
3716
3741
  const { locale } = useConfig$1();
3717
3742
  const {
3718
3743
  type,
@@ -3720,18 +3745,31 @@
3720
3745
  poppable,
3721
3746
  title,
3722
3747
  defaultValue,
3723
- startDate,
3724
- endDate,
3748
+ showToday,
3749
+ startText,
3750
+ endText,
3751
+ confirmText,
3752
+ showTitle,
3753
+ showSubTitle,
3754
+ toDateAnimation,
3755
+ onBtn,
3756
+ onDay,
3757
+ onTopInfo,
3758
+ onBottomInfo,
3725
3759
  onChoose,
3726
3760
  onUpdate,
3727
- onClose
3761
+ onSelected
3728
3762
  } = { ...defaultProps$14, ...props };
3729
3763
  const weeks = locale.calendaritem.weekdays;
3730
3764
  const [yearMonthTitle, setYearMonthTitle] = React.useState("");
3731
- const [unLoadPrev, setUnLoadPrev] = React.useState(false);
3732
3765
  const [monthsData, setMonthsData] = React.useState([]);
3766
+ const [translateY, setTranslateY] = React.useState(0);
3767
+ const [monthDefaultRange, setMonthDefaultRange] = React.useState([]);
3733
3768
  const [state] = React.useState({
3734
3769
  currDate: "",
3770
+ propStartDate: "",
3771
+ propEndDate: "",
3772
+ unLoadPrev: false,
3735
3773
  touchParams: {
3736
3774
  startY: 0,
3737
3775
  endY: 0,
@@ -3741,7 +3779,6 @@
3741
3779
  lastTime: 0
3742
3780
  },
3743
3781
  transformY: 0,
3744
- translateY: 0,
3745
3782
  scrollDistance: 0,
3746
3783
  defaultData: [],
3747
3784
  chooseData: [],
@@ -3749,12 +3786,17 @@
3749
3786
  dayPrefix: "calendar-month-day",
3750
3787
  startData: "",
3751
3788
  endData: "",
3752
- isRange: type === "range",
3753
- timer: 0
3789
+ isRange: props.type === "range",
3790
+ timer: 0,
3791
+ currentIndex: 0,
3792
+ avgHeight: 0,
3793
+ monthsNum: 0
3754
3794
  });
3755
3795
  const weeksPanel = React.useRef(null);
3756
3796
  const months = React.useRef(null);
3757
3797
  const monthsPanel = React.useRef(null);
3798
+ const viewArea = React.useRef(null);
3799
+ let viewHeight = 0;
3758
3800
  const b2 = cn("calendar");
3759
3801
  const classes = classNames(
3760
3802
  {
@@ -3780,23 +3822,29 @@
3780
3822
  const isEnd = (currDate) => {
3781
3823
  return Utils.isEqual(state.currDate[1], currDate);
3782
3824
  };
3783
- const getCurrDate = (day, month, isRange) => {
3784
- return isRange ? `${month.curData[3]}-${month.curData[4]}-${Utils.getNumTwoBit(
3785
- +day.day
3786
- )}` : `${month.curData[0]}-${month.curData[1]}-${Utils.getNumTwoBit(
3825
+ const isMultiple = (currDate) => {
3826
+ if (state.currDate.length > 0) {
3827
+ return state.currDate.some((item) => {
3828
+ return Utils.isEqual(item, currDate);
3829
+ });
3830
+ }
3831
+ return false;
3832
+ };
3833
+ const getCurrDate = (day, month) => {
3834
+ return `${month.curData[0]}-${month.curData[1]}-${Utils.getNumTwoBit(
3787
3835
  +day.day
3788
3836
  )}`;
3789
3837
  };
3790
- const getClass = (day, month, isRange) => {
3791
- const currDate = getCurrDate(day, month, isRange);
3838
+ const getClass = (day, month) => {
3839
+ const currDate = getCurrDate(day, month);
3792
3840
  if (day.type === "curr") {
3793
- if (!state.isRange && Utils.isEqual(state.currDate, currDate) || state.isRange && (isStart(currDate) || isEnd(currDate))) {
3841
+ if (Utils.isEqual(state.currDate, currDate) || type === "range" && (isStart(currDate) || isEnd(currDate)) || type === "multiple" && isMultiple(currDate)) {
3794
3842
  return `${state.dayPrefix}-active`;
3795
3843
  }
3796
- if (startDate && Utils.compareDate(currDate, startDate) || endDate && Utils.compareDate(endDate, currDate)) {
3844
+ if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
3797
3845
  return `${state.dayPrefix}-disabled`;
3798
3846
  }
3799
- if (state.isRange && Array.isArray(state.currDate) && Object.values(state.currDate).length === 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
3847
+ if (type === "range" && Array.isArray(state.currDate) && Object.values(state.currDate).length === 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
3800
3848
  return `${state.dayPrefix}-choose`;
3801
3849
  }
3802
3850
  return null;
@@ -3811,25 +3859,46 @@
3811
3859
  return Utils.isEqual(date, Utils.date2Str(new Date()));
3812
3860
  };
3813
3861
  const confirm = () => {
3814
- if (state.isRange && state.chooseData.length === 2 || !state.isRange) {
3815
- onChoose && onChoose(state.chooseData);
3862
+ const { type: type2 } = props;
3863
+ if (type2 === "range" && state.chooseData.length === 2 || type2 !== "range") {
3864
+ const chooseData = state.chooseData.slice(0);
3865
+ onChoose && onChoose(chooseData);
3816
3866
  if (poppable) {
3817
3867
  onUpdate && onUpdate();
3818
3868
  }
3819
3869
  }
3820
3870
  };
3821
- const chooseDay = (day, month, isFirst, isRange) => {
3822
- if (getClass(day, month, isRange) !== `${state.dayPrefix}-disabled`) {
3823
- let days = [...month.curData];
3824
- days = isRange ? days.splice(3) : days.splice(0, 3);
3871
+ const chooseDay = (day, month, isFirst) => {
3872
+ if (getClass(day, month) !== `${state.dayPrefix}-disabled`) {
3873
+ const { type: type2 } = props;
3874
+ const days = [...month.curData];
3825
3875
  days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
3826
3876
  days[3] = `${days[0]}-${days[1]}-${days[2]}`;
3827
3877
  days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
3828
- if (!state.isRange) {
3829
- state.currDate = days[3];
3830
- state.chooseData = [...days];
3831
- } else {
3832
- if (Object.values(state.currDate).length === 2) {
3878
+ if (type2 === "multiple") {
3879
+ if (state.currDate.length > 0) {
3880
+ let hasIndex = "";
3881
+ state.currDate.forEach((item, index) => {
3882
+ if (item === days[3]) {
3883
+ hasIndex = index;
3884
+ }
3885
+ });
3886
+ if (isFirst) {
3887
+ state.chooseData.push([...days]);
3888
+ } else if (hasIndex !== "") {
3889
+ state.currDate.splice(hasIndex, 1);
3890
+ state.chooseData.splice(hasIndex, 1);
3891
+ } else {
3892
+ state.currDate.push(days[3]);
3893
+ state.chooseData.push([...days]);
3894
+ }
3895
+ } else {
3896
+ state.currDate = [days[3]];
3897
+ state.chooseData = [[...days]];
3898
+ }
3899
+ } else if (type2 === "range") {
3900
+ const curDataLength = Object.values(state.currDate).length;
3901
+ if (curDataLength === 2 || curDataLength === 0) {
3833
3902
  state.currDate = [days[3]];
3834
3903
  } else if (Utils.compareDate(state.currDate[0], days[3])) {
3835
3904
  Array.isArray(state.currDate) && state.currDate.push(days[3]);
@@ -3837,30 +3906,39 @@
3837
3906
  Array.isArray(state.currDate) && state.currDate.unshift(days[3]);
3838
3907
  }
3839
3908
  if (state.chooseData.length === 2 || !state.chooseData.length) {
3840
- state.chooseData = [...days];
3841
- } else if (Utils.compareDate(state.chooseData[3], days[3])) {
3842
- state.chooseData = [[...state.chooseData], [...days]];
3909
+ state.chooseData = [[...days]];
3910
+ } else if (Utils.compareDate(state.chooseData[0][3], days[3])) {
3911
+ state.chooseData = [...state.chooseData, [...days]];
3843
3912
  } else {
3844
- state.chooseData = [[...days], [...state.chooseData]];
3913
+ state.chooseData = [[...days], ...state.chooseData];
3845
3914
  }
3915
+ } else {
3916
+ state.currDate = days[3];
3917
+ state.chooseData = [...days];
3846
3918
  }
3847
- if (isAutoBackFill && !isFirst) {
3848
- confirm();
3919
+ if (!isFirst) {
3920
+ onSelected && onSelected(state.chooseData);
3921
+ if (isAutoBackFill || !poppable) {
3922
+ confirm();
3923
+ }
3849
3924
  }
3850
3925
  setMonthsData(state.monthsData.slice());
3851
3926
  }
3852
3927
  };
3853
3928
  const isStartTip = (day, month) => {
3854
- if (isActive(day, month)) {
3855
- return isStart(getCurrDate(day, month));
3929
+ return isActive(day, month) && isStart(getCurrDate(day, month));
3930
+ };
3931
+ const isEndTip = (day, month) => {
3932
+ if (state.currDate.length >= 2 && isEnd(getCurrDate(day, month))) {
3933
+ return isActive(day, month);
3856
3934
  }
3857
3935
  return false;
3858
3936
  };
3859
- const isEndTip = (day, month) => {
3860
- if (isStartTip(day, month)) {
3861
- return false;
3937
+ const rangeTip = () => {
3938
+ if (state.currDate.length >= 2) {
3939
+ return Utils.isEqual(state.currDate[0], state.currDate[1]);
3862
3940
  }
3863
- return isActive(day, month);
3941
+ return false;
3864
3942
  };
3865
3943
  const getCurrData = (type2) => {
3866
3944
  const monthData = type2 === "prev" ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
@@ -3882,20 +3960,45 @@
3882
3960
  Utils.getMonthDays(String(year), String(month))
3883
3961
  ];
3884
3962
  };
3885
- const getDaysStatus = (days, type2) => {
3963
+ const getDaysStatus = (days, type2, dateInfo) => {
3964
+ const { year, month } = dateInfo;
3886
3965
  if (type2 === "prev" && days >= 7) {
3887
3966
  days -= 7;
3888
3967
  }
3889
3968
  return Array.from(Array(days), (v, k) => {
3890
3969
  return {
3891
3970
  day: k + 1,
3892
- type: type2
3971
+ type: type2,
3972
+ year,
3973
+ month
3893
3974
  };
3894
3975
  });
3895
3976
  };
3977
+ const getPreDaysStatus = (days, type2, dateInfo, preCurrMonthDays) => {
3978
+ const { year, month } = dateInfo;
3979
+ if (type2 === "prev" && days >= 7) {
3980
+ days -= 7;
3981
+ }
3982
+ const months2 = Array.from(Array(preCurrMonthDays), (v, k) => {
3983
+ return {
3984
+ day: k + 1,
3985
+ type: type2,
3986
+ year,
3987
+ month
3988
+ };
3989
+ });
3990
+ return months2.slice(preCurrMonthDays - days);
3991
+ };
3896
3992
  const getMonth = (curData, type2) => {
3897
3993
  const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
3994
+ let preMonth = +curData[1] - 1;
3995
+ let preYear = curData[0];
3996
+ if (preMonth <= 0) {
3997
+ preMonth = 12;
3998
+ preYear += 1;
3999
+ }
3898
4000
  const currMonthDays = Utils.getMonthDays(curData[0], curData[1]);
4001
+ const preCurrMonthDays = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
3899
4002
  const title2 = {
3900
4003
  year: curData[0],
3901
4004
  month: curData[1]
@@ -3904,10 +4007,21 @@
3904
4007
  curData,
3905
4008
  title: locale.calendaritem.monthTitle(title2.year, title2.month),
3906
4009
  monthData: [
3907
- ...getDaysStatus(preMonthDays, "prev"),
3908
- ...getDaysStatus(currMonthDays, "curr")
4010
+ ...getPreDaysStatus(
4011
+ preMonthDays,
4012
+ "prev",
4013
+ { month: preMonth, year: preYear },
4014
+ preCurrMonthDays
4015
+ ),
4016
+ ...getDaysStatus(currMonthDays, "curr", title2)
3909
4017
  ]
3910
4018
  };
4019
+ monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
4020
+ let cssScrollHeight = 0;
4021
+ if (state.monthsData.length > 0) {
4022
+ cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
4023
+ }
4024
+ monthInfo.cssScrollHeight = cssScrollHeight;
3911
4025
  if (type2 === "next") {
3912
4026
  if (!state.endData || !Utils.compareDate(
3913
4027
  `${state.endData[0]}-${state.endData[1]}-${Utils.getMonthDays(
@@ -3923,183 +4037,260 @@
3923
4037
  `${state.startData[0]}-${state.startData[1]}-01`
3924
4038
  )) {
3925
4039
  state.monthsData.unshift(monthInfo);
3926
- } else {
3927
- setUnLoadPrev(true);
3928
4040
  }
3929
4041
  setMonthsData(state.monthsData);
3930
4042
  };
3931
- const loadScroll = () => {
3932
- if (!props.poppable) {
3933
- return false;
3934
- }
3935
- requestAniFrame$1(async () => {
3936
- if ((weeksPanel == null ? void 0 : weeksPanel.current) && (monthsPanel == null ? void 0 : monthsPanel.current)) {
3937
- const weeksPanelRes = await getRectByTaro(weeksPanel == null ? void 0 : weeksPanel.current);
3938
- weeksPanelRes == null ? void 0 : weeksPanelRes.bottom;
3939
- const monthsDoms = monthsPanel.current.getElementsByClassName("calendar-month");
3940
- for (let i = 0; i < monthsDoms.length; i++) {
3941
- }
4043
+ const setDefaultRange = (monthsNum, current) => {
4044
+ let start2 = 0;
4045
+ let end = 0;
4046
+ if (monthsNum >= 3) {
4047
+ if (current > 0 && current < monthsNum) {
4048
+ start2 = current - 1;
4049
+ end = current + 3;
4050
+ } else if (current === 0) {
4051
+ start2 = current;
4052
+ end = current + 4;
4053
+ } else if (current === monthsNum) {
4054
+ start2 = current - 2;
4055
+ end = current + 2;
3942
4056
  }
3943
- });
3944
- };
3945
- const setTransform = (translateY = 0, type2, time = 1e3) => {
3946
- if (monthsPanel == null ? void 0 : monthsPanel.current) {
3947
- if (type2 === "end") {
3948
- monthsPanel.current.style.webkitTransition = `transform ${time}ms cubic-bezier(0.19, 1, 0.22, 1)`;
3949
- clearTimeout(state.timer);
3950
- state.timer = window.setTimeout(() => {
3951
- loadScroll();
3952
- }, time);
3953
- } else {
3954
- monthsPanel.current.style.webkitTransition = "";
3955
- loadScroll();
3956
- }
3957
- monthsPanel.current.style.webkitTransform = `translateY(${translateY}px)`;
3958
- state.scrollDistance = translateY;
4057
+ } else {
4058
+ start2 = 0;
4059
+ end = monthsNum + 2;
3959
4060
  }
4061
+ setMonthDefaultRange([start2, end]);
4062
+ setTranslateY(state.monthsData[start2].cssScrollHeight);
3960
4063
  };
3961
- const setMove = (move, type2, time) => {
3962
- var _a, _b;
3963
- let updateMove = move + state.transformY;
3964
- const h = ((_a = months.current) == null ? void 0 : _a.offsetHeight) || 0;
3965
- const offsetHeight = ((_b = monthsPanel.current) == null ? void 0 : _b.offsetHeight) || 0;
3966
- if (type2 === "end") {
3967
- if (updateMove > 0) {
3968
- updateMove = 0;
4064
+ const mothsViewScroll = (e2) => {
4065
+ if (state.monthsData.length <= 1) {
4066
+ return;
4067
+ }
4068
+ const target = e2.target;
4069
+ const currentScrollTop = target.scrollTop;
4070
+ let current = Math.floor(currentScrollTop / state.avgHeight);
4071
+ if (current === 0) {
4072
+ if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
4073
+ current += 1;
3969
4074
  }
3970
- if (updateMove < 0 && updateMove < -offsetHeight + h) {
3971
- updateMove = -offsetHeight + h;
4075
+ } else if (current > 0 && current < state.monthsNum - 1) {
4076
+ if (currentScrollTop >= state.monthsData[current + 1].cssScrollHeight) {
4077
+ current += 1;
3972
4078
  }
3973
- if (offsetHeight <= h && state.monthsData.length === 1) {
3974
- updateMove = 0;
4079
+ if (currentScrollTop < state.monthsData[current].cssScrollHeight) {
4080
+ current -= 1;
3975
4081
  }
3976
- setTransform(updateMove, type2, time);
3977
4082
  } else {
3978
- if (updateMove > 0 && updateMove > 100) {
3979
- updateMove = 100;
3980
- }
3981
- if (updateMove < -offsetHeight + h - 100 && state.monthsData.length > 1) {
3982
- updateMove = -offsetHeight + h - 100;
4083
+ const viewPosition = Math.round(currentScrollTop + viewHeight);
4084
+ if (viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight && currentScrollTop > state.monthsData[current - 1].cssScrollHeight) {
4085
+ current -= 1;
3983
4086
  }
3984
- if (updateMove < 0 && updateMove < -100 && state.monthsData.length === 1) {
3985
- updateMove = -100;
4087
+ if (current + 1 <= state.monthsNum && viewPosition >= state.monthsData[current + 1].cssScrollHeight + state.monthsData[current + 1].cssHeight) {
4088
+ current += 1;
3986
4089
  }
3987
- setTransform(updateMove);
3988
- }
3989
- };
3990
- const onTouchStart = (event) => {
3991
- event.stopPropagation();
3992
- const changedTouches = event.changedTouches[0];
3993
- state.touchParams.startY = changedTouches.pageY;
3994
- state.touchParams.startTime = event.timeStamp || Date.now();
3995
- state.transformY = state.scrollDistance;
3996
- };
3997
- const onTouchMove = (event) => {
3998
- event.stopPropagation();
3999
- const changedTouches = event.changedTouches[0];
4000
- state.touchParams.lastY = changedTouches.pageY;
4001
- state.touchParams.lastTime = event.timeStamp || Date.now();
4002
- const move = state.touchParams.lastY - state.touchParams.startY;
4003
- if (Math.abs(move) < 5) {
4004
- return false;
4005
- }
4006
- setMove(move);
4007
- };
4008
- const onTouchEnd = (event) => {
4009
- var _a, _b;
4010
- event.stopPropagation();
4011
- const changedTouches = event.changedTouches[0];
4012
- state.touchParams.lastY = changedTouches.pageY;
4013
- state.touchParams.lastTime = event.timeStamp || Date.now();
4014
- let move = state.touchParams.lastY - state.touchParams.startY;
4015
- if (Math.abs(move) < 5) {
4016
- return false;
4017
- }
4018
- const updateMove = move + state.transformY;
4019
- const h = ((_a = months.current) == null ? void 0 : _a.offsetHeight) || 0;
4020
- const offsetHeight = ((_b = monthsPanel.current) == null ? void 0 : _b.offsetHeight) || 0;
4021
- if (updateMove > 0) {
4022
- getMonth(getCurrData("prev"), "prev");
4023
- } else if (updateMove < 0 && updateMove < -offsetHeight + (Math.abs(move) > h ? Math.abs(move) : h) * 5) {
4024
- getMonth(getCurrData("next"), "next");
4025
- if (Math.abs(move) >= 300) {
4026
- getMonth(getCurrData("next"), "next");
4090
+ if (current >= 1 && currentScrollTop < state.monthsData[current - 1].cssScrollHeight) {
4091
+ current -= 1;
4027
4092
  }
4028
4093
  }
4029
- let moveTime = state.touchParams.lastTime - state.touchParams.startTime;
4030
- if (moveTime <= 300) {
4031
- move *= 2;
4032
- moveTime += 1e3;
4033
- setMove(move, "end", moveTime);
4034
- } else {
4035
- setMove(move, "end");
4094
+ if (state.currentIndex !== current) {
4095
+ state.currentIndex = current;
4096
+ setDefaultRange(state.monthsNum, current);
4036
4097
  }
4098
+ setYearMonthTitle(state.monthsData[current].title);
4037
4099
  };
4038
4100
  const initData = () => {
4039
- state.startData = startDate ? splitDate(startDate) : "";
4040
- state.endData = endDate ? splitDate(endDate) : "";
4041
- if (!defaultValue) {
4042
- state.currDate = state.isRange ? [Utils.date2Str(new Date()), Utils.getDay(1)] : Utils.date2Str(new Date());
4043
- } else {
4044
- state.currDate = state.isRange ? [...defaultValue] : defaultValue;
4101
+ const propStartDate = props.startDate ? props.startDate : Utils.getDay(0);
4102
+ const propEndDate = props.endDate ? props.endDate : Utils.getDay(365);
4103
+ state.propStartDate = propStartDate;
4104
+ state.propEndDate = propEndDate;
4105
+ state.startData = splitDate(propStartDate);
4106
+ state.endData = splitDate(propEndDate);
4107
+ if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
4108
+ state.currDate = props.type !== "one" ? [...props.defaultValue] : props.defaultValue;
4109
+ }
4110
+ const startDate = {
4111
+ year: Number(state.startData[0]),
4112
+ month: Number(state.startData[1])
4113
+ };
4114
+ const endDate = {
4115
+ year: Number(state.endData[0]),
4116
+ month: Number(state.endData[1])
4117
+ };
4118
+ let monthsNum = endDate.month - startDate.month;
4119
+ if (endDate.year - startDate.year > 0) {
4120
+ monthsNum += 12 * (endDate.year - startDate.year);
4121
+ }
4122
+ if (monthsNum <= 0) {
4123
+ monthsNum = 1;
4045
4124
  }
4046
- if (state.isRange && Array.isArray(state.currDate)) {
4047
- if (startDate && Utils.compareDate(state.currDate[0], startDate)) {
4048
- state.currDate.splice(0, 1, startDate);
4125
+ getMonth(state.startData, "next");
4126
+ let i = 1;
4127
+ do {
4128
+ getMonth(getCurrData("next"), "next");
4129
+ } while (i++ < monthsNum);
4130
+ state.monthsNum = monthsNum;
4131
+ if (type === "range" && Array.isArray(state.currDate)) {
4132
+ if (state.currDate.length > 0) {
4133
+ if (propStartDate && Utils.compareDate(state.currDate[0], propStartDate)) {
4134
+ state.currDate.splice(0, 1, propStartDate);
4135
+ }
4136
+ if (propEndDate && Utils.compareDate(propEndDate, state.currDate[1])) {
4137
+ state.currDate.splice(1, 1, propEndDate);
4138
+ }
4139
+ state.defaultData = [
4140
+ ...splitDate(state.currDate[0]),
4141
+ ...splitDate(state.currDate[1])
4142
+ ];
4049
4143
  }
4050
- if (endDate && Utils.compareDate(endDate, state.currDate[1])) {
4051
- state.currDate.splice(1, 1, endDate);
4144
+ } else if (props.type === "multiple" && Array.isArray(state.currDate)) {
4145
+ if (state.currDate.length > 0) {
4146
+ const defaultArr = [];
4147
+ const obj = {};
4148
+ state.currDate.forEach((item) => {
4149
+ if (propStartDate && !Utils.compareDate(item, propStartDate) && propEndDate && !Utils.compareDate(propEndDate, item)) {
4150
+ if (!Object.hasOwnProperty.call(obj, item)) {
4151
+ defaultArr.push(item);
4152
+ obj[item] = item;
4153
+ }
4154
+ }
4155
+ });
4156
+ state.currDate = [...defaultArr];
4157
+ state.defaultData = [...splitDate(defaultArr[0])];
4052
4158
  }
4053
- state.defaultData = [
4054
- ...splitDate(state.currDate[0]),
4055
- ...splitDate(state.currDate[1])
4056
- ];
4057
- } else {
4058
- if (startDate && Utils.compareDate(state.currDate, startDate)) {
4059
- state.currDate = startDate;
4060
- } else if (endDate && !Utils.compareDate(state.currDate, endDate)) {
4061
- state.currDate = endDate;
4159
+ } else if (state.currDate) {
4160
+ if (propStartDate && Utils.compareDate(state.currDate, propStartDate)) {
4161
+ state.currDate = propStartDate;
4162
+ } else if (propEndDate && !Utils.compareDate(state.currDate, propEndDate)) {
4163
+ state.currDate = propEndDate;
4062
4164
  }
4063
4165
  state.defaultData = [...splitDate(state.currDate)];
4064
4166
  }
4065
- getMonth(state.defaultData, "next");
4066
- setYearMonthTitle(state.monthsData[0].title);
4067
- let i = 1;
4068
- do {
4069
- getMonth(getCurrData("next"), "next");
4070
- } while (i++ < 4);
4071
- if (state.isRange) {
4072
- chooseDay(
4073
- { day: state.defaultData[2], type: "curr" },
4074
- state.monthsData[0],
4075
- true
4076
- );
4077
- chooseDay(
4078
- { day: state.defaultData[5], type: "curr" },
4079
- state.monthsData[0],
4080
- true,
4081
- true
4082
- );
4083
- } else {
4084
- chooseDay(
4085
- { day: state.defaultData[2], type: "curr" },
4086
- state.monthsData[0],
4087
- true
4088
- );
4167
+ let current = 0;
4168
+ let lastCurrent = 0;
4169
+ if (state.defaultData.length > 0) {
4170
+ state.monthsData.forEach((item, index) => {
4171
+ if (item.title === locale.calendaritem.monthTitle(
4172
+ state.defaultData[0],
4173
+ state.defaultData[1]
4174
+ )) {
4175
+ current = index;
4176
+ }
4177
+ if (props.type === "range") {
4178
+ if (item.title === locale.calendaritem.monthTitle(
4179
+ state.defaultData[3],
4180
+ state.defaultData[4]
4181
+ )) {
4182
+ lastCurrent = index;
4183
+ }
4184
+ }
4185
+ });
4089
4186
  }
4187
+ setDefaultRange(monthsNum, current);
4188
+ state.currentIndex = current;
4189
+ setYearMonthTitle(state.monthsData[state.currentIndex].title);
4190
+ if (state.defaultData.length > 0) {
4191
+ if (type === "range") {
4192
+ chooseDay(
4193
+ { day: state.defaultData[2], type: "curr" },
4194
+ state.monthsData[state.currentIndex],
4195
+ true
4196
+ );
4197
+ chooseDay(
4198
+ { day: state.defaultData[5], type: "curr" },
4199
+ state.monthsData[lastCurrent],
4200
+ true
4201
+ );
4202
+ } else if (type === "multiple") {
4203
+ [...state.currDate].forEach((item) => {
4204
+ const dateArr = splitDate(item);
4205
+ let current2 = state.currentIndex;
4206
+ state.monthsData.forEach((item2, index) => {
4207
+ if (item2.title === locale.calendaritem.monthTitle(dateArr[0], dateArr[1])) {
4208
+ current2 = index;
4209
+ }
4210
+ });
4211
+ chooseDay(
4212
+ { day: dateArr[2], type: "curr" },
4213
+ state.monthsData[current2],
4214
+ true
4215
+ );
4216
+ });
4217
+ } else {
4218
+ chooseDay(
4219
+ { day: state.defaultData[2], type: "curr" },
4220
+ state.monthsData[state.currentIndex],
4221
+ true
4222
+ );
4223
+ }
4224
+ }
4225
+ const lastItem = state.monthsData[state.monthsData.length - 1];
4226
+ const containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
4227
+ requestAniFrame$1(() => {
4228
+ if (months && monthsPanel && viewArea) {
4229
+ viewHeight = months.current.clientHeight;
4230
+ monthsPanel.current.style.height = `${containerHeight}px`;
4231
+ months.current.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
4232
+ }
4233
+ });
4234
+ state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
4235
+ };
4236
+ const resetRender = () => {
4237
+ state.chooseData.splice(0);
4238
+ state.monthsData.splice(0);
4239
+ initData();
4240
+ };
4241
+ const scrollToDate = (date) => {
4242
+ if (Utils.compareDate(date, state.propStartDate)) {
4243
+ date = state.propStartDate;
4244
+ } else if (!Utils.compareDate(date, state.propEndDate)) {
4245
+ date = state.propEndDate;
4246
+ }
4247
+ const dateArr = splitDate(date);
4248
+ state.monthsData.forEach((item, index) => {
4249
+ if (item.title === locale.calendaritem.monthTitle(dateArr[0], dateArr[1])) {
4250
+ if (months.current) {
4251
+ const distance = state.monthsData[index].cssScrollHeight - months.current.scrollTop;
4252
+ if (toDateAnimation) {
4253
+ let flag = 0;
4254
+ const interval = setInterval(() => {
4255
+ flag++;
4256
+ if (months.current) {
4257
+ const offset = distance / 10;
4258
+ months.current.scrollTop += offset;
4259
+ }
4260
+ if (flag >= 10) {
4261
+ clearInterval(interval);
4262
+ if (months.current) {
4263
+ months.current.scrollTop = state.monthsData[index].cssScrollHeight;
4264
+ }
4265
+ }
4266
+ }, 40);
4267
+ } else {
4268
+ months.current.scrollTop = state.monthsData[index].cssScrollHeight;
4269
+ }
4270
+ }
4271
+ }
4272
+ });
4090
4273
  };
4091
4274
  React.useEffect(() => {
4092
4275
  initData();
4093
4276
  }, []);
4277
+ React.useEffect(() => {
4278
+ poppable && resetRender();
4279
+ }, [defaultValue]);
4280
+ React__default["default"].useImperativeHandle(ref, () => ({
4281
+ scrollToDate
4282
+ }));
4094
4283
  return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
4095
4284
  className: classes
4096
4285
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
4097
4286
  className: headerClasses
4098
- }, poppable ? /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
4287
+ }, showTitle && /* @__PURE__ */ React__default["default"].createElement("div", {
4099
4288
  className: "calendar-title"
4100
- }, locale.calendaritem.title), /* @__PURE__ */ React__default["default"].createElement("div", {
4289
+ }, title || locale.calendaritem.title), onBtn && /* @__PURE__ */ React__default["default"].createElement("div", {
4290
+ className: "calendar-top-slot"
4291
+ }, onBtn()), showSubTitle && /* @__PURE__ */ React__default["default"].createElement("div", {
4101
4292
  className: "calendar-curr-month"
4102
- }, yearMonthTitle)) : "", /* @__PURE__ */ React__default["default"].createElement("div", {
4293
+ }, yearMonthTitle), /* @__PURE__ */ React__default["default"].createElement("div", {
4103
4294
  className: "calendar-weeks",
4104
4295
  ref: weeksPanel
4105
4296
  }, weeks.map((item) => /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -4107,48 +4298,54 @@
4107
4298
  key: item
4108
4299
  }, item)))), /* @__PURE__ */ React__default["default"].createElement("div", {
4109
4300
  className: "nut-calendar-content",
4110
- onTouchStart,
4111
- onTouchMove,
4112
- onTouchEnd,
4301
+ onScroll: mothsViewScroll,
4113
4302
  ref: months
4114
4303
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
4115
4304
  className: "calendar-months-panel",
4116
4305
  ref: monthsPanel
4117
4306
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
4118
- className: "calendar-loading-tip"
4119
- }, !unLoadPrev ? locale.calendaritem.loadPreviousMonth : locale.calendaritem.noEarlierMonth), monthsData.map((month, key) => /* @__PURE__ */ React__default["default"].createElement("div", {
4120
- className: "calendar-month",
4121
- key
4122
- }, /* @__PURE__ */ React__default["default"].createElement("div", {
4123
- className: "calendar-month-title"
4124
- }, month.title), /* @__PURE__ */ React__default["default"].createElement("div", {
4125
- className: "calendar-month-con"
4126
- }, /* @__PURE__ */ React__default["default"].createElement("div", {
4127
- className: monthitemclasses
4128
- }, month.monthData && month.monthData.map((day, index) => /* @__PURE__ */ React__default["default"].createElement("div", {
4129
- className: [
4130
- "calendar-month-day",
4131
- getClass(day, month)
4132
- ].join(" "),
4133
- key: index,
4134
- onClick: () => {
4135
- chooseDay(day, month);
4136
- }
4137
- }, /* @__PURE__ */ React__default["default"].createElement("div", {
4138
- className: "calendar-day"
4139
- }, day.type === "curr" ? day.day : ""), isCurrDay(month, day.day) ? /* @__PURE__ */ React__default["default"].createElement("div", {
4140
- className: "calendar-curr-tip-curr"
4141
- }, locale.calendaritem.today) : "", isStartTip(day, month) ? /* @__PURE__ */ React__default["default"].createElement("div", {
4142
- className: "calendar-day-tip"
4143
- }, locale.calendaritem.start) : "", isEndTip(day, month) ? /* @__PURE__ */ React__default["default"].createElement("div", {
4144
- className: "calendar-day-tip"
4145
- }, locale.calendaritem.end) : "")))))))), poppable && !isAutoBackFill ? /* @__PURE__ */ React__default["default"].createElement("div", {
4307
+ className: "viewArea",
4308
+ ref: viewArea,
4309
+ style: { transform: `translateY(${translateY}px)` }
4310
+ }, state.monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
4311
+ return /* @__PURE__ */ React__default["default"].createElement("div", {
4312
+ className: "calendar-month",
4313
+ key
4314
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
4315
+ className: "calendar-month-title"
4316
+ }, month.title), /* @__PURE__ */ React__default["default"].createElement("div", {
4317
+ className: "calendar-month-con"
4318
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
4319
+ className: monthitemclasses
4320
+ }, month.monthData.map((day, i) => /* @__PURE__ */ React__default["default"].createElement("div", {
4321
+ className: [
4322
+ "calendar-month-day",
4323
+ getClass(day, month)
4324
+ ].join(" "),
4325
+ onClick: () => {
4326
+ chooseDay(day, month);
4327
+ },
4328
+ key: i
4329
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
4330
+ className: "calendar-day"
4331
+ }, onDay ? onDay(day) : day.day), onTopInfo && /* @__PURE__ */ React__default["default"].createElement("div", {
4332
+ className: "calendar-curr-tips calendar-curr-tips-top"
4333
+ }, onTopInfo(day)), onBottomInfo && /* @__PURE__ */ React__default["default"].createElement("div", {
4334
+ className: "calendar-curr-tips calendar-curr-tips-bottom"
4335
+ }, onBottomInfo(day)), !onBottomInfo && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React__default["default"].createElement("div", {
4336
+ className: "calendar-curr-tip-curr"
4337
+ }, locale.calendaritem.today), isStartTip(day, month) && /* @__PURE__ */ React__default["default"].createElement("div", {
4338
+ className: `calendar-day-tip ${rangeTip() ? "calendar-curr-tips-top" : ""}`
4339
+ }, startText || locale.calendaritem.start), isEndTip(day, month) && /* @__PURE__ */ React__default["default"].createElement("div", {
4340
+ className: "calendar-day-tip"
4341
+ }, endText || locale.calendaritem.end))))));
4342
+ })))), poppable && !isAutoBackFill ? /* @__PURE__ */ React__default["default"].createElement("div", {
4146
4343
  className: "nut-calendar-footer"
4147
4344
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
4148
4345
  className: "calendar-confirm-btn",
4149
4346
  onClick: confirm
4150
- }, locale.confirm)) : ""));
4151
- };
4347
+ }, confirmText || locale.confirm)) : ""));
4348
+ });
4152
4349
  CalendarItem.defaultProps = defaultProps$14;
4153
4350
  CalendarItem.displayName = "NutCalendarItem";
4154
4351
  const defaultProps$13 = {
@@ -4160,12 +4357,25 @@
4160
4357
  defaultValue: "",
4161
4358
  startDate: Utils.getDay(0),
4162
4359
  endDate: Utils.getDay(365),
4360
+ showToday: true,
4361
+ startText: "\u5F00\u59CB",
4362
+ endText: "\u7ED3\u675F",
4363
+ confirmText: "\u786E\u8BA4",
4364
+ showTitle: true,
4365
+ showSubTitle: true,
4366
+ toDateAnimation: true,
4367
+ onBtn: void 0,
4368
+ onDay: void 0,
4369
+ onTopInfo: void 0,
4370
+ onBottomInfo: void 0,
4163
4371
  onClose: () => {
4164
4372
  },
4165
4373
  onChoose: (param) => {
4374
+ },
4375
+ onSelected: (data) => {
4166
4376
  }
4167
4377
  };
4168
- const Calendar = (props) => {
4378
+ const Calendar = React__default["default"].forwardRef((props, ref) => {
4169
4379
  const { locale } = useConfig$1();
4170
4380
  const {
4171
4381
  children,
@@ -4177,14 +4387,25 @@
4177
4387
  defaultValue,
4178
4388
  startDate,
4179
4389
  endDate,
4390
+ showToday,
4391
+ startText,
4392
+ endText,
4393
+ confirmText,
4394
+ showTitle,
4395
+ showSubTitle,
4396
+ toDateAnimation,
4397
+ onBtn,
4398
+ onDay,
4399
+ onTopInfo,
4400
+ onBottomInfo,
4180
4401
  onClose,
4181
- onChoose
4402
+ onChoose,
4403
+ onSelected
4182
4404
  } = { ...defaultProps$13, ...props };
4405
+ const calendarRef = React.useRef(null);
4183
4406
  const close = () => {
4184
4407
  onClose && onClose();
4185
4408
  };
4186
- const update2 = () => {
4187
- };
4188
4409
  const choose = (param) => {
4189
4410
  close();
4190
4411
  onChoose && onChoose(param);
@@ -4192,6 +4413,41 @@
4192
4413
  const closePopup = () => {
4193
4414
  close();
4194
4415
  };
4416
+ const select = (param) => {
4417
+ onSelected && onSelected(param);
4418
+ };
4419
+ const scrollToDate = (date) => {
4420
+ var _a;
4421
+ (_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date);
4422
+ };
4423
+ React__default["default"].useImperativeHandle(ref, () => ({
4424
+ scrollToDate
4425
+ }));
4426
+ const renderItem = () => {
4427
+ return /* @__PURE__ */ React__default["default"].createElement(CalendarItem, {
4428
+ ref: calendarRef,
4429
+ type,
4430
+ isAutoBackFill,
4431
+ poppable,
4432
+ title: locale.calendaritem.title || title,
4433
+ defaultValue,
4434
+ startDate,
4435
+ endDate,
4436
+ showToday,
4437
+ startText,
4438
+ endText,
4439
+ confirmText,
4440
+ showTitle,
4441
+ showSubTitle,
4442
+ toDateAnimation,
4443
+ onBtn,
4444
+ onDay,
4445
+ onTopInfo,
4446
+ onBottomInfo,
4447
+ onChoose: choose,
4448
+ onSelected: select
4449
+ });
4450
+ };
4195
4451
  return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, poppable ? /* @__PURE__ */ React__default["default"].createElement(Popup, {
4196
4452
  visible,
4197
4453
  position: "bottom",
@@ -4202,29 +4458,8 @@
4202
4458
  onClickOverlay: closePopup,
4203
4459
  onClickCloseIcon: closePopup,
4204
4460
  style: { height: "85vh" }
4205
- }, /* @__PURE__ */ React__default["default"].createElement(CalendarItem, {
4206
- type,
4207
- isAutoBackFill,
4208
- poppable,
4209
- title: locale.calendaritem.title || title,
4210
- defaultValue,
4211
- startDate,
4212
- endDate,
4213
- onUpdate: update2,
4214
- onClose: close,
4215
- onChoose: choose
4216
- })) : /* @__PURE__ */ React__default["default"].createElement(CalendarItem, {
4217
- type,
4218
- isAutoBackFill,
4219
- poppable,
4220
- title: locale.calendaritem.title,
4221
- defaultValue,
4222
- startDate,
4223
- endDate,
4224
- onClose: close,
4225
- onChoose: choose
4226
- }));
4227
- };
4461
+ }, renderItem()) : renderItem());
4462
+ });
4228
4463
  Calendar.defaultProps = defaultProps$13;
4229
4464
  Calendar.displayName = "NutCalendar";
4230
4465
  const defaultProps$12 = {
@@ -4238,11 +4473,12 @@
4238
4473
  },
4239
4474
  activeColor: "#fa2c19",
4240
4475
  checked: false,
4476
+ checkedIcon: "checklist",
4241
4477
  chooseItem: () => {
4242
4478
  }
4243
4479
  };
4244
- const InternalCascaderItem = (props) => {
4245
- const { data, checked, chooseItem, activeColor } = {
4480
+ const InternalCascaderItem = (props, ref) => {
4481
+ const { data, checked, checkedIcon, chooseItem, activeColor } = {
4246
4482
  ...defaultProps$12,
4247
4483
  ...props
4248
4484
  };
@@ -4257,11 +4493,6 @@
4257
4493
  const classesTitle = classNames({
4258
4494
  [`${b2("")}__title`]: true
4259
4495
  });
4260
- React.useEffect(() => {
4261
- initData();
4262
- }, [data]);
4263
- const initData = () => {
4264
- };
4265
4496
  return /* @__PURE__ */ React__default["default"].createElement("div", {
4266
4497
  style: { color: checked ? activeColor : "" },
4267
4498
  className: classes,
@@ -4276,7 +4507,7 @@
4276
4507
  name: "loading"
4277
4508
  }) : /* @__PURE__ */ React__default["default"].createElement(Icon$1, {
4278
4509
  className: `${checked ? b2("icon-check") : ""}`,
4279
- name: "checklist"
4510
+ name: checked ? checkedIcon : ""
4280
4511
  }));
4281
4512
  };
4282
4513
  const CascaderItem = React__default["default"].forwardRef(InternalCascaderItem);
@@ -4418,6 +4649,7 @@
4418
4649
  className: "",
4419
4650
  style: {},
4420
4651
  activeColor: "#fa2c19",
4652
+ checkedIcon: "checklist",
4421
4653
  tabsColor: "",
4422
4654
  poppable: true,
4423
4655
  visible: false,
@@ -4442,7 +4674,7 @@
4442
4674
  },
4443
4675
  ...Popup.defaultProps
4444
4676
  };
4445
- const InternalCascader = (props) => {
4677
+ const InternalCascader = (props, ref) => {
4446
4678
  const {
4447
4679
  className,
4448
4680
  style,
@@ -4466,7 +4698,7 @@
4466
4698
  onPathChange
4467
4699
  } = { ...defaultProps$11, ...props };
4468
4700
  const [tabvalue, setTabvalue] = React.useState("c1");
4469
- const [optiosData, setOptiosData] = React.useState([]);
4701
+ const [optionsData, setOptionsData] = React.useState([]);
4470
4702
  const isLazy = () => state.configs.lazy && Boolean(state.configs.lazyLoad);
4471
4703
  const [state] = React.useState({
4472
4704
  optionsData: [],
@@ -4539,7 +4771,7 @@
4539
4771
  }
4540
4772
  ];
4541
4773
  syncValue();
4542
- setOptiosData(state.panes);
4774
+ setOptionsData(state.panes);
4543
4775
  };
4544
4776
  const syncValue = async () => {
4545
4777
  const currentValue2 = state.innerValue;
@@ -4633,7 +4865,7 @@
4633
4865
  onChange(optionParams, pathNodes);
4634
4866
  onPathChange(optionParams, pathNodes);
4635
4867
  }
4636
- setOptiosData(state.panes);
4868
+ setOptionsData(state.panes);
4637
4869
  close();
4638
4870
  return;
4639
4871
  }
@@ -4648,7 +4880,7 @@
4648
4880
  paneKey: `c${state.tabsCursor + 1}`
4649
4881
  });
4650
4882
  setTabvalue(`c${state.tabsCursor + 1}`);
4651
- setOptiosData(state.panes);
4883
+ setOptionsData(state.panes);
4652
4884
  if (!type) {
4653
4885
  const pathNodes = state.panes.map((item) => item.selectedNode);
4654
4886
  const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
@@ -4665,7 +4897,7 @@
4665
4897
  state.panes[state.tabsCursor].selectedNode = node;
4666
4898
  chooseItem(node, type);
4667
4899
  }
4668
- setOptiosData(state.panes);
4900
+ setOptionsData(state.panes);
4669
4901
  };
4670
4902
  const renderItem = () => {
4671
4903
  return /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -4676,7 +4908,7 @@
4676
4908
  }, title), /* @__PURE__ */ React__default["default"].createElement(Tabs, {
4677
4909
  value: tabvalue,
4678
4910
  titleNode: () => {
4679
- return optiosData.map((pane, index) => {
4911
+ return optionsData.map((pane, index) => {
4680
4912
  var _a, _b;
4681
4913
  return /* @__PURE__ */ React__default["default"].createElement("div", {
4682
4914
  onClick: () => {
@@ -4693,7 +4925,7 @@
4693
4925
  }));
4694
4926
  });
4695
4927
  }
4696
- }, !state.initLoading && state.panes.length ? optiosData.map((pane) => /* @__PURE__ */ React__default["default"].createElement(TabPane, {
4928
+ }, !state.initLoading && state.panes.length ? optionsData.map((pane) => /* @__PURE__ */ React__default["default"].createElement(TabPane, {
4697
4929
  key: pane.paneKey,
4698
4930
  paneKey: pane.paneKey
4699
4931
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -4730,6 +4962,8 @@
4730
4962
  disabled: false,
4731
4963
  checkedValue: [],
4732
4964
  max: void 0,
4965
+ textPosition: "right",
4966
+ direction: "vertical",
4733
4967
  onChange: (value) => {
4734
4968
  },
4735
4969
  options: []
@@ -4744,6 +4978,8 @@
4744
4978
  onChange,
4745
4979
  checkedValue,
4746
4980
  max,
4981
+ textPosition,
4982
+ direction,
4747
4983
  options,
4748
4984
  ...rest
4749
4985
  } = props;
@@ -4799,9 +5035,9 @@
4799
5035
  return (innerValue == null ? void 0 : innerValue.indexOf(child.props.label || child.children)) > -1;
4800
5036
  }
4801
5037
  function validateChecked(value) {
4802
- if (innerValue === null)
5038
+ if (!innerValue)
4803
5039
  return false;
4804
- return innerValue === value;
5040
+ return (innerValue == null ? void 0 : innerValue.indexOf(value)) > -1;
4805
5041
  }
4806
5042
  function getParentVals() {
4807
5043
  return innerValue;
@@ -4817,7 +5053,8 @@
4817
5053
  checked: childChecked,
4818
5054
  onChange: handleChildChange,
4819
5055
  getParentVals,
4820
- max
5056
+ max,
5057
+ textPosition
4821
5058
  });
4822
5059
  });
4823
5060
  }
@@ -4832,13 +5069,14 @@
4832
5069
  onChange: handleChildChange,
4833
5070
  ...rest2,
4834
5071
  max,
5072
+ textPosition,
4835
5073
  getParentVals,
4836
5074
  checked: childChecked
4837
5075
  });
4838
5076
  });
4839
- }, [innerValue, options]);
5077
+ }, [innerValue, options, innerDisabled, max]);
4840
5078
  return /* @__PURE__ */ React__default["default"].createElement("div", {
4841
- className: `${b2()} ${className || ""}`,
5079
+ className: `${b2()} nut-checkboxgroup--${props.direction} ${className || ""}`,
4842
5080
  ...rest
4843
5081
  }, (options == null ? void 0 : options.length) ? renderOptionsChildren() : cloneChildren());
4844
5082
  }
@@ -6427,13 +6665,7 @@
6427
6665
  onChangeFuc && onChangeFuc(outputValue, e2);
6428
6666
  change && change(outputValue, e2);
6429
6667
  if (!isAsync) {
6430
- if (Number(outputValue) < Number(min)) {
6431
- setInputValue(Number(min));
6432
- } else if (Number(outputValue) > Number(max)) {
6433
- setInputValue(Number(max));
6434
- } else {
6435
- setInputValue(outputValue);
6436
- }
6668
+ setInputValue(outputValue);
6437
6669
  }
6438
6670
  };
6439
6671
  const reduceNumber = (e2) => {
@@ -6459,15 +6691,11 @@
6459
6691
  }
6460
6692
  };
6461
6693
  const changeValue = (e2) => {
6462
- const value = Number(e2.detail.value);
6463
- change && change(value, e2);
6464
- onChangeFuc && onChangeFuc(value, e2);
6694
+ const input = e2.target;
6695
+ change && change(input.value, e2);
6696
+ onChangeFuc && onChangeFuc(input.value, e2);
6465
6697
  if (!isAsync) {
6466
- if (Number.isNaN(value)) {
6467
- setInputValue(inputValue);
6468
- } else {
6469
- setInputValue(value);
6470
- }
6698
+ setInputValue(input.value);
6471
6699
  }
6472
6700
  };
6473
6701
  const focusValue = (e2) => {
@@ -6483,7 +6711,8 @@
6483
6711
  return;
6484
6712
  if (readonly)
6485
6713
  return;
6486
- let value = Number(e2.detail.value);
6714
+ const input = e2.target;
6715
+ let value = +input.value;
6487
6716
  if (value < Number(min)) {
6488
6717
  value = Number(min);
6489
6718
  } else if (value > Number(max)) {
@@ -6497,6 +6726,8 @@
6497
6726
  className: classes,
6498
6727
  style: styles,
6499
6728
  ...restProps
6729
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
6730
+ className: "nut-input-minus"
6500
6731
  }, /* @__PURE__ */ React__default["default"].createElement(Icon$1, {
6501
6732
  classPrefix: iconClassPrefix,
6502
6733
  fontClassName: iconFontClassName,
@@ -6504,7 +6735,7 @@
6504
6735
  size: buttonSize,
6505
6736
  name: "minus",
6506
6737
  onClick: reduceNumber
6507
- }), /* @__PURE__ */ React__default["default"].createElement("input", {
6738
+ })), /* @__PURE__ */ React__default["default"].createElement("input", {
6508
6739
  className: "nut-number-input",
6509
6740
  type: "number",
6510
6741
  min,
@@ -6516,14 +6747,16 @@
6516
6747
  onInput: changeValue,
6517
6748
  onBlur: burValue,
6518
6749
  onFocus: focusValue
6519
- }), /* @__PURE__ */ React__default["default"].createElement(Icon$1, {
6750
+ }), /* @__PURE__ */ React__default["default"].createElement("div", {
6751
+ className: "nut-input-add"
6752
+ }, /* @__PURE__ */ React__default["default"].createElement(Icon$1, {
6520
6753
  classPrefix: iconClassPrefix,
6521
6754
  fontClassName: iconFontClassName,
6522
6755
  className: iconAddClasses,
6523
6756
  size: buttonSize,
6524
6757
  name: "plus",
6525
6758
  onClick: addNumber
6526
- }));
6759
+ })));
6527
6760
  };
6528
6761
  InputNumber.defaultProps = defaultProps$W;
6529
6762
  InputNumber.displayName = "NutInputNumber";
@@ -7836,6 +8069,7 @@
7836
8069
  closeOnClickOverlay: true,
7837
8070
  length: 6,
7838
8071
  className: "",
8072
+ autoFocus: false,
7839
8073
  onChange: (value) => {
7840
8074
  },
7841
8075
  onOk: (value) => {
@@ -7871,6 +8105,7 @@
7871
8105
  onComplete,
7872
8106
  iconClassPrefix,
7873
8107
  iconFontClassName,
8108
+ autoFocus,
7874
8109
  ...reset
7875
8110
  } = props;
7876
8111
  const b2 = cn("shortpassword");
@@ -7955,6 +8190,7 @@
7955
8190
  style: systemStyle(),
7956
8191
  maxLength: 6,
7957
8192
  value: inputValue,
8193
+ autoFocus,
7958
8194
  onChange: (e2) => changeValue(e2)
7959
8195
  }), /* @__PURE__ */ React__default["default"].createElement("div", {
7960
8196
  className: b2("input-site")
@@ -8033,6 +8269,10 @@
8033
8269
  SetInputValue(initValue);
8034
8270
  }, [defaultValue]);
8035
8271
  const textChange = (event) => {
8272
+ if (disabled)
8273
+ return;
8274
+ if (readonly)
8275
+ return;
8036
8276
  const text = event.detail ? event.detail : event.target;
8037
8277
  if (maxlength && [...text.value].length > Number(maxlength)) {
8038
8278
  text.value = text.value.substring(0, Number(maxlength));
@@ -8065,8 +8305,7 @@
8065
8305
  resize: `${autosize ? "vertical" : "none"}`,
8066
8306
  ...style
8067
8307
  },
8068
- disabled,
8069
- readOnly: readonly,
8308
+ readOnly: disabled || readonly,
8070
8309
  value: inputValue,
8071
8310
  onInput: (e2) => {
8072
8311
  textChange(e2);
@@ -8321,6 +8560,7 @@
8321
8560
  name: "file",
8322
8561
  disabled: false,
8323
8562
  autoUpload: true,
8563
+ multiple: false,
8324
8564
  maximize: Number.MAX_VALUE,
8325
8565
  data: {},
8326
8566
  headers: {},
@@ -8364,6 +8604,7 @@
8364
8604
  isDeletable,
8365
8605
  maximum,
8366
8606
  maximize,
8607
+ multiple,
8367
8608
  className,
8368
8609
  autoUpload,
8369
8610
  sizeType,
@@ -8411,7 +8652,7 @@
8411
8652
  return;
8412
8653
  }
8413
8654
  Taro.chooseImage({
8414
- count: maximum * 1 - fileList.length,
8655
+ count: multiple ? maximum * 1 - fileList.length : 1,
8415
8656
  sizeType,
8416
8657
  sourceType,
8417
8658
  success: onChangeFn
@@ -8902,11 +9143,9 @@
8902
9143
  DialogWrap.displayName = "NutDialogWrap";
8903
9144
  const DialogWrapper = (props) => {
8904
9145
  const { visible, lockScroll } = props;
8905
- if (lockScroll && !visible && document.body.classList.value.includes("nut-overflow-hidden")) {
8906
- document.body.classList.remove("nut-overflow-hidden");
8907
- }
8908
- return /* @__PURE__ */ React__default["default"].createElement("div", {
8909
- style: { display: visible ? "block" : "none" }
9146
+ return /* @__PURE__ */ React__default["default"].createElement(index_cjs.View, {
9147
+ style: { display: visible ? "block" : "none" },
9148
+ catchMove: lockScroll
8910
9149
  }, /* @__PURE__ */ React__default["default"].createElement(DialogWrap, {
8911
9150
  ...props
8912
9151
  }));
@@ -8926,73 +9165,74 @@
8926
9165
  footerDirection: "horizontal",
8927
9166
  lockScroll: false
8928
9167
  };
8929
- const BaseDialog = (props, ref) => {
8930
- const { locale } = useConfig$1();
8931
- const {
8932
- visible,
8933
- footer,
8934
- noOkBtn,
8935
- noCancelBtn,
8936
- lockScroll,
8937
- okBtnDisabled,
8938
- cancelAutoClose,
8939
- okText,
8940
- cancelText,
8941
- onClosed,
8942
- onCancel,
8943
- onOk,
8944
- ...restProps
8945
- } = props;
8946
- const renderFooter = function() {
8947
- if (footer === null)
8948
- return "";
8949
- const handleCancel = function(e2) {
8950
- e2.stopPropagation();
8951
- if (!cancelAutoClose)
8952
- return;
8953
- onClosed == null ? void 0 : onClosed();
8954
- onCancel == null ? void 0 : onCancel();
8955
- if (lockScroll && visible) {
8956
- document.body.classList.remove("nut-overflow-hidden");
8957
- }
8958
- };
8959
- const handleOk = function(e2) {
8960
- e2.stopPropagation();
8961
- onClosed == null ? void 0 : onClosed();
8962
- onOk == null ? void 0 : onOk(e2);
8963
- if (lockScroll && visible) {
8964
- document.body.classList.remove("nut-overflow-hidden");
8965
- }
9168
+ const BaseDialog = React.forwardRef(
9169
+ (props, ref) => {
9170
+ const { locale } = useConfig$1();
9171
+ const {
9172
+ visible,
9173
+ footer,
9174
+ noOkBtn,
9175
+ noCancelBtn,
9176
+ lockScroll,
9177
+ okBtnDisabled,
9178
+ cancelAutoClose,
9179
+ okText,
9180
+ cancelText,
9181
+ onClosed,
9182
+ onCancel,
9183
+ onOk,
9184
+ ...restProps
9185
+ } = props;
9186
+ const renderFooter = function() {
9187
+ if (footer === null)
9188
+ return "";
9189
+ const handleCancel = function(e2) {
9190
+ e2.stopPropagation();
9191
+ if (!cancelAutoClose)
9192
+ return;
9193
+ onClosed == null ? void 0 : onClosed();
9194
+ onCancel == null ? void 0 : onCancel();
9195
+ if (lockScroll && visible) {
9196
+ document.body.classList.remove("nut-overflow-hidden");
9197
+ }
9198
+ };
9199
+ const handleOk = function(e2) {
9200
+ e2.stopPropagation();
9201
+ onClosed == null ? void 0 : onClosed();
9202
+ onOk == null ? void 0 : onOk(e2);
9203
+ if (lockScroll && visible) {
9204
+ document.body.classList.remove("nut-overflow-hidden");
9205
+ }
9206
+ };
9207
+ const footerContent = footer || /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, !noCancelBtn && /* @__PURE__ */ React__default["default"].createElement(Button, {
9208
+ size: "small",
9209
+ plain: true,
9210
+ type: "primary",
9211
+ className: "nut-dialog__footer-cancel",
9212
+ onClick: (e2) => handleCancel(e2)
9213
+ }, cancelText || locale.cancel), !noOkBtn && /* @__PURE__ */ React__default["default"].createElement(Button, {
9214
+ size: "small",
9215
+ type: "primary",
9216
+ className: classNames("nut-dialog__footer-ok", {
9217
+ disabled: okBtnDisabled
9218
+ }),
9219
+ disabled: okBtnDisabled,
9220
+ onClick: (e2) => handleOk(e2)
9221
+ }, okText || locale.confirm));
9222
+ return footerContent;
8966
9223
  };
8967
- const footerContent = footer || /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, !noCancelBtn && /* @__PURE__ */ React__default["default"].createElement(Button, {
8968
- size: "small",
8969
- plain: true,
8970
- type: "primary",
8971
- className: "nut-dialog__footer-cancel",
8972
- onClick: (e2) => handleCancel(e2)
8973
- }, cancelText || locale.cancel), !noOkBtn && /* @__PURE__ */ React__default["default"].createElement(Button, {
8974
- size: "small",
8975
- type: "primary",
8976
- className: classNames("nut-dialog__footer-ok", {
8977
- disabled: okBtnDisabled
8978
- }),
8979
- disabled: okBtnDisabled,
8980
- onClick: (e2) => handleOk(e2)
8981
- }, okText || locale.confirm));
8982
- return footerContent;
8983
- };
8984
- return /* @__PURE__ */ React__default["default"].createElement(DialogWrapper, {
8985
- ...restProps,
8986
- visible,
8987
- lockScroll,
8988
- footer: renderFooter(),
8989
- onClosed,
8990
- onCancel
8991
- });
8992
- };
8993
- const Dialog = React.forwardRef(BaseDialog);
8994
- Dialog.defaultProps = defaultProps$H;
8995
- Dialog.displayName = "NutDialog";
9224
+ return /* @__PURE__ */ React__default["default"].createElement(DialogWrapper, {
9225
+ ...restProps,
9226
+ visible,
9227
+ lockScroll,
9228
+ footer: renderFooter(),
9229
+ onClosed,
9230
+ onCancel
9231
+ });
9232
+ }
9233
+ );
9234
+ BaseDialog.defaultProps = defaultProps$H;
9235
+ BaseDialog.displayName = "NutDialog";
8996
9236
  const defaultProps$G = {
8997
9237
  attract: false,
8998
9238
  direction: void 0,
@@ -14062,6 +14302,19 @@
14062
14302
  const Swipe = React.forwardRef((props, instanceRef) => {
14063
14303
  const swipeBem = cn("swipe");
14064
14304
  const touch = useTouch();
14305
+ Taro.useReady(() => {
14306
+ const getWidth = async () => {
14307
+ if (leftWrapper.current) {
14308
+ const leftRect = await getRectByTaro(leftWrapper.current);
14309
+ setActionWidth((v) => ({ ...v, left: leftRect.width }));
14310
+ }
14311
+ if (rightWrapper.current) {
14312
+ const rightRect = await getRectByTaro(rightWrapper.current);
14313
+ setActionWidth((v) => ({ ...v, right: rightRect.width }));
14314
+ }
14315
+ };
14316
+ Taro.nextTick(() => getWidth());
14317
+ });
14065
14318
  const { children, className, style } = { ...defaultProps$C, ...props };
14066
14319
  const root2 = React.useRef();
14067
14320
  const opened = React.useRef(false);
@@ -14171,6 +14424,7 @@
14171
14424
  const renderActionContent = (side) => {
14172
14425
  if (props[`${side}Action`]) {
14173
14426
  return /* @__PURE__ */ React__default["default"].createElement("div", {
14427
+ id: "left",
14174
14428
  ref: side === "left" ? leftWrapper : rightWrapper,
14175
14429
  className: `${swipeBem(side)}`,
14176
14430
  onClick: (e2) => handleOperate(e2, side)
@@ -14807,6 +15061,7 @@
14807
15061
  AvatarGroup.displayName = "NutAvatarGroup";
14808
15062
  const defaultProps$u = {
14809
15063
  ...ComponentDefaults,
15064
+ className: "",
14810
15065
  value: "",
14811
15066
  dot: false,
14812
15067
  max: 1e4,
@@ -15650,12 +15905,14 @@
15650
15905
  className: "nut-ellipsis-wordbreak"
15651
15906
  }, (_a = ellipsis.current) == null ? void 0 : _a.leading, ((_b = ellipsis.current) == null ? void 0 : _b.leading) && symbol, expandText ? /* @__PURE__ */ React__default["default"].createElement("span", {
15652
15907
  className: "nut-ellipsis-text",
15653
- onClick: () => {
15908
+ onClick: (e2) => {
15909
+ e2.stopPropagation();
15654
15910
  clickHandle(1);
15655
15911
  }
15656
15912
  }, expandText) : null, ((_c = ellipsis.current) == null ? void 0 : _c.tailing) && symbol, (_d = ellipsis.current) == null ? void 0 : _d.tailing)) : null, exceeded && expanded ? /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, content, expandText ? /* @__PURE__ */ React__default["default"].createElement("span", {
15657
15913
  className: "nut-ellipsis-text",
15658
- onClick: () => {
15914
+ onClick: (e2) => {
15915
+ e2.stopPropagation();
15659
15916
  clickHandle(2);
15660
15917
  }
15661
15918
  }, collapseText) : null) : null)), /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -17017,7 +17274,7 @@
17017
17274
  style: getStyle()
17018
17275
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
17019
17276
  className: `${popoverArrow}`
17020
- }), Array.isArray(children) ? children[1] : "", list.map((item, i) => {
17277
+ }), Array.isArray(children) ? children[1] : "", /* @__PURE__ */ React__default["default"].createElement("div", null, " ", list.map((item, i) => {
17021
17278
  return /* @__PURE__ */ React__default["default"].createElement("div", {
17022
17279
  key: item.name,
17023
17280
  className: `popover-menu-item ${item.disabled ? "disabled" : ""}`,
@@ -17032,7 +17289,7 @@
17032
17289
  }) : "", /* @__PURE__ */ React__default["default"].createElement("div", {
17033
17290
  className: "popover-menu-item-name"
17034
17291
  }, item.name));
17035
- })) : null))), visible ? /* @__PURE__ */ React__default["default"].createElement(Overlay, {
17292
+ }))) : null))), visible ? /* @__PURE__ */ React__default["default"].createElement(Overlay, {
17036
17293
  visible,
17037
17294
  onClick: (e2) => handleClick(e2),
17038
17295
  style: { background: "transparent" }
@@ -18678,7 +18935,7 @@
18678
18935
  barrageList: [],
18679
18936
  frequency: 500,
18680
18937
  loop: true,
18681
- speeds: 2e3,
18938
+ speeds: 3e3,
18682
18939
  rows: 3,
18683
18940
  top: 10
18684
18941
  };
@@ -18696,49 +18953,65 @@
18696
18953
  ...defaultProps$5,
18697
18954
  ...props
18698
18955
  };
18956
+ const [styleList, setStyleList] = React.useState([]);
18957
+ const [baItemList, setBaItemList] = React.useState(barrageList);
18958
+ const barrageListSet = React.useRef(barrageList);
18699
18959
  const barrageBody = React.useRef(null);
18700
18960
  const barrageContainer = React.useRef(null);
18961
+ const timeId = React.useRef(new Date().getTime());
18701
18962
  const timer = React.useRef(0);
18702
- const index = React.useRef(0);
18963
+ React.useRef(0);
18703
18964
  const b2 = cn("barrage");
18704
- const classes = classNames(className, b2(""));
18965
+ const classes = classNames(className, b2(""), {
18966
+ [`nut-barrage__body${timeId.current}`]: true
18967
+ });
18705
18968
  React.useImperativeHandle(ref, () => ({
18706
18969
  add: (word) => {
18707
- const _index = index.current % barrageList.length;
18708
- barrageList.splice(_index, 0, word);
18970
+ barrageListSet.current = [...barrageListSet.current, word];
18971
+ run();
18709
18972
  }
18710
18973
  }));
18711
18974
  React.useEffect(() => {
18975
+ barrageListSet.current = [...barrageList];
18712
18976
  run();
18713
18977
  return () => {
18714
18978
  clearInterval(timer.current);
18715
18979
  };
18716
18980
  }, [barrageList]);
18717
18981
  const run = () => {
18718
- clearInterval(timer.current);
18719
- timer.current = window.setInterval(() => {
18720
- play();
18721
- run();
18722
- }, frequency);
18723
- };
18724
- const play = async () => {
18725
- const _index = loop2 ? index.current % barrageList.length : index.current;
18726
- const el = document.createElement(`div`);
18727
- el.innerHTML = barrageList[_index];
18728
- el.classList.add("barrage-item");
18729
- barrageContainer.current.appendChild(el);
18730
- Taro.createSelectorQuery().select(".barrage-item").boundingClientRect((res) => {
18731
- console.log("res", res);
18732
- const height = res == null ? void 0 : res.height;
18733
- el.classList.add("move");
18734
- el.style.animationDuration = `${speeds}ms`;
18735
- el.style.top = `${_index % rows * (height + top) + 20}px`;
18736
- el.dataset.index = `${_index}`;
18737
- el.addEventListener("animationend", () => {
18738
- barrageContainer.current.removeChild(el);
18982
+ setBaItemList(barrageListSet.current);
18983
+ barrageListSet.current.forEach((item, index2) => {
18984
+ getNode(index2);
18985
+ });
18986
+ };
18987
+ const getNode = (index2) => {
18988
+ const query = Taro.createSelectorQuery();
18989
+ setTimeout(() => {
18990
+ let width = 100;
18991
+ query.select(".nut-barrage__body" + timeId.current).boundingClientRect((rec) => {
18992
+ width = rec.width || 300;
18739
18993
  });
18740
- index.current++;
18741
- }).exec();
18994
+ query.select(".nut-barrage__item" + index2).boundingClientRect((recs) => {
18995
+ let height = recs.height;
18996
+ let nodeTop = index2 % rows * (height + top) + 20 + "px";
18997
+ styleInfo(index2, nodeTop, width);
18998
+ }).exec();
18999
+ }, 500);
19000
+ };
19001
+ const styleInfo = (index2, nodeTop, width) => {
19002
+ let timeIndex = index2 - rows > 0 ? index2 - rows : 0;
19003
+ let list = styleList;
19004
+ let time = list[timeIndex] ? Number(list[timeIndex]["--time"]) : 0;
19005
+ let obj = {
19006
+ top: nodeTop,
19007
+ "--time": `${frequency * index2 + time}`,
19008
+ animationDuration: `${speeds}ms`,
19009
+ animationIterationCount: `${loop2 ? "infinite" : 1}`,
19010
+ animationDelay: `${frequency * index2 + time}ms`,
19011
+ "--move-distance": `-${width}px`
19012
+ };
19013
+ list.push(obj);
19014
+ setStyleList([...list]);
18742
19015
  };
18743
19016
  return /* @__PURE__ */ React__default["default"].createElement("div", {
18744
19017
  className: classes,
@@ -18747,7 +19020,12 @@
18747
19020
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
18748
19021
  ref: barrageContainer,
18749
19022
  className: "bContainer"
18750
- }));
19023
+ }, baItemList.map((item, index2) => {
19024
+ return /* @__PURE__ */ React__default["default"].createElement("div", {
19025
+ className: `barrage-item nut-barrage__item${index2} move`,
19026
+ style: styleList[index2]
19027
+ }, item.length > 8 ? item.substr(0, 8) + "..." : item);
19028
+ })));
18751
19029
  };
18752
19030
  const Barrage = React__default["default"].forwardRef(InternalBarrage);
18753
19031
  Barrage.defaultProps = defaultProps$5;
@@ -19228,7 +19506,7 @@
19228
19506
  exports2.ConfigProvider = ConfigProvider;
19229
19507
  exports2.CountDown = CountDown;
19230
19508
  exports2.DatePicker = DatePicker;
19231
- exports2.Dialog = Dialog;
19509
+ exports2.Dialog = BaseDialog;
19232
19510
  exports2.Divider = Divider;
19233
19511
  exports2.Drag = Drag;
19234
19512
  exports2.Elevator = Elevator;