@metadev/daga 3.0.0 → 3.1.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 +15 -1
- package/README.md +11 -1
- package/index.cjs.js +1052 -348
- package/index.esm.js +1040 -345
- package/package.json +1 -1
- package/src/index.d.ts +27 -21
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +6 -11
- package/src/lib/diagram/collab/collab-action.d.ts +58 -2
- package/src/lib/diagram/converters/daga-model.d.ts +1 -0
- package/src/lib/diagram/diagram-action.d.ts +67 -4
- package/src/lib/diagram/diagram-config.d.ts +23 -4
- package/src/lib/diagram/diagram-event.d.ts +74 -8
- package/src/lib/diagram/layout/diagram-layout.d.ts +4 -0
- package/src/lib/diagram/model/diagram-connection.d.ts +3 -2
- package/src/lib/diagram/model/diagram-decorator.d.ts +1 -0
- package/src/lib/diagram/model/diagram-element.d.ts +5 -0
- package/src/lib/diagram/model/diagram-field.d.ts +1 -0
- package/src/lib/diagram/model/diagram-node.d.ts +69 -2
- package/src/lib/diagram/model/diagram-object.d.ts +1 -0
- package/src/lib/diagram/model/diagram-port.d.ts +1 -0
- package/src/lib/diagram/model/diagram-property.d.ts +3 -1
- package/src/lib/diagram/model/diagram-section.d.ts +1 -0
- package/src/lib/interfaces/canvas.d.ts +8 -11
- package/src/lib/util/line.d.ts +6 -1
- package/src/lib/util/shape.d.ts +6 -1
package/index.cjs.js
CHANGED
|
@@ -324,6 +324,9 @@ const MINIMUM_DISTANCE_BEFORE_TURN = 20;
|
|
|
324
324
|
* @private
|
|
325
325
|
*/
|
|
326
326
|
const linePath = (shape, points, startDirection, endDirection, minimumDistanceBeforeTurn) => {
|
|
327
|
+
if (typeof shape === 'function') {
|
|
328
|
+
return shape(points, startDirection, endDirection, minimumDistanceBeforeTurn);
|
|
329
|
+
}
|
|
327
330
|
if (points.length === 0) {
|
|
328
331
|
return '';
|
|
329
332
|
} else if (points.length === 1) {
|
|
@@ -686,6 +689,9 @@ exports.ClosedShape = void 0;
|
|
|
686
689
|
* @private
|
|
687
690
|
*/
|
|
688
691
|
const generalClosedPath = (shape, x, y, width, height) => {
|
|
692
|
+
if (typeof shape === 'function') {
|
|
693
|
+
return shape(x, y, width, height);
|
|
694
|
+
}
|
|
689
695
|
switch (shape) {
|
|
690
696
|
case exports.ClosedShape.Ellipse:
|
|
691
697
|
return ellipsePath(x, y, width, height);
|
|
@@ -819,7 +825,7 @@ const numberOfColumns = s => {
|
|
|
819
825
|
};
|
|
820
826
|
const numberOfRows = s => {
|
|
821
827
|
var _a;
|
|
822
|
-
return ((_a = s.match(/\n/g)) === null || _a ===
|
|
828
|
+
return ((_a = s.match(/\n/g)) === null || _a === undefined ? undefined : _a.length) || 0;
|
|
823
829
|
};
|
|
824
830
|
|
|
825
831
|
/**
|
|
@@ -979,14 +985,14 @@ class DiagramElement {
|
|
|
979
985
|
*/
|
|
980
986
|
get highlighted() {
|
|
981
987
|
var _a, _b;
|
|
982
|
-
return ((_b = (_a = this.model.canvas) === null || _a ===
|
|
988
|
+
return ((_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userHighlight) === null || _b === undefined ? undefined : _b.contains(this.id)) || false;
|
|
983
989
|
}
|
|
984
990
|
/**
|
|
985
991
|
* Whether this diagram element is currently in the user selection.
|
|
986
992
|
*/
|
|
987
993
|
get selected() {
|
|
988
994
|
var _a, _b;
|
|
989
|
-
return ((_b = (_a = this.model.canvas) === null || _a ===
|
|
995
|
+
return ((_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userSelection) === null || _b === undefined ? undefined : _b.contains(this.id)) || false;
|
|
990
996
|
}
|
|
991
997
|
constructor(model, id) {
|
|
992
998
|
/**
|
|
@@ -1015,7 +1021,7 @@ class DiagramElement {
|
|
|
1015
1021
|
*/
|
|
1016
1022
|
select() {
|
|
1017
1023
|
var _a, _b;
|
|
1018
|
-
return (_b = (_a = this.model.canvas) === null || _a ===
|
|
1024
|
+
return (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.selectCanvasView()) === null || _b === undefined ? undefined : _b.select(`g#${this.id}`);
|
|
1019
1025
|
}
|
|
1020
1026
|
}
|
|
1021
1027
|
class DiagramElementSet extends DiagramEntitySet {
|
|
@@ -1238,6 +1244,7 @@ class ValueSet {
|
|
|
1238
1244
|
constructor(propertySet, rootElement) {
|
|
1239
1245
|
this.displayedProperties = [];
|
|
1240
1246
|
this.hiddenProperties = [];
|
|
1247
|
+
// TODO JC: make this private after reviewing how it's used from React
|
|
1241
1248
|
this.values = {};
|
|
1242
1249
|
this.valueSets = {};
|
|
1243
1250
|
/**
|
|
@@ -1316,7 +1323,7 @@ class ValueSet {
|
|
|
1316
1323
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1317
1324
|
getValue(key) {
|
|
1318
1325
|
var _a;
|
|
1319
|
-
const rootAttribute = (_a = this.propertySet.getProperty(key)) === null || _a ===
|
|
1326
|
+
const rootAttribute = (_a = this.propertySet.getProperty(key)) === null || _a === undefined ? undefined : _a.rootAttribute;
|
|
1320
1327
|
if (rootAttribute !== undefined && rootAttribute !== null) {
|
|
1321
1328
|
this.values[key] = this.getRootElementValue(rootAttribute);
|
|
1322
1329
|
}
|
|
@@ -1401,7 +1408,7 @@ class ValueSet {
|
|
|
1401
1408
|
if (property && property.type === exports.Type.Object) {
|
|
1402
1409
|
return this.getSubValueSet(key).hasAnySetValue();
|
|
1403
1410
|
}
|
|
1404
|
-
return !empty(value) && !equals(value, property === null || property ===
|
|
1411
|
+
return !empty(value) && !equals(value, property === null || property === undefined ? undefined : property.defaultValue);
|
|
1405
1412
|
}
|
|
1406
1413
|
/**
|
|
1407
1414
|
* Checks if any of the values in the set are not empty or the default value.
|
|
@@ -1760,7 +1767,11 @@ class DiagramConnection extends DiagramElement {
|
|
|
1760
1767
|
}
|
|
1761
1768
|
updateInView() {
|
|
1762
1769
|
var _a;
|
|
1763
|
-
(_a = this.model.canvas) === null || _a ===
|
|
1770
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateConnectionsInView(this.id);
|
|
1771
|
+
}
|
|
1772
|
+
raise() {
|
|
1773
|
+
var _a;
|
|
1774
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
1764
1775
|
}
|
|
1765
1776
|
/**
|
|
1766
1777
|
* Set the start of this connection to the given port or reset this connection's starting port if `undefined`.
|
|
@@ -1776,12 +1787,12 @@ class DiagramConnection extends DiagramElement {
|
|
|
1776
1787
|
this.start = start;
|
|
1777
1788
|
if (start !== undefined) {
|
|
1778
1789
|
start.outgoingConnections.push(this);
|
|
1779
|
-
this.startDirection = start === null || start ===
|
|
1780
|
-
this.startCoords = (start === null || start ===
|
|
1790
|
+
this.startDirection = start === null || start === undefined ? undefined : start.direction;
|
|
1791
|
+
this.startCoords = (start === null || start === undefined ? undefined : start.coords) || [0, 0];
|
|
1781
1792
|
}
|
|
1782
1793
|
} else {
|
|
1783
|
-
this.startDirection = start === null || start ===
|
|
1784
|
-
this.startCoords = (start === null || start ===
|
|
1794
|
+
this.startDirection = start === null || start === undefined ? undefined : start.direction;
|
|
1795
|
+
this.startCoords = (start === null || start === undefined ? undefined : start.coords) || [0, 0];
|
|
1785
1796
|
}
|
|
1786
1797
|
this.updateInView();
|
|
1787
1798
|
}
|
|
@@ -1799,12 +1810,12 @@ class DiagramConnection extends DiagramElement {
|
|
|
1799
1810
|
this.end = end;
|
|
1800
1811
|
if (end !== undefined) {
|
|
1801
1812
|
end.incomingConnections.push(this);
|
|
1802
|
-
this.endDirection = end === null || end ===
|
|
1803
|
-
this.endCoords = (end === null || end ===
|
|
1813
|
+
this.endDirection = end === null || end === undefined ? undefined : end.direction;
|
|
1814
|
+
this.endCoords = (end === null || end === undefined ? undefined : end.coords) || [0, 0];
|
|
1804
1815
|
}
|
|
1805
1816
|
} else {
|
|
1806
|
-
this.endDirection = end === null || end ===
|
|
1807
|
-
this.endCoords = (end === null || end ===
|
|
1817
|
+
this.endDirection = end === null || end === undefined ? undefined : end.direction;
|
|
1818
|
+
this.endCoords = (end === null || end === undefined ? undefined : end.coords) || [0, 0];
|
|
1808
1819
|
}
|
|
1809
1820
|
this.updateInView();
|
|
1810
1821
|
}
|
|
@@ -1815,7 +1826,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
1815
1826
|
*/
|
|
1816
1827
|
tighten() {
|
|
1817
1828
|
var _a, _b;
|
|
1818
|
-
if (((_a = this.start) === null || _a ===
|
|
1829
|
+
if (((_a = this.start) === null || _a === undefined ? undefined : _a.rootElement) && this.end) {
|
|
1819
1830
|
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]);
|
|
1820
1831
|
checkAlternativeStartPorts: for (const alternativeStartPort of alternativeStartPortsSortedByDistanceAscending) {
|
|
1821
1832
|
if (alternativeStartPort === this.end) {
|
|
@@ -1845,7 +1856,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
1845
1856
|
}
|
|
1846
1857
|
}
|
|
1847
1858
|
}
|
|
1848
|
-
if (((_b = this.end) === null || _b ===
|
|
1859
|
+
if (((_b = this.end) === null || _b === undefined ? undefined : _b.rootElement) && this.start) {
|
|
1849
1860
|
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]);
|
|
1850
1861
|
checkAlternativeEndPorts: for (const alternativeEndPort of alternativeEndPortsSortedByDistanceAscending) {
|
|
1851
1862
|
if (alternativeEndPort === this.start) {
|
|
@@ -1937,8 +1948,8 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
1937
1948
|
const connection = this.get(id, true);
|
|
1938
1949
|
if (connection) {
|
|
1939
1950
|
// remove from ports
|
|
1940
|
-
removeIfExists(((_a = connection.start) === null || _a ===
|
|
1941
|
-
removeIfExists(((_b = connection.end) === null || _b ===
|
|
1951
|
+
removeIfExists(((_a = connection.start) === null || _a === undefined ? undefined : _a.outgoingConnections) || [], connection);
|
|
1952
|
+
removeIfExists(((_b = connection.end) === null || _b === undefined ? undefined : _b.incomingConnections) || [], connection);
|
|
1942
1953
|
// remove from set of connections
|
|
1943
1954
|
super.remove(id);
|
|
1944
1955
|
// remove from canvas
|
|
@@ -1987,11 +1998,11 @@ class DiagramField extends DiagramElement {
|
|
|
1987
1998
|
this._text = value;
|
|
1988
1999
|
this.updateInView();
|
|
1989
2000
|
if (this.fit) {
|
|
1990
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2001
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.fitFieldRootInView(this.id);
|
|
1991
2002
|
}
|
|
1992
2003
|
}
|
|
1993
2004
|
constructor(model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, text, editable, fit) {
|
|
1994
|
-
const id = `${rootElement === null || rootElement ===
|
|
2005
|
+
const id = `${rootElement === null || rootElement === undefined ? undefined : rootElement.id}_field`;
|
|
1995
2006
|
if (model.fields.get(id) !== undefined) {
|
|
1996
2007
|
throw new Error('DiagramField for rootElement already exists');
|
|
1997
2008
|
}
|
|
@@ -2018,14 +2029,18 @@ class DiagramField extends DiagramElement {
|
|
|
2018
2029
|
}
|
|
2019
2030
|
select() {
|
|
2020
2031
|
var _a, _b;
|
|
2021
|
-
return (_b = (_a = this.model.canvas) === null || _a ===
|
|
2032
|
+
return (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.selectCanvasView()) === null || _b === undefined ? undefined : _b.select(`foreignObject#${this.id}`);
|
|
2022
2033
|
}
|
|
2023
2034
|
get removed() {
|
|
2024
2035
|
return this.selfRemoved || this.rootElement !== undefined && this.rootElement.removed;
|
|
2025
2036
|
}
|
|
2026
2037
|
updateInView() {
|
|
2027
2038
|
var _a;
|
|
2028
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2039
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateFieldsInView(this.id);
|
|
2040
|
+
}
|
|
2041
|
+
raise() {
|
|
2042
|
+
var _a;
|
|
2043
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
2029
2044
|
}
|
|
2030
2045
|
/**
|
|
2031
2046
|
* Change the coordinates of this field to the given coordinates.
|
|
@@ -2038,7 +2053,7 @@ class DiagramField extends DiagramElement {
|
|
|
2038
2053
|
}
|
|
2039
2054
|
getPriority() {
|
|
2040
2055
|
var _a;
|
|
2041
|
-
return ((_a = this.rootElement) === null || _a ===
|
|
2056
|
+
return ((_a = this.rootElement) === null || _a === undefined ? undefined : _a.getPriority()) || DEFAULT_PRIORITY;
|
|
2042
2057
|
}
|
|
2043
2058
|
}
|
|
2044
2059
|
class DiagramFieldSet extends DiagramElementSet {
|
|
@@ -2069,7 +2084,7 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2069
2084
|
const field = this.get(id, true);
|
|
2070
2085
|
if (field) {
|
|
2071
2086
|
// remove from root element
|
|
2072
|
-
if (((_a = field.rootElement) === null || _a ===
|
|
2087
|
+
if (((_a = field.rootElement) === null || _a === undefined ? undefined : _a.label) !== undefined) {
|
|
2073
2088
|
if (field.rootElement.label === field) {
|
|
2074
2089
|
field.rootElement.label = undefined;
|
|
2075
2090
|
}
|
|
@@ -2082,7 +2097,7 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2082
2097
|
}
|
|
2083
2098
|
}
|
|
2084
2099
|
const getBottomMargin = config => {
|
|
2085
|
-
if ((config === null || config ===
|
|
2100
|
+
if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
|
|
2086
2101
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2087
2102
|
} else if (typeof config.margin === 'number') {
|
|
2088
2103
|
return config.margin;
|
|
@@ -2101,7 +2116,7 @@ const getBottomMargin = config => {
|
|
|
2101
2116
|
}
|
|
2102
2117
|
};
|
|
2103
2118
|
const getLeftMargin = config => {
|
|
2104
|
-
if ((config === null || config ===
|
|
2119
|
+
if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
|
|
2105
2120
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2106
2121
|
} else if (typeof config.margin === 'number') {
|
|
2107
2122
|
return config.margin;
|
|
@@ -2120,7 +2135,7 @@ const getLeftMargin = config => {
|
|
|
2120
2135
|
}
|
|
2121
2136
|
};
|
|
2122
2137
|
const getRightMargin = config => {
|
|
2123
|
-
if ((config === null || config ===
|
|
2138
|
+
if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
|
|
2124
2139
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2125
2140
|
} else if (typeof config.margin === 'number') {
|
|
2126
2141
|
return config.margin;
|
|
@@ -2139,7 +2154,7 @@ const getRightMargin = config => {
|
|
|
2139
2154
|
}
|
|
2140
2155
|
};
|
|
2141
2156
|
const getTopMargin = config => {
|
|
2142
|
-
if ((config === null || config ===
|
|
2157
|
+
if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
|
|
2143
2158
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2144
2159
|
} else if (typeof config.margin === 'number') {
|
|
2145
2160
|
return config.margin;
|
|
@@ -2157,8 +2172,8 @@ const getTopMargin = config => {
|
|
|
2157
2172
|
}
|
|
2158
2173
|
}
|
|
2159
2174
|
};
|
|
2160
|
-
const getBottomPadding = config => {
|
|
2161
|
-
if ((config === null || config ===
|
|
2175
|
+
const getBottomPadding$1 = config => {
|
|
2176
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
2162
2177
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2163
2178
|
} else if (typeof config.padding === 'number') {
|
|
2164
2179
|
return config.padding;
|
|
@@ -2176,8 +2191,8 @@ const getBottomPadding = config => {
|
|
|
2176
2191
|
}
|
|
2177
2192
|
}
|
|
2178
2193
|
};
|
|
2179
|
-
const getLeftPadding = config => {
|
|
2180
|
-
if ((config === null || config ===
|
|
2194
|
+
const getLeftPadding$1 = config => {
|
|
2195
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
2181
2196
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2182
2197
|
} else if (typeof config.padding === 'number') {
|
|
2183
2198
|
return config.padding;
|
|
@@ -2195,8 +2210,8 @@ const getLeftPadding = config => {
|
|
|
2195
2210
|
}
|
|
2196
2211
|
}
|
|
2197
2212
|
};
|
|
2198
|
-
const getRightPadding = config => {
|
|
2199
|
-
if ((config === null || config ===
|
|
2213
|
+
const getRightPadding$1 = config => {
|
|
2214
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
2200
2215
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2201
2216
|
} else if (typeof config.padding === 'number') {
|
|
2202
2217
|
return config.padding;
|
|
@@ -2214,8 +2229,8 @@ const getRightPadding = config => {
|
|
|
2214
2229
|
}
|
|
2215
2230
|
}
|
|
2216
2231
|
};
|
|
2217
|
-
const getTopPadding = config => {
|
|
2218
|
-
if ((config === null || config ===
|
|
2232
|
+
const getTopPadding$1 = config => {
|
|
2233
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
2219
2234
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2220
2235
|
} else if (typeof config.padding === 'number') {
|
|
2221
2236
|
return config.padding;
|
|
@@ -2296,7 +2311,7 @@ class DiagramSection extends DiagramElement {
|
|
|
2296
2311
|
*/
|
|
2297
2312
|
get name() {
|
|
2298
2313
|
var _a;
|
|
2299
|
-
return ((_a = this.label) === null || _a ===
|
|
2314
|
+
return ((_a = this.label) === null || _a === undefined ? undefined : _a.text) || '';
|
|
2300
2315
|
}
|
|
2301
2316
|
set name(name) {
|
|
2302
2317
|
if (this.label) {
|
|
@@ -2330,23 +2345,36 @@ class DiagramSection extends DiagramElement {
|
|
|
2330
2345
|
}
|
|
2331
2346
|
updateInView() {
|
|
2332
2347
|
var _a;
|
|
2333
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2348
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateSectionsInView(this.id);
|
|
2349
|
+
}
|
|
2350
|
+
raise() {
|
|
2351
|
+
var _a;
|
|
2352
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
2353
|
+
if (this.label) {
|
|
2354
|
+
this.label.raise();
|
|
2355
|
+
}
|
|
2356
|
+
for (const port of this.ports) {
|
|
2357
|
+
port.raise();
|
|
2358
|
+
}
|
|
2359
|
+
for (const decorator of this.decorators) {
|
|
2360
|
+
decorator.raise();
|
|
2361
|
+
}
|
|
2334
2362
|
}
|
|
2335
2363
|
getConfig() {
|
|
2336
2364
|
var _a, _b, _c, _d, _e;
|
|
2337
|
-
return (_e = (_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2365
|
+
return (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.sections) === null || _d === undefined ? undefined : _d[this.indexYInNode]) === null || _e === undefined ? undefined : _e[this.indexXInNode];
|
|
2338
2366
|
}
|
|
2339
2367
|
getMinWidth() {
|
|
2340
2368
|
var _a, _b, _c, _d;
|
|
2341
|
-
return ((_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2369
|
+
return ((_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.minWidths) === null || _d === undefined ? undefined : _d[this.indexXInNode]) || DIAGRAM_SECTION_MIN_WIDTH;
|
|
2342
2370
|
}
|
|
2343
2371
|
getMinHeight() {
|
|
2344
2372
|
var _a, _b, _c, _d;
|
|
2345
|
-
return ((_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2373
|
+
return ((_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.minHeights) === null || _d === undefined ? undefined : _d[this.indexYInNode]) || DIAGRAM_SECTION_MIN_HEIGHT;
|
|
2346
2374
|
}
|
|
2347
2375
|
getPriority() {
|
|
2348
2376
|
var _a, _b, _c, _d, _e, _f;
|
|
2349
|
-
return ((_f = (_e = (_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2377
|
+
return ((_f = (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.sections) === null || _d === undefined ? undefined : _d[this.indexYInNode]) === null || _e === undefined ? undefined : _e[this.indexXInNode]) === null || _f === undefined ? undefined : _f.priority) || DIAGRAM_SECTION_DEFAULTS.priority;
|
|
2350
2378
|
}
|
|
2351
2379
|
/**
|
|
2352
2380
|
* Get the port of this section which is closest to the given coordinates.
|
|
@@ -2511,9 +2539,9 @@ class DiagramSection extends DiagramElement {
|
|
|
2511
2539
|
}
|
|
2512
2540
|
// Set label's dimensions as a function of ours.
|
|
2513
2541
|
if (this.label) {
|
|
2514
|
-
this.label.coords = [this.coords[0] + getLeftMargin((_a = this.getConfig()) === null || _a ===
|
|
2515
|
-
this.label.width = this.width - getLeftMargin((_c = this.getConfig()) === null || _c ===
|
|
2516
|
-
this.label.height = this.height - getTopMargin((_e = this.getConfig()) === null || _e ===
|
|
2542
|
+
this.label.coords = [this.coords[0] + getLeftMargin((_a = this.getConfig()) === null || _a === undefined ? undefined : _a.label), this.coords[1] + getTopMargin((_b = this.getConfig()) === null || _b === undefined ? undefined : _b.label)];
|
|
2543
|
+
this.label.width = this.width - getLeftMargin((_c = this.getConfig()) === null || _c === undefined ? undefined : _c.label) - getRightMargin((_d = this.getConfig()) === null || _d === undefined ? undefined : _d.label);
|
|
2544
|
+
this.label.height = this.height - getTopMargin((_e = this.getConfig()) === null || _e === undefined ? undefined : _e.label) - getBottomMargin((_f = this.getConfig()) === null || _f === undefined ? undefined : _f.label);
|
|
2517
2545
|
this.label.updateInView();
|
|
2518
2546
|
}
|
|
2519
2547
|
// Move decorators to match the new coords.
|
|
@@ -2547,11 +2575,11 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
2547
2575
|
node.sections.push(section);
|
|
2548
2576
|
node.updateInView();
|
|
2549
2577
|
// add section ports
|
|
2550
|
-
const sectionPorts = (_d = (_c = (_b = (_a = node.type.sectionGrid) === null || _a ===
|
|
2578
|
+
const sectionPorts = (_d = (_c = (_b = (_a = node.type.sectionGrid) === null || _a === undefined ? undefined : _a.sections) === null || _b === undefined ? undefined : _b[indexYInNode]) === null || _c === undefined ? undefined : _c[indexXInNode]) === null || _d === undefined ? undefined : _d.ports;
|
|
2551
2579
|
if (sectionPorts && sectionPorts.length > 0) {
|
|
2552
2580
|
for (let i = 0; i < sectionPorts.length; ++i) {
|
|
2553
2581
|
const portConfig = sectionPorts[i];
|
|
2554
|
-
const port = this.model.ports.new(section, [section.coords[0] + (((_e = portConfig === null || portConfig ===
|
|
2582
|
+
const port = this.model.ports.new(section, [section.coords[0] + (((_e = portConfig === null || portConfig === undefined ? undefined : portConfig.coords) === null || _e === undefined ? undefined : _e[0]) || 0), section.coords[1] + (((_f = portConfig === null || portConfig === undefined ? undefined : portConfig.coords) === null || _f === undefined ? undefined : _f[1]) || 0)], portConfig === null || portConfig === undefined ? undefined : portConfig.direction, `${section.id}_${i}`);
|
|
2555
2583
|
if (portConfig.label) {
|
|
2556
2584
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), portConfig.label);
|
|
2557
2585
|
let labelCoords;
|
|
@@ -2574,7 +2602,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
2574
2602
|
}
|
|
2575
2603
|
}
|
|
2576
2604
|
// add section label
|
|
2577
|
-
const sectionLabel = (_k = (_j = (_h = (_g = node.type.sectionGrid) === null || _g ===
|
|
2605
|
+
const sectionLabel = (_k = (_j = (_h = (_g = node.type.sectionGrid) === null || _g === undefined ? undefined : _g.sections) === null || _h === undefined ? undefined : _h[indexYInNode]) === null || _j === undefined ? undefined : _j[indexXInNode]) === null || _k === undefined ? undefined : _k.label;
|
|
2578
2606
|
if (sectionLabel) {
|
|
2579
2607
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), sectionLabel);
|
|
2580
2608
|
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);
|
|
@@ -2630,11 +2658,14 @@ const DIAGRAM_NODE_TYPE_DEFAULTS = {
|
|
|
2630
2658
|
minHeight: 1,
|
|
2631
2659
|
resizableX: false,
|
|
2632
2660
|
resizableY: false,
|
|
2661
|
+
padding: 0,
|
|
2633
2662
|
label: null,
|
|
2634
2663
|
ports: [],
|
|
2635
2664
|
sectionGrid: null,
|
|
2636
2665
|
look: DIAGRAM_NODE_LOOK_DEFAULTS,
|
|
2637
2666
|
isUnique: false,
|
|
2667
|
+
canBeParentless: true,
|
|
2668
|
+
childrenTypes: [],
|
|
2638
2669
|
priority: DEFAULT_PRIORITY,
|
|
2639
2670
|
properties: []
|
|
2640
2671
|
};
|
|
@@ -2654,13 +2685,19 @@ class DiagramNodeType {
|
|
|
2654
2685
|
this.minHeight = values.minHeight;
|
|
2655
2686
|
this.resizableX = values.resizableX;
|
|
2656
2687
|
this.resizableY = values.resizableY;
|
|
2688
|
+
this.bottomPadding = getBottomPadding(values);
|
|
2689
|
+
this.leftPadding = getLeftPadding(values);
|
|
2690
|
+
this.rightPadding = getRightPadding(values);
|
|
2691
|
+
this.topPadding = getTopPadding(values);
|
|
2657
2692
|
this.label = values.label;
|
|
2658
2693
|
this.ports = values.ports;
|
|
2659
2694
|
this.sectionGrid = values.sectionGrid;
|
|
2660
2695
|
this.look = values.look;
|
|
2661
2696
|
this.isUnique = values.isUnique;
|
|
2697
|
+
this.canBeParentless = values.canBeParentless;
|
|
2698
|
+
this.childrenTypes = values.childrenTypes;
|
|
2662
2699
|
this.priority = values.priority;
|
|
2663
|
-
this.propertySet = new PropertySet((options === null || options ===
|
|
2700
|
+
this.propertySet = new PropertySet((options === null || options === undefined ? undefined : options.properties) || []);
|
|
2664
2701
|
}
|
|
2665
2702
|
}
|
|
2666
2703
|
/**
|
|
@@ -2677,7 +2714,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2677
2714
|
*/
|
|
2678
2715
|
get name() {
|
|
2679
2716
|
var _a;
|
|
2680
|
-
return ((_a = this.label) === null || _a ===
|
|
2717
|
+
return ((_a = this.label) === null || _a === undefined ? undefined : _a.text) || '';
|
|
2681
2718
|
}
|
|
2682
2719
|
set name(name) {
|
|
2683
2720
|
if (this.label) {
|
|
@@ -2689,6 +2726,11 @@ class DiagramNode extends DiagramElement {
|
|
|
2689
2726
|
throw new Error(`DiagramNode with id "${id}" already exists`);
|
|
2690
2727
|
}
|
|
2691
2728
|
super(model, id);
|
|
2729
|
+
/**
|
|
2730
|
+
* Nodes contained within this node.
|
|
2731
|
+
* @public
|
|
2732
|
+
*/
|
|
2733
|
+
this.children = [];
|
|
2692
2734
|
/**
|
|
2693
2735
|
* Sections of this node.
|
|
2694
2736
|
* @public
|
|
@@ -2705,7 +2747,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2705
2747
|
*/
|
|
2706
2748
|
this.decorators = [];
|
|
2707
2749
|
/**
|
|
2708
|
-
* Collaborative timestamp for
|
|
2750
|
+
* Collaborative timestamp for MoveCollabAction, SetGeometryCollabAction and SetParentCollabAction.
|
|
2709
2751
|
* @public
|
|
2710
2752
|
*/
|
|
2711
2753
|
this.geometryTimestamp = null;
|
|
@@ -2721,7 +2763,26 @@ class DiagramNode extends DiagramElement {
|
|
|
2721
2763
|
}
|
|
2722
2764
|
updateInView() {
|
|
2723
2765
|
var _a;
|
|
2724
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2766
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateNodesInView(this.id);
|
|
2767
|
+
}
|
|
2768
|
+
raise() {
|
|
2769
|
+
var _a;
|
|
2770
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
2771
|
+
if (this.label) {
|
|
2772
|
+
this.label.raise();
|
|
2773
|
+
}
|
|
2774
|
+
for (const port of this.ports) {
|
|
2775
|
+
port.raise();
|
|
2776
|
+
}
|
|
2777
|
+
for (const section of this.sections) {
|
|
2778
|
+
section.raise();
|
|
2779
|
+
}
|
|
2780
|
+
for (const decorator of this.decorators) {
|
|
2781
|
+
decorator.raise();
|
|
2782
|
+
}
|
|
2783
|
+
for (const child of this.children) {
|
|
2784
|
+
child.raise();
|
|
2785
|
+
}
|
|
2725
2786
|
}
|
|
2726
2787
|
getPriority() {
|
|
2727
2788
|
return this.type.priority;
|
|
@@ -2813,7 +2874,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2813
2874
|
if (!includeRemoved && incomingConnection.removed) {
|
|
2814
2875
|
continue;
|
|
2815
2876
|
}
|
|
2816
|
-
const otherNode = (_a = incomingConnection.start) === null || _a ===
|
|
2877
|
+
const otherNode = (_a = incomingConnection.start) === null || _a === undefined ? undefined : _a.getNode();
|
|
2817
2878
|
if (otherNode) {
|
|
2818
2879
|
if (!includeRemoved && otherNode.removed) {
|
|
2819
2880
|
continue;
|
|
@@ -2825,7 +2886,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2825
2886
|
if (!includeRemoved && outgoingConnection.removed) {
|
|
2826
2887
|
continue;
|
|
2827
2888
|
}
|
|
2828
|
-
const otherNode = (_b = outgoingConnection.end) === null || _b ===
|
|
2889
|
+
const otherNode = (_b = outgoingConnection.end) === null || _b === undefined ? undefined : _b.getNode();
|
|
2829
2890
|
if (otherNode) {
|
|
2830
2891
|
if (!includeRemoved && otherNode.removed) {
|
|
2831
2892
|
continue;
|
|
@@ -2836,6 +2897,94 @@ class DiagramNode extends DiagramElement {
|
|
|
2836
2897
|
}
|
|
2837
2898
|
return result;
|
|
2838
2899
|
}
|
|
2900
|
+
/**
|
|
2901
|
+
* Return the ancestor of this node which has no ancestors. If this node has no ancestors, returns itself.
|
|
2902
|
+
* @returns The ancestor of this node which has no ancestors.
|
|
2903
|
+
*/
|
|
2904
|
+
getLastAncestor() {
|
|
2905
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
2906
|
+
let node = this;
|
|
2907
|
+
while (node.parent !== undefined) {
|
|
2908
|
+
node = node === null || node === undefined ? undefined : node.parent;
|
|
2909
|
+
}
|
|
2910
|
+
return node;
|
|
2911
|
+
}
|
|
2912
|
+
/**
|
|
2913
|
+
* Return true if this node is among the ancestors of the given node.
|
|
2914
|
+
* @param child A node.
|
|
2915
|
+
* @returns `true` if this node is among the ancestors of the given node, `false` otherwise.
|
|
2916
|
+
*/
|
|
2917
|
+
isAncestorOf(child) {
|
|
2918
|
+
let node = child;
|
|
2919
|
+
while (node !== undefined) {
|
|
2920
|
+
if (this.id === node.id) {
|
|
2921
|
+
return true;
|
|
2922
|
+
}
|
|
2923
|
+
node = node.parent;
|
|
2924
|
+
}
|
|
2925
|
+
return false;
|
|
2926
|
+
}
|
|
2927
|
+
/**
|
|
2928
|
+
* Return true if the given node is among the ancestors of this node.
|
|
2929
|
+
* @param child A node.
|
|
2930
|
+
* @returns `true` if the given node is among the ancestors of this node, `false` otherwise.
|
|
2931
|
+
*/
|
|
2932
|
+
isDescendantOf(child) {
|
|
2933
|
+
return child.isAncestorOf(this);
|
|
2934
|
+
}
|
|
2935
|
+
addChild(child) {
|
|
2936
|
+
if (child.id === this.id) {
|
|
2937
|
+
// do nothing; a node can't be its own child
|
|
2938
|
+
return;
|
|
2939
|
+
}
|
|
2940
|
+
let node = this.parent;
|
|
2941
|
+
let isChildParentOfThis = false;
|
|
2942
|
+
while (node !== undefined) {
|
|
2943
|
+
if (node.id === child.id) {
|
|
2944
|
+
isChildParentOfThis = true;
|
|
2945
|
+
break;
|
|
2946
|
+
}
|
|
2947
|
+
node = node.parent;
|
|
2948
|
+
}
|
|
2949
|
+
if (isChildParentOfThis) {
|
|
2950
|
+
// do nothing; a node can't be its own ancestor
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
if (this.children.indexOf(child) >= 0) {
|
|
2954
|
+
// do nothing, child is already among the node's children
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
this.fitToChild(child);
|
|
2958
|
+
this.children.push(child);
|
|
2959
|
+
child.parent = this;
|
|
2960
|
+
child.raise();
|
|
2961
|
+
}
|
|
2962
|
+
removeChild(child) {
|
|
2963
|
+
removeIfExists(this.children, child);
|
|
2964
|
+
child.parent = undefined;
|
|
2965
|
+
}
|
|
2966
|
+
fitToChild(child) {
|
|
2967
|
+
const excessLeft = this.coords[0] - child.coords[0] + this.type.leftPadding;
|
|
2968
|
+
if (excessLeft >= 0) {
|
|
2969
|
+
this.stretch(exports.Side.Left, excessLeft);
|
|
2970
|
+
}
|
|
2971
|
+
const excessTop = this.coords[1] - child.coords[1] + this.type.topPadding;
|
|
2972
|
+
if (excessTop >= 0) {
|
|
2973
|
+
this.stretch(exports.Side.Top, excessTop);
|
|
2974
|
+
}
|
|
2975
|
+
const excessRight = child.coords[0] + child.width - (this.coords[0] + this.width) + this.type.rightPadding;
|
|
2976
|
+
if (excessRight >= 0) {
|
|
2977
|
+
this.stretch(exports.Side.Right, excessRight);
|
|
2978
|
+
}
|
|
2979
|
+
const excessBottom = child.coords[1] + child.height - (this.coords[1] + this.height) + this.type.bottomPadding;
|
|
2980
|
+
if (excessBottom >= 0) {
|
|
2981
|
+
this.stretch(exports.Side.Bottom, excessBottom);
|
|
2982
|
+
}
|
|
2983
|
+
if (this.parent) {
|
|
2984
|
+
// ensure this node also fits inside its parent after stretching
|
|
2985
|
+
this.parent.fitToChild(this);
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2839
2988
|
/**
|
|
2840
2989
|
* Change the coordinates of this node to the given coordinates and move its sections, ports and labels correspondingly.
|
|
2841
2990
|
* @public
|
|
@@ -2843,6 +2992,9 @@ class DiagramNode extends DiagramElement {
|
|
|
2843
2992
|
*/
|
|
2844
2993
|
move(coords) {
|
|
2845
2994
|
const coordDifferences = [coords[0] - this.coords[0], coords[1] - this.coords[1]];
|
|
2995
|
+
for (const child of this.children) {
|
|
2996
|
+
child.move([child.coords[0] + coordDifferences[0], child.coords[1] + coordDifferences[1]]);
|
|
2997
|
+
}
|
|
2846
2998
|
for (const section of this.sections) {
|
|
2847
2999
|
section.move([section.coords[0] + coordDifferences[0], section.coords[1] + coordDifferences[1]]);
|
|
2848
3000
|
}
|
|
@@ -2851,7 +3003,9 @@ class DiagramNode extends DiagramElement {
|
|
|
2851
3003
|
width: this.width,
|
|
2852
3004
|
height: this.height,
|
|
2853
3005
|
// We already moved the sections above - skip changing them in setDimensions.
|
|
2854
|
-
sections: {}
|
|
3006
|
+
sections: {},
|
|
3007
|
+
// We don't change the children when stretching
|
|
3008
|
+
children: {}
|
|
2855
3009
|
});
|
|
2856
3010
|
}
|
|
2857
3011
|
/**
|
|
@@ -2900,7 +3054,9 @@ class DiagramNode extends DiagramElement {
|
|
|
2900
3054
|
width: newCoordsX[1] - newCoordsX[0],
|
|
2901
3055
|
height: newCoordsY[1] - newCoordsY[0],
|
|
2902
3056
|
// we ignore this.sections, the stretching of a node with sections is handled in the stretchSections method
|
|
2903
|
-
sections: {}
|
|
3057
|
+
sections: {},
|
|
3058
|
+
// we ignore this.children
|
|
3059
|
+
children: {}
|
|
2904
3060
|
});
|
|
2905
3061
|
}
|
|
2906
3062
|
/**
|
|
@@ -2989,16 +3145,23 @@ class DiagramNode extends DiagramElement {
|
|
|
2989
3145
|
* Returns the current values of all geometric properties (coordinates and dimensions) of this node and its sections.
|
|
2990
3146
|
* @public
|
|
2991
3147
|
*/
|
|
2992
|
-
getGeometry() {
|
|
3148
|
+
getGeometry(excludeId) {
|
|
2993
3149
|
const sections = {};
|
|
2994
3150
|
for (const section of this.sections) {
|
|
2995
3151
|
sections[section.id] = section.getGeometry();
|
|
2996
3152
|
}
|
|
3153
|
+
const children = {};
|
|
3154
|
+
for (const child of this.children) {
|
|
3155
|
+
if (child.id !== excludeId) {
|
|
3156
|
+
children[child.id] = child.getGeometry(excludeId);
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
2997
3159
|
return {
|
|
2998
3160
|
coords: [...this.coords],
|
|
2999
3161
|
width: this.width,
|
|
3000
3162
|
height: this.height,
|
|
3001
|
-
sections
|
|
3163
|
+
sections,
|
|
3164
|
+
children
|
|
3002
3165
|
};
|
|
3003
3166
|
}
|
|
3004
3167
|
/**
|
|
@@ -3006,6 +3169,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3006
3169
|
* @public
|
|
3007
3170
|
*/
|
|
3008
3171
|
setGeometry(geometry) {
|
|
3172
|
+
this.raise();
|
|
3009
3173
|
const oldCoordsX = [this.coords[0], this.coords[0] + this.width];
|
|
3010
3174
|
const oldCoordsY = [this.coords[1], this.coords[1] + this.height];
|
|
3011
3175
|
this.coords = [...geometry.coords];
|
|
@@ -3013,6 +3177,13 @@ class DiagramNode extends DiagramElement {
|
|
|
3013
3177
|
this.height = geometry.height;
|
|
3014
3178
|
const newCoordsX = [this.coords[0], this.coords[0] + this.width];
|
|
3015
3179
|
const newCoordsY = [this.coords[1], this.coords[1] + this.height];
|
|
3180
|
+
// Update children, if supplied.
|
|
3181
|
+
for (const child of this.children) {
|
|
3182
|
+
const childGeometry = geometry.children[child.id];
|
|
3183
|
+
if (childGeometry) {
|
|
3184
|
+
child.setGeometry(childGeometry);
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3016
3187
|
// Update sections, if supplied.
|
|
3017
3188
|
for (const section of this.sections) {
|
|
3018
3189
|
const sectionGeometry = geometry.sections[section.id];
|
|
@@ -3084,10 +3255,10 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3084
3255
|
for (let j = 0; j < nodeType.sectionGrid.sections.length; ++j) {
|
|
3085
3256
|
let widthAccumulator = node.coords[0] + (nodeType.sectionGrid.margin || 0);
|
|
3086
3257
|
for (let i = 0; i < nodeType.sectionGrid.sections[j].length; ++i) {
|
|
3087
|
-
this.model.sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a ===
|
|
3088
|
-
widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c ===
|
|
3258
|
+
this.model.sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a === undefined ? undefined : _a[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH, ((_b = nodeType.sectionGrid.defaultHeights) === null || _b === undefined ? undefined : _b[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT, `${node.id}_${j}_${i}`);
|
|
3259
|
+
widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c === undefined ? undefined : _c[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH) + (nodeType.sectionGrid.margin || 0);
|
|
3089
3260
|
}
|
|
3090
|
-
heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d ===
|
|
3261
|
+
heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d === undefined ? undefined : _d[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT) + (nodeType.sectionGrid.margin || 0);
|
|
3091
3262
|
}
|
|
3092
3263
|
}
|
|
3093
3264
|
// add node ports
|
|
@@ -3122,12 +3293,20 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3122
3293
|
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);
|
|
3123
3294
|
}
|
|
3124
3295
|
node.valueSet.resetValues();
|
|
3125
|
-
(_e = node.model.canvas) === null || _e ===
|
|
3296
|
+
(_e = node.model.canvas) === null || _e === undefined ? undefined : _e.fitNodeInView(node.id);
|
|
3126
3297
|
return node;
|
|
3127
3298
|
}
|
|
3128
3299
|
remove(id) {
|
|
3129
3300
|
const node = this.get(id, true);
|
|
3130
3301
|
if (node) {
|
|
3302
|
+
// remove from parent
|
|
3303
|
+
if (node.parent) {
|
|
3304
|
+
removeIfExists(node.parent.children, node);
|
|
3305
|
+
}
|
|
3306
|
+
// remove all children
|
|
3307
|
+
while (node.children.length > 0) {
|
|
3308
|
+
this.model.nodes.remove(node.children[0].id);
|
|
3309
|
+
}
|
|
3131
3310
|
// remove all sections
|
|
3132
3311
|
while (node.sections.length > 0) {
|
|
3133
3312
|
this.model.sections.remove(node.sections[0].id);
|
|
@@ -3150,7 +3329,137 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3150
3329
|
node.updateInView();
|
|
3151
3330
|
}
|
|
3152
3331
|
}
|
|
3332
|
+
/**
|
|
3333
|
+
* Gets all the nodes that overlap with the given coordinates.
|
|
3334
|
+
* @public
|
|
3335
|
+
* @param x A coordinate along the x axis.
|
|
3336
|
+
* @param y A coordinate along the y axis.
|
|
3337
|
+
* @returns All the nodes that overlap with the given coordinates.
|
|
3338
|
+
*/
|
|
3339
|
+
getAtCoordinates(x, y) {
|
|
3340
|
+
const nodesAtLocation = [];
|
|
3341
|
+
for (const node of this) {
|
|
3342
|
+
if (node.coords[0] < x && x < node.coords[0] + node.width && node.coords[1] < y && y < node.coords[1] + node.height) {
|
|
3343
|
+
nodesAtLocation.push(node);
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
return nodesAtLocation;
|
|
3347
|
+
}
|
|
3153
3348
|
}
|
|
3349
|
+
/**
|
|
3350
|
+
* Removes any nodes from the given list which are a descendant of another node in the list.
|
|
3351
|
+
* @param nodes A list of nodes.
|
|
3352
|
+
* @returns The given list of nodes minus any node that is a descendant of another node in the list.
|
|
3353
|
+
*/
|
|
3354
|
+
const filterByOnlyAncestors = nodes => {
|
|
3355
|
+
for (let i = 0; i < nodes.length; ++i) {
|
|
3356
|
+
for (let j = 0; j < nodes.length; ++j) {
|
|
3357
|
+
if (j !== i && nodes[j].isDescendantOf(nodes[i])) {
|
|
3358
|
+
nodes.splice(j, 1);
|
|
3359
|
+
--j;
|
|
3360
|
+
if (i > j) {
|
|
3361
|
+
--i;
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
return nodes;
|
|
3367
|
+
};
|
|
3368
|
+
/**
|
|
3369
|
+
* Removes any nodes from the given list which are an ancestor of another node in the list.
|
|
3370
|
+
* @param nodes A list of nodes.
|
|
3371
|
+
* @returns The given list of nodes minus any node that is an ancestor of another node in the list.
|
|
3372
|
+
*/
|
|
3373
|
+
const filterByOnlyDescendants = nodes => {
|
|
3374
|
+
for (let i = 0; i < nodes.length; ++i) {
|
|
3375
|
+
for (let j = 0; j < nodes.length; ++j) {
|
|
3376
|
+
if (j !== i && nodes[j].isAncestorOf(nodes[i])) {
|
|
3377
|
+
nodes.splice(j, 1);
|
|
3378
|
+
--j;
|
|
3379
|
+
if (i > j) {
|
|
3380
|
+
--i;
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
return nodes;
|
|
3386
|
+
};
|
|
3387
|
+
const getBottomPadding = config => {
|
|
3388
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
3389
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3390
|
+
} else if (typeof config.padding === 'number') {
|
|
3391
|
+
return config.padding;
|
|
3392
|
+
} else {
|
|
3393
|
+
if (config.padding.length === 0) {
|
|
3394
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3395
|
+
} else if (config.padding.length === 1) {
|
|
3396
|
+
return config.padding[0];
|
|
3397
|
+
} else if (config.padding.length === 2) {
|
|
3398
|
+
return config.padding[0];
|
|
3399
|
+
} else if (config.padding.length === 3) {
|
|
3400
|
+
return config.padding[2];
|
|
3401
|
+
} else {
|
|
3402
|
+
return config.padding[2];
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
};
|
|
3406
|
+
const getLeftPadding = config => {
|
|
3407
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
3408
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3409
|
+
} else if (typeof config.padding === 'number') {
|
|
3410
|
+
return config.padding;
|
|
3411
|
+
} else {
|
|
3412
|
+
if (config.padding.length === 0) {
|
|
3413
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3414
|
+
} else if (config.padding.length === 1) {
|
|
3415
|
+
return config.padding[0];
|
|
3416
|
+
} else if (config.padding.length === 2) {
|
|
3417
|
+
return config.padding[1];
|
|
3418
|
+
} else if (config.padding.length === 3) {
|
|
3419
|
+
return config.padding[1];
|
|
3420
|
+
} else {
|
|
3421
|
+
return config.padding[3];
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
};
|
|
3425
|
+
const getRightPadding = config => {
|
|
3426
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
3427
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3428
|
+
} else if (typeof config.padding === 'number') {
|
|
3429
|
+
return config.padding;
|
|
3430
|
+
} else {
|
|
3431
|
+
if (config.padding.length === 0) {
|
|
3432
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3433
|
+
} else if (config.padding.length === 1) {
|
|
3434
|
+
return config.padding[0];
|
|
3435
|
+
} else if (config.padding.length === 2) {
|
|
3436
|
+
return config.padding[1];
|
|
3437
|
+
} else if (config.padding.length === 3) {
|
|
3438
|
+
return config.padding[1];
|
|
3439
|
+
} else {
|
|
3440
|
+
return config.padding[1];
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
};
|
|
3444
|
+
const getTopPadding = config => {
|
|
3445
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
3446
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3447
|
+
} else if (typeof config.padding === 'number') {
|
|
3448
|
+
return config.padding;
|
|
3449
|
+
} else {
|
|
3450
|
+
if (config.padding.length === 0) {
|
|
3451
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3452
|
+
} else if (config.padding.length === 1) {
|
|
3453
|
+
return config.padding[0];
|
|
3454
|
+
} else if (config.padding.length === 2) {
|
|
3455
|
+
return config.padding[0];
|
|
3456
|
+
} else if (config.padding.length === 3) {
|
|
3457
|
+
return config.padding[0];
|
|
3458
|
+
} else {
|
|
3459
|
+
return config.padding[0];
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
};
|
|
3154
3463
|
|
|
3155
3464
|
/**
|
|
3156
3465
|
* Default values of the parameters of a diagram port.
|
|
@@ -3194,7 +3503,17 @@ class DiagramPort extends DiagramElement {
|
|
|
3194
3503
|
}
|
|
3195
3504
|
updateInView() {
|
|
3196
3505
|
var _a;
|
|
3197
|
-
(_a = this.model.canvas) === null || _a ===
|
|
3506
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updatePortsInView(this.id);
|
|
3507
|
+
}
|
|
3508
|
+
raise() {
|
|
3509
|
+
var _a;
|
|
3510
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
3511
|
+
for (const connection of this.incomingConnections) {
|
|
3512
|
+
connection.raise();
|
|
3513
|
+
}
|
|
3514
|
+
for (const connection of this.outgoingConnections) {
|
|
3515
|
+
connection.raise();
|
|
3516
|
+
}
|
|
3198
3517
|
}
|
|
3199
3518
|
/**
|
|
3200
3519
|
* Add a connection to this port's list of outgoing connections.
|
|
@@ -3227,7 +3546,7 @@ class DiagramPort extends DiagramElement {
|
|
|
3227
3546
|
}
|
|
3228
3547
|
getPriority() {
|
|
3229
3548
|
var _a;
|
|
3230
|
-
return ((_a = this.rootElement) === null || _a ===
|
|
3549
|
+
return ((_a = this.rootElement) === null || _a === undefined ? undefined : _a.getPriority()) || DEFAULT_PRIORITY;
|
|
3231
3550
|
}
|
|
3232
3551
|
/**
|
|
3233
3552
|
* Change the coordinates of this port to the given coordinates and move its labels correspondingly.
|
|
@@ -3333,7 +3652,7 @@ class DagaImporter {
|
|
|
3333
3652
|
return model;
|
|
3334
3653
|
}
|
|
3335
3654
|
importNode(model, node) {
|
|
3336
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
3655
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3337
3656
|
const newNodeType = model.nodes.types.get(node.type);
|
|
3338
3657
|
if (newNodeType) {
|
|
3339
3658
|
const newNode = new DiagramNode(model, newNodeType, node.coords, node.id);
|
|
@@ -3351,14 +3670,21 @@ class DagaImporter {
|
|
|
3351
3670
|
newField.updateInView();
|
|
3352
3671
|
}
|
|
3353
3672
|
}
|
|
3673
|
+
for (const child of node.children || []) {
|
|
3674
|
+
const newChild = this.importNode(model, child);
|
|
3675
|
+
if (newChild !== undefined) {
|
|
3676
|
+
(_a = newNode.children) === null || _a === undefined ? undefined : _a.push(newChild);
|
|
3677
|
+
newChild.parent = newNode;
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3354
3680
|
for (const section of node.sections || []) {
|
|
3355
3681
|
const newSection = new DiagramSection(model, newNode, section.indexXInNode, section.indexYInNode, section.coords, section.width, section.height, section.id);
|
|
3356
|
-
(
|
|
3682
|
+
(_b = newNode.sections) === null || _b === undefined ? undefined : _b.push(newSection);
|
|
3357
3683
|
model.sections.add(newSection);
|
|
3358
3684
|
if (section.label) {
|
|
3359
3685
|
// add section label
|
|
3360
|
-
if ((
|
|
3361
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (
|
|
3686
|
+
if ((_f = (_e = (_d = (_c = newNodeType.sectionGrid) === null || _c === undefined ? undefined : _c.sections) === null || _d === undefined ? undefined : _d[section.indexYInNode]) === null || _e === undefined ? undefined : _e[section.indexXInNode]) === null || _f === undefined ? undefined : _f.label) {
|
|
3687
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_k = (_j = (_h = (_g = newNodeType.sectionGrid) === null || _g === undefined ? undefined : _g.sections) === null || _h === undefined ? undefined : _h[section.indexYInNode]) === null || _j === undefined ? undefined : _j[section.indexXInNode]) === null || _k === undefined ? undefined : _k.label);
|
|
3362
3688
|
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);
|
|
3363
3689
|
newField.text = section.label;
|
|
3364
3690
|
newSection.label = newField;
|
|
@@ -3503,16 +3829,21 @@ class DagaImporter {
|
|
|
3503
3829
|
* @see AddNodeAction
|
|
3504
3830
|
*/
|
|
3505
3831
|
class AddNodeCollabAction {
|
|
3506
|
-
constructor(canvas, id, typeId, coords, label, values) {
|
|
3832
|
+
constructor(canvas, id, typeId, coords, parentId, label, values) {
|
|
3507
3833
|
this.canvas = canvas;
|
|
3508
3834
|
this.id = id;
|
|
3509
3835
|
this.typeId = typeId;
|
|
3510
3836
|
this.coords = coords;
|
|
3837
|
+
this.parentId = parentId;
|
|
3511
3838
|
this.label = label;
|
|
3512
3839
|
this.values = values;
|
|
3513
3840
|
}
|
|
3514
3841
|
do() {
|
|
3842
|
+
var _a;
|
|
3515
3843
|
const node = this.canvas.model.nodes.new(this.typeId, this.coords, this.id);
|
|
3844
|
+
if (this.parentId !== undefined) {
|
|
3845
|
+
(_a = this.canvas.model.nodes.get(this.parentId)) === null || _a === undefined ? undefined : _a.addChild(node);
|
|
3846
|
+
}
|
|
3516
3847
|
if (this.values !== undefined) {
|
|
3517
3848
|
node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
|
|
3518
3849
|
}
|
|
@@ -3526,12 +3857,45 @@ class AddNodeCollabAction {
|
|
|
3526
3857
|
id: this.id,
|
|
3527
3858
|
typeId: this.typeId,
|
|
3528
3859
|
coords: this.coords,
|
|
3860
|
+
parentId: this.parentId,
|
|
3529
3861
|
label: this.label,
|
|
3530
3862
|
values: this.values
|
|
3531
3863
|
};
|
|
3532
3864
|
}
|
|
3533
3865
|
static deserialize(canvas, serialized) {
|
|
3534
|
-
return new AddNodeCollabAction(canvas, serialized.id, serialized.typeId, serialized.coords, serialized.label, serialized.values);
|
|
3866
|
+
return new AddNodeCollabAction(canvas, serialized.id, serialized.typeId, serialized.coords, serialized.parentId, serialized.label, serialized.values);
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
/**
|
|
3870
|
+
* Collaborative which consists of applying a layout to the diagram which can change the location of several nodes.
|
|
3871
|
+
* @private
|
|
3872
|
+
* @see ApplyLayoutAction
|
|
3873
|
+
*/
|
|
3874
|
+
class ApplyLayoutCollabAction {
|
|
3875
|
+
constructor(canvas, to, timestamp) {
|
|
3876
|
+
this.canvas = canvas;
|
|
3877
|
+
this.to = to;
|
|
3878
|
+
this.timestamp = timestamp;
|
|
3879
|
+
}
|
|
3880
|
+
do() {
|
|
3881
|
+
for (const nodeId in this.to) {
|
|
3882
|
+
const node = this.canvas.model.nodes.get(nodeId, true);
|
|
3883
|
+
if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
|
|
3884
|
+
const point = this.to[nodeId];
|
|
3885
|
+
node.move([point[0], point[1]]);
|
|
3886
|
+
node.geometryTimestamp = this.timestamp;
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
serialize() {
|
|
3891
|
+
return {
|
|
3892
|
+
type: 'applyLayout',
|
|
3893
|
+
to: this.to,
|
|
3894
|
+
timestamp: this.timestamp
|
|
3895
|
+
};
|
|
3896
|
+
}
|
|
3897
|
+
static deserialize(canvas, serialized) {
|
|
3898
|
+
return new ApplyLayoutCollabAction(canvas, serialized.to, serialized.timestamp);
|
|
3535
3899
|
}
|
|
3536
3900
|
}
|
|
3537
3901
|
/**
|
|
@@ -3547,10 +3911,12 @@ class MoveCollabAction {
|
|
|
3547
3911
|
this.timestamp = timestamp;
|
|
3548
3912
|
}
|
|
3549
3913
|
do() {
|
|
3914
|
+
var _a;
|
|
3550
3915
|
for (const nodeId of this.nodeIds) {
|
|
3551
3916
|
const node = this.canvas.model.nodes.get(nodeId, true);
|
|
3552
3917
|
if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
|
|
3553
3918
|
node.move([node.coords[0] + this.delta[0], node.coords[1] + this.delta[1]]);
|
|
3919
|
+
(_a = node.parent) === null || _a === undefined ? undefined : _a.fitToChild(node);
|
|
3554
3920
|
node.geometryTimestamp = this.timestamp;
|
|
3555
3921
|
}
|
|
3556
3922
|
}
|
|
@@ -3580,19 +3946,20 @@ class SetGeometryCollabAction {
|
|
|
3580
3946
|
this.timestamp = timestamp;
|
|
3581
3947
|
}
|
|
3582
3948
|
do() {
|
|
3583
|
-
var _a, _b;
|
|
3949
|
+
var _a, _b, _c;
|
|
3584
3950
|
const node = this.canvas.model.nodes.get(this.nodeId, true);
|
|
3585
3951
|
if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
|
|
3586
3952
|
node.setGeometry(this.to);
|
|
3587
3953
|
// Re-fit the labels, in case their text has changed since `this.to` was measured.
|
|
3588
|
-
if ((_a = node.label) === null || _a ===
|
|
3954
|
+
if ((_a = node.label) === null || _a === undefined ? undefined : _a.fit) {
|
|
3589
3955
|
this.canvas.fitFieldRootInView(node.label.id);
|
|
3590
3956
|
}
|
|
3591
3957
|
for (const section of node.sections) {
|
|
3592
|
-
if ((_b = section.label) === null || _b ===
|
|
3958
|
+
if ((_b = section.label) === null || _b === undefined ? undefined : _b.fit) {
|
|
3593
3959
|
this.canvas.fitFieldRootInView(section.label.id);
|
|
3594
3960
|
}
|
|
3595
3961
|
}
|
|
3962
|
+
(_c = node.parent) === null || _c === undefined ? undefined : _c.fitToChild(node);
|
|
3596
3963
|
node.geometryTimestamp = this.timestamp;
|
|
3597
3964
|
}
|
|
3598
3965
|
}
|
|
@@ -3608,6 +3975,42 @@ class SetGeometryCollabAction {
|
|
|
3608
3975
|
return new SetGeometryCollabAction(canvas, serialized.nodeId, serialized.to, serialized.timestamp);
|
|
3609
3976
|
}
|
|
3610
3977
|
}
|
|
3978
|
+
/**
|
|
3979
|
+
* Collaborative action which consists of setting a node's parent.
|
|
3980
|
+
* @private
|
|
3981
|
+
* @see SetParentAction
|
|
3982
|
+
*/
|
|
3983
|
+
class SetParentCollabAction {
|
|
3984
|
+
constructor(canvas, childId, parentId, childGeometry, timestamp) {
|
|
3985
|
+
this.canvas = canvas;
|
|
3986
|
+
this.childId = childId;
|
|
3987
|
+
this.parentId = parentId;
|
|
3988
|
+
this.childGeometry = childGeometry;
|
|
3989
|
+
this.timestamp = timestamp;
|
|
3990
|
+
}
|
|
3991
|
+
do() {
|
|
3992
|
+
var _a;
|
|
3993
|
+
const childNode = this.canvas.model.nodes.get(this.childId, true);
|
|
3994
|
+
const parentNode = this.parentId !== undefined ? this.canvas.model.nodes.get(this.parentId, true) : undefined;
|
|
3995
|
+
if (childNode && (this.parentId !== undefined ? parentNode : true) && timestampWins(this.timestamp, childNode.geometryTimestamp)) {
|
|
3996
|
+
(_a = childNode.parent) === null || _a === undefined ? undefined : _a.removeChild(childNode);
|
|
3997
|
+
childNode.setGeometry(this.childGeometry);
|
|
3998
|
+
parentNode === null || parentNode === undefined ? undefined : parentNode.addChild(childNode);
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
serialize() {
|
|
4002
|
+
return {
|
|
4003
|
+
type: 'setParent',
|
|
4004
|
+
childId: this.childId,
|
|
4005
|
+
parentId: this.parentId,
|
|
4006
|
+
childGeometry: this.childGeometry,
|
|
4007
|
+
timestamp: this.timestamp
|
|
4008
|
+
};
|
|
4009
|
+
}
|
|
4010
|
+
static deserialize(canvas, serialized) {
|
|
4011
|
+
return new SetParentCollabAction(canvas, serialized.childId, serialized.parentId, serialized.childGeometry, serialized.timestamp);
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
3611
4014
|
/**
|
|
3612
4015
|
* Collaborative action which consists of adding a connection.
|
|
3613
4016
|
* @private
|
|
@@ -3689,12 +4092,12 @@ class UpdateValuesCollabAction {
|
|
|
3689
4092
|
if (this.id === undefined) {
|
|
3690
4093
|
return this.canvas.model.valueSet;
|
|
3691
4094
|
} else {
|
|
3692
|
-
return (_a = this.canvas.model.nodes.get(this.id, true) || this.canvas.model.connections.get(this.id, true)) === null || _a ===
|
|
4095
|
+
return (_a = this.canvas.model.nodes.get(this.id, true) || this.canvas.model.connections.get(this.id, true)) === null || _a === undefined ? undefined : _a.valueSet;
|
|
3693
4096
|
}
|
|
3694
4097
|
}
|
|
3695
4098
|
do() {
|
|
3696
4099
|
var _a;
|
|
3697
|
-
(_a = this.getValueSet()) === null || _a ===
|
|
4100
|
+
(_a = this.getValueSet()) === null || _a === undefined ? undefined : _a.overwriteValuesLww(this.to, this.timestamp);
|
|
3698
4101
|
}
|
|
3699
4102
|
serialize() {
|
|
3700
4103
|
return {
|
|
@@ -3879,6 +4282,12 @@ class CollabEngine {
|
|
|
3879
4282
|
action.do();
|
|
3880
4283
|
break;
|
|
3881
4284
|
}
|
|
4285
|
+
case 'applyLayout':
|
|
4286
|
+
{
|
|
4287
|
+
const action = ApplyLayoutCollabAction.deserialize(this.canvas, message);
|
|
4288
|
+
action.do();
|
|
4289
|
+
break;
|
|
4290
|
+
}
|
|
3882
4291
|
case 'move':
|
|
3883
4292
|
{
|
|
3884
4293
|
const action = MoveCollabAction.deserialize(this.canvas, message);
|
|
@@ -3891,6 +4300,12 @@ class CollabEngine {
|
|
|
3891
4300
|
action.do();
|
|
3892
4301
|
break;
|
|
3893
4302
|
}
|
|
4303
|
+
case 'setParent':
|
|
4304
|
+
{
|
|
4305
|
+
const action = SetParentCollabAction.deserialize(this.canvas, message);
|
|
4306
|
+
action.do();
|
|
4307
|
+
break;
|
|
4308
|
+
}
|
|
3894
4309
|
case 'addConnection':
|
|
3895
4310
|
{
|
|
3896
4311
|
const action = AddConnectionCollabAction.deserialize(this.canvas, message);
|
|
@@ -3931,7 +4346,7 @@ class CollabEngine {
|
|
|
3931
4346
|
}
|
|
3932
4347
|
|
|
3933
4348
|
/**
|
|
3934
|
-
* A stack of recent actions taken by the user
|
|
4349
|
+
* A stack of recent actions taken by the user.
|
|
3935
4350
|
* @private
|
|
3936
4351
|
*/
|
|
3937
4352
|
class ActionStack {
|
|
@@ -3956,37 +4371,60 @@ class ActionStack {
|
|
|
3956
4371
|
this.history.push(action);
|
|
3957
4372
|
++this.index;
|
|
3958
4373
|
}
|
|
3959
|
-
this.canvas.diagramChange$.next(
|
|
4374
|
+
this.canvas.diagramChange$.next({
|
|
4375
|
+
action,
|
|
4376
|
+
method: exports.DiagramActionMethod.Do
|
|
4377
|
+
});
|
|
3960
4378
|
}
|
|
3961
4379
|
/**
|
|
3962
4380
|
* Undoes the last action in the history, not counting undone actions.
|
|
3963
4381
|
* @private
|
|
3964
4382
|
*/
|
|
3965
4383
|
undo() {
|
|
4384
|
+
let action;
|
|
3966
4385
|
if (this.index > 0) {
|
|
3967
4386
|
let hasEffect;
|
|
3968
4387
|
do {
|
|
3969
4388
|
--this.index;
|
|
3970
|
-
|
|
4389
|
+
action = this.history[this.index];
|
|
4390
|
+
hasEffect = action.undo();
|
|
3971
4391
|
} while (!hasEffect && this.index > 0);
|
|
3972
4392
|
}
|
|
3973
|
-
this.canvas.diagramChange$.next(
|
|
4393
|
+
this.canvas.diagramChange$.next({
|
|
4394
|
+
action,
|
|
4395
|
+
method: exports.DiagramActionMethod.Undo
|
|
4396
|
+
});
|
|
3974
4397
|
}
|
|
3975
4398
|
/**
|
|
3976
4399
|
* Redoes the last undone action in the history.
|
|
3977
4400
|
* @private
|
|
3978
4401
|
*/
|
|
3979
4402
|
redo() {
|
|
4403
|
+
let action;
|
|
3980
4404
|
if (this.index < this.history.length) {
|
|
3981
4405
|
let hasEffect;
|
|
3982
4406
|
do {
|
|
3983
|
-
|
|
4407
|
+
action = this.history[this.index];
|
|
4408
|
+
hasEffect = action.redo();
|
|
3984
4409
|
++this.index;
|
|
3985
4410
|
} while (!hasEffect && this.index < this.history.length);
|
|
3986
4411
|
}
|
|
3987
|
-
this.canvas.diagramChange$.next(
|
|
4412
|
+
this.canvas.diagramChange$.next({
|
|
4413
|
+
action,
|
|
4414
|
+
method: exports.DiagramActionMethod.Redo
|
|
4415
|
+
});
|
|
3988
4416
|
}
|
|
3989
4417
|
}
|
|
4418
|
+
/**
|
|
4419
|
+
* The different methods of an action.
|
|
4420
|
+
* @private
|
|
4421
|
+
*/
|
|
4422
|
+
exports.DiagramActionMethod = void 0;
|
|
4423
|
+
(function (DiagramActionMethod) {
|
|
4424
|
+
DiagramActionMethod[DiagramActionMethod["Do"] = 0] = "Do";
|
|
4425
|
+
DiagramActionMethod[DiagramActionMethod["Undo"] = 1] = "Undo";
|
|
4426
|
+
DiagramActionMethod[DiagramActionMethod["Redo"] = 2] = "Redo";
|
|
4427
|
+
})(exports.DiagramActionMethod || (exports.DiagramActionMethod = {}));
|
|
3990
4428
|
/**
|
|
3991
4429
|
* Enum listing the actions that can be taken by the user.
|
|
3992
4430
|
* The actions can correspond to a DiagramAction that can be recorded in the action stack of a diagram or they may not correspond to any DiagramAction implementations.
|
|
@@ -4006,6 +4444,12 @@ exports.DiagramActions = void 0;
|
|
|
4006
4444
|
* @see AddNodeAction
|
|
4007
4445
|
*/
|
|
4008
4446
|
DiagramActions["AddNode"] = "add-node";
|
|
4447
|
+
/**
|
|
4448
|
+
* Action that corresponds to applying a layout which changes the location of several nodes.
|
|
4449
|
+
* @public
|
|
4450
|
+
* @see ApplyLayoutAction
|
|
4451
|
+
*/
|
|
4452
|
+
DiagramActions["ApplyLayout"] = "apply-layout";
|
|
4009
4453
|
/**
|
|
4010
4454
|
* Action that corresponds to copying diagram elements to the clipboard.
|
|
4011
4455
|
* @public
|
|
@@ -4071,17 +4515,25 @@ exports.DiagramActions = void 0;
|
|
|
4071
4515
|
* @see DiagramNode
|
|
4072
4516
|
*/
|
|
4073
4517
|
class AddNodeAction {
|
|
4074
|
-
constructor(canvas, type, coords, label, values) {
|
|
4518
|
+
constructor(canvas, type, coords, parentId, ancestorId, fromAncestorGeometry, toAncestorGeometry, label, values) {
|
|
4075
4519
|
this.canvas = canvas;
|
|
4076
4520
|
this.type = type;
|
|
4077
4521
|
this.coords = coords;
|
|
4522
|
+
this.parentId = parentId;
|
|
4523
|
+
this.ancestorId = ancestorId;
|
|
4524
|
+
this.fromAncestorGeometry = fromAncestorGeometry;
|
|
4525
|
+
this.toAncestorGeometry = toAncestorGeometry;
|
|
4078
4526
|
this.label = label;
|
|
4079
4527
|
this.values = values;
|
|
4080
4528
|
this.id = this.canvas.collabEngine.freshId();
|
|
4081
4529
|
}
|
|
4082
4530
|
do() {
|
|
4083
|
-
const collabAction = new AddNodeCollabAction(this.canvas, this.id, this.type.id, this.coords, this.label, this.values);
|
|
4531
|
+
const collabAction = new AddNodeCollabAction(this.canvas, this.id, this.type.id, this.coords, this.parentId, this.label, this.values);
|
|
4084
4532
|
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4533
|
+
if (this.ancestorId !== undefined && this.toAncestorGeometry !== undefined) {
|
|
4534
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4535
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4536
|
+
}
|
|
4085
4537
|
// creating a node always has an effect
|
|
4086
4538
|
return true;
|
|
4087
4539
|
}
|
|
@@ -4089,6 +4541,10 @@ class AddNodeAction {
|
|
|
4089
4541
|
const node = this.canvas.model.nodes.get(this.id);
|
|
4090
4542
|
const collabAction = new SetSelfRemovedCollabAction(this.canvas, [this.id], [], [], [], [], true, this.canvas.collabEngine.freshTimestamp());
|
|
4091
4543
|
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4544
|
+
if (this.ancestorId !== undefined && this.fromAncestorGeometry !== undefined) {
|
|
4545
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4546
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4547
|
+
}
|
|
4092
4548
|
// undoing creating a node has an effect if the node was not already removed
|
|
4093
4549
|
return node !== undefined;
|
|
4094
4550
|
}
|
|
@@ -4096,10 +4552,38 @@ class AddNodeAction {
|
|
|
4096
4552
|
const node = this.canvas.model.nodes.get(this.id);
|
|
4097
4553
|
const collabAction = new SetSelfRemovedCollabAction(this.canvas, [this.id], [], [], [], [], false, this.canvas.collabEngine.freshTimestamp());
|
|
4098
4554
|
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4555
|
+
if (this.ancestorId !== undefined && this.toAncestorGeometry !== undefined) {
|
|
4556
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4557
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4558
|
+
}
|
|
4099
4559
|
// redoing creating a node has an effect if the node was removed
|
|
4100
4560
|
return node === undefined;
|
|
4101
4561
|
}
|
|
4102
4562
|
}
|
|
4563
|
+
/**
|
|
4564
|
+
* Action which consists of applying a layout to the diagram which can change the location of several nodes.
|
|
4565
|
+
* @private
|
|
4566
|
+
*/
|
|
4567
|
+
class ApplyLayoutAction {
|
|
4568
|
+
constructor(canvas, from, to) {
|
|
4569
|
+
this.canvas = canvas;
|
|
4570
|
+
this.from = from;
|
|
4571
|
+
this.to = to;
|
|
4572
|
+
}
|
|
4573
|
+
do() {
|
|
4574
|
+
const collabAction = new ApplyLayoutCollabAction(this.canvas, this.to, this.canvas.collabEngine.freshTimestamp());
|
|
4575
|
+
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4576
|
+
return true;
|
|
4577
|
+
}
|
|
4578
|
+
undo() {
|
|
4579
|
+
const collabAction = new ApplyLayoutCollabAction(this.canvas, this.from, this.canvas.collabEngine.freshTimestamp());
|
|
4580
|
+
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4581
|
+
return true;
|
|
4582
|
+
}
|
|
4583
|
+
redo() {
|
|
4584
|
+
return this.do();
|
|
4585
|
+
}
|
|
4586
|
+
}
|
|
4103
4587
|
/**
|
|
4104
4588
|
* Action which consists of changing the coordinates of diagram elements by a fixed amount.
|
|
4105
4589
|
* @private
|
|
@@ -4130,17 +4614,26 @@ class MoveAction {
|
|
|
4130
4614
|
* @see DiagramNode
|
|
4131
4615
|
*/
|
|
4132
4616
|
class SetGeometryAction {
|
|
4133
|
-
constructor(canvas, intent, nodeId, from, to) {
|
|
4617
|
+
constructor(canvas, intent, nodeId, from, to, ancestorId, fromAncestorGeometry, toAncestorGeometry) {
|
|
4134
4618
|
this.canvas = canvas;
|
|
4135
4619
|
this.intent = intent;
|
|
4136
4620
|
this.nodeId = nodeId;
|
|
4137
4621
|
this.from = from;
|
|
4138
4622
|
this.to = to;
|
|
4623
|
+
this.ancestorId = ancestorId;
|
|
4624
|
+
this.fromAncestorGeometry = fromAncestorGeometry;
|
|
4625
|
+
this.toAncestorGeometry = toAncestorGeometry;
|
|
4139
4626
|
}
|
|
4140
4627
|
do() {
|
|
4141
4628
|
const node = this.canvas.model.nodes.get(this.nodeId);
|
|
4142
|
-
|
|
4143
|
-
|
|
4629
|
+
if (node) {
|
|
4630
|
+
const collabAction = new SetGeometryCollabAction(this.canvas, this.nodeId, this.to, this.canvas.collabEngine.freshTimestamp());
|
|
4631
|
+
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4632
|
+
if (this.ancestorId !== undefined && this.toAncestorGeometry !== undefined) {
|
|
4633
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4634
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4635
|
+
}
|
|
4636
|
+
}
|
|
4144
4637
|
return node !== undefined;
|
|
4145
4638
|
}
|
|
4146
4639
|
undo() {
|
|
@@ -4149,6 +4642,10 @@ class SetGeometryAction {
|
|
|
4149
4642
|
this.to = node.getGeometry();
|
|
4150
4643
|
const collabAction = new SetGeometryCollabAction(this.canvas, this.nodeId, this.from, this.canvas.collabEngine.freshTimestamp());
|
|
4151
4644
|
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4645
|
+
if (this.ancestorId !== undefined && this.fromAncestorGeometry !== undefined) {
|
|
4646
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4647
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4648
|
+
}
|
|
4152
4649
|
}
|
|
4153
4650
|
return node !== undefined;
|
|
4154
4651
|
}
|
|
@@ -4162,6 +4659,46 @@ class SetGeometryAction {
|
|
|
4162
4659
|
return node !== undefined;
|
|
4163
4660
|
}
|
|
4164
4661
|
}
|
|
4662
|
+
/**
|
|
4663
|
+
* Action which consists of setting a node's parent.
|
|
4664
|
+
* @private
|
|
4665
|
+
*/
|
|
4666
|
+
class SetParentAction {
|
|
4667
|
+
constructor(canvas, childId, fromParentId, toParentId, fromChildGeometry, toChildGeometry, ancestorId, fromAncestorGeometry, toAncestorGeometry) {
|
|
4668
|
+
this.canvas = canvas;
|
|
4669
|
+
this.childId = childId;
|
|
4670
|
+
this.fromParentId = fromParentId;
|
|
4671
|
+
this.toParentId = toParentId;
|
|
4672
|
+
this.fromChildGeometry = fromChildGeometry;
|
|
4673
|
+
this.toChildGeometry = toChildGeometry;
|
|
4674
|
+
this.ancestorId = ancestorId;
|
|
4675
|
+
this.fromAncestorGeometry = fromAncestorGeometry;
|
|
4676
|
+
this.toAncestorGeometry = toAncestorGeometry;
|
|
4677
|
+
}
|
|
4678
|
+
do() {
|
|
4679
|
+
const childNode = this.canvas.model.nodes.get(this.childId);
|
|
4680
|
+
const collabAction1 = new SetParentCollabAction(this.canvas, this.childId, this.toParentId, this.toChildGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4681
|
+
this.canvas.collabEngine.doCollaboratively(collabAction1);
|
|
4682
|
+
if (this.ancestorId !== undefined && this.toAncestorGeometry !== undefined) {
|
|
4683
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4684
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4685
|
+
}
|
|
4686
|
+
return childNode !== undefined;
|
|
4687
|
+
}
|
|
4688
|
+
undo() {
|
|
4689
|
+
const childNode = this.canvas.model.nodes.get(this.childId);
|
|
4690
|
+
const collabAction1 = new SetParentCollabAction(this.canvas, this.childId, this.fromParentId, this.fromChildGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4691
|
+
this.canvas.collabEngine.doCollaboratively(collabAction1);
|
|
4692
|
+
if (this.ancestorId !== undefined && this.fromAncestorGeometry !== undefined) {
|
|
4693
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4694
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4695
|
+
}
|
|
4696
|
+
return childNode !== undefined;
|
|
4697
|
+
}
|
|
4698
|
+
redo() {
|
|
4699
|
+
return this.do();
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4165
4702
|
/**
|
|
4166
4703
|
* Action which consists of adding a connection.
|
|
4167
4704
|
* @private
|
|
@@ -4426,21 +4963,97 @@ class PasteAction {
|
|
|
4426
4963
|
}
|
|
4427
4964
|
|
|
4428
4965
|
/**
|
|
4429
|
-
* Represents an action taken by the user on the diagram.
|
|
4966
|
+
* Represents an action taken by the user on the diagram which doesn't have an impact on the diagram's model.
|
|
4967
|
+
* Contrast with {@link DiagramAction} which does have an impact on the diagram's model.
|
|
4430
4968
|
* @public
|
|
4431
4969
|
*/
|
|
4432
4970
|
class DiagramEvent {
|
|
4433
|
-
constructor(
|
|
4434
|
-
this.cause = cause;
|
|
4971
|
+
constructor(type) {
|
|
4435
4972
|
this.type = type;
|
|
4436
|
-
this.target = target;
|
|
4437
|
-
this.coords = coords;
|
|
4438
4973
|
this.defaultPrevented = false;
|
|
4439
4974
|
}
|
|
4440
4975
|
preventDefault() {
|
|
4441
4976
|
this.defaultPrevented = true;
|
|
4442
4977
|
}
|
|
4443
4978
|
}
|
|
4979
|
+
/**
|
|
4980
|
+
* Diagram user events.
|
|
4981
|
+
* @public
|
|
4982
|
+
*/
|
|
4983
|
+
exports.DiagramEvents = void 0;
|
|
4984
|
+
(function (DiagramEvents) {
|
|
4985
|
+
DiagramEvents[DiagramEvents["DoubleClick"] = 0] = "DoubleClick";
|
|
4986
|
+
DiagramEvents[DiagramEvents["SecondaryClick"] = 1] = "SecondaryClick";
|
|
4987
|
+
DiagramEvents[DiagramEvents["Selection"] = 2] = "Selection";
|
|
4988
|
+
DiagramEvents[DiagramEvents["Highlight"] = 3] = "Highlight";
|
|
4989
|
+
})(exports.DiagramEvents || (exports.DiagramEvents = {}));
|
|
4990
|
+
/**
|
|
4991
|
+
* Diagram event which consists of the user performing a double click on the diagram.
|
|
4992
|
+
*/
|
|
4993
|
+
class DiagramDoubleClickEvent extends DiagramEvent {
|
|
4994
|
+
/**
|
|
4995
|
+
* Create a diagram double click event.
|
|
4996
|
+
*
|
|
4997
|
+
* @param cause Mouse event which triggered this event.
|
|
4998
|
+
* @param target Diagram element which is targeted by the event, or null if no element was targeted (the diagram background was targeted).
|
|
4999
|
+
* @param coords Optionally, coordinates of the point of the diagram where the event happened.
|
|
5000
|
+
*/
|
|
5001
|
+
constructor(cause, target, coords) {
|
|
5002
|
+
super(exports.DiagramEvents.DoubleClick);
|
|
5003
|
+
this.cause = cause;
|
|
5004
|
+
this.target = target;
|
|
5005
|
+
this.coords = coords;
|
|
5006
|
+
}
|
|
5007
|
+
}
|
|
5008
|
+
/**
|
|
5009
|
+
* Diagram event which consists of the user performing a secondary click on the diagram.
|
|
5010
|
+
*/
|
|
5011
|
+
class DiagramSecondaryClickEvent extends DiagramEvent {
|
|
5012
|
+
/**
|
|
5013
|
+
* Create a diagram secondary click event.
|
|
5014
|
+
*
|
|
5015
|
+
* @param cause Mouse event which triggered this event.
|
|
5016
|
+
* @param target Diagram element which is targeted by the event, or null if no element was targeted (the diagram background was targeted).
|
|
5017
|
+
* @param coords Optionally, coordinates of the point of the diagram where the event happened.
|
|
5018
|
+
*/
|
|
5019
|
+
constructor(cause, target, coords) {
|
|
5020
|
+
super(exports.DiagramEvents.SecondaryClick);
|
|
5021
|
+
this.cause = cause;
|
|
5022
|
+
this.target = target;
|
|
5023
|
+
this.coords = coords;
|
|
5024
|
+
}
|
|
5025
|
+
}
|
|
5026
|
+
/**
|
|
5027
|
+
* Diagram event which consists of the user either adding or removing one or several diagram elements from the user selection.
|
|
5028
|
+
*/
|
|
5029
|
+
class DiagramSelectionEvent extends DiagramEvent {
|
|
5030
|
+
/**
|
|
5031
|
+
* Create a diagram selection event.
|
|
5032
|
+
*
|
|
5033
|
+
* @param targets Diagram elements which are targeted by the event.
|
|
5034
|
+
* @param selected `true` if the targets were selected, `false` if the targets were deselected.
|
|
5035
|
+
*/
|
|
5036
|
+
constructor(targets, selected) {
|
|
5037
|
+
super(exports.DiagramEvents.Selection);
|
|
5038
|
+
this.targets = targets;
|
|
5039
|
+
this.selected = selected;
|
|
5040
|
+
}
|
|
5041
|
+
}
|
|
5042
|
+
/**
|
|
5043
|
+
* Diagram event which consists of the user highlighting a diagram element.
|
|
5044
|
+
* If the target is `null`, that means that the previously highlighted element was unhighlighted.
|
|
5045
|
+
*/
|
|
5046
|
+
class DiagramHighlightedEvent extends DiagramEvent {
|
|
5047
|
+
/**
|
|
5048
|
+
* Create a diagram highlight event.
|
|
5049
|
+
*
|
|
5050
|
+
* @param target Diagram element which is targeted by the event.
|
|
5051
|
+
*/
|
|
5052
|
+
constructor(target) {
|
|
5053
|
+
super(exports.DiagramEvents.Highlight);
|
|
5054
|
+
this.target = target;
|
|
5055
|
+
}
|
|
5056
|
+
}
|
|
4444
5057
|
|
|
4445
5058
|
/**
|
|
4446
5059
|
* A foreign object which is inserted with arbitrary html into a diagram.
|
|
@@ -4466,14 +5079,18 @@ class DiagramDecorator extends DiagramElement {
|
|
|
4466
5079
|
}
|
|
4467
5080
|
select() {
|
|
4468
5081
|
var _a, _b;
|
|
4469
|
-
return (_b = (_a = this.model.canvas) === null || _a ===
|
|
5082
|
+
return (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.selectCanvasView()) === null || _b === undefined ? undefined : _b.select(`foreignObject#${this.id}`);
|
|
4470
5083
|
}
|
|
4471
5084
|
get removed() {
|
|
4472
5085
|
return this.selfRemoved || this.rootElement !== undefined && this.rootElement.removed;
|
|
4473
5086
|
}
|
|
4474
5087
|
updateInView() {
|
|
4475
5088
|
var _a;
|
|
4476
|
-
(_a = this.model.canvas) === null || _a ===
|
|
5089
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateDecoratorsInView(this.id);
|
|
5090
|
+
}
|
|
5091
|
+
raise() {
|
|
5092
|
+
var _a;
|
|
5093
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
4477
5094
|
}
|
|
4478
5095
|
/**
|
|
4479
5096
|
* Change the coordinates of this decorator to the given coordinates.
|
|
@@ -4545,14 +5162,18 @@ class DiagramObject extends DiagramElement {
|
|
|
4545
5162
|
}
|
|
4546
5163
|
select() {
|
|
4547
5164
|
var _a, _b;
|
|
4548
|
-
return (_b = (_a = this.model.canvas) === null || _a ===
|
|
5165
|
+
return (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.selectCanvasView()) === null || _b === undefined ? undefined : _b.select(`foreignObject#${this.id}`);
|
|
4549
5166
|
}
|
|
4550
5167
|
get removed() {
|
|
4551
5168
|
return this.selfRemoved;
|
|
4552
5169
|
}
|
|
4553
5170
|
updateInView() {
|
|
4554
5171
|
var _a;
|
|
4555
|
-
(_a = this.model.canvas) === null || _a ===
|
|
5172
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateObjectsInView(this.id);
|
|
5173
|
+
}
|
|
5174
|
+
raise() {
|
|
5175
|
+
var _a;
|
|
5176
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
4556
5177
|
}
|
|
4557
5178
|
/**
|
|
4558
5179
|
* Change the coordinates of this object to the given coordinates.
|
|
@@ -4662,7 +5283,7 @@ class DiagramModel {
|
|
|
4662
5283
|
*/
|
|
4663
5284
|
clear() {
|
|
4664
5285
|
var _a, _b;
|
|
4665
|
-
(_a = this.canvas) === null || _a ===
|
|
5286
|
+
(_a = this.canvas) === null || _a === undefined ? undefined : _a.cancelAllUserActions();
|
|
4666
5287
|
this.id = undefined;
|
|
4667
5288
|
this.name = '';
|
|
4668
5289
|
this.description = undefined;
|
|
@@ -4677,7 +5298,7 @@ class DiagramModel {
|
|
|
4677
5298
|
this.objects.clear();
|
|
4678
5299
|
this.decorators.clear();
|
|
4679
5300
|
this.valueSet.resetValues();
|
|
4680
|
-
(_b = this.canvas) === null || _b ===
|
|
5301
|
+
(_b = this.canvas) === null || _b === undefined ? undefined : _b.updateModelInView();
|
|
4681
5302
|
}
|
|
4682
5303
|
}
|
|
4683
5304
|
|
|
@@ -4806,7 +5427,7 @@ class DiagramContextMenu {
|
|
|
4806
5427
|
*/
|
|
4807
5428
|
close() {
|
|
4808
5429
|
var _a;
|
|
4809
|
-
(_a = this.contextMenuContainer) === null || _a ===
|
|
5430
|
+
(_a = this.contextMenuContainer) === null || _a === undefined ? undefined : _a.remove();
|
|
4810
5431
|
this.contextMenuContainer = undefined;
|
|
4811
5432
|
}
|
|
4812
5433
|
}
|
|
@@ -4921,6 +5542,7 @@ class DagaExporter {
|
|
|
4921
5542
|
}
|
|
4922
5543
|
for (const node of model.nodes.all(true)) {
|
|
4923
5544
|
if (!includeCollabMeta && node.removed) continue;
|
|
5545
|
+
if (node.parent !== undefined) continue;
|
|
4924
5546
|
result.nodes.push(this.exportNode(node, includeCollabMeta));
|
|
4925
5547
|
}
|
|
4926
5548
|
for (const connection of model.connections.all(true)) {
|
|
@@ -4931,6 +5553,10 @@ class DagaExporter {
|
|
|
4931
5553
|
}
|
|
4932
5554
|
exportNode(node, includeCollabMeta = false) {
|
|
4933
5555
|
var _a, _b, _c, _d;
|
|
5556
|
+
const children = [];
|
|
5557
|
+
for (const child of node.children) {
|
|
5558
|
+
children.push(this.exportNode(child, includeCollabMeta));
|
|
5559
|
+
}
|
|
4934
5560
|
const sections = [];
|
|
4935
5561
|
for (const section of node.sections) {
|
|
4936
5562
|
const ports = [];
|
|
@@ -4939,7 +5565,7 @@ class DagaExporter {
|
|
|
4939
5565
|
id: port.id,
|
|
4940
5566
|
coords: roundPoint(port.coords),
|
|
4941
5567
|
direction: port.direction,
|
|
4942
|
-
label: ((_a = port.label) === null || _a ===
|
|
5568
|
+
label: ((_a = port.label) === null || _a === undefined ? undefined : _a.text) || ''
|
|
4943
5569
|
}, includeCollabMeta ? {
|
|
4944
5570
|
collabMeta: Object.assign({
|
|
4945
5571
|
removed: port.removed,
|
|
@@ -4951,7 +5577,7 @@ class DagaExporter {
|
|
|
4951
5577
|
sections.push(Object.assign({
|
|
4952
5578
|
id: section.id,
|
|
4953
5579
|
ports,
|
|
4954
|
-
label: ((_b = section.label) === null || _b ===
|
|
5580
|
+
label: ((_b = section.label) === null || _b === undefined ? undefined : _b.text) || '',
|
|
4955
5581
|
indexXInNode: section.indexXInNode,
|
|
4956
5582
|
indexYInNode: section.indexYInNode,
|
|
4957
5583
|
coords: roundPoint(section.coords),
|
|
@@ -4971,7 +5597,7 @@ class DagaExporter {
|
|
|
4971
5597
|
id: port.id,
|
|
4972
5598
|
coords: roundPoint(port.coords),
|
|
4973
5599
|
direction: port.direction,
|
|
4974
|
-
label: ((_c = port.label) === null || _c ===
|
|
5600
|
+
label: ((_c = port.label) === null || _c === undefined ? undefined : _c.text) || ''
|
|
4975
5601
|
}, includeCollabMeta ? {
|
|
4976
5602
|
collabMeta: Object.assign({
|
|
4977
5603
|
removed: port.removed,
|
|
@@ -4983,9 +5609,10 @@ class DagaExporter {
|
|
|
4983
5609
|
return Object.assign({
|
|
4984
5610
|
id: node.id,
|
|
4985
5611
|
type: node.type.id,
|
|
5612
|
+
children,
|
|
4986
5613
|
sections,
|
|
4987
5614
|
ports,
|
|
4988
|
-
label: ((_d = node.label) === null || _d ===
|
|
5615
|
+
label: ((_d = node.label) === null || _d === undefined ? undefined : _d.text) || '',
|
|
4989
5616
|
coords: roundPoint(node.coords),
|
|
4990
5617
|
width: node.width,
|
|
4991
5618
|
height: node.height,
|
|
@@ -5005,8 +5632,8 @@ class DagaExporter {
|
|
|
5005
5632
|
return Object.assign({
|
|
5006
5633
|
id: connection.id,
|
|
5007
5634
|
type: connection.type.id,
|
|
5008
|
-
start: ((_a = connection.start) === null || _a ===
|
|
5009
|
-
end: ((_b = connection.end) === null || _b ===
|
|
5635
|
+
start: ((_a = connection.start) === null || _a === undefined ? undefined : _a.id) || '',
|
|
5636
|
+
end: ((_b = connection.end) === null || _b === undefined ? undefined : _b.id) || '',
|
|
5010
5637
|
startLabel: connection.startLabel,
|
|
5011
5638
|
middleLabel: connection.middleLabel,
|
|
5012
5639
|
endLabel: connection.endLabel,
|
|
@@ -5226,11 +5853,11 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
5226
5853
|
openInPropertyEditor(selection) {
|
|
5227
5854
|
var _a;
|
|
5228
5855
|
this.makeUpdateValuesAction();
|
|
5229
|
-
const propertyEditor = (_a = this.canvas.parentComponent) === null || _a ===
|
|
5856
|
+
const propertyEditor = (_a = this.canvas.parentComponent) === null || _a === undefined ? undefined : _a.propertyEditor;
|
|
5230
5857
|
if (propertyEditor === undefined) {
|
|
5231
5858
|
return;
|
|
5232
5859
|
}
|
|
5233
|
-
const selectedValueSet = selection === null || selection ===
|
|
5860
|
+
const selectedValueSet = selection === null || selection === undefined ? undefined : selection.valueSet;
|
|
5234
5861
|
if (selectedValueSet) {
|
|
5235
5862
|
this.propertyEditorSelection = selection;
|
|
5236
5863
|
this.propertyEditorValues = structuredClone(selectedValueSet.getValues());
|
|
@@ -5272,11 +5899,11 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
5272
5899
|
const previousSelectionId = this.propertyEditorSelection instanceof DiagramModel ? undefined : this.propertyEditorSelection.id;
|
|
5273
5900
|
// check if there have been changes in the previously selected ValueSet,
|
|
5274
5901
|
// and create an UpdateValuesAction if there have
|
|
5275
|
-
if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a ===
|
|
5902
|
+
if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a === undefined ? undefined : _a.valueSet.getValues())) {
|
|
5276
5903
|
return;
|
|
5277
5904
|
}
|
|
5278
5905
|
const from = this.propertyEditorValues;
|
|
5279
|
-
const to = structuredClone((_b = this.propertyEditorSelection) === null || _b ===
|
|
5906
|
+
const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === undefined ? undefined : _b.valueSet.getValues());
|
|
5280
5907
|
const [fromDiff, toDiff] = diff(from, to);
|
|
5281
5908
|
const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
|
|
5282
5909
|
currentAction.do();
|
|
@@ -5311,7 +5938,7 @@ class DiagramCanvas {
|
|
|
5311
5938
|
var _a, _b;
|
|
5312
5939
|
this._connectionType = value;
|
|
5313
5940
|
// refresh the palette every time connectionType is set so that the palette keeps track of updates to the connectionType
|
|
5314
|
-
(_b = (_a = this.parentComponent) === null || _a ===
|
|
5941
|
+
(_b = (_a = this.parentComponent) === null || _a === undefined ? undefined : _a.palette) === null || _b === undefined ? undefined : _b.refreshPalette();
|
|
5315
5942
|
}
|
|
5316
5943
|
/**
|
|
5317
5944
|
* Constructs a canvas object.
|
|
@@ -5332,24 +5959,23 @@ class DiagramCanvas {
|
|
|
5332
5959
|
this.viewInitialized$ = new rxjs.Subject();
|
|
5333
5960
|
this.validatorChange$ = new rxjs.Subject();
|
|
5334
5961
|
this.diagramChange$ = new rxjs.Subject();
|
|
5335
|
-
this.diagramImportantChange$ = new rxjs.Subject();
|
|
5336
|
-
this.propertyEditorChanges$ = new rxjs.Subject();
|
|
5337
5962
|
this.diagramEvent$ = new rxjs.Subject();
|
|
5963
|
+
this.propertyEditorChanges$ = new rxjs.Subject();
|
|
5338
5964
|
this.parentComponent = parentComponent;
|
|
5339
5965
|
this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
|
|
5340
5966
|
this.userSelection = new DiagramUserSelection(this);
|
|
5341
5967
|
this.userHighlight = new DiagramUserHighlight(this);
|
|
5342
5968
|
this.contextMenu = new DiagramContextMenu(this);
|
|
5343
|
-
this.backgroundColor = ((_a = config.canvas) === null || _a ===
|
|
5344
|
-
this.gridSize = ((_c = (_b = config.canvas) === null || _b ===
|
|
5345
|
-
this.gridThickness = Math.abs(((_h = (_g = config.canvas) === null || _g ===
|
|
5346
|
-
this.gridColor = ((_k = (_j = config.canvas) === null || _j ===
|
|
5347
|
-
this.snapToGrid = ((_m = (_l = config.canvas) === null || _l ===
|
|
5348
|
-
this.zoomFactor = ((_r = config.canvas) === null || _r ===
|
|
5349
|
-
this.panRate = ((_s = config.canvas) === null || _s ===
|
|
5969
|
+
this.backgroundColor = ((_a = config.canvas) === null || _a === undefined ? undefined : _a.backgroundColor) || '#FFFFFF';
|
|
5970
|
+
this.gridSize = ((_c = (_b = config.canvas) === null || _b === undefined ? undefined : _b.grid) === null || _c === undefined ? undefined : _c.enabled) === false || ((_d = config.canvas) === null || _d === undefined ? undefined : _d.grid) === undefined ? 0 : Math.abs(((_f = (_e = config.canvas) === null || _e === undefined ? undefined : _e.grid) === null || _f === undefined ? undefined : _f.spacing) || 10);
|
|
5971
|
+
this.gridThickness = Math.abs(((_h = (_g = config.canvas) === null || _g === undefined ? undefined : _g.grid) === null || _h === undefined ? undefined : _h.thickness) || 0.05);
|
|
5972
|
+
this.gridColor = ((_k = (_j = config.canvas) === null || _j === undefined ? undefined : _j.grid) === null || _k === undefined ? undefined : _k.color) || 'rgba(0, 0, 0, 0.1)';
|
|
5973
|
+
this.snapToGrid = ((_m = (_l = config.canvas) === null || _l === undefined ? undefined : _l.grid) === null || _m === undefined ? undefined : _m.enabled) === false || ((_o = config.canvas) === null || _o === undefined ? undefined : _o.grid) === undefined ? false : ((_q = (_p = config.canvas) === null || _p === undefined ? undefined : _p.grid) === null || _q === undefined ? undefined : _q.snap) || false;
|
|
5974
|
+
this.zoomFactor = ((_r = config.canvas) === null || _r === undefined ? undefined : _r.zoomFactor) || 2;
|
|
5975
|
+
this.panRate = ((_s = config.canvas) === null || _s === undefined ? undefined : _s.panRate) || 100;
|
|
5350
5976
|
this.inferConnectionType = config.inferConnectionType || false;
|
|
5351
5977
|
this.multipleSelectionOn = false;
|
|
5352
|
-
this.priorityThresholds = ((_t = config.canvas) === null || _t ===
|
|
5978
|
+
this.priorityThresholds = ((_t = config.canvas) === null || _t === undefined ? undefined : _t.priorityThresholds) || [];
|
|
5353
5979
|
this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
|
|
5354
5980
|
this.layoutFormat = config.layoutFormat;
|
|
5355
5981
|
this.userActions = config.userActions || {};
|
|
@@ -5393,7 +6019,7 @@ class DiagramCanvas {
|
|
|
5393
6019
|
for (const node of this.model.nodes) {
|
|
5394
6020
|
this.fitNodeInView(node.id);
|
|
5395
6021
|
}
|
|
5396
|
-
(_b = (_a = this.parentComponent) === null || _a ===
|
|
6022
|
+
(_b = (_a = this.parentComponent) === null || _a === undefined ? undefined : _a.palette) === null || _b === undefined ? undefined : _b.refreshPalette();
|
|
5397
6023
|
}
|
|
5398
6024
|
// View methods
|
|
5399
6025
|
initView(appendTo) {
|
|
@@ -5404,7 +6030,7 @@ class DiagramCanvas {
|
|
|
5404
6030
|
var _a;
|
|
5405
6031
|
// focus on the diagram when clicking so that we can focus on the diagram
|
|
5406
6032
|
// keyboard events only work if we're focusing on the diagram
|
|
5407
|
-
(_a = d3__namespace.select(this.diagramRoot).node()) === null || _a ===
|
|
6033
|
+
(_a = d3__namespace.select(this.diagramRoot).node()) === null || _a === undefined ? undefined : _a.focus();
|
|
5408
6034
|
}).on(exports.Events.ContextMenu, event => {
|
|
5409
6035
|
if (this.dragging) {
|
|
5410
6036
|
event.preventDefault();
|
|
@@ -5412,14 +6038,14 @@ class DiagramCanvas {
|
|
|
5412
6038
|
this.dragging = false;
|
|
5413
6039
|
return;
|
|
5414
6040
|
}
|
|
5415
|
-
const diagramEvent = new
|
|
6041
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, null);
|
|
5416
6042
|
this.diagramEvent$.next(diagramEvent);
|
|
5417
6043
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
5418
6044
|
event.preventDefault();
|
|
5419
6045
|
this.contextMenu.open(event);
|
|
5420
6046
|
}
|
|
5421
6047
|
}).on(exports.Events.DoubleClick, event => {
|
|
5422
|
-
const diagramEvent = new
|
|
6048
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, null);
|
|
5423
6049
|
this.diagramEvent$.next(diagramEvent);
|
|
5424
6050
|
}).on(exports.Events.KeyDown, event => {
|
|
5425
6051
|
if (!event.ctrlKey && (event.key === exports.Keys.Delete || event.key === exports.Keys.Backspace) && this.canUserPerformAction(exports.DiagramActions.Remove)) {
|
|
@@ -5435,15 +6061,34 @@ class DiagramCanvas {
|
|
|
5435
6061
|
for (const connection of this.model.connections) {
|
|
5436
6062
|
this.userSelection.add(connection);
|
|
5437
6063
|
}
|
|
6064
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(this.userSelection.all(), true));
|
|
5438
6065
|
}
|
|
5439
6066
|
if (event.ctrlKey && event.key === 'i') {
|
|
5440
6067
|
event.preventDefault();
|
|
5441
6068
|
// invert selection
|
|
6069
|
+
const selectedElements = [];
|
|
6070
|
+
const deselectedElements = [];
|
|
5442
6071
|
for (const node of this.model.nodes) {
|
|
5443
6072
|
this.userSelection.toggle(node);
|
|
6073
|
+
if (node.selected) {
|
|
6074
|
+
selectedElements.push(node);
|
|
6075
|
+
} else {
|
|
6076
|
+
deselectedElements.push(node);
|
|
6077
|
+
}
|
|
5444
6078
|
}
|
|
5445
6079
|
for (const connection of this.model.connections) {
|
|
5446
6080
|
this.userSelection.toggle(connection);
|
|
6081
|
+
if (connection.selected) {
|
|
6082
|
+
selectedElements.push(connection);
|
|
6083
|
+
} else {
|
|
6084
|
+
deselectedElements.push(connection);
|
|
6085
|
+
}
|
|
6086
|
+
}
|
|
6087
|
+
if (selectedElements.length > 0) {
|
|
6088
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(selectedElements, true));
|
|
6089
|
+
}
|
|
6090
|
+
if (deselectedElements.length > 0) {
|
|
6091
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
5447
6092
|
}
|
|
5448
6093
|
}
|
|
5449
6094
|
if (event.ctrlKey && event.key === 'c') {
|
|
@@ -5488,12 +6133,12 @@ class DiagramCanvas {
|
|
|
5488
6133
|
if (event.key === exports.Keys.ArrowLeft) {
|
|
5489
6134
|
event.preventDefault();
|
|
5490
6135
|
// move left, faster if we're zoomed out and slower if we're zoomed in
|
|
5491
|
-
this.translateBy(
|
|
6136
|
+
this.translateBy(this.panRate / this.zoomTransform.k, 0);
|
|
5492
6137
|
}
|
|
5493
6138
|
if (event.key === exports.Keys.ArrowRight) {
|
|
5494
6139
|
event.preventDefault();
|
|
5495
6140
|
// move right, faster if we're zoomed out and slower if we're zoomed in
|
|
5496
|
-
this.translateBy(this.panRate / this.zoomTransform.k, 0);
|
|
6141
|
+
this.translateBy(-this.panRate / this.zoomTransform.k, 0);
|
|
5497
6142
|
}
|
|
5498
6143
|
if (event.key === exports.Keys.ArrowDown) {
|
|
5499
6144
|
event.preventDefault();
|
|
@@ -5513,12 +6158,22 @@ class DiagramCanvas {
|
|
|
5513
6158
|
this.unfinishedConnection.endCoords = pointerCoords;
|
|
5514
6159
|
}
|
|
5515
6160
|
}).on(exports.Events.MouseOver, () => {
|
|
5516
|
-
this.userHighlight.
|
|
6161
|
+
if (this.userHighlight.size() > 0) {
|
|
6162
|
+
this.userHighlight.clear();
|
|
6163
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(null));
|
|
6164
|
+
}
|
|
5517
6165
|
}).on(exports.Events.Click, () => {
|
|
5518
|
-
this.userHighlight.
|
|
6166
|
+
if (this.userHighlight.size() > 0) {
|
|
6167
|
+
this.userHighlight.clear();
|
|
6168
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(null));
|
|
6169
|
+
}
|
|
5519
6170
|
this.contextMenu.close();
|
|
5520
|
-
this.userSelection.
|
|
5521
|
-
|
|
6171
|
+
if (this.userSelection.size() > 0) {
|
|
6172
|
+
const deselectedElements = this.userSelection.all();
|
|
6173
|
+
this.userSelection.clear();
|
|
6174
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
6175
|
+
this.userSelection.openInPropertyEditor(this.model);
|
|
6176
|
+
}
|
|
5522
6177
|
}).call(d3__namespace.drag().filter(event => {
|
|
5523
6178
|
return this.multipleSelectionOn || isSecondaryButton(event);
|
|
5524
6179
|
}).on(exports.DragEvents.Start, event => {
|
|
@@ -5560,14 +6215,7 @@ class DiagramCanvas {
|
|
|
5560
6215
|
canvasBackgroundPattern.append('circle').attr('cx', this.gridSize / 2).attr('cy', this.gridSize / 2).attr('r', this.gridSize * this.gridThickness).attr('fill', this.gridColor);
|
|
5561
6216
|
canvasBackground.attr('fill', `url(#${this.backgroundPatternId})`);
|
|
5562
6217
|
}
|
|
5563
|
-
|
|
5564
|
-
canvasElements.append('g').attr('class', 'daga-canvas-nodes');
|
|
5565
|
-
canvasElements.append('g').attr('class', 'daga-canvas-sections');
|
|
5566
|
-
canvasElements.append('g').attr('class', 'daga-canvas-ports');
|
|
5567
|
-
canvasElements.append('g').attr('class', 'daga-canvas-connections');
|
|
5568
|
-
canvasElements.append('g').attr('class', 'daga-canvas-fields');
|
|
5569
|
-
canvasElements.append('g').attr('class', 'daga-canvas-objects');
|
|
5570
|
-
canvasElements.append('g').attr('class', 'daga-canvas-decorators');
|
|
6218
|
+
canvasView.append('g').attr('class', 'daga-canvas-elements');
|
|
5571
6219
|
this.viewInitialized$.next();
|
|
5572
6220
|
}
|
|
5573
6221
|
zoomBy(factor) {
|
|
@@ -5625,8 +6273,8 @@ class DiagramCanvas {
|
|
|
5625
6273
|
}
|
|
5626
6274
|
getCoordinatesOnScreen() {
|
|
5627
6275
|
var _a;
|
|
5628
|
-
const rootBoundingClientRect = (_a = this.selectRoot().node()) === null || _a ===
|
|
5629
|
-
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect ===
|
|
6276
|
+
const rootBoundingClientRect = (_a = this.selectRoot().node()) === null || _a === undefined ? undefined : _a.getBoundingClientRect();
|
|
6277
|
+
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.height) || 0];
|
|
5630
6278
|
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]];
|
|
5631
6279
|
}
|
|
5632
6280
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5668,7 +6316,7 @@ class DiagramCanvas {
|
|
|
5668
6316
|
this.updateDecoratorsInView();
|
|
5669
6317
|
}
|
|
5670
6318
|
updateNodesInView(...ids) {
|
|
5671
|
-
let updateSelection = this.
|
|
6319
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-node').data(this.model.nodes.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
5672
6320
|
const exitSelection = updateSelection.exit();
|
|
5673
6321
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-node${d.type.resizableX ? ' resizable-x' : ''}${d.type.resizableY ? ' resizable-y' : ''} ${d.type.look.lookType}`);
|
|
5674
6322
|
if (ids && ids.length > 0) {
|
|
@@ -5679,12 +6327,16 @@ class DiagramCanvas {
|
|
|
5679
6327
|
enterSelection.on(exports.Events.MouseOver, (_event, d) => {
|
|
5680
6328
|
if (!this.dragging) {
|
|
5681
6329
|
this.userHighlight.focusOn(d);
|
|
6330
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
5682
6331
|
}
|
|
5683
6332
|
}).on(exports.Events.Click, (event, d) => {
|
|
5684
6333
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
6334
|
+
const deselectedElements = this.userSelection.all();
|
|
5685
6335
|
this.userSelection.clear();
|
|
6336
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
5686
6337
|
}
|
|
5687
6338
|
this.userSelection.toggle(d);
|
|
6339
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
|
|
5688
6340
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
5689
6341
|
if (this.dragging) {
|
|
5690
6342
|
event.preventDefault();
|
|
@@ -5692,16 +6344,18 @@ class DiagramCanvas {
|
|
|
5692
6344
|
this.dragging = false;
|
|
5693
6345
|
return;
|
|
5694
6346
|
}
|
|
5695
|
-
const diagramEvent = new
|
|
6347
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
5696
6348
|
this.diagramEvent$.next(diagramEvent);
|
|
5697
6349
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
5698
6350
|
event.preventDefault();
|
|
5699
6351
|
this.userHighlight.focusOn(d);
|
|
6352
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
5700
6353
|
this.userSelection.add(d);
|
|
6354
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([d], true));
|
|
5701
6355
|
this.contextMenu.open(event);
|
|
5702
6356
|
}
|
|
5703
6357
|
}).on(exports.Events.DoubleClick, (event, d) => {
|
|
5704
|
-
const diagramEvent = new
|
|
6358
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
5705
6359
|
this.diagramEvent$.next(diagramEvent);
|
|
5706
6360
|
}).call(d3__namespace.drag().filter(event => {
|
|
5707
6361
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -5891,11 +6545,11 @@ class DiagramCanvas {
|
|
|
5891
6545
|
mergeSelection.filter('.resizable-y').select('line.bottom-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', d => d.height - RESIZER_THICKNESS / 2).attr('y2', d => d.height - RESIZER_THICKNESS / 2);
|
|
5892
6546
|
}
|
|
5893
6547
|
updateSectionsInView(...ids) {
|
|
5894
|
-
let updateSelection = this.
|
|
6548
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-section').data(this.model.sections.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
5895
6549
|
const exitSelection = updateSelection.exit();
|
|
5896
6550
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
|
|
5897
6551
|
var _a, _b, _c, _d, _e, _f;
|
|
5898
|
-
return `diagram-section${((_b = (_a = d.node) === null || _a ===
|
|
6552
|
+
return `diagram-section${((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) ? ' resizable-x' : ''}${((_d = (_c = d.node) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.resizableY) ? ' resizable-y' : ''} ${(_f = (_e = d.getConfig()) === null || _e === undefined ? undefined : _e.look) === null || _f === undefined ? undefined : _f.lookType}`;
|
|
5899
6553
|
});
|
|
5900
6554
|
if (ids && ids.length > 0) {
|
|
5901
6555
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
@@ -5905,12 +6559,17 @@ class DiagramCanvas {
|
|
|
5905
6559
|
enterSelection.on(exports.Events.MouseOver, (_event, d) => {
|
|
5906
6560
|
if (!this.dragging) {
|
|
5907
6561
|
this.userHighlight.focusOn(d);
|
|
6562
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
5908
6563
|
}
|
|
5909
6564
|
}).on(exports.Events.Click, (event, d) => {
|
|
5910
6565
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
6566
|
+
const deselectedElements = this.userSelection.all();
|
|
5911
6567
|
this.userSelection.clear();
|
|
6568
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
5912
6569
|
}
|
|
5913
|
-
|
|
6570
|
+
const elementToBeToggled = getRelatedNodeOrItself(d);
|
|
6571
|
+
this.userSelection.toggle(elementToBeToggled);
|
|
6572
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
5914
6573
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
5915
6574
|
if (this.dragging) {
|
|
5916
6575
|
event.preventDefault();
|
|
@@ -5918,17 +6577,19 @@ class DiagramCanvas {
|
|
|
5918
6577
|
this.dragging = false;
|
|
5919
6578
|
return;
|
|
5920
6579
|
}
|
|
5921
|
-
const diagramEvent = new
|
|
6580
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
5922
6581
|
this.diagramEvent$.next(diagramEvent);
|
|
5923
6582
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
5924
6583
|
event.preventDefault();
|
|
5925
6584
|
const elementToSelect = getRelatedNodeOrItself(d);
|
|
5926
6585
|
this.userHighlight.focusOn(elementToSelect);
|
|
6586
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(elementToSelect));
|
|
5927
6587
|
this.userSelection.add(elementToSelect);
|
|
6588
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToSelect], true));
|
|
5928
6589
|
this.contextMenu.open(event);
|
|
5929
6590
|
}
|
|
5930
6591
|
}).on(exports.Events.DoubleClick, (event, d) => {
|
|
5931
|
-
const diagramEvent = new
|
|
6592
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
5932
6593
|
this.diagramEvent$.next(diagramEvent);
|
|
5933
6594
|
}).call(d3__namespace.drag().filter(event => {
|
|
5934
6595
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -5937,7 +6598,7 @@ class DiagramCanvas {
|
|
|
5937
6598
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
5938
6599
|
this.startMultipleSelection(event);
|
|
5939
6600
|
} else {
|
|
5940
|
-
const node = d === null || d ===
|
|
6601
|
+
const node = d === null || d === undefined ? undefined : d.node;
|
|
5941
6602
|
if (node) {
|
|
5942
6603
|
this.startMovingNode(event, node);
|
|
5943
6604
|
} else {
|
|
@@ -5948,7 +6609,7 @@ class DiagramCanvas {
|
|
|
5948
6609
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
5949
6610
|
this.continueMultipleSelection(event);
|
|
5950
6611
|
} else {
|
|
5951
|
-
const node = d === null || d ===
|
|
6612
|
+
const node = d === null || d === undefined ? undefined : d.node;
|
|
5952
6613
|
if (node) {
|
|
5953
6614
|
this.continueMovingNode(event, node);
|
|
5954
6615
|
} else {
|
|
@@ -5959,7 +6620,7 @@ class DiagramCanvas {
|
|
|
5959
6620
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
5960
6621
|
this.finishMultipleSelection(event);
|
|
5961
6622
|
} else {
|
|
5962
|
-
const node = d === null || d ===
|
|
6623
|
+
const node = d === null || d === undefined ? undefined : d.node;
|
|
5963
6624
|
if (node) {
|
|
5964
6625
|
this.finishMovingNode(event, node);
|
|
5965
6626
|
} else {
|
|
@@ -5981,17 +6642,17 @@ class DiagramCanvas {
|
|
|
5981
6642
|
enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-right-image').attr('preserveAspectRatio', 'none');
|
|
5982
6643
|
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) => {
|
|
5983
6644
|
var _a, _b;
|
|
5984
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6645
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
5985
6646
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
5986
6647
|
}
|
|
5987
6648
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
5988
6649
|
var _a, _b;
|
|
5989
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6650
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
5990
6651
|
setCursorStyle();
|
|
5991
6652
|
}
|
|
5992
6653
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
5993
6654
|
var _a, _b;
|
|
5994
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6655
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
5995
6656
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
5996
6657
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
5997
6658
|
} else {
|
|
@@ -5999,13 +6660,13 @@ class DiagramCanvas {
|
|
|
5999
6660
|
}
|
|
6000
6661
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
6001
6662
|
var _a, _b;
|
|
6002
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6663
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
6003
6664
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6004
6665
|
d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
6005
6666
|
}
|
|
6006
6667
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
6007
6668
|
var _a, _b;
|
|
6008
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6669
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection) {
|
|
6009
6670
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6010
6671
|
if (this.snapToGrid) {
|
|
6011
6672
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -6020,17 +6681,17 @@ class DiagramCanvas {
|
|
|
6020
6681
|
}));
|
|
6021
6682
|
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) => {
|
|
6022
6683
|
var _a, _b;
|
|
6023
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6684
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6024
6685
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
6025
6686
|
}
|
|
6026
6687
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
6027
6688
|
var _a, _b;
|
|
6028
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6689
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6029
6690
|
setCursorStyle();
|
|
6030
6691
|
}
|
|
6031
6692
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
6032
6693
|
var _a, _b;
|
|
6033
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6694
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6034
6695
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
6035
6696
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
6036
6697
|
} else {
|
|
@@ -6038,13 +6699,13 @@ class DiagramCanvas {
|
|
|
6038
6699
|
}
|
|
6039
6700
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
6040
6701
|
var _a, _b;
|
|
6041
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6702
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6042
6703
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6043
6704
|
d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
6044
6705
|
}
|
|
6045
6706
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
6046
6707
|
var _a, _b;
|
|
6047
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6708
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection) {
|
|
6048
6709
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6049
6710
|
if (this.snapToGrid) {
|
|
6050
6711
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -6059,17 +6720,17 @@ class DiagramCanvas {
|
|
|
6059
6720
|
}));
|
|
6060
6721
|
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) => {
|
|
6061
6722
|
var _a, _b;
|
|
6062
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6723
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
6063
6724
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
6064
6725
|
}
|
|
6065
6726
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
6066
6727
|
var _a, _b;
|
|
6067
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6728
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
6068
6729
|
setCursorStyle();
|
|
6069
6730
|
}
|
|
6070
6731
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
6071
6732
|
var _a, _b;
|
|
6072
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6733
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
6073
6734
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
6074
6735
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
6075
6736
|
} else {
|
|
@@ -6077,13 +6738,13 @@ class DiagramCanvas {
|
|
|
6077
6738
|
}
|
|
6078
6739
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
6079
6740
|
var _a, _b;
|
|
6080
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6741
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
6081
6742
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6082
6743
|
d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
6083
6744
|
}
|
|
6084
6745
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
6085
6746
|
var _a, _b;
|
|
6086
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6747
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection) {
|
|
6087
6748
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6088
6749
|
if (this.snapToGrid) {
|
|
6089
6750
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -6098,17 +6759,17 @@ class DiagramCanvas {
|
|
|
6098
6759
|
}));
|
|
6099
6760
|
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) => {
|
|
6100
6761
|
var _a, _b;
|
|
6101
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6762
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6102
6763
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
6103
6764
|
}
|
|
6104
6765
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
6105
6766
|
var _a, _b;
|
|
6106
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6767
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6107
6768
|
setCursorStyle();
|
|
6108
6769
|
}
|
|
6109
6770
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
6110
6771
|
var _a, _b;
|
|
6111
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6772
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6112
6773
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
6113
6774
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
6114
6775
|
} else {
|
|
@@ -6116,13 +6777,13 @@ class DiagramCanvas {
|
|
|
6116
6777
|
}
|
|
6117
6778
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
6118
6779
|
var _a, _b;
|
|
6119
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6780
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6120
6781
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6121
6782
|
d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
6122
6783
|
}
|
|
6123
6784
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
6124
6785
|
var _a, _b;
|
|
6125
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6786
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection) {
|
|
6126
6787
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6127
6788
|
if (this.snapToGrid) {
|
|
6128
6789
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -6138,143 +6799,143 @@ class DiagramCanvas {
|
|
|
6138
6799
|
mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
|
|
6139
6800
|
mergeSelection.filter('.shaped-look').select('path').attr('d', d => {
|
|
6140
6801
|
var _a;
|
|
6141
|
-
return generalClosedPath(((_a = d.getConfig()) === null || _a ===
|
|
6802
|
+
return generalClosedPath(((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).shape, 0, 0, d.width, d.height);
|
|
6142
6803
|
}).attr('fill', d => {
|
|
6143
6804
|
var _a, _b;
|
|
6144
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6805
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedFillColor : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).fillColor;
|
|
6145
6806
|
}).attr('stroke', d => {
|
|
6146
6807
|
var _a, _b;
|
|
6147
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6808
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBorderColor : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).borderColor;
|
|
6148
6809
|
}).attr('stroke-width', d => `${d.highlighted ? 3 : 1}px`);
|
|
6149
6810
|
mergeSelection.filter('.image-look').select('image').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('href', d => {
|
|
6150
6811
|
var _a, _b;
|
|
6151
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6812
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImage : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImage;
|
|
6152
6813
|
});
|
|
6153
6814
|
mergeSelection.filter('.stretchable-image-look').select('image.top-left-image').attr('x', 0).attr('y', 0).attr('width', d => {
|
|
6154
6815
|
var _a;
|
|
6155
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6816
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6156
6817
|
}).attr('height', d => {
|
|
6157
6818
|
var _a;
|
|
6158
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6819
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6159
6820
|
}).attr('href', d => {
|
|
6160
6821
|
var _a, _b;
|
|
6161
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6822
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageTopLeft : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageTopLeft;
|
|
6162
6823
|
});
|
|
6163
6824
|
mergeSelection.filter('.stretchable-image-look').select('image.top-image').attr('x', d => {
|
|
6164
6825
|
var _a;
|
|
6165
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6826
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6166
6827
|
}).attr('y', 0).attr('width', d => {
|
|
6167
6828
|
var _a, _b;
|
|
6168
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6829
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).leftMargin;
|
|
6169
6830
|
}).attr('height', d => {
|
|
6170
6831
|
var _a;
|
|
6171
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6832
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6172
6833
|
}).attr('href', d => {
|
|
6173
6834
|
var _a, _b;
|
|
6174
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6835
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageTop : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageTop;
|
|
6175
6836
|
});
|
|
6176
6837
|
mergeSelection.filter('.stretchable-image-look').select('image.top-right-image').attr('x', d => {
|
|
6177
6838
|
var _a;
|
|
6178
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6839
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6179
6840
|
}).attr('y', 0).attr('width', d => {
|
|
6180
6841
|
var _a;
|
|
6181
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6842
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6182
6843
|
}).attr('height', d => {
|
|
6183
6844
|
var _a;
|
|
6184
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6845
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6185
6846
|
}).attr('href', d => {
|
|
6186
6847
|
var _a, _b;
|
|
6187
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6848
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageTopRight : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageTopRight;
|
|
6188
6849
|
});
|
|
6189
6850
|
mergeSelection.filter('.stretchable-image-look').select('image.left-image').attr('x', 0).attr('y', d => {
|
|
6190
6851
|
var _a;
|
|
6191
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6852
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6192
6853
|
}).attr('width', d => {
|
|
6193
6854
|
var _a;
|
|
6194
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6855
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6195
6856
|
}).attr('height', d => {
|
|
6196
6857
|
var _a, _b;
|
|
6197
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6858
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).topMargin;
|
|
6198
6859
|
}).attr('href', d => {
|
|
6199
6860
|
var _a, _b;
|
|
6200
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6861
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageLeft : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageLeft;
|
|
6201
6862
|
});
|
|
6202
6863
|
mergeSelection.filter('.stretchable-image-look').select('image.center-image').attr('x', d => {
|
|
6203
6864
|
var _a;
|
|
6204
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6865
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6205
6866
|
}).attr('y', d => {
|
|
6206
6867
|
var _a;
|
|
6207
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6868
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6208
6869
|
}).attr('width', d => {
|
|
6209
6870
|
var _a, _b;
|
|
6210
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6871
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).leftMargin;
|
|
6211
6872
|
}).attr('height', d => {
|
|
6212
6873
|
var _a, _b;
|
|
6213
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6874
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).topMargin;
|
|
6214
6875
|
}).attr('href', d => {
|
|
6215
6876
|
var _a, _b;
|
|
6216
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6877
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageCenter : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageCenter;
|
|
6217
6878
|
});
|
|
6218
6879
|
mergeSelection.filter('.stretchable-image-look').select('image.right-image').attr('x', d => {
|
|
6219
6880
|
var _a;
|
|
6220
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6881
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6221
6882
|
}).attr('y', d => {
|
|
6222
6883
|
var _a;
|
|
6223
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6884
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6224
6885
|
}).attr('width', d => {
|
|
6225
6886
|
var _a;
|
|
6226
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6887
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6227
6888
|
}).attr('height', d => {
|
|
6228
6889
|
var _a, _b;
|
|
6229
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6890
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).topMargin;
|
|
6230
6891
|
}).attr('href', d => {
|
|
6231
6892
|
var _a, _b;
|
|
6232
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6893
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageRight : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageRight;
|
|
6233
6894
|
});
|
|
6234
6895
|
mergeSelection.filter('.stretchable-image-look').select('image.bottom-left-image').attr('x', 0).attr('y', d => {
|
|
6235
6896
|
var _a;
|
|
6236
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6897
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6237
6898
|
}).attr('width', d => {
|
|
6238
6899
|
var _a;
|
|
6239
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6900
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6240
6901
|
}).attr('height', d => {
|
|
6241
6902
|
var _a;
|
|
6242
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6903
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6243
6904
|
}).attr('href', d => {
|
|
6244
6905
|
var _a, _b;
|
|
6245
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6906
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageBottomLeft : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageBottomLeft;
|
|
6246
6907
|
});
|
|
6247
6908
|
mergeSelection.filter('.stretchable-image-look').select('image.bottom-image').attr('x', d => {
|
|
6248
6909
|
var _a;
|
|
6249
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6910
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6250
6911
|
}).attr('y', d => {
|
|
6251
6912
|
var _a;
|
|
6252
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6913
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6253
6914
|
}).attr('width', d => {
|
|
6254
6915
|
var _a, _b;
|
|
6255
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6916
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).leftMargin;
|
|
6256
6917
|
}).attr('height', d => {
|
|
6257
6918
|
var _a;
|
|
6258
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6919
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6259
6920
|
}).attr('href', d => {
|
|
6260
6921
|
var _a, _b;
|
|
6261
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6922
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageBottom : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageBottom;
|
|
6262
6923
|
});
|
|
6263
6924
|
mergeSelection.filter('.stretchable-image-look').select('image.bottom-right-image').attr('x', d => {
|
|
6264
6925
|
var _a;
|
|
6265
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6926
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6266
6927
|
}).attr('y', d => {
|
|
6267
6928
|
var _a;
|
|
6268
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6929
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6269
6930
|
}).attr('width', d => {
|
|
6270
6931
|
var _a;
|
|
6271
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6932
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6272
6933
|
}).attr('height', d => {
|
|
6273
6934
|
var _a;
|
|
6274
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6935
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6275
6936
|
}).attr('href', d => {
|
|
6276
6937
|
var _a, _b;
|
|
6277
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6938
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageBottomRight : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageBottomRight;
|
|
6278
6939
|
});
|
|
6279
6940
|
mergeSelection.filter('.resizable-x').select('line.left-resizer').attr('x1', RESIZER_THICKNESS / 2).attr('x2', RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
|
|
6280
6941
|
mergeSelection.filter('.resizable-y').select('line.top-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', RESIZER_THICKNESS / 2).attr('y2', RESIZER_THICKNESS / 2);
|
|
@@ -6282,7 +6943,7 @@ class DiagramCanvas {
|
|
|
6282
6943
|
mergeSelection.filter('.resizable-y').select('line.bottom-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', d => d.height - RESIZER_THICKNESS / 2).attr('y2', d => d.height - RESIZER_THICKNESS / 2);
|
|
6283
6944
|
}
|
|
6284
6945
|
updatePortsInView(...ids) {
|
|
6285
|
-
let updateSelection = this.
|
|
6946
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-port').data(this.model.ports.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
6286
6947
|
const exitSelection = updateSelection.exit();
|
|
6287
6948
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-port');
|
|
6288
6949
|
if (ids && ids.length > 0) {
|
|
@@ -6295,9 +6956,10 @@ class DiagramCanvas {
|
|
|
6295
6956
|
if (!this.unfinishedConnection && !this.dragging) {
|
|
6296
6957
|
// if there is an unfinished connection, the port will be highlighted automatically if the pointer is close
|
|
6297
6958
|
this.userHighlight.focusOn(d);
|
|
6959
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
6298
6960
|
}
|
|
6299
6961
|
if (this.unfinishedConnection) {
|
|
6300
|
-
const canConnectionFinishAtThisPort = this.unfinishedConnection.type.canStartFromType(((_c = (_b = (_a = this.unfinishedConnection.start) === null || _a ===
|
|
6962
|
+
const canConnectionFinishAtThisPort = this.unfinishedConnection.type.canStartFromType(((_c = (_b = (_a = this.unfinishedConnection.start) === null || _a === undefined ? undefined : _a.getNode()) === null || _b === undefined ? undefined : _b.type) === null || _c === undefined ? undefined : _c.id) || '') && this.unfinishedConnection.type.canFinishOnType(((_e = (_d = d.getNode()) === null || _d === undefined ? undefined : _d.type) === null || _e === undefined ? undefined : _e.id) || '') || this.unfinishedConnection.type.canStartFromType(((_g = (_f = d.getNode()) === null || _f === undefined ? undefined : _f.type) === null || _g === undefined ? undefined : _g.id) || '') && this.unfinishedConnection.type.canFinishOnType(((_k = (_j = (_h = this.unfinishedConnection.start) === null || _h === undefined ? undefined : _h.getNode()) === null || _j === undefined ? undefined : _j.type) === null || _k === undefined ? undefined : _k.id) || '');
|
|
6301
6963
|
if (!canConnectionFinishAtThisPort) {
|
|
6302
6964
|
setCursorStyle(exports.CursorStyle.NoDrop);
|
|
6303
6965
|
}
|
|
@@ -6308,9 +6970,13 @@ class DiagramCanvas {
|
|
|
6308
6970
|
}
|
|
6309
6971
|
}).on(exports.Events.Click, (event, d) => {
|
|
6310
6972
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
6973
|
+
const deselectedElements = this.userSelection.all();
|
|
6311
6974
|
this.userSelection.clear();
|
|
6975
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
6312
6976
|
}
|
|
6313
|
-
|
|
6977
|
+
const elementToBeToggled = getRelatedNodeOrItself(d);
|
|
6978
|
+
this.userSelection.toggle(elementToBeToggled);
|
|
6979
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
6314
6980
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
6315
6981
|
if (this.dragging) {
|
|
6316
6982
|
event.preventDefault();
|
|
@@ -6318,17 +6984,19 @@ class DiagramCanvas {
|
|
|
6318
6984
|
this.dragging = false;
|
|
6319
6985
|
return;
|
|
6320
6986
|
}
|
|
6321
|
-
const diagramEvent = new
|
|
6987
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6322
6988
|
this.diagramEvent$.next(diagramEvent);
|
|
6323
6989
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
6324
6990
|
event.preventDefault();
|
|
6325
6991
|
const elementToSelect = getRelatedNodeOrItself(d);
|
|
6326
6992
|
this.userHighlight.focusOn(elementToSelect);
|
|
6993
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(elementToSelect));
|
|
6327
6994
|
this.userSelection.add(elementToSelect);
|
|
6995
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToSelect], true));
|
|
6328
6996
|
this.contextMenu.open(event);
|
|
6329
6997
|
}
|
|
6330
6998
|
}).on(exports.Events.DoubleClick, (event, d) => {
|
|
6331
|
-
const diagramEvent = new
|
|
6999
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6332
7000
|
this.diagramEvent$.next(diagramEvent);
|
|
6333
7001
|
}).call(d3__namespace.drag().filter(event => {
|
|
6334
7002
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -6356,8 +7024,8 @@ class DiagramCanvas {
|
|
|
6356
7024
|
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
|
|
6357
7025
|
if (this.unfinishedConnection !== undefined) {
|
|
6358
7026
|
const endCoords = [event.x, event.y];
|
|
6359
|
-
(_a = this.unfinishedConnectionTracer) === null || _a ===
|
|
6360
|
-
const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d ===
|
|
7027
|
+
(_a = this.unfinishedConnectionTracer) === null || _a === undefined ? undefined : _a.attr('d', getConnectionPath(this.unfinishedConnection.type.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.type.width, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === undefined ? undefined : _b.markerWidth, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === undefined ? undefined : _c.markerWidth));
|
|
7028
|
+
const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === undefined ? undefined : _d.node();
|
|
6361
7029
|
if (unfinishedConnectionGhostNode) {
|
|
6362
7030
|
let margin = 2;
|
|
6363
7031
|
const unfinishedConnectionTotalLength = unfinishedConnectionGhostNode.getTotalLength();
|
|
@@ -6398,7 +7066,7 @@ class DiagramCanvas {
|
|
|
6398
7066
|
this.finishMultipleSelection(event);
|
|
6399
7067
|
} else {
|
|
6400
7068
|
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
|
|
6401
|
-
(_a = this.unfinishedConnectionTracer) === null || _a ===
|
|
7069
|
+
(_a = this.unfinishedConnectionTracer) === null || _a === undefined ? undefined : _a.remove();
|
|
6402
7070
|
const userHighlight = this.userHighlight.getFocus();
|
|
6403
7071
|
if (userHighlight instanceof DiagramPort) {
|
|
6404
7072
|
this.finishConnection(userHighlight);
|
|
@@ -6436,7 +7104,7 @@ class DiagramCanvas {
|
|
|
6436
7104
|
if (this.unfinishedConnection) {
|
|
6437
7105
|
connectionList.push(this.unfinishedConnection);
|
|
6438
7106
|
}
|
|
6439
|
-
let updateSelection = this.
|
|
7107
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-connection').data(connectionList, d => d.id);
|
|
6440
7108
|
const exitSelection = updateSelection.exit();
|
|
6441
7109
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-connection');
|
|
6442
7110
|
if (ids && ids.length > 0) {
|
|
@@ -6447,12 +7115,16 @@ class DiagramCanvas {
|
|
|
6447
7115
|
enterSelection.on(exports.Events.MouseOver, (_event, d) => {
|
|
6448
7116
|
if (d.end !== undefined && !this.dragging) {
|
|
6449
7117
|
this.userHighlight.focusOn(d);
|
|
7118
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
6450
7119
|
}
|
|
6451
7120
|
}).on(exports.Events.Click, (event, d) => {
|
|
6452
7121
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
7122
|
+
const deselectedElements = this.userSelection.all();
|
|
6453
7123
|
this.userSelection.clear();
|
|
7124
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
6454
7125
|
}
|
|
6455
7126
|
this.userSelection.toggle(d);
|
|
7127
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
|
|
6456
7128
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
6457
7129
|
if (this.dragging) {
|
|
6458
7130
|
event.preventDefault();
|
|
@@ -6460,16 +7132,18 @@ class DiagramCanvas {
|
|
|
6460
7132
|
this.dragging = false;
|
|
6461
7133
|
return;
|
|
6462
7134
|
}
|
|
6463
|
-
const diagramEvent = new
|
|
7135
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6464
7136
|
this.diagramEvent$.next(diagramEvent);
|
|
6465
7137
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
6466
7138
|
event.preventDefault();
|
|
6467
7139
|
this.userHighlight.focusOn(d);
|
|
7140
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
6468
7141
|
this.userSelection.add(d);
|
|
7142
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([d], true));
|
|
6469
7143
|
this.contextMenu.open(event);
|
|
6470
7144
|
}
|
|
6471
7145
|
}).on(exports.Events.DoubleClick, (event, d) => {
|
|
6472
|
-
const diagramEvent = new
|
|
7146
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6473
7147
|
this.diagramEvent$.next(diagramEvent);
|
|
6474
7148
|
}).call(d3__namespace.drag().filter(event => {
|
|
6475
7149
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -6496,11 +7170,11 @@ class DiagramCanvas {
|
|
|
6496
7170
|
enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
|
|
6497
7171
|
mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
|
|
6498
7172
|
var _a, _b;
|
|
6499
|
-
return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a ===
|
|
7173
|
+
return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a === undefined ? undefined : _a.markerWidth, (_b = d.endMarkerLook) === null || _b === undefined ? undefined : _b.markerWidth);
|
|
6500
7174
|
}).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.selected ? d.type.selectedColor : d.type.color).attr('stroke-width', d => `${d.highlighted ? d.type.width + 1 : d.type.width}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.type.style, d.type.width)).attr('fill', 'none');
|
|
6501
7175
|
mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
|
|
6502
7176
|
var _a, _b;
|
|
6503
|
-
return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a ===
|
|
7177
|
+
return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a === undefined ? undefined : _a.markerWidth, (_b = d.endMarkerLook) === null || _b === undefined ? undefined : _b.markerWidth);
|
|
6504
7178
|
}).attr('stroke', 'transparent')
|
|
6505
7179
|
// allow generating pointer events even when it is transparent
|
|
6506
7180
|
.attr('pointer-events', 'stroke').attr('stroke-width', d => `${d.type.width + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.type.style, d.type.width)).attr('fill', 'none');
|
|
@@ -6510,7 +7184,7 @@ class DiagramCanvas {
|
|
|
6510
7184
|
});
|
|
6511
7185
|
}
|
|
6512
7186
|
updateFieldsInView(...ids) {
|
|
6513
|
-
let updateSelection = this.
|
|
7187
|
+
let updateSelection = this.selectCanvasElements().selectAll('foreignObject.diagram-field').data(this.model.fields.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
6514
7188
|
const exitSelection = updateSelection.exit();
|
|
6515
7189
|
const enterSelection = updateSelection.enter().append('foreignObject').attr('id', d => d.id).attr('class', 'diagram-field');
|
|
6516
7190
|
if (ids && ids.length > 0) {
|
|
@@ -6521,12 +7195,17 @@ class DiagramCanvas {
|
|
|
6521
7195
|
enterSelection.style('box-sizing', 'border-box').on(exports.Events.MouseOver, (_event, d) => {
|
|
6522
7196
|
if (!this.dragging) {
|
|
6523
7197
|
this.userHighlight.focusOn(d);
|
|
7198
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
6524
7199
|
}
|
|
6525
7200
|
}).on(exports.Events.Click, (event, d) => {
|
|
6526
7201
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
7202
|
+
const deselectedElements = this.userSelection.all();
|
|
6527
7203
|
this.userSelection.clear();
|
|
7204
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
6528
7205
|
}
|
|
6529
|
-
|
|
7206
|
+
const elementToBeToggled = getRelatedNodeOrItself(d);
|
|
7207
|
+
this.userSelection.toggle(elementToBeToggled);
|
|
7208
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
6530
7209
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
6531
7210
|
if (this.dragging) {
|
|
6532
7211
|
event.preventDefault();
|
|
@@ -6534,17 +7213,19 @@ class DiagramCanvas {
|
|
|
6534
7213
|
this.dragging = false;
|
|
6535
7214
|
return;
|
|
6536
7215
|
}
|
|
6537
|
-
const diagramEvent = new
|
|
7216
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6538
7217
|
this.diagramEvent$.next(diagramEvent);
|
|
6539
7218
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
6540
7219
|
event.preventDefault();
|
|
6541
7220
|
const elementToSelect = getRelatedNodeOrItself(d);
|
|
6542
7221
|
this.userHighlight.focusOn(elementToSelect);
|
|
7222
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(elementToSelect));
|
|
6543
7223
|
this.userSelection.add(elementToSelect);
|
|
7224
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToSelect], true));
|
|
6544
7225
|
this.contextMenu.open(event);
|
|
6545
7226
|
}
|
|
6546
7227
|
}).on(exports.Events.DoubleClick, (event, d) => {
|
|
6547
|
-
const diagramEvent = new
|
|
7228
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6548
7229
|
this.diagramEvent$.next(diagramEvent);
|
|
6549
7230
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.EditField) && d.editable && !d.removed) {
|
|
6550
7231
|
this.currentAction = new EditFieldAction(this, d.id, d.text, '');
|
|
@@ -6616,7 +7297,7 @@ class DiagramCanvas {
|
|
|
6616
7297
|
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('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/>'));
|
|
6617
7298
|
}
|
|
6618
7299
|
updateObjectsInView(...ids) {
|
|
6619
|
-
let updateSelection = this.
|
|
7300
|
+
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);
|
|
6620
7301
|
const exitSelection = updateSelection.exit();
|
|
6621
7302
|
const enterSelection = updateSelection.enter().append('foreignObject').attr('id', d => d.id).attr('class', 'diagram-object');
|
|
6622
7303
|
if (ids && ids.length > 0) {
|
|
@@ -6625,21 +7306,21 @@ class DiagramCanvas {
|
|
|
6625
7306
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
6626
7307
|
mergeSelection.attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.html);
|
|
6627
7308
|
exitSelection.remove();
|
|
6628
|
-
enterSelection.on(exports.Events.ContextMenu, event => {
|
|
7309
|
+
enterSelection.on(exports.Events.ContextMenu, (event, d) => {
|
|
6629
7310
|
if (this.dragging) {
|
|
6630
7311
|
event.preventDefault();
|
|
6631
7312
|
event.stopPropagation();
|
|
6632
7313
|
this.dragging = false;
|
|
6633
7314
|
return;
|
|
6634
7315
|
}
|
|
6635
|
-
const diagramEvent = new
|
|
7316
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6636
7317
|
this.diagramEvent$.next(diagramEvent);
|
|
6637
7318
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
6638
7319
|
event.preventDefault();
|
|
6639
7320
|
this.contextMenu.open(event);
|
|
6640
7321
|
}
|
|
6641
7322
|
}).on(exports.Events.DoubleClick, (event, d) => {
|
|
6642
|
-
const diagramEvent = new
|
|
7323
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6643
7324
|
this.diagramEvent$.next(diagramEvent);
|
|
6644
7325
|
}).call(d3__namespace.drag().filter(event => {
|
|
6645
7326
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -6653,7 +7334,7 @@ class DiagramCanvas {
|
|
|
6653
7334
|
}));
|
|
6654
7335
|
}
|
|
6655
7336
|
updateDecoratorsInView(...ids) {
|
|
6656
|
-
let updateSelection = this.
|
|
7337
|
+
let updateSelection = this.selectCanvasElements().selectAll('foreignObject.diagram-decorator').data(this.model.decorators.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
6657
7338
|
const exitSelection = updateSelection.exit();
|
|
6658
7339
|
const enterSelection = updateSelection.enter().append('foreignObject').attr('id', d => d.id).attr('class', 'diagram-decorator');
|
|
6659
7340
|
if (ids && ids.length > 0) {
|
|
@@ -6662,21 +7343,21 @@ class DiagramCanvas {
|
|
|
6662
7343
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
6663
7344
|
mergeSelection.attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.html);
|
|
6664
7345
|
exitSelection.remove();
|
|
6665
|
-
enterSelection.on(exports.Events.ContextMenu, event => {
|
|
7346
|
+
enterSelection.on(exports.Events.ContextMenu, (event, d) => {
|
|
6666
7347
|
if (this.dragging) {
|
|
6667
7348
|
event.preventDefault();
|
|
6668
7349
|
event.stopPropagation();
|
|
6669
7350
|
this.dragging = false;
|
|
6670
7351
|
return;
|
|
6671
7352
|
}
|
|
6672
|
-
const diagramEvent = new
|
|
7353
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6673
7354
|
this.diagramEvent$.next(diagramEvent);
|
|
6674
7355
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
6675
7356
|
event.preventDefault();
|
|
6676
7357
|
this.contextMenu.open(event);
|
|
6677
7358
|
}
|
|
6678
7359
|
}).on(exports.Events.DoubleClick, (event, d) => {
|
|
6679
|
-
const diagramEvent = new
|
|
7360
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6680
7361
|
this.diagramEvent$.next(diagramEvent);
|
|
6681
7362
|
}).call(d3__namespace.drag().filter(event => {
|
|
6682
7363
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -6699,33 +7380,33 @@ class DiagramCanvas {
|
|
|
6699
7380
|
const pathLength = pathNode.getTotalLength();
|
|
6700
7381
|
// bind start labels
|
|
6701
7382
|
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);
|
|
6702
|
-
const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a ===
|
|
7383
|
+
const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a === undefined ? undefined : _a.getBoundingClientRect();
|
|
6703
7384
|
if (startLabelBoundingRect) {
|
|
6704
7385
|
// don't create space for the label if the label is empty
|
|
6705
|
-
const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding(labelConfiguration) + getRightPadding(labelConfiguration);
|
|
6706
|
-
const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / this.zoomTransform.k + getTopPadding(labelConfiguration) + getBottomPadding(labelConfiguration);
|
|
7386
|
+
const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
7387
|
+
const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
6707
7388
|
const pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
6708
7389
|
connectionSelection.select('g.diagram-connection-start-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.selected ? connection.type.selectedColor : connection.type.color).attr('stroke', 'none');
|
|
6709
7390
|
connectionSelection.select('g.diagram-connection-start-label').attr('transform', `translate(${pathStartLabelPoint.x},${pathStartLabelPoint.y})`);
|
|
6710
7391
|
}
|
|
6711
7392
|
// bind middle labels
|
|
6712
7393
|
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);
|
|
6713
|
-
const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b ===
|
|
7394
|
+
const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b === undefined ? undefined : _b.getBoundingClientRect();
|
|
6714
7395
|
if (middleLabelBoundingRect) {
|
|
6715
7396
|
// don't create space for the label if the label is empty
|
|
6716
|
-
const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding(labelConfiguration) + getRightPadding(labelConfiguration);
|
|
6717
|
-
const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / this.zoomTransform.k + getTopPadding(labelConfiguration) + getBottomPadding(labelConfiguration);
|
|
7397
|
+
const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
7398
|
+
const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
6718
7399
|
const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
|
|
6719
7400
|
connectionSelection.select('g.diagram-connection-middle-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.selected ? connection.type.selectedColor : connection.type.color).attr('stroke', 'none');
|
|
6720
7401
|
connectionSelection.select('g.diagram-connection-middle-label').attr('transform', `translate(${pathMiddleLabelPoint.x},${pathMiddleLabelPoint.y})`);
|
|
6721
7402
|
}
|
|
6722
7403
|
// bind end labels
|
|
6723
7404
|
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);
|
|
6724
|
-
const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c ===
|
|
7405
|
+
const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c === undefined ? undefined : _c.getBoundingClientRect();
|
|
6725
7406
|
if (endLabelBoundingRect) {
|
|
6726
7407
|
// don't create space for the label if the label is empty
|
|
6727
|
-
const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding(labelConfiguration) + getRightPadding(labelConfiguration);
|
|
6728
|
-
const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / this.zoomTransform.k + getTopPadding(labelConfiguration) + getBottomPadding(labelConfiguration);
|
|
7408
|
+
const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
7409
|
+
const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
6729
7410
|
const pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
6730
7411
|
connectionSelection.select('g.diagram-connection-end-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.selected ? connection.type.selectedColor : connection.type.color).attr('stroke', 'none');
|
|
6731
7412
|
connectionSelection.select('g.diagram-connection-end-label').attr('transform', `translate(${pathEndLabelPoint.x},${pathEndLabelPoint.y})`);
|
|
@@ -6775,7 +7456,7 @@ class DiagramCanvas {
|
|
|
6775
7456
|
const fieldDimensions = this.minimumSizeOfField(field);
|
|
6776
7457
|
let minimumFieldWidth = fieldDimensions[0];
|
|
6777
7458
|
let minimumFieldHeight = fieldDimensions[1];
|
|
6778
|
-
for (const section of ((_a = field.rootElement.node) === null || _a ===
|
|
7459
|
+
for (const section of ((_a = field.rootElement.node) === null || _a === undefined ? undefined : _a.sections) || []) {
|
|
6779
7460
|
if (section.label) {
|
|
6780
7461
|
if (section.indexXInNode === field.rootElement.indexXInNode && section.indexYInNode !== field.rootElement.indexYInNode) {
|
|
6781
7462
|
minimumFieldWidth = Math.max(minimumFieldWidth, this.minimumSizeOfField(section.label)[0]);
|
|
@@ -6790,8 +7471,8 @@ class DiagramCanvas {
|
|
|
6790
7471
|
if (fieldDimensions[1] < minimumFieldHeight) {
|
|
6791
7472
|
fieldDimensions[1] = minimumFieldHeight;
|
|
6792
7473
|
}
|
|
6793
|
-
let stretchX = fieldDimensions[0] + getLeftMargin((_c = (_b = field.rootElement) === null || _b ===
|
|
6794
|
-
let stretchY = fieldDimensions[1] + getTopMargin((_g = (_f = field.rootElement) === null || _f ===
|
|
7474
|
+
let stretchX = fieldDimensions[0] + getLeftMargin((_c = (_b = field.rootElement) === null || _b === undefined ? undefined : _b.getConfig()) === null || _c === undefined ? undefined : _c.label) + getRightMargin((_e = (_d = field.rootElement) === null || _d === undefined ? undefined : _d.getConfig()) === null || _e === undefined ? undefined : _e.label) - field.rootElement.width;
|
|
7475
|
+
let stretchY = fieldDimensions[1] + getTopMargin((_g = (_f = field.rootElement) === null || _f === undefined ? undefined : _f.getConfig()) === null || _g === undefined ? undefined : _g.label) + getBottomMargin((_j = (_h = field.rootElement) === null || _h === undefined ? undefined : _h.getConfig()) === null || _j === undefined ? undefined : _j.label) - field.rootElement.height;
|
|
6795
7476
|
if (this.snapToGrid) {
|
|
6796
7477
|
stretchX = Math.ceil(stretchX / this.gridSize) * this.gridSize;
|
|
6797
7478
|
stretchY = Math.ceil(stretchY / this.gridSize) * this.gridSize;
|
|
@@ -6803,8 +7484,8 @@ class DiagramCanvas {
|
|
|
6803
7484
|
if (field.rootElement.height + stretchY < (field.rootElement.getMinHeight() || 0)) {
|
|
6804
7485
|
stretchY = (field.rootElement.getMinHeight() || 0) - field.rootElement.height;
|
|
6805
7486
|
}
|
|
6806
|
-
(_k = field.rootElement.node) === null || _k ===
|
|
6807
|
-
(_l = field.rootElement.node) === null || _l ===
|
|
7487
|
+
(_k = field.rootElement.node) === null || _k === undefined ? undefined : _k.stretchSections(exports.Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
7488
|
+
(_l = field.rootElement.node) === null || _l === undefined ? undefined : _l.stretchSections(exports.Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
6808
7489
|
}
|
|
6809
7490
|
}
|
|
6810
7491
|
fitNodeInView(id) {
|
|
@@ -6826,8 +7507,8 @@ class DiagramCanvas {
|
|
|
6826
7507
|
}
|
|
6827
7508
|
}
|
|
6828
7509
|
// add the margin that goes between the rightmost and bottommost points of the sections and the edge of the node
|
|
6829
|
-
newNodeWidth += ((_a = node.type.sectionGrid) === null || _a ===
|
|
6830
|
-
newNodeHeight += ((_b = node.type.sectionGrid) === null || _b ===
|
|
7510
|
+
newNodeWidth += ((_a = node.type.sectionGrid) === null || _a === undefined ? undefined : _a.margin) || 0;
|
|
7511
|
+
newNodeHeight += ((_b = node.type.sectionGrid) === null || _b === undefined ? undefined : _b.margin) || 0;
|
|
6831
7512
|
node.stretch(exports.Side.Right, newNodeWidth - node.width);
|
|
6832
7513
|
node.stretch(exports.Side.Bottom, newNodeHeight - node.height);
|
|
6833
7514
|
}
|
|
@@ -6841,42 +7522,21 @@ class DiagramCanvas {
|
|
|
6841
7522
|
selectCanvasElements() {
|
|
6842
7523
|
return this.selectRoot().select(`.daga-canvas-elements`);
|
|
6843
7524
|
}
|
|
6844
|
-
selectCanvasNodes() {
|
|
6845
|
-
return this.selectRoot().select(`.daga-canvas-nodes`);
|
|
6846
|
-
}
|
|
6847
|
-
selectCanvasSections() {
|
|
6848
|
-
return this.selectRoot().select(`.daga-canvas-sections`);
|
|
6849
|
-
}
|
|
6850
|
-
selectCanvasPorts() {
|
|
6851
|
-
return this.selectRoot().select(`.daga-canvas-ports`);
|
|
6852
|
-
}
|
|
6853
|
-
selectCanvasConnections() {
|
|
6854
|
-
return this.selectRoot().select(`.daga-canvas-connections`);
|
|
6855
|
-
}
|
|
6856
|
-
selectCanvasFields() {
|
|
6857
|
-
return this.selectRoot().select(`.daga-canvas-fields`);
|
|
6858
|
-
}
|
|
6859
|
-
selectCanvasObjects() {
|
|
6860
|
-
return this.selectRoot().select(`.daga-canvas-objects`);
|
|
6861
|
-
}
|
|
6862
|
-
selectCanvasDecorators() {
|
|
6863
|
-
return this.selectRoot().select(`.daga-canvas-decorators`);
|
|
6864
|
-
}
|
|
6865
7525
|
// User actions
|
|
6866
7526
|
startConnection(port) {
|
|
6867
7527
|
var _a, _b, _c, _d;
|
|
6868
|
-
if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a ===
|
|
7528
|
+
if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '') || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || ''))) {
|
|
6869
7529
|
this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
6870
7530
|
} else {
|
|
6871
7531
|
if (this.inferConnectionType) {
|
|
6872
7532
|
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
6873
7533
|
var _a, _b;
|
|
6874
|
-
return t.canStartFromType(((_b = (_a = port.getNode()) === null || _a ===
|
|
7534
|
+
return t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
|
|
6875
7535
|
});
|
|
6876
7536
|
if (differentConnectionType === undefined) {
|
|
6877
7537
|
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
6878
7538
|
var _a, _b;
|
|
6879
|
-
return t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a ===
|
|
7539
|
+
return t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
|
|
6880
7540
|
});
|
|
6881
7541
|
}
|
|
6882
7542
|
if (differentConnectionType !== undefined) {
|
|
@@ -6890,14 +7550,14 @@ class DiagramCanvas {
|
|
|
6890
7550
|
this.userHighlight.clear();
|
|
6891
7551
|
if (this.unfinishedConnection !== undefined) {
|
|
6892
7552
|
if (this.unfinishedConnection.start !== port) {
|
|
6893
|
-
if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a ===
|
|
6894
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_g = this.unfinishedConnection.start) === null || _g ===
|
|
7553
|
+
if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.start) === null || _b === undefined ? undefined : _b.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && this.unfinishedConnection.type.canFinishOnType(((_f = (_e = port.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '')) {
|
|
7554
|
+
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_g = this.unfinishedConnection.start) === null || _g === undefined ? undefined : _g.id, port.id);
|
|
6895
7555
|
// clean up the previous unfinished connection
|
|
6896
7556
|
this.dropConnection();
|
|
6897
7557
|
addConnectionAction.do();
|
|
6898
7558
|
this.actionStack.add(addConnectionAction);
|
|
6899
|
-
} else if (this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = (_h = this.unfinishedConnection) === null || _h ===
|
|
6900
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_p = this.unfinishedConnection.start) === null || _p ===
|
|
7559
|
+
} else if (this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = (_h = this.unfinishedConnection) === null || _h === undefined ? undefined : _h.start) === null || _j === undefined ? undefined : _j.getNode()) === null || _k === undefined ? undefined : _k.type) === null || _l === undefined ? undefined : _l.id) || '') && this.unfinishedConnection.type.canStartFromType(((_o = (_m = port.getNode()) === null || _m === undefined ? undefined : _m.type) === null || _o === undefined ? undefined : _o.id) || '')) {
|
|
7560
|
+
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_p = this.unfinishedConnection.start) === null || _p === undefined ? undefined : _p.id);
|
|
6901
7561
|
// clean up the previous unfinished connection
|
|
6902
7562
|
this.dropConnection();
|
|
6903
7563
|
addConnectionAction.do();
|
|
@@ -6906,18 +7566,18 @@ class DiagramCanvas {
|
|
|
6906
7566
|
if (this.inferConnectionType) {
|
|
6907
7567
|
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
6908
7568
|
var _a, _b, _c, _d, _e, _f;
|
|
6909
|
-
return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a ===
|
|
7569
|
+
return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.start) === null || _b === undefined ? undefined : _b.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && t.canFinishOnType(((_f = (_e = port.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '');
|
|
6910
7570
|
});
|
|
6911
7571
|
let invertConnection = false;
|
|
6912
7572
|
if (differentConnectionType === undefined) {
|
|
6913
7573
|
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
6914
7574
|
var _a, _b, _c, _d, _e, _f;
|
|
6915
|
-
return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a ===
|
|
7575
|
+
return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.start) === null || _b === undefined ? undefined : _b.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && t.canStartFromType(((_f = (_e = port.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '');
|
|
6916
7576
|
});
|
|
6917
7577
|
invertConnection = true;
|
|
6918
7578
|
}
|
|
6919
7579
|
if (differentConnectionType !== undefined) {
|
|
6920
|
-
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_q = this.unfinishedConnection.start) === null || _q ===
|
|
7580
|
+
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_q = this.unfinishedConnection.start) === null || _q === undefined ? undefined : _q.id, invertConnection ? (_r = this.unfinishedConnection.start) === null || _r === undefined ? undefined : _r.id : port.id);
|
|
6921
7581
|
// clean up the previous unfinished connection
|
|
6922
7582
|
this.dropConnection();
|
|
6923
7583
|
addConnectionAction.do();
|
|
@@ -6939,9 +7599,9 @@ class DiagramCanvas {
|
|
|
6939
7599
|
}
|
|
6940
7600
|
dropConnection() {
|
|
6941
7601
|
var _a, _b, _c, _d;
|
|
6942
|
-
(_a = this.unfinishedConnection) === null || _a ===
|
|
6943
|
-
(_b = this.unfinishedConnection) === null || _b ===
|
|
6944
|
-
(_d = (_c = this.unfinishedConnection) === null || _c ===
|
|
7602
|
+
(_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.setStart(undefined);
|
|
7603
|
+
(_b = this.unfinishedConnection) === null || _b === undefined ? undefined : _b.setEnd(undefined);
|
|
7604
|
+
(_d = (_c = this.unfinishedConnection) === null || _c === undefined ? undefined : _c.select()) === null || _d === undefined ? undefined : _d.remove();
|
|
6945
7605
|
this.unfinishedConnection = undefined;
|
|
6946
7606
|
}
|
|
6947
7607
|
cancelAllUserActions() {
|
|
@@ -6986,9 +7646,9 @@ class DiagramCanvas {
|
|
|
6986
7646
|
// keep the field from shrinking below its original size
|
|
6987
7647
|
const newWidth = Math.max(inputFieldWidth, width);
|
|
6988
7648
|
const newHeight = Math.max(inputFieldHeight, height);
|
|
6989
|
-
inputFieldContainer === null || inputFieldContainer ===
|
|
7649
|
+
inputFieldContainer === null || inputFieldContainer === undefined ? undefined : inputFieldContainer.attr('width', `${newWidth}px`);
|
|
6990
7650
|
inputField.style('width', `${newWidth}px`);
|
|
6991
|
-
inputFieldContainer === null || inputFieldContainer ===
|
|
7651
|
+
inputFieldContainer === null || inputFieldContainer === undefined ? undefined : inputFieldContainer.attr('height', `${newHeight}px`);
|
|
6992
7652
|
inputField.style('height', `${newHeight}px`);
|
|
6993
7653
|
if (changeCallback) {
|
|
6994
7654
|
changeCallback(value);
|
|
@@ -7010,13 +7670,13 @@ class DiagramCanvas {
|
|
|
7010
7670
|
var _a, _b, _c;
|
|
7011
7671
|
// when removing an element, a blur event is emitted
|
|
7012
7672
|
// we remove the listener for blur so that it doesn't shoot again on element removal
|
|
7013
|
-
(_b = (_a = this.inputFieldContainer) === null || _a ===
|
|
7014
|
-
(_c = this.inputFieldContainer) === null || _c ===
|
|
7673
|
+
(_b = (_a = this.inputFieldContainer) === null || _a === undefined ? undefined : _a.select('input')) === null || _b === undefined ? undefined : _b.on(exports.Events.Blur, null);
|
|
7674
|
+
(_c = this.inputFieldContainer) === null || _c === undefined ? undefined : _c.remove();
|
|
7015
7675
|
this.inputFieldContainer = undefined;
|
|
7016
7676
|
}
|
|
7017
7677
|
minimumSizeOfField(field) {
|
|
7018
7678
|
var _a, _b;
|
|
7019
|
-
const pNode = (_b = (_a = field.select()) === null || _a ===
|
|
7679
|
+
const pNode = (_b = (_a = field.select()) === null || _a === undefined ? undefined : _a.select('p')) === null || _b === undefined ? undefined : _b.node();
|
|
7020
7680
|
if (!pNode) {
|
|
7021
7681
|
// happens when a field has been created but not updated in view yet
|
|
7022
7682
|
return [0, 0];
|
|
@@ -7031,10 +7691,11 @@ class DiagramCanvas {
|
|
|
7031
7691
|
if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && !d.removed) {
|
|
7032
7692
|
setCursorStyle(exports.CursorStyle.Grabbing);
|
|
7033
7693
|
this.draggingFrom = [event.x, event.y];
|
|
7034
|
-
if (d.selected) {
|
|
7694
|
+
if (d.selected && this.userSelection.count(e => e instanceof DiagramNode) > 1) {
|
|
7035
7695
|
this.currentAction = new MoveAction(this, this.userSelection.filter(e => e instanceof DiagramNode).map(n => n.id), d.coords);
|
|
7036
7696
|
} else {
|
|
7037
|
-
|
|
7697
|
+
const ancestorOfNode = d.getLastAncestor();
|
|
7698
|
+
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.MoveNode, d.id, d.getGeometry(), d.getGeometry(), ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.id, ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id), ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id));
|
|
7038
7699
|
}
|
|
7039
7700
|
} else {
|
|
7040
7701
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
@@ -7044,7 +7705,7 @@ class DiagramCanvas {
|
|
|
7044
7705
|
* Method to call to continue the moving of a node triggered by a user drag event.
|
|
7045
7706
|
*/
|
|
7046
7707
|
continueMovingNode(event, d) {
|
|
7047
|
-
if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && this.currentAction instanceof MoveAction && !d.removed) {
|
|
7708
|
+
if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && (this.currentAction instanceof MoveAction || this.currentAction instanceof SetGeometryAction) && !d.removed) {
|
|
7048
7709
|
const newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
7049
7710
|
if (d.selected) {
|
|
7050
7711
|
this.userSelection.move([newNodeCoords[0] - d.coords[0], newNodeCoords[1] - d.coords[1]]);
|
|
@@ -7059,24 +7720,58 @@ class DiagramCanvas {
|
|
|
7059
7720
|
* Method to call to finish the moving of a node triggered by a user drag event.
|
|
7060
7721
|
*/
|
|
7061
7722
|
finishMovingNode(event, d) {
|
|
7723
|
+
var _a, _b, _c;
|
|
7062
7724
|
if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && !d.removed) {
|
|
7063
7725
|
// prevent drag behavior if mouse hasn't moved
|
|
7064
|
-
if (
|
|
7726
|
+
if (this.draggingFrom[0] !== event.x || this.draggingFrom[1] !== event.y) {
|
|
7065
7727
|
let newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
7066
7728
|
if (this.snapToGrid) {
|
|
7067
7729
|
newNodeCoords = this.getClosestGridPoint(newNodeCoords);
|
|
7068
7730
|
}
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7731
|
+
if (this.currentAction instanceof MoveAction) {
|
|
7732
|
+
const movingFrom = this.currentAction.delta;
|
|
7733
|
+
this.currentAction.delta = [newNodeCoords[0] - movingFrom[0], newNodeCoords[1] - movingFrom[1]];
|
|
7734
|
+
// reset position of node prior to moving it again
|
|
7735
|
+
if (d.selected) {
|
|
7736
|
+
this.userSelection.move([movingFrom[0] - d.coords[0], movingFrom[1] - d.coords[1]]);
|
|
7737
|
+
} else {
|
|
7738
|
+
d.move(movingFrom);
|
|
7739
|
+
}
|
|
7740
|
+
} else if (this.currentAction instanceof SetGeometryAction) {
|
|
7741
|
+
d.move(newNodeCoords);
|
|
7742
|
+
// if moving a single node, we can change the node's parent,
|
|
7743
|
+
// so we check whether we dropped this node on a potential parent
|
|
7744
|
+
const nodesAtLocation = this.model.nodes.getAtCoordinates(event.x, event.y).filter(n => n.id !== d.id && !n.isDescendantOf(d));
|
|
7745
|
+
// filter by which nodes can have this node as a child
|
|
7746
|
+
const nodesAtLocationWhichCanHaveNodeAsAChild = nodesAtLocation.filter(n => n.type.childrenTypes.includes(d.type.id));
|
|
7747
|
+
// filter by which nodes don't have descendants in this collection
|
|
7748
|
+
const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
|
|
7749
|
+
const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
|
|
7750
|
+
if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
|
|
7751
|
+
const ancestorOfDroppedOn = droppedOn === null || droppedOn === undefined ? undefined : droppedOn.getLastAncestor();
|
|
7752
|
+
const fromChildGeometry = this.currentAction.from;
|
|
7753
|
+
const setParentAction = new SetParentAction(this, d.id, (_a = d.parent) === null || _a === undefined ? undefined : _a.id, droppedOn === null || droppedOn === undefined ? undefined : droppedOn.id, fromChildGeometry, d.getGeometry(), ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.id, ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.getGeometry(d.id), ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.getGeometry(d.id));
|
|
7754
|
+
(_b = d.parent) === null || _b === undefined ? undefined : _b.removeChild(d);
|
|
7755
|
+
if (droppedOn !== undefined) {
|
|
7756
|
+
droppedOn.addChild(d);
|
|
7757
|
+
}
|
|
7758
|
+
setParentAction.toChildGeometry = d.getGeometry(d.id);
|
|
7759
|
+
setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.getGeometry(d.id);
|
|
7760
|
+
this.currentAction = setParentAction;
|
|
7761
|
+
} else {
|
|
7762
|
+
const ancestorOfNode = d === null || d === undefined ? undefined : d.getLastAncestor();
|
|
7763
|
+
this.currentAction.ancestorId = ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.id;
|
|
7764
|
+
this.currentAction.fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id);
|
|
7765
|
+
(_c = d.parent) === null || _c === undefined ? undefined : _c.fitToChild(d);
|
|
7766
|
+
this.currentAction.to = d.getGeometry(d.id);
|
|
7767
|
+
this.currentAction.toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id);
|
|
7768
|
+
}
|
|
7769
|
+
}
|
|
7770
|
+
if (this.currentAction !== undefined) {
|
|
7771
|
+
this.currentAction.do();
|
|
7772
|
+
this.actionStack.add(this.currentAction);
|
|
7773
|
+
this.currentAction = undefined;
|
|
7076
7774
|
}
|
|
7077
|
-
this.currentAction.do();
|
|
7078
|
-
this.actionStack.add(this.currentAction);
|
|
7079
|
-
this.currentAction = undefined;
|
|
7080
7775
|
}
|
|
7081
7776
|
}
|
|
7082
7777
|
setCursorStyle();
|
|
@@ -7095,14 +7790,14 @@ class DiagramCanvas {
|
|
|
7095
7790
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7096
7791
|
if (this.draggingFrom[0] !== pointerCoords[0] || this.draggingFrom[1] !== pointerCoords[1]) {
|
|
7097
7792
|
setCursorStyle(exports.CursorStyle.Crosshair);
|
|
7098
|
-
(_d = (_c = (_b = (_a = this.multipleSelectionContainer) === null || _a ===
|
|
7793
|
+
(_d = (_c = (_b = (_a = this.multipleSelectionContainer) === null || _a === undefined ? undefined : _a.attr('x', Math.min(this.draggingFrom[0], pointerCoords[0]))) === null || _b === undefined ? undefined : _b.attr('y', Math.min(this.draggingFrom[1], pointerCoords[1]))) === null || _c === undefined ? undefined : _c.attr('width', Math.abs(this.draggingFrom[0] - pointerCoords[0]))) === null || _d === undefined ? undefined : _d.attr('height', Math.abs(this.draggingFrom[1] - pointerCoords[1]));
|
|
7099
7794
|
this.dragging = true;
|
|
7100
7795
|
}
|
|
7101
7796
|
}
|
|
7102
7797
|
finishMultipleSelection(event) {
|
|
7103
7798
|
var _a;
|
|
7104
7799
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7105
|
-
(_a = this.multipleSelectionContainer) === null || _a ===
|
|
7800
|
+
(_a = this.multipleSelectionContainer) === null || _a === undefined ? undefined : _a.remove();
|
|
7106
7801
|
this.multipleSelectionContainer = undefined;
|
|
7107
7802
|
this.userSelection.clear();
|
|
7108
7803
|
for (const node of this.model.nodes) {
|
|
@@ -7111,6 +7806,7 @@ class DiagramCanvas {
|
|
|
7111
7806
|
}
|
|
7112
7807
|
}
|
|
7113
7808
|
this.multipleSelectionOn = false;
|
|
7809
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(this.userSelection.all(), true));
|
|
7114
7810
|
setCursorStyle();
|
|
7115
7811
|
}
|
|
7116
7812
|
}
|
|
@@ -7230,7 +7926,7 @@ class CollabClient {
|
|
|
7230
7926
|
const initialModel = message.initialModel;
|
|
7231
7927
|
new DagaImporter().import(session.canvas.model, initialModel);
|
|
7232
7928
|
this.startSyncing(session);
|
|
7233
|
-
(_a = session.joinRoomResolve) === null || _a ===
|
|
7929
|
+
(_a = session.joinRoomResolve) === null || _a === undefined ? undefined : _a.call(session);
|
|
7234
7930
|
session.joinRoomResolve = undefined;
|
|
7235
7931
|
break;
|
|
7236
7932
|
}
|
|
@@ -7253,7 +7949,7 @@ class CollabClient {
|
|
|
7253
7949
|
session.locator = message.locator;
|
|
7254
7950
|
this.pendingSessions.delete(message.refId);
|
|
7255
7951
|
this.sessions.set(session.locator, session);
|
|
7256
|
-
(_b = session.createRoomResolve) === null || _b ===
|
|
7952
|
+
(_b = session.createRoomResolve) === null || _b === undefined ? undefined : _b.call(session, session.locator);
|
|
7257
7953
|
session.createRoomResolve = undefined;
|
|
7258
7954
|
// Deliver queued AddMessages now that we have a locator.
|
|
7259
7955
|
for (const message of session.addQueue) {
|
|
@@ -7509,21 +8205,21 @@ class Grid {
|
|
|
7509
8205
|
*/
|
|
7510
8206
|
class AdjacencyLayout {
|
|
7511
8207
|
apply(model) {
|
|
7512
|
-
var _a
|
|
8208
|
+
var _a;
|
|
7513
8209
|
if (model.nodes.length === 0) {
|
|
7514
8210
|
// nothing to arrange...
|
|
7515
8211
|
return model;
|
|
7516
8212
|
}
|
|
7517
8213
|
// arrange nodes
|
|
7518
8214
|
const nodeArrangement = new Grid();
|
|
7519
|
-
const nodesToBeArranged = model.nodes.
|
|
8215
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7520
8216
|
while (nodesToBeArranged.length > 0) {
|
|
7521
8217
|
arrangeNode(nodesToBeArranged[0], nodeArrangement, [0, 0], nodesToBeArranged);
|
|
7522
8218
|
}
|
|
7523
8219
|
// place nodes according to arrangement
|
|
7524
8220
|
const maximumWidth = Math.max(...model.nodes.map(n => n.width));
|
|
7525
8221
|
const maximumHeight = Math.max(...model.nodes.map(n => n.height));
|
|
7526
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
8222
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
7527
8223
|
for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
|
|
7528
8224
|
for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
|
|
7529
8225
|
const node = nodeArrangement.get([x, y]);
|
|
@@ -7532,7 +8228,6 @@ class AdjacencyLayout {
|
|
|
7532
8228
|
}
|
|
7533
8229
|
}
|
|
7534
8230
|
}
|
|
7535
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7536
8231
|
return model;
|
|
7537
8232
|
}
|
|
7538
8233
|
}
|
|
@@ -7553,14 +8248,14 @@ const arrangeNode = (node, nodeArrangement, coords, nodesToBeArranged) => {
|
|
|
7553
8248
|
*/
|
|
7554
8249
|
class BreadthAdjacencyLayout {
|
|
7555
8250
|
apply(model) {
|
|
7556
|
-
var _a
|
|
8251
|
+
var _a;
|
|
7557
8252
|
if (model.nodes.length === 0) {
|
|
7558
8253
|
// nothing to arrange...
|
|
7559
8254
|
return model;
|
|
7560
8255
|
}
|
|
7561
8256
|
// arrange nodes
|
|
7562
8257
|
const nodeArrangement = new Grid();
|
|
7563
|
-
const nodesToBeArranged = model.nodes.
|
|
8258
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7564
8259
|
const nodeGridIndices = {};
|
|
7565
8260
|
const firstNode = nodesToBeArranged[0];
|
|
7566
8261
|
let currentNodeLevel = [firstNode];
|
|
@@ -7589,7 +8284,7 @@ class BreadthAdjacencyLayout {
|
|
|
7589
8284
|
// place nodes according to arrangement
|
|
7590
8285
|
const maximumWidth = Math.max(...model.nodes.map(n => n.width));
|
|
7591
8286
|
const maximumHeight = Math.max(...model.nodes.map(n => n.height));
|
|
7592
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
8287
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
7593
8288
|
for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
|
|
7594
8289
|
for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
|
|
7595
8290
|
const node = nodeArrangement.get([x, y]);
|
|
@@ -7598,7 +8293,6 @@ class BreadthAdjacencyLayout {
|
|
|
7598
8293
|
}
|
|
7599
8294
|
}
|
|
7600
8295
|
}
|
|
7601
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7602
8296
|
return model;
|
|
7603
8297
|
}
|
|
7604
8298
|
}
|
|
@@ -7609,13 +8303,13 @@ class BreadthAdjacencyLayout {
|
|
|
7609
8303
|
*/
|
|
7610
8304
|
class BreadthLayout {
|
|
7611
8305
|
apply(model) {
|
|
7612
|
-
var _a
|
|
8306
|
+
var _a;
|
|
7613
8307
|
if (model.nodes.length === 0) {
|
|
7614
8308
|
// nothing to arrange...
|
|
7615
8309
|
return model;
|
|
7616
8310
|
}
|
|
7617
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
7618
|
-
let nodesToBeArranged = model.nodes.
|
|
8311
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8312
|
+
let nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7619
8313
|
// Arrange nodes by a breadth first search
|
|
7620
8314
|
const firstNode = nodesToBeArranged[0];
|
|
7621
8315
|
removeIfExists(nodesToBeArranged, firstNode);
|
|
@@ -7661,7 +8355,6 @@ class BreadthLayout {
|
|
|
7661
8355
|
for (const connection of model.connections) {
|
|
7662
8356
|
connection.tighten();
|
|
7663
8357
|
}
|
|
7664
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7665
8358
|
return model;
|
|
7666
8359
|
}
|
|
7667
8360
|
}
|
|
@@ -7672,14 +8365,14 @@ class BreadthLayout {
|
|
|
7672
8365
|
*/
|
|
7673
8366
|
class ForceLayout {
|
|
7674
8367
|
apply(model) {
|
|
7675
|
-
var _a
|
|
8368
|
+
var _a;
|
|
7676
8369
|
if (model.nodes.length === 0) {
|
|
7677
8370
|
// nothing to arrange...
|
|
7678
8371
|
return model;
|
|
7679
8372
|
}
|
|
7680
8373
|
// as a starting point, we apply a simple layout
|
|
7681
8374
|
new BreadthLayout().apply(model);
|
|
7682
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
8375
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
7683
8376
|
const coolingFactor = 0.99;
|
|
7684
8377
|
const minimumTemperature = 1;
|
|
7685
8378
|
const attractionFactor = 0.1;
|
|
@@ -7757,7 +8450,6 @@ class ForceLayout {
|
|
|
7757
8450
|
for (const connection of model.connections) {
|
|
7758
8451
|
connection.tighten();
|
|
7759
8452
|
}
|
|
7760
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7761
8453
|
return model;
|
|
7762
8454
|
}
|
|
7763
8455
|
}
|
|
@@ -7768,20 +8460,19 @@ class ForceLayout {
|
|
|
7768
8460
|
*/
|
|
7769
8461
|
class HorizontalLayout {
|
|
7770
8462
|
apply(model) {
|
|
7771
|
-
var _a
|
|
8463
|
+
var _a;
|
|
7772
8464
|
if (model.nodes.length === 0) {
|
|
7773
8465
|
// nothing to arrange...
|
|
7774
8466
|
return model;
|
|
7775
8467
|
}
|
|
7776
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
7777
|
-
const nodesToBeArranged = model.nodes.
|
|
8468
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8469
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7778
8470
|
nodesToBeArranged.sort((a, b) => b.type.priority - a.type.priority);
|
|
7779
8471
|
let widthAccumulator = 0;
|
|
7780
8472
|
for (const node of nodesToBeArranged) {
|
|
7781
8473
|
node.move([widthAccumulator, 0]);
|
|
7782
8474
|
widthAccumulator += node.width + gapSize;
|
|
7783
8475
|
}
|
|
7784
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7785
8476
|
return model;
|
|
7786
8477
|
}
|
|
7787
8478
|
}
|
|
@@ -7792,7 +8483,7 @@ class HorizontalLayout {
|
|
|
7792
8483
|
*/
|
|
7793
8484
|
class PriorityLayout {
|
|
7794
8485
|
apply(model) {
|
|
7795
|
-
var _a
|
|
8486
|
+
var _a;
|
|
7796
8487
|
if (model.nodes.length === 0) {
|
|
7797
8488
|
// nothing to arrange...
|
|
7798
8489
|
return model;
|
|
@@ -7804,10 +8495,10 @@ class PriorityLayout {
|
|
|
7804
8495
|
new BreadthLayout().apply(model);
|
|
7805
8496
|
return model;
|
|
7806
8497
|
}
|
|
7807
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
7808
|
-
const nodesToBeArranged = model.nodes.
|
|
8498
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8499
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7809
8500
|
const nodeArrangement = [];
|
|
7810
|
-
const nodesWithMaximumPriorityToBeArranged = model.nodes.filter(n => n.getPriority() >= maximumPriority);
|
|
8501
|
+
const nodesWithMaximumPriorityToBeArranged = model.nodes.filter(n => !n.parent).filter(n => n.getPriority() >= maximumPriority);
|
|
7811
8502
|
const nodesWithMaximumPriority = [];
|
|
7812
8503
|
if (nodesWithMaximumPriorityToBeArranged.length > 1) {
|
|
7813
8504
|
// use bfs to sort nodes by distance to the first node
|
|
@@ -7889,7 +8580,6 @@ class PriorityLayout {
|
|
|
7889
8580
|
for (const connection of model.connections) {
|
|
7890
8581
|
connection.tighten();
|
|
7891
8582
|
}
|
|
7892
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7893
8583
|
return model;
|
|
7894
8584
|
}
|
|
7895
8585
|
}
|
|
@@ -7900,7 +8590,7 @@ class PriorityLayout {
|
|
|
7900
8590
|
*/
|
|
7901
8591
|
class TreeLayout {
|
|
7902
8592
|
apply(model) {
|
|
7903
|
-
var _a
|
|
8593
|
+
var _a;
|
|
7904
8594
|
if (model.nodes.length === 0) {
|
|
7905
8595
|
// nothing to arrange...
|
|
7906
8596
|
return model;
|
|
@@ -7912,8 +8602,8 @@ class TreeLayout {
|
|
|
7912
8602
|
new BreadthLayout().apply(model);
|
|
7913
8603
|
return model;
|
|
7914
8604
|
}
|
|
7915
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
7916
|
-
const nodesToBeArranged =
|
|
8605
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8606
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent).sort((n1, n2) => n2.getPriority() - n1.getPriority());
|
|
7917
8607
|
const branches = [];
|
|
7918
8608
|
while (nodesToBeArranged.length > 0) {
|
|
7919
8609
|
const nodeToBeArranged = nodesToBeArranged[0];
|
|
@@ -7942,7 +8632,6 @@ class TreeLayout {
|
|
|
7942
8632
|
for (const connection of model.connections) {
|
|
7943
8633
|
connection.tighten();
|
|
7944
8634
|
}
|
|
7945
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7946
8635
|
return model;
|
|
7947
8636
|
}
|
|
7948
8637
|
}
|
|
@@ -7999,20 +8688,19 @@ class Branch {
|
|
|
7999
8688
|
*/
|
|
8000
8689
|
class VerticalLayout {
|
|
8001
8690
|
apply(model) {
|
|
8002
|
-
var _a
|
|
8691
|
+
var _a;
|
|
8003
8692
|
if (model.nodes.length === 0) {
|
|
8004
8693
|
// nothing to arrange...
|
|
8005
8694
|
return model;
|
|
8006
8695
|
}
|
|
8007
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
8008
|
-
const nodesToBeArranged = model.nodes.
|
|
8696
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8697
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
8009
8698
|
nodesToBeArranged.sort((a, b) => b.type.priority - a.type.priority);
|
|
8010
8699
|
let heightAccumulator = 0;
|
|
8011
8700
|
for (const node of nodesToBeArranged) {
|
|
8012
8701
|
node.move([0, heightAccumulator]);
|
|
8013
8702
|
heightAccumulator += node.height + gapSize;
|
|
8014
8703
|
}
|
|
8015
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
8016
8704
|
return model;
|
|
8017
8705
|
}
|
|
8018
8706
|
}
|
|
@@ -8030,12 +8718,20 @@ const layouts = {
|
|
|
8030
8718
|
tree: new TreeLayout(),
|
|
8031
8719
|
vertical: new VerticalLayout()
|
|
8032
8720
|
};
|
|
8721
|
+
const getLocationsOfNodes = model => {
|
|
8722
|
+
const locations = {};
|
|
8723
|
+
for (const node of model.nodes) {
|
|
8724
|
+
locations[node.id] = node.coords;
|
|
8725
|
+
}
|
|
8726
|
+
return locations;
|
|
8727
|
+
};
|
|
8033
8728
|
|
|
8034
8729
|
exports.ACTION_STACK_SIZE = ACTION_STACK_SIZE;
|
|
8035
8730
|
exports.ActionStack = ActionStack;
|
|
8036
8731
|
exports.AddConnectionAction = AddConnectionAction;
|
|
8037
8732
|
exports.AddNodeAction = AddNodeAction;
|
|
8038
8733
|
exports.AdjacencyLayout = AdjacencyLayout;
|
|
8734
|
+
exports.ApplyLayoutAction = ApplyLayoutAction;
|
|
8039
8735
|
exports.BreadthAdjacencyLayout = BreadthAdjacencyLayout;
|
|
8040
8736
|
exports.BreadthLayout = BreadthLayout;
|
|
8041
8737
|
exports.CollabClient = CollabClient;
|
|
@@ -8049,6 +8745,7 @@ exports.DiagramConnectionType = DiagramConnectionType;
|
|
|
8049
8745
|
exports.DiagramContextMenu = DiagramContextMenu;
|
|
8050
8746
|
exports.DiagramDecorator = DiagramDecorator;
|
|
8051
8747
|
exports.DiagramDecoratorSet = DiagramDecoratorSet;
|
|
8748
|
+
exports.DiagramDoubleClickEvent = DiagramDoubleClickEvent;
|
|
8052
8749
|
exports.DiagramElement = DiagramElement;
|
|
8053
8750
|
exports.DiagramElementSet = DiagramElementSet;
|
|
8054
8751
|
exports.DiagramEntitySet = DiagramEntitySet;
|
|
@@ -8063,6 +8760,7 @@ exports.DiagramObject = DiagramObject;
|
|
|
8063
8760
|
exports.DiagramObjectSet = DiagramObjectSet;
|
|
8064
8761
|
exports.DiagramPort = DiagramPort;
|
|
8065
8762
|
exports.DiagramPortSet = DiagramPortSet;
|
|
8763
|
+
exports.DiagramSecondaryClickEvent = DiagramSecondaryClickEvent;
|
|
8066
8764
|
exports.DiagramSection = DiagramSection;
|
|
8067
8765
|
exports.DiagramSectionSet = DiagramSectionSet;
|
|
8068
8766
|
exports.DiagramUserHighlight = DiagramUserHighlight;
|
|
@@ -8070,11 +8768,14 @@ exports.DiagramUserSelection = DiagramUserSelection;
|
|
|
8070
8768
|
exports.EditFieldAction = EditFieldAction;
|
|
8071
8769
|
exports.ForceLayout = ForceLayout;
|
|
8072
8770
|
exports.HorizontalLayout = HorizontalLayout;
|
|
8771
|
+
exports.MoveAction = MoveAction;
|
|
8772
|
+
exports.PasteAction = PasteAction;
|
|
8073
8773
|
exports.PriorityLayout = PriorityLayout;
|
|
8074
8774
|
exports.Property = Property;
|
|
8075
8775
|
exports.PropertySet = PropertySet;
|
|
8076
8776
|
exports.RemoveAction = RemoveAction;
|
|
8077
8777
|
exports.SetGeometryAction = SetGeometryAction;
|
|
8778
|
+
exports.SetParentAction = SetParentAction;
|
|
8078
8779
|
exports.TreeLayout = TreeLayout;
|
|
8079
8780
|
exports.UpdateValuesAction = UpdateValuesAction;
|
|
8080
8781
|
exports.ValueSet = ValueSet;
|
|
@@ -8082,15 +8783,18 @@ exports.VerticalLayout = VerticalLayout;
|
|
|
8082
8783
|
exports.addIfNotExists = addIfNotExists;
|
|
8083
8784
|
exports.diff = diff;
|
|
8084
8785
|
exports.equals = equals;
|
|
8786
|
+
exports.filterByOnlyAncestors = filterByOnlyAncestors;
|
|
8787
|
+
exports.filterByOnlyDescendants = filterByOnlyDescendants;
|
|
8085
8788
|
exports.generalClosedPath = generalClosedPath;
|
|
8086
8789
|
exports.getBottomMargin = getBottomMargin;
|
|
8087
|
-
exports.getBottomPadding = getBottomPadding;
|
|
8790
|
+
exports.getBottomPadding = getBottomPadding$1;
|
|
8088
8791
|
exports.getLeftMargin = getLeftMargin;
|
|
8089
|
-
exports.getLeftPadding = getLeftPadding;
|
|
8792
|
+
exports.getLeftPadding = getLeftPadding$1;
|
|
8793
|
+
exports.getLocationsOfNodes = getLocationsOfNodes;
|
|
8090
8794
|
exports.getRightMargin = getRightMargin;
|
|
8091
|
-
exports.getRightPadding = getRightPadding;
|
|
8795
|
+
exports.getRightPadding = getRightPadding$1;
|
|
8092
8796
|
exports.getTopMargin = getTopMargin;
|
|
8093
|
-
exports.getTopPadding = getTopPadding;
|
|
8797
|
+
exports.getTopPadding = getTopPadding$1;
|
|
8094
8798
|
exports.isObject = isObject;
|
|
8095
8799
|
exports.layouts = layouts;
|
|
8096
8800
|
exports.linePath = linePath;
|