@zat-design/sisyphus-react 4.5.10-beta.1 → 4.5.10-beta.2

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 (266) hide show
  1. package/es/FormsProvider/index.js +14 -21
  2. package/es/ProAction/components/CheckModalContent/index.js +12 -26
  3. package/es/ProAction/index.js +79 -83
  4. package/es/ProAction/propsType.js +0 -1
  5. package/es/ProConfigProvider/index.js +63 -110
  6. package/es/ProConfigProvider/propsType.js +0 -1
  7. package/es/ProDownload/index.js +55 -65
  8. package/es/ProDownload/propsType.js +0 -1
  9. package/es/ProDownload/utils.js +61 -95
  10. package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
  11. package/es/ProDrawerForm/components/ProModal/index.js +77 -108
  12. package/es/ProDrawerForm/components/index.js +6 -2
  13. package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
  14. package/es/ProDrawerForm/index.js +29 -38
  15. package/es/ProDrawerForm/propsType.js +0 -1
  16. package/es/ProDrawerForm/utils/index.js +18 -36
  17. package/es/ProEditLabel/components/RenderProForm.js +45 -49
  18. package/es/ProEditLabel/index.js +126 -163
  19. package/es/ProEditLabel/propsType.js +0 -1
  20. package/es/ProEditLabel/utils/index.js +5 -8
  21. package/es/ProEditTable/components/ActionButton/index.js +111 -119
  22. package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
  23. package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
  24. package/es/ProEditTable/components/RcTable/index.js +6 -4
  25. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
  26. package/es/ProEditTable/components/RenderField/index.js +490 -587
  27. package/es/ProEditTable/components/RenderField/propsType.js +0 -1
  28. package/es/ProEditTable/components/RenderField/tools.js +115 -112
  29. package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
  30. package/es/ProEditTable/components/Summary/index.js +38 -64
  31. package/es/ProEditTable/components/Validator/index.js +46 -46
  32. package/es/ProEditTable/components/index.js +12 -5
  33. package/es/ProEditTable/index.js +456 -378
  34. package/es/ProEditTable/propsType.js +0 -1
  35. package/es/ProEditTable/utils/config.js +60 -122
  36. package/es/ProEditTable/utils/diffOriginal.js +45 -82
  37. package/es/ProEditTable/utils/getDefaultProps.js +19 -24
  38. package/es/ProEditTable/utils/index.js +150 -236
  39. package/es/ProEditTable/utils/tools.js +149 -286
  40. package/es/ProEditTable/utils/transform.js +25 -30
  41. package/es/ProEditTable/utils/useEditTableError.js +30 -43
  42. package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
  43. package/es/ProEditTable/utils/validateAll.js +87 -154
  44. package/es/ProEnum/components/Group.js +38 -30
  45. package/es/ProEnum/components/Tag.js +22 -26
  46. package/es/ProEnum/hooks/useEnum.js +48 -116
  47. package/es/ProEnum/hooks/useEnumRequest.js +128 -179
  48. package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
  49. package/es/ProEnum/index.js +162 -172
  50. package/es/ProEnum/propsType.js +0 -1
  51. package/es/ProEnum/utils/eventCenter.js +10 -12
  52. package/es/ProEnum/utils/frequentEnum.js +35 -92
  53. package/es/ProEnum/utils/getEnum.js +32 -90
  54. package/es/ProEnum/utils/getEnumLabel.js +44 -49
  55. package/es/ProEnum/utils/index.js +93 -207
  56. package/es/ProForm/components/Container.js +13 -28
  57. package/es/ProForm/components/FormFooter/index.js +36 -44
  58. package/es/ProForm/components/FormFooter/propsType.js +0 -1
  59. package/es/ProForm/components/base/Checkbox/index.js +32 -59
  60. package/es/ProForm/components/base/DatePicker/index.js +49 -71
  61. package/es/ProForm/components/base/Input/index.js +63 -97
  62. package/es/ProForm/components/base/Input/propsType.js +0 -1
  63. package/es/ProForm/components/base/InputNumber/index.js +118 -172
  64. package/es/ProForm/components/base/Radio/index.js +39 -52
  65. package/es/ProForm/components/base/RangePicker/index.js +109 -127
  66. package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
  67. package/es/ProForm/components/base/Select/index.js +63 -89
  68. package/es/ProForm/components/base/Switch/index.js +27 -35
  69. package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
  70. package/es/ProForm/components/base/TextArea/index.js +30 -41
  71. package/es/ProForm/components/base/TimePicker/index.js +27 -37
  72. package/es/ProForm/components/combination/Container/index.js +37 -47
  73. package/es/ProForm/components/combination/Container/propsType.js +0 -1
  74. package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
  75. package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -103
  76. package/es/ProForm/components/combination/FormList/components/Empty.js +27 -54
  77. package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
  78. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
  79. package/es/ProForm/components/combination/FormList/index.js +151 -161
  80. package/es/ProForm/components/combination/FormList/propsType.js +0 -1
  81. package/es/ProForm/components/combination/FormList/utils.js +22 -38
  82. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
  83. package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
  84. package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +105 -206
  85. package/es/ProForm/components/combination/Group/hooks/index.js +68 -128
  86. package/es/ProForm/components/combination/Group/index.js +87 -126
  87. package/es/ProForm/components/combination/Group/propsType.js +0 -1
  88. package/es/ProForm/components/combination/Group/utils/index.js +124 -239
  89. package/es/ProForm/components/combination/ProCascader/index.js +156 -199
  90. package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
  91. package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
  92. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +63 -75
  93. package/es/ProForm/components/combination/ProModalSelect/index.js +290 -348
  94. package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
  95. package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
  96. package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
  97. package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
  98. package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
  99. package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
  100. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
  101. package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
  102. package/es/ProForm/components/index.js +56 -34
  103. package/es/ProForm/components/render/ChangedWrapper.js +85 -94
  104. package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
  105. package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
  106. package/es/ProForm/components/render/Render.js +223 -329
  107. package/es/ProForm/components/render/RenderFields.js +76 -113
  108. package/es/ProForm/components/render/propsType.js +0 -1
  109. package/es/ProForm/hooks/useControlled.js +8 -10
  110. package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
  111. package/es/ProForm/hooks/useFieldProps.js +8 -4
  112. package/es/ProForm/hooks/useForm.js +50 -110
  113. package/es/ProForm/hooks/useRules.js +17 -33
  114. package/es/ProForm/hooks/useShouldUpdate.js +77 -152
  115. package/es/ProForm/hooks/useWatch.js +58 -129
  116. package/es/ProForm/index.js +157 -194
  117. package/es/ProForm/propsType.js +15 -7
  118. package/es/ProForm/utils/buildFormItemProps.js +51 -58
  119. package/es/ProForm/utils/diffOriginal.js +43 -73
  120. package/es/ProForm/utils/getDefaultProps.js +18 -24
  121. package/es/ProForm/utils/index.js +159 -234
  122. package/es/ProForm/utils/processDependencies.js +21 -60
  123. package/es/ProForm/utils/reactiveValues.js +20 -34
  124. package/es/ProForm/utils/rulesCreator.js +42 -40
  125. package/es/ProForm/utils/transformNames.js +10 -13
  126. package/es/ProForm/utils/transformValue.js +16 -29
  127. package/es/ProForm/utils/valueType.js +96 -178
  128. package/es/ProIcon/config/index.js +340 -274
  129. package/es/ProIcon/index.js +135 -209
  130. package/es/ProIcon/propsTypes.js +0 -1
  131. package/es/ProIcon/utils/index.js +24 -39
  132. package/es/ProLayout/components/Layout/Header/index.js +108 -141
  133. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
  134. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +111 -137
  135. package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
  136. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
  137. package/es/ProLayout/components/Layout/Menu/index.js +92 -89
  138. package/es/ProLayout/components/Layout/Notice/index.js +13 -27
  139. package/es/ProLayout/components/Layout/index.js +8 -3
  140. package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
  141. package/es/ProLayout/components/ProCollapse/index.js +89 -111
  142. package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
  143. package/es/ProLayout/components/ProFooter/index.js +27 -25
  144. package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
  145. package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
  146. package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -86
  147. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
  148. package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
  149. package/es/ProLayout/components/ProHeader/components/index.js +6 -2
  150. package/es/ProLayout/components/ProHeader/index.js +216 -356
  151. package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
  152. package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
  153. package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -64
  154. package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
  155. package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
  156. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
  157. package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
  158. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
  159. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
  160. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +290 -408
  161. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +132 -95
  162. package/es/ProLayout/components/TabsManager/index.js +406 -390
  163. package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
  164. package/es/ProLayout/components/TabsManager/utils/historyObserver.js +26 -23
  165. package/es/ProLayout/components/TabsManager/utils/index.js +127 -184
  166. package/es/ProLayout/components/index.js +8 -3
  167. package/es/ProLayout/index.js +171 -229
  168. package/es/ProLayout/propTypes.js +12 -52
  169. package/es/ProLayout/utils/index.js +48 -128
  170. package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
  171. package/es/ProSelect/index.js +184 -229
  172. package/es/ProSelect/propsType.js +0 -1
  173. package/es/ProSelect/utils/index.js +100 -146
  174. package/es/ProStep/components/Anchor/index.js +71 -82
  175. package/es/ProStep/components/Item/index.js +49 -56
  176. package/es/ProStep/components/LazyLoad/index.js +23 -29
  177. package/es/ProStep/components/Listener/index.js +20 -33
  178. package/es/ProStep/components/Step/index.js +31 -38
  179. package/es/ProStep/constants.js +4 -1
  180. package/es/ProStep/index.js +166 -153
  181. package/es/ProStep/propsType.js +0 -1
  182. package/es/ProStep/utils/index.js +29 -55
  183. package/es/ProStepTab/index.js +83 -138
  184. package/es/ProStepTab/propsType.js +0 -1
  185. package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
  186. package/es/ProTable/components/EditableCell/index.js +37 -71
  187. package/es/ProTable/components/EditableCell/propsType.js +0 -1
  188. package/es/ProTable/components/FormatColumn/index.js +209 -340
  189. package/es/ProTable/components/FormatColumn/propsType.js +0 -1
  190. package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
  191. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
  192. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
  193. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
  194. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
  195. package/es/ProTable/components/RcTable/index.js +6 -4
  196. package/es/ProTable/components/RenderColumn/index.js +158 -186
  197. package/es/ProTable/components/RenderEmptyText/index.js +12 -21
  198. package/es/ProTable/components/RenderFooter/index.js +15 -15
  199. package/es/ProTable/components/RenderSummary/index.js +33 -50
  200. package/es/ProTable/components/RenderTableHeader/index.js +44 -46
  201. package/es/ProTable/components/RenderTabs/index.js +47 -51
  202. package/es/ProTable/components/TableResizable/index.js +56 -72
  203. package/es/ProTable/components/TooltipTitle/index.js +13 -21
  204. package/es/ProTable/components/index.js +16 -36
  205. package/es/ProTable/hooks/useAntdTable.js +185 -219
  206. package/es/ProTable/index.js +232 -249
  207. package/es/ProTable/propsType.js +0 -1
  208. package/es/ProTable/utils/columnStorage.js +63 -88
  209. package/es/ProTable/utils/index.js +57 -90
  210. package/es/ProTabs/components/Card/index.js +20 -48
  211. package/es/ProTabs/components/index.js +4 -1
  212. package/es/ProTabs/index.js +39 -56
  213. package/es/ProTabs/propType.js +0 -1
  214. package/es/ProThemeTools/component/ProTools/index.js +106 -158
  215. package/es/ProThemeTools/component/index.js +4 -1
  216. package/es/ProThemeTools/context/ThemeContext.js +67 -146
  217. package/es/ProThemeTools/index.js +103 -156
  218. package/es/ProThemeTools/propsType.js +0 -1
  219. package/es/ProThemeTools/utils/index.js +60 -109
  220. package/es/ProTooltip/index.js +132 -165
  221. package/es/ProTooltip/propsType.js +0 -1
  222. package/es/ProTree/components/AdaptiveTooltip.js +15 -17
  223. package/es/ProTree/components/CloseIcon.js +18 -26
  224. package/es/ProTree/components/List.js +28 -47
  225. package/es/ProTree/components/ProTree.js +152 -211
  226. package/es/ProTree/components/ProTreeSelect/index.js +254 -458
  227. package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
  228. package/es/ProTree/components/SearchTitle.js +23 -42
  229. package/es/ProTree/components/Tree.js +147 -195
  230. package/es/ProTree/components/index.js +10 -5
  231. package/es/ProTree/index.js +12 -16
  232. package/es/ProTree/propsType.js +0 -1
  233. package/es/ProTree/utils.js +46 -118
  234. package/es/ProTreeModal/components/Cascader.js +56 -64
  235. package/es/ProTreeModal/components/CloseIcon.js +18 -26
  236. package/es/ProTreeModal/components/List.js +114 -180
  237. package/es/ProTreeModal/components/SearchTitle.js +15 -18
  238. package/es/ProTreeModal/components/SortableItem.js +29 -58
  239. package/es/ProTreeModal/components/Tree.js +99 -113
  240. package/es/ProTreeModal/components/Trigger.js +87 -121
  241. package/es/ProTreeModal/components/index.js +14 -6
  242. package/es/ProTreeModal/index.js +397 -435
  243. package/es/ProTreeModal/propsType.js +0 -1
  244. package/es/ProTreeModal/utils.js +52 -95
  245. package/es/ProUpload/components/ButtonRender.js +44 -54
  246. package/es/ProUpload/components/DragRender.js +94 -134
  247. package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
  248. package/es/ProUpload/components/Example.js +27 -31
  249. package/es/ProUpload/components/FileItem.js +69 -163
  250. package/es/ProUpload/components/ImageRender.js +134 -170
  251. package/es/ProUpload/index.js +68 -100
  252. package/es/ProUpload/propsType.js +0 -1
  253. package/es/ProUpload/uitls.js +8 -4
  254. package/es/ProUtils/utils/index.js +17 -13
  255. package/es/ProViewer/index.js +154 -175
  256. package/es/ProViewer/propsType.js +0 -5
  257. package/es/ProWaterMark/index.js +9 -16
  258. package/es/ProWaterMark/propsType.js +0 -1
  259. package/es/hooks/useDraggableRow.js +25 -53
  260. package/es/index.js +57 -77
  261. package/es/locale/en_US.js +153 -142
  262. package/es/locale/index.js +23 -36
  263. package/es/locale/zh_CN.js +145 -142
  264. package/es/tokens.js +84 -83
  265. package/es/utils/index.js +24 -51
  266. package/package.json +4 -3
@@ -1,15 +1,22 @@
1
- import _isObject from "lodash/isObject";
2
- import _isFunction from "lodash/isFunction";
3
- import _isEqual from "lodash/isEqual";
4
- import _isBoolean from "lodash/isBoolean";
5
- import _isArray from "lodash/isArray";
6
- import _debounce from "lodash/debounce";
7
- import { SearchOutlined } from '@ant-design/icons';
8
- import { useDebounceEffect, useDeepCompareEffect, useMount, useSetState } from 'ahooks';
9
- import { Form, message, Input, Tooltip, Space, Button, Spin } from 'antd';
10
- import classNames from 'classnames';
11
- import { ReactSVG } from 'react-svg';
12
- import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { SearchOutlined } from "@ant-design/icons";
3
+ import { useDebounceEffect, useDeepCompareEffect, useMount, useSetState } from "ahooks";
4
+ import { Form, message, Input, Tooltip, Space, Button, Spin } from "antd";
5
+ import debounce from "lodash/debounce";
6
+ import isArray from "lodash/isArray";
7
+ import isBoolean from "lodash/isBoolean";
8
+ import isEqual from "lodash/isEqual";
9
+ import isFunction from "lodash/isFunction";
10
+ import isObject from "lodash/isObject";
11
+ import classNames from "classnames";
12
+ import { ReactSVG } from "react-svg";
13
+ import React, {
14
+ forwardRef,
15
+ useEffect,
16
+ useImperativeHandle,
17
+ useMemo,
18
+ useRef
19
+ } from "react";
13
20
  import { ProForm, ProDrawerForm, ProTable, useProConfig, ProSelect } from "../../../../index";
14
21
  import Container from "../../Container";
15
22
  import viewSvg from "../../../../assets/view.svg";
@@ -17,8 +24,8 @@ import useRequestList from "./hooks/useRequestList";
17
24
  import locale from "../../../../locale";
18
25
  import { hideTooltipIfOpen, mergeSelectedRows } from "./utils";
19
26
  import { generateId } from "../../../../utils";
20
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
21
27
  const ProModalSelect = (props, ref) => {
28
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
22
29
  const {
23
30
  value,
24
31
  onChange,
@@ -26,7 +33,7 @@ const ProModalSelect = (props, ref) => {
26
33
  labelInValue = false,
27
34
  fieldNames,
28
35
  readOnly = true,
29
- mode = 'select',
36
+ mode = "select",
30
37
  addonAfter,
31
38
  configOption,
32
39
  title,
@@ -48,17 +55,17 @@ const ProModalSelect = (props, ref) => {
48
55
  } = props;
49
56
  const _tooltip = tooltip ?? isTooltip;
50
57
  const nextMode = useMemo(() => {
51
- if (_isBoolean(readOnly) && readOnly === false) {
52
- return 'input';
58
+ if (isBoolean(readOnly) && readOnly === false) {
59
+ return "input";
53
60
  }
54
61
  return mode;
55
62
  }, [mode, readOnly]);
56
63
  const contentForm = Form.useFormInstance();
57
- if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
58
- throw new Error('error: 请检查枚举选择弹框的配置项【configOption】');
64
+ if (!configOption || Object.prototype.toString.call(configOption) !== "[object Object]") {
65
+ throw new Error("error: 请检查枚举选择弹框的配置项【configOption】");
59
66
  }
60
67
  const {
61
- type = 'radio',
68
+ type = "radio",
62
69
  useRequest,
63
70
  transformParams,
64
71
  transformResponse,
@@ -67,155 +74,124 @@ const ProModalSelect = (props, ref) => {
67
74
  modalProps,
68
75
  tableProps
69
76
  } = configOption;
70
- const {
71
- onOk,
72
- ...restModalProps
73
- } = modalProps || {};
74
- const {
75
- isView: isViewCon,
76
- viewEmpty
77
- } = ProForm.useFieldProps() || {};
78
- const isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
79
-
80
- // 是否多选
81
- const isMultiple = type === 'checkbox';
82
-
83
- // 生成一个唯一id,用于满足tooltip功能
77
+ const { onOk, ...restModalProps } = modalProps || {};
78
+ const { isView: isViewCon, viewEmpty } = ProForm.useFieldProps() || {};
79
+ const isView = typeof props.isView === "boolean" ? props.isView : isViewCon;
80
+ const isMultiple = type === "checkbox";
84
81
  const uuid = generateId();
85
-
86
- // 全局配置fieldNames指定 value与label的key
87
- const {
88
- fieldNames: proModalSelectFieldNames = {}
89
- } = useProConfig('ProModalSelect') || {};
90
- let labelKey = 'label';
91
- let valueKey = 'value';
82
+ const { fieldNames: proModalSelectFieldNames = {} } = useProConfig("ProModalSelect") || {};
83
+ let labelKey = "label";
84
+ let valueKey = "value";
92
85
  if (proModalSelectFieldNames && Object.keys(proModalSelectFieldNames).length) {
93
86
  labelKey = proModalSelectFieldNames.label;
94
87
  valueKey = proModalSelectFieldNames.value;
95
88
  }
96
-
97
- // 表单上配置的权重大于全局配置
98
89
  if (fieldNames && Object.keys(fieldNames).length) {
99
90
  labelKey = fieldNames.label;
100
91
  valueKey = fieldNames.value;
101
92
  }
102
- const {
103
- rowKey = valueKey,
104
- columns,
105
- rowSelection,
106
- ...restTableProps
107
- } = tableProps || {};
93
+ const { rowKey = valueKey, columns, rowSelection, ...restTableProps } = tableProps || {};
108
94
  const preValue = useRef(value);
109
- // 表单项的ref
110
95
  const fieldRef = useRef(null);
111
- const defaultParams = Array.isArray(useRequest?.options?.defaultParams) ? useRequest?.options?.defaultParams?.[0] : useRequest?.options?.defaultParams || {};
112
- const defaultParamsRef = useRef(defaultParams); // 缓存 defaultParams 的引用
113
-
114
- const [{
115
- _value,
116
- isInit,
117
- onOff,
118
- open,
119
- options,
120
- selectedRows: _selectedRows,
121
- selectedRowKeys: _selectedRowKeys
122
- }, setState] = useSetState({
96
+ 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) || {};
97
+ const defaultParamsRef = useRef(defaultParams);
98
+ const [
99
+ {
100
+ _value,
101
+ isInit,
102
+ onOff,
103
+ open,
104
+ options,
105
+ selectedRows: _selectedRows,
106
+ selectedRowKeys: _selectedRowKeys
107
+ },
108
+ setState
109
+ ] = useSetState({
123
110
  _value: value,
124
111
  isInit: true,
125
112
  onOff: false,
126
113
  open: false,
127
- options: tableProps?.dataSource || [],
114
+ options: (tableProps == null ? void 0 : tableProps.dataSource) || [],
128
115
  selectedRows: [],
129
116
  selectedRowKeys: []
130
117
  });
131
118
  const [form] = Form.useForm(searchForm);
132
- const selectedRows = rowSelection?.selectedRows || _selectedRows;
133
- const selectedRowKeys = rowSelection?.selectedRowKeys || _selectedRowKeys;
134
- const {
135
- run,
136
- loading: selectLoading
137
- } = useRequestList(useRequest?.service, {
138
- withPagination,
139
- transformParams,
140
- transformResponse
141
- }, {
142
- ...useRequest?.options,
143
- manual: true,
144
- onSuccess(res) {
145
- const list = withPagination ? res?.data?.list : res?.data;
146
- setState({
147
- options: (transformResponse ? transformResponse(res?.data) : list) ?? []
148
- });
119
+ const selectedRows = (rowSelection == null ? void 0 : rowSelection.selectedRows) || _selectedRows;
120
+ const selectedRowKeys = (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || _selectedRowKeys;
121
+ const { run, loading: selectLoading } = useRequestList(
122
+ useRequest == null ? void 0 : useRequest.service,
123
+ {
124
+ withPagination,
125
+ transformParams,
126
+ transformResponse
127
+ },
128
+ {
129
+ ...useRequest == null ? void 0 : useRequest.options,
130
+ manual: true,
131
+ onSuccess(res) {
132
+ var _a2;
133
+ const list = withPagination ? (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.list : res == null ? void 0 : res.data;
134
+ setState({
135
+ options: (transformResponse ? transformResponse(res == null ? void 0 : res.data) : list) ?? []
136
+ });
137
+ }
149
138
  }
150
- });
139
+ );
151
140
  const initParams = useMemo(() => {
152
- let nextInitParams = useRequest?.initParams;
153
- if (typeof useRequest?.initParams === 'function') {
154
- nextInitParams = useRequest?.initParams(value, contentForm?.getFieldsValue?.());
141
+ var _a2;
142
+ let nextInitParams = useRequest == null ? void 0 : useRequest.initParams;
143
+ if (typeof (useRequest == null ? void 0 : useRequest.initParams) === "function") {
144
+ nextInitParams = useRequest == null ? void 0 : useRequest.initParams(value, (_a2 = contentForm == null ? void 0 : contentForm.getFieldsValue) == null ? void 0 : _a2.call(contentForm));
155
145
  }
156
146
  return nextInitParams;
157
147
  }, [value]);
158
- const {
159
- data,
160
- loading,
161
- pagination,
162
- onSearch,
163
- onReset,
164
- runAsync,
165
- mutate
166
- } = useRequestList(useRequest?.service, {
167
- withPagination,
168
- transformParams,
169
- transformResponse
170
- }, {
171
- ...useRequest?.options,
172
- ready: useRequest?.options?.ready ?? ((initParams || defaultOne) && nextMode === 'input' ? true : undefined),
173
- manual: useRequest?.options?.manual ?? ((initParams || defaultOne) && nextMode === 'input' ? undefined : true)
174
- });
175
- const defaultOptionRender = rowData => rowData?.[labelKey];
148
+ const { data, loading, pagination, onSearch, onReset, runAsync, mutate } = useRequestList(
149
+ useRequest == null ? void 0 : useRequest.service,
150
+ {
151
+ withPagination,
152
+ transformParams,
153
+ transformResponse
154
+ },
155
+ {
156
+ ...useRequest == null ? void 0 : useRequest.options,
157
+ ready: ((_e = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _e.ready) ?? ((initParams || defaultOne) && nextMode === "input" ? true : void 0),
158
+ manual: ((_f = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _f.manual) ?? ((initParams || defaultOne) && nextMode === "input" ? void 0 : true)
159
+ }
160
+ );
161
+ const defaultOptionRender = (rowData) => rowData == null ? void 0 : rowData[labelKey];
176
162
  let handleFormat = onFormat || defaultOptionRender;
177
163
  if (showCodeName) {
178
- handleFormat = ({
179
- value,
180
- label
181
- }) => `${value}-${label}`;
164
+ handleFormat = ({ value: value2, label }) => `${value2}-${label}`;
182
165
  }
183
-
184
- /**
185
- * 格式化数据方法,展示在输入框中
186
- * @date 2023-02-16
187
- * @param {any} data 当前选中的值 labelInValue模式下为选中行对象,单值模式为value值
188
- * @returns {any}
189
- */
190
- const formatValue = data => {
191
- if (typeof data === 'string' || typeof data === 'number') {
192
- return data;
166
+ const formatValue = (data2) => {
167
+ if (typeof data2 === "string" || typeof data2 === "number") {
168
+ return data2;
193
169
  }
194
- // lodash isObject 对数组也为 true,必须先判数组,否则多选展示永远走对象臂
195
- if (_isArray(data)) {
196
- return data.map(item => {
170
+ if (isArray(data2)) {
171
+ return data2.map((item) => {
197
172
  return handleFormat({
198
173
  ...item,
199
174
  value: item[valueKey],
200
175
  label: item[labelKey]
201
176
  });
202
- }).join('、');
177
+ }).join("、");
203
178
  }
204
- if (_isObject(data)) {
179
+ if (isObject(data2)) {
205
180
  return handleFormat({
206
- ...data,
207
- value: data[valueKey],
208
- label: data[labelKey]
181
+ ...data2,
182
+ value: data2[valueKey],
183
+ label: data2[labelKey]
209
184
  });
210
185
  }
211
- return '';
186
+ return "";
212
187
  };
213
188
  const viewText = useMemo(() => {
189
+ var _a2;
214
190
  let nextValue = labelInValue ? value : _value;
215
191
  if (labelInValue) {
216
192
  nextValue = value;
217
193
  } else {
218
- const optionDTO = options?.find?.(item => item[valueKey] === value);
194
+ const optionDTO = (_a2 = options == null ? void 0 : options.find) == null ? void 0 : _a2.call(options, (item) => item[valueKey] === value);
219
195
  if (optionDTO) {
220
196
  nextValue = optionDTO;
221
197
  } else {
@@ -224,36 +200,22 @@ const ProModalSelect = (props, ref) => {
224
200
  }
225
201
  return formatValue(nextValue);
226
202
  }, [value, _value, options]);
227
-
228
- /**
229
- * 获取表格的rowKey,支持函数、字符串
230
- * @date 2023-02-16
231
- * @param {any} record 表格行数据
232
- * @returns {any}
233
- */
234
- const getRowKey = record => {
235
- if (_isFunction(rowKey)) {
203
+ const getRowKey = (record) => {
204
+ if (isFunction(rowKey)) {
236
205
  return rowKey(record);
237
206
  }
238
207
  return record[rowKey];
239
208
  };
240
-
241
- /**
242
- * 执行onChange暴露出来的第一个参数取数方法
243
- * @date 2023-02-16
244
- * @param {any} selectedRows 选中行数据
245
- * @returns {any}
246
- */
247
- const getNextValues = selectedRows => {
209
+ const getNextValues = (selectedRows2) => {
248
210
  if (isMultiple) {
249
- return selectedRows.map(item => item?.[valueKey]);
211
+ return selectedRows2.map((item) => item == null ? void 0 : item[valueKey]);
250
212
  }
251
- return selectedRows?.[valueKey];
213
+ return selectedRows2 == null ? void 0 : selectedRows2[valueKey];
252
214
  };
253
- const handleChangeValue = e => {
215
+ const handleChangeValue = (e) => {
254
216
  onChange(e.target.value);
255
217
  preValue.current = e.target.value;
256
- if (nextMode === 'input') {
218
+ if (nextMode === "input") {
257
219
  setState({
258
220
  _value: e.target.value
259
221
  });
@@ -265,13 +227,13 @@ const ProModalSelect = (props, ref) => {
265
227
  };
266
228
  const handleClick = async () => {
267
229
  if (!disabled) {
268
- const res = (await beforeOpen?.()) ?? true;
230
+ const res = await (beforeOpen == null ? void 0 : beforeOpen()) ?? true;
269
231
  if (res) {
270
232
  setState({
271
233
  onOff: true
272
234
  });
273
235
  setTimeout(() => {
274
- afterOpen?.({
236
+ afterOpen == null ? void 0 : afterOpen({
275
237
  setInnerState: setState
276
238
  });
277
239
  }, 100);
@@ -279,57 +241,51 @@ const ProModalSelect = (props, ref) => {
279
241
  }
280
242
  };
281
243
  const handleClose = () => {
244
+ var _a2;
282
245
  form.resetFields();
283
246
  setState({
284
247
  onOff: false,
285
248
  open: false,
286
249
  isInit: false
287
250
  });
288
-
289
- // 当设置manual为true时,清空当前弹框内已搜索出来的值
290
- if (useRequest?.options?.manual) {
251
+ if ((_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.manual) {
291
252
  mutate(() => []);
292
253
  }
293
254
  };
294
255
  const handleFinish = async () => {
295
256
  try {
296
- if (!selectedRowKeys?.length || !selectedRows?.length) {
257
+ if (!(selectedRowKeys == null ? void 0 : selectedRowKeys.length) || !(selectedRows == null ? void 0 : selectedRows.length)) {
297
258
  message.error(locale.ProModalSelect.checkMsg);
298
259
  return false;
299
260
  }
300
261
  let nextSelectedRows = selectedRows;
301
- if (!nextSelectedRows?.[0]) {
302
- nextSelectedRows = data.filter(item => selectedRowKeys.includes(item[valueKey]));
262
+ if (!(nextSelectedRows == null ? void 0 : nextSelectedRows[0])) {
263
+ nextSelectedRows = data.filter((item) => selectedRowKeys.includes(item[valueKey]));
303
264
  }
304
- const record = isMultiple ? nextSelectedRows : nextSelectedRows?.[0];
265
+ const record = isMultiple ? nextSelectedRows : nextSelectedRows == null ? void 0 : nextSelectedRows[0];
305
266
  if (!isMultiple) {
306
- // @ts-ignore
307
267
  record.value = record[valueKey];
308
- // @ts-ignore
309
268
  record.label = record[labelKey];
310
269
  }
311
270
  let flag = true;
312
271
  if (onOk) {
313
- // @ts-ignore
314
272
  const res = await onOk(record);
315
- if (res !== null && res !== undefined) {
316
- // @ts-ignore
273
+ if (res !== null && res !== void 0) {
317
274
  flag = res;
318
275
  }
319
276
  }
320
277
  if (flag) {
321
- onChange?.(labelInValue ? record : getNextValues(record), record);
278
+ onChange == null ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
322
279
  preValue.current = labelInValue ? record : getNextValues(record);
323
- // 更新内部展示值
324
280
  setState({
325
281
  _value: record,
326
- options: _isArray(record) ? record : [record]
282
+ options: isArray(record) ? record : [record]
327
283
  });
328
284
  handleClose();
329
285
  }
330
286
  return flag;
331
287
  } catch (error) {
332
- console.warn('error', error);
288
+ console.warn("error", error);
333
289
  }
334
290
  };
335
291
  const handleSearch = async () => {
@@ -341,8 +297,8 @@ const ProModalSelect = (props, ref) => {
341
297
  };
342
298
  const handleReset = () => {
343
299
  form.resetFields();
344
- formColumns?.forEach(column => {
345
- if (column?.name !== undefined && Object.prototype.hasOwnProperty.call(column, 'initialValue')) {
300
+ formColumns == null ? void 0 : formColumns.forEach((column) => {
301
+ if ((column == null ? void 0 : column.name) !== void 0 && Object.prototype.hasOwnProperty.call(column, "initialValue")) {
346
302
  form.setFieldValue(column.name, column.initialValue);
347
303
  }
348
304
  });
@@ -356,33 +312,32 @@ const ProModalSelect = (props, ref) => {
356
312
  // 多选时开启,保证翻页/筛选后不丢弃不在当前页的已选 key
357
313
  preserveSelectedRowKeys: isMultiple,
358
314
  onChange: (rowKeys, rows) => {
359
- // 多选时合并跨页已选行:antd 回传的 rows 中不在当前页的为 undefined,用历史 selectedRows 补全
360
315
  const nextSelectedRows = isMultiple ? mergeSelectedRows(selectedRows, rowKeys, rows, getRowKey) : rows;
361
316
  setState({
362
317
  selectedRowKeys: rowKeys,
363
318
  selectedRows: nextSelectedRows
364
319
  });
365
320
  },
366
- getCheckboxProps: record => ({
367
- disabled: record?.disabled
321
+ getCheckboxProps: (record) => ({
322
+ disabled: record == null ? void 0 : record.disabled
368
323
  }),
369
324
  selectedRowKeys,
370
325
  selectedRows,
371
326
  ...rowSelection
372
327
  };
373
-
374
- // 点击行进行勾选
375
- const handleClickRow = record => {
376
- if (_rowSelection?.getCheckboxProps?.(record)?.disabled) {
328
+ const handleClickRow = (record) => {
329
+ var _a2, _b2;
330
+ if ((_b2 = (_a2 = _rowSelection == null ? void 0 : _rowSelection.getCheckboxProps) == null ? void 0 : _a2.call(_rowSelection, record)) == null ? void 0 : _b2.disabled) {
377
331
  return;
378
332
  }
379
- if (record?.disabled) return;
333
+ if (record == null ? void 0 : record.disabled)
334
+ return;
380
335
  const selectedValue = getRowKey(record);
381
336
  let tempSelectedRows = [...selectedRows];
382
337
  let tempSelectedRowKeys = [...selectedRowKeys];
383
338
  if (isMultiple) {
384
- const rowIndex = tempSelectedRows.findIndex(item => getRowKey(item) === selectedValue);
385
- const rowKeyIndex = tempSelectedRowKeys.findIndex(item => item === selectedValue);
339
+ const rowIndex = tempSelectedRows.findIndex((item) => getRowKey(item) === selectedValue);
340
+ const rowKeyIndex = tempSelectedRowKeys.findIndex((item) => item === selectedValue);
386
341
  if (rowKeyIndex > -1) {
387
342
  tempSelectedRows.splice(rowIndex, 1);
388
343
  tempSelectedRowKeys.splice(rowKeyIndex, 1);
@@ -399,18 +354,17 @@ const ProModalSelect = (props, ref) => {
399
354
  selectedRowKeys: tempSelectedRowKeys
400
355
  });
401
356
  };
402
-
403
- // 初始化回显,当传入initParams时,前端用来回险
404
357
  const getInitValues = async () => {
358
+ var _a2, _b2;
405
359
  if (initParams || defaultOne) {
406
360
  const queryBean = {
407
361
  ...defaultParams,
408
- ...(initParams || {})
362
+ ...initParams || {}
409
363
  };
410
364
  const page = {
411
365
  pageNum: 1,
412
366
  pageSize: 10,
413
- ...useRequest?.options?.page
367
+ ...(_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.page
414
368
  };
415
369
  let params = withPagination ? {
416
370
  ...page,
@@ -418,27 +372,25 @@ const ProModalSelect = (props, ref) => {
418
372
  } : queryBean;
419
373
  params = transformParams ? transformParams(params) : params;
420
374
  const res = await runAsync(params);
421
- if (res?.data) {
422
- let list = withPagination ? res?.data?.list : res?.data;
375
+ if (res == null ? void 0 : res.data) {
376
+ let list = withPagination ? (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.list : res == null ? void 0 : res.data;
423
377
  if (transformResponse) {
424
- list = transformResponse(res?.data);
378
+ list = transformResponse(res == null ? void 0 : res.data);
425
379
  }
426
- const data = isMultiple ? list : list?.[0];
427
- if (data) {
380
+ const data2 = isMultiple ? list : list == null ? void 0 : list[0];
381
+ if (data2) {
428
382
  const nextSelectRowKeys = isMultiple ? value : [value];
429
383
  if (labelInValue) {
430
- onChange(data);
431
- preValue.current = data;
384
+ onChange(data2);
385
+ preValue.current = data2;
432
386
  }
433
- // 更新内部展示值
434
387
  setState({
435
- _value: data,
388
+ _value: data2,
436
389
  isInit: false,
437
390
  selectedRows: list,
438
391
  selectedRowKeys: nextSelectRowKeys
439
392
  });
440
- } else if (nextMode === 'input') {
441
- // 当传入initParams且文本框非只读时,不调用接口获取初始化数据
393
+ } else if (nextMode === "input") {
442
394
  setState({
443
395
  _value: value,
444
396
  isInit: false
@@ -447,16 +399,15 @@ const ProModalSelect = (props, ref) => {
447
399
  }
448
400
  }
449
401
  };
450
-
451
- // 初始化回显,当传入initParams时,前端用来回险
452
402
  const getDefaultOneValues = async () => {
403
+ var _a2, _b2;
453
404
  const queryBean = {
454
405
  ...defaultParams
455
406
  };
456
407
  const page = {
457
408
  pageNum: 1,
458
409
  pageSize: 10,
459
- ...useRequest?.options?.page
410
+ ...(_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.page
460
411
  };
461
412
  let params = withPagination ? {
462
413
  ...page,
@@ -464,23 +415,22 @@ const ProModalSelect = (props, ref) => {
464
415
  } : queryBean;
465
416
  params = transformParams ? transformParams(params) : params;
466
417
  const res = await runAsync(params);
467
- if (res?.data) {
468
- let list = withPagination ? res?.data?.list : res?.data;
418
+ if (res == null ? void 0 : res.data) {
419
+ let list = withPagination ? (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.list : res == null ? void 0 : res.data;
469
420
  if (transformResponse) {
470
- list = transformResponse(res?.data);
421
+ list = transformResponse(res == null ? void 0 : res.data);
471
422
  }
472
- const data = isMultiple ? list : list?.[0];
423
+ const data2 = isMultiple ? list : list == null ? void 0 : list[0];
473
424
  const nextSelectRowKeys = isMultiple ? value : [value];
474
425
  if (labelInValue) {
475
- onChange(data);
476
- preValue.current = data;
426
+ onChange(data2);
427
+ preValue.current = data2;
477
428
  } else {
478
- onChange(isMultiple ? data.map(item => item[valueKey]) : data[valueKey]);
479
- preValue.current = isMultiple ? data.map(item => item[valueKey]) : data[valueKey];
429
+ onChange(isMultiple ? data2.map((item) => item[valueKey]) : data2[valueKey]);
430
+ preValue.current = isMultiple ? data2.map((item) => item[valueKey]) : data2[valueKey];
480
431
  }
481
- // 更新内部展示值
482
432
  setState({
483
- _value: data,
433
+ _value: data2,
484
434
  isInit: false,
485
435
  selectedRows: list,
486
436
  selectedRowKeys: nextSelectRowKeys
@@ -494,21 +444,18 @@ const ProModalSelect = (props, ref) => {
494
444
  useMount(() => {
495
445
  if (!value) {
496
446
  setState({
497
- selectedRowKeys: rowSelection?.selectedRowKeys || [],
498
- selectedRows: rowSelection?.selectedRows || [],
499
- _value: undefined
447
+ selectedRowKeys: (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || [],
448
+ selectedRows: (rowSelection == null ? void 0 : rowSelection.selectedRows) || [],
449
+ _value: void 0
500
450
  });
501
- } else if (_isArray(value)) {
451
+ } else if (isArray(value)) {
502
452
  setState({
503
- selectedRowKeys: rowSelection?.selectedRowKeys || value,
504
- selectedRows: rowSelection?.selectedRows || value,
453
+ selectedRowKeys: (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || value,
454
+ selectedRows: (rowSelection == null ? void 0 : rowSelection.selectedRows) || value,
505
455
  _value: value
506
456
  });
507
- } else if (_isObject(value)) {
508
- const initialValue = {
509
- [valueKey]: value[valueKey],
510
- [labelKey]: value[labelKey]
511
- };
457
+ } else if (isObject(value)) {
458
+ const initialValue = { [valueKey]: value[valueKey], [labelKey]: value[labelKey] };
512
459
  setState({
513
460
  selectedRowKeys: [value],
514
461
  selectedRows: [initialValue],
@@ -517,6 +464,7 @@ const ProModalSelect = (props, ref) => {
517
464
  }
518
465
  });
519
466
  useEffect(() => {
467
+ var _a2;
520
468
  if (onOff && !open) {
521
469
  const nextState = {
522
470
  open: true
@@ -526,19 +474,19 @@ const ProModalSelect = (props, ref) => {
526
474
  nextState.selectedRowKeys = [];
527
475
  nextState.selectedRows = [];
528
476
  }
529
- if (_isObject(value)) {
477
+ if (isObject(value)) {
530
478
  nextState.selectedRowKeys = [getRowKey(value)];
531
479
  nextState.selectedRows = [value];
532
480
  }
533
- if (_isArray(value)) {
534
- nextState.selectedRowKeys = value.map(item => getRowKey(item));
481
+ if (isArray(value)) {
482
+ nextState.selectedRowKeys = value.map((item) => getRowKey(item));
535
483
  nextState.selectedRows = value;
536
484
  }
537
485
  } else if (value) {
538
486
  const nextSelectedRowKeys = isMultiple ? value : [value];
539
487
  nextState.selectedRowKeys = nextSelectedRowKeys;
540
488
  const list = options ?? data;
541
- nextState.selectedRows = list?.filter?.(item => {
489
+ nextState.selectedRows = (_a2 = list == null ? void 0 : list.filter) == null ? void 0 : _a2.call(list, (item) => {
542
490
  return nextSelectedRowKeys.includes(item[valueKey]);
543
491
  });
544
492
  }
@@ -546,28 +494,29 @@ const ProModalSelect = (props, ref) => {
546
494
  }
547
495
  }, [onOff, open, JSON.stringify(value)]);
548
496
  useEffect(() => {
549
- if (open && useRequest?.options?.ready !== false && useRequest?.options?.manual === undefined) {
497
+ var _a2, _b2;
498
+ if (open && ((_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.ready) !== false && ((_b2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _b2.manual) === void 0) {
550
499
  onSearch(form.getFieldsValue(), true);
551
500
  }
552
- }, [open, useRequest?.options?.manual, useRequest?.options?.ready]);
501
+ }, [open, (_g = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _g.manual, (_h = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _h.ready]);
553
502
  useEffect(() => {
554
503
  hideTooltipIfOpen(fieldRef.current, open);
555
504
  }, [open]);
556
505
  useEffect(() => {
557
- if (value && !open && isInit && nextMode === 'input') {
506
+ if (value && !open && isInit && nextMode === "input") {
558
507
  getInitValues();
559
508
  }
560
509
  }, [JSON.stringify(value), open, isInit]);
561
510
  useDebounceEffect(() => {
562
- if (value && !open && nextMode === 'select' && (!_isEqual(value, preValue.current) || options?.length === 0)) {
511
+ var _a2;
512
+ if (value && !open && nextMode === "select" && (!isEqual(value, preValue.current) || (options == null ? void 0 : options.length) === 0)) {
563
513
  preValue.current = value;
564
- const data = labelInValue ? value[valueKey] : value;
565
- const isHasValue = options?.some?.(item => item[valueKey] === data);
514
+ const data2 = labelInValue ? value[valueKey] : value;
515
+ const isHasValue = (_a2 = options == null ? void 0 : options.some) == null ? void 0 : _a2.call(options, (item) => item[valueKey] === data2);
566
516
  if (isHasValue) {
567
517
  return;
568
518
  }
569
519
  if (useRequest) {
570
- // 加定时器 修复依赖数据同步更新未取到问题
571
520
  setTimeout(() => {
572
521
  const params = withPagination ? {
573
522
  pageNum: 1,
@@ -575,19 +524,25 @@ const ProModalSelect = (props, ref) => {
575
524
  queryBean: {
576
525
  ...defaultParams,
577
526
  ...initParams,
578
- [searchKey ?? valueKey]: data
527
+ [searchKey ?? valueKey]: data2
579
528
  }
580
529
  } : {
581
530
  ...defaultParams,
582
531
  ...initParams,
583
- [searchKey ?? valueKey]: data
532
+ [searchKey ?? valueKey]: data2
584
533
  };
585
534
  const nextParams = transformParams ? transformParams(params) : params;
586
535
  run(nextParams);
587
536
  }, 300);
588
537
  }
589
538
  }
590
- }, [JSON.stringify(value), open, JSON.stringify(defaultParams), JSON.stringify(initParams), options?.length]);
539
+ }, [
540
+ JSON.stringify(value),
541
+ open,
542
+ JSON.stringify(defaultParams),
543
+ JSON.stringify(initParams),
544
+ options == null ? void 0 : options.length
545
+ ]);
591
546
  const handleSelectFocus = () => {
592
547
  if (useRequest) {
593
548
  const queryBean = defaultParams || {};
@@ -597,17 +552,16 @@ const ProModalSelect = (props, ref) => {
597
552
  queryBean
598
553
  } : queryBean;
599
554
  const nextParams = transformParams ? transformParams(params) : params;
600
- // 减少请求条件一致时,且请求过时,focus的重复请求
601
- if (!_isEqual(queryBean, defaultParamsRef.current) || !options?.length) {
602
- run(nextParams); // 触发 run 请求
603
- defaultParamsRef.current = queryBean; // 更新缓存
555
+ if (!isEqual(queryBean, defaultParamsRef.current) || !(options == null ? void 0 : options.length)) {
556
+ run(nextParams);
557
+ defaultParamsRef.current = queryBean;
604
558
  }
605
559
  setState({
606
560
  isInit: false
607
561
  });
608
562
  }
609
563
  };
610
- const handleSelectSearch = _debounce(val => {
564
+ const handleSelectSearch = debounce((val) => {
611
565
  if (useRequest) {
612
566
  const queryBean = {
613
567
  ...defaultParams,
@@ -621,28 +575,28 @@ const ProModalSelect = (props, ref) => {
621
575
  const nextParams = transformParams ? transformParams(params) : params;
622
576
  run(nextParams);
623
577
  }
624
- }, 1000);
578
+ }, 1e3);
625
579
  useDebounceEffect(() => {
626
580
  if (!value) {
627
581
  if (defaultOne) {
628
582
  getDefaultOneValues();
629
583
  } else {
630
584
  setState({
631
- _value: undefined,
585
+ _value: void 0,
632
586
  selectedRowKeys: [],
633
587
  selectedRows: []
634
588
  });
635
589
  }
636
590
  }
637
- if (nextMode === 'input') {
638
- if (labelInValue && _value && !_isEqual(value, _value)) {
591
+ if (nextMode === "input") {
592
+ if (labelInValue && _value && !isEqual(value, _value)) {
639
593
  setState({
640
594
  _value: value,
641
595
  selectedRowKeys: [],
642
596
  selectedRows: []
643
597
  });
644
598
  }
645
- if (!labelInValue && !_isEqual(value, _value?.[valueKey])) {
599
+ if (!labelInValue && !isEqual(value, _value == null ? void 0 : _value[valueKey])) {
646
600
  setState({
647
601
  _value: value,
648
602
  selectedRowKeys: [],
@@ -651,133 +605,121 @@ const ProModalSelect = (props, ref) => {
651
605
  }
652
606
  }
653
607
  }, [value, _value]);
654
-
655
- // 加个中间状态Input
656
- let initRender = /*#__PURE__*/_jsxs(Space.Compact, {
657
- style: {
658
- width: '100%'
659
- },
660
- block: true,
661
- children: [nextMode === 'select' ? /*#__PURE__*/_jsx(ProSelect, {
662
- value: value,
663
- onChange: handleSelectValue,
664
- disabled: disabled,
665
- fieldNames: fieldNames,
666
- showCodeName: showCodeName,
667
- labelInValue: labelInValue,
668
- dataSource: options,
669
- optionRender: optionRender,
670
- scrollFollowParent: false,
671
- mode: isMultiple ? 'multiple' : undefined,
672
- notFoundContent: selectLoading ? /*#__PURE__*/_jsx(Spin, {
673
- size: "small"
674
- }) : null,
675
- onFocus: handleSelectFocus,
676
- onSearch: handleSelectSearch,
677
- tooltip: _tooltip,
678
- style: {
679
- width: isView || disabled ? '100%' : 'calc(100% - 30px)'
680
- },
681
- ...restProps
682
- }) : /*#__PURE__*/_jsx(Tooltip, {
683
- title: _tooltip ? viewText : null,
684
- placement: "topLeft",
685
- children: /*#__PURE__*/_jsx(Input, {
608
+ let initRender = /* @__PURE__ */ jsxs(Space.Compact, { style: { width: "100%" }, block: true, children: [
609
+ nextMode === "select" ? /* @__PURE__ */ jsx(
610
+ ProSelect,
611
+ {
612
+ value,
613
+ onChange: handleSelectValue,
614
+ disabled,
615
+ fieldNames,
616
+ showCodeName,
617
+ labelInValue,
618
+ dataSource: options,
619
+ optionRender,
620
+ scrollFollowParent: false,
621
+ mode: isMultiple ? "multiple" : void 0,
622
+ notFoundContent: selectLoading ? /* @__PURE__ */ jsx(Spin, { size: "small" }) : null,
623
+ onFocus: handleSelectFocus,
624
+ onSearch: handleSelectSearch,
625
+ tooltip: _tooltip,
626
+ style: { width: isView || disabled ? "100%" : "calc(100% - 30px)" },
627
+ ...restProps
628
+ }
629
+ ) : /* @__PURE__ */ jsx(Tooltip, { title: _tooltip ? viewText : null, placement: "topLeft", children: /* @__PURE__ */ jsx(
630
+ Input,
631
+ {
686
632
  value: viewText,
687
633
  onChange: handleChangeValue,
688
- disabled: disabled,
634
+ disabled,
689
635
  autoComplete: "off",
690
636
  allowClear: true,
691
637
  ...restProps
692
- })
693
- }), isView || disabled ? null : /*#__PURE__*/_jsx(Button, {
694
- onClick: handleClick,
695
- className: "pro-modal-select-view-button",
696
- icon: /*#__PURE__*/_jsx(ReactSVG, {
697
- className: "viewSvg",
698
- src: viewSvg
699
- })
700
- })]
701
- });
702
- if (customRender && /*#__PURE__*/React.isValidElement(customRender)) {
703
- initRender = /*#__PURE__*/_jsx("div", {
704
- className: "pro-modal-select-init",
705
- onClick: handleClick,
706
- children: customRender
707
- });
638
+ }
639
+ ) }),
640
+ isView || disabled ? null : /* @__PURE__ */ jsx(
641
+ Button,
642
+ {
643
+ onClick: handleClick,
644
+ className: "pro-modal-select-view-button",
645
+ icon: /* @__PURE__ */ jsx(ReactSVG, { className: "viewSvg", src: viewSvg })
646
+ }
647
+ )
648
+ ] });
649
+ if (customRender && React.isValidElement(customRender)) {
650
+ initRender = /* @__PURE__ */ jsx("div", { className: "pro-modal-select-init", onClick: handleClick, children: customRender });
708
651
  }
709
652
  useDeepCompareEffect(() => {
710
653
  setState({
711
- options: tableProps?.dataSource || []
654
+ options: (tableProps == null ? void 0 : tableProps.dataSource) || []
712
655
  });
713
- }, [tableProps?.dataSource]);
714
-
715
- // 当搜索条件只有一个时,且为输入框,默认设置suffix
716
- if (formColumns?.length === 1 && formColumns?.[0]?.type === 'Input') {
717
- if (!formColumns[0]?.fieldProps) {
656
+ }, [tableProps == null ? void 0 : tableProps.dataSource]);
657
+ if ((formColumns == null ? void 0 : formColumns.length) === 1 && ((_i = formColumns == null ? void 0 : formColumns[0]) == null ? void 0 : _i.type) === "Input") {
658
+ if (!((_j = formColumns[0]) == null ? void 0 : _j.fieldProps)) {
718
659
  formColumns[0].fieldProps = {};
719
660
  }
720
- if (!_isFunction(formColumns[0].fieldProps) && !formColumns?.[0]?.fieldProps?.suffix) {
721
- formColumns[0].fieldProps.suffix = /*#__PURE__*/_jsx(SearchOutlined, {
722
- onClick: handleSearch
723
- });
661
+ if (!isFunction(formColumns[0].fieldProps) && !((_l = (_k = formColumns == null ? void 0 : formColumns[0]) == null ? void 0 : _k.fieldProps) == null ? void 0 : _l.suffix)) {
662
+ formColumns[0].fieldProps.suffix = /* @__PURE__ */ jsx(SearchOutlined, { onClick: handleSearch });
724
663
  }
725
664
  }
726
665
  if (isView) {
727
666
  if (!value) {
728
- return /*#__PURE__*/_jsx(_Fragment, {
729
- children: viewEmpty
730
- });
667
+ return /* @__PURE__ */ jsx(Fragment, { children: viewEmpty });
731
668
  }
732
- return /*#__PURE__*/_jsx(Container, {
733
- viewEmpty: viewEmpty,
734
- children: `${viewText}`
735
- });
669
+ return /* @__PURE__ */ jsx(Container, { viewEmpty, children: `${viewText}` });
736
670
  }
737
671
  const _className = classNames({
738
- 'pro-modal-select': true,
672
+ "pro-modal-select": true,
739
673
  [props.className]: props.className,
740
- 'pro-modal-select-open': open
741
- });
742
- return /*#__PURE__*/_jsxs(_Fragment, {
743
- children: [/*#__PURE__*/_jsx("div", {
744
- id: uuid,
745
- className: _className,
746
- style: style,
747
- ref: fieldRef,
748
- children: initRender
749
- }), /*#__PURE__*/_jsxs(ProDrawerForm, {
750
- mode: "Modal",
751
- title: title,
752
- onOk: handleFinish
753
- // @ts-ignore
754
- ,
755
- onCancel: handleClose,
756
- open: open,
757
- ...restModalProps,
758
- children: [/*#__PURE__*/_jsx(ProForm, {
759
- submitOnEnter: true,
760
- form: form,
761
- columns: formColumns,
762
- onFinish: handleSearch,
763
- onCancel: handleReset,
764
- confirmLoading: loading,
765
- footer: formColumns?.length > 1
766
- }), /*#__PURE__*/_jsx(ProTable, {
767
- onRow: record => {
768
- return {
769
- onClick: () => handleClickRow(record)
770
- };
771
- },
772
- rowKey: rowKey,
773
- loading: loading,
774
- rowSelection: _rowSelection,
775
- columns: columns,
776
- dataSource: data,
777
- pagination: withPagination ? pagination : false,
778
- ...restTableProps
779
- })]
780
- })]
674
+ "pro-modal-select-open": open
781
675
  });
676
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
677
+ /* @__PURE__ */ jsx("div", { id: uuid, className: _className, style, ref: fieldRef, children: initRender }),
678
+ /* @__PURE__ */ jsxs(
679
+ ProDrawerForm,
680
+ {
681
+ mode: "Modal",
682
+ title,
683
+ onOk: handleFinish,
684
+ onCancel: handleClose,
685
+ open,
686
+ ...restModalProps,
687
+ children: [
688
+ /* @__PURE__ */ jsx(
689
+ ProForm,
690
+ {
691
+ submitOnEnter: true,
692
+ form,
693
+ columns: formColumns,
694
+ onFinish: handleSearch,
695
+ onCancel: handleReset,
696
+ confirmLoading: loading,
697
+ footer: (formColumns == null ? void 0 : formColumns.length) > 1
698
+ }
699
+ ),
700
+ /* @__PURE__ */ jsx(
701
+ ProTable,
702
+ {
703
+ onRow: (record) => {
704
+ return {
705
+ onClick: () => handleClickRow(record)
706
+ };
707
+ },
708
+ rowKey,
709
+ loading,
710
+ rowSelection: _rowSelection,
711
+ columns,
712
+ dataSource: data,
713
+ pagination: withPagination ? pagination : false,
714
+ ...restTableProps
715
+ }
716
+ )
717
+ ]
718
+ }
719
+ )
720
+ ] });
721
+ };
722
+ var ProModalSelect_default = forwardRef(ProModalSelect);
723
+ export {
724
+ ProModalSelect_default as default
782
725
  };
783
- export default /*#__PURE__*/forwardRef(ProModalSelect);