@para-ui/core 3.0.28 → 3.0.30
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 +48 -88
- package/AutoTips/index.js +25 -32
- package/Breadcrumbs/index.js +43 -63
- package/Button/SplitButton.d.ts +1 -1
- package/Button/index.d.ts +1 -1
- package/Button/index.js +88 -118
- package/ButtonGroup/index.js +27 -36
- package/Carousel/index.d.ts +2 -2
- package/Carousel/index.js +27 -28
- package/Cascader/index.js +52 -64
- package/Checkbox/index.js +23 -39
- package/CheckboxGroup/index.js +31 -48
- package/Collapse/collapsePanel.d.ts +1 -1
- package/Collapse/index.d.ts +1 -1
- package/Collapse/index.js +9 -29
- package/Collapse/util.d.ts +2 -2
- package/CollapseBox/index.js +45 -56
- package/CollapseLayout/index.js +35 -54
- package/ComboSelect/index.js +222 -349
- package/ComboSelect/interface.d.ts +3 -3
- package/Container/index.js +17 -20
- package/DatePicker/generatePicker/index.d.ts +17 -17
- package/DatePicker/index.d.ts +4 -4
- package/DatePicker/index.js +111 -167
- package/Desktop/index.js +62 -173
- package/Drawer/index.js +65 -58
- package/Drawer/interface.d.ts +7 -3
- package/Dropdown/index.d.ts +1 -1
- package/Dropdown/index.js +3 -3
- package/Empty/index.js +17 -22
- package/Form/index.d.ts +1 -1
- package/Form/index.js +38 -80
- package/FormItem/index.d.ts +1 -1
- package/FormItem/index.js +11 -11
- package/FormItem/validateFunction.d.ts +1 -1
- package/FunctionModal/index.js +11 -11
- package/GlobalContext/index.js +3 -3
- package/GlobalContext/usePopupContainer.d.ts +1 -1
- package/Help/index.js +11 -11
- package/HelperText/index.js +11 -12
- package/InputLang/index.js +47 -80
- package/InputNumber/index.js +65 -100
- package/Label/index.js +15 -16
- package/Loading/index.js +6 -7
- package/Menu/index.js +148 -328
- package/Menu/interface.d.ts +2 -2
- package/Menu/verticalMenuList.d.ts +1 -1
- package/Message/index.d.ts +1 -1
- package/Message/index.js +45 -64
- package/Modal/Confirm/index.d.ts +2 -2
- package/Modal/index.d.ts +1 -1
- package/Modal/index.js +119 -152
- package/MultiBox/index.js +44 -76
- package/Notification/index.d.ts +2 -2
- package/Notification/index.js +51 -72
- package/OperateBtn/index.js +42 -70
- package/PageHeader/index.js +120 -286
- package/PageHeader/interface.d.ts +1 -1
- package/Pagination/index.d.ts +2 -2
- package/Pagination/index.js +79 -131
- package/ParauiProvider/index.js +2 -3
- package/PasswordRules/index.js +12 -30
- package/PopConfirm/index.d.ts +1 -1
- package/PopConfirm/index.js +52 -59
- package/Popover/index.js +8 -9
- package/Progress/index.d.ts +6 -6
- package/Progress/index.js +50 -89
- package/Querying/index.js +14 -17
- package/README.md +813 -800
- package/Radio/index.js +21 -33
- package/RadioGroup/index.js +32 -47
- package/Search/index.js +44 -66
- package/Select/index.js +176 -343
- package/SelectInput/index.js +8 -9
- package/Selector/index.js +285 -681
- package/SelectorPicker/index.js +62 -97
- package/SingleBox/index.js +30 -55
- package/Slider/index.d.ts +1 -1
- package/Slider/index.js +29 -41
- package/Slider/interface.d.ts +2 -2
- package/Split/index.js +10 -23
- package/Status/index.js +8 -7
- package/Stepper/index.d.ts +1 -1
- package/Stepper/index.js +20 -25
- package/Styles/form.scss +5 -5
- package/Styles/index.scss +37 -37
- package/Styles/normalize.scss +348 -348
- package/Styles/scrollbar.scss +223 -223
- package/Styles/theme.scss +74 -74
- package/Switch/index.d.ts +2 -2
- package/Switch/index.js +19 -20
- package/Table/index.js +568 -1019
- package/Table/interface.d.ts +5 -5
- package/Tabs/index.d.ts +3 -3
- package/Tabs/index.js +47 -65
- package/Tag/TagGroup.d.ts +1 -1
- package/Tag/index.d.ts +2 -2
- package/Tag/index.js +72 -107
- package/TextEditor/index.d.ts +2 -2
- package/TextEditor/index.js +81 -105
- package/TextField/index.js +141 -220
- package/TimePicker/index.d.ts +1 -1
- package/TimePicker/index.js +12 -15
- package/Timeline/index.js +42 -52
- package/Title/index.js +10 -9
- package/ToggleButton/ToggleButtonGroup.d.ts +1 -1
- package/ToggleButton/index.js +50 -70
- package/Tooltip/index.js +64 -98
- package/Tooltip/interface.d.ts +1 -1
- package/Transfer/index.d.ts +1 -1
- package/Transfer/index.js +114 -137
- package/Transfer/useClick.d.ts +1 -1
- package/Tree/index.js +10 -10
- package/Tree/interface.d.ts +6 -6
- package/Upload/Dragger/index.d.ts +1 -1
- package/Upload/ImageUpload/index.d.ts +1 -1
- package/Upload/ImgCrop/EasyCrop.d.ts +1 -1
- package/Upload/index.d.ts +1 -1
- package/Upload/index.js +283 -475
- package/Upload/interface.d.ts +2 -2
- package/_verture/{constant-bf34e6fa.js → constant-66aa48a1.js} +0 -1
- package/_verture/defineProperty-62acccfc.js +34 -0
- package/_verture/{index-342379c6.js → index-06fea29b.js} +79 -124
- package/_verture/{index-48875ffd.js → index-131f8fe5.js} +80 -181
- package/_verture/{index-31ce5a11.js → index-92144ad3.js} +238 -445
- package/_verture/{index-bbed73a3.js → index-be4faaee.js} +19 -61
- package/_verture/{intl-336570e4.js → intl-5cbb940c.js} +4 -12
- package/_verture/{modalContext-d646d9db.js → modalContext-c749e1c6.js} +18 -43
- package/_verture/{slicedToArray-d7722f4b.js → slicedToArray-77980792.js} +23 -25
- package/_verture/{toConsumableArray-f8047a75.js → toConsumableArray-87c7d895.js} +1 -1
- package/_verture/{useFormatMessage-f4452258.js → useFormatMessage-703f8b20.js} +1 -3
- package/_verture/{useGlobalProps-af9a2af6.js → useGlobalProps-1b846a65.js} +1 -2
- package/_verture/{usePopupContainer-b8ab7cab.js → usePopupContainer-87febeb9.js} +10 -25
- package/_verture/{util-a77b261e.js → util-7e1fb1e2.js} +2 -3
- package/index.d.ts +2 -4
- package/index.js +15 -16
- package/package.json +167 -168
- package/Test/index.d.ts +0 -3
- package/Test/index.js +0 -9
- package/_verture/defineProperty-0590dc61.js +0 -16
package/ComboSelect/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-
|
|
2
|
-
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-
|
|
3
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-
|
|
1
|
+
import { _ as _defineProperty } from '../_verture/defineProperty-62acccfc.js';
|
|
2
|
+
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-87c7d895.js';
|
|
3
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-77980792.js';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import React__default, { useRef, useState, useImperativeHandle, useEffect, useMemo } from 'react';
|
|
6
6
|
import Down from '@para-ui/icons/Down';
|
|
@@ -8,22 +8,22 @@ import SearchIcon from '@para-ui/icons/Search';
|
|
|
8
8
|
import CloseIcon from '@para-ui/icons/Close';
|
|
9
9
|
import CloseCircle from '@para-ui/icons/CloseCircle';
|
|
10
10
|
import Table from '../Table/index.js';
|
|
11
|
-
import { T as Tree } from '../_verture/index-
|
|
11
|
+
import { T as Tree } from '../_verture/index-92144ad3.js';
|
|
12
12
|
import { Button } from '../Button/index.js';
|
|
13
|
-
import { D as Dropdown } from '../_verture/index-
|
|
13
|
+
import { D as Dropdown } from '../_verture/index-be4faaee.js';
|
|
14
14
|
import { Popover } from '../Popover/index.js';
|
|
15
15
|
import AutoTips from '../AutoTips/index.js';
|
|
16
16
|
import { Tooltip } from '../Tooltip/index.js';
|
|
17
17
|
import clsx from 'clsx';
|
|
18
18
|
import { DeepClone, ArrayToObject } from '@paraview/lib';
|
|
19
19
|
import GlobalContext from '@para-ui/core/GlobalContext';
|
|
20
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
20
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-703f8b20.js';
|
|
21
21
|
import Label from '../Label/index.js';
|
|
22
22
|
import HelperText from '../HelperText/index.js';
|
|
23
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
23
|
+
import { $ as $prefixCls } from '../_verture/constant-66aa48a1.js';
|
|
24
24
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
25
25
|
import '../_verture/typeof-498dd2b1.js';
|
|
26
|
-
import '../_verture/index-
|
|
26
|
+
import '../_verture/index-06fea29b.js';
|
|
27
27
|
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
28
28
|
import '../Checkbox/index.js';
|
|
29
29
|
import '../Help/index.js';
|
|
@@ -36,7 +36,7 @@ import '@para-ui/icons/DownTriangleF';
|
|
|
36
36
|
import '@para-ui/icons/Panel';
|
|
37
37
|
import '../Radio/index.js';
|
|
38
38
|
import '../Empty/index.js';
|
|
39
|
-
import '../_verture/useGlobalProps-
|
|
39
|
+
import '../_verture/useGlobalProps-1b846a65.js';
|
|
40
40
|
import '../OperateBtn/index.js';
|
|
41
41
|
import '@para-ui/icons/More';
|
|
42
42
|
import '../Pagination/index.js';
|
|
@@ -61,7 +61,7 @@ import '@para-ui/icons/Delete';
|
|
|
61
61
|
import '@para-ui/icons/Forbid';
|
|
62
62
|
import '@para-ui/icons/MoreCircle';
|
|
63
63
|
import 'rc-dropdown';
|
|
64
|
-
import '../_verture/usePopupContainer-
|
|
64
|
+
import '../_verture/usePopupContainer-87febeb9.js';
|
|
65
65
|
import 'dayjs';
|
|
66
66
|
|
|
67
67
|
//获取替换字段
|
|
@@ -69,8 +69,8 @@ var getReplaceField = function getReplaceField(mode, repl, tableP, treeP) {
|
|
|
69
69
|
var t = {};
|
|
70
70
|
if (mode === 'tree') t = treeP === null || treeP === void 0 ? void 0 : treeP.replaceFields;else t = tableP === null || tableP === void 0 ? void 0 : tableP.replaceFields;
|
|
71
71
|
return Object.assign(Object.assign({}, repl), t);
|
|
72
|
-
};
|
|
73
|
-
|
|
72
|
+
};
|
|
73
|
+
//to array
|
|
74
74
|
var toArray = function toArray(list) {
|
|
75
75
|
if (!list) return [];
|
|
76
76
|
return Array.isArray(list) ? list : JSON.stringify(list) === '{}' ? [] : [list];
|
|
@@ -79,25 +79,21 @@ var isRemoteLoad = function isRemoteLoad(mode, props) {
|
|
|
79
79
|
if (mode === 'table') {
|
|
80
80
|
return !(props && Array.isArray(props.data));
|
|
81
81
|
}
|
|
82
|
-
|
|
83
82
|
return !(props && Array.isArray(props.treeData));
|
|
84
83
|
};
|
|
85
84
|
var getOverlaySize = function getOverlaySize(mode) {
|
|
86
85
|
var isRemoteLoad = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
87
86
|
var maxHeight = arguments.length > 2 ? arguments[2] : undefined;
|
|
88
87
|
var height = arguments.length > 3 ? arguments[3] : undefined;
|
|
89
|
-
|
|
90
88
|
var _a;
|
|
91
|
-
|
|
92
89
|
var screenH = 720;
|
|
93
90
|
var treeOverlay = "".concat(maxHeight || 254, "px");
|
|
94
|
-
var listOverlay = "".concat(maxHeight || 232, "px");
|
|
95
|
-
|
|
91
|
+
var listOverlay = "".concat(maxHeight || 232, "px");
|
|
92
|
+
// let largeScreenH = 880;
|
|
96
93
|
var largeTreeOverlayH = "".concat(maxHeight || 338, "px");
|
|
97
94
|
var largeListOverlayH = "".concat(maxHeight || 304, "px");
|
|
98
95
|
var clientH = document.documentElement.clientHeight;
|
|
99
96
|
var fixHeight = height !== undefined ? 'height' : 'maxHeight';
|
|
100
|
-
|
|
101
97
|
if (mode === 'tree') {
|
|
102
98
|
//tree
|
|
103
99
|
if (clientH <= screenH) {
|
|
@@ -105,9 +101,8 @@ var getOverlaySize = function getOverlaySize(mode) {
|
|
|
105
101
|
return isRemoteLoad ? {
|
|
106
102
|
height: treeOverlay
|
|
107
103
|
} : _defineProperty({}, fixHeight, treeOverlay);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
}
|
|
105
|
+
//大屏幕
|
|
111
106
|
return isRemoteLoad ? {
|
|
112
107
|
height: largeTreeOverlayH
|
|
113
108
|
} : _defineProperty({}, fixHeight, largeTreeOverlayH);
|
|
@@ -118,7 +113,6 @@ var getOverlaySize = function getOverlaySize(mode) {
|
|
|
118
113
|
height: listOverlay
|
|
119
114
|
} : _defineProperty({}, fixHeight, listOverlay);
|
|
120
115
|
}
|
|
121
|
-
|
|
122
116
|
return isRemoteLoad ? {
|
|
123
117
|
height: largeListOverlayH
|
|
124
118
|
} : _defineProperty({}, fixHeight, largeListOverlayH);
|
|
@@ -156,200 +150,164 @@ var localeJson = {
|
|
|
156
150
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/18 上午10:16\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-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 rgba(171, 176, 185, 0.4);\n border-radius: 4px;\n background-color: rgb(255, 255, 255);\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v3-comboselect .comboselect-wrapper:hover {\n border-color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-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: rgba(46, 55, 67, 0.4);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-v3-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-v3-comboselect .comboselect-wrapper .comboselect-arrow svg {\n color: rgba(46, 55, 67, 0.7);\n font-size: 20px;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-clear {\n position: absolute;\n top: 9px;\n right: 12px;\n opacity: 0;\n line-height: 0;\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-clear svg {\n color: rgba(46, 55, 67, 0.7);\n font-size: 16px;\n}\n.paraui-v3-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-v3-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-v3-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(46, 55, 67);\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item {\n flex: none;\n max-width: 100%;\n}\n.paraui-v3-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(46, 55, 67);\n line-height: 22px;\n background-color: rgba(171, 176, 185, 0.2);\n border-radius: 4px;\n user-select: none;\n transition: 0.3s;\n cursor: default;\n}\n.paraui-v3-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-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item .comboselect-item-remove {\n display: inline-flex;\n cursor: pointer;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item .comboselect-item-remove svg {\n font-size: 16px;\n color: inherit;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item--disabled {\n color: rgba(46, 55, 67, 0.4);\n background-color: rgba(171, 176, 185, 0.4);\n cursor: not-allowed;\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item--disabled .comboselect-item-remove {\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-comboselect .comboselect-wrapper .comboselect-overflow-item .comboselect-item--unclosable .comboselect-item-content {\n margin-right: 0;\n}\n.paraui-v3-comboselect-focused .comboselect-wrapper {\n border-color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-focused .comboselect-wrapper .comboselect-arrow {\n transform: rotate(180deg);\n color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-disabled {\n cursor: not-allowed;\n}\n.paraui-v3-comboselect-disabled .comboselect-wrapper {\n background-color: rgba(171, 176, 185, 0.12);\n border-color: rgba(171, 176, 185, 0.4);\n pointer-events: none;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper {\n min-height: 36px;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper .comboselect-overflow {\n padding-top: 5px;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper .comboselect-overflow-item .comboselect-item {\n height: 24px;\n margin-bottom: 5px;\n line-height: 24px;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow {\n height: 34px;\n}\n.paraui-v3-comboselect-large .comboselect-wrapper .comboselect-arrow {\n top: 7px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper {\n min-height: 28px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper .comboselect-overflow {\n padding-top: 3px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper .comboselect-overflow-item .comboselect-item {\n height: 20px;\n margin-bottom: 3px;\n line-height: 20px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper .comboselect-overflow-single.comboselect-overflow {\n height: 26px;\n}\n.paraui-v3-comboselect-small .comboselect-wrapper .comboselect-arrow {\n top: 3px;\n}\n.paraui-v3-comboselect-error .comboselect-wrapper {\n border-color: rgb(235, 96, 84);\n}\n.paraui-v3-comboselect-error .comboselect-wrapper:hover {\n border-color: rgb(235, 96, 84);\n}\n.paraui-v3-comboselect-clear .comboselect-wrapper:hover .comboselect-arrow {\n opacity: 0;\n}\n.paraui-v3-comboselect-clear .comboselect-wrapper:hover .comboselect-clear {\n opacity: 1;\n}\n.paraui-v3-comboselect-non-popup {\n border: 1px solid rgba(171, 176, 185, 0.4);\n border-radius: 4px;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v3-comboselect-non-popup .comboselect-wrapper {\n border: none;\n border-bottom: 1px solid rgba(171, 176, 185, 0.4);\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n cursor: default;\n}\n.paraui-v3-comboselect-non-popup .comboselect-wrapper:hover {\n border-color: rgba(171, 176, 185, 0.4);\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content {\n position: relative;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search {\n display: flex;\n align-items: center;\n height: 40px;\n padding: 0 18px;\n border-bottom: 1px solid rgba(171, 176, 185, 0.2);\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-icon {\n line-height: 0;\n cursor: pointer;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-icon svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-input {\n width: 100%;\n height: 100%;\n flex: auto;\n margin: 0 10px 0 10px;\n border: none;\n color: rgb(46, 55, 67);\n font-size: 14px;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search-input::placeholder {\n color: rgba(46, 55, 67, 0.4);\n font-size: 14px;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search .comboselect-clear-icon {\n display: inline-flex;\n cursor: pointer;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search .comboselect-clear-icon svg {\n font-size: 16px;\n color: rgba(46, 55, 67, 0.7);\n transition: all 0.3s;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-search .comboselect-clear-icon svg:hover {\n color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-table {\n padding-bottom: 10px;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-table .paraui-v3-table {\n box-shadow: none;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-tree {\n padding: 6px 7px;\n}\n.paraui-v3-comboselect-non-popup .comboselect-non-popup-content .comboselect-tree .paraui-v3-tree-empty {\n padding: 52px 0 73px 0;\n}\n.paraui-v3-comboselect-dropdown .comboselect-dropdown-wrapper {\n position: relative;\n color: initial;\n overflow: hidden;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search {\n display: flex;\n align-items: center;\n height: 40px;\n padding: 0 18px;\n border-bottom: 1px solid rgba(171, 176, 185, 0.2);\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-icon {\n line-height: 0;\n cursor: pointer;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-icon svg {\n color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input {\n width: 100%;\n flex: auto;\n margin: 0 10px 0 10px;\n border: none;\n color: rgb(46, 55, 67);\n font-size: 14px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search-input::placeholder {\n color: rgba(46, 55, 67, 0.4);\n font-size: 14px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search .comboselect-clear-icon {\n display: inline-flex;\n cursor: pointer;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search .comboselect-clear-icon svg {\n font-size: 16px;\n color: rgba(46, 55, 67, 0.7);\n transition: all 0.3s;\n}\n.paraui-v3-comboselect-dropdown .comboselect-search .comboselect-clear-icon svg:hover {\n color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-comboselect-dropdown .comboselect-table {\n height: 100%;\n padding-bottom: 10px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-table .paraui-v3-table {\n box-shadow: none;\n}\n.paraui-v3-comboselect-dropdown .comboselect-tree {\n height: 100%;\n padding: 6px 7px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-tree .paraui-v3-tree-empty {\n height: 100%;\n padding: 52px 0 73px 0;\n}\n.paraui-v3-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 rgba(171, 176, 185, 0.2);\n}\n.paraui-v3-comboselect-dropdown .comboselect-actions button + button {\n margin-left: 10px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-fullPath {\n height: 34px;\n line-height: 34px;\n padding: 0 12px;\n border-top: 1px solid rgba(171, 176, 185, 0.2);\n font-size: 14px;\n color: rgb(46, 55, 67);\n}\n.paraui-v3-comboselect-dropdown .comboselect-fullPath span {\n display: inline-block;\n height: 100%;\n padding-right: 10px;\n border-right: 1px solid rgba(171, 176, 185, 0.2);\n}\n.paraui-v3-comboselect-dropdown .comboselect-list {\n padding: 8px 0;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-empty {\n padding: 50px 0 72px 0;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode {\n width: 100%;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode .paraui-v3-tree-switcher {\n display: none;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode .paraui-v3-tree-checkbox {\n display: none;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode .paraui-v3-tree-node-content-wrapper {\n width: 100%;\n margin: 0;\n padding: 6px 28px 6px 12px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode .paraui-v3-tree-node-content-wrapper:hover {\n background-color: rgba(171, 176, 185, 0.12);\n border-radius: 0;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode-checkbox-checked .paraui-v3-tree-node-content-wrapper {\n position: relative;\n color: rgb(54, 102, 214);\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode-checkbox-checked .paraui-v3-tree-node-content-wrapper::after {\n position: absolute;\n content: \" \";\n width: 5px;\n height: 10px;\n right: 12px;\n top: 50%;\n transform: translateY(-50%) rotate(45deg);\n border: 2px solid rgb(54, 102, 214);\n border-top: 0;\n border-left: 0;\n border-bottom-right-radius: 2px;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list .paraui-v3-tree-treenode-disabled .paraui-v3-tree-node-content-wrapper:hover {\n background-color: transparent;\n}\n.paraui-v3-comboselect-dropdown .comboselect-list-single .paraui-v3-tree-treenode-checkbox-checked .paraui-v3-tree-node-content-wrapper::after {\n display: none;\n}\n.paraui-v3-comboselect-more-popover {\n padding-left: 12px;\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper {\n width: 300px;\n padding: 12px 0;\n}\n.paraui-v3-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: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-content {\n max-height: 300px;\n padding: 0 12px;\n overflow-y: auto;\n}\n.paraui-v3-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(46, 55, 67);\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-text {\n display: inline-block;\n max-width: calc(100% - 25px);\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-remove {\n display: inline-flex;\n margin-left: auto;\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-remove svg {\n font-size: 20px;\n color: rgb(46, 55, 67);\n cursor: pointer;\n}\n.paraui-v3-comboselect-more-popover .comboselect-more-wrapper .comboselect-more-item-remove svg:hover {\n color: rgb(54, 102, 214);\n}";
|
|
157
151
|
styleInject(css_248z);
|
|
158
152
|
|
|
153
|
+
//组合选择器
|
|
159
154
|
var ComboSelect = function ComboSelect(props) {
|
|
160
155
|
var _props$mode = props.mode,
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
156
|
+
mode = _props$mode === void 0 ? 'table' : _props$mode,
|
|
157
|
+
placeholder = props.placeholder,
|
|
158
|
+
searchPlaceholder = props.searchPlaceholder,
|
|
159
|
+
maxCount = props.maxCount,
|
|
160
|
+
_props$disabled = props.disabled,
|
|
161
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
162
|
+
_props$allowClear = props.allowClear,
|
|
163
|
+
allowClear = _props$allowClear === void 0 ? false : _props$allowClear,
|
|
164
|
+
className = props.className,
|
|
165
|
+
style = props.style,
|
|
166
|
+
maxHeight = props.maxHeight,
|
|
167
|
+
height = props.height,
|
|
168
|
+
_props$placement = props.placement,
|
|
169
|
+
placement = _props$placement === void 0 ? 'bottomLeft' : _props$placement,
|
|
170
|
+
popoverClassName = props.popoverClassName,
|
|
171
|
+
_props$size = props.size,
|
|
172
|
+
size = _props$size === void 0 ? 'large' : _props$size,
|
|
173
|
+
_props$popoverActions = props.popoverActions,
|
|
174
|
+
popoverActions = _props$popoverActions === void 0 ? null : _props$popoverActions,
|
|
175
|
+
_props$showPopoverAct = props.showPopoverActions,
|
|
176
|
+
showPopoverActions = _props$showPopoverAct === void 0 ? false : _props$showPopoverAct,
|
|
177
|
+
_props$defaultOpen = props.defaultOpen,
|
|
178
|
+
defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,
|
|
179
|
+
defaultValue = props.defaultValue,
|
|
180
|
+
_props$replaceFields = props.replaceFields,
|
|
181
|
+
replaceFields = _props$replaceFields === void 0 ? {
|
|
182
|
+
key: 'key',
|
|
183
|
+
title: 'title',
|
|
184
|
+
children: 'children'
|
|
185
|
+
} : _props$replaceFields,
|
|
186
|
+
_props$outputFields = props.outputFields,
|
|
187
|
+
outputFields = _props$outputFields === void 0 ? {
|
|
188
|
+
outputKey: 'key',
|
|
189
|
+
outputTitle: 'label'
|
|
190
|
+
} : _props$outputFields,
|
|
191
|
+
value = props.value,
|
|
192
|
+
onClear = props.onClear,
|
|
193
|
+
onCancel = props.onCancel,
|
|
194
|
+
onOk = props.onOk,
|
|
195
|
+
onClose = props.onClose,
|
|
196
|
+
onChange = props.onChange,
|
|
197
|
+
onSearch = props.onSearch,
|
|
198
|
+
refresh = props.refresh,
|
|
199
|
+
TableProps = props.TableProps,
|
|
200
|
+
TreeProps = props.TreeProps,
|
|
201
|
+
_props$checkable = props.checkable,
|
|
202
|
+
checkable = _props$checkable === void 0 ? true : _props$checkable,
|
|
203
|
+
url = props.url,
|
|
204
|
+
ctx = props.ctx,
|
|
205
|
+
params = props.params,
|
|
206
|
+
_props$method = props.method,
|
|
207
|
+
method = _props$method === void 0 ? 'Get' : _props$method,
|
|
208
|
+
_props$showSearch = props.showSearch,
|
|
209
|
+
showSearch = _props$showSearch === void 0 ? false : _props$showSearch,
|
|
210
|
+
_props$error = props.error,
|
|
211
|
+
error = _props$error === void 0 ? false : _props$error,
|
|
212
|
+
hideErrorDom = props.hideErrorDom,
|
|
213
|
+
helperText = props.helperText,
|
|
214
|
+
paramsCallback = props.paramsCallback,
|
|
215
|
+
fullPathKey = props.fullPathKey,
|
|
216
|
+
fullPathRender = props.fullPathRender,
|
|
217
|
+
_props$disablePopup = props.disablePopup,
|
|
218
|
+
disablePopup = _props$disablePopup === void 0 ? false : _props$disablePopup,
|
|
219
|
+
tagRender = props.tagRender,
|
|
220
|
+
onTagRemove = props.onTagRemove,
|
|
221
|
+
action = props.action,
|
|
222
|
+
_props$label = props.label,
|
|
223
|
+
label = _props$label === void 0 ? '' : _props$label,
|
|
224
|
+
labelTooltip = props.labelTooltip,
|
|
225
|
+
_props$required = props.required,
|
|
226
|
+
required = _props$required === void 0 ? false : _props$required,
|
|
227
|
+
emptyProps = props.emptyProps,
|
|
228
|
+
_props$toggleSelected = props.toggleSelectedOnSingle,
|
|
229
|
+
toggleSelectedOnSingle = _props$toggleSelected === void 0 ? false : _props$toggleSelected,
|
|
230
|
+
optionRender = props.optionRender,
|
|
231
|
+
getOptionLabel = props.getOptionLabel,
|
|
232
|
+
_props$dropdownMatchS = props.dropdownMatchSelectWidth,
|
|
233
|
+
dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,
|
|
234
|
+
getPopupContainer = props.getPopupContainer,
|
|
235
|
+
maxTagTextLength = props.maxTagTextLength;
|
|
242
236
|
var _React$useContext = React__default.useContext(GlobalContext),
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
237
|
+
language = _React$useContext.language,
|
|
238
|
+
locale = _React$useContext.locale;
|
|
246
239
|
var selectRef = useRef();
|
|
247
|
-
|
|
248
240
|
var _useState = useState(false),
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
241
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
242
|
+
open = _useState2[0],
|
|
243
|
+
setOpen = _useState2[1]; //打开popover
|
|
254
244
|
var _useState3 = useState([]),
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
245
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
246
|
+
checkKeys = _useState4[0],
|
|
247
|
+
setCheckKeys = _useState4[1]; //选中key
|
|
260
248
|
var checkValuesRef = useRef(new Map()); //选中value
|
|
261
|
-
|
|
262
249
|
var _useState5 = useState([]),
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
250
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
251
|
+
checkList = _useState6[0],
|
|
252
|
+
setCheckList = _useState6[1]; //tag显示选中项
|
|
268
253
|
var _useState7 = useState(''),
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
254
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
255
|
+
inputValue = _useState8[0],
|
|
256
|
+
setInputValue = _useState8[1]; //input value
|
|
274
257
|
var searchKeyRef = useRef(undefined); //搜索参数
|
|
275
|
-
|
|
276
258
|
var _useState9 = useState(null),
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
259
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
260
|
+
fullPath = _useState10[0],
|
|
261
|
+
setFullPath = _useState10[1]; //路径
|
|
282
262
|
var _useState11 = useState(false),
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
263
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
264
|
+
hasAllClear = _useState12[0],
|
|
265
|
+
setHasAllClear = _useState12[1]; //显示清除按钮
|
|
288
266
|
var _useState13 = useState(0),
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
267
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
268
|
+
inRefresh = _useState14[0],
|
|
269
|
+
setInRefresh = _useState14[1]; //内部刷新组件
|
|
294
270
|
var _useState15 = useState(false),
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
271
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
272
|
+
openMore = _useState16[0],
|
|
273
|
+
setOpenMore = _useState16[1]; //显示更过选中
|
|
300
274
|
var _useState17 = useState([]),
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
275
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
276
|
+
moreTagList = _useState18[0],
|
|
277
|
+
setMoreTagList = _useState18[1]; //更多tag列表
|
|
306
278
|
var originValueRef = useRef([]); // 保存value
|
|
307
|
-
|
|
308
279
|
var hasPopup = useRef(false); //显示弹框标识
|
|
309
|
-
|
|
310
280
|
var popUpNodeRef = useRef(); //popup dom
|
|
311
|
-
|
|
312
281
|
var emptyParamsRef = useRef({}); //空参数常量
|
|
313
|
-
|
|
314
282
|
var searchInputRef = useRef(); //search input
|
|
315
|
-
|
|
316
283
|
var mergedReplaceF = getReplaceField(mode, replaceFields, TableProps, TreeProps); //替换字段
|
|
317
|
-
|
|
318
284
|
var _mergedReplaceF$key = mergedReplaceF.key,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
285
|
+
fieldKey = _mergedReplaceF$key === void 0 ? '' : _mergedReplaceF$key,
|
|
286
|
+
_mergedReplaceF$title = mergedReplaceF.title,
|
|
287
|
+
fieldTitle = _mergedReplaceF$title === void 0 ? '' : _mergedReplaceF$title;
|
|
323
288
|
var _ref = outputFields || {},
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
289
|
+
_ref$outputKey = _ref.outputKey,
|
|
290
|
+
outputKey = _ref$outputKey === void 0 ? 'key' : _ref$outputKey,
|
|
291
|
+
_ref$outputTitle = _ref.outputTitle,
|
|
292
|
+
outputTitle = _ref$outputTitle === void 0 ? 'label' : _ref$outputTitle;
|
|
329
293
|
var intl = useFormatMessage('ComboSelect', localeJson);
|
|
330
294
|
var isRemoteLoadRef = useRef(isRemoteLoad(mode, mode === 'table' ? TableProps : TreeProps)); //是否远程加载数据
|
|
331
|
-
|
|
332
295
|
var _useState19 = useState(),
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
296
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
297
|
+
loadedKeys = _useState20[0],
|
|
298
|
+
setLoadKeys = _useState20[1]; //加载过的key
|
|
336
299
|
//选择框点击
|
|
337
|
-
|
|
338
|
-
|
|
339
300
|
var handleSelectorClick = function handleSelectorClick(event) {
|
|
340
301
|
if (disablePopup) return;
|
|
341
302
|
if (disabled) return;
|
|
342
|
-
|
|
343
303
|
if (hasPopup.current) {
|
|
344
304
|
handlePopoverClose();
|
|
345
305
|
return;
|
|
346
306
|
}
|
|
347
|
-
|
|
348
307
|
hasPopup.current = true;
|
|
349
308
|
setOpen(true);
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
|
|
309
|
+
};
|
|
310
|
+
//关闭popover
|
|
353
311
|
var handlePopoverClose = function handlePopoverClose(event, reason) {
|
|
354
312
|
hasPopup.current = false;
|
|
355
313
|
searchKeyRef.current = undefined;
|
|
@@ -358,26 +316,22 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
358
316
|
setFullPath(null);
|
|
359
317
|
setInputValue('');
|
|
360
318
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
361
|
-
|
|
362
319
|
if (reason === 'cancel') {
|
|
363
320
|
clearSelectorData();
|
|
364
321
|
}
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
|
|
322
|
+
};
|
|
323
|
+
//清空选择器数据
|
|
368
324
|
var clearSelectorData = function clearSelectorData() {
|
|
369
325
|
setCheckKeys([]);
|
|
370
326
|
setCheckList([]);
|
|
371
327
|
setMoreTagList([]);
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
|
|
328
|
+
};
|
|
329
|
+
//处理选中
|
|
375
330
|
var handleChecked = function handleChecked(keys, values) {
|
|
376
331
|
setCheckKeys(keys);
|
|
377
332
|
formatSelectedData(values, keys);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
|
|
333
|
+
};
|
|
334
|
+
//内部状态变化
|
|
381
335
|
var internalChange = function internalChange(currItem) {
|
|
382
336
|
setCheckKeys(function (prev) {
|
|
383
337
|
var idx = prev.findIndex(function (k) {
|
|
@@ -386,17 +340,13 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
386
340
|
if (idx > -1) prev.splice(idx, 1);
|
|
387
341
|
return _toConsumableArray(prev);
|
|
388
342
|
});
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
|
|
343
|
+
};
|
|
344
|
+
//删除当前选中项
|
|
392
345
|
var handleRemoveTagClick = function handleRemoveTagClick(evt, currItem) {
|
|
393
346
|
evt.stopPropagation();
|
|
394
347
|
if (currItem.closable === false) return; //tag 不可关闭
|
|
395
|
-
|
|
396
348
|
if ((onTagRemove === null || onTagRemove === void 0 ? void 0 : onTagRemove(currItem)) === false) return; //返回false不删除
|
|
397
|
-
|
|
398
349
|
var newCheckList = _toConsumableArray(checkList);
|
|
399
|
-
|
|
400
350
|
var idx = newCheckList.findIndex(function (_) {
|
|
401
351
|
return _[outputKey] === currItem[outputKey];
|
|
402
352
|
});
|
|
@@ -404,22 +354,19 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
404
354
|
setCheckList(newCheckList);
|
|
405
355
|
internalChange(currItem);
|
|
406
356
|
onChange === null || onChange === void 0 ? void 0 : onChange(newCheckList);
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
|
|
357
|
+
};
|
|
358
|
+
//输入框
|
|
410
359
|
var handleInputChange = function handleInputChange(evt) {
|
|
411
360
|
setInputValue(evt.target.value);
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
|
|
361
|
+
};
|
|
362
|
+
//清空搜索值,重置搜索
|
|
415
363
|
var handleClearSearchValue = function handleClearSearchValue() {
|
|
416
364
|
setInputValue('');
|
|
417
365
|
if (onSearch) return onSearch('');
|
|
418
366
|
searchKeyRef.current = '';
|
|
419
367
|
setInRefresh(Math.random());
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
|
|
368
|
+
};
|
|
369
|
+
//输入框回车搜索
|
|
423
370
|
var handleEnterSearch = function handleEnterSearch(evt, type) {
|
|
424
371
|
var searchFn = function searchFn() {
|
|
425
372
|
if (!onSearch) {
|
|
@@ -428,19 +375,16 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
428
375
|
} else {
|
|
429
376
|
onSearch(inputValue);
|
|
430
377
|
}
|
|
431
|
-
|
|
432
378
|
if (isRemoteLoadRef.current) setLoadKeys([]);
|
|
433
379
|
};
|
|
434
|
-
|
|
435
380
|
if (type === 'click') {
|
|
436
381
|
searchFn();
|
|
437
382
|
} else if (evt) {
|
|
438
383
|
var keyCode = evt.which || evt.keyCode;
|
|
439
384
|
if (keyCode === 13) searchFn();
|
|
440
385
|
}
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
|
|
386
|
+
};
|
|
387
|
+
//popover 完成
|
|
444
388
|
var handlePopoverDone = function handlePopoverDone(evt, flag) {
|
|
445
389
|
if (flag) {
|
|
446
390
|
onOk === null || onOk === void 0 ? void 0 : onOk(checkList);
|
|
@@ -449,9 +393,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
449
393
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
450
394
|
handlePopoverClose(null, 'cancel');
|
|
451
395
|
}
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
|
|
396
|
+
};
|
|
397
|
+
//设置容器宽高
|
|
455
398
|
var setPopoverWH = function setPopoverWH() {
|
|
456
399
|
var w = 'auto';
|
|
457
400
|
if (selectRef.current) w = selectRef.current.offsetWidth + 'px';
|
|
@@ -460,60 +403,47 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
460
403
|
minWidth: w,
|
|
461
404
|
maxWidth: 960
|
|
462
405
|
};
|
|
463
|
-
|
|
464
406
|
if (typeof dropdownMatchSelectWidth === 'number') {
|
|
465
407
|
wObj.width = dropdownMatchSelectWidth;
|
|
466
408
|
} else if (dropdownMatchSelectWidth) {
|
|
467
409
|
wObj.width = w;
|
|
468
410
|
}
|
|
469
|
-
|
|
470
411
|
return Object.assign(Object.assign({
|
|
471
412
|
overflow: 'auto'
|
|
472
413
|
}, wObj), overlayStyle);
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
|
|
414
|
+
};
|
|
415
|
+
//select className
|
|
476
416
|
var makeSelectCls = function makeSelectCls() {
|
|
477
417
|
var _clsx;
|
|
478
|
-
|
|
479
418
|
var isMedium = size !== 'medium';
|
|
480
419
|
return clsx("".concat($prefixCls, "-comboselect"), className, (_clsx = {}, _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-focused"), open && !disablePopup), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-disabled"), disabled), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-radioable"), !checkable), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-error"), error), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-clear"), hasAllClear), _defineProperty(_clsx, "".concat($prefixCls, "-comboselect-non-popup"), disablePopup), _clsx), isMedium && "".concat($prefixCls, "-comboselect-").concat(size));
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
|
|
420
|
+
};
|
|
421
|
+
//格式化选中数据
|
|
484
422
|
var formatSelectedData = function formatSelectedData(values, keys) {
|
|
485
423
|
var _a;
|
|
486
|
-
|
|
487
424
|
var opts = [];
|
|
488
|
-
|
|
489
425
|
if (values === null || values === void 0 ? void 0 : values.length) {
|
|
490
426
|
opts = values.map(function (item) {
|
|
491
427
|
var _a;
|
|
492
|
-
|
|
493
428
|
var temp = {};
|
|
494
429
|
temp[outputKey] = item[fieldKey] || '';
|
|
495
430
|
if (getOptionLabel) temp[outputTitle] = getOptionLabel(item) || '';else temp[outputTitle] = item[fieldTitle] || '';
|
|
496
431
|
var oValue = (_a = originValueRef.current) === null || _a === void 0 ? void 0 : _a.find(function (v) {
|
|
497
432
|
return v[outputKey] === temp[outputKey];
|
|
498
433
|
});
|
|
499
|
-
|
|
500
434
|
if (oValue) {
|
|
501
435
|
if (oValue.disabled !== undefined) {
|
|
502
436
|
temp.disabled = oValue.disabled;
|
|
503
437
|
}
|
|
504
|
-
|
|
505
438
|
if (oValue.closable !== undefined) {
|
|
506
439
|
temp.closable = oValue.closable;
|
|
507
440
|
}
|
|
508
441
|
}
|
|
509
|
-
|
|
510
442
|
return temp;
|
|
511
443
|
});
|
|
512
444
|
}
|
|
513
|
-
|
|
514
445
|
if ((keys === null || keys === void 0 ? void 0 : keys.length) && values) {
|
|
515
446
|
var _opts;
|
|
516
|
-
|
|
517
447
|
var fKeys = keys.filter(function (k) {
|
|
518
448
|
return values.findIndex(function (v) {
|
|
519
449
|
return v[fieldKey] === k;
|
|
@@ -524,14 +454,13 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
524
454
|
});
|
|
525
455
|
if (diffValue) (_opts = opts).push.apply(_opts, _toConsumableArray(diffValue));
|
|
526
456
|
}
|
|
527
|
-
|
|
528
457
|
setCheckList(opts);
|
|
529
458
|
var vals = DeepClone(values || []);
|
|
530
|
-
if (!checkable)
|
|
459
|
+
if (!checkable)
|
|
460
|
+
//单选
|
|
531
461
|
onChange === null || onChange === void 0 ? void 0 : onChange(opts[0], vals[0]);else onChange === null || onChange === void 0 ? void 0 : onChange(opts, vals);
|
|
532
|
-
};
|
|
533
|
-
|
|
534
|
-
|
|
462
|
+
};
|
|
463
|
+
//外部数据转换为内部状态
|
|
535
464
|
var transformToState = function transformToState(options) {
|
|
536
465
|
var keys = options.map(function (_) {
|
|
537
466
|
return _[outputKey];
|
|
@@ -539,30 +468,25 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
539
468
|
setCheckList(options);
|
|
540
469
|
setCheckKeys(keys);
|
|
541
470
|
originValueRef.current = options;
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
|
|
471
|
+
};
|
|
472
|
+
//tree select
|
|
545
473
|
var handleSelect = function handleSelect(selectedKeys, info) {
|
|
546
474
|
setFullPath(info.node);
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
|
|
475
|
+
};
|
|
476
|
+
//渲染搜索
|
|
550
477
|
var renderSearch = function renderSearch() {
|
|
551
478
|
var styObj = {};
|
|
552
|
-
|
|
553
479
|
if (!disablePopup) {
|
|
554
480
|
var _setPopoverWH = setPopoverWH(),
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
481
|
+
width = _setPopoverWH.width,
|
|
482
|
+
minWidth = _setPopoverWH.minWidth,
|
|
483
|
+
maxWidth = _setPopoverWH.maxWidth;
|
|
559
484
|
styObj = {
|
|
560
485
|
width: width,
|
|
561
486
|
minWidth: minWidth,
|
|
562
487
|
maxWidth: maxWidth
|
|
563
488
|
};
|
|
564
489
|
}
|
|
565
|
-
|
|
566
490
|
return jsxs("div", Object.assign({
|
|
567
491
|
className: 'comboselect-search',
|
|
568
492
|
style: styObj
|
|
@@ -592,9 +516,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
592
516
|
children: jsx(CloseCircle, {})
|
|
593
517
|
}))]
|
|
594
518
|
}));
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
|
|
519
|
+
};
|
|
520
|
+
//render popover action
|
|
598
521
|
var renderActions = function renderActions() {
|
|
599
522
|
if (popoverActions) return jsx("div", Object.assign({
|
|
600
523
|
className: 'comboselect-actions'
|
|
@@ -626,14 +549,11 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
626
549
|
})
|
|
627
550
|
}))]
|
|
628
551
|
}));
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
|
|
552
|
+
};
|
|
553
|
+
//渲染完整路径
|
|
632
554
|
var renderFullPath = function renderFullPath() {
|
|
633
555
|
var _a;
|
|
634
|
-
|
|
635
556
|
if (mode !== 'tree' || !fullPath) return null;
|
|
636
|
-
|
|
637
557
|
if (fullPathRender) {
|
|
638
558
|
return jsx("div", Object.assign({
|
|
639
559
|
className: 'comboselect-fullPath'
|
|
@@ -641,7 +561,6 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
641
561
|
children: fullPathRender(fullPath !== null && fullPath !== void 0 ? fullPath : {})
|
|
642
562
|
}));
|
|
643
563
|
}
|
|
644
|
-
|
|
645
564
|
return jsxs("div", Object.assign({
|
|
646
565
|
className: 'comboselect-fullPath'
|
|
647
566
|
}, {
|
|
@@ -651,9 +570,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
651
570
|
})
|
|
652
571
|
}), (_a = fullPath === null || fullPath === void 0 ? void 0 : fullPath[fullPathKey]) !== null && _a !== void 0 ? _a : '']
|
|
653
572
|
}));
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
|
|
573
|
+
};
|
|
574
|
+
//全部清空
|
|
657
575
|
var handleAllClear = function handleAllClear(evt) {
|
|
658
576
|
evt.stopPropagation();
|
|
659
577
|
clearSelectorData();
|
|
@@ -661,16 +579,14 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
661
579
|
setOpenMore(false);
|
|
662
580
|
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
663
581
|
onChange === null || onChange === void 0 ? void 0 : onChange(checkable ? [] : {});
|
|
664
|
-
};
|
|
665
|
-
|
|
666
|
-
|
|
582
|
+
};
|
|
583
|
+
//显示更多
|
|
667
584
|
var handleOpenMore = function handleOpenMore(e) {
|
|
668
585
|
e.stopPropagation();
|
|
669
586
|
setOpenMore(true);
|
|
670
587
|
handlePopoverClose();
|
|
671
|
-
};
|
|
672
|
-
|
|
673
|
-
|
|
588
|
+
};
|
|
589
|
+
//暴露给外部的行为
|
|
674
590
|
useImperativeHandle(action, function () {
|
|
675
591
|
return {
|
|
676
592
|
closePopup: function closePopup() {
|
|
@@ -696,8 +612,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
696
612
|
//受控values
|
|
697
613
|
transformToState(toArray(value));
|
|
698
614
|
}
|
|
699
|
-
}, [value]);
|
|
700
|
-
|
|
615
|
+
}, [value]);
|
|
616
|
+
//是否显示清除图标
|
|
701
617
|
useEffect(function () {
|
|
702
618
|
if (allowClear) setHasAllClear(!!(checkList === null || checkList === void 0 ? void 0 : checkList.length));
|
|
703
619
|
}, [checkList]);
|
|
@@ -705,21 +621,18 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
705
621
|
var ownerDocument = function ownerDocument(node) {
|
|
706
622
|
return node && node.ownerDocument || document;
|
|
707
623
|
};
|
|
708
|
-
|
|
709
624
|
var handleMouseDown = function handleMouseDown(evt) {
|
|
710
625
|
var _a, _b;
|
|
711
|
-
|
|
712
626
|
var doc = ownerDocument(selectRef.current);
|
|
713
627
|
var target = evt.target;
|
|
714
628
|
var 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;
|
|
715
|
-
|
|
716
629
|
if (mode === 'table') {
|
|
717
630
|
//表格模式时,显示点击popover时阻止 关闭弹框
|
|
718
631
|
//表格分页popover
|
|
719
|
-
var tablePageSelectCls = ".".concat($prefixCls, "-select-popover .select-popover-content");
|
|
720
|
-
|
|
721
|
-
var tableColumCls = ".".concat($prefixCls, "-table-show-colums-popover");
|
|
722
|
-
|
|
632
|
+
var tablePageSelectCls = ".".concat($prefixCls, "-select-popover .select-popover-content");
|
|
633
|
+
//表格显示列popover
|
|
634
|
+
var tableColumCls = ".".concat($prefixCls, "-table-show-colums-popover");
|
|
635
|
+
//表格过滤popover
|
|
723
636
|
var tableFilterCls = ".".concat($prefixCls, "-filter-popover");
|
|
724
637
|
var tablePageSelectDom = document.querySelector(tablePageSelectCls);
|
|
725
638
|
var tableColumn = document.querySelector(tableColumCls);
|
|
@@ -728,20 +641,16 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
728
641
|
if (tableColumn && tableColumn.contains(target)) return;
|
|
729
642
|
if (tableFilter && tableFilter.contains(target)) return;
|
|
730
643
|
}
|
|
731
|
-
|
|
732
644
|
if (hasPopup.current && !insideDOM) {
|
|
733
645
|
handlePopoverClose();
|
|
734
646
|
}
|
|
735
647
|
};
|
|
736
|
-
|
|
737
648
|
if (open) {
|
|
738
649
|
setTimeout(function () {
|
|
739
650
|
var _a;
|
|
740
|
-
|
|
741
651
|
(_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
742
652
|
}, 200);
|
|
743
653
|
}
|
|
744
|
-
|
|
745
654
|
if (!disablePopup && open) {
|
|
746
655
|
var doc = ownerDocument(selectRef.current);
|
|
747
656
|
doc.addEventListener('mousedown', handleMouseDown);
|
|
@@ -749,13 +658,11 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
749
658
|
doc.removeEventListener('mousedown', handleMouseDown);
|
|
750
659
|
};
|
|
751
660
|
}
|
|
752
|
-
}, [open]);
|
|
753
|
-
|
|
661
|
+
}, [open]);
|
|
662
|
+
//tag memo
|
|
754
663
|
var tagMemo = useMemo(function () {
|
|
755
664
|
var _a;
|
|
756
|
-
|
|
757
665
|
if (!(checkList === null || checkList === void 0 ? void 0 : checkList.length)) return null;
|
|
758
|
-
|
|
759
666
|
if (!checkable) {
|
|
760
667
|
//单选
|
|
761
668
|
return jsx("span", Object.assign({
|
|
@@ -764,25 +671,19 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
764
671
|
children: (_a = checkList[0]) === null || _a === void 0 ? void 0 : _a[outputTitle]
|
|
765
672
|
}));
|
|
766
673
|
}
|
|
767
|
-
|
|
768
674
|
var realShowList = _toConsumableArray(checkList); //实际显示
|
|
769
|
-
|
|
770
|
-
|
|
771
675
|
var overList = [];
|
|
772
|
-
|
|
773
676
|
if (maxCount) {
|
|
774
677
|
if (checkList.length > maxCount) {
|
|
775
678
|
overList = checkList.slice(maxCount); //超出
|
|
776
|
-
|
|
777
679
|
realShowList = checkList.slice(0, maxCount);
|
|
778
680
|
setMoreTagList(overList);
|
|
779
681
|
} else {
|
|
780
682
|
setMoreTagList([]);
|
|
781
683
|
setOpenMore(false);
|
|
782
684
|
}
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
|
|
685
|
+
}
|
|
686
|
+
//超出tag渲染
|
|
786
687
|
var renderOverTag = function renderOverTag() {
|
|
787
688
|
return (overList === null || overList === void 0 ? void 0 : overList.length) ? jsx("div", Object.assign({
|
|
788
689
|
className: 'comboselect-overflow-item'
|
|
@@ -798,31 +699,26 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
798
699
|
}))
|
|
799
700
|
}))
|
|
800
701
|
})) : null;
|
|
801
|
-
};
|
|
802
|
-
|
|
803
|
-
|
|
702
|
+
};
|
|
703
|
+
//渲染tag item
|
|
804
704
|
var renderTagItem = function renderTagItem(item) {
|
|
805
705
|
if (tagRender) return tagRender(item);
|
|
806
|
-
|
|
807
706
|
var _ref2 = item !== null && item !== void 0 ? item : {},
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
707
|
+
disabled = _ref2.disabled,
|
|
708
|
+
_ref2$closable = _ref2.closable,
|
|
709
|
+
closable = _ref2$closable === void 0 ? true : _ref2$closable;
|
|
812
710
|
var displayLabel = item[outputTitle];
|
|
813
|
-
var isOverflow = false;
|
|
814
|
-
|
|
711
|
+
var isOverflow = false;
|
|
712
|
+
//限制tag文本长度
|
|
815
713
|
if (typeof maxTagTextLength === 'number') {
|
|
816
714
|
if (typeof displayLabel === 'string' || typeof displayLabel === 'number') {
|
|
817
715
|
var strLabel = String(displayLabel);
|
|
818
|
-
|
|
819
716
|
if (strLabel.length > maxTagTextLength) {
|
|
820
717
|
displayLabel = "".concat(strLabel.slice(0, maxTagTextLength), "...");
|
|
821
718
|
isOverflow = true;
|
|
822
719
|
}
|
|
823
720
|
}
|
|
824
721
|
}
|
|
825
|
-
|
|
826
722
|
return jsxs("span", Object.assign({
|
|
827
723
|
className: clsx('comboselect-item', {
|
|
828
724
|
'comboselect-item--disabled': disabled,
|
|
@@ -864,7 +760,6 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
864
760
|
}))]
|
|
865
761
|
}));
|
|
866
762
|
};
|
|
867
|
-
|
|
868
763
|
return jsxs(Fragment, {
|
|
869
764
|
children: [realShowList.map(function (item, idx) {
|
|
870
765
|
return jsx("div", Object.assign({
|
|
@@ -874,20 +769,18 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
874
769
|
}), idx);
|
|
875
770
|
}), renderOverTag()]
|
|
876
771
|
});
|
|
877
|
-
}, [checkList, onChange]);
|
|
878
|
-
|
|
772
|
+
}, [checkList, onChange]);
|
|
773
|
+
//处理参数
|
|
879
774
|
var getParams = useMemo(function () {
|
|
880
775
|
var P = params || emptyParamsRef.current;
|
|
881
|
-
|
|
882
776
|
if (showSearch && !onSearch && searchKeyRef.current !== undefined) {
|
|
883
777
|
P = Object.assign(Object.assign({}, P), {
|
|
884
778
|
searchKey: searchKeyRef.current
|
|
885
779
|
});
|
|
886
780
|
}
|
|
887
|
-
|
|
888
781
|
return (paramsCallback === null || paramsCallback === void 0 ? void 0 : paramsCallback(P)) || P;
|
|
889
|
-
}, [params, inRefresh, refresh, open]);
|
|
890
|
-
|
|
782
|
+
}, [params, inRefresh, refresh, open]);
|
|
783
|
+
//表格组件
|
|
891
784
|
var tableMemo = useMemo(function () {
|
|
892
785
|
if (!disablePopup && !open || mode !== 'table') return null;
|
|
893
786
|
var reqOpts = {
|
|
@@ -895,18 +788,16 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
895
788
|
ctx: ctx,
|
|
896
789
|
search: getParams,
|
|
897
790
|
method: method
|
|
898
|
-
};
|
|
899
|
-
|
|
791
|
+
};
|
|
792
|
+
//处理table radio
|
|
900
793
|
var handleTableRadio = function handleTableRadio(keys, values) {
|
|
901
794
|
if (!checkable) {
|
|
902
795
|
//单选时关闭下拉框,点击自己不取消
|
|
903
796
|
handlePopoverClose();
|
|
904
797
|
if (checkKeys.includes(keys)) return;
|
|
905
798
|
}
|
|
906
|
-
|
|
907
799
|
handleChecked([keys], [values]);
|
|
908
800
|
};
|
|
909
|
-
|
|
910
801
|
return jsx("div", Object.assign({
|
|
911
802
|
className: 'comboselect-table'
|
|
912
803
|
}, {
|
|
@@ -923,8 +814,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
923
814
|
autoSize: false
|
|
924
815
|
}))
|
|
925
816
|
}));
|
|
926
|
-
}, [checkKeys, refresh, params, inRefresh, open]);
|
|
927
|
-
|
|
817
|
+
}, [checkKeys, refresh, params, inRefresh, open]);
|
|
818
|
+
//树组件
|
|
928
819
|
var treeMemo = useMemo(function () {
|
|
929
820
|
if (!disablePopup && !open || !['tree', 'list'].includes(mode)) return null;
|
|
930
821
|
var reqOpts = {
|
|
@@ -932,39 +823,32 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
932
823
|
ctx: ctx,
|
|
933
824
|
params: getParams,
|
|
934
825
|
method: method
|
|
935
|
-
};
|
|
936
|
-
|
|
826
|
+
};
|
|
827
|
+
//处理tree nodes
|
|
937
828
|
var handleTreeCheck = function handleTreeCheck(checkedKeys, info) {
|
|
938
829
|
var _a;
|
|
939
|
-
|
|
940
830
|
if (!info.checked) {
|
|
941
831
|
var temp = {};
|
|
942
832
|
temp[outputKey] = info.node[fieldKey] || '';
|
|
943
833
|
temp[outputTitle] = info.node[fieldTitle] || '';
|
|
944
|
-
|
|
945
834
|
if ((onTagRemove === null || onTagRemove === void 0 ? void 0 : onTagRemove(temp)) === false) {
|
|
946
835
|
//返回false不删除
|
|
947
836
|
return;
|
|
948
837
|
}
|
|
949
838
|
}
|
|
950
|
-
|
|
951
839
|
if (!checkable) {
|
|
952
840
|
//单选时
|
|
953
841
|
handlePopoverClose();
|
|
954
|
-
|
|
955
842
|
if (!toggleSelectedOnSingle) {
|
|
956
843
|
if (checkKeys.includes((_a = info.node) === null || _a === void 0 ? void 0 : _a.key)) return;
|
|
957
844
|
}
|
|
958
845
|
}
|
|
959
|
-
|
|
960
846
|
var nodes = info.checkedNodes;
|
|
961
|
-
|
|
962
847
|
if (!checkable) {
|
|
963
848
|
//单选
|
|
964
849
|
if (checkedKeys === null || checkedKeys === void 0 ? void 0 : checkedKeys.length) nodes = [info.node];
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
|
|
850
|
+
}
|
|
851
|
+
//多选
|
|
968
852
|
if (checkable) {
|
|
969
853
|
var nodesObj = ArrayToObject('key', nodes);
|
|
970
854
|
var ckeys = Array.from(checkValuesRef.current.keys());
|
|
@@ -980,22 +864,17 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
980
864
|
});
|
|
981
865
|
nodes = Array.from(checkValuesRef.current.values());
|
|
982
866
|
}
|
|
983
|
-
|
|
984
867
|
handleChecked(checkedKeys, nodes);
|
|
985
868
|
};
|
|
986
|
-
|
|
987
869
|
var _titleRender = function _titleRender(dataNode) {
|
|
988
870
|
if (TreeProps === null || TreeProps === void 0 ? void 0 : TreeProps.titleRender) {
|
|
989
871
|
return TreeProps.titleRender(dataNode);
|
|
990
872
|
}
|
|
991
|
-
|
|
992
873
|
if (optionRender) {
|
|
993
874
|
return optionRender(dataNode);
|
|
994
875
|
}
|
|
995
|
-
|
|
996
876
|
return dataNode.title;
|
|
997
877
|
};
|
|
998
|
-
|
|
999
878
|
var treeCls = clsx('comboselect-tree', {
|
|
1000
879
|
'comboselect-list': mode === 'list',
|
|
1001
880
|
'comboselect-list-single': mode === 'list' && !checkable
|
|
@@ -1025,8 +904,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
1025
904
|
refresh: refresh !== null && refresh !== void 0 ? refresh : inRefresh
|
|
1026
905
|
}))
|
|
1027
906
|
}));
|
|
1028
|
-
}, [checkKeys, refresh, params, inRefresh, open, loadedKeys]);
|
|
1029
|
-
|
|
907
|
+
}, [checkKeys, refresh, params, inRefresh, open, loadedKeys]);
|
|
908
|
+
//组合选择器输入框
|
|
1030
909
|
var comboSelectorInput = jsxs("div", Object.assign({
|
|
1031
910
|
className: 'comboselect-wrapper',
|
|
1032
911
|
ref: selectRef,
|
|
@@ -1052,9 +931,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
1052
931
|
id: 'pleaseSelect'
|
|
1053
932
|
})
|
|
1054
933
|
}))]
|
|
1055
|
-
}));
|
|
1056
|
-
|
|
1057
|
-
|
|
934
|
+
}));
|
|
935
|
+
//渲染label
|
|
1058
936
|
var renderLabel = function renderLabel() {
|
|
1059
937
|
if (label || required) {
|
|
1060
938
|
return jsx(Label, Object.assign({
|
|
@@ -1062,11 +940,9 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
1062
940
|
required: required
|
|
1063
941
|
}, labelTooltip));
|
|
1064
942
|
}
|
|
1065
|
-
|
|
1066
943
|
return null;
|
|
1067
|
-
};
|
|
1068
|
-
|
|
1069
|
-
|
|
944
|
+
};
|
|
945
|
+
//非popover 模式
|
|
1070
946
|
var nonPopoverMemo = useMemo(function () {
|
|
1071
947
|
return jsxs(Fragment, {
|
|
1072
948
|
children: [comboSelectorInput, jsxs("div", Object.assign({
|
|
@@ -1075,8 +951,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
1075
951
|
children: [showSearch && renderSearch(), mode === 'table' ? tableMemo : treeMemo, renderFullPath(), showPopoverActions && renderActions()]
|
|
1076
952
|
}))]
|
|
1077
953
|
});
|
|
1078
|
-
}, [checkKeys, inputValue, refresh, params, fullPath, hasAllClear, helperText, language, locale, onChange, onClear]);
|
|
1079
|
-
|
|
954
|
+
}, [checkKeys, inputValue, refresh, params, fullPath, hasAllClear, helperText, language, locale, onChange, onClear]);
|
|
955
|
+
//popover 浮层
|
|
1080
956
|
var renderOverlay = function renderOverlay() {
|
|
1081
957
|
return jsxs("div", Object.assign({
|
|
1082
958
|
ref: popUpNodeRef,
|
|
@@ -1089,9 +965,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
1089
965
|
children: [mode === 'table' ? tableMemo : treeMemo, open && renderFullPath(), showPopoverActions && renderActions()]
|
|
1090
966
|
}))]
|
|
1091
967
|
}));
|
|
1092
|
-
};
|
|
1093
|
-
|
|
1094
|
-
|
|
968
|
+
};
|
|
969
|
+
//popover 渲染更多节点
|
|
1095
970
|
var renderPopoverMore = function renderPopoverMore() {
|
|
1096
971
|
var generateMoreTag = function generateMoreTag() {
|
|
1097
972
|
if (!(moreTagList === null || moreTagList === void 0 ? void 0 : moreTagList.length)) return null;
|
|
@@ -1116,7 +991,6 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
1116
991
|
}), idx);
|
|
1117
992
|
});
|
|
1118
993
|
};
|
|
1119
|
-
|
|
1120
994
|
return jsxs("div", Object.assign({
|
|
1121
995
|
className: "comboselect-more-wrapper"
|
|
1122
996
|
}, {
|
|
@@ -1134,9 +1008,8 @@ var ComboSelect = function ComboSelect(props) {
|
|
|
1134
1008
|
children: generateMoreTag()
|
|
1135
1009
|
}))]
|
|
1136
1010
|
}));
|
|
1137
|
-
};
|
|
1138
|
-
|
|
1139
|
-
|
|
1011
|
+
};
|
|
1012
|
+
//popover 模式
|
|
1140
1013
|
var popoverMemo = useMemo(function () {
|
|
1141
1014
|
return jsx(Dropdown, Object.assign({
|
|
1142
1015
|
overlay: renderOverlay(),
|