ronds-metadata 1.2.79 → 1.2.80
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/es/comps/DynamicPorts/comps/shape/edge.js +1 -1
- package/es/comps/DynamicPorts/graph.js +15 -6
- package/es/comps/DynamicPorts/index.less +18 -0
- package/es/comps/DynamicPorts/interface.d.ts +2 -0
- package/es/comps/DynamicPorts/interface.js +1 -1
- package/es/comps/DynamicPorts/utils.d.ts +9 -0
- package/es/comps/DynamicPorts/utils.js +19 -9
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
/*
|
|
6
6
|
* @Author: wangxian
|
|
7
7
|
* @Date: 2022-05-24 09:18:34
|
|
8
|
-
* @LastEditTime:
|
|
8
|
+
* @LastEditTime: 2023-07-03 16:20:13
|
|
9
9
|
*/
|
|
10
10
|
import { Shape, Edge } from '@antv/x6';
|
|
11
11
|
import './edge.less';
|
|
@@ -13,7 +13,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
|
13
13
|
/*
|
|
14
14
|
* @Author: wangxian
|
|
15
15
|
* @Date: 2022-05-24 14:31:01
|
|
16
|
-
* @LastEditTime: 2023-07-03
|
|
16
|
+
* @LastEditTime: 2023-07-03 16:49:09
|
|
17
17
|
*/
|
|
18
18
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
19
19
|
import produce from 'immer';
|
|
@@ -156,7 +156,10 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
156
156
|
title: port.name,
|
|
157
157
|
placement: placement
|
|
158
158
|
}, /*#__PURE__*/React.createElement("span", {
|
|
159
|
-
className: "dp-port ".concat(port.connected ? 'connected' : '')
|
|
159
|
+
className: "dp-port ".concat(port.connected ? 'connected' : ''),
|
|
160
|
+
style: port.color && {
|
|
161
|
+
borderColor: "".concat(port.connected ? "".concat(port.color, " transparent transparent") : port.color)
|
|
162
|
+
}
|
|
160
163
|
})), container);
|
|
161
164
|
}
|
|
162
165
|
}
|
|
@@ -201,7 +204,6 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
201
204
|
_this.deleteNodes(oldGraph.nodes.map(function (it) {
|
|
202
205
|
return it.id;
|
|
203
206
|
}));
|
|
204
|
-
_this.onDeleteEdges(oldGraph.edges);
|
|
205
207
|
_formatGraphData2 = formatGraphData(graphData), nodes = _formatGraphData2.nodes, edges = _formatGraphData2.edges;
|
|
206
208
|
nodes.forEach(function (nodeMeta) {
|
|
207
209
|
return _this.renderNode(nodeMeta);
|
|
@@ -210,7 +212,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
210
212
|
return _this.renderEdge(edgeMeta);
|
|
211
213
|
});
|
|
212
214
|
_this.loadDPGraph(graphData);
|
|
213
|
-
case
|
|
215
|
+
case 6:
|
|
214
216
|
case "end":
|
|
215
217
|
return _context.stop();
|
|
216
218
|
}
|
|
@@ -437,7 +439,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
437
439
|
value: // 处理连线事件
|
|
438
440
|
function () {
|
|
439
441
|
var _onConnectNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(args) {
|
|
440
|
-
var _args$edge, edge, isNew, source, target, node, portId, data;
|
|
442
|
+
var _args$edge, edge, isNew, source, target, _edge$getTargetCell, _edge$getTargetCell$p, _ports$find, node, portId, ports, color, data;
|
|
441
443
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
442
444
|
while (1) switch (_context6.prev = _context6.next) {
|
|
443
445
|
case 0:
|
|
@@ -447,6 +449,10 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
447
449
|
// 处理边虚线样式更新的问题。
|
|
448
450
|
node = args.currentCell;
|
|
449
451
|
portId = edge.getTargetPortId();
|
|
452
|
+
ports = ((_edge$getTargetCell = edge.getTargetCell()) === null || _edge$getTargetCell === void 0 ? void 0 : (_edge$getTargetCell$p = _edge$getTargetCell.port) === null || _edge$getTargetCell$p === void 0 ? void 0 : _edge$getTargetCell$p.ports) || [];
|
|
453
|
+
color = (_ports$find = ports.find(function (v) {
|
|
454
|
+
return v.id === portId;
|
|
455
|
+
})) === null || _ports$find === void 0 ? void 0 : _ports$find.color;
|
|
450
456
|
if (node && portId) {
|
|
451
457
|
// 触发 port 重新渲染
|
|
452
458
|
node.setPortProp(portId, 'connected', true);
|
|
@@ -455,7 +461,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
455
461
|
line: {
|
|
456
462
|
strokeDasharray: '',
|
|
457
463
|
targetMarker: '',
|
|
458
|
-
stroke: '#808080'
|
|
464
|
+
stroke: color || '#808080'
|
|
459
465
|
}
|
|
460
466
|
});
|
|
461
467
|
data = {
|
|
@@ -464,6 +470,9 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
464
470
|
outPortId: source.port,
|
|
465
471
|
inPortId: target.port
|
|
466
472
|
};
|
|
473
|
+
if (color) {
|
|
474
|
+
data.color = color;
|
|
475
|
+
}
|
|
467
476
|
edge.setData(data);
|
|
468
477
|
this.updateDPGraph([], [data]);
|
|
469
478
|
}
|
|
@@ -195,4 +195,22 @@
|
|
|
195
195
|
z-index: 10;
|
|
196
196
|
box-sizing: border-box;
|
|
197
197
|
}
|
|
198
|
+
|
|
199
|
+
.error {
|
|
200
|
+
stroke-width: 2px;
|
|
201
|
+
path:nth-child(2) {
|
|
202
|
+
stroke: rgba(245, 34, 45, 0.45) !important;
|
|
203
|
+
stroke-width: 2px;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
.edgeProcessing {
|
|
207
|
+
path:nth-child(2) {
|
|
208
|
+
stroke: rgba(57, 202, 116, 0.8);
|
|
209
|
+
stroke-width: 2px;
|
|
210
|
+
stroke-dasharray: 8px, 2px;
|
|
211
|
+
&:local {
|
|
212
|
+
animation: processing-line 30s infinite linear;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
198
216
|
}
|
|
@@ -46,6 +46,7 @@ export declare namespace NDPGraph {
|
|
|
46
46
|
target: string;
|
|
47
47
|
outPortId: string;
|
|
48
48
|
inPortId: string;
|
|
49
|
+
color?: string;
|
|
49
50
|
}
|
|
50
51
|
interface OutPort extends Port {
|
|
51
52
|
}
|
|
@@ -54,6 +55,7 @@ export declare namespace NDPGraph {
|
|
|
54
55
|
interface Port {
|
|
55
56
|
id: string;
|
|
56
57
|
name: string;
|
|
58
|
+
color?: string;
|
|
57
59
|
seq: number;
|
|
58
60
|
type: number | string;
|
|
59
61
|
}
|
|
@@ -80,6 +80,7 @@ export declare function formatGraphData(graphData: NDPGraph.GraphData): {
|
|
|
80
80
|
target: string;
|
|
81
81
|
outPortId: string;
|
|
82
82
|
inPortId: string;
|
|
83
|
+
color?: string;
|
|
83
84
|
};
|
|
84
85
|
sourceAnchor: string;
|
|
85
86
|
source: {
|
|
@@ -98,7 +99,15 @@ export declare function formatGraphData(graphData: NDPGraph.GraphData): {
|
|
|
98
99
|
};
|
|
99
100
|
label: string;
|
|
100
101
|
zIndex: number;
|
|
102
|
+
attrs: {
|
|
103
|
+
line: {
|
|
104
|
+
strokeDasharray: string;
|
|
105
|
+
targetMarker: string;
|
|
106
|
+
stroke: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
101
109
|
outPortId: string;
|
|
102
110
|
inPortId: string;
|
|
111
|
+
color?: string;
|
|
103
112
|
}[];
|
|
104
113
|
};
|
|
@@ -3,7 +3,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
3
3
|
/*
|
|
4
4
|
* @Author: wangxian
|
|
5
5
|
* @Date: 2022-05-24 16:40:49
|
|
6
|
-
* @LastEditTime: 2023-07-03
|
|
6
|
+
* @LastEditTime: 2023-07-03 16:31:06
|
|
7
7
|
*/
|
|
8
8
|
import { sortBy } from 'lodash-es';
|
|
9
9
|
import { NODE_HEIGHT, NODE_WIDTH } from './constant';
|
|
@@ -40,6 +40,7 @@ export function formatNodeInfoToNodeMeta(nodeData) {
|
|
|
40
40
|
outPorts = nodeData.outPorts;
|
|
41
41
|
sortBy(inPorts, 'seq').forEach(function (inPort) {
|
|
42
42
|
portItems.push(_objectSpread(_objectSpread({}, inPort), {}, {
|
|
43
|
+
color: inPort === null || inPort === void 0 ? void 0 : inPort.color,
|
|
43
44
|
group: 'in',
|
|
44
45
|
id: inPort.id.toString(),
|
|
45
46
|
connected: !!inputPortConnectedMap["".concat(id.toString()).concat(inPort.id.toString())]
|
|
@@ -47,6 +48,7 @@ export function formatNodeInfoToNodeMeta(nodeData) {
|
|
|
47
48
|
});
|
|
48
49
|
sortBy(outPorts, 'seq').forEach(function (outPort) {
|
|
49
50
|
portItems.push(_objectSpread(_objectSpread({}, outPort), {}, {
|
|
51
|
+
color: outPort === null || outPort === void 0 ? void 0 : outPort.color,
|
|
50
52
|
group: 'out',
|
|
51
53
|
id: outPort.id.toString(),
|
|
52
54
|
connected: !!inputPortConnectedMap["".concat(id.toString()).concat(outPort.id.toString())]
|
|
@@ -81,13 +83,14 @@ export function formatGraphData(graphData) {
|
|
|
81
83
|
_graphData$edges = graphData.edges,
|
|
82
84
|
edges = _graphData$edges === void 0 ? [] : _graphData$edges;
|
|
83
85
|
// 格式化边
|
|
84
|
-
var formattedEdges = edges.map(function (
|
|
85
|
-
var source =
|
|
86
|
-
outPortId =
|
|
87
|
-
target =
|
|
88
|
-
inPortId =
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
var formattedEdges = edges.map(function (edge) {
|
|
87
|
+
var source = edge.source,
|
|
88
|
+
outPortId = edge.outPortId,
|
|
89
|
+
target = edge.target,
|
|
90
|
+
inPortId = edge.inPortId,
|
|
91
|
+
color = edge.color;
|
|
92
|
+
return _objectSpread(_objectSpread({}, edge), {}, {
|
|
93
|
+
data: _objectSpread({}, edge),
|
|
91
94
|
sourceAnchor: 'bottom',
|
|
92
95
|
source: {
|
|
93
96
|
cell: source.toString(),
|
|
@@ -104,7 +107,14 @@ export function formatGraphData(graphData) {
|
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
109
|
label: '',
|
|
107
|
-
zIndex: 1
|
|
110
|
+
zIndex: 1,
|
|
111
|
+
attrs: {
|
|
112
|
+
line: {
|
|
113
|
+
strokeDasharray: '',
|
|
114
|
+
targetMarker: '',
|
|
115
|
+
stroke: color || '#808080'
|
|
116
|
+
}
|
|
117
|
+
}
|
|
108
118
|
});
|
|
109
119
|
});
|
|
110
120
|
// 记录所有已连线的输入桩
|