@metadev/daga 2.0.2 → 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 +25 -1
- package/README.md +11 -1
- package/index.cjs.js +1929 -1211
- package/index.esm.js +1917 -1208
- package/package.json +1 -1
- package/src/index.d.ts +27 -21
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +9 -12
- package/src/lib/diagram/collab/collab-action.d.ts +58 -2
- package/src/lib/diagram/converters/daga-model.d.ts +1 -0
- package/src/lib/diagram/diagram-action.d.ts +67 -4
- package/src/lib/diagram/diagram-config.d.ts +32 -4
- package/src/lib/diagram/diagram-event.d.ts +74 -8
- package/src/lib/diagram/layout/diagram-layout.d.ts +4 -0
- package/src/lib/diagram/model/diagram-connection.d.ts +3 -2
- package/src/lib/diagram/model/diagram-decorator.d.ts +1 -0
- package/src/lib/diagram/model/diagram-element.d.ts +5 -0
- package/src/lib/diagram/model/diagram-field.d.ts +7 -6
- package/src/lib/diagram/model/diagram-node.d.ts +71 -4
- package/src/lib/diagram/model/diagram-object.d.ts +1 -0
- package/src/lib/diagram/model/diagram-port.d.ts +3 -2
- package/src/lib/diagram/model/diagram-property.d.ts +3 -1
- package/src/lib/diagram/model/diagram-section.d.ts +3 -2
- package/src/lib/interfaces/canvas.d.ts +8 -11
- package/src/lib/util/events.d.ts +2 -0
- package/src/lib/util/line.d.ts +6 -1
- package/src/lib/util/shape.d.ts +6 -1
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -3,21 +3,23 @@ export { ACTION_STACK_SIZE, DiagramCanvas, setCursorStyle } from './lib/diagram/
|
|
|
3
3
|
export { DiagramContextMenu } from './lib/diagram/canvas/diagram-context-menu';
|
|
4
4
|
export { DiagramUserHighlight } from './lib/diagram/canvas/diagram-user-highlight';
|
|
5
5
|
export { DiagramUserSelection } from './lib/diagram/canvas/diagram-user-selection';
|
|
6
|
-
export { CollabAction, CollabActionSerialized } from './lib/diagram/collab/collab-action';
|
|
6
|
+
export type { CollabAction, CollabActionSerialized } from './lib/diagram/collab/collab-action';
|
|
7
7
|
export { CollabClient } from './lib/diagram/collab/collab-client';
|
|
8
|
-
export { CollabTimestamp, CollabTimestampSet } from './lib/diagram/collab/primitives';
|
|
8
|
+
export type { CollabTimestamp, CollabTimestampSet } from './lib/diagram/collab/primitives';
|
|
9
9
|
export { DagaExporter } from './lib/diagram/converters/daga-exporter';
|
|
10
10
|
export { DagaImporter } from './lib/diagram/converters/daga-importer';
|
|
11
|
-
export { DagaConnection, DagaModel, DagaNode, DagaPort, DagaSection } from './lib/diagram/converters/daga-model';
|
|
12
|
-
export { DiagramModelExporter } from './lib/diagram/converters/diagram-model-exporter';
|
|
13
|
-
export { DiagramModelImporter } from './lib/diagram/converters/diagram-model-importer';
|
|
14
|
-
export { ActionStack, AddConnectionAction, AddNodeAction,
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
11
|
+
export type { DagaConnection, DagaModel, DagaNode, DagaPort, DagaSection } from './lib/diagram/converters/daga-model';
|
|
12
|
+
export type { DiagramModelExporter } from './lib/diagram/converters/diagram-model-exporter';
|
|
13
|
+
export type { DiagramModelImporter } from './lib/diagram/converters/diagram-model-importer';
|
|
14
|
+
export { ActionStack, ApplyLayoutAction, MoveAction, PasteAction, SetParentAction, AddConnectionAction, AddNodeAction, DiagramActionMethod, DiagramActions, EditFieldAction, RemoveAction, SetGeometryAction, UpdateValuesAction } from './lib/diagram/diagram-action';
|
|
15
|
+
export type { DiagramAction } from './lib/diagram/diagram-action';
|
|
16
|
+
export type { ButtonsComponentConfig, CanvasConfig, ComponentsConfig, ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, ErrorsComponentConfig, FieldConfig, GridConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteComponentConfig, PaletteSectionConfig, PortConfig, PropertyEditorComponentConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram/diagram-config';
|
|
17
|
+
export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramSecondaryClickEvent } from './lib/diagram/diagram-event';
|
|
17
18
|
export { AdjacencyLayout } from './lib/diagram/layout/adjacency-layout';
|
|
18
19
|
export { BreadthAdjacencyLayout } from './lib/diagram/layout/breadth-adjacency-layout';
|
|
19
20
|
export { BreadthLayout } from './lib/diagram/layout/breadth-layout';
|
|
20
|
-
export {
|
|
21
|
+
export { layouts, getLocationsOfNodes } from './lib/diagram/layout/diagram-layout';
|
|
22
|
+
export type { DiagramLayout } from './lib/diagram/layout/diagram-layout';
|
|
21
23
|
export { ForceLayout } from './lib/diagram/layout/force-layout';
|
|
22
24
|
export { HorizontalLayout } from './lib/diagram/layout/horizontal-layout';
|
|
23
25
|
export { PriorityLayout } from './lib/diagram/layout/priority-layout';
|
|
@@ -26,22 +28,26 @@ export { VerticalLayout } from './lib/diagram/layout/vertical-layout';
|
|
|
26
28
|
export { DiagramConnection, DiagramConnectionSet, DiagramConnectionType } from './lib/diagram/model/diagram-connection';
|
|
27
29
|
export { DiagramDecorator, DiagramDecoratorSet } from './lib/diagram/model/diagram-decorator';
|
|
28
30
|
export { DiagramElement, DiagramElementSet } from './lib/diagram/model/diagram-element';
|
|
29
|
-
export {
|
|
31
|
+
export { DiagramEntitySet } from './lib/diagram/model/diagram-entity';
|
|
32
|
+
export type { DiagramEntity } from './lib/diagram/model/diagram-entity';
|
|
30
33
|
export { DIAGRAM_FIELD_DEFAULTS, DiagramField, DiagramFieldSet, getBottomMargin, getBottomPadding, getLeftMargin, getLeftPadding, getRightMargin, getRightPadding, getTopMargin, getTopPadding } from './lib/diagram/model/diagram-field';
|
|
31
34
|
export { DiagramModel } from './lib/diagram/model/diagram-model';
|
|
32
|
-
export { DiagramNode,
|
|
35
|
+
export { DiagramNode, DiagramNodeSet, DiagramNodeType, filterByOnlyAncestors, filterByOnlyDescendants } from './lib/diagram/model/diagram-node';
|
|
36
|
+
export type { DiagramNodeGeometry } from './lib/diagram/model/diagram-node';
|
|
33
37
|
export { DiagramObject, DiagramObjectSet } from './lib/diagram/model/diagram-object';
|
|
34
38
|
export { DiagramPort, DiagramPortSet } from './lib/diagram/model/diagram-port';
|
|
35
|
-
export { diff, equals, isObject,
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
39
|
+
export { diff, equals, isObject, Property, PropertySet, Type, ValueSet } from './lib/diagram/model/diagram-property';
|
|
40
|
+
export type { Option } from './lib/diagram/model/diagram-property';
|
|
41
|
+
export { DiagramSection, DiagramSectionSet } from './lib/diagram/model/diagram-section';
|
|
42
|
+
export type { DiagramSectionGeometry } from './lib/diagram/model/diagram-section';
|
|
43
|
+
export type { DiagramError } from './lib/errors/diagram-error';
|
|
44
|
+
export type { DiagramValidator } from './lib/errors/diagram-validator';
|
|
45
|
+
export type { Canvas } from './lib/interfaces/canvas';
|
|
46
|
+
export type { DiagramButtons } from './lib/interfaces/diagram-buttons';
|
|
47
|
+
export type { DiagramEditor } from './lib/interfaces/diagram-editor';
|
|
48
|
+
export type { Palette } from './lib/interfaces/palette';
|
|
49
|
+
export type { PropertyEditor } from './lib/interfaces/property-editor';
|
|
50
|
+
export type { Line, Point, Rectangle } from './lib/util/canvas-util';
|
|
45
51
|
export { DragEvents, Events, Keys, ZoomEvents } from './lib/util/events';
|
|
46
52
|
export { linePath, LineShape, LineStyle, lineStyleDasharray } from './lib/util/line';
|
|
47
53
|
export { addIfNotExists, removeIfExists } from './lib/util/list-util';
|
|
@@ -6,7 +6,7 @@ import { DiagramEditor } from '../../interfaces/diagram-editor';
|
|
|
6
6
|
import { Point } from '../../util/canvas-util';
|
|
7
7
|
import { CursorStyle } from '../../util/style';
|
|
8
8
|
import { CollabEngine } from '../collab/collab-engine';
|
|
9
|
-
import { ActionStack, DiagramActions } from '../diagram-action';
|
|
9
|
+
import { ActionStack, DiagramAction, DiagramActionMethod, DiagramActions } from '../diagram-action';
|
|
10
10
|
import { DiagramConfig } from '../diagram-config';
|
|
11
11
|
import { DiagramEvent } from '../diagram-event';
|
|
12
12
|
import { DiagramConnectionType } from '../model/diagram-connection';
|
|
@@ -49,7 +49,9 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
49
49
|
panRate: number;
|
|
50
50
|
inferConnectionType: boolean;
|
|
51
51
|
multipleSelectionOn: boolean;
|
|
52
|
-
|
|
52
|
+
private _connectionType?;
|
|
53
|
+
get connectionType(): DiagramConnectionType | undefined;
|
|
54
|
+
set connectionType(value: DiagramConnectionType | undefined);
|
|
53
55
|
layoutFormat?: string;
|
|
54
56
|
validators: DiagramValidator[];
|
|
55
57
|
userActions: {
|
|
@@ -73,10 +75,12 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
73
75
|
private currentAction?;
|
|
74
76
|
readonly viewInitialized$: Subject<void>;
|
|
75
77
|
readonly validatorChange$: Subject<void>;
|
|
76
|
-
readonly diagramChange$: Subject<
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
readonly diagramChange$: Subject<{
|
|
79
|
+
action: DiagramAction;
|
|
80
|
+
method: DiagramActionMethod;
|
|
81
|
+
}>;
|
|
79
82
|
readonly diagramEvent$: Subject<DiagramEvent>;
|
|
83
|
+
readonly propertyEditorChanges$: Subject<void>;
|
|
80
84
|
/**
|
|
81
85
|
* Constructs a canvas object.
|
|
82
86
|
* @public
|
|
@@ -117,13 +121,6 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
117
121
|
selectRoot(): d3.Selection<SVGElement, unknown, null, unknown>;
|
|
118
122
|
selectCanvasView(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
119
123
|
selectCanvasElements(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
120
|
-
selectCanvasNodes(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
121
|
-
selectCanvasSections(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
122
|
-
selectCanvasPorts(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
123
|
-
selectCanvasConnections(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
124
|
-
selectCanvasFields(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
125
|
-
selectCanvasObjects(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
126
|
-
selectCanvasDecorators(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
127
124
|
private startConnection;
|
|
128
125
|
private finishConnection;
|
|
129
126
|
private dropConnection;
|
|
@@ -32,7 +32,7 @@ export interface CollabAction {
|
|
|
32
32
|
/**
|
|
33
33
|
* @private
|
|
34
34
|
*/
|
|
35
|
-
export type CollabActionSerialized = AddNodeSerialized | MoveSerialized | SetGeometrySerialized | AddConnectionSerialized | EditFieldSerialized | UpdateValuesSerialized | SetSelfRemovedSerialized | PasteSerialized;
|
|
35
|
+
export type CollabActionSerialized = AddNodeSerialized | ApplyLayoutSerialized | MoveSerialized | SetGeometrySerialized | SetParentSerialized | AddConnectionSerialized | EditFieldSerialized | UpdateValuesSerialized | SetSelfRemovedSerialized | PasteSerialized;
|
|
36
36
|
/**
|
|
37
37
|
* @private
|
|
38
38
|
*/
|
|
@@ -41,6 +41,7 @@ export type AddNodeSerialized = {
|
|
|
41
41
|
id: string;
|
|
42
42
|
typeId: string;
|
|
43
43
|
coords: Point;
|
|
44
|
+
parentId?: string;
|
|
44
45
|
label?: string;
|
|
45
46
|
values?: {
|
|
46
47
|
[key: string]: unknown;
|
|
@@ -56,17 +57,46 @@ export declare class AddNodeCollabAction implements CollabAction {
|
|
|
56
57
|
readonly id: string;
|
|
57
58
|
readonly typeId: string;
|
|
58
59
|
readonly coords: Point;
|
|
60
|
+
readonly parentId?: string | undefined;
|
|
59
61
|
readonly label?: string | undefined;
|
|
60
62
|
readonly values?: {
|
|
61
63
|
[key: string]: unknown;
|
|
62
64
|
} | undefined;
|
|
63
|
-
constructor(canvas: Canvas, id: string, typeId: string, coords: Point, label?: string | undefined, values?: {
|
|
65
|
+
constructor(canvas: Canvas, id: string, typeId: string, coords: Point, parentId?: string | undefined, label?: string | undefined, values?: {
|
|
64
66
|
[key: string]: unknown;
|
|
65
67
|
} | undefined);
|
|
66
68
|
do(): void;
|
|
67
69
|
serialize(): AddNodeSerialized;
|
|
68
70
|
static deserialize(canvas: Canvas, serialized: AddNodeSerialized): AddNodeCollabAction;
|
|
69
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
export type ApplyLayoutSerialized = {
|
|
76
|
+
type: 'applyLayout';
|
|
77
|
+
to: {
|
|
78
|
+
[key: string]: Point;
|
|
79
|
+
};
|
|
80
|
+
timestamp: CollabTimestamp;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Collaborative which consists of applying a layout to the diagram which can change the location of several nodes.
|
|
84
|
+
* @private
|
|
85
|
+
* @see ApplyLayoutAction
|
|
86
|
+
*/
|
|
87
|
+
export declare class ApplyLayoutCollabAction implements CollabAction {
|
|
88
|
+
readonly canvas: Canvas;
|
|
89
|
+
readonly to: {
|
|
90
|
+
[key: string]: Point;
|
|
91
|
+
};
|
|
92
|
+
readonly timestamp: CollabTimestamp;
|
|
93
|
+
constructor(canvas: Canvas, to: {
|
|
94
|
+
[key: string]: Point;
|
|
95
|
+
}, timestamp: CollabTimestamp);
|
|
96
|
+
do(): void;
|
|
97
|
+
serialize(): ApplyLayoutSerialized;
|
|
98
|
+
static deserialize(canvas: Canvas, serialized: ApplyLayoutSerialized): ApplyLayoutCollabAction;
|
|
99
|
+
}
|
|
70
100
|
/**
|
|
71
101
|
* @private
|
|
72
102
|
*/
|
|
@@ -115,6 +145,32 @@ export declare class SetGeometryCollabAction implements CollabAction {
|
|
|
115
145
|
serialize(): SetGeometrySerialized;
|
|
116
146
|
static deserialize(canvas: Canvas, serialized: SetGeometrySerialized): SetGeometryCollabAction;
|
|
117
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* @private
|
|
150
|
+
*/
|
|
151
|
+
export type SetParentSerialized = {
|
|
152
|
+
type: 'setParent';
|
|
153
|
+
childId: string;
|
|
154
|
+
parentId: string | undefined;
|
|
155
|
+
childGeometry: DiagramNodeGeometry;
|
|
156
|
+
timestamp: CollabTimestamp;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Collaborative action which consists of setting a node's parent.
|
|
160
|
+
* @private
|
|
161
|
+
* @see SetParentAction
|
|
162
|
+
*/
|
|
163
|
+
export declare class SetParentCollabAction implements CollabAction {
|
|
164
|
+
readonly canvas: Canvas;
|
|
165
|
+
readonly childId: string;
|
|
166
|
+
readonly parentId: string | undefined;
|
|
167
|
+
readonly childGeometry: DiagramNodeGeometry;
|
|
168
|
+
readonly timestamp: CollabTimestamp;
|
|
169
|
+
constructor(canvas: Canvas, childId: string, parentId: string | undefined, childGeometry: DiagramNodeGeometry, timestamp: CollabTimestamp);
|
|
170
|
+
do(): void;
|
|
171
|
+
serialize(): SetParentSerialized;
|
|
172
|
+
static deserialize(canvas: Canvas, serialized: SetParentSerialized): SetParentCollabAction;
|
|
173
|
+
}
|
|
118
174
|
/**
|
|
119
175
|
* @private
|
|
120
176
|
*/
|
|
@@ -4,7 +4,7 @@ import { DagaConnection, DagaNode } from './converters/daga-model';
|
|
|
4
4
|
import { DiagramConnectionType } from './model/diagram-connection';
|
|
5
5
|
import { DiagramNodeGeometry, DiagramNodeType } from './model/diagram-node';
|
|
6
6
|
/**
|
|
7
|
-
* A stack of recent actions taken by the user
|
|
7
|
+
* A stack of recent actions taken by the user.
|
|
8
8
|
* @private
|
|
9
9
|
*/
|
|
10
10
|
export declare class ActionStack {
|
|
@@ -47,7 +47,17 @@ export declare class ActionStack {
|
|
|
47
47
|
redo(): void;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* The different methods of an action.
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
export declare enum DiagramActionMethod {
|
|
54
|
+
Do = 0,
|
|
55
|
+
Undo = 1,
|
|
56
|
+
Redo = 2
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* An action taken by the user that can be undone and redone and implies a change to the diagram's model.
|
|
60
|
+
* Contrast with {@link DiagramEvent} which doesn't have an impact on the diagram's model.
|
|
51
61
|
* @private
|
|
52
62
|
*/
|
|
53
63
|
export interface DiagramAction {
|
|
@@ -92,6 +102,12 @@ export declare enum DiagramActions {
|
|
|
92
102
|
* @see AddNodeAction
|
|
93
103
|
*/
|
|
94
104
|
AddNode = "add-node",
|
|
105
|
+
/**
|
|
106
|
+
* Action that corresponds to applying a layout which changes the location of several nodes.
|
|
107
|
+
* @public
|
|
108
|
+
* @see ApplyLayoutAction
|
|
109
|
+
*/
|
|
110
|
+
ApplyLayout = "apply-layout",
|
|
95
111
|
/**
|
|
96
112
|
* Action that corresponds to copying diagram elements to the clipboard.
|
|
97
113
|
* @public
|
|
@@ -160,18 +176,43 @@ export declare class AddNodeAction implements DiagramAction {
|
|
|
160
176
|
readonly canvas: Canvas;
|
|
161
177
|
type: DiagramNodeType;
|
|
162
178
|
coords: Point;
|
|
179
|
+
parentId?: string;
|
|
180
|
+
ancestorId?: string | undefined;
|
|
181
|
+
fromAncestorGeometry?: DiagramNodeGeometry | undefined;
|
|
182
|
+
toAncestorGeometry?: DiagramNodeGeometry | undefined;
|
|
163
183
|
label?: string;
|
|
164
184
|
values?: {
|
|
165
185
|
[key: string]: unknown;
|
|
166
186
|
};
|
|
167
187
|
id: string;
|
|
168
|
-
constructor(canvas: Canvas, type: DiagramNodeType, coords: Point, label?: string, values?: {
|
|
188
|
+
constructor(canvas: Canvas, type: DiagramNodeType, coords: Point, parentId?: string, ancestorId?: string | undefined, fromAncestorGeometry?: DiagramNodeGeometry | undefined, toAncestorGeometry?: DiagramNodeGeometry | undefined, label?: string, values?: {
|
|
169
189
|
[key: string]: unknown;
|
|
170
190
|
});
|
|
171
191
|
do(): boolean;
|
|
172
192
|
undo(): boolean;
|
|
173
193
|
redo(): boolean;
|
|
174
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Action which consists of applying a layout to the diagram which can change the location of several nodes.
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
export declare class ApplyLayoutAction implements DiagramAction {
|
|
200
|
+
readonly canvas: Canvas;
|
|
201
|
+
from: {
|
|
202
|
+
[key: string]: Point;
|
|
203
|
+
};
|
|
204
|
+
to: {
|
|
205
|
+
[key: string]: Point;
|
|
206
|
+
};
|
|
207
|
+
constructor(canvas: Canvas, from: {
|
|
208
|
+
[key: string]: Point;
|
|
209
|
+
}, to: {
|
|
210
|
+
[key: string]: Point;
|
|
211
|
+
});
|
|
212
|
+
do(): boolean;
|
|
213
|
+
undo(): boolean;
|
|
214
|
+
redo(): boolean;
|
|
215
|
+
}
|
|
175
216
|
/**
|
|
176
217
|
* Action which consists of changing the coordinates of diagram elements by a fixed amount.
|
|
177
218
|
* @private
|
|
@@ -196,7 +237,29 @@ export declare class SetGeometryAction implements DiagramAction {
|
|
|
196
237
|
nodeId: string;
|
|
197
238
|
from: DiagramNodeGeometry;
|
|
198
239
|
to: DiagramNodeGeometry;
|
|
199
|
-
|
|
240
|
+
ancestorId: string | undefined;
|
|
241
|
+
fromAncestorGeometry: DiagramNodeGeometry | undefined;
|
|
242
|
+
toAncestorGeometry: DiagramNodeGeometry | undefined;
|
|
243
|
+
constructor(canvas: Canvas, intent: DiagramActions.MoveNode | DiagramActions.StretchNode | DiagramActions.StretchSection, nodeId: string, from: DiagramNodeGeometry, to: DiagramNodeGeometry, ancestorId?: string | undefined, fromAncestorGeometry?: DiagramNodeGeometry | undefined, toAncestorGeometry?: DiagramNodeGeometry | undefined);
|
|
244
|
+
do(): boolean;
|
|
245
|
+
undo(): boolean;
|
|
246
|
+
redo(): boolean;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Action which consists of setting a node's parent.
|
|
250
|
+
* @private
|
|
251
|
+
*/
|
|
252
|
+
export declare class SetParentAction implements DiagramAction {
|
|
253
|
+
readonly canvas: Canvas;
|
|
254
|
+
childId: string;
|
|
255
|
+
fromParentId: string | undefined;
|
|
256
|
+
toParentId: string | undefined;
|
|
257
|
+
fromChildGeometry: DiagramNodeGeometry;
|
|
258
|
+
toChildGeometry: DiagramNodeGeometry;
|
|
259
|
+
ancestorId: string | undefined;
|
|
260
|
+
fromAncestorGeometry: DiagramNodeGeometry | undefined;
|
|
261
|
+
toAncestorGeometry: DiagramNodeGeometry | undefined;
|
|
262
|
+
constructor(canvas: Canvas, childId: string, fromParentId: string | undefined, toParentId: string | undefined, fromChildGeometry: DiagramNodeGeometry, toChildGeometry: DiagramNodeGeometry, ancestorId: string | undefined, fromAncestorGeometry: DiagramNodeGeometry | undefined, toAncestorGeometry: DiagramNodeGeometry | undefined);
|
|
200
263
|
do(): boolean;
|
|
201
264
|
undo(): boolean;
|
|
202
265
|
redo(): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../util/canvas-util';
|
|
2
|
-
import { LineShape, LineStyle } from '../util/line';
|
|
3
|
-
import { ClosedShape } from '../util/shape';
|
|
2
|
+
import { LineFunction, LineShape, LineStyle } from '../util/line';
|
|
3
|
+
import { ClosedShape, ShapeFunction } from '../util/shape';
|
|
4
4
|
import { Corner, HorizontalAlign, Side, VerticalAlign } from '../util/svg-util';
|
|
5
5
|
import { DiagramActions } from './diagram-action';
|
|
6
6
|
import { Property } from './model/diagram-property';
|
|
@@ -262,6 +262,11 @@ export interface PaletteComponentConfig {
|
|
|
262
262
|
* @default '12rem'
|
|
263
263
|
*/
|
|
264
264
|
width?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Gap between the templates in this palette.
|
|
267
|
+
* @default '1rem'
|
|
268
|
+
*/
|
|
269
|
+
gap?: string;
|
|
265
270
|
/**
|
|
266
271
|
* Configuration for the sections of this palette. By default, no sections are created.
|
|
267
272
|
* @default undefined
|
|
@@ -330,6 +335,10 @@ export interface NodeTemplateConfig {
|
|
|
330
335
|
* Id of the type of node of this template. Must correspond to the id of a type of node defined in the nodeTypes list.
|
|
331
336
|
*/
|
|
332
337
|
type: string;
|
|
338
|
+
/**
|
|
339
|
+
* Look of this template as it appears on the palette which can be used to override the default look of the nodes of this type.
|
|
340
|
+
*/
|
|
341
|
+
look?: NodeShapedLook | NodeImageLook | NodeStretchableImageLook;
|
|
333
342
|
/**
|
|
334
343
|
* Label of this template as it appears on the palette and label that will be given to nodes created from this template.
|
|
335
344
|
*/
|
|
@@ -371,6 +380,10 @@ export interface ConnectionTemplateConfig {
|
|
|
371
380
|
* File path of the background image of this template as it appears on the palette.
|
|
372
381
|
*/
|
|
373
382
|
icon: string;
|
|
383
|
+
/**
|
|
384
|
+
* File path of the background image of this template as it appears on the palette when this connection type is selected.
|
|
385
|
+
*/
|
|
386
|
+
selectedIcon: string;
|
|
374
387
|
/**
|
|
375
388
|
* Width of this template in diagram units as it appears on the palette.
|
|
376
389
|
*/
|
|
@@ -424,6 +437,11 @@ export interface NodeTypeConfig {
|
|
|
424
437
|
* @default false
|
|
425
438
|
*/
|
|
426
439
|
resizableY?: boolean;
|
|
440
|
+
/**
|
|
441
|
+
* The padding between the node and its children in diagram units if children are present. May be a single value or an array, in which case the value is interpreted in the same way as in CSS padding.
|
|
442
|
+
* @default 0
|
|
443
|
+
*/
|
|
444
|
+
padding?: number | number[];
|
|
427
445
|
/**
|
|
428
446
|
* Configuration for the label of nodes of this type.
|
|
429
447
|
* @default null
|
|
@@ -449,6 +467,16 @@ export interface NodeTypeConfig {
|
|
|
449
467
|
* @default false
|
|
450
468
|
*/
|
|
451
469
|
isUnique?: boolean;
|
|
470
|
+
/**
|
|
471
|
+
* Whether nodes of this type can exist without being contained within another node.
|
|
472
|
+
* @default true
|
|
473
|
+
*/
|
|
474
|
+
canBeParentless?: boolean;
|
|
475
|
+
/**
|
|
476
|
+
* Ids of the types of nodes that can be contained within this node. Must correspond to the ids of types of node defined in the nodeTypes list.
|
|
477
|
+
* @default []
|
|
478
|
+
*/
|
|
479
|
+
childrenTypes?: string[];
|
|
452
480
|
/**
|
|
453
481
|
* The priority of this node when filtering out nodes below a given threshold.
|
|
454
482
|
* @default 0
|
|
@@ -612,7 +640,7 @@ export interface NodeShapedLook {
|
|
|
612
640
|
/**
|
|
613
641
|
* Shape of nodes using this look.
|
|
614
642
|
*/
|
|
615
|
-
shape: ClosedShape;
|
|
643
|
+
shape: ClosedShape | ShapeFunction;
|
|
616
644
|
/**
|
|
617
645
|
* Background color of nodes using this look.
|
|
618
646
|
*/
|
|
@@ -779,7 +807,7 @@ export interface ConnectionTypeConfig {
|
|
|
779
807
|
* Shape of the line of connections of this type.
|
|
780
808
|
* @default 'straight'
|
|
781
809
|
*/
|
|
782
|
-
shape?: LineShape;
|
|
810
|
+
shape?: LineShape | LineFunction;
|
|
783
811
|
/**
|
|
784
812
|
* Style of the line of connections of this type.
|
|
785
813
|
* @default 'solid'
|
|
@@ -1,16 +1,82 @@
|
|
|
1
1
|
import { Point } from '../util/canvas-util';
|
|
2
|
-
import { Events } from '../util/events';
|
|
3
2
|
import { DiagramElement } from './model/diagram-element';
|
|
4
3
|
/**
|
|
5
|
-
* Represents an action taken by the user on the diagram.
|
|
4
|
+
* Represents an action taken by the user on the diagram which doesn't have an impact on the diagram's model.
|
|
5
|
+
* Contrast with {@link DiagramAction} which does have an impact on the diagram's model.
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
|
-
export declare class DiagramEvent {
|
|
9
|
-
|
|
10
|
-
type: Events;
|
|
11
|
-
target?: DiagramElement;
|
|
12
|
-
coords?: Point;
|
|
8
|
+
export declare abstract class DiagramEvent {
|
|
9
|
+
readonly type: DiagramEvents;
|
|
13
10
|
defaultPrevented: boolean;
|
|
14
|
-
constructor(
|
|
11
|
+
constructor(type: DiagramEvents);
|
|
15
12
|
preventDefault(): void;
|
|
16
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Diagram user events.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare enum DiagramEvents {
|
|
19
|
+
DoubleClick = 0,
|
|
20
|
+
SecondaryClick = 1,
|
|
21
|
+
Selection = 2,
|
|
22
|
+
Highlight = 3
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Diagram event which consists of the user performing a double click on the diagram.
|
|
26
|
+
*/
|
|
27
|
+
export declare class DiagramDoubleClickEvent extends DiagramEvent {
|
|
28
|
+
cause: MouseEvent;
|
|
29
|
+
target: DiagramElement | null;
|
|
30
|
+
coords?: Point;
|
|
31
|
+
/**
|
|
32
|
+
* Create a diagram double click event.
|
|
33
|
+
*
|
|
34
|
+
* @param cause Mouse event which triggered this event.
|
|
35
|
+
* @param target Diagram element which is targeted by the event, or null if no element was targeted (the diagram background was targeted).
|
|
36
|
+
* @param coords Optionally, coordinates of the point of the diagram where the event happened.
|
|
37
|
+
*/
|
|
38
|
+
constructor(cause: MouseEvent, target: DiagramElement | null, coords?: Point);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Diagram event which consists of the user performing a secondary click on the diagram.
|
|
42
|
+
*/
|
|
43
|
+
export declare class DiagramSecondaryClickEvent extends DiagramEvent {
|
|
44
|
+
cause: MouseEvent;
|
|
45
|
+
target: DiagramElement | null;
|
|
46
|
+
coords?: Point;
|
|
47
|
+
/**
|
|
48
|
+
* Create a diagram secondary click event.
|
|
49
|
+
*
|
|
50
|
+
* @param cause Mouse event which triggered this event.
|
|
51
|
+
* @param target Diagram element which is targeted by the event, or null if no element was targeted (the diagram background was targeted).
|
|
52
|
+
* @param coords Optionally, coordinates of the point of the diagram where the event happened.
|
|
53
|
+
*/
|
|
54
|
+
constructor(cause: MouseEvent, target: DiagramElement | null, coords?: Point);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Diagram event which consists of the user either adding or removing one or several diagram elements from the user selection.
|
|
58
|
+
*/
|
|
59
|
+
export declare class DiagramSelectionEvent extends DiagramEvent {
|
|
60
|
+
targets: DiagramElement[];
|
|
61
|
+
selected: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Create a diagram selection event.
|
|
64
|
+
*
|
|
65
|
+
* @param targets Diagram elements which are targeted by the event.
|
|
66
|
+
* @param selected `true` if the targets were selected, `false` if the targets were deselected.
|
|
67
|
+
*/
|
|
68
|
+
constructor(targets: DiagramElement[], selected: boolean);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Diagram event which consists of the user highlighting a diagram element.
|
|
72
|
+
* If the target is `null`, that means that the previously highlighted element was unhighlighted.
|
|
73
|
+
*/
|
|
74
|
+
export declare class DiagramHighlightedEvent extends DiagramEvent {
|
|
75
|
+
target: DiagramElement | null;
|
|
76
|
+
/**
|
|
77
|
+
* Create a diagram highlight event.
|
|
78
|
+
*
|
|
79
|
+
* @param target Diagram element which is targeted by the event.
|
|
80
|
+
*/
|
|
81
|
+
constructor(target: DiagramElement | null);
|
|
82
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Point } from '../../util/canvas-util';
|
|
1
2
|
import { DiagramModel } from '../model/diagram-model';
|
|
2
3
|
/**
|
|
3
4
|
* A layout algorithm that can be applied to a diagram.
|
|
@@ -16,3 +17,6 @@ export interface DiagramLayout {
|
|
|
16
17
|
export declare const layouts: {
|
|
17
18
|
[key: string]: DiagramLayout;
|
|
18
19
|
};
|
|
20
|
+
export declare const getLocationsOfNodes: (model: DiagramModel) => {
|
|
21
|
+
[key: string]: Point;
|
|
22
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
|
-
import { LineShape, LineStyle } from '../../util/line';
|
|
2
|
+
import { LineFunction, LineShape, LineStyle } from '../../util/line';
|
|
3
3
|
import { Side } from '../../util/svg-util';
|
|
4
4
|
import { ConnectionMarkerLook, ConnectionTypeConfig, FieldConfig } from '../diagram-config';
|
|
5
5
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
@@ -51,7 +51,7 @@ export declare class DiagramConnectionType implements DiagramEntity {
|
|
|
51
51
|
id: string;
|
|
52
52
|
name: string;
|
|
53
53
|
width: number;
|
|
54
|
-
shape: LineShape;
|
|
54
|
+
shape: LineShape | LineFunction;
|
|
55
55
|
style: LineStyle;
|
|
56
56
|
label: FieldConfig | null;
|
|
57
57
|
defaultStartMarkerLook: ConnectionMarkerLook | null;
|
|
@@ -151,6 +151,7 @@ export declare class DiagramConnection extends DiagramElement {
|
|
|
151
151
|
constructor(model: DiagramModel, type: DiagramConnectionType, start: DiagramPort | undefined, end: DiagramPort | undefined, id: string);
|
|
152
152
|
get removed(): boolean;
|
|
153
153
|
updateInView(): void;
|
|
154
|
+
raise(): void;
|
|
154
155
|
/**
|
|
155
156
|
* Set the start of this connection to the given port or reset this connection's starting port if `undefined`.
|
|
156
157
|
* Add or remove this connection from the list of outgoing connections of ports correspondingly.
|
|
@@ -39,6 +39,7 @@ export declare class DiagramDecorator extends DiagramElement {
|
|
|
39
39
|
select(): d3.Selection<SVGGElement, unknown, null, unknown> | undefined;
|
|
40
40
|
get removed(): boolean;
|
|
41
41
|
updateInView(): void;
|
|
42
|
+
raise(): void;
|
|
42
43
|
/**
|
|
43
44
|
* Change the coordinates of this decorator to the given coordinates.
|
|
44
45
|
* @public
|
|
@@ -68,6 +68,11 @@ export declare abstract class DiagramElement implements DiagramEntity {
|
|
|
68
68
|
* @public
|
|
69
69
|
*/
|
|
70
70
|
abstract updateInView(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Put this element above other elements of its kind in the view.
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
abstract raise(): void;
|
|
71
76
|
/**
|
|
72
77
|
* Obtain the selection of this element.
|
|
73
78
|
* @private
|
|
@@ -4,9 +4,6 @@ import { CollabTimestamp } from '../collab/primitives';
|
|
|
4
4
|
import { FieldConfig } from '../diagram-config';
|
|
5
5
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
6
6
|
import { DiagramModel } from './diagram-model';
|
|
7
|
-
import { DiagramNode } from './diagram-node';
|
|
8
|
-
import { DiagramPort } from './diagram-port';
|
|
9
|
-
import { DiagramSection } from './diagram-section';
|
|
10
7
|
/**
|
|
11
8
|
* Default values of the parameters of a diagram field.
|
|
12
9
|
* @private
|
|
@@ -24,6 +21,9 @@ export declare const DIAGRAM_FIELD_DEFAULTS: {
|
|
|
24
21
|
verticalAlign: VerticalAlign;
|
|
25
22
|
fit: boolean;
|
|
26
23
|
};
|
|
24
|
+
export interface LabeledElement {
|
|
25
|
+
label?: DiagramField;
|
|
26
|
+
}
|
|
27
27
|
/**
|
|
28
28
|
* A field which displays text and is part of a diagram element.
|
|
29
29
|
* @public
|
|
@@ -36,7 +36,7 @@ export declare class DiagramField extends DiagramElement {
|
|
|
36
36
|
* Element that this field belongs to.
|
|
37
37
|
* @public
|
|
38
38
|
*/
|
|
39
|
-
rootElement?:
|
|
39
|
+
rootElement?: LabeledElement & DiagramElement;
|
|
40
40
|
/**
|
|
41
41
|
* Coordinates of this field.
|
|
42
42
|
* @public
|
|
@@ -109,10 +109,11 @@ export declare class DiagramField extends DiagramElement {
|
|
|
109
109
|
* @public
|
|
110
110
|
*/
|
|
111
111
|
fit: boolean;
|
|
112
|
-
constructor(model: DiagramModel, rootElement:
|
|
112
|
+
constructor(model: DiagramModel, rootElement: (LabeledElement & DiagramElement) | 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);
|
|
113
113
|
select(): d3.Selection<SVGGElement, unknown, null, unknown> | undefined;
|
|
114
114
|
get removed(): boolean;
|
|
115
115
|
updateInView(): void;
|
|
116
|
+
raise(): void;
|
|
116
117
|
/**
|
|
117
118
|
* Change the coordinates of this field to the given coordinates.
|
|
118
119
|
* @public
|
|
@@ -132,7 +133,7 @@ export declare class DiagramFieldSet extends DiagramElementSet<DiagramField> {
|
|
|
132
133
|
* Instance a new field and add it to this set. This method is normally called when instancing an element with a field and it is rarely called by itself.
|
|
133
134
|
* @private
|
|
134
135
|
*/
|
|
135
|
-
new(rootElement:
|
|
136
|
+
new(rootElement: (LabeledElement & DiagramElement) | 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): DiagramField;
|
|
136
137
|
remove(id: string): void;
|
|
137
138
|
}
|
|
138
139
|
export declare const getBottomMargin: (config?: FieldConfig | null) => number;
|