@metadev/daga 3.1.4 → 4.0.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 +20 -0
- package/index.cjs.js +826 -367
- package/index.esm.js +826 -368
- package/package.json +1 -1
- package/src/index.d.ts +5 -3
- package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +26 -0
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +1 -3
- package/src/lib/diagram/{diagram-config.d.ts → config/diagram-config.d.ts} +93 -247
- package/src/lib/diagram/config/diagram-look.d.ts +220 -0
- package/src/lib/diagram/converters/daga-model.d.ts +2 -0
- package/src/lib/diagram/model/diagram-connection.d.ts +86 -26
- package/src/lib/diagram/model/diagram-decorator.d.ts +8 -1
- package/src/lib/diagram/model/diagram-element.d.ts +4 -0
- package/src/lib/diagram/model/diagram-field.d.ts +1 -1
- package/src/lib/diagram/model/diagram-node.d.ts +38 -8
- package/src/lib/diagram/model/diagram-object.d.ts +8 -1
- package/src/lib/diagram/model/diagram-port.d.ts +109 -9
- package/src/lib/diagram/model/diagram-property.d.ts +18 -3
- package/src/lib/diagram/model/diagram-section.d.ts +44 -20
- package/src/lib/interfaces/canvas.d.ts +1 -1
- package/src/lib/util/test-util.d.ts +1 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { LineFunction, LineShape, LineStyle } from '../../util/line';
|
|
2
|
+
import { ClosedShape, ShapeFunction } from '../../util/shape';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a configuration for a look into an easier to consult object of fully qualified looks for each case.
|
|
5
|
+
*
|
|
6
|
+
* @param lookConfig A look configuration object
|
|
7
|
+
* @returns An object with four keys for a look with each possible state of being selected or not and being highlighted or not.
|
|
8
|
+
*/
|
|
9
|
+
export declare const extractLooksFromConfig: <L extends Look>(lookConfig: LookConfig<L>) => {
|
|
10
|
+
defaultLook: L;
|
|
11
|
+
selectedLook: L;
|
|
12
|
+
highlightedLook: L;
|
|
13
|
+
selectedAndHighlightedLook: L;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A configuration object for a look, which consists of the look
|
|
17
|
+
* plus optional objects indicating which values are different
|
|
18
|
+
* when the object with this look is selected or highlighted.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export interface LookConfig<L extends Look> {
|
|
22
|
+
selected?: Partial<L>;
|
|
23
|
+
highlighted?: Partial<L>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Configuration object for a look given by a shape.
|
|
27
|
+
* @public
|
|
28
|
+
* @see ShapedLook
|
|
29
|
+
*/
|
|
30
|
+
export interface ShapedLookConfig extends ShapedLook, LookConfig<ShapedLook> {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Configuration object for a look given by an image.
|
|
34
|
+
* @public
|
|
35
|
+
* @see ImageLook
|
|
36
|
+
*/
|
|
37
|
+
export interface ImageLookConfig extends ImageLook, LookConfig<ImageLook> {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Configuration object for a look given by fixed size images in the corners and stretchable images in the middle.
|
|
41
|
+
* @public
|
|
42
|
+
* @see StretchableImageLook
|
|
43
|
+
*/
|
|
44
|
+
export interface StretchableImageLookConfig extends StretchableImageLook, LookConfig<StretchableImageLook> {
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for a look for the markers at the start and end of a connection given by an image.
|
|
48
|
+
* @public
|
|
49
|
+
* @see MarkerImageLook
|
|
50
|
+
*/
|
|
51
|
+
export interface MarkerImageLookConfig extends MarkerImageLook, LookConfig<MarkerImageLook> {
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Configuration for a look for a connection.
|
|
55
|
+
* @public
|
|
56
|
+
* @see MarkerImageLook
|
|
57
|
+
*/
|
|
58
|
+
export interface ConnectionLookConfig extends ConnectionLook, LookConfig<ConnectionLook> {
|
|
59
|
+
}
|
|
60
|
+
export interface Look {
|
|
61
|
+
/**
|
|
62
|
+
* String used to discern the type of look this is.
|
|
63
|
+
*/
|
|
64
|
+
lookType: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for a look given by a shape.
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
export interface ShapedLook extends Look {
|
|
71
|
+
lookType: 'shaped-look';
|
|
72
|
+
/**
|
|
73
|
+
* Shape of nodes using this look.
|
|
74
|
+
*/
|
|
75
|
+
shape: ClosedShape | ShapeFunction;
|
|
76
|
+
/**
|
|
77
|
+
* Background color of this look.
|
|
78
|
+
*/
|
|
79
|
+
fillColor: string;
|
|
80
|
+
/**
|
|
81
|
+
* Border color of this look.
|
|
82
|
+
*/
|
|
83
|
+
borderColor: string;
|
|
84
|
+
/**
|
|
85
|
+
* Border thickness of this look in diagram units.
|
|
86
|
+
*/
|
|
87
|
+
borderThickness: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Configuration for a look given by an image.
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
export interface ImageLook extends Look {
|
|
94
|
+
lookType: 'image-look';
|
|
95
|
+
/**
|
|
96
|
+
* File path to the background image used by this look.
|
|
97
|
+
*/
|
|
98
|
+
backgroundImage: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Configuration for a look given by fixed size images in the corners and stretchable images in the middle.
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
export interface StretchableImageLook extends Look {
|
|
105
|
+
lookType: 'stretchable-image-look';
|
|
106
|
+
/**
|
|
107
|
+
* Width taken up by the images at the left of the look in diagram units.
|
|
108
|
+
*/
|
|
109
|
+
leftMargin: number;
|
|
110
|
+
/**
|
|
111
|
+
* Width taken up by the images at the right of the look in diagram units.
|
|
112
|
+
*/
|
|
113
|
+
rightMargin: number;
|
|
114
|
+
/**
|
|
115
|
+
* Width taken up by the images at the top of the look in diagram units.
|
|
116
|
+
*/
|
|
117
|
+
topMargin: number;
|
|
118
|
+
/**
|
|
119
|
+
* Width taken up by the images at the bottom of the look in diagram units.
|
|
120
|
+
*/
|
|
121
|
+
bottomMargin: number;
|
|
122
|
+
/**
|
|
123
|
+
* File path to the background image used at the top left of the look.
|
|
124
|
+
*/
|
|
125
|
+
backgroundImageTopLeft: string;
|
|
126
|
+
/**
|
|
127
|
+
* File path to the background image used at the top of the look.
|
|
128
|
+
*/
|
|
129
|
+
backgroundImageTop: string;
|
|
130
|
+
/**
|
|
131
|
+
* File path to the background image used at the top right of the look.
|
|
132
|
+
*/
|
|
133
|
+
backgroundImageTopRight: string;
|
|
134
|
+
/**
|
|
135
|
+
* File path to the background image used at the left of the look.
|
|
136
|
+
*/
|
|
137
|
+
backgroundImageLeft: string;
|
|
138
|
+
/**
|
|
139
|
+
* File path to the background image used at the center of the look.
|
|
140
|
+
*/
|
|
141
|
+
backgroundImageCenter: string;
|
|
142
|
+
/**
|
|
143
|
+
* File path to the background image used at the right of the look.
|
|
144
|
+
*/
|
|
145
|
+
backgroundImageRight: string;
|
|
146
|
+
/**
|
|
147
|
+
* File path to the background image used at the bottom left of the look.
|
|
148
|
+
*/
|
|
149
|
+
backgroundImageBottomLeft: string;
|
|
150
|
+
/**
|
|
151
|
+
* File path to the background image used at the bottom of the look.
|
|
152
|
+
*/
|
|
153
|
+
backgroundImageBottom: string;
|
|
154
|
+
/**
|
|
155
|
+
* File path to the background image used at the bottom right of the look.
|
|
156
|
+
*/
|
|
157
|
+
backgroundImageBottomRight: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Configuration for a look for the markers at the start and end of a connection given by an image.
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
163
|
+
export interface MarkerImageLook extends Look {
|
|
164
|
+
lookType: 'marker-image-look';
|
|
165
|
+
/**
|
|
166
|
+
* File path to the image used for the marker.
|
|
167
|
+
*/
|
|
168
|
+
image: string;
|
|
169
|
+
/**
|
|
170
|
+
* The width of the marker in diagram units.
|
|
171
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
172
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerWidth |markerWidth}
|
|
173
|
+
*/
|
|
174
|
+
width: number;
|
|
175
|
+
/**
|
|
176
|
+
* The height of the marker in diagram units.
|
|
177
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
178
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerHeight |markerHeight}
|
|
179
|
+
*/
|
|
180
|
+
height: number;
|
|
181
|
+
/**
|
|
182
|
+
* The x coordinate of the reference point of the image used for the marker.
|
|
183
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
184
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refX |refX}
|
|
185
|
+
*/
|
|
186
|
+
refX: number;
|
|
187
|
+
/**
|
|
188
|
+
* The y coordinate of the reference point of the image used for the marker.
|
|
189
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
190
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refY |refY}
|
|
191
|
+
*/
|
|
192
|
+
refY: number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Configuration for a look for a connection.
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
export interface ConnectionLook extends Look {
|
|
199
|
+
lookType: 'connection-look';
|
|
200
|
+
/**
|
|
201
|
+
* Color of the line of connections of this type.
|
|
202
|
+
* @default '#000000'
|
|
203
|
+
*/
|
|
204
|
+
color: string;
|
|
205
|
+
/**
|
|
206
|
+
* Thickness of the line of connections of this type in diagram units.
|
|
207
|
+
* @default 1
|
|
208
|
+
*/
|
|
209
|
+
thickness: number;
|
|
210
|
+
/**
|
|
211
|
+
* Shape of the line of connections of this type.
|
|
212
|
+
* @default 'straight'
|
|
213
|
+
*/
|
|
214
|
+
shape: LineShape | LineFunction;
|
|
215
|
+
/**
|
|
216
|
+
* Style of the line of connections of this type.
|
|
217
|
+
* @default 'solid'
|
|
218
|
+
*/
|
|
219
|
+
style: LineStyle;
|
|
220
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
|
-
import {
|
|
2
|
+
import { LineShape, LineStyle } from '../../util/line';
|
|
3
3
|
import { Side } from '../../util/svg-util';
|
|
4
|
-
import {
|
|
4
|
+
import { ConnectionTypeConfig, FieldConfig } from '../config/diagram-config';
|
|
5
|
+
import { ConnectionLook, ConnectionLookConfig, MarkerImageLook, MarkerImageLookConfig } from '../config/diagram-look';
|
|
5
6
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
6
7
|
import { DiagramEntity, DiagramEntitySet } from './diagram-entity';
|
|
7
8
|
import { DiagramModel } from './diagram-model';
|
|
@@ -14,16 +15,24 @@ import { PropertySet, ValueSet } from './diagram-property';
|
|
|
14
15
|
*/
|
|
15
16
|
export declare const DIAGRAM_CONNECTION_TYPE_DEFAULTS: {
|
|
16
17
|
name: string;
|
|
17
|
-
width: number;
|
|
18
|
-
shape: LineShape;
|
|
19
|
-
style: LineStyle;
|
|
20
18
|
label: null;
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
look: {
|
|
20
|
+
lookType: string;
|
|
21
|
+
color: string;
|
|
22
|
+
thickness: number;
|
|
23
|
+
shape: LineShape;
|
|
24
|
+
style: LineStyle;
|
|
25
|
+
selected: {
|
|
26
|
+
color: string;
|
|
27
|
+
};
|
|
28
|
+
highlighted: {
|
|
29
|
+
thickness: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
startMarkerLook: undefined;
|
|
33
|
+
endMarkerLook: undefined;
|
|
23
34
|
startTypes: never[];
|
|
24
35
|
endTypes: never[];
|
|
25
|
-
color: string;
|
|
26
|
-
selectedColor: string;
|
|
27
36
|
properties: never[];
|
|
28
37
|
};
|
|
29
38
|
/**
|
|
@@ -42,6 +51,13 @@ export declare const CAN_CONNECTIONS_SHARE_PORTS = true;
|
|
|
42
51
|
* Whether tightening connections is allowed.
|
|
43
52
|
*/
|
|
44
53
|
export declare const CAN_TIGHTEN_CONNECTIONS = true;
|
|
54
|
+
/**
|
|
55
|
+
* The types allowed for the look of the markers of a connection.
|
|
56
|
+
* @public
|
|
57
|
+
* @see Look
|
|
58
|
+
* @see DiagramConnection
|
|
59
|
+
*/
|
|
60
|
+
export type ConnectionMarkerLook = MarkerImageLook;
|
|
45
61
|
/**
|
|
46
62
|
* A connection type, which holds properties that connections of this type share in common.
|
|
47
63
|
* @public
|
|
@@ -50,16 +66,21 @@ export declare const CAN_TIGHTEN_CONNECTIONS = true;
|
|
|
50
66
|
export declare class DiagramConnectionType implements DiagramEntity {
|
|
51
67
|
id: string;
|
|
52
68
|
name: string;
|
|
53
|
-
width: number;
|
|
54
|
-
shape: LineShape | LineFunction;
|
|
55
|
-
style: LineStyle;
|
|
56
69
|
label: FieldConfig | null;
|
|
70
|
+
defaultLook: ConnectionLook;
|
|
71
|
+
selectedLook: ConnectionLook;
|
|
72
|
+
highlightedLook: ConnectionLook;
|
|
73
|
+
selectedAndHighlightedLook: ConnectionLook;
|
|
57
74
|
defaultStartMarkerLook: ConnectionMarkerLook | null;
|
|
75
|
+
selectedStartMarkerLook: ConnectionMarkerLook | null;
|
|
76
|
+
highlightedStartMarkerLook: ConnectionMarkerLook | null;
|
|
77
|
+
selectedAndHighlightedStartMarkerLook: ConnectionMarkerLook | null;
|
|
58
78
|
defaultEndMarkerLook: ConnectionMarkerLook | null;
|
|
79
|
+
selectedEndMarkerLook: ConnectionMarkerLook | null;
|
|
80
|
+
highlightedEndMarkerLook: ConnectionMarkerLook | null;
|
|
81
|
+
selectedAndHighlightedEndMarkerLook: ConnectionMarkerLook | null;
|
|
59
82
|
startTypes: string[];
|
|
60
83
|
endTypes: string[];
|
|
61
|
-
color: string;
|
|
62
|
-
selectedColor: string;
|
|
63
84
|
propertySet: PropertySet;
|
|
64
85
|
constructor(options: ConnectionTypeConfig);
|
|
65
86
|
canStartFromType(type: string): boolean;
|
|
@@ -71,7 +92,11 @@ export declare class DiagramConnectionType implements DiagramEntity {
|
|
|
71
92
|
* @see DiagramPort
|
|
72
93
|
*/
|
|
73
94
|
export declare class DiagramConnection extends DiagramElement {
|
|
74
|
-
|
|
95
|
+
private _type;
|
|
96
|
+
get type(): DiagramConnectionType;
|
|
97
|
+
set type(type: DiagramConnectionType);
|
|
98
|
+
get typeString(): string;
|
|
99
|
+
set typeString(typeString: string);
|
|
75
100
|
/**
|
|
76
101
|
* Additional properties of this connection.
|
|
77
102
|
* @public
|
|
@@ -97,11 +122,6 @@ export declare class DiagramConnection extends DiagramElement {
|
|
|
97
122
|
* @public
|
|
98
123
|
*/
|
|
99
124
|
startCoords: Point;
|
|
100
|
-
/**
|
|
101
|
-
* Look of the marker of this connection at the start, or `null` if the connection has no start marker.
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
startMarkerLook: ConnectionMarkerLook | null;
|
|
105
125
|
/**
|
|
106
126
|
* Port that this connection ends at.
|
|
107
127
|
* @public
|
|
@@ -117,11 +137,6 @@ export declare class DiagramConnection extends DiagramElement {
|
|
|
117
137
|
* @public
|
|
118
138
|
*/
|
|
119
139
|
endCoords: Point;
|
|
120
|
-
/**
|
|
121
|
-
* Look of the marker of this connection at the end, or `null` if the connection has no end marker.
|
|
122
|
-
* @public
|
|
123
|
-
*/
|
|
124
|
-
endMarkerLook: ConnectionMarkerLook | null;
|
|
125
140
|
/**
|
|
126
141
|
* Text at the start of this connection, or `''` if no text.
|
|
127
142
|
* @public
|
|
@@ -148,6 +163,51 @@ export declare class DiagramConnection extends DiagramElement {
|
|
|
148
163
|
*/
|
|
149
164
|
get name(): string;
|
|
150
165
|
set name(name: string);
|
|
166
|
+
private _defaultLook?;
|
|
167
|
+
private _selectedLook?;
|
|
168
|
+
private _highlightedLook?;
|
|
169
|
+
private _selectedAndHighlightedLook?;
|
|
170
|
+
/**
|
|
171
|
+
* Current look of the connection.
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
get look(): ConnectionLook;
|
|
175
|
+
/**
|
|
176
|
+
* Sets the look configuration of the connection to override the one determined by the type.
|
|
177
|
+
* `undefined` resets it to the one determined by the type.
|
|
178
|
+
* @private
|
|
179
|
+
*/
|
|
180
|
+
set look(look: ConnectionLookConfig | undefined);
|
|
181
|
+
private _defaultStartMarkerLook?;
|
|
182
|
+
private _selectedStartMarkerLook?;
|
|
183
|
+
private _highlightedStartMarkerLook?;
|
|
184
|
+
private _selectedAndHighlightedStartMarkerLook?;
|
|
185
|
+
/**
|
|
186
|
+
* Current look of the start marker.
|
|
187
|
+
* @private
|
|
188
|
+
*/
|
|
189
|
+
get startMarkerLook(): MarkerImageLook | null;
|
|
190
|
+
/**
|
|
191
|
+
* Sets the look configuration of the start marker to override the one determined by the type.
|
|
192
|
+
* `null` stands for no marker and `undefined` resets it to the one determined by the type.
|
|
193
|
+
* @private
|
|
194
|
+
*/
|
|
195
|
+
set startMarkerLook(startMarkerLook: MarkerImageLookConfig | null | undefined);
|
|
196
|
+
private _defaultEndMarkerLook?;
|
|
197
|
+
private _selectedEndMarkerLook?;
|
|
198
|
+
private _highlightedEndMarkerLook?;
|
|
199
|
+
private _selectedAndHighlightedEndMarkerLook?;
|
|
200
|
+
/**
|
|
201
|
+
* Current look of the end marker.
|
|
202
|
+
* @private
|
|
203
|
+
*/
|
|
204
|
+
get endMarkerLook(): MarkerImageLook | null;
|
|
205
|
+
/**
|
|
206
|
+
* Sets the look configuration of the end marker to override the one determined by the type.
|
|
207
|
+
* `null` stands for no marker and `undefined` resets it to the one determined by the type.
|
|
208
|
+
* @private
|
|
209
|
+
*/
|
|
210
|
+
set endMarkerLook(endMarkerLook: MarkerImageLookConfig | null | undefined);
|
|
151
211
|
constructor(model: DiagramModel, type: DiagramConnectionType, start: DiagramPort | undefined, end: DiagramPort | undefined, id: string);
|
|
152
212
|
get removed(): boolean;
|
|
153
213
|
updateInView(): void;
|
|
@@ -192,7 +252,7 @@ export declare class DiagramConnectionSet extends DiagramElementSet<DiagramConne
|
|
|
192
252
|
* @param type The type of the connection given as either the type itself or the id of the type.
|
|
193
253
|
* @param start The start port of the connection.
|
|
194
254
|
* @param end The end port of the connection.
|
|
195
|
-
* @param id The id of the connection.
|
|
255
|
+
* @param id The id of the connection. Cannot be an empty string.
|
|
196
256
|
* @returns The instanced connection.
|
|
197
257
|
*/
|
|
198
258
|
new(type: DiagramConnectionType | string, start: DiagramPort | undefined, end: DiagramPort | undefined, id: string): DiagramConnection;
|
|
@@ -57,7 +57,14 @@ export declare class DiagramDecoratorSet extends DiagramElementSet<DiagramDecora
|
|
|
57
57
|
constructor(model: DiagramModel);
|
|
58
58
|
/**
|
|
59
59
|
* Instance a new decorator and add it to this set.
|
|
60
|
-
* @
|
|
60
|
+
* @public
|
|
61
|
+
* @param coords The coordinates of the top left corner of the decorator in the diagram.
|
|
62
|
+
* @param width The dimension of the decorator along the x axis.
|
|
63
|
+
* @param height The dimension of the decorator along the y axis.
|
|
64
|
+
* @param priority The priority of the decorator. Used when filtering by priority.
|
|
65
|
+
* @param html The html contents of the decorator.
|
|
66
|
+
* @param id The id of the decorator. Cannot be an empty string.
|
|
67
|
+
* @returns The instanced decorator.
|
|
61
68
|
*/
|
|
62
69
|
new(rootElement: DiagramNode | DiagramSection | undefined, coords: Point, width: number, height: number, priority: number, html: string, id: string): DiagramDecorator;
|
|
63
70
|
remove(id: string): void;
|
|
@@ -20,6 +20,10 @@ export declare abstract class DiagramElement implements DiagramEntity {
|
|
|
20
20
|
*/
|
|
21
21
|
readonly model: DiagramModel;
|
|
22
22
|
private _id;
|
|
23
|
+
/**
|
|
24
|
+
* Identifier that uniquely identifies this element within its diagram model. Cannot be an empty string.
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
23
27
|
get id(): string;
|
|
24
28
|
/**
|
|
25
29
|
* Whether this diagram element is currently in the user highlight.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
2
|
import { HorizontalAlign, VerticalAlign } from '../../util/svg-util';
|
|
3
3
|
import { CollabTimestamp } from '../collab/primitives';
|
|
4
|
-
import { FieldConfig } from '../diagram-config';
|
|
4
|
+
import { FieldConfig } from '../config/diagram-config';
|
|
5
5
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
6
6
|
import { DiagramModel } from './diagram-model';
|
|
7
7
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
2
|
import { Side } from '../../util/svg-util';
|
|
3
3
|
import { CollabTimestamp } from '../collab/primitives';
|
|
4
|
-
import { FieldConfig,
|
|
4
|
+
import { FieldConfig, NodeTypeConfig, PortConfig } from '../config/diagram-config';
|
|
5
|
+
import { ImageLook, ImageLookConfig, ShapedLook, ShapedLookConfig, StretchableImageLook, StretchableImageLookConfig } from '../config/diagram-look';
|
|
5
6
|
import { DiagramConnection } from './diagram-connection';
|
|
6
7
|
import { DiagramDecorator } from './diagram-decorator';
|
|
7
8
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
@@ -10,13 +11,13 @@ import { DiagramField, LabeledElement } from './diagram-field';
|
|
|
10
11
|
import { DiagramModel } from './diagram-model';
|
|
11
12
|
import { DiagramPort } from './diagram-port';
|
|
12
13
|
import { PropertySet, ValueSet } from './diagram-property';
|
|
13
|
-
import { DiagramSection, DiagramSectionGeometry } from './diagram-section';
|
|
14
|
+
import { DiagramSection, DiagramSectionGeometry, DiagramSectionGrid } from './diagram-section';
|
|
14
15
|
/**
|
|
15
16
|
* Default values of the look of a diagram node.
|
|
16
17
|
* @private
|
|
17
18
|
* @see DIAGRAM_NODE_TYPE_DEFAULTS
|
|
18
19
|
*/
|
|
19
|
-
export declare const DIAGRAM_NODE_LOOK_DEFAULTS:
|
|
20
|
+
export declare const DIAGRAM_NODE_LOOK_DEFAULTS: ShapedLookConfig;
|
|
20
21
|
/**
|
|
21
22
|
* Default values of the parameters of a diagram node.
|
|
22
23
|
* @private
|
|
@@ -34,7 +35,7 @@ export declare const DIAGRAM_NODE_TYPE_DEFAULTS: {
|
|
|
34
35
|
label: null;
|
|
35
36
|
ports: never[];
|
|
36
37
|
sectionGrid: null;
|
|
37
|
-
look:
|
|
38
|
+
look: ShapedLookConfig;
|
|
38
39
|
isUnique: boolean;
|
|
39
40
|
canBeParentless: boolean;
|
|
40
41
|
childrenTypes: never[];
|
|
@@ -52,6 +53,13 @@ export type DiagramNodeGeometry = {
|
|
|
52
53
|
[childId: string]: DiagramNodeGeometry;
|
|
53
54
|
};
|
|
54
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* The types allowed for the look of a node.
|
|
58
|
+
* @public
|
|
59
|
+
* @see Look
|
|
60
|
+
* @see DiagramNode
|
|
61
|
+
*/
|
|
62
|
+
export type NodeLook = ShapedLook | ImageLook | StretchableImageLook;
|
|
55
63
|
/**
|
|
56
64
|
* A node type, which holds properties that nodes of this type share in common.
|
|
57
65
|
* @public
|
|
@@ -72,8 +80,11 @@ export declare class DiagramNodeType implements DiagramEntity {
|
|
|
72
80
|
topPadding: number;
|
|
73
81
|
label: FieldConfig | null;
|
|
74
82
|
ports: PortConfig[];
|
|
75
|
-
sectionGrid:
|
|
76
|
-
|
|
83
|
+
sectionGrid: DiagramSectionGrid | null;
|
|
84
|
+
defaultLook: NodeLook;
|
|
85
|
+
selectedLook: NodeLook;
|
|
86
|
+
highlightedLook: NodeLook;
|
|
87
|
+
selectedAndHighlightedLook: NodeLook;
|
|
77
88
|
isUnique: boolean;
|
|
78
89
|
canBeParentless: boolean;
|
|
79
90
|
childrenTypes: string[];
|
|
@@ -89,7 +100,11 @@ export declare class DiagramNodeType implements DiagramEntity {
|
|
|
89
100
|
* @see DiagramSection
|
|
90
101
|
*/
|
|
91
102
|
export declare class DiagramNode extends DiagramElement implements LabeledElement {
|
|
92
|
-
|
|
103
|
+
private _type;
|
|
104
|
+
get type(): DiagramNodeType;
|
|
105
|
+
set type(type: DiagramNodeType);
|
|
106
|
+
get typeString(): string;
|
|
107
|
+
set typeString(typeString: string);
|
|
93
108
|
/**
|
|
94
109
|
* Additional properties of this node.
|
|
95
110
|
* @public
|
|
@@ -156,6 +171,21 @@ export declare class DiagramNode extends DiagramElement implements LabeledElemen
|
|
|
156
171
|
*/
|
|
157
172
|
get name(): string;
|
|
158
173
|
set name(name: string);
|
|
174
|
+
private _defaultLook?;
|
|
175
|
+
private _selectedLook?;
|
|
176
|
+
private _highlightedLook?;
|
|
177
|
+
private _selectedAndHighlightedLook?;
|
|
178
|
+
/**
|
|
179
|
+
* Current look of this port.
|
|
180
|
+
* @private
|
|
181
|
+
*/
|
|
182
|
+
get look(): NodeLook;
|
|
183
|
+
/**
|
|
184
|
+
* Sets the look configuration of the look to override the one determined by the type.
|
|
185
|
+
* `undefined` resets it to the one determined by the type.
|
|
186
|
+
* @private
|
|
187
|
+
*/
|
|
188
|
+
set look(look: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined);
|
|
159
189
|
constructor(model: DiagramModel, type: DiagramNodeType, coords: Point | undefined, id: string);
|
|
160
190
|
get removed(): boolean;
|
|
161
191
|
updateInView(): void;
|
|
@@ -261,7 +291,7 @@ export declare class DiagramNodeSet extends DiagramElementSet<DiagramNode> {
|
|
|
261
291
|
* @public
|
|
262
292
|
* @param type The type of the node given as either the type itself or the id of the type.
|
|
263
293
|
* @param coords The coordinates of the top left corner of the node in the diagram.
|
|
264
|
-
* @param id The id of the node.
|
|
294
|
+
* @param id The id of the node. Cannot be an empty string.
|
|
265
295
|
* @returns The instanced node.
|
|
266
296
|
*/
|
|
267
297
|
new(type: DiagramNodeType | string, coords: Point, id: string): DiagramNode;
|
|
@@ -46,7 +46,14 @@ export declare class DiagramObjectSet extends DiagramElementSet<DiagramObject> {
|
|
|
46
46
|
constructor(model: DiagramModel);
|
|
47
47
|
/**
|
|
48
48
|
* Instance a new object and add it to this set.
|
|
49
|
-
* @
|
|
49
|
+
* @public
|
|
50
|
+
* @param coords The coordinates of the top left corner of the object in the diagram.
|
|
51
|
+
* @param width The dimension of the object along the x axis.
|
|
52
|
+
* @param height The dimension of the object along the y axis.
|
|
53
|
+
* @param priority The priority of the object. Used when filtering by priority.
|
|
54
|
+
* @param html The html contents of the object.
|
|
55
|
+
* @param id The id of the object. Cannot be an empty string.
|
|
56
|
+
* @returns The instanced object.
|
|
50
57
|
*/
|
|
51
58
|
new(coords: Point, width: number, height: number, priority: number, html: string, id: string): DiagramObject;
|
|
52
59
|
remove(id: string): void;
|