@nutui/nutui-react-taro 1.3.2-beta.0 → 1.3.2-beta.1

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v1.3.2-beta.0 Wed Sep 07 2022 10:39:13 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v1.3.2-beta.1 Wed Sep 07 2022 14:19:34 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -46,7 +46,7 @@ classname_production_min.cn = e$1, classname_production_min.withNaming = r$1;
46
46
  classname.exports = classname_production_min;
47
47
  }
48
48
  const cn = classname.exports.withNaming({ n: "nut-", e: "__", m: "--", v: "-" });
49
- const defaultProps$1p = {
49
+ const defaultProps$1o = {
50
50
  name: "",
51
51
  size: "",
52
52
  classPrefix: "nut-icon",
@@ -74,7 +74,7 @@ function Icon$1(props) {
74
74
  onClick,
75
75
  ...rest
76
76
  } = {
77
- ...defaultProps$1p,
77
+ ...defaultProps$1o,
78
78
  ...props
79
79
  };
80
80
  const isImage = name ? name.indexOf("/") !== -1 : false;
@@ -108,9 +108,9 @@ function Icon$1(props) {
108
108
  children
109
109
  );
110
110
  }
111
- Icon$1.defaultProps = defaultProps$1p;
111
+ Icon$1.defaultProps = defaultProps$1o;
112
112
  Icon$1.displayName = "NutIcon";
113
- const defaultProps$1o = {
113
+ const defaultProps$1n = {
114
114
  className: "",
115
115
  color: "",
116
116
  shape: "round",
@@ -143,7 +143,7 @@ const Button$1 = (props) => {
143
143
  style,
144
144
  ...rest
145
145
  } = {
146
- ...defaultProps$1o,
146
+ ...defaultProps$1n,
147
147
  ...props
148
148
  };
149
149
  const getStyle = useCallback(() => {
@@ -216,7 +216,7 @@ const Button$1 = (props) => {
216
216
  name: icon
217
217
  }) : "", children));
218
218
  };
219
- Button$1.defaultProps = defaultProps$1o;
219
+ Button$1.defaultProps = defaultProps$1n;
220
220
  Button$1.displayName = "NutButton";
221
221
  function _setPrototypeOf(o, p2) {
222
222
  _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
@@ -1434,7 +1434,7 @@ var useContext = React__default.useContext;
1434
1434
  function useHistory() {
1435
1435
  return useContext(historyContext);
1436
1436
  }
1437
- const defaultProps$1n = {
1437
+ const defaultProps$1m = {
1438
1438
  title: null,
1439
1439
  subTitle: null,
1440
1440
  desc: "",
@@ -1474,7 +1474,7 @@ const Cell = (props) => {
1474
1474
  linkSlot,
1475
1475
  ...rest
1476
1476
  } = {
1477
- ...defaultProps$1n,
1477
+ ...defaultProps$1m,
1478
1478
  ...props
1479
1479
  };
1480
1480
  const b2 = cn("cell");
@@ -1527,9 +1527,9 @@ const Cell = (props) => {
1527
1527
  className: b2("link")
1528
1528
  }) : linkSlot));
1529
1529
  };
1530
- Cell.defaultProps = defaultProps$1n;
1530
+ Cell.defaultProps = defaultProps$1m;
1531
1531
  Cell.displayName = "NutCell";
1532
- const defaultProps$1m = {
1532
+ const defaultProps$1l = {
1533
1533
  title: "",
1534
1534
  desc: "",
1535
1535
  titleSlot: null,
@@ -1538,7 +1538,7 @@ const defaultProps$1m = {
1538
1538
  };
1539
1539
  const CellGroup = (props) => {
1540
1540
  const { children, classPrefix, title, desc, titleSlot, descSlot } = {
1541
- ...defaultProps$1m,
1541
+ ...defaultProps$1l,
1542
1542
  ...props
1543
1543
  };
1544
1544
  const b2 = cn("cell-group");
@@ -1552,7 +1552,7 @@ const CellGroup = (props) => {
1552
1552
  className: b2("wrap")
1553
1553
  }, children));
1554
1554
  };
1555
- CellGroup.defaultProps = defaultProps$1m;
1555
+ CellGroup.defaultProps = defaultProps$1l;
1556
1556
  CellGroup.displayName = "NutCellGroup";
1557
1557
  var classnames = { exports: {} };
1558
1558
  /*!
@@ -1602,7 +1602,7 @@ var classnames = { exports: {} };
1602
1602
  })();
1603
1603
  })(classnames);
1604
1604
  var classNames = classnames.exports;
1605
- const defaultOverlayProps$1 = {
1605
+ const defaultOverlayProps = {
1606
1606
  zIndex: 2e3,
1607
1607
  duration: 0.3,
1608
1608
  overlayClass: "",
@@ -1611,7 +1611,7 @@ const defaultOverlayProps$1 = {
1611
1611
  lockScroll: true,
1612
1612
  overlayStyle: {}
1613
1613
  };
1614
- const Overlay$1 = (props) => {
1614
+ const Overlay = (props) => {
1615
1615
  const {
1616
1616
  children,
1617
1617
  zIndex,
@@ -1623,7 +1623,7 @@ const Overlay$1 = (props) => {
1623
1623
  overlayStyle,
1624
1624
  ...rest
1625
1625
  } = {
1626
- ...defaultOverlayProps$1,
1626
+ ...defaultOverlayProps,
1627
1627
  ...props
1628
1628
  };
1629
1629
  const [show, setShow] = useState(visible);
@@ -1679,8 +1679,8 @@ const Overlay$1 = (props) => {
1679
1679
  onClick: handleClick2
1680
1680
  }, children));
1681
1681
  };
1682
- Overlay$1.defaultProps = defaultOverlayProps$1;
1683
- Overlay$1.displayName = "NutOverlay";
1682
+ Overlay.defaultProps = defaultOverlayProps;
1683
+ Overlay.displayName = "NutOverlay";
1684
1684
  function hasClass(element, className) {
1685
1685
  if (element.classList)
1686
1686
  return !!className && element.classList.contains(className);
@@ -2105,7 +2105,7 @@ CSSTransition.defaultProps = {
2105
2105
  };
2106
2106
  CSSTransition.propTypes = {};
2107
2107
  var CSSTransition$1 = CSSTransition;
2108
- const defaultProps$1l = {
2108
+ const defaultProps$1k = {
2109
2109
  position: "center",
2110
2110
  transition: "",
2111
2111
  style: {},
@@ -2131,10 +2131,10 @@ const defaultProps$1l = {
2131
2131
  },
2132
2132
  onClickCloseIcon: (e2) => {
2133
2133
  },
2134
- ...defaultOverlayProps$1
2134
+ ...defaultOverlayProps
2135
2135
  };
2136
- let _zIndex$1 = 2e3;
2137
- const Popup$1 = (props) => {
2136
+ let _zIndex = 2e3;
2137
+ const Popup = (props) => {
2138
2138
  const {
2139
2139
  children,
2140
2140
  visible,
@@ -2164,7 +2164,7 @@ const Popup$1 = (props) => {
2164
2164
  onClosed,
2165
2165
  onClick
2166
2166
  } = props;
2167
- const [index2, setIndex] = useState(zIndex || _zIndex$1);
2167
+ const [index2, setIndex] = useState(zIndex || _zIndex);
2168
2168
  const [innerVisible, setInnerVisible] = useState(visible);
2169
2169
  const [showChildren, setShowChildren] = useState(true);
2170
2170
  const [transitionName, setTransitionName] = useState("");
@@ -2197,7 +2197,7 @@ const Popup$1 = (props) => {
2197
2197
  const open = () => {
2198
2198
  if (!innerVisible) {
2199
2199
  setInnerVisible(true);
2200
- setIndex(++_zIndex$1);
2200
+ setIndex(++_zIndex);
2201
2201
  }
2202
2202
  if (destroyOnClose) {
2203
2203
  setShowChildren(true);
@@ -2266,7 +2266,7 @@ const Popup$1 = (props) => {
2266
2266
  })) : ""));
2267
2267
  };
2268
2268
  const renderNode = () => {
2269
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, overlay ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Overlay$1, {
2269
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, overlay ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Overlay, {
2270
2270
  style: overlayStyles,
2271
2271
  overlayClass,
2272
2272
  visible: innerVisible,
@@ -2286,8 +2286,8 @@ const Popup$1 = (props) => {
2286
2286
  }, [position]);
2287
2287
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderToContainer(teleport, renderNode()));
2288
2288
  };
2289
- Popup$1.defaultProps = defaultProps$1l;
2290
- Popup$1.displayName = "NutPopup";
2289
+ Popup.defaultProps = defaultProps$1k;
2290
+ Popup.displayName = "NutPopup";
2291
2291
  const zhCN = {
2292
2292
  save: "\u4FDD\u5B58",
2293
2293
  confirm: "\u786E\u8BA4",
@@ -2413,7 +2413,7 @@ const zhCN = {
2413
2413
  completeText: "\u5237\u65B0\u6210\u529F"
2414
2414
  }
2415
2415
  };
2416
- const defaultProps$1k = {
2416
+ const defaultProps$1j = {
2417
2417
  locale: zhCN
2418
2418
  };
2419
2419
  const defaultConfigRef$1 = {
@@ -2430,7 +2430,7 @@ const useConfig$1 = () => {
2430
2430
  };
2431
2431
  const ConfigContext$1 = createContext(null);
2432
2432
  const ConfigProvider = (props) => {
2433
- const { children, ...config2 } = { ...defaultProps$1k, ...props };
2433
+ const { children, ...config2 } = { ...defaultProps$1j, ...props };
2434
2434
  const parentConfig = useConfig$1();
2435
2435
  return /* @__PURE__ */ React__default.createElement(ConfigContext$1.Provider, {
2436
2436
  value: {
@@ -2439,25 +2439,25 @@ const ConfigProvider = (props) => {
2439
2439
  }
2440
2440
  }, children);
2441
2441
  };
2442
- ConfigProvider.defaultProps = defaultProps$1k;
2442
+ ConfigProvider.defaultProps = defaultProps$1j;
2443
2443
  ConfigProvider.displayName = "NutConfigProvider";
2444
- const defaultProps$1j = {};
2444
+ const defaultProps$1i = {};
2445
2445
  const Layout = (props) => {
2446
- ({ ...defaultProps$1j, ...props });
2446
+ ({ ...defaultProps$1i, ...props });
2447
2447
  return /* @__PURE__ */ React__default.createElement("div", {
2448
2448
  className: "nut-layout"
2449
2449
  }, "Layout");
2450
2450
  };
2451
- Layout.defaultProps = defaultProps$1j;
2451
+ Layout.defaultProps = defaultProps$1i;
2452
2452
  Layout.displayName = "NutLayout";
2453
2453
  const DataContext$2 = createContext({});
2454
- const defaultProps$1i = {
2454
+ const defaultProps$1h = {
2455
2455
  span: "24",
2456
2456
  offset: "0",
2457
2457
  gutter: "0"
2458
2458
  };
2459
2459
  const Col = (props) => {
2460
- const { span, offset, children, onClick } = { ...defaultProps$1i, ...props };
2460
+ const { span, offset, children, onClick } = { ...defaultProps$1h, ...props };
2461
2461
  const [colName, setColName] = useState("");
2462
2462
  const [colStyle, setColStyle] = useState({});
2463
2463
  const { gutter } = useContext$1(DataContext$2);
@@ -2483,9 +2483,9 @@ const Col = (props) => {
2483
2483
  }
2484
2484
  }, children);
2485
2485
  };
2486
- Col.defaultProps = defaultProps$1i;
2486
+ Col.defaultProps = defaultProps$1h;
2487
2487
  Col.displayName = "NutCol";
2488
- const defaultProps$1h = {
2488
+ const defaultProps$1g = {
2489
2489
  type: "",
2490
2490
  justify: "start",
2491
2491
  align: "flex-start",
@@ -2494,7 +2494,7 @@ const defaultProps$1h = {
2494
2494
  };
2495
2495
  const Row = (props) => {
2496
2496
  const { children, type, justify, align, wrap, gutter, onClick } = {
2497
- ...defaultProps$1h,
2497
+ ...defaultProps$1g,
2498
2498
  ...props
2499
2499
  };
2500
2500
  const prefixCls = "nut-row";
@@ -2528,9 +2528,9 @@ const Row = (props) => {
2528
2528
  children
2529
2529
  ));
2530
2530
  };
2531
- Row.defaultProps = defaultProps$1h;
2531
+ Row.defaultProps = defaultProps$1g;
2532
2532
  Row.displayName = "NutRow";
2533
- const defaultProps$1g = {
2533
+ const defaultProps$1f = {
2534
2534
  contentPosition: "center",
2535
2535
  dashed: false,
2536
2536
  hairline: true,
@@ -2547,7 +2547,7 @@ const Divider = (props) => {
2547
2547
  direction,
2548
2548
  ...rest
2549
2549
  } = {
2550
- ...defaultProps$1g,
2550
+ ...defaultProps$1f,
2551
2551
  ...props
2552
2552
  };
2553
2553
  const dividerBem = cn("divider");
@@ -2568,9 +2568,9 @@ const Divider = (props) => {
2568
2568
  ...rest
2569
2569
  }, children);
2570
2570
  };
2571
- Divider.defaultProps = defaultProps$1g;
2571
+ Divider.defaultProps = defaultProps$1f;
2572
2572
  Divider.displayName = "NutDivider";
2573
- const defaultProps$1f = {
2573
+ const defaultProps$1e = {
2574
2574
  columnNum: 4,
2575
2575
  border: true,
2576
2576
  gutter: 0,
@@ -2597,7 +2597,7 @@ const Grid = (props) => {
2597
2597
  iconColor,
2598
2598
  className,
2599
2599
  ...rest
2600
- } = { ...defaultProps$1f, ...props };
2600
+ } = { ...defaultProps$1e, ...props };
2601
2601
  const childrenDom = React__default.Children.toArray(children);
2602
2602
  const pxCheck2 = (value) => {
2603
2603
  return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
@@ -2636,9 +2636,9 @@ const Grid = (props) => {
2636
2636
  });
2637
2637
  }));
2638
2638
  };
2639
- Grid.defaultProps = defaultProps$1f;
2639
+ Grid.defaultProps = defaultProps$1e;
2640
2640
  Grid.displayName = "NutGrid";
2641
- const defaultProps$1e = {
2641
+ const defaultProps$1d = {
2642
2642
  text: "",
2643
2643
  icon: "",
2644
2644
  iconSize: "",
@@ -2672,7 +2672,7 @@ const GridItem = (props) => {
2672
2672
  reverse,
2673
2673
  direction,
2674
2674
  ...rest
2675
- } = { ...defaultProps$1e, ...props };
2675
+ } = { ...defaultProps$1d, ...props };
2676
2676
  const b2 = cn("grid-item");
2677
2677
  const pxCheck2 = (value) => {
2678
2678
  return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
@@ -2712,9 +2712,9 @@ const GridItem = (props) => {
2712
2712
  className: "nut-grid-item__text"
2713
2713
  }, text), children && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children)));
2714
2714
  };
2715
- GridItem.defaultProps = defaultProps$1e;
2715
+ GridItem.defaultProps = defaultProps$1d;
2716
2716
  GridItem.displayName = "NutGridItem";
2717
- const defaultProps$1d = {
2717
+ const defaultProps$1c = {
2718
2718
  title: "",
2719
2719
  desc: "",
2720
2720
  leftShow: true,
@@ -2747,7 +2747,7 @@ const NavBar = (props) => {
2747
2747
  onClickBack,
2748
2748
  onClickRight
2749
2749
  } = {
2750
- ...defaultProps$1d,
2750
+ ...defaultProps$1c,
2751
2751
  ...props
2752
2752
  };
2753
2753
  const b2 = cn("navbar");
@@ -2812,9 +2812,9 @@ const NavBar = (props) => {
2812
2812
  className: `${b2("")}--placeholder`
2813
2813
  }, renderWrapper()) : renderWrapper());
2814
2814
  };
2815
- NavBar.defaultProps = defaultProps$1d;
2815
+ NavBar.defaultProps = defaultProps$1c;
2816
2816
  NavBar.displayName = "NutNavBar";
2817
- const defaultProps$1c = {
2817
+ const defaultProps$1b = {
2818
2818
  fixednavClass: "nut-fixednav",
2819
2819
  activeText: "",
2820
2820
  unActiveText: "",
@@ -2840,7 +2840,7 @@ const FixedNav = (props) => {
2840
2840
  slotList,
2841
2841
  slotBtn,
2842
2842
  ...rest
2843
- } = { ...defaultProps$1c, ...props };
2843
+ } = { ...defaultProps$1b, ...props };
2844
2844
  const b2 = cn("fixednav");
2845
2845
  const classes = classNames(
2846
2846
  {
@@ -2860,7 +2860,7 @@ const FixedNav = (props) => {
2860
2860
  className: classes,
2861
2861
  style: position,
2862
2862
  ...rest
2863
- }, overlay && /* @__PURE__ */ React__default.createElement(Overlay$1, {
2863
+ }, overlay && /* @__PURE__ */ React__default.createElement(Overlay, {
2864
2864
  visible,
2865
2865
  zIndex: 200,
2866
2866
  onClick: () => onUpdateValue(false)
@@ -2891,9 +2891,9 @@ const FixedNav = (props) => {
2891
2891
  className: "text"
2892
2892
  }, visible ? activeText || locale.fixednav.activeText : unActiveText || locale.fixednav.unActiveText))));
2893
2893
  };
2894
- FixedNav.defaultProps = defaultProps$1c;
2894
+ FixedNav.defaultProps = defaultProps$1b;
2895
2895
  FixedNav.displayName = "NutFixedNav";
2896
- const defaultProps$1b = {
2896
+ const defaultProps$1a = {
2897
2897
  visible: 0,
2898
2898
  bottom: false,
2899
2899
  size: 20,
@@ -2918,7 +2918,7 @@ const Tabbar = (props) => {
2918
2918
  style,
2919
2919
  tabSwitch
2920
2920
  } = {
2921
- ...defaultProps$1b,
2921
+ ...defaultProps$1a,
2922
2922
  ...props
2923
2923
  };
2924
2924
  const b2 = cn("tabbar");
@@ -2953,9 +2953,9 @@ const Tabbar = (props) => {
2953
2953
  return React__default.cloneElement(child, childProps);
2954
2954
  }));
2955
2955
  };
2956
- Tabbar.defaultProps = defaultProps$1b;
2956
+ Tabbar.defaultProps = defaultProps$1a;
2957
2957
  Tabbar.displayName = "NutTabbar";
2958
- const defaultProps$1a = {
2958
+ const defaultProps$19 = {
2959
2959
  dot: false,
2960
2960
  size: "",
2961
2961
  classPrefix: "nutui-iconfont",
@@ -2987,7 +2987,7 @@ const TabbarItem = (props) => {
2987
2987
  index: index2,
2988
2988
  handleClick: handleClick2
2989
2989
  } = {
2990
- ...defaultProps$1a,
2990
+ ...defaultProps$19,
2991
2991
  ...props
2992
2992
  };
2993
2993
  const b2 = cn("tabbar-item");
@@ -7966,7 +7966,7 @@ const host = createHost(primitives, {
7966
7966
  });
7967
7967
  const animated = host.animated;
7968
7968
  const elevatorContext$1 = createContext({});
7969
- const defaultProps$19 = {
7969
+ const defaultProps$18 = {
7970
7970
  height: "200px",
7971
7971
  acceptKey: "title",
7972
7972
  indexList: [],
@@ -7989,7 +7989,7 @@ const Elevator$1 = (props) => {
7989
7989
  children,
7990
7990
  ...rest
7991
7991
  } = {
7992
- ...defaultProps$19,
7992
+ ...defaultProps$18,
7993
7993
  ...props
7994
7994
  };
7995
7995
  const b2 = cn("elevator");
@@ -8177,9 +8177,9 @@ const Elevator$1 = (props) => {
8177
8177
  }, item[acceptKey]);
8178
8178
  }))));
8179
8179
  };
8180
- Elevator$1.defaultProps = defaultProps$19;
8180
+ Elevator$1.defaultProps = defaultProps$18;
8181
8181
  Elevator$1.displayName = "NutElevator";
8182
- const defaultProps$18 = {
8182
+ const defaultProps$17 = {
8183
8183
  defaultValue: 1,
8184
8184
  mode: "multi",
8185
8185
  prevText: "",
@@ -8196,7 +8196,7 @@ const defaultProps$18 = {
8196
8196
  };
8197
8197
  const Pagination = (props) => {
8198
8198
  const { locale } = useConfig$1();
8199
- ({ ...defaultProps$18, ...props });
8199
+ ({ ...defaultProps$17, ...props });
8200
8200
  const {
8201
8201
  modelValue,
8202
8202
  mode,
@@ -8313,7 +8313,7 @@ const Pagination = (props) => {
8313
8313
  onClick: (e2) => selectPage(Number(currentPage) + 1, true)
8314
8314
  }, nextText || locale.pagination.next));
8315
8315
  };
8316
- Pagination.defaultProps = defaultProps$18;
8316
+ Pagination.defaultProps = defaultProps$17;
8317
8317
  Pagination.displayName = "NutPagination";
8318
8318
  class Title {
8319
8319
  constructor() {
@@ -8323,7 +8323,7 @@ class Title {
8323
8323
  this.index = 0;
8324
8324
  }
8325
8325
  }
8326
- const defaultProps$17 = {
8326
+ const defaultProps$16 = {
8327
8327
  value: 0,
8328
8328
  color: "",
8329
8329
  background: "",
@@ -8358,7 +8358,7 @@ const Tabs = (props) => {
8358
8358
  className,
8359
8359
  autoHeight,
8360
8360
  ...rest
8361
- } = { ...defaultProps$17, ...props };
8361
+ } = { ...defaultProps$16, ...props };
8362
8362
  const [currentItem, setCurrentItem] = useState({ index: 0 });
8363
8363
  const titles = useRef([]);
8364
8364
  useEffect(() => {
@@ -8470,9 +8470,9 @@ const Tabs = (props) => {
8470
8470
  return React__default.cloneElement(child, childProps);
8471
8471
  })));
8472
8472
  };
8473
- Tabs.defaultProps = defaultProps$17;
8473
+ Tabs.defaultProps = defaultProps$16;
8474
8474
  Tabs.displayName = "NutTabs";
8475
- const defaultProps$16 = {
8475
+ const defaultProps$15 = {
8476
8476
  title: "",
8477
8477
  paneKey: "",
8478
8478
  activeKey: "",
@@ -8480,7 +8480,7 @@ const defaultProps$16 = {
8480
8480
  };
8481
8481
  const TabPane = (props) => {
8482
8482
  const { children, paneKey, activeKey, autoHeightClassName } = {
8483
- ...defaultProps$16,
8483
+ ...defaultProps$15,
8484
8484
  ...props
8485
8485
  };
8486
8486
  const b2 = cn("tabpane");
@@ -8495,7 +8495,7 @@ const TabPane = (props) => {
8495
8495
  className: classes
8496
8496
  }, children);
8497
8497
  };
8498
- const defaultProps$15 = {
8498
+ const defaultProps$14 = {
8499
8499
  size: 3,
8500
8500
  current: 1,
8501
8501
  block: false,
@@ -8515,7 +8515,7 @@ const Indicator = (props) => {
8515
8515
  vertical,
8516
8516
  ...rest
8517
8517
  } = {
8518
- ...defaultProps$15,
8518
+ ...defaultProps$14,
8519
8519
  ...props
8520
8520
  };
8521
8521
  const b2 = cn("indicator");
@@ -8549,7 +8549,7 @@ const Indicator = (props) => {
8549
8549
  ...rest
8550
8550
  }, renderEles());
8551
8551
  };
8552
- Indicator.defaultProps = defaultProps$15;
8552
+ Indicator.defaultProps = defaultProps$14;
8553
8553
  Indicator.displayName = "NutIndicator";
8554
8554
  const handleClick = (e2) => {
8555
8555
  e2.stopPropagation();
@@ -8565,7 +8565,7 @@ const handleClick = (e2) => {
8565
8565
  }
8566
8566
  };
8567
8567
  const OffsetContext = createContext(20);
8568
- const defaultProps$14 = {
8568
+ const defaultProps$13 = {
8569
8569
  showhead: false,
8570
8570
  position: "left",
8571
8571
  width: "80%"
@@ -8583,11 +8583,11 @@ const SideNavBar = (props) => {
8583
8583
  handleClose,
8584
8584
  ...rest
8585
8585
  } = {
8586
- ...defaultProps$14,
8586
+ ...defaultProps$13,
8587
8587
  ...props
8588
8588
  };
8589
8589
  const offset = props.offset ? Number(props.offset) : 20;
8590
- return /* @__PURE__ */ React__default.createElement(Popup$1, {
8590
+ return /* @__PURE__ */ React__default.createElement(Popup, {
8591
8591
  visible,
8592
8592
  style: { width, height: "100%" },
8593
8593
  position,
@@ -8611,14 +8611,14 @@ const SideNavBar = (props) => {
8611
8611
  className: "nut-sidenavbar__content"
8612
8612
  }, children))))));
8613
8613
  };
8614
- SideNavBar.defaultProps = defaultProps$14;
8614
+ SideNavBar.defaultProps = defaultProps$13;
8615
8615
  SideNavBar.displayName = "NutSideNavBar";
8616
- const defaultProps$13 = {
8616
+ const defaultProps$12 = {
8617
8617
  open: true
8618
8618
  };
8619
8619
  const SubSideNavBar = (props) => {
8620
8620
  const { title, ikey, children, titleClick, open, ...rest } = {
8621
- ...defaultProps$13,
8621
+ ...defaultProps$12,
8622
8622
  ...props
8623
8623
  };
8624
8624
  const offset = useContext$1(OffsetContext);
@@ -8689,7 +8689,7 @@ const SideNavBarItem = (props) => {
8689
8689
  ...rest
8690
8690
  }, title);
8691
8691
  };
8692
- const defaultProps$12 = {
8692
+ const defaultProps$11 = {
8693
8693
  className: "",
8694
8694
  style: {},
8695
8695
  activeColor: "#F2270C",
@@ -8709,7 +8709,7 @@ const Menu = (props) => {
8709
8709
  activeColor,
8710
8710
  ...rest
8711
8711
  } = {
8712
- ...defaultProps$12,
8712
+ ...defaultProps$11,
8713
8713
  ...props
8714
8714
  };
8715
8715
  const parentRef = useRef(null);
@@ -8802,9 +8802,9 @@ const Menu = (props) => {
8802
8802
  })));
8803
8803
  })), cloneChildren());
8804
8804
  };
8805
- Menu.defaultProps = defaultProps$12;
8805
+ Menu.defaultProps = defaultProps$11;
8806
8806
  Menu.displayName = "NutMenu";
8807
- const defaultProps$11 = {
8807
+ const defaultProps$10 = {
8808
8808
  className: "",
8809
8809
  style: {},
8810
8810
  columns: 1,
@@ -8818,7 +8818,7 @@ const defaultProps$11 = {
8818
8818
  };
8819
8819
  const MenuItem = (props) => {
8820
8820
  useConfig$1();
8821
- const mergedProps = { ...defaultProps$11, ...props };
8821
+ const mergedProps = { ...defaultProps$10, ...props };
8822
8822
  const {
8823
8823
  className,
8824
8824
  style,
@@ -8835,7 +8835,7 @@ const MenuItem = (props) => {
8835
8835
  inactiveTitleClass,
8836
8836
  children
8837
8837
  } = {
8838
- ...defaultProps$11,
8838
+ ...defaultProps$10,
8839
8839
  ...props
8840
8840
  };
8841
8841
  const { activeColor, showPopup, parent, orderKey } = mergedProps;
@@ -8908,7 +8908,7 @@ const MenuItem = (props) => {
8908
8908
  })} ${className}`,
8909
8909
  style: placeholderStyle(),
8910
8910
  onClick: () => parent.toggleItemShow(orderKey)
8911
- }), /* @__PURE__ */ React__default.createElement(Overlay$1, {
8911
+ }), /* @__PURE__ */ React__default.createElement(Overlay, {
8912
8912
  overlayClass: "nut-menu__overlay",
8913
8913
  style: getPosition(),
8914
8914
  lockScroll: parent.lockScroll,
@@ -8955,7 +8955,7 @@ const MenuItem = (props) => {
8955
8955
  }, item.text));
8956
8956
  }), children))));
8957
8957
  };
8958
- MenuItem.defaultProps = defaultProps$11;
8958
+ MenuItem.defaultProps = defaultProps$10;
8959
8959
  MenuItem.displayName = "NutMenuItem";
8960
8960
  const MIN_DISTANCE = 10;
8961
8961
  function getDirection(x2, y2) {
@@ -9055,7 +9055,7 @@ const getRectByTaro = async (element) => {
9055
9055
  const res = await element.getBoundingClientRect();
9056
9056
  return res;
9057
9057
  };
9058
- const defaultProps$10 = {
9058
+ const defaultProps$$ = {
9059
9059
  name: "",
9060
9060
  size: "",
9061
9061
  classPrefix: "nut-icon",
@@ -9083,7 +9083,7 @@ function Icon(props) {
9083
9083
  onClick,
9084
9084
  ...rest
9085
9085
  } = {
9086
- ...defaultProps$10,
9086
+ ...defaultProps$$,
9087
9087
  ...props
9088
9088
  };
9089
9089
  const isImage = name ? name.indexOf("/") !== -1 : false;
@@ -9117,7 +9117,7 @@ function Icon(props) {
9117
9117
  children
9118
9118
  );
9119
9119
  }
9120
- Icon.defaultProps = defaultProps$10;
9120
+ Icon.defaultProps = defaultProps$$;
9121
9121
  Icon.displayName = "NutIcon";
9122
9122
  let createRoot;
9123
9123
  try {
@@ -9341,7 +9341,7 @@ var Toast = {
9341
9341
  }
9342
9342
  }
9343
9343
  };
9344
- const defaultProps$$ = {
9344
+ const defaultProps$_ = {
9345
9345
  range: false,
9346
9346
  hiddenRange: false,
9347
9347
  hiddenTag: false,
@@ -9372,8 +9372,8 @@ const Range = (props) => {
9372
9372
  change,
9373
9373
  dragStart,
9374
9374
  dragEnd
9375
- } = { ...defaultProps$$, ...props };
9376
- let { min, max, step } = { ...defaultProps$$, ...props };
9375
+ } = { ...defaultProps$_, ...props };
9376
+ let { min, max, step } = { ...defaultProps$_, ...props };
9377
9377
  min = Number(min);
9378
9378
  max = Number(max);
9379
9379
  step = Number(step);
@@ -9708,7 +9708,7 @@ const Range = (props) => {
9708
9708
  className: "max"
9709
9709
  }, +max) : null);
9710
9710
  };
9711
- Range.defaultProps = defaultProps$$;
9711
+ Range.defaultProps = defaultProps$_;
9712
9712
  Range.displayName = "NutRange";
9713
9713
  const Utils = {
9714
9714
  isLeapYear(y2) {
@@ -9802,7 +9802,7 @@ function requestAniFrame() {
9802
9802
  };
9803
9803
  }
9804
9804
  var requestAniFrame$1 = requestAniFrame();
9805
- const defaultProps$_ = {
9805
+ const defaultProps$Z = {
9806
9806
  type: "one",
9807
9807
  isAutoBackFill: false,
9808
9808
  poppable: true,
@@ -9831,7 +9831,7 @@ const CalendarItem = (props) => {
9831
9831
  onChoose,
9832
9832
  onUpdate,
9833
9833
  onClose
9834
- } = { ...defaultProps$_, ...props };
9834
+ } = { ...defaultProps$Z, ...props };
9835
9835
  const weeks = locale.calendaritem.weekdays;
9836
9836
  const [yearMonthTitle, setYearMonthTitle] = useState("");
9837
9837
  const [unLoadPrev, setUnLoadPrev] = useState(false);
@@ -10255,9 +10255,9 @@ const CalendarItem = (props) => {
10255
10255
  onClick: confirm2
10256
10256
  }, locale.confirm)) : ""));
10257
10257
  };
10258
- CalendarItem.defaultProps = defaultProps$_;
10258
+ CalendarItem.defaultProps = defaultProps$Z;
10259
10259
  CalendarItem.displayName = "NutCalendarItem";
10260
- const defaultProps$Z = {
10260
+ const defaultProps$Y = {
10261
10261
  type: "one",
10262
10262
  isAutoBackFill: false,
10263
10263
  poppable: true,
@@ -10285,7 +10285,7 @@ const Calendar = (props) => {
10285
10285
  endDate,
10286
10286
  onClose,
10287
10287
  onChoose
10288
- } = { ...defaultProps$Z, ...props };
10288
+ } = { ...defaultProps$Y, ...props };
10289
10289
  const close = () => {
10290
10290
  onClose && onClose();
10291
10291
  };
@@ -10298,7 +10298,7 @@ const Calendar = (props) => {
10298
10298
  const closePopup = () => {
10299
10299
  close();
10300
10300
  };
10301
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, poppable ? /* @__PURE__ */ React__default.createElement(Popup$1, {
10301
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, poppable ? /* @__PURE__ */ React__default.createElement(Popup, {
10302
10302
  visible,
10303
10303
  position: "bottom",
10304
10304
  round: true,
@@ -10328,9 +10328,9 @@ const Calendar = (props) => {
10328
10328
  onChoose: choose
10329
10329
  }));
10330
10330
  };
10331
- Calendar.defaultProps = defaultProps$Z;
10331
+ Calendar.defaultProps = defaultProps$Y;
10332
10332
  Calendar.displayName = "NutCalendar";
10333
- const defaultProps$Y = {
10333
+ const defaultProps$X = {
10334
10334
  disabled: false,
10335
10335
  checkedValue: [],
10336
10336
  max: void 0,
@@ -10339,7 +10339,7 @@ const defaultProps$Y = {
10339
10339
  };
10340
10340
  const CheckboxGroup = React__default.forwardRef(
10341
10341
  (props, ref) => {
10342
- const { children } = { ...defaultProps$Y, ...props };
10342
+ const { children } = { ...defaultProps$X, ...props };
10343
10343
  const b2 = cn("checkboxgroup");
10344
10344
  const { className, disabled, onChange, checkedValue, max, ...rest } = props;
10345
10345
  const [innerDisabled, setInnerDisabled] = useState(disabled);
@@ -10418,9 +10418,9 @@ const CheckboxGroup = React__default.forwardRef(
10418
10418
  }, cloneChildren());
10419
10419
  }
10420
10420
  );
10421
- CheckboxGroup.defaultProps = defaultProps$Y;
10421
+ CheckboxGroup.defaultProps = defaultProps$X;
10422
10422
  CheckboxGroup.displayName = "NutCheckboxGroup";
10423
- const defaultProps$X = {
10423
+ const defaultProps$W = {
10424
10424
  checked: false,
10425
10425
  disabled: false,
10426
10426
  textPosition: "right",
@@ -10434,7 +10434,7 @@ const defaultProps$X = {
10434
10434
  }
10435
10435
  };
10436
10436
  const Checkbox = (props) => {
10437
- const { children } = { ...defaultProps$X, ...props };
10437
+ const { children } = { ...defaultProps$W, ...props };
10438
10438
  const b2 = cn("checkbox");
10439
10439
  const {
10440
10440
  iconName,
@@ -10514,355 +10514,95 @@ const Checkbox = (props) => {
10514
10514
  onClick: handleClick2
10515
10515
  }, renderIcon(), renderLabel());
10516
10516
  };
10517
- Checkbox.defaultProps = defaultProps$X;
10517
+ Checkbox.defaultProps = defaultProps$W;
10518
10518
  Checkbox.displayName = "NutCheckBox";
10519
10519
  Checkbox.Group = CheckboxGroup;
10520
- const defaultOverlayProps = {
10521
- zIndex: 2e3,
10522
- duration: 0.3,
10523
- overlayClass: "",
10524
- closeOnClickOverlay: true,
10525
- visible: false,
10526
- lockScroll: true,
10527
- overlayStyle: {}
10528
- };
10529
- const Overlay = (props) => {
10520
+ const InternalPickerSlot = (props, ref) => {
10530
10521
  const {
10531
- children,
10532
- zIndex,
10533
- duration,
10534
- overlayClass,
10535
- closeOnClickOverlay,
10536
- visible,
10537
- lockScroll,
10538
- overlayStyle,
10539
- ...rest
10540
- } = {
10541
- ...defaultOverlayProps,
10542
- ...props
10522
+ keyIndex = 0,
10523
+ defaultValue,
10524
+ listData = [],
10525
+ threeDimensional = true,
10526
+ swipeDuration = 1e3,
10527
+ itemShow = false,
10528
+ chooseItem
10529
+ } = props;
10530
+ const touch = useTouch();
10531
+ const DEFAULT_DURATION = 200;
10532
+ const INERTIA_TIME = 300;
10533
+ const INERTIA_DISTANCE = 15;
10534
+ const [currIndex, setCurrIndex] = useState(1);
10535
+ const lineSpacing = useRef(36);
10536
+ const [touchTime, setTouchTime] = useState(0);
10537
+ const [touchDeg, setTouchDeg] = useState("0deg");
10538
+ const rotation = 20;
10539
+ const moving = useRef(false);
10540
+ let timer;
10541
+ const listbox = useRef(null);
10542
+ const rollerRef = useRef(null);
10543
+ const pickerSlotRef = useRef(null);
10544
+ const [startTime, setStartTime] = useState(0);
10545
+ const [startY, setStartY] = useState(0);
10546
+ const transformY = useRef(0);
10547
+ const [scrollDistance, setScrollDistance] = useState(0);
10548
+ const isHidden = (index2) => {
10549
+ if (index2 >= currIndex + 8 || index2 <= currIndex - 8) {
10550
+ return true;
10551
+ }
10552
+ return false;
10543
10553
  };
10544
- const [show, setShow] = useState(visible);
10545
- const renderRef = useRef(true);
10546
- const intervalRef = useRef(0);
10547
- useEffect(() => {
10548
- visible && setShow(visible);
10549
- lock();
10550
- }, [visible]);
10551
- useEffect(() => {
10552
- return () => {
10553
- clearTimeout(intervalRef.current);
10554
- document.body.classList.remove("nut-overflow-hidden");
10555
- };
10556
- }, []);
10557
- const b2 = cn("overlay");
10558
- const classes = classNames(
10559
- {
10560
- "overlay-fade-leave-active": !renderRef.current && !visible,
10561
- "overlay-fade-enter-active": visible,
10562
- "first-render": renderRef.current && !visible,
10563
- "hidden-render": !visible
10564
- },
10565
- overlayClass,
10566
- b2("")
10567
- );
10568
- const styles = {
10569
- zIndex,
10570
- animationDuration: `${props.duration}s`,
10571
- ...overlayStyle
10554
+ const setTransform = (translateY = 0, type, time = DEFAULT_DURATION, deg) => {
10555
+ let nTime = time;
10556
+ if (type !== "end") {
10557
+ nTime = 0;
10558
+ }
10559
+ setTouchTime(nTime);
10560
+ setTouchDeg(deg);
10561
+ setScrollDistance(translateY);
10572
10562
  };
10573
- const lock = () => {
10574
- if (lockScroll && visible) {
10575
- document.body.classList.add("nut-overflow-hidden");
10563
+ const setMove = (move, type, time) => {
10564
+ console.log("move");
10565
+ let updateMove = move + transformY.current;
10566
+ if (type === "end") {
10567
+ if (updateMove > 0) {
10568
+ updateMove = 0;
10569
+ }
10570
+ if (updateMove < -(listData.length - 1) * lineSpacing.current) {
10571
+ updateMove = -(listData.length - 1) * lineSpacing.current;
10572
+ }
10573
+ const endMove = Math.round(updateMove / lineSpacing.current) * lineSpacing.current;
10574
+ const deg = `${(Math.abs(Math.round(endMove / lineSpacing.current)) + 1) * rotation}deg`;
10575
+ setTransform(endMove, type, time, deg);
10576
+ setCurrIndex(Math.abs(Math.round(endMove / lineSpacing.current)) + 1);
10576
10577
  } else {
10577
- document.body.classList.remove("nut-overflow-hidden");
10578
+ let deg = 0;
10579
+ const currentDeg = (-updateMove / lineSpacing.current + 1) * rotation;
10580
+ const maxDeg = (listData.length + 1) * rotation;
10581
+ const minDeg = 0;
10582
+ deg = Math.min(Math.max(currentDeg, minDeg), maxDeg);
10583
+ if (minDeg < deg && deg < maxDeg) {
10584
+ setTransform(updateMove, "", void 0, `${deg}deg`);
10585
+ setCurrIndex(Math.abs(Math.round(updateMove / lineSpacing.current)) + 1);
10586
+ }
10578
10587
  }
10579
10588
  };
10580
- const handleClick2 = (e2) => {
10581
- if (closeOnClickOverlay) {
10582
- props.onClick && props.onClick(e2);
10583
- renderRef.current = false;
10584
- const id = setTimeout(() => {
10585
- setShow(!visible);
10586
- }, duration * 1e3 * 0.8);
10587
- intervalRef.current = id;
10589
+ const setChooseValue = (move) => {
10590
+ chooseItem && chooseItem(listData == null ? void 0 : listData[Math.round(-move / lineSpacing.current)], keyIndex);
10591
+ };
10592
+ const touchStart = (event) => {
10593
+ touch.start(event);
10594
+ setStartY(touch.deltaY);
10595
+ setStartTime(Date.now());
10596
+ transformY.current = scrollDistance;
10597
+ };
10598
+ const touchMove = (event) => {
10599
+ touch.move(event);
10600
+ if (touch.isVertical) {
10601
+ moving.current = true;
10602
+ preventDefault2(event, true);
10588
10603
  }
10589
- };
10590
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
10591
- className: classes,
10592
- style: styles,
10593
- ...rest,
10594
- onClick: handleClick2
10595
- }, children));
10596
- };
10597
- Overlay.defaultProps = defaultOverlayProps;
10598
- Overlay.displayName = "NutOverlay";
10599
- const defaultProps$W = {
10600
- position: "center",
10601
- transition: "",
10602
- style: {},
10603
- popClass: "",
10604
- closeable: false,
10605
- closeIconPosition: "top-right",
10606
- closeIcon: "close",
10607
- destroyOnClose: true,
10608
- teleport: null,
10609
- overlay: true,
10610
- round: false,
10611
- onOpen: () => {
10612
- },
10613
- onClose: () => {
10614
- },
10615
- onClick: (e2) => {
10616
- },
10617
- onOpened: (e2) => {
10618
- },
10619
- onClosed: (e2) => {
10620
- },
10621
- onClickOverlay: (e2) => {
10622
- },
10623
- onClickCloseIcon: (e2) => {
10624
- },
10625
- ...defaultOverlayProps
10626
- };
10627
- let _zIndex = 2e3;
10628
- const Popup = (props) => {
10629
- const {
10630
- children,
10631
- visible,
10632
- overlay,
10633
- closeOnClickOverlay,
10634
- overlayStyle,
10635
- overlayClass,
10636
- zIndex,
10637
- lockScroll,
10638
- duration,
10639
- closeable,
10640
- closeIconPosition,
10641
- closeIcon,
10642
- style,
10643
- transition,
10644
- round,
10645
- position,
10646
- popClass,
10647
- className,
10648
- destroyOnClose,
10649
- teleport,
10650
- onOpen,
10651
- onClose,
10652
- onClickOverlay,
10653
- onClickCloseIcon,
10654
- onOpened,
10655
- onClosed,
10656
- onClick
10657
- } = props;
10658
- const [index2, setIndex] = useState(zIndex || _zIndex);
10659
- const [innerVisible, setInnerVisible] = useState(visible);
10660
- const [showChildren, setShowChildren] = useState(true);
10661
- const [transitionName, setTransitionName] = useState("");
10662
- const b2 = cn("popup");
10663
- const baseStyle = {
10664
- zIndex: index2,
10665
- animationDuration: `${duration}s`
10666
- };
10667
- const overlayStyles = {
10668
- ...overlayStyle,
10669
- ...baseStyle
10670
- };
10671
- const popStyles = {
10672
- ...style,
10673
- ...baseStyle
10674
- };
10675
- const classes = classNames(
10676
- {
10677
- round,
10678
- [`popup-${position}`]: true,
10679
- [`${popClass}`]: true,
10680
- [`${className}`]: true
10681
- },
10682
- b2("")
10683
- );
10684
- const closeClasses = classNames({
10685
- "nutui-popup__close-icon": true,
10686
- [`nutui-popup__close-icon--${closeIconPosition}`]: true
10687
- });
10688
- const open = () => {
10689
- if (!innerVisible) {
10690
- setInnerVisible(true);
10691
- setIndex(++_zIndex);
10692
- }
10693
- if (destroyOnClose) {
10694
- setShowChildren(true);
10695
- }
10696
- onOpen && onOpen();
10697
- };
10698
- const close = () => {
10699
- if (innerVisible) {
10700
- setInnerVisible(false);
10701
- if (destroyOnClose) {
10702
- setTimeout(() => {
10703
- setShowChildren(false);
10704
- onClose && onClose();
10705
- }, Number(duration) * 1e3);
10706
- }
10707
- }
10708
- };
10709
- const onHandleClickOverlay = (e2) => {
10710
- if (closeOnClickOverlay) {
10711
- onClickOverlay && onClickOverlay(e2);
10712
- close();
10713
- }
10714
- };
10715
- const onHandleClick = (e2) => {
10716
- onClick && onClick(e2);
10717
- };
10718
- const onHandleClickCloseIcon = (e2) => {
10719
- onClickCloseIcon && onClickCloseIcon(e2);
10720
- close();
10721
- };
10722
- const onHandleOpened = (e2) => {
10723
- onOpened && onOpened(e2);
10724
- };
10725
- const onHandleClosed = (e2) => {
10726
- onClosed && onClosed(e2);
10727
- };
10728
- const resolveContainer = (getContainer) => {
10729
- const container = typeof getContainer === "function" ? getContainer() : getContainer;
10730
- return container || document.body;
10731
- };
10732
- const renderToContainer = (getContainer, node) => {
10733
- if (getContainer) {
10734
- const container = resolveContainer(getContainer);
10735
- return createPortal(node, container);
10736
- }
10737
- return node;
10738
- };
10739
- const renderPop = () => {
10740
- return /* @__PURE__ */ React__default.createElement(CSSTransition$1, {
10741
- classNames: transitionName,
10742
- unmountOnExit: true,
10743
- timeout: 500,
10744
- in: innerVisible,
10745
- onEntered: onHandleOpened,
10746
- onExited: onHandleClosed
10747
- }, /* @__PURE__ */ React__default.createElement("div", {
10748
- style: popStyles,
10749
- className: classes,
10750
- onClick: onHandleClick
10751
- }, showChildren ? children : "", closeable ? /* @__PURE__ */ React__default.createElement("div", {
10752
- className: closeClasses,
10753
- onClick: onHandleClickCloseIcon
10754
- }, /* @__PURE__ */ React__default.createElement(Icon, {
10755
- name: closeIcon,
10756
- size: "12px"
10757
- })) : ""));
10758
- };
10759
- const renderNode = () => {
10760
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, overlay ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Overlay, {
10761
- style: overlayStyles,
10762
- overlayClass,
10763
- visible: innerVisible,
10764
- closeOnClickOverlay,
10765
- zIndex,
10766
- lockScroll,
10767
- duration,
10768
- onClick: onHandleClickOverlay
10769
- }), renderPop()) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderPop()));
10770
- };
10771
- useEffect(() => {
10772
- visible && open();
10773
- !visible && close();
10774
- }, [visible]);
10775
- useEffect(() => {
10776
- setTransitionName(transition || `popup-slide-${position}`);
10777
- }, [position]);
10778
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderToContainer(teleport, renderNode()));
10779
- };
10780
- Popup.defaultProps = defaultProps$W;
10781
- Popup.displayName = "NutPopup";
10782
- const InternalPickerSlot$1 = (props, ref) => {
10783
- const {
10784
- keyIndex = 0,
10785
- defaultValue,
10786
- listData = [],
10787
- threeDimensional = true,
10788
- swipeDuration = 1e3,
10789
- chooseItem
10790
- } = props;
10791
- const touch = useTouch();
10792
- const DEFAULT_DURATION = 200;
10793
- const INERTIA_TIME = 300;
10794
- const INERTIA_DISTANCE = 15;
10795
- const [currIndex, setCurrIndex] = useState(1);
10796
- const lineSpacing = 36;
10797
- const [touchTime, setTouchTime] = useState(0);
10798
- const [touchDeg, setTouchDeg] = useState("0deg");
10799
- const rotation = 20;
10800
- const moving = useRef(false);
10801
- let timer;
10802
- useRef(null);
10803
- const rollerRef = useRef(null);
10804
- const pickerSlotRef = useRef(null);
10805
- const [startTime, setStartTime] = useState(0);
10806
- const [startY, setStartY] = useState(0);
10807
- const transformY = useRef(0);
10808
- const [scrollDistance, setScrollDistance] = useState(0);
10809
- const isHidden = (index2) => {
10810
- if (index2 >= currIndex + 8 || index2 <= currIndex - 8) {
10811
- return true;
10812
- }
10813
- return false;
10814
- };
10815
- const setTransform = (translateY = 0, type, time = DEFAULT_DURATION, deg) => {
10816
- let nTime = time;
10817
- if (type !== "end") {
10818
- nTime = 0;
10819
- }
10820
- setTouchTime(nTime);
10821
- setTouchDeg(deg);
10822
- setScrollDistance(translateY);
10823
- };
10824
- const setMove = (move, type, time) => {
10825
- let updateMove = move + transformY.current;
10826
- if (type === "end") {
10827
- if (updateMove > 0) {
10828
- updateMove = 0;
10829
- }
10830
- if (updateMove < -(listData.length - 1) * lineSpacing) {
10831
- updateMove = -(listData.length - 1) * lineSpacing;
10832
- }
10833
- const endMove = Math.round(updateMove / lineSpacing) * lineSpacing;
10834
- const deg = `${(Math.abs(Math.round(endMove / lineSpacing)) + 1) * rotation}deg`;
10835
- setTransform(endMove, type, time, deg);
10836
- setCurrIndex(Math.abs(Math.round(endMove / lineSpacing)) + 1);
10837
- } else {
10838
- let deg = 0;
10839
- const currentDeg = (-updateMove / lineSpacing + 1) * rotation;
10840
- const maxDeg = (listData.length + 1) * rotation;
10841
- const minDeg = 0;
10842
- deg = Math.min(Math.max(currentDeg, minDeg), maxDeg);
10843
- if (minDeg < deg && deg < maxDeg) {
10844
- setTransform(updateMove, "", void 0, `${deg}deg`);
10845
- setCurrIndex(Math.abs(Math.round(updateMove / lineSpacing)) + 1);
10846
- }
10847
- }
10848
- };
10849
- const setChooseValue = (move) => {
10850
- chooseItem && chooseItem(listData == null ? void 0 : listData[Math.round(-move / lineSpacing)], keyIndex);
10851
- };
10852
- const touchStart = (event) => {
10853
- touch.start(event);
10854
- setStartY(touch.deltaY);
10855
- setStartTime(Date.now());
10856
- transformY.current = scrollDistance;
10857
- };
10858
- const touchMove = (event) => {
10859
- touch.move(event);
10860
- if (touch.isVertical) {
10861
- moving.current = true;
10862
- preventDefault2(event, true);
10863
- }
10864
- const move = touch.deltaY - startY;
10865
- setMove(move);
10604
+ const move = touch.deltaY - startY;
10605
+ setMove(move);
10866
10606
  };
10867
10607
  const touchEnd = (event) => {
10868
10608
  if (!moving.current)
@@ -10904,7 +10644,7 @@ const InternalPickerSlot$1 = (props, ref) => {
10904
10644
  });
10905
10645
  }
10906
10646
  setCurrIndex(index2 === -1 ? 1 : index2 + 1);
10907
- const move = index2 === -1 ? 0 : index2 * lineSpacing;
10647
+ const move = index2 === -1 ? 0 : index2 * lineSpacing.current;
10908
10648
  type && setChooseValue(-move);
10909
10649
  setMove(-move);
10910
10650
  };
@@ -10921,11 +10661,17 @@ const InternalPickerSlot$1 = (props, ref) => {
10921
10661
  event.stopPropagation();
10922
10662
  }
10923
10663
  };
10924
- const touchRollerStyle = () => {
10925
- return {
10926
- transition: `transform ${touchTime}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
10927
- transform: `rotate3d(1, 0, 0, ${touchDeg})`
10928
- };
10664
+ const getReference = async () => {
10665
+ const refe = await getRectByTaro(listbox == null ? void 0 : listbox.current);
10666
+ console.log(refe);
10667
+ lineSpacing.current = refe.height ? refe.height : 36;
10668
+ modifyStatus(true);
10669
+ };
10670
+ const touchRollerStyle = () => {
10671
+ return {
10672
+ transition: `transform ${touchTime}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
10673
+ transform: `rotate3d(1, 0, 0, ${touchDeg})`
10674
+ };
10929
10675
  };
10930
10676
  const touchTileStyle = () => {
10931
10677
  return {
@@ -10941,6 +10687,13 @@ const InternalPickerSlot$1 = (props, ref) => {
10941
10687
  clearTimeout(timer);
10942
10688
  };
10943
10689
  }, [listData]);
10690
+ useEffect(() => {
10691
+ if (itemShow) {
10692
+ setTimeout(() => {
10693
+ getReference();
10694
+ }, 200);
10695
+ }
10696
+ }, [itemShow]);
10944
10697
  useImperativeHandle(ref, () => ({
10945
10698
  stopMomentum,
10946
10699
  moving: moving.current
@@ -10960,22 +10713,29 @@ const InternalPickerSlot$1 = (props, ref) => {
10960
10713
  return /* @__PURE__ */ React__default.createElement("div", {
10961
10714
  className: `nut-picker-roller-item ${isHidden(index2 + 1) && "nut-picker-roller-item-hidden"}`,
10962
10715
  style: {
10963
- transform: `rotate3d(1, 0, 0, ${-rotation * (index2 + 1)}deg) translate3d(0px, 0px, 104px)`
10716
+ transform: `rotate3d(1, 0, 0, ${-rotation * (index2 + 1)}deg) translate3d(0px, 0px, 104px)`,
10717
+ height: `${lineSpacing.current}px`,
10718
+ lineHeight: `${lineSpacing.current}px`
10964
10719
  },
10965
10720
  key: item.value ? item.value : index2
10966
10721
  }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, item.text ? item.text : item));
10967
10722
  }), !threeDimensional && listData.map((item, index2) => {
10968
10723
  return /* @__PURE__ */ React__default.createElement("div", {
10969
10724
  className: "nut-picker-roller-item-tile",
10970
- key: item.value ? item.value : index2
10725
+ key: item.value ? item.value : index2,
10726
+ style: {
10727
+ height: `${lineSpacing.current}px`,
10728
+ lineHeight: `${lineSpacing.current}px`
10729
+ }
10971
10730
  }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, item.text ? item.text : item));
10972
10731
  })), /* @__PURE__ */ React__default.createElement("div", {
10973
10732
  className: "nut-picker-mask"
10974
10733
  }), /* @__PURE__ */ React__default.createElement("div", {
10975
- className: "nut-picker-indicator"
10734
+ className: "nut-picker-indicator",
10735
+ ref: listbox
10976
10736
  }));
10977
10737
  };
10978
- const PickerSlot$1 = React__default.forwardRef(InternalPickerSlot$1);
10738
+ const PickerSlot = React__default.forwardRef(InternalPickerSlot);
10979
10739
  function useRefs() {
10980
10740
  const refs = React__default.useRef([]);
10981
10741
  const setRefs = React__default.useCallback(
@@ -10990,21 +10750,8 @@ function useRefs() {
10990
10750
  }, []);
10991
10751
  return [refs.current, setRefs, reset];
10992
10752
  }
10993
- const defaultConfigRef = {
10994
- current: {
10995
- locale: zhCN
10996
- }
10997
- };
10998
- const getDefaultConfig = () => {
10999
- return defaultConfigRef.current;
11000
- };
11001
- const useConfig = () => {
11002
- var _a;
11003
- return (_a = useContext$1(ConfigContext)) != null ? _a : getDefaultConfig();
11004
- };
11005
- const ConfigContext = createContext(null);
11006
- const InternalPicker$1 = (props, ref) => {
11007
- const { locale } = useConfig();
10753
+ const InternalPicker = (props, ref) => {
10754
+ const { locale } = useConfig$1();
11008
10755
  const {
11009
10756
  isVisible,
11010
10757
  title,
@@ -11035,7 +10782,6 @@ const InternalPicker$1 = (props, ref) => {
11035
10782
  }
11036
10783
  }, [defaultValueData]);
11037
10784
  useEffect(() => {
11038
- console.log("\u4FEE\u6539");
11039
10785
  onChange && onChange(columnIndex, chooseValueData, selectedOptions());
11040
10786
  if (isConfirmEvent.current) {
11041
10787
  isConfirmEvent.current = false;
@@ -11200,7 +10946,7 @@ const InternalPicker$1 = (props, ref) => {
11200
10946
  className: b2("panel"),
11201
10947
  ref: pickerRef
11202
10948
  }, columnsList == null ? void 0 : columnsList.map((item, index2) => {
11203
- return /* @__PURE__ */ React__default.createElement(PickerSlot$1, {
10949
+ return /* @__PURE__ */ React__default.createElement(PickerSlot, {
11204
10950
  ref: setRefs(index2),
11205
10951
  defaultValue: chooseValueData == null ? void 0 : chooseValueData[index2],
11206
10952
  listData: item,
@@ -11208,11 +10954,12 @@ const InternalPicker$1 = (props, ref) => {
11208
10954
  chooseItem: (value, index22) => chooseItem(value, index22),
11209
10955
  swipeDuration,
11210
10956
  key: index2,
11211
- keyIndex: index2
10957
+ keyIndex: index2,
10958
+ itemShow: isVisible
11212
10959
  });
11213
10960
  }))));
11214
10961
  };
11215
- const Picker$1 = React__default.forwardRef(InternalPicker$1);
10962
+ const Picker = React__default.forwardRef(InternalPicker);
11216
10963
  const currentYear = new Date().getFullYear();
11217
10964
  const defaultProps$V = {
11218
10965
  modelValue: null,
@@ -11498,7 +11245,7 @@ const DatePicker = (props) => {
11498
11245
  className: `nut-datepicker ${className || ""}`,
11499
11246
  style,
11500
11247
  ...rest
11501
- }, listData.length > 0 && /* @__PURE__ */ React__default.createElement(Picker$1, {
11248
+ }, listData.length > 0 && /* @__PURE__ */ React__default.createElement(Picker, {
11502
11249
  isVisible: show,
11503
11250
  listData,
11504
11251
  onClose: onCloseDatePicker,
@@ -12108,565 +11855,136 @@ const Radio = (props) => {
12108
11855
  const renderIcon = () => {
12109
11856
  const { iconName: iconName2, iconSize: iconSize2, iconActiveName: iconActiveName2 } = props;
12110
11857
  return /* @__PURE__ */ React__default.createElement(Icon$1, {
12111
- name: checkedStatement ? iconActiveName2 : iconName2,
12112
- size: iconSize2,
12113
- className: color()
12114
- });
12115
- };
12116
- const renderRadioItem = () => {
12117
- if (shape === "button") {
12118
- return renderButton();
12119
- }
12120
- if (reverseState) {
12121
- return [renderLabel(), renderIcon()];
12122
- }
12123
- return [renderIcon(), renderLabel()];
12124
- };
12125
- const handleClick2 = (e2) => {
12126
- if (disabledStatement || checkedStatement)
12127
- return;
12128
- setCheckedStatement(!checkedStatement);
12129
- onChange && onChange(e2);
12130
- context2 && context2.onChange(valueStatement);
12131
- };
12132
- const reverseState = textPosition === "left";
12133
- return /* @__PURE__ */ React__default.createElement("div", {
12134
- className: `nut-radio ${className}`,
12135
- onClick: handleClick2,
12136
- ...rest
12137
- }, renderRadioItem());
12138
- };
12139
- Radio.defaultProps = defaultProps$R;
12140
- Radio.displayName = "NutRadio";
12141
- Radio.RadioGroup = RadioGroup;
12142
- const defaultProps$Q = {
12143
- count: 5,
12144
- modelValue: 0,
12145
- minimizeValue: 0,
12146
- iconSize: 18,
12147
- activeColor: "",
12148
- voidColor: "",
12149
- checkedIcon: "star-fill-n",
12150
- uncheckedIcon: "star-n",
12151
- disabled: false,
12152
- readonly: false,
12153
- allowHalf: false,
12154
- spacing: 14
12155
- };
12156
- const Rate = (props) => {
12157
- const {
12158
- count,
12159
- modelValue,
12160
- minimizeValue,
12161
- iconSize,
12162
- activeColor,
12163
- voidColor,
12164
- checkedIcon,
12165
- uncheckedIcon,
12166
- disabled,
12167
- readonly,
12168
- allowHalf,
12169
- spacing,
12170
- change
12171
- } = { ...defaultProps$Q, ...props };
12172
- const b2 = cn("rate");
12173
- const bi = cn("rate-item");
12174
- const [countArray, setCountArray] = useState([1, 2, 3, 4, 5]);
12175
- const [score, setScore] = useState(0);
12176
- useEffect(() => {
12177
- const tmp = [];
12178
- for (let i = 1; i <= Number(count); i++) {
12179
- tmp.push(i);
12180
- }
12181
- setCountArray(tmp);
12182
- }, [count]);
12183
- useEffect(() => {
12184
- setScore(Math.max(Number(modelValue), Number(minimizeValue)));
12185
- }, [modelValue]);
12186
- const pxCheck2 = (value) => {
12187
- return isNaN(Number(value)) ? String(value) : `${value}px`;
12188
- };
12189
- const onClick = (e2, index2) => {
12190
- var _a, _b;
12191
- e2.preventDefault();
12192
- e2.stopPropagation();
12193
- if (disabled || readonly)
12194
- return;
12195
- let value = 0;
12196
- if (index2 === 1 && score === index2)
12197
- ;
12198
- else {
12199
- value = index2;
12200
- if (allowHalf) {
12201
- console.log("e", e2);
12202
- if ((_b = (_a = e2 == null ? void 0 : e2.target) == null ? void 0 : _a.className) == null ? void 0 : _b.includes("__icon--half")) {
12203
- value -= 0.5;
12204
- }
12205
- }
12206
- }
12207
- value = Math.max(value, Number(minimizeValue));
12208
- setScore(value);
12209
- change && change(value);
12210
- };
12211
- return /* @__PURE__ */ React__default.createElement("div", {
12212
- className: b2()
12213
- }, countArray.map((n2) => {
12214
- return /* @__PURE__ */ React__default.createElement("div", {
12215
- className: bi(),
12216
- key: n2,
12217
- onClick: (event) => onClick(event, n2),
12218
- style: { marginRight: pxCheck2(spacing) }
12219
- }, /* @__PURE__ */ React__default.createElement(Icon$1, {
12220
- size: iconSize,
12221
- className: `${bi("icon")} ${disabled || n2 > score ? bi("icon--disabled") : ""}`,
12222
- name: n2 <= score ? checkedIcon : uncheckedIcon,
12223
- color: n2 <= score ? activeColor : voidColor
12224
- }), allowHalf && score > n2 - 1 && /* @__PURE__ */ React__default.createElement(Icon$1, {
12225
- className: `${bi("icon")} ${bi("icon--half")}`,
12226
- color: n2 <= score ? activeColor : voidColor,
12227
- size: iconSize,
12228
- name: checkedIcon
12229
- }), allowHalf && score < n2 - 1 && /* @__PURE__ */ React__default.createElement(Icon$1, {
12230
- className: `${bi("icon")} ${bi("icon--disabled")} ${bi(
12231
- "icon--half"
12232
- )}`,
12233
- color: voidColor,
12234
- size: iconSize,
12235
- name: uncheckedIcon
12236
- }));
12237
- }));
12238
- };
12239
- Rate.defaultProps = defaultProps$Q;
12240
- Rate.displayName = "NutRate";
12241
- const InternalPickerSlot = (props, ref) => {
12242
- const {
12243
- keyIndex = 0,
12244
- defaultValue,
12245
- listData = [],
12246
- threeDimensional = true,
12247
- swipeDuration = 1e3,
12248
- itemShow = false,
12249
- chooseItem
12250
- } = props;
12251
- const touch = useTouch();
12252
- const DEFAULT_DURATION = 200;
12253
- const INERTIA_TIME = 300;
12254
- const INERTIA_DISTANCE = 15;
12255
- const [currIndex, setCurrIndex] = useState(1);
12256
- const lineSpacing = useRef(36);
12257
- const [touchTime, setTouchTime] = useState(0);
12258
- const [touchDeg, setTouchDeg] = useState("0deg");
12259
- const rotation = 20;
12260
- const moving = useRef(false);
12261
- let timer;
12262
- const listbox = useRef(null);
12263
- const rollerRef = useRef(null);
12264
- const pickerSlotRef = useRef(null);
12265
- const [startTime, setStartTime] = useState(0);
12266
- const [startY, setStartY] = useState(0);
12267
- const transformY = useRef(0);
12268
- const [scrollDistance, setScrollDistance] = useState(0);
12269
- const isHidden = (index2) => {
12270
- if (index2 >= currIndex + 8 || index2 <= currIndex - 8) {
12271
- return true;
12272
- }
12273
- return false;
12274
- };
12275
- const setTransform = (translateY = 0, type, time = DEFAULT_DURATION, deg) => {
12276
- let nTime = time;
12277
- if (type !== "end") {
12278
- nTime = 0;
12279
- }
12280
- setTouchTime(nTime);
12281
- setTouchDeg(deg);
12282
- setScrollDistance(translateY);
12283
- };
12284
- const setMove = (move, type, time) => {
12285
- console.log("move");
12286
- let updateMove = move + transformY.current;
12287
- if (type === "end") {
12288
- if (updateMove > 0) {
12289
- updateMove = 0;
12290
- }
12291
- if (updateMove < -(listData.length - 1) * lineSpacing.current) {
12292
- updateMove = -(listData.length - 1) * lineSpacing.current;
12293
- }
12294
- const endMove = Math.round(updateMove / lineSpacing.current) * lineSpacing.current;
12295
- const deg = `${(Math.abs(Math.round(endMove / lineSpacing.current)) + 1) * rotation}deg`;
12296
- setTransform(endMove, type, time, deg);
12297
- setCurrIndex(Math.abs(Math.round(endMove / lineSpacing.current)) + 1);
12298
- } else {
12299
- let deg = 0;
12300
- const currentDeg = (-updateMove / lineSpacing.current + 1) * rotation;
12301
- const maxDeg = (listData.length + 1) * rotation;
12302
- const minDeg = 0;
12303
- deg = Math.min(Math.max(currentDeg, minDeg), maxDeg);
12304
- if (minDeg < deg && deg < maxDeg) {
12305
- setTransform(updateMove, "", void 0, `${deg}deg`);
12306
- setCurrIndex(Math.abs(Math.round(updateMove / lineSpacing.current)) + 1);
12307
- }
12308
- }
12309
- };
12310
- const setChooseValue = (move) => {
12311
- chooseItem && chooseItem(listData == null ? void 0 : listData[Math.round(-move / lineSpacing.current)], keyIndex);
12312
- };
12313
- const touchStart = (event) => {
12314
- touch.start(event);
12315
- setStartY(touch.deltaY);
12316
- setStartTime(Date.now());
12317
- transformY.current = scrollDistance;
12318
- };
12319
- const touchMove = (event) => {
12320
- touch.move(event);
12321
- if (touch.isVertical) {
12322
- moving.current = true;
12323
- preventDefault2(event, true);
12324
- }
12325
- const move = touch.deltaY - startY;
12326
- setMove(move);
12327
- };
12328
- const touchEnd = (event) => {
12329
- if (!moving.current)
12330
- return;
12331
- const move = touch.deltaY - startY;
12332
- const moveTime = Date.now() - startTime;
12333
- if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
12334
- const distance = momentum(move, moveTime);
12335
- setMove(distance, "end", +swipeDuration);
12336
- } else {
12337
- setMove(move, "end");
12338
- }
12339
- setTimeout(() => {
12340
- touch.reset();
12341
- }, 0);
12342
- };
12343
- const momentum = (distance, duration) => {
12344
- let nDistance = distance;
12345
- const speed = Math.abs(nDistance / duration);
12346
- nDistance = speed / 3e-3 * (nDistance < 0 ? -1 : 1);
12347
- return nDistance;
12348
- };
12349
- const modifyStatus = (type, val) => {
12350
- const value = val || defaultValue;
12351
- let index2 = -1;
12352
- if (value) {
12353
- listData.some((item, idx) => {
12354
- if (item.value === value) {
12355
- index2 = idx;
12356
- return true;
12357
- }
12358
- return false;
12359
- });
12360
- } else {
12361
- listData.forEach((item, i) => {
12362
- if (item.value === defaultValue) {
12363
- index2 = i;
12364
- }
12365
- });
12366
- }
12367
- setCurrIndex(index2 === -1 ? 1 : index2 + 1);
12368
- const move = index2 === -1 ? 0 : index2 * lineSpacing.current;
12369
- type && setChooseValue(-move);
12370
- setMove(-move);
12371
- };
12372
- const stopMomentum = () => {
12373
- moving.current = false;
12374
- setTouchTime(0);
12375
- setChooseValue(scrollDistance);
12376
- };
12377
- const preventDefault2 = (event, isStopPropagation) => {
12378
- if (typeof event.cancelable !== "boolean" || event.cancelable) {
12379
- event.preventDefault();
12380
- }
12381
- if (isStopPropagation) {
12382
- event.stopPropagation();
12383
- }
12384
- };
12385
- const getReference = async () => {
12386
- const refe = await getRectByTaro(listbox == null ? void 0 : listbox.current);
12387
- console.log(refe);
12388
- lineSpacing.current = refe.height ? refe.height : 36;
12389
- modifyStatus(true);
12390
- };
12391
- const touchRollerStyle = () => {
12392
- return {
12393
- transition: `transform ${touchTime}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
12394
- transform: `rotate3d(1, 0, 0, ${touchDeg})`
12395
- };
12396
- };
12397
- const touchTileStyle = () => {
12398
- return {
12399
- transition: `transform ${touchTime}ms cubic-bezier(0.17, 0.89, 0.45, 1)`,
12400
- transform: `translate3d(0, ${scrollDistance}px, 0)`
12401
- };
12402
- };
12403
- useEffect(() => {
12404
- setScrollDistance(0);
12405
- transformY.current = 0;
12406
- modifyStatus(false);
12407
- return () => {
12408
- clearTimeout(timer);
12409
- };
12410
- }, [listData]);
12411
- useEffect(() => {
12412
- if (itemShow) {
12413
- setTimeout(() => {
12414
- getReference();
12415
- }, 200);
12416
- }
12417
- }, [itemShow]);
12418
- useImperativeHandle(ref, () => ({
12419
- stopMomentum,
12420
- moving: moving.current
12421
- }));
12422
- return /* @__PURE__ */ React__default.createElement("div", {
12423
- className: "nut-picker-list",
12424
- ref: pickerSlotRef,
12425
- onTouchStart: touchStart,
12426
- onTouchMove: touchMove,
12427
- onTouchEnd: touchEnd
12428
- }, /* @__PURE__ */ React__default.createElement("div", {
12429
- className: "nut-picker-roller",
12430
- ref: rollerRef,
12431
- style: threeDimensional ? touchRollerStyle() : touchTileStyle(),
12432
- onTransitionEnd: stopMomentum
12433
- }, threeDimensional && listData.map((item, index2) => {
12434
- return /* @__PURE__ */ React__default.createElement("div", {
12435
- className: `nut-picker-roller-item ${isHidden(index2 + 1) && "nut-picker-roller-item-hidden"}`,
12436
- style: {
12437
- transform: `rotate3d(1, 0, 0, ${-rotation * (index2 + 1)}deg) translate3d(0px, 0px, 104px)`,
12438
- height: `${lineSpacing.current}px`,
12439
- lineHeight: `${lineSpacing.current}px`
12440
- },
12441
- key: item.value ? item.value : index2
12442
- }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, item.text ? item.text : item));
12443
- }), !threeDimensional && listData.map((item, index2) => {
12444
- return /* @__PURE__ */ React__default.createElement("div", {
12445
- className: "nut-picker-roller-item-tile",
12446
- key: item.value ? item.value : index2,
12447
- style: {
12448
- height: `${lineSpacing.current}px`,
12449
- lineHeight: `${lineSpacing.current}px`
12450
- }
12451
- }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, item.text ? item.text : item));
12452
- })), /* @__PURE__ */ React__default.createElement("div", {
12453
- className: "nut-picker-mask"
12454
- }), /* @__PURE__ */ React__default.createElement("div", {
12455
- className: "nut-picker-indicator",
12456
- ref: listbox
12457
- }));
12458
- };
12459
- const PickerSlot = React__default.forwardRef(InternalPickerSlot);
12460
- const InternalPicker = (props, ref) => {
12461
- const { locale } = useConfig$1();
12462
- const {
12463
- isVisible,
12464
- title,
12465
- listData = [],
12466
- defaultValueData,
12467
- onConfirm,
12468
- onClose,
12469
- onCloseUpdate,
12470
- onChange,
12471
- className,
12472
- style,
12473
- threeDimensional,
12474
- swipeDuration,
12475
- ...rest
12476
- } = props;
12477
- const [chooseValueData, setchooseValueData] = useState([]);
12478
- const [columnIndex, setcolumnIndex] = useState(0);
12479
- const pickerRef = useRef(null);
12480
- const [refs, setRefs] = useRefs();
12481
- const [columnsList, setColumnsList] = useState([]);
12482
- const b2 = cn("picker");
12483
- let isConfirmEvent = useRef(false);
12484
- useEffect(() => {
12485
- if (defaultValueData && defaultValueData.length !== 0 && defaultValueData.toString() !== chooseValueData.toString()) {
12486
- const data = [...defaultValueData];
12487
- setchooseValueData(data);
12488
- setColumnsList(normalListData());
12489
- }
12490
- }, [defaultValueData]);
12491
- useEffect(() => {
12492
- onChange && onChange(columnIndex, chooseValueData, selectedOptions());
12493
- if (isConfirmEvent.current) {
12494
- isConfirmEvent.current = false;
12495
- onConfirm && onConfirm(chooseValueData, selectedOptions());
12496
- }
12497
- }, [chooseValueData]);
12498
- useEffect(() => {
12499
- init();
12500
- }, [listData]);
12501
- const closeActionSheet = () => {
12502
- onClose && onClose(chooseValueData, selectedOptions());
12503
- onCloseUpdate && onCloseUpdate(chooseValueData, selectedOptions(), pickerRef);
12504
- };
12505
- const confirm2 = () => {
12506
- let movings = false;
12507
- refs.forEach((_ref) => {
12508
- if (_ref.moving)
12509
- movings = true;
12510
- _ref.stopMomentum();
12511
- });
12512
- if (movings) {
12513
- isConfirmEvent.current = true;
12514
- } else {
12515
- onConfirm && onConfirm(chooseValueData, selectedOptions());
12516
- }
12517
- onClose && onClose(chooseValueData, selectedOptions());
12518
- setTimeout(() => {
12519
- isConfirmEvent.current = false;
12520
- }, 0);
12521
- };
12522
- const selectedOptions = () => {
12523
- const optins = [];
12524
- columnsList.map((column, index2) => {
12525
- let currOptions = [];
12526
- currOptions = column.filter(
12527
- (item) => item.value === chooseValueData[index2]
12528
- );
12529
- if (currOptions[0]) {
12530
- optins.push(currOptions[0]);
12531
- } else {
12532
- column[0] && optins.push(column[0]);
12533
- }
12534
- return column;
11858
+ name: checkedStatement ? iconActiveName2 : iconName2,
11859
+ size: iconSize2,
11860
+ className: color()
12535
11861
  });
12536
- return optins;
12537
11862
  };
12538
- const chooseItem = (option, columnIndex2) => {
12539
- if (option && Object.keys(option).length) {
12540
- if (chooseValueData[columnIndex2] !== option.value) {
12541
- if (columnsType() === "cascade") {
12542
- chooseValueData[columnIndex2] = option.value ? option.value : "";
12543
- setchooseValueData([...chooseValueData]);
12544
- let index2 = columnIndex2;
12545
- let cursor = option;
12546
- while (cursor && cursor.children && cursor.children[0]) {
12547
- chooseValueData[index2 + 1] = cursor.children[0].value;
12548
- setchooseValueData([...chooseValueData]);
12549
- index2++;
12550
- const cc = cursor.children[0];
12551
- cursor = cc;
12552
- }
12553
- if (cursor && cursor.children) {
12554
- chooseValueData[index2 + 1] = "";
12555
- setchooseValueData([...chooseValueData]);
12556
- }
12557
- setColumnsList(normalListData());
12558
- } else {
12559
- setchooseValueData((data) => {
12560
- const cdata = [...data];
12561
- cdata[columnIndex2] = Object.prototype.hasOwnProperty.call(
12562
- option,
12563
- "value"
12564
- ) ? option.value : "";
12565
- return cdata;
12566
- });
12567
- }
12568
- setcolumnIndex(columnIndex2);
12569
- }
11863
+ const renderRadioItem = () => {
11864
+ if (shape === "button") {
11865
+ return renderButton();
12570
11866
  }
12571
- };
12572
- const normalListData = () => {
12573
- const type = columnsType();
12574
- switch (type) {
12575
- case "multiple":
12576
- return listData;
12577
- case "cascade":
12578
- return formatCascade(listData, chooseValueData);
12579
- default:
12580
- return [listData];
11867
+ if (reverseState) {
11868
+ return [renderLabel(), renderIcon()];
12581
11869
  }
11870
+ return [renderIcon(), renderLabel()];
12582
11871
  };
12583
- const columnsType = () => {
12584
- const firstColumn = listData[0];
12585
- if (firstColumn) {
12586
- if (Array.isArray(firstColumn)) {
12587
- return "multiple";
12588
- }
12589
- if ("children" in firstColumn) {
12590
- return "cascade";
12591
- }
12592
- }
12593
- return "single";
11872
+ const handleClick2 = (e2) => {
11873
+ if (disabledStatement || checkedStatement)
11874
+ return;
11875
+ setCheckedStatement(!checkedStatement);
11876
+ onChange && onChange(e2);
11877
+ context2 && context2.onChange(valueStatement);
12594
11878
  };
12595
- const formatCascade = (columns, defaultValues) => {
12596
- const formatted = [];
12597
- let cursor = {
12598
- text: "",
12599
- value: "",
12600
- children: columns
12601
- };
12602
- let columnIndex2 = 0;
12603
- while (cursor && cursor.children) {
12604
- const options2 = cursor.children;
12605
- const value = defaultValues[columnIndex2];
12606
- let index2 = options2.findIndex(
12607
- (columnItem) => columnItem.value === value
12608
- );
12609
- if (index2 === -1)
12610
- index2 = 0;
12611
- cursor = cursor.children[index2];
12612
- columnIndex2++;
12613
- formatted.push(options2);
11879
+ const reverseState = textPosition === "left";
11880
+ return /* @__PURE__ */ React__default.createElement("div", {
11881
+ className: `nut-radio ${className}`,
11882
+ onClick: handleClick2,
11883
+ ...rest
11884
+ }, renderRadioItem());
11885
+ };
11886
+ Radio.defaultProps = defaultProps$R;
11887
+ Radio.displayName = "NutRadio";
11888
+ Radio.RadioGroup = RadioGroup;
11889
+ const defaultProps$Q = {
11890
+ count: 5,
11891
+ modelValue: 0,
11892
+ minimizeValue: 0,
11893
+ iconSize: 18,
11894
+ activeColor: "",
11895
+ voidColor: "",
11896
+ checkedIcon: "star-fill-n",
11897
+ uncheckedIcon: "star-n",
11898
+ disabled: false,
11899
+ readonly: false,
11900
+ allowHalf: false,
11901
+ spacing: 14
11902
+ };
11903
+ const Rate = (props) => {
11904
+ const {
11905
+ count,
11906
+ modelValue,
11907
+ minimizeValue,
11908
+ iconSize,
11909
+ activeColor,
11910
+ voidColor,
11911
+ checkedIcon,
11912
+ uncheckedIcon,
11913
+ disabled,
11914
+ readonly,
11915
+ allowHalf,
11916
+ spacing,
11917
+ change
11918
+ } = { ...defaultProps$Q, ...props };
11919
+ const b2 = cn("rate");
11920
+ const bi = cn("rate-item");
11921
+ const [countArray, setCountArray] = useState([1, 2, 3, 4, 5]);
11922
+ const [score, setScore] = useState(0);
11923
+ useEffect(() => {
11924
+ const tmp = [];
11925
+ for (let i = 1; i <= Number(count); i++) {
11926
+ tmp.push(i);
12614
11927
  }
12615
- return formatted;
11928
+ setCountArray(tmp);
11929
+ }, [count]);
11930
+ useEffect(() => {
11931
+ setScore(Math.max(Number(modelValue), Number(minimizeValue)));
11932
+ }, [modelValue]);
11933
+ const pxCheck2 = (value) => {
11934
+ return isNaN(Number(value)) ? String(value) : `${value}px`;
12616
11935
  };
12617
- const init = () => {
12618
- const data = [];
12619
- const normalData = normalListData();
12620
- setColumnsList(normalData);
12621
- normalData.length > 0 && normalData.map((item) => {
12622
- item[0] && data.push(item[0].value);
12623
- return item;
12624
- });
12625
- if (!defaultValueData && chooseValueData.length === 0) {
12626
- setchooseValueData([...data]);
11936
+ const onClick = (e2, index2) => {
11937
+ var _a, _b;
11938
+ e2.preventDefault();
11939
+ e2.stopPropagation();
11940
+ if (disabled || readonly)
11941
+ return;
11942
+ let value = 0;
11943
+ if (index2 === 1 && score === index2)
11944
+ ;
11945
+ else {
11946
+ value = index2;
11947
+ if (allowHalf) {
11948
+ console.log("e", e2);
11949
+ if ((_b = (_a = e2 == null ? void 0 : e2.target) == null ? void 0 : _a.className) == null ? void 0 : _b.includes("__icon--half")) {
11950
+ value -= 0.5;
11951
+ }
11952
+ }
12627
11953
  }
11954
+ value = Math.max(value, Number(minimizeValue));
11955
+ setScore(value);
11956
+ change && change(value);
12628
11957
  };
12629
- const renderToolbar = () => {
11958
+ return /* @__PURE__ */ React__default.createElement("div", {
11959
+ className: b2()
11960
+ }, countArray.map((n2) => {
12630
11961
  return /* @__PURE__ */ React__default.createElement("div", {
12631
- className: b2("control")
12632
- }, /* @__PURE__ */ React__default.createElement("span", {
12633
- className: b2("cancel-btn"),
12634
- onClick: () => closeActionSheet()
12635
- }, locale.cancel), /* @__PURE__ */ React__default.createElement("div", {
12636
- className: b2("title")
12637
- }, title || ""), /* @__PURE__ */ React__default.createElement("span", {
12638
- className: b2("confirm-btn"),
12639
- onClick: confirm2
12640
- }, locale.confirm));
12641
- };
12642
- return /* @__PURE__ */ React__default.createElement(Popup, {
12643
- visible: isVisible,
12644
- position: "bottom",
12645
- onClose: () => {
12646
- closeActionSheet();
12647
- }
12648
- }, /* @__PURE__ */ React__default.createElement("div", {
12649
- className: `${b2()} ${className || ""}`,
12650
- style,
12651
- ...rest
12652
- }, renderToolbar(), /* @__PURE__ */ React__default.createElement("div", {
12653
- className: b2("panel"),
12654
- ref: pickerRef
12655
- }, columnsList == null ? void 0 : columnsList.map((item, index2) => {
12656
- return /* @__PURE__ */ React__default.createElement(PickerSlot, {
12657
- ref: setRefs(index2),
12658
- defaultValue: chooseValueData == null ? void 0 : chooseValueData[index2],
12659
- listData: item,
12660
- threeDimensional,
12661
- chooseItem: (value, index22) => chooseItem(value, index22),
12662
- swipeDuration,
12663
- key: index2,
12664
- keyIndex: index2,
12665
- itemShow: isVisible
12666
- });
12667
- }))));
11962
+ className: bi(),
11963
+ key: n2,
11964
+ onClick: (event) => onClick(event, n2),
11965
+ style: { marginRight: pxCheck2(spacing) }
11966
+ }, /* @__PURE__ */ React__default.createElement(Icon$1, {
11967
+ size: iconSize,
11968
+ className: `${bi("icon")} ${disabled || n2 > score ? bi("icon--disabled") : ""}`,
11969
+ name: n2 <= score ? checkedIcon : uncheckedIcon,
11970
+ color: n2 <= score ? activeColor : voidColor
11971
+ }), allowHalf && score > n2 - 1 && /* @__PURE__ */ React__default.createElement(Icon$1, {
11972
+ className: `${bi("icon")} ${bi("icon--half")}`,
11973
+ color: n2 <= score ? activeColor : voidColor,
11974
+ size: iconSize,
11975
+ name: checkedIcon
11976
+ }), allowHalf && score < n2 - 1 && /* @__PURE__ */ React__default.createElement(Icon$1, {
11977
+ className: `${bi("icon")} ${bi("icon--disabled")} ${bi(
11978
+ "icon--half"
11979
+ )}`,
11980
+ color: voidColor,
11981
+ size: iconSize,
11982
+ name: uncheckedIcon
11983
+ }));
11984
+ }));
12668
11985
  };
12669
- const Picker = React__default.forwardRef(InternalPicker);
11986
+ Rate.defaultProps = defaultProps$Q;
11987
+ Rate.displayName = "NutRate";
12670
11988
  const defaultProps$P = {
12671
11989
  title: "",
12672
11990
  desc: "",
@@ -12767,7 +12085,7 @@ const ShortPassword = (props) => {
12767
12085
  const sure = () => {
12768
12086
  onOk && onOk(inputValue);
12769
12087
  };
12770
- return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Popup$1, {
12088
+ return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Popup, {
12771
12089
  style: {
12772
12090
  padding: "32px 24px 28px 24px",
12773
12091
  borderRadius: "12px",
@@ -13558,7 +12876,7 @@ const defaultProps$L = {
13558
12876
  },
13559
12877
  onPathChange: () => {
13560
12878
  },
13561
- ...Popup$1.defaultProps
12879
+ ...Popup.defaultProps
13562
12880
  };
13563
12881
  const InternalCascader = (props) => {
13564
12882
  const {
@@ -13786,7 +13104,7 @@ const InternalCascader = (props) => {
13786
13104
  return /* @__PURE__ */ React__default.createElement("div", {
13787
13105
  className: `${classes} ${className}`,
13788
13106
  style
13789
- }, /* @__PURE__ */ React__default.createElement(Popup$1, {
13107
+ }, /* @__PURE__ */ React__default.createElement(Popup, {
13790
13108
  popClass: "cascadar-popup",
13791
13109
  visible,
13792
13110
  position: "bottom",
@@ -14151,7 +13469,7 @@ const NumberKeyboard = (props) => {
14151
13469
  event.preventDefault();
14152
13470
  setClickKeyIndex(void 0);
14153
13471
  };
14154
- return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Popup$1, {
13472
+ return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(Popup, {
14155
13473
  visible: show,
14156
13474
  position: "bottom",
14157
13475
  popClass,
@@ -14270,7 +13588,7 @@ const ActionSheet = (props) => {
14270
13588
  onChoose && onChoose(item, index2);
14271
13589
  }
14272
13590
  };
14273
- return /* @__PURE__ */ React__default.createElement(Popup$1, {
13591
+ return /* @__PURE__ */ React__default.createElement(Popup, {
14274
13592
  round: true,
14275
13593
  visible,
14276
13594
  position: "bottom",
@@ -16913,6 +16231,19 @@ const Avatar = (props) => {
16913
16231
  };
16914
16232
  Avatar.defaultProps = defaultProps$s;
16915
16233
  Avatar.displayName = "NutAvatar";
16234
+ const defaultConfigRef = {
16235
+ current: {
16236
+ locale: zhCN
16237
+ }
16238
+ };
16239
+ const getDefaultConfig = () => {
16240
+ return defaultConfigRef.current;
16241
+ };
16242
+ const useConfig = () => {
16243
+ var _a;
16244
+ return (_a = useContext$1(ConfigContext)) != null ? _a : getDefaultConfig();
16245
+ };
16246
+ const ConfigContext = createContext(null);
16916
16247
  const defaultProps$r = {
16917
16248
  maxContent: "",
16918
16249
  maxCount: "",
@@ -17333,7 +16664,7 @@ const Popover = (props) => {
17333
16664
  }) : "", /* @__PURE__ */ React__default.createElement("div", {
17334
16665
  className: "popover-menu-item-name"
17335
16666
  }, item.name));
17336
- })) : null))), visible ? /* @__PURE__ */ React__default.createElement(Overlay$1, {
16667
+ })) : null))), visible ? /* @__PURE__ */ React__default.createElement(Overlay, {
17337
16668
  visible,
17338
16669
  onClick: (e2) => handleClick2(e2),
17339
16670
  style: { background: "transparent" }
@@ -18935,7 +18266,7 @@ const ImagePreview = (props) => {
18935
18266
  onCloseInner();
18936
18267
  }
18937
18268
  };
18938
- return /* @__PURE__ */ React__default.createElement(Popup$1, {
18269
+ return /* @__PURE__ */ React__default.createElement(Popup, {
18939
18270
  visible: showPop,
18940
18271
  popClass: "custom-pop",
18941
18272
  style: { width: "100%" },
@@ -19711,7 +19042,7 @@ const Address = (props) => {
19711
19042
  closeFun();
19712
19043
  }
19713
19044
  }, [showPopup]);
19714
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, showPopup && /* @__PURE__ */ React__default.createElement(Popup$1, {
19045
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, showPopup && /* @__PURE__ */ React__default.createElement(Popup, {
19715
19046
  visible: showPopup,
19716
19047
  position: "bottom",
19717
19048
  onClickOverlay: clickOverlay,
@@ -20184,7 +19515,7 @@ const TimeSelect = (props) => {
20184
19515
  useEffect(() => {
20185
19516
  setPopVisible(visible);
20186
19517
  }, [visible]);
20187
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Popup$1, {
19518
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Popup, {
20188
19519
  closeable: true,
20189
19520
  round: true,
20190
19521
  visible: popVisible,
@@ -20216,4 +19547,4 @@ const TimeSelect = (props) => {
20216
19547
  };
20217
19548
  TimeSelect.defaultProps = defaultProps;
20218
19549
  TimeSelect.displayName = "NutTimeSelect";
20219
- export { ActionSheet, Address, AnimatingNumbers, Audio, Avatar, AvatarGroup, BackTop, Badge, Barrage, Button$1 as Button, Calendar, CalendarItem, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, CircleProgress, Col, Collapse, CollapseItem, ConfigProvider, CountDown, DatePicker, Dialog, Divider, Drag, Elevator$1 as Elevator, Empty, FixedNav, Grid, GridItem, Icon$1 as Icon, ImagePreview, Indicator, Infiniteloading, Input, InputNumber, Layout, Menu, MenuItem, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay$1 as Overlay, Pagination, Picker, Popover, Popup$1 as Popup, Price, Progress, PullToRefresh, Radio, RadioGroup, Range, Rate, Row, SearchBar, ShortPassword, SideNavBar, SideNavBarItem, Signature, Skeleton, Step, Steps, SubSideNavBar, Swipe, Swiper, SwiperItem, Switch, TabPane, Tabbar, TabbarItem, Table, Tabs, Tag, TextArea, TimeDetail, TimePannel, TimeSelect, Toast, Uploader, Video, VirtualList };
19550
+ export { ActionSheet, Address, AnimatingNumbers, Audio, Avatar, AvatarGroup, BackTop, Badge, Barrage, Button$1 as Button, Calendar, CalendarItem, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, CircleProgress, Col, Collapse, CollapseItem, ConfigProvider, CountDown, DatePicker, Dialog, Divider, Drag, Elevator$1 as Elevator, Empty, FixedNav, Grid, GridItem, Icon$1 as Icon, ImagePreview, Indicator, Infiniteloading, Input, InputNumber, Layout, Menu, MenuItem, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Picker, Popover, Popup, Price, Progress, PullToRefresh, Radio, RadioGroup, Range, Rate, Row, SearchBar, ShortPassword, SideNavBar, SideNavBarItem, Signature, Skeleton, Step, Steps, SubSideNavBar, Swipe, Swiper, SwiperItem, Switch, TabPane, Tabbar, TabbarItem, Table, Tabs, Tag, TextArea, TimeDetail, TimePannel, TimeSelect, Toast, Uploader, Video, VirtualList };