@riil-frontend/component-topology 12.0.0-dev.19 → 12.0.0-dev.20
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/index.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +5 -12
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +2 -2
- package/es/core/editor/utils/edgeTypeStyleUtil.js +8 -7
- package/es/core/models/AttributeMetricDisplay.js +9 -3
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/utils/edgeUtil.js +8 -0
- package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +6 -12
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -1
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +8 -6
- package/lib/core/models/AttributeMetricDisplay.js +10 -2
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/utils/edgeUtil.js +10 -0
- package/package.json +2 -2
@@ -1,6 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import React, { useEffect, useState } from 'react';
|
3
3
|
import { getEdgesBySelection } from "../../../../utils/edgeTypeStyleUtil";
|
4
|
+
import { isCustomEdge } from "../../../../../utils/edgeUtil";
|
4
5
|
import DropdownButton from "../components/DropdownButton";
|
5
6
|
import WidgetBox from "../WidgetBox";
|
6
7
|
import Content from "./Content";
|
@@ -36,15 +37,7 @@ function EdgeColorButton(props) {
|
|
36
37
|
};
|
37
38
|
|
38
39
|
var getLines = function getLines(list) {
|
39
|
-
|
40
|
-
var arr = [];
|
41
|
-
loopEdges(list, function (edge) {
|
42
|
-
// eslint-disable-next-line eqeqeq
|
43
|
-
if (edge.getAttrObject().type == 'line') {
|
44
|
-
arr.push(edge);
|
45
|
-
}
|
46
|
-
});
|
47
|
-
return arr;
|
40
|
+
return list.filter(isCustomEdge);
|
48
41
|
};
|
49
42
|
|
50
43
|
useEffect(function () {
|
@@ -53,7 +46,7 @@ function EdgeColorButton(props) {
|
|
53
46
|
var list = getLines(edges);
|
54
47
|
setLineWidth(1); // eslint-disable-next-line eqeqeq
|
55
48
|
|
56
|
-
if (selection.length == 1 &&
|
49
|
+
if (selection.length == 1 && list.length === 1) {
|
57
50
|
setLineWidth(list[0] && (list[0].a('styles') && list[0].a('styles').width || list[0].getStyleMap()['edge.width']) || 2);
|
58
51
|
}
|
59
52
|
|
@@ -67,7 +60,7 @@ function EdgeColorButton(props) {
|
|
67
60
|
var edges = getEdgesBySelection(topo);
|
68
61
|
loopEdges(edges, function (edge) {
|
69
62
|
// eslint-disable-next-line eqeqeq
|
70
|
-
if (edge
|
63
|
+
if (isCustomEdge(edge)) {
|
71
64
|
var color = colors.hex;
|
72
65
|
edge.s('edge.color', color);
|
73
66
|
edge.s('edge.dash.color', color);
|
@@ -95,7 +88,7 @@ function EdgeColorButton(props) {
|
|
95
88
|
topo.historyManager.beginTransaction();
|
96
89
|
loopEdges(edges, function (edge) {
|
97
90
|
// eslint-disable-next-line eqeqeq
|
98
|
-
if (edge
|
91
|
+
if (isCustomEdge(edge)) {
|
99
92
|
edge.s('edge.dash.width', width);
|
100
93
|
edge.s('edge.width', width);
|
101
94
|
var style = edge.a('styles') || {};
|
@@ -3,7 +3,7 @@ import _Field from "@alifd/next/es/field";
|
|
3
3
|
import _Select from "@alifd/next/es/select";
|
4
4
|
import _Form from "@alifd/next/es/form";
|
5
5
|
import React, { useEffect, useState } from 'react';
|
6
|
-
import { getEdgesBySelection,
|
6
|
+
import { getEdgesBySelection, isNodeAllEdges } from "../../../../utils/edgeTypeStyleUtil";
|
7
7
|
import styles from "./EdgeType.module.scss";
|
8
8
|
import LineType from "./LineType";
|
9
9
|
var FormItem = _Form.Item;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import React, { useEffect, useState } from 'react';
|
3
|
-
import { getEdgesBySelection,
|
3
|
+
import { getEdgesBySelection, setEdgesType, updateEdgesData } from "../../../../utils/edgeTypeStyleUtil";
|
4
4
|
import DropdownButton from "../components/DropdownButton";
|
5
5
|
import WidgetBox from "../WidgetBox";
|
6
6
|
import { EDGE_END_POINT_TYPE_MAP, LINE_MOLD_MAP } from "./constants";
|
@@ -52,7 +52,7 @@ function EdgeTypeButton(props) {
|
|
52
52
|
return;
|
53
53
|
}
|
54
54
|
|
55
|
-
|
55
|
+
updateEdgesData(topo, edges, function (edge) {
|
56
56
|
if (name === 'startPoint') {
|
57
57
|
// 删除设置
|
58
58
|
['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].forEach(function (iconName) {
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { getEdges } from "../../../utils/htElementUtils";
|
2
|
-
import { getEdgesBetweenNodes } from "../../../utils/htElementUtils";
|
1
|
+
import { getEdges, getEdgesBetweenNodes } from "../../../utils/htElementUtils";
|
3
2
|
var ht = window.ht;
|
4
3
|
export function getEdgesBySelection(topo) {
|
5
4
|
var getChildrenNodeIds = function getChildrenNodeIds(nodes) {
|
@@ -105,16 +104,18 @@ export function loopEdgesAndChildren(topo, edges, operateEdgeFn) {
|
|
105
104
|
* 设置连线及子连线。带回退事务控制
|
106
105
|
* @param {*} topo
|
107
106
|
* @param {*} edges
|
108
|
-
* @param {*}
|
107
|
+
* @param {*} updateEdgeFn
|
109
108
|
*/
|
110
109
|
|
111
|
-
export function
|
110
|
+
export function updateEdgesData(topo, edges, updateEdgeFn) {
|
112
111
|
topo.historyManager.beginTransaction();
|
113
|
-
|
112
|
+
edges.forEach(function (edge) {
|
113
|
+
updateEdgeFn(edge);
|
114
|
+
});
|
114
115
|
topo.historyManager.endTransaction();
|
115
116
|
}
|
116
117
|
/**
|
117
|
-
*
|
118
|
+
* 批量设置连线线形。带回退事务控制
|
118
119
|
*
|
119
120
|
* @param {*} edges
|
120
121
|
* @param {*} type
|
@@ -123,7 +124,7 @@ export function setEdgesAndChildren(topo, edges, operateEdgeFn) {
|
|
123
124
|
|
124
125
|
export function setEdgesType(edges, type, topo) {
|
125
126
|
var htTopo = topo.getHtTopo();
|
126
|
-
|
127
|
+
updateEdgesData(topo, edges, function (edge) {
|
127
128
|
htTopo.setGraphLinear(edge, {
|
128
129
|
type: type
|
129
130
|
});
|
@@ -525,15 +525,21 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
525
525
|
return _extends({}, item, {
|
526
526
|
tags: tags
|
527
527
|
});
|
528
|
-
});
|
529
|
-
|
528
|
+
});
|
529
|
+
rlog.debug('推送标注 => ht 失败', elementTagsAndTips);
|
530
530
|
var htTopo = topo.getHtTopo();
|
531
531
|
|
532
532
|
if (htTopo) {
|
533
533
|
var _topo$historyManager, _topo$historyManager2;
|
534
534
|
|
535
535
|
(_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.setDisabled(true, '加载标注');
|
536
|
-
|
536
|
+
|
537
|
+
try {
|
538
|
+
htTopo.loadTagAndTip(JSON.parse(JSON.stringify(elementTagsAndTips)));
|
539
|
+
} catch (error) {
|
540
|
+
rlog.error('推送标注 => ht 失败', error);
|
541
|
+
}
|
542
|
+
|
537
543
|
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '加载标注');
|
538
544
|
}
|
539
545
|
}
|
@@ -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 "12.0.0-dev.
|
27
|
+
var version = typeof "12.0.0-dev.20" === 'string' ? "12.0.0-dev.20" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -1,5 +1,13 @@
|
|
1
1
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
2
2
|
import { showLinkByConfig } from "../models/utils/linkUtils";
|
3
|
+
/**
|
4
|
+
* 是否手工连线
|
5
|
+
* @param {*} edge
|
6
|
+
*/
|
7
|
+
|
8
|
+
export function isCustomEdge(edge) {
|
9
|
+
return !edge.isEdgeGroupAgent() && (edge.a('type') == 'line' || !edge.a('type'));
|
10
|
+
}
|
3
11
|
/**
|
4
12
|
* 根据配置更新连线展开折叠状态
|
5
13
|
*
|
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
12
12
|
var _edgeTypeStyleUtil = require("../../../../utils/edgeTypeStyleUtil");
|
13
13
|
|
14
|
+
var _edgeUtil = require("../../../../../utils/edgeUtil");
|
15
|
+
|
14
16
|
var _DropdownButton = _interopRequireDefault(require("../components/DropdownButton"));
|
15
17
|
|
16
18
|
var _WidgetBox = _interopRequireDefault(require("../WidgetBox"));
|
@@ -52,15 +54,7 @@ function EdgeColorButton(props) {
|
|
52
54
|
};
|
53
55
|
|
54
56
|
var getLines = function getLines(list) {
|
55
|
-
|
56
|
-
var arr = [];
|
57
|
-
loopEdges(list, function (edge) {
|
58
|
-
// eslint-disable-next-line eqeqeq
|
59
|
-
if (edge.getAttrObject().type == 'line') {
|
60
|
-
arr.push(edge);
|
61
|
-
}
|
62
|
-
});
|
63
|
-
return arr;
|
57
|
+
return list.filter(_edgeUtil.isCustomEdge);
|
64
58
|
};
|
65
59
|
|
66
60
|
(0, _react.useEffect)(function () {
|
@@ -69,7 +63,7 @@ function EdgeColorButton(props) {
|
|
69
63
|
var list = getLines(edges);
|
70
64
|
setLineWidth(1); // eslint-disable-next-line eqeqeq
|
71
65
|
|
72
|
-
if (selection.length == 1 &&
|
66
|
+
if (selection.length == 1 && list.length === 1) {
|
73
67
|
setLineWidth(list[0] && (list[0].a('styles') && list[0].a('styles').width || list[0].getStyleMap()['edge.width']) || 2);
|
74
68
|
}
|
75
69
|
|
@@ -83,7 +77,7 @@ function EdgeColorButton(props) {
|
|
83
77
|
var edges = (0, _edgeTypeStyleUtil.getEdgesBySelection)(topo);
|
84
78
|
loopEdges(edges, function (edge) {
|
85
79
|
// eslint-disable-next-line eqeqeq
|
86
|
-
if (
|
80
|
+
if ((0, _edgeUtil.isCustomEdge)(edge)) {
|
87
81
|
var color = colors.hex;
|
88
82
|
edge.s('edge.color', color);
|
89
83
|
edge.s('edge.dash.color', color);
|
@@ -111,7 +105,7 @@ function EdgeColorButton(props) {
|
|
111
105
|
topo.historyManager.beginTransaction();
|
112
106
|
loopEdges(edges, function (edge) {
|
113
107
|
// eslint-disable-next-line eqeqeq
|
114
|
-
if (
|
108
|
+
if ((0, _edgeUtil.isCustomEdge)(edge)) {
|
115
109
|
edge.s('edge.dash.width', width);
|
116
110
|
edge.s('edge.width', width);
|
117
111
|
var style = edge.a('styles') || {};
|
@@ -69,7 +69,7 @@ function EdgeTypeButton(props) {
|
|
69
69
|
return;
|
70
70
|
}
|
71
71
|
|
72
|
-
(0, _edgeTypeStyleUtil.
|
72
|
+
(0, _edgeTypeStyleUtil.updateEdgesData)(topo, edges, function (edge) {
|
73
73
|
if (name === 'startPoint') {
|
74
74
|
// 删除设置
|
75
75
|
['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].forEach(function (iconName) {
|
@@ -4,8 +4,8 @@ exports.__esModule = true;
|
|
4
4
|
exports.getEdgesBySelection = getEdgesBySelection;
|
5
5
|
exports.isNodeAllEdges = isNodeAllEdges;
|
6
6
|
exports.loopEdgesAndChildren = loopEdgesAndChildren;
|
7
|
-
exports.setEdgesAndChildren = setEdgesAndChildren;
|
8
7
|
exports.setEdgesType = setEdgesType;
|
8
|
+
exports.updateEdgesData = updateEdgesData;
|
9
9
|
|
10
10
|
var _htElementUtils = require("../../../utils/htElementUtils");
|
11
11
|
|
@@ -117,17 +117,19 @@ function loopEdgesAndChildren(topo, edges, operateEdgeFn) {
|
|
117
117
|
* 设置连线及子连线。带回退事务控制
|
118
118
|
* @param {*} topo
|
119
119
|
* @param {*} edges
|
120
|
-
* @param {*}
|
120
|
+
* @param {*} updateEdgeFn
|
121
121
|
*/
|
122
122
|
|
123
123
|
|
124
|
-
function
|
124
|
+
function updateEdgesData(topo, edges, updateEdgeFn) {
|
125
125
|
topo.historyManager.beginTransaction();
|
126
|
-
|
126
|
+
edges.forEach(function (edge) {
|
127
|
+
updateEdgeFn(edge);
|
128
|
+
});
|
127
129
|
topo.historyManager.endTransaction();
|
128
130
|
}
|
129
131
|
/**
|
130
|
-
*
|
132
|
+
* 批量设置连线线形。带回退事务控制
|
131
133
|
*
|
132
134
|
* @param {*} edges
|
133
135
|
* @param {*} type
|
@@ -137,7 +139,7 @@ function setEdgesAndChildren(topo, edges, operateEdgeFn) {
|
|
137
139
|
|
138
140
|
function setEdgesType(edges, type, topo) {
|
139
141
|
var htTopo = topo.getHtTopo();
|
140
|
-
|
142
|
+
updateEdgesData(topo, edges, function (edge) {
|
141
143
|
htTopo.setGraphLinear(edge, {
|
142
144
|
type: type
|
143
145
|
});
|
@@ -539,7 +539,9 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
539
539
|
return (0, _extends2["default"])({}, item, {
|
540
540
|
tags: tags
|
541
541
|
});
|
542
|
-
});
|
542
|
+
});
|
543
|
+
|
544
|
+
_componentTopologyUtils.rlog.debug('推送标注 => ht 失败', elementTagsAndTips);
|
543
545
|
|
544
546
|
var htTopo = topo.getHtTopo();
|
545
547
|
|
@@ -547,7 +549,13 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
547
549
|
var _topo$historyManager, _topo$historyManager2;
|
548
550
|
|
549
551
|
(_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.setDisabled(true, '加载标注');
|
550
|
-
|
552
|
+
|
553
|
+
try {
|
554
|
+
htTopo.loadTagAndTip(JSON.parse(JSON.stringify(elementTagsAndTips)));
|
555
|
+
} catch (error) {
|
556
|
+
_componentTopologyUtils.rlog.error('推送标注 => ht 失败', error);
|
557
|
+
}
|
558
|
+
|
551
559
|
(_topo$historyManager2 = topo.historyManager) === null || _topo$historyManager2 === void 0 ? void 0 : _topo$historyManager2.setDisabled(false, '加载标注');
|
552
560
|
}
|
553
561
|
}
|
@@ -54,7 +54,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
|
54
54
|
var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
|
55
55
|
|
56
56
|
// eslint-disable-next-line no-undef
|
57
|
-
var version = typeof "12.0.0-dev.
|
57
|
+
var version = typeof "12.0.0-dev.20" === 'string' ? "12.0.0-dev.20" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
@@ -3,17 +3,27 @@
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
|
+
exports.isCustomEdge = isCustomEdge;
|
6
7
|
exports.updateEdgeExpanded = void 0;
|
7
8
|
|
8
9
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
9
10
|
|
10
11
|
var _linkUtils = require("../models/utils/linkUtils");
|
11
12
|
|
13
|
+
/**
|
14
|
+
* 是否手工连线
|
15
|
+
* @param {*} edge
|
16
|
+
*/
|
17
|
+
function isCustomEdge(edge) {
|
18
|
+
return !edge.isEdgeGroupAgent() && (edge.a('type') == 'line' || !edge.a('type'));
|
19
|
+
}
|
12
20
|
/**
|
13
21
|
* 根据配置更新连线展开折叠状态
|
14
22
|
*
|
15
23
|
* @param {*} topo
|
16
24
|
*/
|
25
|
+
|
26
|
+
|
17
27
|
var updateEdgeExpanded = function updateEdgeExpanded(topo) {
|
18
28
|
var _topo$historyManager, _topo$historyManager2;
|
19
29
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "12.0.0-dev.
|
3
|
+
"version": "12.0.0-dev.20",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -123,6 +123,6 @@
|
|
123
123
|
"access": "public"
|
124
124
|
},
|
125
125
|
"license": "MIT",
|
126
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@12.0.0-dev.
|
126
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@12.0.0-dev.20/build/index.html",
|
127
127
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
128
128
|
}
|