@para-ui/core 4.0.30 → 4.0.31
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/AutoButton/index.d.ts +41 -0
- package/AutoButton/index.js +213 -0
- package/AutoButton/lang/en_US.d.ts +4 -0
- package/AutoButton/lang/index.d.ts +9 -0
- package/AutoButton/lang/zh_CN.d.ts +4 -0
- package/Badge/index.d.ts +3 -1
- package/Badge/index.js +15 -5
- package/Card/index.d.ts +53 -0
- package/Card/index.js +218 -0
- package/Card/lang/en_US.d.ts +5 -0
- package/Card/lang/index.d.ts +11 -0
- package/Card/lang/zh_CN.d.ts +5 -0
- package/Cascader/index.js +8 -8
- package/ComboSelect/index.js +7 -7
- package/CycleSelector/index.js +4 -1
- package/DatePicker/index.js +4 -1
- package/DragVerify/index.js +7 -2
- package/DynamicMultiBox/index.js +8 -8
- package/Form/index.js +8 -8
- package/FormItem/index.js +8 -8
- package/FunctionModal/index.js +2 -2
- package/Image/index.js +5 -5
- package/PopConfirm/index.js +2 -2
- package/PopMenu/index.js +16 -5
- package/QuickReply/index.js +1 -1
- package/README.md +10 -0
- package/RangeInput/index.d.ts +4 -0
- package/RangeInput/index.js +32 -8
- package/Select/index.js +2 -2
- package/Selector/index.js +282 -225
- package/SelectorPicker/index.js +5 -6
- package/SingleBox/index.js +2 -2
- package/SortBox/index.d.ts +27 -0
- package/SortBox/index.js +64 -0
- package/Stepper/index.js +1 -1
- package/Switch/index.js +2 -2
- package/Table/index.js +471 -409
- package/Tabs/index.js +2 -2
- package/Tag/index.js +82 -53
- package/TextEditor/index.js +3 -3
- package/TimePicker/index.js +4 -1
- package/Timeline/index.js +14 -20
- package/ToggleButton/index.js +25 -26
- package/Tooltip/index.js +26 -27
- package/Transfer/index.js +1 -2
- package/Tree/index.js +8 -8
- package/Upload/ImageUpload/index.d.ts +2 -7
- package/Upload/index.js +114 -37
- package/Upload/interface.d.ts +18 -0
- package/_verture/{Portal-5bf66fed.js → Portal-edd94cac.js} +4 -3
- package/_verture/{defineProperty-f0e15205.js → defineProperty-6f62bb2a.js} +2 -10
- package/_verture/{index-33866394.js → index-3795d730.js} +1 -1
- package/_verture/{index-28edf318.js → index-567b5779.js} +5 -4
- package/_verture/{index-8ec857b4.js → index-8752ccab.js} +6 -6
- package/_verture/{index-8ac46bd9.js → index-94e24006.js} +1 -1
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-75fa4188.js} +15 -2
- package/_verture/{toConsumableArray-8f4c9589.js → toConsumableArray-c7a8028f.js} +1 -1
- package/_verture/typeof-adeedc13.js +11 -0
- package/index.d.ts +6 -0
- package/index.js +18 -14
- package/locale/en-US.d.ts +7 -0
- package/locale/index.d.ts +14 -0
- package/locale/index.js +14 -0
- package/locale/zh-CN.d.ts +7 -0
- package/package.json +2 -3
- package/umd/AutoButton.js +43 -0
- package/umd/Badge.js +1 -1
- package/umd/Card.js +1 -0
- package/umd/DragVerify.js +1 -1
- package/umd/FunctionModal.js +3 -3
- package/umd/Modal.js +2 -2
- package/umd/PopMenu.js +2 -2
- package/umd/RangeInput.js +2 -2
- package/umd/SortBox.js +41 -0
- package/umd/Upload.js +4 -4
- package/umd/locale.js +1 -1
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
- /package/_verture/{index-0f5ee6f7.js → index-c8cb6751.js} +0 -0
- /package/_verture/{modalContext-c57b51b7.js → modalContext-10f0c5aa.js} +0 -0
- /package/_verture/{typeof-6ec38efd.js → typeof-4646b22c.js} +0 -0
package/Selector/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as __awaiter, _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useRef, useEffect, Fragment as Fragment$1 } from 'react';
|
|
4
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-
|
|
5
|
-
import { r as regenerator } from '../_verture/index-
|
|
4
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-75fa4188.js';
|
|
5
|
+
import { r as regenerator } from '../_verture/index-94e24006.js';
|
|
6
6
|
import { Radio } from '../Radio/index.js';
|
|
7
7
|
import { Checkbox } from '../Checkbox/index.js';
|
|
8
8
|
import { Popover } from '../Popover/index.js';
|
|
@@ -19,8 +19,7 @@ import SearchIcon from '@para-ui/icons/Search';
|
|
|
19
19
|
import Refresh from '@para-ui/icons/Refresh';
|
|
20
20
|
import { ArrayToObject, Get, Post, Cancel } from '@paraview/lib';
|
|
21
21
|
import { u as useGlobalProps } from '../_verture/useGlobalProps-4ae1a007.js';
|
|
22
|
-
import '../_verture/
|
|
23
|
-
import '../_verture/typeof-6ec38efd.js';
|
|
22
|
+
import '../_verture/typeof-4646b22c.js';
|
|
24
23
|
import '../Label/index.js';
|
|
25
24
|
import '../Help/index.js';
|
|
26
25
|
import '../Tooltip/index.js';
|
|
@@ -66,8 +65,8 @@ var zh = {
|
|
|
66
65
|
};
|
|
67
66
|
|
|
68
67
|
var localeJson = {
|
|
69
|
-
zh,
|
|
70
|
-
en
|
|
68
|
+
zh: zh,
|
|
69
|
+
en: en
|
|
71
70
|
};
|
|
72
71
|
|
|
73
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}";
|
|
@@ -330,57 +329,63 @@ var SelectorNode = function SelectorNode(props) {
|
|
|
330
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}";
|
|
331
330
|
styleInject(css_248z$2);
|
|
332
331
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
nodeMode = 'branch',
|
|
339
|
-
selectMode,
|
|
340
|
-
loadMore =
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
332
|
+
var SelectorMainContent = function SelectorMainContent(props) {
|
|
333
|
+
var className = props.className,
|
|
334
|
+
value = props.value;
|
|
335
|
+
props.rowKey;
|
|
336
|
+
var _props$nodeMode = props.nodeMode,
|
|
337
|
+
nodeMode = _props$nodeMode === void 0 ? 'branch' : _props$nodeMode,
|
|
338
|
+
selectMode = props.selectMode,
|
|
339
|
+
_props$loadMore = props.loadMore,
|
|
340
|
+
loadMore = _props$loadMore === void 0 ? false : _props$loadMore,
|
|
341
|
+
_props$isAllCheck = props.isAllCheck,
|
|
342
|
+
isAllCheck = _props$isAllCheck === void 0 ? false : _props$isAllCheck,
|
|
343
|
+
detail = props.detail,
|
|
344
|
+
detailRender = props.detailRender,
|
|
345
|
+
isLazy = props.isLazy,
|
|
346
|
+
list = props.list,
|
|
347
|
+
groupType = props.groupType,
|
|
348
|
+
breadcrumbs = props.breadcrumbs,
|
|
349
|
+
_props$breadcrumbsSep = props.breadcrumbsSeparator,
|
|
350
|
+
breadcrumbsSeparator = _props$breadcrumbsSep === void 0 ? '-' : _props$breadcrumbsSep,
|
|
351
|
+
_props$breadcrumbsLis = props.breadcrumbsList,
|
|
352
|
+
breadcrumbsList = _props$breadcrumbsLis === void 0 ? [] : _props$breadcrumbsLis,
|
|
353
|
+
fieldConfig = props.fieldConfig,
|
|
354
|
+
disabled = props.disabled,
|
|
355
|
+
disabledChild = props.disabledChild,
|
|
356
|
+
emptyProps = props.emptyProps,
|
|
357
|
+
loading = props.loading,
|
|
358
|
+
onClickBreadcrumbs = props.onClickBreadcrumbs,
|
|
359
|
+
_onLevel = props.onLevel,
|
|
360
|
+
_onSelect = props.onSelect,
|
|
361
|
+
onLoad = props.onLoad,
|
|
362
|
+
onAllCheck = props.onAllCheck;
|
|
363
|
+
var intl = useFormatMessage('Selector', localeJson);
|
|
364
|
+
var _useState = useState({}),
|
|
365
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
366
|
+
listCom = _useState2[0],
|
|
367
|
+
setListCom = _useState2[1];
|
|
368
|
+
var constData = useRef({
|
|
364
369
|
listTypeJson: {},
|
|
365
370
|
fieldConfig: {},
|
|
366
371
|
resizeTimer: null
|
|
367
372
|
});
|
|
368
|
-
|
|
369
|
-
|
|
373
|
+
var scrolltRef = useRef(null);
|
|
374
|
+
var contentRef = useRef(null);
|
|
370
375
|
constData.current.listTypeJson = ArrayToObject('value', groupType);
|
|
371
376
|
constData.current.fieldConfig = fieldConfig || {};
|
|
372
|
-
useEffect(()
|
|
377
|
+
useEffect(function () {
|
|
373
378
|
changeResize();
|
|
374
|
-
return ()
|
|
379
|
+
return function () {
|
|
375
380
|
clearTimeout(constData.current.resizeTimer);
|
|
376
381
|
};
|
|
377
382
|
}, []);
|
|
378
|
-
useEffect(()
|
|
383
|
+
useEffect(function () {
|
|
379
384
|
if (list && groupType && groupType.length > 0) {
|
|
380
|
-
|
|
381
|
-
for (
|
|
382
|
-
|
|
383
|
-
|
|
385
|
+
var json = {};
|
|
386
|
+
for (var i = 0, l = list.length; i < l; i++) {
|
|
387
|
+
var item = list[i];
|
|
388
|
+
var type = item.type;
|
|
384
389
|
if (!json[type]) json[type] = [];
|
|
385
390
|
json[type].push(item);
|
|
386
391
|
}
|
|
@@ -388,17 +393,17 @@ const SelectorMainContent = props => {
|
|
|
388
393
|
}
|
|
389
394
|
}, [list]);
|
|
390
395
|
/** 屏幕发生改变 */
|
|
391
|
-
|
|
396
|
+
var changeResize = function changeResize() {
|
|
392
397
|
clearTimeout(constData.current.resizeTimer);
|
|
393
|
-
constData.current.resizeTimer = setTimeout(()
|
|
398
|
+
constData.current.resizeTimer = setTimeout(function () {
|
|
394
399
|
onScroll();
|
|
395
400
|
}, 100);
|
|
396
401
|
};
|
|
397
402
|
/** 滚动 */
|
|
398
|
-
|
|
403
|
+
var onScroll = function onScroll() {
|
|
399
404
|
if (!contentRef.current || !scrolltRef.current) return;
|
|
400
|
-
|
|
401
|
-
|
|
405
|
+
var scrollBox = scrolltRef.current;
|
|
406
|
+
var contentBox = contentRef.current;
|
|
402
407
|
contentBox.classList.remove('selector-main-list-scroll-top', 'selector-main-list-scroll-bottom', 'selector-main-list-scroll-middle');
|
|
403
408
|
if (scrollBox.scrollHeight <= scrollBox.clientHeight) return;
|
|
404
409
|
// 滚动条初始化
|
|
@@ -415,17 +420,17 @@ const SelectorMainContent = props => {
|
|
|
415
420
|
contentBox.classList.add('selector-main-list-scroll-middle');
|
|
416
421
|
};
|
|
417
422
|
/** 判断是否全选,半选 */
|
|
418
|
-
|
|
419
|
-
|
|
423
|
+
var handAllCheckFunc = function handAllCheckFunc() {
|
|
424
|
+
var json = {
|
|
420
425
|
checked: false,
|
|
421
426
|
indeterminate: false
|
|
422
427
|
};
|
|
423
428
|
// 不存在value, 没有数据, 全选没转态
|
|
424
429
|
if (!value || !list || list.length === 0) return json;
|
|
425
|
-
for (
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
430
|
+
for (var i = 0, l = list.length; i < l; i++) {
|
|
431
|
+
var item = list[i];
|
|
432
|
+
var key = item.key;
|
|
433
|
+
var disabledItem = handDisabled(item);
|
|
429
434
|
if (disabledItem) {
|
|
430
435
|
if (value[key]) json.checked = true;
|
|
431
436
|
continue;
|
|
@@ -449,7 +454,7 @@ const SelectorMainContent = props => {
|
|
|
449
454
|
return json;
|
|
450
455
|
};
|
|
451
456
|
/** 处理禁用状态 */
|
|
452
|
-
|
|
457
|
+
var handDisabled = function handDisabled(item) {
|
|
453
458
|
if (disabled) {
|
|
454
459
|
if (disabled === true) return true;
|
|
455
460
|
if (disabled instanceof Array) {
|
|
@@ -462,7 +467,7 @@ const SelectorMainContent = props => {
|
|
|
462
467
|
return false;
|
|
463
468
|
};
|
|
464
469
|
/** 处理禁用下级状态 */
|
|
465
|
-
|
|
470
|
+
var handDisabledChild = function handDisabledChild(item) {
|
|
466
471
|
if (disabledChild) {
|
|
467
472
|
if (disabledChild === true) return true;
|
|
468
473
|
if (disabledChild instanceof Array) {
|
|
@@ -475,12 +480,12 @@ const SelectorMainContent = props => {
|
|
|
475
480
|
return false;
|
|
476
481
|
};
|
|
477
482
|
/** 全选 */
|
|
478
|
-
|
|
483
|
+
var handAllCheck = function handAllCheck() {
|
|
479
484
|
// 只存在复选框模式
|
|
480
485
|
if (!isAllCheck || selectMode !== 'check') return null;
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
486
|
+
var checkJson = handAllCheckFunc();
|
|
487
|
+
var onAllCheckCom = function onAllCheckCom() {
|
|
488
|
+
var bol = true;
|
|
484
489
|
if (checkJson.checked) bol = false;
|
|
485
490
|
onAllCheck && onAllCheck(bol);
|
|
486
491
|
};
|
|
@@ -497,11 +502,11 @@ const SelectorMainContent = props => {
|
|
|
497
502
|
}));
|
|
498
503
|
};
|
|
499
504
|
/** 点击查看更多 */
|
|
500
|
-
|
|
505
|
+
var clickLoad = function clickLoad() {
|
|
501
506
|
onLoad && onLoad();
|
|
502
507
|
};
|
|
503
508
|
/** 查看更多 */
|
|
504
|
-
|
|
509
|
+
var handLoadMore = function handLoadMore() {
|
|
505
510
|
if (!loadMore) return null;
|
|
506
511
|
return jsx("div", Object.assign({
|
|
507
512
|
className: "selector-main-list-more",
|
|
@@ -517,29 +522,33 @@ const SelectorMainContent = props => {
|
|
|
517
522
|
}));
|
|
518
523
|
};
|
|
519
524
|
/** 判断是否选中 */
|
|
520
|
-
|
|
521
|
-
|
|
525
|
+
var handCheck = function handCheck(item) {
|
|
526
|
+
var bol = false;
|
|
522
527
|
if (value && value[item.key]) bol = true;
|
|
523
528
|
return bol;
|
|
524
529
|
};
|
|
525
530
|
/** 处理每个节点的配置 */
|
|
526
|
-
|
|
527
|
-
|
|
531
|
+
var handNodeConfig = function handNodeConfig(item) {
|
|
532
|
+
var json = {
|
|
528
533
|
useCase: 'view',
|
|
529
|
-
detail,
|
|
530
|
-
nodeMode,
|
|
534
|
+
detail: detail,
|
|
535
|
+
nodeMode: nodeMode,
|
|
531
536
|
disabled: handDisabled(item),
|
|
532
537
|
disabledChild: handDisabledChild(item),
|
|
533
|
-
onLevel:
|
|
534
|
-
|
|
538
|
+
onLevel: function onLevel() {
|
|
539
|
+
return _onLevel && _onLevel(item);
|
|
540
|
+
},
|
|
541
|
+
onSelect: function onSelect() {
|
|
542
|
+
return _onSelect && _onSelect(item);
|
|
543
|
+
},
|
|
535
544
|
checked: handCheck(item)
|
|
536
545
|
};
|
|
537
546
|
/** 节点类型 */
|
|
538
547
|
if (item.leaf !== undefined) json.nodeMode = item.leaf ? 'leaf' : 'branch';
|
|
539
548
|
/** 渲染字段 */
|
|
540
|
-
|
|
541
|
-
for (
|
|
542
|
-
|
|
549
|
+
var arr = ['img', 'mainTitle', 'subTitle', 'tag', 'tagStyle'];
|
|
550
|
+
for (var i = 0, l = arr.length; i < l; i++) {
|
|
551
|
+
var key = arr[i];
|
|
543
552
|
json[key] = item[key];
|
|
544
553
|
}
|
|
545
554
|
/** 判断是否具有选择 */
|
|
@@ -553,7 +562,7 @@ const SelectorMainContent = props => {
|
|
|
553
562
|
json.child = item.child;
|
|
554
563
|
} else {
|
|
555
564
|
// 全量数据
|
|
556
|
-
|
|
565
|
+
var children = item.children || [];
|
|
557
566
|
if (children && children.length > 0) {
|
|
558
567
|
json.child = true;
|
|
559
568
|
}
|
|
@@ -562,29 +571,43 @@ const SelectorMainContent = props => {
|
|
|
562
571
|
}
|
|
563
572
|
/** 详情render */
|
|
564
573
|
if (detailRender) {
|
|
565
|
-
json.detailRender =
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
574
|
+
json.detailRender = function () {
|
|
575
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
576
|
+
var Dom;
|
|
577
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
578
|
+
while (1) switch (_context.prev = _context.next) {
|
|
579
|
+
case 0:
|
|
580
|
+
_context.next = 2;
|
|
581
|
+
return detailRender(item, true);
|
|
582
|
+
case 2:
|
|
583
|
+
Dom = _context.sent;
|
|
584
|
+
return _context.abrupt("return", Dom);
|
|
585
|
+
case 4:
|
|
586
|
+
case "end":
|
|
587
|
+
return _context.stop();
|
|
588
|
+
}
|
|
589
|
+
}, _callee);
|
|
590
|
+
}));
|
|
591
|
+
};
|
|
569
592
|
}
|
|
570
593
|
if (item.detail !== undefined) json.detail = item.detail;
|
|
571
594
|
return json;
|
|
572
595
|
};
|
|
573
596
|
/** 渲染list节点 */
|
|
574
|
-
|
|
575
|
-
return arr === null || arr === void 0 ? void 0 : arr.map((item, index)
|
|
597
|
+
var handListNode = function handListNode(arr) {
|
|
598
|
+
return arr === null || arr === void 0 ? void 0 : arr.map(function (item, index) {
|
|
576
599
|
return jsx(SelectorNode, Object.assign({}, handNodeConfig(item)), index);
|
|
577
600
|
});
|
|
578
601
|
};
|
|
579
602
|
/** 处理节点dom */
|
|
580
|
-
|
|
603
|
+
var handNode = function handNode() {
|
|
581
604
|
// 分组渲染
|
|
582
605
|
if (groupType && groupType.length > 0) {
|
|
583
606
|
return jsx(Fragment, {
|
|
584
|
-
children: groupType.map((item, index)
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
607
|
+
children: groupType.map(function (item, index) {
|
|
608
|
+
var type = item.value;
|
|
609
|
+
var listData = listCom[type] || [];
|
|
610
|
+
var str = 'selector-group-title';
|
|
588
611
|
if (index === 0) str += ' selector-group-title-first';
|
|
589
612
|
return jsxs(Fragment$1, {
|
|
590
613
|
children: [listData.length > 0 && jsx("div", Object.assign({
|
|
@@ -599,11 +622,11 @@ const SelectorMainContent = props => {
|
|
|
599
622
|
return handListNode(list || []);
|
|
600
623
|
};
|
|
601
624
|
/** 点击面包屑 */
|
|
602
|
-
|
|
625
|
+
var onClickBreadcrums = function onClickBreadcrums(item) {
|
|
603
626
|
onClickBreadcrumbs && onClickBreadcrumbs(item);
|
|
604
627
|
};
|
|
605
628
|
/** 面包屑dom */
|
|
606
|
-
|
|
629
|
+
var handBreadcrumbs = function handBreadcrumbs() {
|
|
607
630
|
if (!breadcrumbs || breadcrumbsList.length === 0) return null;
|
|
608
631
|
return jsx("div", Object.assign({
|
|
609
632
|
className: "nav-box"
|
|
@@ -616,7 +639,7 @@ const SelectorMainContent = props => {
|
|
|
616
639
|
}));
|
|
617
640
|
};
|
|
618
641
|
/** 处理内容 */
|
|
619
|
-
|
|
642
|
+
var handContent = function handContent() {
|
|
620
643
|
if ((list === null || list === void 0 ? void 0 : list.length) === 0 && !loading) {
|
|
621
644
|
// 空状态
|
|
622
645
|
return jsx("div", Object.assign({
|
|
@@ -644,8 +667,8 @@ const SelectorMainContent = props => {
|
|
|
644
667
|
})), handLoadMore()]
|
|
645
668
|
}));
|
|
646
669
|
};
|
|
647
|
-
|
|
648
|
-
|
|
670
|
+
var handClass = function handClass() {
|
|
671
|
+
var str = 'selector-main-content';
|
|
649
672
|
if (className) str += " ".concat(className);
|
|
650
673
|
if (disabled) str += ' selector-main-content-disabled';
|
|
651
674
|
if (isAllCheck && selectMode === 'check') str += ' selector-main-content-all-check';
|
|
@@ -659,87 +682,99 @@ const SelectorMainContent = props => {
|
|
|
659
682
|
children: [handBreadcrumbs(), handContent()]
|
|
660
683
|
}));
|
|
661
684
|
};
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
rowKey = 'key',
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
685
|
+
var SelectorMain = function SelectorMain(props) {
|
|
686
|
+
var className = props.className,
|
|
687
|
+
style = props.style,
|
|
688
|
+
url = props.url,
|
|
689
|
+
value = props.value,
|
|
690
|
+
_props$rowKey2 = props.rowKey,
|
|
691
|
+
rowKey = _props$rowKey2 === void 0 ? 'key' : _props$rowKey2,
|
|
692
|
+
_props$nodeMode2 = props.nodeMode,
|
|
693
|
+
nodeMode = _props$nodeMode2 === void 0 ? 'branch' : _props$nodeMode2,
|
|
694
|
+
selectMode = props.selectMode,
|
|
695
|
+
_props$loadMore2 = props.loadMore,
|
|
696
|
+
loadMore = _props$loadMore2 === void 0 ? false : _props$loadMore2,
|
|
697
|
+
_props$searchLoadMore = props.searchLoadMore,
|
|
698
|
+
searchLoadMore = _props$searchLoadMore === void 0 ? false : _props$searchLoadMore,
|
|
699
|
+
_props$isAllCheck2 = props.isAllCheck,
|
|
700
|
+
isAllCheck = _props$isAllCheck2 === void 0 ? false : _props$isAllCheck2,
|
|
701
|
+
disabled = props.disabled,
|
|
702
|
+
disabledChild = props.disabledChild,
|
|
703
|
+
detail = props.detail,
|
|
704
|
+
detailRender = props.detailRender,
|
|
705
|
+
isLazy = props.isLazy,
|
|
706
|
+
list = props.list,
|
|
707
|
+
groupType = props.groupType,
|
|
708
|
+
groupRange = props.groupRange,
|
|
709
|
+
search = props.search,
|
|
710
|
+
_props$searchVal = props.searchVal,
|
|
711
|
+
searchVal = _props$searchVal === void 0 ? '' : _props$searchVal,
|
|
712
|
+
searchPlaceholder = props.searchPlaceholder,
|
|
713
|
+
searchTrigger = props.searchTrigger,
|
|
714
|
+
searchLoading = props.searchLoading,
|
|
715
|
+
searchList = props.searchList,
|
|
716
|
+
loading = props.loading,
|
|
717
|
+
breadcrumbs = props.breadcrumbs,
|
|
718
|
+
_props$breadcrumbsSep2 = props.breadcrumbsSeparator,
|
|
719
|
+
breadcrumbsSeparator = _props$breadcrumbsSep2 === void 0 ? '-' : _props$breadcrumbsSep2,
|
|
720
|
+
_props$breadcrumbsLis2 = props.breadcrumbsList,
|
|
721
|
+
breadcrumbsList = _props$breadcrumbsLis2 === void 0 ? [] : _props$breadcrumbsLis2,
|
|
722
|
+
fieldConfig = props.fieldConfig,
|
|
723
|
+
onClickBreadcrumbs = props.onClickBreadcrumbs,
|
|
724
|
+
onLevel = props.onLevel,
|
|
725
|
+
onSelect = props.onSelect,
|
|
726
|
+
onLoad = props.onLoad,
|
|
727
|
+
onAllCheck = props.onAllCheck,
|
|
728
|
+
onSearch = props.onSearch,
|
|
729
|
+
onRefresh = props.onRefresh;
|
|
730
|
+
var intl = useFormatMessage('Selector', localeJson);
|
|
731
|
+
var _useState3 = useState(false),
|
|
732
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
733
|
+
showSearch = _useState4[0],
|
|
734
|
+
setShowSearch = _useState4[1]; // 显示搜索/
|
|
735
|
+
var _useState5 = useState(''),
|
|
736
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
737
|
+
searchStr = _useState6[0],
|
|
738
|
+
setSearchStr = _useState6[1];
|
|
739
|
+
var constData = useRef({
|
|
705
740
|
searchTimer: null,
|
|
706
741
|
searchStr: ''
|
|
707
742
|
});
|
|
708
|
-
useEffect(()
|
|
743
|
+
useEffect(function () {
|
|
709
744
|
if (!searchVal) return;
|
|
710
745
|
constData.current.searchStr = searchVal.val;
|
|
711
746
|
setSearchStr(searchVal.val);
|
|
712
747
|
if (searchVal.val !== '') setShowSearch(true);
|
|
713
748
|
}, [searchVal]);
|
|
714
749
|
/** 改变搜索框 */
|
|
715
|
-
|
|
750
|
+
var changeSearch = function changeSearch(val) {
|
|
716
751
|
setSearchStr(val);
|
|
717
752
|
constData.current.searchStr = val;
|
|
718
753
|
if (searchTrigger !== 'onEnter') onSearchCom();
|
|
719
754
|
};
|
|
720
755
|
/** 搜索框回车事件 */
|
|
721
|
-
|
|
756
|
+
var onEnterSearch = function onEnterSearch() {
|
|
722
757
|
onSearchCom(true);
|
|
723
758
|
};
|
|
724
759
|
/** 点击搜索按钮 */
|
|
725
|
-
|
|
760
|
+
var onClickRightIcon = function onClickRightIcon() {
|
|
726
761
|
onSearchCom(true);
|
|
727
762
|
};
|
|
728
763
|
/** 点击清除按钮 */
|
|
729
|
-
|
|
764
|
+
var onClear = function onClear() {
|
|
730
765
|
onSearchCom();
|
|
731
766
|
};
|
|
732
767
|
/** 向外抛出搜索事件 */
|
|
733
|
-
|
|
768
|
+
var onSearchCom = function onSearchCom(bol) {
|
|
734
769
|
clearTimeout(constData.current.searchTimer);
|
|
735
|
-
constData.current.searchTimer = setTimeout(()
|
|
770
|
+
constData.current.searchTimer = setTimeout(function () {
|
|
736
771
|
setShowSearch(!!constData.current.searchStr);
|
|
737
772
|
onSearch && onSearch(constData.current.searchStr, !!bol);
|
|
738
773
|
}, 300);
|
|
739
774
|
};
|
|
740
775
|
/** 搜索dom */
|
|
741
|
-
|
|
742
|
-
|
|
776
|
+
var handSearchDom = function handSearchDom() {
|
|
777
|
+
var handSearchIcon = function handSearchIcon() {
|
|
743
778
|
if (!searchStr) {
|
|
744
779
|
// 本地数据且没有自定义刷新事件
|
|
745
780
|
if (!url && !onRefresh) {
|
|
@@ -770,23 +805,27 @@ const SelectorMain = props => {
|
|
|
770
805
|
/** 点击下级
|
|
771
806
|
* @param isSearch {boolean}
|
|
772
807
|
* */
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
808
|
+
var onLevelCom = function onLevelCom(isSearch) {
|
|
809
|
+
return function (item) {
|
|
810
|
+
if (isSearch) {
|
|
811
|
+
constData.current.searchStr = '';
|
|
812
|
+
setSearchStr('');
|
|
813
|
+
setShowSearch(false);
|
|
814
|
+
}
|
|
815
|
+
onLevel && onLevel(item, isSearch);
|
|
816
|
+
};
|
|
780
817
|
};
|
|
781
818
|
/**
|
|
782
819
|
* 加载更多
|
|
783
820
|
* @param isSearch {boolean} 是否搜索
|
|
784
821
|
* */
|
|
785
|
-
|
|
786
|
-
|
|
822
|
+
var onLoadCom = function onLoadCom(isSearch) {
|
|
823
|
+
return function () {
|
|
824
|
+
onLoad && onLoad(isSearch);
|
|
825
|
+
};
|
|
787
826
|
};
|
|
788
827
|
/** 渲染列表 */
|
|
789
|
-
|
|
828
|
+
var handListDom = function handListDom() {
|
|
790
829
|
return jsx(SelectorMainContent, {
|
|
791
830
|
className: "selector-main-list-box",
|
|
792
831
|
value: value,
|
|
@@ -815,7 +854,7 @@ const SelectorMain = props => {
|
|
|
815
854
|
}, "list");
|
|
816
855
|
};
|
|
817
856
|
/** 渲染搜索列表 */
|
|
818
|
-
|
|
857
|
+
var handSearchList = function handSearchList() {
|
|
819
858
|
if (!showSearch) return;
|
|
820
859
|
return jsx(SelectorMainContent, {
|
|
821
860
|
className: 'selector-main-search-content',
|
|
@@ -840,14 +879,14 @@ const SelectorMain = props => {
|
|
|
840
879
|
}, "search");
|
|
841
880
|
};
|
|
842
881
|
/** 处理loading */
|
|
843
|
-
|
|
882
|
+
var handLoading = function handLoading() {
|
|
844
883
|
if (searchLoading || loading) {
|
|
845
884
|
return jsx(Loading, {});
|
|
846
885
|
}
|
|
847
886
|
};
|
|
848
887
|
// 处理class
|
|
849
|
-
|
|
850
|
-
|
|
888
|
+
var handClass = function handClass() {
|
|
889
|
+
var str = "".concat($prefixCls, "-selector-main");
|
|
851
890
|
if (className) str += " ".concat(className);
|
|
852
891
|
if (selectMode === 'check') str += " ".concat($prefixCls, "-selector-main-select");
|
|
853
892
|
if (showSearch) str += " ".concat($prefixCls, "-selector-main-show-search");
|
|
@@ -870,38 +909,40 @@ const SelectorMain = props => {
|
|
|
870
909
|
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}";
|
|
871
910
|
styleInject(css_248z$1);
|
|
872
911
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
layout = 'node',
|
|
877
|
-
style,
|
|
878
|
-
list,
|
|
879
|
-
groupType,
|
|
880
|
-
nodeMode,
|
|
881
|
-
backDataFieldConfig,
|
|
882
|
-
detail,
|
|
883
|
-
detailRender,
|
|
884
|
-
disabled,
|
|
885
|
-
handSelectorNodeInfo,
|
|
886
|
-
selectDataTitleRender,
|
|
887
|
-
selectRenderItem,
|
|
888
|
-
selectRender,
|
|
889
|
-
onClose
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
912
|
+
var SelectorData = function SelectorData(props) {
|
|
913
|
+
var className = props.className,
|
|
914
|
+
_props$layout = props.layout,
|
|
915
|
+
layout = _props$layout === void 0 ? 'node' : _props$layout,
|
|
916
|
+
style = props.style,
|
|
917
|
+
list = props.list,
|
|
918
|
+
groupType = props.groupType,
|
|
919
|
+
nodeMode = props.nodeMode,
|
|
920
|
+
backDataFieldConfig = props.backDataFieldConfig,
|
|
921
|
+
detail = props.detail,
|
|
922
|
+
detailRender = props.detailRender,
|
|
923
|
+
disabled = props.disabled,
|
|
924
|
+
handSelectorNodeInfo = props.handSelectorNodeInfo,
|
|
925
|
+
selectDataTitleRender = props.selectDataTitleRender,
|
|
926
|
+
selectRenderItem = props.selectRenderItem,
|
|
927
|
+
selectRender = props.selectRender,
|
|
928
|
+
_onClose = props.onClose;
|
|
929
|
+
var intl = useFormatMessage('Selector', localeJson);
|
|
930
|
+
var _useState = useState({}),
|
|
931
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
932
|
+
listCom = _useState2[0],
|
|
933
|
+
setListCom = _useState2[1];
|
|
934
|
+
var constData = useRef({
|
|
894
935
|
listTypeJson: {},
|
|
895
936
|
backDataFieldConfig: {}
|
|
896
937
|
});
|
|
897
938
|
constData.current.listTypeJson = ArrayToObject('value', groupType);
|
|
898
939
|
constData.current.backDataFieldConfig = backDataFieldConfig || {};
|
|
899
|
-
useEffect(()
|
|
940
|
+
useEffect(function () {
|
|
900
941
|
if (list && groupType && groupType.length > 0) {
|
|
901
|
-
|
|
902
|
-
for (
|
|
903
|
-
|
|
904
|
-
|
|
942
|
+
var json = {};
|
|
943
|
+
for (var i = 0, l = list.length; i < l; i++) {
|
|
944
|
+
var item = list[i];
|
|
945
|
+
var type = item[constData.current.backDataFieldConfig.type || ''];
|
|
905
946
|
if (!json[type]) json[type] = [];
|
|
906
947
|
json[type].push(item);
|
|
907
948
|
}
|
|
@@ -909,12 +950,12 @@ const SelectorData = props => {
|
|
|
909
950
|
}
|
|
910
951
|
}, [list]);
|
|
911
952
|
/** 处理禁用 */
|
|
912
|
-
|
|
953
|
+
var handDisabled = function handDisabled(itemConfig) {
|
|
913
954
|
if (disabled) {
|
|
914
955
|
if (disabled === true) return true;
|
|
915
956
|
if (disabled instanceof Array) {
|
|
916
|
-
|
|
917
|
-
|
|
957
|
+
var keyStr = (backDataFieldConfig === null || backDataFieldConfig === void 0 ? void 0 : backDataFieldConfig.key) || '';
|
|
958
|
+
var val = itemConfig[keyStr];
|
|
918
959
|
if (disabled.indexOf(val) !== -1) {
|
|
919
960
|
return true;
|
|
920
961
|
}
|
|
@@ -923,40 +964,56 @@ const SelectorData = props => {
|
|
|
923
964
|
return false;
|
|
924
965
|
};
|
|
925
966
|
/** 处理每个节点的配置 */
|
|
926
|
-
|
|
927
|
-
|
|
967
|
+
var handNodeConfig = function handNodeConfig(itemConfig, index) {
|
|
968
|
+
var item = itemConfig;
|
|
928
969
|
if (handSelectorNodeInfo) item = handSelectorNodeInfo(itemConfig);
|
|
929
|
-
|
|
930
|
-
|
|
970
|
+
var disabledItem = handDisabled(itemConfig);
|
|
971
|
+
var json = {
|
|
931
972
|
useCase: 'edit',
|
|
932
973
|
close: !disabledItem,
|
|
933
|
-
detail,
|
|
974
|
+
detail: detail,
|
|
934
975
|
data: item,
|
|
935
|
-
nodeMode,
|
|
936
|
-
onClose:
|
|
976
|
+
nodeMode: nodeMode,
|
|
977
|
+
onClose: function onClose() {
|
|
978
|
+
return _onClose && _onClose(item, index);
|
|
979
|
+
},
|
|
937
980
|
disabled: handDisabled(itemConfig),
|
|
938
981
|
tagStyle: item.tagStyle
|
|
939
982
|
};
|
|
940
983
|
if (selectRenderItem) {
|
|
941
|
-
json.leftRender = ()
|
|
984
|
+
json.leftRender = function () {
|
|
942
985
|
return selectRenderItem(itemConfig);
|
|
943
986
|
};
|
|
944
987
|
}
|
|
945
988
|
/** 节点类型 */
|
|
946
989
|
if (item.leaf !== undefined) json.nodeMode = item.leaf ? 'leaf' : 'branch';
|
|
947
990
|
/** 渲染字段 */
|
|
948
|
-
|
|
949
|
-
for (
|
|
950
|
-
|
|
951
|
-
|
|
991
|
+
var arr = ['img', 'mainTitle', 'subTitle', 'tag'];
|
|
992
|
+
for (var i = 0, l = arr.length; i < l; i++) {
|
|
993
|
+
var key = arr[i] || '';
|
|
994
|
+
var backName = backDataFieldConfig && backDataFieldConfig[key] || '';
|
|
952
995
|
json[key] = item[backName];
|
|
953
996
|
}
|
|
954
997
|
/** 详情render */
|
|
955
998
|
if (detailRender) {
|
|
956
|
-
json.detailRender =
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
999
|
+
json.detailRender = function () {
|
|
1000
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
1001
|
+
var Dom;
|
|
1002
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
1003
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1004
|
+
case 0:
|
|
1005
|
+
_context.next = 2;
|
|
1006
|
+
return detailRender(item, false);
|
|
1007
|
+
case 2:
|
|
1008
|
+
Dom = _context.sent;
|
|
1009
|
+
return _context.abrupt("return", Dom);
|
|
1010
|
+
case 4:
|
|
1011
|
+
case "end":
|
|
1012
|
+
return _context.stop();
|
|
1013
|
+
}
|
|
1014
|
+
}, _callee);
|
|
1015
|
+
}));
|
|
1016
|
+
};
|
|
960
1017
|
}
|
|
961
1018
|
if (item.detail !== undefined) json.detail = item.detail;
|
|
962
1019
|
/** 是否具有删除 */
|
|
@@ -964,23 +1021,23 @@ const SelectorData = props => {
|
|
|
964
1021
|
return json;
|
|
965
1022
|
};
|
|
966
1023
|
/** 处理节点 */
|
|
967
|
-
|
|
1024
|
+
var handNode = function handNode() {
|
|
968
1025
|
if (selectRender) {
|
|
969
1026
|
return selectRender(list || []);
|
|
970
1027
|
}
|
|
971
|
-
return list === null || list === void 0 ? void 0 : list.map((item, index)
|
|
1028
|
+
return list === null || list === void 0 ? void 0 : list.map(function (item, index) {
|
|
972
1029
|
return jsx(SelectorNode, Object.assign({}, handNodeConfig(item, index)), index);
|
|
973
1030
|
});
|
|
974
1031
|
};
|
|
975
1032
|
/** 处理标题 */
|
|
976
|
-
|
|
977
|
-
|
|
1033
|
+
var handTitle = function handTitle() {
|
|
1034
|
+
var handTitleTag = function handTitleTag() {
|
|
978
1035
|
if (selectDataTitleRender) return selectDataTitleRender(list);
|
|
979
1036
|
if (groupType) {
|
|
980
1037
|
return jsx(Fragment, {
|
|
981
|
-
children: groupType.map((item, index)
|
|
982
|
-
|
|
983
|
-
|
|
1038
|
+
children: groupType.map(function (item, index) {
|
|
1039
|
+
var num = 0;
|
|
1040
|
+
var val = item.value;
|
|
984
1041
|
if (listCom[val]) num = listCom[val].length;
|
|
985
1042
|
if (num === 0) return;
|
|
986
1043
|
return jsxs("span", Object.assign({
|
|
@@ -1005,7 +1062,7 @@ const SelectorData = props => {
|
|
|
1005
1062
|
}));
|
|
1006
1063
|
};
|
|
1007
1064
|
// 处理节点内容
|
|
1008
|
-
|
|
1065
|
+
var handContentNode = function handContentNode() {
|
|
1009
1066
|
return jsxs("div", Object.assign({
|
|
1010
1067
|
className: "selector-data-node-box"
|
|
1011
1068
|
}, {
|
|
@@ -1017,13 +1074,13 @@ const SelectorData = props => {
|
|
|
1017
1074
|
}));
|
|
1018
1075
|
};
|
|
1019
1076
|
// 处理内容
|
|
1020
|
-
|
|
1077
|
+
var handDetailTagContent = function handDetailTagContent() {
|
|
1021
1078
|
if (selectRender) {
|
|
1022
1079
|
return selectRender(list || []);
|
|
1023
1080
|
}
|
|
1024
1081
|
return jsx(Fragment, {
|
|
1025
|
-
children: list === null || list === void 0 ? void 0 : list.map((item, index)
|
|
1026
|
-
|
|
1082
|
+
children: list === null || list === void 0 ? void 0 : list.map(function (item, index) {
|
|
1083
|
+
var disabledItem = handDisabled(item);
|
|
1027
1084
|
return jsxs("span", Object.assign({
|
|
1028
1085
|
className: "content-tag"
|
|
1029
1086
|
}, {
|
|
@@ -1032,14 +1089,16 @@ const SelectorData = props => {
|
|
|
1032
1089
|
children: item[(backDataFieldConfig === null || backDataFieldConfig === void 0 ? void 0 : backDataFieldConfig.mainTitle) || ''] || item[(backDataFieldConfig === null || backDataFieldConfig === void 0 ? void 0 : backDataFieldConfig.key) || '']
|
|
1033
1090
|
})
|
|
1034
1091
|
}), !disabledItem && jsx(CloseIcon, {
|
|
1035
|
-
onClick: ()
|
|
1092
|
+
onClick: function onClick() {
|
|
1093
|
+
return _onClose && _onClose(item, index);
|
|
1094
|
+
}
|
|
1036
1095
|
})]
|
|
1037
1096
|
}), index);
|
|
1038
1097
|
})
|
|
1039
1098
|
});
|
|
1040
1099
|
};
|
|
1041
1100
|
// 处理tag内容
|
|
1042
|
-
|
|
1101
|
+
var handContentTag = function handContentTag() {
|
|
1043
1102
|
return jsxs("div", Object.assign({
|
|
1044
1103
|
className: "selector-data-tag-box"
|
|
1045
1104
|
}, {
|
|
@@ -1050,8 +1109,8 @@ const SelectorData = props => {
|
|
|
1050
1109
|
}))]
|
|
1051
1110
|
}));
|
|
1052
1111
|
};
|
|
1053
|
-
|
|
1054
|
-
|
|
1112
|
+
var handClass = function handClass() {
|
|
1113
|
+
var str = "".concat($prefixCls, "-selector-data");
|
|
1055
1114
|
if (layout) str += " ".concat($prefixCls, "-selector-data-").concat(layout);
|
|
1056
1115
|
if (disabled === true) str += " ".concat($prefixCls, "-selector-data-disabled");
|
|
1057
1116
|
if (className) str += " ".concat(className);
|
|
@@ -1069,11 +1128,9 @@ const SelectorData = props => {
|
|
|
1069
1128
|
* 发送请求
|
|
1070
1129
|
* @param obj {ReqFuncProps} 请求信息
|
|
1071
1130
|
*/
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
data
|
|
1076
|
-
} = obj,
|
|
1131
|
+
var reqFunc = function reqFunc(obj) {
|
|
1132
|
+
var method = obj.method,
|
|
1133
|
+
data = obj.data,
|
|
1077
1134
|
otherProps = __rest(obj, ["method", "data"]);
|
|
1078
1135
|
if (method === 'Get') {
|
|
1079
1136
|
return Get(Object.assign({
|
|
@@ -1082,7 +1139,7 @@ const reqFunc = obj => {
|
|
|
1082
1139
|
}
|
|
1083
1140
|
if (method === 'Post') {
|
|
1084
1141
|
return Post(Object.assign({
|
|
1085
|
-
data
|
|
1142
|
+
data: data
|
|
1086
1143
|
}, otherProps));
|
|
1087
1144
|
}
|
|
1088
1145
|
};
|