@nutui/nutui-react 2.0.0-alpha.5 → 2.0.0-alpha.6

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.
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  var _a;
8
8
  /*!
9
- * @nutui/nutui-react v2.0.0-alpha.5 Wed May 10 2023 14:17:23 GMT+0800 (China Standard Time)
9
+ * @nutui/nutui-react v2.0.0-alpha.6 Fri May 12 2023 15:13:32 GMT+0800 (China Standard Time)
10
10
  * (c) 2023 @jdf2e.
11
11
  * Released under the MIT License.
12
12
  */
@@ -3233,7 +3233,7 @@ const ComponentDefaults = {
3233
3233
  style: {}
3234
3234
  };
3235
3235
  const prefixCls = "nut-button";
3236
- const defaultProps$1r = {
3236
+ const defaultProps$1s = {
3237
3237
  ...ComponentDefaults,
3238
3238
  color: "",
3239
3239
  type: "default",
@@ -3265,7 +3265,7 @@ const Button = React__default.forwardRef(
3265
3265
  style,
3266
3266
  ...rest
3267
3267
  } = {
3268
- ...defaultProps$1r,
3268
+ ...defaultProps$1s,
3269
3269
  ...props
3270
3270
  };
3271
3271
  const getStyle = useCallback(() => {
@@ -3322,7 +3322,7 @@ const Button = React__default.forwardRef(
3322
3322
  }
3323
3323
  );
3324
3324
  Button.displayName = "NutButton";
3325
- const defaultProps$1q = {
3325
+ const defaultProps$1r = {
3326
3326
  ...ComponentDefaults,
3327
3327
  title: null,
3328
3328
  description: null,
@@ -3346,7 +3346,7 @@ const Cell = (props) => {
3346
3346
  style,
3347
3347
  ...rest
3348
3348
  } = {
3349
- ...defaultProps$1q,
3349
+ ...defaultProps$1r,
3350
3350
  ...props
3351
3351
  };
3352
3352
  const handleClick2 = (event) => {
@@ -3385,9 +3385,9 @@ const Cell = (props) => {
3385
3385
  }
3386
3386
  );
3387
3387
  };
3388
- Cell.defaultProps = defaultProps$1q;
3388
+ Cell.defaultProps = defaultProps$1r;
3389
3389
  Cell.displayName = "NutCell";
3390
- const defaultProps$1p = {
3390
+ const defaultProps$1q = {
3391
3391
  ...ComponentDefaults,
3392
3392
  title: "",
3393
3393
  description: "",
@@ -3396,7 +3396,7 @@ const defaultProps$1p = {
3396
3396
  const classPrefix$f = "nut-cell-group";
3397
3397
  const CellGroup = (props) => {
3398
3398
  const { children, className, style, title, description, divider, ...rest } = {
3399
- ...defaultProps$1p,
3399
+ ...defaultProps$1q,
3400
3400
  ...props
3401
3401
  };
3402
3402
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classNames(classPrefix$f, className), ...rest, children: [
@@ -3411,7 +3411,7 @@ const CellGroup = (props) => {
3411
3411
  )
3412
3412
  ] });
3413
3413
  };
3414
- CellGroup.defaultProps = defaultProps$1p;
3414
+ CellGroup.defaultProps = defaultProps$1q;
3415
3415
  CellGroup.displayName = "NutCellGroup";
3416
3416
  var INFINITY = 1 / 0;
3417
3417
  var symbolTag = "[object Symbol]";
@@ -3826,7 +3826,7 @@ const zhCN = {
3826
3826
  errorCanvasTips: "当前环境不支持Canvas"
3827
3827
  }
3828
3828
  };
3829
- const defaultProps$1o = {
3829
+ const defaultProps$1p = {
3830
3830
  locale: zhCN
3831
3831
  };
3832
3832
  const defaultConfigRef = {
@@ -3849,7 +3849,7 @@ function convertThemeVarsToCSSVars(themeVars) {
3849
3849
  return cssVars;
3850
3850
  }
3851
3851
  const ConfigProvider = (props) => {
3852
- const { children, ...config2 } = { ...defaultProps$1o, ...props };
3852
+ const { children, ...config2 } = { ...defaultProps$1p, ...props };
3853
3853
  const parentConfig = useConfig();
3854
3854
  const theme = config2.theme || {};
3855
3855
  const style = useMemo(
@@ -3867,12 +3867,12 @@ const ConfigProvider = (props) => {
3867
3867
  }
3868
3868
  );
3869
3869
  };
3870
- ConfigProvider.defaultProps = defaultProps$1o;
3870
+ ConfigProvider.defaultProps = defaultProps$1p;
3871
3871
  ConfigProvider.displayName = "NutConfigProvider";
3872
3872
  const pxCheck = (value) => {
3873
3873
  return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
3874
3874
  };
3875
- const defaultProps$1n = {
3875
+ const defaultProps$1o = {
3876
3876
  ...ComponentDefaults,
3877
3877
  fit: "fill",
3878
3878
  position: "center",
@@ -3901,21 +3901,19 @@ const Image$1 = (props) => {
3901
3901
  onClick,
3902
3902
  onLoad,
3903
3903
  onError
3904
- } = { ...defaultProps$1n, ...props };
3904
+ } = { ...defaultProps$1o, ...props };
3905
3905
  const [innerLoading, setInnerLoading] = useState(true);
3906
3906
  const [isError, setIsError] = useState(false);
3907
- const [_src, setSrc] = useState("");
3908
3907
  const imgRef = useRef(null);
3909
3908
  useEffect(() => {
3910
3909
  if (imgRef.current && imgRef.current.complete && imgRef.current.naturalHeight !== 0) {
3911
3910
  setInnerLoading(false);
3912
3911
  } else if (src) {
3913
- setSrc(src);
3914
- setIsError(false);
3915
3912
  setInnerLoading(true);
3916
3913
  }
3917
3914
  }, [src]);
3918
3915
  const handleLoad = () => {
3916
+ setIsError(false);
3919
3917
  setInnerLoading(false);
3920
3918
  onLoad && onLoad();
3921
3919
  };
@@ -4011,7 +4009,7 @@ const Image$1 = (props) => {
4011
4009
  ref: imgRef,
4012
4010
  className: "nut-img lazyload",
4013
4011
  style: imgStyle,
4014
- "data-src": _src,
4012
+ "data-src": src,
4015
4013
  alt,
4016
4014
  loading: "lazy",
4017
4015
  onLoad: handleLoad,
@@ -4023,7 +4021,7 @@ const Image$1 = (props) => {
4023
4021
  ref: imgRef,
4024
4022
  className: "nut-img",
4025
4023
  style: imgStyle,
4026
- src: _src,
4024
+ src,
4027
4025
  alt,
4028
4026
  onLoad: handleLoad,
4029
4027
  onError: handleError
@@ -4035,7 +4033,7 @@ const Image$1 = (props) => {
4035
4033
  }
4036
4034
  );
4037
4035
  };
4038
- Image$1.defaultProps = defaultProps$1n;
4036
+ Image$1.defaultProps = defaultProps$1o;
4039
4037
  Image$1.displayName = "NutImage";
4040
4038
  const defaultOverlayProps = {
4041
4039
  ...ComponentDefaults,
@@ -4120,7 +4118,7 @@ const Overlay = (props) => {
4120
4118
  Overlay.defaultProps = defaultOverlayProps;
4121
4119
  Overlay.displayName = "NutOverlay";
4122
4120
  const DataContext$2 = createContext({});
4123
- const defaultProps$1m = {
4121
+ const defaultProps$1n = {
4124
4122
  ...ComponentDefaults,
4125
4123
  span: "24",
4126
4124
  offset: "0",
@@ -4128,7 +4126,7 @@ const defaultProps$1m = {
4128
4126
  };
4129
4127
  const Col = (props) => {
4130
4128
  const { className, style, span, offset, children, onClick } = {
4131
- ...defaultProps$1m,
4129
+ ...defaultProps$1n,
4132
4130
  ...props
4133
4131
  };
4134
4132
  const [colName, setColName] = useState("");
@@ -4160,9 +4158,9 @@ const Col = (props) => {
4160
4158
  }
4161
4159
  );
4162
4160
  };
4163
- Col.defaultProps = defaultProps$1m;
4161
+ Col.defaultProps = defaultProps$1n;
4164
4162
  Col.displayName = "NutCol";
4165
- const defaultProps$1l = {
4163
+ const defaultProps$1m = {
4166
4164
  ...ComponentDefaults,
4167
4165
  contentPosition: "center",
4168
4166
  direction: "horizontal"
@@ -4170,7 +4168,7 @@ const defaultProps$1l = {
4170
4168
  const classPrefix$d = `nut-divider`;
4171
4169
  const Divider = (props) => {
4172
4170
  const { children, contentPosition, style, className, direction, ...rest } = {
4173
- ...defaultProps$1l,
4171
+ ...defaultProps$1m,
4174
4172
  ...props
4175
4173
  };
4176
4174
  const classes = direction === "horizontal" ? classNames({
@@ -4185,14 +4183,14 @@ const Divider = (props) => {
4185
4183
  });
4186
4184
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classes} ${className || ""}`, style, ...rest, children });
4187
4185
  };
4188
- Divider.defaultProps = defaultProps$1l;
4186
+ Divider.defaultProps = defaultProps$1m;
4189
4187
  Divider.displayName = "NutDivider";
4190
4188
  const gridContext = {
4191
4189
  onClick: (item, index) => {
4192
4190
  }
4193
4191
  };
4194
4192
  const GridContext = React__default.createContext(gridContext);
4195
- const defaultProps$1k = {
4193
+ const defaultProps$1l = {
4196
4194
  text: "",
4197
4195
  columns: 4,
4198
4196
  gap: 0,
@@ -4218,7 +4216,7 @@ const GridItem = (props) => {
4218
4216
  onClick,
4219
4217
  ...rest
4220
4218
  } = {
4221
- ...defaultProps$1k,
4219
+ ...defaultProps$1l,
4222
4220
  ...props
4223
4221
  };
4224
4222
  const classPrefix2 = "nut-grid-item";
@@ -4279,9 +4277,9 @@ const GridItem = (props) => {
4279
4277
  }
4280
4278
  );
4281
4279
  };
4282
- GridItem.defaultProps = defaultProps$1k;
4280
+ GridItem.defaultProps = defaultProps$1l;
4283
4281
  GridItem.displayName = "NutGridItem";
4284
- const defaultProps$1j = {
4282
+ const defaultProps$1k = {
4285
4283
  columns: 4,
4286
4284
  gap: 0,
4287
4285
  center: true,
@@ -4302,7 +4300,7 @@ const Grid = (props) => {
4302
4300
  className,
4303
4301
  onClick,
4304
4302
  ...rest
4305
- } = { ...defaultProps$1j, ...props };
4303
+ } = { ...defaultProps$1k, ...props };
4306
4304
  const childrenDom = React__default.Children.toArray(children);
4307
4305
  const classPrefix2 = "nut-grid";
4308
4306
  const rootClass = () => {
@@ -4332,18 +4330,18 @@ const Grid = (props) => {
4332
4330
  });
4333
4331
  }) }) });
4334
4332
  };
4335
- Grid.defaultProps = defaultProps$1j;
4333
+ Grid.defaultProps = defaultProps$1k;
4336
4334
  Grid.displayName = "NutGrid";
4337
4335
  Grid.Item = GridItem;
4338
- const defaultProps$1i = {};
4336
+ const defaultProps$1j = {};
4339
4337
  const Layout = (props) => {
4340
- ({ ...defaultProps$1i, ...props });
4338
+ ({ ...defaultProps$1j, ...props });
4341
4339
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-layout", children: "Layout" });
4342
4340
  };
4343
- Layout.defaultProps = defaultProps$1i;
4341
+ Layout.defaultProps = defaultProps$1j;
4344
4342
  Layout.displayName = "NutLayout";
4345
4343
  const classPrefix$c = "nut-row";
4346
- const defaultProps$1h = {
4344
+ const defaultProps$1i = {
4347
4345
  ...ComponentDefaults,
4348
4346
  type: "",
4349
4347
  justify: "start",
@@ -4363,7 +4361,7 @@ const Row = (props) => {
4363
4361
  gutter,
4364
4362
  onClick
4365
4363
  } = {
4366
- ...defaultProps$1h,
4364
+ ...defaultProps$1i,
4367
4365
  ...props
4368
4366
  };
4369
4367
  const getClass = (prefix2, type22) => {
@@ -4395,7 +4393,7 @@ const Row = (props) => {
4395
4393
  children
4396
4394
  ) });
4397
4395
  };
4398
- Row.defaultProps = defaultProps$1h;
4396
+ Row.defaultProps = defaultProps$1i;
4399
4397
  Row.displayName = "NutRow";
4400
4398
  const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
4401
4399
  const defaultRoot = canUseDom ? window : void 0;
@@ -4470,7 +4468,7 @@ function useWatch(dep, callback, config2 = { immediate: false }) {
4470
4468
  stop2.current = true;
4471
4469
  };
4472
4470
  }
4473
- const defaultProps$1g = {
4471
+ const defaultProps$1h = {
4474
4472
  ...ComponentDefaults,
4475
4473
  position: "top",
4476
4474
  threshold: 0,
@@ -4488,7 +4486,7 @@ const Sticky = (props) => {
4488
4486
  threshold,
4489
4487
  onChange,
4490
4488
  ...rest
4491
- } = { ...defaultProps$1g, ...props };
4489
+ } = { ...defaultProps$1h, ...props };
4492
4490
  const stickyRef = useRef(null);
4493
4491
  const rootRef = useRef(null);
4494
4492
  const [isFixed, setIsFixed] = useState(false);
@@ -4604,9 +4602,9 @@ const Sticky = (props) => {
4604
4602
  }
4605
4603
  );
4606
4604
  };
4607
- Sticky.defaultProps = defaultProps$1g;
4605
+ Sticky.defaultProps = defaultProps$1h;
4608
4606
  Sticky.displayName = "NutSticky";
4609
- const defaultProps$1f = {
4607
+ const defaultProps$1g = {
4610
4608
  ...ComponentDefaults,
4611
4609
  target: "",
4612
4610
  threshold: 200,
@@ -4624,7 +4622,7 @@ const BackTop = (props) => {
4624
4622
  style,
4625
4623
  onClick
4626
4624
  } = {
4627
- ...defaultProps$1f,
4625
+ ...defaultProps$1g,
4628
4626
  ...props
4629
4627
  };
4630
4628
  const classPrefix2 = "nut-backtop";
@@ -4722,7 +4720,7 @@ const BackTop = (props) => {
4722
4720
  }
4723
4721
  );
4724
4722
  };
4725
- BackTop.defaultProps = defaultProps$1f;
4723
+ BackTop.defaultProps = defaultProps$1g;
4726
4724
  BackTop.displayName = "NutBackTop";
4727
4725
  function clamp$1(v, min, max) {
4728
4726
  return Math.max(min, Math.min(v, max));
@@ -9840,7 +9838,7 @@ const host = createHost(primitives, {
9840
9838
  });
9841
9839
  const animated = host.animated;
9842
9840
  const elevatorContext = createContext({});
9843
- const defaultProps$1e = {
9841
+ const defaultProps$1f = {
9844
9842
  ...ComponentDefaults,
9845
9843
  height: "200px",
9846
9844
  floorKey: "title",
@@ -9864,7 +9862,7 @@ const Elevator = (props) => {
9864
9862
  children,
9865
9863
  ...rest
9866
9864
  } = {
9867
- ...defaultProps$1e,
9865
+ ...defaultProps$1f,
9868
9866
  ...props
9869
9867
  };
9870
9868
  const classPrefix2 = "nut-elevator";
@@ -10047,10 +10045,10 @@ const Elevator = (props) => {
10047
10045
  ) })
10048
10046
  ] });
10049
10047
  };
10050
- Elevator.defaultProps = defaultProps$1e;
10048
+ Elevator.defaultProps = defaultProps$1f;
10051
10049
  Elevator.displayName = "NutElevator";
10052
10050
  Elevator.Context = elevatorContext;
10053
- const defaultProps$1d = {
10051
+ const defaultProps$1e = {
10054
10052
  ...ComponentDefaults,
10055
10053
  activeText: "",
10056
10054
  inactiveText: "",
@@ -10078,7 +10076,7 @@ const FixedNav = (props) => {
10078
10076
  content,
10079
10077
  ...rest
10080
10078
  } = {
10081
- ...defaultProps$1d,
10079
+ ...defaultProps$1e,
10082
10080
  ...props
10083
10081
  };
10084
10082
  const classPrefix2 = "nut-fixednav";
@@ -10137,9 +10135,9 @@ const FixedNav = (props) => {
10137
10135
  }
10138
10136
  );
10139
10137
  };
10140
- FixedNav.defaultProps = defaultProps$1d;
10138
+ FixedNav.defaultProps = defaultProps$1e;
10141
10139
  FixedNav.displayName = "NutFixedNav";
10142
- const defaultProps$1c = {
10140
+ const defaultProps$1d = {
10143
10141
  ...ComponentDefaults,
10144
10142
  left: "",
10145
10143
  right: "",
@@ -10162,7 +10160,7 @@ const NavBar = (props) => {
10162
10160
  zIndex,
10163
10161
  onClickBack
10164
10162
  } = {
10165
- ...defaultProps$1c,
10163
+ ...defaultProps$1d,
10166
10164
  ...props
10167
10165
  };
10168
10166
  const classPrefix2 = "nut-navbar";
@@ -10206,7 +10204,7 @@ const NavBar = (props) => {
10206
10204
  const cls = classNames(classPrefix2, classes, className);
10207
10205
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: fixed && placeholder ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}--placeholder`, children: renderWrapper() }) : renderWrapper() });
10208
10206
  };
10209
- NavBar.defaultProps = defaultProps$1c;
10207
+ NavBar.defaultProps = defaultProps$1d;
10210
10208
  NavBar.displayName = "NutNavBar";
10211
10209
  function _extends$1() {
10212
10210
  _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
@@ -11949,7 +11947,7 @@ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends$1({},
11949
11947
  onExited: propTypesExports.func
11950
11948
  }) : {};
11951
11949
  const CSSTransition$1 = CSSTransition;
11952
- const defaultProps$1b = {
11950
+ const defaultProps$1c = {
11953
11951
  ...ComponentDefaults,
11954
11952
  position: "center",
11955
11953
  transition: "",
@@ -12128,7 +12126,7 @@ const Popup = (props) => {
12128
12126
  }, [position, transition]);
12129
12127
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: renderToContainer(portal, renderNode()) });
12130
12128
  };
12131
- Popup.defaultProps = defaultProps$1b;
12129
+ Popup.defaultProps = defaultProps$1c;
12132
12130
  Popup.displayName = "NutPopup";
12133
12131
  const handleClick = (e) => {
12134
12132
  e.stopPropagation();
@@ -12144,7 +12142,7 @@ const handleClick = (e) => {
12144
12142
  }
12145
12143
  };
12146
12144
  const OffsetContext = createContext(20);
12147
- const defaultProps$1a = {
12145
+ const defaultProps$1b = {
12148
12146
  showhead: false,
12149
12147
  position: "left",
12150
12148
  width: "80%"
@@ -12161,7 +12159,7 @@ const SideNavBar = (props) => {
12161
12159
  onClose,
12162
12160
  ...rest
12163
12161
  } = {
12164
- ...defaultProps$1a,
12162
+ ...defaultProps$1b,
12165
12163
  ...props
12166
12164
  };
12167
12165
  const offset = props.offset ? Number(props.offset) : 20;
@@ -12197,7 +12195,7 @@ const SideNavBar = (props) => {
12197
12195
  }
12198
12196
  );
12199
12197
  };
12200
- SideNavBar.defaultProps = defaultProps$1a;
12198
+ SideNavBar.defaultProps = defaultProps$1b;
12201
12199
  SideNavBar.displayName = "NutSideNavBar";
12202
12200
  const SideNavBarItem = (props) => {
12203
12201
  const { title, key, children, onClick, ...rest } = props;
@@ -12215,12 +12213,12 @@ const SideNavBarItem = (props) => {
12215
12213
  }
12216
12214
  );
12217
12215
  };
12218
- const defaultProps$19 = {
12216
+ const defaultProps$1a = {
12219
12217
  open: true
12220
12218
  };
12221
12219
  const SubSideNavBar = (props) => {
12222
12220
  const { title, key, children, onClick, open, ...rest } = {
12223
- ...defaultProps$19,
12221
+ ...defaultProps$1a,
12224
12222
  ...props
12225
12223
  };
12226
12224
  const offset = useContext(OffsetContext);
@@ -12294,7 +12292,7 @@ function usePropsValue({
12294
12292
  }
12295
12293
  return [uncontrolled, handleUncontrolledChange];
12296
12294
  }
12297
- const defaultProps$18 = {
12295
+ const defaultProps$19 = {
12298
12296
  ...ComponentDefaults,
12299
12297
  value: "",
12300
12298
  dot: false,
@@ -12305,7 +12303,7 @@ const defaultProps$18 = {
12305
12303
  };
12306
12304
  const Badge = (props) => {
12307
12305
  const { className, style, value, max, children, dot, top, right, color } = {
12308
- ...defaultProps$18,
12306
+ ...defaultProps$19,
12309
12307
  ...props
12310
12308
  };
12311
12309
  const classPrefix2 = "nut-badge";
@@ -12336,9 +12334,9 @@ const Badge = (props) => {
12336
12334
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: contentClasses, style: getStyle(), children: content() })
12337
12335
  ] });
12338
12336
  };
12339
- Badge.defaultProps = defaultProps$18;
12337
+ Badge.defaultProps = defaultProps$19;
12340
12338
  Badge.displayName = "NutBadge";
12341
- const defaultProps$17 = {
12339
+ const defaultProps$18 = {
12342
12340
  ...ComponentDefaults,
12343
12341
  title: "",
12344
12342
  icon: null,
@@ -12360,7 +12358,7 @@ const TabbarItem = (props) => {
12360
12358
  handleClick: handleClick2,
12361
12359
  ...rest
12362
12360
  } = {
12363
- ...defaultProps$17,
12361
+ ...defaultProps$18,
12364
12362
  ...props
12365
12363
  };
12366
12364
  const classPrefix2 = "nut-tabbar-item";
@@ -12387,7 +12385,7 @@ const TabbarItem = (props) => {
12387
12385
  }
12388
12386
  );
12389
12387
  };
12390
- const defaultProps$16 = {
12388
+ const defaultProps$17 = {
12391
12389
  ...ComponentDefaults,
12392
12390
  defaultValue: 0,
12393
12391
  fixed: false,
@@ -12410,7 +12408,7 @@ const Tabbar = (props) => {
12410
12408
  style,
12411
12409
  onSwitch
12412
12410
  } = {
12413
- ...defaultProps$16,
12411
+ ...defaultProps$17,
12414
12412
  ...props
12415
12413
  };
12416
12414
  const classPrefix2 = "nut-tabbar";
@@ -12447,17 +12445,17 @@ const Tabbar = (props) => {
12447
12445
  }
12448
12446
  );
12449
12447
  };
12450
- Tabbar.defaultProps = defaultProps$16;
12448
+ Tabbar.defaultProps = defaultProps$17;
12451
12449
  Tabbar.displayName = "NutTabbar";
12452
12450
  Tabbar.Item = TabbarItem;
12453
- const defaultProps$15 = {
12451
+ const defaultProps$16 = {
12454
12452
  title: "",
12455
12453
  value: "",
12456
12454
  disabled: false
12457
12455
  };
12458
12456
  const TabPane = (props) => {
12459
12457
  const { children, autoHeightClassName, className, disabled } = {
12460
- ...defaultProps$15,
12458
+ ...defaultProps$16,
12461
12459
  ...props
12462
12460
  };
12463
12461
  const classPrefix2 = "nut-tabpane";
@@ -12484,7 +12482,7 @@ function requestAniFrame() {
12484
12482
  }
12485
12483
  }
12486
12484
  const requestAniFrame$1 = requestAniFrame();
12487
- const defaultProps$14 = {
12485
+ const defaultProps$15 = {
12488
12486
  ...ComponentDefaults,
12489
12487
  tabStyle: {},
12490
12488
  activeColor: "",
@@ -12510,7 +12508,7 @@ const Tabs = (props) => {
12510
12508
  autoHeight,
12511
12509
  ...rest
12512
12510
  } = {
12513
- ...defaultProps$14,
12511
+ ...defaultProps$15,
12514
12512
  ...props
12515
12513
  };
12516
12514
  const [value, setValue] = usePropsValue({
@@ -12571,6 +12569,16 @@ const Tabs = (props) => {
12571
12569
  return titles2;
12572
12570
  };
12573
12571
  const titles = useRef(getTitles());
12572
+ useEffect(() => {
12573
+ titles.current = getTitles();
12574
+ let current = "";
12575
+ titles.current.forEach((title2) => {
12576
+ if (title2.value === value) {
12577
+ current = value;
12578
+ }
12579
+ });
12580
+ setValue(current);
12581
+ }, [children]);
12574
12582
  const classes = classNames(
12575
12583
  classPrefix$a,
12576
12584
  `${classPrefix$a}--${direction}`,
@@ -12665,7 +12673,7 @@ const Tabs = (props) => {
12665
12673
  }) }) })
12666
12674
  ] });
12667
12675
  };
12668
- Tabs.defaultProps = defaultProps$14;
12676
+ Tabs.defaultProps = defaultProps$15;
12669
12677
  Tabs.displayName = "NutTabs";
12670
12678
  Tabs.TabPane = TabPane;
12671
12679
  var classnameExports = {};
@@ -12788,7 +12796,7 @@ function requireClassname_development() {
12788
12796
  }
12789
12797
  })(classname);
12790
12798
  const cn = classnameExports.withNaming({ n: "nut-", e: "__", m: "--", v: "-" });
12791
- const defaultProps$13 = {
12799
+ const defaultProps$14 = {
12792
12800
  type: "custom",
12793
12801
  existAddress: [],
12794
12802
  defaultIcon: null,
@@ -12810,7 +12818,7 @@ const ExistRender = (props) => {
12810
12818
  onClose,
12811
12819
  onSwitchModule,
12812
12820
  ...rest
12813
- } = { ...defaultProps$13, ...props };
12821
+ } = { ...defaultProps$14, ...props };
12814
12822
  const b = cn("address");
12815
12823
  const selectedExist = (item) => {
12816
12824
  const copyExistAdd = existAddress;
@@ -12852,7 +12860,7 @@ const ExistRender = (props) => {
12852
12860
  isShowCustomAddress && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("choose-other"), onClick: onSwitch, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("choose-other-btn"), children: customAndExistTitle || locale.address.chooseAnotherAddress }) })
12853
12861
  ] });
12854
12862
  };
12855
- const defaultProps$12 = {
12863
+ const defaultProps$13 = {
12856
12864
  modelValue: [],
12857
12865
  type: "custom",
12858
12866
  province: [],
@@ -12877,7 +12885,7 @@ const CustomRender = (props) => {
12877
12885
  onClose,
12878
12886
  ...rest
12879
12887
  } = {
12880
- ...defaultProps$12,
12888
+ ...defaultProps$13,
12881
12889
  ...props
12882
12890
  };
12883
12891
  const b = cn("address");
@@ -13046,28 +13054,28 @@ const CustomRender = (props) => {
13046
13054
  nextAreaList(item);
13047
13055
  };
13048
13056
  useEffect(() => {
13049
- const { province: province2 } = { ...defaultProps$12, ...props };
13057
+ const { province: province2 } = { ...defaultProps$13, ...props };
13050
13058
  setRegionList({
13051
13059
  ...regionList,
13052
13060
  province: isCustom2() ? transformData(province2) : province2
13053
13061
  });
13054
13062
  }, [province]);
13055
13063
  useEffect(() => {
13056
- const { city: city2 } = { ...defaultProps$12, ...props };
13064
+ const { city: city2 } = { ...defaultProps$13, ...props };
13057
13065
  setRegionList({
13058
13066
  ...regionList,
13059
13067
  city: isCustom2() ? transformData(city2) : city2
13060
13068
  });
13061
13069
  }, [city]);
13062
13070
  useEffect(() => {
13063
- const { country: country2 } = { ...defaultProps$12, ...props };
13071
+ const { country: country2 } = { ...defaultProps$13, ...props };
13064
13072
  setRegionList({
13065
13073
  ...regionList,
13066
13074
  country: isCustom2() ? transformData(country2) : country2
13067
13075
  });
13068
13076
  }, [country]);
13069
13077
  useEffect(() => {
13070
- const { town: town2 } = { ...defaultProps$12, ...props };
13078
+ const { town: town2 } = { ...defaultProps$13, ...props };
13071
13079
  setRegionList({
13072
13080
  ...regionList,
13073
13081
  town: isCustom2() ? transformData(town2) : town2
@@ -13142,7 +13150,7 @@ const CustomRender = (props) => {
13142
13150
  ) })
13143
13151
  ] });
13144
13152
  };
13145
- const defaultProps$11 = {
13153
+ const defaultProps$12 = {
13146
13154
  ...ComponentDefaults,
13147
13155
  modelValue: false,
13148
13156
  modelSelect: [],
@@ -13193,7 +13201,7 @@ const Address = (props) => {
13193
13201
  className,
13194
13202
  ...rest
13195
13203
  } = {
13196
- ...defaultProps$11,
13204
+ ...defaultProps$12,
13197
13205
  ...props
13198
13206
  };
13199
13207
  const b = cn("address");
@@ -13351,7 +13359,7 @@ const Address = (props) => {
13351
13359
  }
13352
13360
  ) });
13353
13361
  };
13354
- Address.defaultProps = defaultProps$11;
13362
+ Address.defaultProps = defaultProps$12;
13355
13363
  Address.displayName = "NutAddress";
13356
13364
  const Utils = {
13357
13365
  /**
@@ -13471,7 +13479,7 @@ const Utils = {
13471
13479
  return false;
13472
13480
  }
13473
13481
  };
13474
- const defaultProps$10 = {
13482
+ const defaultProps$11 = {
13475
13483
  type: "one",
13476
13484
  isAutoBackFill: false,
13477
13485
  poppable: true,
@@ -13523,7 +13531,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
13523
13531
  onUpdate,
13524
13532
  onSelected,
13525
13533
  onYearMonthChange
13526
- } = { ...defaultProps$10, ...props };
13534
+ } = { ...defaultProps$11, ...props };
13527
13535
  const weeks = locale.calendaritem.weekdays;
13528
13536
  const [yearMonthTitle, setYearMonthTitle] = useState("");
13529
13537
  const [monthsData, setMonthsData] = useState([]);
@@ -14119,9 +14127,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
14119
14127
  poppable && !isAutoBackFill ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-calendar-footer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "calendar-confirm-btn", onClick: confirm2, children: confirmText || locale.confirm }) }) : ""
14120
14128
  ] }) });
14121
14129
  });
14122
- CalendarItem.defaultProps = defaultProps$10;
14130
+ CalendarItem.defaultProps = defaultProps$11;
14123
14131
  CalendarItem.displayName = "NutCalendarItem";
14124
- const defaultProps$$ = {
14132
+ const defaultProps$10 = {
14125
14133
  type: "one",
14126
14134
  isAutoBackFill: false,
14127
14135
  poppable: true,
@@ -14176,7 +14184,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
14176
14184
  onChoose,
14177
14185
  onSelected,
14178
14186
  onYearMonthChange
14179
- } = { ...defaultProps$$, ...props };
14187
+ } = { ...defaultProps$10, ...props };
14180
14188
  const calendarRef = useRef(null);
14181
14189
  const close = () => {
14182
14190
  onClose && onClose();
@@ -14246,9 +14254,9 @@ const Calendar = React__default.forwardRef((props, ref) => {
14246
14254
  }
14247
14255
  ) : renderItem() });
14248
14256
  });
14249
- Calendar.defaultProps = defaultProps$$;
14257
+ Calendar.defaultProps = defaultProps$10;
14250
14258
  Calendar.displayName = "NutCalendar";
14251
- const defaultProps$_ = {
14259
+ const defaultProps$$ = {
14252
14260
  data: {
14253
14261
  text: "",
14254
14262
  value: "",
@@ -14259,32 +14267,37 @@ const defaultProps$_ = {
14259
14267
  },
14260
14268
  activeColor: "",
14261
14269
  checked: false,
14262
- checkedIcon: "checklist",
14270
+ activeIcon: "checklist",
14263
14271
  chooseItem: () => {
14264
14272
  }
14265
14273
  };
14266
14274
  const InternalCascaderItem = (props, ref) => {
14267
- const { data, checked, checkedIcon, chooseItem, activeColor } = {
14268
- ...defaultProps$_,
14275
+ const { data, checked, activeIcon, chooseItem, activeColor } = {
14276
+ ...defaultProps$$,
14269
14277
  ...props
14270
14278
  };
14271
- const b = cn("cascader-item");
14279
+ const classPrefix2 = "nut-cascader-item";
14272
14280
  const classes = classNames(
14273
14281
  {
14274
14282
  active: checked,
14275
14283
  disabled: data.disabled
14276
14284
  },
14277
- b("")
14285
+ classPrefix2
14278
14286
  );
14279
14287
  const classesTitle = classNames({
14280
- [`${b("")}__title`]: true
14288
+ [`${classPrefix2}__title`]: true
14281
14289
  });
14282
14290
  const renderIcon = () => {
14283
14291
  if (checked) {
14284
- if (isValidElement(checkedIcon)) {
14285
- return checkedIcon;
14292
+ if (isValidElement(activeIcon)) {
14293
+ return activeIcon;
14286
14294
  }
14287
- return /* @__PURE__ */ jsxRuntimeExports.jsx(x$c, { className: `${checked ? b("icon-check") : ""}` });
14295
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
14296
+ x$c,
14297
+ {
14298
+ className: `${checked ? `${classPrefix2}__icon-check` : ""}`
14299
+ }
14300
+ );
14288
14301
  }
14289
14302
  return null;
14290
14303
  };
@@ -14304,7 +14317,7 @@ const InternalCascaderItem = (props, ref) => {
14304
14317
  );
14305
14318
  };
14306
14319
  const CascaderItem = React__default.forwardRef(InternalCascaderItem);
14307
- CascaderItem.defaultProps = defaultProps$_;
14320
+ CascaderItem.defaultProps = defaultProps$$;
14308
14321
  CascaderItem.displayName = "NutCascaderItem";
14309
14322
  const formatTree = (tree, parent, config2) => tree.map((node) => {
14310
14323
  const {
@@ -14442,26 +14455,22 @@ class Tree {
14442
14455
  }
14443
14456
  }
14444
14457
  const Tree$1 = Tree;
14445
- const defaultProps$Z = {
14446
- className: "",
14447
- style: {},
14458
+ const defaultProps$_ = {
14459
+ ...ComponentDefaults,
14448
14460
  activeColor: "",
14449
- checkedIcon: "checklist",
14450
- tabsColor: "",
14451
- poppable: true,
14461
+ activeIcon: "checklist",
14462
+ popup: true,
14452
14463
  visible: false,
14453
14464
  options: [],
14454
14465
  value: [],
14455
14466
  title: "",
14456
- textKey: "text",
14457
- valueKey: "value",
14458
- childrenKey: "children",
14459
- convertConfig: {},
14467
+ optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" },
14468
+ format: {},
14460
14469
  closeable: false,
14461
14470
  closeIconPosition: "top-right",
14462
14471
  closeIcon: "close",
14463
14472
  lazy: false,
14464
- lazyLoad: () => {
14473
+ onLoad: () => {
14465
14474
  },
14466
14475
  onClose: () => {
14467
14476
  },
@@ -14475,28 +14484,25 @@ const InternalCascader = (props, ref) => {
14475
14484
  const {
14476
14485
  className,
14477
14486
  style,
14478
- tabsColor,
14479
- poppable,
14487
+ popup,
14480
14488
  visible,
14481
14489
  options: options2,
14482
14490
  value,
14483
14491
  title,
14484
- textKey,
14485
- valueKey,
14486
- childrenKey,
14487
- convertConfig: convertConfig2,
14492
+ optionKey: optionKey2,
14493
+ format: format2,
14488
14494
  closeable,
14489
14495
  closeIconPosition,
14490
14496
  closeIcon,
14491
14497
  lazy,
14492
- lazyLoad,
14498
+ onLoad,
14493
14499
  onClose,
14494
14500
  onChange,
14495
14501
  onPathChange
14496
- } = { ...defaultProps$Z, ...props };
14502
+ } = { ...defaultProps$_, ...props };
14497
14503
  const [tabvalue, setTabvalue] = useState("c1");
14498
14504
  const [optionsData, setOptionsData] = useState([]);
14499
- const isLazy = () => state.configs.lazy && Boolean(state.configs.lazyLoad);
14505
+ const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
14500
14506
  const [state] = useState({
14501
14507
  optionsData: [],
14502
14508
  panes: [
@@ -14514,44 +14520,38 @@ const InternalCascader = (props, ref) => {
14514
14520
  currentProcessNode: [],
14515
14521
  configs: {
14516
14522
  lazy,
14517
- lazyLoad,
14518
- valueKey,
14519
- textKey,
14520
- childrenKey,
14521
- convertConfig: convertConfig2
14523
+ onLoad,
14524
+ optionKey: optionKey2,
14525
+ format: format2
14522
14526
  },
14523
14527
  lazyLoadMap: /* @__PURE__ */ new Map()
14524
14528
  });
14525
- const b = cn("cascader");
14526
- const classes = classNames(b(""));
14529
+ const classPrefix2 = classNames(`nut-cascader`);
14527
14530
  const classesPane = classNames({
14528
- [`${b("")}-pane`]: true
14531
+ [`${classPrefix2}-pane`]: true
14529
14532
  });
14530
14533
  useEffect(() => {
14531
14534
  initData();
14532
- }, []);
14535
+ }, [options2]);
14533
14536
  useEffect(() => {
14534
14537
  if (value !== state.innerValue) {
14535
14538
  state.innerValue = value;
14536
14539
  }
14537
14540
  }, [value]);
14538
- useEffect(() => {
14539
- initData();
14540
- }, [options2]);
14541
14541
  const initData = async () => {
14542
14542
  state.lazyLoadMap.clear();
14543
- if (convertConfig2 && Object.keys(convertConfig2).length > 0) {
14543
+ if (format2 && Object.keys(format2).length > 0) {
14544
14544
  state.optionsData = convertListToOptions(
14545
14545
  options2,
14546
- convertConfig2
14546
+ format2
14547
14547
  );
14548
14548
  } else {
14549
14549
  state.optionsData = options2;
14550
14550
  }
14551
14551
  state.tree = new Tree$1(state.optionsData, {
14552
- value: state.configs.valueKey,
14553
- text: state.configs.textKey,
14554
- children: state.configs.childrenKey
14552
+ value: state.configs.optionKey.valueKey,
14553
+ text: state.configs.optionKey.textKey,
14554
+ children: state.configs.optionKey.childrenKey
14555
14555
  });
14556
14556
  if (isLazy() && !state.tree.nodes.length) {
14557
14557
  await invokeLazyLoad({
@@ -14617,7 +14617,7 @@ const InternalCascader = (props, ref) => {
14617
14617
  if (!node) {
14618
14618
  return;
14619
14619
  }
14620
- if (!state.configs.lazyLoad) {
14620
+ if (!state.configs.onLoad) {
14621
14621
  node.leaf = true;
14622
14622
  return;
14623
14623
  }
@@ -14630,7 +14630,7 @@ const InternalCascader = (props, ref) => {
14630
14630
  if (!lazyLoadPromise) {
14631
14631
  lazyLoadPromise = new Promise((resolve) => {
14632
14632
  var _a2, _b;
14633
- (_b = (_a2 = state.configs).lazyLoad) == null ? void 0 : _b.call(_a2, node, resolve);
14633
+ (_b = (_a2 = state.configs).onLoad) == null ? void 0 : _b.call(_a2, node, resolve);
14634
14634
  });
14635
14635
  state.lazyLoadMap.set(node, lazyLoadPromise);
14636
14636
  }
@@ -14677,8 +14677,8 @@ const InternalCascader = (props, ref) => {
14677
14677
  selectedNode: null,
14678
14678
  paneKey: `c${state.tabsCursor + 1}`
14679
14679
  });
14680
- setTabvalue(`c${state.tabsCursor + 1}`);
14681
14680
  setOptionsData(state.panes);
14681
+ setTabvalue(`c${state.tabsCursor + 1}`);
14682
14682
  if (!type4) {
14683
14683
  const pathNodes = state.panes.map((item) => item.selectedNode);
14684
14684
  const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
@@ -14698,8 +14698,8 @@ const InternalCascader = (props, ref) => {
14698
14698
  setOptionsData(state.panes);
14699
14699
  };
14700
14700
  const renderItem = () => {
14701
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classes} ${className}`, style, children: [
14702
- poppable && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("title"), children: title }),
14701
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2} ${className}`, style, children: [
14702
+ popup && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-cascader__title", children: title }),
14703
14703
  /* @__PURE__ */ jsxRuntimeExports.jsx(
14704
14704
  Tabs,
14705
14705
  {
@@ -14714,27 +14714,21 @@ const InternalCascader = (props, ref) => {
14714
14714
  setTabvalue(pane.paneKey);
14715
14715
  state.tabsCursor = index;
14716
14716
  },
14717
- className: `nut-tabs__titles-item ${tabvalue === pane.paneKey ? "active" : ""}`,
14717
+ className: `nut-tabs__titles-item ${tabvalue === pane.paneKey ? "nut-tabs__titles-item--active" : ""}`,
14718
14718
  children: [
14719
14719
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "nut-tabs__titles-item__text", children: [
14720
14720
  !state.initLoading && state.panes.length && ((_a2 = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _a2.text),
14721
14721
  !state.initLoading && state.panes.length && !((_b = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _b.text) && "请选择",
14722
14722
  !(!state.initLoading && state.panes.length) && "Loading..."
14723
14723
  ] }),
14724
- /* @__PURE__ */ jsxRuntimeExports.jsx(
14725
- "span",
14726
- {
14727
- className: "nut-tabs__titles-item__line",
14728
- style: { background: tabsColor }
14729
- }
14730
- )
14724
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "nut-tabs__titles-item__line" })
14731
14725
  ]
14732
14726
  },
14733
14727
  pane.paneKey
14734
14728
  );
14735
14729
  });
14736
14730
  },
14737
- children: !state.initLoading && state.panes.length ? optionsData.map((pane) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabPane, { value: pane.paneKey, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane, children: pane.nodes && pane.nodes.map((node, index) => {
14731
+ children: !state.initLoading && state.panes.length ? optionsData.map((pane) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs.TabPane, { value: pane.paneKey, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane, children: pane.nodes && pane.nodes.map((node, index) => {
14738
14732
  var _a2;
14739
14733
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14740
14734
  CascaderItem,
@@ -14746,15 +14740,14 @@ const InternalCascader = (props, ref) => {
14746
14740
  },
14747
14741
  index
14748
14742
  );
14749
- }) }) }, pane.paneKey)) : /* @__PURE__ */ jsxRuntimeExports.jsx(TabPane, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane }) })
14743
+ }) }) }, pane.paneKey)) : /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs.TabPane, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane }) })
14750
14744
  }
14751
14745
  )
14752
14746
  ] });
14753
14747
  };
14754
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: poppable ? /* @__PURE__ */ jsxRuntimeExports.jsx(
14748
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: popup ? /* @__PURE__ */ jsxRuntimeExports.jsx(
14755
14749
  Popup,
14756
14750
  {
14757
- className: "cascadar-popup",
14758
14751
  visible,
14759
14752
  position: "bottom",
14760
14753
  round: true,
@@ -14768,11 +14761,11 @@ const InternalCascader = (props, ref) => {
14768
14761
  ) : renderItem() });
14769
14762
  };
14770
14763
  const Cascader = React__default.forwardRef(InternalCascader);
14771
- Cascader.defaultProps = defaultProps$Z;
14764
+ Cascader.defaultProps = defaultProps$_;
14772
14765
  Cascader.displayName = "NutCascader";
14773
14766
  const CheckboxGroupContext = createContext(null);
14774
14767
  const Context = CheckboxGroupContext;
14775
- const defaultProps$Y = {
14768
+ const defaultProps$Z = {
14776
14769
  max: void 0,
14777
14770
  labelPosition: "right",
14778
14771
  direction: "vertical",
@@ -14783,7 +14776,7 @@ const defaultProps$Y = {
14783
14776
  const classPrefix$9 = "nut-checkboxgroup";
14784
14777
  const CheckboxGroup = React__default.forwardRef(
14785
14778
  (props, ref) => {
14786
- const { children } = { ...defaultProps$Y, ...props };
14779
+ const { children } = { ...defaultProps$Z, ...props };
14787
14780
  const {
14788
14781
  className,
14789
14782
  disabled,
@@ -14873,9 +14866,9 @@ const CheckboxGroup = React__default.forwardRef(
14873
14866
  );
14874
14867
  }
14875
14868
  );
14876
- CheckboxGroup.defaultProps = defaultProps$Y;
14869
+ CheckboxGroup.defaultProps = defaultProps$Z;
14877
14870
  CheckboxGroup.displayName = "NutCheckboxGroup";
14878
- const defaultProps$X = {
14871
+ const defaultProps$Y = {
14879
14872
  ...ComponentDefaults,
14880
14873
  disabled: false,
14881
14874
  labelPosition: "right",
@@ -14888,7 +14881,7 @@ const defaultProps$X = {
14888
14881
  const classPrefix$8 = "nut-checkbox";
14889
14882
  const Checkbox = (props) => {
14890
14883
  const { children } = {
14891
- ...defaultProps$X,
14884
+ ...defaultProps$Y,
14892
14885
  ...props
14893
14886
  };
14894
14887
  const {
@@ -14993,7 +14986,7 @@ const Checkbox = (props) => {
14993
14986
  }
14994
14987
  );
14995
14988
  };
14996
- Checkbox.defaultProps = defaultProps$X;
14989
+ Checkbox.defaultProps = defaultProps$Y;
14997
14990
  Checkbox.displayName = "NutCheckBox";
14998
14991
  Checkbox.Group = CheckboxGroup;
14999
14992
  const MIN_DISTANCE = 10;
@@ -15061,13 +15054,13 @@ function useTouch() {
15061
15054
  isHorizontal
15062
15055
  };
15063
15056
  }
15064
- const InternalPickerSlot = (props, ref) => {
15057
+ const InternalPickerPanel = (props, ref) => {
15065
15058
  const {
15066
15059
  keyIndex = 0,
15067
15060
  defaultValue,
15068
- listData = [],
15061
+ options: options2 = [],
15069
15062
  threeDimensional = true,
15070
- swipeDuration = 1e3,
15063
+ duration = 1e3,
15071
15064
  chooseItem
15072
15065
  } = props;
15073
15066
  const touch = useTouch();
@@ -15081,9 +15074,8 @@ const InternalPickerSlot = (props, ref) => {
15081
15074
  const rotation = 20;
15082
15075
  const moving = useRef(false);
15083
15076
  let timer;
15084
- useRef(null);
15085
15077
  const rollerRef = useRef(null);
15086
- const pickerSlotRef = useRef(null);
15078
+ const PickerPanelRef = useRef(null);
15087
15079
  const [startTime, setStartTime] = useState(0);
15088
15080
  const [startY, setStartY] = useState(0);
15089
15081
  const transformY = useRef(0);
@@ -15109,8 +15101,8 @@ const InternalPickerSlot = (props, ref) => {
15109
15101
  if (updateMove > 0) {
15110
15102
  updateMove = 0;
15111
15103
  }
15112
- if (updateMove < -(listData.length - 1) * lineSpacing) {
15113
- updateMove = -(listData.length - 1) * lineSpacing;
15104
+ if (updateMove < -(options2.length - 1) * lineSpacing) {
15105
+ updateMove = -(options2.length - 1) * lineSpacing;
15114
15106
  }
15115
15107
  const endMove = Math.round(updateMove / lineSpacing) * lineSpacing;
15116
15108
  const deg = `${(Math.abs(Math.round(endMove / lineSpacing)) + 1) * rotation}deg`;
@@ -15119,7 +15111,7 @@ const InternalPickerSlot = (props, ref) => {
15119
15111
  } else {
15120
15112
  let deg = 0;
15121
15113
  const currentDeg = (-updateMove / lineSpacing + 1) * rotation;
15122
- const maxDeg = (listData.length + 1) * rotation;
15114
+ const maxDeg = (options2.length + 1) * rotation;
15123
15115
  const minDeg = 0;
15124
15116
  deg = Math.min(Math.max(currentDeg, minDeg), maxDeg);
15125
15117
  if (minDeg < deg && deg < maxDeg) {
@@ -15129,7 +15121,7 @@ const InternalPickerSlot = (props, ref) => {
15129
15121
  }
15130
15122
  };
15131
15123
  const setChooseValue = (move) => {
15132
- chooseItem && chooseItem(listData == null ? void 0 : listData[Math.round(-move / lineSpacing)], keyIndex);
15124
+ chooseItem && chooseItem(options2 == null ? void 0 : options2[Math.round(-move / lineSpacing)], keyIndex);
15133
15125
  };
15134
15126
  const touchStart = (event) => {
15135
15127
  touch.start(event);
@@ -15153,7 +15145,7 @@ const InternalPickerSlot = (props, ref) => {
15153
15145
  const moveTime = Date.now() - startTime;
15154
15146
  if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
15155
15147
  const distance = momentum(move, moveTime);
15156
- setMove(distance, "end", +swipeDuration);
15148
+ setMove(distance, "end", +duration);
15157
15149
  } else {
15158
15150
  setMove(move, "end");
15159
15151
  }
@@ -15161,9 +15153,9 @@ const InternalPickerSlot = (props, ref) => {
15161
15153
  touch.reset();
15162
15154
  }, 0);
15163
15155
  };
15164
- const momentum = (distance, duration) => {
15156
+ const momentum = (distance, duration2) => {
15165
15157
  let nDistance = distance;
15166
- const speed = Math.abs(nDistance / duration);
15158
+ const speed = Math.abs(nDistance / duration2);
15167
15159
  nDistance = speed / 3e-3 * (nDistance < 0 ? -1 : 1);
15168
15160
  return nDistance;
15169
15161
  };
@@ -15171,7 +15163,7 @@ const InternalPickerSlot = (props, ref) => {
15171
15163
  const value = val || defaultValue;
15172
15164
  let index = -1;
15173
15165
  if (value) {
15174
- listData.some((item, idx) => {
15166
+ options2.some((item, idx) => {
15175
15167
  if (item.value === value) {
15176
15168
  index = idx;
15177
15169
  return true;
@@ -15179,7 +15171,7 @@ const InternalPickerSlot = (props, ref) => {
15179
15171
  return false;
15180
15172
  });
15181
15173
  } else {
15182
- listData.forEach((item, i) => {
15174
+ options2.forEach((item, i) => {
15183
15175
  if (item.value === defaultValue) {
15184
15176
  index = i;
15185
15177
  }
@@ -15222,7 +15214,7 @@ const InternalPickerSlot = (props, ref) => {
15222
15214
  return () => {
15223
15215
  clearTimeout(timer);
15224
15216
  };
15225
- }, [listData]);
15217
+ }, [options2]);
15226
15218
  useImperativeHandle(ref, () => ({
15227
15219
  stopMomentum,
15228
15220
  moving: moving.current
@@ -15231,7 +15223,7 @@ const InternalPickerSlot = (props, ref) => {
15231
15223
  "div",
15232
15224
  {
15233
15225
  className: "nut-picker-list",
15234
- ref: pickerSlotRef,
15226
+ ref: PickerPanelRef,
15235
15227
  onTouchStart: touchStart,
15236
15228
  onTouchMove: touchMove,
15237
15229
  onTouchEnd: touchEnd,
@@ -15244,7 +15236,7 @@ const InternalPickerSlot = (props, ref) => {
15244
15236
  style: threeDimensional ? touchRollerStyle() : touchTileStyle(),
15245
15237
  onTransitionEnd: stopMomentum,
15246
15238
  children: [
15247
- threeDimensional && listData.map((item, index) => {
15239
+ threeDimensional && options2.map((item, index) => {
15248
15240
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15249
15241
  "div",
15250
15242
  {
@@ -15257,7 +15249,7 @@ const InternalPickerSlot = (props, ref) => {
15257
15249
  item.value ? item.value : index
15258
15250
  );
15259
15251
  }),
15260
- !threeDimensional && listData.map((item, index) => {
15252
+ !threeDimensional && options2.map((item, index) => {
15261
15253
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15262
15254
  "div",
15263
15255
  {
@@ -15276,8 +15268,8 @@ const InternalPickerSlot = (props, ref) => {
15276
15268
  }
15277
15269
  );
15278
15270
  };
15279
- const PickerSlot = React__default.forwardRef(InternalPickerSlot);
15280
- const PickerSlot$1 = PickerSlot;
15271
+ const PickerPanel = React__default.forwardRef(InternalPickerPanel);
15272
+ const PickerPanel$1 = PickerPanel;
15281
15273
  function useRefs() {
15282
15274
  const refs = React__default.useRef([]);
15283
15275
  const setRefs = React__default.useCallback(
@@ -15292,180 +15284,202 @@ function useRefs() {
15292
15284
  }, []);
15293
15285
  return [refs.current, setRefs, reset];
15294
15286
  }
15287
+ const defaultProps$X = {
15288
+ ...ComponentDefaults,
15289
+ visible: false,
15290
+ title: "",
15291
+ options: [],
15292
+ value: [],
15293
+ defaultValue: [],
15294
+ threeDimensional: true,
15295
+ duration: 1e3
15296
+ };
15295
15297
  const InternalPicker = (props, ref) => {
15296
15298
  const { locale } = useConfig();
15297
15299
  const {
15298
15300
  visible,
15299
15301
  title,
15300
- listData = [],
15301
- defaultValueData,
15302
- onConfirm,
15303
- onClose,
15304
- onCloseUpdate,
15305
- onChange,
15302
+ options: options2 = [],
15303
+ defaultValue = [],
15306
15304
  className,
15307
15305
  style,
15308
15306
  threeDimensional,
15309
- swipeDuration,
15307
+ duration,
15308
+ onConfirm,
15309
+ onClose,
15310
+ afterClose,
15311
+ onChange,
15310
15312
  ...rest
15311
- } = props;
15312
- const [chooseValueData, setchooseValueData] = useState([]);
15313
- const [columnIndex, setcolumnIndex] = useState(0);
15313
+ } = { ...defaultProps$X, ...props };
15314
+ const classPrefix2 = "nut-picker";
15315
+ const classes = classNames(classPrefix2, className);
15316
+ const [selectedValue, setSelectedValue] = usePropsValue({
15317
+ value: props.value,
15318
+ defaultValue: [...defaultValue],
15319
+ finalValue: [...defaultValue],
15320
+ onChange: (val) => {
15321
+ var _a2;
15322
+ (_a2 = props.onConfirm) == null ? void 0 : _a2.call(props, setSelectedOptions(), val);
15323
+ }
15324
+ });
15325
+ const [columnIndex, setColumnIndex] = useState(0);
15314
15326
  const pickerRef = useRef(null);
15315
15327
  const [refs, setRefs] = useRefs();
15316
15328
  const [columnsList, setColumnsList] = useState([]);
15317
- const b = cn("picker");
15318
15329
  const isConfirmEvent = useRef(false);
15319
- useEffect(() => {
15320
- if (defaultValueData && defaultValueData.length !== 0 && defaultValueData.toString() !== chooseValueData.toString()) {
15321
- const data = [...defaultValueData];
15322
- setchooseValueData(data);
15323
- setColumnsList(normalListData());
15330
+ const formatCascade = (columns, values) => {
15331
+ const formatted = [];
15332
+ let columnOptions = {
15333
+ text: "",
15334
+ value: "",
15335
+ children: columns
15336
+ };
15337
+ let columnIndex2 = 0;
15338
+ while (columnOptions && columnOptions.children) {
15339
+ const options22 = columnOptions.children;
15340
+ const value = values[columnIndex2];
15341
+ let index = options22.findIndex(
15342
+ (columnItem) => columnItem.value === value
15343
+ );
15344
+ if (index === -1)
15345
+ index = 0;
15346
+ columnOptions = columnOptions.children[index];
15347
+ columnIndex2++;
15348
+ formatted.push(options22);
15324
15349
  }
15325
- }, [defaultValueData]);
15326
- useEffect(() => {
15327
- onChange && onChange(columnIndex, chooseValueData, selectedOptions());
15328
- if (isConfirmEvent.current) {
15329
- isConfirmEvent.current = false;
15330
- onConfirm && onConfirm(chooseValueData, selectedOptions());
15350
+ return formatted;
15351
+ };
15352
+ const columnsType = () => {
15353
+ const firstColumn = options2[0];
15354
+ if (firstColumn) {
15355
+ if (Array.isArray(firstColumn)) {
15356
+ return "multiple";
15357
+ }
15358
+ if ("children" in firstColumn) {
15359
+ return "cascade";
15360
+ }
15331
15361
  }
15332
- }, [chooseValueData]);
15333
- useEffect(() => {
15334
- init();
15335
- }, [listData]);
15336
- const closeActionSheet = () => {
15337
- onClose && onClose(chooseValueData, selectedOptions());
15338
- onCloseUpdate && onCloseUpdate(chooseValueData, selectedOptions(), pickerRef);
15362
+ return "single";
15339
15363
  };
15340
- const confirm2 = () => {
15341
- let movings = false;
15342
- refs.forEach((_ref) => {
15343
- if (_ref.moving)
15344
- movings = true;
15345
- _ref.stopMomentum();
15364
+ const normalListData = () => {
15365
+ const type4 = columnsType();
15366
+ switch (type4) {
15367
+ case "multiple":
15368
+ return options2;
15369
+ case "cascade":
15370
+ return formatCascade(options2, selectedValue);
15371
+ default:
15372
+ return [options2];
15373
+ }
15374
+ };
15375
+ const init = () => {
15376
+ const normalData = normalListData();
15377
+ setColumnsList(normalData);
15378
+ const data = [];
15379
+ normalData.length > 0 && normalData.map((item) => {
15380
+ item[0] && data.push(item[0].value);
15381
+ return item;
15346
15382
  });
15347
- if (movings) {
15348
- isConfirmEvent.current = true;
15349
- } else {
15350
- onConfirm && onConfirm(chooseValueData, selectedOptions());
15383
+ if (!defaultValue.length && selectedValue.length === 0) {
15384
+ setSelectedValue([...data]);
15351
15385
  }
15352
- onClose && onClose(chooseValueData, selectedOptions());
15353
- setTimeout(() => {
15354
- isConfirmEvent.current = false;
15355
- }, 0);
15356
15386
  };
15357
- const selectedOptions = () => {
15358
- const optins = [];
15359
- columnsList.map((column, index) => {
15360
- let currOptions = [];
15361
- currOptions = column.filter(
15362
- (item) => item.value === chooseValueData[index]
15387
+ useEffect(() => {
15388
+ if (!visible) {
15389
+ return;
15390
+ }
15391
+ init();
15392
+ }, [options2, visible]);
15393
+ const setSelectedOptions = () => {
15394
+ const options22 = [];
15395
+ let currOptions = [];
15396
+ columnsList.forEach((columnOptions, index) => {
15397
+ currOptions = columnOptions.filter(
15398
+ (item) => item.value === selectedValue[index]
15363
15399
  );
15364
15400
  if (currOptions[0]) {
15365
- optins.push(currOptions[0]);
15401
+ options22.push(currOptions[0]);
15366
15402
  } else {
15367
- column[0] && optins.push(column[0]);
15403
+ columnOptions[0] && options22.push(columnOptions[0]);
15368
15404
  }
15369
- return column;
15370
15405
  });
15371
- return optins;
15406
+ return options22;
15372
15407
  };
15373
- const chooseItem = (option, columnIndex2) => {
15374
- if (option && Object.keys(option).length) {
15375
- if (chooseValueData[columnIndex2] !== option.value) {
15408
+ useEffect(() => {
15409
+ if (!visible) {
15410
+ return;
15411
+ }
15412
+ onChange && onChange(setSelectedOptions(), selectedValue, columnIndex);
15413
+ if (isConfirmEvent.current) {
15414
+ isConfirmEvent.current = false;
15415
+ onConfirm && onConfirm(setSelectedOptions(), selectedValue);
15416
+ }
15417
+ }, [selectedValue, columnsList, visible]);
15418
+ const chooseItem = (columnOptions, columnIndex2) => {
15419
+ var _a2, _b;
15420
+ if (columnOptions && Object.keys(columnOptions).length) {
15421
+ if (selectedValue[columnIndex2] !== columnOptions.value) {
15376
15422
  if (columnsType() === "cascade") {
15377
- chooseValueData[columnIndex2] = option.value ? option.value : "";
15378
- setchooseValueData([...chooseValueData]);
15379
- let index = columnIndex2;
15380
- let cursor = option;
15381
- while (cursor && cursor.children && cursor.children[0]) {
15382
- chooseValueData[index + 1] = cursor.children[0].value;
15383
- setchooseValueData([...chooseValueData]);
15384
- index++;
15385
- const cc = cursor.children[0];
15386
- cursor = cc;
15423
+ selectedValue[columnIndex2] = columnOptions.value || "";
15424
+ setSelectedValue([...selectedValue]);
15425
+ while ((_a2 = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _a2[0]) {
15426
+ selectedValue[columnIndex2 + 1] = columnOptions.children[0].value;
15427
+ setSelectedValue([...selectedValue]);
15428
+ columnIndex2++;
15429
+ columnOptions = columnOptions.children[0];
15387
15430
  }
15388
- if (cursor && cursor.children) {
15389
- chooseValueData[index + 1] = "";
15390
- setchooseValueData([...chooseValueData]);
15431
+ if ((_b = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _b.length) {
15432
+ selectedValue[columnIndex2 + 1] = "";
15433
+ setSelectedValue([...selectedValue]);
15391
15434
  }
15392
15435
  setColumnsList(normalListData());
15393
15436
  } else {
15394
- setchooseValueData((data) => {
15437
+ setSelectedValue((data) => {
15395
15438
  const cdata = [...data];
15396
15439
  cdata[columnIndex2] = Object.prototype.hasOwnProperty.call(
15397
- option,
15440
+ columnOptions,
15398
15441
  "value"
15399
- ) ? option.value : "";
15442
+ ) ? columnOptions.value : "";
15400
15443
  return cdata;
15401
15444
  });
15402
15445
  }
15403
- setcolumnIndex(columnIndex2);
15446
+ setColumnIndex(columnIndex2);
15404
15447
  }
15405
15448
  }
15406
15449
  };
15407
- const normalListData = () => {
15408
- const type4 = columnsType();
15409
- switch (type4) {
15410
- case "multiple":
15411
- return listData;
15412
- case "cascade":
15413
- return formatCascade(listData, chooseValueData);
15414
- default:
15415
- return [listData];
15416
- }
15417
- };
15418
- const columnsType = () => {
15419
- const firstColumn = listData[0];
15420
- if (firstColumn) {
15421
- if (Array.isArray(firstColumn)) {
15422
- return "multiple";
15423
- }
15424
- if ("children" in firstColumn) {
15425
- return "cascade";
15426
- }
15427
- }
15428
- return "single";
15429
- };
15430
- const formatCascade = (columns, defaultValues) => {
15431
- const formatted = [];
15432
- let cursor = {
15433
- text: "",
15434
- value: "",
15435
- children: columns
15436
- };
15437
- let columnIndex2 = 0;
15438
- while (cursor && cursor.children) {
15439
- const options2 = cursor.children;
15440
- const value = defaultValues[columnIndex2];
15441
- let index = options2.findIndex(
15442
- (columnItem) => columnItem.value === value
15443
- );
15444
- if (index === -1)
15445
- index = 0;
15446
- cursor = cursor.children[index];
15447
- columnIndex2++;
15448
- formatted.push(options2);
15449
- }
15450
- return formatted;
15451
- };
15452
- const init = () => {
15453
- const data = [];
15454
- const normalData = normalListData();
15455
- setColumnsList(normalData);
15456
- normalData.length > 0 && normalData.map((item) => {
15457
- item[0] && data.push(item[0].value);
15458
- return item;
15450
+ const confirm2 = () => {
15451
+ let movings = false;
15452
+ refs.forEach((ref2) => {
15453
+ if (ref2.moving)
15454
+ movings = true;
15455
+ ref2.stopMomentum();
15459
15456
  });
15460
- if (!defaultValueData && chooseValueData.length === 0) {
15461
- setchooseValueData([...data]);
15457
+ if (movings) {
15458
+ isConfirmEvent.current = true;
15459
+ } else {
15460
+ onConfirm && onConfirm(setSelectedOptions(), selectedValue);
15461
+ closePicker();
15462
15462
  }
15463
+ setTimeout(() => {
15464
+ isConfirmEvent.current = false;
15465
+ }, 0);
15466
+ };
15467
+ const closePicker = () => {
15468
+ onClose && onClose(setSelectedOptions(), selectedValue);
15469
+ afterClose && afterClose(setSelectedOptions(), selectedValue, pickerRef);
15463
15470
  };
15464
- const renderToolbar = () => {
15465
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: b("control"), children: [
15466
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: b("cancel-btn"), onClick: () => closeActionSheet(), children: locale.cancel }),
15467
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("title"), children: title || "" }),
15468
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: b("confirm-btn"), onClick: confirm2, children: locale.confirm })
15471
+ const renderTitleBar = () => {
15472
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__control`, children: [
15473
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
15474
+ "span",
15475
+ {
15476
+ className: `${classPrefix2}__cancel-btn`,
15477
+ onClick: () => closePicker(),
15478
+ children: locale.cancel
15479
+ }
15480
+ ),
15481
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__title`, children: title || "" }),
15482
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `${classPrefix2}__confirm-btn`, onClick: confirm2, children: locale.confirm })
15469
15483
  ] });
15470
15484
  };
15471
15485
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -15474,20 +15488,20 @@ const InternalPicker = (props, ref) => {
15474
15488
  visible,
15475
15489
  position: "bottom",
15476
15490
  onClose: () => {
15477
- closeActionSheet();
15491
+ closePicker();
15478
15492
  },
15479
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${b()} ${className || ""}`, style, ...rest, children: [
15480
- renderToolbar(),
15481
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("panel"), ref: pickerRef, children: columnsList == null ? void 0 : columnsList.map((item, index) => {
15493
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes, style, ...rest, children: [
15494
+ renderTitleBar(),
15495
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__panel`, ref: pickerRef, children: columnsList == null ? void 0 : columnsList.map((item, index) => {
15482
15496
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15483
- PickerSlot$1,
15497
+ PickerPanel$1,
15484
15498
  {
15485
15499
  ref: setRefs(index),
15486
- defaultValue: chooseValueData == null ? void 0 : chooseValueData[index],
15487
- listData: item,
15500
+ defaultValue: selectedValue == null ? void 0 : selectedValue[index],
15501
+ options: item,
15488
15502
  threeDimensional,
15489
15503
  chooseItem: (value, index2) => chooseItem(value, index2),
15490
- swipeDuration,
15504
+ duration,
15491
15505
  keyIndex: index
15492
15506
  },
15493
15507
  index
@@ -15538,7 +15552,7 @@ const DatePicker = (props) => {
15538
15552
  const [show, setShow] = useState(false);
15539
15553
  const [currentDate, setCurrentDate] = useState(modelValue);
15540
15554
  const [defaultValue, setDefaultValue] = useState([]);
15541
- const [listData, setListData] = useState([]);
15555
+ const [options2, setListData] = useState([]);
15542
15556
  const pickerRef = useRef(null);
15543
15557
  const isDate = (val) => {
15544
15558
  return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
@@ -15656,7 +15670,7 @@ const DatePicker = (props) => {
15656
15670
  }
15657
15671
  return result;
15658
15672
  };
15659
- const updateChooseValueCustmer = (index, selectedValue, cacheValueData) => {
15673
+ const updateChooseValueCustmer = (cacheValueData, selectedValue, index) => {
15660
15674
  if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
15661
15675
  type4.toLocaleLowerCase()
15662
15676
  )) {
@@ -15695,7 +15709,7 @@ const DatePicker = (props) => {
15695
15709
  const isEqual2 = (currentDate == null ? void 0 : currentDate.getTime()) === (date4 == null ? void 0 : date4.getTime());
15696
15710
  date4 && isDate(date4) && !isEqual2 && setCurrentDate(formatValue(date4));
15697
15711
  }
15698
- props.onChange && props.onChange(index, selectedValue, cacheValueData);
15712
+ props.onChange && props.onChange(cacheValueData, selectedValue, index);
15699
15713
  };
15700
15714
  const padZero = (num, targetLength = 2) => {
15701
15715
  let str = `${num}`;
@@ -15791,16 +15805,16 @@ const DatePicker = (props) => {
15791
15805
  className: `nut-datepicker ${className || ""}`,
15792
15806
  style,
15793
15807
  ...rest,
15794
- children: listData.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
15808
+ children: options2.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
15795
15809
  Picker$1,
15796
15810
  {
15797
15811
  title,
15798
15812
  visible: show,
15799
- listData,
15813
+ options: options2,
15800
15814
  onClose: onCloseDatePicker,
15801
- defaultValueData: defaultValue,
15802
- onConfirm: (values, options2) => onConfirmDatePicker && onConfirmDatePicker(values, options2),
15803
- onChange: (index, value, list) => updateChooseValueCustmer(index, value, list),
15815
+ defaultValue,
15816
+ onConfirm: (options22, values) => onConfirmDatePicker && onConfirmDatePicker(options22, values),
15817
+ onChange: (list, value, index) => updateChooseValueCustmer(list, value, index),
15804
15818
  threeDimensional,
15805
15819
  ref: pickerRef
15806
15820
  }
@@ -19750,144 +19764,120 @@ const Switch = (props) => {
19750
19764
  Switch.defaultProps = defaultProps$H;
19751
19765
  Switch.displayName = "NutSwitch";
19752
19766
  const defaultProps$G = {
19767
+ ...ComponentDefaults,
19753
19768
  defaultValue: "",
19754
- textAlign: "left",
19755
- limitshow: false,
19756
- maxlength: "",
19757
- rows: "",
19769
+ showCount: false,
19770
+ rows: 2,
19771
+ maxLength: 140,
19758
19772
  placeholder: "",
19759
- readonly: false,
19773
+ readOnly: false,
19760
19774
  disabled: false,
19761
- autosize: false
19775
+ autoSize: false
19762
19776
  };
19763
19777
  const TextArea = (props) => {
19764
19778
  const { locale } = useConfig();
19765
19779
  const {
19766
19780
  className,
19781
+ value,
19767
19782
  defaultValue,
19768
- textAlign,
19769
- limitshow,
19770
- maxlength,
19783
+ showCount,
19784
+ maxLength,
19771
19785
  rows,
19772
19786
  placeholder,
19773
- readonly,
19787
+ readOnly,
19774
19788
  disabled,
19775
- autosize,
19789
+ autoSize,
19776
19790
  style,
19777
19791
  onChange,
19778
19792
  onBlur,
19779
- onFocus
19793
+ onFocus,
19794
+ ...rest
19780
19795
  } = { ...defaultProps$G, ...props };
19781
- const textareaBem = cn("textarea");
19782
- const [inputValue, SetInputValue] = useState("");
19796
+ const classPrefix2 = "nut-textarea";
19783
19797
  const textareaRef = useRef(null);
19784
- const compositingRef = useRef(false);
19785
- useEffect(() => {
19786
- let initValue = defaultValue;
19787
- if (initValue && maxlength && [...initValue].length > Number(maxlength)) {
19788
- initValue = initValue.substring(0, Number(maxlength));
19798
+ const compositionRef = useRef(false);
19799
+ const format2 = (value2) => {
19800
+ if (maxLength !== void 0 && value2.length > maxLength) {
19801
+ return value2.substring(0, maxLength);
19789
19802
  }
19790
- SetInputValue(initValue);
19791
- if (autosize) {
19792
- setTimeout(() => {
19793
- setContentHeight();
19794
- });
19795
- }
19796
- }, [defaultValue, autosize]);
19803
+ return value2;
19804
+ };
19805
+ const [inputValue, setInputValue] = usePropsValue({
19806
+ value,
19807
+ defaultValue,
19808
+ finalValue: format2(defaultValue),
19809
+ onChange
19810
+ });
19797
19811
  useEffect(() => {
19798
- if (inputValue) {
19799
- if (autosize) {
19800
- setContentHeight();
19801
- }
19812
+ if (autoSize) {
19813
+ setContentHeight();
19802
19814
  }
19803
- }, [inputValue]);
19815
+ }, [autoSize, defaultValue, inputValue]);
19804
19816
  const setContentHeight = () => {
19805
19817
  const textarea = textareaRef.current;
19806
19818
  if (textarea) {
19807
19819
  textarea.style.height = "auto";
19808
- let height = textarea == null ? void 0 : textarea.scrollHeight;
19809
- if (typeof autosize === "object") {
19810
- const { maxHeight, minHeight } = autosize;
19811
- if (maxHeight !== void 0) {
19812
- height = Math.min(height, maxHeight);
19813
- }
19814
- if (minHeight !== void 0) {
19815
- height = Math.max(height, minHeight);
19816
- }
19817
- }
19820
+ const height = textarea == null ? void 0 : textarea.scrollHeight;
19818
19821
  if (height) {
19819
19822
  textarea.style.height = `${height}px`;
19820
19823
  }
19821
19824
  }
19822
19825
  };
19823
- const textChange = (event) => {
19826
+ const handleChange = (event) => {
19824
19827
  const text = event.target;
19825
- if (maxlength && [...text.value].length > Number(maxlength) && !compositingRef.current) {
19826
- text.value = text.value.substring(0, Number(maxlength));
19827
- }
19828
- SetInputValue(text.value);
19829
- onChange && onChange(text.value, event);
19828
+ const value2 = compositionRef.current ? text.value : format2(text.value);
19829
+ setInputValue(value2);
19830
19830
  };
19831
- const textFocus = (event) => {
19831
+ const handleFocus = (event) => {
19832
19832
  if (disabled)
19833
19833
  return;
19834
- if (readonly)
19834
+ if (readOnly)
19835
19835
  return;
19836
19836
  onFocus && onFocus(event);
19837
19837
  };
19838
- const textBlur = (event) => {
19838
+ const handleBlur = (event) => {
19839
19839
  if (disabled)
19840
19840
  return;
19841
- if (readonly)
19841
+ if (readOnly)
19842
19842
  return;
19843
- const text = event.target;
19844
- onChange && onChange(text.value, event);
19845
19843
  onBlur && onBlur(event);
19846
19844
  };
19847
- const startComposing = () => {
19848
- compositingRef.current = true;
19849
- };
19850
- const endComposing = () => {
19851
- compositingRef.current = false;
19852
- };
19853
19845
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
19854
19846
  "div",
19855
19847
  {
19856
- className: `${textareaBem()} ${disabled ? textareaBem("disabled") : ""} ${className || ""}`,
19848
+ className: classNames(classPrefix2, className, {
19849
+ [`${classPrefix2}__disabled`]: disabled
19850
+ }),
19857
19851
  children: [
19858
19852
  /* @__PURE__ */ jsxRuntimeExports.jsx(
19859
19853
  "textarea",
19860
19854
  {
19861
19855
  ref: textareaRef,
19862
- className: textareaBem("textarea"),
19863
- style: {
19864
- textAlign,
19865
- ...style
19866
- },
19856
+ className: `${classPrefix2}__textarea`,
19857
+ style,
19867
19858
  disabled,
19868
- readOnly: readonly,
19859
+ readOnly,
19869
19860
  value: inputValue,
19870
- onChange: (e) => {
19871
- textChange(e);
19872
- },
19873
- onBlur: (e) => {
19874
- textBlur(e);
19861
+ onChange: (e) => handleChange(e),
19862
+ onBlur: (e) => handleBlur(e),
19863
+ onFocus: (e) => handleFocus(e),
19864
+ onCompositionEnd: () => {
19865
+ compositionRef.current = false;
19875
19866
  },
19876
- onFocus: (e) => {
19877
- textFocus(e);
19867
+ onCompositionStart: () => {
19868
+ compositionRef.current = true;
19878
19869
  },
19879
- onCompositionEnd: (e) => endComposing(),
19880
- onCompositionStart: (e) => startComposing(),
19881
19870
  rows,
19882
- maxLength: maxlength < 0 ? 0 : maxlength,
19883
- placeholder: placeholder || locale.placeholder
19871
+ maxLength: maxLength === -1 ? void 0 : maxLength,
19872
+ placeholder: placeholder || locale.placeholder,
19873
+ ...rest
19884
19874
  }
19885
19875
  ),
19886
- limitshow ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: textareaBem("limit"), children: [
19887
- [...inputValue].length,
19876
+ showCount && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__limit`, children: [
19877
+ inputValue.length,
19888
19878
  "/",
19889
- maxlength < 0 ? 0 : maxlength
19890
- ] }) : null
19879
+ maxLength < 0 ? 0 : maxLength
19880
+ ] })
19891
19881
  ]
19892
19882
  }
19893
19883
  );
@@ -25070,13 +25060,11 @@ Steps.defaultProps = defaultProps$9;
25070
25060
  Steps.displayName = "NutSteps";
25071
25061
  const defaultProps$8 = {
25072
25062
  ...ComponentDefaults,
25073
- className: "",
25074
- style: {},
25075
25063
  columns: [],
25076
25064
  data: [],
25077
25065
  bordered: true,
25078
25066
  striped: false,
25079
- noData: "无数据",
25067
+ noData: "",
25080
25068
  sorterIcon: null,
25081
25069
  showHeader: true
25082
25070
  };
@@ -25093,9 +25081,9 @@ const Table = (props) => {
25093
25081
  summary,
25094
25082
  striped,
25095
25083
  noData,
25096
- onSorter,
25097
25084
  sorterIcon,
25098
25085
  showHeader,
25086
+ onSort,
25099
25087
  ...rest
25100
25088
  } = {
25101
25089
  ...defaultProps$8,
@@ -25107,12 +25095,13 @@ const Table = (props) => {
25107
25095
  setCurData(data);
25108
25096
  }
25109
25097
  }, [data]);
25110
- const b = cn("table");
25111
- const classes = classNames({});
25112
- const cls = classNames(b(), classes, className);
25098
+ const classPrefix2 = "nut-table";
25099
+ const headerClassPrefix = `${classPrefix2}__main__head__tr`;
25100
+ const bodyClassPrefix = `${classPrefix2}__main__body__tr`;
25101
+ const cls = classNames(classPrefix2, className);
25113
25102
  const handleSorterClick = (item) => {
25114
25103
  if (item.sorter) {
25115
- onSorter && onSorter(item, curData);
25104
+ onSort && onSort(item, curData);
25116
25105
  if (typeof item.sorter === "function") {
25117
25106
  setCurData(curData.sort(item.sorter));
25118
25107
  } else {
@@ -25122,8 +25111,8 @@ const Table = (props) => {
25122
25111
  };
25123
25112
  const cellClasses = (item) => {
25124
25113
  return {
25125
- "nut-table__main__head__tr--border": props.bordered,
25126
- [`nut-table__main__head__tr--align${item.align ? item.align : ""}`]: true
25114
+ [`${headerClassPrefix}--border`]: props.bordered,
25115
+ [`${headerClassPrefix}--align${item.align ? item.align : ""}`]: true
25127
25116
  };
25128
25117
  };
25129
25118
  const getColumnItem = (value) => {
@@ -25134,10 +25123,7 @@ const Table = (props) => {
25134
25123
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
25135
25124
  "span",
25136
25125
  {
25137
- className: classNames(
25138
- "nut-table__main__head__tr__th",
25139
- cellClasses(item)
25140
- ),
25126
+ className: classNames(`${headerClassPrefix}__th`, cellClasses(item)),
25141
25127
  onClick: () => handleSorterClick(item),
25142
25128
  children: [
25143
25129
  item.title,
@@ -25160,7 +25146,7 @@ const Table = (props) => {
25160
25146
  "span",
25161
25147
  {
25162
25148
  className: classNames(
25163
- "nut-table__main__body__tr__td",
25149
+ `${bodyClassPrefix}__td`,
25164
25150
  cellClasses(getColumnItem(value))
25165
25151
  ),
25166
25152
  children: typeof item[value] === "function" || typeof render2 === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: render2 ? render2(item) : item[value](item) }) : item[value]
@@ -25171,24 +25157,23 @@ const Table = (props) => {
25171
25157
  };
25172
25158
  const renderBoyTrs = () => {
25173
25159
  return curData.map((item, index) => {
25174
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__main__body__tr", children: renderBodyTds(item) }, index);
25160
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: bodyClassPrefix, children: renderBodyTds(item) }, index);
25175
25161
  });
25176
25162
  };
25177
25163
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cls, style, ...rest, children: [
25178
25164
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
25179
25165
  "div",
25180
25166
  {
25181
- className: classNames("nut-table__main", {
25182
- "nut-table__main--striped": striped
25167
+ className: classNames(`${classPrefix2}__main`, {
25168
+ [`${classPrefix2}__main--striped`]: striped
25183
25169
  }),
25184
25170
  children: [
25185
- showHeader && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__main__head", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__main__head__tr", children: renderHeadCells() }) }),
25186
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__main__body", children: renderBoyTrs() })
25171
+ showHeader && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__main__head`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: headerClassPrefix, children: renderHeadCells() }) }),
25172
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__main__body`, children: renderBoyTrs() })
25187
25173
  ]
25188
25174
  }
25189
25175
  ),
25190
- summary && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__summary", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "nut-table__summary__text", children: summary }) }),
25191
- curData.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__nodata", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__nodata", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__nodata__text", children: noData }) }) })
25176
+ (summary || curData.length === 0) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__summary`, children: summary || noData })
25192
25177
  ] });
25193
25178
  };
25194
25179
  Table.defaultProps = defaultProps$8;