@zat-design/sisyphus-react 4.5.9 → 4.5.10-beta.2

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 (280) hide show
  1. package/dist/index.esm.css +1 -1
  2. package/dist/less.esm.css +1 -1
  3. package/es/FormsProvider/index.js +14 -21
  4. package/es/ProAction/components/CheckModalContent/index.js +12 -26
  5. package/es/ProAction/index.js +79 -83
  6. package/es/ProAction/propsType.js +0 -1
  7. package/es/ProConfigProvider/index.js +63 -110
  8. package/es/ProConfigProvider/propsType.js +0 -1
  9. package/es/ProDownload/index.d.ts +2 -1
  10. package/es/ProDownload/index.js +74 -69
  11. package/es/ProDownload/propsType.js +0 -1
  12. package/es/ProDownload/utils.d.ts +10 -5
  13. package/es/ProDownload/utils.js +63 -95
  14. package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
  15. package/es/ProDrawerForm/components/ProModal/index.js +77 -108
  16. package/es/ProDrawerForm/components/index.js +6 -2
  17. package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
  18. package/es/ProDrawerForm/index.js +29 -38
  19. package/es/ProDrawerForm/propsType.js +0 -1
  20. package/es/ProDrawerForm/utils/index.js +18 -36
  21. package/es/ProEditLabel/components/RenderProForm.js +45 -49
  22. package/es/ProEditLabel/index.js +126 -163
  23. package/es/ProEditLabel/propsType.js +0 -1
  24. package/es/ProEditLabel/utils/index.js +5 -8
  25. package/es/ProEditTable/components/ActionButton/index.js +111 -119
  26. package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
  27. package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
  28. package/es/ProEditTable/components/RcTable/index.js +6 -4
  29. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
  30. package/es/ProEditTable/components/RenderField/index.js +490 -587
  31. package/es/ProEditTable/components/RenderField/propsType.js +0 -1
  32. package/es/ProEditTable/components/RenderField/tools.js +115 -112
  33. package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
  34. package/es/ProEditTable/components/Summary/index.js +38 -64
  35. package/es/ProEditTable/components/Validator/index.js +46 -46
  36. package/es/ProEditTable/components/index.js +12 -5
  37. package/es/ProEditTable/index.js +456 -378
  38. package/es/ProEditTable/propsType.js +0 -1
  39. package/es/ProEditTable/utils/config.js +60 -122
  40. package/es/ProEditTable/utils/diffOriginal.js +45 -82
  41. package/es/ProEditTable/utils/getDefaultProps.js +19 -24
  42. package/es/ProEditTable/utils/index.js +154 -235
  43. package/es/ProEditTable/utils/tools.js +149 -286
  44. package/es/ProEditTable/utils/transform.js +25 -30
  45. package/es/ProEditTable/utils/useEditTableError.js +30 -43
  46. package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
  47. package/es/ProEditTable/utils/validateAll.js +87 -154
  48. package/es/ProEnum/components/Group.js +38 -30
  49. package/es/ProEnum/components/Tag.js +22 -26
  50. package/es/ProEnum/hooks/useEnum.js +48 -116
  51. package/es/ProEnum/hooks/useEnumRequest.js +182 -212
  52. package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
  53. package/es/ProEnum/index.js +162 -172
  54. package/es/ProEnum/propsType.js +0 -1
  55. package/es/ProEnum/utils/eventCenter.js +10 -12
  56. package/es/ProEnum/utils/frequentEnum.js +35 -92
  57. package/es/ProEnum/utils/getEnum.js +32 -90
  58. package/es/ProEnum/utils/getEnumLabel.js +44 -49
  59. package/es/ProEnum/utils/index.js +93 -207
  60. package/es/ProForm/components/Container.js +13 -28
  61. package/es/ProForm/components/FormFooter/index.js +36 -44
  62. package/es/ProForm/components/FormFooter/propsType.js +0 -1
  63. package/es/ProForm/components/base/Checkbox/index.js +32 -59
  64. package/es/ProForm/components/base/DatePicker/index.js +49 -71
  65. package/es/ProForm/components/base/Input/index.js +63 -97
  66. package/es/ProForm/components/base/Input/propsType.js +0 -1
  67. package/es/ProForm/components/base/InputNumber/index.js +118 -172
  68. package/es/ProForm/components/base/Radio/index.js +39 -52
  69. package/es/ProForm/components/base/RangePicker/index.js +109 -127
  70. package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
  71. package/es/ProForm/components/base/Select/index.js +63 -89
  72. package/es/ProForm/components/base/Switch/index.js +27 -35
  73. package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
  74. package/es/ProForm/components/base/TextArea/index.js +30 -41
  75. package/es/ProForm/components/base/TimePicker/index.js +27 -37
  76. package/es/ProForm/components/combination/Container/index.js +37 -47
  77. package/es/ProForm/components/combination/Container/propsType.js +0 -1
  78. package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
  79. package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -102
  80. package/es/ProForm/components/combination/FormList/components/Empty.js +28 -55
  81. package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
  82. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
  83. package/es/ProForm/components/combination/FormList/index.js +151 -161
  84. package/es/ProForm/components/combination/FormList/propsType.js +0 -1
  85. package/es/ProForm/components/combination/FormList/style/index.less +6 -0
  86. package/es/ProForm/components/combination/FormList/utils.js +22 -38
  87. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
  88. package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
  89. package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +106 -213
  90. package/es/ProForm/components/combination/Group/hooks/index.js +69 -129
  91. package/es/ProForm/components/combination/Group/index.js +87 -126
  92. package/es/ProForm/components/combination/Group/propsType.js +0 -1
  93. package/es/ProForm/components/combination/Group/utils/index.js +124 -239
  94. package/es/ProForm/components/combination/ProCascader/index.js +156 -199
  95. package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
  96. package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
  97. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +72 -70
  98. package/es/ProForm/components/combination/ProModalSelect/index.js +309 -347
  99. package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
  100. package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
  101. package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
  102. package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
  103. package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
  104. package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
  105. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
  106. package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
  107. package/es/ProForm/components/index.js +56 -34
  108. package/es/ProForm/components/render/ChangedWrapper.js +85 -94
  109. package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
  110. package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
  111. package/es/ProForm/components/render/Render.js +223 -329
  112. package/es/ProForm/components/render/RenderFields.js +76 -113
  113. package/es/ProForm/components/render/propsType.js +0 -1
  114. package/es/ProForm/hooks/useControlled.js +8 -10
  115. package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
  116. package/es/ProForm/hooks/useFieldProps.js +8 -4
  117. package/es/ProForm/hooks/useForm.js +50 -110
  118. package/es/ProForm/hooks/useRules.js +17 -33
  119. package/es/ProForm/hooks/useShouldUpdate.js +77 -152
  120. package/es/ProForm/hooks/useWatch.js +62 -134
  121. package/es/ProForm/index.js +157 -194
  122. package/es/ProForm/propsType.js +15 -7
  123. package/es/ProForm/utils/buildFormItemProps.js +51 -58
  124. package/es/ProForm/utils/diffOriginal.js +43 -73
  125. package/es/ProForm/utils/getDefaultProps.js +18 -24
  126. package/es/ProForm/utils/index.js +160 -235
  127. package/es/ProForm/utils/processDependencies.js +21 -60
  128. package/es/ProForm/utils/reactiveValues.js +20 -34
  129. package/es/ProForm/utils/rulesCreator.js +42 -40
  130. package/es/ProForm/utils/transformNames.js +10 -13
  131. package/es/ProForm/utils/transformValue.js +16 -29
  132. package/es/ProForm/utils/valueType.js +96 -178
  133. package/es/ProIcon/config/index.js +340 -274
  134. package/es/ProIcon/index.js +135 -209
  135. package/es/ProIcon/propsTypes.js +0 -1
  136. package/es/ProIcon/utils/index.js +24 -39
  137. package/es/ProLayout/components/Layout/Header/index.js +108 -141
  138. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
  139. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +113 -139
  140. package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
  141. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
  142. package/es/ProLayout/components/Layout/Menu/index.js +92 -89
  143. package/es/ProLayout/components/Layout/Notice/index.js +13 -27
  144. package/es/ProLayout/components/Layout/index.js +8 -3
  145. package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
  146. package/es/ProLayout/components/ProCollapse/index.js +89 -111
  147. package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
  148. package/es/ProLayout/components/ProFooter/index.js +27 -24
  149. package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
  150. package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
  151. package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -84
  152. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
  153. package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
  154. package/es/ProLayout/components/ProHeader/components/index.js +6 -2
  155. package/es/ProLayout/components/ProHeader/index.js +216 -356
  156. package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
  157. package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
  158. package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -63
  159. package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
  160. package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
  161. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
  162. package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
  163. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
  164. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
  165. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +320 -350
  166. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.d.ts +19 -0
  167. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +332 -0
  168. package/es/ProLayout/components/TabsManager/index.js +407 -351
  169. package/es/ProLayout/components/TabsManager/propTypes.d.ts +4 -0
  170. package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
  171. package/es/ProLayout/components/TabsManager/style/index.less +1 -1
  172. package/es/ProLayout/components/TabsManager/utils/historyObserver.d.ts +7 -0
  173. package/es/ProLayout/components/TabsManager/utils/historyObserver.js +65 -0
  174. package/es/ProLayout/components/TabsManager/utils/index.d.ts +15 -2
  175. package/es/ProLayout/components/TabsManager/utils/index.js +156 -159
  176. package/es/ProLayout/components/index.js +8 -3
  177. package/es/ProLayout/index.js +173 -228
  178. package/es/ProLayout/propTypes.d.ts +28 -1
  179. package/es/ProLayout/propTypes.js +12 -52
  180. package/es/ProLayout/utils/index.js +48 -128
  181. package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
  182. package/es/ProSelect/index.js +187 -223
  183. package/es/ProSelect/propsType.js +0 -1
  184. package/es/ProSelect/style/index.less +13 -0
  185. package/es/ProSelect/utils/index.js +100 -146
  186. package/es/ProStep/components/Anchor/index.js +71 -82
  187. package/es/ProStep/components/Item/index.js +49 -56
  188. package/es/ProStep/components/LazyLoad/index.js +23 -29
  189. package/es/ProStep/components/Listener/index.js +20 -33
  190. package/es/ProStep/components/Step/index.js +31 -38
  191. package/es/ProStep/constants.js +4 -1
  192. package/es/ProStep/index.js +166 -153
  193. package/es/ProStep/propsType.js +0 -1
  194. package/es/ProStep/style/index.less +1 -1
  195. package/es/ProStep/utils/index.js +29 -55
  196. package/es/ProStepTab/index.js +83 -138
  197. package/es/ProStepTab/propsType.js +0 -1
  198. package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
  199. package/es/ProTable/components/EditableCell/index.js +37 -71
  200. package/es/ProTable/components/EditableCell/propsType.js +0 -1
  201. package/es/ProTable/components/FormatColumn/index.js +209 -340
  202. package/es/ProTable/components/FormatColumn/propsType.js +0 -1
  203. package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
  204. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
  205. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
  206. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
  207. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
  208. package/es/ProTable/components/RcTable/index.js +6 -4
  209. package/es/ProTable/components/RenderColumn/index.js +158 -186
  210. package/es/ProTable/components/RenderEmptyText/index.js +12 -21
  211. package/es/ProTable/components/RenderFooter/index.js +15 -15
  212. package/es/ProTable/components/RenderSummary/index.js +33 -50
  213. package/es/ProTable/components/RenderTableHeader/index.js +44 -46
  214. package/es/ProTable/components/RenderTabs/index.js +47 -51
  215. package/es/ProTable/components/TableResizable/index.js +56 -72
  216. package/es/ProTable/components/TooltipTitle/index.js +13 -21
  217. package/es/ProTable/components/index.js +16 -36
  218. package/es/ProTable/hooks/useAntdTable.js +191 -224
  219. package/es/ProTable/index.js +232 -249
  220. package/es/ProTable/propsType.js +0 -1
  221. package/es/ProTable/utils/columnStorage.js +63 -88
  222. package/es/ProTable/utils/index.js +57 -90
  223. package/es/ProTabs/components/Card/index.js +20 -48
  224. package/es/ProTabs/components/index.js +4 -1
  225. package/es/ProTabs/index.js +41 -58
  226. package/es/ProTabs/propType.js +0 -1
  227. package/es/ProThemeTools/component/ProTools/index.js +106 -158
  228. package/es/ProThemeTools/component/index.js +4 -1
  229. package/es/ProThemeTools/context/ThemeContext.js +67 -146
  230. package/es/ProThemeTools/index.js +103 -156
  231. package/es/ProThemeTools/propsType.js +0 -1
  232. package/es/ProThemeTools/utils/index.js +60 -109
  233. package/es/ProTooltip/index.js +132 -168
  234. package/es/ProTooltip/propsType.js +0 -1
  235. package/es/ProTree/components/AdaptiveTooltip.js +15 -17
  236. package/es/ProTree/components/CloseIcon.js +18 -26
  237. package/es/ProTree/components/List.js +28 -47
  238. package/es/ProTree/components/ProTree.js +152 -211
  239. package/es/ProTree/components/ProTreeSelect/index.js +255 -459
  240. package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
  241. package/es/ProTree/components/SearchTitle.js +23 -42
  242. package/es/ProTree/components/Tree.js +147 -195
  243. package/es/ProTree/components/index.js +10 -5
  244. package/es/ProTree/index.js +12 -16
  245. package/es/ProTree/propsType.js +0 -1
  246. package/es/ProTree/utils.js +46 -118
  247. package/es/ProTreeModal/components/Cascader.js +56 -64
  248. package/es/ProTreeModal/components/CloseIcon.js +18 -26
  249. package/es/ProTreeModal/components/List.js +114 -180
  250. package/es/ProTreeModal/components/SearchTitle.js +15 -18
  251. package/es/ProTreeModal/components/SortableItem.js +29 -58
  252. package/es/ProTreeModal/components/Tree.js +99 -113
  253. package/es/ProTreeModal/components/Trigger.js +87 -121
  254. package/es/ProTreeModal/components/index.js +14 -6
  255. package/es/ProTreeModal/index.js +397 -438
  256. package/es/ProTreeModal/propsType.js +0 -1
  257. package/es/ProTreeModal/utils.js +52 -95
  258. package/es/ProUpload/components/ButtonRender.js +44 -54
  259. package/es/ProUpload/components/DragRender.js +94 -148
  260. package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
  261. package/es/ProUpload/components/Example.js +27 -31
  262. package/es/ProUpload/components/FileItem.js +69 -163
  263. package/es/ProUpload/components/ImageRender.js +134 -170
  264. package/es/ProUpload/index.js +68 -100
  265. package/es/ProUpload/propsType.js +0 -1
  266. package/es/ProUpload/uitls.js +8 -4
  267. package/es/ProUtils/utils/index.js +17 -13
  268. package/es/ProViewer/index.js +154 -175
  269. package/es/ProViewer/propsType.js +0 -5
  270. package/es/ProWaterMark/index.js +9 -16
  271. package/es/ProWaterMark/propsType.js +0 -1
  272. package/es/hooks/useDraggableRow.js +25 -53
  273. package/es/index.js +57 -77
  274. package/es/locale/en_US.js +153 -142
  275. package/es/locale/index.js +23 -36
  276. package/es/locale/zh_CN.js +145 -142
  277. package/es/tokens.js +84 -83
  278. package/es/utils/index.js +24 -51
  279. package/package.json +4 -2
  280. package/es/ProConfigProvider/demo/locale.js +0 -58
@@ -1,8 +1,9 @@
1
- import _isString from "lodash/isString";
2
- import _union from "lodash/union";
3
- import _isFunction from "lodash/isFunction";
4
- import _isBoolean from "lodash/isBoolean";
5
- import React from 'react';
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import isBoolean from "lodash/isBoolean";
4
+ import isFunction from "lodash/isFunction";
5
+ import union from "lodash/union";
6
+ import isString from "lodash/isString";
6
7
  import Render from "./Render";
7
8
  import { getDefaultProps } from "../../utils/getDefaultProps";
8
9
  import * as componentMap from "../index";
@@ -10,8 +11,7 @@ import { isSelect } from "../../utils";
10
11
  import { FieldProvider } from "../../hooks/useFieldProps";
11
12
  import locale from "../../../locale";
12
13
  import processDependencies from "../../utils/processDependencies";
13
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
14
- const RenderFields = props => {
14
+ const RenderFields = (props) => {
15
15
  const {
16
16
  isView,
17
17
  columns = [],
@@ -20,7 +20,7 @@ const RenderFields = props => {
20
20
  form,
21
21
  expand,
22
22
  colProps: defaultColProps,
23
- viewEmpty = '-',
23
+ viewEmpty = "-",
24
24
  openState,
25
25
  labelWidth,
26
26
  clearNotShow: outerClearNotShow,
@@ -30,20 +30,18 @@ const RenderFields = props => {
30
30
  globalControl,
31
31
  shouldUpdateDebounce
32
32
  } = props;
33
-
34
- // 根据 hiddenNames 生成隐藏字段供表单收集(不可变:不修改入参 columns,避免稳定引用下跨渲染累积)
35
- const hiddenColumns = columns.filter(item => Array.isArray(item.hiddenNames)).flatMap(item => item.hiddenNames).map(nameItem => ({
33
+ const hiddenColumns = columns.filter((item) => Array.isArray(item.hiddenNames)).flatMap((item) => item.hiddenNames).map((nameItem) => ({
36
34
  name: Array.isArray(nameItem) ? nameItem : `${nameItem}`,
37
35
  hidden: true
38
36
  }));
39
37
  const renderColumns = hiddenColumns.length ? [...columns, ...hiddenColumns] : columns;
40
38
  const comList = renderColumns.flatMap((column, index) => {
39
+ var _a;
41
40
  if (!!expand && !openState) {
42
- // expand为Number时 过滤掉大于expand 非fixed的column
43
- if (typeof expand === 'number') {
44
- if (index >= expand && column.fixed !== true) return [];
41
+ if (typeof expand === "number") {
42
+ if (index >= expand && column.fixed !== true)
43
+ return [];
45
44
  } else if (column.fixed !== true) {
46
- // 否则只过滤非fixed的column
47
45
  return [];
48
46
  }
49
47
  }
@@ -65,15 +63,10 @@ const RenderFields = props => {
65
63
  span,
66
64
  ...otherFormItemProps
67
65
  } = column;
68
- const {
69
- component
70
- } = column;
71
- const _isView = typeof column.isView === 'boolean' ? column.isView : isView;
66
+ const { component } = column;
67
+ const _isView = typeof column.isView === "boolean" ? column.isView : isView;
72
68
  const defaultProps = getDefaultProps(column);
73
- // 处理dependencies,支持namesPaths格式
74
69
  const processedDeps = processDependencies(column.dependencies);
75
-
76
- // formItem 的属性平铺在 column 最外层
77
70
  const _formItemProps = {
78
71
  ...defaultProps,
79
72
  ...otherFormItemProps,
@@ -81,74 +74,54 @@ const RenderFields = props => {
81
74
  clearNotShow,
82
75
  dependencies: processedDeps
83
76
  };
84
- _formItemProps.labelWidth = _formItemProps.labelWidth || labelWidth; // 接收Form中的labelWidth
85
-
77
+ _formItemProps.labelWidth = _formItemProps.labelWidth || labelWidth;
86
78
  if (type && component) {
87
- console.error('Warning: type and component are mutually exclusive. type will not take effect');
79
+ console.error(
80
+ "Warning: type and component are mutually exclusive. type will not take effect"
81
+ );
88
82
  }
89
- let _type = type || 'Input';
83
+ let _type = type || "Input";
90
84
  let TargetComponent;
91
-
92
- // 查看高阶函数
93
85
  const viewRenderHandle = () => {
86
+ var _a2;
94
87
  let value = form.getFieldValue(column.name);
95
88
  let record = form.getFieldsValue();
96
- let index;
97
- // FormList场景
98
- if (Array.isArray(column?.namePath) && column?.namePath?.length) {
99
- value = form.getFieldValue(_union(column.namePath, column?.name || []));
89
+ let index2;
90
+ if (Array.isArray(column == null ? void 0 : column.namePath) && ((_a2 = column == null ? void 0 : column.namePath) == null ? void 0 : _a2.length)) {
91
+ value = form.getFieldValue(union(column.namePath, (column == null ? void 0 : column.name) || []));
100
92
  record = form.getFieldValue(column.namePath);
101
- index = column?.index;
93
+ index2 = column == null ? void 0 : column.index;
102
94
  }
103
- return viewRender ? viewRender(value, record, {
104
- form,
105
- index,
106
- namePath: column?.namePath
107
- }) || null : null;
95
+ return viewRender ? viewRender(value, record, { form, index: index2, namePath: column == null ? void 0 : column.namePath }) || null : null;
108
96
  };
109
- if (typeof _type === 'string') {
97
+ if (typeof _type === "string") {
110
98
  TargetComponent = _isView && viewRender ? viewRenderHandle : componentMap[_type];
111
99
  }
112
- // 自定义组件时 防止默认值影像后续判断
113
- if ('component' in column) {
100
+ if ("component" in column) {
114
101
  _type = null;
115
102
  }
116
- if (component && /*#__PURE__*/React.isValidElement(component)) {
103
+ if (component && React.isValidElement(component)) {
117
104
  const newComponent = component;
118
- const isProEditTable = newComponent?.props?.onlyOneLineMsg != null;
119
- TargetComponent = _isView ? viewRenderHandle || '' : component;
120
- // 可编辑表格内部支持
105
+ const isProEditTable = ((_a = newComponent == null ? void 0 : newComponent.props) == null ? void 0 : _a.onlyOneLineMsg) != null;
106
+ TargetComponent = _isView ? viewRenderHandle || "" : component;
121
107
  if (isProEditTable) {
122
108
  TargetComponent = _isView ? viewRenderHandle || component : component;
123
109
  }
124
110
  }
125
- const {
126
- label,
127
- placeholder,
128
- dataSource
129
- } = formItemChildProps;
130
- const {
131
- label: formLabel
132
- } = _formItemProps;
133
- const comDisabled = _formItemProps?.disabled ?? fieldProps.disabled; // 组件属性层disabled fieldProps可能为函数
134
-
135
- // 当前组件是不是一个选择组件
136
- const _isSelect = isSelect({
137
- dataSource,
138
- type: _type
139
- });
111
+ const { label, placeholder, dataSource } = formItemChildProps;
112
+ const { label: formLabel } = _formItemProps;
113
+ const comDisabled = (_formItemProps == null ? void 0 : _formItemProps.disabled) ?? fieldProps.disabled;
114
+ const _isSelect = isSelect({ dataSource, type: _type });
140
115
  const placeholderHandle = () => {
141
- const _label = _isString(label) ? label : '';
142
- const _formLabel = _isString(formLabel) ? formLabel : '';
143
- return placeholder || `${_isSelect ? `${locale.ProForm.selectPlaceHolder}` : `${locale.ProForm.inputPlaceholder}`}${_label || _formLabel || ''}`;
116
+ const _label = isString(label) ? label : "";
117
+ const _formLabel = isString(formLabel) ? formLabel : "";
118
+ return placeholder || `${_isSelect ? `${locale.ProForm.selectPlaceHolder}` : `${locale.ProForm.inputPlaceholder}`}${_label || _formLabel || ""}`;
144
119
  };
145
-
146
- // 表单组件Props 兼容2.0版本
147
120
  const _fieldProps = {
148
121
  ...formItemChildProps,
149
122
  ...fieldProps
150
123
  };
151
- if (_isBoolean(formDisabled)) {
124
+ if (isBoolean(formDisabled)) {
152
125
  _fieldProps.disabled = formDisabled;
153
126
  }
154
127
  const componentProps = {
@@ -156,38 +129,23 @@ const RenderFields = props => {
156
129
  ..._fieldProps,
157
130
  disabled: comDisabled
158
131
  };
159
-
160
- // 容器组件,额外处理show的问题
161
- if (['ProCollapse', 'Container'].includes(_type)) {
132
+ if (["ProCollapse", "Container"].includes(_type)) {
162
133
  componentProps.show = show;
163
134
  componentProps.clearNotShow = clearNotShow;
164
135
  componentProps.diffConfig = diffConfig;
165
136
  }
166
-
167
- // switch与SwitchCheckbox单独添加valuePropName
168
- if (['Switch', 'SwitchCheckbox'].includes(_type)) {
169
- _formItemProps.valuePropName = 'checked';
137
+ if (["Switch", "SwitchCheckbox"].includes(_type)) {
138
+ _formItemProps.valuePropName = "checked";
170
139
  }
171
-
172
- // 时间范围placeholder处理
173
- if (['RangePicker'].includes(_type) && !fieldProps?.placeholder) {
140
+ if (["RangePicker"].includes(_type) && !(fieldProps == null ? void 0 : fieldProps.placeholder)) {
174
141
  delete componentProps.placeholder;
175
142
  }
176
-
177
- // 没有找到对应组件 不渲染
178
143
  if (!TargetComponent) {
179
144
  return [];
180
145
  }
181
- const _colProps = span ? {
182
- span
183
- } : {
184
- ...defaultColProps,
185
- ...colProps
186
- };
146
+ const _colProps = span ? { span } : { ...defaultColProps, ...colProps };
187
147
  const columnName = _formItemProps.name;
188
- const fieldKey = (Array.isArray(columnName) ? columnName.join('.') : columnName) ?? _formItemProps.label ?? _type;
189
-
190
- // 其余参数收进对象里传给子组件 componentProps只包含子组件参数
148
+ const fieldKey = (Array.isArray(columnName) ? columnName.join(".") : columnName) ?? _formItemProps.label ?? _type;
191
149
  const otherProps = {
192
150
  label: _formItemProps.label,
193
151
  name: _formItemProps.name,
@@ -209,31 +167,36 @@ const RenderFields = props => {
209
167
  diffConfig,
210
168
  shouldUpdateDebounce
211
169
  };
212
- return /*#__PURE__*/_jsx(FieldProvider, {
213
- value: otherProps,
214
- children: /*#__PURE__*/_jsx(Render, {
215
- show: show,
216
- disabled: column.disabled // 外层配置disabled(与 otherProps.disabled 语义不同,单独传递)
217
- ,
218
- originComponent: component // 原始自定义component,用于动态函数场景,TargetComponent已经默认赋值Input被污染
219
- ,
220
- component: TargetComponent,
221
- formItemProps: _formItemProps,
222
- confirm: confirm,
223
- componentProps: componentProps,
224
- otherProps: otherProps,
225
- fieldProps: _isFunction(fieldProps) ? fieldProps : null // 透传fieldProps函数
226
- ,
227
- isSelect: _isSelect,
228
- onDiff: onDiff,
229
- requiredOnView: requiredOnView,
230
- viewRender: viewRender,
231
- desensitization: desensitization
232
- })
233
- }, fieldKey != null && fieldKey !== '' ? String(fieldKey) : `column-${index}`);
234
- });
235
- return /*#__PURE__*/_jsx(_Fragment, {
236
- children: comList
170
+ return /* @__PURE__ */ jsx(
171
+ FieldProvider,
172
+ {
173
+ value: otherProps,
174
+ children: /* @__PURE__ */ jsx(
175
+ Render,
176
+ {
177
+ show,
178
+ disabled: column.disabled,
179
+ originComponent: component,
180
+ component: TargetComponent,
181
+ formItemProps: _formItemProps,
182
+ confirm,
183
+ componentProps,
184
+ otherProps,
185
+ fieldProps: isFunction(fieldProps) ? fieldProps : null,
186
+ isSelect: _isSelect,
187
+ onDiff,
188
+ requiredOnView,
189
+ viewRender,
190
+ desensitization
191
+ }
192
+ )
193
+ },
194
+ fieldKey != null && fieldKey !== "" ? String(fieldKey) : `column-${index}`
195
+ );
237
196
  });
197
+ return /* @__PURE__ */ jsx(Fragment, { children: comList });
198
+ };
199
+ var RenderFields_default = RenderFields;
200
+ export {
201
+ RenderFields_default as default
238
202
  };
239
- export default RenderFields;
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +1,12 @@
1
- import { useState } from 'react';
2
-
3
- // 受控状态
4
- export const useControlled = props => {
5
- const {
6
- value,
7
- onChange
8
- } = props;
1
+ import { useState } from "react";
2
+ const useControlled = (props) => {
3
+ const { value, onChange } = props;
9
4
  const [state, setState] = useState(value || false);
10
- if (value !== undefined) {
5
+ if (value !== void 0) {
11
6
  return [value, onChange];
12
7
  }
13
8
  return [state, setState];
14
- };
9
+ };
10
+ export {
11
+ useControlled
12
+ };
@@ -1,17 +1,17 @@
1
- import _isEqualWith from "lodash/isEqualWith";
2
- import { useRef } from 'react';
1
+ import { useRef } from "react";
2
+ import isEqualWith from "lodash/isEqualWith";
3
3
  import { customEqualForFunction } from "../../utils";
4
-
5
- /** 深度比较依赖变化memo */
6
- export const useDeepCompareMemo = (fun, changedCb, depList) => {
7
- const lastDependency = useRef({}); // 上一次的依赖
8
- const lastRes = useRef({}); // 上一次的结果
9
-
10
- if (!_isEqualWith(depList, lastDependency?.current, customEqualForFunction)) {
4
+ const useDeepCompareMemo = (fun, changedCb, depList) => {
5
+ const lastDependency = useRef({});
6
+ const lastRes = useRef({});
7
+ if (!isEqualWith(depList, lastDependency == null ? void 0 : lastDependency.current, customEqualForFunction)) {
11
8
  const res = fun();
12
- changedCb?.(lastRes.current, res);
9
+ changedCb == null ? void 0 : changedCb(lastRes.current, res);
13
10
  lastRes.current = res;
14
11
  }
15
12
  lastDependency.current = depList;
16
13
  return lastRes.current;
17
- };
14
+ };
15
+ export {
16
+ useDeepCompareMemo
17
+ };
@@ -1,4 +1,8 @@
1
- import React, { useContext } from 'react';
2
- const FieldContext = /*#__PURE__*/React.createContext({});
3
- export const FieldProvider = FieldContext.Provider;
4
- export const useFieldProps = () => useContext(FieldContext);
1
+ import React, { useContext } from "react";
2
+ const FieldContext = React.createContext({});
3
+ const FieldProvider = FieldContext.Provider;
4
+ const useFieldProps = () => useContext(FieldContext);
5
+ export {
6
+ FieldProvider,
7
+ useFieldProps
8
+ };
@@ -1,48 +1,30 @@
1
- import { Form } from 'antd';
2
- import { useContext } from 'react';
1
+ import { Form } from "antd";
2
+ import { useContext } from "react";
3
3
  import { filterInternalFields, getFormFieldPaths, mergeNames, isListForm } from "../utils";
4
4
  import { handleScrollToError as handleScrollToErrorProEditTable } from "../../ProEditTable/utils/tools";
5
5
  import { FormsContext } from "../../FormsProvider";
6
- export const useForm = function (originForm, options) {
7
- // 如果没有form实例可以直接把options放在第一个参数位置
8
- // @ts-ignore
9
- const _originForm = originForm?._init ? originForm : undefined;
10
- const _options =
11
- // @ts-ignore
12
- options || (originForm && !originForm?._init ? originForm : undefined);
13
- const {
14
- scrollToError = true,
15
- optimize,
16
- formKey,
17
- source
18
- } = _options || {};
19
-
20
- // formKey全局共享逻辑
6
+ const useForm = function(originForm, options) {
7
+ const _originForm = (originForm == null ? void 0 : originForm._init) ? originForm : void 0;
8
+ const _options = (
9
+ // @ts-ignore
10
+ options || (originForm && !(originForm == null ? void 0 : originForm._init) ? originForm : void 0)
11
+ );
12
+ const { scrollToError = true, optimize, formKey, source } = _options || {};
21
13
  const forms = useContext(FormsContext);
22
14
  const [localForm] = Form.useForm(_originForm);
23
- // 同步注册共享实例,确保同一渲染流程中相同 formKey 复用同一个实例
24
15
  if (formKey && !forms[formKey]) {
25
16
  forms[formKey] = localForm;
26
17
  localForm.formKey = formKey;
27
18
  }
28
- const sharedForm = formKey ? forms[formKey] : undefined;
19
+ const sharedForm = formKey ? forms[formKey] : void 0;
29
20
  const form = sharedForm || localForm;
30
21
  if (formKey && form.formKey !== formKey) {
31
22
  form.formKey = formKey;
32
23
  }
33
- const {
34
- getFieldsValue,
35
- validateFields,
36
- isModified,
37
- setFields,
38
- getFieldsError,
39
- setFieldsValue
40
- } = form;
41
- if (isModified) return [form];
42
-
43
- // @ts-ignore
24
+ const { getFieldsValue, validateFields, isModified, setFields, getFieldsError, setFieldsValue } = form;
25
+ if (isModified)
26
+ return [form];
44
27
  const nextGetFieldsValue = (nameList, filterFunc) => {
45
- // 全部查询
46
28
  if (nameList !== true) {
47
29
  const values = getFieldsValue(nameList || true, filterFunc);
48
30
  return filterInternalFields(values, optimize);
@@ -50,69 +32,43 @@ export const useForm = function (originForm, options) {
50
32
  return getFieldsValue(nameList, filterFunc);
51
33
  };
52
34
  const nextValidateFields = async (nameList, ...rest) => {
53
- // 内部选项:行内联动等被动校验只想触发校验、不想滚动到报错位置;
54
- // 全局/主动提交校验不传,保持滚动。提取后从传给 antd 底层的选项中剔除,避免污染原生 options。
55
- // @ts-ignore
56
- const skipScrollOnError = !!rest?.[0]?.__skipScrollOnError;
57
- // @ts-ignore
58
- const restForNative = rest?.[0] ? [(({
59
- __skipScrollOnError,
60
- ...opts
61
- }) => opts)(rest[0]), ...rest.slice(1)] : rest;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h;
36
+ const skipScrollOnError = !!((_a = rest == null ? void 0 : rest[0]) == null ? void 0 : _a.__skipScrollOnError);
37
+ const restForNative = (rest == null ? void 0 : rest[0]) ? [(({ __skipScrollOnError, ...opts }) => opts)(rest[0]), ...rest.slice(1)] : rest;
62
38
  try {
63
- const isRecursive = rest?.[0]?.recursive;
64
- const stopOnFirstError = form?.__INTERNAL_CONFIG__?.stopOnFirstError;
65
-
66
- // 如果启用了 stopOnFirstError 且没有指定字段列表
39
+ const isRecursive = (_b = rest == null ? void 0 : rest[0]) == null ? void 0 : _b.recursive;
40
+ const stopOnFirstError = (_c = form == null ? void 0 : form.__INTERNAL_CONFIG__) == null ? void 0 : _c.stopOnFirstError;
67
41
  if (stopOnFirstError && !nameList) {
68
- // 获取所有表单字段
69
42
  const allFields = getFormFieldPaths(form);
70
- // 单独验证每个字段
71
- // eslint-disable-next-line no-restricted-syntax
72
43
  for (const field of allFields) {
73
44
  try {
74
- // 创建不包含 stopOnFirstError / 内部选项的选项
75
- // @ts-ignore
76
- const options = rest?.[0] ? {
77
- ...rest[0]
78
- } : {};
79
- delete options.stopOnFirstError;
80
- delete options.__skipScrollOnError;
81
- // 验证单个字段
82
- // eslint-disable-next-line no-await-in-loop
83
- await validateFields([field], options);
45
+ const options2 = (rest == null ? void 0 : rest[0]) ? { ...rest[0] } : {};
46
+ delete options2.stopOnFirstError;
47
+ delete options2.__skipScrollOnError;
48
+ await validateFields([field], options2);
84
49
  } catch (error) {
85
- // 遇到错误,滚动到错误位置(skipScrollOnError 时跳过)
86
- if (!skipScrollOnError && scrollToError && error?.errorFields?.length) {
87
- form.scrollToField(error.errorFields[0]?.name, {
88
- block: 'center',
89
- behavior: 'smooth'
50
+ if (!skipScrollOnError && scrollToError && ((_d = error == null ? void 0 : error.errorFields) == null ? void 0 : _d.length)) {
51
+ form.scrollToField((_e = error.errorFields[0]) == null ? void 0 : _e.name, {
52
+ block: "center",
53
+ behavior: "smooth"
90
54
  });
91
55
  }
92
- // 中止验证,抛出错误
93
56
  throw error;
94
57
  }
95
58
  }
96
- // 全部验证通过,返回表单值
97
59
  return form.getFieldsValue();
98
60
  }
99
61
  let validateNames = [];
100
- // 前缀校验模式
101
62
  if (isRecursive) {
102
- // @ts-ignore
103
- const {
104
- getFields
105
- } = form.getInternalHooks('RC_FORM_INTERNAL_HOOKS');
63
+ const { getFields } = form.getInternalHooks("RC_FORM_INTERNAL_HOOKS");
106
64
  const fieldsList = getFields();
107
-
108
- // formList& proEditTable 特殊处理
109
65
  if (Array.isArray(nameList) && isListForm(String(nameList))) {
110
- const fieldsNames = fieldsList.map(item => item.name);
66
+ const fieldsNames = fieldsList.map((item) => item.name);
111
67
  validateNames = mergeNames(nameList, fieldsNames);
112
68
  } else {
113
- // 其他情况
114
- fieldsList.forEach(item => {
115
- if (nameList[0] === item.name?.[0] || item.name?.[0]?.startsWith(`${nameList[0]}_`)) {
69
+ fieldsList.forEach((item) => {
70
+ var _a2, _b2, _c2;
71
+ if (nameList[0] === ((_a2 = item.name) == null ? void 0 : _a2[0]) || ((_c2 = (_b2 = item.name) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.startsWith(`${nameList[0]}_`))) {
116
72
  validateNames.push(item.name);
117
73
  }
118
74
  });
@@ -120,30 +76,25 @@ export const useForm = function (originForm, options) {
120
76
  if (Array.isArray(nameList) && nameList.length && !validateNames.length) {
121
77
  validateNames = [...nameList];
122
78
  }
123
-
124
- // @ts-ignore
125
- return await validateFields(validateNames, ...restForNative).then(values => {
79
+ return await validateFields(validateNames, ...restForNative).then((values) => {
126
80
  return filterInternalFields(values, optimize);
127
81
  });
128
82
  }
129
-
130
- // 解决,单个pro-edit-table的表单校验
131
- if (nameList?.length && !nameList.join('-').includes(',')) {
132
- const tablePagination = document && document?.querySelector(`#pro-edit-table-pagination-${nameList.join('-')}`);
83
+ if ((nameList == null ? void 0 : nameList.length) && !nameList.join("-").includes(",")) {
84
+ const tablePagination = document && (document == null ? void 0 : document.querySelector(`#pro-edit-table-pagination-${nameList.join("-")}`));
133
85
  if (tablePagination) {
134
- tablePagination?.click?.();
86
+ (_f = tablePagination == null ? void 0 : tablePagination.click) == null ? void 0 : _f.call(tablePagination);
135
87
  }
136
88
  }
137
- return await validateFields(nameList, ...restForNative).then(values => {
89
+ return await validateFields(nameList, ...restForNative).then((values) => {
138
90
  return nameList ? values : nextGetFieldsValue();
139
91
  });
140
92
  } catch (error) {
141
- // skipScrollOnError(行内联动等被动校验)时不滚动,仅抛出错误
142
93
  if (!skipScrollOnError) {
143
- if (scrollToError && error?.errorFields?.length && source === 'ProForm') {
144
- form.scrollToField(error.errorFields[0]?.name, {
145
- block: 'center',
146
- behavior: 'smooth'
94
+ if (scrollToError && ((_g = error == null ? void 0 : error.errorFields) == null ? void 0 : _g.length) && source === "ProForm") {
95
+ form.scrollToField((_h = error.errorFields[0]) == null ? void 0 : _h.name, {
96
+ block: "center",
97
+ behavior: "smooth"
147
98
  });
148
99
  }
149
100
  handleScrollToErrorProEditTable();
@@ -153,21 +104,12 @@ export const useForm = function (originForm, options) {
153
104
  };
154
105
  const nextSetFieldValue = (name, value, info) => {
155
106
  if (info) {
156
- setFields([{
157
- name,
158
- value,
159
- ...info
160
- }]);
107
+ setFields([{ name, value, ...info }]);
161
108
  } else {
162
- setFields([{
163
- name,
164
- value,
165
- errors: [],
166
- warnings: []
167
- }]);
109
+ setFields([{ name, value, errors: [], warnings: [] }]);
168
110
  }
169
111
  };
170
- const nextSetFieldsValue = values => {
112
+ const nextSetFieldsValue = (values) => {
171
113
  const errors = getFieldsError();
172
114
  const errorNames = errors.reduce((acc, entry) => {
173
115
  if (entry.errors.length > 0) {
@@ -176,14 +118,9 @@ export const useForm = function (originForm, options) {
176
118
  return acc;
177
119
  }, []) || [];
178
120
  if (errorNames.length) {
179
- errorNames.forEach(errorName => {
180
- // 只处理names的报错
181
- if (errorName.includes('-')) {
182
- setFields([{
183
- name: errorName,
184
- errors: [],
185
- warnings: []
186
- }]);
121
+ errorNames.forEach((errorName) => {
122
+ if (errorName.includes("-")) {
123
+ setFields([{ name: errorName, errors: [], warnings: [] }]);
187
124
  }
188
125
  });
189
126
  setFieldsValue(values);
@@ -198,4 +135,7 @@ export const useForm = function (originForm, options) {
198
135
  form.isModified = true;
199
136
  form.__INTERNAL_CONFIG__ = {};
200
137
  return [form];
201
- };
138
+ };
139
+ export {
140
+ useForm
141
+ };