@metadev/daga 4.0.0 → 4.0.2
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 +21 -0
- package/index.cjs.js +349 -221
- package/index.esm.js +349 -221
- package/package.json +1 -1
- package/src/index.d.ts +8 -4
- package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +10 -0
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +2 -0
- package/src/lib/diagram/canvas/diagram-context-menu.d.ts +6 -1
- package/src/lib/diagram/canvas/diagram-user-selection.d.ts +1 -1
- package/src/lib/diagram/collab/collab-action.d.ts +1 -1
- package/src/lib/diagram/config/diagram-canvas-config.d.ts +103 -0
- package/src/lib/diagram/config/diagram-components-config.d.ts +249 -0
- package/src/lib/diagram/config/diagram-config.d.ts +35 -312
- package/src/lib/diagram/model/diagram-connection.d.ts +3 -2
- package/src/lib/diagram/model/diagram-decorator.d.ts +0 -1
- package/src/lib/diagram/model/diagram-field.d.ts +0 -1
- package/src/lib/diagram/model/diagram-model.d.ts +2 -1
- package/src/lib/diagram/model/diagram-node.d.ts +6 -3
- package/src/lib/diagram/model/diagram-object.d.ts +0 -1
- package/src/lib/diagram/model/diagram-port.d.ts +1 -1
- package/src/lib/diagram/model/diagram-section.d.ts +1 -1
- package/src/lib/diagram/property/property-util.d.ts +61 -0
- package/src/lib/diagram/property/property.d.ts +146 -0
- package/src/lib/diagram/property/value.d.ts +163 -0
- package/src/lib/interfaces/canvas.d.ts +6 -0
- package/src/lib/interfaces/property-editor.d.ts +1 -1
- package/src/lib/util/html-util.d.ts +1 -0
- package/src/lib/diagram/model/diagram-property.d.ts +0 -368
- /package/src/lib/diagram/config/{diagram-look.d.ts → diagram-look-config.d.ts} +0 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export { DiagramUserSelection } from './lib/diagram/canvas/diagram-user-selectio
|
|
|
7
7
|
export type { CollabAction, CollabActionSerialized } from './lib/diagram/collab/collab-action';
|
|
8
8
|
export { CollabClient } from './lib/diagram/collab/collab-client';
|
|
9
9
|
export type { CollabTimestamp, CollabTimestampSet } from './lib/diagram/collab/primitives';
|
|
10
|
+
export type { CanvasConfig, GridConfig, GridStyle } from './lib/diagram/config/diagram-canvas-config';
|
|
11
|
+
export type { ButtonsComponentConfig, ComponentsConfig, ConnectionTemplateConfig, ErrorsComponentConfig, NodeTemplateConfig, PaletteComponentConfig, PaletteSectionConfig, PropertyEditorComponentConfig } from './lib/diagram/config/diagram-components-config';
|
|
12
|
+
export type { ConnectionTypeConfig, DiagramConfig, FieldConfig, NodeTypeConfig, PortConfig, PortTypeConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram/config/diagram-config';
|
|
13
|
+
export type { ConnectionLook, ConnectionLookConfig, ImageLook, ImageLookConfig, Look, LookConfig, MarkerImageLook, MarkerImageLookConfig, ShapedLook, ShapedLookConfig, StretchableImageLook, StretchableImageLookConfig } from './lib/diagram/config/diagram-look-config';
|
|
10
14
|
export { DagaExporter } from './lib/diagram/converters/daga-exporter';
|
|
11
15
|
export { DagaImporter } from './lib/diagram/converters/daga-importer';
|
|
12
16
|
export type { DagaConnection, DagaModel, DagaNode, DagaPort, DagaSection } from './lib/diagram/converters/daga-model';
|
|
@@ -14,8 +18,6 @@ export type { DiagramModelExporter } from './lib/diagram/converters/diagram-mode
|
|
|
14
18
|
export type { DiagramModelImporter } from './lib/diagram/converters/diagram-model-importer';
|
|
15
19
|
export { ActionStack, AddConnectionAction, AddNodeAction, ApplyLayoutAction, DiagramActionMethod, DiagramActions, EditFieldAction, MoveAction, PasteAction, RemoveAction, SetGeometryAction, SetParentAction, UpdateValuesAction } from './lib/diagram/diagram-action';
|
|
16
20
|
export type { DiagramAction } from './lib/diagram/diagram-action';
|
|
17
|
-
export type { ButtonsComponentConfig, CanvasConfig, ComponentsConfig, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, ErrorsComponentConfig, FieldConfig, GridConfig, NodeTemplateConfig, NodeTypeConfig, PaletteComponentConfig, PaletteSectionConfig, PortConfig, PortTypeConfig, PropertyEditorComponentConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram/config/diagram-config';
|
|
18
|
-
export type { MarkerImageLook, StretchableImageLook, ImageLook, ShapedLook, Look, MarkerImageLookConfig, StretchableImageLookConfig, ImageLookConfig, ShapedLookConfig, LookConfig } from './lib/diagram/config/diagram-look';
|
|
19
21
|
export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramHighlightedEvent, DiagramSecondaryClickEvent, DiagramSelectionEvent } from './lib/diagram/diagram-event';
|
|
20
22
|
export { AdjacencyLayout } from './lib/diagram/layout/adjacency-layout';
|
|
21
23
|
export { BreadthAdjacencyLayout } from './lib/diagram/layout/breadth-adjacency-layout';
|
|
@@ -38,10 +40,12 @@ export { DiagramNode, DiagramNodeSet, DiagramNodeType, filterByOnlyAncestors, fi
|
|
|
38
40
|
export type { DiagramNodeGeometry } from './lib/diagram/model/diagram-node';
|
|
39
41
|
export { DiagramObject, DiagramObjectSet } from './lib/diagram/model/diagram-object';
|
|
40
42
|
export { DiagramPort, DiagramPortSet, DiagramPortType } from './lib/diagram/model/diagram-port';
|
|
41
|
-
export { diff, equals, isObject, Property, PropertySet, Type, ValueSet } from './lib/diagram/model/diagram-property';
|
|
42
|
-
export type { Option } from './lib/diagram/model/diagram-property';
|
|
43
43
|
export { DiagramSection, DiagramSectionSet } from './lib/diagram/model/diagram-section';
|
|
44
44
|
export type { DiagramSectionGeometry } from './lib/diagram/model/diagram-section';
|
|
45
|
+
export { Property, PropertySet, Type } from './lib/diagram/property/property';
|
|
46
|
+
export type { Option } from './lib/diagram/property/property';
|
|
47
|
+
export { diff, equals, isObject } from './lib/diagram/property/property-util';
|
|
48
|
+
export { ValueSet } from './lib/diagram/property/value';
|
|
45
49
|
export type { DiagramError } from './lib/errors/diagram-error';
|
|
46
50
|
export type { DiagramValidator } from './lib/errors/diagram-validator';
|
|
47
51
|
export type { Canvas } from './lib/interfaces/canvas';
|
|
@@ -7,6 +7,7 @@ import { DiagramField } from '../model/diagram-field';
|
|
|
7
7
|
import { DiagramNode } from '../model/diagram-node';
|
|
8
8
|
import { DiagramPort } from '../model/diagram-port';
|
|
9
9
|
import { DiagramSection } from '../model/diagram-section';
|
|
10
|
+
import { DiagramCanvas } from './diagram-canvas';
|
|
10
11
|
/**
|
|
11
12
|
* Checks if the given mouse event was produced with a secondary button press.
|
|
12
13
|
* @private
|
|
@@ -24,3 +25,12 @@ export declare const setCursorStyle: (style?: CursorStyle) => void;
|
|
|
24
25
|
export declare const getRelatedNodeOrItself: (element: DiagramNode | DiagramSection | DiagramPort | DiagramField) => DiagramNode | DiagramSection | DiagramPort | DiagramField;
|
|
25
26
|
export declare const initializeLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
|
|
26
27
|
export declare const updateLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
|
|
28
|
+
export declare const GRID_DEFAULTS: {
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
style: string;
|
|
31
|
+
color: string;
|
|
32
|
+
snap: boolean;
|
|
33
|
+
spacing: number;
|
|
34
|
+
thickness: number;
|
|
35
|
+
};
|
|
36
|
+
export declare const initializeGrid: (canvas: DiagramCanvas, canvasView: d3.Selection<SVGGElement, unknown, null, unknown>, backgroundPatternId: string) => void;
|
|
@@ -5,6 +5,7 @@ import { Canvas } from '../../interfaces/canvas';
|
|
|
5
5
|
import { DiagramEditor } from '../../interfaces/diagram-editor';
|
|
6
6
|
import { Point } from '../../util/canvas-util';
|
|
7
7
|
import { CollabEngine } from '../collab/collab-engine';
|
|
8
|
+
import { GridStyle } from '../config/diagram-canvas-config';
|
|
8
9
|
import { DiagramConfig } from '../config/diagram-config';
|
|
9
10
|
import { ActionStack, DiagramAction, DiagramActionMethod, DiagramActions } from '../diagram-action';
|
|
10
11
|
import { DiagramEvent } from '../diagram-event';
|
|
@@ -40,6 +41,7 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
40
41
|
readonly actionStack: ActionStack;
|
|
41
42
|
readonly collabEngine: CollabEngine;
|
|
42
43
|
backgroundColor: string;
|
|
44
|
+
gridStyle: GridStyle;
|
|
43
45
|
gridSize: number;
|
|
44
46
|
gridThickness: number;
|
|
45
47
|
gridColor: string;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Canvas } from '../../interfaces/canvas';
|
|
2
|
+
import { ContextMenuConfig } from '../config/diagram-canvas-config';
|
|
3
|
+
export declare const CONTEXT_MENU_DEFAULTS: {
|
|
4
|
+
customButtons: never[];
|
|
5
|
+
};
|
|
2
6
|
/**
|
|
3
7
|
* Stores the functionality regarding the context menu of a diagram canvas.
|
|
4
8
|
* @public
|
|
@@ -6,13 +10,14 @@ import { Canvas } from '../../interfaces/canvas';
|
|
|
6
10
|
*/
|
|
7
11
|
export declare class DiagramContextMenu {
|
|
8
12
|
private readonly canvas;
|
|
13
|
+
private config;
|
|
9
14
|
private contextMenuContainer?;
|
|
10
15
|
/**
|
|
11
16
|
* Constructs a context menu object.
|
|
12
17
|
* @public
|
|
13
18
|
* @param canvas A canvas.
|
|
14
19
|
*/
|
|
15
|
-
constructor(canvas: Canvas);
|
|
20
|
+
constructor(canvas: Canvas, config?: ContextMenuConfig);
|
|
16
21
|
/**
|
|
17
22
|
* Opens the context menu at the location determined by the given mouse event.
|
|
18
23
|
* @public
|
|
@@ -2,7 +2,7 @@ import { Canvas } from '../../interfaces/canvas';
|
|
|
2
2
|
import { Point } from '../../util/canvas-util';
|
|
3
3
|
import { DiagramElement, DiagramElementSet } from '../model/diagram-element';
|
|
4
4
|
import { DiagramModel } from '../model/diagram-model';
|
|
5
|
-
import { ValueSet } from '../
|
|
5
|
+
import { ValueSet } from '../property/value';
|
|
6
6
|
/**
|
|
7
7
|
* Text to display as the title of the property editor when editing the properties of a diagram's value set.
|
|
8
8
|
* @private
|
|
@@ -2,7 +2,7 @@ import { Canvas } from '../../interfaces/canvas';
|
|
|
2
2
|
import { Point } from '../../util/canvas-util';
|
|
3
3
|
import { DagaConnection, DagaNode } from '../converters/daga-model';
|
|
4
4
|
import { DiagramNodeGeometry } from '../model/diagram-node';
|
|
5
|
-
import { ValueSet } from '../
|
|
5
|
+
import { ValueSet } from '../property/value';
|
|
6
6
|
import { CollabTimestamp } from './primitives';
|
|
7
7
|
/**
|
|
8
8
|
* An action taken by a local or remote user.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Canvas } from '../../interfaces/canvas';
|
|
2
|
+
/**
|
|
3
|
+
* The configuration for the visual behavior of a diagram in the user interface.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface CanvasConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for the context menu in this diagram.
|
|
9
|
+
* If left undefined, the default context menu is used.
|
|
10
|
+
*/
|
|
11
|
+
contextMenu?: ContextMenuConfig;
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for the grid in the canvas.
|
|
14
|
+
* If left undefined, it is interpreted as disabling the grid,
|
|
15
|
+
* same as if the attribute `enabled` in its configuration was set to `false`.
|
|
16
|
+
*/
|
|
17
|
+
grid?: GridConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Background color of this diagram.
|
|
20
|
+
* @default "#FFFFFF"
|
|
21
|
+
*/
|
|
22
|
+
backgroundColor?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The factor by which the zoom level increases or decreases when the user users buttons or keys to zoom in or out. Should be above 1.
|
|
25
|
+
* @default 2
|
|
26
|
+
*/
|
|
27
|
+
zoomFactor?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The rate by which the view of the canvas moves when the user users buttons or keys to pan at a default zoom level in diagram units. Should be above 1.
|
|
30
|
+
* @default 100
|
|
31
|
+
*/
|
|
32
|
+
panRate?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Possible values of the priority threshold that the user can toggle between to hide nodes whose priority value is below it.
|
|
35
|
+
* If it is possible to toggle the priority threshold via the filter button, it should have at least two values.
|
|
36
|
+
* @default []
|
|
37
|
+
*/
|
|
38
|
+
priorityThresholds?: number[];
|
|
39
|
+
}
|
|
40
|
+
export type GridStyle = 'dots' | 'lines';
|
|
41
|
+
/**
|
|
42
|
+
* Configuration of the guide grid in the background of the diagram.
|
|
43
|
+
*/
|
|
44
|
+
export interface GridConfig {
|
|
45
|
+
/**
|
|
46
|
+
* Whether the grid is present in the diagram.
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The style of the grid.
|
|
52
|
+
* @default "dots"
|
|
53
|
+
*/
|
|
54
|
+
style?: GridStyle;
|
|
55
|
+
/**
|
|
56
|
+
* Color of grid elements such as the points or axes.
|
|
57
|
+
* @default "rgba(0, 0, 0, 0.1)"
|
|
58
|
+
*/
|
|
59
|
+
color?: string;
|
|
60
|
+
/**
|
|
61
|
+
* When true, the user moving or stretching nodes will cause their corners to automatically snap to the closest grid point.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
snap?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Distance between each point of the grid of this diagram in diagram units.
|
|
67
|
+
* @default 10
|
|
68
|
+
*/
|
|
69
|
+
spacing?: number;
|
|
70
|
+
/**
|
|
71
|
+
* In a range between 0 and 1, how thick the points of the grid are relative to the distance between them.
|
|
72
|
+
* @default 0.05
|
|
73
|
+
*/
|
|
74
|
+
thickness?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface ContextMenuConfig {
|
|
77
|
+
/**
|
|
78
|
+
* Custom buttons to be added to the context menu.
|
|
79
|
+
* @default []
|
|
80
|
+
*/
|
|
81
|
+
customButtons?: ContextMenuButtonConfig[];
|
|
82
|
+
}
|
|
83
|
+
export interface ContextMenuButtonConfig {
|
|
84
|
+
/**
|
|
85
|
+
* Text on the button.
|
|
86
|
+
*/
|
|
87
|
+
name: string;
|
|
88
|
+
/**
|
|
89
|
+
* File path to the image icon used by this button.
|
|
90
|
+
*/
|
|
91
|
+
image?: string;
|
|
92
|
+
/**
|
|
93
|
+
* A function which is executed when the user clicks on this button.
|
|
94
|
+
* @param canvas The diagram's canvas.
|
|
95
|
+
*/
|
|
96
|
+
onPress?: (canvas: Canvas) => void;
|
|
97
|
+
/**
|
|
98
|
+
* A function which given the canvas determines if the button should be present if the user opens a context menu on the canvas.
|
|
99
|
+
* @param canvas The diagram's canvas.
|
|
100
|
+
* @returns `true` if the button should be present on the menu, `false` otherwise.
|
|
101
|
+
*/
|
|
102
|
+
condition?: (canvas: Canvas) => boolean;
|
|
103
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { Corner, Side } from '../../util/svg-util';
|
|
2
|
+
import { FieldConfig } from './diagram-config';
|
|
3
|
+
import { ImageLookConfig, ShapedLookConfig, StretchableImageLookConfig } from './diagram-look-config';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the components of the diagram.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type ComponentsConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for the buttons component in the diagram.
|
|
11
|
+
* If left undefined, it is interpreted as disabling the buttons component,
|
|
12
|
+
* same as if the attribute `enabled` in its configuration was set to `false`.
|
|
13
|
+
*/
|
|
14
|
+
buttons?: ButtonsComponentConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Configuration for the errors component in the diagram.
|
|
17
|
+
* If left undefined, it is interpreted as disabling the errors component,
|
|
18
|
+
* same as if the attribute `enabled` in its configuration was set to `false`.
|
|
19
|
+
*/
|
|
20
|
+
errors?: ErrorsComponentConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Configuration for the palette component in the diagram.
|
|
23
|
+
* If left undefined, it is interpreted as disabling the palette component,
|
|
24
|
+
* same as if the attribute `enabled` in its configuration was set to `false`.
|
|
25
|
+
*/
|
|
26
|
+
palette?: PaletteComponentConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Configuration for the property editor component in the diagram.
|
|
29
|
+
* If left undefined, it is interpreted as disabling the property editor component,
|
|
30
|
+
* same as if the attribute `enabled` in its configuration was set to `false`.
|
|
31
|
+
*/
|
|
32
|
+
propertyEditor?: PropertyEditorComponentConfig;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for the buttons component in a diagram.
|
|
36
|
+
* @public
|
|
37
|
+
* @see DiagramButtonsComponent
|
|
38
|
+
*/
|
|
39
|
+
export interface ButtonsComponentConfig {
|
|
40
|
+
/**
|
|
41
|
+
* Whether this component is present in the diagram.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Location of this component in the screen.
|
|
47
|
+
* @default 'bottom-right'
|
|
48
|
+
*/
|
|
49
|
+
location?: Corner;
|
|
50
|
+
/**
|
|
51
|
+
* Direction that this component extends towards.
|
|
52
|
+
* @default 'top'
|
|
53
|
+
*/
|
|
54
|
+
direction?: Side;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to enable the user action (undo, redo) buttons in this component.
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
enableAction?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to enable the filter button in this component.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
enableFilter?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether to enable the layout button in this component.
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
enableLayout?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether to enable the user selection (copy, paste, cut, delete) buttons in this component.
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
enableSelection?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Whether to enable the zoom buttons in this component.
|
|
77
|
+
* @default true
|
|
78
|
+
*/
|
|
79
|
+
enableZoom?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Configuration for the errors component in a diagram.
|
|
83
|
+
* @public
|
|
84
|
+
* @see ErrorsComponent
|
|
85
|
+
*/
|
|
86
|
+
export interface ErrorsComponentConfig {
|
|
87
|
+
/**
|
|
88
|
+
* Whether this component is present in the diagram.
|
|
89
|
+
* @default true
|
|
90
|
+
*/
|
|
91
|
+
enabled?: boolean;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Configuration for the palette component in a diagram.
|
|
95
|
+
* @public
|
|
96
|
+
* @see PaletteComponent
|
|
97
|
+
*/
|
|
98
|
+
export interface PaletteComponentConfig {
|
|
99
|
+
/**
|
|
100
|
+
* Whether this component is present in the diagram.
|
|
101
|
+
* @default true
|
|
102
|
+
*/
|
|
103
|
+
enabled?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Location of this component in the screen.
|
|
106
|
+
* @default 'top-left'
|
|
107
|
+
*/
|
|
108
|
+
location?: Corner;
|
|
109
|
+
/**
|
|
110
|
+
* Direction that this component extends towards.
|
|
111
|
+
* @default 'bottom'
|
|
112
|
+
*/
|
|
113
|
+
direction?: Side;
|
|
114
|
+
/**
|
|
115
|
+
* Dimension of this component in the direction perpendicular to the direction that it extends towards.
|
|
116
|
+
* @default '12rem'
|
|
117
|
+
*/
|
|
118
|
+
width?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Gap between the templates in this palette.
|
|
121
|
+
* @default '1rem'
|
|
122
|
+
*/
|
|
123
|
+
gap?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Configuration for the sections of this palette. By default, no sections are created.
|
|
126
|
+
* @default undefined
|
|
127
|
+
*/
|
|
128
|
+
sections?: PaletteSectionConfig[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Configuration for the property editor component in a diagram.
|
|
132
|
+
* @public
|
|
133
|
+
* @see PropertyEditorComponent
|
|
134
|
+
*/
|
|
135
|
+
export interface PropertyEditorComponentConfig {
|
|
136
|
+
/**
|
|
137
|
+
* Whether this component is present in the diagram.
|
|
138
|
+
* @default true
|
|
139
|
+
*/
|
|
140
|
+
enabled?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Location of this component in the screen.
|
|
143
|
+
* @default 'top-right'
|
|
144
|
+
*/
|
|
145
|
+
location?: Corner;
|
|
146
|
+
/**
|
|
147
|
+
* Direction that this component extends towards.
|
|
148
|
+
* @default 'bottom'
|
|
149
|
+
*/
|
|
150
|
+
direction?: Side;
|
|
151
|
+
/**
|
|
152
|
+
* Dimension of this component in the direction perpendicular to the direction that it extends towards.
|
|
153
|
+
* @default '24rem'
|
|
154
|
+
*/
|
|
155
|
+
width?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Configuration for a palette.
|
|
159
|
+
* @public
|
|
160
|
+
* @see PaletteComponent
|
|
161
|
+
*/
|
|
162
|
+
export interface PaletteSectionConfig {
|
|
163
|
+
/**
|
|
164
|
+
* Name of this palette. Displayed in the tab of this palette in the palette component. Can be left undefined if this is the only palette.
|
|
165
|
+
*/
|
|
166
|
+
name?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Categories of this palette. Used to enable displaying one of different categories of templates as defined here. Can be left undefined if there are no categories.
|
|
169
|
+
*/
|
|
170
|
+
categories?: {
|
|
171
|
+
[key: string]: (NodeTemplateConfig | ConnectionTemplateConfig)[];
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* List of templates that are always displayed in this palette. Can be left undefined.
|
|
175
|
+
*/
|
|
176
|
+
templates?: (NodeTemplateConfig | ConnectionTemplateConfig)[];
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Configuration for a template of a node in a palette.
|
|
180
|
+
* @public
|
|
181
|
+
* @see PaletteComponent
|
|
182
|
+
*/
|
|
183
|
+
export interface NodeTemplateConfig {
|
|
184
|
+
/**
|
|
185
|
+
* String used to indicate that this is a template of a node.
|
|
186
|
+
*/
|
|
187
|
+
templateType: 'node';
|
|
188
|
+
/**
|
|
189
|
+
* Id of the type of node of this template. Must correspond to the id of a type of node defined in the nodeTypes list.
|
|
190
|
+
*/
|
|
191
|
+
type: string;
|
|
192
|
+
/**
|
|
193
|
+
* 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.
|
|
194
|
+
*/
|
|
195
|
+
look?: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig;
|
|
196
|
+
/**
|
|
197
|
+
* Label of this template as it appears on the palette and label that will be given to nodes created from this template.
|
|
198
|
+
*/
|
|
199
|
+
label?: string;
|
|
200
|
+
/**
|
|
201
|
+
* Look of the label of this template as it appears on the palette. By default, the label of the type of node is used.
|
|
202
|
+
*/
|
|
203
|
+
labelLook?: FieldConfig | null;
|
|
204
|
+
/**
|
|
205
|
+
* Default values of the properties of nodes created from this template.
|
|
206
|
+
*/
|
|
207
|
+
values?: {
|
|
208
|
+
[key: string]: unknown;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Configuration for a template of a connection in a palette.
|
|
213
|
+
* @public
|
|
214
|
+
* @see PaletteComponent
|
|
215
|
+
*/
|
|
216
|
+
export interface ConnectionTemplateConfig {
|
|
217
|
+
/**
|
|
218
|
+
* String used to indicate that this is a template of a connection.
|
|
219
|
+
*/
|
|
220
|
+
templateType: 'connection';
|
|
221
|
+
/**
|
|
222
|
+
* Id of the type of connection of this template. Must correspond to the id of a type of connection defined in the connectionTypes list.
|
|
223
|
+
*/
|
|
224
|
+
type: string;
|
|
225
|
+
/**
|
|
226
|
+
* Label of this template as it appears on the palette.
|
|
227
|
+
*/
|
|
228
|
+
label: string;
|
|
229
|
+
/**
|
|
230
|
+
* Background color of this template as it appears on the palette.
|
|
231
|
+
*/
|
|
232
|
+
backgroundColor: string;
|
|
233
|
+
/**
|
|
234
|
+
* File path of the background image of this template as it appears on the palette.
|
|
235
|
+
*/
|
|
236
|
+
icon: string;
|
|
237
|
+
/**
|
|
238
|
+
* File path of the background image of this template as it appears on the palette when this connection type is selected.
|
|
239
|
+
*/
|
|
240
|
+
selectedIcon: string;
|
|
241
|
+
/**
|
|
242
|
+
* Width of this template in diagram units as it appears on the palette.
|
|
243
|
+
*/
|
|
244
|
+
width: number;
|
|
245
|
+
/**
|
|
246
|
+
* Height of this template in diagram units as it appears on the palette.
|
|
247
|
+
*/
|
|
248
|
+
height: number;
|
|
249
|
+
}
|