@zat-design/sisyphus-react 4.5.10-beta.1 → 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 (266) hide show
  1. package/es/FormsProvider/index.js +14 -21
  2. package/es/ProAction/components/CheckModalContent/index.js +12 -26
  3. package/es/ProAction/index.js +79 -83
  4. package/es/ProAction/propsType.js +0 -1
  5. package/es/ProConfigProvider/index.js +63 -110
  6. package/es/ProConfigProvider/propsType.js +0 -1
  7. package/es/ProDownload/index.js +55 -65
  8. package/es/ProDownload/propsType.js +0 -1
  9. package/es/ProDownload/utils.js +61 -95
  10. package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
  11. package/es/ProDrawerForm/components/ProModal/index.js +77 -108
  12. package/es/ProDrawerForm/components/index.js +6 -2
  13. package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
  14. package/es/ProDrawerForm/index.js +29 -38
  15. package/es/ProDrawerForm/propsType.js +0 -1
  16. package/es/ProDrawerForm/utils/index.js +18 -36
  17. package/es/ProEditLabel/components/RenderProForm.js +45 -49
  18. package/es/ProEditLabel/index.js +126 -163
  19. package/es/ProEditLabel/propsType.js +0 -1
  20. package/es/ProEditLabel/utils/index.js +5 -8
  21. package/es/ProEditTable/components/ActionButton/index.js +111 -119
  22. package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
  23. package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
  24. package/es/ProEditTable/components/RcTable/index.js +6 -4
  25. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
  26. package/es/ProEditTable/components/RenderField/index.js +490 -587
  27. package/es/ProEditTable/components/RenderField/propsType.js +0 -1
  28. package/es/ProEditTable/components/RenderField/tools.js +115 -112
  29. package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
  30. package/es/ProEditTable/components/Summary/index.js +38 -64
  31. package/es/ProEditTable/components/Validator/index.js +46 -46
  32. package/es/ProEditTable/components/index.js +12 -5
  33. package/es/ProEditTable/index.js +456 -378
  34. package/es/ProEditTable/propsType.js +0 -1
  35. package/es/ProEditTable/utils/config.js +60 -122
  36. package/es/ProEditTable/utils/diffOriginal.js +45 -82
  37. package/es/ProEditTable/utils/getDefaultProps.js +19 -24
  38. package/es/ProEditTable/utils/index.js +150 -236
  39. package/es/ProEditTable/utils/tools.js +149 -286
  40. package/es/ProEditTable/utils/transform.js +25 -30
  41. package/es/ProEditTable/utils/useEditTableError.js +30 -43
  42. package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
  43. package/es/ProEditTable/utils/validateAll.js +87 -154
  44. package/es/ProEnum/components/Group.js +38 -30
  45. package/es/ProEnum/components/Tag.js +22 -26
  46. package/es/ProEnum/hooks/useEnum.js +48 -116
  47. package/es/ProEnum/hooks/useEnumRequest.js +128 -179
  48. package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
  49. package/es/ProEnum/index.js +162 -172
  50. package/es/ProEnum/propsType.js +0 -1
  51. package/es/ProEnum/utils/eventCenter.js +10 -12
  52. package/es/ProEnum/utils/frequentEnum.js +35 -92
  53. package/es/ProEnum/utils/getEnum.js +32 -90
  54. package/es/ProEnum/utils/getEnumLabel.js +44 -49
  55. package/es/ProEnum/utils/index.js +93 -207
  56. package/es/ProForm/components/Container.js +13 -28
  57. package/es/ProForm/components/FormFooter/index.js +36 -44
  58. package/es/ProForm/components/FormFooter/propsType.js +0 -1
  59. package/es/ProForm/components/base/Checkbox/index.js +32 -59
  60. package/es/ProForm/components/base/DatePicker/index.js +49 -71
  61. package/es/ProForm/components/base/Input/index.js +63 -97
  62. package/es/ProForm/components/base/Input/propsType.js +0 -1
  63. package/es/ProForm/components/base/InputNumber/index.js +118 -172
  64. package/es/ProForm/components/base/Radio/index.js +39 -52
  65. package/es/ProForm/components/base/RangePicker/index.js +109 -127
  66. package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
  67. package/es/ProForm/components/base/Select/index.js +63 -89
  68. package/es/ProForm/components/base/Switch/index.js +27 -35
  69. package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
  70. package/es/ProForm/components/base/TextArea/index.js +30 -41
  71. package/es/ProForm/components/base/TimePicker/index.js +27 -37
  72. package/es/ProForm/components/combination/Container/index.js +37 -47
  73. package/es/ProForm/components/combination/Container/propsType.js +0 -1
  74. package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
  75. package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -103
  76. package/es/ProForm/components/combination/FormList/components/Empty.js +27 -54
  77. package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
  78. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
  79. package/es/ProForm/components/combination/FormList/index.js +151 -161
  80. package/es/ProForm/components/combination/FormList/propsType.js +0 -1
  81. package/es/ProForm/components/combination/FormList/utils.js +22 -38
  82. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
  83. package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
  84. package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +105 -206
  85. package/es/ProForm/components/combination/Group/hooks/index.js +68 -128
  86. package/es/ProForm/components/combination/Group/index.js +87 -126
  87. package/es/ProForm/components/combination/Group/propsType.js +0 -1
  88. package/es/ProForm/components/combination/Group/utils/index.js +124 -239
  89. package/es/ProForm/components/combination/ProCascader/index.js +156 -199
  90. package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
  91. package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
  92. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +63 -75
  93. package/es/ProForm/components/combination/ProModalSelect/index.js +290 -348
  94. package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
  95. package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
  96. package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
  97. package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
  98. package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
  99. package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
  100. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
  101. package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
  102. package/es/ProForm/components/index.js +56 -34
  103. package/es/ProForm/components/render/ChangedWrapper.js +85 -94
  104. package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
  105. package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
  106. package/es/ProForm/components/render/Render.js +223 -329
  107. package/es/ProForm/components/render/RenderFields.js +76 -113
  108. package/es/ProForm/components/render/propsType.js +0 -1
  109. package/es/ProForm/hooks/useControlled.js +8 -10
  110. package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
  111. package/es/ProForm/hooks/useFieldProps.js +8 -4
  112. package/es/ProForm/hooks/useForm.js +50 -110
  113. package/es/ProForm/hooks/useRules.js +17 -33
  114. package/es/ProForm/hooks/useShouldUpdate.js +77 -152
  115. package/es/ProForm/hooks/useWatch.js +58 -129
  116. package/es/ProForm/index.js +157 -194
  117. package/es/ProForm/propsType.js +15 -7
  118. package/es/ProForm/utils/buildFormItemProps.js +51 -58
  119. package/es/ProForm/utils/diffOriginal.js +43 -73
  120. package/es/ProForm/utils/getDefaultProps.js +18 -24
  121. package/es/ProForm/utils/index.js +159 -234
  122. package/es/ProForm/utils/processDependencies.js +21 -60
  123. package/es/ProForm/utils/reactiveValues.js +20 -34
  124. package/es/ProForm/utils/rulesCreator.js +42 -40
  125. package/es/ProForm/utils/transformNames.js +10 -13
  126. package/es/ProForm/utils/transformValue.js +16 -29
  127. package/es/ProForm/utils/valueType.js +96 -178
  128. package/es/ProIcon/config/index.js +340 -274
  129. package/es/ProIcon/index.js +135 -209
  130. package/es/ProIcon/propsTypes.js +0 -1
  131. package/es/ProIcon/utils/index.js +24 -39
  132. package/es/ProLayout/components/Layout/Header/index.js +108 -141
  133. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
  134. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +111 -137
  135. package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
  136. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
  137. package/es/ProLayout/components/Layout/Menu/index.js +92 -89
  138. package/es/ProLayout/components/Layout/Notice/index.js +13 -27
  139. package/es/ProLayout/components/Layout/index.js +8 -3
  140. package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
  141. package/es/ProLayout/components/ProCollapse/index.js +89 -111
  142. package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
  143. package/es/ProLayout/components/ProFooter/index.js +27 -25
  144. package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
  145. package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
  146. package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -86
  147. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
  148. package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
  149. package/es/ProLayout/components/ProHeader/components/index.js +6 -2
  150. package/es/ProLayout/components/ProHeader/index.js +216 -356
  151. package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
  152. package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
  153. package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -64
  154. package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
  155. package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
  156. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
  157. package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
  158. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
  159. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
  160. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +290 -408
  161. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +132 -95
  162. package/es/ProLayout/components/TabsManager/index.js +406 -390
  163. package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
  164. package/es/ProLayout/components/TabsManager/utils/historyObserver.js +26 -23
  165. package/es/ProLayout/components/TabsManager/utils/index.js +127 -184
  166. package/es/ProLayout/components/index.js +8 -3
  167. package/es/ProLayout/index.js +171 -229
  168. package/es/ProLayout/propTypes.js +12 -52
  169. package/es/ProLayout/utils/index.js +48 -128
  170. package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
  171. package/es/ProSelect/index.js +184 -229
  172. package/es/ProSelect/propsType.js +0 -1
  173. package/es/ProSelect/utils/index.js +100 -146
  174. package/es/ProStep/components/Anchor/index.js +71 -82
  175. package/es/ProStep/components/Item/index.js +49 -56
  176. package/es/ProStep/components/LazyLoad/index.js +23 -29
  177. package/es/ProStep/components/Listener/index.js +20 -33
  178. package/es/ProStep/components/Step/index.js +31 -38
  179. package/es/ProStep/constants.js +4 -1
  180. package/es/ProStep/index.js +166 -153
  181. package/es/ProStep/propsType.js +0 -1
  182. package/es/ProStep/utils/index.js +29 -55
  183. package/es/ProStepTab/index.js +83 -138
  184. package/es/ProStepTab/propsType.js +0 -1
  185. package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
  186. package/es/ProTable/components/EditableCell/index.js +37 -71
  187. package/es/ProTable/components/EditableCell/propsType.js +0 -1
  188. package/es/ProTable/components/FormatColumn/index.js +209 -340
  189. package/es/ProTable/components/FormatColumn/propsType.js +0 -1
  190. package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
  191. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
  192. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
  193. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
  194. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
  195. package/es/ProTable/components/RcTable/index.js +6 -4
  196. package/es/ProTable/components/RenderColumn/index.js +158 -186
  197. package/es/ProTable/components/RenderEmptyText/index.js +12 -21
  198. package/es/ProTable/components/RenderFooter/index.js +15 -15
  199. package/es/ProTable/components/RenderSummary/index.js +33 -50
  200. package/es/ProTable/components/RenderTableHeader/index.js +44 -46
  201. package/es/ProTable/components/RenderTabs/index.js +47 -51
  202. package/es/ProTable/components/TableResizable/index.js +56 -72
  203. package/es/ProTable/components/TooltipTitle/index.js +13 -21
  204. package/es/ProTable/components/index.js +16 -36
  205. package/es/ProTable/hooks/useAntdTable.js +185 -219
  206. package/es/ProTable/index.js +232 -249
  207. package/es/ProTable/propsType.js +0 -1
  208. package/es/ProTable/utils/columnStorage.js +63 -88
  209. package/es/ProTable/utils/index.js +57 -90
  210. package/es/ProTabs/components/Card/index.js +20 -48
  211. package/es/ProTabs/components/index.js +4 -1
  212. package/es/ProTabs/index.js +39 -56
  213. package/es/ProTabs/propType.js +0 -1
  214. package/es/ProThemeTools/component/ProTools/index.js +106 -158
  215. package/es/ProThemeTools/component/index.js +4 -1
  216. package/es/ProThemeTools/context/ThemeContext.js +67 -146
  217. package/es/ProThemeTools/index.js +103 -156
  218. package/es/ProThemeTools/propsType.js +0 -1
  219. package/es/ProThemeTools/utils/index.js +60 -109
  220. package/es/ProTooltip/index.js +132 -165
  221. package/es/ProTooltip/propsType.js +0 -1
  222. package/es/ProTree/components/AdaptiveTooltip.js +15 -17
  223. package/es/ProTree/components/CloseIcon.js +18 -26
  224. package/es/ProTree/components/List.js +28 -47
  225. package/es/ProTree/components/ProTree.js +152 -211
  226. package/es/ProTree/components/ProTreeSelect/index.js +254 -458
  227. package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
  228. package/es/ProTree/components/SearchTitle.js +23 -42
  229. package/es/ProTree/components/Tree.js +147 -195
  230. package/es/ProTree/components/index.js +10 -5
  231. package/es/ProTree/index.js +12 -16
  232. package/es/ProTree/propsType.js +0 -1
  233. package/es/ProTree/utils.js +46 -118
  234. package/es/ProTreeModal/components/Cascader.js +56 -64
  235. package/es/ProTreeModal/components/CloseIcon.js +18 -26
  236. package/es/ProTreeModal/components/List.js +114 -180
  237. package/es/ProTreeModal/components/SearchTitle.js +15 -18
  238. package/es/ProTreeModal/components/SortableItem.js +29 -58
  239. package/es/ProTreeModal/components/Tree.js +99 -113
  240. package/es/ProTreeModal/components/Trigger.js +87 -121
  241. package/es/ProTreeModal/components/index.js +14 -6
  242. package/es/ProTreeModal/index.js +397 -435
  243. package/es/ProTreeModal/propsType.js +0 -1
  244. package/es/ProTreeModal/utils.js +52 -95
  245. package/es/ProUpload/components/ButtonRender.js +44 -54
  246. package/es/ProUpload/components/DragRender.js +94 -134
  247. package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
  248. package/es/ProUpload/components/Example.js +27 -31
  249. package/es/ProUpload/components/FileItem.js +69 -163
  250. package/es/ProUpload/components/ImageRender.js +134 -170
  251. package/es/ProUpload/index.js +68 -100
  252. package/es/ProUpload/propsType.js +0 -1
  253. package/es/ProUpload/uitls.js +8 -4
  254. package/es/ProUtils/utils/index.js +17 -13
  255. package/es/ProViewer/index.js +154 -175
  256. package/es/ProViewer/propsType.js +0 -5
  257. package/es/ProWaterMark/index.js +9 -16
  258. package/es/ProWaterMark/propsType.js +0 -1
  259. package/es/hooks/useDraggableRow.js +25 -53
  260. package/es/index.js +57 -77
  261. package/es/locale/en_US.js +153 -142
  262. package/es/locale/index.js +23 -36
  263. package/es/locale/zh_CN.js +145 -142
  264. package/es/tokens.js +84 -83
  265. package/es/utils/index.js +24 -51
  266. package/package.json +4 -3
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +1,31 @@
1
- import _isFunction from "lodash/isFunction";
2
- import _isEqualWith from "lodash/isEqualWith";
3
- import _isEqual from "lodash/isEqual";
4
- import _get from "lodash/get";
1
+ import get from "lodash/get";
2
+ import isEqual from "lodash/isEqual";
3
+ import isEqualWith from "lodash/isEqualWith";
4
+ import isFunction from "lodash/isFunction";
5
5
  import { customEqualForFunction } from "../../../utils";
6
6
  import { getNamePath, isRecordShallowEqual } from "../../utils/tools";
7
- const ROW_FUNCTION_DEPENDENCY_KEYS = ['component', 'editRender', 'fieldProps', 'rules', 'required', 'disabled', 'isEditable', 'valueType', 'viewRender'];
8
-
9
- /** 判断列是否包含可能依赖整行数据的函数型配置。 */
10
- export const hasRowFunctionDependency = column => ROW_FUNCTION_DEPENDENCY_KEYS.some(key => _isFunction(column?.[key]));
11
-
12
- /**
13
- * 将 onFieldChange 中原地修改的字段合并到最新 Form Store 行。
14
- * Store 若已将同一字段显式写成其他值,则保留 Store 值。
15
- */
16
- export const mergeOnFieldChangeRow = (beforeRow, mutatedRow, latestStoreRow) => {
7
+ const ROW_FUNCTION_DEPENDENCY_KEYS = [
8
+ "component",
9
+ "editRender",
10
+ "fieldProps",
11
+ "rules",
12
+ "required",
13
+ "disabled",
14
+ "isEditable",
15
+ "valueType",
16
+ "viewRender"
17
+ ];
18
+ const hasRowFunctionDependency = (column) => ROW_FUNCTION_DEPENDENCY_KEYS.some((key) => isFunction(column == null ? void 0 : column[key]));
19
+ const mergeOnFieldChangeRow = (beforeRow, mutatedRow, latestStoreRow) => {
17
20
  const before = beforeRow || {};
18
21
  const mutated = mutatedRow || {};
19
22
  const latest = latestStoreRow || {};
20
- const changedKeys = Array.from(new Set([...Object.keys(before), ...Object.keys(mutated)])).filter(key => !_isEqual(before[key], mutated[key]));
23
+ const changedKeys = Array.from(/* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(mutated)])).filter(
24
+ (key) => !isEqual(before[key], mutated[key])
25
+ );
21
26
  let nextRow = latest;
22
- changedKeys.forEach(key => {
23
- const storeChangedExplicitly = !_isEqual(latest[key], before[key]) && !_isEqual(latest[key], mutated[key]);
27
+ changedKeys.forEach((key) => {
28
+ const storeChangedExplicitly = !isEqual(latest[key], before[key]) && !isEqual(latest[key], mutated[key]);
24
29
  if (!storeChangedExplicitly) {
25
30
  nextRow = {
26
31
  ...nextRow,
@@ -30,25 +35,38 @@ export const mergeOnFieldChangeRow = (beforeRow, mutatedRow, latestStoreRow) =>
30
35
  });
31
36
  return nextRow;
32
37
  };
33
-
34
- /** 列配置中不应透传到 Form.Item 或 DOM 的字段(与 ProForm Render 保持一致) */
35
- export const OMIT_FORM_ITEM_AND_DOM_KEYS = ['format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow', 'dependNames', 'shouldCellUpdate' // 表格内部性能优化属性,不应传递给 Form.Item
38
+ const OMIT_FORM_ITEM_AND_DOM_KEYS = [
39
+ "format",
40
+ "toISOString",
41
+ "toCSTString",
42
+ "switchValue",
43
+ "precision",
44
+ "clearNotShow",
45
+ "dependNames",
46
+ "shouldCellUpdate"
47
+ // 表格内部性能优化属性,不应传递给 Form.Item
48
+ ];
49
+ const OMIT_FROM_DOM_KEYS = [
50
+ "disabled",
51
+ // div 不支持 disabled,且值可能非 string/number
52
+ "toCSTString",
53
+ "toISOString",
54
+ "format",
55
+ "switchValue",
56
+ "precision",
57
+ "clearNotShow",
58
+ "dependNames"
36
59
  ];
37
-
38
- /** 克隆子元素时需从 props 中剔除,避免透传到 div 等 DOM 导致 React 警告 */
39
- export const OMIT_FROM_DOM_KEYS = ['disabled',
40
- // div 不支持 disabled,且值可能非 string/number
41
- 'toCSTString', 'toISOString', 'format', 'switchValue', 'precision', 'clearNotShow', 'dependNames'];
42
- export const toNamePath = name => {
60
+ const toNamePath = (name) => {
43
61
  if (Array.isArray(name)) {
44
62
  return name;
45
63
  }
46
64
  return [name];
47
65
  };
48
- export const toNamePaths = names => {
49
- return names.map(name => toNamePath(name));
66
+ const toNamePaths = (names) => {
67
+ return names.map((name) => toNamePath(name));
50
68
  };
51
- export const getOriginalValue = ({
69
+ const getOriginalValue = ({
52
70
  namePath,
53
71
  originalName,
54
72
  originalNames,
@@ -57,32 +75,31 @@ export const getOriginalValue = ({
57
75
  form
58
76
  }) => {
59
77
  if (!originalValues) {
60
- return undefined;
78
+ return void 0;
61
79
  }
62
80
  let originRecord;
63
81
  if (rowKeyPath) {
64
- const rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
65
- const rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
66
-
82
+ const rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1);
83
+ const rowKeyName = rowKeyPath[rowKeyPath.length - 1];
67
84
  const rowValue = form.getFieldValue(rowValueNamePath);
68
- if (!rowValue) return undefined;
69
- const keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
70
- if (!keyValue) return undefined;
71
- const originalValueList = _get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
72
- originRecord = originalValueList?.find(item => {
85
+ if (!rowValue)
86
+ return void 0;
87
+ const keyValue = rowValue[rowKeyName];
88
+ if (!keyValue)
89
+ return void 0;
90
+ const originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
91
+ originRecord = originalValueList == null ? void 0 : originalValueList.find((item) => {
73
92
  return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
74
93
  });
75
94
  let originalValue;
76
- if (originalNames?.length) {
77
- const originalNamesValue = originalNames.map(originalName => {
78
- return _get(originRecord, originalName.slice(rowKeyPath.length - 1));
95
+ if (originalNames == null ? void 0 : originalNames.length) {
96
+ const originalNamesValue = originalNames.map((originalName2) => {
97
+ return get(originRecord, originalName2.slice(rowKeyPath.length - 1));
79
98
  });
80
-
81
- // 有可能出现数组中全是undefined的情况 视为没有值
82
- const fillUndefined = originalNamesValue.every(valItem => valItem === undefined);
83
- originalValue = fillUndefined ? undefined : originalNamesValue;
99
+ const fillUndefined = originalNamesValue.every((valItem) => valItem === void 0);
100
+ originalValue = fillUndefined ? void 0 : originalNamesValue;
84
101
  } else {
85
- originalValue = _get(originRecord, originalName.slice(rowKeyPath.length - 1));
102
+ originalValue = get(originRecord, originalName.slice(rowKeyPath.length - 1));
86
103
  }
87
104
  return {
88
105
  originalValue,
@@ -90,19 +107,12 @@ export const getOriginalValue = ({
90
107
  record: rowValue
91
108
  };
92
109
  }
93
-
94
- // 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
95
110
  return {
96
- originalValue: originalNames?.length ? originalNames.map(originalName => _get(originalValues, originalName)) : _get(originalValues, originalName),
111
+ originalValue: (originalNames == null ? void 0 : originalNames.length) ? originalNames.map((originalName2) => get(originalValues, originalName2)) : get(originalValues, originalName),
97
112
  originRecord
98
113
  };
99
114
  };
100
-
101
- /**
102
- * memo 自定义比较函数:只有关键 props 变化时才重新渲染。
103
- * 从 RenderField 拆出,行为与原内联实现保持一致。
104
- */
105
- export const arePropsEqual = (prevProps, nextProps) => {
115
+ const arePropsEqual = (prevProps, nextProps) => {
106
116
  const {
107
117
  text: prevText,
108
118
  record: prevRecord,
@@ -117,106 +127,99 @@ export const arePropsEqual = (prevProps, nextProps) => {
117
127
  column: nextColumn,
118
128
  config: nextConfig
119
129
  } = nextProps;
120
-
121
- // 函数型动态属性(component/editRender/fieldProps/rules/required/disabled/isEditable/valueType/viewRender)
122
- // 可能依赖行内兄弟字段;行对象为同引用(原地修改)时,浅比较无法区分,需强制重渲染
123
130
  const hasFunctionDependency = hasRowFunctionDependency(prevColumn) || hasRowFunctionDependency(nextColumn);
124
131
  if (hasFunctionDependency && prevRecord === nextRecord) {
125
132
  return false;
126
133
  }
127
-
128
- // 构建新的参数格式(与 ProForm 保持一致)
129
- const prevNamePath = getNamePath(prevConfig?.name, prevConfig?.virtualKey);
130
- const nextNamePath = getNamePath(nextConfig?.name, nextConfig?.virtualKey);
134
+ const prevNamePath = getNamePath(prevConfig == null ? void 0 : prevConfig.name, prevConfig == null ? void 0 : prevConfig.virtualKey);
135
+ const nextNamePath = getNamePath(nextConfig == null ? void 0 : nextConfig.name, nextConfig == null ? void 0 : nextConfig.virtualKey);
131
136
  const prevReactiveParams = {
132
- form: prevConfig?.form,
137
+ form: prevConfig == null ? void 0 : prevConfig.form,
133
138
  index: prevIndex,
134
139
  namePath: [...prevNamePath, prevIndex]
135
140
  };
136
141
  const nextReactiveParams = {
137
- form: nextConfig?.form,
142
+ form: nextConfig == null ? void 0 : nextConfig.form,
138
143
  index: nextIndex,
139
144
  namePath: [...nextNamePath, nextIndex]
140
145
  };
141
- if (_isFunction(prevColumn?.disabled) && _isFunction(nextColumn?.disabled)) {
142
- if (prevColumn?.disabled(prevRecord, prevReactiveParams) !== nextColumn?.disabled(nextRecord, nextReactiveParams)) {
146
+ if (isFunction(prevColumn == null ? void 0 : prevColumn.disabled) && isFunction(nextColumn == null ? void 0 : nextColumn.disabled)) {
147
+ if ((prevColumn == null ? void 0 : prevColumn.disabled(prevRecord, prevReactiveParams)) !== (nextColumn == null ? void 0 : nextColumn.disabled(nextRecord, nextReactiveParams))) {
143
148
  return false;
144
149
  }
145
150
  }
146
-
147
- // fieldProps 函数化直接更新,无法比对返回值是否一致
148
- // 优化:不直接调用函数,而是比较输入参数(record 和 reactiveParams)
149
- // 如果输入参数相同,fieldProps 的返回值应该相同(纯函数假设)
150
- if (_isFunction(prevColumn?.fieldProps) && _isFunction(nextColumn?.fieldProps)) {
151
- // 比较 record 数据是否变化(浅比较,虚拟滚动性能优化)
151
+ if (isFunction(prevColumn == null ? void 0 : prevColumn.fieldProps) && isFunction(nextColumn == null ? void 0 : nextColumn.fieldProps)) {
152
152
  if (!isRecordShallowEqual(prevRecord, nextRecord)) {
153
153
  return false;
154
154
  }
155
- // reactiveParams 中的 form、index、namePath 已经在外层比较过了,无需重复比较
156
155
  }
157
- // fieldProps 为对象时,必须比较配置变化(如 dataSource 异步更新)
158
- if (!_isFunction(prevColumn?.fieldProps) && !_isFunction(nextColumn?.fieldProps)) {
159
- const isFieldPropsEqual = _isEqualWith(prevColumn?.fieldProps, nextColumn?.fieldProps, customEqualForFunction);
156
+ if (!isFunction(prevColumn == null ? void 0 : prevColumn.fieldProps) && !isFunction(nextColumn == null ? void 0 : nextColumn.fieldProps)) {
157
+ const isFieldPropsEqual = isEqualWith(
158
+ prevColumn == null ? void 0 : prevColumn.fieldProps,
159
+ nextColumn == null ? void 0 : nextColumn.fieldProps,
160
+ customEqualForFunction
161
+ );
160
162
  if (!isFieldPropsEqual) {
161
163
  return false;
162
164
  }
163
165
  }
164
-
165
- // 通用函数比较方法
166
- // 优化:不直接调用函数,而是比较函数引用和输入参数
167
166
  const compareFunctionResult = (prevCol, nextCol, prevValues, nextValues, _prevReactiveParams, _nextReactiveParams, functionName) => {
168
- const prevFunc = prevCol?.[functionName];
169
- const nextFunc = nextCol?.[functionName];
170
- if (_isFunction(prevFunc) && _isFunction(nextFunc)) {
171
- // 函数引用变化说明闭包可能捕获了新的外部状态(如异步加载的 list),必须重渲染
172
- if (prevFunc !== nextFunc) return false;
173
- // 同引用函数,比较输入参数(纯函数假设:输入相同则输出相同)
167
+ const prevFunc = prevCol == null ? void 0 : prevCol[functionName];
168
+ const nextFunc = nextCol == null ? void 0 : nextCol[functionName];
169
+ if (isFunction(prevFunc) && isFunction(nextFunc)) {
170
+ if (prevFunc !== nextFunc)
171
+ return false;
174
172
  return isRecordShallowEqual(prevValues, nextValues);
175
173
  }
176
- return true; // 如果不是函数或只有一个是函数,认为相等
174
+ return true;
177
175
  };
178
-
179
- // 使用简化后的比较逻辑
180
- const functionFields = ['rules', 'component', 'desensitization', 'isEditable', 'required'];
181
- if (functionFields.some(field => !compareFunctionResult(prevColumn, nextColumn, prevRecord, nextRecord, prevReactiveParams, nextReactiveParams, field))) {
176
+ const functionFields = ["rules", "component", "desensitization", "isEditable", "required"];
177
+ if (functionFields.some(
178
+ (field) => !compareFunctionResult(
179
+ prevColumn,
180
+ nextColumn,
181
+ prevRecord,
182
+ nextRecord,
183
+ prevReactiveParams,
184
+ nextReactiveParams,
185
+ field
186
+ )
187
+ )) {
182
188
  return false;
183
189
  }
184
-
185
- // 基本props比较
186
- if (!_isEqual(prevText, nextText) || prevIndex !== nextIndex) {
190
+ if (!isEqual(prevText, nextText) || prevIndex !== nextIndex) {
187
191
  return false;
188
192
  }
189
-
190
- // 记录关键字段比较(避免完整对象比较的性能开销)
191
- if (prevRecord?.rowKey !== nextRecord?.rowKey || prevRecord?._addFlag !== nextRecord?._addFlag) {
193
+ if ((prevRecord == null ? void 0 : prevRecord.rowKey) !== (nextRecord == null ? void 0 : nextRecord.rowKey) || (prevRecord == null ? void 0 : prevRecord._addFlag) !== (nextRecord == null ? void 0 : nextRecord._addFlag)) {
192
194
  return false;
193
195
  }
194
-
195
- // 列配置比较(只比较关键字段),required,disabled为函数时,需要重新计算
196
- if (prevColumn?.dataIndex !== nextColumn?.dataIndex || prevColumn?.type !== nextColumn?.type || prevColumn?.name !== nextColumn?.name) {
196
+ if ((prevColumn == null ? void 0 : prevColumn.dataIndex) !== (nextColumn == null ? void 0 : nextColumn.dataIndex) || (prevColumn == null ? void 0 : prevColumn.type) !== (nextColumn == null ? void 0 : nextColumn.type) || (prevColumn == null ? void 0 : prevColumn.name) !== (nextColumn == null ? void 0 : nextColumn.name)) {
197
197
  return false;
198
198
  }
199
-
200
- // config中关键字段比较
201
- if (prevConfig?._isEditing !== nextConfig?._isEditing || prevConfig?.mode !== nextConfig?.mode) {
199
+ if ((prevConfig == null ? void 0 : prevConfig._isEditing) !== (nextConfig == null ? void 0 : nextConfig._isEditing) || (prevConfig == null ? void 0 : prevConfig.mode) !== (nextConfig == null ? void 0 : nextConfig.mode)) {
202
200
  return false;
203
201
  }
204
-
205
- // 当前单元格的值比较
206
- const prevDataIndex = prevColumn?.dataIndex;
207
- const nextDataIndex = nextColumn?.dataIndex;
202
+ const prevDataIndex = prevColumn == null ? void 0 : prevColumn.dataIndex;
203
+ const nextDataIndex = nextColumn == null ? void 0 : nextColumn.dataIndex;
208
204
  if (prevDataIndex && nextDataIndex && prevDataIndex === nextDataIndex) {
209
- if (prevRecord?.[prevDataIndex] !== nextRecord?.[nextDataIndex]) {
205
+ if ((prevRecord == null ? void 0 : prevRecord[prevDataIndex]) !== (nextRecord == null ? void 0 : nextRecord[nextDataIndex])) {
210
206
  return false;
211
207
  }
212
208
  }
213
-
214
- // 特殊处理:当使用自定义 component 函数时,比较整个 record 对象
215
- // 因为自定义组件可能依赖 record 中的其他字段(不只是当前列的 dataIndex)
216
- if (_isFunction(prevColumn?.component) || _isFunction(nextColumn?.component)) {
209
+ if (isFunction(prevColumn == null ? void 0 : prevColumn.component) || isFunction(nextColumn == null ? void 0 : nextColumn.component)) {
217
210
  if (!isRecordShallowEqual(prevRecord, nextRecord)) {
218
211
  return false;
219
212
  }
220
213
  }
221
214
  return true;
222
- };
215
+ };
216
+ export {
217
+ OMIT_FORM_ITEM_AND_DOM_KEYS,
218
+ OMIT_FROM_DOM_KEYS,
219
+ arePropsEqual,
220
+ getOriginalValue,
221
+ hasRowFunctionDependency,
222
+ mergeOnFieldChangeRow,
223
+ toNamePath,
224
+ toNamePaths
225
+ };
@@ -1,38 +1,24 @@
1
- import React from 'react';
2
- import { Space } from 'antd';
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { Space } from "antd";
3
4
  import { actions, defaultBtnNameMap, defaultToolbarKeys } from "../../utils/config";
4
5
  import ActionButton from "../ActionButton";
5
6
  import { getNamePath } from "../../utils/tools";
6
-
7
- // 渲染工具栏
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- const RenderToolbar = config => {
10
- const {
11
- emptyBtnText,
12
- toolbarProps,
13
- name,
14
- virtualKey,
15
- disabled,
16
- tableLength
17
- } = config;
7
+ const RenderToolbar = (config) => {
8
+ const { emptyBtnText, toolbarProps, name, virtualKey, disabled, tableLength } = config;
18
9
  const virtualName = getNamePath(name, virtualKey);
19
- // toolbarProps配置为false 默认不插入
20
10
  if (toolbarProps === false || disabled) {
21
11
  return null;
22
12
  }
23
13
  let nextToolbarProps = [...toolbarProps];
24
14
  if (tableLength) {
25
- // 不设置toolbarProps
26
- if (!toolbarProps?.length) {
27
- nextToolbarProps = defaultToolbarKeys.map(key => {
28
- return {
29
- type: key
30
- };
15
+ if (!(toolbarProps == null ? void 0 : toolbarProps.length)) {
16
+ nextToolbarProps = defaultToolbarKeys.map((key) => {
17
+ return { type: key };
31
18
  });
32
19
  } else {
33
- // 部分设置toolbarProps
34
- defaultToolbarKeys.forEach(key => {
35
- if (!toolbarProps.find(action => action.type === key)) {
20
+ defaultToolbarKeys.forEach((key) => {
21
+ if (!toolbarProps.find((action) => action.type === key)) {
36
22
  nextToolbarProps.push({
37
23
  type: key
38
24
  });
@@ -40,62 +26,46 @@ const RenderToolbar = config => {
40
26
  });
41
27
  }
42
28
  } else {
43
- const addConfig = toolbarProps.find(action => action.type === 'add');
44
- // 需要持久化显示的ToolBar
45
- const persistenceToolBar = toolbarProps.filter(action => action?.persistence);
46
- nextToolbarProps = [{
47
- ...addConfig,
48
- type: 'add',
49
- label: addConfig?.isSelectModal ? addConfig.label : emptyBtnText,
50
- icon: false
51
- }, ...persistenceToolBar];
29
+ const addConfig = toolbarProps.find((action) => action.type === "add");
30
+ const persistenceToolBar = toolbarProps.filter((action) => action == null ? void 0 : action.persistence);
31
+ nextToolbarProps = [
32
+ {
33
+ ...addConfig,
34
+ type: "add",
35
+ label: (addConfig == null ? void 0 : addConfig.isSelectModal) ? addConfig.label : emptyBtnText,
36
+ icon: false
37
+ },
38
+ ...persistenceToolBar
39
+ ];
52
40
  }
53
-
54
- // 渲染操作按钮前处理下默认数据
55
- const toolbarBtns = nextToolbarProps.map(toolbar => {
56
- const {
57
- type,
58
- label,
59
- show,
60
- onHandle,
61
- needConfirm,
62
- onClick,
63
- isSelectModal,
64
- ...buttonProps
65
- } = toolbar;
41
+ const toolbarBtns = nextToolbarProps.map((toolbar) => {
42
+ const { type, label, show, onHandle, needConfirm, onClick, isSelectModal, ...buttonProps } = toolbar;
66
43
  toolbar.isEditable = false;
67
44
  toolbar.label = label ?? defaultBtnNameMap[type];
68
45
  toolbar.show = show ?? true;
69
46
  toolbar.needConfirm = needConfirm ?? true;
70
- toolbar.onEvent = async (record, {
71
- index,
72
- form,
73
- name,
74
- namePath,
75
- tableLength,
76
- selectedRows
77
- }) => {
47
+ toolbar.onEvent = async (record, { index, form, name: name2, namePath, tableLength: tableLength2, selectedRows }) => {
78
48
  const onEvent = onClick || onHandle;
79
49
  let result;
80
50
  if (!onEvent) {
81
51
  result = true;
82
52
  } else {
83
- result = await onEvent?.(record, {
53
+ result = await (onEvent == null ? void 0 : onEvent(record, {
84
54
  index,
85
55
  form,
86
- name,
56
+ name: name2,
87
57
  namePath,
88
- tableLength,
58
+ tableLength: tableLength2,
89
59
  selectedRows
90
- });
60
+ }));
91
61
  }
92
- if (result !== false && type !== 'custom') {
62
+ if (result !== false && type !== "custom") {
93
63
  const actionHandler = actions[type];
94
64
  actionHandler({
95
65
  ...config,
96
66
  index,
97
67
  record,
98
- name,
68
+ name: name2,
99
69
  result,
100
70
  virtualName
101
71
  });
@@ -105,20 +75,24 @@ const RenderToolbar = config => {
105
75
  return toolbar;
106
76
  });
107
77
  const renderToolbarBtns = () => {
108
- return toolbarBtns.map(btnConfig => {
109
- return /*#__PURE__*/_jsx(React.Fragment, {
110
- children: /*#__PURE__*/_jsx(ActionButton, {
111
- config,
112
- btnConfig: {
113
- ...btnConfig,
114
- editingKeys: []
78
+ return toolbarBtns.map((btnConfig) => {
79
+ return /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsx(
80
+ ActionButton,
81
+ {
82
+ ...{
83
+ config,
84
+ btnConfig: {
85
+ ...btnConfig,
86
+ editingKeys: []
87
+ }
115
88
  }
116
- })
117
- }, `${btnConfig?.label}${btnConfig?.type}`);
89
+ }
90
+ ) }, `${btnConfig == null ? void 0 : btnConfig.label}${btnConfig == null ? void 0 : btnConfig.type}`);
118
91
  });
119
92
  };
120
- return /*#__PURE__*/_jsx(Space, {
121
- children: renderToolbarBtns()
122
- });
93
+ return /* @__PURE__ */ jsx(Space, { children: renderToolbarBtns() });
94
+ };
95
+ var RenderToolbar_default = RenderToolbar;
96
+ export {
97
+ RenderToolbar_default as default
123
98
  };
124
- export default RenderToolbar;
@@ -1,89 +1,63 @@
1
- import { Table, Space } from 'antd';
2
- import { tools } from '@zat-design/utils';
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Table, Space } from "antd";
3
+ import { tools } from "@zat-design/utils";
3
4
  import { valueTypeRender } from "../../../ProUtils/utils";
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- const {
6
- calc
7
- } = tools;
8
- const formatSummaryColumns = (columns, {
9
- rowSelection
10
- }) => {
5
+ const { calc } = tools;
6
+ const formatSummaryColumns = (columns, { rowSelection }) => {
11
7
  const nextColumns = [...columns];
12
8
  if (!rowSelection) {
13
- nextColumns.forEach(column => {
14
- column.index = calc(column.index ?? 0, '-', 1);
9
+ nextColumns.forEach((column) => {
10
+ column.index = calc(column.index ?? 0, "-", 1);
15
11
  });
16
12
  }
17
- const {
18
- index: firstIndex
19
- } = nextColumns?.[0] || {};
13
+ const { index: firstIndex } = (nextColumns == null ? void 0 : nextColumns[0]) || {};
20
14
  if (firstIndex !== 0) {
21
- const colSpan = calc(firstIndex ?? 0, '-', 1);
15
+ const colSpan = calc(firstIndex ?? 0, "-", 1);
22
16
  nextColumns.unshift({
23
17
  index: 0,
24
- colSpan: colSpan === 0 ? undefined : colSpan
18
+ colSpan: colSpan === 0 ? void 0 : colSpan
25
19
  });
26
20
  }
27
21
  return nextColumns;
28
22
  };
29
- const Summary = ({
30
- data,
31
- summary,
32
- rowSelection
33
- }) => {
34
- const {
35
- columns,
36
- total = true,
37
- fixed = true
38
- } = summary || {};
39
- const nextColumns = formatSummaryColumns(columns, {
40
- rowSelection
41
- });
42
- const renderCell = item => {
43
- const {
44
- key,
45
- title,
46
- precision,
47
- valueType
48
- } = item;
23
+ const Summary = ({ data, summary, rowSelection }) => {
24
+ const { columns, total = true, fixed = true } = summary || {};
25
+ const nextColumns = formatSummaryColumns(columns, { rowSelection });
26
+ const renderCell = (item) => {
27
+ var _a, _b;
28
+ const { key, title, precision, valueType } = item;
49
29
  if (title) {
50
30
  return title;
51
31
  }
52
32
  if (total && key) {
53
- const format = valueTypeRender?.[valueType];
54
- const sum = data?.reduce?.((pre, cur) => {
55
- return calc(pre, '+', cur[key] ?? 0);
33
+ const format = (_a = valueTypeRender) == null ? void 0 : _a[valueType];
34
+ const sum = (_b = data == null ? void 0 : data.reduce) == null ? void 0 : _b.call(data, (pre, cur) => {
35
+ return calc(pre, "+", cur[key] ?? 0);
56
36
  }, 0);
57
37
  return format ? format(sum, precision ?? 2) : sum;
58
38
  }
59
39
  return null;
60
40
  };
61
-
62
- // 当编辑列表没有数据时,不展示底部合计栏
63
- if (!data?.length) {
41
+ if (!(data == null ? void 0 : data.length)) {
64
42
  return null;
65
43
  }
66
- return /*#__PURE__*/_jsx(Table.Summary, {
67
- fixed: fixed,
68
- children: /*#__PURE__*/_jsx(Table.Summary.Row, {
69
- children: nextColumns.map(item => {
70
- const {
71
- index,
72
- colSpan,
44
+ return /* @__PURE__ */ jsx(Table.Summary, { fixed, children: /* @__PURE__ */ jsx(Table.Summary.Row, { children: nextColumns.map((item) => {
45
+ const { index, colSpan, prefix, key: columnKey } = item;
46
+ return /* @__PURE__ */ jsx(
47
+ Table.Summary.Cell,
48
+ {
49
+ index,
50
+ colSpan,
51
+ children: /* @__PURE__ */ jsxs(Space, { children: [
73
52
  prefix,
74
- key: columnKey
75
- } = item;
76
- return /*#__PURE__*/_jsx(Table.Summary.Cell, {
77
- index: index,
78
- colSpan: colSpan,
79
- children: /*#__PURE__*/_jsxs(Space, {
80
- children: [prefix, /*#__PURE__*/_jsx("span", {
81
- children: renderCell(item)
82
- })]
83
- })
84
- }, columnKey ?? `summary-col-${index}`);
85
- })
86
- })
87
- });
53
+ /* @__PURE__ */ jsx("span", { children: renderCell(item) })
54
+ ] })
55
+ },
56
+ columnKey ?? `summary-col-${index}`
57
+ );
58
+ }) }) });
59
+ };
60
+ var Summary_default = Summary;
61
+ export {
62
+ Summary_default as default
88
63
  };
89
- export default Summary;