@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
@@ -30,7 +30,7 @@
30
30
  height: 48px;
31
31
  font-size: var(--zaui-font-size-lg, 16px);
32
32
  border-bottom: 1px solid var(--zaui-line, #dddddd);
33
- .pro-step-menu-name{
33
+ .pro-step-menu-name {
34
34
  margin-left: 8px;
35
35
  }
36
36
  > .anticon {
@@ -1,91 +1,65 @@
1
- import _pick from "lodash/pick";
2
- import scrollIntoView from 'scroll-into-view-if-needed';
3
- const toCssLength = value => typeof value === 'number' ? `${value}px` : value;
4
-
5
- /**
6
- * 滚动到错误位置, 延迟200ms解决ProForm错误还未生成
7
- */
8
- export const handleScrollError = (dom, root = document) => {
1
+ import pick from "lodash/pick";
2
+ import scrollIntoView from "scroll-into-view-if-needed";
3
+ const toCssLength = (value) => typeof value === "number" ? `${value}px` : value;
4
+ const handleScrollError = (dom, root = document) => {
9
5
  setTimeout(() => {
10
6
  const errorDom = dom || root.querySelector('[class*="form-item-has-error"]');
11
7
  if (errorDom) {
12
8
  scrollIntoView(errorDom, {
13
- behavior: 'smooth',
14
- block: 'center',
15
- scrollMode: 'if-needed'
9
+ behavior: "smooth",
10
+ block: "center",
11
+ scrollMode: "if-needed"
16
12
  });
17
13
  }
18
14
  }, 200);
19
15
  };
20
-
21
- /**
22
- * 处理滚动到指定元素位置, 如发现有错误, 则优先滚动到错误位置
23
- * @param id 目标元素的ID
24
- * @param options 滚动选项
25
- */
26
- export const handleScroll = (id, options) => {
27
- const {
28
- targetOffset,
29
- scrollToError,
30
- root = document,
31
- target
32
- } = options || {};
33
- const dom = target || Array.from(root.querySelectorAll('.pro-step-item')).find(item => item.id === id);
16
+ const handleScroll = (id, options) => {
17
+ const { targetOffset, scrollToError, root = document, target } = options || {};
18
+ const dom = target || Array.from(root.querySelectorAll(".pro-step-item")).find((item) => item.id === id);
34
19
  if (dom) {
35
- // 查找指定id下的错误表单项
36
20
  const errorDom = dom.querySelector('[class*="form-item-has-error"]');
37
21
  if (errorDom && scrollToError) {
38
- // 如果发现错误表单项,执行handleScrollError函数
39
22
  handleScrollError(errorDom);
40
23
  } else {
41
- // 目录点击必须重新对齐到 sticky 区域下方,不能因“当前可见”而跳过。
42
24
  const previousScrollMarginTop = dom.style.scrollMarginTop;
43
- if (targetOffset !== undefined && targetOffset !== null) {
25
+ if (targetOffset !== void 0 && targetOffset !== null) {
44
26
  dom.style.scrollMarginTop = toCssLength(targetOffset);
45
27
  }
46
28
  try {
47
29
  scrollIntoView(dom, {
48
30
  // compute-scroll-into-view 已计算 scroll-margin;custom behavior 避免外层库再次扣减。
49
- behavior: actions => {
50
- actions.forEach(({
51
- el,
52
- top,
53
- left
54
- }) => {
55
- el.scroll({
56
- top,
57
- left,
58
- behavior: 'smooth'
59
- });
31
+ behavior: (actions) => {
32
+ actions.forEach(({ el, top, left }) => {
33
+ el.scroll({ top, left, behavior: "smooth" });
60
34
  });
61
35
  },
62
- block: 'start',
63
- scrollMode: 'always'
36
+ block: "start",
37
+ scrollMode: "always"
64
38
  });
65
39
  } finally {
66
- if (targetOffset !== undefined && targetOffset !== null) {
40
+ if (targetOffset !== void 0 && targetOffset !== null) {
67
41
  dom.style.scrollMarginTop = previousScrollMarginTop;
68
42
  }
69
43
  }
70
44
  }
71
45
  }
72
46
  };
73
-
74
- /**
75
- * 获取加载模块数据信息
76
- * @param registerMap 注册映射对象
77
- * @returns 模块加载状态列表
78
- */
79
- export const getLoadedMap = registerMap => {
80
- if (!registerMap?.current) {
47
+ const getLoadedMap = (registerMap) => {
48
+ if (!(registerMap == null ? void 0 : registerMap.current)) {
81
49
  return [];
82
50
  }
83
- const stepList = Object.values(registerMap?.current).map(item => {
51
+ const stepList = Object.values(registerMap == null ? void 0 : registerMap.current).map((item) => {
84
52
  return {
85
- ..._pick(item, ['id', 'order', 'title']),
86
- loaded: !document.querySelector(`.${item?.id}-placeholder`)
53
+ ...pick(item, ["id", "order", "title"]),
54
+ loaded: !document.querySelector(`.${item == null ? void 0 : item.id}-placeholder`)
87
55
  };
88
56
  });
89
57
  return stepList;
90
58
  };
91
- export default handleScroll;
59
+ var utils_default = handleScroll;
60
+ export {
61
+ utils_default as default,
62
+ getLoadedMap,
63
+ handleScroll,
64
+ handleScrollError
65
+ };
@@ -1,19 +1,11 @@
1
- import _isNaN from "lodash/isNaN";
2
- import React, { useState, useCallback, useEffect, createContext, useContext } from 'react';
3
- // 存储当前的 StepTab 实例
4
- const StepTabInstanceContext = /*#__PURE__*/createContext(null);
5
-
6
- /**
7
- * 使用原生 JS 获取 URL 搜索参数
8
- * @returns 当前 URL 的搜索参数和路径
9
- */
1
+ import React, { useState, useCallback, useEffect, createContext, useContext } from "react";
2
+ import isNaN from "lodash/isNaN";
3
+ const StepTabInstanceContext = createContext(null);
10
4
  const useNativeLocation = () => {
11
5
  const [location, setLocation] = useState({
12
6
  search: window.location.search,
13
7
  pathname: window.location.pathname
14
8
  });
15
-
16
- // 监听 popstate 事件,更新 location 状态
17
9
  useEffect(() => {
18
10
  const handleLocationChange = () => {
19
11
  setLocation({
@@ -21,24 +13,17 @@ const useNativeLocation = () => {
21
13
  pathname: window.location.pathname
22
14
  });
23
15
  };
24
- window.addEventListener('popstate', handleLocationChange);
16
+ window.addEventListener("popstate", handleLocationChange);
25
17
  return () => {
26
- window.removeEventListener('popstate', handleLocationChange);
18
+ window.removeEventListener("popstate", handleLocationChange);
27
19
  };
28
20
  }, []);
29
21
  return location;
30
22
  };
31
-
32
- /**
33
- * 步骤化Tab管理钩子,用于管理多步骤表单或流程的切换和验证
34
- *
35
- * @param {ProStepTabType} props 配置参数
36
- * @returns {ProStepTabResultType} 返回步骤Tab相关方法和状态
37
- */
38
- export function useStepTab(props = {}) {
23
+ function useStepTab(props = {}) {
39
24
  const {
40
25
  routerKeep = false,
41
- routerSearchKey = 'tab',
26
+ routerSearchKey = "tab",
42
27
  validate = true,
43
28
  onBeforeChange,
44
29
  onAfterChange,
@@ -47,12 +32,8 @@ export function useStepTab(props = {}) {
47
32
  queueSteps,
48
33
  autoNext = false
49
34
  } = props;
50
-
51
- // 内部状态,避免全局污染
52
35
  const [handlesState, setHandlesState] = useState({});
53
36
  const location = useNativeLocation();
54
-
55
- // 获取初始激活的tab key
56
37
  const getInitialActiveKey = useCallback(() => {
57
38
  if (routerKeep) {
58
39
  const urlSearchParams = new URLSearchParams(location.search);
@@ -61,40 +42,30 @@ export function useStepTab(props = {}) {
61
42
  return tabValue;
62
43
  }
63
44
  }
64
- return defaultActiveKey || '1';
45
+ return defaultActiveKey || "1";
65
46
  }, [routerKeep, routerSearchKey, location.search, defaultActiveKey]);
66
-
67
- // 获取初始激活的步骤
68
47
  const getInitialStep = useCallback(() => {
69
48
  if (routerKeep) {
70
49
  const urlSearchParams = new URLSearchParams(location.search);
71
50
  const stepValue = urlSearchParams.get(routerSearchKey);
72
- // 如果stepValue是数字,则返回数字
73
- if (stepValue && !_isNaN(Number(stepValue))) {
51
+ if (stepValue && !isNaN(Number(stepValue))) {
74
52
  return Number(stepValue);
75
53
  }
76
54
  }
77
55
  return defaultStep;
78
56
  }, [routerKeep, routerSearchKey, location.search, defaultStep]);
79
57
  const [activeKey, setActiveKeyState] = useState(getInitialActiveKey());
80
- const [step, setStepState] = useState(getInitialStep()); // 当前已激活步骤
58
+ const [step, setStepState] = useState(getInitialStep());
81
59
  const [loading, setLoading] = useState(false);
82
-
83
- // 同步URL参数
84
60
  useEffect(() => {
85
61
  if (routerKeep && activeKey) {
86
- // 更新URL参数
87
62
  const urlSearchParams = new URLSearchParams(location.search);
88
63
  urlSearchParams.set(routerSearchKey, activeKey);
89
-
90
- // 使用原生 history API 更新 URL
91
64
  const newUrl = `${location.pathname}?${urlSearchParams.toString()}`;
92
- window.history.replaceState(null, '', newUrl);
65
+ window.history.replaceState(null, "", newUrl);
93
66
  }
94
67
  }, [activeKey, routerKeep, routerSearchKey, location]);
95
-
96
- // 创建一个包装函数,自动处理loading状态
97
- const wrapHandleWithLoading = useCallback(fn => {
68
+ const wrapHandleWithLoading = useCallback((fn) => {
98
69
  return async () => {
99
70
  setLoading(true);
100
71
  try {
@@ -107,82 +78,72 @@ export function useStepTab(props = {}) {
107
78
  }
108
79
  };
109
80
  }, []);
110
-
111
- // 注册步骤处理函数
112
- const registerHandle = useCallback((key, handler) => {
113
- // 使用wrapHandleWithLoading包装处理函数
114
- setHandlesState(prev => ({
115
- ...prev,
116
- [key]: wrapHandleWithLoading(handler)
117
- }));
118
- }, [wrapHandleWithLoading]);
119
-
120
- // 获取步骤处理函数
121
- const getHandle = useCallback(key => {
122
- return handlesState[key];
123
- }, [handlesState]);
124
-
125
- // 处理表单验证和切换(内部使用)
126
- const validateAndChange = useCallback(async targetKey => {
127
- if (targetKey === activeKey) return true;
128
- try {
129
- // 执行当前步骤的保存处理, 如果validate为true,则执行验证
130
- const currentHandler = handlesState[activeKey];
131
- if (currentHandler && validate) {
132
- const handleResult = await currentHandler();
133
- if (!handleResult) {
134
- return false;
81
+ const registerHandle = useCallback(
82
+ (key, handler) => {
83
+ setHandlesState((prev) => ({
84
+ ...prev,
85
+ [key]: wrapHandleWithLoading(handler)
86
+ }));
87
+ },
88
+ [wrapHandleWithLoading]
89
+ );
90
+ const getHandle = useCallback(
91
+ (key) => {
92
+ return handlesState[key];
93
+ },
94
+ [handlesState]
95
+ );
96
+ const validateAndChange = useCallback(
97
+ async (targetKey) => {
98
+ if (targetKey === activeKey)
99
+ return true;
100
+ try {
101
+ const currentHandler = handlesState[activeKey];
102
+ if (currentHandler && validate) {
103
+ const handleResult = await currentHandler();
104
+ if (!handleResult) {
105
+ return false;
106
+ }
135
107
  }
136
- }
137
-
138
- // 执行切换前回调
139
- if (onBeforeChange) {
140
- const beforeResult = await onBeforeChange(activeKey, targetKey);
141
- if (beforeResult === false) {
142
- return false;
108
+ if (onBeforeChange) {
109
+ const beforeResult = await onBeforeChange(activeKey, targetKey);
110
+ if (beforeResult === false) {
111
+ return false;
112
+ }
113
+ }
114
+ setActiveKeyState(targetKey);
115
+ if (onAfterChange) {
116
+ onAfterChange(targetKey);
143
117
  }
118
+ return true;
119
+ } catch (error) {
120
+ console.error("Tab切换验证失败:", error);
121
+ return false;
144
122
  }
145
-
146
- // 更新激活的key
147
- setActiveKeyState(targetKey);
148
-
149
- // 执行切换后回调
150
- if (onAfterChange) {
151
- onAfterChange(targetKey);
123
+ },
124
+ [activeKey, validate, onBeforeChange, onAfterChange, handlesState]
125
+ );
126
+ const setCheckActiveKey = useCallback(
127
+ async (targetKey, validate2) => {
128
+ if (validate2 === false) {
129
+ setActiveKeyState(targetKey);
130
+ return true;
152
131
  }
153
- return true;
154
- } catch (error) {
155
- // 验证失败
156
- console.error('Tab切换验证失败:', error);
157
- return false;
158
- }
159
- }, [activeKey, validate, onBeforeChange, onAfterChange, handlesState]);
160
-
161
- // 设置激活的key
162
- const setCheckActiveKey = useCallback(async (targetKey, validate) => {
163
- if (validate === false) {
164
- setActiveKeyState(targetKey);
165
- return true;
166
- }
167
- // 执行表单验证和切换
168
- return validateAndChange(targetKey);
169
- }, [validateAndChange]);
170
-
171
- // 执行当前步骤处理函数
132
+ return validateAndChange(targetKey);
133
+ },
134
+ [validateAndChange]
135
+ );
172
136
  const saveHandle = useCallback(async () => {
173
137
  const handler = handlesState[activeKey];
174
138
  if (handler) {
175
139
  const result = await handler();
176
- // 添加autoNext功能
177
140
  if (result && autoNext) {
178
- // 只有当activeKey能转换为数字时才执行自动跳转
179
141
  const currentKeyNum = Number(activeKey);
180
- if (!_isNaN(currentKeyNum)) {
142
+ if (!isNaN(currentKeyNum)) {
181
143
  let nextKey = String(currentKeyNum + 1);
182
144
  if (Number(nextKey) > queueSteps) {
183
145
  nextKey = String(queueSteps);
184
146
  }
185
- // 自动跳转到下一个tab
186
147
  await setCheckActiveKey(nextKey, false);
187
148
  }
188
149
  }
@@ -193,16 +154,15 @@ export function useStepTab(props = {}) {
193
154
  }
194
155
  return Promise.resolve(true);
195
156
  }, [activeKey, handlesState, autoNext, queueSteps, setCheckActiveKey]);
196
-
197
- // 拦截setStep, 最大值是queueSteps
198
- const setStep = useCallback(step => {
199
- if (step > queueSteps) {
200
- return;
201
- }
202
- setStepState(step);
203
- }, [queueSteps]);
204
-
205
- // 重置handles,用于清空或组件卸载时调用
157
+ const setStep = useCallback(
158
+ (step2) => {
159
+ if (step2 > queueSteps) {
160
+ return;
161
+ }
162
+ setStepState(step2);
163
+ },
164
+ [queueSteps]
165
+ );
206
166
  const resetHandles = useCallback(() => {
207
167
  setHandlesState({});
208
168
  }, []);
@@ -221,36 +181,21 @@ export function useStepTab(props = {}) {
221
181
  };
222
182
  return stepTabInstance;
223
183
  }
224
-
225
- /**
226
- * 在子组件中获取父级 StepTab 实例的钩子
227
- * @returns {ProStepTabResultType} 步骤Tab实例
228
- */
229
- export function useStepTabInstance() {
184
+ function useStepTabInstance() {
230
185
  const context = useContext(StepTabInstanceContext);
231
186
  if (context === null) {
232
- throw new Error('useStepTabInstance must be used inside a ProStepTab component');
187
+ throw new Error("useStepTabInstance must be used inside a ProStepTab component");
233
188
  }
234
189
  return context;
235
190
  }
236
-
237
- // 扩展FC类型,添加静态方法
238
-
239
- /**
240
- * ProStepTab 组件
241
- */
242
- const ProStepTab = ({
243
- children,
244
- ...rest
245
- }) => {
191
+ const ProStepTab = ({ children, ...rest }) => {
246
192
  const stepTabInstance = useStepTab(rest);
247
- return /*#__PURE__*/React.createElement(StepTabInstanceContext.Provider, {
248
- value: stepTabInstance
249
- }, children);
193
+ return React.createElement(StepTabInstanceContext.Provider, { value: stepTabInstance }, children);
250
194
  };
251
-
252
- // 将 useStepTabInstance 挂载到 ProStepTab 上作为静态方法
253
195
  ProStepTab.useStepTabInstance = useStepTabInstance;
254
-
255
- // 导出默认组件
256
- export default ProStepTab;
196
+ var ProStepTab_default = ProStepTab;
197
+ export {
198
+ ProStepTab_default as default,
199
+ useStepTab,
200
+ useStepTabInstance
201
+ };
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +1,11 @@
1
- import { EditOutlined } from '@ant-design/icons';
2
- import classNames from 'classnames';
3
- import React from 'react';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- const EditIcon = ({
6
- onClick
7
- }) => {
8
- const cls = classNames('pro-table-editable-cell-edit-icon');
9
- return /*#__PURE__*/_jsx("span", {
10
- className: cls,
11
- onClick: onClick,
12
- children: /*#__PURE__*/_jsx(EditOutlined, {})
13
- });
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { EditOutlined } from "@ant-design/icons";
3
+ import classNames from "classnames";
4
+ const EditIcon = ({ onClick }) => {
5
+ const cls = classNames("pro-table-editable-cell-edit-icon");
6
+ return /* @__PURE__ */ jsx("span", { className: cls, onClick, children: /* @__PURE__ */ jsx(EditOutlined, {}) });
7
+ };
8
+ var EditIcon_default = EditIcon;
9
+ export {
10
+ EditIcon_default as default
14
11
  };
15
- export default EditIcon;
@@ -1,10 +1,10 @@
1
- import _isEqual from "lodash/isEqual";
2
- import React, { useState, useRef } from 'react';
3
- import { Form } from 'antd';
4
- import classNames from 'classnames';
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState, useRef } from "react";
3
+ import { Form } from "antd";
4
+ import classNames from "classnames";
5
+ import isEqual from "lodash/isEqual";
5
6
  import * as componentMap from "../../../ProForm/components";
6
7
  import EditIcon from "./EditIcon";
7
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const InternalCell = ({
9
9
  value,
10
10
  record,
@@ -17,19 +17,10 @@ const InternalCell = ({
17
17
  }) => {
18
18
  const [editing, setEditing] = useState(false);
19
19
  const snapshotRef = useRef(value);
20
- const {
21
- type = 'Input',
22
- fieldProps = {},
23
- rules,
24
- required,
25
- valueType
26
- } = editConfig;
27
- const {
28
- onBlur: onBlurCallback,
29
- ...restFieldProps
30
- } = fieldProps;
20
+ const { type = "Input", fieldProps = {}, rules, required, valueType } = editConfig;
21
+ const { onBlur: onBlurCallback, ...restFieldProps } = fieldProps;
31
22
  const Component = componentMap[type] ?? componentMap.Input;
32
- const wrapperClassName = classNames('pro-table-editable-cell-wrapper');
23
+ const wrapperClassName = classNames("pro-table-editable-cell-wrapper");
33
24
  const handleEditIconClick = () => {
34
25
  snapshotRef.current = value;
35
26
  form.setFieldValue(fieldName, value);
@@ -39,7 +30,7 @@ const InternalCell = ({
39
30
  try {
40
31
  await form.validateFields([fieldName]);
41
32
  const newValue = form.getFieldValue(fieldName);
42
- if (_isEqual(newValue, snapshotRef.current)) {
33
+ if (isEqual(newValue, snapshotRef.current)) {
43
34
  setEditing(false);
44
35
  return;
45
36
  }
@@ -53,69 +44,44 @@ const InternalCell = ({
53
44
  }
54
45
  setEditing(false);
55
46
  } catch {
56
- // Validation failed - stay in edit mode
57
47
  }
58
48
  };
59
49
  if (!editing) {
60
- return /*#__PURE__*/_jsxs("span", {
61
- className: wrapperClassName,
62
- children: [/*#__PURE__*/_jsx("span", {
63
- children: displayContent ?? '-'
64
- }), /*#__PURE__*/_jsx(EditIcon, {
65
- onClick: handleEditIconClick
66
- })]
67
- });
50
+ return /* @__PURE__ */ jsxs("span", { className: wrapperClassName, children: [
51
+ /* @__PURE__ */ jsx("span", { children: displayContent ?? "-" }),
52
+ /* @__PURE__ */ jsx(EditIcon, { onClick: handleEditIconClick })
53
+ ] });
68
54
  }
69
- const formItem = /*#__PURE__*/_jsx(Form.Item, {
70
- name: fieldName,
71
- rules: rules,
72
- required: required,
73
- noStyle: true,
74
- children: /*#__PURE__*/_jsx(Component, {
75
- ...restFieldProps,
76
- valueType: valueType,
77
- autoFocus: true,
78
- onBlur: handleBlur
79
- })
80
- });
55
+ const formItem = /* @__PURE__ */ jsx(Form.Item, { name: fieldName, rules, required, noStyle: true, children: /* @__PURE__ */ jsx(Component, { ...restFieldProps, valueType, autoFocus: true, onBlur: handleBlur }) });
81
56
  if (!wrapInForm) {
82
57
  return formItem;
83
58
  }
84
- return /*#__PURE__*/_jsx(Form, {
85
- form: form,
86
- component: false,
87
- children: formItem
88
- });
59
+ return /* @__PURE__ */ jsx(Form, { form, component: false, children: formItem });
89
60
  };
90
- const PerCellEditableCell = props => {
61
+ const PerCellEditableCell = (props) => {
91
62
  const [form] = Form.useForm();
92
- const fieldName = Array.isArray(props.dataIndex) ? props.dataIndex.join('_') : props.dataIndex;
93
- return /*#__PURE__*/_jsx(InternalCell, {
94
- ...props,
95
- form: form,
96
- fieldName: fieldName,
97
- wrapInForm: true
98
- });
63
+ const fieldName = Array.isArray(props.dataIndex) ? props.dataIndex.join("_") : props.dataIndex;
64
+ return /* @__PURE__ */ jsx(InternalCell, { ...props, form, fieldName, wrapInForm: true });
99
65
  };
100
- const SharedFormEditableCell = props => {
101
- const fieldName = props.sharedFieldName ?? (Array.isArray(props.dataIndex) ? props.dataIndex.join('_') : props.dataIndex);
102
- return /*#__PURE__*/_jsx(InternalCell, {
103
- ...props,
104
- form: props.sharedForm,
105
- fieldName: fieldName,
106
- wrapInForm: false
107
- });
66
+ const SharedFormEditableCell = (props) => {
67
+ const fieldName = props.sharedFieldName ?? (Array.isArray(props.dataIndex) ? props.dataIndex.join("_") : props.dataIndex);
68
+ return /* @__PURE__ */ jsx(
69
+ InternalCell,
70
+ {
71
+ ...props,
72
+ form: props.sharedForm,
73
+ fieldName,
74
+ wrapInForm: false
75
+ }
76
+ );
108
77
  };
109
- const EditableCell = props => {
110
- // editMode 默认 'per-cell-form',与重构前完全一致
111
- // 'shared-form':外层 ProTable 提供共享 Form,跳过内部 useForm
112
- if (props.editMode === 'shared-form' && props.sharedForm) {
113
- return /*#__PURE__*/_jsx(SharedFormEditableCell, {
114
- ...props
115
- });
78
+ const EditableCell = (props) => {
79
+ if (props.editMode === "shared-form" && props.sharedForm) {
80
+ return /* @__PURE__ */ jsx(SharedFormEditableCell, { ...props });
116
81
  }
117
- return /*#__PURE__*/_jsx(PerCellEditableCell, {
118
- ...props
119
- });
82
+ return /* @__PURE__ */ jsx(PerCellEditableCell, { ...props });
83
+ };
84
+ var EditableCell_default = EditableCell;
85
+ export {
86
+ EditableCell_default as default
120
87
  };
121
- export default EditableCell;
@@ -1 +0,0 @@
1
- export {};