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

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 (603) hide show
  1. package/babel.config.js +7 -30
  2. package/dist/esm/index.d.ts +5 -0
  3. package/dist/esm/index.js +5 -0
  4. package/dist/esm/regExp/index.d.ts +19 -0
  5. package/dist/esm/regExp/index.js +73 -0
  6. package/dist/esm/tools/calc/index.d.ts +4 -0
  7. package/dist/esm/tools/calc/index.js +67 -0
  8. package/dist/esm/tools/dateUtils.d.ts +7 -0
  9. package/dist/esm/tools/dateUtils.js +23 -0
  10. package/dist/esm/tools/disableDate/index.d.ts +9 -0
  11. package/dist/esm/tools/disableDate/index.js +43 -0
  12. package/dist/esm/tools/disableTimeRange/index.d.ts +9 -0
  13. package/dist/esm/tools/disableTimeRange/index.js +121 -0
  14. package/dist/esm/tools/formatAmount/index.d.ts +7 -0
  15. package/dist/esm/tools/formatAmount/index.js +14 -0
  16. package/dist/esm/tools/formatPerMill/index.d.ts +7 -0
  17. package/dist/esm/tools/formatPerMill/index.js +11 -0
  18. package/dist/esm/tools/formatPercent/index.d.ts +7 -0
  19. package/dist/esm/tools/formatPercent/index.js +11 -0
  20. package/dist/esm/tools/getDataByIdCard/index.d.ts +16 -0
  21. package/dist/esm/tools/getDataByIdCard/index.js +65 -0
  22. package/dist/esm/tools/index.d.ts +12 -0
  23. package/dist/esm/tools/index.js +14 -0
  24. package/dist/esm/tools/sumAmount/index.d.ts +16 -0
  25. package/dist/esm/tools/sumAmount/index.js +40 -0
  26. package/dist/esm/tools/toChineseNum/index.d.ts +7 -0
  27. package/dist/esm/tools/toChineseNum/index.js +103 -0
  28. package/dist/esm/tools/toFixed/index.d.ts +2 -0
  29. package/dist/esm/tools/toFixed/index.js +5 -0
  30. package/dist/esm/tools/transformDataName/index.d.ts +12 -0
  31. package/dist/esm/tools/transformDataName/index.js +37 -0
  32. package/dist/esm/transforms/dateTransformer/index.d.ts +24 -0
  33. package/dist/esm/transforms/dateTransformer/index.js +67 -0
  34. package/dist/esm/transforms/index.d.ts +6 -0
  35. package/dist/esm/transforms/index.js +6 -0
  36. package/dist/esm/transforms/propTypes.d.ts +7 -0
  37. package/dist/esm/transforms/propTypes.js +1 -0
  38. package/dist/esm/transforms/transformDate/index.d.ts +21 -0
  39. package/dist/esm/transforms/transformDate/index.js +141 -0
  40. package/dist/esm/transforms/transformDatePicker/index.d.ts +12 -0
  41. package/dist/esm/transforms/transformDatePicker/index.js +24 -0
  42. package/dist/esm/transforms/transformRangePicker/index.d.ts +29 -0
  43. package/dist/esm/transforms/transformRangePicker/index.js +61 -0
  44. package/dist/esm/transforms/transformSwitch/index.d.ts +13 -0
  45. package/dist/esm/transforms/transformSwitch/index.js +35 -0
  46. package/dist/esm/transforms/utils.d.ts +2 -0
  47. package/dist/esm/transforms/utils.js +8 -0
  48. package/dist/esm/validate/index.d.ts +107 -0
  49. package/dist/esm/validate/index.js +284 -0
  50. package/es/FormsProvider/index.js +4 -2
  51. package/es/ProAction/components/CheckModalContent/index.js +9 -8
  52. package/es/ProAction/index.js +77 -75
  53. package/es/ProAction/index.less +0 -2
  54. package/es/ProConfigProvider/index.d.ts +1 -0
  55. package/es/ProConfigProvider/index.js +20 -16
  56. package/es/ProDownload/index.js +89 -94
  57. package/es/ProDownload/style/index.less +0 -2
  58. package/es/ProDownload/utils.js +59 -50
  59. package/es/ProDrawerForm/components/ProDrawer/index.js +79 -72
  60. package/es/ProDrawerForm/components/ProModal/index.js +62 -60
  61. package/es/ProDrawerForm/components/index.js +2 -2
  62. package/es/ProDrawerForm/index.js +43 -37
  63. package/es/ProDrawerForm/style/index.less +0 -2
  64. package/es/ProEditLabel/components/RenderProForm.js +25 -21
  65. package/es/ProEditLabel/index.js +54 -46
  66. package/es/ProEditLabel/style/index.less +0 -2
  67. package/es/ProEditTable/components/ActionButton/index.js +31 -23
  68. package/es/ProEditTable/components/RcTable/BaseTable.js +16 -15
  69. package/es/ProEditTable/components/RcTable/DraggableTable.js +20 -19
  70. package/es/ProEditTable/components/RcTable/index.js +2 -2
  71. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +41 -19
  72. package/es/ProEditTable/components/RenderField/index.js +176 -145
  73. package/es/ProEditTable/components/RenderToolbar/index.js +26 -24
  74. package/es/ProEditTable/components/Summary/index.js +13 -11
  75. package/es/ProEditTable/components/Validator/index.js +6 -5
  76. package/es/ProEditTable/components/index.js +5 -5
  77. package/es/ProEditTable/index.d.ts +1 -1
  78. package/es/ProEditTable/index.js +96 -80
  79. package/es/ProEditTable/propsType.d.ts +1 -1
  80. package/es/ProEditTable/style/index.less +2 -4
  81. package/es/ProEditTable/utils/config.js +44 -37
  82. package/es/ProEditTable/utils/diffOriginal.d.ts +1 -0
  83. package/es/ProEditTable/utils/diffOriginal.js +76 -7
  84. package/es/ProEditTable/utils/getDefaultProps.js +8 -8
  85. package/es/ProEditTable/utils/index.js +86 -73
  86. package/es/ProEditTable/utils/tools.js +166 -157
  87. package/es/ProEditTable/utils/useEditTableError.js +17 -6
  88. package/es/ProEnum/components/Group.js +6 -6
  89. package/es/ProEnum/components/Tag.js +8 -6
  90. package/es/ProEnum/hooks/useEnum.js +31 -4
  91. package/es/ProEnum/hooks/useEnumRequest.js +59 -54
  92. package/es/ProEnum/index.js +48 -49
  93. package/es/ProEnum/style/index.less +0 -2
  94. package/es/ProEnum/utils/eventCenter.js +6 -4
  95. package/es/ProEnum/utils/getEnumLabel.js +9 -10
  96. package/es/ProEnum/utils/index.js +10 -5
  97. package/es/ProForm/components/Container.js +7 -5
  98. package/es/ProForm/components/FormFooter/index.js +16 -14
  99. package/es/ProForm/components/base/Checkbox/index.js +11 -8
  100. package/es/ProForm/components/base/DatePicker/index.js +33 -46
  101. package/es/ProForm/components/base/Input/index.js +17 -15
  102. package/es/ProForm/components/base/InputNumber/index.js +42 -38
  103. package/es/ProForm/components/base/Radio/index.js +10 -8
  104. package/es/ProForm/components/base/RangePicker/index.js +20 -20
  105. package/es/ProForm/components/base/Select/index.js +12 -10
  106. package/es/ProForm/components/base/Switch/index.js +12 -11
  107. package/es/ProForm/components/base/SwitchCheckbox/index.js +15 -14
  108. package/es/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
  109. package/es/ProForm/components/base/TextArea/index.js +12 -11
  110. package/es/ProForm/components/base/TextArea/index.less +0 -2
  111. package/es/ProForm/components/base/TimePicker/index.js +7 -6
  112. package/es/ProForm/components/base/TimePicker/style/index.less +0 -2
  113. package/es/ProForm/components/combination/Container/index.js +14 -12
  114. package/es/ProForm/components/combination/Container/style/index.less +0 -2
  115. package/es/ProForm/components/combination/FormList/components/ActionButton.js +45 -42
  116. package/es/ProForm/components/combination/FormList/components/BlockFields.js +14 -13
  117. package/es/ProForm/components/combination/FormList/components/BlockTitle.js +6 -6
  118. package/es/ProForm/components/combination/FormList/components/Empty.js +30 -27
  119. package/es/ProForm/components/combination/FormList/components/LineFields.js +12 -11
  120. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +31 -29
  121. package/es/ProForm/components/combination/FormList/index.js +22 -21
  122. package/es/ProForm/components/combination/FormList/style/index.less +0 -2
  123. package/es/ProForm/components/combination/FormList/utils.js +5 -3
  124. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +7 -5
  125. package/es/ProForm/components/combination/Group/component/ComRender.js +27 -22
  126. package/es/ProForm/components/combination/Group/hooks/index.js +35 -19
  127. package/es/ProForm/components/combination/Group/index.d.ts +8 -2
  128. package/es/ProForm/components/combination/Group/index.js +27 -32
  129. package/es/ProForm/components/combination/Group/utils.js +22 -14
  130. package/es/ProForm/components/combination/ProCascader/index.js +144 -88
  131. package/es/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
  132. package/es/ProForm/components/combination/ProCascader/style/index.less +1 -3
  133. package/es/ProForm/components/combination/ProCascader/utils/index.js +3 -3
  134. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +24 -18
  135. package/es/ProForm/components/combination/ProModalSelect/index.js +185 -193
  136. package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
  137. package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
  138. package/es/ProForm/components/combination/ProNumberRange/index.js +23 -20
  139. package/es/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
  140. package/es/ProForm/components/combination/ProRangeLimit/index.js +33 -29
  141. package/es/ProForm/components/combination/ProTimeLimit/index.js +34 -28
  142. package/es/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
  143. package/es/ProForm/components/index.d.ts +2 -0
  144. package/es/ProForm/components/index.js +31 -27
  145. package/es/ProForm/components/render/ChangedWrapper.js +21 -15
  146. package/es/ProForm/components/render/ConfirmWrapper.js +35 -35
  147. package/es/ProForm/components/render/Render.js +109 -75
  148. package/es/ProForm/components/render/RenderFields.d.ts +1 -0
  149. package/es/ProForm/components/render/RenderFields.js +46 -29
  150. package/es/ProForm/components/render/propsType.d.ts +1 -0
  151. package/es/ProForm/components/render/propsType.js +25 -0
  152. package/es/ProForm/index.d.ts +2 -2
  153. package/es/ProForm/index.js +58 -38
  154. package/es/ProForm/propsType.d.ts +3 -1
  155. package/es/ProForm/propsType.js +5 -1
  156. package/es/ProForm/style/index.less +0 -2
  157. package/es/ProForm/utils/diffOriginal.d.ts +1 -0
  158. package/es/ProForm/utils/diffOriginal.js +75 -8
  159. package/es/ProForm/utils/getDefaultProps.js +7 -7
  160. package/es/ProForm/utils/index.js +64 -39
  161. package/es/ProForm/utils/processDependencies.js +11 -0
  162. package/es/ProForm/utils/rulesCreator.js +12 -13
  163. package/es/ProForm/utils/transformNames.js +5 -4
  164. package/es/ProForm/utils/transformValue.js +11 -6
  165. package/es/ProForm/utils/useDeepCompareMemo.js +6 -4
  166. package/es/ProForm/utils/useForm.js +71 -71
  167. package/es/ProForm/utils/useRules.js +11 -9
  168. package/es/ProForm/utils/useShouldUpdate.d.ts +1 -0
  169. package/es/ProForm/utils/useShouldUpdate.js +117 -29
  170. package/es/ProForm/utils/useWatch.js +25 -3
  171. package/es/ProForm/utils/valueType.js +14 -11
  172. package/es/ProIcon/config/index.js +2 -0
  173. package/es/ProIcon/index.js +33 -23
  174. package/es/ProIcon/style/index.less +0 -2
  175. package/es/ProIcon/utils/index.js +4 -5
  176. package/es/ProLayout/components/Layout/Header/index.js +12 -10
  177. package/es/ProLayout/components/Layout/Icon/Icon.js +3 -3
  178. package/es/ProLayout/components/Layout/Icon/index.js +1 -1
  179. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +82 -25
  180. package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
  181. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +54 -27
  182. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +10 -7
  183. package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
  184. package/es/ProLayout/components/Layout/Menu/index.js +16 -11
  185. package/es/ProLayout/components/Layout/Menu/style/index.less +0 -2
  186. package/es/ProLayout/components/Layout/Notice/index.js +9 -8
  187. package/es/ProLayout/components/Layout/Notice/style/index.less +0 -2
  188. package/es/ProLayout/components/Layout/index.js +4 -4
  189. package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
  190. package/es/ProLayout/components/ProCollapse/index.js +44 -16
  191. package/es/ProLayout/components/ProCollapse/style/index.less +148 -4
  192. package/es/ProLayout/components/ProFooter/index.js +3 -3
  193. package/es/ProLayout/components/ProFooter/style/index.less +0 -2
  194. package/es/ProLayout/components/ProHeader/components/Copy/index.js +6 -6
  195. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +5 -4
  196. package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
  197. package/es/ProLayout/components/ProHeader/components/index.js +2 -2
  198. package/es/ProLayout/components/ProHeader/index.js +87 -75
  199. package/es/ProLayout/components/ProHeader/style/index.less +0 -2
  200. package/es/ProLayout/components/index.js +3 -3
  201. package/es/ProLayout/index.d.ts +1 -12
  202. package/es/ProLayout/index.js +73 -41
  203. package/es/ProLayout/propTypes.d.ts +9 -0
  204. package/es/ProLayout/style/index.less +0 -2
  205. package/es/ProLayout/utils/index.d.ts +7 -0
  206. package/es/ProLayout/utils/index.js +51 -18
  207. package/es/ProSelect/components/AdaptiveTooltip.js +5 -4
  208. package/es/ProSelect/index.js +44 -43
  209. package/es/ProSelect/index.less +0 -2
  210. package/es/ProSelect/utils/index.js +67 -5
  211. package/es/ProStep/components/Anchor/index.d.ts +1 -0
  212. package/es/ProStep/components/Anchor/index.js +19 -18
  213. package/es/ProStep/components/Item/index.d.ts +1 -0
  214. package/es/ProStep/components/Item/index.js +15 -12
  215. package/es/ProStep/components/Listener/index.js +18 -16
  216. package/es/ProStep/components/Step/index.js +15 -14
  217. package/es/ProStep/index.js +74 -62
  218. package/es/ProStep/style/index.less +0 -2
  219. package/es/ProStep/utils/index.js +6 -5
  220. package/es/ProStepTab/index.js +111 -77
  221. package/es/ProTable/components/FormatColumn/index.js +69 -66
  222. package/es/ProTable/components/RcTable/components/BaseTable/index.js +3 -3
  223. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +40 -36
  224. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +10 -9
  225. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +5 -5
  226. package/es/ProTable/components/RcTable/index.js +2 -2
  227. package/es/ProTable/components/RenderColumn/index.js +30 -26
  228. package/es/ProTable/components/RenderEmptyText/index.js +7 -6
  229. package/es/ProTable/components/RenderFooter/index.js +2 -2
  230. package/es/ProTable/components/RenderSummary/index.js +11 -10
  231. package/es/ProTable/components/RenderTableHeader/index.js +15 -13
  232. package/es/ProTable/components/RenderTabs/index.js +7 -6
  233. package/es/ProTable/components/TableResizable/index.js +9 -8
  234. package/es/ProTable/components/TooltipTitle/index.js +6 -5
  235. package/es/ProTable/components/index.js +11 -6
  236. package/es/ProTable/hooks/useAntdTable.d.ts +3 -0
  237. package/es/ProTable/hooks/useAntdTable.js +133 -98
  238. package/es/ProTable/index.d.ts +3 -7
  239. package/es/ProTable/index.js +83 -77
  240. package/es/ProTable/propsType.d.ts +3 -2
  241. package/es/ProTable/style/index.less +4 -6
  242. package/es/ProTable/utils/index.js +12 -5
  243. package/es/ProTabs/components/Card/index.js +12 -11
  244. package/es/ProTabs/components/index.js +1 -1
  245. package/es/ProTabs/index.js +9 -8
  246. package/es/ProTabs/style/index.less +0 -2
  247. package/es/ProThemeTools/component/ProTools/index.js +42 -41
  248. package/es/ProThemeTools/component/index.js +1 -1
  249. package/es/ProThemeTools/context/ThemeContext.js +18 -2
  250. package/es/ProThemeTools/index.d.ts +0 -7
  251. package/es/ProThemeTools/index.js +50 -26
  252. package/es/ProThemeTools/style/index.less +0 -2
  253. package/es/ProThemeTools/utils/index.js +9 -0
  254. package/es/ProTooltip/index.js +24 -22
  255. package/es/ProTooltip/style/index.less +0 -2
  256. package/es/ProTree/components/AdaptiveTooltip.js +4 -4
  257. package/es/ProTree/components/CloseIcon.js +5 -5
  258. package/es/ProTree/components/List.js +15 -13
  259. package/es/ProTree/components/ProTree.js +62 -56
  260. package/es/ProTree/components/ProTreeSelect/index.js +88 -73
  261. package/es/ProTree/components/ProTreeSelect/style/index.less +0 -2
  262. package/es/ProTree/components/SearchTitle.js +10 -9
  263. package/es/ProTree/components/Tree.js +53 -52
  264. package/es/ProTree/components/index.js +4 -4
  265. package/es/ProTree/index.js +4 -4
  266. package/es/ProTree/style/index.less +0 -2
  267. package/es/ProTree/utils.js +21 -14
  268. package/es/ProTreeModal/components/Cascader.js +23 -21
  269. package/es/ProTreeModal/components/CloseIcon.js +5 -5
  270. package/es/ProTreeModal/components/List.js +40 -33
  271. package/es/ProTreeModal/components/SearchTitle.js +5 -4
  272. package/es/ProTreeModal/components/SortableItem.js +10 -8
  273. package/es/ProTreeModal/components/Tree.js +37 -35
  274. package/es/ProTreeModal/components/Trigger.js +23 -22
  275. package/es/ProTreeModal/components/index.js +6 -6
  276. package/es/ProTreeModal/index.js +85 -65
  277. package/es/ProTreeModal/style/index.less +0 -2
  278. package/es/ProTreeModal/utils.js +22 -18
  279. package/es/ProUpload/components/ButtonRender.js +38 -37
  280. package/es/ProUpload/components/DragRender.js +41 -34
  281. package/es/ProUpload/components/DraggableUploadListItem.js +3 -2
  282. package/es/ProUpload/components/Example.js +10 -9
  283. package/es/ProUpload/components/FileItem.js +47 -42
  284. package/es/ProUpload/components/ImageRender.js +85 -85
  285. package/es/ProUpload/index.js +24 -19
  286. package/es/ProUpload/style/index.less +0 -2
  287. package/es/ProUpload/uitls.js +1 -1
  288. package/es/ProViewer/index.js +25 -19
  289. package/es/ProViewer/propsType.js +3 -1
  290. package/es/ProViewer/style/index.less +0 -2
  291. package/es/ProWaterMark/index.js +4 -3
  292. package/es/index.d.ts +1 -1
  293. package/es/index.js +38 -29
  294. package/es/locale/index.js +7 -2
  295. package/es/style/theme/antd.less +0 -2
  296. package/es/tokens.js +1 -0
  297. package/es/utils/index.js +7 -3
  298. package/jest.config.js +46 -4
  299. package/lib/FormsProvider/index.js +53 -29
  300. package/lib/ProAction/components/CheckModalContent/index.js +27 -33
  301. package/lib/ProAction/index.js +155 -198
  302. package/lib/ProAction/index.less +0 -2
  303. package/lib/ProAction/propsType.js +16 -4
  304. package/lib/ProConfigProvider/index.d.ts +1 -0
  305. package/lib/ProConfigProvider/index.js +141 -122
  306. package/lib/ProDownload/index.js +123 -194
  307. package/lib/ProDownload/propsType.js +16 -4
  308. package/lib/ProDownload/style/index.less +0 -2
  309. package/lib/ProDownload/utils.js +145 -179
  310. package/lib/ProDrawerForm/components/ProDrawer/index.js +169 -236
  311. package/lib/ProDrawerForm/components/ProModal/index.js +134 -188
  312. package/lib/ProDrawerForm/components/index.js +39 -17
  313. package/lib/ProDrawerForm/index.js +93 -80
  314. package/lib/ProDrawerForm/propsType.js +16 -4
  315. package/lib/ProDrawerForm/style/index.less +0 -2
  316. package/lib/ProDrawerForm/utils/index.js +31 -13
  317. package/lib/ProEditLabel/components/RenderProForm.js +60 -58
  318. package/lib/ProEditLabel/index.js +182 -237
  319. package/lib/ProEditLabel/propsType.js +16 -4
  320. package/lib/ProEditLabel/style/index.less +0 -2
  321. package/lib/ProEditLabel/utils/index.js +31 -15
  322. package/lib/ProEditTable/components/ActionButton/index.js +172 -153
  323. package/lib/ProEditTable/components/RcTable/BaseTable.js +103 -104
  324. package/lib/ProEditTable/components/RcTable/DraggableTable.js +159 -187
  325. package/lib/ProEditTable/components/RcTable/index.js +39 -17
  326. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +192 -178
  327. package/lib/ProEditTable/components/RenderField/index.js +564 -646
  328. package/lib/ProEditTable/components/RenderToolbar/index.js +105 -125
  329. package/lib/ProEditTable/components/Summary/index.js +61 -67
  330. package/lib/ProEditTable/components/Validator/index.js +48 -27
  331. package/lib/ProEditTable/components/index.js +48 -38
  332. package/lib/ProEditTable/index.d.ts +1 -1
  333. package/lib/ProEditTable/index.js +372 -430
  334. package/lib/ProEditTable/propsType.d.ts +1 -1
  335. package/lib/ProEditTable/propsType.js +16 -4
  336. package/lib/ProEditTable/style/index.less +2 -4
  337. package/lib/ProEditTable/utils/config.js +180 -235
  338. package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -0
  339. package/lib/ProEditTable/utils/diffOriginal.js +106 -50
  340. package/lib/ProEditTable/utils/getDefaultProps.js +44 -29
  341. package/lib/ProEditTable/utils/index.js +255 -325
  342. package/lib/ProEditTable/utils/tools.js +252 -436
  343. package/lib/ProEditTable/utils/transform.js +28 -19
  344. package/lib/ProEditTable/utils/useEditTableError.js +58 -60
  345. package/lib/ProEnum/components/Group.js +78 -54
  346. package/lib/ProEnum/components/Tag.js +55 -40
  347. package/lib/ProEnum/hooks/useEnum.js +56 -53
  348. package/lib/ProEnum/hooks/useEnumRequest.js +198 -268
  349. package/lib/ProEnum/index.js +235 -244
  350. package/lib/ProEnum/propsType.js +16 -4
  351. package/lib/ProEnum/style/index.less +0 -2
  352. package/lib/ProEnum/utils/eventCenter.js +25 -37
  353. package/lib/ProEnum/utils/getEnumLabel.js +65 -63
  354. package/lib/ProEnum/utils/index.js +67 -92
  355. package/lib/ProForm/components/Container.js +45 -32
  356. package/lib/ProForm/components/FormFooter/index.js +82 -64
  357. package/lib/ProForm/components/FormFooter/propsType.js +16 -4
  358. package/lib/ProForm/components/base/Checkbox/index.js +62 -65
  359. package/lib/ProForm/components/base/DatePicker/index.js +77 -78
  360. package/lib/ProForm/components/base/DatePicker/useDateLimit.js +31 -16
  361. package/lib/ProForm/components/base/Input/index.js +73 -61
  362. package/lib/ProForm/components/base/Input/propsType.js +16 -4
  363. package/lib/ProForm/components/base/InputNumber/index.js +177 -225
  364. package/lib/ProForm/components/base/Radio/index.js +69 -59
  365. package/lib/ProForm/components/base/RangePicker/index.js +90 -77
  366. package/lib/ProForm/components/base/RangePicker/useDateRange.js +46 -28
  367. package/lib/ProForm/components/base/Select/index.js +69 -60
  368. package/lib/ProForm/components/base/Switch/index.js +59 -42
  369. package/lib/ProForm/components/base/SwitchCheckbox/index.js +63 -62
  370. package/lib/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
  371. package/lib/ProForm/components/base/TextArea/index.js +67 -52
  372. package/lib/ProForm/components/base/TextArea/index.less +0 -2
  373. package/lib/ProForm/components/base/TimePicker/index.js +59 -43
  374. package/lib/ProForm/components/base/TimePicker/style/index.less +0 -2
  375. package/lib/ProForm/components/combination/Container/index.js +77 -62
  376. package/lib/ProForm/components/combination/Container/propsType.js +16 -4
  377. package/lib/ProForm/components/combination/Container/style/index.less +0 -2
  378. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +195 -247
  379. package/lib/ProForm/components/combination/FormList/components/BlockFields.js +108 -81
  380. package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +44 -25
  381. package/lib/ProForm/components/combination/FormList/components/Empty.js +55 -92
  382. package/lib/ProForm/components/combination/FormList/components/LineFields.js +120 -94
  383. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +103 -136
  384. package/lib/ProForm/components/combination/FormList/index.js +168 -142
  385. package/lib/ProForm/components/combination/FormList/propsType.js +16 -4
  386. package/lib/ProForm/components/combination/FormList/style/index.less +0 -2
  387. package/lib/ProForm/components/combination/FormList/utils.js +54 -33
  388. package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +38 -21
  389. package/lib/ProForm/components/combination/Group/component/ComRender.js +76 -77
  390. package/lib/ProForm/components/combination/Group/hooks/index.js +142 -130
  391. package/lib/ProForm/components/combination/Group/index.d.ts +8 -2
  392. package/lib/ProForm/components/combination/Group/index.js +113 -110
  393. package/lib/ProForm/components/combination/Group/propsType.js +16 -4
  394. package/lib/ProForm/components/combination/Group/utils.js +113 -128
  395. package/lib/ProForm/components/combination/ProCascader/index.js +255 -254
  396. package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
  397. package/lib/ProForm/components/combination/ProCascader/propsType.js +16 -4
  398. package/lib/ProForm/components/combination/ProCascader/style/index.less +1 -3
  399. package/lib/ProForm/components/combination/ProCascader/utils/index.js +35 -24
  400. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +122 -115
  401. package/lib/ProForm/components/combination/ProModalSelect/index.js +494 -689
  402. package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
  403. package/lib/ProForm/components/combination/ProModalSelect/propsType.js +16 -4
  404. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
  405. package/lib/ProForm/components/combination/ProModalSelect/utils/index.js +45 -22
  406. package/lib/ProForm/components/combination/ProNumberRange/index.js +163 -182
  407. package/lib/ProForm/components/combination/ProNumberRange/propsType.js +16 -4
  408. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
  409. package/lib/ProForm/components/combination/ProRangeLimit/index.js +140 -164
  410. package/lib/ProForm/components/combination/ProRangeLimit/propsType.js +16 -4
  411. package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +49 -28
  412. package/lib/ProForm/components/combination/ProTimeLimit/index.js +128 -143
  413. package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
  414. package/lib/ProForm/components/index.d.ts +2 -0
  415. package/lib/ProForm/components/index.js +115 -192
  416. package/lib/ProForm/components/render/ChangedWrapper.js +147 -133
  417. package/lib/ProForm/components/render/ConfirmWrapper.js +78 -122
  418. package/lib/ProForm/components/render/Render.js +356 -419
  419. package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
  420. package/lib/ProForm/components/render/RenderFields.js +188 -188
  421. package/lib/ProForm/components/render/propsType.d.ts +1 -0
  422. package/lib/ProForm/components/render/propsType.js +16 -5
  423. package/lib/ProForm/index.d.ts +2 -2
  424. package/lib/ProForm/index.js +241 -270
  425. package/lib/ProForm/propsType.d.ts +3 -1
  426. package/lib/ProForm/propsType.js +38 -5
  427. package/lib/ProForm/style/index.less +0 -2
  428. package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
  429. package/lib/ProForm/utils/diffOriginal.js +103 -44
  430. package/lib/ProForm/utils/getDefaultProps.js +44 -28
  431. package/lib/ProForm/utils/index.js +270 -321
  432. package/lib/ProForm/utils/processDependencies.js +44 -52
  433. package/lib/ProForm/utils/rulesCreator.js +84 -61
  434. package/lib/ProForm/utils/transformNames.js +38 -27
  435. package/lib/ProForm/utils/transformValue.js +51 -48
  436. package/lib/ProForm/utils/useDeepCompareMemo.js +36 -16
  437. package/lib/ProForm/utils/useFieldProps.js +42 -11
  438. package/lib/ProForm/utils/useForm.js +118 -228
  439. package/lib/ProForm/utils/useRules.js +67 -60
  440. package/lib/ProForm/utils/useShouldUpdate.d.ts +1 -0
  441. package/lib/ProForm/utils/useShouldUpdate.js +153 -176
  442. package/lib/ProForm/utils/useWatch.js +93 -100
  443. package/lib/ProForm/utils/valueType.js +157 -224
  444. package/lib/ProIcon/config/index.js +365 -276
  445. package/lib/ProIcon/index.js +189 -214
  446. package/lib/ProIcon/propsTypes.js +16 -4
  447. package/lib/ProIcon/style/index.less +0 -2
  448. package/lib/ProIcon/symbolIcon.js +23 -30
  449. package/lib/ProIcon/utils/index.js +66 -57
  450. package/lib/ProLayout/components/Layout/Header/index.js +59 -42
  451. package/lib/ProLayout/components/Layout/Icon/Icon.js +49 -30
  452. package/lib/ProLayout/components/Layout/Icon/index.js +34 -7
  453. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +141 -119
  454. package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
  455. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +123 -123
  456. package/lib/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +16 -4
  457. package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +60 -42
  458. package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
  459. package/lib/ProLayout/components/Layout/Menu/index.js +79 -56
  460. package/lib/ProLayout/components/Layout/Menu/style/index.less +0 -2
  461. package/lib/ProLayout/components/Layout/Notice/index.js +39 -31
  462. package/lib/ProLayout/components/Layout/Notice/style/index.less +0 -2
  463. package/lib/ProLayout/components/Layout/index.js +45 -31
  464. package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
  465. package/lib/ProLayout/components/ProCollapse/PropTypes.js +16 -4
  466. package/lib/ProLayout/components/ProCollapse/index.js +156 -135
  467. package/lib/ProLayout/components/ProCollapse/style/index.less +148 -4
  468. package/lib/ProLayout/components/ProFooter/PropTypes.js +16 -4
  469. package/lib/ProLayout/components/ProFooter/index.js +58 -44
  470. package/lib/ProLayout/components/ProFooter/style/index.less +0 -2
  471. package/lib/ProLayout/components/ProHeader/PropTypes.js +16 -4
  472. package/lib/ProLayout/components/ProHeader/components/Copy/index.js +53 -25
  473. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +48 -27
  474. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +16 -4
  475. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
  476. package/lib/ProLayout/components/ProHeader/components/index.js +39 -17
  477. package/lib/ProLayout/components/ProHeader/index.js +274 -452
  478. package/lib/ProLayout/components/ProHeader/style/index.less +0 -2
  479. package/lib/ProLayout/components/ProHeader/utils/index.js +32 -14
  480. package/lib/ProLayout/components/index.js +42 -24
  481. package/lib/ProLayout/index.d.ts +1 -12
  482. package/lib/ProLayout/index.js +158 -136
  483. package/lib/ProLayout/propTypes.d.ts +9 -0
  484. package/lib/ProLayout/propTypes.js +16 -4
  485. package/lib/ProLayout/style/index.less +0 -2
  486. package/lib/ProLayout/utils/index.d.ts +7 -0
  487. package/lib/ProLayout/utils/index.js +107 -103
  488. package/lib/ProSelect/components/AdaptiveTooltip.js +46 -40
  489. package/lib/ProSelect/index.js +218 -250
  490. package/lib/ProSelect/index.less +0 -2
  491. package/lib/ProSelect/propsType.js +16 -4
  492. package/lib/ProSelect/utils/index.js +110 -79
  493. package/lib/ProStep/components/Anchor/index.d.ts +1 -0
  494. package/lib/ProStep/components/Anchor/index.js +108 -101
  495. package/lib/ProStep/components/Item/index.d.ts +1 -0
  496. package/lib/ProStep/components/Item/index.js +82 -75
  497. package/lib/ProStep/components/Listener/index.js +62 -71
  498. package/lib/ProStep/components/Step/index.js +76 -67
  499. package/lib/ProStep/index.js +167 -225
  500. package/lib/ProStep/propsType.js +16 -4
  501. package/lib/ProStep/style/index.less +0 -2
  502. package/lib/ProStep/utils/index.js +59 -52
  503. package/lib/ProStepTab/index.js +179 -287
  504. package/lib/ProStepTab/propsType.js +16 -4
  505. package/lib/ProTable/components/FormatColumn/index.js +446 -495
  506. package/lib/ProTable/components/RcTable/components/BaseTable/index.js +53 -40
  507. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +139 -200
  508. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +116 -95
  509. package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +16 -4
  510. package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +80 -59
  511. package/lib/ProTable/components/RcTable/index.js +39 -17
  512. package/lib/ProTable/components/RenderColumn/index.js +194 -200
  513. package/lib/ProTable/components/RenderEmptyText/index.js +27 -25
  514. package/lib/ProTable/components/RenderFooter/index.js +33 -17
  515. package/lib/ProTable/components/RenderSummary/index.js +46 -56
  516. package/lib/ProTable/components/RenderTableHeader/index.js +68 -59
  517. package/lib/ProTable/components/RenderTabs/index.js +89 -78
  518. package/lib/ProTable/components/TableResizable/index.js +88 -87
  519. package/lib/ProTable/components/TooltipTitle/index.js +40 -26
  520. package/lib/ProTable/components/index.js +51 -45
  521. package/lib/ProTable/hooks/useAntdTable.d.ts +3 -0
  522. package/lib/ProTable/hooks/useAntdTable.js +349 -376
  523. package/lib/ProTable/index.d.ts +3 -7
  524. package/lib/ProTable/index.js +353 -392
  525. package/lib/ProTable/propsType.d.ts +3 -2
  526. package/lib/ProTable/propsType.js +16 -4
  527. package/lib/ProTable/style/index.less +4 -6
  528. package/lib/ProTable/utils/index.js +84 -84
  529. package/lib/ProTabs/components/Card/index.js +30 -50
  530. package/lib/ProTabs/components/index.js +36 -10
  531. package/lib/ProTabs/index.js +92 -85
  532. package/lib/ProTabs/propType.js +16 -4
  533. package/lib/ProTabs/style/index.less +0 -2
  534. package/lib/ProThemeTools/component/ProTools/index.js +198 -238
  535. package/lib/ProThemeTools/component/index.js +36 -10
  536. package/lib/ProThemeTools/context/ThemeContext.js +96 -87
  537. package/lib/ProThemeTools/index.d.ts +0 -7
  538. package/lib/ProThemeTools/index.js +181 -195
  539. package/lib/ProThemeTools/propsType.js +16 -4
  540. package/lib/ProThemeTools/style/index.less +0 -2
  541. package/lib/ProThemeTools/utils/index.js +85 -79
  542. package/lib/ProTooltip/index.js +217 -221
  543. package/lib/ProTooltip/propsType.js +16 -4
  544. package/lib/ProTooltip/style/index.less +0 -2
  545. package/lib/ProTree/components/AdaptiveTooltip.js +33 -22
  546. package/lib/ProTree/components/CloseIcon.js +36 -31
  547. package/lib/ProTree/components/List.js +68 -72
  548. package/lib/ProTree/components/ProTree.js +262 -362
  549. package/lib/ProTree/components/ProTreeSelect/index.js +367 -474
  550. package/lib/ProTree/components/ProTreeSelect/propsType.js +16 -4
  551. package/lib/ProTree/components/ProTreeSelect/style/index.less +0 -2
  552. package/lib/ProTree/components/SearchTitle.js +47 -50
  553. package/lib/ProTree/components/Tree.js +230 -302
  554. package/lib/ProTree/components/index.js +45 -31
  555. package/lib/ProTree/index.js +45 -22
  556. package/lib/ProTree/propsType.js +16 -4
  557. package/lib/ProTree/style/index.less +0 -2
  558. package/lib/ProTree/utils.js +83 -135
  559. package/lib/ProTreeModal/components/Cascader.js +97 -93
  560. package/lib/ProTreeModal/components/CloseIcon.js +36 -31
  561. package/lib/ProTreeModal/components/List.js +194 -263
  562. package/lib/ProTreeModal/components/SearchTitle.js +30 -22
  563. package/lib/ProTreeModal/components/SortableItem.js +60 -59
  564. package/lib/ProTreeModal/components/Tree.js +162 -180
  565. package/lib/ProTreeModal/components/Trigger.js +108 -126
  566. package/lib/ProTreeModal/components/index.js +51 -45
  567. package/lib/ProTreeModal/index.js +464 -574
  568. package/lib/ProTreeModal/propsType.js +16 -4
  569. package/lib/ProTreeModal/style/index.less +0 -2
  570. package/lib/ProTreeModal/utils.js +105 -158
  571. package/lib/ProUpload/components/ButtonRender.js +86 -108
  572. package/lib/ProUpload/components/DragRender.js +120 -167
  573. package/lib/ProUpload/components/DraggableUploadListItem.js +50 -32
  574. package/lib/ProUpload/components/Example.js +56 -38
  575. package/lib/ProUpload/components/FileItem.js +114 -203
  576. package/lib/ProUpload/components/ImageRender.js +176 -246
  577. package/lib/ProUpload/index.js +204 -215
  578. package/lib/ProUpload/propsType.js +16 -4
  579. package/lib/ProUpload/style/index.less +0 -2
  580. package/lib/ProUpload/uitls.js +34 -10
  581. package/lib/ProUtils/utils/index.js +38 -26
  582. package/lib/ProViewer/index.js +173 -199
  583. package/lib/ProViewer/propsType.js +16 -4
  584. package/lib/ProViewer/style/index.less +0 -2
  585. package/lib/ProWaterMark/index.js +38 -18
  586. package/lib/ProWaterMark/propsType.js +16 -4
  587. package/lib/index.d.ts +1 -1
  588. package/lib/index.js +123 -272
  589. package/lib/locale/en_US.js +145 -127
  590. package/lib/locale/index.js +58 -38
  591. package/lib/locale/zh_CN.js +146 -128
  592. package/lib/style/theme/antd.less +0 -2
  593. package/lib/tokens.js +103 -86
  594. package/lib/utils/index.js +91 -63
  595. package/package.json +13 -12
  596. package/tests/__mocks__/fileMock.js +1 -0
  597. package/tests/__mocks__/zatUtils.js +27 -0
  598. package/tests/setup.ts +484 -0
  599. package/tests/test-utils.tsx +81 -0
  600. package/dist/index.esm.css +0 -6445
  601. package/dist/index.esm.js +0 -3
  602. package/dist/less.esm.css +0 -5871
  603. package/dist/less.esm.js +0 -3
@@ -1,224 +1,215 @@
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 _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
29
+ // src/ProForm/components/combination/ProModalSelect/index.tsx
30
+ var ProModalSelect_exports = {};
31
+ __export(ProModalSelect_exports, {
32
+ default: () => ProModalSelect_default
7
33
  });
8
- exports.default = void 0;
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
- var _objectSpread5 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
- var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
16
- var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
17
- var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
18
- var _debounce2 = _interopRequireDefault(require("lodash/debounce"));
19
- var _jsxRuntime = require("react/jsx-runtime");
20
- var _icons = require("@ant-design/icons");
21
- var _ahooks = require("ahooks");
22
- var _antd = require("antd");
23
- var _classnames = _interopRequireDefault(require("classnames"));
24
- var _reactSvg = require("react-svg");
25
- var _react = _interopRequireWildcard(require("react"));
26
- var _index = require("../../../../index");
27
- var _Container = _interopRequireDefault(require("../../Container"));
28
- var _view = _interopRequireDefault(require("../../../../assets/view.svg"));
29
- var _useRequestList3 = _interopRequireDefault(require("./hooks/useRequestList"));
30
- var _locale = _interopRequireDefault(require("../../../../locale"));
31
- var _utils = require("./utils");
32
- var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "afterOpen", "isTooltip", "searchForm", "searchKey", "defaultOne", "otherProps"],
33
- _excluded2 = ["onOk"],
34
- _excluded3 = ["rowKey", "columns", "rowSelection"];
35
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
36
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
37
- var ProModalSelect = function ProModalSelect(props, ref) {
38
- var _useRequest$options, _useRequest$options2, _useRequest$options2$, _useRequest$options3, _formColumns$;
39
- var value = props.value,
40
- onChange = props.onChange,
41
- disabled = props.disabled,
42
- _props$labelInValue = props.labelInValue,
43
- labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
44
- fieldNames = props.fieldNames,
45
- _props$readOnly = props.readOnly,
46
- readOnly = _props$readOnly === void 0 ? true : _props$readOnly,
47
- addonAfter = props.addonAfter,
48
- configOption = props.configOption,
49
- title = props.title,
50
- onFormat = props.onFormat,
51
- showCodeName = props.showCodeName,
52
- optionRender = props.optionRender,
53
- customRender = props.customRender,
54
- style = props.style,
55
- className = props.className,
56
- beforeOpen = props.beforeOpen,
57
- afterOpen = props.afterOpen,
58
- isTooltip = props.isTooltip,
59
- searchForm = props.searchForm,
60
- searchKey = props.searchKey,
61
- defaultOne = props.defaultOne,
62
- otherProps = props.otherProps,
63
- restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
64
- var contentForm = _antd.Form.useFormInstance();
65
- if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
66
- throw new Error('error: 请检查枚举选择弹框的配置项【configOption】');
34
+ module.exports = __toCommonJS(ProModalSelect_exports);
35
+ var import_icons = require("@ant-design/icons");
36
+ var import_ahooks = require("ahooks");
37
+ var import_antd = require("antd");
38
+ var import_lodash = require("lodash");
39
+ var import_classnames = __toESM(require("classnames"));
40
+ var import_react_svg = require("react-svg");
41
+ var import_react = __toESM(require("react"));
42
+ var import__ = require("../../../../index");
43
+ var import_Container = __toESM(require("../../Container"));
44
+ var import_view = __toESM(require("../../../../assets/view.svg"));
45
+ var import_useRequestList = __toESM(require("./hooks/useRequestList"));
46
+ var import_locale = __toESM(require("../../../../locale"));
47
+ var import_utils = require("./utils");
48
+ var ProModalSelect = (props, ref) => {
49
+ var _a, _b, _c, _d, _e, _f, _g, _h;
50
+ const {
51
+ value,
52
+ onChange,
53
+ disabled,
54
+ labelInValue = false,
55
+ fieldNames,
56
+ readOnly = true,
57
+ mode = "select",
58
+ addonAfter,
59
+ configOption,
60
+ title,
61
+ onFormat,
62
+ showCodeName,
63
+ optionRender,
64
+ customRender,
65
+ style,
66
+ className,
67
+ beforeOpen,
68
+ afterOpen,
69
+ isTooltip,
70
+ tooltip,
71
+ searchForm,
72
+ searchKey,
73
+ defaultOne,
74
+ otherProps,
75
+ ...restProps
76
+ } = props;
77
+ const _tooltip = tooltip ?? isTooltip;
78
+ const nextMode = (0, import_react.useMemo)(() => {
79
+ if ((0, import_lodash.isBoolean)(readOnly) && readOnly === false) {
80
+ return "input";
81
+ }
82
+ return mode;
83
+ }, [mode, readOnly]);
84
+ const contentForm = import_antd.Form.useFormInstance();
85
+ if (!configOption || Object.prototype.toString.call(configOption) !== "[object Object]") {
86
+ throw new Error("error: 请检查枚举选择弹框的配置项【configOption】");
67
87
  }
68
- var _configOption$type = configOption.type,
69
- type = _configOption$type === void 0 ? 'radio' : _configOption$type,
70
- useRequest = configOption.useRequest,
71
- transformParams = configOption.transformParams,
72
- transformResponse = configOption.transformResponse,
73
- formColumns = configOption.formColumns,
74
- _configOption$withPag = configOption.withPagination,
75
- withPagination = _configOption$withPag === void 0 ? true : _configOption$withPag,
76
- modalProps = configOption.modalProps,
77
- tableProps = configOption.tableProps;
78
- var _ref = modalProps || {},
79
- onOk = _ref.onOk,
80
- restModalProps = (0, _objectWithoutProperties2.default)(_ref, _excluded2);
81
- var _ref2 = _index.ProForm.useFieldProps() || {},
82
- isViewCon = _ref2.isView,
83
- viewEmpty = _ref2.viewEmpty;
84
- var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
85
- // 是否多选
86
- var isMultiple = type === 'checkbox';
87
- // 生成一个唯一id,用于满足tooltip功能
88
- var uuid = Math.random().toString(36).slice(-6);
89
- // 全局配置fieldNames指定 value与label的key
90
- var _ref3 = (0, _index.useProConfig)('ProModalSelect') || {},
91
- _ref3$fieldNames = _ref3.fieldNames,
92
- proModalSelectFieldNames = _ref3$fieldNames === void 0 ? {} : _ref3$fieldNames;
93
- var labelKey = 'label';
94
- var valueKey = 'value';
88
+ const {
89
+ type = "radio",
90
+ useRequest,
91
+ transformParams,
92
+ transformResponse,
93
+ formColumns,
94
+ withPagination = true,
95
+ modalProps,
96
+ tableProps
97
+ } = configOption;
98
+ const { onOk, ...restModalProps } = modalProps || {};
99
+ const { isView: isViewCon, viewEmpty } = import__.ProForm.useFieldProps() || {};
100
+ const isView = typeof props.isView === "boolean" ? props.isView : isViewCon;
101
+ const isMultiple = type === "checkbox";
102
+ const uuid = Math.random().toString(36).slice(-6);
103
+ const { fieldNames: proModalSelectFieldNames = {} } = (0, import__.useProConfig)("ProModalSelect") || {};
104
+ let labelKey = "label";
105
+ let valueKey = "value";
95
106
  if (proModalSelectFieldNames && Object.keys(proModalSelectFieldNames).length) {
96
107
  labelKey = proModalSelectFieldNames.label;
97
108
  valueKey = proModalSelectFieldNames.value;
98
109
  }
99
- // 表单上配置的权重大于全局配置
100
110
  if (fieldNames && Object.keys(fieldNames).length) {
101
111
  labelKey = fieldNames.label;
102
112
  valueKey = fieldNames.value;
103
113
  }
104
- var _ref4 = tableProps || {},
105
- _ref4$rowKey = _ref4.rowKey,
106
- rowKey = _ref4$rowKey === void 0 ? valueKey : _ref4$rowKey,
107
- columns = _ref4.columns,
108
- rowSelection = _ref4.rowSelection,
109
- restTableProps = (0, _objectWithoutProperties2.default)(_ref4, _excluded3);
110
- var preValue = (0, _react.useRef)(value);
111
- // 表单项的ref
112
- var fieldRef = (0, _react.useRef)(null);
113
- var defaultParams = Array.isArray(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.defaultParams) ? useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : (_useRequest$options2$ = _useRequest$options2.defaultParams) === null || _useRequest$options2$ === void 0 ? void 0 : _useRequest$options2$[0] : (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options3 = useRequest.options) === null || _useRequest$options3 === void 0 ? void 0 : _useRequest$options3.defaultParams) || {};
114
- var defaultParamsRef = (0, _react.useRef)(defaultParams); // 缓存 defaultParams 的引用
115
- var _useSetState = (0, _ahooks.useSetState)({
116
- _value: value,
117
- isInit: true,
118
- onOff: false,
119
- open: false,
120
- options: (tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource) || [],
121
- selectedRows: [],
122
- selectedRowKeys: []
123
- }),
124
- _useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
125
- _useSetState2$ = _useSetState2[0],
126
- _value = _useSetState2$._value,
127
- isInit = _useSetState2$.isInit,
128
- onOff = _useSetState2$.onOff,
129
- open = _useSetState2$.open,
130
- options = _useSetState2$.options,
131
- _selectedRows = _useSetState2$.selectedRows,
132
- _selectedRowKeys = _useSetState2$.selectedRowKeys,
133
- setState = _useSetState2[1];
134
- var _Form$useForm = _antd.Form.useForm(searchForm),
135
- _Form$useForm2 = (0, _slicedToArray2.default)(_Form$useForm, 1),
136
- form = _Form$useForm2[0];
137
- var selectedRows = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || _selectedRows;
138
- var selectedRowKeys = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || _selectedRowKeys;
139
- var _useRequestList = (0, _useRequestList3.default)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
140
- withPagination: withPagination,
141
- transformParams: transformParams,
142
- transformResponse: transformResponse
143
- }, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
114
+ const { rowKey = valueKey, columns, rowSelection, ...restTableProps } = tableProps || {};
115
+ const preValue = (0, import_react.useRef)(value);
116
+ const fieldRef = (0, import_react.useRef)(null);
117
+ const defaultParams = Array.isArray((_a = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a.defaultParams) ? (_c = (_b = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _b.defaultParams) == null ? void 0 : _c[0] : ((_d = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _d.defaultParams) || {};
118
+ const defaultParamsRef = (0, import_react.useRef)(defaultParams);
119
+ const [
120
+ {
121
+ _value,
122
+ isInit,
123
+ onOff,
124
+ open,
125
+ options,
126
+ selectedRows: _selectedRows,
127
+ selectedRowKeys: _selectedRowKeys
128
+ },
129
+ setState
130
+ ] = (0, import_ahooks.useSetState)({
131
+ _value: value,
132
+ isInit: true,
133
+ onOff: false,
134
+ open: false,
135
+ options: (tableProps == null ? void 0 : tableProps.dataSource) || [],
136
+ selectedRows: [],
137
+ selectedRowKeys: []
138
+ });
139
+ const [form] = import_antd.Form.useForm(searchForm);
140
+ const selectedRows = (rowSelection == null ? void 0 : rowSelection.selectedRows) || _selectedRows;
141
+ const selectedRowKeys = (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || _selectedRowKeys;
142
+ const { run, loading: selectLoading } = (0, import_useRequestList.default)(
143
+ useRequest == null ? void 0 : useRequest.service,
144
+ {
145
+ withPagination,
146
+ transformParams,
147
+ transformResponse
148
+ },
149
+ {
150
+ ...useRequest == null ? void 0 : useRequest.options,
144
151
  manual: true,
145
- onSuccess: function onSuccess(res) {
146
- var _res$data, _ref5;
147
- var list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
152
+ onSuccess(res) {
153
+ var _a2;
154
+ const list = withPagination ? (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.list : res == null ? void 0 : res.data;
148
155
  setState({
149
- options: (_ref5 = transformResponse ? transformResponse(res === null || res === void 0 ? void 0 : res.data) : list) !== null && _ref5 !== void 0 ? _ref5 : []
156
+ options: (transformResponse ? transformResponse(res == null ? void 0 : res.data) : list) ?? []
150
157
  });
151
158
  }
152
- })),
153
- run = _useRequestList.run,
154
- selectLoading = _useRequestList.loading;
155
- var initParams = (0, _react.useMemo)(function () {
156
- var nextInitParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams;
157
- if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
158
- var _contentForm$getField;
159
- nextInitParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField = contentForm.getFieldsValue) === null || _contentForm$getField === void 0 ? void 0 : _contentForm$getField.call(contentForm));
159
+ }
160
+ );
161
+ const initParams = (0, import_react.useMemo)(() => {
162
+ var _a2;
163
+ let nextInitParams = useRequest == null ? void 0 : useRequest.initParams;
164
+ if (typeof (useRequest == null ? void 0 : useRequest.initParams) === "function") {
165
+ nextInitParams = useRequest == null ? void 0 : useRequest.initParams(value, (_a2 = contentForm == null ? void 0 : contentForm.getFieldsValue) == null ? void 0 : _a2.call(contentForm));
160
166
  }
161
167
  return nextInitParams;
162
168
  }, [value]);
163
- var _useRequestList2 = (0, _useRequestList3.default)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
164
- withPagination: withPagination,
165
- transformParams: transformParams,
166
- transformResponse: transformResponse
167
- }, (0, _objectSpread5.default)({
168
- manual: true,
169
- ready: (initParams || defaultOne) && !readOnly || open
170
- }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
171
- data = _useRequestList2.data,
172
- loading = _useRequestList2.loading,
173
- pagination = _useRequestList2.pagination,
174
- onSearch = _useRequestList2.onSearch,
175
- onReset = _useRequestList2.onReset,
176
- runAsync = _useRequestList2.runAsync,
177
- mutate = _useRequestList2.mutate;
178
- var defaultOptionRender = function defaultOptionRender(rowData) {
179
- return rowData === null || rowData === void 0 ? void 0 : rowData[labelKey];
180
- };
181
- var handleFormat = onFormat || defaultOptionRender;
169
+ const { data, loading, pagination, onSearch, onReset, runAsync, mutate } = (0, import_useRequestList.default)(
170
+ useRequest == null ? void 0 : useRequest.service,
171
+ {
172
+ withPagination,
173
+ transformParams,
174
+ transformResponse
175
+ },
176
+ {
177
+ ready: (initParams || defaultOne) && nextMode === "input" || open,
178
+ ...useRequest == null ? void 0 : useRequest.options
179
+ }
180
+ );
181
+ const defaultOptionRender = (rowData) => rowData == null ? void 0 : rowData[labelKey];
182
+ let handleFormat = onFormat || defaultOptionRender;
182
183
  if (showCodeName) {
183
- handleFormat = function handleFormat(_ref6) {
184
- var value = _ref6.value,
185
- label = _ref6.label;
186
- return "".concat(value, "-").concat(label);
187
- };
184
+ handleFormat = ({ value: value2, label }) => `${value2}-${label}`;
188
185
  }
189
- /**
190
- * 格式化数据方法,展示在输入框中
191
- * @date 2023-02-16
192
- * @param {any} data 当前选中的值 labelInValue模式下为选中行对象,单值模式为value值
193
- * @returns {any}
194
- */
195
- var formatValue = function formatValue(data) {
196
- var _data$map;
197
- if (typeof data === 'string' || typeof data === 'number') {
198
- return data;
186
+ const formatValue = (data2) => {
187
+ var _a2;
188
+ if (typeof data2 === "string" || typeof data2 === "number") {
189
+ return data2;
199
190
  }
200
- if (Object.prototype.toString.call(data) === '[object Object]') {
201
- return handleFormat((0, _objectSpread5.default)((0, _objectSpread5.default)({}, data), {}, {
202
- value: data[valueKey],
203
- label: data[labelKey]
204
- }));
191
+ if ((0, import_lodash.isObject)(data2)) {
192
+ return handleFormat({
193
+ ...data2,
194
+ value: data2[valueKey],
195
+ label: data2[labelKey]
196
+ });
205
197
  }
206
- return (0, _isArray2.default)(data) ? data === null || data === void 0 ? void 0 : (_data$map = data.map(function (item) {
207
- return handleFormat((0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
198
+ return (0, import_lodash.isArray)(data2) ? (_a2 = data2 == null ? void 0 : data2.map((item) => {
199
+ return handleFormat({
200
+ ...item,
208
201
  value: item[valueKey],
209
202
  label: item[labelKey]
210
- }));
211
- })) === null || _data$map === void 0 ? void 0 : _data$map.join('') : '';
203
+ });
204
+ })) == null ? void 0 : _a2.join("") : "";
212
205
  };
213
- var viewText = (0, _react.useMemo)(function () {
214
- var nextValue = labelInValue ? value : _value;
206
+ const viewText = (0, import_react.useMemo)(() => {
207
+ var _a2;
208
+ let nextValue = labelInValue ? value : _value;
215
209
  if (labelInValue) {
216
210
  nextValue = value;
217
211
  } else {
218
- var _options$find;
219
- var optionDTO = options === null || options === void 0 ? void 0 : (_options$find = options.find) === null || _options$find === void 0 ? void 0 : _options$find.call(options, function (item) {
220
- return item[valueKey] === value;
221
- });
212
+ const optionDTO = (_a2 = options == null ? void 0 : options.find) == null ? void 0 : _a2.call(options, (item) => item[valueKey] === value);
222
213
  if (optionDTO) {
223
214
  nextValue = optionDTO;
224
215
  } else {
@@ -227,231 +218,129 @@ var ProModalSelect = function ProModalSelect(props, ref) {
227
218
  }
228
219
  return formatValue(nextValue);
229
220
  }, [value, _value, options]);
230
- /**
231
- * 获取表格的rowKey,支持函数、字符串
232
- * @date 2023-02-16
233
- * @param {any} record 表格行数据
234
- * @returns {any}
235
- */
236
- var getRowKey = function getRowKey(record) {
237
- if (typeof rowKey === 'function') {
221
+ const getRowKey = (record) => {
222
+ if ((0, import_lodash.isFunction)(rowKey)) {
238
223
  return rowKey(record);
239
224
  }
240
225
  return record[rowKey];
241
226
  };
242
- /**
243
- * 执行onChange暴露出来的第一个参数取数方法
244
- * @date 2023-02-16
245
- * @param {any} selectedRows 选中行数据
246
- * @returns {any}
247
- */
248
- var getNextValues = function getNextValues(selectedRows) {
227
+ const getNextValues = (selectedRows2) => {
249
228
  if (isMultiple) {
250
- return selectedRows.map(function (item) {
251
- return item === null || item === void 0 ? void 0 : item[valueKey];
252
- });
229
+ return selectedRows2.map((item) => item == null ? void 0 : item[valueKey]);
253
230
  }
254
- return selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows[valueKey];
231
+ return selectedRows2 == null ? void 0 : selectedRows2[valueKey];
255
232
  };
256
- var handleChangeValue = function handleChangeValue(e) {
233
+ const handleChangeValue = (e) => {
257
234
  onChange(e.target.value);
258
235
  preValue.current = e.target.value;
259
- if (!readOnly) {
236
+ if (nextMode === "input") {
260
237
  setState({
261
238
  _value: e.target.value
262
239
  });
263
240
  }
264
241
  };
265
- var handleSelectValue = function handleSelectValue(val, option) {
242
+ const handleSelectValue = (val, option) => {
266
243
  onChange(val, option);
267
244
  preValue.current = val;
268
245
  };
269
- var handleClick = /*#__PURE__*/function () {
270
- var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator().m(function _callee() {
271
- var _yield$beforeOpen, res, _t, _t2, _t3;
272
- return _regenerator().w(function (_context) {
273
- while (1) switch (_context.n) {
274
- case 0:
275
- if (disabled) {
276
- _context.n = 5;
277
- break;
278
- }
279
- _context.n = 1;
280
- return beforeOpen === null || beforeOpen === void 0 ? void 0 : beforeOpen();
281
- case 1:
282
- _t2 = _yield$beforeOpen = _context.v;
283
- _t = _t2 !== null;
284
- if (!_t) {
285
- _context.n = 2;
286
- break;
287
- }
288
- _t = _yield$beforeOpen !== void 0;
289
- case 2:
290
- if (!_t) {
291
- _context.n = 3;
292
- break;
293
- }
294
- _t3 = _yield$beforeOpen;
295
- _context.n = 4;
296
- break;
297
- case 3:
298
- _t3 = true;
299
- case 4:
300
- res = _t3;
301
- if (res) {
302
- setState({
303
- onOff: true
304
- });
305
- setTimeout(function () {
306
- afterOpen === null || afterOpen === void 0 ? void 0 : afterOpen({
307
- setInnerState: setState
308
- });
309
- }, 100);
310
- }
311
- case 5:
312
- return _context.a(2);
313
- }
314
- }, _callee);
315
- }));
316
- return function handleClick() {
317
- return _ref7.apply(this, arguments);
318
- };
319
- }();
320
- var handleClose = function handleClose() {
321
- var _useRequest$options4;
246
+ const handleClick = async () => {
247
+ if (!disabled) {
248
+ const res = await (beforeOpen == null ? void 0 : beforeOpen()) ?? true;
249
+ if (res) {
250
+ setState({
251
+ onOff: true
252
+ });
253
+ setTimeout(() => {
254
+ afterOpen == null ? void 0 : afterOpen({
255
+ setInnerState: setState
256
+ });
257
+ }, 100);
258
+ }
259
+ }
260
+ };
261
+ const handleClose = () => {
262
+ var _a2;
322
263
  form.resetFields();
323
264
  setState({
324
265
  onOff: false,
325
266
  open: false,
326
267
  isInit: false
327
268
  });
328
- // 当设置manual为true时,清空当前弹框内已搜索出来的值
329
- if (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.manual) {
330
- mutate(function () {
331
- return [];
332
- });
269
+ if ((_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.manual) {
270
+ mutate(() => []);
333
271
  }
334
272
  };
335
- var handleFinish = /*#__PURE__*/function () {
336
- var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator().m(function _callee2() {
337
- var _nextSelectedRows, _nextSelectedRows2, nextSelectedRows, record, flag, res, _t4;
338
- return _regenerator().w(function (_context2) {
339
- while (1) switch (_context2.p = _context2.n) {
340
- case 0:
341
- _context2.p = 0;
342
- if (!(!(selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) || !(selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length))) {
343
- _context2.n = 1;
344
- break;
345
- }
346
- _antd.message.error(_locale.default.ProModalSelect.checkMsg);
347
- return _context2.a(2, false);
348
- case 1:
349
- nextSelectedRows = selectedRows;
350
- if (!((_nextSelectedRows = nextSelectedRows) === null || _nextSelectedRows === void 0 ? void 0 : _nextSelectedRows[0])) {
351
- nextSelectedRows = data.filter(function (item) {
352
- return selectedRowKeys.includes(item[valueKey]);
353
- });
354
- }
355
- record = isMultiple ? nextSelectedRows : (_nextSelectedRows2 = nextSelectedRows) === null || _nextSelectedRows2 === void 0 ? void 0 : _nextSelectedRows2[0];
356
- if (!isMultiple) {
357
- // @ts-ignore
358
- record.value = record[valueKey];
359
- // @ts-ignore
360
- record.label = record[labelKey];
361
- }
362
- flag = true;
363
- if (!onOk) {
364
- _context2.n = 3;
365
- break;
366
- }
367
- _context2.n = 2;
368
- return onOk(record);
369
- case 2:
370
- res = _context2.v;
371
- if (res !== null && res !== undefined) {
372
- // @ts-ignore
373
- flag = res;
374
- }
375
- case 3:
376
- if (flag) {
377
- onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
378
- preValue.current = labelInValue ? record : getNextValues(record);
379
- // 更新内部展示值
380
- setState({
381
- _value: record,
382
- options: (0, _isArray2.default)(record) ? record : [record]
383
- });
384
- handleClose();
385
- }
386
- return _context2.a(2, flag);
387
- case 4:
388
- _context2.p = 4;
389
- _t4 = _context2.v;
390
- console.warn('error', _t4);
391
- case 5:
392
- return _context2.a(2);
393
- }
394
- }, _callee2, null, [[0, 4]]);
395
- }));
396
- return function handleFinish() {
397
- return _ref8.apply(this, arguments);
398
- };
399
- }();
400
- var handleSearch = /*#__PURE__*/function () {
401
- var _ref9 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator().m(function _callee3() {
402
- var values;
403
- return _regenerator().w(function (_context3) {
404
- while (1) switch (_context3.n) {
405
- case 0:
406
- _context3.n = 1;
407
- return form.validateFields();
408
- case 1:
409
- values = _context3.v;
410
- onSearch((0, _objectSpread5.default)((0, _objectSpread5.default)({}, values), {}, {
411
- d: Date.now()
412
- }));
413
- case 2:
414
- return _context3.a(2);
273
+ const handleFinish = async () => {
274
+ try {
275
+ if (!(selectedRowKeys == null ? void 0 : selectedRowKeys.length) || !(selectedRows == null ? void 0 : selectedRows.length)) {
276
+ import_antd.message.error(import_locale.default.ProModalSelect.checkMsg);
277
+ return false;
278
+ }
279
+ let nextSelectedRows = selectedRows;
280
+ if (!(nextSelectedRows == null ? void 0 : nextSelectedRows[0])) {
281
+ nextSelectedRows = data.filter((item) => selectedRowKeys.includes(item[valueKey]));
282
+ }
283
+ const record = isMultiple ? nextSelectedRows : nextSelectedRows == null ? void 0 : nextSelectedRows[0];
284
+ if (!isMultiple) {
285
+ record.value = record[valueKey];
286
+ record.label = record[labelKey];
287
+ }
288
+ let flag = true;
289
+ if (onOk) {
290
+ const res = await onOk(record);
291
+ if (res !== null && res !== void 0) {
292
+ flag = res;
415
293
  }
416
- }, _callee3);
417
- }));
418
- return function handleSearch() {
419
- return _ref9.apply(this, arguments);
420
- };
421
- }();
422
- var _rowSelection = (0, _objectSpread5.default)({
423
- type: type,
424
- onChange: function onChange(rowKeys, rows) {
294
+ }
295
+ if (flag) {
296
+ onChange == null ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
297
+ preValue.current = labelInValue ? record : getNextValues(record);
298
+ setState({
299
+ _value: record,
300
+ options: (0, import_lodash.isArray)(record) ? record : [record]
301
+ });
302
+ handleClose();
303
+ }
304
+ return flag;
305
+ } catch (error) {
306
+ console.warn("error", error);
307
+ }
308
+ };
309
+ const handleSearch = async () => {
310
+ const values = await form.validateFields();
311
+ onSearch({
312
+ ...values,
313
+ d: Date.now()
314
+ });
315
+ };
316
+ const _rowSelection = {
317
+ type,
318
+ onChange: (rowKeys, rows) => {
425
319
  setState({
426
320
  selectedRowKeys: rowKeys,
427
321
  selectedRows: rows
428
322
  });
429
323
  },
430
- getCheckboxProps: function getCheckboxProps(record) {
431
- return {
432
- disabled: record === null || record === void 0 ? void 0 : record.disabled
433
- };
434
- },
435
- selectedRowKeys: selectedRowKeys,
436
- selectedRows: selectedRows
437
- }, rowSelection);
438
- // 点击行进行勾选
439
- var handleClickRow = function handleClickRow(record) {
440
- var _rowSelection$getChec, _rowSelection$getChec2;
441
- if (_rowSelection === null || _rowSelection === void 0 ? void 0 : (_rowSelection$getChec = _rowSelection.getCheckboxProps) === null || _rowSelection$getChec === void 0 ? void 0 : (_rowSelection$getChec2 = _rowSelection$getChec.call(_rowSelection, record)) === null || _rowSelection$getChec2 === void 0 ? void 0 : _rowSelection$getChec2.disabled) {
324
+ getCheckboxProps: (record) => ({
325
+ disabled: record == null ? void 0 : record.disabled
326
+ }),
327
+ selectedRowKeys,
328
+ selectedRows,
329
+ ...rowSelection
330
+ };
331
+ const handleClickRow = (record) => {
332
+ var _a2, _b2;
333
+ if ((_b2 = (_a2 = _rowSelection == null ? void 0 : _rowSelection.getCheckboxProps) == null ? void 0 : _a2.call(_rowSelection, record)) == null ? void 0 : _b2.disabled) {
442
334
  return;
443
335
  }
444
- if (record === null || record === void 0 ? void 0 : record.disabled) return;
445
- var selectedValue = getRowKey(record);
446
- var tempSelectedRows = (0, _toConsumableArray2.default)(selectedRows);
447
- var tempSelectedRowKeys = (0, _toConsumableArray2.default)(selectedRowKeys);
336
+ if (record == null ? void 0 : record.disabled)
337
+ return;
338
+ const selectedValue = getRowKey(record);
339
+ let tempSelectedRows = [...selectedRows];
340
+ let tempSelectedRowKeys = [...selectedRowKeys];
448
341
  if (isMultiple) {
449
- var rowIndex = tempSelectedRows.findIndex(function (item) {
450
- return getRowKey(item) === selectedValue;
451
- });
452
- var rowKeyIndex = tempSelectedRowKeys.findIndex(function (item) {
453
- return item === selectedValue;
454
- });
342
+ const rowIndex = tempSelectedRows.findIndex((item) => getRowKey(item) === selectedValue);
343
+ const rowKeyIndex = tempSelectedRowKeys.findIndex((item) => item === selectedValue);
455
344
  if (rowKeyIndex > -1) {
456
345
  tempSelectedRows.splice(rowIndex, 1);
457
346
  tempSelectedRowKeys.splice(rowKeyIndex, 1);
@@ -468,143 +357,108 @@ var ProModalSelect = function ProModalSelect(props, ref) {
468
357
  selectedRowKeys: tempSelectedRowKeys
469
358
  });
470
359
  };
471
- // 初始化回显,当传入initParams时,前端用来回险
472
- var getInitValues = /*#__PURE__*/function () {
473
- var _ref0 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator().m(function _callee4() {
474
- var _useRequest$options5, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
475
- return _regenerator().w(function (_context4) {
476
- while (1) switch (_context4.n) {
477
- case 0:
478
- if (!(initParams || defaultOne)) {
479
- _context4.n = 2;
480
- break;
481
- }
482
- queryBean = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, defaultParams), initParams || {});
483
- page = (0, _objectSpread5.default)({
484
- pageNum: 1,
485
- pageSize: 10
486
- }, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options5 = useRequest.options) === null || _useRequest$options5 === void 0 ? void 0 : _useRequest$options5.page);
487
- params = withPagination ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, page), {}, {
488
- queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
489
- }) : queryBean;
490
- params = transformParams ? transformParams(params) : params;
491
- _context4.n = 1;
492
- return runAsync(params);
493
- case 1:
494
- res = _context4.v;
495
- if (res === null || res === void 0 ? void 0 : res.data) {
496
- list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
497
- if (transformResponse) {
498
- list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
499
- }
500
- _data = isMultiple ? list : (_list = list) === null || _list === void 0 ? void 0 : _list[0];
501
- if (_data) {
502
- nextSelectRowKeys = isMultiple ? value : [value];
503
- if (labelInValue) {
504
- onChange(_data);
505
- preValue.current = _data;
506
- }
507
- // 更新内部展示值
508
- setState({
509
- _value: _data,
510
- isInit: false,
511
- selectedRows: list,
512
- selectedRowKeys: nextSelectRowKeys
513
- });
514
- } else if (!readOnly) {
515
- // 当传入initParams且文本框非只读时,不调用接口获取初始化数据
516
- setState({
517
- _value: value,
518
- isInit: false
519
- });
520
- }
521
- }
522
- case 2:
523
- return _context4.a(2);
360
+ const getInitValues = async () => {
361
+ var _a2, _b2;
362
+ if (initParams || defaultOne) {
363
+ const queryBean = {
364
+ ...defaultParams,
365
+ ...initParams || {}
366
+ };
367
+ const page = {
368
+ pageNum: 1,
369
+ pageSize: 10,
370
+ ...(_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.page
371
+ };
372
+ let params = withPagination ? {
373
+ ...page,
374
+ queryBean: queryBean ?? {}
375
+ } : queryBean;
376
+ params = transformParams ? transformParams(params) : params;
377
+ const res = await runAsync(params);
378
+ if (res == null ? void 0 : res.data) {
379
+ let list = withPagination ? (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.list : res == null ? void 0 : res.data;
380
+ if (transformResponse) {
381
+ list = transformResponse(res == null ? void 0 : res.data);
524
382
  }
525
- }, _callee4);
526
- }));
527
- return function getInitValues() {
528
- return _ref0.apply(this, arguments);
529
- };
530
- }();
531
- // 初始化回显,当传入initParams时,前端用来回险
532
- var getDefaultOneValues = /*#__PURE__*/function () {
533
- var _ref1 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator().m(function _callee5() {
534
- var _useRequest$options6;
535
- var queryBean, page, params, res, _res$data3, _list2, list, _data2, nextSelectRowKeys;
536
- return _regenerator().w(function (_context5) {
537
- while (1) switch (_context5.n) {
538
- case 0:
539
- queryBean = (0, _objectSpread5.default)({}, defaultParams);
540
- page = (0, _objectSpread5.default)({
541
- pageNum: 1,
542
- pageSize: 10
543
- }, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.page);
544
- params = withPagination ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, page), {}, {
545
- queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
546
- }) : queryBean;
547
- params = transformParams ? transformParams(params) : params;
548
- _context5.n = 1;
549
- return runAsync(params);
550
- case 1:
551
- res = _context5.v;
552
- if (res === null || res === void 0 ? void 0 : res.data) {
553
- list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
554
- if (transformResponse) {
555
- list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
556
- }
557
- _data2 = isMultiple ? list : (_list2 = list) === null || _list2 === void 0 ? void 0 : _list2[0];
558
- nextSelectRowKeys = isMultiple ? value : [value];
559
- if (labelInValue) {
560
- onChange(_data2);
561
- preValue.current = _data2;
562
- } else {
563
- onChange(isMultiple ? _data2.map(function (item) {
564
- return item[valueKey];
565
- }) : _data2[valueKey]);
566
- preValue.current = isMultiple ? _data2.map(function (item) {
567
- return item[valueKey];
568
- }) : _data2[valueKey];
569
- }
570
- // 更新内部展示值
571
- setState({
572
- _value: _data2,
573
- isInit: false,
574
- selectedRows: list,
575
- selectedRowKeys: nextSelectRowKeys
576
- });
577
- }
578
- case 2:
579
- return _context5.a(2);
383
+ const data2 = isMultiple ? list : list == null ? void 0 : list[0];
384
+ if (data2) {
385
+ const nextSelectRowKeys = isMultiple ? value : [value];
386
+ if (labelInValue) {
387
+ onChange(data2);
388
+ preValue.current = data2;
389
+ }
390
+ setState({
391
+ _value: data2,
392
+ isInit: false,
393
+ selectedRows: list,
394
+ selectedRowKeys: nextSelectRowKeys
395
+ });
396
+ } else if (nextMode === "input") {
397
+ setState({
398
+ _value: value,
399
+ isInit: false
400
+ });
580
401
  }
581
- }, _callee5);
582
- }));
583
- return function getDefaultOneValues() {
584
- return _ref1.apply(this, arguments);
402
+ }
403
+ }
404
+ };
405
+ const getDefaultOneValues = async () => {
406
+ var _a2, _b2;
407
+ const queryBean = {
408
+ ...defaultParams
585
409
  };
586
- }();
587
- (0, _react.useImperativeHandle)(ref, function () {
588
- return {
589
- handleClick: handleClick,
590
- handleSearch: handleSearch
410
+ const page = {
411
+ pageNum: 1,
412
+ pageSize: 10,
413
+ ...(_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.page
591
414
  };
592
- });
593
- (0, _ahooks.useMount)(function () {
415
+ let params = withPagination ? {
416
+ ...page,
417
+ queryBean: queryBean ?? {}
418
+ } : queryBean;
419
+ params = transformParams ? transformParams(params) : params;
420
+ const res = await runAsync(params);
421
+ if (res == null ? void 0 : res.data) {
422
+ let list = withPagination ? (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.list : res == null ? void 0 : res.data;
423
+ if (transformResponse) {
424
+ list = transformResponse(res == null ? void 0 : res.data);
425
+ }
426
+ const data2 = isMultiple ? list : list == null ? void 0 : list[0];
427
+ const nextSelectRowKeys = isMultiple ? value : [value];
428
+ if (labelInValue) {
429
+ onChange(data2);
430
+ preValue.current = data2;
431
+ } else {
432
+ onChange(isMultiple ? data2.map((item) => item[valueKey]) : data2[valueKey]);
433
+ preValue.current = isMultiple ? data2.map((item) => item[valueKey]) : data2[valueKey];
434
+ }
435
+ setState({
436
+ _value: data2,
437
+ isInit: false,
438
+ selectedRows: list,
439
+ selectedRowKeys: nextSelectRowKeys
440
+ });
441
+ }
442
+ };
443
+ (0, import_react.useImperativeHandle)(ref, () => ({
444
+ handleClick,
445
+ handleSearch
446
+ }));
447
+ (0, import_ahooks.useMount)(() => {
594
448
  if (!value) {
595
449
  setState({
596
- selectedRowKeys: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || [],
597
- selectedRows: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || [],
598
- _value: undefined
450
+ selectedRowKeys: (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || [],
451
+ selectedRows: (rowSelection == null ? void 0 : rowSelection.selectedRows) || [],
452
+ _value: void 0
599
453
  });
600
- } else if (Object.prototype.toString.call(value) === '[object Array]') {
454
+ } else if ((0, import_lodash.isArray)(value)) {
601
455
  setState({
602
- selectedRowKeys: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || value,
603
- selectedRows: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || value,
456
+ selectedRowKeys: (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || value,
457
+ selectedRows: (rowSelection == null ? void 0 : rowSelection.selectedRows) || value,
604
458
  _value: value
605
459
  });
606
- } else if (Object.prototype.toString.call(value) === '[object Object]') {
607
- var initialValue = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, valueKey, value[valueKey]), labelKey, value[labelKey]);
460
+ } else if ((0, import_lodash.isObject)(value)) {
461
+ const initialValue = { [valueKey]: value[valueKey], [labelKey]: value[labelKey] };
608
462
  setState({
609
463
  selectedRowKeys: [value],
610
464
  selectedRows: [initialValue],
@@ -612,13 +466,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
612
466
  });
613
467
  }
614
468
  });
615
- (0, _react.useEffect)(function () {
469
+ (0, import_react.useEffect)(() => {
470
+ var _a2, _b2;
616
471
  if (onOff && !open) {
617
- var _useRequest$options7;
618
- if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.manual) !== true) {
472
+ if (((_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.manual) !== true) {
619
473
  onReset();
620
474
  }
621
- var nextState = {
475
+ const nextState = {
622
476
  open: true
623
477
  };
624
478
  if (labelInValue) {
@@ -626,113 +480,123 @@ var ProModalSelect = function ProModalSelect(props, ref) {
626
480
  nextState.selectedRowKeys = [];
627
481
  nextState.selectedRows = [];
628
482
  }
629
- if (Object.prototype.toString.call(value) === '[object Object]') {
483
+ if ((0, import_lodash.isObject)(value)) {
630
484
  nextState.selectedRowKeys = [getRowKey(value)];
631
485
  nextState.selectedRows = [value];
632
486
  }
633
- if ((0, _isArray2.default)(value)) {
634
- nextState.selectedRowKeys = value.map(function (item) {
635
- return getRowKey(item);
636
- });
487
+ if ((0, import_lodash.isArray)(value)) {
488
+ nextState.selectedRowKeys = value.map((item) => getRowKey(item));
637
489
  nextState.selectedRows = value;
638
490
  }
639
491
  } else if (value) {
640
- var _list$filter;
641
- var nextSelectedRowKeys = isMultiple ? value : [value];
492
+ const nextSelectedRowKeys = isMultiple ? value : [value];
642
493
  nextState.selectedRowKeys = nextSelectedRowKeys;
643
- var list = options !== null && options !== void 0 ? options : data;
644
- nextState.selectedRows = list === null || list === void 0 ? void 0 : (_list$filter = list.filter) === null || _list$filter === void 0 ? void 0 : _list$filter.call(list, function (item) {
494
+ const list = options ?? data;
495
+ nextState.selectedRows = (_b2 = list == null ? void 0 : list.filter) == null ? void 0 : _b2.call(list, (item) => {
645
496
  return nextSelectedRowKeys.includes(item[valueKey]);
646
497
  });
647
498
  }
648
499
  setState(nextState);
649
500
  }
650
501
  }, [onOff, open, JSON.stringify(value)]);
651
- (0, _react.useEffect)(function () {
652
- (0, _utils.hideTooltipIfOpen)(fieldRef.current, open);
502
+ (0, import_react.useEffect)(() => {
503
+ (0, import_utils.hideTooltipIfOpen)(fieldRef.current, open);
653
504
  }, [open]);
654
- (0, _react.useEffect)(function () {
655
- if (value && !open && isInit && !readOnly) {
505
+ (0, import_react.useEffect)(() => {
506
+ if (value && !open && isInit && nextMode === "input") {
656
507
  getInitValues();
657
508
  }
658
509
  }, [JSON.stringify(value), open, isInit]);
659
- (0, _ahooks.useDebounceEffect)(function () {
660
- if (value && !open && readOnly && (!(0, _isEqual2.default)(value, preValue.current) || (options === null || options === void 0 ? void 0 : options.length) === 0)) {
661
- var _options$some;
510
+ (0, import_ahooks.useDebounceEffect)(() => {
511
+ var _a2;
512
+ if (value && !open && nextMode === "select" && (!(0, import_lodash.isEqual)(value, preValue.current) || (options == null ? void 0 : options.length) === 0)) {
662
513
  preValue.current = value;
663
- var _data3 = labelInValue ? value[valueKey] : value;
664
- var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
665
- return item[valueKey] === _data3;
666
- });
514
+ const data2 = labelInValue ? value[valueKey] : value;
515
+ const isHasValue = (_a2 = options == null ? void 0 : options.some) == null ? void 0 : _a2.call(options, (item) => item[valueKey] === data2);
667
516
  if (isHasValue) {
668
517
  return;
669
518
  }
670
519
  if (useRequest) {
671
- // 加定时器 修复依赖数据同步更新未取到问题
672
- setTimeout(function () {
673
- var params = withPagination ? {
520
+ setTimeout(() => {
521
+ const params = withPagination ? {
674
522
  pageNum: 1,
675
523
  pageSize: 50,
676
- queryBean: (0, _objectSpread5.default)((0, _objectSpread5.default)((0, _objectSpread5.default)({}, defaultParams), initParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : valueKey, _data3))
677
- } : (0, _objectSpread5.default)((0, _objectSpread5.default)((0, _objectSpread5.default)({}, defaultParams), initParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : valueKey, _data3));
678
- var nextParams = transformParams ? transformParams(params) : params;
524
+ queryBean: {
525
+ ...defaultParams,
526
+ ...initParams,
527
+ [searchKey ?? valueKey]: data2
528
+ }
529
+ } : {
530
+ ...defaultParams,
531
+ ...initParams,
532
+ [searchKey ?? valueKey]: data2
533
+ };
534
+ const nextParams = transformParams ? transformParams(params) : params;
679
535
  run(nextParams);
680
536
  }, 300);
681
537
  }
682
538
  }
683
- }, [JSON.stringify(value), open, JSON.stringify(defaultParams), JSON.stringify(initParams), options === null || options === void 0 ? void 0 : options.length]);
684
- var handleSelectFocus = function handleSelectFocus() {
539
+ }, [
540
+ JSON.stringify(value),
541
+ open,
542
+ JSON.stringify(defaultParams),
543
+ JSON.stringify(initParams),
544
+ options == null ? void 0 : options.length
545
+ ]);
546
+ const handleSelectFocus = () => {
685
547
  if (useRequest) {
686
- var queryBean = defaultParams || {};
687
- var params = withPagination ? {
548
+ const queryBean = defaultParams || {};
549
+ const params = withPagination ? {
688
550
  pageNum: 1,
689
551
  pageSize: 50,
690
- queryBean: queryBean
552
+ queryBean
691
553
  } : queryBean;
692
- var nextParams = transformParams ? transformParams(params) : params;
693
- // 减少请求条件一致时,且请求过时,focus的重复请求
694
- if (!(0, _isEqual2.default)(queryBean, defaultParamsRef.current) || !(options === null || options === void 0 ? void 0 : options.length)) {
695
- run(nextParams); // 触发 run 请求
696
- defaultParamsRef.current = queryBean; // 更新缓存
554
+ const nextParams = transformParams ? transformParams(params) : params;
555
+ if (!(0, import_lodash.isEqual)(queryBean, defaultParamsRef.current) || !(options == null ? void 0 : options.length)) {
556
+ run(nextParams);
557
+ defaultParamsRef.current = queryBean;
697
558
  }
698
559
  setState({
699
560
  isInit: false
700
561
  });
701
562
  }
702
563
  };
703
- var handleSelectSearch = (0, _debounce2.default)(function (val) {
564
+ const handleSelectSearch = (0, import_lodash.debounce)((val) => {
704
565
  if (useRequest) {
705
- var queryBean = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, defaultParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
706
- var params = withPagination ? {
566
+ const queryBean = {
567
+ ...defaultParams,
568
+ [searchKey ?? labelKey]: val
569
+ };
570
+ const params = withPagination ? {
707
571
  pageNum: 1,
708
572
  pageSize: 50,
709
- queryBean: queryBean
573
+ queryBean
710
574
  } : queryBean;
711
- var nextParams = transformParams ? transformParams(params) : params;
575
+ const nextParams = transformParams ? transformParams(params) : params;
712
576
  run(nextParams);
713
577
  }
714
- }, 1000);
715
- (0, _ahooks.useDebounceEffect)(function () {
578
+ }, 1e3);
579
+ (0, import_ahooks.useDebounceEffect)(() => {
716
580
  if (!value) {
717
581
  if (defaultOne) {
718
582
  getDefaultOneValues();
719
583
  } else {
720
584
  setState({
721
- _value: undefined,
585
+ _value: void 0,
722
586
  selectedRowKeys: [],
723
587
  selectedRows: []
724
588
  });
725
589
  }
726
590
  }
727
- if (!readOnly) {
728
- if (labelInValue && _value && !(0, _isEqual2.default)(value, _value)) {
591
+ if (nextMode === "input") {
592
+ if (labelInValue && _value && !(0, import_lodash.isEqual)(value, _value)) {
729
593
  setState({
730
594
  _value: value,
731
595
  selectedRowKeys: [],
732
596
  selectedRows: []
733
597
  });
734
598
  }
735
- if (!labelInValue && !(0, _isEqual2.default)(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
599
+ if (!labelInValue && !(0, import_lodash.isEqual)(value, _value == null ? void 0 : _value[valueKey])) {
736
600
  setState({
737
601
  _value: value,
738
602
  selectedRowKeys: [],
@@ -741,161 +605,102 @@ var ProModalSelect = function ProModalSelect(props, ref) {
741
605
  }
742
606
  }
743
607
  }, [value, _value]);
744
- // 加个中间状态Input
745
- var initRender = (0, _jsxRuntime.jsxs)(_antd.Space.Compact, {
746
- style: {
747
- width: '100%'
748
- },
749
- block: true,
750
- children: [readOnly ? (0, _jsxRuntime.jsx)(_index.ProSelect, (0, _objectSpread5.default)({
751
- value: value,
608
+ let initRender = /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { style: { width: "100%" }, block: true }, nextMode === "select" ? /* @__PURE__ */ import_react.default.createElement(
609
+ import__.ProSelect,
610
+ {
611
+ value,
752
612
  onChange: handleSelectValue,
753
- disabled: disabled,
754
- fieldNames: fieldNames,
755
- showCodeName: showCodeName,
756
- labelInValue: labelInValue,
613
+ disabled,
614
+ fieldNames,
615
+ showCodeName,
616
+ labelInValue,
757
617
  dataSource: options,
758
- optionRender: optionRender,
618
+ optionRender,
759
619
  scrollFollowParent: false,
760
- mode: isMultiple ? 'multiple' : undefined,
761
- notFoundContent: selectLoading ? (0, _jsxRuntime.jsx)(_antd.Spin, {
762
- size: "small"
763
- }) : null,
620
+ mode: isMultiple ? "multiple" : void 0,
621
+ notFoundContent: selectLoading ? /* @__PURE__ */ import_react.default.createElement(import_antd.Spin, { size: "small" }) : null,
764
622
  onFocus: handleSelectFocus,
765
623
  onSearch: handleSelectSearch,
766
- style: {
767
- width: isView || disabled ? '100%' : 'calc(100% - 30px)'
768
- }
769
- }, restProps)) : (0, _jsxRuntime.jsx)(_antd.Input, (0, _objectSpread5.default)({
624
+ tooltip: _tooltip,
625
+ style: { width: isView || disabled ? "100%" : "calc(100% - 30px)" },
626
+ ...restProps
627
+ }
628
+ ) : /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { title: _tooltip ? viewText : null, placement: "topLeft" }, /* @__PURE__ */ import_react.default.createElement(
629
+ import_antd.Input,
630
+ {
770
631
  value: viewText,
771
632
  onChange: handleChangeValue,
772
- disabled: disabled,
633
+ disabled,
773
634
  autoComplete: "off",
774
- allowClear: true
775
- }, restProps)), isView || disabled ? null : (0, _jsxRuntime.jsx)(_antd.Button, {
776
- onClick: handleClick,
777
- icon: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
778
- className: "viewSvg",
779
- src: _view.default
780
- })
781
- })]
782
- });
783
- if (customRender && /*#__PURE__*/_react.default.isValidElement(customRender)) {
784
- initRender = (0, _jsxRuntime.jsx)("div", {
785
- className: "pro-modal-select-init",
786
- onClick: handleClick,
787
- children: customRender
788
- });
789
- }
790
- (0, _ahooks.useDeepCompareEffect)(function () {
791
- if (isTooltip && value) {
792
- var dom = document.getElementById(uuid);
793
- dom.addEventListener('mouseover', function (e) {
794
- if (value && e.target.tagName === 'INPUT') {
795
- setState({
796
- open: true
797
- });
798
- }
799
- });
800
- dom.addEventListener('mouseout', function (e) {
801
- if (e.target.tagName === 'INPUT') {
802
- setState({
803
- open: false
804
- });
805
- }
806
- });
807
- return function () {
808
- dom.removeEventListener('mouseover', function (e) {
809
- if (value && e.target.tagName === 'INPUT') {
810
- setState({
811
- open: true
812
- });
813
- }
814
- });
815
- dom.removeEventListener('mouseout', function (e) {
816
- if (e.target.tagName === 'INPUT') {
817
- setState({
818
- open: false
819
- });
820
- }
821
- });
822
- };
635
+ allowClear: true,
636
+ ...restProps
823
637
  }
824
- }, [value, isTooltip]);
825
- (0, _ahooks.useDeepCompareEffect)(function () {
638
+ )), isView || disabled ? null : /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleClick, icon: /* @__PURE__ */ import_react.default.createElement(import_react_svg.ReactSVG, { className: "viewSvg", src: import_view.default }) }));
639
+ if (customRender && import_react.default.isValidElement(customRender)) {
640
+ initRender = /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-modal-select-init", onClick: handleClick }, customRender);
641
+ }
642
+ (0, import_ahooks.useDeepCompareEffect)(() => {
826
643
  setState({
827
- options: (tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource) || []
644
+ options: (tableProps == null ? void 0 : tableProps.dataSource) || []
828
645
  });
829
- }, [tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource]);
830
- // 当搜索条件只有一个时,且为输入框,默认设置suffix
831
- if ((formColumns === null || formColumns === void 0 ? void 0 : formColumns.length) === 1 && (formColumns === null || formColumns === void 0 ? void 0 : (_formColumns$ = formColumns[0]) === null || _formColumns$ === void 0 ? void 0 : _formColumns$.type) === 'Input') {
832
- var _formColumns$2, _formColumns$3, _formColumns$3$fieldP;
833
- if (!((_formColumns$2 = formColumns[0]) === null || _formColumns$2 === void 0 ? void 0 : _formColumns$2.fieldProps)) {
646
+ }, [tableProps == null ? void 0 : tableProps.dataSource]);
647
+ if ((formColumns == null ? void 0 : formColumns.length) === 1 && ((_e = formColumns == null ? void 0 : formColumns[0]) == null ? void 0 : _e.type) === "Input") {
648
+ if (!((_f = formColumns[0]) == null ? void 0 : _f.fieldProps)) {
834
649
  formColumns[0].fieldProps = {};
835
650
  }
836
- if (!(0, _isFunction2.default)(formColumns[0].fieldProps) && !(formColumns === null || formColumns === void 0 ? void 0 : (_formColumns$3 = formColumns[0]) === null || _formColumns$3 === void 0 ? void 0 : (_formColumns$3$fieldP = _formColumns$3.fieldProps) === null || _formColumns$3$fieldP === void 0 ? void 0 : _formColumns$3$fieldP.suffix)) {
837
- formColumns[0].fieldProps.suffix = (0, _jsxRuntime.jsx)(_icons.SearchOutlined, {
838
- onClick: handleSearch
839
- });
651
+ if (!(0, import_lodash.isFunction)(formColumns[0].fieldProps) && !((_h = (_g = formColumns == null ? void 0 : formColumns[0]) == null ? void 0 : _g.fieldProps) == null ? void 0 : _h.suffix)) {
652
+ formColumns[0].fieldProps.suffix = /* @__PURE__ */ import_react.default.createElement(import_icons.SearchOutlined, { onClick: handleSearch });
840
653
  }
841
654
  }
842
655
  if (isView) {
843
656
  if (!value) {
844
- return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
845
- children: viewEmpty
846
- });
657
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, viewEmpty);
847
658
  }
848
- return (0, _jsxRuntime.jsx)(_Container.default, {
849
- viewEmpty: viewEmpty,
850
- children: "".concat(viewText)
851
- });
659
+ return /* @__PURE__ */ import_react.default.createElement(import_Container.default, { viewEmpty }, `${viewText}`);
852
660
  }
853
- var _className = (0, _classnames.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
854
- 'pro-modal-select': true
855
- }, props.className, props.className), 'pro-modal-select-open', open));
856
- return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
857
- children: [(0, _jsxRuntime.jsx)("div", {
858
- id: uuid,
859
- className: _className,
860
- style: style,
861
- ref: fieldRef,
862
- children: isTooltip && viewText ? (0, _jsxRuntime.jsx)(_antd.Tooltip, {
863
- placement: "topLeft",
864
- open: open,
865
- title: viewText,
866
- children: initRender
867
- }) : initRender
868
- }), (0, _jsxRuntime.jsxs)(_index.ProDrawerForm, (0, _objectSpread5.default)((0, _objectSpread5.default)({
869
- showType: "Modal",
870
- title: title,
661
+ const _className = (0, import_classnames.default)({
662
+ "pro-modal-select": true,
663
+ [props.className]: props.className,
664
+ "pro-modal-select-open": open
665
+ });
666
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { id: uuid, className: _className, style, ref: fieldRef }, initRender), /* @__PURE__ */ import_react.default.createElement(
667
+ import__.ProDrawerForm,
668
+ {
669
+ mode: "Modal",
670
+ title,
871
671
  onOk: handleFinish,
872
- // @ts-ignore
873
672
  onCancel: handleClose,
874
- open: open
875
- }, restModalProps), {}, {
876
- children: [(0, _jsxRuntime.jsx)(_index.ProForm, {
673
+ open,
674
+ ...restModalProps
675
+ },
676
+ /* @__PURE__ */ import_react.default.createElement(
677
+ import__.ProForm,
678
+ {
877
679
  submitOnEnter: true,
878
- form: form,
680
+ form,
879
681
  columns: formColumns,
880
682
  onFinish: handleSearch,
881
683
  confirmLoading: loading,
882
- footer: (formColumns === null || formColumns === void 0 ? void 0 : formColumns.length) > 1
883
- }), (0, _jsxRuntime.jsx)(_index.ProTable, (0, _objectSpread5.default)({
884
- onRow: function onRow(record) {
684
+ footer: (formColumns == null ? void 0 : formColumns.length) > 1
685
+ }
686
+ ),
687
+ /* @__PURE__ */ import_react.default.createElement(
688
+ import__.ProTable,
689
+ {
690
+ onRow: (record) => {
885
691
  return {
886
- onClick: function onClick() {
887
- return handleClickRow(record);
888
- }
692
+ onClick: () => handleClickRow(record)
889
693
  };
890
694
  },
891
- rowKey: rowKey,
892
- loading: loading,
695
+ rowKey,
696
+ loading,
893
697
  rowSelection: _rowSelection,
894
- columns: columns,
698
+ columns,
895
699
  dataSource: data,
896
- pagination: withPagination ? pagination : false
897
- }, restTableProps))]
898
- }))]
899
- });
700
+ pagination: withPagination ? pagination : false,
701
+ ...restTableProps
702
+ }
703
+ )
704
+ ));
900
705
  };
901
- var _default = exports.default = /*#__PURE__*/(0, _react.forwardRef)(ProModalSelect);
706
+ var ProModalSelect_default = (0, import_react.forwardRef)(ProModalSelect);