@nutui/nutui-react-taro 2.7.6 → 2.7.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +20 -7
  2. package/dist/esm/Address/style/style.css +1 -1
  3. package/dist/esm/Address.js +1 -1
  4. package/dist/esm/Cascader/style/style.css +1 -1
  5. package/dist/esm/Cascader.js +1 -1
  6. package/dist/esm/DatePicker.js +1 -1
  7. package/dist/esm/Empty.js +1 -1
  8. package/dist/esm/Form.js +2 -1
  9. package/dist/esm/FormItem.js +1 -1
  10. package/dist/esm/TabPane.js +1 -1
  11. package/dist/esm/Tabs/style/style.css +1 -1
  12. package/dist/esm/Tabs.js +1 -1
  13. package/dist/esm/{address.taro-BCoDZM6h.js → address.taro-Ck0ZmxRg.js} +1 -1
  14. package/dist/esm/{cascader.taro-BwRnRQXE.js → cascader.taro-DUJvcGw0.js} +1 -1
  15. package/dist/esm/{datepicker.taro-DicskhhH.js → datepicker.taro-Dwh8sKhJ.js} +8 -0
  16. package/dist/esm/{empty.taro-DhCHSdca.js → empty.taro-ChtnK90s.js} +1 -1
  17. package/dist/esm/{formitem.taro-CU6rrcJD.js → formitem.taro-Bee3MWwq.js} +121 -31
  18. package/dist/esm/nutui-react.es.js +7 -7
  19. package/dist/esm/{tabpane.taro-BAe86j3t.js → tabpane.taro-BAihO3w8.js} +2 -1
  20. package/dist/esm/{tabs.taro-CnXiMR_B.js → tabs.taro-sp_DNWis.js} +26 -44
  21. package/dist/locales/base.js +1 -1
  22. package/dist/locales/en-US.js +1 -1
  23. package/dist/locales/id-ID.js +1 -1
  24. package/dist/locales/tr-TR.js +1 -1
  25. package/dist/locales/zh-CN.js +1 -1
  26. package/dist/locales/zh-TW.js +1 -1
  27. package/dist/locales/zh-UG.js +1 -1
  28. package/dist/nutui.react.es.js +161 -100
  29. package/dist/nutui.react.umd.js +161 -100
  30. package/dist/packages/tabs/tabs.scss +72 -115
  31. package/dist/style.css +1 -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/merge.d.ts +14 -1
  38. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tarojs/taro"), require("@tarojs/components"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "@tarojs/taro", "@tarojs/components", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory((global2.nutui = global2.nutui || {}, global2.nutui.react = {}), global2.React, global2.Taro, global2.components, global2.ReactDOM));
3
3
  })(this, function(exports2, React, Taro, components, ReactDOM) {
4
4
  "use strict";/*!
5
- * @nutui/nutui-react-taro v2.7.6 Fri Jan 10 2025 10:43:35 GMT+0800 (China Standard Time)
5
+ * @nutui/nutui-react v2.7.7 Fri Jan 24 2025 13:57:13 GMT+0800 (China Standard Time)
6
6
  * (c) 2023 @jdf2e.
7
7
  * Released under the MIT License.
8
8
  */
@@ -3938,7 +3938,7 @@
3938
3938
  }));
3939
3939
  };
3940
3940
  Space.displayName = "NutSpace";
3941
- function useWatch(dep, callback, config2 = { immediate: false }) {
3941
+ function useWatch$1(dep, callback, config2 = { immediate: false }) {
3942
3942
  const { immediate } = config2;
3943
3943
  const prev = React.useRef();
3944
3944
  const inited = React.useRef(false);
@@ -4074,7 +4074,7 @@
4074
4074
  const [rootRect, setRootRect] = React.useState({});
4075
4075
  const [fixed, setFixed] = React.useState(false);
4076
4076
  const [transform, setTransform] = React.useState(0);
4077
- useWatch(fixed, () => {
4077
+ useWatch$1(fixed, () => {
4078
4078
  onChange && onChange(fixed);
4079
4079
  });
4080
4080
  const rootStyle = React.useMemo(() => {
@@ -5269,7 +5269,7 @@
5269
5269
  autoHeightClassName,
5270
5270
  className
5271
5271
  );
5272
- return children ? /* @__PURE__ */ React.createElement("div", { className: classes }, !disabled && children) : null;
5272
+ return children && /* @__PURE__ */ React.createElement(components.View, { className: classes }, !disabled && children);
5273
5273
  };
5274
5274
  const inBrowser = typeof window !== "undefined";
5275
5275
  function requestAniFrame() {
@@ -5313,24 +5313,19 @@
5313
5313
  value: outerValue,
5314
5314
  defaultValue: outerDefaultValue,
5315
5315
  ...rest
5316
- } = {
5317
- ...defaultProps$18,
5318
- ...props
5319
- };
5316
+ } = { ...defaultProps$18, ...props };
5320
5317
  const uuid = useUuid();
5321
5318
  const [value, setValue] = usePropsValue({
5322
5319
  value: outerValue,
5323
5320
  defaultValue: outerDefaultValue,
5324
- finalValue: 0,
5325
5321
  onChange
5326
5322
  });
5327
5323
  const titleItemsRef = React.useRef([]);
5328
- const navRef = React.useRef(null);
5329
5324
  const getTitles = () => {
5330
5325
  const titles2 = [];
5331
5326
  React.Children.forEach(children, (child, idx) => {
5332
5327
  if (React.isValidElement(child)) {
5333
- const props2 = child == null ? void 0 : child.props;
5328
+ const { props: props2 } = child;
5334
5329
  if ((props2 == null ? void 0 : props2.title) || (props2 == null ? void 0 : props2.value)) {
5335
5330
  titles2.push({
5336
5331
  title: props2.title,
@@ -5365,13 +5360,8 @@
5365
5360
  );
5366
5361
  const classesTitle = classNames(`${classPrefix$k}-titles`, {
5367
5362
  [`${classPrefix$k}-titles-${activeType}`]: activeType,
5368
- [`${classPrefix$k}-titles-scrollable`]: true,
5369
5363
  [`${classPrefix$k}-titles-${align}`]: align
5370
5364
  });
5371
- const tabsActiveStyle = {
5372
- color: activeType === "smile" ? activeColor : "",
5373
- background: activeType === "line" ? activeColor : ""
5374
- };
5375
5365
  const getRect2 = (selector) => {
5376
5366
  return new Promise((resolve) => {
5377
5367
  Taro.createSelectorQuery().select(selector).boundingClientRect().exec((rect = []) => {
@@ -5387,22 +5377,15 @@
5387
5377
  });
5388
5378
  };
5389
5379
  const scrollWithAnimation = React.useRef(false);
5390
- const navRectRef = React.useRef();
5391
- const titleRectRef = React.useRef([]);
5392
5380
  const [scrollLeft, setScrollLeft] = React.useState(0);
5393
5381
  const [scrollTop, setScrollTop] = React.useState(0);
5394
5382
  const scrollDirection = (to, direction2) => {
5395
5383
  let count = 0;
5396
5384
  const frames = 1;
5397
5385
  function animate() {
5398
- if (direction2 === "horizontal") {
5399
- setScrollLeft(to);
5400
- } else {
5401
- setScrollTop(to);
5402
- }
5403
- if (++count < frames) {
5404
- requestAniFrame$1(animate);
5405
- }
5386
+ if (direction2 === "horizontal") setScrollLeft(to);
5387
+ else setScrollTop(to);
5388
+ if (++count < frames) requestAniFrame$1(animate);
5406
5389
  }
5407
5390
  animate();
5408
5391
  };
@@ -5412,17 +5395,17 @@
5412
5395
  getRect2(`#nut-tabs-titles-${name || uuid} .nut-tabs-list`),
5413
5396
  getAllRect(`#nut-tabs-titles-${name || uuid} .nut-tabs-titles-item`)
5414
5397
  ]).then(([navRect, titleRects]) => {
5415
- navRectRef.current = navRect;
5416
- titleRectRef.current = titleRects;
5417
- const titleRect = titleRectRef.current[index];
5398
+ const titleRect = titleRects[index];
5418
5399
  if (!titleRect) return;
5419
5400
  let to = 0;
5420
5401
  if (direction === "vertical") {
5421
5402
  const top = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.height, 0);
5422
- to = top - (navRectRef.current.height - titleRect.height) / 2;
5403
+ to = top - (navRect.height - titleRect.height) / 2;
5423
5404
  } else {
5424
5405
  const left2 = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.width, 0);
5425
- to = rtl ? -left2 : left2;
5406
+ to = left2 - (navRect.width - titleRect.width) / 2;
5407
+ if (to < 0) return;
5408
+ to = rtl ? -to : to;
5426
5409
  }
5427
5410
  Taro.nextTick(() => {
5428
5411
  scrollWithAnimation.current = true;
@@ -5437,7 +5420,7 @@
5437
5420
  );
5438
5421
  index = index < 0 ? 0 : index;
5439
5422
  return {
5440
- transform: direction === "horizontal" ? `translate3d(${rtl ? "" : "-"}${index * 100}%, 0, 0)` : `translate3d( 0,-${index * 100}%, 0)`,
5423
+ transform: direction === "horizontal" ? `translate3d(${rtl ? "" : "-"}${index * 100}%, 0, 0)` : `translate3d( 0, -${index * 100}%, 0)`,
5441
5424
  transitionDuration: `${duration}ms`
5442
5425
  };
5443
5426
  };
@@ -5448,12 +5431,11 @@
5448
5431
  index = index < 0 ? 0 : index;
5449
5432
  scrollIntoView(index);
5450
5433
  }, [value]);
5451
- const tabChange = (item, index) => {
5434
+ const tabChange = (item) => {
5452
5435
  onClick && onClick(item.value);
5453
- if (item.disabled) {
5454
- return;
5436
+ if (!item.disabled) {
5437
+ setValue(item.value);
5455
5438
  }
5456
- setValue(item.value);
5457
5439
  };
5458
5440
  return /* @__PURE__ */ React.createElement(components.View, { className: classes, ...rest }, /* @__PURE__ */ React.createElement(
5459
5441
  components.ScrollView,
@@ -5468,71 +5450,55 @@
5468
5450
  scrollWithAnimation: rtl && Taro.getEnv() !== "WEB" ? false : scrollWithAnimation.current,
5469
5451
  id: `nut-tabs-titles-${name || uuid}`,
5470
5452
  className: classesTitle,
5471
- style: { ...tabStyle }
5453
+ style: tabStyle
5472
5454
  },
5473
- /* @__PURE__ */ React.createElement(components.View, { className: "nut-tabs-list", ref: navRef }, !!title && typeof title === "function" ? title() : titles.current.map((item, index) => {
5455
+ /* @__PURE__ */ React.createElement(components.View, { className: "nut-tabs-list" }, !!title && typeof title === "function" ? title() : titles.current.map((item, index) => {
5474
5456
  return /* @__PURE__ */ React.createElement(
5475
5457
  components.View,
5476
5458
  {
5459
+ key: item.value,
5477
5460
  ref: (ref) => titleItemsRef.current.push(ref),
5478
5461
  id: `scrollIntoView${index}`,
5479
- onClick: (e2) => {
5480
- tabChange(item);
5481
- },
5462
+ onClick: () => tabChange(item),
5482
5463
  className: classNames(`${classPrefix$k}-titles-item`, {
5483
5464
  [`nut-tabs-titles-item-active`]: !item.disabled && String(item.value) === String(value),
5484
5465
  [`nut-tabs-titles-item-disabled`]: item.disabled,
5485
5466
  [`nut-tabs-titles-item-${align}`]: align
5486
- }),
5487
- key: item.value
5467
+ })
5488
5468
  },
5489
5469
  activeType === "line" && /* @__PURE__ */ React.createElement(
5490
5470
  components.View,
5491
5471
  {
5492
5472
  className: classNames(
5493
5473
  `${classPrefix$k}-titles-item-line`,
5494
- {
5495
- [`${classPrefix$k}-titles-item-line-${direction}`]: true
5496
- }
5474
+ `${classPrefix$k}-titles-item-line-${direction}`
5497
5475
  ),
5498
- style: tabsActiveStyle
5476
+ style: { background: activeColor }
5499
5477
  }
5500
5478
  ),
5501
- activeType === "smile" && /* @__PURE__ */ React.createElement(
5502
- components.View,
5503
- {
5504
- className: `${classPrefix$k}-titles-item-smile`,
5505
- style: tabsActiveStyle
5506
- },
5507
- /* @__PURE__ */ React.createElement(L$1, { color: activeColor })
5508
- ),
5479
+ activeType === "smile" && /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix$k}-titles-item-smile` }, /* @__PURE__ */ React.createElement(L$1, { color: activeColor })),
5509
5480
  /* @__PURE__ */ React.createElement(
5510
5481
  components.View,
5511
5482
  {
5512
5483
  className: classNames(
5513
- `${classPrefix$k}-ellipsis`,
5484
+ {
5485
+ [`${classPrefix$k}-ellipsis`]: direction === "vertical"
5486
+ },
5514
5487
  `${classPrefix$k}-titles-item-text`
5515
- )
5488
+ ),
5489
+ style: { color: activeColor }
5516
5490
  },
5517
5491
  item.title
5518
5492
  )
5519
5493
  );
5520
5494
  }))
5521
5495
  ), /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix$k}-content-wrap` }, /* @__PURE__ */ React.createElement(components.View, { className: `${classPrefix$k}-content`, style: getContentStyle() }, React.Children.map(children, (child, idx) => {
5522
- if (!React.isValidElement(child)) {
5523
- return null;
5524
- }
5525
- let childProps = {
5496
+ if (!React.isValidElement(child)) return null;
5497
+ return React.cloneElement(child, {
5526
5498
  ...child.props,
5527
- active: value === child.props.value
5528
- };
5529
- if (String(value) !== String(child.props.value || idx) && autoHeight) {
5530
- childProps = {
5531
- ...childProps,
5532
- autoHeightClassName: "inactive"
5533
- };
5534
- }
5535
- return React.cloneElement(child, childProps);
5499
+ active: value === child.props.value,
5500
+ autoHeightClassName: autoHeight && String(value) !== String(child.props.value || idx) ? "inactive" : void 0
5501
+ });
5536
5502
  }))));
5537
5503
  };
5538
5504
  Tabs.displayName = "NutTabs";
@@ -8717,6 +8683,14 @@
8717
8683
  Number(formatDate[2]),
8718
8684
  getMonthEndDay(Number(formatDate[0]), Number(formatDate[1]))
8719
8685
  );
8686
+ if (selectedOptions.length >= 2 && ["date", "datehour", "datetime", "month-day"].includes(rangeType)) {
8687
+ const dayOption = formatOption("day", day);
8688
+ if (rangeType === "month-day") {
8689
+ selectedOptions[1] = dayOption;
8690
+ } else {
8691
+ selectedOptions[2] = dayOption;
8692
+ }
8693
+ }
8720
8694
  let date2 = null;
8721
8695
  if (rangeType === "date" || rangeType === "month-day" || rangeType === "year-month") {
8722
8696
  date2 = new Date(year, month, day);
@@ -9630,7 +9604,7 @@
9630
9604
  pattern: {
9631
9605
  mismatch: "%s value %s does not match pattern %s"
9632
9606
  },
9633
- clone: function clone() {
9607
+ clone: function clone2() {
9634
9608
  var cloned = JSON.parse(JSON.stringify(this));
9635
9609
  cloned.clone = this.clone;
9636
9610
  return cloned;
@@ -9894,23 +9868,55 @@
9894
9868
  Schema.warning = warning;
9895
9869
  Schema.messages = messages;
9896
9870
  Schema.validators = validators;
9897
- function merge(...objects) {
9898
- const result = Array.isArray(objects[0]) ? [] : {};
9899
- function mergeHelper(obj, path = []) {
9900
- for (const [key, value] of Object.entries(obj)) {
9901
- const newPath = [...path, key];
9902
- if (Array.isArray(value)) {
9903
- result[key] = [...value];
9904
- } else if (typeof value === "object" && value !== null) {
9905
- if (path.some((p) => p === value)) continue;
9906
- if (!result[key]) result[key] = {};
9907
- mergeHelper(value, newPath);
9908
- } else {
9909
- result[key] = value;
9910
- }
9871
+ function merge(...items) {
9872
+ return _merge(items[0] === true, false, items);
9873
+ }
9874
+ function recursive(...items) {
9875
+ return _merge(items[0] === true, true, items);
9876
+ }
9877
+ function clone(input) {
9878
+ if (Array.isArray(input)) {
9879
+ const output = [];
9880
+ for (let index = 0; index < input.length; ++index)
9881
+ output.push(clone(input[index]));
9882
+ return output;
9883
+ }
9884
+ if (isPlainObject(input)) {
9885
+ const output = {};
9886
+ for (const index in input) output[index] = clone(input[index]);
9887
+ return output;
9888
+ }
9889
+ return input;
9890
+ }
9891
+ function isPlainObject(input) {
9892
+ if (input === null || typeof input !== "object") return false;
9893
+ if (Object.getPrototypeOf(input) === null) return true;
9894
+ let ref = input;
9895
+ while (Object.getPrototypeOf(ref) !== null) ref = Object.getPrototypeOf(ref);
9896
+ return Object.getPrototypeOf(input) === ref;
9897
+ }
9898
+ function _recursiveMerge(base, extend) {
9899
+ if (!isPlainObject(base) || !isPlainObject(extend)) return extend;
9900
+ for (const key in extend) {
9901
+ if (key === "__proto__" || key === "constructor" || key === "prototype")
9902
+ continue;
9903
+ base[key] = isPlainObject(base[key]) && isPlainObject(extend[key]) ? _recursiveMerge(base[key], extend[key]) : extend[key];
9904
+ }
9905
+ return base;
9906
+ }
9907
+ function _merge(isClone, isRecursive, items) {
9908
+ let result;
9909
+ if (isClone || !isPlainObject(result = items.shift())) result = {};
9910
+ for (let index = 0; index < items.length; ++index) {
9911
+ const item = items[index];
9912
+ if (!isPlainObject(item)) continue;
9913
+ for (const key in item) {
9914
+ if (key === "__proto__" || key === "constructor" || key === "prototype")
9915
+ continue;
9916
+ const value = isClone ? clone(item[key]) : item[key];
9917
+ result[key] = isRecursive ? _recursiveMerge(result[key], value) : value;
9911
9918
  }
9912
9919
  }
9913
- objects.filter((obj) => !!obj).forEach((obj) => mergeHelper(obj));
9914
9920
  return result;
9915
9921
  }
9916
9922
  const SECRET = "NUT_FORM_INTERNAL";
@@ -9926,9 +9932,6 @@
9926
9932
  this.fieldEntities.push(field);
9927
9933
  return () => {
9928
9934
  this.fieldEntities = this.fieldEntities.filter((item) => item !== field);
9929
- if (this.store) {
9930
- delete this.store[field.props.name];
9931
- }
9932
9935
  };
9933
9936
  };
9934
9937
  this.getFieldValue = (name) => {
@@ -9950,10 +9953,11 @@
9950
9953
  if (init) {
9951
9954
  const nextStore = merge(initialValues, this.store);
9952
9955
  this.updateStore(nextStore);
9956
+ this.notifyWatch();
9953
9957
  }
9954
9958
  };
9955
9959
  this.setFieldsValue = (newStore) => {
9956
- const nextStore = merge(this.store, newStore);
9960
+ const nextStore = recursive(true, this.store, newStore);
9957
9961
  this.updateStore(nextStore);
9958
9962
  this.fieldEntities.forEach((entity) => {
9959
9963
  const { name } = entity.props;
@@ -9972,12 +9976,14 @@
9972
9976
  item.entity.onStoreChange("update");
9973
9977
  }
9974
9978
  });
9979
+ this.notifyWatch();
9975
9980
  };
9976
9981
  this.setFieldValue = (name, value) => {
9977
9982
  const store = {
9978
9983
  [name]: value
9979
9984
  };
9980
9985
  this.setFieldsValue(store);
9986
+ this.notifyWatch([name]);
9981
9987
  };
9982
9988
  this.setCallback = (callback) => {
9983
9989
  this.callbacks = {
@@ -10020,7 +10026,6 @@
10020
10026
  };
10021
10027
  this.validateFields = async (nameList) => {
10022
10028
  let filterEntities = [];
10023
- this.errors.length = 0;
10024
10029
  if (!nameList || nameList.length === 0) {
10025
10030
  filterEntities = this.fieldEntities;
10026
10031
  } else {
@@ -10045,13 +10050,29 @@
10045
10050
  (_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c, this.store, errors);
10046
10051
  }
10047
10052
  };
10048
- this.resetFields = () => {
10049
- this.errors.length = 0;
10050
- const nextStore = merge({}, this.initialValues);
10051
- this.updateStore(nextStore);
10052
- this.fieldEntities.forEach((entity) => {
10053
- entity.onStoreChange("reset");
10054
- });
10053
+ this.resetFields = (namePaths) => {
10054
+ if (namePaths && namePaths.length) {
10055
+ namePaths.forEach((path) => {
10056
+ this.errors[path] = null;
10057
+ this.fieldEntities.forEach((entity) => {
10058
+ const name = entity.props.name;
10059
+ if (name === path) {
10060
+ if (path in this.initialValues) {
10061
+ this.updateStore({ [path]: this.initialValues[path] });
10062
+ } else {
10063
+ delete this.store[path];
10064
+ }
10065
+ entity.onStoreChange("reset");
10066
+ }
10067
+ });
10068
+ });
10069
+ } else {
10070
+ const nextStore = merge({}, this.initialValues);
10071
+ this.updateStore(nextStore);
10072
+ this.fieldEntities.forEach((entity) => {
10073
+ entity.onStoreChange("reset");
10074
+ });
10075
+ }
10055
10076
  };
10056
10077
  this.registerUpdate = (field, shouldUpdate) => {
10057
10078
  this.updateList.push({
@@ -10074,7 +10095,8 @@
10074
10095
  dispatch: this.dispatch,
10075
10096
  store: this.store,
10076
10097
  fieldEntities: this.fieldEntities,
10077
- registerUpdate: this.registerUpdate
10098
+ registerUpdate: this.registerUpdate,
10099
+ registerWatch: this.registerWatch
10078
10100
  };
10079
10101
  }
10080
10102
  };
@@ -10091,6 +10113,26 @@
10091
10113
  getInternal: this.getInternal
10092
10114
  };
10093
10115
  };
10116
+ this.watchList = [];
10117
+ this.registerWatch = (callback) => {
10118
+ this.watchList.push(callback);
10119
+ return () => {
10120
+ this.watchList = this.watchList.filter((fn) => fn !== callback);
10121
+ };
10122
+ };
10123
+ this.notifyWatch = (namePath = []) => {
10124
+ if (this.watchList.length) {
10125
+ let allValues;
10126
+ if (!namePath || namePath.length === 0) {
10127
+ allValues = this.getFieldsValue(true);
10128
+ } else {
10129
+ allValues = this.getFieldsValue(namePath);
10130
+ }
10131
+ this.watchList.forEach((callback) => {
10132
+ callback(allValues, namePath);
10133
+ });
10134
+ }
10135
+ };
10094
10136
  this.callbacks = {
10095
10137
  onFinish: () => {
10096
10138
  },
@@ -10114,6 +10156,24 @@
10114
10156
  }
10115
10157
  return [formRef.current];
10116
10158
  };
10159
+ const useWatch = (path, form) => {
10160
+ const formInstance = form.getInternal(SECRET);
10161
+ const [value, setValue] = React.useState();
10162
+ React.useEffect(() => {
10163
+ const unsubscribe = formInstance.registerWatch(
10164
+ (data, namePath) => {
10165
+ const value2 = data[path];
10166
+ setValue(value2);
10167
+ }
10168
+ );
10169
+ const initialValue = form.getFieldsValue(true);
10170
+ if (value !== initialValue[path]) {
10171
+ setValue(initialValue[path]);
10172
+ }
10173
+ return () => unsubscribe();
10174
+ }, [form]);
10175
+ return value;
10176
+ };
10117
10177
  const defaultProps$Y = {
10118
10178
  ...ComponentDefaults,
10119
10179
  labelPosition: "right",
@@ -10419,6 +10479,7 @@
10419
10479
  const InnerForm = Form;
10420
10480
  InnerForm.Item = FormItem;
10421
10481
  InnerForm.useForm = useForm;
10482
+ InnerForm.useWatch = useWatch;
10422
10483
  function trimExtraChar(value, char, regExp) {
10423
10484
  const index = value.indexOf(char);
10424
10485
  if (index === -1) {
@@ -13969,7 +14030,7 @@
13969
14030
  const imageNode = typeof imageUrl === "string" ? /* @__PURE__ */ React.createElement("img", { className: "img", src: imageUrl, alt: "empty" }) : imageUrl;
13970
14031
  React.useEffect(() => {
13971
14032
  setImgStyle(() => {
13972
- if (!imageSize) {
14033
+ if (typeof imageSize !== "number" && typeof imageSize !== "string") {
13973
14034
  return {};
13974
14035
  }
13975
14036
  if (typeof imageSize === "number") {