@metadev/daga 1.3.1 → 1.4.1

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.
Files changed (38) hide show
  1. package/Changelog.md +31 -0
  2. package/assets/styles/_diagram-buttons.scss +71 -37
  3. package/assets/styles/_palette.scss +12 -4
  4. package/assets/styles/_property-editor.scss +0 -3
  5. package/assets/styles/daga.scss +9 -5
  6. package/fesm2022/metadev-daga.mjs +3069 -2588
  7. package/fesm2022/metadev-daga.mjs.map +1 -1
  8. package/index.d.ts +1 -1
  9. package/lib/diagram/diagram.component.d.ts +28 -3
  10. package/lib/diagram-buttons/diagram-buttons.component.d.ts +14 -3
  11. package/lib/diagram-editor/diagram/converters/daga-model.d.ts +5 -0
  12. package/lib/diagram-editor/diagram/diagram-action.d.ts +61 -10
  13. package/lib/diagram-editor/diagram/diagram-canvas.d.ts +26 -7
  14. package/lib/diagram-editor/diagram/diagram-config.d.ts +199 -41
  15. package/lib/diagram-editor/diagram/diagram-connection.d.ts +1 -0
  16. package/lib/diagram-editor/diagram/diagram-element.d.ts +10 -0
  17. package/lib/diagram-editor/diagram/diagram-field.d.ts +11 -4
  18. package/lib/diagram-editor/diagram/diagram-model.d.ts +0 -16
  19. package/lib/diagram-editor/diagram/diagram-node.d.ts +5 -4
  20. package/lib/diagram-editor/diagram/diagram-port.d.ts +1 -0
  21. package/lib/diagram-editor/diagram/diagram-section.d.ts +40 -8
  22. package/lib/diagram-editor/diagram-editor.component.d.ts +2 -1
  23. package/lib/interfaces/canvas.d.ts +48 -17
  24. package/lib/palette/palette.component.d.ts +8 -6
  25. package/lib/property-editor/property-editor.component.d.ts +9 -4
  26. package/lib/services/canvas-provider.service.d.ts +1 -1
  27. package/lib/services/daga-configuration.service.d.ts +1 -1
  28. package/lib/util/events.d.ts +5 -1
  29. package/lib/util/style.d.ts +13 -0
  30. package/lib/util/text-util.d.ts +2 -0
  31. package/package.json +1 -1
  32. package/assets/config/generic-diagram.json +0 -94
  33. package/assets/icon/connection/arrow.svg +0 -23
  34. package/assets/icon/connection/empty-arrow.svg +0 -19
  35. package/assets/icon/connection/empty-diamond.svg +0 -20
  36. package/assets/icon/connection/filled-arrow.svg +0 -19
  37. package/assets/icon/connection/filled-diamond.svg +0 -20
  38. package/assets/icon/connection/line.svg +0 -9
package/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { DiagramModelExporter } from './lib/diagram-editor/diagram/converters/di
9
9
  export { DiagramModelImporter } from './lib/diagram-editor/diagram/converters/diagram-model-importer';
10
10
  export { ActionQueue, AddConnectionAction, AddNodeAction, DiagramAction, DiagramActions, EditFieldAction, MoveNodeAction, RemoveAction, StretchNodeAction, UpdateValuesAction } from './lib/diagram-editor/diagram/diagram-action';
11
11
  export { ACTION_QUEUE_SIZE, DiagramCanvas } from './lib/diagram-editor/diagram/diagram-canvas';
12
- export { ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, FieldConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteConfig, PortConfig, SectionConfig } from './lib/diagram-editor/diagram/diagram-config';
12
+ export { ButtonsComponentConfig, ComponentsConfig, ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, ErrorsComponentConfig, FieldConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteComponentConfig, PaletteSectionConfig, PortConfig, PropertyEditorComponentConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram-editor/diagram/diagram-config';
13
13
  export { DiagramConnection, DiagramConnectionSet, DiagramConnectionType } from './lib/diagram-editor/diagram/diagram-connection';
14
14
  export { DiagramElement, DiagramEntity, DiagramEntitySet } from './lib/diagram-editor/diagram/diagram-element';
15
15
  export { DiagramField, DiagramFieldSet } from './lib/diagram-editor/diagram/diagram-field';
@@ -1,4 +1,5 @@
1
- import { OnInit } from '@angular/core';
1
+ import { AfterContentInit, AfterViewInit, EventEmitter, OnInit } from '@angular/core';
2
+ import { DagaModel } from '../diagram-editor/diagram/converters/daga-model';
2
3
  import { DiagramConfig } from '../diagram-editor/diagram/diagram-config';
3
4
  import { CanvasProviderService } from '../services/canvas-provider.service';
4
5
  import { DagaConfigurationService } from '../services/daga-configuration.service';
@@ -8,12 +9,36 @@ import * as i0 from "@angular/core";
8
9
  * This component defines a {@link DagaConfigurationService} and a {@link CanvasProviderService}, which is shared by all the components within and allows accessing the configuration and the canvas of this component's diagram, respectively.
9
10
  * @public
10
11
  */
11
- export declare class DiagramComponent implements OnInit {
12
+ export declare class DiagramComponent implements AfterContentInit, AfterViewInit, OnInit {
12
13
  private configurationService;
13
14
  private canvasProvider;
15
+ /**
16
+ * Configuration for the diagram.
17
+ * @public
18
+ */
14
19
  config: DiagramConfig;
20
+ private importer;
21
+ private exporter;
22
+ private _model;
23
+ /**
24
+ * Serialized model for the diagram. Used for data binding to the model.
25
+ * @public
26
+ */
27
+ get model(): DagaModel;
28
+ /**
29
+ * Serialized model for the diagram. Used for data binding to the model.
30
+ * @public
31
+ */
32
+ set model(model: DagaModel);
33
+ /**
34
+ * Output for changes to the diagram's model.
35
+ * @public
36
+ */
37
+ modelChange: EventEmitter<DagaModel>;
15
38
  constructor(configurationService: DagaConfigurationService, canvasProvider: CanvasProviderService);
16
39
  ngOnInit(): void;
40
+ ngAfterContentInit(): void;
41
+ ngAfterViewInit(): void;
17
42
  static ɵfac: i0.ɵɵFactoryDeclaration<DiagramComponent, never>;
18
- static ɵcmp: i0.ɵɵComponentDeclaration<DiagramComponent, "daga-diagram", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, ["*"], true, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<DiagramComponent, "daga-diagram", never, { "config": { "alias": "config"; "required": false; }; "model": { "alias": "model"; "required": false; }; }, { "modelChange": "modelChange"; }, never, ["*"], true, never>;
19
44
  }
@@ -1,16 +1,20 @@
1
- import { ElementRef } from '@angular/core';
1
+ import { AfterViewInit, ElementRef } from '@angular/core';
2
+ import { DiagramActions } from '../diagram-editor/diagram/diagram-action';
2
3
  import { Canvas } from '../interfaces/canvas';
3
4
  import { DiagramButtons } from '../interfaces/diagram-buttons';
4
5
  import { CanvasProviderService } from '../services/canvas-provider.service';
6
+ import { Corner, Side } from '../util/svg-util';
5
7
  import * as i0 from "@angular/core";
6
8
  /**
7
9
  * Buttons used to trigger diagram functionalities by the user.
8
10
  * @private
9
11
  */
10
- export declare class DiagramButtonsComponent implements DiagramButtons {
12
+ export declare class DiagramButtonsComponent implements AfterViewInit, DiagramButtons {
11
13
  private canvasProvider;
12
14
  get canvas(): Canvas;
13
15
  collapsableButtons: ElementRef<HTMLDivElement>;
16
+ location: Corner;
17
+ direction: Side;
14
18
  enableFilter: boolean;
15
19
  enableLayout: boolean;
16
20
  enableUndoRedo: boolean;
@@ -19,7 +23,14 @@ export declare class DiagramButtonsComponent implements DiagramButtons {
19
23
  filterOn: boolean;
20
24
  collapsed: boolean;
21
25
  animationOngoing: boolean;
26
+ private sizeAttribute;
27
+ private transformFunction;
28
+ private transformOrigin;
29
+ private marginSide;
30
+ private collapsableButtonsSize;
31
+ DiagramActions: typeof DiagramActions;
22
32
  constructor(canvasProvider: CanvasProviderService);
33
+ ngAfterViewInit(): void;
23
34
  toggleCollapse(): Promise<void>;
24
35
  zoomIn(): void;
25
36
  zoomOut(): void;
@@ -29,5 +40,5 @@ export declare class DiagramButtonsComponent implements DiagramButtons {
29
40
  undo(): void;
30
41
  redo(): void;
31
42
  static ɵfac: i0.ɵɵFactoryDeclaration<DiagramButtonsComponent, never>;
32
- static ɵcmp: i0.ɵɵComponentDeclaration<DiagramButtonsComponent, "daga-diagram-buttons", never, { "enableFilter": { "alias": "enableFilter"; "required": false; }; "enableLayout": { "alias": "enableLayout"; "required": false; }; "enableUndoRedo": { "alias": "enableUndoRedo"; "required": false; }; "enableZoom": { "alias": "enableZoom"; "required": false; }; "zoomRate": { "alias": "zoomRate"; "required": false; }; }, {}, never, never, true, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<DiagramButtonsComponent, "daga-diagram-buttons", never, { "location": { "alias": "location"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "enableFilter": { "alias": "enableFilter"; "required": false; }; "enableLayout": { "alias": "enableLayout"; "required": false; }; "enableUndoRedo": { "alias": "enableUndoRedo"; "required": false; }; "enableZoom": { "alias": "enableZoom"; "required": false; }; "zoomRate": { "alias": "zoomRate"; "required": false; }; }, {}, never, never, true, never>;
33
44
  }
@@ -30,6 +30,8 @@ export interface DagaModel {
30
30
  label: string;
31
31
  }[];
32
32
  label: string;
33
+ indexXInNode: number;
34
+ indexYInNode: number;
33
35
  coords: Point;
34
36
  width: number;
35
37
  height: number;
@@ -61,4 +63,7 @@ export interface DagaModel {
61
63
  [key: string]: unknown;
62
64
  };
63
65
  }[];
66
+ data: {
67
+ [key: string]: unknown;
68
+ };
64
69
  }
@@ -13,6 +13,11 @@ import { DiagramSection } from './diagram-section';
13
13
  * @private
14
14
  */
15
15
  export declare class ActionQueue {
16
+ /**
17
+ * Canvas that this action queue belongs to.
18
+ * @private
19
+ */
20
+ canvas: Canvas;
16
21
  /**
17
22
  * Maximum number of actions that can be recorded simultaneously.
18
23
  * When new actions are added past this limit, older actions are removed.
@@ -29,7 +34,7 @@ export declare class ActionQueue {
29
34
  * @private
30
35
  */
31
36
  index: number;
32
- constructor(maximum: number);
37
+ constructor(canvas: Canvas, maximum: number);
33
38
  /**
34
39
  * Adds an action to the history.
35
40
  * @private
@@ -56,17 +61,63 @@ export interface DiagramAction {
56
61
  }
57
62
  /**
58
63
  * Enum listing the actions that can be taken by the user.
59
- * @private
64
+ * The actions can correspond to a DiagramAction that can be recorded in the action queue of a diagram or they may not correspond to any DiagramAction implementations.
65
+ * @public
60
66
  */
61
67
  export declare enum DiagramActions {
62
- AddConnectionAction = "add-connection",
63
- AddNodeAction = "add-node",
64
- EditFieldAction = "edit-field",
65
- MoveNodeAction = "move-node",
66
- RemoveAction = "remove",
67
- StretchNodeAction = "stretch-node",
68
- StretchSectionAction = "stretch-section",
69
- UpdateValuesAction = "update-values"
68
+ /**
69
+ * Action that corresponds to the addition of a connection.
70
+ * @see AddConnectionAction
71
+ * @public
72
+ */
73
+ AddConnection = "add-connection",
74
+ /**
75
+ * Action that corresponds to the addition of a node.
76
+ * @see AddNodeAction
77
+ * @public
78
+ */
79
+ AddNode = "add-node",
80
+ /**
81
+ * Action that corresponds to the edition of a field's text content.
82
+ * @see EditFieldAction
83
+ * @public
84
+ */
85
+ EditField = "edit-field",
86
+ /**
87
+ * Action that corresponds to moving a node.
88
+ * @see MoveNodeAction
89
+ * @public
90
+ */
91
+ MoveNode = "move-node",
92
+ /**
93
+ * Action that corresponds to removing elements.
94
+ * @see RemoveAction
95
+ * @public
96
+ */
97
+ Remove = "remove",
98
+ /**
99
+ * Action that corresponds to altering a node's dimensions.
100
+ * @see StretchNodeAction
101
+ * @public
102
+ */
103
+ StretchNode = "stretch-node",
104
+ /**
105
+ * Action that corresponds to altering a sections's dimensions.
106
+ * @see StretchSectionAction
107
+ * @public
108
+ */
109
+ StretchSection = "stretch-section",
110
+ /**
111
+ * Action that corresponds to changing the values of a value set.
112
+ * @see UpdateValuesAction
113
+ * @public
114
+ */
115
+ UpdateValues = "update-values",
116
+ /**
117
+ * Action that corresponds to changing the view point of a diagram by zooming or panning.
118
+ * @public
119
+ */
120
+ Zoom = "zoom"
70
121
  }
71
122
  /**
72
123
  * Action which consists of adding a node.
@@ -11,6 +11,7 @@ import { DiagramElement } from './diagram-element';
11
11
  import { DiagramModel } from './diagram-model';
12
12
  import { DiagramPort } from './diagram-port';
13
13
  import { ValueSet } from './diagram-property';
14
+ import { CursorStyle } from '../../util/style';
14
15
  /**
15
16
  * Thickness of the invisible path around a connection used to make it easier to click on, in pixels.
16
17
  * @private
@@ -37,13 +38,11 @@ export declare class DiagramCanvas implements Canvas {
37
38
  parentComponent: DiagramEditor;
38
39
  diagramRoot: HTMLElement;
39
40
  model: DiagramModel;
40
- color: string;
41
+ backgroundColor: string;
41
42
  gridSize: number;
42
43
  snapToGrid: boolean;
43
44
  guessConnectionType: boolean;
44
45
  connectionType?: DiagramConnectionType;
45
- priorityThreshold?: number;
46
- priorityThresholds: number[];
47
46
  validators: DiagramValidator[];
48
47
  layoutFormat?: string;
49
48
  userActions: {
@@ -54,22 +53,31 @@ export declare class DiagramCanvas implements Canvas {
54
53
  private backgroundPatternId;
55
54
  private zoomBehavior;
56
55
  private zoomTransform;
56
+ private priorityThreshold?;
57
+ private priorityThresholds;
57
58
  private mainUserHighlight?;
58
59
  private userHighlight;
59
60
  private userSelection;
60
61
  private propertyEditorSelection?;
61
62
  private propertyEditorValues?;
62
63
  private unfinishedConnection?;
64
+ /**
65
+ * Invisible path followed by an unfinished connection. Used for making unfinished connections stop before the cursor rather than stopping right at the cursor.
66
+ */
67
+ private unfinishedConnectionTracer?;
63
68
  private inputFieldContainer?;
64
69
  private draggingFrom;
65
70
  private currentAction?;
66
71
  viewInitialized$: Subject<void>;
67
72
  validatorChanges$: Subject<void>;
68
- diagramChanges$: Subject<number>;
73
+ diagramChanges$: Subject<void>;
69
74
  diagramImportantChanges$: Subject<void>;
70
75
  constructor(parentComponent: DiagramEditor, config: DiagramConfig);
71
76
  addValidator(validator: DiagramValidator): void;
72
77
  removeValidator(validator: DiagramValidator): void;
78
+ getPriorityThresholdOptions(): number[] | undefined;
79
+ getPriorityThreshold(): number | undefined;
80
+ setPriorityThreshold(priority: number): void;
73
81
  initView(appendTo: HTMLElement): void;
74
82
  zoomBy(zoom: number): void;
75
83
  zoomTo(zoom: number): void;
@@ -80,6 +88,7 @@ export declare class DiagramCanvas implements Canvas {
80
88
  private getEventHoldingCoordinates;
81
89
  getPointerLocationRelativeToCanvas(event: MouseEvent): Point;
82
90
  getPointerLocationRelativeToBody(event: MouseEvent): Point;
91
+ getPointerLocationRelativeToScreen(event: MouseEvent): Point;
83
92
  updateModelInView(): void;
84
93
  updateNodesInView(...ids: string[]): void;
85
94
  updateSectionsInView(...ids: string[]): void;
@@ -88,23 +97,33 @@ export declare class DiagramCanvas implements Canvas {
88
97
  updateFieldsInView(...ids: string[]): void;
89
98
  updateConnectionLabelsInView(connection: DiagramConnection): void;
90
99
  updateConnectionMarkersInView(connection: DiagramConnection): void;
100
+ fitFieldRootInView(id: string): void;
101
+ fitNodeInView(id: string): void;
91
102
  selectRoot(): d3.Selection<d3.BaseType, unknown, null, unknown>;
92
- selectCanvas(): d3.Selection<SVGGElement, unknown, null, unknown>;
93
103
  selectCanvasView(): d3.Selection<SVGGElement, unknown, null, unknown>;
104
+ selectCanvasElements(): d3.Selection<SVGGElement, unknown, null, unknown>;
105
+ selectCanvasNodes(): d3.Selection<SVGGElement, unknown, null, unknown>;
106
+ selectCanvasSections(): d3.Selection<SVGGElement, unknown, null, unknown>;
107
+ selectCanvasPorts(): d3.Selection<SVGGElement, unknown, null, unknown>;
108
+ selectCanvasConnections(): d3.Selection<SVGGElement, unknown, null, unknown>;
109
+ selectCanvasFields(): d3.Selection<SVGGElement, unknown, null, unknown>;
94
110
  startConnection(port: DiagramPort): void;
95
111
  finishConnection(port: DiagramPort): void;
96
112
  dropConnection(): void;
97
113
  highlight(element: DiagramElement): void;
98
114
  unhighlight(): void;
99
- setPropertyEditorSelection(selection?: DiagramElement & {
115
+ setPropertyEditorSelection(selection?: {
100
116
  valueSet: ValueSet;
101
- }): void;
117
+ } & (DiagramElement | DiagramModel)): void;
102
118
  isInUserSelection(selection: DiagramElement): boolean;
103
119
  addToUserSelection(selection: DiagramElement): void;
104
120
  removeFromUserSelection(selection: DiagramElement): void;
105
121
  toggleUserSelection(selection: DiagramElement): void;
106
122
  clearUserSelection(): void;
107
123
  cancelAllUserActions(): void;
124
+ canUserPerformAction(action: DiagramActions): boolean;
108
125
  private createInputField;
109
126
  private removeInputField;
127
+ private minimumSizeOfField;
110
128
  }
129
+ export declare const cursorStyle: (style?: CursorStyle) => void;