@riil-frontend/component-topology 2.12.0 → 2.12.4
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/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +22 -22
- package/demo/5/345/205/266/344/273/226/347/273/204/344/273/266//346/240/221/345/270/203/345/261/200/346/226/271/345/220/221.md +12 -0
- package/es/components/LayoutDirectionSelect/LayoutDirectionSelect.js +2 -2
- package/es/components/MultiResourceDrawer/index.js +3 -2
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -0
- package/es/components/ResourceSelectDrawer/ResourceSelectList.js +6 -1
- package/es/components/SingleResourceDrawer/SelectDrawer.js +54 -0
- package/es/components/SingleResourceDrawer/index.js +3 -3
- package/es/core/common/icons/defaultIcons.js +9 -2
- package/es/core/components/TopoView/topoView.js +2 -2
- package/es/core/editor/components/settings/Settings.js +5 -29
- package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.js +0 -0
- package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.module.scss +0 -0
- package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceSelectButton.js +12 -14
- package/es/core/editor/components/settings/{group → common}/GroupNodeList/icon.js +0 -0
- package/es/core/editor/components/settings/group/DataTab/GroupNodeList.js +19 -0
- package/es/core/editor/components/settings/group/DataTab/RelateData.js +45 -0
- package/es/core/editor/components/settings/group/GroupPropertyView.js +44 -0
- package/es/core/editor/components/settings/group/GroupPropertyView.module.scss +3 -0
- package/es/core/editor/components/settings/group/SettingTab/GroupExpandSetting.js +27 -0
- package/es/core/editor/components/settings/group/SettingTab/NodeIconSelect.js +32 -0
- package/es/core/editor/components/settings/group/SettingTab/Setting.js +86 -0
- package/es/core/editor/components/settings/group/hooks/useGroup.js +9 -0
- package/es/core/editor/components/settings/group/hooks/useGroupExpand.js +20 -0
- package/es/core/editor/components/settings/layer/LayerSettingsForm.js +2 -2
- package/es/core/editor/components/settings/{group/GroupNodeList/GroupNodeList.js → layer/NodeList.js} +3 -3
- package/es/core/editor/components/settings/link/LinkPropertyView.js +3 -3
- package/es/core/editor/components/settings/node/NodeIconSelect.js +1 -1
- package/es/core/editor/components/settings/propertyViews.js +23 -0
- package/es/core/models/TopoApp.js +27 -15
- package/es/hooks/useTopoEdit.js +137 -100
- package/es/style.js +2 -2
- package/es/topoCenter/models/TopoCenter.js +40 -12
- package/es/utils/htElementUtils.js +16 -7
- package/lib/components/LayoutDirectionSelect/LayoutDirectionSelect.js +2 -2
- package/lib/components/MultiResourceDrawer/index.js +3 -2
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -0
- package/lib/components/ResourceSelectDrawer/ResourceSelectList.js +6 -1
- package/lib/components/SingleResourceDrawer/SelectDrawer.js +68 -0
- package/lib/components/SingleResourceDrawer/index.js +3 -3
- package/lib/core/common/icons/defaultIcons.js +11 -2
- package/lib/core/components/TopoView/topoView.js +2 -2
- package/lib/core/editor/components/settings/Settings.js +5 -34
- package/lib/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.js +0 -0
- package/lib/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.module.scss +0 -0
- package/lib/core/editor/components/settings/{group → common}/GroupNodeList/ResourceSelectButton.js +13 -14
- package/lib/core/editor/components/settings/{group → common}/GroupNodeList/icon.js +0 -0
- package/lib/core/editor/components/settings/group/DataTab/GroupNodeList.js +33 -0
- package/lib/core/editor/components/settings/group/DataTab/RelateData.js +57 -0
- package/lib/core/editor/components/settings/group/GroupPropertyView.js +58 -0
- package/lib/core/editor/components/settings/group/GroupPropertyView.module.scss +3 -0
- package/lib/core/editor/components/settings/group/SettingTab/GroupExpandSetting.js +37 -0
- package/lib/core/editor/components/settings/group/SettingTab/NodeIconSelect.js +45 -0
- package/lib/core/editor/components/settings/group/SettingTab/Setting.js +106 -0
- package/lib/core/editor/components/settings/group/hooks/useGroup.js +15 -0
- package/lib/core/editor/components/settings/group/hooks/useGroupExpand.js +26 -0
- package/lib/core/editor/components/settings/layer/LayerSettingsForm.js +3 -3
- package/lib/core/editor/components/settings/{group/GroupNodeList/GroupNodeList.js → layer/NodeList.js} +3 -3
- package/lib/core/editor/components/settings/link/LinkPropertyView.js +3 -3
- package/lib/core/editor/components/settings/node/NodeIconSelect.js +1 -1
- package/lib/core/editor/components/settings/propertyViews.js +38 -0
- package/lib/core/models/TopoApp.js +27 -15
- package/lib/hooks/useTopoEdit.js +138 -100
- package/lib/style.js +2 -2
- package/lib/topoCenter/models/TopoCenter.js +40 -12
- package/lib/utils/htElementUtils.js +22 -7
- package/package.json +9 -9
package/lib/hooks/useTopoEdit.js
CHANGED
|
@@ -35,6 +35,8 @@ var _template = require("../utils/template");
|
|
|
35
35
|
|
|
36
36
|
var _topoPermissionUtil = _interopRequireDefault(require("../utils/topoPermissionUtil"));
|
|
37
37
|
|
|
38
|
+
var _htElementUtils = require("../utils/htElementUtils");
|
|
39
|
+
|
|
38
40
|
var useTopoEdit = function useTopoEdit(params) {
|
|
39
41
|
var topoApp = params.topoApp,
|
|
40
42
|
topoId = params.topoId,
|
|
@@ -91,6 +93,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
91
93
|
deletedNodes = _useDynamicList.list,
|
|
92
94
|
addDeletedNode = _useDynamicList.push,
|
|
93
95
|
clearDeletedNodes = _useDynamicList.resetList;
|
|
96
|
+
/**
|
|
97
|
+
* 拓扑图全局已选固定资源
|
|
98
|
+
*/
|
|
99
|
+
|
|
94
100
|
|
|
95
101
|
var resSelections = (0, _react.useMemo)(function () {
|
|
96
102
|
var sel = staticRes.selected && staticRes.data || [];
|
|
@@ -213,9 +219,9 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
213
219
|
id = _ref4.id;
|
|
214
220
|
|
|
215
221
|
if (!(0, _utils.isNull)(id)) {
|
|
216
|
-
setSingleResKey(
|
|
222
|
+
setSingleResKey(id);
|
|
217
223
|
} else {
|
|
218
|
-
setSingleResKey(
|
|
224
|
+
setSingleResKey(null);
|
|
219
225
|
}
|
|
220
226
|
|
|
221
227
|
setShowSingleResDrawer(true);
|
|
@@ -339,9 +345,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
339
345
|
var id = data.id,
|
|
340
346
|
tag = data.tag; // 新加的容器 tag 格式为 group_${id}
|
|
341
347
|
|
|
342
|
-
var group = topoApp.getDataModel().getDataById(tag) || topoApp.getDataModel().getDataByTag(id) ||
|
|
343
|
-
return item.a('tag') === tag;
|
|
344
|
-
})[0];
|
|
348
|
+
var group = topoApp.getDataModel().getDataById(tag) || topoApp.getDataModel().getDataByTag(id) || (0, _htElementUtils.getGroupElementByTag)(topoApp.getDataModel(), tag);
|
|
345
349
|
|
|
346
350
|
if (!group) {
|
|
347
351
|
return;
|
|
@@ -491,11 +495,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
491
495
|
|
|
492
496
|
|
|
493
497
|
function _bindGroupResourcesConfig() {
|
|
494
|
-
_bindGroupResourcesConfig = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
498
|
+
_bindGroupResourcesConfig = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(group, data) {
|
|
495
499
|
var id, tag, name, index, newGroup;
|
|
496
|
-
return _regenerator["default"].wrap(function
|
|
500
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
497
501
|
while (1) {
|
|
498
|
-
switch (
|
|
502
|
+
switch (_context6.prev = _context6.next) {
|
|
499
503
|
case 0:
|
|
500
504
|
id = group.id, tag = group.tag, name = group.name;
|
|
501
505
|
index = findGroupIndex(groups, {
|
|
@@ -504,18 +508,18 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
504
508
|
});
|
|
505
509
|
|
|
506
510
|
if (!(index > -1)) {
|
|
507
|
-
|
|
511
|
+
_context6.next = 7;
|
|
508
512
|
break;
|
|
509
513
|
}
|
|
510
514
|
|
|
511
|
-
|
|
515
|
+
_context6.next = 5;
|
|
512
516
|
return editDispatchers.updateGroupResourcesByIndex({
|
|
513
517
|
index: index,
|
|
514
518
|
resources: data
|
|
515
519
|
});
|
|
516
520
|
|
|
517
521
|
case 5:
|
|
518
|
-
|
|
522
|
+
_context6.next = 8;
|
|
519
523
|
break;
|
|
520
524
|
|
|
521
525
|
case 7:
|
|
@@ -531,10 +535,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
531
535
|
|
|
532
536
|
case 8:
|
|
533
537
|
case "end":
|
|
534
|
-
return
|
|
538
|
+
return _context6.stop();
|
|
535
539
|
}
|
|
536
540
|
}
|
|
537
|
-
},
|
|
541
|
+
}, _callee6);
|
|
538
542
|
}));
|
|
539
543
|
return _bindGroupResourcesConfig.apply(this, arguments);
|
|
540
544
|
}
|
|
@@ -548,26 +552,26 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
548
552
|
|
|
549
553
|
|
|
550
554
|
function _bindGroupResources() {
|
|
551
|
-
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
555
|
+
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(group, data) {
|
|
552
556
|
var id, tag, _yield$editDispatcher, elements, groupElement;
|
|
553
557
|
|
|
554
|
-
return _regenerator["default"].wrap(function
|
|
558
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
555
559
|
while (1) {
|
|
556
|
-
switch (
|
|
560
|
+
switch (_context7.prev = _context7.next) {
|
|
557
561
|
case 0:
|
|
558
562
|
id = group.id, tag = group.tag;
|
|
559
|
-
|
|
563
|
+
_context7.next = 3;
|
|
560
564
|
return bindGroupResourcesConfig(group, data);
|
|
561
565
|
|
|
562
566
|
case 3:
|
|
563
|
-
|
|
567
|
+
_context7.next = 5;
|
|
564
568
|
return editDispatchers.refreshDataByConfig();
|
|
565
569
|
|
|
566
570
|
case 5:
|
|
567
|
-
_yield$editDispatcher =
|
|
571
|
+
_yield$editDispatcher = _context7.sent;
|
|
568
572
|
elements = _yield$editDispatcher.topoDataTrans;
|
|
569
573
|
|
|
570
|
-
_rlog["default"].debug('
|
|
574
|
+
_rlog["default"].debug('bindGroupResources--id, tag', id, tag);
|
|
571
575
|
|
|
572
576
|
if (id) {
|
|
573
577
|
groupElement = (0, _format.filterGroupById)(elements, id);
|
|
@@ -583,10 +587,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
583
587
|
|
|
584
588
|
case 11:
|
|
585
589
|
case "end":
|
|
586
|
-
return
|
|
590
|
+
return _context7.stop();
|
|
587
591
|
}
|
|
588
592
|
}
|
|
589
|
-
},
|
|
593
|
+
}, _callee7);
|
|
590
594
|
}));
|
|
591
595
|
return _bindGroupResources.apply(this, arguments);
|
|
592
596
|
}
|
|
@@ -596,31 +600,31 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
596
600
|
}
|
|
597
601
|
|
|
598
602
|
function _bindViewResources() {
|
|
599
|
-
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
603
|
+
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(data) {
|
|
600
604
|
var _yield$editDispatcher2, elements;
|
|
601
605
|
|
|
602
|
-
return _regenerator["default"].wrap(function
|
|
606
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
603
607
|
while (1) {
|
|
604
|
-
switch (
|
|
608
|
+
switch (_context8.prev = _context8.next) {
|
|
605
609
|
case 0:
|
|
606
|
-
|
|
610
|
+
_context8.next = 2;
|
|
607
611
|
return editDispatchers.updateViewResources(data);
|
|
608
612
|
|
|
609
613
|
case 2:
|
|
610
|
-
|
|
614
|
+
_context8.next = 4;
|
|
611
615
|
return editDispatchers.refreshDataByConfig();
|
|
612
616
|
|
|
613
617
|
case 4:
|
|
614
|
-
_yield$editDispatcher2 =
|
|
618
|
+
_yield$editDispatcher2 = _context8.sent;
|
|
615
619
|
elements = _yield$editDispatcher2.topoDataTrans;
|
|
616
620
|
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements);
|
|
617
621
|
|
|
618
622
|
case 7:
|
|
619
623
|
case "end":
|
|
620
|
-
return
|
|
624
|
+
return _context8.stop();
|
|
621
625
|
}
|
|
622
626
|
}
|
|
623
|
-
},
|
|
627
|
+
}, _callee8);
|
|
624
628
|
}));
|
|
625
629
|
return _bindViewResources.apply(this, arguments);
|
|
626
630
|
}
|
|
@@ -630,12 +634,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
630
634
|
}
|
|
631
635
|
|
|
632
636
|
function _addResourceToFirstLayer() {
|
|
633
|
-
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
637
|
+
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(data) {
|
|
634
638
|
var group, config, _yield$editDispatcher3, topoData;
|
|
635
639
|
|
|
636
|
-
return _regenerator["default"].wrap(function
|
|
640
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
637
641
|
while (1) {
|
|
638
|
-
switch (
|
|
642
|
+
switch (_context9.prev = _context9.next) {
|
|
639
643
|
case 0:
|
|
640
644
|
group = groups[0];
|
|
641
645
|
config = {
|
|
@@ -649,50 +653,84 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
649
653
|
data: [].concat(group.resources["static"].data, data)
|
|
650
654
|
}
|
|
651
655
|
};
|
|
652
|
-
|
|
656
|
+
_context9.next = 4;
|
|
653
657
|
return bindGroupResourcesConfig(group, config);
|
|
654
658
|
|
|
655
659
|
case 4:
|
|
656
|
-
|
|
660
|
+
_context9.next = 6;
|
|
657
661
|
return editDispatchers.refreshDataByConfig();
|
|
658
662
|
|
|
659
663
|
case 6:
|
|
660
|
-
_yield$editDispatcher3 =
|
|
664
|
+
_yield$editDispatcher3 = _context9.sent;
|
|
661
665
|
topoData = _yield$editDispatcher3.topoData;
|
|
662
666
|
topoApp.updateElements(topoData);
|
|
663
667
|
|
|
664
668
|
case 9:
|
|
665
669
|
case "end":
|
|
666
|
-
return
|
|
670
|
+
return _context9.stop();
|
|
667
671
|
}
|
|
668
672
|
}
|
|
669
|
-
},
|
|
673
|
+
}, _callee9);
|
|
670
674
|
}));
|
|
671
675
|
return _addResourceToFirstLayer.apply(this, arguments);
|
|
672
676
|
}
|
|
673
677
|
|
|
674
|
-
var onSaveComboRes = function
|
|
675
|
-
|
|
678
|
+
var onSaveComboRes = /*#__PURE__*/function () {
|
|
679
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(data) {
|
|
680
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
681
|
+
while (1) {
|
|
682
|
+
switch (_context3.prev = _context3.next) {
|
|
683
|
+
case 0:
|
|
684
|
+
_rlog["default"].debug('关联资源-----onSaveComboRes', data, focusedGroup);
|
|
676
685
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
686
|
+
if (!(topoShowType === 'layers')) {
|
|
687
|
+
_context3.next = 6;
|
|
688
|
+
break;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
_context3.next = 4;
|
|
692
|
+
return addResourceToFirstLayer(data);
|
|
693
|
+
|
|
694
|
+
case 4:
|
|
695
|
+
_context3.next = 13;
|
|
696
|
+
break;
|
|
697
|
+
|
|
698
|
+
case 6:
|
|
699
|
+
if (!focusedGroup) {
|
|
700
|
+
_context3.next = 11;
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
688
703
|
|
|
689
|
-
|
|
690
|
-
|
|
704
|
+
_context3.next = 9;
|
|
705
|
+
return bindGroupResources(focusedGroup, data);
|
|
706
|
+
|
|
707
|
+
case 9:
|
|
708
|
+
_context3.next = 13;
|
|
709
|
+
break;
|
|
710
|
+
|
|
711
|
+
case 11:
|
|
712
|
+
_context3.next = 13;
|
|
713
|
+
return bindViewResources(data);
|
|
714
|
+
|
|
715
|
+
case 13:
|
|
716
|
+
case "end":
|
|
717
|
+
return _context3.stop();
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}, _callee3);
|
|
721
|
+
}));
|
|
722
|
+
|
|
723
|
+
return function onSaveComboRes(_x7) {
|
|
724
|
+
return _ref5.apply(this, arguments);
|
|
725
|
+
};
|
|
726
|
+
}();
|
|
727
|
+
|
|
728
|
+
var onSaveSingleRes = function onSaveSingleRes(selectedResKey) {
|
|
729
|
+
_rlog["default"].debug('onSaveSingleRes', selectedResKey);
|
|
691
730
|
|
|
692
|
-
var selectedRes = resource[0];
|
|
693
731
|
var selected = staticRes.selected,
|
|
694
732
|
data = staticRes.data;
|
|
695
|
-
var exist = data.indexOf(
|
|
733
|
+
var exist = data.indexOf(selectedResKey) !== -1;
|
|
696
734
|
|
|
697
735
|
if (selected && exist) {
|
|
698
736
|
// 资源已被选
|
|
@@ -704,15 +742,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
704
742
|
|
|
705
743
|
if (singleResKey) {
|
|
706
744
|
list = list.filter(function (item) {
|
|
707
|
-
return item !== singleResKey
|
|
745
|
+
return item !== singleResKey;
|
|
708
746
|
});
|
|
709
747
|
}
|
|
710
748
|
|
|
711
749
|
if (!exist) {
|
|
712
|
-
list =
|
|
750
|
+
list = [].concat(list, [selectedResKey]);
|
|
713
751
|
}
|
|
714
752
|
|
|
715
|
-
setSingleResKey(
|
|
753
|
+
setSingleResKey(selectedResKey);
|
|
716
754
|
editDispatchers.updateResources({
|
|
717
755
|
"static": {
|
|
718
756
|
selected: true,
|
|
@@ -723,32 +761,32 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
723
761
|
}
|
|
724
762
|
};
|
|
725
763
|
|
|
726
|
-
function checkSavePermission(
|
|
764
|
+
function checkSavePermission(_x8) {
|
|
727
765
|
return _checkSavePermission.apply(this, arguments);
|
|
728
766
|
}
|
|
729
767
|
|
|
730
768
|
function _checkSavePermission() {
|
|
731
|
-
_checkSavePermission = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
769
|
+
_checkSavePermission = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(id) {
|
|
732
770
|
var permission;
|
|
733
|
-
return _regenerator["default"].wrap(function
|
|
771
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
734
772
|
while (1) {
|
|
735
|
-
switch (
|
|
773
|
+
switch (_context10.prev = _context10.next) {
|
|
736
774
|
case 0:
|
|
737
|
-
|
|
775
|
+
_context10.next = 2;
|
|
738
776
|
return topoDispatchers.getTopoPermission({
|
|
739
777
|
id: id,
|
|
740
778
|
update: false
|
|
741
779
|
});
|
|
742
780
|
|
|
743
781
|
case 2:
|
|
744
|
-
permission =
|
|
782
|
+
permission = _context10.sent;
|
|
745
783
|
|
|
746
784
|
if (!_topoPermissionUtil["default"].isEditable(permission)) {
|
|
747
|
-
|
|
785
|
+
_context10.next = 5;
|
|
748
786
|
break;
|
|
749
787
|
}
|
|
750
788
|
|
|
751
|
-
return
|
|
789
|
+
return _context10.abrupt("return", true);
|
|
752
790
|
|
|
753
791
|
case 5:
|
|
754
792
|
_dialog["default"].alert({
|
|
@@ -760,43 +798,43 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
760
798
|
onOk: function onOk() {}
|
|
761
799
|
});
|
|
762
800
|
|
|
763
|
-
return
|
|
801
|
+
return _context10.abrupt("return", false);
|
|
764
802
|
|
|
765
803
|
case 7:
|
|
766
804
|
case "end":
|
|
767
|
-
return
|
|
805
|
+
return _context10.stop();
|
|
768
806
|
}
|
|
769
807
|
}
|
|
770
|
-
},
|
|
808
|
+
}, _callee10);
|
|
771
809
|
}));
|
|
772
810
|
return _checkSavePermission.apply(this, arguments);
|
|
773
811
|
}
|
|
774
812
|
|
|
775
813
|
var onSaveTopo = /*#__PURE__*/function () {
|
|
776
|
-
var
|
|
814
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
|
|
777
815
|
var id, config, global, serialize, saveConfig, valid, _config$layout2, template, layout;
|
|
778
816
|
|
|
779
|
-
return _regenerator["default"].wrap(function
|
|
817
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
780
818
|
while (1) {
|
|
781
|
-
switch (
|
|
819
|
+
switch (_context5.prev = _context5.next) {
|
|
782
820
|
case 0:
|
|
783
821
|
id = data.id, config = data.config, global = data.global, serialize = data.serialize;
|
|
784
822
|
|
|
785
823
|
if (!onSave) {
|
|
786
|
-
|
|
824
|
+
_context5.next = 5;
|
|
787
825
|
break;
|
|
788
826
|
}
|
|
789
827
|
|
|
790
828
|
saveConfig = /*#__PURE__*/function () {
|
|
791
|
-
var
|
|
829
|
+
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
792
830
|
var _config$layout, template, layout;
|
|
793
831
|
|
|
794
|
-
return _regenerator["default"].wrap(function
|
|
832
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
795
833
|
while (1) {
|
|
796
|
-
switch (
|
|
834
|
+
switch (_context4.prev = _context4.next) {
|
|
797
835
|
case 0:
|
|
798
836
|
_config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
|
|
799
|
-
|
|
837
|
+
_context4.next = 3;
|
|
800
838
|
return editDispatchers.saveTopo({
|
|
801
839
|
id: id,
|
|
802
840
|
template: template,
|
|
@@ -807,14 +845,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
807
845
|
|
|
808
846
|
case 3:
|
|
809
847
|
case "end":
|
|
810
|
-
return
|
|
848
|
+
return _context4.stop();
|
|
811
849
|
}
|
|
812
850
|
}
|
|
813
|
-
},
|
|
851
|
+
}, _callee4);
|
|
814
852
|
}));
|
|
815
853
|
|
|
816
854
|
return function saveConfig() {
|
|
817
|
-
return
|
|
855
|
+
return _ref7.apply(this, arguments);
|
|
818
856
|
};
|
|
819
857
|
}();
|
|
820
858
|
|
|
@@ -822,7 +860,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
822
860
|
data: data,
|
|
823
861
|
saveConfig: saveConfig
|
|
824
862
|
});
|
|
825
|
-
return
|
|
863
|
+
return _context5.abrupt("return");
|
|
826
864
|
|
|
827
865
|
case 5:
|
|
828
866
|
// TODO 以下逻辑移到拓扑中心
|
|
@@ -830,26 +868,26 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
830
868
|
saving: true
|
|
831
869
|
}); // 检查权限
|
|
832
870
|
|
|
833
|
-
|
|
871
|
+
_context5.next = 8;
|
|
834
872
|
return checkSavePermission(id);
|
|
835
873
|
|
|
836
874
|
case 8:
|
|
837
|
-
valid =
|
|
875
|
+
valid = _context5.sent;
|
|
838
876
|
|
|
839
877
|
if (valid) {
|
|
840
|
-
|
|
878
|
+
_context5.next = 12;
|
|
841
879
|
break;
|
|
842
880
|
}
|
|
843
881
|
|
|
844
882
|
topoEditDispatchers.update({
|
|
845
883
|
saving: false
|
|
846
884
|
});
|
|
847
|
-
return
|
|
885
|
+
return _context5.abrupt("return");
|
|
848
886
|
|
|
849
887
|
case 12:
|
|
850
888
|
// 保存
|
|
851
889
|
_config$layout2 = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout2.type, layout = _config$layout2.layout;
|
|
852
|
-
|
|
890
|
+
_context5.next = 15;
|
|
853
891
|
return editDispatchers.saveTopo({
|
|
854
892
|
id: id,
|
|
855
893
|
template: template,
|
|
@@ -861,7 +899,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
861
899
|
});
|
|
862
900
|
|
|
863
901
|
case 15:
|
|
864
|
-
|
|
902
|
+
_context5.next = 17;
|
|
865
903
|
return editDispatchers.addToBlockList({
|
|
866
904
|
id: topoId,
|
|
867
905
|
ciIdList: deletedNodes
|
|
@@ -878,14 +916,14 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
878
916
|
|
|
879
917
|
case 20:
|
|
880
918
|
case "end":
|
|
881
|
-
return
|
|
919
|
+
return _context5.stop();
|
|
882
920
|
}
|
|
883
921
|
}
|
|
884
|
-
},
|
|
922
|
+
}, _callee5);
|
|
885
923
|
}));
|
|
886
924
|
|
|
887
|
-
return function onSaveTopo(
|
|
888
|
-
return
|
|
925
|
+
return function onSaveTopo(_x9) {
|
|
926
|
+
return _ref6.apply(this, arguments);
|
|
889
927
|
};
|
|
890
928
|
}();
|
|
891
929
|
|
|
@@ -953,22 +991,22 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
953
991
|
* @return {Promise<void>}
|
|
954
992
|
*/
|
|
955
993
|
|
|
956
|
-
function refreshDataByConfig(
|
|
994
|
+
function refreshDataByConfig(_x10) {
|
|
957
995
|
return _refreshDataByConfig.apply(this, arguments);
|
|
958
996
|
}
|
|
959
997
|
|
|
960
998
|
function _refreshDataByConfig() {
|
|
961
|
-
_refreshDataByConfig = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
999
|
+
_refreshDataByConfig = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(config) {
|
|
962
1000
|
var resources, groups, dRes, sRes, query;
|
|
963
|
-
return _regenerator["default"].wrap(function
|
|
1001
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
964
1002
|
while (1) {
|
|
965
|
-
switch (
|
|
1003
|
+
switch (_context11.prev = _context11.next) {
|
|
966
1004
|
case 0:
|
|
967
1005
|
resources = config.resources, groups = config.groups;
|
|
968
1006
|
dRes = resources.dynamic, sRes = resources["static"];
|
|
969
1007
|
|
|
970
1008
|
if (!(dRes.selected && dRes.condition || sRes.selected && (0, _utils.isAvailableArray)(sRes.data) || (0, _utils.isAvailableArray)(groups))) {
|
|
971
|
-
|
|
1009
|
+
_context11.next = 7;
|
|
972
1010
|
break;
|
|
973
1011
|
}
|
|
974
1012
|
|
|
@@ -981,15 +1019,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
981
1019
|
_rlog["default"].debug('useEffect', editState, isEditing, topoId, resources, groups); // editDispatchers.update({ resources, groups });
|
|
982
1020
|
|
|
983
1021
|
|
|
984
|
-
|
|
1022
|
+
_context11.next = 7;
|
|
985
1023
|
return editDispatchers.getTopoByConditions(query);
|
|
986
1024
|
|
|
987
1025
|
case 7:
|
|
988
1026
|
case "end":
|
|
989
|
-
return
|
|
1027
|
+
return _context11.stop();
|
|
990
1028
|
}
|
|
991
1029
|
}
|
|
992
|
-
},
|
|
1030
|
+
}, _callee11);
|
|
993
1031
|
}));
|
|
994
1032
|
return _refreshDataByConfig.apply(this, arguments);
|
|
995
1033
|
}
|
|
@@ -1012,7 +1050,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1012
1050
|
if (showSingleResDrawer) {
|
|
1013
1051
|
if ((0, _utils.isAvailableArray)(topo)) {
|
|
1014
1052
|
// 需要过滤出单选的节点及其相关连线
|
|
1015
|
-
var nodeId = singleResKey
|
|
1053
|
+
var nodeId = singleResKey;
|
|
1016
1054
|
var data = (0, _format.filterNode)(topo, nodeId);
|
|
1017
1055
|
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_SINGLE, data);
|
|
1018
1056
|
}
|
package/lib/style.js
CHANGED
|
@@ -20,11 +20,11 @@ require('@alifd/next/lib/box/style');
|
|
|
20
20
|
require('@alifd/next/lib/dropdown/style');
|
|
21
21
|
require('@alifd/next/lib/menu/style');
|
|
22
22
|
require('@alifd/next/lib/tab/style');
|
|
23
|
-
require('@alifd/next/lib/radio/style');
|
|
24
23
|
require('@alifd/next/lib/collapse/style');
|
|
25
|
-
require('@alifd/next/lib/list/style');
|
|
26
24
|
require('@alifd/next/lib/tree-select/style');
|
|
27
25
|
|
|
26
|
+
require('@alifd/next/lib/radio/style');
|
|
27
|
+
require('@alifd/next/lib/list/style');
|
|
28
28
|
require('@alifd/next/lib/tag/style');
|
|
29
29
|
|
|
30
30
|
require('./index.scss');
|
|
@@ -31,6 +31,34 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
|
31
31
|
loadData: _getTopoData["default"]
|
|
32
32
|
}, options, {
|
|
33
33
|
usePermission: true,
|
|
34
|
+
beforeSwitchToEditMode: function () {
|
|
35
|
+
var _beforeSwitchToEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
36
|
+
var topoDispatchers;
|
|
37
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
38
|
+
while (1) {
|
|
39
|
+
switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
topoDispatchers = _this.store.getModelDispatchers('topoMod');
|
|
42
|
+
topoDispatchers.update({
|
|
43
|
+
topoData: null
|
|
44
|
+
});
|
|
45
|
+
_context.next = 4;
|
|
46
|
+
return topoDispatchers.refreshTopo();
|
|
47
|
+
|
|
48
|
+
case 4:
|
|
49
|
+
case "end":
|
|
50
|
+
return _context.stop();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, _callee);
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
function beforeSwitchToEditMode() {
|
|
57
|
+
return _beforeSwitchToEditMode.apply(this, arguments);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return beforeSwitchToEditMode;
|
|
61
|
+
}(),
|
|
34
62
|
onSwitchToEditMode: function onSwitchToEditMode() {
|
|
35
63
|
var editDispatchers = _this.store.getModelDispatchers('topoCreateMod');
|
|
36
64
|
|
|
@@ -63,22 +91,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
|
63
91
|
_proto.initData =
|
|
64
92
|
/*#__PURE__*/
|
|
65
93
|
function () {
|
|
66
|
-
var _initData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
94
|
+
var _initData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(params) {
|
|
67
95
|
var topoDispatchers;
|
|
68
|
-
return _regenerator["default"].wrap(function
|
|
96
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
69
97
|
while (1) {
|
|
70
|
-
switch (
|
|
98
|
+
switch (_context2.prev = _context2.next) {
|
|
71
99
|
case 0:
|
|
72
100
|
topoDispatchers = this.store.getModelDispatchers('topoCenter');
|
|
73
|
-
|
|
101
|
+
_context2.next = 3;
|
|
74
102
|
return topoDispatchers.initData(params);
|
|
75
103
|
|
|
76
104
|
case 3:
|
|
77
105
|
case "end":
|
|
78
|
-
return
|
|
106
|
+
return _context2.stop();
|
|
79
107
|
}
|
|
80
108
|
}
|
|
81
|
-
},
|
|
109
|
+
}, _callee2, this);
|
|
82
110
|
}));
|
|
83
111
|
|
|
84
112
|
function initData(_x) {
|
|
@@ -100,22 +128,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
|
100
128
|
_proto.exit =
|
|
101
129
|
/*#__PURE__*/
|
|
102
130
|
function () {
|
|
103
|
-
var _exit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
131
|
+
var _exit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
104
132
|
var topoDispatchers;
|
|
105
|
-
return _regenerator["default"].wrap(function
|
|
133
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
106
134
|
while (1) {
|
|
107
|
-
switch (
|
|
135
|
+
switch (_context3.prev = _context3.next) {
|
|
108
136
|
case 0:
|
|
109
137
|
topoDispatchers = this.store.getModelDispatchers('topoCenter');
|
|
110
|
-
|
|
138
|
+
_context3.next = 3;
|
|
111
139
|
return topoDispatchers.exit();
|
|
112
140
|
|
|
113
141
|
case 3:
|
|
114
142
|
case "end":
|
|
115
|
-
return
|
|
143
|
+
return _context3.stop();
|
|
116
144
|
}
|
|
117
145
|
}
|
|
118
|
-
},
|
|
146
|
+
}, _callee3, this);
|
|
119
147
|
}));
|
|
120
148
|
|
|
121
149
|
function exit() {
|