@riil-frontend/component-topology 2.12.2 → 2.12.5-alpha.2

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.
Files changed (83) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +21 -21
  5. package/es/components/Link/index.js +1 -1
  6. package/es/components/Link/index.module.scss +2 -2
  7. package/es/components/MultiResourceDrawer/index.js +3 -2
  8. package/es/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -0
  9. package/es/components/ResourceSelectDrawer/ResourceSelectList.js +6 -1
  10. package/es/components/SingleResourceDrawer/SelectDrawer.js +54 -0
  11. package/es/components/SingleResourceDrawer/index.js +3 -3
  12. package/es/core/common/icons/defaultIcons.js +9 -2
  13. package/es/core/components/TopoView/topoView.js +3 -2
  14. package/es/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +1 -1
  15. package/es/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +1 -1
  16. package/es/core/editor/components/ResourceViewAttributeSetting/Setting.js +1 -1
  17. package/es/core/editor/components/settings/Settings.js +5 -29
  18. package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.js +0 -0
  19. package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.module.scss +0 -0
  20. package/es/core/editor/components/settings/{group → common}/GroupNodeList/ResourceSelectButton.js +12 -14
  21. package/es/core/editor/components/settings/{group → common}/GroupNodeList/icon.js +0 -0
  22. package/es/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +1 -1
  23. package/es/core/editor/components/settings/group/DataTab/GroupNodeList.js +19 -0
  24. package/es/core/editor/components/settings/group/DataTab/RelateData.js +45 -0
  25. package/es/core/editor/components/settings/group/GroupPropertyView.js +44 -0
  26. package/es/core/editor/components/settings/group/GroupPropertyView.module.scss +3 -0
  27. package/es/core/editor/components/settings/group/SettingTab/GroupExpandSetting.js +27 -0
  28. package/es/core/editor/components/settings/group/SettingTab/NodeIconSelect.js +32 -0
  29. package/es/core/editor/components/settings/group/SettingTab/Setting.js +86 -0
  30. package/es/core/editor/components/settings/group/hooks/useGroup.js +9 -0
  31. package/es/core/editor/components/settings/group/hooks/useGroupExpand.js +20 -0
  32. package/es/core/editor/components/settings/layer/LayerSettingsForm.js +2 -2
  33. package/es/core/editor/components/settings/{group/GroupNodeList/GroupNodeList.js → layer/NodeList.js} +3 -3
  34. package/es/core/editor/components/settings/link/LinkPropertyView.js +3 -3
  35. package/es/core/editor/components/settings/node/NodeIconSelect.js +1 -1
  36. package/es/core/editor/components/settings/propertyViews.js +23 -0
  37. package/es/core/models/TopoApp.js +28 -16
  38. package/es/hooks/useContainerLinkTopo.js +1 -1
  39. package/es/hooks/usePolling.js +1 -1
  40. package/es/hooks/useTopoEdit.js +139 -103
  41. package/es/style.js +3 -4
  42. package/es/topoCenter/models/TopoCenter.js +40 -12
  43. package/es/utils/htElementUtils.js +36 -7
  44. package/lib/components/Link/index.js +6 -6
  45. package/lib/components/Link/index.module.scss +2 -2
  46. package/lib/components/MultiResourceDrawer/index.js +3 -2
  47. package/lib/components/ResourceSelectDrawer/ResourceSelectDrawer.js +1 -0
  48. package/lib/components/ResourceSelectDrawer/ResourceSelectList.js +6 -1
  49. package/lib/components/SingleResourceDrawer/SelectDrawer.js +68 -0
  50. package/lib/components/SingleResourceDrawer/index.js +3 -3
  51. package/lib/core/common/icons/defaultIcons.js +11 -2
  52. package/lib/core/components/TopoView/topoView.js +15 -13
  53. package/lib/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +1 -1
  54. package/lib/core/editor/components/ResourceViewAttributeSetting/ResourceViewAttributeSettingPlugin.js +3 -3
  55. package/lib/core/editor/components/ResourceViewAttributeSetting/Setting.js +2 -2
  56. package/lib/core/editor/components/settings/Settings.js +5 -34
  57. package/lib/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.js +0 -0
  58. package/lib/core/editor/components/settings/{group → common}/GroupNodeList/ResourceList.module.scss +0 -0
  59. package/lib/core/editor/components/settings/{group → common}/GroupNodeList/ResourceSelectButton.js +13 -14
  60. package/lib/core/editor/components/settings/{group → common}/GroupNodeList/icon.js +0 -0
  61. package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +1 -1
  62. package/lib/core/editor/components/settings/group/DataTab/GroupNodeList.js +33 -0
  63. package/lib/core/editor/components/settings/group/DataTab/RelateData.js +57 -0
  64. package/lib/core/editor/components/settings/group/GroupPropertyView.js +58 -0
  65. package/lib/core/editor/components/settings/group/GroupPropertyView.module.scss +3 -0
  66. package/lib/core/editor/components/settings/group/SettingTab/GroupExpandSetting.js +37 -0
  67. package/lib/core/editor/components/settings/group/SettingTab/NodeIconSelect.js +45 -0
  68. package/lib/core/editor/components/settings/group/SettingTab/Setting.js +106 -0
  69. package/lib/core/editor/components/settings/group/hooks/useGroup.js +15 -0
  70. package/lib/core/editor/components/settings/group/hooks/useGroupExpand.js +26 -0
  71. package/lib/core/editor/components/settings/layer/LayerSettingsForm.js +3 -3
  72. package/lib/core/editor/components/settings/{group/GroupNodeList/GroupNodeList.js → layer/NodeList.js} +3 -3
  73. package/lib/core/editor/components/settings/link/LinkPropertyView.js +3 -3
  74. package/lib/core/editor/components/settings/node/NodeIconSelect.js +1 -1
  75. package/lib/core/editor/components/settings/propertyViews.js +38 -0
  76. package/lib/core/models/TopoApp.js +29 -17
  77. package/lib/hooks/useContainerLinkTopo.js +2 -2
  78. package/lib/hooks/usePolling.js +3 -3
  79. package/lib/hooks/useTopoEdit.js +149 -112
  80. package/lib/style.js +3 -4
  81. package/lib/topoCenter/models/TopoCenter.js +40 -12
  82. package/lib/utils/htElementUtils.js +44 -7
  83. package/package.json +10 -10
@@ -8,10 +8,11 @@ import { useUpdateEffect, useDynamicList } from 'ahooks';
8
8
  import { isAvailableArray, isNull } from '@riil-frontend/utils';
9
9
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
10
10
  import * as cmdbService from '@riil-frontend/component-topology-common/es/services/cmdb';
11
- import { TopoEvent } from '@riil-frontend/component-topology-graph';
11
+ import TopoEvent from '@riil-frontend/component-topology-graph/es/event';
12
12
  import { filterNode, filterGroupById, filterGroupByTag, formatTreeDataSelect } from "../utils/format";
13
13
  import { DEFAULT_GROUP } from "../utils/template";
14
14
  import topoPermissonUtil from "../utils/topoPermissionUtil";
15
+ import { getGroupElementByTag } from "../utils/htElementUtils";
15
16
 
16
17
  var useTopoEdit = function useTopoEdit(params) {
17
18
  var topoApp = params.topoApp,
@@ -69,6 +70,10 @@ var useTopoEdit = function useTopoEdit(params) {
69
70
  deletedNodes = _useDynamicList.list,
70
71
  addDeletedNode = _useDynamicList.push,
71
72
  clearDeletedNodes = _useDynamicList.resetList;
73
+ /**
74
+ * 拓扑图全局已选固定资源
75
+ */
76
+
72
77
 
73
78
  var resSelections = useMemo(function () {
74
79
  var sel = staticRes.selected && staticRes.data || [];
@@ -190,9 +195,9 @@ var useTopoEdit = function useTopoEdit(params) {
190
195
  id = _ref4.id;
191
196
 
192
197
  if (!isNull(id)) {
193
- setSingleResKey([id]);
198
+ setSingleResKey(id);
194
199
  } else {
195
- setSingleResKey([]);
200
+ setSingleResKey(null);
196
201
  }
197
202
 
198
203
  setShowSingleResDrawer(true);
@@ -315,9 +320,7 @@ var useTopoEdit = function useTopoEdit(params) {
315
320
  var id = data.id,
316
321
  tag = data.tag; // 新加的容器 tag 格式为 group_${id}
317
322
 
318
- var group = topoApp.getDataModel().getDataById(tag) || topoApp.getDataModel().getDataByTag(id) || topoApp.getDataModel().getDatas().toArray().filter(function (item) {
319
- return item.a('tag') === tag;
320
- })[0];
323
+ var group = topoApp.getDataModel().getDataById(tag) || topoApp.getDataModel().getDataByTag(id) || getGroupElementByTag(topoApp.getDataModel(), tag);
321
324
 
322
325
  if (!group) {
323
326
  return;
@@ -467,11 +470,11 @@ var useTopoEdit = function useTopoEdit(params) {
467
470
 
468
471
 
469
472
  function _bindGroupResourcesConfig() {
470
- _bindGroupResourcesConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(group, data) {
473
+ _bindGroupResourcesConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(group, data) {
471
474
  var id, tag, name, index, newGroup;
472
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
475
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
473
476
  while (1) {
474
- switch (_context5.prev = _context5.next) {
477
+ switch (_context6.prev = _context6.next) {
475
478
  case 0:
476
479
  id = group.id, tag = group.tag, name = group.name;
477
480
  index = findGroupIndex(groups, {
@@ -480,18 +483,18 @@ var useTopoEdit = function useTopoEdit(params) {
480
483
  });
481
484
 
482
485
  if (!(index > -1)) {
483
- _context5.next = 7;
486
+ _context6.next = 7;
484
487
  break;
485
488
  }
486
489
 
487
- _context5.next = 5;
490
+ _context6.next = 5;
488
491
  return editDispatchers.updateGroupResourcesByIndex({
489
492
  index: index,
490
493
  resources: data
491
494
  });
492
495
 
493
496
  case 5:
494
- _context5.next = 8;
497
+ _context6.next = 8;
495
498
  break;
496
499
 
497
500
  case 7:
@@ -507,10 +510,10 @@ var useTopoEdit = function useTopoEdit(params) {
507
510
 
508
511
  case 8:
509
512
  case "end":
510
- return _context5.stop();
513
+ return _context6.stop();
511
514
  }
512
515
  }
513
- }, _callee5);
516
+ }, _callee6);
514
517
  }));
515
518
  return _bindGroupResourcesConfig.apply(this, arguments);
516
519
  }
@@ -524,26 +527,25 @@ var useTopoEdit = function useTopoEdit(params) {
524
527
 
525
528
 
526
529
  function _bindGroupResources() {
527
- _bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(group, data) {
530
+ _bindGroupResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(group, data) {
528
531
  var id, tag, _yield$editDispatcher, elements, groupElement;
529
532
 
530
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
533
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
531
534
  while (1) {
532
- switch (_context6.prev = _context6.next) {
535
+ switch (_context7.prev = _context7.next) {
533
536
  case 0:
534
537
  id = group.id, tag = group.tag;
535
- _context6.next = 3;
538
+ _context7.next = 3;
536
539
  return bindGroupResourcesConfig(group, data);
537
540
 
538
541
  case 3:
539
- _context6.next = 5;
542
+ _context7.next = 5;
540
543
  return editDispatchers.refreshDataByConfig();
541
544
 
542
545
  case 5:
543
- _yield$editDispatcher = _context6.sent;
546
+ _yield$editDispatcher = _context7.sent;
544
547
  elements = _yield$editDispatcher.topoDataTrans;
545
- debugger;
546
- rlog.debug('useUpdateEffect--id, tag', id, tag);
548
+ rlog.debug('bindGroupResources--id, tag', id, tag);
547
549
 
548
550
  if (id) {
549
551
  groupElement = filterGroupById(elements, id);
@@ -557,12 +559,12 @@ var useTopoEdit = function useTopoEdit(params) {
557
559
 
558
560
  setFocusedGroup(null);
559
561
 
560
- case 12:
562
+ case 11:
561
563
  case "end":
562
- return _context6.stop();
564
+ return _context7.stop();
563
565
  }
564
566
  }
565
- }, _callee6);
567
+ }, _callee7);
566
568
  }));
567
569
  return _bindGroupResources.apply(this, arguments);
568
570
  }
@@ -572,31 +574,31 @@ var useTopoEdit = function useTopoEdit(params) {
572
574
  }
573
575
 
574
576
  function _bindViewResources() {
575
- _bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data) {
577
+ _bindViewResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data) {
576
578
  var _yield$editDispatcher2, elements;
577
579
 
578
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
580
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
579
581
  while (1) {
580
- switch (_context7.prev = _context7.next) {
582
+ switch (_context8.prev = _context8.next) {
581
583
  case 0:
582
- _context7.next = 2;
584
+ _context8.next = 2;
583
585
  return editDispatchers.updateViewResources(data);
584
586
 
585
587
  case 2:
586
- _context7.next = 4;
588
+ _context8.next = 4;
587
589
  return editDispatchers.refreshDataByConfig();
588
590
 
589
591
  case 4:
590
- _yield$editDispatcher2 = _context7.sent;
592
+ _yield$editDispatcher2 = _context8.sent;
591
593
  elements = _yield$editDispatcher2.topoDataTrans;
592
594
  saveBind(TopoEvent.DATA_TYPE_RESOURCE_COMBO, elements);
593
595
 
594
596
  case 7:
595
597
  case "end":
596
- return _context7.stop();
598
+ return _context8.stop();
597
599
  }
598
600
  }
599
- }, _callee7);
601
+ }, _callee8);
600
602
  }));
601
603
  return _bindViewResources.apply(this, arguments);
602
604
  }
@@ -606,12 +608,12 @@ var useTopoEdit = function useTopoEdit(params) {
606
608
  }
607
609
 
608
610
  function _addResourceToFirstLayer() {
609
- _addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data) {
611
+ _addResourceToFirstLayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data) {
610
612
  var group, config, _yield$editDispatcher3, topoData;
611
613
 
612
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
614
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
613
615
  while (1) {
614
- switch (_context8.prev = _context8.next) {
616
+ switch (_context9.prev = _context9.next) {
615
617
  case 0:
616
618
  group = groups[0];
617
619
  config = {
@@ -625,49 +627,83 @@ var useTopoEdit = function useTopoEdit(params) {
625
627
  data: [].concat(group.resources["static"].data, data)
626
628
  }
627
629
  };
628
- _context8.next = 4;
630
+ _context9.next = 4;
629
631
  return bindGroupResourcesConfig(group, config);
630
632
 
631
633
  case 4:
632
- _context8.next = 6;
634
+ _context9.next = 6;
633
635
  return editDispatchers.refreshDataByConfig();
634
636
 
635
637
  case 6:
636
- _yield$editDispatcher3 = _context8.sent;
638
+ _yield$editDispatcher3 = _context9.sent;
637
639
  topoData = _yield$editDispatcher3.topoData;
638
640
  topoApp.updateElements(topoData);
639
641
 
640
642
  case 9:
641
643
  case "end":
642
- return _context8.stop();
644
+ return _context9.stop();
643
645
  }
644
646
  }
645
- }, _callee8);
647
+ }, _callee9);
646
648
  }));
647
649
  return _addResourceToFirstLayer.apply(this, arguments);
648
650
  }
649
651
 
650
- var onSaveComboRes = function onSaveComboRes(data) {
651
- rlog.debug('关联资源-----onSaveComboRes', data, focusedGroup);
652
+ var onSaveComboRes = /*#__PURE__*/function () {
653
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data) {
654
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
655
+ while (1) {
656
+ switch (_context3.prev = _context3.next) {
657
+ case 0:
658
+ rlog.debug('关联资源-----onSaveComboRes', data, focusedGroup);
652
659
 
653
- if (topoShowType !== 'layers') {
654
- if (focusedGroup) {
655
- bindGroupResources(focusedGroup, data);
656
- } else {
657
- bindViewResources(data);
658
- }
659
- } else {
660
- // 分层拓扑,添加到第一层
661
- addResourceToFirstLayer(data);
662
- }
663
- };
660
+ if (!(topoShowType === 'layers')) {
661
+ _context3.next = 6;
662
+ break;
663
+ }
664
+
665
+ _context3.next = 4;
666
+ return addResourceToFirstLayer(data);
667
+
668
+ case 4:
669
+ _context3.next = 13;
670
+ break;
671
+
672
+ case 6:
673
+ if (!focusedGroup) {
674
+ _context3.next = 11;
675
+ break;
676
+ }
677
+
678
+ _context3.next = 9;
679
+ return bindGroupResources(focusedGroup, data);
680
+
681
+ case 9:
682
+ _context3.next = 13;
683
+ break;
684
+
685
+ case 11:
686
+ _context3.next = 13;
687
+ return bindViewResources(data);
688
+
689
+ case 13:
690
+ case "end":
691
+ return _context3.stop();
692
+ }
693
+ }
694
+ }, _callee3);
695
+ }));
664
696
 
665
- var onSaveSingleRes = function onSaveSingleRes(resource) {
666
- rlog.debug('onSaveSingleRes', resource);
667
- var selectedRes = resource[0];
697
+ return function onSaveComboRes(_x7) {
698
+ return _ref5.apply(this, arguments);
699
+ };
700
+ }();
701
+
702
+ var onSaveSingleRes = function onSaveSingleRes(selectedResKey) {
703
+ rlog.debug('onSaveSingleRes', selectedResKey);
668
704
  var selected = staticRes.selected,
669
705
  data = staticRes.data;
670
- var exist = data.indexOf(selectedRes) !== -1;
706
+ var exist = data.indexOf(selectedResKey) !== -1;
671
707
 
672
708
  if (selected && exist) {
673
709
  // 资源已被选
@@ -679,15 +715,15 @@ var useTopoEdit = function useTopoEdit(params) {
679
715
 
680
716
  if (singleResKey) {
681
717
  list = list.filter(function (item) {
682
- return item !== singleResKey[0];
718
+ return item !== singleResKey;
683
719
  });
684
720
  }
685
721
 
686
722
  if (!exist) {
687
- list = list.concat(selectedRes);
723
+ list = [].concat(list, [selectedResKey]);
688
724
  }
689
725
 
690
- setSingleResKey(resource);
726
+ setSingleResKey(selectedResKey);
691
727
  editDispatchers.updateResources({
692
728
  "static": {
693
729
  selected: true,
@@ -698,32 +734,32 @@ var useTopoEdit = function useTopoEdit(params) {
698
734
  }
699
735
  };
700
736
 
701
- function checkSavePermission(_x7) {
737
+ function checkSavePermission(_x8) {
702
738
  return _checkSavePermission.apply(this, arguments);
703
739
  }
704
740
 
705
741
  function _checkSavePermission() {
706
- _checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(id) {
742
+ _checkSavePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id) {
707
743
  var permission;
708
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
744
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
709
745
  while (1) {
710
- switch (_context9.prev = _context9.next) {
746
+ switch (_context10.prev = _context10.next) {
711
747
  case 0:
712
- _context9.next = 2;
748
+ _context10.next = 2;
713
749
  return topoDispatchers.getTopoPermission({
714
750
  id: id,
715
751
  update: false
716
752
  });
717
753
 
718
754
  case 2:
719
- permission = _context9.sent;
755
+ permission = _context10.sent;
720
756
 
721
757
  if (!topoPermissonUtil.isEditable(permission)) {
722
- _context9.next = 5;
758
+ _context10.next = 5;
723
759
  break;
724
760
  }
725
761
 
726
- return _context9.abrupt("return", true);
762
+ return _context10.abrupt("return", true);
727
763
 
728
764
  case 5:
729
765
  _Dialog.alert({
@@ -735,43 +771,43 @@ var useTopoEdit = function useTopoEdit(params) {
735
771
  onOk: function onOk() {}
736
772
  });
737
773
 
738
- return _context9.abrupt("return", false);
774
+ return _context10.abrupt("return", false);
739
775
 
740
776
  case 7:
741
777
  case "end":
742
- return _context9.stop();
778
+ return _context10.stop();
743
779
  }
744
780
  }
745
- }, _callee9);
781
+ }, _callee10);
746
782
  }));
747
783
  return _checkSavePermission.apply(this, arguments);
748
784
  }
749
785
 
750
786
  var onSaveTopo = /*#__PURE__*/function () {
751
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
787
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
752
788
  var id, config, global, serialize, saveConfig, valid, _config$layout2, template, layout;
753
789
 
754
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
790
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
755
791
  while (1) {
756
- switch (_context4.prev = _context4.next) {
792
+ switch (_context5.prev = _context5.next) {
757
793
  case 0:
758
794
  id = data.id, config = data.config, global = data.global, serialize = data.serialize;
759
795
 
760
796
  if (!onSave) {
761
- _context4.next = 5;
797
+ _context5.next = 5;
762
798
  break;
763
799
  }
764
800
 
765
801
  saveConfig = /*#__PURE__*/function () {
766
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
802
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
767
803
  var _config$layout, template, layout;
768
804
 
769
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
805
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
770
806
  while (1) {
771
- switch (_context3.prev = _context3.next) {
807
+ switch (_context4.prev = _context4.next) {
772
808
  case 0:
773
809
  _config$layout = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout.type, layout = _config$layout.layout;
774
- _context3.next = 3;
810
+ _context4.next = 3;
775
811
  return editDispatchers.saveTopo({
776
812
  id: id,
777
813
  template: template,
@@ -782,14 +818,14 @@ var useTopoEdit = function useTopoEdit(params) {
782
818
 
783
819
  case 3:
784
820
  case "end":
785
- return _context3.stop();
821
+ return _context4.stop();
786
822
  }
787
823
  }
788
- }, _callee3);
824
+ }, _callee4);
789
825
  }));
790
826
 
791
827
  return function saveConfig() {
792
- return _ref6.apply(this, arguments);
828
+ return _ref7.apply(this, arguments);
793
829
  };
794
830
  }();
795
831
 
@@ -797,7 +833,7 @@ var useTopoEdit = function useTopoEdit(params) {
797
833
  data: data,
798
834
  saveConfig: saveConfig
799
835
  });
800
- return _context4.abrupt("return");
836
+ return _context5.abrupt("return");
801
837
 
802
838
  case 5:
803
839
  // TODO 以下逻辑移到拓扑中心
@@ -805,26 +841,26 @@ var useTopoEdit = function useTopoEdit(params) {
805
841
  saving: true
806
842
  }); // 检查权限
807
843
 
808
- _context4.next = 8;
844
+ _context5.next = 8;
809
845
  return checkSavePermission(id);
810
846
 
811
847
  case 8:
812
- valid = _context4.sent;
848
+ valid = _context5.sent;
813
849
 
814
850
  if (valid) {
815
- _context4.next = 12;
851
+ _context5.next = 12;
816
852
  break;
817
853
  }
818
854
 
819
855
  topoEditDispatchers.update({
820
856
  saving: false
821
857
  });
822
- return _context4.abrupt("return");
858
+ return _context5.abrupt("return");
823
859
 
824
860
  case 12:
825
861
  // 保存
826
862
  _config$layout2 = config === null || config === void 0 ? void 0 : config.layout, template = _config$layout2.type, layout = _config$layout2.layout;
827
- _context4.next = 15;
863
+ _context5.next = 15;
828
864
  return editDispatchers.saveTopo({
829
865
  id: id,
830
866
  template: template,
@@ -836,7 +872,7 @@ var useTopoEdit = function useTopoEdit(params) {
836
872
  });
837
873
 
838
874
  case 15:
839
- _context4.next = 17;
875
+ _context5.next = 17;
840
876
  return editDispatchers.addToBlockList({
841
877
  id: topoId,
842
878
  ciIdList: deletedNodes
@@ -853,14 +889,14 @@ var useTopoEdit = function useTopoEdit(params) {
853
889
 
854
890
  case 20:
855
891
  case "end":
856
- return _context4.stop();
892
+ return _context5.stop();
857
893
  }
858
894
  }
859
- }, _callee4);
895
+ }, _callee5);
860
896
  }));
861
897
 
862
- return function onSaveTopo(_x8) {
863
- return _ref5.apply(this, arguments);
898
+ return function onSaveTopo(_x9) {
899
+ return _ref6.apply(this, arguments);
864
900
  };
865
901
  }();
866
902
 
@@ -926,22 +962,22 @@ var useTopoEdit = function useTopoEdit(params) {
926
962
  * @return {Promise<void>}
927
963
  */
928
964
 
929
- function refreshDataByConfig(_x9) {
965
+ function refreshDataByConfig(_x10) {
930
966
  return _refreshDataByConfig.apply(this, arguments);
931
967
  }
932
968
 
933
969
  function _refreshDataByConfig() {
934
- _refreshDataByConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(config) {
970
+ _refreshDataByConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(config) {
935
971
  var resources, groups, dRes, sRes, query;
936
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
972
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
937
973
  while (1) {
938
- switch (_context10.prev = _context10.next) {
974
+ switch (_context11.prev = _context11.next) {
939
975
  case 0:
940
976
  resources = config.resources, groups = config.groups;
941
977
  dRes = resources.dynamic, sRes = resources["static"];
942
978
 
943
979
  if (!(dRes.selected && dRes.condition || sRes.selected && isAvailableArray(sRes.data) || isAvailableArray(groups))) {
944
- _context10.next = 7;
980
+ _context11.next = 7;
945
981
  break;
946
982
  }
947
983
 
@@ -952,15 +988,15 @@ var useTopoEdit = function useTopoEdit(params) {
952
988
  };
953
989
  rlog.debug('useEffect', editState, isEditing, topoId, resources, groups); // editDispatchers.update({ resources, groups });
954
990
 
955
- _context10.next = 7;
991
+ _context11.next = 7;
956
992
  return editDispatchers.getTopoByConditions(query);
957
993
 
958
994
  case 7:
959
995
  case "end":
960
- return _context10.stop();
996
+ return _context11.stop();
961
997
  }
962
998
  }
963
- }, _callee10);
999
+ }, _callee11);
964
1000
  }));
965
1001
  return _refreshDataByConfig.apply(this, arguments);
966
1002
  }
@@ -981,7 +1017,7 @@ var useTopoEdit = function useTopoEdit(params) {
981
1017
  if (showSingleResDrawer) {
982
1018
  if (isAvailableArray(topo)) {
983
1019
  // 需要过滤出单选的节点及其相关连线
984
- var nodeId = singleResKey && singleResKey[0] || null;
1020
+ var nodeId = singleResKey;
985
1021
  var data = filterNode(topo, nodeId);
986
1022
  saveBind(TopoEvent.DATA_TYPE_RESOURCE_SINGLE, data);
987
1023
  }
package/es/style.js CHANGED
@@ -1,6 +1,6 @@
1
-
2
1
  import '@alifd/next/lib/message/style';
3
2
  import '@alifd/next/lib/dialog/style';
3
+
4
4
  import '@alifd/next/lib/drawer/style';
5
5
  import '@alifd/next/lib/button/style';
6
6
  import '@alifd/next/lib/table/style';
@@ -20,11 +20,10 @@ import '@alifd/next/lib/box/style';
20
20
  import '@alifd/next/lib/dropdown/style';
21
21
  import '@alifd/next/lib/menu/style';
22
22
  import '@alifd/next/lib/tab/style';
23
- import '@alifd/next/lib/radio/style';
24
23
  import '@alifd/next/lib/collapse/style';
25
- import '@alifd/next/lib/list/style';
26
24
  import '@alifd/next/lib/tree-select/style';
27
-
25
+ import '@alifd/next/lib/radio/style';
26
+ import '@alifd/next/lib/list/style';
28
27
  import '@alifd/next/lib/tag/style';
29
28
 
30
29
  import './index.scss';
@@ -17,6 +17,34 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
17
17
  loadData: getTopoData
18
18
  }, options, {
19
19
  usePermission: true,
20
+ beforeSwitchToEditMode: function () {
21
+ var _beforeSwitchToEditMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
22
+ var topoDispatchers;
23
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
24
+ while (1) {
25
+ switch (_context.prev = _context.next) {
26
+ case 0:
27
+ topoDispatchers = _this.store.getModelDispatchers('topoMod');
28
+ topoDispatchers.update({
29
+ topoData: null
30
+ });
31
+ _context.next = 4;
32
+ return topoDispatchers.refreshTopo();
33
+
34
+ case 4:
35
+ case "end":
36
+ return _context.stop();
37
+ }
38
+ }
39
+ }, _callee);
40
+ }));
41
+
42
+ function beforeSwitchToEditMode() {
43
+ return _beforeSwitchToEditMode.apply(this, arguments);
44
+ }
45
+
46
+ return beforeSwitchToEditMode;
47
+ }(),
20
48
  onSwitchToEditMode: function onSwitchToEditMode() {
21
49
  var editDispatchers = _this.store.getModelDispatchers('topoCreateMod');
22
50
 
@@ -49,22 +77,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
49
77
  _proto.initData =
50
78
  /*#__PURE__*/
51
79
  function () {
52
- var _initData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
80
+ var _initData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
53
81
  var topoDispatchers;
54
- return _regeneratorRuntime.wrap(function _callee$(_context) {
82
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
55
83
  while (1) {
56
- switch (_context.prev = _context.next) {
84
+ switch (_context2.prev = _context2.next) {
57
85
  case 0:
58
86
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
59
- _context.next = 3;
87
+ _context2.next = 3;
60
88
  return topoDispatchers.initData(params);
61
89
 
62
90
  case 3:
63
91
  case "end":
64
- return _context.stop();
92
+ return _context2.stop();
65
93
  }
66
94
  }
67
- }, _callee, this);
95
+ }, _callee2, this);
68
96
  }));
69
97
 
70
98
  function initData(_x) {
@@ -86,22 +114,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
86
114
  _proto.exit =
87
115
  /*#__PURE__*/
88
116
  function () {
89
- var _exit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
117
+ var _exit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
90
118
  var topoDispatchers;
91
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
119
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
92
120
  while (1) {
93
- switch (_context2.prev = _context2.next) {
121
+ switch (_context3.prev = _context3.next) {
94
122
  case 0:
95
123
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
96
- _context2.next = 3;
124
+ _context3.next = 3;
97
125
  return topoDispatchers.exit();
98
126
 
99
127
  case 3:
100
128
  case "end":
101
- return _context2.stop();
129
+ return _context3.stop();
102
130
  }
103
131
  }
104
- }, _callee2, this);
132
+ }, _callee3, this);
105
133
  }));
106
134
 
107
135
  function exit() {