@metadev/daga 4.2.10 → 4.2.12
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 +12 -0
- package/index.cjs.js +47 -19
- package/index.esm.js +47 -20
- package/package.json +2 -2
- package/src/index.d.ts +1 -1
- package/src/lib/diagram/diagram-event.d.ts +18 -4
- package/src/lib/util/browser-util.d.ts +1 -0
- package/src/lib/util/canvas-util.d.ts +1 -1
package/Changelog.md
CHANGED
|
@@ -6,6 +6,18 @@ List of releases and changes.
|
|
|
6
6
|
|
|
7
7
|
## Next release Joyeuse
|
|
8
8
|
|
|
9
|
+
## v. 4.2.12
|
|
10
|
+
|
|
11
|
+
- Force location of field `<foreignObject>` tags in webkit browsers [#356](https://github.com/metadevpro/daga/pull/356)
|
|
12
|
+
- Use `<g>` instead of `<foreignObject>` for containers of diagram decorators and objects [#357](https://github.com/metadevpro/daga/pull/357)
|
|
13
|
+
|
|
14
|
+
## v. 4.2.11
|
|
15
|
+
|
|
16
|
+
- Version branch to avoid error in ng-packagr
|
|
17
|
+
- Ensure that an array remains an array after cloning [#349](https://github.com/metadevpro/daga/pull/349)
|
|
18
|
+
- When checking if a port is being shared, ignore connections that have been removed [#350](https://github.com/metadevpro/daga/pull/350)
|
|
19
|
+
- Create `DiagramZoomEvent` to enable listening to user zooming and panning events [#351](https://github.com/metadevpro/daga/pull/351)
|
|
20
|
+
|
|
9
21
|
## v. 4.2.10
|
|
10
22
|
|
|
11
23
|
- Fix errors with cloned objects containing functions [#345](https://github.com/metadevpro/daga/pull/345)
|
package/index.cjs.js
CHANGED
|
@@ -231,7 +231,7 @@ const distanceBetweenPoints = (point1, point2) => {
|
|
|
231
231
|
return Math.pow(Math.pow(point1[0] - point2[0], 2) + Math.pow(point1[1] - point2[1], 2), 0.5);
|
|
232
232
|
};
|
|
233
233
|
/**
|
|
234
|
-
* Checks whether the two given
|
|
234
|
+
* Checks whether the two given rectangles share at least one point.
|
|
235
235
|
* @public
|
|
236
236
|
* @param rectangle1 A rectangle.
|
|
237
237
|
* @param rectangle2 A rectangle.
|
|
@@ -2529,18 +2529,18 @@ class DiagramConnection extends DiagramElement {
|
|
|
2529
2529
|
// alternative start port not valid, it doesn't allow outgoing connections
|
|
2530
2530
|
continue checkAlternativeStartPorts;
|
|
2531
2531
|
}
|
|
2532
|
-
if (!allowSharingPorts && (alternativeStartPort.incomingConnections.
|
|
2532
|
+
if (!allowSharingPorts && (alternativeStartPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeStartPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2533
2533
|
// alternative start port not valid, it already has other connections
|
|
2534
2534
|
continue checkAlternativeStartPorts;
|
|
2535
2535
|
}
|
|
2536
2536
|
if (!allowSharingBothPorts) {
|
|
2537
|
-
for (const connection of alternativeStartPort.outgoingConnections) {
|
|
2537
|
+
for (const connection of alternativeStartPort.outgoingConnections.filter(c => !c.removed)) {
|
|
2538
2538
|
if (connection !== this && connection.end === this.end) {
|
|
2539
2539
|
// alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
|
|
2540
2540
|
continue checkAlternativeStartPorts;
|
|
2541
2541
|
}
|
|
2542
2542
|
}
|
|
2543
|
-
for (const connection of alternativeStartPort.incomingConnections) {
|
|
2543
|
+
for (const connection of alternativeStartPort.incomingConnections.filter(c => !c.removed)) {
|
|
2544
2544
|
if (connection !== this && connection.start === this.end) {
|
|
2545
2545
|
// alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
|
|
2546
2546
|
continue checkAlternativeStartPorts;
|
|
@@ -2567,18 +2567,18 @@ class DiagramConnection extends DiagramElement {
|
|
|
2567
2567
|
// alternative end port not valid, it doesn't allow incoming connections
|
|
2568
2568
|
continue checkAlternativeEndPorts;
|
|
2569
2569
|
}
|
|
2570
|
-
if (!allowSharingPorts && (alternativeEndPort.
|
|
2570
|
+
if (!allowSharingPorts && (alternativeEndPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeEndPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2571
2571
|
// alternative end port not valid, it already has other connections
|
|
2572
2572
|
continue checkAlternativeEndPorts;
|
|
2573
2573
|
}
|
|
2574
2574
|
if (!allowSharingBothPorts) {
|
|
2575
|
-
for (const connection of alternativeEndPort.incomingConnections) {
|
|
2575
|
+
for (const connection of alternativeEndPort.incomingConnections.filter(c => !c.removed)) {
|
|
2576
2576
|
if (connection !== this && connection.start === this.start) {
|
|
2577
2577
|
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
2578
2578
|
continue checkAlternativeEndPorts;
|
|
2579
2579
|
}
|
|
2580
2580
|
}
|
|
2581
|
-
for (const connection of alternativeEndPort.outgoingConnections) {
|
|
2581
|
+
for (const connection of alternativeEndPort.outgoingConnections.filter(c => !c.removed)) {
|
|
2582
2582
|
if (connection !== this && connection.end === this.start) {
|
|
2583
2583
|
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
2584
2584
|
continue checkAlternativeEndPorts;
|
|
@@ -6301,11 +6301,27 @@ class DiagramEvent {
|
|
|
6301
6301
|
*/
|
|
6302
6302
|
exports.DiagramEvents = void 0;
|
|
6303
6303
|
(function (DiagramEvents) {
|
|
6304
|
-
DiagramEvents[DiagramEvents["
|
|
6305
|
-
DiagramEvents[DiagramEvents["
|
|
6306
|
-
DiagramEvents[DiagramEvents["
|
|
6307
|
-
DiagramEvents[DiagramEvents["
|
|
6304
|
+
DiagramEvents[DiagramEvents["Zoom"] = 0] = "Zoom";
|
|
6305
|
+
DiagramEvents[DiagramEvents["DoubleClick"] = 1] = "DoubleClick";
|
|
6306
|
+
DiagramEvents[DiagramEvents["SecondaryClick"] = 2] = "SecondaryClick";
|
|
6307
|
+
DiagramEvents[DiagramEvents["Selection"] = 3] = "Selection";
|
|
6308
|
+
DiagramEvents[DiagramEvents["Highlight"] = 4] = "Highlight";
|
|
6308
6309
|
})(exports.DiagramEvents || (exports.DiagramEvents = {}));
|
|
6310
|
+
/**
|
|
6311
|
+
* Diagram event which consists of the user zooming or panning.
|
|
6312
|
+
*/
|
|
6313
|
+
class DiagramZoomEvent extends DiagramEvent {
|
|
6314
|
+
/**
|
|
6315
|
+
* Create a diagram zoom event.
|
|
6316
|
+
*
|
|
6317
|
+
* @param coords .
|
|
6318
|
+
*/
|
|
6319
|
+
constructor(coords, zoom) {
|
|
6320
|
+
super(exports.DiagramEvents.Zoom);
|
|
6321
|
+
this.coords = coords;
|
|
6322
|
+
this.zoom = zoom;
|
|
6323
|
+
}
|
|
6324
|
+
}
|
|
6309
6325
|
/**
|
|
6310
6326
|
* Diagram event which consists of the user performing a double click on the diagram.
|
|
6311
6327
|
*/
|
|
@@ -7147,7 +7163,6 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7147
7163
|
this.canvas.propertyEditorChanges$.pipe(rxjs.debounceTime(2000)).subscribe(() => {
|
|
7148
7164
|
this.makeUpdateValuesAction();
|
|
7149
7165
|
});
|
|
7150
|
-
console.log(diagramPropertiesText);
|
|
7151
7166
|
this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
|
|
7152
7167
|
}
|
|
7153
7168
|
add(element) {
|
|
@@ -7399,6 +7414,9 @@ const unrotate = (width, height, orientation) => {
|
|
|
7399
7414
|
return [oldWidth, oldHeight];
|
|
7400
7415
|
};
|
|
7401
7416
|
|
|
7417
|
+
var _a;
|
|
7418
|
+
const isWebkit = ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.indexOf('AppleWebKit')) >= 0;
|
|
7419
|
+
|
|
7402
7420
|
/**
|
|
7403
7421
|
* Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
|
|
7404
7422
|
* @private
|
|
@@ -7696,7 +7714,12 @@ class DiagramCanvas {
|
|
|
7696
7714
|
const transformAttribute = event.transform.toString();
|
|
7697
7715
|
this.selectCanvasElements().attr('transform', transformAttribute);
|
|
7698
7716
|
d3__namespace.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
|
|
7717
|
+
if (isWebkit) {
|
|
7718
|
+
// force update fields to compensate for a rendering bug in webkit
|
|
7719
|
+
this.updateFieldsInView();
|
|
7720
|
+
}
|
|
7699
7721
|
this.contextMenu.close();
|
|
7722
|
+
this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
|
|
7700
7723
|
}).on(exports.ZoomEvents.End, () => {
|
|
7701
7724
|
setCursorStyle();
|
|
7702
7725
|
}));
|
|
@@ -8357,7 +8380,7 @@ class DiagramCanvas {
|
|
|
8357
8380
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
8358
8381
|
this.startMultipleSelection(event);
|
|
8359
8382
|
} else {
|
|
8360
|
-
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.length === 0 && d.outgoingConnections.length === 0) && !d.removed) {
|
|
8383
|
+
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
8384
|
setCursorStyle(exports.CursorStyle.Grabbing);
|
|
8362
8385
|
this.startConnection(d);
|
|
8363
8386
|
// should be true after having called this.startConnection()
|
|
@@ -8653,11 +8676,15 @@ class DiagramCanvas {
|
|
|
8653
8676
|
this.secondaryButton = false;
|
|
8654
8677
|
})).append('xhtml:div').style('width', '100%').style('height', '100%').style('display', 'flex').append('xhtml:p').style('box-sizing', 'border-box').style('outline', 0).style('margin', 0).style('border', 0).style('padding', 0).style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
|
|
8655
8678
|
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' : `${unrotate(d.width, d.height, d.orientation)[0]}px`).style('max-height', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[1]}px`).style('overflow', d => d.fit ? 'default' : 'clip').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'center' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'end' : 'start').style('transform', d => `rotate(${d.orientation}deg)`).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/>'));
|
|
8679
|
+
if (isWebkit) {
|
|
8680
|
+
const zoomFactor = this.zoomTransform.k;
|
|
8681
|
+
mergeSelection.attr('width', d => `${d.width * zoomFactor}px`).attr('height', d => `${d.height * zoomFactor}px`).select('div').style('position', 'absolute').style('left', d => `${d.coords[0] * zoomFactor + this.zoomTransform.x}px`).style('top', d => `${d.coords[1] * zoomFactor + this.zoomTransform.y}px`).select('p').style('font-size', d => `${d.fontSize * zoomFactor}px`);
|
|
8682
|
+
}
|
|
8656
8683
|
}
|
|
8657
8684
|
updateObjectsInView(...ids) {
|
|
8658
|
-
let updateSelection = this.selectCanvasElements().selectAll('
|
|
8685
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
8659
8686
|
const exitSelection = updateSelection.exit();
|
|
8660
|
-
const enterSelection = updateSelection.enter().append('
|
|
8687
|
+
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-object');
|
|
8661
8688
|
if (ids && ids.length > 0) {
|
|
8662
8689
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
8663
8690
|
}
|
|
@@ -8698,9 +8725,9 @@ class DiagramCanvas {
|
|
|
8698
8725
|
}));
|
|
8699
8726
|
}
|
|
8700
8727
|
updateDecoratorsInView(...ids) {
|
|
8701
|
-
let updateSelection = this.selectCanvasElements().selectAll('
|
|
8728
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-decorator').data(this.model.decorators.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
8702
8729
|
const exitSelection = updateSelection.exit();
|
|
8703
|
-
const enterSelection = updateSelection.enter().append('
|
|
8730
|
+
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-decorator');
|
|
8704
8731
|
if (ids && ids.length > 0) {
|
|
8705
8732
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
8706
8733
|
}
|
|
@@ -9107,13 +9134,13 @@ class DiagramCanvas {
|
|
|
9107
9134
|
this.dropConnection();
|
|
9108
9135
|
return;
|
|
9109
9136
|
}
|
|
9110
|
-
if (!this.allowSharingPorts && (port.incomingConnections.length > 0 || port.outgoingConnections.length > 0)) {
|
|
9137
|
+
if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
|
|
9111
9138
|
this.dropConnection();
|
|
9112
9139
|
return;
|
|
9113
9140
|
}
|
|
9114
9141
|
if (!this.allowSharingBothPorts && this.model.connections.find(c => {
|
|
9115
9142
|
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;
|
|
9143
|
+
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
9144
|
}) !== undefined) {
|
|
9118
9145
|
this.dropConnection();
|
|
9119
9146
|
return;
|
|
@@ -10325,6 +10352,7 @@ exports.DiagramSectionSet = DiagramSectionSet;
|
|
|
10325
10352
|
exports.DiagramSelectionEvent = DiagramSelectionEvent;
|
|
10326
10353
|
exports.DiagramUserHighlight = DiagramUserHighlight;
|
|
10327
10354
|
exports.DiagramUserSelection = DiagramUserSelection;
|
|
10355
|
+
exports.DiagramZoomEvent = DiagramZoomEvent;
|
|
10328
10356
|
exports.EditFieldAction = EditFieldAction;
|
|
10329
10357
|
exports.ForceLayout = ForceLayout;
|
|
10330
10358
|
exports.HorizontalLayout = HorizontalLayout;
|
package/index.esm.js
CHANGED
|
@@ -210,7 +210,7 @@ const distanceBetweenPoints = (point1, point2) => {
|
|
|
210
210
|
return Math.pow(Math.pow(point1[0] - point2[0], 2) + Math.pow(point1[1] - point2[1], 2), 0.5);
|
|
211
211
|
};
|
|
212
212
|
/**
|
|
213
|
-
* Checks whether the two given
|
|
213
|
+
* Checks whether the two given rectangles share at least one point.
|
|
214
214
|
* @public
|
|
215
215
|
* @param rectangle1 A rectangle.
|
|
216
216
|
* @param rectangle2 A rectangle.
|
|
@@ -2508,18 +2508,18 @@ class DiagramConnection extends DiagramElement {
|
|
|
2508
2508
|
// alternative start port not valid, it doesn't allow outgoing connections
|
|
2509
2509
|
continue checkAlternativeStartPorts;
|
|
2510
2510
|
}
|
|
2511
|
-
if (!allowSharingPorts && (alternativeStartPort.incomingConnections.
|
|
2511
|
+
if (!allowSharingPorts && (alternativeStartPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeStartPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2512
2512
|
// alternative start port not valid, it already has other connections
|
|
2513
2513
|
continue checkAlternativeStartPorts;
|
|
2514
2514
|
}
|
|
2515
2515
|
if (!allowSharingBothPorts) {
|
|
2516
|
-
for (const connection of alternativeStartPort.outgoingConnections) {
|
|
2516
|
+
for (const connection of alternativeStartPort.outgoingConnections.filter(c => !c.removed)) {
|
|
2517
2517
|
if (connection !== this && connection.end === this.end) {
|
|
2518
2518
|
// alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
|
|
2519
2519
|
continue checkAlternativeStartPorts;
|
|
2520
2520
|
}
|
|
2521
2521
|
}
|
|
2522
|
-
for (const connection of alternativeStartPort.incomingConnections) {
|
|
2522
|
+
for (const connection of alternativeStartPort.incomingConnections.filter(c => !c.removed)) {
|
|
2523
2523
|
if (connection !== this && connection.start === this.end) {
|
|
2524
2524
|
// alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
|
|
2525
2525
|
continue checkAlternativeStartPorts;
|
|
@@ -2546,18 +2546,18 @@ class DiagramConnection extends DiagramElement {
|
|
|
2546
2546
|
// alternative end port not valid, it doesn't allow incoming connections
|
|
2547
2547
|
continue checkAlternativeEndPorts;
|
|
2548
2548
|
}
|
|
2549
|
-
if (!allowSharingPorts && (alternativeEndPort.
|
|
2549
|
+
if (!allowSharingPorts && (alternativeEndPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeEndPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2550
2550
|
// alternative end port not valid, it already has other connections
|
|
2551
2551
|
continue checkAlternativeEndPorts;
|
|
2552
2552
|
}
|
|
2553
2553
|
if (!allowSharingBothPorts) {
|
|
2554
|
-
for (const connection of alternativeEndPort.incomingConnections) {
|
|
2554
|
+
for (const connection of alternativeEndPort.incomingConnections.filter(c => !c.removed)) {
|
|
2555
2555
|
if (connection !== this && connection.start === this.start) {
|
|
2556
2556
|
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
2557
2557
|
continue checkAlternativeEndPorts;
|
|
2558
2558
|
}
|
|
2559
2559
|
}
|
|
2560
|
-
for (const connection of alternativeEndPort.outgoingConnections) {
|
|
2560
|
+
for (const connection of alternativeEndPort.outgoingConnections.filter(c => !c.removed)) {
|
|
2561
2561
|
if (connection !== this && connection.end === this.start) {
|
|
2562
2562
|
// alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
|
|
2563
2563
|
continue checkAlternativeEndPorts;
|
|
@@ -6280,11 +6280,27 @@ class DiagramEvent {
|
|
|
6280
6280
|
*/
|
|
6281
6281
|
var DiagramEvents;
|
|
6282
6282
|
(function (DiagramEvents) {
|
|
6283
|
-
DiagramEvents[DiagramEvents["
|
|
6284
|
-
DiagramEvents[DiagramEvents["
|
|
6285
|
-
DiagramEvents[DiagramEvents["
|
|
6286
|
-
DiagramEvents[DiagramEvents["
|
|
6283
|
+
DiagramEvents[DiagramEvents["Zoom"] = 0] = "Zoom";
|
|
6284
|
+
DiagramEvents[DiagramEvents["DoubleClick"] = 1] = "DoubleClick";
|
|
6285
|
+
DiagramEvents[DiagramEvents["SecondaryClick"] = 2] = "SecondaryClick";
|
|
6286
|
+
DiagramEvents[DiagramEvents["Selection"] = 3] = "Selection";
|
|
6287
|
+
DiagramEvents[DiagramEvents["Highlight"] = 4] = "Highlight";
|
|
6287
6288
|
})(DiagramEvents || (DiagramEvents = {}));
|
|
6289
|
+
/**
|
|
6290
|
+
* Diagram event which consists of the user zooming or panning.
|
|
6291
|
+
*/
|
|
6292
|
+
class DiagramZoomEvent extends DiagramEvent {
|
|
6293
|
+
/**
|
|
6294
|
+
* Create a diagram zoom event.
|
|
6295
|
+
*
|
|
6296
|
+
* @param coords .
|
|
6297
|
+
*/
|
|
6298
|
+
constructor(coords, zoom) {
|
|
6299
|
+
super(DiagramEvents.Zoom);
|
|
6300
|
+
this.coords = coords;
|
|
6301
|
+
this.zoom = zoom;
|
|
6302
|
+
}
|
|
6303
|
+
}
|
|
6288
6304
|
/**
|
|
6289
6305
|
* Diagram event which consists of the user performing a double click on the diagram.
|
|
6290
6306
|
*/
|
|
@@ -7126,7 +7142,6 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7126
7142
|
this.canvas.propertyEditorChanges$.pipe(debounceTime(2000)).subscribe(() => {
|
|
7127
7143
|
this.makeUpdateValuesAction();
|
|
7128
7144
|
});
|
|
7129
|
-
console.log(diagramPropertiesText);
|
|
7130
7145
|
this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
|
|
7131
7146
|
}
|
|
7132
7147
|
add(element) {
|
|
@@ -7378,6 +7393,9 @@ const unrotate = (width, height, orientation) => {
|
|
|
7378
7393
|
return [oldWidth, oldHeight];
|
|
7379
7394
|
};
|
|
7380
7395
|
|
|
7396
|
+
var _a;
|
|
7397
|
+
const isWebkit = ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.indexOf('AppleWebKit')) >= 0;
|
|
7398
|
+
|
|
7381
7399
|
/**
|
|
7382
7400
|
* Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
|
|
7383
7401
|
* @private
|
|
@@ -7675,7 +7693,12 @@ class DiagramCanvas {
|
|
|
7675
7693
|
const transformAttribute = event.transform.toString();
|
|
7676
7694
|
this.selectCanvasElements().attr('transform', transformAttribute);
|
|
7677
7695
|
d3.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
|
|
7696
|
+
if (isWebkit) {
|
|
7697
|
+
// force update fields to compensate for a rendering bug in webkit
|
|
7698
|
+
this.updateFieldsInView();
|
|
7699
|
+
}
|
|
7678
7700
|
this.contextMenu.close();
|
|
7701
|
+
this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
|
|
7679
7702
|
}).on(ZoomEvents.End, () => {
|
|
7680
7703
|
setCursorStyle();
|
|
7681
7704
|
}));
|
|
@@ -8336,7 +8359,7 @@ class DiagramCanvas {
|
|
|
8336
8359
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
8337
8360
|
this.startMultipleSelection(event);
|
|
8338
8361
|
} else {
|
|
8339
|
-
if (this.canUserPerformAction(DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.length === 0 && d.outgoingConnections.length === 0) && !d.removed) {
|
|
8362
|
+
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
8363
|
setCursorStyle(CursorStyle.Grabbing);
|
|
8341
8364
|
this.startConnection(d);
|
|
8342
8365
|
// should be true after having called this.startConnection()
|
|
@@ -8632,11 +8655,15 @@ class DiagramCanvas {
|
|
|
8632
8655
|
this.secondaryButton = false;
|
|
8633
8656
|
})).append('xhtml:div').style('width', '100%').style('height', '100%').style('display', 'flex').append('xhtml:p').style('box-sizing', 'border-box').style('outline', 0).style('margin', 0).style('border', 0).style('padding', 0).style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
|
|
8634
8657
|
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 === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === VerticalAlign.Center ? 'center' : d.verticalAlign === VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[0]}px`).style('max-height', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[1]}px`).style('overflow', d => d.fit ? 'default' : 'clip').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'end' : 'start').style('transform', d => `rotate(${d.orientation}deg)`).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/>'));
|
|
8658
|
+
if (isWebkit) {
|
|
8659
|
+
const zoomFactor = this.zoomTransform.k;
|
|
8660
|
+
mergeSelection.attr('width', d => `${d.width * zoomFactor}px`).attr('height', d => `${d.height * zoomFactor}px`).select('div').style('position', 'absolute').style('left', d => `${d.coords[0] * zoomFactor + this.zoomTransform.x}px`).style('top', d => `${d.coords[1] * zoomFactor + this.zoomTransform.y}px`).select('p').style('font-size', d => `${d.fontSize * zoomFactor}px`);
|
|
8661
|
+
}
|
|
8635
8662
|
}
|
|
8636
8663
|
updateObjectsInView(...ids) {
|
|
8637
|
-
let updateSelection = this.selectCanvasElements().selectAll('
|
|
8664
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
8638
8665
|
const exitSelection = updateSelection.exit();
|
|
8639
|
-
const enterSelection = updateSelection.enter().append('
|
|
8666
|
+
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-object');
|
|
8640
8667
|
if (ids && ids.length > 0) {
|
|
8641
8668
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
8642
8669
|
}
|
|
@@ -8677,9 +8704,9 @@ class DiagramCanvas {
|
|
|
8677
8704
|
}));
|
|
8678
8705
|
}
|
|
8679
8706
|
updateDecoratorsInView(...ids) {
|
|
8680
|
-
let updateSelection = this.selectCanvasElements().selectAll('
|
|
8707
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-decorator').data(this.model.decorators.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
8681
8708
|
const exitSelection = updateSelection.exit();
|
|
8682
|
-
const enterSelection = updateSelection.enter().append('
|
|
8709
|
+
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-decorator');
|
|
8683
8710
|
if (ids && ids.length > 0) {
|
|
8684
8711
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
8685
8712
|
}
|
|
@@ -9086,13 +9113,13 @@ class DiagramCanvas {
|
|
|
9086
9113
|
this.dropConnection();
|
|
9087
9114
|
return;
|
|
9088
9115
|
}
|
|
9089
|
-
if (!this.allowSharingPorts && (port.incomingConnections.length > 0 || port.outgoingConnections.length > 0)) {
|
|
9116
|
+
if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
|
|
9090
9117
|
this.dropConnection();
|
|
9091
9118
|
return;
|
|
9092
9119
|
}
|
|
9093
9120
|
if (!this.allowSharingBothPorts && this.model.connections.find(c => {
|
|
9094
9121
|
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;
|
|
9122
|
+
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
9123
|
}) !== undefined) {
|
|
9097
9124
|
this.dropConnection();
|
|
9098
9125
|
return;
|
|
@@ -10262,4 +10289,4 @@ const getLocationsOfNodes = model => {
|
|
|
10262
10289
|
return locations;
|
|
10263
10290
|
};
|
|
10264
10291
|
|
|
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 };
|
|
10292
|
+
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": "4.2.
|
|
3
|
+
"version": "4.2.12",
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isWebkit: boolean;
|
|
@@ -144,7 +144,7 @@ export declare const linesOverlap: (line1: Line, line2: Line) => boolean;
|
|
|
144
144
|
*/
|
|
145
145
|
export declare const lineIntersectsRectangle: (line: Line, rectangle: Rectangle) => boolean;
|
|
146
146
|
/**
|
|
147
|
-
* Checks whether the two given
|
|
147
|
+
* Checks whether the two given rectangles share at least one point.
|
|
148
148
|
* @public
|
|
149
149
|
* @param rectangle1 A rectangle.
|
|
150
150
|
* @param rectangle2 A rectangle.
|