@metadev/daga 4.1.0 → 4.2.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 +10 -2
- package/README.md +1 -0
- package/index.cjs.js +270 -246
- package/index.esm.js +270 -246
- package/package.json +3 -3
- package/src/lib/diagram/config/diagram-components-config.d.ts +8 -0
- package/src/lib/diagram/config/diagram-config.d.ts +5 -0
- package/src/lib/diagram/model/diagram-element.d.ts +1 -1
- package/src/lib/diagram/model/diagram-field.d.ts +9 -3
- package/index.cjs.d.ts +0 -1
- package/index.esm.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -825,7 +825,7 @@ const numberOfColumns = s => {
|
|
|
825
825
|
};
|
|
826
826
|
const numberOfRows = s => {
|
|
827
827
|
var _a;
|
|
828
|
-
return ((_a = s.match(/\n/g)) === null || _a ===
|
|
828
|
+
return ((_a = s.match(/\n/g)) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
829
829
|
};
|
|
830
830
|
|
|
831
831
|
/******************************************************************************
|
|
@@ -1051,14 +1051,14 @@ class DiagramElement {
|
|
|
1051
1051
|
*/
|
|
1052
1052
|
get highlighted() {
|
|
1053
1053
|
var _a, _b;
|
|
1054
|
-
return ((_b = (_a = this.model.canvas) === null || _a ===
|
|
1054
|
+
return ((_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userHighlight) === null || _b === void 0 ? void 0 : _b.contains(this.id)) || false;
|
|
1055
1055
|
}
|
|
1056
1056
|
/**
|
|
1057
1057
|
* Whether this diagram element is currently in the user selection.
|
|
1058
1058
|
*/
|
|
1059
1059
|
get selected() {
|
|
1060
1060
|
var _a, _b;
|
|
1061
|
-
return ((_b = (_a = this.model.canvas) === null || _a ===
|
|
1061
|
+
return ((_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userSelection) === null || _b === void 0 ? void 0 : _b.contains(this.id)) || false;
|
|
1062
1062
|
}
|
|
1063
1063
|
constructor(model, id) {
|
|
1064
1064
|
/**
|
|
@@ -1087,7 +1087,7 @@ class DiagramElement {
|
|
|
1087
1087
|
*/
|
|
1088
1088
|
select() {
|
|
1089
1089
|
var _a, _b;
|
|
1090
|
-
return (_b = (_a = this.model.canvas) === null || _a ===
|
|
1090
|
+
return (_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.selectCanvasView()) === null || _b === void 0 ? void 0 : _b.select(`[id='${escapeSelector(this.id)}']`);
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
class DiagramElementSet extends DiagramEntitySet {
|
|
@@ -1485,7 +1485,7 @@ class ValueSet {
|
|
|
1485
1485
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1486
1486
|
getValue(key) {
|
|
1487
1487
|
var _a;
|
|
1488
|
-
const rootAttribute = (_a = this.propertySet.getProperty(key)) === null || _a ===
|
|
1488
|
+
const rootAttribute = (_a = this.propertySet.getProperty(key)) === null || _a === void 0 ? void 0 : _a.rootAttribute;
|
|
1489
1489
|
if (rootAttribute !== undefined && rootAttribute !== null) {
|
|
1490
1490
|
this.values[key] = this.getRootElementValue(rootAttribute);
|
|
1491
1491
|
}
|
|
@@ -1570,7 +1570,7 @@ class ValueSet {
|
|
|
1570
1570
|
if (property && property.type === exports.Type.Object) {
|
|
1571
1571
|
return this.getSubValueSet(key).hasAnySetValue();
|
|
1572
1572
|
}
|
|
1573
|
-
return !empty(value) && !equals(value, property === null || property ===
|
|
1573
|
+
return !empty(value) && !equals(value, property === null || property === void 0 ? void 0 : property.defaultValue);
|
|
1574
1574
|
}
|
|
1575
1575
|
/**
|
|
1576
1576
|
* Checks if any of the values in the set are not empty or the default value.
|
|
@@ -1837,7 +1837,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
1837
1837
|
}
|
|
1838
1838
|
set type(type) {
|
|
1839
1839
|
var _a, _b;
|
|
1840
|
-
(_b = (_a = this.model.canvas) === null || _a ===
|
|
1840
|
+
(_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userSelection) === null || _b === void 0 ? void 0 : _b.openInPropertyEditor(undefined);
|
|
1841
1841
|
this._type = type;
|
|
1842
1842
|
if (this.valueSet) {
|
|
1843
1843
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
@@ -2026,11 +2026,11 @@ class DiagramConnection extends DiagramElement {
|
|
|
2026
2026
|
}
|
|
2027
2027
|
updateInView() {
|
|
2028
2028
|
var _a;
|
|
2029
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2029
|
+
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateConnectionsInView(this.id);
|
|
2030
2030
|
}
|
|
2031
2031
|
raise() {
|
|
2032
2032
|
var _a;
|
|
2033
|
-
(_a = this.select()) === null || _a ===
|
|
2033
|
+
(_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
|
|
2034
2034
|
}
|
|
2035
2035
|
/**
|
|
2036
2036
|
* Set the start of this connection to the given port or reset this connection's starting port if `undefined`.
|
|
@@ -2046,12 +2046,12 @@ class DiagramConnection extends DiagramElement {
|
|
|
2046
2046
|
this.start = start;
|
|
2047
2047
|
if (start !== undefined) {
|
|
2048
2048
|
start.outgoingConnections.push(this);
|
|
2049
|
-
this.startDirection = start === null || start ===
|
|
2050
|
-
this.startCoords = (start === null || start ===
|
|
2049
|
+
this.startDirection = start === null || start === void 0 ? void 0 : start.direction;
|
|
2050
|
+
this.startCoords = (start === null || start === void 0 ? void 0 : start.connectionPoint) || [0, 0];
|
|
2051
2051
|
}
|
|
2052
2052
|
} else {
|
|
2053
|
-
this.startDirection = start === null || start ===
|
|
2054
|
-
this.startCoords = (start === null || start ===
|
|
2053
|
+
this.startDirection = start === null || start === void 0 ? void 0 : start.direction;
|
|
2054
|
+
this.startCoords = (start === null || start === void 0 ? void 0 : start.connectionPoint) || [0, 0];
|
|
2055
2055
|
}
|
|
2056
2056
|
this.updateInView();
|
|
2057
2057
|
}
|
|
@@ -2069,12 +2069,12 @@ class DiagramConnection extends DiagramElement {
|
|
|
2069
2069
|
this.end = end;
|
|
2070
2070
|
if (end !== undefined) {
|
|
2071
2071
|
end.incomingConnections.push(this);
|
|
2072
|
-
this.endDirection = end === null || end ===
|
|
2073
|
-
this.endCoords = (end === null || end ===
|
|
2072
|
+
this.endDirection = end === null || end === void 0 ? void 0 : end.direction;
|
|
2073
|
+
this.endCoords = (end === null || end === void 0 ? void 0 : end.connectionPoint) || [0, 0];
|
|
2074
2074
|
}
|
|
2075
2075
|
} else {
|
|
2076
|
-
this.endDirection = end === null || end ===
|
|
2077
|
-
this.endCoords = (end === null || end ===
|
|
2076
|
+
this.endDirection = end === null || end === void 0 ? void 0 : end.direction;
|
|
2077
|
+
this.endCoords = (end === null || end === void 0 ? void 0 : end.connectionPoint) || [0, 0];
|
|
2078
2078
|
}
|
|
2079
2079
|
this.updateInView();
|
|
2080
2080
|
}
|
|
@@ -2085,7 +2085,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2085
2085
|
*/
|
|
2086
2086
|
tighten() {
|
|
2087
2087
|
var _a, _b;
|
|
2088
|
-
if (((_a = this.start) === null || _a ===
|
|
2088
|
+
if (((_a = this.start) === null || _a === void 0 ? void 0 : _a.rootElement) && this.end) {
|
|
2089
2089
|
const alternativeStartPortsSortedByDistanceAscending = this.start.rootElement.ports.map(p => [p, p.distanceTo(this.end.coords)]).sort((a, b) => a[1] - b[1]).map(a => a[0]);
|
|
2090
2090
|
checkAlternativeStartPorts: for (const alternativeStartPort of alternativeStartPortsSortedByDistanceAscending) {
|
|
2091
2091
|
if (alternativeStartPort === this.end) {
|
|
@@ -2119,7 +2119,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2119
2119
|
}
|
|
2120
2120
|
}
|
|
2121
2121
|
}
|
|
2122
|
-
if (((_b = this.end) === null || _b ===
|
|
2122
|
+
if (((_b = this.end) === null || _b === void 0 ? void 0 : _b.rootElement) && this.start) {
|
|
2123
2123
|
const alternativeEndPortsSortedByDistanceAscending = this.end.rootElement.ports.map(p => [p, p.distanceTo(this.start.coords)]).sort((a, b) => a[1] - b[1]).map(a => a[0]);
|
|
2124
2124
|
checkAlternativeEndPorts: for (const alternativeEndPort of alternativeEndPortsSortedByDistanceAscending) {
|
|
2125
2125
|
if (alternativeEndPort === this.start) {
|
|
@@ -2215,8 +2215,8 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
2215
2215
|
const connection = this.get(id, true);
|
|
2216
2216
|
if (connection) {
|
|
2217
2217
|
// remove from ports
|
|
2218
|
-
removeIfExists(((_a = connection.start) === null || _a ===
|
|
2219
|
-
removeIfExists(((_b = connection.end) === null || _b ===
|
|
2218
|
+
removeIfExists(((_a = connection.start) === null || _a === void 0 ? void 0 : _a.outgoingConnections) || [], connection);
|
|
2219
|
+
removeIfExists(((_b = connection.end) === null || _b === void 0 ? void 0 : _b.incomingConnections) || [], connection);
|
|
2220
2220
|
// remove from set of connections
|
|
2221
2221
|
super.remove(id);
|
|
2222
2222
|
// remove from canvas
|
|
@@ -2240,6 +2240,7 @@ const DIAGRAM_FIELD_DEFAULTS = {
|
|
|
2240
2240
|
selectedColor: '#000000',
|
|
2241
2241
|
horizontalAlign: exports.HorizontalAlign.Center,
|
|
2242
2242
|
verticalAlign: exports.VerticalAlign.Center,
|
|
2243
|
+
orientation: exports.Side.Top,
|
|
2243
2244
|
fit: false
|
|
2244
2245
|
};
|
|
2245
2246
|
/**
|
|
@@ -2259,17 +2260,17 @@ class DiagramField extends DiagramElement {
|
|
|
2259
2260
|
}
|
|
2260
2261
|
set text(value) {
|
|
2261
2262
|
var _a;
|
|
2262
|
-
if (value === null || value === undefined || (value === null || value ===
|
|
2263
|
+
if (value === null || value === undefined || (value === null || value === void 0 ? void 0 : value.trim()) === '') {
|
|
2263
2264
|
value = this.defaultText;
|
|
2264
2265
|
}
|
|
2265
2266
|
this._text = value;
|
|
2266
2267
|
this.updateInView();
|
|
2267
2268
|
if (this.fit) {
|
|
2268
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2269
|
+
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.fitFieldRootInView(this.id);
|
|
2269
2270
|
}
|
|
2270
2271
|
}
|
|
2271
|
-
constructor(model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, text, editable, fit) {
|
|
2272
|
-
const id = `${rootElement === null || rootElement ===
|
|
2272
|
+
constructor(model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, orientation, text, editable, fit) {
|
|
2273
|
+
const id = `${rootElement === null || rootElement === void 0 ? void 0 : rootElement.id}_field`;
|
|
2273
2274
|
if (model.fields.get(id) !== undefined) {
|
|
2274
2275
|
throw new Error('DiagramField for rootElement already exists');
|
|
2275
2276
|
}
|
|
@@ -2289,6 +2290,7 @@ class DiagramField extends DiagramElement {
|
|
|
2289
2290
|
this.selectedColor = selectedColor;
|
|
2290
2291
|
this.horizontalAlign = horizontalAlign;
|
|
2291
2292
|
this.verticalAlign = verticalAlign;
|
|
2293
|
+
this.orientation = orientation;
|
|
2292
2294
|
this.defaultText = text;
|
|
2293
2295
|
this._text = text;
|
|
2294
2296
|
this.editable = editable;
|
|
@@ -2299,11 +2301,11 @@ class DiagramField extends DiagramElement {
|
|
|
2299
2301
|
}
|
|
2300
2302
|
updateInView() {
|
|
2301
2303
|
var _a;
|
|
2302
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2304
|
+
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateFieldsInView(this.id);
|
|
2303
2305
|
}
|
|
2304
2306
|
raise() {
|
|
2305
2307
|
var _a;
|
|
2306
|
-
(_a = this.select()) === null || _a ===
|
|
2308
|
+
(_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
|
|
2307
2309
|
}
|
|
2308
2310
|
/**
|
|
2309
2311
|
* Change the coordinates of this field to the given coordinates.
|
|
@@ -2316,7 +2318,7 @@ class DiagramField extends DiagramElement {
|
|
|
2316
2318
|
}
|
|
2317
2319
|
getPriority() {
|
|
2318
2320
|
var _a;
|
|
2319
|
-
return ((_a = this.rootElement) === null || _a ===
|
|
2321
|
+
return ((_a = this.rootElement) === null || _a === void 0 ? void 0 : _a.getPriority()) || DEFAULT_PRIORITY;
|
|
2320
2322
|
}
|
|
2321
2323
|
}
|
|
2322
2324
|
class DiagramFieldSet extends DiagramElementSet {
|
|
@@ -2332,8 +2334,8 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2332
2334
|
* Instance a new field and add it to this set. This method is normally called when instancing an element with a field and it is rarely called by itself.
|
|
2333
2335
|
* @private
|
|
2334
2336
|
*/
|
|
2335
|
-
new(rootElement, coords, fontSize, fontFamily, color, selectedColor, width, height, horizontalAlign, verticalAlign, text, editable, fit) {
|
|
2336
|
-
const field = new DiagramField(this.model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, text, editable, fit);
|
|
2337
|
+
new(rootElement, coords, fontSize, fontFamily, color, selectedColor, width, height, horizontalAlign, verticalAlign, orientation, text, editable, fit) {
|
|
2338
|
+
const field = new DiagramField(this.model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, orientation, text, editable, fit);
|
|
2337
2339
|
super.add(field);
|
|
2338
2340
|
field.updateInView();
|
|
2339
2341
|
// add this field to its root element
|
|
@@ -2347,7 +2349,7 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2347
2349
|
const field = this.get(id, true);
|
|
2348
2350
|
if (field) {
|
|
2349
2351
|
// remove from root element
|
|
2350
|
-
if (((_a = field.rootElement) === null || _a ===
|
|
2352
|
+
if (((_a = field.rootElement) === null || _a === void 0 ? void 0 : _a.label) !== undefined) {
|
|
2351
2353
|
if (field.rootElement.label === field) {
|
|
2352
2354
|
field.rootElement.label = undefined;
|
|
2353
2355
|
}
|
|
@@ -2360,7 +2362,7 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2360
2362
|
}
|
|
2361
2363
|
}
|
|
2362
2364
|
const getBottomMargin = config => {
|
|
2363
|
-
if ((config === null || config ===
|
|
2365
|
+
if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
|
|
2364
2366
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2365
2367
|
} else if (typeof config.margin === 'number') {
|
|
2366
2368
|
return config.margin;
|
|
@@ -2379,7 +2381,7 @@ const getBottomMargin = config => {
|
|
|
2379
2381
|
}
|
|
2380
2382
|
};
|
|
2381
2383
|
const getLeftMargin = config => {
|
|
2382
|
-
if ((config === null || config ===
|
|
2384
|
+
if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
|
|
2383
2385
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2384
2386
|
} else if (typeof config.margin === 'number') {
|
|
2385
2387
|
return config.margin;
|
|
@@ -2398,7 +2400,7 @@ const getLeftMargin = config => {
|
|
|
2398
2400
|
}
|
|
2399
2401
|
};
|
|
2400
2402
|
const getRightMargin = config => {
|
|
2401
|
-
if ((config === null || config ===
|
|
2403
|
+
if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
|
|
2402
2404
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2403
2405
|
} else if (typeof config.margin === 'number') {
|
|
2404
2406
|
return config.margin;
|
|
@@ -2417,7 +2419,7 @@ const getRightMargin = config => {
|
|
|
2417
2419
|
}
|
|
2418
2420
|
};
|
|
2419
2421
|
const getTopMargin = config => {
|
|
2420
|
-
if ((config === null || config ===
|
|
2422
|
+
if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
|
|
2421
2423
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2422
2424
|
} else if (typeof config.margin === 'number') {
|
|
2423
2425
|
return config.margin;
|
|
@@ -2436,7 +2438,7 @@ const getTopMargin = config => {
|
|
|
2436
2438
|
}
|
|
2437
2439
|
};
|
|
2438
2440
|
const getBottomPadding$1 = config => {
|
|
2439
|
-
if ((config === null || config ===
|
|
2441
|
+
if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
|
|
2440
2442
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2441
2443
|
} else if (typeof config.padding === 'number') {
|
|
2442
2444
|
return config.padding;
|
|
@@ -2455,7 +2457,7 @@ const getBottomPadding$1 = config => {
|
|
|
2455
2457
|
}
|
|
2456
2458
|
};
|
|
2457
2459
|
const getLeftPadding$1 = config => {
|
|
2458
|
-
if ((config === null || config ===
|
|
2460
|
+
if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
|
|
2459
2461
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2460
2462
|
} else if (typeof config.padding === 'number') {
|
|
2461
2463
|
return config.padding;
|
|
@@ -2474,7 +2476,7 @@ const getLeftPadding$1 = config => {
|
|
|
2474
2476
|
}
|
|
2475
2477
|
};
|
|
2476
2478
|
const getRightPadding$1 = config => {
|
|
2477
|
-
if ((config === null || config ===
|
|
2479
|
+
if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
|
|
2478
2480
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2479
2481
|
} else if (typeof config.padding === 'number') {
|
|
2480
2482
|
return config.padding;
|
|
@@ -2493,7 +2495,7 @@ const getRightPadding$1 = config => {
|
|
|
2493
2495
|
}
|
|
2494
2496
|
};
|
|
2495
2497
|
const getTopPadding$1 = config => {
|
|
2496
|
-
if ((config === null || config ===
|
|
2498
|
+
if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
|
|
2497
2499
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2498
2500
|
} else if (typeof config.padding === 'number') {
|
|
2499
2501
|
return config.padding;
|
|
@@ -2585,7 +2587,7 @@ class DiagramSection extends DiagramElement {
|
|
|
2585
2587
|
*/
|
|
2586
2588
|
get name() {
|
|
2587
2589
|
var _a;
|
|
2588
|
-
return ((_a = this.label) === null || _a ===
|
|
2590
|
+
return ((_a = this.label) === null || _a === void 0 ? void 0 : _a.text) || '';
|
|
2589
2591
|
}
|
|
2590
2592
|
set name(name) {
|
|
2591
2593
|
if (this.label) {
|
|
@@ -2600,15 +2602,15 @@ class DiagramSection extends DiagramElement {
|
|
|
2600
2602
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2601
2603
|
if (this.selected) {
|
|
2602
2604
|
if (this.highlighted) {
|
|
2603
|
-
return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : ((_a = this.type) === null || _a ===
|
|
2605
|
+
return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : ((_a = this.type) === null || _a === void 0 ? void 0 : _a.selectedAndHighlightedLook) || ((_b = this.node) === null || _b === void 0 ? void 0 : _b.look);
|
|
2604
2606
|
} else {
|
|
2605
|
-
return this._selectedLook !== undefined ? this._selectedLook : ((_c = this.type) === null || _c ===
|
|
2607
|
+
return this._selectedLook !== undefined ? this._selectedLook : ((_c = this.type) === null || _c === void 0 ? void 0 : _c.selectedLook) || ((_d = this.node) === null || _d === void 0 ? void 0 : _d.look);
|
|
2606
2608
|
}
|
|
2607
2609
|
} else {
|
|
2608
2610
|
if (this.highlighted) {
|
|
2609
|
-
return this._highlightedLook !== undefined ? this._highlightedLook : ((_e = this.type) === null || _e ===
|
|
2611
|
+
return this._highlightedLook !== undefined ? this._highlightedLook : ((_e = this.type) === null || _e === void 0 ? void 0 : _e.highlightedLook) || ((_f = this.node) === null || _f === void 0 ? void 0 : _f.look);
|
|
2610
2612
|
} else {
|
|
2611
|
-
return this._defaultLook !== undefined ? this._defaultLook : ((_g = this.type) === null || _g ===
|
|
2613
|
+
return this._defaultLook !== undefined ? this._defaultLook : ((_g = this.type) === null || _g === void 0 ? void 0 : _g.defaultLook) || ((_h = this.node) === null || _h === void 0 ? void 0 : _h.look);
|
|
2612
2614
|
}
|
|
2613
2615
|
}
|
|
2614
2616
|
}
|
|
@@ -2661,11 +2663,11 @@ class DiagramSection extends DiagramElement {
|
|
|
2661
2663
|
}
|
|
2662
2664
|
updateInView() {
|
|
2663
2665
|
var _a;
|
|
2664
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2666
|
+
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateSectionsInView(this.id);
|
|
2665
2667
|
}
|
|
2666
2668
|
raise() {
|
|
2667
2669
|
var _a;
|
|
2668
|
-
(_a = this.select()) === null || _a ===
|
|
2670
|
+
(_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
|
|
2669
2671
|
if (this.label) {
|
|
2670
2672
|
this.label.raise();
|
|
2671
2673
|
}
|
|
@@ -2678,19 +2680,19 @@ class DiagramSection extends DiagramElement {
|
|
|
2678
2680
|
}
|
|
2679
2681
|
get type() {
|
|
2680
2682
|
var _a, _b, _c, _d, _e;
|
|
2681
|
-
return (_e = (_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2683
|
+
return (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.sectionGrid) === null || _c === void 0 ? void 0 : _c.sections) === null || _d === void 0 ? void 0 : _d[this.indexYInNode]) === null || _e === void 0 ? void 0 : _e[this.indexXInNode];
|
|
2682
2684
|
}
|
|
2683
2685
|
getMinWidth() {
|
|
2684
2686
|
var _a, _b, _c, _d;
|
|
2685
|
-
return ((_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2687
|
+
return ((_d = (_c = (_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.sectionGrid) === null || _c === void 0 ? void 0 : _c.minWidths) === null || _d === void 0 ? void 0 : _d[this.indexXInNode]) || DIAGRAM_SECTION_MIN_WIDTH;
|
|
2686
2688
|
}
|
|
2687
2689
|
getMinHeight() {
|
|
2688
2690
|
var _a, _b, _c, _d;
|
|
2689
|
-
return ((_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2691
|
+
return ((_d = (_c = (_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.sectionGrid) === null || _c === void 0 ? void 0 : _c.minHeights) === null || _d === void 0 ? void 0 : _d[this.indexYInNode]) || DIAGRAM_SECTION_MIN_HEIGHT;
|
|
2690
2692
|
}
|
|
2691
2693
|
getPriority() {
|
|
2692
2694
|
var _a, _b, _c, _d, _e, _f;
|
|
2693
|
-
return ((_f = (_e = (_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2695
|
+
return ((_f = (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.sectionGrid) === null || _c === void 0 ? void 0 : _c.sections) === null || _d === void 0 ? void 0 : _d[this.indexYInNode]) === null || _e === void 0 ? void 0 : _e[this.indexXInNode]) === null || _f === void 0 ? void 0 : _f.priority) || DEFAULT_PRIORITY;
|
|
2694
2696
|
}
|
|
2695
2697
|
/**
|
|
2696
2698
|
* Get the port of this section which is closest to the given coordinates.
|
|
@@ -2855,9 +2857,9 @@ class DiagramSection extends DiagramElement {
|
|
|
2855
2857
|
// Set label's dimensions as a function of ours.
|
|
2856
2858
|
const type = this.type;
|
|
2857
2859
|
if (this.label) {
|
|
2858
|
-
this.label.coords = [this.coords[0] + getLeftMargin(type === null || type ===
|
|
2859
|
-
this.label.width = this.width - getLeftMargin(type === null || type ===
|
|
2860
|
-
this.label.height = this.height - getTopMargin(type === null || type ===
|
|
2860
|
+
this.label.coords = [this.coords[0] + getLeftMargin(type === null || type === void 0 ? void 0 : type.label), this.coords[1] + getTopMargin(type === null || type === void 0 ? void 0 : type.label)];
|
|
2861
|
+
this.label.width = this.width - getLeftMargin(type === null || type === void 0 ? void 0 : type.label) - getRightMargin(type === null || type === void 0 ? void 0 : type.label);
|
|
2862
|
+
this.label.height = this.height - getTopMargin(type === null || type === void 0 ? void 0 : type.label) - getBottomMargin(type === null || type === void 0 ? void 0 : type.label);
|
|
2861
2863
|
this.label.updateInView();
|
|
2862
2864
|
}
|
|
2863
2865
|
// Move decorators to match the new coords.
|
|
@@ -2891,13 +2893,13 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
2891
2893
|
node.sections.push(section);
|
|
2892
2894
|
node.updateInView();
|
|
2893
2895
|
// add section ports
|
|
2894
|
-
const sectionPorts = (_d = (_c = (_b = (_a = node.type.sectionGrid) === null || _a ===
|
|
2896
|
+
const sectionPorts = (_d = (_c = (_b = (_a = node.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.sections) === null || _b === void 0 ? void 0 : _b[indexYInNode]) === null || _c === void 0 ? void 0 : _c[indexXInNode]) === null || _d === void 0 ? void 0 : _d.ports;
|
|
2895
2897
|
if (sectionPorts && sectionPorts.length > 0) {
|
|
2896
2898
|
for (let i = 0; i < sectionPorts.length; ++i) {
|
|
2897
2899
|
const portConfig = sectionPorts[i];
|
|
2898
|
-
const port = this.model.ports.new(portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined, section, [section.coords[0] + (portConfig.coords[0] || 0), section.coords[1] + (portConfig.coords[1] || 0)], portConfig.connectionPoint !== undefined ? [section.coords[0] + (portConfig.connectionPoint[0] || 0), section.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig === null || portConfig ===
|
|
2899
|
-
if ((_e = port.type) === null || _e ===
|
|
2900
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f ===
|
|
2900
|
+
const port = this.model.ports.new(portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined, section, [section.coords[0] + (portConfig.coords[0] || 0), section.coords[1] + (portConfig.coords[1] || 0)], portConfig.connectionPoint !== undefined ? [section.coords[0] + (portConfig.connectionPoint[0] || 0), section.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig === null || portConfig === void 0 ? void 0 : portConfig.direction, `${section.id}_${i}`);
|
|
2901
|
+
if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
|
|
2902
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
|
|
2901
2903
|
const labelWidth = 6 * labelConfiguration.fontSize + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
2902
2904
|
const labelHeight = labelConfiguration.fontSize + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
2903
2905
|
let labelCoords;
|
|
@@ -2913,15 +2915,15 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
2913
2915
|
default:
|
|
2914
2916
|
labelCoords = port.coords;
|
|
2915
2917
|
}
|
|
2916
|
-
this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
2918
|
+
this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
2917
2919
|
}
|
|
2918
2920
|
}
|
|
2919
2921
|
}
|
|
2920
2922
|
// add section label
|
|
2921
|
-
const sectionLabel = (_k = (_j = (_h = (_g = node.type.sectionGrid) === null || _g ===
|
|
2923
|
+
const sectionLabel = (_k = (_j = (_h = (_g = node.type.sectionGrid) === null || _g === void 0 ? void 0 : _g.sections) === null || _h === void 0 ? void 0 : _h[indexYInNode]) === null || _j === void 0 ? void 0 : _j[indexXInNode]) === null || _k === void 0 ? void 0 : _k.label;
|
|
2922
2924
|
if (sectionLabel) {
|
|
2923
2925
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), sectionLabel);
|
|
2924
|
-
this.model.fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
2926
|
+
this.model.fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
2925
2927
|
}
|
|
2926
2928
|
return section;
|
|
2927
2929
|
}
|
|
@@ -3025,7 +3027,7 @@ class DiagramNodeType {
|
|
|
3025
3027
|
this.canBeParentless = values.canBeParentless;
|
|
3026
3028
|
this.childrenTypes = values.childrenTypes;
|
|
3027
3029
|
this.priority = values.priority;
|
|
3028
|
-
this.propertySet = new PropertySet((options === null || options ===
|
|
3030
|
+
this.propertySet = new PropertySet((options === null || options === void 0 ? void 0 : options.properties) || []);
|
|
3029
3031
|
}
|
|
3030
3032
|
}
|
|
3031
3033
|
/**
|
|
@@ -3041,7 +3043,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3041
3043
|
}
|
|
3042
3044
|
set type(type) {
|
|
3043
3045
|
var _a, _b;
|
|
3044
|
-
(_b = (_a = this.model.canvas) === null || _a ===
|
|
3046
|
+
(_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userSelection) === null || _b === void 0 ? void 0 : _b.openInPropertyEditor(undefined);
|
|
3045
3047
|
this._type = type;
|
|
3046
3048
|
if (this.valueSet) {
|
|
3047
3049
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
@@ -3063,7 +3065,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3063
3065
|
*/
|
|
3064
3066
|
get name() {
|
|
3065
3067
|
var _a;
|
|
3066
|
-
return ((_a = this.label) === null || _a ===
|
|
3068
|
+
return ((_a = this.label) === null || _a === void 0 ? void 0 : _a.text) || '';
|
|
3067
3069
|
}
|
|
3068
3070
|
set name(name) {
|
|
3069
3071
|
if (this.label) {
|
|
@@ -3153,11 +3155,11 @@ class DiagramNode extends DiagramElement {
|
|
|
3153
3155
|
}
|
|
3154
3156
|
updateInView() {
|
|
3155
3157
|
var _a;
|
|
3156
|
-
(_a = this.model.canvas) === null || _a ===
|
|
3158
|
+
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateNodesInView(this.id);
|
|
3157
3159
|
}
|
|
3158
3160
|
raise() {
|
|
3159
3161
|
var _a;
|
|
3160
|
-
(_a = this.select()) === null || _a ===
|
|
3162
|
+
(_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
|
|
3161
3163
|
for (const section of this.sections) {
|
|
3162
3164
|
section.raise();
|
|
3163
3165
|
}
|
|
@@ -3264,7 +3266,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3264
3266
|
if (!includeRemoved && incomingConnection.removed) {
|
|
3265
3267
|
continue;
|
|
3266
3268
|
}
|
|
3267
|
-
const otherNode = (_a = incomingConnection.start) === null || _a ===
|
|
3269
|
+
const otherNode = (_a = incomingConnection.start) === null || _a === void 0 ? void 0 : _a.getNode();
|
|
3268
3270
|
if (otherNode) {
|
|
3269
3271
|
if (!includeRemoved && otherNode.removed) {
|
|
3270
3272
|
continue;
|
|
@@ -3276,7 +3278,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3276
3278
|
if (!includeRemoved && outgoingConnection.removed) {
|
|
3277
3279
|
continue;
|
|
3278
3280
|
}
|
|
3279
|
-
const otherNode = (_b = outgoingConnection.end) === null || _b ===
|
|
3281
|
+
const otherNode = (_b = outgoingConnection.end) === null || _b === void 0 ? void 0 : _b.getNode();
|
|
3280
3282
|
if (otherNode) {
|
|
3281
3283
|
if (!includeRemoved && otherNode.removed) {
|
|
3282
3284
|
continue;
|
|
@@ -3295,7 +3297,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3295
3297
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3296
3298
|
let node = this;
|
|
3297
3299
|
while (node.parent !== undefined) {
|
|
3298
|
-
node = node === null || node ===
|
|
3300
|
+
node = node === null || node === void 0 ? void 0 : node.parent;
|
|
3299
3301
|
}
|
|
3300
3302
|
return node;
|
|
3301
3303
|
}
|
|
@@ -3606,7 +3608,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3606
3608
|
*/
|
|
3607
3609
|
removeSectionColumn(columnIndex) {
|
|
3608
3610
|
var _a;
|
|
3609
|
-
const margin = ((_a = this.type.sectionGrid) === null || _a ===
|
|
3611
|
+
const margin = ((_a = this.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
|
|
3610
3612
|
let columnWidth = 0;
|
|
3611
3613
|
const sections = [...this.sections];
|
|
3612
3614
|
for (const section of sections) {
|
|
@@ -3629,7 +3631,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3629
3631
|
*/
|
|
3630
3632
|
removeSectionRow(rowIndex) {
|
|
3631
3633
|
var _a;
|
|
3632
|
-
const margin = ((_a = this.type.sectionGrid) === null || _a ===
|
|
3634
|
+
const margin = ((_a = this.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
|
|
3633
3635
|
let rowHeight = 0;
|
|
3634
3636
|
const sections = [...this.sections];
|
|
3635
3637
|
for (const section of sections) {
|
|
@@ -3652,7 +3654,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3652
3654
|
*/
|
|
3653
3655
|
copySectionColumn(columnIndex) {
|
|
3654
3656
|
var _a;
|
|
3655
|
-
const margin = ((_a = this.type.sectionGrid) === null || _a ===
|
|
3657
|
+
const margin = ((_a = this.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
|
|
3656
3658
|
let columnWidth = 0;
|
|
3657
3659
|
const sections = [...this.sections];
|
|
3658
3660
|
for (const section of sections) {
|
|
@@ -3679,7 +3681,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3679
3681
|
*/
|
|
3680
3682
|
copySectionRow(rowIndex) {
|
|
3681
3683
|
var _a;
|
|
3682
|
-
const margin = ((_a = this.type.sectionGrid) === null || _a ===
|
|
3684
|
+
const margin = ((_a = this.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
|
|
3683
3685
|
let rowHeight = 0;
|
|
3684
3686
|
const sections = [...this.sections];
|
|
3685
3687
|
for (const section of sections) {
|
|
@@ -3745,10 +3747,10 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3745
3747
|
for (let j = 0; j < nodeType.sectionGrid.sections.length; ++j) {
|
|
3746
3748
|
let widthAccumulator = node.coords[0] + (nodeType.sectionGrid.margin || 0);
|
|
3747
3749
|
for (let i = 0; i < nodeType.sectionGrid.sections[j].length; ++i) {
|
|
3748
|
-
this.model.sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a ===
|
|
3749
|
-
widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c ===
|
|
3750
|
+
this.model.sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a === void 0 ? void 0 : _a[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH, ((_b = nodeType.sectionGrid.defaultHeights) === null || _b === void 0 ? void 0 : _b[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT, `${node.id}_${j}_${i}`);
|
|
3751
|
+
widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c === void 0 ? void 0 : _c[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH) + (nodeType.sectionGrid.margin || 0);
|
|
3750
3752
|
}
|
|
3751
|
-
heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d ===
|
|
3753
|
+
heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d === void 0 ? void 0 : _d[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT) + (nodeType.sectionGrid.margin || 0);
|
|
3752
3754
|
}
|
|
3753
3755
|
}
|
|
3754
3756
|
// add node ports
|
|
@@ -3757,8 +3759,8 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3757
3759
|
const portConfig = nodeType.ports[i];
|
|
3758
3760
|
const portType = portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined;
|
|
3759
3761
|
const port = this.model.ports.new(portType, node, [node.coords[0] + portConfig.coords[0], node.coords[1] + portConfig.coords[1]], portConfig.connectionPoint !== undefined ? [node.coords[0] + (portConfig.connectionPoint[0] || 0), node.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig.direction, `${node.id}_port_${i}`);
|
|
3760
|
-
if ((_e = port.type) === null || _e ===
|
|
3761
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f ===
|
|
3762
|
+
if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
|
|
3763
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
|
|
3762
3764
|
const labelWidth = 6 * labelConfiguration.fontSize + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
3763
3765
|
const labelHeight = labelConfiguration.fontSize + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
3764
3766
|
let labelCoords;
|
|
@@ -3774,14 +3776,14 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3774
3776
|
default:
|
|
3775
3777
|
labelCoords = port.coords;
|
|
3776
3778
|
}
|
|
3777
|
-
this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3779
|
+
this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3778
3780
|
}
|
|
3779
3781
|
}
|
|
3780
3782
|
}
|
|
3781
3783
|
// add node label
|
|
3782
3784
|
if (nodeType.label) {
|
|
3783
3785
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), nodeType.label);
|
|
3784
|
-
this.model.fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3786
|
+
this.model.fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3785
3787
|
}
|
|
3786
3788
|
// add node decorators
|
|
3787
3789
|
if (nodeType.decorators.length > 0) {
|
|
@@ -3791,7 +3793,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3791
3793
|
}
|
|
3792
3794
|
}
|
|
3793
3795
|
node.valueSet.resetValues();
|
|
3794
|
-
(_g = node.model.canvas) === null || _g ===
|
|
3796
|
+
(_g = node.model.canvas) === null || _g === void 0 ? void 0 : _g.fitNodeInView(node.id);
|
|
3795
3797
|
return node;
|
|
3796
3798
|
}
|
|
3797
3799
|
remove(id) {
|
|
@@ -3883,7 +3885,7 @@ const filterByOnlyDescendants = nodes => {
|
|
|
3883
3885
|
return nodes;
|
|
3884
3886
|
};
|
|
3885
3887
|
const getBottomPadding = config => {
|
|
3886
|
-
if ((config === null || config ===
|
|
3888
|
+
if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
|
|
3887
3889
|
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3888
3890
|
} else if (typeof config.padding === 'number') {
|
|
3889
3891
|
return config.padding;
|
|
@@ -3902,7 +3904,7 @@ const getBottomPadding = config => {
|
|
|
3902
3904
|
}
|
|
3903
3905
|
};
|
|
3904
3906
|
const getLeftPadding = config => {
|
|
3905
|
-
if ((config === null || config ===
|
|
3907
|
+
if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
|
|
3906
3908
|
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3907
3909
|
} else if (typeof config.padding === 'number') {
|
|
3908
3910
|
return config.padding;
|
|
@@ -3921,7 +3923,7 @@ const getLeftPadding = config => {
|
|
|
3921
3923
|
}
|
|
3922
3924
|
};
|
|
3923
3925
|
const getRightPadding = config => {
|
|
3924
|
-
if ((config === null || config ===
|
|
3926
|
+
if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
|
|
3925
3927
|
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3926
3928
|
} else if (typeof config.padding === 'number') {
|
|
3927
3929
|
return config.padding;
|
|
@@ -3940,7 +3942,7 @@ const getRightPadding = config => {
|
|
|
3940
3942
|
}
|
|
3941
3943
|
};
|
|
3942
3944
|
const getTopPadding = config => {
|
|
3943
|
-
if ((config === null || config ===
|
|
3945
|
+
if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
|
|
3944
3946
|
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3945
3947
|
} else if (typeof config.padding === 'number') {
|
|
3946
3948
|
return config.padding;
|
|
@@ -4029,7 +4031,7 @@ class DiagramPort extends DiagramElement {
|
|
|
4029
4031
|
}
|
|
4030
4032
|
get typeString() {
|
|
4031
4033
|
var _a;
|
|
4032
|
-
return (_a = this.type) === null || _a ===
|
|
4034
|
+
return (_a = this.type) === null || _a === void 0 ? void 0 : _a.id;
|
|
4033
4035
|
}
|
|
4034
4036
|
set typeString(typeString) {
|
|
4035
4037
|
if (typeString === undefined) {
|
|
@@ -4046,14 +4048,14 @@ class DiagramPort extends DiagramElement {
|
|
|
4046
4048
|
*/
|
|
4047
4049
|
get allowsOutgoing() {
|
|
4048
4050
|
var _a, _b;
|
|
4049
|
-
return ((_a = this.type) === null || _a ===
|
|
4051
|
+
return ((_a = this.type) === null || _a === void 0 ? void 0 : _a.allowsOutgoing) !== undefined ? (_b = this.type) === null || _b === void 0 ? void 0 : _b.allowsOutgoing : true;
|
|
4050
4052
|
}
|
|
4051
4053
|
/**
|
|
4052
4054
|
* Whether this port can be used as a connection end point.
|
|
4053
4055
|
*/
|
|
4054
4056
|
get allowsIncoming() {
|
|
4055
4057
|
var _a, _b;
|
|
4056
|
-
return ((_a = this.type) === null || _a ===
|
|
4058
|
+
return ((_a = this.type) === null || _a === void 0 ? void 0 : _a.allowsIncoming) !== undefined ? (_b = this.type) === null || _b === void 0 ? void 0 : _b.allowsIncoming : true;
|
|
4057
4059
|
}
|
|
4058
4060
|
/**
|
|
4059
4061
|
* Name of this port. Alias for this port's label's text.
|
|
@@ -4061,7 +4063,7 @@ class DiagramPort extends DiagramElement {
|
|
|
4061
4063
|
*/
|
|
4062
4064
|
get name() {
|
|
4063
4065
|
var _a;
|
|
4064
|
-
return ((_a = this.label) === null || _a ===
|
|
4066
|
+
return ((_a = this.label) === null || _a === void 0 ? void 0 : _a.text) || '';
|
|
4065
4067
|
}
|
|
4066
4068
|
set name(name) {
|
|
4067
4069
|
if (this.label) {
|
|
@@ -4076,15 +4078,15 @@ class DiagramPort extends DiagramElement {
|
|
|
4076
4078
|
var _a, _b, _c, _d;
|
|
4077
4079
|
if (this.selected) {
|
|
4078
4080
|
if (this.highlighted) {
|
|
4079
|
-
return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : (_a = this.type || DIAGRAM_PORT_LOOKS) === null || _a ===
|
|
4081
|
+
return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : (_a = this.type || DIAGRAM_PORT_LOOKS) === null || _a === void 0 ? void 0 : _a.selectedAndHighlightedLook;
|
|
4080
4082
|
} else {
|
|
4081
|
-
return this._selectedLook !== undefined ? this._selectedLook : (_b = this.type || DIAGRAM_PORT_LOOKS) === null || _b ===
|
|
4083
|
+
return this._selectedLook !== undefined ? this._selectedLook : (_b = this.type || DIAGRAM_PORT_LOOKS) === null || _b === void 0 ? void 0 : _b.selectedLook;
|
|
4082
4084
|
}
|
|
4083
4085
|
} else {
|
|
4084
4086
|
if (this.highlighted) {
|
|
4085
|
-
return this._highlightedLook !== undefined ? this._highlightedLook : (_c = this.type || DIAGRAM_PORT_LOOKS) === null || _c ===
|
|
4087
|
+
return this._highlightedLook !== undefined ? this._highlightedLook : (_c = this.type || DIAGRAM_PORT_LOOKS) === null || _c === void 0 ? void 0 : _c.highlightedLook;
|
|
4086
4088
|
} else {
|
|
4087
|
-
return this._defaultLook !== undefined ? this._defaultLook : (_d = this.type || DIAGRAM_PORT_LOOKS) === null || _d ===
|
|
4089
|
+
return this._defaultLook !== undefined ? this._defaultLook : (_d = this.type || DIAGRAM_PORT_LOOKS) === null || _d === void 0 ? void 0 : _d.defaultLook;
|
|
4088
4090
|
}
|
|
4089
4091
|
}
|
|
4090
4092
|
}
|
|
@@ -4113,7 +4115,7 @@ class DiagramPort extends DiagramElement {
|
|
|
4113
4115
|
*/
|
|
4114
4116
|
get width() {
|
|
4115
4117
|
var _a;
|
|
4116
|
-
return ((_a = this.type) === null || _a ===
|
|
4118
|
+
return ((_a = this.type) === null || _a === void 0 ? void 0 : _a.width) || DIAGRAM_PORT_TYPE_DEFAULTS.width;
|
|
4117
4119
|
}
|
|
4118
4120
|
/**
|
|
4119
4121
|
* Current height of this port. Same as the width.
|
|
@@ -4151,11 +4153,11 @@ class DiagramPort extends DiagramElement {
|
|
|
4151
4153
|
}
|
|
4152
4154
|
updateInView() {
|
|
4153
4155
|
var _a;
|
|
4154
|
-
(_a = this.model.canvas) === null || _a ===
|
|
4156
|
+
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updatePortsInView(this.id);
|
|
4155
4157
|
}
|
|
4156
4158
|
raise() {
|
|
4157
4159
|
var _a;
|
|
4158
|
-
(_a = this.select()) === null || _a ===
|
|
4160
|
+
(_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
|
|
4159
4161
|
if (this.label) {
|
|
4160
4162
|
this.label.raise();
|
|
4161
4163
|
}
|
|
@@ -4197,7 +4199,7 @@ class DiagramPort extends DiagramElement {
|
|
|
4197
4199
|
}
|
|
4198
4200
|
getPriority() {
|
|
4199
4201
|
var _a;
|
|
4200
|
-
return ((_a = this.rootElement) === null || _a ===
|
|
4202
|
+
return ((_a = this.rootElement) === null || _a === void 0 ? void 0 : _a.getPriority()) || DEFAULT_PRIORITY;
|
|
4201
4203
|
}
|
|
4202
4204
|
/**
|
|
4203
4205
|
* Change the coordinates of this port to the given coordinates and move its labels correspondingly.
|
|
@@ -4328,7 +4330,7 @@ class DagaImporter {
|
|
|
4328
4330
|
// add node label
|
|
4329
4331
|
if (newNodeType.label) {
|
|
4330
4332
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newNodeType.label);
|
|
4331
|
-
const newField = new DiagramField(model, newNode, [newNode.coords[0] + getLeftMargin(labelConfiguration), newNode.coords[1] + getTopMargin(labelConfiguration)], newNode.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newNode.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
4333
|
+
const newField = new DiagramField(model, newNode, [newNode.coords[0] + getLeftMargin(labelConfiguration), newNode.coords[1] + getTopMargin(labelConfiguration)], newNode.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newNode.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
4332
4334
|
newField.text = node.label;
|
|
4333
4335
|
newNode.label = newField;
|
|
4334
4336
|
model.fields.add(newField);
|
|
@@ -4338,19 +4340,19 @@ class DagaImporter {
|
|
|
4338
4340
|
for (const child of node.children || []) {
|
|
4339
4341
|
const newChild = this.importNode(model, child);
|
|
4340
4342
|
if (newChild !== undefined) {
|
|
4341
|
-
(_a = newNode.children) === null || _a ===
|
|
4343
|
+
(_a = newNode.children) === null || _a === void 0 ? void 0 : _a.push(newChild);
|
|
4342
4344
|
newChild.parent = newNode;
|
|
4343
4345
|
}
|
|
4344
4346
|
}
|
|
4345
4347
|
for (const section of node.sections || []) {
|
|
4346
4348
|
const newSection = new DiagramSection(model, newNode, section.indexXInNode, section.indexYInNode, section.coords, section.width, section.height, section.id);
|
|
4347
|
-
(_b = newNode.sections) === null || _b ===
|
|
4349
|
+
(_b = newNode.sections) === null || _b === void 0 ? void 0 : _b.push(newSection);
|
|
4348
4350
|
model.sections.add(newSection);
|
|
4349
4351
|
if (section.label) {
|
|
4350
4352
|
// add section label
|
|
4351
|
-
if ((_f = (_e = (_d = (_c = newNodeType.sectionGrid) === null || _c ===
|
|
4352
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_k = (_j = (_h = (_g = newNodeType.sectionGrid) === null || _g ===
|
|
4353
|
-
const newField = new DiagramField(model, newSection, [newSection.coords[0] + getLeftMargin(labelConfiguration), newSection.coords[1] + getTopMargin(labelConfiguration)], newSection.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newSection.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
4353
|
+
if ((_f = (_e = (_d = (_c = newNodeType.sectionGrid) === null || _c === void 0 ? void 0 : _c.sections) === null || _d === void 0 ? void 0 : _d[section.indexYInNode]) === null || _e === void 0 ? void 0 : _e[section.indexXInNode]) === null || _f === void 0 ? void 0 : _f.label) {
|
|
4354
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_k = (_j = (_h = (_g = newNodeType.sectionGrid) === null || _g === void 0 ? void 0 : _g.sections) === null || _h === void 0 ? void 0 : _h[section.indexYInNode]) === null || _j === void 0 ? void 0 : _j[section.indexXInNode]) === null || _k === void 0 ? void 0 : _k.label);
|
|
4355
|
+
const newField = new DiagramField(model, newSection, [newSection.coords[0] + getLeftMargin(labelConfiguration), newSection.coords[1] + getTopMargin(labelConfiguration)], newSection.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newSection.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
4354
4356
|
newField.text = section.label;
|
|
4355
4357
|
newSection.label = newField;
|
|
4356
4358
|
model.fields.add(newField);
|
|
@@ -4365,8 +4367,8 @@ class DagaImporter {
|
|
|
4365
4367
|
model.ports.add(newPort);
|
|
4366
4368
|
if (port.label) {
|
|
4367
4369
|
// add port label
|
|
4368
|
-
if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType ===
|
|
4369
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType ===
|
|
4370
|
+
if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === void 0 ? void 0 : newPortType.label)) {
|
|
4371
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === void 0 ? void 0 : newPortType.label);
|
|
4370
4372
|
let labelCoords;
|
|
4371
4373
|
switch (newPort.direction) {
|
|
4372
4374
|
case exports.Side.Top:
|
|
@@ -4382,7 +4384,7 @@ class DagaImporter {
|
|
|
4382
4384
|
default:
|
|
4383
4385
|
labelCoords = newPort.coords;
|
|
4384
4386
|
}
|
|
4385
|
-
const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
4387
|
+
const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
4386
4388
|
newField.text = port.label;
|
|
4387
4389
|
newPort.label = newField;
|
|
4388
4390
|
model.fields.add(newField);
|
|
@@ -4412,8 +4414,8 @@ class DagaImporter {
|
|
|
4412
4414
|
model.ports.add(newPort);
|
|
4413
4415
|
if (port.label) {
|
|
4414
4416
|
// add port label
|
|
4415
|
-
if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType ===
|
|
4416
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType ===
|
|
4417
|
+
if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === void 0 ? void 0 : newPortType.label)) {
|
|
4418
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === void 0 ? void 0 : newPortType.label);
|
|
4417
4419
|
let labelCoords;
|
|
4418
4420
|
switch (newPort.direction) {
|
|
4419
4421
|
case exports.Side.Top:
|
|
@@ -4429,7 +4431,7 @@ class DagaImporter {
|
|
|
4429
4431
|
default:
|
|
4430
4432
|
labelCoords = newPort.coords;
|
|
4431
4433
|
}
|
|
4432
|
-
const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
4434
|
+
const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
4433
4435
|
newField.text = port.label;
|
|
4434
4436
|
newPort.label = newField;
|
|
4435
4437
|
model.fields.add(newField);
|
|
@@ -4513,14 +4515,16 @@ class AddNodeCollabAction {
|
|
|
4513
4515
|
var _a;
|
|
4514
4516
|
const node = this.canvas.model.nodes.new(this.typeId, this.coords, this.id);
|
|
4515
4517
|
if (this.parentId !== undefined) {
|
|
4516
|
-
(_a = this.canvas.model.nodes.get(this.parentId)) === null || _a ===
|
|
4517
|
-
}
|
|
4518
|
-
if (this.values !== undefined) {
|
|
4519
|
-
node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
|
|
4518
|
+
(_a = this.canvas.model.nodes.get(this.parentId)) === null || _a === void 0 ? void 0 : _a.addChild(node);
|
|
4520
4519
|
}
|
|
4521
4520
|
if (node.label) {
|
|
4522
4521
|
node.label.text = this.label || '';
|
|
4523
4522
|
}
|
|
4523
|
+
if (this.values !== undefined) {
|
|
4524
|
+
node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
|
|
4525
|
+
} else {
|
|
4526
|
+
node.valueSet.resetValues();
|
|
4527
|
+
}
|
|
4524
4528
|
}
|
|
4525
4529
|
serialize() {
|
|
4526
4530
|
return {
|
|
@@ -4635,7 +4639,7 @@ class MoveCollabAction {
|
|
|
4635
4639
|
const node = this.canvas.model.nodes.get(nodeId, true);
|
|
4636
4640
|
if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
|
|
4637
4641
|
node.move([node.coords[0] + this.delta[0], node.coords[1] + this.delta[1]]);
|
|
4638
|
-
(_a = node.parent) === null || _a ===
|
|
4642
|
+
(_a = node.parent) === null || _a === void 0 ? void 0 : _a.fitToChild(node);
|
|
4639
4643
|
node.geometryTimestamp = this.timestamp;
|
|
4640
4644
|
}
|
|
4641
4645
|
}
|
|
@@ -4670,15 +4674,15 @@ class SetGeometryCollabAction {
|
|
|
4670
4674
|
if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
|
|
4671
4675
|
node.setGeometry(this.to);
|
|
4672
4676
|
// Re-fit the labels, in case their text has changed since `this.to` was measured.
|
|
4673
|
-
if ((_a = node.label) === null || _a ===
|
|
4677
|
+
if ((_a = node.label) === null || _a === void 0 ? void 0 : _a.fit) {
|
|
4674
4678
|
this.canvas.fitFieldRootInView(node.label.id);
|
|
4675
4679
|
}
|
|
4676
4680
|
for (const section of node.sections) {
|
|
4677
|
-
if ((_b = section.label) === null || _b ===
|
|
4681
|
+
if ((_b = section.label) === null || _b === void 0 ? void 0 : _b.fit) {
|
|
4678
4682
|
this.canvas.fitFieldRootInView(section.label.id);
|
|
4679
4683
|
}
|
|
4680
4684
|
}
|
|
4681
|
-
(_c = node.parent) === null || _c ===
|
|
4685
|
+
(_c = node.parent) === null || _c === void 0 ? void 0 : _c.fitToChild(node);
|
|
4682
4686
|
node.geometryTimestamp = this.timestamp;
|
|
4683
4687
|
}
|
|
4684
4688
|
}
|
|
@@ -4712,9 +4716,9 @@ class SetParentCollabAction {
|
|
|
4712
4716
|
const childNode = this.canvas.model.nodes.get(this.childId, true);
|
|
4713
4717
|
const parentNode = this.parentId !== undefined ? this.canvas.model.nodes.get(this.parentId, true) : undefined;
|
|
4714
4718
|
if (childNode && (this.parentId !== undefined ? parentNode : true) && timestampWins(this.timestamp, childNode.geometryTimestamp)) {
|
|
4715
|
-
(_a = childNode.parent) === null || _a ===
|
|
4719
|
+
(_a = childNode.parent) === null || _a === void 0 ? void 0 : _a.removeChild(childNode);
|
|
4716
4720
|
childNode.setGeometry(this.childGeometry);
|
|
4717
|
-
parentNode === null || parentNode ===
|
|
4721
|
+
parentNode === null || parentNode === void 0 ? void 0 : parentNode.addChild(childNode);
|
|
4718
4722
|
}
|
|
4719
4723
|
}
|
|
4720
4724
|
serialize() {
|
|
@@ -4811,12 +4815,12 @@ class UpdateValuesCollabAction {
|
|
|
4811
4815
|
if (this.id === undefined) {
|
|
4812
4816
|
return this.canvas.model.valueSet;
|
|
4813
4817
|
} else {
|
|
4814
|
-
return (_a = this.canvas.model.nodes.get(this.id, true) || this.canvas.model.connections.get(this.id, true)) === null || _a ===
|
|
4818
|
+
return (_a = this.canvas.model.nodes.get(this.id, true) || this.canvas.model.connections.get(this.id, true)) === null || _a === void 0 ? void 0 : _a.valueSet;
|
|
4815
4819
|
}
|
|
4816
4820
|
}
|
|
4817
4821
|
do() {
|
|
4818
4822
|
var _a;
|
|
4819
|
-
(_a = this.getValueSet()) === null || _a ===
|
|
4823
|
+
(_a = this.getValueSet()) === null || _a === void 0 ? void 0 : _a.overwriteValuesLww(this.to, this.timestamp);
|
|
4820
4824
|
}
|
|
4821
4825
|
serialize() {
|
|
4822
4826
|
return {
|
|
@@ -5816,11 +5820,11 @@ class DiagramDecorator extends DiagramElement {
|
|
|
5816
5820
|
}
|
|
5817
5821
|
updateInView() {
|
|
5818
5822
|
var _a;
|
|
5819
|
-
(_a = this.model.canvas) === null || _a ===
|
|
5823
|
+
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateDecoratorsInView(this.id);
|
|
5820
5824
|
}
|
|
5821
5825
|
raise() {
|
|
5822
5826
|
var _a;
|
|
5823
|
-
(_a = this.select()) === null || _a ===
|
|
5827
|
+
(_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
|
|
5824
5828
|
}
|
|
5825
5829
|
/**
|
|
5826
5830
|
* Change the coordinates of this decorator to the given coordinates.
|
|
@@ -5905,11 +5909,11 @@ class DiagramObject extends DiagramElement {
|
|
|
5905
5909
|
}
|
|
5906
5910
|
updateInView() {
|
|
5907
5911
|
var _a;
|
|
5908
|
-
(_a = this.model.canvas) === null || _a ===
|
|
5912
|
+
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateObjectsInView(this.id);
|
|
5909
5913
|
}
|
|
5910
5914
|
raise() {
|
|
5911
5915
|
var _a;
|
|
5912
|
-
(_a = this.select()) === null || _a ===
|
|
5916
|
+
(_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
|
|
5913
5917
|
}
|
|
5914
5918
|
/**
|
|
5915
5919
|
* Change the coordinates of this object to the given coordinates.
|
|
@@ -6026,7 +6030,7 @@ class DiagramModel {
|
|
|
6026
6030
|
*/
|
|
6027
6031
|
clear() {
|
|
6028
6032
|
var _a, _b;
|
|
6029
|
-
(_a = this.canvas) === null || _a ===
|
|
6033
|
+
(_a = this.canvas) === null || _a === void 0 ? void 0 : _a.cancelAllUserActions();
|
|
6030
6034
|
this.id = undefined;
|
|
6031
6035
|
this.name = '';
|
|
6032
6036
|
this.description = undefined;
|
|
@@ -6041,7 +6045,7 @@ class DiagramModel {
|
|
|
6041
6045
|
this.objects.clear();
|
|
6042
6046
|
this.decorators.clear();
|
|
6043
6047
|
this.valueSet.resetValues();
|
|
6044
|
-
(_b = this.canvas) === null || _b ===
|
|
6048
|
+
(_b = this.canvas) === null || _b === void 0 ? void 0 : _b.updateModelInView();
|
|
6045
6049
|
}
|
|
6046
6050
|
}
|
|
6047
6051
|
|
|
@@ -6107,7 +6111,6 @@ const updateLook = selection => {
|
|
|
6107
6111
|
selection.filter('.stretchable-image-look').select('image.bottom-right-image').attr('x', d => d.width - d.look.rightMargin).attr('y', d => d.height - d.look.bottomMargin).attr('width', d => d.look.rightMargin).attr('height', d => d.look.bottomMargin).attr('href', d => d.look.backgroundImageBottomRight);
|
|
6108
6112
|
};
|
|
6109
6113
|
const GRID_DEFAULTS = {
|
|
6110
|
-
enabled: true,
|
|
6111
6114
|
style: 'dots',
|
|
6112
6115
|
color: 'rgba(0, 0, 0, 0.1)',
|
|
6113
6116
|
snap: false,
|
|
@@ -6265,7 +6268,7 @@ class DiagramContextMenu {
|
|
|
6265
6268
|
*/
|
|
6266
6269
|
close() {
|
|
6267
6270
|
var _a;
|
|
6268
|
-
(_a = this.contextMenuContainer) === null || _a ===
|
|
6271
|
+
(_a = this.contextMenuContainer) === null || _a === void 0 ? void 0 : _a.remove();
|
|
6269
6272
|
this.contextMenuContainer = undefined;
|
|
6270
6273
|
}
|
|
6271
6274
|
}
|
|
@@ -6401,11 +6404,11 @@ class DagaExporter {
|
|
|
6401
6404
|
for (const port of section.ports) {
|
|
6402
6405
|
ports.push(Object.assign({
|
|
6403
6406
|
id: port.id,
|
|
6404
|
-
type: (_a = port.type) === null || _a ===
|
|
6407
|
+
type: (_a = port.type) === null || _a === void 0 ? void 0 : _a.id,
|
|
6405
6408
|
coords: roundPoint(port.coords),
|
|
6406
6409
|
connectionPoint: roundPoint(port.connectionPoint),
|
|
6407
6410
|
direction: port.direction,
|
|
6408
|
-
label: ((_b = port.label) === null || _b ===
|
|
6411
|
+
label: ((_b = port.label) === null || _b === void 0 ? void 0 : _b.text) || ''
|
|
6409
6412
|
}, includeCollabMeta ? {
|
|
6410
6413
|
collabMeta: Object.assign({
|
|
6411
6414
|
removed: port.removed,
|
|
@@ -6417,7 +6420,7 @@ class DagaExporter {
|
|
|
6417
6420
|
sections.push(Object.assign({
|
|
6418
6421
|
id: section.id,
|
|
6419
6422
|
ports,
|
|
6420
|
-
label: ((_c = section.label) === null || _c ===
|
|
6423
|
+
label: ((_c = section.label) === null || _c === void 0 ? void 0 : _c.text) || '',
|
|
6421
6424
|
indexXInNode: section.indexXInNode,
|
|
6422
6425
|
indexYInNode: section.indexYInNode,
|
|
6423
6426
|
coords: roundPoint(section.coords),
|
|
@@ -6435,11 +6438,11 @@ class DagaExporter {
|
|
|
6435
6438
|
for (const port of node.ports) {
|
|
6436
6439
|
ports.push(Object.assign({
|
|
6437
6440
|
id: port.id,
|
|
6438
|
-
type: (_d = port.type) === null || _d ===
|
|
6441
|
+
type: (_d = port.type) === null || _d === void 0 ? void 0 : _d.id,
|
|
6439
6442
|
coords: roundPoint(port.coords),
|
|
6440
6443
|
connectionPoint: roundPoint(port.connectionPoint),
|
|
6441
6444
|
direction: port.direction,
|
|
6442
|
-
label: ((_e = port.label) === null || _e ===
|
|
6445
|
+
label: ((_e = port.label) === null || _e === void 0 ? void 0 : _e.text) || ''
|
|
6443
6446
|
}, includeCollabMeta ? {
|
|
6444
6447
|
collabMeta: Object.assign({
|
|
6445
6448
|
removed: port.removed,
|
|
@@ -6454,7 +6457,7 @@ class DagaExporter {
|
|
|
6454
6457
|
children,
|
|
6455
6458
|
sections,
|
|
6456
6459
|
ports,
|
|
6457
|
-
label: ((_f = node.label) === null || _f ===
|
|
6460
|
+
label: ((_f = node.label) === null || _f === void 0 ? void 0 : _f.text) || '',
|
|
6458
6461
|
coords: roundPoint(node.coords),
|
|
6459
6462
|
width: node.width,
|
|
6460
6463
|
height: node.height,
|
|
@@ -6474,8 +6477,8 @@ class DagaExporter {
|
|
|
6474
6477
|
return Object.assign({
|
|
6475
6478
|
id: connection.id,
|
|
6476
6479
|
type: connection.type.id,
|
|
6477
|
-
start: ((_a = connection.start) === null || _a ===
|
|
6478
|
-
end: ((_b = connection.end) === null || _b ===
|
|
6480
|
+
start: ((_a = connection.start) === null || _a === void 0 ? void 0 : _a.id) || '',
|
|
6481
|
+
end: ((_b = connection.end) === null || _b === void 0 ? void 0 : _b.id) || '',
|
|
6479
6482
|
startLabel: connection.startLabel,
|
|
6480
6483
|
middleLabel: connection.middleLabel,
|
|
6481
6484
|
endLabel: connection.endLabel,
|
|
@@ -6695,11 +6698,11 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
6695
6698
|
openInPropertyEditor(selection) {
|
|
6696
6699
|
var _a;
|
|
6697
6700
|
this.makeUpdateValuesAction();
|
|
6698
|
-
const propertyEditor = (_a = this.canvas.parentComponent) === null || _a ===
|
|
6701
|
+
const propertyEditor = (_a = this.canvas.parentComponent) === null || _a === void 0 ? void 0 : _a.propertyEditor;
|
|
6699
6702
|
if (propertyEditor === undefined) {
|
|
6700
6703
|
return;
|
|
6701
6704
|
}
|
|
6702
|
-
const selectedValueSet = selection === null || selection ===
|
|
6705
|
+
const selectedValueSet = selection === null || selection === void 0 ? void 0 : selection.valueSet;
|
|
6703
6706
|
if (selectedValueSet) {
|
|
6704
6707
|
this.propertyEditorSelection = selection;
|
|
6705
6708
|
this.propertyEditorValues = structuredClone(selectedValueSet.getValues());
|
|
@@ -6741,12 +6744,12 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
6741
6744
|
const previousSelectionId = this.propertyEditorSelection instanceof DiagramModel ? undefined : this.propertyEditorSelection.id;
|
|
6742
6745
|
// check if there have been changes in the previously selected ValueSet,
|
|
6743
6746
|
// and create an UpdateValuesAction if there have
|
|
6744
|
-
if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a ===
|
|
6747
|
+
if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a === void 0 ? void 0 : _a.valueSet.getValues())) {
|
|
6745
6748
|
return;
|
|
6746
6749
|
}
|
|
6747
6750
|
const from = this.propertyEditorValues;
|
|
6748
|
-
const to = structuredClone((_b = this.propertyEditorSelection) === null || _b ===
|
|
6749
|
-
const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c ===
|
|
6751
|
+
const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
|
|
6752
|
+
const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === void 0 ? void 0 : _c.valueSet);
|
|
6750
6753
|
const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
|
|
6751
6754
|
currentAction.do();
|
|
6752
6755
|
this.canvas.actionStack.add(currentAction);
|
|
@@ -6780,7 +6783,7 @@ class DiagramCanvas {
|
|
|
6780
6783
|
var _a, _b;
|
|
6781
6784
|
this._connectionType = value;
|
|
6782
6785
|
// refresh the palette every time connectionType is set so that the palette keeps track of updates to the connectionType
|
|
6783
|
-
(_b = (_a = this.parentComponent) === null || _a ===
|
|
6786
|
+
(_b = (_a = this.parentComponent) === null || _a === void 0 ? void 0 : _a.palette) === null || _b === void 0 ? void 0 : _b.refreshPalette();
|
|
6784
6787
|
}
|
|
6785
6788
|
/**
|
|
6786
6789
|
* Constructs a canvas object.
|
|
@@ -6806,18 +6809,18 @@ class DiagramCanvas {
|
|
|
6806
6809
|
this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
|
|
6807
6810
|
this.userSelection = new DiagramUserSelection(this);
|
|
6808
6811
|
this.userHighlight = new DiagramUserHighlight(this);
|
|
6809
|
-
this.contextMenu = new DiagramContextMenu(this, (_a = config.canvas) === null || _a ===
|
|
6810
|
-
this.backgroundColor = ((_b = config.canvas) === null || _b ===
|
|
6811
|
-
this.gridStyle = (_e = (_d = (_c = config.canvas) === null || _c ===
|
|
6812
|
-
this.gridSize = ((_g = (_f = config.canvas) === null || _f ===
|
|
6813
|
-
this.gridThickness = Math.abs(((_m = (_l = config.canvas) === null || _l ===
|
|
6814
|
-
this.gridColor = ((_p = (_o = config.canvas) === null || _o ===
|
|
6815
|
-
this.snapToGrid = ((_r = (_q = config.canvas) === null || _q ===
|
|
6816
|
-
this.zoomFactor = ((_v = config.canvas) === null || _v ===
|
|
6817
|
-
this.panRate = ((_w = config.canvas) === null || _w ===
|
|
6812
|
+
this.contextMenu = new DiagramContextMenu(this, (_a = config.canvas) === null || _a === void 0 ? void 0 : _a.contextMenu);
|
|
6813
|
+
this.backgroundColor = ((_b = config.canvas) === null || _b === void 0 ? void 0 : _b.backgroundColor) || '#FFFFFF';
|
|
6814
|
+
this.gridStyle = (_e = (_d = (_c = config.canvas) === null || _c === void 0 ? void 0 : _c.grid) === null || _d === void 0 ? void 0 : _d.style) !== null && _e !== void 0 ? _e : GRID_DEFAULTS.style;
|
|
6815
|
+
this.gridSize = ((_g = (_f = config.canvas) === null || _f === void 0 ? void 0 : _f.grid) === null || _g === void 0 ? void 0 : _g.enabled) === false || ((_h = config.canvas) === null || _h === void 0 ? void 0 : _h.grid) === undefined ? 0 : Math.abs(((_k = (_j = config.canvas) === null || _j === void 0 ? void 0 : _j.grid) === null || _k === void 0 ? void 0 : _k.spacing) || GRID_DEFAULTS.spacing);
|
|
6816
|
+
this.gridThickness = Math.abs(((_m = (_l = config.canvas) === null || _l === void 0 ? void 0 : _l.grid) === null || _m === void 0 ? void 0 : _m.thickness) || GRID_DEFAULTS.thickness);
|
|
6817
|
+
this.gridColor = ((_p = (_o = config.canvas) === null || _o === void 0 ? void 0 : _o.grid) === null || _p === void 0 ? void 0 : _p.color) || GRID_DEFAULTS.color;
|
|
6818
|
+
this.snapToGrid = ((_r = (_q = config.canvas) === null || _q === void 0 ? void 0 : _q.grid) === null || _r === void 0 ? void 0 : _r.enabled) === false || ((_s = config.canvas) === null || _s === void 0 ? void 0 : _s.grid) === undefined ? false : ((_u = (_t = config.canvas) === null || _t === void 0 ? void 0 : _t.grid) === null || _u === void 0 ? void 0 : _u.snap) || GRID_DEFAULTS.snap;
|
|
6819
|
+
this.zoomFactor = ((_v = config.canvas) === null || _v === void 0 ? void 0 : _v.zoomFactor) || 2;
|
|
6820
|
+
this.panRate = ((_w = config.canvas) === null || _w === void 0 ? void 0 : _w.panRate) || 100;
|
|
6818
6821
|
this.inferConnectionType = config.inferConnectionType || false;
|
|
6819
6822
|
this.multipleSelectionOn = false;
|
|
6820
|
-
this.priorityThresholds = ((_x = config.canvas) === null || _x ===
|
|
6823
|
+
this.priorityThresholds = ((_x = config.canvas) === null || _x === void 0 ? void 0 : _x.priorityThresholds) || [];
|
|
6821
6824
|
this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
|
|
6822
6825
|
this.layoutFormat = config.layoutFormat;
|
|
6823
6826
|
this.userActions = config.userActions || {};
|
|
@@ -6868,7 +6871,7 @@ class DiagramCanvas {
|
|
|
6868
6871
|
for (const node of this.model.nodes) {
|
|
6869
6872
|
this.fitNodeInView(node.id);
|
|
6870
6873
|
}
|
|
6871
|
-
(_b = (_a = this.parentComponent) === null || _a ===
|
|
6874
|
+
(_b = (_a = this.parentComponent) === null || _a === void 0 ? void 0 : _a.palette) === null || _b === void 0 ? void 0 : _b.refreshPalette();
|
|
6872
6875
|
}
|
|
6873
6876
|
// View methods
|
|
6874
6877
|
initView(appendTo) {
|
|
@@ -6882,7 +6885,7 @@ class DiagramCanvas {
|
|
|
6882
6885
|
var _a;
|
|
6883
6886
|
// focus on the diagram when clicking so that we can focus on the diagram
|
|
6884
6887
|
// keyboard events only work if we're focusing on the diagram
|
|
6885
|
-
(_a = d3__namespace.select(this.diagramRoot).node()) === null || _a ===
|
|
6888
|
+
(_a = d3__namespace.select(this.diagramRoot).node()) === null || _a === void 0 ? void 0 : _a.focus();
|
|
6886
6889
|
}).on(exports.Events.ContextMenu, event => {
|
|
6887
6890
|
if (this.dragging) {
|
|
6888
6891
|
event.preventDefault();
|
|
@@ -7105,7 +7108,7 @@ class DiagramCanvas {
|
|
|
7105
7108
|
var _a;
|
|
7106
7109
|
// if there are no nodes, we have nothing to do here
|
|
7107
7110
|
if (this.model.nodes.length > 0) {
|
|
7108
|
-
const canvasViewBoundingBox = (_a = this.selectCanvasView().select('rect').node()) === null || _a ===
|
|
7111
|
+
const canvasViewBoundingBox = (_a = this.selectCanvasView().select('rect').node()) === null || _a === void 0 ? void 0 : _a.getBBox();
|
|
7109
7112
|
const nonRemovedNodes = this.model.nodes.all();
|
|
7110
7113
|
const minimumX = Math.min(...nonRemovedNodes.map(n => n.coords[0]));
|
|
7111
7114
|
const maximumX = Math.max(...nonRemovedNodes.map(n => n.coords[0] + n.width));
|
|
@@ -7137,8 +7140,8 @@ class DiagramCanvas {
|
|
|
7137
7140
|
}
|
|
7138
7141
|
getCoordinatesOnScreen() {
|
|
7139
7142
|
var _a;
|
|
7140
|
-
const rootBoundingClientRect = (_a = this.selectSVGElement().node()) === null || _a ===
|
|
7141
|
-
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect ===
|
|
7143
|
+
const rootBoundingClientRect = (_a = this.selectSVGElement().node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
7144
|
+
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.height) || 0];
|
|
7142
7145
|
return [[-this.zoomTransform.x / this.zoomTransform.k, -this.zoomTransform.y / this.zoomTransform.k], [(rootDimensions[0] - this.zoomTransform.x) / this.zoomTransform.k, (rootDimensions[1] - this.zoomTransform.y) / this.zoomTransform.k]];
|
|
7143
7146
|
}
|
|
7144
7147
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -7393,7 +7396,7 @@ class DiagramCanvas {
|
|
|
7393
7396
|
const exitSelection = updateSelection.exit();
|
|
7394
7397
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
|
|
7395
7398
|
var _a, _b, _c, _d, _e;
|
|
7396
|
-
return `diagram-section${((_b = (_a = d.node) === null || _a ===
|
|
7399
|
+
return `diagram-section${((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) ? ' resizable-x' : ''}${((_d = (_c = d.node) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.resizableY) ? ' resizable-y' : ''} ${(_e = d.look) === null || _e === void 0 ? void 0 : _e.lookType}`;
|
|
7397
7400
|
});
|
|
7398
7401
|
if (ids && ids.length > 0) {
|
|
7399
7402
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
@@ -7442,7 +7445,7 @@ class DiagramCanvas {
|
|
|
7442
7445
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
7443
7446
|
this.startMultipleSelection(event);
|
|
7444
7447
|
} else {
|
|
7445
|
-
const node = d === null || d ===
|
|
7448
|
+
const node = d === null || d === void 0 ? void 0 : d.node;
|
|
7446
7449
|
if (node) {
|
|
7447
7450
|
this.startMovingNode(event, node);
|
|
7448
7451
|
} else {
|
|
@@ -7453,7 +7456,7 @@ class DiagramCanvas {
|
|
|
7453
7456
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
7454
7457
|
this.continueMultipleSelection(event);
|
|
7455
7458
|
} else {
|
|
7456
|
-
const node = d === null || d ===
|
|
7459
|
+
const node = d === null || d === void 0 ? void 0 : d.node;
|
|
7457
7460
|
if (node) {
|
|
7458
7461
|
this.continueMovingNode(event, node);
|
|
7459
7462
|
} else {
|
|
@@ -7464,7 +7467,7 @@ class DiagramCanvas {
|
|
|
7464
7467
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
7465
7468
|
this.finishMultipleSelection(event);
|
|
7466
7469
|
} else {
|
|
7467
|
-
const node = d === null || d ===
|
|
7470
|
+
const node = d === null || d === void 0 ? void 0 : d.node;
|
|
7468
7471
|
if (node) {
|
|
7469
7472
|
this.finishMovingNode(event, node);
|
|
7470
7473
|
} else {
|
|
@@ -7476,17 +7479,17 @@ class DiagramCanvas {
|
|
|
7476
7479
|
initializeLook(enterSelection);
|
|
7477
7480
|
enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
|
|
7478
7481
|
var _a, _b;
|
|
7479
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7482
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
|
|
7480
7483
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
7481
7484
|
}
|
|
7482
7485
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
7483
7486
|
var _a, _b;
|
|
7484
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7487
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
|
|
7485
7488
|
setCursorStyle();
|
|
7486
7489
|
}
|
|
7487
7490
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
7488
7491
|
var _a, _b;
|
|
7489
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7492
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
|
|
7490
7493
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
7491
7494
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
7492
7495
|
} else {
|
|
@@ -7494,13 +7497,13 @@ class DiagramCanvas {
|
|
|
7494
7497
|
}
|
|
7495
7498
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
7496
7499
|
var _a, _b;
|
|
7497
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7500
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
|
|
7498
7501
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7499
7502
|
d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
7500
7503
|
}
|
|
7501
7504
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
7502
7505
|
var _a, _b;
|
|
7503
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7506
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection) {
|
|
7504
7507
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7505
7508
|
if (this.snapToGrid) {
|
|
7506
7509
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -7515,17 +7518,17 @@ class DiagramCanvas {
|
|
|
7515
7518
|
}));
|
|
7516
7519
|
enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
|
|
7517
7520
|
var _a, _b;
|
|
7518
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7521
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
|
|
7519
7522
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
7520
7523
|
}
|
|
7521
7524
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
7522
7525
|
var _a, _b;
|
|
7523
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7526
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
|
|
7524
7527
|
setCursorStyle();
|
|
7525
7528
|
}
|
|
7526
7529
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
7527
7530
|
var _a, _b;
|
|
7528
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7531
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
|
|
7529
7532
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
7530
7533
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
7531
7534
|
} else {
|
|
@@ -7533,13 +7536,13 @@ class DiagramCanvas {
|
|
|
7533
7536
|
}
|
|
7534
7537
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
7535
7538
|
var _a, _b;
|
|
7536
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7539
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
|
|
7537
7540
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7538
7541
|
d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
7539
7542
|
}
|
|
7540
7543
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
7541
7544
|
var _a, _b;
|
|
7542
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7545
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection) {
|
|
7543
7546
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7544
7547
|
if (this.snapToGrid) {
|
|
7545
7548
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -7554,17 +7557,17 @@ class DiagramCanvas {
|
|
|
7554
7557
|
}));
|
|
7555
7558
|
enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
|
|
7556
7559
|
var _a, _b;
|
|
7557
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7560
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
|
|
7558
7561
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
7559
7562
|
}
|
|
7560
7563
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
7561
7564
|
var _a, _b;
|
|
7562
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7565
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
|
|
7563
7566
|
setCursorStyle();
|
|
7564
7567
|
}
|
|
7565
7568
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
7566
7569
|
var _a, _b;
|
|
7567
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7570
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
|
|
7568
7571
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
7569
7572
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
7570
7573
|
} else {
|
|
@@ -7572,13 +7575,13 @@ class DiagramCanvas {
|
|
|
7572
7575
|
}
|
|
7573
7576
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
7574
7577
|
var _a, _b;
|
|
7575
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7578
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
|
|
7576
7579
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7577
7580
|
d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
7578
7581
|
}
|
|
7579
7582
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
7580
7583
|
var _a, _b;
|
|
7581
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7584
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection) {
|
|
7582
7585
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7583
7586
|
if (this.snapToGrid) {
|
|
7584
7587
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -7593,17 +7596,17 @@ class DiagramCanvas {
|
|
|
7593
7596
|
}));
|
|
7594
7597
|
enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
|
|
7595
7598
|
var _a, _b;
|
|
7596
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7599
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
|
|
7597
7600
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
7598
7601
|
}
|
|
7599
7602
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
7600
7603
|
var _a, _b;
|
|
7601
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7604
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
|
|
7602
7605
|
setCursorStyle();
|
|
7603
7606
|
}
|
|
7604
7607
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
7605
7608
|
var _a, _b;
|
|
7606
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7609
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
|
|
7607
7610
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
7608
7611
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
7609
7612
|
} else {
|
|
@@ -7611,13 +7614,13 @@ class DiagramCanvas {
|
|
|
7611
7614
|
}
|
|
7612
7615
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
7613
7616
|
var _a, _b;
|
|
7614
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7617
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
|
|
7615
7618
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7616
7619
|
d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
7617
7620
|
}
|
|
7618
7621
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
7619
7622
|
var _a, _b;
|
|
7620
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
7623
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection) {
|
|
7621
7624
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7622
7625
|
if (this.snapToGrid) {
|
|
7623
7626
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -7656,13 +7659,13 @@ class DiagramCanvas {
|
|
|
7656
7659
|
if (this.unfinishedConnection) {
|
|
7657
7660
|
const canConnectionFinishAtThisPort =
|
|
7658
7661
|
// can start at the starting port
|
|
7659
|
-
this.unfinishedConnection.type.canStartFromType(((_c = (_b = (_a = this.unfinishedConnection.start) === null || _a ===
|
|
7662
|
+
this.unfinishedConnection.type.canStartFromType(((_c = (_b = (_a = this.unfinishedConnection.start) === null || _a === void 0 ? void 0 : _a.getNode()) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) || '') && ((_d = this.unfinishedConnection.start) === null || _d === void 0 ? void 0 : _d.allowsOutgoing) &&
|
|
7660
7663
|
// can end at the ending port
|
|
7661
|
-
this.unfinishedConnection.type.canFinishOnType(((_f = (_e = d.getNode()) === null || _e ===
|
|
7664
|
+
this.unfinishedConnection.type.canFinishOnType(((_f = (_e = d.getNode()) === null || _e === void 0 ? void 0 : _e.type) === null || _f === void 0 ? void 0 : _f.id) || '') && d.allowsIncoming ||
|
|
7662
7665
|
// can start at the ending port
|
|
7663
|
-
this.unfinishedConnection.type.canStartFromType(((_h = (_g = d.getNode()) === null || _g ===
|
|
7666
|
+
this.unfinishedConnection.type.canStartFromType(((_h = (_g = d.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && d.allowsOutgoing &&
|
|
7664
7667
|
// can end at the starting port
|
|
7665
|
-
this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = this.unfinishedConnection.start) === null || _j ===
|
|
7668
|
+
this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = this.unfinishedConnection.start) === null || _j === void 0 ? void 0 : _j.getNode()) === null || _k === void 0 ? void 0 : _k.type) === null || _l === void 0 ? void 0 : _l.id) || '') && ((_m = this.unfinishedConnection.start) === null || _m === void 0 ? void 0 : _m.allowsIncoming);
|
|
7666
7669
|
if (!canConnectionFinishAtThisPort) {
|
|
7667
7670
|
setCursorStyle(exports.CursorStyle.NoDrop);
|
|
7668
7671
|
}
|
|
@@ -7727,8 +7730,8 @@ class DiagramCanvas {
|
|
|
7727
7730
|
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
|
|
7728
7731
|
if (this.unfinishedConnection !== undefined) {
|
|
7729
7732
|
const endCoords = [event.x, event.y];
|
|
7730
|
-
(_a = this.unfinishedConnectionTracer) === null || _a ===
|
|
7731
|
-
const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d ===
|
|
7733
|
+
(_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.look.thickness, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === void 0 ? void 0 : _c.width));
|
|
7734
|
+
const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === void 0 ? void 0 : _d.node();
|
|
7732
7735
|
if (unfinishedConnectionGhostNode) {
|
|
7733
7736
|
let margin = 2;
|
|
7734
7737
|
const unfinishedConnectionTotalLength = unfinishedConnectionGhostNode.getTotalLength();
|
|
@@ -7769,7 +7772,7 @@ class DiagramCanvas {
|
|
|
7769
7772
|
this.finishMultipleSelection(event);
|
|
7770
7773
|
} else {
|
|
7771
7774
|
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
|
|
7772
|
-
(_a = this.unfinishedConnectionTracer) === null || _a ===
|
|
7775
|
+
(_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.remove();
|
|
7773
7776
|
const userHighlight = this.userHighlight.getFocus();
|
|
7774
7777
|
if (userHighlight instanceof DiagramPort) {
|
|
7775
7778
|
this.finishConnection(userHighlight);
|
|
@@ -7875,11 +7878,11 @@ class DiagramCanvas {
|
|
|
7875
7878
|
enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
|
|
7876
7879
|
mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
|
|
7877
7880
|
var _a, _b;
|
|
7878
|
-
return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a ===
|
|
7881
|
+
return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
7879
7882
|
}).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color).attr('stroke-width', d => `${d.look.thickness}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style, d.look.thickness)).attr('fill', 'none');
|
|
7880
7883
|
mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
|
|
7881
7884
|
var _a, _b;
|
|
7882
|
-
return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a ===
|
|
7885
|
+
return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
7883
7886
|
}).attr('stroke', 'transparent')
|
|
7884
7887
|
// allow generating pointer events even when it is transparent
|
|
7885
7888
|
.attr('pointer-events', 'stroke').attr('stroke-width', d => `${d.look.thickness + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style, d.look.thickness)).attr('fill', 'none');
|
|
@@ -7934,8 +7937,12 @@ class DiagramCanvas {
|
|
|
7934
7937
|
this.diagramEvent$.next(diagramEvent);
|
|
7935
7938
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.EditField) && d.editable && !d.removed) {
|
|
7936
7939
|
this.currentAction = new EditFieldAction(this, d.id, d.text, '');
|
|
7937
|
-
this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, text => {
|
|
7938
|
-
|
|
7940
|
+
this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, d.orientation, text => {
|
|
7941
|
+
/*
|
|
7942
|
+
Empty for now
|
|
7943
|
+
We should create a better function to stretch the root element as the text expands
|
|
7944
|
+
Bear in mind that DiagramNode.setGeometry() calls DiagramNode.raise(), which breaks the input field
|
|
7945
|
+
*/
|
|
7939
7946
|
}, text => {
|
|
7940
7947
|
d.text = text;
|
|
7941
7948
|
if (this.currentAction instanceof EditFieldAction) {
|
|
@@ -7999,7 +8006,24 @@ class DiagramCanvas {
|
|
|
7999
8006
|
}
|
|
8000
8007
|
this.secondaryButton = false;
|
|
8001
8008
|
})).append('xhtml:div').style('width', '100%').style('height', '100%').style('display', 'flex').append('xhtml:p').style('box-sizing', 'border-box').style('outline', 0).style('margin', 0).style('border', 0).style('padding', 0).style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
|
|
8002
|
-
mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'center' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === exports.VerticalAlign.Center ? 'center' : d.verticalAlign === exports.VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : '100%').style('max-height', d => d.fit ? 'default' : '100%').style('overflow', d => d.fit ? 'default' : 'hidden').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'center' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'end' : 'start').style('
|
|
8009
|
+
mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'center' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === exports.VerticalAlign.Center ? 'center' : d.verticalAlign === exports.VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : '100%').style('max-height', d => d.fit ? 'default' : '100%').style('overflow', d => d.fit ? 'default' : 'hidden').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'center' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'end' : 'start').style('transform', d => {
|
|
8010
|
+
if (!isNaN(Number(d.orientation))) {
|
|
8011
|
+
return `rotate(${d.orientation}deg)`;
|
|
8012
|
+
} else {
|
|
8013
|
+
switch (d.orientation) {
|
|
8014
|
+
case exports.Side.Top:
|
|
8015
|
+
return 'rotate(0deg)';
|
|
8016
|
+
case exports.Side.Right:
|
|
8017
|
+
return 'rotate(90deg)';
|
|
8018
|
+
case exports.Side.Bottom:
|
|
8019
|
+
return 'rotate(180deg)';
|
|
8020
|
+
case exports.Side.Left:
|
|
8021
|
+
return 'rotate(270deg)';
|
|
8022
|
+
default:
|
|
8023
|
+
return 'rotate(0deg)';
|
|
8024
|
+
}
|
|
8025
|
+
}
|
|
8026
|
+
}).style('font-size', d => `${d.fontSize}px`).style('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").style('font-weight', d => d.highlighted ? 600 : 400).style('color', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').html(d => d.text.replace(/</g, '<').replace(/>/g, '>').replace(/\n/g, '<br/>'));
|
|
8003
8027
|
}
|
|
8004
8028
|
updateObjectsInView(...ids) {
|
|
8005
8029
|
let updateSelection = this.selectCanvasElements().selectAll('foreignObject.diagram-object').data(this.model.objects.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
@@ -8157,7 +8181,7 @@ class DiagramCanvas {
|
|
|
8157
8181
|
const pathLength = pathNode.getTotalLength();
|
|
8158
8182
|
// bind start labels
|
|
8159
8183
|
connectionSelection.select('g.diagram-connection-start-label text').attr('x', 0).attr('y', labelConfiguration.fontSize / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.fontFamily).attr('font-size', labelConfiguration.fontSize).attr('fill', connection.selected ? labelConfiguration.selectedColor : labelConfiguration.color).style('font-kerning', 'none').text(connection.startLabel);
|
|
8160
|
-
const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a ===
|
|
8184
|
+
const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
8161
8185
|
if (startLabelBoundingRect) {
|
|
8162
8186
|
// don't create space for the label if the label is empty
|
|
8163
8187
|
const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
@@ -8168,7 +8192,7 @@ class DiagramCanvas {
|
|
|
8168
8192
|
}
|
|
8169
8193
|
// bind middle labels
|
|
8170
8194
|
connectionSelection.select('g.diagram-connection-middle-label text').attr('x', 0).attr('y', labelConfiguration.fontSize / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.fontFamily).attr('font-size', labelConfiguration.fontSize).attr('fill', connection.selected ? labelConfiguration.selectedColor : labelConfiguration.color).style('font-kerning', 'none').text(connection.middleLabel);
|
|
8171
|
-
const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b ===
|
|
8195
|
+
const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
8172
8196
|
if (middleLabelBoundingRect) {
|
|
8173
8197
|
// don't create space for the label if the label is empty
|
|
8174
8198
|
const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
@@ -8179,7 +8203,7 @@ class DiagramCanvas {
|
|
|
8179
8203
|
}
|
|
8180
8204
|
// bind end labels
|
|
8181
8205
|
connectionSelection.select('g.diagram-connection-end-label text').attr('x', 0).attr('y', labelConfiguration.fontSize / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.fontFamily).attr('font-size', labelConfiguration.fontSize).attr('fill', connection.selected ? labelConfiguration.selectedColor : labelConfiguration.color).style('font-kerning', 'none').text(connection.endLabel);
|
|
8182
|
-
const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c ===
|
|
8206
|
+
const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
8183
8207
|
if (endLabelBoundingRect) {
|
|
8184
8208
|
// don't create space for the label if the label is empty
|
|
8185
8209
|
const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
@@ -8213,8 +8237,8 @@ class DiagramCanvas {
|
|
|
8213
8237
|
}
|
|
8214
8238
|
if (field.rootElement instanceof DiagramNode || field.rootElement instanceof DiagramSection) {
|
|
8215
8239
|
const fieldDimensions = this.minimumSizeOfField(field);
|
|
8216
|
-
const stretchX = fieldDimensions[0] + getLeftMargin((_a = field.rootElement.type) === null || _a ===
|
|
8217
|
-
const stretchY = fieldDimensions[1] + getTopMargin((_c = field.rootElement.type) === null || _c ===
|
|
8240
|
+
const stretchX = fieldDimensions[0] + getLeftMargin((_a = field.rootElement.type) === null || _a === void 0 ? void 0 : _a.label) + getRightMargin((_b = field.rootElement.type) === null || _b === void 0 ? void 0 : _b.label) - field.rootElement.width;
|
|
8241
|
+
const stretchY = fieldDimensions[1] + getTopMargin((_c = field.rootElement.type) === null || _c === void 0 ? void 0 : _c.label) + getBottomMargin((_d = field.rootElement.type) === null || _d === void 0 ? void 0 : _d.label) - field.rootElement.height;
|
|
8218
8242
|
return stretchX <= 0 && stretchY <= 0;
|
|
8219
8243
|
}
|
|
8220
8244
|
return true;
|
|
@@ -8251,7 +8275,7 @@ class DiagramCanvas {
|
|
|
8251
8275
|
const fieldDimensions = this.minimumSizeOfField(field);
|
|
8252
8276
|
let minimumFieldWidth = fieldDimensions[0];
|
|
8253
8277
|
let minimumFieldHeight = fieldDimensions[1];
|
|
8254
|
-
for (const section of ((_a = field.rootElement.node) === null || _a ===
|
|
8278
|
+
for (const section of ((_a = field.rootElement.node) === null || _a === void 0 ? void 0 : _a.sections) || []) {
|
|
8255
8279
|
if (section.label) {
|
|
8256
8280
|
if (section.indexXInNode === field.rootElement.indexXInNode && section.indexYInNode !== field.rootElement.indexYInNode) {
|
|
8257
8281
|
minimumFieldWidth = Math.max(minimumFieldWidth, this.minimumSizeOfField(section.label)[0]);
|
|
@@ -8267,8 +8291,8 @@ class DiagramCanvas {
|
|
|
8267
8291
|
fieldDimensions[1] = minimumFieldHeight;
|
|
8268
8292
|
}
|
|
8269
8293
|
const type = field.rootElement.type;
|
|
8270
|
-
let stretchX = fieldDimensions[0] + getLeftMargin(type === null || type ===
|
|
8271
|
-
let stretchY = fieldDimensions[1] + getTopMargin(type === null || type ===
|
|
8294
|
+
let stretchX = fieldDimensions[0] + getLeftMargin(type === null || type === void 0 ? void 0 : type.label) + getRightMargin(type === null || type === void 0 ? void 0 : type.label) - field.rootElement.width;
|
|
8295
|
+
let stretchY = fieldDimensions[1] + getTopMargin(type === null || type === void 0 ? void 0 : type.label) + getBottomMargin(type === null || type === void 0 ? void 0 : type.label) - field.rootElement.height;
|
|
8272
8296
|
if (this.snapToGrid) {
|
|
8273
8297
|
stretchX = Math.ceil(stretchX / this.gridSize) * this.gridSize;
|
|
8274
8298
|
stretchY = Math.ceil(stretchY / this.gridSize) * this.gridSize;
|
|
@@ -8281,10 +8305,10 @@ class DiagramCanvas {
|
|
|
8281
8305
|
stretchY = (field.rootElement.getMinHeight() || 0) - field.rootElement.height;
|
|
8282
8306
|
}
|
|
8283
8307
|
if (shrink !== false || stretchX > 0) {
|
|
8284
|
-
(_b = field.rootElement.node) === null || _b ===
|
|
8308
|
+
(_b = field.rootElement.node) === null || _b === void 0 ? void 0 : _b.stretchSections(exports.Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
8285
8309
|
}
|
|
8286
8310
|
if (shrink !== false || stretchY > 0) {
|
|
8287
|
-
(_c = field.rootElement.node) === null || _c ===
|
|
8311
|
+
(_c = field.rootElement.node) === null || _c === void 0 ? void 0 : _c.stretchSections(exports.Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
8288
8312
|
}
|
|
8289
8313
|
}
|
|
8290
8314
|
}
|
|
@@ -8307,8 +8331,8 @@ class DiagramCanvas {
|
|
|
8307
8331
|
}
|
|
8308
8332
|
}
|
|
8309
8333
|
// add the margin that goes between the rightmost and bottommost points of the sections and the edge of the node
|
|
8310
|
-
newNodeWidth += ((_a = node.type.sectionGrid) === null || _a ===
|
|
8311
|
-
newNodeHeight += ((_b = node.type.sectionGrid) === null || _b ===
|
|
8334
|
+
newNodeWidth += ((_a = node.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
|
|
8335
|
+
newNodeHeight += ((_b = node.type.sectionGrid) === null || _b === void 0 ? void 0 : _b.margin) || 0;
|
|
8312
8336
|
node.stretch(exports.Side.Right, newNodeWidth - node.width);
|
|
8313
8337
|
node.stretch(exports.Side.Bottom, newNodeHeight - node.height);
|
|
8314
8338
|
}
|
|
@@ -8329,18 +8353,18 @@ class DiagramCanvas {
|
|
|
8329
8353
|
startConnection(port) {
|
|
8330
8354
|
var _a, _b, _c, _d;
|
|
8331
8355
|
if (port.allowsOutgoing || port.allowsIncoming) {
|
|
8332
|
-
if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a ===
|
|
8356
|
+
if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '') && port.allowsOutgoing || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && port.allowsIncoming)) {
|
|
8333
8357
|
this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
8334
8358
|
} else {
|
|
8335
8359
|
if (this.inferConnectionType) {
|
|
8336
8360
|
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
8337
8361
|
var _a, _b;
|
|
8338
|
-
return port.allowsOutgoing && t.canStartFromType(((_b = (_a = port.getNode()) === null || _a ===
|
|
8362
|
+
return port.allowsOutgoing && t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '');
|
|
8339
8363
|
});
|
|
8340
8364
|
if (differentConnectionType === undefined) {
|
|
8341
8365
|
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
8342
8366
|
var _a, _b;
|
|
8343
|
-
return port.allowsIncoming && t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a ===
|
|
8367
|
+
return port.allowsIncoming && t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '');
|
|
8344
8368
|
});
|
|
8345
8369
|
}
|
|
8346
8370
|
if (differentConnectionType !== undefined) {
|
|
@@ -8355,14 +8379,14 @@ class DiagramCanvas {
|
|
|
8355
8379
|
this.userHighlight.clear();
|
|
8356
8380
|
if (this.unfinishedConnection !== undefined) {
|
|
8357
8381
|
if (this.unfinishedConnection.start !== port) {
|
|
8358
|
-
if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a ===
|
|
8359
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_j = this.unfinishedConnection.start) === null || _j ===
|
|
8382
|
+
if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsOutgoing) && this.unfinishedConnection.type.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsIncoming) {
|
|
8383
|
+
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_j = this.unfinishedConnection.start) === null || _j === void 0 ? void 0 : _j.id, port.id);
|
|
8360
8384
|
// clean up the previous unfinished connection
|
|
8361
8385
|
this.dropConnection();
|
|
8362
8386
|
addConnectionAction.do();
|
|
8363
8387
|
this.actionStack.add(addConnectionAction);
|
|
8364
|
-
} else if (this.unfinishedConnection.type.canFinishOnType(((_o = (_m = (_l = (_k = this.unfinishedConnection) === null || _k ===
|
|
8365
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_t = this.unfinishedConnection.start) === null || _t ===
|
|
8388
|
+
} else if (this.unfinishedConnection.type.canFinishOnType(((_o = (_m = (_l = (_k = this.unfinishedConnection) === null || _k === void 0 ? void 0 : _k.start) === null || _l === void 0 ? void 0 : _l.getNode()) === null || _m === void 0 ? void 0 : _m.type) === null || _o === void 0 ? void 0 : _o.id) || '') && ((_q = (_p = this.unfinishedConnection) === null || _p === void 0 ? void 0 : _p.start) === null || _q === void 0 ? void 0 : _q.allowsIncoming) && this.unfinishedConnection.type.canStartFromType(((_s = (_r = port.getNode()) === null || _r === void 0 ? void 0 : _r.type) === null || _s === void 0 ? void 0 : _s.id) || '') && port.allowsOutgoing) {
|
|
8389
|
+
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_t = this.unfinishedConnection.start) === null || _t === void 0 ? void 0 : _t.id);
|
|
8366
8390
|
// clean up the previous unfinished connection
|
|
8367
8391
|
this.dropConnection();
|
|
8368
8392
|
addConnectionAction.do();
|
|
@@ -8371,18 +8395,18 @@ class DiagramCanvas {
|
|
|
8371
8395
|
if (this.inferConnectionType) {
|
|
8372
8396
|
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
8373
8397
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8374
|
-
return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a ===
|
|
8398
|
+
return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsOutgoing) && t.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsIncoming;
|
|
8375
8399
|
});
|
|
8376
8400
|
let invertConnection = false;
|
|
8377
8401
|
if (differentConnectionType === undefined) {
|
|
8378
8402
|
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
8379
8403
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8380
|
-
return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a ===
|
|
8404
|
+
return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsIncoming) && t.canStartFromType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsOutgoing;
|
|
8381
8405
|
});
|
|
8382
8406
|
invertConnection = true;
|
|
8383
8407
|
}
|
|
8384
8408
|
if (differentConnectionType !== undefined) {
|
|
8385
|
-
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_u = this.unfinishedConnection.start) === null || _u ===
|
|
8409
|
+
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_u = this.unfinishedConnection.start) === null || _u === void 0 ? void 0 : _u.id, invertConnection ? (_v = this.unfinishedConnection.start) === null || _v === void 0 ? void 0 : _v.id : port.id);
|
|
8386
8410
|
// clean up the previous unfinished connection
|
|
8387
8411
|
this.dropConnection();
|
|
8388
8412
|
addConnectionAction.do();
|
|
@@ -8404,9 +8428,9 @@ class DiagramCanvas {
|
|
|
8404
8428
|
}
|
|
8405
8429
|
dropConnection() {
|
|
8406
8430
|
var _a, _b, _c, _d;
|
|
8407
|
-
(_a = this.unfinishedConnection) === null || _a ===
|
|
8408
|
-
(_b = this.unfinishedConnection) === null || _b ===
|
|
8409
|
-
(_d = (_c = this.unfinishedConnection) === null || _c ===
|
|
8431
|
+
(_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.setStart(undefined);
|
|
8432
|
+
(_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.setEnd(undefined);
|
|
8433
|
+
(_d = (_c = this.unfinishedConnection) === null || _c === void 0 ? void 0 : _c.select()) === null || _d === void 0 ? void 0 : _d.remove();
|
|
8410
8434
|
this.unfinishedConnection = undefined;
|
|
8411
8435
|
}
|
|
8412
8436
|
cancelAllUserActions() {
|
|
@@ -8419,7 +8443,7 @@ class DiagramCanvas {
|
|
|
8419
8443
|
canUserPerformAction(action) {
|
|
8420
8444
|
return this.userActions[action] !== false;
|
|
8421
8445
|
}
|
|
8422
|
-
createInputField(text, coords, width, height, fontSize, fontFamily, changeCallback, finishCallback) {
|
|
8446
|
+
createInputField(text, coords, width, height, fontSize, fontFamily, orientation, changeCallback, finishCallback) {
|
|
8423
8447
|
// if we have a text input open, close it before creating a new one
|
|
8424
8448
|
this.removeInputField();
|
|
8425
8449
|
const inputFieldContainer = this.selectCanvasElements().append('foreignObject').attr('x', `${coords[0]}px`).attr('y', `${coords[1]}px`).attr('width', `${width}px`).attr('height', `${height}px`).style('box-sizing', 'border-box').style('border', '1px solid');
|
|
@@ -8451,9 +8475,9 @@ class DiagramCanvas {
|
|
|
8451
8475
|
// keep the field from shrinking below its original size
|
|
8452
8476
|
const newWidth = Math.max(inputFieldWidth, width);
|
|
8453
8477
|
const newHeight = Math.max(inputFieldHeight, height);
|
|
8454
|
-
inputFieldContainer === null || inputFieldContainer ===
|
|
8478
|
+
inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('width', `${newWidth}px`);
|
|
8455
8479
|
inputField.style('width', `${newWidth}px`);
|
|
8456
|
-
inputFieldContainer === null || inputFieldContainer ===
|
|
8480
|
+
inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('height', `${newHeight}px`);
|
|
8457
8481
|
inputField.style('height', `${newHeight}px`);
|
|
8458
8482
|
if (changeCallback) {
|
|
8459
8483
|
changeCallback(value);
|
|
@@ -8475,13 +8499,13 @@ class DiagramCanvas {
|
|
|
8475
8499
|
var _a, _b, _c;
|
|
8476
8500
|
// when removing an element, a blur event is emitted
|
|
8477
8501
|
// we remove the listener for blur so that it doesn't shoot again on element removal
|
|
8478
|
-
(_b = (_a = this.inputFieldContainer) === null || _a ===
|
|
8479
|
-
(_c = this.inputFieldContainer) === null || _c ===
|
|
8502
|
+
(_b = (_a = this.inputFieldContainer) === null || _a === void 0 ? void 0 : _a.select('input')) === null || _b === void 0 ? void 0 : _b.on(exports.Events.Blur, null);
|
|
8503
|
+
(_c = this.inputFieldContainer) === null || _c === void 0 ? void 0 : _c.remove();
|
|
8480
8504
|
this.inputFieldContainer = undefined;
|
|
8481
8505
|
}
|
|
8482
8506
|
minimumSizeOfField(field) {
|
|
8483
8507
|
var _a, _b;
|
|
8484
|
-
const pNode = (_b = (_a = field.select()) === null || _a ===
|
|
8508
|
+
const pNode = (_b = (_a = field.select()) === null || _a === void 0 ? void 0 : _a.select('p')) === null || _b === void 0 ? void 0 : _b.node();
|
|
8485
8509
|
if (!pNode) {
|
|
8486
8510
|
// happens when a field has been created but not updated in view yet
|
|
8487
8511
|
return [0, 0];
|
|
@@ -8500,7 +8524,7 @@ class DiagramCanvas {
|
|
|
8500
8524
|
this.currentAction = new MoveAction(this, this.userSelection.filter(e => e instanceof DiagramNode).map(n => n.id), d.coords);
|
|
8501
8525
|
} else {
|
|
8502
8526
|
const ancestorOfNode = d.getLastAncestor();
|
|
8503
|
-
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.MoveNode, d.id, d.getGeometry(), d.getGeometry(), ancestorOfNode === null || ancestorOfNode ===
|
|
8527
|
+
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.MoveNode, d.id, d.getGeometry(), d.getGeometry(), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id, ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id));
|
|
8504
8528
|
}
|
|
8505
8529
|
} else {
|
|
8506
8530
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
@@ -8553,23 +8577,23 @@ class DiagramCanvas {
|
|
|
8553
8577
|
const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
|
|
8554
8578
|
const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
|
|
8555
8579
|
if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
|
|
8556
|
-
const ancestorOfDroppedOn = droppedOn === null || droppedOn ===
|
|
8580
|
+
const ancestorOfDroppedOn = droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.getLastAncestor();
|
|
8557
8581
|
const fromChildGeometry = this.currentAction.from;
|
|
8558
|
-
const setParentAction = new SetParentAction(this, d.id, (_a = d.parent) === null || _a ===
|
|
8559
|
-
(_b = d.parent) === null || _b ===
|
|
8582
|
+
const setParentAction = new SetParentAction(this, d.id, (_a = d.parent) === null || _a === void 0 ? void 0 : _a.id, droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.id, fromChildGeometry, d.getGeometry(), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.id, ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id));
|
|
8583
|
+
(_b = d.parent) === null || _b === void 0 ? void 0 : _b.removeChild(d);
|
|
8560
8584
|
if (droppedOn !== undefined) {
|
|
8561
8585
|
droppedOn.addChild(d);
|
|
8562
8586
|
}
|
|
8563
8587
|
setParentAction.toChildGeometry = d.getGeometry(d.id);
|
|
8564
|
-
setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn ===
|
|
8588
|
+
setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id);
|
|
8565
8589
|
this.currentAction = setParentAction;
|
|
8566
8590
|
} else {
|
|
8567
|
-
const ancestorOfNode = d === null || d ===
|
|
8568
|
-
this.currentAction.ancestorId = ancestorOfNode === null || ancestorOfNode ===
|
|
8569
|
-
this.currentAction.fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode ===
|
|
8570
|
-
(_c = d.parent) === null || _c ===
|
|
8591
|
+
const ancestorOfNode = d === null || d === void 0 ? void 0 : d.getLastAncestor();
|
|
8592
|
+
this.currentAction.ancestorId = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id;
|
|
8593
|
+
this.currentAction.fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
8594
|
+
(_c = d.parent) === null || _c === void 0 ? void 0 : _c.fitToChild(d);
|
|
8571
8595
|
this.currentAction.to = d.getGeometry(d.id);
|
|
8572
|
-
this.currentAction.toAncestorGeometry = ancestorOfNode === null || ancestorOfNode ===
|
|
8596
|
+
this.currentAction.toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
8573
8597
|
}
|
|
8574
8598
|
}
|
|
8575
8599
|
if (this.currentAction !== undefined) {
|
|
@@ -8595,14 +8619,14 @@ class DiagramCanvas {
|
|
|
8595
8619
|
setCursorStyle(exports.CursorStyle.Crosshair);
|
|
8596
8620
|
// since the multiple selection rectangle is not affected by zoom,
|
|
8597
8621
|
// we compensate its coordinates based in the zoom transform to draw it
|
|
8598
|
-
(_d = (_c = (_b = (_a = this.multipleSelectionContainer) === null || _a ===
|
|
8622
|
+
(_d = (_c = (_b = (_a = this.multipleSelectionContainer) === null || _a === void 0 ? void 0 : _a.attr('x', Math.min(this.draggingFrom[0], pointerCoords[0]) * this.zoomTransform.k + this.zoomTransform.x)) === null || _b === void 0 ? void 0 : _b.attr('y', Math.min(this.draggingFrom[1], pointerCoords[1]) * this.zoomTransform.k + this.zoomTransform.y)) === null || _c === void 0 ? void 0 : _c.attr('width', Math.abs(this.draggingFrom[0] - pointerCoords[0]) * this.zoomTransform.k)) === null || _d === void 0 ? void 0 : _d.attr('height', Math.abs(this.draggingFrom[1] - pointerCoords[1]) * this.zoomTransform.k);
|
|
8599
8623
|
this.dragging = true;
|
|
8600
8624
|
}
|
|
8601
8625
|
}
|
|
8602
8626
|
finishMultipleSelection(event) {
|
|
8603
8627
|
var _a;
|
|
8604
8628
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8605
|
-
(_a = this.multipleSelectionContainer) === null || _a ===
|
|
8629
|
+
(_a = this.multipleSelectionContainer) === null || _a === void 0 ? void 0 : _a.remove();
|
|
8606
8630
|
this.multipleSelectionContainer = undefined;
|
|
8607
8631
|
this.userSelection.clear();
|
|
8608
8632
|
for (const node of this.model.nodes) {
|
|
@@ -8696,7 +8720,7 @@ class CollabClient {
|
|
|
8696
8720
|
const initialModel = message.initialModel;
|
|
8697
8721
|
new DagaImporter().import(session.canvas.model, initialModel);
|
|
8698
8722
|
this.startSyncing(session);
|
|
8699
|
-
(_a = session.joinRoomResolve) === null || _a ===
|
|
8723
|
+
(_a = session.joinRoomResolve) === null || _a === void 0 ? void 0 : _a.call(session);
|
|
8700
8724
|
session.joinRoomResolve = undefined;
|
|
8701
8725
|
break;
|
|
8702
8726
|
}
|
|
@@ -8719,7 +8743,7 @@ class CollabClient {
|
|
|
8719
8743
|
session.locator = message.locator;
|
|
8720
8744
|
this.pendingSessions.delete(message.refId);
|
|
8721
8745
|
this.sessions.set(session.locator, session);
|
|
8722
|
-
(_b = session.createRoomResolve) === null || _b ===
|
|
8746
|
+
(_b = session.createRoomResolve) === null || _b === void 0 ? void 0 : _b.call(session, session.locator);
|
|
8723
8747
|
session.createRoomResolve = undefined;
|
|
8724
8748
|
// Deliver queued AddMessages now that we have a locator.
|
|
8725
8749
|
for (const message of session.addQueue) {
|
|
@@ -8992,7 +9016,7 @@ class AdjacencyLayout {
|
|
|
8992
9016
|
// place nodes according to arrangement
|
|
8993
9017
|
const maximumWidth = Math.max(...model.nodes.map(n => n.width));
|
|
8994
9018
|
const maximumHeight = Math.max(...model.nodes.map(n => n.height));
|
|
8995
|
-
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a ===
|
|
9019
|
+
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
|
|
8996
9020
|
for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
|
|
8997
9021
|
for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
|
|
8998
9022
|
const node = nodeArrangement.get([x, y]);
|
|
@@ -9060,7 +9084,7 @@ class BreadthAdjacencyLayout {
|
|
|
9060
9084
|
// place nodes according to arrangement
|
|
9061
9085
|
const maximumWidth = Math.max(...model.nodes.map(n => n.width));
|
|
9062
9086
|
const maximumHeight = Math.max(...model.nodes.map(n => n.height));
|
|
9063
|
-
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a ===
|
|
9087
|
+
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
|
|
9064
9088
|
for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
|
|
9065
9089
|
for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
|
|
9066
9090
|
const node = nodeArrangement.get([x, y]);
|
|
@@ -9087,7 +9111,7 @@ class BreadthLayout {
|
|
|
9087
9111
|
// nothing to arrange...
|
|
9088
9112
|
return model;
|
|
9089
9113
|
}
|
|
9090
|
-
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a ===
|
|
9114
|
+
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
|
|
9091
9115
|
let nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
9092
9116
|
// Arrange nodes by a breadth first search
|
|
9093
9117
|
const firstNode = nodesToBeArranged[0];
|
|
@@ -9154,7 +9178,7 @@ class ForceLayout {
|
|
|
9154
9178
|
}
|
|
9155
9179
|
// as a starting point, we apply a simple layout
|
|
9156
9180
|
new BreadthLayout().apply(model);
|
|
9157
|
-
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a ===
|
|
9181
|
+
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
|
|
9158
9182
|
const coolingFactor = 0.99;
|
|
9159
9183
|
const minimumTemperature = 1;
|
|
9160
9184
|
const attractionFactor = 0.1;
|
|
@@ -9250,7 +9274,7 @@ class HorizontalLayout {
|
|
|
9250
9274
|
// nothing to arrange...
|
|
9251
9275
|
return model;
|
|
9252
9276
|
}
|
|
9253
|
-
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a ===
|
|
9277
|
+
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
|
|
9254
9278
|
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
9255
9279
|
nodesToBeArranged.sort((a, b) => b.type.priority - a.type.priority);
|
|
9256
9280
|
let widthAccumulator = 0;
|
|
@@ -9283,7 +9307,7 @@ class PriorityLayout {
|
|
|
9283
9307
|
new BreadthLayout().apply(model);
|
|
9284
9308
|
return model;
|
|
9285
9309
|
}
|
|
9286
|
-
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a ===
|
|
9310
|
+
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
|
|
9287
9311
|
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
9288
9312
|
const nodeArrangement = [];
|
|
9289
9313
|
const nodesWithMaximumPriorityToBeArranged = model.nodes.filter(n => !n.parent).filter(n => n.getPriority() >= maximumPriority);
|
|
@@ -9393,7 +9417,7 @@ class TreeLayout {
|
|
|
9393
9417
|
new BreadthLayout().apply(model);
|
|
9394
9418
|
return model;
|
|
9395
9419
|
}
|
|
9396
|
-
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a ===
|
|
9420
|
+
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
|
|
9397
9421
|
const nodesToBeArranged = model.nodes.filter(n => !n.parent).sort((n1, n2) => n2.getPriority() - n1.getPriority());
|
|
9398
9422
|
const branches = [];
|
|
9399
9423
|
while (nodesToBeArranged.length > 0) {
|
|
@@ -9487,7 +9511,7 @@ class VerticalLayout {
|
|
|
9487
9511
|
// nothing to arrange...
|
|
9488
9512
|
return model;
|
|
9489
9513
|
}
|
|
9490
|
-
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a ===
|
|
9514
|
+
const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
|
|
9491
9515
|
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
9492
9516
|
nodesToBeArranged.sort((a, b) => b.type.priority - a.type.priority);
|
|
9493
9517
|
let heightAccumulator = 0;
|