@ant-design/pro-components 3.0.0-beta.1 → 3.0.0-beta.3

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 (784) hide show
  1. package/dist/pro-components.min.js +1 -1
  2. package/es/card/ProCard.d.ts +0 -1
  3. package/es/card/ProCard.js +11 -23
  4. package/es/card/components/Actions/index.js +33 -28
  5. package/es/card/components/Actions/style.js +72 -100
  6. package/es/card/components/Card/index.js +212 -258
  7. package/es/card/components/Card/style.js +192 -266
  8. package/es/card/components/CheckCard/Group.js +198 -208
  9. package/es/card/components/CheckCard/index.js +151 -160
  10. package/es/card/components/CheckCard/style.js +186 -212
  11. package/es/card/components/Divider/index.js +23 -18
  12. package/es/card/components/Divider/style.js +30 -54
  13. package/es/card/components/Loading/index.js +80 -13
  14. package/es/card/components/Loading/style.js +42 -63
  15. package/es/card/components/Operation/index.js +22 -17
  16. package/es/card/components/Operation/style.js +19 -43
  17. package/es/card/components/Statistic/index.js +79 -96
  18. package/es/card/components/Statistic/style.js +76 -115
  19. package/es/card/components/StatisticCard/index.d.ts +0 -2
  20. package/es/card/components/StatisticCard/index.js +59 -70
  21. package/es/card/components/StatisticCard/style.js +36 -55
  22. package/es/card/index.d.ts +2 -2
  23. package/es/card/index.js +2 -9
  24. package/es/card/typing.js +1 -0
  25. package/es/descriptions/index.js +363 -414
  26. package/es/descriptions/useFetchData.js +94 -73
  27. package/es/field/AllProField.js +438 -361
  28. package/es/field/FieldHOC/index.js +32 -28
  29. package/es/field/PureProField.js +129 -160
  30. package/es/field/ValueTypeToComponent.js +686 -396
  31. package/es/field/components/Cascader/index.d.ts +2 -2
  32. package/es/field/components/Cascader/index.js +124 -149
  33. package/es/field/components/Checkbox/index.d.ts +1 -1
  34. package/es/field/components/Checkbox/index.js +106 -128
  35. package/es/field/components/Code/index.js +67 -60
  36. package/es/field/components/ColorPicker/index.d.ts +1 -1
  37. package/es/field/components/ColorPicker/index.js +55 -78
  38. package/es/field/components/DatePicker/index.d.ts +2 -2
  39. package/es/field/components/DatePicker/index.js +100 -116
  40. package/es/field/components/Digit/index.js +84 -83
  41. package/es/field/components/DigitRange/index.js +102 -96
  42. package/es/field/components/FromNow/index.js +50 -62
  43. package/es/field/components/Image/index.js +46 -50
  44. package/es/field/components/IndexColumn/index.js +45 -43
  45. package/es/field/components/Money/index.js +244 -253
  46. package/es/field/components/Options/index.js +61 -71
  47. package/es/field/components/Password/index.js +62 -59
  48. package/es/field/components/Percent/index.js +74 -80
  49. package/es/field/components/Percent/util.js +23 -18
  50. package/es/field/components/Progress/index.js +53 -54
  51. package/es/field/components/Radio/index.d.ts +1 -1
  52. package/es/field/components/Radio/index.js +85 -107
  53. package/es/field/components/RangePicker/index.d.ts +2 -2
  54. package/es/field/components/RangePicker/index.js +122 -137
  55. package/es/field/components/Rate/index.js +39 -35
  56. package/es/field/components/Second/index.js +61 -59
  57. package/es/field/components/Segmented/index.d.ts +1 -1
  58. package/es/field/components/Segmented/index.js +68 -90
  59. package/es/field/components/Select/LightSelect/index.d.ts +1 -1
  60. package/es/field/components/Select/LightSelect/index.js +210 -256
  61. package/es/field/components/Select/SearchSelect/index.js +192 -225
  62. package/es/field/components/Select/index.d.ts +2 -2
  63. package/es/field/components/Select/index.js +299 -368
  64. package/es/field/components/Slider/index.js +39 -45
  65. package/es/field/components/Status/index.js +83 -23
  66. package/es/field/components/Switch/index.d.ts +1 -1
  67. package/es/field/components/Switch/index.js +60 -71
  68. package/es/field/components/Text/index.js +53 -48
  69. package/es/field/components/TextArea/index.js +39 -53
  70. package/es/field/components/TextArea/readonly.js +36 -50
  71. package/es/field/components/TimePicker/index.js +182 -190
  72. package/es/field/components/TreeSelect/index.d.ts +2 -2
  73. package/es/field/components/TreeSelect/index.js +178 -184
  74. package/es/field/index.js +3 -43
  75. package/es/form/BaseForm/BaseForm.js +581 -621
  76. package/es/form/BaseForm/EditOrReadOnlyContext.js +4 -8
  77. package/es/form/BaseForm/LightWrapper/index.js +104 -161
  78. package/es/form/BaseForm/LightWrapper/style.js +14 -41
  79. package/es/form/BaseForm/Submitter/index.js +69 -100
  80. package/es/form/BaseForm/index.js +1 -2
  81. package/es/form/FieldContext.js +4 -8
  82. package/es/form/components/Captcha/index.js +162 -169
  83. package/es/form/components/Cascader/index.js +46 -75
  84. package/es/form/components/Checkbox/index.js +73 -98
  85. package/es/form/components/ColorPicker/index.js +43 -64
  86. package/es/form/components/DatePicker/BaseDatePicker.js +45 -69
  87. package/es/form/components/DatePicker/DatePicker.js +26 -51
  88. package/es/form/components/DatePicker/DateTimePicker.js +26 -50
  89. package/es/form/components/DatePicker/MonthPicker.js +26 -51
  90. package/es/form/components/DatePicker/QuarterPicker.js +26 -51
  91. package/es/form/components/DatePicker/TimePicker.js +43 -72
  92. package/es/form/components/DatePicker/WeekPicker.js +26 -51
  93. package/es/form/components/DatePicker/YearPicker.js +26 -51
  94. package/es/form/components/DatePicker/index.js +4 -6
  95. package/es/form/components/DateRangePicker/BaseDateRanger.js +42 -70
  96. package/es/form/components/DateRangePicker/DateMonthRangePicker.js +29 -51
  97. package/es/form/components/DateRangePicker/DateQuarterRangePicker.js +29 -51
  98. package/es/form/components/DateRangePicker/DateTimeRangePicker.js +29 -51
  99. package/es/form/components/DateRangePicker/DateWeekRangePicker.js +29 -51
  100. package/es/form/components/DateRangePicker/DateYearRangePicker.js +29 -51
  101. package/es/form/components/DateRangePicker/TimeRangePicker.js +42 -67
  102. package/es/form/components/DateRangePicker/index.js +29 -51
  103. package/es/form/components/Dependency/index.js +56 -96
  104. package/es/form/components/Digit/DigitRange.d.ts +1 -1
  105. package/es/form/components/Digit/DigitRange.js +42 -75
  106. package/es/form/components/Digit/index.js +47 -78
  107. package/es/form/components/Field/index.js +80 -124
  108. package/es/form/components/FieldSet/index.js +95 -123
  109. package/es/form/components/FormItem/FormItemRender/index.js +135 -92
  110. package/es/form/components/FormItem/Group/index.js +134 -169
  111. package/es/form/components/FormItem/Group/style.js +41 -62
  112. package/es/form/components/FormItem/index.js +252 -293
  113. package/es/form/components/FormItem/warpField.js +218 -285
  114. package/es/form/components/List/ListContainer.js +221 -181
  115. package/es/form/components/List/ListItem.js +258 -350
  116. package/es/form/components/List/index.js +195 -252
  117. package/es/form/components/List/style.js +48 -95
  118. package/es/form/components/Money/index.js +50 -80
  119. package/es/form/components/Radio/index.js +52 -86
  120. package/es/form/components/Rate/index.js +37 -60
  121. package/es/form/components/SchemaForm/index.js +121 -167
  122. package/es/form/components/SchemaForm/layoutType/Embed.js +8 -5
  123. package/es/form/components/SchemaForm/layoutType/StepsForm.js +35 -68
  124. package/es/form/components/SchemaForm/layoutType/index.js +2 -7
  125. package/es/form/components/SchemaForm/typing.js +1 -0
  126. package/es/form/components/SchemaForm/valueType/dependency.js +19 -43
  127. package/es/form/components/SchemaForm/valueType/divider.js +11 -30
  128. package/es/form/components/SchemaForm/valueType/field.js +59 -100
  129. package/es/form/components/SchemaForm/valueType/formList.js +16 -42
  130. package/es/form/components/SchemaForm/valueType/formSet.js +16 -42
  131. package/es/form/components/SchemaForm/valueType/group.js +15 -37
  132. package/es/form/components/SchemaForm/valueType/ignore.js +4 -7
  133. package/es/form/components/SchemaForm/valueType/index.js +16 -17
  134. package/es/form/components/Segmented/index.js +43 -61
  135. package/es/form/components/Select/index.js +114 -151
  136. package/es/form/components/Slider/index.js +54 -91
  137. package/es/form/components/Switch/index.js +47 -71
  138. package/es/form/components/Text/index.js +132 -161
  139. package/es/form/components/TextArea/index.js +34 -57
  140. package/es/form/components/TreeSelect/index.js +42 -61
  141. package/es/form/components/UploadButton/index.js +125 -145
  142. package/es/form/components/UploadDragger/index.js +77 -92
  143. package/es/form/components/index.js +36 -88
  144. package/es/form/helpers/grid.js +77 -82
  145. package/es/form/helpers/index.js +1 -2
  146. package/es/form/index.js +6 -15
  147. package/es/form/layouts/DrawerForm/index.js +308 -315
  148. package/es/form/layouts/DrawerForm/style.js +26 -50
  149. package/es/form/layouts/LightFilter/index.js +208 -270
  150. package/es/form/layouts/LightFilter/style.js +49 -74
  151. package/es/form/layouts/LoginForm/index.js +85 -104
  152. package/es/form/layouts/LoginForm/style.js +68 -95
  153. package/es/form/layouts/LoginFormPage/index.js +141 -147
  154. package/es/form/layouts/LoginFormPage/style.js +129 -154
  155. package/es/form/layouts/ModalForm/index.js +247 -253
  156. package/es/form/layouts/ProForm/index.js +15 -32
  157. package/es/form/layouts/QueryFilter/Actions.js +52 -47
  158. package/es/form/layouts/QueryFilter/index.js +297 -359
  159. package/es/form/layouts/QueryFilter/style.js +38 -69
  160. package/es/form/layouts/StepsForm/StepForm.js +87 -119
  161. package/es/form/layouts/StepsForm/index.js +339 -353
  162. package/es/form/layouts/StepsForm/style.js +29 -50
  163. package/es/form/layouts/index.js +9 -20
  164. package/es/form/typing.js +1 -0
  165. package/es/index.js +1 -5
  166. package/es/layout/ProLayout.js +426 -497
  167. package/es/layout/WrapContent.js +26 -15
  168. package/es/layout/assert/Logo.js +107 -79
  169. package/es/layout/components/AppsLogoComponents/AppsLogo.js +13 -11
  170. package/es/layout/components/AppsLogoComponents/DefaultContent.js +50 -56
  171. package/es/layout/components/AppsLogoComponents/SimpleContent.js +73 -66
  172. package/es/layout/components/AppsLogoComponents/index.js +90 -73
  173. package/es/layout/components/AppsLogoComponents/style/default.js +31 -35
  174. package/es/layout/components/AppsLogoComponents/style/index.js +51 -77
  175. package/es/layout/components/AppsLogoComponents/style/simple.js +37 -40
  176. package/es/layout/components/CollapsedIcon/index.js +19 -55
  177. package/es/layout/components/CollapsedIcon/style.js +42 -66
  178. package/es/layout/components/Footer.js +27 -38
  179. package/es/layout/components/FooterToolbar/index.js +78 -102
  180. package/es/layout/components/FooterToolbar/style/index.js +38 -62
  181. package/es/layout/components/FooterToolbar/style/stylish.js +10 -38
  182. package/es/layout/components/GlobalFooter/index.js +37 -31
  183. package/es/layout/components/GlobalFooter/style.js +32 -53
  184. package/es/layout/components/GlobalHeader/ActionsContent.js +132 -181
  185. package/es/layout/components/GlobalHeader/index.d.ts +0 -5
  186. package/es/layout/components/GlobalHeader/index.js +76 -84
  187. package/es/layout/components/GlobalHeader/rightContentStyle.js +52 -76
  188. package/es/layout/components/GlobalHeader/style.js +57 -83
  189. package/es/layout/components/GridContent/index.js +35 -33
  190. package/es/layout/components/GridContent/style.js +14 -38
  191. package/es/layout/components/Header/index.js +95 -124
  192. package/es/layout/components/Header/style/header.js +48 -72
  193. package/es/layout/components/Header/style/stylish.js +12 -42
  194. package/es/layout/components/Help/AsyncContentPanel.js +53 -42
  195. package/es/layout/components/Help/HelpProvide.js +55 -6
  196. package/es/layout/components/Help/ProHelpContentPanel.js +128 -127
  197. package/es/layout/components/Help/ProHelpDrawer.js +48 -76
  198. package/es/layout/components/Help/ProHelpModal.js +47 -76
  199. package/es/layout/components/Help/ProHelpPanel.js +183 -224
  200. package/es/layout/components/Help/ProHelpPopover.js +37 -64
  201. package/es/layout/components/Help/RenderContentPanel.js +90 -103
  202. package/es/layout/components/Help/Search.js +124 -163
  203. package/es/layout/components/Help/index.js +19 -40
  204. package/es/layout/components/Help/style.js +90 -115
  205. package/es/layout/components/PageContainer/index.js +233 -280
  206. package/es/layout/components/PageContainer/style/index.js +78 -118
  207. package/es/layout/components/PageContainer/style/stylish.js +10 -38
  208. package/es/layout/components/PageHeader/index.js +144 -129
  209. package/es/layout/components/PageHeader/style/index.js +125 -172
  210. package/es/layout/components/PageLoading/index.js +23 -50
  211. package/es/layout/components/SettingDrawer/BlockCheckbox.js +42 -42
  212. package/es/layout/components/SettingDrawer/LayoutChange.js +108 -98
  213. package/es/layout/components/SettingDrawer/RegionalChange.js +31 -34
  214. package/es/layout/components/SettingDrawer/ThemeColor.js +50 -69
  215. package/es/layout/components/SettingDrawer/icon/group.js +109 -88
  216. package/es/layout/components/SettingDrawer/icon/sub.js +70 -116
  217. package/es/layout/components/SettingDrawer/index.js +405 -420
  218. package/es/layout/components/SettingDrawer/style/index.js +142 -146
  219. package/es/layout/components/SiderMenu/Arrow.js +12 -15
  220. package/es/layout/components/SiderMenu/BaseMenu.js +402 -451
  221. package/es/layout/components/SiderMenu/SiderMenu.js +246 -336
  222. package/es/layout/components/SiderMenu/index.js +72 -101
  223. package/es/layout/components/SiderMenu/style/index.js +171 -210
  224. package/es/layout/components/SiderMenu/style/menu.js +110 -173
  225. package/es/layout/components/SiderMenu/style/stylish.js +12 -42
  226. package/es/layout/components/TopNavHeader/index.js +106 -179
  227. package/es/layout/components/TopNavHeader/style.js +67 -95
  228. package/es/layout/context/RouteContext.js +2 -6
  229. package/es/layout/defaultSettings.js +6 -9
  230. package/es/layout/getPageTitle.js +46 -40
  231. package/es/layout/index.js +4 -27
  232. package/es/layout/locales/en-US/settingDrawer.js +43 -47
  233. package/es/layout/locales/en-US.js +2 -22
  234. package/es/layout/locales/index.js +13 -18
  235. package/es/layout/locales/it-IT/settingDrawer.js +34 -38
  236. package/es/layout/locales/it-IT.js +2 -22
  237. package/es/layout/locales/ko-KR/settingDrawer.js +39 -43
  238. package/es/layout/locales/ko-KR.js +2 -22
  239. package/es/layout/locales/zh-CN/settingDrawer.js +43 -47
  240. package/es/layout/locales/zh-CN.js +2 -22
  241. package/es/layout/locales/zh-TW/settingDrawer.js +35 -39
  242. package/es/layout/locales/zh-TW.js +2 -22
  243. package/es/layout/style/index.js +43 -73
  244. package/es/layout/typing.js +1 -0
  245. package/es/layout/utils/getBreadcrumbProps.js +111 -91
  246. package/es/layout/utils/getMenuData.js +18 -21
  247. package/es/layout/utils/pathTools.js +11 -12
  248. package/es/layout/utils/useCurrentMenuLayoutProps.js +21 -29
  249. package/es/layout/utils/utils.js +35 -51
  250. package/es/list/Item.js +222 -294
  251. package/es/list/ListView.js +188 -232
  252. package/es/list/constants.js +4 -17
  253. package/es/list/index.js +121 -178
  254. package/es/list/style/index.js +224 -287
  255. package/es/provider/index.js +228 -179
  256. package/es/provider/intl.js +100 -124
  257. package/es/provider/locale/ar_EG.js +47 -51
  258. package/es/provider/locale/ca_ES.js +45 -49
  259. package/es/provider/locale/cs_CZ.js +50 -54
  260. package/es/provider/locale/de_DE.js +47 -51
  261. package/es/provider/locale/en_GB.js +49 -53
  262. package/es/provider/locale/en_US.js +51 -55
  263. package/es/provider/locale/es_ES.js +47 -51
  264. package/es/provider/locale/fa_IR.js +47 -51
  265. package/es/provider/locale/fr_FR.js +47 -51
  266. package/es/provider/locale/he_IL.js +50 -54
  267. package/es/provider/locale/hr_HR.js +47 -51
  268. package/es/provider/locale/id_ID.js +47 -51
  269. package/es/provider/locale/it_IT.js +47 -51
  270. package/es/provider/locale/ja_JP.js +47 -51
  271. package/es/provider/locale/ko_KR.js +47 -51
  272. package/es/provider/locale/mn_MN.js +47 -51
  273. package/es/provider/locale/ms_MY.js +47 -51
  274. package/es/provider/locale/nl_NL.js +50 -54
  275. package/es/provider/locale/pl_PL.js +47 -51
  276. package/es/provider/locale/pt_BR.js +47 -51
  277. package/es/provider/locale/ro_RO.js +50 -54
  278. package/es/provider/locale/ru_RU.js +47 -51
  279. package/es/provider/locale/sk_SK.js +50 -54
  280. package/es/provider/locale/sr_RS.js +47 -51
  281. package/es/provider/locale/sv_SE.js +50 -54
  282. package/es/provider/locale/th_TH.js +50 -54
  283. package/es/provider/locale/tr_TR.js +47 -51
  284. package/es/provider/locale/uk_UA.js +50 -54
  285. package/es/provider/locale/uz_UZ.js +47 -51
  286. package/es/provider/locale/vi_VN.js +47 -51
  287. package/es/provider/locale/zh_CN.js +50 -54
  288. package/es/provider/locale/zh_HK.js +50 -54
  289. package/es/provider/locale/zh_TW.js +50 -54
  290. package/es/provider/typing/layoutToken.d.ts +0 -10
  291. package/es/provider/typing/layoutToken.js +19 -42
  292. package/es/provider/useStyle/index.d.ts +1 -1
  293. package/es/provider/useStyle/index.js +91 -78
  294. package/es/provider/utils/merge.js +13 -29
  295. package/es/skeleton/components/Descriptions/index.js +240 -252
  296. package/es/skeleton/components/List/index.js +217 -207
  297. package/es/skeleton/components/Result/index.js +57 -54
  298. package/es/skeleton/index.js +18 -62
  299. package/es/table/Store/Provide.d.ts +0 -1
  300. package/es/table/Store/Provide.js +141 -128
  301. package/es/table/Table.js +645 -698
  302. package/es/table/components/Alert/index.js +60 -37
  303. package/es/table/components/Alert/style.js +28 -52
  304. package/es/table/components/ColumnSetting/index.js +382 -387
  305. package/es/table/components/ColumnSetting/style.js +72 -108
  306. package/es/table/components/DragSortTable/index.js +101 -137
  307. package/es/table/components/DragSortTable/style.js +20 -44
  308. package/es/table/components/Dropdown/index.js +70 -83
  309. package/es/table/components/EditableTable/CellEditorTable.js +50 -65
  310. package/es/table/components/EditableTable/RowEditorTable.js +44 -62
  311. package/es/table/components/EditableTable/index.js +343 -347
  312. package/es/table/components/Form/FormRender.js +167 -173
  313. package/es/table/components/Form/index.js +123 -132
  314. package/es/table/components/ListToolBar/HeaderMenu.js +68 -102
  315. package/es/table/components/ListToolBar/index.js +254 -273
  316. package/es/table/components/ListToolBar/style.js +119 -134
  317. package/es/table/components/ToolBar/DensityIcon.js +36 -41
  318. package/es/table/components/ToolBar/FullscreenIcon.js +21 -14
  319. package/es/table/components/ToolBar/index.js +235 -267
  320. package/es/table/index.js +3 -50
  321. package/es/table/style/index.js +129 -175
  322. package/es/table/typing.d.ts +2 -2
  323. package/es/table/typing.js +1 -0
  324. package/es/table/useFetchData.js +432 -232
  325. package/es/table/utils/cellRenderToFromItem.js +186 -261
  326. package/es/table/utils/columnRender.js +116 -115
  327. package/es/table/utils/columnSort.js +23 -21
  328. package/es/table/utils/genProColumnToColumn.js +101 -129
  329. package/es/table/utils/index.js +197 -115
  330. package/es/table/utils/useDragSort.js +135 -174
  331. package/es/utils/components/DropdownFooter/index.js +48 -58
  332. package/es/utils/components/DropdownFooter/style.js +16 -40
  333. package/es/utils/components/ErrorBoundary/index.js +51 -25
  334. package/es/utils/components/FieldLabel/index.js +119 -146
  335. package/es/utils/components/FieldLabel/style.js +82 -128
  336. package/es/utils/components/FilterDropdown/index.js +54 -81
  337. package/es/utils/components/FilterDropdown/style.js +17 -38
  338. package/es/utils/components/InlineErrorFormItem/index.js +132 -167
  339. package/es/utils/components/InlineErrorFormItem/style.js +51 -79
  340. package/es/utils/components/LabelIconTip/index.js +58 -56
  341. package/es/utils/components/LabelIconTip/style.js +36 -57
  342. package/es/utils/components/ProFormContext/index.js +2 -6
  343. package/es/utils/conversionMomentValue/index.js +102 -83
  344. package/es/utils/dateArrayFormatter/index.js +31 -16
  345. package/es/utils/genCopyable/index.js +44 -38
  346. package/es/utils/getFieldPropsOrFormItemProps/index.js +10 -7
  347. package/es/utils/hooks/useDebounceFn/index.js +58 -48
  348. package/es/utils/hooks/useDebounceValue/index.js +29 -19
  349. package/es/utils/hooks/useDeepCompareEffect/index.js +29 -44
  350. package/es/utils/hooks/useDeepCompareMemo/index.js +12 -10
  351. package/es/utils/hooks/useDocumentTitle/index.js +5 -9
  352. package/es/utils/hooks/useFetchData/index.js +70 -63
  353. package/es/utils/hooks/useForceRender/index.js +12 -9
  354. package/es/utils/hooks/useLatest/index.js +8 -8
  355. package/es/utils/hooks/usePrevious/index.js +5 -9
  356. package/es/utils/hooks/useReactiveRef/index.js +4 -8
  357. package/es/utils/hooks/useRefCallback/index.js +6 -10
  358. package/es/utils/hooks/useRefFunction/index.js +11 -10
  359. package/es/utils/index.d.ts +1 -3
  360. package/es/utils/index.js +9 -84
  361. package/es/utils/isBrowser/index.js +14 -9
  362. package/es/utils/isDeepEqualReact/index.js +79 -53
  363. package/es/utils/isDropdownValueType/index.js +4 -8
  364. package/es/utils/isImg/index.js +3 -6
  365. package/es/utils/isNil/index.js +3 -5
  366. package/es/utils/isUrl/index.js +10 -10
  367. package/es/utils/merge/index.js +20 -27
  368. package/es/utils/nanoid/index.js +24 -18
  369. package/es/utils/omitBoolean/index.js +8 -7
  370. package/es/utils/omitUndefined/index.js +6 -10
  371. package/es/utils/omitUndefinedAndEmptyArr/index.js +7 -11
  372. package/es/utils/parseValueToMoment/index.js +16 -14
  373. package/es/utils/pickProFormItemProps/index.js +9 -42
  374. package/es/utils/pickProProps/index.js +9 -11
  375. package/es/utils/proFieldParsingText/index.js +141 -49
  376. package/es/utils/runFunction/index.js +8 -8
  377. package/es/utils/stringify/index.js +4 -9
  378. package/es/utils/transformKeySubmitValue/index.js +254 -130
  379. package/es/utils/typing.js +1 -0
  380. package/es/utils/useEditableArray/index.js +776 -611
  381. package/es/utils/useEditableMap/index.js +179 -161
  382. package/es/utils/useMediaQuery/index.js +47 -43
  383. package/es/utils/useMediaQuery/query.js +19 -15
  384. package/es/utils/useMountMergeState/index.d.ts +1 -1
  385. package/es/utils/useMountMergeState/index.js +2 -5
  386. package/es/version.js +3 -7
  387. package/lib/card/ProCard.d.ts +0 -1
  388. package/lib/card/ProCard.js +20 -52
  389. package/lib/card/components/Actions/index.js +39 -57
  390. package/lib/card/components/Actions/style.js +77 -115
  391. package/lib/card/components/Card/index.js +221 -287
  392. package/lib/card/components/Card/style.js +197 -281
  393. package/lib/card/components/CheckCard/Group.js +205 -230
  394. package/lib/card/components/CheckCard/index.js +160 -190
  395. package/lib/card/components/CheckCard/style.js +192 -227
  396. package/lib/card/components/Divider/index.js +30 -47
  397. package/lib/card/components/Divider/style.js +35 -69
  398. package/lib/card/components/Loading/index.js +85 -42
  399. package/lib/card/components/Loading/style.js +48 -78
  400. package/lib/card/components/Operation/index.js +29 -46
  401. package/lib/card/components/Operation/style.js +24 -58
  402. package/lib/card/components/Statistic/index.js +84 -117
  403. package/lib/card/components/Statistic/style.js +81 -130
  404. package/lib/card/components/StatisticCard/index.d.ts +0 -2
  405. package/lib/card/components/StatisticCard/index.js +72 -103
  406. package/lib/card/components/StatisticCard/style.js +41 -70
  407. package/lib/card/index.d.ts +2 -2
  408. package/lib/card/index.js +34 -41
  409. package/lib/card/typing.js +4 -16
  410. package/lib/descriptions/index.js +368 -436
  411. package/lib/descriptions/useFetchData.js +99 -100
  412. package/lib/field/AllProField.js +477 -415
  413. package/lib/field/FieldHOC/index.js +37 -56
  414. package/lib/field/PureProField.js +141 -187
  415. package/lib/field/ValueTypeToComponent.js +725 -454
  416. package/lib/field/components/Cascader/index.d.ts +2 -2
  417. package/lib/field/components/Cascader/index.js +132 -171
  418. package/lib/field/components/Checkbox/index.d.ts +1 -1
  419. package/lib/field/components/Checkbox/index.js +113 -155
  420. package/lib/field/components/Code/index.js +73 -86
  421. package/lib/field/components/ColorPicker/index.d.ts +1 -1
  422. package/lib/field/components/ColorPicker/index.js +61 -103
  423. package/lib/field/components/DatePicker/index.d.ts +2 -2
  424. package/lib/field/components/DatePicker/index.js +109 -145
  425. package/lib/field/components/Digit/index.js +92 -110
  426. package/lib/field/components/DigitRange/index.js +108 -122
  427. package/lib/field/components/FromNow/index.js +57 -90
  428. package/lib/field/components/Image/index.js +52 -76
  429. package/lib/field/components/IndexColumn/index.js +50 -72
  430. package/lib/field/components/Money/index.js +253 -281
  431. package/lib/field/components/Options/index.js +68 -98
  432. package/lib/field/components/Password/index.js +66 -85
  433. package/lib/field/components/Percent/index.js +80 -101
  434. package/lib/field/components/Percent/util.js +28 -33
  435. package/lib/field/components/Progress/index.js +61 -80
  436. package/lib/field/components/Radio/index.d.ts +1 -1
  437. package/lib/field/components/Radio/index.js +92 -134
  438. package/lib/field/components/RangePicker/index.d.ts +2 -2
  439. package/lib/field/components/RangePicker/index.js +129 -164
  440. package/lib/field/components/Rate/index.js +43 -60
  441. package/lib/field/components/Second/index.js +67 -84
  442. package/lib/field/components/Segmented/index.d.ts +1 -1
  443. package/lib/field/components/Segmented/index.js +74 -117
  444. package/lib/field/components/Select/LightSelect/index.d.ts +1 -1
  445. package/lib/field/components/Select/LightSelect/index.js +216 -282
  446. package/lib/field/components/Select/SearchSelect/index.js +195 -245
  447. package/lib/field/components/Select/index.d.ts +2 -2
  448. package/lib/field/components/Select/index.js +307 -379
  449. package/lib/field/components/Slider/index.js +43 -70
  450. package/lib/field/components/Status/index.js +89 -52
  451. package/lib/field/components/Switch/index.d.ts +1 -1
  452. package/lib/field/components/Switch/index.js +67 -98
  453. package/lib/field/components/Text/index.js +58 -74
  454. package/lib/field/components/TextArea/index.js +44 -80
  455. package/lib/field/components/TextArea/readonly.js +43 -76
  456. package/lib/field/components/TimePicker/index.js +188 -217
  457. package/lib/field/components/TreeSelect/index.d.ts +2 -2
  458. package/lib/field/components/TreeSelect/index.js +185 -206
  459. package/lib/field/index.js +240 -96
  460. package/lib/form/BaseForm/BaseForm.js +594 -634
  461. package/lib/form/BaseForm/EditOrReadOnlyContext.js +9 -36
  462. package/lib/form/BaseForm/LightWrapper/index.js +111 -182
  463. package/lib/form/BaseForm/LightWrapper/style.js +19 -56
  464. package/lib/form/BaseForm/Submitter/index.js +75 -126
  465. package/lib/form/BaseForm/index.js +37 -20
  466. package/lib/form/FieldContext.js +8 -36
  467. package/lib/form/components/Captcha/index.js +169 -196
  468. package/lib/form/components/Cascader/index.js +56 -104
  469. package/lib/form/components/Checkbox/index.js +83 -128
  470. package/lib/form/components/ColorPicker/index.js +51 -92
  471. package/lib/form/components/DatePicker/BaseDatePicker.js +54 -98
  472. package/lib/form/components/DatePicker/DatePicker.js +32 -77
  473. package/lib/form/components/DatePicker/DateTimePicker.js +32 -76
  474. package/lib/form/components/DatePicker/MonthPicker.js +32 -77
  475. package/lib/form/components/DatePicker/QuarterPicker.js +32 -77
  476. package/lib/form/components/DatePicker/TimePicker.js +55 -103
  477. package/lib/form/components/DatePicker/WeekPicker.js +32 -77
  478. package/lib/form/components/DatePicker/YearPicker.js +32 -77
  479. package/lib/form/components/DatePicker/index.js +19 -44
  480. package/lib/form/components/DateRangePicker/BaseDateRanger.js +53 -100
  481. package/lib/form/components/DateRangePicker/DateMonthRangePicker.js +36 -78
  482. package/lib/form/components/DateRangePicker/DateQuarterRangePicker.js +36 -78
  483. package/lib/form/components/DateRangePicker/DateTimeRangePicker.js +36 -78
  484. package/lib/form/components/DateRangePicker/DateWeekRangePicker.js +36 -78
  485. package/lib/form/components/DateRangePicker/DateYearRangePicker.js +36 -78
  486. package/lib/form/components/DateRangePicker/TimeRangePicker.js +53 -97
  487. package/lib/form/components/DateRangePicker/index.js +36 -78
  488. package/lib/form/components/Dependency/index.js +68 -127
  489. package/lib/form/components/Digit/DigitRange.d.ts +1 -1
  490. package/lib/form/components/Digit/DigitRange.js +50 -103
  491. package/lib/form/components/Digit/index.js +55 -106
  492. package/lib/form/components/Field/index.js +89 -153
  493. package/lib/form/components/FieldSet/index.js +107 -153
  494. package/lib/form/components/FormItem/FormItemRender/index.js +142 -114
  495. package/lib/form/components/FormItem/Group/index.js +143 -198
  496. package/lib/form/components/FormItem/Group/style.js +46 -77
  497. package/lib/form/components/FormItem/index.js +257 -316
  498. package/lib/form/components/FormItem/warpField.js +229 -308
  499. package/lib/form/components/List/ListContainer.js +227 -211
  500. package/lib/form/components/List/ListItem.js +267 -374
  501. package/lib/form/components/List/index.js +211 -277
  502. package/lib/form/components/List/style.js +53 -110
  503. package/lib/form/components/Money/index.js +58 -108
  504. package/lib/form/components/Radio/index.js +60 -114
  505. package/lib/form/components/Rate/index.js +45 -88
  506. package/lib/form/components/SchemaForm/index.js +154 -193
  507. package/lib/form/components/SchemaForm/layoutType/Embed.js +12 -24
  508. package/lib/form/components/SchemaForm/layoutType/StepsForm.js +43 -96
  509. package/lib/form/components/SchemaForm/layoutType/index.js +18 -35
  510. package/lib/form/components/SchemaForm/typing.js +4 -16
  511. package/lib/form/components/SchemaForm/valueType/dependency.js +25 -69
  512. package/lib/form/components/SchemaForm/valueType/divider.js +16 -45
  513. package/lib/form/components/SchemaForm/valueType/field.js +67 -128
  514. package/lib/form/components/SchemaForm/valueType/formList.js +22 -58
  515. package/lib/form/components/SchemaForm/valueType/formSet.js +22 -68
  516. package/lib/form/components/SchemaForm/valueType/group.js +21 -53
  517. package/lib/form/components/SchemaForm/valueType/ignore.js +8 -25
  518. package/lib/form/components/SchemaForm/valueType/index.js +27 -43
  519. package/lib/form/components/Segmented/index.js +50 -89
  520. package/lib/form/components/Select/index.js +125 -181
  521. package/lib/form/components/Slider/index.js +62 -119
  522. package/lib/form/components/Switch/index.js +55 -99
  523. package/lib/form/components/Text/index.js +141 -190
  524. package/lib/form/components/TextArea/index.js +42 -85
  525. package/lib/form/components/TreeSelect/index.js +50 -89
  526. package/lib/form/components/UploadButton/index.js +131 -172
  527. package/lib/form/components/UploadDragger/index.js +84 -119
  528. package/lib/form/components/index.js +294 -110
  529. package/lib/form/helpers/grid.js +82 -97
  530. package/lib/form/helpers/index.js +15 -18
  531. package/lib/form/index.js +78 -38
  532. package/lib/form/layouts/DrawerForm/index.js +317 -338
  533. package/lib/form/layouts/DrawerForm/style.js +31 -65
  534. package/lib/form/layouts/LightFilter/index.js +217 -293
  535. package/lib/form/layouts/LightFilter/style.js +54 -89
  536. package/lib/form/layouts/LoginForm/index.js +93 -133
  537. package/lib/form/layouts/LoginForm/style.js +73 -110
  538. package/lib/form/layouts/LoginFormPage/index.js +148 -174
  539. package/lib/form/layouts/LoginFormPage/style.js +133 -165
  540. package/lib/form/layouts/ModalForm/index.js +253 -273
  541. package/lib/form/layouts/ProForm/index.js +28 -68
  542. package/lib/form/layouts/QueryFilter/Actions.js +57 -77
  543. package/lib/form/layouts/QueryFilter/index.js +308 -390
  544. package/lib/form/layouts/QueryFilter/style.js +43 -84
  545. package/lib/form/layouts/StepsForm/StepForm.js +94 -146
  546. package/lib/form/layouts/StepsForm/index.js +351 -378
  547. package/lib/form/layouts/StepsForm/style.js +34 -65
  548. package/lib/form/layouts/index.js +62 -40
  549. package/lib/form/typing.js +4 -16
  550. package/lib/index.js +133 -34
  551. package/lib/layout/ProLayout.js +447 -528
  552. package/lib/layout/WrapContent.js +34 -46
  553. package/lib/layout/assert/Logo.js +110 -97
  554. package/lib/layout/components/AppsLogoComponents/AppsLogo.js +17 -29
  555. package/lib/layout/components/AppsLogoComponents/DefaultContent.js +55 -85
  556. package/lib/layout/components/AppsLogoComponents/SimpleContent.js +78 -95
  557. package/lib/layout/components/AppsLogoComponents/index.js +98 -105
  558. package/lib/layout/components/AppsLogoComponents/style/default.js +36 -55
  559. package/lib/layout/components/AppsLogoComponents/style/index.js +58 -94
  560. package/lib/layout/components/AppsLogoComponents/style/simple.js +41 -59
  561. package/lib/layout/components/CollapsedIcon/index.js +26 -82
  562. package/lib/layout/components/CollapsedIcon/style.js +47 -81
  563. package/lib/layout/components/Footer.js +33 -65
  564. package/lib/layout/components/FooterToolbar/index.js +87 -132
  565. package/lib/layout/components/FooterToolbar/style/index.js +43 -77
  566. package/lib/layout/components/FooterToolbar/style/stylish.js +16 -54
  567. package/lib/layout/components/GlobalFooter/index.js +43 -61
  568. package/lib/layout/components/GlobalFooter/style.js +37 -68
  569. package/lib/layout/components/GlobalHeader/ActionsContent.js +138 -208
  570. package/lib/layout/components/GlobalHeader/index.d.ts +0 -5
  571. package/lib/layout/components/GlobalHeader/index.js +86 -116
  572. package/lib/layout/components/GlobalHeader/rightContentStyle.js +57 -91
  573. package/lib/layout/components/GlobalHeader/style.js +62 -98
  574. package/lib/layout/components/GridContent/index.js +43 -64
  575. package/lib/layout/components/GridContent/style.js +19 -53
  576. package/lib/layout/components/Header/index.js +105 -156
  577. package/lib/layout/components/Header/style/header.js +53 -87
  578. package/lib/layout/components/Header/style/stylish.js +18 -58
  579. package/lib/layout/components/Help/AsyncContentPanel.js +59 -62
  580. package/lib/layout/components/Help/HelpProvide.js +59 -34
  581. package/lib/layout/components/Help/ProHelpContentPanel.js +139 -157
  582. package/lib/layout/components/Help/ProHelpDrawer.js +54 -102
  583. package/lib/layout/components/Help/ProHelpModal.js +53 -102
  584. package/lib/layout/components/Help/ProHelpPanel.js +192 -254
  585. package/lib/layout/components/Help/ProHelpPopover.js +46 -92
  586. package/lib/layout/components/Help/RenderContentPanel.js +97 -130
  587. package/lib/layout/components/Help/Search.js +130 -191
  588. package/lib/layout/components/Help/index.js +113 -74
  589. package/lib/layout/components/Help/style.js +96 -130
  590. package/lib/layout/components/PageContainer/index.js +245 -308
  591. package/lib/layout/components/PageContainer/style/index.js +83 -133
  592. package/lib/layout/components/PageContainer/style/stylish.js +16 -54
  593. package/lib/layout/components/PageHeader/index.js +149 -156
  594. package/lib/layout/components/PageHeader/style/index.js +129 -182
  595. package/lib/layout/components/PageLoading/index.js +28 -76
  596. package/lib/layout/components/SettingDrawer/BlockCheckbox.js +46 -71
  597. package/lib/layout/components/SettingDrawer/LayoutChange.js +114 -129
  598. package/lib/layout/components/SettingDrawer/RegionalChange.js +38 -65
  599. package/lib/layout/components/SettingDrawer/ThemeColor.js +55 -95
  600. package/lib/layout/components/SettingDrawer/icon/group.js +111 -105
  601. package/lib/layout/components/SettingDrawer/icon/sub.js +72 -133
  602. package/lib/layout/components/SettingDrawer/index.js +424 -447
  603. package/lib/layout/components/SettingDrawer/style/index.js +147 -161
  604. package/lib/layout/components/SiderMenu/Arrow.js +16 -34
  605. package/lib/layout/components/SiderMenu/BaseMenu.js +416 -487
  606. package/lib/layout/components/SiderMenu/SiderMenu.js +254 -367
  607. package/lib/layout/components/SiderMenu/index.js +81 -130
  608. package/lib/layout/components/SiderMenu/style/index.js +178 -226
  609. package/lib/layout/components/SiderMenu/style/menu.js +115 -188
  610. package/lib/layout/components/SiderMenu/style/stylish.js +18 -58
  611. package/lib/layout/components/TopNavHeader/index.js +117 -211
  612. package/lib/layout/components/TopNavHeader/style.js +72 -110
  613. package/lib/layout/context/RouteContext.js +6 -24
  614. package/lib/layout/defaultSettings.js +11 -29
  615. package/lib/layout/getPageTitle.js +53 -60
  616. package/lib/layout/index.js +145 -55
  617. package/lib/layout/locales/en-US/settingDrawer.js +47 -65
  618. package/lib/layout/locales/en-US.js +8 -48
  619. package/lib/layout/locales/index.js +24 -52
  620. package/lib/layout/locales/it-IT/settingDrawer.js +38 -56
  621. package/lib/layout/locales/it-IT.js +8 -48
  622. package/lib/layout/locales/ko-KR/settingDrawer.js +43 -61
  623. package/lib/layout/locales/ko-KR.js +8 -48
  624. package/lib/layout/locales/zh-CN/settingDrawer.js +47 -65
  625. package/lib/layout/locales/zh-CN.js +8 -48
  626. package/lib/layout/locales/zh-TW/settingDrawer.js +39 -57
  627. package/lib/layout/locales/zh-TW.js +8 -48
  628. package/lib/layout/style/index.js +48 -88
  629. package/lib/layout/typing.js +4 -16
  630. package/lib/layout/utils/getBreadcrumbProps.js +117 -107
  631. package/lib/layout/utils/getMenuData.js +23 -40
  632. package/lib/layout/utils/pathTools.js +14 -29
  633. package/lib/layout/utils/useCurrentMenuLayoutProps.js +27 -49
  634. package/lib/layout/utils/utils.js +40 -64
  635. package/lib/list/Item.js +229 -321
  636. package/lib/list/ListView.js +197 -260
  637. package/lib/list/constants.js +7 -35
  638. package/lib/list/index.js +132 -207
  639. package/lib/list/style/index.js +230 -302
  640. package/lib/provider/index.js +270 -215
  641. package/lib/provider/intl.js +140 -188
  642. package/lib/provider/locale/ar_EG.js +51 -69
  643. package/lib/provider/locale/ca_ES.js +49 -67
  644. package/lib/provider/locale/cs_CZ.js +54 -72
  645. package/lib/provider/locale/de_DE.js +51 -69
  646. package/lib/provider/locale/en_GB.js +53 -71
  647. package/lib/provider/locale/en_US.js +55 -73
  648. package/lib/provider/locale/es_ES.js +51 -69
  649. package/lib/provider/locale/fa_IR.js +51 -69
  650. package/lib/provider/locale/fr_FR.js +51 -69
  651. package/lib/provider/locale/he_IL.js +54 -72
  652. package/lib/provider/locale/hr_HR.js +51 -69
  653. package/lib/provider/locale/id_ID.js +51 -69
  654. package/lib/provider/locale/it_IT.js +51 -69
  655. package/lib/provider/locale/ja_JP.js +51 -69
  656. package/lib/provider/locale/ko_KR.js +51 -69
  657. package/lib/provider/locale/mn_MN.js +51 -69
  658. package/lib/provider/locale/ms_MY.js +51 -69
  659. package/lib/provider/locale/nl_NL.js +54 -72
  660. package/lib/provider/locale/pl_PL.js +51 -69
  661. package/lib/provider/locale/pt_BR.js +51 -69
  662. package/lib/provider/locale/ro_RO.js +54 -72
  663. package/lib/provider/locale/ru_RU.js +51 -69
  664. package/lib/provider/locale/sk_SK.js +54 -72
  665. package/lib/provider/locale/sr_RS.js +51 -69
  666. package/lib/provider/locale/sv_SE.js +54 -72
  667. package/lib/provider/locale/th_TH.js +54 -72
  668. package/lib/provider/locale/tr_TR.js +51 -69
  669. package/lib/provider/locale/uk_UA.js +54 -72
  670. package/lib/provider/locale/uz_UZ.js +51 -69
  671. package/lib/provider/locale/vi_VN.js +51 -69
  672. package/lib/provider/locale/zh_CN.js +54 -72
  673. package/lib/provider/locale/zh_HK.js +54 -72
  674. package/lib/provider/locale/zh_TW.js +54 -72
  675. package/lib/provider/typing/layoutToken.d.ts +0 -10
  676. package/lib/provider/typing/layoutToken.js +36 -69
  677. package/lib/provider/useStyle/index.d.ts +1 -1
  678. package/lib/provider/useStyle/index.js +98 -94
  679. package/lib/provider/utils/merge.js +18 -44
  680. package/lib/skeleton/components/Descriptions/index.js +246 -282
  681. package/lib/skeleton/components/List/index.js +221 -236
  682. package/lib/skeleton/components/Result/index.js +63 -84
  683. package/lib/skeleton/index.js +73 -79
  684. package/lib/table/Store/Provide.d.ts +0 -1
  685. package/lib/table/Store/Provide.js +147 -151
  686. package/lib/table/Table.js +664 -712
  687. package/lib/table/components/Alert/index.js +66 -67
  688. package/lib/table/components/Alert/style.js +33 -67
  689. package/lib/table/components/ColumnSetting/index.js +391 -404
  690. package/lib/table/components/ColumnSetting/style.js +77 -123
  691. package/lib/table/components/DragSortTable/index.js +110 -165
  692. package/lib/table/components/DragSortTable/style.js +25 -59
  693. package/lib/table/components/Dropdown/index.js +75 -108
  694. package/lib/table/components/EditableTable/CellEditorTable.js +55 -90
  695. package/lib/table/components/EditableTable/RowEditorTable.js +49 -87
  696. package/lib/table/components/EditableTable/index.js +351 -365
  697. package/lib/table/components/Form/FormRender.js +176 -201
  698. package/lib/table/components/Form/index.js +132 -161
  699. package/lib/table/components/ListToolBar/HeaderMenu.js +74 -128
  700. package/lib/table/components/ListToolBar/index.js +263 -302
  701. package/lib/table/components/ListToolBar/style.js +124 -149
  702. package/lib/table/components/ToolBar/DensityIcon.js +43 -71
  703. package/lib/table/components/ToolBar/FullscreenIcon.js +30 -45
  704. package/lib/table/components/ToolBar/index.js +247 -299
  705. package/lib/table/index.js +179 -71
  706. package/lib/table/style/index.js +135 -190
  707. package/lib/table/typing.d.ts +2 -2
  708. package/lib/table/typing.js +4 -16
  709. package/lib/table/useFetchData.js +437 -241
  710. package/lib/table/utils/cellRenderToFromItem.js +192 -277
  711. package/lib/table/utils/columnRender.js +126 -144
  712. package/lib/table/utils/columnSort.js +27 -39
  713. package/lib/table/utils/genProColumnToColumn.js +111 -141
  714. package/lib/table/utils/index.js +204 -128
  715. package/lib/table/utils/useDragSort.js +141 -188
  716. package/lib/utils/components/DropdownFooter/index.js +56 -89
  717. package/lib/utils/components/DropdownFooter/style.js +21 -55
  718. package/lib/utils/components/ErrorBoundary/index.js +55 -53
  719. package/lib/utils/components/FieldLabel/index.js +126 -176
  720. package/lib/utils/components/FieldLabel/style.js +87 -143
  721. package/lib/utils/components/FilterDropdown/index.js +61 -109
  722. package/lib/utils/components/FilterDropdown/style.js +22 -53
  723. package/lib/utils/components/InlineErrorFormItem/index.js +137 -193
  724. package/lib/utils/components/InlineErrorFormItem/style.js +56 -94
  725. package/lib/utils/components/LabelIconTip/index.js +62 -82
  726. package/lib/utils/components/LabelIconTip/style.js +41 -72
  727. package/lib/utils/components/ProFormContext/index.js +7 -34
  728. package/lib/utils/conversionMomentValue/index.js +112 -115
  729. package/lib/utils/dateArrayFormatter/index.js +38 -46
  730. package/lib/utils/genCopyable/index.js +49 -66
  731. package/lib/utils/getFieldPropsOrFormItemProps/index.js +15 -27
  732. package/lib/utils/hooks/useDebounceFn/index.js +63 -65
  733. package/lib/utils/hooks/useDebounceValue/index.js +35 -38
  734. package/lib/utils/hooks/useDeepCompareEffect/index.js +37 -61
  735. package/lib/utils/hooks/useDeepCompareMemo/index.js +17 -39
  736. package/lib/utils/hooks/useDocumentTitle/index.js +10 -28
  737. package/lib/utils/hooks/useFetchData/index.js +74 -89
  738. package/lib/utils/hooks/useForceRender/index.js +16 -26
  739. package/lib/utils/hooks/useLatest/index.js +11 -26
  740. package/lib/utils/hooks/usePrevious/index.js +9 -27
  741. package/lib/utils/hooks/useReactiveRef/index.js +10 -37
  742. package/lib/utils/hooks/useRefCallback/index.js +9 -27
  743. package/lib/utils/hooks/useRefFunction/index.js +16 -29
  744. package/lib/utils/index.d.ts +1 -3
  745. package/lib/utils/index.js +455 -138
  746. package/lib/utils/isBrowser/index.js +18 -27
  747. package/lib/utils/isDeepEqualReact/index.js +83 -70
  748. package/lib/utils/isDropdownValueType/index.js +8 -26
  749. package/lib/utils/isImg/index.js +6 -23
  750. package/lib/utils/isNil/index.js +7 -23
  751. package/lib/utils/isUrl/index.js +14 -28
  752. package/lib/utils/merge/index.js +26 -44
  753. package/lib/utils/nanoid/index.js +28 -36
  754. package/lib/utils/omitBoolean/index.js +12 -25
  755. package/lib/utils/omitUndefined/index.js +10 -28
  756. package/lib/utils/omitUndefinedAndEmptyArr/index.js +11 -29
  757. package/lib/utils/parseValueToMoment/index.js +26 -47
  758. package/lib/utils/pickProFormItemProps/index.js +12 -59
  759. package/lib/utils/pickProProps/index.js +13 -29
  760. package/lib/utils/proFieldParsingText/index.js +146 -77
  761. package/lib/utils/runFunction/index.js +12 -26
  762. package/lib/utils/stringify/index.js +14 -28
  763. package/lib/utils/transformKeySubmitValue/index.js +262 -160
  764. package/lib/utils/typing.js +4 -16
  765. package/lib/utils/useEditableArray/index.js +790 -630
  766. package/lib/utils/useEditableMap/index.js +188 -179
  767. package/lib/utils/useMediaQuery/index.js +53 -73
  768. package/lib/utils/useMediaQuery/query.js +23 -32
  769. package/lib/utils/useMountMergeState/index.d.ts +1 -1
  770. package/lib/utils/useMountMergeState/index.js +10 -33
  771. package/lib/version.js +7 -25
  772. package/package.json +4 -3
  773. package/es/card/components/TabPane/index.d.ts +0 -26
  774. package/es/card/components/TabPane/index.js +0 -84
  775. package/es/utils/compareVersions/coverToNewToken.d.ts +0 -2
  776. package/es/utils/compareVersions/coverToNewToken.js +0 -56
  777. package/es/utils/compareVersions/index.d.ts +0 -8
  778. package/es/utils/compareVersions/index.js +0 -48
  779. package/lib/card/components/TabPane/index.d.ts +0 -26
  780. package/lib/card/components/TabPane/index.js +0 -111
  781. package/lib/utils/compareVersions/coverToNewToken.d.ts +0 -2
  782. package/lib/utils/compareVersions/coverToNewToken.js +0 -73
  783. package/lib/utils/compareVersions/index.d.ts +0 -8
  784. package/lib/utils/compareVersions/index.js +0 -68
@@ -1,104 +1,76 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- var __async = (__this, __arguments, generator) => {
33
- return new Promise((resolve, reject) => {
34
- var fulfilled = (value) => {
35
- try {
36
- step(generator.next(value));
37
- } catch (e) {
38
- reject(e);
39
- }
40
- };
41
- var rejected = (value) => {
42
- try {
43
- step(generator.throw(value));
44
- } catch (e) {
45
- reject(e);
46
- }
47
- };
48
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
- step((generator = generator.apply(__this, __arguments)).next());
50
- });
51
- };
52
-
53
- // src/utils/useEditableArray/index.tsx
54
- import { LoadingOutlined } from "@ant-design/icons";
55
- import { Form, Popconfirm, message } from "antd";
56
- import useLazyKVMap from "antd/lib/table/hooks/useLazyKVMap";
57
- import useMergedState from "rc-util/lib/hooks/useMergedState";
58
- import get from "rc-util/lib/utils/get";
59
- import set from "rc-util/lib/utils/set";
60
- import { noteOnce } from "rc-util/lib/warning";
61
- import React, {
62
- createRef,
63
- forwardRef,
64
- useContext,
65
- useEffect,
66
- useImperativeHandle,
67
- useMemo,
68
- useRef,
69
- useState
70
- } from "react";
71
- import { useDebounceFn, useRefFunction } from "..";
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
+ import _toArray from "@babel/runtime/helpers/esm/toArray";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
8
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
9
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
10
+ var _excluded = ["map_row_parentKey"],
11
+ _excluded2 = ["map_row_parentKey", "map_row_key"],
12
+ _excluded3 = ["map_row_key"];
13
+ /* eslint-disable react-hooks/exhaustive-deps */import { LoadingOutlined } from '@ant-design/icons';
14
+ import { get, warning as rcWarning, set, useMergedState } from '@rc-component/util';
15
+ import { Form, Popconfirm, message } from 'antd';
16
+ import useLazyKVMap from 'antd/lib/table/hooks/useLazyKVMap';
17
+ import React, { createRef, forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
18
+ import { useDebounceFn, useRefFunction } from '..';
72
19
  import { useIntl } from "../../provider";
73
20
  import { ProFormContext } from "../components/ProFormContext";
74
21
  import { useDeepCompareEffectDebounce } from "../hooks/useDeepCompareEffect";
75
22
  import { usePrevious } from "../hooks/usePrevious";
76
23
  import { merge } from "../merge";
77
24
  import { useMountMergeState } from "../useMountMergeState";
78
- var warning = (messageStr) => {
79
- return (message.warn || message.warning)(messageStr);
25
+ import { jsx as _jsx } from "react/jsx-runtime";
26
+ import { jsxs as _jsxs } from "react/jsx-runtime";
27
+ var noteOnce = rcWarning.noteOnce;
28
+
29
+ /**
30
+ * 显示警告信息
31
+ * @param messageStr
32
+ */
33
+ var warning = function warning(messageStr) {
34
+ return message.warning(messageStr);
80
35
  };
81
- var recordKeyToString = (rowKey) => {
82
- if (Array.isArray(rowKey))
83
- return rowKey.join(",");
36
+ export var recordKeyToString = function recordKeyToString(rowKey) {
37
+ if (Array.isArray(rowKey)) return rowKey.join(',');
84
38
  return rowKey;
85
39
  };
86
- function editableRowByKey(keyProps, action) {
87
- var _a;
88
- const { getRowKey, row, data, childrenColumnName = "children" } = keyProps;
89
- const key = (_a = recordKeyToString(keyProps.key)) == null ? void 0 : _a.toString();
90
- const kvMap = /* @__PURE__ */ new Map();
40
+ /**
41
+ * 使用map 来删除数据,性能一般 但是准确率比较高
42
+ *
43
+ * @param keyProps
44
+ * @param action
45
+ */
46
+ export function editableRowByKey(keyProps, action) {
47
+ var _recordKeyToString;
48
+ var getRowKey = keyProps.getRowKey,
49
+ row = keyProps.row,
50
+ data = keyProps.data,
51
+ _keyProps$childrenCol = keyProps.childrenColumnName,
52
+ childrenColumnName = _keyProps$childrenCol === void 0 ? 'children' : _keyProps$childrenCol;
53
+ var key = (_recordKeyToString = recordKeyToString(keyProps.key)) === null || _recordKeyToString === void 0 ? void 0 : _recordKeyToString.toString();
54
+ var kvMap = new Map();
55
+
56
+ /**
57
+ * 打平这个数组
58
+ *
59
+ * @param records
60
+ * @param parentKey
61
+ */
91
62
  function dig(records, map_row_parentKey, map_row_index) {
92
- records.forEach((record, index) => {
93
- const eachIndex = (map_row_index || 0) * 10 + index;
94
- const recordKey = getRowKey(record, eachIndex).toString();
95
- if (record && typeof record === "object" && childrenColumnName in record) {
63
+ records.forEach(function (record, index) {
64
+ var eachIndex = (map_row_index || 0) * 10 + index;
65
+ var recordKey = getRowKey(record, eachIndex).toString();
66
+ // children 取在前面方便拼的时候按照反顺序放回去
67
+ if (record && _typeof(record) === 'object' && childrenColumnName in record) {
96
68
  dig(record[childrenColumnName] || [], recordKey, eachIndex);
97
69
  }
98
- const newRecord = __spreadProps(__spreadValues({}, record), {
70
+ var newRecord = _objectSpread(_objectSpread({}, record), {}, {
99
71
  map_row_key: recordKey,
100
- children: void 0,
101
- map_row_parentKey
72
+ children: undefined,
73
+ map_row_parentKey: map_row_parentKey
102
74
  });
103
75
  delete newRecord.children;
104
76
  if (!map_row_parentKey) {
@@ -107,55 +79,58 @@ function editableRowByKey(keyProps, action) {
107
79
  kvMap.set(recordKey, newRecord);
108
80
  });
109
81
  }
110
- if (action === "top") {
111
- kvMap.set(key, __spreadValues(__spreadValues({}, kvMap.get(key)), row));
82
+ if (action === 'top') {
83
+ kvMap.set(key, _objectSpread(_objectSpread({}, kvMap.get(key)), row));
112
84
  }
113
85
  dig(data);
114
- if (action === "update") {
115
- kvMap.set(key, __spreadValues(__spreadValues({}, kvMap.get(key)), row));
86
+ if (action === 'update') {
87
+ kvMap.set(key, _objectSpread(_objectSpread({}, kvMap.get(key)), row));
116
88
  }
117
- if (action === "delete") {
89
+ if (action === 'delete') {
118
90
  kvMap.delete(key);
119
91
  }
120
- const fill = (map) => {
121
- const kvArrayMap = /* @__PURE__ */ new Map();
122
- const kvSource = [];
123
- const fillNewRecord = (fillChildren = false) => {
124
- map.forEach((value) => {
125
- var _b;
92
+ var fill = function fill(map) {
93
+ var kvArrayMap = new Map();
94
+ var kvSource = [];
95
+ var fillNewRecord = function fillNewRecord() {
96
+ var fillChildren = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
97
+ map.forEach(function (value) {
126
98
  if (value.map_row_parentKey && !value.map_row_key) {
127
- const _a2 = value, { map_row_parentKey } = _a2, rest = __objRest(_a2, ["map_row_parentKey"]);
99
+ var map_row_parentKey = value.map_row_parentKey,
100
+ rest = _objectWithoutProperties(value, _excluded);
128
101
  if (!kvArrayMap.has(map_row_parentKey)) {
129
102
  kvArrayMap.set(map_row_parentKey, []);
130
103
  }
131
104
  if (fillChildren) {
132
- (_b = kvArrayMap.get(map_row_parentKey)) == null ? void 0 : _b.push(rest);
105
+ var _kvArrayMap$get;
106
+ (_kvArrayMap$get = kvArrayMap.get(map_row_parentKey)) === null || _kvArrayMap$get === void 0 || _kvArrayMap$get.push(rest);
133
107
  }
134
108
  }
135
109
  });
136
110
  };
137
- fillNewRecord(action === "top");
138
- map.forEach((value) => {
139
- var _b;
111
+ fillNewRecord(action === 'top');
112
+ map.forEach(function (value) {
140
113
  if (value.map_row_parentKey && value.map_row_key) {
141
- const _a2 = value, { map_row_parentKey, map_row_key } = _a2, rest = __objRest(_a2, ["map_row_parentKey", "map_row_key"]);
114
+ var _kvArrayMap$get2;
115
+ var map_row_parentKey = value.map_row_parentKey,
116
+ map_row_key = value.map_row_key,
117
+ rest = _objectWithoutProperties(value, _excluded2);
142
118
  if (kvArrayMap.has(map_row_key)) {
143
119
  rest[childrenColumnName] = kvArrayMap.get(map_row_key);
144
120
  }
145
121
  if (!kvArrayMap.has(map_row_parentKey)) {
146
122
  kvArrayMap.set(map_row_parentKey, []);
147
123
  }
148
- (_b = kvArrayMap.get(map_row_parentKey)) == null ? void 0 : _b.push(rest);
124
+ (_kvArrayMap$get2 = kvArrayMap.get(map_row_parentKey)) === null || _kvArrayMap$get2 === void 0 || _kvArrayMap$get2.push(rest);
149
125
  }
150
126
  });
151
- fillNewRecord(action === "update");
152
- map.forEach((value) => {
127
+ fillNewRecord(action === 'update');
128
+ map.forEach(function (value) {
153
129
  if (!value.map_row_parentKey) {
154
- const _a2 = value, { map_row_key } = _a2, rest = __objRest(_a2, ["map_row_key"]);
130
+ var map_row_key = value.map_row_key,
131
+ rest = _objectWithoutProperties(value, _excluded3);
155
132
  if (map_row_key && kvArrayMap.has(map_row_key)) {
156
- const item = __spreadProps(__spreadValues({}, rest), {
157
- [childrenColumnName]: kvArrayMap.get(map_row_key)
158
- });
133
+ var item = _objectSpread(_objectSpread({}, rest), {}, _defineProperty({}, childrenColumnName, kvArrayMap.get(map_row_key)));
159
134
  kvSource.push(item);
160
135
  return;
161
136
  }
@@ -166,202 +141,282 @@ function editableRowByKey(keyProps, action) {
166
141
  };
167
142
  return fill(kvMap);
168
143
  }
169
- function SaveEditableAction({
170
- recordKey,
171
- onSave,
172
- row,
173
- children,
174
- newLineConfig,
175
- editorType,
176
- tableName
177
- }, ref) {
178
- const context = useContext(ProFormContext);
179
- const form = Form.useFormInstance();
180
- const [loading, setLoading] = useMountMergeState(false);
181
- const save = useRefFunction(() => __async(this, null, function* () {
182
- var _a;
183
- try {
184
- const isMapEditor = editorType === "Map";
185
- const namePath = [
186
- tableName,
187
- Array.isArray(recordKey) ? recordKey[0] : recordKey
188
- ].map((key) => key == null ? void 0 : key.toString()).flat(1).filter(Boolean);
189
- setLoading(true);
190
- yield form.validateFields(namePath, {
191
- recursive: true
192
- });
193
- const fields = ((_a = context == null ? void 0 : context.getFieldFormatValue) == null ? void 0 : _a.call(context, namePath)) || form.getFieldValue(namePath);
194
- if (Array.isArray(recordKey) && recordKey.length > 1) {
195
- const [, ...recordKeyPath] = recordKey;
196
- const curValue = get(fields, recordKeyPath);
197
- set(fields, recordKeyPath, curValue);
144
+
145
+ /**
146
+ * 保存按钮的dom
147
+ *
148
+ * @param ActionRenderConfig
149
+ */
150
+ export function SaveEditableAction(_ref, ref) {
151
+ var recordKey = _ref.recordKey,
152
+ onSave = _ref.onSave,
153
+ row = _ref.row,
154
+ children = _ref.children,
155
+ newLineConfig = _ref.newLineConfig,
156
+ editorType = _ref.editorType,
157
+ tableName = _ref.tableName;
158
+ var context = useContext(ProFormContext);
159
+ var form = Form.useFormInstance();
160
+ var _useMountMergeState = useMountMergeState(false),
161
+ _useMountMergeState2 = _slicedToArray(_useMountMergeState, 2),
162
+ loading = _useMountMergeState2[0],
163
+ setLoading = _useMountMergeState2[1];
164
+ var save = useRefFunction( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
165
+ var _context$getFieldForm, isMapEditor, namePath, fields, _recordKey, recordKeyPath, curValue, data, res;
166
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
167
+ while (1) switch (_context.prev = _context.next) {
168
+ case 0:
169
+ _context.prev = 0;
170
+ isMapEditor = editorType === 'Map'; // 为了兼容类型为 array 的 dataIndex,当 recordKey 是一个数组时,用于获取表单值的 key 只取第一项,
171
+ // 从表单中获取回来之后,再根据 namepath 获取具体的某个字段并设置
172
+ namePath = [tableName, Array.isArray(recordKey) ? recordKey[0] : recordKey].map(function (key) {
173
+ return key === null || key === void 0 ? void 0 : key.toString();
174
+ }).flat(1).filter(Boolean);
175
+ setLoading(true);
176
+ _context.next = 6;
177
+ return form.validateFields(namePath, {
178
+ recursive: true
179
+ });
180
+ case 6:
181
+ fields = (context === null || context === void 0 || (_context$getFieldForm = context.getFieldFormatValue) === null || _context$getFieldForm === void 0 ? void 0 : _context$getFieldForm.call(context, namePath)) || form.getFieldValue(namePath); // 处理 dataIndex 为数组的情况
182
+ if (Array.isArray(recordKey) && recordKey.length > 1) {
183
+ // 获取 namepath
184
+ _recordKey = _toArray(recordKey), recordKeyPath = _recordKey.slice(1); // 将目标值获取出来并设置到 fields 当中
185
+ curValue = get(fields, recordKeyPath);
186
+ set(fields, recordKeyPath, curValue);
187
+ }
188
+ data = isMapEditor ? set({}, namePath, fields) : fields; // 获取数据并保存
189
+ _context.next = 11;
190
+ return onSave === null || onSave === void 0 ? void 0 : onSave(recordKey,
191
+ // 如果是 map 模式,fields 就是一个值,所以需要set 到对象中
192
+ // 数据模式 fields 是一个对象,所以不需要
193
+ merge({}, row, data), row, newLineConfig);
194
+ case 11:
195
+ res = _context.sent;
196
+ setLoading(false);
197
+ return _context.abrupt("return", res);
198
+ case 16:
199
+ _context.prev = 16;
200
+ _context.t0 = _context["catch"](0);
201
+ setLoading(false);
202
+ throw _context.t0;
203
+ case 20:
204
+ case "end":
205
+ return _context.stop();
198
206
  }
199
- const data = isMapEditor ? set({}, namePath, fields) : fields;
200
- const res = yield onSave == null ? void 0 : onSave(
201
- recordKey,
202
- // 如果是 map 模式,fields 就是一个值,所以需要set 到对象中
203
- // 数据模式 fields 是一个对象,所以不需要
204
- merge({}, row, data),
205
- row,
206
- newLineConfig
207
- );
208
- setLoading(false);
209
- return res;
210
- } catch (error) {
211
- setLoading(false);
212
- throw error;
213
- }
214
- }));
215
- useImperativeHandle(
216
- ref,
217
- () => ({
218
- save
219
- }),
220
- [save]
221
- );
222
- return /* @__PURE__ */ React.createElement(
223
- "a",
224
- {
225
- key: "save",
226
- onClick: (e) => __async(this, null, function* () {
227
- e.stopPropagation();
228
- e.preventDefault();
229
- try {
230
- yield save();
231
- } catch (e2) {
232
- }
233
- })
234
- },
235
- loading ? /* @__PURE__ */ React.createElement(
236
- LoadingOutlined,
237
- {
238
- style: {
239
- marginInlineEnd: 8
240
- }
207
+ }, _callee, null, [[0, 16]]);
208
+ })));
209
+
210
+ // 保存数据
211
+ useImperativeHandle(ref, function () {
212
+ return {
213
+ save: save
214
+ };
215
+ }, [save]);
216
+ return /*#__PURE__*/_jsxs("a", {
217
+ onClick: ( /*#__PURE__*/function () {
218
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
219
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
220
+ while (1) switch (_context2.prev = _context2.next) {
221
+ case 0:
222
+ e.stopPropagation();
223
+ e.preventDefault();
224
+ _context2.prev = 2;
225
+ _context2.next = 5;
226
+ return save();
227
+ case 5:
228
+ _context2.next = 9;
229
+ break;
230
+ case 7:
231
+ _context2.prev = 7;
232
+ _context2.t0 = _context2["catch"](2);
233
+ case 9:
234
+ case "end":
235
+ return _context2.stop();
236
+ }
237
+ }, _callee2, null, [[2, 7]]);
238
+ }));
239
+ return function (_x) {
240
+ return _ref3.apply(this, arguments);
241
+ };
242
+ }()),
243
+ children: [loading ? /*#__PURE__*/_jsx(LoadingOutlined, {
244
+ style: {
245
+ marginInlineEnd: 8
241
246
  }
242
- ) : null,
243
- children || "保存"
244
- );
247
+ }) : null, children || '保存']
248
+ }, "save");
245
249
  }
246
- var DeleteEditableAction = ({
247
- recordKey,
248
- onDelete,
249
- preEditRowRef,
250
- row,
251
- children,
252
- deletePopconfirmMessage
253
- }) => {
254
- const [loading, setLoading] = useMountMergeState(() => false);
255
- const onConfirm = useRefFunction(() => __async(void 0, null, function* () {
256
- try {
257
- setLoading(true);
258
- const res = yield onDelete == null ? void 0 : onDelete(recordKey, row);
259
- setLoading(false);
260
- return res;
261
- } catch (e) {
262
- setLoading(false);
263
- return null;
264
- } finally {
265
- if (preEditRowRef)
266
- preEditRowRef.current = null;
267
- }
268
- }));
269
- return children !== false ? /* @__PURE__ */ React.createElement(
270
- Popconfirm,
271
- {
272
- key: "delete",
273
- title: deletePopconfirmMessage,
274
- onConfirm: () => onConfirm()
250
+ /**
251
+ * 删除按钮 dom
252
+ *
253
+ * @param ActionRenderConfig
254
+ */
255
+ export var DeleteEditableAction = function DeleteEditableAction(_ref4) {
256
+ var recordKey = _ref4.recordKey,
257
+ onDelete = _ref4.onDelete,
258
+ preEditRowRef = _ref4.preEditRowRef,
259
+ row = _ref4.row,
260
+ children = _ref4.children,
261
+ deletePopconfirmMessage = _ref4.deletePopconfirmMessage;
262
+ var _useMountMergeState3 = useMountMergeState(function () {
263
+ return false;
264
+ }),
265
+ _useMountMergeState4 = _slicedToArray(_useMountMergeState3, 2),
266
+ loading = _useMountMergeState4[0],
267
+ setLoading = _useMountMergeState4[1];
268
+ var _onConfirm = useRefFunction( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
269
+ var res;
270
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
271
+ while (1) switch (_context3.prev = _context3.next) {
272
+ case 0:
273
+ _context3.prev = 0;
274
+ setLoading(true);
275
+ _context3.next = 4;
276
+ return onDelete === null || onDelete === void 0 ? void 0 : onDelete(recordKey, row);
277
+ case 4:
278
+ res = _context3.sent;
279
+ setLoading(false);
280
+ return _context3.abrupt("return", res);
281
+ case 9:
282
+ _context3.prev = 9;
283
+ _context3.t0 = _context3["catch"](0);
284
+ setLoading(false);
285
+ return _context3.abrupt("return", null);
286
+ case 13:
287
+ _context3.prev = 13;
288
+ if (preEditRowRef) preEditRowRef.current = null;
289
+ return _context3.finish(13);
290
+ case 16:
291
+ case "end":
292
+ return _context3.stop();
293
+ }
294
+ }, _callee3, null, [[0, 9, 13, 16]]);
295
+ })));
296
+ return children !== false ? /*#__PURE__*/_jsx(Popconfirm, {
297
+ title: deletePopconfirmMessage,
298
+ onConfirm: function onConfirm() {
299
+ return _onConfirm();
275
300
  },
276
- /* @__PURE__ */ React.createElement("a", null, loading ? /* @__PURE__ */ React.createElement(
277
- LoadingOutlined,
278
- {
301
+ children: /*#__PURE__*/_jsxs("a", {
302
+ children: [loading ? /*#__PURE__*/_jsx(LoadingOutlined, {
279
303
  style: {
280
304
  marginInlineEnd: 8
281
305
  }
282
- }
283
- ) : null, children || "删除")
284
- ) : null;
306
+ }) : null, children || '删除']
307
+ })
308
+ }, "delete") : null;
285
309
  };
286
- var CancelEditableAction = (props) => {
287
- const {
288
- recordKey,
289
- tableName,
290
- newLineConfig,
291
- editorType,
292
- onCancel,
293
- cancelEditable,
294
- row,
295
- cancelText,
296
- preEditRowRef
297
- } = props;
298
- const context = useContext(ProFormContext);
299
- const form = Form.useFormInstance();
300
- return /* @__PURE__ */ React.createElement(
301
- "a",
302
- {
303
- key: "cancel",
304
- onClick: (e) => __async(void 0, null, function* () {
305
- var _a, _b;
306
- e.stopPropagation();
307
- e.preventDefault();
308
- const isMapEditor = editorType === "Map";
309
- const namePath = [tableName, recordKey].flat(1).filter(Boolean);
310
- const fields = ((_a = context == null ? void 0 : context.getFieldFormatValue) == null ? void 0 : _a.call(context, namePath)) || (form == null ? void 0 : form.getFieldValue(namePath));
311
- const record = isMapEditor ? set({}, namePath, fields) : fields;
312
- const res = yield onCancel == null ? void 0 : onCancel(recordKey, record, row, newLineConfig);
313
- yield cancelEditable(recordKey);
314
- if ((preEditRowRef == null ? void 0 : preEditRowRef.current) !== null) {
315
- form.setFieldsValue(set({}, namePath, preEditRowRef == null ? void 0 : preEditRowRef.current));
316
- } else {
317
- yield (_b = props.onDelete) == null ? void 0 : _b.call(props, recordKey, row);
318
- }
319
- if (preEditRowRef)
320
- preEditRowRef.current = null;
321
- return res;
322
- })
323
- },
324
- cancelText || "取消"
325
- );
310
+ var CancelEditableAction = function CancelEditableAction(props) {
311
+ var recordKey = props.recordKey,
312
+ tableName = props.tableName,
313
+ newLineConfig = props.newLineConfig,
314
+ editorType = props.editorType,
315
+ onCancel = props.onCancel,
316
+ cancelEditable = props.cancelEditable,
317
+ row = props.row,
318
+ cancelText = props.cancelText,
319
+ preEditRowRef = props.preEditRowRef;
320
+ var context = useContext(ProFormContext);
321
+ var form = Form.useFormInstance();
322
+ return /*#__PURE__*/_jsx("a", {
323
+ onClick: ( /*#__PURE__*/function () {
324
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(e) {
325
+ var _context$getFieldForm2;
326
+ var isMapEditor, namePath, fields, record, res, _props$onDelete;
327
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
328
+ while (1) switch (_context4.prev = _context4.next) {
329
+ case 0:
330
+ e.stopPropagation();
331
+ e.preventDefault();
332
+ isMapEditor = editorType === 'Map';
333
+ namePath = [tableName, recordKey].flat(1).filter(Boolean);
334
+ fields = (context === null || context === void 0 || (_context$getFieldForm2 = context.getFieldFormatValue) === null || _context$getFieldForm2 === void 0 ? void 0 : _context$getFieldForm2.call(context, namePath)) || (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath));
335
+ record = isMapEditor ? set({}, namePath, fields) : fields;
336
+ _context4.next = 8;
337
+ return onCancel === null || onCancel === void 0 ? void 0 : onCancel(recordKey, record, row, newLineConfig);
338
+ case 8:
339
+ res = _context4.sent;
340
+ _context4.next = 11;
341
+ return cancelEditable(recordKey);
342
+ case 11:
343
+ if (!((preEditRowRef === null || preEditRowRef === void 0 ? void 0 : preEditRowRef.current) !== null)) {
344
+ _context4.next = 15;
345
+ break;
346
+ }
347
+ form.setFieldsValue(set({}, namePath, preEditRowRef === null || preEditRowRef === void 0 ? void 0 : preEditRowRef.current));
348
+ _context4.next = 17;
349
+ break;
350
+ case 15:
351
+ _context4.next = 17;
352
+ return (_props$onDelete = props.onDelete) === null || _props$onDelete === void 0 ? void 0 : _props$onDelete.call(props, recordKey, row);
353
+ case 17:
354
+ if (preEditRowRef) preEditRowRef.current = null;
355
+ return _context4.abrupt("return", res);
356
+ case 19:
357
+ case "end":
358
+ return _context4.stop();
359
+ }
360
+ }, _callee4);
361
+ }));
362
+ return function (_x2) {
363
+ return _ref6.apply(this, arguments);
364
+ };
365
+ }()),
366
+ children: cancelText || '取消'
367
+ }, "cancel");
326
368
  };
327
- function defaultActionRender(row, config) {
328
- const { recordKey, newLineConfig, saveText, deleteText } = config;
329
- const SaveEditableActionRef = forwardRef(
330
- SaveEditableAction
331
- );
332
- const saveRef = createRef();
369
+ export function defaultActionRender(row, config) {
370
+ var recordKey = config.recordKey,
371
+ newLineConfig = config.newLineConfig,
372
+ saveText = config.saveText,
373
+ deleteText = config.deleteText;
374
+ var SaveEditableActionRef = /*#__PURE__*/forwardRef(SaveEditableAction);
375
+ var saveRef = /*#__PURE__*/createRef();
333
376
  return {
334
- save: /* @__PURE__ */ React.createElement(
335
- SaveEditableActionRef,
336
- __spreadProps(__spreadValues({
337
- key: "save" + recordKey
338
- }, config), {
339
- row,
340
- ref: saveRef
341
- }),
342
- saveText
343
- ),
344
- saveRef,
345
- delete: (newLineConfig == null ? void 0 : newLineConfig.options.recordKey) !== recordKey ? /* @__PURE__ */ React.createElement(DeleteEditableAction, __spreadProps(__spreadValues({ key: "delete" + recordKey }, config), { row }), deleteText) : void 0,
346
- cancel: /* @__PURE__ */ React.createElement(CancelEditableAction, __spreadProps(__spreadValues({ key: "cancel" + recordKey }, config), { row }))
377
+ save: /*#__PURE__*/_jsx(SaveEditableActionRef, _objectSpread(_objectSpread({}, config), {}, {
378
+ row: row,
379
+ ref: saveRef,
380
+ children: saveText
381
+ }), 'save' + recordKey),
382
+ saveRef: saveRef,
383
+ delete: (newLineConfig === null || newLineConfig === void 0 ? void 0 : newLineConfig.options.recordKey) !== recordKey ? /*#__PURE__*/_jsx(DeleteEditableAction, _objectSpread(_objectSpread({}, config), {}, {
384
+ row: row,
385
+ children: deleteText
386
+ }), 'delete' + recordKey) : undefined,
387
+ cancel: /*#__PURE__*/_jsx(CancelEditableAction, _objectSpread(_objectSpread({}, config), {}, {
388
+ row: row
389
+ }), 'cancel' + recordKey)
347
390
  };
348
391
  }
349
- function useEditableArray(props) {
350
- const intl = useIntl();
351
- const preEditRowRef = useRef(null);
352
- const [newLineRecordCache, setNewLineRecordCache] = useState(void 0);
353
- const resetMapRef = () => {
354
- const map = /* @__PURE__ */ new Map();
355
- const loopGetKey = (dataSource, parentKey) => {
356
- dataSource == null ? void 0 : dataSource.forEach((record, index) => {
357
- var _a;
358
- const key = parentKey === void 0 || parentKey === null ? index.toString() : parentKey + "_" + index.toString();
392
+
393
+ /**
394
+ * 一个方便的hooks 用于维护编辑的状态
395
+ *
396
+ * @param props
397
+ */
398
+ export function useEditableArray(props) {
399
+ // Internationalization
400
+ var intl = useIntl();
401
+
402
+ /**
403
+ * 点击开始编辑之前的保存数据用的
404
+ */
405
+ var preEditRowRef = useRef(null);
406
+ var _useState = useState(undefined),
407
+ _useState2 = _slicedToArray(_useState, 2),
408
+ newLineRecordCache = _useState2[0],
409
+ setNewLineRecordCache = _useState2[1];
410
+ var resetMapRef = function resetMapRef() {
411
+ var map = new Map();
412
+ //存在children时会覆盖Map的key,导致使用数组索引查找key错误
413
+ var loopGetKey = function loopGetKey(dataSource, parentKey) {
414
+ dataSource === null || dataSource === void 0 || dataSource.forEach(function (record, index) {
415
+ var _recordKeyToString2;
416
+ var key = parentKey === undefined || parentKey === null ? index.toString() : parentKey + '_' + index.toString();
359
417
  map.set(key, recordKeyToString(props.getRowKey(record, -1)));
360
- map.set(
361
- (_a = recordKeyToString(props.getRowKey(record, -1))) == null ? void 0 : _a.toString(),
362
- key
363
- );
364
- if (props.childrenColumnName && (record == null ? void 0 : record[props.childrenColumnName])) {
418
+ map.set((_recordKeyToString2 = recordKeyToString(props.getRowKey(record, -1))) === null || _recordKeyToString2 === void 0 ? void 0 : _recordKeyToString2.toString(), key);
419
+ if (props.childrenColumnName && record !== null && record !== void 0 && record[props.childrenColumnName]) {
365
420
  loopGetKey(record[props.childrenColumnName], key);
366
421
  }
367
422
  });
@@ -369,358 +424,468 @@ function useEditableArray(props) {
369
424
  loopGetKey(props.dataSource);
370
425
  return map;
371
426
  };
372
- const initDataSourceKeyIndexMap = useMemo(() => resetMapRef(), []);
373
- const dataSourceKeyIndexMapRef = useRef(
374
- initDataSourceKeyIndexMap
375
- );
376
- const newLineRecordRef = useRef(
377
- void 0
378
- );
379
- useDeepCompareEffectDebounce(() => {
427
+ var initDataSourceKeyIndexMap = useMemo(function () {
428
+ return resetMapRef();
429
+ }, []);
430
+ var dataSourceKeyIndexMapRef = useRef(initDataSourceKeyIndexMap);
431
+ var newLineRecordRef = useRef(undefined);
432
+ useDeepCompareEffectDebounce(function () {
380
433
  dataSourceKeyIndexMapRef.current = resetMapRef();
381
434
  }, [props.dataSource]);
435
+
436
+ // 这里这么做是为了存上次的状态,不然每次存一下再拿
382
437
  newLineRecordRef.current = newLineRecordCache;
383
- const editableType = props.type || "single";
384
- const [getRecordByKey] = useLazyKVMap(
385
- props.dataSource,
386
- "children",
387
- props.getRowKey
388
- );
389
- const [editableKeys, setEditableRowKeys] = useMergedState([], {
390
- value: props.editableKeys,
391
- onChange: props.onChange ? (keys) => {
392
- var _a, _b, _c;
393
- (_c = props == null ? void 0 : props.onChange) == null ? void 0 : _c.call(
394
- props,
395
- // 计算编辑的key
396
- (_a = keys == null ? void 0 : keys.filter((key) => key !== void 0)) != null ? _a : [],
397
- // 计算编辑的行
398
- (_b = keys == null ? void 0 : keys.map((key) => getRecordByKey(key)).filter((key) => key !== void 0)) != null ? _b : []
399
- );
400
- } : void 0
401
- });
402
- const editableKeysSet = useMemo(() => {
403
- const keys = editableType === "single" ? editableKeys == null ? void 0 : editableKeys.slice(0, 1) : editableKeys;
438
+ var editableType = props.type || 'single';
439
+ var _useLazyKVMap = useLazyKVMap(props.dataSource, 'children', props.getRowKey),
440
+ _useLazyKVMap2 = _slicedToArray(_useLazyKVMap, 1),
441
+ getRecordByKey = _useLazyKVMap2[0];
442
+ var _useMergedState = useMergedState([], {
443
+ value: props.editableKeys,
444
+ onChange: props.onChange ? function (keys) {
445
+ var _props$onChange, _keys$filter, _keys$map$filter;
446
+ props === null || props === void 0 || (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, // 计算编辑的key
447
+ (_keys$filter = keys === null || keys === void 0 ? void 0 : keys.filter(function (key) {
448
+ return key !== undefined;
449
+ })) !== null && _keys$filter !== void 0 ? _keys$filter : [], // 计算编辑的行
450
+ (_keys$map$filter = keys === null || keys === void 0 ? void 0 : keys.map(function (key) {
451
+ return getRecordByKey(key);
452
+ }).filter(function (key) {
453
+ return key !== undefined;
454
+ })) !== null && _keys$map$filter !== void 0 ? _keys$map$filter : []);
455
+ } : undefined
456
+ }),
457
+ _useMergedState2 = _slicedToArray(_useMergedState, 2),
458
+ editableKeys = _useMergedState2[0],
459
+ setEditableRowKeys = _useMergedState2[1];
460
+
461
+ /** 一个用来标志的set 提供了方便的 api 来去重什么的 */
462
+ var editableKeysSet = useMemo(function () {
463
+ var keys = editableType === 'single' ? editableKeys === null || editableKeys === void 0 ? void 0 : editableKeys.slice(0, 1) : editableKeys;
404
464
  return new Set(keys);
405
- }, [(editableKeys || []).join(","), editableType]);
406
- const editableKeysRef = usePrevious(editableKeys);
407
- const isEditable = useRefFunction((row) => {
408
- var _a, _b, _c, _d;
409
- const recordKeyOrIndex = (_b = (_a = props.getRowKey(row, row.index)) == null ? void 0 : _a.toString) == null ? void 0 : _b.call(_a);
410
- const recordKey = (_d = (_c = props.getRowKey(row, -1)) == null ? void 0 : _c.toString) == null ? void 0 : _d.call(_c);
411
- const stringEditableKeys = editableKeys == null ? void 0 : editableKeys.map((key) => key == null ? void 0 : key.toString());
412
- const stringEditableKeysRef = (editableKeysRef == null ? void 0 : editableKeysRef.map((key) => key == null ? void 0 : key.toString())) || [];
413
- const preIsEditable = props.tableName && !!(stringEditableKeysRef == null ? void 0 : stringEditableKeysRef.includes(recordKey)) || !!(stringEditableKeysRef == null ? void 0 : stringEditableKeysRef.includes(recordKeyOrIndex));
465
+ }, [(editableKeys || []).join(','), editableType]);
466
+ var editableKeysRef = usePrevious(editableKeys);
467
+
468
+ /** 这行是不是编辑状态 */
469
+ var isEditable = useRefFunction(function (row) {
470
+ var _props$getRowKey, _props$getRowKey$toSt, _props$getRowKey2, _props$getRowKey2$toS;
471
+ // 为了兼容一下name 模式的 indexKey,所以需要判断两次,一次是index,一次是没有 index
472
+ var recordKeyOrIndex = (_props$getRowKey = props.getRowKey(row, row.index)) === null || _props$getRowKey === void 0 || (_props$getRowKey$toSt = _props$getRowKey.toString) === null || _props$getRowKey$toSt === void 0 ? void 0 : _props$getRowKey$toSt.call(_props$getRowKey);
473
+ // 这里是不设置 index 的地方
474
+ var recordKey = (_props$getRowKey2 = props.getRowKey(row, -1)) === null || _props$getRowKey2 === void 0 || (_props$getRowKey2$toS = _props$getRowKey2.toString) === null || _props$getRowKey2$toS === void 0 ? void 0 : _props$getRowKey2$toS.call(_props$getRowKey2);
475
+
476
+ // 都转化为了字符串,不然 number 和 string
477
+ var stringEditableKeys = editableKeys === null || editableKeys === void 0 ? void 0 : editableKeys.map(function (key) {
478
+ return key === null || key === void 0 ? void 0 : key.toString();
479
+ });
480
+ var stringEditableKeysRef = (editableKeysRef === null || editableKeysRef === void 0 ? void 0 : editableKeysRef.map(function (key) {
481
+ return key === null || key === void 0 ? void 0 : key.toString();
482
+ })) || [];
483
+ var preIsEditable = props.tableName && !!(stringEditableKeysRef !== null && stringEditableKeysRef !== void 0 && stringEditableKeysRef.includes(recordKey)) || !!(stringEditableKeysRef !== null && stringEditableKeysRef !== void 0 && stringEditableKeysRef.includes(recordKeyOrIndex));
414
484
  return {
415
- recordKey,
416
- isEditable: props.tableName && (stringEditableKeys == null ? void 0 : stringEditableKeys.includes(recordKey)) || (stringEditableKeys == null ? void 0 : stringEditableKeys.includes(recordKeyOrIndex)),
417
- preIsEditable
485
+ recordKey: recordKey,
486
+ isEditable: props.tableName && (stringEditableKeys === null || stringEditableKeys === void 0 ? void 0 : stringEditableKeys.includes(recordKey)) || (stringEditableKeys === null || stringEditableKeys === void 0 ? void 0 : stringEditableKeys.includes(recordKeyOrIndex)),
487
+ preIsEditable: preIsEditable
418
488
  };
419
489
  });
420
- const startEditable = useRefFunction(
421
- (recordKey, record) => {
422
- var _a, _b;
423
- if (editableKeysSet.size > 0 && editableType === "single" && props.onlyOneLineEditorAlertMessage !== false) {
424
- warning(
425
- props.onlyOneLineEditorAlertMessage || intl.getMessage(
426
- "editableTable.onlyOneLineEditor",
427
- "只能同时编辑一行"
428
- )
429
- );
430
- return false;
431
- }
432
- editableKeysSet.add(recordKey);
433
- setEditableRowKeys(Array.from(editableKeysSet));
434
- preEditRowRef.current = (_b = record != null ? record : (_a = props.dataSource) == null ? void 0 : _a.find((recordData, index) => {
435
- return props.getRowKey(recordData, index) === recordKey;
436
- })) != null ? _b : null;
437
- return true;
490
+
491
+ /**
492
+ * 进入编辑状态
493
+ *
494
+ * @param recordKey
495
+ */
496
+ var startEditable = useRefFunction(function (recordKey, record) {
497
+ var _ref7, _props$dataSource;
498
+ // 如果是单行的话,不允许多行编辑
499
+ if (editableKeysSet.size > 0 && editableType === 'single' && props.onlyOneLineEditorAlertMessage !== false) {
500
+ warning(props.onlyOneLineEditorAlertMessage || intl.getMessage('editableTable.onlyOneLineEditor', '只能同时编辑一行'));
501
+ return false;
438
502
  }
439
- );
440
- const cancelEditable = useRefFunction(
441
- (recordKey, needReTry) => __async(this, null, function* () {
442
- const relayKey = recordKeyToString(recordKey).toString();
443
- const key = dataSourceKeyIndexMapRef.current.get(relayKey);
444
- if (!editableKeysSet.has(relayKey) && key && (needReTry != null ? needReTry : true) && props.tableName) {
445
- cancelEditable(key, false);
446
- return;
447
- }
448
- if (newLineRecordCache && newLineRecordCache.options.recordKey === recordKey) {
449
- setNewLineRecordCache(void 0);
450
- }
451
- editableKeysSet.delete(relayKey);
452
- editableKeysSet.delete(recordKeyToString(recordKey));
453
- setEditableRowKeys(Array.from(editableKeysSet));
454
- return true;
455
- })
456
- );
457
- const propsOnValuesChange = useDebounceFn((...rest) => __async(this, null, function* () {
458
- var _a;
459
- (_a = props.onValuesChange) == null ? void 0 : _a.call(props, ...rest);
460
- }), 64);
461
- const onValuesChange = useRefFunction(
462
- (value, values) => {
463
- var _a;
464
- if (!props.onValuesChange) {
465
- return;
503
+ editableKeysSet.add(recordKey);
504
+ setEditableRowKeys(Array.from(editableKeysSet));
505
+
506
+ // 这里是为了存上次的状态,不然取消的时候就丢掉了
507
+ preEditRowRef.current = (_ref7 = record !== null && record !== void 0 ? record : (_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.find(function (recordData, index) {
508
+ return props.getRowKey(recordData, index) === recordKey;
509
+ })) !== null && _ref7 !== void 0 ? _ref7 : null;
510
+ return true;
511
+ });
512
+
513
+ /**
514
+ * 退出编辑状态
515
+ *
516
+ * @param recordKey
517
+ */
518
+ var cancelEditable = useRefFunction( /*#__PURE__*/function () {
519
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(recordKey, needReTry) {
520
+ var relayKey, key;
521
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
522
+ while (1) switch (_context5.prev = _context5.next) {
523
+ case 0:
524
+ relayKey = recordKeyToString(recordKey).toString();
525
+ key = dataSourceKeyIndexMapRef.current.get(relayKey);
526
+ /** 如果没找到key,转化一下再去找 */
527
+ if (!(!editableKeysSet.has(relayKey) && key && (needReTry !== null && needReTry !== void 0 ? needReTry : true) && props.tableName)) {
528
+ _context5.next = 5;
529
+ break;
530
+ }
531
+ cancelEditable(key, false);
532
+ return _context5.abrupt("return");
533
+ case 5:
534
+ /** 如果这个是 new Line 直接删除 */
535
+ if (newLineRecordCache && newLineRecordCache.options.recordKey === recordKey) {
536
+ setNewLineRecordCache(undefined);
537
+ }
538
+ editableKeysSet.delete(relayKey);
539
+ editableKeysSet.delete(recordKeyToString(recordKey));
540
+ setEditableRowKeys(Array.from(editableKeysSet));
541
+ return _context5.abrupt("return", true);
542
+ case 10:
543
+ case "end":
544
+ return _context5.stop();
545
+ }
546
+ }, _callee5);
547
+ }));
548
+ return function (_x3, _x4) {
549
+ return _ref8.apply(this, arguments);
550
+ };
551
+ }());
552
+ var propsOnValuesChange = useDebounceFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
553
+ var _props$onValuesChange;
554
+ var _len,
555
+ rest,
556
+ _key,
557
+ _args6 = arguments;
558
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
559
+ while (1) switch (_context6.prev = _context6.next) {
560
+ case 0:
561
+ for (_len = _args6.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {
562
+ rest[_key] = _args6[_key];
563
+ }
564
+ //@ts-ignore
565
+ (_props$onValuesChange = props.onValuesChange) === null || _props$onValuesChange === void 0 || _props$onValuesChange.call.apply(_props$onValuesChange, [props].concat(rest));
566
+ case 2:
567
+ case "end":
568
+ return _context6.stop();
466
569
  }
467
- let { dataSource } = props;
468
- editableKeys == null ? void 0 : editableKeys.forEach((eachRecordKey) => {
469
- if ((newLineRecordCache == null ? void 0 : newLineRecordCache.options.recordKey) === eachRecordKey)
470
- return;
471
- const recordKey2 = eachRecordKey.toString();
472
- const editRow2 = get(
473
- values,
474
- [props.tableName || "", recordKey2].flat(1).filter((key) => key || key === 0)
475
- );
476
- if (!editRow2)
477
- return;
478
- dataSource = editableRowByKey(
479
- {
480
- data: dataSource,
481
- getRowKey: props.getRowKey,
482
- row: editRow2,
483
- key: recordKey2,
484
- childrenColumnName: props.childrenColumnName || "children"
485
- },
486
- "update"
487
- );
488
- });
489
- const relayValue = value;
490
- const recordKey = (_a = Object.keys(relayValue || {}).pop()) == null ? void 0 : _a.toString();
491
- const newLineRecordData = __spreadValues(__spreadValues({}, newLineRecordCache == null ? void 0 : newLineRecordCache.defaultValue), get(
492
- values,
493
- [props.tableName || "", recordKey.toString()].flat(1).filter((key) => key || key === 0)
494
- ));
495
- const editRow = dataSourceKeyIndexMapRef.current.has(
496
- recordKeyToString(recordKey)
497
- ) ? dataSource.find((item, index) => {
498
- var _a2;
499
- const key = (_a2 = props.getRowKey(item, index)) == null ? void 0 : _a2.toString();
500
- return key === recordKey;
501
- }) : newLineRecordData;
502
- propsOnValuesChange.run(editRow || newLineRecordData, dataSource);
570
+ }, _callee6);
571
+ })), 64);
572
+ var onValuesChange = useRefFunction(function (value, values) {
573
+ var _Object$keys$pop;
574
+ if (!props.onValuesChange) {
575
+ return;
503
576
  }
504
- );
505
- const saveRefsMap = useRef(/* @__PURE__ */ new Map());
506
- useEffect(() => {
507
- saveRefsMap.current.forEach((ref, key) => {
577
+ var dataSource = props.dataSource;
578
+
579
+ // 这里是把正在编辑中的所有表单数据都修改掉
580
+ // 不然会用 props 里面的 dataSource,数据只有正在编辑中的
581
+ // Object.keys(get(values, [props.tableName || ''].flat(1)) || values).forEach((recordKey) => {
582
+ editableKeys === null || editableKeys === void 0 || editableKeys.forEach(function (eachRecordKey) {
583
+ if ((newLineRecordCache === null || newLineRecordCache === void 0 ? void 0 : newLineRecordCache.options.recordKey) === eachRecordKey) return;
584
+ var recordKey = eachRecordKey.toString();
585
+ // 如果数据在这个 form 中没有展示,也不显示
586
+ var editRow = get(values, [props.tableName || '', recordKey].flat(1).filter(function (key) {
587
+ return key || key === 0;
588
+ }));
589
+ if (!editRow) return;
590
+ dataSource = editableRowByKey({
591
+ data: dataSource,
592
+ getRowKey: props.getRowKey,
593
+ row: editRow,
594
+ key: recordKey,
595
+ childrenColumnName: props.childrenColumnName || 'children'
596
+ }, 'update');
597
+ });
598
+ var relayValue = value;
599
+ var recordKey = (_Object$keys$pop = Object.keys(relayValue || {}).pop()) === null || _Object$keys$pop === void 0 ? void 0 : _Object$keys$pop.toString();
600
+
601
+ //从form 和 cache 中取得数据
602
+ var newLineRecordData = _objectSpread(_objectSpread({}, newLineRecordCache === null || newLineRecordCache === void 0 ? void 0 : newLineRecordCache.defaultValue), get(values, [props.tableName || '', recordKey.toString()].flat(1).filter(function (key) {
603
+ return key || key === 0;
604
+ })));
605
+
606
+ /** 如果已经在 dataSource 中存在了,直接 find */
607
+ var editRow = dataSourceKeyIndexMapRef.current.has(recordKeyToString(recordKey)) ? dataSource.find(function (item, index) {
608
+ var _props$getRowKey3;
609
+ var key = (_props$getRowKey3 = props.getRowKey(item, index)) === null || _props$getRowKey3 === void 0 ? void 0 : _props$getRowKey3.toString();
610
+ return key === recordKey;
611
+ }) : newLineRecordData;
612
+ propsOnValuesChange.run(editRow || newLineRecordData, dataSource);
613
+ });
614
+ var saveRefsMap = useRef(new Map());
615
+ useEffect(function () {
616
+ // 确保只保留编辑状态的,其它的都删除掉
617
+ saveRefsMap.current.forEach(function (ref, key) {
508
618
  if (!editableKeysSet.has(key)) {
509
619
  saveRefsMap.current.delete(key);
510
620
  }
511
621
  });
512
622
  }, [saveRefsMap, editableKeysSet]);
513
- const saveEditable = useRefFunction(
514
- (recordKey, needReTry) => __async(this, null, function* () {
515
- var _a;
516
- const relayKey = recordKeyToString(recordKey);
517
- const key = dataSourceKeyIndexMapRef.current.get(recordKey.toString());
518
- if (!editableKeysSet.has(relayKey) && key && (needReTry != null ? needReTry : true) && props.tableName) {
519
- return yield saveEditable(key, false);
520
- }
521
- const saveRef = saveRefsMap.current.get(relayKey) || saveRefsMap.current.get(relayKey.toString());
522
- try {
523
- yield (_a = saveRef == null ? void 0 : saveRef.current) == null ? void 0 : _a.save();
524
- } catch (e) {
525
- return false;
526
- }
527
- editableKeysSet.delete(relayKey);
528
- editableKeysSet.delete(relayKey.toString());
529
- setEditableRowKeys(Array.from(editableKeysSet));
530
- return true;
531
- })
532
- );
533
- const addEditRecord = useRefFunction(
534
- (row, options) => {
535
- var _a;
536
- if ((options == null ? void 0 : options.parentKey) && !dataSourceKeyIndexMapRef.current.has(
537
- recordKeyToString(options == null ? void 0 : options.parentKey).toString()
538
- )) {
539
- console.warn("can't find record by key", options == null ? void 0 : options.parentKey);
540
- return false;
541
- }
542
- if (newLineRecordRef.current && props.onlyAddOneLineAlertMessage !== false) {
543
- warning(
544
- props.onlyAddOneLineAlertMessage || intl.getMessage("editableTable.onlyAddOneLine", "只能新增一行")
545
- );
546
- return false;
547
- }
548
- if (editableKeysSet.size > 0 && editableType === "single" && props.onlyOneLineEditorAlertMessage !== false) {
549
- warning(
550
- props.onlyOneLineEditorAlertMessage || intl.getMessage(
551
- "editableTable.onlyOneLineEditor",
552
- "只能同时编辑一行"
553
- )
554
- );
555
- return false;
556
- }
557
- const recordKey = props.getRowKey(row, -1);
558
- if (!recordKey && recordKey !== 0) {
559
- noteOnce(
560
- !!recordKey,
561
- "请设置 recordCreatorProps.record 并返回一个唯一的key \n https://procomponents.ant.design/components/editable-table#editable-%E6%96%B0%E5%BB%BA%E8%A1%8C"
562
- );
563
- throw new Error("请设置 recordCreatorProps.record 并返回一个唯一的key");
564
- }
565
- editableKeysSet.add(recordKey);
566
- setEditableRowKeys(Array.from(editableKeysSet));
567
- if ((options == null ? void 0 : options.newRecordType) === "dataSource" || props.tableName) {
568
- const actionProps = {
569
- data: props.dataSource,
570
- getRowKey: props.getRowKey,
571
- row: __spreadProps(__spreadValues({}, row), {
572
- map_row_parentKey: (options == null ? void 0 : options.parentKey) ? (_a = recordKeyToString(options == null ? void 0 : options.parentKey)) == null ? void 0 : _a.toString() : void 0
573
- }),
574
- key: recordKey,
575
- childrenColumnName: props.childrenColumnName || "children"
576
- };
577
- props.setDataSource(
578
- editableRowByKey(
579
- actionProps,
580
- (options == null ? void 0 : options.position) === "top" ? "top" : "update"
581
- )
582
- );
583
- } else {
584
- setNewLineRecordCache({
585
- defaultValue: row,
586
- options: __spreadProps(__spreadValues({}, options), {
587
- recordKey
588
- })
589
- });
590
- }
591
- return true;
592
- }
593
- );
594
- const saveText = (props == null ? void 0 : props.saveText) || intl.getMessage("editableTable.action.save", "保存");
595
- const deleteText = (props == null ? void 0 : props.deleteText) || intl.getMessage("editableTable.action.delete", "删除");
596
- const cancelText = (props == null ? void 0 : props.cancelText) || intl.getMessage("editableTable.action.cancel", "取消");
597
- const actionSaveRef = useRefFunction(
598
- (recordKey, editRow, originRow, newLine) => __async(this, null, function* () {
599
- var _a, _b, _c;
600
- const res = yield (_a = props == null ? void 0 : props.onSave) == null ? void 0 : _a.call(props, recordKey, editRow, originRow, newLine);
601
- yield cancelEditable(recordKey);
602
- const { options } = newLine || newLineRecordRef.current || {};
603
- if (!(options == null ? void 0 : options.parentKey) && (options == null ? void 0 : options.recordKey) === recordKey) {
604
- if ((options == null ? void 0 : options.position) === "top") {
605
- props.setDataSource([editRow, ...props.dataSource]);
606
- } else {
607
- props.setDataSource([...props.dataSource, editRow]);
623
+ /**
624
+ * 保存编辑行
625
+ *
626
+ * @param recordKey
627
+ * @param needReTry
628
+ */
629
+ var saveEditable = useRefFunction( /*#__PURE__*/function () {
630
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(recordKey, needReTry) {
631
+ var relayKey, key, saveRef, _saveRef$current;
632
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
633
+ while (1) switch (_context7.prev = _context7.next) {
634
+ case 0:
635
+ relayKey = recordKeyToString(recordKey);
636
+ key = dataSourceKeyIndexMapRef.current.get(recordKey.toString());
637
+ /** 如果没找到key,转化一下再去找 */
638
+ if (!(!editableKeysSet.has(relayKey) && key && (needReTry !== null && needReTry !== void 0 ? needReTry : true) && props.tableName)) {
639
+ _context7.next = 6;
640
+ break;
641
+ }
642
+ _context7.next = 5;
643
+ return saveEditable(key, false);
644
+ case 5:
645
+ return _context7.abrupt("return", _context7.sent);
646
+ case 6:
647
+ saveRef = saveRefsMap.current.get(relayKey) || saveRefsMap.current.get(relayKey.toString());
648
+ _context7.prev = 7;
649
+ _context7.next = 10;
650
+ return saveRef === null || saveRef === void 0 || (_saveRef$current = saveRef.current) === null || _saveRef$current === void 0 ? void 0 : _saveRef$current.save();
651
+ case 10:
652
+ _context7.next = 15;
653
+ break;
654
+ case 12:
655
+ _context7.prev = 12;
656
+ _context7.t0 = _context7["catch"](7);
657
+ return _context7.abrupt("return", false);
658
+ case 15:
659
+ editableKeysSet.delete(relayKey);
660
+ editableKeysSet.delete(relayKey.toString());
661
+ setEditableRowKeys(Array.from(editableKeysSet));
662
+ return _context7.abrupt("return", true);
663
+ case 19:
664
+ case "end":
665
+ return _context7.stop();
608
666
  }
609
- return res;
610
- }
611
- const actionProps = {
612
- data: props.dataSource,
613
- getRowKey: props.getRowKey,
614
- row: options ? __spreadProps(__spreadValues({}, editRow), {
615
- map_row_parentKey: (_c = recordKeyToString(
616
- (_b = options == null ? void 0 : options.parentKey) != null ? _b : ""
617
- )) == null ? void 0 : _c.toString()
618
- }) : editRow,
619
- key: recordKey,
620
- childrenColumnName: props.childrenColumnName || "children"
621
- };
622
- props.setDataSource(
623
- editableRowByKey(
624
- actionProps,
625
- (options == null ? void 0 : options.position) === "top" ? "top" : "update"
626
- )
627
- );
628
- yield cancelEditable(recordKey);
629
- return res;
630
- })
631
- );
632
- const actionDeleteRef = useRefFunction(
633
- (recordKey, editRow) => __async(this, null, function* () {
634
- var _a;
635
- const actionProps = {
667
+ }, _callee7, null, [[7, 12]]);
668
+ }));
669
+ return function (_x5, _x6) {
670
+ return _ref10.apply(this, arguments);
671
+ };
672
+ }());
673
+
674
+ /**
675
+ * 同时只能支持一行,取消之后数据消息,不会触发 dataSource
676
+ *
677
+ * @param row
678
+ * @param options
679
+ * @name 增加新的行
680
+ */
681
+ var addEditRecord = useRefFunction(function (row, options) {
682
+ if (options !== null && options !== void 0 && options.parentKey && !dataSourceKeyIndexMapRef.current.has(recordKeyToString(options === null || options === void 0 ? void 0 : options.parentKey).toString())) {
683
+ console.warn("can't find record by key", options === null || options === void 0 ? void 0 : options.parentKey);
684
+ return false;
685
+ }
686
+ // 暂时不支持多行新增
687
+ if (newLineRecordRef.current && props.onlyAddOneLineAlertMessage !== false) {
688
+ warning(props.onlyAddOneLineAlertMessage || intl.getMessage('editableTable.onlyAddOneLine', '只能新增一行'));
689
+ return false;
690
+ }
691
+ // 如果是单行的话,不允许多行编辑
692
+ if (editableKeysSet.size > 0 && editableType === 'single' && props.onlyOneLineEditorAlertMessage !== false) {
693
+ warning(props.onlyOneLineEditorAlertMessage || intl.getMessage('editableTable.onlyOneLineEditor', '只能同时编辑一行'));
694
+ return false;
695
+ }
696
+ // 防止多次渲染
697
+ var recordKey = props.getRowKey(row, -1);
698
+ if (!recordKey && recordKey !== 0) {
699
+ noteOnce(!!recordKey, '请设置 recordCreatorProps.record 并返回一个唯一的key \n https://procomponents.ant.design/components/editable-table#editable-%E6%96%B0%E5%BB%BA%E8%A1%8C');
700
+ throw new Error('请设置 recordCreatorProps.record 并返回一个唯一的key');
701
+ }
702
+ editableKeysSet.add(recordKey);
703
+ setEditableRowKeys(Array.from(editableKeysSet));
704
+
705
+ // 如果是dataSource 新增模式的话,取消再开始编辑,
706
+ // 这样就可以把新增到 dataSource的数据进入编辑模式了
707
+ // [a,b,cache] => [a,b,c]
708
+ if ((options === null || options === void 0 ? void 0 : options.newRecordType) === 'dataSource' || props.tableName) {
709
+ var _recordKeyToString3;
710
+ var actionProps = {
636
711
  data: props.dataSource,
637
712
  getRowKey: props.getRowKey,
638
- row: editRow,
713
+ row: _objectSpread(_objectSpread({}, row), {}, {
714
+ map_row_parentKey: options !== null && options !== void 0 && options.parentKey ? (_recordKeyToString3 = recordKeyToString(options === null || options === void 0 ? void 0 : options.parentKey)) === null || _recordKeyToString3 === void 0 ? void 0 : _recordKeyToString3.toString() : undefined
715
+ }),
639
716
  key: recordKey,
640
- childrenColumnName: props.childrenColumnName || "children"
717
+ childrenColumnName: props.childrenColumnName || 'children'
641
718
  };
642
- const res = yield (_a = props == null ? void 0 : props.onDelete) == null ? void 0 : _a.call(props, recordKey, editRow);
643
- yield cancelEditable(recordKey, false);
644
- props.setDataSource(editableRowByKey(actionProps, "delete"));
645
- return res;
646
- })
647
- );
648
- const actionCancelRef = useRefFunction(
649
- (recordKey, editRow, originRow, newLine) => __async(this, null, function* () {
650
- var _a;
651
- const res = yield (_a = props == null ? void 0 : props.onCancel) == null ? void 0 : _a.call(
652
- props,
653
- recordKey,
654
- editRow,
655
- originRow,
656
- newLine
657
- );
658
- return res;
659
- })
660
- );
661
- const existCustomActionRender = props.actionRender && typeof props.actionRender === "function";
662
- const customActionRender = existCustomActionRender ? props.actionRender : () => {
663
- };
664
- const customActionRenderRef = useRefFunction(
665
- customActionRender
666
- );
667
- const actionRender = (row) => {
668
- const key = props.getRowKey(row, row.index);
669
- const config = {
670
- saveText,
671
- cancelText,
672
- deleteText,
673
- addEditRecord,
719
+ props.setDataSource(editableRowByKey(actionProps, (options === null || options === void 0 ? void 0 : options.position) === 'top' ? 'top' : 'update'));
720
+ } else {
721
+ setNewLineRecordCache({
722
+ defaultValue: row,
723
+ options: _objectSpread(_objectSpread({}, options), {}, {
724
+ recordKey: recordKey
725
+ })
726
+ });
727
+ }
728
+ return true;
729
+ });
730
+ var saveText = (props === null || props === void 0 ? void 0 : props.saveText) || intl.getMessage('editableTable.action.save', '保存');
731
+ var deleteText = (props === null || props === void 0 ? void 0 : props.deleteText) || intl.getMessage('editableTable.action.delete', '删除');
732
+ var cancelText = (props === null || props === void 0 ? void 0 : props.cancelText) || intl.getMessage('editableTable.action.cancel', '取消');
733
+ var actionSaveRef = useRefFunction( /*#__PURE__*/function () {
734
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(recordKey, editRow, originRow, newLine) {
735
+ var _props$onSave, _recordKeyToString4, _options$parentKey;
736
+ var res, _ref12, options, actionProps;
737
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
738
+ while (1) switch (_context8.prev = _context8.next) {
739
+ case 0:
740
+ _context8.next = 2;
741
+ return props === null || props === void 0 || (_props$onSave = props.onSave) === null || _props$onSave === void 0 ? void 0 : _props$onSave.call(props, recordKey, editRow, originRow, newLine);
742
+ case 2:
743
+ res = _context8.sent;
744
+ _context8.next = 5;
745
+ return cancelEditable(recordKey);
746
+ case 5:
747
+ _ref12 = newLine || newLineRecordRef.current || {}, options = _ref12.options;
748
+ if (!(!(options !== null && options !== void 0 && options.parentKey) && (options === null || options === void 0 ? void 0 : options.recordKey) === recordKey)) {
749
+ _context8.next = 9;
750
+ break;
751
+ }
752
+ if ((options === null || options === void 0 ? void 0 : options.position) === 'top') {
753
+ props.setDataSource([editRow].concat(_toConsumableArray(props.dataSource)));
754
+ } else {
755
+ props.setDataSource([].concat(_toConsumableArray(props.dataSource), [editRow]));
756
+ }
757
+ return _context8.abrupt("return", res);
758
+ case 9:
759
+ actionProps = {
760
+ data: props.dataSource,
761
+ getRowKey: props.getRowKey,
762
+ row: options ? _objectSpread(_objectSpread({}, editRow), {}, {
763
+ map_row_parentKey: (_recordKeyToString4 = recordKeyToString((_options$parentKey = options === null || options === void 0 ? void 0 : options.parentKey) !== null && _options$parentKey !== void 0 ? _options$parentKey : '')) === null || _recordKeyToString4 === void 0 ? void 0 : _recordKeyToString4.toString()
764
+ }) : editRow,
765
+ key: recordKey,
766
+ childrenColumnName: props.childrenColumnName || 'children'
767
+ };
768
+ props.setDataSource(editableRowByKey(actionProps, (options === null || options === void 0 ? void 0 : options.position) === 'top' ? 'top' : 'update'));
769
+ _context8.next = 13;
770
+ return cancelEditable(recordKey);
771
+ case 13:
772
+ return _context8.abrupt("return", res);
773
+ case 14:
774
+ case "end":
775
+ return _context8.stop();
776
+ }
777
+ }, _callee8);
778
+ }));
779
+ return function (_x7, _x8, _x9, _x10) {
780
+ return _ref11.apply(this, arguments);
781
+ };
782
+ }());
783
+ var actionDeleteRef = useRefFunction( /*#__PURE__*/function () {
784
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(recordKey, editRow) {
785
+ var _props$onDelete2;
786
+ var actionProps, res;
787
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
788
+ while (1) switch (_context9.prev = _context9.next) {
789
+ case 0:
790
+ actionProps = {
791
+ data: props.dataSource,
792
+ getRowKey: props.getRowKey,
793
+ row: editRow,
794
+ key: recordKey,
795
+ childrenColumnName: props.childrenColumnName || 'children'
796
+ };
797
+ _context9.next = 3;
798
+ return props === null || props === void 0 || (_props$onDelete2 = props.onDelete) === null || _props$onDelete2 === void 0 ? void 0 : _props$onDelete2.call(props, recordKey, editRow);
799
+ case 3:
800
+ res = _context9.sent;
801
+ _context9.next = 6;
802
+ return cancelEditable(recordKey, false);
803
+ case 6:
804
+ props.setDataSource(editableRowByKey(actionProps, 'delete'));
805
+ return _context9.abrupt("return", res);
806
+ case 8:
807
+ case "end":
808
+ return _context9.stop();
809
+ }
810
+ }, _callee9);
811
+ }));
812
+ return function (_x11, _x12) {
813
+ return _ref13.apply(this, arguments);
814
+ };
815
+ }());
816
+ var actionCancelRef = useRefFunction( /*#__PURE__*/function () {
817
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(recordKey, editRow, originRow, newLine) {
818
+ var _props$onCancel;
819
+ var res;
820
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
821
+ while (1) switch (_context10.prev = _context10.next) {
822
+ case 0:
823
+ _context10.next = 2;
824
+ return props === null || props === void 0 || (_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 ? void 0 : _props$onCancel.call(props, recordKey, editRow, originRow, newLine);
825
+ case 2:
826
+ res = _context10.sent;
827
+ return _context10.abrupt("return", res);
828
+ case 4:
829
+ case "end":
830
+ return _context10.stop();
831
+ }
832
+ }, _callee10);
833
+ }));
834
+ return function (_x13, _x14, _x15, _x16) {
835
+ return _ref14.apply(this, arguments);
836
+ };
837
+ }());
838
+
839
+ // 如果传入了自定义的actionRender,使用useRefFunction以确保内部的事件处理函数可以访问最新的state
840
+ var existCustomActionRender = props.actionRender && typeof props.actionRender === 'function';
841
+ var customActionRender = existCustomActionRender ? props.actionRender : function () {};
842
+ var customActionRenderRef = useRefFunction(customActionRender);
843
+ var actionRender = function actionRender(row) {
844
+ var key = props.getRowKey(row, row.index);
845
+ var config = {
846
+ saveText: saveText,
847
+ cancelText: cancelText,
848
+ deleteText: deleteText,
849
+ addEditRecord: addEditRecord,
674
850
  recordKey: key,
675
- cancelEditable,
851
+ cancelEditable: cancelEditable,
676
852
  index: row.index,
677
853
  tableName: props.tableName,
678
854
  newLineConfig: newLineRecordCache,
679
855
  onCancel: actionCancelRef,
680
856
  onDelete: actionDeleteRef,
681
857
  onSave: actionSaveRef,
682
- editableKeys,
683
- setEditableRowKeys,
684
- preEditRowRef,
685
- deletePopconfirmMessage: props.deletePopconfirmMessage || `${intl.getMessage("deleteThisLine", "删除此项")}?`
858
+ editableKeys: editableKeys,
859
+ setEditableRowKeys: setEditableRowKeys,
860
+ preEditRowRef: preEditRowRef,
861
+ deletePopconfirmMessage: props.deletePopconfirmMessage || "".concat(intl.getMessage('deleteThisLine', '删除此项'), "?")
686
862
  };
687
- const renderResult = defaultActionRender(row, config);
863
+ var renderResult = defaultActionRender(row, config);
864
+ // 缓存一下saveRef
688
865
  if (props.tableName) {
689
- saveRefsMap.current.set(
690
- dataSourceKeyIndexMapRef.current.get(recordKeyToString(key)) || recordKeyToString(key),
691
- renderResult.saveRef
692
- );
866
+ saveRefsMap.current.set(dataSourceKeyIndexMapRef.current.get(recordKeyToString(key)) || recordKeyToString(key), renderResult.saveRef);
693
867
  } else {
694
868
  saveRefsMap.current.set(recordKeyToString(key), renderResult.saveRef);
695
869
  }
696
- if (existCustomActionRender)
697
- return customActionRenderRef(row, config, {
698
- save: renderResult.save,
699
- delete: renderResult.delete,
700
- cancel: renderResult.cancel
701
- });
870
+ if (existCustomActionRender) return customActionRenderRef(row, config, {
871
+ save: renderResult.save,
872
+ delete: renderResult.delete,
873
+ cancel: renderResult.cancel
874
+ });
702
875
  return [renderResult.save, renderResult.delete, renderResult.cancel];
703
876
  };
704
877
  return {
705
- editableKeys,
706
- setEditableRowKeys,
707
- isEditable,
708
- actionRender,
709
- startEditable,
710
- cancelEditable,
711
- addEditRecord,
712
- saveEditable,
878
+ editableKeys: editableKeys,
879
+ setEditableRowKeys: setEditableRowKeys,
880
+ isEditable: isEditable,
881
+ actionRender: actionRender,
882
+ startEditable: startEditable,
883
+ cancelEditable: cancelEditable,
884
+ addEditRecord: addEditRecord,
885
+ saveEditable: saveEditable,
713
886
  newLineRecord: newLineRecordCache,
714
887
  preEditableKeys: editableKeysRef,
715
- onValuesChange,
888
+ onValuesChange: onValuesChange,
716
889
  getRealIndex: props.getRealIndex
717
890
  };
718
- }
719
- export {
720
- DeleteEditableAction,
721
- SaveEditableAction,
722
- defaultActionRender,
723
- editableRowByKey,
724
- recordKeyToString,
725
- useEditableArray
726
- };
891
+ }