@metadev/daga 1.3.1 → 1.4.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 +24 -0
- package/assets/styles/_diagram-buttons.scss +71 -37
- package/assets/styles/_palette.scss +12 -4
- package/assets/styles/_property-editor.scss +0 -3
- package/assets/styles/daga.scss +9 -5
- package/fesm2022/metadev-daga.mjs +3063 -2589
- package/fesm2022/metadev-daga.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/lib/diagram/diagram.component.d.ts +28 -3
- package/lib/diagram-buttons/diagram-buttons.component.d.ts +14 -3
- package/lib/diagram-editor/diagram/converters/daga-model.d.ts +5 -0
- package/lib/diagram-editor/diagram/diagram-action.d.ts +61 -10
- package/lib/diagram-editor/diagram/diagram-canvas.d.ts +25 -7
- package/lib/diagram-editor/diagram/diagram-config.d.ts +199 -41
- package/lib/diagram-editor/diagram/diagram-connection.d.ts +1 -0
- package/lib/diagram-editor/diagram/diagram-element.d.ts +10 -0
- package/lib/diagram-editor/diagram/diagram-field.d.ts +11 -4
- package/lib/diagram-editor/diagram/diagram-model.d.ts +0 -16
- package/lib/diagram-editor/diagram/diagram-node.d.ts +5 -4
- package/lib/diagram-editor/diagram/diagram-port.d.ts +1 -0
- package/lib/diagram-editor/diagram/diagram-section.d.ts +40 -8
- package/lib/diagram-editor/diagram-editor.component.d.ts +2 -1
- package/lib/interfaces/canvas.d.ts +42 -17
- package/lib/palette/palette.component.d.ts +8 -6
- package/lib/property-editor/property-editor.component.d.ts +9 -4
- package/lib/services/canvas-provider.service.d.ts +1 -1
- package/lib/services/daga-configuration.service.d.ts +1 -1
- package/lib/util/events.d.ts +5 -1
- package/lib/util/style.d.ts +13 -0
- package/lib/util/text-util.d.ts +2 -0
- package/package.json +1 -1
- package/assets/config/generic-diagram.json +0 -94
- package/assets/icon/connection/arrow.svg +0 -23
- package/assets/icon/connection/empty-arrow.svg +0 -19
- package/assets/icon/connection/empty-diamond.svg +0 -20
- package/assets/icon/connection/filled-arrow.svg +0 -19
- package/assets/icon/connection/filled-diamond.svg +0 -20
- package/assets/icon/connection/line.svg +0 -9
|
@@ -136,6 +136,7 @@ export declare class DiagramConnection extends DiagramElement {
|
|
|
136
136
|
setStart(start?: DiagramPort): void;
|
|
137
137
|
setEnd(end?: DiagramPort): void;
|
|
138
138
|
tighten(): void;
|
|
139
|
+
getPriority(): number;
|
|
139
140
|
}
|
|
140
141
|
export declare class DiagramConnectionSet extends DiagramEntitySet<DiagramConnection> {
|
|
141
142
|
private model;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as d3 from 'd3';
|
|
2
2
|
import { DiagramModel } from './diagram-model';
|
|
3
|
+
/**
|
|
4
|
+
* Default priority value for diagram elements.
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_PRIORITY = 0;
|
|
3
8
|
/**
|
|
4
9
|
* Represents an object which exists as part of a diagram model.
|
|
5
10
|
* @public
|
|
@@ -37,6 +42,11 @@ export declare abstract class DiagramElement implements DiagramEntity {
|
|
|
37
42
|
*/
|
|
38
43
|
selected: boolean;
|
|
39
44
|
constructor(model: DiagramModel, id: string);
|
|
45
|
+
/**
|
|
46
|
+
* Get the priority of this element to calculate whether it should be filtered out in the view or not.
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
abstract getPriority(): number;
|
|
40
50
|
/**
|
|
41
51
|
* Update the view of the canvas to show the current state of this element.
|
|
42
52
|
* @public
|
|
@@ -15,11 +15,12 @@ export declare const DIAGRAM_FIELD_DEFAULTS: {
|
|
|
15
15
|
fontSize: number;
|
|
16
16
|
margin: number;
|
|
17
17
|
padding: number;
|
|
18
|
-
fontFamily:
|
|
18
|
+
fontFamily: string;
|
|
19
19
|
color: string;
|
|
20
20
|
selectedColor: string;
|
|
21
21
|
horizontalAlign: HorizontalAlign;
|
|
22
22
|
verticalAlign: VerticalAlign;
|
|
23
|
+
fit: boolean;
|
|
23
24
|
};
|
|
24
25
|
/**
|
|
25
26
|
* A field which displays text and is part of a diagram element.
|
|
@@ -96,15 +97,21 @@ export declare class DiagramField extends DiagramElement {
|
|
|
96
97
|
* @public
|
|
97
98
|
*/
|
|
98
99
|
editable: boolean;
|
|
99
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Whether this field's size can adapt to the size of the text.
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
fit: boolean;
|
|
105
|
+
constructor(model: DiagramModel, rootElement: DiagramNode | DiagramSection | DiagramPort | undefined, coords: Point, width: number, height: number, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, fit: boolean, id?: string);
|
|
106
|
+
select(): d3.Selection<SVGGElement, unknown, null, unknown> | undefined;
|
|
100
107
|
updateInView(): void;
|
|
101
108
|
move(coords: Point): void;
|
|
102
|
-
|
|
109
|
+
getPriority(): number;
|
|
103
110
|
}
|
|
104
111
|
export declare class DiagramFieldSet extends DiagramEntitySet<DiagramField> {
|
|
105
112
|
private model;
|
|
106
113
|
constructor(model: DiagramModel);
|
|
107
|
-
new(rootElement: DiagramNode | DiagramSection | DiagramPort | undefined, coords: Point, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, id?: string | undefined): DiagramField;
|
|
114
|
+
new(rootElement: DiagramNode | DiagramSection | DiagramPort | undefined, coords: Point, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, fit: boolean, id?: string | undefined): DiagramField;
|
|
108
115
|
remove(id: string): void;
|
|
109
116
|
filter(threshold?: number): DiagramField[];
|
|
110
117
|
find(threshold?: number): DiagramField | undefined;
|
|
@@ -15,11 +15,6 @@ export declare class DiagramModel {
|
|
|
15
15
|
* @private
|
|
16
16
|
*/
|
|
17
17
|
canvas?: Canvas;
|
|
18
|
-
/**
|
|
19
|
-
* Whether changes to this model are updated in the canvas in real time.
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
renderToCanvas: boolean;
|
|
23
18
|
/**
|
|
24
19
|
* Nodes of this model.
|
|
25
20
|
* @see DiagramNode
|
|
@@ -86,17 +81,6 @@ export declare class DiagramModel {
|
|
|
86
81
|
*/
|
|
87
82
|
valueSet: ValueSet;
|
|
88
83
|
constructor(canvas: Canvas | undefined, id: string | undefined, name: string, description: string | undefined, type: string, properties?: Property[]);
|
|
89
|
-
/**
|
|
90
|
-
* Enables rendering to canvas in real time and updates the view of this model in the canvas.
|
|
91
|
-
* @public
|
|
92
|
-
*/
|
|
93
|
-
enableRenderToCanvas(): void;
|
|
94
|
-
/**
|
|
95
|
-
* Disables rendering to canvas in real time.
|
|
96
|
-
* Used to perform batches of changes to the model without the computational cost of rendering each change to the canvas individually.
|
|
97
|
-
* @public
|
|
98
|
-
*/
|
|
99
|
-
disableRenderToCanvas(): void;
|
|
100
84
|
/**
|
|
101
85
|
* Deletes everything in this diagram.
|
|
102
86
|
* @public
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
2
|
import { Side } from '../../util/svg-util';
|
|
3
|
-
import { FieldConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTypeConfig, PortConfig,
|
|
3
|
+
import { FieldConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTypeConfig, PortConfig, SectionGridConfig } from './diagram-config';
|
|
4
4
|
import { DiagramConnection } from './diagram-connection';
|
|
5
5
|
import { DiagramElement, DiagramEntity, DiagramEntitySet } from './diagram-element';
|
|
6
6
|
import { DiagramField } from './diagram-field';
|
|
@@ -29,7 +29,7 @@ export declare const DIAGRAM_NODE_TYPE_DEFAULTS: {
|
|
|
29
29
|
resizableY: boolean;
|
|
30
30
|
label: null;
|
|
31
31
|
ports: never[];
|
|
32
|
-
|
|
32
|
+
sectionGrid: null;
|
|
33
33
|
look: NodeShapedLook;
|
|
34
34
|
isUnique: boolean;
|
|
35
35
|
priority: number;
|
|
@@ -51,7 +51,7 @@ export declare class DiagramNodeType implements DiagramEntity {
|
|
|
51
51
|
resizableY: boolean;
|
|
52
52
|
label: FieldConfig | null;
|
|
53
53
|
ports: PortConfig[];
|
|
54
|
-
|
|
54
|
+
sectionGrid: SectionGridConfig | null;
|
|
55
55
|
look: NodeShapedLook | NodeImageLook | NodeStretchableImageLook;
|
|
56
56
|
isUnique: boolean;
|
|
57
57
|
priority: number;
|
|
@@ -115,6 +115,7 @@ export declare class DiagramNode extends DiagramElement {
|
|
|
115
115
|
set name(name: string);
|
|
116
116
|
constructor(model: DiagramModel, type: DiagramNodeType, coords?: Point, id?: string);
|
|
117
117
|
updateInView(): void;
|
|
118
|
+
getPriority(): number;
|
|
118
119
|
getClosestPortToPoint(coords: Point): DiagramPort | undefined;
|
|
119
120
|
getIncomingConnections(): DiagramConnection[];
|
|
120
121
|
getOutgoingConnections(): DiagramConnection[];
|
|
@@ -122,7 +123,7 @@ export declare class DiagramNode extends DiagramElement {
|
|
|
122
123
|
getAdjacentNodes(): DiagramNode[];
|
|
123
124
|
move(coords: Point): void;
|
|
124
125
|
stretch(direction: Side, distance: number): void;
|
|
125
|
-
stretchSections(direction: Side, distance: number,
|
|
126
|
+
stretchSections(direction: Side, distance: number, indexX: number, indexY: number): void;
|
|
126
127
|
}
|
|
127
128
|
export declare class DiagramNodeSet extends DiagramEntitySet<DiagramNode> {
|
|
128
129
|
private model;
|
|
@@ -59,6 +59,7 @@ export declare class DiagramPort extends DiagramElement {
|
|
|
59
59
|
startConnection(connection: DiagramConnection): void;
|
|
60
60
|
finishConnection(connection: DiagramConnection): void;
|
|
61
61
|
getNode(): DiagramNode | undefined;
|
|
62
|
+
getPriority(): number;
|
|
62
63
|
move(coords: Point): void;
|
|
63
64
|
distanceTo(coords: Point): number;
|
|
64
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
2
|
import { Side } from '../../util/svg-util';
|
|
3
|
-
import { NodeShapedLook } from './diagram-config';
|
|
3
|
+
import { NodeShapedLook, SectionConfig } from './diagram-config';
|
|
4
4
|
import { DiagramConnection } from './diagram-connection';
|
|
5
5
|
import { DiagramElement, DiagramEntitySet } from './diagram-element';
|
|
6
6
|
import { DiagramField } from './diagram-field';
|
|
@@ -19,15 +19,35 @@ export declare const DIAGRAM_SECTION_LOOK_DEFAULTS: NodeShapedLook;
|
|
|
19
19
|
* @private
|
|
20
20
|
*/
|
|
21
21
|
export declare const DIAGRAM_SECTION_DEFAULTS: {
|
|
22
|
-
sectionsX: number;
|
|
23
|
-
sectionsY: number;
|
|
24
|
-
minWidth: number;
|
|
25
|
-
minHeight: number;
|
|
26
|
-
margin: number;
|
|
27
22
|
label: null;
|
|
28
23
|
ports: never[];
|
|
29
24
|
look: NodeShapedLook;
|
|
25
|
+
priority: number;
|
|
30
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Default value of the default width of a diagram section.
|
|
29
|
+
* @see DiagramSection
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
export declare const DIAGRAM_SECTION_DEFAULT_WIDTH = 1;
|
|
33
|
+
/**
|
|
34
|
+
* Default value of the default height of a diagram section.
|
|
35
|
+
* @see DiagramSection
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
export declare const DIAGRAM_SECTION_DEFAULT_HEIGHT = 1;
|
|
39
|
+
/**
|
|
40
|
+
* Default value of the minimum width of a diagram section.
|
|
41
|
+
* @see DiagramSection
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
export declare const DIAGRAM_SECTION_MIN_WIDTH = 1;
|
|
45
|
+
/**
|
|
46
|
+
* Default value of the minimum height of a diagram section.
|
|
47
|
+
* @see DiagramSection
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
export declare const DIAGRAM_SECTION_MIN_HEIGHT = 1;
|
|
31
51
|
/**
|
|
32
52
|
* A section of a node which can have connections and display a property of the node.
|
|
33
53
|
* @see DiagramConnection
|
|
@@ -41,6 +61,14 @@ export declare class DiagramSection extends DiagramElement {
|
|
|
41
61
|
* @public
|
|
42
62
|
*/
|
|
43
63
|
node?: DiagramNode;
|
|
64
|
+
/**
|
|
65
|
+
* X index of this section in the parent node's section array.
|
|
66
|
+
*/
|
|
67
|
+
indexXInNode: number;
|
|
68
|
+
/**
|
|
69
|
+
* Y index of this section in the parent node's section array.
|
|
70
|
+
*/
|
|
71
|
+
indexYInNode: number;
|
|
44
72
|
/**
|
|
45
73
|
* Label of this section.
|
|
46
74
|
* @public
|
|
@@ -72,8 +100,12 @@ export declare class DiagramSection extends DiagramElement {
|
|
|
72
100
|
*/
|
|
73
101
|
get name(): string;
|
|
74
102
|
set name(name: string);
|
|
75
|
-
constructor(model: DiagramModel, node: DiagramNode | undefined, coords: Point, width: number, height: number, id?: string);
|
|
103
|
+
constructor(model: DiagramModel, node: DiagramNode | undefined, indexXInNode: number, indexYInNode: number, coords: Point, width: number, height: number, id?: string);
|
|
76
104
|
updateInView(): void;
|
|
105
|
+
getConfig(): SectionConfig | undefined;
|
|
106
|
+
getMinWidth(): number;
|
|
107
|
+
getMinHeight(): number;
|
|
108
|
+
getPriority(): number;
|
|
77
109
|
getClosestPortToPoint(coords: Point): DiagramPort | undefined;
|
|
78
110
|
getIncomingConnections(): DiagramConnection[];
|
|
79
111
|
getOutgoingConnections(): DiagramConnection[];
|
|
@@ -84,7 +116,7 @@ export declare class DiagramSection extends DiagramElement {
|
|
|
84
116
|
export declare class DiagramSectionSet extends DiagramEntitySet<DiagramSection> {
|
|
85
117
|
private model;
|
|
86
118
|
constructor(model: DiagramModel);
|
|
87
|
-
new(node: DiagramNode, coords: Point, width: number, height: number, id?: string | undefined, portIds?: (string | undefined)[], portLabelIds?: (string | undefined)[]): DiagramSection;
|
|
119
|
+
new(node: DiagramNode, indexXInNode: number, indexYInNode: number, coords: Point, width: number, height: number, id?: string | undefined, portIds?: (string | undefined)[], portLabelIds?: (string | undefined)[]): DiagramSection;
|
|
88
120
|
remove(id: string): void;
|
|
89
121
|
filter(threshold?: number): DiagramSection[];
|
|
90
122
|
find(threshold?: number): DiagramSection | undefined;
|
|
@@ -7,7 +7,7 @@ import { PaletteComponent } from '../palette/palette.component';
|
|
|
7
7
|
import { PropertyEditorComponent } from '../property-editor/property-editor.component';
|
|
8
8
|
import { CanvasProviderService } from '../services/canvas-provider.service';
|
|
9
9
|
import { DagaConfigurationService } from '../services/daga-configuration.service';
|
|
10
|
-
import { Corner } from '../util/svg-util';
|
|
10
|
+
import { Corner, Side } from '../util/svg-util';
|
|
11
11
|
import * as i0 from "@angular/core";
|
|
12
12
|
/**
|
|
13
13
|
* A diagram's user interface editor.
|
|
@@ -23,6 +23,7 @@ export declare class DiagramEditorComponent implements AfterViewInit, DiagramEdi
|
|
|
23
23
|
get config(): DiagramConfig;
|
|
24
24
|
get canvas(): Canvas;
|
|
25
25
|
Corner: typeof Corner;
|
|
26
|
+
Side: typeof Side;
|
|
26
27
|
constructor(configurationService: DagaConfigurationService, canvasProvider: CanvasProviderService);
|
|
27
28
|
ngOnInit(): void;
|
|
28
29
|
ngAfterViewInit(): void;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Subject } from 'rxjs';
|
|
2
|
-
import { ActionQueue } from '../diagram-editor/diagram/diagram-action';
|
|
2
|
+
import { ActionQueue, DiagramActions } from '../diagram-editor/diagram/diagram-action';
|
|
3
|
+
import { UserActionConfig } from '../diagram-editor/diagram/diagram-config';
|
|
3
4
|
import { DiagramConnectionType } from '../diagram-editor/diagram/diagram-connection';
|
|
4
5
|
import { DiagramElement } from '../diagram-editor/diagram/diagram-element';
|
|
5
6
|
import { DiagramModel } from '../diagram-editor/diagram/diagram-model';
|
|
6
7
|
import { DiagramValidator } from '../errors/diagram-validator';
|
|
7
8
|
import { Point } from '../util/canvas-util';
|
|
8
9
|
import { DiagramEditor } from './diagram-editor';
|
|
9
|
-
import {
|
|
10
|
+
import { ValueSet } from '../diagram-editor/diagram/diagram-property';
|
|
10
11
|
/**
|
|
11
12
|
* Provides the functionality for the visual representation of the elements of a model.
|
|
12
13
|
* @public
|
|
@@ -26,7 +27,7 @@ export interface Canvas {
|
|
|
26
27
|
* Background color of the diagram.
|
|
27
28
|
* @public
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
|
+
backgroundColor: string;
|
|
30
31
|
/**
|
|
31
32
|
* Distance between the grid points of the diagram.
|
|
32
33
|
* @public
|
|
@@ -47,16 +48,6 @@ export interface Canvas {
|
|
|
47
48
|
* @public
|
|
48
49
|
*/
|
|
49
50
|
connectionType?: DiagramConnectionType;
|
|
50
|
-
/**
|
|
51
|
-
* Elements below the priority threshold shouldn't be displayed.
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
priorityThreshold?: number;
|
|
55
|
-
/**
|
|
56
|
-
* Possible values that the priority threshold can take.
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
priorityThresholds: number[];
|
|
60
51
|
/**
|
|
61
52
|
* Identifier of the current layout format used by the diagram.
|
|
62
53
|
* @public
|
|
@@ -83,19 +74,20 @@ export interface Canvas {
|
|
|
83
74
|
*/
|
|
84
75
|
viewInitialized$: Subject<void>;
|
|
85
76
|
/**
|
|
86
|
-
* Subject for tracking when validators are added to the canvas.
|
|
77
|
+
* Subject for tracking when validators are added to or removed from the canvas.
|
|
87
78
|
* @public
|
|
88
79
|
*/
|
|
89
80
|
validatorChanges$: Subject<void>;
|
|
90
81
|
/**
|
|
91
82
|
* Subject for tracking changes in the diagram.
|
|
92
83
|
* Used to detect if there have been changes over a period of time.
|
|
84
|
+
* Values are sent when the user performs changes on the diagram, but not when the changes are performed programmatically.
|
|
93
85
|
* @public
|
|
94
86
|
*/
|
|
95
|
-
diagramChanges$: Subject<
|
|
87
|
+
diagramChanges$: Subject<void>;
|
|
96
88
|
/**
|
|
97
89
|
* Subject for tracking the presence of important changes in the diagram.
|
|
98
|
-
* Used to detect if there are any changes that require
|
|
90
|
+
* Used to detect if there are any changes that require immediate handling.
|
|
99
91
|
* @public
|
|
100
92
|
*/
|
|
101
93
|
diagramImportantChanges$: Subject<void>;
|
|
@@ -163,6 +155,22 @@ export interface Canvas {
|
|
|
163
155
|
* @public
|
|
164
156
|
*/
|
|
165
157
|
removeValidator(validator: DiagramValidator): void;
|
|
158
|
+
/**
|
|
159
|
+
* Get the possible priority thresholds of the diagram.
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
getPriorityThresholdOptions(): number[] | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* Get the current priority threshold of the diagram.
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
getPriorityThreshold(): number | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Changes the current priority threshold of the diagram.
|
|
170
|
+
* @public
|
|
171
|
+
* @param priority A priority threshold.
|
|
172
|
+
*/
|
|
173
|
+
setPriorityThreshold(priority: number): void;
|
|
166
174
|
/**
|
|
167
175
|
* Update the view of the canvas to show the current state of the model.
|
|
168
176
|
* @public
|
|
@@ -193,6 +201,16 @@ export interface Canvas {
|
|
|
193
201
|
* @public
|
|
194
202
|
*/
|
|
195
203
|
updateFieldsInView(...ids: string[]): void;
|
|
204
|
+
/**
|
|
205
|
+
* Fit the root of a diagram field to encompass the totality of the field.
|
|
206
|
+
* @param id The id of a diagram field
|
|
207
|
+
*/
|
|
208
|
+
fitFieldRootInView(id: string): void;
|
|
209
|
+
/**
|
|
210
|
+
* Fit a node to encompass the totality of its sections.
|
|
211
|
+
* @param id The id of a node
|
|
212
|
+
*/
|
|
213
|
+
fitNodeInView(id: string): void;
|
|
196
214
|
/**
|
|
197
215
|
* Get the d3 Selection containing the view of all the elements in the canvas.
|
|
198
216
|
* @private
|
|
@@ -245,9 +263,16 @@ export interface Canvas {
|
|
|
245
263
|
* @public
|
|
246
264
|
*/
|
|
247
265
|
cancelAllUserActions(): void;
|
|
266
|
+
/**
|
|
267
|
+
* Checks whether the user can perform the given action.
|
|
268
|
+
* @public
|
|
269
|
+
*/
|
|
270
|
+
canUserPerformAction(action: DiagramActions): boolean;
|
|
248
271
|
/**
|
|
249
272
|
* Sets the diagram element whose ValueSet is being displayed in the value set editor.
|
|
250
273
|
* @private
|
|
251
274
|
*/
|
|
252
|
-
setPropertyEditorSelection(selection?:
|
|
275
|
+
setPropertyEditorSelection(selection?: {
|
|
276
|
+
valueSet: ValueSet;
|
|
277
|
+
} & (DiagramElement | DiagramModel)): void;
|
|
253
278
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AfterContentInit, AfterViewInit, ElementRef } from '@angular/core';
|
|
2
2
|
import * as d3 from 'd3';
|
|
3
|
-
import {
|
|
3
|
+
import { PaletteSectionConfig } from '../diagram-editor/diagram/diagram-config';
|
|
4
4
|
import { Canvas } from '../interfaces/canvas';
|
|
5
5
|
import { Palette } from '../interfaces/palette';
|
|
6
6
|
import { CanvasProviderService } from '../services/canvas-provider.service';
|
|
7
|
-
import { Corner } from '../util/svg-util';
|
|
7
|
+
import { Corner, Side } from '../util/svg-util';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
9
|
/**
|
|
10
10
|
* Palette that the user can drag and drop nodes from.
|
|
@@ -16,16 +16,18 @@ export declare class PaletteComponent implements AfterContentInit, AfterViewInit
|
|
|
16
16
|
private canvasProvider;
|
|
17
17
|
get canvas(): Canvas;
|
|
18
18
|
panel: ElementRef<HTMLDivElement>;
|
|
19
|
-
palettes:
|
|
20
|
-
currentPalette:
|
|
19
|
+
palettes: PaletteSectionConfig[];
|
|
20
|
+
currentPalette: PaletteSectionConfig;
|
|
21
21
|
currentCategory: string;
|
|
22
22
|
location: Corner;
|
|
23
|
+
direction: Side;
|
|
24
|
+
width: string;
|
|
23
25
|
private priorityThreshold?;
|
|
24
26
|
constructor(canvasProvider: CanvasProviderService);
|
|
25
27
|
ngAfterContentInit(): void;
|
|
26
28
|
ngAfterViewInit(): void;
|
|
27
29
|
refreshPalette(): void;
|
|
28
|
-
switchPalette(palette:
|
|
30
|
+
switchPalette(palette: PaletteSectionConfig): void;
|
|
29
31
|
selectPanel(): d3.Selection<HTMLDivElement, unknown, null, undefined>;
|
|
30
32
|
selectPalette(): d3.Selection<HTMLDivElement, unknown, null, undefined>;
|
|
31
33
|
private appendCategories;
|
|
@@ -33,5 +35,5 @@ export declare class PaletteComponent implements AfterContentInit, AfterViewInit
|
|
|
33
35
|
private appendNodeTemplate;
|
|
34
36
|
private appendConnectionTemplate;
|
|
35
37
|
static ɵfac: i0.ɵɵFactoryDeclaration<PaletteComponent, never>;
|
|
36
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PaletteComponent, "daga-palette", never, { "palettes": { "alias": "palettes"; "required": false; }; "currentPalette": { "alias": "currentPalette"; "required": false; }; "currentCategory": { "alias": "currentCategory"; "required": false; }; "location": { "alias": "location"; "required": false; }; }, {}, never, never, true, never>;
|
|
38
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PaletteComponent, "daga-palette", never, { "palettes": { "alias": "palettes"; "required": false; }; "currentPalette": { "alias": "currentPalette"; "required": false; }; "currentCategory": { "alias": "currentCategory"; "required": false; }; "location": { "alias": "location"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "width": { "alias": "width"; "required": false; }; }, {}, never, never, true, never>;
|
|
37
39
|
}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
import { ChangeDetectorRef, ElementRef } from '@angular/core';
|
|
1
|
+
import { AfterViewInit, ChangeDetectorRef, ElementRef } from '@angular/core';
|
|
2
|
+
import * as d3 from 'd3';
|
|
2
3
|
import { ValueSet } from '../diagram-editor/diagram/diagram-property';
|
|
3
4
|
import { PropertyEditor } from '../interfaces/property-editor';
|
|
4
|
-
import { Corner } from '../util/svg-util';
|
|
5
|
+
import { Corner, Side } from '../util/svg-util';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
/**
|
|
7
8
|
* Editor of the values of a value set.
|
|
8
9
|
* @see ValueSet
|
|
9
10
|
* @private
|
|
10
11
|
*/
|
|
11
|
-
export declare class PropertyEditorComponent implements PropertyEditor {
|
|
12
|
+
export declare class PropertyEditorComponent implements AfterViewInit, PropertyEditor {
|
|
12
13
|
private cdr;
|
|
13
14
|
panel: ElementRef<HTMLDivElement>;
|
|
14
15
|
location: Corner;
|
|
16
|
+
direction: Side;
|
|
17
|
+
width: string;
|
|
15
18
|
title?: string;
|
|
16
19
|
_valueSet: ValueSet | undefined;
|
|
17
20
|
get valueSet(): ValueSet | undefined;
|
|
18
21
|
set valueSet(valueSet: ValueSet | undefined);
|
|
19
22
|
constructor(cdr: ChangeDetectorRef);
|
|
23
|
+
ngAfterViewInit(): void;
|
|
24
|
+
selectPanel(): d3.Selection<HTMLDivElement, unknown, null, undefined>;
|
|
20
25
|
highlightProperty(...propertyNames: string[]): void;
|
|
21
26
|
static ɵfac: i0.ɵɵFactoryDeclaration<PropertyEditorComponent, never>;
|
|
22
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PropertyEditorComponent, "daga-property-editor", never, { "location": { "alias": "location"; "required": false; }; "valueSet": { "alias": "valueSet"; "required": false; }; }, {}, never, never, true, never>;
|
|
27
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PropertyEditorComponent, "daga-property-editor", never, { "location": { "alias": "location"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "width": { "alias": "width"; "required": false; }; "valueSet": { "alias": "valueSet"; "required": false; }; }, {}, never, never, true, never>;
|
|
23
28
|
}
|
|
@@ -22,7 +22,7 @@ export declare class CanvasProviderService {
|
|
|
22
22
|
*/
|
|
23
23
|
initCanvasView(appendTo: HTMLElement): void;
|
|
24
24
|
/**
|
|
25
|
-
* Get the diagram canvas of this context.
|
|
25
|
+
* Get the diagram canvas of this context. Should only be called after the view of the {@link DiagramComponent} context has been initialized.
|
|
26
26
|
* @public
|
|
27
27
|
* @returns A diagram canvas.
|
|
28
28
|
*/
|
|
@@ -13,7 +13,7 @@ export declare class DagaConfigurationService {
|
|
|
13
13
|
*/
|
|
14
14
|
init(config: DiagramConfig): void;
|
|
15
15
|
/**
|
|
16
|
-
* Get the diagram configuration of this context.
|
|
16
|
+
* Get the diagram configuration of this context. Should only be called after the {@link DiagramComponent} context has been initialized.
|
|
17
17
|
* @public
|
|
18
18
|
* @returns A diagram configuration.
|
|
19
19
|
*/
|
package/lib/util/events.d.ts
CHANGED
|
@@ -7,11 +7,15 @@ export declare enum Events {
|
|
|
7
7
|
Change = "change",
|
|
8
8
|
Click = "click",
|
|
9
9
|
DoubleClick = "dblclick",
|
|
10
|
+
Focus = "focus",
|
|
11
|
+
FocusIn = "focusin",
|
|
12
|
+
FocusOut = "focusout",
|
|
10
13
|
Input = "input",
|
|
11
14
|
KeyUp = "keyup",
|
|
12
15
|
MouseMove = "mousemove",
|
|
13
16
|
MouseOut = "mouseout",
|
|
14
|
-
MouseOver = "mouseover"
|
|
17
|
+
MouseOver = "mouseover",
|
|
18
|
+
Wheel = "wheel"
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
17
21
|
* Keys in keyboard events.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum CursorStyle {
|
|
2
|
+
AllScroll = "all-scroll",
|
|
3
|
+
Auto = "auto",
|
|
4
|
+
EWResize = "ew-resize",
|
|
5
|
+
Grab = "grab",
|
|
6
|
+
Grabbing = "grabbing",
|
|
7
|
+
Move = "move",
|
|
8
|
+
NoDrop = "no-drop",
|
|
9
|
+
NSResize = "ns-resize",
|
|
10
|
+
NotAllowed = "not-allowed",
|
|
11
|
+
ZoomIn = "zoom-in",
|
|
12
|
+
ZoomOut = "zoom-out"
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metadev/daga",
|
|
3
3
|
"description": "Diagramming engine for editing models on the Web. Made by Metadev.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"author": "Metadev (https://metadev.pro)",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
7
|
"repository": "git+https://github.com/metadevpro/daga-tutorial.git",
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "generic-diagram",
|
|
3
|
-
"color": "#FFFFFF",
|
|
4
|
-
"gridSize": 50,
|
|
5
|
-
"snapToGrid": true,
|
|
6
|
-
"guessConnectionType": false,
|
|
7
|
-
"defaultConnection": "diagram-connection",
|
|
8
|
-
"palettes": [
|
|
9
|
-
{
|
|
10
|
-
"name": "",
|
|
11
|
-
"templates": [
|
|
12
|
-
{
|
|
13
|
-
"templateType": "node",
|
|
14
|
-
"type": "diagram-node",
|
|
15
|
-
"label": "Node"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"templateType": "connection",
|
|
19
|
-
"type": "diagram-connection",
|
|
20
|
-
"label": "",
|
|
21
|
-
"color": "white",
|
|
22
|
-
"icon": "/assets/daga/icon/connection/filled-arrow.svg",
|
|
23
|
-
"width": 150,
|
|
24
|
-
"height": 50
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
"nodeTypes": [
|
|
30
|
-
{
|
|
31
|
-
"id": "diagram-node",
|
|
32
|
-
"name": "Node",
|
|
33
|
-
"defaultWidth": 150,
|
|
34
|
-
"defaultHeight": 50,
|
|
35
|
-
"label": {
|
|
36
|
-
"fontSize": 20,
|
|
37
|
-
"margin": 10
|
|
38
|
-
},
|
|
39
|
-
"ports": [
|
|
40
|
-
{
|
|
41
|
-
"coords": [75, 0],
|
|
42
|
-
"direction": "top"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"coords": [0, 25],
|
|
46
|
-
"direction": "left"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"coords": [75, 50],
|
|
50
|
-
"direction": "bottom"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"coords": [150, 25],
|
|
54
|
-
"direction": "right"
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
"look": {
|
|
58
|
-
"lookType": "shaped-look",
|
|
59
|
-
"shape": "rectangle",
|
|
60
|
-
"color": "#FFFFFF",
|
|
61
|
-
"borderColor": "#000000",
|
|
62
|
-
"selectedColor": "#FFAAFF",
|
|
63
|
-
"selectedBorderColor": "#AA00AA"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
"connectionTypes": [
|
|
68
|
-
{
|
|
69
|
-
"id": "diagram-connection",
|
|
70
|
-
"name": "Connection",
|
|
71
|
-
"color": "#000000",
|
|
72
|
-
"selectedColor": "#AA00AA",
|
|
73
|
-
"width": 3,
|
|
74
|
-
"shape": "bezier",
|
|
75
|
-
"defaultEndMarkerLook": {
|
|
76
|
-
"image": "/assets/marker/arrow.svg",
|
|
77
|
-
"selectedImage": "/assets/marker/arrow.svg",
|
|
78
|
-
"markerWidth": 4,
|
|
79
|
-
"markerHeight": 8,
|
|
80
|
-
"markerRefX": 4,
|
|
81
|
-
"markerRefY": 4
|
|
82
|
-
},
|
|
83
|
-
"label": {
|
|
84
|
-
"color": "#FFFFFF",
|
|
85
|
-
"selectedColor": "#FFFFFF",
|
|
86
|
-
"fontSize": 12,
|
|
87
|
-
"padding": 6,
|
|
88
|
-
"margin": 20
|
|
89
|
-
},
|
|
90
|
-
"startTypes": ["diagram-node"],
|
|
91
|
-
"endTypes": ["diagram-node"]
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 150 50" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<line
|
|
3
|
-
x1="10"
|
|
4
|
-
y1="25"
|
|
5
|
-
x2="140"
|
|
6
|
-
y2="25"
|
|
7
|
-
stroke="black"
|
|
8
|
-
/>
|
|
9
|
-
<line
|
|
10
|
-
x1="120"
|
|
11
|
-
y1="5"
|
|
12
|
-
x2="140"
|
|
13
|
-
y2="25"
|
|
14
|
-
stroke="black"
|
|
15
|
-
/>
|
|
16
|
-
<line
|
|
17
|
-
x1="120"
|
|
18
|
-
y1="45"
|
|
19
|
-
x2="140"
|
|
20
|
-
y2="25"
|
|
21
|
-
stroke="black"
|
|
22
|
-
/>
|
|
23
|
-
</svg>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 150 50" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<line
|
|
3
|
-
x1="10"
|
|
4
|
-
y1="25"
|
|
5
|
-
x2="120"
|
|
6
|
-
y2="25"
|
|
7
|
-
stroke="black"
|
|
8
|
-
/>
|
|
9
|
-
<path
|
|
10
|
-
d="
|
|
11
|
-
M 140, 25
|
|
12
|
-
L 120, 5
|
|
13
|
-
L 120, 45
|
|
14
|
-
z
|
|
15
|
-
"
|
|
16
|
-
stroke="black"
|
|
17
|
-
fill="white"
|
|
18
|
-
/>
|
|
19
|
-
</svg>
|