@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/Selector/index.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-8f4c9589.js';
|
|
2
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
3
|
-
import { r as regenerator } from '../_verture/index-232d890b.js';
|
|
4
1
|
import { a as __awaiter, _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
5
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
3
|
import { useState, useRef, useEffect, Fragment as Fragment$1 } from 'react';
|
|
4
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-75fa4188.js';
|
|
5
|
+
import { r as regenerator } from '../_verture/index-d63bd287.js';
|
|
7
6
|
import { Radio } from '../Radio/index.js';
|
|
8
7
|
import { Checkbox } from '../Checkbox/index.js';
|
|
9
8
|
import { Popover } from '../Popover/index.js';
|
|
10
9
|
import AutoTips from '../AutoTips/index.js';
|
|
11
10
|
import { Loading } from '../Loading/index.js';
|
|
12
11
|
import CloseIcon from '@para-ui/icons/Close';
|
|
13
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
14
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
12
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
13
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
|
|
15
14
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
16
15
|
import { Search } from '../Search/index.js';
|
|
17
16
|
import { Breadcrumbs } from '../Breadcrumbs/index.js';
|
|
@@ -19,9 +18,8 @@ import Empty from '../Empty/index.js';
|
|
|
19
18
|
import SearchIcon from '@para-ui/icons/Search';
|
|
20
19
|
import Refresh from '@para-ui/icons/Refresh';
|
|
21
20
|
import { ArrayToObject, Get, Post, Cancel } from '@paraview/lib';
|
|
22
|
-
import { u as useGlobalProps } from '../_verture/useGlobalProps-
|
|
23
|
-
import '../_verture/
|
|
24
|
-
import '../_verture/typeof-c310ee4a.js';
|
|
21
|
+
import { u as useGlobalProps } from '../_verture/useGlobalProps-1e416658.js';
|
|
22
|
+
import '../_verture/typeof-b240b062.js';
|
|
25
23
|
import '../Label/index.js';
|
|
26
24
|
import '../Help/index.js';
|
|
27
25
|
import '../Tooltip/index.js';
|
|
@@ -30,16 +28,15 @@ import 'rc-tooltip/lib/placements';
|
|
|
30
28
|
import 'clsx';
|
|
31
29
|
import '@para-ui/icons/Forbid';
|
|
32
30
|
import '@para-ui/icons/Help';
|
|
33
|
-
import '../_verture/usePopupContainer-
|
|
31
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
34
32
|
import '@para-ui/icons/LoadingF';
|
|
35
33
|
import '@para-ui/core/GlobalContext';
|
|
36
34
|
import '../TextField/index.js';
|
|
37
|
-
import '../_verture/typeof-adeedc13.js';
|
|
38
35
|
import '@para-ui/icons/PreviewClose';
|
|
39
36
|
import '@para-ui/icons/PreviewOpen';
|
|
40
37
|
import '@para-ui/icons/CloseCircleF';
|
|
41
38
|
import '../HelperText/index.js';
|
|
42
|
-
import '../_verture/index-
|
|
39
|
+
import '../_verture/index-da9097d3.js';
|
|
43
40
|
import 'rc-dropdown';
|
|
44
41
|
import 'dayjs';
|
|
45
42
|
import '@para-ui/icons/More';
|
|
@@ -68,8 +65,8 @@ var zh = {
|
|
|
68
65
|
};
|
|
69
66
|
|
|
70
67
|
var localeJson = {
|
|
71
|
-
zh
|
|
72
|
-
en
|
|
68
|
+
zh,
|
|
69
|
+
en
|
|
73
70
|
};
|
|
74
71
|
|
|
75
72
|
var css_248z$3 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-selector-node {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n}\n.paraui-v4-selector-node:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-selector-node > .selector-node-left {\n display: flex;\n align-items: center;\n flex: 1;\n overflow: hidden;\n padding-right: 10px;\n}\n.paraui-v4-selector-node > .selector-node-left > .selector-node-radio {\n margin-right: 8px;\n display: flex;\n align-items: center;\n padding: 0;\n}\n.paraui-v4-selector-node > .selector-node-left > .selector-node-radio .radio-box {\n top: 0;\n}\n.paraui-v4-selector-node > .selector-node-left > .selector-node-check {\n margin-right: 8px;\n display: flex;\n align-items: center;\n padding: 0;\n}\n.paraui-v4-selector-node > .selector-node-left > .selector-node-check .checkbox-box {\n top: 0;\n}\n.paraui-v4-selector-node > .selector-node-left > .node-img {\n display: inline-block;\n width: 30px;\n height: 30px;\n margin-right: 8px;\n}\n.paraui-v4-selector-node > .selector-node-left > .node-img img {\n width: 30px;\n height: 30px;\n border-radius: 50%;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-branch {\n height: 30px;\n padding: 0 10px;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-branch.paraui-v4-selector-node-img {\n height: 44px;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-branch > .selector-node-left > .main-title {\n font-size: 14px;\n color: rgb(29, 33, 38);\n white-space: nowrap;\n height: 20px;\n line-height: 20px;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-branch > .selector-node-left > .sub-title {\n margin-left: 8px;\n font-size: 14px;\n color: rgb(161, 168, 179);\n white-space: nowrap;\n height: 20px;\n line-height: 20px;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: 30px;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-branch > .selector-node-left > .tag {\n margin-left: 8px;\n background-color: rgba(46, 101, 230, 0.1);\n color: rgb(46, 101, 230);\n border-radius: 2px;\n font-size: 12px;\n padding: 0px 6px;\n white-space: nowrap;\n height: 20px;\n line-height: 20px;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-leaf {\n padding: 0px 10px;\n height: 44px;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-leaf > .selector-node-left > .title-box {\n flex: 1;\n overflow: hidden;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-leaf > .selector-node-left > .title-box > .main-title-box {\n display: flex;\n align-items: center;\n white-space: nowrap;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-leaf > .selector-node-left > .title-box > .main-title-box > .main-title {\n font-size: 14px;\n color: rgb(29, 33, 38);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-leaf > .selector-node-left > .title-box > .main-title-box > .tag {\n margin-left: 8px;\n background-color: rgba(46, 101, 230, 0.1);\n color: rgb(46, 101, 230);\n border-radius: 2px;\n font-size: 12px;\n padding: 0px 6px;\n white-space: nowrap;\n height: 20px;\n line-height: 20px;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-leaf > .selector-node-left > .title-box > .sub-title {\n font-size: 12px;\n color: rgb(161, 168, 179);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.paraui-v4-selector-node > .selector-node-right {\n display: flex;\n align-items: center;\n height: 100%;\n}\n.paraui-v4-selector-node > .selector-node-right > .detail {\n font-size: 14px;\n color: rgb(46, 101, 230);\n white-space: nowrap;\n padding: 0 4px;\n cursor: pointer;\n height: 24px;\n line-height: 24px;\n border-radius: 2px;\n}\n.paraui-v4-selector-node > .selector-node-right > .detail:hover {\n background-color: rgba(212, 218, 227, 0.4);\n}\n.paraui-v4-selector-node > .selector-node-right > .line {\n border-left: 1px solid rgb(213, 224, 250);\n margin: 0 8px;\n content: \"\";\n display: inline-block;\n height: 12px;\n}\n.paraui-v4-selector-node > .selector-node-right > .lower-child {\n font-size: 14px;\n color: rgb(46, 101, 230);\n white-space: nowrap;\n padding: 0 4px;\n cursor: pointer;\n height: 24px;\n line-height: 24px;\n border-radius: 2px;\n}\n.paraui-v4-selector-node > .selector-node-right > .lower-child:hover {\n background-color: rgb(234, 236, 241);\n}\n.paraui-v4-selector-node > .selector-node-right > .close {\n display: flex;\n align-items: center;\n color: rgb(46, 101, 230);\n white-space: nowrap;\n padding: 0 4px;\n cursor: pointer;\n height: 24px;\n line-height: 24px;\n border-radius: 2px;\n}\n.paraui-v4-selector-node > .selector-node-right > .close:hover > svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-selector-node > .selector-node-right > .close > svg {\n font-size: 16px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-edit > .selector-node-right > .detail, .paraui-v4-selector-node.paraui-v4-selector-node-edit > .selector-node-right > .lower-child {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-edit > .selector-node-right > .detail:hover, .paraui-v4-selector-node.paraui-v4-selector-node-edit > .selector-node-right > .lower-child:hover {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-disabled {\n cursor: not-allowed;\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-disabled.paraui-v4-selector-node-branch > .selector-node-left > .main-title {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-disabled.paraui-v4-selector-node-leaf > .selector-node-left > .title-box > .main-title-box > .main-title {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-disabled > .selector-node-right > .lower-child {\n cursor: not-allowed;\n color: rgb(161, 168, 179);\n}\n.paraui-v4-selector-node.paraui-v4-selector-node-disabled-child > .selector-node-right > .lower-child {\n cursor: not-allowed;\n color: rgb(161, 168, 179);\n}\n\n.paraui-v4-selector-detail .selector-detail-popover-content.selector-detail-popover-content-loading {\n min-width: 100px;\n min-height: 50px;\n}";
|
|
@@ -332,63 +329,57 @@ var SelectorNode = function SelectorNode(props) {
|
|
|
332
329
|
var css_248z$2 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-selector-main {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n}\n.paraui-v4-selector-main > .selectot-main-search {\n margin-bottom: 16px;\n border-bottom: 1px solid rgb(234, 236, 241);\n}\n.paraui-v4-selector-main > .selectot-main-search .text-field-content {\n border: none;\n height: 32px;\n}\n.paraui-v4-selector-main > .selectot-main-search .text-field-content .text-field-content-within-input {\n height: 32px !important;\n}\n.paraui-v4-selector-main > .selectot-main-search .text-field-content .text-field-content-within-input .text-field-label-placeholder {\n line-height: 32px !important;\n}\n.paraui-v4-selector-main > .selector-main-box {\n position: relative;\n width: 100%;\n height: 100%;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .nav-box {\n padding: 0 6px;\n margin-bottom: 4px;\n margin-top: 10px;\n line-height: 0;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list-no-data {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n padding-bottom: 16px;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list {\n overflow-y: hidden;\n display: flex;\n flex-direction: column;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-all-check {\n position: relative;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-all-check + .selector-group-title.selector-group-title-first {\n margin-top: 4px;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content {\n overflow-y: hidden;\n position: relative;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content:before {\n content: \"\";\n position: absolute;\n height: 30px;\n width: 100%;\n pointer-events: none;\n top: 0;\n left: 0;\n z-index: 1;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content:after {\n content: \"\";\n position: absolute;\n height: 30px;\n width: 100%;\n pointer-events: none;\n bottom: 0;\n left: 0;\n z-index: 1;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content.selector-main-list-scroll-top:after {\n box-shadow: inset 0px -10px 10px -8px rgba(0, 0, 0, 0.05);\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content.selector-main-list-scroll-middle:before {\n box-shadow: inset 0px 10px 10px -8px rgba(0, 0, 0, 0.05);\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content.selector-main-list-scroll-middle:after {\n box-shadow: inset 0px -10px 10px -8px rgba(0, 0, 0, 0.05);\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content.selector-main-list-scroll-bottom:before {\n box-shadow: inset 0px 10px 10px -8px rgba(0, 0, 0, 0.05);\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content > .selector-main-list-content-box {\n height: 100%;\n overflow-y: auto;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content > .selector-main-list-content-box > .selector-group-title {\n padding: 0 12px;\n margin-top: 16px;\n margin-bottom: 4px;\n font-size: 14px;\n color: rgb(161, 168, 179);\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-content > .selector-main-list-content-box > .selector-group-title.selector-group-title-first {\n margin-top: 0;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-more {\n padding: 0 10px;\n cursor: pointer;\n font-size: 14px;\n color: rgb(46, 101, 230);\n line-height: 30px;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content > .selector-main-list > .selector-main-list-more:hover {\n color: rgb(87, 131, 235);\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content.selector-main-search-content {\n /*position: absolute;\n left: 0;\n top: 0;*/\n width: 100%;\n height: 100%;\n background-color: white;\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content.selector-main-content-all-check > .selector-main-list > .selector-main-list-content {\n max-height: calc(100% - 30px);\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content.selector-main-content-load-more > .selector-main-list > .selector-main-list-content {\n max-height: calc(100% - 30px);\n}\n.paraui-v4-selector-main > .selector-main-box > .selector-main-content.selector-main-content-all-check.selector-main-content-load-more > .selector-main-list > .selector-main-list-content {\n max-height: calc(100% - 30px - 30px);\n}\n.paraui-v4-selector-main.paraui-v4-selector-main-show-search > .selector-main-box {\n height: calc(100% - 49px);\n}\n.paraui-v4-selector-main.paraui-v4-selector-main-show-search > .selector-main-box > .selector-main-content.selector-main-list-box {\n display: none;\n}\n.paraui-v4-selector-main.paraui-v4-selector-main-search > .selector-main-box {\n height: calc(100% - 49px);\n}\n.paraui-v4-selector-main.paraui-v4-selector-main-search > .selector-main-box .selector-main-content .nav-box {\n margin-top: 0;\n}";
|
|
333
330
|
styleInject(css_248z$2);
|
|
334
331
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
nodeMode =
|
|
341
|
-
selectMode
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
var intl = useFormatMessage('Selector', localeJson);
|
|
367
|
-
var _useState = useState({}),
|
|
368
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
369
|
-
listCom = _useState2[0],
|
|
370
|
-
setListCom = _useState2[1];
|
|
371
|
-
var constData = useRef({
|
|
332
|
+
const SelectorMainContent = props => {
|
|
333
|
+
const {
|
|
334
|
+
className,
|
|
335
|
+
value,
|
|
336
|
+
rowKey = 'key',
|
|
337
|
+
nodeMode = 'branch',
|
|
338
|
+
selectMode,
|
|
339
|
+
loadMore = false,
|
|
340
|
+
isAllCheck = false,
|
|
341
|
+
detail,
|
|
342
|
+
detailRender,
|
|
343
|
+
isLazy,
|
|
344
|
+
list,
|
|
345
|
+
groupType,
|
|
346
|
+
breadcrumbs,
|
|
347
|
+
breadcrumbsSeparator = '-',
|
|
348
|
+
breadcrumbsList = [],
|
|
349
|
+
fieldConfig,
|
|
350
|
+
disabled,
|
|
351
|
+
disabledChild,
|
|
352
|
+
emptyProps,
|
|
353
|
+
loading,
|
|
354
|
+
onClickBreadcrumbs,
|
|
355
|
+
onLevel,
|
|
356
|
+
onSelect,
|
|
357
|
+
onLoad,
|
|
358
|
+
onAllCheck
|
|
359
|
+
} = props;
|
|
360
|
+
const intl = useFormatMessage('Selector', localeJson);
|
|
361
|
+
const [listCom, setListCom] = useState({});
|
|
362
|
+
const constData = useRef({
|
|
372
363
|
listTypeJson: {},
|
|
373
364
|
fieldConfig: {},
|
|
374
365
|
resizeTimer: null
|
|
375
366
|
});
|
|
376
|
-
|
|
377
|
-
|
|
367
|
+
const scrolltRef = useRef(null);
|
|
368
|
+
const contentRef = useRef(null);
|
|
378
369
|
constData.current.listTypeJson = ArrayToObject('value', groupType);
|
|
379
370
|
constData.current.fieldConfig = fieldConfig || {};
|
|
380
|
-
useEffect(
|
|
371
|
+
useEffect(() => {
|
|
381
372
|
changeResize();
|
|
382
|
-
return
|
|
373
|
+
return () => {
|
|
383
374
|
clearTimeout(constData.current.resizeTimer);
|
|
384
375
|
};
|
|
385
376
|
}, []);
|
|
386
|
-
useEffect(
|
|
377
|
+
useEffect(() => {
|
|
387
378
|
if (list && groupType && groupType.length > 0) {
|
|
388
|
-
|
|
389
|
-
for (
|
|
390
|
-
|
|
391
|
-
|
|
379
|
+
const json = {};
|
|
380
|
+
for (let i = 0, l = list.length; i < l; i++) {
|
|
381
|
+
const item = list[i];
|
|
382
|
+
const type = item.type;
|
|
392
383
|
if (!json[type]) json[type] = [];
|
|
393
384
|
json[type].push(item);
|
|
394
385
|
}
|
|
@@ -396,17 +387,17 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
396
387
|
}
|
|
397
388
|
}, [list]);
|
|
398
389
|
/** 屏幕发生改变 */
|
|
399
|
-
|
|
390
|
+
const changeResize = () => {
|
|
400
391
|
clearTimeout(constData.current.resizeTimer);
|
|
401
|
-
constData.current.resizeTimer = setTimeout(
|
|
392
|
+
constData.current.resizeTimer = setTimeout(() => {
|
|
402
393
|
onScroll();
|
|
403
394
|
}, 100);
|
|
404
395
|
};
|
|
405
396
|
/** 滚动 */
|
|
406
|
-
|
|
397
|
+
const onScroll = () => {
|
|
407
398
|
if (!contentRef.current || !scrolltRef.current) return;
|
|
408
|
-
|
|
409
|
-
|
|
399
|
+
const scrollBox = scrolltRef.current;
|
|
400
|
+
const contentBox = contentRef.current;
|
|
410
401
|
contentBox.classList.remove('selector-main-list-scroll-top', 'selector-main-list-scroll-bottom', 'selector-main-list-scroll-middle');
|
|
411
402
|
if (scrollBox.scrollHeight <= scrollBox.clientHeight) return;
|
|
412
403
|
// 滚动条初始化
|
|
@@ -423,17 +414,17 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
423
414
|
contentBox.classList.add('selector-main-list-scroll-middle');
|
|
424
415
|
};
|
|
425
416
|
/** 判断是否全选,半选 */
|
|
426
|
-
|
|
427
|
-
|
|
417
|
+
const handAllCheckFunc = () => {
|
|
418
|
+
const json = {
|
|
428
419
|
checked: false,
|
|
429
420
|
indeterminate: false
|
|
430
421
|
};
|
|
431
422
|
// 不存在value, 没有数据, 全选没转态
|
|
432
423
|
if (!value || !list || list.length === 0) return json;
|
|
433
|
-
for (
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
424
|
+
for (let i = 0, l = list.length; i < l; i++) {
|
|
425
|
+
const item = list[i];
|
|
426
|
+
const key = item.key;
|
|
427
|
+
const disabledItem = handDisabled(item);
|
|
437
428
|
if (disabledItem) {
|
|
438
429
|
if (value[key]) json.checked = true;
|
|
439
430
|
continue;
|
|
@@ -457,7 +448,7 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
457
448
|
return json;
|
|
458
449
|
};
|
|
459
450
|
/** 处理禁用状态 */
|
|
460
|
-
|
|
451
|
+
const handDisabled = item => {
|
|
461
452
|
if (disabled) {
|
|
462
453
|
if (disabled === true) return true;
|
|
463
454
|
if (disabled instanceof Array) {
|
|
@@ -470,7 +461,7 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
470
461
|
return false;
|
|
471
462
|
};
|
|
472
463
|
/** 处理禁用下级状态 */
|
|
473
|
-
|
|
464
|
+
const handDisabledChild = item => {
|
|
474
465
|
if (disabledChild) {
|
|
475
466
|
if (disabledChild === true) return true;
|
|
476
467
|
if (disabledChild instanceof Array) {
|
|
@@ -483,12 +474,12 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
483
474
|
return false;
|
|
484
475
|
};
|
|
485
476
|
/** 全选 */
|
|
486
|
-
|
|
477
|
+
const handAllCheck = () => {
|
|
487
478
|
// 只存在复选框模式
|
|
488
479
|
if (!isAllCheck || selectMode !== 'check') return null;
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
480
|
+
const checkJson = handAllCheckFunc();
|
|
481
|
+
const onAllCheckCom = () => {
|
|
482
|
+
let bol = true;
|
|
492
483
|
if (checkJson.checked) bol = false;
|
|
493
484
|
onAllCheck && onAllCheck(bol);
|
|
494
485
|
};
|
|
@@ -505,11 +496,11 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
505
496
|
}));
|
|
506
497
|
};
|
|
507
498
|
/** 点击查看更多 */
|
|
508
|
-
|
|
499
|
+
const clickLoad = () => {
|
|
509
500
|
onLoad && onLoad();
|
|
510
501
|
};
|
|
511
502
|
/** 查看更多 */
|
|
512
|
-
|
|
503
|
+
const handLoadMore = () => {
|
|
513
504
|
if (!loadMore) return null;
|
|
514
505
|
return jsx("div", Object.assign({
|
|
515
506
|
className: "selector-main-list-more",
|
|
@@ -525,33 +516,29 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
525
516
|
}));
|
|
526
517
|
};
|
|
527
518
|
/** 判断是否选中 */
|
|
528
|
-
|
|
529
|
-
|
|
519
|
+
const handCheck = item => {
|
|
520
|
+
let bol = false;
|
|
530
521
|
if (value && value[item.key]) bol = true;
|
|
531
522
|
return bol;
|
|
532
523
|
};
|
|
533
524
|
/** 处理每个节点的配置 */
|
|
534
|
-
|
|
535
|
-
|
|
525
|
+
const handNodeConfig = item => {
|
|
526
|
+
const json = {
|
|
536
527
|
useCase: 'view',
|
|
537
|
-
detail
|
|
538
|
-
nodeMode
|
|
528
|
+
detail,
|
|
529
|
+
nodeMode,
|
|
539
530
|
disabled: handDisabled(item),
|
|
540
531
|
disabledChild: handDisabledChild(item),
|
|
541
|
-
onLevel:
|
|
542
|
-
|
|
543
|
-
},
|
|
544
|
-
onSelect: function onSelect() {
|
|
545
|
-
return _onSelect && _onSelect(item);
|
|
546
|
-
},
|
|
532
|
+
onLevel: () => onLevel && onLevel(item),
|
|
533
|
+
onSelect: () => onSelect && onSelect(item),
|
|
547
534
|
checked: handCheck(item)
|
|
548
535
|
};
|
|
549
536
|
/** 节点类型 */
|
|
550
537
|
if (item.leaf !== undefined) json.nodeMode = item.leaf ? 'leaf' : 'branch';
|
|
551
538
|
/** 渲染字段 */
|
|
552
|
-
|
|
553
|
-
for (
|
|
554
|
-
|
|
539
|
+
const arr = ['img', 'mainTitle', 'subTitle', 'tag', 'tagStyle'];
|
|
540
|
+
for (let i = 0, l = arr.length; i < l; i++) {
|
|
541
|
+
const key = arr[i];
|
|
555
542
|
json[key] = item[key];
|
|
556
543
|
}
|
|
557
544
|
/** 判断是否具有选择 */
|
|
@@ -565,7 +552,7 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
565
552
|
json.child = item.child;
|
|
566
553
|
} else {
|
|
567
554
|
// 全量数据
|
|
568
|
-
|
|
555
|
+
const children = item.children || [];
|
|
569
556
|
if (children && children.length > 0) {
|
|
570
557
|
json.child = true;
|
|
571
558
|
}
|
|
@@ -574,43 +561,29 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
574
561
|
}
|
|
575
562
|
/** 详情render */
|
|
576
563
|
if (detailRender) {
|
|
577
|
-
json.detailRender = function () {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
while (1) switch (_context.prev = _context.next) {
|
|
582
|
-
case 0:
|
|
583
|
-
_context.next = 2;
|
|
584
|
-
return detailRender(item, true);
|
|
585
|
-
case 2:
|
|
586
|
-
Dom = _context.sent;
|
|
587
|
-
return _context.abrupt("return", Dom);
|
|
588
|
-
case 4:
|
|
589
|
-
case "end":
|
|
590
|
-
return _context.stop();
|
|
591
|
-
}
|
|
592
|
-
}, _callee);
|
|
593
|
-
}));
|
|
594
|
-
};
|
|
564
|
+
json.detailRender = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
565
|
+
const Dom = yield detailRender(item, true);
|
|
566
|
+
return Dom;
|
|
567
|
+
});
|
|
595
568
|
}
|
|
596
569
|
if (item.detail !== undefined) json.detail = item.detail;
|
|
597
570
|
return json;
|
|
598
571
|
};
|
|
599
572
|
/** 渲染list节点 */
|
|
600
|
-
|
|
601
|
-
return arr === null || arr === void 0 ? void 0 : arr.map(
|
|
573
|
+
const handListNode = arr => {
|
|
574
|
+
return arr === null || arr === void 0 ? void 0 : arr.map((item, index) => {
|
|
602
575
|
return jsx(SelectorNode, Object.assign({}, handNodeConfig(item)), index);
|
|
603
576
|
});
|
|
604
577
|
};
|
|
605
578
|
/** 处理节点dom */
|
|
606
|
-
|
|
579
|
+
const handNode = () => {
|
|
607
580
|
// 分组渲染
|
|
608
581
|
if (groupType && groupType.length > 0) {
|
|
609
582
|
return jsx(Fragment, {
|
|
610
|
-
children: groupType.map(
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
583
|
+
children: groupType.map((item, index) => {
|
|
584
|
+
const type = item.value;
|
|
585
|
+
const listData = listCom[type] || [];
|
|
586
|
+
let str = 'selector-group-title';
|
|
614
587
|
if (index === 0) str += ' selector-group-title-first';
|
|
615
588
|
return jsxs(Fragment$1, {
|
|
616
589
|
children: [listData.length > 0 && jsx("div", Object.assign({
|
|
@@ -625,11 +598,11 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
625
598
|
return handListNode(list || []);
|
|
626
599
|
};
|
|
627
600
|
/** 点击面包屑 */
|
|
628
|
-
|
|
601
|
+
const onClickBreadcrums = item => {
|
|
629
602
|
onClickBreadcrumbs && onClickBreadcrumbs(item);
|
|
630
603
|
};
|
|
631
604
|
/** 面包屑dom */
|
|
632
|
-
|
|
605
|
+
const handBreadcrumbs = () => {
|
|
633
606
|
if (!breadcrumbs || breadcrumbsList.length === 0) return null;
|
|
634
607
|
return jsx("div", Object.assign({
|
|
635
608
|
className: "nav-box"
|
|
@@ -642,7 +615,7 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
642
615
|
}));
|
|
643
616
|
};
|
|
644
617
|
/** 处理内容 */
|
|
645
|
-
|
|
618
|
+
const handContent = () => {
|
|
646
619
|
if ((list === null || list === void 0 ? void 0 : list.length) === 0 && !loading) {
|
|
647
620
|
// 空状态
|
|
648
621
|
return jsx("div", Object.assign({
|
|
@@ -670,8 +643,8 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
670
643
|
})), handLoadMore()]
|
|
671
644
|
}));
|
|
672
645
|
};
|
|
673
|
-
|
|
674
|
-
|
|
646
|
+
const handClass = () => {
|
|
647
|
+
let str = 'selector-main-content';
|
|
675
648
|
if (className) str += " ".concat(className);
|
|
676
649
|
if (disabled) str += ' selector-main-content-disabled';
|
|
677
650
|
if (isAllCheck && selectMode === 'check') str += ' selector-main-content-all-check';
|
|
@@ -685,99 +658,87 @@ var SelectorMainContent = function SelectorMainContent(props) {
|
|
|
685
658
|
children: [handBreadcrumbs(), handContent()]
|
|
686
659
|
}));
|
|
687
660
|
};
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
rowKey =
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
onSearch = props.onSearch,
|
|
732
|
-
onRefresh = props.onRefresh;
|
|
733
|
-
var intl = useFormatMessage('Selector', localeJson);
|
|
734
|
-
var _useState3 = useState(false),
|
|
735
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
736
|
-
showSearch = _useState4[0],
|
|
737
|
-
setShowSearch = _useState4[1]; // 显示搜索/
|
|
738
|
-
var _useState5 = useState(''),
|
|
739
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
740
|
-
searchStr = _useState6[0],
|
|
741
|
-
setSearchStr = _useState6[1];
|
|
742
|
-
var constData = useRef({
|
|
661
|
+
const SelectorMain = props => {
|
|
662
|
+
const {
|
|
663
|
+
className,
|
|
664
|
+
style,
|
|
665
|
+
url,
|
|
666
|
+
value,
|
|
667
|
+
rowKey = 'key',
|
|
668
|
+
nodeMode = 'branch',
|
|
669
|
+
selectMode,
|
|
670
|
+
loadMore = false,
|
|
671
|
+
searchLoadMore = false,
|
|
672
|
+
isAllCheck = false,
|
|
673
|
+
disabled,
|
|
674
|
+
disabledChild,
|
|
675
|
+
detail,
|
|
676
|
+
detailRender,
|
|
677
|
+
isLazy,
|
|
678
|
+
list,
|
|
679
|
+
groupType,
|
|
680
|
+
groupRange,
|
|
681
|
+
search,
|
|
682
|
+
searchVal = '',
|
|
683
|
+
searchPlaceholder,
|
|
684
|
+
searchTrigger,
|
|
685
|
+
searchLoading,
|
|
686
|
+
searchList,
|
|
687
|
+
loading,
|
|
688
|
+
breadcrumbs,
|
|
689
|
+
breadcrumbsSeparator = '-',
|
|
690
|
+
breadcrumbsList = [],
|
|
691
|
+
fieldConfig,
|
|
692
|
+
onClickBreadcrumbs,
|
|
693
|
+
onLevel,
|
|
694
|
+
onSelect,
|
|
695
|
+
onLoad,
|
|
696
|
+
onAllCheck,
|
|
697
|
+
onSearch,
|
|
698
|
+
onRefresh
|
|
699
|
+
} = props;
|
|
700
|
+
const intl = useFormatMessage('Selector', localeJson);
|
|
701
|
+
const [showSearch, setShowSearch] = useState(false); // 显示搜索/
|
|
702
|
+
const [searchStr, setSearchStr] = useState('');
|
|
703
|
+
const constData = useRef({
|
|
743
704
|
searchTimer: null,
|
|
744
705
|
searchStr: ''
|
|
745
706
|
});
|
|
746
|
-
useEffect(
|
|
707
|
+
useEffect(() => {
|
|
747
708
|
if (!searchVal) return;
|
|
748
709
|
constData.current.searchStr = searchVal.val;
|
|
749
710
|
setSearchStr(searchVal.val);
|
|
750
711
|
if (searchVal.val !== '') setShowSearch(true);
|
|
751
712
|
}, [searchVal]);
|
|
752
713
|
/** 改变搜索框 */
|
|
753
|
-
|
|
714
|
+
const changeSearch = val => {
|
|
754
715
|
setSearchStr(val);
|
|
755
716
|
constData.current.searchStr = val;
|
|
756
717
|
if (searchTrigger !== 'onEnter') onSearchCom();
|
|
757
718
|
};
|
|
758
719
|
/** 搜索框回车事件 */
|
|
759
|
-
|
|
720
|
+
const onEnterSearch = () => {
|
|
760
721
|
onSearchCom(true);
|
|
761
722
|
};
|
|
762
723
|
/** 点击搜索按钮 */
|
|
763
|
-
|
|
724
|
+
const onClickRightIcon = () => {
|
|
764
725
|
onSearchCom(true);
|
|
765
726
|
};
|
|
766
727
|
/** 点击清除按钮 */
|
|
767
|
-
|
|
728
|
+
const onClear = () => {
|
|
768
729
|
onSearchCom();
|
|
769
730
|
};
|
|
770
731
|
/** 向外抛出搜索事件 */
|
|
771
|
-
|
|
732
|
+
const onSearchCom = bol => {
|
|
772
733
|
clearTimeout(constData.current.searchTimer);
|
|
773
|
-
constData.current.searchTimer = setTimeout(
|
|
734
|
+
constData.current.searchTimer = setTimeout(() => {
|
|
774
735
|
setShowSearch(!!constData.current.searchStr);
|
|
775
736
|
onSearch && onSearch(constData.current.searchStr, !!bol);
|
|
776
737
|
}, 300);
|
|
777
738
|
};
|
|
778
739
|
/** 搜索dom */
|
|
779
|
-
|
|
780
|
-
|
|
740
|
+
const handSearchDom = () => {
|
|
741
|
+
const handSearchIcon = () => {
|
|
781
742
|
if (!searchStr) {
|
|
782
743
|
// 本地数据且没有自定义刷新事件
|
|
783
744
|
if (!url && !onRefresh) {
|
|
@@ -808,27 +769,23 @@ var SelectorMain = function SelectorMain(props) {
|
|
|
808
769
|
/** 点击下级
|
|
809
770
|
* @param isSearch {boolean}
|
|
810
771
|
* */
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
onLevel && onLevel(item, isSearch);
|
|
819
|
-
};
|
|
772
|
+
const onLevelCom = isSearch => item => {
|
|
773
|
+
if (isSearch) {
|
|
774
|
+
constData.current.searchStr = '';
|
|
775
|
+
setSearchStr('');
|
|
776
|
+
setShowSearch(false);
|
|
777
|
+
}
|
|
778
|
+
onLevel && onLevel(item, isSearch);
|
|
820
779
|
};
|
|
821
780
|
/**
|
|
822
781
|
* 加载更多
|
|
823
782
|
* @param isSearch {boolean} 是否搜索
|
|
824
783
|
* */
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
onLoad && onLoad(isSearch);
|
|
828
|
-
};
|
|
784
|
+
const onLoadCom = isSearch => () => {
|
|
785
|
+
onLoad && onLoad(isSearch);
|
|
829
786
|
};
|
|
830
787
|
/** 渲染列表 */
|
|
831
|
-
|
|
788
|
+
const handListDom = () => {
|
|
832
789
|
return jsx(SelectorMainContent, {
|
|
833
790
|
className: "selector-main-list-box",
|
|
834
791
|
value: value,
|
|
@@ -857,7 +814,7 @@ var SelectorMain = function SelectorMain(props) {
|
|
|
857
814
|
}, "list");
|
|
858
815
|
};
|
|
859
816
|
/** 渲染搜索列表 */
|
|
860
|
-
|
|
817
|
+
const handSearchList = () => {
|
|
861
818
|
if (!showSearch) return;
|
|
862
819
|
return jsx(SelectorMainContent, {
|
|
863
820
|
className: 'selector-main-search-content',
|
|
@@ -882,14 +839,14 @@ var SelectorMain = function SelectorMain(props) {
|
|
|
882
839
|
}, "search");
|
|
883
840
|
};
|
|
884
841
|
/** 处理loading */
|
|
885
|
-
|
|
842
|
+
const handLoading = () => {
|
|
886
843
|
if (searchLoading || loading) {
|
|
887
844
|
return jsx(Loading, {});
|
|
888
845
|
}
|
|
889
846
|
};
|
|
890
847
|
// 处理class
|
|
891
|
-
|
|
892
|
-
|
|
848
|
+
const handClass = () => {
|
|
849
|
+
let str = "".concat($prefixCls, "-selector-main");
|
|
893
850
|
if (className) str += " ".concat(className);
|
|
894
851
|
if (selectMode === 'check') str += " ".concat($prefixCls, "-selector-main-select");
|
|
895
852
|
if (showSearch) str += " ".concat($prefixCls, "-selector-main-show-search");
|
|
@@ -912,40 +869,38 @@ var SelectorMain = function SelectorMain(props) {
|
|
|
912
869
|
var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-selector-data.paraui-v4-selector-data-node > .selector-data-node-box {\n padding: 10px 0 10px 0;\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-node > .selector-data-node-box > .title {\n font-size: 14px;\n color: rgb(29, 33, 38);\n padding: 0 10px;\n margin-bottom: 10px;\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-node > .selector-data-node-box > .title > .title-content {\n margin-left: 8px;\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-node > .selector-data-node-box > .content {\n overflow-y: auto;\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-tag > .selector-data-tag-box {\n padding-top: 10px;\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-tag > .selector-data-tag-box > .title {\n font-size: 14px;\n color: rgb(29, 33, 38);\n padding: 0 10px;\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-tag > .selector-data-tag-box > .content {\n padding: 0 10px 10px 10px;\n overflow: auto;\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-tag > .selector-data-tag-box > .content > .content-tag {\n display: inline-flex;\n height: 24px;\n align-items: center;\n padding: 0 10px;\n border-radius: 4px;\n background-color: rgb(234, 236, 241);\n margin-right: 4px;\n margin-top: 4px;\n max-width: calc(100% - 8px);\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-tag > .selector-data-tag-box > .content > .content-tag > span {\n font-size: 14px;\n color: rgb(29, 33, 38);\n overflow: hidden;\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-tag > .selector-data-tag-box > .content > .content-tag > svg {\n font-size: 16px;\n margin-left: 4px;\n color: rgb(29, 33, 38);\n cursor: pointer;\n}\n.paraui-v4-selector-data.paraui-v4-selector-data-tag > .selector-data-tag-box > .content > .content-tag > svg:hover {\n color: rgb(46, 101, 230);\n}";
|
|
913
870
|
styleInject(css_248z$1);
|
|
914
871
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
layout =
|
|
919
|
-
style
|
|
920
|
-
list
|
|
921
|
-
groupType
|
|
922
|
-
nodeMode
|
|
923
|
-
backDataFieldConfig
|
|
924
|
-
detail
|
|
925
|
-
detailRender
|
|
926
|
-
disabled
|
|
927
|
-
handSelectorNodeInfo
|
|
928
|
-
selectDataTitleRender
|
|
929
|
-
selectRenderItem
|
|
930
|
-
selectRender
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
setListCom = _useState2[1];
|
|
937
|
-
var constData = useRef({
|
|
872
|
+
const SelectorData = props => {
|
|
873
|
+
const {
|
|
874
|
+
className,
|
|
875
|
+
layout = 'node',
|
|
876
|
+
style,
|
|
877
|
+
list,
|
|
878
|
+
groupType,
|
|
879
|
+
nodeMode,
|
|
880
|
+
backDataFieldConfig,
|
|
881
|
+
detail,
|
|
882
|
+
detailRender,
|
|
883
|
+
disabled,
|
|
884
|
+
handSelectorNodeInfo,
|
|
885
|
+
selectDataTitleRender,
|
|
886
|
+
selectRenderItem,
|
|
887
|
+
selectRender,
|
|
888
|
+
onClose
|
|
889
|
+
} = props;
|
|
890
|
+
const intl = useFormatMessage('Selector', localeJson);
|
|
891
|
+
const [listCom, setListCom] = useState({});
|
|
892
|
+
const constData = useRef({
|
|
938
893
|
listTypeJson: {},
|
|
939
894
|
backDataFieldConfig: {}
|
|
940
895
|
});
|
|
941
896
|
constData.current.listTypeJson = ArrayToObject('value', groupType);
|
|
942
897
|
constData.current.backDataFieldConfig = backDataFieldConfig || {};
|
|
943
|
-
useEffect(
|
|
898
|
+
useEffect(() => {
|
|
944
899
|
if (list && groupType && groupType.length > 0) {
|
|
945
|
-
|
|
946
|
-
for (
|
|
947
|
-
|
|
948
|
-
|
|
900
|
+
const json = {};
|
|
901
|
+
for (let i = 0, l = list.length; i < l; i++) {
|
|
902
|
+
const item = list[i];
|
|
903
|
+
const type = item[constData.current.backDataFieldConfig.type || ''];
|
|
949
904
|
if (!json[type]) json[type] = [];
|
|
950
905
|
json[type].push(item);
|
|
951
906
|
}
|
|
@@ -953,12 +908,12 @@ var SelectorData = function SelectorData(props) {
|
|
|
953
908
|
}
|
|
954
909
|
}, [list]);
|
|
955
910
|
/** 处理禁用 */
|
|
956
|
-
|
|
911
|
+
const handDisabled = itemConfig => {
|
|
957
912
|
if (disabled) {
|
|
958
913
|
if (disabled === true) return true;
|
|
959
914
|
if (disabled instanceof Array) {
|
|
960
|
-
|
|
961
|
-
|
|
915
|
+
const keyStr = (backDataFieldConfig === null || backDataFieldConfig === void 0 ? void 0 : backDataFieldConfig.key) || '';
|
|
916
|
+
const val = itemConfig[keyStr];
|
|
962
917
|
if (disabled.indexOf(val) !== -1) {
|
|
963
918
|
return true;
|
|
964
919
|
}
|
|
@@ -967,56 +922,40 @@ var SelectorData = function SelectorData(props) {
|
|
|
967
922
|
return false;
|
|
968
923
|
};
|
|
969
924
|
/** 处理每个节点的配置 */
|
|
970
|
-
|
|
971
|
-
|
|
925
|
+
const handNodeConfig = (itemConfig, index) => {
|
|
926
|
+
let item = itemConfig;
|
|
972
927
|
if (handSelectorNodeInfo) item = handSelectorNodeInfo(itemConfig);
|
|
973
|
-
|
|
974
|
-
|
|
928
|
+
const disabledItem = handDisabled(itemConfig);
|
|
929
|
+
const json = {
|
|
975
930
|
useCase: 'edit',
|
|
976
931
|
close: !disabledItem,
|
|
977
|
-
detail
|
|
932
|
+
detail,
|
|
978
933
|
data: item,
|
|
979
|
-
nodeMode
|
|
980
|
-
onClose:
|
|
981
|
-
return _onClose && _onClose(item, index);
|
|
982
|
-
},
|
|
934
|
+
nodeMode,
|
|
935
|
+
onClose: () => onClose && onClose(item, index),
|
|
983
936
|
disabled: handDisabled(itemConfig),
|
|
984
937
|
tagStyle: item.tagStyle
|
|
985
938
|
};
|
|
986
939
|
if (selectRenderItem) {
|
|
987
|
-
json.leftRender =
|
|
940
|
+
json.leftRender = () => {
|
|
988
941
|
return selectRenderItem(itemConfig);
|
|
989
942
|
};
|
|
990
943
|
}
|
|
991
944
|
/** 节点类型 */
|
|
992
945
|
if (item.leaf !== undefined) json.nodeMode = item.leaf ? 'leaf' : 'branch';
|
|
993
946
|
/** 渲染字段 */
|
|
994
|
-
|
|
995
|
-
for (
|
|
996
|
-
|
|
997
|
-
|
|
947
|
+
const arr = ['img', 'mainTitle', 'subTitle', 'tag'];
|
|
948
|
+
for (let i = 0, l = arr.length; i < l; i++) {
|
|
949
|
+
const key = arr[i] || '';
|
|
950
|
+
const backName = backDataFieldConfig && backDataFieldConfig[key] || '';
|
|
998
951
|
json[key] = item[backName];
|
|
999
952
|
}
|
|
1000
953
|
/** 详情render */
|
|
1001
954
|
if (detailRender) {
|
|
1002
|
-
json.detailRender = function () {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1007
|
-
case 0:
|
|
1008
|
-
_context.next = 2;
|
|
1009
|
-
return detailRender(item, false);
|
|
1010
|
-
case 2:
|
|
1011
|
-
Dom = _context.sent;
|
|
1012
|
-
return _context.abrupt("return", Dom);
|
|
1013
|
-
case 4:
|
|
1014
|
-
case "end":
|
|
1015
|
-
return _context.stop();
|
|
1016
|
-
}
|
|
1017
|
-
}, _callee);
|
|
1018
|
-
}));
|
|
1019
|
-
};
|
|
955
|
+
json.detailRender = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
956
|
+
const Dom = yield detailRender(item, false);
|
|
957
|
+
return Dom;
|
|
958
|
+
});
|
|
1020
959
|
}
|
|
1021
960
|
if (item.detail !== undefined) json.detail = item.detail;
|
|
1022
961
|
/** 是否具有删除 */
|
|
@@ -1024,23 +963,23 @@ var SelectorData = function SelectorData(props) {
|
|
|
1024
963
|
return json;
|
|
1025
964
|
};
|
|
1026
965
|
/** 处理节点 */
|
|
1027
|
-
|
|
966
|
+
const handNode = () => {
|
|
1028
967
|
if (selectRender) {
|
|
1029
968
|
return selectRender(list || []);
|
|
1030
969
|
}
|
|
1031
|
-
return list === null || list === void 0 ? void 0 : list.map(
|
|
970
|
+
return list === null || list === void 0 ? void 0 : list.map((item, index) => {
|
|
1032
971
|
return jsx(SelectorNode, Object.assign({}, handNodeConfig(item, index)), index);
|
|
1033
972
|
});
|
|
1034
973
|
};
|
|
1035
974
|
/** 处理标题 */
|
|
1036
|
-
|
|
1037
|
-
|
|
975
|
+
const handTitle = () => {
|
|
976
|
+
const handTitleTag = () => {
|
|
1038
977
|
if (selectDataTitleRender) return selectDataTitleRender(list);
|
|
1039
978
|
if (groupType) {
|
|
1040
979
|
return jsx(Fragment, {
|
|
1041
|
-
children: groupType.map(
|
|
1042
|
-
|
|
1043
|
-
|
|
980
|
+
children: groupType.map((item, index) => {
|
|
981
|
+
let num = 0;
|
|
982
|
+
const val = item.value;
|
|
1044
983
|
if (listCom[val]) num = listCom[val].length;
|
|
1045
984
|
if (num === 0) return;
|
|
1046
985
|
return jsxs("span", Object.assign({
|
|
@@ -1065,7 +1004,7 @@ var SelectorData = function SelectorData(props) {
|
|
|
1065
1004
|
}));
|
|
1066
1005
|
};
|
|
1067
1006
|
// 处理节点内容
|
|
1068
|
-
|
|
1007
|
+
const handContentNode = () => {
|
|
1069
1008
|
return jsxs("div", Object.assign({
|
|
1070
1009
|
className: "selector-data-node-box"
|
|
1071
1010
|
}, {
|
|
@@ -1077,13 +1016,13 @@ var SelectorData = function SelectorData(props) {
|
|
|
1077
1016
|
}));
|
|
1078
1017
|
};
|
|
1079
1018
|
// 处理内容
|
|
1080
|
-
|
|
1019
|
+
const handDetailTagContent = () => {
|
|
1081
1020
|
if (selectRender) {
|
|
1082
1021
|
return selectRender(list || []);
|
|
1083
1022
|
}
|
|
1084
1023
|
return jsx(Fragment, {
|
|
1085
|
-
children: list === null || list === void 0 ? void 0 : list.map(
|
|
1086
|
-
|
|
1024
|
+
children: list === null || list === void 0 ? void 0 : list.map((item, index) => {
|
|
1025
|
+
const disabledItem = handDisabled(item);
|
|
1087
1026
|
return jsxs("span", Object.assign({
|
|
1088
1027
|
className: "content-tag"
|
|
1089
1028
|
}, {
|
|
@@ -1092,16 +1031,14 @@ var SelectorData = function SelectorData(props) {
|
|
|
1092
1031
|
children: item[(backDataFieldConfig === null || backDataFieldConfig === void 0 ? void 0 : backDataFieldConfig.mainTitle) || ''] || item[(backDataFieldConfig === null || backDataFieldConfig === void 0 ? void 0 : backDataFieldConfig.key) || '']
|
|
1093
1032
|
})
|
|
1094
1033
|
}), !disabledItem && jsx(CloseIcon, {
|
|
1095
|
-
onClick:
|
|
1096
|
-
return _onClose && _onClose(item, index);
|
|
1097
|
-
}
|
|
1034
|
+
onClick: () => onClose && onClose(item, index)
|
|
1098
1035
|
})]
|
|
1099
1036
|
}), index);
|
|
1100
1037
|
})
|
|
1101
1038
|
});
|
|
1102
1039
|
};
|
|
1103
1040
|
// 处理tag内容
|
|
1104
|
-
|
|
1041
|
+
const handContentTag = () => {
|
|
1105
1042
|
return jsxs("div", Object.assign({
|
|
1106
1043
|
className: "selector-data-tag-box"
|
|
1107
1044
|
}, {
|
|
@@ -1112,8 +1049,8 @@ var SelectorData = function SelectorData(props) {
|
|
|
1112
1049
|
}))]
|
|
1113
1050
|
}));
|
|
1114
1051
|
};
|
|
1115
|
-
|
|
1116
|
-
|
|
1052
|
+
const handClass = () => {
|
|
1053
|
+
let str = "".concat($prefixCls, "-selector-data");
|
|
1117
1054
|
if (layout) str += " ".concat($prefixCls, "-selector-data-").concat(layout);
|
|
1118
1055
|
if (disabled === true) str += " ".concat($prefixCls, "-selector-data-disabled");
|
|
1119
1056
|
if (className) str += " ".concat(className);
|
|
@@ -1131,9 +1068,11 @@ var SelectorData = function SelectorData(props) {
|
|
|
1131
1068
|
* 发送请求
|
|
1132
1069
|
* @param obj {ReqFuncProps} 请求信息
|
|
1133
1070
|
*/
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1071
|
+
const reqFunc = obj => {
|
|
1072
|
+
const {
|
|
1073
|
+
method,
|
|
1074
|
+
data
|
|
1075
|
+
} = obj,
|
|
1137
1076
|
otherProps = __rest(obj, ["method", "data"]);
|
|
1138
1077
|
if (method === 'Get') {
|
|
1139
1078
|
return Get(Object.assign({
|
|
@@ -1142,7 +1081,7 @@ var reqFunc = function reqFunc(obj) {
|
|
|
1142
1081
|
}
|
|
1143
1082
|
if (method === 'Post') {
|
|
1144
1083
|
return Post(Object.assign({
|
|
1145
|
-
data
|
|
1084
|
+
data
|
|
1146
1085
|
}, otherProps));
|
|
1147
1086
|
}
|
|
1148
1087
|
};
|
|
@@ -1150,8 +1089,8 @@ var reqFunc = function reqFunc(obj) {
|
|
|
1150
1089
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-selector {\n border: 1px solid rgb(212, 218, 227);\n border-radius: 4px;\n display: flex;\n height: 100%;\n width: 100%;\n overflow: hidden;\n}\n.paraui-v4-selector svg {\n overflow: hidden;\n}\n.paraui-v4-selector.paraui-v4-selector-lr > .paraui-v4-selector-main {\n width: 50%;\n}\n.paraui-v4-selector.paraui-v4-selector-lr > .paraui-v4-selector-data {\n width: 50%;\n border-left: 1px solid rgb(234, 236, 241);\n}\n.paraui-v4-selector.paraui-v4-selector-tb {\n flex-direction: column;\n}\n.paraui-v4-selector.paraui-v4-selector-tb > .paraui-v4-selector-data {\n border-bottom: 1px solid rgb(212, 218, 227);\n max-height: 100px;\n}\n.paraui-v4-selector.paraui-v4-selector-tb > .paraui-v4-selector-main {\n overflow-y: auto;\n height: auto;\n flex: 1;\n}";
|
|
1151
1090
|
styleInject(css_248z);
|
|
1152
1091
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1092
|
+
const handFieldConfig = (fieldConfig, rowKey) => {
|
|
1093
|
+
const json = Object.assign({
|
|
1155
1094
|
mainTitle: 'label',
|
|
1156
1095
|
children: 'children',
|
|
1157
1096
|
parentId: 'parentId',
|
|
@@ -1160,108 +1099,64 @@ var handFieldConfig = function handFieldConfig(fieldConfig, rowKey) {
|
|
|
1160
1099
|
}, fieldConfig);
|
|
1161
1100
|
return json;
|
|
1162
1101
|
};
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
className
|
|
1166
|
-
style
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
setCurrentData = _useState2[1]; // 当前展示的数据
|
|
1222
|
-
var _useState3 = useState(false),
|
|
1223
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1224
|
-
loadMore = _useState4[0],
|
|
1225
|
-
setLoadMore = _useState4[1]; // 加载更多
|
|
1226
|
-
var _useState5 = useState([]),
|
|
1227
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1228
|
-
valueCom = _useState6[0],
|
|
1229
|
-
setValueCom = _useState6[1]; // 绑定的值
|
|
1230
|
-
var _useState7 = useState({}),
|
|
1231
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
1232
|
-
valueJsonCom = _useState8[0],
|
|
1233
|
-
setValueJsonCom = _useState8[1]; // 绑定的值,json
|
|
1234
|
-
var _useState9 = useState([]),
|
|
1235
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
1236
|
-
breadcrumbsList = _useState10[0],
|
|
1237
|
-
setBreadcrumbsList = _useState10[1]; // 面包屑
|
|
1238
|
-
var _useState11 = useState(false),
|
|
1239
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
1240
|
-
searchLoading = _useState12[0],
|
|
1241
|
-
setSearchLoading = _useState12[1]; // 搜索loading
|
|
1242
|
-
var _useState13 = useState({
|
|
1243
|
-
val: ''
|
|
1244
|
-
}),
|
|
1245
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
1246
|
-
searchVal = _useState14[0],
|
|
1247
|
-
setSearchVal = _useState14[1]; // 搜索值
|
|
1248
|
-
var _useState15 = useState([]),
|
|
1249
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
1250
|
-
searchList = _useState16[0],
|
|
1251
|
-
setSearchList = _useState16[1]; // 搜索数据
|
|
1252
|
-
var _useState17 = useState(false),
|
|
1253
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
1254
|
-
searchLoadMore = _useState18[0],
|
|
1255
|
-
setSearchLoadMore = _useState18[1]; // 是否显示搜索的加载更多按钮
|
|
1256
|
-
var _useState19 = useState(true),
|
|
1257
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
1258
|
-
loadingCom = _useState20[0],
|
|
1259
|
-
setLoadingCom = _useState20[1];
|
|
1260
|
-
var _useState21 = useState(),
|
|
1261
|
-
_useState22 = _slicedToArray(_useState21, 2),
|
|
1262
|
-
refreshCom = _useState22[0],
|
|
1263
|
-
setRefreshCom = _useState22[1];
|
|
1264
|
-
var constData = useRef({
|
|
1102
|
+
const Selector = props => {
|
|
1103
|
+
const {
|
|
1104
|
+
className,
|
|
1105
|
+
style,
|
|
1106
|
+
rowKey = 'key',
|
|
1107
|
+
layout = 'lr',
|
|
1108
|
+
nodeMode = 'branch',
|
|
1109
|
+
selectMode,
|
|
1110
|
+
refresh,
|
|
1111
|
+
ctx,
|
|
1112
|
+
url,
|
|
1113
|
+
method = 'Get',
|
|
1114
|
+
value,
|
|
1115
|
+
defaultValue,
|
|
1116
|
+
data,
|
|
1117
|
+
pagination = false,
|
|
1118
|
+
size = 10,
|
|
1119
|
+
isLazy = false,
|
|
1120
|
+
isAllCheck = true,
|
|
1121
|
+
disabled,
|
|
1122
|
+
disabledChild,
|
|
1123
|
+
detail,
|
|
1124
|
+
detailRender,
|
|
1125
|
+
backDataFieldConfig,
|
|
1126
|
+
search,
|
|
1127
|
+
searchPlaceholder,
|
|
1128
|
+
searchTrigger = 'onChange',
|
|
1129
|
+
breadcrumbs = true,
|
|
1130
|
+
breadcrumbsSeparator,
|
|
1131
|
+
breadcrumbsHead,
|
|
1132
|
+
showbreadcrumbsHead = true,
|
|
1133
|
+
groupType,
|
|
1134
|
+
groupRange = 'search',
|
|
1135
|
+
emptyProps,
|
|
1136
|
+
selectRenderItem,
|
|
1137
|
+
selectRender,
|
|
1138
|
+
onChange,
|
|
1139
|
+
onSelect,
|
|
1140
|
+
onSearch,
|
|
1141
|
+
onRefresh
|
|
1142
|
+
} = useGlobalProps(props, 'Selector');
|
|
1143
|
+
const intl = useFormatMessage('Selector', localeJson);
|
|
1144
|
+
const fieldConfigHand = handFieldConfig(props.fieldConfig, rowKey); // 字段配置,对应数据字段
|
|
1145
|
+
const selectorFieldConfigHand = Object.assign(Object.assign({}, fieldConfigHand), backDataFieldConfig); // 选中值字段配置,对应数据字段
|
|
1146
|
+
const [currentData, setCurrentData] = useState([]); // 当前展示的数据
|
|
1147
|
+
const [loadMore, setLoadMore] = useState(false); // 加载更多
|
|
1148
|
+
const [valueCom, setValueCom] = useState([]); // 绑定的值
|
|
1149
|
+
const [valueJsonCom, setValueJsonCom] = useState({}); // 绑定的值,json
|
|
1150
|
+
const [breadcrumbsList, setBreadcrumbsList] = useState([]); // 面包屑
|
|
1151
|
+
const [searchLoading, setSearchLoading] = useState(false); // 搜索loading
|
|
1152
|
+
const [searchVal, setSearchVal] = useState({
|
|
1153
|
+
val: ''
|
|
1154
|
+
}); // 搜索值
|
|
1155
|
+
const [searchList, setSearchList] = useState([]); // 搜索数据
|
|
1156
|
+
const [searchLoadMore, setSearchLoadMore] = useState(false); // 是否显示搜索的加载更多按钮
|
|
1157
|
+
const [loadingCom, setLoadingCom] = useState(true);
|
|
1158
|
+
const [refreshCom, setRefreshCom] = useState();
|
|
1159
|
+
const constData = useRef({
|
|
1265
1160
|
/** 对象集合 所有的 */
|
|
1266
1161
|
jsonData: {},
|
|
1267
1162
|
/** 浅拷贝对象 所有的 */
|
|
@@ -1305,43 +1200,43 @@ var Selector = function Selector(props) {
|
|
|
1305
1200
|
constData.current.reqParams.pagination = pagination;
|
|
1306
1201
|
constData.current.reqParams.isLazy = isLazy;
|
|
1307
1202
|
// 本地数据 有接口的全量数据 -> 走本地数据逻辑
|
|
1308
|
-
|
|
1309
|
-
useEffect(
|
|
1203
|
+
const isReqLocalData = props.data || !constData.current.reqParams.isLazy && constData.current.noLazyReq;
|
|
1204
|
+
useEffect(() => {
|
|
1310
1205
|
if (defaultValue !== undefined) handValue(defaultValue);
|
|
1311
|
-
return
|
|
1206
|
+
return () => {
|
|
1312
1207
|
clearTimeout(constData.current.reqTimer);
|
|
1313
1208
|
};
|
|
1314
1209
|
}, []);
|
|
1315
|
-
useEffect(
|
|
1210
|
+
useEffect(() => {
|
|
1316
1211
|
if (value !== undefined) handValue(value);
|
|
1317
1212
|
}, [value]);
|
|
1318
1213
|
// 处理源数据
|
|
1319
|
-
useEffect(
|
|
1214
|
+
useEffect(() => {
|
|
1320
1215
|
if (data) {
|
|
1321
|
-
|
|
1216
|
+
const treeData = convertTree(data, false);
|
|
1322
1217
|
constData.current.oneDataList = treeData;
|
|
1323
1218
|
constData.current.currentSourceData = treeData;
|
|
1324
1219
|
setBreadcrumbsList([]);
|
|
1325
1220
|
handInitCurrent();
|
|
1326
1221
|
}
|
|
1327
1222
|
}, [data]);
|
|
1328
|
-
useEffect(
|
|
1223
|
+
useEffect(() => {
|
|
1329
1224
|
if (url) {
|
|
1330
1225
|
setBreadcrumbsList([]);
|
|
1331
1226
|
handInitCurrent();
|
|
1332
1227
|
}
|
|
1333
1228
|
}, [url]);
|
|
1334
1229
|
// 请求数据
|
|
1335
|
-
useEffect(
|
|
1230
|
+
useEffect(() => {
|
|
1336
1231
|
clearTimeout(constData.current.reqTimer);
|
|
1337
1232
|
if (props.url) Cancel(constData.current.reqId);
|
|
1338
|
-
constData.current.reqTimer = setTimeout(
|
|
1233
|
+
constData.current.reqTimer = setTimeout(() => {
|
|
1339
1234
|
// 本地数据 不是懒加载的全量接口数据
|
|
1340
1235
|
if (isReqLocalData) {
|
|
1341
|
-
|
|
1236
|
+
const currentSourceData = constData.current.currentSourceData;
|
|
1342
1237
|
if (constData.current.reqParams.pagination) {
|
|
1343
1238
|
// 分页
|
|
1344
|
-
|
|
1239
|
+
const sliceData = currentSourceData.slice(0, constData.current.page * constData.current.reqParams.size);
|
|
1345
1240
|
setCurrentData(sliceData);
|
|
1346
1241
|
// 没有加载更多
|
|
1347
1242
|
if (constData.current.page * constData.current.reqParams.size >= currentSourceData.length) {
|
|
@@ -1357,10 +1252,10 @@ var Selector = function Selector(props) {
|
|
|
1357
1252
|
}
|
|
1358
1253
|
// 远程数据
|
|
1359
1254
|
if (props.url) {
|
|
1360
|
-
|
|
1361
|
-
method
|
|
1255
|
+
const obj = {
|
|
1256
|
+
method,
|
|
1362
1257
|
url: props.url,
|
|
1363
|
-
ctx
|
|
1258
|
+
ctx,
|
|
1364
1259
|
uuid: constData.current.reqId,
|
|
1365
1260
|
data: Object.assign({
|
|
1366
1261
|
parentId: handParentId()
|
|
@@ -1381,11 +1276,11 @@ var Selector = function Selector(props) {
|
|
|
1381
1276
|
}
|
|
1382
1277
|
}, 50);
|
|
1383
1278
|
}, [refreshCom]);
|
|
1384
|
-
useEffect(
|
|
1279
|
+
useEffect(() => {
|
|
1385
1280
|
if (refresh) refreshFunc();
|
|
1386
1281
|
}, [refresh]);
|
|
1387
1282
|
/** 刷新 */
|
|
1388
|
-
|
|
1283
|
+
const refreshFunc = () => {
|
|
1389
1284
|
if (!isReqLocalData) {
|
|
1390
1285
|
constData.current.currentSourceData = [];
|
|
1391
1286
|
}
|
|
@@ -1396,8 +1291,8 @@ var Selector = function Selector(props) {
|
|
|
1396
1291
|
* @param item 节点数据
|
|
1397
1292
|
* @param bol 是否是搜索
|
|
1398
1293
|
* */
|
|
1399
|
-
|
|
1400
|
-
|
|
1294
|
+
const handNodeData = (item, bol) => {
|
|
1295
|
+
let itemData = {
|
|
1401
1296
|
key: item[rowKey],
|
|
1402
1297
|
parentId: item[fieldConfigHand.parentId],
|
|
1403
1298
|
type: item[fieldConfigHand.type],
|
|
@@ -1424,17 +1319,17 @@ var Selector = function Selector(props) {
|
|
|
1424
1319
|
* @param notTree true不生成树
|
|
1425
1320
|
* @param isSearch 是否搜索
|
|
1426
1321
|
* */
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1322
|
+
const convertTree = (arr, notTree, isSearch) => {
|
|
1323
|
+
const handArr = [];
|
|
1324
|
+
const json = {};
|
|
1430
1325
|
// 生成mappingd对象
|
|
1431
|
-
|
|
1432
|
-
for (
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1326
|
+
const recurrence = list => {
|
|
1327
|
+
for (let i = 0, l = list.length; i < l; i++) {
|
|
1328
|
+
const item = list[i];
|
|
1329
|
+
const keyStr = item[rowKey];
|
|
1330
|
+
const itemData = handNodeData(item, !!isSearch);
|
|
1436
1331
|
json[keyStr] = itemData;
|
|
1437
|
-
|
|
1332
|
+
const childrenName = fieldConfigHand.children;
|
|
1438
1333
|
constData.current.jsonDataCopy[keyStr] = item; // 原始数据
|
|
1439
1334
|
constData.current.jsonData[keyStr] = itemData; // 处理过的数据
|
|
1440
1335
|
if (item[childrenName]) {
|
|
@@ -1444,11 +1339,11 @@ var Selector = function Selector(props) {
|
|
|
1444
1339
|
};
|
|
1445
1340
|
recurrence(arr);
|
|
1446
1341
|
// 生成tree数据
|
|
1447
|
-
|
|
1448
|
-
for (
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1342
|
+
const arrKey = Object.keys(json);
|
|
1343
|
+
for (let i = 0, l = arrKey.length; i < l; i++) {
|
|
1344
|
+
const keyStr = arrKey[i];
|
|
1345
|
+
const item = json[keyStr];
|
|
1346
|
+
const parentId = item.parentId || '';
|
|
1452
1347
|
if (notTree) {
|
|
1453
1348
|
handArr.push(item);
|
|
1454
1349
|
continue;
|
|
@@ -1463,12 +1358,12 @@ var Selector = function Selector(props) {
|
|
|
1463
1358
|
return handArr;
|
|
1464
1359
|
};
|
|
1465
1360
|
/** 处理parentId */
|
|
1466
|
-
|
|
1467
|
-
|
|
1361
|
+
const handParentId = () => {
|
|
1362
|
+
let parentId;
|
|
1468
1363
|
// 面包屑最后一项做parent
|
|
1469
1364
|
if (constData.current.breadcrumbsList.length > 0) {
|
|
1470
1365
|
// 包含了根,所以要多加1
|
|
1471
|
-
|
|
1366
|
+
const item = constData.current.breadcrumbsList[constData.current.breadcrumbsList.length - 1];
|
|
1472
1367
|
parentId = item.value;
|
|
1473
1368
|
} else {
|
|
1474
1369
|
if (props.breadcrumbsHead) parentId = props.breadcrumbsHead.value; // 根
|
|
@@ -1478,67 +1373,47 @@ var Selector = function Selector(props) {
|
|
|
1478
1373
|
parentId = undefined;
|
|
1479
1374
|
if (props.breadcrumbsHead) parentId = props.breadcrumbsHead.value; // 根
|
|
1480
1375
|
}
|
|
1481
|
-
|
|
1482
1376
|
return parentId;
|
|
1483
1377
|
};
|
|
1484
1378
|
/** 请求 */
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
if (!err) {
|
|
1499
|
-
_context.next = 10;
|
|
1500
|
-
break;
|
|
1501
|
-
}
|
|
1502
|
-
setLoadingCom(false);
|
|
1503
|
-
if (constData.current.reqParams.isLazy) {
|
|
1504
|
-
// 懒加载
|
|
1505
|
-
if (constData.current.reqParams.pagination) {
|
|
1506
|
-
// 分页 第一页不处理
|
|
1507
|
-
if (constData.current.page !== 1) constData.current.page = constData.current.page - 1;
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
return _context.abrupt("return");
|
|
1511
|
-
case 10:
|
|
1512
|
-
if (!props.requestCallback) {
|
|
1513
|
-
_context.next = 13;
|
|
1514
|
-
break;
|
|
1515
|
-
}
|
|
1516
|
-
props.requestCallback(data, function (handData) {
|
|
1517
|
-
setLoadingCom(false);
|
|
1518
|
-
handReqData(handData);
|
|
1519
|
-
});
|
|
1520
|
-
return _context.abrupt("return");
|
|
1521
|
-
case 13:
|
|
1522
|
-
setLoadingCom(false);
|
|
1523
|
-
handReqData(data);
|
|
1524
|
-
case 15:
|
|
1525
|
-
case "end":
|
|
1526
|
-
return _context.stop();
|
|
1379
|
+
const handReq = obj => __awaiter(void 0, void 0, void 0, function* () {
|
|
1380
|
+
setLoadingCom(true);
|
|
1381
|
+
const {
|
|
1382
|
+
data,
|
|
1383
|
+
err
|
|
1384
|
+
} = yield reqFunc(obj);
|
|
1385
|
+
if (err) {
|
|
1386
|
+
setLoadingCom(false);
|
|
1387
|
+
if (constData.current.reqParams.isLazy) {
|
|
1388
|
+
// 懒加载
|
|
1389
|
+
if (constData.current.reqParams.pagination) {
|
|
1390
|
+
// 分页 第一页不处理
|
|
1391
|
+
if (constData.current.page !== 1) constData.current.page = constData.current.page - 1;
|
|
1527
1392
|
}
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
|
|
1393
|
+
}
|
|
1394
|
+
return;
|
|
1395
|
+
}
|
|
1396
|
+
if (props.requestCallback) {
|
|
1397
|
+
props.requestCallback(data, handData => {
|
|
1398
|
+
setLoadingCom(false);
|
|
1399
|
+
handReqData(handData);
|
|
1400
|
+
});
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
setLoadingCom(false);
|
|
1404
|
+
handReqData(data);
|
|
1405
|
+
});
|
|
1531
1406
|
/** 接口回来处理数据 */
|
|
1532
|
-
|
|
1407
|
+
const handReqData = resultData => {
|
|
1533
1408
|
if (constData.current.reqParams.isLazy) {
|
|
1534
1409
|
// 懒加载
|
|
1535
1410
|
if (constData.current.reqParams.pagination) {
|
|
1536
1411
|
// 分页
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1412
|
+
const result = resultData.data || {};
|
|
1413
|
+
const arr = result.list || [];
|
|
1414
|
+
const total = result.total;
|
|
1415
|
+
const arrHand = convertTree(arr, true);
|
|
1416
|
+
const currentD = [...constData.current.currentSourceData, ...arrHand];
|
|
1542
1417
|
constData.current.currentSourceData = currentD;
|
|
1543
1418
|
setCurrentData(currentD);
|
|
1544
1419
|
if (constData.current.page * constData.current.reqParams.size >= total) {
|
|
@@ -1548,45 +1423,45 @@ var Selector = function Selector(props) {
|
|
|
1548
1423
|
}
|
|
1549
1424
|
} else {
|
|
1550
1425
|
// 不分页 必须返回平铺的数组
|
|
1551
|
-
|
|
1552
|
-
|
|
1426
|
+
const arr = resultData.data || [];
|
|
1427
|
+
const treeData = convertTree(arr, true);
|
|
1553
1428
|
constData.current.currentSourceData = treeData;
|
|
1554
1429
|
setCurrentData(treeData);
|
|
1555
1430
|
}
|
|
1556
1431
|
} else {
|
|
1557
1432
|
// 不是懒加载 只请求一次
|
|
1558
1433
|
constData.current.noLazyReq = true;
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
constData.current.oneDataList =
|
|
1562
|
-
constData.current.currentSourceData =
|
|
1434
|
+
const arr = resultData.data || [];
|
|
1435
|
+
const treeData = convertTree(arr, false);
|
|
1436
|
+
constData.current.oneDataList = treeData; // 第一层数据
|
|
1437
|
+
constData.current.currentSourceData = treeData;
|
|
1563
1438
|
handInitCurrent();
|
|
1564
1439
|
}
|
|
1565
1440
|
};
|
|
1566
1441
|
/** 当前页初始更新 */
|
|
1567
|
-
|
|
1442
|
+
const handInitCurrent = () => {
|
|
1568
1443
|
constData.current.page = 1;
|
|
1569
1444
|
setRefreshCom(Math.random());
|
|
1570
1445
|
};
|
|
1571
1446
|
/** 处理value */
|
|
1572
|
-
|
|
1573
|
-
|
|
1447
|
+
const handValue = val => {
|
|
1448
|
+
let handVal = !val ? [] : [val];
|
|
1574
1449
|
if (val instanceof Array) {
|
|
1575
|
-
handVal =
|
|
1450
|
+
handVal = [...val];
|
|
1576
1451
|
}
|
|
1577
|
-
|
|
1452
|
+
const json = ArrayToObject(selectorFieldConfigHand.key, handVal);
|
|
1578
1453
|
constData.current.selectValueJson = json;
|
|
1579
1454
|
setValueJsonCom(json);
|
|
1580
|
-
setValueCom(
|
|
1455
|
+
setValueCom([...handVal]);
|
|
1581
1456
|
};
|
|
1582
1457
|
/** 点击下级,添加面包屑 */
|
|
1583
|
-
|
|
1584
|
-
|
|
1458
|
+
const onLevelAddBreadcrumbs = (item, isSearch) => {
|
|
1459
|
+
let arr = [...breadcrumbsList];
|
|
1585
1460
|
if (isSearch) {
|
|
1586
1461
|
arr = [];
|
|
1587
1462
|
if (constData.current.beforeSearchBreadcrumbs === null) {
|
|
1588
1463
|
// 记录搜索之前的面包屑
|
|
1589
|
-
constData.current.beforeSearchBreadcrumbs =
|
|
1464
|
+
constData.current.beforeSearchBreadcrumbs = [...breadcrumbsList];
|
|
1590
1465
|
}
|
|
1591
1466
|
}
|
|
1592
1467
|
arr.push({
|
|
@@ -1596,7 +1471,7 @@ var Selector = function Selector(props) {
|
|
|
1596
1471
|
setBreadcrumbsList(arr);
|
|
1597
1472
|
};
|
|
1598
1473
|
/** 点击下级 */
|
|
1599
|
-
|
|
1474
|
+
const onLevelCom = (item, isSearch) => {
|
|
1600
1475
|
onLevelAddBreadcrumbs(item, isSearch);
|
|
1601
1476
|
if (isReqLocalData) {
|
|
1602
1477
|
// 本地数据
|
|
@@ -1615,15 +1490,15 @@ var Selector = function Selector(props) {
|
|
|
1615
1490
|
}
|
|
1616
1491
|
};
|
|
1617
1492
|
/** 处理抛出去的数据 */
|
|
1618
|
-
|
|
1619
|
-
|
|
1493
|
+
const handEmitValue = item => {
|
|
1494
|
+
const arr = ['key', 'img', 'mainTitle', 'subTitle', 'tag'];
|
|
1620
1495
|
if (props.groupType && props.groupType.length > 0) {
|
|
1621
1496
|
arr.push('type');
|
|
1622
1497
|
}
|
|
1623
|
-
|
|
1624
|
-
for (
|
|
1625
|
-
|
|
1626
|
-
|
|
1498
|
+
const json = {};
|
|
1499
|
+
for (let i = 0, l = arr.length; i < l; i++) {
|
|
1500
|
+
const arrItem = arr[i];
|
|
1501
|
+
const name = selectorFieldConfigHand[arrItem];
|
|
1627
1502
|
if (name) json[name] = item[arrItem];
|
|
1628
1503
|
}
|
|
1629
1504
|
return json;
|
|
@@ -1635,81 +1510,57 @@ var Selector = function Selector(props) {
|
|
|
1635
1510
|
* @param node 处理过的节点数据
|
|
1636
1511
|
* @param rowData 原始数据节点
|
|
1637
1512
|
* */
|
|
1638
|
-
|
|
1513
|
+
const onChangeEmit = (val, valCom, node, rowData) => {
|
|
1639
1514
|
onChange && onChange(val, node, rowData);
|
|
1640
1515
|
if (value == undefined) {
|
|
1641
1516
|
handValue(!val ? [] : val);
|
|
1642
1517
|
}
|
|
1643
1518
|
};
|
|
1644
1519
|
/** 选择数据 */
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
if (selectMode === 'radio') {
|
|
1676
|
-
json = handEmitValue(item);
|
|
1677
|
-
onChangeEmit(json, [json], constData.current.jsonData[keyStr], constData.current.jsonDataCopy[keyStr]);
|
|
1678
|
-
}
|
|
1679
|
-
// 多选
|
|
1680
|
-
if (selectMode === 'check') {
|
|
1681
|
-
arr = [];
|
|
1682
|
-
node = {}; // 处理过得数据
|
|
1683
|
-
rowData = {}; // 原始数据
|
|
1684
|
-
// 把即将不选中的值,从valueCom里面拿掉
|
|
1685
|
-
for (i = 0, l = valueCom.length; i < l; i++) {
|
|
1686
|
-
valueComItem = valueCom[i]; // 选中valueCom都保留
|
|
1687
|
-
// 不选中 保留valueCom里面的key不等于当前的key
|
|
1688
|
-
if (!selectVal || item.key !== valueComItem[selectorFieldConfigHand.key]) {
|
|
1689
|
-
valueComItemId = valueComItem[selectorFieldConfigHand.key];
|
|
1690
|
-
node[valueComItemId] = constData.current.jsonData[valueComItemId];
|
|
1691
|
-
rowData[valueComItemId] = constData.current.jsonDataCopy[valueComItemId];
|
|
1692
|
-
arr.push(valueComItem);
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
// 不选中 -> 选中
|
|
1696
|
-
if (!selectVal) {
|
|
1697
|
-
_json = handEmitValue(item);
|
|
1698
|
-
node[keyStr] = constData.current.jsonData[keyStr];
|
|
1699
|
-
rowData[keyStr] = constData.current.jsonDataCopy[keyStr];
|
|
1700
|
-
arr.push(_json);
|
|
1701
|
-
}
|
|
1702
|
-
onChangeEmit(arr, arr, node, rowData);
|
|
1703
|
-
}
|
|
1704
|
-
case 12:
|
|
1705
|
-
case "end":
|
|
1706
|
-
return _context2.stop();
|
|
1520
|
+
const onSelectCom = item => __awaiter(void 0, void 0, void 0, function* () {
|
|
1521
|
+
const keyStr = item.key || ''; // key
|
|
1522
|
+
// 单选且选中,点击不触发
|
|
1523
|
+
if (selectMode === 'radio' && valueJsonCom[keyStr]) return;
|
|
1524
|
+
const selectVal = constData.current.selectValueJson[keyStr]; // 存在选中值当中 -> 选中变不选中
|
|
1525
|
+
if (onSelect) {
|
|
1526
|
+
// 有外部选择事件, 且返回true,不触发onChange事件
|
|
1527
|
+
const bol = yield onSelect(item, selectMode === 'radio' ? true : !selectVal, false);
|
|
1528
|
+
if (bol) return;
|
|
1529
|
+
}
|
|
1530
|
+
// 单选
|
|
1531
|
+
if (selectMode === 'radio') {
|
|
1532
|
+
const json = handEmitValue(item);
|
|
1533
|
+
onChangeEmit(json, [json], constData.current.jsonData[keyStr], constData.current.jsonDataCopy[keyStr]);
|
|
1534
|
+
}
|
|
1535
|
+
// 多选
|
|
1536
|
+
if (selectMode === 'check') {
|
|
1537
|
+
const arr = [];
|
|
1538
|
+
const node = {}; // 处理过得数据
|
|
1539
|
+
const rowData = {}; // 原始数据
|
|
1540
|
+
// 把即将不选中的值,从valueCom里面拿掉
|
|
1541
|
+
for (let i = 0, l = valueCom.length; i < l; i++) {
|
|
1542
|
+
const valueComItem = valueCom[i];
|
|
1543
|
+
// 选中valueCom都保留
|
|
1544
|
+
// 不选中 保留valueCom里面的key不等于当前的key
|
|
1545
|
+
if (!selectVal || item.key !== valueComItem[selectorFieldConfigHand.key]) {
|
|
1546
|
+
const valueComItemId = valueComItem[selectorFieldConfigHand.key];
|
|
1547
|
+
node[valueComItemId] = constData.current.jsonData[valueComItemId];
|
|
1548
|
+
rowData[valueComItemId] = constData.current.jsonDataCopy[valueComItemId];
|
|
1549
|
+
arr.push(valueComItem);
|
|
1707
1550
|
}
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
|
|
1551
|
+
}
|
|
1552
|
+
// 不选中 -> 选中
|
|
1553
|
+
if (!selectVal) {
|
|
1554
|
+
const json = handEmitValue(item);
|
|
1555
|
+
node[keyStr] = constData.current.jsonData[keyStr];
|
|
1556
|
+
rowData[keyStr] = constData.current.jsonDataCopy[keyStr];
|
|
1557
|
+
arr.push(json);
|
|
1558
|
+
}
|
|
1559
|
+
onChangeEmit(arr, arr, node, rowData);
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1711
1562
|
/** 处理禁用状态 */
|
|
1712
|
-
|
|
1563
|
+
const handDisabled = item => {
|
|
1713
1564
|
if (disabled) {
|
|
1714
1565
|
if (disabled === true) return true;
|
|
1715
1566
|
if (disabled instanceof Array) {
|
|
@@ -1725,97 +1576,63 @@ var Selector = function Selector(props) {
|
|
|
1725
1576
|
* 点击全选
|
|
1726
1577
|
* @param bol true全选
|
|
1727
1578
|
* */
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
item = arrList[i];
|
|
1749
|
-
keyStr = item.key || '';
|
|
1750
|
-
disabledItem = handDisabled(item);
|
|
1751
|
-
if (!disabledItem) {
|
|
1752
|
-
_context3.next = 14;
|
|
1753
|
-
break;
|
|
1754
|
-
}
|
|
1755
|
-
return _context3.abrupt("continue", 15);
|
|
1756
|
-
case 14:
|
|
1757
|
-
if (bol) {
|
|
1758
|
-
// 全选
|
|
1759
|
-
if (!constData.current.selectValueJson[keyStr]) {
|
|
1760
|
-
// 不存在选中值中
|
|
1761
|
-
arrVal.push(handEmitValue(item));
|
|
1762
|
-
selectEmitData.push(item);
|
|
1763
|
-
}
|
|
1764
|
-
} else {
|
|
1765
|
-
// 全不选
|
|
1766
|
-
if (constData.current.selectValueJson[keyStr]) {
|
|
1767
|
-
// 存在选中值中,拿掉
|
|
1768
|
-
selectArr.push(keyStr);
|
|
1769
|
-
selectEmitData.push(item);
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
case 15:
|
|
1773
|
-
i++;
|
|
1774
|
-
_context3.next = 8;
|
|
1775
|
-
break;
|
|
1776
|
-
case 18:
|
|
1777
|
-
for (_i = 0, _l = arrVal.length; _i < _l; _i++) {
|
|
1778
|
-
_item = arrVal[_i];
|
|
1779
|
-
_keyStr = _item[selectorFieldConfigHand.key];
|
|
1780
|
-
if (bol) {
|
|
1781
|
-
// 全选
|
|
1782
|
-
node[_keyStr] = constData.current.jsonData[_keyStr];
|
|
1783
|
-
rowData[_keyStr] = constData.current.jsonDataCopy[_keyStr];
|
|
1784
|
-
} else {
|
|
1785
|
-
// 全不选
|
|
1786
|
-
if (selectArr.indexOf(_keyStr) === -1) {
|
|
1787
|
-
// 不存在 全不选 - 当前列选中值
|
|
1788
|
-
node[_keyStr] = constData.current.jsonData[_keyStr];
|
|
1789
|
-
rowData[_keyStr] = constData.current.jsonDataCopy[_keyStr];
|
|
1790
|
-
arrval1.push(_item);
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
emitArr = bol ? arrVal : arrval1;
|
|
1795
|
-
if (!onSelect) {
|
|
1796
|
-
_context3.next = 26;
|
|
1797
|
-
break;
|
|
1798
|
-
}
|
|
1799
|
-
_context3.next = 23;
|
|
1800
|
-
return onSelect(selectEmitData, !!bol, false);
|
|
1801
|
-
case 23:
|
|
1802
|
-
flag = _context3.sent;
|
|
1803
|
-
if (!flag) {
|
|
1804
|
-
_context3.next = 26;
|
|
1805
|
-
break;
|
|
1806
|
-
}
|
|
1807
|
-
return _context3.abrupt("return");
|
|
1808
|
-
case 26:
|
|
1809
|
-
onChangeEmit(emitArr, emitArr, node, rowData);
|
|
1810
|
-
case 27:
|
|
1811
|
-
case "end":
|
|
1812
|
-
return _context3.stop();
|
|
1579
|
+
const onAllCheckCom = bol => __awaiter(void 0, void 0, void 0, function* () {
|
|
1580
|
+
const arrList = [...currentData]; // 当前列的数据
|
|
1581
|
+
const arrVal = [...valueCom]; // 全选 绑定的值
|
|
1582
|
+
const arrval1 = []; // 全不选 绑定的值
|
|
1583
|
+
const node = {}; // 处理过得数据
|
|
1584
|
+
const rowData = {}; // 原始数据
|
|
1585
|
+
const selectArr = []; // 全不选 - 当前列选中值
|
|
1586
|
+
const selectEmitData = []; // 选择事件抛出去的值
|
|
1587
|
+
// 循环当前列数据
|
|
1588
|
+
for (let i = 0, l = arrList.length; i < l; i++) {
|
|
1589
|
+
const item = arrList[i];
|
|
1590
|
+
const keyStr = item.key || '';
|
|
1591
|
+
const disabledItem = handDisabled(item);
|
|
1592
|
+
if (disabledItem) continue;
|
|
1593
|
+
if (bol) {
|
|
1594
|
+
// 全选
|
|
1595
|
+
if (!constData.current.selectValueJson[keyStr]) {
|
|
1596
|
+
// 不存在选中值中
|
|
1597
|
+
arrVal.push(handEmitValue(item));
|
|
1598
|
+
selectEmitData.push(item);
|
|
1813
1599
|
}
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1600
|
+
} else {
|
|
1601
|
+
// 全不选
|
|
1602
|
+
if (constData.current.selectValueJson[keyStr]) {
|
|
1603
|
+
// 存在选中值中,拿掉
|
|
1604
|
+
selectArr.push(keyStr);
|
|
1605
|
+
selectEmitData.push(item);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
for (let i = 0, l = arrVal.length; i < l; i++) {
|
|
1610
|
+
const item = arrVal[i];
|
|
1611
|
+
const keyStr = item[selectorFieldConfigHand.key];
|
|
1612
|
+
if (bol) {
|
|
1613
|
+
// 全选
|
|
1614
|
+
node[keyStr] = constData.current.jsonData[keyStr];
|
|
1615
|
+
rowData[keyStr] = constData.current.jsonDataCopy[keyStr];
|
|
1616
|
+
} else {
|
|
1617
|
+
// 全不选
|
|
1618
|
+
if (selectArr.indexOf(keyStr) === -1) {
|
|
1619
|
+
// 不存在 全不选 - 当前列选中值
|
|
1620
|
+
node[keyStr] = constData.current.jsonData[keyStr];
|
|
1621
|
+
rowData[keyStr] = constData.current.jsonDataCopy[keyStr];
|
|
1622
|
+
arrval1.push(item);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
const emitArr = bol ? arrVal : arrval1;
|
|
1627
|
+
if (onSelect) {
|
|
1628
|
+
// 有外部选择事件, 且返回true,不触发onChange事件
|
|
1629
|
+
const flag = yield onSelect(selectEmitData, !!bol, false);
|
|
1630
|
+
if (flag) return;
|
|
1631
|
+
}
|
|
1632
|
+
onChangeEmit(emitArr, emitArr, node, rowData);
|
|
1633
|
+
});
|
|
1817
1634
|
/** 点击查看更多 */
|
|
1818
|
-
|
|
1635
|
+
const onLoadCom = isSearch => {
|
|
1819
1636
|
if (isSearch) {
|
|
1820
1637
|
// 搜索
|
|
1821
1638
|
constData.current.searchConfig.page = constData.current.searchConfig.page + 1;
|
|
@@ -1826,10 +1643,10 @@ var Selector = function Selector(props) {
|
|
|
1826
1643
|
setRefreshCom(Math.random());
|
|
1827
1644
|
};
|
|
1828
1645
|
/** 处理面包屑数组 */
|
|
1829
|
-
|
|
1830
|
-
|
|
1646
|
+
const handBreadcrumbsList = () => {
|
|
1647
|
+
const arr = [...breadcrumbsList];
|
|
1831
1648
|
// 根路径
|
|
1832
|
-
|
|
1649
|
+
const oneItem = breadcrumbsHead || {
|
|
1833
1650
|
label: intl({
|
|
1834
1651
|
id: 'root'
|
|
1835
1652
|
}),
|
|
@@ -1849,10 +1666,10 @@ var Selector = function Selector(props) {
|
|
|
1849
1666
|
return arr;
|
|
1850
1667
|
};
|
|
1851
1668
|
/** 截取面包屑数据 */
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
for (
|
|
1855
|
-
|
|
1669
|
+
const spliceBreadcrumbs = item => {
|
|
1670
|
+
const arr = [];
|
|
1671
|
+
for (let i = 0, l = breadcrumbsList.length; i < l; i++) {
|
|
1672
|
+
const itemB = breadcrumbsList[i];
|
|
1856
1673
|
arr.push(itemB);
|
|
1857
1674
|
if (itemB.value === item.value) {
|
|
1858
1675
|
break;
|
|
@@ -1861,20 +1678,20 @@ var Selector = function Selector(props) {
|
|
|
1861
1678
|
return arr;
|
|
1862
1679
|
};
|
|
1863
1680
|
/** 点击面包屑 */
|
|
1864
|
-
|
|
1865
|
-
|
|
1681
|
+
const onClickBreadcrumbsCom = item => {
|
|
1682
|
+
const list = constData.current.breadcrumbsList;
|
|
1866
1683
|
// 点击最后一层,不触发数据变更
|
|
1867
1684
|
if (list.length === 0 || item.value === list[list.length - 1].value) {
|
|
1868
1685
|
return;
|
|
1869
1686
|
}
|
|
1870
|
-
|
|
1871
|
-
|
|
1687
|
+
const keyStr = item.value || '';
|
|
1688
|
+
const oneValue = breadcrumbsHead ? breadcrumbsHead.value : '_paraui_first_floor';
|
|
1872
1689
|
// 点击搜索结果,显示上一次的搜索
|
|
1873
1690
|
if (item.value === '_paraui_search') {
|
|
1874
1691
|
setSearchVal({
|
|
1875
1692
|
val: constData.current.searchVal
|
|
1876
1693
|
});
|
|
1877
|
-
setBreadcrumbsList(
|
|
1694
|
+
setBreadcrumbsList([...(constData.current.beforeSearchBreadcrumbs || [])]);
|
|
1878
1695
|
return;
|
|
1879
1696
|
}
|
|
1880
1697
|
// 点击根路径且具有搜索面包屑
|
|
@@ -1898,10 +1715,10 @@ var Selector = function Selector(props) {
|
|
|
1898
1715
|
if (isReqLocalData) {
|
|
1899
1716
|
if (keyStr === oneValue) {
|
|
1900
1717
|
// 第一层
|
|
1901
|
-
constData.current.currentSourceData =
|
|
1718
|
+
constData.current.currentSourceData = [...constData.current.oneDataList];
|
|
1902
1719
|
} else {
|
|
1903
1720
|
// 除了第一级,最后一级
|
|
1904
|
-
|
|
1721
|
+
const itemData = constData.current.jsonData[keyStr];
|
|
1905
1722
|
constData.current.currentSourceData = itemData[fieldConfigHand.children];
|
|
1906
1723
|
}
|
|
1907
1724
|
} else {
|
|
@@ -1917,15 +1734,15 @@ var Selector = function Selector(props) {
|
|
|
1917
1734
|
handInitCurrent();
|
|
1918
1735
|
};
|
|
1919
1736
|
/** 处理搜索的请求 */
|
|
1920
|
-
|
|
1921
|
-
|
|
1737
|
+
const handSearchData = resultData => {
|
|
1738
|
+
const isTree = resultData.isTree;
|
|
1922
1739
|
if (constData.current.reqParams.pagination) {
|
|
1923
1740
|
// 分页
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1741
|
+
const result = resultData.data || {};
|
|
1742
|
+
const arr = result.list || [];
|
|
1743
|
+
const total = result.total;
|
|
1744
|
+
const arrHand = convertTree(arr, !isTree, true); // 搜索默认不生成树
|
|
1745
|
+
const currentD = [...constData.current.searchConfig.currentSourceData, ...arrHand];
|
|
1929
1746
|
constData.current.searchConfig.currentSourceData = currentD;
|
|
1930
1747
|
setSearchList(currentD);
|
|
1931
1748
|
if (constData.current.searchConfig.page * constData.current.searchConfig.size >= total) {
|
|
@@ -1935,16 +1752,18 @@ var Selector = function Selector(props) {
|
|
|
1935
1752
|
}
|
|
1936
1753
|
} else {
|
|
1937
1754
|
// 不分页 必须返回平铺的数组
|
|
1938
|
-
|
|
1939
|
-
|
|
1755
|
+
const arr = resultData.data || [];
|
|
1756
|
+
const treeData = convertTree(arr, !isTree, true); // 搜索默认不生成树
|
|
1940
1757
|
constData.current.searchConfig.currentSourceData = treeData;
|
|
1941
1758
|
setSearchList(treeData);
|
|
1942
1759
|
}
|
|
1943
1760
|
};
|
|
1944
1761
|
/** 处理搜索接口 */
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1762
|
+
const handReqSearchResult = result => {
|
|
1763
|
+
const {
|
|
1764
|
+
data,
|
|
1765
|
+
err
|
|
1766
|
+
} = result;
|
|
1948
1767
|
if (err) {
|
|
1949
1768
|
setSearchLoading(false);
|
|
1950
1769
|
if (constData.current.reqParams.pagination) {
|
|
@@ -1954,7 +1773,7 @@ var Selector = function Selector(props) {
|
|
|
1954
1773
|
return;
|
|
1955
1774
|
}
|
|
1956
1775
|
if (props.requestCallback) {
|
|
1957
|
-
props.requestCallback(data,
|
|
1776
|
+
props.requestCallback(data, handData => {
|
|
1958
1777
|
setSearchLoading(false);
|
|
1959
1778
|
handSearchData(handData);
|
|
1960
1779
|
}, true);
|
|
@@ -1964,64 +1783,45 @@ var Selector = function Selector(props) {
|
|
|
1964
1783
|
handSearchData(data);
|
|
1965
1784
|
};
|
|
1966
1785
|
/** 搜索请求 */
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
}, props.params)
|
|
1997
|
-
};
|
|
1998
|
-
if (constData.current.reqParams.pagination) {
|
|
1999
|
-
obj.data.size = constData.current.searchConfig.size;
|
|
2000
|
-
obj.data.page = constData.current.searchConfig.page;
|
|
2001
|
-
}
|
|
2002
|
-
obj = props.paramsCallback ? props.paramsCallback(obj, true) : obj;
|
|
2003
|
-
_context4.next = 13;
|
|
2004
|
-
return reqFunc(obj);
|
|
2005
|
-
case 13:
|
|
2006
|
-
result = _context4.sent;
|
|
2007
|
-
handReqSearchResult(result);
|
|
2008
|
-
case 15:
|
|
2009
|
-
case "end":
|
|
2010
|
-
return _context4.stop();
|
|
2011
|
-
}
|
|
2012
|
-
}, _callee4);
|
|
2013
|
-
}));
|
|
2014
|
-
};
|
|
1786
|
+
const reqSearch = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1787
|
+
var _a;
|
|
1788
|
+
if (onSearch) {
|
|
1789
|
+
const reqParams = {};
|
|
1790
|
+
if (constData.current.reqParams.pagination) {
|
|
1791
|
+
reqParams.size = constData.current.searchConfig.size;
|
|
1792
|
+
reqParams.page = constData.current.searchConfig.page;
|
|
1793
|
+
}
|
|
1794
|
+
const result = yield onSearch(constData.current.searchVal, reqParams);
|
|
1795
|
+
handReqSearchResult(result);
|
|
1796
|
+
return;
|
|
1797
|
+
}
|
|
1798
|
+
let obj = {
|
|
1799
|
+
method,
|
|
1800
|
+
url: props.url || '',
|
|
1801
|
+
ctx,
|
|
1802
|
+
uuid: constData.current.reqId,
|
|
1803
|
+
data: Object.assign({
|
|
1804
|
+
searchKey: (_a = constData.current.searchVal) === null || _a === void 0 ? void 0 : _a.trim()
|
|
1805
|
+
}, props.params)
|
|
1806
|
+
};
|
|
1807
|
+
if (constData.current.reqParams.pagination) {
|
|
1808
|
+
obj.data.size = constData.current.searchConfig.size;
|
|
1809
|
+
obj.data.page = constData.current.searchConfig.page;
|
|
1810
|
+
}
|
|
1811
|
+
obj = props.paramsCallback ? props.paramsCallback(obj, true) : obj;
|
|
1812
|
+
const result = yield reqFunc(obj);
|
|
1813
|
+
handReqSearchResult(result);
|
|
1814
|
+
});
|
|
2015
1815
|
/**
|
|
2016
1816
|
* 递归寻找子级
|
|
2017
1817
|
* */
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
for (
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
1818
|
+
const convertChild = (id, arr) => {
|
|
1819
|
+
let arrHnad = arr;
|
|
1820
|
+
const recurrence = arrItem => {
|
|
1821
|
+
for (let i = 0, l = arrItem.length; i < l; i++) {
|
|
1822
|
+
const item = arrItem[i];
|
|
1823
|
+
const rowId = item[rowKey];
|
|
1824
|
+
const arrChild = item.children || [];
|
|
2025
1825
|
if (rowId === id) {
|
|
2026
1826
|
arrHnad = arrChild;
|
|
2027
1827
|
return;
|
|
@@ -2035,65 +1835,51 @@ var Selector = function Selector(props) {
|
|
|
2035
1835
|
/** 搜索回调
|
|
2036
1836
|
* @param bol 搜索框为空的情况下,触发搜索
|
|
2037
1837
|
* */
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
constData.current.beforeSearchBreadcrumbs = null;
|
|
2057
|
-
if (isReqLocalData) {
|
|
2058
|
-
// 本地全量数据
|
|
2059
|
-
// 搜索点过下级,修改了当前显示的数据
|
|
2060
|
-
// 从搜索恢复到正常列表, 需要从原始数据,取出当前层级对应的数据
|
|
2061
|
-
parentId = handParentId();
|
|
2062
|
-
arr = convertChild(parentId, constData.current.oneDataList);
|
|
2063
|
-
constData.current.currentSourceData = arr;
|
|
2064
|
-
}
|
|
2065
|
-
refreshFunc();
|
|
2066
|
-
}
|
|
2067
|
-
if (bol) {
|
|
2068
|
-
// 当前页刷新
|
|
2069
|
-
refreshFunc();
|
|
2070
|
-
onRefresh && onRefresh();
|
|
2071
|
-
}
|
|
2072
|
-
return _context5.abrupt("return");
|
|
2073
|
-
case 8:
|
|
2074
|
-
constData.current.searchConfig.page = 1;
|
|
2075
|
-
constData.current.searchConfig.currentSourceData = [];
|
|
2076
|
-
reqSearch();
|
|
2077
|
-
case 11:
|
|
2078
|
-
case "end":
|
|
2079
|
-
return _context5.stop();
|
|
1838
|
+
const onSearchCom = (val, bol) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1839
|
+
setSearchLoading(true);
|
|
1840
|
+
constData.current.searchVal = val;
|
|
1841
|
+
if (val === '') {
|
|
1842
|
+
setSearchList([]);
|
|
1843
|
+
setSearchLoading(false);
|
|
1844
|
+
if (constData.current.beforeSearchBreadcrumbs) {
|
|
1845
|
+
// 从搜索恢复到正常列表
|
|
1846
|
+
constData.current.breadcrumbsList = [...constData.current.beforeSearchBreadcrumbs];
|
|
1847
|
+
setBreadcrumbsList([...constData.current.beforeSearchBreadcrumbs]);
|
|
1848
|
+
constData.current.beforeSearchBreadcrumbs = null;
|
|
1849
|
+
if (isReqLocalData) {
|
|
1850
|
+
// 本地全量数据
|
|
1851
|
+
// 搜索点过下级,修改了当前显示的数据
|
|
1852
|
+
// 从搜索恢复到正常列表, 需要从原始数据,取出当前层级对应的数据
|
|
1853
|
+
const parentId = handParentId();
|
|
1854
|
+
const arr = convertChild(parentId, constData.current.oneDataList);
|
|
1855
|
+
constData.current.currentSourceData = arr;
|
|
2080
1856
|
}
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
1857
|
+
refreshFunc();
|
|
1858
|
+
}
|
|
1859
|
+
if (bol) {
|
|
1860
|
+
// 当前页刷新
|
|
1861
|
+
refreshFunc();
|
|
1862
|
+
onRefresh && onRefresh();
|
|
1863
|
+
}
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
constData.current.searchConfig.page = 1;
|
|
1867
|
+
constData.current.searchConfig.currentSourceData = [];
|
|
1868
|
+
reqSearch();
|
|
1869
|
+
});
|
|
2084
1870
|
/** 删除数据 */
|
|
2085
|
-
|
|
1871
|
+
const onCloseCom = (item, index) => {
|
|
2086
1872
|
if (selectMode === 'radio') {
|
|
2087
1873
|
onChangeEmit(null, [], {}, {});
|
|
2088
1874
|
}
|
|
2089
1875
|
if (selectMode === 'check') {
|
|
2090
|
-
|
|
1876
|
+
const arr = [...valueCom];
|
|
2091
1877
|
arr.splice(index, 1);
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
for (
|
|
2095
|
-
|
|
2096
|
-
|
|
1878
|
+
const node = {}; // 处理过得数据
|
|
1879
|
+
const rowData = {}; // 原始数据
|
|
1880
|
+
for (let i = 0, l = arr.length; i < l; i++) {
|
|
1881
|
+
const item = arr[i];
|
|
1882
|
+
const keyStr = item[selectorFieldConfigHand.key];
|
|
2097
1883
|
node[keyStr] = constData.current.jsonData[keyStr];
|
|
2098
1884
|
rowData[keyStr] = constData.current.jsonDataCopy[keyStr];
|
|
2099
1885
|
}
|
|
@@ -2101,7 +1887,7 @@ var Selector = function Selector(props) {
|
|
|
2101
1887
|
}
|
|
2102
1888
|
};
|
|
2103
1889
|
/** 处理返回数据dom配置 */
|
|
2104
|
-
|
|
1890
|
+
const handSelectorData = () => {
|
|
2105
1891
|
return jsx(SelectorData, {
|
|
2106
1892
|
layout: layout === 'tb' ? 'tag' : 'node',
|
|
2107
1893
|
backDataFieldConfig: selectorFieldConfigHand,
|
|
@@ -2120,8 +1906,8 @@ var Selector = function Selector(props) {
|
|
|
2120
1906
|
});
|
|
2121
1907
|
};
|
|
2122
1908
|
// 处理className
|
|
2123
|
-
|
|
2124
|
-
|
|
1909
|
+
const handClass = () => {
|
|
1910
|
+
let str = "".concat($prefixCls, "-selector");
|
|
2125
1911
|
if (className) str += " ".concat(className);
|
|
2126
1912
|
if (layout) str += " ".concat($prefixCls, "-selector-").concat(layout);
|
|
2127
1913
|
if (selectMode) str += " ".concat($prefixCls, "-selector-").concat(selectMode);
|