@unicom-cloud/ui 0.8.55 → 0.8.57

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