@para-ui/core 4.0.0-rc.4 → 4.0.0-rc.6
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.
- package/AutoBox/index.js +72 -85
- package/AutoTips/index.js +72 -95
- package/Badge/index.js +17 -16
- package/Breadcrumbs/index.js +57 -73
- package/Button/index.js +90 -118
- package/ButtonGroup/index.js +30 -33
- package/Carousel/index.js +29 -33
- package/Cascader/index.js +9 -10
- package/Checkbox/index.js +28 -35
- package/CheckboxGroup/index.js +43 -58
- package/Collapse/index.js +52 -49
- package/CollapseBox/index.js +65 -70
- package/CollapseLayout/index.js +106 -101
- package/ColorPicker/index.js +3 -3
- package/ComboSelect/index.js +260 -337
- package/ComboSelect/lang/en_US.d.ts +1 -0
- package/ComboSelect/lang/index.d.ts +2 -0
- package/ComboSelect/lang/zh_CN.d.ts +1 -0
- package/ComboSelect/utils.d.ts +6 -0
- package/Container/index.js +17 -21
- package/CopyText/index.js +50 -83
- package/DatePicker/index.js +24 -27
- package/Descriptions/index.js +50 -59
- package/Desktop/index.js +161 -180
- package/DragVerify/index.js +77 -113
- package/Drawer/index.js +80 -95
- package/Dropdown/index.js +3 -3
- package/DynamicMultiBox/index.js +222 -224
- package/DynamicMultiBox/interface.d.ts +7 -0
- package/Empty/index.js +26 -28
- package/Form/index.js +70 -74
- package/FormItem/index.js +18 -15
- package/FunctionModal/index.js +7 -14
- package/GlobalContext/index.js +17 -20
- package/Help/index.js +9 -12
- package/HelperText/index.js +11 -11
- package/InputLang/index.js +104 -124
- package/InputNumber/index.js +62 -81
- package/Label/index.js +19 -21
- package/Loading/index.js +11 -10
- package/Menu/index.js +302 -371
- package/Message/index.js +104 -113
- package/Modal/index.js +122 -148
- package/MultiBox/index.d.ts +5 -0
- package/MultiBox/index.js +111 -115
- package/Notification/index.js +105 -103
- package/OperateBtn/index.d.ts +3 -0
- package/OperateBtn/index.js +77 -107
- package/PageHeader/index.js +327 -406
- package/Pagination/index.js +107 -137
- package/ParauiProvider/index.js +20 -22
- package/PasswordRules/index.js +36 -40
- package/PopConfirm/index.js +60 -77
- package/Popover/index.js +12 -12
- package/Progress/index.js +72 -74
- package/Querying/index.js +22 -23
- package/README.md +2 -0
- package/Radio/index.js +27 -34
- package/RadioGroup/index.js +38 -52
- package/Search/index.js +34 -43
- package/Select/index.js +281 -345
- package/SelectInput/index.js +8 -13
- package/Selector/index.js +582 -796
- package/SelectorPicker/index.js +113 -134
- package/SingleBox/index.d.ts +5 -0
- package/SingleBox/index.js +92 -88
- package/Slider/index.js +46 -57
- package/Status/index.js +14 -13
- package/Stepper/index.js +24 -25
- package/Styles/theme.scss +9 -9
- package/Switch/index.js +32 -35
- package/Table/index.js +360 -494
- package/Tabs/index.js +100 -100
- package/Tag/index.js +64 -82
- package/TextEditor/index.js +78 -100
- package/TextField/index.js +142 -183
- package/TimePicker/index.js +29 -28
- package/Timeline/index.js +50 -47
- package/Title/index.js +32 -34
- package/ToggleButton/index.js +29 -29
- package/Tooltip/index.js +52 -56
- package/Transfer/index.js +117 -154
- package/Tree/index.js +9 -10
- package/Upload/index.js +125 -143
- package/Upload/interface.d.ts +2 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-5a7e2438.js → index-3cdaba96.js} +967 -934
- package/_verture/{index-b1f80962.js → index-4fafd0a0.js} +6 -8
- package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
- package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
- package/_verture/{index-232d890b.js → index-d63bd287.js} +1 -1
- package/_verture/index-da9097d3.js +239 -0
- package/_verture/{index-9331b116.js → index-e0f9064d.js} +125 -134
- package/_verture/intl-f2f27722.js +69 -0
- package/_verture/{modalContext-736ff215.js → modalContext-8534f23d.js} +36 -64
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-75fa4188.js} +15 -2
- package/_verture/{toConsumableArray-8f4c9589.js → toConsumableArray-c7a8028f.js} +1 -1
- package/_verture/{useFormatMessage-703f8b20.js → useFormatMessage-eb13cf56.js} +5 -4
- package/_verture/{useGlobalProps-1b846a65.js → useGlobalProps-1e416658.js} +4 -3
- package/_verture/{usePopupContainer-87febeb9.js → usePopupContainer-635f66f4.js} +16 -15
- package/_verture/{util-7e1fb1e2.js → util-82646c4f.js} +5 -4
- package/_verture/utils-c17b5265.js +97 -0
- package/index.js +24 -23
- package/locale/en-US.d.ts +1 -0
- package/locale/index.d.ts +2 -0
- package/locale/index.js +10 -8
- package/locale/zh-CN.d.ts +1 -0
- package/package.json +11 -10
- package/umd/AutoBox.js +9 -8
- package/umd/AutoTips.js +9 -8
- package/umd/Badge.js +1 -1
- package/umd/Breadcrumbs.js +9 -8
- package/umd/Button.js +9 -8
- package/umd/ButtonGroup.js +9 -8
- package/umd/Carousel.js +5 -5
- package/umd/Cascader.js +9 -8
- package/umd/Checkbox.js +9 -8
- package/umd/CheckboxGroup.js +9 -8
- package/umd/Collapse.js +8 -7
- package/umd/CollapseBox.js +1 -1
- package/umd/CollapseLayout.js +4 -4
- package/umd/ColorPicker.js +1 -1
- package/umd/ComboSelect.js +9 -8
- package/umd/Container.js +1 -1
- package/umd/CopyText.js +9 -8
- package/umd/DatePicker.js +9 -8
- package/umd/Descriptions.js +9 -8
- package/umd/Desktop.js +9 -8
- package/umd/DragVerify.js +4 -4
- package/umd/Drawer.js +9 -8
- package/umd/Dropdown.js +6 -5
- package/umd/DynamicMultiBox.js +11 -10
- package/umd/Empty.js +1 -1
- package/umd/Form.js +9 -8
- package/umd/FormItem.js +9 -8
- package/umd/FunctionModal.js +9 -8
- package/umd/GlobalContext.js +1 -1
- package/umd/Help.js +9 -8
- package/umd/HelperText.js +1 -1
- package/umd/InputLang.js +9 -8
- package/umd/InputNumber.js +9 -8
- package/umd/Label.js +9 -8
- package/umd/Loading.js +4 -4
- package/umd/Menu.js +4 -4
- package/umd/Message.js +4 -4
- package/umd/Modal.js +9 -8
- package/umd/MultiBox.js +9 -8
- package/umd/Notification.js +8 -7
- package/umd/OperateBtn.js +9 -8
- package/umd/PageHeader.js +9 -8
- package/umd/Pagination.js +9 -8
- package/umd/ParauiProvider.js +1 -1
- package/umd/PasswordRules.js +4 -4
- package/umd/PopConfirm.js +9 -8
- package/umd/Popover.js +9 -8
- package/umd/Progress.js +5 -5
- package/umd/Querying.js +1 -1
- package/umd/Radio.js +9 -8
- package/umd/RadioGroup.js +9 -8
- package/umd/Search.js +9 -8
- package/umd/Select.js +9 -8
- package/umd/SelectInput.js +9 -8
- package/umd/Selector.js +9 -8
- package/umd/SelectorPicker.js +9 -8
- package/umd/SingleBox.js +9 -8
- package/umd/Slider.js +6 -5
- package/umd/Status.js +4 -4
- package/umd/Stepper.js +9 -8
- package/umd/Switch.js +9 -8
- package/umd/Table.js +9 -8
- package/umd/Tabs.js +9 -8
- package/umd/Tag.js +9 -8
- package/umd/TextEditor.js +22 -21
- package/umd/TextField.js +9 -8
- package/umd/TimePicker.js +9 -8
- package/umd/Timeline.js +1 -1
- package/umd/Title.js +9 -8
- package/umd/ToggleButton.js +9 -8
- package/umd/Tooltip.js +9 -8
- package/umd/Transfer.js +10 -9
- package/umd/Tree.js +9 -8
- package/umd/Upload.js +10 -9
- package/umd/locale.js +1 -1
- package/_verture/index-e9007d6a.js +0 -236
- package/_verture/intl-5c1ec055.js +0 -81
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
- package/_verture/utils-418da0a4.js +0 -73
- /package/_verture/{typeof-c310ee4a.js → typeof-b240b062.js} +0 -0
package/ComboSelect/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-1d116156.js';
|
|
2
|
-
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-8f4c9589.js';
|
|
3
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
4
|
-
import { r as regenerator } from '../_verture/index-232d890b.js';
|
|
5
1
|
import { a as __awaiter } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
6
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
3
|
import React__default, { useRef, useState, useMemo, useImperativeHandle, useEffect } from 'react';
|
|
@@ -10,27 +6,26 @@ import SearchIcon from '@para-ui/icons/Search';
|
|
|
10
6
|
import CloseIcon from '@para-ui/icons/Close';
|
|
11
7
|
import CloseCircleF from '@para-ui/icons/CloseCircleF';
|
|
12
8
|
import Table from '../Table/index.js';
|
|
13
|
-
import { T as Tree } from '../_verture/index-
|
|
9
|
+
import { T as Tree } from '../_verture/index-4fafd0a0.js';
|
|
14
10
|
import { Button } from '../Button/index.js';
|
|
15
|
-
import { D as Dropdown } from '../_verture/index-
|
|
11
|
+
import { D as Dropdown } from '../_verture/index-da9097d3.js';
|
|
16
12
|
import { Popover } from '../Popover/index.js';
|
|
17
13
|
import AutoTips from '../AutoTips/index.js';
|
|
18
14
|
import { Tooltip } from '../Tooltip/index.js';
|
|
19
15
|
import clsx from 'clsx';
|
|
20
|
-
import { g as getReplaceField, i as isRemoteLoad, d as debounce, t as toArray, a as getOverlaySize } from '../_verture/utils-
|
|
16
|
+
import { g as getReplaceField, i as isRemoteLoad, d as debounce, t as toArray, c as closest, a as getOverlaySize } from '../_verture/utils-c17b5265.js';
|
|
21
17
|
import { DeepClone, ArrayToObject } from '@paraview/lib';
|
|
22
18
|
import GlobalContext from '@para-ui/core/GlobalContext';
|
|
23
|
-
import { u as useGlobalProps } from '../_verture/useGlobalProps-
|
|
24
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
19
|
+
import { u as useGlobalProps } from '../_verture/useGlobalProps-1e416658.js';
|
|
20
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
|
|
25
21
|
import Label from '../Label/index.js';
|
|
26
22
|
import HelperText from '../HelperText/index.js';
|
|
27
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
23
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
28
24
|
import { Search } from '../Search/index.js';
|
|
29
25
|
import LoadingOutlined from '@para-ui/icons/LoadingF';
|
|
30
26
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
31
27
|
import '../_verture/typeof-adeedc13.js';
|
|
32
|
-
import '../_verture/
|
|
33
|
-
import '../_verture/typeof-c310ee4a.js';
|
|
28
|
+
import '../_verture/slicedToArray-75fa4188.js';
|
|
34
29
|
import '../Checkbox/index.js';
|
|
35
30
|
import '../Help/index.js';
|
|
36
31
|
import '@para-ui/icons/Help';
|
|
@@ -42,9 +37,15 @@ import '@para-ui/icons/UpTriangleF';
|
|
|
42
37
|
import '@para-ui/icons/DownTriangleF';
|
|
43
38
|
import '@para-ui/icons/Panel';
|
|
44
39
|
import '../Empty/index.js';
|
|
40
|
+
import '../_verture/defineProperty-1d116156.js';
|
|
45
41
|
import '../Radio/index.js';
|
|
46
42
|
import '../OperateBtn/index.js';
|
|
47
43
|
import '@para-ui/icons/More';
|
|
44
|
+
import '../PopConfirm/index.js';
|
|
45
|
+
import '@para-ui/icons/CheckCircleF';
|
|
46
|
+
import '@para-ui/icons/WarningCircle';
|
|
47
|
+
import '@para-ui/icons/WarningCircleF';
|
|
48
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
48
49
|
import '@para-ui/icons/Refresh';
|
|
49
50
|
import '../Pagination/index.js';
|
|
50
51
|
import '../TextField/index.js';
|
|
@@ -58,6 +59,9 @@ import 'rc-pagination';
|
|
|
58
59
|
import '@para-ui/icons/Right';
|
|
59
60
|
import '@para-ui/icons/DoubleLeft';
|
|
60
61
|
import '@para-ui/icons/DoubleRight';
|
|
62
|
+
import '../_verture/toConsumableArray-c7a8028f.js';
|
|
63
|
+
import '../_verture/index-d63bd287.js';
|
|
64
|
+
import '../_verture/typeof-b240b062.js';
|
|
61
65
|
import 'rc-tree';
|
|
62
66
|
import '@para-ui/icons/Document';
|
|
63
67
|
import 'react-dom';
|
|
@@ -66,7 +70,6 @@ import '@para-ui/icons/PlusCircle';
|
|
|
66
70
|
import '@para-ui/icons/Delete';
|
|
67
71
|
import '@para-ui/icons/MoreCircle';
|
|
68
72
|
import 'rc-dropdown';
|
|
69
|
-
import '../_verture/usePopupContainer-87febeb9.js';
|
|
70
73
|
import 'dayjs';
|
|
71
74
|
|
|
72
75
|
var en = {
|
|
@@ -75,7 +78,8 @@ var en = {
|
|
|
75
78
|
ok: 'Ok',
|
|
76
79
|
fullPath: 'Full path',
|
|
77
80
|
pleaseSelect: 'Please select',
|
|
78
|
-
selected: 'selected'
|
|
81
|
+
selected: 'selected',
|
|
82
|
+
searching: 'Searching'
|
|
79
83
|
};
|
|
80
84
|
|
|
81
85
|
var zh = {
|
|
@@ -84,169 +88,121 @@ var zh = {
|
|
|
84
88
|
ok: '确定',
|
|
85
89
|
fullPath: '完整路径',
|
|
86
90
|
pleaseSelect: '请选择',
|
|
87
|
-
selected: '已选中'
|
|
91
|
+
selected: '已选中',
|
|
92
|
+
searching: '搜索中'
|
|
88
93
|
};
|
|
89
94
|
|
|
90
95
|
var localeJson = {
|
|
91
|
-
zh
|
|
92
|
-
en
|
|
96
|
+
zh,
|
|
97
|
+
en
|
|
93
98
|
};
|
|
94
99
|
|
|
95
100
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/18 上午10:16\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-comboselect .comboselect-wrapper {\n position: relative;\n display: flex;\n width: 100%;\n min-height: 32px;\n padding: 0 12px;\n font-size: 14px;\n border: 1px solid rgb(212, 218, 227);\n border-radius: 4px;\n background-color: rgb(255, 255, 255);\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v4-comboselect .comboselect-wrapper:hover {\n border-color: rgb(87, 131, 235);\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-placeholder {\n position: absolute;\n top: 50%;\n left: 12px;\n right: 42px;\n transform: translateY(-50%);\n font-size: 14px;\n color: rgb(161, 168, 179);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-arrow {\n position: absolute;\n top: 5px;\n right: 12px;\n line-height: 0;\n transition: 0.3s;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-arrow svg {\n color: rgb(92, 101, 115);\n font-size: 20px;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-clear {\n position: absolute;\n top: 7px;\n right: 12px;\n opacity: 0;\n line-height: 0;\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-clear svg {\n color: rgb(161, 168, 179);\n font-size: 16px;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-clear svg:hover {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow {\n position: relative;\n display: flex;\n width: 100%;\n flex: auto;\n flex-wrap: wrap;\n padding: 4px 30px 0 0;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow {\n height: 30px;\n padding: 0 30px 0 0;\n align-items: center;\n overflow: hidden;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow .comboselect-single-content {\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 14px;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-item {\n flex: none;\n max-width: 100%;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item {\n display: inline-flex;\n align-items: center;\n padding: 0 12px;\n height: 22px;\n margin: 0 8px 4px 0;\n max-width: 100%;\n color: rgb(29, 33, 38);\n line-height: 22px;\n background-color: rgb(234, 236, 241);\n border-radius: 4px;\n user-select: none;\n transition: 0.3s;\n cursor: default;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item .comboselect-item-content {\n display: inline-block;\n margin-right: 4px;\n overflow: hidden;\n font-size: 12px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item .comboselect-item-remove {\n display: inline-flex;\n cursor: pointer;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item .comboselect-item-remove svg {\n font-size: 16px;\n color: inherit;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item .comboselect-item-remove svg:hover {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item--disabled {\n color: rgb(161, 168, 179);\n background-color: rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item--disabled .comboselect-item-remove {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item--unclosable .comboselect-item-content {\n margin-right: 0;\n}\n.paraui-v4-comboselect-focused .comboselect-wrapper {\n border-color: rgb(87, 131, 235);\n}\n.paraui-v4-comboselect-focused .comboselect-wrapper .comboselect-arrow {\n transform: rotate(180deg);\n color: rgb(87, 131, 235);\n}\n.paraui-v4-comboselect-disabled {\n cursor: not-allowed;\n}\n.paraui-v4-comboselect-disabled .comboselect-wrapper {\n background-color: rgb(247, 248, 250);\n border-color: rgb(212, 218, 227);\n pointer-events: none;\n}\n.paraui-v4-comboselect-small .comboselect-wrapper, .paraui-v4-comboselect-medium .comboselect-wrapper {\n min-height: 28px;\n}\n.paraui-v4-comboselect-small .comboselect-wrapper .comboselect-overflow, .paraui-v4-comboselect-medium .comboselect-wrapper .comboselect-overflow {\n padding-top: 3px;\n}\n.paraui-v4-comboselect-small .comboselect-wrapper .comboselect-overflow-item .comboselect-item, .paraui-v4-comboselect-medium .comboselect-wrapper .comboselect-overflow-item .comboselect-item {\n height: 20px;\n margin-bottom: 3px;\n line-height: 20px;\n}\n.paraui-v4-comboselect-small .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow, .paraui-v4-comboselect-medium .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow {\n height: 26px;\n}\n.paraui-v4-comboselect-small .comboselect-wrapper .comboselect-arrow, .paraui-v4-comboselect-medium .comboselect-wrapper .comboselect-arrow {\n top: 3px;\n}\n.paraui-v4-comboselect-small .comboselect-wrapper .comboselect-clear, .paraui-v4-comboselect-medium .comboselect-wrapper .comboselect-clear {\n top: 5px;\n}\n.paraui-v4-comboselect-error .comboselect-wrapper {\n border-color: rgb(244, 66, 66);\n}\n.paraui-v4-comboselect-error .comboselect-wrapper:hover {\n border-color: rgb(244, 66, 66);\n}\n.paraui-v4-comboselect-clear .comboselect-wrapper:hover .comboselect-arrow {\n opacity: 0;\n}\n.paraui-v4-comboselect-clear .comboselect-wrapper:hover .comboselect-clear {\n opacity: 1;\n}\n.paraui-v4-comboselect-non-popup {\n border: 1px solid rgb(212, 218, 227);\n border-radius: 4px;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-comboselect-non-popup .comboselect-wrapper {\n border: none;\n border-bottom: 1px solid rgb(212, 218, 227);\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n cursor: default;\n}\n.paraui-v4-comboselect-non-popup .comboselect-wrapper:hover {\n border-color: rgb(212, 218, 227);\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content {\n position: relative;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-search {\n display: flex;\n align-items: center;\n height: 40px;\n border-bottom: 1px solid rgb(234, 236, 241);\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-icon {\n line-height: 0;\n cursor: pointer;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-icon svg {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-input {\n width: 100%;\n flex: auto;\n border: none;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-input .text-field-content {\n border: unset;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-input::placeholder {\n color: rgb(161, 168, 179);\n font-size: 14px;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-search .comboselect-clear-icon {\n display: inline-flex;\n cursor: pointer;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-search .comboselect-clear-icon svg {\n font-size: 16px;\n color: rgb(161, 168, 179);\n transition: all 0.3s;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-search .comboselect-clear-icon svg:hover {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-table {\n padding-bottom: 10px;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-table .table-pagination {\n height: 52px;\n padding-right: 20px;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-table .paraui-v4-table {\n box-shadow: none;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-tree {\n padding: 6px 7px;\n}\n.paraui-v4-comboselect-non-popup .comboselect-non-popup-content .comboselect-tree .paraui-v4-tree-empty {\n padding: 52px 0 73px 0;\n}\n.paraui-v4-comboselect-dropdown .comboselect-dropdown-wrapper {\n position: relative;\n color: initial;\n overflow: hidden;\n}\n.paraui-v4-comboselect-dropdown .dropdown-content {\n display: flex;\n flex-direction: column;\n}\n.paraui-v4-comboselect-dropdown .comboselect-search {\n display: flex;\n align-items: center;\n height: 40px;\n min-height: 40px;\n border-bottom: 1px solid rgb(234, 236, 241);\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-icon {\n line-height: 0;\n cursor: pointer;\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-icon svg {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-input {\n width: 100%;\n flex: auto;\n border: none;\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-input .text-field-content {\n border: unset;\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-input::placeholder {\n color: rgb(161, 168, 179);\n font-size: 14px;\n}\n.paraui-v4-comboselect-dropdown .comboselect-search .comboselect-clear-icon {\n display: inline-flex;\n cursor: pointer;\n}\n.paraui-v4-comboselect-dropdown .comboselect-search .comboselect-clear-icon svg {\n font-size: 16px;\n color: rgb(161, 168, 179);\n transition: all 0.3s;\n}\n.paraui-v4-comboselect-dropdown .comboselect-search .comboselect-clear-icon svg:hover {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-comboselect-dropdown .comboselect-table {\n flex: 1 1;\n overflow-y: auto;\n height: 100%;\n padding-bottom: 20px;\n}\n.paraui-v4-comboselect-dropdown .comboselect-table .paraui-v4-table {\n box-shadow: none;\n}\n.paraui-v4-comboselect-dropdown .comboselect-table .paraui-v4-table .table-pagination {\n height: 52px;\n padding-right: 20px;\n}\n.paraui-v4-comboselect-dropdown .comboselect-table .paraui-v4-table .table-contain {\n height: calc(100% - 52px);\n}\n.paraui-v4-comboselect-dropdown .comboselect-tree {\n flex: 1 1;\n overflow-y: auto;\n height: 100%;\n padding: 6px 7px;\n}\n.paraui-v4-comboselect-dropdown .comboselect-tree .paraui-v4-tree-empty {\n height: 100%;\n padding: 52px 0 73px 0;\n}\n.paraui-v4-comboselect-dropdown .comboselect-tree .loading-node-content {\n display: flex;\n justify-content: center;\n}\n@keyframes rotateLoading {\n 0% {\n transformOrigin: 50% 50%;\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n.paraui-v4-comboselect-dropdown .comboselect-tree .loading-node-content .loading-icon {\n margin-right: 4px;\n}\n.paraui-v4-comboselect-dropdown .comboselect-tree .loading-node-content .loading-icon > svg {\n transition: all 0.3s ease-in-out;\n animation: rotateLoading 1s infinite linear;\n font-size: 20px;\n}\n.paraui-v4-comboselect-dropdown .comboselect-actions {\n display: flex;\n align-items: center;\n padding: 8px 20px 8px 0;\n justify-content: flex-end;\n border-top: 1px solid rgb(234, 236, 241);\n}\n.paraui-v4-comboselect-dropdown .comboselect-actions button + button {\n margin-left: 10px;\n}\n.paraui-v4-comboselect-dropdown .comboselect-fullPath {\n height: 34px;\n line-height: 34px;\n padding: 0 12px;\n border-top: 1px solid rgb(234, 236, 241);\n font-size: 14px;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-comboselect-dropdown .comboselect-fullPath span {\n display: inline-block;\n height: 100%;\n padding-right: 10px;\n border-right: 1px solid rgb(234, 236, 241);\n}\n.paraui-v4-comboselect-dropdown .comboselect-list {\n padding: 8px 0;\n}\n.paraui-v4-comboselect-dropdown .comboselect-list .paraui-v4-tree-empty {\n padding: 50px 0 72px 0;\n}\n.paraui-v4-comboselect-dropdown .comboselect-list .paraui-v4-tree-treenode {\n width: 100%;\n}\n.paraui-v4-comboselect-dropdown .comboselect-list .paraui-v4-tree-treenode .paraui-v4-tree-switcher {\n display: none;\n}\n.paraui-v4-comboselect-dropdown .comboselect-list .paraui-v4-tree-treenode .paraui-v4-tree-checkbox {\n display: none;\n}\n.paraui-v4-comboselect-dropdown .comboselect-list .paraui-v4-tree-treenode .paraui-v4-tree-node-content-wrapper {\n width: 100%;\n margin: 0;\n padding: 6px 28px 6px 12px;\n}\n.paraui-v4-comboselect-dropdown .comboselect-list .paraui-v4-tree-treenode .paraui-v4-tree-node-content-wrapper:hover {\n background-color: rgb(247, 248, 250);\n border-radius: 0 !important;\n}\n.paraui-v4-comboselect-dropdown .comboselect-list .paraui-v4-tree-treenode-checkbox-checked .paraui-v4-tree-node-content-wrapper {\n position: relative;\n color: rgb(87, 131, 235);\n}\n.paraui-v4-comboselect-dropdown .comboselect-list .paraui-v4-tree-treenode-checkbox-checked .paraui-v4-tree-node-content-wrapper::after {\n position: absolute;\n content: \" \";\n width: 15px;\n height: 10px;\n right: 12px;\n top: 50%;\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAVCAYAAABR915hAAAABHNCSVQICAgIfAhkiAAAAPhJREFUSEu91TsKwkAQANBZ0drOIjaWIkTiCcSbaLHgbTxAFPUGHkFvEAh4hASs7BXH3WBC/tmv24TAJG8/M7ME/jRcGq8JfnYIJAj3zor8w01QwGNqvaG/sA6XUUQ4sxWziVgcTSgnrcFtqDW4C7UCi6DGYVE0g2f04d39UaCTZzJoArs0urIMWyLgKfTHGxVcFk3gOY2e7DnkLyq4CvpbcbGryOCqaHbGlR8IbLsOWshqGVwXrZSTCG4Cra3jNtwU2thA6nCA3i1/taW3jEr5tXauMp4HdNHOllmHm0A7YR6Qx02hQjAPmm7jyeCFXnhwLqpnWv7uCxqa4b8ke3ZZAAAAAElFTkSuQmCC\");\n transform: translateY(-50%);\n background-size: 15px 11px;\n}\n.paraui-v4-comboselect-dropdown .comboselect-list .paraui-v4-tree-treenode-disabled .paraui-v4-tree-node-content-wrapper:hover {\n background-color: transparent;\n}\n.paraui-v4-comboselect-dropdown .comboselect-list-single .paraui-v4-tree-treenode-checkbox-checked .paraui-v4-tree-node-content-wrapper::after {\n display: none;\n}\n.paraui-v4-comboselect-more-popover {\n padding-left: 12px;\n}\n.paraui-v4-comboselect-more-popover .comboselect-more-wrapper {\n width: 300px;\n padding: 12px 0;\n}\n.paraui-v4-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-title {\n display: block;\n padding: 0 12px;\n margin-bottom: 5px;\n font-size: 12px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-content {\n max-height: 300px;\n padding: 0 12px;\n overflow-y: auto;\n}\n.paraui-v4-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item {\n display: flex;\n align-items: center;\n height: 36px;\n font-size: 14px;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-text {\n display: inline-block;\n max-width: calc(100% - 25px);\n}\n.paraui-v4-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-remove {\n display: inline-flex;\n margin-left: auto;\n}\n.paraui-v4-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-remove svg {\n font-size: 20px;\n color: rgb(29, 33, 38);\n cursor: pointer;\n}\n.paraui-v4-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-remove svg:hover {\n color: rgb(87, 131, 235);\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-input::-ms-clear, .paraui-v4-comboselect-non-popup .comboselect-search-input::-ms-clear {\n display: none;\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-input::-ms-reveal, .paraui-v4-comboselect-non-popup .comboselect-search-input::-ms-reveal {\n display: none;\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-input:-moz-placeholder, .paraui-v4-comboselect-non-popup .comboselect-search-input:-moz-placeholder {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-input::-moz-placeholder, .paraui-v4-comboselect-non-popup .comboselect-search-input::-moz-placeholder {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-input:-ms-input-placeholder, .paraui-v4-comboselect-non-popup .comboselect-search-input:-ms-input-placeholder {\n /* Internet Explorer 10-11 */\n color: rgb(161, 168, 179);\n}\n.paraui-v4-comboselect-dropdown .comboselect-search-input::-ms-input-placeholder, .paraui-v4-comboselect-non-popup .comboselect-search-input::-ms-input-placeholder {\n /* Microsoft Edge */\n color: rgb(161, 168, 179);\n}";
|
|
96
101
|
styleInject(css_248z);
|
|
97
102
|
|
|
98
103
|
//组合选择器
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
_useGlobalProps$popov = _useGlobalProps.popoverActions,
|
|
120
|
-
popoverActions = _useGlobalProps$popov === void 0 ? null : _useGlobalProps$popov,
|
|
121
|
-
_useGlobalProps$showP = _useGlobalProps.showPopoverActions,
|
|
122
|
-
showPopoverActions = _useGlobalProps$showP === void 0 ? false : _useGlobalProps$showP,
|
|
123
|
-
_useGlobalProps$defau = _useGlobalProps.defaultOpen,
|
|
124
|
-
defaultOpen = _useGlobalProps$defau === void 0 ? false : _useGlobalProps$defau,
|
|
125
|
-
defaultValue = _useGlobalProps.defaultValue,
|
|
126
|
-
_useGlobalProps$repla = _useGlobalProps.replaceFields,
|
|
127
|
-
replaceFields = _useGlobalProps$repla === void 0 ? {
|
|
104
|
+
const ComboSelect = props => {
|
|
105
|
+
const {
|
|
106
|
+
mode = 'table',
|
|
107
|
+
placeholder,
|
|
108
|
+
searchPlaceholder,
|
|
109
|
+
maxCount,
|
|
110
|
+
disabled = false,
|
|
111
|
+
allowClear = false,
|
|
112
|
+
className,
|
|
113
|
+
style,
|
|
114
|
+
maxHeight,
|
|
115
|
+
height,
|
|
116
|
+
placement = 'bottomLeft',
|
|
117
|
+
popoverClassName,
|
|
118
|
+
size = 'large',
|
|
119
|
+
popoverActions = null,
|
|
120
|
+
showPopoverActions = false,
|
|
121
|
+
defaultOpen = false,
|
|
122
|
+
defaultValue,
|
|
123
|
+
replaceFields = {
|
|
128
124
|
key: 'key',
|
|
129
125
|
title: 'title',
|
|
130
126
|
children: 'children'
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
outputFields = _useGlobalProps$outpu === void 0 ? {
|
|
127
|
+
},
|
|
128
|
+
outputFields = {
|
|
134
129
|
outputKey: 'key',
|
|
135
130
|
outputTitle: 'label'
|
|
136
|
-
}
|
|
137
|
-
value
|
|
138
|
-
onClear
|
|
139
|
-
onCancel
|
|
140
|
-
onOk
|
|
141
|
-
onClose
|
|
142
|
-
onChange
|
|
143
|
-
onSearch
|
|
144
|
-
refresh
|
|
145
|
-
TableProps
|
|
146
|
-
TreeProps
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
fullPath = _useState10[0],
|
|
210
|
-
setFullPath = _useState10[1]; //路径
|
|
211
|
-
var _useState11 = useState(false),
|
|
212
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
213
|
-
hasAllClear = _useState12[0],
|
|
214
|
-
setHasAllClear = _useState12[1]; //显示清除按钮
|
|
215
|
-
var _useState13 = useState(0),
|
|
216
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
217
|
-
inRefresh = _useState14[0],
|
|
218
|
-
setInRefresh = _useState14[1]; //内部刷新组件
|
|
219
|
-
var _useState15 = useState(false),
|
|
220
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
221
|
-
openMore = _useState16[0],
|
|
222
|
-
setOpenMore = _useState16[1]; //显示更过选中
|
|
223
|
-
var _useState17 = useState([]),
|
|
224
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
225
|
-
moreTagList = _useState18[0],
|
|
226
|
-
setMoreTagList = _useState18[1]; //更多tag列表
|
|
227
|
-
var originValueRef = useRef([]); // 保存value
|
|
228
|
-
var hasPopup = useRef(false); //显示弹框标识
|
|
229
|
-
var popUpNodeRef = useRef(); //popup dom
|
|
230
|
-
var emptyParamsRef = useRef({}); //空参数常量
|
|
231
|
-
var searchInputRef = useRef(); //search input
|
|
232
|
-
var mergedReplaceF = getReplaceField(mode, replaceFields, TableProps, TreeProps); //替换字段
|
|
233
|
-
var _mergedReplaceF$key = mergedReplaceF.key,
|
|
234
|
-
fieldKey = _mergedReplaceF$key === void 0 ? '' : _mergedReplaceF$key,
|
|
235
|
-
_mergedReplaceF$title = mergedReplaceF.title,
|
|
236
|
-
fieldTitle = _mergedReplaceF$title === void 0 ? '' : _mergedReplaceF$title;
|
|
237
|
-
var _ref = outputFields || {},
|
|
238
|
-
_ref$outputKey = _ref.outputKey,
|
|
239
|
-
outputKey = _ref$outputKey === void 0 ? 'key' : _ref$outputKey,
|
|
240
|
-
_ref$outputTitle = _ref.outputTitle,
|
|
241
|
-
outputTitle = _ref$outputTitle === void 0 ? 'label' : _ref$outputTitle;
|
|
242
|
-
var intl = useFormatMessage('ComboSelect', localeJson);
|
|
243
|
-
var isRemoteLoadRef = useRef(isRemoteLoad(mode, mode === 'table' ? TableProps : TreeProps)); //是否远程加载数据
|
|
244
|
-
var _useState19 = useState(),
|
|
245
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
246
|
-
loadedKeys = _useState20[0],
|
|
247
|
-
setLoadKeys = _useState20[1]; //加载过的key
|
|
131
|
+
},
|
|
132
|
+
value,
|
|
133
|
+
onClear,
|
|
134
|
+
onCancel,
|
|
135
|
+
onOk,
|
|
136
|
+
onClose,
|
|
137
|
+
onChange,
|
|
138
|
+
onSearch,
|
|
139
|
+
refresh,
|
|
140
|
+
TableProps,
|
|
141
|
+
TreeProps,
|
|
142
|
+
checkable = true,
|
|
143
|
+
url,
|
|
144
|
+
ctx,
|
|
145
|
+
params,
|
|
146
|
+
method = 'Get',
|
|
147
|
+
showSearch = false,
|
|
148
|
+
realTimeSearch = false,
|
|
149
|
+
error = false,
|
|
150
|
+
hideErrorDom,
|
|
151
|
+
helperText,
|
|
152
|
+
paramsCallback,
|
|
153
|
+
fullPathKey,
|
|
154
|
+
fullPathRender,
|
|
155
|
+
disablePopup = false,
|
|
156
|
+
tagRender,
|
|
157
|
+
onTagRemove,
|
|
158
|
+
action,
|
|
159
|
+
label = '',
|
|
160
|
+
labelTooltip,
|
|
161
|
+
required = false,
|
|
162
|
+
emptyProps,
|
|
163
|
+
toggleSelectedOnSingle = false,
|
|
164
|
+
optionRender,
|
|
165
|
+
getOptionLabel,
|
|
166
|
+
dropdownMatchSelectWidth = true,
|
|
167
|
+
getPopupContainer,
|
|
168
|
+
maxTagTextLength,
|
|
169
|
+
renderInputContent
|
|
170
|
+
} = useGlobalProps(props, 'ComboSelect');
|
|
171
|
+
const {
|
|
172
|
+
language,
|
|
173
|
+
locale
|
|
174
|
+
} = React__default.useContext(GlobalContext);
|
|
175
|
+
const selectRef = useRef();
|
|
176
|
+
const [open, setOpen] = useState(false); //打开popover
|
|
177
|
+
const [checkKeys, setCheckKeys] = useState([]); //选中key
|
|
178
|
+
const checkValuesRef = useRef(new Map()); //选中value
|
|
179
|
+
const [checkList, setCheckList] = useState([]); //tag显示选中项
|
|
180
|
+
const [inputValue, setInputValue] = useState(''); //input value
|
|
181
|
+
const searchKeyRef = useRef(undefined); //搜索参数
|
|
182
|
+
const [fullPath, setFullPath] = useState(null); //路径
|
|
183
|
+
const [hasAllClear, setHasAllClear] = useState(false); //显示清除按钮
|
|
184
|
+
const [inRefresh, setInRefresh] = useState(0); //内部刷新组件
|
|
185
|
+
const [openMore, setOpenMore] = useState(false); //显示更过选中
|
|
186
|
+
const [moreTagList, setMoreTagList] = useState([]); //更多tag列表
|
|
187
|
+
const originValueRef = useRef([]); // 保存value
|
|
188
|
+
const hasPopup = useRef(false); //显示弹框标识
|
|
189
|
+
const popUpNodeRef = useRef(); //popup dom
|
|
190
|
+
const emptyParamsRef = useRef({}); //空参数常量
|
|
191
|
+
const searchInputRef = useRef(); //search input
|
|
192
|
+
const mergedReplaceF = getReplaceField(mode, replaceFields, TableProps, TreeProps); //替换字段
|
|
193
|
+
const {
|
|
194
|
+
key: fieldKey = '',
|
|
195
|
+
title: fieldTitle = ''
|
|
196
|
+
} = mergedReplaceF;
|
|
197
|
+
const {
|
|
198
|
+
outputKey = 'key',
|
|
199
|
+
outputTitle = 'label'
|
|
200
|
+
} = outputFields || {};
|
|
201
|
+
const intl = useFormatMessage('ComboSelect', localeJson);
|
|
202
|
+
const isRemoteLoadRef = useRef(isRemoteLoad(mode, mode === 'table' ? TableProps : TreeProps)); //是否远程加载数据
|
|
203
|
+
const [loadedKeys, setLoadKeys] = useState(); //加载过的key
|
|
248
204
|
//选择框点击
|
|
249
|
-
|
|
205
|
+
const handleSelectorClick = event => {
|
|
250
206
|
if (disablePopup) return;
|
|
251
207
|
if (disabled) return;
|
|
252
208
|
if (hasPopup.current) {
|
|
@@ -257,7 +213,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
257
213
|
setOpen(true);
|
|
258
214
|
};
|
|
259
215
|
//关闭popover
|
|
260
|
-
|
|
216
|
+
const handlePopoverClose = (event, reason) => {
|
|
261
217
|
hasPopup.current = false;
|
|
262
218
|
searchKeyRef.current = undefined;
|
|
263
219
|
emptyParamsRef.current = {};
|
|
@@ -270,35 +226,31 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
270
226
|
}
|
|
271
227
|
};
|
|
272
228
|
//清空选择器数据
|
|
273
|
-
|
|
229
|
+
const clearSelectorData = () => {
|
|
274
230
|
setCheckKeys([]);
|
|
275
231
|
setCheckList([]);
|
|
276
232
|
setMoreTagList([]);
|
|
277
233
|
};
|
|
278
234
|
//处理选中
|
|
279
|
-
|
|
235
|
+
const handleChecked = (keys, values) => {
|
|
280
236
|
setCheckKeys(keys);
|
|
281
237
|
formatSelectedData(values, keys);
|
|
282
238
|
};
|
|
283
239
|
//内部状态变化
|
|
284
|
-
|
|
285
|
-
setCheckKeys(
|
|
286
|
-
|
|
287
|
-
return k === currItem[outputKey];
|
|
288
|
-
});
|
|
240
|
+
const internalChange = currItem => {
|
|
241
|
+
setCheckKeys(prev => {
|
|
242
|
+
const idx = prev.findIndex(k => k === currItem[outputKey]);
|
|
289
243
|
if (idx > -1) prev.splice(idx, 1);
|
|
290
|
-
return
|
|
244
|
+
return [...prev];
|
|
291
245
|
});
|
|
292
246
|
};
|
|
293
247
|
//删除当前选中项
|
|
294
|
-
|
|
248
|
+
const handleRemoveTagClick = (evt, currItem) => {
|
|
295
249
|
evt.stopPropagation();
|
|
296
250
|
if (currItem.closable === false) return; //tag 不可关闭
|
|
297
251
|
if ((onTagRemove === null || onTagRemove === void 0 ? void 0 : onTagRemove(currItem)) === false) return; //返回false不删除
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return _[outputKey] === currItem[outputKey];
|
|
301
|
-
});
|
|
252
|
+
const newCheckList = [...checkList];
|
|
253
|
+
const idx = newCheckList.findIndex(_ => _[outputKey] === currItem[outputKey]);
|
|
302
254
|
if (idx > -1) newCheckList.splice(idx, 1);
|
|
303
255
|
setCheckList(newCheckList);
|
|
304
256
|
internalChange(currItem);
|
|
@@ -307,28 +259,16 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
307
259
|
/**
|
|
308
260
|
* @desc 搜索 - 防抖
|
|
309
261
|
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
314
|
-
while (1) switch (_context.prev = _context.next) {
|
|
315
|
-
case 0:
|
|
316
|
-
searchFn(val);
|
|
317
|
-
case 1:
|
|
318
|
-
case "end":
|
|
319
|
-
return _context.stop();
|
|
320
|
-
}
|
|
321
|
-
}, _callee);
|
|
322
|
-
}));
|
|
323
|
-
}, 400);
|
|
324
|
-
}, []);
|
|
262
|
+
const onRealTimeSearch = useMemo(() => debounce(val => __awaiter(void 0, void 0, void 0, function* () {
|
|
263
|
+
searchFn(val);
|
|
264
|
+
}), 400), []);
|
|
325
265
|
//输入框
|
|
326
|
-
|
|
266
|
+
const handleInputChange = value => {
|
|
327
267
|
setInputValue(value);
|
|
328
268
|
realTimeSearch && onRealTimeSearch(value);
|
|
329
269
|
};
|
|
330
|
-
|
|
331
|
-
|
|
270
|
+
const searchFn = value => {
|
|
271
|
+
const input = value !== null && value !== void 0 ? value : inputValue;
|
|
332
272
|
if (!onSearch) {
|
|
333
273
|
searchKeyRef.current = input === null || input === void 0 ? void 0 : input.trim();
|
|
334
274
|
setInRefresh(Math.random());
|
|
@@ -338,7 +278,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
338
278
|
if (isRemoteLoadRef.current) setLoadKeys([]);
|
|
339
279
|
};
|
|
340
280
|
//popover 完成
|
|
341
|
-
|
|
281
|
+
const handlePopoverDone = (evt, flag) => {
|
|
342
282
|
if (flag) {
|
|
343
283
|
onOk === null || onOk === void 0 ? void 0 : onOk(checkList);
|
|
344
284
|
handlePopoverClose(null, 'ok');
|
|
@@ -348,11 +288,11 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
348
288
|
}
|
|
349
289
|
};
|
|
350
290
|
//设置容器宽高
|
|
351
|
-
|
|
352
|
-
|
|
291
|
+
const setPopoverWH = () => {
|
|
292
|
+
let w = 'auto';
|
|
353
293
|
if (selectRef.current) w = "".concat(selectRef.current.offsetWidth, "px");
|
|
354
|
-
|
|
355
|
-
|
|
294
|
+
const overlayStyle = getOverlaySize(mode, isRemoteLoadRef.current, maxHeight, height);
|
|
295
|
+
const wObj = {
|
|
356
296
|
minWidth: w,
|
|
357
297
|
maxWidth: 960
|
|
358
298
|
};
|
|
@@ -366,23 +306,27 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
366
306
|
}, wObj), overlayStyle);
|
|
367
307
|
};
|
|
368
308
|
//select className
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
309
|
+
const makeSelectCls = () => {
|
|
310
|
+
return clsx("".concat($prefixCls, "-comboselect"), className, {
|
|
311
|
+
["".concat($prefixCls, "-comboselect-focused")]: open && !disablePopup,
|
|
312
|
+
["".concat($prefixCls, "-comboselect-disabled")]: disabled,
|
|
313
|
+
["".concat($prefixCls, "-comboselect-radioable")]: !checkable,
|
|
314
|
+
["".concat($prefixCls, "-comboselect-error")]: error,
|
|
315
|
+
["".concat($prefixCls, "-comboselect-clear")]: hasAllClear,
|
|
316
|
+
["".concat($prefixCls, "-comboselect-non-popup")]: disablePopup
|
|
317
|
+
}, "".concat($prefixCls, "-comboselect-").concat(size));
|
|
372
318
|
};
|
|
373
319
|
//格式化选中数据
|
|
374
|
-
|
|
320
|
+
const formatSelectedData = (values, keys) => {
|
|
375
321
|
var _a;
|
|
376
|
-
|
|
322
|
+
let opts = [];
|
|
377
323
|
if (values === null || values === void 0 ? void 0 : values.length) {
|
|
378
|
-
opts = values.map(
|
|
324
|
+
opts = values.map(item => {
|
|
379
325
|
var _a;
|
|
380
|
-
|
|
326
|
+
const temp = {};
|
|
381
327
|
temp[outputKey] = item[fieldKey] || '';
|
|
382
328
|
if (getOptionLabel) temp[outputTitle] = getOptionLabel(item) || '';else temp[outputTitle] = item[fieldTitle] || '';
|
|
383
|
-
|
|
384
|
-
return v[outputKey] === temp[outputKey];
|
|
385
|
-
});
|
|
329
|
+
const oValue = (_a = originValueRef.current) === null || _a === void 0 ? void 0 : _a.find(v => v[outputKey] === temp[outputKey]);
|
|
386
330
|
if (oValue) {
|
|
387
331
|
if (oValue.disabled !== undefined) {
|
|
388
332
|
temp.disabled = oValue.disabled;
|
|
@@ -395,48 +339,40 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
395
339
|
});
|
|
396
340
|
}
|
|
397
341
|
if ((keys === null || keys === void 0 ? void 0 : keys.length) && values) {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
return v[fieldKey] === k;
|
|
402
|
-
}) === -1;
|
|
403
|
-
});
|
|
404
|
-
var diffValue = (_a = originValueRef.current) === null || _a === void 0 ? void 0 : _a.filter(function (v) {
|
|
405
|
-
return fKeys === null || fKeys === void 0 ? void 0 : fKeys.includes(v[outputKey]);
|
|
406
|
-
});
|
|
407
|
-
if (diffValue) (_opts = opts).push.apply(_opts, _toConsumableArray(diffValue));
|
|
342
|
+
const fKeys = keys.filter(k => values.findIndex(v => v[fieldKey] === k) === -1);
|
|
343
|
+
const diffValue = (_a = originValueRef.current) === null || _a === void 0 ? void 0 : _a.filter(v => fKeys === null || fKeys === void 0 ? void 0 : fKeys.includes(v[outputKey]));
|
|
344
|
+
if (diffValue) opts.push(...diffValue);
|
|
408
345
|
}
|
|
409
346
|
setCheckList(opts);
|
|
410
|
-
|
|
347
|
+
const vals = DeepClone(values || []);
|
|
411
348
|
if (!checkable)
|
|
412
349
|
//单选
|
|
413
350
|
onChange === null || onChange === void 0 ? void 0 : onChange(opts[0], vals[0]);else onChange === null || onChange === void 0 ? void 0 : onChange(opts, vals);
|
|
414
351
|
};
|
|
415
352
|
//外部数据转换为内部状态
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
return _[outputKey];
|
|
419
|
-
});
|
|
353
|
+
const transformToState = options => {
|
|
354
|
+
const keys = options.map(_ => _[outputKey]);
|
|
420
355
|
setCheckList(options);
|
|
421
356
|
setCheckKeys(keys);
|
|
422
357
|
originValueRef.current = options;
|
|
423
358
|
};
|
|
424
359
|
//tree select
|
|
425
|
-
|
|
360
|
+
const handleSelect = (selectedKeys, info) => {
|
|
426
361
|
setFullPath(info.node);
|
|
427
362
|
};
|
|
428
363
|
//渲染搜索
|
|
429
|
-
|
|
430
|
-
|
|
364
|
+
const renderSearch = () => {
|
|
365
|
+
let styObj = {};
|
|
431
366
|
if (!disablePopup) {
|
|
432
|
-
|
|
433
|
-
width
|
|
434
|
-
minWidth
|
|
435
|
-
maxWidth
|
|
367
|
+
const {
|
|
368
|
+
width,
|
|
369
|
+
minWidth,
|
|
370
|
+
maxWidth
|
|
371
|
+
} = setPopoverWH();
|
|
436
372
|
styObj = {
|
|
437
|
-
width
|
|
438
|
-
minWidth
|
|
439
|
-
maxWidth
|
|
373
|
+
width,
|
|
374
|
+
minWidth,
|
|
375
|
+
maxWidth
|
|
440
376
|
};
|
|
441
377
|
}
|
|
442
378
|
return jsx("div", Object.assign({
|
|
@@ -455,20 +391,20 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
455
391
|
placeholder: searchPlaceholder !== null && searchPlaceholder !== void 0 ? searchPlaceholder : intl({
|
|
456
392
|
id: 'searchPlaceholder'
|
|
457
393
|
}),
|
|
458
|
-
onClickBtn:
|
|
394
|
+
onClickBtn: () => {
|
|
459
395
|
searchFn();
|
|
460
396
|
},
|
|
461
|
-
onEnter:
|
|
397
|
+
onEnter: () => {
|
|
462
398
|
searchFn();
|
|
463
399
|
},
|
|
464
|
-
onClear:
|
|
400
|
+
onClear: () => {
|
|
465
401
|
searchFn('');
|
|
466
402
|
}
|
|
467
403
|
})
|
|
468
404
|
}));
|
|
469
405
|
};
|
|
470
406
|
//render popover action
|
|
471
|
-
|
|
407
|
+
const renderActions = () => {
|
|
472
408
|
if (popoverActions) return jsx("div", Object.assign({
|
|
473
409
|
className: 'comboselect-actions'
|
|
474
410
|
}, {
|
|
@@ -478,9 +414,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
478
414
|
className: 'comboselect-actions'
|
|
479
415
|
}, {
|
|
480
416
|
children: [jsx(Button, Object.assign({
|
|
481
|
-
onClick:
|
|
482
|
-
return handlePopoverDone(evt, false);
|
|
483
|
-
},
|
|
417
|
+
onClick: evt => handlePopoverDone(evt, false),
|
|
484
418
|
variant: "outlined",
|
|
485
419
|
size: 'small'
|
|
486
420
|
}, {
|
|
@@ -489,9 +423,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
489
423
|
})
|
|
490
424
|
})), jsx(Button, Object.assign({
|
|
491
425
|
variant: "outlined",
|
|
492
|
-
onClick:
|
|
493
|
-
return handlePopoverDone(evt, true);
|
|
494
|
-
},
|
|
426
|
+
onClick: evt => handlePopoverDone(evt, true),
|
|
495
427
|
size: 'small'
|
|
496
428
|
}, {
|
|
497
429
|
children: intl({
|
|
@@ -501,7 +433,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
501
433
|
}));
|
|
502
434
|
};
|
|
503
435
|
//渲染完整路径
|
|
504
|
-
|
|
436
|
+
const renderFullPath = () => {
|
|
505
437
|
var _a;
|
|
506
438
|
if (mode !== 'tree' || !fullPath) return null;
|
|
507
439
|
if (fullPathRender) {
|
|
@@ -522,7 +454,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
522
454
|
}));
|
|
523
455
|
};
|
|
524
456
|
//全部清空
|
|
525
|
-
|
|
457
|
+
const handleAllClear = evt => {
|
|
526
458
|
evt.stopPropagation();
|
|
527
459
|
clearSelectorData();
|
|
528
460
|
handlePopoverClose();
|
|
@@ -531,86 +463,85 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
531
463
|
onChange === null || onChange === void 0 ? void 0 : onChange(checkable ? [] : {});
|
|
532
464
|
};
|
|
533
465
|
//显示更多
|
|
534
|
-
|
|
466
|
+
const handleOpenMore = e => {
|
|
535
467
|
e.stopPropagation();
|
|
536
468
|
setOpenMore(true);
|
|
537
469
|
handlePopoverClose();
|
|
538
470
|
};
|
|
539
471
|
//暴露给外部的行为
|
|
540
|
-
useImperativeHandle(action,
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
});
|
|
547
|
-
useEffect(function () {
|
|
472
|
+
useImperativeHandle(action, () => ({
|
|
473
|
+
closePopup: () => handlePopoverClose()
|
|
474
|
+
}));
|
|
475
|
+
useEffect(() => {
|
|
548
476
|
if (!disablePopup && defaultOpen) {
|
|
549
477
|
//默认打开
|
|
550
478
|
hasPopup.current = true;
|
|
551
479
|
setOpen(defaultOpen);
|
|
552
480
|
}
|
|
553
481
|
}, [defaultOpen]);
|
|
554
|
-
useEffect(
|
|
482
|
+
useEffect(() => {
|
|
555
483
|
if (defaultValue) {
|
|
556
484
|
//默认值
|
|
557
485
|
transformToState(toArray(defaultValue));
|
|
558
486
|
}
|
|
559
487
|
}, []);
|
|
560
|
-
useEffect(
|
|
488
|
+
useEffect(() => {
|
|
561
489
|
if (value) {
|
|
562
490
|
//受控values
|
|
563
491
|
transformToState(toArray(value));
|
|
564
492
|
}
|
|
565
493
|
}, [value]);
|
|
566
494
|
//是否显示清除图标
|
|
567
|
-
useEffect(
|
|
495
|
+
useEffect(() => {
|
|
568
496
|
if (allowClear) setHasAllClear(!!(checkList === null || checkList === void 0 ? void 0 : checkList.length));
|
|
569
497
|
}, [checkList]);
|
|
570
|
-
useEffect(
|
|
571
|
-
|
|
498
|
+
useEffect(() => {
|
|
499
|
+
const ownerDocument = node => {
|
|
572
500
|
return node && node.ownerDocument || document;
|
|
573
501
|
};
|
|
574
|
-
|
|
502
|
+
const handleMouseDown = evt => {
|
|
575
503
|
var _a, _b;
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
504
|
+
const doc = ownerDocument(selectRef.current);
|
|
505
|
+
const target = evt.target;
|
|
506
|
+
const insideDOM = !doc.documentElement.contains(target) || ((_a = popUpNodeRef.current) === null || _a === void 0 ? void 0 : _a.contains(target)) || ((_b = selectRef.current) === null || _b === void 0 ? void 0 : _b.contains(target)) || false;
|
|
579
507
|
if (mode === 'table') {
|
|
580
508
|
//表格模式时,显示点击popover时阻止 关闭弹框
|
|
581
509
|
//表格分页popover
|
|
582
|
-
|
|
510
|
+
const tablePageSelectCls = ".".concat($prefixCls, "-select-popover");
|
|
583
511
|
//表格显示列popover
|
|
584
|
-
|
|
512
|
+
const tableColumCls = ".".concat($prefixCls, "-table-show-colums-popover");
|
|
585
513
|
//表格过滤popover
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
514
|
+
const tableFilterCls = ".".concat($prefixCls, "-filter-popover");
|
|
515
|
+
// 检测元素是否在指定的DOM内
|
|
516
|
+
const bol = closest(target, "".concat(tablePageSelectCls, ", ").concat(tableColumCls, ", ").concat(tableFilterCls));
|
|
517
|
+
if (bol) return;
|
|
518
|
+
// const tablePageSelectDom = document.querySelector(tablePageSelectCls);
|
|
519
|
+
// const tableColumn = document.querySelector(tableColumCls);
|
|
520
|
+
// const tableFilter = document.querySelector(tableFilterCls);
|
|
521
|
+
// if (tablePageSelectDom && tablePageSelectDom.contains(target)) return;
|
|
522
|
+
// if (tableColumn && tableColumn.contains(target)) return;
|
|
523
|
+
// if (tableFilter && tableFilter.contains(target)) return;
|
|
593
524
|
}
|
|
594
525
|
if (hasPopup.current && !insideDOM) {
|
|
595
526
|
handlePopoverClose();
|
|
596
527
|
}
|
|
597
528
|
};
|
|
598
529
|
if (open) {
|
|
599
|
-
setTimeout(
|
|
530
|
+
setTimeout(() => {
|
|
600
531
|
var _a;
|
|
601
532
|
(_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
602
533
|
}, 200);
|
|
603
534
|
}
|
|
604
535
|
if (!disablePopup && open) {
|
|
605
|
-
|
|
536
|
+
const doc = ownerDocument(selectRef.current);
|
|
606
537
|
doc.addEventListener('mousedown', handleMouseDown);
|
|
607
|
-
return
|
|
538
|
+
return () => {
|
|
608
539
|
doc.removeEventListener('mousedown', handleMouseDown);
|
|
609
540
|
};
|
|
610
541
|
}
|
|
611
542
|
}, [open]);
|
|
612
543
|
//tag memo
|
|
613
|
-
|
|
544
|
+
const tagMemo = useMemo(() => {
|
|
614
545
|
var _a;
|
|
615
546
|
if (!(checkList === null || checkList === void 0 ? void 0 : checkList.length)) return null;
|
|
616
547
|
// 自定义渲染输入框内容
|
|
@@ -629,8 +560,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
629
560
|
})
|
|
630
561
|
}));
|
|
631
562
|
}
|
|
632
|
-
|
|
633
|
-
|
|
563
|
+
let realShowList = [...checkList]; //实际显示
|
|
564
|
+
let overList = [];
|
|
634
565
|
if (maxCount) {
|
|
635
566
|
if (checkList.length > maxCount) {
|
|
636
567
|
overList = checkList.slice(maxCount); //超出
|
|
@@ -642,7 +573,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
642
573
|
}
|
|
643
574
|
}
|
|
644
575
|
//超出tag渲染
|
|
645
|
-
|
|
576
|
+
const renderOverTag = () => {
|
|
646
577
|
return (overList === null || overList === void 0 ? void 0 : overList.length) ? jsx("div", Object.assign({
|
|
647
578
|
className: 'comboselect-overflow-item'
|
|
648
579
|
}, {
|
|
@@ -659,18 +590,18 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
659
590
|
})) : null;
|
|
660
591
|
};
|
|
661
592
|
//渲染tag item
|
|
662
|
-
|
|
593
|
+
const renderTagItem = item => {
|
|
663
594
|
if (tagRender) return tagRender(item);
|
|
664
|
-
|
|
665
|
-
disabled
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
595
|
+
const {
|
|
596
|
+
disabled,
|
|
597
|
+
closable = true
|
|
598
|
+
} = item !== null && item !== void 0 ? item : {};
|
|
599
|
+
let displayLabel = item[outputTitle];
|
|
600
|
+
let isOverflow = false;
|
|
670
601
|
//限制tag文本长度
|
|
671
602
|
if (typeof maxTagTextLength === 'number') {
|
|
672
603
|
if (typeof displayLabel === 'string' || typeof displayLabel === 'number') {
|
|
673
|
-
|
|
604
|
+
const strLabel = String(displayLabel);
|
|
674
605
|
if (strLabel.length > maxTagTextLength) {
|
|
675
606
|
displayLabel = "".concat(strLabel.slice(0, maxTagTextLength), "...");
|
|
676
607
|
isOverflow = true;
|
|
@@ -685,9 +616,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
685
616
|
}, {
|
|
686
617
|
children: [isOverflow ? jsx(Tooltip, Object.assign({
|
|
687
618
|
title: jsx("div", Object.assign({
|
|
688
|
-
onClick:
|
|
689
|
-
return e.stopPropagation();
|
|
690
|
-
}
|
|
619
|
+
onClick: e => e.stopPropagation()
|
|
691
620
|
}, {
|
|
692
621
|
children: item[outputTitle]
|
|
693
622
|
})),
|
|
@@ -707,19 +636,15 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
707
636
|
})
|
|
708
637
|
})), closable === true && jsx("span", Object.assign({
|
|
709
638
|
className: 'comboselect-item-remove',
|
|
710
|
-
onClick:
|
|
711
|
-
|
|
712
|
-
},
|
|
713
|
-
onMouseDown: function onMouseDown(e) {
|
|
714
|
-
return e.stopPropagation();
|
|
715
|
-
}
|
|
639
|
+
onClick: evt => handleRemoveTagClick(evt, item),
|
|
640
|
+
onMouseDown: e => e.stopPropagation()
|
|
716
641
|
}, {
|
|
717
642
|
children: jsx(CloseIcon, {})
|
|
718
643
|
}))]
|
|
719
644
|
}));
|
|
720
645
|
};
|
|
721
646
|
return jsxs(Fragment, {
|
|
722
|
-
children: [realShowList.map(
|
|
647
|
+
children: [realShowList.map((item, idx) => {
|
|
723
648
|
return jsx("div", Object.assign({
|
|
724
649
|
className: 'comboselect-overflow-item'
|
|
725
650
|
}, {
|
|
@@ -729,8 +654,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
729
654
|
});
|
|
730
655
|
}, [checkList, onChange, checkable]);
|
|
731
656
|
//处理参数
|
|
732
|
-
|
|
733
|
-
|
|
657
|
+
const getParams = useMemo(() => {
|
|
658
|
+
let P = params || emptyParamsRef.current;
|
|
734
659
|
if (showSearch && !onSearch && searchKeyRef.current !== undefined) {
|
|
735
660
|
P = Object.assign(Object.assign({}, P), {
|
|
736
661
|
searchKey: searchKeyRef.current
|
|
@@ -739,16 +664,16 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
739
664
|
return (paramsCallback === null || paramsCallback === void 0 ? void 0 : paramsCallback(P)) || P;
|
|
740
665
|
}, [params, inRefresh, refresh, open]);
|
|
741
666
|
//表格组件
|
|
742
|
-
|
|
667
|
+
const tableMemo = useMemo(() => {
|
|
743
668
|
if (!disablePopup && !open || mode !== 'table') return null;
|
|
744
|
-
|
|
745
|
-
url
|
|
746
|
-
ctx
|
|
669
|
+
const reqOpts = {
|
|
670
|
+
url,
|
|
671
|
+
ctx,
|
|
747
672
|
search: getParams,
|
|
748
|
-
method
|
|
673
|
+
method
|
|
749
674
|
};
|
|
750
675
|
//处理table radio
|
|
751
|
-
|
|
676
|
+
const handleTableRadio = (keys, values) => {
|
|
752
677
|
if (!checkable) {
|
|
753
678
|
//单选时关闭下拉框,点击自己不取消
|
|
754
679
|
handlePopoverClose();
|
|
@@ -776,19 +701,19 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
776
701
|
}));
|
|
777
702
|
}, [checkKeys, refresh, params, inRefresh, disablePopup, open, getParams, fieldKey, checkable]);
|
|
778
703
|
//树组件
|
|
779
|
-
|
|
704
|
+
const treeMemo = useMemo(() => {
|
|
780
705
|
if (!disablePopup && !open || !['tree', 'list'].includes(mode)) return null;
|
|
781
|
-
|
|
782
|
-
url
|
|
783
|
-
ctx
|
|
706
|
+
const reqOpts = {
|
|
707
|
+
url,
|
|
708
|
+
ctx,
|
|
784
709
|
params: getParams,
|
|
785
|
-
method
|
|
710
|
+
method
|
|
786
711
|
};
|
|
787
712
|
//处理tree nodes
|
|
788
|
-
|
|
713
|
+
const handleTreeCheck = (checkedKeys, info) => {
|
|
789
714
|
var _a;
|
|
790
715
|
if (!info.checked) {
|
|
791
|
-
|
|
716
|
+
const temp = {};
|
|
792
717
|
temp[outputKey] = info.node[fieldKey] || '';
|
|
793
718
|
temp[outputTitle] = info.node[fieldTitle] || '';
|
|
794
719
|
if ((onTagRemove === null || onTagRemove === void 0 ? void 0 : onTagRemove(temp)) === false) {
|
|
@@ -803,21 +728,21 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
803
728
|
if (checkKeys.includes((_a = info.node) === null || _a === void 0 ? void 0 : _a.key)) return;
|
|
804
729
|
}
|
|
805
730
|
}
|
|
806
|
-
|
|
731
|
+
let nodes = info.checkedNodes;
|
|
807
732
|
if (!checkable) {
|
|
808
733
|
//单选
|
|
809
734
|
if (checkedKeys === null || checkedKeys === void 0 ? void 0 : checkedKeys.length) nodes = [info.node];
|
|
810
735
|
}
|
|
811
736
|
//多选
|
|
812
737
|
if (checkable) {
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
ckeys.forEach(
|
|
738
|
+
const nodesObj = ArrayToObject('key', nodes);
|
|
739
|
+
const ckeys = Array.from(checkValuesRef.current.keys());
|
|
740
|
+
ckeys.forEach(k => {
|
|
816
741
|
if (!checkedKeys.includes(k)) {
|
|
817
742
|
checkValuesRef.current.delete(k);
|
|
818
743
|
}
|
|
819
744
|
});
|
|
820
|
-
checkedKeys.forEach(
|
|
745
|
+
checkedKeys.forEach(k => {
|
|
821
746
|
if (nodesObj[k]) {
|
|
822
747
|
checkValuesRef.current.set(k, nodesObj[k]);
|
|
823
748
|
}
|
|
@@ -826,7 +751,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
826
751
|
}
|
|
827
752
|
handleChecked(checkedKeys, nodes);
|
|
828
753
|
};
|
|
829
|
-
|
|
754
|
+
const _titleRender = dataNode => {
|
|
830
755
|
if (TreeProps === null || TreeProps === void 0 ? void 0 : TreeProps.titleRender) {
|
|
831
756
|
return TreeProps.titleRender(dataNode);
|
|
832
757
|
}
|
|
@@ -835,7 +760,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
835
760
|
}
|
|
836
761
|
return dataNode.title;
|
|
837
762
|
};
|
|
838
|
-
|
|
763
|
+
const treeCls = clsx('comboselect-tree', {
|
|
839
764
|
'comboselect-list': mode === 'list',
|
|
840
765
|
'comboselect-list-single': mode === 'list' && !checkable
|
|
841
766
|
});
|
|
@@ -863,19 +788,21 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
863
788
|
titleRender: _titleRender,
|
|
864
789
|
refresh: refresh !== null && refresh !== void 0 ? refresh : inRefresh,
|
|
865
790
|
loadingNode: jsxs("div", Object.assign({
|
|
866
|
-
className:
|
|
791
|
+
className: "loading-node-content"
|
|
867
792
|
}, {
|
|
868
793
|
children: [jsx("div", Object.assign({
|
|
869
|
-
className:
|
|
794
|
+
className: "loading-icon"
|
|
870
795
|
}, {
|
|
871
796
|
children: jsx(LoadingOutlined, {})
|
|
872
|
-
})),
|
|
797
|
+
})), intl({
|
|
798
|
+
id: 'searching'
|
|
799
|
+
})]
|
|
873
800
|
}))
|
|
874
801
|
}))
|
|
875
802
|
}));
|
|
876
803
|
}, [checkKeys, refresh, params, inRefresh, disablePopup, open, loadedKeys, mode, getParams, checkable]);
|
|
877
804
|
//组合选择器输入框
|
|
878
|
-
|
|
805
|
+
const comboSelectorInput = jsxs("div", Object.assign({
|
|
879
806
|
className: 'comboselect-wrapper',
|
|
880
807
|
ref: selectRef,
|
|
881
808
|
onClick: handleSelectorClick
|
|
@@ -902,7 +829,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
902
829
|
}))]
|
|
903
830
|
}));
|
|
904
831
|
//渲染label
|
|
905
|
-
|
|
832
|
+
const renderLabel = () => {
|
|
906
833
|
if (label || required) {
|
|
907
834
|
return jsx(Label, Object.assign({
|
|
908
835
|
label: label,
|
|
@@ -912,7 +839,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
912
839
|
return null;
|
|
913
840
|
};
|
|
914
841
|
//非popover 模式
|
|
915
|
-
|
|
842
|
+
const nonPopoverMemo = useMemo(() => {
|
|
916
843
|
return jsxs(Fragment, {
|
|
917
844
|
children: [comboSelectorInput, jsxs("div", Object.assign({
|
|
918
845
|
className: 'comboselect-non-popup-content'
|
|
@@ -922,7 +849,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
922
849
|
});
|
|
923
850
|
}, [checkKeys, inputValue, refresh, params, fullPath, hasAllClear, helperText, language, locale, onChange, onClear]);
|
|
924
851
|
//popover 浮层
|
|
925
|
-
|
|
852
|
+
const renderOverlay = () => {
|
|
926
853
|
return jsx("div", Object.assign({
|
|
927
854
|
ref: popUpNodeRef,
|
|
928
855
|
className: 'comboselect-dropdown-wrapper'
|
|
@@ -936,10 +863,10 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
936
863
|
}));
|
|
937
864
|
};
|
|
938
865
|
//popover 渲染更多节点
|
|
939
|
-
|
|
940
|
-
|
|
866
|
+
const renderPopoverMore = () => {
|
|
867
|
+
const generateMoreTag = () => {
|
|
941
868
|
if (!(moreTagList === null || moreTagList === void 0 ? void 0 : moreTagList.length)) return null;
|
|
942
|
-
return moreTagList.map(
|
|
869
|
+
return moreTagList.map((item, idx) => {
|
|
943
870
|
return jsxs("div", Object.assign({
|
|
944
871
|
className: "comboselect-more-item"
|
|
945
872
|
}, {
|
|
@@ -951,9 +878,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
951
878
|
})
|
|
952
879
|
})), jsx("span", Object.assign({
|
|
953
880
|
className: 'comboselect-more-item-remove',
|
|
954
|
-
onClick:
|
|
955
|
-
return handleRemoveTagClick(e, item);
|
|
956
|
-
}
|
|
881
|
+
onClick: e => handleRemoveTagClick(e, item)
|
|
957
882
|
}, {
|
|
958
883
|
children: jsx(CloseIcon, {})
|
|
959
884
|
}))]
|
|
@@ -979,7 +904,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
979
904
|
}));
|
|
980
905
|
};
|
|
981
906
|
//popover 模式
|
|
982
|
-
|
|
907
|
+
const popoverMemo = useMemo(() => {
|
|
983
908
|
return jsx(Dropdown, Object.assign({
|
|
984
909
|
overlay: renderOverlay(),
|
|
985
910
|
visible: open,
|
|
@@ -993,9 +918,7 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
993
918
|
destroyTooltipOnHide: true,
|
|
994
919
|
placement: "rightTop",
|
|
995
920
|
content: renderPopoverMore(),
|
|
996
|
-
onVisibleChange:
|
|
997
|
-
return setOpenMore(false);
|
|
998
|
-
},
|
|
921
|
+
onVisibleChange: () => setOpenMore(false),
|
|
999
922
|
overlayClassName: "".concat($prefixCls, "-comboselect-more-popover")
|
|
1000
923
|
}, {
|
|
1001
924
|
children: comboSelectorInput
|