@zat-design/sisyphus-react 3.14.0-beta.2 → 4.0.0-beta.10

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 (545) hide show
  1. package/README.md +77 -207
  2. package/babel.config.js +2 -2
  3. package/dist/index.esm.css +1 -1
  4. package/dist/less.esm.css +1 -1
  5. package/es/FormsProvider/index.d.ts +4 -1
  6. package/es/ProAction/components/CheckModalContent/index.js +0 -9
  7. package/es/ProAction/index.js +3 -6
  8. package/es/ProAction/index.less +0 -2
  9. package/es/ProConfigProvider/index.d.ts +22 -5
  10. package/es/ProConfigProvider/index.js +58 -26
  11. package/es/ProDownload/index.js +2 -3
  12. package/es/ProDownload/style/index.less +0 -2
  13. package/es/ProDownload/utils.js +3 -4
  14. package/es/ProDrawerForm/components/ProDrawer/index.js +13 -17
  15. package/es/ProDrawerForm/components/ProModal/index.js +12 -20
  16. package/es/ProDrawerForm/index.d.ts +2 -1
  17. package/es/ProDrawerForm/index.js +35 -33
  18. package/es/ProDrawerForm/propsType.d.ts +7 -18
  19. package/es/ProDrawerForm/style/index.less +6 -14
  20. package/es/ProEditLabel/components/RenderProForm.js +2 -3
  21. package/es/ProEditLabel/index.js +10 -15
  22. package/es/ProEditLabel/propsType.d.ts +1 -6
  23. package/es/ProEditLabel/style/index.less +2 -3
  24. package/es/ProEditTable/components/ActionButton/index.js +5 -8
  25. package/es/ProEditTable/components/RcTable/BaseTable.js +70 -53
  26. package/es/ProEditTable/components/RcTable/DraggableTable.js +70 -49
  27. package/es/ProEditTable/components/RcTable/index.d.ts +0 -2
  28. package/es/ProEditTable/components/RcTable/index.js +1 -3
  29. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +9 -12
  30. package/es/ProEditTable/components/RenderField/index.d.ts +3 -2
  31. package/es/ProEditTable/components/RenderField/index.js +401 -241
  32. package/es/ProEditTable/components/RenderToolbar/index.js +5 -5
  33. package/es/ProEditTable/components/Summary/index.js +5 -8
  34. package/es/ProEditTable/components/Validator/index.js +3 -6
  35. package/es/ProEditTable/index.js +99 -103
  36. package/es/ProEditTable/propsType.d.ts +7 -7
  37. package/es/ProEditTable/style/index.less +12 -12
  38. package/es/ProEditTable/utils/config.js +6 -7
  39. package/es/ProEditTable/utils/index.js +21 -17
  40. package/es/ProEditTable/utils/useEditTableError.js +12 -4
  41. package/es/ProEditTable/utils/useShouldUpdateForTable.d.ts +15 -0
  42. package/es/ProEditTable/utils/useShouldUpdateForTable.js +132 -0
  43. package/es/ProEnum/hooks/useEnum.js +5 -0
  44. package/es/ProEnum/hooks/useEnumRequest.js +3 -3
  45. package/es/ProEnum/index.js +10 -17
  46. package/es/ProEnum/style/index.less +0 -2
  47. package/es/ProEnum/utils/index.d.ts +1 -0
  48. package/es/ProEnum/utils/index.js +3 -7
  49. package/es/ProForm/components/Container.d.ts +1 -0
  50. package/es/ProForm/components/Container.js +2 -3
  51. package/es/ProForm/components/FormFooter/index.js +18 -19
  52. package/es/ProForm/components/FormFooter/propsType.d.ts +2 -0
  53. package/es/ProForm/components/base/Checkbox/index.js +3 -4
  54. package/es/ProForm/components/base/DatePicker/index.d.ts +1 -3
  55. package/es/ProForm/components/base/DatePicker/index.js +7 -7
  56. package/es/ProForm/components/base/DatePicker/useDateLimit.d.ts +3 -0
  57. package/es/ProForm/components/base/DatePicker/useDateLimit.js +11 -0
  58. package/es/ProForm/components/base/Input/index.js +10 -8
  59. package/es/ProForm/components/base/InputNumber/index.js +3 -6
  60. package/es/ProForm/components/base/Radio/index.js +3 -4
  61. package/es/ProForm/components/base/RangePicker/index.js +7 -6
  62. package/es/ProForm/components/base/RangePicker/useDateRange.d.ts +5 -5
  63. package/es/ProForm/components/base/Select/index.js +2 -3
  64. package/es/ProForm/components/base/Switch/index.js +2 -3
  65. package/es/ProForm/components/base/SwitchCheckbox/index.js +2 -3
  66. package/es/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
  67. package/es/ProForm/components/base/TextArea/index.js +3 -4
  68. package/es/ProForm/components/base/TextArea/index.less +10 -2
  69. package/es/ProForm/components/base/TimePicker/index.d.ts +1 -2
  70. package/es/ProForm/components/base/TimePicker/index.js +6 -7
  71. package/es/ProForm/components/base/TimePicker/style/index.less +3 -3
  72. package/es/ProForm/components/combination/Container/style/index.less +0 -2
  73. package/es/ProForm/components/combination/FormList/components/ActionButton.js +15 -13
  74. package/es/ProForm/components/combination/FormList/components/BlockFields.js +5 -8
  75. package/es/ProForm/components/combination/FormList/components/Empty.js +2 -3
  76. package/es/ProForm/components/combination/FormList/components/LineFields.js +2 -3
  77. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +5 -8
  78. package/es/ProForm/components/combination/FormList/index.js +2 -3
  79. package/es/ProForm/components/combination/FormList/style/index.less +36 -2
  80. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +1 -0
  81. package/es/ProForm/components/combination/Group/component/ComRender.js +0 -1
  82. package/es/ProForm/components/combination/Group/index.js +3 -4
  83. package/es/ProForm/components/combination/Group/style/index.less +7 -87
  84. package/es/ProForm/components/combination/Group/utils.d.ts +1 -1
  85. package/es/ProForm/components/combination/Group/utils.js +4 -5
  86. package/es/ProForm/components/combination/ProCascader/index.js +13 -15
  87. package/es/ProForm/components/combination/ProCascader/propsType.d.ts +1 -1
  88. package/es/ProForm/components/combination/ProCascader/style/index.less +0 -2
  89. package/es/ProForm/components/combination/ProModalSelect/index.d.ts +1 -1
  90. package/es/ProForm/components/combination/ProModalSelect/index.js +24 -39
  91. package/es/ProForm/components/combination/ProModalSelect/style/index.less +11 -15
  92. package/es/ProForm/components/combination/ProNumberRange/index.d.ts +3 -2
  93. package/es/ProForm/components/combination/ProNumberRange/index.js +21 -21
  94. package/es/ProForm/components/combination/ProNumberRange/style/index.less +3 -54
  95. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -23
  96. package/es/ProForm/components/combination/ProRangeLimit/index.js +42 -25
  97. package/es/ProForm/components/combination/ProRangeLimit/propsType.d.ts +23 -0
  98. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +3 -2
  99. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +14 -2
  100. package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +5 -6
  101. package/es/ProForm/components/combination/ProTimeLimit/index.js +23 -20
  102. package/es/ProForm/components/combination/ProTimeLimit/style/index.less +64 -6
  103. package/es/ProForm/components/index.d.ts +2 -9
  104. package/es/ProForm/components/index.js +1 -11
  105. package/es/ProForm/components/render/ChangedWrapper.js +8 -9
  106. package/es/ProForm/components/render/ConfirmWrapper.js +7 -7
  107. package/es/ProForm/components/render/Render.js +29 -30
  108. package/es/ProForm/components/render/RenderFields.d.ts +1 -0
  109. package/es/ProForm/components/render/RenderFields.js +6 -3
  110. package/es/ProForm/components/render/propsType.d.ts +3 -6
  111. package/es/ProForm/index.d.ts +2 -2
  112. package/es/ProForm/index.js +14 -42
  113. package/es/ProForm/propsType.d.ts +3 -0
  114. package/es/ProForm/style/index.less +4 -16
  115. package/es/ProForm/utils/index.d.ts +15 -1
  116. package/es/ProForm/utils/index.js +66 -15
  117. package/es/ProForm/utils/useDeepCompareMemo.js +4 -4
  118. package/es/ProForm/utils/useForm.js +27 -22
  119. package/es/ProForm/utils/useShouldUpdate.d.ts +1 -0
  120. package/es/ProForm/utils/useShouldUpdate.js +103 -17
  121. package/es/ProIcon/index.js +10 -13
  122. package/es/ProIcon/style/index.less +0 -2
  123. package/es/ProLayout/components/Layout/Header/index.js +1 -1
  124. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +3 -6
  125. package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +40 -39
  126. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +2 -3
  127. package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +0 -3
  128. package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +7 -5
  129. package/es/ProLayout/components/Layout/Menu/index.js +1 -1
  130. package/es/ProLayout/components/Layout/Menu/style/index.less +0 -2
  131. package/es/ProLayout/components/Layout/Notice/style/index.less +0 -2
  132. package/es/ProLayout/components/ProCollapse/index.js +29 -44
  133. package/es/ProLayout/components/ProCollapse/style/index.less +5 -4
  134. package/es/ProLayout/components/ProFooter/index.js +2 -3
  135. package/es/ProLayout/components/ProFooter/style/index.less +0 -2
  136. package/es/ProLayout/components/ProHeader/components/Copy/index.js +2 -3
  137. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +2 -3
  138. package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +7 -9
  139. package/es/ProLayout/components/ProHeader/index.js +43 -45
  140. package/es/ProLayout/components/ProHeader/style/index.less +0 -2
  141. package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +2 -3
  142. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +0 -2
  143. package/es/ProLayout/index.js +80 -41
  144. package/es/ProLayout/style/index.less +2 -3
  145. package/es/ProSelect/components/AdaptiveTooltip.js +2 -3
  146. package/es/ProSelect/index.js +7 -15
  147. package/es/ProSelect/index.less +0 -2
  148. package/es/ProSelect/propsType.d.ts +1 -1
  149. package/es/ProStep/components/Anchor/index.js +2 -3
  150. package/es/ProStep/components/Item/index.js +1 -0
  151. package/es/ProStep/components/Step/index.js +1 -0
  152. package/es/ProStep/style/index.less +2 -4
  153. package/es/ProTable/components/FormatColumn/index.js +33 -31
  154. package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +0 -1
  155. package/es/ProTable/components/RcTable/components/BaseTable/index.js +2 -4
  156. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +17 -13
  157. package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +0 -1
  158. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +2 -4
  159. package/es/ProTable/components/RenderColumn/index.d.ts +1 -1
  160. package/es/ProTable/components/RenderColumn/index.js +15 -18
  161. package/es/ProTable/components/RenderSummary/index.js +4 -5
  162. package/es/ProTable/components/RenderTableHeader/index.js +3 -4
  163. package/es/ProTable/components/RenderTabs/index.js +3 -6
  164. package/es/ProTable/components/TableResizable/index.js +2 -1
  165. package/es/ProTable/components/TooltipTitle/index.js +2 -3
  166. package/es/ProTable/hooks/useAntdTable.js +4 -7
  167. package/es/ProTable/index.d.ts +0 -7
  168. package/es/ProTable/index.js +11 -14
  169. package/es/ProTable/propsType.d.ts +2 -3
  170. package/es/ProTable/style/index.less +4 -6
  171. package/es/ProTabs/components/Card/index.js +5 -10
  172. package/es/ProTabs/index.js +2 -3
  173. package/es/ProTabs/style/index.less +0 -2
  174. package/es/ProThemeTools/component/ProTools/index.js +18 -22
  175. package/es/ProThemeTools/context/ThemeContext.d.ts +31 -0
  176. package/es/ProThemeTools/context/ThemeContext.js +136 -0
  177. package/es/ProThemeTools/index.d.ts +4 -8
  178. package/es/ProThemeTools/index.js +80 -49
  179. package/es/ProThemeTools/style/index.less +1 -3
  180. package/es/ProThemeTools/utils/index.d.ts +16 -6
  181. package/es/ProThemeTools/utils/index.js +30 -24
  182. package/es/ProTooltip/index.js +14 -9
  183. package/es/ProTooltip/style/index.less +0 -2
  184. package/es/ProTree/components/AdaptiveTooltip.js +2 -3
  185. package/es/ProTree/components/List.js +3 -4
  186. package/es/ProTree/components/ProTree.js +5 -12
  187. package/es/ProTree/components/ProTreeSelect/index.js +28 -26
  188. package/es/ProTree/components/ProTreeSelect/style/index.less +0 -2
  189. package/es/ProTree/components/Tree.js +6 -13
  190. package/es/ProTree/index.js +0 -7
  191. package/es/ProTree/propsType.d.ts +1 -1
  192. package/es/ProTree/style/index.less +8 -6
  193. package/es/ProTreeModal/components/Cascader.js +3 -4
  194. package/es/ProTreeModal/components/List.js +11 -17
  195. package/es/ProTreeModal/components/SortableItem.js +2 -3
  196. package/es/ProTreeModal/components/Tree.js +3 -4
  197. package/es/ProTreeModal/components/Trigger.js +6 -11
  198. package/es/ProTreeModal/index.d.ts +0 -1
  199. package/es/ProTreeModal/index.js +10 -20
  200. package/es/ProTreeModal/style/index.less +12 -3
  201. package/es/ProUpload/components/ButtonRender.js +4 -7
  202. package/es/ProUpload/components/DragRender.js +2 -3
  203. package/es/ProUpload/components/FileItem.d.ts +0 -1
  204. package/es/ProUpload/components/FileItem.js +15 -21
  205. package/es/ProUpload/components/ImageRender.js +8 -17
  206. package/es/ProUpload/index.js +3 -4
  207. package/es/ProUpload/style/index.less +171 -12
  208. package/es/ProViewer/index.js +28 -35
  209. package/es/ProViewer/propsType.js +3 -0
  210. package/es/ProViewer/style/index.less +0 -2
  211. package/es/ProWaterMark/index.js +2 -3
  212. package/es/ProWaterMark/propsType.d.ts +5 -24
  213. package/es/global.less +2 -1
  214. package/es/index.d.ts +3 -3
  215. package/es/index.js +5 -5
  216. package/es/locale/en_US.js +1 -1
  217. package/es/locale/index.d.ts +2 -0
  218. package/es/locale/index.js +13 -2
  219. package/es/locale/zh_CN.js +1 -1
  220. package/es/style/components.less +0 -3
  221. package/es/style/index.less +1 -1
  222. package/es/style/theme/antd.less +36 -48
  223. package/es/style/theme/base.less +90 -0
  224. package/es/style/theme/index.less +2 -89
  225. package/es/utils/index.d.ts +7 -0
  226. package/es/utils/index.js +37 -1
  227. package/lib/FormsProvider/index.d.ts +4 -1
  228. package/lib/ProAction/components/CheckModalContent/index.js +0 -9
  229. package/lib/ProAction/index.js +3 -6
  230. package/lib/ProAction/index.less +0 -2
  231. package/lib/ProConfigProvider/index.d.ts +22 -5
  232. package/lib/ProConfigProvider/index.js +58 -26
  233. package/lib/ProDownload/index.js +2 -3
  234. package/lib/ProDownload/style/index.less +0 -2
  235. package/lib/ProDownload/utils.js +3 -4
  236. package/lib/ProDrawerForm/components/ProDrawer/index.js +13 -17
  237. package/lib/ProDrawerForm/components/ProModal/index.js +12 -20
  238. package/lib/ProDrawerForm/index.d.ts +2 -1
  239. package/lib/ProDrawerForm/index.js +35 -33
  240. package/lib/ProDrawerForm/propsType.d.ts +7 -18
  241. package/lib/ProDrawerForm/style/index.less +6 -14
  242. package/lib/ProEditLabel/components/RenderProForm.js +2 -3
  243. package/lib/ProEditLabel/index.js +10 -15
  244. package/lib/ProEditLabel/propsType.d.ts +1 -6
  245. package/lib/ProEditLabel/style/index.less +2 -3
  246. package/lib/ProEditTable/components/ActionButton/index.js +5 -8
  247. package/lib/ProEditTable/components/RcTable/BaseTable.js +69 -52
  248. package/lib/ProEditTable/components/RcTable/DraggableTable.js +69 -48
  249. package/lib/ProEditTable/components/RcTable/index.d.ts +0 -2
  250. package/lib/ProEditTable/components/RcTable/index.js +1 -8
  251. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +9 -12
  252. package/lib/ProEditTable/components/RenderField/index.d.ts +3 -2
  253. package/lib/ProEditTable/components/RenderField/index.js +401 -241
  254. package/lib/ProEditTable/components/RenderToolbar/index.js +5 -5
  255. package/lib/ProEditTable/components/Summary/index.js +5 -9
  256. package/lib/ProEditTable/components/Validator/index.js +3 -7
  257. package/lib/ProEditTable/index.js +96 -100
  258. package/lib/ProEditTable/propsType.d.ts +7 -7
  259. package/lib/ProEditTable/style/index.less +12 -12
  260. package/lib/ProEditTable/utils/config.js +6 -7
  261. package/lib/ProEditTable/utils/index.js +20 -16
  262. package/lib/ProEditTable/utils/useEditTableError.js +12 -4
  263. package/lib/ProEditTable/utils/useShouldUpdateForTable.d.ts +15 -0
  264. package/lib/ProEditTable/utils/useShouldUpdateForTable.js +139 -0
  265. package/lib/ProEnum/hooks/useEnum.js +5 -0
  266. package/lib/ProEnum/hooks/useEnumRequest.js +2 -2
  267. package/lib/ProEnum/index.js +10 -17
  268. package/lib/ProEnum/style/index.less +0 -2
  269. package/lib/ProEnum/utils/index.d.ts +1 -0
  270. package/lib/ProEnum/utils/index.js +4 -7
  271. package/lib/ProForm/components/Container.d.ts +1 -0
  272. package/lib/ProForm/components/Container.js +2 -3
  273. package/lib/ProForm/components/FormFooter/index.js +18 -19
  274. package/lib/ProForm/components/FormFooter/propsType.d.ts +2 -0
  275. package/lib/ProForm/components/base/Checkbox/index.js +3 -4
  276. package/lib/ProForm/components/base/DatePicker/index.d.ts +1 -3
  277. package/lib/ProForm/components/base/DatePicker/index.js +7 -7
  278. package/lib/ProForm/components/base/DatePicker/useDateLimit.d.ts +3 -0
  279. package/lib/ProForm/components/base/DatePicker/useDateLimit.js +19 -0
  280. package/lib/ProForm/components/base/Input/index.js +10 -8
  281. package/lib/ProForm/components/base/InputNumber/index.js +3 -6
  282. package/lib/ProForm/components/base/Radio/index.js +3 -4
  283. package/lib/ProForm/components/base/RangePicker/index.js +6 -6
  284. package/lib/ProForm/components/base/RangePicker/useDateRange.d.ts +5 -5
  285. package/lib/ProForm/components/base/Select/index.js +2 -3
  286. package/lib/ProForm/components/base/Switch/index.js +2 -3
  287. package/lib/ProForm/components/base/SwitchCheckbox/index.js +2 -3
  288. package/lib/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
  289. package/lib/ProForm/components/base/TextArea/index.js +3 -4
  290. package/lib/ProForm/components/base/TextArea/index.less +10 -2
  291. package/lib/ProForm/components/base/TimePicker/index.d.ts +1 -2
  292. package/lib/ProForm/components/base/TimePicker/index.js +6 -7
  293. package/lib/ProForm/components/base/TimePicker/style/index.less +3 -3
  294. package/lib/ProForm/components/combination/Container/style/index.less +0 -2
  295. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +15 -13
  296. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +6 -9
  297. package/lib/ProForm/components/combination/FormList/components/Empty.js +2 -3
  298. package/lib/ProForm/components/combination/FormList/components/LineFields.js +2 -3
  299. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +4 -7
  300. package/lib/ProForm/components/combination/FormList/index.js +2 -3
  301. package/lib/ProForm/components/combination/FormList/style/index.less +36 -2
  302. package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +1 -0
  303. package/lib/ProForm/components/combination/Group/component/ComRender.js +0 -1
  304. package/lib/ProForm/components/combination/Group/index.js +3 -4
  305. package/lib/ProForm/components/combination/Group/style/index.less +7 -87
  306. package/lib/ProForm/components/combination/Group/utils.d.ts +1 -1
  307. package/lib/ProForm/components/combination/Group/utils.js +4 -5
  308. package/lib/ProForm/components/combination/ProCascader/index.js +12 -14
  309. package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +1 -1
  310. package/lib/ProForm/components/combination/ProCascader/style/index.less +0 -2
  311. package/lib/ProForm/components/combination/ProModalSelect/index.d.ts +1 -1
  312. package/lib/ProForm/components/combination/ProModalSelect/index.js +24 -39
  313. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +11 -15
  314. package/lib/ProForm/components/combination/ProNumberRange/index.d.ts +3 -2
  315. package/lib/ProForm/components/combination/ProNumberRange/index.js +20 -20
  316. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +3 -54
  317. package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -23
  318. package/lib/ProForm/components/combination/ProRangeLimit/index.js +42 -25
  319. package/lib/ProForm/components/combination/ProRangeLimit/propsType.d.ts +23 -0
  320. package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +3 -2
  321. package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +14 -2
  322. package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +5 -6
  323. package/lib/ProForm/components/combination/ProTimeLimit/index.js +23 -20
  324. package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +64 -6
  325. package/lib/ProForm/components/index.d.ts +2 -9
  326. package/lib/ProForm/components/index.js +1 -63
  327. package/lib/ProForm/components/render/ChangedWrapper.js +8 -9
  328. package/lib/ProForm/components/render/ConfirmWrapper.js +7 -7
  329. package/lib/ProForm/components/render/Render.js +29 -30
  330. package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
  331. package/lib/ProForm/components/render/RenderFields.js +6 -3
  332. package/lib/ProForm/components/render/propsType.d.ts +3 -6
  333. package/lib/ProForm/index.d.ts +2 -2
  334. package/lib/ProForm/index.js +13 -42
  335. package/lib/ProForm/propsType.d.ts +3 -0
  336. package/lib/ProForm/style/index.less +4 -16
  337. package/lib/ProForm/utils/index.d.ts +15 -1
  338. package/lib/ProForm/utils/index.js +69 -17
  339. package/lib/ProForm/utils/useDeepCompareMemo.js +4 -4
  340. package/lib/ProForm/utils/useForm.js +26 -21
  341. package/lib/ProForm/utils/useShouldUpdate.d.ts +1 -0
  342. package/lib/ProForm/utils/useShouldUpdate.js +101 -15
  343. package/lib/ProIcon/index.js +10 -13
  344. package/lib/ProIcon/style/index.less +0 -2
  345. package/lib/ProLayout/components/Layout/Header/index.js +1 -1
  346. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +3 -6
  347. package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +40 -39
  348. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +2 -3
  349. package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +0 -3
  350. package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +7 -5
  351. package/lib/ProLayout/components/Layout/Menu/index.js +1 -1
  352. package/lib/ProLayout/components/Layout/Menu/style/index.less +0 -2
  353. package/lib/ProLayout/components/Layout/Notice/style/index.less +0 -2
  354. package/lib/ProLayout/components/ProCollapse/index.js +29 -44
  355. package/lib/ProLayout/components/ProCollapse/style/index.less +5 -4
  356. package/lib/ProLayout/components/ProFooter/index.js +2 -3
  357. package/lib/ProLayout/components/ProFooter/style/index.less +0 -2
  358. package/lib/ProLayout/components/ProHeader/components/Copy/index.js +2 -3
  359. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +2 -3
  360. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +7 -9
  361. package/lib/ProLayout/components/ProHeader/index.js +44 -47
  362. package/lib/ProLayout/components/ProHeader/style/index.less +0 -2
  363. package/lib/ProLayout/components/TabsManager/components/TabContextMenu.js +2 -3
  364. package/lib/ProLayout/components/TabsManager/hooks/useTabsState.js +0 -2
  365. package/lib/ProLayout/index.js +79 -40
  366. package/lib/ProLayout/style/index.less +2 -3
  367. package/lib/ProSelect/components/AdaptiveTooltip.js +2 -3
  368. package/lib/ProSelect/index.js +7 -15
  369. package/lib/ProSelect/index.less +0 -2
  370. package/lib/ProSelect/propsType.d.ts +1 -1
  371. package/lib/ProStep/components/Anchor/index.js +2 -3
  372. package/lib/ProStep/components/Item/index.js +1 -1
  373. package/lib/ProStep/components/Step/index.js +1 -0
  374. package/lib/ProStep/style/index.less +2 -4
  375. package/lib/ProTable/components/FormatColumn/index.js +33 -31
  376. package/lib/ProTable/components/RcTable/components/BaseTable/index.d.ts +0 -1
  377. package/lib/ProTable/components/RcTable/components/BaseTable/index.js +2 -4
  378. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +16 -13
  379. package/lib/ProTable/components/RcTable/components/DraggableTable/index.d.ts +0 -1
  380. package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +2 -4
  381. package/lib/ProTable/components/RenderColumn/index.d.ts +1 -1
  382. package/lib/ProTable/components/RenderColumn/index.js +15 -18
  383. package/lib/ProTable/components/RenderSummary/index.js +4 -6
  384. package/lib/ProTable/components/RenderTableHeader/index.js +3 -5
  385. package/lib/ProTable/components/RenderTabs/index.js +3 -6
  386. package/lib/ProTable/components/TableResizable/index.js +2 -1
  387. package/lib/ProTable/components/TooltipTitle/index.js +2 -3
  388. package/lib/ProTable/hooks/useAntdTable.js +4 -7
  389. package/lib/ProTable/index.d.ts +0 -7
  390. package/lib/ProTable/index.js +10 -13
  391. package/lib/ProTable/propsType.d.ts +2 -3
  392. package/lib/ProTable/style/index.less +4 -6
  393. package/lib/ProTabs/components/Card/index.js +5 -11
  394. package/lib/ProTabs/index.js +2 -3
  395. package/lib/ProTabs/style/index.less +0 -2
  396. package/lib/ProThemeTools/component/ProTools/index.js +18 -22
  397. package/lib/ProThemeTools/context/ThemeContext.d.ts +31 -0
  398. package/lib/ProThemeTools/context/ThemeContext.js +145 -0
  399. package/lib/ProThemeTools/index.d.ts +4 -8
  400. package/lib/ProThemeTools/index.js +88 -48
  401. package/lib/ProThemeTools/style/index.less +1 -3
  402. package/lib/ProThemeTools/utils/index.d.ts +16 -6
  403. package/lib/ProThemeTools/utils/index.js +34 -27
  404. package/lib/ProTooltip/index.js +14 -9
  405. package/lib/ProTooltip/style/index.less +0 -2
  406. package/lib/ProTree/components/AdaptiveTooltip.js +2 -4
  407. package/lib/ProTree/components/List.js +3 -4
  408. package/lib/ProTree/components/ProTree.js +5 -12
  409. package/lib/ProTree/components/ProTreeSelect/index.js +28 -26
  410. package/lib/ProTree/components/ProTreeSelect/style/index.less +0 -2
  411. package/lib/ProTree/components/Tree.js +6 -13
  412. package/lib/ProTree/index.js +0 -8
  413. package/lib/ProTree/propsType.d.ts +1 -1
  414. package/lib/ProTree/style/index.less +8 -6
  415. package/lib/ProTreeModal/components/Cascader.js +3 -4
  416. package/lib/ProTreeModal/components/List.js +11 -17
  417. package/lib/ProTreeModal/components/SortableItem.js +2 -3
  418. package/lib/ProTreeModal/components/Tree.js +3 -4
  419. package/lib/ProTreeModal/components/Trigger.js +6 -11
  420. package/lib/ProTreeModal/index.d.ts +0 -1
  421. package/lib/ProTreeModal/index.js +10 -20
  422. package/lib/ProTreeModal/style/index.less +12 -3
  423. package/lib/ProUpload/components/ButtonRender.js +4 -7
  424. package/lib/ProUpload/components/DragRender.js +2 -3
  425. package/lib/ProUpload/components/FileItem.d.ts +0 -1
  426. package/lib/ProUpload/components/FileItem.js +15 -21
  427. package/lib/ProUpload/components/ImageRender.js +8 -17
  428. package/lib/ProUpload/index.js +3 -4
  429. package/lib/ProUpload/style/index.less +171 -12
  430. package/lib/ProViewer/index.js +30 -36
  431. package/lib/ProViewer/propsType.js +3 -1
  432. package/lib/ProViewer/style/index.less +0 -2
  433. package/lib/ProWaterMark/index.js +3 -4
  434. package/lib/ProWaterMark/propsType.d.ts +5 -24
  435. package/lib/global.less +2 -1
  436. package/lib/index.d.ts +3 -3
  437. package/lib/index.js +34 -21
  438. package/lib/locale/en_US.js +1 -1
  439. package/lib/locale/index.d.ts +2 -0
  440. package/lib/locale/index.js +14 -3
  441. package/lib/locale/zh_CN.js +1 -1
  442. package/lib/style/components.less +0 -3
  443. package/lib/style/index.less +1 -1
  444. package/lib/style/theme/antd.less +36 -48
  445. package/lib/style/theme/base.less +90 -0
  446. package/lib/style/theme/index.less +2 -89
  447. package/lib/utils/index.d.ts +7 -0
  448. package/lib/utils/index.js +41 -2
  449. package/package.json +37 -25
  450. package/es/ProEditTable/components/RcTable/VirtualTable.d.ts +0 -3
  451. package/es/ProEditTable/components/RcTable/VirtualTable.js +0 -9
  452. package/es/ProForm/components/combination/ProCombination/index.d.ts +0 -6
  453. package/es/ProForm/components/combination/ProCombination/index.js +0 -208
  454. package/es/ProForm/components/combination/ProCombination/propsType.d.ts +0 -68
  455. package/es/ProForm/components/combination/ProCombination/style/index.less +0 -18
  456. package/es/ProForm/components/old/EnumSelect/hooks/useRequestList.d.ts +0 -33
  457. package/es/ProForm/components/old/EnumSelect/hooks/useRequestList.js +0 -110
  458. package/es/ProForm/components/old/EnumSelect/index.d.ts +0 -4
  459. package/es/ProForm/components/old/EnumSelect/index.js +0 -265
  460. package/es/ProForm/components/old/EnumSelect/interface.d.ts +0 -29
  461. package/es/ProForm/components/old/EnumSelect/interface.js +0 -1
  462. package/es/ProForm/components/old/EnumSelect/style/index.less +0 -113
  463. package/es/ProForm/components/old/InputRange/index.d.ts +0 -16
  464. package/es/ProForm/components/old/InputRange/index.js +0 -101
  465. package/es/ProForm/components/old/InputWithSuffix/index.d.ts +0 -3
  466. package/es/ProForm/components/old/InputWithSuffix/index.js +0 -47
  467. package/es/ProForm/components/old/InputWithSuffix/propsTypes.d.ts +0 -11
  468. package/es/ProForm/components/old/InputWithSuffix/propsTypes.js +0 -1
  469. package/es/ProForm/components/old/ProAddress/index.d.ts +0 -27
  470. package/es/ProForm/components/old/ProAddress/index.js +0 -276
  471. package/es/ProForm/components/old/ProAddress/propsTypes.d.ts +0 -16
  472. package/es/ProForm/components/old/ProAddress/propsTypes.js +0 -1
  473. package/es/ProForm/components/old/ProCertNo/index.d.ts +0 -14
  474. package/es/ProForm/components/old/ProCertNo/index.js +0 -66
  475. package/es/ProForm/components/old/ProCertNo/propsType.d.ts +0 -18
  476. package/es/ProForm/components/old/ProCertNo/propsType.js +0 -1
  477. package/es/ProForm/components/old/ProCertValidity/index.d.ts +0 -9
  478. package/es/ProForm/components/old/ProCertValidity/index.js +0 -186
  479. package/es/ProForm/components/old/ProCertValidity/propsType.d.ts +0 -19
  480. package/es/ProForm/components/old/ProCertValidity/propsType.js +0 -1
  481. package/es/ProForm/components/old/ProRangeBox/index.d.ts +0 -2
  482. package/es/ProForm/components/old/ProRangeBox/index.js +0 -98
  483. package/es/ProForm/components/old/ProRangeBox/propsType.d.ts +0 -3
  484. package/es/ProForm/components/old/ProRangeBox/propsType.js +0 -1
  485. package/es/ProUpload/style/fileItem.less +0 -159
  486. package/es/old/ProCertValidity/index.d.ts +0 -9
  487. package/es/old/ProCertValidity/index.js +0 -186
  488. package/es/old/ProCertValidity/propsType.d.ts +0 -19
  489. package/es/old/ProCertValidity/propsType.js +0 -1
  490. package/es/old/ProEditableTable/index.d.ts +0 -4
  491. package/es/old/ProEditableTable/index.js +0 -594
  492. package/es/old/ProEditableTable/propsType.d.ts +0 -68
  493. package/es/old/ProEditableTable/propsType.js +0 -1
  494. package/es/old/ProEditableTable/style/index.less +0 -75
  495. package/es/old/ProEditableTable/utils.d.ts +0 -29
  496. package/es/old/ProEditableTable/utils.js +0 -321
  497. package/lib/ProEditTable/components/RcTable/VirtualTable.d.ts +0 -3
  498. package/lib/ProEditTable/components/RcTable/VirtualTable.js +0 -14
  499. package/lib/ProForm/components/combination/ProCombination/index.d.ts +0 -6
  500. package/lib/ProForm/components/combination/ProCombination/index.js +0 -217
  501. package/lib/ProForm/components/combination/ProCombination/propsType.d.ts +0 -68
  502. package/lib/ProForm/components/combination/ProCombination/style/index.less +0 -18
  503. package/lib/ProForm/components/old/EnumSelect/hooks/useRequestList.d.ts +0 -33
  504. package/lib/ProForm/components/old/EnumSelect/hooks/useRequestList.js +0 -117
  505. package/lib/ProForm/components/old/EnumSelect/index.d.ts +0 -4
  506. package/lib/ProForm/components/old/EnumSelect/index.js +0 -271
  507. package/lib/ProForm/components/old/EnumSelect/interface.d.ts +0 -29
  508. package/lib/ProForm/components/old/EnumSelect/interface.js +0 -5
  509. package/lib/ProForm/components/old/EnumSelect/style/index.less +0 -113
  510. package/lib/ProForm/components/old/InputRange/index.d.ts +0 -16
  511. package/lib/ProForm/components/old/InputRange/index.js +0 -108
  512. package/lib/ProForm/components/old/InputWithSuffix/index.d.ts +0 -3
  513. package/lib/ProForm/components/old/InputWithSuffix/index.js +0 -53
  514. package/lib/ProForm/components/old/InputWithSuffix/propsTypes.d.ts +0 -11
  515. package/lib/ProForm/components/old/InputWithSuffix/propsTypes.js +0 -5
  516. package/lib/ProForm/components/old/ProAddress/index.d.ts +0 -27
  517. package/lib/ProForm/components/old/ProAddress/index.js +0 -284
  518. package/lib/ProForm/components/old/ProAddress/propsTypes.d.ts +0 -16
  519. package/lib/ProForm/components/old/ProAddress/propsTypes.js +0 -5
  520. package/lib/ProForm/components/old/ProCertNo/index.d.ts +0 -14
  521. package/lib/ProForm/components/old/ProCertNo/index.js +0 -72
  522. package/lib/ProForm/components/old/ProCertNo/propsType.d.ts +0 -18
  523. package/lib/ProForm/components/old/ProCertNo/propsType.js +0 -5
  524. package/lib/ProForm/components/old/ProCertValidity/index.d.ts +0 -9
  525. package/lib/ProForm/components/old/ProCertValidity/index.js +0 -192
  526. package/lib/ProForm/components/old/ProCertValidity/propsType.d.ts +0 -19
  527. package/lib/ProForm/components/old/ProCertValidity/propsType.js +0 -5
  528. package/lib/ProForm/components/old/ProRangeBox/index.d.ts +0 -2
  529. package/lib/ProForm/components/old/ProRangeBox/index.js +0 -105
  530. package/lib/ProForm/components/old/ProRangeBox/propsType.d.ts +0 -3
  531. package/lib/ProForm/components/old/ProRangeBox/propsType.js +0 -5
  532. package/lib/ProUpload/style/fileItem.less +0 -159
  533. package/lib/old/ProCertValidity/index.d.ts +0 -9
  534. package/lib/old/ProCertValidity/index.js +0 -192
  535. package/lib/old/ProCertValidity/propsType.d.ts +0 -19
  536. package/lib/old/ProCertValidity/propsType.js +0 -5
  537. package/lib/old/ProEditableTable/index.d.ts +0 -4
  538. package/lib/old/ProEditableTable/index.js +0 -598
  539. package/lib/old/ProEditableTable/propsType.d.ts +0 -68
  540. package/lib/old/ProEditableTable/propsType.js +0 -5
  541. package/lib/old/ProEditableTable/style/index.less +0 -75
  542. package/lib/old/ProEditableTable/utils.d.ts +0 -29
  543. package/lib/old/ProEditableTable/utils.js +0 -329
  544. /package/es/ProForm/components/combination/{ProCombination → ProRangeLimit}/propsType.js +0 -0
  545. /package/lib/ProForm/components/combination/{ProCombination → ProRangeLimit}/propsType.js +0 -0
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { ProEditableTablePropsType } from './propsType';
3
- declare const ProEditableTable: React.ForwardRefExoticComponent<Omit<ProEditableTablePropsType, "ref"> & React.RefAttributes<unknown>>;
4
- export default ProEditableTable;
@@ -1,594 +0,0 @@
1
- import "antd/es/config-provider/style";
2
- import _ConfigProvider from "antd/es/config-provider";
3
- import "antd/es/table/style";
4
- import _Table from "antd/es/table";
5
- import "antd/es/space/style";
6
- import _Space from "antd/es/space";
7
- import "antd/es/popconfirm/style";
8
- import _Popconfirm from "antd/es/popconfirm";
9
- import "antd/es/button/style";
10
- import _Button from "antd/es/button";
11
- import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
12
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
13
- import "antd/es/message/style";
14
- import _message from "antd/es/message";
15
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
16
- import "antd/es/form/style";
17
- import _Form from "antd/es/form";
18
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
19
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
20
- var _excluded = ["form", "dataSource", "setDataSource", "columns", "actionRef", "addButtonProps", "pagination", "editType", "onlyOneLineEditorAlertMessage", "noSaveAlertMessage", "mulDeletePoconfirmMsg", "name", "disabled", "formProps"],
21
- _excluded2 = ["isCanAdd", "isCanMultipleDelete", "multipleDeleteModalProps", "position", "buttonText", "emptyButtonText", "insertType", "onlyAddOneLineAlertMessage"];
22
- import { PlusOutlined } from '@ant-design/icons';
23
- import { useSetState, useDeepCompareEffect } from 'ahooks';
24
- import { cloneDeep } from 'lodash';
25
- import React, { cloneElement, forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react';
26
- import Empty from "../../assets/empty.png";
27
- import { formatList, transformColumns, getRandom } from "./utils";
28
-
29
- // 1、保证再去取dataSource数据纯净 table里面用list进行处理
30
- import { jsx as _jsx } from "react/jsx-runtime";
31
- import { jsxs as _jsxs } from "react/jsx-runtime";
32
- import { Fragment as _Fragment } from "react/jsx-runtime";
33
- var ProEditableTable = /*#__PURE__*/forwardRef((props, ref) => {
34
- var originForm = props.form,
35
- dataSource = props.dataSource,
36
- setDataSource = props.setDataSource,
37
- columns = props.columns,
38
- actionRef = props.actionRef,
39
- addButtonProps = props.addButtonProps,
40
- pagination = props.pagination,
41
- editType = props.editType,
42
- onlyOneLineEditorAlertMessage = props.onlyOneLineEditorAlertMessage,
43
- noSaveAlertMessage = props.noSaveAlertMessage,
44
- mulDeletePoconfirmMsg = props.mulDeletePoconfirmMsg,
45
- _props$name = props.name,
46
- name = _props$name === void 0 ? 'dataList' : _props$name,
47
- disabled = props.disabled,
48
- formProps = props.formProps,
49
- otherProps = _objectWithoutProperties(props, _excluded);
50
- var isSingle = editType === 'single';
51
- var _Form$useForm = _Form.useForm(originForm),
52
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
53
- form = _Form$useForm2[0];
54
-
55
- // table实例
56
- var tableRef = useRef();
57
- var _useState = useState(dataSource),
58
- _useState2 = _slicedToArray(_useState, 2),
59
- list = _useState2[0],
60
- setList = _useState2[1];
61
- var _useState3 = useState([]),
62
- _useState4 = _slicedToArray(_useState3, 2),
63
- selectedRowKeys = _useState4[0],
64
- setSelectedRowKeys = _useState4[1];
65
- var _useState5 = useState([]),
66
- _useState6 = _slicedToArray(_useState5, 2),
67
- selectedRows = _useState6[0],
68
- setSelectedRows = _useState6[1];
69
- var _useSetState = useSetState([]),
70
- _useSetState2 = _slicedToArray(_useSetState, 2),
71
- originRowData = _useSetState2[0],
72
- setOriginRowData = _useSetState2[1];
73
- var _ref = addButtonProps || {},
74
- _ref$isCanAdd = _ref.isCanAdd,
75
- isCanAdd = _ref$isCanAdd === void 0 ? true : _ref$isCanAdd,
76
- _ref$isCanMultipleDel = _ref.isCanMultipleDelete,
77
- isCanMultipleDelete = _ref$isCanMultipleDel === void 0 ? false : _ref$isCanMultipleDel,
78
- _ref$multipleDeleteMo = _ref.multipleDeleteModalProps,
79
- multipleDeleteModalProps = _ref$multipleDeleteMo === void 0 ? {} : _ref$multipleDeleteMo,
80
- _ref$position = _ref.position,
81
- position = _ref$position === void 0 ? 'bottomLeft' : _ref$position,
82
- _ref$buttonText = _ref.buttonText,
83
- buttonText = _ref$buttonText === void 0 ? '添加一行' : _ref$buttonText,
84
- _ref$emptyButtonText = _ref.emptyButtonText,
85
- emptyButtonText = _ref$emptyButtonText === void 0 ? '点击添加' : _ref$emptyButtonText,
86
- _ref$insertType = _ref.insertType,
87
- insertType = _ref$insertType === void 0 ? 'after' : _ref$insertType,
88
- _ref$onlyAddOneLineAl = _ref.onlyAddOneLineAlertMessage,
89
- onlyAddOneLineAlertMessage = _ref$onlyAddOneLineAl === void 0 ? '只能新增一行' : _ref$onlyAddOneLineAl,
90
- antButtonProps = _objectWithoutProperties(_ref, _excluded2);
91
-
92
- // 获取key
93
- var getRowKey = record => record.rowKey;
94
- var rowSelection = {
95
- onChange: (selectedRowKeys, selectedRows) => {
96
- setSelectedRows(selectedRows);
97
- setSelectedRowKeys(selectedRowKeys);
98
- }
99
- // getCheckboxProps: (record: any) => ({
100
- // disabled: !getRowKey(record) || String(getRowKey(record)).startsWith('&&'), // 新增的虚拟行不可选中
101
- // }),
102
- };
103
-
104
- /**
105
- * 监听行数据变化同步list
106
- * @param {number} rowIndex 修改行的index
107
- * @param {any} values 需要更新的数据
108
- * @returns {promise}
109
- */
110
- var onUpdateRowData = (rowIndex, values) => {
111
- var nextList = cloneDeep(list);
112
- nextList[rowIndex] = _objectSpread(_objectSpread({}, nextList[rowIndex]), values);
113
- setDataSource ? setDataSource(nextList) : setList([...nextList]);
114
- return Promise.resolve({
115
- rowIndex,
116
- nextList,
117
- list: formatList(nextList),
118
- rowData: nextList[rowIndex]
119
- });
120
- };
121
- var handleMulResetForm = () => {
122
- var values = form.getFieldsValue();
123
- var tempValues = {};
124
- Object.keys(values).forEach(index => {
125
- tempValues[+index + 1] = values[index];
126
- });
127
- form.resetFields([0]);
128
- form.setFieldsValue(_objectSpread({}, tempValues));
129
- };
130
-
131
- /**
132
- * 新增行
133
- * @param {IRowDataPropsType} rowData 初始化数据
134
- * @param {IAddOptionsPropsType} options 新增配置选项
135
- * @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
136
- */
137
- var onAdd = rowData => {
138
- if (isSingle) {
139
- var _list$filter;
140
- var isOneEditing = ((_list$filter = list.filter(item => item.editable)) === null || _list$filter === void 0 ? void 0 : _list$filter.length) >= 1;
141
- if (isOneEditing) {
142
- _message.warning(onlyAddOneLineAlertMessage);
143
- return Promise.reject(onlyAddOneLineAlertMessage);
144
- }
145
- }
146
- var rowIndex = 0;
147
- var nextList = cloneDeep(list);
148
- if (insertType === 'before') {
149
- handleMulResetForm();
150
- nextList.unshift(_objectSpread(_objectSpread({}, rowData), {}, {
151
- editable: true,
152
- isFirst: true,
153
- rowKey: `&&${getRandom()}`
154
- }));
155
- } else if (insertType === 'after') {
156
- nextList.push(_objectSpread(_objectSpread({}, rowData), {}, {
157
- editable: true,
158
- isFirst: true,
159
- rowKey: `&&${getRandom()}`
160
- }));
161
- rowIndex = list.length;
162
- }
163
- setDataSource ? setDataSource(nextList) : setList([...nextList]);
164
- return Promise.resolve({
165
- rowIndex,
166
- nextList,
167
- list: formatList(nextList),
168
- rowData: nextList[rowIndex]
169
- });
170
- };
171
-
172
- /**
173
- * 删除多行
174
- * @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
175
- */
176
- var onMultipleDelete = /*#__PURE__*/function () {
177
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
178
- var res, values, nextList, resetFieldsIndex;
179
- return _regeneratorRuntime().wrap(function _callee$(_context) {
180
- while (1) switch (_context.prev = _context.next) {
181
- case 0:
182
- if (!(addButtonProps !== null && addButtonProps !== void 0 && addButtonProps.onMultipleDelete)) {
183
- _context.next = 6;
184
- break;
185
- }
186
- _context.next = 3;
187
- return addButtonProps.onMultipleDelete(selectedRowKeys, selectedRows);
188
- case 3:
189
- _context.t0 = _context.sent;
190
- _context.next = 7;
191
- break;
192
- case 6:
193
- _context.t0 = true;
194
- case 7:
195
- res = _context.t0;
196
- if (!res) {
197
- _context.next = 20;
198
- break;
199
- }
200
- values = cloneDeep(form.getFieldsValue(true));
201
- nextList = cloneDeep(list);
202
- nextList = nextList.filter(item => !selectedRowKeys.includes(getRowKey(item)));
203
- resetFieldsIndex = [];
204
- Object.keys(values).forEach(key => {
205
- // eslint-disable-next-line no-restricted-globals
206
- if (!isNaN(Number(key))) {
207
- resetFieldsIndex.push(key);
208
- }
209
- });
210
- setSelectedRows([]);
211
- setSelectedRowKeys([]);
212
-
213
- // 清空删除后最后一条formItem状态
214
- form.resetFields(resetFieldsIndex);
215
- nextList.forEach((item, index) => {
216
- // 可编辑状态默认给表单回填数据
217
- if (item.editable) {
218
- form.setFieldsValue({
219
- [index]: item
220
- });
221
- }
222
- });
223
- setDataSource ? setDataSource(nextList) : setList([...nextList]);
224
- return _context.abrupt("return", Promise.resolve({
225
- rowIndex: 0,
226
- nextList,
227
- list: formatList(nextList),
228
- rowData: nextList[0]
229
- }));
230
- case 20:
231
- case "end":
232
- return _context.stop();
233
- }
234
- }, _callee);
235
- }));
236
- return function onMultipleDelete() {
237
- return _ref2.apply(this, arguments);
238
- };
239
- }();
240
-
241
- /**
242
- * 删除行
243
- * @param {number} rowIndex 当前删除行的下标
244
- * @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
245
- */
246
- var onDelete = rowIndex => {
247
- var values = cloneDeep(form.getFieldsValue(true));
248
- var lastIndex = list.length - 1;
249
- form.resetFields([rowIndex]);
250
- var nextList = cloneDeep(list);
251
- setSelectedRows(selectedRows.filter(item => {
252
- var _nextList$rowIndex;
253
- return item.rowKey !== ((_nextList$rowIndex = nextList[rowIndex]) === null || _nextList$rowIndex === void 0 ? void 0 : _nextList$rowIndex.rowKey);
254
- }));
255
- setSelectedRowKeys(selectedRowKeys.filter(key => {
256
- var _nextList$rowIndex2;
257
- return key !== ((_nextList$rowIndex2 = nextList[rowIndex]) === null || _nextList$rowIndex2 === void 0 ? void 0 : _nextList$rowIndex2.rowKey);
258
- }));
259
- nextList.splice(rowIndex, 1);
260
- for (var i = rowIndex; i < lastIndex; i++) {
261
- var _nextList$i = nextList[i],
262
- editable = _nextList$i.editable,
263
- isFirst = _nextList$i.isFirst;
264
- nextList[i] = _objectSpread(_objectSpread(_objectSpread({}, nextList[i]), values[i + 1]), {}, {
265
- editable,
266
- isFirst
267
- });
268
- }
269
-
270
- // 清空删除后最后一条formItem状态
271
- form.resetFields([lastIndex]);
272
- setDataSource ? setDataSource(nextList) : setList([...nextList]);
273
- return Promise.resolve({
274
- rowIndex,
275
- nextList,
276
- list: formatList(nextList),
277
- rowData: nextList[rowIndex]
278
- });
279
- };
280
-
281
- /**
282
- * 保存行
283
- * @param {number} rowIndex 当前保存行的下标
284
- * @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
285
- */
286
- var onSave = /*#__PURE__*/function () {
287
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(rowIndex, callback) {
288
- var _form$getFieldsValue$, _form$getFieldsValue, nextValues, res, values;
289
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
290
- while (1) switch (_context2.prev = _context2.next) {
291
- case 0:
292
- _context2.prev = 0;
293
- nextValues = (_form$getFieldsValue$ = (_form$getFieldsValue = form.getFieldsValue()) === null || _form$getFieldsValue === void 0 ? void 0 : _form$getFieldsValue[rowIndex]) !== null && _form$getFieldsValue$ !== void 0 ? _form$getFieldsValue$ : {};
294
- if (!callback) {
295
- _context2.next = 8;
296
- break;
297
- }
298
- _context2.next = 5;
299
- return callback({
300
- preValues: originRowData[rowIndex],
301
- nextValues
302
- });
303
- case 5:
304
- _context2.t0 = _context2.sent;
305
- _context2.next = 9;
306
- break;
307
- case 8:
308
- _context2.t0 = true;
309
- case 9:
310
- res = _context2.t0;
311
- if (!res) {
312
- _context2.next = 15;
313
- break;
314
- }
315
- _context2.next = 13;
316
- return form.validateFields();
317
- case 13:
318
- values = _context2.sent;
319
- return _context2.abrupt("return", onUpdateRowData(rowIndex, _objectSpread({
320
- editable: false,
321
- isFirst: false
322
- }, values[rowIndex])));
323
- case 15:
324
- _context2.next = 20;
325
- break;
326
- case 17:
327
- _context2.prev = 17;
328
- _context2.t1 = _context2["catch"](0);
329
- console.warn(_context2.t1);
330
- case 20:
331
- case "end":
332
- return _context2.stop();
333
- }
334
- }, _callee2, null, [[0, 17]]);
335
- }));
336
- return function onSave(_x, _x2) {
337
- return _ref3.apply(this, arguments);
338
- };
339
- }();
340
-
341
- /**
342
- * 编辑行
343
- * @param {number}} rowIndex 当前保存行的下标
344
- * @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
345
- */
346
- var onEdit = rowIndex => {
347
- if (isSingle) {
348
- var _list$filter2;
349
- var isOneEditing = ((_list$filter2 = list.filter(item => item.editable)) === null || _list$filter2 === void 0 ? void 0 : _list$filter2.length) >= 1;
350
- if (isOneEditing) {
351
- _message.warning(onlyOneLineEditorAlertMessage);
352
- return Promise.reject(onlyOneLineEditorAlertMessage);
353
- }
354
- }
355
- setOriginRowData({
356
- [rowIndex]: list[rowIndex]
357
- });
358
- form.setFieldsValue({
359
- [rowIndex]: list[rowIndex]
360
- });
361
- return onUpdateRowData(rowIndex, {
362
- editable: true,
363
- isFirst: false
364
- });
365
- };
366
-
367
- /**
368
- * 取消行
369
- * 第一次新增删除当前行 当点过编辑或者保存后,重置isFirst为false
370
- * @param {IRowDataPropsType} rowData 原始行数据
371
- * @param {number}} rowIndex 当前保存行的下标
372
- * @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
373
- */
374
- var onCancel = (rowData, rowIndex) => {
375
- if (rowData.isFirst) {
376
- return onDelete(rowIndex);
377
- }
378
- return onUpdateRowData(rowIndex, _objectSpread({
379
- editable: false,
380
- isFirst: false
381
- }, originRowData[rowIndex]));
382
- };
383
-
384
- // 渲染新增按钮
385
- var renderAddButton = () => {
386
- if (disabled || list.length === 0 || isCanAdd === false) {
387
- return null;
388
- }
389
- return /*#__PURE__*/_jsx(_Fragment, {
390
- children: buttonText !== false ? /*#__PURE__*/_jsx(_Fragment, {
391
- children: typeof buttonText === 'string' ? /*#__PURE__*/_jsxs(_Space, {
392
- style: {
393
- display: 'flex',
394
- justifyContent: ['topLeft', 'bottomLeft'].includes(position) ? 'flex-start' : 'flex-end',
395
- margin: ['topLeft', 'topRight'].includes(position) ? '0 0 16px 0' : '16px 0 0 0'
396
- },
397
- children: [isCanMultipleDelete ? /*#__PURE__*/_jsx(_Popconfirm, {
398
- placement: "top",
399
- title: mulDeletePoconfirmMsg,
400
- onConfirm: onMultipleDelete,
401
- okText: "\u786E\u5B9A",
402
- cancelText: "\u53D6\u6D88",
403
- disabled: !(selectedRowKeys !== null && selectedRowKeys !== void 0 && selectedRowKeys.length),
404
- children: /*#__PURE__*/_jsx(_Button, {
405
- disabled: !(selectedRowKeys !== null && selectedRowKeys !== void 0 && selectedRowKeys.length),
406
- type: "link",
407
- children: "\u5220\u9664"
408
- })
409
- }) : null, /*#__PURE__*/_jsx(_Button, _objectSpread(_objectSpread({
410
- type: "link",
411
- icon: /*#__PURE__*/_jsx(PlusOutlined, {}),
412
- onClick: () => {
413
- onAdd();
414
- }
415
- }, antButtonProps), {}, {
416
- children: buttonText
417
- }))]
418
- }) : ( /*#__PURE__*/cloneElement(buttonText, antButtonProps))
419
- }) : null
420
- });
421
- };
422
- var validateFields = /*#__PURE__*/function () {
423
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
424
- var values, nextValues, nextList, isEditing;
425
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
426
- while (1) switch (_context3.prev = _context3.next) {
427
- case 0:
428
- _context3.next = 2;
429
- return form.validateFields();
430
- case 2:
431
- values = _context3.sent;
432
- nextValues = {};
433
- nextList = [];
434
- Object.keys(values).forEach(key => {
435
- if (Number.isNaN(Number(key))) {
436
- nextValues[key] = values[key];
437
- } else {
438
- nextList.push(values[key]);
439
- }
440
- });
441
- nextValues[name] = nextList;
442
- isEditing = list.find(item => item.editable);
443
- if (!(isSingle && isEditing)) {
444
- _context3.next = 11;
445
- break;
446
- }
447
- _message.warning(noSaveAlertMessage);
448
- // eslint-disable-next-line prefer-promise-reject-errors
449
- return _context3.abrupt("return", Promise.reject('请保存当前行数据'));
450
- case 11:
451
- return _context3.abrupt("return", Promise.resolve(nextValues));
452
- case 12:
453
- case "end":
454
- return _context3.stop();
455
- }
456
- }, _callee3);
457
- }));
458
- return function validateFields() {
459
- return _ref4.apply(this, arguments);
460
- };
461
- }();
462
- var newColumns = useMemo(() => {
463
- return transformColumns(columns, form, disabled);
464
- }, [columns, form, disabled]);
465
- useImperativeHandle(actionRef, () => ({
466
- /** 暴露出当前table节点 * */
467
- tableNode: tableRef.current,
468
- data: list,
469
- getPureDataSource: () => formatList(list),
470
- selectedRows,
471
- selectedRowKeys,
472
- setSelectedRowKeys,
473
- setSelectedRows,
474
- onUpdateRowData,
475
- onMultipleDelete,
476
- onAdd,
477
- onDelete,
478
- onEdit,
479
- onSave,
480
- onCancel,
481
- validateFields,
482
- setDataSource: setList
483
- }));
484
-
485
- // 实时同步外部dataSource (useDeepCompareEffect无法察觉dataSource的变更)
486
- useDeepCompareEffect(() => {
487
- var nextList = [];
488
- if (dataSource.length) {
489
- dataSource.forEach((item, index) => {
490
- var key = getRowKey(item) || `&&${getRandom()}`;
491
- var innerItem = list.find(child => getRowKey(child) === key);
492
- var nextItem = innerItem ? _objectSpread(_objectSpread(_objectSpread({
493
- editable: !isSingle
494
- }, innerItem), item), {}, {
495
- rowKey: key
496
- }) : _objectSpread(_objectSpread({
497
- editable: !isSingle
498
- }, item), {}, {
499
- rowKey: key
500
- });
501
- nextList.push(nextItem);
502
- });
503
- setList(nextList);
504
- } else {
505
- setList([]);
506
- }
507
- }, [dataSource]);
508
- useDeepCompareEffect(() => {
509
- try {
510
- if (list !== null && list !== void 0 && list.length) {
511
- list.forEach((item, index) => {
512
- // 可编辑状态默认给表单回填数据
513
- if (item.editable) {
514
- form.setFieldsValue({
515
- [index]: item
516
- });
517
- }
518
- });
519
- }
520
- } catch (error) {
521
- console.error('error', error);
522
- }
523
- }, [list]);
524
- var empty = () =>
525
- /*#__PURE__*/
526
- // 这里面就是我们自己定义的空状态
527
- _jsxs("div", {
528
- className: "com-empty",
529
- children: [/*#__PURE__*/_jsx("img", {
530
- className: "empty-img",
531
- src: Empty
532
- }), !disabled && isCanAdd ? /*#__PURE__*/_jsxs("div", {
533
- className: "empty-text",
534
- children: ["\u6682\u65E0\u6570\u636E\uFF0C", /*#__PURE__*/_jsx(_Button, _objectSpread(_objectSpread({
535
- type: "link",
536
- onClick: () => {
537
- onAdd();
538
- }
539
- }, antButtonProps), {}, {
540
- children: emptyButtonText
541
- }))]
542
- }) : /*#__PURE__*/_jsx("p", {
543
- children: "\u6682\u65E0\u6570\u636E"
544
- })]
545
- });
546
- return /*#__PURE__*/_jsxs(_Fragment, {
547
- children: [['topLeft', 'topRight'].includes(position) && renderAddButton(), /*#__PURE__*/_jsx(_Form, _objectSpread(_objectSpread({
548
- form: form,
549
- className: "proEditable pro-editable"
550
- }, formProps), {}, {
551
- children: name ? /*#__PURE__*/_jsx(_Form.Item, {
552
- name: name,
553
- children: /*#__PURE__*/_jsx(_ConfigProvider, {
554
- renderEmpty: list !== null && list !== void 0 && list.length ? undefined : empty,
555
- children: /*#__PURE__*/_jsx(_Table, _objectSpread(_objectSpread({
556
- dataSource: list,
557
- columns: newColumns,
558
- pagination: pagination,
559
- rowSelection: isCanMultipleDelete && !disabled ? rowSelection : undefined,
560
- ref: node => tableRef.current = node
561
- }, otherProps), {}, {
562
- rowKey: getRowKey
563
- }))
564
- })
565
- }) : /*#__PURE__*/_jsx(_ConfigProvider, {
566
- renderEmpty: list !== null && list !== void 0 && list.length ? undefined : empty,
567
- children: /*#__PURE__*/_jsx(_Table, _objectSpread(_objectSpread({
568
- dataSource: list,
569
- columns: newColumns,
570
- pagination: pagination,
571
- rowSelection: isCanMultipleDelete && !disabled ? rowSelection : undefined,
572
- ref: node => tableRef.current = node
573
- }, otherProps), {}, {
574
- rowKey: getRowKey
575
- }))
576
- })
577
- })), ['bottomLeft', 'bottomRight'].includes(position) && renderAddButton()]
578
- });
579
- });
580
- ProEditableTable.defaultProps = {
581
- dataSource: [],
582
- columns: [],
583
- editType: 'single',
584
- pagination: false,
585
- onlyOneLineEditorAlertMessage: '只能同时编辑一行',
586
- noSaveAlertMessage: '请保存当前行数据',
587
- mulDeletePoconfirmMsg: '您确定要删除吗?',
588
- addButtonProps: {},
589
- disabled: false,
590
- formProps: {
591
- preserve: false
592
- }
593
- };
594
- export default ProEditableTable;
@@ -1,68 +0,0 @@
1
- import { ButtonProps } from 'antd/es/button';
2
- import { FormProps } from 'antd/es/form';
3
- import { TablePaginationConfig } from 'antd/es/table/Table';
4
- import React from 'react';
5
- export type TypePropsType = 'Input' | 'InputNumber' | 'InputRange' | 'TextArea' | 'Select' | 'Switch' | 'DatePicker' | 'RangePicker' | 'Cascader' | 'Checkbox' | 'Radio';
6
- export type editTypePropsType = 'single' | 'multiple';
7
- export type insertTypePropsType = 'before' | 'after';
8
- export interface IAddOptionsPropsType {
9
- insertType: string;
10
- }
11
- export interface IRowDataPropsType {
12
- editable?: boolean;
13
- isFirst?: boolean;
14
- [key: string]: any;
15
- }
16
- export interface IActionReturnPropsType {
17
- nextList: IRowDataPropsType[];
18
- list: IRowDataPropsType[];
19
- rowData: IRowDataPropsType;
20
- rowIndex: number;
21
- }
22
- export interface IAddButtonPropsType extends ButtonProps {
23
- isCanAdd?: boolean;
24
- isCanMultipleDelete?: boolean;
25
- position?: string;
26
- insertType?: insertTypePropsType;
27
- buttonText?: any;
28
- emptyButtonText?: any;
29
- onMultipleDelete?: Function;
30
- multipleDeleteModalProps?: any;
31
- multipleDeleteErrorMessage?: string;
32
- onlyAddOneLineAlertMessage?: string;
33
- }
34
- export interface TActionRefPropsType {
35
- onUpdateRowData: Function;
36
- onAdd: Function;
37
- onDelete: Function;
38
- onMultipleDelete: Function;
39
- onEdit: Function;
40
- onSave: Function;
41
- onCancel: Function;
42
- tableNode: HTMLDivElement;
43
- validateFields: Function;
44
- setDataSource: Function;
45
- getPureDataSource: Function;
46
- data: IRowDataPropsType[];
47
- selectedRows: IRowDataPropsType[];
48
- selectedRowKeys: React.Key[];
49
- setSelectedRowKeys: React.Dispatch<React.SetStateAction<React.Key[]>>;
50
- setSelectedRows: React.Dispatch<React.SetStateAction<IRowDataPropsType[]>>;
51
- }
52
- export interface ProEditableTablePropsType {
53
- addButtonProps?: IAddButtonPropsType;
54
- name?: string;
55
- editType: editTypePropsType;
56
- columns: any;
57
- dataSource: any;
58
- rowKey: string;
59
- pagination?: TablePaginationConfig;
60
- formProps?: FormProps;
61
- isAllEditable?: boolean;
62
- [key: string]: any;
63
- }
64
- export interface FormItemComponentPropsType {
65
- type?: TypePropsType;
66
- name?: string[];
67
- [key: string]: any;
68
- }
@@ -1 +0,0 @@
1
- export {};