@metadev/daga 1.1.0 → 1.3.0
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 +29 -1
- package/README.md +1 -1
- package/assets/fonts/DMMono-Medium.ttf +0 -0
- package/assets/fonts/DMMono-Medium.woff +0 -0
- package/assets/fonts/DMMono-Medium.woff2 +0 -0
- package/assets/fonts/WonderUnitSans-Medium.ttf +0 -0
- package/assets/fonts/WonderUnitSans-Medium.woff +0 -0
- package/assets/fonts/WonderUnitSans-Medium.woff2 +0 -0
- package/assets/styles/_collapse-button.scss +37 -0
- package/assets/styles/_diagram-buttons.scss +132 -0
- package/assets/styles/_diagram.scss +15 -0
- package/assets/styles/_errors.scss +83 -0
- package/assets/styles/_palette.scss +12 -0
- package/assets/styles/_property-editor.scss +160 -0
- package/assets/styles/daga.scss +152 -0
- package/fesm2022/metadev-daga.mjs +1174 -279
- package/fesm2022/metadev-daga.mjs.map +1 -1
- package/index.d.ts +16 -7
- package/lib/collapse-button/collapse-button.component.d.ts +5 -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 +77 -2
- package/lib/diagram-editor/diagram/diagram-canvas.d.ts +8 -1
- package/lib/diagram-editor/diagram/diagram-config.d.ts +26 -0
- 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 +59 -1
- 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 +48 -1
- 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 +50 -0
- 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 +8 -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
- package/assets/styles/styles.scss +0 -181
|
@@ -7,35 +7,111 @@ import * as i4 from '@angular/forms';
|
|
|
7
7
|
import { FormsModule } from '@angular/forms';
|
|
8
8
|
import * as i3 from '@metadev/lux';
|
|
9
9
|
import { LuxModule } from '@metadev/lux';
|
|
10
|
-
import { Subject, delay, map
|
|
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;
|
|
@@ -71,12 +147,56 @@ class CollapseButtonComponent {
|
|
|
71
147
|
selection.style(this.rule, this.collapsed ? this.collapsedValue : this.visibleValue);
|
|
72
148
|
}
|
|
73
149
|
}
|
|
74
|
-
|
|
75
|
-
|
|
150
|
+
getClass() {
|
|
151
|
+
switch (this.direction) {
|
|
152
|
+
case Side.Right:
|
|
153
|
+
if (this.disabled) {
|
|
154
|
+
return 'horizontal-none';
|
|
155
|
+
}
|
|
156
|
+
else if (this.collapsed) {
|
|
157
|
+
return 'horizontal-right';
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return 'horizontal-left';
|
|
161
|
+
}
|
|
162
|
+
case Side.Bottom:
|
|
163
|
+
if (this.disabled) {
|
|
164
|
+
return 'vertical-none';
|
|
165
|
+
}
|
|
166
|
+
else if (this.collapsed) {
|
|
167
|
+
return 'vertical-down';
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
return 'vertical-up';
|
|
171
|
+
}
|
|
172
|
+
case Side.Left:
|
|
173
|
+
if (this.disabled) {
|
|
174
|
+
return 'horizontal-none';
|
|
175
|
+
}
|
|
176
|
+
else if (this.collapsed) {
|
|
177
|
+
return 'horizontal-left';
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
return 'horizontal-right';
|
|
181
|
+
}
|
|
182
|
+
case Side.Top:
|
|
183
|
+
if (this.disabled) {
|
|
184
|
+
return 'vertical-none';
|
|
185
|
+
}
|
|
186
|
+
else if (this.collapsed) {
|
|
187
|
+
return 'vertical-up';
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
return 'vertical-down';
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CollapseButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
195
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: CollapseButtonComponent, isStandalone: true, selector: "daga-collapse-button", inputs: { collapsableSelector: "collapsableSelector", collapsableAdditionalSelector: "collapsableAdditionalSelector", collapsed: "collapsed", disabled: "disabled", direction: "direction", rule: "rule", collapsedValue: "collapsedValue", visibleValue: "visibleValue" }, ngImport: i0, template: "<button class=\"collapse-button {{ direction }}\" (click)=\"toggleCollapse()\">\n <div [class]=\"getClass()\"></div>\n</button>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }] }); }
|
|
76
196
|
}
|
|
77
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CollapseButtonComponent, decorators: [{
|
|
78
198
|
type: Component,
|
|
79
|
-
args: [{ standalone: true, selector: 'daga-collapse-button', imports: [CommonModule], template: "<button class=\"collapse-button {{ direction }}\" (click)=\"toggleCollapse()\">\n <
|
|
199
|
+
args: [{ standalone: true, selector: 'daga-collapse-button', imports: [CommonModule], template: "<button class=\"collapse-button {{ direction }}\" (click)=\"toggleCollapse()\">\n <div [class]=\"getClass()\"></div>\n</button>\n" }]
|
|
80
200
|
}], propDecorators: { collapsableSelector: [{
|
|
81
201
|
type: Input
|
|
82
202
|
}], collapsableAdditionalSelector: [{
|
|
@@ -95,41 +215,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
95
215
|
type: Input
|
|
96
216
|
}] } });
|
|
97
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
|
+
*/
|
|
98
222
|
class Grid {
|
|
99
223
|
constructor() {
|
|
100
224
|
this.grid = [[undefined]];
|
|
101
225
|
this.offsetX = 0;
|
|
102
226
|
this.offsetY = 0;
|
|
103
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Get the minimum x coordinate among the elements in the grid.
|
|
230
|
+
*/
|
|
104
231
|
minX() {
|
|
105
232
|
return -this.offsetX;
|
|
106
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Get the maximum x coordinate among the elements in the grid.
|
|
236
|
+
*/
|
|
107
237
|
maxX() {
|
|
108
238
|
return this.width() - 1 - this.offsetX;
|
|
109
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Get the minimum y coordinate among the elements in the grid.
|
|
242
|
+
*/
|
|
110
243
|
minY() {
|
|
111
244
|
return -this.offsetY;
|
|
112
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Get the maximum y coordinate among the elements in the grid.
|
|
248
|
+
*/
|
|
113
249
|
maxY() {
|
|
114
250
|
return this.height() - 1 - this.offsetY;
|
|
115
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Get the total extension of the grid along the x axis.
|
|
254
|
+
*/
|
|
116
255
|
width() {
|
|
117
256
|
return this.grid[0].length;
|
|
118
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Get the total extension of the grid along the y axis.
|
|
260
|
+
*/
|
|
119
261
|
height() {
|
|
120
262
|
return this.grid.length;
|
|
121
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Add a new column at the start of the x axis.
|
|
266
|
+
*/
|
|
122
267
|
addColumnLeft() {
|
|
123
268
|
for (const row of this.grid) {
|
|
124
269
|
row.splice(0, 0, undefined);
|
|
125
270
|
}
|
|
126
271
|
this.offsetX = this.offsetX + 1;
|
|
127
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Add a new column at the end of the x axis.
|
|
275
|
+
*/
|
|
128
276
|
addColumnRight() {
|
|
129
277
|
for (const row of this.grid) {
|
|
130
278
|
row.push(undefined);
|
|
131
279
|
}
|
|
132
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Add a new row at the start of the y axis.
|
|
283
|
+
*/
|
|
133
284
|
addRowTop() {
|
|
134
285
|
const newRow = [];
|
|
135
286
|
for (let i = 0; i < this.grid[0].length; ++i) {
|
|
@@ -138,6 +289,9 @@ class Grid {
|
|
|
138
289
|
this.grid.splice(0, 0, newRow);
|
|
139
290
|
this.offsetY = this.offsetY + 1;
|
|
140
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Add a new row at the end of the y axis.
|
|
294
|
+
*/
|
|
141
295
|
addRowBottom() {
|
|
142
296
|
const newRow = [];
|
|
143
297
|
for (let i = 0; i < this.grid[0].length; ++i) {
|
|
@@ -145,12 +299,18 @@ class Grid {
|
|
|
145
299
|
}
|
|
146
300
|
this.grid.push(newRow);
|
|
147
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Get the element at the given coordinates or undefined if there is no element at the given coordinates.
|
|
304
|
+
*/
|
|
148
305
|
get(coords) {
|
|
149
306
|
if (this.grid[coords[1] + this.offsetY]) {
|
|
150
307
|
return this.grid[coords[1] + this.offsetY][coords[0] + this.offsetX];
|
|
151
308
|
}
|
|
152
309
|
return undefined;
|
|
153
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Set the element at the given coordinates to the given element.
|
|
313
|
+
*/
|
|
154
314
|
set(coords, value) {
|
|
155
315
|
while (coords[0] < -this.offsetX) {
|
|
156
316
|
this.addColumnLeft();
|
|
@@ -166,6 +326,9 @@ class Grid {
|
|
|
166
326
|
}
|
|
167
327
|
this.grid[coords[1] + this.offsetY][coords[0] + this.offsetX] = value;
|
|
168
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* Get the closest coordinates to the given coordinates that are not set to an element.
|
|
331
|
+
*/
|
|
169
332
|
getClosestEmptyCoordinate(coords) {
|
|
170
333
|
if (this.get(coords) === undefined) {
|
|
171
334
|
return coords;
|
|
@@ -192,6 +355,13 @@ class Grid {
|
|
|
192
355
|
}
|
|
193
356
|
}
|
|
194
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
|
+
*/
|
|
195
365
|
const removeIfExists = (arr, obj) => {
|
|
196
366
|
const index = arr.indexOf(obj);
|
|
197
367
|
if (index >= 0) {
|
|
@@ -199,6 +369,13 @@ const removeIfExists = (arr, obj) => {
|
|
|
199
369
|
}
|
|
200
370
|
return arr;
|
|
201
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
|
+
*/
|
|
202
379
|
const addIfNotExists = (arr, obj) => {
|
|
203
380
|
if (!arr.includes(obj)) {
|
|
204
381
|
arr.push(obj);
|
|
@@ -208,6 +385,7 @@ const addIfNotExists = (arr, obj) => {
|
|
|
208
385
|
|
|
209
386
|
/**
|
|
210
387
|
* A layout which places adjacent nodes close by, placing nodes in order according to depth first search.
|
|
388
|
+
* @public
|
|
211
389
|
*/
|
|
212
390
|
class AdjacencyLayout {
|
|
213
391
|
apply(model) {
|
|
@@ -254,6 +432,7 @@ const arrangeNode = (node, nodeArrangement, coords, nodesToBeArranged) => {
|
|
|
254
432
|
|
|
255
433
|
/**
|
|
256
434
|
* A layout which places adjacent nodes close by, placing nodes in order according to breadth first search.
|
|
435
|
+
* @public
|
|
257
436
|
*/
|
|
258
437
|
class BreadthAdjacencyLayout {
|
|
259
438
|
apply(model) {
|
|
@@ -314,8 +493,8 @@ class BreadthAdjacencyLayout {
|
|
|
314
493
|
}
|
|
315
494
|
|
|
316
495
|
/**
|
|
317
|
-
* A layout which arranges the nodes by a breadth first search system
|
|
318
|
-
*
|
|
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
|
|
319
498
|
*/
|
|
320
499
|
class BreadthLayout {
|
|
321
500
|
apply(model) {
|
|
@@ -376,9 +555,23 @@ class BreadthLayout {
|
|
|
376
555
|
}
|
|
377
556
|
}
|
|
378
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
|
+
*/
|
|
379
564
|
const roundPoint = (point) => {
|
|
380
565
|
return [Math.round(point[0]), Math.round(point[1])];
|
|
381
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
|
+
*/
|
|
382
575
|
const between = (coordinate, start, end) => {
|
|
383
576
|
if (start < end) {
|
|
384
577
|
return start <= coordinate && coordinate <= end;
|
|
@@ -387,18 +580,44 @@ const between = (coordinate, start, end) => {
|
|
|
387
580
|
return end <= coordinate && coordinate <= start;
|
|
388
581
|
}
|
|
389
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
|
+
*/
|
|
390
591
|
const translateCoordinate = (oldCoordinate, oldCoordinates, newCoordinates) => {
|
|
391
592
|
return (((oldCoordinate - oldCoordinates[0]) /
|
|
392
593
|
(oldCoordinates[1] - oldCoordinates[0])) *
|
|
393
594
|
(newCoordinates[1] - newCoordinates[0]) +
|
|
394
595
|
newCoordinates[0]);
|
|
395
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
|
+
*/
|
|
396
607
|
const translatePoint = (oldPoint, oldCoordsX, oldCoordsY, newCoordsX, newCoordsY) => {
|
|
397
608
|
return [
|
|
398
609
|
translateCoordinate(oldPoint[0], oldCoordsX, newCoordsX),
|
|
399
610
|
translateCoordinate(oldPoint[1], oldCoordsY, newCoordsY)
|
|
400
611
|
];
|
|
401
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
|
+
*/
|
|
402
621
|
const movePoint = (point, direction, distance) => {
|
|
403
622
|
switch (direction) {
|
|
404
623
|
case Side.Right:
|
|
@@ -411,12 +630,33 @@ const movePoint = (point, direction, distance) => {
|
|
|
411
630
|
return [point[0], point[1] - distance];
|
|
412
631
|
}
|
|
413
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
|
+
*/
|
|
414
640
|
const equals$1 = (point1, point2) => {
|
|
415
641
|
return point1[0] === point2[0] && point1[1] === point2[1];
|
|
416
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
|
+
*/
|
|
417
650
|
const distanceBetweenPoints = (point1, point2) => {
|
|
418
651
|
return ((point1[0] - point2[0]) ** 2 + (point1[1] - point2[1]) ** 2) ** 0.5;
|
|
419
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
|
+
*/
|
|
420
660
|
const lineContainsPoint = (line, point) => {
|
|
421
661
|
const alphaX = (point[0] - line[0][0]) / (line[1][0] - line[0][0]);
|
|
422
662
|
if (alphaX < 0 || 1 < alphaX) {
|
|
@@ -425,10 +665,24 @@ const lineContainsPoint = (line, point) => {
|
|
|
425
665
|
const alphaY = (point[1] - line[0][1]) / (line[1][1] - line[0][1]);
|
|
426
666
|
return alphaX === alphaY;
|
|
427
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
|
+
*/
|
|
428
675
|
const rectangleContainsPoint = (rectangle, point) => {
|
|
429
676
|
return (between(point[0], rectangle[0][0], rectangle[1][0]) &&
|
|
430
677
|
between(point[1], rectangle[0][1], rectangle[1][1]));
|
|
431
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
|
+
*/
|
|
432
686
|
const linesIntersect = (line1, line2) => {
|
|
433
687
|
// if both lines are a point, they intersect if they are the same point
|
|
434
688
|
if (equals$1(line1[0], line1[1]) && equals$1(line2[0], line2[1])) {
|
|
@@ -459,6 +713,13 @@ const linesIntersect = (line1, line2) => {
|
|
|
459
713
|
const p3 = dy0 * (line1[1][0] - line2[1][0]) - dx0 * (line1[1][1] - line2[1][1]);
|
|
460
714
|
return p0 * p1 <= 0 && p2 * p3 <= 0;
|
|
461
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
|
+
*/
|
|
462
723
|
const linesOverlap = (line1, line2) => {
|
|
463
724
|
// if both lines are a point, they overlap if they are the same point
|
|
464
725
|
if (equals$1(line1[0], line1[1]) && equals$1(line2[0], line2[1])) {
|
|
@@ -478,10 +739,21 @@ const linesOverlap = (line1, line2) => {
|
|
|
478
739
|
lineContainsPoint(line2, line1[0])) &&
|
|
479
740
|
(lineContainsPoint(line1, line2[1]) || lineContainsPoint(line2, line1[1])));
|
|
480
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
|
+
*/
|
|
481
749
|
const lineIntersectsRectangle = (line, rectangle) => {
|
|
750
|
+
// first corner of the rectangle
|
|
482
751
|
const point1 = rectangle[0];
|
|
752
|
+
// second corner of the rectangle
|
|
483
753
|
const point2 = [rectangle[0][0], rectangle[1][1]];
|
|
754
|
+
// third corner of the rectangle
|
|
484
755
|
const point3 = rectangle[1];
|
|
756
|
+
// fourth corner of the rectangle
|
|
485
757
|
const point4 = [rectangle[1][0], rectangle[0][1]];
|
|
486
758
|
return (linesIntersect(line, [point1, point2]) ||
|
|
487
759
|
linesIntersect(line, [point2, point3]) ||
|
|
@@ -491,6 +763,7 @@ const lineIntersectsRectangle = (line, rectangle) => {
|
|
|
491
763
|
|
|
492
764
|
/**
|
|
493
765
|
* A layout which attracts connected nodes and repels unconnected nodes.
|
|
766
|
+
* @public
|
|
494
767
|
*/
|
|
495
768
|
class ForceLayout {
|
|
496
769
|
apply(model) {
|
|
@@ -514,7 +787,7 @@ class ForceLayout {
|
|
|
514
787
|
temperature = temperature * coolingFactor;
|
|
515
788
|
// calculate the center of the diagram for applying gravity
|
|
516
789
|
const diagramCenterCoords = [0, 0];
|
|
517
|
-
if (gravityFactor
|
|
790
|
+
if (gravityFactor > 0) {
|
|
518
791
|
for (const node of model.nodes) {
|
|
519
792
|
diagramCenterCoords[0] =
|
|
520
793
|
diagramCenterCoords[0] + node.coords[0] + node.width / 2;
|
|
@@ -585,7 +858,7 @@ class ForceLayout {
|
|
|
585
858
|
newNode2Coords[1] + shiftNodeIfOverlap * (Math.random() * 2 - 1);
|
|
586
859
|
}
|
|
587
860
|
// apply gravity force
|
|
588
|
-
if (gravityFactor
|
|
861
|
+
if (gravityFactor > 0) {
|
|
589
862
|
newNode2Coords[0] =
|
|
590
863
|
newNode2Coords[0] -
|
|
591
864
|
(node2CenterCoords[0] - diagramCenterCoords[0]) * gravityFactor;
|
|
@@ -626,6 +899,7 @@ class ForceLayout {
|
|
|
626
899
|
|
|
627
900
|
/**
|
|
628
901
|
* A layout which arranges all the nodes in a horizontal line.
|
|
902
|
+
* @public
|
|
629
903
|
*/
|
|
630
904
|
class HorizontalLayout {
|
|
631
905
|
apply(model) {
|
|
@@ -647,6 +921,7 @@ class HorizontalLayout {
|
|
|
647
921
|
|
|
648
922
|
/**
|
|
649
923
|
* A layout which arranges the nodes by their priority first.
|
|
924
|
+
* @public
|
|
650
925
|
*/
|
|
651
926
|
class PriorityLayout {
|
|
652
927
|
apply(model) {
|
|
@@ -754,6 +1029,7 @@ class PriorityLayout {
|
|
|
754
1029
|
|
|
755
1030
|
/**
|
|
756
1031
|
* A layout which arranges all the nodes in a vertical line.
|
|
1032
|
+
* @public
|
|
757
1033
|
*/
|
|
758
1034
|
class VerticalLayout {
|
|
759
1035
|
apply(model) {
|
|
@@ -773,6 +1049,9 @@ class VerticalLayout {
|
|
|
773
1049
|
}
|
|
774
1050
|
}
|
|
775
1051
|
|
|
1052
|
+
/**
|
|
1053
|
+
* Mapping of available layout algorithms.
|
|
1054
|
+
*/
|
|
776
1055
|
const layouts = {
|
|
777
1056
|
adjacency: new AdjacencyLayout(),
|
|
778
1057
|
breadth: new BreadthLayout(),
|
|
@@ -784,7 +1063,8 @@ const layouts = {
|
|
|
784
1063
|
};
|
|
785
1064
|
|
|
786
1065
|
/**
|
|
787
|
-
* User events
|
|
1066
|
+
* User events.
|
|
1067
|
+
* @private
|
|
788
1068
|
*/
|
|
789
1069
|
var Events;
|
|
790
1070
|
(function (Events) {
|
|
@@ -799,7 +1079,8 @@ var Events;
|
|
|
799
1079
|
Events["MouseOver"] = "mouseover";
|
|
800
1080
|
})(Events || (Events = {}));
|
|
801
1081
|
/**
|
|
802
|
-
* Keys in keyboard events
|
|
1082
|
+
* Keys in keyboard events.
|
|
1083
|
+
* @private
|
|
803
1084
|
*/
|
|
804
1085
|
var Keys;
|
|
805
1086
|
(function (Keys) {
|
|
@@ -823,7 +1104,8 @@ var Keys;
|
|
|
823
1104
|
Keys["Tab"] = "Tab";
|
|
824
1105
|
})(Keys || (Keys = {}));
|
|
825
1106
|
/**
|
|
826
|
-
* Types of events used by D3's drag functionality
|
|
1107
|
+
* Types of events used by D3's drag functionality.
|
|
1108
|
+
* @private
|
|
827
1109
|
*/
|
|
828
1110
|
var DragEvents;
|
|
829
1111
|
(function (DragEvents) {
|
|
@@ -832,7 +1114,8 @@ var DragEvents;
|
|
|
832
1114
|
DragEvents["End"] = "end";
|
|
833
1115
|
})(DragEvents || (DragEvents = {}));
|
|
834
1116
|
/**
|
|
835
|
-
* Types of events used by D3's zoom functionality
|
|
1117
|
+
* Types of events used by D3's zoom functionality.
|
|
1118
|
+
* @private
|
|
836
1119
|
*/
|
|
837
1120
|
var ZoomEvents;
|
|
838
1121
|
(function (ZoomEvents) {
|
|
@@ -841,20 +1124,64 @@ var ZoomEvents;
|
|
|
841
1124
|
ZoomEvents["End"] = "end";
|
|
842
1125
|
})(ZoomEvents || (ZoomEvents = {}));
|
|
843
1126
|
|
|
1127
|
+
/**
|
|
1128
|
+
* An enumeration of the possible shapes of a line.
|
|
1129
|
+
* @public
|
|
1130
|
+
*/
|
|
844
1131
|
var LineShape;
|
|
845
1132
|
(function (LineShape) {
|
|
1133
|
+
/**
|
|
1134
|
+
* A line that goes between its points taking the shortest euclidean distance.
|
|
1135
|
+
* @public
|
|
1136
|
+
*/
|
|
846
1137
|
LineShape["Straight"] = "straight";
|
|
1138
|
+
/**
|
|
1139
|
+
* A line that goes between its points using bezier splines.
|
|
1140
|
+
* @public
|
|
1141
|
+
*/
|
|
847
1142
|
LineShape["Bezier"] = "bezier";
|
|
1143
|
+
/**
|
|
1144
|
+
* A line that goes between its points moving parallel to the axes of coordinates.
|
|
1145
|
+
* @public
|
|
1146
|
+
*/
|
|
848
1147
|
LineShape["Square"] = "square";
|
|
849
1148
|
})(LineShape || (LineShape = {}));
|
|
1149
|
+
/**
|
|
1150
|
+
* An enumeration of the possible styles of a line.
|
|
1151
|
+
* @public
|
|
1152
|
+
*/
|
|
850
1153
|
var LineStyle;
|
|
851
1154
|
(function (LineStyle) {
|
|
1155
|
+
/**
|
|
1156
|
+
* A solid uninterrupted line.
|
|
1157
|
+
* @public
|
|
1158
|
+
*/
|
|
852
1159
|
LineStyle["Solid"] = "solid";
|
|
1160
|
+
/**
|
|
1161
|
+
* A dashed line with little separation between the dashes.
|
|
1162
|
+
* @public
|
|
1163
|
+
*/
|
|
853
1164
|
LineStyle["Dashed"] = "dashed";
|
|
1165
|
+
/**
|
|
1166
|
+
* A dashed line with wide gaps between the dashes.
|
|
1167
|
+
* @public
|
|
1168
|
+
*/
|
|
854
1169
|
LineStyle["GappedDashes"] = "gapped-dashes";
|
|
1170
|
+
/**
|
|
1171
|
+
* A dotted line.
|
|
1172
|
+
* @public
|
|
1173
|
+
*/
|
|
855
1174
|
LineStyle["Dotted"] = "dotted";
|
|
856
1175
|
})(LineStyle || (LineStyle = {}));
|
|
1176
|
+
/**
|
|
1177
|
+
* The default minimum distance before turn used by the linePath function.
|
|
1178
|
+
* @private
|
|
1179
|
+
*/
|
|
857
1180
|
const MINIMUM_DISTANCE_BEFORE_TURN = 20;
|
|
1181
|
+
/**
|
|
1182
|
+
* Calculates the path of an SVG line with the given parameters.
|
|
1183
|
+
* @private
|
|
1184
|
+
*/
|
|
858
1185
|
const linePath = (shape, points, startDirection, endDirection, minimumDistanceBeforeTurn) => {
|
|
859
1186
|
if (points.length === 0) {
|
|
860
1187
|
return '';
|
|
@@ -1192,6 +1519,10 @@ const linePath = (shape, points, startDirection, endDirection, minimumDistanceBe
|
|
|
1192
1519
|
return result;
|
|
1193
1520
|
}
|
|
1194
1521
|
};
|
|
1522
|
+
/**
|
|
1523
|
+
* Calculates the dasharray property of an SVG line corresponding to the given line style and width.
|
|
1524
|
+
* @private
|
|
1525
|
+
*/
|
|
1195
1526
|
const lineStyleDasharray = (style, width) => {
|
|
1196
1527
|
switch (style) {
|
|
1197
1528
|
case LineStyle.Dotted:
|
|
@@ -1206,19 +1537,67 @@ const lineStyleDasharray = (style, width) => {
|
|
|
1206
1537
|
}
|
|
1207
1538
|
};
|
|
1208
1539
|
|
|
1540
|
+
/**
|
|
1541
|
+
* An enumeration of possible closed shapes.
|
|
1542
|
+
* @public
|
|
1543
|
+
*/
|
|
1209
1544
|
var ClosedShape;
|
|
1210
1545
|
(function (ClosedShape) {
|
|
1546
|
+
/**
|
|
1547
|
+
* An ellipse shape.
|
|
1548
|
+
* @public
|
|
1549
|
+
*/
|
|
1211
1550
|
ClosedShape["Ellipse"] = "ellipse";
|
|
1551
|
+
/**
|
|
1552
|
+
* A nonexistent shape.
|
|
1553
|
+
* @public
|
|
1554
|
+
*/
|
|
1212
1555
|
ClosedShape["Empty"] = "empty";
|
|
1556
|
+
/**
|
|
1557
|
+
* A folder-like shape.
|
|
1558
|
+
* @public
|
|
1559
|
+
*/
|
|
1213
1560
|
ClosedShape["Folder"] = "folder";
|
|
1561
|
+
/**
|
|
1562
|
+
* An hexagon shape.
|
|
1563
|
+
* @public
|
|
1564
|
+
*/
|
|
1214
1565
|
ClosedShape["Hexagon"] = "hexagon";
|
|
1566
|
+
/**
|
|
1567
|
+
* An octagon shape.
|
|
1568
|
+
* @public
|
|
1569
|
+
*/
|
|
1215
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
|
+
*/
|
|
1216
1575
|
ClosedShape["Pill"] = "pill";
|
|
1576
|
+
/**
|
|
1577
|
+
* A rectangle shape.
|
|
1578
|
+
* @public
|
|
1579
|
+
*/
|
|
1217
1580
|
ClosedShape["Rectangle"] = "rectangle";
|
|
1581
|
+
/**
|
|
1582
|
+
* A rhombus shape.
|
|
1583
|
+
* @public
|
|
1584
|
+
*/
|
|
1218
1585
|
ClosedShape["Rhombus"] = "rhombus";
|
|
1586
|
+
/**
|
|
1587
|
+
* A rectangle shape with rounded corners.
|
|
1588
|
+
* @public
|
|
1589
|
+
*/
|
|
1219
1590
|
ClosedShape["RoundedRectangle"] = "rounded-rectangle";
|
|
1591
|
+
/**
|
|
1592
|
+
* A sticky note-like shape.
|
|
1593
|
+
* @public
|
|
1594
|
+
*/
|
|
1220
1595
|
ClosedShape["StickyNote"] = "sticky-note";
|
|
1221
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
|
+
*/
|
|
1222
1601
|
const generalClosedPath = (shape, x, y, width, height) => {
|
|
1223
1602
|
switch (shape) {
|
|
1224
1603
|
case ClosedShape.Ellipse:
|
|
@@ -1245,21 +1624,51 @@ const generalClosedPath = (shape, x, y, width, height) => {
|
|
|
1245
1624
|
return rectanglePath(x, y, width, height);
|
|
1246
1625
|
}
|
|
1247
1626
|
};
|
|
1627
|
+
/**
|
|
1628
|
+
* Generates an ellipse SVG path.
|
|
1629
|
+
* @see ClosedShape
|
|
1630
|
+
* @private
|
|
1631
|
+
*/
|
|
1248
1632
|
const ellipsePath = (x, y, width, height) => {
|
|
1249
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`;
|
|
1250
1634
|
};
|
|
1635
|
+
/**
|
|
1636
|
+
* Generates an empty SVG path.
|
|
1637
|
+
* @see ClosedShape
|
|
1638
|
+
* @private
|
|
1639
|
+
*/
|
|
1251
1640
|
const emptyPath = () => {
|
|
1252
1641
|
return 'Z';
|
|
1253
1642
|
};
|
|
1643
|
+
/**
|
|
1644
|
+
* Generates a folder SVG path.
|
|
1645
|
+
* @see ClosedShape
|
|
1646
|
+
* @private
|
|
1647
|
+
*/
|
|
1254
1648
|
const folderPath = (x, y, width, height) => {
|
|
1255
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`;
|
|
1256
1650
|
};
|
|
1651
|
+
/**
|
|
1652
|
+
* Generates an hexagon SVG path.
|
|
1653
|
+
* @see ClosedShape
|
|
1654
|
+
* @private
|
|
1655
|
+
*/
|
|
1257
1656
|
const hexagonPath = (x, y, width, height) => {
|
|
1258
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`;
|
|
1259
1658
|
};
|
|
1659
|
+
/**
|
|
1660
|
+
* Generates an octagon SVG path.
|
|
1661
|
+
* @see ClosedShape
|
|
1662
|
+
* @private
|
|
1663
|
+
*/
|
|
1260
1664
|
const octagonPath = (x, y, width, height) => {
|
|
1261
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`;
|
|
1262
1666
|
};
|
|
1667
|
+
/**
|
|
1668
|
+
* Generates a pill SVG path.
|
|
1669
|
+
* @see ClosedShape
|
|
1670
|
+
* @private
|
|
1671
|
+
*/
|
|
1263
1672
|
const pillPath = (x, y, width, height) => {
|
|
1264
1673
|
if (height < width) {
|
|
1265
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`;
|
|
@@ -1271,19 +1680,43 @@ const pillPath = (x, y, width, height) => {
|
|
|
1271
1680
|
return ellipsePath(x, y, width, height);
|
|
1272
1681
|
}
|
|
1273
1682
|
};
|
|
1683
|
+
/**
|
|
1684
|
+
* Generates a rectangle SVG path.
|
|
1685
|
+
* @see ClosedShape
|
|
1686
|
+
* @private
|
|
1687
|
+
*/
|
|
1274
1688
|
const rectanglePath = (x, y, width, height) => {
|
|
1275
1689
|
return `M ${x} ${y} L ${x + width} ${y} L ${x + width} ${y + height} L ${x} ${y + height} Z`;
|
|
1276
1690
|
};
|
|
1691
|
+
/**
|
|
1692
|
+
* Generates a rhombus SVG path.
|
|
1693
|
+
* @see ClosedShape
|
|
1694
|
+
* @private
|
|
1695
|
+
*/
|
|
1277
1696
|
const rhombusPath = (x, y, width, height) => {
|
|
1278
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`;
|
|
1279
1698
|
};
|
|
1699
|
+
/**
|
|
1700
|
+
* Generates a rounded rectangle SVG path.
|
|
1701
|
+
* @see ClosedShape
|
|
1702
|
+
* @private
|
|
1703
|
+
*/
|
|
1280
1704
|
const roundedRectanglePath = (x, y, width, height) => {
|
|
1281
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`;
|
|
1282
1706
|
};
|
|
1707
|
+
/**
|
|
1708
|
+
* Generates a sticky note SVG path.
|
|
1709
|
+
* @see ClosedShape
|
|
1710
|
+
* @private
|
|
1711
|
+
*/
|
|
1283
1712
|
const stickyNotePath = (x, y, width, height) => {
|
|
1284
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`;
|
|
1285
1714
|
};
|
|
1286
1715
|
|
|
1716
|
+
/**
|
|
1717
|
+
* A queue of recent actions taken by the user that can be undone and redone.
|
|
1718
|
+
* @private
|
|
1719
|
+
*/
|
|
1287
1720
|
class ActionQueue {
|
|
1288
1721
|
constructor(maximum) {
|
|
1289
1722
|
this.maximum = maximum;
|
|
@@ -1292,6 +1725,7 @@ class ActionQueue {
|
|
|
1292
1725
|
}
|
|
1293
1726
|
/**
|
|
1294
1727
|
* Adds an action to the history.
|
|
1728
|
+
* @private
|
|
1295
1729
|
*/
|
|
1296
1730
|
add(action) {
|
|
1297
1731
|
if (this.index < this.history.length) {
|
|
@@ -1308,6 +1742,7 @@ class ActionQueue {
|
|
|
1308
1742
|
}
|
|
1309
1743
|
/**
|
|
1310
1744
|
* Undoes the last action in the history, not counting undone actions.
|
|
1745
|
+
* @private
|
|
1311
1746
|
*/
|
|
1312
1747
|
undo() {
|
|
1313
1748
|
if (this.index > 0) {
|
|
@@ -1317,6 +1752,7 @@ class ActionQueue {
|
|
|
1317
1752
|
}
|
|
1318
1753
|
/**
|
|
1319
1754
|
* Redoes the last undone action in the history.
|
|
1755
|
+
* @private
|
|
1320
1756
|
*/
|
|
1321
1757
|
redo() {
|
|
1322
1758
|
if (this.index < this.history.length) {
|
|
@@ -1325,6 +1761,26 @@ class ActionQueue {
|
|
|
1325
1761
|
}
|
|
1326
1762
|
}
|
|
1327
1763
|
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Enum listing the actions that can be taken by the user.
|
|
1766
|
+
* @private
|
|
1767
|
+
*/
|
|
1768
|
+
var DiagramActions;
|
|
1769
|
+
(function (DiagramActions) {
|
|
1770
|
+
DiagramActions["AddConnectionAction"] = "add-connection";
|
|
1771
|
+
DiagramActions["AddNodeAction"] = "add-node";
|
|
1772
|
+
DiagramActions["EditFieldAction"] = "edit-field";
|
|
1773
|
+
DiagramActions["MoveNodeAction"] = "move-node";
|
|
1774
|
+
DiagramActions["RemoveAction"] = "remove";
|
|
1775
|
+
DiagramActions["StretchNodeAction"] = "stretch-node";
|
|
1776
|
+
DiagramActions["StretchSectionAction"] = "stretch-section";
|
|
1777
|
+
DiagramActions["UpdateValuesAction"] = "update-values";
|
|
1778
|
+
})(DiagramActions || (DiagramActions = {}));
|
|
1779
|
+
/**
|
|
1780
|
+
* Action which consists of adding a node.
|
|
1781
|
+
* @see DiagramNode
|
|
1782
|
+
* @private
|
|
1783
|
+
*/
|
|
1328
1784
|
class AddNodeAction {
|
|
1329
1785
|
constructor(canvas, type, coords, label, values, id) {
|
|
1330
1786
|
this.canvas = canvas;
|
|
@@ -1361,6 +1817,11 @@ class AddNodeAction {
|
|
|
1361
1817
|
this.labelId = node.label?.id;
|
|
1362
1818
|
}
|
|
1363
1819
|
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Action which consists of moving a node.
|
|
1822
|
+
* @see DiagramNode
|
|
1823
|
+
* @private
|
|
1824
|
+
*/
|
|
1364
1825
|
class MoveNodeAction {
|
|
1365
1826
|
constructor(canvas, nodeId, from, to) {
|
|
1366
1827
|
this.canvas = canvas;
|
|
@@ -1375,6 +1836,11 @@ class MoveNodeAction {
|
|
|
1375
1836
|
this.canvas.model.nodes.get(this.nodeId)?.move(this.to);
|
|
1376
1837
|
}
|
|
1377
1838
|
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Action which consists of changing the dimensions of a node in a given direction.
|
|
1841
|
+
* @see DiagramNode
|
|
1842
|
+
* @private
|
|
1843
|
+
*/
|
|
1378
1844
|
class StretchNodeAction {
|
|
1379
1845
|
constructor(canvas, nodeId, direction, from, to) {
|
|
1380
1846
|
this.canvas = canvas;
|
|
@@ -1394,6 +1860,11 @@ class StretchNodeAction {
|
|
|
1394
1860
|
?.stretch(this.direction, this.to - this.from);
|
|
1395
1861
|
}
|
|
1396
1862
|
}
|
|
1863
|
+
/**
|
|
1864
|
+
* Action which consists of changing the dimensions of a section in a given direction.
|
|
1865
|
+
* @see DiagramSection
|
|
1866
|
+
* @private
|
|
1867
|
+
*/
|
|
1397
1868
|
class StretchSectionAction {
|
|
1398
1869
|
constructor(canvas, sectionId, direction, from, to) {
|
|
1399
1870
|
this.canvas = canvas;
|
|
@@ -1417,6 +1888,11 @@ class StretchSectionAction {
|
|
|
1417
1888
|
}
|
|
1418
1889
|
}
|
|
1419
1890
|
}
|
|
1891
|
+
/**
|
|
1892
|
+
* Action which consists of adding a connection.
|
|
1893
|
+
* @see DiagramConnection
|
|
1894
|
+
* @private
|
|
1895
|
+
*/
|
|
1420
1896
|
class AddConnectionAction {
|
|
1421
1897
|
constructor(canvas, type, startId, endId, id) {
|
|
1422
1898
|
this.canvas = canvas;
|
|
@@ -1440,6 +1916,11 @@ class AddConnectionAction {
|
|
|
1440
1916
|
}
|
|
1441
1917
|
}
|
|
1442
1918
|
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Action which consists of editing the text of a field.
|
|
1921
|
+
* @see DiagramField
|
|
1922
|
+
* @private
|
|
1923
|
+
*/
|
|
1443
1924
|
class EditFieldAction {
|
|
1444
1925
|
constructor(canvas, fieldId, from, to) {
|
|
1445
1926
|
this.canvas = canvas;
|
|
@@ -1462,6 +1943,11 @@ class EditFieldAction {
|
|
|
1462
1943
|
}
|
|
1463
1944
|
}
|
|
1464
1945
|
}
|
|
1946
|
+
/**
|
|
1947
|
+
* Action which consists of editing the values of a value set.
|
|
1948
|
+
* @see ValueSet
|
|
1949
|
+
* @private
|
|
1950
|
+
*/
|
|
1465
1951
|
class UpdateValuesAction {
|
|
1466
1952
|
constructor(model, id, from, to) {
|
|
1467
1953
|
this.model = model;
|
|
@@ -1484,6 +1970,10 @@ class UpdateValuesAction {
|
|
|
1484
1970
|
this.getValueSet()?.setValues(this.to);
|
|
1485
1971
|
}
|
|
1486
1972
|
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Action which consists of removing elements from a diagram.
|
|
1975
|
+
* @private
|
|
1976
|
+
*/
|
|
1487
1977
|
class RemoveAction {
|
|
1488
1978
|
constructor(model, nodes, sections, ports, connections, fields) {
|
|
1489
1979
|
this.nodes = [];
|
|
@@ -1535,11 +2025,11 @@ class RemoveAction {
|
|
|
1535
2025
|
addIfNotExists(this.connections, connection);
|
|
1536
2026
|
}
|
|
1537
2027
|
}
|
|
1538
|
-
this.nodeIds = this.nodes.map((n) => n.
|
|
1539
|
-
this.sectionIds = this.sections.map((s) => s.
|
|
1540
|
-
this.portIds = this.ports.map((p) => p.
|
|
1541
|
-
this.connectionIds = this.connections.map((c) => c.
|
|
1542
|
-
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);
|
|
1543
2033
|
}
|
|
1544
2034
|
undo() {
|
|
1545
2035
|
for (const node of this.nodes) {
|
|
@@ -1559,14 +2049,14 @@ class RemoveAction {
|
|
|
1559
2049
|
}
|
|
1560
2050
|
for (const node of this.nodes) {
|
|
1561
2051
|
if (node.label) {
|
|
1562
|
-
const label = this.model.fields.get(node.label.
|
|
2052
|
+
const label = this.model.fields.get(node.label.id);
|
|
1563
2053
|
if (label) {
|
|
1564
2054
|
node.label = label;
|
|
1565
2055
|
}
|
|
1566
2056
|
}
|
|
1567
2057
|
const ports = [];
|
|
1568
2058
|
for (const nodePort of node.ports) {
|
|
1569
|
-
const port = this.model.ports.get(nodePort.
|
|
2059
|
+
const port = this.model.ports.get(nodePort.id);
|
|
1570
2060
|
if (port) {
|
|
1571
2061
|
ports.push(port);
|
|
1572
2062
|
}
|
|
@@ -1574,7 +2064,7 @@ class RemoveAction {
|
|
|
1574
2064
|
node.ports = ports;
|
|
1575
2065
|
const sections = [];
|
|
1576
2066
|
for (const nodeSection of node.sections) {
|
|
1577
|
-
const section = this.model.sections.get(nodeSection.
|
|
2067
|
+
const section = this.model.sections.get(nodeSection.id);
|
|
1578
2068
|
if (section) {
|
|
1579
2069
|
sections.push(section);
|
|
1580
2070
|
}
|
|
@@ -1583,20 +2073,20 @@ class RemoveAction {
|
|
|
1583
2073
|
}
|
|
1584
2074
|
for (const section of this.sections) {
|
|
1585
2075
|
if (section.node) {
|
|
1586
|
-
const node = this.model.nodes.get(section.node.
|
|
2076
|
+
const node = this.model.nodes.get(section.node.id);
|
|
1587
2077
|
if (node) {
|
|
1588
2078
|
section.node = node;
|
|
1589
2079
|
}
|
|
1590
2080
|
}
|
|
1591
2081
|
if (section.label) {
|
|
1592
|
-
const label = this.model.fields.get(section.label.
|
|
2082
|
+
const label = this.model.fields.get(section.label.id);
|
|
1593
2083
|
if (label) {
|
|
1594
2084
|
section.label = label;
|
|
1595
2085
|
}
|
|
1596
2086
|
}
|
|
1597
2087
|
const ports = [];
|
|
1598
2088
|
for (const sectionPort of section.ports) {
|
|
1599
|
-
const port = this.model.ports.get(sectionPort.
|
|
2089
|
+
const port = this.model.ports.get(sectionPort.id);
|
|
1600
2090
|
if (port) {
|
|
1601
2091
|
ports.push(port);
|
|
1602
2092
|
}
|
|
@@ -1605,21 +2095,21 @@ class RemoveAction {
|
|
|
1605
2095
|
}
|
|
1606
2096
|
for (const port of this.ports) {
|
|
1607
2097
|
if (port.rootElement) {
|
|
1608
|
-
const rootElement = this.model.nodes.get(port.rootElement.
|
|
1609
|
-
this.model.sections.get(port.rootElement.
|
|
2098
|
+
const rootElement = this.model.nodes.get(port.rootElement.id) ||
|
|
2099
|
+
this.model.sections.get(port.rootElement.id);
|
|
1610
2100
|
if (rootElement) {
|
|
1611
2101
|
port.rootElement = rootElement;
|
|
1612
2102
|
}
|
|
1613
2103
|
}
|
|
1614
2104
|
if (port.label) {
|
|
1615
|
-
const label = this.model.fields.get(port.label.
|
|
2105
|
+
const label = this.model.fields.get(port.label.id);
|
|
1616
2106
|
if (label) {
|
|
1617
2107
|
port.label = label;
|
|
1618
2108
|
}
|
|
1619
2109
|
}
|
|
1620
2110
|
const outgoingConnections = [];
|
|
1621
2111
|
for (const portOutgoingConnection of port.outgoingConnections) {
|
|
1622
|
-
const connection = this.model.connections.get(portOutgoingConnection.
|
|
2112
|
+
const connection = this.model.connections.get(portOutgoingConnection.id);
|
|
1623
2113
|
if (connection) {
|
|
1624
2114
|
outgoingConnections.push(connection);
|
|
1625
2115
|
}
|
|
@@ -1627,7 +2117,7 @@ class RemoveAction {
|
|
|
1627
2117
|
port.outgoingConnections = outgoingConnections;
|
|
1628
2118
|
const incomingConnections = [];
|
|
1629
2119
|
for (const portIncomingConnection of port.incomingConnections) {
|
|
1630
|
-
const connection = this.model.connections.get(portIncomingConnection.
|
|
2120
|
+
const connection = this.model.connections.get(portIncomingConnection.id);
|
|
1631
2121
|
if (connection) {
|
|
1632
2122
|
incomingConnections.push(connection);
|
|
1633
2123
|
}
|
|
@@ -1636,13 +2126,13 @@ class RemoveAction {
|
|
|
1636
2126
|
}
|
|
1637
2127
|
for (const connection of this.connections) {
|
|
1638
2128
|
if (connection.start) {
|
|
1639
|
-
const start = this.model.ports.get(connection.start.
|
|
2129
|
+
const start = this.model.ports.get(connection.start.id);
|
|
1640
2130
|
if (start) {
|
|
1641
2131
|
connection.setStart(start);
|
|
1642
2132
|
}
|
|
1643
2133
|
}
|
|
1644
2134
|
if (connection.end) {
|
|
1645
|
-
const end = this.model.ports.get(connection.end.
|
|
2135
|
+
const end = this.model.ports.get(connection.end.id);
|
|
1646
2136
|
if (end) {
|
|
1647
2137
|
connection.setEnd(end);
|
|
1648
2138
|
}
|
|
@@ -1650,9 +2140,9 @@ class RemoveAction {
|
|
|
1650
2140
|
}
|
|
1651
2141
|
for (const field of this.fields) {
|
|
1652
2142
|
if (field.rootElement) {
|
|
1653
|
-
const rootElement = this.model.nodes.get(field.rootElement.
|
|
1654
|
-
this.model.sections.get(field.rootElement.
|
|
1655
|
-
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);
|
|
1656
2146
|
if (rootElement) {
|
|
1657
2147
|
field.rootElement = rootElement;
|
|
1658
2148
|
}
|
|
@@ -1756,6 +2246,7 @@ const clone = (obj) => {
|
|
|
1756
2246
|
|
|
1757
2247
|
/**
|
|
1758
2248
|
* Represents an object which exists as part of a specific diagram model and has a visual representation in a diagram canvas.
|
|
2249
|
+
* @public
|
|
1759
2250
|
* @see DiagramModel
|
|
1760
2251
|
* @see DiagramCanvas
|
|
1761
2252
|
*/
|
|
@@ -1763,18 +2254,23 @@ class DiagramElement {
|
|
|
1763
2254
|
get id() {
|
|
1764
2255
|
return this._id;
|
|
1765
2256
|
}
|
|
1766
|
-
set id(value) {
|
|
1767
|
-
this.select()?.attr('id', value);
|
|
1768
|
-
this._id = value;
|
|
1769
|
-
}
|
|
1770
2257
|
constructor(model, id) {
|
|
2258
|
+
/**
|
|
2259
|
+
* Whether this diagram element is currently highlighted by the user.
|
|
2260
|
+
* @private
|
|
2261
|
+
*/
|
|
1771
2262
|
this.highlighted = false;
|
|
2263
|
+
/**
|
|
2264
|
+
* Whether this diagram element is currently selected by the user.
|
|
2265
|
+
* @private
|
|
2266
|
+
*/
|
|
1772
2267
|
this.selected = false;
|
|
1773
2268
|
this.model = model;
|
|
1774
2269
|
this._id = id;
|
|
1775
2270
|
}
|
|
1776
2271
|
/**
|
|
1777
2272
|
* Obtain the selection of this element.
|
|
2273
|
+
* @private
|
|
1778
2274
|
*/
|
|
1779
2275
|
select() {
|
|
1780
2276
|
return this.model.canvas?.selectCanvasView()?.select(`g#${this.id}`);
|
|
@@ -1782,6 +2278,7 @@ class DiagramElement {
|
|
|
1782
2278
|
}
|
|
1783
2279
|
/**
|
|
1784
2280
|
* Represents a collection of diagram entities of a type that exists as part of a diagram model.
|
|
2281
|
+
* @public
|
|
1785
2282
|
* @see DiagramEntity
|
|
1786
2283
|
* @see DiagramModel
|
|
1787
2284
|
*/
|
|
@@ -1789,21 +2286,25 @@ class DiagramEntitySet {
|
|
|
1789
2286
|
constructor() {
|
|
1790
2287
|
/**
|
|
1791
2288
|
* The list of entities contained in this set.
|
|
2289
|
+
* @private
|
|
1792
2290
|
*/
|
|
1793
2291
|
this.entities = [];
|
|
1794
2292
|
/**
|
|
1795
2293
|
* A mapping of entity ids to their corresponding entity in this set for quickly fetching entities based on their id.
|
|
2294
|
+
* @private
|
|
1796
2295
|
*/
|
|
1797
2296
|
this.entityMap = {};
|
|
1798
2297
|
}
|
|
1799
2298
|
/**
|
|
1800
2299
|
* The number of entities of this set.
|
|
2300
|
+
* @public
|
|
1801
2301
|
*/
|
|
1802
2302
|
get length() {
|
|
1803
2303
|
return this.entities.length;
|
|
1804
2304
|
}
|
|
1805
2305
|
/**
|
|
1806
2306
|
* Gets all of the entities of this set.
|
|
2307
|
+
* @public
|
|
1807
2308
|
* @returns An array containing all of the entities of this set.
|
|
1808
2309
|
*/
|
|
1809
2310
|
all() {
|
|
@@ -1812,6 +2313,7 @@ class DiagramEntitySet {
|
|
|
1812
2313
|
/**
|
|
1813
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.
|
|
1814
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
|
|
1815
2317
|
* @param entity An entity to be added to this set.
|
|
1816
2318
|
*/
|
|
1817
2319
|
add(entity) {
|
|
@@ -1822,6 +2324,7 @@ class DiagramEntitySet {
|
|
|
1822
2324
|
}
|
|
1823
2325
|
/**
|
|
1824
2326
|
* Removes all the entities in this set.
|
|
2327
|
+
* @public
|
|
1825
2328
|
*/
|
|
1826
2329
|
clear() {
|
|
1827
2330
|
// remove each entity individually in case classes that extend this implement their own specific cleanup
|
|
@@ -1831,6 +2334,7 @@ class DiagramEntitySet {
|
|
|
1831
2334
|
}
|
|
1832
2335
|
/**
|
|
1833
2336
|
* Checks if this set contains an entity with the given id.
|
|
2337
|
+
* @public
|
|
1834
2338
|
* @param id An id.
|
|
1835
2339
|
* @returns `true` if this set contains an entity with the given id, `false` otherwise.
|
|
1836
2340
|
*/
|
|
@@ -1839,6 +2343,7 @@ class DiagramEntitySet {
|
|
|
1839
2343
|
}
|
|
1840
2344
|
/**
|
|
1841
2345
|
* Gets all of the entities of this set filtered following given criteria.
|
|
2346
|
+
* @public
|
|
1842
2347
|
* @returns An array containing the entities of this set that meet the given criteria.
|
|
1843
2348
|
*/
|
|
1844
2349
|
filter() {
|
|
@@ -1846,6 +2351,7 @@ class DiagramEntitySet {
|
|
|
1846
2351
|
}
|
|
1847
2352
|
/**
|
|
1848
2353
|
* Gets an entity of this set matching specific criteria.
|
|
2354
|
+
* @public
|
|
1849
2355
|
* @returns An entity of this set.
|
|
1850
2356
|
*/
|
|
1851
2357
|
find() {
|
|
@@ -1853,6 +2359,7 @@ class DiagramEntitySet {
|
|
|
1853
2359
|
}
|
|
1854
2360
|
/**
|
|
1855
2361
|
* Gets an entity from this set.
|
|
2362
|
+
* @public
|
|
1856
2363
|
* @param id An id.
|
|
1857
2364
|
* @returns An entity with the given id, or `undefined` if there are no entities with the given id.
|
|
1858
2365
|
*/
|
|
@@ -1861,6 +2368,7 @@ class DiagramEntitySet {
|
|
|
1861
2368
|
}
|
|
1862
2369
|
/**
|
|
1863
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
|
|
1864
2372
|
* @param id An id.
|
|
1865
2373
|
*/
|
|
1866
2374
|
remove(id) {
|
|
@@ -1870,6 +2378,10 @@ class DiagramEntitySet {
|
|
|
1870
2378
|
removeIfExists(this.entities, entity);
|
|
1871
2379
|
}
|
|
1872
2380
|
}
|
|
2381
|
+
/**
|
|
2382
|
+
* Iterator to iterate over the entities of this set.
|
|
2383
|
+
* @public
|
|
2384
|
+
*/
|
|
1873
2385
|
*[Symbol.iterator]() {
|
|
1874
2386
|
let counter = 0;
|
|
1875
2387
|
while (counter < this.entities.length) {
|
|
@@ -1879,6 +2391,12 @@ class DiagramEntitySet {
|
|
|
1879
2391
|
}
|
|
1880
2392
|
}
|
|
1881
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
|
+
*/
|
|
1882
2400
|
class Property {
|
|
1883
2401
|
constructor(name, type, defaultValue, basic, editable, rootAttribute) {
|
|
1884
2402
|
this.name = name;
|
|
@@ -1891,6 +2409,11 @@ class Property {
|
|
|
1891
2409
|
this.properties = undefined;
|
|
1892
2410
|
}
|
|
1893
2411
|
}
|
|
2412
|
+
/**
|
|
2413
|
+
* The type that a property can hvae..
|
|
2414
|
+
* @see Property
|
|
2415
|
+
* @private
|
|
2416
|
+
*/
|
|
1894
2417
|
var Type;
|
|
1895
2418
|
(function (Type) {
|
|
1896
2419
|
/**
|
|
@@ -1946,6 +2469,12 @@ var Type;
|
|
|
1946
2469
|
*/
|
|
1947
2470
|
Type["Url"] = "url";
|
|
1948
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
|
+
*/
|
|
1949
2478
|
class PropertySet {
|
|
1950
2479
|
constructor(properties = []) {
|
|
1951
2480
|
this.propertyList = properties;
|
|
@@ -1961,6 +2490,11 @@ class PropertySet {
|
|
|
1961
2490
|
return this.propertyList.length > 0;
|
|
1962
2491
|
}
|
|
1963
2492
|
}
|
|
2493
|
+
/**
|
|
2494
|
+
* A set of values corresponding to a set of properties.
|
|
2495
|
+
* @see PropertySet
|
|
2496
|
+
* @private
|
|
2497
|
+
*/
|
|
1964
2498
|
class ValueSet {
|
|
1965
2499
|
constructor(propertySet, rootElement) {
|
|
1966
2500
|
this.displayedProperties = [];
|
|
@@ -2152,6 +2686,11 @@ const equals = (a, b) => {
|
|
|
2152
2686
|
};
|
|
2153
2687
|
|
|
2154
2688
|
let idTicker$4 = 0;
|
|
2689
|
+
/**
|
|
2690
|
+
* Default values of the parameters of a diagram connection.
|
|
2691
|
+
* @see DiagramConnection
|
|
2692
|
+
* @private
|
|
2693
|
+
*/
|
|
2155
2694
|
const DIAGRAM_CONNECTION_TYPE_DEFAULTS = {
|
|
2156
2695
|
name: '',
|
|
2157
2696
|
width: 1,
|
|
@@ -2166,6 +2705,11 @@ const DIAGRAM_CONNECTION_TYPE_DEFAULTS = {
|
|
|
2166
2705
|
selectedColor: '#000000',
|
|
2167
2706
|
properties: []
|
|
2168
2707
|
};
|
|
2708
|
+
/**
|
|
2709
|
+
* A connection type, which holds properties that connections of this type share in common.
|
|
2710
|
+
* @see ConnectionTypeConfig
|
|
2711
|
+
* @public
|
|
2712
|
+
*/
|
|
2169
2713
|
class DiagramConnectionType {
|
|
2170
2714
|
constructor(options) {
|
|
2171
2715
|
const values = {
|
|
@@ -2193,7 +2737,16 @@ class DiagramConnectionType {
|
|
|
2193
2737
|
return this.endTypes.indexOf(type) >= 0;
|
|
2194
2738
|
}
|
|
2195
2739
|
}
|
|
2740
|
+
/**
|
|
2741
|
+
* A connection which goes from one port to another.
|
|
2742
|
+
* @see DiagramPort
|
|
2743
|
+
* @public
|
|
2744
|
+
*/
|
|
2196
2745
|
class DiagramConnection extends DiagramElement {
|
|
2746
|
+
/**
|
|
2747
|
+
* Name of this connection. Alias for this connection's middle label.
|
|
2748
|
+
* @public
|
|
2749
|
+
*/
|
|
2197
2750
|
get name() {
|
|
2198
2751
|
return this.middleLabel;
|
|
2199
2752
|
}
|
|
@@ -2211,11 +2764,35 @@ class DiagramConnection extends DiagramElement {
|
|
|
2211
2764
|
} while (model.connections.get(uniqueId) !== undefined);
|
|
2212
2765
|
}
|
|
2213
2766
|
super(model, uniqueId);
|
|
2767
|
+
/**
|
|
2768
|
+
* Coordinates of the start point of this connection.
|
|
2769
|
+
* @public
|
|
2770
|
+
*/
|
|
2214
2771
|
this.startCoords = [0, 0];
|
|
2772
|
+
/**
|
|
2773
|
+
* Coordinates of the end point of this connection.
|
|
2774
|
+
* @public
|
|
2775
|
+
*/
|
|
2215
2776
|
this.endCoords = [0, 0];
|
|
2777
|
+
/**
|
|
2778
|
+
* Text at the start of this connection, or `''` if no text.
|
|
2779
|
+
* @public
|
|
2780
|
+
*/
|
|
2216
2781
|
this.startLabel = '';
|
|
2782
|
+
/**
|
|
2783
|
+
* Text at the middle of this connection, or `''` if no text.
|
|
2784
|
+
* @public
|
|
2785
|
+
*/
|
|
2217
2786
|
this.middleLabel = '';
|
|
2787
|
+
/**
|
|
2788
|
+
* Text at the end of this connection, or `''` if no text.
|
|
2789
|
+
* @public
|
|
2790
|
+
*/
|
|
2218
2791
|
this.endLabel = '';
|
|
2792
|
+
/**
|
|
2793
|
+
* Points that this connection passes through.
|
|
2794
|
+
* @public
|
|
2795
|
+
*/
|
|
2219
2796
|
this.points = [];
|
|
2220
2797
|
this.type = type;
|
|
2221
2798
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
@@ -2231,24 +2808,36 @@ class DiagramConnection extends DiagramElement {
|
|
|
2231
2808
|
}
|
|
2232
2809
|
}
|
|
2233
2810
|
setStart(start) {
|
|
2234
|
-
if (this.start !==
|
|
2235
|
-
|
|
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
|
+
}
|
|
2236
2821
|
}
|
|
2237
|
-
|
|
2238
|
-
if (start !== undefined) {
|
|
2239
|
-
start.outgoingConnections.push(this);
|
|
2822
|
+
else {
|
|
2240
2823
|
this.startDirection = start?.direction;
|
|
2241
2824
|
this.startCoords = start?.coords || [0, 0];
|
|
2242
2825
|
}
|
|
2243
2826
|
this.updateInView();
|
|
2244
2827
|
}
|
|
2245
2828
|
setEnd(end) {
|
|
2246
|
-
if (this.end !==
|
|
2247
|
-
|
|
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
|
+
}
|
|
2248
2839
|
}
|
|
2249
|
-
|
|
2250
|
-
if (end !== undefined) {
|
|
2251
|
-
end.incomingConnections.push(this);
|
|
2840
|
+
else {
|
|
2252
2841
|
this.endDirection = end?.direction;
|
|
2253
2842
|
this.endCoords = end?.coords || [0, 0];
|
|
2254
2843
|
}
|
|
@@ -2317,6 +2906,24 @@ class DiagramConnectionSet extends DiagramEntitySet {
|
|
|
2317
2906
|
}
|
|
2318
2907
|
|
|
2319
2908
|
let idTicker$3 = 0;
|
|
2909
|
+
/**
|
|
2910
|
+
* Default values of the look of a diagram section.
|
|
2911
|
+
* @see DIAGRAM_SECTION_DEFAULTS
|
|
2912
|
+
* @private
|
|
2913
|
+
*/
|
|
2914
|
+
const DIAGRAM_SECTION_LOOK_DEFAULTS = {
|
|
2915
|
+
lookType: 'shaped-look',
|
|
2916
|
+
shape: ClosedShape.Rectangle,
|
|
2917
|
+
color: '#FFFFFF',
|
|
2918
|
+
borderColor: '#000000',
|
|
2919
|
+
selectedColor: '#FFFFFF',
|
|
2920
|
+
selectedBorderColor: '#000000'
|
|
2921
|
+
};
|
|
2922
|
+
/**
|
|
2923
|
+
* Default values of the parameters of a diagram section.
|
|
2924
|
+
* @see DiagramSection
|
|
2925
|
+
* @private
|
|
2926
|
+
*/
|
|
2320
2927
|
const DIAGRAM_SECTION_DEFAULTS = {
|
|
2321
2928
|
sectionsX: 1,
|
|
2322
2929
|
sectionsY: 1,
|
|
@@ -2325,9 +2932,20 @@ const DIAGRAM_SECTION_DEFAULTS = {
|
|
|
2325
2932
|
margin: 0,
|
|
2326
2933
|
label: null,
|
|
2327
2934
|
ports: [],
|
|
2328
|
-
look:
|
|
2935
|
+
look: DIAGRAM_SECTION_LOOK_DEFAULTS
|
|
2329
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
|
+
*/
|
|
2330
2944
|
class DiagramSection extends DiagramElement {
|
|
2945
|
+
/**
|
|
2946
|
+
* Name of this section. Alias for this section's label's text.
|
|
2947
|
+
* @public
|
|
2948
|
+
*/
|
|
2331
2949
|
get name() {
|
|
2332
2950
|
return this.label?.text || '';
|
|
2333
2951
|
}
|
|
@@ -2348,6 +2966,10 @@ class DiagramSection extends DiagramElement {
|
|
|
2348
2966
|
} while (model.sections.get(uniqueId) !== undefined);
|
|
2349
2967
|
}
|
|
2350
2968
|
super(model, uniqueId);
|
|
2969
|
+
/**
|
|
2970
|
+
* Ports of this section.
|
|
2971
|
+
* @public
|
|
2972
|
+
*/
|
|
2351
2973
|
this.ports = [];
|
|
2352
2974
|
this.node = node;
|
|
2353
2975
|
this.coords = coords;
|
|
@@ -2614,7 +3236,12 @@ class DiagramSectionSet extends DiagramEntitySet {
|
|
|
2614
3236
|
}
|
|
2615
3237
|
|
|
2616
3238
|
let idTicker$2 = 0;
|
|
2617
|
-
|
|
3239
|
+
/**
|
|
3240
|
+
* Default values of the look of a diagram node.
|
|
3241
|
+
* @see DIAGRAM_NODE_TYPE_DEFAULTS
|
|
3242
|
+
* @private
|
|
3243
|
+
*/
|
|
3244
|
+
const DIAGRAM_NODE_LOOK_DEFAULTS = {
|
|
2618
3245
|
lookType: 'shaped-look',
|
|
2619
3246
|
shape: ClosedShape.Rectangle,
|
|
2620
3247
|
color: '#FFFFFF',
|
|
@@ -2622,6 +3249,11 @@ const DIAGRAM_LOOK_DEFAULTS = {
|
|
|
2622
3249
|
selectedColor: '#FFFFFF',
|
|
2623
3250
|
selectedBorderColor: '#000000'
|
|
2624
3251
|
};
|
|
3252
|
+
/**
|
|
3253
|
+
* Default values of the parameters of a diagram node.
|
|
3254
|
+
* @see DiagramNode
|
|
3255
|
+
* @private
|
|
3256
|
+
*/
|
|
2625
3257
|
const DIAGRAM_NODE_TYPE_DEFAULTS = {
|
|
2626
3258
|
name: '',
|
|
2627
3259
|
defaultWidth: 0,
|
|
@@ -2633,11 +3265,16 @@ const DIAGRAM_NODE_TYPE_DEFAULTS = {
|
|
|
2633
3265
|
label: null,
|
|
2634
3266
|
ports: [],
|
|
2635
3267
|
sections: null,
|
|
2636
|
-
look:
|
|
3268
|
+
look: DIAGRAM_NODE_LOOK_DEFAULTS,
|
|
2637
3269
|
isUnique: false,
|
|
2638
3270
|
priority: 0,
|
|
2639
3271
|
properties: []
|
|
2640
3272
|
};
|
|
3273
|
+
/**
|
|
3274
|
+
* A node type, which holds properties that nodes of this type share in common.
|
|
3275
|
+
* @see NodeTypeConfig
|
|
3276
|
+
* @public
|
|
3277
|
+
*/
|
|
2641
3278
|
class DiagramNodeType {
|
|
2642
3279
|
constructor(options) {
|
|
2643
3280
|
const values = {
|
|
@@ -2661,7 +3298,18 @@ class DiagramNodeType {
|
|
|
2661
3298
|
this.propertySet = new PropertySet(options?.properties || []);
|
|
2662
3299
|
}
|
|
2663
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
|
+
*/
|
|
2664
3308
|
class DiagramNode extends DiagramElement {
|
|
3309
|
+
/**
|
|
3310
|
+
* Name of this node. Alias for this node's label's text.
|
|
3311
|
+
* @public
|
|
3312
|
+
*/
|
|
2665
3313
|
get name() {
|
|
2666
3314
|
return this.label?.text || '';
|
|
2667
3315
|
}
|
|
@@ -2682,7 +3330,15 @@ class DiagramNode extends DiagramElement {
|
|
|
2682
3330
|
} while (model.nodes.get(uniqueId) !== undefined);
|
|
2683
3331
|
}
|
|
2684
3332
|
super(model, uniqueId);
|
|
3333
|
+
/**
|
|
3334
|
+
* Sections of this node.
|
|
3335
|
+
* @public
|
|
3336
|
+
*/
|
|
2685
3337
|
this.sections = [];
|
|
3338
|
+
/**
|
|
3339
|
+
* Ports of this node.
|
|
3340
|
+
* @public
|
|
3341
|
+
*/
|
|
2686
3342
|
this.ports = [];
|
|
2687
3343
|
this.type = type;
|
|
2688
3344
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
@@ -3012,11 +3668,23 @@ class DiagramNodeSet extends DiagramEntitySet {
|
|
|
3012
3668
|
}
|
|
3013
3669
|
|
|
3014
3670
|
let idTicker$1 = 0;
|
|
3671
|
+
/**
|
|
3672
|
+
* Default values of the parameters of a diagram port.
|
|
3673
|
+
* @see DiagramPort
|
|
3674
|
+
* @private
|
|
3675
|
+
*/
|
|
3015
3676
|
const DIAGRAM_PORT_DEFAULTS = {
|
|
3016
3677
|
radius: 12,
|
|
3017
3678
|
highlightedColor: 'cyan',
|
|
3018
3679
|
selectedColor: 'violet'
|
|
3019
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
|
+
*/
|
|
3020
3688
|
class DiagramPort extends DiagramElement {
|
|
3021
3689
|
constructor(model, rootElement, coords, direction, id) {
|
|
3022
3690
|
let uniqueId;
|
|
@@ -3029,7 +3697,15 @@ class DiagramPort extends DiagramElement {
|
|
|
3029
3697
|
} while (model.ports.get(uniqueId) !== undefined);
|
|
3030
3698
|
}
|
|
3031
3699
|
super(model, uniqueId);
|
|
3700
|
+
/**
|
|
3701
|
+
* Connections that start at this port.
|
|
3702
|
+
* @public
|
|
3703
|
+
*/
|
|
3032
3704
|
this.outgoingConnections = [];
|
|
3705
|
+
/**
|
|
3706
|
+
* Connections that end at this port.
|
|
3707
|
+
* @public
|
|
3708
|
+
*/
|
|
3033
3709
|
this.incomingConnections = [];
|
|
3034
3710
|
this.rootElement = rootElement;
|
|
3035
3711
|
this.coords = coords;
|
|
@@ -3146,6 +3822,11 @@ class DiagramPortSet extends DiagramEntitySet {
|
|
|
3146
3822
|
}
|
|
3147
3823
|
|
|
3148
3824
|
let idTicker = 0;
|
|
3825
|
+
/**
|
|
3826
|
+
* Default values of the parameters of a diagram field.
|
|
3827
|
+
* @see DiagramField
|
|
3828
|
+
* @private
|
|
3829
|
+
*/
|
|
3149
3830
|
const DIAGRAM_FIELD_DEFAULTS = {
|
|
3150
3831
|
editable: true,
|
|
3151
3832
|
fontSize: 0,
|
|
@@ -3157,7 +3838,18 @@ const DIAGRAM_FIELD_DEFAULTS = {
|
|
|
3157
3838
|
horizontalAlign: HorizontalAlign.Center,
|
|
3158
3839
|
verticalAlign: VerticalAlign.Center
|
|
3159
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
|
+
*/
|
|
3160
3848
|
class DiagramField extends DiagramElement {
|
|
3849
|
+
/**
|
|
3850
|
+
* Text contents of this field.
|
|
3851
|
+
* @public
|
|
3852
|
+
*/
|
|
3161
3853
|
get text() {
|
|
3162
3854
|
return this._text;
|
|
3163
3855
|
}
|
|
@@ -3267,23 +3959,46 @@ class DiagramFieldSet extends DiagramEntitySet {
|
|
|
3267
3959
|
}
|
|
3268
3960
|
}
|
|
3269
3961
|
|
|
3962
|
+
/**
|
|
3963
|
+
* Stores the data of a diagram.
|
|
3964
|
+
* @public
|
|
3965
|
+
*/
|
|
3270
3966
|
class DiagramModel {
|
|
3271
|
-
// canvas attribute accesors
|
|
3272
|
-
// added so that the valueSet can access canvas attributes and change them
|
|
3273
|
-
get layoutFormat() {
|
|
3274
|
-
return this.canvas?.layoutFormat;
|
|
3275
|
-
}
|
|
3276
|
-
set layoutFormat(value) {
|
|
3277
|
-
if (this.canvas) {
|
|
3278
|
-
this.canvas.layoutFormat = value;
|
|
3279
|
-
}
|
|
3280
|
-
}
|
|
3281
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
|
+
*/
|
|
3282
3972
|
this.renderToCanvas = true;
|
|
3973
|
+
/**
|
|
3974
|
+
* Nodes of this model.
|
|
3975
|
+
* @see DiagramNode
|
|
3976
|
+
* @public
|
|
3977
|
+
*/
|
|
3283
3978
|
this.nodes = new DiagramNodeSet(this);
|
|
3979
|
+
/**
|
|
3980
|
+
* Sections of this model.
|
|
3981
|
+
* @see DiagramSection
|
|
3982
|
+
* @public
|
|
3983
|
+
*/
|
|
3284
3984
|
this.sections = new DiagramSectionSet(this);
|
|
3985
|
+
/**
|
|
3986
|
+
* Ports of this model.
|
|
3987
|
+
* @see DiagramPort
|
|
3988
|
+
* @public
|
|
3989
|
+
*/
|
|
3285
3990
|
this.ports = new DiagramPortSet(this);
|
|
3991
|
+
/**
|
|
3992
|
+
* Connections of this model.
|
|
3993
|
+
* @see DiagramConnection
|
|
3994
|
+
* @public
|
|
3995
|
+
*/
|
|
3286
3996
|
this.connections = new DiagramConnectionSet(this);
|
|
3997
|
+
/**
|
|
3998
|
+
* Fields of this model.
|
|
3999
|
+
* @see DiagramField
|
|
4000
|
+
* @public
|
|
4001
|
+
*/
|
|
3287
4002
|
this.fields = new DiagramFieldSet(this);
|
|
3288
4003
|
this.canvas = canvas;
|
|
3289
4004
|
this.id = id;
|
|
@@ -3294,15 +4009,25 @@ class DiagramModel {
|
|
|
3294
4009
|
this.updatedAt = new Date();
|
|
3295
4010
|
this.valueSet = new ValueSet(new PropertySet(properties), this);
|
|
3296
4011
|
}
|
|
4012
|
+
/**
|
|
4013
|
+
* Enables rendering to canvas in real time and updates the view of this model in the canvas.
|
|
4014
|
+
* @public
|
|
4015
|
+
*/
|
|
3297
4016
|
enableRenderToCanvas() {
|
|
3298
4017
|
this.renderToCanvas = true;
|
|
3299
4018
|
this.canvas?.updateModelInView();
|
|
3300
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
|
+
*/
|
|
3301
4025
|
disableRenderToCanvas() {
|
|
3302
4026
|
this.renderToCanvas = false;
|
|
3303
4027
|
}
|
|
3304
4028
|
/**
|
|
3305
4029
|
* Deletes everything in this diagram.
|
|
4030
|
+
* @public
|
|
3306
4031
|
*/
|
|
3307
4032
|
clear() {
|
|
3308
4033
|
this.id = undefined;
|
|
@@ -3325,20 +4050,24 @@ class DiagramModel {
|
|
|
3325
4050
|
|
|
3326
4051
|
/**
|
|
3327
4052
|
* Thickness of the invisible path around a connection used to make it easier to click on, in pixels.
|
|
4053
|
+
* @private
|
|
3328
4054
|
*/
|
|
3329
4055
|
const CONNECTION_PATH_BOX_THICKNESS = 12;
|
|
3330
4056
|
/**
|
|
3331
4057
|
* Thickness of the resizer line used to resize nodes and sections on drag, in pixels.
|
|
4058
|
+
* @private
|
|
3332
4059
|
*/
|
|
3333
4060
|
const RESIZER_THICKNESS = 6;
|
|
3334
4061
|
/**
|
|
3335
4062
|
* Text to display as the title of the property editor when editing this diagram's properties.
|
|
3336
4063
|
* @see PropertyEditorComponent
|
|
4064
|
+
* @private
|
|
3337
4065
|
*/
|
|
3338
4066
|
const DIAGRAM_PROPERTIES_TEXT = 'Diagram properties';
|
|
3339
4067
|
/**
|
|
3340
4068
|
* Maximum number of user actions that can be recorded in the user action queue.
|
|
3341
4069
|
* @see ActionQueue
|
|
4070
|
+
* @private
|
|
3342
4071
|
*/
|
|
3343
4072
|
const ACTION_QUEUE_SIZE = 25;
|
|
3344
4073
|
class DiagramCanvas {
|
|
@@ -3364,6 +4093,7 @@ class DiagramCanvas {
|
|
|
3364
4093
|
this.priorityThreshold = config.defaultPriorityThreshold;
|
|
3365
4094
|
this.priorityThresholds = config.priorityThresholds || [];
|
|
3366
4095
|
this.layoutFormat = config.layoutFormat;
|
|
4096
|
+
this.userActions = config.userActions || {};
|
|
3367
4097
|
this.validators = [];
|
|
3368
4098
|
this.actionQueue = new ActionQueue(ACTION_QUEUE_SIZE);
|
|
3369
4099
|
// load node types
|
|
@@ -3416,7 +4146,9 @@ class DiagramCanvas {
|
|
|
3416
4146
|
d3.select(this.diagramRoot).node()?.focus();
|
|
3417
4147
|
})
|
|
3418
4148
|
.on(Events.KeyUp, (event) => {
|
|
3419
|
-
if (!event.ctrlKey &&
|
|
4149
|
+
if (!event.ctrlKey &&
|
|
4150
|
+
event.key === Keys.Delete &&
|
|
4151
|
+
this.userActions[DiagramActions.RemoveAction] !== false) {
|
|
3420
4152
|
// delete selection
|
|
3421
4153
|
if (this.userSelection.length > 0) {
|
|
3422
4154
|
const nodesToBeDeleted = [];
|
|
@@ -3663,37 +4395,43 @@ class DiagramCanvas {
|
|
|
3663
4395
|
.call(d3
|
|
3664
4396
|
.drag()
|
|
3665
4397
|
.on(DragEvents.Start, (event, d) => {
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
4398
|
+
if (this.userActions[DiagramActions.MoveNodeAction] !== false) {
|
|
4399
|
+
d3.select('body').style('cursor', 'grabbing');
|
|
4400
|
+
this.draggingFrom = [event.x, event.y];
|
|
4401
|
+
this.currentAction = new MoveNodeAction(this, d.id, d.coords, [0, 0]);
|
|
4402
|
+
}
|
|
3669
4403
|
})
|
|
3670
4404
|
.on(DragEvents.Drag, (event, d) => {
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
event.y - d.height / 2
|
|
3674
|
-
];
|
|
3675
|
-
d.move(newNodeCoords);
|
|
3676
|
-
})
|
|
3677
|
-
.on(DragEvents.End, (event, d) => {
|
|
3678
|
-
// prevent drag behavior if mouse hasn't moved
|
|
3679
|
-
if ((this.draggingFrom[0] !== event.x ||
|
|
3680
|
-
this.draggingFrom[1] !== event.y) &&
|
|
3681
|
-
this.currentAction instanceof MoveNodeAction) {
|
|
3682
|
-
let newNodeCoords = [
|
|
4405
|
+
if (this.userActions[DiagramActions.MoveNodeAction] !== false) {
|
|
4406
|
+
const newNodeCoords = [
|
|
3683
4407
|
event.x - d.width / 2,
|
|
3684
4408
|
event.y - d.height / 2
|
|
3685
4409
|
];
|
|
3686
|
-
if (this.snapToGrid) {
|
|
3687
|
-
newNodeCoords = this.getClosestGridPoint(newNodeCoords);
|
|
3688
|
-
}
|
|
3689
4410
|
d.move(newNodeCoords);
|
|
3690
|
-
this.currentAction.to = newNodeCoords;
|
|
3691
|
-
this.actionQueue.add(this.currentAction);
|
|
3692
4411
|
}
|
|
3693
|
-
|
|
3694
|
-
|
|
4412
|
+
})
|
|
4413
|
+
.on(DragEvents.End, (event, d) => {
|
|
4414
|
+
if (this.userActions[DiagramActions.MoveNodeAction] !== false) {
|
|
4415
|
+
// prevent drag behavior if mouse hasn't moved
|
|
4416
|
+
if ((this.draggingFrom[0] !== event.x ||
|
|
4417
|
+
this.draggingFrom[1] !== event.y) &&
|
|
4418
|
+
this.currentAction instanceof MoveNodeAction) {
|
|
4419
|
+
let newNodeCoords = [
|
|
4420
|
+
event.x - d.width / 2,
|
|
4421
|
+
event.y - d.height / 2
|
|
4422
|
+
];
|
|
4423
|
+
if (this.snapToGrid) {
|
|
4424
|
+
newNodeCoords = this.getClosestGridPoint(newNodeCoords);
|
|
4425
|
+
}
|
|
4426
|
+
d.move(newNodeCoords);
|
|
4427
|
+
this.currentAction.to = newNodeCoords;
|
|
4428
|
+
this.actionQueue.add(this.currentAction);
|
|
4429
|
+
}
|
|
4430
|
+
else {
|
|
4431
|
+
this.currentAction = undefined;
|
|
4432
|
+
}
|
|
4433
|
+
d3.select('body').style('cursor', 'auto');
|
|
3695
4434
|
}
|
|
3696
|
-
d3.select('body').style('cursor', 'auto');
|
|
3697
4435
|
}));
|
|
3698
4436
|
enterSelection.filter('.shaped-look').append('path');
|
|
3699
4437
|
enterSelection
|
|
@@ -3752,31 +4490,36 @@ class DiagramCanvas {
|
|
|
3752
4490
|
.attr('stroke', 'transparent')
|
|
3753
4491
|
.attr('stroke-width', `${RESIZER_THICKNESS}px`)
|
|
3754
4492
|
.on(Events.MouseOver, (event, d) => {
|
|
3755
|
-
if (
|
|
4493
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4494
|
+
d.type.resizableX) {
|
|
3756
4495
|
d3.select('body').style('cursor', 'ew-resize');
|
|
3757
4496
|
}
|
|
3758
4497
|
})
|
|
3759
4498
|
.on(Events.MouseOut, (event, d) => {
|
|
3760
|
-
if (
|
|
4499
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4500
|
+
d.type.resizableX) {
|
|
3761
4501
|
d3.select('body').style('cursor', 'auto');
|
|
3762
4502
|
}
|
|
3763
4503
|
})
|
|
3764
4504
|
.call(d3
|
|
3765
4505
|
.drag()
|
|
3766
4506
|
.on(DragEvents.Start, (event, d) => {
|
|
3767
|
-
if (
|
|
4507
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4508
|
+
d.type.resizableX) {
|
|
3768
4509
|
d3.select('body').style('cursor', 'ew-resize');
|
|
3769
4510
|
this.currentAction = new StretchNodeAction(this, d.id, Side.Left, d.width, d.width);
|
|
3770
4511
|
}
|
|
3771
4512
|
})
|
|
3772
4513
|
.on(DragEvents.Drag, (event, d) => {
|
|
3773
|
-
if (
|
|
4514
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4515
|
+
d.type.resizableX) {
|
|
3774
4516
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
3775
4517
|
d.stretch(Side.Left, d.coords[0] - pointerCoords[0]);
|
|
3776
4518
|
}
|
|
3777
4519
|
})
|
|
3778
4520
|
.on(DragEvents.End, (event, d) => {
|
|
3779
|
-
if (
|
|
4521
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4522
|
+
d.type.resizableX) {
|
|
3780
4523
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
3781
4524
|
if (this.snapToGrid) {
|
|
3782
4525
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -3795,31 +4538,36 @@ class DiagramCanvas {
|
|
|
3795
4538
|
.attr('stroke', 'transparent')
|
|
3796
4539
|
.attr('stroke-width', `${RESIZER_THICKNESS}px`)
|
|
3797
4540
|
.on(Events.MouseOver, (event, d) => {
|
|
3798
|
-
if (
|
|
4541
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4542
|
+
d.type.resizableY) {
|
|
3799
4543
|
d3.select('body').style('cursor', 'ns-resize');
|
|
3800
4544
|
}
|
|
3801
4545
|
})
|
|
3802
4546
|
.on(Events.MouseOut, (event, d) => {
|
|
3803
|
-
if (
|
|
4547
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4548
|
+
d.type.resizableY) {
|
|
3804
4549
|
d3.select('body').style('cursor', 'auto');
|
|
3805
4550
|
}
|
|
3806
4551
|
})
|
|
3807
4552
|
.call(d3
|
|
3808
4553
|
.drag()
|
|
3809
4554
|
.on(DragEvents.Start, (event, d) => {
|
|
3810
|
-
if (
|
|
4555
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4556
|
+
d.type.resizableY) {
|
|
3811
4557
|
d3.select('body').style('cursor', 'ns-resize');
|
|
3812
4558
|
this.currentAction = new StretchNodeAction(this, d.id, Side.Top, d.height, d.height);
|
|
3813
4559
|
}
|
|
3814
4560
|
})
|
|
3815
4561
|
.on(DragEvents.Drag, (event, d) => {
|
|
3816
|
-
if (
|
|
4562
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4563
|
+
d.type.resizableY) {
|
|
3817
4564
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
3818
4565
|
d.stretch(Side.Top, d.coords[1] - pointerCoords[1]);
|
|
3819
4566
|
}
|
|
3820
4567
|
})
|
|
3821
4568
|
.on(DragEvents.End, (event, d) => {
|
|
3822
|
-
if (
|
|
4569
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4570
|
+
d.type.resizableY) {
|
|
3823
4571
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
3824
4572
|
if (this.snapToGrid) {
|
|
3825
4573
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -3838,31 +4586,36 @@ class DiagramCanvas {
|
|
|
3838
4586
|
.attr('stroke', 'transparent')
|
|
3839
4587
|
.attr('stroke-width', `${RESIZER_THICKNESS}px`)
|
|
3840
4588
|
.on(Events.MouseOver, (event, d) => {
|
|
3841
|
-
if (
|
|
4589
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4590
|
+
d.type.resizableX) {
|
|
3842
4591
|
d3.select('body').style('cursor', 'ew-resize');
|
|
3843
4592
|
}
|
|
3844
4593
|
})
|
|
3845
4594
|
.on(Events.MouseOut, (event, d) => {
|
|
3846
|
-
if (
|
|
4595
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4596
|
+
d.type.resizableX) {
|
|
3847
4597
|
d3.select('body').style('cursor', 'auto');
|
|
3848
4598
|
}
|
|
3849
4599
|
})
|
|
3850
4600
|
.call(d3
|
|
3851
4601
|
.drag()
|
|
3852
4602
|
.on(DragEvents.Start, (event, d) => {
|
|
3853
|
-
if (
|
|
4603
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4604
|
+
d.type.resizableX) {
|
|
3854
4605
|
d3.select('body').style('cursor', 'ew-resize');
|
|
3855
4606
|
this.currentAction = new StretchNodeAction(this, d.id, Side.Right, d.width, d.width);
|
|
3856
4607
|
}
|
|
3857
4608
|
})
|
|
3858
4609
|
.on(DragEvents.Drag, (event, d) => {
|
|
3859
|
-
if (
|
|
4610
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4611
|
+
d.type.resizableX) {
|
|
3860
4612
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
3861
4613
|
d.stretch(Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
3862
4614
|
}
|
|
3863
4615
|
})
|
|
3864
4616
|
.on(DragEvents.End, (event, d) => {
|
|
3865
|
-
if (
|
|
4617
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4618
|
+
d.type.resizableX) {
|
|
3866
4619
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
3867
4620
|
if (this.snapToGrid) {
|
|
3868
4621
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -3881,31 +4634,36 @@ class DiagramCanvas {
|
|
|
3881
4634
|
.attr('stroke', 'transparent')
|
|
3882
4635
|
.attr('stroke-width', `${RESIZER_THICKNESS}px`)
|
|
3883
4636
|
.on(Events.MouseOver, (event, d) => {
|
|
3884
|
-
if (
|
|
4637
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4638
|
+
d.type.resizableY) {
|
|
3885
4639
|
d3.select('body').style('cursor', 'ns-resize');
|
|
3886
4640
|
}
|
|
3887
4641
|
})
|
|
3888
4642
|
.on(Events.MouseOut, (event, d) => {
|
|
3889
|
-
if (
|
|
4643
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4644
|
+
d.type.resizableY) {
|
|
3890
4645
|
d3.select('body').style('cursor', 'auto');
|
|
3891
4646
|
}
|
|
3892
4647
|
})
|
|
3893
4648
|
.call(d3
|
|
3894
4649
|
.drag()
|
|
3895
4650
|
.on(DragEvents.Start, (event, d) => {
|
|
3896
|
-
if (
|
|
4651
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4652
|
+
d.type.resizableY) {
|
|
3897
4653
|
d3.select('body').style('cursor', 'ns-resize');
|
|
3898
4654
|
this.currentAction = new StretchNodeAction(this, d.id, Side.Bottom, d.height, d.height);
|
|
3899
4655
|
}
|
|
3900
4656
|
})
|
|
3901
4657
|
.on(DragEvents.Drag, (event, d) => {
|
|
3902
|
-
if (
|
|
4658
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4659
|
+
d.type.resizableY) {
|
|
3903
4660
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
3904
4661
|
d.stretch(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
3905
4662
|
}
|
|
3906
4663
|
})
|
|
3907
4664
|
.on(DragEvents.End, (event, d) => {
|
|
3908
|
-
if (
|
|
4665
|
+
if (this.userActions[DiagramActions.StretchNodeAction] !== false &&
|
|
4666
|
+
d.type.resizableY) {
|
|
3909
4667
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
3910
4668
|
if (this.snapToGrid) {
|
|
3911
4669
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -4113,40 +4871,46 @@ class DiagramCanvas {
|
|
|
4113
4871
|
.call(d3
|
|
4114
4872
|
.drag()
|
|
4115
4873
|
.on(DragEvents.Start, (event, d) => {
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4874
|
+
if (this.userActions[DiagramActions.MoveNodeAction] !== false) {
|
|
4875
|
+
const node = d.node;
|
|
4876
|
+
d3.select('body').style('cursor', 'grabbing');
|
|
4877
|
+
this.draggingFrom = [event.x, event.y];
|
|
4878
|
+
this.currentAction = new MoveNodeAction(this, node.id, node.coords, [0, 0]);
|
|
4879
|
+
}
|
|
4120
4880
|
})
|
|
4121
4881
|
.on(DragEvents.Drag, (event, d) => {
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
event.y - node.height / 2
|
|
4126
|
-
];
|
|
4127
|
-
node.move(newNodeCoords);
|
|
4128
|
-
})
|
|
4129
|
-
.on(DragEvents.End, (event, d) => {
|
|
4130
|
-
const node = d.node;
|
|
4131
|
-
// prevent drag behavior if mouse hasn't moved
|
|
4132
|
-
if ((this.draggingFrom[0] !== event.x ||
|
|
4133
|
-
this.draggingFrom[1] !== event.y) &&
|
|
4134
|
-
this.currentAction instanceof MoveNodeAction) {
|
|
4135
|
-
let newNodeCoords = [
|
|
4882
|
+
if (this.userActions[DiagramActions.MoveNodeAction] !== false) {
|
|
4883
|
+
const node = d.node;
|
|
4884
|
+
const newNodeCoords = [
|
|
4136
4885
|
event.x - node.width / 2,
|
|
4137
4886
|
event.y - node.height / 2
|
|
4138
4887
|
];
|
|
4139
|
-
|
|
4140
|
-
newNodeCoords = this.getClosestGridPoint(newNodeCoords);
|
|
4141
|
-
}
|
|
4142
|
-
d.node?.move(newNodeCoords);
|
|
4143
|
-
this.currentAction.to = newNodeCoords;
|
|
4144
|
-
this.actionQueue.add(this.currentAction);
|
|
4888
|
+
node.move(newNodeCoords);
|
|
4145
4889
|
}
|
|
4146
|
-
|
|
4147
|
-
|
|
4890
|
+
})
|
|
4891
|
+
.on(DragEvents.End, (event, d) => {
|
|
4892
|
+
if (this.userActions[DiagramActions.MoveNodeAction] !== false) {
|
|
4893
|
+
const node = d.node;
|
|
4894
|
+
// prevent drag behavior if mouse hasn't moved
|
|
4895
|
+
if ((this.draggingFrom[0] !== event.x ||
|
|
4896
|
+
this.draggingFrom[1] !== event.y) &&
|
|
4897
|
+
this.currentAction instanceof MoveNodeAction) {
|
|
4898
|
+
let newNodeCoords = [
|
|
4899
|
+
event.x - node.width / 2,
|
|
4900
|
+
event.y - node.height / 2
|
|
4901
|
+
];
|
|
4902
|
+
if (this.snapToGrid) {
|
|
4903
|
+
newNodeCoords = this.getClosestGridPoint(newNodeCoords);
|
|
4904
|
+
}
|
|
4905
|
+
d.node?.move(newNodeCoords);
|
|
4906
|
+
this.currentAction.to = newNodeCoords;
|
|
4907
|
+
this.actionQueue.add(this.currentAction);
|
|
4908
|
+
}
|
|
4909
|
+
else {
|
|
4910
|
+
this.currentAction = undefined;
|
|
4911
|
+
}
|
|
4912
|
+
d3.select('body').style('cursor', 'auto');
|
|
4148
4913
|
}
|
|
4149
|
-
d3.select('body').style('cursor', 'auto');
|
|
4150
4914
|
}));
|
|
4151
4915
|
enterSelection.filter('.shaped-look').append('path');
|
|
4152
4916
|
enterSelection
|
|
@@ -4205,31 +4969,36 @@ class DiagramCanvas {
|
|
|
4205
4969
|
.attr('stroke', 'transparent')
|
|
4206
4970
|
.attr('stroke-width', `${RESIZER_THICKNESS}px`)
|
|
4207
4971
|
.on(Events.MouseOver, (event, d) => {
|
|
4208
|
-
if (
|
|
4972
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
4973
|
+
d.node?.type?.resizableX) {
|
|
4209
4974
|
d3.select('body').style('cursor', 'ew-resize');
|
|
4210
4975
|
}
|
|
4211
4976
|
})
|
|
4212
4977
|
.on(Events.MouseOut, (event, d) => {
|
|
4213
|
-
if (
|
|
4978
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
4979
|
+
d.node?.type?.resizableX) {
|
|
4214
4980
|
d3.select('body').style('cursor', 'auto');
|
|
4215
4981
|
}
|
|
4216
4982
|
})
|
|
4217
4983
|
.call(d3
|
|
4218
4984
|
.drag()
|
|
4219
4985
|
.on(DragEvents.Start, (event, d) => {
|
|
4220
|
-
if (
|
|
4986
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
4987
|
+
d.node?.type?.resizableX) {
|
|
4221
4988
|
d3.select('body').style('cursor', 'ew-resize');
|
|
4222
4989
|
this.currentAction = new StretchSectionAction(this, d.id, Side.Left, d.width, d.width);
|
|
4223
4990
|
}
|
|
4224
4991
|
})
|
|
4225
4992
|
.on(DragEvents.Drag, (event, d) => {
|
|
4226
|
-
if (
|
|
4993
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
4994
|
+
d.node?.type?.resizableX) {
|
|
4227
4995
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
4228
4996
|
d.node.stretchSections(Side.Left, d.coords[0] - pointerCoords[0], d.coords);
|
|
4229
4997
|
}
|
|
4230
4998
|
})
|
|
4231
4999
|
.on(DragEvents.End, (event, d) => {
|
|
4232
|
-
if (
|
|
5000
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5001
|
+
d.node?.type?.resizableX) {
|
|
4233
5002
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
4234
5003
|
if (this.snapToGrid) {
|
|
4235
5004
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -4248,31 +5017,36 @@ class DiagramCanvas {
|
|
|
4248
5017
|
.attr('stroke', 'transparent')
|
|
4249
5018
|
.attr('stroke-width', `${RESIZER_THICKNESS}px`)
|
|
4250
5019
|
.on(Events.MouseOver, (event, d) => {
|
|
4251
|
-
if (
|
|
5020
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5021
|
+
d.node?.type?.resizableY) {
|
|
4252
5022
|
d3.select('body').style('cursor', 'ns-resize');
|
|
4253
5023
|
}
|
|
4254
5024
|
})
|
|
4255
5025
|
.on(Events.MouseOut, (event, d) => {
|
|
4256
|
-
if (
|
|
5026
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5027
|
+
d.node?.type?.resizableY) {
|
|
4257
5028
|
d3.select('body').style('cursor', 'auto');
|
|
4258
5029
|
}
|
|
4259
5030
|
})
|
|
4260
5031
|
.call(d3
|
|
4261
5032
|
.drag()
|
|
4262
5033
|
.on(DragEvents.Start, (event, d) => {
|
|
4263
|
-
if (
|
|
5034
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5035
|
+
d.node?.type?.resizableY) {
|
|
4264
5036
|
d3.select('body').style('cursor', 'ns-resize');
|
|
4265
5037
|
this.currentAction = new StretchSectionAction(this, d.id, Side.Top, d.height, d.height);
|
|
4266
5038
|
}
|
|
4267
5039
|
})
|
|
4268
5040
|
.on(DragEvents.Drag, (event, d) => {
|
|
4269
|
-
if (
|
|
5041
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5042
|
+
d.node?.type?.resizableY) {
|
|
4270
5043
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
4271
5044
|
d.node.stretchSections(Side.Top, d.coords[1] - pointerCoords[1], d.coords);
|
|
4272
5045
|
}
|
|
4273
5046
|
})
|
|
4274
5047
|
.on(DragEvents.End, (event, d) => {
|
|
4275
|
-
if (
|
|
5048
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5049
|
+
d.node?.type?.resizableY) {
|
|
4276
5050
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
4277
5051
|
if (this.snapToGrid) {
|
|
4278
5052
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -4291,31 +5065,36 @@ class DiagramCanvas {
|
|
|
4291
5065
|
.attr('stroke', 'transparent')
|
|
4292
5066
|
.attr('stroke-width', `${RESIZER_THICKNESS}px`)
|
|
4293
5067
|
.on(Events.MouseOver, (event, d) => {
|
|
4294
|
-
if (
|
|
5068
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5069
|
+
d.node?.type?.resizableX) {
|
|
4295
5070
|
d3.select('body').style('cursor', 'ew-resize');
|
|
4296
5071
|
}
|
|
4297
5072
|
})
|
|
4298
5073
|
.on(Events.MouseOut, (event, d) => {
|
|
4299
|
-
if (
|
|
5074
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5075
|
+
d.node?.type?.resizableX) {
|
|
4300
5076
|
d3.select('body').style('cursor', 'auto');
|
|
4301
5077
|
}
|
|
4302
5078
|
})
|
|
4303
5079
|
.call(d3
|
|
4304
5080
|
.drag()
|
|
4305
5081
|
.on(DragEvents.Start, (event, d) => {
|
|
4306
|
-
if (
|
|
5082
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5083
|
+
d.node?.type?.resizableX) {
|
|
4307
5084
|
d3.select('body').style('cursor', 'ew-resize');
|
|
4308
5085
|
this.currentAction = new StretchSectionAction(this, d.id, Side.Right, d.width, d.width);
|
|
4309
5086
|
}
|
|
4310
5087
|
})
|
|
4311
5088
|
.on(DragEvents.Drag, (event, d) => {
|
|
4312
|
-
if (
|
|
5089
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5090
|
+
d.node?.type?.resizableX) {
|
|
4313
5091
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
4314
5092
|
d.node.stretchSections(Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.coords);
|
|
4315
5093
|
}
|
|
4316
5094
|
})
|
|
4317
5095
|
.on(DragEvents.End, (event, d) => {
|
|
4318
|
-
if (
|
|
5096
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5097
|
+
d.node?.type?.resizableX) {
|
|
4319
5098
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
4320
5099
|
if (this.snapToGrid) {
|
|
4321
5100
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -4334,31 +5113,36 @@ class DiagramCanvas {
|
|
|
4334
5113
|
.attr('stroke', 'transparent')
|
|
4335
5114
|
.attr('stroke-width', `${RESIZER_THICKNESS}px`)
|
|
4336
5115
|
.on(Events.MouseOver, (event, d) => {
|
|
4337
|
-
if (
|
|
5116
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5117
|
+
d.node?.type?.resizableY) {
|
|
4338
5118
|
d3.select('body').style('cursor', 'ns-resize');
|
|
4339
5119
|
}
|
|
4340
5120
|
})
|
|
4341
5121
|
.on(Events.MouseOut, (event, d) => {
|
|
4342
|
-
if (
|
|
5122
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5123
|
+
d.node?.type?.resizableY) {
|
|
4343
5124
|
d3.select('body').style('cursor', 'auto');
|
|
4344
5125
|
}
|
|
4345
5126
|
})
|
|
4346
5127
|
.call(d3
|
|
4347
5128
|
.drag()
|
|
4348
5129
|
.on(DragEvents.Start, (event, d) => {
|
|
4349
|
-
if (
|
|
5130
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5131
|
+
d.node?.type?.resizableY) {
|
|
4350
5132
|
d3.select('body').style('cursor', 'ns-resize');
|
|
4351
5133
|
this.currentAction = new StretchSectionAction(this, d.id, Side.Bottom, d.height, d.height);
|
|
4352
5134
|
}
|
|
4353
5135
|
})
|
|
4354
5136
|
.on(DragEvents.Drag, (event, d) => {
|
|
4355
|
-
if (
|
|
5137
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5138
|
+
d.node?.type?.resizableY) {
|
|
4356
5139
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
4357
5140
|
d.node.stretchSections(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.coords);
|
|
4358
5141
|
}
|
|
4359
5142
|
})
|
|
4360
5143
|
.on(DragEvents.End, (event, d) => {
|
|
4361
|
-
if (
|
|
5144
|
+
if (this.userActions[DiagramActions.StretchSectionAction] !== false &&
|
|
5145
|
+
d.node?.type?.resizableY) {
|
|
4362
5146
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
4363
5147
|
if (this.snapToGrid) {
|
|
4364
5148
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -4595,50 +5379,56 @@ class DiagramCanvas {
|
|
|
4595
5379
|
.call(d3
|
|
4596
5380
|
.drag()
|
|
4597
5381
|
.on(DragEvents.Start, (event, d) => {
|
|
4598
|
-
|
|
4599
|
-
|
|
5382
|
+
if (this.userActions[DiagramActions.AddConnectionAction] !== false) {
|
|
5383
|
+
d3.select('body').style('cursor', 'grabbing');
|
|
5384
|
+
this.startConnection(d);
|
|
5385
|
+
}
|
|
4600
5386
|
})
|
|
4601
5387
|
.on(DragEvents.Drag, (event) => {
|
|
4602
|
-
if (this.
|
|
4603
|
-
this.unfinishedConnection
|
|
4604
|
-
|
|
5388
|
+
if (this.userActions[DiagramActions.AddConnectionAction] !== false) {
|
|
5389
|
+
if (this.unfinishedConnection !== undefined) {
|
|
5390
|
+
this.unfinishedConnection.endCoords = [event.x, event.y];
|
|
5391
|
+
this.updateConnectionsInView();
|
|
5392
|
+
}
|
|
4605
5393
|
}
|
|
4606
5394
|
})
|
|
4607
5395
|
.on(DragEvents.End, (event) => {
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
else if (this.mainUserHighlight instanceof DiagramNode ||
|
|
4613
|
-
this.mainUserHighlight instanceof DiagramSection ||
|
|
4614
|
-
this.mainUserHighlight instanceof DiagramField) {
|
|
4615
|
-
let targetRootElement;
|
|
4616
|
-
if (this.mainUserHighlight instanceof DiagramNode ||
|
|
4617
|
-
this.mainUserHighlight instanceof DiagramSection) {
|
|
4618
|
-
targetRootElement = this.mainUserHighlight;
|
|
4619
|
-
}
|
|
4620
|
-
else if (this.mainUserHighlight.rootElement instanceof DiagramNode ||
|
|
4621
|
-
this.mainUserHighlight.rootElement instanceof DiagramSection) {
|
|
4622
|
-
targetRootElement = this.mainUserHighlight.rootElement;
|
|
4623
|
-
}
|
|
4624
|
-
else {
|
|
4625
|
-
this.dropConnection();
|
|
4626
|
-
return;
|
|
5396
|
+
if (this.userActions[DiagramActions.AddConnectionAction] !== false) {
|
|
5397
|
+
d3.select('body').style('cursor', 'auto');
|
|
5398
|
+
if (this.mainUserHighlight instanceof DiagramPort) {
|
|
5399
|
+
this.finishConnection(this.mainUserHighlight);
|
|
4627
5400
|
}
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
5401
|
+
else if (this.mainUserHighlight instanceof DiagramNode ||
|
|
5402
|
+
this.mainUserHighlight instanceof DiagramSection ||
|
|
5403
|
+
this.mainUserHighlight instanceof DiagramField) {
|
|
5404
|
+
let targetRootElement;
|
|
5405
|
+
if (this.mainUserHighlight instanceof DiagramNode ||
|
|
5406
|
+
this.mainUserHighlight instanceof DiagramSection) {
|
|
5407
|
+
targetRootElement = this.mainUserHighlight;
|
|
5408
|
+
}
|
|
5409
|
+
else if (this.mainUserHighlight.rootElement instanceof DiagramNode ||
|
|
5410
|
+
this.mainUserHighlight.rootElement instanceof DiagramSection) {
|
|
5411
|
+
targetRootElement = this.mainUserHighlight.rootElement;
|
|
5412
|
+
}
|
|
5413
|
+
else {
|
|
5414
|
+
this.dropConnection();
|
|
5415
|
+
return;
|
|
5416
|
+
}
|
|
5417
|
+
const closestPort = targetRootElement.getClosestPortToPoint([
|
|
5418
|
+
event.x,
|
|
5419
|
+
event.y
|
|
5420
|
+
]);
|
|
5421
|
+
if (closestPort !== undefined) {
|
|
5422
|
+
this.finishConnection(closestPort);
|
|
5423
|
+
}
|
|
5424
|
+
else {
|
|
5425
|
+
this.dropConnection();
|
|
5426
|
+
}
|
|
4634
5427
|
}
|
|
4635
5428
|
else {
|
|
4636
5429
|
this.dropConnection();
|
|
4637
5430
|
}
|
|
4638
5431
|
}
|
|
4639
|
-
else {
|
|
4640
|
-
this.dropConnection();
|
|
4641
|
-
}
|
|
4642
5432
|
}));
|
|
4643
5433
|
enterSelection.append('circle');
|
|
4644
5434
|
mergeSelection.attr('transform', (d) => `translate(${d.coords[0]},${d.coords[1]})`);
|
|
@@ -4783,7 +5573,8 @@ class DiagramCanvas {
|
|
|
4783
5573
|
}
|
|
4784
5574
|
})
|
|
4785
5575
|
.on(Events.DoubleClick, (event, d) => {
|
|
4786
|
-
if (
|
|
5576
|
+
if (this.userActions[DiagramActions.EditFieldAction] !== false &&
|
|
5577
|
+
d.editable) {
|
|
4787
5578
|
this.currentAction = new EditFieldAction(this, d.id, d.text, '');
|
|
4788
5579
|
this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily, (text) => {
|
|
4789
5580
|
d.text = text;
|
|
@@ -4801,54 +5592,60 @@ class DiagramCanvas {
|
|
|
4801
5592
|
.call(d3
|
|
4802
5593
|
.drag()
|
|
4803
5594
|
.on(DragEvents.Start, (event, d) => {
|
|
4804
|
-
if (
|
|
4805
|
-
d.rootElement instanceof
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
5595
|
+
if (this.userActions[DiagramActions.MoveNodeAction] !== false) {
|
|
5596
|
+
if (d.rootElement instanceof DiagramNode ||
|
|
5597
|
+
d.rootElement instanceof DiagramSection) {
|
|
5598
|
+
const node = d.rootElement instanceof DiagramNode
|
|
5599
|
+
? d.rootElement
|
|
5600
|
+
: d.rootElement.node;
|
|
5601
|
+
d3.select('body').style('cursor', 'grabbing');
|
|
5602
|
+
this.draggingFrom = [event.x, event.y];
|
|
5603
|
+
this.currentAction = new MoveNodeAction(this, node.id, node.coords, [0, 0]);
|
|
5604
|
+
}
|
|
4812
5605
|
}
|
|
4813
5606
|
})
|
|
4814
5607
|
.on(DragEvents.Drag, (event, d) => {
|
|
4815
|
-
if (
|
|
4816
|
-
d.rootElement instanceof
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
event.y - node.height / 2
|
|
4823
|
-
];
|
|
4824
|
-
node.move(newNodeCoords);
|
|
4825
|
-
}
|
|
4826
|
-
})
|
|
4827
|
-
.on(DragEvents.End, (event, d) => {
|
|
4828
|
-
if (d.rootElement instanceof DiagramNode ||
|
|
4829
|
-
d.rootElement instanceof DiagramSection) {
|
|
4830
|
-
const node = d.rootElement instanceof DiagramNode
|
|
4831
|
-
? d.rootElement
|
|
4832
|
-
: d.rootElement.node;
|
|
4833
|
-
// prevent drag behavior if mouse hasn't moved
|
|
4834
|
-
if ((this.draggingFrom[0] !== event.x ||
|
|
4835
|
-
this.draggingFrom[1] !== event.y) &&
|
|
4836
|
-
this.currentAction instanceof MoveNodeAction) {
|
|
4837
|
-
let newNodeCoords = [
|
|
5608
|
+
if (this.userActions[DiagramActions.MoveNodeAction] !== false) {
|
|
5609
|
+
if (d.rootElement instanceof DiagramNode ||
|
|
5610
|
+
d.rootElement instanceof DiagramSection) {
|
|
5611
|
+
const node = d.rootElement instanceof DiagramNode
|
|
5612
|
+
? d.rootElement
|
|
5613
|
+
: d.rootElement.node;
|
|
5614
|
+
const newNodeCoords = [
|
|
4838
5615
|
event.x - node.width / 2,
|
|
4839
5616
|
event.y - node.height / 2
|
|
4840
5617
|
];
|
|
4841
|
-
if (this.snapToGrid) {
|
|
4842
|
-
newNodeCoords = this.getClosestGridPoint(newNodeCoords);
|
|
4843
|
-
}
|
|
4844
5618
|
node.move(newNodeCoords);
|
|
4845
|
-
this.currentAction.to = newNodeCoords;
|
|
4846
|
-
this.actionQueue.add(this.currentAction);
|
|
4847
5619
|
}
|
|
4848
|
-
|
|
4849
|
-
|
|
5620
|
+
}
|
|
5621
|
+
})
|
|
5622
|
+
.on(DragEvents.End, (event, d) => {
|
|
5623
|
+
if (this.userActions[DiagramActions.MoveNodeAction] !== false) {
|
|
5624
|
+
if (d.rootElement instanceof DiagramNode ||
|
|
5625
|
+
d.rootElement instanceof DiagramSection) {
|
|
5626
|
+
const node = d.rootElement instanceof DiagramNode
|
|
5627
|
+
? d.rootElement
|
|
5628
|
+
: d.rootElement.node;
|
|
5629
|
+
// prevent drag behavior if mouse hasn't moved
|
|
5630
|
+
if ((this.draggingFrom[0] !== event.x ||
|
|
5631
|
+
this.draggingFrom[1] !== event.y) &&
|
|
5632
|
+
this.currentAction instanceof MoveNodeAction) {
|
|
5633
|
+
let newNodeCoords = [
|
|
5634
|
+
event.x - node.width / 2,
|
|
5635
|
+
event.y - node.height / 2
|
|
5636
|
+
];
|
|
5637
|
+
if (this.snapToGrid) {
|
|
5638
|
+
newNodeCoords = this.getClosestGridPoint(newNodeCoords);
|
|
5639
|
+
}
|
|
5640
|
+
node.move(newNodeCoords);
|
|
5641
|
+
this.currentAction.to = newNodeCoords;
|
|
5642
|
+
this.actionQueue.add(this.currentAction);
|
|
5643
|
+
}
|
|
5644
|
+
else {
|
|
5645
|
+
this.currentAction = undefined;
|
|
5646
|
+
}
|
|
5647
|
+
d3.select('body').style('cursor', 'auto');
|
|
4850
5648
|
}
|
|
4851
|
-
d3.select('body').style('cursor', 'auto');
|
|
4852
5649
|
}
|
|
4853
5650
|
}))
|
|
4854
5651
|
.append('xhtml:div')
|
|
@@ -5376,6 +6173,11 @@ class DiagramCanvas {
|
|
|
5376
6173
|
this.inputFieldContainer = undefined;
|
|
5377
6174
|
}
|
|
5378
6175
|
}
|
|
6176
|
+
/**
|
|
6177
|
+
* Get the SVG path of a diagram connection.
|
|
6178
|
+
* @see linePath
|
|
6179
|
+
* @private
|
|
6180
|
+
*/
|
|
5379
6181
|
const getConnectionPath = (connection) => {
|
|
5380
6182
|
return linePath(connection.type.shape, [connection.startCoords, connection.endCoords], connection.startDirection, connection.endDirection, Math.max(
|
|
5381
6183
|
// reasonable value for the minimumDistanceBeforeTurn relative to the line width
|
|
@@ -5384,24 +6186,45 @@ const getConnectionPath = (connection) => {
|
|
|
5384
6186
|
|
|
5385
6187
|
/**
|
|
5386
6188
|
* A provider for the {@link Canvas} associated with a {@link DiagramComponent} context.
|
|
6189
|
+
* @public
|
|
5387
6190
|
*/
|
|
5388
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
|
+
*/
|
|
5389
6198
|
initCanvas(parentComponent, config) {
|
|
5390
6199
|
this._canvas = new DiagramCanvas(parentComponent, config);
|
|
5391
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
|
+
*/
|
|
5392
6206
|
initCanvasView(appendTo) {
|
|
5393
6207
|
this._canvas.initView(appendTo);
|
|
5394
6208
|
}
|
|
6209
|
+
/**
|
|
6210
|
+
* Get the diagram canvas of this context.
|
|
6211
|
+
* @public
|
|
6212
|
+
* @returns A diagram canvas.
|
|
6213
|
+
*/
|
|
5395
6214
|
getCanvas() {
|
|
5396
6215
|
return this._canvas;
|
|
5397
6216
|
}
|
|
5398
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
5399
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.
|
|
6217
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CanvasProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
6218
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CanvasProviderService }); }
|
|
5400
6219
|
}
|
|
5401
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
6220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CanvasProviderService, decorators: [{
|
|
5402
6221
|
type: Injectable
|
|
5403
6222
|
}] });
|
|
5404
6223
|
|
|
6224
|
+
/**
|
|
6225
|
+
* Buttons used to trigger diagram functionalities by the user.
|
|
6226
|
+
* @private
|
|
6227
|
+
*/
|
|
5405
6228
|
class DiagramButtonsComponent {
|
|
5406
6229
|
get canvas() {
|
|
5407
6230
|
return this.canvasProvider.getCanvas();
|
|
@@ -5482,12 +6305,12 @@ class DiagramButtonsComponent {
|
|
|
5482
6305
|
redo() {
|
|
5483
6306
|
this.canvas.actionQueue.redo();
|
|
5484
6307
|
}
|
|
5485
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
5486
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
6308
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DiagramButtonsComponent, deps: [{ token: CanvasProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6309
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: DiagramButtonsComponent, isStandalone: true, selector: "daga-diagram-buttons", inputs: { enableFilter: "enableFilter", enableLayout: "enableLayout", enableUndoRedo: "enableUndoRedo", enableZoom: "enableZoom", zoomRate: "zoomRate" }, viewQueries: [{ propertyName: "collapsableButtons", first: true, predicate: ["collapsableButtons"], descendants: true }], ngImport: i0, template: "<div class=\"diagram-buttons\">\n <button *ngIf=\"enableZoom\" class=\"zoom-in\" (click)=\"zoomIn()\">\n <span class=\"tooltip\">Zoom in</span>\n </button>\n <button *ngIf=\"enableZoom\" class=\"zoom-out\" (click)=\"zoomOut()\">\n <span class=\"tooltip\">Zoom out</span>\n </button>\n <div #collapsableButtons class=\"collapsable-buttons collapsed\">\n <button *ngIf=\"enableZoom\" class=\"center\" (click)=\"center()\">\n <span class=\"tooltip\">Fit diagram to screen</span>\n </button>\n <button *ngIf=\"enableUndoRedo\" class=\"undo\" (click)=\"undo()\">\n <span class=\"tooltip\">Undo</span>\n </button>\n <button *ngIf=\"enableUndoRedo\" class=\"redo\" (click)=\"redo()\">\n <span class=\"tooltip\">Redo</span>\n </button>\n <button\n *ngIf=\"enableLayout && canvas.layoutFormat\"\n class=\"layout\"\n (click)=\"layout()\"\n >\n <span class=\"tooltip\">Apply layout</span>\n </button>\n <button\n *ngIf=\"enableFilter && canvas.priorityThresholds.length >= 2\"\n class=\"filter\"\n [class]=\"filterOn ? 'on' : 'off'\"\n (click)=\"filter()\"\n >\n <span class=\"tooltip\">Apply filter</span>\n </button>\n </div>\n <button class=\"more-options\" (click)=\"toggleCollapse()\">\n <span *ngIf=\"!collapsed\" class=\"tooltip\">Less options</span>\n <span *ngIf=\"collapsed\" class=\"tooltip\">More options</span>\n </button>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
5487
6310
|
}
|
|
5488
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
6311
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DiagramButtonsComponent, decorators: [{
|
|
5489
6312
|
type: Component,
|
|
5490
|
-
args: [{ standalone: true, selector: 'daga-diagram-buttons', imports: [CommonModule], template: "<div class=\"diagram-buttons\">\n <button *ngIf=\"enableZoom\" class=\"zoom-in\" (click)=\"zoomIn()\">\n <span class=\"tooltip\">Zoom in</span>\n </button>\n <button *ngIf=\"enableZoom\" class=\"zoom-out\" (click)=\"zoomOut()\">\n <span class=\"tooltip\">Zoom out</span>\n </button>\n <div #collapsableButtons class=\"collapsable-buttons collapsed\">\n <button *ngIf=\"enableZoom\" class=\"center\" (click)=\"center()\">\n <span class=\"tooltip\">Fit diagram to screen</span>\n </button>\n <button *ngIf=\"enableUndoRedo\" class=\"undo\" (click)=\"undo()\">\n <span class=\"tooltip\">Undo</span>\n </button>\n <button *ngIf=\"enableUndoRedo\" class=\"redo\" (click)=\"redo()\">\n <span class=\"tooltip\">Redo</span>\n </button>\n <button\n *ngIf=\"enableLayout && canvas.layoutFormat\"\n class=\"layout\"\n (click)=\"layout()\"\n >\n <span class=\"tooltip\">Apply layout</span>\n </button>\n <button\n *ngIf=\"enableFilter && canvas.priorityThresholds.length >= 2\"\n class=\"filter\"\n [class]=\"filterOn ? 'on' : 'off'\"\n (click)=\"filter()\"\n >\n <span class=\"tooltip\">Apply filter</span>\n </button>\n </div>\n <button class=\"more-options\" (click)=\"toggleCollapse()\">\n <span *ngIf=\"!collapsed\" class=\"tooltip\">Less options</span>\n <span *ngIf=\"collapsed\" class=\"tooltip\">More options</span>\n </button>\n</div>\n"
|
|
6313
|
+
args: [{ standalone: true, selector: 'daga-diagram-buttons', imports: [CommonModule], template: "<div class=\"diagram-buttons\">\n <button *ngIf=\"enableZoom\" class=\"zoom-in\" (click)=\"zoomIn()\">\n <span class=\"tooltip\">Zoom in</span>\n </button>\n <button *ngIf=\"enableZoom\" class=\"zoom-out\" (click)=\"zoomOut()\">\n <span class=\"tooltip\">Zoom out</span>\n </button>\n <div #collapsableButtons class=\"collapsable-buttons collapsed\">\n <button *ngIf=\"enableZoom\" class=\"center\" (click)=\"center()\">\n <span class=\"tooltip\">Fit diagram to screen</span>\n </button>\n <button *ngIf=\"enableUndoRedo\" class=\"undo\" (click)=\"undo()\">\n <span class=\"tooltip\">Undo</span>\n </button>\n <button *ngIf=\"enableUndoRedo\" class=\"redo\" (click)=\"redo()\">\n <span class=\"tooltip\">Redo</span>\n </button>\n <button\n *ngIf=\"enableLayout && canvas.layoutFormat\"\n class=\"layout\"\n (click)=\"layout()\"\n >\n <span class=\"tooltip\">Apply layout</span>\n </button>\n <button\n *ngIf=\"enableFilter && canvas.priorityThresholds.length >= 2\"\n class=\"filter\"\n [class]=\"filterOn ? 'on' : 'off'\"\n (click)=\"filter()\"\n >\n <span class=\"tooltip\">Apply filter</span>\n </button>\n </div>\n <button class=\"more-options\" (click)=\"toggleCollapse()\">\n <span *ngIf=\"!collapsed\" class=\"tooltip\">Less options</span>\n <span *ngIf=\"collapsed\" class=\"tooltip\">More options</span>\n </button>\n</div>\n" }]
|
|
5491
6314
|
}], ctorParameters: () => [{ type: CanvasProviderService }], propDecorators: { collapsableButtons: [{
|
|
5492
6315
|
type: ViewChild,
|
|
5493
6316
|
args: ['collapsableButtons']
|
|
@@ -5503,6 +6326,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
5503
6326
|
type: Input
|
|
5504
6327
|
}] } });
|
|
5505
6328
|
|
|
6329
|
+
/**
|
|
6330
|
+
* Displays the errors detected by a diagram's validators.
|
|
6331
|
+
* @see DiagramValidator
|
|
6332
|
+
* @private
|
|
6333
|
+
*/
|
|
5506
6334
|
class ErrorsComponent {
|
|
5507
6335
|
get canvas() {
|
|
5508
6336
|
return this.canvasProvider.getCanvas();
|
|
@@ -5541,17 +6369,23 @@ class ErrorsComponent {
|
|
|
5541
6369
|
}
|
|
5542
6370
|
// TODO: IF ERROR IS IN AN ELEMENT BUT NOT IN A SPECIFIC PROPERTY, WE COULD HIGHLIGHT THE ELEMENT
|
|
5543
6371
|
}
|
|
5544
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
5545
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
6372
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: ErrorsComponent, deps: [{ token: CanvasProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6373
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: ErrorsComponent, isStandalone: true, selector: "daga-errors", viewQueries: [{ propertyName: "errorsContainer", first: true, predicate: ["errors"], descendants: true }], ngImport: i0, template: "<div #errorsContainer class=\"errors\">\n <div\n *ngIf=\"errors.length === 0\"\n class=\"errors-summary no-errors prevent-user-select\"\n >\n <span>No errors found</span>\n </div>\n <div\n *ngIf=\"errors.length > 0\"\n class=\"errors-summary with-errors prevent-user-select\"\n >\n <span>{{ errors.length }} errors found</span>\n <div class=\"collapse-button-container\">\n <daga-collapse-button\n [collapsableSelector]=\"errorsContainer\"\n [collapsableAdditionalSelector]=\"'.error-panel'\"\n [direction]=\"Side.Top\"\n [rule]=\"'display'\"\n [collapsedValue]=\"'none'\"\n [visibleValue]=\"'block'\"\n />\n </div>\n </div>\n <div *ngIf=\"errors.length > 0\" class=\"error-panel\">\n <ol>\n <li\n *ngFor=\"let error of errors; index as i\"\n (click)=\"showError(error)\"\n [innerHTML]=\"error.message\"\n ></li>\n </ol>\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CollapseButtonComponent, selector: "daga-collapse-button", inputs: ["collapsableSelector", "collapsableAdditionalSelector", "collapsed", "disabled", "direction", "rule", "collapsedValue", "visibleValue"] }] }); }
|
|
5546
6374
|
}
|
|
5547
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
6375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: ErrorsComponent, decorators: [{
|
|
5548
6376
|
type: Component,
|
|
5549
|
-
args: [{ standalone: true, selector: 'daga-errors', imports: [CommonModule, CollapseButtonComponent], template: "<div #errorsContainer class=\"errors\">\n <div\n *ngIf=\"errors.length === 0\"\n class=\"errors-summary no-errors prevent-user-select\"\n >\n <span>No errors found</span>\n </div>\n <div\n *ngIf=\"errors.length > 0\"\n class=\"errors-summary with-errors prevent-user-select\"\n >\n <span>{{ errors.length }} errors found</span>\n <div class=\"collapse-button-container\">\n <daga-collapse-button\n [collapsableSelector]=\"errorsContainer\"\n [collapsableAdditionalSelector]=\"'.error-panel'\"\n [direction]=\"Side.Top\"\n [rule]=\"'display'\"\n [collapsedValue]=\"'none'\"\n [visibleValue]=\"'block'\"\n />\n </div>\n </div>\n <div *ngIf=\"errors.length > 0\" class=\"error-panel\">\n <ol>\n <li\n *ngFor=\"let error of errors; index as i\"\n (click)=\"showError(error)\"\n [innerHTML]=\"error.message\"\n ></li>\n </ol>\n </div>\n</div>\n"
|
|
6377
|
+
args: [{ standalone: true, selector: 'daga-errors', imports: [CommonModule, CollapseButtonComponent], template: "<div #errorsContainer class=\"errors\">\n <div\n *ngIf=\"errors.length === 0\"\n class=\"errors-summary no-errors prevent-user-select\"\n >\n <span>No errors found</span>\n </div>\n <div\n *ngIf=\"errors.length > 0\"\n class=\"errors-summary with-errors prevent-user-select\"\n >\n <span>{{ errors.length }} errors found</span>\n <div class=\"collapse-button-container\">\n <daga-collapse-button\n [collapsableSelector]=\"errorsContainer\"\n [collapsableAdditionalSelector]=\"'.error-panel'\"\n [direction]=\"Side.Top\"\n [rule]=\"'display'\"\n [collapsedValue]=\"'none'\"\n [visibleValue]=\"'block'\"\n />\n </div>\n </div>\n <div *ngIf=\"errors.length > 0\" class=\"error-panel\">\n <ol>\n <li\n *ngFor=\"let error of errors; index as i\"\n (click)=\"showError(error)\"\n [innerHTML]=\"error.message\"\n ></li>\n </ol>\n </div>\n</div>\n" }]
|
|
5550
6378
|
}], ctorParameters: () => [{ type: CanvasProviderService }], propDecorators: { errorsContainer: [{
|
|
5551
6379
|
type: ViewChild,
|
|
5552
6380
|
args: ['errors']
|
|
5553
6381
|
}] } });
|
|
5554
6382
|
|
|
6383
|
+
/**
|
|
6384
|
+
* Palette that the user can drag and drop nodes from.
|
|
6385
|
+
* @see DiagramConfig
|
|
6386
|
+
* @see DiagramNode
|
|
6387
|
+
* @private
|
|
6388
|
+
*/
|
|
5555
6389
|
class PaletteComponent {
|
|
5556
6390
|
get canvas() {
|
|
5557
6391
|
return this.canvasProvider.getCanvas();
|
|
@@ -5695,6 +6529,10 @@ class PaletteComponent {
|
|
|
5695
6529
|
.style('top', 0)
|
|
5696
6530
|
.style('z-index', 'auto');
|
|
5697
6531
|
// try to place node
|
|
6532
|
+
if (this.canvas.userActions[DiagramActions.AddNodeAction] === false) {
|
|
6533
|
+
// can't place, the user isn't allowed to place nodes
|
|
6534
|
+
return;
|
|
6535
|
+
}
|
|
5698
6536
|
if (type.isUnique &&
|
|
5699
6537
|
this.canvas.model.nodes.find(type.id) !== undefined) {
|
|
5700
6538
|
// can't place, it's unique and that node is already in the model
|
|
@@ -5896,12 +6734,12 @@ class PaletteComponent {
|
|
|
5896
6734
|
.text(templateConfig.label);
|
|
5897
6735
|
}
|
|
5898
6736
|
}
|
|
5899
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
5900
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
6737
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: PaletteComponent, deps: [{ token: CanvasProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6738
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: PaletteComponent, isStandalone: true, selector: "daga-palette", inputs: { palettes: "palettes", currentPalette: "currentPalette", currentCategory: "currentCategory", location: "location" }, viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true }], ngImport: i0, template: "<div #panel class=\"panel {{ location }}\">\n <daga-collapse-button\n #collapseButton\n [collapsableSelector]=\"panel\"\n [collapsableAdditionalSelector]=\"'.panel-content'\"\n [rule]=\"'display'\"\n [collapsedValue]=\"'none'\"\n [visibleValue]=\"'block'\"\n />\n <div class=\"panel-content\">\n <div *ngIf=\"palettes.length > 1\" class=\"panel-tabs\">\n <div\n *ngFor=\"let palette of palettes\"\n class=\"panel-tab\"\n [class]=\"palette === currentPalette ? 'current-tab' : ''\"\n (click)=\"switchPalette(palette)\"\n >\n {{ palette.name }}\n </div>\n </div>\n <div class=\"palette-view\"></div>\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CollapseButtonComponent, selector: "daga-collapse-button", inputs: ["collapsableSelector", "collapsableAdditionalSelector", "collapsed", "disabled", "direction", "rule", "collapsedValue", "visibleValue"] }] }); }
|
|
5901
6739
|
}
|
|
5902
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
6740
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: PaletteComponent, decorators: [{
|
|
5903
6741
|
type: Component,
|
|
5904
|
-
args: [{ standalone: true, selector: 'daga-palette', imports: [CommonModule, CollapseButtonComponent], template: "<div #panel class=\"panel {{ location }}\">\n <daga-collapse-button\n #collapseButton\n [collapsableSelector]=\"panel\"\n [collapsableAdditionalSelector]=\"'.panel-content'\"\n [rule]=\"'display'\"\n [collapsedValue]=\"'none'\"\n [visibleValue]=\"'block'\"\n />\n <div class=\"panel-content\">\n <div *ngIf=\"palettes.length > 1\" class=\"panel-tabs\">\n <div\n *ngFor=\"let palette of palettes\"\n class=\"panel-tab\"\n [class]=\"palette === currentPalette ? 'current-tab' : ''\"\n (click)=\"switchPalette(palette)\"\n >\n {{ palette.name }}\n </div>\n </div>\n <div class=\"palette-view\"></div>\n </div>\n</div>\n"
|
|
6742
|
+
args: [{ standalone: true, selector: 'daga-palette', imports: [CommonModule, CollapseButtonComponent], template: "<div #panel class=\"panel {{ location }}\">\n <daga-collapse-button\n #collapseButton\n [collapsableSelector]=\"panel\"\n [collapsableAdditionalSelector]=\"'.panel-content'\"\n [rule]=\"'display'\"\n [collapsedValue]=\"'none'\"\n [visibleValue]=\"'block'\"\n />\n <div class=\"panel-content\">\n <div *ngIf=\"palettes.length > 1\" class=\"panel-tabs\">\n <div\n *ngFor=\"let palette of palettes\"\n class=\"panel-tab\"\n [class]=\"palette === currentPalette ? 'current-tab' : ''\"\n (click)=\"switchPalette(palette)\"\n >\n {{ palette.name }}\n </div>\n </div>\n <div class=\"palette-view\"></div>\n </div>\n</div>\n" }]
|
|
5905
6743
|
}], ctorParameters: () => [{ type: CanvasProviderService }], propDecorators: { panel: [{
|
|
5906
6744
|
type: ViewChild,
|
|
5907
6745
|
args: ['panel']
|
|
@@ -5915,6 +6753,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
5915
6753
|
type: Input
|
|
5916
6754
|
}] } });
|
|
5917
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
|
+
*/
|
|
5918
6763
|
class TextListEditorComponent {
|
|
5919
6764
|
set value(val) {
|
|
5920
6765
|
if (val === this._value) {
|
|
@@ -5969,12 +6814,12 @@ class TextListEditorComponent {
|
|
|
5969
6814
|
this.addToValue();
|
|
5970
6815
|
}
|
|
5971
6816
|
}
|
|
5972
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
5973
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
6817
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TextListEditorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6818
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TextListEditorComponent, isStandalone: true, selector: "daga-text-list-editor", inputs: { value: "value", valueInput: "valueInput", disabled: "disabled" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<div *ngFor=\"let item of value; let index = index\" class=\"value-item-element\">\n <lux-input\n type=\"text\"\n [disabled]=\"disabled\"\n [value]=\"item\"\n (focusout)=\"editFromValue(getValueFromEvent($event), index)\"\n ></lux-input>\n <button\n *ngIf=\"!disabled\"\n class=\"property-button\"\n (click)=\"removeFromValue(index)\"\n >\n <div class=\"icon close-icon\"></div>\n </button>\n</div>\n<div *ngIf=\"!disabled\" class=\"value-item-input\">\n <div class=\"relatively-positioned\">\n <lux-input\n type=\"text\"\n (keyup)=\"onKeyUp($event)\"\n [(ngModel)]=\"valueInput\"\n ></lux-input>\n <button\n *ngIf=\"valueInput !== ''\"\n class=\"clear\"\n (click)=\"clearInput()\"\n ></button>\n </div>\n <button class=\"property-button\" (click)=\"addToValue()\">\n <div class=\"icon add-icon\"></div>\n </button>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: LuxModule }, { kind: "component", type: i3.InputComponent, selector: "lux-input", inputs: ["rows", "cols", "step", "min", "max", "lang", "inlineErrors", "inputId", "aria-label", "readonly", "disabled", "pattern", "currency", "placeholder", "required", "type", "value"], outputs: ["valueChange", "keyPress"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
5974
6819
|
}
|
|
5975
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
6820
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TextListEditorComponent, decorators: [{
|
|
5976
6821
|
type: Component,
|
|
5977
|
-
args: [{ standalone: true, selector: 'daga-text-list-editor', imports: [CommonModule, LuxModule, FormsModule], template: "<div *ngFor=\"let item of value; let index = index\" class=\"value-item-element\">\n <lux-input\n type=\"text\"\n [disabled]=\"disabled\"\n [value]=\"item\"\n (focusout)=\"editFromValue(getValueFromEvent($event), index)\"\n ></lux-input>\n <button\n *ngIf=\"!disabled\"\n class=\"property-button\"\n (click)=\"removeFromValue(index)\"\n >\n <
|
|
6822
|
+
args: [{ standalone: true, selector: 'daga-text-list-editor', imports: [CommonModule, LuxModule, FormsModule], template: "<div *ngFor=\"let item of value; let index = index\" class=\"value-item-element\">\n <lux-input\n type=\"text\"\n [disabled]=\"disabled\"\n [value]=\"item\"\n (focusout)=\"editFromValue(getValueFromEvent($event), index)\"\n ></lux-input>\n <button\n *ngIf=\"!disabled\"\n class=\"property-button\"\n (click)=\"removeFromValue(index)\"\n >\n <div class=\"icon close-icon\"></div>\n </button>\n</div>\n<div *ngIf=\"!disabled\" class=\"value-item-input\">\n <div class=\"relatively-positioned\">\n <lux-input\n type=\"text\"\n (keyup)=\"onKeyUp($event)\"\n [(ngModel)]=\"valueInput\"\n ></lux-input>\n <button\n *ngIf=\"valueInput !== ''\"\n class=\"clear\"\n (click)=\"clearInput()\"\n ></button>\n </div>\n <button class=\"property-button\" (click)=\"addToValue()\">\n <div class=\"icon add-icon\"></div>\n </button>\n</div>\n" }]
|
|
5978
6823
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { value: [{
|
|
5979
6824
|
type: Input
|
|
5980
6825
|
}], valueInput: [{
|
|
@@ -5985,6 +6830,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
5985
6830
|
type: Output
|
|
5986
6831
|
}] } });
|
|
5987
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
|
+
*/
|
|
5988
6840
|
class TextMapEditorComponent {
|
|
5989
6841
|
set value(val) {
|
|
5990
6842
|
if (val === this._value) {
|
|
@@ -6045,12 +6897,12 @@ class TextMapEditorComponent {
|
|
|
6045
6897
|
this.addToValue();
|
|
6046
6898
|
}
|
|
6047
6899
|
}
|
|
6048
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
6049
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
6900
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TextMapEditorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6901
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: TextMapEditorComponent, isStandalone: true, selector: "daga-text-map-editor", inputs: { value: "value", keyInput: "keyInput", valueInput: "valueInput", disabled: "disabled" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<div *ngFor=\"let item of value | keyvalue\" class=\"value-item-element\">\n <lux-input\n type=\"text\"\n [disabled]=\"disabled\"\n [value]=\"item.key\"\n (focusout)=\"editKey(item.key, getValueFromEvent($event))\"\n ></lux-input>\n <lux-input\n type=\"text\"\n [disabled]=\"disabled\"\n [value]=\"item.value\"\n (focusout)=\"editValue(item.key, getValueFromEvent($event))\"\n ></lux-input>\n <button\n *ngIf=\"!disabled\"\n class=\"property-button\"\n (click)=\"removeFromValue(item.key)\"\n >\n <div class=\"icon close-icon\"></div>\n </button>\n</div>\n<div *ngIf=\"!disabled\" class=\"value-item-input\">\n <div class=\"relatively-positioned\">\n <lux-input\n type=\"text\"\n (keyup)=\"onKeyUp($event)\"\n [(ngModel)]=\"keyInput\"\n ></lux-input>\n <button\n *ngIf=\"keyInput !== ''\"\n class=\"clear\"\n (click)=\"clearKeyInput()\"\n ></button>\n </div>\n <div class=\"relatively-positioned\">\n <lux-input\n type=\"text\"\n (keyup)=\"onKeyUp($event)\"\n [(ngModel)]=\"valueInput\"\n ></lux-input>\n <button\n *ngIf=\"valueInput !== ''\"\n class=\"clear\"\n (click)=\"clearValueInput()\"\n ></button>\n </div>\n <button class=\"property-button\" (click)=\"addToValue()\">\n <div class=\"icon add-icon\"></div>\n </button>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.KeyValuePipe, name: "keyvalue" }, { kind: "ngmodule", type: LuxModule }, { kind: "component", type: i3.InputComponent, selector: "lux-input", inputs: ["rows", "cols", "step", "min", "max", "lang", "inlineErrors", "inputId", "aria-label", "readonly", "disabled", "pattern", "currency", "placeholder", "required", "type", "value"], outputs: ["valueChange", "keyPress"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
6050
6902
|
}
|
|
6051
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
6903
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: TextMapEditorComponent, decorators: [{
|
|
6052
6904
|
type: Component,
|
|
6053
|
-
args: [{ standalone: true, selector: 'daga-text-map-editor', imports: [CommonModule, LuxModule, FormsModule], template: "<div *ngFor=\"let item of value | keyvalue\" class=\"value-item-element\">\n <lux-input\n type=\"text\"\n [disabled]=\"disabled\"\n [value]=\"item.key\"\n (focusout)=\"editKey(item.key, getValueFromEvent($event))\"\n ></lux-input>\n <lux-input\n type=\"text\"\n [disabled]=\"disabled\"\n [value]=\"item.value\"\n (focusout)=\"editValue(item.key, getValueFromEvent($event))\"\n ></lux-input>\n <button\n *ngIf=\"!disabled\"\n class=\"property-button\"\n (click)=\"removeFromValue(item.key)\"\n >\n <
|
|
6905
|
+
args: [{ standalone: true, selector: 'daga-text-map-editor', imports: [CommonModule, LuxModule, FormsModule], template: "<div *ngFor=\"let item of value | keyvalue\" class=\"value-item-element\">\n <lux-input\n type=\"text\"\n [disabled]=\"disabled\"\n [value]=\"item.key\"\n (focusout)=\"editKey(item.key, getValueFromEvent($event))\"\n ></lux-input>\n <lux-input\n type=\"text\"\n [disabled]=\"disabled\"\n [value]=\"item.value\"\n (focusout)=\"editValue(item.key, getValueFromEvent($event))\"\n ></lux-input>\n <button\n *ngIf=\"!disabled\"\n class=\"property-button\"\n (click)=\"removeFromValue(item.key)\"\n >\n <div class=\"icon close-icon\"></div>\n </button>\n</div>\n<div *ngIf=\"!disabled\" class=\"value-item-input\">\n <div class=\"relatively-positioned\">\n <lux-input\n type=\"text\"\n (keyup)=\"onKeyUp($event)\"\n [(ngModel)]=\"keyInput\"\n ></lux-input>\n <button\n *ngIf=\"keyInput !== ''\"\n class=\"clear\"\n (click)=\"clearKeyInput()\"\n ></button>\n </div>\n <div class=\"relatively-positioned\">\n <lux-input\n type=\"text\"\n (keyup)=\"onKeyUp($event)\"\n [(ngModel)]=\"valueInput\"\n ></lux-input>\n <button\n *ngIf=\"valueInput !== ''\"\n class=\"clear\"\n (click)=\"clearValueInput()\"\n ></button>\n </div>\n <button class=\"property-button\" (click)=\"addToValue()\">\n <div class=\"icon add-icon\"></div>\n </button>\n</div>\n" }]
|
|
6054
6906
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { value: [{
|
|
6055
6907
|
type: Input
|
|
6056
6908
|
}], keyInput: [{
|
|
@@ -6063,10 +6915,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
6063
6915
|
type: Output
|
|
6064
6916
|
}] } });
|
|
6065
6917
|
|
|
6918
|
+
/**
|
|
6919
|
+
* Editor of a value set within a property editor.
|
|
6920
|
+
* @see PropertyEditor
|
|
6921
|
+
* @see ValueSet
|
|
6922
|
+
* @private
|
|
6923
|
+
*/
|
|
6066
6924
|
class ObjectEditorComponent {
|
|
6067
6925
|
get canvas() {
|
|
6068
6926
|
return this.canvasProvider.getCanvas();
|
|
6069
6927
|
}
|
|
6928
|
+
get userCanEdit() {
|
|
6929
|
+
return this.canvas.userActions[DiagramActions.UpdateValuesAction] !== false;
|
|
6930
|
+
}
|
|
6070
6931
|
get valueSet() {
|
|
6071
6932
|
return this._valueSet;
|
|
6072
6933
|
}
|
|
@@ -6078,7 +6939,7 @@ class ObjectEditorComponent {
|
|
|
6078
6939
|
constructor(cdr, canvasProvider) {
|
|
6079
6940
|
this.cdr = cdr;
|
|
6080
6941
|
this.canvasProvider = canvasProvider;
|
|
6081
|
-
/** How many object-editors are parents of this object-editor */
|
|
6942
|
+
/** How many object-editors are parents of this object-editor. @private */
|
|
6082
6943
|
this.depth = 0;
|
|
6083
6944
|
// Attributes for the template
|
|
6084
6945
|
this.Type = Type;
|
|
@@ -6143,10 +7004,10 @@ class ObjectEditorComponent {
|
|
|
6143
7004
|
}
|
|
6144
7005
|
return date && !isNaN(date.valueOf()) ? new Date(date).toISOString() : '';
|
|
6145
7006
|
}
|
|
6146
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
6147
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
7007
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: ObjectEditorComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: CanvasProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7008
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: ObjectEditorComponent, isStandalone: true, selector: "daga-object-editor", inputs: { valueSet: "valueSet", depth: "depth" }, ngImport: i0, template: "<div\n *ngFor=\"let property of valueSet?.displayedProperties || []\"\n class=\"property\"\n [class]=\"property.name + ' depth-' + depth\"\n>\n <p class=\"property-name\">\n {{ property.name }}\n <button class=\"property-button\" (click)=\"hideProperty(property.name)\">\n <div class=\"icon hide-icon\"></div>\n </button>\n </p>\n\n <lux-input\n *ngIf=\"property.type === Type.Text\"\n type=\"text\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <textarea\n *ngIf=\"property.type === Type.TextArea\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [ngModel]=\"valueSet?.getValue(property.name)\"\n (ngModelChange)=\"setValue(property, $event)\"\n ></textarea>\n <lux-input\n *ngIf=\"property.type === Type.Number\"\n type=\"number\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-input\n *ngIf=\"property.type === Type.Color\"\n type=\"color\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-input\n *ngIf=\"property.type === Type.Date\"\n type=\"date\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"convertDate(valueSet?.getValue(property.name))\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-input\n *ngIf=\"property.type === Type.Time\"\n type=\"time\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"convertDate(valueSet?.getValue(property.name))\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-input\n *ngIf=\"property.type === Type.Url\"\n type=\"url\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-radiogroup\n *ngIf=\"property.type === Type.Boolean\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [items]=\"booleanRadioItems\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-radiogroup>\n <lux-autocomplete\n *ngIf=\"property.type === Type.Option\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [dataSource]=\"property.options || []\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-autocomplete>\n <lux-autocomplete-list\n *ngIf=\"property.type === Type.OptionList\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [dataSource]=\"property.options || []\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-autocomplete-list>\n <daga-text-list-editor\n *ngIf=\"property.type === Type.TextList\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></daga-text-list-editor>\n <daga-text-map-editor\n *ngIf=\"property.type === Type.TextMap\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></daga-text-map-editor>\n <div *ngIf=\"property.type === Type.Object\" class=\"left-bar\">\n <daga-object-editor\n [valueSet]=\"valueSet?.getSubValueSet(property.name)\"\n [depth]=\"depth + 1\"\n ></daga-object-editor>\n </div>\n</div>\n<div class=\"property\" *ngIf=\"valueSet && valueSet.hiddenProperties.length > 0\">\n <p class=\"property-name\">Add property:</p>\n <select (change)=\"displayProperty($event)\">\n <option value=\"\">Select a property</option>\n <option\n *ngFor=\"let property of valueSet?.hiddenProperties || []\"\n [value]=\"property.name\"\n >\n {{ property.name }}\n </option>\n </select>\n</div>\n", dependencies: [{ kind: "component", type: ObjectEditorComponent, selector: "daga-object-editor", inputs: ["valueSet", "depth"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: LuxModule }, { kind: "component", type: i3.AutocompleteComponent, selector: "lux-autocomplete", inputs: ["inputId", "disabled", "readonly", "label", "canAddNewValues", "keepOpenAfterDelete", "value", "dataSource", "required", "placeholder", "resolveLabelsFunction", "populateFunction", "instance"], outputs: ["valueChange", "dataSourceChange"] }, { kind: "component", type: i3.AutocompleteListComponent, selector: "lux-autocomplete-list", inputs: ["value", "lang", "inputId", "dataSource", "placeholder", "disabled", "deleteLabelTemplate", "addMessage", "required", "resolveLabelsFunction", "populateFunction", "instance"], outputs: ["valueChange"] }, { kind: "component", type: i3.InputComponent, selector: "lux-input", inputs: ["rows", "cols", "step", "min", "max", "lang", "inlineErrors", "inputId", "aria-label", "readonly", "disabled", "pattern", "currency", "placeholder", "required", "type", "value"], outputs: ["valueChange", "keyPress"] }, { kind: "component", type: i3.RadiogroupComponent, selector: "lux-radiogroup", inputs: ["name", "disabled", "readonly", "required", "items", "value"], outputs: ["itemsChange", "valueChange"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: TextListEditorComponent, selector: "daga-text-list-editor", inputs: ["value", "valueInput", "disabled"], outputs: ["valueChange"] }, { kind: "component", type: TextMapEditorComponent, selector: "daga-text-map-editor", inputs: ["value", "keyInput", "valueInput", "disabled"], outputs: ["valueChange"] }] }); }
|
|
6148
7009
|
}
|
|
6149
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
7010
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: ObjectEditorComponent, decorators: [{
|
|
6150
7011
|
type: Component,
|
|
6151
7012
|
args: [{ standalone: true, selector: 'daga-object-editor', imports: [
|
|
6152
7013
|
CommonModule,
|
|
@@ -6154,13 +7015,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
6154
7015
|
FormsModule,
|
|
6155
7016
|
TextListEditorComponent,
|
|
6156
7017
|
TextMapEditorComponent
|
|
6157
|
-
], template: "<div\n *ngFor=\"let property of valueSet?.displayedProperties || []\"\n class=\"property\"\n [class]=\"property.name + ' depth-' + depth\"\n>\n <p class=\"property-name\">\n {{ property.name }}\n <button class=\"property-button\" (click)=\"hideProperty(property.name)\">\n <
|
|
7018
|
+
], template: "<div\n *ngFor=\"let property of valueSet?.displayedProperties || []\"\n class=\"property\"\n [class]=\"property.name + ' depth-' + depth\"\n>\n <p class=\"property-name\">\n {{ property.name }}\n <button class=\"property-button\" (click)=\"hideProperty(property.name)\">\n <div class=\"icon hide-icon\"></div>\n </button>\n </p>\n\n <lux-input\n *ngIf=\"property.type === Type.Text\"\n type=\"text\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <textarea\n *ngIf=\"property.type === Type.TextArea\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [ngModel]=\"valueSet?.getValue(property.name)\"\n (ngModelChange)=\"setValue(property, $event)\"\n ></textarea>\n <lux-input\n *ngIf=\"property.type === Type.Number\"\n type=\"number\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-input\n *ngIf=\"property.type === Type.Color\"\n type=\"color\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-input\n *ngIf=\"property.type === Type.Date\"\n type=\"date\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"convertDate(valueSet?.getValue(property.name))\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-input\n *ngIf=\"property.type === Type.Time\"\n type=\"time\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"convertDate(valueSet?.getValue(property.name))\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-input\n *ngIf=\"property.type === Type.Url\"\n type=\"url\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-input>\n <lux-radiogroup\n *ngIf=\"property.type === Type.Boolean\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [items]=\"booleanRadioItems\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-radiogroup>\n <lux-autocomplete\n *ngIf=\"property.type === Type.Option\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [dataSource]=\"property.options || []\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-autocomplete>\n <lux-autocomplete-list\n *ngIf=\"property.type === Type.OptionList\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [dataSource]=\"property.options || []\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></lux-autocomplete-list>\n <daga-text-list-editor\n *ngIf=\"property.type === Type.TextList\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></daga-text-list-editor>\n <daga-text-map-editor\n *ngIf=\"property.type === Type.TextMap\"\n [disabled]=\"!property.editable || !userCanEdit\"\n [value]=\"valueSet?.getValue(property.name)\"\n (valueChange)=\"setValue(property, $event)\"\n ></daga-text-map-editor>\n <div *ngIf=\"property.type === Type.Object\" class=\"left-bar\">\n <daga-object-editor\n [valueSet]=\"valueSet?.getSubValueSet(property.name)\"\n [depth]=\"depth + 1\"\n ></daga-object-editor>\n </div>\n</div>\n<div class=\"property\" *ngIf=\"valueSet && valueSet.hiddenProperties.length > 0\">\n <p class=\"property-name\">Add property:</p>\n <select (change)=\"displayProperty($event)\">\n <option value=\"\">Select a property</option>\n <option\n *ngFor=\"let property of valueSet?.hiddenProperties || []\"\n [value]=\"property.name\"\n >\n {{ property.name }}\n </option>\n </select>\n</div>\n" }]
|
|
6158
7019
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: CanvasProviderService }], propDecorators: { valueSet: [{
|
|
6159
7020
|
type: Input
|
|
6160
7021
|
}], depth: [{
|
|
6161
7022
|
type: Input
|
|
6162
7023
|
}] } });
|
|
6163
7024
|
|
|
7025
|
+
/**
|
|
7026
|
+
* Editor of the values of a value set.
|
|
7027
|
+
* @see ValueSet
|
|
7028
|
+
* @private
|
|
7029
|
+
*/
|
|
6164
7030
|
class PropertyEditorComponent {
|
|
6165
7031
|
get valueSet() {
|
|
6166
7032
|
return this._valueSet;
|
|
@@ -6192,12 +7058,12 @@ class PropertyEditorComponent {
|
|
|
6192
7058
|
});
|
|
6193
7059
|
}
|
|
6194
7060
|
}
|
|
6195
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
6196
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
7061
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: PropertyEditorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7062
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: PropertyEditorComponent, isStandalone: true, selector: "daga-property-editor", inputs: { location: "location", valueSet: "valueSet" }, viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true }], ngImport: i0, template: "<div #panel class=\"panel bottom {{ location }}\">\n <daga-collapse-button\n [collapsableSelector]=\"panel\"\n [collapsableAdditionalSelector]=\"'.panel-content'\"\n [rule]=\"'display'\"\n [collapsedValue]=\"'none'\"\n [visibleValue]=\"'block'\"\n [disabled]=\"\n !valueSet ||\n !valueSet.propertySet ||\n !valueSet.propertySet.hasProperties()\n \"\n />\n <div\n *ngIf=\"\n valueSet && valueSet.propertySet && valueSet.propertySet.hasProperties()\n \"\n class=\"panel-content\"\n >\n <p *ngIf=\"title\" class=\"title\">{{ title }}</p>\n <daga-object-editor [valueSet]=\"valueSet\"></daga-object-editor>\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CollapseButtonComponent, selector: "daga-collapse-button", inputs: ["collapsableSelector", "collapsableAdditionalSelector", "collapsed", "disabled", "direction", "rule", "collapsedValue", "visibleValue"] }, { kind: "component", type: ObjectEditorComponent, selector: "daga-object-editor", inputs: ["valueSet", "depth"] }] }); }
|
|
6197
7063
|
}
|
|
6198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
7064
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: PropertyEditorComponent, decorators: [{
|
|
6199
7065
|
type: Component,
|
|
6200
|
-
args: [{ standalone: true, selector: 'daga-property-editor', imports: [CommonModule, CollapseButtonComponent, ObjectEditorComponent], template: "<div #panel class=\"panel bottom {{ location }}\">\n <daga-collapse-button\n [collapsableSelector]=\"panel\"\n [collapsableAdditionalSelector]=\"'.panel-content'\"\n [rule]=\"'display'\"\n [collapsedValue]=\"'none'\"\n [visibleValue]=\"'block'\"\n [disabled]=\"\n !valueSet ||\n !valueSet.propertySet ||\n !valueSet.propertySet.hasProperties()\n \"\n />\n <div\n *ngIf=\"\n valueSet && valueSet.propertySet && valueSet.propertySet.hasProperties()\n \"\n class=\"panel-content\"\n >\n <p *ngIf=\"title\" class=\"title\">{{ title }}</p>\n <daga-object-editor [valueSet]=\"valueSet\"></daga-object-editor>\n </div>\n</div>\n"
|
|
7066
|
+
args: [{ standalone: true, selector: 'daga-property-editor', imports: [CommonModule, CollapseButtonComponent, ObjectEditorComponent], template: "<div #panel class=\"panel bottom {{ location }}\">\n <daga-collapse-button\n [collapsableSelector]=\"panel\"\n [collapsableAdditionalSelector]=\"'.panel-content'\"\n [rule]=\"'display'\"\n [collapsedValue]=\"'none'\"\n [visibleValue]=\"'block'\"\n [disabled]=\"\n !valueSet ||\n !valueSet.propertySet ||\n !valueSet.propertySet.hasProperties()\n \"\n />\n <div\n *ngIf=\"\n valueSet && valueSet.propertySet && valueSet.propertySet.hasProperties()\n \"\n class=\"panel-content\"\n >\n <p *ngIf=\"title\" class=\"title\">{{ title }}</p>\n <daga-object-editor [valueSet]=\"valueSet\"></daga-object-editor>\n </div>\n</div>\n" }]
|
|
6201
7067
|
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { panel: [{
|
|
6202
7068
|
type: ViewChild,
|
|
6203
7069
|
args: ['panel']
|
|
@@ -6209,21 +7075,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
6209
7075
|
|
|
6210
7076
|
/**
|
|
6211
7077
|
* A provider for the {@link DiagramConfig} associated with a {@link DiagramComponent} context.
|
|
7078
|
+
* @public
|
|
6212
7079
|
*/
|
|
6213
7080
|
class DagaConfigurationService {
|
|
7081
|
+
/**
|
|
7082
|
+
* Set the diagram configuration of this context.
|
|
7083
|
+
* @private
|
|
7084
|
+
* @param config A diagram configuration.
|
|
7085
|
+
*/
|
|
6214
7086
|
init(config) {
|
|
6215
7087
|
this._config = config;
|
|
6216
7088
|
}
|
|
7089
|
+
/**
|
|
7090
|
+
* Get the diagram configuration of this context.
|
|
7091
|
+
* @public
|
|
7092
|
+
* @returns A diagram configuration.
|
|
7093
|
+
*/
|
|
6217
7094
|
getConfig() {
|
|
6218
7095
|
return this._config;
|
|
6219
7096
|
}
|
|
6220
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
6221
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.
|
|
7097
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DagaConfigurationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7098
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DagaConfigurationService }); }
|
|
6222
7099
|
}
|
|
6223
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
7100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DagaConfigurationService, decorators: [{
|
|
6224
7101
|
type: Injectable
|
|
6225
7102
|
}] });
|
|
6226
7103
|
|
|
7104
|
+
/**
|
|
7105
|
+
* A diagram's user interface editor.
|
|
7106
|
+
* @private
|
|
7107
|
+
*/
|
|
6227
7108
|
class DiagramEditorComponent {
|
|
6228
7109
|
get config() {
|
|
6229
7110
|
return this.configurationService.getConfig();
|
|
@@ -6242,10 +7123,10 @@ class DiagramEditorComponent {
|
|
|
6242
7123
|
ngAfterViewInit() {
|
|
6243
7124
|
this.canvasProvider.initCanvasView(this.appendTo.nativeElement);
|
|
6244
7125
|
}
|
|
6245
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
6246
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
7126
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DiagramEditorComponent, deps: [{ token: DagaConfigurationService }, { token: CanvasProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7127
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: DiagramEditorComponent, isStandalone: true, selector: "daga-diagram-editor", viewQueries: [{ propertyName: "appendTo", first: true, predicate: ["appendTo"], descendants: true }, { propertyName: "diagramButtons", first: true, predicate: ["diagramButtons"], descendants: true }, { propertyName: "palette", first: true, predicate: ["palette"], descendants: true }, { propertyName: "propertyEditor", first: true, predicate: ["propertyEditor"], descendants: true }], ngImport: i0, template: "<div class=\"append-to\" #appendTo></div>\n<daga-diagram-buttons #diagramButtons />\n<daga-palette\n *ngIf=\"config.palettes && config.palettes.length > 0\"\n #palette\n [location]=\"Corner.TopLeft\"\n [palettes]=\"config.palettes\"\n/>\n<daga-property-editor #propertyEditor [location]=\"Corner.TopRight\" />\n<daga-errors />\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DiagramButtonsComponent, selector: "daga-diagram-buttons", inputs: ["enableFilter", "enableLayout", "enableUndoRedo", "enableZoom", "zoomRate"] }, { kind: "component", type: PaletteComponent, selector: "daga-palette", inputs: ["palettes", "currentPalette", "currentCategory", "location"] }, { kind: "component", type: PropertyEditorComponent, selector: "daga-property-editor", inputs: ["location", "valueSet"] }, { kind: "component", type: ErrorsComponent, selector: "daga-errors" }] }); }
|
|
6247
7128
|
}
|
|
6248
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
7129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DiagramEditorComponent, decorators: [{
|
|
6249
7130
|
type: Component,
|
|
6250
7131
|
args: [{ standalone: true, selector: 'daga-diagram-editor', imports: [
|
|
6251
7132
|
CommonModule,
|
|
@@ -6253,7 +7134,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
6253
7134
|
PaletteComponent,
|
|
6254
7135
|
PropertyEditorComponent,
|
|
6255
7136
|
ErrorsComponent
|
|
6256
|
-
], template: "<div class=\"append-to\" #appendTo></div>\n<daga-diagram-buttons #diagramButtons />\n<daga-palette\n *ngIf=\"config.palettes && config.palettes.length > 0\"\n #palette\n [location]=\"Corner.TopLeft\"\n [palettes]=\"config.palettes\"\n/>\n<daga-property-editor #propertyEditor [location]=\"Corner.TopRight\" />\n<daga-errors />\n"
|
|
7137
|
+
], template: "<div class=\"append-to\" #appendTo></div>\n<daga-diagram-buttons #diagramButtons />\n<daga-palette\n *ngIf=\"config.palettes && config.palettes.length > 0\"\n #palette\n [location]=\"Corner.TopLeft\"\n [palettes]=\"config.palettes\"\n/>\n<daga-property-editor #propertyEditor [location]=\"Corner.TopRight\" />\n<daga-errors />\n" }]
|
|
6257
7138
|
}], ctorParameters: () => [{ type: DagaConfigurationService }, { type: CanvasProviderService }], propDecorators: { appendTo: [{
|
|
6258
7139
|
type: ViewChild,
|
|
6259
7140
|
args: ['appendTo']
|
|
@@ -6271,6 +7152,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
6271
7152
|
/**
|
|
6272
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}.
|
|
6273
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
|
|
6274
7156
|
*/
|
|
6275
7157
|
class DiagramComponent {
|
|
6276
7158
|
constructor(configurationService, canvasProvider) {
|
|
@@ -6280,19 +7162,24 @@ class DiagramComponent {
|
|
|
6280
7162
|
ngOnInit() {
|
|
6281
7163
|
this.configurationService.init(this.config);
|
|
6282
7164
|
}
|
|
6283
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
6284
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.
|
|
7165
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DiagramComponent, deps: [{ token: DagaConfigurationService }, { token: CanvasProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7166
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: DiagramComponent, isStandalone: true, selector: "daga-diagram", inputs: { config: "config" }, providers: [CanvasProviderService, DagaConfigurationService], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true }); }
|
|
6285
7167
|
}
|
|
6286
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
7168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DiagramComponent, decorators: [{
|
|
6287
7169
|
type: Component,
|
|
6288
|
-
args: [{
|
|
7170
|
+
args: [{
|
|
7171
|
+
standalone: true,
|
|
7172
|
+
selector: 'daga-diagram',
|
|
7173
|
+
template: `<ng-content></ng-content>`,
|
|
7174
|
+
providers: [CanvasProviderService, DagaConfigurationService]
|
|
7175
|
+
}]
|
|
6289
7176
|
}], ctorParameters: () => [{ type: DagaConfigurationService }, { type: CanvasProviderService }], propDecorators: { config: [{
|
|
6290
7177
|
type: Input
|
|
6291
7178
|
}] } });
|
|
6292
7179
|
|
|
6293
7180
|
class DagaModule {
|
|
6294
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
6295
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.
|
|
7181
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DagaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
7182
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.2", ngImport: i0, type: DagaModule, imports: [CollapseButtonComponent,
|
|
6296
7183
|
DiagramButtonsComponent,
|
|
6297
7184
|
DiagramComponent,
|
|
6298
7185
|
DiagramEditorComponent,
|
|
@@ -6305,7 +7192,7 @@ class DagaModule {
|
|
|
6305
7192
|
CommonModule,
|
|
6306
7193
|
FormsModule,
|
|
6307
7194
|
LuxModule], exports: [DiagramComponent, DiagramEditorComponent] }); }
|
|
6308
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.
|
|
7195
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DagaModule, providers: [DagaConfigurationService, CanvasProviderService], imports: [CollapseButtonComponent,
|
|
6309
7196
|
DiagramButtonsComponent,
|
|
6310
7197
|
DiagramEditorComponent,
|
|
6311
7198
|
ErrorsComponent,
|
|
@@ -6318,7 +7205,7 @@ class DagaModule {
|
|
|
6318
7205
|
FormsModule,
|
|
6319
7206
|
LuxModule] }); }
|
|
6320
7207
|
}
|
|
6321
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
7208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DagaModule, decorators: [{
|
|
6322
7209
|
type: NgModule,
|
|
6323
7210
|
args: [{
|
|
6324
7211
|
declarations: [],
|
|
@@ -6344,6 +7231,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.6", ngImpor
|
|
|
6344
7231
|
|
|
6345
7232
|
const DAGA_FILE_VERSION = 1;
|
|
6346
7233
|
|
|
7234
|
+
/**
|
|
7235
|
+
* Importer which exports a diagram to its daga model representation.
|
|
7236
|
+
* @public
|
|
7237
|
+
*/
|
|
6347
7238
|
class DagaExporter {
|
|
6348
7239
|
export(model) {
|
|
6349
7240
|
const result = {
|
|
@@ -6420,6 +7311,10 @@ class DagaExporter {
|
|
|
6420
7311
|
}
|
|
6421
7312
|
}
|
|
6422
7313
|
|
|
7314
|
+
/**
|
|
7315
|
+
* Importer which imports a diagram from its daga model representation.
|
|
7316
|
+
* @public
|
|
7317
|
+
*/
|
|
6423
7318
|
class DagaImporter {
|
|
6424
7319
|
import(model, data) {
|
|
6425
7320
|
// clear the model beforehand
|
|
@@ -6594,5 +7489,5 @@ class DagaImporter {
|
|
|
6594
7489
|
* Generated bundle index. Do not edit.
|
|
6595
7490
|
*/
|
|
6596
7491
|
|
|
6597
|
-
export { ACTION_QUEUE_SIZE, ActionQueue, AddConnectionAction, AddNodeAction, AdjacencyLayout, BreadthAdjacencyLayout, BreadthLayout, CanvasProviderService, CollapseButtonComponent, DagaConfigurationService, DagaExporter, DagaImporter, DagaModule, DiagramButtonsComponent, DiagramCanvas, DiagramComponent, DiagramConnection, DiagramConnectionType, DiagramEditorComponent, DiagramElement, DiagramField, DiagramModel, DiagramNode, DiagramNodeType, DiagramPort, EditFieldAction, ErrorsComponent, ForceLayout, HorizontalLayout, MoveNodeAction, ObjectEditorComponent, PaletteComponent, PriorityLayout, Property, PropertyEditorComponent, PropertySet, RemoveAction, StretchNodeAction, TextListEditorComponent, TextMapEditorComponent, Type, UpdateValuesAction, ValueSet, VerticalLayout, layouts };
|
|
7492
|
+
export { ACTION_QUEUE_SIZE, ActionQueue, AddConnectionAction, AddNodeAction, AdjacencyLayout, BreadthAdjacencyLayout, BreadthLayout, CanvasProviderService, ClosedShape, CollapseButtonComponent, Corner, DagaConfigurationService, DagaExporter, DagaImporter, DagaModule, DiagramActions, DiagramButtonsComponent, DiagramCanvas, DiagramComponent, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramEditorComponent, DiagramElement, DiagramEntitySet, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramPort, DiagramPortSet, DiagramSection, DiagramSectionSet, EditFieldAction, ErrorsComponent, ForceLayout, HorizontalAlign, HorizontalLayout, LineShape, LineStyle, MoveNodeAction, ObjectEditorComponent, PaletteComponent, PriorityLayout, Property, PropertyEditorComponent, PropertySet, RemoveAction, Side, StretchNodeAction, TextListEditorComponent, TextMapEditorComponent, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, layouts };
|
|
6598
7493
|
//# sourceMappingURL=metadev-daga.mjs.map
|