@riil-frontend/component-topology 10.0.32 → 10.0.33
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.
@@ -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.
|
27
|
+
var version = typeof "10.0.33" === 'string' ? "10.0.33" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -1,18 +1,20 @@
|
|
1
1
|
import { getLinksInNodes } from "../../core/utils/linkUtil";
|
2
2
|
/**
|
3
|
-
*
|
3
|
+
* 查询节点/区域及后代节点
|
4
4
|
* @param {*} nodes
|
5
5
|
* @returns
|
6
6
|
*/
|
7
7
|
|
8
|
-
var
|
9
|
-
var allNodes = []
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
var getNodeChildrenNodes = function getNodeChildrenNodes(node) {
|
9
|
+
var allNodes = [node];
|
10
|
+
|
11
|
+
if (node instanceof ht.Group) {
|
12
|
+
var children = node.getChildren().toArray();
|
13
|
+
children.forEach(function (child) {
|
14
|
+
allNodes.push.apply(allNodes, getNodeChildrenNodes(child));
|
15
|
+
});
|
16
|
+
}
|
17
|
+
|
16
18
|
return allNodes;
|
17
19
|
};
|
18
20
|
/**
|
@@ -24,9 +26,17 @@ var getChildrenNodes = function getChildrenNodes(nodes) {
|
|
24
26
|
|
25
27
|
|
26
28
|
export function getLinksByEdgeGroup(topo, edgeGroup) {
|
27
|
-
var
|
28
|
-
|
29
|
-
|
29
|
+
var sourceIds = getNodeChildrenNodes(edgeGroup.getSourceAgent()).map(function (item) {
|
30
|
+
return item.getTag();
|
31
|
+
}).filter(function (item) {
|
32
|
+
return !!item;
|
33
|
+
});
|
34
|
+
var targetIds = getNodeChildrenNodes(edgeGroup.getTargetAgent()).map(function (item) {
|
35
|
+
return item.getTag();
|
36
|
+
}).filter(function (item) {
|
37
|
+
return !!item;
|
38
|
+
});
|
39
|
+
var links = getLinksInNodes(topo.dataModel.getEdges(), sourceIds, targetIds);
|
30
40
|
return links;
|
31
41
|
} // 获得连线组标注配置的链路id。无配置时取默认链路
|
32
42
|
|
@@ -39,15 +49,16 @@ export function getEdgeGroupLinkIdConfig(edgeGroup, topo) {
|
|
39
49
|
}
|
40
50
|
|
41
51
|
return getEdgeGroupLinkConfig({
|
42
|
-
|
52
|
+
edgeGroup: edgeGroup,
|
43
53
|
topo: topo,
|
44
54
|
links: links
|
45
55
|
});
|
46
56
|
}
|
47
|
-
export function getEdgeGroupConfigId(
|
48
|
-
var
|
49
|
-
var
|
50
|
-
var
|
57
|
+
export function getEdgeGroupConfigId(edgeGroup) {
|
58
|
+
var sourceNode = edgeGroup.getSourceAgent();
|
59
|
+
var targetNode = edgeGroup.getTargetAgent();
|
60
|
+
var sourceId = sourceNode.a('uuid');
|
61
|
+
var targetId = targetNode.a('uuid');
|
51
62
|
return [sourceId, targetId].sort().join(',');
|
52
63
|
}
|
53
64
|
/**
|
@@ -61,14 +72,23 @@ function getDefaultLinkId(links) {
|
|
61
72
|
return a.attributes.display_name.localeCompare(b.attributes.display_name);
|
62
73
|
});
|
63
74
|
return sortedLinks[0].id;
|
64
|
-
}
|
75
|
+
} // 获得连线组标注配置的链路id。无配置时取默认链路
|
76
|
+
|
65
77
|
|
66
78
|
export function getEdgeGroupLinkConfig(_ref) {
|
67
|
-
var
|
79
|
+
var edgeGroup = _ref.edgeGroup,
|
68
80
|
topo = _ref.topo,
|
69
81
|
links = _ref.links;
|
70
82
|
var displayConfig = topo.store.getModelState('displayConfig');
|
71
|
-
var edgeGroupShowLinkTag = displayConfig.
|
72
|
-
var edgeGroupId = getEdgeGroupConfigId(
|
73
|
-
|
83
|
+
var edgeGroupShowLinkTag = displayConfig.edgeGroupTagBindLink || {};
|
84
|
+
var edgeGroupId = getEdgeGroupConfigId(edgeGroup);
|
85
|
+
var linkId = edgeGroupShowLinkTag[edgeGroupId];
|
86
|
+
|
87
|
+
if (links.find(function (item) {
|
88
|
+
return item.id === linkId;
|
89
|
+
})) {
|
90
|
+
return linkId;
|
91
|
+
}
|
92
|
+
|
93
|
+
return getDefaultLinkId(links);
|
74
94
|
}
|
@@ -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.
|
59
|
+
var version = typeof "10.0.33" === 'string' ? "10.0.33" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -9,18 +9,20 @@ exports.getLinksByEdgeGroup = getLinksByEdgeGroup;
|
|
9
9
|
var _linkUtil = require("../../core/utils/linkUtil");
|
10
10
|
|
11
11
|
/**
|
12
|
-
*
|
12
|
+
* 查询节点/区域及后代节点
|
13
13
|
* @param {*} nodes
|
14
14
|
* @returns
|
15
15
|
*/
|
16
|
-
var
|
17
|
-
var allNodes = []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
var getNodeChildrenNodes = function getNodeChildrenNodes(node) {
|
17
|
+
var allNodes = [node];
|
18
|
+
|
19
|
+
if (node instanceof ht.Group) {
|
20
|
+
var children = node.getChildren().toArray();
|
21
|
+
children.forEach(function (child) {
|
22
|
+
allNodes.push.apply(allNodes, getNodeChildrenNodes(child));
|
23
|
+
});
|
24
|
+
}
|
25
|
+
|
24
26
|
return allNodes;
|
25
27
|
};
|
26
28
|
/**
|
@@ -32,9 +34,17 @@ var getChildrenNodes = function getChildrenNodes(nodes) {
|
|
32
34
|
|
33
35
|
|
34
36
|
function getLinksByEdgeGroup(topo, edgeGroup) {
|
35
|
-
var
|
36
|
-
|
37
|
-
|
37
|
+
var sourceIds = getNodeChildrenNodes(edgeGroup.getSourceAgent()).map(function (item) {
|
38
|
+
return item.getTag();
|
39
|
+
}).filter(function (item) {
|
40
|
+
return !!item;
|
41
|
+
});
|
42
|
+
var targetIds = getNodeChildrenNodes(edgeGroup.getTargetAgent()).map(function (item) {
|
43
|
+
return item.getTag();
|
44
|
+
}).filter(function (item) {
|
45
|
+
return !!item;
|
46
|
+
});
|
47
|
+
var links = (0, _linkUtil.getLinksInNodes)(topo.dataModel.getEdges(), sourceIds, targetIds);
|
38
48
|
return links;
|
39
49
|
} // 获得连线组标注配置的链路id。无配置时取默认链路
|
40
50
|
|
@@ -48,16 +58,17 @@ function getEdgeGroupLinkIdConfig(edgeGroup, topo) {
|
|
48
58
|
}
|
49
59
|
|
50
60
|
return getEdgeGroupLinkConfig({
|
51
|
-
|
61
|
+
edgeGroup: edgeGroup,
|
52
62
|
topo: topo,
|
53
63
|
links: links
|
54
64
|
});
|
55
65
|
}
|
56
66
|
|
57
|
-
function getEdgeGroupConfigId(
|
58
|
-
var
|
59
|
-
var
|
60
|
-
var
|
67
|
+
function getEdgeGroupConfigId(edgeGroup) {
|
68
|
+
var sourceNode = edgeGroup.getSourceAgent();
|
69
|
+
var targetNode = edgeGroup.getTargetAgent();
|
70
|
+
var sourceId = sourceNode.a('uuid');
|
71
|
+
var targetId = targetNode.a('uuid');
|
61
72
|
return [sourceId, targetId].sort().join(',');
|
62
73
|
}
|
63
74
|
/**
|
@@ -72,14 +83,23 @@ function getDefaultLinkId(links) {
|
|
72
83
|
return a.attributes.display_name.localeCompare(b.attributes.display_name);
|
73
84
|
});
|
74
85
|
return sortedLinks[0].id;
|
75
|
-
}
|
86
|
+
} // 获得连线组标注配置的链路id。无配置时取默认链路
|
87
|
+
|
76
88
|
|
77
89
|
function getEdgeGroupLinkConfig(_ref) {
|
78
|
-
var
|
90
|
+
var edgeGroup = _ref.edgeGroup,
|
79
91
|
topo = _ref.topo,
|
80
92
|
links = _ref.links;
|
81
93
|
var displayConfig = topo.store.getModelState('displayConfig');
|
82
|
-
var edgeGroupShowLinkTag = displayConfig.
|
83
|
-
var edgeGroupId = getEdgeGroupConfigId(
|
84
|
-
|
94
|
+
var edgeGroupShowLinkTag = displayConfig.edgeGroupTagBindLink || {};
|
95
|
+
var edgeGroupId = getEdgeGroupConfigId(edgeGroup);
|
96
|
+
var linkId = edgeGroupShowLinkTag[edgeGroupId];
|
97
|
+
|
98
|
+
if (links.find(function (item) {
|
99
|
+
return item.id === linkId;
|
100
|
+
})) {
|
101
|
+
return linkId;
|
102
|
+
}
|
103
|
+
|
104
|
+
return getDefaultLinkId(links);
|
85
105
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "10.0.
|
3
|
+
"version": "10.0.33",
|
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.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@10.0.33/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|