@riil-frontend/component-topology 2.12.4 → 2.12.6-alpha.0
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 +28 -28
- package/es/components/Link/index.module.scss +2 -2
- package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/es/components/SingleResourceDrawer/SingleResourceDrawer.js +58 -0
- package/es/components/SingleResourceDrawer/index.js +2 -52
- package/es/core/components/TopoView/topoView.js +7 -23
- package/es/core/editor/components/EditorPlugin.js +2 -1
- package/es/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +1 -1
- package/es/core/editor/components/resource/SingleResourceDrawer/SelectDrawer.js +54 -0
- package/es/core/editor/components/resource/SingleResourceDrawer/SingleResourceDrawer.js +58 -0
- package/es/core/editor/components/resource/SingleResourceDrawer/index.js +2 -0
- package/es/core/editor/components/settings/common/GroupNodeList/ResourceList.js +1 -1
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +1 -1
- package/es/core/editor/components/settings/group/DataTab/GroupNodeList.js +1 -1
- package/es/core/editor/components/settings/group/DataTab/RelateData.js +2 -1
- package/es/core/editor/components/settings/node/NodePropertyView.js +1 -1
- package/es/core/editor/components/settings/node/data/BindResourceDrawer.js +65 -0
- package/es/core/editor/components/settings/node/data/NodeRelateResourceButton.js +41 -0
- package/es/hooks/useSelection.js +4 -3
- package/es/hooks/useTopoEdit.js +172 -143
- package/es/models/topoCreateMod.js +5 -0
- package/es/models/topoMod.js +45 -43
- package/es/style.js +3 -6
- package/es/utils/htElementUtils.js +25 -1
- package/lib/components/Link/index.module.scss +2 -2
- package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -1
- package/lib/components/SingleResourceDrawer/SingleResourceDrawer.js +72 -0
- package/lib/components/SingleResourceDrawer/index.js +2 -57
- package/lib/core/components/TopoView/topoView.js +7 -23
- package/lib/core/editor/components/EditorPlugin.js +2 -1
- package/lib/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +1 -1
- package/lib/core/editor/components/resource/SingleResourceDrawer/SelectDrawer.js +68 -0
- package/lib/core/editor/components/resource/SingleResourceDrawer/SingleResourceDrawer.js +72 -0
- package/lib/core/editor/components/resource/SingleResourceDrawer/index.js +11 -0
- package/lib/core/editor/components/settings/common/GroupNodeList/ResourceList.js +1 -3
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +1 -1
- package/lib/core/editor/components/settings/group/DataTab/GroupNodeList.js +1 -1
- package/lib/core/editor/components/settings/group/DataTab/RelateData.js +2 -1
- package/lib/core/editor/components/settings/node/NodePropertyView.js +1 -1
- package/lib/core/editor/components/settings/node/data/BindResourceDrawer.js +79 -0
- package/lib/core/editor/components/settings/node/data/NodeRelateResourceButton.js +54 -0
- package/lib/hooks/useSelection.js +4 -3
- package/lib/hooks/useTopoEdit.js +174 -144
- package/lib/models/topoCreateMod.js +5 -0
- package/lib/models/topoMod.js +45 -43
- package/lib/style.js +3 -6
- package/lib/utils/htElementUtils.js +27 -1
- package/package.json +15 -15
- package/CHANGELOG.md +0 -26
- package/es/core/editor/components/settings/node/NodeRelateResourceButton.js +0 -22
- package/lib/core/editor/components/settings/node/NodeRelateResourceButton.js +0 -31
package/lib/hooks/useTopoEdit.js
CHANGED
|
@@ -85,10 +85,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
85
85
|
showSingleResDrawer = _useState4[0],
|
|
86
86
|
setShowSingleResDrawer = _useState4[1];
|
|
87
87
|
|
|
88
|
-
var _useState5 = (0, _react.useState)(null),
|
|
89
|
-
singleResKey = _useState5[0],
|
|
90
|
-
setSingleResKey = _useState5[1];
|
|
91
|
-
|
|
92
88
|
var _useDynamicList = (0, _ahooks.useDynamicList)([]),
|
|
93
89
|
deletedNodes = _useDynamicList.list,
|
|
94
90
|
addDeletedNode = _useDynamicList.push,
|
|
@@ -141,7 +137,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
141
137
|
switch (type) {
|
|
142
138
|
case _componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_SINGLE:
|
|
143
139
|
{
|
|
144
|
-
|
|
140
|
+
openBindNodeResourceDrawer(data);
|
|
145
141
|
}
|
|
146
142
|
break;
|
|
147
143
|
|
|
@@ -209,23 +205,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
209
205
|
setComboResData(res);
|
|
210
206
|
setShowComboResDrawer(true);
|
|
211
207
|
};
|
|
212
|
-
/**
|
|
213
|
-
* 打开节点关联/重新关联资源
|
|
214
|
-
*/
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
var bindNodeResource = function bindNodeResource(node) {
|
|
218
|
-
var _ref4 = node || {},
|
|
219
|
-
id = _ref4.id;
|
|
220
|
-
|
|
221
|
-
if (!(0, _utils.isNull)(id)) {
|
|
222
|
-
setSingleResKey(id);
|
|
223
|
-
} else {
|
|
224
|
-
setSingleResKey(null);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
setShowSingleResDrawer(true);
|
|
228
|
-
};
|
|
229
208
|
|
|
230
209
|
var onDeleteElement = function onDeleteElement(data) {
|
|
231
210
|
var _topoApp$options$edit;
|
|
@@ -495,11 +474,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
495
474
|
|
|
496
475
|
|
|
497
476
|
function _bindGroupResourcesConfig() {
|
|
498
|
-
_bindGroupResourcesConfig = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
477
|
+
_bindGroupResourcesConfig = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(group, data) {
|
|
499
478
|
var id, tag, name, index, newGroup;
|
|
500
|
-
return _regenerator["default"].wrap(function
|
|
479
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
501
480
|
while (1) {
|
|
502
|
-
switch (
|
|
481
|
+
switch (_context7.prev = _context7.next) {
|
|
503
482
|
case 0:
|
|
504
483
|
id = group.id, tag = group.tag, name = group.name;
|
|
505
484
|
index = findGroupIndex(groups, {
|
|
@@ -508,18 +487,18 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
508
487
|
});
|
|
509
488
|
|
|
510
489
|
if (!(index > -1)) {
|
|
511
|
-
|
|
490
|
+
_context7.next = 7;
|
|
512
491
|
break;
|
|
513
492
|
}
|
|
514
493
|
|
|
515
|
-
|
|
494
|
+
_context7.next = 5;
|
|
516
495
|
return editDispatchers.updateGroupResourcesByIndex({
|
|
517
496
|
index: index,
|
|
518
497
|
resources: data
|
|
519
498
|
});
|
|
520
499
|
|
|
521
500
|
case 5:
|
|
522
|
-
|
|
501
|
+
_context7.next = 8;
|
|
523
502
|
break;
|
|
524
503
|
|
|
525
504
|
case 7:
|
|
@@ -535,10 +514,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
535
514
|
|
|
536
515
|
case 8:
|
|
537
516
|
case "end":
|
|
538
|
-
return
|
|
517
|
+
return _context7.stop();
|
|
539
518
|
}
|
|
540
519
|
}
|
|
541
|
-
},
|
|
520
|
+
}, _callee7);
|
|
542
521
|
}));
|
|
543
522
|
return _bindGroupResourcesConfig.apply(this, arguments);
|
|
544
523
|
}
|
|
@@ -552,24 +531,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
552
531
|
|
|
553
532
|
|
|
554
533
|
function _bindGroupResources() {
|
|
555
|
-
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
556
|
-
var id, tag, _yield$
|
|
534
|
+
_bindGroupResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(group, data) {
|
|
535
|
+
var id, tag, _yield$editDispatcher2, elements, groupElement;
|
|
557
536
|
|
|
558
|
-
return _regenerator["default"].wrap(function
|
|
537
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
559
538
|
while (1) {
|
|
560
|
-
switch (
|
|
539
|
+
switch (_context8.prev = _context8.next) {
|
|
561
540
|
case 0:
|
|
562
541
|
id = group.id, tag = group.tag;
|
|
563
|
-
|
|
542
|
+
_context8.next = 3;
|
|
564
543
|
return bindGroupResourcesConfig(group, data);
|
|
565
544
|
|
|
566
545
|
case 3:
|
|
567
|
-
|
|
546
|
+
_context8.next = 5;
|
|
568
547
|
return editDispatchers.refreshDataByConfig();
|
|
569
548
|
|
|
570
549
|
case 5:
|
|
571
|
-
_yield$
|
|
572
|
-
elements = _yield$
|
|
550
|
+
_yield$editDispatcher2 = _context8.sent;
|
|
551
|
+
elements = _yield$editDispatcher2.topoDataTrans;
|
|
573
552
|
|
|
574
553
|
_rlog["default"].debug('bindGroupResources--id, tag', id, tag);
|
|
575
554
|
|
|
@@ -587,10 +566,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
587
566
|
|
|
588
567
|
case 11:
|
|
589
568
|
case "end":
|
|
590
|
-
return
|
|
569
|
+
return _context8.stop();
|
|
591
570
|
}
|
|
592
571
|
}
|
|
593
|
-
},
|
|
572
|
+
}, _callee8);
|
|
594
573
|
}));
|
|
595
574
|
return _bindGroupResources.apply(this, arguments);
|
|
596
575
|
}
|
|
@@ -600,31 +579,31 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
600
579
|
}
|
|
601
580
|
|
|
602
581
|
function _bindViewResources() {
|
|
603
|
-
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
604
|
-
var _yield$
|
|
582
|
+
_bindViewResources = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(data) {
|
|
583
|
+
var _yield$editDispatcher3, elements;
|
|
605
584
|
|
|
606
|
-
return _regenerator["default"].wrap(function
|
|
585
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
607
586
|
while (1) {
|
|
608
|
-
switch (
|
|
587
|
+
switch (_context9.prev = _context9.next) {
|
|
609
588
|
case 0:
|
|
610
|
-
|
|
589
|
+
_context9.next = 2;
|
|
611
590
|
return editDispatchers.updateViewResources(data);
|
|
612
591
|
|
|
613
592
|
case 2:
|
|
614
|
-
|
|
593
|
+
_context9.next = 4;
|
|
615
594
|
return editDispatchers.refreshDataByConfig();
|
|
616
595
|
|
|
617
596
|
case 4:
|
|
618
|
-
_yield$
|
|
619
|
-
elements = _yield$
|
|
597
|
+
_yield$editDispatcher3 = _context9.sent;
|
|
598
|
+
elements = _yield$editDispatcher3.topoDataTrans;
|
|
620
599
|
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements);
|
|
621
600
|
|
|
622
601
|
case 7:
|
|
623
602
|
case "end":
|
|
624
|
-
return
|
|
603
|
+
return _context9.stop();
|
|
625
604
|
}
|
|
626
605
|
}
|
|
627
|
-
},
|
|
606
|
+
}, _callee9);
|
|
628
607
|
}));
|
|
629
608
|
return _bindViewResources.apply(this, arguments);
|
|
630
609
|
}
|
|
@@ -634,12 +613,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
634
613
|
}
|
|
635
614
|
|
|
636
615
|
function _addResourceToFirstLayer() {
|
|
637
|
-
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
638
|
-
var group, config, _yield$
|
|
616
|
+
_addResourceToFirstLayer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(data) {
|
|
617
|
+
var group, config, _yield$editDispatcher4, topoData;
|
|
639
618
|
|
|
640
|
-
return _regenerator["default"].wrap(function
|
|
619
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
641
620
|
while (1) {
|
|
642
|
-
switch (
|
|
621
|
+
switch (_context10.prev = _context10.next) {
|
|
643
622
|
case 0:
|
|
644
623
|
group = groups[0];
|
|
645
624
|
config = {
|
|
@@ -653,30 +632,30 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
653
632
|
data: [].concat(group.resources["static"].data, data)
|
|
654
633
|
}
|
|
655
634
|
};
|
|
656
|
-
|
|
635
|
+
_context10.next = 4;
|
|
657
636
|
return bindGroupResourcesConfig(group, config);
|
|
658
637
|
|
|
659
638
|
case 4:
|
|
660
|
-
|
|
639
|
+
_context10.next = 6;
|
|
661
640
|
return editDispatchers.refreshDataByConfig();
|
|
662
641
|
|
|
663
642
|
case 6:
|
|
664
|
-
_yield$
|
|
665
|
-
topoData = _yield$
|
|
643
|
+
_yield$editDispatcher4 = _context10.sent;
|
|
644
|
+
topoData = _yield$editDispatcher4.topoData;
|
|
666
645
|
topoApp.updateElements(topoData);
|
|
667
646
|
|
|
668
647
|
case 9:
|
|
669
648
|
case "end":
|
|
670
|
-
return
|
|
649
|
+
return _context10.stop();
|
|
671
650
|
}
|
|
672
651
|
}
|
|
673
|
-
},
|
|
652
|
+
}, _callee10);
|
|
674
653
|
}));
|
|
675
654
|
return _addResourceToFirstLayer.apply(this, arguments);
|
|
676
655
|
}
|
|
677
656
|
|
|
678
657
|
var onSaveComboRes = /*#__PURE__*/function () {
|
|
679
|
-
var
|
|
658
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(data) {
|
|
680
659
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
681
660
|
while (1) {
|
|
682
661
|
switch (_context3.prev = _context3.next) {
|
|
@@ -721,72 +700,36 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
721
700
|
}));
|
|
722
701
|
|
|
723
702
|
return function onSaveComboRes(_x7) {
|
|
724
|
-
return
|
|
703
|
+
return _ref4.apply(this, arguments);
|
|
725
704
|
};
|
|
726
705
|
}();
|
|
727
706
|
|
|
728
|
-
var onSaveSingleRes = function onSaveSingleRes(selectedResKey) {
|
|
729
|
-
_rlog["default"].debug('onSaveSingleRes', selectedResKey);
|
|
730
|
-
|
|
731
|
-
var selected = staticRes.selected,
|
|
732
|
-
data = staticRes.data;
|
|
733
|
-
var exist = data.indexOf(selectedResKey) !== -1;
|
|
734
|
-
|
|
735
|
-
if (selected && exist) {
|
|
736
|
-
// 资源已被选
|
|
737
|
-
_message["default"].warning('所选资源在图上已存在,请重新选择一个。');
|
|
738
|
-
|
|
739
|
-
return false;
|
|
740
|
-
} else {
|
|
741
|
-
var list = data;
|
|
742
|
-
|
|
743
|
-
if (singleResKey) {
|
|
744
|
-
list = list.filter(function (item) {
|
|
745
|
-
return item !== singleResKey;
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
if (!exist) {
|
|
750
|
-
list = [].concat(list, [selectedResKey]);
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
setSingleResKey(selectedResKey);
|
|
754
|
-
editDispatchers.updateResources({
|
|
755
|
-
"static": {
|
|
756
|
-
selected: true,
|
|
757
|
-
data: list
|
|
758
|
-
}
|
|
759
|
-
});
|
|
760
|
-
return true;
|
|
761
|
-
}
|
|
762
|
-
};
|
|
763
|
-
|
|
764
707
|
function checkSavePermission(_x8) {
|
|
765
708
|
return _checkSavePermission.apply(this, arguments);
|
|
766
709
|
}
|
|
767
710
|
|
|
768
711
|
function _checkSavePermission() {
|
|
769
|
-
_checkSavePermission = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
712
|
+
_checkSavePermission = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(id) {
|
|
770
713
|
var permission;
|
|
771
|
-
return _regenerator["default"].wrap(function
|
|
714
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
772
715
|
while (1) {
|
|
773
|
-
switch (
|
|
716
|
+
switch (_context11.prev = _context11.next) {
|
|
774
717
|
case 0:
|
|
775
|
-
|
|
718
|
+
_context11.next = 2;
|
|
776
719
|
return topoDispatchers.getTopoPermission({
|
|
777
720
|
id: id,
|
|
778
721
|
update: false
|
|
779
722
|
});
|
|
780
723
|
|
|
781
724
|
case 2:
|
|
782
|
-
permission =
|
|
725
|
+
permission = _context11.sent;
|
|
783
726
|
|
|
784
727
|
if (!_topoPermissionUtil["default"].isEditable(permission)) {
|
|
785
|
-
|
|
728
|
+
_context11.next = 5;
|
|
786
729
|
break;
|
|
787
730
|
}
|
|
788
731
|
|
|
789
|
-
return
|
|
732
|
+
return _context11.abrupt("return", true);
|
|
790
733
|
|
|
791
734
|
case 5:
|
|
792
735
|
_dialog["default"].alert({
|
|
@@ -798,20 +741,20 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
798
741
|
onOk: function onOk() {}
|
|
799
742
|
});
|
|
800
743
|
|
|
801
|
-
return
|
|
744
|
+
return _context11.abrupt("return", false);
|
|
802
745
|
|
|
803
746
|
case 7:
|
|
804
747
|
case "end":
|
|
805
|
-
return
|
|
748
|
+
return _context11.stop();
|
|
806
749
|
}
|
|
807
750
|
}
|
|
808
|
-
},
|
|
751
|
+
}, _callee11);
|
|
809
752
|
}));
|
|
810
753
|
return _checkSavePermission.apply(this, arguments);
|
|
811
754
|
}
|
|
812
755
|
|
|
813
756
|
var onSaveTopo = /*#__PURE__*/function () {
|
|
814
|
-
var
|
|
757
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data) {
|
|
815
758
|
var id, config, global, serialize, saveConfig, valid, _config$layout2, template, layout;
|
|
816
759
|
|
|
817
760
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
@@ -826,7 +769,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
826
769
|
}
|
|
827
770
|
|
|
828
771
|
saveConfig = /*#__PURE__*/function () {
|
|
829
|
-
var
|
|
772
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
830
773
|
var _config$layout, template, layout;
|
|
831
774
|
|
|
832
775
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
@@ -852,7 +795,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
852
795
|
}));
|
|
853
796
|
|
|
854
797
|
return function saveConfig() {
|
|
855
|
-
return
|
|
798
|
+
return _ref6.apply(this, arguments);
|
|
856
799
|
};
|
|
857
800
|
}();
|
|
858
801
|
|
|
@@ -923,7 +866,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
923
866
|
}));
|
|
924
867
|
|
|
925
868
|
return function onSaveTopo(_x9) {
|
|
926
|
-
return
|
|
869
|
+
return _ref5.apply(this, arguments);
|
|
927
870
|
};
|
|
928
871
|
}();
|
|
929
872
|
|
|
@@ -996,17 +939,17 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
996
939
|
}
|
|
997
940
|
|
|
998
941
|
function _refreshDataByConfig() {
|
|
999
|
-
_refreshDataByConfig = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
942
|
+
_refreshDataByConfig = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(config) {
|
|
1000
943
|
var resources, groups, dRes, sRes, query;
|
|
1001
|
-
return _regenerator["default"].wrap(function
|
|
944
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
1002
945
|
while (1) {
|
|
1003
|
-
switch (
|
|
946
|
+
switch (_context12.prev = _context12.next) {
|
|
1004
947
|
case 0:
|
|
1005
948
|
resources = config.resources, groups = config.groups;
|
|
1006
949
|
dRes = resources.dynamic, sRes = resources["static"];
|
|
1007
950
|
|
|
1008
951
|
if (!(dRes.selected && dRes.condition || sRes.selected && (0, _utils.isAvailableArray)(sRes.data) || (0, _utils.isAvailableArray)(groups))) {
|
|
1009
|
-
|
|
952
|
+
_context12.next = 7;
|
|
1010
953
|
break;
|
|
1011
954
|
}
|
|
1012
955
|
|
|
@@ -1019,15 +962,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1019
962
|
_rlog["default"].debug('useEffect', editState, isEditing, topoId, resources, groups); // editDispatchers.update({ resources, groups });
|
|
1020
963
|
|
|
1021
964
|
|
|
1022
|
-
|
|
965
|
+
_context12.next = 7;
|
|
1023
966
|
return editDispatchers.getTopoByConditions(query);
|
|
1024
967
|
|
|
1025
968
|
case 7:
|
|
1026
969
|
case "end":
|
|
1027
|
-
return
|
|
970
|
+
return _context12.stop();
|
|
1028
971
|
}
|
|
1029
972
|
}
|
|
1030
|
-
},
|
|
973
|
+
}, _callee12);
|
|
1031
974
|
}));
|
|
1032
975
|
return _refreshDataByConfig.apply(this, arguments);
|
|
1033
976
|
}
|
|
@@ -1043,21 +986,115 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1043
986
|
emitEvent(_componentTopologyGraph.TopoEvent.EVENT_DATA_RESULT, eventData); // 刷新链路动态样式
|
|
1044
987
|
|
|
1045
988
|
linkDynamicStyleDispatcher.execute();
|
|
1046
|
-
};
|
|
989
|
+
};
|
|
990
|
+
/**
|
|
991
|
+
* 打开节点关联/重新关联资源
|
|
992
|
+
*/
|
|
1047
993
|
|
|
1048
994
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
995
|
+
var openBindNodeResourceDrawer = function openBindNodeResourceDrawer(node) {
|
|
996
|
+
setShowSingleResDrawer(true);
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* 资源绑定(单选)保存选择
|
|
1000
|
+
*
|
|
1001
|
+
* 场景:
|
|
1002
|
+
* 关联到画布节点
|
|
1003
|
+
* 重新关联到画布节点
|
|
1004
|
+
* 关联到新区域里的节点
|
|
1005
|
+
* 重新关联到新区域里的节点
|
|
1006
|
+
* 关联到已有区域里的节点
|
|
1007
|
+
* 重新关联到已有区域里的节点
|
|
1008
|
+
*/
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
var bindNodeResource = /*#__PURE__*/function () {
|
|
1012
|
+
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(params) {
|
|
1013
|
+
var id, oldResId, newResId, newGroups, _yield$editDispatcher, elements, nodeRelatedData, existInResources, replaceRes;
|
|
1014
|
+
|
|
1015
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
1016
|
+
while (1) {
|
|
1017
|
+
switch (_context6.prev = _context6.next) {
|
|
1018
|
+
case 0:
|
|
1019
|
+
replaceRes = function _replaceRes(resources, oldResId, newResId) {
|
|
1020
|
+
return (0, _extends2["default"])({}, resources, {
|
|
1021
|
+
"static": {
|
|
1022
|
+
selected: true,
|
|
1023
|
+
data: [].concat(resources["static"].data.filter(function (item) {
|
|
1024
|
+
return item !== oldResId;
|
|
1025
|
+
}), [newResId])
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
existInResources = function _existInResources(resources, id) {
|
|
1031
|
+
return resources["static"].data.indexOf(id) !== -1;
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
id = params.id, oldResId = params.oldResId, newResId = params.newResId;
|
|
1035
|
+
|
|
1036
|
+
_rlog["default"].debug('bindNodeResource', params); // 节点所属容器
|
|
1037
|
+
// 区域不存在,则新建
|
|
1038
|
+
// 在画布上
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
if (!existInResources(resources, oldResId)) {
|
|
1042
|
+
_context6.next = 9;
|
|
1043
|
+
break;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
_context6.next = 7;
|
|
1047
|
+
return editDispatchers.updateResources(replaceRes(resources, oldResId, newResId));
|
|
1048
|
+
|
|
1049
|
+
case 7:
|
|
1050
|
+
_context6.next = 12;
|
|
1051
|
+
break;
|
|
1052
|
+
|
|
1053
|
+
case 9:
|
|
1054
|
+
// 在容器中
|
|
1055
|
+
newGroups = groups.map(function (group) {
|
|
1056
|
+
if (!existInResources(group.resources, oldResId)) {
|
|
1057
|
+
return group;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
return (0, _extends2["default"])({}, group, {
|
|
1061
|
+
resources: replaceRes(group.resources, oldResId, newResId)
|
|
1062
|
+
});
|
|
1063
|
+
});
|
|
1064
|
+
_context6.next = 12;
|
|
1065
|
+
return editDispatchers.updateGroups(newGroups);
|
|
1066
|
+
|
|
1067
|
+
case 12:
|
|
1068
|
+
_context6.next = 14;
|
|
1069
|
+
return editDispatchers.refreshDataByConfig();
|
|
1070
|
+
|
|
1071
|
+
case 14:
|
|
1072
|
+
_yield$editDispatcher = _context6.sent;
|
|
1073
|
+
elements = _yield$editDispatcher.topoDataTrans;
|
|
1074
|
+
nodeRelatedData = (0, _format.filterNode)(topo, newResId);
|
|
1075
|
+
saveBind(_componentTopologyGraph.TopoEvent.DATA_TYPE_RESOURCE_SINGLE, nodeRelatedData);
|
|
1076
|
+
|
|
1077
|
+
case 18:
|
|
1078
|
+
case "end":
|
|
1079
|
+
return _context6.stop();
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}, _callee6);
|
|
1083
|
+
}));
|
|
1084
|
+
|
|
1085
|
+
return function bindNodeResource(_x11) {
|
|
1086
|
+
return _ref7.apply(this, arguments);
|
|
1087
|
+
};
|
|
1088
|
+
}();
|
|
1089
|
+
/**
|
|
1090
|
+
* 关闭资源绑定(单选)抽屉
|
|
1091
|
+
*/
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
var closeBindNodeResourceDrawer = function closeBindNodeResourceDrawer() {
|
|
1095
|
+
setShowSingleResDrawer(false);
|
|
1096
|
+
};
|
|
1057
1097
|
|
|
1058
|
-
setShowSingleResDrawer(false);
|
|
1059
|
-
}
|
|
1060
|
-
}, [topo]);
|
|
1061
1098
|
var effectsState = store.useModelEffectsState('topoCreateMod');
|
|
1062
1099
|
var topoLoading = effectsState.getTopoByConditions.isLoading;
|
|
1063
1100
|
return {
|
|
@@ -1071,11 +1108,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1071
1108
|
*/
|
|
1072
1109
|
showSingleResDrawer: showSingleResDrawer,
|
|
1073
1110
|
|
|
1074
|
-
/**
|
|
1075
|
-
* 资源绑定(单选)已选择资源
|
|
1076
|
-
*/
|
|
1077
|
-
initialSingleRes: singleResKey,
|
|
1078
|
-
|
|
1079
1111
|
/**
|
|
1080
1112
|
* 资源绑定(多选)抽屉显示状态
|
|
1081
1113
|
*/
|
|
@@ -1117,26 +1149,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1117
1149
|
addResourceToView: addResourceToView,
|
|
1118
1150
|
|
|
1119
1151
|
/**
|
|
1120
|
-
*
|
|
1152
|
+
* 增加资源到容器
|
|
1121
1153
|
*/
|
|
1122
|
-
|
|
1154
|
+
addResourceToGroup: addResourceToGroup,
|
|
1123
1155
|
|
|
1124
1156
|
/**
|
|
1125
|
-
*
|
|
1157
|
+
* 关联/重新关联资源
|
|
1126
1158
|
*/
|
|
1127
|
-
|
|
1159
|
+
openBindNodeResourceDrawer: openBindNodeResourceDrawer,
|
|
1128
1160
|
|
|
1129
1161
|
/**
|
|
1130
1162
|
* 资源绑定(单选)保存选择
|
|
1131
1163
|
*/
|
|
1132
|
-
|
|
1164
|
+
bindNodeResource: bindNodeResource,
|
|
1133
1165
|
|
|
1134
1166
|
/**
|
|
1135
1167
|
* 关闭资源绑定(单选)抽屉
|
|
1136
1168
|
*/
|
|
1137
|
-
|
|
1138
|
-
return setShowSingleResDrawer(false);
|
|
1139
|
-
},
|
|
1169
|
+
closeBindNodeResourceDrawer: closeBindNodeResourceDrawer,
|
|
1140
1170
|
|
|
1141
1171
|
/**
|
|
1142
1172
|
* 资源绑定(多选)保存选择
|
|
@@ -214,6 +214,11 @@ function _default(topoApp) {
|
|
|
214
214
|
resources: (0, _extends2["default"])({}, prevState.resources, resources)
|
|
215
215
|
});
|
|
216
216
|
},
|
|
217
|
+
updateGroups: function updateGroups(prevState, groups) {
|
|
218
|
+
return (0, _extends2["default"])({}, prevState, {
|
|
219
|
+
groups: groups
|
|
220
|
+
});
|
|
221
|
+
},
|
|
217
222
|
updateResList: function updateResList(prevState, list) {
|
|
218
223
|
return (0, _extends2["default"])({}, prevState, {
|
|
219
224
|
resList: list
|