@zat-design/sisyphus-react 4.5.9 → 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 (280) hide show
  1. package/dist/index.esm.css +1 -1
  2. package/dist/less.esm.css +1 -1
  3. package/es/FormsProvider/index.js +14 -21
  4. package/es/ProAction/components/CheckModalContent/index.js +12 -26
  5. package/es/ProAction/index.js +79 -83
  6. package/es/ProAction/propsType.js +0 -1
  7. package/es/ProConfigProvider/index.js +63 -110
  8. package/es/ProConfigProvider/propsType.js +0 -1
  9. package/es/ProDownload/index.d.ts +2 -1
  10. package/es/ProDownload/index.js +74 -69
  11. package/es/ProDownload/propsType.js +0 -1
  12. package/es/ProDownload/utils.d.ts +10 -5
  13. package/es/ProDownload/utils.js +63 -95
  14. package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
  15. package/es/ProDrawerForm/components/ProModal/index.js +77 -108
  16. package/es/ProDrawerForm/components/index.js +6 -2
  17. package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
  18. package/es/ProDrawerForm/index.js +29 -38
  19. package/es/ProDrawerForm/propsType.js +0 -1
  20. package/es/ProDrawerForm/utils/index.js +18 -36
  21. package/es/ProEditLabel/components/RenderProForm.js +45 -49
  22. package/es/ProEditLabel/index.js +126 -163
  23. package/es/ProEditLabel/propsType.js +0 -1
  24. package/es/ProEditLabel/utils/index.js +5 -8
  25. package/es/ProEditTable/components/ActionButton/index.js +111 -119
  26. package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
  27. package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
  28. package/es/ProEditTable/components/RcTable/index.js +6 -4
  29. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
  30. package/es/ProEditTable/components/RenderField/index.js +490 -587
  31. package/es/ProEditTable/components/RenderField/propsType.js +0 -1
  32. package/es/ProEditTable/components/RenderField/tools.js +115 -112
  33. package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
  34. package/es/ProEditTable/components/Summary/index.js +38 -64
  35. package/es/ProEditTable/components/Validator/index.js +46 -46
  36. package/es/ProEditTable/components/index.js +12 -5
  37. package/es/ProEditTable/index.js +456 -378
  38. package/es/ProEditTable/propsType.js +0 -1
  39. package/es/ProEditTable/utils/config.js +60 -122
  40. package/es/ProEditTable/utils/diffOriginal.js +45 -82
  41. package/es/ProEditTable/utils/getDefaultProps.js +19 -24
  42. package/es/ProEditTable/utils/index.js +154 -235
  43. package/es/ProEditTable/utils/tools.js +149 -286
  44. package/es/ProEditTable/utils/transform.js +25 -30
  45. package/es/ProEditTable/utils/useEditTableError.js +30 -43
  46. package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
  47. package/es/ProEditTable/utils/validateAll.js +87 -154
  48. package/es/ProEnum/components/Group.js +38 -30
  49. package/es/ProEnum/components/Tag.js +22 -26
  50. package/es/ProEnum/hooks/useEnum.js +48 -116
  51. package/es/ProEnum/hooks/useEnumRequest.js +182 -212
  52. package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
  53. package/es/ProEnum/index.js +162 -172
  54. package/es/ProEnum/propsType.js +0 -1
  55. package/es/ProEnum/utils/eventCenter.js +10 -12
  56. package/es/ProEnum/utils/frequentEnum.js +35 -92
  57. package/es/ProEnum/utils/getEnum.js +32 -90
  58. package/es/ProEnum/utils/getEnumLabel.js +44 -49
  59. package/es/ProEnum/utils/index.js +93 -207
  60. package/es/ProForm/components/Container.js +13 -28
  61. package/es/ProForm/components/FormFooter/index.js +36 -44
  62. package/es/ProForm/components/FormFooter/propsType.js +0 -1
  63. package/es/ProForm/components/base/Checkbox/index.js +32 -59
  64. package/es/ProForm/components/base/DatePicker/index.js +49 -71
  65. package/es/ProForm/components/base/Input/index.js +63 -97
  66. package/es/ProForm/components/base/Input/propsType.js +0 -1
  67. package/es/ProForm/components/base/InputNumber/index.js +118 -172
  68. package/es/ProForm/components/base/Radio/index.js +39 -52
  69. package/es/ProForm/components/base/RangePicker/index.js +109 -127
  70. package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
  71. package/es/ProForm/components/base/Select/index.js +63 -89
  72. package/es/ProForm/components/base/Switch/index.js +27 -35
  73. package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
  74. package/es/ProForm/components/base/TextArea/index.js +30 -41
  75. package/es/ProForm/components/base/TimePicker/index.js +27 -37
  76. package/es/ProForm/components/combination/Container/index.js +37 -47
  77. package/es/ProForm/components/combination/Container/propsType.js +0 -1
  78. package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
  79. package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -102
  80. package/es/ProForm/components/combination/FormList/components/Empty.js +28 -55
  81. package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
  82. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
  83. package/es/ProForm/components/combination/FormList/index.js +151 -161
  84. package/es/ProForm/components/combination/FormList/propsType.js +0 -1
  85. package/es/ProForm/components/combination/FormList/style/index.less +6 -0
  86. package/es/ProForm/components/combination/FormList/utils.js +22 -38
  87. package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
  88. package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
  89. package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +106 -213
  90. package/es/ProForm/components/combination/Group/hooks/index.js +69 -129
  91. package/es/ProForm/components/combination/Group/index.js +87 -126
  92. package/es/ProForm/components/combination/Group/propsType.js +0 -1
  93. package/es/ProForm/components/combination/Group/utils/index.js +124 -239
  94. package/es/ProForm/components/combination/ProCascader/index.js +156 -199
  95. package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
  96. package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
  97. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +72 -70
  98. package/es/ProForm/components/combination/ProModalSelect/index.js +309 -347
  99. package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
  100. package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
  101. package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
  102. package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
  103. package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
  104. package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
  105. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
  106. package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
  107. package/es/ProForm/components/index.js +56 -34
  108. package/es/ProForm/components/render/ChangedWrapper.js +85 -94
  109. package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
  110. package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
  111. package/es/ProForm/components/render/Render.js +223 -329
  112. package/es/ProForm/components/render/RenderFields.js +76 -113
  113. package/es/ProForm/components/render/propsType.js +0 -1
  114. package/es/ProForm/hooks/useControlled.js +8 -10
  115. package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
  116. package/es/ProForm/hooks/useFieldProps.js +8 -4
  117. package/es/ProForm/hooks/useForm.js +50 -110
  118. package/es/ProForm/hooks/useRules.js +17 -33
  119. package/es/ProForm/hooks/useShouldUpdate.js +77 -152
  120. package/es/ProForm/hooks/useWatch.js +62 -134
  121. package/es/ProForm/index.js +157 -194
  122. package/es/ProForm/propsType.js +15 -7
  123. package/es/ProForm/utils/buildFormItemProps.js +51 -58
  124. package/es/ProForm/utils/diffOriginal.js +43 -73
  125. package/es/ProForm/utils/getDefaultProps.js +18 -24
  126. package/es/ProForm/utils/index.js +160 -235
  127. package/es/ProForm/utils/processDependencies.js +21 -60
  128. package/es/ProForm/utils/reactiveValues.js +20 -34
  129. package/es/ProForm/utils/rulesCreator.js +42 -40
  130. package/es/ProForm/utils/transformNames.js +10 -13
  131. package/es/ProForm/utils/transformValue.js +16 -29
  132. package/es/ProForm/utils/valueType.js +96 -178
  133. package/es/ProIcon/config/index.js +340 -274
  134. package/es/ProIcon/index.js +135 -209
  135. package/es/ProIcon/propsTypes.js +0 -1
  136. package/es/ProIcon/utils/index.js +24 -39
  137. package/es/ProLayout/components/Layout/Header/index.js +108 -141
  138. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
  139. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +113 -139
  140. package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
  141. package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
  142. package/es/ProLayout/components/Layout/Menu/index.js +92 -89
  143. package/es/ProLayout/components/Layout/Notice/index.js +13 -27
  144. package/es/ProLayout/components/Layout/index.js +8 -3
  145. package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
  146. package/es/ProLayout/components/ProCollapse/index.js +89 -111
  147. package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
  148. package/es/ProLayout/components/ProFooter/index.js +27 -24
  149. package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
  150. package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
  151. package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -84
  152. package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
  153. package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
  154. package/es/ProLayout/components/ProHeader/components/index.js +6 -2
  155. package/es/ProLayout/components/ProHeader/index.js +216 -356
  156. package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
  157. package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
  158. package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -63
  159. package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
  160. package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
  161. package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
  162. package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
  163. package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
  164. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
  165. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +320 -350
  166. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.d.ts +19 -0
  167. package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +332 -0
  168. package/es/ProLayout/components/TabsManager/index.js +407 -351
  169. package/es/ProLayout/components/TabsManager/propTypes.d.ts +4 -0
  170. package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
  171. package/es/ProLayout/components/TabsManager/style/index.less +1 -1
  172. package/es/ProLayout/components/TabsManager/utils/historyObserver.d.ts +7 -0
  173. package/es/ProLayout/components/TabsManager/utils/historyObserver.js +65 -0
  174. package/es/ProLayout/components/TabsManager/utils/index.d.ts +15 -2
  175. package/es/ProLayout/components/TabsManager/utils/index.js +156 -159
  176. package/es/ProLayout/components/index.js +8 -3
  177. package/es/ProLayout/index.js +173 -228
  178. package/es/ProLayout/propTypes.d.ts +28 -1
  179. package/es/ProLayout/propTypes.js +12 -52
  180. package/es/ProLayout/utils/index.js +48 -128
  181. package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
  182. package/es/ProSelect/index.js +187 -223
  183. package/es/ProSelect/propsType.js +0 -1
  184. package/es/ProSelect/style/index.less +13 -0
  185. package/es/ProSelect/utils/index.js +100 -146
  186. package/es/ProStep/components/Anchor/index.js +71 -82
  187. package/es/ProStep/components/Item/index.js +49 -56
  188. package/es/ProStep/components/LazyLoad/index.js +23 -29
  189. package/es/ProStep/components/Listener/index.js +20 -33
  190. package/es/ProStep/components/Step/index.js +31 -38
  191. package/es/ProStep/constants.js +4 -1
  192. package/es/ProStep/index.js +166 -153
  193. package/es/ProStep/propsType.js +0 -1
  194. package/es/ProStep/style/index.less +1 -1
  195. package/es/ProStep/utils/index.js +29 -55
  196. package/es/ProStepTab/index.js +83 -138
  197. package/es/ProStepTab/propsType.js +0 -1
  198. package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
  199. package/es/ProTable/components/EditableCell/index.js +37 -71
  200. package/es/ProTable/components/EditableCell/propsType.js +0 -1
  201. package/es/ProTable/components/FormatColumn/index.js +209 -340
  202. package/es/ProTable/components/FormatColumn/propsType.js +0 -1
  203. package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
  204. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
  205. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
  206. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
  207. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
  208. package/es/ProTable/components/RcTable/index.js +6 -4
  209. package/es/ProTable/components/RenderColumn/index.js +158 -186
  210. package/es/ProTable/components/RenderEmptyText/index.js +12 -21
  211. package/es/ProTable/components/RenderFooter/index.js +15 -15
  212. package/es/ProTable/components/RenderSummary/index.js +33 -50
  213. package/es/ProTable/components/RenderTableHeader/index.js +44 -46
  214. package/es/ProTable/components/RenderTabs/index.js +47 -51
  215. package/es/ProTable/components/TableResizable/index.js +56 -72
  216. package/es/ProTable/components/TooltipTitle/index.js +13 -21
  217. package/es/ProTable/components/index.js +16 -36
  218. package/es/ProTable/hooks/useAntdTable.js +191 -224
  219. package/es/ProTable/index.js +232 -249
  220. package/es/ProTable/propsType.js +0 -1
  221. package/es/ProTable/utils/columnStorage.js +63 -88
  222. package/es/ProTable/utils/index.js +57 -90
  223. package/es/ProTabs/components/Card/index.js +20 -48
  224. package/es/ProTabs/components/index.js +4 -1
  225. package/es/ProTabs/index.js +41 -58
  226. package/es/ProTabs/propType.js +0 -1
  227. package/es/ProThemeTools/component/ProTools/index.js +106 -158
  228. package/es/ProThemeTools/component/index.js +4 -1
  229. package/es/ProThemeTools/context/ThemeContext.js +67 -146
  230. package/es/ProThemeTools/index.js +103 -156
  231. package/es/ProThemeTools/propsType.js +0 -1
  232. package/es/ProThemeTools/utils/index.js +60 -109
  233. package/es/ProTooltip/index.js +132 -168
  234. package/es/ProTooltip/propsType.js +0 -1
  235. package/es/ProTree/components/AdaptiveTooltip.js +15 -17
  236. package/es/ProTree/components/CloseIcon.js +18 -26
  237. package/es/ProTree/components/List.js +28 -47
  238. package/es/ProTree/components/ProTree.js +152 -211
  239. package/es/ProTree/components/ProTreeSelect/index.js +255 -459
  240. package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
  241. package/es/ProTree/components/SearchTitle.js +23 -42
  242. package/es/ProTree/components/Tree.js +147 -195
  243. package/es/ProTree/components/index.js +10 -5
  244. package/es/ProTree/index.js +12 -16
  245. package/es/ProTree/propsType.js +0 -1
  246. package/es/ProTree/utils.js +46 -118
  247. package/es/ProTreeModal/components/Cascader.js +56 -64
  248. package/es/ProTreeModal/components/CloseIcon.js +18 -26
  249. package/es/ProTreeModal/components/List.js +114 -180
  250. package/es/ProTreeModal/components/SearchTitle.js +15 -18
  251. package/es/ProTreeModal/components/SortableItem.js +29 -58
  252. package/es/ProTreeModal/components/Tree.js +99 -113
  253. package/es/ProTreeModal/components/Trigger.js +87 -121
  254. package/es/ProTreeModal/components/index.js +14 -6
  255. package/es/ProTreeModal/index.js +397 -438
  256. package/es/ProTreeModal/propsType.js +0 -1
  257. package/es/ProTreeModal/utils.js +52 -95
  258. package/es/ProUpload/components/ButtonRender.js +44 -54
  259. package/es/ProUpload/components/DragRender.js +94 -148
  260. package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
  261. package/es/ProUpload/components/Example.js +27 -31
  262. package/es/ProUpload/components/FileItem.js +69 -163
  263. package/es/ProUpload/components/ImageRender.js +134 -170
  264. package/es/ProUpload/index.js +68 -100
  265. package/es/ProUpload/propsType.js +0 -1
  266. package/es/ProUpload/uitls.js +8 -4
  267. package/es/ProUtils/utils/index.js +17 -13
  268. package/es/ProViewer/index.js +154 -175
  269. package/es/ProViewer/propsType.js +0 -5
  270. package/es/ProWaterMark/index.js +9 -16
  271. package/es/ProWaterMark/propsType.js +0 -1
  272. package/es/hooks/useDraggableRow.js +25 -53
  273. package/es/index.js +57 -77
  274. package/es/locale/en_US.js +153 -142
  275. package/es/locale/index.js +23 -36
  276. package/es/locale/zh_CN.js +145 -142
  277. package/es/tokens.js +84 -83
  278. package/es/utils/index.js +24 -51
  279. package/package.json +4 -2
  280. package/es/ProConfigProvider/demo/locale.js +0 -58
@@ -1,30 +1,21 @@
1
- import _debounce from "lodash/debounce";
2
- import _cloneDeep from "lodash/cloneDeep";
3
- /* eslint-disable @typescript-eslint/no-use-before-define */
4
- import React, { useImperativeHandle, forwardRef, useCallback } from 'react';
5
- import { useDeepCompareEffect, useRequest as useRequestFunc, useSetState } from 'ahooks';
6
- import { Input, TreeSelect, message, Tooltip } from 'antd';
7
- import classnames from 'classnames';
8
- import { tools } from '@zat-design/utils';
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useImperativeHandle, forwardRef, useCallback } from "react";
3
+ import { useDeepCompareEffect, useRequest as useRequestFunc, useSetState } from "ahooks";
4
+ import { Input, TreeSelect, message, Tooltip } from "antd";
5
+ import classnames from "classnames";
6
+ import cloneDeep from "lodash/cloneDeep";
7
+ import debounce from "lodash/debounce";
8
+ import { tools } from "@zat-design/utils";
9
9
  import locale from "../../../locale";
10
10
  import { useProConfig } from "../../../ProConfigProvider";
11
11
  import Container from "../../../ProForm/components/Container";
12
12
  import AdaptiveTooltip from "../AdaptiveTooltip";
13
13
  import { getFlatTreeData, restoreCodeNameLabel, applyCheckLeaf } from "../../utils";
14
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
15
- const {
16
- SHOW_PARENT
17
- } = TreeSelect;
18
- export const ProTreeSelect = (props, ref) => {
19
- // 全局属性配置在ConfigProvider
20
- const {
21
- fieldNames: proSelectFieldNames = {}
22
- } = useProConfig('ProTreeSelect') || {};
23
- const {
24
- dics = {}
25
- } = useProConfig('ProEnum');
26
-
27
- // 配置属性
14
+ const { SHOW_PARENT } = TreeSelect;
15
+ const ProTreeSelect = (props, ref) => {
16
+ var _a, _b, _c, _d, _e, _f;
17
+ const { fieldNames: proSelectFieldNames = {} } = useProConfig("ProTreeSelect") || {};
18
+ const { dics = {} } = useProConfig("ProEnum");
28
19
  const {
29
20
  disabled,
30
21
  code: enumCode,
@@ -43,7 +34,7 @@ export const ProTreeSelect = (props, ref) => {
43
34
  // 默认支持搜索
44
35
  filterTreeNode,
45
36
  // 是否根据输入项进行筛选,默认true
46
- treeNodeFilterProp = 'label',
37
+ treeNodeFilterProp = "label",
47
38
  defaultExpandAll = true,
48
39
  // 默认展开所有树
49
40
  expandedKeys,
@@ -67,84 +58,46 @@ export const ProTreeSelect = (props, ref) => {
67
58
  // 开启后只能选择叶子节点,非叶子节点置灰禁用
68
59
  ...selectProps
69
60
  } = props;
70
- const {
71
- value = undefined
72
- } = props;
73
- const {
74
- showEllipse = true
75
- } = props;
76
- const {
77
- isDiffChange
78
- } = otherProps ?? {};
61
+ const { value = void 0 } = props;
62
+ const { showEllipse = true } = props;
63
+ const { isDiffChange } = otherProps ?? {};
79
64
  const _showEllipse = showEllipse && !isDiffChange;
80
- const {
81
- isView,
82
- viewEmpty
83
- } = otherProps || {};
84
-
85
- // 合并全局和组件级别的 fieldNames,优先级:组件级 > 全局
65
+ const { isView, viewEmpty } = otherProps || {};
86
66
  const finalFieldNames = {
87
- label: 'label',
88
- value: 'value',
89
- children: 'children',
67
+ label: "label",
68
+ value: "value",
69
+ children: "children",
90
70
  ...proSelectFieldNames,
91
71
  ...fieldNames
92
72
  };
93
-
94
- /**
95
- * 使用 tools.transformDataName 统一转换字段名
96
- * 将原始数据转换为标准格式(label, value, children)
97
- * tools.transformDataName 会自动检查数据是否已经是标准格式,如果是则直接返回
98
- */
99
- const transformFieldNames = useCallback(data => {
100
- if (!data || !Array.isArray(data) || !data.length) {
101
- return data || [];
102
- }
103
-
104
- // 使用 tools.transformDataName 转换字段名
105
- // 它会自动检查数据是否已经是标准格式(label, value, children),如果是则直接返回
106
- return tools.transformDataName(data, {
107
- label: finalFieldNames.label,
108
- value: finalFieldNames.value,
109
- children: finalFieldNames.children
110
- });
111
- }, [finalFieldNames]);
112
- // 经过处理后的枚举数据,可能来自用户配置的处理函数后返回的结果
73
+ const transformFieldNames = useCallback(
74
+ (data) => {
75
+ if (!data || !Array.isArray(data) || !data.length) {
76
+ return data || [];
77
+ }
78
+ return tools.transformDataName(data, {
79
+ label: finalFieldNames.label,
80
+ value: finalFieldNames.value,
81
+ children: finalFieldNames.children
82
+ });
83
+ },
84
+ [finalFieldNames]
85
+ );
113
86
  const [state, setState] = useSetState({});
114
- const {
115
- selectList = [],
116
- origDataSource = []
117
- } = state;
118
-
119
- /**
120
- * 如果数据少于10条那么将数据平铺返回
121
- * 注意:当 treeCheckable 为 false 时(单选模式),应保持树形结构,不进行平铺
122
- * @param dictsEnum 原始数据
123
- * @returns 平铺或者原始数据
124
- */
125
- const countChild = dictsEnum => {
87
+ const { selectList = [], origDataSource = [] } = state;
88
+ const countChild = (dictsEnum) => {
126
89
  if (treeCheckable) {
127
90
  return dictsEnum;
128
91
  }
129
- // 单选模式(treeCheckable=false)时,保持树形结构,不进行平铺
130
- // 因为 TreeSelect 在单选模式下也需要树形结构来正确展示层级关系
131
92
  return dictsEnum;
132
93
  };
133
-
134
- /**
135
- * 如果要展示code-name,那么将源数据的label转为code-name
136
- * 注意:此时数据已经是标准格式(label, value, children)
137
- * @param dataArr 源数据(标准格式)
138
- * @param showCodeAndName 是否展示code-name
139
- * @returns 转换结果
140
- */
141
94
  const transferDataSource = (dataArr, showCodeAndName) => {
142
95
  if (!showCodeAndName) {
143
96
  return dataArr;
144
97
  }
145
- const copyData = _cloneDeep(dataArr);
146
- const loop = arr => {
147
- arr.map(item => {
98
+ const copyData = cloneDeep(dataArr);
99
+ const loop = (arr) => {
100
+ arr.map((item) => {
148
101
  item.label = `${item.value}-${item.label}`;
149
102
  if (item.children) {
150
103
  loop(item.children);
@@ -155,162 +108,104 @@ export const ProTreeSelect = (props, ref) => {
155
108
  loop(copyData);
156
109
  return copyData;
157
110
  };
158
-
159
- /**
160
- * 统一数据后处理:先处理 code-name 展示,再按 checkLeaf 标记非叶子节点禁用
161
- * 数据已是标准格式(label, value, children)
162
- * @param dataArr 标准格式数据
163
- * @returns 后处理结果
164
- */
165
- const processData = dataArr => {
111
+ const processData = (dataArr) => {
166
112
  const result = transferDataSource(dataArr, showCodeName);
167
113
  return checkLeaf ? applyCheckLeaf(result) : result;
168
114
  };
169
- const defaultOnSuccessFun = res => {
170
- const {
171
- status = 200,
172
- message: msg,
173
- data
174
- } = res;
115
+ const defaultOnSuccessFun = (res) => {
116
+ const { status = 200, message: msg, data } = res;
175
117
  if (status !== 200) {
176
118
  message.error(msg);
177
119
  return;
178
120
  }
179
- // 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
180
121
  const transformedData = transformFieldNames(data || []);
181
122
  const resultData = processData(transformedData);
182
- setState({
183
- selectList: resultData || [],
184
- origDataSource: resultData || []
185
- });
123
+ setState({ selectList: resultData || [], origDataSource: resultData || [] });
186
124
  };
187
- const successTransformDataHandle = useCallback(res => {
188
- if (transformResponse && typeof transformResponse === 'function') {
125
+ const successTransformDataHandle = useCallback((res) => {
126
+ if (transformResponse && typeof transformResponse === "function") {
189
127
  return transformResponse(res);
190
128
  }
191
- const {
192
- status = 200,
193
- message: msg,
194
- data
195
- } = res || {};
129
+ const { status = 200, message: msg, data } = res || {};
196
130
  if (status !== 200) {
197
131
  message.error(msg);
198
132
  return;
199
133
  }
200
134
  return data;
201
135
  }, []);
202
-
203
- // 配置了异步数据源,拉取枚举数据逻辑 如果有code不掉接口从local里根据code取值
204
- const fetchFunction = useRequestFunc(useRequest?.service, {
136
+ const fetchFunction = useRequestFunc(useRequest == null ? void 0 : useRequest.service, {
205
137
  manual: true,
206
138
  debounceWait: 300,
207
- onSuccess: data => {
208
- if (transformResponse && typeof transformResponse === 'function') {
139
+ onSuccess: (data) => {
140
+ if (transformResponse && typeof transformResponse === "function") {
209
141
  const responseData = transformResponse(data);
210
- // 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
211
142
  const transformedData = transformFieldNames(responseData);
212
143
  const resultData = processData(transformedData);
213
- setState({
214
- selectList: countChild(resultData),
215
- origDataSource: resultData
216
- });
144
+ setState({ selectList: countChild(resultData), origDataSource: resultData });
217
145
  } else {
218
- defaultOnSuccessFun(fetchFunction.data);
146
+ defaultOnSuccessFun(data);
219
147
  }
220
148
  },
221
- ...useRequest?.options
149
+ ...useRequest == null ? void 0 : useRequest.options
222
150
  });
223
- const cacheList = useRequest?.options?.cacheKey ? successTransformDataHandle(fetchFunction?.data) : [];
224
- useImperativeHandle(ref, () => ({
225
- useRequestRef: fetchFunction
226
- }));
227
-
228
- // 设置cacheKey后使用缓存的数据
151
+ const cacheList = ((_a = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a.cacheKey) ? successTransformDataHandle(fetchFunction == null ? void 0 : fetchFunction.data) : [];
152
+ useImperativeHandle(
153
+ ref,
154
+ () => ({
155
+ useRequestRef: fetchFunction
156
+ })
157
+ );
229
158
  useDeepCompareEffect(() => {
230
- if (fetchFunction?.data, useRequest?.options?.cacheKey) {
231
- if (transformResponse && typeof transformResponse === 'function') {
159
+ var _a2;
160
+ if ((fetchFunction == null ? void 0 : fetchFunction.data) && ((_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.cacheKey)) {
161
+ if (transformResponse && typeof transformResponse === "function") {
232
162
  const responseData = transformResponse(fetchFunction.data);
233
- // 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
234
163
  const transformedData = transformFieldNames(responseData);
235
164
  const resultData = processData(transformedData);
236
- setState({
237
- selectList: countChild(resultData),
238
- origDataSource: resultData
239
- });
165
+ setState({ selectList: countChild(resultData), origDataSource: resultData });
240
166
  } else {
241
167
  defaultOnSuccessFun(fetchFunction.data);
242
168
  }
243
169
  }
244
- }, [fetchFunction?.data, useRequest?.options?.cacheKey]);
170
+ }, [fetchFunction == null ? void 0 : fetchFunction.data, (_b = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _b.cacheKey]);
245
171
  useDeepCompareEffect(() => {
246
172
  if (enumCode) {
247
173
  const dictEnum = dics[enumCode] || [];
248
- // 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
249
174
  const transformedData = transformFieldNames(dictEnum);
250
175
  const resultData = processData(transformedData);
251
176
  const processedList = countChild(resultData);
252
- setState({
253
- selectList: processedList,
254
- origDataSource: resultData
255
- });
177
+ setState({ selectList: processedList, origDataSource: resultData });
256
178
  } else if (dataSource) {
257
- // 先转换字段名,再处理 code-name 展示与 checkLeaf 标记
258
179
  const transformedData = transformFieldNames(dataSource);
259
180
  const resultData = processData(transformedData);
260
181
  const processedList = countChild(resultData);
261
- setState({
262
- selectList: processedList,
263
- origDataSource: resultData
264
- });
182
+ setState({ selectList: processedList, origDataSource: resultData });
265
183
  }
266
184
  }, [enumCode, dataSource, showCodeName]);
267
185
  useDeepCompareEffect(() => {
268
- // code存在huo dataSource存在,不执行接口请求
269
186
  if (enumCode || dataSource) {
270
- return undefined;
187
+ return void 0;
271
188
  }
272
- // 如果配置手动加载,不执行请求
273
- const {
274
- defaultParams,
275
- manual
276
- } = useRequest?.options || {};
277
- // disabled 状态时,不查询接口
189
+ const { defaultParams, manual } = (useRequest == null ? void 0 : useRequest.options) || {};
278
190
  if (defaultDisableValue || !useRequest) {
279
- return undefined;
191
+ return void 0;
280
192
  }
281
- if (manual || cacheList?.length) {
193
+ if (manual || (cacheList == null ? void 0 : cacheList.length)) {
282
194
  return;
283
195
  }
284
- const params = Array.isArray(defaultParams) ? defaultParams?.[0] : defaultParams || {};
285
- // 执行用户配置的枚举服务,拉取枚举数据进行更新
196
+ const params = Array.isArray(defaultParams) ? defaultParams == null ? void 0 : defaultParams[0] : defaultParams || {};
286
197
  fetchFunction.run(params);
287
- }, [useRequest?.options, defaultDisableValue]);
288
-
289
- // disable默认值
198
+ }, [useRequest == null ? void 0 : useRequest.options, defaultDisableValue]);
290
199
  if (defaultDisableValue) {
291
- return /*#__PURE__*/_jsx("span", {
292
- title: defaultDisableValue,
293
- children: /*#__PURE__*/_jsx(Input, {
294
- disabled: true,
295
- defaultValue: defaultDisableValue,
296
- style: props?.style
297
- })
298
- });
200
+ return /* @__PURE__ */ jsx("span", { title: defaultDisableValue, children: /* @__PURE__ */ jsx(Input, { disabled: true, defaultValue: defaultDisableValue, style: props == null ? void 0 : props.style }) });
299
201
  }
300
-
301
- /**
302
- * 根据值进行回显
303
- * 注意:此时数据已经是标准格式(label, value, children)
304
- * @param value 输入值
305
- * @returns 对应枚举label
306
- */
307
- const transToLabel = value => {
202
+ const transToLabel = (value2) => {
308
203
  if (!Array.isArray(origDataSource) || !origDataSource.length) {
309
204
  return viewEmpty;
310
205
  }
311
206
  const labelResult = [];
312
- const queryLabel = dicts => dicts.map(item => {
313
- if (value.includes(item.value)) {
207
+ const queryLabel = (dicts) => dicts.map((item) => {
208
+ if (value2.includes(item.value)) {
314
209
  const labelText = item.label;
315
210
  labelResult.push(labelText);
316
211
  }
@@ -320,251 +215,182 @@ export const ProTreeSelect = (props, ref) => {
320
215
  return item;
321
216
  });
322
217
  queryLabel(origDataSource);
323
- return labelResult?.join('');
218
+ return labelResult == null ? void 0 : labelResult.join("");
324
219
  };
325
-
326
- // 优化的maxTagPlaceholder实现,支持hover显示完整标签内容
327
- // 必须在条件返回之前定义所有hooks,避免hooks数量不一致错误
328
- const maxTagPlaceholder = useCallback(omittedValues => {
329
- // 获取扁平化的树数据用于查找标签
330
- const flatData = getFlatTreeData(selectList, finalFieldNames);
331
-
332
- // 提取被省略的标签文本
333
- const omittedLabels = omittedValues.map(valueObj => {
334
- // TreeSelect的maxTagPlaceholder参数是选中项的完整对象
335
- const targetValue = valueObj.value || valueObj[finalFieldNames.value];
336
-
337
- // 从扁平化的选项列表中查找匹配项
338
- const matchedItem = flatData.find(item => item[finalFieldNames.value] === targetValue);
339
- if (matchedItem) {
340
- // 支持showCodeName格式
341
- return showCodeName ? `${matchedItem[finalFieldNames.value]}-${matchedItem[finalFieldNames.label]}` : matchedItem[finalFieldNames.label];
342
- }
343
-
344
- // 备选方案1:直接提取valueObjlabel
345
- if (valueObj.label) {
346
- // 处理可能的React元素或带HTML的标签
347
- if (typeof valueObj.label === 'object' && valueObj.label?.props) {
348
- const children = valueObj.label?.props?.children;
349
- if (children?.props?.dangerouslySetInnerHTML?.__html) {
350
- return children.props.dangerouslySetInnerHTML.__html;
351
- }
352
- if (valueObj.label?.props?.dangerouslySetInnerHTML?.__html) {
353
- return valueObj.label.props.dangerouslySetInnerHTML.__html;
220
+ const maxTagPlaceholder = useCallback(
221
+ (omittedValues) => {
222
+ const flatData = getFlatTreeData(selectList, finalFieldNames);
223
+ const omittedLabels = omittedValues.map((valueObj) => {
224
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h;
225
+ const targetValue = valueObj.value || valueObj[finalFieldNames.value];
226
+ const matchedItem = flatData.find((item) => item[finalFieldNames.value] === targetValue);
227
+ if (matchedItem) {
228
+ return showCodeName ? `${matchedItem[finalFieldNames.value]}-${matchedItem[finalFieldNames.label]}` : matchedItem[finalFieldNames.label];
229
+ }
230
+ if (valueObj.label) {
231
+ if (typeof valueObj.label === "object" && ((_a2 = valueObj.label) == null ? void 0 : _a2.props)) {
232
+ const children = (_c2 = (_b2 = valueObj.label) == null ? void 0 : _b2.props) == null ? void 0 : _c2.children;
233
+ if ((_e2 = (_d2 = children == null ? void 0 : children.props) == null ? void 0 : _d2.dangerouslySetInnerHTML) == null ? void 0 : _e2.__html) {
234
+ return children.props.dangerouslySetInnerHTML.__html;
235
+ }
236
+ if ((_h = (_g = (_f2 = valueObj.label) == null ? void 0 : _f2.props) == null ? void 0 : _g.dangerouslySetInnerHTML) == null ? void 0 : _h.__html) {
237
+ return valueObj.label.props.dangerouslySetInnerHTML.__html;
238
+ }
239
+ return children || valueObj.label;
354
240
  }
355
- // 如果是React元素,尝试提取文本内容
356
- return children || valueObj.label;
241
+ return valueObj.label;
357
242
  }
358
- return valueObj.label;
359
- }
360
-
361
- // 备选方案2:使用value作为fallback
362
- return targetValue;
363
- });
364
- const tooltipContent = omittedLabels.join('、');
365
- return /*#__PURE__*/_jsx(Tooltip, {
366
- title: tooltipContent,
367
- placement: "topLeft",
368
- children: /*#__PURE__*/_jsxs("span", {
369
- children: ["+ ", /*#__PURE__*/_jsx("b", {
370
- className: "pro-tree-more-count",
371
- children: omittedValues.length
372
- }), "..."]
373
- })
374
- });
375
- }, [selectList, finalFieldNames, showCodeName]);
376
-
377
- // 纯展示处理
243
+ return targetValue;
244
+ });
245
+ const tooltipContent = omittedLabels.join("、");
246
+ return /* @__PURE__ */ jsx(Tooltip, { title: tooltipContent, placement: "topLeft", children: /* @__PURE__ */ jsxs("span", { children: [
247
+ "+ ",
248
+ /* @__PURE__ */ jsx("b", { className: "pro-tree-more-count", children: omittedValues.length }),
249
+ "..."
250
+ ] }) });
251
+ },
252
+ [selectList, finalFieldNames, showCodeName]
253
+ );
378
254
  if (isView || props.isView) {
379
255
  if (Array.isArray(value)) {
380
- // 从selectProps或props中获取maxTagCount,因为此时treeProps还未定义
381
256
  const maxTagCount = selectProps.maxTagCount || props.maxTagCount;
382
- // 如果设置了maxTagCount且超出数量,需要截断显示
383
- const shouldTruncate = typeof maxTagCount === 'number' && value.length > maxTagCount;
257
+ const shouldTruncate = typeof maxTagCount === "number" && value.length > maxTagCount;
384
258
  if (shouldTruncate) {
385
- // 截断显示:显示前N项 + "更多N项..."的hover提示
386
- const maxCount = typeof maxTagCount === 'number' ? maxTagCount : 0;
259
+ const maxCount = typeof maxTagCount === "number" ? maxTagCount : 0;
387
260
  const visibleItems = value.slice(0, maxCount);
388
261
  const hiddenItems = value.slice(maxCount);
389
262
  const hiddenCount = value.length - maxCount;
390
263
  const visibleText = transToLabel(visibleItems);
391
- const hiddenText = transToLabel(hiddenItems); // 只显示被隐藏的标签
392
- const moreText = locale?.ProForm?.moreItems ? /*#__PURE__*/_jsxs(_Fragment, {
393
- children: [locale.ProForm.moreItems.split('{count}')[0], /*#__PURE__*/_jsx("b", {
394
- className: "pro-tree-more-count",
395
- children: hiddenCount
396
- }), locale.ProForm.moreItems.split('{count}')[1]]
397
- }) : /*#__PURE__*/_jsxs(_Fragment, {
398
- children: [/*#__PURE__*/_jsx("b", {
399
- className: "pro-tree-more-count",
400
- children: hiddenCount
401
- }), " more..."]
402
- });
403
- return /*#__PURE__*/_jsxs(Container, {
404
- viewEmpty: viewEmpty,
405
- children: [visibleText, "\u3001", /*#__PURE__*/_jsx(Tooltip, {
406
- title: hiddenText,
407
- placement: "topLeft",
408
- children: /*#__PURE__*/_jsx("span", {
409
- children: moreText
410
- })
411
- })]
412
- });
264
+ const hiddenText = transToLabel(hiddenItems);
265
+ const moreText = ((_d = (_c = locale) == null ? void 0 : _c.ProForm) == null ? void 0 : _d.moreItems) ? /* @__PURE__ */ jsxs(Fragment, { children: [
266
+ locale.ProForm.moreItems.split("{count}")[0],
267
+ /* @__PURE__ */ jsx("b", { className: "pro-tree-more-count", children: hiddenCount }),
268
+ locale.ProForm.moreItems.split("{count}")[1]
269
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
270
+ /* @__PURE__ */ jsx("b", { className: "pro-tree-more-count", children: hiddenCount }),
271
+ " more..."
272
+ ] });
273
+ return /* @__PURE__ */ jsxs(Container, { viewEmpty, children: [
274
+ visibleText,
275
+ "、",
276
+ /* @__PURE__ */ jsx(Tooltip, { title: hiddenText, placement: "topLeft", children: /* @__PURE__ */ jsx("span", { children: moreText }) })
277
+ ] });
413
278
  }
414
-
415
- // 不需要截断,正常显示
416
- return /*#__PURE__*/_jsx(Container, {
417
- tooltip: true,
418
- viewEmpty: viewEmpty,
419
- children: transToLabel(value)
420
- });
279
+ return /* @__PURE__ */ jsx(Container, { tooltip: true, viewEmpty, children: transToLabel(value) });
421
280
  }
422
- return /*#__PURE__*/_jsx(Container, {
423
- viewEmpty: viewEmpty,
424
- children: value ? transToLabel([value]) : null
425
- });
281
+ return /* @__PURE__ */ jsx(Container, { viewEmpty, children: value ? transToLabel([value]) : null });
426
282
  }
427
283
  const Icon = () => {
428
- return /*#__PURE__*/_jsx("svg", {
429
- className: "icon",
430
- viewBox: "0 0 1433 1024",
431
- version: "1.1",
432
- xmlns: "http://www.w3.org/2000/svg",
433
- "p-id": "2318",
434
- width: "1em",
435
- height: "1em",
436
- children: /*#__PURE__*/_jsx("path", {
437
- d: "M209.92 337.2032l362.0864 361.984L1223.68 47.5136l144.7936 144.896-796.4672 796.4672-506.88-506.88z",
438
- "p-id": "2319",
439
- fill: "currentColor"
440
- })
441
- });
284
+ return /* @__PURE__ */ jsx(
285
+ "svg",
286
+ {
287
+ className: "icon",
288
+ viewBox: "0 0 1433 1024",
289
+ version: "1.1",
290
+ xmlns: "http://www.w3.org/2000/svg",
291
+ "p-id": "2318",
292
+ width: "1em",
293
+ height: "1em",
294
+ children: /* @__PURE__ */ jsx(
295
+ "path",
296
+ {
297
+ d: "M209.92 337.2032l362.0864 361.984L1223.68 47.5136l144.7936 144.896-796.4672 796.4672-506.88-506.88z",
298
+ "p-id": "2319",
299
+ fill: "currentColor"
300
+ }
301
+ )
302
+ }
303
+ );
442
304
  };
443
-
444
- // filterTree 写入的高亮标记(纯文本分隔)转成安全的 React 节点,避免 dangerouslySetInnerHTML
445
- const renderHighlightLabel = text => {
446
- if (!text || !text.includes('highlight-search-text')) return text;
305
+ const renderHighlightLabel = (text) => {
306
+ if (!text || !text.includes("highlight-search-text"))
307
+ return text;
447
308
  const parts = text.split(/(<span class="highlight-search-text">.*?<\/span>)/g);
448
309
  return parts.map((part, i) => {
449
310
  const match = part.match(/^<span class="highlight-search-text">(.*?)<\/span>$/);
450
311
  if (match) {
451
- return /*#__PURE__*/_jsx("span", {
452
- className: "highlight-search-text",
453
- children: match[1]
454
- }, i);
312
+ return /* @__PURE__ */ jsx("span", { className: "highlight-search-text", children: match[1] }, i);
455
313
  }
456
314
  return part;
457
315
  });
458
316
  };
459
-
460
- /**
461
- * 自定义渲染子树
462
- * 注意:此时数据已经是标准格式(label, value, children)
463
- * @param node 每个节点数据对象(标准格式)
464
- * @returns 整个react节点树
465
- */
466
317
  const renderTreeNode = (node, grade) => {
467
- const {
468
- children,
469
- icon,
470
- label,
471
- value: nodeValue,
472
- key: nodeKey
473
- } = node;
318
+ const { children, icon, label, value: nodeValue, key: nodeKey } = node;
474
319
  let labelText = label;
475
- let value = nodeValue;
476
- let key = nodeValue; // 使用 value 作为 key,如果有 key 字段则使用 key
477
- if (nodeKey !== undefined) {
320
+ let value2 = nodeValue;
321
+ let key = nodeValue;
322
+ if (nodeKey !== void 0) {
478
323
  key = nodeKey;
479
324
  }
480
- // 三无走默认
481
- if (['undefined-undefined', 'undefined'].includes(labelText) && !value && !key) {
325
+ if (["undefined-undefined", "undefined"].includes(labelText) && !value2 && !key) {
482
326
  if (showCodeName) {
483
- labelText = `${node?.value}-${node?.label}`;
327
+ labelText = `${node == null ? void 0 : node.value}-${node == null ? void 0 : node.label}`;
484
328
  } else {
485
- labelText = node?.label;
329
+ labelText = node == null ? void 0 : node.label;
486
330
  }
487
- value = node?.value;
488
- key = node?.value;
331
+ value2 = node == null ? void 0 : node.value;
332
+ key = node == null ? void 0 : node.value;
489
333
  }
490
- const titleHtml = /*#__PURE__*/_jsx("span", {
491
- children: renderHighlightLabel(labelText)
492
- });
493
- let searchKey = '';
334
+ const titleHtml = /* @__PURE__ */ jsx("span", { children: renderHighlightLabel(labelText) });
335
+ let searchKey = "";
494
336
  if (showCodeName) {
495
- searchKey = `${value}-${labelText}`;
337
+ searchKey = `${value2}-${labelText}`;
496
338
  } else {
497
339
  searchKey = labelText;
498
340
  }
499
- let title = treeCheckable ? titleHtml : /*#__PURE__*/_jsxs("span", {
500
- className: "check-option-text",
501
- children: [/*#__PURE__*/_jsx("span", {
502
- className: "check-option-text-content",
503
- children: titleHtml
504
- }), !disabled ? /*#__PURE__*/_jsx("span", {
505
- className: "check-mark-icon",
506
- children: /*#__PURE__*/_jsx(Icon, {})
507
- }) : null]
508
- });
341
+ let title = treeCheckable ? titleHtml : /* @__PURE__ */ jsxs("span", { className: "check-option-text", children: [
342
+ /* @__PURE__ */ jsx("span", { className: "check-option-text-content", children: titleHtml }),
343
+ !disabled ? /* @__PURE__ */ jsx("span", { className: "check-mark-icon", children: /* @__PURE__ */ jsx(Icon, {}) }) : null
344
+ ] });
509
345
  if (_showEllipse) {
510
- title = /*#__PURE__*/_jsx(AdaptiveTooltip, {
511
- children: treeCheckable ? titleHtml : /*#__PURE__*/_jsx("span", {
512
- className: "check-option-text",
513
- children: /*#__PURE__*/_jsx("span", {
514
- className: "check-option-text-content",
515
- children: titleHtml
516
- })
517
- })
518
- });
346
+ title = /* @__PURE__ */ jsx(AdaptiveTooltip, { children: treeCheckable ? titleHtml : /* @__PURE__ */ jsx("span", { className: "check-option-text", children: /* @__PURE__ */ jsx("span", { className: "check-option-text-content", children: titleHtml }) }) });
519
347
  }
520
348
  if (!children) {
521
- return /*#__PURE__*/_jsx(TreeSelect.TreeNode, {
522
- value: value,
523
- title: title,
349
+ return /* @__PURE__ */ jsx(
350
+ TreeSelect.TreeNode,
351
+ {
352
+ value: value2,
353
+ title,
354
+ label: searchKey,
355
+ disabled: node.disabled,
356
+ checkable: node.checkable,
357
+ icon,
358
+ className: `node-val-${value2}`
359
+ },
360
+ key
361
+ );
362
+ }
363
+ const sonGrade = grade + 1;
364
+ return /* @__PURE__ */ jsx(
365
+ TreeSelect.TreeNode,
366
+ {
367
+ value: value2,
368
+ title,
524
369
  label: searchKey,
525
370
  disabled: node.disabled,
526
371
  checkable: node.checkable,
527
- icon: icon,
528
- className: `node-val-${value}`
529
- }, key);
530
- }
531
- const sonGrade = grade + 1;
532
- return /*#__PURE__*/_jsx(TreeSelect.TreeNode, {
533
- value: value,
534
- title: title,
535
- label: searchKey,
536
- disabled: node.disabled,
537
- checkable: node.checkable,
538
- className: `node-val-${value}`,
539
- children: children.map(child => renderTreeNode(child, sonGrade))
540
- }, key);
372
+ className: `node-val-${value2}`,
373
+ children: children.map((child) => renderTreeNode(child, sonGrade))
374
+ },
375
+ key
376
+ );
541
377
  };
542
-
543
- /**
544
- * 从树形数据中找出用户搜索得数据,并且将搜索字符串高亮标识
545
- * 注意:此时数据已经是标准格式(label, value, children)
546
- * @param data 全量树(标准格式)
547
- * @param searchStr 搜索字符串
548
- * @returns 处理后得树
549
- */
550
378
  function filterTree(sourceList, keyWord) {
551
- const filterData = function (data) {
552
- const currentAllNodeChild = []; // 记录当前节点得所有子节点
553
- // 遍历数组
379
+ const filterData = function(data) {
380
+ const currentAllNodeChild = [];
554
381
  for (let i = 0; i < data.length; i++) {
555
382
  const item = data[i];
556
- // 一直递归到最后一层子节点
557
- let currentNodeChild = []; // 记录当前节点下得子节点匹配到的节点个数
383
+ let currentNodeChild = [];
558
384
  if (item.children && item.children.length > 0) {
559
385
  currentNodeChild = filterData(item.children);
560
386
  }
561
- // 迭代完子节点向上回溯,如果有匹配到得子节点,那么加入当前节点得孩子对象上,否则加入得是空数组
562
387
  item.children = currentNodeChild;
563
- // 判断节点label是否包含关键字 如果有,那么直接进行下一循环
564
- // @ts-ignore
565
- if (item.label && item.label.indexOf(keyWord) > -1 && selectProps?.mode !== 'treeSelect') {
388
+ if (item.label && item.label.indexOf(keyWord) > -1 && (selectProps == null ? void 0 : selectProps.mode) !== "treeSelect") {
566
389
  const regExp = new RegExp(keyWord);
567
- item.label = item.label.replace(regExp, `<span class="highlight-search-text">${keyWord}</span>`);
390
+ item.label = item.label.replace(
391
+ regExp,
392
+ `<span class="highlight-search-text">${keyWord}</span>`
393
+ );
568
394
  }
569
395
  currentAllNodeChild.push(item);
570
396
  }
@@ -573,40 +399,24 @@ export const ProTreeSelect = (props, ref) => {
573
399
  sourceList = filterData(sourceList);
574
400
  return sourceList;
575
401
  }
576
- const searchTreeEvent = _debounce(async searchVal => {
402
+ const searchTreeEvent = debounce(async (searchVal) => {
577
403
  if (!searchVal) {
578
- setState({
579
- selectList: _cloneDeep(origDataSource || [])
580
- });
404
+ setState({ selectList: cloneDeep(origDataSource || []) });
581
405
  return null;
582
406
  }
583
- const result = filterTree(_cloneDeep(origDataSource || []), searchVal);
584
- setState({
585
- selectList: result || []
586
- });
407
+ const result = filterTree(cloneDeep(origDataSource || []), searchVal);
408
+ setState({ selectList: result || [] });
587
409
  }, 500);
588
-
589
- /**
590
- * 从树形数据中查找节点
591
- * 注意:此时数据已经是标准格式(label, value, children)
592
- * @param treeList 树形数据(标准格式)
593
- * @param nodeValue 节点值
594
- * @returns 找到的节点
595
- */
596
410
  function findTreeNode(treeList, nodeValue) {
597
411
  let result = {};
598
- const filterData = function (data) {
412
+ const filterData = function(data) {
599
413
  for (let i = 0; i < data.length; i++) {
600
414
  const item = data[i];
601
415
  if (item.value === nodeValue || Array.isArray(nodeValue) && nodeValue.includes(item.value)) {
602
- result = {
603
- ...item
604
- };
605
- // 删除 children 字段,避免循环引用
416
+ result = { ...item };
606
417
  delete result.children;
607
418
  return null;
608
419
  }
609
- // 一直递归到最后一层子节点
610
420
  if (item.children && item.children.length > 0) {
611
421
  filterData(item.children);
612
422
  }
@@ -615,20 +425,13 @@ export const ProTreeSelect = (props, ref) => {
615
425
  filterData(treeList);
616
426
  return result;
617
427
  }
618
- /**
619
- * 根据值获取标签
620
- * 注意:此时数据已经是标准格式(label, value, children)
621
- * @param treeList 树形数据(标准格式)
622
- * @param nodeValue 节点值
623
- * @returns 标签对象或数组
624
- */
625
428
  function getLabelByValue(treeList, nodeValue) {
626
429
  let result = nodeValue;
627
430
  if (nodeValue) {
628
431
  if (Array.isArray(nodeValue)) {
629
432
  result = [];
630
- nodeValue.map(item => {
631
- const res = findTreeNode(treeList, item?.value);
433
+ nodeValue.map((item) => {
434
+ const res = findTreeNode(treeList, item == null ? void 0 : item.value);
632
435
  res && result.push(res);
633
436
  return item;
634
437
  });
@@ -639,13 +442,11 @@ export const ProTreeSelect = (props, ref) => {
639
442
  return result;
640
443
  }
641
444
  const handleChange = (newVal, label, extra) => {
642
- // newVal回来得一定是label、value
643
- // 注意:此时数据已经是标准格式(label, value, children)
644
- const _selectList = selectList.map(item => {
445
+ const _selectList = selectList.map((item) => {
645
446
  let _label = item.label;
646
447
  if (_label) {
647
448
  const regex = /<span class="highlight-search-text">(.*?)<\/span>/g;
648
- _label = item.label = _label.replace(regex, '$1');
449
+ _label = item.label = _label.replace(regex, "$1");
649
450
  }
650
451
  return {
651
452
  ...item,
@@ -653,65 +454,60 @@ export const ProTreeSelect = (props, ref) => {
653
454
  };
654
455
  });
655
456
  let result = newVal;
656
- if (props?.labelInValue) {
457
+ if (props == null ? void 0 : props.labelInValue) {
657
458
  result = getLabelByValue(_selectList, newVal);
658
459
  }
659
- // showCodeName 仅影响展示,回调返回的 option 需还原原始 label
660
- const options = restoreCodeNameLabel(findTreeNode(_selectList, extra?.triggerValue), showCodeName);
460
+ const options = restoreCodeNameLabel(
461
+ findTreeNode(_selectList, extra == null ? void 0 : extra.triggerValue),
462
+ showCodeName
463
+ );
661
464
  onChange && onChange(result, options, extra);
662
- // 重置搜索
663
- showSearch && searchTreeEvent('');
465
+ showSearch && searchTreeEvent("");
664
466
  };
665
-
666
- /**
667
- * 全局点击事件, 如果是单选的情况那么点击选中节点后取消勾选
668
- * @param e 事件源
669
- */
670
- const nodeChangeEvent = e => {
467
+ const nodeChangeEvent = (e) => {
671
468
  const el = e.target;
672
469
  const classStr = el.className;
673
- if (classStr && !treeCheckable && typeof classStr === 'string') {
674
- const [valStr] = classStr.split(' ');
675
- if (valStr && classStr.startsWith('node-val-')) {
676
- const choiceVal = valStr.replace('node-val-', '');
470
+ if (classStr && !treeCheckable && typeof classStr === "string") {
471
+ const [valStr] = classStr.split(" ");
472
+ if (valStr && classStr.startsWith("node-val-")) {
473
+ const choiceVal = valStr.replace("node-val-", "");
677
474
  if (value === choiceVal) {
678
- onChange && onChange(undefined, [], null);
475
+ onChange && onChange(void 0, [], null);
679
476
  }
680
477
  }
681
478
  }
682
479
  };
683
-
684
- // 如果单选情况下只有10条那么设置class控制样式
685
- let tenCountClass = '';
686
- const countTen = enums => {
480
+ let tenCountClass = "";
481
+ const countTen = (enums) => {
687
482
  if (!enums) {
688
- return '';
483
+ return "";
689
484
  }
690
485
  let noneChild = true;
691
- const loopCount = data => {
692
- data.map(item => {
693
- if (item?.children?.length) {
486
+ const loopCount = (data) => {
487
+ data.map((item) => {
488
+ var _a2;
489
+ if ((_a2 = item == null ? void 0 : item.children) == null ? void 0 : _a2.length) {
694
490
  noneChild = false;
695
491
  }
696
492
  return item;
697
493
  });
698
494
  };
699
495
  loopCount(enums);
700
- return noneChild ? 'ten-count-tree-node' : '';
496
+ return noneChild ? "ten-count-tree-node" : "";
701
497
  };
702
498
  tenCountClass = countTen(selectList);
703
499
  const cls = classnames({
704
- 'pro-tree-select': true,
500
+ "pro-tree-select": true,
705
501
  [`${className}`]: className
706
502
  });
707
- const innerClass = treeCheckable ? 'checkable-tree pro' : `${tenCountClass} signal-tree`;
503
+ const innerClass = treeCheckable ? "checkable-tree pro" : `${tenCountClass} signal-tree`;
708
504
  const dropDownClassName = classnames({
709
- 'pro-tree-select-drop-down-container': true,
505
+ "pro-tree-select-drop-down-container": true,
710
506
  [`${innerClass}`]: true,
711
507
  [`${popupClassName}`]: popupClassName
712
508
  });
713
- const selectClassNames = selectProps?.classNames;
714
- const selectStyles = selectProps?.styles;
509
+ const selectClassNames = selectProps == null ? void 0 : selectProps.classNames;
510
+ const selectStyles = selectProps == null ? void 0 : selectProps.styles;
715
511
  const treeProps = {
716
512
  disabled,
717
513
  showSearch,
@@ -726,10 +522,7 @@ export const ProTreeSelect = (props, ref) => {
726
522
  value,
727
523
  onChange: handleChange,
728
524
  listHeight: listHeight || 320,
729
- style: {
730
- width: width || '100%',
731
- ...style
732
- },
525
+ style: { width: width || "100%", ...style },
733
526
  onSearch: searchTreeEvent,
734
527
  allowClear: allowClear || true,
735
528
  treeNodeFilterProp,
@@ -740,20 +533,20 @@ export const ProTreeSelect = (props, ref) => {
740
533
  classNames: {
741
534
  ...selectClassNames,
742
535
  popup: {
743
- ...selectClassNames?.popup,
744
- root: [selectClassNames?.popup?.root, dropDownClassName].filter(Boolean).join(' ')
536
+ ...selectClassNames == null ? void 0 : selectClassNames.popup,
537
+ root: [(_e = selectClassNames == null ? void 0 : selectClassNames.popup) == null ? void 0 : _e.root, dropDownClassName].filter(Boolean).join(" ")
745
538
  }
746
539
  },
747
540
  styles: {
748
541
  ...selectStyles,
749
542
  popup: {
750
- ...selectStyles?.popup,
543
+ ...selectStyles == null ? void 0 : selectStyles.popup,
751
544
  root: {
752
545
  maxHeight: 320,
753
- paddingTop: '0px',
754
- maxWidth: '580px',
546
+ paddingTop: "0px",
547
+ maxWidth: "580px",
755
548
  ...dropdownStyle,
756
- ...selectStyles?.popup?.root
549
+ ...(_f = selectStyles == null ? void 0 : selectStyles.popup) == null ? void 0 : _f.root
757
550
  }
758
551
  }
759
552
  }
@@ -761,15 +554,18 @@ export const ProTreeSelect = (props, ref) => {
761
554
  if (value === null) {
762
555
  delete treeProps.value;
763
556
  }
764
- return /*#__PURE__*/_jsx("div", {
765
- onClick: nodeChangeEvent,
766
- className: cls,
767
- children: /*#__PURE__*/_jsx(TreeSelect, {
557
+ return /* @__PURE__ */ jsx("div", { onClick: nodeChangeEvent, className: cls, children: /* @__PURE__ */ jsx(
558
+ TreeSelect,
559
+ {
768
560
  placeholder: placeholder || locale.ProForm.treeSelectPlaceholder,
769
- maxTagPlaceholder: maxTagPlaceholder,
561
+ maxTagPlaceholder,
770
562
  ...treeProps,
771
- children: selectList.map(node => renderTreeNode(node, 1))
772
- })
773
- });
563
+ children: selectList.map((node) => renderTreeNode(node, 1))
564
+ }
565
+ ) });
566
+ };
567
+ var ProTreeSelect_default = forwardRef(ProTreeSelect);
568
+ export {
569
+ ProTreeSelect,
570
+ ProTreeSelect_default as default
774
571
  };
775
- export default /*#__PURE__*/forwardRef(ProTreeSelect);