@nutui/nutui-react-taro 2.6.21 → 2.6.23

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 (86) hide show
  1. package/CHANGELOG.md +32 -5
  2. package/dist/esm/ActionSheet/style/style.css +1 -1
  3. package/dist/esm/Address/style/style.css +1 -1
  4. package/dist/esm/Address.js +1 -1
  5. package/dist/esm/AnimatingNumbers.js +7 -7
  6. package/dist/esm/Audio/style/style.css +1 -1
  7. package/dist/esm/Audio.js +1 -1
  8. package/dist/esm/Avatar.js +1 -1
  9. package/dist/esm/AvatarCropper.js +1 -1
  10. package/dist/esm/BackTop.js +1 -1
  11. package/dist/esm/Button.js +1 -1
  12. package/dist/esm/Calendar/style/style.css +1 -1
  13. package/dist/esm/Calendar.js +1 -1
  14. package/dist/esm/CalendarItem.js +1 -1
  15. package/dist/esm/Cascader/style/style.css +1 -1
  16. package/dist/esm/Cascader.js +1 -1
  17. package/dist/esm/DatePicker/style/style.css +1 -1
  18. package/dist/esm/Dialog/style/style.css +1 -1
  19. package/dist/esm/Dialog.js +1 -1
  20. package/dist/esm/Empty.js +1 -1
  21. package/dist/esm/FixedNav/style/style.css +1 -1
  22. package/dist/esm/ImagePreview/style/style.css +1 -1
  23. package/dist/esm/Menu/style/style.css +1 -1
  24. package/dist/esm/Menu.js +1 -1
  25. package/dist/esm/MenuItem/style/style.css +1 -1
  26. package/dist/esm/MenuItem.js +1 -1
  27. package/dist/esm/NavBar/style/style.css +1 -1
  28. package/dist/esm/NavBar.js +1 -1
  29. package/dist/esm/NumberKeyboard/style/style.css +1 -1
  30. package/dist/esm/Overlay/style/style.css +1 -1
  31. package/dist/esm/Picker/style/style.css +1 -1
  32. package/dist/esm/Popover/style/style.css +1 -1
  33. package/dist/esm/Popup/style/style.css +1 -1
  34. package/dist/esm/Radio.js +1 -1
  35. package/dist/esm/RadioGroup.js +1 -1
  36. package/dist/esm/Range/style/style.css +1 -1
  37. package/dist/esm/Range.js +1 -1
  38. package/dist/esm/ShortPassword/style/style.css +1 -1
  39. package/dist/esm/SideNavBar/style/style.css +1 -1
  40. package/dist/esm/Skeleton.js +1 -1
  41. package/dist/esm/Tabs.js +1 -1
  42. package/dist/esm/TimeSelect/style/style.css +1 -1
  43. package/dist/esm/Tour/style/style.css +1 -1
  44. package/dist/esm/Uploader.js +1 -1
  45. package/dist/esm/{address.taro-CWr6jIYg.js → address.taro-Ai6DQF3D.js} +1 -1
  46. package/dist/esm/{audio.taro--yoX2oyx.js → audio.taro-qK1wq4IH.js} +4 -5
  47. package/dist/esm/avatar.taro-9dU2KeWv.js +82 -0
  48. package/dist/esm/{avatarcropper.taro-B0I9uLNp.js → avatarcropper.taro-meD2sizv.js} +1 -1
  49. package/dist/esm/{backtop.taro-CpzSXDW3.js → backtop.taro-D3Lo3jFO.js} +8 -10
  50. package/dist/esm/{button.taro-1kEru6r9.js → button.taro-CixO32Hw.js} +2 -2
  51. package/dist/esm/{calendar.taro-Csq-7imv.js → calendar.taro-MkErd99P.js} +4 -4
  52. package/dist/esm/{calendaritem.taro-BOMJjsx9.js → calendaritem.taro-BGbbuJOS.js} +3 -3
  53. package/dist/esm/{cascader.taro-DZ_oBTm0.js → cascader.taro-CMOCzo0m.js} +1 -1
  54. package/dist/esm/{dialog.taro-Bg730q8d.js → dialog.taro-yjDaaRHA.js} +1 -1
  55. package/dist/esm/{empty.taro-Dr4eSaDg.js → empty.taro-Dt07kty5.js} +1 -1
  56. package/dist/esm/{menu.taro-BFc4uUxG.js → menu.taro-BmjnA_YM.js} +13 -13
  57. package/dist/esm/{menuitem.taro-D6KQvdRw.js → menuitem.taro-DCqPC4Nu.js} +13 -13
  58. package/dist/esm/{navbar.taro-Dea0-s9Q.js → navbar.taro-HRFRDGii.js} +7 -2
  59. package/dist/esm/nutui-react.es.js +19 -19
  60. package/dist/esm/{radio.taro-CzOHqD3O.js → radio.taro-M2in687s.js} +24 -20
  61. package/dist/esm/{raf-zwv-SBjP.js → raf-Di10dXPS.js} +2 -1
  62. package/dist/esm/{range.taro-BilM3sMH.js → range.taro-D4U2Q7Wx.js} +49 -44
  63. package/dist/esm/{skeleton.taro-bD6fHZop.js → skeleton.taro-D9Vkgsyx.js} +1 -1
  64. package/dist/esm/{tabs.taro-CJiI4q_-.js → tabs.taro-D8bDfm4x.js} +1 -1
  65. package/dist/esm/{uploader.taro-DZyZiEi2.js → uploader.taro-CceZ5Y4t.js} +1 -1
  66. package/dist/locales/base.js +1 -1
  67. package/dist/locales/en-US.js +1 -1
  68. package/dist/locales/id-ID.js +1 -1
  69. package/dist/locales/tr-TR.js +1 -1
  70. package/dist/locales/zh-CN.js +1 -1
  71. package/dist/locales/zh-TW.js +1 -1
  72. package/dist/locales/zh-UG.js +1 -1
  73. package/dist/nutui.react.es.js +218 -253
  74. package/dist/nutui.react.umd.js +218 -253
  75. package/dist/packages/navbar/navbar.scss +0 -5
  76. package/dist/packages/overlay/overlay.scss +0 -4
  77. package/dist/packages/range/range.scss +2 -0
  78. package/dist/style.css +1 -1
  79. package/dist/types/packages/avatar/avatar.d.ts +1 -1
  80. package/dist/types/packages/calendar/calendar.d.ts +2 -0
  81. package/dist/types/packages/calendar/calendar.taro.d.ts +10 -0
  82. package/dist/types/packages/calendaritem/calendaritem.d.ts +1 -0
  83. package/dist/types/packages/calendaritem/calendaritem.taro.d.ts +1 -0
  84. package/dist/types/packages/overlay/overlay.d.ts +1 -1
  85. package/package.json +1 -1
  86. package/dist/esm/avatar.taro-DSL3ErmC.js +0 -85
@@ -1,8 +1,8 @@
1
1
  import { _ as __rest } from "./tslib.es6-iWu3F_1J.js";
2
- import React__default, { useRef, useState, useEffect } from "react";
2
+ import React__default, { useRef, useState, useCallback, useEffect } from "react";
3
3
  import classNames from "classnames";
4
4
  import { ArrowUp, ArrowDown } from "@nutui/icons-react-taro";
5
- import { M as MenuItem } from "./menuitem.taro-D6KQvdRw.js";
5
+ import { M as MenuItem } from "./menuitem.taro-DCqPC4Nu.js";
6
6
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
7
7
  const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { activeColor: "", closeOnOverlayClick: true, scrollFixed: false, lockScroll: true, overlay: true, icon: null, onOpen: (index, from) => {
8
8
  }, onClose: (index, from) => {
@@ -10,24 +10,26 @@ const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { activ
10
10
  const Menu = (props) => {
11
11
  const _a = Object.assign(Object.assign({}, defaultProps), props), { className, icon, scrollFixed, lockScroll, overlay, closeOnOverlayClick, children, activeColor, onClose, onOpen } = _a, rest = __rest(_a, ["className", "icon", "scrollFixed", "lockScroll", "overlay", "closeOnOverlayClick", "children", "activeColor", "onClose", "onOpen"]);
12
12
  const menuRef = useRef(null);
13
+ const [showMenuItem, setShowMenuItem] = useState([]);
14
+ const [menuItemTitle, setMenuItemTitle] = useState([]);
13
15
  const [isScrollFixed, setIsScrollFixed] = useState(false);
16
+ const cls = classNames(`nut-menu`, className, {
17
+ "scroll-fixed": isScrollFixed
18
+ });
14
19
  const getScrollTop = (el) => {
15
- return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
20
+ return Math.max(0, el === window ? window.scrollY : el.scrollTop);
16
21
  };
17
- const onScroll = () => {
18
- const { scrollFixed: scrollFixed2 } = props;
22
+ const onScroll = useCallback(() => {
19
23
  const scrollTop = getScrollTop(window);
20
- const isFixed = scrollTop > (typeof scrollFixed2 === "boolean" ? 30 : Number(scrollFixed2));
24
+ const isFixed = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
21
25
  setIsScrollFixed(isFixed);
22
- };
26
+ }, [scrollFixed]);
23
27
  useEffect(() => {
24
28
  if (scrollFixed) {
25
29
  window.addEventListener("scroll", onScroll);
26
30
  }
27
31
  return () => window.removeEventListener("scroll", onScroll);
28
- }, []);
29
- const [showMenuItem, setShowMenuItem] = useState([]);
30
- const [menuItemTitle, setMenuItemTitle] = useState([]);
32
+ }, [scrollFixed, onScroll]);
31
33
  const toggleMenuItem = (index, from = "NORMAL") => {
32
34
  showMenuItem[index] = !showMenuItem[index];
33
35
  if (showMenuItem[index]) {
@@ -105,9 +107,7 @@ const Menu = (props) => {
105
107
  };
106
108
  return React__default.createElement(
107
109
  "div",
108
- Object.assign({}, rest, { className: classNames(`nut-menu`, className, {
109
- "scroll-fixed": isScrollFixed
110
- }), ref: menuRef }),
110
+ Object.assign({}, rest, { className: cls, ref: menuRef }),
111
111
  React__default.createElement("div", { className: classNames("nut-menu-bar", {
112
112
  opened: showMenuItem.includes(true)
113
113
  }) }, menuTitle()),
@@ -1,5 +1,5 @@
1
1
  import { a as __awaiter } from "./tslib.es6-iWu3F_1J.js";
2
- import React__default, { forwardRef, useState, useRef, useEffect, useMemo, useCallback, useImperativeHandle } from "react";
2
+ import React__default, { forwardRef, useState, useRef, useEffect, useCallback, useMemo, useImperativeHandle } from "react";
3
3
  import classNames from "classnames";
4
4
  import { getSystemInfoSync, usePageScroll } from "@tarojs/taro";
5
5
  import { View } from "@tarojs/components";
@@ -26,9 +26,19 @@ const MenuItem = forwardRef((props, ref) => {
26
26
  useEffect(() => {
27
27
  setShowPopup(show);
28
28
  }, [show]);
29
+ const getParentOffset = useCallback(() => {
30
+ setTimeout(() => __awaiter(void 0, void 0, void 0, function* () {
31
+ const p = parent.menuRef.current;
32
+ const rect = yield getRectByTaro(p);
33
+ setPosition({
34
+ height: rect.height,
35
+ top: rect.top
36
+ });
37
+ }), 100);
38
+ }, [parent.menuRef]);
29
39
  useEffect(() => {
30
40
  getParentOffset();
31
- }, [showPopup]);
41
+ }, [showPopup, getParentOffset]);
32
42
  const windowHeight = useMemo(() => getSystemInfoSync().windowHeight, []);
33
43
  const updateItemOffset = useCallback(() => {
34
44
  if (!parent.lockScroll)
@@ -42,7 +52,7 @@ const MenuItem = forwardRef((props, ref) => {
42
52
  });
43
53
  }
44
54
  });
45
- }, [direction, windowHeight]);
55
+ }, [direction, windowHeight, parent.lockScroll, parent.menuRef]);
46
56
  usePageScroll(updateItemOffset);
47
57
  useImperativeHandle(ref, () => ({
48
58
  toggle: (s) => {
@@ -70,16 +80,6 @@ const MenuItem = forwardRef((props, ref) => {
70
80
  top: 0,
71
81
  height: 0
72
82
  });
73
- const getParentOffset = () => {
74
- setTimeout(() => __awaiter(void 0, void 0, void 0, function* () {
75
- const p = parent.menuRef.current;
76
- const rect = yield getRectByTaro(p);
77
- setPosition({
78
- height: rect.height,
79
- top: rect.top
80
- });
81
- }), 100);
82
- };
83
83
  const isShow = () => {
84
84
  if (showPopup)
85
85
  return {};
@@ -4,6 +4,7 @@ import classNames from "classnames";
4
4
  import { View } from "@tarojs/components";
5
5
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
6
6
  import { g as getRectByTaro } from "./get-rect-by-taro-THaHH07X.js";
7
+ import { S as SafeArea } from "./safearea.taro-BJpvFsMf.js";
7
8
  const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { left: "", right: "", titleAlign: "center", back: "", fixed: false, safeAreaInsetTop: false, placeholder: false, zIndex: 10 });
8
9
  const NavBar = (props) => {
9
10
  const { right, left, titleAlign, className, style, back, fixed, safeAreaInsetTop, placeholder, zIndex, onBackClick } = Object.assign(Object.assign({}, defaultProps), props);
@@ -77,11 +78,15 @@ const NavBar = (props) => {
77
78
  };
78
79
  const classes = classNames({
79
80
  [`${classPrefix}-fixed`]: fixed,
80
- [`${classPrefix}-safe-area-inset-top`]: safeAreaInsetTop,
81
81
  [`${classPrefix}-title-align-${titleAlign}`]: true
82
82
  });
83
83
  const cls = classNames(classPrefix, classes, className);
84
- return React__default.createElement(React__default.Fragment, null, fixed && placeholder ? React__default.createElement(View, { className: `${classPrefix}-placeholder` }, renderWrapper()) : renderWrapper());
84
+ return React__default.createElement(
85
+ React__default.Fragment,
86
+ null,
87
+ safeAreaInsetTop && React__default.createElement(SafeArea, { position: "top" }),
88
+ fixed && placeholder ? React__default.createElement(View, { className: `${classPrefix}-placeholder` }, renderWrapper()) : renderWrapper()
89
+ );
85
90
  };
86
91
  NavBar.displayName = "NutNavBar";
87
92
  export {
@@ -1,4 +1,4 @@
1
- import { B } from "./button.taro-1kEru6r9.js";
1
+ import { B } from "./button.taro-CixO32Hw.js";
2
2
  import { C } from "./cell.taro-DWLhb5m6.js";
3
3
  import { C as C2 } from "./cellgroup.taro-DTLGMR_c.js";
4
4
  import { C as C3, g, s, u, a } from "./configprovider.taro-C3WyeHSO.js";
@@ -13,46 +13,46 @@ import { R } from "./row.taro-ItEq1Bi5.js";
13
13
  import { S } from "./space.taro-B1KsEPZL.js";
14
14
  import { S as S2 } from "./sticky.taro-DC98CdU7.js";
15
15
  import { S as S3 } from "./safearea.taro-BJpvFsMf.js";
16
- import { B as B2 } from "./backtop.taro-CpzSXDW3.js";
16
+ import { B as B2 } from "./backtop.taro-D3Lo3jFO.js";
17
17
  import { E } from "./elevator.taro-Bsc8PcT0.js";
18
18
  import { F } from "./fixednav.taro-BodErnYy.js";
19
- import { N } from "./navbar.taro-Dea0-s9Q.js";
19
+ import { N } from "./navbar.taro-HRFRDGii.js";
20
20
  import { S as S4 } from "./sidenavbar.taro-DNwoQw9u.js";
21
21
  import { S as S5 } from "./sidenavbaritem.taro-BKpzXpzG.js";
22
22
  import { S as S6 } from "./subsidenavbar.taro-CSU3DhNq.js";
23
23
  import { T } from "./tabbar.taro-BiQDgZQF.js";
24
24
  import { T as T2 } from "./tabbaritem.taro-BiIVucQz.js";
25
25
  import { T as T3 } from "./tabpane.taro-BAe86j3t.js";
26
- import { T as T4 } from "./tabs.taro-CJiI4q_-.js";
27
- import { A } from "./address.taro-CWr6jIYg.js";
28
- import { C as C5 } from "./calendar.taro-Csq-7imv.js";
29
- import { C as C6 } from "./calendaritem.taro-BOMJjsx9.js";
26
+ import { T as T4 } from "./tabs.taro-D8bDfm4x.js";
27
+ import { A } from "./address.taro-Ai6DQF3D.js";
28
+ import { C as C5 } from "./calendar.taro-MkErd99P.js";
29
+ import { C as C6 } from "./calendaritem.taro-BGbbuJOS.js";
30
30
  import { C as C7 } from "./calendarcard.taro-CvWyBqnr.js";
31
- import { C as C8 } from "./cascader.taro-DZ_oBTm0.js";
31
+ import { C as C8 } from "./cascader.taro-CMOCzo0m.js";
32
32
  import { C as C9, a as a2 } from "./checkbox.taro-CgqJyhrh.js";
33
33
  import { D as D2 } from "./datepicker.taro-DibmSueg.js";
34
34
  import { default as default2 } from "./Form.js";
35
35
  import { F as F2 } from "./formitem.taro-CEWRz5EJ.js";
36
36
  import { I as I2 } from "./input.taro-CA9ZpM9a.js";
37
37
  import { I as I3 } from "./inputnumber.taro-DPRZtV42.js";
38
- import { M } from "./menu.taro-BFc4uUxG.js";
39
- import { M as M2 } from "./menuitem.taro-D6KQvdRw.js";
38
+ import { M } from "./menu.taro-BmjnA_YM.js";
39
+ import { M as M2 } from "./menuitem.taro-DCqPC4Nu.js";
40
40
  import { N as N2 } from "./numberkeyboard.taro-CIlStObb.js";
41
41
  import { P } from "./picker.taro-mCnxpFCY.js";
42
- import { R as R2, a as a3 } from "./radio.taro-CzOHqD3O.js";
43
- import { R as R3 } from "./range.taro-BilM3sMH.js";
42
+ import { R as R2, a as a3 } from "./radio.taro-M2in687s.js";
43
+ import { R as R3 } from "./range.taro-D4U2Q7Wx.js";
44
44
  import { R as R4 } from "./rate.taro-CPGkjYYu.js";
45
45
  import { S as S7 } from "./searchbar.taro-LaO2Xr2t.js";
46
46
  import { S as S8 } from "./shortpassword.taro-ByEtEDDl.js";
47
47
  import { S as S9 } from "./signature.taro-BW4eiGIR.js";
48
48
  import { S as S10 } from "./switch.taro-CdBmDo18.js";
49
49
  import { T as T5 } from "./textarea.taro-EJQxRHZR.js";
50
- import { U } from "./uploader.taro-DZyZiEi2.js";
50
+ import { U } from "./uploader.taro-CceZ5Y4t.js";
51
51
  import { A as A2 } from "./actionsheet.taro-CgfXnK1M.js";
52
52
  import { B as B3 } from "./badge.taro-B42_7q8v.js";
53
- import { B as B4 } from "./dialog.taro-Bg730q8d.js";
53
+ import { B as B4 } from "./dialog.taro-yjDaaRHA.js";
54
54
  import { D as D3 } from "./drag.taro-B_sfzmtW.js";
55
- import { E as E2 } from "./empty.taro-Dr4eSaDg.js";
55
+ import { E as E2 } from "./empty.taro-Dt07kty5.js";
56
56
  import { I as I4 } from "./infiniteloading.taro-DzIrZvc0.js";
57
57
  import { L as L2 } from "./loading.taro-n_qoNgCW.js";
58
58
  import { N as N3 } from "./noticebar.taro-BjKDC7We.js";
@@ -60,13 +60,13 @@ import { N as N4 } from "./notify.taro-BVXg7xTI.js";
60
60
  import { P as P2 } from "./popover.taro-BHcidbZG.js";
61
61
  import { P as P3 } from "./popup.taro-DV32k5dP.js";
62
62
  import { P as P4 } from "./pulltorefresh.taro-BiSDwLpA.js";
63
- import { S as S11 } from "./skeleton.taro-bD6fHZop.js";
63
+ import { S as S11 } from "./skeleton.taro-D9Vkgsyx.js";
64
64
  import { S as S12 } from "./swipe.taro-Bsk2fnEl.js";
65
65
  import { T as T6 } from "./toast.taro-Tx0IHbsl.js";
66
66
  import { A as A3 } from "./animate.taro-CQVEyDKL.js";
67
67
  import { default as default3 } from "./AnimatingNumbers.js";
68
- import { A as A4 } from "./audio.taro--yoX2oyx.js";
69
- import { A as A5 } from "./avatar.taro-DSL3ErmC.js";
68
+ import { A as A4 } from "./audio.taro-qK1wq4IH.js";
69
+ import { A as A5 } from "./avatar.taro-9dU2KeWv.js";
70
70
  import { A as A6 } from "./avatargroup.taro-ScakjsY1.js";
71
71
  import { C as C10 } from "./circleprogress.taro-BTRyQG5T.js";
72
72
  import { C as C11 } from "./collapse.taro-wqL6MWZr.js";
@@ -93,7 +93,7 @@ import { T as T10 } from "./timedetail.taro-ya5JNy2L.js";
93
93
  import { T as T11 } from "./timeselect.taro-DE_a87DT.js";
94
94
  import { T as T12 } from "./trendarrow.taro-DKx5cGIh.js";
95
95
  import { W } from "./watermark.taro-CbO7mKFD.js";
96
- import { A as A7 } from "./avatarcropper.taro-B0I9uLNp.js";
96
+ import { A as A7 } from "./avatarcropper.taro-meD2sizv.js";
97
97
  export {
98
98
  A2 as ActionSheet,
99
99
  A as Address,
@@ -15,6 +15,9 @@ const defaultProps$1 = {
15
15
  const classPrefix = "nut-radiogroup";
16
16
  const RadioGroup = React__default.forwardRef((props, ref) => {
17
17
  const _a = Object.assign(Object.assign({}, defaultProps$1), props), { children, className, value, defaultValue, onChange, shape, labelPosition, direction, options, disabled } = _a, rest = __rest(_a, ["children", "className", "value", "defaultValue", "onChange", "shape", "labelPosition", "direction", "options", "disabled"]);
18
+ const cls = classNames(classPrefix, {
19
+ [`${classPrefix}-${props.direction}`]: props.direction
20
+ }, className);
18
21
  const [val2State, setVal2State] = usePropsValue({
19
22
  defaultValue: props.defaultValue,
20
23
  value: props.value,
@@ -26,7 +29,7 @@ const RadioGroup = React__default.forwardRef((props, ref) => {
26
29
  var { label, value: value2, disabled: disabled2, onChange: onChange2 } = _a2, rest2 = __rest(_a2, ["label", "value", "disabled", "onChange"]);
27
30
  return React__default.createElement(Radio, Object.assign({}, rest2, { key: value2 === null || value2 === void 0 ? void 0 : value2.toString(), children: label, value: value2, disabled: disabled2, onChange: onChange2, labelPosition, checked: value2 === val2State }));
28
31
  });
29
- }, [options]);
32
+ }, [options, labelPosition, val2State]);
30
33
  return React__default.createElement(
31
34
  RadioContext.Provider,
32
35
  { value: {
@@ -41,9 +44,7 @@ const RadioGroup = React__default.forwardRef((props, ref) => {
41
44
  setVal2State("");
42
45
  }
43
46
  } },
44
- React__default.createElement("div", Object.assign({ className: classNames(classPrefix, {
45
- [`${classPrefix}-${props.direction}`]: props.direction
46
- }, className) }, rest), (options === null || options === void 0 ? void 0 : options.length) ? renderOptionsChildren() : children)
47
+ React__default.createElement("div", Object.assign({ className: cls }, rest), (options === null || options === void 0 ? void 0 : options.length) ? renderOptionsChildren() : children)
47
48
  );
48
49
  });
49
50
  RadioGroup.displayName = "NutRadioGroup";
@@ -79,17 +80,6 @@ const Radio = (props) => {
79
80
  }
80
81
  };
81
82
  }
82
- const renderLabel = () => {
83
- return React__default.createElement("div", { className: classNames(`${classPrefix2}-label`, {
84
- [`${classPrefix2}-label-disabled`]: disabled
85
- }) }, children);
86
- };
87
- const renderButton = () => {
88
- return React__default.createElement("div", { className: classNames(`${classPrefix2}-button`, {
89
- [`${classPrefix2}-button-active`]: checkedStatement,
90
- [`${classPrefix2}-button-disabled`]: disabled
91
- }) }, children);
92
- };
93
83
  const color = () => {
94
84
  return {
95
85
  [`${classPrefix2}-icon-disabled`]: disabled,
@@ -107,14 +97,27 @@ const Radio = (props) => {
107
97
  }
108
98
  return React__default.isValidElement(icon2) ? React__default.cloneElement(icon2, Object.assign(Object.assign({}, icon2.props), { className: classNames(color()) })) : React__default.createElement(CheckNormal, { className: classNames(color()) });
109
99
  };
110
- const renderByShape = (shape2) => {
111
- return shape2 === "button" ? renderButton() : React__default.createElement(
100
+ const renderLabel = () => {
101
+ const labelcls = classNames(`${classPrefix2}-label`, {
102
+ [`${classPrefix2}-label-disabled`]: disabled
103
+ });
104
+ return React__default.createElement(
112
105
  React__default.Fragment,
113
106
  null,
114
107
  renderIcon(),
115
- renderLabel()
108
+ React__default.createElement("div", { className: labelcls }, children)
116
109
  );
117
110
  };
111
+ const renderButton = () => {
112
+ const buttoncls = classNames(`${classPrefix2}-button`, {
113
+ [`${classPrefix2}-button-active`]: checkedStatement,
114
+ [`${classPrefix2}-button-disabled`]: disabled
115
+ });
116
+ return React__default.createElement("div", { className: buttoncls }, children);
117
+ };
118
+ const renderByShape = (shape2) => {
119
+ return shape2 === "button" ? renderButton() : renderLabel();
120
+ };
118
121
  const renderRadioItem = () => {
119
122
  return renderByShape(context && context.shape ? context.shape : shape);
120
123
  };
@@ -123,9 +126,10 @@ const Radio = (props) => {
123
126
  return;
124
127
  setCheckedStatement(!checkedStatement);
125
128
  };
126
- return React__default.createElement("div", Object.assign({ className: classNames(classPrefix2, {
129
+ const cls = classNames(classPrefix2, {
127
130
  [`${classPrefix2}-reverse`]: labelPosition === "left"
128
- }, className), style, onClick: handleClick }, rest), renderRadioItem());
131
+ }, className);
132
+ return React__default.createElement("div", Object.assign({ className: cls, style, onClick: handleClick }, rest), renderRadioItem());
129
133
  };
130
134
  Radio.displayName = "NutRadio";
131
135
  Radio.Group = RadioGroup;
@@ -1,5 +1,6 @@
1
+ const inBrowser = typeof window !== "undefined";
1
2
  function requestAniFrame() {
2
- if (typeof window !== "undefined") {
3
+ if (inBrowser) {
3
4
  const _window = window;
4
5
  return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
5
6
  _window.setTimeout(callback, 1e3 / 60);
@@ -1,5 +1,5 @@
1
1
  import { a as __awaiter } from "./tslib.es6-iWu3F_1J.js";
2
- import React__default, { useState, useRef, useEffect, useCallback } from "react";
2
+ import React__default, { useState, useRef, useEffect, useMemo } from "react";
3
3
  import classNames from "classnames";
4
4
  import { View } from "@tarojs/components";
5
5
  import { u as useTouch } from "./use-touch-BeiLHDO9.js";
@@ -10,7 +10,7 @@ import { a as useRtl } from "./configprovider.taro-C3WyeHSO.js";
10
10
  const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { range: false, min: 0, max: 100, step: 1, vertical: false, marks: {} });
11
11
  const Range = (props) => {
12
12
  const rtl = useRtl();
13
- const { className, range, disabled, button, vertical, marks, onChange, onStart, onEnd, minDescription, maxDescription, currentDescription, min, max, step, value, defaultValue } = Object.assign(Object.assign({}, defaultProps), props);
13
+ const { className, range, disabled, button, vertical, marks, minDescription, maxDescription, currentDescription, min, max, step, value, defaultValue, onChange, onStart, onEnd } = Object.assign(Object.assign({}, defaultProps), props);
14
14
  const classPrefix = "nut-range";
15
15
  const [buttonIndex, setButtonIndex] = useState(0);
16
16
  const [dragStatus, setDragStatus] = useState("start");
@@ -27,7 +27,7 @@ const Range = (props) => {
27
27
  finalValue: 0,
28
28
  onChange: handleChange
29
29
  });
30
- const [exactValue, setEaxctValue] = useState(() => value || defaultValue || 0);
30
+ const [exactValue, setExactValue] = useState(() => value || defaultValue || 0);
31
31
  const marksRef = useRef({});
32
32
  useEffect(() => {
33
33
  if (marks) {
@@ -43,10 +43,7 @@ const Range = (props) => {
43
43
  setMarksList(list);
44
44
  }
45
45
  }
46
- }, [marks]);
47
- const scope = () => {
48
- return max - min;
49
- };
46
+ }, [marks, max, min]);
50
47
  const classes = classNames(classPrefix, {
51
48
  [`${classPrefix}-disabled`]: disabled,
52
49
  [`${classPrefix}-vertical`]: vertical
@@ -54,7 +51,7 @@ const Range = (props) => {
54
51
  const containerClasses = classNames(`${classPrefix}-container`, {
55
52
  [`${classPrefix}-container-vertical`]: vertical
56
53
  }, className);
57
- const markClassName = useCallback((mark) => {
54
+ const markClassName = (mark) => {
58
55
  const classPrefix2 = "nut-range-mark";
59
56
  let lowerBound = min;
60
57
  let upperBound = max;
@@ -69,23 +66,23 @@ const Range = (props) => {
69
66
  `${classPrefix2}-text`,
70
67
  `${isActive ? `${classPrefix2}-text-active` : ""}`
71
68
  ].join(" ");
72
- }, [range, current, min, max]);
69
+ };
73
70
  const isRange = (val) => {
74
71
  return !!range && Array.isArray(val);
75
72
  };
73
+ const scope = useMemo(() => {
74
+ if (max < min || max === min) {
75
+ console.log("max 的值需要大于 min的值");
76
+ }
77
+ return max - min;
78
+ }, [max, min]);
76
79
  const calcMainAxis = () => {
77
80
  const modelVal = current;
78
- if (isRange(modelVal)) {
79
- return `${(modelVal[1] - modelVal[0]) * 100 / scope()}%`;
80
- }
81
- return `${(modelVal - min) * 100 / scope()}%`;
81
+ return isRange(modelVal) ? `${(modelVal[1] - modelVal[0]) * 100 / scope}%` : `${(modelVal - min) * 100 / scope}%`;
82
82
  };
83
83
  const calcOffset = () => {
84
84
  const modelVal = current;
85
- if (isRange(modelVal)) {
86
- return `${(modelVal[0] - min) * 100 / scope()}%`;
87
- }
88
- return `0%`;
85
+ return isRange(modelVal) ? `${(modelVal[0] - min) * 100 / scope}%` : `0%`;
89
86
  };
90
87
  const barStyle = () => {
91
88
  if (vertical) {
@@ -105,11 +102,11 @@ const Range = (props) => {
105
102
  const marksStyle = (mark) => {
106
103
  const dir = rtl ? "right" : "left";
107
104
  let style = {
108
- [dir]: `${(mark - min) / scope() * 100}%`
105
+ [dir]: `${(mark - min) / scope * 100}%`
109
106
  };
110
107
  if (vertical) {
111
108
  style = {
112
- top: `${(mark - min) / scope() * 100}%`
109
+ top: `${(mark - min) / scope * 100}%`
113
110
  };
114
111
  }
115
112
  return style;
@@ -156,8 +153,8 @@ const Range = (props) => {
156
153
  delta = (event.detail.y ? event.detail.y : event.clientY) - rect.top;
157
154
  total = rect.height;
158
155
  }
159
- const value2 = min + delta / total * scope();
160
- setEaxctValue(current);
156
+ const value2 = min + delta / total * scope;
157
+ setExactValue(current);
161
158
  if (isRange(current)) {
162
159
  const [left, right] = current;
163
160
  const middle = (left + right) / 2;
@@ -175,7 +172,7 @@ const Range = (props) => {
175
172
  return;
176
173
  }
177
174
  touch.start(event);
178
- setEaxctValue(current);
175
+ setExactValue(current);
179
176
  if (isRange(current)) {
180
177
  setStartValue(current.map(format));
181
178
  } else {
@@ -197,12 +194,12 @@ const Range = (props) => {
197
194
  return;
198
195
  let delta = touch.deltaX.current;
199
196
  let total = rect.width;
200
- let diff = delta / total * scope();
197
+ let diff = delta / total * scope;
201
198
  diff = rtl ? -diff : diff;
202
199
  if (vertical) {
203
200
  delta = touch.deltaY.current;
204
201
  total = rect.height;
205
- diff = delta / total * scope();
202
+ diff = delta / total * scope;
206
203
  }
207
204
  let newValue;
208
205
  if (isRange(startValue)) {
@@ -211,7 +208,7 @@ const Range = (props) => {
211
208
  } else {
212
209
  newValue = startValue + diff;
213
210
  }
214
- setEaxctValue(newValue);
211
+ setExactValue(newValue);
215
212
  updateValue(newValue);
216
213
  });
217
214
  const onTouchEnd = () => {
@@ -231,6 +228,31 @@ const Range = (props) => {
231
228
  const renderButton = (index) => {
232
229
  return React__default.createElement(React__default.Fragment, null, button || React__default.createElement("div", { className: "nut-range-button" }, currentDescription !== null && React__default.createElement("div", { className: "number" }, currentDescription ? currentDescription(curValue(index)) : curValue(index))));
233
230
  };
231
+ const renderRangeButton = () => {
232
+ return [0, 1].map((item, index) => {
233
+ const cls = `${index === 0 ? "nut-range-button-wrapper-left" : ""}
234
+ ${index === 1 ? "nut-range-button-wrapper-right" : ""}`;
235
+ return React__default.createElement("div", { key: index, className: cls, onTouchStart: (e) => {
236
+ setButtonIndex(index);
237
+ onTouchStart(e);
238
+ }, onTouchMove, onTouchEnd, onTouchCancel: onTouchEnd, onClick: (e) => e.stopPropagation() }, renderButton(index));
239
+ });
240
+ };
241
+ const renderSingleButton = () => {
242
+ return React__default.createElement(View, { catchMove: true, className: "nut-range-button-wrapper", onTouchStart, onTouchMove, onTouchEnd, onTouchCancel: onTouchEnd, onClick: (e) => e.stopPropagation() }, renderButton());
243
+ };
244
+ const renderMark = () => {
245
+ return React__default.createElement(React__default.Fragment, null, marksList.length > 0 && React__default.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
246
+ return React__default.createElement(
247
+ "span",
248
+ { key: mark, className: markClassName(mark), style: marksStyle(mark) },
249
+ Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
250
+ React__default.createElement("span", { className: classNames("nut-range-tick", {
251
+ active: tickClass(mark)
252
+ }) })
253
+ );
254
+ })));
255
+ };
234
256
  return React__default.createElement(
235
257
  "div",
236
258
  { className: containerClasses },
@@ -238,25 +260,8 @@ const Range = (props) => {
238
260
  React__default.createElement(
239
261
  "div",
240
262
  { ref: root, className: classes, onClick: (e) => click(e) },
241
- marksList.length > 0 && React__default.createElement("div", { className: "nut-range-mark" }, marksList.map((mark) => {
242
- return React__default.createElement(
243
- "span",
244
- { key: mark, className: markClassName(mark), style: marksStyle(mark) },
245
- Array.isArray(marks) ? marksRef.current[mark] : marks[mark],
246
- React__default.createElement("span", { className: classNames("nut-range-tick", {
247
- active: tickClass(mark)
248
- }) })
249
- );
250
- })),
251
- React__default.createElement("div", { className: "nut-range-bar", style: barStyle() }, range ? [0, 1].map((item, index) => {
252
- return React__default.createElement("div", { key: index, className: `${index === 0 ? "nut-range-button-wrapper-left" : ""}
253
- ${index === 1 ? "nut-range-button-wrapper-right" : ""}`, onTouchStart: (e) => {
254
- if (typeof index === "number") {
255
- setButtonIndex(index);
256
- }
257
- onTouchStart(e);
258
- }, onTouchMove: (e) => onTouchMove(e), onTouchEnd, onTouchCancel: onTouchEnd, onClick: (e) => e.stopPropagation() }, renderButton(index));
259
- }) : React__default.createElement(View, { catchMove: true, className: "nut-range-button-wrapper", onTouchStart: (e) => onTouchStart(e), onTouchMove: (e) => onTouchMove(e), onTouchEnd, onTouchCancel: onTouchEnd, onClick: (e) => e.stopPropagation() }, renderButton()))
263
+ renderMark(),
264
+ React__default.createElement("div", { className: "nut-range-bar", style: barStyle() }, range ? renderRangeButton() : renderSingleButton())
260
265
  ),
261
266
  maxDescription !== null && React__default.createElement("div", { className: "max" }, maxDescription || max)
262
267
  );
@@ -1,7 +1,7 @@
1
1
  import { _ as __rest } from "./tslib.es6-iWu3F_1J.js";
2
2
  import React__default from "react";
3
3
  import classNames from "classnames";
4
- import { A as Avatar } from "./avatar.taro-DSL3ErmC.js";
4
+ import { A as Avatar } from "./avatar.taro-9dU2KeWv.js";
5
5
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
6
6
  const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { rows: 1, animated: false, title: false, avatar: false, avatarSize: "50px", visible: false, avatarShape: "round" });
7
7
  const Skeleton = (props) => {
@@ -8,7 +8,7 @@ import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
8
8
  import { T as TabPane } from "./tabpane.taro-BAe86j3t.js";
9
9
  import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
10
10
  import { u as useForceUpdate } from "./use-force-update-CudFjCsy.js";
11
- import { r as requestAniFrame } from "./raf-zwv-SBjP.js";
11
+ import { r as requestAniFrame } from "./raf-Di10dXPS.js";
12
12
  import { u as useUuid } from "./use-uuid-BvqmbYZ7.js";
13
13
  import { a as useRtl } from "./configprovider.taro-C3WyeHSO.js";
14
14
  const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { tabStyle: {}, activeColor: "", direction: "horizontal", activeType: "line", duration: 300, autoHeight: false });
@@ -3,7 +3,7 @@ import React__default, { useState, useImperativeHandle, useRef, useEffect } from
3
3
  import classNames from "classnames";
4
4
  import Taro, { uploadFile, getEnv, chooseMedia, chooseImage } from "@tarojs/taro";
5
5
  import { Link, Del, Failure, Loading, Photograph } from "@nutui/icons-react-taro";
6
- import { B as Button } from "./button.taro-1kEru6r9.js";
6
+ import { B as Button } from "./button.taro-CixO32Hw.js";
7
7
  import { u as useConfig } from "./configprovider.taro-C3WyeHSO.js";
8
8
  import { a as isPromise } from "./index-DeNfBlua.js";
9
9
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:03:03 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.6.23 Fri Oct 18 2024 14:19:06 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:03:03 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.6.23 Fri Oct 18 2024 14:19:06 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:03:03 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.6.23 Fri Oct 18 2024 14:19:06 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:03:03 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.6.23 Fri Oct 18 2024 14:19:06 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:03:03 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.6.23 Fri Oct 18 2024 14:19:06 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:03:03 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.6.23 Fri Oct 18 2024 14:19:06 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.6.21 Fri Sep 27 2024 14:03:03 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.6.23 Fri Oct 18 2024 14:19:06 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */