ronds-metadata 1.2.87 → 1.2.89
Sign up to get free protection for your applications and to get access to all the features.
@@ -55,6 +55,7 @@ declare class DPGraph extends GraphCore<BaseNode, BaseEdge> {
|
|
55
55
|
}): void;
|
56
56
|
onContextMenu(data: ContextMenuInfo): any;
|
57
57
|
clearContextMenuInfo: () => void;
|
58
|
+
clearGraphCells: () => void;
|
58
59
|
onMoveNodes(movedNodes: any[]): Promise<void>;
|
59
60
|
dispose(): void;
|
60
61
|
}
|
@@ -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-
|
16
|
+
* @LastEditTime: 2023-07-28 09:01:28
|
17
17
|
*/
|
18
18
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
19
19
|
import produce from 'immer';
|
@@ -195,24 +195,35 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
195
195
|
// 画布已经渲染的情况下,再次渲染图数据
|
196
196
|
_this.renderGraphData = /*#__PURE__*/function () {
|
197
197
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(graphData) {
|
198
|
-
var
|
198
|
+
var _formatGraphData2, nodes, edges, dpNodes, dpEdges;
|
199
199
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
200
200
|
while (1) switch (_context.prev = _context.next) {
|
201
201
|
case 0:
|
202
202
|
// 清除已有的图谱
|
203
|
-
oldGraph =
|
204
|
-
|
205
|
-
|
206
|
-
|
203
|
+
// const oldGraph = this.factory$.dpGraph.getValue();
|
204
|
+
// console.log('清除已有的图谱', oldGraph);
|
205
|
+
// this.deleteNodes(
|
206
|
+
// oldGraph.nodes.map((it) => {
|
207
|
+
// return it.id;
|
208
|
+
// }),
|
209
|
+
// );
|
210
|
+
_this.clearGraphCells;
|
207
211
|
_formatGraphData2 = formatGraphData(graphData), nodes = _formatGraphData2.nodes, edges = _formatGraphData2.edges;
|
208
|
-
nodes.
|
209
|
-
return
|
210
|
-
|
211
|
-
|
212
|
-
|
212
|
+
dpNodes = nodes.map(function (it) {
|
213
|
+
return new DPNode(_objectSpread(_objectSpread({}, it), {}, {
|
214
|
+
shape: 'dp-rect-port',
|
215
|
+
component: /*#__PURE__*/React.createElement(NodeElement, null)
|
216
|
+
}));
|
213
217
|
});
|
218
|
+
dpEdges = edges.map(function (it) {
|
219
|
+
return new DPEdge(it);
|
220
|
+
}); // nodes!.forEach((nodeMeta) => this.renderNode(nodeMeta));
|
221
|
+
// edges!.forEach((edgeMeta) => this.renderEdge(edgeMeta));
|
222
|
+
_this.graph.addNodes(dpNodes);
|
223
|
+
_this.graph.addEdges(dpEdges);
|
224
|
+
_this.zoomGraphToFit();
|
214
225
|
_this.loadDPGraph(graphData);
|
215
|
-
case
|
226
|
+
case 8:
|
216
227
|
case "end":
|
217
228
|
return _context.stop();
|
218
229
|
}
|
@@ -254,6 +265,9 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
254
265
|
_this.clearContextMenuInfo = function () {
|
255
266
|
_this.factory$.contextMenuInfo.next(null);
|
256
267
|
};
|
268
|
+
_this.clearGraphCells = function () {
|
269
|
+
_this.graph.clearCells();
|
270
|
+
};
|
257
271
|
_this.initialize(_graphData);
|
258
272
|
return _this;
|
259
273
|
}
|
@@ -6,7 +6,7 @@ var _excluded = ["wrapper", "container", "nodes", "edges"];
|
|
6
6
|
/*
|
7
7
|
* @Author: wangxian
|
8
8
|
* @Date: 2022-05-24 13:55:44
|
9
|
-
* @LastEditTime: 2023-07-
|
9
|
+
* @LastEditTime: 2023-07-28 08:14:22
|
10
10
|
*/
|
11
11
|
import { Graph } from '@antv/x6';
|
12
12
|
import { debounceTime, fromEventPattern, map, merge, scan, tap } from 'rxjs';
|
@@ -329,6 +329,7 @@ export var GraphCore = /*#__PURE__*/function () {
|
|
329
329
|
}, {
|
330
330
|
key: "render",
|
331
331
|
value: function render(params) {
|
332
|
+
var _this3 = this;
|
332
333
|
this.setMeta(params);
|
333
334
|
if (this.isMetaValid) {
|
334
335
|
var wrapper = this.wrapper,
|
@@ -342,10 +343,14 @@ export var GraphCore = /*#__PURE__*/function () {
|
|
342
343
|
height: height
|
343
344
|
}));
|
344
345
|
this.graph = graph;
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
346
|
+
nodeMetas.forEach(function (nodeMeta) {
|
347
|
+
return _this3.renderNode(nodeMeta);
|
348
|
+
});
|
349
|
+
edgeMetas.forEach(function (edgeMeta) {
|
350
|
+
return _this3.renderEdge(edgeMeta);
|
351
|
+
});
|
352
|
+
// this.graph!.addNodes(nodeMetas);
|
353
|
+
// this.graph!.addEdges(edgeMetas);
|
349
354
|
this.afterLayout();
|
350
355
|
if (graph.isFrozen()) {
|
351
356
|
graph.unfreeze();
|