@unicom-cloud/ui 0.8.57 → 0.8.58

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 (261) hide show
  1. package/Affix.js +15 -15
  2. package/Alert.js +5 -5
  3. package/Anchor.js +1 -1
  4. package/AutoComplete.js +28 -28
  5. package/Avatar.js +11 -11
  6. package/BackTop.js +28 -28
  7. package/Badge.js +10 -10
  8. package/Breadcrumb.js +6 -6
  9. package/Button.js +11 -10
  10. package/Calendar.js +8 -8
  11. package/Card.js +3 -3
  12. package/Carousel.js +7 -7
  13. package/Cascader.js +1 -1
  14. package/Checkbox.js +1 -1
  15. package/Collapse.js +1 -1
  16. package/ColorPicker.js +582 -11
  17. package/Comment.js +7 -7
  18. package/ConfigProvider.js +2 -2
  19. package/Copy.js +6 -6
  20. package/DatePicker.js +14 -12
  21. package/Descriptions.js +3 -3
  22. package/Divider.js +3 -3
  23. package/Draggable.js +12 -12
  24. package/Drawer.js +1 -1
  25. package/Dropdown.js +5 -5
  26. package/Empty.js +3 -3
  27. package/Form.js +1410 -10
  28. package/Grid.js +14 -14
  29. package/Icon.js +2 -2
  30. package/IconHover.js +2 -2
  31. package/Image.js +1 -1
  32. package/Input.js +2 -2
  33. package/InputNumber.js +8 -8
  34. package/InputTag.js +1 -1
  35. package/Layout.js +8 -8
  36. package/Link.js +13 -13
  37. package/List.js +21 -21
  38. package/Mentions.js +30 -30
  39. package/Menu.js +1 -1
  40. package/Message.js +3 -3
  41. package/Modal.js +1 -1
  42. package/Notice.js +3 -3
  43. package/Notification.js +4 -4
  44. package/OverflowEllipsis.js +9 -9
  45. package/PageHeader.js +10 -10
  46. package/Pagination.js +1 -1
  47. package/Picker.js +1 -1
  48. package/Popconfirm.js +5 -5
  49. package/Popover.js +7 -7
  50. package/Portal.js +1 -1
  51. package/Progress.js +15 -15
  52. package/Radio.js +2 -2
  53. package/Rate.js +10 -10
  54. package/ResizeBox.js +10 -11
  55. package/Result.js +11 -11
  56. package/Select.js +1 -1
  57. package/SelectView.js +40 -41
  58. package/Skeleton.js +4 -4
  59. package/Slider.js +9 -9
  60. package/Space.js +12 -12
  61. package/SpeechSynthesis.js +1 -1
  62. package/Spin.js +11 -11
  63. package/Statistic.js +43 -43
  64. package/Steps.js +5 -5
  65. package/Switch.js +15 -16
  66. package/Table.js +17 -17
  67. package/Tabs.js +1 -1
  68. package/Tag.js +5 -5
  69. package/TimePicker.js +38 -38
  70. package/Timeline.js +1 -1
  71. package/Tooltip.js +9 -9
  72. package/Transfer.js +26 -26
  73. package/Tree.js +1 -1
  74. package/TreeSelect.js +1 -1
  75. package/Trigger.js +11 -11
  76. package/Typography.js +1 -1
  77. package/Upload.js +4 -1
  78. package/VerificationCode.js +1 -1
  79. package/Version.js +1 -1
  80. package/VirtualList.js +1 -1
  81. package/Watermark.js +1 -1
  82. package/chunk/{m_kOQCiU.js → -LZOUh53.js} +1 -1
  83. package/chunk/{CXNW5Y2a.js → -jdfq71f.js} +1 -1
  84. package/chunk/{CkAOsst1.js → 4-gvEY5y.js} +30 -30
  85. package/chunk/{DQXq1QT0.js → B0GOLsj_.js} +1 -1
  86. package/chunk/{BMvZCjSU.js → B16KHtX-.js} +16 -16
  87. package/chunk/{CggcswbO.js → B2vORJQ8.js} +19 -15
  88. package/chunk/{BCk8e9fj.js → B7Zsp3gO.js} +1 -1
  89. package/chunk/B8QV6E2b.js +34 -0
  90. package/chunk/{BeM2hfks.js → BBVjSFnw.js} +27 -23
  91. package/chunk/{1mEO29GP.js → BDjXkzNj.js} +1 -1
  92. package/chunk/{BuEC_zcc.js → BEDYCG-I.js} +31 -31
  93. package/chunk/{B45v5S9k.js → BHn4xgbv.js} +1 -1
  94. package/chunk/{CF3Telny.js → BJ_7JTqC.js} +3 -3
  95. package/chunk/{BM6dpkeM.js → BLSiP_gg.js} +1 -1
  96. package/chunk/{9Gh1afjL.js → BMJfSSLX.js} +1 -1
  97. package/chunk/{DBJ8d0o0.js → BNHrEI0Y.js} +31 -31
  98. package/chunk/{BP7xX86Q.js → BPZ-6HKJ.js} +131 -134
  99. package/chunk/{DxNRWF67.js → BVLwPZis.js} +11 -11
  100. package/chunk/{BpwDupra.js → BYhtrDV3.js} +9 -9
  101. package/chunk/{D6mVoX-C.js → B_nfMl0e.js} +1 -1
  102. package/chunk/{BWx1cVT_.js → BcS17Pzy.js} +1 -1
  103. package/chunk/Bdh4XVuf.js +1487 -0
  104. package/chunk/{BkHxm4sv.js → BdiEwtQO.js} +1 -1
  105. package/chunk/{DDda6s72.js → BjSHZA0m.js} +6 -6
  106. package/chunk/{C7Okdv4u.js → Bpug_KxP.js} +1 -1
  107. package/chunk/BzPkh4Zv.js +11 -0
  108. package/chunk/{CwXmtKib.js → C1D7T29r.js} +35 -35
  109. package/chunk/{DYZzQ2uT.js → C1u_ckwU.js} +1 -1
  110. package/chunk/C1xMmQIZ.js +468 -0
  111. package/chunk/C2lIz2F9.js +60 -0
  112. package/chunk/{Be7oeWU8.js → C43Hv2Bl.js} +1 -1
  113. package/chunk/{CR4u270n.js → C5AQWbC4.js} +79 -79
  114. package/chunk/{fqgc8r6C.js → C9vsih_D.js} +1 -1
  115. package/chunk/CANaGbGR.js +154 -0
  116. package/chunk/{BA02BFUV.js → CAfR2wLq.js} +1 -1
  117. package/chunk/{CcX2pBUh.js → CAfecMDF.js} +1 -1
  118. package/chunk/{BHK9zpXn.js → CKp4rZnD.js} +1 -1
  119. package/chunk/CTxjmYmx.js +19 -0
  120. package/chunk/{BqxwlITu.js → CV2Aqv9q.js} +1 -1
  121. package/chunk/{bsawGxt8.js → CYdarMv9.js} +1 -1
  122. package/chunk/{DafaH1Qt.js → C_S5Mdvd.js} +43 -44
  123. package/chunk/{DkIjpuBZ.js → Cbd50gx8.js} +11 -11
  124. package/chunk/{D5p8q9Pa.js → CbiWdbr_.js} +12 -12
  125. package/chunk/{cUuQh7L_.js → CmB-TL7C.js} +1 -1
  126. package/chunk/{BbYzi8M0.js → CuOl4X0X.js} +4 -4
  127. package/chunk/{BHLTzWzi.js → D-ER56Sf.js} +1 -1
  128. package/chunk/{BK1FKNAX.js → D-aYnb6u.js} +1 -1
  129. package/chunk/{DalIRWr7.js → D2HkyI6A.js} +9 -9
  130. package/chunk/D3NFxdmG.js +518 -0
  131. package/chunk/{C2fspJbE.js → D3xQFJcO.js} +1 -1
  132. package/chunk/{Lk60-jkf.js → DApXtulb.js} +4 -0
  133. package/chunk/{sl8s35SK.js → DJcEys80.js} +1 -1
  134. package/chunk/{B1S1OEw6.js → DLIm6rRJ.js} +1 -1
  135. package/chunk/{C95ipQ6b.js → DOWEHtqM.js} +1 -1
  136. package/chunk/{aM2ePYrq.js → DSGRHf-1.js} +132 -132
  137. package/chunk/{D9TqtOhq.js → DT37l12z.js} +1 -1
  138. package/chunk/{B6fn5y_s.js → DW-B7npC.js} +1 -1
  139. package/chunk/D_-UD4vO.js +119 -0
  140. package/chunk/{Dtnux4qL.js → D_MTFBb0.js} +1 -1
  141. package/chunk/{WkB0MERB.js → DhBo0pPJ.js} +27 -27
  142. package/chunk/DmUhn9ib.js +961 -0
  143. package/chunk/{Bny52uiG.js → DpfUGhi4.js} +10 -10
  144. package/chunk/{DhLbnw3R.js → Dx_5J4fO.js} +1 -1
  145. package/chunk/{B9PsJar0.js → Dy487FZ1.js} +1 -1
  146. package/chunk/{D6RTBH4C.js → IooeSKJJ.js} +10 -10
  147. package/chunk/Kbr6FzOG.js +745 -0
  148. package/chunk/{CwjaGytU.js → RMBPs_Ry.js} +32 -32
  149. package/chunk/Uz-rNulO.js +98 -0
  150. package/chunk/V6euPXVB.js +1025 -0
  151. package/chunk/{Bv8ZRDFt.js → YIlBPVAs.js} +14 -14
  152. package/chunk/{DPvnQJ-H.js → cDZI_t6o.js} +1 -1
  153. package/chunk/{C-w9pFY-.js → cZiP8FvM.js} +3 -3
  154. package/chunk/{DJmWXheU.js → eK7lxdak.js} +8 -8
  155. package/chunk/{Dg2DmtzA.js → gIbzjQ-X.js} +5 -6
  156. package/chunk/{CPl52AZh.js → sScV-J56.js} +1 -1
  157. package/chunk/{BbI3gqVr.js → wI2I1qb0.js} +1 -1
  158. package/hooks/index.js +32 -32
  159. package/hooks/use-verification-code.js +23 -22
  160. package/hooks/use-watermark.js +2 -1
  161. package/hooks/useComputedState.js +2 -1
  162. package/hooks/useCreate.js +2 -1
  163. package/hooks/useForceUpdate.js +2 -1
  164. package/hooks/useId.js +2 -1
  165. package/hooks/useInView.js +5 -4
  166. package/hooks/useIntersectionObserver.js +11 -11
  167. package/hooks/useIsFirstRender.js +2 -1
  168. package/hooks/useIsomorphicLayoutEffect.js +2 -1
  169. package/hooks/useKeyboardEvent.js +3 -2
  170. package/hooks/useMedia.js +2 -1
  171. package/hooks/useMergeProps.js +2 -1
  172. package/hooks/useMergeValue.js +4 -3
  173. package/hooks/useOverflowHidden.js +2 -1
  174. package/hooks/useOverrideRef.js +2 -1
  175. package/hooks/usePersistCallback.js +2 -1
  176. package/hooks/usePrevious.js +2 -1
  177. package/hooks/useRefs.js +2 -1
  178. package/hooks/useResizeObserver.js +2 -1
  179. package/hooks/useStateCallback.js +2 -1
  180. package/hooks/useStateWithPromise.js +2 -1
  181. package/hooks/useUpdateEffect.js +2 -1
  182. package/hooks/useWatch.js +3 -2
  183. package/hooks/useWindowSize.js +2 -1
  184. package/icons.js +35 -35
  185. package/index.js +484 -376
  186. package/locale/en-US.js +3 -11
  187. package/locale/tr-TR.js +3 -11
  188. package/package.json +1 -1
  189. package/types/anchor/Anchor.d.ts +1 -1
  190. package/types/button/index.d.ts +3 -2
  191. package/types/color-picker/hooks/useColorPicker.d.ts +1 -1
  192. package/types/color-picker/hooks/useControlBlock.d.ts +1 -1
  193. package/types/config-provider/interface.d.ts +1 -0
  194. package/types/date-picker/PickerRange.d.ts +1 -1
  195. package/types/hooks/use-verification-code/index.d.ts +2 -1
  196. package/types/hooks/use-watermark/index.d.ts +2 -1
  197. package/types/hooks/useComputedState.d.ts +2 -2
  198. package/types/hooks/useCreate.d.ts +2 -1
  199. package/types/hooks/useForceUpdate.d.ts +2 -1
  200. package/types/hooks/useId.d.ts +2 -1
  201. package/types/hooks/useInView.d.ts +1 -1
  202. package/types/hooks/useIntersectionObserver.d.ts +1 -1
  203. package/types/hooks/useIsFirstRender.d.ts +2 -1
  204. package/types/hooks/useIsomorphicLayoutEffect.d.ts +1 -1
  205. package/types/hooks/useKeyboardEvent.d.ts +2 -2
  206. package/types/hooks/useMedia.d.ts +1 -1
  207. package/types/hooks/useMergeProps.d.ts +2 -1
  208. package/types/hooks/useMergeValue.d.ts +2 -1
  209. package/types/hooks/useOverflowHidden.d.ts +2 -2
  210. package/types/hooks/useOverrideRef.d.ts +2 -1
  211. package/types/hooks/usePersistCallback.d.ts +2 -1
  212. package/types/hooks/usePrevious.d.ts +2 -1
  213. package/types/hooks/useRefs.d.ts +2 -1
  214. package/types/hooks/useResizeObserver.d.ts +2 -1
  215. package/types/hooks/useStateCallback.d.ts +1 -1
  216. package/types/hooks/useStateWithPromise.d.ts +1 -1
  217. package/types/hooks/useUpdateEffect.d.ts +2 -1
  218. package/types/hooks/useWatch.d.ts +2 -1
  219. package/types/hooks/useWindowSize.d.ts +1 -1
  220. package/types/image/interface.d.ts +1 -1
  221. package/types/index.d.ts +13 -22
  222. package/types/table/interface.d.ts +3 -1
  223. package/types/upload/Upload.d.ts +2 -1
  224. package/types/upload/index.d.ts +3 -1
  225. package/types/upload/request_.d.ts +3 -0
  226. package/types/utils/caseName.d.ts +2 -0
  227. package/types/utils/fileToURL.d.ts +2 -0
  228. package/types/utils/fillNBSP.d.ts +1 -1
  229. package/types/utils/index.d.ts +37 -0
  230. package/types/utils/is.d.ts +2 -2
  231. package/types/utils/lodash.d.ts +4 -0
  232. package/types/utils/scrollIntoView.d.ts +2 -1
  233. package/types/version/index.d.ts +1 -1
  234. package/ui.css +1 -0
  235. package/utils/CSSTransition.js +1 -1
  236. package/utils/caseName.js +20 -0
  237. package/utils/className.js +1 -1
  238. package/utils/contextHolder.js +1 -1
  239. package/utils/fileToURL.js +4 -0
  240. package/utils/index.js +219 -0
  241. package/utils/is.js +95 -93
  242. package/utils/keyCode.js +10 -46
  243. package/utils/lodash.js +8 -0
  244. package/utils/mergedToString.js +11 -10
  245. package/utils/reactDOM.js +1 -1
  246. package/utils/saveAs.js +1 -1
  247. package/utils/scrollIntoView.js +8 -7
  248. package/chunk/5pZ3ayqs.js +0 -29
  249. package/chunk/Bl-ODC57.js +0 -945
  250. package/chunk/BlKc_pDZ.js +0 -678
  251. package/chunk/CiEln_Q1.js +0 -517
  252. package/chunk/CiZVOdJ3.js +0 -122
  253. package/chunk/DMWMrXg1.js +0 -964
  254. package/chunk/DUxWiN2U.js +0 -1465
  255. package/chunk/Dbk4DVhB.js +0 -855
  256. package/chunk/Do1aMgY3.js +0 -12
  257. package/chunk/HlP8inLK.js +0 -1796
  258. package/chunk/V_IcWDFx.js +0 -49
  259. package/style.css +0 -1
  260. /package/types/utils/{mergeProp.d.ts → mergeProps.d.ts} +0 -0
  261. /package/utils/{mergeProp.js → mergeProps.js} +0 -0
package/Form.js CHANGED
@@ -1,12 +1,1412 @@
1
- import { C as o, I as r, L as e, a as t, F as m, u as F, b as u, c as d, d as C } from "./chunk/HlP8inLK.js";
1
+ var Ze = Object.defineProperty;
2
+ var Ye = (s, e, t) => e in s ? Ze(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var u = (s, e, t) => Ye(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { jsx as f, jsxs as J, Fragment as Ne } from "react/jsx-runtime";
5
+ import { p as Ke } from "./chunk/CANaGbGR.js";
6
+ import M from "lodash/isPlainObject";
7
+ import Me from "lodash/merge";
8
+ import H, { createContext as ue, useRef as L, forwardRef as Ve, useContext as O, useEffect as ie, useImperativeHandle as et, Component as tt, isValidElement as fe, useState as ce, useMemo as we, createElement as Ee, cloneElement as Te, useCallback as ee } from "react";
9
+ import { d as xe, a as rt } from "./chunk/Bdh4XVuf.js";
10
+ import { useCreate as st } from "./hooks/useCreate.js";
11
+ import { useMergeProps as it } from "./hooks/useMergeProps.js";
12
+ import { y as G } from "./chunk/BzPkh4Zv.js";
13
+ import _e from "./utils/omit.js";
14
+ import { NOOP as b } from "./utils/constant.js";
15
+ import $ from "lodash/get";
16
+ import Le from "lodash/has";
17
+ import T from "lodash/isArray";
18
+ import j from "lodash/isFunction";
19
+ import nt from "lodash/omit";
20
+ import De from "lodash/setWith";
21
+ import { isExist as $e } from "./utils/is.js";
22
+ import { P as lt } from "./chunk/C1xMmQIZ.js";
23
+ import Ue from "lodash/cloneDeepWith";
24
+ import Oe from "lodash/set";
25
+ import { b as ot, c as at, a as ct, e as ut } from "./chunk/BHn4xgbv.js";
26
+ import dt from "lodash/isBoolean";
27
+ import pe from "lodash/isEqualWith";
28
+ import ht from "lodash/isNil";
29
+ import re from "./utils/warning.js";
30
+ import te from "lodash/isUndefined";
31
+ import je from "./Grid.js";
32
+ import { P as gt } from "./chunk/BPZ-6HKJ.js";
33
+ import { I as mt } from "./chunk/C43Hv2Bl.js";
34
+ import Ft from "./Tooltip.js";
35
+ import { useForceUpdate as ft } from "./hooks/useForceUpdate.js";
36
+ import pt from "lodash/isString";
37
+ const se = ue({
38
+ layout: "horizontal",
39
+ labelCol: { span: 5, offset: 0 },
40
+ labelAlign: "right",
41
+ wrapperCol: { span: 19, offset: 0 },
42
+ requiredSymbol: !0,
43
+ getFormElementId: () => "pqb-",
44
+ store: {
45
+ clearFields: b,
46
+ getFieldsValue: b,
47
+ getFieldValue: b,
48
+ getFieldError: b,
49
+ getFieldsError: b,
50
+ getTouchedFields: b,
51
+ getFields: b,
52
+ getInitialValues: b,
53
+ setInitialValues: b,
54
+ setInitialValue: b,
55
+ setFieldValue: b,
56
+ setFieldsValue: b,
57
+ setFields: b,
58
+ resetFields: b,
59
+ submit: b,
60
+ validate: b,
61
+ getFieldsState: b,
62
+ scrollToField: b,
63
+ getInnerMethods: () => ({
64
+ registerField: b,
65
+ innerGetStore: b,
66
+ registerStateWatcher: b,
67
+ registerWatcher: b,
68
+ innerGetStoreStatus: b
69
+ })
70
+ }
71
+ }), Se = ue({}), qe = ue({}), Ge = ue({}), me = {
72
+ error: "error",
73
+ success: "success",
74
+ warning: "warning",
75
+ validating: "validating"
76
+ };
77
+ var U = /* @__PURE__ */ ((s) => (s.init = "init", s.error = "error", s.success = "success", s.submitting = "submitting", s))(U || {});
78
+ class St extends Error {
79
+ constructor(t) {
80
+ super("form validate error, get errors by error.errors");
81
+ u(this, "errors", {});
82
+ this.errors = t;
83
+ }
84
+ }
85
+ function Vt(s) {
86
+ return Object.defineProperty(
87
+ (...e) => typeof e[e.length - 1] == "function" ? s.apply(this, e) : new Promise((t, r) => (e[e.length] = (i, l) => {
88
+ if (i) return r(new St(i));
89
+ t(l);
90
+ }, e.length++, s.apply(this, e))),
91
+ "name",
92
+ { value: s.name }
93
+ );
94
+ }
95
+ function K(s) {
96
+ return Ue(s, (e) => {
97
+ if (!M(e) && !T(e))
98
+ return e;
99
+ });
100
+ }
101
+ const bt = (s, e) => Ue(s, (t) => {
102
+ if (j(t))
103
+ return (r) => t(r, e);
104
+ });
105
+ function N(s, e, t) {
106
+ return Oe(s, e, K(t)), s;
107
+ }
108
+ function ke(s, e = "") {
109
+ const t = /* @__PURE__ */ new Set(), r = (i, l = "") => i ? t.has(i) ? [] : (t.add(i), Object.keys(i).map((n) => (M(i[n]) || T(i[n])) && Object.keys(i[n]).length && !H.isValidElement(i[n]) ? r(i[n], `${l + n}.`) : l + n).flat()) : [];
110
+ return r(s, e);
111
+ }
112
+ function ze(s) {
113
+ var e;
114
+ return ((e = s == null ? void 0 : s.constructor) == null ? void 0 : e.name) === "SyntheticEvent" || (s == null ? void 0 : s.nativeEvent) instanceof Event;
115
+ }
116
+ async function Re(s, e, t, r) {
117
+ const i = [...t || []];
118
+ let l = 0;
119
+ return new Promise(async (n) => {
120
+ const o = [], a = async (d) => {
121
+ const c = () => l < i.length - 1 ? (l++, a(i[l])) : n({ error: null, warning: o });
122
+ if (!d)
123
+ return c();
124
+ const h = { ...d };
125
+ !h.type && !h.validator && (h.type = "string"), new lt({ [s]: [h] }, {
126
+ ignoreEmptyString: !0,
127
+ validateMessages: r
128
+ }).validate({ [s]: e }, (F) => {
129
+ if (F)
130
+ if (d.validateLevel === "warning")
131
+ o.push(F[s].message);
132
+ else
133
+ return n({
134
+ error: F,
135
+ warning: o
136
+ });
137
+ return c();
138
+ });
139
+ };
140
+ a(i[l]);
141
+ });
142
+ }
143
+ function ae(s, e) {
144
+ const t = De({}, s, void 0, Object);
145
+ return e.some((r) => Le(t, r));
146
+ }
147
+ const be = "_input";
148
+ class vt {
149
+ constructor() {
150
+ // 表示的 Form 的提交状态而非单个字段的提交状态。
151
+ // 只有在触发表单 reset(原生 reset,而非当前的 resetFields) 时,才会回到 init 状态(目前没有支持 form.reset,所以没有这块逻辑)
152
+ u(this, "submitStatus", U.init);
153
+ u(this, "registerFields", []);
154
+ // 所有 form item value 的变动,都会通知这里注册到的 watcher
155
+ u(this, "registerWatchers", []);
156
+ // 所有 form item 内部 errors, validating, touched 状态的变化,都会通知这里注册到的 watcher
157
+ // TODO: 合并 registerWatchers
158
+ u(this, "registerStateWatchers", []);
159
+ // 所有 form 整体 的变动,都会通知这里注册到的 watcher
160
+ u(this, "registerFormWatchers", []);
161
+ // 和formControl 的 touched属性不一样。 只要被改过的字段,这里就会存储。并且不会跟随formControl被卸载而清除。
162
+ // reset 的时候清除
163
+ u(this, "touchedFields", {});
164
+ u(this, "store", {});
165
+ u(this, "initialValues", {});
166
+ u(this, "callbacks", {});
167
+ // 告知 form 状态改变,进行状态收集
168
+ u(this, "innerCollectFormState", () => {
169
+ this.notifyStateWatchers();
170
+ });
171
+ u(this, "innerSetCallbacks", (e) => {
172
+ this.callbacks = e;
173
+ });
174
+ u(this, "registerFormWatcher", (e) => (this.registerFormWatchers.push(e), () => {
175
+ this.registerFormWatchers = this.registerFormWatchers.filter(
176
+ (t) => t !== e
177
+ );
178
+ }));
179
+ u(this, "registerStateWatcher", (e) => (this.registerStateWatchers.push(e), () => {
180
+ this.registerStateWatchers = this.registerStateWatchers.filter(
181
+ (t) => t !== e
182
+ );
183
+ }));
184
+ u(this, "registerWatcher", (e) => (this.registerWatchers.push(e), () => {
185
+ this.registerWatchers = this.registerWatchers.filter((t) => t !== e);
186
+ }));
187
+ // 收集所有control字段,并在组件卸载时移除
188
+ u(this, "registerField", (e) => (this.registerFields.push(e), this.notifyWatchers(), () => {
189
+ this.registerFields = this.registerFields.filter((t) => t !== e), this.notifyWatchers();
190
+ }));
191
+ // hasField为true时,只返回传入field属性的control实例
192
+ // isFormList 目前只在校验时需要包含
193
+ // TODO formlist 实现缺陷,待优化
194
+ u(this, "getRegisteredFields", (e, t) => e ? this.registerFields.filter(
195
+ (r) => {
196
+ var i;
197
+ return r.hasFieldProps() && ((t == null ? void 0 : t.containFormList) || !((i = r.props) != null && i.isFormList));
198
+ }
199
+ ) : this.registerFields);
200
+ // 获取props.field === field 的control组件。
201
+ u(this, "getRegisteredField", (e) => this.registerFields.filter((t) => t.props.field === e)[0]);
202
+ // 通知所有的FormItem进行更新。
203
+ // setFieldValue: 外部调用setFieldsValue (setFieldValue等)方法触发更新
204
+ // innerSetValue: 控件例如Input,通过onChange事件触发的更新
205
+ // reset:重置
206
+ u(this, "notify", (e, t) => {
207
+ (e === "setFieldValue" || e === "innerSetValue" && !t.ignore) && this._pushTouchField(
208
+ t.changeValues ? ke(t.changeValues) : this._getIterativelyKeysByField(t.field)
209
+ ), this.registerFields.forEach((r) => {
210
+ var i;
211
+ (i = r == null ? void 0 : r.onStoreChange) == null || i.call(r, e, {
212
+ ...t,
213
+ current: this.store
214
+ });
215
+ });
216
+ });
217
+ u(this, "innerSetInitialValues", (e) => {
218
+ e && (this.initialValues = Me(this.initialValues, K(e)), Object.keys(e).forEach((t) => {
219
+ N(this.store, t, e[t]);
220
+ }));
221
+ });
222
+ u(this, "innerSetInitialValue", (e, t) => {
223
+ e && (this.initialValues[e] = t, this._inTouchFields(e) || N(this.store, e, $(this.initialValues, e)));
224
+ });
225
+ /**
226
+ *
227
+ * 内部使用,更新value,会同时触发onChange 和 onValuesChange
228
+ * @options.isFormList 强制更新field对应的组件包括其子组件,form
229
+ */
230
+ u(this, "innerSetFieldValue", (e, t, r) => {
231
+ if (!e) return;
232
+ const i = this.getFields();
233
+ N(this.store, e, t), this.triggerValuesChange({
234
+ [e]: t
235
+ }), this.triggerTouchChange({ [e]: t }), this.notify("innerSetValue", {
236
+ prev: i,
237
+ field: e,
238
+ ...r,
239
+ changeValues: { [e]: t }
240
+ });
241
+ });
242
+ // 内部使用
243
+ u(this, "innerGetStore", () => this.store);
244
+ // 目前返回提交状态,后续统一维护 errors,warnings 后,这里可进行拓展
245
+ u(this, "innerGetStoreStatus", () => ({
246
+ submitStatus: this.submitStatus
247
+ }));
248
+ // 内部使用,返回原始对象,注入到组件的 value 都从这里获取值,cloneDeep 后的值每次引用地址是不同的
249
+ u(this, "innerGetFieldValue", (e) => $(this.store, e));
250
+ // 获取所有被操作过的字段
251
+ u(this, "getTouchedFields", () => this.getRegisteredFields(!0).filter((e) => e.isTouched()).map((e) => e.props.field));
252
+ // 外部调用设置表单字段值
253
+ u(this, "setFieldValue", (e, t) => {
254
+ e && this.setFields({
255
+ [e]: { value: t }
256
+ });
257
+ });
258
+ // 外部调用,设置多个表单控件的值
259
+ u(this, "setFieldsValue", (e) => {
260
+ if (M(e)) {
261
+ const t = Object.keys(e), r = {};
262
+ t.forEach((i) => {
263
+ r[i] = {
264
+ value: e[i]
265
+ };
266
+ }), this.setFields(r);
267
+ }
268
+ });
269
+ // 外部调用,设置多个表单控件的值,以及 error,touch 信息。
270
+ u(this, "setFields", (e) => {
271
+ const t = Object.keys(e), r = {};
272
+ t.forEach((i) => {
273
+ const l = e[i], n = this.getFields();
274
+ if (l) {
275
+ const o = {};
276
+ "error" in l && (o.errors = l.error), "warning" in l && (o.warnings = l.warning), "touched" in l && (o.touched = l.touched), "value" in l && (N(this.store, i, l.value), r[i] = l.value), this.notify("setFieldValue", {
277
+ data: o,
278
+ prev: n,
279
+ field: i,
280
+ changeValues: { [i]: l.value }
281
+ });
282
+ }
283
+ }), this.triggerValuesChange(r);
284
+ });
285
+ u(this, "getFieldValue", (e) => K($(this.store, e)));
286
+ // 获取单个字段的错误信息。
287
+ u(this, "getFieldError", (e) => {
288
+ const t = this.getRegisteredField(e);
289
+ return t ? t.getErrors() : null;
290
+ });
291
+ // 获取传入字段/全部的错误信息
292
+ u(this, "getFieldsError", (e) => {
293
+ const t = {};
294
+ return T(e) ? e.map((r) => {
295
+ const i = this.getFieldError(r);
296
+ i && (t[r] = i);
297
+ }) : this.getRegisteredFields(!0, { containFormList: !0 }).forEach(
298
+ (r) => {
299
+ r.getErrors() && (t[r.props.field] = r.getErrors());
300
+ }
301
+ ), t;
302
+ });
303
+ u(this, "getFields", () => K(this.store));
304
+ u(this, "getFieldsValue", (e) => {
305
+ const t = {};
306
+ return T(e) ? (e.forEach((r) => {
307
+ N(t, r, this.getFieldValue(r));
308
+ }), t) : (this.getRegisteredFields(!0).forEach(({ props: { field: r } }) => {
309
+ const i = $(this.store, r);
310
+ N(t, r, i);
311
+ }), t);
312
+ });
313
+ u(this, "getInitialValues", () => this.initialValues);
314
+ u(this, "setInitialValues", (e) => {
315
+ this.innerSetInitialValues(e), this.setFieldsValue(e);
316
+ });
317
+ u(this, "setInitialValue", (e, t) => {
318
+ this.innerSetInitialValue(e, t), this.setFieldValue(e, t);
319
+ });
320
+ u(this, "resetFields", (e) => {
321
+ const t = this.getFields(), r = $e(e) && !T(e) ? [e] : e;
322
+ let i = {};
323
+ if (r && T(r))
324
+ r.forEach((n) => {
325
+ N(
326
+ this.store,
327
+ n,
328
+ this.initialValues[n]
329
+ ), i[n] = $(this.store, n);
330
+ }), this.triggerValuesChange(i), this.notify("reset", { prev: t, field: r }), this._popTouchField(r);
331
+ else {
332
+ const n = {};
333
+ i = this.getFields(), Object.keys(this.initialValues).forEach((o) => {
334
+ N(n, o, this.initialValues[o]);
335
+ }), this.store = n, this.getRegisteredFields(!0).forEach((o) => {
336
+ const a = o.props.field;
337
+ N(i, a, $(this.store, a));
338
+ }), this.triggerValuesChange(i), this._popTouchField(), this.notify("reset", {
339
+ prev: t,
340
+ field: Object.keys(i)
341
+ });
342
+ }
343
+ const { onReset: l } = this.callbacks;
344
+ l == null || l(i);
345
+ });
346
+ u(this, "validate", Vt(
347
+ (e, t, r) => {
348
+ const i = this.getRegisteredFields(!0, {
349
+ containFormList: !0
350
+ }), l = T(e) && e.length ? i.filter(
351
+ (c) => e.indexOf(c.props.field) > -1
352
+ ) : i, n = M(e) ? e : M(t) ? t : {}, o = j(e) ? e : j(t) ? t : r || (() => {
353
+ }), a = l.map(
354
+ (c) => n != null && n.validateOnly ? c.validateFieldOnly() : c.validateField()
355
+ ), d = (c) => {
356
+ if (!(n != null && n.validateOnly)) {
357
+ const { onValidateFail: h } = this.callbacks;
358
+ h == null || h(c);
359
+ }
360
+ };
361
+ Promise.all(a).then((c) => {
362
+ let h = {};
363
+ const m = {};
364
+ c.map((V) => {
365
+ var p;
366
+ V.error && (h = { ...h, ...V.error });
367
+ const g = this.getRegisteredField(V.field);
368
+ (p = g == null ? void 0 : g.props) != null && p.isFormList || N(m, V.field, V.value);
369
+ });
370
+ let F;
371
+ return Object.keys(h).length ? (d == null || d(h), F = o == null ? void 0 : o(h, K(m))) : F = o == null ? void 0 : o(null, K(m)), F;
372
+ });
373
+ }
374
+ ));
375
+ u(this, "toggleSubmitStatus", (e) => {
376
+ this.submitStatus = e, this.innerCollectFormState(), this.notifyFormWatcher();
377
+ });
378
+ u(this, "submit", () => (this.toggleSubmitStatus(U.submitting), this.validate((e, t) => {
379
+ let r;
380
+ const { onSubmit: i, onSubmitFailed: l } = this.callbacks;
381
+ !e && i && (r = i(t)), e && l && (r = l(e)), r && r.then ? r.then((n) => (this.toggleSubmitStatus(U.success), n)).catch((n) => (this.toggleSubmitStatus(U.error), Promise.reject(n))) : this.toggleSubmitStatus(
382
+ e ? U.error : U.success
383
+ );
384
+ })));
385
+ u(this, "getFieldsState", (e) => {
386
+ const t = {}, r = (i) => {
387
+ if (!i)
388
+ return null;
389
+ const l = i.getErrors();
390
+ return {
391
+ errors: l ? [l] : [],
392
+ warnings: i.getWarnings(),
393
+ validateStatus: i.getValidateStatus(),
394
+ isSubmitting: this.submitStatus === U.submitting,
395
+ isTouched: i.isTouched(),
396
+ value: this.getFieldValue(i.props.field)
397
+ };
398
+ };
399
+ return T(e) ? (e.forEach((i) => {
400
+ t[i] = r(this.getRegisteredField(i));
401
+ }), t) : (this.getRegisteredFields(!0).forEach((i) => {
402
+ t[i.props.field] = r(i);
403
+ }), t);
404
+ });
405
+ u(this, "clearFields", (e) => {
406
+ const t = this.getFields(), r = $e(e) && !T(e) ? [e] : e;
407
+ if (r && T(r)) {
408
+ const i = {};
409
+ r.forEach((l) => {
410
+ N(this.store, l, void 0), i[l] = $(this.store, l);
411
+ }), this.triggerValuesChange(i), this.notify("setFieldValue", {
412
+ prev: t,
413
+ field: r,
414
+ data: {
415
+ errors: null,
416
+ warnings: null
417
+ }
418
+ });
419
+ } else {
420
+ const i = {};
421
+ this.store = {}, this.getRegisteredFields(!0).forEach((l) => {
422
+ const n = l.props.field;
423
+ N(i, n, void 0);
424
+ }), this.triggerValuesChange(i), this.notify("setFieldValue", {
425
+ prev: t,
426
+ field: Object.keys(i),
427
+ data: {
428
+ errors: null,
429
+ warnings: null
430
+ }
431
+ });
432
+ }
433
+ });
434
+ }
435
+ notifyWatchers() {
436
+ this.registerWatchers.forEach((e) => {
437
+ e();
438
+ });
439
+ }
440
+ // 注册监听全局状态的 watcher
441
+ notifyFormWatcher() {
442
+ this.registerFormWatchers.forEach((e) => {
443
+ e();
444
+ });
445
+ }
446
+ notifyStateWatchers() {
447
+ this.registerStateWatchers.forEach((e) => {
448
+ e();
449
+ });
450
+ }
451
+ triggerValuesChange(e) {
452
+ if (e && Object.keys(e).length) {
453
+ const { onValuesChange: t } = this.callbacks;
454
+ t == null || t(e, this.getFields());
455
+ }
456
+ this.notifyWatchers();
457
+ }
458
+ triggerTouchChange(e) {
459
+ if (e && Object.keys(e).length) {
460
+ const { onChange: t } = this.callbacks;
461
+ t == null || t(e, this.getFields());
462
+ }
463
+ }
464
+ _getIterativelyKeysByField(e) {
465
+ if (!e)
466
+ return [];
467
+ const r = [].concat(e).map((i) => ke(N({}, i, void 0))).reduce((i, l) => i.concat(l), []);
468
+ return [e, ...r];
469
+ }
470
+ _inTouchFields(e) {
471
+ return this._getIterativelyKeysByField(e).some((r) => Le(this.touchedFields, r));
472
+ }
473
+ _popTouchField(e) {
474
+ e === void 0 && (this.touchedFields = {});
475
+ const t = this._getIterativelyKeysByField(e);
476
+ this.touchedFields = nt(this.touchedFields, t);
477
+ }
478
+ _pushTouchField(e) {
479
+ [].concat(e).forEach((t) => {
480
+ De(this.touchedFields, t, void 0, Object);
481
+ });
482
+ }
483
+ }
484
+ function yt() {
485
+ const s = new vt();
486
+ return {
487
+ getFieldsValue: s.getFieldsValue,
488
+ getFieldValue: s.getFieldValue,
489
+ getFieldError: s.getFieldError,
490
+ getFieldsError: s.getFieldsError,
491
+ getTouchedFields: s.getTouchedFields,
492
+ getFields: s.getFields,
493
+ getInitialValues: s.getInitialValues,
494
+ setInitialValues: s.setInitialValues,
495
+ setInitialValue: s.setInitialValue,
496
+ setFieldValue: s.setFieldValue,
497
+ setFieldsValue: s.setFieldsValue,
498
+ setFields: s.setFields,
499
+ resetFields: s.resetFields,
500
+ clearFields: s.clearFields,
501
+ submit: s.submit,
502
+ validate: s.validate,
503
+ scrollToField: () => {
504
+ },
505
+ getFieldsState: s.getFieldsState,
506
+ getInnerMethods: (e) => {
507
+ const t = {};
508
+ return e && [
509
+ "registerField",
510
+ "registerWatcher",
511
+ "registerStateWatcher",
512
+ "registerFormWatcher",
513
+ "innerSetInitialValues",
514
+ "innerSetInitialValue",
515
+ "innerSetCallbacks",
516
+ "innerSetFieldValue",
517
+ "innerGetStore",
518
+ "innerGetStoreStatus",
519
+ "innerGetFieldValue",
520
+ "innerCollectFormState"
521
+ ].map((r) => {
522
+ t[r] = s[r];
523
+ }), t;
524
+ }
525
+ };
526
+ }
527
+ function Ae(s) {
528
+ const e = L(s);
529
+ return e.current || (s ? e.current = s : e.current = yt()), [e.current];
530
+ }
531
+ function Fe(s, e) {
532
+ const t = e.replace(/[[.]/g, "_").replace(/\]/g, "");
533
+ return s ? `${s}-${t}` : `${t}`;
534
+ }
535
+ const Ct = {
536
+ layout: "horizontal",
537
+ labelCol: { span: 5, offset: 0 },
538
+ labelAlign: "right",
539
+ wrapperCol: { span: 19, offset: 0 },
540
+ requiredSymbol: !0,
541
+ wrapper: "form",
542
+ validateTrigger: "onChange"
543
+ }, It = (s, e) => {
544
+ var X, B;
545
+ const t = O(xe), r = O(qe), i = L(null), [l] = Ae(
546
+ s.form
547
+ ), n = it(
548
+ s,
549
+ Ct,
550
+ (X = t.componentConfig) == null ? void 0 : X.Form
551
+ ), {
552
+ layout: o,
553
+ labelCol: a,
554
+ wrapperCol: d,
555
+ wrapper: c,
556
+ id: h,
557
+ requiredSymbol: m,
558
+ labelAlign: F,
559
+ disabled: V,
560
+ colon: g,
561
+ className: p,
562
+ validateTrigger: v,
563
+ prefixCls: y,
564
+ validateMessages: w,
565
+ ...k
566
+ } = n, R = y || t.getPrefixCls("form"), Q = t.rtl, ne = "size" in n ? n.size : t.size, le = l.getInnerMethods(!0);
567
+ st(() => {
568
+ le.innerSetInitialValues(n.initialValues);
569
+ }), ie(() => {
570
+ let S;
571
+ return r.register && (S = r.register(n.id, l)), S;
572
+ }, [n.id, l]), l.scrollToField = (S, W) => {
573
+ const C = i.current, P = n.id;
574
+ if (!C)
575
+ return;
576
+ let q = C.querySelector(
577
+ `#${Fe(P, S)}`
578
+ );
579
+ q || (q = C.querySelector(
580
+ `#${Fe(P, S)}${be}`
581
+ )), q && Ke(q, {
582
+ behavior: "smooth",
583
+ block: "nearest",
584
+ scrollMode: "if-needed",
585
+ ...W
586
+ });
587
+ }, le.innerSetCallbacks({
588
+ onValuesChange: (S, W) => {
589
+ var C, P;
590
+ (C = n.onValuesChange) == null || C.call(n, S, W), (P = r.onFormValuesChange) == null || P.call(r, n.id, S);
591
+ },
592
+ onChange: n.onChange,
593
+ onValidateFail: (S) => {
594
+ const W = n.scrollToFirstError;
595
+ if (W) {
596
+ const C = M(W) ? W : {};
597
+ l.scrollToField(
598
+ Object.keys(S)[0],
599
+ C
600
+ );
601
+ }
602
+ },
603
+ onSubmitFailed: n.onSubmitFailed,
604
+ onSubmit: (S) => {
605
+ var C, P;
606
+ const W = (C = n.onSubmit) == null ? void 0 : C.call(n, S);
607
+ return (P = r.onFormSubmit) == null || P.call(r, n.id, S), W;
608
+ },
609
+ onReset: (S) => {
610
+ var C, P;
611
+ const W = (C = n.onReset) == null ? void 0 : C.call(n, S);
612
+ return (P = r == null ? void 0 : r.onFormReset) == null || P.call(r, n.id, S), W;
613
+ }
614
+ });
615
+ const he = {
616
+ requiredSymbol: m,
617
+ labelAlign: F,
618
+ disabled: V,
619
+ colon: g,
620
+ labelCol: a,
621
+ wrapperCol: d,
622
+ layout: o,
623
+ store: l,
624
+ prefixCls: R,
625
+ validateTrigger: v,
626
+ validateMessages: Me(
627
+ {},
628
+ (B = t.locale.Form) == null ? void 0 : B.validateMessages,
629
+ w
630
+ ),
631
+ getFormElementId: (S) => Fe(h, S)
632
+ }, oe = se;
633
+ return et(e, () => ({
634
+ ...l,
635
+ getRootDOMNode() {
636
+ return i.current;
637
+ }
638
+ })), /* @__PURE__ */ f(rt, { ...t, size: ne, children: /* @__PURE__ */ f(oe.Provider, { value: he, children: /* @__PURE__ */ f(
639
+ c,
640
+ {
641
+ ref: i,
642
+ ..._e(k, [
643
+ "form",
644
+ "size",
645
+ "initialValues",
646
+ "onValuesChange",
647
+ "onChange",
648
+ "wrapperProps",
649
+ "scrollToFirstError",
650
+ "onSubmit",
651
+ "onSubmitFailed",
652
+ "onReset"
653
+ ]),
654
+ ...n.wrapperProps,
655
+ className: G(
656
+ R,
657
+ `${R}-${o}`,
658
+ `${R}-size-${ne}`,
659
+ { [`${R}-rtl`]: Q },
660
+ p
661
+ ),
662
+ style: n.style,
663
+ onSubmit: (S) => {
664
+ S.preventDefault(), S.stopPropagation(), l.submit();
665
+ },
666
+ onReset: (S) => {
667
+ S.preventDefault(), S.stopPropagation(), l.resetFields();
668
+ },
669
+ id: h,
670
+ children: n.children
671
+ }
672
+ ) }) });
673
+ }, Be = Ve(It);
674
+ Be.displayName = "Form";
675
+ class z extends tt {
676
+ constructor(t, r) {
677
+ var i, l;
678
+ super(t);
679
+ u(this, "context");
680
+ // 校验信息
681
+ u(this, "errors", null);
682
+ // 校验 warning 信息
683
+ u(this, "warnings", null);
684
+ // undefined => validating => success / error => (validating or undefined)
685
+ u(this, "validateStatus");
686
+ // 是否被用户操作过
687
+ u(this, "touched");
688
+ u(this, "isDestroyed", !1);
689
+ // 保存 props.children 或函数类型 props.children() 的返回值
690
+ u(this, "childrenElement", null);
691
+ u(this, "removeRegisterField");
692
+ // 触发 store 进行状态收集
693
+ // TODO: error, validateStatus ,touched 状态和 UI 组件解耦,统一维护在 store 内部
694
+ u(this, "triggerStateCollect", () => {
695
+ const { innerCollectFormState: t } = this.context.store.getInnerMethods(!0);
696
+ t();
697
+ });
698
+ // 切换校验状态
699
+ u(this, "toggleValidateStatus", (t) => {
700
+ this.validateStatus = t, this.triggerStateCollect();
701
+ });
702
+ // 切换 touch 状态
703
+ u(this, "toggleTouched", (t) => {
704
+ this.touched = dt(t) ? t : !this.touched, this.triggerStateCollect();
705
+ });
706
+ u(this, "setWarnings", (t) => {
707
+ this.warnings = t, this.triggerStateCollect();
708
+ });
709
+ u(this, "setErrors", (t) => {
710
+ this.errors = t, this.triggerStateCollect();
711
+ });
712
+ u(this, "getErrors", () => this.errors);
713
+ u(this, "getWarnings", () => this.warnings || []);
714
+ u(this, "isTouched", () => this.touched);
715
+ u(this, "getValidateStatus", () => this.props.validateStatus ? this.props.validateStatus : this.validateStatus);
716
+ u(this, "hasFieldProps", () => !!this.props.field);
717
+ u(this, "clearFormItemError", (t = this.props.field) => {
718
+ const { updateFormItem: r } = this.context;
719
+ r == null || r(t, { errors: null, warnings: null });
720
+ });
721
+ u(this, "updateFormItem", () => {
722
+ if (this.isDestroyed) return;
723
+ this.forceUpdate();
724
+ const { updateFormItem: t } = this.context;
725
+ t == null || t(this.props.field, {
726
+ errors: this.errors,
727
+ warnings: this.warnings
728
+ });
729
+ });
730
+ u(this, "getFieldValue", () => {
731
+ const t = this.props.field, r = this.context.store;
732
+ return t ? r.getInnerMethods(!0).innerGetFieldValue(t) : void 0;
733
+ });
734
+ u(this, "onStoreChange", (t, r) => {
735
+ const i = T(r.field) ? r.field : [r.field], { field: l, shouldUpdate: n, dependencies: o } = this.props, a = (d) => {
736
+ if (o && n && re(!0, "`shouldUpdate` of the `Form.Item` will be ignored."), o)
737
+ (T(o) || o.some(
738
+ (c) => ae(c, i)
739
+ )) && this.isTouched() && this.validateField();
740
+ else if (n) {
741
+ let c = !1;
742
+ j(n) ? c = n(r.prev, r.current, {
743
+ field: r.field,
744
+ ...d
745
+ }) : c = !pe(r.prev, r.current), c && this.updateFormItem();
746
+ }
747
+ };
748
+ switch (t) {
749
+ case "reset":
750
+ this.toggleTouched(!1), this.toggleValidateStatus(void 0), this.setErrors(null), this.setWarnings(null), o || n ? a() : this.updateFormItem();
751
+ break;
752
+ case "innerSetValue":
753
+ if (ae(l, i)) {
754
+ this.toggleTouched(!0), this.updateFormItem();
755
+ return;
756
+ }
757
+ a({
758
+ isInner: !0,
759
+ isFormList: r.isFormList
760
+ });
761
+ break;
762
+ case "setFieldValue":
763
+ if (ae(l, i)) {
764
+ this.toggleTouched(!0), r.data && "touched" in r.data && this.toggleTouched(r.data.touched), r.data && "warnings" in r.data && this.setWarnings(
765
+ ht(r.data.warnings) ? [] : [].concat(r.data.warnings)
766
+ ), r.data && "errors" in r.data ? this.setErrors(r.data.errors) : pe($(r.prev, l), $(r.current, l)) || this.setErrors(null), this.updateFormItem();
767
+ return;
768
+ }
769
+ a();
770
+ break;
771
+ }
772
+ });
773
+ u(this, "innerSetFieldValue", (t, r) => {
774
+ var o, a;
775
+ if (!t) return;
776
+ const { store: i } = this.context;
777
+ i.getInnerMethods(!0).innerSetFieldValue(t, r);
778
+ const n = {};
779
+ Oe(n, t, r), (a = (o = this.props) == null ? void 0 : o.onValuesChange) == null || a.call(o, n, {
780
+ ...i.getFieldsValue()
781
+ });
782
+ });
783
+ // 仅仅校验下值,不做任何状态变更
784
+ u(this, "validateFieldOnly", () => {
785
+ const { validateMessages: t } = this.context, { field: r, rules: i } = this.props, l = this.getFieldValue();
786
+ return Re(r, l, i, t).then(
787
+ ({ error: n, warning: o }) => Promise.resolve({ error: n, value: l, warning: o, field: r })
788
+ );
789
+ });
790
+ /**
791
+ *
792
+ * @param triggerType the value of validateTrigger.
793
+ * @returns
794
+ */
795
+ u(this, "validateField", (t) => {
796
+ const { validateTrigger: r, validateMessages: i } = this.context, { field: l, rules: n, validateTrigger: o } = this.props, a = this.getFieldValue(), d = () => {
797
+ var m;
798
+ const h = this.errors || ((m = this.warnings) == null ? void 0 : m.length);
799
+ this.toggleValidateStatus("validating"), this.setErrors(null), this.setWarnings(null), h && this.updateFormItem();
800
+ }, c = t ? (n || []).filter((h) => [].concat(
801
+ h.validateTrigger || o || r
802
+ ).indexOf(t) > -1) : n;
803
+ return c && c.length && l ? (d(), Re(l, a, c, i).then(
804
+ ({ error: h, warning: m }) => {
805
+ var F;
806
+ return this.setErrors(h ? h[l] : null), this.setWarnings(m || null), this.toggleValidateStatus(
807
+ this.errors ? "error" : (F = this.warnings) != null && F.length ? "warning" : "success"
808
+ ), this.updateFormItem(), Promise.resolve({ error: h, value: a, field: l });
809
+ }
810
+ )) : Promise.resolve({ error: null, value: a, field: l });
811
+ });
812
+ // 每次 render 都会作为 onChange 传递给 children,需要保证引用地址不变
813
+ // 所以 handleTrigger 需要声明在类上,并且直接作为 children.props.onChange
814
+ u(this, "handleTrigger", (t, ...r) => {
815
+ const i = this.childrenElement || this.props.children, { store: l } = this.context, { field: n, trigger: o, normalize: a, getValueFromEvent: d } = this.props, c = j(d) ? d(t, ...r) : t;
816
+ let h = c;
817
+ if (ze(c)) {
818
+ re(
819
+ !0,
820
+ "changed value missed, please check whether extra elements is outta input/select controled by Form.Item"
821
+ ), c.stopPropagation();
822
+ return;
823
+ }
824
+ typeof a == "function" && (h = a(c, l.getFieldValue(n), {
825
+ ...l.getFieldsValue()
826
+ })), this.toggleTouched(!0), this.innerSetFieldValue(n, h), this.validateField(o), fe(i) && i.props && i.props[o] && (this.props.isFormList || i.props[o](h, ...r));
827
+ });
828
+ u(this, "getChild", () => {
829
+ const { children: t } = this.props, { store: r } = this.context;
830
+ let i = t;
831
+ return j(t) && (i = t(
832
+ r.getFields(),
833
+ {
834
+ ...r
835
+ },
836
+ this.props.isFormList && {
837
+ value: this.getFieldValue(),
838
+ onChange: this.handleTrigger
839
+ }
840
+ )), this.childrenElement = i, i;
841
+ });
842
+ "initialValue" in t && this.hasFieldProps() && ((l = (i = r == null ? void 0 : r.store) == null ? void 0 : i.setInitialValue) == null || l.call(i, t.field, t.initialValue));
843
+ }
844
+ componentDidMount() {
845
+ const { store: t } = this.context ?? {};
846
+ if (t) {
847
+ const r = t.getInnerMethods(!0);
848
+ this.removeRegisterField = r.registerField(this);
849
+ }
850
+ this.isDestroyed = !1;
851
+ }
852
+ componentDidUpdate(t) {
853
+ (t.field !== this.props.field && this.props._key && t._key === this.props._key || /* 以下条件判断潘启宝添加于 2023年10月23日 星期一 13时10分43秒 CST */
854
+ this.props.disabled !== t.disabled && this.props.disabled || this.props.rules !== t.rules && !this.props.rules) && (this.updateFormItem(), this.clearFormItemError(t.field));
855
+ }
856
+ componentWillUnmount() {
857
+ var t;
858
+ (t = this.removeRegisterField) == null || t.call(this), this.removeRegisterField = null, this.clearFormItemError(), this.isDestroyed = !0;
859
+ }
860
+ /**
861
+ * 收集rules里的validateTrigger字段
862
+ */
863
+ getValidateTrigger() {
864
+ const t = this.props.validateTrigger || this.context.validateTrigger || "onChange", r = this.props.rules || [];
865
+ let i = [];
866
+ return r.map((l) => {
867
+ i = i.concat(l.validateTrigger || t);
868
+ }), Array.from(new Set(i));
869
+ }
870
+ renderControl(t, r) {
871
+ var g;
872
+ const {
873
+ field: i,
874
+ trigger: l = "onChange",
875
+ triggerPropName: n = "value",
876
+ validateStatus: o,
877
+ formatter: a
878
+ } = this.props, { store: d, disabled: c } = this.context, h = "disabled" in this.props ? this.props.disabled : c, m = H.Children.only(t), F = {
879
+ // used by label
880
+ id: G(((g = m.props) == null ? void 0 : g.id) || { [`${r}${be}`]: r })
881
+ };
882
+ this.getValidateTrigger().forEach((p) => {
883
+ F[p] = (v) => {
884
+ var y, w;
885
+ this.validateField(p), (w = (y = m.props) == null ? void 0 : y[p]) == null || w.call(y, v);
886
+ };
887
+ }), F[l] = this.handleTrigger, h !== void 0 && !("disabled" in m.props) && (F.disabled = h);
888
+ let V = $(d.getInnerMethods(!0).innerGetStore(), i);
889
+ return j(a) && (V = a(V)), F[n] = V, !o && this.errors && (F.error = !0), H.cloneElement(m, F);
890
+ }
891
+ render() {
892
+ const { noStyle: t, field: r, isFormList: i, hasFeedback: l } = this.props, n = this.getValidateStatus(), { prefixCls: o, getFormElementId: a } = this.context;
893
+ let d = this.getChild();
894
+ const c = this.hasFieldProps() ? a == null ? void 0 : a(r) : void 0;
895
+ return this.hasFieldProps() && !i && H.Children.count(d) === 1 && (d = this.renderControl(d, c)), t ? d : /* @__PURE__ */ f("div", { className: `${o}-item-control-wrapper`, children: /* @__PURE__ */ f("div", { className: `${o}-item-control`, id: c, children: /* @__PURE__ */ J("div", { className: `${o}-item-control-children`, children: [
896
+ d,
897
+ n && l && /* @__PURE__ */ J(
898
+ "div",
899
+ {
900
+ className: `${o}-item-feedback ${o}-item-feedback-${n}`,
901
+ children: [
902
+ n === "warning" && /* @__PURE__ */ f(ot, {}),
903
+ n === "success" && /* @__PURE__ */ f(at, {}),
904
+ n === "error" && /* @__PURE__ */ f(ct, {}),
905
+ n === "validating" && /* @__PURE__ */ f(ut, {})
906
+ ]
907
+ }
908
+ )
909
+ ] }) }) });
910
+ }
911
+ }
912
+ u(z, "defaultProps", {
913
+ trigger: "onChange",
914
+ triggerPropName: "value"
915
+ }), u(z, "isFormControl", !0), u(z, "contextType", Se);
916
+ function wt(s) {
917
+ return /* @__PURE__ */ f(
918
+ "svg",
919
+ {
920
+ width: "1em",
921
+ height: "1em",
922
+ "aria-hidden": !0,
923
+ focusable: !1,
924
+ fill: "currentColor",
925
+ stroke: "none",
926
+ viewBox: "0 0 48 48",
927
+ ...s,
928
+ children: /* @__PURE__ */ f("path", { d: "M30.841,46.115l5.864,-2.824l-6.841,-14.205l15.371,3.508l1.449,-6.345l-15.372,-3.509l12.327,-9.83l-4.058,-5.088l-12.327,9.83l0,-15.767l-6.508,0l-0,15.767l-12.327,-9.83l-4.058,5.088l12.327,9.83l-15.372,3.509l1.449,6.345l15.371,-3.508l-6.841,14.205l5.864,2.824l6.841,-14.206l6.841,14.206Z" })
929
+ }
930
+ );
931
+ }
932
+ const Et = ({
933
+ htmlFor: s,
934
+ showColon: e,
935
+ label: t,
936
+ requiredSymbol: r,
937
+ required: i,
938
+ rules: l,
939
+ prefix: n,
940
+ tooltip: o
941
+ }) => {
942
+ const a = T(l) && l.some((m) => m && m.required), d = M(r) ? r.position : "end", c = (i || a) && !!r && /* @__PURE__ */ f("strong", { className: `${n}-form-item-symbol`, children: /* @__PURE__ */ f(wt, {}) }), h = () => {
943
+ if (!o)
944
+ return null;
945
+ const m = `${n}-form-item-tooltip`;
946
+ let F = {}, V = /* @__PURE__ */ f(mt, { className: m });
947
+ if (!M(o) || fe(o))
948
+ F = {
949
+ content: o
950
+ };
951
+ else {
952
+ const { icon: g, ...p } = o;
953
+ F = p, g && (V = fe(g) ? H.cloneElement(g, {
954
+ className: G(
955
+ m,
956
+ g.props.className
957
+ )
958
+ }) : g);
959
+ }
960
+ return /* @__PURE__ */ f(Ft, { ...F, children: V });
961
+ };
962
+ return t ? /* @__PURE__ */ J("label", { htmlFor: s && `${s}${be}`, children: [
963
+ d !== "end" && c,
964
+ " ",
965
+ t,
966
+ h(),
967
+ d === "end" && /* @__PURE__ */ J(Ne, { children: [
968
+ " ",
969
+ c
970
+ ] }),
971
+ e ? e === !0 ? ":" : e : ""
972
+ ] }) : null;
973
+ }, Tt = je.Row, We = je.Col, $t = ({
974
+ prefixCls: s,
975
+ help: e,
976
+ errors: t,
977
+ warnings: r
978
+ }) => {
979
+ const i = t.map((a, d) => {
980
+ if (a)
981
+ return /* @__PURE__ */ f("div", { role: "alert", children: a.message }, d);
982
+ }), l = [];
983
+ r.map((a, d) => {
984
+ l.push(
985
+ /* @__PURE__ */ f("div", { role: "alert", className: `${s}-message-help-warning`, children: a }, d)
986
+ );
987
+ });
988
+ const n = !te(e) || !!l.length, o = n || !!i.length;
989
+ return o && /* @__PURE__ */ f(
990
+ gt,
991
+ {
992
+ in: o,
993
+ appear: !0,
994
+ classNames: "formblink",
995
+ timeout: 300,
996
+ unmountOnExit: !0,
997
+ children: /* @__PURE__ */ f(
998
+ "div",
999
+ {
1000
+ className: G(`${s}-message`, {
1001
+ [`${s}-message-help`]: n
1002
+ }),
1003
+ children: te(e) ? /* @__PURE__ */ J(Ne, { children: [
1004
+ i.length > 0 && i,
1005
+ l.length > 0 && l
1006
+ ] }) : e
1007
+ }
1008
+ )
1009
+ }
1010
+ );
1011
+ }, kt = (s, e) => {
1012
+ var ve, ye, Ce;
1013
+ const { getPrefixCls: t, prefixCls: r } = O(xe), i = O(Se), l = O(Ge), [n, o] = ce(null), [a, d] = ce(null), c = O(se), h = c.prefixCls || t("form"), m = s.layout || c.layout, F = s.labelAlign || c.labelAlign, V = L(!1), g = (x, I = {}) => {
1014
+ if (V.current)
1015
+ return;
1016
+ const { errors: D, warnings: Z } = I || {};
1017
+ o((Y) => {
1018
+ const E = { ...Y || {} };
1019
+ return D ? E[x] = D : delete E[x], E;
1020
+ }), d((Y) => {
1021
+ const E = { ...Y || {} };
1022
+ return Z && Z.length ? E[x] = Z : delete E[x], E;
1023
+ });
1024
+ }, p = M(s.noStyle) && s.noStyle.showErrorTip && i.updateFormItem ? i.updateFormItem : g;
1025
+ ie(() => (V.current = !1, () => {
1026
+ V.current = !0, o(null), d(null);
1027
+ }), []);
1028
+ const v = {
1029
+ ...c,
1030
+ validateMessages: c.validateMessages && bt(c.validateMessages, {
1031
+ label: s.label
1032
+ }),
1033
+ prefixCls: h,
1034
+ updateFormItem: p,
1035
+ disabled: "disabled" in s ? s.disabled : c.disabled
1036
+ }, { label: y, extra: w, className: k, style: R, validateStatus: Q, hidden: ne, ...le } = s, he = G(`${h}-label-item`, {
1037
+ [`${h}-label-item-left`]: F === "left"
1038
+ }), oe = n ? Object.values(n) : [], X = a ? Object.values(a).reduce((x, I) => x.concat(I), []) : [], B = we(() => {
1039
+ if (Q)
1040
+ return Q;
1041
+ if (oe.length)
1042
+ return me.error;
1043
+ if (X.length)
1044
+ return me.warning;
1045
+ }, [n, a, Q]), S = we(() => !te(s.help) || X.length > 0, [s.help, a]), W = G(
1046
+ `${h}-item`,
1047
+ {
1048
+ [`${h}-item-error`]: S || !Q && B === me.error,
1049
+ [`${h}-item-status-${B}`]: B,
1050
+ [`${h}-item-has-help`]: S,
1051
+ [`${h}-item-hidden`]: ne,
1052
+ [`${h}-item-has-feedback`]: B && s.hasFeedback
1053
+ },
1054
+ `${h}-layout-${m}`,
1055
+ k
1056
+ ), C = () => {
1057
+ var Z, Y;
1058
+ const { field: x, children: I } = s, D = "disabled" in s ? s.disabled : c.disabled;
1059
+ if (j(I)) {
1060
+ const { key: E, ..._ } = s ?? {};
1061
+ return /* @__PURE__ */ Ee(
1062
+ z,
1063
+ {
1064
+ disabled: D,
1065
+ ..._,
1066
+ key: x || E,
1067
+ _key: x || E
1068
+ },
1069
+ (...ge) => I(
1070
+ ...ge
1071
+ )
1072
+ );
1073
+ }
1074
+ if (T(I)) {
1075
+ const E = H.Children.map(I, (_, ge) => {
1076
+ const Ie = M(_) && _.key || ge, Qe = M(_) && "disabled" in _.props, Xe = !te(D) && !Qe ? { key: Ie, disabled: D } : { key: Ie };
1077
+ return M(_) ? Te(_, Xe) : _;
1078
+ });
1079
+ return /* @__PURE__ */ f(z, { ...s, field: void 0, children: E });
1080
+ }
1081
+ if (H.Children.count(I) == 1) {
1082
+ if (x) {
1083
+ const E = ((Z = l == null ? void 0 : l.getItemKey) == null ? void 0 : Z.call(l, x)) || x;
1084
+ return /* @__PURE__ */ Ee(z, { disabled: D, ...s, key: E, _key: E }, I);
1085
+ }
1086
+ if (M(I)) {
1087
+ if ((Y = I.type) != null && Y.isFormControl)
1088
+ return I;
1089
+ const _ = !("disabled" in I.props) && !te(D) ? { disabled: D } : null;
1090
+ return /* @__PURE__ */ f(z, { ...s, field: void 0, children: _ ? Te(I, _) : I });
1091
+ }
1092
+ }
1093
+ return I;
1094
+ }, P = Se, q = {
1095
+ ...c
1096
+ };
1097
+ return s.noStyle || (q.wrapperCol = void 0, q.labelCol = void 0), /* @__PURE__ */ f(se.Provider, { value: q, children: /* @__PURE__ */ f(P.Provider, { value: v, children: s.noStyle ? C() : /* @__PURE__ */ J(
1098
+ Tt,
1099
+ {
1100
+ ref: e,
1101
+ ..._e(le, [
1102
+ "tooltip",
1103
+ "children",
1104
+ "prefixCls",
1105
+ "store",
1106
+ "initialValue",
1107
+ "field",
1108
+ "labelCol",
1109
+ "wrapperCol",
1110
+ "colon",
1111
+ "disabled",
1112
+ "rules",
1113
+ "trigger",
1114
+ "triggerPropName",
1115
+ "validateTrigger",
1116
+ "noStyle",
1117
+ "required",
1118
+ "hasFeedback",
1119
+ "help",
1120
+ "normalize",
1121
+ "formatter",
1122
+ "getValueFromEvent",
1123
+ "shouldUpdate",
1124
+ "field",
1125
+ "isInner",
1126
+ "labelAlign",
1127
+ "layout",
1128
+ "requiredSymbol",
1129
+ "isFormList"
1130
+ ]),
1131
+ className: W,
1132
+ div: m !== "horizontal",
1133
+ style: R,
1134
+ children: [
1135
+ y ? /* @__PURE__ */ f(
1136
+ We,
1137
+ {
1138
+ ...s.labelCol || c.labelCol,
1139
+ className: G(
1140
+ he,
1141
+ (ve = s.labelCol) == null ? void 0 : ve.className,
1142
+ (ye = c.labelCol) == null ? void 0 : ye.className,
1143
+ {
1144
+ [`${h}-label-item-flex`]: !s.labelCol && !c.labelCol
1145
+ }
1146
+ ),
1147
+ children: /* @__PURE__ */ f(
1148
+ Et,
1149
+ {
1150
+ tooltip: s.tooltip,
1151
+ htmlFor: s.field && ((Ce = c == null ? void 0 : c.getFormElementId) == null ? void 0 : Ce.call(c, s.field)),
1152
+ label: y,
1153
+ prefix: r,
1154
+ requiredSymbol: "requiredSymbol" in s ? s.requiredSymbol : c.requiredSymbol,
1155
+ required: s.required,
1156
+ rules: s.rules,
1157
+ showColon: "colon" in s ? s.colon : c.colon
1158
+ }
1159
+ )
1160
+ }
1161
+ ) : null,
1162
+ /* @__PURE__ */ J(
1163
+ We,
1164
+ {
1165
+ className: G(`${h}-item-wrapper`, {
1166
+ [`${h}-item-wrapper-flex`]: !s.wrapperCol && !c.wrapperCol
1167
+ }),
1168
+ ...s.wrapperCol || c.wrapperCol,
1169
+ children: [
1170
+ C(),
1171
+ /* @__PURE__ */ f(
1172
+ $t,
1173
+ {
1174
+ prefixCls: h,
1175
+ help: s.help,
1176
+ errors: oe,
1177
+ warnings: X
1178
+ }
1179
+ ),
1180
+ w && /* @__PURE__ */ f("div", { className: `${h}-extra`, children: w })
1181
+ ]
1182
+ }
1183
+ )
1184
+ ]
1185
+ }
1186
+ ) }) });
1187
+ }, de = Ve(kt);
1188
+ de.defaultProps = {
1189
+ trigger: "onChange",
1190
+ triggerPropName: "value"
1191
+ };
1192
+ de.displayName = "FormItem";
1193
+ const Pe = (s, e) => !te(s) && s >= 0 && s < e.length, He = (s) => {
1194
+ const { field: e, children: t, initialValue: r } = s, i = L({
1195
+ id: 0,
1196
+ keys: []
1197
+ }), l = "initialValue" in s ? { initialValue: r } : {}, n = i.current.keys;
1198
+ return /* @__PURE__ */ f(
1199
+ Ge.Provider,
1200
+ {
1201
+ value: {
1202
+ getItemKey: (o) => {
1203
+ const a = o == null ? void 0 : o.replace(/\[|\]/g, ".").split("."), d = a.indexOf(e), c = a[d + 1];
1204
+ return `${e}_${n.indexOf(c)}_${a.slice(d + 2).join("_")}`;
1205
+ }
1206
+ },
1207
+ children: /* @__PURE__ */ f(
1208
+ de,
1209
+ {
1210
+ field: e,
1211
+ ...l,
1212
+ isFormList: !0,
1213
+ rules: s.rules,
1214
+ wrapperCol: { span: 24 },
1215
+ noStyle: "noStyle" in s ? s.noStyle : !s.rules,
1216
+ shouldUpdate: (o, a, d) => {
1217
+ var c, h;
1218
+ return !!(d && !d.isInner && ae(d.field, [e]) && ((c = $(o, e)) == null ? void 0 : c.length) !== ((h = $(a, e)) == null ? void 0 : h.length));
1219
+ },
1220
+ children: (o, a, { value: d, onChange: c }) => {
1221
+ const h = d || [], m = function(g, p) {
1222
+ var R;
1223
+ if (ze(g)) {
1224
+ re(
1225
+ !0,
1226
+ "Form.List: The event object cannot be used as a parameter of the add method"
1227
+ );
1228
+ return;
1229
+ }
1230
+ const v = ((R = a.getInnerMethods(!0)) == null ? void 0 : R.innerGetFieldValue(e)) || [], y = i.current.id;
1231
+ i.current.id += 1;
1232
+ const w = v || [];
1233
+ let k = w;
1234
+ p !== void 0 && p >= 0 && p <= w.length ? (n.splice(p, 0, y), k = [
1235
+ ...w.slice(0, p),
1236
+ g,
1237
+ ...w.slice(p)
1238
+ ]) : (n.push(y), k = [...w, g]), c(k, {
1239
+ isFormList: !0,
1240
+ ignore: g === void 0
1241
+ });
1242
+ }, F = function(g) {
1243
+ var y;
1244
+ const v = (((y = a.getInnerMethods(!0)) == null ? void 0 : y.innerGetFieldValue(e)) || []).filter((w, k) => k !== g);
1245
+ n.splice(g, 1), c([...v], { isFormList: !0 });
1246
+ }, V = function(g, p) {
1247
+ var R;
1248
+ const v = ((R = a.getInnerMethods(!0)) == null ? void 0 : R.innerGetFieldValue(e)) || [];
1249
+ if (g === p || !Pe(g, v) || !Pe(p, v))
1250
+ return;
1251
+ const y = n[g];
1252
+ n.splice(g, 1), n.splice(p, 0, y);
1253
+ const w = v[g], k = [...v];
1254
+ k.splice(g, 1), k.splice(p, 0, w), c(k, { isFormList: !0 });
1255
+ };
1256
+ return j(t) && t(
1257
+ h.map((g, p) => {
1258
+ let v = n[p];
1259
+ return v === void 0 && (v = i.current.id, n.push(v), i.current.id += 1), {
1260
+ ...g,
1261
+ // 潘启宝添加 2024年 9月 5日 星期四 17时09分53秒 CST
1262
+ field: `${e}[${p}]`,
1263
+ key: v
1264
+ };
1265
+ }),
1266
+ {
1267
+ add: m,
1268
+ remove: F,
1269
+ move: V
1270
+ }
1271
+ );
1272
+ }
1273
+ }
1274
+ )
1275
+ }
1276
+ );
1277
+ };
1278
+ He.displayName = "FormList";
1279
+ const Rt = (s, e) => {
1280
+ const t = L({}), r = ee((o, a) => (o && (t.current[o] = a), () => {
1281
+ delete t.current[o];
1282
+ }), []), i = ee(
1283
+ (o, a) => {
1284
+ var d;
1285
+ (d = s.onFormSubmit) == null || d.call(s, o, a, {
1286
+ forms: t.current
1287
+ });
1288
+ },
1289
+ [s.onFormSubmit]
1290
+ ), l = ee(
1291
+ (o, a) => {
1292
+ var d;
1293
+ (d = s.onFormReset) == null || d.call(s, o, a, {
1294
+ forms: t.current
1295
+ });
1296
+ },
1297
+ [s.onFormReset]
1298
+ ), n = ee(
1299
+ (o, a) => {
1300
+ var d;
1301
+ (d = s.onFormValuesChange) == null || d.call(s, o, a, {
1302
+ forms: t.current
1303
+ });
1304
+ },
1305
+ [s.onFormValuesChange]
1306
+ );
1307
+ return /* @__PURE__ */ f(
1308
+ qe.Provider,
1309
+ {
1310
+ value: {
1311
+ onFormValuesChange: n,
1312
+ onFormSubmit: i,
1313
+ onFormReset: l,
1314
+ register: r
1315
+ },
1316
+ children: s.children
1317
+ }
1318
+ );
1319
+ }, Je = Ve(Rt);
1320
+ Je.displayName = "FormProvider";
1321
+ const Wt = () => {
1322
+ const s = O(se), e = s.store, t = L(!1), r = ft(), i = ee(() => {
1323
+ var o, a, d;
1324
+ const { submitStatus: l } = ((d = (a = (o = e == null ? void 0 : e.getInnerMethods) == null ? void 0 : o.call(e, !0)) == null ? void 0 : a.innerGetStoreStatus) == null ? void 0 : d.call(a)) ?? {}, n = l === U.submitting;
1325
+ n !== t.current && (t.current = n, r());
1326
+ }, []);
1327
+ return ie(() => {
1328
+ var a;
1329
+ if (!e) {
1330
+ re(!0, "formInstance is not available");
1331
+ return;
1332
+ }
1333
+ const { registerFormWatcher: l } = ((a = e == null ? void 0 : e.getInnerMethods) == null ? void 0 : a.call(e, !0)) ?? {}, n = () => i();
1334
+ n();
1335
+ const o = (l == null ? void 0 : l(n)) ?? {};
1336
+ return () => {
1337
+ o == null || o();
1338
+ };
1339
+ }, []), {
1340
+ form: e,
1341
+ disabled: s.disabled,
1342
+ isSubmitting: t.current
1343
+ };
1344
+ }, Pt = (s, e) => {
1345
+ const t = O(se), r = e || t.store, i = L(s);
1346
+ i.current = s;
1347
+ const l = ee(() => {
1348
+ const d = i.current, c = r.getFieldsState([d]);
1349
+ return c == null ? void 0 : c[d];
1350
+ }, []), [n, o] = ce(l), a = L(n);
1351
+ return ie(() => {
1352
+ var m;
1353
+ if (!r) {
1354
+ re(!0, "formInstance is not available");
1355
+ return;
1356
+ }
1357
+ const { registerStateWatcher: d } = ((m = r == null ? void 0 : r.getInnerMethods) == null ? void 0 : m.call(r, !0)) ?? {}, c = () => {
1358
+ const F = l();
1359
+ pe(a.current, F) || (o(F), a.current = F);
1360
+ };
1361
+ c();
1362
+ const h = d == null ? void 0 : d(c);
1363
+ return () => {
1364
+ h == null || h();
1365
+ };
1366
+ }, []), n;
1367
+ }, Nt = (s, e) => {
1368
+ const t = O(se), r = e || t.store, [i, l] = ce(() => {
1369
+ const a = r == null ? void 0 : r.getFieldsValue([].concat(s));
1370
+ return pt(s) ? $(a, s) : a;
1371
+ }), n = L(s);
1372
+ n.current = s;
1373
+ const o = L(JSON.stringify(i));
1374
+ return ie(() => {
1375
+ var h;
1376
+ if (!r) {
1377
+ re(!0, "formInstance is not available");
1378
+ return;
1379
+ }
1380
+ const { registerWatcher: a } = ((h = r == null ? void 0 : r.getInnerMethods) == null ? void 0 : h.call(r, !0)) ?? {}, d = () => {
1381
+ const m = n.current, F = r.getFieldsValue([].concat(m));
1382
+ let V = F;
1383
+ T(m) || (V = $(F, m));
1384
+ const g = JSON.stringify(V);
1385
+ o.current !== g && (l(V), o.current = g);
1386
+ };
1387
+ d();
1388
+ const c = a == null ? void 0 : a(d);
1389
+ return () => {
1390
+ c == null || c();
1391
+ };
1392
+ }, []), i;
1393
+ }, A = Be;
1394
+ A.Provider = Je;
1395
+ A.Item = de;
1396
+ A.List = He;
1397
+ A.Control = z;
1398
+ A.useForm = Ae;
1399
+ A.useFormContext = Wt;
1400
+ A.useWatch = Nt;
1401
+ A.useFormState = Pt;
2
1402
  export {
3
- o as FormControl,
4
- r as FormItem,
5
- e as FormList,
6
- t as FormProvider,
7
- m as default,
8
- F as useForm,
9
- u as useFormContext,
10
- d as useFormState,
11
- C as useWatch
1403
+ z as FormControl,
1404
+ de as FormItem,
1405
+ He as FormList,
1406
+ Je as FormProvider,
1407
+ A as default,
1408
+ Ae as useForm,
1409
+ Wt as useFormContext,
1410
+ Pt as useFormState,
1411
+ Nt as useWatch
12
1412
  };