@metadev/daga 1.5.2 → 1.5.4

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 CHANGED
@@ -6,6 +6,19 @@ List of releases and changes.
6
6
 
7
7
  ## Next release Lobera
8
8
 
9
+ ## v. 1.5.4
10
+
11
+ Date: _2024-09-21_
12
+
13
+ - Add diagram decorators [#164](https://github.com/metadevpro/daga/issues/164) [#166](https://github.com/metadevpro/daga/pull/166)
14
+ - Enable diagram events on diagram objects [#166](https://github.com/metadevpro/daga/pull/166)
15
+
16
+ ## v. 1.5.3
17
+
18
+ Date: _2024-09-09_
19
+
20
+ - Create interface for listening to user events on the diagram [#160](https://github.com/metadevpro/daga/issues/160) [#161](https://github.com/metadevpro/daga/pull/161)
21
+
9
22
  ## v. 1.5.2
10
23
 
11
24
  Date: _2024-08-30_
@@ -2207,6 +2207,11 @@ class DiagramSection extends DiagramElement {
2207
2207
  * @public
2208
2208
  */
2209
2209
  this.ports = [];
2210
+ /**
2211
+ * Decorators of this section.
2212
+ * @public
2213
+ */
2214
+ this.decorators = [];
2210
2215
  this.node = node;
2211
2216
  this.indexXInNode = indexXInNode;
2212
2217
  this.indexYInNode = indexYInNode;
@@ -2396,6 +2401,10 @@ class DiagramSection extends DiagramElement {
2396
2401
  this.height - (this.getConfig()?.label?.margin || 0) * 2);
2397
2402
  this.label.updateInView();
2398
2403
  }
2404
+ // Move decorators to match the new coords.
2405
+ for (const decorator of this.decorators) {
2406
+ decorator.move(translatePoint(decorator.coords, oldCoordsX, oldCoordsY, newCoordsX, newCoordsY));
2407
+ }
2399
2408
  // Update canvas.
2400
2409
  this.getConnections().forEach((c) => c.tighten());
2401
2410
  this.updateInView();
@@ -2597,6 +2606,11 @@ class DiagramNode extends DiagramElement {
2597
2606
  * @public
2598
2607
  */
2599
2608
  this.ports = [];
2609
+ /**
2610
+ * Decorators of this node.
2611
+ * @public
2612
+ */
2613
+ this.decorators = [];
2600
2614
  /**
2601
2615
  * Collaborative timestamp for SetGeometryCollabActions.
2602
2616
  * @public
@@ -2913,6 +2927,10 @@ class DiagramNode extends DiagramElement {
2913
2927
  (this.label.height = this.height - (this.type.label?.margin || 0) * 2);
2914
2928
  this.label.updateInView();
2915
2929
  }
2930
+ // Move decorators to match the new coords.
2931
+ for (const decorator of this.decorators) {
2932
+ decorator.move(translatePoint(decorator.coords, oldCoordsX, oldCoordsY, newCoordsX, newCoordsY));
2933
+ }
2916
2934
  // Update canvas.
2917
2935
  this.getConnections().forEach((c) => c.tighten());
2918
2936
  this.updateInView();
@@ -4781,8 +4799,8 @@ class PriorityLayout {
4781
4799
  // nothing to arrange...
4782
4800
  return model;
4783
4801
  }
4784
- const maximumPriority = Math.max(...model.nodes.types.all().map((n) => n.priority));
4785
- const minimumPriority = Math.min(...model.nodes.types.all().map((n) => n.priority));
4802
+ const maximumPriority = Math.max(...model.nodes.filter((n) => !n.removed).map((n) => n.getPriority()));
4803
+ const minimumPriority = Math.min(...model.nodes.filter((n) => !n.removed).map((n) => n.getPriority()));
4786
4804
  if (maximumPriority === minimumPriority) {
4787
4805
  // if there's no disparity in priorities, just use breadth layout
4788
4806
  new BreadthLayout().apply(model);
@@ -4880,6 +4898,106 @@ class PriorityLayout {
4880
4898
  }
4881
4899
  }
4882
4900
 
4901
+ /**
4902
+ * A layout which arranges the nodes in trees from left to right by depth relative to the nodes with most priority.
4903
+ * @public
4904
+ */
4905
+ class TreeLayout {
4906
+ apply(model) {
4907
+ if (model.nodes.length === 0) {
4908
+ // nothing to arrange...
4909
+ return model;
4910
+ }
4911
+ const maximumPriority = Math.max(...model.nodes.filter((n) => !n.removed).map((n) => n.getPriority()));
4912
+ const minimumPriority = Math.min(...model.nodes.filter((n) => !n.removed).map((n) => n.getPriority()));
4913
+ if (maximumPriority === minimumPriority) {
4914
+ // if there's no disparity in priorities, just use breadth layout
4915
+ new BreadthLayout().apply(model);
4916
+ return model;
4917
+ }
4918
+ const gapSize = (model.canvas?.gridSize || 0) * 2;
4919
+ const nodesToBeArranged = [...model.nodes].sort((n1, n2) => n2.getPriority() - n1.getPriority());
4920
+ const branches = [];
4921
+ while (nodesToBeArranged.length > 0) {
4922
+ const nodeToBeArranged = nodesToBeArranged[0];
4923
+ nodesToBeArranged.splice(0, 1);
4924
+ const branch = new Branch(undefined, nodeToBeArranged);
4925
+ populateBranches(branch, nodesToBeArranged);
4926
+ branches.push(branch);
4927
+ }
4928
+ const branchArrangement = [];
4929
+ for (const branch of branches) {
4930
+ branchArrangement.push([branch]);
4931
+ arrangeBranches(branch, branchArrangement, branchArrangement.length);
4932
+ }
4933
+ const maximumHeight = Math.max(...model.nodes.all().map((n) => n.height));
4934
+ let widthAccumulator = 0;
4935
+ for (let i = 0; i < branchArrangement.length; ++i) {
4936
+ let heightAccumulator = 0;
4937
+ for (let j = 0; j < branchArrangement[i].length; ++j) {
4938
+ const branch = branchArrangement[i][j];
4939
+ branch.node.move([widthAccumulator, heightAccumulator]);
4940
+ heightAccumulator +=
4941
+ (gapSize + maximumHeight) * branch.countBranchHeight();
4942
+ }
4943
+ const maximumWidth = Math.max(...branchArrangement[i].map((b) => b.node.width));
4944
+ widthAccumulator += gapSize + maximumWidth;
4945
+ }
4946
+ for (const connection of model.connections) {
4947
+ connection.tighten();
4948
+ }
4949
+ model.canvas?.diagramChanges$.next();
4950
+ return model;
4951
+ }
4952
+ }
4953
+ const populateBranches = (branch, nodesToBeArranged) => {
4954
+ for (const adjacentNode of branch.node.getAdjacentNodes()) {
4955
+ const indexOfAdjacentNode = nodesToBeArranged.indexOf(adjacentNode);
4956
+ if (indexOfAdjacentNode >= 0) {
4957
+ nodesToBeArranged.splice(indexOfAdjacentNode, 1);
4958
+ const newBranch = branch.addBranch(adjacentNode);
4959
+ populateBranches(newBranch, nodesToBeArranged);
4960
+ }
4961
+ }
4962
+ };
4963
+ const arrangeBranches = (branch, branchArrangement, index) => {
4964
+ if (branch.branches.length > 0) {
4965
+ while (index >= branchArrangement.length) {
4966
+ branchArrangement.push([]);
4967
+ }
4968
+ for (const subbranch of branch.branches) {
4969
+ branchArrangement[index].push(subbranch);
4970
+ arrangeBranches(subbranch, branchArrangement, index + 1);
4971
+ }
4972
+ }
4973
+ };
4974
+ class Branch {
4975
+ constructor(parent, node) {
4976
+ this.parent = parent;
4977
+ this.branches = [];
4978
+ this.depth = 0;
4979
+ this.node = node;
4980
+ }
4981
+ addBranch(node) {
4982
+ const newBranch = new Branch(this, node);
4983
+ newBranch.depth = this.depth + 1;
4984
+ this.branches.push(newBranch);
4985
+ return newBranch;
4986
+ }
4987
+ countBranchHeight() {
4988
+ if (this.branches.length <= 0) {
4989
+ return 1;
4990
+ }
4991
+ else {
4992
+ let total = 0;
4993
+ for (const subbranch of this.branches) {
4994
+ total += subbranch.countBranchHeight();
4995
+ }
4996
+ return total;
4997
+ }
4998
+ }
4999
+ }
5000
+
4883
5001
  /**
4884
5002
  * A layout which arranges all the nodes in a vertical line.
4885
5003
  * @public
@@ -4913,6 +5031,7 @@ const layouts = {
4913
5031
  force: new ForceLayout(),
4914
5032
  horizontal: new HorizontalLayout(),
4915
5033
  priority: new PriorityLayout(),
5034
+ tree: new TreeLayout(),
4916
5035
  vertical: new VerticalLayout()
4917
5036
  };
4918
5037
 
@@ -5278,6 +5397,102 @@ class DagaExporter {
5278
5397
  }
5279
5398
  }
5280
5399
 
5400
+ /**
5401
+ * Represents an action taken by the user on the diagram.
5402
+ * @public
5403
+ */
5404
+ class DiagramEvent {
5405
+ constructor(cause, type, target, coords) {
5406
+ this.cause = cause;
5407
+ this.type = type;
5408
+ this.target = target;
5409
+ this.coords = coords;
5410
+ this.defaultPrevented = false;
5411
+ }
5412
+ preventDefault() {
5413
+ this.defaultPrevented = true;
5414
+ }
5415
+ }
5416
+
5417
+ /**
5418
+ * A foreign object which is inserted with arbitrary html into a diagram.
5419
+ * Similar to a diagram object, but it's part of a node or section and it moves and stretches as its geometry changes.
5420
+ * Diagram decorators are not serialized with other diagram elements.
5421
+ * @see DiagramNode
5422
+ * @see DiagramObject
5423
+ * @see DiagramSection
5424
+ * @public
5425
+ */
5426
+ class DiagramDecorator extends DiagramElement {
5427
+ constructor(model, coords, width, height, priority, html, id) {
5428
+ if (model.objects.get(id) !== undefined) {
5429
+ throw new Error(`DiagramObject with id "${id}" already exists`);
5430
+ }
5431
+ super(model, id);
5432
+ this.coords = coords;
5433
+ this.width = width;
5434
+ this.height = height;
5435
+ this.priority = priority;
5436
+ this.html = html;
5437
+ }
5438
+ select() {
5439
+ return this.model.canvas
5440
+ ?.selectCanvasView()
5441
+ ?.select(`foreignObject#${this.id}`);
5442
+ }
5443
+ get removed() {
5444
+ return this.selfRemoved;
5445
+ }
5446
+ updateInView() {
5447
+ this.model.canvas?.updateDecoratorsInView(this.id);
5448
+ }
5449
+ /**
5450
+ * Change the coordinates of this decorator to the given coordinates.
5451
+ * @public
5452
+ * @param coords A point in the diagram.
5453
+ */
5454
+ move(coords) {
5455
+ this.coords = coords;
5456
+ this.updateInView();
5457
+ }
5458
+ getPriority() {
5459
+ return this.priority;
5460
+ }
5461
+ }
5462
+ class DiagramDecoratorSet extends DiagramEntitySet {
5463
+ /**
5464
+ * Instance a set of decorators for the given model. This method is used internally.
5465
+ * @private
5466
+ */
5467
+ constructor(model) {
5468
+ super();
5469
+ this.model = model;
5470
+ }
5471
+ /**
5472
+ * Instance a new decorator and add it to this set.
5473
+ * @private
5474
+ */
5475
+ new(rootElement, coords, width, height, priority, html, id) {
5476
+ const decorator = new DiagramDecorator(this.model, coords, width, height, priority, html, id);
5477
+ super.add(decorator);
5478
+ decorator.updateInView();
5479
+ // add this port to its root element
5480
+ if (rootElement !== undefined) {
5481
+ rootElement.decorators.push(decorator);
5482
+ }
5483
+ return decorator;
5484
+ }
5485
+ remove(id) {
5486
+ const object = this.get(id);
5487
+ if (object) {
5488
+ // remove from set of objects
5489
+ super.remove(id);
5490
+ // remove from canvas
5491
+ object.updateInView();
5492
+ }
5493
+ }
5494
+ }
5495
+
5281
5496
  /**
5282
5497
  * A foreign object which is inserted with arbitrary html into a diagram.
5283
5498
  * Diagram objects are not serialized with other diagram elements.
@@ -5392,6 +5607,12 @@ class DiagramModel {
5392
5607
  * @public
5393
5608
  */
5394
5609
  this.objects = new DiagramObjectSet(this);
5610
+ /**
5611
+ * Decorators of this model.
5612
+ * @see DiagramDecorator
5613
+ * @public
5614
+ */
5615
+ this.decorators = new DiagramDecoratorSet(this);
5395
5616
  this.canvas = canvas;
5396
5617
  this.id = id;
5397
5618
  this.name = name;
@@ -5555,10 +5776,17 @@ class DiagramCanvas {
5555
5776
  d3.select(this.diagramRoot).node()?.focus();
5556
5777
  })
5557
5778
  .on(Events.ContextMenu, (event) => {
5558
- if (this.canUserPerformAction(DiagramActions.ContextMenu)) {
5779
+ const diagramEvent = new DiagramEvent(event, Events.ContextMenu, undefined);
5780
+ this.parentComponent.modelEvent.emit(diagramEvent);
5781
+ if (!diagramEvent.defaultPrevented &&
5782
+ this.canUserPerformAction(DiagramActions.ContextMenu)) {
5559
5783
  event.preventDefault();
5560
5784
  this.openContextMenu(event);
5561
5785
  }
5786
+ })
5787
+ .on(Events.DoubleClick, (event) => {
5788
+ const diagramEvent = new DiagramEvent(event, Events.DoubleClick, undefined);
5789
+ this.parentComponent.modelEvent.emit(diagramEvent);
5562
5790
  })
5563
5791
  .on(Events.KeyDown, (event) => {
5564
5792
  if (!event.ctrlKey &&
@@ -5713,6 +5941,7 @@ class DiagramCanvas {
5713
5941
  canvasElements.append('g').attr('class', 'canvas-connections');
5714
5942
  canvasElements.append('g').attr('class', 'canvas-fields');
5715
5943
  canvasElements.append('g').attr('class', 'canvas-objects');
5944
+ canvasElements.append('g').attr('class', 'canvas-decorators');
5716
5945
  this.viewInitialized$.next();
5717
5946
  }
5718
5947
  zoomBy(zoom) {
@@ -5836,6 +6065,7 @@ class DiagramCanvas {
5836
6065
  this.updateConnectionsInView();
5837
6066
  this.updateFieldsInView();
5838
6067
  this.updateObjectsInView();
6068
+ this.updateDecoratorsInView();
5839
6069
  }
5840
6070
  updateNodesInView(...ids) {
5841
6071
  let updateSelection = this.selectCanvasNodes()
@@ -5866,12 +6096,19 @@ class DiagramCanvas {
5866
6096
  this.toggleUserSelection(d);
5867
6097
  })
5868
6098
  .on(Events.ContextMenu, (event, d) => {
5869
- if (this.canUserPerformAction(DiagramActions.ContextMenu)) {
6099
+ const diagramEvent = new DiagramEvent(event, Events.ContextMenu, d);
6100
+ this.parentComponent.modelEvent.emit(diagramEvent);
6101
+ if (!diagramEvent.defaultPrevented &&
6102
+ this.canUserPerformAction(DiagramActions.ContextMenu)) {
5870
6103
  event.preventDefault();
5871
6104
  this.highlight(d);
5872
6105
  this.addToUserSelection(d);
5873
6106
  this.openContextMenu(event);
5874
6107
  }
6108
+ })
6109
+ .on(Events.DoubleClick, (event, d) => {
6110
+ const diagramEvent = new DiagramEvent(event, Events.DoubleClick, d);
6111
+ this.parentComponent.modelEvent.emit(diagramEvent);
5875
6112
  })
5876
6113
  .call(d3
5877
6114
  .drag()
@@ -6398,13 +6635,20 @@ class DiagramCanvas {
6398
6635
  this.toggleUserSelection(getRelatedNodeOrItself(d));
6399
6636
  })
6400
6637
  .on(Events.ContextMenu, (event, d) => {
6401
- if (this.canUserPerformAction(DiagramActions.ContextMenu)) {
6638
+ const diagramEvent = new DiagramEvent(event, Events.ContextMenu, d);
6639
+ this.parentComponent.modelEvent.emit(diagramEvent);
6640
+ if (!diagramEvent.defaultPrevented &&
6641
+ this.canUserPerformAction(DiagramActions.ContextMenu)) {
6402
6642
  event.preventDefault();
6403
6643
  const elementToSelect = getRelatedNodeOrItself(d);
6404
6644
  this.highlight(elementToSelect);
6405
6645
  this.addToUserSelection(elementToSelect);
6406
6646
  this.openContextMenu(event);
6407
6647
  }
6648
+ })
6649
+ .on(Events.DoubleClick, (event, d) => {
6650
+ const diagramEvent = new DiagramEvent(event, Events.DoubleClick, d);
6651
+ this.parentComponent.modelEvent.emit(diagramEvent);
6408
6652
  })
6409
6653
  .call(d3
6410
6654
  .drag()
@@ -6966,13 +7210,20 @@ class DiagramCanvas {
6966
7210
  this.toggleUserSelection(getRelatedNodeOrItself(d));
6967
7211
  })
6968
7212
  .on(Events.ContextMenu, (event, d) => {
6969
- if (this.canUserPerformAction(DiagramActions.ContextMenu)) {
7213
+ const diagramEvent = new DiagramEvent(event, Events.ContextMenu, d);
7214
+ this.parentComponent.modelEvent.emit(diagramEvent);
7215
+ if (!diagramEvent.defaultPrevented &&
7216
+ this.canUserPerformAction(DiagramActions.ContextMenu)) {
6970
7217
  event.preventDefault();
6971
7218
  const elementToSelect = getRelatedNodeOrItself(d);
6972
7219
  this.highlight(elementToSelect);
6973
7220
  this.addToUserSelection(elementToSelect);
6974
7221
  this.openContextMenu(event);
6975
7222
  }
7223
+ })
7224
+ .on(Events.DoubleClick, (event, d) => {
7225
+ const diagramEvent = new DiagramEvent(event, Events.DoubleClick, d);
7226
+ this.parentComponent.modelEvent.emit(diagramEvent);
6976
7227
  })
6977
7228
  .call(d3
6978
7229
  .drag()
@@ -7128,12 +7379,19 @@ class DiagramCanvas {
7128
7379
  this.toggleUserSelection(d);
7129
7380
  })
7130
7381
  .on(Events.ContextMenu, (event, d) => {
7131
- if (this.canUserPerformAction(DiagramActions.ContextMenu)) {
7382
+ const diagramEvent = new DiagramEvent(event, Events.ContextMenu, d);
7383
+ this.parentComponent.modelEvent.emit(diagramEvent);
7384
+ if (!diagramEvent.defaultPrevented &&
7385
+ this.canUserPerformAction(DiagramActions.ContextMenu)) {
7132
7386
  event.preventDefault();
7133
7387
  this.highlight(d);
7134
7388
  this.addToUserSelection(d);
7135
7389
  this.openContextMenu(event);
7136
7390
  }
7391
+ })
7392
+ .on(Events.DoubleClick, (event, d) => {
7393
+ const diagramEvent = new DiagramEvent(event, Events.DoubleClick, d);
7394
+ this.parentComponent.modelEvent.emit(diagramEvent);
7137
7395
  });
7138
7396
  enterSelection.append('path').attr('class', 'diagram-connection-path');
7139
7397
  enterSelection.append('path').attr('class', 'diagram-connection-path-box');
@@ -7221,7 +7479,10 @@ class DiagramCanvas {
7221
7479
  this.toggleUserSelection(getRelatedNodeOrItself(d));
7222
7480
  })
7223
7481
  .on(Events.ContextMenu, (event, d) => {
7224
- if (this.canUserPerformAction(DiagramActions.ContextMenu)) {
7482
+ const diagramEvent = new DiagramEvent(event, Events.ContextMenu, d);
7483
+ this.parentComponent.modelEvent.emit(diagramEvent);
7484
+ if (!diagramEvent.defaultPrevented &&
7485
+ this.canUserPerformAction(DiagramActions.ContextMenu)) {
7225
7486
  event.preventDefault();
7226
7487
  const elementToSelect = getRelatedNodeOrItself(d);
7227
7488
  this.highlight(elementToSelect);
@@ -7229,8 +7490,11 @@ class DiagramCanvas {
7229
7490
  this.openContextMenu(event);
7230
7491
  }
7231
7492
  })
7232
- .on(Events.DoubleClick, (_event, d) => {
7233
- if (this.canUserPerformAction(DiagramActions.EditField) &&
7493
+ .on(Events.DoubleClick, (event, d) => {
7494
+ const diagramEvent = new DiagramEvent(event, Events.DoubleClick, d);
7495
+ this.parentComponent.modelEvent.emit(diagramEvent);
7496
+ if (!diagramEvent.defaultPrevented &&
7497
+ this.canUserPerformAction(DiagramActions.EditField) &&
7234
7498
  d.editable &&
7235
7499
  !d.removed) {
7236
7500
  this.currentAction = new EditFieldAction(this, d.id, d.text, '');
@@ -7385,6 +7649,58 @@ class DiagramCanvas {
7385
7649
  .attr('transform', (d) => `translate(${d.coords[0]},${d.coords[1]})`)
7386
7650
  .html((d) => d.html);
7387
7651
  exitSelection.remove();
7652
+ enterSelection
7653
+ .on(Events.ContextMenu, (event) => {
7654
+ const diagramEvent = new DiagramEvent(event, Events.ContextMenu, undefined);
7655
+ this.parentComponent.modelEvent.emit(diagramEvent);
7656
+ if (!diagramEvent.defaultPrevented &&
7657
+ this.canUserPerformAction(DiagramActions.ContextMenu)) {
7658
+ event.preventDefault();
7659
+ this.openContextMenu(event);
7660
+ }
7661
+ })
7662
+ .on(Events.DoubleClick, (event, d) => {
7663
+ const diagramEvent = new DiagramEvent(event, Events.DoubleClick, d);
7664
+ this.parentComponent.modelEvent.emit(diagramEvent);
7665
+ });
7666
+ }
7667
+ updateDecoratorsInView(...ids) {
7668
+ let updateSelection = this.selectCanvasDecorators()
7669
+ .selectAll('foreignObject.diagram-decorator')
7670
+ .data(this.model.decorators.filter((e) => !e.removed &&
7671
+ (this.priorityThreshold !== undefined
7672
+ ? e.getPriority() >= this.priorityThreshold
7673
+ : true)), (d) => d.id);
7674
+ const exitSelection = updateSelection.exit();
7675
+ const enterSelection = updateSelection
7676
+ .enter()
7677
+ .append('foreignObject')
7678
+ .attr('id', (d) => d.id)
7679
+ .attr('class', 'diagram-decorator');
7680
+ if (ids && ids.length > 0) {
7681
+ updateSelection = updateSelection.filter((d) => ids.includes(d.id));
7682
+ }
7683
+ const mergeSelection = enterSelection.merge(updateSelection);
7684
+ mergeSelection
7685
+ .attr('width', (d) => `${d.width}px`)
7686
+ .attr('height', (d) => `${d.height}px`)
7687
+ .attr('transform', (d) => `translate(${d.coords[0]},${d.coords[1]})`)
7688
+ .html((d) => d.html);
7689
+ exitSelection.remove();
7690
+ enterSelection
7691
+ .on(Events.ContextMenu, (event) => {
7692
+ const diagramEvent = new DiagramEvent(event, Events.ContextMenu, undefined);
7693
+ this.parentComponent.modelEvent.emit(diagramEvent);
7694
+ if (!diagramEvent.defaultPrevented &&
7695
+ this.canUserPerformAction(DiagramActions.ContextMenu)) {
7696
+ event.preventDefault();
7697
+ this.openContextMenu(event);
7698
+ }
7699
+ })
7700
+ .on(Events.DoubleClick, (event, d) => {
7701
+ const diagramEvent = new DiagramEvent(event, Events.DoubleClick, d);
7702
+ this.parentComponent.modelEvent.emit(diagramEvent);
7703
+ });
7388
7704
  }
7389
7705
  updateConnectionLabelsInView(connection) {
7390
7706
  const connectionSelection = this.selectCanvasView().select(`g.diagram-connection#${connection.id}`);
@@ -7690,6 +8006,9 @@ class DiagramCanvas {
7690
8006
  selectCanvasObjects() {
7691
8007
  return this.selectRoot().select(`.canvas-objects`);
7692
8008
  }
8009
+ selectCanvasDecorators() {
8010
+ return this.selectRoot().select(`.canvas-decorators`);
8011
+ }
7693
8012
  // User actions
7694
8013
  startConnection(port) {
7695
8014
  if (this.connectionType &&
@@ -9829,6 +10148,11 @@ class DiagramEditorComponent {
9829
10148
  constructor(configurationService, canvasProvider) {
9830
10149
  this.configurationService = configurationService;
9831
10150
  this.canvasProvider = canvasProvider;
10151
+ /**
10152
+ * Output for user events on the diagram's model.
10153
+ * @public
10154
+ */
10155
+ this.modelEvent = new EventEmitter();
9832
10156
  this.Corner = Corner;
9833
10157
  this.Side = Side;
9834
10158
  }
@@ -9839,7 +10163,7 @@ class DiagramEditorComponent {
9839
10163
  this.canvasProvider.initCanvasView(this.appendTo.nativeElement);
9840
10164
  }
9841
10165
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DiagramEditorComponent, deps: [{ token: DagaConfigurationService }, { token: CanvasProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
9842
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.2", type: DiagramEditorComponent, isStandalone: true, selector: "daga-diagram-editor", viewQueries: [{ propertyName: "appendTo", first: true, predicate: ["appendTo"], descendants: true }, { propertyName: "diagramButtons", first: true, predicate: ["diagramButtons"], descendants: true }, { propertyName: "palette", first: true, predicate: ["palette"], descendants: true }, { propertyName: "propertyEditor", first: true, predicate: ["propertyEditor"], descendants: true }], ngImport: i0, template: "<div class=\"append-to\" #appendTo></div>\n<daga-diagram-buttons\n *ngIf=\"config.components?.buttons?.exists !== false\"\n #diagramButtons\n [location]=\"config.components?.buttons?.location || Corner.BottomRight\"\n [direction]=\"config.components?.buttons?.direction || Side.Top\"\n [enableFilter]=\"config.components?.buttons?.enableFilter !== false\"\n [enableLayout]=\"config.components?.buttons?.enableLayout !== false\"\n [enableUndoRedo]=\"config.components?.buttons?.enableUndoRedo !== false\"\n [enableZoom]=\"config.components?.buttons?.enableZoom !== false\"\n [zoomRate]=\"config.components?.buttons?.zoomRate || 2\"\n/>\n<daga-palette\n *ngIf=\"\n config.components?.palette?.exists !== false &&\n config.components?.palette?.sections &&\n (config.components?.palette?.sections?.length || 0) > 0\n \"\n #palette\n [location]=\"config.components?.palette?.location || Corner.TopLeft\"\n [direction]=\"config.components?.palette?.direction || Side.Bottom\"\n [width]=\"config.components?.palette?.width || '12rem'\"\n [palettes]=\"config.components?.palette?.sections || []\"\n/>\n<daga-property-editor\n *ngIf=\"config.components?.propertyEditor?.exists !== false\"\n #propertyEditor\n [location]=\"config.components?.propertyEditor?.location || Corner.TopRight\"\n [direction]=\"config.components?.propertyEditor?.direction || Side.Bottom\"\n [width]=\"config.components?.propertyEditor?.width || '24rem'\"\n/>\n<daga-errors *ngIf=\"config.components?.errors?.exists !== false\" />\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DiagramButtonsComponent, selector: "daga-diagram-buttons", inputs: ["location", "direction", "enableFilter", "enableLayout", "enableUndoRedo", "enableZoom", "zoomRate"] }, { kind: "component", type: PaletteComponent, selector: "daga-palette", inputs: ["palettes", "currentPalette", "currentCategory", "location", "direction", "width"] }, { kind: "component", type: PropertyEditorComponent, selector: "daga-property-editor", inputs: ["location", "direction", "width", "valueSet"] }, { kind: "component", type: ErrorsComponent, selector: "daga-errors" }] }); }
10166
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.2", type: DiagramEditorComponent, isStandalone: true, selector: "daga-diagram-editor", outputs: { modelEvent: "modelEvent" }, viewQueries: [{ propertyName: "appendTo", first: true, predicate: ["appendTo"], descendants: true }, { propertyName: "diagramButtons", first: true, predicate: ["diagramButtons"], descendants: true }, { propertyName: "palette", first: true, predicate: ["palette"], descendants: true }, { propertyName: "propertyEditor", first: true, predicate: ["propertyEditor"], descendants: true }], ngImport: i0, template: "<div class=\"append-to\" #appendTo></div>\n<daga-diagram-buttons\n *ngIf=\"config.components?.buttons?.exists !== false\"\n #diagramButtons\n [location]=\"config.components?.buttons?.location || Corner.BottomRight\"\n [direction]=\"config.components?.buttons?.direction || Side.Top\"\n [enableFilter]=\"config.components?.buttons?.enableFilter !== false\"\n [enableLayout]=\"config.components?.buttons?.enableLayout !== false\"\n [enableUndoRedo]=\"config.components?.buttons?.enableUndoRedo !== false\"\n [enableZoom]=\"config.components?.buttons?.enableZoom !== false\"\n [zoomRate]=\"config.components?.buttons?.zoomRate || 2\"\n/>\n<daga-palette\n *ngIf=\"\n config.components?.palette?.exists !== false &&\n config.components?.palette?.sections &&\n (config.components?.palette?.sections?.length || 0) > 0\n \"\n #palette\n [location]=\"config.components?.palette?.location || Corner.TopLeft\"\n [direction]=\"config.components?.palette?.direction || Side.Bottom\"\n [width]=\"config.components?.palette?.width || '12rem'\"\n [palettes]=\"config.components?.palette?.sections || []\"\n/>\n<daga-property-editor\n *ngIf=\"config.components?.propertyEditor?.exists !== false\"\n #propertyEditor\n [location]=\"config.components?.propertyEditor?.location || Corner.TopRight\"\n [direction]=\"config.components?.propertyEditor?.direction || Side.Bottom\"\n [width]=\"config.components?.propertyEditor?.width || '24rem'\"\n/>\n<daga-errors *ngIf=\"config.components?.errors?.exists !== false\" />\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DiagramButtonsComponent, selector: "daga-diagram-buttons", inputs: ["location", "direction", "enableFilter", "enableLayout", "enableUndoRedo", "enableZoom", "zoomRate"] }, { kind: "component", type: PaletteComponent, selector: "daga-palette", inputs: ["palettes", "currentPalette", "currentCategory", "location", "direction", "width"] }, { kind: "component", type: PropertyEditorComponent, selector: "daga-property-editor", inputs: ["location", "direction", "width", "valueSet"] }, { kind: "component", type: ErrorsComponent, selector: "daga-errors" }] }); }
9843
10167
  }
9844
10168
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DiagramEditorComponent, decorators: [{
9845
10169
  type: Component,
@@ -9862,6 +10186,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
9862
10186
  }], propertyEditor: [{
9863
10187
  type: ViewChild,
9864
10188
  args: ['propertyEditor']
10189
+ }], modelEvent: [{
10190
+ type: Output
9865
10191
  }] } });
9866
10192
 
9867
10193
  /**
@@ -10201,5 +10527,5 @@ function now() {
10201
10527
  * Generated bundle index. Do not edit.
10202
10528
  */
10203
10529
 
10204
- export { ACTION_QUEUE_SIZE, ActionQueue, AddConnectionAction, AddNodeAction, AdjacencyLayout, BreadthAdjacencyLayout, BreadthLayout, CanvasProviderService, ClosedShape, CollabClient, CollapseButtonComponent, Corner, DagaConfigurationService, DagaExporter, DagaImporter, DagaModule, DiagramActions, DiagramButtonsComponent, DiagramCanvas, DiagramComponent, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramEditorComponent, DiagramElement, DiagramEntitySet, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramPort, DiagramPortSet, DiagramSection, DiagramSectionSet, EditFieldAction, ErrorsComponent, ForceLayout, HorizontalAlign, HorizontalLayout, LineShape, LineStyle, ObjectEditorComponent, PaletteComponent, PriorityLayout, Property, PropertyEditorComponent, PropertySet, RemoveAction, SetGeometryAction, Side, TextListEditorComponent, TextMapEditorComponent, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, layouts };
10530
+ export { ACTION_QUEUE_SIZE, ActionQueue, AddConnectionAction, AddNodeAction, AdjacencyLayout, BreadthAdjacencyLayout, BreadthLayout, CanvasProviderService, ClosedShape, CollabClient, CollapseButtonComponent, Corner, DagaConfigurationService, DagaExporter, DagaImporter, DagaModule, DiagramActions, DiagramButtonsComponent, DiagramCanvas, DiagramComponent, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramDecorator, DiagramDecoratorSet, DiagramEditorComponent, DiagramElement, DiagramEntitySet, DiagramEvent, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSection, DiagramSectionSet, EditFieldAction, ErrorsComponent, ForceLayout, HorizontalAlign, HorizontalLayout, LineShape, LineStyle, ObjectEditorComponent, PaletteComponent, PriorityLayout, Property, PropertyEditorComponent, PropertySet, RemoveAction, SetGeometryAction, Side, TextListEditorComponent, TextMapEditorComponent, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, layouts };
10205
10531
  //# sourceMappingURL=metadev-daga.mjs.map