@metadev/daga-angular 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +15 -1
- package/README.md +11 -1
- package/fesm2022/metadev-daga-angular.mjs +100 -78
- package/fesm2022/metadev-daga-angular.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/lib/diagram/diagram.component.d.ts +16 -5
- package/lib/diagram-editor/diagram-editor.component.d.ts +3 -8
- package/package.json +2 -2
package/Changelog.md
CHANGED
|
@@ -4,7 +4,21 @@ List of releases and changes.
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
## Next release
|
|
7
|
+
## Next release Joyeuse
|
|
8
|
+
|
|
9
|
+
## v. 3.1.0 Excalibur
|
|
10
|
+
|
|
11
|
+
Date: _2025-01-21_
|
|
12
|
+
|
|
13
|
+
- Add node continence [#200](https://github.com/metadevpro/daga/pull/200)
|
|
14
|
+
- Enable defining custom shape functions for nodes in the configuration [#206](https://github.com/metadevpro/daga/pull/206)
|
|
15
|
+
- Fix order of diagram elements [#208](https://github.com/metadevpro/daga/pull/208)
|
|
16
|
+
- 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)
|
|
17
|
+
- 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)
|
|
18
|
+
- 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)
|
|
19
|
+
- 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)
|
|
20
|
+
- Enable customizing the look of nodes in the palette [#216](https://github.com/metadevpro/daga/pull/216)
|
|
21
|
+
- Enable adding custom line shapes [#217](https://github.com/metadevpro/daga/pull/217)
|
|
8
22
|
|
|
9
23
|
## v. 3.0.0 Curtana
|
|
10
24
|
|
package/README.md
CHANGED
|
@@ -14,7 +14,17 @@ Made and comercial suport by [Metadev](https://metadev.pro).
|
|
|
14
14
|
|
|
15
15
|
## Requirements
|
|
16
16
|
|
|
17
|
-
- Angular
|
|
17
|
+
- Angular
|
|
18
|
+
|
|
19
|
+
### Compatibility Matrix
|
|
20
|
+
|
|
21
|
+
Please ensure you use a compatible Angular version with Daga version.
|
|
22
|
+
|
|
23
|
+
|Daga Version |Angular Version |
|
|
24
|
+
|---------:|-----:|
|
|
25
|
+
|3.x | 19.x |
|
|
26
|
+
|1.5 - 2.x | 18.x |
|
|
27
|
+
|1.x - 1.4 | 17.x |
|
|
18
28
|
|
|
19
29
|
## Build Daga
|
|
20
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Side, DiagramCanvas, DiagramActions, layouts, Events, setCursorStyle, CursorStyle, DragEvents, AddNodeAction, generalClosedPath, DIAGRAM_FIELD_DEFAULTS, getLeftMargin, getTopMargin, Type, Property, isObject, equals, Keys, Corner, DagaImporter, DagaExporter } from '@metadev/daga';
|
|
2
|
-
export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, DagaExporter, DagaImporter, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramDecorator, DiagramDecoratorSet, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSection, DiagramSectionSet, EditFieldAction, ForceLayout, HorizontalAlign, HorizontalLayout, LineShape, LineStyle, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, layouts } from '@metadev/daga';
|
|
1
|
+
import { Side, DiagramCanvas, DiagramActions, layouts, getLocationsOfNodes, ApplyLayoutAction, Events, setCursorStyle, CursorStyle, DragEvents, filterByOnlyDescendants, AddNodeAction, generalClosedPath, DIAGRAM_FIELD_DEFAULTS, getLeftMargin, getTopMargin, Type, Property, isObject, equals, Keys, Corner, DagaImporter, DagaExporter } from '@metadev/daga';
|
|
2
|
+
export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, EditFieldAction, ForceLayout, HorizontalAlign, HorizontalLayout, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, getLocationsOfNodes, layouts } from '@metadev/daga';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
@@ -254,7 +254,11 @@ class DiagramButtonsComponent {
|
|
|
254
254
|
}
|
|
255
255
|
layout() {
|
|
256
256
|
if (this.canvas.layoutFormat && this.canvas.layoutFormat in layouts) {
|
|
257
|
+
const from = getLocationsOfNodes(this.canvas.model);
|
|
257
258
|
layouts[this.canvas.layoutFormat].apply(this.canvas.model);
|
|
259
|
+
const to = getLocationsOfNodes(this.canvas.model);
|
|
260
|
+
const action = new ApplyLayoutAction(this.canvas, from, to);
|
|
261
|
+
this.canvas.actionStack.add(action);
|
|
258
262
|
}
|
|
259
263
|
}
|
|
260
264
|
filter() {
|
|
@@ -600,8 +604,21 @@ class PaletteComponent {
|
|
|
600
604
|
if (this.canvas.snapToGrid) {
|
|
601
605
|
newNodeCoords = this.canvas.getClosestGridPoint(newNodeCoords);
|
|
602
606
|
}
|
|
603
|
-
|
|
607
|
+
// check whether we dropped this node on a potential parent
|
|
608
|
+
const nodesAtLocation = this.canvas.model.nodes.getAtCoordinates(pointerCoords[0], pointerCoords[1]);
|
|
609
|
+
// filter by which nodes can have this type as a child
|
|
610
|
+
const nodesAtLocationWhichCanHaveNodeAsAChild = nodesAtLocation.filter((n) => n.type.childrenTypes.includes(type.id));
|
|
611
|
+
// filter by which nodes don't have descendants in this collection
|
|
612
|
+
const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
|
|
613
|
+
const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
|
|
614
|
+
if (!type.canBeParentless && droppedOn === undefined) {
|
|
615
|
+
// can't place, node must have a parent and no suitable parent has been found
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
const ancestor = droppedOn?.getLastAncestor();
|
|
619
|
+
const addNodeAction = new AddNodeAction(this.canvas, type, newNodeCoords, droppedOn?.id, ancestor?.id, ancestor?.getGeometry(), undefined, templateConfig.label, templateConfig.values);
|
|
604
620
|
addNodeAction.do();
|
|
621
|
+
addNodeAction.toAncestorGeometry = ancestor?.getGeometry();
|
|
605
622
|
this.canvas.actionStack.add(addNodeAction);
|
|
606
623
|
// reset cursor
|
|
607
624
|
setCursorStyle();
|
|
@@ -614,13 +631,14 @@ class PaletteComponent {
|
|
|
614
631
|
.style('top', 0)
|
|
615
632
|
.style('width', '100%')
|
|
616
633
|
.style('height', '100%');
|
|
617
|
-
|
|
634
|
+
const nodeLook = templateConfig.look || type.look;
|
|
635
|
+
switch (nodeLook.lookType) {
|
|
618
636
|
case 'shaped-look':
|
|
619
637
|
thisComponent
|
|
620
638
|
.append('path')
|
|
621
|
-
.attr('d', generalClosedPath(
|
|
622
|
-
.attr('fill',
|
|
623
|
-
.attr('stroke',
|
|
639
|
+
.attr('d', generalClosedPath(nodeLook.shape, 0, 0, type.defaultWidth, type.defaultHeight))
|
|
640
|
+
.attr('fill', nodeLook.fillColor)
|
|
641
|
+
.attr('stroke', nodeLook.borderColor)
|
|
624
642
|
.attr('stroke-width', '1px');
|
|
625
643
|
break;
|
|
626
644
|
case 'image-look':
|
|
@@ -630,7 +648,7 @@ class PaletteComponent {
|
|
|
630
648
|
.attr('y', 0)
|
|
631
649
|
.attr('width', type.defaultWidth)
|
|
632
650
|
.attr('height', type.defaultHeight)
|
|
633
|
-
.attr('href',
|
|
651
|
+
.attr('href', nodeLook.backgroundImage)
|
|
634
652
|
.attr('preserveAspectRatio', 'none');
|
|
635
653
|
break;
|
|
636
654
|
case 'stretchable-image-look':
|
|
@@ -638,73 +656,73 @@ class PaletteComponent {
|
|
|
638
656
|
.append('image')
|
|
639
657
|
.attr('x', 0)
|
|
640
658
|
.attr('y', 0)
|
|
641
|
-
.attr('width',
|
|
642
|
-
.attr('height',
|
|
643
|
-
.attr('href',
|
|
659
|
+
.attr('width', nodeLook.leftMargin)
|
|
660
|
+
.attr('height', nodeLook.topMargin)
|
|
661
|
+
.attr('href', nodeLook.backgroundImageTopLeft)
|
|
644
662
|
.attr('preserveAspectRatio', 'none');
|
|
645
663
|
thisComponent
|
|
646
664
|
.append('image')
|
|
647
|
-
.attr('x',
|
|
665
|
+
.attr('x', nodeLook.leftMargin)
|
|
648
666
|
.attr('y', 0)
|
|
649
|
-
.attr('width', type.defaultWidth -
|
|
650
|
-
.attr('height',
|
|
651
|
-
.attr('href',
|
|
667
|
+
.attr('width', type.defaultWidth - nodeLook.rightMargin - nodeLook.leftMargin)
|
|
668
|
+
.attr('height', nodeLook.topMargin)
|
|
669
|
+
.attr('href', nodeLook.backgroundImageTop)
|
|
652
670
|
.attr('preserveAspectRatio', 'none');
|
|
653
671
|
thisComponent
|
|
654
672
|
.append('image')
|
|
655
|
-
.attr('x', type.defaultWidth -
|
|
673
|
+
.attr('x', type.defaultWidth - nodeLook.rightMargin)
|
|
656
674
|
.attr('y', 0)
|
|
657
|
-
.attr('width',
|
|
658
|
-
.attr('height',
|
|
659
|
-
.attr('href',
|
|
675
|
+
.attr('width', nodeLook.rightMargin)
|
|
676
|
+
.attr('height', nodeLook.topMargin)
|
|
677
|
+
.attr('href', nodeLook.backgroundImageTopRight)
|
|
660
678
|
.attr('preserveAspectRatio', 'none');
|
|
661
679
|
thisComponent
|
|
662
680
|
.append('image')
|
|
663
681
|
.attr('x', 0)
|
|
664
|
-
.attr('y',
|
|
665
|
-
.attr('width',
|
|
666
|
-
.attr('height', type.defaultHeight -
|
|
667
|
-
.attr('href',
|
|
682
|
+
.attr('y', nodeLook.topMargin)
|
|
683
|
+
.attr('width', nodeLook.leftMargin)
|
|
684
|
+
.attr('height', type.defaultHeight - nodeLook.bottomMargin - nodeLook.topMargin)
|
|
685
|
+
.attr('href', nodeLook.backgroundImageLeft)
|
|
668
686
|
.attr('preserveAspectRatio', 'none');
|
|
669
687
|
thisComponent
|
|
670
688
|
.append('image')
|
|
671
|
-
.attr('x',
|
|
672
|
-
.attr('y',
|
|
673
|
-
.attr('width', type.defaultWidth -
|
|
674
|
-
.attr('height', type.defaultHeight -
|
|
675
|
-
.attr('href',
|
|
689
|
+
.attr('x', nodeLook.leftMargin)
|
|
690
|
+
.attr('y', nodeLook.topMargin)
|
|
691
|
+
.attr('width', type.defaultWidth - nodeLook.rightMargin - nodeLook.leftMargin)
|
|
692
|
+
.attr('height', type.defaultHeight - nodeLook.bottomMargin - nodeLook.topMargin)
|
|
693
|
+
.attr('href', nodeLook.backgroundImageCenter)
|
|
676
694
|
.attr('preserveAspectRatio', 'none');
|
|
677
695
|
thisComponent
|
|
678
696
|
.append('image')
|
|
679
|
-
.attr('x', type.defaultWidth -
|
|
680
|
-
.attr('y',
|
|
681
|
-
.attr('width',
|
|
682
|
-
.attr('height', type.defaultHeight -
|
|
683
|
-
.attr('href',
|
|
697
|
+
.attr('x', type.defaultWidth - nodeLook.rightMargin)
|
|
698
|
+
.attr('y', nodeLook.topMargin)
|
|
699
|
+
.attr('width', nodeLook.rightMargin)
|
|
700
|
+
.attr('height', type.defaultHeight - nodeLook.bottomMargin - nodeLook.topMargin)
|
|
701
|
+
.attr('href', nodeLook.backgroundImageRight)
|
|
684
702
|
.attr('preserveAspectRatio', 'none');
|
|
685
703
|
thisComponent
|
|
686
704
|
.append('image')
|
|
687
705
|
.attr('x', 0)
|
|
688
|
-
.attr('y', type.defaultHeight -
|
|
689
|
-
.attr('width',
|
|
690
|
-
.attr('height',
|
|
691
|
-
.attr('href',
|
|
706
|
+
.attr('y', type.defaultHeight - nodeLook.bottomMargin)
|
|
707
|
+
.attr('width', nodeLook.leftMargin)
|
|
708
|
+
.attr('height', nodeLook.bottomMargin)
|
|
709
|
+
.attr('href', nodeLook.backgroundImageBottomLeft)
|
|
692
710
|
.attr('preserveAspectRatio', 'none');
|
|
693
711
|
thisComponent
|
|
694
712
|
.append('image')
|
|
695
|
-
.attr('x',
|
|
696
|
-
.attr('y', type.defaultHeight -
|
|
697
|
-
.attr('width', type.defaultWidth -
|
|
698
|
-
.attr('height',
|
|
699
|
-
.attr('href',
|
|
713
|
+
.attr('x', nodeLook.leftMargin)
|
|
714
|
+
.attr('y', type.defaultHeight - nodeLook.bottomMargin)
|
|
715
|
+
.attr('width', type.defaultWidth - nodeLook.rightMargin - nodeLook.leftMargin)
|
|
716
|
+
.attr('height', nodeLook.bottomMargin)
|
|
717
|
+
.attr('href', nodeLook.backgroundImageBottom)
|
|
700
718
|
.attr('preserveAspectRatio', 'none');
|
|
701
719
|
thisComponent
|
|
702
720
|
.append('image')
|
|
703
|
-
.attr('x', type.defaultWidth -
|
|
704
|
-
.attr('y', type.defaultHeight -
|
|
705
|
-
.attr('width',
|
|
706
|
-
.attr('height',
|
|
707
|
-
.attr('href',
|
|
721
|
+
.attr('x', type.defaultWidth - nodeLook.rightMargin)
|
|
722
|
+
.attr('y', type.defaultHeight - nodeLook.bottomMargin)
|
|
723
|
+
.attr('width', nodeLook.rightMargin)
|
|
724
|
+
.attr('height', nodeLook.bottomMargin)
|
|
725
|
+
.attr('href', nodeLook.backgroundImageBottomRight)
|
|
708
726
|
.attr('preserveAspectRatio', 'none');
|
|
709
727
|
}
|
|
710
728
|
if (templateConfig.label) {
|
|
@@ -1554,8 +1572,6 @@ class ObjectEditorComponent {
|
|
|
1554
1572
|
if (property.editable) {
|
|
1555
1573
|
if (!equals(this.valueSet.getValue(property.name), value)) {
|
|
1556
1574
|
this.valueSet.setValue(property.name, value);
|
|
1557
|
-
// register a diagram change when editing a value
|
|
1558
|
-
this.canvas.diagramChange$?.next();
|
|
1559
1575
|
this.canvas.propertyEditorChanges$?.next();
|
|
1560
1576
|
}
|
|
1561
1577
|
}
|
|
@@ -1722,11 +1738,6 @@ class DiagramEditorComponent {
|
|
|
1722
1738
|
constructor(configurationService, canvasProvider) {
|
|
1723
1739
|
this.configurationService = configurationService;
|
|
1724
1740
|
this.canvasProvider = canvasProvider;
|
|
1725
|
-
/**
|
|
1726
|
-
* Output for user events on the diagram's model.
|
|
1727
|
-
* @public
|
|
1728
|
-
*/
|
|
1729
|
-
this.modelEvent = new EventEmitter();
|
|
1730
1741
|
this.Corner = Corner;
|
|
1731
1742
|
this.Side = Side;
|
|
1732
1743
|
}
|
|
@@ -1735,12 +1746,9 @@ class DiagramEditorComponent {
|
|
|
1735
1746
|
}
|
|
1736
1747
|
ngAfterViewInit() {
|
|
1737
1748
|
this.canvasProvider.initCanvasView(this.appendTo.nativeElement);
|
|
1738
|
-
this.canvas.diagramEvent$.subscribe((e) => {
|
|
1739
|
-
this.modelEvent.emit(e);
|
|
1740
|
-
});
|
|
1741
1749
|
}
|
|
1742
1750
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DiagramEditorComponent, deps: [{ token: DagaConfigurationService }, { token: CanvasProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1743
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: DiagramEditorComponent, isStandalone: true, selector: "daga-diagram-editor",
|
|
1751
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", 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=\"daga-append-to\" #appendTo></div>\r\n<daga-diagram-buttons\r\n *ngIf=\"\r\n config.components?.buttons !== undefined &&\r\n config.components?.buttons?.enabled !== false\r\n \"\r\n #diagramButtons\r\n [location]=\"config.components?.buttons?.location || Corner.BottomRight\"\r\n [direction]=\"config.components?.buttons?.direction || Side.Top\"\r\n [enableAction]=\"config.components?.buttons?.enableAction === true\"\r\n [enableFilter]=\"config.components?.buttons?.enableFilter === true\"\r\n [enableLayout]=\"config.components?.buttons?.enableLayout === true\"\r\n [enableSelection]=\"config.components?.buttons?.enableSelection === true\"\r\n [enableZoom]=\"config.components?.buttons?.enableZoom !== false\"\r\n/>\r\n<daga-palette\r\n *ngIf=\"\r\n config.components?.palette !== undefined &&\r\n config.components?.palette?.enabled !== false &&\r\n config.components?.palette?.sections &&\r\n (config.components?.palette?.sections?.length || 0) > 0\r\n \"\r\n #palette\r\n [location]=\"config.components?.palette?.location || Corner.TopLeft\"\r\n [direction]=\"config.components?.palette?.direction || Side.Bottom\"\r\n [width]=\"config.components?.palette?.width || '12rem'\"\r\n [gap]=\"config.components?.palette?.gap || '1rem'\"\r\n [palettes]=\"config.components?.palette?.sections || []\"\r\n/>\r\n<daga-property-editor\r\n *ngIf=\"\r\n config.components?.propertyEditor !== undefined &&\r\n config.components?.propertyEditor?.enabled !== false\r\n \"\r\n #propertyEditor\r\n [location]=\"config.components?.propertyEditor?.location || Corner.TopRight\"\r\n [direction]=\"config.components?.propertyEditor?.direction || Side.Bottom\"\r\n [width]=\"config.components?.propertyEditor?.width || '24rem'\"\r\n/>\r\n<daga-errors\r\n *ngIf=\"\r\n config.components?.errors !== undefined &&\r\n config.components?.errors?.enabled !== false\r\n \"\r\n/>\r\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", "enableAction", "enableFilter", "enableLayout", "enableSelection", "enableZoom"] }, { kind: "component", type: PaletteComponent, selector: "daga-palette", inputs: ["palettes", "currentPalette", "currentCategory", "location", "direction", "width", "gap"] }, { kind: "component", type: PropertyEditorComponent, selector: "daga-property-editor", inputs: ["location", "direction", "width", "valueSet"] }, { kind: "component", type: ErrorsComponent, selector: "daga-errors" }] }); }
|
|
1744
1752
|
}
|
|
1745
1753
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DiagramEditorComponent, decorators: [{
|
|
1746
1754
|
type: Component,
|
|
@@ -1763,8 +1771,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1763
1771
|
}], propertyEditor: [{
|
|
1764
1772
|
type: ViewChild,
|
|
1765
1773
|
args: ['propertyEditor']
|
|
1766
|
-
}], modelEvent: [{
|
|
1767
|
-
type: Output
|
|
1768
1774
|
}] } });
|
|
1769
1775
|
|
|
1770
1776
|
/**
|
|
@@ -1773,6 +1779,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1773
1779
|
* @public
|
|
1774
1780
|
*/
|
|
1775
1781
|
class DiagramComponent {
|
|
1782
|
+
/**
|
|
1783
|
+
* Getter for the canvas of this diagram.
|
|
1784
|
+
* @public
|
|
1785
|
+
*/
|
|
1786
|
+
get canvas() {
|
|
1787
|
+
return this.canvasProvider.getCanvas();
|
|
1788
|
+
}
|
|
1776
1789
|
/**
|
|
1777
1790
|
* Serialized model for the diagram. Used for data binding to the model.
|
|
1778
1791
|
* @public
|
|
@@ -1787,9 +1800,9 @@ class DiagramComponent {
|
|
|
1787
1800
|
set model(model) {
|
|
1788
1801
|
if (this._model !== model) {
|
|
1789
1802
|
this._model = model;
|
|
1790
|
-
const canvas = this.
|
|
1803
|
+
const canvas = this.canvas;
|
|
1791
1804
|
if (canvas) {
|
|
1792
|
-
this.importer.import(
|
|
1805
|
+
this.importer.import(canvas.model, model);
|
|
1793
1806
|
}
|
|
1794
1807
|
}
|
|
1795
1808
|
}
|
|
@@ -1803,44 +1816,52 @@ class DiagramComponent {
|
|
|
1803
1816
|
* @public
|
|
1804
1817
|
*/
|
|
1805
1818
|
this.modelChange = new EventEmitter();
|
|
1819
|
+
/**
|
|
1820
|
+
* Output for user events on the diagram.
|
|
1821
|
+
* @public
|
|
1822
|
+
*/
|
|
1823
|
+
this.diagramEvent = new EventEmitter();
|
|
1806
1824
|
}
|
|
1807
1825
|
ngOnInit() {
|
|
1808
1826
|
this.configurationService.init(this.config);
|
|
1809
1827
|
}
|
|
1810
|
-
ngAfterContentInit() {
|
|
1811
|
-
this.canvasProvider
|
|
1812
|
-
.getCanvas()
|
|
1813
|
-
.viewInitialized$.pipe(delay(1))
|
|
1814
|
-
.subscribe(() => {
|
|
1815
|
-
if (this.model) {
|
|
1816
|
-
this.importer.import(this.canvasProvider.getCanvas().model, this.model);
|
|
1817
|
-
}
|
|
1818
|
-
});
|
|
1819
|
-
}
|
|
1820
1828
|
ngAfterViewInit() {
|
|
1821
|
-
this.
|
|
1822
|
-
|
|
1829
|
+
const canvas = this.canvas;
|
|
1830
|
+
if (this.model) {
|
|
1831
|
+
this.importer.import(canvas.model, this.model);
|
|
1832
|
+
}
|
|
1833
|
+
canvas.diagramEvent$.subscribe((e) => {
|
|
1834
|
+
this.diagramEvent.emit(e);
|
|
1835
|
+
});
|
|
1836
|
+
canvas.diagramChange$.subscribe(() => {
|
|
1837
|
+
const exportedModel = this.exporter.export(this.canvas.model);
|
|
1823
1838
|
this._model = exportedModel;
|
|
1824
1839
|
this.modelChange.emit(exportedModel);
|
|
1825
1840
|
});
|
|
1826
1841
|
}
|
|
1827
1842
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DiagramComponent, deps: [{ token: DagaConfigurationService }, { token: CanvasProviderService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1828
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: DiagramComponent, isStandalone: true, selector: "daga-diagram", inputs: { config: "config", model: "model" }, outputs: { modelChange: "modelChange" }, providers: [CanvasProviderService, DagaConfigurationService], ngImport: i0, template: `<ng-content />`, isInline: true }); }
|
|
1843
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: DiagramComponent, isStandalone: true, selector: "daga-diagram", inputs: { config: "config", model: "model" }, outputs: { modelChange: "modelChange", diagramEvent: "diagramEvent" }, providers: [CanvasProviderService, DagaConfigurationService], viewQueries: [{ propertyName: "editor", first: true, predicate: DiagramEditorComponent, descendants: true }], ngImport: i0, template: `<daga-diagram-editor /><ng-content />`, isInline: true, dependencies: [{ kind: "component", type: DiagramEditorComponent, selector: "daga-diagram-editor" }] }); }
|
|
1829
1844
|
}
|
|
1830
1845
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DiagramComponent, decorators: [{
|
|
1831
1846
|
type: Component,
|
|
1832
1847
|
args: [{
|
|
1833
1848
|
standalone: true,
|
|
1834
1849
|
selector: 'daga-diagram',
|
|
1835
|
-
template: `<ng-content />`,
|
|
1836
|
-
providers: [CanvasProviderService, DagaConfigurationService]
|
|
1850
|
+
template: `<daga-diagram-editor /><ng-content />`,
|
|
1851
|
+
providers: [CanvasProviderService, DagaConfigurationService],
|
|
1852
|
+
imports: [DiagramEditorComponent]
|
|
1837
1853
|
}]
|
|
1838
|
-
}], ctorParameters: () => [{ type: DagaConfigurationService }, { type: CanvasProviderService }], propDecorators: {
|
|
1854
|
+
}], ctorParameters: () => [{ type: DagaConfigurationService }, { type: CanvasProviderService }], propDecorators: { editor: [{
|
|
1855
|
+
type: ViewChild,
|
|
1856
|
+
args: [DiagramEditorComponent]
|
|
1857
|
+
}], config: [{
|
|
1839
1858
|
type: Input
|
|
1840
1859
|
}], model: [{
|
|
1841
1860
|
type: Input
|
|
1842
1861
|
}], modelChange: [{
|
|
1843
1862
|
type: Output
|
|
1863
|
+
}], diagramEvent: [{
|
|
1864
|
+
type: Output
|
|
1844
1865
|
}] } });
|
|
1845
1866
|
|
|
1846
1867
|
class DagaModule {
|
|
@@ -1859,6 +1880,7 @@ class DagaModule {
|
|
|
1859
1880
|
FormsModule], exports: [DiagramComponent, DiagramEditorComponent] }); }
|
|
1860
1881
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DagaModule, providers: [DagaConfigurationService, CanvasProviderService], imports: [CollapseButtonComponent,
|
|
1861
1882
|
DiagramButtonsComponent,
|
|
1883
|
+
DiagramComponent,
|
|
1862
1884
|
DiagramEditorComponent,
|
|
1863
1885
|
ErrorsComponent,
|
|
1864
1886
|
ObjectEditorComponent,
|