@nutui/nutui-react 2.7.6 → 2.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +29 -7
  2. package/dist/esm/Address/style/style.css +1 -1
  3. package/dist/esm/Animate/style/style.css +1 -1
  4. package/dist/esm/Animate.js +6 -9
  5. package/dist/esm/Calendar/style/style.css +1 -1
  6. package/dist/esm/Calendar.js +2 -2
  7. package/dist/esm/CalendarCard.js +4 -4
  8. package/dist/esm/CalendarItem.js +177 -180
  9. package/dist/esm/Cascader/style/style.css +1 -1
  10. package/dist/esm/DatePicker.js +8 -0
  11. package/dist/esm/Empty.js +1 -1
  12. package/dist/esm/Form.js +2 -1
  13. package/dist/esm/TabPane.js +1 -1
  14. package/dist/esm/Tabs/style/style.css +1 -1
  15. package/dist/esm/date.js +109 -181
  16. package/dist/esm/formitem2.js +121 -31
  17. package/dist/esm/tabs2.js +26 -42
  18. package/dist/locales/base.js +1 -1
  19. package/dist/locales/en-US.js +1 -1
  20. package/dist/locales/id-ID.js +1 -1
  21. package/dist/locales/tr-TR.js +1 -1
  22. package/dist/locales/zh-CN.js +1 -1
  23. package/dist/locales/zh-TW.js +1 -1
  24. package/dist/locales/zh-UG.js +1 -1
  25. package/dist/nutui.react.es.js +477 -517
  26. package/dist/nutui.react.umd.js +477 -517
  27. package/dist/packages/animate/animate.scss +63 -105
  28. package/dist/packages/calendar/calendar.scss +9 -9
  29. package/dist/packages/tabs/tabs.scss +72 -115
  30. package/dist/style.css +1 -1
  31. package/dist/types/packages/animate/animate.taro.d.ts +2 -1
  32. package/dist/types/packages/form/__tests__/merge.spec.d.ts +1 -0
  33. package/dist/types/packages/form/index.d.ts +2 -1
  34. package/dist/types/packages/form/index.taro.d.ts +2 -1
  35. package/dist/types/packages/form/useform.d.ts +2 -1
  36. package/dist/types/packages/form/useform.taro.d.ts +2 -1
  37. package/dist/types/utils/date.d.ts +54 -52
  38. package/dist/types/utils/merge.d.ts +14 -1
  39. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.nutui = {}, global2.React, global2.ReactDOM));
3
3
  })(this, function(exports2, React, ReactDOM) {
4
4
  "use strict";/*!
5
- * @nutui/nutui-react v2.7.6 Fri Jan 10 2025 10:41:29 GMT+0800 (China Standard Time)
5
+ * @nutui/nutui-react v2.7.8 Fri Feb 14 2025 16:19:28 GMT+0800 (China Standard Time)
6
6
  * (c) 2023 @jdf2e.
7
7
  * Released under the MIT License.
8
8
  */
@@ -3171,7 +3171,7 @@
3171
3171
  height: 0
3172
3172
  };
3173
3173
  };
3174
- function useWatch(dep, callback, config2 = { immediate: false }) {
3174
+ function useWatch$1(dep, callback, config2 = { immediate: false }) {
3175
3175
  const { immediate } = config2;
3176
3176
  const prev = React.useRef();
3177
3177
  const inited = React.useRef(false);
@@ -3301,7 +3301,7 @@
3301
3301
  });
3302
3302
  setIsFixed(fixed.fixed);
3303
3303
  }, [position, threshold, container]);
3304
- useWatch(isFixed, () => {
3304
+ useWatch$1(isFixed, () => {
3305
3305
  onChange && onChange(isFixed);
3306
3306
  });
3307
3307
  React.useEffect(() => {
@@ -5308,7 +5308,7 @@
5308
5308
  num: (a) => typeof a === "number",
5309
5309
  und: (a) => a === void 0
5310
5310
  };
5311
- function isEqual(a, b) {
5311
+ function isEqual$1(a, b) {
5312
5312
  if (is.arr(a)) {
5313
5313
  if (!is.arr(b) || a.length !== b.length) return false;
5314
5314
  for (let i2 = 0; i2 < a.length; i2++) {
@@ -7172,12 +7172,12 @@
7172
7172
  to2 = from;
7173
7173
  }
7174
7174
  if (props.reverse) [to2, from] = [from, to2];
7175
- const hasFromChanged = !isEqual(from, prevFrom);
7175
+ const hasFromChanged = !isEqual$1(from, prevFrom);
7176
7176
  if (hasFromChanged) {
7177
7177
  anim.from = from;
7178
7178
  }
7179
7179
  from = getFluidValue(from);
7180
- const hasToChanged = !isEqual(to2, prevTo);
7180
+ const hasToChanged = !isEqual$1(to2, prevTo);
7181
7181
  if (hasToChanged) {
7182
7182
  this._focus(to2);
7183
7183
  }
@@ -7218,10 +7218,10 @@
7218
7218
  if (!started) {
7219
7219
  const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;
7220
7220
  if (hasToChanged || hasValueChanged) {
7221
- finished = isEqual(computeGoal(value), goal);
7221
+ finished = isEqual$1(computeGoal(value), goal);
7222
7222
  started = !finished;
7223
7223
  }
7224
- if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) {
7224
+ if (!isEqual$1(anim.immediate, immediate) && !immediate || !isEqual$1(config2.decay, decay) || !isEqual$1(config2.velocity, velocity)) {
7225
7225
  started = true;
7226
7226
  }
7227
7227
  }
@@ -7312,7 +7312,7 @@
7312
7312
  const value = getFluidValue(arg);
7313
7313
  if (!is.und(value)) {
7314
7314
  const oldNode = getAnimated(this);
7315
- if (!oldNode || !isEqual(value, oldNode.getValue())) {
7315
+ if (!oldNode || !isEqual$1(value, oldNode.getValue())) {
7316
7316
  const nodeType = getAnimatedType(value);
7317
7317
  if (!oldNode || oldNode.constructor != nodeType) {
7318
7318
  setAnimated(this, nodeType.create(value));
@@ -7389,7 +7389,7 @@
7389
7389
  function checkFinished(target, to2) {
7390
7390
  const goal = computeGoal(to2);
7391
7391
  const value = computeGoal(target.get());
7392
- return isEqual(value, goal);
7392
+ return isEqual$1(value, goal);
7393
7393
  }
7394
7394
  function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) {
7395
7395
  let loopRet = callProp(loop2);
@@ -7963,7 +7963,7 @@
7963
7963
  advance(_dt) {
7964
7964
  const value = this._get();
7965
7965
  const oldValue = this.get();
7966
- if (!isEqual(value, oldValue)) {
7966
+ if (!isEqual$1(value, oldValue)) {
7967
7967
  getAnimated(this).setValue(value);
7968
7968
  this._onChange(value, this.idle);
7969
7969
  }
@@ -9222,7 +9222,7 @@
9222
9222
  autoHeightClassName,
9223
9223
  className
9224
9224
  );
9225
- return children ? /* @__PURE__ */ React.createElement("div", { className: classes }, !disabled && children) : null;
9225
+ return children && /* @__PURE__ */ React.createElement("div", { className: classes }, !disabled && children);
9226
9226
  };
9227
9227
  const defaultProps$17 = {
9228
9228
  ...ComponentDefaults,
@@ -9252,39 +9252,30 @@
9252
9252
  value: outerValue,
9253
9253
  defaultValue: outerDefaultValue,
9254
9254
  ...rest
9255
- } = {
9256
- ...defaultProps$17,
9257
- ...props
9258
- };
9255
+ } = { ...defaultProps$17, ...props };
9259
9256
  const [value, setValue] = usePropsValue({
9260
9257
  value: outerValue,
9261
9258
  defaultValue: outerDefaultValue,
9262
- finalValue: 0,
9263
9259
  onChange
9264
9260
  });
9265
9261
  const titleItemsRef = React.useRef([]);
9266
9262
  const navRef = React.useRef(null);
9267
- const scrollDirection = (nav, to2, duration2, direction2) => {
9268
- let count = 0;
9269
- const from = direction2 === "horizontal" ? nav.scrollLeft : nav.scrollTop;
9263
+ const scrollDirection = (nav, to2, duration2) => {
9264
+ const from = direction === "horizontal" ? nav.scrollLeft : nav.scrollTop;
9270
9265
  const frames = Math.round(duration2 * 1e3 / 16);
9271
- function animate() {
9272
- if (direction2 === "horizontal") {
9273
- nav.scrollLeft += (to2 - from) / frames;
9274
- } else {
9275
- nav.scrollTop += (to2 - from) / frames;
9276
- }
9277
- if (++count < frames) {
9278
- requestAniFrame$1(animate);
9279
- }
9280
- }
9266
+ let count = 0;
9267
+ const animate = () => {
9268
+ if (direction === "horizontal") nav.scrollLeft += (to2 - from) / frames;
9269
+ else nav.scrollTop += (to2 - from) / frames;
9270
+ if (++count < frames) requestAniFrame$1(animate);
9271
+ };
9281
9272
  animate();
9282
9273
  };
9283
9274
  const scrollIntoView = (index, immediate) => {
9284
9275
  const nav = navRef.current;
9285
9276
  const titleItem = titleItemsRef.current;
9286
9277
  const titlesLength = titles.current.length;
9287
- const itemLength = titleItemsRef.current.length;
9278
+ const itemLength = titleItem.length;
9288
9279
  if (!nav || !titleItem || !titleItem[itemLength - titlesLength + index]) {
9289
9280
  return;
9290
9281
  }
@@ -9296,13 +9287,13 @@
9296
9287
  } else {
9297
9288
  to2 = title2.offsetLeft - (nav.offsetWidth - title2.offsetWidth) / 2;
9298
9289
  }
9299
- scrollDirection(nav, to2, 0.3, direction);
9290
+ scrollDirection(nav, to2, 0.3);
9300
9291
  };
9301
9292
  const getTitles = () => {
9302
9293
  const titles2 = [];
9303
9294
  React.Children.forEach(children, (child, idx) => {
9304
9295
  if (React.isValidElement(child)) {
9305
- const props2 = child == null ? void 0 : child.props;
9296
+ const { props: props2 } = child;
9306
9297
  if ((props2 == null ? void 0 : props2.title) || (props2 == null ? void 0 : props2.value)) {
9307
9298
  titles2.push({
9308
9299
  title: props2.title,
@@ -9337,23 +9328,18 @@
9337
9328
  );
9338
9329
  const classesTitle = classNames(`${classPrefix$j}-titles`, {
9339
9330
  [`${classPrefix$j}-titles-${activeType}`]: activeType,
9340
- [`${classPrefix$j}-titles-scrollable`]: true,
9341
9331
  [`${classPrefix$j}-titles-${align}`]: align
9342
9332
  });
9343
- const tabsActiveStyle = {
9344
- color: activeType === "smile" ? activeColor : "",
9345
- background: activeType === "line" ? activeColor : ""
9346
- };
9347
9333
  const getContentStyle = () => {
9348
- let index = titles.current.findIndex((t) => t.value == value);
9334
+ let index = titles.current.findIndex((t) => t.value === value);
9349
9335
  index = index < 0 ? 0 : index;
9350
9336
  return {
9351
- transform: direction === "horizontal" ? `translate3d(${rtl ? "" : "-"}${index * 100}%, 0, 0)` : `translate3d( 0,-${index * 100}%, 0)`,
9337
+ transform: direction === "horizontal" ? `translate3d(${rtl ? "" : "-"}${index * 100}%, 0, 0)` : `translate3d( 0, -${index * 100}%, 0)`,
9352
9338
  transitionDuration: `${duration}ms`
9353
9339
  };
9354
9340
  };
9355
9341
  React.useEffect(() => {
9356
- let index = titles.current.findIndex((t) => t.value == value);
9342
+ let index = titles.current.findIndex((t) => t.value === value);
9357
9343
  index = index < 0 ? 0 : index;
9358
9344
  setTimeout(() => {
9359
9345
  scrollIntoView(index);
@@ -9361,69 +9347,55 @@
9361
9347
  }, [value]);
9362
9348
  const tabChange = (item) => {
9363
9349
  onClick && onClick(item.value);
9364
- if (item.disabled) {
9365
- return;
9350
+ if (!item.disabled) {
9351
+ setValue(item.value);
9366
9352
  }
9367
- setValue(item.value);
9368
9353
  };
9369
- return /* @__PURE__ */ React.createElement("div", { className: classes, ...rest }, /* @__PURE__ */ React.createElement("div", { className: classesTitle, style: { ...tabStyle }, ref: navRef }, !!title && typeof title === "function" ? title() : titles.current.map((item) => {
9354
+ return /* @__PURE__ */ React.createElement("div", { className: classes, ...rest }, /* @__PURE__ */ React.createElement("div", { className: classesTitle, style: tabStyle, ref: navRef }, !!title && typeof title === "function" ? title() : titles.current.map((item) => {
9370
9355
  return /* @__PURE__ */ React.createElement(
9371
9356
  "div",
9372
9357
  {
9373
- onClick: () => {
9374
- tabChange(item);
9375
- },
9358
+ key: item.value,
9359
+ ref: (ref) => titleItemsRef.current.push(ref),
9360
+ onClick: () => tabChange(item),
9376
9361
  className: classNames(`${classPrefix$j}-titles-item`, {
9377
9362
  [`nut-tabs-titles-item-active`]: !item.disabled && String(item.value) === String(value),
9378
9363
  [`nut-tabs-titles-item-disabled`]: item.disabled,
9379
9364
  [`nut-tabs-titles-item-${align}`]: align
9380
- }),
9381
- ref: (ref) => titleItemsRef.current.push(ref),
9382
- key: item.value
9365
+ })
9383
9366
  },
9384
9367
  activeType === "line" && /* @__PURE__ */ React.createElement(
9385
9368
  "div",
9386
9369
  {
9387
- className: classNames(`${classPrefix$j}-titles-item-line`, {
9388
- [`${classPrefix$j}-titles-item-line-${direction}`]: true
9389
- }),
9390
- style: tabsActiveStyle
9370
+ className: classNames(
9371
+ `${classPrefix$j}-titles-item-line`,
9372
+ `${classPrefix$j}-titles-item-line-${direction}`
9373
+ ),
9374
+ style: { background: activeColor }
9391
9375
  }
9392
9376
  ),
9393
- activeType === "smile" && /* @__PURE__ */ React.createElement(
9394
- "div",
9395
- {
9396
- className: `${classPrefix$j}-titles-item-smile`,
9397
- style: tabsActiveStyle
9398
- },
9399
- /* @__PURE__ */ React.createElement(c$3, { color: activeColor, width: 40, height: 20 })
9400
- ),
9377
+ activeType === "smile" && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$j}-titles-item-smile` }, /* @__PURE__ */ React.createElement(c$3, { color: activeColor, width: 40, height: 20 })),
9401
9378
  /* @__PURE__ */ React.createElement(
9402
9379
  "div",
9403
9380
  {
9404
9381
  className: classNames(
9405
- `${classPrefix$j}-ellipsis`,
9382
+ {
9383
+ [`${classPrefix$j}-ellipsis`]: direction === "vertical"
9384
+ },
9406
9385
  `${classPrefix$j}-titles-item-text`
9407
- )
9386
+ ),
9387
+ style: { color: activeColor }
9408
9388
  },
9409
9389
  item.title
9410
9390
  )
9411
9391
  );
9412
9392
  })), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$j}-content-wrap` }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix$j}-content`, style: getContentStyle() }, React.Children.map(children, (child, idx) => {
9413
- if (!React.isValidElement(child)) {
9414
- return null;
9415
- }
9416
- let childProps = {
9393
+ if (!React.isValidElement(child)) return null;
9394
+ return React.cloneElement(child, {
9417
9395
  ...child.props,
9418
- active: value === child.props.value
9419
- };
9420
- if (String(value) !== String(child.props.value || idx) && autoHeight) {
9421
- childProps = {
9422
- ...childProps,
9423
- autoHeightClassName: "inactive"
9424
- };
9425
- }
9426
- return React.cloneElement(child, childProps);
9396
+ active: value === child.props.value,
9397
+ autoHeightClassName: autoHeight && String(value) !== String(child.props.value || idx) ? "inactive" : void 0
9398
+ });
9427
9399
  }))));
9428
9400
  };
9429
9401
  Tabs.displayName = "NutTabs";
@@ -10152,189 +10124,106 @@
10152
10124
  };
10153
10125
  const Address = React.forwardRef(InternalAddress);
10154
10126
  Address.displayName = "NutAddress";
10155
- const Utils = {
10156
- /**
10157
- * 是否为闫年
10158
- * @return {Boolse} true|false
10159
- */
10160
- isLeapYear(y) {
10161
- return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
10162
- },
10163
- /**
10164
- * 返回星期数
10165
- * @return {String}
10166
- */
10167
- getWhatDay(year, month, day) {
10168
- const date = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
10169
- const index = date.getDay();
10170
- const dayNames = [
10171
- "星期日",
10172
- "星期一",
10173
- "星期二",
10174
- "星期三",
10175
- "星期四",
10176
- "星期五",
10177
- "星期六"
10178
- ];
10179
- return dayNames[index];
10180
- },
10181
- /**
10182
- * 返回上一个月在当前面板中的天数
10183
- * @return {Number}
10184
- */
10185
- getMonthPreDay(year, month) {
10186
- const date = /* @__PURE__ */ new Date(`${year}/${month}/01`);
10187
- let day = date.getDay();
10188
- if (day === 0) {
10189
- day = 7;
10190
- }
10191
- return day;
10192
- },
10193
- /**
10194
- * 返回月份天数
10195
- * @return {Number}
10196
- */
10197
- getMonthDays(year, month) {
10198
- if (/^0/.test(month)) {
10199
- month = month.split("")[1];
10200
- }
10201
- return [
10202
- 0,
10203
- 31,
10204
- this.isLeapYear(Number(year)) ? 29 : 28,
10205
- 31,
10206
- 30,
10207
- 31,
10208
- 30,
10209
- 31,
10210
- 31,
10211
- 30,
10212
- 31,
10213
- 30,
10214
- 31
10215
- ][month];
10216
- },
10217
- /**
10218
- * 补齐数字位数
10219
- * @return {string}
10220
- */
10221
- getNumTwoBit(n2) {
10222
- n2 = Number(n2);
10223
- return (n2 > 9 ? "" : "0") + n2;
10224
- },
10225
- /**
10226
- * 日期对象转成字符串
10227
- * @return {string}
10228
- */
10229
- date2Str(date, split) {
10230
- split = split || "-";
10231
- const y = date.getFullYear();
10232
- const m2 = this.getNumTwoBit(date.getMonth() + 1);
10233
- const d2 = this.getNumTwoBit(date.getDate());
10234
- return [y, m2, d2].join(split);
10235
- },
10236
- /**
10237
- * 返回日期格式字符串
10238
- * @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
10239
- * @return {string} '2014-12-31'
10240
- */
10241
- getDay(i2) {
10242
- i2 = i2 || 0;
10243
- let date = /* @__PURE__ */ new Date();
10244
- const diff = i2 * (1e3 * 60 * 60 * 24);
10245
- date = new Date(date.getTime() + diff);
10246
- return this.date2Str(date);
10247
- },
10248
- /**
10249
- * 时间比较
10250
- * @return {Boolean}
10251
- */
10252
- compareDate(date1, date22) {
10253
- const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
10254
- const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
10255
- if (startTime >= endTime) {
10256
- return false;
10257
- }
10258
- return true;
10259
- },
10260
- /**
10261
- * 时间是否相等
10262
- * @return {Boolean}
10263
- */
10264
- isEqual(date1, date22) {
10265
- const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
10266
- const endTime = new Date(date22.replace(/-/g, "/")).getTime();
10267
- if (startTime === endTime) {
10268
- return true;
10269
- }
10270
- return false;
10271
- },
10272
- getMonthWeek(year, month, date, firstDayOfWeek = 0) {
10273
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
10274
- let w = dateNow.getDay();
10275
- const d2 = dateNow.getDate();
10276
- let remainder = 6 - w;
10277
- if (firstDayOfWeek !== 0) {
10278
- w = w === 0 ? 7 : w;
10279
- remainder = 7 - w;
10280
- }
10281
- return Math.ceil((d2 + remainder) / 7);
10282
- },
10283
- getYearWeek(year, month, date, firstDayOfWeek = 0) {
10284
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
10285
- const dateFirst = new Date(Number(year), 0, 1);
10286
- const dataNumber = Math.round(
10287
- (dateNow.valueOf() - dateFirst.valueOf()) / 864e5
10288
- );
10289
- return Math.ceil((dataNumber + (dateFirst.getDay() + 1 - 1)) / 7);
10290
- },
10291
- getWeekDate(year, month, date, firstDayOfWeek = 0) {
10292
- const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
10293
- const nowTime = dateNow.getTime();
10294
- let day = dateNow.getDay();
10295
- if (firstDayOfWeek === 0) {
10296
- const oneDayTime2 = 24 * 60 * 60 * 1e3;
10297
- const SundayTime2 = nowTime - day * oneDayTime2;
10298
- const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
10299
- const sunday2 = this.date2Str(new Date(SundayTime2));
10300
- const saturday = this.date2Str(new Date(SaturdayTime));
10301
- return [sunday2, saturday];
10302
- }
10303
- day = day === 0 ? 7 : day;
10304
- const oneDayTime = 24 * 60 * 60 * 1e3;
10305
- const MondayTime = nowTime - (day - 1) * oneDayTime;
10306
- const SundayTime = nowTime + (7 - day) * oneDayTime;
10307
- const monday = this.date2Str(new Date(MondayTime));
10308
- const sunday = this.date2Str(new Date(SundayTime));
10309
- return [monday, sunday];
10310
- },
10311
- formatResultDate(date) {
10312
- const days = [...date.split("-")];
10313
- days[2] = Utils.getNumTwoBit(Number(days[2]));
10314
- days[3] = `${days[0]}-${days[1]}-${days[2]}`;
10315
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
10316
- return days;
10127
+ const isLeapYear = (y) => {
10128
+ return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
10129
+ };
10130
+ const getWhatDay = (year, month, day) => {
10131
+ const date = new Date(year, month - 1, day);
10132
+ const dayNames = [
10133
+ "星期日",
10134
+ "星期一",
10135
+ "星期二",
10136
+ "星期三",
10137
+ "星期四",
10138
+ "星期五",
10139
+ "星期六"
10140
+ ];
10141
+ return dayNames[date.getDay()];
10142
+ };
10143
+ const getMonthPreDay = (year, month) => {
10144
+ const day = new Date(year, month - 1, 1).getDay();
10145
+ return day === 0 ? 7 : day;
10146
+ };
10147
+ const getMonthDays = (year, month) => {
10148
+ if (/^0/.test(month)) {
10149
+ month = month.split("")[1];
10317
10150
  }
10151
+ return [
10152
+ 0,
10153
+ 31,
10154
+ isLeapYear(Number(year)) ? 29 : 28,
10155
+ 31,
10156
+ 30,
10157
+ 31,
10158
+ 30,
10159
+ 31,
10160
+ 31,
10161
+ 30,
10162
+ 31,
10163
+ 30,
10164
+ 31
10165
+ ][month];
10166
+ };
10167
+ const getNumTwoBit = (n2) => {
10168
+ return n2 > 9 ? `${n2}` : `0${n2}`;
10169
+ };
10170
+ const date2Str = (date, split = "-") => {
10171
+ const y = date.getFullYear();
10172
+ const m2 = getNumTwoBit(date.getMonth() + 1);
10173
+ const d2 = getNumTwoBit(date.getDate());
10174
+ return [y, m2, d2].join(split);
10175
+ };
10176
+ const getDateString = (offset = 0) => {
10177
+ const date = /* @__PURE__ */ new Date();
10178
+ date.setDate(date.getDate() + offset);
10179
+ return date2Str(date, "-");
10180
+ };
10181
+ const compareDate = (date1, date22) => {
10182
+ const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
10183
+ const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
10184
+ return startTime < endTime;
10185
+ };
10186
+ const isEqual = (date1, date22) => {
10187
+ const startTime = new Date((date1 || "").replace(/-/g, "/")).getTime();
10188
+ const endTime = new Date(date22.replace(/-/g, "/")).getTime();
10189
+ return startTime === endTime;
10190
+ };
10191
+ const getWeekDate = (year, month, date, firstDayOfWeek = 0) => {
10192
+ const dateNow = new Date(Number(year), parseInt(month) - 1, Number(date));
10193
+ const nowTime = dateNow.getTime();
10194
+ let day = dateNow.getDay();
10195
+ if (firstDayOfWeek === 0) {
10196
+ const oneDayTime2 = 24 * 60 * 60 * 1e3;
10197
+ const SundayTime2 = nowTime - day * oneDayTime2;
10198
+ const SaturdayTime = nowTime + (6 - day) * oneDayTime2;
10199
+ const sunday2 = date2Str(new Date(SundayTime2));
10200
+ const saturday = date2Str(new Date(SaturdayTime));
10201
+ return [sunday2, saturday];
10202
+ }
10203
+ day = day === 0 ? 7 : day;
10204
+ const oneDayTime = 24 * 60 * 60 * 1e3;
10205
+ const MondayTime = nowTime - (day - 1) * oneDayTime;
10206
+ const SundayTime = nowTime + (7 - day) * oneDayTime;
10207
+ const monday = date2Str(new Date(MondayTime));
10208
+ const sunday = date2Str(new Date(SundayTime));
10209
+ return [monday, sunday];
10210
+ };
10211
+ const formatResultDate = (date) => {
10212
+ const [year, month, day] = [...date.split("-")];
10213
+ const formatterDay = getNumTwoBit(Number(day));
10214
+ const formatterDate = `${year}-${month}-${day}`;
10215
+ const dayOfWeek = getWhatDay(Number(year), Number(month), Number(day));
10216
+ return [year, month, formatterDay, formatterDate, dayOfWeek];
10318
10217
  };
10319
10218
  const getCurrMonthData = (type, year, month) => {
10320
- switch (type) {
10321
- case "prev":
10322
- month === 1 && (year -= 1);
10323
- month = month === 1 ? 12 : --month;
10324
- break;
10325
- case "next":
10326
- month === 12 && (year += 1);
10327
- month = month === 12 ? 1 : ++month;
10328
- break;
10219
+ {
10220
+ month === 12 && (year += 1);
10221
+ month = month === 12 ? 1 : ++month;
10329
10222
  }
10330
- return [
10331
- year,
10332
- Utils.getNumTwoBit(month),
10333
- Utils.getMonthDays(String(year), String(month))
10334
- ];
10223
+ return [year, getNumTwoBit(month), getMonthDays(String(year), String(month))];
10335
10224
  };
10336
10225
  const getDaysStatus = (type, year, month) => {
10337
- let days = Utils.getMonthDays(`${year}`, `${month}`);
10226
+ let days = getMonthDays(`${year}`, `${month}`);
10338
10227
  return Array.from(Array(days), (v, k) => {
10339
10228
  return {
10340
10229
  day: k + 1,
@@ -10351,12 +10240,12 @@
10351
10240
  preMonth = 12;
10352
10241
  preYear += 1;
10353
10242
  }
10354
- let days = Utils.getMonthPreDay(+year, +month);
10243
+ let days = getMonthPreDay(+year, +month);
10355
10244
  days -= firstDayOfWeek;
10356
10245
  if (days >= 7) {
10357
10246
  days -= 7;
10358
10247
  }
10359
- const preDates = Utils.getMonthDays(`${preYear}`, `${preMonth}`);
10248
+ const preDates = getMonthDays(`${preYear}`, `${preMonth}`);
10360
10249
  const months = Array.from(Array(preDates), (v, k) => {
10361
10250
  return {
10362
10251
  day: k + 1,
@@ -10374,28 +10263,26 @@
10374
10263
  const isMultiple = (day, days) => {
10375
10264
  if (days.length > 0) {
10376
10265
  return days.some((item) => {
10377
- return Utils.isEqual(item, day);
10266
+ return isEqual(item, day);
10378
10267
  });
10379
10268
  }
10380
10269
  return false;
10381
10270
  };
10382
10271
  const isCurrDay = (month, day) => {
10383
10272
  const date = `${month.curData[0]}/${month.curData[1]}/${day}`;
10384
- return Utils.isEqual(date, Utils.date2Str(/* @__PURE__ */ new Date(), "/"));
10273
+ return isEqual(date, date2Str(/* @__PURE__ */ new Date(), "/"));
10385
10274
  };
10386
10275
  const getCurrDate = (day, month) => {
10387
- return `${month.curData[0]}/${month.curData[1]}/${Utils.getNumTwoBit(
10388
- +day.day
10389
- )}`;
10276
+ return `${month.curData[0]}/${month.curData[1]}/${getNumTwoBit(+day.day)}`;
10390
10277
  };
10391
10278
  const isStart = (day, days) => {
10392
- return Utils.isEqual(days[0], day);
10279
+ return isEqual(days[0], day);
10393
10280
  };
10394
10281
  const isEnd = (day, days) => {
10395
- return Utils.isEqual(days[1], day);
10282
+ return isEqual(days[1], day);
10396
10283
  };
10397
10284
  const isStartAndEnd = (days) => {
10398
- return days.length >= 2 && Utils.isEqual(days[0], days[1]);
10285
+ return days.length >= 2 && isEqual(days[0], days[1]);
10399
10286
  };
10400
10287
  const defaultProps$12 = {
10401
10288
  ...ComponentDefaults,
@@ -10403,8 +10290,8 @@
10403
10290
  autoBackfill: false,
10404
10291
  popup: true,
10405
10292
  title: "",
10406
- startDate: Utils.getDay(0),
10407
- endDate: Utils.getDay(365),
10293
+ startDate: getDateString(0),
10294
+ endDate: getDateString(365),
10408
10295
  showToday: true,
10409
10296
  startText: "",
10410
10297
  endText: "",
@@ -10460,6 +10347,8 @@
10460
10347
  onDayClick,
10461
10348
  onPageChange
10462
10349
  } = { ...defaultProps$12, ...props };
10350
+ const classPrefix2 = "nut-calendar";
10351
+ const dayPrefix = "nut-calendar-day";
10463
10352
  const weekdays = locale.calendaritem.weekdays;
10464
10353
  const weeks = [
10465
10354
  ...weekdays.slice(firstDayOfWeek, 7),
@@ -10471,19 +10360,13 @@
10471
10360
  const [monthsNum, setMonthsNum] = React.useState(0);
10472
10361
  const [translateY, setTranslateY] = React.useState(0);
10473
10362
  const [monthDefaultRange, setMonthDefaultRange] = React.useState([]);
10474
- const propStartDate = startDate || Utils.getDay(0);
10475
- const propEndDate = endDate || Utils.getDay(365);
10363
+ const propStartDate = startDate || getDateString(0);
10364
+ const propEndDate = endDate || getDateString(365);
10476
10365
  const startDates = splitDate(propStartDate);
10477
10366
  const endDates = splitDate(propEndDate);
10478
10367
  const [state] = React.useState({
10479
10368
  currDateArray: []
10480
10369
  });
10481
- const getMonthsPanel = () => {
10482
- return monthsPanel.current;
10483
- };
10484
- const getMonthsRef = () => {
10485
- return monthsRef.current;
10486
- };
10487
10370
  const resetDefaultValue = () => {
10488
10371
  if (defaultValue || Array.isArray(defaultValue) && defaultValue.length > 0) {
10489
10372
  return type !== "single" ? [...defaultValue] : defaultValue;
@@ -10503,9 +10386,7 @@
10503
10386
  const viewAreaRef = React.useRef(null);
10504
10387
  const [avgHeight, setAvgHeight] = React.useState(0);
10505
10388
  let viewHeight = 0;
10506
- const classPrefix2 = "nut-calendar";
10507
- const dayPrefix = "nut-calendar-day";
10508
- const getMonthData = (curData, monthNum, type22) => {
10389
+ const getMonthData = (curData, monthNum) => {
10509
10390
  let i2 = 0;
10510
10391
  let date = curData;
10511
10392
  const monthData = monthsData;
@@ -10529,16 +10410,14 @@
10529
10410
  cssHeight,
10530
10411
  scrollTop
10531
10412
  };
10532
- {
10533
- if (!endDates || !Utils.compareDate(
10534
- `${endDates[0]}/${endDates[1]}/${Utils.getMonthDays(
10535
- endDates[0],
10536
- endDates[1]
10537
- )}`,
10538
- `${curData[0]}/${curData[1]}/${curData[2]}`
10539
- )) {
10540
- monthData.push(monthInfo);
10541
- }
10413
+ if (!endDates || !compareDate(
10414
+ `${endDates[0]}/${endDates[1]}/${getMonthDays(
10415
+ endDates[0],
10416
+ endDates[1]
10417
+ )}`,
10418
+ `${curData[0]}/${curData[1]}/${curData[2]}`
10419
+ )) {
10420
+ monthData.push(monthInfo);
10542
10421
  }
10543
10422
  date = getCurrMonthData("next", y, m2);
10544
10423
  } while (i2++ < monthNum);
@@ -10546,8 +10425,8 @@
10546
10425
  };
10547
10426
  const setReachedYearMonthInfo = (current) => {
10548
10427
  const currentMonthsData = monthsData[current];
10549
- const [year, month] = currentMonthsData.curData;
10550
10428
  if (currentMonthsData.title === yearMonthTitle) return;
10429
+ const [year, month] = currentMonthsData.curData;
10551
10430
  onPageChange && onPageChange([year, month, `${year}-${month}`]);
10552
10431
  setYearMonthTitle(currentMonthsData.title);
10553
10432
  };
@@ -10573,57 +10452,54 @@
10573
10452
  setTranslateY(monthsData[start2].scrollTop);
10574
10453
  setReachedYearMonthInfo(current);
10575
10454
  };
10576
- const getMonthNum = () => {
10577
- let monthNum = Number(endDates[1]) - Number(startDates[1]);
10578
- const yearNum = Number(endDates[0]) - Number(startDates[0]);
10579
- if (yearNum > 0) {
10580
- monthNum += 12 * yearNum;
10581
- }
10582
- if (monthNum <= 0) {
10583
- monthNum = 1;
10584
- }
10585
- setMonthsNum(monthNum);
10586
- return monthNum;
10587
- };
10588
10455
  const setDefaultDate = () => {
10589
10456
  let defaultData = [];
10590
- if (type === "range" && Array.isArray(currentDate)) {
10591
- if (currentDate.length > 0) {
10592
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
10593
- currentDate.splice(0, 1, propStartDate);
10457
+ if (type === "single" && typeof currentDate === "string") {
10458
+ if (!currentDate.length) {
10459
+ return defaultData;
10460
+ }
10461
+ if (compareDate(currentDate, propStartDate)) {
10462
+ defaultData = [...splitDate(propStartDate)];
10463
+ } else if (!compareDate(currentDate, propEndDate)) {
10464
+ defaultData = [...splitDate(propEndDate)];
10465
+ } else {
10466
+ defaultData = [...splitDate(currentDate)];
10467
+ }
10468
+ return defaultData;
10469
+ }
10470
+ if (Array.isArray(currentDate) && currentDate.length) {
10471
+ if (type === "range") {
10472
+ if (compareDate(currentDate[0], propStartDate)) {
10473
+ currentDate[0] = propStartDate;
10594
10474
  }
10595
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
10596
- currentDate.splice(1, 1, propEndDate);
10475
+ if (compareDate(propEndDate, currentDate[1])) {
10476
+ currentDate[1] = propEndDate;
10597
10477
  }
10598
10478
  defaultData = [
10599
10479
  ...splitDate(currentDate[0]),
10600
10480
  ...splitDate(currentDate[1])
10601
10481
  ];
10602
- }
10603
- } else if (type === "multiple" && Array.isArray(currentDate)) {
10604
- if (currentDate.length > 0) {
10482
+ } else if (type === "multiple") {
10605
10483
  const defaultArr = [];
10606
10484
  const obj = {};
10607
10485
  currentDate.forEach((item) => {
10608
- if (propStartDate && !Utils.compareDate(item, propStartDate) && propEndDate && !Utils.compareDate(propEndDate, item)) {
10486
+ if (!compareDate(item, propStartDate) && !compareDate(propEndDate, item)) {
10609
10487
  if (!Object.hasOwnProperty.call(obj, item)) {
10610
10488
  defaultArr.push(item);
10611
10489
  obj[item] = item;
10612
10490
  }
10613
10491
  }
10614
10492
  });
10615
- currentDate.splice(0) && currentDate.push(...defaultArr);
10493
+ currentDate.splice(0, currentDate.length, ...defaultArr);
10616
10494
  defaultData = [...splitDate(defaultArr[0])];
10617
- }
10618
- } else if (type === "week" && Array.isArray(currentDate)) {
10619
- if (currentDate.length > 0) {
10495
+ } else if (type === "week") {
10620
10496
  const [y, m2, d2] = splitDate(currentDate[0]);
10621
- const weekArr = Utils.getWeekDate(y, m2, d2, firstDayOfWeek);
10622
- currentDate.splice(0) && currentDate.push(...weekArr);
10623
- if (propStartDate && Utils.compareDate(currentDate[0], propStartDate)) {
10497
+ const weekArr = getWeekDate(y, m2, d2, firstDayOfWeek);
10498
+ currentDate.splice(0, currentDate.length, ...weekArr);
10499
+ if (compareDate(currentDate[0], propStartDate)) {
10624
10500
  currentDate.splice(0, 1, propStartDate);
10625
10501
  }
10626
- if (propEndDate && Utils.compareDate(propEndDate, currentDate[1])) {
10502
+ if (compareDate(propEndDate, currentDate[1])) {
10627
10503
  currentDate.splice(1, 1, propEndDate);
10628
10504
  }
10629
10505
  defaultData = [
@@ -10631,18 +10507,6 @@
10631
10507
  ...splitDate(currentDate[1])
10632
10508
  ];
10633
10509
  }
10634
- } else if (currentDate) {
10635
- if (currentDate.length > 0) {
10636
- if (propStartDate && Utils.compareDate(currentDate, propStartDate)) {
10637
- defaultData = [...splitDate(propStartDate)];
10638
- } else if (propEndDate && !Utils.compareDate(currentDate, propEndDate)) {
10639
- defaultData = [...splitDate(propEndDate)];
10640
- } else {
10641
- defaultData = [...splitDate(currentDate)];
10642
- }
10643
- } else {
10644
- defaultData = [];
10645
- }
10646
10510
  }
10647
10511
  return defaultData;
10648
10512
  };
@@ -10676,51 +10540,38 @@
10676
10540
  lastCurrent
10677
10541
  };
10678
10542
  };
10679
- const renderCurrentDate = () => {
10680
- const defaultData = setDefaultDate();
10681
- const current = getCurrentIndex(defaultData);
10682
- if (defaultData.length > 0) {
10683
- if (type === "range") {
10684
- chooseDay(
10685
- { day: defaultData[2], type: "active" },
10686
- monthsData[current.current],
10687
- true
10688
- );
10689
- chooseDay(
10690
- { day: defaultData[5], type: "active" },
10691
- monthsData[current.lastCurrent],
10692
- true
10693
- );
10694
- } else if (type === "week") {
10695
- chooseDay(
10696
- { day: defaultData[2], type: "curr" },
10697
- monthsData[current.current],
10698
- true
10543
+ const renderCurrentDate = (defaultData, current) => {
10544
+ if (!defaultData.length) return;
10545
+ const date = monthsData[current.current];
10546
+ if (type === "range") {
10547
+ handleDayClick({ day: defaultData[2], type: "active" }, date);
10548
+ handleDayClick(
10549
+ { day: defaultData[5], type: "active" },
10550
+ monthsData[current.lastCurrent]
10551
+ );
10552
+ } else if (type === "week") {
10553
+ handleDayClick({ day: defaultData[2], type: "curr" }, date);
10554
+ } else if (type === "multiple") {
10555
+ [...currentDate].forEach((item) => {
10556
+ const dateArr = splitDate(item);
10557
+ let currentIndex = current.current;
10558
+ currentIndex = monthsData.findIndex(
10559
+ (item2) => item2.title === monthTitle(dateArr[0], dateArr[1])
10699
10560
  );
10700
- } else if (type === "multiple") {
10701
- [...currentDate].forEach((item) => {
10702
- const dateArr = splitDate(item);
10703
- let currentIndex = current.current;
10704
- monthsData.forEach((item2, index) => {
10705
- if (item2.title === monthTitle(dateArr[0], dateArr[1])) {
10706
- currentIndex = index;
10707
- }
10708
- });
10709
- chooseDay(
10710
- { day: dateArr[2], type: "active" },
10711
- monthsData[currentIndex],
10712
- true
10713
- );
10714
- });
10715
- } else {
10716
- chooseDay(
10717
- { day: defaultData[2], type: "active" },
10718
- monthsData[current.current],
10719
- true
10561
+ handleDayClick(
10562
+ { day: dateArr[2], type: "active" },
10563
+ monthsData[currentIndex]
10720
10564
  );
10721
- }
10565
+ });
10566
+ } else {
10567
+ handleDayClick({ day: defaultData[2], type: "active" }, date);
10722
10568
  }
10723
- return current.current;
10569
+ };
10570
+ const getMonthsPanel = () => {
10571
+ return monthsPanel.current;
10572
+ };
10573
+ const getMonthsRef = () => {
10574
+ return monthsRef.current;
10724
10575
  };
10725
10576
  const requestAniFrameFunc = (current, monthNum) => {
10726
10577
  const lastItem = monthsData[monthsData.length - 1];
@@ -10734,12 +10585,27 @@
10734
10585
  });
10735
10586
  setAvgHeight(Math.floor(containerHeight / (monthNum + 1)));
10736
10587
  };
10588
+ const getMonthNum = () => {
10589
+ let monthNum = Number(endDates[1]) - Number(startDates[1]);
10590
+ const yearNum = Number(endDates[0]) - Number(startDates[0]);
10591
+ if (yearNum > 0) {
10592
+ monthNum += 12 * yearNum;
10593
+ }
10594
+ if (monthNum <= 0) {
10595
+ monthNum = 1;
10596
+ }
10597
+ setMonthsNum(monthNum);
10598
+ return monthNum;
10599
+ };
10737
10600
  const initData = () => {
10738
10601
  const monthNum = getMonthNum();
10739
10602
  getMonthData(startDates, monthNum);
10740
- const current = renderCurrentDate();
10741
- setDefaultRange(monthNum, current);
10742
- requestAniFrameFunc(current, monthNum);
10603
+ const defaultData = setDefaultDate();
10604
+ const current = getCurrentIndex(defaultData);
10605
+ const currentIndex = current.current;
10606
+ renderCurrentDate(defaultData, current);
10607
+ setDefaultRange(monthNum, currentIndex);
10608
+ requestAniFrameFunc(currentIndex, monthNum);
10743
10609
  };
10744
10610
  React.useEffect(() => {
10745
10611
  initData();
@@ -10756,9 +10622,9 @@
10756
10622
  popup && resetRender();
10757
10623
  }, [currentDate]);
10758
10624
  const scrollToDate = (date) => {
10759
- if (Utils.compareDate(date, propStartDate)) {
10625
+ if (compareDate(date, propStartDate)) {
10760
10626
  date = propStartDate;
10761
- } else if (!Utils.compareDate(date, propEndDate)) {
10627
+ } else if (!compareDate(date, propEndDate)) {
10762
10628
  date = propEndDate;
10763
10629
  }
10764
10630
  const dateArr = splitDate(date);
@@ -10800,16 +10666,10 @@
10800
10666
  const nextTop = monthsData[current + 1].scrollTop;
10801
10667
  const nextHeight = monthsData[current + 1].cssHeight;
10802
10668
  if (current === 0) {
10803
- if (scrollTop >= nextTop) {
10804
- current += 1;
10805
- }
10669
+ if (scrollTop >= nextTop) current += 1;
10806
10670
  } else if (current > 0 && current < monthsNum - 1) {
10807
- if (scrollTop >= nextTop) {
10808
- current += 1;
10809
- }
10810
- if (scrollTop < monthsData[current].scrollTop) {
10811
- current -= 1;
10812
- }
10671
+ if (scrollTop >= nextTop) current += 1;
10672
+ if (scrollTop < monthsData[current].scrollTop) current -= 1;
10813
10673
  } else {
10814
10674
  const viewPosition = Math.round(scrollTop + viewHeight);
10815
10675
  if (current + 1 <= monthsNum && viewPosition >= nextTop + nextHeight) {
@@ -10824,86 +10684,85 @@
10824
10684
  React.useImperativeHandle(ref, () => ({
10825
10685
  scrollToDate
10826
10686
  }));
10687
+ const isDisable = (day, month) => {
10688
+ if (day.type !== "active") return true;
10689
+ const dateStr = getCurrDate(day, month);
10690
+ if (compareDate(dateStr, propStartDate)) return true;
10691
+ if (compareDate(propEndDate, dateStr)) return true;
10692
+ return false;
10693
+ };
10827
10694
  const getClasses = (day, month) => {
10828
10695
  const dateStr = getCurrDate(day, month);
10829
- if (day.type === "active") {
10830
- if (propStartDate && Utils.compareDate(dateStr, propStartDate) || propEndDate && Utils.compareDate(propEndDate, dateStr)) {
10831
- return `${dayPrefix}-disabled`;
10832
- }
10833
- if (type === "range" || type === "week") {
10834
- if (isStart(dateStr, currentDate) || isEnd(dateStr, currentDate)) {
10835
- return `${dayPrefix}-active ${isStart(dateStr, currentDate) ? "active-start" : ""} ${isEnd(dateStr, currentDate) ? "active-end" : ""}`;
10836
- }
10837
- if (Array.isArray(currentDate) && Object.values(currentDate).length === 2 && Utils.compareDate(currentDate[0], dateStr) && Utils.compareDate(dateStr, currentDate[1])) {
10838
- if (disableDate(day)) {
10839
- return `${dayPrefix}-choose-disabled`;
10840
- }
10841
- return `${dayPrefix}-choose`;
10842
- }
10843
- } else if (type === "multiple" && isMultiple(dateStr, currentDate) || !Array.isArray(currentDate) && Utils.isEqual(currentDate, dateStr)) {
10844
- return `${dayPrefix}-active`;
10696
+ if (isDisable(day, month)) return `${dayPrefix}-disabled`;
10697
+ const activeCls = `${dayPrefix}-active`;
10698
+ if (type === "range" || type === "week") {
10699
+ if (isStart(dateStr, currentDate))
10700
+ return `${activeCls} active-start`;
10701
+ if (isEnd(dateStr, currentDate)) {
10702
+ return `${activeCls} active-end`;
10845
10703
  }
10846
- if (disableDate(day)) {
10847
- return `${dayPrefix}-disabled`;
10704
+ if (currentDate.length === 2 && compareDate(currentDate[0], dateStr) && compareDate(dateStr, currentDate[1])) {
10705
+ return disableDate(day) ? `${dayPrefix}-choose-disabled` : `${dayPrefix}-choose`;
10848
10706
  }
10849
- return null;
10707
+ } else if (type === "multiple" && isMultiple(dateStr, currentDate) || type === "single" && isEqual(currentDate, dateStr)) {
10708
+ return activeCls;
10850
10709
  }
10851
- return `${dayPrefix}-disabled`;
10710
+ if (disableDate(day)) return `${dayPrefix}-disabled`;
10711
+ return null;
10852
10712
  };
10853
- const chooseDay = (day, month, isFirst) => {
10713
+ const handleDayClick = (day, month, isFirst = true) => {
10854
10714
  if (getClasses(day, month) === `${dayPrefix}-disabled`) {
10855
10715
  return;
10856
10716
  }
10857
10717
  const days = [...month.curData];
10858
10718
  const [y, m2] = month.curData;
10859
- days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
10719
+ days[2] = typeof day.day === "number" ? getNumTwoBit(day.day) : day.day;
10860
10720
  days[3] = `${days[0]}/${days[1]}/${days[2]}`;
10861
- days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
10721
+ days[4] = getWhatDay(+days[0], +days[1], +days[2]);
10722
+ const newDate = days[3];
10862
10723
  if (type === "multiple") {
10863
- if (currentDate.length > 0) {
10864
- let hasIndex = "";
10865
- currentDate.forEach((item, index) => {
10866
- if (item === days[3]) {
10867
- hasIndex = index;
10724
+ if (Array.isArray(currentDate)) {
10725
+ if (currentDate.length > 0) {
10726
+ const hasIndex = currentDate.findIndex((item) => item === newDate);
10727
+ if (isFirst) {
10728
+ state.currDateArray.push([...days]);
10729
+ } else if (hasIndex > -1) {
10730
+ currentDate.splice(hasIndex, 1);
10731
+ state.currDateArray.splice(hasIndex, 1);
10732
+ } else {
10733
+ currentDate.push(newDate);
10734
+ state.currDateArray.push([...days]);
10868
10735
  }
10869
- });
10870
- if (isFirst) {
10871
- state.currDateArray.push([...days]);
10872
- } else if (hasIndex !== "") {
10873
- currentDate.splice(hasIndex, 1);
10874
- state.currDateArray.splice(hasIndex, 1);
10875
10736
  } else {
10876
- currentDate.push(days[3]);
10877
- state.currDateArray.push([...days]);
10737
+ currentDate.push(newDate);
10738
+ state.currDateArray = [[...days]];
10878
10739
  }
10879
- } else {
10880
- currentDate.push(days[3]);
10881
- state.currDateArray = [[...days]];
10882
10740
  }
10883
10741
  } else if (type === "range") {
10884
- const curDataLength = Object.values(currentDate).length;
10885
- if (curDataLength === 2 || curDataLength === 0) {
10886
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(days[3]);
10887
- state.currDateArray = [[...days]];
10888
- } else if (Utils.compareDate(currentDate[0], days[3])) {
10889
- Array.isArray(currentDate) && currentDate.push(days[3]);
10890
- state.currDateArray = [...state.currDateArray, [...days]];
10891
- } else {
10892
- Array.isArray(currentDate) && currentDate.unshift(days[3]);
10893
- state.currDateArray = [[...days], ...state.currDateArray];
10742
+ if (Array.isArray(currentDate)) {
10743
+ if (currentDate.length === 2 || currentDate.length === 0) {
10744
+ currentDate.splice(0, currentDate.length, newDate);
10745
+ state.currDateArray = [[...days]];
10746
+ } else if (compareDate(currentDate[0], newDate)) {
10747
+ currentDate.push(newDate);
10748
+ state.currDateArray = [...state.currDateArray, [...days]];
10749
+ } else {
10750
+ currentDate.unshift(newDate);
10751
+ state.currDateArray = [[...days], ...state.currDateArray];
10752
+ }
10894
10753
  }
10895
10754
  } else if (type === "week") {
10896
- const weekArr = Utils.getWeekDate(y, m2, `${day.day}`, firstDayOfWeek);
10897
- if (propStartDate && Utils.compareDate(weekArr[0], propStartDate)) {
10898
- weekArr.splice(0, 1, propStartDate);
10755
+ const weekArr = getWeekDate(y, m2, `${day.day}`, firstDayOfWeek);
10756
+ if (compareDate(weekArr[0], propStartDate)) {
10757
+ weekArr[0] = propStartDate;
10899
10758
  }
10900
- if (propEndDate && Utils.compareDate(propEndDate, weekArr[1])) {
10901
- weekArr.splice(1, 1, propEndDate);
10759
+ if (compareDate(propEndDate, weekArr[1])) {
10760
+ weekArr[1] = propEndDate;
10902
10761
  }
10903
- Array.isArray(currentDate) && currentDate.splice(0) && currentDate.push(...weekArr);
10762
+ currentDate.splice(0, currentDate.length, ...weekArr);
10904
10763
  state.currDateArray = [
10905
- Utils.formatResultDate(weekArr[0]),
10906
- Utils.formatResultDate(weekArr[1])
10764
+ formatResultDate(weekArr[0]),
10765
+ formatResultDate(weekArr[1])
10907
10766
  ];
10908
10767
  } else {
10909
10768
  setCurrentDate(days[3]);
@@ -10927,11 +10786,11 @@
10927
10786
  }
10928
10787
  };
10929
10788
  const classes = classNames(
10789
+ classPrefix2,
10930
10790
  {
10931
10791
  [`${classPrefix2}-title`]: !popup,
10932
10792
  [`${classPrefix2}-nofooter`]: !!autoBackfill
10933
10793
  },
10934
- classPrefix2,
10935
10794
  className
10936
10795
  );
10937
10796
  const headerClasses = classNames({
@@ -10947,6 +10806,36 @@
10947
10806
  const renderHeader = () => {
10948
10807
  return /* @__PURE__ */ React.createElement("div", { className: headerClasses }, showTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title` }, title || locale.calendaritem.title), renderHeaderButtons && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-header-buttons` }, renderHeaderButtons()), showSubTitle && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-sub-title` }, yearMonthTitle), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-weeks`, ref: weeksPanel }, weeks.map((item) => /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-week-item`, key: item }, item))));
10949
10808
  };
10809
+ const renderItem = (month, day, index) => {
10810
+ const startTip = isStartTip(day, month);
10811
+ const endTip = isEndTip(day, month);
10812
+ const noStartNorEnd = !startTip && !endTip;
10813
+ return /* @__PURE__ */ React.createElement(
10814
+ "div",
10815
+ {
10816
+ className: [`${classPrefix2}-day`, getClasses(day, month)].join(" "),
10817
+ onClick: () => handleDayClick(day, month, false),
10818
+ key: index
10819
+ },
10820
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
10821
+ !startTip && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
10822
+ noStartNorEnd && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
10823
+ noStartNorEnd && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
10824
+ startTip && /* @__PURE__ */ React.createElement(
10825
+ "div",
10826
+ {
10827
+ className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
10828
+ },
10829
+ startText || locale.calendaritem.start
10830
+ ),
10831
+ endTip && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
10832
+ );
10833
+ };
10834
+ const renderPanel = (month, key) => {
10835
+ return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map(
10836
+ (day, i2) => renderItem(month, day, i2)
10837
+ )));
10838
+ };
10950
10839
  const renderContent = () => {
10951
10840
  return /* @__PURE__ */ React.createElement(
10952
10841
  "div",
@@ -10963,31 +10852,7 @@
10963
10852
  style: { transform: `translateY(${translateY}px)` }
10964
10853
  },
10965
10854
  monthsData.slice(monthDefaultRange[0], monthDefaultRange[1]).map((month, key) => {
10966
- return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month`, key }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-month-title` }, month.title), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-days` }, month.monthData.map((day, i2) => /* @__PURE__ */ React.createElement(
10967
- "div",
10968
- {
10969
- className: [
10970
- `${classPrefix2}-day`,
10971
- getClasses(day, month)
10972
- ].join(" "),
10973
- onClick: () => {
10974
- chooseDay(day, month);
10975
- },
10976
- key: i2
10977
- },
10978
- /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-day` }, renderDay ? renderDay(day) : day.day),
10979
- !isStartTip(day, month) && renderDayTop && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-top` }, renderDayTop(day)),
10980
- !isStartTip(day, month) && !isEndTip(day, month) && renderDayBottom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-bottom` }, renderDayBottom(day)),
10981
- !isStartTip(day, month) && !isEndTip(day, month) && !renderDayBottom && showToday && isCurrDay(month, day.day) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info-curr` }, locale.calendaritem.today),
10982
- isStartTip(day, month) && /* @__PURE__ */ React.createElement(
10983
- "div",
10984
- {
10985
- className: `${classPrefix2}-day-info ${isStartAndEnd(currentDate) ? `${classPrefix2}-day-info-top` : ""}`
10986
- },
10987
- startText || locale.calendaritem.start
10988
- ),
10989
- isEndTip(day, month) && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-day-info` }, endText || locale.calendaritem.end)
10990
- ))));
10855
+ return renderPanel(month, key);
10991
10856
  })
10992
10857
  ))
10993
10858
  );
@@ -11006,8 +10871,8 @@
11006
10871
  visible: false,
11007
10872
  title: "",
11008
10873
  defaultValue: "",
11009
- startDate: Utils.getDay(0),
11010
- endDate: Utils.getDay(365),
10874
+ startDate: getDateString(0),
10875
+ endDate: getDateString(365),
11011
10876
  showToday: true,
11012
10877
  startText: "",
11013
10878
  endText: "",
@@ -11206,12 +11071,12 @@
11206
11071
  prevMonth = 12;
11207
11072
  prevYear -= 1;
11208
11073
  }
11209
- let days = Utils.getMonthPreDay(year, month);
11074
+ let days = getMonthPreDay(year, month);
11210
11075
  days -= firstDayOfWeek;
11211
11076
  if (days >= 7) {
11212
11077
  days -= 7;
11213
11078
  }
11214
- const preDates = Utils.getMonthDays(`${prevYear}`, `${prevMonth}`);
11079
+ const preDates = getMonthDays(`${prevYear}`, `${prevMonth}`);
11215
11080
  const months = Array.from(Array(preDates), (_, k) => {
11216
11081
  return {
11217
11082
  type: "prev",
@@ -11223,7 +11088,7 @@
11223
11088
  return months.slice(preDates - days);
11224
11089
  };
11225
11090
  const getCurrentMonthDays = (year, month) => {
11226
- const days = Utils.getMonthDays(`${year}`, `${month}`);
11091
+ const days = getMonthDays(`${year}`, `${month}`);
11227
11092
  return Array.from(Array(days), (_, k) => {
11228
11093
  return {
11229
11094
  type: "current",
@@ -12551,6 +12416,14 @@
12551
12416
  Number(formatDate[2]),
12552
12417
  getMonthEndDay(Number(formatDate[0]), Number(formatDate[1]))
12553
12418
  );
12419
+ if (selectedOptions.length >= 2 && ["date", "datehour", "datetime", "month-day"].includes(rangeType)) {
12420
+ const dayOption = formatOption("day", day);
12421
+ if (rangeType === "month-day") {
12422
+ selectedOptions[1] = dayOption;
12423
+ } else {
12424
+ selectedOptions[2] = dayOption;
12425
+ }
12426
+ }
12554
12427
  let date = null;
12555
12428
  if (rangeType === "date" || rangeType === "month-day" || rangeType === "year-month") {
12556
12429
  date = new Date(year, month, day);
@@ -13455,7 +13328,7 @@
13455
13328
  pattern: {
13456
13329
  mismatch: "%s value %s does not match pattern %s"
13457
13330
  },
13458
- clone: function clone() {
13331
+ clone: function clone2() {
13459
13332
  var cloned = JSON.parse(JSON.stringify(this));
13460
13333
  cloned.clone = this.clone;
13461
13334
  return cloned;
@@ -13719,23 +13592,55 @@
13719
13592
  Schema.warning = warning;
13720
13593
  Schema.messages = messages;
13721
13594
  Schema.validators = validators;
13722
- function merge(...objects) {
13723
- const result = Array.isArray(objects[0]) ? [] : {};
13724
- function mergeHelper(obj, path = []) {
13725
- for (const [key, value] of Object.entries(obj)) {
13726
- const newPath = [...path, key];
13727
- if (Array.isArray(value)) {
13728
- result[key] = [...value];
13729
- } else if (typeof value === "object" && value !== null) {
13730
- if (path.some((p2) => p2 === value)) continue;
13731
- if (!result[key]) result[key] = {};
13732
- mergeHelper(value, newPath);
13733
- } else {
13734
- result[key] = value;
13735
- }
13595
+ function merge(...items) {
13596
+ return _merge(items[0] === true, false, items);
13597
+ }
13598
+ function recursive(...items) {
13599
+ return _merge(items[0] === true, true, items);
13600
+ }
13601
+ function clone(input) {
13602
+ if (Array.isArray(input)) {
13603
+ const output = [];
13604
+ for (let index = 0; index < input.length; ++index)
13605
+ output.push(clone(input[index]));
13606
+ return output;
13607
+ }
13608
+ if (isPlainObject(input)) {
13609
+ const output = {};
13610
+ for (const index in input) output[index] = clone(input[index]);
13611
+ return output;
13612
+ }
13613
+ return input;
13614
+ }
13615
+ function isPlainObject(input) {
13616
+ if (input === null || typeof input !== "object") return false;
13617
+ if (Object.getPrototypeOf(input) === null) return true;
13618
+ let ref = input;
13619
+ while (Object.getPrototypeOf(ref) !== null) ref = Object.getPrototypeOf(ref);
13620
+ return Object.getPrototypeOf(input) === ref;
13621
+ }
13622
+ function _recursiveMerge(base, extend) {
13623
+ if (!isPlainObject(base) || !isPlainObject(extend)) return extend;
13624
+ for (const key in extend) {
13625
+ if (key === "__proto__" || key === "constructor" || key === "prototype")
13626
+ continue;
13627
+ base[key] = isPlainObject(base[key]) && isPlainObject(extend[key]) ? _recursiveMerge(base[key], extend[key]) : extend[key];
13628
+ }
13629
+ return base;
13630
+ }
13631
+ function _merge(isClone, isRecursive, items) {
13632
+ let result;
13633
+ if (isClone || !isPlainObject(result = items.shift())) result = {};
13634
+ for (let index = 0; index < items.length; ++index) {
13635
+ const item = items[index];
13636
+ if (!isPlainObject(item)) continue;
13637
+ for (const key in item) {
13638
+ if (key === "__proto__" || key === "constructor" || key === "prototype")
13639
+ continue;
13640
+ const value = isClone ? clone(item[key]) : item[key];
13641
+ result[key] = isRecursive ? _recursiveMerge(result[key], value) : value;
13736
13642
  }
13737
13643
  }
13738
- objects.filter((obj) => !!obj).forEach((obj) => mergeHelper(obj));
13739
13644
  return result;
13740
13645
  }
13741
13646
  const SECRET = "NUT_FORM_INTERNAL";
@@ -13751,9 +13656,6 @@
13751
13656
  this.fieldEntities.push(field);
13752
13657
  return () => {
13753
13658
  this.fieldEntities = this.fieldEntities.filter((item) => item !== field);
13754
- if (this.store) {
13755
- delete this.store[field.props.name];
13756
- }
13757
13659
  };
13758
13660
  };
13759
13661
  this.getFieldValue = (name) => {
@@ -13775,10 +13677,11 @@
13775
13677
  if (init) {
13776
13678
  const nextStore = merge(initialValues, this.store);
13777
13679
  this.updateStore(nextStore);
13680
+ this.notifyWatch();
13778
13681
  }
13779
13682
  };
13780
13683
  this.setFieldsValue = (newStore) => {
13781
- const nextStore = merge(this.store, newStore);
13684
+ const nextStore = recursive(true, this.store, newStore);
13782
13685
  this.updateStore(nextStore);
13783
13686
  this.fieldEntities.forEach((entity) => {
13784
13687
  const { name } = entity.props;
@@ -13797,12 +13700,14 @@
13797
13700
  item.entity.onStoreChange("update");
13798
13701
  }
13799
13702
  });
13703
+ this.notifyWatch();
13800
13704
  };
13801
13705
  this.setFieldValue = (name, value) => {
13802
13706
  const store = {
13803
13707
  [name]: value
13804
13708
  };
13805
13709
  this.setFieldsValue(store);
13710
+ this.notifyWatch([name]);
13806
13711
  };
13807
13712
  this.setCallback = (callback) => {
13808
13713
  this.callbacks = {
@@ -13845,7 +13750,6 @@
13845
13750
  };
13846
13751
  this.validateFields = async (nameList) => {
13847
13752
  let filterEntities = [];
13848
- this.errors.length = 0;
13849
13753
  if (!nameList || nameList.length === 0) {
13850
13754
  filterEntities = this.fieldEntities;
13851
13755
  } else {
@@ -13870,13 +13774,29 @@
13870
13774
  (_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c, this.store, errors);
13871
13775
  }
13872
13776
  };
13873
- this.resetFields = () => {
13874
- this.errors.length = 0;
13875
- const nextStore = merge({}, this.initialValues);
13876
- this.updateStore(nextStore);
13877
- this.fieldEntities.forEach((entity) => {
13878
- entity.onStoreChange("reset");
13879
- });
13777
+ this.resetFields = (namePaths) => {
13778
+ if (namePaths && namePaths.length) {
13779
+ namePaths.forEach((path) => {
13780
+ this.errors[path] = null;
13781
+ this.fieldEntities.forEach((entity) => {
13782
+ const name = entity.props.name;
13783
+ if (name === path) {
13784
+ if (path in this.initialValues) {
13785
+ this.updateStore({ [path]: this.initialValues[path] });
13786
+ } else {
13787
+ delete this.store[path];
13788
+ }
13789
+ entity.onStoreChange("reset");
13790
+ }
13791
+ });
13792
+ });
13793
+ } else {
13794
+ const nextStore = merge({}, this.initialValues);
13795
+ this.updateStore(nextStore);
13796
+ this.fieldEntities.forEach((entity) => {
13797
+ entity.onStoreChange("reset");
13798
+ });
13799
+ }
13880
13800
  };
13881
13801
  this.registerUpdate = (field, shouldUpdate) => {
13882
13802
  this.updateList.push({
@@ -13899,7 +13819,8 @@
13899
13819
  dispatch: this.dispatch,
13900
13820
  store: this.store,
13901
13821
  fieldEntities: this.fieldEntities,
13902
- registerUpdate: this.registerUpdate
13822
+ registerUpdate: this.registerUpdate,
13823
+ registerWatch: this.registerWatch
13903
13824
  };
13904
13825
  }
13905
13826
  };
@@ -13916,6 +13837,26 @@
13916
13837
  getInternal: this.getInternal
13917
13838
  };
13918
13839
  };
13840
+ this.watchList = [];
13841
+ this.registerWatch = (callback) => {
13842
+ this.watchList.push(callback);
13843
+ return () => {
13844
+ this.watchList = this.watchList.filter((fn) => fn !== callback);
13845
+ };
13846
+ };
13847
+ this.notifyWatch = (namePath = []) => {
13848
+ if (this.watchList.length) {
13849
+ let allValues;
13850
+ if (!namePath || namePath.length === 0) {
13851
+ allValues = this.getFieldsValue(true);
13852
+ } else {
13853
+ allValues = this.getFieldsValue(namePath);
13854
+ }
13855
+ this.watchList.forEach((callback) => {
13856
+ callback(allValues, namePath);
13857
+ });
13858
+ }
13859
+ };
13919
13860
  this.callbacks = {
13920
13861
  onFinish: () => {
13921
13862
  },
@@ -13939,6 +13880,24 @@
13939
13880
  }
13940
13881
  return [formRef.current];
13941
13882
  };
13883
+ const useWatch = (path, form) => {
13884
+ const formInstance = form.getInternal(SECRET);
13885
+ const [value, setValue] = React.useState();
13886
+ React.useEffect(() => {
13887
+ const unsubscribe = formInstance.registerWatch(
13888
+ (data, namePath) => {
13889
+ const value2 = data[path];
13890
+ setValue(value2);
13891
+ }
13892
+ );
13893
+ const initialValue = form.getFieldsValue(true);
13894
+ if (value !== initialValue[path]) {
13895
+ setValue(initialValue[path]);
13896
+ }
13897
+ return () => unsubscribe();
13898
+ }, [form]);
13899
+ return value;
13900
+ };
13942
13901
  const defaultProps$X = {
13943
13902
  ...ComponentDefaults,
13944
13903
  labelPosition: "right",
@@ -14226,6 +14185,7 @@
14226
14185
  const InnerForm = Form;
14227
14186
  InnerForm.Item = FormItem;
14228
14187
  InnerForm.useForm = useForm;
14188
+ InnerForm.useWatch = useWatch;
14229
14189
  function trimExtraChar(value, char, regExp) {
14230
14190
  const index = value.indexOf(char);
14231
14191
  if (index === -1) {
@@ -17708,7 +17668,7 @@
17708
17668
  const imageNode = typeof imageUrl === "string" ? /* @__PURE__ */ React.createElement("img", { className: "img", src: imageUrl, alt: "empty" }) : imageUrl;
17709
17669
  React.useEffect(() => {
17710
17670
  setImgStyle(() => {
17711
- if (!imageSize) {
17671
+ if (typeof imageSize !== "number" && typeof imageSize !== "string") {
17712
17672
  return {};
17713
17673
  }
17714
17674
  if (typeof imageSize === "number") {
@@ -19573,29 +19533,29 @@
19573
19533
  onClick: (event) => {
19574
19534
  }
19575
19535
  };
19576
- const classPrefix$7 = `nut-animate`;
19536
+ const classPrefix$7 = "nut-animate";
19577
19537
  const Animate = (props) => {
19578
19538
  const { className, type, action, loop: loop2, onClick, children, ...rest } = {
19579
19539
  ...defaultProps$s,
19580
19540
  ...props
19581
19541
  };
19582
19542
  const [clicked, setClicked] = React.useState(false);
19583
- const classes = classNames({
19584
- "nut-ani-container": true,
19585
- [`${classPrefix$7}-${type}`]: action === "initial" || clicked ? type : false,
19586
- loop: loop2
19587
- });
19588
- const cls = classNames(classes, className);
19543
+ const classes = classNames(
19544
+ {
19545
+ "nut-ani-container": true,
19546
+ [`${classPrefix$7}-${type}`]: action === "initial" || clicked,
19547
+ loop: loop2
19548
+ },
19549
+ className
19550
+ );
19589
19551
  const handleClick2 = (event) => {
19590
19552
  setClicked(true);
19591
19553
  if (!loop2) {
19592
- setTimeout(() => {
19593
- setClicked(false);
19594
- }, 1e3);
19554
+ setTimeout(() => setClicked(false), 1e3);
19595
19555
  }
19596
- onClick && onClick(event);
19556
+ onClick(event);
19597
19557
  };
19598
- return /* @__PURE__ */ React.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React.createElement("div", { className: cls, onClick: handleClick2, ...rest }, children));
19558
+ return /* @__PURE__ */ React.createElement("div", { className: "nut-animate" }, /* @__PURE__ */ React.createElement("div", { className: classes, onClick: handleClick2, ...rest }, children));
19599
19559
  };
19600
19560
  Animate.displayName = "NutAnimate";
19601
19561
  const defaultProps$r = {