@zat-design/sisyphus-react 4.0.0-beta.8 → 4.0.0

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 (443) hide show
  1. package/babel.config.js.backup +13 -0
  2. package/dist/index.esm.css +1 -1
  3. package/dist/less.esm.css +1 -1
  4. package/es/ProAction/index.js +14 -4
  5. package/es/ProConfigProvider/index.js +11 -2
  6. package/es/ProDownload/index.js +16 -5
  7. package/es/ProDownload/utils.js +8 -3
  8. package/es/ProDrawerForm/components/ProDrawer/index.js +14 -4
  9. package/es/ProDrawerForm/components/ProModal/index.js +14 -4
  10. package/es/ProDrawerForm/index.js +13 -3
  11. package/es/ProEditLabel/components/RenderProForm.js +5 -1
  12. package/es/ProEditLabel/index.js +16 -5
  13. package/es/ProEditTable/components/ActionButton/index.js +5 -1
  14. package/es/ProEditTable/components/RcTable/BaseTable.js +13 -3
  15. package/es/ProEditTable/components/RcTable/DraggableTable.js +12 -5
  16. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +7 -2
  17. package/es/ProEditTable/components/RenderField/index.js +54 -29
  18. package/es/ProEditTable/components/RenderToolbar/index.js +10 -4
  19. package/es/ProEditTable/index.js +16 -5
  20. package/es/ProEditTable/propsType.d.ts +12 -6
  21. package/es/ProEditTable/style/index.less +30 -3
  22. package/es/ProEditTable/utils/config.js +8 -3
  23. package/es/ProEditTable/utils/index.js +13 -9
  24. package/es/ProEditTable/utils/tools.js +22 -10
  25. package/es/ProEditTable/utils/useEditTableError.js +6 -1
  26. package/es/ProEditTable/utils/useShouldUpdateForTable.js +16 -7
  27. package/es/ProEnum/components/Group.js +6 -1
  28. package/es/ProEnum/components/Tag.js +6 -1
  29. package/es/ProEnum/hooks/useEnum.d.ts +8 -0
  30. package/es/ProEnum/hooks/useEnum.js +76 -4
  31. package/es/ProEnum/hooks/useEnumRequest.js +8 -3
  32. package/es/ProEnum/hooks/useFrequentEnumRequest.js +8 -3
  33. package/es/ProEnum/index.js +25 -15
  34. package/es/ProEnum/utils/eventCenter.js +3 -1
  35. package/es/ProEnum/utils/frequentEnum.js +5 -1
  36. package/es/ProEnum/utils/index.js +2 -1
  37. package/es/ProForm/components/FormFooter/index.js +5 -1
  38. package/es/ProForm/components/base/Checkbox/index.js +7 -2
  39. package/es/ProForm/components/base/DatePicker/index.js +7 -2
  40. package/es/ProForm/components/base/DatePicker/useDateLimit.js +6 -1
  41. package/es/ProForm/components/base/Input/index.js +7 -2
  42. package/es/ProForm/components/base/InputNumber/index.js +13 -3
  43. package/es/ProForm/components/base/Radio/index.js +7 -2
  44. package/es/ProForm/components/base/RangePicker/index.d.ts +7 -1
  45. package/es/ProForm/components/base/RangePicker/index.js +50 -4
  46. package/es/ProForm/components/base/RangePicker/useDateRange.js +6 -1
  47. package/es/ProForm/components/base/Select/index.js +7 -2
  48. package/es/ProForm/components/base/Switch/index.js +7 -2
  49. package/es/ProForm/components/base/SwitchCheckbox/index.js +7 -2
  50. package/es/ProForm/components/base/TextArea/index.js +7 -2
  51. package/es/ProForm/components/base/TimePicker/index.js +7 -2
  52. package/es/ProForm/components/combination/Container/index.js +5 -1
  53. package/es/ProForm/components/combination/Container/style/index.less +5 -0
  54. package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  55. package/es/ProForm/components/combination/FormList/components/ActionButton.js +94 -7
  56. package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  57. package/es/ProForm/components/combination/FormList/components/BlockFields.js +63 -6
  58. package/es/ProForm/components/combination/FormList/components/Empty.js +14 -4
  59. package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
  60. package/es/ProForm/components/combination/FormList/components/LineFields.js +9 -3
  61. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +48 -13
  62. package/es/ProForm/components/combination/FormList/index.js +108 -61
  63. package/es/ProForm/components/combination/FormList/propsType.d.ts +7 -2
  64. package/es/ProForm/components/combination/FormList/style/index.less +41 -0
  65. package/es/ProForm/components/combination/FormList/utils.d.ts +6 -0
  66. package/es/ProForm/components/combination/FormList/utils.js +17 -0
  67. package/es/ProForm/components/combination/Group/component/ComRender.d.ts +3 -0
  68. package/es/ProForm/components/combination/Group/component/ComRender.js +70 -3
  69. package/es/ProForm/components/combination/Group/component/FlexibleGroup.d.ts +10 -0
  70. package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +351 -0
  71. package/es/ProForm/components/combination/Group/hooks/index.d.ts +16 -1
  72. package/es/ProForm/components/combination/Group/hooks/index.js +107 -4
  73. package/es/ProForm/components/combination/Group/index.d.ts +3 -4
  74. package/es/ProForm/components/combination/Group/index.js +108 -24
  75. package/es/ProForm/components/combination/Group/propsType.d.ts +44 -1
  76. package/es/ProForm/components/combination/Group/style/index.less +425 -3
  77. package/es/ProForm/components/combination/Group/utils/index.d.ts +154 -0
  78. package/es/ProForm/components/combination/Group/utils/index.js +428 -0
  79. package/es/ProForm/components/combination/ProCascader/index.js +13 -3
  80. package/es/ProForm/components/combination/ProCascader/utils/index.js +7 -2
  81. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +14 -4
  82. package/es/ProForm/components/combination/ProModalSelect/index.js +16 -5
  83. package/es/ProForm/components/combination/ProNumberRange/index.js +24 -12
  84. package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +4 -0
  85. package/es/ProForm/components/combination/ProNumberRange/style/index.less +14 -7
  86. package/es/ProForm/components/combination/ProRangeLimit/index.js +13 -3
  87. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +6 -1
  88. package/es/ProForm/components/combination/ProTimeLimit/index.js +13 -3
  89. package/es/ProForm/components/render/ChangedWrapper.js +7 -2
  90. package/es/ProForm/components/render/ConfirmWrapper.js +10 -4
  91. package/es/ProForm/components/render/CustomComponentViewWrapper.d.ts +30 -0
  92. package/es/ProForm/components/render/CustomComponentViewWrapper.js +120 -0
  93. package/es/ProForm/components/render/Render.js +71 -16
  94. package/es/ProForm/components/render/RenderFields.js +7 -2
  95. package/es/ProForm/index.js +13 -3
  96. package/es/ProForm/propsType.d.ts +7 -0
  97. package/es/ProForm/style/index.less +11 -2
  98. package/es/ProForm/utils/index.js +7 -2
  99. package/es/ProForm/utils/rulesCreator.js +5 -1
  100. package/es/ProForm/utils/transformValue.js +5 -1
  101. package/es/ProForm/utils/useForm.js +15 -5
  102. package/es/ProForm/utils/useShouldUpdate.js +93 -35
  103. package/es/ProForm/utils/useWatch.js +9 -4
  104. package/es/ProForm/utils/valueType.js +11 -2
  105. package/es/ProIcon/index.js +13 -3
  106. package/es/ProIcon/utils/index.js +5 -1
  107. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +19 -14
  108. package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +6 -2
  109. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +48 -31
  110. package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +3 -12
  111. package/es/ProLayout/components/Layout/Notice/style/index.less +4 -0
  112. package/es/ProLayout/components/ProCollapse/index.js +5 -1
  113. package/es/ProLayout/components/ProCollapse/style/index.less +9 -9
  114. package/es/ProLayout/components/ProFooter/index.js +6 -2
  115. package/es/ProLayout/components/ProHeader/index.js +33 -19
  116. package/es/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +7 -0
  117. package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +100 -0
  118. package/es/ProLayout/components/TabsManager/components/TabItem.d.ts +26 -0
  119. package/es/ProLayout/components/TabsManager/components/TabItem.js +61 -0
  120. package/es/ProLayout/components/TabsManager/components/TabsContext.d.ts +6 -0
  121. package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -0
  122. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.d.ts +6 -0
  123. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +14 -0
  124. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.d.ts +18 -0
  125. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +26 -0
  126. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.d.ts +31 -0
  127. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +96 -0
  128. package/es/ProLayout/components/TabsManager/hooks/useTabsState.d.ts +5 -0
  129. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +364 -0
  130. package/es/ProLayout/components/TabsManager/index.d.ts +8 -0
  131. package/es/ProLayout/components/TabsManager/index.js +180 -0
  132. package/es/ProLayout/components/TabsManager/propTypes.d.ts +74 -0
  133. package/es/ProLayout/components/TabsManager/propTypes.js +16 -0
  134. package/es/ProLayout/components/TabsManager/style/index.less +179 -0
  135. package/es/ProLayout/components/TabsManager/utils/index.d.ts +38 -0
  136. package/es/ProLayout/components/TabsManager/utils/index.js +106 -0
  137. package/es/ProLayout/index.d.ts +21 -4
  138. package/es/ProLayout/index.js +107 -14
  139. package/es/ProLayout/propTypes.d.ts +139 -1
  140. package/es/ProLayout/propTypes.js +37 -1
  141. package/es/ProLayout/utils/index.js +16 -7
  142. package/es/ProSelect/components/AdaptiveTooltip.js +6 -1
  143. package/es/ProSelect/index.js +13 -3
  144. package/es/ProSelect/utils/index.js +3 -1
  145. package/es/ProStep/components/Item/index.js +8 -2
  146. package/es/ProStep/components/Listener/index.js +10 -4
  147. package/es/ProStep/components/Step/index.js +11 -2
  148. package/es/ProStep/index.js +16 -5
  149. package/es/ProStep/utils/index.js +5 -1
  150. package/es/ProStepTab/index.js +19 -8
  151. package/es/ProTable/components/FormatColumn/index.js +7 -2
  152. package/es/ProTable/components/RcTable/components/BaseTable/index.js +7 -2
  153. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +10 -4
  154. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +5 -1
  155. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +7 -2
  156. package/es/ProTable/components/RenderColumn/index.js +11 -2
  157. package/es/ProTable/components/RenderTabs/index.js +11 -2
  158. package/es/ProTable/components/TableResizable/index.js +13 -3
  159. package/es/ProTable/components/TooltipTitle/index.js +3 -5
  160. package/es/ProTable/hooks/useAntdTable.js +69 -35
  161. package/es/ProTable/index.js +16 -5
  162. package/es/ProTable/style/index.less +3 -0
  163. package/es/ProTable/utils/index.js +6 -1
  164. package/es/ProTabs/index.js +13 -3
  165. package/es/ProThemeTools/component/ProTools/index.js +11 -2
  166. package/es/ProThemeTools/context/ThemeContext.js +11 -2
  167. package/es/ProThemeTools/index.js +13 -3
  168. package/es/ProThemeTools/utils/index.js +5 -1
  169. package/es/ProTooltip/index.js +13 -3
  170. package/es/ProTree/components/CloseIcon.js +5 -1
  171. package/es/ProTree/components/List.js +7 -2
  172. package/es/ProTree/components/ProTree.js +16 -5
  173. package/es/ProTree/components/ProTreeSelect/index.js +119 -75
  174. package/es/ProTree/components/Tree.js +16 -5
  175. package/es/ProTree/index.js +5 -1
  176. package/es/ProTree/utils.js +8 -2
  177. package/es/ProTreeModal/components/Cascader.js +11 -2
  178. package/es/ProTreeModal/components/CloseIcon.js +5 -1
  179. package/es/ProTreeModal/components/List.js +6 -1
  180. package/es/ProTreeModal/components/SortableItem.js +5 -1
  181. package/es/ProTreeModal/components/Tree.js +13 -3
  182. package/es/ProTreeModal/components/Trigger.js +11 -2
  183. package/es/ProTreeModal/index.js +11 -2
  184. package/es/ProTreeModal/style/index.less +6 -0
  185. package/es/ProTreeModal/utils.js +8 -2
  186. package/es/ProUpload/components/ButtonRender.js +8 -3
  187. package/es/ProUpload/components/DragRender.d.ts +1 -0
  188. package/es/ProUpload/components/DragRender.js +10 -2
  189. package/es/ProUpload/components/DraggableUploadListItem.js +5 -1
  190. package/es/ProUpload/components/Example.js +11 -2
  191. package/es/ProUpload/components/ImageRender.js +14 -4
  192. package/es/ProUpload/index.js +17 -5
  193. package/es/ProUpload/propsType.d.ts +5 -0
  194. package/es/ProViewer/index.js +14 -4
  195. package/es/ProWaterMark/index.js +5 -1
  196. package/es/index.d.ts +1 -2
  197. package/es/index.js +1 -0
  198. package/es/locale/en_US.d.ts +9 -0
  199. package/es/locale/en_US.js +9 -0
  200. package/es/locale/zh_CN.d.ts +9 -0
  201. package/es/locale/zh_CN.js +9 -0
  202. package/es/style/theme/antd.less +11 -35
  203. package/es/utils/index.js +6 -1
  204. package/jest.config.js +3 -1
  205. package/lib/FormsProvider/index.js +2 -1
  206. package/lib/ProAction/index.js +20 -10
  207. package/lib/ProConfigProvider/index.js +29 -19
  208. package/lib/ProDownload/index.js +29 -17
  209. package/lib/ProDownload/utils.js +14 -12
  210. package/lib/ProDrawerForm/components/ProDrawer/index.js +27 -16
  211. package/lib/ProDrawerForm/components/ProModal/index.js +21 -10
  212. package/lib/ProDrawerForm/components/index.js +2 -2
  213. package/lib/ProDrawerForm/index.js +20 -9
  214. package/lib/ProEditLabel/components/RenderProForm.js +9 -6
  215. package/lib/ProEditLabel/index.js +30 -18
  216. package/lib/ProEditTable/components/ActionButton/index.js +14 -11
  217. package/lib/ProEditTable/components/RcTable/BaseTable.js +19 -9
  218. package/lib/ProEditTable/components/RcTable/DraggableTable.js +24 -16
  219. package/lib/ProEditTable/components/RcTable/index.js +2 -2
  220. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +16 -10
  221. package/lib/ProEditTable/components/RenderField/index.js +76 -50
  222. package/lib/ProEditTable/components/RenderToolbar/index.js +18 -12
  223. package/lib/ProEditTable/components/index.js +2 -2
  224. package/lib/ProEditTable/index.js +33 -21
  225. package/lib/ProEditTable/propsType.d.ts +12 -6
  226. package/lib/ProEditTable/style/index.less +30 -3
  227. package/lib/ProEditTable/utils/config.js +20 -15
  228. package/lib/ProEditTable/utils/index.js +22 -18
  229. package/lib/ProEditTable/utils/tools.js +30 -21
  230. package/lib/ProEditTable/utils/useEditTableError.js +7 -3
  231. package/lib/ProEditTable/utils/useShouldUpdateForTable.js +17 -9
  232. package/lib/ProEnum/components/Group.js +8 -3
  233. package/lib/ProEnum/components/Tag.js +8 -3
  234. package/lib/ProEnum/hooks/useEnum.d.ts +8 -0
  235. package/lib/ProEnum/hooks/useEnum.js +76 -4
  236. package/lib/ProEnum/hooks/useEnumRequest.js +23 -18
  237. package/lib/ProEnum/hooks/useFrequentEnumRequest.js +12 -8
  238. package/lib/ProEnum/index.js +37 -26
  239. package/lib/ProEnum/utils/eventCenter.js +4 -3
  240. package/lib/ProEnum/utils/frequentEnum.js +6 -3
  241. package/lib/ProEnum/utils/index.js +3 -3
  242. package/lib/ProForm/components/Container.js +1 -1
  243. package/lib/ProForm/components/FormFooter/index.js +11 -6
  244. package/lib/ProForm/components/base/Checkbox/index.js +13 -7
  245. package/lib/ProForm/components/base/DatePicker/index.js +11 -6
  246. package/lib/ProForm/components/base/DatePicker/useDateLimit.js +7 -3
  247. package/lib/ProForm/components/base/Input/index.js +11 -6
  248. package/lib/ProForm/components/base/InputNumber/index.js +21 -10
  249. package/lib/ProForm/components/base/Radio/index.js +10 -5
  250. package/lib/ProForm/components/base/RangePicker/index.d.ts +7 -1
  251. package/lib/ProForm/components/base/RangePicker/index.js +55 -9
  252. package/lib/ProForm/components/base/RangePicker/useDateRange.js +7 -3
  253. package/lib/ProForm/components/base/Select/index.js +10 -5
  254. package/lib/ProForm/components/base/Switch/index.js +10 -5
  255. package/lib/ProForm/components/base/SwitchCheckbox/index.js +12 -6
  256. package/lib/ProForm/components/base/TextArea/index.js +10 -5
  257. package/lib/ProForm/components/base/TimePicker/index.js +10 -5
  258. package/lib/ProForm/components/combination/Container/index.js +11 -6
  259. package/lib/ProForm/components/combination/Container/style/index.less +5 -0
  260. package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
  261. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +108 -20
  262. package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
  263. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +65 -8
  264. package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
  265. package/lib/ProForm/components/combination/FormList/components/Empty.js +17 -7
  266. package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
  267. package/lib/ProForm/components/combination/FormList/components/LineFields.js +11 -5
  268. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +58 -23
  269. package/lib/ProForm/components/combination/FormList/index.js +113 -65
  270. package/lib/ProForm/components/combination/FormList/propsType.d.ts +7 -2
  271. package/lib/ProForm/components/combination/FormList/style/index.less +41 -0
  272. package/lib/ProForm/components/combination/FormList/utils.d.ts +6 -0
  273. package/lib/ProForm/components/combination/FormList/utils.js +20 -2
  274. package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +1 -1
  275. package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +3 -0
  276. package/lib/ProForm/components/combination/Group/component/ComRender.js +79 -11
  277. package/lib/ProForm/components/combination/Group/component/FlexibleGroup.d.ts +10 -0
  278. package/lib/ProForm/components/combination/Group/component/FlexibleGroup.js +360 -0
  279. package/lib/ProForm/components/combination/Group/hooks/index.d.ts +16 -1
  280. package/lib/ProForm/components/combination/Group/hooks/index.js +111 -9
  281. package/lib/ProForm/components/combination/Group/index.d.ts +3 -4
  282. package/lib/ProForm/components/combination/Group/index.js +111 -27
  283. package/lib/ProForm/components/combination/Group/propsType.d.ts +44 -1
  284. package/lib/ProForm/components/combination/Group/style/index.less +425 -3
  285. package/lib/ProForm/components/combination/Group/utils/index.d.ts +154 -0
  286. package/lib/ProForm/components/combination/Group/utils/index.js +444 -0
  287. package/lib/ProForm/components/combination/ProCascader/index.js +20 -10
  288. package/lib/ProForm/components/combination/ProCascader/utils/index.js +9 -5
  289. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +25 -15
  290. package/lib/ProForm/components/combination/ProModalSelect/index.js +53 -41
  291. package/lib/ProForm/components/combination/ProNumberRange/index.js +28 -16
  292. package/lib/ProForm/components/combination/ProNumberRange/propsType.d.ts +4 -0
  293. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +14 -7
  294. package/lib/ProForm/components/combination/ProRangeLimit/index.js +29 -18
  295. package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +8 -3
  296. package/lib/ProForm/components/combination/ProTimeLimit/index.js +26 -15
  297. package/lib/ProForm/components/index.js +2 -2
  298. package/lib/ProForm/components/render/ChangedWrapper.js +16 -10
  299. package/lib/ProForm/components/render/ConfirmWrapper.js +19 -13
  300. package/lib/ProForm/components/render/CustomComponentViewWrapper.d.ts +30 -0
  301. package/lib/ProForm/components/render/CustomComponentViewWrapper.js +127 -0
  302. package/lib/ProForm/components/render/Render.js +93 -37
  303. package/lib/ProForm/components/render/RenderFields.js +15 -9
  304. package/lib/ProForm/index.js +23 -12
  305. package/lib/ProForm/propsType.d.ts +7 -0
  306. package/lib/ProForm/style/index.less +11 -2
  307. package/lib/ProForm/utils/index.js +12 -8
  308. package/lib/ProForm/utils/rulesCreator.js +8 -4
  309. package/lib/ProForm/utils/transformValue.js +6 -3
  310. package/lib/ProForm/utils/useFieldProps.js +2 -1
  311. package/lib/ProForm/utils/useForm.js +21 -12
  312. package/lib/ProForm/utils/useRules.js +1 -1
  313. package/lib/ProForm/utils/useShouldUpdate.js +94 -37
  314. package/lib/ProForm/utils/useWatch.js +11 -6
  315. package/lib/ProForm/utils/valueType.js +15 -6
  316. package/lib/ProIcon/index.js +26 -16
  317. package/lib/ProIcon/utils/index.js +7 -4
  318. package/lib/ProLayout/components/Layout/Header/index.js +1 -1
  319. package/lib/ProLayout/components/Layout/Icon/Icon.js +2 -1
  320. package/lib/ProLayout/components/Layout/Icon/index.js +1 -1
  321. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +24 -19
  322. package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +6 -2
  323. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +50 -33
  324. package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +3 -12
  325. package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +1 -1
  326. package/lib/ProLayout/components/Layout/Menu/index.js +1 -1
  327. package/lib/ProLayout/components/Layout/Notice/index.js +1 -1
  328. package/lib/ProLayout/components/Layout/Notice/style/index.less +4 -0
  329. package/lib/ProLayout/components/Layout/index.js +2 -2
  330. package/lib/ProLayout/components/ProCollapse/index.js +10 -6
  331. package/lib/ProLayout/components/ProCollapse/style/index.less +9 -9
  332. package/lib/ProLayout/components/ProFooter/index.js +8 -4
  333. package/lib/ProLayout/components/ProHeader/components/Copy/index.js +1 -1
  334. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +1 -1
  335. package/lib/ProLayout/components/ProHeader/components/index.js +2 -2
  336. package/lib/ProLayout/components/ProHeader/index.js +41 -27
  337. package/lib/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +7 -0
  338. package/lib/ProLayout/components/TabsManager/components/TabContextMenu.js +106 -0
  339. package/lib/ProLayout/components/TabsManager/components/TabItem.d.ts +26 -0
  340. package/lib/ProLayout/components/TabsManager/components/TabItem.js +67 -0
  341. package/lib/ProLayout/components/TabsManager/components/TabsContext.d.ts +6 -0
  342. package/lib/ProLayout/components/TabsManager/components/TabsContext.js +11 -0
  343. package/lib/ProLayout/components/TabsManager/hooks/useActiveTab.d.ts +6 -0
  344. package/lib/ProLayout/components/TabsManager/hooks/useActiveTab.js +20 -0
  345. package/lib/ProLayout/components/TabsManager/hooks/useProLayoutTabs.d.ts +18 -0
  346. package/lib/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +31 -0
  347. package/lib/ProLayout/components/TabsManager/hooks/useTabsCache.d.ts +31 -0
  348. package/lib/ProLayout/components/TabsManager/hooks/useTabsCache.js +103 -0
  349. package/lib/ProLayout/components/TabsManager/hooks/useTabsState.d.ts +5 -0
  350. package/lib/ProLayout/components/TabsManager/hooks/useTabsState.js +370 -0
  351. package/lib/ProLayout/components/TabsManager/index.d.ts +8 -0
  352. package/lib/ProLayout/components/TabsManager/index.js +183 -0
  353. package/lib/ProLayout/components/TabsManager/propTypes.d.ts +74 -0
  354. package/lib/ProLayout/components/TabsManager/propTypes.js +22 -0
  355. package/lib/ProLayout/components/TabsManager/style/index.less +179 -0
  356. package/lib/ProLayout/components/TabsManager/utils/index.d.ts +38 -0
  357. package/lib/ProLayout/components/TabsManager/utils/index.js +119 -0
  358. package/lib/ProLayout/components/index.js +2 -2
  359. package/lib/ProLayout/index.d.ts +21 -4
  360. package/lib/ProLayout/index.js +122 -21
  361. package/lib/ProLayout/propTypes.d.ts +139 -1
  362. package/lib/ProLayout/propTypes.js +40 -1
  363. package/lib/ProLayout/utils/index.js +18 -13
  364. package/lib/ProSelect/components/AdaptiveTooltip.js +7 -3
  365. package/lib/ProSelect/index.js +23 -12
  366. package/lib/ProSelect/utils/index.js +8 -8
  367. package/lib/ProStep/components/Anchor/index.js +1 -1
  368. package/lib/ProStep/components/Item/index.js +15 -9
  369. package/lib/ProStep/components/Listener/index.js +15 -9
  370. package/lib/ProStep/components/Step/index.js +17 -7
  371. package/lib/ProStep/index.js +30 -19
  372. package/lib/ProStep/utils/index.js +6 -3
  373. package/lib/ProStepTab/index.js +33 -22
  374. package/lib/ProTable/components/FormatColumn/index.js +22 -16
  375. package/lib/ProTable/components/RcTable/components/BaseTable/index.js +9 -5
  376. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +22 -16
  377. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +8 -5
  378. package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +11 -6
  379. package/lib/ProTable/components/RcTable/index.js +2 -2
  380. package/lib/ProTable/components/RenderColumn/index.js +17 -8
  381. package/lib/ProTable/components/RenderTabs/index.js +16 -7
  382. package/lib/ProTable/components/TableResizable/index.js +19 -9
  383. package/lib/ProTable/components/TooltipTitle/index.js +3 -6
  384. package/lib/ProTable/components/index.js +2 -2
  385. package/lib/ProTable/hooks/useAntdTable.js +94 -60
  386. package/lib/ProTable/index.js +41 -29
  387. package/lib/ProTable/style/index.less +3 -0
  388. package/lib/ProTable/utils/index.js +7 -3
  389. package/lib/ProTabs/components/index.js +2 -2
  390. package/lib/ProTabs/index.js +23 -12
  391. package/lib/ProThemeTools/component/ProTools/index.js +21 -11
  392. package/lib/ProThemeTools/component/index.js +2 -2
  393. package/lib/ProThemeTools/context/ThemeContext.js +20 -16
  394. package/lib/ProThemeTools/index.js +22 -12
  395. package/lib/ProThemeTools/utils/index.js +6 -3
  396. package/lib/ProTooltip/index.js +30 -20
  397. package/lib/ProTree/components/CloseIcon.js +6 -3
  398. package/lib/ProTree/components/List.js +10 -5
  399. package/lib/ProTree/components/ProTree.js +23 -12
  400. package/lib/ProTree/components/ProTreeSelect/index.js +138 -93
  401. package/lib/ProTree/components/SearchTitle.js +1 -1
  402. package/lib/ProTree/components/Tree.js +28 -16
  403. package/lib/ProTree/components/index.js +2 -2
  404. package/lib/ProTree/index.js +9 -5
  405. package/lib/ProTree/utils.js +16 -11
  406. package/lib/ProTreeModal/components/Cascader.js +14 -5
  407. package/lib/ProTreeModal/components/CloseIcon.js +6 -3
  408. package/lib/ProTreeModal/components/List.js +11 -7
  409. package/lib/ProTreeModal/components/SortableItem.js +10 -6
  410. package/lib/ProTreeModal/components/Tree.js +24 -13
  411. package/lib/ProTreeModal/components/Trigger.js +19 -9
  412. package/lib/ProTreeModal/components/index.js +2 -2
  413. package/lib/ProTreeModal/index.js +16 -6
  414. package/lib/ProTreeModal/style/index.less +6 -0
  415. package/lib/ProTreeModal/utils.js +17 -14
  416. package/lib/ProUpload/components/ButtonRender.js +14 -9
  417. package/lib/ProUpload/components/DragRender.d.ts +1 -0
  418. package/lib/ProUpload/components/DragRender.js +13 -5
  419. package/lib/ProUpload/components/DraggableUploadListItem.js +7 -3
  420. package/lib/ProUpload/components/Example.js +16 -6
  421. package/lib/ProUpload/components/FileItem.js +1 -1
  422. package/lib/ProUpload/components/ImageRender.js +20 -10
  423. package/lib/ProUpload/index.js +31 -18
  424. package/lib/ProUpload/propsType.d.ts +5 -0
  425. package/lib/ProViewer/index.js +22 -14
  426. package/lib/ProWaterMark/index.js +7 -3
  427. package/lib/index.d.ts +1 -2
  428. package/lib/index.js +4 -3
  429. package/lib/locale/en_US.d.ts +9 -0
  430. package/lib/locale/en_US.js +9 -0
  431. package/lib/locale/index.js +1 -1
  432. package/lib/locale/zh_CN.d.ts +9 -0
  433. package/lib/locale/zh_CN.js +9 -0
  434. package/lib/style/theme/antd.less +11 -35
  435. package/lib/utils/index.js +9 -4
  436. package/package.json +14 -17
  437. package/package.json.backup-antd5 +159 -0
  438. package/es/ProForm/components/combination/Group/utils.d.ts +0 -54
  439. package/es/ProForm/components/combination/Group/utils.js +0 -196
  440. package/es/assets/tip.svg +0 -1
  441. package/lib/ProForm/components/combination/Group/utils.d.ts +0 -54
  442. package/lib/ProForm/components/combination/Group/utils.js +0 -210
  443. package/lib/assets/tip.svg +0 -1
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { TabItem } from '../../../propTypes';
3
+ interface TabItemComponentProps {
4
+ tab: TabItem;
5
+ active: boolean;
6
+ onClick: () => void;
7
+ onClose: () => void;
8
+ onCloseOthers: () => void;
9
+ onCloseRight: () => void;
10
+ onCloseAll: () => void;
11
+ /** 所有标签页列表 */
12
+ tabsList?: TabItem[];
13
+ /** 自定义菜单项 */
14
+ menuItems?: import('antd').MenuProps['items'];
15
+ /** 自定义菜单项点击回调 */
16
+ tabMenuClick?: (params: {
17
+ key: string;
18
+ tab: TabItem;
19
+ tabs: TabItem[];
20
+ }) => void;
21
+ }
22
+ /**
23
+ * 单个标签页组件
24
+ */
25
+ declare const TabItemComponent: React.FC<TabItemComponentProps>;
26
+ export { TabItemComponent };
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import { CloseOutlined } from '@ant-design/icons';
3
+ import { TabContextMenu } from "./TabContextMenu";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ /**
7
+ * 单个标签页组件
8
+ */
9
+ var TabItemComponent = _ref => {
10
+ var tab = _ref.tab,
11
+ active = _ref.active,
12
+ onClick = _ref.onClick,
13
+ _onClose = _ref.onClose,
14
+ _onCloseOthers = _ref.onCloseOthers,
15
+ _onCloseRight = _ref.onCloseRight,
16
+ onCloseAll = _ref.onCloseAll,
17
+ _ref$tabsList = _ref.tabsList,
18
+ tabsList = _ref$tabsList === void 0 ? [] : _ref$tabsList,
19
+ menuItems = _ref.menuItems,
20
+ tabMenuClick = _ref.tabMenuClick;
21
+ var handleCloseClick = e => {
22
+ e.stopPropagation();
23
+ _onClose();
24
+ };
25
+ return /*#__PURE__*/_jsx(TabContextMenu, {
26
+ tabId: tab.id,
27
+ closable: tab.closable,
28
+ onClose: () => _onClose(),
29
+ onCloseOthers: () => _onCloseOthers(),
30
+ onCloseRight: () => _onCloseRight(),
31
+ onCloseAll: onCloseAll,
32
+ tab: tab,
33
+ tabs: tabsList,
34
+ menuItems: menuItems,
35
+ tabMenuClick: tabMenuClick,
36
+ children: /*#__PURE__*/_jsx("div", {
37
+ className: `pro-layout-tab-item ${active ? 'active' : ''} ${tab.closable ? 'closable' : ''}`,
38
+ onClick: onClick,
39
+ "data-testid": `tab-${tab.id}`,
40
+ children: /*#__PURE__*/_jsxs("div", {
41
+ className: "pro-layout-tab-content",
42
+ children: [tab.icon && /*#__PURE__*/_jsx("span", {
43
+ className: "pro-layout-tab-icon",
44
+ children: typeof tab.icon === 'string' ? /*#__PURE__*/_jsx("i", {
45
+ className: `iconfont ${tab.icon}`
46
+ }) : tab.icon
47
+ }), /*#__PURE__*/_jsx("span", {
48
+ className: "pro-layout-tab-title",
49
+ title: tab.title,
50
+ children: tab.title
51
+ }), tab.closable && /*#__PURE__*/_jsx("span", {
52
+ className: "pro-layout-tab-close",
53
+ onClick: handleCloseClick,
54
+ "data-testid": `tab-close-${tab.id}`,
55
+ children: /*#__PURE__*/_jsx(CloseOutlined, {})
56
+ })]
57
+ })
58
+ })
59
+ });
60
+ };
61
+ export { TabItemComponent };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import type { ProLayoutTabsInstance } from '../../../propTypes';
3
+ /**
4
+ * 标签页实例 Context,用于在 ProLayout children 中访问标签页 API
5
+ */
6
+ export declare const TabsContext: import("react").Context<ProLayoutTabsInstance>;
@@ -0,0 +1,5 @@
1
+ import { createContext } from 'react';
2
+ /**
3
+ * 标签页实例 Context,用于在 ProLayout children 中访问标签页 API
4
+ */
5
+ export var TabsContext = /*#__PURE__*/createContext(null);
@@ -0,0 +1,6 @@
1
+ import { TabItem } from '../../../propTypes';
2
+ /**
3
+ * 获取当前激活的 Tab 信息 Hook
4
+ * @returns 当前激活的 Tab 对象,如果没有激活则返回 undefined
5
+ */
6
+ export declare const useActiveTab: () => TabItem | undefined;
@@ -0,0 +1,14 @@
1
+ import { useContext, useMemo } from 'react';
2
+ import { TabsContext } from "../components/TabsContext";
3
+
4
+ /**
5
+ * 获取当前激活的 Tab 信息 Hook
6
+ * @returns 当前激活的 Tab 对象,如果没有激活则返回 undefined
7
+ */
8
+ export var useActiveTab = () => {
9
+ var tabsInstance = useContext(TabsContext);
10
+ return useMemo(() => {
11
+ if (!tabsInstance) return undefined;
12
+ return tabsInstance.getTabInfo().activeTabInfo;
13
+ }, [tabsInstance]);
14
+ };
@@ -0,0 +1,18 @@
1
+ import type { ProLayoutTabsInstance } from '../../../propTypes';
2
+ /**
3
+ * @description 获取 ProLayout 标签页实例的 Hook(类似 Form.useForm)
4
+ * @returns [ProLayoutTabsInstance] 标签页实例
5
+ * @example
6
+ * ```tsx
7
+ * // 在 ProLayout children 中使用
8
+ * const [layoutTabs] = useProLayoutTabs();
9
+ *
10
+ * // 使用实例方法
11
+ * layoutTabs.addTab({
12
+ * code: 'PolicyInput',
13
+ * name: '投保单录入',
14
+ * extra: { customData: '自定义数据' }
15
+ * });
16
+ * ```
17
+ */
18
+ export declare function useProLayoutTabs(): [ProLayoutTabsInstance];
@@ -0,0 +1,26 @@
1
+ import { useContext } from 'react';
2
+ import { TabsContext } from "../components/TabsContext";
3
+
4
+ /**
5
+ * @description 获取 ProLayout 标签页实例的 Hook(类似 Form.useForm)
6
+ * @returns [ProLayoutTabsInstance] 标签页实例
7
+ * @example
8
+ * ```tsx
9
+ * // 在 ProLayout children 中使用
10
+ * const [layoutTabs] = useProLayoutTabs();
11
+ *
12
+ * // 使用实例方法
13
+ * layoutTabs.addTab({
14
+ * code: 'PolicyInput',
15
+ * name: '投保单录入',
16
+ * extra: { customData: '自定义数据' }
17
+ * });
18
+ * ```
19
+ */
20
+ export function useProLayoutTabs() {
21
+ var context = useContext(TabsContext);
22
+ if (!context) {
23
+ throw new Error('useProLayoutTabs must be used within ProLayout with mode="tabs"');
24
+ }
25
+ return [context];
26
+ }
@@ -0,0 +1,31 @@
1
+ import { TabsState } from '../../../propTypes';
2
+ import { TabsCacheManager } from '../propTypes';
3
+ /**
4
+ * 简化的标签页缓存管理器
5
+ */
6
+ declare class SimpleTabsCache implements TabsCacheManager {
7
+ private cacheKey;
8
+ private storage;
9
+ constructor(keyPrefix: string, strategy: 'localStorage' | 'sessionStorage');
10
+ /** 保存标签页状态 */
11
+ save(state: TabsState): void;
12
+ /** 恢复标签页状态 */
13
+ restore(): TabsState | null;
14
+ /** 清空缓存 */
15
+ clear(): void;
16
+ }
17
+ interface UseTabsCacheOptions {
18
+ cacheKey: string;
19
+ storage: 'localStorage' | 'sessionStorage';
20
+ enabled?: boolean;
21
+ }
22
+ /**
23
+ * 标签页缓存管理Hook
24
+ */
25
+ export declare const useTabsCache: (options: UseTabsCacheOptions) => {
26
+ saveToCache: (state: TabsState) => void;
27
+ restoreFromCache: () => TabsState | null;
28
+ clearCache: () => void;
29
+ cacheManager: SimpleTabsCache;
30
+ };
31
+ export {};
@@ -0,0 +1,96 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ import { useCallback, useMemo } from 'react';
7
+ /**
8
+ * 简化的标签页缓存管理器
9
+ */
10
+ class SimpleTabsCache {
11
+ constructor(keyPrefix, strategy) {
12
+ _defineProperty(this, "cacheKey", void 0);
13
+ _defineProperty(this, "storage", void 0);
14
+ this.cacheKey = `${keyPrefix}_tabs_cache`;
15
+ this.storage = strategy === 'localStorage' ? localStorage : sessionStorage;
16
+ }
17
+
18
+ /** 保存标签页状态 */
19
+ save(state) {
20
+ try {
21
+ var cacheData = _objectSpread(_objectSpread({}, state), {}, {
22
+ timestamp: Date.now()
23
+ });
24
+ this.storage.setItem(this.cacheKey, JSON.stringify(cacheData));
25
+ } catch (error) {
26
+ console.warn('标签页缓存保存失败:', error);
27
+ }
28
+ }
29
+
30
+ /** 恢复标签页状态 */
31
+ restore() {
32
+ try {
33
+ var cached = this.storage.getItem(this.cacheKey);
34
+ if (!cached) return null;
35
+ var cacheData = JSON.parse(cached);
36
+ // 移除时间戳字段
37
+ delete cacheData.timestamp;
38
+ return cacheData;
39
+ } catch (error) {
40
+ console.warn('标签页缓存恢复失败:', error);
41
+ return null;
42
+ }
43
+ }
44
+
45
+ /** 清空缓存 */
46
+ clear() {
47
+ try {
48
+ this.storage.removeItem(this.cacheKey);
49
+ } catch (error) {
50
+ console.warn('标签页缓存清空失败:', error);
51
+ }
52
+ }
53
+ }
54
+ /**
55
+ * 标签页缓存管理Hook
56
+ */
57
+ export var useTabsCache = options => {
58
+ var cacheKey = options.cacheKey,
59
+ storage = options.storage,
60
+ _options$enabled = options.enabled,
61
+ enabled = _options$enabled === void 0 ? true : _options$enabled;
62
+
63
+ // 创建缓存管理器实例
64
+ var cacheManager = useMemo(() => {
65
+ if (!enabled) return null;
66
+ return new SimpleTabsCache(cacheKey, storage);
67
+ }, [cacheKey, storage, enabled]);
68
+
69
+ // 保存状态到缓存
70
+ var saveToCache = useCallback(state => {
71
+ if (cacheManager) {
72
+ cacheManager.save(state);
73
+ }
74
+ }, [cacheManager]);
75
+
76
+ // 从缓存恢复状态
77
+ var restoreFromCache = useCallback(() => {
78
+ if (cacheManager) {
79
+ return cacheManager.restore();
80
+ }
81
+ return null;
82
+ }, [cacheManager]);
83
+
84
+ // 清空缓存
85
+ var clearCache = useCallback(() => {
86
+ if (cacheManager) {
87
+ cacheManager.clear();
88
+ }
89
+ }, [cacheManager]);
90
+ return {
91
+ saveToCache,
92
+ restoreFromCache,
93
+ clearCache,
94
+ cacheManager
95
+ };
96
+ };
@@ -0,0 +1,5 @@
1
+ import { UseTabsStateOptions, UseTabsStateReturn } from '../propTypes';
2
+ /**
3
+ * 标签页状态管理Hook
4
+ */
5
+ export declare const useTabsState: (options: UseTabsStateOptions) => UseTabsStateReturn;
@@ -0,0 +1,364 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
11
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
+ import { useState, useCallback, useEffect, useRef } from 'react';
13
+ import { DEFAULT_TABS_CONFIG } from "../propTypes";
14
+ import { useTabsCache } from "./useTabsCache";
15
+ import { createTabFromMenu, generateTabId, shouldOpenExternal, handleExternalOpen, checkTabLimit, getRightTabs, flattenMenuData, isLeafMenuItem } from "../utils";
16
+
17
+ /**
18
+ * 标签页状态管理Hook
19
+ */
20
+ export var useTabsState = options => {
21
+ var _options$initialState = options.initialState,
22
+ initialState = _options$initialState === void 0 ? {} : _options$initialState,
23
+ config = options.config,
24
+ dataSource = options.dataSource;
25
+
26
+ // 合并默认配置
27
+ var finalConfig = _objectSpread(_objectSpread({}, DEFAULT_TABS_CONFIG), config);
28
+
29
+ // 初始化状态
30
+ var _useState = useState(() => _objectSpread({
31
+ tabsList: [],
32
+ activeKey: '',
33
+ activeTabInfo: undefined,
34
+ newTabIndex: 0,
35
+ activeComponent: ''
36
+ }, initialState)),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ state = _useState2[0],
39
+ setState = _useState2[1];
40
+
41
+ // 缓存管理
42
+ var _useTabsCache = useTabsCache({
43
+ cacheKey: finalConfig.cacheKey,
44
+ storage: finalConfig.storage,
45
+ enabled: true
46
+ }),
47
+ saveToCache = _useTabsCache.saveToCache,
48
+ restoreFromCache = _useTabsCache.restoreFromCache,
49
+ clearCache = _useTabsCache.clearCache;
50
+
51
+ // 初始化标记,确保只在初始化后保存缓存
52
+ var _useState3 = useState(false),
53
+ _useState4 = _slicedToArray(_useState3, 2),
54
+ isInitialized = _useState4[0],
55
+ setIsInitialized = _useState4[1];
56
+
57
+ // 从缓存恢复状态
58
+ useEffect(() => {
59
+ var cachedState = restoreFromCache();
60
+ if (cachedState && cachedState.tabsList && cachedState.tabsList.length > 0) {
61
+ // 兼容旧缓存:如果缓存中有 activeTab 但没有 activeTabInfo,进行迁移
62
+ var restoredState = _objectSpread({}, cachedState);
63
+ if ('activeTab' in restoredState && !restoredState.activeTabInfo) {
64
+ restoredState.activeTabInfo = restoredState.activeTab;
65
+ delete restoredState.activeTab;
66
+ }
67
+ setState(restoredState);
68
+ }
69
+ setIsInitialized(true);
70
+ }, [restoreFromCache]);
71
+ var lastActiveKeyRef = useRef('');
72
+ var shouldSkipSaveRef = useRef(false);
73
+
74
+ // 保存状态到缓存
75
+ useEffect(() => {
76
+ if (!isInitialized) return;
77
+
78
+ // 如果标记了跳过保存(清空缓存后),则跳过本次保存
79
+ if (shouldSkipSaveRef.current) {
80
+ shouldSkipSaveRef.current = false;
81
+ return;
82
+ }
83
+
84
+ // 处理 onTabChange 调用 - 支持空状态和正常切换
85
+ if (finalConfig.onTabChange && lastActiveKeyRef.current !== state.activeKey) {
86
+ lastActiveKeyRef.current = state.activeKey;
87
+ if (state.activeKey) {
88
+ // 正常的标签页切换
89
+ var activeTab = state.tabsList.find(tab => tab.id === state.activeKey);
90
+ if (activeTab) {
91
+ finalConfig.onTabChange(state.activeKey, activeTab, state.tabsList);
92
+ }
93
+ } else {
94
+ // 空状态 - 所有标签页都被关闭
95
+ finalConfig.onTabChange('', undefined, state.tabsList);
96
+ }
97
+ }
98
+
99
+ // 如果 tabsList 为空且 activeKey 为空,说明是清空状态,不保存缓存
100
+ if (state.tabsList.length === 0 && !state.activeKey) {
101
+ return;
102
+ }
103
+
104
+ // 保存状态到缓存
105
+ saveToCache(state);
106
+ }, [state, saveToCache, finalConfig, isInitialized]);
107
+
108
+ /**
109
+ * 添加标签页
110
+ */
111
+ var addTab = useCallback((menuItem, options) => {
112
+ var _ref = options || {},
113
+ _ref$forceNew = _ref.forceNew,
114
+ forceNew = _ref$forceNew === void 0 ? false : _ref$forceNew;
115
+ setState(prevState => {
116
+ // 只有最后一级菜单(叶子节点)才能添加标签页
117
+ if (!isLeafMenuItem(menuItem)) {
118
+ return prevState;
119
+ }
120
+
121
+ // 检查是否需要外部跳转
122
+ if (shouldOpenExternal(menuItem)) {
123
+ handleExternalOpen(menuItem);
124
+ return prevState;
125
+ }
126
+ var existingIds = prevState.tabsList.map(tab => tab.id);
127
+ var tabId = generateTabId(menuItem, existingIds);
128
+
129
+ // 如果 forceNew = false(默认),检查是否已存在相同的标签页
130
+ if (!forceNew) {
131
+ var existingTab = prevState.tabsList.find(tab => {
132
+ var _tab$menuItem;
133
+ return ((_tab$menuItem = tab.menuItem) === null || _tab$menuItem === void 0 ? void 0 : _tab$menuItem.code) === menuItem.code || tab.url === menuItem.url;
134
+ });
135
+ if (existingTab) {
136
+ var _existingTab$menuItem;
137
+ // 如果已存在,直接切换到该标签页
138
+ var _newState = _objectSpread(_objectSpread({}, prevState), {}, {
139
+ activeKey: existingTab.id,
140
+ activeTabInfo: existingTab,
141
+ activeComponent: ((_existingTab$menuItem = existingTab.menuItem) === null || _existingTab$menuItem === void 0 ? void 0 : _existingTab$menuItem.code) || existingTab.id
142
+ });
143
+ return _newState;
144
+ }
145
+ }
146
+
147
+ // 检查是否超出限制
148
+ if (checkTabLimit(prevState.tabsList, finalConfig.max)) {
149
+ // 达到最大值时,不添加新标签页,直接返回
150
+ return prevState;
151
+ }
152
+
153
+ // 创建新标签页
154
+ var newTab = createTabFromMenu(menuItem, prevState.newTabIndex);
155
+ newTab.id = tabId;
156
+ var newState = _objectSpread(_objectSpread({}, prevState), {}, {
157
+ tabsList: [...prevState.tabsList, newTab],
158
+ activeKey: tabId,
159
+ activeTabInfo: newTab,
160
+ newTabIndex: prevState.newTabIndex + 1,
161
+ activeComponent: menuItem.code || tabId
162
+ });
163
+ return newState;
164
+ });
165
+ }, [finalConfig]);
166
+
167
+ /**
168
+ * 移除标签页
169
+ */
170
+ var removeTab = useCallback(tabId => {
171
+ setState(prevState => {
172
+ var tabToRemove = prevState.tabsList.find(tab => tab.id === tabId);
173
+ if (!tabToRemove || !tabToRemove.closable) {
174
+ return prevState;
175
+ }
176
+ var newTabs = prevState.tabsList.filter(tab => tab.id !== tabId);
177
+ var newActiveKey = prevState.activeKey;
178
+ var newActiveTabInfo = prevState.activeTabInfo;
179
+ var newActiveComponent = prevState.activeComponent;
180
+
181
+ // 如果移除的是当前活跃标签页,需要选择新的活跃标签页
182
+ if (prevState.activeKey === tabId && newTabs.length > 0) {
183
+ var _newActiveTabInfo$men;
184
+ var currentIndex = prevState.tabsList.findIndex(tab => tab.id === tabId);
185
+ var newActiveIndex = Math.min(currentIndex, newTabs.length - 1);
186
+ newActiveTabInfo = newTabs[newActiveIndex];
187
+ newActiveKey = newActiveTabInfo.id;
188
+ newActiveComponent = ((_newActiveTabInfo$men = newActiveTabInfo.menuItem) === null || _newActiveTabInfo$men === void 0 ? void 0 : _newActiveTabInfo$men.code) || newActiveTabInfo.id;
189
+ } else if (prevState.activeKey === tabId) {
190
+ // 如果删除后没有标签页了
191
+ newActiveKey = '';
192
+ newActiveTabInfo = undefined;
193
+ newActiveComponent = '';
194
+ }
195
+
196
+ // 如果删除后没有标签页了,清空缓存
197
+ if (newTabs.length === 0) {
198
+ // 标记跳过下次保存,避免清空后又被重新保存
199
+ shouldSkipSaveRef.current = true;
200
+ clearCache();
201
+
202
+ // 直接调用 onTabChange,因为 useEffect 会被跳过
203
+ if (finalConfig.onTabChange) {
204
+ setTimeout(() => {
205
+ finalConfig.onTabChange('', undefined, []);
206
+ }, 0);
207
+ }
208
+ }
209
+ return _objectSpread(_objectSpread({}, prevState), {}, {
210
+ tabsList: newTabs,
211
+ activeKey: newActiveKey,
212
+ activeTabInfo: newActiveTabInfo,
213
+ activeComponent: newActiveComponent
214
+ });
215
+ });
216
+ }, [clearCache, finalConfig]);
217
+
218
+ /**
219
+ * 切换标签页
220
+ */
221
+ var switchTab = useCallback(tabId => {
222
+ setState(prevState => {
223
+ var _targetTab$menuItem;
224
+ var targetTab = prevState.tabsList.find(tab => tab.id === tabId);
225
+ if (!targetTab) return prevState;
226
+ var newState = _objectSpread(_objectSpread({}, prevState), {}, {
227
+ activeKey: tabId,
228
+ activeTabInfo: targetTab,
229
+ activeComponent: ((_targetTab$menuItem = targetTab.menuItem) === null || _targetTab$menuItem === void 0 ? void 0 : _targetTab$menuItem.code) || tabId
230
+ });
231
+ return newState;
232
+ });
233
+ }, []);
234
+
235
+ /**
236
+ * 关闭其他标签页
237
+ */
238
+ var closeOtherTabs = useCallback(currentTabId => {
239
+ setState(prevState => {
240
+ var _currentTab$menuItem;
241
+ var currentTab = prevState.tabsList.find(tab => tab.id === currentTabId);
242
+ if (!currentTab) return prevState;
243
+
244
+ // 只保留当前标签页和不可关闭的标签页
245
+ var newTabs = prevState.tabsList.filter(tab => tab.id === currentTabId || !tab.closable);
246
+ return _objectSpread(_objectSpread({}, prevState), {}, {
247
+ tabsList: newTabs,
248
+ activeKey: currentTabId,
249
+ activeTabInfo: currentTab,
250
+ activeComponent: ((_currentTab$menuItem = currentTab.menuItem) === null || _currentTab$menuItem === void 0 ? void 0 : _currentTab$menuItem.code) || currentTabId
251
+ });
252
+ });
253
+ }, []);
254
+
255
+ /**
256
+ * 关闭右侧标签页
257
+ */
258
+ var closeRightTabs = useCallback(currentTabId => {
259
+ setState(prevState => {
260
+ var rightTabs = getRightTabs(prevState.tabsList, currentTabId);
261
+ var tabsToKeep = prevState.tabsList.filter(tab => !rightTabs.includes(tab) || !tab.closable);
262
+ return _objectSpread(_objectSpread({}, prevState), {}, {
263
+ tabsList: tabsToKeep
264
+ });
265
+ });
266
+ }, []);
267
+
268
+ /**
269
+ * 关闭全部标签页
270
+ */
271
+ var closeAllTabs = useCallback(() => {
272
+ setState(prevState => {
273
+ // 只保留不可关闭的标签页
274
+ var newTabs = prevState.tabsList.filter(tab => !tab.closable);
275
+ var newActiveKey = '';
276
+ var newActiveComponent = '';
277
+ if (newTabs.length > 0) {
278
+ var _firstTab$menuItem;
279
+ var firstTab = newTabs[0];
280
+ newActiveKey = firstTab.id;
281
+ newActiveComponent = ((_firstTab$menuItem = firstTab.menuItem) === null || _firstTab$menuItem === void 0 ? void 0 : _firstTab$menuItem.code) || firstTab.id;
282
+ }
283
+
284
+ // 关闭全部标签页时,清空缓存
285
+ // 标记跳过下次保存,避免清空后又被重新保存
286
+ shouldSkipSaveRef.current = true;
287
+ clearCache();
288
+
289
+ // 如果关闭后没有标签页了,直接调用 onTabChange
290
+ if (newTabs.length === 0 && finalConfig.onTabChange) {
291
+ setTimeout(() => {
292
+ finalConfig.onTabChange('', undefined, []);
293
+ }, 0);
294
+ }
295
+ return _objectSpread(_objectSpread({}, prevState), {}, {
296
+ tabsList: newTabs,
297
+ activeKey: newActiveKey,
298
+ activeTabInfo: undefined,
299
+ activeComponent: newActiveComponent
300
+ });
301
+ });
302
+ }, [clearCache, finalConfig]);
303
+
304
+ /**
305
+ * 重置状态
306
+ */
307
+ var resetTabs = useCallback(() => {
308
+ setState({
309
+ tabsList: [],
310
+ activeKey: '',
311
+ newTabIndex: 0,
312
+ activeComponent: ''
313
+ });
314
+ }, []);
315
+
316
+ // 监听 URL 变化并同步 Tabs (仅在初始化和 location 变化时)
317
+ // 放在最后以确保可以使用 addTab 和 switchTab
318
+ useEffect(() => {
319
+ // 确保数据源存在
320
+ if (!dataSource || !('menus' in dataSource)) return;
321
+ var currentPath = window.location.pathname;
322
+
323
+ // 如果当前没有 activeKey 或者 activeKey 对应的 URL 与当前 URL 不一致
324
+ var activeTab = state.tabsList.find(tab => tab.id === state.activeKey);
325
+
326
+ // 如果当前已经在正确的 Tab 上,无需处理
327
+ if (activeTab && activeTab.url === currentPath) return;
328
+
329
+ // 在菜单中查找当前 URL 对应的菜单项
330
+ var flatMenus = flattenMenuData(dataSource.menus || []);
331
+ var targetMenu = flatMenus.find(item => item.url === currentPath);
332
+ if (targetMenu) {
333
+ // 只有最后一级菜单(叶子节点)才能添加标签页
334
+ if (!isLeafMenuItem(targetMenu)) {
335
+ return;
336
+ }
337
+
338
+ // 检查是否已在 Tabs 中
339
+ var existingTab = state.tabsList.find(tab => {
340
+ var _tab$menuItem2;
341
+ return ((_tab$menuItem2 = tab.menuItem) === null || _tab$menuItem2 === void 0 ? void 0 : _tab$menuItem2.code) === targetMenu.code || tab.url === targetMenu.url;
342
+ });
343
+ if (existingTab) {
344
+ // 如果已存在,切换到该 Tab
345
+ if (state.activeKey !== existingTab.id) {
346
+ switchTab(existingTab.id);
347
+ }
348
+ } else {
349
+ // 如果不存在,添加新 Tab
350
+ addTab(targetMenu);
351
+ }
352
+ }
353
+ }, [dataSource, state.tabsList, state.activeKey, addTab, switchTab]);
354
+ return {
355
+ state,
356
+ addTab,
357
+ removeTab,
358
+ switchTab,
359
+ closeOtherTabs,
360
+ closeRightTabs,
361
+ closeAllTabs,
362
+ resetTabs
363
+ };
364
+ };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { TabsManagerProps } from './propTypes';
3
+ import './style/index.less';
4
+ /**
5
+ * 标签页管理器主组件
6
+ */
7
+ declare const TabsManager: import("react").ForwardRefExoticComponent<TabsManagerProps & import("react").RefAttributes<any>>;
8
+ export default TabsManager;