@riil-frontend/component-topology 8.0.0-a.3 → 8.0.0-a.4
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 +1 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +37 -25
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
- package/es/core/editor/utils/edgeTypeStyleUtil.js +2 -3
- package/es/core/models/TopoApp.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +37 -25
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -0
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +2 -3
- package/lib/core/models/TopoApp.js +1 -1
- package/package.json +2 -2
@@ -60,43 +60,55 @@ var LINE_MOLD_OPTIONS = [{
|
|
60
60
|
icon: 'topo_lineMold_dotted_two'
|
61
61
|
}];
|
62
62
|
|
63
|
-
function
|
63
|
+
function getValuesByEdges(edges) {
|
64
|
+
function getStartPoint(edge) {
|
65
|
+
var icons = edge.s('icons') || {};
|
66
|
+
return ['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].filter(function (name) {
|
67
|
+
return icons[name];
|
68
|
+
})[0] || 'nil';
|
69
|
+
}
|
70
|
+
|
71
|
+
function getEndPoint(edge) {
|
72
|
+
var icons = edge.s('icons') || {};
|
73
|
+
return ['targetArrow', 'targetSolidCircle', 'targetNoneCircle'].filter(function (name) {
|
74
|
+
return icons[name];
|
75
|
+
})[0] || 'nil';
|
76
|
+
}
|
77
|
+
|
78
|
+
var edgeValues = edges.map(function (edge) {
|
79
|
+
return {
|
80
|
+
startPoint: getStartPoint(edge),
|
81
|
+
endPoint: getEndPoint(edge),
|
82
|
+
lineMold: edge.a('lineMode') || 'solidLine'
|
83
|
+
};
|
84
|
+
});
|
64
85
|
var values = {
|
65
86
|
startPoint: undefined,
|
66
87
|
endPoint: undefined,
|
67
88
|
lineMold: undefined
|
68
|
-
};
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
values = {
|
73
|
-
startPoint: 'nil',
|
74
|
-
endPoint: 'nil',
|
75
|
-
lineMold: edge.a('lineMode') || 'solidLine'
|
76
|
-
};
|
77
|
-
var icons = edge.s('icons') || {};
|
78
|
-
['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].forEach(function (name) {
|
79
|
-
if (icons[name]) {
|
80
|
-
values.startPoint = name;
|
81
|
-
}
|
89
|
+
};
|
90
|
+
Object.keys(values).forEach(function (name) {
|
91
|
+
var vals = edgeValues.map(function (item) {
|
92
|
+
return item[name];
|
82
93
|
});
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
}
|
87
|
-
});
|
88
|
-
}
|
94
|
+
var isSame = vals.filter(function (val) {
|
95
|
+
return val === vals[0];
|
96
|
+
}).length === vals.length;
|
89
97
|
|
98
|
+
if (isSame) {
|
99
|
+
values[name] = vals[0];
|
100
|
+
}
|
101
|
+
});
|
90
102
|
return values;
|
91
103
|
}
|
92
104
|
|
93
105
|
function EdgeType(props) {
|
94
|
-
var
|
106
|
+
var edges = props.edges,
|
95
107
|
_onChange = props.onChange;
|
96
108
|
|
97
109
|
var field = _Field.useField({
|
98
110
|
autoUnmount: false,
|
99
|
-
values:
|
111
|
+
values: getValuesByEdges(edges),
|
100
112
|
onChange: function onChange(name, value) {
|
101
113
|
if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
|
102
114
|
_onChange(name, null);
|
@@ -107,8 +119,8 @@ function EdgeType(props) {
|
|
107
119
|
});
|
108
120
|
|
109
121
|
useEffect(function () {
|
110
|
-
field.setValues(
|
111
|
-
}, [
|
122
|
+
field.setValues(getValuesByEdges(edges));
|
123
|
+
}, [edges]);
|
112
124
|
return /*#__PURE__*/React.createElement("div", {
|
113
125
|
className: styles.lineBox
|
114
126
|
}, /*#__PURE__*/React.createElement(_Form, {
|
@@ -14,8 +14,7 @@ export function getEdgesBySelection(topo) {
|
|
14
14
|
return nodeIds;
|
15
15
|
};
|
16
16
|
|
17
|
-
var getSelectedEdges = function getSelectedEdges(
|
18
|
-
var gv = topo.getGraphView();
|
17
|
+
var getSelectedEdges = function getSelectedEdges(gv) {
|
19
18
|
var selection = gv.getSelectionModel().getSelection().toArray(); // 选中的连线
|
20
19
|
|
21
20
|
var edges = selection.filter(function (element) {
|
@@ -41,7 +40,7 @@ export function getEdgesBySelection(topo) {
|
|
41
40
|
return edges;
|
42
41
|
};
|
43
42
|
|
44
|
-
return getSelectedEdges(topo);
|
43
|
+
return getSelectedEdges(topo.getGraphView());
|
45
44
|
}
|
46
45
|
/**
|
47
46
|
* 遍历连线及子连线
|
@@ -23,7 +23,7 @@ import topoFactory from "./topoFactory";
|
|
23
23
|
import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
24
24
|
import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
|
25
25
|
|
26
|
-
var version = typeof "8.0.0-a.
|
26
|
+
var version = typeof "8.0.0-a.4" === 'string' ? "8.0.0-a.4" : null;
|
27
27
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
28
28
|
/**
|
29
29
|
* 拓扑显示和编辑
|
@@ -77,43 +77,55 @@ var LINE_MOLD_OPTIONS = [{
|
|
77
77
|
icon: 'topo_lineMold_dotted_two'
|
78
78
|
}];
|
79
79
|
|
80
|
-
function
|
80
|
+
function getValuesByEdges(edges) {
|
81
|
+
function getStartPoint(edge) {
|
82
|
+
var icons = edge.s('icons') || {};
|
83
|
+
return ['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].filter(function (name) {
|
84
|
+
return icons[name];
|
85
|
+
})[0] || 'nil';
|
86
|
+
}
|
87
|
+
|
88
|
+
function getEndPoint(edge) {
|
89
|
+
var icons = edge.s('icons') || {};
|
90
|
+
return ['targetArrow', 'targetSolidCircle', 'targetNoneCircle'].filter(function (name) {
|
91
|
+
return icons[name];
|
92
|
+
})[0] || 'nil';
|
93
|
+
}
|
94
|
+
|
95
|
+
var edgeValues = edges.map(function (edge) {
|
96
|
+
return {
|
97
|
+
startPoint: getStartPoint(edge),
|
98
|
+
endPoint: getEndPoint(edge),
|
99
|
+
lineMold: edge.a('lineMode') || 'solidLine'
|
100
|
+
};
|
101
|
+
});
|
81
102
|
var values = {
|
82
103
|
startPoint: undefined,
|
83
104
|
endPoint: undefined,
|
84
105
|
lineMold: undefined
|
85
|
-
};
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
values = {
|
90
|
-
startPoint: 'nil',
|
91
|
-
endPoint: 'nil',
|
92
|
-
lineMold: edge.a('lineMode') || 'solidLine'
|
93
|
-
};
|
94
|
-
var icons = edge.s('icons') || {};
|
95
|
-
['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].forEach(function (name) {
|
96
|
-
if (icons[name]) {
|
97
|
-
values.startPoint = name;
|
98
|
-
}
|
106
|
+
};
|
107
|
+
Object.keys(values).forEach(function (name) {
|
108
|
+
var vals = edgeValues.map(function (item) {
|
109
|
+
return item[name];
|
99
110
|
});
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
}
|
104
|
-
});
|
105
|
-
}
|
111
|
+
var isSame = vals.filter(function (val) {
|
112
|
+
return val === vals[0];
|
113
|
+
}).length === vals.length;
|
106
114
|
|
115
|
+
if (isSame) {
|
116
|
+
values[name] = vals[0];
|
117
|
+
}
|
118
|
+
});
|
107
119
|
return values;
|
108
120
|
}
|
109
121
|
|
110
122
|
function EdgeType(props) {
|
111
|
-
var
|
123
|
+
var edges = props.edges,
|
112
124
|
_onChange = props.onChange;
|
113
125
|
|
114
126
|
var field = _field["default"].useField({
|
115
127
|
autoUnmount: false,
|
116
|
-
values:
|
128
|
+
values: getValuesByEdges(edges),
|
117
129
|
onChange: function onChange(name, value) {
|
118
130
|
if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
|
119
131
|
_onChange(name, null);
|
@@ -124,8 +136,8 @@ function EdgeType(props) {
|
|
124
136
|
});
|
125
137
|
|
126
138
|
(0, _react.useEffect)(function () {
|
127
|
-
field.setValues(
|
128
|
-
}, [
|
139
|
+
field.setValues(getValuesByEdges(edges));
|
140
|
+
}, [edges]);
|
129
141
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
130
142
|
className: _EdgeTypeModule["default"].lineBox
|
131
143
|
}, /*#__PURE__*/_react["default"].createElement(_form["default"], {
|
@@ -128,6 +128,7 @@ function EdgeTypeButton(props) {
|
|
128
128
|
disabled: disabled,
|
129
129
|
trigger: icon
|
130
130
|
}, !disabled && /*#__PURE__*/_react["default"].createElement(_EdgeType["default"], {
|
131
|
+
edges: (0, _edgeTypeStyleUtil.getEdgesBySelection)(topo),
|
131
132
|
selection: selection,
|
132
133
|
onChange: handleChange
|
133
134
|
})));
|
@@ -24,8 +24,7 @@ function getEdgesBySelection(topo) {
|
|
24
24
|
return nodeIds;
|
25
25
|
};
|
26
26
|
|
27
|
-
var getSelectedEdges = function getSelectedEdges(
|
28
|
-
var gv = topo.getGraphView();
|
27
|
+
var getSelectedEdges = function getSelectedEdges(gv) {
|
29
28
|
var selection = gv.getSelectionModel().getSelection().toArray(); // 选中的连线
|
30
29
|
|
31
30
|
var edges = selection.filter(function (element) {
|
@@ -51,7 +50,7 @@ function getEdgesBySelection(topo) {
|
|
51
50
|
return edges;
|
52
51
|
};
|
53
52
|
|
54
|
-
return getSelectedEdges(topo);
|
53
|
+
return getSelectedEdges(topo.getGraphView());
|
55
54
|
}
|
56
55
|
/**
|
57
56
|
* 遍历连线及子连线
|
@@ -54,7 +54,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
|
|
54
54
|
var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
55
55
|
|
56
56
|
// eslint-disable-next-line no-undef
|
57
|
-
var version = typeof "8.0.0-a.
|
57
|
+
var version = typeof "8.0.0-a.4" === 'string' ? "8.0.0-a.4" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "8.0.0-a.
|
3
|
+
"version": "8.0.0-a.4",
|
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@8.0.0-a.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@8.0.0-a.4/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|