@antv/g6 5.0.0-alpha.8 → 5.0.0-alpha.9
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/dist/g6.min.js +6 -19
- package/esm/index.d.ts +26 -6
- package/esm/item/combo.d.ts +72 -2
- package/esm/item/combo.js +122 -2
- package/esm/item/combo.js.map +1 -1
- package/esm/item/edge.d.ts +3 -3
- package/esm/item/edge.js +4 -5
- package/esm/item/edge.js.map +1 -1
- package/esm/item/item.d.ts +4 -4
- package/esm/item/item.js +38 -9
- package/esm/item/item.js.map +1 -1
- package/esm/item/node.d.ts +20 -16
- package/esm/item/node.js +14 -8
- package/esm/item/node.js.map +1 -1
- package/esm/runtime/controller/data.d.ts +12 -4
- package/esm/runtime/controller/data.js +354 -62
- package/esm/runtime/controller/data.js.map +1 -1
- package/esm/runtime/controller/interaction.js +16 -4
- package/esm/runtime/controller/interaction.js.map +1 -1
- package/esm/runtime/controller/item.d.ts +11 -2
- package/esm/runtime/controller/item.js +344 -52
- package/esm/runtime/controller/item.js.map +1 -1
- package/esm/runtime/controller/layout.js +19 -5
- package/esm/runtime/controller/layout.js.map +1 -1
- package/esm/runtime/graph.d.ts +54 -17
- package/esm/runtime/graph.js +165 -34
- package/esm/runtime/graph.js.map +1 -1
- package/esm/stdlib/behavior/click-select.d.ts +3 -0
- package/esm/stdlib/behavior/click-select.js +13 -1
- package/esm/stdlib/behavior/click-select.js.map +1 -1
- package/esm/stdlib/behavior/collapse-expand-combo.d.ts +29 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js +35 -0
- package/esm/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- package/esm/stdlib/behavior/drag-combo.d.ts +99 -0
- package/esm/stdlib/behavior/drag-combo.js +341 -0
- package/esm/stdlib/behavior/drag-combo.js.map +1 -0
- package/esm/stdlib/behavior/drag-node.d.ts +14 -10
- package/esm/stdlib/behavior/drag-node.js +134 -37
- package/esm/stdlib/behavior/drag-node.js.map +1 -1
- package/esm/stdlib/behavior/hover-activate.d.ts +3 -1
- package/esm/stdlib/behavior/hover-activate.js +3 -1
- package/esm/stdlib/behavior/hover-activate.js.map +1 -1
- package/esm/stdlib/behavior/orbit-canvas-3d.js +1 -1
- package/esm/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/esm/stdlib/behavior/track-canvas-3d.js +1 -1
- package/esm/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/esm/stdlib/index.d.ts +25 -3
- package/esm/stdlib/index.js +25 -3
- package/esm/stdlib/index.js.map +1 -1
- package/esm/stdlib/item/combo/circle.d.ts +29 -0
- package/esm/stdlib/item/combo/circle.js +56 -0
- package/esm/stdlib/item/combo/circle.js.map +1 -0
- package/esm/stdlib/item/edge/base.d.ts +2 -2
- package/esm/stdlib/item/edge/base.js +3 -0
- package/esm/stdlib/item/edge/base.js.map +1 -1
- package/esm/stdlib/item/edge/cubic-horizon.d.ts +37 -0
- package/esm/stdlib/item/edge/cubic-horizon.js +71 -0
- package/esm/stdlib/item/edge/cubic-horizon.js.map +1 -0
- package/esm/stdlib/item/edge/cubic-vertical.d.ts +37 -0
- package/esm/stdlib/item/edge/cubic-vertical.js +71 -0
- package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/esm/stdlib/item/edge/cubic.d.ts +60 -0
- package/esm/stdlib/item/edge/cubic.js +99 -0
- package/esm/stdlib/item/edge/cubic.js.map +1 -0
- package/esm/stdlib/item/edge/index.d.ts +1 -0
- package/esm/stdlib/item/edge/index.js +1 -0
- package/esm/stdlib/item/edge/index.js.map +1 -1
- package/esm/stdlib/item/edge/line.d.ts +1 -1
- package/esm/stdlib/item/edge/quadratic.d.ts +41 -0
- package/esm/stdlib/item/edge/quadratic.js +66 -0
- package/esm/stdlib/item/edge/quadratic.js.map +1 -0
- package/esm/stdlib/item/node/base.d.ts +38 -37
- package/esm/stdlib/item/node/base.js +4 -4
- package/esm/stdlib/item/node/base.js.map +1 -1
- package/esm/stdlib/item/node/index.d.ts +1 -0
- package/esm/stdlib/item/node/index.js +1 -0
- package/esm/stdlib/item/node/index.js.map +1 -1
- package/esm/stdlib/item/node/rect.d.ts +31 -0
- package/esm/stdlib/item/node/rect.js +59 -0
- package/esm/stdlib/item/node/rect.js.map +1 -0
- package/esm/stdlib/plugin/fisheye/index.d.ts +102 -0
- package/esm/stdlib/plugin/fisheye/index.js +487 -0
- package/esm/stdlib/plugin/fisheye/index.js.map +1 -0
- package/esm/stdlib/plugin/menu/index.d.ts +42 -0
- package/esm/stdlib/plugin/menu/index.js +236 -0
- package/esm/stdlib/plugin/menu/index.js.map +1 -0
- package/esm/stdlib/plugin/tooltip/index.d.ts +75 -0
- package/esm/stdlib/plugin/tooltip/index.js +377 -0
- package/esm/stdlib/plugin/tooltip/index.js.map +1 -0
- package/esm/stdlib/theme/dark.js +4 -0
- package/esm/stdlib/theme/dark.js.map +1 -1
- package/esm/stdlib/theme/light.js +54 -9
- package/esm/stdlib/theme/light.js.map +1 -1
- package/esm/types/combo.d.ts +52 -3
- package/esm/types/data.d.ts +4 -4
- package/esm/types/edge.d.ts +2 -3
- package/esm/types/event.d.ts +9 -1
- package/esm/types/event.js +8 -8
- package/esm/types/event.js.map +1 -1
- package/esm/types/graph.d.ts +49 -13
- package/esm/types/hook.d.ts +8 -1
- package/esm/types/item.d.ts +4 -4
- package/esm/types/node.d.ts +4 -5
- package/esm/types/theme.d.ts +1 -1
- package/esm/util/animate.js.map +1 -1
- package/esm/util/canvas.js +8 -0
- package/esm/util/canvas.js.map +1 -1
- package/esm/util/data.d.ts +65 -0
- package/esm/util/data.js +150 -0
- package/esm/util/data.js.map +1 -0
- package/esm/util/event.d.ts +8 -0
- package/esm/util/event.js +16 -0
- package/esm/util/event.js.map +1 -1
- package/esm/util/item.d.ts +2 -1
- package/esm/util/item.js +36 -13
- package/esm/util/item.js.map +1 -1
- package/esm/util/shape.d.ts +39 -4
- package/esm/util/shape.js +101 -1
- package/esm/util/shape.js.map +1 -1
- package/esm/util/zoom.d.ts +2 -2
- package/lib/index.d.ts +26 -6
- package/lib/item/combo.d.ts +72 -2
- package/lib/item/combo.js +122 -2
- package/lib/item/combo.js.map +1 -1
- package/lib/item/edge.d.ts +3 -3
- package/lib/item/edge.js +4 -5
- package/lib/item/edge.js.map +1 -1
- package/lib/item/item.d.ts +4 -4
- package/lib/item/item.js +37 -8
- package/lib/item/item.js.map +1 -1
- package/lib/item/node.d.ts +20 -16
- package/lib/item/node.js +14 -8
- package/lib/item/node.js.map +1 -1
- package/lib/runtime/controller/data.d.ts +12 -4
- package/lib/runtime/controller/data.js +353 -61
- package/lib/runtime/controller/data.js.map +1 -1
- package/lib/runtime/controller/interaction.js +15 -3
- package/lib/runtime/controller/interaction.js.map +1 -1
- package/lib/runtime/controller/item.d.ts +11 -2
- package/lib/runtime/controller/item.js +342 -50
- package/lib/runtime/controller/item.js.map +1 -1
- package/lib/runtime/controller/layout.js +19 -5
- package/lib/runtime/controller/layout.js.map +1 -1
- package/lib/runtime/graph.d.ts +54 -17
- package/lib/runtime/graph.js +165 -34
- package/lib/runtime/graph.js.map +1 -1
- package/lib/stdlib/behavior/click-select.d.ts +3 -0
- package/lib/stdlib/behavior/click-select.js +13 -1
- package/lib/stdlib/behavior/click-select.js.map +1 -1
- package/lib/stdlib/behavior/collapse-expand-combo.d.ts +29 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js +38 -0
- package/lib/stdlib/behavior/collapse-expand-combo.js.map +1 -0
- package/lib/stdlib/behavior/drag-combo.d.ts +99 -0
- package/lib/stdlib/behavior/drag-combo.js +344 -0
- package/lib/stdlib/behavior/drag-combo.js.map +1 -0
- package/lib/stdlib/behavior/drag-node.d.ts +14 -10
- package/lib/stdlib/behavior/drag-node.js +134 -37
- package/lib/stdlib/behavior/drag-node.js.map +1 -1
- package/lib/stdlib/behavior/hover-activate.d.ts +3 -1
- package/lib/stdlib/behavior/hover-activate.js +3 -2
- package/lib/stdlib/behavior/hover-activate.js.map +1 -1
- package/lib/stdlib/behavior/orbit-canvas-3d.js +1 -1
- package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
- package/lib/stdlib/behavior/track-canvas-3d.js +1 -1
- package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -1
- package/lib/stdlib/index.d.ts +25 -3
- package/lib/stdlib/index.js +25 -3
- package/lib/stdlib/index.js.map +1 -1
- package/lib/stdlib/item/combo/circle.d.ts +29 -0
- package/lib/stdlib/item/combo/circle.js +60 -0
- package/lib/stdlib/item/combo/circle.js.map +1 -0
- package/lib/stdlib/item/edge/base.d.ts +2 -2
- package/lib/stdlib/item/edge/base.js +3 -0
- package/lib/stdlib/item/edge/base.js.map +1 -1
- package/lib/stdlib/item/edge/cubic-horizon.d.ts +37 -0
- package/lib/stdlib/item/edge/cubic-horizon.js +75 -0
- package/lib/stdlib/item/edge/cubic-horizon.js.map +1 -0
- package/lib/stdlib/item/edge/cubic-vertical.d.ts +37 -0
- package/lib/stdlib/item/edge/cubic-vertical.js +75 -0
- package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -0
- package/lib/stdlib/item/edge/cubic.d.ts +60 -0
- package/lib/stdlib/item/edge/cubic.js +103 -0
- package/lib/stdlib/item/edge/cubic.js.map +1 -0
- package/lib/stdlib/item/edge/index.d.ts +1 -0
- package/lib/stdlib/item/edge/index.js +1 -0
- package/lib/stdlib/item/edge/index.js.map +1 -1
- package/lib/stdlib/item/edge/line.d.ts +1 -1
- package/lib/stdlib/item/edge/quadratic.d.ts +41 -0
- package/lib/stdlib/item/edge/quadratic.js +70 -0
- package/lib/stdlib/item/edge/quadratic.js.map +1 -0
- package/lib/stdlib/item/node/base.d.ts +38 -37
- package/lib/stdlib/item/node/base.js +4 -4
- package/lib/stdlib/item/node/base.js.map +1 -1
- package/lib/stdlib/item/node/index.d.ts +1 -0
- package/lib/stdlib/item/node/index.js +1 -0
- package/lib/stdlib/item/node/index.js.map +1 -1
- package/lib/stdlib/item/node/rect.d.ts +31 -0
- package/lib/stdlib/item/node/rect.js +63 -0
- package/lib/stdlib/item/node/rect.js.map +1 -0
- package/lib/stdlib/plugin/fisheye/index.d.ts +102 -0
- package/lib/stdlib/plugin/fisheye/index.js +490 -0
- package/lib/stdlib/plugin/fisheye/index.js.map +1 -0
- package/lib/stdlib/plugin/menu/index.d.ts +42 -0
- package/lib/stdlib/plugin/menu/index.js +242 -0
- package/lib/stdlib/plugin/menu/index.js.map +1 -0
- package/lib/stdlib/plugin/tooltip/index.d.ts +75 -0
- package/lib/stdlib/plugin/tooltip/index.js +383 -0
- package/lib/stdlib/plugin/tooltip/index.js.map +1 -0
- package/lib/stdlib/theme/dark.js +4 -0
- package/lib/stdlib/theme/dark.js.map +1 -1
- package/lib/stdlib/theme/light.js +54 -9
- package/lib/stdlib/theme/light.js.map +1 -1
- package/lib/types/combo.d.ts +52 -3
- package/lib/types/data.d.ts +4 -4
- package/lib/types/edge.d.ts +2 -3
- package/lib/types/event.d.ts +9 -1
- package/lib/types/event.js +10 -10
- package/lib/types/event.js.map +1 -1
- package/lib/types/graph.d.ts +49 -13
- package/lib/types/hook.d.ts +8 -1
- package/lib/types/item.d.ts +4 -4
- package/lib/types/item.js +1 -1
- package/lib/types/item.js.map +1 -1
- package/lib/types/node.d.ts +4 -5
- package/lib/types/theme.d.ts +1 -1
- package/lib/util/animate.js.map +1 -1
- package/lib/util/canvas.js +8 -0
- package/lib/util/canvas.js.map +1 -1
- package/lib/util/data.d.ts +65 -0
- package/lib/util/data.js +161 -0
- package/lib/util/data.js.map +1 -0
- package/lib/util/event.d.ts +8 -0
- package/lib/util/event.js +18 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/item.d.ts +2 -1
- package/lib/util/item.js +36 -13
- package/lib/util/item.js.map +1 -1
- package/lib/util/shape.d.ts +39 -4
- package/lib/util/shape.js +105 -2
- package/lib/util/shape.js.map +1 -1
- package/lib/util/zoom.d.ts +2 -2
- package/package.json +13 -13
- package/src/item/combo.ts +220 -2
- package/src/item/edge.ts +7 -8
- package/src/item/item.ts +58 -15
- package/src/item/node.ts +47 -24
- package/src/runtime/controller/data.ts +390 -68
- package/src/runtime/controller/interaction.ts +23 -3
- package/src/runtime/controller/item.ts +444 -64
- package/src/runtime/controller/layout.ts +24 -5
- package/src/runtime/graph.ts +225 -38
- package/src/stdlib/behavior/click-select.ts +15 -2
- package/src/stdlib/behavior/collapse-expand-combo.ts +59 -0
- package/src/stdlib/behavior/drag-combo.ts +533 -0
- package/src/stdlib/behavior/drag-node.ts +195 -62
- package/src/stdlib/behavior/hover-activate.ts +4 -5
- package/src/stdlib/behavior/orbit-canvas-3d.ts +1 -1
- package/src/stdlib/behavior/track-canvas-3d.ts +1 -1
- package/src/stdlib/index.ts +25 -3
- package/src/stdlib/item/combo/circle.ts +113 -0
- package/src/stdlib/item/edge/base.ts +5 -2
- package/src/stdlib/item/edge/cubic-horizon.ts +114 -0
- package/src/stdlib/item/edge/cubic-vertical.ts +116 -0
- package/src/stdlib/item/edge/cubic.ts +198 -0
- package/src/stdlib/item/edge/index.ts +1 -0
- package/src/stdlib/item/edge/quadratic.ts +136 -0
- package/src/stdlib/item/node/base.ts +79 -41
- package/src/stdlib/item/node/index.ts +1 -0
- package/src/stdlib/item/node/rect.ts +124 -0
- package/src/stdlib/plugin/fisheye/index.ts +578 -0
- package/src/stdlib/plugin/menu/index.ts +260 -0
- package/src/stdlib/plugin/tooltip/index.ts +424 -0
- package/src/stdlib/theme/dark.ts +4 -0
- package/src/stdlib/theme/light.ts +77 -9
- package/src/types/combo.ts +61 -3
- package/src/types/data.ts +6 -4
- package/src/types/edge.ts +2 -2
- package/src/types/event.ts +8 -8
- package/src/types/graph.ts +73 -16
- package/src/types/hook.ts +8 -1
- package/src/types/item.ts +10 -9
- package/src/types/node.ts +4 -4
- package/src/types/theme.ts +1 -1
- package/src/util/animate.ts +2 -3
- package/src/util/canvas.ts +10 -0
- package/src/util/data.ts +178 -0
- package/src/util/event.ts +29 -0
- package/src/util/item.ts +75 -12
- package/src/util/shape.ts +142 -5
- package/src/util/zoom.ts +2 -2
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.DataController = void 0;
|
|
4
15
|
const graphlib_1 = require("@antv/graphlib");
|
|
5
16
|
const util_1 = require("@antv/util");
|
|
6
17
|
const stdlib_1 = require("../../stdlib");
|
|
7
18
|
const extension_1 = require("../../util/extension");
|
|
19
|
+
const data_1 = require("../../util/data");
|
|
8
20
|
/**
|
|
9
21
|
* Manages the data transform extensions;
|
|
10
22
|
* Storages user data and inner data.
|
|
@@ -25,12 +37,25 @@ class DataController {
|
|
|
25
37
|
const ids = conditionIsArray ? condition : [condition];
|
|
26
38
|
switch (type) {
|
|
27
39
|
case 'node':
|
|
28
|
-
return ids.map((id) =>
|
|
40
|
+
return ids.map((id) => {
|
|
41
|
+
if (!graphCore.hasNode(id))
|
|
42
|
+
return undefined;
|
|
43
|
+
const model = graphCore.getNode(id);
|
|
44
|
+
if (model.data._isCombo)
|
|
45
|
+
return undefined;
|
|
46
|
+
return model;
|
|
47
|
+
});
|
|
29
48
|
case 'edge':
|
|
30
49
|
return ids.map((id) => graphCore.hasEdge(id) ? graphCore.getEdge(id) : undefined);
|
|
31
50
|
case 'combo':
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
return ids.map((id) => {
|
|
52
|
+
if (!graphCore.hasNode(id))
|
|
53
|
+
return undefined;
|
|
54
|
+
const model = graphCore.getNode(id);
|
|
55
|
+
if (!model.data._isCombo)
|
|
56
|
+
return undefined;
|
|
57
|
+
return model;
|
|
58
|
+
});
|
|
34
59
|
}
|
|
35
60
|
}
|
|
36
61
|
else if (conditionType === 'function') {
|
|
@@ -56,16 +81,21 @@ class DataController {
|
|
|
56
81
|
return [];
|
|
57
82
|
}
|
|
58
83
|
}
|
|
59
|
-
|
|
84
|
+
findRelatedEdges(nodeId, direction = 'both') {
|
|
60
85
|
return this.graphCore.getRelatedEdges(nodeId, direction);
|
|
61
86
|
}
|
|
62
|
-
|
|
87
|
+
findNeighborNodes(nodeId, direction = 'both') {
|
|
63
88
|
if (direction === 'in')
|
|
64
89
|
return this.graphCore.getAncestors(nodeId);
|
|
65
90
|
if (direction === 'out')
|
|
66
91
|
return this.graphCore.getSuccessors(nodeId);
|
|
67
92
|
return this.graphCore.getNeighbors(nodeId);
|
|
68
93
|
}
|
|
94
|
+
findChildren(comboId, treeKey) {
|
|
95
|
+
if (!this.graphCore.hasNode(comboId))
|
|
96
|
+
return;
|
|
97
|
+
return this.graphCore.getChildren(comboId, treeKey);
|
|
98
|
+
}
|
|
69
99
|
/**
|
|
70
100
|
* Subscribe the lifecycle of graph.
|
|
71
101
|
*/
|
|
@@ -99,6 +129,12 @@ class DataController {
|
|
|
99
129
|
case 'update':
|
|
100
130
|
this.updateData(data);
|
|
101
131
|
break;
|
|
132
|
+
case 'moveCombo':
|
|
133
|
+
this.moveCombo(data);
|
|
134
|
+
break;
|
|
135
|
+
case 'addCombo':
|
|
136
|
+
this.addCombo(data);
|
|
137
|
+
break;
|
|
102
138
|
default:
|
|
103
139
|
// 'replace' | 'mergeReplace' | 'union'
|
|
104
140
|
this.changeData(data, changeType);
|
|
@@ -119,49 +155,98 @@ class DataController {
|
|
|
119
155
|
* @param changeType type of data change, 'replace' means discard the old data. 'mergeReplace' means merge the common part. 'union' means merge whole sets of old and new one
|
|
120
156
|
*/
|
|
121
157
|
changeData(data, changeType) {
|
|
158
|
+
var _a;
|
|
122
159
|
const { userGraphCore } = this;
|
|
123
160
|
if (changeType === 'replace') {
|
|
124
|
-
this.userGraphCore = new graphlib_1.Graph(
|
|
161
|
+
this.userGraphCore = new graphlib_1.Graph({
|
|
162
|
+
nodes: data.nodes.concat(((_a = data.combos) === null || _a === void 0 ? void 0 : _a.map((combo) => ({
|
|
163
|
+
id: combo.id,
|
|
164
|
+
data: Object.assign(Object.assign({}, combo.data), { _isCombo: true }),
|
|
165
|
+
}))) || []),
|
|
166
|
+
edges: data.edges,
|
|
167
|
+
onChanged: (event) => this.updateGraphCore(event),
|
|
168
|
+
});
|
|
125
169
|
const { data: transformedData } = this.transformData();
|
|
126
|
-
|
|
170
|
+
const { nodes = [], edges = [], combos = [] } = transformedData;
|
|
171
|
+
this.graphCore = new graphlib_1.Graph({
|
|
172
|
+
nodes: nodes.concat((combos === null || combos === void 0 ? void 0 : combos.map((combo) => ({
|
|
173
|
+
id: combo.id,
|
|
174
|
+
data: Object.assign(Object.assign({}, combo.data), { _isCombo: true }),
|
|
175
|
+
}))) || []),
|
|
176
|
+
edges,
|
|
177
|
+
});
|
|
178
|
+
if (combos === null || combos === void 0 ? void 0 : combos.length) {
|
|
179
|
+
this.comboTreeView = new graphlib_1.GraphView({
|
|
180
|
+
graph: this.graphCore,
|
|
181
|
+
cache: 'manual',
|
|
182
|
+
});
|
|
183
|
+
this.graphCore.attachTreeStructure('combo');
|
|
184
|
+
nodes.forEach((node) => {
|
|
185
|
+
if (node.data.parentId) {
|
|
186
|
+
if ((0, data_1.validateComboStrucutre)(this.graph, node.id, node.data.parentId)) {
|
|
187
|
+
this.graphCore.setParent(node.id, node.data.parentId, 'combo');
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
this.graphCore.mergeNodeData(node.id, { parentId: undefined });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
combos.forEach((combo) => {
|
|
195
|
+
if (combo.data.parentId) {
|
|
196
|
+
if ((0, data_1.validateComboStrucutre)(this.graph, combo.id, combo.data.parentId)) {
|
|
197
|
+
this.graphCore.setParent(combo.id, combo.data.parentId, 'combo');
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
this.graphCore.mergeNodeData(combo.id, { parentId: undefined });
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
127
205
|
}
|
|
128
206
|
else {
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
207
|
+
const prevData = (0, data_1.deconstructData)({
|
|
208
|
+
nodes: userGraphCore.getAllNodes(),
|
|
209
|
+
edges: userGraphCore.getAllEdges(),
|
|
210
|
+
});
|
|
211
|
+
const { nodes = [], edges = [], combos = [] } = data;
|
|
212
|
+
const nodesAndCombos = nodes.concat(combos.map((combo) => ({
|
|
213
|
+
id: combo.id,
|
|
214
|
+
data: Object.assign(Object.assign({}, combo.data), { _isCombo: true }),
|
|
215
|
+
})));
|
|
216
|
+
// =========== node & combos ============
|
|
217
|
+
if (!prevData.nodes.length) {
|
|
218
|
+
userGraphCore.addNodes(nodesAndCombos);
|
|
134
219
|
}
|
|
135
220
|
else {
|
|
136
221
|
if (changeType === 'mergeReplace') {
|
|
137
222
|
// remove the nodes which are not in data but in userGraphCore
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
if (!
|
|
223
|
+
const nodeAndComboIds = nodesAndCombos.map((node) => node.id);
|
|
224
|
+
prevData.nodes.forEach((prevNode) => {
|
|
225
|
+
if (!nodeAndComboIds.includes(prevNode.id))
|
|
141
226
|
userGraphCore.removeNode(prevNode.id);
|
|
142
227
|
});
|
|
143
228
|
}
|
|
144
229
|
// add or update node
|
|
145
|
-
|
|
146
|
-
if (userGraphCore.hasNode(
|
|
230
|
+
nodesAndCombos.forEach((item) => {
|
|
231
|
+
if (userGraphCore.hasNode(item.id)) {
|
|
147
232
|
// update node which is in the graphCore
|
|
148
|
-
userGraphCore.mergeNodeData(
|
|
233
|
+
userGraphCore.mergeNodeData(item.id, item.data);
|
|
149
234
|
}
|
|
150
235
|
else {
|
|
151
236
|
// add node which is in data but not in graphCore
|
|
152
|
-
userGraphCore.addNode(
|
|
237
|
+
userGraphCore.addNode(item);
|
|
153
238
|
}
|
|
154
239
|
});
|
|
155
240
|
}
|
|
156
|
-
|
|
157
|
-
if (!
|
|
241
|
+
// =========== edge ============
|
|
242
|
+
if (!prevData.edges.length) {
|
|
158
243
|
userGraphCore.addEdges(edges);
|
|
159
244
|
}
|
|
160
245
|
else {
|
|
161
246
|
if (changeType === 'mergeReplace') {
|
|
162
247
|
// remove the edges which are not in data but in userGraphCore
|
|
163
248
|
const edgeIds = edges.map((edge) => edge.id);
|
|
164
|
-
|
|
249
|
+
prevData.edges.forEach((prevEdge) => {
|
|
165
250
|
if (!edgeIds.includes(prevEdge.id))
|
|
166
251
|
userGraphCore.removeEdge(prevEdge.id);
|
|
167
252
|
});
|
|
@@ -186,19 +271,28 @@ class DataController {
|
|
|
186
271
|
*/
|
|
187
272
|
removeData(data) {
|
|
188
273
|
const { userGraphCore } = this;
|
|
189
|
-
const { nodes, edges, combos } = data;
|
|
190
|
-
const
|
|
274
|
+
const { nodes = [], edges = [], combos = [] } = data;
|
|
275
|
+
const nodesAndCombos = nodes.concat(combos);
|
|
276
|
+
const prevNodesAndCombos = userGraphCore.getAllNodes();
|
|
191
277
|
const prevEdges = userGraphCore.getAllEdges();
|
|
192
|
-
|
|
193
|
-
|
|
278
|
+
if (prevNodesAndCombos.length && nodesAndCombos.length) {
|
|
279
|
+
// update the parentId
|
|
280
|
+
nodesAndCombos.forEach((item) => {
|
|
281
|
+
const { parentId } = item.data;
|
|
282
|
+
this.graphCore.getChildren(item.id, 'combo').forEach((child) => {
|
|
283
|
+
userGraphCore.mergeNodeData(child.id, { parentId });
|
|
284
|
+
});
|
|
285
|
+
});
|
|
194
286
|
// remove the node
|
|
195
|
-
userGraphCore.removeNodes(
|
|
287
|
+
userGraphCore.removeNodes(nodesAndCombos.map((node) => node.id));
|
|
196
288
|
}
|
|
197
289
|
if (prevEdges.length && edges.length) {
|
|
198
290
|
// add or update edge
|
|
199
|
-
|
|
291
|
+
const ids = edges
|
|
292
|
+
.map((edge) => edge.id)
|
|
293
|
+
.filter((id) => userGraphCore.hasEdge(id));
|
|
294
|
+
userGraphCore.removeEdges(ids);
|
|
200
295
|
}
|
|
201
|
-
// TODO: combo
|
|
202
296
|
}
|
|
203
297
|
/**
|
|
204
298
|
* Update part of old data.
|
|
@@ -206,10 +300,11 @@ class DataController {
|
|
|
206
300
|
*/
|
|
207
301
|
updateData(data) {
|
|
208
302
|
const { userGraphCore } = this;
|
|
209
|
-
const { nodes, edges, combos } = data;
|
|
210
|
-
const prevNodes =
|
|
211
|
-
|
|
212
|
-
|
|
303
|
+
const { nodes = [], edges = [], combos = [] } = data;
|
|
304
|
+
const { nodes: prevNodes, edges: prevEdges, combos: prevCombos, } = (0, data_1.deconstructData)({
|
|
305
|
+
nodes: userGraphCore.getAllNodes(),
|
|
306
|
+
edges: userGraphCore.getAllEdges(),
|
|
307
|
+
});
|
|
213
308
|
if (prevNodes.length) {
|
|
214
309
|
// update node
|
|
215
310
|
nodes.forEach((newModel) => {
|
|
@@ -237,7 +332,135 @@ class DataController {
|
|
|
237
332
|
}
|
|
238
333
|
});
|
|
239
334
|
}
|
|
240
|
-
|
|
335
|
+
if (prevCombos.length) {
|
|
336
|
+
// update combos
|
|
337
|
+
const modelsToMove = [];
|
|
338
|
+
combos.forEach((newModel) => {
|
|
339
|
+
const { id, data } = newModel;
|
|
340
|
+
const { x: comboNewX, y: comboNewY } = data, others = __rest(data, ["x", "y"]);
|
|
341
|
+
if (comboNewX !== undefined || comboNewY !== undefined) {
|
|
342
|
+
if (this.graphCore.getChildren(id, 'combo').length) {
|
|
343
|
+
// combo's position is updated, update the succeed nodes' positions
|
|
344
|
+
const oldBounds = this.graph.getRenderBBox(id, true);
|
|
345
|
+
if (!oldBounds)
|
|
346
|
+
return;
|
|
347
|
+
const [comboOldX, comboOldY] = oldBounds.center;
|
|
348
|
+
const dx = comboNewX - comboOldX;
|
|
349
|
+
const dy = comboNewY - comboOldY;
|
|
350
|
+
(0, data_1.graphComboTreeDfs)(this.graph, [newModel], (succeed) => {
|
|
351
|
+
const { x, y, _isCombo } = succeed.data;
|
|
352
|
+
if (!_isCombo) {
|
|
353
|
+
modelsToMove.push({
|
|
354
|
+
id: succeed.id,
|
|
355
|
+
data: {
|
|
356
|
+
x: x + dx,
|
|
357
|
+
y: y + dy,
|
|
358
|
+
},
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}, 'BT');
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
// empty combo, modify the position directly
|
|
365
|
+
modelsToMove.push({
|
|
366
|
+
id,
|
|
367
|
+
data: {
|
|
368
|
+
x: comboNewX,
|
|
369
|
+
y: comboNewY,
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// update other properties
|
|
375
|
+
if (Object.keys(others).length) {
|
|
376
|
+
const mergedData = mergeOneLevelData(userGraphCore.getNode(id), {
|
|
377
|
+
id,
|
|
378
|
+
data: others,
|
|
379
|
+
});
|
|
380
|
+
userGraphCore.mergeNodeData(id, mergedData);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
// update succeed nodes
|
|
384
|
+
modelsToMove.forEach((newModel) => {
|
|
385
|
+
const { id, data } = newModel;
|
|
386
|
+
userGraphCore.mergeNodeData(id, data);
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Relatively move the position of combo a dinstance (dx and dy in combo data).
|
|
392
|
+
* @param data graph data which contains the combo dx dy info
|
|
393
|
+
*/
|
|
394
|
+
moveCombo(data) {
|
|
395
|
+
const { combos = [] } = data;
|
|
396
|
+
const succeedNodesModels = [];
|
|
397
|
+
combos.forEach((newModel) => {
|
|
398
|
+
const { dx = 0, dy = 0 } = newModel.data;
|
|
399
|
+
if (!dx && !dy)
|
|
400
|
+
return;
|
|
401
|
+
if (this.graphCore.getChildren(newModel.id, 'combo').length) {
|
|
402
|
+
// combo's position is updated, update the succeed nodes' positions
|
|
403
|
+
(0, data_1.graphComboTreeDfs)(this.graph, [newModel], (succeed) => {
|
|
404
|
+
const { x, y, _isCombo } = succeed.data;
|
|
405
|
+
if (!_isCombo ||
|
|
406
|
+
!this.graphCore.getChildren(succeed.id, 'combo').length) {
|
|
407
|
+
succeedNodesModels.push({
|
|
408
|
+
id: succeed.id,
|
|
409
|
+
data: {
|
|
410
|
+
x: x + dx,
|
|
411
|
+
y: y + dy,
|
|
412
|
+
},
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
}, 'BT');
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
// empty combo, move it directly
|
|
419
|
+
const comboModel = this.graphCore.getNode(newModel.id);
|
|
420
|
+
const { x = 0, y = 0 } = comboModel.data;
|
|
421
|
+
succeedNodesModels.push({
|
|
422
|
+
id: newModel.id,
|
|
423
|
+
data: {
|
|
424
|
+
x: x + dx,
|
|
425
|
+
y: y + dy,
|
|
426
|
+
},
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
// update succeed nodes
|
|
431
|
+
const { userGraphCore } = this;
|
|
432
|
+
succeedNodesModels.forEach((newModel) => {
|
|
433
|
+
const { id, data } = newModel;
|
|
434
|
+
if (data) {
|
|
435
|
+
const mergedData = mergeOneLevelData(userGraphCore.getNode(id), newModel);
|
|
436
|
+
userGraphCore.mergeNodeData(id, mergedData);
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
addCombo(data) {
|
|
441
|
+
const { combos = [] } = data;
|
|
442
|
+
if (!(combos === null || combos === void 0 ? void 0 : combos.length))
|
|
443
|
+
return;
|
|
444
|
+
const { userGraphCore } = this;
|
|
445
|
+
const { id, data: comboData } = combos[0];
|
|
446
|
+
const { _children = [] } = comboData, others = __rest(comboData, ["_children"]);
|
|
447
|
+
// add or update combo
|
|
448
|
+
if (userGraphCore.hasNode(id)) {
|
|
449
|
+
// update node which is in the graphCore
|
|
450
|
+
userGraphCore.mergeNodeData(id, Object.assign(Object.assign({}, others), { _isCombo: true }));
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
// add node which is in data but not in graphCore
|
|
454
|
+
userGraphCore.addNode({ id, data: Object.assign(Object.assign({}, others), { _isCombo: true }) });
|
|
455
|
+
}
|
|
456
|
+
// update strucutre
|
|
457
|
+
_children.forEach((childId) => {
|
|
458
|
+
if (!this.graphCore.hasNode(childId)) {
|
|
459
|
+
console.warn(`Adding child ${childId} to combo ${id} failed. The child ${childId} does not exist`);
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
userGraphCore.mergeNodeData(childId, { parentId: id });
|
|
463
|
+
});
|
|
241
464
|
}
|
|
242
465
|
/**
|
|
243
466
|
* Update graphCore with transformed userGraphCore data.
|
|
@@ -247,11 +470,11 @@ class DataController {
|
|
|
247
470
|
// === step 1: clone data from userGraphCore (userData) ===
|
|
248
471
|
// === step 2: transform the data with transform extensions, output innerData and idMaps ===
|
|
249
472
|
const { data: transformedData, idMaps } = this.transformData();
|
|
250
|
-
const { nodes, edges, combos } = transformedData;
|
|
251
|
-
const
|
|
473
|
+
const { nodes = [], edges = [], combos = [] } = transformedData;
|
|
474
|
+
const prevNodesAndCombos = graphCore.getAllNodes();
|
|
252
475
|
// function to update one data in graphCore with different model type ('node' or 'edge')
|
|
253
|
-
const syncUpdateToGraphCore = (id, newValue, oldValue,
|
|
254
|
-
if (
|
|
476
|
+
const syncUpdateToGraphCore = (id, newValue, oldValue, isNodeOrCombo, diff = []) => {
|
|
477
|
+
if (isNodeOrCombo) {
|
|
255
478
|
if (newValue.data)
|
|
256
479
|
graphCore.updateNodeData(id, newValue.data);
|
|
257
480
|
}
|
|
@@ -264,26 +487,69 @@ class DataController {
|
|
|
264
487
|
if (diff.includes('target'))
|
|
265
488
|
graphCore.updateEdgeTarget(id, newValue.target);
|
|
266
489
|
}
|
|
267
|
-
// TODO: combo
|
|
268
490
|
};
|
|
269
491
|
graphCore.batch(() => {
|
|
492
|
+
var _a;
|
|
270
493
|
// === step 3: sync to graphCore according to the changes in userGraphCore ==
|
|
271
494
|
if (!(idMaps === null || idMaps === void 0 ? void 0 : idMaps.length) || idMaps.length !== this.extensions.length) {
|
|
272
495
|
// situation 1: not every extension has corresponding idMap, use default mapping: suppose id is not changed by transforms
|
|
273
496
|
// and diff the value in graphCore whose id is not in userGraphCore
|
|
274
497
|
const newModelMap = {};
|
|
275
|
-
|
|
498
|
+
const parentMap = {};
|
|
499
|
+
const changeMap = {};
|
|
500
|
+
event.changes.forEach((change) => {
|
|
501
|
+
const { value, id } = change;
|
|
502
|
+
changeMap[id || value.id] = true;
|
|
503
|
+
});
|
|
504
|
+
nodes.forEach((model) => {
|
|
505
|
+
newModelMap[model.id] = { type: 'node', model };
|
|
506
|
+
if (model.data.hasOwnProperty('parentId')) {
|
|
507
|
+
parentMap[model.id] = {
|
|
508
|
+
new: model.data.parentId,
|
|
509
|
+
old: undefined,
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
});
|
|
276
513
|
edges.forEach((model) => (newModelMap[model.id] = { type: 'edge', model }));
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
514
|
+
combos.forEach((model) => {
|
|
515
|
+
newModelMap[model.id] = { type: 'combo', model };
|
|
516
|
+
if (model.data.hasOwnProperty('parentId')) {
|
|
517
|
+
parentMap[model.id] = {
|
|
518
|
+
new: model.data.parentId,
|
|
519
|
+
old: undefined,
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
prevNodesAndCombos.forEach((prevModel) => {
|
|
524
|
+
var _a, _b, _c;
|
|
525
|
+
const { id } = prevModel;
|
|
526
|
+
if (((_a = parentMap[id]) === null || _a === void 0 ? void 0 : _a.new) !== undefined ||
|
|
527
|
+
prevModel.data.parentId !== undefined) {
|
|
528
|
+
parentMap[id] = {
|
|
529
|
+
new: (_b = parentMap[id]) === null || _b === void 0 ? void 0 : _b.new,
|
|
530
|
+
old: prevModel.data.parentId,
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
delete parentMap[id];
|
|
535
|
+
}
|
|
280
536
|
const { model: newModel } = newModelMap[id] || {};
|
|
281
537
|
// remove
|
|
282
|
-
if (!newModel)
|
|
538
|
+
if (!newModel) {
|
|
539
|
+
if (prevModel.data._isCombo) {
|
|
540
|
+
graphCore.getChildren(id, 'combo').forEach((child) => {
|
|
541
|
+
parentMap[child.id] = Object.assign(Object.assign({}, parentMap[child.id]), { new: prevModel.data.parentId });
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
if (prevModel.data.parentId) {
|
|
545
|
+
graphCore.setParent(id, undefined, 'combo');
|
|
546
|
+
}
|
|
283
547
|
graphCore.removeNode(id);
|
|
548
|
+
delete parentMap[prevModel.id];
|
|
549
|
+
}
|
|
284
550
|
// update
|
|
285
|
-
else if ((
|
|
286
|
-
syncUpdateToGraphCore(id, newModel,
|
|
551
|
+
else if (((_c = diffAt(newModel, prevModel, true)) === null || _c === void 0 ? void 0 : _c.length) || changeMap[id])
|
|
552
|
+
syncUpdateToGraphCore(id, newModel, prevModel, true);
|
|
287
553
|
// delete from the map indicates this model is visited
|
|
288
554
|
delete newModelMap[id];
|
|
289
555
|
});
|
|
@@ -304,11 +570,21 @@ class DataController {
|
|
|
304
570
|
});
|
|
305
571
|
// add
|
|
306
572
|
Object.values(newModelMap).forEach(({ type, model }) => {
|
|
307
|
-
if (type === 'node')
|
|
573
|
+
if (type === 'node' || type === 'combo')
|
|
308
574
|
graphCore.addNode(model);
|
|
309
575
|
else if (type === 'edge')
|
|
310
576
|
graphCore.addEdge(model);
|
|
311
|
-
|
|
577
|
+
});
|
|
578
|
+
// update parents after adding all items
|
|
579
|
+
Object.keys(parentMap).forEach((id) => {
|
|
580
|
+
if (parentMap[id].new === parentMap[id].old)
|
|
581
|
+
return;
|
|
582
|
+
if (!(0, data_1.validateComboStrucutre)(this.graph, id, parentMap[id].new)) {
|
|
583
|
+
graphCore.mergeNodeData(id, { parentId: parentMap[id].old });
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
graphCore.mergeNodeData(id, { parentId: parentMap[id].new });
|
|
587
|
+
graphCore.setParent(id, parentMap[id].new, 'combo');
|
|
312
588
|
});
|
|
313
589
|
}
|
|
314
590
|
else {
|
|
@@ -317,14 +593,16 @@ class DataController {
|
|
|
317
593
|
const finalIdMap = {};
|
|
318
594
|
const newModelMap = {};
|
|
319
595
|
const prevModelMap = {};
|
|
320
|
-
nodes
|
|
596
|
+
nodes
|
|
597
|
+
.concat(edges)
|
|
598
|
+
.concat(combos)
|
|
599
|
+
.forEach((model) => {
|
|
321
600
|
finalIdMap[model.id] = getComesFromLinkedList(model.id, idMaps);
|
|
322
601
|
newModelMap[model.id] = model;
|
|
323
602
|
});
|
|
324
|
-
|
|
603
|
+
prevNodesAndCombos.concat(graphCore.getAllEdges()).forEach((model) => {
|
|
325
604
|
prevModelMap[model.id] = model;
|
|
326
605
|
});
|
|
327
|
-
// TODO: combo
|
|
328
606
|
// map changes for search
|
|
329
607
|
const changeMap = {};
|
|
330
608
|
const { changes } = event;
|
|
@@ -348,13 +626,15 @@ class DataController {
|
|
|
348
626
|
const comesFromIds = finalIdMap[newId];
|
|
349
627
|
const newValue = newModelMap[newId];
|
|
350
628
|
const oldValue = prevModelMap[newId];
|
|
351
|
-
const
|
|
629
|
+
const isNodeOrCombo = graphCore.hasNode(newId);
|
|
352
630
|
if (newValue && !oldValue) {
|
|
353
|
-
const addFunc =
|
|
631
|
+
const addFunc = isNodeOrCombo
|
|
632
|
+
? graphCore.addNode
|
|
633
|
+
: graphCore.addEdge;
|
|
354
634
|
addFunc(newValue);
|
|
355
635
|
}
|
|
356
636
|
else if (!newValue && oldValue) {
|
|
357
|
-
const removeFunc =
|
|
637
|
+
const removeFunc = isNodeOrCombo
|
|
358
638
|
? graphCore.removeNode
|
|
359
639
|
: graphCore.removeEdge;
|
|
360
640
|
removeFunc(newId);
|
|
@@ -362,19 +642,31 @@ class DataController {
|
|
|
362
642
|
else {
|
|
363
643
|
if (!(comesFromIds === null || comesFromIds === void 0 ? void 0 : comesFromIds.length)) {
|
|
364
644
|
// no comesForm, find same id in userGraphCore to follow the change, if it not found, diff new and old data value of graphCore (inner data)
|
|
365
|
-
const diff = diffAt(newValue, oldValue,
|
|
645
|
+
const diff = diffAt(newValue, oldValue, isNodeOrCombo);
|
|
366
646
|
if (diff === null || diff === void 0 ? void 0 : diff.length)
|
|
367
|
-
syncUpdateToGraphCore(newId, newValue, oldValue,
|
|
647
|
+
syncUpdateToGraphCore(newId, newValue, oldValue, isNodeOrCombo, diff);
|
|
368
648
|
}
|
|
369
649
|
else {
|
|
370
650
|
// follow the corresponding data event in userGraphCore
|
|
371
651
|
const comesFromChanges = changeMap[comesFromIds[0]];
|
|
372
652
|
if (comesFromChanges === null || comesFromChanges === void 0 ? void 0 : comesFromChanges.length)
|
|
373
|
-
syncUpdateToGraphCore(newId, newValue, oldValue,
|
|
653
|
+
syncUpdateToGraphCore(newId, newValue, oldValue, isNodeOrCombo);
|
|
374
654
|
}
|
|
375
655
|
}
|
|
376
656
|
});
|
|
657
|
+
// update parents after updating all items
|
|
658
|
+
graphCore.getAllNodes().forEach((node) => {
|
|
659
|
+
if (!(0, data_1.validateComboStrucutre)(this.graph, node.id, node.data.parentId)) {
|
|
660
|
+
// restore if the new parent is invalid
|
|
661
|
+
graphCore.mergeNodeData(node.id, {
|
|
662
|
+
parentId: prevModelMap[node.id].data.parentId,
|
|
663
|
+
});
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
graphCore.setParent(node.id, node.data.parentId, 'combo');
|
|
667
|
+
});
|
|
377
668
|
}
|
|
669
|
+
(_a = this.comboTreeView) === null || _a === void 0 ? void 0 : _a.refreshCache();
|
|
378
670
|
});
|
|
379
671
|
}
|
|
380
672
|
/**
|
|
@@ -384,12 +676,10 @@ class DataController {
|
|
|
384
676
|
transformData() {
|
|
385
677
|
const { userGraphCore } = this;
|
|
386
678
|
// === step 1: clone data from userGraphCore (userData) ===
|
|
387
|
-
const userData = {
|
|
388
|
-
// TODO: should be deepClone
|
|
679
|
+
const userData = (0, data_1.deconstructData)({
|
|
389
680
|
nodes: userGraphCore.getAllNodes(),
|
|
390
681
|
edges: userGraphCore.getAllEdges(),
|
|
391
|
-
|
|
392
|
-
};
|
|
682
|
+
});
|
|
393
683
|
let dataCloned = (0, util_1.clone)(userData);
|
|
394
684
|
// === step 2: transform the data with transform extensions, output innerData and idMaps ===
|
|
395
685
|
const idMaps = [];
|
|
@@ -461,6 +751,8 @@ const diffAt = (newModel, oldModel, isNode) => {
|
|
|
461
751
|
else
|
|
462
752
|
continue;
|
|
463
753
|
}
|
|
754
|
+
if (isNaN(newValue) && isNaN(oldValue))
|
|
755
|
+
continue;
|
|
464
756
|
if (newValue !== oldValue)
|
|
465
757
|
return diff.concat('data');
|
|
466
758
|
}
|