@zat-design/sisyphus-react 4.0.0-beta.2 → 4.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 (433) hide show
  1. package/es/FormsProvider/index.js +4 -2
  2. package/es/ProAction/components/CheckModalContent/index.js +9 -8
  3. package/es/ProAction/index.js +77 -75
  4. package/es/ProConfigProvider/index.js +17 -12
  5. package/es/ProDownload/index.js +89 -94
  6. package/es/ProDownload/utils.js +59 -50
  7. package/es/ProDrawerForm/components/ProDrawer/index.js +79 -72
  8. package/es/ProDrawerForm/components/ProModal/index.js +62 -60
  9. package/es/ProDrawerForm/components/index.js +2 -2
  10. package/es/ProDrawerForm/index.js +13 -11
  11. package/es/ProEditLabel/components/RenderProForm.js +25 -21
  12. package/es/ProEditLabel/index.js +54 -46
  13. package/es/ProEditTable/components/ActionButton/index.js +31 -23
  14. package/es/ProEditTable/components/RcTable/BaseTable.js +16 -15
  15. package/es/ProEditTable/components/RcTable/DraggableTable.js +19 -18
  16. package/es/ProEditTable/components/RcTable/index.js +2 -2
  17. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +27 -17
  18. package/es/ProEditTable/components/RenderField/index.js +176 -145
  19. package/es/ProEditTable/components/RenderToolbar/index.js +26 -24
  20. package/es/ProEditTable/components/Summary/index.js +13 -11
  21. package/es/ProEditTable/components/Validator/index.js +6 -5
  22. package/es/ProEditTable/components/index.js +5 -5
  23. package/es/ProEditTable/index.d.ts +1 -1
  24. package/es/ProEditTable/index.js +96 -80
  25. package/es/ProEditTable/utils/config.js +44 -37
  26. package/es/ProEditTable/utils/diffOriginal.js +8 -6
  27. package/es/ProEditTable/utils/getDefaultProps.js +8 -8
  28. package/es/ProEditTable/utils/index.js +86 -73
  29. package/es/ProEditTable/utils/tools.js +166 -157
  30. package/es/ProEditTable/utils/useEditTableError.js +17 -6
  31. package/es/ProEnum/components/Group.js +6 -6
  32. package/es/ProEnum/components/Tag.js +8 -6
  33. package/es/ProEnum/hooks/useEnum.js +26 -4
  34. package/es/ProEnum/hooks/useEnumRequest.js +59 -54
  35. package/es/ProEnum/index.js +48 -49
  36. package/es/ProEnum/utils/eventCenter.js +6 -4
  37. package/es/ProEnum/utils/getEnumLabel.js +9 -10
  38. package/es/ProEnum/utils/index.js +10 -5
  39. package/es/ProForm/components/Container.js +7 -5
  40. package/es/ProForm/components/FormFooter/index.js +10 -8
  41. package/es/ProForm/components/base/Checkbox/index.js +11 -8
  42. package/es/ProForm/components/base/DatePicker/index.js +21 -19
  43. package/es/ProForm/components/base/Input/index.js +17 -15
  44. package/es/ProForm/components/base/InputNumber/index.js +42 -38
  45. package/es/ProForm/components/base/Radio/index.js +10 -8
  46. package/es/ProForm/components/base/RangePicker/index.js +20 -20
  47. package/es/ProForm/components/base/Select/index.js +12 -10
  48. package/es/ProForm/components/base/Switch/index.js +12 -11
  49. package/es/ProForm/components/base/SwitchCheckbox/index.js +15 -14
  50. package/es/ProForm/components/base/TextArea/index.js +12 -11
  51. package/es/ProForm/components/base/TimePicker/index.js +7 -6
  52. package/es/ProForm/components/combination/Container/index.js +14 -12
  53. package/es/ProForm/components/combination/FormList/components/ActionButton.js +45 -42
  54. package/es/ProForm/components/combination/FormList/components/BlockFields.js +14 -13
  55. package/es/ProForm/components/combination/FormList/components/BlockTitle.js +6 -6
  56. package/es/ProForm/components/combination/FormList/components/Empty.js +30 -27
  57. package/es/ProForm/components/combination/FormList/components/LineFields.js +12 -11
  58. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +31 -29
  59. package/es/ProForm/components/combination/FormList/index.js +22 -21
  60. package/es/ProForm/components/combination/FormList/utils.js +5 -3
  61. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +7 -5
  62. package/es/ProForm/components/combination/Group/component/ComRender.js +19 -15
  63. package/es/ProForm/components/combination/Group/hooks/index.js +19 -16
  64. package/es/ProForm/components/combination/Group/index.js +19 -18
  65. package/es/ProForm/components/combination/Group/utils.js +22 -14
  66. package/es/ProForm/components/combination/ProCascader/index.js +53 -51
  67. package/es/ProForm/components/combination/ProCascader/utils/index.js +3 -3
  68. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +22 -14
  69. package/es/ProForm/components/combination/ProModalSelect/index.js +153 -135
  70. package/es/ProForm/components/combination/ProNumberRange/index.js +23 -20
  71. package/es/ProForm/components/combination/ProRangeLimit/index.js +33 -29
  72. package/es/ProForm/components/combination/ProTimeLimit/index.js +34 -28
  73. package/es/ProForm/components/index.d.ts +2 -0
  74. package/es/ProForm/components/index.js +31 -27
  75. package/es/ProForm/components/render/ChangedWrapper.js +19 -13
  76. package/es/ProForm/components/render/ConfirmWrapper.js +35 -35
  77. package/es/ProForm/components/render/Render.js +93 -71
  78. package/es/ProForm/components/render/RenderFields.js +42 -27
  79. package/es/ProForm/components/render/propsType.js +25 -0
  80. package/es/ProForm/index.js +53 -36
  81. package/es/ProForm/propsType.d.ts +1 -1
  82. package/es/ProForm/propsType.js +5 -1
  83. package/es/ProForm/utils/diffOriginal.js +9 -7
  84. package/es/ProForm/utils/getDefaultProps.js +7 -7
  85. package/es/ProForm/utils/index.js +63 -38
  86. package/es/ProForm/utils/processDependencies.js +11 -0
  87. package/es/ProForm/utils/rulesCreator.js +12 -13
  88. package/es/ProForm/utils/transformNames.js +5 -4
  89. package/es/ProForm/utils/transformValue.js +11 -6
  90. package/es/ProForm/utils/useDeepCompareMemo.js +6 -4
  91. package/es/ProForm/utils/useForm.js +71 -71
  92. package/es/ProForm/utils/useRules.js +11 -9
  93. package/es/ProForm/utils/useShouldUpdate.js +29 -27
  94. package/es/ProForm/utils/useWatch.js +25 -3
  95. package/es/ProForm/utils/valueType.js +14 -11
  96. package/es/ProIcon/config/index.js +2 -0
  97. package/es/ProIcon/index.js +33 -23
  98. package/es/ProIcon/utils/index.js +4 -5
  99. package/es/ProLayout/components/Layout/Header/index.js +12 -10
  100. package/es/ProLayout/components/Layout/Icon/Icon.js +3 -3
  101. package/es/ProLayout/components/Layout/Icon/index.js +1 -1
  102. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +24 -19
  103. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +30 -25
  104. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +7 -6
  105. package/es/ProLayout/components/Layout/Menu/index.js +12 -10
  106. package/es/ProLayout/components/Layout/Notice/index.js +9 -8
  107. package/es/ProLayout/components/Layout/index.js +4 -4
  108. package/es/ProLayout/components/ProCollapse/index.js +19 -15
  109. package/es/ProLayout/components/ProFooter/index.js +3 -3
  110. package/es/ProLayout/components/ProHeader/components/Copy/index.js +6 -6
  111. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +5 -4
  112. package/es/ProLayout/components/ProHeader/components/index.js +2 -2
  113. package/es/ProLayout/components/ProHeader/index.js +87 -75
  114. package/es/ProLayout/components/index.js +3 -3
  115. package/es/ProLayout/index.d.ts +1 -1
  116. package/es/ProLayout/index.js +17 -13
  117. package/es/ProLayout/utils/index.js +21 -18
  118. package/es/ProSelect/components/AdaptiveTooltip.js +5 -4
  119. package/es/ProSelect/index.js +44 -43
  120. package/es/ProSelect/utils/index.js +5 -4
  121. package/es/ProStep/components/Anchor/index.d.ts +1 -0
  122. package/es/ProStep/components/Anchor/index.js +19 -18
  123. package/es/ProStep/components/Item/index.d.ts +1 -0
  124. package/es/ProStep/components/Item/index.js +15 -11
  125. package/es/ProStep/components/Listener/index.js +18 -16
  126. package/es/ProStep/components/Step/index.js +15 -14
  127. package/es/ProStep/index.js +74 -62
  128. package/es/ProStep/utils/index.js +6 -5
  129. package/es/ProStepTab/index.js +111 -77
  130. package/es/ProTable/components/FormatColumn/index.js +69 -66
  131. package/es/ProTable/components/RcTable/components/BaseTable/index.js +3 -3
  132. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +39 -35
  133. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +10 -9
  134. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +5 -5
  135. package/es/ProTable/components/RcTable/index.js +2 -2
  136. package/es/ProTable/components/RenderColumn/index.js +30 -26
  137. package/es/ProTable/components/RenderEmptyText/index.js +7 -6
  138. package/es/ProTable/components/RenderFooter/index.js +2 -2
  139. package/es/ProTable/components/RenderSummary/index.js +11 -10
  140. package/es/ProTable/components/RenderTableHeader/index.js +15 -13
  141. package/es/ProTable/components/RenderTabs/index.js +7 -6
  142. package/es/ProTable/components/TableResizable/index.js +9 -8
  143. package/es/ProTable/components/TooltipTitle/index.js +6 -5
  144. package/es/ProTable/components/index.js +11 -6
  145. package/es/ProTable/hooks/useAntdTable.js +54 -47
  146. package/es/ProTable/index.js +71 -65
  147. package/es/ProTable/utils/index.js +12 -5
  148. package/es/ProTabs/components/Card/index.js +12 -11
  149. package/es/ProTabs/components/index.js +1 -1
  150. package/es/ProTabs/index.js +9 -8
  151. package/es/ProThemeTools/component/ProTools/index.js +42 -41
  152. package/es/ProThemeTools/component/index.js +1 -1
  153. package/es/ProThemeTools/context/ThemeContext.js +18 -2
  154. package/es/ProThemeTools/index.js +40 -14
  155. package/es/ProThemeTools/utils/index.js +9 -0
  156. package/es/ProTooltip/index.js +24 -22
  157. package/es/ProTree/components/AdaptiveTooltip.js +4 -4
  158. package/es/ProTree/components/CloseIcon.js +5 -5
  159. package/es/ProTree/components/List.js +15 -13
  160. package/es/ProTree/components/ProTree.js +62 -56
  161. package/es/ProTree/components/ProTreeSelect/index.js +88 -73
  162. package/es/ProTree/components/SearchTitle.js +10 -9
  163. package/es/ProTree/components/Tree.js +53 -52
  164. package/es/ProTree/components/index.js +4 -4
  165. package/es/ProTree/index.js +4 -4
  166. package/es/ProTree/utils.js +21 -14
  167. package/es/ProTreeModal/components/Cascader.js +23 -21
  168. package/es/ProTreeModal/components/CloseIcon.js +5 -5
  169. package/es/ProTreeModal/components/List.js +40 -33
  170. package/es/ProTreeModal/components/SearchTitle.js +5 -4
  171. package/es/ProTreeModal/components/SortableItem.js +10 -8
  172. package/es/ProTreeModal/components/Tree.js +37 -35
  173. package/es/ProTreeModal/components/Trigger.js +23 -22
  174. package/es/ProTreeModal/components/index.js +6 -6
  175. package/es/ProTreeModal/index.js +85 -65
  176. package/es/ProTreeModal/utils.js +22 -18
  177. package/es/ProUpload/components/ButtonRender.js +38 -37
  178. package/es/ProUpload/components/DragRender.js +41 -34
  179. package/es/ProUpload/components/DraggableUploadListItem.js +3 -2
  180. package/es/ProUpload/components/Example.js +10 -9
  181. package/es/ProUpload/components/FileItem.js +47 -42
  182. package/es/ProUpload/components/ImageRender.js +85 -85
  183. package/es/ProUpload/index.js +24 -19
  184. package/es/ProUpload/uitls.js +1 -1
  185. package/es/ProViewer/index.js +25 -19
  186. package/es/ProViewer/propsType.js +3 -1
  187. package/es/ProWaterMark/index.js +4 -3
  188. package/es/index.d.ts +1 -1
  189. package/es/index.js +38 -29
  190. package/es/locale/index.js +7 -2
  191. package/es/tokens.js +1 -0
  192. package/es/utils/index.js +7 -3
  193. package/lib/FormsProvider/index.js +53 -29
  194. package/lib/ProAction/components/CheckModalContent/index.js +27 -33
  195. package/lib/ProAction/index.js +155 -198
  196. package/lib/ProAction/propsType.js +16 -4
  197. package/lib/ProConfigProvider/index.js +139 -121
  198. package/lib/ProDownload/index.js +123 -194
  199. package/lib/ProDownload/propsType.js +16 -4
  200. package/lib/ProDownload/utils.js +145 -179
  201. package/lib/ProDrawerForm/components/ProDrawer/index.js +169 -236
  202. package/lib/ProDrawerForm/components/ProModal/index.js +134 -188
  203. package/lib/ProDrawerForm/components/index.js +39 -17
  204. package/lib/ProDrawerForm/index.js +86 -70
  205. package/lib/ProDrawerForm/propsType.js +16 -4
  206. package/lib/ProDrawerForm/utils/index.js +31 -13
  207. package/lib/ProEditLabel/components/RenderProForm.js +60 -58
  208. package/lib/ProEditLabel/index.js +182 -237
  209. package/lib/ProEditLabel/propsType.js +16 -4
  210. package/lib/ProEditLabel/utils/index.js +31 -15
  211. package/lib/ProEditTable/components/ActionButton/index.js +172 -153
  212. package/lib/ProEditTable/components/RcTable/BaseTable.js +103 -104
  213. package/lib/ProEditTable/components/RcTable/DraggableTable.js +159 -187
  214. package/lib/ProEditTable/components/RcTable/index.js +39 -17
  215. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +184 -178
  216. package/lib/ProEditTable/components/RenderField/index.js +564 -646
  217. package/lib/ProEditTable/components/RenderToolbar/index.js +105 -125
  218. package/lib/ProEditTable/components/Summary/index.js +61 -67
  219. package/lib/ProEditTable/components/Validator/index.js +48 -27
  220. package/lib/ProEditTable/components/index.js +48 -38
  221. package/lib/ProEditTable/index.d.ts +1 -1
  222. package/lib/ProEditTable/index.js +372 -430
  223. package/lib/ProEditTable/propsType.js +16 -4
  224. package/lib/ProEditTable/utils/config.js +180 -235
  225. package/lib/ProEditTable/utils/diffOriginal.js +59 -50
  226. package/lib/ProEditTable/utils/getDefaultProps.js +44 -29
  227. package/lib/ProEditTable/utils/index.js +255 -325
  228. package/lib/ProEditTable/utils/tools.js +252 -436
  229. package/lib/ProEditTable/utils/transform.js +28 -19
  230. package/lib/ProEditTable/utils/useEditTableError.js +58 -60
  231. package/lib/ProEnum/components/Group.js +78 -54
  232. package/lib/ProEnum/components/Tag.js +55 -40
  233. package/lib/ProEnum/hooks/useEnum.js +53 -53
  234. package/lib/ProEnum/hooks/useEnumRequest.js +198 -268
  235. package/lib/ProEnum/index.js +235 -244
  236. package/lib/ProEnum/propsType.js +16 -4
  237. package/lib/ProEnum/utils/eventCenter.js +25 -37
  238. package/lib/ProEnum/utils/getEnumLabel.js +65 -63
  239. package/lib/ProEnum/utils/index.js +67 -92
  240. package/lib/ProForm/components/Container.js +45 -32
  241. package/lib/ProForm/components/FormFooter/index.js +80 -63
  242. package/lib/ProForm/components/FormFooter/propsType.js +16 -4
  243. package/lib/ProForm/components/base/Checkbox/index.js +62 -65
  244. package/lib/ProForm/components/base/DatePicker/index.js +82 -71
  245. package/lib/ProForm/components/base/DatePicker/useDateLimit.js +31 -16
  246. package/lib/ProForm/components/base/Input/index.js +73 -61
  247. package/lib/ProForm/components/base/Input/propsType.js +16 -4
  248. package/lib/ProForm/components/base/InputNumber/index.js +177 -225
  249. package/lib/ProForm/components/base/Radio/index.js +69 -59
  250. package/lib/ProForm/components/base/RangePicker/index.js +90 -77
  251. package/lib/ProForm/components/base/RangePicker/useDateRange.js +46 -28
  252. package/lib/ProForm/components/base/Select/index.js +69 -60
  253. package/lib/ProForm/components/base/Switch/index.js +59 -42
  254. package/lib/ProForm/components/base/SwitchCheckbox/index.js +63 -62
  255. package/lib/ProForm/components/base/TextArea/index.js +67 -52
  256. package/lib/ProForm/components/base/TimePicker/index.js +59 -43
  257. package/lib/ProForm/components/combination/Container/index.js +77 -62
  258. package/lib/ProForm/components/combination/Container/propsType.js +16 -4
  259. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +195 -247
  260. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +108 -81
  261. package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +44 -25
  262. package/lib/ProForm/components/combination/FormList/components/Empty.js +55 -92
  263. package/lib/ProForm/components/combination/FormList/components/LineFields.js +120 -94
  264. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +103 -136
  265. package/lib/ProForm/components/combination/FormList/index.js +168 -142
  266. package/lib/ProForm/components/combination/FormList/propsType.js +16 -4
  267. package/lib/ProForm/components/combination/FormList/utils.js +54 -33
  268. package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +38 -21
  269. package/lib/ProForm/components/combination/Group/component/ComRender.js +74 -76
  270. package/lib/ProForm/components/combination/Group/hooks/index.js +136 -130
  271. package/lib/ProForm/components/combination/Group/index.js +114 -106
  272. package/lib/ProForm/components/combination/Group/propsType.js +16 -4
  273. package/lib/ProForm/components/combination/Group/utils.js +113 -128
  274. package/lib/ProForm/components/combination/ProCascader/index.js +192 -248
  275. package/lib/ProForm/components/combination/ProCascader/propsType.js +16 -4
  276. package/lib/ProForm/components/combination/ProCascader/utils/index.js +35 -24
  277. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +121 -114
  278. package/lib/ProForm/components/combination/ProModalSelect/index.js +491 -660
  279. package/lib/ProForm/components/combination/ProModalSelect/propsType.js +16 -4
  280. package/lib/ProForm/components/combination/ProModalSelect/utils/index.js +45 -22
  281. package/lib/ProForm/components/combination/ProNumberRange/index.js +163 -182
  282. package/lib/ProForm/components/combination/ProNumberRange/propsType.js +16 -4
  283. package/lib/ProForm/components/combination/ProRangeLimit/index.js +140 -164
  284. package/lib/ProForm/components/combination/ProRangeLimit/propsType.js +16 -4
  285. package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +49 -28
  286. package/lib/ProForm/components/combination/ProTimeLimit/index.js +128 -143
  287. package/lib/ProForm/components/index.d.ts +2 -0
  288. package/lib/ProForm/components/index.js +115 -192
  289. package/lib/ProForm/components/render/ChangedWrapper.js +146 -132
  290. package/lib/ProForm/components/render/ConfirmWrapper.js +78 -122
  291. package/lib/ProForm/components/render/Render.js +348 -419
  292. package/lib/ProForm/components/render/RenderFields.js +186 -188
  293. package/lib/ProForm/components/render/propsType.js +16 -5
  294. package/lib/ProForm/index.js +239 -270
  295. package/lib/ProForm/propsType.d.ts +1 -1
  296. package/lib/ProForm/propsType.js +38 -5
  297. package/lib/ProForm/utils/diffOriginal.js +56 -44
  298. package/lib/ProForm/utils/getDefaultProps.js +44 -28
  299. package/lib/ProForm/utils/index.js +270 -321
  300. package/lib/ProForm/utils/processDependencies.js +44 -52
  301. package/lib/ProForm/utils/rulesCreator.js +84 -61
  302. package/lib/ProForm/utils/transformNames.js +38 -27
  303. package/lib/ProForm/utils/transformValue.js +51 -48
  304. package/lib/ProForm/utils/useDeepCompareMemo.js +36 -16
  305. package/lib/ProForm/utils/useFieldProps.js +42 -11
  306. package/lib/ProForm/utils/useForm.js +118 -228
  307. package/lib/ProForm/utils/useRules.js +67 -60
  308. package/lib/ProForm/utils/useShouldUpdate.js +105 -177
  309. package/lib/ProForm/utils/useWatch.js +93 -100
  310. package/lib/ProForm/utils/valueType.js +157 -224
  311. package/lib/ProIcon/config/index.js +365 -276
  312. package/lib/ProIcon/index.js +189 -214
  313. package/lib/ProIcon/propsTypes.js +16 -4
  314. package/lib/ProIcon/symbolIcon.js +23 -30
  315. package/lib/ProIcon/utils/index.js +66 -57
  316. package/lib/ProLayout/components/Layout/Header/index.js +59 -42
  317. package/lib/ProLayout/components/Layout/Icon/Icon.js +49 -30
  318. package/lib/ProLayout/components/Layout/Icon/index.js +34 -7
  319. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +113 -120
  320. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +118 -123
  321. package/lib/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +16 -4
  322. package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +59 -42
  323. package/lib/ProLayout/components/Layout/Menu/index.js +76 -56
  324. package/lib/ProLayout/components/Layout/Notice/index.js +39 -31
  325. package/lib/ProLayout/components/Layout/index.js +45 -31
  326. package/lib/ProLayout/components/ProCollapse/PropTypes.js +16 -4
  327. package/lib/ProLayout/components/ProCollapse/index.js +132 -135
  328. package/lib/ProLayout/components/ProFooter/PropTypes.js +16 -4
  329. package/lib/ProLayout/components/ProFooter/index.js +58 -44
  330. package/lib/ProLayout/components/ProHeader/PropTypes.js +16 -4
  331. package/lib/ProLayout/components/ProHeader/components/Copy/index.js +53 -25
  332. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +48 -27
  333. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +16 -4
  334. package/lib/ProLayout/components/ProHeader/components/index.js +39 -17
  335. package/lib/ProLayout/components/ProHeader/index.js +274 -452
  336. package/lib/ProLayout/components/ProHeader/utils/index.js +32 -14
  337. package/lib/ProLayout/components/index.js +42 -24
  338. package/lib/ProLayout/index.d.ts +1 -1
  339. package/lib/ProLayout/index.js +127 -124
  340. package/lib/ProLayout/propTypes.js +16 -4
  341. package/lib/ProLayout/utils/index.js +92 -103
  342. package/lib/ProSelect/components/AdaptiveTooltip.js +46 -40
  343. package/lib/ProSelect/index.js +218 -250
  344. package/lib/ProSelect/propsType.js +16 -4
  345. package/lib/ProSelect/utils/index.js +80 -78
  346. package/lib/ProStep/components/Anchor/index.d.ts +1 -0
  347. package/lib/ProStep/components/Anchor/index.js +108 -101
  348. package/lib/ProStep/components/Item/index.d.ts +1 -0
  349. package/lib/ProStep/components/Item/index.js +83 -75
  350. package/lib/ProStep/components/Listener/index.js +62 -71
  351. package/lib/ProStep/components/Step/index.js +76 -67
  352. package/lib/ProStep/index.js +167 -225
  353. package/lib/ProStep/propsType.js +16 -4
  354. package/lib/ProStep/utils/index.js +59 -52
  355. package/lib/ProStepTab/index.js +179 -287
  356. package/lib/ProStepTab/propsType.js +16 -4
  357. package/lib/ProTable/components/FormatColumn/index.js +446 -495
  358. package/lib/ProTable/components/RcTable/components/BaseTable/index.js +53 -40
  359. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +139 -200
  360. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +116 -95
  361. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +16 -4
  362. package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +80 -59
  363. package/lib/ProTable/components/RcTable/index.js +39 -17
  364. package/lib/ProTable/components/RenderColumn/index.js +194 -200
  365. package/lib/ProTable/components/RenderEmptyText/index.js +27 -25
  366. package/lib/ProTable/components/RenderFooter/index.js +33 -17
  367. package/lib/ProTable/components/RenderSummary/index.js +46 -56
  368. package/lib/ProTable/components/RenderTableHeader/index.js +68 -59
  369. package/lib/ProTable/components/RenderTabs/index.js +89 -78
  370. package/lib/ProTable/components/TableResizable/index.js +88 -87
  371. package/lib/ProTable/components/TooltipTitle/index.js +40 -26
  372. package/lib/ProTable/components/index.js +51 -45
  373. package/lib/ProTable/hooks/useAntdTable.js +313 -375
  374. package/lib/ProTable/index.js +351 -385
  375. package/lib/ProTable/propsType.js +16 -4
  376. package/lib/ProTable/utils/index.js +84 -84
  377. package/lib/ProTabs/components/Card/index.js +30 -50
  378. package/lib/ProTabs/components/index.js +36 -10
  379. package/lib/ProTabs/index.js +92 -85
  380. package/lib/ProTabs/propType.js +16 -4
  381. package/lib/ProThemeTools/component/ProTools/index.js +198 -238
  382. package/lib/ProThemeTools/component/index.js +36 -10
  383. package/lib/ProThemeTools/context/ThemeContext.js +96 -87
  384. package/lib/ProThemeTools/index.js +183 -190
  385. package/lib/ProThemeTools/propsType.js +16 -4
  386. package/lib/ProThemeTools/utils/index.js +85 -79
  387. package/lib/ProTooltip/index.js +217 -221
  388. package/lib/ProTooltip/propsType.js +16 -4
  389. package/lib/ProTree/components/AdaptiveTooltip.js +33 -22
  390. package/lib/ProTree/components/CloseIcon.js +36 -31
  391. package/lib/ProTree/components/List.js +68 -72
  392. package/lib/ProTree/components/ProTree.js +262 -362
  393. package/lib/ProTree/components/ProTreeSelect/index.js +367 -474
  394. package/lib/ProTree/components/ProTreeSelect/propsType.js +16 -4
  395. package/lib/ProTree/components/SearchTitle.js +47 -50
  396. package/lib/ProTree/components/Tree.js +230 -302
  397. package/lib/ProTree/components/index.js +45 -31
  398. package/lib/ProTree/index.js +45 -22
  399. package/lib/ProTree/propsType.js +16 -4
  400. package/lib/ProTree/utils.js +83 -135
  401. package/lib/ProTreeModal/components/Cascader.js +97 -93
  402. package/lib/ProTreeModal/components/CloseIcon.js +36 -31
  403. package/lib/ProTreeModal/components/List.js +194 -263
  404. package/lib/ProTreeModal/components/SearchTitle.js +30 -22
  405. package/lib/ProTreeModal/components/SortableItem.js +60 -59
  406. package/lib/ProTreeModal/components/Tree.js +162 -180
  407. package/lib/ProTreeModal/components/Trigger.js +108 -126
  408. package/lib/ProTreeModal/components/index.js +51 -45
  409. package/lib/ProTreeModal/index.js +464 -574
  410. package/lib/ProTreeModal/propsType.js +16 -4
  411. package/lib/ProTreeModal/utils.js +105 -158
  412. package/lib/ProUpload/components/ButtonRender.js +86 -108
  413. package/lib/ProUpload/components/DragRender.js +120 -167
  414. package/lib/ProUpload/components/DraggableUploadListItem.js +50 -32
  415. package/lib/ProUpload/components/Example.js +56 -38
  416. package/lib/ProUpload/components/FileItem.js +114 -203
  417. package/lib/ProUpload/components/ImageRender.js +176 -246
  418. package/lib/ProUpload/index.js +204 -215
  419. package/lib/ProUpload/propsType.js +16 -4
  420. package/lib/ProUpload/uitls.js +34 -10
  421. package/lib/ProUtils/utils/index.js +38 -26
  422. package/lib/ProViewer/index.js +173 -199
  423. package/lib/ProViewer/propsType.js +16 -4
  424. package/lib/ProWaterMark/index.js +38 -18
  425. package/lib/ProWaterMark/propsType.js +16 -4
  426. package/lib/index.d.ts +1 -1
  427. package/lib/index.js +123 -272
  428. package/lib/locale/en_US.js +145 -127
  429. package/lib/locale/index.js +58 -38
  430. package/lib/locale/zh_CN.js +146 -128
  431. package/lib/tokens.js +103 -86
  432. package/lib/utils/index.js +91 -63
  433. package/package.json +7 -7
@@ -1,259 +1,246 @@
1
- "use strict";
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
28
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
29
+ // src/ProTreeModal/index.tsx
30
+ var ProTreeModal_exports = {};
31
+ __export(ProTreeModal_exports, {
32
+ CASCADER: () => CASCADER,
33
+ default: () => ProTreeModal_default
7
34
  });
8
- exports.default = exports.CASCADER = void 0;
9
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
- var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
14
- var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- var _react = _interopRequireWildcard(require("react"));
17
- var _ahooks = require("ahooks");
18
- var _antd = require("antd");
19
- var _reactSvg = require("react-svg");
20
- var _classnames = _interopRequireDefault(require("classnames"));
21
- var _index = require("../index");
22
- var _components = require("./components");
23
- var _utils = require("./utils");
24
- var _index2 = require("../ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index");
25
- var _inputSearch = _interopRequireDefault(require("../assets/input-search.svg"));
26
- var _locale = _interopRequireWildcard(require("../locale"));
27
- var LIST = 'LIST';
28
- var TREE = 'TREE';
29
- var CASCADER = exports.CASCADER = 'CASCADER';
30
- var ProTreeModal = function ProTreeModal(props) {
31
- var _locale$ProTreeModal, _props$otherProps, _props$otherProps2, _locale$ProTreeModal9, _locale$ProTreeModal0, _locale$ProTreeModal1, _locale$ProTreeModal10;
32
- var _useProConfig = (0, _index.useProConfig)('ProEnum'),
33
- _useProConfig$dics = _useProConfig.dics,
34
- dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
35
- var listRef = (0, _react.useRef)(null);
36
- var open = props.open,
37
- value = props.value,
38
- onChange = props.onChange,
39
- dataSource = props.dataSource,
40
- trigger = props.trigger,
41
- _props$mode = props.mode,
42
- mode = _props$mode === void 0 ? 'tree' : _props$mode,
43
- enumCode = props.code,
44
- _props$title = props.title,
45
- title = _props$title === void 0 ? _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal = _locale.default.ProTreeModal) === null || _locale$ProTreeModal === void 0 ? void 0 : _locale$ProTreeModal.select : _props$title,
46
- useRequest = props.useRequest,
47
- _props$showCodeName = props.showCodeName,
48
- showCodeName = _props$showCodeName === void 0 ? false : _props$showCodeName,
49
- _props$checkStrictly = props.checkStrictly,
50
- checkStrictly = _props$checkStrictly === void 0 ? false : _props$checkStrictly,
51
- tags = props.tags,
52
- placeholder = props.placeholder,
53
- _props$labelInValue = props.labelInValue,
54
- labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
55
- _props$style = props.style,
56
- style = _props$style === void 0 ? {} : _props$style,
57
- min = props.min,
58
- max = props.max,
59
- draggable = props.draggable,
60
- span = props.span,
61
- appoint = props.appoint,
62
- appointProps = props.appointProps,
63
- _props$fieldNames = props.fieldNames,
64
- fieldNames = _props$fieldNames === void 0 ? {
65
- label: 'label',
66
- value: 'value',
67
- children: 'children'
68
- } : _props$fieldNames,
69
- _props$disabled = props.disabled,
70
- disabled = _props$disabled === void 0 ? props.disabled || props.isView || (props === null || props === void 0 ? void 0 : (_props$otherProps = props.otherProps) === null || _props$otherProps === void 0 ? void 0 : _props$otherProps.isView) || false : _props$disabled,
71
- _props$isView = props.isView,
72
- isView = _props$isView === void 0 ? props.isView || (props === null || props === void 0 ? void 0 : (_props$otherProps2 = props.otherProps) === null || _props$otherProps2 === void 0 ? void 0 : _props$otherProps2.isView) || false : _props$isView,
73
- transformResponse = props.transformResponse,
74
- optionRender = props.optionRender,
75
- openChange = props.openChange,
76
- maxMessage = props.maxMessage;
77
- var allValue = props.allValue;
78
- var modeType = mode.toUpperCase();
79
- var fieldNameLabel = fieldNames.label;
80
- var fieldNameValue = fieldNames.value;
35
+ module.exports = __toCommonJS(ProTreeModal_exports);
36
+ var import_react = __toESM(require("react"));
37
+ var import_ahooks = require("ahooks");
38
+ var import_antd = require("antd");
39
+ var import_lodash = require("lodash");
40
+ var import_react_svg = require("react-svg");
41
+ var import_classnames = __toESM(require("classnames"));
42
+ var import__ = require("../index");
43
+ var import_components = require("./components");
44
+ var import_utils = require("./utils");
45
+ var import_utils2 = require("../ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index");
46
+ var import_input_search = __toESM(require("../assets/input-search.svg"));
47
+ var import_locale = __toESM(require("../locale"));
48
+ var LIST = "LIST";
49
+ var TREE = "TREE";
50
+ var CASCADER = "CASCADER";
51
+ var ProTreeModal = (props) => {
52
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
53
+ const { dics = {} } = (0, import__.useProConfig)("ProEnum");
54
+ const listRef = (0, import_react.useRef)(null);
55
+ const {
56
+ open,
57
+ value,
58
+ onChange,
59
+ dataSource,
60
+ trigger,
61
+ mode = "tree",
62
+ code: enumCode,
63
+ title = (_b = (_a = import_locale.default) == null ? void 0 : _a.ProTreeModal) == null ? void 0 : _b.select,
64
+ useRequest,
65
+ showCodeName = false,
66
+ checkStrictly = false,
67
+ tags,
68
+ placeholder,
69
+ labelInValue = false,
70
+ style = {},
71
+ min,
72
+ max,
73
+ draggable,
74
+ span,
75
+ appoint,
76
+ appointProps,
77
+ fieldNames = {
78
+ label: "label",
79
+ value: "value",
80
+ children: "children"
81
+ },
82
+ disabled = props.disabled || props.isView || ((_c = props == null ? void 0 : props.otherProps) == null ? void 0 : _c.isView) || false,
83
+ isView = props.isView || ((_d = props == null ? void 0 : props.otherProps) == null ? void 0 : _d.isView) || false,
84
+ transformResponse,
85
+ optionRender,
86
+ openChange,
87
+ maxMessage
88
+ } = props;
89
+ let { allValue } = props;
90
+ const modeType = mode.toUpperCase();
91
+ const fieldNameLabel = fieldNames.label;
92
+ const fieldNameValue = fieldNames.value;
81
93
  if (appoint && !allValue) {
82
- console.error('allValue must be input');
83
- allValue = 'all';
94
+ console.error("allValue must be input");
95
+ allValue = "all";
84
96
  }
85
- var _useSetState = (0, _ahooks.useSetState)({
86
- open: false,
87
- checkedValues: [],
88
- beforeClearAllValues: [],
89
- treeData: [],
90
- treeViewData: [],
91
- originalTreeData: [],
92
- flatTreeData: [],
93
- searchStr: '',
94
- checkAll: false,
95
- allKeys: [],
96
- transformedTree: []
97
- }),
98
- _useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
99
- state = _useSetState2[0],
100
- setState = _useSetState2[1];
101
- var fetchFunction = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)({
97
+ const [state, setState] = (0, import_ahooks.useSetState)({
98
+ open: false,
99
+ checkedValues: [],
100
+ beforeClearAllValues: [],
101
+ // 点击清空全部并点击关闭、此时数据回显示不正确
102
+ treeData: [],
103
+ treeViewData: [],
104
+ originalTreeData: [],
105
+ flatTreeData: [],
106
+ searchStr: "",
107
+ checkAll: false,
108
+ allKeys: [],
109
+ transformedTree: []
110
+ });
111
+ const fetchFunction = (0, import_ahooks.useRequest)(useRequest == null ? void 0 : useRequest.service, {
102
112
  manual: true,
103
- onSuccess: function onSuccess(res) {
104
- var _res$status = res.status,
105
- status = _res$status === void 0 ? 200 : _res$status,
106
- msg = res.message;
107
- var responseData = res === null || res === void 0 ? void 0 : res.data;
108
- if (transformResponse && typeof transformResponse === 'function') {
113
+ onSuccess: (res) => {
114
+ const { status = 200, message: msg } = res;
115
+ let responseData = res == null ? void 0 : res.data;
116
+ if (transformResponse && typeof transformResponse === "function") {
109
117
  responseData = transformResponse(res);
110
118
  }
111
119
  if (status !== 200) {
112
- _antd.message.error(msg);
120
+ import_antd.message.error(msg);
113
121
  return;
114
122
  }
115
123
  setState({
116
124
  treeData: responseData,
117
125
  originalTreeData: responseData,
118
- flatTreeData: (0, _utils.getFlatTreeData)(responseData, fieldNames, modeType),
119
- allKeys: (0, _utils.getAllKeys)(responseData, fieldNames)
126
+ flatTreeData: (0, import_utils.getFlatTreeData)(responseData, fieldNames, modeType),
127
+ allKeys: (0, import_utils.getAllKeys)(responseData, fieldNames)
120
128
  });
121
129
  },
122
- debounceWait: 300
123
- }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
124
- (0, _ahooks.useDeepCompareEffect)(function () {
130
+ debounceWait: 300,
131
+ ...useRequest == null ? void 0 : useRequest.options
132
+ });
133
+ (0, import_ahooks.useDeepCompareEffect)(() => {
134
+ var _a2, _b2;
125
135
  if (dataSource && dataSource.length) {
126
136
  setState({
127
137
  treeData: dataSource,
128
- originalTreeData: (0, _cloneDeep2.default)(dataSource),
129
- flatTreeData: (0, _utils.getFlatTreeData)(dataSource, fieldNames),
130
- allKeys: (0, _utils.getAllKeys)(dataSource, fieldNames)
138
+ originalTreeData: (0, import_lodash.cloneDeep)(dataSource),
139
+ flatTreeData: (0, import_utils.getFlatTreeData)(dataSource, fieldNames),
140
+ allKeys: (0, import_utils.getAllKeys)(dataSource, fieldNames)
131
141
  });
132
142
  } else if (enumCode) {
133
- var dictEnum = dics[enumCode] || [];
134
- // transform dictEnum
135
- if (transformResponse && (0, _isFunction2.default)(transformResponse)) {
143
+ let dictEnum = dics[enumCode] || [];
144
+ if (transformResponse && (0, import_lodash.isFunction)(transformResponse)) {
136
145
  dictEnum = transformResponse(dictEnum);
137
146
  }
138
- // check dictEnum isArray
139
147
  if (!dictEnum || !Array.isArray(dictEnum)) {
140
- var _locale$ProTreeModal2;
141
- console.error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal2 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal2 === void 0 ? void 0 : _locale$ProTreeModal2.errorArrayMessage);
148
+ console.error((_b2 = (_a2 = import_locale.default) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.errorArrayMessage);
142
149
  dictEnum = [];
143
150
  }
144
151
  setState({
145
152
  treeData: dictEnum,
146
- originalTreeData: (0, _cloneDeep2.default)(dictEnum),
147
- flatTreeData: (0, _utils.getFlatTreeData)(dictEnum, fieldNames),
148
- allKeys: (0, _utils.getAllKeys)(dictEnum, fieldNames)
153
+ originalTreeData: (0, import_lodash.cloneDeep)(dictEnum),
154
+ flatTreeData: (0, import_utils.getFlatTreeData)(dictEnum, fieldNames),
155
+ allKeys: (0, import_utils.getAllKeys)(dictEnum, fieldNames)
149
156
  });
150
157
  }
151
158
  }, [dataSource, enumCode]);
152
- (0, _ahooks.useDeepCompareEffect)(function () {
159
+ (0, import_ahooks.useDeepCompareEffect)(() => {
153
160
  if (enumCode) {
154
- return undefined;
161
+ return void 0;
155
162
  }
156
163
  if (dataSource) {
157
- return undefined;
164
+ return void 0;
158
165
  }
159
- var _ref = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
160
- defaultParams = _ref.defaultParams,
161
- manual = _ref.manual;
162
- var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
166
+ const { defaultParams, manual } = (useRequest == null ? void 0 : useRequest.options) || {};
167
+ const params = Array.isArray(defaultParams) ? defaultParams == null ? void 0 : defaultParams[0] : defaultParams || {};
163
168
  if (manual) {
164
169
  return;
165
170
  }
166
- // 执行用户配置的枚举服务,拉取枚举数据进行更新
167
171
  fetchFunction.run(params);
168
- }, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
169
- (0, _react.useEffect)(function () {
172
+ }, [useRequest == null ? void 0 : useRequest.options]);
173
+ (0, import_react.useEffect)(() => {
170
174
  setState({
171
- open: open
175
+ open
172
176
  });
173
177
  }, [open]);
174
- (0, _react.useEffect)(function () {
178
+ (0, import_react.useEffect)(() => {
175
179
  if (value) {
176
- var checkedValues = [];
177
- var treeData = state.treeData,
178
- allKeys = state.allKeys,
179
- originalTreeData = state.originalTreeData;
180
- var treeViewData = [];
181
- if (allValue && typeof value === 'string' && allValue === value) {
180
+ let checkedValues = [];
181
+ const { treeData, allKeys, originalTreeData } = state;
182
+ let treeViewData = [];
183
+ if (allValue && typeof value === "string" && allValue === value) {
182
184
  if (modeType === LIST) {
183
- checkedValues = treeData.map(function (item) {
184
- return item[fieldNameValue];
185
- }) || [];
185
+ checkedValues = treeData.map((item) => item[fieldNameValue]) || [];
186
186
  } else if (modeType === TREE) {
187
187
  checkedValues = allKeys;
188
188
  }
189
189
  } else {
190
190
  if (!Array.isArray(value)) {
191
- console.error('Please pass in the array');
191
+ console.error("Please pass in the array");
192
192
  return;
193
193
  }
194
- // 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
195
194
  if (labelInValue) {
196
- var isObjectArray = value.every(function (element) {
197
- return (0, _typeof2.default)(element) === 'object' && element !== null;
198
- });
195
+ const isObjectArray = value.every(
196
+ (element) => typeof element === "object" && element !== null
197
+ );
199
198
  if (!isObjectArray) {
200
- console.error('Please enter an array object');
199
+ console.error("Please enter an array object");
201
200
  checkedValues = [];
202
201
  }
203
- checkedValues = value.map(function (item) {
204
- return item[fieldNameValue];
205
- });
202
+ checkedValues = value.map((item) => item[fieldNameValue]);
206
203
  } else {
207
204
  checkedValues = value;
208
205
  }
209
206
  }
210
- treeViewData = (0, _utils.filterCheckedNodes)(originalTreeData, checkedValues, '', fieldNames);
207
+ treeViewData = (0, import_utils.filterCheckedNodes)(originalTreeData, checkedValues, "", fieldNames);
211
208
  setState({
212
- checkedValues: checkedValues,
209
+ checkedValues,
213
210
  checkAll: checkedValues.length === allKeys.length,
214
- treeViewData: treeViewData,
211
+ treeViewData,
215
212
  beforeClearAllValues: checkedValues
216
213
  });
217
214
  }
218
215
  }, [value, state.allKeys, state.open]);
219
- (0, _ahooks.useDeepCompareEffect)(function () {
220
- var transformedTree = (0, _utils.addLevelAndParentId)(state.treeData, fieldNames);
216
+ (0, import_ahooks.useDeepCompareEffect)(() => {
217
+ const transformedTree = (0, import_utils.addLevelAndParentId)(state.treeData, fieldNames);
221
218
  setState({
222
- transformedTree: transformedTree
219
+ transformedTree
223
220
  });
224
221
  }, [state.treeData]);
225
- var handleClick = function handleClick() {
222
+ const handleClick = () => {
226
223
  setState({
227
224
  open: true
228
225
  });
229
- openChange === null || openChange === void 0 ? void 0 : openChange(true);
226
+ openChange == null ? void 0 : openChange(true);
230
227
  };
231
- /**
232
- * close Drawer and onChange(values)
233
- */
234
- var handleFinish = function handleFinish() {
235
- // 全选的时候返回 allValue 标记即可
236
- // 3.3.2 版本全选的时候返回所有值的合集 list
237
- if (allValue !== undefined && state.checkAll && !draggable) {
228
+ const handleFinish = () => {
229
+ var _a2, _b2, _c2;
230
+ if (allValue !== void 0 && state.checkAll && !draggable) {
238
231
  if (labelInValue) {
239
- onChange === null || onChange === void 0 ? void 0 : onChange(state.flatTreeData);
232
+ onChange == null ? void 0 : onChange(state.flatTreeData);
240
233
  } else {
241
- onChange === null || onChange === void 0 ? void 0 : onChange(state.flatTreeData.map(function (item) {
242
- return item[fieldNameValue];
243
- }));
234
+ onChange == null ? void 0 : onChange(state.flatTreeData.map((item) => item[fieldNameValue]));
244
235
  }
245
236
  } else if (draggable && span) {
246
- var _listRef$current;
247
- // 开启 draggable 使用拖拽后的顺序
248
- var checkedList = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.onChange();
237
+ const checkedList = (_a2 = listRef.current) == null ? void 0 : _a2.onChange();
249
238
  onChange(checkedList);
250
239
  } else {
251
- var values = [];
240
+ let values = [];
252
241
  if (labelInValue) {
253
- state.checkedValues.forEach(function (val) {
254
- var option = state.flatTreeData.find(function (item) {
255
- return item[fieldNameValue] === val;
256
- });
242
+ state.checkedValues.forEach((val) => {
243
+ const option = state.flatTreeData.find((item) => item[fieldNameValue] === val);
257
244
  option && values.push(option);
258
245
  });
259
246
  } else {
@@ -261,74 +248,50 @@ var ProTreeModal = function ProTreeModal(props) {
261
248
  }
262
249
  if (min) {
263
250
  if (values.length < min) {
264
- var _locale$ProTreeModal3;
265
- _antd.message.error((0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal3 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal3 === void 0 ? void 0 : _locale$ProTreeModal3.selectMin, {
266
- min: min
267
- }));
251
+ import_antd.message.error((0, import_locale.formatMessage)((_c2 = (_b2 = import_locale.default) == null ? void 0 : _b2.ProTreeModal) == null ? void 0 : _c2.selectMin, { min }));
268
252
  return;
269
253
  }
270
254
  }
271
- onChange === null || onChange === void 0 ? void 0 : onChange(values);
255
+ onChange == null ? void 0 : onChange(values);
272
256
  }
273
- // fix: 当有 openChange 时候、点击确定应该由关闭 openChange 控制
274
- if (!openChange || open === undefined) {
257
+ if (!openChange || open === void 0) {
275
258
  setState({
276
259
  open: false
277
260
  });
278
- openChange === null || openChange === void 0 ? void 0 : openChange(false);
261
+ openChange == null ? void 0 : openChange(false);
279
262
  }
280
- if (openChange && open !== undefined) {
281
- openChange === null || openChange === void 0 ? void 0 : openChange(true);
263
+ if (openChange && open !== void 0) {
264
+ openChange == null ? void 0 : openChange(true);
282
265
  }
283
266
  };
284
- /**
285
- * clear all checked
286
- */
287
- var handleClearAll = function handleClearAll() {
288
- var _state$flatTreeData$f;
289
- // 处理 ProTable 场景下 disabled 的不需要被清理
290
- var _checkedValues = span ? (_state$flatTreeData$f = state.flatTreeData.filter(function (item) {
291
- return item.disabled;
292
- })) === null || _state$flatTreeData$f === void 0 ? void 0 : _state$flatTreeData$f.map(function (item) {
293
- return item[fieldNameValue];
294
- }) : [];
267
+ const handleClearAll = () => {
268
+ var _a2;
269
+ const _checkedValues = span ? (_a2 = state.flatTreeData.filter((item) => item.disabled)) == null ? void 0 : _a2.map((item) => item[fieldNameValue]) : [];
295
270
  setState({
296
271
  checkedValues: _checkedValues,
297
272
  beforeClearAllValues: state.checkedValues,
273
+ // 把清空全部之前的数据记录下
298
274
  treeViewData: [],
299
275
  checkAll: false
300
276
  });
301
277
  };
302
- /**
303
- * Drawer close
304
- */
305
- var handleClose = function handleClose() {
278
+ const handleClose = () => {
306
279
  setState({
307
280
  open: false,
308
281
  checkedValues: state.beforeClearAllValues,
309
282
  beforeClearAllValues: []
310
283
  });
311
- openChange === null || openChange === void 0 ? void 0 : openChange(false);
284
+ openChange == null ? void 0 : openChange(false);
312
285
  };
313
- /**
314
- * checkbox/list selected change values
315
- * @param values
316
- */
317
- var handleListCheckChange = function handleListCheckChange(e, code) {
318
- var checkedValues = (0, _toConsumableArray2.default)(state.checkedValues);
319
- var checked = e.target.checked;
286
+ const handleListCheckChange = (e, code) => {
287
+ var _a2, _b2;
288
+ let checkedValues = [...state.checkedValues];
289
+ const { checked } = e.target;
320
290
  if (!checked) {
321
- checkedValues = checkedValues.filter(function (value) {
322
- return value !== code;
323
- });
291
+ checkedValues = checkedValues.filter((value2) => value2 !== code);
324
292
  } else if (draggable && span) {
325
- // 固定在右侧的情况
326
- var fixedOption = state.flatTreeData.find(function (item) {
327
- return item.fixed === 'right';
328
- }) || {};
329
- var fixedIdx = checkedValues.findIndex(function (value) {
330
- return value === fixedOption[fieldNameValue];
331
- });
293
+ const fixedOption = state.flatTreeData.find((item) => item.fixed === "right") || {};
294
+ const fixedIdx = checkedValues.findIndex((value2) => value2 === fixedOption[fieldNameValue]);
332
295
  if (fixedIdx >= 0) {
333
296
  checkedValues.splice(fixedIdx, 0, code);
334
297
  } else {
@@ -338,492 +301,419 @@ var ProTreeModal = function ProTreeModal(props) {
338
301
  checkedValues.push(code);
339
302
  }
340
303
  if (max && checkedValues.length > max) {
341
- var _locale$ProTreeModal4;
342
- _antd.message.error(maxMessage ? (0, _utils.transformMessage)({
343
- max: max
344
- }, maxMessage) : (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal4 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal4 === void 0 ? void 0 : _locale$ProTreeModal4.selectMax, {
345
- max: max
346
- }));
304
+ import_antd.message.error(
305
+ maxMessage ? (0, import_utils.transformMessage)({ max }, maxMessage) : (0, import_locale.formatMessage)((_b2 = (_a2 = import_locale.default) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.selectMax, { max })
306
+ );
347
307
  return;
348
308
  }
349
309
  setState({
350
- checkedValues: checkedValues,
310
+ checkedValues,
351
311
  checkAll: checkedValues.length === state.flatTreeData.length
352
312
  });
353
313
  };
354
- var handleDragEndChange = function handleDragEndChange(checkedValues) {
314
+ const handleDragEndChange = (checkedValues) => {
355
315
  setState({
356
- checkedValues: checkedValues
316
+ checkedValues
357
317
  });
358
318
  };
359
- var onCheck = function onCheck(checkedKeys, info) {
360
- var checkedValues = (0, _toConsumableArray2.default)(state.checkedValues);
361
- var originalTreeData = state.originalTreeData;
362
- // 如果有检索则自管理
319
+ const onCheck = (checkedKeys, info) => {
320
+ var _a2, _b2, _c2;
321
+ let checkedValues = [...state.checkedValues];
322
+ const { originalTreeData } = state;
363
323
  if (state.searchStr) {
364
- var _transformTreeToArray;
365
- var node = info.node;
366
- // 从完整树中找到当前节点
367
- var activeNode = (0, _index2.treeNodeFind)(state.transformedTree, function (t) {
368
- return t[fieldNameValue] === node[fieldNameValue];
369
- }, {
370
- childrenKey: fieldNames.children
371
- });
372
- var allChildren = (_transformTreeToArray = (0, _index2.transformTreeToArray)([activeNode], {
324
+ const { node } = info;
325
+ const activeNode = (0, import_utils2.treeNodeFind)(
326
+ state.transformedTree,
327
+ (t) => t[fieldNameValue] === node[fieldNameValue],
328
+ {
329
+ childrenKey: fieldNames.children
330
+ }
331
+ );
332
+ const allChildren = (_a2 = (0, import_utils2.transformTreeToArray)([activeNode], {
373
333
  childrenKey: fieldNames.children
374
- })) === null || _transformTreeToArray === void 0 ? void 0 : _transformTreeToArray.map(function (item) {
375
- return item[fieldNameValue];
376
- });
377
- // 子项合并勾选
334
+ })) == null ? void 0 : _a2.map((item) => item[fieldNameValue]);
378
335
  checkedValues = checkedValues.concat(allChildren);
379
- // 从完整树中拿到父节点 只要存在父节点,那么就判断当前children是否全被勾选 若全被勾选就合并当前key到勾选队列
380
- var _recourse2 = function _recourse(findNode) {
336
+ const _recourse = (findNode) => {
337
+ var _a3;
381
338
  if (findNode.parentId) {
382
- var _transformTreeToArray2;
383
- var parentNode = (0, _index2.treeNodeFind)(state.transformedTree, function (t) {
384
- return t[fieldNameValue] === findNode.parentId;
385
- }, {
386
- childrenKey: fieldNames.children
387
- });
388
- var parentChildrenKeys = (_transformTreeToArray2 = (0, _index2.transformTreeToArray)([parentNode], {
339
+ const parentNode = (0, import_utils2.treeNodeFind)(
340
+ state.transformedTree,
341
+ (t) => t[fieldNameValue] === findNode.parentId,
342
+ {
343
+ childrenKey: fieldNames.children
344
+ }
345
+ );
346
+ const parentChildrenKeys = (_a3 = (0, import_utils2.transformTreeToArray)([parentNode], {
389
347
  childrenKey: fieldNames.children
390
- })) === null || _transformTreeToArray2 === void 0 ? void 0 : _transformTreeToArray2.map(function (item) {
391
- return item[fieldNameValue];
392
- });
393
- var parentChildrenAllChecked = parentChildrenKeys.every(function (key) {
348
+ })) == null ? void 0 : _a3.map((item) => item[fieldNameValue]);
349
+ const parentChildrenAllChecked = parentChildrenKeys.every((key) => {
394
350
  return checkedValues.includes(key);
395
351
  });
396
352
  if (parentChildrenAllChecked) {
397
- // 把当前父节点追加进来
398
353
  checkedValues = checkedValues.concat([parentNode[fieldNameValue]]);
399
- // 继续向上查找
400
354
  if (parentNode.parentId) {
401
- _recourse2(parentNode);
355
+ _recourse(parentNode);
402
356
  }
403
357
  }
404
358
  }
405
359
  };
406
- _recourse2(activeNode);
360
+ _recourse(activeNode);
407
361
  }
408
- var _checkStrictly = state.searchStr ? true : checkStrictly;
409
- // 此时应该取消掉自身并包含它所有的子集
362
+ const _checkStrictly = state.searchStr ? true : checkStrictly;
410
363
  if (!info.checked && !_checkStrictly) {
411
- // 1. 取消自身
412
- // 2. 把所有的子节点也要取消
413
- var childrenkeys = [];
414
- (0, _utils.getChildrenKeys)(info.node, childrenkeys, fieldNames, 'treeCheck');
415
- checkedValues = checkedValues.filter(function (key) {
416
- return !childrenkeys.includes(key);
417
- });
418
- // 3. 取消父节点
419
- var parentNodes = (0, _utils.findTreeNodeByKey)(originalTreeData, info.node.key, fieldNames);
420
- var parentKeys = parentNodes.reduce(function (prev, curr) {
421
- return prev.concat(curr[fieldNameValue]);
422
- }, []);
423
- checkedValues = checkedValues.filter(function (key) {
424
- return !parentKeys.includes(key);
425
- });
364
+ const childrenkeys = [];
365
+ (0, import_utils.getChildrenKeys)(info.node, childrenkeys, fieldNames, "treeCheck");
366
+ checkedValues = checkedValues.filter((key) => !childrenkeys.includes(key));
367
+ const parentNodes = (0, import_utils.findTreeNodeByKey)(originalTreeData, info.node.key, fieldNames);
368
+ const parentKeys = parentNodes.reduce(
369
+ (prev, curr) => prev.concat(curr[fieldNameValue]),
370
+ []
371
+ );
372
+ checkedValues = checkedValues.filter((key) => !parentKeys.includes(key));
426
373
  } else {
427
- // _checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
428
374
  if (_checkStrictly) {
429
375
  if (!info.checked) {
430
- checkedValues = checkedValues.filter(function (key) {
431
- return key !== info.node.key;
432
- });
376
+ checkedValues = checkedValues.filter((key) => key !== info.node.key);
433
377
  }
434
378
  checkedKeys = checkedKeys.checked || [];
435
379
  }
436
- checkedKeys.forEach(function (key) {
437
- var exist = checkedValues.includes(key);
380
+ checkedKeys.forEach((key) => {
381
+ const exist = checkedValues.includes(key);
438
382
  if (info.checked && !exist) {
439
383
  checkedValues.push(key);
440
384
  }
441
385
  });
442
386
  }
443
- // 根据选中的筛选出 viewTreeData
444
- var treeViewData = [];
387
+ let treeViewData = [];
445
388
  if (!checkStrictly) {
446
- treeViewData = (0, _utils.filterCheckedNodes)(originalTreeData, checkedValues, '', fieldNames);
389
+ treeViewData = (0, import_utils.filterCheckedNodes)(originalTreeData, checkedValues, "", fieldNames);
447
390
  } else {
448
- treeViewData = state.flatTreeData.filter(function (item) {
391
+ treeViewData = state.flatTreeData.filter((item) => {
449
392
  return checkedValues.includes(item[fieldNameValue]);
450
393
  });
451
394
  }
452
395
  if (max && checkedValues.length > max) {
453
- var _locale$ProTreeModal5;
454
- _antd.message.error(maxMessage ? (0, _utils.transformMessage)({
455
- max: max
456
- }, maxMessage) : (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal5 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal5 === void 0 ? void 0 : _locale$ProTreeModal5.selectMax, {
457
- max: max
458
- }));
396
+ import_antd.message.error(
397
+ maxMessage ? (0, import_utils.transformMessage)({ max }, maxMessage) : (0, import_locale.formatMessage)((_c2 = (_b2 = import_locale.default) == null ? void 0 : _b2.ProTreeModal) == null ? void 0 : _c2.selectMax, { max })
398
+ );
459
399
  return;
460
400
  }
461
401
  setState({
462
- checkedValues: checkedValues,
463
- treeViewData: treeViewData,
402
+ checkedValues,
403
+ treeViewData,
464
404
  checkAll: state.allKeys.length === checkedValues.length
465
405
  });
466
406
  };
467
- /**
468
- * filter checkbox by fileNameValue
469
- * @param fileNameValue
470
- */
471
- var handleFilterClose = function handleFilterClose(fileNameValue) {
407
+ const handleFilterClose = (fileNameValue) => {
472
408
  setState({
473
- checkedValues: state.checkedValues.filter(function (value) {
474
- return value !== fileNameValue;
475
- }),
409
+ checkedValues: state.checkedValues.filter((value2) => value2 !== fileNameValue),
476
410
  checkAll: false
477
411
  });
478
412
  };
479
- /**
480
- * tree close
481
- * @param fileNamekey
482
- * @param node
483
- */
484
- var treeFilterClose = function treeFilterClose(fileNamekey, node) {
485
- var checkedValues = (0, _toConsumableArray2.default)(state.checkedValues);
486
- var treeViewData = [];
487
- var originalTreeData = state.originalTreeData;
413
+ const treeFilterClose = (fileNamekey, node) => {
414
+ let checkedValues = [...state.checkedValues];
415
+ let treeViewData = [];
416
+ const { originalTreeData } = state;
488
417
  if (checkStrictly) {
489
- checkedValues = checkedValues.filter(function (key) {
490
- return key !== fileNamekey;
491
- });
492
- // handleFilterClose
493
- treeViewData = state.flatTreeData.filter(function (item) {
418
+ checkedValues = checkedValues.filter((key) => key !== fileNamekey);
419
+ treeViewData = state.flatTreeData.filter((item) => {
494
420
  return checkedValues.includes(item[fieldNameValue]);
495
421
  });
496
422
  } else {
497
- // 1. 取消自身
498
- checkedValues = checkedValues.filter(function (key) {
499
- return key !== fileNamekey;
500
- });
501
- // 2. 把所有的子节点也要取消
502
- var childrenkeys = [];
503
- (0, _utils.getChildrenKeys)(node, childrenkeys, fieldNames, 'treeClose');
504
- checkedValues = checkedValues.filter(function (key) {
505
- return !childrenkeys.includes(key);
506
- });
507
- // 3. 取消父节点
508
- var parentNodes = (0, _utils.findTreeNodeByKey)(originalTreeData, fileNamekey, fieldNames);
509
- var parentKeys = parentNodes.reduce(function (prev, curr) {
510
- return prev.concat(curr[fieldNames.value]);
511
- }, []);
512
- checkedValues = checkedValues.filter(function (key) {
513
- return !parentKeys.includes(key);
514
- });
515
- // 根据选中的筛选出 viewTreeData
516
- treeViewData = (0, _utils.filterCheckedNodes)(originalTreeData, checkedValues, '', fieldNames);
423
+ checkedValues = checkedValues.filter((key) => key !== fileNamekey);
424
+ const childrenkeys = [];
425
+ (0, import_utils.getChildrenKeys)(node, childrenkeys, fieldNames, "treeClose");
426
+ checkedValues = checkedValues.filter((key) => !childrenkeys.includes(key));
427
+ const parentNodes = (0, import_utils.findTreeNodeByKey)(originalTreeData, fileNamekey, fieldNames);
428
+ const parentKeys = parentNodes.reduce(
429
+ (prev, curr) => prev.concat(curr[fieldNames.value]),
430
+ []
431
+ );
432
+ checkedValues = checkedValues.filter((key) => !parentKeys.includes(key));
433
+ treeViewData = (0, import_utils.filterCheckedNodes)(originalTreeData, checkedValues, "", fieldNames);
517
434
  }
518
435
  setState({
519
- checkedValues: checkedValues,
520
- treeViewData: treeViewData,
436
+ checkedValues,
437
+ treeViewData,
521
438
  checkAll: false
522
439
  });
523
440
  };
524
- var _useDebounceFn = (0, _ahooks.useDebounceFn)(function (str) {
441
+ const { run: onSearch } = (0, import_ahooks.useDebounceFn)(
442
+ (str) => {
525
443
  if (modeType === LIST || modeType === CASCADER) {
526
- var isCASCADER = modeType === CASCADER;
527
- var data = state.flatTreeData.filter(function (item) {
528
- var title = isCASCADER ? item === null || item === void 0 ? void 0 : item.title : item[fieldNameLabel];
529
- return title.includes(str);
444
+ const isCASCADER = modeType === CASCADER;
445
+ const data = state.flatTreeData.filter((item) => {
446
+ const title2 = isCASCADER ? item == null ? void 0 : item.title : item[fieldNameLabel];
447
+ return title2.includes(str);
530
448
  });
531
449
  setState({
532
450
  treeData: !str ? state.originalTreeData : data
533
451
  });
534
452
  }
535
- }, {
453
+ },
454
+ {
536
455
  wait: 0
537
- }),
538
- onSearch = _useDebounceFn.run;
539
- var handleSetSearchStr = function handleSetSearchStr(str) {
456
+ }
457
+ );
458
+ const handleSetSearchStr = (str) => {
540
459
  setState({
541
460
  searchStr: str
542
461
  });
543
462
  onSearch(str);
544
463
  };
545
- /**
546
- * 指定模式下的操作
547
- * @param appoint
548
- */
549
- var appointChange = function appointChange(appoint) {
550
- if (appoint) {
551
- onChange === null || onChange === void 0 ? void 0 : onChange(allValue);
464
+ const appointChange = (appoint2) => {
465
+ if (appoint2) {
466
+ onChange == null ? void 0 : onChange(allValue);
552
467
  setState({
553
468
  checkAll: true
554
469
  });
555
470
  } else {
556
- onChange === null || onChange === void 0 ? void 0 : onChange([]);
471
+ onChange == null ? void 0 : onChange([]);
557
472
  setState({
558
473
  checkAll: false,
559
474
  open: true
560
475
  });
561
- if (appoint) {
562
- openChange === null || openChange === void 0 ? void 0 : openChange(true);
476
+ if (appoint2) {
477
+ openChange == null ? void 0 : openChange(true);
563
478
  }
564
479
  }
565
480
  };
566
- /**
567
- * Trigger the container opened by Drawer
568
- * default example and you can customize trigger={<Button>打开</Button>}
569
- * @returns
570
- */
571
- var TriggerComponent = (0, _react.useMemo)(function () {
572
- var _props$otherProps3;
573
- if (trigger && /*#__PURE__*/_react.default.isValidElement(trigger)) {
574
- return (0, _jsxRuntime.jsx)("div", {
575
- onClick: handleClick,
576
- children: trigger
577
- });
481
+ const TriggerComponent = (0, import_react.useMemo)(() => {
482
+ var _a2;
483
+ if (trigger && import_react.default.isValidElement(trigger)) {
484
+ return /* @__PURE__ */ import_react.default.createElement("div", { onClick: handleClick }, trigger);
578
485
  }
579
- return (0, _jsxRuntime.jsx)(_components.Trigger, {
580
- checkedValues: state.checkedValues,
581
- value: value,
582
- checkAll: state.checkAll,
583
- triggerStyle: style,
584
- disabled: disabled,
585
- isView: isView,
586
- appoint: appoint,
587
- allValue: allValue,
588
- label: props === null || props === void 0 ? void 0 : (_props$otherProps3 = props.otherProps) === null || _props$otherProps3 === void 0 ? void 0 : _props$otherProps3.label,
589
- handleClick: handleClick,
590
- handleClearAll: handleClearAll,
591
- appointChange: appointChange,
592
- appointProps: appointProps
593
- });
486
+ return /* @__PURE__ */ import_react.default.createElement(
487
+ import_components.Trigger,
488
+ {
489
+ checkedValues: state.checkedValues,
490
+ value,
491
+ checkAll: state.checkAll,
492
+ triggerStyle: style,
493
+ disabled,
494
+ isView,
495
+ appoint,
496
+ allValue,
497
+ label: (_a2 = props == null ? void 0 : props.otherProps) == null ? void 0 : _a2.label,
498
+ handleClick,
499
+ handleClearAll,
500
+ appointChange,
501
+ appointProps
502
+ }
503
+ );
594
504
  }, [state.checkedValues, state.checkAll, style, disabled, isView, value]);
595
- /**
596
- * 全选操作
597
- */
598
- var handleAllCheck = function handleAllCheck(e) {
599
- var checked = e.target.checked;
600
- var checkedValues = [];
601
- var treeViewData = [];
505
+ const handleAllCheck = (e) => {
506
+ var _a2, _b2;
507
+ const { checked } = e.target;
508
+ let checkedValues = [];
509
+ let treeViewData = [];
602
510
  if (modeType === LIST || modeType === CASCADER) {
603
511
  if (checked) {
604
- checkedValues = state.flatTreeData.map(function (item) {
605
- return item[fieldNameValue];
606
- });
512
+ checkedValues = state.flatTreeData.map((item) => item[fieldNameValue]);
607
513
  } else if (!checked && span) {
608
- // ProTable 场景下 disabled 不取消掉
609
- checkedValues = state.flatTreeData.filter(function (item) {
610
- return item.disabled;
611
- }).map(function (item) {
612
- return item[fieldNameValue];
613
- });
514
+ checkedValues = state.flatTreeData.filter((item) => item.disabled).map((item) => item[fieldNameValue]);
614
515
  } else if (!checked) {
615
516
  checkedValues = [];
616
517
  }
617
518
  } else if (modeType === TREE) {
618
519
  checkedValues = checked ? state.allKeys : [];
619
520
  if (checkStrictly) {
620
- treeViewData = (0, _toConsumableArray2.default)(state.flatTreeData);
521
+ treeViewData = [...state.flatTreeData];
621
522
  } else {
622
- treeViewData = (0, _utils.filterCheckedNodes)(state.originalTreeData, checkedValues, '', fieldNames);
523
+ treeViewData = (0, import_utils.filterCheckedNodes)(state.originalTreeData, checkedValues, "", fieldNames);
623
524
  }
624
525
  }
625
526
  if (max && checkedValues.length > max) {
626
- var _locale$ProTreeModal6;
627
- _antd.message.error(maxMessage ? (0, _utils.transformMessage)({
628
- max: max
629
- }, maxMessage) : (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal6 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal6 === void 0 ? void 0 : _locale$ProTreeModal6.selectMax, {
630
- max: max
631
- }));
527
+ import_antd.message.error(
528
+ maxMessage ? (0, import_utils.transformMessage)({ max }, maxMessage) : (0, import_locale.formatMessage)((_b2 = (_a2 = import_locale.default) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.selectMax, { max })
529
+ );
632
530
  return;
633
531
  }
634
532
  setState({
635
- checkedValues: checkedValues,
533
+ checkedValues,
636
534
  checkAll: checked,
637
- treeViewData: treeViewData
535
+ treeViewData
638
536
  });
639
537
  };
640
- /**
641
- * 左侧容器、分为三种 list、tree、Cascader
642
- * @returns
643
- */
644
- var renderContainer = function renderContainer() {
538
+ const renderContainer = () => {
539
+ var _a2, _b2;
645
540
  if (state.treeData.length === 0 && state.searchStr) {
646
- var _locale$ProTreeModal7;
647
- return (0, _jsxRuntime.jsx)("div", {
648
- className: "pro-tree-modal-no-checks",
649
- children: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal7 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal7 === void 0 ? void 0 : _locale$ProTreeModal7.noFinal
650
- });
541
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-tree-modal-no-checks" }, (_b2 = (_a2 = import_locale.default) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.noFinal);
651
542
  }
652
543
  switch (modeType) {
653
544
  case LIST:
654
- return (0, _jsxRuntime.jsx)(_components.ListView, {
655
- treeData: state.treeData,
656
- optionRender: optionRender,
657
- checkedValues: state.checkedValues,
658
- handleOnChange: handleListCheckChange,
659
- searchStr: state.searchStr,
660
- showCodeName: showCodeName,
661
- disabled: disabled || isView,
662
- fieldNames: fieldNames,
663
- span: span
664
- });
665
- case TREE:
666
- return (0, _jsxRuntime.jsx)(_components.TreeView, {
667
- treeData: state.transformedTree,
668
- originalTreeData: state.originalTreeData,
669
- flatTreeData: state.flatTreeData,
670
- checkedValues: state.checkedValues,
671
- onCheck: onCheck,
672
- optionRender: optionRender,
673
- searchStr: state.searchStr,
674
- showCodeName: showCodeName,
675
- disabled: disabled || isView,
676
- checkStrictly: checkStrictly,
677
- tags: tags,
678
- fieldNames: fieldNames
679
- });
680
- case CASCADER:
681
- if (state.searchStr && state.treeData.length) {
682
- return (0, _jsxRuntime.jsx)(_components.ListView, {
545
+ return /* @__PURE__ */ import_react.default.createElement(
546
+ import_components.ListView,
547
+ {
683
548
  treeData: state.treeData,
684
- modeType: CASCADER,
685
- optionRender: optionRender,
549
+ optionRender,
686
550
  checkedValues: state.checkedValues,
687
551
  handleOnChange: handleListCheckChange,
688
552
  searchStr: state.searchStr,
689
- showCodeName: showCodeName,
553
+ showCodeName,
690
554
  disabled: disabled || isView,
691
- fieldNames: fieldNames
692
- });
555
+ fieldNames,
556
+ span
557
+ }
558
+ );
559
+ case TREE:
560
+ return /* @__PURE__ */ import_react.default.createElement(
561
+ import_components.TreeView,
562
+ {
563
+ treeData: state.transformedTree,
564
+ originalTreeData: state.originalTreeData,
565
+ flatTreeData: state.flatTreeData,
566
+ checkedValues: state.checkedValues,
567
+ onCheck,
568
+ optionRender,
569
+ searchStr: state.searchStr,
570
+ showCodeName,
571
+ disabled: disabled || isView,
572
+ checkStrictly,
573
+ tags,
574
+ fieldNames
575
+ }
576
+ );
577
+ case CASCADER:
578
+ if (state.searchStr && state.treeData.length) {
579
+ return /* @__PURE__ */ import_react.default.createElement(
580
+ import_components.ListView,
581
+ {
582
+ treeData: state.treeData,
583
+ modeType: CASCADER,
584
+ optionRender,
585
+ checkedValues: state.checkedValues,
586
+ handleOnChange: handleListCheckChange,
587
+ searchStr: state.searchStr,
588
+ showCodeName,
589
+ disabled: disabled || isView,
590
+ fieldNames
591
+ }
592
+ );
693
593
  }
694
- return (0, _jsxRuntime.jsx)(_components.Cascader, {
695
- dataSource: state.treeData,
696
- fieldNames: fieldNames,
697
- checkedValues: state.checkedValues,
698
- searchStr: state.searchStr,
699
- showCodeName: showCodeName,
700
- handleOnChange: handleListCheckChange,
701
- optionRender: optionRender
702
- });
594
+ return /* @__PURE__ */ import_react.default.createElement(
595
+ import_components.Cascader,
596
+ {
597
+ dataSource: state.treeData,
598
+ fieldNames,
599
+ checkedValues: state.checkedValues,
600
+ searchStr: state.searchStr,
601
+ showCodeName,
602
+ handleOnChange: handleListCheckChange,
603
+ optionRender
604
+ }
605
+ );
703
606
  default:
704
607
  break;
705
608
  }
706
609
  };
707
- var listTreeData = (0, _react.useMemo)(function () {
708
- var checkListOptions = [];
709
- state.checkedValues.forEach(function (key) {
710
- var option = state.flatTreeData.find(function (item) {
711
- return item[fieldNameValue] === key;
712
- });
610
+ const listTreeData = (0, import_react.useMemo)(() => {
611
+ const checkListOptions = [];
612
+ state.checkedValues.forEach((key) => {
613
+ const option = state.flatTreeData.find((item) => item[fieldNameValue] === key);
713
614
  if (option) {
714
615
  checkListOptions.push(option);
715
616
  }
716
617
  });
717
618
  return checkListOptions;
718
619
  }, [state.checkedValues, state.flatTreeData]);
719
- /**
720
- * 勾选后的右侧展示
721
- * @returns
722
- */
723
- var renderView = function renderView() {
620
+ const renderView = () => {
621
+ var _a2, _b2;
724
622
  if (state.checkedValues.length === 0) {
725
- var _locale$ProTreeModal8;
726
- return (0, _jsxRuntime.jsx)("div", {
727
- className: "pro-tree-modal-no-checks",
728
- children: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal8 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal8 === void 0 ? void 0 : _locale$ProTreeModal8.noCheck
729
- });
623
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-tree-modal-no-checks" }, (_b2 = (_a2 = import_locale.default) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.noCheck);
730
624
  }
731
625
  switch (modeType) {
732
626
  case LIST:
733
627
  case CASCADER:
734
- return (0, _jsxRuntime.jsx)(_components.ListView, {
735
- mode: "view",
736
- showCodeName: showCodeName,
737
- treeData: listTreeData,
738
- fieldNames: fieldNames,
739
- disabled: disabled || isView,
740
- draggable: draggable,
741
- flatTreeData: state.flatTreeData,
742
- span: span,
743
- ref: listRef,
744
- optionRender: optionRender,
745
- handleFilterClose: handleFilterClose,
746
- handleDragEndChange: handleDragEndChange
747
- });
628
+ return /* @__PURE__ */ import_react.default.createElement(
629
+ import_components.ListView,
630
+ {
631
+ mode: "view",
632
+ showCodeName,
633
+ treeData: listTreeData,
634
+ fieldNames,
635
+ disabled: disabled || isView,
636
+ draggable,
637
+ flatTreeData: state.flatTreeData,
638
+ span,
639
+ ref: listRef,
640
+ optionRender,
641
+ handleFilterClose,
642
+ handleDragEndChange
643
+ }
644
+ );
748
645
  case TREE:
749
- return (0, _jsxRuntime.jsx)(_components.TreeView, {
750
- mode: "view",
751
- checkStrictly: checkStrictly,
752
- showCodeName: showCodeName,
753
- treeData: checkStrictly ? listTreeData : state.treeViewData,
754
- tags: tags,
755
- fieldNames: fieldNames,
756
- disabled: disabled || isView,
757
- draggable: draggable,
758
- min: min,
759
- max: max,
760
- ref: listRef,
761
- handleFilterClose: treeFilterClose,
762
- optionRender: optionRender,
763
- handleDragEndChange: handleDragEndChange
764
- });
646
+ return /* @__PURE__ */ import_react.default.createElement(
647
+ import_components.TreeView,
648
+ {
649
+ mode: "view",
650
+ checkStrictly,
651
+ showCodeName,
652
+ treeData: checkStrictly ? listTreeData : state.treeViewData,
653
+ tags,
654
+ fieldNames,
655
+ disabled: disabled || isView,
656
+ draggable,
657
+ min,
658
+ max,
659
+ ref: listRef,
660
+ handleFilterClose: treeFilterClose,
661
+ optionRender,
662
+ handleDragEndChange
663
+ }
664
+ );
765
665
  default:
766
666
  break;
767
667
  }
768
668
  };
769
- return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
770
- children: (0, _jsxRuntime.jsxs)("div", {
771
- className: "pro-tree-modal",
772
- children: [open === undefined && TriggerComponent, (0, _jsxRuntime.jsx)(_index.ProDrawerForm, {
773
- onOk: handleFinish,
774
- onCancel: handleClose,
775
- okDisabled: disabled,
776
- open: state.open,
777
- title: title,
778
- showType: "Modal",
779
- className: "pro-tree-modal-container",
780
- extraLeft: allValue !== undefined ? (0, _jsxRuntime.jsx)(_antd.Checkbox, {
781
- checked: state.checkAll,
782
- disabled: disabled,
783
- onChange: handleAllCheck,
784
- children: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal9 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal9 === void 0 ? void 0 : _locale$ProTreeModal9.checkAll
785
- }) : null,
786
- children: (0, _jsxRuntime.jsxs)("div", {
787
- className: "pro-tree-modal-content",
788
- children: [(0, _jsxRuntime.jsxs)("div", {
789
- className: (0, _classnames.default)('pro-tree-modal-box', modeType === CASCADER || modeType === LIST && span ? 'pro-tree-modal-cascader-box' : ''),
790
- children: [(0, _jsxRuntime.jsx)(_antd.Input, {
791
- disabled: disabled,
792
- allowClear: true,
793
- value: state.searchStr,
794
- placeholder: placeholder || (_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal0 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal0 === void 0 ? void 0 : _locale$ProTreeModal0.input),
795
- className: "pro-tree-modal-search",
796
- onChange: function onChange(e) {
797
- return handleSetSearchStr(e.target.value);
798
- },
799
- prefix: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
800
- className: "pro-tree-modal-search-svg",
801
- src: _inputSearch.default
802
- })
803
- }), (0, _jsxRuntime.jsx)("div", {
804
- className: "pro-tree-modal-tree-warp",
805
- children: renderContainer()
806
- })]
807
- }), (0, _jsxRuntime.jsxs)("div", {
808
- className: (0, _classnames.default)('pro-tree-modal-box', modeType === CASCADER || modeType === LIST && span ? 'pro-tree-modal-cascader-box-view' : ''),
809
- children: [(0, _jsxRuntime.jsxs)("div", {
810
- className: "pro-tree-modal-box-header",
811
- children: [(0, _jsxRuntime.jsxs)("span", {
812
- children: [_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal1 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal1 === void 0 ? void 0 : _locale$ProTreeModal1.check, " (", state.checkedValues.length, "/", max || state.flatTreeData.length, ")"]
813
- }), (0, _jsxRuntime.jsx)(_antd.Button, {
814
- disabled: disabled,
815
- type: "link",
816
- onClick: handleClearAll,
817
- children: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal10 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal10 === void 0 ? void 0 : _locale$ProTreeModal10.clearAll
818
- })]
819
- }), (0, _jsxRuntime.jsx)("div", {
820
- className: "pro-tree-modal-tree-warp pro-transfer-right",
821
- children: renderView()
822
- })]
823
- })]
824
- })
825
- })]
826
- })
827
- });
669
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-tree-modal" }, open === void 0 && TriggerComponent, /* @__PURE__ */ import_react.default.createElement(
670
+ import__.ProDrawerForm,
671
+ {
672
+ onOk: handleFinish,
673
+ onCancel: handleClose,
674
+ okDisabled: disabled,
675
+ open: state.open,
676
+ title,
677
+ showType: "Modal",
678
+ className: "pro-tree-modal-container",
679
+ extraLeft: allValue !== void 0 ? /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, { checked: state.checkAll, disabled, onChange: handleAllCheck }, (_f = (_e = import_locale.default) == null ? void 0 : _e.ProTreeModal) == null ? void 0 : _f.checkAll) : null
680
+ },
681
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-tree-modal-content" }, /* @__PURE__ */ import_react.default.createElement(
682
+ "div",
683
+ {
684
+ className: (0, import_classnames.default)(
685
+ "pro-tree-modal-box",
686
+ modeType === CASCADER || modeType === LIST && span ? "pro-tree-modal-cascader-box" : ""
687
+ )
688
+ },
689
+ /* @__PURE__ */ import_react.default.createElement(
690
+ import_antd.Input,
691
+ {
692
+ disabled,
693
+ allowClear: true,
694
+ value: state.searchStr,
695
+ placeholder: placeholder || ((_h = (_g = import_locale.default) == null ? void 0 : _g.ProTreeModal) == null ? void 0 : _h.input),
696
+ className: "pro-tree-modal-search",
697
+ onChange: (e) => handleSetSearchStr(e.target.value),
698
+ prefix: /* @__PURE__ */ import_react.default.createElement(import_react_svg.ReactSVG, { className: "pro-tree-modal-search-svg", src: import_input_search.default })
699
+ }
700
+ ),
701
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-tree-modal-tree-warp" }, renderContainer())
702
+ ), /* @__PURE__ */ import_react.default.createElement(
703
+ "div",
704
+ {
705
+ className: (0, import_classnames.default)(
706
+ "pro-tree-modal-box",
707
+ modeType === CASCADER || modeType === LIST && span ? "pro-tree-modal-cascader-box-view" : ""
708
+ )
709
+ },
710
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-tree-modal-box-header" }, /* @__PURE__ */ import_react.default.createElement("span", null, (_j = (_i = import_locale.default) == null ? void 0 : _i.ProTreeModal) == null ? void 0 : _j.check, " (", state.checkedValues.length, "/", max || state.flatTreeData.length, ")"), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { disabled, type: "link", onClick: handleClearAll }, (_l = (_k = import_locale.default) == null ? void 0 : _k.ProTreeModal) == null ? void 0 : _l.clearAll)),
711
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-tree-modal-tree-warp pro-transfer-right" }, renderView())
712
+ ))
713
+ )));
828
714
  };
829
- var _default = exports.default = ProTreeModal;
715
+ var ProTreeModal_default = ProTreeModal;
716
+ // Annotate the CommonJS export names for ESM import in node:
717
+ 0 && (module.exports = {
718
+ CASCADER
719
+ });