@riil-frontend/component-topology 10.0.28 → 10.0.29

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.
@@ -12,13 +12,13 @@ export default function useHtDataPropertyChangeListener(props) {
12
12
  var dm = topo.getDataModel();
13
13
  var inited = false;
14
14
 
15
- if (graphLoaded || graphLoaded2) {
15
+ if (dm) {
16
16
  dm.addDataPropertyChangeListener(onChange);
17
17
  inited = true;
18
18
  }
19
19
 
20
20
  return function () {
21
- if (inited) {
21
+ if (inited && dm) {
22
22
  dm.removeDataPropertyChangeListener(onChange);
23
23
  }
24
24
  };
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel";
25
25
  import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
26
26
 
27
- var version = typeof "10.0.28" === 'string' ? "10.0.28" : null;
27
+ var version = typeof "10.0.29" === 'string' ? "10.0.29" : null;
28
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
29
29
  /**
30
30
  * 拓扑显示和编辑
@@ -23,6 +23,13 @@ export default {
23
23
 
24
24
  };
25
25
  },
26
+ open: function open(prevState, id) {
27
+ return {
28
+ visible: true,
29
+ id: id // 资源id
30
+
31
+ };
32
+ },
26
33
  close: function close() {
27
34
  return {
28
35
  visible: false,
@@ -0,0 +1,12 @@
1
+ /**
2
+ *
3
+ * @param {Array} links
4
+ * @param {Array} ids1
5
+ * @param {Array} ids2
6
+ * @returns
7
+ */
8
+ export function getLinksInNodes(links, ids1, ids2) {
9
+ return links.filter(function (link) {
10
+ return ids1.includes(link.source) && ids2.includes(link.target) || ids2.includes(link.source) && ids1.includes(link.target);
11
+ });
12
+ }
@@ -62,8 +62,9 @@ function useElementDetailManager(props) {
62
62
  }
63
63
 
64
64
  function openByHtElement(htElement) {
65
+ var isEdgeGroupAgent = htElement instanceof ht.Edge && htElement.isEdgeGroupAgent() && !htElement.s('edge.expanded');
65
66
  open({
66
- id: htElement.getTag() || "ht:" + htElement.getId(),
67
+ id: isEdgeGroupAgent || !htElement.getTag() ? "ht:" + htElement.getId() : htElement.getTag(),
67
68
  htElement: htElement
68
69
  });
69
70
  }
@@ -42,10 +42,11 @@ function ResourceDetailDrawer(props) {
42
42
  detailManager: detailManager
43
43
  }),
44
44
  onClose: detailManager.close
45
- }, visible && /*#__PURE__*/React.createElement(Content, _extends({}, props, {
45
+ }, visible && Content && /*#__PURE__*/React.createElement(Content, _extends({}, props, {
46
46
  topo: topo,
47
47
  id: id,
48
48
  htElement: htElement,
49
+ detailManager: detailManager,
49
50
  viewerProps: viewerProps,
50
51
  onClose: detailManager.close
51
52
  })));
@@ -1,9 +1,38 @@
1
- // 获得连线组标注配置的链路id。无配置时取默认链路
2
- export function getEdgeGroupLinkIdConfig(edgeGroup, topo) {
3
- // const { } = options
1
+ import { getLinksInNodes } from "../../core/utils/linkUtil";
2
+ /**
3
+ * 查询节点/区域及子节点
4
+ * @param {*} nodes
5
+ * @returns
6
+ */
7
+
8
+ var getChildrenNodes = function getChildrenNodes(nodes) {
9
+ var allNodes = [].concat(nodes);
10
+ nodes.forEach(function (node) {
11
+ if (node instanceof ht.Group) {
12
+ var children = node.getChildren().toArray();
13
+ allNodes.push.apply(allNodes, getChildrenNodes(children));
14
+ }
15
+ });
16
+ return allNodes;
17
+ };
18
+ /**
19
+ * 查询连线两端节点间的链路列表
20
+ * @param {*} topo
21
+ * @param {*} edgeGroup
22
+ * @returns
23
+ */
24
+
25
+
26
+ export function getLinksByEdgeGroup(topo, edgeGroup) {
4
27
  var sourceId = edgeGroup.getSource().getTag();
5
28
  var targetId = edgeGroup.getTarget().getTag();
6
- var links = topo.dataModel.getEdgesBetweenTwoNodes(sourceId, targetId);
29
+ var links = getLinksInNodes(topo.dataModel.getEdges(), [sourceId], [targetId]);
30
+ return links;
31
+ } // 获得连线组标注配置的链路id。无配置时取默认链路
32
+
33
+ export function getEdgeGroupLinkIdConfig(edgeGroup, topo) {
34
+ // const { } = options
35
+ var links = getLinksByEdgeGroup(topo, edgeGroup);
7
36
 
8
37
  if (!links.length) {
9
38
  return null;
@@ -21,13 +21,13 @@ function useHtDataPropertyChangeListener(props) {
21
21
  var dm = topo.getDataModel();
22
22
  var inited = false;
23
23
 
24
- if (graphLoaded || graphLoaded2) {
24
+ if (dm) {
25
25
  dm.addDataPropertyChangeListener(onChange);
26
26
  inited = true;
27
27
  }
28
28
 
29
29
  return function () {
30
- if (inited) {
30
+ if (inited && dm) {
31
31
  dm.removeDataPropertyChangeListener(onChange);
32
32
  }
33
33
  };
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
56
56
  var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
57
57
 
58
58
  // eslint-disable-next-line no-undef
59
- var version = typeof "10.0.28" === 'string' ? "10.0.28" : null;
59
+ var version = typeof "10.0.29" === 'string' ? "10.0.29" : null;
60
60
  console.info("\u62D3\u6251\u7248\u672C: " + version);
61
61
  /**
62
62
  * 拓扑显示和编辑
@@ -31,6 +31,13 @@ var _default = {
31
31
 
32
32
  };
33
33
  },
34
+ open: function open(prevState, id) {
35
+ return {
36
+ visible: true,
37
+ id: id // 资源id
38
+
39
+ };
40
+ },
34
41
  close: function close() {
35
42
  return {
36
43
  visible: false,
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getLinksInNodes = getLinksInNodes;
5
+
6
+ /**
7
+ *
8
+ * @param {Array} links
9
+ * @param {Array} ids1
10
+ * @param {Array} ids2
11
+ * @returns
12
+ */
13
+ function getLinksInNodes(links, ids1, ids2) {
14
+ return links.filter(function (link) {
15
+ return ids1.includes(link.source) && ids2.includes(link.target) || ids2.includes(link.source) && ids1.includes(link.target);
16
+ });
17
+ }
@@ -74,8 +74,9 @@ function useElementDetailManager(props) {
74
74
  }
75
75
 
76
76
  function openByHtElement(htElement) {
77
+ var isEdgeGroupAgent = htElement instanceof ht.Edge && htElement.isEdgeGroupAgent() && !htElement.s('edge.expanded');
77
78
  open({
78
- id: htElement.getTag() || "ht:" + htElement.getId(),
79
+ id: isEdgeGroupAgent || !htElement.getTag() ? "ht:" + htElement.getId() : htElement.getTag(),
79
80
  htElement: htElement
80
81
  });
81
82
  }
@@ -58,10 +58,11 @@ function ResourceDetailDrawer(props) {
58
58
  detailManager: detailManager
59
59
  }),
60
60
  onClose: detailManager.close
61
- }, visible && /*#__PURE__*/_react["default"].createElement(Content, (0, _extends2["default"])({}, props, {
61
+ }, visible && Content && /*#__PURE__*/_react["default"].createElement(Content, (0, _extends2["default"])({}, props, {
62
62
  topo: topo,
63
63
  id: id,
64
64
  htElement: htElement,
65
+ detailManager: detailManager,
65
66
  viewerProps: viewerProps,
66
67
  onClose: detailManager.close
67
68
  })));
@@ -4,13 +4,44 @@ exports.__esModule = true;
4
4
  exports.getEdgeGroupConfigId = getEdgeGroupConfigId;
5
5
  exports.getEdgeGroupLinkConfig = getEdgeGroupLinkConfig;
6
6
  exports.getEdgeGroupLinkIdConfig = getEdgeGroupLinkIdConfig;
7
+ exports.getLinksByEdgeGroup = getLinksByEdgeGroup;
7
8
 
8
- // 获得连线组标注配置的链路id。无配置时取默认链路
9
- function getEdgeGroupLinkIdConfig(edgeGroup, topo) {
10
- // const { } = options
9
+ var _linkUtil = require("../../core/utils/linkUtil");
10
+
11
+ /**
12
+ * 查询节点/区域及子节点
13
+ * @param {*} nodes
14
+ * @returns
15
+ */
16
+ var getChildrenNodes = function getChildrenNodes(nodes) {
17
+ var allNodes = [].concat(nodes);
18
+ nodes.forEach(function (node) {
19
+ if (node instanceof ht.Group) {
20
+ var children = node.getChildren().toArray();
21
+ allNodes.push.apply(allNodes, getChildrenNodes(children));
22
+ }
23
+ });
24
+ return allNodes;
25
+ };
26
+ /**
27
+ * 查询连线两端节点间的链路列表
28
+ * @param {*} topo
29
+ * @param {*} edgeGroup
30
+ * @returns
31
+ */
32
+
33
+
34
+ function getLinksByEdgeGroup(topo, edgeGroup) {
11
35
  var sourceId = edgeGroup.getSource().getTag();
12
36
  var targetId = edgeGroup.getTarget().getTag();
13
- var links = topo.dataModel.getEdgesBetweenTwoNodes(sourceId, targetId);
37
+ var links = (0, _linkUtil.getLinksInNodes)(topo.dataModel.getEdges(), [sourceId], [targetId]);
38
+ return links;
39
+ } // 获得连线组标注配置的链路id。无配置时取默认链路
40
+
41
+
42
+ function getEdgeGroupLinkIdConfig(edgeGroup, topo) {
43
+ // const { } = options
44
+ var links = getLinksByEdgeGroup(topo, edgeGroup);
14
45
 
15
46
  if (!links.length) {
16
47
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "10.0.28",
3
+ "version": "10.0.29",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -116,6 +116,6 @@
116
116
  "access": "public"
117
117
  },
118
118
  "license": "MIT",
119
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@10.0.28/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@10.0.29/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }