@zat-design/sisyphus-react 4.5.0 → 4.5.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 (290) hide show
  1. package/dist/index.esm.css +1 -1
  2. package/dist/less.esm.css +1 -1
  3. package/es/ProDrawerForm/components/ProDrawer/index.js +58 -86
  4. package/es/ProDrawerForm/components/ProModal/index.js +44 -20
  5. package/es/ProDrawerForm/hooks/useConfirmClose.js +70 -0
  6. package/es/ProDrawerForm/index.js +7 -11
  7. package/es/ProDrawerForm/utils/index.js +36 -0
  8. package/es/ProEditTable/components/RcTable/BaseTable.js +10 -0
  9. package/es/ProEditTable/components/Summary/index.js +3 -2
  10. package/es/ProEditTable/utils/tools.js +1 -1
  11. package/es/ProEnum/index.js +6 -3
  12. package/es/ProForm/components/combination/FormList/components/ActionButton.js +7 -6
  13. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +4 -3
  14. package/es/ProForm/components/combination/ProModalSelect/index.js +7 -2
  15. package/es/ProForm/components/combination/ProModalSelect/utils/mergeSelectedRows.js +26 -0
  16. package/es/ProForm/components/render/RenderFields.js +3 -1
  17. package/es/ProForm/hooks/useWatch.js +8 -10
  18. package/es/ProLayout/components/ProHeader/index.js +28 -15
  19. package/es/ProSelect/index.js +77 -178
  20. package/es/ProSelect/utils/index.js +174 -0
  21. package/es/ProTree/components/ProTreeSelect/index.js +41 -14
  22. package/es/ProTree/components/ProTreeSelect/style/index.less +13 -4
  23. package/es/ProTree/style/index.less +20 -9
  24. package/es/ProTree/utils.js +26 -0
  25. package/es/ProTreeModal/style/index.less +1 -1
  26. package/es/ProUpload/components/DragRender.js +2 -1
  27. package/es/ProUpload/index.js +1 -1
  28. package/es/ProViewer/propsType.js +3 -1
  29. package/es/index.js +10 -0
  30. package/package.json +7 -13
  31. package/es/FormsProvider/index.d.ts +0 -18
  32. package/es/ProAction/components/CheckModalContent/index.d.ts +0 -8
  33. package/es/ProAction/index.d.ts +0 -7
  34. package/es/ProAction/propsType.d.ts +0 -45
  35. package/es/ProConfigProvider/index.d.ts +0 -9
  36. package/es/ProConfigProvider/propsType.d.ts +0 -78
  37. package/es/ProDownload/index.d.ts +0 -6
  38. package/es/ProDownload/propsType.d.ts +0 -71
  39. package/es/ProDownload/utils.d.ts +0 -60
  40. package/es/ProDrawerForm/components/ProDrawer/index.d.ts +0 -7
  41. package/es/ProDrawerForm/components/ProModal/index.d.ts +0 -7
  42. package/es/ProDrawerForm/components/index.d.ts +0 -2
  43. package/es/ProDrawerForm/index.d.ts +0 -6
  44. package/es/ProDrawerForm/propsType.d.ts +0 -100
  45. package/es/ProDrawerForm/utils/index.d.ts +0 -6
  46. package/es/ProEditLabel/components/RenderProForm.d.ts +0 -4
  47. package/es/ProEditLabel/index.d.ts +0 -4
  48. package/es/ProEditLabel/propsType.d.ts +0 -163
  49. package/es/ProEditLabel/utils/index.d.ts +0 -7
  50. package/es/ProEditTable/components/ActionButton/index.d.ts +0 -2
  51. package/es/ProEditTable/components/RcTable/BaseTable.d.ts +0 -6
  52. package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +0 -7
  53. package/es/ProEditTable/components/RcTable/index.d.ts +0 -4
  54. package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +0 -4
  55. package/es/ProEditTable/components/RenderField/index.d.ts +0 -3
  56. package/es/ProEditTable/components/RenderField/propsType.d.ts +0 -30
  57. package/es/ProEditTable/components/RenderField/tools.d.ts +0 -22
  58. package/es/ProEditTable/components/RenderToolbar/index.d.ts +0 -2
  59. package/es/ProEditTable/components/Summary/index.d.ts +0 -12
  60. package/es/ProEditTable/components/Validator/index.d.ts +0 -19
  61. package/es/ProEditTable/components/index.d.ts +0 -5
  62. package/es/ProEditTable/index.d.ts +0 -4
  63. package/es/ProEditTable/propsType.d.ts +0 -437
  64. package/es/ProEditTable/utils/config.d.ts +0 -25
  65. package/es/ProEditTable/utils/diffOriginal.d.ts +0 -22
  66. package/es/ProEditTable/utils/getDefaultProps.d.ts +0 -1
  67. package/es/ProEditTable/utils/index.d.ts +0 -23
  68. package/es/ProEditTable/utils/tools.d.ts +0 -128
  69. package/es/ProEditTable/utils/transform.d.ts +0 -13
  70. package/es/ProEditTable/utils/useEditTableError.d.ts +0 -7
  71. package/es/ProEditTable/utils/useShouldUpdateForTable.d.ts +0 -16
  72. package/es/ProEditTable/utils/validateAll.d.ts +0 -89
  73. package/es/ProEnum/components/Group.d.ts +0 -10
  74. package/es/ProEnum/components/Tag.d.ts +0 -7
  75. package/es/ProEnum/hooks/useEnum.d.ts +0 -29
  76. package/es/ProEnum/hooks/useEnumRequest.d.ts +0 -4
  77. package/es/ProEnum/hooks/useFrequentEnumRequest.d.ts +0 -14
  78. package/es/ProEnum/index.d.ts +0 -10
  79. package/es/ProEnum/propsType.d.ts +0 -310
  80. package/es/ProEnum/utils/eventCenter.d.ts +0 -1
  81. package/es/ProEnum/utils/frequentEnum.d.ts +0 -39
  82. package/es/ProEnum/utils/getEnum.d.ts +0 -47
  83. package/es/ProEnum/utils/getEnumLabel.d.ts +0 -2
  84. package/es/ProEnum/utils/index.d.ts +0 -84
  85. package/es/ProForm/components/Container.d.ts +0 -9
  86. package/es/ProForm/components/FormFooter/index.d.ts +0 -5
  87. package/es/ProForm/components/FormFooter/propsType.d.ts +0 -22
  88. package/es/ProForm/components/base/Checkbox/index.d.ts +0 -14
  89. package/es/ProForm/components/base/DatePicker/index.d.ts +0 -11
  90. package/es/ProForm/components/base/Input/index.d.ts +0 -3
  91. package/es/ProForm/components/base/Input/propsType.d.ts +0 -21
  92. package/es/ProForm/components/base/InputNumber/index.d.ts +0 -11
  93. package/es/ProForm/components/base/Radio/index.d.ts +0 -15
  94. package/es/ProForm/components/base/RangePicker/index.d.ts +0 -19
  95. package/es/ProForm/components/base/RangePicker/useDateRange.d.ts +0 -15
  96. package/es/ProForm/components/base/Select/index.d.ts +0 -11
  97. package/es/ProForm/components/base/Switch/index.d.ts +0 -10
  98. package/es/ProForm/components/base/SwitchCheckbox/index.d.ts +0 -10
  99. package/es/ProForm/components/base/TextArea/index.d.ts +0 -11
  100. package/es/ProForm/components/base/TimePicker/index.d.ts +0 -13
  101. package/es/ProForm/components/combination/Container/index.d.ts +0 -4
  102. package/es/ProForm/components/combination/Container/propsType.d.ts +0 -13
  103. package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +0 -24
  104. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +0 -23
  105. package/es/ProForm/components/combination/FormList/components/Empty.d.ts +0 -13
  106. package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +0 -20
  107. package/es/ProForm/components/combination/FormList/components/ToolbarButton.d.ts +0 -12
  108. package/es/ProForm/components/combination/FormList/index.d.ts +0 -4
  109. package/es/ProForm/components/combination/FormList/propsType.d.ts +0 -69
  110. package/es/ProForm/components/combination/FormList/utils.d.ts +0 -18
  111. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +0 -9
  112. package/es/ProForm/components/combination/Group/component/ComRender.d.ts +0 -28
  113. package/es/ProForm/components/combination/Group/component/FlexibleGroup.d.ts +0 -10
  114. package/es/ProForm/components/combination/Group/hooks/index.d.ts +0 -34
  115. package/es/ProForm/components/combination/Group/index.d.ts +0 -9
  116. package/es/ProForm/components/combination/Group/propsType.d.ts +0 -99
  117. package/es/ProForm/components/combination/Group/utils/index.d.ts +0 -154
  118. package/es/ProForm/components/combination/ProCascader/index.d.ts +0 -4
  119. package/es/ProForm/components/combination/ProCascader/propsType.d.ts +0 -48
  120. package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +0 -14
  121. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.d.ts +0 -33
  122. package/es/ProForm/components/combination/ProModalSelect/index.d.ts +0 -4
  123. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +0 -106
  124. package/es/ProForm/components/combination/ProModalSelect/utils/index.d.ts +0 -1
  125. package/es/ProForm/components/combination/ProNumberRange/index.d.ts +0 -4
  126. package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +0 -85
  127. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +0 -4
  128. package/es/ProForm/components/combination/ProRangeLimit/propsType.d.ts +0 -23
  129. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +0 -9
  130. package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +0 -33
  131. package/es/ProForm/components/index.d.ts +0 -29
  132. package/es/ProForm/components/render/ChangedWrapper.d.ts +0 -17
  133. package/es/ProForm/components/render/ConfirmWrapper.d.ts +0 -10
  134. package/es/ProForm/components/render/CustomComponentViewWrapper.d.ts +0 -30
  135. package/es/ProForm/components/render/Render.d.ts +0 -4
  136. package/es/ProForm/components/render/RenderFields.d.ts +0 -26
  137. package/es/ProForm/components/render/propsType.d.ts +0 -279
  138. package/es/ProForm/hooks/useControlled.d.ts +0 -1
  139. package/es/ProForm/hooks/useDeepCompareMemo.d.ts +0 -2
  140. package/es/ProForm/hooks/useFieldProps.d.ts +0 -4
  141. package/es/ProForm/hooks/useForm.d.ts +0 -8
  142. package/es/ProForm/hooks/useRules.d.ts +0 -16
  143. package/es/ProForm/hooks/useShouldUpdate.d.ts +0 -31
  144. package/es/ProForm/hooks/useWatch.d.ts +0 -22
  145. package/es/ProForm/index.d.ts +0 -6
  146. package/es/ProForm/propsType.d.ts +0 -143
  147. package/es/ProForm/utils/buildFormItemProps.d.ts +0 -25
  148. package/es/ProForm/utils/diffOriginal.d.ts +0 -10
  149. package/es/ProForm/utils/getDefaultProps.d.ts +0 -1
  150. package/es/ProForm/utils/index.d.ts +0 -109
  151. package/es/ProForm/utils/processDependencies.d.ts +0 -29
  152. package/es/ProForm/utils/reactiveValues.d.ts +0 -34
  153. package/es/ProForm/utils/rulesCreator.d.ts +0 -7
  154. package/es/ProForm/utils/transformNames.d.ts +0 -10
  155. package/es/ProForm/utils/transformValue.d.ts +0 -6
  156. package/es/ProForm/utils/valueType.d.ts +0 -70
  157. package/es/ProIcon/config/index.d.ts +0 -19
  158. package/es/ProIcon/index.d.ts +0 -4
  159. package/es/ProIcon/propsTypes.d.ts +0 -175
  160. package/es/ProIcon/utils/index.d.ts +0 -6
  161. package/es/ProLayout/components/Layout/Header/index.d.ts +0 -4
  162. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.d.ts +0 -3
  163. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +0 -3
  164. package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.d.ts +0 -15
  165. package/es/ProLayout/components/Layout/Menu/SideMenu/index.d.ts +0 -3
  166. package/es/ProLayout/components/Layout/Menu/index.d.ts +0 -4
  167. package/es/ProLayout/components/Layout/Notice/index.d.ts +0 -4
  168. package/es/ProLayout/components/Layout/index.d.ts +0 -3
  169. package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +0 -98
  170. package/es/ProLayout/components/ProCollapse/index.d.ts +0 -3
  171. package/es/ProLayout/components/ProFooter/PropTypes.d.ts +0 -27
  172. package/es/ProLayout/components/ProFooter/index.d.ts +0 -4
  173. package/es/ProLayout/components/ProHeader/PropTypes.d.ts +0 -206
  174. package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +0 -4
  175. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.d.ts +0 -9
  176. package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.d.ts +0 -4
  177. package/es/ProLayout/components/ProHeader/components/index.d.ts +0 -2
  178. package/es/ProLayout/components/ProHeader/index.d.ts +0 -4
  179. package/es/ProLayout/components/ProHeader/utils/index.d.ts +0 -5
  180. package/es/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +0 -7
  181. package/es/ProLayout/components/TabsManager/components/TabItem.d.ts +0 -26
  182. package/es/ProLayout/components/TabsManager/components/TabsContext.d.ts +0 -6
  183. package/es/ProLayout/components/TabsManager/components/TabsHeader.d.ts +0 -10
  184. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.d.ts +0 -6
  185. package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.d.ts +0 -25
  186. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.d.ts +0 -18
  187. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.d.ts +0 -31
  188. package/es/ProLayout/components/TabsManager/hooks/useTabsState.d.ts +0 -5
  189. package/es/ProLayout/components/TabsManager/index.d.ts +0 -7
  190. package/es/ProLayout/components/TabsManager/propTypes.d.ts +0 -89
  191. package/es/ProLayout/components/TabsManager/utils/index.d.ts +0 -47
  192. package/es/ProLayout/components/index.d.ts +0 -3
  193. package/es/ProLayout/index.d.ts +0 -20
  194. package/es/ProLayout/propTypes.d.ts +0 -533
  195. package/es/ProLayout/utils/index.d.ts +0 -43
  196. package/es/ProSelect/components/AdaptiveTooltip.d.ts +0 -4
  197. package/es/ProSelect/index.d.ts +0 -5
  198. package/es/ProSelect/propsType.d.ts +0 -160
  199. package/es/ProSelect/utils/index.d.ts +0 -4
  200. package/es/ProStep/components/Anchor/index.d.ts +0 -4
  201. package/es/ProStep/components/Item/index.d.ts +0 -3
  202. package/es/ProStep/components/LazyLoad/index.d.ts +0 -19
  203. package/es/ProStep/components/Listener/index.d.ts +0 -4
  204. package/es/ProStep/components/Step/index.d.ts +0 -5
  205. package/es/ProStep/index.d.ts +0 -11
  206. package/es/ProStep/propsType.d.ts +0 -224
  207. package/es/ProStep/utils/index.d.ts +0 -22
  208. package/es/ProStepTab/index.d.ts +0 -22
  209. package/es/ProStepTab/propsType.d.ts +0 -114
  210. package/es/ProTable/components/EditableCell/EditIcon.d.ts +0 -6
  211. package/es/ProTable/components/EditableCell/index.d.ts +0 -4
  212. package/es/ProTable/components/EditableCell/propsType.d.ts +0 -24
  213. package/es/ProTable/components/FormatColumn/index.d.ts +0 -22
  214. package/es/ProTable/components/FormatColumn/propsType.d.ts +0 -29
  215. package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +0 -3
  216. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +0 -18
  217. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.d.ts +0 -8
  218. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.d.ts +0 -61
  219. package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +0 -3
  220. package/es/ProTable/components/RcTable/index.d.ts +0 -4
  221. package/es/ProTable/components/RenderColumn/index.d.ts +0 -22
  222. package/es/ProTable/components/RenderEmptyText/index.d.ts +0 -3
  223. package/es/ProTable/components/RenderFooter/index.d.ts +0 -2
  224. package/es/ProTable/components/RenderSummary/index.d.ts +0 -3
  225. package/es/ProTable/components/RenderTableHeader/index.d.ts +0 -2
  226. package/es/ProTable/components/RenderTabs/index.d.ts +0 -4
  227. package/es/ProTable/components/TableResizable/index.d.ts +0 -13
  228. package/es/ProTable/components/TooltipTitle/index.d.ts +0 -11
  229. package/es/ProTable/components/index.d.ts +0 -31
  230. package/es/ProTable/hooks/useAntdTable.d.ts +0 -7
  231. package/es/ProTable/index.d.ts +0 -17
  232. package/es/ProTable/propsType.d.ts +0 -792
  233. package/es/ProTable/utils/columnStorage.d.ts +0 -35
  234. package/es/ProTable/utils/index.d.ts +0 -52
  235. package/es/ProTabs/components/Card/index.d.ts +0 -3
  236. package/es/ProTabs/components/index.d.ts +0 -1
  237. package/es/ProTabs/index.d.ts +0 -4
  238. package/es/ProTabs/propType.d.ts +0 -94
  239. package/es/ProThemeTools/component/ProTools/index.d.ts +0 -3
  240. package/es/ProThemeTools/component/index.d.ts +0 -1
  241. package/es/ProThemeTools/context/ThemeContext.d.ts +0 -43
  242. package/es/ProThemeTools/index.d.ts +0 -9
  243. package/es/ProThemeTools/propsType.d.ts +0 -170
  244. package/es/ProThemeTools/utils/index.d.ts +0 -51
  245. package/es/ProTooltip/index.d.ts +0 -3
  246. package/es/ProTooltip/propsType.d.ts +0 -57
  247. package/es/ProTree/components/AdaptiveTooltip.d.ts +0 -4
  248. package/es/ProTree/components/CloseIcon.d.ts +0 -2
  249. package/es/ProTree/components/List.d.ts +0 -17
  250. package/es/ProTree/components/ProTree.d.ts +0 -3
  251. package/es/ProTree/components/ProTreeSelect/index.d.ts +0 -5
  252. package/es/ProTree/components/ProTreeSelect/propsType.d.ts +0 -439
  253. package/es/ProTree/components/SearchTitle.d.ts +0 -11
  254. package/es/ProTree/components/Tree.d.ts +0 -27
  255. package/es/ProTree/components/index.d.ts +0 -4
  256. package/es/ProTree/index.d.ts +0 -3
  257. package/es/ProTree/propsType.d.ts +0 -812
  258. package/es/ProTree/utils.d.ts +0 -52
  259. package/es/ProTreeModal/components/Cascader.d.ts +0 -14
  260. package/es/ProTreeModal/components/CloseIcon.d.ts +0 -2
  261. package/es/ProTreeModal/components/List.d.ts +0 -21
  262. package/es/ProTreeModal/components/SearchTitle.d.ts +0 -7
  263. package/es/ProTreeModal/components/SortableItem.d.ts +0 -12
  264. package/es/ProTreeModal/components/Tree.d.ts +0 -25
  265. package/es/ProTreeModal/components/Trigger.d.ts +0 -21
  266. package/es/ProTreeModal/components/index.d.ts +0 -6
  267. package/es/ProTreeModal/index.d.ts +0 -4
  268. package/es/ProTreeModal/propsType.d.ts +0 -298
  269. package/es/ProTreeModal/utils.d.ts +0 -39
  270. package/es/ProUpload/components/ButtonRender.d.ts +0 -20
  271. package/es/ProUpload/components/DragRender.d.ts +0 -21
  272. package/es/ProUpload/components/DraggableUploadListItem.d.ts +0 -2
  273. package/es/ProUpload/components/Example.d.ts +0 -10
  274. package/es/ProUpload/components/FileItem.d.ts +0 -33
  275. package/es/ProUpload/components/ImageRender.d.ts +0 -19
  276. package/es/ProUpload/index.d.ts +0 -4
  277. package/es/ProUpload/propsType.d.ts +0 -264
  278. package/es/ProUpload/uitls.d.ts +0 -3
  279. package/es/ProUtils/utils/index.d.ts +0 -6
  280. package/es/ProViewer/index.d.ts +0 -4
  281. package/es/ProViewer/propsType.d.ts +0 -35
  282. package/es/ProWaterMark/index.d.ts +0 -4
  283. package/es/ProWaterMark/propsType.d.ts +0 -6
  284. package/es/hooks/useDraggableRow.d.ts +0 -34
  285. package/es/index.d.ts +0 -47
  286. package/es/locale/en_US.d.ts +0 -176
  287. package/es/locale/index.d.ts +0 -15
  288. package/es/locale/zh_CN.d.ts +0 -176
  289. package/es/tokens.d.ts +0 -83
  290. package/es/utils/index.d.ts +0 -20
@@ -1,17 +1,17 @@
1
1
  import _omit from "lodash/omit";
2
2
  import _isArray from "lodash/isArray";
3
- import { Button, Drawer, Modal } from 'antd';
4
- import React, { useCallback, useState, useRef, useEffect } from 'react';
3
+ import { Button, Drawer } from 'antd';
4
+ import React, { useCallback, useState, useRef } from 'react';
5
5
  import { useScroll } from 'ahooks';
6
6
  import classNames from 'classnames';
7
7
  import { ReactSVG } from 'react-svg';
8
8
  import closeSvg from "../../../assets/close.svg";
9
- import locale from "../../../locale";
9
+ import { useConfirmClose } from "../../hooks/useConfirmClose";
10
10
 
11
11
  /**
12
12
  * 抽屉组件
13
13
  */
14
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
15
15
  const ProDrawer = ({
16
16
  form,
17
17
  title,
@@ -31,67 +31,32 @@ const ProDrawer = ({
31
31
  children,
32
32
  className,
33
33
  zIndex,
34
+ destroyOnHidden,
34
35
  drawerProps
35
36
  }) => {
36
37
  const ref = useRef(null);
37
- const modalRef = useRef(null);
38
38
  const {
39
39
  top
40
40
  } = useScroll(ref) || {};
41
41
  const [loading, toggleLoading] = useState(false);
42
- const [initialSnapshot, setInitialSnapshot] = useState('');
43
42
  const noRenderFooter = isView || footer === false || footer === null;
44
43
  const {
45
44
  mask: drawerMask,
46
45
  ...restDrawerProps
47
46
  } = drawerProps || {};
48
- const drawerWidth = width;
49
- const drawerSize = restDrawerProps?.size;
50
-
51
- // 使用 useEffect 在 open 变更时延迟捕获 初始DOM 快照
52
- useEffect(() => {
53
- if (open) {
54
- // 延迟到下一个事件循环,确保 Drawer 已经渲染
55
- const timeoutId = setTimeout(() => {
56
- if (ref.current) {
57
- setInitialSnapshot(ref.current.innerHTML); // 捕获 DOM 快照
58
- }
59
- }, 100); // 使用 setTimeout 让 DOM 渲染完成后再执行
60
-
61
- return () => clearTimeout(timeoutId); // 清理定时器
62
- }
63
- setInitialSnapshot('');
64
- }, [open]); // 当 open 变化时执行
65
-
66
- // 快照对比
67
- const compareSnapshots = () => {
68
- if (!ref.current) return false;
69
- return ref.current.innerHTML === initialSnapshot;
70
- };
71
- const onConfirm = useCallback(async () => {
72
- // 如果当前是查看状态,或者不需要确认关闭,或者快照对比一致,则直接关闭
73
- if (isView || !isConfirmClose || compareSnapshots()) {
74
- onCancel && onCancel();
75
- } else if (!modalRef.current) {
76
- modalRef.current = Modal.confirm({
77
- className: 'width430',
78
- title: locale?.ProDrawerForm?.isSureClose,
79
- okText: locale?.ProDrawerForm?.confirm,
80
- cancelText: locale?.ProDrawerForm?.cancel,
81
- content: locale?.ProDrawerForm?.secondTipsWhenSave,
82
- mask: {
83
- blur: false
84
- },
85
- onOk: () => {
86
- onCancel && onCancel();
87
- },
88
- onCancel: () => {
89
- modalRef.current = null;
90
- },
91
- ...isConfirmCloseModalProps
92
- });
93
- }
94
- }, [onCancel, modalRef.current, ref.current]);
47
+ // 抽屉宽度统一走 size(antd v6 width 已废弃);数字优先,自定义 width 兜底
48
+ const drawerSize = restDrawerProps?.size ?? width;
49
+ const {
50
+ markInteracted,
51
+ onConfirm,
52
+ contextHolder
53
+ } = useConfirmClose({
54
+ open,
55
+ isView,
56
+ isConfirmClose,
57
+ isConfirmCloseModalProps,
58
+ onCancel
59
+ });
95
60
  const handleFinish = useCallback(async () => {
96
61
  try {
97
62
  if (open) {
@@ -164,40 +129,47 @@ const ProDrawer = ({
164
129
  }
165
130
  return defaultFooter;
166
131
  };
167
- return /*#__PURE__*/_jsxs(Drawer, {
168
- width: drawerWidth,
169
- size: drawerSize,
170
- open: open,
171
- mask: drawerMask ?? {
172
- blur: false
173
- },
174
- maskClosable: maskClosable,
175
- placement: "right",
176
- rootClassName: classNames(className, 'pro-drawer'),
177
- closable: false,
178
- onClose: onCancel,
179
- zIndex: zIndex,
180
- ..._omit(restDrawerProps, 'width', 'size'),
181
- children: [/*#__PURE__*/_jsx("div", {
182
- className: "pro-drawer-close",
183
- onClick: onConfirm,
184
- children: /*#__PURE__*/_jsx(ReactSVG, {
185
- className: "close-icon",
186
- src: closeSvg
187
- })
188
- }), title ? /*#__PURE__*/_jsx("div", {
189
- className: `pro-drawer-title ${top > 0 ? 'pro-drawer-scrolling' : ''}`,
190
- children: title
191
- }) : null, /*#__PURE__*/_jsx("div", {
192
- ref: ref,
193
- className: "pro-drawer-content",
194
- style: {
195
- marginTop: title ? 64 : 0,
196
- paddingBottom: noRenderFooter ? 0 : 64,
197
- height: `calc(100% - ${title ? 64 : 0}px)`
132
+ return /*#__PURE__*/_jsxs(_Fragment, {
133
+ children: [contextHolder, /*#__PURE__*/_jsxs(Drawer, {
134
+ size: drawerSize,
135
+ open: open,
136
+ mask: typeof drawerMask === 'object' ? {
137
+ closable: maskClosable,
138
+ ...drawerMask
139
+ } : drawerMask ?? {
140
+ blur: false,
141
+ closable: maskClosable
198
142
  },
199
- children: children
200
- }), renderFooter()]
143
+ placement: "right",
144
+ rootClassName: classNames(className, 'pro-drawer'),
145
+ closable: false,
146
+ onClose: onConfirm,
147
+ zIndex: zIndex,
148
+ destroyOnHidden: destroyOnHidden,
149
+ ..._omit(restDrawerProps, 'width', 'size'),
150
+ children: [/*#__PURE__*/_jsx("div", {
151
+ className: "pro-drawer-close",
152
+ onClick: onConfirm,
153
+ children: /*#__PURE__*/_jsx(ReactSVG, {
154
+ className: "close-icon",
155
+ src: closeSvg
156
+ })
157
+ }), title ? /*#__PURE__*/_jsx("div", {
158
+ className: `pro-drawer-title ${top > 0 ? 'pro-drawer-scrolling' : ''}`,
159
+ children: title
160
+ }) : null, /*#__PURE__*/_jsx("div", {
161
+ ref: ref,
162
+ className: "pro-drawer-content",
163
+ onInput: markInteracted,
164
+ onChange: markInteracted,
165
+ style: {
166
+ marginTop: title ? 64 : 0,
167
+ paddingBottom: noRenderFooter ? 0 : 64,
168
+ height: `calc(100% - ${title ? 64 : 0}px)`
169
+ },
170
+ children: children
171
+ }), renderFooter()]
172
+ })]
201
173
  });
202
174
  };
203
175
  export default ProDrawer;
@@ -3,10 +3,12 @@ import React, { useCallback, useState, useRef } from 'react';
3
3
  import { Space, Button, Modal } from 'antd';
4
4
  import { useScroll, useSize } from 'ahooks';
5
5
  import classnames from 'classnames';
6
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ import { useConfirmClose } from "../../hooks/useConfirmClose";
7
+
7
8
  /**
8
9
  * 弹窗组件
9
10
  */
11
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
10
12
  const ProModal = ({
11
13
  form,
12
14
  title,
@@ -15,6 +17,8 @@ const ProModal = ({
15
17
  footer,
16
18
  isView,
17
19
  maskClosable,
20
+ isConfirmClose,
21
+ isConfirmCloseModalProps,
18
22
  okText,
19
23
  cancelText,
20
24
  okLoading,
@@ -25,6 +29,7 @@ const ProModal = ({
25
29
  className,
26
30
  extraLeft,
27
31
  zIndex,
32
+ destroyOnHidden,
28
33
  modalProps
29
34
  }) => {
30
35
  const ref = useRef(null);
@@ -40,6 +45,17 @@ const ProModal = ({
40
45
  ...restModalProps
41
46
  } = modalProps || {};
42
47
  const [loading, toggleLoading] = useState(false);
48
+ const {
49
+ markInteracted,
50
+ onConfirm,
51
+ contextHolder
52
+ } = useConfirmClose({
53
+ open,
54
+ isView,
55
+ isConfirmClose,
56
+ isConfirmCloseModalProps,
57
+ onCancel
58
+ });
43
59
  const _className = classnames(['pro-modal', className, {
44
60
  'pro-modal-scrolling': top > 0,
45
61
  'pro-modal-no-footer': noRenderFooter,
@@ -122,25 +138,33 @@ const ProModal = ({
122
138
  }
123
139
  return defaultFooter;
124
140
  };
125
- return /*#__PURE__*/_jsx(Modal, {
126
- className: _className,
127
- title: title,
128
- width: width,
129
- open: open,
130
- mask: modalMask ?? {
131
- blur: false
132
- },
133
- maskClosable: maskClosable,
134
- onCancel: onCancel,
135
- footer: renderFooter(),
136
- okText: okText,
137
- cancelText: cancelText,
138
- zIndex: zIndex,
139
- ...restModalProps,
140
- children: /*#__PURE__*/_jsx("div", {
141
- ref: ref,
142
- children: children
143
- })
141
+ return /*#__PURE__*/_jsxs(_Fragment, {
142
+ children: [contextHolder, /*#__PURE__*/_jsx(Modal, {
143
+ className: _className,
144
+ title: title,
145
+ width: width,
146
+ open: open,
147
+ mask: typeof modalMask === 'object' ? {
148
+ closable: maskClosable,
149
+ ...modalMask
150
+ } : modalMask ?? {
151
+ blur: false,
152
+ closable: maskClosable
153
+ },
154
+ onCancel: onConfirm,
155
+ footer: renderFooter(),
156
+ okText: okText,
157
+ cancelText: cancelText,
158
+ zIndex: zIndex,
159
+ destroyOnHidden: destroyOnHidden,
160
+ ...restModalProps,
161
+ children: /*#__PURE__*/_jsx("div", {
162
+ ref: ref,
163
+ onInput: markInteracted,
164
+ onChange: markInteracted,
165
+ children: children
166
+ })
167
+ })]
144
168
  });
145
169
  };
146
170
  export default ProModal;
@@ -0,0 +1,70 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ import { Modal } from 'antd';
3
+ import { shouldConfirmClose } from "../utils";
4
+ import locale from "../../locale";
5
+ /**
6
+ * 关闭抽屉/弹窗时的二次确认逻辑
7
+ *
8
+ * - markInteracted:绑定到内容容器的 input / change 事件,标记用户真实交互过。
9
+ * setFieldsValue 等程序回填不会派发用户输入事件,因此异步回填不会误触发二次确认。
10
+ * - onConfirm:组件自带关闭入口(右上角 × / 遮罩)的关闭处理。未交互、查看模式或
11
+ * 未开启二次确认时直接关闭;否则弹出二次确认。底部取消按钮不走此逻辑。
12
+ * - contextHolder:Modal.useModal 的上下文占位,需渲染进组件,使二次确认弹框能继承
13
+ * ConfigProvider 的主题 / 国际化(替代静态 Modal.confirm,消除上下文告警)。
14
+ */
15
+ export const useConfirmClose = ({
16
+ open,
17
+ isView,
18
+ isConfirmClose,
19
+ isConfirmCloseModalProps,
20
+ onCancel
21
+ }) => {
22
+ const [modal, contextHolder] = Modal.useModal();
23
+ // 记录用户是否真实交互过表单内容(区别于 setFieldsValue 等程序回填)
24
+ const userInteractedRef = useRef(false);
25
+ const confirmingRef = useRef(false);
26
+
27
+ // open 变化时重置用户交互标记
28
+ useEffect(() => {
29
+ userInteractedRef.current = false;
30
+ }, [open]);
31
+ const markInteracted = useCallback(() => {
32
+ userInteractedRef.current = true;
33
+ }, []);
34
+ const onConfirm = useCallback(() => {
35
+ // 用户真实交互过才弹二次确认;查看模式、未开启确认、或仅程序回填均直接关闭
36
+ if (!shouldConfirmClose({
37
+ isView,
38
+ isConfirmClose,
39
+ userInteracted: userInteractedRef.current
40
+ })) {
41
+ onCancel?.();
42
+ return;
43
+ }
44
+ if (confirmingRef.current) return;
45
+ confirmingRef.current = true;
46
+ modal.confirm({
47
+ className: 'width430',
48
+ title: locale?.ProDrawerForm?.isSureClose,
49
+ okText: locale?.ProDrawerForm?.confirm,
50
+ cancelText: locale?.ProDrawerForm?.cancel,
51
+ content: locale?.ProDrawerForm?.secondTipsWhenSave,
52
+ mask: {
53
+ blur: false
54
+ },
55
+ onOk: () => {
56
+ confirmingRef.current = false;
57
+ onCancel?.();
58
+ },
59
+ onCancel: () => {
60
+ confirmingRef.current = false;
61
+ },
62
+ ...isConfirmCloseModalProps
63
+ });
64
+ }, [isView, isConfirmClose, isConfirmCloseModalProps, onCancel, modal]);
65
+ return {
66
+ markInteracted,
67
+ onConfirm,
68
+ contextHolder
69
+ };
70
+ };
@@ -1,7 +1,7 @@
1
1
  import React, { createContext, forwardRef, useContext, useImperativeHandle, useMemo } from 'react';
2
2
  import { ProDrawer, ProModal } from "./components";
3
3
  import ProForm from "../ProForm";
4
- import { transformBySize } from "./utils";
4
+ import { resolveDrawerSize } from "./utils";
5
5
  import locale from "../locale";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const ProDrawerFormContext = /*#__PURE__*/createContext(null);
@@ -26,17 +26,13 @@ const ProDrawerForm = /*#__PURE__*/forwardRef((props, ref) => {
26
26
  } = props;
27
27
  const nextIsView = isView || disabled;
28
28
  const nextOkText = okText ?? (mode === 'Drawer' ? locale?.ProDrawerForm?.save : locale?.ProDrawerForm?.confirm);
29
- let {
30
- width
29
+ const {
30
+ width: deprecatedWidth,
31
+ ...restPropsWithoutWidth
31
32
  } = restProps;
32
- if (!width && size) {
33
- width = transformBySize(size);
34
- }
35
33
 
36
- // 强转string 类型
37
- if (!Number.isNaN(+width)) {
38
- width = `${width}px`;
39
- }
34
+ // size 优先;显式传入(已废弃的)width 仍兼容生效并告警
35
+ const width = resolveDrawerSize(size, deprecatedWidth);
40
36
  const [form] = ProForm.useForm(originalForm);
41
37
  const handleCancel = () => {
42
38
  onCloseClean && form.resetFields();
@@ -56,7 +52,7 @@ const ProDrawerForm = /*#__PURE__*/forwardRef((props, ref) => {
56
52
  source: 'ProDrawerForm'
57
53
  },
58
54
  children: open ? /*#__PURE__*/_jsx(DrawerModal, {
59
- ...restProps,
55
+ ...restPropsWithoutWidth,
60
56
  isView: nextIsView,
61
57
  open: open,
62
58
  form: form,
@@ -13,4 +13,40 @@ export const transformBySize = size => {
13
13
  default:
14
14
  return 960;
15
15
  }
16
+ };
17
+ const SIZE_PRESETS = ['small', 'middle', 'large'];
18
+
19
+ /**
20
+ * 解析最终尺寸
21
+ *
22
+ * - 显式传入(已废弃的)`width` 时打印警告并优先生效,保证向后兼容。
23
+ * - `size` 命中三档枚举走 `transformBySize`;否则视为自定义数字 / 像素 / 百分比直接返回。
24
+ */
25
+ export const resolveDrawerSize = (size, width) => {
26
+ if (width !== undefined && width !== '') {
27
+ // eslint-disable-next-line no-console
28
+ console.warn('[ProDrawerForm] `width` 已废弃,请改用 `size`');
29
+ return width;
30
+ }
31
+ if (SIZE_PRESETS.includes(size)) {
32
+ return transformBySize(size);
33
+ }
34
+ return size;
35
+ };
36
+
37
+ /**
38
+ * 关闭抽屉时是否需要弹出二次确认
39
+ *
40
+ * 判定「用户是否真实改动过」依据 userInteracted —— 它由抽屉内容容器上监听到的
41
+ * 真实用户输入事件(input / change)置位。打开后通过 setFieldsValue 异步回填
42
+ * 详情数据属于程序行为,不会派发这些用户事件,因此不会误触发二次确认。
43
+ */
44
+ export const shouldConfirmClose = params => {
45
+ const {
46
+ isView,
47
+ isConfirmClose,
48
+ userInteracted
49
+ } = params;
50
+ if (isView || !isConfirmClose) return false;
51
+ return userInteracted;
16
52
  };
@@ -2,7 +2,11 @@ import _isFunction from "lodash/isFunction";
2
2
  import { memo, useCallback } from 'react';
3
3
  import { Badge, Table } from 'antd';
4
4
  import useEditTableError from "../../utils/useEditTableError";
5
+
6
+ // 可编辑表格虚拟滚动的固定行高(px)。值取自单元格编辑态实际行高,
7
+ // 透传给内部 rc-virtual-list 用于高度计算,减少滚动时的行测量开销。
5
8
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
9
+ const VIRTUAL_ROW_HEIGHT = 65;
6
10
  const BaseTable = ({
7
11
  tableProps,
8
12
  ...resetProps
@@ -62,6 +66,12 @@ const BaseTable = ({
62
66
  'data-row-draggable': rowDraggable,
63
67
  onClick: () => {}
64
68
  }),
69
+ // 虚拟滚动场景下,透传固定行高给内部 rc-virtual-list,帮助其准确计算高度、
70
+ // 减少滚动时的行测量开销(antd 未导出该属性,但会透传到内部虚拟滚动)。
71
+ // 行高 65px 为可编辑表格单元格的固定高度;外部显式传入时以外部为准。
72
+ ...(resetProps?.virtual && resetProps?.listItemHeight == null ? {
73
+ listItemHeight: VIRTUAL_ROW_HEIGHT
74
+ } : {}),
65
75
  ...resetProps,
66
76
  rowKey: tableRowKey,
67
77
  summary,
@@ -70,7 +70,8 @@ const Summary = ({
70
70
  const {
71
71
  index,
72
72
  colSpan,
73
- prefix
73
+ prefix,
74
+ key: columnKey
74
75
  } = item;
75
76
  return /*#__PURE__*/_jsx(Table.Summary.Cell, {
76
77
  index: index,
@@ -80,7 +81,7 @@ const Summary = ({
80
81
  children: renderCell(item)
81
82
  })]
82
83
  })
83
- }, index);
84
+ }, columnKey ?? `summary-col-${index}`);
84
85
  })
85
86
  })
86
87
  });
@@ -16,7 +16,7 @@ import { tools, validate } from '@zat-design/utils';
16
16
  * @returns 随机字符串
17
17
  */
18
18
  export const getRandom = () => {
19
- return Math.random().toString(36).slice(-6);
19
+ return crypto.randomUUID().replace(/-/g, '').slice(0, 6);
20
20
  };
21
21
 
22
22
  /**
@@ -137,14 +137,17 @@ const ProEnum = props => {
137
137
  let list = [];
138
138
 
139
139
  // 优先使用组件内部自己传入的数据源或者请求得到的数据
140
- list = _cloneDeep(dataList && dataList.length ? dataList : enumLists);
141
- // 对数据进行一系列的过滤等操作
140
+ const sourceList = dataList && dataList.length ? dataList : enumLists;
141
+ // 仅在需要走 transformResponse 时才克隆,避免污染原始字典;
142
+ // 否则直接传引用(下游 ProSelect 等仅只读消费),减少滚动重挂载时的 cloneDeep 开销
142
143
  if (!useRequest?.service && transformResponse) {
143
- list = transformResponse(list);
144
+ list = transformResponse(_cloneDeep(sourceList));
144
145
  if (!Array.isArray(list)) {
145
146
  console.error(locale.ProEnum?.errorArrayMessage);
146
147
  list = [];
147
148
  }
149
+ } else {
150
+ list = sourceList;
148
151
  }
149
152
  if ( /*#__PURE__*/React.isValidElement(component)) {
150
153
  const Component = component;
@@ -182,13 +182,14 @@ const ActionButton = props => {
182
182
  align: "start",
183
183
  className: "pro-form-list-action",
184
184
  children: actionProps?.map(item => {
185
- if (item.show === false) return /*#__PURE__*/_jsx("span", {}, `${item?.type}${index}`);
185
+ const actionKey = `${field.key}-${item?.type ?? item?.label ?? 'action'}`;
186
+ if (item.show === false) return /*#__PURE__*/_jsx("span", {}, actionKey);
186
187
  if (_isFunction(item.show) && !item.show(form.getFieldValue(namePath), {
187
188
  namePath,
188
189
  index,
189
190
  form
190
191
  })) {
191
- return /*#__PURE__*/_jsx("span", {}, `${item?.type}${index}`);
192
+ return /*#__PURE__*/_jsx("span", {}, actionKey);
192
193
  }
193
194
  const {
194
195
  label,
@@ -295,7 +296,7 @@ const ActionButton = props => {
295
296
  onClick: e => e.stopPropagation(),
296
297
  children: label || defaultLabel
297
298
  })
298
- }, `${item?.type}${index}`) : /*#__PURE__*/_jsx(Button, {
299
+ }, actionKey) : /*#__PURE__*/_jsx(Button, {
299
300
  className: classNames({
300
301
  'pro-form-list-tool-btn': mode === 'line',
301
302
  'pro-form-list-tool-btn-block': mode === 'block',
@@ -313,7 +314,7 @@ const ActionButton = props => {
313
314
  }
314
315
  },
315
316
  children: label || defaultLabel
316
- }, `${item?.type}${index}`);
317
+ }, actionKey);
317
318
  }
318
319
  return needConfirm ? /*#__PURE__*/_jsx(Popconfirm, {
319
320
  title: title ?? `${locale.ProForm.formListConfirmMessage}`,
@@ -326,9 +327,9 @@ const ActionButton = props => {
326
327
  onClick: e => e.stopPropagation(),
327
328
  children: label
328
329
  })
329
- }, `${item?.type}${index}`) : /*#__PURE__*/_createElement(Button, {
330
+ }, actionKey) : /*#__PURE__*/_createElement(Button, {
330
331
  ..._omit(rest, filterKeys),
331
- key: `${item?.type}${index}`,
332
+ key: actionKey,
332
333
  type: "text",
333
334
  onClick: e => {
334
335
  e.stopPropagation();
@@ -108,7 +108,7 @@ const ToolbarButton = props => {
108
108
  return /*#__PURE__*/_jsx(Space, {
109
109
  align: "start",
110
110
  className: "pro-form-list-toolbar",
111
- children: toolbarProps?.map((item, index) => {
111
+ children: toolbarProps?.map(item => {
112
112
  if (item.show === false) return /*#__PURE__*/_jsx(_Fragment, {});
113
113
  if (_isFunction(item.show) && !item.show(form.getFieldValue(namePath), {
114
114
  namePath,
@@ -123,6 +123,7 @@ const ToolbarButton = props => {
123
123
  type,
124
124
  ...rest
125
125
  } = item;
126
+ const toolbarKey = `${namePath.join('.')}-${type ?? 'custom'}-${label ?? ''}`;
126
127
  const _onClick = onClick || onHandle;
127
128
  if (type === 'add') {
128
129
  if (disabled || isView) return /*#__PURE__*/_jsx(_Fragment, {});
@@ -141,14 +142,14 @@ const ToolbarButton = props => {
141
142
  type: "link",
142
143
  onClick: () => handleClick(internalOnClick, _onClick, item),
143
144
  children: label || defaultLabel
144
- }, `${type}${index}`);
145
+ }, toolbarKey);
145
146
  }
146
147
  return /*#__PURE__*/_jsx(Button, {
147
148
  ..._omit(rest, filterKeys),
148
149
  type: "link",
149
150
  onClick: () => customClick(onClick, item),
150
151
  children: label
151
- }, `${type}${index}`);
152
+ }, toolbarKey);
152
153
  })
153
154
  });
154
155
  };
@@ -16,6 +16,7 @@ import viewSvg from "../../../../assets/view.svg";
16
16
  import useRequestList from "./hooks/useRequestList";
17
17
  import locale from "../../../../locale";
18
18
  import { hideTooltipIfOpen } from "./utils";
19
+ import { mergeSelectedRows } from "./utils/mergeSelectedRows";
19
20
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
20
21
  const ProModalSelect = (props, ref) => {
21
22
  const {
@@ -80,7 +81,7 @@ const ProModalSelect = (props, ref) => {
80
81
  const isMultiple = type === 'checkbox';
81
82
 
82
83
  // 生成一个唯一id,用于满足tooltip功能
83
- const uuid = Math.random().toString(36).slice(-6);
84
+ const uuid = crypto.randomUUID().slice(0, 8);
84
85
 
85
86
  // 全局配置fieldNames指定 value与label的key
86
87
  const {
@@ -335,10 +336,14 @@ const ProModalSelect = (props, ref) => {
335
336
  };
336
337
  const _rowSelection = {
337
338
  type,
339
+ // 多选时开启,保证翻页/筛选后不丢弃不在当前页的已选 key
340
+ preserveSelectedRowKeys: isMultiple,
338
341
  onChange: (rowKeys, rows) => {
342
+ // 多选时合并跨页已选行:antd 回传的 rows 中不在当前页的为 undefined,用历史 selectedRows 补全
343
+ const nextSelectedRows = isMultiple ? mergeSelectedRows(selectedRows, rowKeys, rows, getRowKey) : rows;
339
344
  setState({
340
345
  selectedRowKeys: rowKeys,
341
- selectedRows: rows
346
+ selectedRows: nextSelectedRows
342
347
  });
343
348
  },
344
349
  getCheckboxProps: record => ({
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 合并跨页/筛选场景下的多选行数据
3
+ *
4
+ * antd Table 开启 preserveSelectedRowKeys 后,onChange 回传的 rowKeys 是全量(含不在当前页的 key),
5
+ * 但 rows 中不在当前 dataSource 的行对象会是 undefined。此函数用历史已选行(prevRows)补全这些缺失的行对象,
6
+ * 保证返回的 rows 与 rowKeys 全量对齐,从而避免翻页/精准筛选后丢失已选数据。
7
+ *
8
+ * @param prevRows 历史已选行(累积缓存)
9
+ * @param nextRowKeys antd 回传的全量选中 key
10
+ * @param nextRows antd 回传的行对象(不在当前页的为 undefined)
11
+ * @param getRowKey 取行 key 的方法
12
+ * @returns 与 nextRowKeys 对齐的全量行对象(无法找到行对象的 key 会被过滤)
13
+ */
14
+ export const mergeSelectedRows = (prevRows, nextRowKeys, nextRows, getRowKey) => {
15
+ // 用 key -> row 建立查找表:当前页最新行覆盖历史行
16
+ const rowMap = new Map();
17
+ prevRows?.forEach(row => {
18
+ if (row) rowMap.set(getRowKey(row), row);
19
+ });
20
+ nextRows?.forEach(row => {
21
+ if (row) rowMap.set(getRowKey(row), row);
22
+ });
23
+
24
+ // 按 nextRowKeys 顺序取行对象,取不到的(无缓存)过滤掉
25
+ return nextRowKeys.map(key => rowMap.get(key)).filter(Boolean);
26
+ };
@@ -184,6 +184,8 @@ const RenderFields = props => {
184
184
  ...defaultColProps,
185
185
  ...colProps
186
186
  };
187
+ const columnName = _formItemProps.name;
188
+ const fieldKey = (Array.isArray(columnName) ? columnName.join('.') : columnName) ?? _formItemProps.label ?? _type;
187
189
 
188
190
  // 其余参数收进对象里传给子组件 componentProps只包含子组件参数
189
191
  const otherProps = {
@@ -228,7 +230,7 @@ const RenderFields = props => {
228
230
  viewRender: viewRender,
229
231
  desensitization: desensitization
230
232
  })
231
- }, `${_formItemProps.name || _formItemProps.label}${index}`);
233
+ }, fieldKey != null && fieldKey !== '' ? String(fieldKey) : `column-${index}`);
232
234
  });
233
235
  return /*#__PURE__*/_jsx(_Fragment, {
234
236
  children: comList