@metadev/daga 1.2.0 → 1.3.1
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/Changelog.md +16 -0
- package/README.md +2 -2
- package/fesm2022/metadev-daga.mjs +810 -58
- package/fesm2022/metadev-daga.mjs.map +1 -1
- package/lib/collapse-button/collapse-button.component.d.ts +4 -0
- package/lib/diagram/diagram.component.d.ts +1 -0
- package/lib/diagram-buttons/diagram-buttons.component.d.ts +4 -0
- package/lib/diagram-editor/diagram/converters/daga-exporter.d.ts +4 -0
- package/lib/diagram-editor/diagram/converters/daga-importer.d.ts +4 -0
- package/lib/diagram-editor/diagram/converters/daga-model.d.ts +5 -0
- package/lib/diagram-editor/diagram/converters/diagram-model-exporter.d.ts +7 -0
- package/lib/diagram-editor/diagram/converters/diagram-model-importer.d.ts +7 -0
- package/lib/diagram-editor/diagram/diagram-action.d.ts +67 -1
- package/lib/diagram-editor/diagram/diagram-canvas.d.ts +4 -0
- package/lib/diagram-editor/diagram/diagram-config.d.ts +21 -3
- package/lib/diagram-editor/diagram/diagram-connection.d.ts +75 -0
- package/lib/diagram-editor/diagram/diagram-element.d.ts +40 -3
- package/lib/diagram-editor/diagram/diagram-field.d.ts +64 -0
- package/lib/diagram-editor/diagram/diagram-model.d.ts +75 -2
- package/lib/diagram-editor/diagram/diagram-node.d.ts +58 -0
- package/lib/diagram-editor/diagram/diagram-port.d.ts +36 -0
- package/lib/diagram-editor/diagram/diagram-property.d.ts +23 -2
- package/lib/diagram-editor/diagram/diagram-section.d.ts +45 -0
- package/lib/diagram-editor/diagram/layout/adjacency-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/breadth-adjacency-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/breadth-layout.d.ts +2 -2
- package/lib/diagram-editor/diagram/layout/diagram-layout.d.ts +8 -0
- package/lib/diagram-editor/diagram/layout/force-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/horizontal-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/priority-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/vertical-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram-editor.component.d.ts +4 -0
- package/lib/errors/diagram-error.d.ts +19 -0
- package/lib/errors/diagram-validator.d.ts +6 -1
- package/lib/errors/errors.component.d.ts +5 -0
- package/lib/interfaces/canvas.d.ts +48 -4
- package/lib/interfaces/diagram-buttons.d.ts +8 -0
- package/lib/interfaces/diagram-editor.d.ts +4 -0
- package/lib/interfaces/palette.d.ts +2 -0
- package/lib/interfaces/property-editor.d.ts +4 -0
- package/lib/object-editor/object-editor.component.d.ts +7 -1
- package/lib/palette/palette.component.d.ts +6 -0
- package/lib/property-editor/property-editor.component.d.ts +5 -0
- package/lib/services/canvas-provider.service.d.ts +17 -0
- package/lib/services/daga-configuration.service.d.ts +11 -0
- package/lib/text-list-editor/text-list-editor.component.d.ts +7 -0
- package/lib/text-map-editor/text-map-editor.component.d.ts +7 -0
- package/lib/util/canvas-util.d.ts +104 -0
- package/lib/util/events.d.ts +8 -4
- package/lib/util/grid.d.ts +47 -4
- package/lib/util/line.d.ts +44 -0
- package/lib/util/list-util.d.ts +14 -0
- package/lib/util/shape.d.ts +98 -0
- package/lib/util/svg-util.d.ts +77 -5
- package/package.json +1 -1
|
@@ -9,33 +9,109 @@ import * as i3 from '@metadev/lux';
|
|
|
9
9
|
import { LuxModule } from '@metadev/lux';
|
|
10
10
|
import { Subject, combineLatest, delay, map } from 'rxjs';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* An enumeration of the possible sides of a rectangle and directions parallel to the axes of coordinates.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
12
16
|
var Side;
|
|
13
17
|
(function (Side) {
|
|
18
|
+
/**
|
|
19
|
+
* Bottom side or direction.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
14
22
|
Side["Bottom"] = "bottom";
|
|
23
|
+
/**
|
|
24
|
+
* Left side or direction.
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
15
27
|
Side["Left"] = "left";
|
|
28
|
+
/**
|
|
29
|
+
* Right side or direction.
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
16
32
|
Side["Right"] = "right";
|
|
33
|
+
/**
|
|
34
|
+
* Top side or direction.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
17
37
|
Side["Top"] = "top";
|
|
18
38
|
})(Side || (Side = {}));
|
|
39
|
+
/**
|
|
40
|
+
* An enumeration of the possible corners of a rectangle.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
19
43
|
var Corner;
|
|
20
44
|
(function (Corner) {
|
|
45
|
+
/**
|
|
46
|
+
* Bottom left corner.
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
21
49
|
Corner["BottomLeft"] = "bottom-left";
|
|
50
|
+
/**
|
|
51
|
+
* Bottom right corner.
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
22
54
|
Corner["BottomRight"] = "bottom-right";
|
|
55
|
+
/**
|
|
56
|
+
* Top left corner.
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
23
59
|
Corner["TopLeft"] = "top-left";
|
|
60
|
+
/**
|
|
61
|
+
* Top right corner.
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
24
64
|
Corner["TopRight"] = "top-right";
|
|
25
65
|
})(Corner || (Corner = {}));
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
VerticalAlign["Bottom"] = "bottom";
|
|
31
|
-
})(VerticalAlign || (VerticalAlign = {}));
|
|
66
|
+
/**
|
|
67
|
+
* An enumeration of the possible horizontal alignments within a horizontal range of coordinates.
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
32
70
|
var HorizontalAlign;
|
|
33
71
|
(function (HorizontalAlign) {
|
|
72
|
+
/**
|
|
73
|
+
* Start of an horizontal range of coordinates.
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
34
76
|
HorizontalAlign["Left"] = "left";
|
|
77
|
+
/**
|
|
78
|
+
* Middle of an horizontal range of coordinates.
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
35
81
|
HorizontalAlign["Center"] = "center";
|
|
82
|
+
/**
|
|
83
|
+
* End of an horizontal range of coordinates.
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
36
86
|
HorizontalAlign["Right"] = "right";
|
|
37
87
|
})(HorizontalAlign || (HorizontalAlign = {}));
|
|
88
|
+
/**
|
|
89
|
+
* An enumeration of the possible vertical alignments within a vertical range of coordinates.
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
var VerticalAlign;
|
|
93
|
+
(function (VerticalAlign) {
|
|
94
|
+
/**
|
|
95
|
+
* Start of a vertical range of coordinates.
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
VerticalAlign["Top"] = "top";
|
|
99
|
+
/**
|
|
100
|
+
* Middle of a vertical range of coordinates.
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
VerticalAlign["Center"] = "center";
|
|
104
|
+
/**
|
|
105
|
+
* End of a vertical range of coordinates.
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
VerticalAlign["Bottom"] = "bottom";
|
|
109
|
+
})(VerticalAlign || (VerticalAlign = {}));
|
|
38
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Button used to collapse components that implement it.
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
39
115
|
class CollapseButtonComponent {
|
|
40
116
|
constructor() {
|
|
41
117
|
this.collapsed = false;
|
|
@@ -139,41 +215,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
139
215
|
type: Input
|
|
140
216
|
}] } });
|
|
141
217
|
|
|
218
|
+
/**
|
|
219
|
+
* A two dimensional array of elements of the given class that can extend infinitely in any direction, both positive and negative.
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
142
222
|
class Grid {
|
|
143
223
|
constructor() {
|
|
144
224
|
this.grid = [[undefined]];
|
|
145
225
|
this.offsetX = 0;
|
|
146
226
|
this.offsetY = 0;
|
|
147
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Get the minimum x coordinate among the elements in the grid.
|
|
230
|
+
*/
|
|
148
231
|
minX() {
|
|
149
232
|
return -this.offsetX;
|
|
150
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Get the maximum x coordinate among the elements in the grid.
|
|
236
|
+
*/
|
|
151
237
|
maxX() {
|
|
152
238
|
return this.width() - 1 - this.offsetX;
|
|
153
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Get the minimum y coordinate among the elements in the grid.
|
|
242
|
+
*/
|
|
154
243
|
minY() {
|
|
155
244
|
return -this.offsetY;
|
|
156
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Get the maximum y coordinate among the elements in the grid.
|
|
248
|
+
*/
|
|
157
249
|
maxY() {
|
|
158
250
|
return this.height() - 1 - this.offsetY;
|
|
159
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Get the total extension of the grid along the x axis.
|
|
254
|
+
*/
|
|
160
255
|
width() {
|
|
161
256
|
return this.grid[0].length;
|
|
162
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Get the total extension of the grid along the y axis.
|
|
260
|
+
*/
|
|
163
261
|
height() {
|
|
164
262
|
return this.grid.length;
|
|
165
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Add a new column at the start of the x axis.
|
|
266
|
+
*/
|
|
166
267
|
addColumnLeft() {
|
|
167
268
|
for (const row of this.grid) {
|
|
168
269
|
row.splice(0, 0, undefined);
|
|
169
270
|
}
|
|
170
271
|
this.offsetX = this.offsetX + 1;
|
|
171
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Add a new column at the end of the x axis.
|
|
275
|
+
*/
|
|
172
276
|
addColumnRight() {
|
|
173
277
|
for (const row of this.grid) {
|
|
174
278
|
row.push(undefined);
|
|
175
279
|
}
|
|
176
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Add a new row at the start of the y axis.
|
|
283
|
+
*/
|
|
177
284
|
addRowTop() {
|
|
178
285
|
const newRow = [];
|
|
179
286
|
for (let i = 0; i < this.grid[0].length; ++i) {
|
|
@@ -182,6 +289,9 @@ class Grid {
|
|
|
182
289
|
this.grid.splice(0, 0, newRow);
|
|
183
290
|
this.offsetY = this.offsetY + 1;
|
|
184
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Add a new row at the end of the y axis.
|
|
294
|
+
*/
|
|
185
295
|
addRowBottom() {
|
|
186
296
|
const newRow = [];
|
|
187
297
|
for (let i = 0; i < this.grid[0].length; ++i) {
|
|
@@ -189,12 +299,18 @@ class Grid {
|
|
|
189
299
|
}
|
|
190
300
|
this.grid.push(newRow);
|
|
191
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Get the element at the given coordinates or undefined if there is no element at the given coordinates.
|
|
304
|
+
*/
|
|
192
305
|
get(coords) {
|
|
193
306
|
if (this.grid[coords[1] + this.offsetY]) {
|
|
194
307
|
return this.grid[coords[1] + this.offsetY][coords[0] + this.offsetX];
|
|
195
308
|
}
|
|
196
309
|
return undefined;
|
|
197
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Set the element at the given coordinates to the given element.
|
|
313
|
+
*/
|
|
198
314
|
set(coords, value) {
|
|
199
315
|
while (coords[0] < -this.offsetX) {
|
|
200
316
|
this.addColumnLeft();
|
|
@@ -210,6 +326,9 @@ class Grid {
|
|
|
210
326
|
}
|
|
211
327
|
this.grid[coords[1] + this.offsetY][coords[0] + this.offsetX] = value;
|
|
212
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* Get the closest coordinates to the given coordinates that are not set to an element.
|
|
331
|
+
*/
|
|
213
332
|
getClosestEmptyCoordinate(coords) {
|
|
214
333
|
if (this.get(coords) === undefined) {
|
|
215
334
|
return coords;
|
|
@@ -236,6 +355,13 @@ class Grid {
|
|
|
236
355
|
}
|
|
237
356
|
}
|
|
238
357
|
|
|
358
|
+
/**
|
|
359
|
+
* Removes the given element from the array if it exists within the array.
|
|
360
|
+
* @private
|
|
361
|
+
* @param arr An array.
|
|
362
|
+
* @param obj An element to remove from the array.
|
|
363
|
+
* @returns The given array without the given element removed if it was found; otherwise the array without modifications.
|
|
364
|
+
*/
|
|
239
365
|
const removeIfExists = (arr, obj) => {
|
|
240
366
|
const index = arr.indexOf(obj);
|
|
241
367
|
if (index >= 0) {
|
|
@@ -243,6 +369,13 @@ const removeIfExists = (arr, obj) => {
|
|
|
243
369
|
}
|
|
244
370
|
return arr;
|
|
245
371
|
};
|
|
372
|
+
/**
|
|
373
|
+
* Adds the given element to the array if it doesn't exist within the array.
|
|
374
|
+
* @private
|
|
375
|
+
* @param arr An array.
|
|
376
|
+
* @param obj An element to add to the array.
|
|
377
|
+
* @returns The given array with the given element added it was not found; otherwise the array without modifications.
|
|
378
|
+
*/
|
|
246
379
|
const addIfNotExists = (arr, obj) => {
|
|
247
380
|
if (!arr.includes(obj)) {
|
|
248
381
|
arr.push(obj);
|
|
@@ -252,6 +385,7 @@ const addIfNotExists = (arr, obj) => {
|
|
|
252
385
|
|
|
253
386
|
/**
|
|
254
387
|
* A layout which places adjacent nodes close by, placing nodes in order according to depth first search.
|
|
388
|
+
* @public
|
|
255
389
|
*/
|
|
256
390
|
class AdjacencyLayout {
|
|
257
391
|
apply(model) {
|
|
@@ -298,6 +432,7 @@ const arrangeNode = (node, nodeArrangement, coords, nodesToBeArranged) => {
|
|
|
298
432
|
|
|
299
433
|
/**
|
|
300
434
|
* A layout which places adjacent nodes close by, placing nodes in order according to breadth first search.
|
|
435
|
+
* @public
|
|
301
436
|
*/
|
|
302
437
|
class BreadthAdjacencyLayout {
|
|
303
438
|
apply(model) {
|
|
@@ -358,8 +493,8 @@ class BreadthAdjacencyLayout {
|
|
|
358
493
|
}
|
|
359
494
|
|
|
360
495
|
/**
|
|
361
|
-
* A layout which arranges the nodes by a breadth first search system
|
|
362
|
-
*
|
|
496
|
+
* A layout which arranges the nodes by a breadth first search system according to their distance to the first node in the list.
|
|
497
|
+
* @public
|
|
363
498
|
*/
|
|
364
499
|
class BreadthLayout {
|
|
365
500
|
apply(model) {
|
|
@@ -420,9 +555,23 @@ class BreadthLayout {
|
|
|
420
555
|
}
|
|
421
556
|
}
|
|
422
557
|
|
|
558
|
+
/**
|
|
559
|
+
* Round the coordinates of the given point to the nearest whole number.
|
|
560
|
+
* @public
|
|
561
|
+
* @param point A point.
|
|
562
|
+
* @returns A new point with whole coordinates.
|
|
563
|
+
*/
|
|
423
564
|
const roundPoint = (point) => {
|
|
424
565
|
return [Math.round(point[0]), Math.round(point[1])];
|
|
425
566
|
};
|
|
567
|
+
/**
|
|
568
|
+
* Checks if the given coordinate is in the range given by an starting coordinate and an ending coordinate.
|
|
569
|
+
* @public
|
|
570
|
+
* @param coordinate A coordinate to check its presence in the range.
|
|
571
|
+
* @param start A coordinate determining one of the extremes in the range.
|
|
572
|
+
* @param end A coordinate determine one of the extremes in the range.
|
|
573
|
+
* @returns `true` if the given coordinate is in the given range; `false` otherwise.
|
|
574
|
+
*/
|
|
426
575
|
const between = (coordinate, start, end) => {
|
|
427
576
|
if (start < end) {
|
|
428
577
|
return start <= coordinate && coordinate <= end;
|
|
@@ -431,18 +580,44 @@ const between = (coordinate, start, end) => {
|
|
|
431
580
|
return end <= coordinate && coordinate <= start;
|
|
432
581
|
}
|
|
433
582
|
};
|
|
583
|
+
/**
|
|
584
|
+
* Moves the given coordinate according to the given changes in coordinates.
|
|
585
|
+
* @public
|
|
586
|
+
* @param oldCoordinate A coordinate.
|
|
587
|
+
* @param oldCoordinates A range of coordinates.
|
|
588
|
+
* @param newCoordinates A range of coordinates.
|
|
589
|
+
* @returns A new coordinate.
|
|
590
|
+
*/
|
|
434
591
|
const translateCoordinate = (oldCoordinate, oldCoordinates, newCoordinates) => {
|
|
435
592
|
return (((oldCoordinate - oldCoordinates[0]) /
|
|
436
593
|
(oldCoordinates[1] - oldCoordinates[0])) *
|
|
437
594
|
(newCoordinates[1] - newCoordinates[0]) +
|
|
438
595
|
newCoordinates[0]);
|
|
439
596
|
};
|
|
597
|
+
/**
|
|
598
|
+
* Moves the coordinates of the given point according to the given changes in coordinates.
|
|
599
|
+
* @public
|
|
600
|
+
* @param oldPoint A point.
|
|
601
|
+
* @param oldCoordsX A range of coordinates along the x axis.
|
|
602
|
+
* @param oldCoordsY A range of coordinates along the y axis.
|
|
603
|
+
* @param newCoordsX A range of coordinates along the x axis.
|
|
604
|
+
* @param newCoordsY A range of coordinates along the y axis.
|
|
605
|
+
* @returns A new point.
|
|
606
|
+
*/
|
|
440
607
|
const translatePoint = (oldPoint, oldCoordsX, oldCoordsY, newCoordsX, newCoordsY) => {
|
|
441
608
|
return [
|
|
442
609
|
translateCoordinate(oldPoint[0], oldCoordsX, newCoordsX),
|
|
443
610
|
translateCoordinate(oldPoint[1], oldCoordsY, newCoordsY)
|
|
444
611
|
];
|
|
445
612
|
};
|
|
613
|
+
/**
|
|
614
|
+
* Calculates the result of moving the given point by the given distance in the given direction.
|
|
615
|
+
* @public
|
|
616
|
+
* @param point A point.
|
|
617
|
+
* @param direction A direction.
|
|
618
|
+
* @param distance A distance.
|
|
619
|
+
* @returns A new point which differs from the given point by the given distance in the given direction.
|
|
620
|
+
*/
|
|
446
621
|
const movePoint = (point, direction, distance) => {
|
|
447
622
|
switch (direction) {
|
|
448
623
|
case Side.Right:
|
|
@@ -455,12 +630,33 @@ const movePoint = (point, direction, distance) => {
|
|
|
455
630
|
return [point[0], point[1] - distance];
|
|
456
631
|
}
|
|
457
632
|
};
|
|
633
|
+
/**
|
|
634
|
+
* Checks whether two given points are the same point, that is, they have the same coordinates and are not NaN.
|
|
635
|
+
* @public
|
|
636
|
+
* @param point1 A point.
|
|
637
|
+
* @param point2 A point.
|
|
638
|
+
* @returns `true` if the two points have the same coordinates; `false` otherwise.
|
|
639
|
+
*/
|
|
458
640
|
const equals$1 = (point1, point2) => {
|
|
459
641
|
return point1[0] === point2[0] && point1[1] === point2[1];
|
|
460
642
|
};
|
|
643
|
+
/**
|
|
644
|
+
* Calculates the euclidean distance between two points.
|
|
645
|
+
* @public
|
|
646
|
+
* @param point1 A point.
|
|
647
|
+
* @param point2 A point.
|
|
648
|
+
* @returns The euclidean distance between the given points.
|
|
649
|
+
*/
|
|
461
650
|
const distanceBetweenPoints = (point1, point2) => {
|
|
462
651
|
return ((point1[0] - point2[0]) ** 2 + (point1[1] - point2[1]) ** 2) ** 0.5;
|
|
463
652
|
};
|
|
653
|
+
/**
|
|
654
|
+
* Checks whether the given point is inside the given line.
|
|
655
|
+
* @public
|
|
656
|
+
* @param line A line.
|
|
657
|
+
* @param point A point.
|
|
658
|
+
* @returns `true` if the point is contained within the line; `false` otherwise.
|
|
659
|
+
*/
|
|
464
660
|
const lineContainsPoint = (line, point) => {
|
|
465
661
|
const alphaX = (point[0] - line[0][0]) / (line[1][0] - line[0][0]);
|
|
466
662
|
if (alphaX < 0 || 1 < alphaX) {
|
|
@@ -469,10 +665,24 @@ const lineContainsPoint = (line, point) => {
|
|
|
469
665
|
const alphaY = (point[1] - line[0][1]) / (line[1][1] - line[0][1]);
|
|
470
666
|
return alphaX === alphaY;
|
|
471
667
|
};
|
|
668
|
+
/**
|
|
669
|
+
* Checks whether the given point is inside the given rectaingle.
|
|
670
|
+
* @public
|
|
671
|
+
* @param rectangle A rectangle.
|
|
672
|
+
* @param point A point.
|
|
673
|
+
* @returns `true` if the point is contained within the rectangle; `false` otherwise.
|
|
674
|
+
*/
|
|
472
675
|
const rectangleContainsPoint = (rectangle, point) => {
|
|
473
676
|
return (between(point[0], rectangle[0][0], rectangle[1][0]) &&
|
|
474
677
|
between(point[1], rectangle[0][1], rectangle[1][1]));
|
|
475
678
|
};
|
|
679
|
+
/**
|
|
680
|
+
* Checks whether the two given lines share at least one point.
|
|
681
|
+
* @public
|
|
682
|
+
* @param line1 A line.
|
|
683
|
+
* @param line2 A line.
|
|
684
|
+
* @returns `true` if the lines intersect; `false` otherwise.
|
|
685
|
+
*/
|
|
476
686
|
const linesIntersect = (line1, line2) => {
|
|
477
687
|
// if both lines are a point, they intersect if they are the same point
|
|
478
688
|
if (equals$1(line1[0], line1[1]) && equals$1(line2[0], line2[1])) {
|
|
@@ -503,6 +713,13 @@ const linesIntersect = (line1, line2) => {
|
|
|
503
713
|
const p3 = dy0 * (line1[1][0] - line2[1][0]) - dx0 * (line1[1][1] - line2[1][1]);
|
|
504
714
|
return p0 * p1 <= 0 && p2 * p3 <= 0;
|
|
505
715
|
};
|
|
716
|
+
/**
|
|
717
|
+
* Checks whether the two given lines share at least one point and have the same slope.
|
|
718
|
+
* @public
|
|
719
|
+
* @param line1 A line.
|
|
720
|
+
* @param line2 A line.
|
|
721
|
+
* @returns `true` if the lines overlap; `false` otherwise.
|
|
722
|
+
*/
|
|
506
723
|
const linesOverlap = (line1, line2) => {
|
|
507
724
|
// if both lines are a point, they overlap if they are the same point
|
|
508
725
|
if (equals$1(line1[0], line1[1]) && equals$1(line2[0], line2[1])) {
|
|
@@ -522,10 +739,21 @@ const linesOverlap = (line1, line2) => {
|
|
|
522
739
|
lineContainsPoint(line2, line1[0])) &&
|
|
523
740
|
(lineContainsPoint(line1, line2[1]) || lineContainsPoint(line2, line1[1])));
|
|
524
741
|
};
|
|
742
|
+
/**
|
|
743
|
+
* Checks whether the given line shares at least one point with the given rectangle.
|
|
744
|
+
* @public
|
|
745
|
+
* @param line A line.
|
|
746
|
+
* @param rectangle A rectangle.
|
|
747
|
+
* @returns `true` if the line intersects with the rectangle; `false` otherwise.
|
|
748
|
+
*/
|
|
525
749
|
const lineIntersectsRectangle = (line, rectangle) => {
|
|
750
|
+
// first corner of the rectangle
|
|
526
751
|
const point1 = rectangle[0];
|
|
752
|
+
// second corner of the rectangle
|
|
527
753
|
const point2 = [rectangle[0][0], rectangle[1][1]];
|
|
754
|
+
// third corner of the rectangle
|
|
528
755
|
const point3 = rectangle[1];
|
|
756
|
+
// fourth corner of the rectangle
|
|
529
757
|
const point4 = [rectangle[1][0], rectangle[0][1]];
|
|
530
758
|
return (linesIntersect(line, [point1, point2]) ||
|
|
531
759
|
linesIntersect(line, [point2, point3]) ||
|
|
@@ -535,6 +763,7 @@ const lineIntersectsRectangle = (line, rectangle) => {
|
|
|
535
763
|
|
|
536
764
|
/**
|
|
537
765
|
* A layout which attracts connected nodes and repels unconnected nodes.
|
|
766
|
+
* @public
|
|
538
767
|
*/
|
|
539
768
|
class ForceLayout {
|
|
540
769
|
apply(model) {
|
|
@@ -670,6 +899,7 @@ class ForceLayout {
|
|
|
670
899
|
|
|
671
900
|
/**
|
|
672
901
|
* A layout which arranges all the nodes in a horizontal line.
|
|
902
|
+
* @public
|
|
673
903
|
*/
|
|
674
904
|
class HorizontalLayout {
|
|
675
905
|
apply(model) {
|
|
@@ -691,6 +921,7 @@ class HorizontalLayout {
|
|
|
691
921
|
|
|
692
922
|
/**
|
|
693
923
|
* A layout which arranges the nodes by their priority first.
|
|
924
|
+
* @public
|
|
694
925
|
*/
|
|
695
926
|
class PriorityLayout {
|
|
696
927
|
apply(model) {
|
|
@@ -798,6 +1029,7 @@ class PriorityLayout {
|
|
|
798
1029
|
|
|
799
1030
|
/**
|
|
800
1031
|
* A layout which arranges all the nodes in a vertical line.
|
|
1032
|
+
* @public
|
|
801
1033
|
*/
|
|
802
1034
|
class VerticalLayout {
|
|
803
1035
|
apply(model) {
|
|
@@ -817,6 +1049,9 @@ class VerticalLayout {
|
|
|
817
1049
|
}
|
|
818
1050
|
}
|
|
819
1051
|
|
|
1052
|
+
/**
|
|
1053
|
+
* Mapping of available layout algorithms.
|
|
1054
|
+
*/
|
|
820
1055
|
const layouts = {
|
|
821
1056
|
adjacency: new AdjacencyLayout(),
|
|
822
1057
|
breadth: new BreadthLayout(),
|
|
@@ -828,7 +1063,8 @@ const layouts = {
|
|
|
828
1063
|
};
|
|
829
1064
|
|
|
830
1065
|
/**
|
|
831
|
-
* User events
|
|
1066
|
+
* User events.
|
|
1067
|
+
* @private
|
|
832
1068
|
*/
|
|
833
1069
|
var Events;
|
|
834
1070
|
(function (Events) {
|
|
@@ -843,7 +1079,8 @@ var Events;
|
|
|
843
1079
|
Events["MouseOver"] = "mouseover";
|
|
844
1080
|
})(Events || (Events = {}));
|
|
845
1081
|
/**
|
|
846
|
-
* Keys in keyboard events
|
|
1082
|
+
* Keys in keyboard events.
|
|
1083
|
+
* @private
|
|
847
1084
|
*/
|
|
848
1085
|
var Keys;
|
|
849
1086
|
(function (Keys) {
|
|
@@ -867,7 +1104,8 @@ var Keys;
|
|
|
867
1104
|
Keys["Tab"] = "Tab";
|
|
868
1105
|
})(Keys || (Keys = {}));
|
|
869
1106
|
/**
|
|
870
|
-
* Types of events used by D3's drag functionality
|
|
1107
|
+
* Types of events used by D3's drag functionality.
|
|
1108
|
+
* @private
|
|
871
1109
|
*/
|
|
872
1110
|
var DragEvents;
|
|
873
1111
|
(function (DragEvents) {
|
|
@@ -876,7 +1114,8 @@ var DragEvents;
|
|
|
876
1114
|
DragEvents["End"] = "end";
|
|
877
1115
|
})(DragEvents || (DragEvents = {}));
|
|
878
1116
|
/**
|
|
879
|
-
* Types of events used by D3's zoom functionality
|
|
1117
|
+
* Types of events used by D3's zoom functionality.
|
|
1118
|
+
* @private
|
|
880
1119
|
*/
|
|
881
1120
|
var ZoomEvents;
|
|
882
1121
|
(function (ZoomEvents) {
|
|
@@ -885,20 +1124,64 @@ var ZoomEvents;
|
|
|
885
1124
|
ZoomEvents["End"] = "end";
|
|
886
1125
|
})(ZoomEvents || (ZoomEvents = {}));
|
|
887
1126
|
|
|
1127
|
+
/**
|
|
1128
|
+
* An enumeration of the possible shapes of a line.
|
|
1129
|
+
* @public
|
|
1130
|
+
*/
|
|
888
1131
|
var LineShape;
|
|
889
1132
|
(function (LineShape) {
|
|
1133
|
+
/**
|
|
1134
|
+
* A line that goes between its points taking the shortest euclidean distance.
|
|
1135
|
+
* @public
|
|
1136
|
+
*/
|
|
890
1137
|
LineShape["Straight"] = "straight";
|
|
1138
|
+
/**
|
|
1139
|
+
* A line that goes between its points using bezier splines.
|
|
1140
|
+
* @public
|
|
1141
|
+
*/
|
|
891
1142
|
LineShape["Bezier"] = "bezier";
|
|
1143
|
+
/**
|
|
1144
|
+
* A line that goes between its points moving parallel to the axes of coordinates.
|
|
1145
|
+
* @public
|
|
1146
|
+
*/
|
|
892
1147
|
LineShape["Square"] = "square";
|
|
893
1148
|
})(LineShape || (LineShape = {}));
|
|
1149
|
+
/**
|
|
1150
|
+
* An enumeration of the possible styles of a line.
|
|
1151
|
+
* @public
|
|
1152
|
+
*/
|
|
894
1153
|
var LineStyle;
|
|
895
1154
|
(function (LineStyle) {
|
|
1155
|
+
/**
|
|
1156
|
+
* A solid uninterrupted line.
|
|
1157
|
+
* @public
|
|
1158
|
+
*/
|
|
896
1159
|
LineStyle["Solid"] = "solid";
|
|
1160
|
+
/**
|
|
1161
|
+
* A dashed line with little separation between the dashes.
|
|
1162
|
+
* @public
|
|
1163
|
+
*/
|
|
897
1164
|
LineStyle["Dashed"] = "dashed";
|
|
1165
|
+
/**
|
|
1166
|
+
* A dashed line with wide gaps between the dashes.
|
|
1167
|
+
* @public
|
|
1168
|
+
*/
|
|
898
1169
|
LineStyle["GappedDashes"] = "gapped-dashes";
|
|
1170
|
+
/**
|
|
1171
|
+
* A dotted line.
|
|
1172
|
+
* @public
|
|
1173
|
+
*/
|
|
899
1174
|
LineStyle["Dotted"] = "dotted";
|
|
900
1175
|
})(LineStyle || (LineStyle = {}));
|
|
1176
|
+
/**
|
|
1177
|
+
* The default minimum distance before turn used by the linePath function.
|
|
1178
|
+
* @private
|
|
1179
|
+
*/
|
|
901
1180
|
const MINIMUM_DISTANCE_BEFORE_TURN = 20;
|
|
1181
|
+
/**
|
|
1182
|
+
* Calculates the path of an SVG line with the given parameters.
|
|
1183
|
+
* @private
|
|
1184
|
+
*/
|
|
902
1185
|
const linePath = (shape, points, startDirection, endDirection, minimumDistanceBeforeTurn) => {
|
|
903
1186
|
if (points.length === 0) {
|
|
904
1187
|
return '';
|
|
@@ -1236,6 +1519,10 @@ const linePath = (shape, points, startDirection, endDirection, minimumDistanceBe
|
|
|
1236
1519
|
return result;
|
|
1237
1520
|
}
|
|
1238
1521
|
};
|
|
1522
|
+
/**
|
|
1523
|
+
* Calculates the dasharray property of an SVG line corresponding to the given line style and width.
|
|
1524
|
+
* @private
|
|
1525
|
+
*/
|
|
1239
1526
|
const lineStyleDasharray = (style, width) => {
|
|
1240
1527
|
switch (style) {
|
|
1241
1528
|
case LineStyle.Dotted:
|
|
@@ -1250,19 +1537,67 @@ const lineStyleDasharray = (style, width) => {
|
|
|
1250
1537
|
}
|
|
1251
1538
|
};
|
|
1252
1539
|
|
|
1540
|
+
/**
|
|
1541
|
+
* An enumeration of possible closed shapes.
|
|
1542
|
+
* @public
|
|
1543
|
+
*/
|
|
1253
1544
|
var ClosedShape;
|
|
1254
1545
|
(function (ClosedShape) {
|
|
1546
|
+
/**
|
|
1547
|
+
* An ellipse shape.
|
|
1548
|
+
* @public
|
|
1549
|
+
*/
|
|
1255
1550
|
ClosedShape["Ellipse"] = "ellipse";
|
|
1551
|
+
/**
|
|
1552
|
+
* A nonexistent shape.
|
|
1553
|
+
* @public
|
|
1554
|
+
*/
|
|
1256
1555
|
ClosedShape["Empty"] = "empty";
|
|
1556
|
+
/**
|
|
1557
|
+
* A folder-like shape.
|
|
1558
|
+
* @public
|
|
1559
|
+
*/
|
|
1257
1560
|
ClosedShape["Folder"] = "folder";
|
|
1561
|
+
/**
|
|
1562
|
+
* An hexagon shape.
|
|
1563
|
+
* @public
|
|
1564
|
+
*/
|
|
1258
1565
|
ClosedShape["Hexagon"] = "hexagon";
|
|
1566
|
+
/**
|
|
1567
|
+
* An octagon shape.
|
|
1568
|
+
* @public
|
|
1569
|
+
*/
|
|
1259
1570
|
ClosedShape["Octagon"] = "octagon";
|
|
1571
|
+
/**
|
|
1572
|
+
* A shape delimited by curves with a fixed radius, with differences in dimensions supplemented by straight lines.
|
|
1573
|
+
* @public
|
|
1574
|
+
*/
|
|
1260
1575
|
ClosedShape["Pill"] = "pill";
|
|
1576
|
+
/**
|
|
1577
|
+
* A rectangle shape.
|
|
1578
|
+
* @public
|
|
1579
|
+
*/
|
|
1261
1580
|
ClosedShape["Rectangle"] = "rectangle";
|
|
1581
|
+
/**
|
|
1582
|
+
* A rhombus shape.
|
|
1583
|
+
* @public
|
|
1584
|
+
*/
|
|
1262
1585
|
ClosedShape["Rhombus"] = "rhombus";
|
|
1586
|
+
/**
|
|
1587
|
+
* A rectangle shape with rounded corners.
|
|
1588
|
+
* @public
|
|
1589
|
+
*/
|
|
1263
1590
|
ClosedShape["RoundedRectangle"] = "rounded-rectangle";
|
|
1591
|
+
/**
|
|
1592
|
+
* A sticky note-like shape.
|
|
1593
|
+
* @public
|
|
1594
|
+
*/
|
|
1264
1595
|
ClosedShape["StickyNote"] = "sticky-note";
|
|
1265
1596
|
})(ClosedShape || (ClosedShape = {}));
|
|
1597
|
+
/**
|
|
1598
|
+
* Get the SVG path of the correspondign closed shape, starting at the given x and y coordinates, with the given width and height.
|
|
1599
|
+
* @private
|
|
1600
|
+
*/
|
|
1266
1601
|
const generalClosedPath = (shape, x, y, width, height) => {
|
|
1267
1602
|
switch (shape) {
|
|
1268
1603
|
case ClosedShape.Ellipse:
|
|
@@ -1289,21 +1624,51 @@ const generalClosedPath = (shape, x, y, width, height) => {
|
|
|
1289
1624
|
return rectanglePath(x, y, width, height);
|
|
1290
1625
|
}
|
|
1291
1626
|
};
|
|
1627
|
+
/**
|
|
1628
|
+
* Generates an ellipse SVG path.
|
|
1629
|
+
* @see ClosedShape
|
|
1630
|
+
* @private
|
|
1631
|
+
*/
|
|
1292
1632
|
const ellipsePath = (x, y, width, height) => {
|
|
1293
1633
|
return `M ${x + width / 2} ${y} A ${width / 2} ${height / 2} 0 0 0 ${x + width / 2} ${y + height} A ${width / 2} ${height / 2} 0 1 0 ${x + width / 2} ${y} Z`;
|
|
1294
1634
|
};
|
|
1635
|
+
/**
|
|
1636
|
+
* Generates an empty SVG path.
|
|
1637
|
+
* @see ClosedShape
|
|
1638
|
+
* @private
|
|
1639
|
+
*/
|
|
1295
1640
|
const emptyPath = () => {
|
|
1296
1641
|
return 'Z';
|
|
1297
1642
|
};
|
|
1643
|
+
/**
|
|
1644
|
+
* Generates a folder SVG path.
|
|
1645
|
+
* @see ClosedShape
|
|
1646
|
+
* @private
|
|
1647
|
+
*/
|
|
1298
1648
|
const folderPath = (x, y, width, height) => {
|
|
1299
1649
|
return `M ${x} ${y} L ${x + width / 3} ${y} L ${x + width / 2} ${y + height / 6} L ${x + width} ${y + height / 6} L ${x + width} ${y + height} L ${x} ${y + height} Z`;
|
|
1300
1650
|
};
|
|
1651
|
+
/**
|
|
1652
|
+
* Generates an hexagon SVG path.
|
|
1653
|
+
* @see ClosedShape
|
|
1654
|
+
* @private
|
|
1655
|
+
*/
|
|
1301
1656
|
const hexagonPath = (x, y, width, height) => {
|
|
1302
1657
|
return `M ${x + width / 4} ${y} L ${x + (3 * width) / 4} ${y} L ${x + width} ${y + height / 2} L ${x + (3 * width) / 4} ${y + height} L ${x + width / 4} ${y + height} L ${x} ${y + height / 2} Z`;
|
|
1303
1658
|
};
|
|
1659
|
+
/**
|
|
1660
|
+
* Generates an octagon SVG path.
|
|
1661
|
+
* @see ClosedShape
|
|
1662
|
+
* @private
|
|
1663
|
+
*/
|
|
1304
1664
|
const octagonPath = (x, y, width, height) => {
|
|
1305
1665
|
return `M ${x + width / 4} ${y} L ${x + (3 * width) / 4} ${y} L ${x + width} ${y + height / 4} L ${x + width} ${y + (3 * height) / 4} L ${x + (3 * width) / 4} ${y + height} L ${x + width / 4} ${y + height} L ${x} ${y + (3 * height) / 4} L ${x} ${y + height / 4} L ${x + width / 4} ${y} Z`;
|
|
1306
1666
|
};
|
|
1667
|
+
/**
|
|
1668
|
+
* Generates a pill SVG path.
|
|
1669
|
+
* @see ClosedShape
|
|
1670
|
+
* @private
|
|
1671
|
+
*/
|
|
1307
1672
|
const pillPath = (x, y, width, height) => {
|
|
1308
1673
|
if (height < width) {
|
|
1309
1674
|
return `M ${x + height / 2} ${y} L ${x + width - height / 2} ${y} A ${height / 2} ${height / 2} 0 0 1 ${x + width} ${y + height / 2} A ${height / 2} ${height / 2} 0 0 1 ${x + width - height / 2} ${y + height} L ${x + height / 2} ${y + height} A ${height / 2} ${height / 2} 0 0 1 ${x} ${y + height / 2} A ${height / 2} ${height / 2} 0 0 1 ${x + height / 2} ${y} Z`;
|
|
@@ -1315,19 +1680,43 @@ const pillPath = (x, y, width, height) => {
|
|
|
1315
1680
|
return ellipsePath(x, y, width, height);
|
|
1316
1681
|
}
|
|
1317
1682
|
};
|
|
1683
|
+
/**
|
|
1684
|
+
* Generates a rectangle SVG path.
|
|
1685
|
+
* @see ClosedShape
|
|
1686
|
+
* @private
|
|
1687
|
+
*/
|
|
1318
1688
|
const rectanglePath = (x, y, width, height) => {
|
|
1319
1689
|
return `M ${x} ${y} L ${x + width} ${y} L ${x + width} ${y + height} L ${x} ${y + height} Z`;
|
|
1320
1690
|
};
|
|
1691
|
+
/**
|
|
1692
|
+
* Generates a rhombus SVG path.
|
|
1693
|
+
* @see ClosedShape
|
|
1694
|
+
* @private
|
|
1695
|
+
*/
|
|
1321
1696
|
const rhombusPath = (x, y, width, height) => {
|
|
1322
1697
|
return `M ${x + width / 2} ${y} L ${x + width} ${y + height / 2} L ${x + width / 2} ${y + height} L ${x} ${y + height / 2} Z`;
|
|
1323
1698
|
};
|
|
1699
|
+
/**
|
|
1700
|
+
* Generates a rounded rectangle SVG path.
|
|
1701
|
+
* @see ClosedShape
|
|
1702
|
+
* @private
|
|
1703
|
+
*/
|
|
1324
1704
|
const roundedRectanglePath = (x, y, width, height) => {
|
|
1325
1705
|
return `M ${x + width / 4} ${y} L ${x + (3 * width) / 4} ${y} A ${width / 4} ${height / 4} 0 0 1 ${x + width} ${y + height / 4} L ${x + width} ${y + (3 * height) / 4} A ${width / 4} ${height / 4} 0 0 1 ${x + (3 * width) / 4} ${y + height} L ${x + width / 4} ${y + height} A ${width / 4} ${height / 4} 0 0 1 ${x} ${y + (3 * height) / 4} L ${x} ${y + height / 4} A ${width / 4} ${height / 4} 0 0 1 ${x + width / 4} ${y} Z`;
|
|
1326
1706
|
};
|
|
1707
|
+
/**
|
|
1708
|
+
* Generates a sticky note SVG path.
|
|
1709
|
+
* @see ClosedShape
|
|
1710
|
+
* @private
|
|
1711
|
+
*/
|
|
1327
1712
|
const stickyNotePath = (x, y, width, height) => {
|
|
1328
1713
|
return `M ${x} ${y} L ${x + (3 * width) / 4} ${y} L ${x + (3 * width) / 4} ${y + height / 4} L ${x + (3 * width) / 4} ${y} L ${x + width} ${y + height / 4} L ${x + (3 * width) / 4} ${y + height / 4} L ${x + width} ${y + height / 4} L ${x + width} ${y + height} L ${x} ${y + height} Z`;
|
|
1329
1714
|
};
|
|
1330
1715
|
|
|
1716
|
+
/**
|
|
1717
|
+
* A queue of recent actions taken by the user that can be undone and redone.
|
|
1718
|
+
* @private
|
|
1719
|
+
*/
|
|
1331
1720
|
class ActionQueue {
|
|
1332
1721
|
constructor(maximum) {
|
|
1333
1722
|
this.maximum = maximum;
|
|
@@ -1336,6 +1725,7 @@ class ActionQueue {
|
|
|
1336
1725
|
}
|
|
1337
1726
|
/**
|
|
1338
1727
|
* Adds an action to the history.
|
|
1728
|
+
* @private
|
|
1339
1729
|
*/
|
|
1340
1730
|
add(action) {
|
|
1341
1731
|
if (this.index < this.history.length) {
|
|
@@ -1352,6 +1742,7 @@ class ActionQueue {
|
|
|
1352
1742
|
}
|
|
1353
1743
|
/**
|
|
1354
1744
|
* Undoes the last action in the history, not counting undone actions.
|
|
1745
|
+
* @private
|
|
1355
1746
|
*/
|
|
1356
1747
|
undo() {
|
|
1357
1748
|
if (this.index > 0) {
|
|
@@ -1361,6 +1752,7 @@ class ActionQueue {
|
|
|
1361
1752
|
}
|
|
1362
1753
|
/**
|
|
1363
1754
|
* Redoes the last undone action in the history.
|
|
1755
|
+
* @private
|
|
1364
1756
|
*/
|
|
1365
1757
|
redo() {
|
|
1366
1758
|
if (this.index < this.history.length) {
|
|
@@ -1369,6 +1761,10 @@ class ActionQueue {
|
|
|
1369
1761
|
}
|
|
1370
1762
|
}
|
|
1371
1763
|
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Enum listing the actions that can be taken by the user.
|
|
1766
|
+
* @private
|
|
1767
|
+
*/
|
|
1372
1768
|
var DiagramActions;
|
|
1373
1769
|
(function (DiagramActions) {
|
|
1374
1770
|
DiagramActions["AddConnectionAction"] = "add-connection";
|
|
@@ -1380,6 +1776,11 @@ var DiagramActions;
|
|
|
1380
1776
|
DiagramActions["StretchSectionAction"] = "stretch-section";
|
|
1381
1777
|
DiagramActions["UpdateValuesAction"] = "update-values";
|
|
1382
1778
|
})(DiagramActions || (DiagramActions = {}));
|
|
1779
|
+
/**
|
|
1780
|
+
* Action which consists of adding a node.
|
|
1781
|
+
* @see DiagramNode
|
|
1782
|
+
* @private
|
|
1783
|
+
*/
|
|
1383
1784
|
class AddNodeAction {
|
|
1384
1785
|
constructor(canvas, type, coords, label, values, id) {
|
|
1385
1786
|
this.canvas = canvas;
|
|
@@ -1416,6 +1817,11 @@ class AddNodeAction {
|
|
|
1416
1817
|
this.labelId = node.label?.id;
|
|
1417
1818
|
}
|
|
1418
1819
|
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Action which consists of moving a node.
|
|
1822
|
+
* @see DiagramNode
|
|
1823
|
+
* @private
|
|
1824
|
+
*/
|
|
1419
1825
|
class MoveNodeAction {
|
|
1420
1826
|
constructor(canvas, nodeId, from, to) {
|
|
1421
1827
|
this.canvas = canvas;
|
|
@@ -1430,6 +1836,11 @@ class MoveNodeAction {
|
|
|
1430
1836
|
this.canvas.model.nodes.get(this.nodeId)?.move(this.to);
|
|
1431
1837
|
}
|
|
1432
1838
|
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Action which consists of changing the dimensions of a node in a given direction.
|
|
1841
|
+
* @see DiagramNode
|
|
1842
|
+
* @private
|
|
1843
|
+
*/
|
|
1433
1844
|
class StretchNodeAction {
|
|
1434
1845
|
constructor(canvas, nodeId, direction, from, to) {
|
|
1435
1846
|
this.canvas = canvas;
|
|
@@ -1449,6 +1860,11 @@ class StretchNodeAction {
|
|
|
1449
1860
|
?.stretch(this.direction, this.to - this.from);
|
|
1450
1861
|
}
|
|
1451
1862
|
}
|
|
1863
|
+
/**
|
|
1864
|
+
* Action which consists of changing the dimensions of a section in a given direction.
|
|
1865
|
+
* @see DiagramSection
|
|
1866
|
+
* @private
|
|
1867
|
+
*/
|
|
1452
1868
|
class StretchSectionAction {
|
|
1453
1869
|
constructor(canvas, sectionId, direction, from, to) {
|
|
1454
1870
|
this.canvas = canvas;
|
|
@@ -1472,6 +1888,11 @@ class StretchSectionAction {
|
|
|
1472
1888
|
}
|
|
1473
1889
|
}
|
|
1474
1890
|
}
|
|
1891
|
+
/**
|
|
1892
|
+
* Action which consists of adding a connection.
|
|
1893
|
+
* @see DiagramConnection
|
|
1894
|
+
* @private
|
|
1895
|
+
*/
|
|
1475
1896
|
class AddConnectionAction {
|
|
1476
1897
|
constructor(canvas, type, startId, endId, id) {
|
|
1477
1898
|
this.canvas = canvas;
|
|
@@ -1495,6 +1916,11 @@ class AddConnectionAction {
|
|
|
1495
1916
|
}
|
|
1496
1917
|
}
|
|
1497
1918
|
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Action which consists of editing the text of a field.
|
|
1921
|
+
* @see DiagramField
|
|
1922
|
+
* @private
|
|
1923
|
+
*/
|
|
1498
1924
|
class EditFieldAction {
|
|
1499
1925
|
constructor(canvas, fieldId, from, to) {
|
|
1500
1926
|
this.canvas = canvas;
|
|
@@ -1517,6 +1943,11 @@ class EditFieldAction {
|
|
|
1517
1943
|
}
|
|
1518
1944
|
}
|
|
1519
1945
|
}
|
|
1946
|
+
/**
|
|
1947
|
+
* Action which consists of editing the values of a value set.
|
|
1948
|
+
* @see ValueSet
|
|
1949
|
+
* @private
|
|
1950
|
+
*/
|
|
1520
1951
|
class UpdateValuesAction {
|
|
1521
1952
|
constructor(model, id, from, to) {
|
|
1522
1953
|
this.model = model;
|
|
@@ -1539,6 +1970,10 @@ class UpdateValuesAction {
|
|
|
1539
1970
|
this.getValueSet()?.setValues(this.to);
|
|
1540
1971
|
}
|
|
1541
1972
|
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Action which consists of removing elements from a diagram.
|
|
1975
|
+
* @private
|
|
1976
|
+
*/
|
|
1542
1977
|
class RemoveAction {
|
|
1543
1978
|
constructor(model, nodes, sections, ports, connections, fields) {
|
|
1544
1979
|
this.nodes = [];
|
|
@@ -1590,11 +2025,11 @@ class RemoveAction {
|
|
|
1590
2025
|
addIfNotExists(this.connections, connection);
|
|
1591
2026
|
}
|
|
1592
2027
|
}
|
|
1593
|
-
this.nodeIds = this.nodes.map((n) => n.
|
|
1594
|
-
this.sectionIds = this.sections.map((s) => s.
|
|
1595
|
-
this.portIds = this.ports.map((p) => p.
|
|
1596
|
-
this.connectionIds = this.connections.map((c) => c.
|
|
1597
|
-
this.fieldIds = this.fields.map((f) => f.
|
|
2028
|
+
this.nodeIds = this.nodes.map((n) => n.id);
|
|
2029
|
+
this.sectionIds = this.sections.map((s) => s.id);
|
|
2030
|
+
this.portIds = this.ports.map((p) => p.id);
|
|
2031
|
+
this.connectionIds = this.connections.map((c) => c.id);
|
|
2032
|
+
this.fieldIds = this.fields.map((f) => f.id);
|
|
1598
2033
|
}
|
|
1599
2034
|
undo() {
|
|
1600
2035
|
for (const node of this.nodes) {
|
|
@@ -1614,14 +2049,14 @@ class RemoveAction {
|
|
|
1614
2049
|
}
|
|
1615
2050
|
for (const node of this.nodes) {
|
|
1616
2051
|
if (node.label) {
|
|
1617
|
-
const label = this.model.fields.get(node.label.
|
|
2052
|
+
const label = this.model.fields.get(node.label.id);
|
|
1618
2053
|
if (label) {
|
|
1619
2054
|
node.label = label;
|
|
1620
2055
|
}
|
|
1621
2056
|
}
|
|
1622
2057
|
const ports = [];
|
|
1623
2058
|
for (const nodePort of node.ports) {
|
|
1624
|
-
const port = this.model.ports.get(nodePort.
|
|
2059
|
+
const port = this.model.ports.get(nodePort.id);
|
|
1625
2060
|
if (port) {
|
|
1626
2061
|
ports.push(port);
|
|
1627
2062
|
}
|
|
@@ -1629,7 +2064,7 @@ class RemoveAction {
|
|
|
1629
2064
|
node.ports = ports;
|
|
1630
2065
|
const sections = [];
|
|
1631
2066
|
for (const nodeSection of node.sections) {
|
|
1632
|
-
const section = this.model.sections.get(nodeSection.
|
|
2067
|
+
const section = this.model.sections.get(nodeSection.id);
|
|
1633
2068
|
if (section) {
|
|
1634
2069
|
sections.push(section);
|
|
1635
2070
|
}
|
|
@@ -1638,20 +2073,20 @@ class RemoveAction {
|
|
|
1638
2073
|
}
|
|
1639
2074
|
for (const section of this.sections) {
|
|
1640
2075
|
if (section.node) {
|
|
1641
|
-
const node = this.model.nodes.get(section.node.
|
|
2076
|
+
const node = this.model.nodes.get(section.node.id);
|
|
1642
2077
|
if (node) {
|
|
1643
2078
|
section.node = node;
|
|
1644
2079
|
}
|
|
1645
2080
|
}
|
|
1646
2081
|
if (section.label) {
|
|
1647
|
-
const label = this.model.fields.get(section.label.
|
|
2082
|
+
const label = this.model.fields.get(section.label.id);
|
|
1648
2083
|
if (label) {
|
|
1649
2084
|
section.label = label;
|
|
1650
2085
|
}
|
|
1651
2086
|
}
|
|
1652
2087
|
const ports = [];
|
|
1653
2088
|
for (const sectionPort of section.ports) {
|
|
1654
|
-
const port = this.model.ports.get(sectionPort.
|
|
2089
|
+
const port = this.model.ports.get(sectionPort.id);
|
|
1655
2090
|
if (port) {
|
|
1656
2091
|
ports.push(port);
|
|
1657
2092
|
}
|
|
@@ -1660,21 +2095,21 @@ class RemoveAction {
|
|
|
1660
2095
|
}
|
|
1661
2096
|
for (const port of this.ports) {
|
|
1662
2097
|
if (port.rootElement) {
|
|
1663
|
-
const rootElement = this.model.nodes.get(port.rootElement.
|
|
1664
|
-
this.model.sections.get(port.rootElement.
|
|
2098
|
+
const rootElement = this.model.nodes.get(port.rootElement.id) ||
|
|
2099
|
+
this.model.sections.get(port.rootElement.id);
|
|
1665
2100
|
if (rootElement) {
|
|
1666
2101
|
port.rootElement = rootElement;
|
|
1667
2102
|
}
|
|
1668
2103
|
}
|
|
1669
2104
|
if (port.label) {
|
|
1670
|
-
const label = this.model.fields.get(port.label.
|
|
2105
|
+
const label = this.model.fields.get(port.label.id);
|
|
1671
2106
|
if (label) {
|
|
1672
2107
|
port.label = label;
|
|
1673
2108
|
}
|
|
1674
2109
|
}
|
|
1675
2110
|
const outgoingConnections = [];
|
|
1676
2111
|
for (const portOutgoingConnection of port.outgoingConnections) {
|
|
1677
|
-
const connection = this.model.connections.get(portOutgoingConnection.
|
|
2112
|
+
const connection = this.model.connections.get(portOutgoingConnection.id);
|
|
1678
2113
|
if (connection) {
|
|
1679
2114
|
outgoingConnections.push(connection);
|
|
1680
2115
|
}
|
|
@@ -1682,7 +2117,7 @@ class RemoveAction {
|
|
|
1682
2117
|
port.outgoingConnections = outgoingConnections;
|
|
1683
2118
|
const incomingConnections = [];
|
|
1684
2119
|
for (const portIncomingConnection of port.incomingConnections) {
|
|
1685
|
-
const connection = this.model.connections.get(portIncomingConnection.
|
|
2120
|
+
const connection = this.model.connections.get(portIncomingConnection.id);
|
|
1686
2121
|
if (connection) {
|
|
1687
2122
|
incomingConnections.push(connection);
|
|
1688
2123
|
}
|
|
@@ -1691,13 +2126,13 @@ class RemoveAction {
|
|
|
1691
2126
|
}
|
|
1692
2127
|
for (const connection of this.connections) {
|
|
1693
2128
|
if (connection.start) {
|
|
1694
|
-
const start = this.model.ports.get(connection.start.
|
|
2129
|
+
const start = this.model.ports.get(connection.start.id);
|
|
1695
2130
|
if (start) {
|
|
1696
2131
|
connection.setStart(start);
|
|
1697
2132
|
}
|
|
1698
2133
|
}
|
|
1699
2134
|
if (connection.end) {
|
|
1700
|
-
const end = this.model.ports.get(connection.end.
|
|
2135
|
+
const end = this.model.ports.get(connection.end.id);
|
|
1701
2136
|
if (end) {
|
|
1702
2137
|
connection.setEnd(end);
|
|
1703
2138
|
}
|
|
@@ -1705,9 +2140,9 @@ class RemoveAction {
|
|
|
1705
2140
|
}
|
|
1706
2141
|
for (const field of this.fields) {
|
|
1707
2142
|
if (field.rootElement) {
|
|
1708
|
-
const rootElement = this.model.nodes.get(field.rootElement.
|
|
1709
|
-
this.model.sections.get(field.rootElement.
|
|
1710
|
-
this.model.ports.get(field.rootElement.
|
|
2143
|
+
const rootElement = this.model.nodes.get(field.rootElement.id) ||
|
|
2144
|
+
this.model.sections.get(field.rootElement.id) ||
|
|
2145
|
+
this.model.ports.get(field.rootElement.id);
|
|
1711
2146
|
if (rootElement) {
|
|
1712
2147
|
field.rootElement = rootElement;
|
|
1713
2148
|
}
|
|
@@ -1811,6 +2246,7 @@ const clone = (obj) => {
|
|
|
1811
2246
|
|
|
1812
2247
|
/**
|
|
1813
2248
|
* Represents an object which exists as part of a specific diagram model and has a visual representation in a diagram canvas.
|
|
2249
|
+
* @public
|
|
1814
2250
|
* @see DiagramModel
|
|
1815
2251
|
* @see DiagramCanvas
|
|
1816
2252
|
*/
|
|
@@ -1818,18 +2254,23 @@ class DiagramElement {
|
|
|
1818
2254
|
get id() {
|
|
1819
2255
|
return this._id;
|
|
1820
2256
|
}
|
|
1821
|
-
set id(value) {
|
|
1822
|
-
this.select()?.attr('id', value);
|
|
1823
|
-
this._id = value;
|
|
1824
|
-
}
|
|
1825
2257
|
constructor(model, id) {
|
|
2258
|
+
/**
|
|
2259
|
+
* Whether this diagram element is currently highlighted by the user.
|
|
2260
|
+
* @private
|
|
2261
|
+
*/
|
|
1826
2262
|
this.highlighted = false;
|
|
2263
|
+
/**
|
|
2264
|
+
* Whether this diagram element is currently selected by the user.
|
|
2265
|
+
* @private
|
|
2266
|
+
*/
|
|
1827
2267
|
this.selected = false;
|
|
1828
2268
|
this.model = model;
|
|
1829
2269
|
this._id = id;
|
|
1830
2270
|
}
|
|
1831
2271
|
/**
|
|
1832
2272
|
* Obtain the selection of this element.
|
|
2273
|
+
* @private
|
|
1833
2274
|
*/
|
|
1834
2275
|
select() {
|
|
1835
2276
|
return this.model.canvas?.selectCanvasView()?.select(`g#${this.id}`);
|
|
@@ -1837,6 +2278,7 @@ class DiagramElement {
|
|
|
1837
2278
|
}
|
|
1838
2279
|
/**
|
|
1839
2280
|
* Represents a collection of diagram entities of a type that exists as part of a diagram model.
|
|
2281
|
+
* @public
|
|
1840
2282
|
* @see DiagramEntity
|
|
1841
2283
|
* @see DiagramModel
|
|
1842
2284
|
*/
|
|
@@ -1844,21 +2286,25 @@ class DiagramEntitySet {
|
|
|
1844
2286
|
constructor() {
|
|
1845
2287
|
/**
|
|
1846
2288
|
* The list of entities contained in this set.
|
|
2289
|
+
* @private
|
|
1847
2290
|
*/
|
|
1848
2291
|
this.entities = [];
|
|
1849
2292
|
/**
|
|
1850
2293
|
* A mapping of entity ids to their corresponding entity in this set for quickly fetching entities based on their id.
|
|
2294
|
+
* @private
|
|
1851
2295
|
*/
|
|
1852
2296
|
this.entityMap = {};
|
|
1853
2297
|
}
|
|
1854
2298
|
/**
|
|
1855
2299
|
* The number of entities of this set.
|
|
2300
|
+
* @public
|
|
1856
2301
|
*/
|
|
1857
2302
|
get length() {
|
|
1858
2303
|
return this.entities.length;
|
|
1859
2304
|
}
|
|
1860
2305
|
/**
|
|
1861
2306
|
* Gets all of the entities of this set.
|
|
2307
|
+
* @public
|
|
1862
2308
|
* @returns An array containing all of the entities of this set.
|
|
1863
2309
|
*/
|
|
1864
2310
|
all() {
|
|
@@ -1867,6 +2313,7 @@ class DiagramEntitySet {
|
|
|
1867
2313
|
/**
|
|
1868
2314
|
* Adds an entity to this set if there are no entities with the same id. Has no effect if there already exists an entity with the same id as the given entity.
|
|
1869
2315
|
* For creating entities with relationships with other entities, the new() method should be used instead. The add() method adds an entity but doesn't take care of setting that entity's relationships with other entities.
|
|
2316
|
+
* @private
|
|
1870
2317
|
* @param entity An entity to be added to this set.
|
|
1871
2318
|
*/
|
|
1872
2319
|
add(entity) {
|
|
@@ -1877,6 +2324,7 @@ class DiagramEntitySet {
|
|
|
1877
2324
|
}
|
|
1878
2325
|
/**
|
|
1879
2326
|
* Removes all the entities in this set.
|
|
2327
|
+
* @public
|
|
1880
2328
|
*/
|
|
1881
2329
|
clear() {
|
|
1882
2330
|
// remove each entity individually in case classes that extend this implement their own specific cleanup
|
|
@@ -1886,6 +2334,7 @@ class DiagramEntitySet {
|
|
|
1886
2334
|
}
|
|
1887
2335
|
/**
|
|
1888
2336
|
* Checks if this set contains an entity with the given id.
|
|
2337
|
+
* @public
|
|
1889
2338
|
* @param id An id.
|
|
1890
2339
|
* @returns `true` if this set contains an entity with the given id, `false` otherwise.
|
|
1891
2340
|
*/
|
|
@@ -1894,6 +2343,7 @@ class DiagramEntitySet {
|
|
|
1894
2343
|
}
|
|
1895
2344
|
/**
|
|
1896
2345
|
* Gets all of the entities of this set filtered following given criteria.
|
|
2346
|
+
* @public
|
|
1897
2347
|
* @returns An array containing the entities of this set that meet the given criteria.
|
|
1898
2348
|
*/
|
|
1899
2349
|
filter() {
|
|
@@ -1901,6 +2351,7 @@ class DiagramEntitySet {
|
|
|
1901
2351
|
}
|
|
1902
2352
|
/**
|
|
1903
2353
|
* Gets an entity of this set matching specific criteria.
|
|
2354
|
+
* @public
|
|
1904
2355
|
* @returns An entity of this set.
|
|
1905
2356
|
*/
|
|
1906
2357
|
find() {
|
|
@@ -1908,6 +2359,7 @@ class DiagramEntitySet {
|
|
|
1908
2359
|
}
|
|
1909
2360
|
/**
|
|
1910
2361
|
* Gets an entity from this set.
|
|
2362
|
+
* @public
|
|
1911
2363
|
* @param id An id.
|
|
1912
2364
|
* @returns An entity with the given id, or `undefined` if there are no entities with the given id.
|
|
1913
2365
|
*/
|
|
@@ -1916,6 +2368,7 @@ class DiagramEntitySet {
|
|
|
1916
2368
|
}
|
|
1917
2369
|
/**
|
|
1918
2370
|
* Attempts to find and remove an entity with the given id. Has no effect if there are no entities with the given id.
|
|
2371
|
+
* @public
|
|
1919
2372
|
* @param id An id.
|
|
1920
2373
|
*/
|
|
1921
2374
|
remove(id) {
|
|
@@ -1925,6 +2378,10 @@ class DiagramEntitySet {
|
|
|
1925
2378
|
removeIfExists(this.entities, entity);
|
|
1926
2379
|
}
|
|
1927
2380
|
}
|
|
2381
|
+
/**
|
|
2382
|
+
* Iterator to iterate over the entities of this set.
|
|
2383
|
+
* @public
|
|
2384
|
+
*/
|
|
1928
2385
|
*[Symbol.iterator]() {
|
|
1929
2386
|
let counter = 0;
|
|
1930
2387
|
while (counter < this.entities.length) {
|
|
@@ -1934,6 +2391,12 @@ class DiagramEntitySet {
|
|
|
1934
2391
|
}
|
|
1935
2392
|
}
|
|
1936
2393
|
|
|
2394
|
+
/**
|
|
2395
|
+
* A property which is part of a property set and defines what values a value in a value set can take.
|
|
2396
|
+
* @see PropertySet
|
|
2397
|
+
* @see ValueSet
|
|
2398
|
+
* @private
|
|
2399
|
+
*/
|
|
1937
2400
|
class Property {
|
|
1938
2401
|
constructor(name, type, defaultValue, basic, editable, rootAttribute) {
|
|
1939
2402
|
this.name = name;
|
|
@@ -1946,6 +2409,11 @@ class Property {
|
|
|
1946
2409
|
this.properties = undefined;
|
|
1947
2410
|
}
|
|
1948
2411
|
}
|
|
2412
|
+
/**
|
|
2413
|
+
* The type that a property can hvae..
|
|
2414
|
+
* @see Property
|
|
2415
|
+
* @private
|
|
2416
|
+
*/
|
|
1949
2417
|
var Type;
|
|
1950
2418
|
(function (Type) {
|
|
1951
2419
|
/**
|
|
@@ -2001,6 +2469,12 @@ var Type;
|
|
|
2001
2469
|
*/
|
|
2002
2470
|
Type["Url"] = "url";
|
|
2003
2471
|
})(Type || (Type = {}));
|
|
2472
|
+
/**
|
|
2473
|
+
* A set of properties based on which a set of values of those properties can be created.
|
|
2474
|
+
* @see Property
|
|
2475
|
+
* @see ValueSet
|
|
2476
|
+
* @private
|
|
2477
|
+
*/
|
|
2004
2478
|
class PropertySet {
|
|
2005
2479
|
constructor(properties = []) {
|
|
2006
2480
|
this.propertyList = properties;
|
|
@@ -2016,6 +2490,11 @@ class PropertySet {
|
|
|
2016
2490
|
return this.propertyList.length > 0;
|
|
2017
2491
|
}
|
|
2018
2492
|
}
|
|
2493
|
+
/**
|
|
2494
|
+
* A set of values corresponding to a set of properties.
|
|
2495
|
+
* @see PropertySet
|
|
2496
|
+
* @private
|
|
2497
|
+
*/
|
|
2019
2498
|
class ValueSet {
|
|
2020
2499
|
constructor(propertySet, rootElement) {
|
|
2021
2500
|
this.displayedProperties = [];
|
|
@@ -2207,6 +2686,11 @@ const equals = (a, b) => {
|
|
|
2207
2686
|
};
|
|
2208
2687
|
|
|
2209
2688
|
let idTicker$4 = 0;
|
|
2689
|
+
/**
|
|
2690
|
+
* Default values of the parameters of a diagram connection.
|
|
2691
|
+
* @see DiagramConnection
|
|
2692
|
+
* @private
|
|
2693
|
+
*/
|
|
2210
2694
|
const DIAGRAM_CONNECTION_TYPE_DEFAULTS = {
|
|
2211
2695
|
name: '',
|
|
2212
2696
|
width: 1,
|
|
@@ -2221,6 +2705,11 @@ const DIAGRAM_CONNECTION_TYPE_DEFAULTS = {
|
|
|
2221
2705
|
selectedColor: '#000000',
|
|
2222
2706
|
properties: []
|
|
2223
2707
|
};
|
|
2708
|
+
/**
|
|
2709
|
+
* A connection type, which holds properties that connections of this type share in common.
|
|
2710
|
+
* @see ConnectionTypeConfig
|
|
2711
|
+
* @public
|
|
2712
|
+
*/
|
|
2224
2713
|
class DiagramConnectionType {
|
|
2225
2714
|
constructor(options) {
|
|
2226
2715
|
const values = {
|
|
@@ -2248,7 +2737,16 @@ class DiagramConnectionType {
|
|
|
2248
2737
|
return this.endTypes.indexOf(type) >= 0;
|
|
2249
2738
|
}
|
|
2250
2739
|
}
|
|
2740
|
+
/**
|
|
2741
|
+
* A connection which goes from one port to another.
|
|
2742
|
+
* @see DiagramPort
|
|
2743
|
+
* @public
|
|
2744
|
+
*/
|
|
2251
2745
|
class DiagramConnection extends DiagramElement {
|
|
2746
|
+
/**
|
|
2747
|
+
* Name of this connection. Alias for this connection's middle label.
|
|
2748
|
+
* @public
|
|
2749
|
+
*/
|
|
2252
2750
|
get name() {
|
|
2253
2751
|
return this.middleLabel;
|
|
2254
2752
|
}
|
|
@@ -2266,11 +2764,35 @@ class DiagramConnection extends DiagramElement {
|
|
|
2266
2764
|
} while (model.connections.get(uniqueId) !== undefined);
|
|
2267
2765
|
}
|
|
2268
2766
|
super(model, uniqueId);
|
|
2767
|
+
/**
|
|
2768
|
+
* Coordinates of the start point of this connection.
|
|
2769
|
+
* @public
|
|
2770
|
+
*/
|
|
2269
2771
|
this.startCoords = [0, 0];
|
|
2772
|
+
/**
|
|
2773
|
+
* Coordinates of the end point of this connection.
|
|
2774
|
+
* @public
|
|
2775
|
+
*/
|
|
2270
2776
|
this.endCoords = [0, 0];
|
|
2777
|
+
/**
|
|
2778
|
+
* Text at the start of this connection, or `''` if no text.
|
|
2779
|
+
* @public
|
|
2780
|
+
*/
|
|
2271
2781
|
this.startLabel = '';
|
|
2782
|
+
/**
|
|
2783
|
+
* Text at the middle of this connection, or `''` if no text.
|
|
2784
|
+
* @public
|
|
2785
|
+
*/
|
|
2272
2786
|
this.middleLabel = '';
|
|
2787
|
+
/**
|
|
2788
|
+
* Text at the end of this connection, or `''` if no text.
|
|
2789
|
+
* @public
|
|
2790
|
+
*/
|
|
2273
2791
|
this.endLabel = '';
|
|
2792
|
+
/**
|
|
2793
|
+
* Points that this connection passes through.
|
|
2794
|
+
* @public
|
|
2795
|
+
*/
|
|
2274
2796
|
this.points = [];
|
|
2275
2797
|
this.type = type;
|
|
2276
2798
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
@@ -2286,24 +2808,36 @@ class DiagramConnection extends DiagramElement {
|
|
|
2286
2808
|
}
|
|
2287
2809
|
}
|
|
2288
2810
|
setStart(start) {
|
|
2289
|
-
if (this.start !==
|
|
2290
|
-
|
|
2811
|
+
if (this.start !== start) {
|
|
2812
|
+
if (this.start !== undefined) {
|
|
2813
|
+
removeIfExists(this.start.outgoingConnections, this);
|
|
2814
|
+
}
|
|
2815
|
+
this.start = start;
|
|
2816
|
+
if (start !== undefined) {
|
|
2817
|
+
start.outgoingConnections.push(this);
|
|
2818
|
+
this.startDirection = start?.direction;
|
|
2819
|
+
this.startCoords = start?.coords || [0, 0];
|
|
2820
|
+
}
|
|
2291
2821
|
}
|
|
2292
|
-
|
|
2293
|
-
if (start !== undefined) {
|
|
2294
|
-
start.outgoingConnections.push(this);
|
|
2822
|
+
else {
|
|
2295
2823
|
this.startDirection = start?.direction;
|
|
2296
2824
|
this.startCoords = start?.coords || [0, 0];
|
|
2297
2825
|
}
|
|
2298
2826
|
this.updateInView();
|
|
2299
2827
|
}
|
|
2300
2828
|
setEnd(end) {
|
|
2301
|
-
if (this.end !==
|
|
2302
|
-
|
|
2829
|
+
if (this.end !== end) {
|
|
2830
|
+
if (this.end !== undefined) {
|
|
2831
|
+
removeIfExists(this.end.incomingConnections, this);
|
|
2832
|
+
}
|
|
2833
|
+
this.end = end;
|
|
2834
|
+
if (end !== undefined) {
|
|
2835
|
+
end.incomingConnections.push(this);
|
|
2836
|
+
this.endDirection = end?.direction;
|
|
2837
|
+
this.endCoords = end?.coords || [0, 0];
|
|
2838
|
+
}
|
|
2303
2839
|
}
|
|
2304
|
-
|
|
2305
|
-
if (end !== undefined) {
|
|
2306
|
-
end.incomingConnections.push(this);
|
|
2840
|
+
else {
|
|
2307
2841
|
this.endDirection = end?.direction;
|
|
2308
2842
|
this.endCoords = end?.coords || [0, 0];
|
|
2309
2843
|
}
|
|
@@ -2372,6 +2906,11 @@ class DiagramConnectionSet extends DiagramEntitySet {
|
|
|
2372
2906
|
}
|
|
2373
2907
|
|
|
2374
2908
|
let idTicker$3 = 0;
|
|
2909
|
+
/**
|
|
2910
|
+
* Default values of the look of a diagram section.
|
|
2911
|
+
* @see DIAGRAM_SECTION_DEFAULTS
|
|
2912
|
+
* @private
|
|
2913
|
+
*/
|
|
2375
2914
|
const DIAGRAM_SECTION_LOOK_DEFAULTS = {
|
|
2376
2915
|
lookType: 'shaped-look',
|
|
2377
2916
|
shape: ClosedShape.Rectangle,
|
|
@@ -2380,6 +2919,11 @@ const DIAGRAM_SECTION_LOOK_DEFAULTS = {
|
|
|
2380
2919
|
selectedColor: '#FFFFFF',
|
|
2381
2920
|
selectedBorderColor: '#000000'
|
|
2382
2921
|
};
|
|
2922
|
+
/**
|
|
2923
|
+
* Default values of the parameters of a diagram section.
|
|
2924
|
+
* @see DiagramSection
|
|
2925
|
+
* @private
|
|
2926
|
+
*/
|
|
2383
2927
|
const DIAGRAM_SECTION_DEFAULTS = {
|
|
2384
2928
|
sectionsX: 1,
|
|
2385
2929
|
sectionsY: 1,
|
|
@@ -2390,7 +2934,18 @@ const DIAGRAM_SECTION_DEFAULTS = {
|
|
|
2390
2934
|
ports: [],
|
|
2391
2935
|
look: DIAGRAM_SECTION_LOOK_DEFAULTS
|
|
2392
2936
|
};
|
|
2937
|
+
/**
|
|
2938
|
+
* A section of a node which can have connections and display a property of the node.
|
|
2939
|
+
* @see DiagramConnection
|
|
2940
|
+
* @see DiagramNode
|
|
2941
|
+
* @see DiagramPort
|
|
2942
|
+
* @public
|
|
2943
|
+
*/
|
|
2393
2944
|
class DiagramSection extends DiagramElement {
|
|
2945
|
+
/**
|
|
2946
|
+
* Name of this section. Alias for this section's label's text.
|
|
2947
|
+
* @public
|
|
2948
|
+
*/
|
|
2394
2949
|
get name() {
|
|
2395
2950
|
return this.label?.text || '';
|
|
2396
2951
|
}
|
|
@@ -2411,6 +2966,10 @@ class DiagramSection extends DiagramElement {
|
|
|
2411
2966
|
} while (model.sections.get(uniqueId) !== undefined);
|
|
2412
2967
|
}
|
|
2413
2968
|
super(model, uniqueId);
|
|
2969
|
+
/**
|
|
2970
|
+
* Ports of this section.
|
|
2971
|
+
* @public
|
|
2972
|
+
*/
|
|
2414
2973
|
this.ports = [];
|
|
2415
2974
|
this.node = node;
|
|
2416
2975
|
this.coords = coords;
|
|
@@ -2677,6 +3236,11 @@ class DiagramSectionSet extends DiagramEntitySet {
|
|
|
2677
3236
|
}
|
|
2678
3237
|
|
|
2679
3238
|
let idTicker$2 = 0;
|
|
3239
|
+
/**
|
|
3240
|
+
* Default values of the look of a diagram node.
|
|
3241
|
+
* @see DIAGRAM_NODE_TYPE_DEFAULTS
|
|
3242
|
+
* @private
|
|
3243
|
+
*/
|
|
2680
3244
|
const DIAGRAM_NODE_LOOK_DEFAULTS = {
|
|
2681
3245
|
lookType: 'shaped-look',
|
|
2682
3246
|
shape: ClosedShape.Rectangle,
|
|
@@ -2685,6 +3249,11 @@ const DIAGRAM_NODE_LOOK_DEFAULTS = {
|
|
|
2685
3249
|
selectedColor: '#FFFFFF',
|
|
2686
3250
|
selectedBorderColor: '#000000'
|
|
2687
3251
|
};
|
|
3252
|
+
/**
|
|
3253
|
+
* Default values of the parameters of a diagram node.
|
|
3254
|
+
* @see DiagramNode
|
|
3255
|
+
* @private
|
|
3256
|
+
*/
|
|
2688
3257
|
const DIAGRAM_NODE_TYPE_DEFAULTS = {
|
|
2689
3258
|
name: '',
|
|
2690
3259
|
defaultWidth: 0,
|
|
@@ -2701,6 +3270,11 @@ const DIAGRAM_NODE_TYPE_DEFAULTS = {
|
|
|
2701
3270
|
priority: 0,
|
|
2702
3271
|
properties: []
|
|
2703
3272
|
};
|
|
3273
|
+
/**
|
|
3274
|
+
* A node type, which holds properties that nodes of this type share in common.
|
|
3275
|
+
* @see NodeTypeConfig
|
|
3276
|
+
* @public
|
|
3277
|
+
*/
|
|
2704
3278
|
class DiagramNodeType {
|
|
2705
3279
|
constructor(options) {
|
|
2706
3280
|
const values = {
|
|
@@ -2724,7 +3298,18 @@ class DiagramNodeType {
|
|
|
2724
3298
|
this.propertySet = new PropertySet(options?.properties || []);
|
|
2725
3299
|
}
|
|
2726
3300
|
}
|
|
3301
|
+
/**
|
|
3302
|
+
* A node, the most basic element of a diagram, which can have connections to other nodes through its ports or be divided into sections.
|
|
3303
|
+
* @see DiagramConnection
|
|
3304
|
+
* @see DiagramPort
|
|
3305
|
+
* @see DiagramSection
|
|
3306
|
+
* @public
|
|
3307
|
+
*/
|
|
2727
3308
|
class DiagramNode extends DiagramElement {
|
|
3309
|
+
/**
|
|
3310
|
+
* Name of this node. Alias for this node's label's text.
|
|
3311
|
+
* @public
|
|
3312
|
+
*/
|
|
2728
3313
|
get name() {
|
|
2729
3314
|
return this.label?.text || '';
|
|
2730
3315
|
}
|
|
@@ -2745,7 +3330,15 @@ class DiagramNode extends DiagramElement {
|
|
|
2745
3330
|
} while (model.nodes.get(uniqueId) !== undefined);
|
|
2746
3331
|
}
|
|
2747
3332
|
super(model, uniqueId);
|
|
3333
|
+
/**
|
|
3334
|
+
* Sections of this node.
|
|
3335
|
+
* @public
|
|
3336
|
+
*/
|
|
2748
3337
|
this.sections = [];
|
|
3338
|
+
/**
|
|
3339
|
+
* Ports of this node.
|
|
3340
|
+
* @public
|
|
3341
|
+
*/
|
|
2749
3342
|
this.ports = [];
|
|
2750
3343
|
this.type = type;
|
|
2751
3344
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
@@ -3075,11 +3668,23 @@ class DiagramNodeSet extends DiagramEntitySet {
|
|
|
3075
3668
|
}
|
|
3076
3669
|
|
|
3077
3670
|
let idTicker$1 = 0;
|
|
3671
|
+
/**
|
|
3672
|
+
* Default values of the parameters of a diagram port.
|
|
3673
|
+
* @see DiagramPort
|
|
3674
|
+
* @private
|
|
3675
|
+
*/
|
|
3078
3676
|
const DIAGRAM_PORT_DEFAULTS = {
|
|
3079
3677
|
radius: 12,
|
|
3080
3678
|
highlightedColor: 'cyan',
|
|
3081
3679
|
selectedColor: 'violet'
|
|
3082
3680
|
};
|
|
3681
|
+
/**
|
|
3682
|
+
* A port which is part of a node or section and at which connections can start or end.
|
|
3683
|
+
* @see DiagramConnection
|
|
3684
|
+
* @see DiagramNode
|
|
3685
|
+
* @see DiagramSection
|
|
3686
|
+
* @public
|
|
3687
|
+
*/
|
|
3083
3688
|
class DiagramPort extends DiagramElement {
|
|
3084
3689
|
constructor(model, rootElement, coords, direction, id) {
|
|
3085
3690
|
let uniqueId;
|
|
@@ -3092,7 +3697,15 @@ class DiagramPort extends DiagramElement {
|
|
|
3092
3697
|
} while (model.ports.get(uniqueId) !== undefined);
|
|
3093
3698
|
}
|
|
3094
3699
|
super(model, uniqueId);
|
|
3700
|
+
/**
|
|
3701
|
+
* Connections that start at this port.
|
|
3702
|
+
* @public
|
|
3703
|
+
*/
|
|
3095
3704
|
this.outgoingConnections = [];
|
|
3705
|
+
/**
|
|
3706
|
+
* Connections that end at this port.
|
|
3707
|
+
* @public
|
|
3708
|
+
*/
|
|
3096
3709
|
this.incomingConnections = [];
|
|
3097
3710
|
this.rootElement = rootElement;
|
|
3098
3711
|
this.coords = coords;
|
|
@@ -3209,6 +3822,11 @@ class DiagramPortSet extends DiagramEntitySet {
|
|
|
3209
3822
|
}
|
|
3210
3823
|
|
|
3211
3824
|
let idTicker = 0;
|
|
3825
|
+
/**
|
|
3826
|
+
* Default values of the parameters of a diagram field.
|
|
3827
|
+
* @see DiagramField
|
|
3828
|
+
* @private
|
|
3829
|
+
*/
|
|
3212
3830
|
const DIAGRAM_FIELD_DEFAULTS = {
|
|
3213
3831
|
editable: true,
|
|
3214
3832
|
fontSize: 0,
|
|
@@ -3220,7 +3838,18 @@ const DIAGRAM_FIELD_DEFAULTS = {
|
|
|
3220
3838
|
horizontalAlign: HorizontalAlign.Center,
|
|
3221
3839
|
verticalAlign: VerticalAlign.Center
|
|
3222
3840
|
};
|
|
3841
|
+
/**
|
|
3842
|
+
* A field which displays text and is part of a diagram element.
|
|
3843
|
+
* @see DiagramNode
|
|
3844
|
+
* @see DiagramPort
|
|
3845
|
+
* @see DiagramSection
|
|
3846
|
+
* @public
|
|
3847
|
+
*/
|
|
3223
3848
|
class DiagramField extends DiagramElement {
|
|
3849
|
+
/**
|
|
3850
|
+
* Text contents of this field.
|
|
3851
|
+
* @public
|
|
3852
|
+
*/
|
|
3224
3853
|
get text() {
|
|
3225
3854
|
return this._text;
|
|
3226
3855
|
}
|
|
@@ -3330,23 +3959,46 @@ class DiagramFieldSet extends DiagramEntitySet {
|
|
|
3330
3959
|
}
|
|
3331
3960
|
}
|
|
3332
3961
|
|
|
3962
|
+
/**
|
|
3963
|
+
* Stores the data of a diagram.
|
|
3964
|
+
* @public
|
|
3965
|
+
*/
|
|
3333
3966
|
class DiagramModel {
|
|
3334
|
-
// canvas attribute accesors
|
|
3335
|
-
// added so that the valueSet can access canvas attributes and change them
|
|
3336
|
-
get layoutFormat() {
|
|
3337
|
-
return this.canvas?.layoutFormat;
|
|
3338
|
-
}
|
|
3339
|
-
set layoutFormat(value) {
|
|
3340
|
-
if (this.canvas) {
|
|
3341
|
-
this.canvas.layoutFormat = value;
|
|
3342
|
-
}
|
|
3343
|
-
}
|
|
3344
3967
|
constructor(canvas, id, name, description, type, properties = []) {
|
|
3968
|
+
/**
|
|
3969
|
+
* Whether changes to this model are updated in the canvas in real time.
|
|
3970
|
+
* @private
|
|
3971
|
+
*/
|
|
3345
3972
|
this.renderToCanvas = true;
|
|
3973
|
+
/**
|
|
3974
|
+
* Nodes of this model.
|
|
3975
|
+
* @see DiagramNode
|
|
3976
|
+
* @public
|
|
3977
|
+
*/
|
|
3346
3978
|
this.nodes = new DiagramNodeSet(this);
|
|
3979
|
+
/**
|
|
3980
|
+
* Sections of this model.
|
|
3981
|
+
* @see DiagramSection
|
|
3982
|
+
* @public
|
|
3983
|
+
*/
|
|
3347
3984
|
this.sections = new DiagramSectionSet(this);
|
|
3985
|
+
/**
|
|
3986
|
+
* Ports of this model.
|
|
3987
|
+
* @see DiagramPort
|
|
3988
|
+
* @public
|
|
3989
|
+
*/
|
|
3348
3990
|
this.ports = new DiagramPortSet(this);
|
|
3991
|
+
/**
|
|
3992
|
+
* Connections of this model.
|
|
3993
|
+
* @see DiagramConnection
|
|
3994
|
+
* @public
|
|
3995
|
+
*/
|
|
3349
3996
|
this.connections = new DiagramConnectionSet(this);
|
|
3997
|
+
/**
|
|
3998
|
+
* Fields of this model.
|
|
3999
|
+
* @see DiagramField
|
|
4000
|
+
* @public
|
|
4001
|
+
*/
|
|
3350
4002
|
this.fields = new DiagramFieldSet(this);
|
|
3351
4003
|
this.canvas = canvas;
|
|
3352
4004
|
this.id = id;
|
|
@@ -3357,15 +4009,25 @@ class DiagramModel {
|
|
|
3357
4009
|
this.updatedAt = new Date();
|
|
3358
4010
|
this.valueSet = new ValueSet(new PropertySet(properties), this);
|
|
3359
4011
|
}
|
|
4012
|
+
/**
|
|
4013
|
+
* Enables rendering to canvas in real time and updates the view of this model in the canvas.
|
|
4014
|
+
* @public
|
|
4015
|
+
*/
|
|
3360
4016
|
enableRenderToCanvas() {
|
|
3361
4017
|
this.renderToCanvas = true;
|
|
3362
4018
|
this.canvas?.updateModelInView();
|
|
3363
4019
|
}
|
|
4020
|
+
/**
|
|
4021
|
+
* Disables rendering to canvas in real time.
|
|
4022
|
+
* Used to perform batches of changes to the model without the computational cost of rendering each change to the canvas individually.
|
|
4023
|
+
* @public
|
|
4024
|
+
*/
|
|
3364
4025
|
disableRenderToCanvas() {
|
|
3365
4026
|
this.renderToCanvas = false;
|
|
3366
4027
|
}
|
|
3367
4028
|
/**
|
|
3368
4029
|
* Deletes everything in this diagram.
|
|
4030
|
+
* @public
|
|
3369
4031
|
*/
|
|
3370
4032
|
clear() {
|
|
3371
4033
|
this.id = undefined;
|
|
@@ -3388,20 +4050,24 @@ class DiagramModel {
|
|
|
3388
4050
|
|
|
3389
4051
|
/**
|
|
3390
4052
|
* Thickness of the invisible path around a connection used to make it easier to click on, in pixels.
|
|
4053
|
+
* @private
|
|
3391
4054
|
*/
|
|
3392
4055
|
const CONNECTION_PATH_BOX_THICKNESS = 12;
|
|
3393
4056
|
/**
|
|
3394
4057
|
* Thickness of the resizer line used to resize nodes and sections on drag, in pixels.
|
|
4058
|
+
* @private
|
|
3395
4059
|
*/
|
|
3396
4060
|
const RESIZER_THICKNESS = 6;
|
|
3397
4061
|
/**
|
|
3398
4062
|
* Text to display as the title of the property editor when editing this diagram's properties.
|
|
3399
4063
|
* @see PropertyEditorComponent
|
|
4064
|
+
* @private
|
|
3400
4065
|
*/
|
|
3401
4066
|
const DIAGRAM_PROPERTIES_TEXT = 'Diagram properties';
|
|
3402
4067
|
/**
|
|
3403
4068
|
* Maximum number of user actions that can be recorded in the user action queue.
|
|
3404
4069
|
* @see ActionQueue
|
|
4070
|
+
* @private
|
|
3405
4071
|
*/
|
|
3406
4072
|
const ACTION_QUEUE_SIZE = 25;
|
|
3407
4073
|
class DiagramCanvas {
|
|
@@ -5507,6 +6173,11 @@ class DiagramCanvas {
|
|
|
5507
6173
|
this.inputFieldContainer = undefined;
|
|
5508
6174
|
}
|
|
5509
6175
|
}
|
|
6176
|
+
/**
|
|
6177
|
+
* Get the SVG path of a diagram connection.
|
|
6178
|
+
* @see linePath
|
|
6179
|
+
* @private
|
|
6180
|
+
*/
|
|
5510
6181
|
const getConnectionPath = (connection) => {
|
|
5511
6182
|
return linePath(connection.type.shape, [connection.startCoords, connection.endCoords], connection.startDirection, connection.endDirection, Math.max(
|
|
5512
6183
|
// reasonable value for the minimumDistanceBeforeTurn relative to the line width
|
|
@@ -5515,14 +6186,31 @@ const getConnectionPath = (connection) => {
|
|
|
5515
6186
|
|
|
5516
6187
|
/**
|
|
5517
6188
|
* A provider for the {@link Canvas} associated with a {@link DiagramComponent} context.
|
|
6189
|
+
* @public
|
|
5518
6190
|
*/
|
|
5519
6191
|
class CanvasProviderService {
|
|
6192
|
+
/**
|
|
6193
|
+
* Initialize the diagram canvas object of this context.
|
|
6194
|
+
* @private
|
|
6195
|
+
* @param parentComponent A diagram editor.
|
|
6196
|
+
* @param config A diagram configuration.
|
|
6197
|
+
*/
|
|
5520
6198
|
initCanvas(parentComponent, config) {
|
|
5521
6199
|
this._canvas = new DiagramCanvas(parentComponent, config);
|
|
5522
6200
|
}
|
|
6201
|
+
/**
|
|
6202
|
+
* Attach the canvas of this context to an HTML Element to render it there.
|
|
6203
|
+
* @private
|
|
6204
|
+
* @param appendTo An HTML Element.
|
|
6205
|
+
*/
|
|
5523
6206
|
initCanvasView(appendTo) {
|
|
5524
6207
|
this._canvas.initView(appendTo);
|
|
5525
6208
|
}
|
|
6209
|
+
/**
|
|
6210
|
+
* Get the diagram canvas of this context.
|
|
6211
|
+
* @public
|
|
6212
|
+
* @returns A diagram canvas.
|
|
6213
|
+
*/
|
|
5526
6214
|
getCanvas() {
|
|
5527
6215
|
return this._canvas;
|
|
5528
6216
|
}
|
|
@@ -5533,6 +6221,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
5533
6221
|
type: Injectable
|
|
5534
6222
|
}] });
|
|
5535
6223
|
|
|
6224
|
+
/**
|
|
6225
|
+
* Buttons used to trigger diagram functionalities by the user.
|
|
6226
|
+
* @private
|
|
6227
|
+
*/
|
|
5536
6228
|
class DiagramButtonsComponent {
|
|
5537
6229
|
get canvas() {
|
|
5538
6230
|
return this.canvasProvider.getCanvas();
|
|
@@ -5634,6 +6326,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
5634
6326
|
type: Input
|
|
5635
6327
|
}] } });
|
|
5636
6328
|
|
|
6329
|
+
/**
|
|
6330
|
+
* Displays the errors detected by a diagram's validators.
|
|
6331
|
+
* @see DiagramValidator
|
|
6332
|
+
* @private
|
|
6333
|
+
*/
|
|
5637
6334
|
class ErrorsComponent {
|
|
5638
6335
|
get canvas() {
|
|
5639
6336
|
return this.canvasProvider.getCanvas();
|
|
@@ -5683,6 +6380,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
5683
6380
|
args: ['errors']
|
|
5684
6381
|
}] } });
|
|
5685
6382
|
|
|
6383
|
+
/**
|
|
6384
|
+
* Palette that the user can drag and drop nodes from.
|
|
6385
|
+
* @see DiagramConfig
|
|
6386
|
+
* @see DiagramNode
|
|
6387
|
+
* @private
|
|
6388
|
+
*/
|
|
5686
6389
|
class PaletteComponent {
|
|
5687
6390
|
get canvas() {
|
|
5688
6391
|
return this.canvasProvider.getCanvas();
|
|
@@ -6050,6 +6753,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
6050
6753
|
type: Input
|
|
6051
6754
|
}] } });
|
|
6052
6755
|
|
|
6756
|
+
/**
|
|
6757
|
+
* Editor of a property of text list type within a property editor.
|
|
6758
|
+
* @see TextList
|
|
6759
|
+
* @see PropertyEditor
|
|
6760
|
+
* @see ValueSet
|
|
6761
|
+
* @private
|
|
6762
|
+
*/
|
|
6053
6763
|
class TextListEditorComponent {
|
|
6054
6764
|
set value(val) {
|
|
6055
6765
|
if (val === this._value) {
|
|
@@ -6120,6 +6830,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
6120
6830
|
type: Output
|
|
6121
6831
|
}] } });
|
|
6122
6832
|
|
|
6833
|
+
/**
|
|
6834
|
+
* Editor of a property of text map type within a property editor.
|
|
6835
|
+
* @see TextMap
|
|
6836
|
+
* @see PropertyEditor
|
|
6837
|
+
* @see ValueSet
|
|
6838
|
+
* @private
|
|
6839
|
+
*/
|
|
6123
6840
|
class TextMapEditorComponent {
|
|
6124
6841
|
set value(val) {
|
|
6125
6842
|
if (val === this._value) {
|
|
@@ -6198,6 +6915,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
6198
6915
|
type: Output
|
|
6199
6916
|
}] } });
|
|
6200
6917
|
|
|
6918
|
+
/**
|
|
6919
|
+
* Editor of a value set within a property editor.
|
|
6920
|
+
* @see PropertyEditor
|
|
6921
|
+
* @see ValueSet
|
|
6922
|
+
* @private
|
|
6923
|
+
*/
|
|
6201
6924
|
class ObjectEditorComponent {
|
|
6202
6925
|
get canvas() {
|
|
6203
6926
|
return this.canvasProvider.getCanvas();
|
|
@@ -6216,7 +6939,7 @@ class ObjectEditorComponent {
|
|
|
6216
6939
|
constructor(cdr, canvasProvider) {
|
|
6217
6940
|
this.cdr = cdr;
|
|
6218
6941
|
this.canvasProvider = canvasProvider;
|
|
6219
|
-
/** How many object-editors are parents of this object-editor */
|
|
6942
|
+
/** How many object-editors are parents of this object-editor. @private */
|
|
6220
6943
|
this.depth = 0;
|
|
6221
6944
|
// Attributes for the template
|
|
6222
6945
|
this.Type = Type;
|
|
@@ -6299,6 +7022,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
6299
7022
|
type: Input
|
|
6300
7023
|
}] } });
|
|
6301
7024
|
|
|
7025
|
+
/**
|
|
7026
|
+
* Editor of the values of a value set.
|
|
7027
|
+
* @see ValueSet
|
|
7028
|
+
* @private
|
|
7029
|
+
*/
|
|
6302
7030
|
class PropertyEditorComponent {
|
|
6303
7031
|
get valueSet() {
|
|
6304
7032
|
return this._valueSet;
|
|
@@ -6347,11 +7075,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
6347
7075
|
|
|
6348
7076
|
/**
|
|
6349
7077
|
* A provider for the {@link DiagramConfig} associated with a {@link DiagramComponent} context.
|
|
7078
|
+
* @public
|
|
6350
7079
|
*/
|
|
6351
7080
|
class DagaConfigurationService {
|
|
7081
|
+
/**
|
|
7082
|
+
* Set the diagram configuration of this context.
|
|
7083
|
+
* @private
|
|
7084
|
+
* @param config A diagram configuration.
|
|
7085
|
+
*/
|
|
6352
7086
|
init(config) {
|
|
6353
7087
|
this._config = config;
|
|
6354
7088
|
}
|
|
7089
|
+
/**
|
|
7090
|
+
* Get the diagram configuration of this context.
|
|
7091
|
+
* @public
|
|
7092
|
+
* @returns A diagram configuration.
|
|
7093
|
+
*/
|
|
6355
7094
|
getConfig() {
|
|
6356
7095
|
return this._config;
|
|
6357
7096
|
}
|
|
@@ -6362,6 +7101,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
6362
7101
|
type: Injectable
|
|
6363
7102
|
}] });
|
|
6364
7103
|
|
|
7104
|
+
/**
|
|
7105
|
+
* A diagram's user interface editor.
|
|
7106
|
+
* @private
|
|
7107
|
+
*/
|
|
6365
7108
|
class DiagramEditorComponent {
|
|
6366
7109
|
get config() {
|
|
6367
7110
|
return this.configurationService.getConfig();
|
|
@@ -6409,6 +7152,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
6409
7152
|
/**
|
|
6410
7153
|
* The context of a diagram. Every separate diagram must be contained within its own {@link DiagramComponent} and every {@link DiagramComponent} must contain its own {@link DiagramEditorComponent}.
|
|
6411
7154
|
* This component defines a {@link DagaConfigurationService} and a {@link CanvasProviderService}, which is shared by all the components within and allows accessing the configuration and the canvas of this component's diagram, respectively.
|
|
7155
|
+
* @public
|
|
6412
7156
|
*/
|
|
6413
7157
|
class DiagramComponent {
|
|
6414
7158
|
constructor(configurationService, canvasProvider) {
|
|
@@ -6487,6 +7231,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
6487
7231
|
|
|
6488
7232
|
const DAGA_FILE_VERSION = 1;
|
|
6489
7233
|
|
|
7234
|
+
/**
|
|
7235
|
+
* Importer which exports a diagram to its daga model representation.
|
|
7236
|
+
* @public
|
|
7237
|
+
*/
|
|
6490
7238
|
class DagaExporter {
|
|
6491
7239
|
export(model) {
|
|
6492
7240
|
const result = {
|
|
@@ -6563,6 +7311,10 @@ class DagaExporter {
|
|
|
6563
7311
|
}
|
|
6564
7312
|
}
|
|
6565
7313
|
|
|
7314
|
+
/**
|
|
7315
|
+
* Importer which imports a diagram from its daga model representation.
|
|
7316
|
+
* @public
|
|
7317
|
+
*/
|
|
6566
7318
|
class DagaImporter {
|
|
6567
7319
|
import(model, data) {
|
|
6568
7320
|
// clear the model beforehand
|