@nutui/nutui-react-taro 2.6.20 → 2.6.22

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 (66) hide show
  1. package/CHANGELOG.md +30 -5
  2. package/dist/esm/Address.js +1 -1
  3. package/dist/esm/AnimatingNumbers.js +7 -7
  4. package/dist/esm/Audio/style/style.css +1 -1
  5. package/dist/esm/Audio.js +1 -1
  6. package/dist/esm/Avatar.js +1 -1
  7. package/dist/esm/AvatarCropper.js +1 -1
  8. package/dist/esm/BackTop.js +1 -1
  9. package/dist/esm/Barrage.js +1 -1
  10. package/dist/esm/Button.js +1 -1
  11. package/dist/esm/Calendar.js +1 -1
  12. package/dist/esm/CalendarItem.js +1 -1
  13. package/dist/esm/Cascader.js +1 -1
  14. package/dist/esm/Dialog.js +1 -1
  15. package/dist/esm/Empty.js +1 -1
  16. package/dist/esm/Menu.js +1 -1
  17. package/dist/esm/MenuItem.js +1 -1
  18. package/dist/esm/NavBar/style/style.css +1 -1
  19. package/dist/esm/NavBar.js +1 -1
  20. package/dist/esm/Radio.js +1 -1
  21. package/dist/esm/RadioGroup.js +1 -1
  22. package/dist/esm/Range/style/style.css +1 -1
  23. package/dist/esm/Range.js +1 -1
  24. package/dist/esm/Skeleton.js +1 -1
  25. package/dist/esm/Tabs.js +1 -1
  26. package/dist/esm/Uploader.js +1 -1
  27. package/dist/esm/{address.taro-CWr6jIYg.js → address.taro-Ai6DQF3D.js} +1 -1
  28. package/dist/esm/{audio.taro--yoX2oyx.js → audio.taro-qK1wq4IH.js} +4 -5
  29. package/dist/esm/avatar.taro-9dU2KeWv.js +82 -0
  30. package/dist/esm/{avatarcropper.taro-B0I9uLNp.js → avatarcropper.taro-meD2sizv.js} +1 -1
  31. package/dist/esm/{backtop.taro-CpzSXDW3.js → backtop.taro-D3Lo3jFO.js} +8 -10
  32. package/dist/esm/{barrage.taro-CA-9uADD.js → barrage.taro-D2lmvcB-.js} +40 -26
  33. package/dist/esm/{button.taro-1kEru6r9.js → button.taro-CixO32Hw.js} +2 -2
  34. package/dist/esm/{calendar.taro-Csq-7imv.js → calendar.taro-C52T1TFf.js} +1 -1
  35. package/dist/esm/{calendaritem.taro-BOMJjsx9.js → calendaritem.taro-CHdJXKkc.js} +1 -1
  36. package/dist/esm/{cascader.taro-DZ_oBTm0.js → cascader.taro-CMOCzo0m.js} +1 -1
  37. package/dist/esm/{dialog.taro-Bg730q8d.js → dialog.taro-yjDaaRHA.js} +1 -1
  38. package/dist/esm/{empty.taro-Dr4eSaDg.js → empty.taro-Dt07kty5.js} +1 -1
  39. package/dist/esm/{menu.taro-BFc4uUxG.js → menu.taro-BmjnA_YM.js} +13 -13
  40. package/dist/esm/{menuitem.taro-D6KQvdRw.js → menuitem.taro-DCqPC4Nu.js} +13 -13
  41. package/dist/esm/{navbar.taro-Dea0-s9Q.js → navbar.taro-HRFRDGii.js} +7 -2
  42. package/dist/esm/nutui-react.es.js +20 -20
  43. package/dist/esm/{radio.taro-CzOHqD3O.js → radio.taro-M2in687s.js} +24 -20
  44. package/dist/esm/{raf-zwv-SBjP.js → raf-Di10dXPS.js} +2 -1
  45. package/dist/esm/{range.taro-BilM3sMH.js → range.taro-D4U2Q7Wx.js} +49 -44
  46. package/dist/esm/{skeleton.taro-bD6fHZop.js → skeleton.taro-D9Vkgsyx.js} +1 -1
  47. package/dist/esm/{tabs.taro-CJiI4q_-.js → tabs.taro-D8bDfm4x.js} +1 -1
  48. package/dist/esm/{uploader.taro-C-8Jf7un.js → uploader.taro-CceZ5Y4t.js} +8 -7
  49. package/dist/locales/base.js +1 -1
  50. package/dist/locales/en-US.js +1 -1
  51. package/dist/locales/id-ID.js +1 -1
  52. package/dist/locales/tr-TR.js +1 -1
  53. package/dist/locales/zh-CN.js +1 -1
  54. package/dist/locales/zh-TW.js +1 -1
  55. package/dist/locales/zh-UG.js +1 -1
  56. package/dist/nutui.react.es.js +262 -284
  57. package/dist/nutui.react.umd.js +262 -284
  58. package/dist/packages/navbar/navbar.scss +0 -5
  59. package/dist/packages/range/range.scss +2 -0
  60. package/dist/style.css +1 -1
  61. package/dist/types/packages/avatar/avatar.d.ts +1 -1
  62. package/dist/types/packages/overlay/overlay.d.ts +1 -1
  63. package/dist/types/packages/uploader/uploader.d.ts +1 -0
  64. package/dist/types/packages/uploader/uploader.taro.d.ts +5 -0
  65. package/package.json +1 -1
  66. package/dist/esm/avatar.taro-DSL3ErmC.js +0 -85
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.6.20 Fri Sep 20 2024 13:48:55 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.6.22 Sat Oct 12 2024 15:01:29 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -304,7 +304,7 @@ const Button = React__default.forwardRef(
304
304
  };
305
305
  const getStyle = useCallback(() => {
306
306
  const style2 = {};
307
- if (props.color) {
307
+ if (color) {
308
308
  if (props.fill === "outline" || props.fill === "dashed") {
309
309
  style2.color = color;
310
310
  if (!(color == null ? void 0 : color.includes("gradient"))) {
@@ -317,7 +317,7 @@ const Button = React__default.forwardRef(
317
317
  }
318
318
  }
319
319
  return style2;
320
- }, [color]);
320
+ }, [color, props.fill]);
321
321
  const handleClick = (e2) => {
322
322
  if (!loading && !disabled && onClick) {
323
323
  onClick(e2);
@@ -3945,7 +3945,7 @@ function useWatch(dep, callback, config2 = { immediate: false }) {
3945
3945
  stop.current = true;
3946
3946
  };
3947
3947
  }
3948
- const inBrowser = typeof document !== "undefined" && !!document.scripts;
3948
+ const inBrowser$1 = typeof document !== "undefined" && !!document.scripts;
3949
3949
  function isWindow(val) {
3950
3950
  return val === window;
3951
3951
  }
@@ -3987,7 +3987,7 @@ function makeRect(width, height) {
3987
3987
  }
3988
3988
  const getRectByTaro = async (element) => {
3989
3989
  if (element) {
3990
- if (inBrowser) {
3990
+ if (inBrowser$1) {
3991
3991
  return Promise.resolve(getRect(element));
3992
3992
  }
3993
3993
  return new Promise((resolve, reject) => {
@@ -4152,11 +4152,16 @@ const BackTop = (props) => {
4152
4152
  ...props
4153
4153
  };
4154
4154
  const classPrefix2 = "nut-backtop";
4155
- const [backTop, SetBackTop] = useState(false);
4156
- usePageScroll((res) => {
4157
- const { scrollTop } = res;
4158
- scrollTop >= threshold ? SetBackTop(true) : SetBackTop(false);
4159
- });
4155
+ const [backTop, setBackTop] = useState(false);
4156
+ const cls = classNames(classPrefix2, { show: backTop }, className);
4157
+ const handleScroll = useCallback(
4158
+ (res) => {
4159
+ const { scrollTop } = res;
4160
+ setBackTop(scrollTop >= threshold);
4161
+ },
4162
+ [threshold]
4163
+ );
4164
+ usePageScroll(handleScroll);
4160
4165
  const goTop = (e2) => {
4161
4166
  onClick && onClick(e2);
4162
4167
  pageScrollTo({
@@ -4172,23 +4177,7 @@ const BackTop = (props) => {
4172
4177
  bottom: "20px",
4173
4178
  zIndex
4174
4179
  };
4175
- return /* @__PURE__ */ React__default.createElement(
4176
- "div",
4177
- {
4178
- className: classNames(
4179
- classPrefix2,
4180
- {
4181
- show: backTop
4182
- },
4183
- className
4184
- ),
4185
- style: styles,
4186
- onClick: (e2) => {
4187
- goTop(e2);
4188
- }
4189
- },
4190
- children || /* @__PURE__ */ React__default.createElement(N, { size: 19, className: "nut-backtop-main" })
4191
- );
4180
+ return /* @__PURE__ */ React__default.createElement("div", { className: cls, style: styles, onClick: (e2) => goTop(e2) }, children || /* @__PURE__ */ React__default.createElement(N, { size: 19, className: "nut-backtop-main" }));
4192
4181
  };
4193
4182
  BackTop.displayName = "NutBackTop";
4194
4183
  const elevatorContext = createContext({});
@@ -4612,11 +4601,10 @@ const NavBar = (props) => {
4612
4601
  };
4613
4602
  const classes = classNames({
4614
4603
  [`${classPrefix2}-fixed`]: fixed,
4615
- [`${classPrefix2}-safe-area-inset-top`]: safeAreaInsetTop,
4616
4604
  [`${classPrefix2}-title-align-${titleAlign}`]: true
4617
4605
  });
4618
4606
  const cls = classNames(classPrefix2, classes, className);
4619
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, fixed && placeholder ? /* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
4607
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, safeAreaInsetTop && /* @__PURE__ */ React__default.createElement(SafeArea, { position: "top" }), fixed && placeholder ? /* @__PURE__ */ React__default.createElement(View, { className: `${classPrefix2}-placeholder` }, renderWrapper()) : renderWrapper());
4620
4608
  };
4621
4609
  NavBar.displayName = "NutNavBar";
4622
4610
  const defaultProps$1f = {
@@ -5204,8 +5192,9 @@ const TabPane = (props) => {
5204
5192
  );
5205
5193
  return children ? /* @__PURE__ */ React__default.createElement("div", { className: classes }, !disabled && children) : null;
5206
5194
  };
5195
+ const inBrowser = typeof window !== "undefined";
5207
5196
  function requestAniFrame() {
5208
- if (typeof window !== "undefined") {
5197
+ if (inBrowser) {
5209
5198
  const _window = window;
5210
5199
  return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
5211
5200
  _window.setTimeout(callback, 1e3 / 60);
@@ -10759,9 +10748,19 @@ const MenuItem = forwardRef((props, ref) => {
10759
10748
  useEffect(() => {
10760
10749
  setShowPopup(show2);
10761
10750
  }, [show2]);
10751
+ const getParentOffset = useCallback(() => {
10752
+ setTimeout(async () => {
10753
+ const p = parent.menuRef.current;
10754
+ const rect = await getRectByTaro(p);
10755
+ setPosition({
10756
+ height: rect.height,
10757
+ top: rect.top
10758
+ });
10759
+ }, 100);
10760
+ }, [parent.menuRef]);
10762
10761
  useEffect(() => {
10763
10762
  getParentOffset();
10764
- }, [showPopup]);
10763
+ }, [showPopup, getParentOffset]);
10765
10764
  const windowHeight = useMemo$1(() => getSystemInfoSync().windowHeight, []);
10766
10765
  const updateItemOffset = useCallback(() => {
10767
10766
  if (!parent.lockScroll) return;
@@ -10774,7 +10773,7 @@ const MenuItem = forwardRef((props, ref) => {
10774
10773
  });
10775
10774
  }
10776
10775
  });
10777
- }, [direction, windowHeight]);
10776
+ }, [direction, windowHeight, parent.lockScroll, parent.menuRef]);
10778
10777
  usePageScroll(updateItemOffset);
10779
10778
  useImperativeHandle(ref, () => ({
10780
10779
  toggle: (s) => {
@@ -10802,16 +10801,6 @@ const MenuItem = forwardRef((props, ref) => {
10802
10801
  top: 0,
10803
10802
  height: 0
10804
10803
  });
10805
- const getParentOffset = () => {
10806
- setTimeout(async () => {
10807
- const p = parent.menuRef.current;
10808
- const rect = await getRectByTaro(p);
10809
- setPosition({
10810
- height: rect.height,
10811
- top: rect.top
10812
- });
10813
- }, 100);
10814
- };
10815
10804
  const isShow = () => {
10816
10805
  if (showPopup) return {};
10817
10806
  return { display: "none" };
@@ -10956,24 +10945,29 @@ const Menu = (props) => {
10956
10945
  ...props
10957
10946
  };
10958
10947
  const menuRef = useRef(null);
10948
+ const [showMenuItem, setShowMenuItem] = useState([]);
10949
+ const [menuItemTitle, setMenuItemTitle] = useState([]);
10959
10950
  const [isScrollFixed, setIsScrollFixed] = useState(false);
10951
+ const cls = classNames(`nut-menu`, className, {
10952
+ "scroll-fixed": isScrollFixed
10953
+ });
10960
10954
  const getScrollTop = (el) => {
10961
- return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
10955
+ return Math.max(
10956
+ 0,
10957
+ el === window ? window.scrollY : el.scrollTop
10958
+ );
10962
10959
  };
10963
- const onScroll = () => {
10964
- const { scrollFixed: scrollFixed2 } = props;
10960
+ const onScroll = useCallback(() => {
10965
10961
  const scrollTop = getScrollTop(window);
10966
- const isFixed = scrollTop > (typeof scrollFixed2 === "boolean" ? 30 : Number(scrollFixed2));
10962
+ const isFixed = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
10967
10963
  setIsScrollFixed(isFixed);
10968
- };
10964
+ }, [scrollFixed]);
10969
10965
  useEffect(() => {
10970
10966
  if (scrollFixed) {
10971
10967
  window.addEventListener("scroll", onScroll);
10972
10968
  }
10973
10969
  return () => window.removeEventListener("scroll", onScroll);
10974
- }, []);
10975
- const [showMenuItem, setShowMenuItem] = useState([]);
10976
- const [menuItemTitle, setMenuItemTitle] = useState([]);
10970
+ }, [scrollFixed, onScroll]);
10977
10971
  const toggleMenuItem = (index, from = "NORMAL") => {
10978
10972
  showMenuItem[index] = !showMenuItem[index];
10979
10973
  if (showMenuItem[index]) {
@@ -11076,26 +11070,15 @@ const Menu = (props) => {
11076
11070
  return null;
11077
11071
  });
11078
11072
  };
11079
- return /* @__PURE__ */ React__default.createElement(
11073
+ return /* @__PURE__ */ React__default.createElement("div", { ...rest, className: cls, ref: menuRef }, /* @__PURE__ */ React__default.createElement(
11080
11074
  "div",
11081
11075
  {
11082
- ...rest,
11083
- className: classNames(`nut-menu`, className, {
11084
- "scroll-fixed": isScrollFixed
11085
- }),
11086
- ref: menuRef
11076
+ className: classNames("nut-menu-bar", {
11077
+ opened: showMenuItem.includes(true)
11078
+ })
11087
11079
  },
11088
- /* @__PURE__ */ React__default.createElement(
11089
- "div",
11090
- {
11091
- className: classNames("nut-menu-bar", {
11092
- opened: showMenuItem.includes(true)
11093
- })
11094
- },
11095
- menuTitle()
11096
- ),
11097
- cloneChildren()
11098
- );
11080
+ menuTitle()
11081
+ ), cloneChildren());
11099
11082
  };
11100
11083
  Menu.displayName = "NutMenu";
11101
11084
  Menu.Item = MenuItem;
@@ -11286,6 +11269,13 @@ const RadioGroup = React__default.forwardRef(
11286
11269
  disabled,
11287
11270
  ...rest
11288
11271
  } = { ...defaultProps$R, ...props };
11272
+ const cls = classNames(
11273
+ classPrefix$g,
11274
+ {
11275
+ [`${classPrefix$g}-${props.direction}`]: props.direction
11276
+ },
11277
+ className
11278
+ );
11289
11279
  const [val2State, setVal2State] = usePropsValue({
11290
11280
  defaultValue: props.defaultValue,
11291
11281
  value: props.value,
@@ -11308,7 +11298,7 @@ const RadioGroup = React__default.forwardRef(
11308
11298
  }
11309
11299
  );
11310
11300
  });
11311
- }, [options]);
11301
+ }, [options, labelPosition, val2State]);
11312
11302
  return /* @__PURE__ */ React__default.createElement(
11313
11303
  RadioContext.Provider,
11314
11304
  {
@@ -11325,20 +11315,7 @@ const RadioGroup = React__default.forwardRef(
11325
11315
  }
11326
11316
  }
11327
11317
  },
11328
- /* @__PURE__ */ React__default.createElement(
11329
- "div",
11330
- {
11331
- className: classNames(
11332
- classPrefix$g,
11333
- {
11334
- [`${classPrefix$g}-${props.direction}`]: props.direction
11335
- },
11336
- className
11337
- ),
11338
- ...rest
11339
- },
11340
- (options == null ? void 0 : options.length) ? renderOptionsChildren() : children
11341
- )
11318
+ /* @__PURE__ */ React__default.createElement("div", { className: cls, ...rest }, (options == null ? void 0 : options.length) ? renderOptionsChildren() : children)
11342
11319
  );
11343
11320
  }
11344
11321
  );
@@ -11396,29 +11373,6 @@ const Radio = (props) => {
11396
11373
  }
11397
11374
  };
11398
11375
  }
11399
- const renderLabel = () => {
11400
- return /* @__PURE__ */ React__default.createElement(
11401
- "div",
11402
- {
11403
- className: classNames(`${classPrefix2}-label`, {
11404
- [`${classPrefix2}-label-disabled`]: disabled
11405
- })
11406
- },
11407
- children
11408
- );
11409
- };
11410
- const renderButton = () => {
11411
- return /* @__PURE__ */ React__default.createElement(
11412
- "div",
11413
- {
11414
- className: classNames(`${classPrefix2}-button`, {
11415
- [`${classPrefix2}-button-active`]: checkedStatement,
11416
- [`${classPrefix2}-button-disabled`]: disabled
11417
- })
11418
- },
11419
- children
11420
- );
11421
- };
11422
11376
  const color = () => {
11423
11377
  return {
11424
11378
  [`${classPrefix2}-icon-disabled`]: disabled,
@@ -11442,8 +11396,21 @@ const Radio = (props) => {
11442
11396
  className: classNames(color())
11443
11397
  }) : /* @__PURE__ */ React__default.createElement(A, { className: classNames(color()) });
11444
11398
  };
11399
+ const renderLabel = () => {
11400
+ const labelcls = classNames(`${classPrefix2}-label`, {
11401
+ [`${classPrefix2}-label-disabled`]: disabled
11402
+ });
11403
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), /* @__PURE__ */ React__default.createElement("div", { className: labelcls }, children));
11404
+ };
11405
+ const renderButton = () => {
11406
+ const buttoncls = classNames(`${classPrefix2}-button`, {
11407
+ [`${classPrefix2}-button-active`]: checkedStatement,
11408
+ [`${classPrefix2}-button-disabled`]: disabled
11409
+ });
11410
+ return /* @__PURE__ */ React__default.createElement("div", { className: buttoncls }, children);
11411
+ };
11445
11412
  const renderByShape = (shape2) => {
11446
- return shape2 === "button" ? renderButton() : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
11413
+ return shape2 === "button" ? renderButton() : renderLabel();
11447
11414
  };
11448
11415
  const renderRadioItem = () => {
11449
11416
  return renderByShape(context && context.shape ? context.shape : shape);
@@ -11452,22 +11419,14 @@ const Radio = (props) => {
11452
11419
  if (disabled || checkedStatement) return;
11453
11420
  setCheckedStatement(!checkedStatement);
11454
11421
  };
11455
- return /* @__PURE__ */ React__default.createElement(
11456
- "div",
11422
+ const cls = classNames(
11423
+ classPrefix2,
11457
11424
  {
11458
- className: classNames(
11459
- classPrefix2,
11460
- {
11461
- [`${classPrefix2}-reverse`]: labelPosition === "left"
11462
- },
11463
- className
11464
- ),
11465
- style,
11466
- onClick: handleClick,
11467
- ...rest
11425
+ [`${classPrefix2}-reverse`]: labelPosition === "left"
11468
11426
  },
11469
- renderRadioItem()
11427
+ className
11470
11428
  );
11429
+ return /* @__PURE__ */ React__default.createElement("div", { className: cls, style, onClick: handleClick, ...rest }, renderRadioItem());
11471
11430
  };
11472
11431
  Radio.displayName = "NutRadio";
11473
11432
  Radio.Group = RadioGroup;
@@ -11489,9 +11448,6 @@ const Range = (props) => {
11489
11448
  button,
11490
11449
  vertical,
11491
11450
  marks,
11492
- onChange,
11493
- onStart,
11494
- onEnd,
11495
11451
  minDescription,
11496
11452
  maxDescription,
11497
11453
  currentDescription,
@@ -11499,7 +11455,10 @@ const Range = (props) => {
11499
11455
  max,
11500
11456
  step,
11501
11457
  value,
11502
- defaultValue
11458
+ defaultValue,
11459
+ onChange,
11460
+ onStart,
11461
+ onEnd
11503
11462
  } = { ...defaultProps$P, ...props };
11504
11463
  const classPrefix2 = "nut-range";
11505
11464
  const [buttonIndex, setButtonIndex] = useState(0);
@@ -11517,7 +11476,7 @@ const Range = (props) => {
11517
11476
  finalValue: 0,
11518
11477
  onChange: handleChange
11519
11478
  });
11520
- const [exactValue, setEaxctValue] = useState(
11479
+ const [exactValue, setExactValue] = useState(
11521
11480
  () => value || defaultValue || 0
11522
11481
  );
11523
11482
  const marksRef = useRef({});
@@ -11535,10 +11494,7 @@ const Range = (props) => {
11535
11494
  setMarksList(list);
11536
11495
  }
11537
11496
  }
11538
- }, [marks]);
11539
- const scope = () => {
11540
- return max - min;
11541
- };
11497
+ }, [marks, max, min]);
11542
11498
  const classes = classNames(classPrefix2, {
11543
11499
  [`${classPrefix2}-disabled`]: disabled,
11544
11500
  [`${classPrefix2}-vertical`]: vertical
@@ -11550,41 +11506,38 @@ const Range = (props) => {
11550
11506
  },
11551
11507
  className
11552
11508
  );
11553
- const markClassName = useCallback(
11554
- (mark) => {
11555
- const classPrefix22 = "nut-range-mark";
11556
- let lowerBound = min;
11557
- let upperBound = max;
11558
- if (range3 && Array.isArray(current)) {
11559
- lowerBound = current[0];
11560
- upperBound = current[1];
11561
- } else {
11562
- upperBound = current;
11563
- }
11564
- const isActive = mark <= upperBound && mark >= lowerBound;
11565
- return [
11566
- `${classPrefix22}-text`,
11567
- `${isActive ? `${classPrefix22}-text-active` : ""}`
11568
- ].join(" ");
11569
- },
11570
- [range3, current, min, max]
11571
- );
11509
+ const markClassName = (mark) => {
11510
+ const classPrefix22 = "nut-range-mark";
11511
+ let lowerBound = min;
11512
+ let upperBound = max;
11513
+ if (range3 && Array.isArray(current)) {
11514
+ lowerBound = current[0];
11515
+ upperBound = current[1];
11516
+ } else {
11517
+ upperBound = current;
11518
+ }
11519
+ const isActive = mark <= upperBound && mark >= lowerBound;
11520
+ return [
11521
+ `${classPrefix22}-text`,
11522
+ `${isActive ? `${classPrefix22}-text-active` : ""}`
11523
+ ].join(" ");
11524
+ };
11572
11525
  const isRange = (val) => {
11573
11526
  return !!range3 && Array.isArray(val);
11574
11527
  };
11528
+ const scope = useMemo$1(() => {
11529
+ if (max < min || max === min) {
11530
+ console.log("max 的值需要大于 min的值");
11531
+ }
11532
+ return max - min;
11533
+ }, [max, min]);
11575
11534
  const calcMainAxis = () => {
11576
11535
  const modelVal = current;
11577
- if (isRange(modelVal)) {
11578
- return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
11579
- }
11580
- return `${(modelVal - min) * 100 / scope()}%`;
11536
+ return isRange(modelVal) ? `${(modelVal[1] - modelVal[0]) * 100 / scope}%` : `${(modelVal - min) * 100 / scope}%`;
11581
11537
  };
11582
11538
  const calcOffset = () => {
11583
11539
  const modelVal = current;
11584
- if (isRange(modelVal)) {
11585
- return `${(modelVal[0] - min) * 100 / scope()}%`;
11586
- }
11587
- return `0%`;
11540
+ return isRange(modelVal) ? `${(modelVal[0] - min) * 100 / scope}%` : `0%`;
11588
11541
  };
11589
11542
  const barStyle = () => {
11590
11543
  if (vertical) {
@@ -11604,11 +11557,11 @@ const Range = (props) => {
11604
11557
  const marksStyle = (mark) => {
11605
11558
  const dir = rtl ? "right" : "left";
11606
11559
  let style = {
11607
- [dir]: `${(mark - min) / scope() * 100}%`
11560
+ [dir]: `${(mark - min) / scope * 100}%`
11608
11561
  };
11609
11562
  if (vertical) {
11610
11563
  style = {
11611
- top: `${(mark - min) / scope() * 100}%`
11564
+ top: `${(mark - min) / scope * 100}%`
11612
11565
  };
11613
11566
  }
11614
11567
  return style;
@@ -11655,8 +11608,8 @@ const Range = (props) => {
11655
11608
  delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
11656
11609
  total = rect.height;
11657
11610
  }
11658
- const value2 = min + delta / total * scope();
11659
- setEaxctValue(current);
11611
+ const value2 = min + delta / total * scope;
11612
+ setExactValue(current);
11660
11613
  if (isRange(current)) {
11661
11614
  const [left2, right2] = current;
11662
11615
  const middle = (left2 + right2) / 2;
@@ -11674,7 +11627,7 @@ const Range = (props) => {
11674
11627
  return;
11675
11628
  }
11676
11629
  touch.start(event);
11677
- setEaxctValue(current);
11630
+ setExactValue(current);
11678
11631
  if (isRange(current)) {
11679
11632
  setStartValue(current.map(format2));
11680
11633
  } else {
@@ -11695,12 +11648,12 @@ const Range = (props) => {
11695
11648
  if (!rect) return;
11696
11649
  let delta = touch.deltaX.current;
11697
11650
  let total = rect.width;
11698
- let diff = delta / total * scope();
11651
+ let diff = delta / total * scope;
11699
11652
  diff = rtl ? -diff : diff;
11700
11653
  if (vertical) {
11701
11654
  delta = touch.deltaY.current;
11702
11655
  total = rect.height;
11703
- diff = delta / total * scope();
11656
+ diff = delta / total * scope;
11704
11657
  }
11705
11658
  let newValue;
11706
11659
  if (isRange(startValue)) {
@@ -11709,7 +11662,7 @@ const Range = (props) => {
11709
11662
  } else {
11710
11663
  newValue = startValue + diff;
11711
11664
  }
11712
- setEaxctValue(newValue);
11665
+ setExactValue(newValue);
11713
11666
  updateValue(newValue);
11714
11667
  };
11715
11668
  const onTouchEnd = () => {
@@ -11729,57 +11682,65 @@ const Range = (props) => {
11729
11682
  const renderButton = (index) => {
11730
11683
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, button || /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-button" }, currentDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "number" }, currentDescription ? currentDescription(curValue(index)) : curValue(index))));
11731
11684
  };
11732
- return /* @__PURE__ */ React__default.createElement("div", { className: containerClasses }, minDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "min" }, minDescription || min), /* @__PURE__ */ React__default.createElement("div", { ref: root2, className: classes, onClick: (e2) => click(e2) }, marksList.length > 0 && /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
11733
- return /* @__PURE__ */ React__default.createElement(
11734
- "span",
11735
- {
11736
- key: mark,
11737
- className: markClassName(mark),
11738
- style: marksStyle(mark)
11739
- },
11740
- Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
11741
- /* @__PURE__ */ React__default.createElement(
11742
- "span",
11685
+ const renderRangeButton = () => {
11686
+ return [0, 1].map((item, index) => {
11687
+ const cls = `${index === 0 ? "nut-range-button-wrapper-left" : ""}
11688
+ ${index === 1 ? "nut-range-button-wrapper-right" : ""}`;
11689
+ return /* @__PURE__ */ React__default.createElement(
11690
+ "div",
11743
11691
  {
11744
- className: classNames("nut-range-tick", {
11745
- active: tickClass(mark)
11746
- })
11747
- }
11748
- )
11749
- );
11750
- })), /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-bar", style: barStyle() }, range3 ? [0, 1].map((item, index) => {
11751
- return /* @__PURE__ */ React__default.createElement(
11752
- "div",
11753
- {
11754
- key: index,
11755
- className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
11756
- ${index === 1 ? "nut-range-button-wrapper-right" : ""}`,
11757
- onTouchStart: (e2) => {
11758
- if (typeof index === "number") {
11692
+ key: index,
11693
+ className: cls,
11694
+ onTouchStart: (e2) => {
11759
11695
  setButtonIndex(index);
11760
- }
11761
- onTouchStart(e2);
11696
+ onTouchStart(e2);
11697
+ },
11698
+ onTouchMove,
11699
+ onTouchEnd,
11700
+ onTouchCancel: onTouchEnd,
11701
+ onClick: (e2) => e2.stopPropagation()
11762
11702
  },
11763
- onTouchMove: (e2) => onTouchMove(e2),
11703
+ renderButton(index)
11704
+ );
11705
+ });
11706
+ };
11707
+ const renderSingleButton = () => {
11708
+ return /* @__PURE__ */ React__default.createElement(
11709
+ View,
11710
+ {
11711
+ catchMove: true,
11712
+ className: "nut-range-button-wrapper",
11713
+ onTouchStart,
11714
+ onTouchMove,
11764
11715
  onTouchEnd,
11765
11716
  onTouchCancel: onTouchEnd,
11766
11717
  onClick: (e2) => e2.stopPropagation()
11767
11718
  },
11768
- renderButton(index)
11719
+ renderButton()
11769
11720
  );
11770
- }) : /* @__PURE__ */ React__default.createElement(
11771
- View,
11772
- {
11773
- catchMove: true,
11774
- className: "nut-range-button-wrapper",
11775
- onTouchStart: (e2) => onTouchStart(e2),
11776
- onTouchMove: (e2) => onTouchMove(e2),
11777
- onTouchEnd,
11778
- onTouchCancel: onTouchEnd,
11779
- onClick: (e2) => e2.stopPropagation()
11780
- },
11781
- renderButton()
11782
- ))), maxDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "max" }, maxDescription || max));
11721
+ };
11722
+ const renderMark = () => {
11723
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, marksList.length > 0 && /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
11724
+ return /* @__PURE__ */ React__default.createElement(
11725
+ "span",
11726
+ {
11727
+ key: mark,
11728
+ className: markClassName(mark),
11729
+ style: marksStyle(mark)
11730
+ },
11731
+ Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
11732
+ /* @__PURE__ */ React__default.createElement(
11733
+ "span",
11734
+ {
11735
+ className: classNames("nut-range-tick", {
11736
+ active: tickClass(mark)
11737
+ })
11738
+ }
11739
+ )
11740
+ );
11741
+ })));
11742
+ };
11743
+ return /* @__PURE__ */ React__default.createElement("div", { className: containerClasses }, minDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "min" }, minDescription || min), /* @__PURE__ */ React__default.createElement("div", { ref: root2, className: classes, onClick: (e2) => click(e2) }, renderMark(), /* @__PURE__ */ React__default.createElement("div", { className: "nut-range-bar", style: barStyle() }, range3 ? renderRangeButton() : renderSingleButton())), maxDescription !== null && /* @__PURE__ */ React__default.createElement("div", { className: "max" }, maxDescription || max));
11783
11744
  };
11784
11745
  Range.displayName = "NutRange";
11785
11746
  const defaultProps$O = {
@@ -12862,6 +12823,7 @@ const Preview = ({
12862
12823
  onDeleteItem,
12863
12824
  handleItemClick,
12864
12825
  previewUrl,
12826
+ deleteIcon,
12865
12827
  children
12866
12828
  }) => {
12867
12829
  const renderIcon = (item) => {
@@ -12879,12 +12841,12 @@ const Preview = ({
12879
12841
  key: item.uid
12880
12842
  },
12881
12843
  previewType === "picture" && !children && deletable && /* @__PURE__ */ React__default.createElement(
12882
- u$1,
12844
+ View,
12883
12845
  {
12884
- color: "rgba(0,0,0,0.6)",
12885
12846
  className: "close",
12886
12847
  onClick: () => onDeleteItem(item, index)
12887
- }
12848
+ },
12849
+ deleteIcon
12888
12850
  ),
12889
12851
  previewType === "picture" && !children && /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-img" }, item.status === "ready" ? /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-progress" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-progress-msg" }, item.message)) : item.status !== "success" && /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-progress" }, renderIcon(item), /* @__PURE__ */ React__default.createElement("div", { className: "nut-uploader-preview-progress-msg" }, item.message)), ((_a = item.type) == null ? void 0 : _a.includes("image")) ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, item.url && /* @__PURE__ */ React__default.createElement(
12890
12852
  Image$2,
@@ -12947,6 +12909,7 @@ const defaultProps$H = {
12947
12909
  mediaType: ["image", "video"],
12948
12910
  camera: "back",
12949
12911
  uploadIcon: /* @__PURE__ */ React__default.createElement(y, { size: "20px", color: "#808080" }),
12912
+ deleteIcon: /* @__PURE__ */ React__default.createElement(u$1, { color: "rgba(0,0,0,0.6)" }),
12950
12913
  uploadLabel: "",
12951
12914
  previewType: "picture",
12952
12915
  fit: "cover",
@@ -12974,6 +12937,7 @@ const InternalUploader = (props, ref) => {
12974
12937
  const {
12975
12938
  children,
12976
12939
  uploadIcon,
12940
+ deleteIcon,
12977
12941
  uploadLabel,
12978
12942
  accept,
12979
12943
  name,
@@ -13300,6 +13264,7 @@ const InternalUploader = (props, ref) => {
13300
13264
  onDeleteItem,
13301
13265
  handleItemClick,
13302
13266
  previewUrl,
13267
+ deleteIcon,
13303
13268
  children
13304
13269
  }
13305
13270
  }
@@ -15045,15 +15010,14 @@ const defaultProps$v = {
15045
15010
  size: "",
15046
15011
  shape: "round",
15047
15012
  icon: "",
15048
- fit: "cover",
15049
15013
  background: "#eee",
15050
15014
  color: "#666",
15015
+ fit: "cover",
15051
15016
  src: "",
15052
15017
  alt: ""
15053
15018
  };
15054
15019
  const classPrefix$a = `nut-avatar`;
15055
15020
  const Avatar = (props) => {
15056
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
15057
15021
  const {
15058
15022
  children,
15059
15023
  size,
@@ -15061,9 +15025,9 @@ const Avatar = (props) => {
15061
15025
  background,
15062
15026
  color,
15063
15027
  src,
15028
+ alt,
15064
15029
  icon,
15065
15030
  fit,
15066
- alt,
15067
15031
  className,
15068
15032
  style,
15069
15033
  onClick,
@@ -15079,9 +15043,10 @@ const Avatar = (props) => {
15079
15043
  const avatarRef = useRef(null);
15080
15044
  const parent = useContext(AvatarContext);
15081
15045
  const sizeValue = ["large", "normal", "small"];
15046
+ const { propAvatarGroup, avatarGroupRef } = parent;
15082
15047
  const classes = classNames({
15083
- [`nut-avatar-${((_a = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _a.size) || size || "normal"}`]: true,
15084
- [`nut-avatar-${((_b = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _b.shape) || shape}`]: true
15048
+ [`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.size) || size || "normal"}`]: true,
15049
+ [`nut-avatar-${(propAvatarGroup == null ? void 0 : propAvatarGroup.shape) || shape}`]: true
15085
15050
  });
15086
15051
  const cls = classNames(classPrefix$a, classes, className);
15087
15052
  const styles = {
@@ -15089,52 +15054,52 @@ const Avatar = (props) => {
15089
15054
  height: sizeValue.indexOf(size) > -1 ? "" : `${size}px`,
15090
15055
  backgroundColor: `${background}`,
15091
15056
  color,
15092
- marginLeft: avatarIndex !== 1 && ((_c = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c.gap) ? `${(_d = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _d.gap}px` : "",
15093
- zIndex: ((_e = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _e.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
15057
+ marginLeft: avatarIndex !== 1 && (propAvatarGroup == null ? void 0 : propAvatarGroup.gap) ? `${propAvatarGroup == null ? void 0 : propAvatarGroup.gap}px` : "",
15058
+ zIndex: (propAvatarGroup == null ? void 0 : propAvatarGroup.level) === "right" ? `${Math.abs(maxSum - avatarIndex)}` : "",
15094
15059
  ...style
15095
15060
  };
15096
15061
  const maxStyles = {
15097
- backgroundColor: `${(_f = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _f.maxBackground}`,
15098
- color: `${(_g = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _g.maxColor}`
15062
+ backgroundColor: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxBackground}`,
15063
+ color: `${propAvatarGroup == null ? void 0 : propAvatarGroup.maxColor}`
15099
15064
  };
15065
+ const avatarLength = useCallback(
15066
+ (children2) => {
15067
+ var _a, _b;
15068
+ for (let i2 = 0; i2 < children2.length; i2++) {
15069
+ if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
15070
+ children2[i2].setAttribute("data-index", i2 + 1);
15071
+ }
15072
+ }
15073
+ const index = Number((_b = (_a = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a.dataset) == null ? void 0 : _b.index);
15074
+ const maxCount = propAvatarGroup == null ? void 0 : propAvatarGroup.max;
15075
+ setMaxSum(children2.length);
15076
+ setAvatarIndex(index);
15077
+ if (index === children2.length && index !== maxCount && children2.length > maxCount) {
15078
+ setShowMax(true);
15079
+ }
15080
+ },
15081
+ [propAvatarGroup == null ? void 0 : propAvatarGroup.max]
15082
+ );
15100
15083
  useEffect(() => {
15101
- var _a2;
15102
- const avatarChildren = (_a2 = parent == null ? void 0 : parent.avatarGroupRef) == null ? void 0 : _a2.current.children;
15084
+ const avatarChildren = avatarGroupRef == null ? void 0 : avatarGroupRef.current.children;
15103
15085
  if (avatarChildren) {
15104
15086
  avatarLength(avatarChildren);
15105
15087
  }
15106
- }, []);
15088
+ }, [avatarLength, avatarGroupRef]);
15107
15089
  const isAvatarInClassList = (element) => {
15108
- var _a2, _b2;
15090
+ var _a, _b;
15109
15091
  if (getEnv() === Taro.ENV_TYPE.WEB) {
15110
15092
  return element.classList[0] === "nut-avatar" || element.classList.values().next().value === "nut-avatar";
15111
15093
  }
15112
- return ((_a2 = element.classList) == null ? void 0 : _a2.tokenList[0]) === "nut-avatar" || ((_b2 = element.classList) == null ? void 0 : _b2.tokenList.values().next().value) === "nut-avatar";
15113
- };
15114
- const avatarLength = (children2) => {
15115
- var _a2, _b2, _c2;
15116
- for (let i2 = 0; i2 < children2.length; i2++) {
15117
- if (children2[i2] && children2[i2].classList && isAvatarInClassList(children2[i2])) {
15118
- children2[i2].setAttribute("data-index", i2 + 1);
15119
- }
15120
- }
15121
- const index = (_b2 = (_a2 = avatarRef == null ? void 0 : avatarRef.current) == null ? void 0 : _a2.dataset) == null ? void 0 : _b2.index;
15122
- const maxCount = (_c2 = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _c2.max;
15123
- setMaxSum(children2.length);
15124
- setAvatarIndex(index);
15125
- if (index === children2.length && index !== maxCount && children2.length > maxCount) {
15126
- setShowMax(true);
15127
- }
15094
+ return ((_a = element.classList) == null ? void 0 : _a.tokenList[0]) === "nut-avatar" || ((_b = element.classList) == null ? void 0 : _b.tokenList.values().next().value) === "nut-avatar";
15128
15095
  };
15129
15096
  const errorEvent = () => {
15130
- if (onError) {
15131
- onError();
15132
- }
15097
+ onError && onError();
15133
15098
  };
15134
15099
  const clickAvatar = (e2) => {
15135
15100
  onClick && onClick(e2);
15136
15101
  };
15137
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, (showMax || !((_h = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _h.max) || avatarIndex <= ((_i = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _i.max)) && /* @__PURE__ */ React__default.createElement(
15102
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, (showMax || !(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React__default.createElement(
15138
15103
  "div",
15139
15104
  {
15140
15105
  className: cls,
@@ -15143,7 +15108,7 @@ const Avatar = (props) => {
15143
15108
  onClick: clickAvatar,
15144
15109
  ref: avatarRef
15145
15110
  },
15146
- (!((_j = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _j.max) || avatarIndex <= ((_k = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _k.max)) && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, src && /* @__PURE__ */ React__default.createElement(
15111
+ (!(propAvatarGroup == null ? void 0 : propAvatarGroup.max) || avatarIndex <= (propAvatarGroup == null ? void 0 : propAvatarGroup.max)) && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, src && /* @__PURE__ */ React__default.createElement(
15147
15112
  Image$1,
15148
15113
  {
15149
15114
  className: "avatar-img",
@@ -15155,7 +15120,7 @@ const Avatar = (props) => {
15155
15120
  ...icon.props,
15156
15121
  className: `${icon.props.className || ""} icon`
15157
15122
  }) : null, children && /* @__PURE__ */ React__default.createElement("span", { className: "text" }, children), !src && !icon && !children && /* @__PURE__ */ React__default.createElement(D, { className: "icon" })),
15158
- showMax && /* @__PURE__ */ React__default.createElement("div", { className: "text" }, ((_l = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _l.maxContent) ? (_m = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _m.maxContent : `+ ${avatarIndex - Number(((_n = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _n.max) || 0)}`)
15123
+ showMax && /* @__PURE__ */ React__default.createElement("div", { className: "text" }, (propAvatarGroup == null ? void 0 : propAvatarGroup.maxContent) ? propAvatarGroup == null ? void 0 : propAvatarGroup.maxContent : `+ ${avatarIndex - Number((propAvatarGroup == null ? void 0 : propAvatarGroup.max) || 0)}`)
15159
15124
  ));
15160
15125
  };
15161
15126
  Avatar.displayName = "NutAvatar";
@@ -15620,22 +15585,22 @@ const CountUp = (props) => {
15620
15585
  className,
15621
15586
  thousands,
15622
15587
  style,
15623
- ...reset
15588
+ ...rest
15624
15589
  } = mergeProps(defaultProps$q, props);
15625
15590
  const classPrefix2 = "nut-countup";
15626
15591
  const countupRef = useRef(null);
15627
15592
  const timerRef = useRef(0);
15628
15593
  const numbers = Array.from({ length: 10 }, (v, i2) => i2);
15629
- const getShowNumber = () => {
15594
+ const getShowNumber = useCallback(() => {
15630
15595
  const splitArr = value.split(".");
15631
15596
  const intNumber = length && splitArr[0].length < length ? (Array(length).join("0") + splitArr[0]).slice(-length) : splitArr[0];
15632
15597
  const currNumber = `${thousands ? intNumber.replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") : intNumber}${splitArr[1] ? "." : ""}${splitArr[1] || ""}`;
15633
15598
  return currNumber.split("");
15634
- };
15599
+ }, [length, thousands, value]);
15635
15600
  const [numerArr, setNumerArr] = useState([]);
15636
15601
  const [transformArr, setTransformArr] = useState([]);
15637
15602
  const isLoaded = useRef(false);
15638
- const setNumberTransform = () => {
15603
+ const setNumberTransform = useCallback(() => {
15639
15604
  if (countupRef.current && numerArr.length) {
15640
15605
  createSelectorQuery().selectAll(".nut-countup-listitem").node((numberItems) => {
15641
15606
  const transformArrCache = [];
@@ -15650,7 +15615,7 @@ const CountUp = (props) => {
15650
15615
  setTransformArr([...transformArrCache]);
15651
15616
  }).exec();
15652
15617
  }
15653
- };
15618
+ }, [numerArr]);
15654
15619
  const numberEaseStyle = (idx) => {
15655
15620
  return {
15656
15621
  transition: `transform ${duration}s ease-in-out`,
@@ -15659,7 +15624,7 @@ const CountUp = (props) => {
15659
15624
  };
15660
15625
  useEffect(() => {
15661
15626
  setNumberTransform();
15662
- }, [numerArr]);
15627
+ }, [numerArr, setNumberTransform]);
15663
15628
  useEffect(() => {
15664
15629
  if (!isLoaded.current) {
15665
15630
  isLoaded.current = true;
@@ -15672,7 +15637,7 @@ const CountUp = (props) => {
15672
15637
  return () => {
15673
15638
  window.clearTimeout(timerRef.current);
15674
15639
  };
15675
- }, [value]);
15640
+ }, [value, delay, getShowNumber]);
15676
15641
  return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2} ${className}`, ref: countupRef }, /* @__PURE__ */ React__default.createElement("ul", { className: `${classPrefix2}-list` }, numerArr.map((item, idx) => {
15677
15642
  return /* @__PURE__ */ React__default.createElement(
15678
15643
  "li",
@@ -15787,7 +15752,7 @@ const Audio = (props) => {
15787
15752
  onPlay == null ? void 0 : onPlay(audioCtx);
15788
15753
  });
15789
15754
  audioCtx.onCanplay(() => {
15790
- const intervalID = setInterval(function() {
15755
+ const intervalID = setInterval(() => {
15791
15756
  if (audioCtx.duration !== 0) {
15792
15757
  setTotalSeconds(audioCtx.duration);
15793
15758
  clearInterval(intervalID);
@@ -15804,8 +15769,7 @@ const Audio = (props) => {
15804
15769
  setCurrentDuration(formatSeconds(audioCtx.currentTime.toString()));
15805
15770
  });
15806
15771
  audioCtx.onError((res) => {
15807
- console.warn("code", res.errCode);
15808
- console.warn("message", res.errMsg);
15772
+ console.warn("onError", res.errCode, res.errMsg);
15809
15773
  });
15810
15774
  function formatSeconds(value) {
15811
15775
  if (!value) {
@@ -18355,6 +18319,7 @@ const InternalBarrage = (props, ref) => {
18355
18319
  const barrageContainer = useRef(null);
18356
18320
  const barrageCWidth = useRef(0);
18357
18321
  const timer = useRef(0);
18322
+ const domTimer = useRef(0);
18358
18323
  const index = useRef(0);
18359
18324
  const times = useRef([]);
18360
18325
  const historyIndex = useRef(-1);
@@ -18376,28 +18341,34 @@ const InternalBarrage = (props, ref) => {
18376
18341
  }
18377
18342
  return 0;
18378
18343
  };
18344
+ const clearDomTimeout = () => {
18345
+ if (domTimer.current) {
18346
+ clearTimeout(domTimer.current);
18347
+ domTimer.current = 0;
18348
+ }
18349
+ };
18379
18350
  useEffect(() => {
18380
18351
  const init = async () => {
18352
+ var _a;
18381
18353
  if (barrageBody.current) {
18382
18354
  barrageCWidth.current = await getNodeWidth(barrageBody.current);
18355
+ (_a = barrageBody.current) == null ? void 0 : _a.style.setProperty(
18356
+ "--move-distance",
18357
+ `-${barrageCWidth.current}px`
18358
+ );
18359
+ index.current = 0;
18360
+ run();
18383
18361
  }
18384
18362
  };
18385
- init();
18386
- setTimeout(() => {
18387
- var _a;
18388
- (_a = barrageBody.current) == null ? void 0 : _a.style.setProperty(
18389
- "--move-distance",
18390
- `-${barrageCWidth.current}px`
18391
- );
18392
- index.current = 0;
18393
- run();
18363
+ domTimer.current = window.setTimeout(() => {
18364
+ init();
18394
18365
  }, 300);
18395
18366
  return () => {
18396
- clearInterval(timer.current);
18367
+ clearDomTimeout();
18397
18368
  };
18398
18369
  }, [list]);
18399
18370
  const run = () => {
18400
- clearInterval(timer.current);
18371
+ clearTimeout(timer.current);
18401
18372
  let intervalCache = interval;
18402
18373
  const _index = (loop ? index.current % list.length : index.current) % rows;
18403
18374
  const result = times.current[_index] - rows * interval;
@@ -18408,7 +18379,30 @@ const InternalBarrage = (props, ref) => {
18408
18379
  play();
18409
18380
  }, intervalCache);
18410
18381
  };
18411
- const play = async () => {
18382
+ const setStyle = async (el, currentIndex) => {
18383
+ try {
18384
+ if (el) {
18385
+ const refe = await getRectByTaro(el);
18386
+ const width = refe.width;
18387
+ const height = refe.height;
18388
+ el.classList.add("move");
18389
+ const elScrollDuration = Math.round(
18390
+ width / barrageCWidth.current * duration
18391
+ );
18392
+ times.current[currentIndex] = elScrollDuration;
18393
+ el.style.animationDuration = `${duration + elScrollDuration}ms`;
18394
+ el.style.top = `${currentIndex * (height + gapY) + 20}px`;
18395
+ el.style.width = `${width}px`;
18396
+ }
18397
+ } catch (error) {
18398
+ console.log("异常自动流转到下一个", error);
18399
+ barrageContainer.current.removeChild(el);
18400
+ }
18401
+ el.addEventListener("animationend", () => {
18402
+ barrageContainer.current.removeChild(el);
18403
+ });
18404
+ };
18405
+ const play = () => {
18412
18406
  if (!loop && index.current >= list.length) {
18413
18407
  return;
18414
18408
  }
@@ -18420,25 +18414,9 @@ const InternalBarrage = (props, ref) => {
18420
18414
  }
18421
18415
  historyIndex.current = currentIndex;
18422
18416
  el.innerHTML = list[_index];
18423
- el.classList.add("barrage-item");
18424
18417
  barrageContainer.current.appendChild(el);
18425
- try {
18426
- const width = await getNodeWidth(el);
18427
- const height = await getNodeWidth(el, "height");
18428
- el.classList.add("move");
18429
- const elScrollDuration = width / barrageCWidth.current * duration;
18430
- times.current[currentIndex] = Math.ceil(elScrollDuration);
18431
- el.style.animationDuration = `${(duration + elScrollDuration).toFixed(
18432
- 2
18433
- )}ms`;
18434
- el.style.top = `${currentIndex * (height + gapY) + 20}px`;
18435
- el.style.width = `${width}px`;
18436
- } catch (error) {
18437
- console.log("异常自动流转到下一个");
18438
- }
18439
- el.addEventListener("animationend", () => {
18440
- barrageContainer.current.removeChild(el);
18441
- });
18418
+ el.classList.add("barrage-item");
18419
+ requestAnimationFrame(() => setStyle(el, currentIndex));
18442
18420
  index.current++;
18443
18421
  run();
18444
18422
  };