@riil-frontend/component-topology 2.15.42 → 2.15.45

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 (133) hide show
  1. package/build/index.css +1 -1
  2. package/build/index.js +2 -2
  3. package/es/common/components/ColorPicker/ColorPicker.js +5 -2
  4. package/es/components/Drawer/index.js +8 -2
  5. package/es/components/TemplateButton/index.module.scss +1 -0
  6. package/es/core/common/hooks/ht/useDataModelDataPropertyChange.js +13 -4
  7. package/es/core/common/icons/icon.js +1 -1
  8. package/es/core/common/icons/useIcons.js +1 -1
  9. package/es/core/components/TopoView/topoView.js +8 -18
  10. package/es/core/{models/createTopoApp.js → createTopoApp.js} +1 -1
  11. package/es/core/editor/components/BackgroundView/index.js +80 -44
  12. package/es/core/editor/components/BackgroundView/index.module.scss +1 -0
  13. package/es/core/editor/components/{iconManage/IconManage.js → CustomIconPlugin/CustomIconPlugin.js} +3 -3
  14. package/es/core/editor/components/{iconManage → CustomIconPlugin}/RenameDialog.js +1 -1
  15. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.js +16 -2
  16. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.module.scss +0 -0
  17. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.scss +0 -0
  18. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialogWrapper.js +1 -1
  19. package/es/core/editor/components/CustomIconPlugin/index.js +2 -0
  20. package/es/core/editor/components/{iconManage → CustomIconPlugin}/utils/svgToShape.js +0 -0
  21. package/es/core/editor/components/EditorPlugin.js +2 -2
  22. package/es/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +2 -0
  23. package/es/core/editor/components/settings/propertyViews/node/NodePropertyView.js +2 -2
  24. package/es/core/models/TopoApp.js +9 -5
  25. package/es/core/services/background.js +26 -1
  26. package/es/core/store/coreModels.js +32 -26
  27. package/es/core/store/createStore.js +1 -1
  28. package/es/core/test/Test.js +3 -1
  29. package/es/core/viewer/contextmenu/buildNodeContextmenu.js +65 -64
  30. package/es/createTopo.js +1 -1
  31. package/es/hooks/useAlarm.js +3 -6
  32. package/es/hooks/useResourceConfig.js +1 -1
  33. package/es/hooks/useTopoEdit.js +4 -8
  34. package/es/models/{iconManage.js → customIcon.js} +1 -1
  35. package/es/models/topoBizMod.js +22 -52
  36. package/es/models/{topoCreateMod.js → topoConfig.js} +8 -4
  37. package/es/models/topoMod.js +32 -69
  38. package/es/{components → topoCenter/components}/Link/form.js +0 -0
  39. package/es/{components → topoCenter/components}/Link/hook.js +0 -0
  40. package/es/{components → topoCenter/components}/Link/index copy.js +1 -1
  41. package/es/{components → topoCenter/components}/Link/index.js +1 -1
  42. package/es/{components → topoCenter/components}/Link/index.module.scss +0 -0
  43. package/es/{components → topoCenter/components}/Link/setting.js +0 -0
  44. package/es/topoCenter/components/TopoView.js +16 -3
  45. package/es/topoCenter/components/Topology.js +0 -5
  46. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.js +0 -0
  47. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.module.scss +0 -0
  48. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/index.js +0 -0
  49. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.js +0 -0
  50. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.module.scss +0 -0
  51. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.js +0 -0
  52. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.module.scss +0 -0
  53. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.scss +0 -0
  54. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.js +0 -0
  55. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.module.scss +0 -0
  56. package/es/topoCenter/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +1 -1
  57. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +3 -3
  58. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +1 -1
  59. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +1 -1
  60. package/es/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.js → LinkInfoPreview.js} +1 -1
  61. package/es/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.module.scss → LinkInfoPreview.module.scss} +0 -0
  62. package/es/{hooks → topoCenter/hooks/viewer}/useRelateTopo.js +2 -2
  63. package/es/{models → topoCenter/store}/linkDynamicStyle.js +3 -3
  64. package/es/{models → topoCenter/store}/linkDynamicStyleConfig.js +2 -1
  65. package/es/{models → topoCenter/store}/linkManager.js +0 -0
  66. package/lib/common/components/ColorPicker/ColorPicker.js +5 -2
  67. package/lib/components/Drawer/index.js +7 -2
  68. package/lib/components/TemplateButton/index.module.scss +1 -0
  69. package/lib/core/common/hooks/ht/useDataModelDataPropertyChange.js +13 -4
  70. package/lib/core/common/icons/icon.js +1 -1
  71. package/lib/core/common/icons/useIcons.js +1 -1
  72. package/lib/core/components/TopoView/topoView.js +9 -20
  73. package/lib/core/{models/createTopoApp.js → createTopoApp.js} +1 -1
  74. package/lib/core/editor/components/BackgroundView/index.js +80 -44
  75. package/lib/core/editor/components/BackgroundView/index.module.scss +1 -0
  76. package/lib/core/editor/components/{iconManage/IconManage.js → CustomIconPlugin/CustomIconPlugin.js} +3 -3
  77. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/RenameDialog.js +1 -1
  78. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.js +17 -2
  79. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.module.scss +0 -0
  80. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.scss +0 -0
  81. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialogWrapper.js +1 -1
  82. package/lib/core/editor/components/CustomIconPlugin/index.js +11 -0
  83. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/utils/svgToShape.js +0 -0
  84. package/lib/core/editor/components/EditorPlugin.js +2 -2
  85. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +2 -0
  86. package/lib/core/editor/components/settings/propertyViews/node/NodePropertyView.js +1 -1
  87. package/lib/core/models/TopoApp.js +9 -5
  88. package/lib/core/services/background.js +26 -1
  89. package/lib/core/store/coreModels.js +35 -26
  90. package/lib/core/store/createStore.js +2 -2
  91. package/lib/core/test/Test.js +3 -1
  92. package/lib/core/viewer/contextmenu/buildNodeContextmenu.js +65 -64
  93. package/lib/createTopo.js +1 -1
  94. package/lib/hooks/useAlarm.js +3 -6
  95. package/lib/hooks/useResourceConfig.js +1 -1
  96. package/lib/hooks/useTopoEdit.js +4 -8
  97. package/lib/models/{iconManage.js → customIcon.js} +1 -1
  98. package/lib/models/topoBizMod.js +22 -52
  99. package/lib/models/{topoCreateMod.js → topoConfig.js} +7 -4
  100. package/lib/models/topoMod.js +32 -69
  101. package/lib/{components → topoCenter/components}/Link/form.js +0 -0
  102. package/lib/{components → topoCenter/components}/Link/hook.js +0 -0
  103. package/lib/{components → topoCenter/components}/Link/index copy.js +1 -1
  104. package/lib/{components → topoCenter/components}/Link/index.js +1 -1
  105. package/lib/{components → topoCenter/components}/Link/index.module.scss +0 -0
  106. package/lib/{components → topoCenter/components}/Link/setting.js +0 -0
  107. package/lib/topoCenter/components/TopoView.js +19 -3
  108. package/lib/topoCenter/components/Topology.js +0 -7
  109. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.js +0 -0
  110. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.module.scss +0 -0
  111. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/index.js +0 -0
  112. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.js +0 -0
  113. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.module.scss +0 -0
  114. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.js +0 -0
  115. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.module.scss +0 -0
  116. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.scss +0 -0
  117. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.js +0 -0
  118. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.module.scss +0 -0
  119. package/lib/topoCenter/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +2 -2
  120. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +8 -8
  121. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +1 -1
  122. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +1 -1
  123. package/lib/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.js → LinkInfoPreview.js} +4 -4
  124. package/lib/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.module.scss → LinkInfoPreview.module.scss} +0 -0
  125. package/lib/{hooks → topoCenter/hooks/viewer}/useRelateTopo.js +2 -2
  126. package/lib/{models → topoCenter/store}/linkDynamicStyle.js +3 -3
  127. package/lib/{models → topoCenter/store}/linkDynamicStyleConfig.js +2 -1
  128. package/lib/{models → topoCenter/store}/linkManager.js +0 -0
  129. package/package.json +2 -2
  130. package/es/core/editor/LinkDynamicStyleConfig.js +0 -16
  131. package/es/core/store/getStoreModels.js +0 -40
  132. package/lib/core/editor/LinkDynamicStyleConfig.js +0 -21
  133. package/lib/core/store/getStoreModels.js +0 -67
@@ -21,7 +21,6 @@ export default function (topoApp) {
21
21
  topoLoadError: false,
22
22
  id: undefined,
23
23
  topoId: "",
24
- topoName: "",
25
24
  type: undefined,
26
25
  data: null,
27
26
  // 后端返回的分组、连线、节点数据
@@ -29,22 +28,6 @@ export default function (topoApp) {
29
28
  // ht 拓扑数据,用于首次load
30
29
  currentTopo: undefined,
31
30
  topoPermission: undefined,
32
- currentNode: {
33
- id: "",
34
- name: "无数据"
35
- },
36
- topoAlarmIsOpen: false,
37
- // 拓扑通道是否打开
38
- alarmPanelIsOpen: false,
39
- // 告警弹窗是否打开
40
- alarmData: null,
41
- // 概览抽屉中告警列表相关数据 TODO 抽取
42
- currentCiInfo: null,
43
- // 概览抽屉当前CI元数据 TODO 抽取
44
- addLinkIsOpen: false,
45
- // 添加链路抽屉显示
46
- ciConnectable: [],
47
- // 可创建联系ci列表
48
31
  resAndMetrics: {
49
32
  res: [],
50
33
  metrics: [],
@@ -187,10 +170,19 @@ export default function (topoApp) {
187
170
  }, _callee2);
188
171
  }))();
189
172
  },
173
+
174
+ /**
175
+ * 设置拓扑类型
176
+ * @param {*} type
177
+ */
178
+ setTopoType: function setTopoType(type) {
179
+ this.update({
180
+ type: type
181
+ });
182
+ },
190
183
  clearData: function clearData() {
191
184
  this.update({
192
185
  topoId: "",
193
- topoName: "",
194
186
  topoData: null,
195
187
  graphLoaded: false,
196
188
  data: null,
@@ -417,7 +409,7 @@ export default function (topoApp) {
417
409
  result = parseTopoData(result);
418
410
  rlog.debug("topoMod.initTopoData 查询数据完成", topoId, linkTo, result);
419
411
  _context6.next = 40;
420
- return Promise.all([topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)), dispatch.iconManage.loadCustomIcons()]);
412
+ return Promise.all([topoApp.ciTyeCache.getCiTypeMap(getCiTypes(result)), dispatch.customIcon.loadCustomIcons()]);
421
413
 
422
414
  case 40:
423
415
  _yield$Promise$all = _context6.sent;
@@ -440,6 +432,7 @@ export default function (topoApp) {
440
432
 
441
433
  _this5.update({
442
434
  type: (_result$config = result.config) === null || _result$config === void 0 ? void 0 : _result$config.showType,
435
+ currentTopo: topoData.config,
443
436
  data: result,
444
437
  topoData: topoData,
445
438
  resAndMetrics: resAndMetrics,
@@ -577,95 +570,65 @@ export default function (topoApp) {
577
570
  }, _callee10);
578
571
  }))();
579
572
  },
580
- getCiInfo: function getCiInfo(conditions, state) {
573
+ getTopoPermission: function getTopoPermission(playload, rootState) {
581
574
  var _this8 = this;
582
575
 
583
576
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
584
- var result;
577
+ var id, update, topoPermission, getTopoPermission;
585
578
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
586
579
  while (1) {
587
580
  switch (_context11.prev = _context11.next) {
588
- case 0:
589
- _context11.next = 2;
590
- return getCiMeta(conditions);
591
-
592
- case 2:
593
- result = _context11.sent;
594
-
595
- // rlog.debug("getCiInfo", result);
596
- _this8.update({
597
- // alarmList: result.datas,
598
- currentCiInfo: result // drawerAlarmPageInfo,
599
-
600
- });
601
-
602
- case 4:
603
- case "end":
604
- return _context11.stop();
605
- }
606
- }
607
- }, _callee11);
608
- }))();
609
- },
610
- getTopoPermission: function getTopoPermission(playload, rootState) {
611
- var _this9 = this;
612
-
613
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
614
- var id, update, topoPermission, getTopoPermission;
615
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
616
- while (1) {
617
- switch (_context12.prev = _context12.next) {
618
581
  case 0:
619
582
  id = playload.id, update = playload.update;
620
- _context12.prev = 1;
583
+ _context11.prev = 1;
621
584
  getTopoPermission = topoApp.options.getTopoPermission || topoService.auth.getTopoPermission;
622
- _context12.next = 5;
585
+ _context11.next = 5;
623
586
  return getTopoPermission(id);
624
587
 
625
588
  case 5:
626
- topoPermission = _context12.sent;
627
- _context12.next = 11;
589
+ topoPermission = _context11.sent;
590
+ _context11.next = 11;
628
591
  break;
629
592
 
630
593
  case 8:
631
- _context12.prev = 8;
632
- _context12.t0 = _context12["catch"](1);
633
- rlog.error("\u67E5\u8BE2\u62D3\u6251" + id + "\u7684\u6743\u9650\u5931\u8D25", _context12.t0); // 尚未区分拓扑图不存在还是接口请求报错
594
+ _context11.prev = 8;
595
+ _context11.t0 = _context11["catch"](1);
596
+ rlog.error("\u67E5\u8BE2\u62D3\u6251" + id + "\u7684\u6743\u9650\u5931\u8D25", _context11.t0); // 尚未区分拓扑图不存在还是接口请求报错
634
597
 
635
598
  case 11:
636
- _context12.next = 13;
599
+ _context11.next = 13;
637
600
  return dispatch.functionAuth.checkAuth('createTopo');
638
601
 
639
602
  case 13:
640
- if (!_context12.sent) {
641
- _context12.next = 17;
603
+ if (!_context11.sent) {
604
+ _context11.next = 17;
642
605
  break;
643
606
  }
644
607
 
645
- _context12.t1 = 'delete';
646
- _context12.next = 18;
608
+ _context11.t1 = 'delete';
609
+ _context11.next = 18;
647
610
  break;
648
611
 
649
612
  case 17:
650
- _context12.t1 = 'read';
613
+ _context11.t1 = 'read';
651
614
 
652
615
  case 18:
653
- topoPermission = _context12.t1;
616
+ topoPermission = _context11.t1;
654
617
 
655
618
  if (update !== false) {
656
- _this9.update({
619
+ _this8.update({
657
620
  topoPermission: topoPermission
658
621
  });
659
622
  }
660
623
 
661
- return _context12.abrupt("return", topoPermission);
624
+ return _context11.abrupt("return", topoPermission);
662
625
 
663
626
  case 21:
664
627
  case "end":
665
- return _context12.stop();
628
+ return _context11.stop();
666
629
  }
667
630
  }
668
- }, _callee12, null, [[1, 8]]);
631
+ }, _callee11, null, [[1, 8]]);
669
632
  }))();
670
633
  }
671
634
  };
@@ -18,7 +18,7 @@ var LinkDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
18
18
  topo = props.topo;
19
19
  var store = topo.store;
20
20
 
21
- var _store$useModel = store.useModel('topoCreateMod'),
21
+ var _store$useModel = store.useModel('topoConfig'),
22
22
  editState = _store$useModel[0],
23
23
  editDispatchers = _store$useModel[1];
24
24
 
@@ -18,7 +18,7 @@ var LinkDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
18
18
  topo = props.topo;
19
19
  var store = topo.store;
20
20
 
21
- var _store$useModel = store.useModel('topoCreateMod'),
21
+ var _store$useModel = store.useModel('topoConfig'),
22
22
  editState = _store$useModel[0],
23
23
  editDispatchers = _store$useModel[1];
24
24
 
@@ -10,11 +10,13 @@ import Topo404 from "./Topo404";
10
10
  import TopoNoPermission from "./TopoNoPermission";
11
11
  import styles from "../../components/index.module.scss";
12
12
  import AlarmListPanel from "../../core/components/AlarmListPanel";
13
+ import useLinkDynamicStyle from "../hooks/useLinkDynamicStyle";
14
+ import useRelateTopo from "../hooks/viewer/useRelateTopo";
13
15
  /**
14
16
  * 拓扑组件。变化无权限、无数据显示
15
17
  */
16
18
 
17
- function NetworkTopology(props) {
19
+ function NetworkTopologyCore(props) {
18
20
  var topo = props.topo,
19
21
  titleBar = props.titleBar,
20
22
  onEnterEdit = props.onEnterEdit,
@@ -25,6 +27,12 @@ function NetworkTopology(props) {
25
27
  topoId = topoState.topoId,
26
28
  topoData = topoState.topoData,
27
29
  topoPermission = topoState.topoPermission;
30
+ useLinkDynamicStyle({
31
+ topo: topo
32
+ });
33
+ var relateTopo = useRelateTopo({
34
+ topo: topo
35
+ });
28
36
 
29
37
  var renderTopoView = function renderTopoView() {
30
38
  var viewerProps = _extends({}, props.viewerProps, {
@@ -34,11 +42,16 @@ function NetworkTopology(props) {
34
42
  plugins: []
35
43
  });
36
44
 
45
+ var handleEvent = function handleEvent(event) {
46
+ relateTopo.onEvent(event);
47
+ };
48
+
37
49
  return /*#__PURE__*/React.createElement(BasicTopoView, _extends({}, otherProps, {
38
50
  topo: topo,
39
51
  viewerProps: viewerProps,
40
52
  titleBar: titleBar,
41
- onEnterEdit: onEnterEdit
53
+ onEnterEdit: onEnterEdit,
54
+ onEvent: handleEvent
42
55
  }));
43
56
  };
44
57
 
@@ -77,4 +90,4 @@ function NetworkTopology(props) {
77
90
  }, renderContent()));
78
91
  }
79
92
 
80
- export default NetworkTopology;
93
+ export default NetworkTopologyCore;
@@ -1,20 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useState, useEffect, useRef, useCallback } from "react";
3
- import { TopoEvent } from "@riil-frontend/component-topology-graph";
4
3
  import TopoView from "./TopoView";
5
4
  import LayerRelatedResourceList from "./editor/propertyViews/LayerRelatedResourceList";
6
5
  import LayerConfigPlugin from "./editor/plugins/LayerConfigPlugin";
7
6
  import EdgeGroupPropertyView from "./editor/propertyViews/edge/EdgeGroupPropertyView";
8
7
  import LinkPropertyView from "./editor/propertyViews/edge/LinkPropertyView";
9
- import useLinkDynamicStyle from "../hooks/useLinkDynamicStyle";
10
8
  import AddLinkDrawer from "./editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer";
11
9
  import useTopoEdit from "../hooks/useTopoEdit";
12
10
  export default function NetworkTopologyFull(props) {
13
11
  var topo = props.topo,
14
12
  customEditorProps = props.editorProps;
15
- useLinkDynamicStyle({
16
- topo: topo
17
- });
18
13
  var topoEdit = useTopoEdit({
19
14
  topo: topo
20
15
  });
@@ -2,7 +2,7 @@ import _Tab from "@alifd/next/es/tab";
2
2
  import React, { useState, useEffect } from 'react';
3
3
  import TabView from "../../../../../core/editor/components/settings/common/tab/TabView";
4
4
  import EdgeGroupSetting from "../../../../../core/editor/components/settings/propertyViews/edge/edgeGroup/EdgeGroupSetting";
5
- import LindInfoPreview from "./link/LindInfoPreview";
5
+ import LindInfoPreview from "./link/LinkInfoPreview";
6
6
  export default function EdgeGroupPropertyView(props) {
7
7
  var topo = props.topo,
8
8
  edge = props.edge,
@@ -1,7 +1,7 @@
1
1
  import _Button from "@alifd/next/es/button";
2
2
  import React from "react";
3
- import LindInfoPreview from "../../link/LindInfoPreview";
4
- import styles from "../../link/LindInfoPreview.module.scss";
3
+ import LindInfoPreview from "../../link/LinkInfoPreview";
4
+ import styles from "../../link/LinkInfoPreview.module.scss";
5
5
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
6
6
  import { getLinkPermission } from "../../../../../../utils/linPermissionUtil";
7
7
  export default function LinkDataTab(props) {
@@ -22,7 +22,7 @@ export default function LinkDataTab(props) {
22
22
  return item.id === edge.getTag();
23
23
  });
24
24
 
25
- var _topo$store$useModel = topo.store.useModel("topoCreateMod"),
25
+ var _topo$store$useModel = topo.store.useModel("topoConfig"),
26
26
  editState = _topo$store$useModel[0],
27
27
  editDispatchers = _topo$store$useModel[1];
28
28
 
@@ -22,7 +22,7 @@ function AddLinkDrawer(props) {
22
22
  lineData = props.lineData;
23
23
  var store = topo.store;
24
24
 
25
- var _store$useModel = store.useModel("topoCreateMod"),
25
+ var _store$useModel = store.useModel("topoConfig"),
26
26
  editState = _store$useModel[0],
27
27
  editDispatchers = _store$useModel[1];
28
28
 
@@ -74,7 +74,7 @@ export default function EditLinkInfo(props) {
74
74
  setSource(source);
75
75
  setTarget(target);
76
76
  field.setValues(attributes);
77
- }, [source, target, field, attributes]); // const [editState, editDispatchers] = store.useModel("topoCreateMod");
77
+ }, [source, target, field, attributes]); // const [editState, editDispatchers] = store.useModel("topoConfig");
78
78
 
79
79
  var labelAlign = "top";
80
80
  var formItemLayout = {
@@ -1,7 +1,7 @@
1
1
  import _Box from "@alifd/next/es/box";
2
2
  import _Collapse from "@alifd/next/es/collapse";
3
3
  import React, { useEffect } from "react";
4
- import styles from "./LindInfoPreview.module.scss";
4
+ import styles from "./LinkInfoPreview.module.scss";
5
5
  import { formatMetric } from "../../../../../../core/models/attributeFormatter";
6
6
  var CollapsePanel = _Collapse.Panel;
7
7
  export default function LindInfoPreview(props) {
@@ -2,9 +2,9 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { TopoEvent } from '@riil-frontend/component-topology-graph';
4
4
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
5
- import { loopTreeFun } from "../utils/tree";
5
+ import { loopTreeFun } from "../../../utils/tree";
6
6
  /**
7
- * 关联拓扑
7
+ * 关联拓扑:FIXME 移到拓扑中心
8
8
  *
9
9
  * 双击容器打开关联拓扑图
10
10
  * 双击缩略图返回原拓扑图
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
 
5
5
  /**
6
- * 动态设置链路样式 Model
6
+ * 动态设置链路样式 Model。-- 功能已废弃
7
7
  */
8
8
  import _ from 'lodash';
9
9
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
@@ -209,12 +209,12 @@ export default function (engine) {
209
209
 
210
210
  links = [];
211
211
 
212
- if (!(isEdit && rootState.topoCreateMod.topoData.links.length)) {
212
+ if (!(isEdit && rootState.topoConfig.topoData.links.length)) {
213
213
  _context3.next = 10;
214
214
  break;
215
215
  }
216
216
 
217
- links = rootState.topoCreateMod.topoData.links;
217
+ links = rootState.topoConfig.topoData.links;
218
218
  _context3.next = 13;
219
219
  break;
220
220
 
@@ -3,7 +3,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
4
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  import clone from 'lodash/cloneDeep';
6
- var ruleKey = 0;
6
+ var ruleKey = 0; // -- 功能已废弃
7
+
7
8
  export default {
8
9
  // 定义 model 的初始 state
9
10
  state: {
File without changes
@@ -37,9 +37,11 @@ var ColorPicker = /*#__PURE__*/function (_Component) {
37
37
  var _this$props = _this.props,
38
38
  prevValue = _this$props.value,
39
39
  onChange = _this$props.onChange;
40
+ var value = color.hex; // const rgb = color.rgb;
41
+ // const rgba = `rgba(${rgb.r},${rgb.g},${rgb.b},${rgb.a})`
40
42
 
41
- if (prevValue !== color.hex) {
42
- onChange(color.hex);
43
+ if (value !== prevValue) {
44
+ onChange(value);
43
45
  }
44
46
  };
45
47
 
@@ -76,6 +78,7 @@ var ColorPicker = /*#__PURE__*/function (_Component) {
76
78
  }, /*#__PURE__*/_react["default"].createElement(_reactColor.SketchPicker, {
77
79
  color: value // width={230}
78
80
  ,
81
+ disableAlpha: true,
79
82
  styles: {
80
83
  'default': {
81
84
  picker: {
@@ -11,12 +11,15 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var _button = _interopRequireDefault(require("@alifd/next/lib/button"));
13
13
 
14
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
15
+
14
16
  var _react = _interopRequireDefault(require("react"));
15
17
 
16
18
  var _classnames = _interopRequireDefault(require("classnames"));
17
19
 
18
20
  var _indexModule = _interopRequireDefault(require("./index.module.scss"));
19
21
 
22
+ var _excluded = ["bodyClassName"];
20
23
  var headerStyle = {
21
24
  zIndex: 1000
22
25
  };
@@ -37,6 +40,8 @@ var Drawer = function Drawer(props) {
37
40
  onSave = props.onSave,
38
41
  drawerProps = props.drawerProps,
39
42
  children = props.children;
43
+ var bodyClassName = drawerProps.bodyClassName,
44
+ otherDrawerProps = (0, _objectWithoutPropertiesLoose2["default"])(drawerProps, _excluded);
40
45
  return /*#__PURE__*/_react["default"].createElement(_drawer["default"], (0, _extends2["default"])({
41
46
  title: title,
42
47
  placement: "right",
@@ -44,12 +49,12 @@ var Drawer = function Drawer(props) {
44
49
  headerStyle: headerStyle,
45
50
  bodyStyle: bodyStyle,
46
51
  closeMode: ['close', 'esc']
47
- }, drawerProps, {
52
+ }, otherDrawerProps, {
48
53
  className: (0, _classnames["default"])(_indexModule["default"].drawer, drawerProps.className),
49
54
  visible: visible,
50
55
  onClose: onClose
51
56
  }), /*#__PURE__*/_react["default"].createElement("div", {
52
- className: (0, _classnames["default"])(_indexModule["default"].content, drawerProps.bodyClassName)
57
+ className: (0, _classnames["default"])(_indexModule["default"].content, bodyClassName)
53
58
  }, children), footer && /*#__PURE__*/_react["default"].createElement("div", {
54
59
  className: _indexModule["default"].footer
55
60
  }, /*#__PURE__*/_react["default"].createElement(_button["default"], {
@@ -14,6 +14,7 @@
14
14
  display: flex;
15
15
  justify-content: center;
16
16
  align-items: center;
17
+ user-select: none;
17
18
  }
18
19
 
19
20
  .icon {
@@ -6,13 +6,22 @@ exports["default"] = void 0;
6
6
  var _react = require("react");
7
7
 
8
8
  var _default = function _default(topo, fn) {
9
+ var topoModState = topo.store.useModelState('topoMod');
10
+ var graphLoaded = topoModState.graphLoaded;
9
11
  (0, _react.useEffect)(function () {
10
- var dataModel = topo.getDataModel();
11
- dataModel.addDataPropertyChangeListener(fn);
12
+ var dataModel;
13
+
14
+ if (graphLoaded) {
15
+ dataModel = topo.getDataModel();
16
+ dataModel.addDataPropertyChangeListener(fn);
17
+ }
18
+
12
19
  return function () {
13
- dataModel.removeDataPropertyChangeListener(fn);
20
+ if (dataModel) {
21
+ dataModel.removeDataPropertyChangeListener(fn);
22
+ }
14
23
  };
15
- }, [fn]);
24
+ }, [topo, graphLoaded, fn]);
16
25
  };
17
26
 
18
27
  exports["default"] = _default;
@@ -93,7 +93,7 @@ function transformCustomIcons2HtIcons(icons) {
93
93
 
94
94
 
95
95
  function getUserCustomIcons(topo) {
96
- var uploadIcons = topo.store.getModelState('iconManage').icons;
96
+ var uploadIcons = topo.store.getModelState('customIcon').icons;
97
97
  return [].concat(transformCustomIcons2HtIcons(uploadIcons.node));
98
98
  } // 获得节点图标列表
99
99
 
@@ -7,7 +7,7 @@ exports.useNodeIcons = useNodeIcons;
7
7
  var _icon = require("./icon");
8
8
 
9
9
  function useCustomIcons(topo) {
10
- var _topo$store$useModelS = topo.store.useModelState('iconManage'),
10
+ var _topo$store$useModelS = topo.store.useModelState('customIcon'),
11
11
  icons = _topo$store$useModelS.icons;
12
12
 
13
13
  var customIcons = icons.node.map(_icon.transformCustomIcon2HtIcon);
@@ -23,8 +23,6 @@ var _useTopoEdit = _interopRequireDefault(require("../../../hooks/useTopoEdit"))
23
23
 
24
24
  var _useSelection2 = _interopRequireDefault(require("../../../hooks/useSelection"));
25
25
 
26
- var _useRelateTopo = _interopRequireDefault(require("../../../hooks/useRelateTopo"));
27
-
28
26
  var _showMessage = _interopRequireDefault(require("../../utils/showMessage"));
29
27
 
30
28
  var _EditorPlugin = _interopRequireDefault(require("../../editor/components/EditorPlugin"));
@@ -39,15 +37,15 @@ var _PropertyView = _interopRequireDefault(require("../../editor/components/sett
39
37
 
40
38
  var _BackgroundView = _interopRequireDefault(require("../../editor/components/BackgroundView"));
41
39
 
42
- var _TopoViewModule = _interopRequireDefault(require("./TopoView.module.scss"));
43
-
44
40
  var _edgeUtil = require("../../utils/edgeUtil");
45
41
 
42
+ var _TopoViewModule = _interopRequireDefault(require("./TopoView.module.scss"));
43
+
46
44
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
45
 
48
46
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
49
47
 
50
- var TopoView = function TopoView(props) {
48
+ var Topology = function Topology(props) {
51
49
  var _classnames, _graphViewProps$creat;
52
50
 
53
51
  var topo = props.topo,
@@ -63,6 +61,7 @@ var TopoView = function TopoView(props) {
63
61
  nodeDeleteable = props.nodeDeleteable,
64
62
  onNodeDelete = props.onNodeDelete,
65
63
  onLineDelete = props.onLineDelete,
64
+ onEvent = props.onEvent,
66
65
  _props$graphViewProps = props.graphViewProps,
67
66
  graphViewProps = _props$graphViewProps === void 0 ? {} : _props$graphViewProps,
68
67
  viewerProps = props.viewerProps,
@@ -109,10 +108,7 @@ var TopoView = function TopoView(props) {
109
108
  var onExitEdit = topoEdit.onExitEdit,
110
109
  onBindData = topoEdit.onBindData,
111
110
  onDeleteElement = topoEdit.onDeleteElement,
112
- onSaveTopo = topoEdit.onSaveTopo;
113
- var relateTopo = (0, _useRelateTopo["default"])({
114
- topo: topo
115
- }); // useAlarm({
111
+ onSaveTopo = topoEdit.onSaveTopo; // useAlarm({
116
112
  // topo,
117
113
  // });
118
114
 
@@ -141,13 +137,6 @@ var TopoView = function TopoView(props) {
141
137
  (0, _react.useEffect)(function () {
142
138
  // rlog.debug("TopoView.useEffect topoData", topoData);
143
139
  setTData(buildLoadOptions ? buildLoadOptions(topoData) : topoData);
144
-
145
- if (topoData) {
146
- // TODO 移到模型中
147
- topoDispatchers.update({
148
- currentTopo: topoData.config
149
- });
150
- }
151
140
  }, [topoData]);
152
141
  (0, _react.useEffect)(function () {
153
142
  return function () {
@@ -207,7 +196,7 @@ var TopoView = function TopoView(props) {
207
196
  var handleEvent = function handleEvent(event) {
208
197
  _rlog["default"].debug("TopoView:onEvent", event);
209
198
 
210
- relateTopo.onEvent(event);
199
+ onEvent(event);
211
200
  topoEdit.onEvent(event);
212
201
 
213
202
  switch (event.name) {
@@ -310,7 +299,7 @@ var TopoView = function TopoView(props) {
310
299
  }));
311
300
  };
312
301
 
313
- TopoView.propTypes = {
302
+ Topology.propTypes = {
314
303
  // 拓扑模型
315
304
  topo: _propTypes["default"].any.isRequired,
316
305
  defaultEnterEditMode: _propTypes["default"].bool,
@@ -330,11 +319,11 @@ TopoView.propTypes = {
330
319
  */
331
320
  titleBar: _propTypes["default"].oneOf([_react["default"].ReactNode, false])
332
321
  };
333
- TopoView.defaultProps = {
322
+ Topology.defaultProps = {
334
323
  defaultEnterEditMode: false,
335
324
  viewerProps: {},
336
325
  editorProps: {} // titleBar: false,
337
326
 
338
327
  };
339
- var _default = TopoView;
328
+ var _default = Topology;
340
329
  exports["default"] = _default;
@@ -8,7 +8,7 @@ exports.createTopology = void 0;
8
8
 
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
 
11
- var _TopoApp = _interopRequireDefault(require("./TopoApp"));
11
+ var _TopoApp = _interopRequireDefault(require("./models/TopoApp"));
12
12
 
13
13
  /**
14
14
  *