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