@zat-design/sisyphus-react 4.0.0-beta.3 → 4.0.0-beta.5

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