@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.
@@ -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.7 Fri May 12 2023 15:35:24 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,18 @@ 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
+ if (current !== "") {
12581
+ setValue(current);
12582
+ }
12583
+ }, [children]);
12574
12584
  const classes = classNames(
12575
12585
  classPrefix$a,
12576
12586
  `${classPrefix$a}--${direction}`,
@@ -12665,7 +12675,7 @@ const Tabs = (props) => {
12665
12675
  }) }) })
12666
12676
  ] });
12667
12677
  };
12668
- Tabs.defaultProps = defaultProps$14;
12678
+ Tabs.defaultProps = defaultProps$15;
12669
12679
  Tabs.displayName = "NutTabs";
12670
12680
  Tabs.TabPane = TabPane;
12671
12681
  var classnameExports = {};
@@ -12788,7 +12798,7 @@ function requireClassname_development() {
12788
12798
  }
12789
12799
  })(classname);
12790
12800
  const cn = classnameExports.withNaming({ n: "nut-", e: "__", m: "--", v: "-" });
12791
- const defaultProps$13 = {
12801
+ const defaultProps$14 = {
12792
12802
  type: "custom",
12793
12803
  existAddress: [],
12794
12804
  defaultIcon: null,
@@ -12810,7 +12820,7 @@ const ExistRender = (props) => {
12810
12820
  onClose,
12811
12821
  onSwitchModule,
12812
12822
  ...rest
12813
- } = { ...defaultProps$13, ...props };
12823
+ } = { ...defaultProps$14, ...props };
12814
12824
  const b = cn("address");
12815
12825
  const selectedExist = (item) => {
12816
12826
  const copyExistAdd = existAddress;
@@ -12852,7 +12862,7 @@ const ExistRender = (props) => {
12852
12862
  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
12863
  ] });
12854
12864
  };
12855
- const defaultProps$12 = {
12865
+ const defaultProps$13 = {
12856
12866
  modelValue: [],
12857
12867
  type: "custom",
12858
12868
  province: [],
@@ -12877,7 +12887,7 @@ const CustomRender = (props) => {
12877
12887
  onClose,
12878
12888
  ...rest
12879
12889
  } = {
12880
- ...defaultProps$12,
12890
+ ...defaultProps$13,
12881
12891
  ...props
12882
12892
  };
12883
12893
  const b = cn("address");
@@ -13046,28 +13056,28 @@ const CustomRender = (props) => {
13046
13056
  nextAreaList(item);
13047
13057
  };
13048
13058
  useEffect(() => {
13049
- const { province: province2 } = { ...defaultProps$12, ...props };
13059
+ const { province: province2 } = { ...defaultProps$13, ...props };
13050
13060
  setRegionList({
13051
13061
  ...regionList,
13052
13062
  province: isCustom2() ? transformData(province2) : province2
13053
13063
  });
13054
13064
  }, [province]);
13055
13065
  useEffect(() => {
13056
- const { city: city2 } = { ...defaultProps$12, ...props };
13066
+ const { city: city2 } = { ...defaultProps$13, ...props };
13057
13067
  setRegionList({
13058
13068
  ...regionList,
13059
13069
  city: isCustom2() ? transformData(city2) : city2
13060
13070
  });
13061
13071
  }, [city]);
13062
13072
  useEffect(() => {
13063
- const { country: country2 } = { ...defaultProps$12, ...props };
13073
+ const { country: country2 } = { ...defaultProps$13, ...props };
13064
13074
  setRegionList({
13065
13075
  ...regionList,
13066
13076
  country: isCustom2() ? transformData(country2) : country2
13067
13077
  });
13068
13078
  }, [country]);
13069
13079
  useEffect(() => {
13070
- const { town: town2 } = { ...defaultProps$12, ...props };
13080
+ const { town: town2 } = { ...defaultProps$13, ...props };
13071
13081
  setRegionList({
13072
13082
  ...regionList,
13073
13083
  town: isCustom2() ? transformData(town2) : town2
@@ -13142,7 +13152,7 @@ const CustomRender = (props) => {
13142
13152
  ) })
13143
13153
  ] });
13144
13154
  };
13145
- const defaultProps$11 = {
13155
+ const defaultProps$12 = {
13146
13156
  ...ComponentDefaults,
13147
13157
  modelValue: false,
13148
13158
  modelSelect: [],
@@ -13193,7 +13203,7 @@ const Address = (props) => {
13193
13203
  className,
13194
13204
  ...rest
13195
13205
  } = {
13196
- ...defaultProps$11,
13206
+ ...defaultProps$12,
13197
13207
  ...props
13198
13208
  };
13199
13209
  const b = cn("address");
@@ -13351,7 +13361,7 @@ const Address = (props) => {
13351
13361
  }
13352
13362
  ) });
13353
13363
  };
13354
- Address.defaultProps = defaultProps$11;
13364
+ Address.defaultProps = defaultProps$12;
13355
13365
  Address.displayName = "NutAddress";
13356
13366
  const Utils = {
13357
13367
  /**
@@ -13471,7 +13481,7 @@ const Utils = {
13471
13481
  return false;
13472
13482
  }
13473
13483
  };
13474
- const defaultProps$10 = {
13484
+ const defaultProps$11 = {
13475
13485
  type: "one",
13476
13486
  isAutoBackFill: false,
13477
13487
  poppable: true,
@@ -13523,7 +13533,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
13523
13533
  onUpdate,
13524
13534
  onSelected,
13525
13535
  onYearMonthChange
13526
- } = { ...defaultProps$10, ...props };
13536
+ } = { ...defaultProps$11, ...props };
13527
13537
  const weeks = locale.calendaritem.weekdays;
13528
13538
  const [yearMonthTitle, setYearMonthTitle] = useState("");
13529
13539
  const [monthsData, setMonthsData] = useState([]);
@@ -14119,9 +14129,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
14119
14129
  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
14130
  ] }) });
14121
14131
  });
14122
- CalendarItem.defaultProps = defaultProps$10;
14132
+ CalendarItem.defaultProps = defaultProps$11;
14123
14133
  CalendarItem.displayName = "NutCalendarItem";
14124
- const defaultProps$$ = {
14134
+ const defaultProps$10 = {
14125
14135
  type: "one",
14126
14136
  isAutoBackFill: false,
14127
14137
  poppable: true,
@@ -14176,7 +14186,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
14176
14186
  onChoose,
14177
14187
  onSelected,
14178
14188
  onYearMonthChange
14179
- } = { ...defaultProps$$, ...props };
14189
+ } = { ...defaultProps$10, ...props };
14180
14190
  const calendarRef = useRef(null);
14181
14191
  const close = () => {
14182
14192
  onClose && onClose();
@@ -14246,9 +14256,9 @@ const Calendar = React__default.forwardRef((props, ref) => {
14246
14256
  }
14247
14257
  ) : renderItem() });
14248
14258
  });
14249
- Calendar.defaultProps = defaultProps$$;
14259
+ Calendar.defaultProps = defaultProps$10;
14250
14260
  Calendar.displayName = "NutCalendar";
14251
- const defaultProps$_ = {
14261
+ const defaultProps$$ = {
14252
14262
  data: {
14253
14263
  text: "",
14254
14264
  value: "",
@@ -14259,32 +14269,37 @@ const defaultProps$_ = {
14259
14269
  },
14260
14270
  activeColor: "",
14261
14271
  checked: false,
14262
- checkedIcon: "checklist",
14272
+ activeIcon: "checklist",
14263
14273
  chooseItem: () => {
14264
14274
  }
14265
14275
  };
14266
14276
  const InternalCascaderItem = (props, ref) => {
14267
- const { data, checked, checkedIcon, chooseItem, activeColor } = {
14268
- ...defaultProps$_,
14277
+ const { data, checked, activeIcon, chooseItem, activeColor } = {
14278
+ ...defaultProps$$,
14269
14279
  ...props
14270
14280
  };
14271
- const b = cn("cascader-item");
14281
+ const classPrefix2 = "nut-cascader-item";
14272
14282
  const classes = classNames(
14273
14283
  {
14274
14284
  active: checked,
14275
14285
  disabled: data.disabled
14276
14286
  },
14277
- b("")
14287
+ classPrefix2
14278
14288
  );
14279
14289
  const classesTitle = classNames({
14280
- [`${b("")}__title`]: true
14290
+ [`${classPrefix2}__title`]: true
14281
14291
  });
14282
14292
  const renderIcon = () => {
14283
14293
  if (checked) {
14284
- if (isValidElement(checkedIcon)) {
14285
- return checkedIcon;
14294
+ if (isValidElement(activeIcon)) {
14295
+ return activeIcon;
14286
14296
  }
14287
- return /* @__PURE__ */ jsxRuntimeExports.jsx(x$c, { className: `${checked ? b("icon-check") : ""}` });
14297
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
14298
+ x$c,
14299
+ {
14300
+ className: `${checked ? `${classPrefix2}__icon-check` : ""}`
14301
+ }
14302
+ );
14288
14303
  }
14289
14304
  return null;
14290
14305
  };
@@ -14304,7 +14319,7 @@ const InternalCascaderItem = (props, ref) => {
14304
14319
  );
14305
14320
  };
14306
14321
  const CascaderItem = React__default.forwardRef(InternalCascaderItem);
14307
- CascaderItem.defaultProps = defaultProps$_;
14322
+ CascaderItem.defaultProps = defaultProps$$;
14308
14323
  CascaderItem.displayName = "NutCascaderItem";
14309
14324
  const formatTree = (tree, parent, config2) => tree.map((node) => {
14310
14325
  const {
@@ -14442,26 +14457,22 @@ class Tree {
14442
14457
  }
14443
14458
  }
14444
14459
  const Tree$1 = Tree;
14445
- const defaultProps$Z = {
14446
- className: "",
14447
- style: {},
14460
+ const defaultProps$_ = {
14461
+ ...ComponentDefaults,
14448
14462
  activeColor: "",
14449
- checkedIcon: "checklist",
14450
- tabsColor: "",
14451
- poppable: true,
14463
+ activeIcon: "checklist",
14464
+ popup: true,
14452
14465
  visible: false,
14453
14466
  options: [],
14454
14467
  value: [],
14455
14468
  title: "",
14456
- textKey: "text",
14457
- valueKey: "value",
14458
- childrenKey: "children",
14459
- convertConfig: {},
14469
+ optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" },
14470
+ format: {},
14460
14471
  closeable: false,
14461
14472
  closeIconPosition: "top-right",
14462
14473
  closeIcon: "close",
14463
14474
  lazy: false,
14464
- lazyLoad: () => {
14475
+ onLoad: () => {
14465
14476
  },
14466
14477
  onClose: () => {
14467
14478
  },
@@ -14475,28 +14486,25 @@ const InternalCascader = (props, ref) => {
14475
14486
  const {
14476
14487
  className,
14477
14488
  style,
14478
- tabsColor,
14479
- poppable,
14489
+ popup,
14480
14490
  visible,
14481
14491
  options: options2,
14482
14492
  value,
14483
14493
  title,
14484
- textKey,
14485
- valueKey,
14486
- childrenKey,
14487
- convertConfig: convertConfig2,
14494
+ optionKey: optionKey2,
14495
+ format: format2,
14488
14496
  closeable,
14489
14497
  closeIconPosition,
14490
14498
  closeIcon,
14491
14499
  lazy,
14492
- lazyLoad,
14500
+ onLoad,
14493
14501
  onClose,
14494
14502
  onChange,
14495
14503
  onPathChange
14496
- } = { ...defaultProps$Z, ...props };
14504
+ } = { ...defaultProps$_, ...props };
14497
14505
  const [tabvalue, setTabvalue] = useState("c1");
14498
14506
  const [optionsData, setOptionsData] = useState([]);
14499
- const isLazy = () => state.configs.lazy && Boolean(state.configs.lazyLoad);
14507
+ const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
14500
14508
  const [state] = useState({
14501
14509
  optionsData: [],
14502
14510
  panes: [
@@ -14514,44 +14522,38 @@ const InternalCascader = (props, ref) => {
14514
14522
  currentProcessNode: [],
14515
14523
  configs: {
14516
14524
  lazy,
14517
- lazyLoad,
14518
- valueKey,
14519
- textKey,
14520
- childrenKey,
14521
- convertConfig: convertConfig2
14525
+ onLoad,
14526
+ optionKey: optionKey2,
14527
+ format: format2
14522
14528
  },
14523
14529
  lazyLoadMap: /* @__PURE__ */ new Map()
14524
14530
  });
14525
- const b = cn("cascader");
14526
- const classes = classNames(b(""));
14531
+ const classPrefix2 = classNames(`nut-cascader`);
14527
14532
  const classesPane = classNames({
14528
- [`${b("")}-pane`]: true
14533
+ [`${classPrefix2}-pane`]: true
14529
14534
  });
14530
14535
  useEffect(() => {
14531
14536
  initData();
14532
- }, []);
14537
+ }, [options2]);
14533
14538
  useEffect(() => {
14534
14539
  if (value !== state.innerValue) {
14535
14540
  state.innerValue = value;
14536
14541
  }
14537
14542
  }, [value]);
14538
- useEffect(() => {
14539
- initData();
14540
- }, [options2]);
14541
14543
  const initData = async () => {
14542
14544
  state.lazyLoadMap.clear();
14543
- if (convertConfig2 && Object.keys(convertConfig2).length > 0) {
14545
+ if (format2 && Object.keys(format2).length > 0) {
14544
14546
  state.optionsData = convertListToOptions(
14545
14547
  options2,
14546
- convertConfig2
14548
+ format2
14547
14549
  );
14548
14550
  } else {
14549
14551
  state.optionsData = options2;
14550
14552
  }
14551
14553
  state.tree = new Tree$1(state.optionsData, {
14552
- value: state.configs.valueKey,
14553
- text: state.configs.textKey,
14554
- children: state.configs.childrenKey
14554
+ value: state.configs.optionKey.valueKey,
14555
+ text: state.configs.optionKey.textKey,
14556
+ children: state.configs.optionKey.childrenKey
14555
14557
  });
14556
14558
  if (isLazy() && !state.tree.nodes.length) {
14557
14559
  await invokeLazyLoad({
@@ -14617,7 +14619,7 @@ const InternalCascader = (props, ref) => {
14617
14619
  if (!node) {
14618
14620
  return;
14619
14621
  }
14620
- if (!state.configs.lazyLoad) {
14622
+ if (!state.configs.onLoad) {
14621
14623
  node.leaf = true;
14622
14624
  return;
14623
14625
  }
@@ -14630,7 +14632,7 @@ const InternalCascader = (props, ref) => {
14630
14632
  if (!lazyLoadPromise) {
14631
14633
  lazyLoadPromise = new Promise((resolve) => {
14632
14634
  var _a2, _b;
14633
- (_b = (_a2 = state.configs).lazyLoad) == null ? void 0 : _b.call(_a2, node, resolve);
14635
+ (_b = (_a2 = state.configs).onLoad) == null ? void 0 : _b.call(_a2, node, resolve);
14634
14636
  });
14635
14637
  state.lazyLoadMap.set(node, lazyLoadPromise);
14636
14638
  }
@@ -14677,8 +14679,8 @@ const InternalCascader = (props, ref) => {
14677
14679
  selectedNode: null,
14678
14680
  paneKey: `c${state.tabsCursor + 1}`
14679
14681
  });
14680
- setTabvalue(`c${state.tabsCursor + 1}`);
14681
14682
  setOptionsData(state.panes);
14683
+ setTabvalue(`c${state.tabsCursor + 1}`);
14682
14684
  if (!type4) {
14683
14685
  const pathNodes = state.panes.map((item) => item.selectedNode);
14684
14686
  const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
@@ -14698,8 +14700,8 @@ const InternalCascader = (props, ref) => {
14698
14700
  setOptionsData(state.panes);
14699
14701
  };
14700
14702
  const renderItem = () => {
14701
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classes} ${className}`, style, children: [
14702
- poppable && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("title"), children: title }),
14703
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2} ${className}`, style, children: [
14704
+ popup && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-cascader__title", children: title }),
14703
14705
  /* @__PURE__ */ jsxRuntimeExports.jsx(
14704
14706
  Tabs,
14705
14707
  {
@@ -14714,27 +14716,21 @@ const InternalCascader = (props, ref) => {
14714
14716
  setTabvalue(pane.paneKey);
14715
14717
  state.tabsCursor = index;
14716
14718
  },
14717
- className: `nut-tabs__titles-item ${tabvalue === pane.paneKey ? "active" : ""}`,
14719
+ className: `nut-tabs__titles-item ${tabvalue === pane.paneKey ? "nut-tabs__titles-item--active" : ""}`,
14718
14720
  children: [
14719
14721
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "nut-tabs__titles-item__text", children: [
14720
14722
  !state.initLoading && state.panes.length && ((_a2 = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _a2.text),
14721
14723
  !state.initLoading && state.panes.length && !((_b = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _b.text) && "请选择",
14722
14724
  !(!state.initLoading && state.panes.length) && "Loading..."
14723
14725
  ] }),
14724
- /* @__PURE__ */ jsxRuntimeExports.jsx(
14725
- "span",
14726
- {
14727
- className: "nut-tabs__titles-item__line",
14728
- style: { background: tabsColor }
14729
- }
14730
- )
14726
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "nut-tabs__titles-item__line" })
14731
14727
  ]
14732
14728
  },
14733
14729
  pane.paneKey
14734
14730
  );
14735
14731
  });
14736
14732
  },
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) => {
14733
+ 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
14734
  var _a2;
14739
14735
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14740
14736
  CascaderItem,
@@ -14746,15 +14742,14 @@ const InternalCascader = (props, ref) => {
14746
14742
  },
14747
14743
  index
14748
14744
  );
14749
- }) }) }, pane.paneKey)) : /* @__PURE__ */ jsxRuntimeExports.jsx(TabPane, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane }) })
14745
+ }) }) }, pane.paneKey)) : /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs.TabPane, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane }) })
14750
14746
  }
14751
14747
  )
14752
14748
  ] });
14753
14749
  };
14754
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: poppable ? /* @__PURE__ */ jsxRuntimeExports.jsx(
14750
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: popup ? /* @__PURE__ */ jsxRuntimeExports.jsx(
14755
14751
  Popup,
14756
14752
  {
14757
- className: "cascadar-popup",
14758
14753
  visible,
14759
14754
  position: "bottom",
14760
14755
  round: true,
@@ -14768,11 +14763,11 @@ const InternalCascader = (props, ref) => {
14768
14763
  ) : renderItem() });
14769
14764
  };
14770
14765
  const Cascader = React__default.forwardRef(InternalCascader);
14771
- Cascader.defaultProps = defaultProps$Z;
14766
+ Cascader.defaultProps = defaultProps$_;
14772
14767
  Cascader.displayName = "NutCascader";
14773
14768
  const CheckboxGroupContext = createContext(null);
14774
14769
  const Context = CheckboxGroupContext;
14775
- const defaultProps$Y = {
14770
+ const defaultProps$Z = {
14776
14771
  max: void 0,
14777
14772
  labelPosition: "right",
14778
14773
  direction: "vertical",
@@ -14783,7 +14778,7 @@ const defaultProps$Y = {
14783
14778
  const classPrefix$9 = "nut-checkboxgroup";
14784
14779
  const CheckboxGroup = React__default.forwardRef(
14785
14780
  (props, ref) => {
14786
- const { children } = { ...defaultProps$Y, ...props };
14781
+ const { children } = { ...defaultProps$Z, ...props };
14787
14782
  const {
14788
14783
  className,
14789
14784
  disabled,
@@ -14873,9 +14868,9 @@ const CheckboxGroup = React__default.forwardRef(
14873
14868
  );
14874
14869
  }
14875
14870
  );
14876
- CheckboxGroup.defaultProps = defaultProps$Y;
14871
+ CheckboxGroup.defaultProps = defaultProps$Z;
14877
14872
  CheckboxGroup.displayName = "NutCheckboxGroup";
14878
- const defaultProps$X = {
14873
+ const defaultProps$Y = {
14879
14874
  ...ComponentDefaults,
14880
14875
  disabled: false,
14881
14876
  labelPosition: "right",
@@ -14888,7 +14883,7 @@ const defaultProps$X = {
14888
14883
  const classPrefix$8 = "nut-checkbox";
14889
14884
  const Checkbox = (props) => {
14890
14885
  const { children } = {
14891
- ...defaultProps$X,
14886
+ ...defaultProps$Y,
14892
14887
  ...props
14893
14888
  };
14894
14889
  const {
@@ -14993,7 +14988,7 @@ const Checkbox = (props) => {
14993
14988
  }
14994
14989
  );
14995
14990
  };
14996
- Checkbox.defaultProps = defaultProps$X;
14991
+ Checkbox.defaultProps = defaultProps$Y;
14997
14992
  Checkbox.displayName = "NutCheckBox";
14998
14993
  Checkbox.Group = CheckboxGroup;
14999
14994
  const MIN_DISTANCE = 10;
@@ -15061,13 +15056,13 @@ function useTouch() {
15061
15056
  isHorizontal
15062
15057
  };
15063
15058
  }
15064
- const InternalPickerSlot = (props, ref) => {
15059
+ const InternalPickerPanel = (props, ref) => {
15065
15060
  const {
15066
15061
  keyIndex = 0,
15067
15062
  defaultValue,
15068
- listData = [],
15063
+ options: options2 = [],
15069
15064
  threeDimensional = true,
15070
- swipeDuration = 1e3,
15065
+ duration = 1e3,
15071
15066
  chooseItem
15072
15067
  } = props;
15073
15068
  const touch = useTouch();
@@ -15081,9 +15076,8 @@ const InternalPickerSlot = (props, ref) => {
15081
15076
  const rotation = 20;
15082
15077
  const moving = useRef(false);
15083
15078
  let timer;
15084
- useRef(null);
15085
15079
  const rollerRef = useRef(null);
15086
- const pickerSlotRef = useRef(null);
15080
+ const PickerPanelRef = useRef(null);
15087
15081
  const [startTime, setStartTime] = useState(0);
15088
15082
  const [startY, setStartY] = useState(0);
15089
15083
  const transformY = useRef(0);
@@ -15109,8 +15103,8 @@ const InternalPickerSlot = (props, ref) => {
15109
15103
  if (updateMove > 0) {
15110
15104
  updateMove = 0;
15111
15105
  }
15112
- if (updateMove < -(listData.length - 1) * lineSpacing) {
15113
- updateMove = -(listData.length - 1) * lineSpacing;
15106
+ if (updateMove < -(options2.length - 1) * lineSpacing) {
15107
+ updateMove = -(options2.length - 1) * lineSpacing;
15114
15108
  }
15115
15109
  const endMove = Math.round(updateMove / lineSpacing) * lineSpacing;
15116
15110
  const deg = `${(Math.abs(Math.round(endMove / lineSpacing)) + 1) * rotation}deg`;
@@ -15119,7 +15113,7 @@ const InternalPickerSlot = (props, ref) => {
15119
15113
  } else {
15120
15114
  let deg = 0;
15121
15115
  const currentDeg = (-updateMove / lineSpacing + 1) * rotation;
15122
- const maxDeg = (listData.length + 1) * rotation;
15116
+ const maxDeg = (options2.length + 1) * rotation;
15123
15117
  const minDeg = 0;
15124
15118
  deg = Math.min(Math.max(currentDeg, minDeg), maxDeg);
15125
15119
  if (minDeg < deg && deg < maxDeg) {
@@ -15129,7 +15123,7 @@ const InternalPickerSlot = (props, ref) => {
15129
15123
  }
15130
15124
  };
15131
15125
  const setChooseValue = (move) => {
15132
- chooseItem && chooseItem(listData == null ? void 0 : listData[Math.round(-move / lineSpacing)], keyIndex);
15126
+ chooseItem && chooseItem(options2 == null ? void 0 : options2[Math.round(-move / lineSpacing)], keyIndex);
15133
15127
  };
15134
15128
  const touchStart = (event) => {
15135
15129
  touch.start(event);
@@ -15153,7 +15147,7 @@ const InternalPickerSlot = (props, ref) => {
15153
15147
  const moveTime = Date.now() - startTime;
15154
15148
  if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
15155
15149
  const distance = momentum(move, moveTime);
15156
- setMove(distance, "end", +swipeDuration);
15150
+ setMove(distance, "end", +duration);
15157
15151
  } else {
15158
15152
  setMove(move, "end");
15159
15153
  }
@@ -15161,9 +15155,9 @@ const InternalPickerSlot = (props, ref) => {
15161
15155
  touch.reset();
15162
15156
  }, 0);
15163
15157
  };
15164
- const momentum = (distance, duration) => {
15158
+ const momentum = (distance, duration2) => {
15165
15159
  let nDistance = distance;
15166
- const speed = Math.abs(nDistance / duration);
15160
+ const speed = Math.abs(nDistance / duration2);
15167
15161
  nDistance = speed / 3e-3 * (nDistance < 0 ? -1 : 1);
15168
15162
  return nDistance;
15169
15163
  };
@@ -15171,7 +15165,7 @@ const InternalPickerSlot = (props, ref) => {
15171
15165
  const value = val || defaultValue;
15172
15166
  let index = -1;
15173
15167
  if (value) {
15174
- listData.some((item, idx) => {
15168
+ options2.some((item, idx) => {
15175
15169
  if (item.value === value) {
15176
15170
  index = idx;
15177
15171
  return true;
@@ -15179,7 +15173,7 @@ const InternalPickerSlot = (props, ref) => {
15179
15173
  return false;
15180
15174
  });
15181
15175
  } else {
15182
- listData.forEach((item, i) => {
15176
+ options2.forEach((item, i) => {
15183
15177
  if (item.value === defaultValue) {
15184
15178
  index = i;
15185
15179
  }
@@ -15222,7 +15216,7 @@ const InternalPickerSlot = (props, ref) => {
15222
15216
  return () => {
15223
15217
  clearTimeout(timer);
15224
15218
  };
15225
- }, [listData]);
15219
+ }, [options2]);
15226
15220
  useImperativeHandle(ref, () => ({
15227
15221
  stopMomentum,
15228
15222
  moving: moving.current
@@ -15231,7 +15225,7 @@ const InternalPickerSlot = (props, ref) => {
15231
15225
  "div",
15232
15226
  {
15233
15227
  className: "nut-picker-list",
15234
- ref: pickerSlotRef,
15228
+ ref: PickerPanelRef,
15235
15229
  onTouchStart: touchStart,
15236
15230
  onTouchMove: touchMove,
15237
15231
  onTouchEnd: touchEnd,
@@ -15244,7 +15238,7 @@ const InternalPickerSlot = (props, ref) => {
15244
15238
  style: threeDimensional ? touchRollerStyle() : touchTileStyle(),
15245
15239
  onTransitionEnd: stopMomentum,
15246
15240
  children: [
15247
- threeDimensional && listData.map((item, index) => {
15241
+ threeDimensional && options2.map((item, index) => {
15248
15242
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15249
15243
  "div",
15250
15244
  {
@@ -15257,7 +15251,7 @@ const InternalPickerSlot = (props, ref) => {
15257
15251
  item.value ? item.value : index
15258
15252
  );
15259
15253
  }),
15260
- !threeDimensional && listData.map((item, index) => {
15254
+ !threeDimensional && options2.map((item, index) => {
15261
15255
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15262
15256
  "div",
15263
15257
  {
@@ -15276,8 +15270,8 @@ const InternalPickerSlot = (props, ref) => {
15276
15270
  }
15277
15271
  );
15278
15272
  };
15279
- const PickerSlot = React__default.forwardRef(InternalPickerSlot);
15280
- const PickerSlot$1 = PickerSlot;
15273
+ const PickerPanel = React__default.forwardRef(InternalPickerPanel);
15274
+ const PickerPanel$1 = PickerPanel;
15281
15275
  function useRefs() {
15282
15276
  const refs = React__default.useRef([]);
15283
15277
  const setRefs = React__default.useCallback(
@@ -15292,180 +15286,202 @@ function useRefs() {
15292
15286
  }, []);
15293
15287
  return [refs.current, setRefs, reset];
15294
15288
  }
15289
+ const defaultProps$X = {
15290
+ ...ComponentDefaults,
15291
+ visible: false,
15292
+ title: "",
15293
+ options: [],
15294
+ value: [],
15295
+ defaultValue: [],
15296
+ threeDimensional: true,
15297
+ duration: 1e3
15298
+ };
15295
15299
  const InternalPicker = (props, ref) => {
15296
15300
  const { locale } = useConfig();
15297
15301
  const {
15298
15302
  visible,
15299
15303
  title,
15300
- listData = [],
15301
- defaultValueData,
15302
- onConfirm,
15303
- onClose,
15304
- onCloseUpdate,
15305
- onChange,
15304
+ options: options2 = [],
15305
+ defaultValue = [],
15306
15306
  className,
15307
15307
  style,
15308
15308
  threeDimensional,
15309
- swipeDuration,
15309
+ duration,
15310
+ onConfirm,
15311
+ onClose,
15312
+ afterClose,
15313
+ onChange,
15310
15314
  ...rest
15311
- } = props;
15312
- const [chooseValueData, setchooseValueData] = useState([]);
15313
- const [columnIndex, setcolumnIndex] = useState(0);
15315
+ } = { ...defaultProps$X, ...props };
15316
+ const classPrefix2 = "nut-picker";
15317
+ const classes = classNames(classPrefix2, className);
15318
+ const [selectedValue, setSelectedValue] = usePropsValue({
15319
+ value: props.value,
15320
+ defaultValue: [...defaultValue],
15321
+ finalValue: [...defaultValue],
15322
+ onChange: (val) => {
15323
+ var _a2;
15324
+ (_a2 = props.onConfirm) == null ? void 0 : _a2.call(props, setSelectedOptions(), val);
15325
+ }
15326
+ });
15327
+ const [columnIndex, setColumnIndex] = useState(0);
15314
15328
  const pickerRef = useRef(null);
15315
15329
  const [refs, setRefs] = useRefs();
15316
15330
  const [columnsList, setColumnsList] = useState([]);
15317
- const b = cn("picker");
15318
15331
  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());
15332
+ const formatCascade = (columns, values) => {
15333
+ const formatted = [];
15334
+ let columnOptions = {
15335
+ text: "",
15336
+ value: "",
15337
+ children: columns
15338
+ };
15339
+ let columnIndex2 = 0;
15340
+ while (columnOptions && columnOptions.children) {
15341
+ const options22 = columnOptions.children;
15342
+ const value = values[columnIndex2];
15343
+ let index = options22.findIndex(
15344
+ (columnItem) => columnItem.value === value
15345
+ );
15346
+ if (index === -1)
15347
+ index = 0;
15348
+ columnOptions = columnOptions.children[index];
15349
+ columnIndex2++;
15350
+ formatted.push(options22);
15324
15351
  }
15325
- }, [defaultValueData]);
15326
- useEffect(() => {
15327
- onChange && onChange(columnIndex, chooseValueData, selectedOptions());
15328
- if (isConfirmEvent.current) {
15329
- isConfirmEvent.current = false;
15330
- onConfirm && onConfirm(chooseValueData, selectedOptions());
15352
+ return formatted;
15353
+ };
15354
+ const columnsType = () => {
15355
+ const firstColumn = options2[0];
15356
+ if (firstColumn) {
15357
+ if (Array.isArray(firstColumn)) {
15358
+ return "multiple";
15359
+ }
15360
+ if ("children" in firstColumn) {
15361
+ return "cascade";
15362
+ }
15331
15363
  }
15332
- }, [chooseValueData]);
15333
- useEffect(() => {
15334
- init();
15335
- }, [listData]);
15336
- const closeActionSheet = () => {
15337
- onClose && onClose(chooseValueData, selectedOptions());
15338
- onCloseUpdate && onCloseUpdate(chooseValueData, selectedOptions(), pickerRef);
15364
+ return "single";
15339
15365
  };
15340
- const confirm2 = () => {
15341
- let movings = false;
15342
- refs.forEach((_ref) => {
15343
- if (_ref.moving)
15344
- movings = true;
15345
- _ref.stopMomentum();
15366
+ const normalListData = () => {
15367
+ const type4 = columnsType();
15368
+ switch (type4) {
15369
+ case "multiple":
15370
+ return options2;
15371
+ case "cascade":
15372
+ return formatCascade(options2, selectedValue);
15373
+ default:
15374
+ return [options2];
15375
+ }
15376
+ };
15377
+ const init = () => {
15378
+ const normalData = normalListData();
15379
+ setColumnsList(normalData);
15380
+ const data = [];
15381
+ normalData.length > 0 && normalData.map((item) => {
15382
+ item[0] && data.push(item[0].value);
15383
+ return item;
15346
15384
  });
15347
- if (movings) {
15348
- isConfirmEvent.current = true;
15349
- } else {
15350
- onConfirm && onConfirm(chooseValueData, selectedOptions());
15385
+ if (!defaultValue.length && selectedValue.length === 0) {
15386
+ setSelectedValue([...data]);
15351
15387
  }
15352
- onClose && onClose(chooseValueData, selectedOptions());
15353
- setTimeout(() => {
15354
- isConfirmEvent.current = false;
15355
- }, 0);
15356
15388
  };
15357
- const selectedOptions = () => {
15358
- const optins = [];
15359
- columnsList.map((column, index) => {
15360
- let currOptions = [];
15361
- currOptions = column.filter(
15362
- (item) => item.value === chooseValueData[index]
15389
+ useEffect(() => {
15390
+ if (!visible) {
15391
+ return;
15392
+ }
15393
+ init();
15394
+ }, [options2, visible]);
15395
+ const setSelectedOptions = () => {
15396
+ const options22 = [];
15397
+ let currOptions = [];
15398
+ columnsList.forEach((columnOptions, index) => {
15399
+ currOptions = columnOptions.filter(
15400
+ (item) => item.value === selectedValue[index]
15363
15401
  );
15364
15402
  if (currOptions[0]) {
15365
- optins.push(currOptions[0]);
15403
+ options22.push(currOptions[0]);
15366
15404
  } else {
15367
- column[0] && optins.push(column[0]);
15405
+ columnOptions[0] && options22.push(columnOptions[0]);
15368
15406
  }
15369
- return column;
15370
15407
  });
15371
- return optins;
15408
+ return options22;
15372
15409
  };
15373
- const chooseItem = (option, columnIndex2) => {
15374
- if (option && Object.keys(option).length) {
15375
- if (chooseValueData[columnIndex2] !== option.value) {
15410
+ useEffect(() => {
15411
+ if (!visible) {
15412
+ return;
15413
+ }
15414
+ onChange && onChange(setSelectedOptions(), selectedValue, columnIndex);
15415
+ if (isConfirmEvent.current) {
15416
+ isConfirmEvent.current = false;
15417
+ onConfirm && onConfirm(setSelectedOptions(), selectedValue);
15418
+ }
15419
+ }, [selectedValue, columnsList, visible]);
15420
+ const chooseItem = (columnOptions, columnIndex2) => {
15421
+ var _a2, _b;
15422
+ if (columnOptions && Object.keys(columnOptions).length) {
15423
+ if (selectedValue[columnIndex2] !== columnOptions.value) {
15376
15424
  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;
15425
+ selectedValue[columnIndex2] = columnOptions.value || "";
15426
+ setSelectedValue([...selectedValue]);
15427
+ while ((_a2 = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _a2[0]) {
15428
+ selectedValue[columnIndex2 + 1] = columnOptions.children[0].value;
15429
+ setSelectedValue([...selectedValue]);
15430
+ columnIndex2++;
15431
+ columnOptions = columnOptions.children[0];
15387
15432
  }
15388
- if (cursor && cursor.children) {
15389
- chooseValueData[index + 1] = "";
15390
- setchooseValueData([...chooseValueData]);
15433
+ if ((_b = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _b.length) {
15434
+ selectedValue[columnIndex2 + 1] = "";
15435
+ setSelectedValue([...selectedValue]);
15391
15436
  }
15392
15437
  setColumnsList(normalListData());
15393
15438
  } else {
15394
- setchooseValueData((data) => {
15439
+ setSelectedValue((data) => {
15395
15440
  const cdata = [...data];
15396
15441
  cdata[columnIndex2] = Object.prototype.hasOwnProperty.call(
15397
- option,
15442
+ columnOptions,
15398
15443
  "value"
15399
- ) ? option.value : "";
15444
+ ) ? columnOptions.value : "";
15400
15445
  return cdata;
15401
15446
  });
15402
15447
  }
15403
- setcolumnIndex(columnIndex2);
15448
+ setColumnIndex(columnIndex2);
15404
15449
  }
15405
15450
  }
15406
15451
  };
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;
15452
+ const confirm2 = () => {
15453
+ let movings = false;
15454
+ refs.forEach((ref2) => {
15455
+ if (ref2.moving)
15456
+ movings = true;
15457
+ ref2.stopMomentum();
15459
15458
  });
15460
- if (!defaultValueData && chooseValueData.length === 0) {
15461
- setchooseValueData([...data]);
15459
+ if (movings) {
15460
+ isConfirmEvent.current = true;
15461
+ } else {
15462
+ onConfirm && onConfirm(setSelectedOptions(), selectedValue);
15463
+ closePicker();
15462
15464
  }
15465
+ setTimeout(() => {
15466
+ isConfirmEvent.current = false;
15467
+ }, 0);
15468
+ };
15469
+ const closePicker = () => {
15470
+ onClose && onClose(setSelectedOptions(), selectedValue);
15471
+ afterClose && afterClose(setSelectedOptions(), selectedValue, pickerRef);
15463
15472
  };
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 })
15473
+ const renderTitleBar = () => {
15474
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__control`, children: [
15475
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
15476
+ "span",
15477
+ {
15478
+ className: `${classPrefix2}__cancel-btn`,
15479
+ onClick: () => closePicker(),
15480
+ children: locale.cancel
15481
+ }
15482
+ ),
15483
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__title`, children: title || "" }),
15484
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `${classPrefix2}__confirm-btn`, onClick: confirm2, children: locale.confirm })
15469
15485
  ] });
15470
15486
  };
15471
15487
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -15474,20 +15490,20 @@ const InternalPicker = (props, ref) => {
15474
15490
  visible,
15475
15491
  position: "bottom",
15476
15492
  onClose: () => {
15477
- closeActionSheet();
15493
+ closePicker();
15478
15494
  },
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) => {
15495
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes, style, ...rest, children: [
15496
+ renderTitleBar(),
15497
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__panel`, ref: pickerRef, children: columnsList == null ? void 0 : columnsList.map((item, index) => {
15482
15498
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15483
- PickerSlot$1,
15499
+ PickerPanel$1,
15484
15500
  {
15485
15501
  ref: setRefs(index),
15486
- defaultValue: chooseValueData == null ? void 0 : chooseValueData[index],
15487
- listData: item,
15502
+ defaultValue: selectedValue == null ? void 0 : selectedValue[index],
15503
+ options: item,
15488
15504
  threeDimensional,
15489
15505
  chooseItem: (value, index2) => chooseItem(value, index2),
15490
- swipeDuration,
15506
+ duration,
15491
15507
  keyIndex: index
15492
15508
  },
15493
15509
  index
@@ -15538,7 +15554,7 @@ const DatePicker = (props) => {
15538
15554
  const [show, setShow] = useState(false);
15539
15555
  const [currentDate, setCurrentDate] = useState(modelValue);
15540
15556
  const [defaultValue, setDefaultValue] = useState([]);
15541
- const [listData, setListData] = useState([]);
15557
+ const [options2, setListData] = useState([]);
15542
15558
  const pickerRef = useRef(null);
15543
15559
  const isDate = (val) => {
15544
15560
  return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
@@ -15656,7 +15672,7 @@ const DatePicker = (props) => {
15656
15672
  }
15657
15673
  return result;
15658
15674
  };
15659
- const updateChooseValueCustmer = (index, selectedValue, cacheValueData) => {
15675
+ const updateChooseValueCustmer = (cacheValueData, selectedValue, index) => {
15660
15676
  if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
15661
15677
  type4.toLocaleLowerCase()
15662
15678
  )) {
@@ -15695,7 +15711,7 @@ const DatePicker = (props) => {
15695
15711
  const isEqual2 = (currentDate == null ? void 0 : currentDate.getTime()) === (date4 == null ? void 0 : date4.getTime());
15696
15712
  date4 && isDate(date4) && !isEqual2 && setCurrentDate(formatValue(date4));
15697
15713
  }
15698
- props.onChange && props.onChange(index, selectedValue, cacheValueData);
15714
+ props.onChange && props.onChange(cacheValueData, selectedValue, index);
15699
15715
  };
15700
15716
  const padZero = (num, targetLength = 2) => {
15701
15717
  let str = `${num}`;
@@ -15791,16 +15807,16 @@ const DatePicker = (props) => {
15791
15807
  className: `nut-datepicker ${className || ""}`,
15792
15808
  style,
15793
15809
  ...rest,
15794
- children: listData.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
15810
+ children: options2.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
15795
15811
  Picker$1,
15796
15812
  {
15797
15813
  title,
15798
15814
  visible: show,
15799
- listData,
15815
+ options: options2,
15800
15816
  onClose: onCloseDatePicker,
15801
- defaultValueData: defaultValue,
15802
- onConfirm: (values, options2) => onConfirmDatePicker && onConfirmDatePicker(values, options2),
15803
- onChange: (index, value, list) => updateChooseValueCustmer(index, value, list),
15817
+ defaultValue,
15818
+ onConfirm: (options22, values) => onConfirmDatePicker && onConfirmDatePicker(options22, values),
15819
+ onChange: (list, value, index) => updateChooseValueCustmer(list, value, index),
15804
15820
  threeDimensional,
15805
15821
  ref: pickerRef
15806
15822
  }
@@ -19750,144 +19766,120 @@ const Switch = (props) => {
19750
19766
  Switch.defaultProps = defaultProps$H;
19751
19767
  Switch.displayName = "NutSwitch";
19752
19768
  const defaultProps$G = {
19769
+ ...ComponentDefaults,
19753
19770
  defaultValue: "",
19754
- textAlign: "left",
19755
- limitshow: false,
19756
- maxlength: "",
19757
- rows: "",
19771
+ showCount: false,
19772
+ rows: 2,
19773
+ maxLength: 140,
19758
19774
  placeholder: "",
19759
- readonly: false,
19775
+ readOnly: false,
19760
19776
  disabled: false,
19761
- autosize: false
19777
+ autoSize: false
19762
19778
  };
19763
19779
  const TextArea = (props) => {
19764
19780
  const { locale } = useConfig();
19765
19781
  const {
19766
19782
  className,
19783
+ value,
19767
19784
  defaultValue,
19768
- textAlign,
19769
- limitshow,
19770
- maxlength,
19785
+ showCount,
19786
+ maxLength,
19771
19787
  rows,
19772
19788
  placeholder,
19773
- readonly,
19789
+ readOnly,
19774
19790
  disabled,
19775
- autosize,
19791
+ autoSize,
19776
19792
  style,
19777
19793
  onChange,
19778
19794
  onBlur,
19779
- onFocus
19795
+ onFocus,
19796
+ ...rest
19780
19797
  } = { ...defaultProps$G, ...props };
19781
- const textareaBem = cn("textarea");
19782
- const [inputValue, SetInputValue] = useState("");
19798
+ const classPrefix2 = "nut-textarea";
19783
19799
  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));
19800
+ const compositionRef = useRef(false);
19801
+ const format2 = (value2) => {
19802
+ if (maxLength !== void 0 && value2.length > maxLength) {
19803
+ return value2.substring(0, maxLength);
19789
19804
  }
19790
- SetInputValue(initValue);
19791
- if (autosize) {
19792
- setTimeout(() => {
19793
- setContentHeight();
19794
- });
19795
- }
19796
- }, [defaultValue, autosize]);
19805
+ return value2;
19806
+ };
19807
+ const [inputValue, setInputValue] = usePropsValue({
19808
+ value,
19809
+ defaultValue,
19810
+ finalValue: format2(defaultValue),
19811
+ onChange
19812
+ });
19797
19813
  useEffect(() => {
19798
- if (inputValue) {
19799
- if (autosize) {
19800
- setContentHeight();
19801
- }
19814
+ if (autoSize) {
19815
+ setContentHeight();
19802
19816
  }
19803
- }, [inputValue]);
19817
+ }, [autoSize, defaultValue, inputValue]);
19804
19818
  const setContentHeight = () => {
19805
19819
  const textarea = textareaRef.current;
19806
19820
  if (textarea) {
19807
19821
  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
- }
19822
+ const height = textarea == null ? void 0 : textarea.scrollHeight;
19818
19823
  if (height) {
19819
19824
  textarea.style.height = `${height}px`;
19820
19825
  }
19821
19826
  }
19822
19827
  };
19823
- const textChange = (event) => {
19828
+ const handleChange = (event) => {
19824
19829
  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);
19830
+ const value2 = compositionRef.current ? text.value : format2(text.value);
19831
+ setInputValue(value2);
19830
19832
  };
19831
- const textFocus = (event) => {
19833
+ const handleFocus = (event) => {
19832
19834
  if (disabled)
19833
19835
  return;
19834
- if (readonly)
19836
+ if (readOnly)
19835
19837
  return;
19836
19838
  onFocus && onFocus(event);
19837
19839
  };
19838
- const textBlur = (event) => {
19840
+ const handleBlur = (event) => {
19839
19841
  if (disabled)
19840
19842
  return;
19841
- if (readonly)
19843
+ if (readOnly)
19842
19844
  return;
19843
- const text = event.target;
19844
- onChange && onChange(text.value, event);
19845
19845
  onBlur && onBlur(event);
19846
19846
  };
19847
- const startComposing = () => {
19848
- compositingRef.current = true;
19849
- };
19850
- const endComposing = () => {
19851
- compositingRef.current = false;
19852
- };
19853
19847
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
19854
19848
  "div",
19855
19849
  {
19856
- className: `${textareaBem()} ${disabled ? textareaBem("disabled") : ""} ${className || ""}`,
19850
+ className: classNames(classPrefix2, className, {
19851
+ [`${classPrefix2}__disabled`]: disabled
19852
+ }),
19857
19853
  children: [
19858
19854
  /* @__PURE__ */ jsxRuntimeExports.jsx(
19859
19855
  "textarea",
19860
19856
  {
19861
19857
  ref: textareaRef,
19862
- className: textareaBem("textarea"),
19863
- style: {
19864
- textAlign,
19865
- ...style
19866
- },
19858
+ className: `${classPrefix2}__textarea`,
19859
+ style,
19867
19860
  disabled,
19868
- readOnly: readonly,
19861
+ readOnly,
19869
19862
  value: inputValue,
19870
- onChange: (e) => {
19871
- textChange(e);
19872
- },
19873
- onBlur: (e) => {
19874
- textBlur(e);
19863
+ onChange: (e) => handleChange(e),
19864
+ onBlur: (e) => handleBlur(e),
19865
+ onFocus: (e) => handleFocus(e),
19866
+ onCompositionEnd: () => {
19867
+ compositionRef.current = false;
19875
19868
  },
19876
- onFocus: (e) => {
19877
- textFocus(e);
19869
+ onCompositionStart: () => {
19870
+ compositionRef.current = true;
19878
19871
  },
19879
- onCompositionEnd: (e) => endComposing(),
19880
- onCompositionStart: (e) => startComposing(),
19881
19872
  rows,
19882
- maxLength: maxlength < 0 ? 0 : maxlength,
19883
- placeholder: placeholder || locale.placeholder
19873
+ maxLength: maxLength === -1 ? void 0 : maxLength,
19874
+ placeholder: placeholder || locale.placeholder,
19875
+ ...rest
19884
19876
  }
19885
19877
  ),
19886
- limitshow ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: textareaBem("limit"), children: [
19887
- [...inputValue].length,
19878
+ showCount && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__limit`, children: [
19879
+ inputValue.length,
19888
19880
  "/",
19889
- maxlength < 0 ? 0 : maxlength
19890
- ] }) : null
19881
+ maxLength < 0 ? 0 : maxLength
19882
+ ] })
19891
19883
  ]
19892
19884
  }
19893
19885
  );
@@ -25070,13 +25062,11 @@ Steps.defaultProps = defaultProps$9;
25070
25062
  Steps.displayName = "NutSteps";
25071
25063
  const defaultProps$8 = {
25072
25064
  ...ComponentDefaults,
25073
- className: "",
25074
- style: {},
25075
25065
  columns: [],
25076
25066
  data: [],
25077
25067
  bordered: true,
25078
25068
  striped: false,
25079
- noData: "无数据",
25069
+ noData: "",
25080
25070
  sorterIcon: null,
25081
25071
  showHeader: true
25082
25072
  };
@@ -25093,9 +25083,9 @@ const Table = (props) => {
25093
25083
  summary,
25094
25084
  striped,
25095
25085
  noData,
25096
- onSorter,
25097
25086
  sorterIcon,
25098
25087
  showHeader,
25088
+ onSort,
25099
25089
  ...rest
25100
25090
  } = {
25101
25091
  ...defaultProps$8,
@@ -25107,12 +25097,13 @@ const Table = (props) => {
25107
25097
  setCurData(data);
25108
25098
  }
25109
25099
  }, [data]);
25110
- const b = cn("table");
25111
- const classes = classNames({});
25112
- const cls = classNames(b(), classes, className);
25100
+ const classPrefix2 = "nut-table";
25101
+ const headerClassPrefix = `${classPrefix2}__main__head__tr`;
25102
+ const bodyClassPrefix = `${classPrefix2}__main__body__tr`;
25103
+ const cls = classNames(classPrefix2, className);
25113
25104
  const handleSorterClick = (item) => {
25114
25105
  if (item.sorter) {
25115
- onSorter && onSorter(item, curData);
25106
+ onSort && onSort(item, curData);
25116
25107
  if (typeof item.sorter === "function") {
25117
25108
  setCurData(curData.sort(item.sorter));
25118
25109
  } else {
@@ -25122,8 +25113,8 @@ const Table = (props) => {
25122
25113
  };
25123
25114
  const cellClasses = (item) => {
25124
25115
  return {
25125
- "nut-table__main__head__tr--border": props.bordered,
25126
- [`nut-table__main__head__tr--align${item.align ? item.align : ""}`]: true
25116
+ [`${headerClassPrefix}--border`]: props.bordered,
25117
+ [`${headerClassPrefix}--align${item.align ? item.align : ""}`]: true
25127
25118
  };
25128
25119
  };
25129
25120
  const getColumnItem = (value) => {
@@ -25134,10 +25125,7 @@ const Table = (props) => {
25134
25125
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
25135
25126
  "span",
25136
25127
  {
25137
- className: classNames(
25138
- "nut-table__main__head__tr__th",
25139
- cellClasses(item)
25140
- ),
25128
+ className: classNames(`${headerClassPrefix}__th`, cellClasses(item)),
25141
25129
  onClick: () => handleSorterClick(item),
25142
25130
  children: [
25143
25131
  item.title,
@@ -25160,7 +25148,7 @@ const Table = (props) => {
25160
25148
  "span",
25161
25149
  {
25162
25150
  className: classNames(
25163
- "nut-table__main__body__tr__td",
25151
+ `${bodyClassPrefix}__td`,
25164
25152
  cellClasses(getColumnItem(value))
25165
25153
  ),
25166
25154
  children: typeof item[value] === "function" || typeof render2 === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: render2 ? render2(item) : item[value](item) }) : item[value]
@@ -25171,24 +25159,23 @@ const Table = (props) => {
25171
25159
  };
25172
25160
  const renderBoyTrs = () => {
25173
25161
  return curData.map((item, index) => {
25174
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__main__body__tr", children: renderBodyTds(item) }, index);
25162
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: bodyClassPrefix, children: renderBodyTds(item) }, index);
25175
25163
  });
25176
25164
  };
25177
25165
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cls, style, ...rest, children: [
25178
25166
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
25179
25167
  "div",
25180
25168
  {
25181
- className: classNames("nut-table__main", {
25182
- "nut-table__main--striped": striped
25169
+ className: classNames(`${classPrefix2}__main`, {
25170
+ [`${classPrefix2}__main--striped`]: striped
25183
25171
  }),
25184
25172
  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() })
25173
+ showHeader && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__main__head`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: headerClassPrefix, children: renderHeadCells() }) }),
25174
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__main__body`, children: renderBoyTrs() })
25187
25175
  ]
25188
25176
  }
25189
25177
  ),
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 }) }) })
25178
+ (summary || curData.length === 0) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__summary`, children: summary || noData })
25192
25179
  ] });
25193
25180
  };
25194
25181
  Table.defaultProps = defaultProps$8;