@para-ui/core 2.2.9 → 3.0.1

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 (360) hide show
  1. package/AutoBox/index.d.ts +34 -34
  2. package/AutoBox/index.js +203 -15
  3. package/AutoTips/index.d.ts +27 -27
  4. package/AutoTips/index.js +84 -15
  5. package/Breadcrumbs/index.d.ts +39 -39
  6. package/Breadcrumbs/index.js +227 -15
  7. package/Button/SplitButton.d.ts +62 -61
  8. package/Button/index.d.ts +79 -56
  9. package/Button/index.js +387 -14
  10. package/Button/lang/en_US.d.ts +4 -4
  11. package/Button/lang/index.d.ts +9 -9
  12. package/Button/lang/zh_CN.d.ts +4 -4
  13. package/ButtonGroup/index.d.ts +33 -33
  14. package/ButtonGroup/index.js +128 -14
  15. package/Carousel/index.d.ts +38 -30
  16. package/Carousel/index.js +77 -15
  17. package/Cascader/index.d.ts +52 -52
  18. package/Cascader/index.js +166 -15
  19. package/Cascader/lang/en_US.d.ts +4 -4
  20. package/Cascader/lang/index.d.ts +9 -9
  21. package/Cascader/lang/zh_CN.d.ts +4 -4
  22. package/Checkbox/index.d.ts +40 -40
  23. package/Checkbox/index.js +105 -14
  24. package/CheckboxGroup/index.d.ts +46 -46
  25. package/CheckboxGroup/index.js +138 -14
  26. package/Collapse/collapsePanel.d.ts +30 -30
  27. package/Collapse/index.d.ts +57 -57
  28. package/Collapse/index.js +171 -15
  29. package/Collapse/motion.d.ts +5 -5
  30. package/Collapse/util.d.ts +11 -11
  31. package/CollapseBox/index.d.ts +27 -27
  32. package/CollapseBox/index.js +164 -15
  33. package/CollapseBox/util.d.ts +5 -5
  34. package/ColorPicker/index.d.ts +4 -4
  35. package/ColorPicker/index.js +4 -1
  36. package/ComboSelect/index.d.ts +6 -11
  37. package/ComboSelect/index.js +1062 -14
  38. package/ComboSelect/interface.d.ts +145 -143
  39. package/ComboSelect/lang/en_US.d.ts +9 -8
  40. package/ComboSelect/lang/index.d.ts +19 -17
  41. package/ComboSelect/lang/zh_CN.d.ts +9 -8
  42. package/ComboSelect/utils.d.ts +9 -12
  43. package/Container/index.d.ts +77 -77
  44. package/Container/index.js +234 -15
  45. package/DatePicker/PickerButton.d.ts +3 -3
  46. package/DatePicker/PickerTag.d.ts +3 -3
  47. package/DatePicker/generatePicker/generateRangePicker.d.ts +4 -4
  48. package/DatePicker/generatePicker/generateSinglePicker.d.ts +11 -11
  49. package/DatePicker/generatePicker/index.d.ts +84 -77
  50. package/DatePicker/index.d.ts +18 -18
  51. package/DatePicker/index.js +737 -14
  52. package/DatePicker/lang/en_US.d.ts +3 -3
  53. package/DatePicker/lang/index.d.ts +7 -7
  54. package/DatePicker/lang/zh_CN.d.ts +3 -3
  55. package/DatePicker/util.d.ts +20 -20
  56. package/Desktop/index.d.ts +57 -55
  57. package/Desktop/index.js +853 -14
  58. package/Drawer/index.d.ts +11 -11
  59. package/Drawer/index.js +195 -14
  60. package/Drawer/interface.d.ts +83 -83
  61. package/Drawer/lang/en_US.d.ts +5 -5
  62. package/Drawer/lang/index.d.ts +11 -11
  63. package/Drawer/lang/zh_CN.d.ts +5 -5
  64. package/Dropdown/index.d.ts +38 -0
  65. package/Dropdown/index.js +67 -0
  66. package/Empty/images/index.d.ts +3 -2
  67. package/Empty/index.d.ts +30 -30
  68. package/Empty/index.js +644 -14
  69. package/Empty/lang/en_US.d.ts +6 -6
  70. package/Empty/lang/index.d.ts +13 -13
  71. package/Empty/lang/zh_CN.d.ts +6 -6
  72. package/Form/index.d.ts +181 -181
  73. package/Form/index.js +377 -14
  74. package/FormItem/compoments/defaultCompoments/index.d.ts +19 -19
  75. package/FormItem/compoments/formCheckboxGroup/index.d.ts +8 -8
  76. package/FormItem/compoments/formFile/index.d.ts +38 -38
  77. package/FormItem/compoments/formRadioGroup/index.d.ts +8 -8
  78. package/FormItem/compoments/formSelect/index.d.ts +18 -18
  79. package/FormItem/errorTips.d.ts +12 -12
  80. package/FormItem/index.d.ts +152 -152
  81. package/FormItem/index.js +74 -14
  82. package/FormItem/itemType.d.ts +42 -42
  83. package/FormItem/validateFunction.d.ts +15 -15
  84. package/FunctionModal/dialog.d.ts +58 -58
  85. package/FunctionModal/index.d.ts +8 -8
  86. package/FunctionModal/index.js +39 -14
  87. package/FunctionModal/modalContext.d.ts +15 -14
  88. package/GlobalContext/componentsProps.d.ts +21 -19
  89. package/GlobalContext/confirmLocale.d.ts +7 -7
  90. package/GlobalContext/index.d.ts +28 -28
  91. package/GlobalContext/index.js +41 -16
  92. package/GlobalContext/intl.d.ts +34 -34
  93. package/GlobalContext/useFormatMessage.d.ts +3 -3
  94. package/Help/index.d.ts +24 -20
  95. package/Help/index.js +39 -15
  96. package/HelperText/index.d.ts +19 -19
  97. package/HelperText/index.js +29 -15
  98. package/Hooks/useGlobalProps.d.ts +1 -1
  99. package/InputLang/index.d.ts +49 -49
  100. package/InputLang/index.js +270 -14
  101. package/InputNumber/index.d.ts +74 -74
  102. package/InputNumber/index.js +308 -14
  103. package/Label/index.d.ts +35 -35
  104. package/Label/index.js +81 -14
  105. package/Loading/index.d.ts +17 -17
  106. package/Loading/index.js +47 -15
  107. package/Menu/footerExpansion.d.ts +9 -9
  108. package/Menu/index.d.ts +10 -10
  109. package/Menu/index.js +1232 -14
  110. package/Menu/interface.d.ts +139 -139
  111. package/Menu/logo.d.ts +9 -9
  112. package/Menu/verticalMenuList.d.ts +14 -14
  113. package/Message/index.d.ts +73 -73
  114. package/Message/index.js +222 -15
  115. package/Modal/Confirm/index.d.ts +65 -66
  116. package/Modal/index.d.ts +99 -61
  117. package/Modal/index.js +449 -14
  118. package/Modal/lang/en_US.d.ts +5 -5
  119. package/Modal/lang/index.d.ts +11 -11
  120. package/Modal/lang/zh_CN.d.ts +5 -5
  121. package/MultiBox/index.d.ts +54 -54
  122. package/MultiBox/index.js +231 -14
  123. package/Notification/index.d.ts +74 -52
  124. package/Notification/index.js +266 -15
  125. package/OperateBtn/index.d.ts +59 -59
  126. package/OperateBtn/index.js +260 -14
  127. package/OperateBtn/lang/en_US.d.ts +4 -4
  128. package/OperateBtn/lang/index.d.ts +9 -9
  129. package/OperateBtn/lang/zh_CN.d.ts +4 -4
  130. package/PageHeader/horizontalMeun.d.ts +9 -9
  131. package/PageHeader/horizontalMeunRight.d.ts +9 -9
  132. package/PageHeader/index.d.ts +10 -10
  133. package/PageHeader/index.js +1170 -14
  134. package/PageHeader/interface.d.ts +167 -167
  135. package/Pagination/index.d.ts +33 -33
  136. package/Pagination/index.js +469 -14
  137. package/Pagination/lang/en_US.d.ts +8 -8
  138. package/Pagination/lang/index.d.ts +17 -17
  139. package/Pagination/lang/zh_CN.d.ts +8 -8
  140. package/ParauiProvider/index.d.ts +8 -12
  141. package/ParauiProvider/index.js +53 -15
  142. package/PopConfirm/index.d.ts +61 -56
  143. package/PopConfirm/index.js +191 -14
  144. package/PopConfirm/lang/en_US.d.ts +5 -5
  145. package/PopConfirm/lang/index.d.ts +11 -11
  146. package/PopConfirm/lang/zh_CN.d.ts +5 -5
  147. package/Popover/index.d.ts +16 -14
  148. package/Popover/index.js +66 -15
  149. package/Progress/Line.d.ts +47 -47
  150. package/Progress/Steps.d.ts +17 -17
  151. package/Progress/index.d.ts +81 -81
  152. package/Progress/index.js +358 -20
  153. package/Progress/utils.d.ts +6 -6
  154. package/Querying/images/index.d.ts +3 -2
  155. package/Querying/index.d.ts +26 -26
  156. package/Querying/index.js +762 -14
  157. package/Querying/lang/en_US.d.ts +4 -4
  158. package/Querying/lang/index.d.ts +9 -9
  159. package/Querying/lang/zh_CN.d.ts +4 -4
  160. package/README.md +37 -1
  161. package/Radio/index.d.ts +38 -38
  162. package/Radio/index.js +94 -14
  163. package/RadioGroup/index.d.ts +47 -47
  164. package/RadioGroup/index.js +128 -14
  165. package/Search/index.d.ts +56 -56
  166. package/Search/index.js +220 -14
  167. package/Select/index.d.ts +88 -86
  168. package/Select/index.js +1290 -14
  169. package/Select/lang/en_US.d.ts +5 -5
  170. package/Select/lang/index.d.ts +11 -11
  171. package/Select/lang/zh_CN.d.ts +5 -5
  172. package/SelectInput/index.d.ts +11 -11
  173. package/SelectInput/index.js +51 -14
  174. package/Selector/index.d.ts +11 -0
  175. package/Selector/index.js +2123 -0
  176. package/Selector/interface.d.ts +355 -0
  177. package/Selector/lang/en_US.d.ts +8 -0
  178. package/Selector/lang/index.d.ts +17 -0
  179. package/Selector/lang/zh_CN.d.ts +8 -0
  180. package/Selector/selectorData/index.d.ts +10 -0
  181. package/Selector/selectorMain/index.d.ts +10 -0
  182. package/Selector/selectorNode/index.d.ts +10 -0
  183. package/Selector/util.d.ts +15 -0
  184. package/SelectorPicker/index.d.ts +49 -0
  185. package/SelectorPicker/index.js +316 -0
  186. package/SingleBox/index.d.ts +42 -42
  187. package/SingleBox/index.js +194 -14
  188. package/Slider/index.d.ts +14 -14
  189. package/Slider/index.js +125 -15
  190. package/Slider/interface.d.ts +102 -102
  191. package/Split/index.d.ts +7 -7
  192. package/Split/index.js +134 -15
  193. package/Stepper/icons.d.ts +5 -5
  194. package/Stepper/index.d.ts +59 -39
  195. package/Stepper/index.js +98 -15
  196. package/Switch/index.d.ts +78 -78
  197. package/Switch/index.js +73 -14
  198. package/Table/index.d.ts +10 -10
  199. package/Table/index.js +2728 -14
  200. package/Table/interface.d.ts +202 -202
  201. package/Table/lang/en_US.d.ts +6 -6
  202. package/Table/lang/index.d.ts +13 -13
  203. package/Table/lang/zh_CN.d.ts +6 -6
  204. package/Table/tableBody.d.ts +9 -9
  205. package/Table/tableBodyElement/index.d.ts +15 -15
  206. package/Table/tableBodyInterface.d.ts +67 -67
  207. package/Table/tableContainer/index.d.ts +16 -16
  208. package/Table/tableElement/index.d.ts +17 -17
  209. package/Table/tableHead.d.ts +9 -9
  210. package/Table/tableHeadElement/index.d.ts +15 -15
  211. package/Table/tableHeadInterface.d.ts +26 -30
  212. package/Table/tablePagination.d.ts +9 -9
  213. package/Table/tablePaginationInterFace.d.ts +24 -24
  214. package/Table/tdElement/index.d.ts +15 -15
  215. package/Table/thElement/index.d.ts +15 -15
  216. package/Table/trElement/index.d.ts +15 -15
  217. package/Table/util.d.ts +16 -16
  218. package/Tabs/index.d.ts +69 -48
  219. package/Tabs/index.js +218 -14
  220. package/Tabs/lang/en_US.d.ts +4 -0
  221. package/Tabs/lang/index.d.ts +9 -0
  222. package/Tabs/lang/zh_CN.d.ts +4 -0
  223. package/Tag/TagGroup.d.ts +66 -66
  224. package/Tag/index.d.ts +34 -34
  225. package/Tag/index.js +286 -14
  226. package/Test/index.d.ts +3 -2
  227. package/Test/index.js +9 -16
  228. package/TextField/index.d.ts +95 -93
  229. package/TextField/index.js +687 -14
  230. package/TimePicker/index.d.ts +22 -22
  231. package/TimePicker/index.js +78 -14
  232. package/TimePicker/locale/en_US.d.ts +3 -3
  233. package/TimePicker/locale/zh_CN.d.ts +3 -3
  234. package/TimePicker/style/index.d.ts +1 -1
  235. package/Timeline/TimelineItem.d.ts +30 -0
  236. package/Timeline/index.d.ts +32 -22
  237. package/Timeline/index.js +157 -15
  238. package/ToggleButton/ToggleButtonGroup.d.ts +49 -49
  239. package/ToggleButton/index.d.ts +49 -49
  240. package/ToggleButton/index.js +200 -14
  241. package/Tooltip/index.d.ts +11 -14
  242. package/Tooltip/index.js +346 -15
  243. package/Tooltip/interface.d.ts +31 -0
  244. package/Tooltip/utils.d.ts +18 -0
  245. package/Transfer/index.d.ts +18 -17
  246. package/Transfer/index.js +343 -14
  247. package/Transfer/lang/en_US.d.ts +6 -6
  248. package/Transfer/lang/index.d.ts +13 -13
  249. package/Transfer/lang/zh_CN.d.ts +6 -6
  250. package/Tree/OperateBar/index.d.ts +13 -13
  251. package/Tree/Tree.d.ts +4 -4
  252. package/Tree/index.d.ts +5 -5
  253. package/Tree/index.js +35 -14
  254. package/Tree/interface.d.ts +207 -207
  255. package/Tree/lang/en_US.d.ts +8 -8
  256. package/Tree/lang/index.d.ts +17 -17
  257. package/Tree/lang/zh_CN.d.ts +8 -8
  258. package/Tree/utils/tools.d.ts +26 -26
  259. package/Tree/utils/treeUtil.d.ts +15 -15
  260. package/Upload/Dragger/index.d.ts +10 -10
  261. package/Upload/ErroTip/index.d.ts +13 -13
  262. package/Upload/ImageUpload/index.d.ts +14 -14
  263. package/Upload/ImgCrop/EasyCrop.d.ts +17 -17
  264. package/Upload/ImgCrop/constants.d.ts +7 -7
  265. package/Upload/ImgCrop/index.d.ts +6 -6
  266. package/Upload/ImgCrop/interface.d.ts +43 -24
  267. package/Upload/UploadList/index.d.ts +5 -5
  268. package/Upload/index.d.ts +15 -15
  269. package/Upload/index.js +1550 -14
  270. package/Upload/interface.d.ts +134 -134
  271. package/Upload/lang/en_US.d.ts +12 -12
  272. package/Upload/lang/index.d.ts +25 -25
  273. package/Upload/lang/zh_CN.d.ts +12 -12
  274. package/_verture/defineProperty-0590dc61.js +16 -0
  275. package/_verture/index-342379c6.js +391 -0
  276. package/_verture/index-5bb4b5d7.js +1551 -0
  277. package/_verture/index-a369ca3f.js +4 -0
  278. package/_verture/index-abfdd262.js +778 -0
  279. package/_verture/index-e2881a53.js +16 -0
  280. package/_verture/intl-336570e4.js +65 -0
  281. package/_verture/modalContext-59669f93.js +228 -0
  282. package/_verture/slicedToArray-d7722f4b.js +62 -0
  283. package/_verture/style-inject.es-300983ab.js +28 -0
  284. package/_verture/toConsumableArray-f8047a75.js +19 -0
  285. package/_verture/tslib.es6-55ed4bd2.js +38 -0
  286. package/_verture/typeof-498dd2b1.js +11 -0
  287. package/_verture/useFormatMessage-ac9d6acf.js +20 -0
  288. package/_verture/useGlobalProps-af9a2af6.js +12 -0
  289. package/index.d.ts +132 -128
  290. package/index.js +163 -19
  291. package/package.json +59 -23
  292. package/ComboSelect/WithTabsCombo/index.d.ts +0 -11
  293. package/ComboSelect/WithTabsCombo/interface.d.ts +0 -141
  294. package/Popper/index.d.ts +0 -13
  295. package/Popper/index.js +0 -16
  296. package/cdn/AutoBox/index.js +0 -29
  297. package/cdn/AutoTips/index.js +0 -40
  298. package/cdn/Breadcrumbs/index.js +0 -53
  299. package/cdn/Button/index.js +0 -79
  300. package/cdn/ButtonGroup/index.js +0 -79
  301. package/cdn/Carousel/index.js +0 -6
  302. package/cdn/Cascader/index.js +0 -42
  303. package/cdn/Checkbox/index.js +0 -53
  304. package/cdn/CheckboxGroup/index.js +0 -53
  305. package/cdn/Collapse/index.js +0 -27
  306. package/cdn/CollapseBox/index.js +0 -1
  307. package/cdn/ColorPicker/index.js +0 -1
  308. package/cdn/ComboSelect/index.js +0 -438
  309. package/cdn/Container/index.js +0 -1
  310. package/cdn/DatePicker/index.js +0 -185
  311. package/cdn/Desktop/index.js +0 -24
  312. package/cdn/Drawer/index.js +0 -84
  313. package/cdn/Empty/index.js +0 -1
  314. package/cdn/Form/index.js +0 -477
  315. package/cdn/FormItem/index.js +0 -477
  316. package/cdn/FunctionModal/index.js +0 -144
  317. package/cdn/GlobalContext/index.js +0 -1
  318. package/cdn/Help/index.js +0 -53
  319. package/cdn/HelperText/index.js +0 -1
  320. package/cdn/InputLang/index.js +0 -144
  321. package/cdn/InputNumber/index.js +0 -118
  322. package/cdn/Label/index.js +0 -53
  323. package/cdn/Loading/index.js +0 -14
  324. package/cdn/Menu/index.js +0 -40
  325. package/cdn/Message/index.js +0 -53
  326. package/cdn/Modal/index.js +0 -144
  327. package/cdn/MultiBox/index.js +0 -131
  328. package/cdn/Notification/index.js +0 -66
  329. package/cdn/OperateBtn/index.js +0 -92
  330. package/cdn/PageHeader/index.js +0 -92
  331. package/cdn/Pagination/index.js +0 -214
  332. package/cdn/ParauiProvider/index.js +0 -9
  333. package/cdn/PopConfirm/index.js +0 -131
  334. package/cdn/Popover/index.js +0 -16
  335. package/cdn/Popper/index.js +0 -26
  336. package/cdn/Progress/index.js +0 -58
  337. package/cdn/Querying/index.js +0 -1
  338. package/cdn/Radio/index.js +0 -53
  339. package/cdn/RadioGroup/index.js +0 -53
  340. package/cdn/Search/index.js +0 -144
  341. package/cdn/Select/index.js +0 -131
  342. package/cdn/SelectInput/index.js +0 -131
  343. package/cdn/SingleBox/index.js +0 -131
  344. package/cdn/Slider/index.js +0 -16
  345. package/cdn/Split/index.js +0 -1
  346. package/cdn/Stepper/index.js +0 -154
  347. package/cdn/Switch/index.js +0 -71
  348. package/cdn/Table/index.js +0 -292
  349. package/cdn/Tabs/index.js +0 -165
  350. package/cdn/Tag/index.js +0 -27
  351. package/cdn/Test/index.js +0 -1
  352. package/cdn/TextField/index.js +0 -105
  353. package/cdn/TimePicker/index.js +0 -185
  354. package/cdn/Timeline/index.js +0 -16
  355. package/cdn/ToggleButton/index.js +0 -79
  356. package/cdn/Tooltip/index.js +0 -40
  357. package/cdn/Transfer/index.js +0 -170
  358. package/cdn/Tree/index.js +0 -170
  359. package/cdn/Upload/index.js +0 -252
  360. package/style.css +0 -72
@@ -0,0 +1,2123 @@
1
+ import { _ as _toConsumableArray } from '../_verture/toConsumableArray-f8047a75.js';
2
+ import { _ as _slicedToArray } from '../_verture/slicedToArray-d7722f4b.js';
3
+ import { r as regenerator } from '../_verture/index-342379c6.js';
4
+ import { a as __awaiter, _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
5
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
+ import { useState, useRef, useEffect, Fragment as Fragment$1 } from 'react';
7
+ import { Radio } from '../Radio/index.js';
8
+ import { Checkbox } from '../Checkbox/index.js';
9
+ import { Popover } from '../Popover/index.js';
10
+ import { Loading } from '../Loading/index.js';
11
+ import CloseIcon from '@para-ui/icons/Close';
12
+ import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
13
+ import { Search } from '../Search/index.js';
14
+ import { Breadcrumbs } from '../Breadcrumbs/index.js';
15
+ import Empty from '../Empty/index.js';
16
+ import SearchIcon from '@para-ui/icons/Search';
17
+ import Refresh from '@para-ui/icons/Refresh';
18
+ import { ArrayToObject, Get, Post, Cancel } from '@paraview/lib';
19
+ import { u as useFormatMessage } from '../_verture/useFormatMessage-ac9d6acf.js';
20
+ import { u as useGlobalProps } from '../_verture/useGlobalProps-af9a2af6.js';
21
+ import '../Label/index.js';
22
+ import '../Help/index.js';
23
+ import '../Tooltip/index.js';
24
+ import 'rc-tooltip';
25
+ import 'rc-tooltip/lib/placements';
26
+ import 'clsx';
27
+ import '@para-ui/icons/Help';
28
+ import '@para-ui/icons/LoadingF';
29
+ import '../TextField/index.js';
30
+ import '../_verture/typeof-498dd2b1.js';
31
+ import '@para-ui/icons/PreviewClose';
32
+ import '@para-ui/icons/PreviewOpen';
33
+ import '@para-ui/icons/CloseCircle';
34
+ import '../AutoTips/index.js';
35
+ import '../HelperText/index.js';
36
+ import '../Dropdown/index.js';
37
+ import 'rc-dropdown';
38
+ import '../Button/index.js';
39
+ import '@para-ui/icons/Forbid';
40
+ import '@para-ui/icons/Down';
41
+ import '@para-ui/core/GlobalContext';
42
+ import '@para-ui/icons/More';
43
+
44
+ var css_248z$3 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-selector-node {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n}\n.paraui-selector-node:hover {\n background-color: rgba(171, 176, 185, 0.12);\n}\n.paraui-selector-node > .paraui-selector-node-left {\n display: flex;\n align-items: center;\n flex: 1;\n overflow: hidden;\n padding-right: 16px;\n}\n.paraui-selector-node > .paraui-selector-node-left > .paraui-radio {\n margin-right: 8px;\n display: flex;\n align-items: center;\n}\n.paraui-selector-node > .paraui-selector-node-left > .paraui-radio .paraui-radio-box {\n top: 0;\n}\n.paraui-selector-node > .paraui-selector-node-left > .paraui-check-box {\n margin-right: 8px;\n display: flex;\n align-items: center;\n}\n.paraui-selector-node > .paraui-selector-node-left > .paraui-check-box .paraui-checkbox-box {\n top: 0;\n}\n.paraui-selector-node > .paraui-selector-node-left > .node-img {\n display: inline-block;\n width: 30px;\n height: 30px;\n margin-right: 8px;\n}\n.paraui-selector-node > .paraui-selector-node-left > .node-img img {\n width: 30px;\n height: 30px;\n border-radius: 50%;\n}\n.paraui-selector-node.paraui-selector-node-branch {\n height: 36px;\n padding: 0 16px;\n}\n.paraui-selector-node.paraui-selector-node-branch > .paraui-selector-node-left > .main-title {\n font-size: 14px;\n color: rgb(46, 55, 67);\n white-space: nowrap;\n height: 20px;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-selector-node.paraui-selector-node-branch > .paraui-selector-node-left > .sub-title {\n margin-left: 8px;\n font-size: 14px;\n color: rgba(46, 55, 67, 0.4);\n white-space: nowrap;\n height: 20px;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-selector-node.paraui-selector-node-branch > .paraui-selector-node-left > .tag {\n margin-left: 8px;\n background-color: rgba(54, 102, 214, 0.05);\n color: rgb(54, 102, 214);\n border-radius: 2px;\n font-size: 12px;\n padding: 0px 6px;\n white-space: nowrap;\n height: 17px;\n}\n.paraui-selector-node.paraui-selector-node-leaf {\n padding: 6px 16px;\n height: 48px;\n}\n.paraui-selector-node.paraui-selector-node-leaf > .paraui-selector-node-left > .title-box {\n flex: 1;\n overflow: hidden;\n}\n.paraui-selector-node.paraui-selector-node-leaf > .paraui-selector-node-left > .title-box > .main-title-box {\n display: flex;\n white-space: nowrap;\n}\n.paraui-selector-node.paraui-selector-node-leaf > .paraui-selector-node-left > .title-box > .main-title-box > .main-title {\n font-size: 14px;\n color: rgb(46, 55, 67);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-selector-node.paraui-selector-node-leaf > .paraui-selector-node-left > .title-box > .main-title-box > .tag {\n margin-left: 8px;\n background-color: rgba(54, 102, 214, 0.05);\n color: rgb(54, 102, 214);\n border-radius: 2px;\n font-size: 12px;\n padding: 1px 6px;\n white-space: nowrap;\n}\n.paraui-selector-node.paraui-selector-node-leaf > .paraui-selector-node-left > .title-box > .sub-title {\n font-size: 12px;\n color: rgba(46, 55, 67, 0.4);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-selector-node > .paraui-selector-node-right {\n display: flex;\n align-items: center;\n height: 100%;\n}\n.paraui-selector-node > .paraui-selector-node-right > .detail {\n font-size: 14px;\n color: rgb(54, 102, 214);\n white-space: nowrap;\n padding: 0 4px;\n cursor: pointer;\n height: 24px;\n line-height: 24px;\n border-radius: 2px;\n}\n.paraui-selector-node > .paraui-selector-node-right > .detail:hover {\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-selector-node > .paraui-selector-node-right > .line {\n border-left: 1px solid rgba(171, 176, 185, 0.2);\n margin: 0 8px;\n content: \"\";\n display: inline-block;\n height: 12px;\n}\n.paraui-selector-node > .paraui-selector-node-right > .lower-child {\n font-size: 14px;\n color: rgb(54, 102, 214);\n white-space: nowrap;\n padding: 0 4px;\n cursor: pointer;\n height: 24px;\n line-height: 24px;\n border-radius: 2px;\n}\n.paraui-selector-node > .paraui-selector-node-right > .lower-child:hover {\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-selector-node > .paraui-selector-node-right > .close {\n display: flex;\n align-items: center;\n color: rgb(54, 102, 214);\n white-space: nowrap;\n padding: 0 4px;\n cursor: pointer;\n height: 24px;\n line-height: 24px;\n border-radius: 2px;\n}\n.paraui-selector-node > .paraui-selector-node-right > .close:hover {\n background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-selector-node > .paraui-selector-node-right > .close:hover > svg {\n color: rgb(54, 102, 214);\n}\n.paraui-selector-node > .paraui-selector-node-right > .close > svg {\n font-size: 16px;\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-selector-node.paraui-selector-node-edit > .paraui-selector-node-right > .detail, .paraui-selector-node.paraui-selector-node-edit > .paraui-selector-node-right > .lower-child {\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-selector-node.paraui-selector-node-edit > .paraui-selector-node-right > .detail:hover, .paraui-selector-node.paraui-selector-node-edit > .paraui-selector-node-right > .lower-child:hover {\n color: rgb(54, 102, 214);\n}\n.paraui-selector-node.paraui-selector-node-disabled {\n cursor: not-allowed;\n}\n.paraui-selector-node.paraui-selector-node-disabled.paraui-selector-node-branch > .paraui-selector-node-left > .main-title {\n color: rgba(46, 55, 67, 0.4);\n}\n.paraui-selector-node.paraui-selector-node-disabled.paraui-selector-node-leaf > .paraui-selector-node-left > .title-box > .main-title-box > .main-title {\n color: rgba(46, 55, 67, 0.4);\n}\n.paraui-selector-node.paraui-selector-node-disabled > .paraui-selector-node-right > .lower-child {\n cursor: not-allowed;\n color: rgba(46, 55, 67, 0.4);\n}\n\n.paraui-selector-detail-popover-content.paraui-selector-detail-popover-content-loading {\n min-width: 100px;\n min-height: 50px;\n}";
45
+ styleInject(css_248z$3);
46
+
47
+ var SelectorNode = function SelectorNode(props) {
48
+ var className = props.className,
49
+ style = props.style,
50
+ _props$nodeMode = props.nodeMode,
51
+ nodeMode = _props$nodeMode === void 0 ? 'branch' : _props$nodeMode,
52
+ _props$useCase = props.useCase,
53
+ useCase = _props$useCase === void 0 ? 'view' : _props$useCase,
54
+ img = props.img,
55
+ selectMode = props.selectMode,
56
+ mainTitle = props.mainTitle,
57
+ subTitle = props.subTitle,
58
+ tag = props.tag,
59
+ detail = props.detail,
60
+ detailRender = props.detailRender,
61
+ child = props.child,
62
+ close = props.close,
63
+ checked = props.checked,
64
+ indeterminate = props.indeterminate,
65
+ disabled = props.disabled,
66
+ onLevel = props.onLevel,
67
+ onSelect = props.onSelect,
68
+ onClose = props.onClose;
69
+
70
+ var _useState = useState(),
71
+ _useState2 = _slicedToArray(_useState, 2),
72
+ detailDom = _useState2[0],
73
+ setDetailDom = _useState2[1]; // 详情内容
74
+
75
+
76
+ var _useState3 = useState(false),
77
+ _useState4 = _slicedToArray(_useState3, 2),
78
+ detailDomLoading = _useState4[0],
79
+ setDetailDomLoading = _useState4[1]; // 详情loading
80
+
81
+
82
+ var detailRef = useRef();
83
+ /** 点击节点 */
84
+
85
+ var onClickNode = function onClickNode() {
86
+ if (disabled) return;
87
+ onSelect && onSelect();
88
+ };
89
+ /** 点击下级 */
90
+
91
+
92
+ var onLevelBtn = function onLevelBtn(e) {
93
+ e.stopPropagation();
94
+ if (disabled) return;
95
+ onLevel && onLevel();
96
+ };
97
+ /** 点击详情 */
98
+
99
+
100
+ var onClickDetail = function onClickDetail(e) {
101
+ e.stopPropagation();
102
+ };
103
+ /** 点击× */
104
+
105
+
106
+ var onCloseCom = function onCloseCom(e) {
107
+ e.stopPropagation();
108
+ onClose && onClose();
109
+ };
110
+ /** 详情显示隐藏 */
111
+
112
+
113
+ var onVisibleChange = function onVisibleChange(bol) {
114
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
115
+ var Dom;
116
+ return regenerator.wrap(function _callee$(_context) {
117
+ while (1) {
118
+ switch (_context.prev = _context.next) {
119
+ case 0:
120
+ if (detailRender) {
121
+ _context.next = 2;
122
+ break;
123
+ }
124
+
125
+ return _context.abrupt("return");
126
+
127
+ case 2:
128
+ setDetailDomLoading(false);
129
+
130
+ if (bol) {
131
+ _context.next = 5;
132
+ break;
133
+ }
134
+
135
+ return _context.abrupt("return", setDetailDom(null));
136
+
137
+ case 5:
138
+ setDetailDomLoading(true);
139
+ detailRef.current && detailRef.current.classList.add('paraui-selector-detail-popover-content-loading');
140
+ _context.next = 9;
141
+ return detailRender();
142
+
143
+ case 9:
144
+ Dom = _context.sent;
145
+ detailRef.current && detailRef.current.classList.remove('paraui-selector-detail-popover-content-loading');
146
+ setDetailDomLoading(false);
147
+ setDetailDom(Dom);
148
+
149
+ case 13:
150
+ case "end":
151
+ return _context.stop();
152
+ }
153
+ }
154
+ }, _callee);
155
+ }));
156
+ };
157
+ /** 处理头像 */
158
+
159
+
160
+ var handImg = function handImg() {
161
+ if (!img) return null;
162
+ var imgDom = img;
163
+ if (typeof img === "string") imgDom = jsx("img", {
164
+ src: img
165
+ });
166
+ return jsx("span", Object.assign({
167
+ className: "node-img"
168
+ }, {
169
+ children: imgDom
170
+ }));
171
+ };
172
+ /** 处理选择框 */
173
+
174
+
175
+ var handSelectDom = function handSelectDom() {
176
+ if (selectMode === 'radio') return jsx(Radio, {
177
+ size: "small",
178
+ checked: checked,
179
+ disabled: disabled
180
+ });
181
+ if (selectMode === 'check') return jsx(Checkbox, {
182
+ size: "small",
183
+ checked: checked,
184
+ disabled: disabled,
185
+ indeterminate: indeterminate
186
+ });
187
+ return null;
188
+ };
189
+ /** 处理详情弹窗 */
190
+
191
+
192
+ var handDetailDom = function handDetailDom() {
193
+ return jsxs("div", Object.assign({
194
+ className: "paraui-selector-detail-popover-content",
195
+ ref: detailRef
196
+ }, {
197
+ children: [detailDom, detailDomLoading && jsx(Loading, {})]
198
+ }));
199
+ };
200
+ /** 处理详情 */
201
+
202
+
203
+ var handDetail = function handDetail() {
204
+ if (!detail) return null;
205
+ return jsx(Popover, Object.assign({
206
+ content: handDetailDom(),
207
+ trigger: 'hover',
208
+ placement: 'bottomRight',
209
+ onVisibleChange: onVisibleChange
210
+ }, {
211
+ children: jsx("span", Object.assign({
212
+ className: "detail",
213
+ onClick: onClickDetail
214
+ }, {
215
+ children: "\u8BE6\u60C5"
216
+ }))
217
+ }));
218
+ };
219
+ /** 处理标签内容 */
220
+
221
+
222
+ var handNodeLeft = function handNodeLeft() {
223
+ if (nodeMode === 'branch') {
224
+ return jsxs(Fragment, {
225
+ children: [mainTitle && jsx("span", Object.assign({
226
+ className: "main-title"
227
+ }, {
228
+ children: mainTitle
229
+ })), subTitle && jsx("span", Object.assign({
230
+ className: "sub-title"
231
+ }, {
232
+ children: subTitle
233
+ })), tag && jsx("span", Object.assign({
234
+ className: "tag"
235
+ }, {
236
+ children: tag
237
+ }))]
238
+ });
239
+ }
240
+
241
+ if (nodeMode === 'leaf') {
242
+ return jsxs("div", Object.assign({
243
+ className: "title-box"
244
+ }, {
245
+ children: [jsxs("div", Object.assign({
246
+ className: "main-title-box"
247
+ }, {
248
+ children: [mainTitle && jsx("span", Object.assign({
249
+ className: "main-title"
250
+ }, {
251
+ children: mainTitle
252
+ })), tag && jsx("span", Object.assign({
253
+ className: "tag"
254
+ }, {
255
+ children: tag
256
+ }))]
257
+ })), subTitle && jsx("div", Object.assign({
258
+ className: "sub-title"
259
+ }, {
260
+ children: subTitle
261
+ }))]
262
+ }));
263
+ }
264
+ };
265
+ /** 处理className */
266
+
267
+
268
+ var handClass = function handClass() {
269
+ var str = 'paraui-selector-node';
270
+ str += ' paraui-selector-node-' + useCase;
271
+ str += ' paraui-selector-node-' + nodeMode;
272
+ if (disabled) str += ' paraui-selector-node-disabled';
273
+ if (className) str += ' ' + className;
274
+ return str;
275
+ };
276
+
277
+ return jsxs("div", Object.assign({
278
+ className: handClass(),
279
+ style: style,
280
+ onClick: onClickNode
281
+ }, {
282
+ children: [jsxs("div", Object.assign({
283
+ className: "paraui-selector-node-left"
284
+ }, {
285
+ children: [handSelectDom(), handImg(), handNodeLeft()]
286
+ })), jsxs("div", Object.assign({
287
+ className: "paraui-selector-node-right"
288
+ }, {
289
+ children: [handDetail(), detail && child && jsx("span", {
290
+ className: "line"
291
+ }), child && jsx("span", Object.assign({
292
+ className: "lower-child",
293
+ onClick: onLevelBtn
294
+ }, {
295
+ children: "\u4E0B\u7EA7"
296
+ })), detail && close && jsx("span", {
297
+ className: "line"
298
+ }), close && jsx("span", Object.assign({
299
+ className: "close",
300
+ onClick: onCloseCom
301
+ }, {
302
+ children: jsx(CloseIcon, {})
303
+ }))]
304
+ }))]
305
+ }));
306
+ };
307
+
308
+ var en = {
309
+ root: 'root',
310
+ selectAll: 'Select all',
311
+ seeMore: 'See more',
312
+ selected: 'Selected',
313
+ pleaseEnter: 'Please enter'
314
+ };
315
+
316
+ var zh = {
317
+ root: '根',
318
+ selectAll: '全选',
319
+ seeMore: '查看更多',
320
+ selected: '已选',
321
+ pleaseEnter: '请输入'
322
+ };
323
+
324
+ var localeJson = {
325
+ zh: zh,
326
+ en: en
327
+ };
328
+
329
+ var css_248z$2 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-selector-main {\n padding: 16px 0 0 0;\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n}\n.paraui-selector-main > .paraui-search {\n padding: 0 16px;\n margin-bottom: 16px;\n}\n.paraui-selector-main > .paraui-selector-main-box {\n position: relative;\n width: 100%;\n height: 100%;\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content > .nav-box {\n padding: 0 16px;\n margin-bottom: 12px;\n line-height: 0;\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content > .paraui-selector-main-list {\n flex: 1;\n overflow-y: auto;\n padding-bottom: 16px;\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content > .paraui-selector-main-list > .paraui-selector-main-list-no-data {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content > .paraui-selector-main-list > .paraui-selector-all-check + .paraui-selector-group-title.paraui-selector-group-title-first {\n margin-top: 4px;\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content > .paraui-selector-main-list > .paraui-selector-group-title {\n padding: 0 12px;\n margin-top: 24px;\n margin-bottom: 12px;\n font-size: 14px;\n color: rgba(46, 55, 67, 0.4);\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content > .paraui-selector-main-list > .paraui-selector-group-title.paraui-selector-group-title-first {\n margin-top: 0;\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content > .paraui-selector-main-list > .paraui-selector-main-list-more {\n padding: 0 16px;\n cursor: pointer;\n font-size: 14px;\n color: rgb(54, 102, 214);\n line-height: 36px;\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content > .paraui-selector-main-list > .paraui-selector-main-list-more:hover {\n background-color: rgba(171, 176, 185, 0.12);\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content.paraui-selector-main-search-content {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: white;\n}\n.paraui-selector-main > .paraui-selector-main-box > .paraui-selector-main-content.paraui-selector-main-search-content > .paraui-selector-main-list {\n padding-bottom: 16px;\n}\n.paraui-selector-main.paraui-selector-main-select > .paraui-selector-main-box > .paraui-selector-main-content > .paraui-selector-main-list > .paraui-selector-main-list-more {\n padding-left: 38px;\n}\n.paraui-selector-main.paraui-selector-main-show-search > .paraui-selector-main-box {\n height: calc(100% - 52px);\n}\n.paraui-selector-main.paraui-selector-main-show-search > .paraui-selector-main-box > .paraui-selector-main-content.paraui-selector-main-list-box {\n display: none;\n}\n.paraui-selector-main.paraui-selector-main-search > .paraui-selector-main-box {\n height: calc(100% - 52px);\n}";
330
+ styleInject(css_248z$2);
331
+
332
+ var SelectorMainContent = function SelectorMainContent(props) {
333
+ var className = props.className,
334
+ value = props.value,
335
+ _props$rowKey = props.rowKey,
336
+ rowKey = _props$rowKey === void 0 ? 'key' : _props$rowKey,
337
+ _props$nodeMode = props.nodeMode,
338
+ nodeMode = _props$nodeMode === void 0 ? 'branch' : _props$nodeMode,
339
+ selectMode = props.selectMode,
340
+ _props$loadMore = props.loadMore,
341
+ loadMore = _props$loadMore === void 0 ? false : _props$loadMore,
342
+ _props$isAllCheck = props.isAllCheck,
343
+ isAllCheck = _props$isAllCheck === void 0 ? false : _props$isAllCheck,
344
+ detail = props.detail,
345
+ detailRender = props.detailRender,
346
+ isLazy = props.isLazy,
347
+ list = props.list,
348
+ groupType = props.groupType,
349
+ breadcrumbs = props.breadcrumbs,
350
+ _props$breadcrumbsSep = props.breadcrumbsSeparator,
351
+ breadcrumbsSeparator = _props$breadcrumbsSep === void 0 ? '-' : _props$breadcrumbsSep,
352
+ _props$breadcrumbsLis = props.breadcrumbsList,
353
+ breadcrumbsList = _props$breadcrumbsLis === void 0 ? [] : _props$breadcrumbsLis,
354
+ fieldConfig = props.fieldConfig,
355
+ disabled = props.disabled,
356
+ emptyProps = props.emptyProps,
357
+ loading = props.loading,
358
+ onClickBreadcrumbs = props.onClickBreadcrumbs,
359
+ _onLevel = props.onLevel,
360
+ _onSelect = props.onSelect,
361
+ onLoad = props.onLoad,
362
+ onAllCheck = props.onAllCheck;
363
+ var intl = useFormatMessage('Selector', localeJson);
364
+
365
+ var _useState = useState({}),
366
+ _useState2 = _slicedToArray(_useState, 2),
367
+ listCom = _useState2[0],
368
+ setListCom = _useState2[1];
369
+
370
+ var constData = useRef({
371
+ listTypeJson: {},
372
+ fieldConfig: {}
373
+ });
374
+ constData.current.listTypeJson = ArrayToObject('value', groupType);
375
+ constData.current.fieldConfig = fieldConfig || {};
376
+ useEffect(function () {
377
+ if (list && groupType && groupType.length > 0) {
378
+ var json = {};
379
+
380
+ for (var i = 0, l = list.length; i < l; i++) {
381
+ var item = list[i];
382
+ var type = item[constData.current.fieldConfig.type || ''];
383
+ if (!json[type]) json[type] = [];
384
+ json[type].push(item);
385
+ }
386
+
387
+ setListCom(json);
388
+ }
389
+ }, [list]);
390
+ /** 判断是否全选,半选 */
391
+
392
+ var handAllCheckFunc = function handAllCheckFunc() {
393
+ var json = {
394
+ checked: false,
395
+ indeterminate: false
396
+ }; // 不存在value, 没有数据, 全选没转态
397
+
398
+ if (!value || !list || list.length === 0) return json;
399
+
400
+ for (var i = 0, l = list.length; i < l; i++) {
401
+ var item = list[i];
402
+ var key = item[rowKey];
403
+ var disabledItem = handDisabled(item);
404
+
405
+ if (disabledItem) {
406
+ if (value[key]) json.checked = true;
407
+ continue;
408
+ }
409
+
410
+ if (value[key]) {
411
+ json.checked = true;
412
+ } else {
413
+ json.indeterminate = true;
414
+ }
415
+ } // 半选
416
+
417
+
418
+ if (json.checked && json.indeterminate) {
419
+ json.checked = false;
420
+ return json;
421
+ } // 全不选
422
+
423
+
424
+ if (!json.checked && json.indeterminate) {
425
+ json.indeterminate = false;
426
+ return json;
427
+ }
428
+
429
+ return json;
430
+ };
431
+ /** 处理禁用状态 */
432
+
433
+
434
+ var handDisabled = function handDisabled(item) {
435
+ if (disabled) {
436
+ if (disabled === true) return true;
437
+
438
+ if (disabled instanceof Array) {
439
+ if (item.key && disabled.indexOf(item.key) !== -1) {
440
+ return true;
441
+ }
442
+ }
443
+ }
444
+
445
+ if (item.disabled) return true;
446
+ return false;
447
+ };
448
+ /** 全选 */
449
+
450
+
451
+ var handAllCheck = function handAllCheck() {
452
+ // 只存在复选框模式
453
+ if (!isAllCheck || selectMode !== "check") return null;
454
+ var checkJson = handAllCheckFunc();
455
+
456
+ var onAllCheckCom = function onAllCheckCom() {
457
+ var bol = true;
458
+ if (checkJson.checked) bol = false;
459
+ onAllCheck && onAllCheck(bol);
460
+ };
461
+
462
+ return jsx(SelectorNode, Object.assign({
463
+ disabled: disabled === true,
464
+ nodeMode: 'branch',
465
+ mainTitle: intl({
466
+ id: 'selectAll'
467
+ }),
468
+ selectMode: 'check'
469
+ }, checkJson, {
470
+ onSelect: onAllCheckCom,
471
+ className: 'paraui-selector-all-check'
472
+ }));
473
+ };
474
+ /** 点击查看更多 */
475
+
476
+
477
+ var clickLoad = function clickLoad() {
478
+ onLoad && onLoad();
479
+ };
480
+ /** 查看更多 */
481
+
482
+
483
+ var handLoadMore = function handLoadMore() {
484
+ if (!loadMore) return null;
485
+ return jsx("div", Object.assign({
486
+ className: "paraui-selector-main-list-more",
487
+ onClick: clickLoad
488
+ }, {
489
+ children: jsx("span", Object.assign({
490
+ className: "more-btn"
491
+ }, {
492
+ children: intl({
493
+ id: 'seeMore'
494
+ })
495
+ }))
496
+ }));
497
+ };
498
+ /** 判断是否选中 */
499
+
500
+
501
+ var handCheck = function handCheck(item) {
502
+ var bol = false;
503
+ if (value && value[item[rowKey]]) bol = true;
504
+ return bol;
505
+ };
506
+ /** 处理每个节点的配置 */
507
+
508
+
509
+ var handNodeConfig = function handNodeConfig(item) {
510
+ var json = {
511
+ useCase: 'view',
512
+ detail: detail,
513
+ nodeMode: nodeMode,
514
+ disabled: handDisabled(item),
515
+ onLevel: function onLevel() {
516
+ return _onLevel && _onLevel(item);
517
+ },
518
+ onSelect: function onSelect() {
519
+ return _onSelect && _onSelect(item);
520
+ },
521
+ checked: handCheck(item)
522
+ };
523
+ /** 节点类型 */
524
+
525
+ if (item.leaf !== undefined) json.nodeMode = item.leaf ? 'leaf' : 'branch';
526
+ /** 渲染字段 */
527
+
528
+ var arr = ['img', 'mainTitle', 'subTitle', 'tag'];
529
+
530
+ for (var i = 0, l = arr.length; i < l; i++) {
531
+ var key = arr[i];
532
+ json[key] = item[key];
533
+ }
534
+ /** 判断是否具有选择 */
535
+
536
+
537
+ if (item.choice !== false) {
538
+ // 当前节点可选择
539
+ if (selectMode) json.selectMode = selectMode;
540
+ }
541
+ /** 判断是否具有下级 */
542
+
543
+
544
+ if (isLazy) {
545
+ // 懒加载
546
+ json.child = item.child;
547
+ } else {
548
+ // 全量数据
549
+ var children = item.children || [];
550
+
551
+ if (children && children.length > 0) {
552
+ json.child = true;
553
+ } // 强制设置下级
554
+
555
+
556
+ if (item.child !== undefined) json.child = item.child;
557
+ }
558
+ /** 详情render */
559
+
560
+
561
+ if (detailRender) {
562
+ json.detailRender = function () {
563
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
564
+ var Dom;
565
+ return regenerator.wrap(function _callee$(_context) {
566
+ while (1) {
567
+ switch (_context.prev = _context.next) {
568
+ case 0:
569
+ _context.next = 2;
570
+ return detailRender(item, true);
571
+
572
+ case 2:
573
+ Dom = _context.sent;
574
+ return _context.abrupt("return", Dom);
575
+
576
+ case 4:
577
+ case "end":
578
+ return _context.stop();
579
+ }
580
+ }
581
+ }, _callee);
582
+ }));
583
+ };
584
+ }
585
+
586
+ return json;
587
+ };
588
+ /** 渲染list节点 */
589
+
590
+
591
+ var handListNode = function handListNode(arr) {
592
+ return arr === null || arr === void 0 ? void 0 : arr.map(function (item, index) {
593
+ return jsx(SelectorNode, Object.assign({}, handNodeConfig(item)), index);
594
+ });
595
+ };
596
+ /** 处理节点dom */
597
+
598
+
599
+ var handNode = function handNode() {
600
+ // 分组渲染
601
+ if (groupType && groupType.length > 0) {
602
+ return jsx(Fragment, {
603
+ children: groupType.map(function (item, index) {
604
+ var type = item.value;
605
+ var listData = listCom[type] || [];
606
+ var str = 'paraui-selector-group-title';
607
+ if (index === 0) str += ' paraui-selector-group-title-first';
608
+ return jsxs(Fragment$1, {
609
+ children: [listData.length > 0 && jsx("div", Object.assign({
610
+ className: str
611
+ }, {
612
+ children: item.label || type
613
+ })), handListNode(listData)]
614
+ }, index);
615
+ })
616
+ });
617
+ }
618
+
619
+ return handListNode(list || []);
620
+ };
621
+ /** 点击面包屑 */
622
+
623
+
624
+ var onClickBreadcrums = function onClickBreadcrums(item) {
625
+ onClickBreadcrumbs && onClickBreadcrumbs(item);
626
+ };
627
+ /** 面包屑dom */
628
+
629
+
630
+ var handBreadcrumbs = function handBreadcrumbs() {
631
+ if (!breadcrumbs || breadcrumbsList.length === 0) return null;
632
+ return jsx("div", Object.assign({
633
+ className: "nav-box"
634
+ }, {
635
+ children: jsx(Breadcrumbs, {
636
+ list: breadcrumbsList,
637
+ separator: breadcrumbsSeparator,
638
+ onClickItem: onClickBreadcrums
639
+ })
640
+ }));
641
+ };
642
+ /** 处理内容 */
643
+
644
+
645
+ var handContent = function handContent() {
646
+ if ((list === null || list === void 0 ? void 0 : list.length) === 0 && !loading) {
647
+ // 空状态
648
+ return jsx("div", Object.assign({
649
+ className: "paraui-selector-main-list-no-data"
650
+ }, {
651
+ children: jsx(Empty, Object.assign({}, emptyProps, {
652
+ size: (emptyProps === null || emptyProps === void 0 ? void 0 : emptyProps.size) || "small"
653
+ }))
654
+ }));
655
+ }
656
+
657
+ return jsxs(Fragment, {
658
+ children: [handAllCheck(), handNode(), handLoadMore()]
659
+ });
660
+ };
661
+
662
+ var handClass = function handClass() {
663
+ var str = 'paraui-selector-main-content';
664
+ if (className) str += ' ' + className;
665
+ if (disabled) str += ' paraui-selector-main-content-disabled';
666
+ return str;
667
+ };
668
+
669
+ return jsxs("div", Object.assign({
670
+ className: handClass()
671
+ }, {
672
+ children: [handBreadcrumbs(), jsx("div", Object.assign({
673
+ className: "paraui-selector-main-list"
674
+ }, {
675
+ children: handContent()
676
+ }))]
677
+ }));
678
+ };
679
+
680
+ var SelectorMain = function SelectorMain(props) {
681
+ var className = props.className,
682
+ style = props.style,
683
+ value = props.value,
684
+ _props$rowKey2 = props.rowKey,
685
+ rowKey = _props$rowKey2 === void 0 ? 'key' : _props$rowKey2,
686
+ _props$nodeMode2 = props.nodeMode,
687
+ nodeMode = _props$nodeMode2 === void 0 ? 'branch' : _props$nodeMode2,
688
+ selectMode = props.selectMode,
689
+ _props$loadMore2 = props.loadMore,
690
+ loadMore = _props$loadMore2 === void 0 ? false : _props$loadMore2,
691
+ _props$isAllCheck2 = props.isAllCheck,
692
+ isAllCheck = _props$isAllCheck2 === void 0 ? false : _props$isAllCheck2,
693
+ disabled = props.disabled,
694
+ detail = props.detail,
695
+ detailRender = props.detailRender,
696
+ isLazy = props.isLazy,
697
+ list = props.list,
698
+ groupType = props.groupType,
699
+ groupRange = props.groupRange,
700
+ search = props.search,
701
+ searchPlaceholder = props.searchPlaceholder,
702
+ searchTrigger = props.searchTrigger,
703
+ searchLoading = props.searchLoading,
704
+ searchList = props.searchList,
705
+ loading = props.loading,
706
+ breadcrumbs = props.breadcrumbs,
707
+ _props$breadcrumbsSep2 = props.breadcrumbsSeparator,
708
+ breadcrumbsSeparator = _props$breadcrumbsSep2 === void 0 ? '-' : _props$breadcrumbsSep2,
709
+ _props$breadcrumbsLis2 = props.breadcrumbsList,
710
+ breadcrumbsList = _props$breadcrumbsLis2 === void 0 ? [] : _props$breadcrumbsLis2,
711
+ fieldConfig = props.fieldConfig,
712
+ onClickBreadcrumbs = props.onClickBreadcrumbs,
713
+ onLevel = props.onLevel,
714
+ onSelect = props.onSelect,
715
+ onLoad = props.onLoad,
716
+ onAllCheck = props.onAllCheck,
717
+ onSearch = props.onSearch;
718
+ var intl = useFormatMessage('Selector', localeJson);
719
+
720
+ var _useState3 = useState(false),
721
+ _useState4 = _slicedToArray(_useState3, 2),
722
+ showSearch = _useState4[0],
723
+ setShowSearch = _useState4[1];
724
+
725
+ var _useState5 = useState(''),
726
+ _useState6 = _slicedToArray(_useState5, 2),
727
+ searchStr = _useState6[0],
728
+ setSearchStr = _useState6[1];
729
+
730
+ var constData = useRef({
731
+ searchTimer: null,
732
+ searchStr: ''
733
+ });
734
+ /** 改变搜索框 */
735
+
736
+ var changeSearch = function changeSearch(val) {
737
+ setSearchStr(val);
738
+ constData.current.searchStr = val;
739
+ if (searchTrigger !== 'onEnter') onSearchCom();
740
+ };
741
+ /** 搜索框回车事件 */
742
+
743
+
744
+ var onEnterSearch = function onEnterSearch() {
745
+ onSearchCom(true);
746
+ };
747
+ /** 点击搜索按钮 */
748
+
749
+
750
+ var onClickRightIcon = function onClickRightIcon() {
751
+ onSearchCom(true);
752
+ };
753
+ /** 向外抛出搜索事件 */
754
+
755
+
756
+ var onSearchCom = function onSearchCom(bol) {
757
+ clearTimeout(constData.current.searchTimer);
758
+ constData.current.searchTimer = setTimeout(function () {
759
+ setShowSearch(!!constData.current.searchStr);
760
+ onSearch && onSearch(constData.current.searchStr, !!bol);
761
+ }, 100);
762
+ };
763
+ /** 搜索dom */
764
+
765
+
766
+ var handSearchDom = function handSearchDom() {
767
+ var handSearchIcon = function handSearchIcon() {
768
+ if (!searchStr) return jsx(Refresh, {});
769
+ return jsx(SearchIcon, {});
770
+ };
771
+
772
+ return jsx(Fragment, {
773
+ children: search && jsx(Search, {
774
+ value: searchStr,
775
+ rightIconExist: true,
776
+ showBtn: false,
777
+ rightIcon: handSearchIcon(),
778
+ btnType: "inside",
779
+ onChange: changeSearch,
780
+ onEnter: onEnterSearch,
781
+ placeholder: searchPlaceholder || intl({
782
+ id: 'pleaseEnter'
783
+ }),
784
+ onClickRightIcon: onClickRightIcon
785
+ })
786
+ });
787
+ };
788
+ /** 渲染列表 */
789
+
790
+
791
+ var handListDom = function handListDom() {
792
+ return jsx(SelectorMainContent, {
793
+ className: "paraui-selector-main-list-box",
794
+ value: value,
795
+ rowKey: rowKey,
796
+ nodeMode: nodeMode,
797
+ selectMode: selectMode,
798
+ loadMore: loadMore,
799
+ isAllCheck: isAllCheck,
800
+ disabled: disabled,
801
+ detail: detail,
802
+ detailRender: detailRender,
803
+ isLazy: isLazy,
804
+ list: list,
805
+ loading: loading,
806
+ groupType: groupRange === 'list' || groupRange === 'searchList' ? groupType : undefined,
807
+ breadcrumbs: breadcrumbs,
808
+ breadcrumbsSeparator: breadcrumbsSeparator,
809
+ breadcrumbsList: breadcrumbsList,
810
+ fieldConfig: fieldConfig,
811
+ onClickBreadcrumbs: onClickBreadcrumbs,
812
+ onLevel: onLevel,
813
+ onSelect: onSelect,
814
+ onLoad: onLoad,
815
+ onAllCheck: onAllCheck
816
+ }, "list");
817
+ };
818
+ /** 渲染搜索列表 */
819
+
820
+
821
+ var handSearchList = function handSearchList() {
822
+ if (!showSearch) return;
823
+ return jsx(SelectorMainContent, {
824
+ className: 'paraui-selector-main-search-content',
825
+ value: value,
826
+ rowKey: rowKey,
827
+ nodeMode: nodeMode,
828
+ selectMode: selectMode,
829
+ loadMore: false,
830
+ isAllCheck: false,
831
+ disabled: disabled,
832
+ detail: detail,
833
+ detailRender: detailRender,
834
+ isLazy: false,
835
+ list: searchList,
836
+ groupType: groupRange === 'search' || groupRange === 'searchList' ? groupType : undefined,
837
+ fieldConfig: fieldConfig,
838
+ loading: searchLoading,
839
+ onSelect: onSelect
840
+ }, "search");
841
+ };
842
+ /** 处理loading */
843
+
844
+
845
+ var handLoading = function handLoading() {
846
+ if (searchLoading || loading) {
847
+ return jsx(Loading, {});
848
+ }
849
+ }; // 处理class
850
+
851
+
852
+ var handClass = function handClass() {
853
+ var str = 'paraui-selector-main';
854
+ if (className) str += ' ' + className;
855
+ if (selectMode === 'check') str += ' paraui-selector-main-select';
856
+ if (showSearch) str += ' paraui-selector-main-show-search';
857
+ if (search) str += ' paraui-selector-main-search';
858
+ if (disabled === true) str += ' paraui-selector-main-disabled';
859
+ return str;
860
+ };
861
+
862
+ return jsxs("div", Object.assign({
863
+ className: handClass(),
864
+ style: style
865
+ }, {
866
+ children: [handSearchDom(), jsxs("div", Object.assign({
867
+ className: "paraui-selector-main-box"
868
+ }, {
869
+ children: [handListDom(), handSearchList(), handLoading()]
870
+ }))]
871
+ }));
872
+ };
873
+
874
+ var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-selector-data.paraui-selector-data-node > .paraui-selector-data-node-box {\n padding: 24px 0 16px 0;\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n.paraui-selector-data.paraui-selector-data-node > .paraui-selector-data-node-box > .title {\n font-size: 14px;\n color: rgb(46, 55, 67);\n padding: 0 16px;\n margin-bottom: 16px;\n}\n.paraui-selector-data.paraui-selector-data-node > .paraui-selector-data-node-box > .title > .title-content {\n margin-left: 8px;\n}\n.paraui-selector-data.paraui-selector-data-node > .paraui-selector-data-node-box > .content {\n overflow-y: auto;\n}\n.paraui-selector-data.paraui-selector-data-tag > .paraui-selector-data-tag-box {\n padding-top: 12px;\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.paraui-selector-data.paraui-selector-data-tag > .paraui-selector-data-tag-box > .title {\n font-size: 14px;\n color: rgb(46, 55, 67);\n padding: 0 16px;\n}\n.paraui-selector-data.paraui-selector-data-tag > .paraui-selector-data-tag-box > .content {\n padding: 0 16px 12px 16px;\n overflow: auto;\n}\n.paraui-selector-data.paraui-selector-data-tag > .paraui-selector-data-tag-box > .content > .content-tag {\n display: inline-flex;\n height: 24px;\n align-items: center;\n padding: 0 8px;\n border-radius: 2px;\n background-color: rgba(171, 176, 185, 0.2);\n margin-right: 8px;\n margin-top: 6px;\n}\n.paraui-selector-data.paraui-selector-data-tag > .paraui-selector-data-tag-box > .content > .content-tag > span {\n font-size: 12px;\n color: rgb(46, 55, 67);\n}\n.paraui-selector-data.paraui-selector-data-tag > .paraui-selector-data-tag-box > .content > .content-tag > svg {\n font-size: 16px;\n margin-left: 4px;\n color: rgba(46, 55, 67, 0.7);\n cursor: pointer;\n}";
875
+ styleInject(css_248z$1);
876
+
877
+ var SelectorData = function SelectorData(props) {
878
+ var className = props.className,
879
+ _props$layout = props.layout,
880
+ layout = _props$layout === void 0 ? 'node' : _props$layout,
881
+ style = props.style,
882
+ list = props.list,
883
+ groupType = props.groupType,
884
+ nodeMode = props.nodeMode,
885
+ backDataFieldConfig = props.backDataFieldConfig,
886
+ detail = props.detail,
887
+ detailRender = props.detailRender,
888
+ disabled = props.disabled,
889
+ handSelectorNodeInfo = props.handSelectorNodeInfo,
890
+ selectDataTitleRender = props.selectDataTitleRender,
891
+ _onClose = props.onClose;
892
+ var intl = useFormatMessage('Selector', localeJson);
893
+
894
+ var _useState = useState({}),
895
+ _useState2 = _slicedToArray(_useState, 2),
896
+ listCom = _useState2[0],
897
+ setListCom = _useState2[1];
898
+
899
+ var constData = useRef({
900
+ listTypeJson: {},
901
+ backDataFieldConfig: {}
902
+ });
903
+ constData.current.listTypeJson = ArrayToObject('value', groupType);
904
+ constData.current.backDataFieldConfig = backDataFieldConfig || {};
905
+ useEffect(function () {
906
+ if (list && groupType && groupType.length > 0) {
907
+ var json = {};
908
+
909
+ for (var i = 0, l = list.length; i < l; i++) {
910
+ var item = list[i];
911
+ var type = item[constData.current.backDataFieldConfig.type || ''];
912
+ if (!json[type]) json[type] = [];
913
+ json[type].push(item);
914
+ }
915
+
916
+ setListCom(json);
917
+ }
918
+ }, [list]);
919
+ /** 处理禁用 */
920
+
921
+ var handDisabled = function handDisabled(itemConfig) {
922
+ if (disabled) {
923
+ if (disabled === true) return true;
924
+
925
+ if (disabled instanceof Array) {
926
+ var keyStr = (backDataFieldConfig === null || backDataFieldConfig === void 0 ? void 0 : backDataFieldConfig.key) || '';
927
+ var val = itemConfig[keyStr];
928
+
929
+ if (disabled.indexOf(val) !== -1) {
930
+ return true;
931
+ }
932
+ }
933
+ }
934
+
935
+ return false;
936
+ };
937
+ /** 处理每个节点的配置 */
938
+
939
+
940
+ var handNodeConfig = function handNodeConfig(itemConfig, index) {
941
+ var item = itemConfig;
942
+ if (handSelectorNodeInfo) item = handSelectorNodeInfo(itemConfig);
943
+ var disabledItem = handDisabled(itemConfig);
944
+ var json = {
945
+ useCase: 'edit',
946
+ close: !disabledItem,
947
+ detail: detail,
948
+ data: item,
949
+ nodeMode: nodeMode,
950
+ onClose: function onClose() {
951
+ return _onClose && _onClose(item, index);
952
+ },
953
+ disabled: handDisabled(itemConfig)
954
+ };
955
+ /** 节点类型 */
956
+
957
+ if (item.leaf !== undefined) json.nodeMode = item.leaf ? 'leaf' : 'branch';
958
+ /** 渲染字段 */
959
+
960
+ var arr = ['img', 'mainTitle', 'subTitle', 'tag'];
961
+
962
+ for (var i = 0, l = arr.length; i < l; i++) {
963
+ var key = arr[i] || '';
964
+ var backName = backDataFieldConfig && backDataFieldConfig[key] || '';
965
+ json[key] = item[backName];
966
+ }
967
+ /** 详情render */
968
+
969
+
970
+ if (detailRender) {
971
+ json.detailRender = function () {
972
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
973
+ var Dom;
974
+ return regenerator.wrap(function _callee$(_context) {
975
+ while (1) {
976
+ switch (_context.prev = _context.next) {
977
+ case 0:
978
+ _context.next = 2;
979
+ return detailRender(item, false);
980
+
981
+ case 2:
982
+ Dom = _context.sent;
983
+ return _context.abrupt("return", Dom);
984
+
985
+ case 4:
986
+ case "end":
987
+ return _context.stop();
988
+ }
989
+ }
990
+ }, _callee);
991
+ }));
992
+ };
993
+ }
994
+ /** 是否具有删除 */
995
+
996
+
997
+ if (item.close !== undefined) json.close = item.close;
998
+ return json;
999
+ };
1000
+ /** 处理节点 */
1001
+
1002
+
1003
+ var handNode = function handNode() {
1004
+ return list === null || list === void 0 ? void 0 : list.map(function (item, index) {
1005
+ return jsx(SelectorNode, Object.assign({}, handNodeConfig(item, index)), index);
1006
+ });
1007
+ };
1008
+ /** 处理标题 */
1009
+
1010
+
1011
+ var handTitle = function handTitle() {
1012
+ var handTitleTag = function handTitleTag() {
1013
+ if (selectDataTitleRender) return selectDataTitleRender(list);
1014
+
1015
+ if (groupType) {
1016
+ return jsx(Fragment, {
1017
+ children: groupType.map(function (item, index) {
1018
+ var num = 0;
1019
+ var val = item.value;
1020
+ if (listCom[val]) num = listCom[val].length;
1021
+ if (num === 0) return;
1022
+ return jsxs("span", Object.assign({
1023
+ className: "title-content"
1024
+ }, {
1025
+ children: [num, "\u4E2A", item.label || item.value]
1026
+ }), index);
1027
+ })
1028
+ });
1029
+ }
1030
+ };
1031
+
1032
+ return jsxs("div", Object.assign({
1033
+ className: "title"
1034
+ }, {
1035
+ children: [jsxs("span", Object.assign({
1036
+ className: "title-tip"
1037
+ }, {
1038
+ children: [intl({
1039
+ id: 'selected'
1040
+ }), ":"]
1041
+ })), handTitleTag()]
1042
+ }));
1043
+ }; // 处理节点内容
1044
+
1045
+
1046
+ var handContentNode = function handContentNode() {
1047
+ return jsxs("div", Object.assign({
1048
+ className: "paraui-selector-data-node-box"
1049
+ }, {
1050
+ children: [handTitle(), jsx("div", Object.assign({
1051
+ className: "content"
1052
+ }, {
1053
+ children: handNode()
1054
+ }))]
1055
+ }));
1056
+ }; // 处理tag内容
1057
+
1058
+
1059
+ var handContentTag = function handContentTag() {
1060
+ return jsxs("div", Object.assign({
1061
+ className: "paraui-selector-data-tag-box"
1062
+ }, {
1063
+ children: [handTitle(), jsx("div", Object.assign({
1064
+ className: "content"
1065
+ }, {
1066
+ children: list === null || list === void 0 ? void 0 : list.map(function (item, index) {
1067
+ var disabledItem = handDisabled(item);
1068
+ return jsxs("span", Object.assign({
1069
+ className: "content-tag"
1070
+ }, {
1071
+ children: [jsx("span", {
1072
+ children: item[(backDataFieldConfig === null || backDataFieldConfig === void 0 ? void 0 : backDataFieldConfig.mainTitle) || ''] || item[(backDataFieldConfig === null || backDataFieldConfig === void 0 ? void 0 : backDataFieldConfig.key) || '']
1073
+ }), !disabledItem && jsx(CloseIcon, {
1074
+ onClick: function onClick() {
1075
+ return _onClose && _onClose(item, index);
1076
+ }
1077
+ })]
1078
+ }), index);
1079
+ })
1080
+ }))]
1081
+ }));
1082
+ };
1083
+
1084
+ var handClass = function handClass() {
1085
+ var str = 'paraui-selector-data';
1086
+ if (layout) str += ' paraui-selector-data-' + layout;
1087
+ if (disabled === true) str += ' paraui-selector-data-disabled';
1088
+ if (className) str += ' ' + className;
1089
+ return str;
1090
+ };
1091
+
1092
+ return jsx("div", Object.assign({
1093
+ className: handClass(),
1094
+ style: style
1095
+ }, {
1096
+ children: layout === 'node' ? handContentNode() : handContentTag()
1097
+ }));
1098
+ };
1099
+
1100
+ /**
1101
+ * 发送请求
1102
+ * @param obj {ReqFuncProps} 请求信息
1103
+ */
1104
+
1105
+ var reqFunc = function reqFunc(obj) {
1106
+ var method = obj.method,
1107
+ data = obj.data,
1108
+ otherProps = __rest(obj, ["method", "data"]);
1109
+
1110
+ if (method === 'Get') {
1111
+ return Get(Object.assign({
1112
+ params: data
1113
+ }, otherProps));
1114
+ }
1115
+
1116
+ if (method === 'Post') {
1117
+ return Post(Object.assign({
1118
+ data: data
1119
+ }, otherProps));
1120
+ }
1121
+ };
1122
+
1123
+ var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-selector {\n border: 1px solid rgba(171, 176, 185, 0.4);\n border-radius: 4px;\n display: flex;\n height: 100%;\n width: 100%;\n}\n.paraui-selector.paraui-selector-lr > .paraui-selector-main {\n width: 50%;\n}\n.paraui-selector.paraui-selector-lr > .paraui-selector-data {\n width: 50%;\n border-left: 1px solid rgba(171, 176, 185, 0.4);\n}\n.paraui-selector.paraui-selector-tb {\n flex-direction: column;\n}\n.paraui-selector.paraui-selector-tb > .paraui-selector-data {\n border-bottom: 1px solid rgba(171, 176, 185, 0.4);\n max-height: 106px;\n}\n.paraui-selector.paraui-selector-tb > .paraui-selector-main {\n overflow-y: auto;\n height: auto;\n flex: 1;\n}";
1124
+ styleInject(css_248z);
1125
+
1126
+ var handFieldConfig = function handFieldConfig(fieldConfig, rowKey) {
1127
+ var json = Object.assign({
1128
+ mainTitle: 'label',
1129
+ children: 'children',
1130
+ parentId: 'parentId',
1131
+ key: rowKey,
1132
+ type: 'type'
1133
+ }, fieldConfig);
1134
+ return json;
1135
+ };
1136
+
1137
+ var Selector = function Selector(props) {
1138
+ var _useGlobalProps = useGlobalProps(props, 'Selector'),
1139
+ className = _useGlobalProps.className,
1140
+ style = _useGlobalProps.style,
1141
+ _useGlobalProps$rowKe = _useGlobalProps.rowKey,
1142
+ rowKey = _useGlobalProps$rowKe === void 0 ? 'key' : _useGlobalProps$rowKe,
1143
+ _useGlobalProps$layou = _useGlobalProps.layout,
1144
+ layout = _useGlobalProps$layou === void 0 ? 'lr' : _useGlobalProps$layou,
1145
+ _useGlobalProps$nodeM = _useGlobalProps.nodeMode,
1146
+ nodeMode = _useGlobalProps$nodeM === void 0 ? 'branch' : _useGlobalProps$nodeM,
1147
+ selectMode = _useGlobalProps.selectMode,
1148
+ refresh = _useGlobalProps.refresh,
1149
+ ctx = _useGlobalProps.ctx,
1150
+ url = _useGlobalProps.url,
1151
+ _useGlobalProps$metho = _useGlobalProps.method,
1152
+ method = _useGlobalProps$metho === void 0 ? 'Get' : _useGlobalProps$metho,
1153
+ value = _useGlobalProps.value,
1154
+ defaultValue = _useGlobalProps.defaultValue,
1155
+ data = _useGlobalProps.data,
1156
+ _useGlobalProps$pagin = _useGlobalProps.pagination,
1157
+ pagination = _useGlobalProps$pagin === void 0 ? false : _useGlobalProps$pagin,
1158
+ _useGlobalProps$size = _useGlobalProps.size,
1159
+ size = _useGlobalProps$size === void 0 ? 10 : _useGlobalProps$size,
1160
+ _useGlobalProps$isLaz = _useGlobalProps.isLazy,
1161
+ isLazy = _useGlobalProps$isLaz === void 0 ? false : _useGlobalProps$isLaz,
1162
+ _useGlobalProps$isAll = _useGlobalProps.isAllCheck,
1163
+ isAllCheck = _useGlobalProps$isAll === void 0 ? true : _useGlobalProps$isAll,
1164
+ disabled = _useGlobalProps.disabled,
1165
+ detail = _useGlobalProps.detail,
1166
+ detailRender = _useGlobalProps.detailRender,
1167
+ backDataFieldConfig = _useGlobalProps.backDataFieldConfig,
1168
+ search = _useGlobalProps.search,
1169
+ searchPlaceholder = _useGlobalProps.searchPlaceholder,
1170
+ _useGlobalProps$searc = _useGlobalProps.searchTrigger,
1171
+ searchTrigger = _useGlobalProps$searc === void 0 ? 'onChange' : _useGlobalProps$searc,
1172
+ _useGlobalProps$bread = _useGlobalProps.breadcrumbs,
1173
+ breadcrumbs = _useGlobalProps$bread === void 0 ? true : _useGlobalProps$bread,
1174
+ breadcrumbsSeparator = _useGlobalProps.breadcrumbsSeparator,
1175
+ breadcrumbsHead = _useGlobalProps.breadcrumbsHead,
1176
+ _useGlobalProps$showb = _useGlobalProps.showbreadcrumbsHead,
1177
+ showbreadcrumbsHead = _useGlobalProps$showb === void 0 ? true : _useGlobalProps$showb,
1178
+ groupType = _useGlobalProps.groupType,
1179
+ _useGlobalProps$group = _useGlobalProps.groupRange,
1180
+ groupRange = _useGlobalProps$group === void 0 ? 'search' : _useGlobalProps$group,
1181
+ emptyProps = _useGlobalProps.emptyProps,
1182
+ onChange = _useGlobalProps.onChange,
1183
+ onSelect = _useGlobalProps.onSelect,
1184
+ onSearch = _useGlobalProps.onSearch;
1185
+
1186
+ var intl = useFormatMessage('Selector', localeJson);
1187
+ var fieldConfigHand = handFieldConfig(props.fieldConfig, rowKey); // 字段配置,对应数据字段
1188
+
1189
+ var selectorFieldConfigHand = Object.assign(Object.assign({}, fieldConfigHand), backDataFieldConfig); // 选中值字段配置,对应数据字段
1190
+
1191
+ var _useState = useState([]),
1192
+ _useState2 = _slicedToArray(_useState, 2),
1193
+ currentData = _useState2[0],
1194
+ setCurrentData = _useState2[1]; // 当前展示的数据
1195
+
1196
+
1197
+ var _useState3 = useState(false),
1198
+ _useState4 = _slicedToArray(_useState3, 2),
1199
+ loadMore = _useState4[0],
1200
+ setLoadMore = _useState4[1]; // 加载更多
1201
+
1202
+
1203
+ var _useState5 = useState([]),
1204
+ _useState6 = _slicedToArray(_useState5, 2),
1205
+ valueCom = _useState6[0],
1206
+ setValueCom = _useState6[1]; // 绑定的值
1207
+
1208
+
1209
+ var _useState7 = useState({}),
1210
+ _useState8 = _slicedToArray(_useState7, 2),
1211
+ valueJsonCom = _useState8[0],
1212
+ setValueJsonCom = _useState8[1]; // 绑定的值,json
1213
+
1214
+
1215
+ var _useState9 = useState([]),
1216
+ _useState10 = _slicedToArray(_useState9, 2),
1217
+ breadcrumbsList = _useState10[0],
1218
+ setBreadcrumbsList = _useState10[1]; // 面包屑
1219
+
1220
+
1221
+ var _useState11 = useState(false),
1222
+ _useState12 = _slicedToArray(_useState11, 2),
1223
+ searchLoading = _useState12[0],
1224
+ setSearchLoading = _useState12[1]; // 搜索loading
1225
+
1226
+
1227
+ var _useState13 = useState([]),
1228
+ _useState14 = _slicedToArray(_useState13, 2),
1229
+ searchList = _useState14[0],
1230
+ setSearchList = _useState14[1]; // 搜索数据
1231
+
1232
+
1233
+ var _useState15 = useState(true),
1234
+ _useState16 = _slicedToArray(_useState15, 2),
1235
+ loadingCom = _useState16[0],
1236
+ setLoadingCom = _useState16[1];
1237
+
1238
+ var _useState17 = useState(),
1239
+ _useState18 = _slicedToArray(_useState17, 2),
1240
+ refreshCom = _useState18[0],
1241
+ setRefreshCom = _useState18[1];
1242
+
1243
+ var constData = useRef({
1244
+ /** 对象集合 所有的 */
1245
+ jsonData: {},
1246
+
1247
+ /** 浅拷贝对象 所有的 */
1248
+ jsonDataCopy: {},
1249
+
1250
+ /** 第一层数据 */
1251
+ oneDataList: [],
1252
+
1253
+ /** 当前页数据源 本地数据为当前页所有的数据,请求数据为当前展示的数据 */
1254
+ currentSourceData: [],
1255
+
1256
+ /** 当前选中值的mapping */
1257
+ selectValueJson: {},
1258
+
1259
+ /** 面包屑数据 */
1260
+ breadcrumbsList: [],
1261
+
1262
+ /** 接口id */
1263
+ reqId: Math.random().toString(),
1264
+
1265
+ /** 请求数据 */
1266
+ reqParams: {
1267
+ size: 10,
1268
+ pagination: false,
1269
+ isLazy: false
1270
+ },
1271
+
1272
+ /** 不是懒加载, 是否请求过 */
1273
+ noLazyReq: false,
1274
+
1275
+ /** 更改数据定时器 */
1276
+ reqTimer: null,
1277
+
1278
+ /** 页数 */
1279
+ page: 1
1280
+ }); // 常量
1281
+
1282
+ constData.current.reqParams.size = size;
1283
+ constData.current.reqParams.pagination = pagination;
1284
+ constData.current.reqParams.isLazy = isLazy; // 本地数据 有接口的全量数据 -> 走本地数据逻辑
1285
+
1286
+ var isReqLocalData = props.data || !constData.current.reqParams.isLazy && constData.current.noLazyReq;
1287
+ useEffect(function () {
1288
+ if (defaultValue !== undefined) handValue(defaultValue);
1289
+ return function () {
1290
+ clearTimeout(constData.current.reqTimer);
1291
+ };
1292
+ }, []);
1293
+ useEffect(function () {
1294
+ if (value !== undefined) handValue(value);
1295
+ }, [value]); // 处理源数据
1296
+
1297
+ useEffect(function () {
1298
+ if (data) {
1299
+ var treeData = convertTree(data, false);
1300
+ constData.current.oneDataList = treeData;
1301
+ constData.current.currentSourceData = treeData;
1302
+ setBreadcrumbsList([]);
1303
+ handInitCurrent();
1304
+ }
1305
+ }, [data]);
1306
+ useEffect(function () {
1307
+ if (url) {
1308
+ setBreadcrumbsList([]);
1309
+ handInitCurrent();
1310
+ }
1311
+ }, [url]); // 请求数据
1312
+
1313
+ useEffect(function () {
1314
+ clearTimeout(constData.current.reqTimer);
1315
+ if (props.url) Cancel(constData.current.reqId);
1316
+ constData.current.reqTimer = setTimeout(function () {
1317
+ // 本地数据 不是懒加载的全量接口数据
1318
+ if (isReqLocalData) {
1319
+ var currentSourceData = constData.current.currentSourceData;
1320
+
1321
+ if (constData.current.reqParams.pagination) {
1322
+ // 分页
1323
+ var sliceData = currentSourceData.slice(0, constData.current.page * constData.current.reqParams.size);
1324
+ setCurrentData(sliceData); // 没有加载更多
1325
+
1326
+ if (constData.current.page * constData.current.reqParams.size >= currentSourceData.length) {
1327
+ setLoadMore(false);
1328
+ } else {
1329
+ setLoadMore(true);
1330
+ }
1331
+ } else {
1332
+ // 不分页
1333
+ setCurrentData(currentSourceData);
1334
+ }
1335
+
1336
+ setLoadingCom(false);
1337
+ } // 远程数据
1338
+
1339
+
1340
+ if (props.url) {
1341
+ var obj = {
1342
+ method: method,
1343
+ url: props.url,
1344
+ ctx: ctx,
1345
+ uuid: constData.current.reqId,
1346
+ data: Object.assign({
1347
+ parentId: handParentId()
1348
+ }, props.params)
1349
+ }; // 懒加载
1350
+
1351
+ if (constData.current.reqParams.isLazy) {
1352
+ // 分页
1353
+ if (constData.current.reqParams.pagination) {
1354
+ obj.data.size = constData.current.reqParams.size;
1355
+ obj.data.page = constData.current.page;
1356
+ }
1357
+
1358
+ handReq(props.paramsCallback ? props.paramsCallback(obj) : obj);
1359
+ } else {
1360
+ // 不是懒加载 全量数据 只请求一次
1361
+ if (!constData.current.noLazyReq) handReq(props.paramsCallback ? props.paramsCallback(obj) : obj);
1362
+ }
1363
+ }
1364
+ }, 50);
1365
+ }, [refreshCom]);
1366
+ useEffect(function () {
1367
+ if (refresh) refreshFunc();
1368
+ }, [refresh]);
1369
+ /** 刷新 */
1370
+
1371
+ var refreshFunc = function refreshFunc() {
1372
+ if (!isReqLocalData) {
1373
+ constData.current.currentSourceData = [];
1374
+ }
1375
+
1376
+ handInitCurrent();
1377
+ };
1378
+ /**
1379
+ * 处理节点数据
1380
+ * @param item 节点数据
1381
+ * @param bol 是否是搜索
1382
+ * */
1383
+
1384
+
1385
+ var handNodeData = function handNodeData(item, bol) {
1386
+ var itemData = {
1387
+ key: item[rowKey],
1388
+ parentId: item[fieldConfigHand.parentId],
1389
+ type: item[fieldConfigHand.type],
1390
+ img: item[fieldConfigHand.img],
1391
+ mainTitle: item[fieldConfigHand.mainTitle],
1392
+ subTitle: item[fieldConfigHand.subTitle],
1393
+ tag: item[fieldConfigHand.tag],
1394
+ children: [],
1395
+ disabled: false,
1396
+ choice: selectMode !== undefined,
1397
+ detail: detail,
1398
+ leaf: nodeMode === 'leaf',
1399
+ //child: false,
1400
+ data: item
1401
+ }; // 如果外部存在节点回调
1402
+
1403
+ if (props.handNodeInfo) itemData = props.handNodeInfo(itemData);
1404
+ return itemData;
1405
+ };
1406
+ /**
1407
+ * 转换树结构 记录原始数据,跟处理过的数据
1408
+ * @param arr 数据源
1409
+ * @param bol true不生成树
1410
+ * */
1411
+
1412
+
1413
+ var convertTree = function convertTree(arr, bol) {
1414
+ var handArr = [];
1415
+ var json = {}; // 生成mappingd对象
1416
+
1417
+ var recurrence = function recurrence(list) {
1418
+ for (var i = 0, l = list.length; i < l; i++) {
1419
+ var item = list[i];
1420
+ var keyStr = item[rowKey];
1421
+ var itemData = handNodeData(item);
1422
+ json[keyStr] = itemData;
1423
+ var childrenName = fieldConfigHand.children;
1424
+ constData.current.jsonDataCopy[keyStr] = item; // 原始数据
1425
+
1426
+ constData.current.jsonData[keyStr] = itemData; // 处理过的数据
1427
+
1428
+ if (item[childrenName]) {
1429
+ recurrence(item[childrenName]);
1430
+ }
1431
+ }
1432
+ };
1433
+
1434
+ recurrence(arr); // 生成tree数据
1435
+
1436
+ var arrKey = Object.keys(json);
1437
+
1438
+ for (var i = 0, l = arrKey.length; i < l; i++) {
1439
+ var keyStr = arrKey[i];
1440
+ var item = json[keyStr];
1441
+ var parentId = item.parentId || '';
1442
+
1443
+ if (bol) {
1444
+ handArr.push(item);
1445
+ continue;
1446
+ }
1447
+
1448
+ if (parentId && json[parentId]) {
1449
+ if (!json[parentId].children) json[parentId].children = [];
1450
+ json[parentId].children.push(item);
1451
+ } else {
1452
+ handArr.push(item);
1453
+ }
1454
+ }
1455
+
1456
+ return handArr;
1457
+ };
1458
+ /** 处理parentId */
1459
+
1460
+
1461
+ var handParentId = function handParentId() {
1462
+ var parentId = undefined;
1463
+ if (props.breadcrumbsHead) parentId = props.breadcrumbsHead.value;
1464
+
1465
+ if (constData.current.breadcrumbsList.length > 1) {
1466
+ // 包含了根,所以要多加1
1467
+ var item = constData.current.breadcrumbsList[constData.current.breadcrumbsList.length - 1];
1468
+ parentId = item.value;
1469
+ }
1470
+
1471
+ return parentId;
1472
+ };
1473
+ /** 请求 */
1474
+
1475
+
1476
+ var handReq = function handReq(obj) {
1477
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
1478
+ var _yield$reqFunc, data, err;
1479
+
1480
+ return regenerator.wrap(function _callee$(_context) {
1481
+ while (1) {
1482
+ switch (_context.prev = _context.next) {
1483
+ case 0:
1484
+ setLoadingCom(true);
1485
+ _context.next = 3;
1486
+ return reqFunc(obj);
1487
+
1488
+ case 3:
1489
+ _yield$reqFunc = _context.sent;
1490
+ data = _yield$reqFunc.data;
1491
+ err = _yield$reqFunc.err;
1492
+
1493
+ if (!err) {
1494
+ _context.next = 10;
1495
+ break;
1496
+ }
1497
+
1498
+ setLoadingCom(false); // cancel的接口不清除上次展示的数据
1499
+
1500
+ if (!err.__CANCEL__) {
1501
+ if (constData.current.reqParams.isLazy) {
1502
+ // 懒加载
1503
+ if (constData.current.reqParams.pagination) {
1504
+ // 分页 第一页不处理
1505
+ if (constData.current.page !== 1) constData.current.page = constData.current.page - 1;
1506
+ }
1507
+ }
1508
+ }
1509
+
1510
+ return _context.abrupt("return");
1511
+
1512
+ case 10:
1513
+ if (!props.requestCallback) {
1514
+ _context.next = 13;
1515
+ break;
1516
+ }
1517
+
1518
+ props.requestCallback(data, function (handData) {
1519
+ setLoadingCom(false);
1520
+ handReqData(data);
1521
+ });
1522
+ return _context.abrupt("return");
1523
+
1524
+ case 13:
1525
+ setLoadingCom(false);
1526
+ handReqData(data);
1527
+
1528
+ case 15:
1529
+ case "end":
1530
+ return _context.stop();
1531
+ }
1532
+ }
1533
+ }, _callee);
1534
+ }));
1535
+ };
1536
+ /** 接口回来处理数据 */
1537
+
1538
+
1539
+ var handReqData = function handReqData(resultData) {
1540
+ if (constData.current.reqParams.isLazy) {
1541
+ // 懒加载
1542
+ if (constData.current.reqParams.pagination) {
1543
+ // 分页
1544
+ var result = resultData.data || {};
1545
+ var arr = result.list || [];
1546
+ var total = result.total;
1547
+ var arrHand = convertTree(arr, true);
1548
+ var currentD = [].concat(_toConsumableArray(constData.current.currentSourceData), _toConsumableArray(arrHand));
1549
+ constData.current.currentSourceData = currentD;
1550
+ setCurrentData(currentD);
1551
+
1552
+ if (constData.current.page * constData.current.reqParams.size >= total) {
1553
+ setLoadMore(false);
1554
+ } else {
1555
+ setLoadMore(true);
1556
+ }
1557
+ } else {
1558
+ // 不分页 必须返回平铺的数组
1559
+ var _arr = resultData.data || [];
1560
+
1561
+ var treeData = convertTree(_arr, true);
1562
+ constData.current.currentSourceData = treeData;
1563
+ setCurrentData(treeData);
1564
+ }
1565
+ } else {
1566
+ // 不是懒加载 只请求一次
1567
+ constData.current.noLazyReq = true;
1568
+
1569
+ var _arr2 = resultData.data || [];
1570
+
1571
+ var _treeData = convertTree(_arr2, false);
1572
+
1573
+ constData.current.oneDataList = _treeData; // 第一层数据
1574
+
1575
+ constData.current.currentSourceData = _treeData;
1576
+ handInitCurrent();
1577
+ }
1578
+ };
1579
+ /** 当前页初始更新 */
1580
+
1581
+
1582
+ var handInitCurrent = function handInitCurrent() {
1583
+ constData.current.page = 1;
1584
+ setRefreshCom(Math.random());
1585
+ };
1586
+ /** 处理value */
1587
+
1588
+
1589
+ var handValue = function handValue(val) {
1590
+ var handVal = !val ? [] : [val];
1591
+
1592
+ if (val instanceof Array) {
1593
+ handVal = _toConsumableArray(val);
1594
+ }
1595
+
1596
+ var json = ArrayToObject(selectorFieldConfigHand.key, handVal);
1597
+ constData.current.selectValueJson = json;
1598
+ setValueJsonCom(json);
1599
+ setValueCom(handVal);
1600
+ };
1601
+ /** 点击下级,添加面包屑 */
1602
+
1603
+
1604
+ var onLevelAddBreadcrumbs = function onLevelAddBreadcrumbs(item) {
1605
+ breadcrumbsList.push({
1606
+ label: item.mainTitle,
1607
+ value: item.key || ''
1608
+ });
1609
+ setBreadcrumbsList(_toConsumableArray(breadcrumbsList));
1610
+ };
1611
+ /** 点击下级 */
1612
+
1613
+
1614
+ var onLevelCom = function onLevelCom(item) {
1615
+ onLevelAddBreadcrumbs(item);
1616
+
1617
+ if (isReqLocalData) {
1618
+ // 本地数据
1619
+ constData.current.currentSourceData = item.children || [];
1620
+ handInitCurrent();
1621
+ } else {
1622
+ // 请求数据
1623
+ if (constData.current.reqParams.isLazy) {
1624
+ // 懒加载
1625
+ if (constData.current.reqParams.pagination) {
1626
+ // 分页
1627
+ constData.current.currentSourceData = [];
1628
+ }
1629
+
1630
+ handInitCurrent();
1631
+ }
1632
+ }
1633
+ };
1634
+ /** 处理抛出去的数据 */
1635
+
1636
+
1637
+ var handEmitValue = function handEmitValue(item) {
1638
+ var arr = ['key', 'img', 'mainTitle', 'subTitle', 'tag'];
1639
+
1640
+ if (props.groupType && props.groupType.length > 0) {
1641
+ arr.push('type');
1642
+ }
1643
+
1644
+ var json = {};
1645
+
1646
+ for (var i = 0, l = arr.length; i < l; i++) {
1647
+ var arrItem = arr[i];
1648
+ var name = selectorFieldConfigHand[arrItem];
1649
+ if (name) json[name] = item[arrItem];
1650
+ }
1651
+
1652
+ return json;
1653
+ };
1654
+ /**
1655
+ * 向外触发onchane事件
1656
+ * @param val 向外抛的值
1657
+ * @param valCom 设置组件的值
1658
+ * @param node 处理过的节点数据
1659
+ * @param rowData 原始数据节点
1660
+ * */
1661
+
1662
+
1663
+ var onChangeEmit = function onChangeEmit(val, valCom, node, rowData) {
1664
+ onChange && onChange(val, node, rowData);
1665
+
1666
+ if (value == undefined) {
1667
+ handValue(!val ? [] : val);
1668
+ }
1669
+ };
1670
+ /** 选择数据 */
1671
+
1672
+
1673
+ var onSelectCom = function onSelectCom(item) {
1674
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
1675
+ var keyStr, selectVal, bol, json, arr, node, rowData, i, l, valueComItem, valueComItemId, _json;
1676
+
1677
+ return regenerator.wrap(function _callee2$(_context2) {
1678
+ while (1) {
1679
+ switch (_context2.prev = _context2.next) {
1680
+ case 0:
1681
+ keyStr = item.key || ''; // key
1682
+ // 单选且选中,点击不触发
1683
+
1684
+ if (!(selectMode === 'radio' && valueJsonCom[keyStr])) {
1685
+ _context2.next = 3;
1686
+ break;
1687
+ }
1688
+
1689
+ return _context2.abrupt("return");
1690
+
1691
+ case 3:
1692
+ selectVal = constData.current.selectValueJson[keyStr]; // 存在选中值当中 -> 选中变不选中
1693
+
1694
+ if (!onSelect) {
1695
+ _context2.next = 10;
1696
+ break;
1697
+ }
1698
+
1699
+ _context2.next = 7;
1700
+ return onSelect(item, selectMode === 'radio' ? true : !selectVal, false);
1701
+
1702
+ case 7:
1703
+ bol = _context2.sent;
1704
+
1705
+ if (!bol) {
1706
+ _context2.next = 10;
1707
+ break;
1708
+ }
1709
+
1710
+ return _context2.abrupt("return");
1711
+
1712
+ case 10:
1713
+ // 单选
1714
+ if (selectMode === 'radio') {
1715
+ json = handEmitValue(item);
1716
+ onChangeEmit(json, [json], constData.current.jsonData[keyStr], constData.current.jsonDataCopy[keyStr]);
1717
+ } // 多选
1718
+
1719
+
1720
+ if (selectMode === 'check') {
1721
+ arr = [];
1722
+ node = {}; // 处理过得数据
1723
+
1724
+ rowData = {}; // 原始数据
1725
+ // 把即将不选中的值,从valueCom里面拿掉
1726
+
1727
+ for (i = 0, l = valueCom.length; i < l; i++) {
1728
+ valueComItem = valueCom[i]; // 选中valueCom都保留
1729
+ // 不选中 保留valueCom里面的key不等于当前的key
1730
+
1731
+ if (!selectVal || item.key !== valueComItem[selectorFieldConfigHand.key]) {
1732
+ valueComItemId = valueComItem[selectorFieldConfigHand.key];
1733
+ node[valueComItemId] = constData.current.jsonData[valueComItemId];
1734
+ rowData[valueComItemId] = constData.current.jsonDataCopy[valueComItemId];
1735
+ arr.push(valueComItem);
1736
+ }
1737
+ } // 不选中 -> 选中
1738
+
1739
+
1740
+ if (!selectVal) {
1741
+ _json = handEmitValue(item);
1742
+ node[keyStr] = constData.current.jsonData[keyStr];
1743
+ rowData[keyStr] = constData.current.jsonDataCopy[keyStr];
1744
+ arr.push(_json);
1745
+ }
1746
+
1747
+ onChangeEmit(arr, arr, node, rowData);
1748
+ }
1749
+
1750
+ case 12:
1751
+ case "end":
1752
+ return _context2.stop();
1753
+ }
1754
+ }
1755
+ }, _callee2);
1756
+ }));
1757
+ };
1758
+ /** 处理禁用状态 */
1759
+
1760
+
1761
+ var handDisabled = function handDisabled(item) {
1762
+ if (disabled) {
1763
+ if (disabled === true) return true;
1764
+
1765
+ if (disabled instanceof Array) {
1766
+ if (item.key && disabled.indexOf(item.key) !== -1) {
1767
+ return true;
1768
+ }
1769
+ }
1770
+ }
1771
+
1772
+ if (item.disabled) return true;
1773
+ return false;
1774
+ };
1775
+ /**
1776
+ * 点击全选
1777
+ * @param bol true全选
1778
+ * */
1779
+
1780
+
1781
+ var onAllCheckCom = function onAllCheckCom(bol) {
1782
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
1783
+ var arrList, arrVal, arrval1, node, rowData, selectArr, selectEmitData, i, l, item, keyStr, disabledItem, _i, _l, _item, _keyStr, emitArr, flag;
1784
+
1785
+ return regenerator.wrap(function _callee3$(_context3) {
1786
+ while (1) {
1787
+ switch (_context3.prev = _context3.next) {
1788
+ case 0:
1789
+ arrList = _toConsumableArray(currentData); // 当前列的数据
1790
+
1791
+ arrVal = _toConsumableArray(valueCom); // 全选 绑定的值
1792
+
1793
+ arrval1 = []; // 全不选 绑定的值
1794
+
1795
+ node = {}; // 处理过得数据
1796
+
1797
+ rowData = {}; // 原始数据
1798
+
1799
+ selectArr = []; // 全不选 - 当前列选中值
1800
+
1801
+ selectEmitData = []; // 选择事件抛出去的值
1802
+ // 循环当前列数据
1803
+
1804
+ i = 0, l = arrList.length;
1805
+
1806
+ case 8:
1807
+ if (!(i < l)) {
1808
+ _context3.next = 18;
1809
+ break;
1810
+ }
1811
+
1812
+ item = arrList[i];
1813
+ keyStr = item.key || '';
1814
+ disabledItem = handDisabled(item);
1815
+
1816
+ if (!disabledItem) {
1817
+ _context3.next = 14;
1818
+ break;
1819
+ }
1820
+
1821
+ return _context3.abrupt("continue", 15);
1822
+
1823
+ case 14:
1824
+ if (bol) {
1825
+ // 全选
1826
+ if (!constData.current.selectValueJson[keyStr]) {
1827
+ // 不存在选中值中
1828
+ arrVal.push(handEmitValue(item));
1829
+ selectEmitData.push(item);
1830
+ }
1831
+ } else {
1832
+ // 全不选
1833
+ if (constData.current.selectValueJson[keyStr]) {
1834
+ // 存在选中值中,拿掉
1835
+ selectArr.push(keyStr);
1836
+ selectEmitData.push(item);
1837
+ }
1838
+ }
1839
+
1840
+ case 15:
1841
+ i++;
1842
+ _context3.next = 8;
1843
+ break;
1844
+
1845
+ case 18:
1846
+ for (_i = 0, _l = arrVal.length; _i < _l; _i++) {
1847
+ _item = arrVal[_i];
1848
+ _keyStr = _item[selectorFieldConfigHand.key];
1849
+
1850
+ if (bol) {
1851
+ // 全选
1852
+ node[_keyStr] = constData.current.jsonData[_keyStr];
1853
+ rowData[_keyStr] = constData.current.jsonDataCopy[_keyStr];
1854
+ } else {
1855
+ // 全不选
1856
+ if (selectArr.indexOf(_keyStr) === -1) {
1857
+ // 不存在 全不选 - 当前列选中值
1858
+ node[_keyStr] = constData.current.jsonData[_keyStr];
1859
+ rowData[_keyStr] = constData.current.jsonDataCopy[_keyStr];
1860
+ arrval1.push(_item);
1861
+ }
1862
+ }
1863
+ }
1864
+
1865
+ emitArr = bol ? arrVal : arrval1;
1866
+
1867
+ if (!onSelect) {
1868
+ _context3.next = 26;
1869
+ break;
1870
+ }
1871
+
1872
+ _context3.next = 23;
1873
+ return onSelect(selectEmitData, !!bol, false);
1874
+
1875
+ case 23:
1876
+ flag = _context3.sent;
1877
+
1878
+ if (!flag) {
1879
+ _context3.next = 26;
1880
+ break;
1881
+ }
1882
+
1883
+ return _context3.abrupt("return");
1884
+
1885
+ case 26:
1886
+ onChangeEmit(emitArr, emitArr, node, rowData);
1887
+
1888
+ case 27:
1889
+ case "end":
1890
+ return _context3.stop();
1891
+ }
1892
+ }
1893
+ }, _callee3);
1894
+ }));
1895
+ };
1896
+ /** 点击查看更多 */
1897
+
1898
+
1899
+ var onLoadCom = function onLoadCom() {
1900
+ constData.current.page = constData.current.page + 1;
1901
+ setRefreshCom(Math.random());
1902
+ };
1903
+ /** 处理面包屑数组 */
1904
+
1905
+
1906
+ var handBreadcrumbsList = function handBreadcrumbsList() {
1907
+ var arr = _toConsumableArray(breadcrumbsList);
1908
+
1909
+ var oneItem = breadcrumbsHead || {
1910
+ label: intl({
1911
+ id: 'root'
1912
+ }),
1913
+ value: '_paraui_first_floor'
1914
+ };
1915
+ if (showbreadcrumbsHead) arr.unshift(oneItem);
1916
+ constData.current.breadcrumbsList = arr;
1917
+ return arr;
1918
+ };
1919
+ /** 截取面包屑数据 */
1920
+
1921
+
1922
+ var spliceBreadcrumbs = function spliceBreadcrumbs(item) {
1923
+ var arr = [];
1924
+
1925
+ for (var i = 0, l = breadcrumbsList.length; i < l; i++) {
1926
+ var itemB = breadcrumbsList[i];
1927
+ arr.push(itemB);
1928
+
1929
+ if (itemB.value === item.value) {
1930
+ break;
1931
+ }
1932
+ }
1933
+
1934
+ return arr;
1935
+ };
1936
+ /** 点击面包屑 */
1937
+
1938
+
1939
+ var onClickBreadcrumbsCom = function onClickBreadcrumbsCom(item) {
1940
+ var list = constData.current.breadcrumbsList; // 点击最后一层,不触发数据变更
1941
+
1942
+ if (list.length === 0 || item.value === list[list.length - 1].value) {
1943
+ return;
1944
+ }
1945
+
1946
+ var keyStr = item.value || '';
1947
+ var oneValue = breadcrumbsHead ? breadcrumbsHead.value : '_paraui_first_floor'; // 设置面包屑
1948
+
1949
+ if (keyStr === oneValue) {
1950
+ // 第一层
1951
+ setBreadcrumbsList([]);
1952
+ } else {
1953
+ // 除了第一级,最后一级
1954
+ setBreadcrumbsList(spliceBreadcrumbs(item));
1955
+ }
1956
+
1957
+ if (isReqLocalData) {
1958
+ if (keyStr === oneValue) {
1959
+ // 第一层
1960
+ constData.current.currentSourceData = _toConsumableArray(constData.current.oneDataList);
1961
+ } else {
1962
+ // 除了第一级,最后一级
1963
+ var itemData = constData.current.jsonData[keyStr];
1964
+ constData.current.currentSourceData = itemData[fieldConfigHand.children];
1965
+ }
1966
+ } else {
1967
+ // 请求数据
1968
+ if (constData.current.reqParams.isLazy) {
1969
+ // 懒加载
1970
+ if (constData.current.reqParams.pagination) {
1971
+ // 分页
1972
+ constData.current.currentSourceData = [];
1973
+ }
1974
+ }
1975
+ }
1976
+
1977
+ handInitCurrent();
1978
+ };
1979
+ /** 搜索回调 */
1980
+
1981
+
1982
+ var onSearchCom = function onSearchCom(val, bol) {
1983
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee4() {
1984
+ var result, arr;
1985
+ return regenerator.wrap(function _callee4$(_context4) {
1986
+ while (1) {
1987
+ switch (_context4.prev = _context4.next) {
1988
+ case 0:
1989
+ if (!(val === '')) {
1990
+ _context4.next = 5;
1991
+ break;
1992
+ }
1993
+
1994
+ setSearchList([]);
1995
+ setSearchLoading(false);
1996
+
1997
+ if (bol) {
1998
+ // 当前页刷新
1999
+ refreshFunc();
2000
+ }
2001
+
2002
+ return _context4.abrupt("return");
2003
+
2004
+ case 5:
2005
+ if (!onSearch) {
2006
+ _context4.next = 13;
2007
+ break;
2008
+ }
2009
+
2010
+ setSearchLoading(true);
2011
+ _context4.next = 9;
2012
+ return onSearch(val);
2013
+
2014
+ case 9:
2015
+ result = _context4.sent;
2016
+ arr = convertTree(result || [], true);
2017
+ setSearchList(arr);
2018
+ setSearchLoading(false);
2019
+
2020
+ case 13:
2021
+ case "end":
2022
+ return _context4.stop();
2023
+ }
2024
+ }
2025
+ }, _callee4);
2026
+ }));
2027
+ };
2028
+ /** 删除数据 */
2029
+
2030
+
2031
+ var onCloseCom = function onCloseCom(item, index) {
2032
+ if (selectMode === 'radio') {
2033
+ onChangeEmit(null, [], {}, {});
2034
+ }
2035
+
2036
+ if (selectMode === 'check') {
2037
+ var arr = _toConsumableArray(valueCom);
2038
+
2039
+ arr.splice(index, 1);
2040
+ var node = {}; // 处理过得数据
2041
+
2042
+ var rowData = {}; // 原始数据
2043
+
2044
+ for (var i = 0, l = arr.length; i < l; i++) {
2045
+ var _item2 = arr[i];
2046
+ var keyStr = _item2[selectorFieldConfigHand.key];
2047
+ node[keyStr] = constData.current.jsonData[keyStr];
2048
+ rowData[keyStr] = constData.current.jsonDataCopy[keyStr];
2049
+ }
2050
+
2051
+ onChangeEmit(arr, arr, node, rowData);
2052
+ }
2053
+ };
2054
+ /** 处理返回数据dom配置 */
2055
+
2056
+
2057
+ var handSelectorData = function handSelectorData() {
2058
+ return jsx(SelectorData, {
2059
+ layout: layout === 'tb' ? 'tag' : 'node',
2060
+ backDataFieldConfig: selectorFieldConfigHand,
2061
+ groupType: groupType,
2062
+ handSelectorNodeInfo: props.handSelectorNodeInfo,
2063
+ list: valueCom,
2064
+ nodeMode: nodeMode,
2065
+ detail: detail,
2066
+ detailRender: detailRender,
2067
+ emptyProps: emptyProps,
2068
+ onClose: onCloseCom,
2069
+ selectDataTitleRender: props.selectDataTitleRender,
2070
+ disabled: disabled
2071
+ });
2072
+ }; // 处理className
2073
+
2074
+
2075
+ var handClass = function handClass() {
2076
+ var str = 'paraui-selector';
2077
+ if (className) str += ' ' + className;
2078
+ if (layout) str += ' paraui-selector-' + layout;
2079
+ if (selectMode) str += ' paraui-selector-' + selectMode;
2080
+ if (disabled === true) str += ' paraui-selector-disabled';
2081
+ return str;
2082
+ };
2083
+
2084
+ return jsxs("div", Object.assign({
2085
+ className: handClass(),
2086
+ style: style
2087
+ }, {
2088
+ children: [layout === 'tb' && handSelectorData(), jsx(SelectorMain, {
2089
+ rowKey: rowKey,
2090
+ value: valueJsonCom,
2091
+ loadMore: loadMore,
2092
+ isAllCheck: isAllCheck,
2093
+ list: currentData,
2094
+ groupType: groupType,
2095
+ groupRange: groupRange,
2096
+ fieldConfig: fieldConfigHand,
2097
+ nodeMode: nodeMode,
2098
+ selectMode: selectMode,
2099
+ isLazy: isLazy,
2100
+ detail: detail,
2101
+ detailRender: detailRender,
2102
+ search: search,
2103
+ searchTrigger: searchTrigger,
2104
+ searchPlaceholder: searchPlaceholder,
2105
+ searchLoading: searchLoading,
2106
+ disabled: disabled,
2107
+ loading: loadingCom,
2108
+ searchList: searchList,
2109
+ breadcrumbs: breadcrumbs,
2110
+ breadcrumbsSeparator: breadcrumbsSeparator,
2111
+ breadcrumbsList: handBreadcrumbsList(),
2112
+ emptyProps: emptyProps,
2113
+ onLevel: onLevelCom,
2114
+ onSelect: onSelectCom,
2115
+ onLoad: onLoadCom,
2116
+ onAllCheck: onAllCheckCom,
2117
+ onClickBreadcrumbs: onClickBreadcrumbsCom,
2118
+ onSearch: onSearchCom
2119
+ }), layout === 'lr' && handSelectorData()]
2120
+ }));
2121
+ };
2122
+
2123
+ export { Selector as default, handFieldConfig };