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

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.
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  return value;
10
10
  };
11
11
  /*!
12
- * @nutui/nutui-react v2.0.0-alpha.5 Wed May 10 2023 14:17:23 GMT+0800 (China Standard Time)
12
+ * @nutui/nutui-react v2.0.0-alpha.7 Fri May 12 2023 15:35:24 GMT+0800 (China Standard Time)
13
13
  * (c) 2023 @jdf2e.
14
14
  * Released under the MIT License.
15
15
  */
@@ -3251,7 +3251,7 @@ Check the top-level render call using <` + t + ">.");
3251
3251
  style: {}
3252
3252
  };
3253
3253
  const prefixCls = "nut-button";
3254
- const defaultProps$1r = {
3254
+ const defaultProps$1s = {
3255
3255
  ...ComponentDefaults,
3256
3256
  color: "",
3257
3257
  type: "default",
@@ -3283,7 +3283,7 @@ Check the top-level render call using <` + t + ">.");
3283
3283
  style,
3284
3284
  ...rest
3285
3285
  } = {
3286
- ...defaultProps$1r,
3286
+ ...defaultProps$1s,
3287
3287
  ...props
3288
3288
  };
3289
3289
  const getStyle = React.useCallback(() => {
@@ -3340,7 +3340,7 @@ Check the top-level render call using <` + t + ">.");
3340
3340
  }
3341
3341
  );
3342
3342
  Button.displayName = "NutButton";
3343
- const defaultProps$1q = {
3343
+ const defaultProps$1r = {
3344
3344
  ...ComponentDefaults,
3345
3345
  title: null,
3346
3346
  description: null,
@@ -3364,7 +3364,7 @@ Check the top-level render call using <` + t + ">.");
3364
3364
  style,
3365
3365
  ...rest
3366
3366
  } = {
3367
- ...defaultProps$1q,
3367
+ ...defaultProps$1r,
3368
3368
  ...props
3369
3369
  };
3370
3370
  const handleClick2 = (event) => {
@@ -3403,9 +3403,9 @@ Check the top-level render call using <` + t + ">.");
3403
3403
  }
3404
3404
  );
3405
3405
  };
3406
- Cell.defaultProps = defaultProps$1q;
3406
+ Cell.defaultProps = defaultProps$1r;
3407
3407
  Cell.displayName = "NutCell";
3408
- const defaultProps$1p = {
3408
+ const defaultProps$1q = {
3409
3409
  ...ComponentDefaults,
3410
3410
  title: "",
3411
3411
  description: "",
@@ -3414,7 +3414,7 @@ Check the top-level render call using <` + t + ">.");
3414
3414
  const classPrefix$f = "nut-cell-group";
3415
3415
  const CellGroup = (props) => {
3416
3416
  const { children, className, style, title, description, divider, ...rest } = {
3417
- ...defaultProps$1p,
3417
+ ...defaultProps$1q,
3418
3418
  ...props
3419
3419
  };
3420
3420
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classNames(classPrefix$f, className), ...rest, children: [
@@ -3429,7 +3429,7 @@ Check the top-level render call using <` + t + ">.");
3429
3429
  )
3430
3430
  ] });
3431
3431
  };
3432
- CellGroup.defaultProps = defaultProps$1p;
3432
+ CellGroup.defaultProps = defaultProps$1q;
3433
3433
  CellGroup.displayName = "NutCellGroup";
3434
3434
  var INFINITY = 1 / 0;
3435
3435
  var symbolTag = "[object Symbol]";
@@ -3844,7 +3844,7 @@ Check the top-level render call using <` + t + ">.");
3844
3844
  errorCanvasTips: "当前环境不支持Canvas"
3845
3845
  }
3846
3846
  };
3847
- const defaultProps$1o = {
3847
+ const defaultProps$1p = {
3848
3848
  locale: zhCN
3849
3849
  };
3850
3850
  const defaultConfigRef = {
@@ -3867,7 +3867,7 @@ Check the top-level render call using <` + t + ">.");
3867
3867
  return cssVars;
3868
3868
  }
3869
3869
  const ConfigProvider = (props) => {
3870
- const { children, ...config2 } = { ...defaultProps$1o, ...props };
3870
+ const { children, ...config2 } = { ...defaultProps$1p, ...props };
3871
3871
  const parentConfig = useConfig();
3872
3872
  const theme = config2.theme || {};
3873
3873
  const style = React.useMemo(
@@ -3885,12 +3885,12 @@ Check the top-level render call using <` + t + ">.");
3885
3885
  }
3886
3886
  );
3887
3887
  };
3888
- ConfigProvider.defaultProps = defaultProps$1o;
3888
+ ConfigProvider.defaultProps = defaultProps$1p;
3889
3889
  ConfigProvider.displayName = "NutConfigProvider";
3890
3890
  const pxCheck = (value) => {
3891
3891
  return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
3892
3892
  };
3893
- const defaultProps$1n = {
3893
+ const defaultProps$1o = {
3894
3894
  ...ComponentDefaults,
3895
3895
  fit: "fill",
3896
3896
  position: "center",
@@ -3919,21 +3919,19 @@ Check the top-level render call using <` + t + ">.");
3919
3919
  onClick,
3920
3920
  onLoad,
3921
3921
  onError
3922
- } = { ...defaultProps$1n, ...props };
3922
+ } = { ...defaultProps$1o, ...props };
3923
3923
  const [innerLoading, setInnerLoading] = React.useState(true);
3924
3924
  const [isError, setIsError] = React.useState(false);
3925
- const [_src, setSrc] = React.useState("");
3926
3925
  const imgRef = React.useRef(null);
3927
3926
  React.useEffect(() => {
3928
3927
  if (imgRef.current && imgRef.current.complete && imgRef.current.naturalHeight !== 0) {
3929
3928
  setInnerLoading(false);
3930
3929
  } else if (src) {
3931
- setSrc(src);
3932
- setIsError(false);
3933
3930
  setInnerLoading(true);
3934
3931
  }
3935
3932
  }, [src]);
3936
3933
  const handleLoad = () => {
3934
+ setIsError(false);
3937
3935
  setInnerLoading(false);
3938
3936
  onLoad && onLoad();
3939
3937
  };
@@ -4029,7 +4027,7 @@ Check the top-level render call using <` + t + ">.");
4029
4027
  ref: imgRef,
4030
4028
  className: "nut-img lazyload",
4031
4029
  style: imgStyle,
4032
- "data-src": _src,
4030
+ "data-src": src,
4033
4031
  alt,
4034
4032
  loading: "lazy",
4035
4033
  onLoad: handleLoad,
@@ -4041,7 +4039,7 @@ Check the top-level render call using <` + t + ">.");
4041
4039
  ref: imgRef,
4042
4040
  className: "nut-img",
4043
4041
  style: imgStyle,
4044
- src: _src,
4042
+ src,
4045
4043
  alt,
4046
4044
  onLoad: handleLoad,
4047
4045
  onError: handleError
@@ -4053,7 +4051,7 @@ Check the top-level render call using <` + t + ">.");
4053
4051
  }
4054
4052
  );
4055
4053
  };
4056
- Image$1.defaultProps = defaultProps$1n;
4054
+ Image$1.defaultProps = defaultProps$1o;
4057
4055
  Image$1.displayName = "NutImage";
4058
4056
  const defaultOverlayProps = {
4059
4057
  ...ComponentDefaults,
@@ -4138,7 +4136,7 @@ Check the top-level render call using <` + t + ">.");
4138
4136
  Overlay.defaultProps = defaultOverlayProps;
4139
4137
  Overlay.displayName = "NutOverlay";
4140
4138
  const DataContext$2 = React.createContext({});
4141
- const defaultProps$1m = {
4139
+ const defaultProps$1n = {
4142
4140
  ...ComponentDefaults,
4143
4141
  span: "24",
4144
4142
  offset: "0",
@@ -4146,7 +4144,7 @@ Check the top-level render call using <` + t + ">.");
4146
4144
  };
4147
4145
  const Col = (props) => {
4148
4146
  const { className, style, span, offset, children, onClick } = {
4149
- ...defaultProps$1m,
4147
+ ...defaultProps$1n,
4150
4148
  ...props
4151
4149
  };
4152
4150
  const [colName, setColName] = React.useState("");
@@ -4178,9 +4176,9 @@ Check the top-level render call using <` + t + ">.");
4178
4176
  }
4179
4177
  );
4180
4178
  };
4181
- Col.defaultProps = defaultProps$1m;
4179
+ Col.defaultProps = defaultProps$1n;
4182
4180
  Col.displayName = "NutCol";
4183
- const defaultProps$1l = {
4181
+ const defaultProps$1m = {
4184
4182
  ...ComponentDefaults,
4185
4183
  contentPosition: "center",
4186
4184
  direction: "horizontal"
@@ -4188,7 +4186,7 @@ Check the top-level render call using <` + t + ">.");
4188
4186
  const classPrefix$d = `nut-divider`;
4189
4187
  const Divider = (props) => {
4190
4188
  const { children, contentPosition, style, className, direction, ...rest } = {
4191
- ...defaultProps$1l,
4189
+ ...defaultProps$1m,
4192
4190
  ...props
4193
4191
  };
4194
4192
  const classes = direction === "horizontal" ? classNames({
@@ -4203,14 +4201,14 @@ Check the top-level render call using <` + t + ">.");
4203
4201
  });
4204
4202
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classes} ${className || ""}`, style, ...rest, children });
4205
4203
  };
4206
- Divider.defaultProps = defaultProps$1l;
4204
+ Divider.defaultProps = defaultProps$1m;
4207
4205
  Divider.displayName = "NutDivider";
4208
4206
  const gridContext = {
4209
4207
  onClick: (item, index) => {
4210
4208
  }
4211
4209
  };
4212
4210
  const GridContext = React.createContext(gridContext);
4213
- const defaultProps$1k = {
4211
+ const defaultProps$1l = {
4214
4212
  text: "",
4215
4213
  columns: 4,
4216
4214
  gap: 0,
@@ -4236,7 +4234,7 @@ Check the top-level render call using <` + t + ">.");
4236
4234
  onClick,
4237
4235
  ...rest
4238
4236
  } = {
4239
- ...defaultProps$1k,
4237
+ ...defaultProps$1l,
4240
4238
  ...props
4241
4239
  };
4242
4240
  const classPrefix2 = "nut-grid-item";
@@ -4297,9 +4295,9 @@ Check the top-level render call using <` + t + ">.");
4297
4295
  }
4298
4296
  );
4299
4297
  };
4300
- GridItem.defaultProps = defaultProps$1k;
4298
+ GridItem.defaultProps = defaultProps$1l;
4301
4299
  GridItem.displayName = "NutGridItem";
4302
- const defaultProps$1j = {
4300
+ const defaultProps$1k = {
4303
4301
  columns: 4,
4304
4302
  gap: 0,
4305
4303
  center: true,
@@ -4320,7 +4318,7 @@ Check the top-level render call using <` + t + ">.");
4320
4318
  className,
4321
4319
  onClick,
4322
4320
  ...rest
4323
- } = { ...defaultProps$1j, ...props };
4321
+ } = { ...defaultProps$1k, ...props };
4324
4322
  const childrenDom = React.Children.toArray(children);
4325
4323
  const classPrefix2 = "nut-grid";
4326
4324
  const rootClass = () => {
@@ -4350,18 +4348,18 @@ Check the top-level render call using <` + t + ">.");
4350
4348
  });
4351
4349
  }) }) });
4352
4350
  };
4353
- Grid.defaultProps = defaultProps$1j;
4351
+ Grid.defaultProps = defaultProps$1k;
4354
4352
  Grid.displayName = "NutGrid";
4355
4353
  Grid.Item = GridItem;
4356
- const defaultProps$1i = {};
4354
+ const defaultProps$1j = {};
4357
4355
  const Layout = (props) => {
4358
- ({ ...defaultProps$1i, ...props });
4356
+ ({ ...defaultProps$1j, ...props });
4359
4357
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-layout", children: "Layout" });
4360
4358
  };
4361
- Layout.defaultProps = defaultProps$1i;
4359
+ Layout.defaultProps = defaultProps$1j;
4362
4360
  Layout.displayName = "NutLayout";
4363
4361
  const classPrefix$c = "nut-row";
4364
- const defaultProps$1h = {
4362
+ const defaultProps$1i = {
4365
4363
  ...ComponentDefaults,
4366
4364
  type: "",
4367
4365
  justify: "start",
@@ -4381,7 +4379,7 @@ Check the top-level render call using <` + t + ">.");
4381
4379
  gutter,
4382
4380
  onClick
4383
4381
  } = {
4384
- ...defaultProps$1h,
4382
+ ...defaultProps$1i,
4385
4383
  ...props
4386
4384
  };
4387
4385
  const getClass = (prefix2, type22) => {
@@ -4413,7 +4411,7 @@ Check the top-level render call using <` + t + ">.");
4413
4411
  children
4414
4412
  ) });
4415
4413
  };
4416
- Row.defaultProps = defaultProps$1h;
4414
+ Row.defaultProps = defaultProps$1i;
4417
4415
  Row.displayName = "NutRow";
4418
4416
  const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
4419
4417
  const defaultRoot = canUseDom ? window : void 0;
@@ -4488,7 +4486,7 @@ Check the top-level render call using <` + t + ">.");
4488
4486
  stop2.current = true;
4489
4487
  };
4490
4488
  }
4491
- const defaultProps$1g = {
4489
+ const defaultProps$1h = {
4492
4490
  ...ComponentDefaults,
4493
4491
  position: "top",
4494
4492
  threshold: 0,
@@ -4506,7 +4504,7 @@ Check the top-level render call using <` + t + ">.");
4506
4504
  threshold,
4507
4505
  onChange,
4508
4506
  ...rest
4509
- } = { ...defaultProps$1g, ...props };
4507
+ } = { ...defaultProps$1h, ...props };
4510
4508
  const stickyRef = React.useRef(null);
4511
4509
  const rootRef = React.useRef(null);
4512
4510
  const [isFixed, setIsFixed] = React.useState(false);
@@ -4622,9 +4620,9 @@ Check the top-level render call using <` + t + ">.");
4622
4620
  }
4623
4621
  );
4624
4622
  };
4625
- Sticky.defaultProps = defaultProps$1g;
4623
+ Sticky.defaultProps = defaultProps$1h;
4626
4624
  Sticky.displayName = "NutSticky";
4627
- const defaultProps$1f = {
4625
+ const defaultProps$1g = {
4628
4626
  ...ComponentDefaults,
4629
4627
  target: "",
4630
4628
  threshold: 200,
@@ -4642,7 +4640,7 @@ Check the top-level render call using <` + t + ">.");
4642
4640
  style,
4643
4641
  onClick
4644
4642
  } = {
4645
- ...defaultProps$1f,
4643
+ ...defaultProps$1g,
4646
4644
  ...props
4647
4645
  };
4648
4646
  const classPrefix2 = "nut-backtop";
@@ -4740,7 +4738,7 @@ Check the top-level render call using <` + t + ">.");
4740
4738
  }
4741
4739
  );
4742
4740
  };
4743
- BackTop.defaultProps = defaultProps$1f;
4741
+ BackTop.defaultProps = defaultProps$1g;
4744
4742
  BackTop.displayName = "NutBackTop";
4745
4743
  function clamp$1(v, min, max) {
4746
4744
  return Math.max(min, Math.min(v, max));
@@ -9858,7 +9856,7 @@ Please add \`${key}Action\` when creating your handler.`);
9858
9856
  });
9859
9857
  const animated = host.animated;
9860
9858
  const elevatorContext = React.createContext({});
9861
- const defaultProps$1e = {
9859
+ const defaultProps$1f = {
9862
9860
  ...ComponentDefaults,
9863
9861
  height: "200px",
9864
9862
  floorKey: "title",
@@ -9882,7 +9880,7 @@ Please add \`${key}Action\` when creating your handler.`);
9882
9880
  children,
9883
9881
  ...rest
9884
9882
  } = {
9885
- ...defaultProps$1e,
9883
+ ...defaultProps$1f,
9886
9884
  ...props
9887
9885
  };
9888
9886
  const classPrefix2 = "nut-elevator";
@@ -10065,10 +10063,10 @@ Please add \`${key}Action\` when creating your handler.`);
10065
10063
  ) })
10066
10064
  ] });
10067
10065
  };
10068
- Elevator.defaultProps = defaultProps$1e;
10066
+ Elevator.defaultProps = defaultProps$1f;
10069
10067
  Elevator.displayName = "NutElevator";
10070
10068
  Elevator.Context = elevatorContext;
10071
- const defaultProps$1d = {
10069
+ const defaultProps$1e = {
10072
10070
  ...ComponentDefaults,
10073
10071
  activeText: "",
10074
10072
  inactiveText: "",
@@ -10096,7 +10094,7 @@ Please add \`${key}Action\` when creating your handler.`);
10096
10094
  content,
10097
10095
  ...rest
10098
10096
  } = {
10099
- ...defaultProps$1d,
10097
+ ...defaultProps$1e,
10100
10098
  ...props
10101
10099
  };
10102
10100
  const classPrefix2 = "nut-fixednav";
@@ -10155,9 +10153,9 @@ Please add \`${key}Action\` when creating your handler.`);
10155
10153
  }
10156
10154
  );
10157
10155
  };
10158
- FixedNav.defaultProps = defaultProps$1d;
10156
+ FixedNav.defaultProps = defaultProps$1e;
10159
10157
  FixedNav.displayName = "NutFixedNav";
10160
- const defaultProps$1c = {
10158
+ const defaultProps$1d = {
10161
10159
  ...ComponentDefaults,
10162
10160
  left: "",
10163
10161
  right: "",
@@ -10180,7 +10178,7 @@ Please add \`${key}Action\` when creating your handler.`);
10180
10178
  zIndex,
10181
10179
  onClickBack
10182
10180
  } = {
10183
- ...defaultProps$1c,
10181
+ ...defaultProps$1d,
10184
10182
  ...props
10185
10183
  };
10186
10184
  const classPrefix2 = "nut-navbar";
@@ -10224,7 +10222,7 @@ Please add \`${key}Action\` when creating your handler.`);
10224
10222
  const cls = classNames(classPrefix2, classes, className);
10225
10223
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: fixed && placeholder ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}--placeholder`, children: renderWrapper() }) : renderWrapper() });
10226
10224
  };
10227
- NavBar.defaultProps = defaultProps$1c;
10225
+ NavBar.defaultProps = defaultProps$1d;
10228
10226
  NavBar.displayName = "NutNavBar";
10229
10227
  function _extends$1() {
10230
10228
  _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
@@ -11967,7 +11965,7 @@ Please add \`${key}Action\` when creating your handler.`);
11967
11965
  onExited: propTypesExports.func
11968
11966
  }) : {};
11969
11967
  const CSSTransition$1 = CSSTransition;
11970
- const defaultProps$1b = {
11968
+ const defaultProps$1c = {
11971
11969
  ...ComponentDefaults,
11972
11970
  position: "center",
11973
11971
  transition: "",
@@ -12146,7 +12144,7 @@ Please add \`${key}Action\` when creating your handler.`);
12146
12144
  }, [position, transition]);
12147
12145
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: renderToContainer(portal, renderNode()) });
12148
12146
  };
12149
- Popup.defaultProps = defaultProps$1b;
12147
+ Popup.defaultProps = defaultProps$1c;
12150
12148
  Popup.displayName = "NutPopup";
12151
12149
  const handleClick = (e) => {
12152
12150
  e.stopPropagation();
@@ -12162,7 +12160,7 @@ Please add \`${key}Action\` when creating your handler.`);
12162
12160
  }
12163
12161
  };
12164
12162
  const OffsetContext = React.createContext(20);
12165
- const defaultProps$1a = {
12163
+ const defaultProps$1b = {
12166
12164
  showhead: false,
12167
12165
  position: "left",
12168
12166
  width: "80%"
@@ -12179,7 +12177,7 @@ Please add \`${key}Action\` when creating your handler.`);
12179
12177
  onClose,
12180
12178
  ...rest
12181
12179
  } = {
12182
- ...defaultProps$1a,
12180
+ ...defaultProps$1b,
12183
12181
  ...props
12184
12182
  };
12185
12183
  const offset = props.offset ? Number(props.offset) : 20;
@@ -12215,7 +12213,7 @@ Please add \`${key}Action\` when creating your handler.`);
12215
12213
  }
12216
12214
  );
12217
12215
  };
12218
- SideNavBar.defaultProps = defaultProps$1a;
12216
+ SideNavBar.defaultProps = defaultProps$1b;
12219
12217
  SideNavBar.displayName = "NutSideNavBar";
12220
12218
  const SideNavBarItem = (props) => {
12221
12219
  const { title, key, children, onClick, ...rest } = props;
@@ -12233,12 +12231,12 @@ Please add \`${key}Action\` when creating your handler.`);
12233
12231
  }
12234
12232
  );
12235
12233
  };
12236
- const defaultProps$19 = {
12234
+ const defaultProps$1a = {
12237
12235
  open: true
12238
12236
  };
12239
12237
  const SubSideNavBar = (props) => {
12240
12238
  const { title, key, children, onClick, open, ...rest } = {
12241
- ...defaultProps$19,
12239
+ ...defaultProps$1a,
12242
12240
  ...props
12243
12241
  };
12244
12242
  const offset = React.useContext(OffsetContext);
@@ -12312,7 +12310,7 @@ Please add \`${key}Action\` when creating your handler.`);
12312
12310
  }
12313
12311
  return [uncontrolled, handleUncontrolledChange];
12314
12312
  }
12315
- const defaultProps$18 = {
12313
+ const defaultProps$19 = {
12316
12314
  ...ComponentDefaults,
12317
12315
  value: "",
12318
12316
  dot: false,
@@ -12323,7 +12321,7 @@ Please add \`${key}Action\` when creating your handler.`);
12323
12321
  };
12324
12322
  const Badge = (props) => {
12325
12323
  const { className, style, value, max, children, dot, top, right, color } = {
12326
- ...defaultProps$18,
12324
+ ...defaultProps$19,
12327
12325
  ...props
12328
12326
  };
12329
12327
  const classPrefix2 = "nut-badge";
@@ -12354,9 +12352,9 @@ Please add \`${key}Action\` when creating your handler.`);
12354
12352
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: contentClasses, style: getStyle(), children: content() })
12355
12353
  ] });
12356
12354
  };
12357
- Badge.defaultProps = defaultProps$18;
12355
+ Badge.defaultProps = defaultProps$19;
12358
12356
  Badge.displayName = "NutBadge";
12359
- const defaultProps$17 = {
12357
+ const defaultProps$18 = {
12360
12358
  ...ComponentDefaults,
12361
12359
  title: "",
12362
12360
  icon: null,
@@ -12378,7 +12376,7 @@ Please add \`${key}Action\` when creating your handler.`);
12378
12376
  handleClick: handleClick2,
12379
12377
  ...rest
12380
12378
  } = {
12381
- ...defaultProps$17,
12379
+ ...defaultProps$18,
12382
12380
  ...props
12383
12381
  };
12384
12382
  const classPrefix2 = "nut-tabbar-item";
@@ -12405,7 +12403,7 @@ Please add \`${key}Action\` when creating your handler.`);
12405
12403
  }
12406
12404
  );
12407
12405
  };
12408
- const defaultProps$16 = {
12406
+ const defaultProps$17 = {
12409
12407
  ...ComponentDefaults,
12410
12408
  defaultValue: 0,
12411
12409
  fixed: false,
@@ -12428,7 +12426,7 @@ Please add \`${key}Action\` when creating your handler.`);
12428
12426
  style,
12429
12427
  onSwitch
12430
12428
  } = {
12431
- ...defaultProps$16,
12429
+ ...defaultProps$17,
12432
12430
  ...props
12433
12431
  };
12434
12432
  const classPrefix2 = "nut-tabbar";
@@ -12465,17 +12463,17 @@ Please add \`${key}Action\` when creating your handler.`);
12465
12463
  }
12466
12464
  );
12467
12465
  };
12468
- Tabbar.defaultProps = defaultProps$16;
12466
+ Tabbar.defaultProps = defaultProps$17;
12469
12467
  Tabbar.displayName = "NutTabbar";
12470
12468
  Tabbar.Item = TabbarItem;
12471
- const defaultProps$15 = {
12469
+ const defaultProps$16 = {
12472
12470
  title: "",
12473
12471
  value: "",
12474
12472
  disabled: false
12475
12473
  };
12476
12474
  const TabPane = (props) => {
12477
12475
  const { children, autoHeightClassName, className, disabled } = {
12478
- ...defaultProps$15,
12476
+ ...defaultProps$16,
12479
12477
  ...props
12480
12478
  };
12481
12479
  const classPrefix2 = "nut-tabpane";
@@ -12502,7 +12500,7 @@ Please add \`${key}Action\` when creating your handler.`);
12502
12500
  }
12503
12501
  }
12504
12502
  const requestAniFrame$1 = requestAniFrame();
12505
- const defaultProps$14 = {
12503
+ const defaultProps$15 = {
12506
12504
  ...ComponentDefaults,
12507
12505
  tabStyle: {},
12508
12506
  activeColor: "",
@@ -12528,7 +12526,7 @@ Please add \`${key}Action\` when creating your handler.`);
12528
12526
  autoHeight,
12529
12527
  ...rest
12530
12528
  } = {
12531
- ...defaultProps$14,
12529
+ ...defaultProps$15,
12532
12530
  ...props
12533
12531
  };
12534
12532
  const [value, setValue] = usePropsValue({
@@ -12589,6 +12587,18 @@ Please add \`${key}Action\` when creating your handler.`);
12589
12587
  return titles2;
12590
12588
  };
12591
12589
  const titles = React.useRef(getTitles());
12590
+ React.useEffect(() => {
12591
+ titles.current = getTitles();
12592
+ let current = "";
12593
+ titles.current.forEach((title2) => {
12594
+ if (title2.value === value) {
12595
+ current = value;
12596
+ }
12597
+ });
12598
+ if (current !== "") {
12599
+ setValue(current);
12600
+ }
12601
+ }, [children]);
12592
12602
  const classes = classNames(
12593
12603
  classPrefix$a,
12594
12604
  `${classPrefix$a}--${direction}`,
@@ -12683,7 +12693,7 @@ Please add \`${key}Action\` when creating your handler.`);
12683
12693
  }) }) })
12684
12694
  ] });
12685
12695
  };
12686
- Tabs.defaultProps = defaultProps$14;
12696
+ Tabs.defaultProps = defaultProps$15;
12687
12697
  Tabs.displayName = "NutTabs";
12688
12698
  Tabs.TabPane = TabPane;
12689
12699
  var classnameExports = {};
@@ -12806,7 +12816,7 @@ Please add \`${key}Action\` when creating your handler.`);
12806
12816
  }
12807
12817
  })(classname);
12808
12818
  const cn = classnameExports.withNaming({ n: "nut-", e: "__", m: "--", v: "-" });
12809
- const defaultProps$13 = {
12819
+ const defaultProps$14 = {
12810
12820
  type: "custom",
12811
12821
  existAddress: [],
12812
12822
  defaultIcon: null,
@@ -12828,7 +12838,7 @@ Please add \`${key}Action\` when creating your handler.`);
12828
12838
  onClose,
12829
12839
  onSwitchModule,
12830
12840
  ...rest
12831
- } = { ...defaultProps$13, ...props };
12841
+ } = { ...defaultProps$14, ...props };
12832
12842
  const b = cn("address");
12833
12843
  const selectedExist = (item) => {
12834
12844
  const copyExistAdd = existAddress;
@@ -12870,7 +12880,7 @@ Please add \`${key}Action\` when creating your handler.`);
12870
12880
  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 }) })
12871
12881
  ] });
12872
12882
  };
12873
- const defaultProps$12 = {
12883
+ const defaultProps$13 = {
12874
12884
  modelValue: [],
12875
12885
  type: "custom",
12876
12886
  province: [],
@@ -12895,7 +12905,7 @@ Please add \`${key}Action\` when creating your handler.`);
12895
12905
  onClose,
12896
12906
  ...rest
12897
12907
  } = {
12898
- ...defaultProps$12,
12908
+ ...defaultProps$13,
12899
12909
  ...props
12900
12910
  };
12901
12911
  const b = cn("address");
@@ -13064,28 +13074,28 @@ Please add \`${key}Action\` when creating your handler.`);
13064
13074
  nextAreaList(item);
13065
13075
  };
13066
13076
  React.useEffect(() => {
13067
- const { province: province2 } = { ...defaultProps$12, ...props };
13077
+ const { province: province2 } = { ...defaultProps$13, ...props };
13068
13078
  setRegionList({
13069
13079
  ...regionList,
13070
13080
  province: isCustom2() ? transformData(province2) : province2
13071
13081
  });
13072
13082
  }, [province]);
13073
13083
  React.useEffect(() => {
13074
- const { city: city2 } = { ...defaultProps$12, ...props };
13084
+ const { city: city2 } = { ...defaultProps$13, ...props };
13075
13085
  setRegionList({
13076
13086
  ...regionList,
13077
13087
  city: isCustom2() ? transformData(city2) : city2
13078
13088
  });
13079
13089
  }, [city]);
13080
13090
  React.useEffect(() => {
13081
- const { country: country2 } = { ...defaultProps$12, ...props };
13091
+ const { country: country2 } = { ...defaultProps$13, ...props };
13082
13092
  setRegionList({
13083
13093
  ...regionList,
13084
13094
  country: isCustom2() ? transformData(country2) : country2
13085
13095
  });
13086
13096
  }, [country]);
13087
13097
  React.useEffect(() => {
13088
- const { town: town2 } = { ...defaultProps$12, ...props };
13098
+ const { town: town2 } = { ...defaultProps$13, ...props };
13089
13099
  setRegionList({
13090
13100
  ...regionList,
13091
13101
  town: isCustom2() ? transformData(town2) : town2
@@ -13160,7 +13170,7 @@ Please add \`${key}Action\` when creating your handler.`);
13160
13170
  ) })
13161
13171
  ] });
13162
13172
  };
13163
- const defaultProps$11 = {
13173
+ const defaultProps$12 = {
13164
13174
  ...ComponentDefaults,
13165
13175
  modelValue: false,
13166
13176
  modelSelect: [],
@@ -13211,7 +13221,7 @@ Please add \`${key}Action\` when creating your handler.`);
13211
13221
  className,
13212
13222
  ...rest
13213
13223
  } = {
13214
- ...defaultProps$11,
13224
+ ...defaultProps$12,
13215
13225
  ...props
13216
13226
  };
13217
13227
  const b = cn("address");
@@ -13369,7 +13379,7 @@ Please add \`${key}Action\` when creating your handler.`);
13369
13379
  }
13370
13380
  ) });
13371
13381
  };
13372
- Address.defaultProps = defaultProps$11;
13382
+ Address.defaultProps = defaultProps$12;
13373
13383
  Address.displayName = "NutAddress";
13374
13384
  const Utils = {
13375
13385
  /**
@@ -13489,7 +13499,7 @@ Please add \`${key}Action\` when creating your handler.`);
13489
13499
  return false;
13490
13500
  }
13491
13501
  };
13492
- const defaultProps$10 = {
13502
+ const defaultProps$11 = {
13493
13503
  type: "one",
13494
13504
  isAutoBackFill: false,
13495
13505
  poppable: true,
@@ -13541,7 +13551,7 @@ Please add \`${key}Action\` when creating your handler.`);
13541
13551
  onUpdate,
13542
13552
  onSelected,
13543
13553
  onYearMonthChange
13544
- } = { ...defaultProps$10, ...props };
13554
+ } = { ...defaultProps$11, ...props };
13545
13555
  const weeks = locale.calendaritem.weekdays;
13546
13556
  const [yearMonthTitle, setYearMonthTitle] = React.useState("");
13547
13557
  const [monthsData, setMonthsData] = React.useState([]);
@@ -14137,9 +14147,9 @@ Please add \`${key}Action\` when creating your handler.`);
14137
14147
  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 }) }) : ""
14138
14148
  ] }) });
14139
14149
  });
14140
- CalendarItem.defaultProps = defaultProps$10;
14150
+ CalendarItem.defaultProps = defaultProps$11;
14141
14151
  CalendarItem.displayName = "NutCalendarItem";
14142
- const defaultProps$$ = {
14152
+ const defaultProps$10 = {
14143
14153
  type: "one",
14144
14154
  isAutoBackFill: false,
14145
14155
  poppable: true,
@@ -14194,7 +14204,7 @@ Please add \`${key}Action\` when creating your handler.`);
14194
14204
  onChoose,
14195
14205
  onSelected,
14196
14206
  onYearMonthChange
14197
- } = { ...defaultProps$$, ...props };
14207
+ } = { ...defaultProps$10, ...props };
14198
14208
  const calendarRef = React.useRef(null);
14199
14209
  const close = () => {
14200
14210
  onClose && onClose();
@@ -14264,9 +14274,9 @@ Please add \`${key}Action\` when creating your handler.`);
14264
14274
  }
14265
14275
  ) : renderItem() });
14266
14276
  });
14267
- Calendar.defaultProps = defaultProps$$;
14277
+ Calendar.defaultProps = defaultProps$10;
14268
14278
  Calendar.displayName = "NutCalendar";
14269
- const defaultProps$_ = {
14279
+ const defaultProps$$ = {
14270
14280
  data: {
14271
14281
  text: "",
14272
14282
  value: "",
@@ -14277,32 +14287,37 @@ Please add \`${key}Action\` when creating your handler.`);
14277
14287
  },
14278
14288
  activeColor: "",
14279
14289
  checked: false,
14280
- checkedIcon: "checklist",
14290
+ activeIcon: "checklist",
14281
14291
  chooseItem: () => {
14282
14292
  }
14283
14293
  };
14284
14294
  const InternalCascaderItem = (props, ref) => {
14285
- const { data, checked, checkedIcon, chooseItem, activeColor } = {
14286
- ...defaultProps$_,
14295
+ const { data, checked, activeIcon, chooseItem, activeColor } = {
14296
+ ...defaultProps$$,
14287
14297
  ...props
14288
14298
  };
14289
- const b = cn("cascader-item");
14299
+ const classPrefix2 = "nut-cascader-item";
14290
14300
  const classes = classNames(
14291
14301
  {
14292
14302
  active: checked,
14293
14303
  disabled: data.disabled
14294
14304
  },
14295
- b("")
14305
+ classPrefix2
14296
14306
  );
14297
14307
  const classesTitle = classNames({
14298
- [`${b("")}__title`]: true
14308
+ [`${classPrefix2}__title`]: true
14299
14309
  });
14300
14310
  const renderIcon = () => {
14301
14311
  if (checked) {
14302
- if (React.isValidElement(checkedIcon)) {
14303
- return checkedIcon;
14312
+ if (React.isValidElement(activeIcon)) {
14313
+ return activeIcon;
14304
14314
  }
14305
- return /* @__PURE__ */ jsxRuntimeExports.jsx(x$c, { className: `${checked ? b("icon-check") : ""}` });
14315
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
14316
+ x$c,
14317
+ {
14318
+ className: `${checked ? `${classPrefix2}__icon-check` : ""}`
14319
+ }
14320
+ );
14306
14321
  }
14307
14322
  return null;
14308
14323
  };
@@ -14322,7 +14337,7 @@ Please add \`${key}Action\` when creating your handler.`);
14322
14337
  );
14323
14338
  };
14324
14339
  const CascaderItem = React.forwardRef(InternalCascaderItem);
14325
- CascaderItem.defaultProps = defaultProps$_;
14340
+ CascaderItem.defaultProps = defaultProps$$;
14326
14341
  CascaderItem.displayName = "NutCascaderItem";
14327
14342
  const formatTree = (tree, parent, config2) => tree.map((node) => {
14328
14343
  const {
@@ -14460,26 +14475,22 @@ Please add \`${key}Action\` when creating your handler.`);
14460
14475
  }
14461
14476
  }
14462
14477
  const Tree$1 = Tree;
14463
- const defaultProps$Z = {
14464
- className: "",
14465
- style: {},
14478
+ const defaultProps$_ = {
14479
+ ...ComponentDefaults,
14466
14480
  activeColor: "",
14467
- checkedIcon: "checklist",
14468
- tabsColor: "",
14469
- poppable: true,
14481
+ activeIcon: "checklist",
14482
+ popup: true,
14470
14483
  visible: false,
14471
14484
  options: [],
14472
14485
  value: [],
14473
14486
  title: "",
14474
- textKey: "text",
14475
- valueKey: "value",
14476
- childrenKey: "children",
14477
- convertConfig: {},
14487
+ optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" },
14488
+ format: {},
14478
14489
  closeable: false,
14479
14490
  closeIconPosition: "top-right",
14480
14491
  closeIcon: "close",
14481
14492
  lazy: false,
14482
- lazyLoad: () => {
14493
+ onLoad: () => {
14483
14494
  },
14484
14495
  onClose: () => {
14485
14496
  },
@@ -14493,28 +14504,25 @@ Please add \`${key}Action\` when creating your handler.`);
14493
14504
  const {
14494
14505
  className,
14495
14506
  style,
14496
- tabsColor,
14497
- poppable,
14507
+ popup,
14498
14508
  visible,
14499
14509
  options: options2,
14500
14510
  value,
14501
14511
  title,
14502
- textKey,
14503
- valueKey,
14504
- childrenKey,
14505
- convertConfig: convertConfig2,
14512
+ optionKey: optionKey2,
14513
+ format: format2,
14506
14514
  closeable,
14507
14515
  closeIconPosition,
14508
14516
  closeIcon,
14509
14517
  lazy,
14510
- lazyLoad,
14518
+ onLoad,
14511
14519
  onClose,
14512
14520
  onChange,
14513
14521
  onPathChange
14514
- } = { ...defaultProps$Z, ...props };
14522
+ } = { ...defaultProps$_, ...props };
14515
14523
  const [tabvalue, setTabvalue] = React.useState("c1");
14516
14524
  const [optionsData, setOptionsData] = React.useState([]);
14517
- const isLazy = () => state.configs.lazy && Boolean(state.configs.lazyLoad);
14525
+ const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
14518
14526
  const [state] = React.useState({
14519
14527
  optionsData: [],
14520
14528
  panes: [
@@ -14532,44 +14540,38 @@ Please add \`${key}Action\` when creating your handler.`);
14532
14540
  currentProcessNode: [],
14533
14541
  configs: {
14534
14542
  lazy,
14535
- lazyLoad,
14536
- valueKey,
14537
- textKey,
14538
- childrenKey,
14539
- convertConfig: convertConfig2
14543
+ onLoad,
14544
+ optionKey: optionKey2,
14545
+ format: format2
14540
14546
  },
14541
14547
  lazyLoadMap: /* @__PURE__ */ new Map()
14542
14548
  });
14543
- const b = cn("cascader");
14544
- const classes = classNames(b(""));
14549
+ const classPrefix2 = classNames(`nut-cascader`);
14545
14550
  const classesPane = classNames({
14546
- [`${b("")}-pane`]: true
14551
+ [`${classPrefix2}-pane`]: true
14547
14552
  });
14548
14553
  React.useEffect(() => {
14549
14554
  initData();
14550
- }, []);
14555
+ }, [options2]);
14551
14556
  React.useEffect(() => {
14552
14557
  if (value !== state.innerValue) {
14553
14558
  state.innerValue = value;
14554
14559
  }
14555
14560
  }, [value]);
14556
- React.useEffect(() => {
14557
- initData();
14558
- }, [options2]);
14559
14561
  const initData = async () => {
14560
14562
  state.lazyLoadMap.clear();
14561
- if (convertConfig2 && Object.keys(convertConfig2).length > 0) {
14563
+ if (format2 && Object.keys(format2).length > 0) {
14562
14564
  state.optionsData = convertListToOptions(
14563
14565
  options2,
14564
- convertConfig2
14566
+ format2
14565
14567
  );
14566
14568
  } else {
14567
14569
  state.optionsData = options2;
14568
14570
  }
14569
14571
  state.tree = new Tree$1(state.optionsData, {
14570
- value: state.configs.valueKey,
14571
- text: state.configs.textKey,
14572
- children: state.configs.childrenKey
14572
+ value: state.configs.optionKey.valueKey,
14573
+ text: state.configs.optionKey.textKey,
14574
+ children: state.configs.optionKey.childrenKey
14573
14575
  });
14574
14576
  if (isLazy() && !state.tree.nodes.length) {
14575
14577
  await invokeLazyLoad({
@@ -14635,7 +14637,7 @@ Please add \`${key}Action\` when creating your handler.`);
14635
14637
  if (!node) {
14636
14638
  return;
14637
14639
  }
14638
- if (!state.configs.lazyLoad) {
14640
+ if (!state.configs.onLoad) {
14639
14641
  node.leaf = true;
14640
14642
  return;
14641
14643
  }
@@ -14648,7 +14650,7 @@ Please add \`${key}Action\` when creating your handler.`);
14648
14650
  if (!lazyLoadPromise) {
14649
14651
  lazyLoadPromise = new Promise((resolve) => {
14650
14652
  var _a2, _b;
14651
- (_b = (_a2 = state.configs).lazyLoad) == null ? void 0 : _b.call(_a2, node, resolve);
14653
+ (_b = (_a2 = state.configs).onLoad) == null ? void 0 : _b.call(_a2, node, resolve);
14652
14654
  });
14653
14655
  state.lazyLoadMap.set(node, lazyLoadPromise);
14654
14656
  }
@@ -14695,8 +14697,8 @@ Please add \`${key}Action\` when creating your handler.`);
14695
14697
  selectedNode: null,
14696
14698
  paneKey: `c${state.tabsCursor + 1}`
14697
14699
  });
14698
- setTabvalue(`c${state.tabsCursor + 1}`);
14699
14700
  setOptionsData(state.panes);
14701
+ setTabvalue(`c${state.tabsCursor + 1}`);
14700
14702
  if (!type2) {
14701
14703
  const pathNodes = state.panes.map((item) => item.selectedNode);
14702
14704
  const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
@@ -14716,8 +14718,8 @@ Please add \`${key}Action\` when creating your handler.`);
14716
14718
  setOptionsData(state.panes);
14717
14719
  };
14718
14720
  const renderItem = () => {
14719
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classes} ${className}`, style, children: [
14720
- poppable && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("title"), children: title }),
14721
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2} ${className}`, style, children: [
14722
+ popup && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-cascader__title", children: title }),
14721
14723
  /* @__PURE__ */ jsxRuntimeExports.jsx(
14722
14724
  Tabs,
14723
14725
  {
@@ -14732,27 +14734,21 @@ Please add \`${key}Action\` when creating your handler.`);
14732
14734
  setTabvalue(pane.paneKey);
14733
14735
  state.tabsCursor = index;
14734
14736
  },
14735
- className: `nut-tabs__titles-item ${tabvalue === pane.paneKey ? "active" : ""}`,
14737
+ className: `nut-tabs__titles-item ${tabvalue === pane.paneKey ? "nut-tabs__titles-item--active" : ""}`,
14736
14738
  children: [
14737
14739
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "nut-tabs__titles-item__text", children: [
14738
14740
  !state.initLoading && state.panes.length && ((_a2 = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _a2.text),
14739
14741
  !state.initLoading && state.panes.length && !((_b = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _b.text) && "请选择",
14740
14742
  !(!state.initLoading && state.panes.length) && "Loading..."
14741
14743
  ] }),
14742
- /* @__PURE__ */ jsxRuntimeExports.jsx(
14743
- "span",
14744
- {
14745
- className: "nut-tabs__titles-item__line",
14746
- style: { background: tabsColor }
14747
- }
14748
- )
14744
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "nut-tabs__titles-item__line" })
14749
14745
  ]
14750
14746
  },
14751
14747
  pane.paneKey
14752
14748
  );
14753
14749
  });
14754
14750
  },
14755
- 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) => {
14751
+ 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) => {
14756
14752
  var _a2;
14757
14753
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14758
14754
  CascaderItem,
@@ -14764,15 +14760,14 @@ Please add \`${key}Action\` when creating your handler.`);
14764
14760
  },
14765
14761
  index
14766
14762
  );
14767
- }) }) }, pane.paneKey)) : /* @__PURE__ */ jsxRuntimeExports.jsx(TabPane, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane }) })
14763
+ }) }) }, pane.paneKey)) : /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs.TabPane, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane }) })
14768
14764
  }
14769
14765
  )
14770
14766
  ] });
14771
14767
  };
14772
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: poppable ? /* @__PURE__ */ jsxRuntimeExports.jsx(
14768
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: popup ? /* @__PURE__ */ jsxRuntimeExports.jsx(
14773
14769
  Popup,
14774
14770
  {
14775
- className: "cascadar-popup",
14776
14771
  visible,
14777
14772
  position: "bottom",
14778
14773
  round: true,
@@ -14786,11 +14781,11 @@ Please add \`${key}Action\` when creating your handler.`);
14786
14781
  ) : renderItem() });
14787
14782
  };
14788
14783
  const Cascader = React.forwardRef(InternalCascader);
14789
- Cascader.defaultProps = defaultProps$Z;
14784
+ Cascader.defaultProps = defaultProps$_;
14790
14785
  Cascader.displayName = "NutCascader";
14791
14786
  const CheckboxGroupContext = React.createContext(null);
14792
14787
  const Context = CheckboxGroupContext;
14793
- const defaultProps$Y = {
14788
+ const defaultProps$Z = {
14794
14789
  max: void 0,
14795
14790
  labelPosition: "right",
14796
14791
  direction: "vertical",
@@ -14801,7 +14796,7 @@ Please add \`${key}Action\` when creating your handler.`);
14801
14796
  const classPrefix$9 = "nut-checkboxgroup";
14802
14797
  const CheckboxGroup = React.forwardRef(
14803
14798
  (props, ref) => {
14804
- const { children } = { ...defaultProps$Y, ...props };
14799
+ const { children } = { ...defaultProps$Z, ...props };
14805
14800
  const {
14806
14801
  className,
14807
14802
  disabled,
@@ -14891,9 +14886,9 @@ Please add \`${key}Action\` when creating your handler.`);
14891
14886
  );
14892
14887
  }
14893
14888
  );
14894
- CheckboxGroup.defaultProps = defaultProps$Y;
14889
+ CheckboxGroup.defaultProps = defaultProps$Z;
14895
14890
  CheckboxGroup.displayName = "NutCheckboxGroup";
14896
- const defaultProps$X = {
14891
+ const defaultProps$Y = {
14897
14892
  ...ComponentDefaults,
14898
14893
  disabled: false,
14899
14894
  labelPosition: "right",
@@ -14906,7 +14901,7 @@ Please add \`${key}Action\` when creating your handler.`);
14906
14901
  const classPrefix$8 = "nut-checkbox";
14907
14902
  const Checkbox = (props) => {
14908
14903
  const { children } = {
14909
- ...defaultProps$X,
14904
+ ...defaultProps$Y,
14910
14905
  ...props
14911
14906
  };
14912
14907
  const {
@@ -15011,7 +15006,7 @@ Please add \`${key}Action\` when creating your handler.`);
15011
15006
  }
15012
15007
  );
15013
15008
  };
15014
- Checkbox.defaultProps = defaultProps$X;
15009
+ Checkbox.defaultProps = defaultProps$Y;
15015
15010
  Checkbox.displayName = "NutCheckBox";
15016
15011
  Checkbox.Group = CheckboxGroup;
15017
15012
  const MIN_DISTANCE = 10;
@@ -15079,13 +15074,13 @@ Please add \`${key}Action\` when creating your handler.`);
15079
15074
  isHorizontal
15080
15075
  };
15081
15076
  }
15082
- const InternalPickerSlot = (props, ref) => {
15077
+ const InternalPickerPanel = (props, ref) => {
15083
15078
  const {
15084
15079
  keyIndex = 0,
15085
15080
  defaultValue,
15086
- listData = [],
15081
+ options: options2 = [],
15087
15082
  threeDimensional = true,
15088
- swipeDuration = 1e3,
15083
+ duration = 1e3,
15089
15084
  chooseItem
15090
15085
  } = props;
15091
15086
  const touch = useTouch();
@@ -15099,9 +15094,8 @@ Please add \`${key}Action\` when creating your handler.`);
15099
15094
  const rotation = 20;
15100
15095
  const moving = React.useRef(false);
15101
15096
  let timer;
15102
- React.useRef(null);
15103
15097
  const rollerRef = React.useRef(null);
15104
- const pickerSlotRef = React.useRef(null);
15098
+ const PickerPanelRef = React.useRef(null);
15105
15099
  const [startTime, setStartTime] = React.useState(0);
15106
15100
  const [startY, setStartY] = React.useState(0);
15107
15101
  const transformY = React.useRef(0);
@@ -15127,8 +15121,8 @@ Please add \`${key}Action\` when creating your handler.`);
15127
15121
  if (updateMove > 0) {
15128
15122
  updateMove = 0;
15129
15123
  }
15130
- if (updateMove < -(listData.length - 1) * lineSpacing) {
15131
- updateMove = -(listData.length - 1) * lineSpacing;
15124
+ if (updateMove < -(options2.length - 1) * lineSpacing) {
15125
+ updateMove = -(options2.length - 1) * lineSpacing;
15132
15126
  }
15133
15127
  const endMove = Math.round(updateMove / lineSpacing) * lineSpacing;
15134
15128
  const deg = `${(Math.abs(Math.round(endMove / lineSpacing)) + 1) * rotation}deg`;
@@ -15137,7 +15131,7 @@ Please add \`${key}Action\` when creating your handler.`);
15137
15131
  } else {
15138
15132
  let deg = 0;
15139
15133
  const currentDeg = (-updateMove / lineSpacing + 1) * rotation;
15140
- const maxDeg = (listData.length + 1) * rotation;
15134
+ const maxDeg = (options2.length + 1) * rotation;
15141
15135
  const minDeg = 0;
15142
15136
  deg = Math.min(Math.max(currentDeg, minDeg), maxDeg);
15143
15137
  if (minDeg < deg && deg < maxDeg) {
@@ -15147,7 +15141,7 @@ Please add \`${key}Action\` when creating your handler.`);
15147
15141
  }
15148
15142
  };
15149
15143
  const setChooseValue = (move) => {
15150
- chooseItem && chooseItem(listData == null ? void 0 : listData[Math.round(-move / lineSpacing)], keyIndex);
15144
+ chooseItem && chooseItem(options2 == null ? void 0 : options2[Math.round(-move / lineSpacing)], keyIndex);
15151
15145
  };
15152
15146
  const touchStart = (event) => {
15153
15147
  touch.start(event);
@@ -15171,7 +15165,7 @@ Please add \`${key}Action\` when creating your handler.`);
15171
15165
  const moveTime = Date.now() - startTime;
15172
15166
  if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
15173
15167
  const distance = momentum(move, moveTime);
15174
- setMove(distance, "end", +swipeDuration);
15168
+ setMove(distance, "end", +duration);
15175
15169
  } else {
15176
15170
  setMove(move, "end");
15177
15171
  }
@@ -15179,9 +15173,9 @@ Please add \`${key}Action\` when creating your handler.`);
15179
15173
  touch.reset();
15180
15174
  }, 0);
15181
15175
  };
15182
- const momentum = (distance, duration) => {
15176
+ const momentum = (distance, duration2) => {
15183
15177
  let nDistance = distance;
15184
- const speed = Math.abs(nDistance / duration);
15178
+ const speed = Math.abs(nDistance / duration2);
15185
15179
  nDistance = speed / 3e-3 * (nDistance < 0 ? -1 : 1);
15186
15180
  return nDistance;
15187
15181
  };
@@ -15189,7 +15183,7 @@ Please add \`${key}Action\` when creating your handler.`);
15189
15183
  const value = val || defaultValue;
15190
15184
  let index = -1;
15191
15185
  if (value) {
15192
- listData.some((item, idx) => {
15186
+ options2.some((item, idx) => {
15193
15187
  if (item.value === value) {
15194
15188
  index = idx;
15195
15189
  return true;
@@ -15197,7 +15191,7 @@ Please add \`${key}Action\` when creating your handler.`);
15197
15191
  return false;
15198
15192
  });
15199
15193
  } else {
15200
- listData.forEach((item, i) => {
15194
+ options2.forEach((item, i) => {
15201
15195
  if (item.value === defaultValue) {
15202
15196
  index = i;
15203
15197
  }
@@ -15240,7 +15234,7 @@ Please add \`${key}Action\` when creating your handler.`);
15240
15234
  return () => {
15241
15235
  clearTimeout(timer);
15242
15236
  };
15243
- }, [listData]);
15237
+ }, [options2]);
15244
15238
  React.useImperativeHandle(ref, () => ({
15245
15239
  stopMomentum,
15246
15240
  moving: moving.current
@@ -15249,7 +15243,7 @@ Please add \`${key}Action\` when creating your handler.`);
15249
15243
  "div",
15250
15244
  {
15251
15245
  className: "nut-picker-list",
15252
- ref: pickerSlotRef,
15246
+ ref: PickerPanelRef,
15253
15247
  onTouchStart: touchStart,
15254
15248
  onTouchMove: touchMove,
15255
15249
  onTouchEnd: touchEnd,
@@ -15262,7 +15256,7 @@ Please add \`${key}Action\` when creating your handler.`);
15262
15256
  style: threeDimensional ? touchRollerStyle() : touchTileStyle(),
15263
15257
  onTransitionEnd: stopMomentum,
15264
15258
  children: [
15265
- threeDimensional && listData.map((item, index) => {
15259
+ threeDimensional && options2.map((item, index) => {
15266
15260
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15267
15261
  "div",
15268
15262
  {
@@ -15275,7 +15269,7 @@ Please add \`${key}Action\` when creating your handler.`);
15275
15269
  item.value ? item.value : index
15276
15270
  );
15277
15271
  }),
15278
- !threeDimensional && listData.map((item, index) => {
15272
+ !threeDimensional && options2.map((item, index) => {
15279
15273
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15280
15274
  "div",
15281
15275
  {
@@ -15294,8 +15288,8 @@ Please add \`${key}Action\` when creating your handler.`);
15294
15288
  }
15295
15289
  );
15296
15290
  };
15297
- const PickerSlot = React.forwardRef(InternalPickerSlot);
15298
- const PickerSlot$1 = PickerSlot;
15291
+ const PickerPanel = React.forwardRef(InternalPickerPanel);
15292
+ const PickerPanel$1 = PickerPanel;
15299
15293
  function useRefs() {
15300
15294
  const refs = React.useRef([]);
15301
15295
  const setRefs = React.useCallback(
@@ -15310,180 +15304,202 @@ Please add \`${key}Action\` when creating your handler.`);
15310
15304
  }, []);
15311
15305
  return [refs.current, setRefs, reset];
15312
15306
  }
15307
+ const defaultProps$X = {
15308
+ ...ComponentDefaults,
15309
+ visible: false,
15310
+ title: "",
15311
+ options: [],
15312
+ value: [],
15313
+ defaultValue: [],
15314
+ threeDimensional: true,
15315
+ duration: 1e3
15316
+ };
15313
15317
  const InternalPicker = (props, ref) => {
15314
15318
  const { locale } = useConfig();
15315
15319
  const {
15316
15320
  visible,
15317
15321
  title,
15318
- listData = [],
15319
- defaultValueData,
15320
- onConfirm,
15321
- onClose,
15322
- onCloseUpdate,
15323
- onChange,
15322
+ options: options2 = [],
15323
+ defaultValue = [],
15324
15324
  className,
15325
15325
  style,
15326
15326
  threeDimensional,
15327
- swipeDuration,
15327
+ duration,
15328
+ onConfirm,
15329
+ onClose,
15330
+ afterClose,
15331
+ onChange,
15328
15332
  ...rest
15329
- } = props;
15330
- const [chooseValueData, setchooseValueData] = React.useState([]);
15331
- const [columnIndex, setcolumnIndex] = React.useState(0);
15333
+ } = { ...defaultProps$X, ...props };
15334
+ const classPrefix2 = "nut-picker";
15335
+ const classes = classNames(classPrefix2, className);
15336
+ const [selectedValue, setSelectedValue] = usePropsValue({
15337
+ value: props.value,
15338
+ defaultValue: [...defaultValue],
15339
+ finalValue: [...defaultValue],
15340
+ onChange: (val) => {
15341
+ var _a2;
15342
+ (_a2 = props.onConfirm) == null ? void 0 : _a2.call(props, setSelectedOptions(), val);
15343
+ }
15344
+ });
15345
+ const [columnIndex, setColumnIndex] = React.useState(0);
15332
15346
  const pickerRef = React.useRef(null);
15333
15347
  const [refs, setRefs] = useRefs();
15334
15348
  const [columnsList, setColumnsList] = React.useState([]);
15335
- const b = cn("picker");
15336
15349
  const isConfirmEvent = React.useRef(false);
15337
- React.useEffect(() => {
15338
- if (defaultValueData && defaultValueData.length !== 0 && defaultValueData.toString() !== chooseValueData.toString()) {
15339
- const data = [...defaultValueData];
15340
- setchooseValueData(data);
15341
- setColumnsList(normalListData());
15350
+ const formatCascade = (columns, values) => {
15351
+ const formatted = [];
15352
+ let columnOptions = {
15353
+ text: "",
15354
+ value: "",
15355
+ children: columns
15356
+ };
15357
+ let columnIndex2 = 0;
15358
+ while (columnOptions && columnOptions.children) {
15359
+ const options22 = columnOptions.children;
15360
+ const value = values[columnIndex2];
15361
+ let index = options22.findIndex(
15362
+ (columnItem) => columnItem.value === value
15363
+ );
15364
+ if (index === -1)
15365
+ index = 0;
15366
+ columnOptions = columnOptions.children[index];
15367
+ columnIndex2++;
15368
+ formatted.push(options22);
15342
15369
  }
15343
- }, [defaultValueData]);
15344
- React.useEffect(() => {
15345
- onChange && onChange(columnIndex, chooseValueData, selectedOptions());
15346
- if (isConfirmEvent.current) {
15347
- isConfirmEvent.current = false;
15348
- onConfirm && onConfirm(chooseValueData, selectedOptions());
15370
+ return formatted;
15371
+ };
15372
+ const columnsType = () => {
15373
+ const firstColumn = options2[0];
15374
+ if (firstColumn) {
15375
+ if (Array.isArray(firstColumn)) {
15376
+ return "multiple";
15377
+ }
15378
+ if ("children" in firstColumn) {
15379
+ return "cascade";
15380
+ }
15349
15381
  }
15350
- }, [chooseValueData]);
15351
- React.useEffect(() => {
15352
- init();
15353
- }, [listData]);
15354
- const closeActionSheet = () => {
15355
- onClose && onClose(chooseValueData, selectedOptions());
15356
- onCloseUpdate && onCloseUpdate(chooseValueData, selectedOptions(), pickerRef);
15382
+ return "single";
15357
15383
  };
15358
- const confirm2 = () => {
15359
- let movings = false;
15360
- refs.forEach((_ref) => {
15361
- if (_ref.moving)
15362
- movings = true;
15363
- _ref.stopMomentum();
15384
+ const normalListData = () => {
15385
+ const type2 = columnsType();
15386
+ switch (type2) {
15387
+ case "multiple":
15388
+ return options2;
15389
+ case "cascade":
15390
+ return formatCascade(options2, selectedValue);
15391
+ default:
15392
+ return [options2];
15393
+ }
15394
+ };
15395
+ const init = () => {
15396
+ const normalData = normalListData();
15397
+ setColumnsList(normalData);
15398
+ const data = [];
15399
+ normalData.length > 0 && normalData.map((item) => {
15400
+ item[0] && data.push(item[0].value);
15401
+ return item;
15364
15402
  });
15365
- if (movings) {
15366
- isConfirmEvent.current = true;
15367
- } else {
15368
- onConfirm && onConfirm(chooseValueData, selectedOptions());
15403
+ if (!defaultValue.length && selectedValue.length === 0) {
15404
+ setSelectedValue([...data]);
15369
15405
  }
15370
- onClose && onClose(chooseValueData, selectedOptions());
15371
- setTimeout(() => {
15372
- isConfirmEvent.current = false;
15373
- }, 0);
15374
15406
  };
15375
- const selectedOptions = () => {
15376
- const optins = [];
15377
- columnsList.map((column, index) => {
15378
- let currOptions = [];
15379
- currOptions = column.filter(
15380
- (item) => item.value === chooseValueData[index]
15407
+ React.useEffect(() => {
15408
+ if (!visible) {
15409
+ return;
15410
+ }
15411
+ init();
15412
+ }, [options2, visible]);
15413
+ const setSelectedOptions = () => {
15414
+ const options22 = [];
15415
+ let currOptions = [];
15416
+ columnsList.forEach((columnOptions, index) => {
15417
+ currOptions = columnOptions.filter(
15418
+ (item) => item.value === selectedValue[index]
15381
15419
  );
15382
15420
  if (currOptions[0]) {
15383
- optins.push(currOptions[0]);
15421
+ options22.push(currOptions[0]);
15384
15422
  } else {
15385
- column[0] && optins.push(column[0]);
15423
+ columnOptions[0] && options22.push(columnOptions[0]);
15386
15424
  }
15387
- return column;
15388
15425
  });
15389
- return optins;
15426
+ return options22;
15390
15427
  };
15391
- const chooseItem = (option, columnIndex2) => {
15392
- if (option && Object.keys(option).length) {
15393
- if (chooseValueData[columnIndex2] !== option.value) {
15428
+ React.useEffect(() => {
15429
+ if (!visible) {
15430
+ return;
15431
+ }
15432
+ onChange && onChange(setSelectedOptions(), selectedValue, columnIndex);
15433
+ if (isConfirmEvent.current) {
15434
+ isConfirmEvent.current = false;
15435
+ onConfirm && onConfirm(setSelectedOptions(), selectedValue);
15436
+ }
15437
+ }, [selectedValue, columnsList, visible]);
15438
+ const chooseItem = (columnOptions, columnIndex2) => {
15439
+ var _a2, _b;
15440
+ if (columnOptions && Object.keys(columnOptions).length) {
15441
+ if (selectedValue[columnIndex2] !== columnOptions.value) {
15394
15442
  if (columnsType() === "cascade") {
15395
- chooseValueData[columnIndex2] = option.value ? option.value : "";
15396
- setchooseValueData([...chooseValueData]);
15397
- let index = columnIndex2;
15398
- let cursor = option;
15399
- while (cursor && cursor.children && cursor.children[0]) {
15400
- chooseValueData[index + 1] = cursor.children[0].value;
15401
- setchooseValueData([...chooseValueData]);
15402
- index++;
15403
- const cc = cursor.children[0];
15404
- cursor = cc;
15443
+ selectedValue[columnIndex2] = columnOptions.value || "";
15444
+ setSelectedValue([...selectedValue]);
15445
+ while ((_a2 = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _a2[0]) {
15446
+ selectedValue[columnIndex2 + 1] = columnOptions.children[0].value;
15447
+ setSelectedValue([...selectedValue]);
15448
+ columnIndex2++;
15449
+ columnOptions = columnOptions.children[0];
15405
15450
  }
15406
- if (cursor && cursor.children) {
15407
- chooseValueData[index + 1] = "";
15408
- setchooseValueData([...chooseValueData]);
15451
+ if ((_b = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _b.length) {
15452
+ selectedValue[columnIndex2 + 1] = "";
15453
+ setSelectedValue([...selectedValue]);
15409
15454
  }
15410
15455
  setColumnsList(normalListData());
15411
15456
  } else {
15412
- setchooseValueData((data) => {
15457
+ setSelectedValue((data) => {
15413
15458
  const cdata = [...data];
15414
15459
  cdata[columnIndex2] = Object.prototype.hasOwnProperty.call(
15415
- option,
15460
+ columnOptions,
15416
15461
  "value"
15417
- ) ? option.value : "";
15462
+ ) ? columnOptions.value : "";
15418
15463
  return cdata;
15419
15464
  });
15420
15465
  }
15421
- setcolumnIndex(columnIndex2);
15466
+ setColumnIndex(columnIndex2);
15422
15467
  }
15423
15468
  }
15424
15469
  };
15425
- const normalListData = () => {
15426
- const type2 = columnsType();
15427
- switch (type2) {
15428
- case "multiple":
15429
- return listData;
15430
- case "cascade":
15431
- return formatCascade(listData, chooseValueData);
15432
- default:
15433
- return [listData];
15434
- }
15435
- };
15436
- const columnsType = () => {
15437
- const firstColumn = listData[0];
15438
- if (firstColumn) {
15439
- if (Array.isArray(firstColumn)) {
15440
- return "multiple";
15441
- }
15442
- if ("children" in firstColumn) {
15443
- return "cascade";
15444
- }
15445
- }
15446
- return "single";
15447
- };
15448
- const formatCascade = (columns, defaultValues) => {
15449
- const formatted = [];
15450
- let cursor = {
15451
- text: "",
15452
- value: "",
15453
- children: columns
15454
- };
15455
- let columnIndex2 = 0;
15456
- while (cursor && cursor.children) {
15457
- const options2 = cursor.children;
15458
- const value = defaultValues[columnIndex2];
15459
- let index = options2.findIndex(
15460
- (columnItem) => columnItem.value === value
15461
- );
15462
- if (index === -1)
15463
- index = 0;
15464
- cursor = cursor.children[index];
15465
- columnIndex2++;
15466
- formatted.push(options2);
15467
- }
15468
- return formatted;
15469
- };
15470
- const init = () => {
15471
- const data = [];
15472
- const normalData = normalListData();
15473
- setColumnsList(normalData);
15474
- normalData.length > 0 && normalData.map((item) => {
15475
- item[0] && data.push(item[0].value);
15476
- return item;
15470
+ const confirm2 = () => {
15471
+ let movings = false;
15472
+ refs.forEach((ref2) => {
15473
+ if (ref2.moving)
15474
+ movings = true;
15475
+ ref2.stopMomentum();
15477
15476
  });
15478
- if (!defaultValueData && chooseValueData.length === 0) {
15479
- setchooseValueData([...data]);
15477
+ if (movings) {
15478
+ isConfirmEvent.current = true;
15479
+ } else {
15480
+ onConfirm && onConfirm(setSelectedOptions(), selectedValue);
15481
+ closePicker();
15480
15482
  }
15483
+ setTimeout(() => {
15484
+ isConfirmEvent.current = false;
15485
+ }, 0);
15486
+ };
15487
+ const closePicker = () => {
15488
+ onClose && onClose(setSelectedOptions(), selectedValue);
15489
+ afterClose && afterClose(setSelectedOptions(), selectedValue, pickerRef);
15481
15490
  };
15482
- const renderToolbar = () => {
15483
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: b("control"), children: [
15484
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: b("cancel-btn"), onClick: () => closeActionSheet(), children: locale.cancel }),
15485
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("title"), children: title || "" }),
15486
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: b("confirm-btn"), onClick: confirm2, children: locale.confirm })
15491
+ const renderTitleBar = () => {
15492
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__control`, children: [
15493
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
15494
+ "span",
15495
+ {
15496
+ className: `${classPrefix2}__cancel-btn`,
15497
+ onClick: () => closePicker(),
15498
+ children: locale.cancel
15499
+ }
15500
+ ),
15501
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__title`, children: title || "" }),
15502
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `${classPrefix2}__confirm-btn`, onClick: confirm2, children: locale.confirm })
15487
15503
  ] });
15488
15504
  };
15489
15505
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -15492,20 +15508,20 @@ Please add \`${key}Action\` when creating your handler.`);
15492
15508
  visible,
15493
15509
  position: "bottom",
15494
15510
  onClose: () => {
15495
- closeActionSheet();
15511
+ closePicker();
15496
15512
  },
15497
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${b()} ${className || ""}`, style, ...rest, children: [
15498
- renderToolbar(),
15499
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("panel"), ref: pickerRef, children: columnsList == null ? void 0 : columnsList.map((item, index) => {
15513
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes, style, ...rest, children: [
15514
+ renderTitleBar(),
15515
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__panel`, ref: pickerRef, children: columnsList == null ? void 0 : columnsList.map((item, index) => {
15500
15516
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15501
- PickerSlot$1,
15517
+ PickerPanel$1,
15502
15518
  {
15503
15519
  ref: setRefs(index),
15504
- defaultValue: chooseValueData == null ? void 0 : chooseValueData[index],
15505
- listData: item,
15520
+ defaultValue: selectedValue == null ? void 0 : selectedValue[index],
15521
+ options: item,
15506
15522
  threeDimensional,
15507
15523
  chooseItem: (value, index2) => chooseItem(value, index2),
15508
- swipeDuration,
15524
+ duration,
15509
15525
  keyIndex: index
15510
15526
  },
15511
15527
  index
@@ -15556,7 +15572,7 @@ Please add \`${key}Action\` when creating your handler.`);
15556
15572
  const [show, setShow] = React.useState(false);
15557
15573
  const [currentDate, setCurrentDate] = React.useState(modelValue);
15558
15574
  const [defaultValue, setDefaultValue] = React.useState([]);
15559
- const [listData, setListData] = React.useState([]);
15575
+ const [options2, setListData] = React.useState([]);
15560
15576
  const pickerRef = React.useRef(null);
15561
15577
  const isDate = (val) => {
15562
15578
  return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
@@ -15674,7 +15690,7 @@ Please add \`${key}Action\` when creating your handler.`);
15674
15690
  }
15675
15691
  return result;
15676
15692
  };
15677
- const updateChooseValueCustmer = (index, selectedValue, cacheValueData) => {
15693
+ const updateChooseValueCustmer = (cacheValueData, selectedValue, index) => {
15678
15694
  if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
15679
15695
  type2.toLocaleLowerCase()
15680
15696
  )) {
@@ -15713,7 +15729,7 @@ Please add \`${key}Action\` when creating your handler.`);
15713
15729
  const isEqual2 = (currentDate == null ? void 0 : currentDate.getTime()) === (date2 == null ? void 0 : date2.getTime());
15714
15730
  date2 && isDate(date2) && !isEqual2 && setCurrentDate(formatValue(date2));
15715
15731
  }
15716
- props.onChange && props.onChange(index, selectedValue, cacheValueData);
15732
+ props.onChange && props.onChange(cacheValueData, selectedValue, index);
15717
15733
  };
15718
15734
  const padZero = (num, targetLength = 2) => {
15719
15735
  let str = `${num}`;
@@ -15809,16 +15825,16 @@ Please add \`${key}Action\` when creating your handler.`);
15809
15825
  className: `nut-datepicker ${className || ""}`,
15810
15826
  style,
15811
15827
  ...rest,
15812
- children: listData.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
15828
+ children: options2.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
15813
15829
  Picker$1,
15814
15830
  {
15815
15831
  title,
15816
15832
  visible: show,
15817
- listData,
15833
+ options: options2,
15818
15834
  onClose: onCloseDatePicker,
15819
- defaultValueData: defaultValue,
15820
- onConfirm: (values, options2) => onConfirmDatePicker && onConfirmDatePicker(values, options2),
15821
- onChange: (index, value, list) => updateChooseValueCustmer(index, value, list),
15835
+ defaultValue,
15836
+ onConfirm: (options22, values) => onConfirmDatePicker && onConfirmDatePicker(options22, values),
15837
+ onChange: (list, value, index) => updateChooseValueCustmer(list, value, index),
15822
15838
  threeDimensional,
15823
15839
  ref: pickerRef
15824
15840
  }
@@ -19768,144 +19784,120 @@ Please add \`${key}Action\` when creating your handler.`);
19768
19784
  Switch.defaultProps = defaultProps$H;
19769
19785
  Switch.displayName = "NutSwitch";
19770
19786
  const defaultProps$G = {
19787
+ ...ComponentDefaults,
19771
19788
  defaultValue: "",
19772
- textAlign: "left",
19773
- limitshow: false,
19774
- maxlength: "",
19775
- rows: "",
19789
+ showCount: false,
19790
+ rows: 2,
19791
+ maxLength: 140,
19776
19792
  placeholder: "",
19777
- readonly: false,
19793
+ readOnly: false,
19778
19794
  disabled: false,
19779
- autosize: false
19795
+ autoSize: false
19780
19796
  };
19781
19797
  const TextArea = (props) => {
19782
19798
  const { locale } = useConfig();
19783
19799
  const {
19784
19800
  className,
19801
+ value,
19785
19802
  defaultValue,
19786
- textAlign,
19787
- limitshow,
19788
- maxlength,
19803
+ showCount,
19804
+ maxLength,
19789
19805
  rows,
19790
19806
  placeholder,
19791
- readonly,
19807
+ readOnly,
19792
19808
  disabled,
19793
- autosize,
19809
+ autoSize,
19794
19810
  style,
19795
19811
  onChange,
19796
19812
  onBlur,
19797
- onFocus
19813
+ onFocus,
19814
+ ...rest
19798
19815
  } = { ...defaultProps$G, ...props };
19799
- const textareaBem = cn("textarea");
19800
- const [inputValue, SetInputValue] = React.useState("");
19816
+ const classPrefix2 = "nut-textarea";
19801
19817
  const textareaRef = React.useRef(null);
19802
- const compositingRef = React.useRef(false);
19803
- React.useEffect(() => {
19804
- let initValue = defaultValue;
19805
- if (initValue && maxlength && [...initValue].length > Number(maxlength)) {
19806
- initValue = initValue.substring(0, Number(maxlength));
19818
+ const compositionRef = React.useRef(false);
19819
+ const format2 = (value2) => {
19820
+ if (maxLength !== void 0 && value2.length > maxLength) {
19821
+ return value2.substring(0, maxLength);
19807
19822
  }
19808
- SetInputValue(initValue);
19809
- if (autosize) {
19810
- setTimeout(() => {
19811
- setContentHeight();
19812
- });
19813
- }
19814
- }, [defaultValue, autosize]);
19823
+ return value2;
19824
+ };
19825
+ const [inputValue, setInputValue] = usePropsValue({
19826
+ value,
19827
+ defaultValue,
19828
+ finalValue: format2(defaultValue),
19829
+ onChange
19830
+ });
19815
19831
  React.useEffect(() => {
19816
- if (inputValue) {
19817
- if (autosize) {
19818
- setContentHeight();
19819
- }
19832
+ if (autoSize) {
19833
+ setContentHeight();
19820
19834
  }
19821
- }, [inputValue]);
19835
+ }, [autoSize, defaultValue, inputValue]);
19822
19836
  const setContentHeight = () => {
19823
19837
  const textarea = textareaRef.current;
19824
19838
  if (textarea) {
19825
19839
  textarea.style.height = "auto";
19826
- let height = textarea == null ? void 0 : textarea.scrollHeight;
19827
- if (typeof autosize === "object") {
19828
- const { maxHeight, minHeight } = autosize;
19829
- if (maxHeight !== void 0) {
19830
- height = Math.min(height, maxHeight);
19831
- }
19832
- if (minHeight !== void 0) {
19833
- height = Math.max(height, minHeight);
19834
- }
19835
- }
19840
+ const height = textarea == null ? void 0 : textarea.scrollHeight;
19836
19841
  if (height) {
19837
19842
  textarea.style.height = `${height}px`;
19838
19843
  }
19839
19844
  }
19840
19845
  };
19841
- const textChange = (event) => {
19846
+ const handleChange = (event) => {
19842
19847
  const text = event.target;
19843
- if (maxlength && [...text.value].length > Number(maxlength) && !compositingRef.current) {
19844
- text.value = text.value.substring(0, Number(maxlength));
19845
- }
19846
- SetInputValue(text.value);
19847
- onChange && onChange(text.value, event);
19848
+ const value2 = compositionRef.current ? text.value : format2(text.value);
19849
+ setInputValue(value2);
19848
19850
  };
19849
- const textFocus = (event) => {
19851
+ const handleFocus = (event) => {
19850
19852
  if (disabled)
19851
19853
  return;
19852
- if (readonly)
19854
+ if (readOnly)
19853
19855
  return;
19854
19856
  onFocus && onFocus(event);
19855
19857
  };
19856
- const textBlur = (event) => {
19858
+ const handleBlur = (event) => {
19857
19859
  if (disabled)
19858
19860
  return;
19859
- if (readonly)
19861
+ if (readOnly)
19860
19862
  return;
19861
- const text = event.target;
19862
- onChange && onChange(text.value, event);
19863
19863
  onBlur && onBlur(event);
19864
19864
  };
19865
- const startComposing = () => {
19866
- compositingRef.current = true;
19867
- };
19868
- const endComposing = () => {
19869
- compositingRef.current = false;
19870
- };
19871
19865
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
19872
19866
  "div",
19873
19867
  {
19874
- className: `${textareaBem()} ${disabled ? textareaBem("disabled") : ""} ${className || ""}`,
19868
+ className: classNames(classPrefix2, className, {
19869
+ [`${classPrefix2}__disabled`]: disabled
19870
+ }),
19875
19871
  children: [
19876
19872
  /* @__PURE__ */ jsxRuntimeExports.jsx(
19877
19873
  "textarea",
19878
19874
  {
19879
19875
  ref: textareaRef,
19880
- className: textareaBem("textarea"),
19881
- style: {
19882
- textAlign,
19883
- ...style
19884
- },
19876
+ className: `${classPrefix2}__textarea`,
19877
+ style,
19885
19878
  disabled,
19886
- readOnly: readonly,
19879
+ readOnly,
19887
19880
  value: inputValue,
19888
- onChange: (e) => {
19889
- textChange(e);
19890
- },
19891
- onBlur: (e) => {
19892
- textBlur(e);
19881
+ onChange: (e) => handleChange(e),
19882
+ onBlur: (e) => handleBlur(e),
19883
+ onFocus: (e) => handleFocus(e),
19884
+ onCompositionEnd: () => {
19885
+ compositionRef.current = false;
19893
19886
  },
19894
- onFocus: (e) => {
19895
- textFocus(e);
19887
+ onCompositionStart: () => {
19888
+ compositionRef.current = true;
19896
19889
  },
19897
- onCompositionEnd: (e) => endComposing(),
19898
- onCompositionStart: (e) => startComposing(),
19899
19890
  rows,
19900
- maxLength: maxlength < 0 ? 0 : maxlength,
19901
- placeholder: placeholder || locale.placeholder
19891
+ maxLength: maxLength === -1 ? void 0 : maxLength,
19892
+ placeholder: placeholder || locale.placeholder,
19893
+ ...rest
19902
19894
  }
19903
19895
  ),
19904
- limitshow ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: textareaBem("limit"), children: [
19905
- [...inputValue].length,
19896
+ showCount && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__limit`, children: [
19897
+ inputValue.length,
19906
19898
  "/",
19907
- maxlength < 0 ? 0 : maxlength
19908
- ] }) : null
19899
+ maxLength < 0 ? 0 : maxLength
19900
+ ] })
19909
19901
  ]
19910
19902
  }
19911
19903
  );
@@ -25088,13 +25080,11 @@ Please add \`${key}Action\` when creating your handler.`);
25088
25080
  Steps.displayName = "NutSteps";
25089
25081
  const defaultProps$8 = {
25090
25082
  ...ComponentDefaults,
25091
- className: "",
25092
- style: {},
25093
25083
  columns: [],
25094
25084
  data: [],
25095
25085
  bordered: true,
25096
25086
  striped: false,
25097
- noData: "无数据",
25087
+ noData: "",
25098
25088
  sorterIcon: null,
25099
25089
  showHeader: true
25100
25090
  };
@@ -25111,9 +25101,9 @@ Please add \`${key}Action\` when creating your handler.`);
25111
25101
  summary,
25112
25102
  striped,
25113
25103
  noData,
25114
- onSorter,
25115
25104
  sorterIcon,
25116
25105
  showHeader,
25106
+ onSort,
25117
25107
  ...rest
25118
25108
  } = {
25119
25109
  ...defaultProps$8,
@@ -25125,12 +25115,13 @@ Please add \`${key}Action\` when creating your handler.`);
25125
25115
  setCurData(data);
25126
25116
  }
25127
25117
  }, [data]);
25128
- const b = cn("table");
25129
- const classes = classNames({});
25130
- const cls = classNames(b(), classes, className);
25118
+ const classPrefix2 = "nut-table";
25119
+ const headerClassPrefix = `${classPrefix2}__main__head__tr`;
25120
+ const bodyClassPrefix = `${classPrefix2}__main__body__tr`;
25121
+ const cls = classNames(classPrefix2, className);
25131
25122
  const handleSorterClick = (item) => {
25132
25123
  if (item.sorter) {
25133
- onSorter && onSorter(item, curData);
25124
+ onSort && onSort(item, curData);
25134
25125
  if (typeof item.sorter === "function") {
25135
25126
  setCurData(curData.sort(item.sorter));
25136
25127
  } else {
@@ -25140,8 +25131,8 @@ Please add \`${key}Action\` when creating your handler.`);
25140
25131
  };
25141
25132
  const cellClasses = (item) => {
25142
25133
  return {
25143
- "nut-table__main__head__tr--border": props.bordered,
25144
- [`nut-table__main__head__tr--align${item.align ? item.align : ""}`]: true
25134
+ [`${headerClassPrefix}--border`]: props.bordered,
25135
+ [`${headerClassPrefix}--align${item.align ? item.align : ""}`]: true
25145
25136
  };
25146
25137
  };
25147
25138
  const getColumnItem = (value) => {
@@ -25152,10 +25143,7 @@ Please add \`${key}Action\` when creating your handler.`);
25152
25143
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
25153
25144
  "span",
25154
25145
  {
25155
- className: classNames(
25156
- "nut-table__main__head__tr__th",
25157
- cellClasses(item)
25158
- ),
25146
+ className: classNames(`${headerClassPrefix}__th`, cellClasses(item)),
25159
25147
  onClick: () => handleSorterClick(item),
25160
25148
  children: [
25161
25149
  item.title,
@@ -25178,7 +25166,7 @@ Please add \`${key}Action\` when creating your handler.`);
25178
25166
  "span",
25179
25167
  {
25180
25168
  className: classNames(
25181
- "nut-table__main__body__tr__td",
25169
+ `${bodyClassPrefix}__td`,
25182
25170
  cellClasses(getColumnItem(value))
25183
25171
  ),
25184
25172
  children: typeof item[value] === "function" || typeof render2 === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: render2 ? render2(item) : item[value](item) }) : item[value]
@@ -25189,24 +25177,23 @@ Please add \`${key}Action\` when creating your handler.`);
25189
25177
  };
25190
25178
  const renderBoyTrs = () => {
25191
25179
  return curData.map((item, index) => {
25192
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__main__body__tr", children: renderBodyTds(item) }, index);
25180
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: bodyClassPrefix, children: renderBodyTds(item) }, index);
25193
25181
  });
25194
25182
  };
25195
25183
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cls, style, ...rest, children: [
25196
25184
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
25197
25185
  "div",
25198
25186
  {
25199
- className: classNames("nut-table__main", {
25200
- "nut-table__main--striped": striped
25187
+ className: classNames(`${classPrefix2}__main`, {
25188
+ [`${classPrefix2}__main--striped`]: striped
25201
25189
  }),
25202
25190
  children: [
25203
- showHeader && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__main__head", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__main__head__tr", children: renderHeadCells() }) }),
25204
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__main__body", children: renderBoyTrs() })
25191
+ showHeader && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__main__head`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: headerClassPrefix, children: renderHeadCells() }) }),
25192
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__main__body`, children: renderBoyTrs() })
25205
25193
  ]
25206
25194
  }
25207
25195
  ),
25208
- summary && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__summary", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "nut-table__summary__text", children: summary }) }),
25209
- 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 }) }) })
25196
+ (summary || curData.length === 0) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__summary`, children: summary || noData })
25210
25197
  ] });
25211
25198
  };
25212
25199
  Table.defaultProps = defaultProps$8;