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