react-graph-grid 0.1.4 → 0.1.6

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.
Files changed (88) hide show
  1. package/README.md +4 -0
  2. package/{src/css → dist}/default.css +2 -1
  3. package/dist/index.esm.js +21 -0
  4. package/dist/index.js +56 -0
  5. package/dist/index10.esm.js +3844 -0
  6. package/dist/index10.js +3848 -0
  7. package/dist/index11.esm.js +4121 -0
  8. package/dist/index11.js +4125 -0
  9. package/dist/index12.esm.js +5238 -0
  10. package/dist/index12.js +5242 -0
  11. package/dist/index13.esm.js +5466 -0
  12. package/dist/index13.js +5470 -0
  13. package/dist/index14.esm.js +22 -0
  14. package/dist/index14.js +26 -0
  15. package/dist/index15.esm.js +402 -0
  16. package/dist/index15.js +403 -0
  17. package/dist/index16.esm.js +507 -0
  18. package/dist/index16.js +507 -0
  19. package/dist/index17.esm.js +256 -0
  20. package/dist/index17.js +257 -0
  21. package/dist/index18.esm.js +261 -0
  22. package/dist/index18.js +263 -0
  23. package/dist/index19.esm.js +623 -0
  24. package/dist/index19.js +624 -0
  25. package/dist/index2.esm.js +6 -0
  26. package/dist/index2.js +2 -0
  27. package/dist/index20.esm.js +219 -0
  28. package/dist/index20.js +220 -0
  29. package/dist/index21.esm.js +298 -0
  30. package/dist/index21.js +299 -0
  31. package/dist/index22.esm.js +662 -0
  32. package/dist/index22.js +663 -0
  33. package/dist/index23.esm.js +340 -0
  34. package/dist/index23.js +341 -0
  35. package/dist/index24.esm.js +269 -0
  36. package/dist/index24.js +270 -0
  37. package/dist/index25.esm.js +600 -0
  38. package/dist/index25.js +601 -0
  39. package/dist/index26.esm.js +245 -0
  40. package/dist/index26.js +246 -0
  41. package/dist/index27.esm.js +136 -0
  42. package/dist/index27.js +137 -0
  43. package/dist/index28.esm.js +70 -0
  44. package/dist/index28.js +70 -0
  45. package/dist/index29.esm.js +748 -0
  46. package/dist/index29.js +748 -0
  47. package/dist/index30.esm.js +363 -0
  48. package/dist/index30.js +363 -0
  49. package/dist/index4.esm.js +27 -0
  50. package/dist/index4.js +27 -0
  51. package/dist/index5.esm.js +35 -0
  52. package/dist/index5.js +39 -0
  53. package/dist/index6.esm.js +200 -0
  54. package/dist/index6.js +204 -0
  55. package/dist/index7.esm.js +9 -0
  56. package/dist/index7.js +13 -0
  57. package/dist/index8.esm.js +65 -0
  58. package/dist/index8.js +68 -0
  59. package/dist/index9.esm.js +102 -0
  60. package/dist/index9.js +103 -0
  61. package/package.json +6 -3
  62. package/eslint.config.js +0 -29
  63. package/index.html +0 -13
  64. package/index.js +0 -19
  65. package/npm.aps +0 -0
  66. package/src/Base.jsx +0 -81
  67. package/src/Card.jsx +0 -333
  68. package/src/Dropdown.jsx +0 -339
  69. package/src/FieldEdit.jsx +0 -376
  70. package/src/Graph.jsx +0 -482
  71. package/src/Grid.jsx +0 -887
  72. package/src/GridCD.jsx +0 -180
  73. package/src/GridDB.jsx +0 -897
  74. package/src/GridFE.jsx +0 -753
  75. package/src/GridFL.jsx +0 -468
  76. package/src/GridGR.jsx +0 -311
  77. package/src/GridPK.jsx +0 -414
  78. package/src/Modal.jsx +0 -511
  79. package/src/Overlay.jsx +0 -140
  80. package/src/Tests/DebugApp.jsx +0 -334
  81. package/src/Tests/TestData.jsx +0 -251
  82. package/src/Themes/DefaultGridTheme.jsx +0 -36
  83. package/src/Themes/Images.jsx +0 -438
  84. package/src/Themes/Translate.jsx +0 -76
  85. package/src/css/default_.css +0 -945
  86. package/src/main.jsx +0 -10
  87. package/vite.config.js +0 -14
  88. /package/{public → dist}/IM.svg +0 -0
@@ -0,0 +1,261 @@
1
+ var GraphClass = class {
2
+ constructor() {
3
+ const graph = this;
4
+ graph.nodesDict = {};
5
+ graph.linksDict = {};
6
+ graph.waveCache = {};
7
+ graph.nodeCount = 0;
8
+ graph.lastWaveInd = 0;
9
+ graph.lastWaveInds = {};
10
+ }
11
+ getWaveUid(e) {
12
+ const arr = [
13
+ e.waveType,
14
+ e.withStartNodes,
15
+ e.markVisited,
16
+ e.allParentsVisited,
17
+ e.moveType
18
+ ];
19
+ for (let node of e.nodes) arr.push(node.id);
20
+ return arr.join("_");
21
+ }
22
+ visitNodesByWave(e) {
23
+ const graph = this;
24
+ if (!e || !e.list || e.list.length <= 0) return;
25
+ if (e.waveType === graph.lastWaveType && e.waveInd < graph.lastWaveInd) return;
26
+ while (e.list.length) {
27
+ const nodeUid = e.list.shift();
28
+ let node = graph.nodesDict[nodeUid];
29
+ if (node.skipOnWaveVisit && node.skipOnWaveVisit(e)) continue;
30
+ if (e.markVisited) node.visited = true;
31
+ if (node.visitByWave) node.visitByWave(e).then(() => {
32
+ graph.visitNodesByWave(e);
33
+ });
34
+ }
35
+ if (e.afterAllVisited) e.afterAllVisited();
36
+ }
37
+ skipLink(link, waveType) {
38
+ return false;
39
+ }
40
+ clearWaveVisits() {
41
+ const graph = this;
42
+ for (let uid in graph.nodesDict) graph.nodesDict[uid]._waveNum = -1;
43
+ }
44
+ allParentsVisited(node, e) {
45
+ const graph = this;
46
+ for (let pid of node.parents) {
47
+ let link = graph.linksDict[node.id + "_" + graph.nodesDict[pid].id];
48
+ if (link.parent._lastWaveInd > e.waveInd && !graph.skipLink(link, e.waveType)) return false;
49
+ }
50
+ return true;
51
+ }
52
+ addChildrenToWave(parents, e) {
53
+ const graph = this;
54
+ const dubl = {};
55
+ for (let node of e.nodes) dubl[node.uid] = 1;
56
+ for (let node of parents) {
57
+ node._lastWaveInd = e.waveInd;
58
+ dubl[node.uid] = 1;
59
+ for (let cid of node.children) if (!dubl[cid]) {
60
+ dubl[cid] = 1;
61
+ let chNode = graph.nodesDict[cid];
62
+ if (chNode._lastWaveInd == null || chNode._lastWaveInd < e.waveInd) e.nodes.push(chNode);
63
+ }
64
+ }
65
+ }
66
+ triggerWave(e) {
67
+ if (e == null || !e.nodes || e.nodes.length <= 0) return;
68
+ const graph = this;
69
+ if (e.prepared == null) {
70
+ if (e.waveType == null) {
71
+ e.waveType = WaveType.value;
72
+ e.allParentsVisited = true;
73
+ }
74
+ if (e.withStartNodes == null) e.withStartNodes = true;
75
+ if (e.moveType == null) e.moveType = MoveType.fromParent;
76
+ if (e.waveInd == null) e.waveInd = ++graph.lastWaveInd;
77
+ e.prepared = true;
78
+ }
79
+ graph._isMakingWave = true;
80
+ if (graph.lastWaveInds[e.waveType] != null && e.waveInd < graph.lastWaveInds[e.waveType]) return;
81
+ if (graph.lastWaveInds[e.waveType] == null || graph.lastWaveInds[e.waveType] < e.waveInd) graph.lastWaveInds[e.waveType] = e.waveInd;
82
+ if (!e.withStartNodes) {
83
+ const parents = [...e.nodes];
84
+ e.nodes = [];
85
+ graph.addChildrenToWave(parents, e);
86
+ e.withStartNodes = true;
87
+ }
88
+ if (graph.lastWaveInds[e.waveType] == e.waveInd && e.nodes.length <= 0) {
89
+ graph._isMakingWave = false;
90
+ if (e.afterAllVisited) e.afterAllVisited();
91
+ return;
92
+ }
93
+ let i = 0;
94
+ while (i < e.nodes.length) {
95
+ let node = e.nodes[i];
96
+ if (node._lastWaveInd == e.waveInd) {
97
+ i++;
98
+ continue;
99
+ }
100
+ if (node.skipOnWaveVisit && node.skipOnWaveVisit(e)) {
101
+ e.nodes.splice(i, 1);
102
+ continue;
103
+ }
104
+ if (e.allParentsVisited && !graph.allParentsVisited(node, e)) {
105
+ i++;
106
+ continue;
107
+ }
108
+ if (e.markVisited) node.visited = true;
109
+ node._lastWaveInd = e.waveInd;
110
+ if (node.visitByWave) {
111
+ i++;
112
+ node.visitByWave(e).then(() => {
113
+ graph.addChildrenToWave([node], e);
114
+ const index = e.nodes.indexOf(node);
115
+ if (index > -1) e.nodes.splice(index, 1);
116
+ graph.triggerWave(e);
117
+ if (graph.lastWaveInds[e.waveType] == e.waveInd && e.nodes.length <= 0) {
118
+ graph._isMakingWave = false;
119
+ if (e.afterAllVisited) e.afterAllVisited();
120
+ }
121
+ });
122
+ } else {
123
+ e.nodes.splice(i, 1);
124
+ if (graph.lastWaveInds[e.waveType] == e.waveInd && e.nodes.length <= 0) {
125
+ graph._isMakingWave = false;
126
+ if (e.afterAllVisited) e.afterAllVisited();
127
+ }
128
+ }
129
+ }
130
+ }
131
+ triggerWaveOld(e) {
132
+ e = e || {};
133
+ const graph = this;
134
+ if (graph._isMakingWave || !e.nodes || e.nodes.length <= 0) return;
135
+ if (e.waveType == null) e.waveType = WaveType.value;
136
+ if (e.withStartNodes == null) e.withStartNodes = true;
137
+ if (e.moveType == null) e.moveType = MoveType.fromParent;
138
+ e.list = [];
139
+ e.waveUid = graph.getWaveUid(e);
140
+ graph.lastWaveType = e.waveType;
141
+ e.waveInd = ++graph.lastWaveInd;
142
+ graph._isMakingWave = true;
143
+ let _cachedWave = graph.waveCache[e.waveUid];
144
+ if (!graph.noCachWave && _cachedWave) {
145
+ Object.assign(e.list, _cachedWave);
146
+ graph.visitNodesByWave(e);
147
+ graph._isMakingWave = false;
148
+ return;
149
+ }
150
+ _cachedWave = [];
151
+ let error;
152
+ try {
153
+ graph.clearWaveVisits();
154
+ let waveNum = 0;
155
+ for (let node of e.nodes) {
156
+ node._waveNum = waveNum;
157
+ if (e.withStartNodes) _cachedWave.push(node.uid);
158
+ }
159
+ let found = true;
160
+ let needAdd;
161
+ while (found && graph.nodeCount > waveNum) {
162
+ found = false;
163
+ waveNum++;
164
+ const currWaveNodes = [];
165
+ for (let uid in graph.nodesDict) {
166
+ let node = graph.nodesDict[uid];
167
+ if (node._waveNum >= 0) continue;
168
+ needAdd = false;
169
+ if (e.moveType !== MoveType.fromChild) for (let pid of node.parents) {
170
+ let link = graph.linksDict[node.id + "_" + graph.nodesDict[pid].id];
171
+ needAdd = link.parent._waveNum >= 0 && link.parent._waveNum < waveNum && !graph.skipLink(link, e.waveType);
172
+ if (!e.allParentsVisited && needAdd || e.allParentsVisited && !needAdd) break;
173
+ }
174
+ if ((!needAdd || e.allParentsVisited) && e.moveType !== MoveType.fromParent) for (let cid of node.children) {
175
+ let link = graph.linksDict[graph.nodesDict[cid].id + "_" + node.id];
176
+ needAdd = link.child._waveNum >= 0 && link.child._waveNum < waveNum && !graph.skipLink(link, e.waveType);
177
+ if (!e.allParentsVisited && needAdd || e.allParentsVisited && !needAdd) break;
178
+ }
179
+ if (needAdd) {
180
+ node._waveNum = waveNum;
181
+ currWaveNodes.push(node);
182
+ found = true;
183
+ }
184
+ }
185
+ if (!e.allParentsVisited) {
186
+ let added = false;
187
+ for (let i = currWaveNodes.length - 1; i >= 0; i--) {
188
+ let node = currWaveNodes[i];
189
+ if (e.moveType !== MoveType.fromChild && !graph.hasParentWithSameWave(node)) {
190
+ _cachedWave.push(node.uid);
191
+ currWaveNodes.splice(i, 1);
192
+ added = true;
193
+ } else if (e.moveType !== MoveType.fromParent && !graph.hasChildWithSameWave(node)) {
194
+ _cachedWave.push(node.uid);
195
+ currWaveNodes.splice(i, 1);
196
+ added = true;
197
+ }
198
+ }
199
+ for (let node of currWaveNodes) if (!added && node.inCycle) _cachedWave.push(node.uid);
200
+ else node._waveNum = -1;
201
+ } else if (currWaveNodes.length > 0) Array.prototype.push.apply(_cachedWave, currWaveNodes);
202
+ }
203
+ Object.assign(e.list, _cachedWave);
204
+ graph.visitNodesByWave(e);
205
+ } catch (x) {
206
+ error = true;
207
+ if (graph.debug) alert(x);
208
+ } finally {
209
+ graph.clearWaveVisits();
210
+ graph._isMakingWave = false;
211
+ if (!error) graph.waveCache[e.waveUid] = _cachedWave;
212
+ }
213
+ }
214
+ hasParentWithSameWave(node) {
215
+ const graph = this;
216
+ if (!node) return;
217
+ for (let pid of node.parents) if (graph.nodesDict[pid]._waveNum === node._waveNum) return true;
218
+ }
219
+ hasChildWithSameWave(node) {
220
+ const graph = this;
221
+ if (!node) return;
222
+ for (let lid of node.children) if (graph.nodesDict[lid]._waveNum === node._waveNum) return true;
223
+ }
224
+ markCycles() {
225
+ const graph = this;
226
+ const hasParents = function(node) {
227
+ for (let pid of node.parents) if (!graph.nodesDict[pid].excluded) return true;
228
+ };
229
+ const hasChildren = function(node) {
230
+ for (let lid in node.children) if (graph.nodesDict[lid].excluded) return true;
231
+ };
232
+ let changesDone = true;
233
+ while (changesDone) {
234
+ changesDone = false;
235
+ for (let uid in graph.nodesDict) {
236
+ let node = graph.nodesDict[uid];
237
+ if (node.excluded) continue;
238
+ if (!hasParents(node) || !hasChildren(node)) {
239
+ node.excluded = true;
240
+ changesDone = true;
241
+ }
242
+ }
243
+ }
244
+ for (let uid in graph.nodesDict) {
245
+ let node = graph.nodesDict[uid];
246
+ if (node.excluded) delete node.excluded;
247
+ else node.inCycle = true;
248
+ }
249
+ }
250
+ };
251
+ var WaveType = class {
252
+ static value = 0;
253
+ static refresh = 1;
254
+ static save = 2;
255
+ };
256
+ var MoveType = class {
257
+ static fromParent = 0;
258
+ static fromChild = 1;
259
+ static All = 2;
260
+ };
261
+ export { GraphClass, MoveType, WaveType };
@@ -0,0 +1,263 @@
1
+ var GraphClass = class {
2
+ constructor() {
3
+ const graph = this;
4
+ graph.nodesDict = {};
5
+ graph.linksDict = {};
6
+ graph.waveCache = {};
7
+ graph.nodeCount = 0;
8
+ graph.lastWaveInd = 0;
9
+ graph.lastWaveInds = {};
10
+ }
11
+ getWaveUid(e) {
12
+ const arr = [
13
+ e.waveType,
14
+ e.withStartNodes,
15
+ e.markVisited,
16
+ e.allParentsVisited,
17
+ e.moveType
18
+ ];
19
+ for (let node of e.nodes) arr.push(node.id);
20
+ return arr.join("_");
21
+ }
22
+ visitNodesByWave(e) {
23
+ const graph = this;
24
+ if (!e || !e.list || e.list.length <= 0) return;
25
+ if (e.waveType === graph.lastWaveType && e.waveInd < graph.lastWaveInd) return;
26
+ while (e.list.length) {
27
+ const nodeUid = e.list.shift();
28
+ let node = graph.nodesDict[nodeUid];
29
+ if (node.skipOnWaveVisit && node.skipOnWaveVisit(e)) continue;
30
+ if (e.markVisited) node.visited = true;
31
+ if (node.visitByWave) node.visitByWave(e).then(() => {
32
+ graph.visitNodesByWave(e);
33
+ });
34
+ }
35
+ if (e.afterAllVisited) e.afterAllVisited();
36
+ }
37
+ skipLink(link, waveType) {
38
+ return false;
39
+ }
40
+ clearWaveVisits() {
41
+ const graph = this;
42
+ for (let uid in graph.nodesDict) graph.nodesDict[uid]._waveNum = -1;
43
+ }
44
+ allParentsVisited(node, e) {
45
+ const graph = this;
46
+ for (let pid of node.parents) {
47
+ let link = graph.linksDict[node.id + "_" + graph.nodesDict[pid].id];
48
+ if (link.parent._lastWaveInd > e.waveInd && !graph.skipLink(link, e.waveType)) return false;
49
+ }
50
+ return true;
51
+ }
52
+ addChildrenToWave(parents, e) {
53
+ const graph = this;
54
+ const dubl = {};
55
+ for (let node of e.nodes) dubl[node.uid] = 1;
56
+ for (let node of parents) {
57
+ node._lastWaveInd = e.waveInd;
58
+ dubl[node.uid] = 1;
59
+ for (let cid of node.children) if (!dubl[cid]) {
60
+ dubl[cid] = 1;
61
+ let chNode = graph.nodesDict[cid];
62
+ if (chNode._lastWaveInd == null || chNode._lastWaveInd < e.waveInd) e.nodes.push(chNode);
63
+ }
64
+ }
65
+ }
66
+ triggerWave(e) {
67
+ if (e == null || !e.nodes || e.nodes.length <= 0) return;
68
+ const graph = this;
69
+ if (e.prepared == null) {
70
+ if (e.waveType == null) {
71
+ e.waveType = WaveType.value;
72
+ e.allParentsVisited = true;
73
+ }
74
+ if (e.withStartNodes == null) e.withStartNodes = true;
75
+ if (e.moveType == null) e.moveType = MoveType.fromParent;
76
+ if (e.waveInd == null) e.waveInd = ++graph.lastWaveInd;
77
+ e.prepared = true;
78
+ }
79
+ graph._isMakingWave = true;
80
+ if (graph.lastWaveInds[e.waveType] != null && e.waveInd < graph.lastWaveInds[e.waveType]) return;
81
+ if (graph.lastWaveInds[e.waveType] == null || graph.lastWaveInds[e.waveType] < e.waveInd) graph.lastWaveInds[e.waveType] = e.waveInd;
82
+ if (!e.withStartNodes) {
83
+ const parents = [...e.nodes];
84
+ e.nodes = [];
85
+ graph.addChildrenToWave(parents, e);
86
+ e.withStartNodes = true;
87
+ }
88
+ if (graph.lastWaveInds[e.waveType] == e.waveInd && e.nodes.length <= 0) {
89
+ graph._isMakingWave = false;
90
+ if (e.afterAllVisited) e.afterAllVisited();
91
+ return;
92
+ }
93
+ let i = 0;
94
+ while (i < e.nodes.length) {
95
+ let node = e.nodes[i];
96
+ if (node._lastWaveInd == e.waveInd) {
97
+ i++;
98
+ continue;
99
+ }
100
+ if (node.skipOnWaveVisit && node.skipOnWaveVisit(e)) {
101
+ e.nodes.splice(i, 1);
102
+ continue;
103
+ }
104
+ if (e.allParentsVisited && !graph.allParentsVisited(node, e)) {
105
+ i++;
106
+ continue;
107
+ }
108
+ if (e.markVisited) node.visited = true;
109
+ node._lastWaveInd = e.waveInd;
110
+ if (node.visitByWave) {
111
+ i++;
112
+ node.visitByWave(e).then(() => {
113
+ graph.addChildrenToWave([node], e);
114
+ const index = e.nodes.indexOf(node);
115
+ if (index > -1) e.nodes.splice(index, 1);
116
+ graph.triggerWave(e);
117
+ if (graph.lastWaveInds[e.waveType] == e.waveInd && e.nodes.length <= 0) {
118
+ graph._isMakingWave = false;
119
+ if (e.afterAllVisited) e.afterAllVisited();
120
+ }
121
+ });
122
+ } else {
123
+ e.nodes.splice(i, 1);
124
+ if (graph.lastWaveInds[e.waveType] == e.waveInd && e.nodes.length <= 0) {
125
+ graph._isMakingWave = false;
126
+ if (e.afterAllVisited) e.afterAllVisited();
127
+ }
128
+ }
129
+ }
130
+ }
131
+ triggerWaveOld(e) {
132
+ e = e || {};
133
+ const graph = this;
134
+ if (graph._isMakingWave || !e.nodes || e.nodes.length <= 0) return;
135
+ if (e.waveType == null) e.waveType = WaveType.value;
136
+ if (e.withStartNodes == null) e.withStartNodes = true;
137
+ if (e.moveType == null) e.moveType = MoveType.fromParent;
138
+ e.list = [];
139
+ e.waveUid = graph.getWaveUid(e);
140
+ graph.lastWaveType = e.waveType;
141
+ e.waveInd = ++graph.lastWaveInd;
142
+ graph._isMakingWave = true;
143
+ let _cachedWave = graph.waveCache[e.waveUid];
144
+ if (!graph.noCachWave && _cachedWave) {
145
+ Object.assign(e.list, _cachedWave);
146
+ graph.visitNodesByWave(e);
147
+ graph._isMakingWave = false;
148
+ return;
149
+ }
150
+ _cachedWave = [];
151
+ let error;
152
+ try {
153
+ graph.clearWaveVisits();
154
+ let waveNum = 0;
155
+ for (let node of e.nodes) {
156
+ node._waveNum = waveNum;
157
+ if (e.withStartNodes) _cachedWave.push(node.uid);
158
+ }
159
+ let found = true;
160
+ let needAdd;
161
+ while (found && graph.nodeCount > waveNum) {
162
+ found = false;
163
+ waveNum++;
164
+ const currWaveNodes = [];
165
+ for (let uid in graph.nodesDict) {
166
+ let node = graph.nodesDict[uid];
167
+ if (node._waveNum >= 0) continue;
168
+ needAdd = false;
169
+ if (e.moveType !== MoveType.fromChild) for (let pid of node.parents) {
170
+ let link = graph.linksDict[node.id + "_" + graph.nodesDict[pid].id];
171
+ needAdd = link.parent._waveNum >= 0 && link.parent._waveNum < waveNum && !graph.skipLink(link, e.waveType);
172
+ if (!e.allParentsVisited && needAdd || e.allParentsVisited && !needAdd) break;
173
+ }
174
+ if ((!needAdd || e.allParentsVisited) && e.moveType !== MoveType.fromParent) for (let cid of node.children) {
175
+ let link = graph.linksDict[graph.nodesDict[cid].id + "_" + node.id];
176
+ needAdd = link.child._waveNum >= 0 && link.child._waveNum < waveNum && !graph.skipLink(link, e.waveType);
177
+ if (!e.allParentsVisited && needAdd || e.allParentsVisited && !needAdd) break;
178
+ }
179
+ if (needAdd) {
180
+ node._waveNum = waveNum;
181
+ currWaveNodes.push(node);
182
+ found = true;
183
+ }
184
+ }
185
+ if (!e.allParentsVisited) {
186
+ let added = false;
187
+ for (let i = currWaveNodes.length - 1; i >= 0; i--) {
188
+ let node = currWaveNodes[i];
189
+ if (e.moveType !== MoveType.fromChild && !graph.hasParentWithSameWave(node)) {
190
+ _cachedWave.push(node.uid);
191
+ currWaveNodes.splice(i, 1);
192
+ added = true;
193
+ } else if (e.moveType !== MoveType.fromParent && !graph.hasChildWithSameWave(node)) {
194
+ _cachedWave.push(node.uid);
195
+ currWaveNodes.splice(i, 1);
196
+ added = true;
197
+ }
198
+ }
199
+ for (let node of currWaveNodes) if (!added && node.inCycle) _cachedWave.push(node.uid);
200
+ else node._waveNum = -1;
201
+ } else if (currWaveNodes.length > 0) Array.prototype.push.apply(_cachedWave, currWaveNodes);
202
+ }
203
+ Object.assign(e.list, _cachedWave);
204
+ graph.visitNodesByWave(e);
205
+ } catch (x) {
206
+ error = true;
207
+ if (graph.debug) alert(x);
208
+ } finally {
209
+ graph.clearWaveVisits();
210
+ graph._isMakingWave = false;
211
+ if (!error) graph.waveCache[e.waveUid] = _cachedWave;
212
+ }
213
+ }
214
+ hasParentWithSameWave(node) {
215
+ const graph = this;
216
+ if (!node) return;
217
+ for (let pid of node.parents) if (graph.nodesDict[pid]._waveNum === node._waveNum) return true;
218
+ }
219
+ hasChildWithSameWave(node) {
220
+ const graph = this;
221
+ if (!node) return;
222
+ for (let lid of node.children) if (graph.nodesDict[lid]._waveNum === node._waveNum) return true;
223
+ }
224
+ markCycles() {
225
+ const graph = this;
226
+ const hasParents = function(node) {
227
+ for (let pid of node.parents) if (!graph.nodesDict[pid].excluded) return true;
228
+ };
229
+ const hasChildren = function(node) {
230
+ for (let lid in node.children) if (graph.nodesDict[lid].excluded) return true;
231
+ };
232
+ let changesDone = true;
233
+ while (changesDone) {
234
+ changesDone = false;
235
+ for (let uid in graph.nodesDict) {
236
+ let node = graph.nodesDict[uid];
237
+ if (node.excluded) continue;
238
+ if (!hasParents(node) || !hasChildren(node)) {
239
+ node.excluded = true;
240
+ changesDone = true;
241
+ }
242
+ }
243
+ }
244
+ for (let uid in graph.nodesDict) {
245
+ let node = graph.nodesDict[uid];
246
+ if (node.excluded) delete node.excluded;
247
+ else node.inCycle = true;
248
+ }
249
+ }
250
+ };
251
+ var WaveType = class {
252
+ static value = 0;
253
+ static refresh = 1;
254
+ static save = 2;
255
+ };
256
+ var MoveType = class {
257
+ static fromParent = 0;
258
+ static fromChild = 1;
259
+ static All = 2;
260
+ };
261
+ exports.GraphClass = GraphClass;
262
+ exports.MoveType = MoveType;
263
+ exports.WaveType = WaveType;