@metadev/daga 3.1.3 → 3.1.5
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 +18 -0
- package/index.cjs.js +201 -83
- package/index.esm.js +199 -84
- package/package.json +1 -1
- package/src/index.d.ts +5 -5
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +2 -1
- package/src/lib/diagram/converters/daga-model.d.ts +2 -0
- package/src/lib/diagram/diagram-config.d.ts +81 -26
- package/src/lib/diagram/model/diagram-node.d.ts +4 -4
- package/src/lib/diagram/model/diagram-port.d.ts +71 -6
- package/src/lib/diagram/model/diagram-section.d.ts +3 -3
- package/src/lib/interfaces/canvas.d.ts +7 -2
package/index.esm.js
CHANGED
|
@@ -1767,11 +1767,11 @@ class DiagramConnection extends DiagramElement {
|
|
|
1767
1767
|
if (start !== undefined) {
|
|
1768
1768
|
start.outgoingConnections.push(this);
|
|
1769
1769
|
this.startDirection = start === null || start === undefined ? undefined : start.direction;
|
|
1770
|
-
this.startCoords = (start === null || start === undefined ? undefined : start.
|
|
1770
|
+
this.startCoords = (start === null || start === undefined ? undefined : start.connectionPoint) || [0, 0];
|
|
1771
1771
|
}
|
|
1772
1772
|
} else {
|
|
1773
1773
|
this.startDirection = start === null || start === undefined ? undefined : start.direction;
|
|
1774
|
-
this.startCoords = (start === null || start === undefined ? undefined : start.
|
|
1774
|
+
this.startCoords = (start === null || start === undefined ? undefined : start.connectionPoint) || [0, 0];
|
|
1775
1775
|
}
|
|
1776
1776
|
this.updateInView();
|
|
1777
1777
|
}
|
|
@@ -1790,11 +1790,11 @@ class DiagramConnection extends DiagramElement {
|
|
|
1790
1790
|
if (end !== undefined) {
|
|
1791
1791
|
end.incomingConnections.push(this);
|
|
1792
1792
|
this.endDirection = end === null || end === undefined ? undefined : end.direction;
|
|
1793
|
-
this.endCoords = (end === null || end === undefined ? undefined : end.
|
|
1793
|
+
this.endCoords = (end === null || end === undefined ? undefined : end.connectionPoint) || [0, 0];
|
|
1794
1794
|
}
|
|
1795
1795
|
} else {
|
|
1796
1796
|
this.endDirection = end === null || end === undefined ? undefined : end.direction;
|
|
1797
|
-
this.endCoords = (end === null || end === undefined ? undefined : end.
|
|
1797
|
+
this.endCoords = (end === null || end === undefined ? undefined : end.connectionPoint) || [0, 0];
|
|
1798
1798
|
}
|
|
1799
1799
|
this.updateInView();
|
|
1800
1800
|
}
|
|
@@ -1812,6 +1812,10 @@ class DiagramConnection extends DiagramElement {
|
|
|
1812
1812
|
// alternative start port not valid, it is the same as the end port
|
|
1813
1813
|
continue checkAlternativeStartPorts;
|
|
1814
1814
|
}
|
|
1815
|
+
if (!alternativeStartPort.allowsOutgoing) {
|
|
1816
|
+
// alternative start port not valid, it doesn't allow outgoing connections
|
|
1817
|
+
continue checkAlternativeStartPorts;
|
|
1818
|
+
}
|
|
1815
1819
|
{
|
|
1816
1820
|
for (const connection of alternativeStartPort.outgoingConnections) {
|
|
1817
1821
|
if (connection !== this && connection.end === this.end) {
|
|
@@ -1839,24 +1843,28 @@ class DiagramConnection extends DiagramElement {
|
|
|
1839
1843
|
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]);
|
|
1840
1844
|
checkAlternativeEndPorts: for (const alternativeEndPort of alternativeEndPortsSortedByDistanceAscending) {
|
|
1841
1845
|
if (alternativeEndPort === this.start) {
|
|
1842
|
-
// alternative
|
|
1846
|
+
// alternative end port not valid, it is the same as the end port
|
|
1847
|
+
continue checkAlternativeEndPorts;
|
|
1848
|
+
}
|
|
1849
|
+
if (!alternativeEndPort.allowsIncoming) {
|
|
1850
|
+
// alternative end port not valid, it doesn't allow incoming connections
|
|
1843
1851
|
continue checkAlternativeEndPorts;
|
|
1844
1852
|
}
|
|
1845
1853
|
{
|
|
1846
1854
|
for (const connection of alternativeEndPort.incomingConnections) {
|
|
1847
1855
|
if (connection !== this && connection.start === this.start) {
|
|
1848
|
-
// alternative
|
|
1856
|
+
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
1849
1857
|
continue checkAlternativeEndPorts;
|
|
1850
1858
|
}
|
|
1851
1859
|
}
|
|
1852
1860
|
for (const connection of alternativeEndPort.outgoingConnections) {
|
|
1853
1861
|
if (connection !== this && connection.end === this.start) {
|
|
1854
|
-
// alternative
|
|
1862
|
+
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
1855
1863
|
continue checkAlternativeEndPorts;
|
|
1856
1864
|
}
|
|
1857
1865
|
}
|
|
1858
1866
|
}
|
|
1859
|
-
// found a valid
|
|
1867
|
+
// found a valid end port
|
|
1860
1868
|
if (alternativeEndPort === this.end) {
|
|
1861
1869
|
break checkAlternativeEndPorts;
|
|
1862
1870
|
} else {
|
|
@@ -2558,25 +2566,25 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
2558
2566
|
if (sectionPorts && sectionPorts.length > 0) {
|
|
2559
2567
|
for (let i = 0; i < sectionPorts.length; ++i) {
|
|
2560
2568
|
const portConfig = sectionPorts[i];
|
|
2561
|
-
const port = this.model.ports.new(section, [section.coords[0] + (
|
|
2562
|
-
if (
|
|
2563
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS),
|
|
2569
|
+
const port = this.model.ports.new(portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined, section, [section.coords[0] + (portConfig.coords[0] || 0), section.coords[1] + (portConfig.coords[1] || 0)], portConfig.connectionPoint !== undefined ? [section.coords[0] + (portConfig.connectionPoint[0] || 0), section.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig === null || portConfig === undefined ? undefined : portConfig.direction, `${section.id}_${i}`);
|
|
2570
|
+
if ((_e = port.type) === null || _e === undefined ? undefined : _e.label) {
|
|
2571
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === undefined ? undefined : _f.label);
|
|
2572
|
+
const labelWidth = 6 * labelConfiguration.fontSize + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
2573
|
+
const labelHeight = labelConfiguration.fontSize + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
2564
2574
|
let labelCoords;
|
|
2565
2575
|
switch (port.direction) {
|
|
2566
|
-
case Side.Top:
|
|
2567
|
-
case Side.Left:
|
|
2568
|
-
labelCoords = [port.coords[0] - labelConfiguration.fontSize, port.coords[1] - labelConfiguration.fontSize];
|
|
2569
|
-
break;
|
|
2570
2576
|
case Side.Bottom:
|
|
2571
|
-
|
|
2572
|
-
break;
|
|
2577
|
+
case Side.Left:
|
|
2573
2578
|
case Side.Right:
|
|
2574
|
-
labelCoords = [port.coords[0]
|
|
2579
|
+
labelCoords = [port.coords[0] - labelWidth / 2, port.coords[1] - labelHeight - getBottomMargin(labelConfiguration)];
|
|
2580
|
+
break;
|
|
2581
|
+
case Side.Top:
|
|
2582
|
+
labelCoords = [port.coords[0] - labelWidth / 2, port.coords[1] + getTopMargin(labelConfiguration)];
|
|
2575
2583
|
break;
|
|
2576
2584
|
default:
|
|
2577
2585
|
labelCoords = port.coords;
|
|
2578
2586
|
}
|
|
2579
|
-
this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor,
|
|
2587
|
+
this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
2580
2588
|
}
|
|
2581
2589
|
}
|
|
2582
2590
|
}
|
|
@@ -3213,7 +3221,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3213
3221
|
* @returns The instanced node.
|
|
3214
3222
|
*/
|
|
3215
3223
|
new(type, coords, id) {
|
|
3216
|
-
var _a, _b, _c, _d, _e;
|
|
3224
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3217
3225
|
let nodeType;
|
|
3218
3226
|
if (type instanceof DiagramNodeType) {
|
|
3219
3227
|
nodeType = type;
|
|
@@ -3244,25 +3252,25 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3244
3252
|
if (nodeType.ports.length > 0) {
|
|
3245
3253
|
for (let i = 0; i < nodeType.ports.length; ++i) {
|
|
3246
3254
|
const portConfig = nodeType.ports[i];
|
|
3247
|
-
const port = this.model.ports.new(node, [node.coords[0] + portConfig.coords[0], node.coords[1] + portConfig.coords[1]], portConfig.direction, `${node.id}_${i}`);
|
|
3248
|
-
if (
|
|
3249
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS),
|
|
3255
|
+
const port = this.model.ports.new(portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined, node, [node.coords[0] + portConfig.coords[0], node.coords[1] + portConfig.coords[1]], portConfig.connectionPoint !== undefined ? [node.coords[0] + (portConfig.connectionPoint[0] || 0), node.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig.direction, `${node.id}_${i}`);
|
|
3256
|
+
if ((_e = port.type) === null || _e === undefined ? undefined : _e.label) {
|
|
3257
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === undefined ? undefined : _f.label);
|
|
3258
|
+
const labelWidth = 6 * labelConfiguration.fontSize + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
3259
|
+
const labelHeight = labelConfiguration.fontSize + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
3250
3260
|
let labelCoords;
|
|
3251
3261
|
switch (port.direction) {
|
|
3252
|
-
case Side.Top:
|
|
3253
|
-
case Side.Left:
|
|
3254
|
-
labelCoords = [port.coords[0] - labelConfiguration.fontSize, port.coords[1] - labelConfiguration.fontSize];
|
|
3255
|
-
break;
|
|
3256
3262
|
case Side.Bottom:
|
|
3257
|
-
|
|
3258
|
-
break;
|
|
3263
|
+
case Side.Left:
|
|
3259
3264
|
case Side.Right:
|
|
3260
|
-
labelCoords = [port.coords[0]
|
|
3265
|
+
labelCoords = [port.coords[0] - labelWidth / 2, port.coords[1] - labelHeight - getBottomMargin(labelConfiguration)];
|
|
3266
|
+
break;
|
|
3267
|
+
case Side.Top:
|
|
3268
|
+
labelCoords = [port.coords[0] - labelWidth / 2, port.coords[1] + getTopMargin(labelConfiguration)];
|
|
3261
3269
|
break;
|
|
3262
3270
|
default:
|
|
3263
3271
|
labelCoords = port.coords;
|
|
3264
3272
|
}
|
|
3265
|
-
this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor,
|
|
3273
|
+
this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3266
3274
|
}
|
|
3267
3275
|
}
|
|
3268
3276
|
}
|
|
@@ -3272,7 +3280,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3272
3280
|
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);
|
|
3273
3281
|
}
|
|
3274
3282
|
node.valueSet.resetValues();
|
|
3275
|
-
(
|
|
3283
|
+
(_g = node.model.canvas) === null || _g === undefined ? undefined : _g.fitNodeInView(node.id);
|
|
3276
3284
|
return node;
|
|
3277
3285
|
}
|
|
3278
3286
|
remove(id) {
|
|
@@ -3446,10 +3454,38 @@ const getTopPadding = config => {
|
|
|
3446
3454
|
* @see DiagramPort
|
|
3447
3455
|
*/
|
|
3448
3456
|
const DIAGRAM_PORT_DEFAULTS = {
|
|
3449
|
-
radius: 12,
|
|
3450
3457
|
highlightedColor: 'cyan',
|
|
3451
3458
|
selectedColor: 'violet'
|
|
3452
3459
|
};
|
|
3460
|
+
/**
|
|
3461
|
+
* Default values of the parameters of a diagram port.
|
|
3462
|
+
* @private
|
|
3463
|
+
* @see DiagramPort
|
|
3464
|
+
*/
|
|
3465
|
+
const DIAGRAM_PORT_TYPE_DEFAULTS = {
|
|
3466
|
+
name: '',
|
|
3467
|
+
label: null,
|
|
3468
|
+
allowsOutgoing: true,
|
|
3469
|
+
allowsIncoming: true,
|
|
3470
|
+
width: 24
|
|
3471
|
+
};
|
|
3472
|
+
/**
|
|
3473
|
+
* A port type, which holds properties that ports of this type share in common.
|
|
3474
|
+
* @public
|
|
3475
|
+
* @see PortTypeConfig
|
|
3476
|
+
*/
|
|
3477
|
+
class DiagramPortType {
|
|
3478
|
+
constructor(options) {
|
|
3479
|
+
const values = Object.assign(Object.assign({}, DIAGRAM_PORT_TYPE_DEFAULTS), options);
|
|
3480
|
+
this.id = values.id;
|
|
3481
|
+
this.name = values.name;
|
|
3482
|
+
this.label = values.label;
|
|
3483
|
+
this.allowsOutgoing = values.allowsOutgoing;
|
|
3484
|
+
this.allowsIncoming = values.allowsIncoming;
|
|
3485
|
+
this.width = values.width;
|
|
3486
|
+
this.look = values.look;
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3453
3489
|
/**
|
|
3454
3490
|
* A port which is part of a node or section and at which connections can start or end.
|
|
3455
3491
|
* @public
|
|
@@ -3458,7 +3494,34 @@ const DIAGRAM_PORT_DEFAULTS = {
|
|
|
3458
3494
|
* @see DiagramSection
|
|
3459
3495
|
*/
|
|
3460
3496
|
class DiagramPort extends DiagramElement {
|
|
3461
|
-
|
|
3497
|
+
/**
|
|
3498
|
+
* Whether this port can be used as a connection start point.
|
|
3499
|
+
*/
|
|
3500
|
+
get allowsOutgoing() {
|
|
3501
|
+
var _a, _b;
|
|
3502
|
+
return ((_a = this.type) === null || _a === undefined ? undefined : _a.allowsOutgoing) !== undefined ? (_b = this.type) === null || _b === undefined ? undefined : _b.allowsOutgoing : true;
|
|
3503
|
+
}
|
|
3504
|
+
/**
|
|
3505
|
+
* Whether this port can be used as a connection end point.
|
|
3506
|
+
*/
|
|
3507
|
+
get allowsIncoming() {
|
|
3508
|
+
var _a, _b;
|
|
3509
|
+
return ((_a = this.type) === null || _a === undefined ? undefined : _a.allowsIncoming) !== undefined ? (_b = this.type) === null || _b === undefined ? undefined : _b.allowsIncoming : true;
|
|
3510
|
+
}
|
|
3511
|
+
/**
|
|
3512
|
+
* Name of this port. Alias for this port's label's text.
|
|
3513
|
+
* @public
|
|
3514
|
+
*/
|
|
3515
|
+
get name() {
|
|
3516
|
+
var _a;
|
|
3517
|
+
return ((_a = this.label) === null || _a === undefined ? undefined : _a.text) || '';
|
|
3518
|
+
}
|
|
3519
|
+
set name(name) {
|
|
3520
|
+
if (this.label) {
|
|
3521
|
+
this.label.text = name;
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
constructor(model, type, rootElement, coords, connectionPoint, direction, id) {
|
|
3462
3525
|
if (model.ports.get(id) !== undefined) {
|
|
3463
3526
|
throw new Error(`DiagramPort with id "${id}" already exists`);
|
|
3464
3527
|
}
|
|
@@ -3473,8 +3536,10 @@ class DiagramPort extends DiagramElement {
|
|
|
3473
3536
|
* @public
|
|
3474
3537
|
*/
|
|
3475
3538
|
this.incomingConnections = [];
|
|
3539
|
+
this.type = type;
|
|
3476
3540
|
this.rootElement = rootElement;
|
|
3477
3541
|
this.coords = coords;
|
|
3542
|
+
this.connectionPoint = connectionPoint || coords;
|
|
3478
3543
|
this.direction = direction;
|
|
3479
3544
|
}
|
|
3480
3545
|
get removed() {
|
|
@@ -3487,6 +3552,9 @@ class DiagramPort extends DiagramElement {
|
|
|
3487
3552
|
raise() {
|
|
3488
3553
|
var _a;
|
|
3489
3554
|
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
3555
|
+
if (this.label) {
|
|
3556
|
+
this.label.raise();
|
|
3557
|
+
}
|
|
3490
3558
|
for (const connection of this.incomingConnections) {
|
|
3491
3559
|
connection.raise();
|
|
3492
3560
|
}
|
|
@@ -3535,6 +3603,8 @@ class DiagramPort extends DiagramElement {
|
|
|
3535
3603
|
move(coords) {
|
|
3536
3604
|
const coordDifferences = [coords[0] - this.coords[0], coords[1] - this.coords[1]];
|
|
3537
3605
|
this.coords = coords;
|
|
3606
|
+
this.connectionPoint[0] = this.connectionPoint[0] + coordDifferences[0];
|
|
3607
|
+
this.connectionPoint[1] = this.connectionPoint[1] + coordDifferences[1];
|
|
3538
3608
|
for (const connection of this.outgoingConnections) {
|
|
3539
3609
|
connection.setStart(this);
|
|
3540
3610
|
}
|
|
@@ -3557,14 +3627,19 @@ class DiagramPortSet extends DiagramElementSet {
|
|
|
3557
3627
|
*/
|
|
3558
3628
|
constructor(model) {
|
|
3559
3629
|
super();
|
|
3630
|
+
/**
|
|
3631
|
+
* Set of the possible types of port that the ports of this set can have.
|
|
3632
|
+
* @public
|
|
3633
|
+
*/
|
|
3634
|
+
this.types = new DiagramEntitySet();
|
|
3560
3635
|
this.model = model;
|
|
3561
3636
|
}
|
|
3562
3637
|
/**
|
|
3563
3638
|
* Instance a new port and add it to this set. This method is normally called when instancing an element with a port and it is rarely called by itself.
|
|
3564
3639
|
* @private
|
|
3565
3640
|
*/
|
|
3566
|
-
new(rootElement, coords, direction, id) {
|
|
3567
|
-
const port = new DiagramPort(this.model, rootElement, coords, direction, id);
|
|
3641
|
+
new(type, rootElement, coords, connectionPoint, direction, id) {
|
|
3642
|
+
const port = new DiagramPort(this.model, type, rootElement, coords, connectionPoint, direction, id);
|
|
3568
3643
|
super.add(port);
|
|
3569
3644
|
port.updateInView();
|
|
3570
3645
|
// add this port to its root element
|
|
@@ -3673,13 +3748,14 @@ class DagaImporter {
|
|
|
3673
3748
|
}
|
|
3674
3749
|
let portCounter = 0;
|
|
3675
3750
|
for (const port of section.ports || []) {
|
|
3676
|
-
const
|
|
3751
|
+
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
3752
|
+
const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint, port.direction, port.id);
|
|
3677
3753
|
newSection.ports.push(newPort);
|
|
3678
3754
|
model.ports.add(newPort);
|
|
3679
3755
|
if (port.label) {
|
|
3680
3756
|
// add port label
|
|
3681
|
-
if (newNodeType.ports.length > portCounter &&
|
|
3682
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS),
|
|
3757
|
+
if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === undefined ? undefined : newPortType.label)) {
|
|
3758
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === undefined ? undefined : newPortType.label);
|
|
3683
3759
|
let labelCoords;
|
|
3684
3760
|
switch (newPort.direction) {
|
|
3685
3761
|
case Side.Top:
|
|
@@ -3719,13 +3795,14 @@ class DagaImporter {
|
|
|
3719
3795
|
}
|
|
3720
3796
|
let portCounter = 0;
|
|
3721
3797
|
for (const port of node.ports || []) {
|
|
3722
|
-
const
|
|
3798
|
+
const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
|
|
3799
|
+
const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint, port.direction, port.id);
|
|
3723
3800
|
newNode.ports.push(newPort);
|
|
3724
3801
|
model.ports.add(newPort);
|
|
3725
3802
|
if (port.label) {
|
|
3726
3803
|
// add port label
|
|
3727
|
-
if (newNodeType.ports.length > portCounter &&
|
|
3728
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS),
|
|
3804
|
+
if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === undefined ? undefined : newPortType.label)) {
|
|
3805
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === undefined ? undefined : newPortType.label);
|
|
3729
3806
|
let labelCoords;
|
|
3730
3807
|
switch (newPort.direction) {
|
|
3731
3808
|
case Side.Top:
|
|
@@ -3767,6 +3844,8 @@ class DagaImporter {
|
|
|
3767
3844
|
newNode.valueSet.setTimestamps(node.collabMeta.dataTimestamps);
|
|
3768
3845
|
}
|
|
3769
3846
|
newNode.updateInView();
|
|
3847
|
+
// raise node to sort the render order of the node and its components
|
|
3848
|
+
newNode.raise();
|
|
3770
3849
|
return newNode;
|
|
3771
3850
|
}
|
|
3772
3851
|
return undefined;
|
|
@@ -3789,6 +3868,8 @@ class DagaImporter {
|
|
|
3789
3868
|
newConnection.valueSet.setTimestamps(connection.collabMeta.dataTimestamps);
|
|
3790
3869
|
}
|
|
3791
3870
|
newConnection.updateInView();
|
|
3871
|
+
// raise connection just in case it is necessary to sort the render order
|
|
3872
|
+
newConnection.raise();
|
|
3792
3873
|
return newConnection;
|
|
3793
3874
|
}
|
|
3794
3875
|
return undefined;
|
|
@@ -5310,7 +5391,7 @@ class DiagramContextMenu {
|
|
|
5310
5391
|
const coordsRelativeToRoot = this.canvas.getPointerLocationRelativeToRoot(event);
|
|
5311
5392
|
const coordsRelativeToCanvas = this.canvas.getPointerLocationRelativeToCanvas(event);
|
|
5312
5393
|
// append to the root (svg) element so the context menu is not affected by zoom transforms on the canvas view
|
|
5313
|
-
const contextMenuContainer = this.canvas.
|
|
5394
|
+
const contextMenuContainer = this.canvas.selectSVGElement().append('foreignObject').attr('class', 'daga-context-menu').attr('x', `${coordsRelativeToRoot[0] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('y', `${coordsRelativeToRoot[1] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('width', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).attr('height', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).style('pointer-events', 'none').on(Events.ContextMenu, newEvent => {
|
|
5314
5395
|
if (this.canvas.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
5315
5396
|
event.preventDefault();
|
|
5316
5397
|
this.open(newEvent);
|
|
@@ -5531,7 +5612,7 @@ class DagaExporter {
|
|
|
5531
5612
|
return result;
|
|
5532
5613
|
}
|
|
5533
5614
|
exportNode(node, includeCollabMeta = false) {
|
|
5534
|
-
var _a, _b, _c, _d;
|
|
5615
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5535
5616
|
const children = [];
|
|
5536
5617
|
for (const child of node.children) {
|
|
5537
5618
|
children.push(this.exportNode(child, includeCollabMeta));
|
|
@@ -5542,9 +5623,11 @@ class DagaExporter {
|
|
|
5542
5623
|
for (const port of section.ports) {
|
|
5543
5624
|
ports.push(Object.assign({
|
|
5544
5625
|
id: port.id,
|
|
5626
|
+
type: (_a = port.type) === null || _a === undefined ? undefined : _a.id,
|
|
5545
5627
|
coords: roundPoint(port.coords),
|
|
5628
|
+
connectionPoint: roundPoint(port.connectionPoint),
|
|
5546
5629
|
direction: port.direction,
|
|
5547
|
-
label: ((
|
|
5630
|
+
label: ((_b = port.label) === null || _b === undefined ? undefined : _b.text) || ''
|
|
5548
5631
|
}, includeCollabMeta ? {
|
|
5549
5632
|
collabMeta: Object.assign({
|
|
5550
5633
|
removed: port.removed,
|
|
@@ -5556,7 +5639,7 @@ class DagaExporter {
|
|
|
5556
5639
|
sections.push(Object.assign({
|
|
5557
5640
|
id: section.id,
|
|
5558
5641
|
ports,
|
|
5559
|
-
label: ((
|
|
5642
|
+
label: ((_c = section.label) === null || _c === undefined ? undefined : _c.text) || '',
|
|
5560
5643
|
indexXInNode: section.indexXInNode,
|
|
5561
5644
|
indexYInNode: section.indexYInNode,
|
|
5562
5645
|
coords: roundPoint(section.coords),
|
|
@@ -5574,9 +5657,11 @@ class DagaExporter {
|
|
|
5574
5657
|
for (const port of node.ports) {
|
|
5575
5658
|
ports.push(Object.assign({
|
|
5576
5659
|
id: port.id,
|
|
5660
|
+
type: (_d = port.type) === null || _d === undefined ? undefined : _d.id,
|
|
5577
5661
|
coords: roundPoint(port.coords),
|
|
5662
|
+
connectionPoint: roundPoint(port.connectionPoint),
|
|
5578
5663
|
direction: port.direction,
|
|
5579
|
-
label: ((
|
|
5664
|
+
label: ((_e = port.label) === null || _e === undefined ? undefined : _e.text) || ''
|
|
5580
5665
|
}, includeCollabMeta ? {
|
|
5581
5666
|
collabMeta: Object.assign({
|
|
5582
5667
|
removed: port.removed,
|
|
@@ -5591,7 +5676,7 @@ class DagaExporter {
|
|
|
5591
5676
|
children,
|
|
5592
5677
|
sections,
|
|
5593
5678
|
ports,
|
|
5594
|
-
label: ((
|
|
5679
|
+
label: ((_f = node.label) === null || _f === undefined ? undefined : _f.text) || '',
|
|
5595
5680
|
coords: roundPoint(node.coords),
|
|
5596
5681
|
width: node.width,
|
|
5597
5682
|
height: node.height,
|
|
@@ -5967,6 +6052,13 @@ class DiagramCanvas {
|
|
|
5967
6052
|
this.model.nodes.types.add(nodeType);
|
|
5968
6053
|
}
|
|
5969
6054
|
}
|
|
6055
|
+
// load port types
|
|
6056
|
+
if (config.portTypes) {
|
|
6057
|
+
for (const portTypeConfig of config.portTypes) {
|
|
6058
|
+
const portType = new DiagramPortType(Object.assign(Object.assign({}, config.portTypeDefaults), portTypeConfig));
|
|
6059
|
+
this.model.ports.types.add(portType);
|
|
6060
|
+
}
|
|
6061
|
+
}
|
|
5970
6062
|
// load connection types
|
|
5971
6063
|
if (config.connectionTypes) {
|
|
5972
6064
|
for (const connectionTypeConfig of config.connectionTypes) {
|
|
@@ -6132,7 +6224,7 @@ class DiagramCanvas {
|
|
|
6132
6224
|
this.translateBy(0, this.panRate / this.zoomTransform.k);
|
|
6133
6225
|
}
|
|
6134
6226
|
});
|
|
6135
|
-
const canvasView = this.
|
|
6227
|
+
const canvasView = this.selectSVGElement().append('g').attr('class', 'daga-canvas-view').attr('width', `100%`).attr('height', `100%`);
|
|
6136
6228
|
const canvasBackground = canvasView.append('rect').attr('x', 0).attr('y', 0).attr('width', `100%`).attr('height', `100%`).attr('fill', this.backgroundColor).attr('stroke-width', '0').on(Events.MouseMove, event => {
|
|
6137
6229
|
if (this.unfinishedConnection !== undefined) {
|
|
6138
6230
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
@@ -6219,9 +6311,10 @@ class DiagramCanvas {
|
|
|
6219
6311
|
}
|
|
6220
6312
|
}
|
|
6221
6313
|
center() {
|
|
6314
|
+
var _a;
|
|
6222
6315
|
// if there are no nodes, we have nothing to do here
|
|
6223
6316
|
if (this.model.nodes.length > 0) {
|
|
6224
|
-
const canvasViewBoundingBox = this.selectCanvasView().select('rect').node().getBBox();
|
|
6317
|
+
const canvasViewBoundingBox = (_a = this.selectCanvasView().select('rect').node()) === null || _a === undefined ? undefined : _a.getBBox();
|
|
6225
6318
|
const nonRemovedNodes = this.model.nodes.all();
|
|
6226
6319
|
const minimumX = Math.min(...nonRemovedNodes.map(n => n.coords[0]));
|
|
6227
6320
|
const maximumX = Math.max(...nonRemovedNodes.map(n => n.coords[0] + n.width));
|
|
@@ -6253,7 +6346,7 @@ class DiagramCanvas {
|
|
|
6253
6346
|
}
|
|
6254
6347
|
getCoordinatesOnScreen() {
|
|
6255
6348
|
var _a;
|
|
6256
|
-
const rootBoundingClientRect = (_a = this.
|
|
6349
|
+
const rootBoundingClientRect = (_a = this.selectSVGElement().node()) === null || _a === undefined ? undefined : _a.getBoundingClientRect();
|
|
6257
6350
|
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.height) || 0];
|
|
6258
6351
|
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]];
|
|
6259
6352
|
}
|
|
@@ -6277,7 +6370,7 @@ class DiagramCanvas {
|
|
|
6277
6370
|
return d3.pointer(this.getEventHoldingCoordinates(event), this.selectCanvasElements().node());
|
|
6278
6371
|
}
|
|
6279
6372
|
getPointerLocationRelativeToRoot(event) {
|
|
6280
|
-
return d3.pointer(this.getEventHoldingCoordinates(event), this.
|
|
6373
|
+
return d3.pointer(this.getEventHoldingCoordinates(event), this.selectSVGElement().node());
|
|
6281
6374
|
}
|
|
6282
6375
|
getPointerLocationRelativeToBody(event) {
|
|
6283
6376
|
return d3.pointer(this.getEventHoldingCoordinates(event), d3.select('body').node());
|
|
@@ -6925,21 +7018,32 @@ class DiagramCanvas {
|
|
|
6925
7018
|
updatePortsInView(...ids) {
|
|
6926
7019
|
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);
|
|
6927
7020
|
const exitSelection = updateSelection.exit();
|
|
6928
|
-
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class',
|
|
7021
|
+
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
|
|
7022
|
+
var _a, _b;
|
|
7023
|
+
return `diagram-port ${((_b = (_a = d.type) === null || _a === undefined ? undefined : _a.look) === null || _b === undefined ? undefined : _b.lookType) || 'default'}`;
|
|
7024
|
+
});
|
|
6929
7025
|
if (ids && ids.length > 0) {
|
|
6930
7026
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
6931
7027
|
}
|
|
6932
7028
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
6933
7029
|
exitSelection.remove();
|
|
6934
7030
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
6935
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
7031
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6936
7032
|
if (!this.unfinishedConnection && !this.dragging) {
|
|
6937
7033
|
// if there is an unfinished connection, the port will be highlighted automatically if the pointer is close
|
|
6938
7034
|
this.userHighlight.focusOn(d);
|
|
6939
7035
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
6940
7036
|
}
|
|
6941
7037
|
if (this.unfinishedConnection) {
|
|
6942
|
-
const canConnectionFinishAtThisPort =
|
|
7038
|
+
const canConnectionFinishAtThisPort =
|
|
7039
|
+
// can start at the starting port
|
|
7040
|
+
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) || '') && ((_d = this.unfinishedConnection.start) === null || _d === undefined ? undefined : _d.allowsOutgoing) &&
|
|
7041
|
+
// can end at the ending port
|
|
7042
|
+
this.unfinishedConnection.type.canFinishOnType(((_f = (_e = d.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '') && d.allowsIncoming ||
|
|
7043
|
+
// can start at the ending port
|
|
7044
|
+
this.unfinishedConnection.type.canStartFromType(((_h = (_g = d.getNode()) === null || _g === undefined ? undefined : _g.type) === null || _h === undefined ? undefined : _h.id) || '') && d.allowsOutgoing &&
|
|
7045
|
+
// can end at the starting port
|
|
7046
|
+
this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = this.unfinishedConnection.start) === null || _j === undefined ? undefined : _j.getNode()) === null || _k === undefined ? undefined : _k.type) === null || _l === undefined ? undefined : _l.id) || '') && ((_m = this.unfinishedConnection.start) === null || _m === undefined ? undefined : _m.allowsIncoming);
|
|
6943
7047
|
if (!canConnectionFinishAtThisPort) {
|
|
6944
7048
|
setCursorStyle(CursorStyle.NoDrop);
|
|
6945
7049
|
}
|
|
@@ -7076,8 +7180,14 @@ class DiagramCanvas {
|
|
|
7076
7180
|
}
|
|
7077
7181
|
this.secondaryButton = false;
|
|
7078
7182
|
}));
|
|
7079
|
-
enterSelection.append('circle');
|
|
7080
|
-
|
|
7183
|
+
enterSelection.filter('.default').append('circle');
|
|
7184
|
+
enterSelection.filter('.image-look').append('image');
|
|
7185
|
+
mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
|
|
7186
|
+
mergeSelection.filter('.default').select('circle').attr('cx', 0).attr('cy', 0).attr('r', DIAGRAM_PORT_TYPE_DEFAULTS.width / 2).attr('fill', d => d.selected ? DIAGRAM_PORT_DEFAULTS.selectedColor : DIAGRAM_PORT_DEFAULTS.highlightedColor).attr('opacity', d => d.highlighted || d.selected ? 0.5 : 0);
|
|
7187
|
+
mergeSelection.filter('.image-look').select('image').attr('x', d => -d.type.width / 2).attr('y', d => -d.type.width / 2).attr('width', d => d.type.width).attr('height', d => d.type.width).attr('href', d => {
|
|
7188
|
+
var _a, _b;
|
|
7189
|
+
return d.selected ? ((_a = d.type) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImage : ((_b = d.type) === null || _b === undefined ? undefined : _b.look).backgroundImage;
|
|
7190
|
+
});
|
|
7081
7191
|
}
|
|
7082
7192
|
updateConnectionsInView(...ids) {
|
|
7083
7193
|
const connectionList = this.model.connections.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true);
|
|
@@ -7494,50 +7604,55 @@ class DiagramCanvas {
|
|
|
7494
7604
|
}
|
|
7495
7605
|
}
|
|
7496
7606
|
selectRoot() {
|
|
7607
|
+
return d3.select(this.diagramRoot);
|
|
7608
|
+
}
|
|
7609
|
+
selectSVGElement() {
|
|
7497
7610
|
return d3.select(this.diagramRoot).select('svg');
|
|
7498
7611
|
}
|
|
7499
7612
|
selectCanvasView() {
|
|
7500
|
-
return this.
|
|
7613
|
+
return this.selectSVGElement().select(`.daga-canvas-view`);
|
|
7501
7614
|
}
|
|
7502
7615
|
selectCanvasElements() {
|
|
7503
|
-
return this.
|
|
7616
|
+
return this.selectSVGElement().select(`.daga-canvas-elements`);
|
|
7504
7617
|
}
|
|
7505
7618
|
// User actions
|
|
7506
7619
|
startConnection(port) {
|
|
7507
7620
|
var _a, _b, _c, _d;
|
|
7508
|
-
if (
|
|
7509
|
-
this.
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
return t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
|
|
7515
|
-
});
|
|
7516
|
-
if (differentConnectionType === undefined) {
|
|
7517
|
-
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
7621
|
+
if (port.allowsOutgoing || port.allowsIncoming) {
|
|
7622
|
+
if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '') && port.allowsOutgoing || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && port.allowsIncoming)) {
|
|
7623
|
+
this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
7624
|
+
} else {
|
|
7625
|
+
if (this.inferConnectionType) {
|
|
7626
|
+
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
7518
7627
|
var _a, _b;
|
|
7519
|
-
return t.
|
|
7628
|
+
return port.allowsOutgoing && t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
|
|
7520
7629
|
});
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7630
|
+
if (differentConnectionType === undefined) {
|
|
7631
|
+
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
7632
|
+
var _a, _b;
|
|
7633
|
+
return port.allowsIncoming && t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
|
|
7634
|
+
});
|
|
7635
|
+
}
|
|
7636
|
+
if (differentConnectionType !== undefined) {
|
|
7637
|
+
this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
7638
|
+
}
|
|
7524
7639
|
}
|
|
7525
7640
|
}
|
|
7526
7641
|
}
|
|
7527
7642
|
}
|
|
7528
7643
|
finishConnection(port) {
|
|
7529
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
7644
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
7530
7645
|
this.userHighlight.clear();
|
|
7531
7646
|
if (this.unfinishedConnection !== undefined) {
|
|
7532
7647
|
if (this.unfinishedConnection.start !== port) {
|
|
7533
|
-
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(((
|
|
7534
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (
|
|
7648
|
+
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) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === undefined ? undefined : _e.start) === null || _f === undefined ? undefined : _f.allowsOutgoing) && this.unfinishedConnection.type.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === undefined ? undefined : _g.type) === null || _h === undefined ? undefined : _h.id) || '') && port.allowsIncoming) {
|
|
7649
|
+
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_j = this.unfinishedConnection.start) === null || _j === undefined ? undefined : _j.id, port.id);
|
|
7535
7650
|
// clean up the previous unfinished connection
|
|
7536
7651
|
this.dropConnection();
|
|
7537
7652
|
addConnectionAction.do();
|
|
7538
7653
|
this.actionStack.add(addConnectionAction);
|
|
7539
|
-
} else if (this.unfinishedConnection.type.canFinishOnType(((
|
|
7540
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (
|
|
7654
|
+
} else if (this.unfinishedConnection.type.canFinishOnType(((_o = (_m = (_l = (_k = this.unfinishedConnection) === null || _k === undefined ? undefined : _k.start) === null || _l === undefined ? undefined : _l.getNode()) === null || _m === undefined ? undefined : _m.type) === null || _o === undefined ? undefined : _o.id) || '') && ((_q = (_p = this.unfinishedConnection) === null || _p === undefined ? undefined : _p.start) === null || _q === undefined ? undefined : _q.allowsIncoming) && this.unfinishedConnection.type.canStartFromType(((_s = (_r = port.getNode()) === null || _r === undefined ? undefined : _r.type) === null || _s === undefined ? undefined : _s.id) || '') && port.allowsOutgoing) {
|
|
7655
|
+
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_t = this.unfinishedConnection.start) === null || _t === undefined ? undefined : _t.id);
|
|
7541
7656
|
// clean up the previous unfinished connection
|
|
7542
7657
|
this.dropConnection();
|
|
7543
7658
|
addConnectionAction.do();
|
|
@@ -7545,19 +7660,19 @@ class DiagramCanvas {
|
|
|
7545
7660
|
} else {
|
|
7546
7661
|
if (this.inferConnectionType) {
|
|
7547
7662
|
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
7548
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7549
|
-
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(((
|
|
7663
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7664
|
+
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) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === undefined ? undefined : _e.start) === null || _f === undefined ? undefined : _f.allowsOutgoing) && t.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === undefined ? undefined : _g.type) === null || _h === undefined ? undefined : _h.id) || '') && port.allowsIncoming;
|
|
7550
7665
|
});
|
|
7551
7666
|
let invertConnection = false;
|
|
7552
7667
|
if (differentConnectionType === undefined) {
|
|
7553
7668
|
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
7554
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7555
|
-
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(((
|
|
7669
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7670
|
+
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) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === undefined ? undefined : _e.start) === null || _f === undefined ? undefined : _f.allowsIncoming) && t.canStartFromType(((_h = (_g = port.getNode()) === null || _g === undefined ? undefined : _g.type) === null || _h === undefined ? undefined : _h.id) || '') && port.allowsOutgoing;
|
|
7556
7671
|
});
|
|
7557
7672
|
invertConnection = true;
|
|
7558
7673
|
}
|
|
7559
7674
|
if (differentConnectionType !== undefined) {
|
|
7560
|
-
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (
|
|
7675
|
+
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_u = this.unfinishedConnection.start) === null || _u === undefined ? undefined : _u.id, invertConnection ? (_v = this.unfinishedConnection.start) === null || _v === undefined ? undefined : _v.id : port.id);
|
|
7561
7676
|
// clean up the previous unfinished connection
|
|
7562
7677
|
this.dropConnection();
|
|
7563
7678
|
addConnectionAction.do();
|
|
@@ -8706,4 +8821,4 @@ const getLocationsOfNodes = model => {
|
|
|
8706
8821
|
return locations;
|
|
8707
8822
|
};
|
|
8708
8823
|
|
|
8709
|
-
export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramUserHighlight, DiagramUserSelection, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
|
|
8824
|
+
export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramHighlightedEvent, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramPortType, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramSelectionEvent, DiagramUserHighlight, DiagramUserSelection, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
|