@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/es/hooks/useTopoEdit.js
CHANGED
|
@@ -62,10 +62,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
62
62
|
showSingleResDrawer = _useState4[0],
|
|
63
63
|
setShowSingleResDrawer = _useState4[1];
|
|
64
64
|
|
|
65
|
-
var _useState5 = useState(null),
|
|
66
|
-
singleResKey = _useState5[0],
|
|
67
|
-
setSingleResKey = _useState5[1];
|
|
68
|
-
|
|
69
65
|
var _useDynamicList = useDynamicList([]),
|
|
70
66
|
deletedNodes = _useDynamicList.list,
|
|
71
67
|
addDeletedNode = _useDynamicList.push,
|
|
@@ -118,7 +114,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
118
114
|
switch (type) {
|
|
119
115
|
case TopoEvent.DATA_TYPE_RESOURCE_SINGLE:
|
|
120
116
|
{
|
|
121
|
-
|
|
117
|
+
openBindNodeResourceDrawer(data);
|
|
122
118
|
}
|
|
123
119
|
break;
|
|
124
120
|
|
|
@@ -185,23 +181,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
185
181
|
setComboResData(res);
|
|
186
182
|
setShowComboResDrawer(true);
|
|
187
183
|
};
|
|
188
|
-
/**
|
|
189
|
-
* 打开节点关联/重新关联资源
|
|
190
|
-
*/
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
var bindNodeResource = function bindNodeResource(node) {
|
|
194
|
-
var _ref4 = node || {},
|
|
195
|
-
id = _ref4.id;
|
|
196
|
-
|
|
197
|
-
if (!isNull(id)) {
|
|
198
|
-
setSingleResKey(id);
|
|
199
|
-
} else {
|
|
200
|
-
setSingleResKey(null);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
setShowSingleResDrawer(true);
|
|
204
|
-
};
|
|
205
184
|
|
|
206
185
|
var onDeleteElement = function onDeleteElement(data) {
|
|
207
186
|
var _topoApp$options$edit;
|
|
@@ -470,11 +449,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
470
449
|
|
|
471
450
|
|
|
472
451
|
function _bindGroupResourcesConfig() {
|
|
473
|
-
_bindGroupResourcesConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
452
|
+
_bindGroupResourcesConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(group, data) {
|
|
474
453
|
var id, tag, name, index, newGroup;
|
|
475
|
-
return _regeneratorRuntime.wrap(function
|
|
454
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
476
455
|
while (1) {
|
|
477
|
-
switch (
|
|
456
|
+
switch (_context7.prev = _context7.next) {
|
|
478
457
|
case 0:
|
|
479
458
|
id = group.id, tag = group.tag, name = group.name;
|
|
480
459
|
index = findGroupIndex(groups, {
|
|
@@ -483,18 +462,18 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
483
462
|
});
|
|
484
463
|
|
|
485
464
|
if (!(index > -1)) {
|
|
486
|
-
|
|
465
|
+
_context7.next = 7;
|
|
487
466
|
break;
|
|
488
467
|
}
|
|
489
468
|
|
|
490
|
-
|
|
469
|
+
_context7.next = 5;
|
|
491
470
|
return editDispatchers.updateGroupResourcesByIndex({
|
|
492
471
|
index: index,
|
|
493
472
|
resources: data
|
|
494
473
|
});
|
|
495
474
|
|
|
496
475
|
case 5:
|
|
497
|
-
|
|
476
|
+
_context7.next = 8;
|
|
498
477
|
break;
|
|
499
478
|
|
|
500
479
|
case 7:
|
|
@@ -510,10 +489,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
510
489
|
|
|
511
490
|
case 8:
|
|
512
491
|
case "end":
|
|
513
|
-
return
|
|
492
|
+
return _context7.stop();
|
|
514
493
|
}
|
|
515
494
|
}
|
|
516
|
-
},
|
|
495
|
+
}, _callee7);
|
|
517
496
|
}));
|
|
518
497
|
return _bindGroupResourcesConfig.apply(this, arguments);
|
|
519
498
|
}
|
|
@@ -527,24 +506,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
527
506
|
|
|
528
507
|
|
|
529
508
|
function _bindGroupResources() {
|
|
530
|
-
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
531
|
-
var id, tag, _yield$
|
|
509
|
+
_bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(group, data) {
|
|
510
|
+
var id, tag, _yield$editDispatcher2, elements, groupElement;
|
|
532
511
|
|
|
533
|
-
return _regeneratorRuntime.wrap(function
|
|
512
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
534
513
|
while (1) {
|
|
535
|
-
switch (
|
|
514
|
+
switch (_context8.prev = _context8.next) {
|
|
536
515
|
case 0:
|
|
537
516
|
id = group.id, tag = group.tag;
|
|
538
|
-
|
|
517
|
+
_context8.next = 3;
|
|
539
518
|
return bindGroupResourcesConfig(group, data);
|
|
540
519
|
|
|
541
520
|
case 3:
|
|
542
|
-
|
|
521
|
+
_context8.next = 5;
|
|
543
522
|
return editDispatchers.refreshDataByConfig();
|
|
544
523
|
|
|
545
524
|
case 5:
|
|
546
|
-
_yield$
|
|
547
|
-
elements = _yield$
|
|
525
|
+
_yield$editDispatcher2 = _context8.sent;
|
|
526
|
+
elements = _yield$editDispatcher2.topoDataTrans;
|
|
548
527
|
rlog.debug('bindGroupResources--id, tag', id, tag);
|
|
549
528
|
|
|
550
529
|
if (id) {
|
|
@@ -561,10 +540,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
561
540
|
|
|
562
541
|
case 11:
|
|
563
542
|
case "end":
|
|
564
|
-
return
|
|
543
|
+
return _context8.stop();
|
|
565
544
|
}
|
|
566
545
|
}
|
|
567
|
-
},
|
|
546
|
+
}, _callee8);
|
|
568
547
|
}));
|
|
569
548
|
return _bindGroupResources.apply(this, arguments);
|
|
570
549
|
}
|
|
@@ -574,31 +553,31 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
574
553
|
}
|
|
575
554
|
|
|
576
555
|
function _bindViewResources() {
|
|
577
|
-
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
578
|
-
var _yield$
|
|
556
|
+
_bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data) {
|
|
557
|
+
var _yield$editDispatcher3, elements;
|
|
579
558
|
|
|
580
|
-
return _regeneratorRuntime.wrap(function
|
|
559
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
581
560
|
while (1) {
|
|
582
|
-
switch (
|
|
561
|
+
switch (_context9.prev = _context9.next) {
|
|
583
562
|
case 0:
|
|
584
|
-
|
|
563
|
+
_context9.next = 2;
|
|
585
564
|
return editDispatchers.updateViewResources(data);
|
|
586
565
|
|
|
587
566
|
case 2:
|
|
588
|
-
|
|
567
|
+
_context9.next = 4;
|
|
589
568
|
return editDispatchers.refreshDataByConfig();
|
|
590
569
|
|
|
591
570
|
case 4:
|
|
592
|
-
_yield$
|
|
593
|
-
elements = _yield$
|
|
571
|
+
_yield$editDispatcher3 = _context9.sent;
|
|
572
|
+
elements = _yield$editDispatcher3.topoDataTrans;
|
|
594
573
|
saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements);
|
|
595
574
|
|
|
596
575
|
case 7:
|
|
597
576
|
case "end":
|
|
598
|
-
return
|
|
577
|
+
return _context9.stop();
|
|
599
578
|
}
|
|
600
579
|
}
|
|
601
|
-
},
|
|
580
|
+
}, _callee9);
|
|
602
581
|
}));
|
|
603
582
|
return _bindViewResources.apply(this, arguments);
|
|
604
583
|
}
|
|
@@ -608,12 +587,12 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
608
587
|
}
|
|
609
588
|
|
|
610
589
|
function _addResourceToFirstLayer() {
|
|
611
|
-
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
612
|
-
var group, config, _yield$
|
|
590
|
+
_addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(data) {
|
|
591
|
+
var group, config, _yield$editDispatcher4, topoData;
|
|
613
592
|
|
|
614
|
-
return _regeneratorRuntime.wrap(function
|
|
593
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
615
594
|
while (1) {
|
|
616
|
-
switch (
|
|
595
|
+
switch (_context10.prev = _context10.next) {
|
|
617
596
|
case 0:
|
|
618
597
|
group = groups[0];
|
|
619
598
|
config = {
|
|
@@ -627,30 +606,30 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
627
606
|
data: [].concat(group.resources["static"].data, data)
|
|
628
607
|
}
|
|
629
608
|
};
|
|
630
|
-
|
|
609
|
+
_context10.next = 4;
|
|
631
610
|
return bindGroupResourcesConfig(group, config);
|
|
632
611
|
|
|
633
612
|
case 4:
|
|
634
|
-
|
|
613
|
+
_context10.next = 6;
|
|
635
614
|
return editDispatchers.refreshDataByConfig();
|
|
636
615
|
|
|
637
616
|
case 6:
|
|
638
|
-
_yield$
|
|
639
|
-
topoData = _yield$
|
|
617
|
+
_yield$editDispatcher4 = _context10.sent;
|
|
618
|
+
topoData = _yield$editDispatcher4.topoData;
|
|
640
619
|
topoApp.updateElements(topoData);
|
|
641
620
|
|
|
642
621
|
case 9:
|
|
643
622
|
case "end":
|
|
644
|
-
return
|
|
623
|
+
return _context10.stop();
|
|
645
624
|
}
|
|
646
625
|
}
|
|
647
|
-
},
|
|
626
|
+
}, _callee10);
|
|
648
627
|
}));
|
|
649
628
|
return _addResourceToFirstLayer.apply(this, arguments);
|
|
650
629
|
}
|
|
651
630
|
|
|
652
631
|
var onSaveComboRes = /*#__PURE__*/function () {
|
|
653
|
-
var
|
|
632
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
|
|
654
633
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
655
634
|
while (1) {
|
|
656
635
|
switch (_context3.prev = _context3.next) {
|
|
@@ -695,71 +674,36 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
695
674
|
}));
|
|
696
675
|
|
|
697
676
|
return function onSaveComboRes(_x7) {
|
|
698
|
-
return
|
|
677
|
+
return _ref4.apply(this, arguments);
|
|
699
678
|
};
|
|
700
679
|
}();
|
|
701
680
|
|
|
702
|
-
var onSaveSingleRes = function onSaveSingleRes(selectedResKey) {
|
|
703
|
-
rlog.debug('onSaveSingleRes', selectedResKey);
|
|
704
|
-
var selected = staticRes.selected,
|
|
705
|
-
data = staticRes.data;
|
|
706
|
-
var exist = data.indexOf(selectedResKey) !== -1;
|
|
707
|
-
|
|
708
|
-
if (selected && exist) {
|
|
709
|
-
// 资源已被选
|
|
710
|
-
_Message.warning('所选资源在图上已存在,请重新选择一个。');
|
|
711
|
-
|
|
712
|
-
return false;
|
|
713
|
-
} else {
|
|
714
|
-
var list = data;
|
|
715
|
-
|
|
716
|
-
if (singleResKey) {
|
|
717
|
-
list = list.filter(function (item) {
|
|
718
|
-
return item !== singleResKey;
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
if (!exist) {
|
|
723
|
-
list = [].concat(list, [selectedResKey]);
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
setSingleResKey(selectedResKey);
|
|
727
|
-
editDispatchers.updateResources({
|
|
728
|
-
"static": {
|
|
729
|
-
selected: true,
|
|
730
|
-
data: list
|
|
731
|
-
}
|
|
732
|
-
});
|
|
733
|
-
return true;
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
|
|
737
681
|
function checkSavePermission(_x8) {
|
|
738
682
|
return _checkSavePermission.apply(this, arguments);
|
|
739
683
|
}
|
|
740
684
|
|
|
741
685
|
function _checkSavePermission() {
|
|
742
|
-
_checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
686
|
+
_checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(id) {
|
|
743
687
|
var permission;
|
|
744
|
-
return _regeneratorRuntime.wrap(function
|
|
688
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
745
689
|
while (1) {
|
|
746
|
-
switch (
|
|
690
|
+
switch (_context11.prev = _context11.next) {
|
|
747
691
|
case 0:
|
|
748
|
-
|
|
692
|
+
_context11.next = 2;
|
|
749
693
|
return topoDispatchers.getTopoPermission({
|
|
750
694
|
id: id,
|
|
751
695
|
update: false
|
|
752
696
|
});
|
|
753
697
|
|
|
754
698
|
case 2:
|
|
755
|
-
permission =
|
|
699
|
+
permission = _context11.sent;
|
|
756
700
|
|
|
757
701
|
if (!topoPermissonUtil.isEditable(permission)) {
|
|
758
|
-
|
|
702
|
+
_context11.next = 5;
|
|
759
703
|
break;
|
|
760
704
|
}
|
|
761
705
|
|
|
762
|
-
return
|
|
706
|
+
return _context11.abrupt("return", true);
|
|
763
707
|
|
|
764
708
|
case 5:
|
|
765
709
|
_Dialog.alert({
|
|
@@ -771,20 +715,20 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
771
715
|
onOk: function onOk() {}
|
|
772
716
|
});
|
|
773
717
|
|
|
774
|
-
return
|
|
718
|
+
return _context11.abrupt("return", false);
|
|
775
719
|
|
|
776
720
|
case 7:
|
|
777
721
|
case "end":
|
|
778
|
-
return
|
|
722
|
+
return _context11.stop();
|
|
779
723
|
}
|
|
780
724
|
}
|
|
781
|
-
},
|
|
725
|
+
}, _callee11);
|
|
782
726
|
}));
|
|
783
727
|
return _checkSavePermission.apply(this, arguments);
|
|
784
728
|
}
|
|
785
729
|
|
|
786
730
|
var onSaveTopo = /*#__PURE__*/function () {
|
|
787
|
-
var
|
|
731
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
|
|
788
732
|
var id, config, global, serialize, saveConfig, valid, _config$layout2, template, layout;
|
|
789
733
|
|
|
790
734
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
@@ -799,7 +743,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
799
743
|
}
|
|
800
744
|
|
|
801
745
|
saveConfig = /*#__PURE__*/function () {
|
|
802
|
-
var
|
|
746
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
803
747
|
var _config$layout, template, layout;
|
|
804
748
|
|
|
805
749
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
@@ -825,7 +769,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
825
769
|
}));
|
|
826
770
|
|
|
827
771
|
return function saveConfig() {
|
|
828
|
-
return
|
|
772
|
+
return _ref6.apply(this, arguments);
|
|
829
773
|
};
|
|
830
774
|
}();
|
|
831
775
|
|
|
@@ -896,7 +840,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
896
840
|
}));
|
|
897
841
|
|
|
898
842
|
return function onSaveTopo(_x9) {
|
|
899
|
-
return
|
|
843
|
+
return _ref5.apply(this, arguments);
|
|
900
844
|
};
|
|
901
845
|
}();
|
|
902
846
|
|
|
@@ -967,17 +911,17 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
967
911
|
}
|
|
968
912
|
|
|
969
913
|
function _refreshDataByConfig() {
|
|
970
|
-
_refreshDataByConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
914
|
+
_refreshDataByConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(config) {
|
|
971
915
|
var resources, groups, dRes, sRes, query;
|
|
972
|
-
return _regeneratorRuntime.wrap(function
|
|
916
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
973
917
|
while (1) {
|
|
974
|
-
switch (
|
|
918
|
+
switch (_context12.prev = _context12.next) {
|
|
975
919
|
case 0:
|
|
976
920
|
resources = config.resources, groups = config.groups;
|
|
977
921
|
dRes = resources.dynamic, sRes = resources["static"];
|
|
978
922
|
|
|
979
923
|
if (!(dRes.selected && dRes.condition || sRes.selected && isAvailableArray(sRes.data) || isAvailableArray(groups))) {
|
|
980
|
-
|
|
924
|
+
_context12.next = 7;
|
|
981
925
|
break;
|
|
982
926
|
}
|
|
983
927
|
|
|
@@ -988,15 +932,15 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
988
932
|
};
|
|
989
933
|
rlog.debug('useEffect', editState, isEditing, topoId, resources, groups); // editDispatchers.update({ resources, groups });
|
|
990
934
|
|
|
991
|
-
|
|
935
|
+
_context12.next = 7;
|
|
992
936
|
return editDispatchers.getTopoByConditions(query);
|
|
993
937
|
|
|
994
938
|
case 7:
|
|
995
939
|
case "end":
|
|
996
|
-
return
|
|
940
|
+
return _context12.stop();
|
|
997
941
|
}
|
|
998
942
|
}
|
|
999
|
-
},
|
|
943
|
+
}, _callee12);
|
|
1000
944
|
}));
|
|
1001
945
|
return _refreshDataByConfig.apply(this, arguments);
|
|
1002
946
|
}
|
|
@@ -1010,21 +954,113 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1010
954
|
emitEvent(TopoEvent.EVENT_DATA_RESULT, eventData); // 刷新链路动态样式
|
|
1011
955
|
|
|
1012
956
|
linkDynamicStyleDispatcher.execute();
|
|
1013
|
-
};
|
|
957
|
+
};
|
|
958
|
+
/**
|
|
959
|
+
* 打开节点关联/重新关联资源
|
|
960
|
+
*/
|
|
1014
961
|
|
|
1015
962
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
963
|
+
var openBindNodeResourceDrawer = function openBindNodeResourceDrawer(node) {
|
|
964
|
+
setShowSingleResDrawer(true);
|
|
965
|
+
};
|
|
966
|
+
/**
|
|
967
|
+
* 资源绑定(单选)保存选择
|
|
968
|
+
*
|
|
969
|
+
* 场景:
|
|
970
|
+
* 关联到画布节点
|
|
971
|
+
* 重新关联到画布节点
|
|
972
|
+
* 关联到新区域里的节点
|
|
973
|
+
* 重新关联到新区域里的节点
|
|
974
|
+
* 关联到已有区域里的节点
|
|
975
|
+
* 重新关联到已有区域里的节点
|
|
976
|
+
*/
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
var bindNodeResource = /*#__PURE__*/function () {
|
|
980
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(params) {
|
|
981
|
+
var id, oldResId, newResId, newGroups, _yield$editDispatcher, elements, nodeRelatedData, existInResources, replaceRes;
|
|
982
|
+
|
|
983
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
984
|
+
while (1) {
|
|
985
|
+
switch (_context6.prev = _context6.next) {
|
|
986
|
+
case 0:
|
|
987
|
+
replaceRes = function _replaceRes(resources, oldResId, newResId) {
|
|
988
|
+
return _extends({}, resources, {
|
|
989
|
+
"static": {
|
|
990
|
+
selected: true,
|
|
991
|
+
data: [].concat(resources["static"].data.filter(function (item) {
|
|
992
|
+
return item !== oldResId;
|
|
993
|
+
}), [newResId])
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
existInResources = function _existInResources(resources, id) {
|
|
999
|
+
return resources["static"].data.indexOf(id) !== -1;
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
id = params.id, oldResId = params.oldResId, newResId = params.newResId;
|
|
1003
|
+
rlog.debug('bindNodeResource', params); // 节点所属容器
|
|
1004
|
+
// 区域不存在,则新建
|
|
1005
|
+
// 在画布上
|
|
1006
|
+
|
|
1007
|
+
if (!existInResources(resources, oldResId)) {
|
|
1008
|
+
_context6.next = 9;
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
_context6.next = 7;
|
|
1013
|
+
return editDispatchers.updateResources(replaceRes(resources, oldResId, newResId));
|
|
1014
|
+
|
|
1015
|
+
case 7:
|
|
1016
|
+
_context6.next = 12;
|
|
1017
|
+
break;
|
|
1018
|
+
|
|
1019
|
+
case 9:
|
|
1020
|
+
// 在容器中
|
|
1021
|
+
newGroups = groups.map(function (group) {
|
|
1022
|
+
if (!existInResources(group.resources, oldResId)) {
|
|
1023
|
+
return group;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
return _extends({}, group, {
|
|
1027
|
+
resources: replaceRes(group.resources, oldResId, newResId)
|
|
1028
|
+
});
|
|
1029
|
+
});
|
|
1030
|
+
_context6.next = 12;
|
|
1031
|
+
return editDispatchers.updateGroups(newGroups);
|
|
1032
|
+
|
|
1033
|
+
case 12:
|
|
1034
|
+
_context6.next = 14;
|
|
1035
|
+
return editDispatchers.refreshDataByConfig();
|
|
1036
|
+
|
|
1037
|
+
case 14:
|
|
1038
|
+
_yield$editDispatcher = _context6.sent;
|
|
1039
|
+
elements = _yield$editDispatcher.topoDataTrans;
|
|
1040
|
+
nodeRelatedData = filterNode(topo, newResId);
|
|
1041
|
+
saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, nodeRelatedData);
|
|
1042
|
+
|
|
1043
|
+
case 18:
|
|
1044
|
+
case "end":
|
|
1045
|
+
return _context6.stop();
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}, _callee6);
|
|
1049
|
+
}));
|
|
1050
|
+
|
|
1051
|
+
return function bindNodeResource(_x11) {
|
|
1052
|
+
return _ref7.apply(this, arguments);
|
|
1053
|
+
};
|
|
1054
|
+
}();
|
|
1055
|
+
/**
|
|
1056
|
+
* 关闭资源绑定(单选)抽屉
|
|
1057
|
+
*/
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
var closeBindNodeResourceDrawer = function closeBindNodeResourceDrawer() {
|
|
1061
|
+
setShowSingleResDrawer(false);
|
|
1062
|
+
};
|
|
1024
1063
|
|
|
1025
|
-
setShowSingleResDrawer(false);
|
|
1026
|
-
}
|
|
1027
|
-
}, [topo]);
|
|
1028
1064
|
var effectsState = store.useModelEffectsState('topoCreateMod');
|
|
1029
1065
|
var topoLoading = effectsState.getTopoByConditions.isLoading;
|
|
1030
1066
|
return {
|
|
@@ -1038,11 +1074,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1038
1074
|
*/
|
|
1039
1075
|
showSingleResDrawer: showSingleResDrawer,
|
|
1040
1076
|
|
|
1041
|
-
/**
|
|
1042
|
-
* 资源绑定(单选)已选择资源
|
|
1043
|
-
*/
|
|
1044
|
-
initialSingleRes: singleResKey,
|
|
1045
|
-
|
|
1046
1077
|
/**
|
|
1047
1078
|
* 资源绑定(多选)抽屉显示状态
|
|
1048
1079
|
*/
|
|
@@ -1084,26 +1115,24 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
|
1084
1115
|
addResourceToView: addResourceToView,
|
|
1085
1116
|
|
|
1086
1117
|
/**
|
|
1087
|
-
*
|
|
1118
|
+
* 增加资源到容器
|
|
1088
1119
|
*/
|
|
1089
|
-
|
|
1120
|
+
addResourceToGroup: addResourceToGroup,
|
|
1090
1121
|
|
|
1091
1122
|
/**
|
|
1092
|
-
*
|
|
1123
|
+
* 关联/重新关联资源
|
|
1093
1124
|
*/
|
|
1094
|
-
|
|
1125
|
+
openBindNodeResourceDrawer: openBindNodeResourceDrawer,
|
|
1095
1126
|
|
|
1096
1127
|
/**
|
|
1097
1128
|
* 资源绑定(单选)保存选择
|
|
1098
1129
|
*/
|
|
1099
|
-
|
|
1130
|
+
bindNodeResource: bindNodeResource,
|
|
1100
1131
|
|
|
1101
1132
|
/**
|
|
1102
1133
|
* 关闭资源绑定(单选)抽屉
|
|
1103
1134
|
*/
|
|
1104
|
-
|
|
1105
|
-
return setShowSingleResDrawer(false);
|
|
1106
|
-
},
|
|
1135
|
+
closeBindNodeResourceDrawer: closeBindNodeResourceDrawer,
|
|
1107
1136
|
|
|
1108
1137
|
/**
|
|
1109
1138
|
* 资源绑定(多选)保存选择
|
|
@@ -200,6 +200,11 @@ export default function (topoApp) {
|
|
|
200
200
|
resources: _extends({}, prevState.resources, resources)
|
|
201
201
|
});
|
|
202
202
|
},
|
|
203
|
+
updateGroups: function updateGroups(prevState, groups) {
|
|
204
|
+
return _extends({}, prevState, {
|
|
205
|
+
groups: groups
|
|
206
|
+
});
|
|
207
|
+
},
|
|
203
208
|
updateResList: function updateResList(prevState, list) {
|
|
204
209
|
return _extends({}, prevState, {
|
|
205
210
|
resList: list
|