@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,33 +1,44 @@
1
- import _set from "lodash/set";
2
- import _isFunction from "lodash/isFunction";
3
- import _isBoolean from "lodash/isBoolean";
4
- import _isArray from "lodash/isArray";
5
- import _get from "lodash/get";
6
- import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
7
- import { useLocalStorageState, useSetState } from 'ahooks';
8
- import { ConfigProvider, Form, Affix } from 'antd';
9
- import { ConfigContext } from 'antd/es/config-provider';
10
- import classnames from 'classnames';
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import React, {
3
+ forwardRef,
4
+ useCallback,
5
+ useEffect,
6
+ useImperativeHandle,
7
+ useMemo,
8
+ useRef
9
+ } from "react";
10
+ import get from "lodash/get";
11
+ import isArray from "lodash/isArray";
12
+ import isBoolean from "lodash/isBoolean";
13
+ import isFunction from "lodash/isFunction";
14
+ import set from "lodash/set";
15
+ import { useLocalStorageState, useSetState } from "ahooks";
16
+ import { ConfigProvider, Form, Affix } from "antd";
17
+ import { ConfigContext } from "antd/es/config-provider";
18
+ import classnames from "classnames";
11
19
  import { transformColumns } from "./utils";
12
20
  import { createErrorStore } from "./utils/validateAll";
13
- import { getRandom, getNamePath, handleScrollToError, onPageCheck, buildTableRowKey } from "./utils/tools";
21
+ import {
22
+ getRandom,
23
+ getNamePath,
24
+ handleScrollToError,
25
+ onPageCheck,
26
+ buildTableRowKey
27
+ } from "./utils/tools";
14
28
  import { Validator, Summary, RenderToolbar } from "./components";
15
29
  import ProForm from "../ProForm";
16
30
  import Empty from "../assets/empty.png";
17
31
  import locale, { formatMessage } from "../locale";
18
32
  import { BaseTable, DraggableTable } from "./components/RcTable";
19
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
20
33
  const EMPTY_VALUE = [];
21
34
  const EMPTY_ACTION_PROPS = [];
22
35
  const EMPTY_TOOLBAR_PROPS = [];
23
-
24
- /** 保留浅层语义相同对象的引用,避免 rest props 每次分配新对象导致整表重算。 */
25
- const useShallowStableObject = value => {
36
+ const useShallowStableObject = (value) => {
26
37
  const valueRef = useRef(value);
27
38
  const previous = valueRef.current;
28
39
  const previousKeys = Object.keys(previous);
29
40
  const nextKeys = Object.keys(value);
30
- const changed = previousKeys.length !== nextKeys.length || nextKeys.some(key => !Object.is(previous[key], value[key]));
41
+ const changed = previousKeys.length !== nextKeys.length || nextKeys.some((key) => !Object.is(previous[key], value[key]));
31
42
  if (changed) {
32
43
  valueRef.current = value;
33
44
  }
@@ -40,12 +51,12 @@ const ProEditTable = ({
40
51
  onDragEnd,
41
52
  className,
42
53
  columns,
43
- mode = 'multiple',
44
- paginationMode = 'normal',
54
+ mode = "multiple",
55
+ paginationMode = "normal",
45
56
  stripe = true,
46
57
  draggable = false,
47
58
  disabled = false,
48
- insertType = 'after',
59
+ insertType = "after",
49
60
  emptyBtnText = locale.ProEditTable.clickAdd,
50
61
  actionWidth,
51
62
  actionProps = EMPTY_ACTION_PROPS,
@@ -65,65 +76,64 @@ const ProEditTable = ({
65
76
  rowDraggable,
66
77
  footerRender,
67
78
  scroll,
68
- actionDirection = 'horizontal',
79
+ actionDirection = "horizontal",
69
80
  diffConfig,
70
81
  ...resetProps
71
82
  }, ref) => {
83
+ var _a, _b, _c, _d, _e, _f, _g;
72
84
  const stableResetProps = useShallowStableObject(resetProps);
73
- // 上下文form
74
85
  const contentForm = Form.useFormInstance();
75
86
  const formFieldProps = ProForm.useFieldProps() || {};
76
87
  const affixRef = useRef(null);
77
- const form = contentForm || formFieldProps?.form || stableResetProps?.form;
78
- let name = formFieldProps?.name || stableResetProps?.name || stableResetProps?.id?.split?.('_');
79
- const shouldUpdateDebounce = formFieldProps?.shouldUpdateDebounce ?? stableResetProps?.shouldUpdateDebounce ?? 200;
80
- const {
81
- isView = false,
82
- viewEmpty = '-',
83
- namePath
84
- } = formFieldProps;
85
-
86
- // 判断是否在formList内
87
- if (namePath?.length) {
88
+ const form = contentForm || (formFieldProps == null ? void 0 : formFieldProps.form) || (stableResetProps == null ? void 0 : stableResetProps.form);
89
+ let name = (formFieldProps == null ? void 0 : formFieldProps.name) || (stableResetProps == null ? void 0 : stableResetProps.name) || ((_b = (_a = stableResetProps == null ? void 0 : stableResetProps.id) == null ? void 0 : _a.split) == null ? void 0 : _b.call(_a, "_"));
90
+ const shouldUpdateDebounce = (formFieldProps == null ? void 0 : formFieldProps.shouldUpdateDebounce) ?? (stableResetProps == null ? void 0 : stableResetProps.shouldUpdateDebounce) ?? 200;
91
+ const { isView = false, viewEmpty = "-", namePath } = formFieldProps;
92
+ if (namePath == null ? void 0 : namePath.length) {
88
93
  name = [...namePath, ...name.slice(1)];
89
- disabled = formFieldProps?.disabled || disabled; // formFieldProps?.disabled可能是函数??
94
+ disabled = (formFieldProps == null ? void 0 : formFieldProps.disabled) || disabled;
90
95
  }
91
- const nameSignature = Array.isArray(name) ? name.join('\u0001') : String(name);
92
- // ProForm 上下文可能每次渲染都生成新的 namePath 数组,按路径语义稳定引用。
96
+ const nameSignature = Array.isArray(name) ? name.join("") : String(name);
93
97
  name = useMemo(() => name, [nameSignature]);
94
98
  const tableRef = useRef(null);
95
- // 虚拟表格错误存储:脱离 antd Field 生命周期持久化真实报错文案,
96
- // 解决滚动卸载后报错丢失(报错常驻)。按表格实例隔离。
97
- const errorStoreRef = useRef(undefined);
99
+ const errorStoreRef = useRef(void 0);
98
100
  if (!errorStoreRef.current) {
99
101
  errorStoreRef.current = createErrorStore();
100
102
  }
101
- // shouldCellUpdate 缓存按表格实例隔离,避免 module-level Map 在多实例间交叉污染
102
103
  const cellCachesRef = useRef({
103
- dataSourceRef: new Map(),
104
- componentRef: new Map(),
105
- listLength: new Map()
104
+ dataSourceRef: /* @__PURE__ */ new Map(),
105
+ componentRef: /* @__PURE__ */ new Map(),
106
+ listLength: /* @__PURE__ */ new Map()
106
107
  });
107
- // const valueChangeRef = useRef<number>(0);
108
- // valueChangeRef.current = 0;
109
-
110
- const {
111
- getPrefixCls
112
- } = React.useContext(ConfigContext);
108
+ const { getPrefixCls } = React.useContext(ConfigContext);
113
109
  const prefixCls = getPrefixCls();
114
- const [themeConfig] = useLocalStorageState('themeConfig');
110
+ const [themeConfig] = useLocalStorageState("themeConfig");
115
111
  const requiredAlign = useMemo(() => {
116
- return themeConfig?.data?.zauiFormAlign ?? configRequiredAlign ?? 'left';
117
- }, [themeConfig?.data?.zauiFormAlign, configRequiredAlign]);
118
- const renderOtherProps = useMemo(() => ({
119
- globalControl: stableResetProps?.otherProps?.globalControl,
120
- formDisabled: stableResetProps?.otherProps?.formDisabled,
121
- desensitizationKey: stableResetProps?.otherProps?.desensitizationKey
122
- }), [stableResetProps?.otherProps?.desensitizationKey, stableResetProps?.otherProps?.formDisabled, stableResetProps?.otherProps?.globalControl]);
123
- const mergedDiffConfig = useMemo(() => ({
124
- ...stableResetProps?.otherProps?.diffConfig,
125
- ...diffConfig
126
- }), [diffConfig, stableResetProps?.otherProps?.diffConfig]);
112
+ var _a2;
113
+ return ((_a2 = themeConfig == null ? void 0 : themeConfig.data) == null ? void 0 : _a2.zauiFormAlign) ?? configRequiredAlign ?? "left";
114
+ }, [(_c = themeConfig == null ? void 0 : themeConfig.data) == null ? void 0 : _c.zauiFormAlign, configRequiredAlign]);
115
+ const renderOtherProps = useMemo(
116
+ () => {
117
+ var _a2, _b2, _c2;
118
+ return {
119
+ globalControl: (_a2 = stableResetProps == null ? void 0 : stableResetProps.otherProps) == null ? void 0 : _a2.globalControl,
120
+ formDisabled: (_b2 = stableResetProps == null ? void 0 : stableResetProps.otherProps) == null ? void 0 : _b2.formDisabled,
121
+ desensitizationKey: (_c2 = stableResetProps == null ? void 0 : stableResetProps.otherProps) == null ? void 0 : _c2.desensitizationKey
122
+ };
123
+ },
124
+ [
125
+ (_d = stableResetProps == null ? void 0 : stableResetProps.otherProps) == null ? void 0 : _d.desensitizationKey,
126
+ (_e = stableResetProps == null ? void 0 : stableResetProps.otherProps) == null ? void 0 : _e.formDisabled,
127
+ (_f = stableResetProps == null ? void 0 : stableResetProps.otherProps) == null ? void 0 : _f.globalControl
128
+ ]
129
+ );
130
+ const mergedDiffConfig = useMemo(
131
+ () => {
132
+ var _a2;
133
+ return { ...(_a2 = stableResetProps == null ? void 0 : stableResetProps.otherProps) == null ? void 0 : _a2.diffConfig, ...diffConfig };
134
+ },
135
+ [diffConfig, (_g = stableResetProps == null ? void 0 : stableResetProps.otherProps) == null ? void 0 : _g.diffConfig]
136
+ );
127
137
  const [state, setState] = useSetState({
128
138
  forceUpdate: {},
129
139
  // 表格内部强制刷新开关
@@ -133,223 +143,275 @@ const ProEditTable = ({
133
143
  // 当前选中行的row-key集合
134
144
  selectedRows: [],
135
145
  // 当前选中行的row-key集合
136
- virtualKey: mode === 'single' ? getRandom() : '',
146
+ virtualKey: mode === "single" ? getRandom() : "",
137
147
  // 单行编辑生成个随机formItem的key
138
148
  page: {
139
149
  pageNum: 1,
140
- pageSize: pagination?.pageSize || 10
150
+ pageSize: (pagination == null ? void 0 : pagination.pageSize) || 10
141
151
  }
142
152
  });
143
- const {
144
- forceUpdate,
145
- editingKeys,
146
- virtualKey,
147
- selectedRowKeys,
148
- selectedRows,
149
- page
150
- } = state;
153
+ const { forceUpdate, editingKeys, virtualKey, selectedRowKeys, selectedRows, page } = state;
151
154
  const paginationEnabled = Boolean(pagination);
152
- const paginationValidationEnabled = paginationEnabled && paginationMode === 'validate';
153
- const paginationConfig = typeof pagination === 'object' ? pagination : undefined;
154
- const resolvedPage = useMemo(() => ({
155
- pageNum: paginationConfig?.current ?? page.pageNum,
156
- pageSize: paginationConfig?.pageSize ?? page.pageSize
157
- }), [page.pageNum, page.pageSize, paginationConfig?.current, paginationConfig?.pageSize]);
158
- const mergedSelectedRowKeys = rowSelection?.selectedRowKeys ?? selectedRowKeys;
159
- const virtualRowName = useMemo(() => getNamePath(_isArray(name) ? name : [name], virtualKey), [name, virtualKey]);
160
-
161
- // 样式处理
155
+ const paginationValidationEnabled = paginationEnabled && paginationMode === "validate";
156
+ const paginationConfig = typeof pagination === "object" ? pagination : void 0;
157
+ const resolvedPage = useMemo(
158
+ () => ({
159
+ pageNum: (paginationConfig == null ? void 0 : paginationConfig.current) ?? page.pageNum,
160
+ pageSize: (paginationConfig == null ? void 0 : paginationConfig.pageSize) ?? page.pageSize
161
+ }),
162
+ [page.pageNum, page.pageSize, paginationConfig == null ? void 0 : paginationConfig.current, paginationConfig == null ? void 0 : paginationConfig.pageSize]
163
+ );
164
+ const mergedSelectedRowKeys = (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) ?? selectedRowKeys;
165
+ const virtualRowName = useMemo(
166
+ () => getNamePath(isArray(name) ? name : [name], virtualKey),
167
+ [name, virtualKey]
168
+ );
162
169
  const _className = classnames({
163
- 'pro-edit-table': true,
164
- 'pro-edit-table-drag': draggable,
165
- 'pro-table-no-stripe': !stripe,
170
+ "pro-edit-table": true,
171
+ "pro-edit-table-drag": draggable,
172
+ "pro-table-no-stripe": !stripe,
166
173
  className
167
174
  });
168
- const getRowKey = useCallback(record => {
169
- let key = record.rowKey || getRandom();
170
- if (rowKey) {
171
- const userKey = _isFunction(rowKey) ? rowKey(record) : record[rowKey];
172
- // 检查用户返回的 key 是否有效(不是 null、undefined、NaN 或空字符串)
173
- if (userKey != null && !Number.isNaN(userKey) && userKey !== '') {
174
- key = userKey;
175
+ const getRowKey = useCallback(
176
+ (record) => {
177
+ let key = record.rowKey || getRandom();
178
+ if (rowKey) {
179
+ const userKey = isFunction(rowKey) ? rowKey(record) : record[rowKey];
180
+ if (userKey != null && !Number.isNaN(userKey) && userKey !== "") {
181
+ key = userKey;
182
+ }
175
183
  }
176
- }
177
- return String(key); // 确保返回字符串
178
- }, [rowKey]);
184
+ return String(key);
185
+ },
186
+ [rowKey]
187
+ );
179
188
  const originalValues = useMemo(() => {
189
+ var _a2, _b2, _c2;
180
190
  let nextOriginalValues;
181
- // 原始值也需要设置对应的rowkey,后续比对通过rowkey对比
182
- const originalArr = _get(stableResetProps?.originalValues, name);
183
- const isOriginalAllHasKey = originalArr ? originalArr?.every?.(item => item.rowKey) : true;
184
- const isNeedCoverOriginal = originalArr?.some?.(item => item.rowKey !== getRowKey(item));
185
- // 初始化默认生成row-key
186
- if (originalArr?.length && (!isOriginalAllHasKey || isNeedCoverOriginal)) {
187
- originalArr?.forEach?.(item => {
191
+ const originalArr = get(stableResetProps == null ? void 0 : stableResetProps.originalValues, name);
192
+ const isOriginalAllHasKey = originalArr ? (_a2 = originalArr == null ? void 0 : originalArr.every) == null ? void 0 : _a2.call(originalArr, (item) => item.rowKey) : true;
193
+ const isNeedCoverOriginal = (_b2 = originalArr == null ? void 0 : originalArr.some) == null ? void 0 : _b2.call(originalArr, (item) => item.rowKey !== getRowKey(item));
194
+ if ((originalArr == null ? void 0 : originalArr.length) && (!isOriginalAllHasKey || isNeedCoverOriginal)) {
195
+ (_c2 = originalArr == null ? void 0 : originalArr.forEach) == null ? void 0 : _c2.call(originalArr, (item) => {
188
196
  item.rowKey = getRowKey(item);
189
197
  });
190
198
  }
191
- if (originalArr?.length) {
199
+ if (originalArr == null ? void 0 : originalArr.length) {
192
200
  nextOriginalValues = {};
193
- _set(nextOriginalValues, name, originalArr);
201
+ set(nextOriginalValues, name, originalArr);
194
202
  }
195
203
  return nextOriginalValues;
196
- }, [getRowKey, name, stableResetProps?.originalValues]);
197
- const getIsNew = useCallback(record => {
198
- const originalArr = _get(originalValues, name);
199
- if (!originalArr?.length) {
200
- return false;
201
- }
202
- return !originalArr?.find?.(item => getRowKey(item) === getRowKey(record));
203
- }, [getRowKey, originalValues, name]);
204
-
205
- // 分页变更
206
- const handlePageChange = useCallback(async (current, pageSize) => {
207
- if (!paginationEnabled) return;
208
- const isPageSizeChange = pageSize !== resolvedPage.pageSize;
209
- if (paginationValidationEnabled && !isPageSizeChange) {
210
- try {
211
- await form.validateFields([name], {
212
- recursive: true
213
- });
214
- } catch (error) {
215
- handleScrollToError();
204
+ }, [getRowKey, name, stableResetProps == null ? void 0 : stableResetProps.originalValues]);
205
+ const getIsNew = useCallback(
206
+ (record) => {
207
+ var _a2;
208
+ const originalArr = get(originalValues, name);
209
+ if (!(originalArr == null ? void 0 : originalArr.length)) {
210
+ return false;
211
+ }
212
+ return !((_a2 = originalArr == null ? void 0 : originalArr.find) == null ? void 0 : _a2.call(originalArr, (item) => getRowKey(item) === getRowKey(record)));
213
+ },
214
+ [getRowKey, originalValues, name]
215
+ );
216
+ const handlePageChange = useCallback(
217
+ async (current, pageSize) => {
218
+ var _a2;
219
+ if (!paginationEnabled)
216
220
  return;
221
+ const isPageSizeChange = pageSize !== resolvedPage.pageSize;
222
+ if (paginationValidationEnabled && !isPageSizeChange) {
223
+ try {
224
+ await form.validateFields([name], { recursive: true });
225
+ } catch (error) {
226
+ handleScrollToError();
227
+ return;
228
+ }
217
229
  }
218
- }
219
- setState({
220
- page: {
221
- pageNum: current,
222
- pageSize: pageSize ?? resolvedPage.pageSize
230
+ setState({
231
+ page: {
232
+ pageNum: current,
233
+ pageSize: pageSize ?? resolvedPage.pageSize
234
+ }
235
+ });
236
+ (_a2 = paginationConfig == null ? void 0 : paginationConfig.onChange) == null ? void 0 : _a2.call(paginationConfig, current, pageSize);
237
+ },
238
+ [
239
+ form,
240
+ name,
241
+ paginationConfig == null ? void 0 : paginationConfig.onChange,
242
+ paginationEnabled,
243
+ paginationValidationEnabled,
244
+ resolvedPage.pageSize
245
+ ]
246
+ );
247
+ const config = useMemo(
248
+ () => ({
249
+ form,
250
+ mode,
251
+ isView,
252
+ viewEmpty,
253
+ disabled,
254
+ forceUpdate,
255
+ insertType,
256
+ emptyBtnText,
257
+ editingKeys,
258
+ actionWidth,
259
+ actionProps,
260
+ toolbarProps,
261
+ setState,
262
+ selectedRowKeys: mergedSelectedRowKeys,
263
+ selectedRows,
264
+ onlyOneLineMsg,
265
+ deletePoConfirmMsg,
266
+ mulDeletePoConfirmMsg,
267
+ virtualKey,
268
+ requiredAlign,
269
+ name: isArray(name) ? name : [name],
270
+ // name需要处理成namePath形式,为兼容多路径
271
+ namePath,
272
+ columns,
273
+ // 原始列配置:供单元格变更后按所属列(含 names 合并名)重校验/清理常驻报错
274
+ tableRef,
275
+ max,
276
+ tableLength: value == null ? void 0 : value.length,
277
+ page: resolvedPage,
278
+ originalValues,
279
+ errorStore: errorStoreRef.current,
280
+ prefixCls,
281
+ rowDisabled,
282
+ actionDirection,
283
+ diffConfig: mergedDiffConfig,
284
+ shouldUpdateDebounce,
285
+ getIsNew,
286
+ handlePageChange,
287
+ validateTrigger: stableResetProps == null ? void 0 : stableResetProps.validateTrigger,
288
+ validateMessages: stableResetProps == null ? void 0 : stableResetProps.validateMessages,
289
+ virtual: stableResetProps == null ? void 0 : stableResetProps.virtual,
290
+ otherProps: renderOtherProps
291
+ }),
292
+ [
293
+ actionDirection,
294
+ actionProps,
295
+ actionWidth,
296
+ columns,
297
+ deletePoConfirmMsg,
298
+ diffConfig,
299
+ editingKeys,
300
+ emptyBtnText,
301
+ form,
302
+ // forceUpdate 不应该作为依赖项,因为它是触发刷新的信号,而非用于比较的数据
303
+ getIsNew,
304
+ handlePageChange,
305
+ insertType,
306
+ isView,
307
+ max,
308
+ mergedDiffConfig,
309
+ mode,
310
+ mulDeletePoConfirmMsg,
311
+ name,
312
+ namePath,
313
+ onlyOneLineMsg,
314
+ originalValues,
315
+ prefixCls,
316
+ requiredAlign,
317
+ renderOtherProps,
318
+ rowDisabled,
319
+ mergedSelectedRowKeys,
320
+ selectedRows,
321
+ shouldUpdateDebounce,
322
+ stableResetProps == null ? void 0 : stableResetProps.validateMessages,
323
+ stableResetProps == null ? void 0 : stableResetProps.validateTrigger,
324
+ stableResetProps == null ? void 0 : stableResetProps.virtual,
325
+ tableRef,
326
+ toolbarProps,
327
+ value == null ? void 0 : value.length,
328
+ viewEmpty,
329
+ virtualKey,
330
+ resolvedPage
331
+ ]
332
+ );
333
+ const _rowClassName = useCallback(
334
+ (record) => {
335
+ const isEdit = !virtualKey || editingKeys.includes(record.rowKey);
336
+ const rowClassName = isEdit ? "is-editing" : "";
337
+ if (getIsNew(record)) {
338
+ return `is-new-row ${rowClassName}`;
223
339
  }
224
- });
225
- paginationConfig?.onChange?.(current, pageSize);
226
- }, [form, name, paginationConfig?.onChange, paginationEnabled, paginationValidationEnabled, resolvedPage.pageSize]);
227
- const config = useMemo(() => ({
228
- form,
229
- mode,
230
- isView,
231
- viewEmpty,
232
- disabled,
233
- forceUpdate,
234
- insertType,
235
- emptyBtnText,
236
- editingKeys,
237
- actionWidth,
238
- actionProps,
239
- toolbarProps,
240
- setState,
241
- selectedRowKeys: mergedSelectedRowKeys,
242
- selectedRows,
243
- onlyOneLineMsg,
244
- deletePoConfirmMsg,
245
- mulDeletePoConfirmMsg,
246
- virtualKey,
247
- requiredAlign,
248
- name: _isArray(name) ? name : [name],
249
- // name需要处理成namePath形式,为兼容多路径
250
- namePath,
251
- columns,
252
- // 原始列配置:供单元格变更后按所属列(含 names 合并名)重校验/清理常驻报错
253
- tableRef,
254
- max,
255
- tableLength: value?.length,
256
- page: resolvedPage,
257
- originalValues,
258
- errorStore: errorStoreRef.current,
259
- prefixCls,
260
- rowDisabled,
261
- actionDirection,
262
- diffConfig: mergedDiffConfig,
263
- shouldUpdateDebounce,
264
- getIsNew,
265
- handlePageChange,
266
- validateTrigger: stableResetProps?.validateTrigger,
267
- validateMessages: stableResetProps?.validateMessages,
268
- virtual: stableResetProps?.virtual,
269
- otherProps: renderOtherProps
270
- }), [actionDirection, actionProps, actionWidth, columns, deletePoConfirmMsg, diffConfig, editingKeys, emptyBtnText, form,
271
- // forceUpdate 不应该作为依赖项,因为它是触发刷新的信号,而非用于比较的数据
272
- getIsNew, handlePageChange, insertType, isView, max, mergedDiffConfig, mode, mulDeletePoConfirmMsg, name, namePath, onlyOneLineMsg, originalValues, prefixCls, requiredAlign, renderOtherProps, rowDisabled, mergedSelectedRowKeys, selectedRows, shouldUpdateDebounce, stableResetProps?.validateMessages, stableResetProps?.validateTrigger, stableResetProps?.virtual, tableRef, toolbarProps, value?.length, viewEmpty, virtualKey, resolvedPage]);
273
-
274
- // 编辑行设置下样式
275
- const _rowClassName = useCallback(record => {
276
- const isEdit = !virtualKey || editingKeys.includes(record.rowKey);
277
- const rowClassName = isEdit ? 'is-editing' : '';
278
- if (getIsNew(record)) {
279
- return `is-new-row ${rowClassName}`;
280
- }
281
- return rowClassName;
282
- }, [editingKeys, getIsNew, virtualKey]);
283
-
284
- // 判断是否禁止添加、批量删除
285
- const isForbiddenBtn = useCallback(type => {
286
- // 当工具栏不渲染时,都不渲染
287
- if (toolbarProps === false) {
288
- return true;
289
- }
290
- // 通过配置项配置show 为 false 开启关闭添加与批量删除
291
- if (Array.isArray(toolbarProps)) {
292
- const addBtnConfig = toolbarProps?.find(item => item.type === type);
293
- if (_isFunction(addBtnConfig?.show)) {
294
- const result = addBtnConfig.show();
295
- addBtnConfig.show = result;
340
+ return rowClassName;
341
+ },
342
+ [editingKeys, getIsNew, virtualKey]
343
+ );
344
+ const isForbiddenBtn = useCallback(
345
+ (type) => {
346
+ if (toolbarProps === false) {
347
+ return true;
296
348
  }
297
- return addBtnConfig?.show === false;
298
- }
299
- return false;
300
- }, [toolbarProps]);
301
-
302
- // 是否隐藏勾选框
303
- const isHideCheckBox = !rowSelection && isForbiddenBtn('mulDelete');
304
-
305
- // 复选框
306
- const _rowSelection = useMemo(() => ({
307
- fixed: true,
308
- columnWidth: 48,
309
- getCheckboxProps: record => {
310
- if (rowDisabled) {
311
- const _disabled = rowDisabled(record);
312
- return {
313
- disabled: _disabled
314
- };
349
+ if (Array.isArray(toolbarProps)) {
350
+ const addBtnConfig = toolbarProps == null ? void 0 : toolbarProps.find((item) => item.type === type);
351
+ if (isFunction(addBtnConfig == null ? void 0 : addBtnConfig.show)) {
352
+ const result = addBtnConfig.show();
353
+ addBtnConfig.show = result;
354
+ }
355
+ return (addBtnConfig == null ? void 0 : addBtnConfig.show) === false;
315
356
  }
316
- return {};
357
+ return false;
317
358
  },
318
- hideSelectAll: isHideCheckBox,
319
- ...rowSelection,
320
- selectedRowKeys: mergedSelectedRowKeys,
321
- onChange: (nextSelectedRowKeys, nextSelectedRows, info) => {
322
- setState({
323
- selectedRowKeys: nextSelectedRowKeys,
324
- selectedRows: nextSelectedRows
325
- });
326
- rowSelection?.onChange?.(nextSelectedRowKeys, nextSelectedRows, info);
327
- }
328
- }), [isHideCheckBox, mergedSelectedRowKeys, rowDisabled, rowSelection, setState]);
329
-
330
- // 空列表状态
331
- const emptyDom = useMemo(() => () => /*#__PURE__*/_jsxs("div", {
332
- className: "com-empty",
333
- children: [/*#__PURE__*/_jsx("img", {
334
- className: "img",
335
- src: Empty,
336
- alt: "Empty"
337
- }), /*#__PURE__*/_jsx("div", {
338
- className: "content",
339
- children: disabled || isForbiddenBtn('add') ? locale.ProEditTable.noData : /*#__PURE__*/_jsxs(_Fragment, {
340
- children: [locale.ProEditTable.noData, "\uFF0C", /*#__PURE__*/_jsx(RenderToolbar, {
341
- ...config,
342
- toolbarProps: toolbarProps?.filter?.(item => item.type === 'add' || item?.persistence),
343
- dataSource: []
344
- })]
345
- })
346
- })]
347
- }), [config, disabled, isForbiddenBtn, toolbarProps]);
348
-
349
- /**
350
- * 渲染表格选择器
351
- * @returns rowSelection
352
- */
359
+ [toolbarProps]
360
+ );
361
+ const isHideCheckBox = !rowSelection && isForbiddenBtn("mulDelete");
362
+ const _rowSelection = useMemo(
363
+ () => ({
364
+ fixed: true,
365
+ columnWidth: 48,
366
+ getCheckboxProps: (record) => {
367
+ if (rowDisabled) {
368
+ const _disabled = rowDisabled(record);
369
+ return {
370
+ disabled: _disabled
371
+ };
372
+ }
373
+ return {};
374
+ },
375
+ hideSelectAll: isHideCheckBox,
376
+ ...rowSelection,
377
+ selectedRowKeys: mergedSelectedRowKeys,
378
+ onChange: (nextSelectedRowKeys, nextSelectedRows, info) => {
379
+ var _a2;
380
+ setState({
381
+ selectedRowKeys: nextSelectedRowKeys,
382
+ selectedRows: nextSelectedRows
383
+ });
384
+ (_a2 = rowSelection == null ? void 0 : rowSelection.onChange) == null ? void 0 : _a2.call(rowSelection, nextSelectedRowKeys, nextSelectedRows, info);
385
+ }
386
+ }),
387
+ [isHideCheckBox, mergedSelectedRowKeys, rowDisabled, rowSelection, setState]
388
+ );
389
+ const emptyDom = useMemo(
390
+ () => () => {
391
+ var _a2;
392
+ return /* @__PURE__ */ jsxs("div", { className: "com-empty", children: [
393
+ /* @__PURE__ */ jsx("img", { className: "img", src: Empty, alt: "Empty" }),
394
+ /* @__PURE__ */ jsx("div", { className: "content", children: disabled || isForbiddenBtn("add") ? locale.ProEditTable.noData : /* @__PURE__ */ jsxs(Fragment, { children: [
395
+ locale.ProEditTable.noData,
396
+ ",",
397
+ /* @__PURE__ */ jsx(
398
+ RenderToolbar,
399
+ {
400
+ ...{
401
+ ...config,
402
+ toolbarProps: (_a2 = toolbarProps == null ? void 0 : toolbarProps.filter) == null ? void 0 : _a2.call(
403
+ toolbarProps,
404
+ (item) => item.type === "add" || (item == null ? void 0 : item.persistence)
405
+ ),
406
+ dataSource: []
407
+ }
408
+ }
409
+ )
410
+ ] }) })
411
+ ] });
412
+ },
413
+ [config, disabled, isForbiddenBtn, toolbarProps]
414
+ );
353
415
  const renderRowSelection = useCallback(() => {
354
416
  if (disabled || isView) {
355
417
  return null;
@@ -366,20 +428,20 @@ const ProEditTable = ({
366
428
  return transformColumns(columns, config, cellCachesRef.current);
367
429
  }, [columns, config, forceUpdate]);
368
430
  const initDataSource = () => {
369
- // 检查每一项是否有 rowKey 或通过 rowKey 字段获取的 key
370
- const isAllHasKey = value?.every?.(item => item.rowKey || typeof rowKey === 'string' && item[rowKey]);
371
-
372
- // 检查 rowKey 是否需要覆盖(即当前 rowKey getRowKey 生成的不一致)
373
- const isNeedCover = value?.some?.(item => item.rowKey !== getRowKey?.(item));
374
- // 初始化默认生成 rowKey
375
- if (value?.length && (!isAllHasKey || isNeedCover)) {
376
- const nextValues = value?.map(item => {
431
+ var _a2, _b2;
432
+ const isAllHasKey = (_a2 = value == null ? void 0 : value.every) == null ? void 0 : _a2.call(
433
+ value,
434
+ (item) => item.rowKey || typeof rowKey === "string" && item[rowKey]
435
+ );
436
+ const isNeedCover = (_b2 = value == null ? void 0 : value.some) == null ? void 0 : _b2.call(value, (item) => item.rowKey !== (getRowKey == null ? void 0 : getRowKey(item)));
437
+ if ((value == null ? void 0 : value.length) && (!isAllHasKey || isNeedCover)) {
438
+ const nextValues = value == null ? void 0 : value.map((item) => {
377
439
  return {
378
440
  ...item,
379
441
  rowKey: getRowKey(item)
380
442
  };
381
443
  });
382
- onChange?.(nextValues);
444
+ onChange == null ? void 0 : onChange(nextValues);
383
445
  if (virtualKey) {
384
446
  form.setFieldValue(virtualRowName, nextValues);
385
447
  }
@@ -388,7 +450,7 @@ const ProEditTable = ({
388
450
  useEffect(() => {
389
451
  initDataSource();
390
452
  }, [value, originalValues]);
391
- useImperativeHandle(stableResetProps?.ref || ref, () => {
453
+ useImperativeHandle((stableResetProps == null ? void 0 : stableResetProps.ref) || ref, () => {
392
454
  return {
393
455
  getInternalState: () => state,
394
456
  setInternalState: setState
@@ -397,132 +459,148 @@ const ProEditTable = ({
397
459
  useEffect(() => {
398
460
  if (toolbarSticky) {
399
461
  const updatePos = () => {
400
- affixRef?.current?.updatePosition?.();
462
+ var _a2, _b2;
463
+ (_b2 = (_a2 = affixRef == null ? void 0 : affixRef.current) == null ? void 0 : _a2.updatePosition) == null ? void 0 : _b2.call(_a2);
401
464
  };
402
- window.addEventListener('scroll', updatePos, true);
465
+ window.addEventListener("scroll", updatePos, true);
403
466
  return () => {
404
- window.removeEventListener('scroll', updatePos, true);
467
+ window.removeEventListener("scroll", updatePos, true);
405
468
  };
406
469
  }
407
470
  }, [toolbarSticky]);
408
- const _toolbarSticky = _isBoolean(toolbarSticky) ? {} : toolbarSticky;
409
- const _summary = useMemo(() => typeof summary === 'object' ? data => /*#__PURE__*/_jsx(Summary, {
410
- data: data,
411
- summary: summary,
412
- rowSelection: renderRowSelection()
413
- }) : summary, [renderRowSelection, summary]);
471
+ const _toolbarSticky = isBoolean(toolbarSticky) ? {} : toolbarSticky;
472
+ const _summary = useMemo(
473
+ () => typeof summary === "object" ? (data) => /* @__PURE__ */ jsx(Summary, { data, summary, rowSelection: renderRowSelection() }) : summary,
474
+ [renderRowSelection, summary]
475
+ );
414
476
  const TableComponent = draggable ? DraggableTable : BaseTable;
415
-
416
- // 给每个 record 附加编辑状态标识,让 shouldCellUpdate 能检测到状态变化
417
- // 始终注入 _rowIndex,供 shouldCellUpdate 感知行位置变化(增删行后同一行数据不变但位置变了)
418
- // draggable 时同时注入 _dragIndex
419
477
  const enrichedValue = useMemo(() => {
420
- return value?.map((record, idx) => ({
478
+ return value == null ? void 0 : value.map((record, idx) => ({
421
479
  ...record,
422
- ...(virtualKey ? {
423
- _isEditing: editingKeys.includes(record.rowKey) || record._addFlag
424
- } : {}),
425
- ...(draggable ? {
426
- _dragIndex: idx
427
- } : {}),
480
+ ...virtualKey ? { _isEditing: editingKeys.includes(record.rowKey) || record._addFlag } : {},
481
+ ...draggable ? { _dragIndex: idx } : {},
428
482
  _rowIndex: idx
429
483
  }));
430
484
  }, [value, virtualKey, editingKeys, draggable]);
431
485
  const tableRowKey = useMemo(() => buildTableRowKey(rowKey), [rowKey]);
432
- const tableProps = useMemo(() => ({
433
- rowKey,
434
- tableRowKey,
435
- value: enrichedValue,
436
- headerRender,
437
- tableRef,
438
- className: _className,
439
- columns: _columns,
440
- renderRowSelection,
441
- rowClassName: _rowClassName,
442
- disabled,
443
- virtualKey,
444
- editingKeys,
445
- isHideCheckBox,
446
- rowDraggable,
447
- pagination,
448
- paginationValidationEnabled,
449
- scroll,
450
- summary: _summary,
451
- page: resolvedPage,
452
- formatMessage,
453
- locale,
454
- handlePageChange
455
- }), [_className, _columns, _rowClassName, disabled, editingKeys, formatMessage, handlePageChange, headerRender, isHideCheckBox, locale, pagination, paginationValidationEnabled, renderRowSelection, rowDraggable, rowKey, tableRowKey, scroll, _summary, tableRef, enrichedValue, resolvedPage, virtualKey]);
456
-
457
- // 拖拽排序后,enrichedValue 中含 _dragIndex/_rowIndex(内部字段),需清除后再传给外部 onChange
458
- const handleDragChange = useCallback(newValue => {
459
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
460
- const cleanValue = newValue?.map(({
461
- _dragIndex: _d,
462
- _rowIndex: _r,
463
- ...rest
464
- }) => rest);
465
- onChange?.(cleanValue);
466
- }, [onChange]);
467
- const draggableProps = useMemo(() => ({
468
- onChange: draggable ? handleDragChange : onChange,
469
- onDrag,
470
- onDragEnd,
471
- draggable
472
- }), [draggable, handleDragChange, onChange, onDrag, onDragEnd]);
473
- return /*#__PURE__*/_jsxs(_Fragment, {
474
- children: [/*#__PURE__*/_jsx(ConfigProvider, {
475
- renderEmpty: value?.length ? undefined : emptyDom,
476
- children: /*#__PURE__*/_jsx(TableComponent, {
477
- ...resetProps,
478
- draggableProps: draggableProps,
479
- tableProps: tableProps
480
- })
481
- }), !isView && value?.length ? toolbarSticky ? /*#__PURE__*/_jsx(Affix, {
482
- ref: affixRef,
483
- ..._toolbarSticky,
484
- children: /*#__PURE__*/_jsx("div", {
485
- className: `pro-edit-table-toolbar${paginationEnabled ? ' pro-edit-table-toolbar-fixed' : ''}`,
486
- children: /*#__PURE__*/_jsx(RenderToolbar, {
487
- ...config
488
- })
489
- })
490
- }) : /*#__PURE__*/_jsx("div", {
491
- className: `pro-edit-table-toolbar${paginationEnabled ? ' pro-edit-table-toolbar-fixed' : ''}`,
492
- children: /*#__PURE__*/_jsx(RenderToolbar, {
493
- ...config
494
- })
495
- }) : null, footerRender ? /*#__PURE__*/_jsx("div", {
496
- className: "pro-edit-table-footer",
497
- children: footerRender
498
- }) : null, paginationValidationEnabled ? /*#__PURE__*/_jsx("div", {
499
- id: `pro-edit-table-pagination-${Array.isArray(config.name) ? config.name.filter(Boolean).join('-') : config.name || 'default'}`,
500
- onClick: () => {
501
- onPageCheck({
502
- form,
503
- name,
504
- value,
505
- columns,
506
- page: resolvedPage,
507
- pagination,
508
- isView,
509
- disabled,
510
- setState
511
- });
486
+ const tableProps = useMemo(
487
+ () => ({
488
+ rowKey,
489
+ tableRowKey,
490
+ value: enrichedValue,
491
+ headerRender,
492
+ tableRef,
493
+ className: _className,
494
+ columns: _columns,
495
+ renderRowSelection,
496
+ rowClassName: _rowClassName,
497
+ disabled,
498
+ virtualKey,
499
+ editingKeys,
500
+ isHideCheckBox,
501
+ rowDraggable,
502
+ pagination,
503
+ paginationValidationEnabled,
504
+ scroll,
505
+ summary: _summary,
506
+ page: resolvedPage,
507
+ formatMessage,
508
+ locale,
509
+ handlePageChange
510
+ }),
511
+ [
512
+ _className,
513
+ _columns,
514
+ _rowClassName,
515
+ disabled,
516
+ editingKeys,
517
+ formatMessage,
518
+ handlePageChange,
519
+ headerRender,
520
+ isHideCheckBox,
521
+ locale,
522
+ pagination,
523
+ paginationValidationEnabled,
524
+ renderRowSelection,
525
+ rowDraggable,
526
+ rowKey,
527
+ tableRowKey,
528
+ scroll,
529
+ _summary,
530
+ tableRef,
531
+ enrichedValue,
532
+ resolvedPage,
533
+ virtualKey
534
+ ]
535
+ );
536
+ const handleDragChange = useCallback(
537
+ (newValue) => {
538
+ const cleanValue = newValue == null ? void 0 : newValue.map(({ _dragIndex: _d2, _rowIndex: _r, ...rest }) => rest);
539
+ onChange == null ? void 0 : onChange(cleanValue);
540
+ },
541
+ [onChange]
542
+ );
543
+ const draggableProps = useMemo(
544
+ () => ({
545
+ onChange: draggable ? handleDragChange : onChange,
546
+ onDrag,
547
+ onDragEnd,
548
+ draggable
549
+ }),
550
+ [draggable, handleDragChange, onChange, onDrag, onDragEnd]
551
+ );
552
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
553
+ /* @__PURE__ */ jsx(ConfigProvider, { renderEmpty: (value == null ? void 0 : value.length) ? void 0 : emptyDom, children: /* @__PURE__ */ jsx(TableComponent, { ...resetProps, draggableProps, tableProps }) }),
554
+ !isView && (value == null ? void 0 : value.length) ? toolbarSticky ? /* @__PURE__ */ jsx(Affix, { ref: affixRef, ..._toolbarSticky, children: /* @__PURE__ */ jsx(
555
+ "div",
556
+ {
557
+ className: `pro-edit-table-toolbar${paginationEnabled ? " pro-edit-table-toolbar-fixed" : ""}`,
558
+ children: /* @__PURE__ */ jsx(RenderToolbar, { ...config })
512
559
  }
513
- }) : null, /*#__PURE__*/_jsx(Validator, {
514
- name: name,
515
- virtualKey: virtualKey,
516
- editingKeys: editingKeys,
517
- onlyOneLineMsg: onlyOneLineMsg,
518
- virtual: stableResetProps?.virtual,
519
- columns: columns,
520
- config: config,
521
- errorStore: errorStoreRef.current
522
- })]
523
- });
560
+ ) }) : /* @__PURE__ */ jsx(
561
+ "div",
562
+ {
563
+ className: `pro-edit-table-toolbar${paginationEnabled ? " pro-edit-table-toolbar-fixed" : ""}`,
564
+ children: /* @__PURE__ */ jsx(RenderToolbar, { ...config })
565
+ }
566
+ ) : null,
567
+ footerRender ? /* @__PURE__ */ jsx("div", { className: "pro-edit-table-footer", children: footerRender }) : null,
568
+ paginationValidationEnabled ? /* @__PURE__ */ jsx(
569
+ "div",
570
+ {
571
+ id: `pro-edit-table-pagination-${Array.isArray(config.name) ? config.name.filter(Boolean).join("-") : config.name || "default"}`,
572
+ onClick: () => {
573
+ onPageCheck({
574
+ form,
575
+ name,
576
+ value,
577
+ columns,
578
+ page: resolvedPage,
579
+ pagination,
580
+ isView,
581
+ disabled,
582
+ setState
583
+ });
584
+ }
585
+ }
586
+ ) : null,
587
+ /* @__PURE__ */ jsx(
588
+ Validator,
589
+ {
590
+ name,
591
+ virtualKey,
592
+ editingKeys,
593
+ onlyOneLineMsg,
594
+ virtual: stableResetProps == null ? void 0 : stableResetProps.virtual,
595
+ columns,
596
+ config,
597
+ errorStore: errorStoreRef.current
598
+ }
599
+ )
600
+ ] });
601
+ };
602
+ const ForwardProEditTable = forwardRef(ProEditTable);
603
+ var ProEditTable_default = ForwardProEditTable;
604
+ export {
605
+ ProEditTable_default as default
524
606
  };
525
- const ForwardProEditTable = /*#__PURE__*/forwardRef(ProEditTable);
526
-
527
- // 导出组件
528
- export default ForwardProEditTable;