@riil-frontend/component-topology 8.0.0-a.3 → 8.0.0-a.5
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.css +1 -1
- package/build/index.js +12 -12
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +42 -24
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +7 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
- 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 +43 -24
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +8 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +4 -0
- 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
@@ -2,6 +2,7 @@ import _Field from "@alifd/next/es/field";
|
|
2
2
|
import _Select from "@alifd/next/es/select";
|
3
3
|
import _Form from "@alifd/next/es/form";
|
4
4
|
import React, { useEffect } from 'react';
|
5
|
+
import { getEdgesBySelection, loopEdgesAndChildren } from "../../../../utils/edgeTypeStyleUtil";
|
5
6
|
import styles from "./EdgeType.module.scss";
|
6
7
|
import LineType from "./LineType";
|
7
8
|
var FormItem = _Form.Item;
|
@@ -60,43 +61,60 @@ var LINE_MOLD_OPTIONS = [{
|
|
60
61
|
icon: 'topo_lineMold_dotted_two'
|
61
62
|
}];
|
62
63
|
|
63
|
-
function
|
64
|
+
function getValuesByEdges(topo) {
|
65
|
+
function getStartPoint(edge) {
|
66
|
+
var icons = edge.s('icons') || {};
|
67
|
+
return ['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].filter(function (name) {
|
68
|
+
return icons[name];
|
69
|
+
})[0] || 'nil';
|
70
|
+
}
|
71
|
+
|
72
|
+
function getEndPoint(edge) {
|
73
|
+
var icons = edge.s('icons') || {};
|
74
|
+
return ['targetArrow', 'targetSolidCircle', 'targetNoneCircle'].filter(function (name) {
|
75
|
+
return icons[name];
|
76
|
+
})[0] || 'nil';
|
77
|
+
}
|
78
|
+
|
79
|
+
var selectionEdges = getEdgesBySelection(topo);
|
80
|
+
var edgeValues = [];
|
81
|
+
loopEdgesAndChildren(topo, selectionEdges, function (edge) {
|
82
|
+
edgeValues.push({
|
83
|
+
lineButton: edge.s('edge.type'),
|
84
|
+
startPoint: getStartPoint(edge),
|
85
|
+
endPoint: getEndPoint(edge),
|
86
|
+
lineMold: edge.a('lineMode') || 'solidLine'
|
87
|
+
});
|
88
|
+
});
|
64
89
|
var values = {
|
90
|
+
lineButton: undefined,
|
65
91
|
startPoint: undefined,
|
66
92
|
endPoint: undefined,
|
67
93
|
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
|
-
}
|
94
|
+
};
|
95
|
+
Object.keys(values).forEach(function (name) {
|
96
|
+
var vals = edgeValues.map(function (item) {
|
97
|
+
return item[name];
|
82
98
|
});
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
}
|
87
|
-
});
|
88
|
-
}
|
99
|
+
var isSame = vals.filter(function (val) {
|
100
|
+
return val === vals[0];
|
101
|
+
}).length === vals.length;
|
89
102
|
|
103
|
+
if (isSame) {
|
104
|
+
values[name] = vals[0];
|
105
|
+
}
|
106
|
+
});
|
90
107
|
return values;
|
91
108
|
}
|
92
109
|
|
93
110
|
function EdgeType(props) {
|
94
|
-
var
|
111
|
+
var topo = props.topo,
|
112
|
+
selection = props.selection,
|
95
113
|
_onChange = props.onChange;
|
96
114
|
|
97
115
|
var field = _Field.useField({
|
98
116
|
autoUnmount: false,
|
99
|
-
values:
|
117
|
+
values: getValuesByEdges(topo),
|
100
118
|
onChange: function onChange(name, value) {
|
101
119
|
if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
|
102
120
|
_onChange(name, null);
|
@@ -107,7 +125,7 @@ function EdgeType(props) {
|
|
107
125
|
});
|
108
126
|
|
109
127
|
useEffect(function () {
|
110
|
-
field.setValues(
|
128
|
+
field.setValues(getValuesByEdges(topo));
|
111
129
|
}, [selection]);
|
112
130
|
return /*#__PURE__*/React.createElement("div", {
|
113
131
|
className: styles.lineBox
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import _Button from "@alifd/next/es/button";
|
2
2
|
import _Balloon from "@alifd/next/es/balloon";
|
3
3
|
import React, { useState } from 'react';
|
4
|
+
import classNames from 'classnames';
|
4
5
|
import styles from "./LineType.module.scss";
|
5
6
|
var Tooltip = _Balloon.Tooltip;
|
6
7
|
var LINE_TYPE_OPTIONS = [{
|
@@ -25,11 +26,14 @@ var LINE_TYPE_OPTIONS = [{
|
|
25
26
|
icon: 'topo_linear_icon_arcline'
|
26
27
|
}];
|
27
28
|
var LineType = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
28
|
-
var
|
29
|
+
var value = props.value,
|
30
|
+
onChange = props.onChange;
|
29
31
|
|
30
32
|
function lineButton(item) {
|
33
|
+
var _classNames;
|
34
|
+
|
31
35
|
return /*#__PURE__*/React.createElement(_Button, {
|
32
|
-
className:
|
36
|
+
className: classNames(styles.redioBtn, (_classNames = {}, _classNames[styles.selected] = value === item.value, _classNames)),
|
33
37
|
onClick: function onClick() {
|
34
38
|
onChange(item.value);
|
35
39
|
}
|
@@ -50,4 +54,5 @@ var LineType = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
50
54
|
}, item.label);
|
51
55
|
}));
|
52
56
|
});
|
57
|
+
LineType.displayName = 'LineType';
|
53
58
|
export default LineType;
|
@@ -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.5" === 'string' ? "8.0.0-a.5" : null;
|
27
27
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
28
28
|
/**
|
29
29
|
* 拓扑显示和编辑
|
@@ -13,6 +13,8 @@ var _form = _interopRequireDefault(require("@alifd/next/lib/form"));
|
|
13
13
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
15
15
|
|
16
|
+
var _edgeTypeStyleUtil = require("../../../../utils/edgeTypeStyleUtil");
|
17
|
+
|
16
18
|
var _EdgeTypeModule = _interopRequireDefault(require("./EdgeType.module.scss"));
|
17
19
|
|
18
20
|
var _LineType = _interopRequireDefault(require("./LineType"));
|
@@ -77,43 +79,60 @@ var LINE_MOLD_OPTIONS = [{
|
|
77
79
|
icon: 'topo_lineMold_dotted_two'
|
78
80
|
}];
|
79
81
|
|
80
|
-
function
|
82
|
+
function getValuesByEdges(topo) {
|
83
|
+
function getStartPoint(edge) {
|
84
|
+
var icons = edge.s('icons') || {};
|
85
|
+
return ['sourceArrow', 'sourceSolidCircle', 'sourceNoneCircle'].filter(function (name) {
|
86
|
+
return icons[name];
|
87
|
+
})[0] || 'nil';
|
88
|
+
}
|
89
|
+
|
90
|
+
function getEndPoint(edge) {
|
91
|
+
var icons = edge.s('icons') || {};
|
92
|
+
return ['targetArrow', 'targetSolidCircle', 'targetNoneCircle'].filter(function (name) {
|
93
|
+
return icons[name];
|
94
|
+
})[0] || 'nil';
|
95
|
+
}
|
96
|
+
|
97
|
+
var selectionEdges = (0, _edgeTypeStyleUtil.getEdgesBySelection)(topo);
|
98
|
+
var edgeValues = [];
|
99
|
+
(0, _edgeTypeStyleUtil.loopEdgesAndChildren)(topo, selectionEdges, function (edge) {
|
100
|
+
edgeValues.push({
|
101
|
+
lineButton: edge.s('edge.type'),
|
102
|
+
startPoint: getStartPoint(edge),
|
103
|
+
endPoint: getEndPoint(edge),
|
104
|
+
lineMold: edge.a('lineMode') || 'solidLine'
|
105
|
+
});
|
106
|
+
});
|
81
107
|
var values = {
|
108
|
+
lineButton: undefined,
|
82
109
|
startPoint: undefined,
|
83
110
|
endPoint: undefined,
|
84
111
|
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
|
-
}
|
112
|
+
};
|
113
|
+
Object.keys(values).forEach(function (name) {
|
114
|
+
var vals = edgeValues.map(function (item) {
|
115
|
+
return item[name];
|
99
116
|
});
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
}
|
104
|
-
});
|
105
|
-
}
|
117
|
+
var isSame = vals.filter(function (val) {
|
118
|
+
return val === vals[0];
|
119
|
+
}).length === vals.length;
|
106
120
|
|
121
|
+
if (isSame) {
|
122
|
+
values[name] = vals[0];
|
123
|
+
}
|
124
|
+
});
|
107
125
|
return values;
|
108
126
|
}
|
109
127
|
|
110
128
|
function EdgeType(props) {
|
111
|
-
var
|
129
|
+
var topo = props.topo,
|
130
|
+
selection = props.selection,
|
112
131
|
_onChange = props.onChange;
|
113
132
|
|
114
133
|
var field = _field["default"].useField({
|
115
134
|
autoUnmount: false,
|
116
|
-
values:
|
135
|
+
values: getValuesByEdges(topo),
|
117
136
|
onChange: function onChange(name, value) {
|
118
137
|
if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
|
119
138
|
_onChange(name, null);
|
@@ -124,7 +143,7 @@ function EdgeType(props) {
|
|
124
143
|
});
|
125
144
|
|
126
145
|
(0, _react.useEffect)(function () {
|
127
|
-
field.setValues(
|
146
|
+
field.setValues(getValuesByEdges(topo));
|
128
147
|
}, [selection]);
|
129
148
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
130
149
|
className: _EdgeTypeModule["default"].lineBox
|
@@ -11,6 +11,8 @@ var _balloon = _interopRequireDefault(require("@alifd/next/lib/balloon"));
|
|
11
11
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
13
13
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
15
|
+
|
14
16
|
var _LineTypeModule = _interopRequireDefault(require("./LineType.module.scss"));
|
15
17
|
|
16
18
|
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); }
|
@@ -41,11 +43,14 @@ var LINE_TYPE_OPTIONS = [{
|
|
41
43
|
}];
|
42
44
|
|
43
45
|
var LineType = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
44
|
-
var
|
46
|
+
var value = props.value,
|
47
|
+
onChange = props.onChange;
|
45
48
|
|
46
49
|
function lineButton(item) {
|
50
|
+
var _classNames;
|
51
|
+
|
47
52
|
return /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
48
|
-
className: ""
|
53
|
+
className: (0, _classnames["default"])(_LineTypeModule["default"].redioBtn, (_classNames = {}, _classNames[_LineTypeModule["default"].selected] = value === item.value, _classNames)),
|
49
54
|
onClick: function onClick() {
|
50
55
|
onChange(item.value);
|
51
56
|
}
|
@@ -67,5 +72,6 @@ var LineType = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
67
72
|
}));
|
68
73
|
});
|
69
74
|
|
75
|
+
LineType.displayName = 'LineType';
|
70
76
|
var _default = LineType;
|
71
77
|
exports["default"] = _default;
|
@@ -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.5" === 'string' ? "8.0.0-a.5" : 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.5",
|
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.5/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|