@metadev/daga 4.2.10 → 5.0.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 +9 -2
- package/index.cjs.js +43 -20
- package/index.esm.js +43 -21
- package/package.json +2 -2
- package/src/index.d.ts +1 -1
- package/src/lib/diagram/diagram-event.d.ts +18 -4
package/Changelog.md
CHANGED
|
@@ -4,7 +4,14 @@ List of releases and changes.
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
## Next release
|
|
7
|
+
## Next release Durendal
|
|
8
|
+
|
|
9
|
+
## 5.0.0 Joyeuse
|
|
10
|
+
|
|
11
|
+
- Support for Angular 21 [#346](https://github.com/metadevpro/daga/pull/346)
|
|
12
|
+
- Ensure that an array remains an array after cloning [#349](https://github.com/metadevpro/daga/pull/349)
|
|
13
|
+
- When checking if a port is being shared, ignore connections that have been removed [#350](https://github.com/metadevpro/daga/pull/350)
|
|
14
|
+
- Create `DiagramZoomEvent` to enable listening to user zooming and panning events [#351](https://github.com/metadevpro/daga/pull/351)
|
|
8
15
|
|
|
9
16
|
## v. 4.2.10
|
|
10
17
|
|
|
@@ -161,7 +168,7 @@ Date: _2025-01-21_
|
|
|
161
168
|
- Add node continence [#200](https://github.com/metadevpro/daga/pull/200)
|
|
162
169
|
- Enable defining custom shape functions for nodes in the configuration [#206](https://github.com/metadevpro/daga/pull/206)
|
|
163
170
|
- Fix order of diagram elements [#208](https://github.com/metadevpro/daga/pull/208)
|
|
164
|
-
- Simplify usage of `<daga-diagram>` tag in
|
|
171
|
+
- Simplify usage of `<daga-diagram>` tag in Angular by removing the need to include a `<daga-diagram-editor>` inside [#210](https://github.com/metadevpro/daga/pull/210)
|
|
165
172
|
- Distinguish between diagram actions (which affect the model) and diagram events (which don't affect the model) [#210](https://github.com/metadevpro/daga/pull/210)
|
|
166
173
|
- Add layout action so layouts applied by the user can be undone and redone (which don't affect the model) [#210](https://github.com/metadevpro/daga/pull/210)
|
|
167
174
|
- Add diagram events for the selection and highlight of diagram elements [#212](https://github.com/metadevpro/daga/pull/212) [#214](https://github.com/metadevpro/daga/pull/214)
|
package/index.cjs.js
CHANGED
|
@@ -1194,13 +1194,17 @@ const clone = o => {
|
|
|
1194
1194
|
if (typeof o !== 'object') {
|
|
1195
1195
|
return o;
|
|
1196
1196
|
}
|
|
1197
|
+
if (Array.isArray(o)) {
|
|
1198
|
+
return o.map(clone);
|
|
1199
|
+
}
|
|
1197
1200
|
const res = {};
|
|
1198
1201
|
for (const e of Object.entries(o)) {
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1202
|
+
res[e[0]] = clone(e[1]);
|
|
1203
|
+
// if (typeof e[1] === 'object') {
|
|
1204
|
+
// res[e[0]] = clone(e[1]);
|
|
1205
|
+
// } else {
|
|
1206
|
+
// res[e[0]] = e[1];
|
|
1207
|
+
// }
|
|
1204
1208
|
}
|
|
1205
1209
|
return res;
|
|
1206
1210
|
};
|
|
@@ -2529,18 +2533,18 @@ class DiagramConnection extends DiagramElement {
|
|
|
2529
2533
|
// alternative start port not valid, it doesn't allow outgoing connections
|
|
2530
2534
|
continue checkAlternativeStartPorts;
|
|
2531
2535
|
}
|
|
2532
|
-
if (!allowSharingPorts && (alternativeStartPort.incomingConnections.
|
|
2536
|
+
if (!allowSharingPorts && (alternativeStartPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeStartPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2533
2537
|
// alternative start port not valid, it already has other connections
|
|
2534
2538
|
continue checkAlternativeStartPorts;
|
|
2535
2539
|
}
|
|
2536
2540
|
if (!allowSharingBothPorts) {
|
|
2537
|
-
for (const connection of alternativeStartPort.outgoingConnections) {
|
|
2541
|
+
for (const connection of alternativeStartPort.outgoingConnections.filter(c => !c.removed)) {
|
|
2538
2542
|
if (connection !== this && connection.end === this.end) {
|
|
2539
2543
|
// alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
|
|
2540
2544
|
continue checkAlternativeStartPorts;
|
|
2541
2545
|
}
|
|
2542
2546
|
}
|
|
2543
|
-
for (const connection of alternativeStartPort.incomingConnections) {
|
|
2547
|
+
for (const connection of alternativeStartPort.incomingConnections.filter(c => !c.removed)) {
|
|
2544
2548
|
if (connection !== this && connection.start === this.end) {
|
|
2545
2549
|
// alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
|
|
2546
2550
|
continue checkAlternativeStartPorts;
|
|
@@ -2567,18 +2571,18 @@ class DiagramConnection extends DiagramElement {
|
|
|
2567
2571
|
// alternative end port not valid, it doesn't allow incoming connections
|
|
2568
2572
|
continue checkAlternativeEndPorts;
|
|
2569
2573
|
}
|
|
2570
|
-
if (!allowSharingPorts && (alternativeEndPort.
|
|
2574
|
+
if (!allowSharingPorts && (alternativeEndPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeEndPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2571
2575
|
// alternative end port not valid, it already has other connections
|
|
2572
2576
|
continue checkAlternativeEndPorts;
|
|
2573
2577
|
}
|
|
2574
2578
|
if (!allowSharingBothPorts) {
|
|
2575
|
-
for (const connection of alternativeEndPort.incomingConnections) {
|
|
2579
|
+
for (const connection of alternativeEndPort.incomingConnections.filter(c => !c.removed)) {
|
|
2576
2580
|
if (connection !== this && connection.start === this.start) {
|
|
2577
2581
|
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
2578
2582
|
continue checkAlternativeEndPorts;
|
|
2579
2583
|
}
|
|
2580
2584
|
}
|
|
2581
|
-
for (const connection of alternativeEndPort.outgoingConnections) {
|
|
2585
|
+
for (const connection of alternativeEndPort.outgoingConnections.filter(c => !c.removed)) {
|
|
2582
2586
|
if (connection !== this && connection.end === this.start) {
|
|
2583
2587
|
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
2584
2588
|
continue checkAlternativeEndPorts;
|
|
@@ -6301,11 +6305,27 @@ class DiagramEvent {
|
|
|
6301
6305
|
*/
|
|
6302
6306
|
exports.DiagramEvents = void 0;
|
|
6303
6307
|
(function (DiagramEvents) {
|
|
6304
|
-
DiagramEvents[DiagramEvents["
|
|
6305
|
-
DiagramEvents[DiagramEvents["
|
|
6306
|
-
DiagramEvents[DiagramEvents["
|
|
6307
|
-
DiagramEvents[DiagramEvents["
|
|
6308
|
+
DiagramEvents[DiagramEvents["Zoom"] = 0] = "Zoom";
|
|
6309
|
+
DiagramEvents[DiagramEvents["DoubleClick"] = 1] = "DoubleClick";
|
|
6310
|
+
DiagramEvents[DiagramEvents["SecondaryClick"] = 2] = "SecondaryClick";
|
|
6311
|
+
DiagramEvents[DiagramEvents["Selection"] = 3] = "Selection";
|
|
6312
|
+
DiagramEvents[DiagramEvents["Highlight"] = 4] = "Highlight";
|
|
6308
6313
|
})(exports.DiagramEvents || (exports.DiagramEvents = {}));
|
|
6314
|
+
/**
|
|
6315
|
+
* Diagram event which consists of the user zooming or panning.
|
|
6316
|
+
*/
|
|
6317
|
+
class DiagramZoomEvent extends DiagramEvent {
|
|
6318
|
+
/**
|
|
6319
|
+
* Create a diagram zoom event.
|
|
6320
|
+
*
|
|
6321
|
+
* @param coords .
|
|
6322
|
+
*/
|
|
6323
|
+
constructor(coords, zoom) {
|
|
6324
|
+
super(exports.DiagramEvents.Zoom);
|
|
6325
|
+
this.coords = coords;
|
|
6326
|
+
this.zoom = zoom;
|
|
6327
|
+
}
|
|
6328
|
+
}
|
|
6309
6329
|
/**
|
|
6310
6330
|
* Diagram event which consists of the user performing a double click on the diagram.
|
|
6311
6331
|
*/
|
|
@@ -7147,7 +7167,7 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7147
7167
|
this.canvas.propertyEditorChanges$.pipe(rxjs.debounceTime(2000)).subscribe(() => {
|
|
7148
7168
|
this.makeUpdateValuesAction();
|
|
7149
7169
|
});
|
|
7150
|
-
console.log(diagramPropertiesText);
|
|
7170
|
+
//console.log(diagramPropertiesText);
|
|
7151
7171
|
this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
|
|
7152
7172
|
}
|
|
7153
7173
|
add(element) {
|
|
@@ -7697,6 +7717,7 @@ class DiagramCanvas {
|
|
|
7697
7717
|
this.selectCanvasElements().attr('transform', transformAttribute);
|
|
7698
7718
|
d3__namespace.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
|
|
7699
7719
|
this.contextMenu.close();
|
|
7720
|
+
this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
|
|
7700
7721
|
}).on(exports.ZoomEvents.End, () => {
|
|
7701
7722
|
setCursorStyle();
|
|
7702
7723
|
}));
|
|
@@ -8357,7 +8378,7 @@ class DiagramCanvas {
|
|
|
8357
8378
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
8358
8379
|
this.startMultipleSelection(event);
|
|
8359
8380
|
} else {
|
|
8360
|
-
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.length === 0 && d.outgoingConnections.length === 0) && !d.removed) {
|
|
8381
|
+
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.filter(c => !c.removed).length === 0 && d.outgoingConnections.filter(c => !c.removed).length === 0) && !d.removed) {
|
|
8361
8382
|
setCursorStyle(exports.CursorStyle.Grabbing);
|
|
8362
8383
|
this.startConnection(d);
|
|
8363
8384
|
// should be true after having called this.startConnection()
|
|
@@ -8583,7 +8604,8 @@ class DiagramCanvas {
|
|
|
8583
8604
|
this.diagramEvent$.next(diagramEvent);
|
|
8584
8605
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.EditField) && d.editable && !d.removed) {
|
|
8585
8606
|
this.currentAction = new EditFieldAction(this, d.id, d.text, '');
|
|
8586
|
-
this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, d.orientation,
|
|
8607
|
+
this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, d.orientation, () => {
|
|
8608
|
+
// (_text)
|
|
8587
8609
|
/*
|
|
8588
8610
|
Empty for now
|
|
8589
8611
|
We should create a better function to stretch the root element as the text expands
|
|
@@ -9107,13 +9129,13 @@ class DiagramCanvas {
|
|
|
9107
9129
|
this.dropConnection();
|
|
9108
9130
|
return;
|
|
9109
9131
|
}
|
|
9110
|
-
if (!this.allowSharingPorts && (port.incomingConnections.length > 0 || port.outgoingConnections.length > 0)) {
|
|
9132
|
+
if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
|
|
9111
9133
|
this.dropConnection();
|
|
9112
9134
|
return;
|
|
9113
9135
|
}
|
|
9114
9136
|
if (!this.allowSharingBothPorts && this.model.connections.find(c => {
|
|
9115
9137
|
var _a, _b;
|
|
9116
|
-
return c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port;
|
|
9138
|
+
return !c.removed && (c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port);
|
|
9117
9139
|
}) !== undefined) {
|
|
9118
9140
|
this.dropConnection();
|
|
9119
9141
|
return;
|
|
@@ -10325,6 +10347,7 @@ exports.DiagramSectionSet = DiagramSectionSet;
|
|
|
10325
10347
|
exports.DiagramSelectionEvent = DiagramSelectionEvent;
|
|
10326
10348
|
exports.DiagramUserHighlight = DiagramUserHighlight;
|
|
10327
10349
|
exports.DiagramUserSelection = DiagramUserSelection;
|
|
10350
|
+
exports.DiagramZoomEvent = DiagramZoomEvent;
|
|
10328
10351
|
exports.EditFieldAction = EditFieldAction;
|
|
10329
10352
|
exports.ForceLayout = ForceLayout;
|
|
10330
10353
|
exports.HorizontalLayout = HorizontalLayout;
|
package/index.esm.js
CHANGED
|
@@ -1173,13 +1173,17 @@ const clone = o => {
|
|
|
1173
1173
|
if (typeof o !== 'object') {
|
|
1174
1174
|
return o;
|
|
1175
1175
|
}
|
|
1176
|
+
if (Array.isArray(o)) {
|
|
1177
|
+
return o.map(clone);
|
|
1178
|
+
}
|
|
1176
1179
|
const res = {};
|
|
1177
1180
|
for (const e of Object.entries(o)) {
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1181
|
+
res[e[0]] = clone(e[1]);
|
|
1182
|
+
// if (typeof e[1] === 'object') {
|
|
1183
|
+
// res[e[0]] = clone(e[1]);
|
|
1184
|
+
// } else {
|
|
1185
|
+
// res[e[0]] = e[1];
|
|
1186
|
+
// }
|
|
1183
1187
|
}
|
|
1184
1188
|
return res;
|
|
1185
1189
|
};
|
|
@@ -2508,18 +2512,18 @@ class DiagramConnection extends DiagramElement {
|
|
|
2508
2512
|
// alternative start port not valid, it doesn't allow outgoing connections
|
|
2509
2513
|
continue checkAlternativeStartPorts;
|
|
2510
2514
|
}
|
|
2511
|
-
if (!allowSharingPorts && (alternativeStartPort.incomingConnections.
|
|
2515
|
+
if (!allowSharingPorts && (alternativeStartPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeStartPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2512
2516
|
// alternative start port not valid, it already has other connections
|
|
2513
2517
|
continue checkAlternativeStartPorts;
|
|
2514
2518
|
}
|
|
2515
2519
|
if (!allowSharingBothPorts) {
|
|
2516
|
-
for (const connection of alternativeStartPort.outgoingConnections) {
|
|
2520
|
+
for (const connection of alternativeStartPort.outgoingConnections.filter(c => !c.removed)) {
|
|
2517
2521
|
if (connection !== this && connection.end === this.end) {
|
|
2518
2522
|
// alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
|
|
2519
2523
|
continue checkAlternativeStartPorts;
|
|
2520
2524
|
}
|
|
2521
2525
|
}
|
|
2522
|
-
for (const connection of alternativeStartPort.incomingConnections) {
|
|
2526
|
+
for (const connection of alternativeStartPort.incomingConnections.filter(c => !c.removed)) {
|
|
2523
2527
|
if (connection !== this && connection.start === this.end) {
|
|
2524
2528
|
// alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
|
|
2525
2529
|
continue checkAlternativeStartPorts;
|
|
@@ -2546,18 +2550,18 @@ class DiagramConnection extends DiagramElement {
|
|
|
2546
2550
|
// alternative end port not valid, it doesn't allow incoming connections
|
|
2547
2551
|
continue checkAlternativeEndPorts;
|
|
2548
2552
|
}
|
|
2549
|
-
if (!allowSharingPorts && (alternativeEndPort.
|
|
2553
|
+
if (!allowSharingPorts && (alternativeEndPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeEndPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2550
2554
|
// alternative end port not valid, it already has other connections
|
|
2551
2555
|
continue checkAlternativeEndPorts;
|
|
2552
2556
|
}
|
|
2553
2557
|
if (!allowSharingBothPorts) {
|
|
2554
|
-
for (const connection of alternativeEndPort.incomingConnections) {
|
|
2558
|
+
for (const connection of alternativeEndPort.incomingConnections.filter(c => !c.removed)) {
|
|
2555
2559
|
if (connection !== this && connection.start === this.start) {
|
|
2556
2560
|
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
2557
2561
|
continue checkAlternativeEndPorts;
|
|
2558
2562
|
}
|
|
2559
2563
|
}
|
|
2560
|
-
for (const connection of alternativeEndPort.outgoingConnections) {
|
|
2564
|
+
for (const connection of alternativeEndPort.outgoingConnections.filter(c => !c.removed)) {
|
|
2561
2565
|
if (connection !== this && connection.end === this.start) {
|
|
2562
2566
|
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
2563
2567
|
continue checkAlternativeEndPorts;
|
|
@@ -6280,11 +6284,27 @@ class DiagramEvent {
|
|
|
6280
6284
|
*/
|
|
6281
6285
|
var DiagramEvents;
|
|
6282
6286
|
(function (DiagramEvents) {
|
|
6283
|
-
DiagramEvents[DiagramEvents["
|
|
6284
|
-
DiagramEvents[DiagramEvents["
|
|
6285
|
-
DiagramEvents[DiagramEvents["
|
|
6286
|
-
DiagramEvents[DiagramEvents["
|
|
6287
|
+
DiagramEvents[DiagramEvents["Zoom"] = 0] = "Zoom";
|
|
6288
|
+
DiagramEvents[DiagramEvents["DoubleClick"] = 1] = "DoubleClick";
|
|
6289
|
+
DiagramEvents[DiagramEvents["SecondaryClick"] = 2] = "SecondaryClick";
|
|
6290
|
+
DiagramEvents[DiagramEvents["Selection"] = 3] = "Selection";
|
|
6291
|
+
DiagramEvents[DiagramEvents["Highlight"] = 4] = "Highlight";
|
|
6287
6292
|
})(DiagramEvents || (DiagramEvents = {}));
|
|
6293
|
+
/**
|
|
6294
|
+
* Diagram event which consists of the user zooming or panning.
|
|
6295
|
+
*/
|
|
6296
|
+
class DiagramZoomEvent extends DiagramEvent {
|
|
6297
|
+
/**
|
|
6298
|
+
* Create a diagram zoom event.
|
|
6299
|
+
*
|
|
6300
|
+
* @param coords .
|
|
6301
|
+
*/
|
|
6302
|
+
constructor(coords, zoom) {
|
|
6303
|
+
super(DiagramEvents.Zoom);
|
|
6304
|
+
this.coords = coords;
|
|
6305
|
+
this.zoom = zoom;
|
|
6306
|
+
}
|
|
6307
|
+
}
|
|
6288
6308
|
/**
|
|
6289
6309
|
* Diagram event which consists of the user performing a double click on the diagram.
|
|
6290
6310
|
*/
|
|
@@ -7126,7 +7146,7 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7126
7146
|
this.canvas.propertyEditorChanges$.pipe(debounceTime(2000)).subscribe(() => {
|
|
7127
7147
|
this.makeUpdateValuesAction();
|
|
7128
7148
|
});
|
|
7129
|
-
console.log(diagramPropertiesText);
|
|
7149
|
+
//console.log(diagramPropertiesText);
|
|
7130
7150
|
this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
|
|
7131
7151
|
}
|
|
7132
7152
|
add(element) {
|
|
@@ -7676,6 +7696,7 @@ class DiagramCanvas {
|
|
|
7676
7696
|
this.selectCanvasElements().attr('transform', transformAttribute);
|
|
7677
7697
|
d3.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
|
|
7678
7698
|
this.contextMenu.close();
|
|
7699
|
+
this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
|
|
7679
7700
|
}).on(ZoomEvents.End, () => {
|
|
7680
7701
|
setCursorStyle();
|
|
7681
7702
|
}));
|
|
@@ -8336,7 +8357,7 @@ class DiagramCanvas {
|
|
|
8336
8357
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
8337
8358
|
this.startMultipleSelection(event);
|
|
8338
8359
|
} else {
|
|
8339
|
-
if (this.canUserPerformAction(DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.length === 0 && d.outgoingConnections.length === 0) && !d.removed) {
|
|
8360
|
+
if (this.canUserPerformAction(DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.filter(c => !c.removed).length === 0 && d.outgoingConnections.filter(c => !c.removed).length === 0) && !d.removed) {
|
|
8340
8361
|
setCursorStyle(CursorStyle.Grabbing);
|
|
8341
8362
|
this.startConnection(d);
|
|
8342
8363
|
// should be true after having called this.startConnection()
|
|
@@ -8562,7 +8583,8 @@ class DiagramCanvas {
|
|
|
8562
8583
|
this.diagramEvent$.next(diagramEvent);
|
|
8563
8584
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.EditField) && d.editable && !d.removed) {
|
|
8564
8585
|
this.currentAction = new EditFieldAction(this, d.id, d.text, '');
|
|
8565
|
-
this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, d.orientation,
|
|
8586
|
+
this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, d.orientation, () => {
|
|
8587
|
+
// (_text)
|
|
8566
8588
|
/*
|
|
8567
8589
|
Empty for now
|
|
8568
8590
|
We should create a better function to stretch the root element as the text expands
|
|
@@ -9086,13 +9108,13 @@ class DiagramCanvas {
|
|
|
9086
9108
|
this.dropConnection();
|
|
9087
9109
|
return;
|
|
9088
9110
|
}
|
|
9089
|
-
if (!this.allowSharingPorts && (port.incomingConnections.length > 0 || port.outgoingConnections.length > 0)) {
|
|
9111
|
+
if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
|
|
9090
9112
|
this.dropConnection();
|
|
9091
9113
|
return;
|
|
9092
9114
|
}
|
|
9093
9115
|
if (!this.allowSharingBothPorts && this.model.connections.find(c => {
|
|
9094
9116
|
var _a, _b;
|
|
9095
|
-
return c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port;
|
|
9117
|
+
return !c.removed && (c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port);
|
|
9096
9118
|
}) !== undefined) {
|
|
9097
9119
|
this.dropConnection();
|
|
9098
9120
|
return;
|
|
@@ -10262,4 +10284,4 @@ const getLocationsOfNodes = model => {
|
|
|
10262
10284
|
return locations;
|
|
10263
10285
|
};
|
|
10264
10286
|
|
|
10265
|
-
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 };
|
|
10287
|
+
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, DiagramZoomEvent, 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 };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metadev/daga",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"dependencies": {},
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"d3": "^7.9.0",
|
|
7
7
|
"rxjs": "~7.8.1",
|
|
8
|
-
"uuid": "^
|
|
8
|
+
"uuid": "^13.0.0"
|
|
9
9
|
},
|
|
10
10
|
"main": "./index.cjs.js",
|
|
11
11
|
"typings": "./src/index.d.ts",
|
package/src/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type { DiagramModelExporter } from './lib/diagram/converters/diagram-mode
|
|
|
18
18
|
export type { DiagramModelImporter } from './lib/diagram/converters/diagram-model-importer';
|
|
19
19
|
export { ActionStack, AddConnectionAction, AddNodeAction, ApplyLayoutAction, DiagramActionMethod, DiagramActions, EditFieldAction, MoveAction, PasteAction, RemoveAction, SetGeometryAction, SetParentAction, UpdateValuesAction } from './lib/diagram/diagram-action';
|
|
20
20
|
export type { DiagramAction } from './lib/diagram/diagram-action';
|
|
21
|
-
export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramHighlightedEvent, DiagramSecondaryClickEvent, DiagramSelectionEvent } from './lib/diagram/diagram-event';
|
|
21
|
+
export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramHighlightedEvent, DiagramSecondaryClickEvent, DiagramSelectionEvent, DiagramZoomEvent } from './lib/diagram/diagram-event';
|
|
22
22
|
export { AdjacencyLayout } from './lib/diagram/layout/adjacency-layout';
|
|
23
23
|
export { BreadthAdjacencyLayout } from './lib/diagram/layout/breadth-adjacency-layout';
|
|
24
24
|
export { BreadthLayout } from './lib/diagram/layout/breadth-layout';
|
|
@@ -16,10 +16,24 @@ export declare abstract class DiagramEvent {
|
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
18
|
export declare enum DiagramEvents {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
Zoom = 0,
|
|
20
|
+
DoubleClick = 1,
|
|
21
|
+
SecondaryClick = 2,
|
|
22
|
+
Selection = 3,
|
|
23
|
+
Highlight = 4
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Diagram event which consists of the user zooming or panning.
|
|
27
|
+
*/
|
|
28
|
+
export declare class DiagramZoomEvent extends DiagramEvent {
|
|
29
|
+
coords: Point;
|
|
30
|
+
zoom: number;
|
|
31
|
+
/**
|
|
32
|
+
* Create a diagram zoom event.
|
|
33
|
+
*
|
|
34
|
+
* @param coords .
|
|
35
|
+
*/
|
|
36
|
+
constructor(coords: Point, zoom: number);
|
|
23
37
|
}
|
|
24
38
|
/**
|
|
25
39
|
* Diagram event which consists of the user performing a double click on the diagram.
|