@metadev/daga 5.1.0 → 5.1.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 +15 -0
- package/index.cjs.js +1115 -542
- package/index.esm.js +1115 -542
- package/package.json +1 -1
- package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +11 -4
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +7 -10
- package/src/lib/diagram/config/diagram-config.d.ts +78 -14
- package/src/lib/diagram/config/diagram-look-config.d.ts +32 -7
- package/src/lib/diagram/model/diagram-connection.d.ts +2 -3
- package/src/lib/diagram/model/diagram-field.d.ts +0 -1
- package/src/lib/diagram/model/diagram-node.d.ts +38 -4
- package/src/lib/diagram/model/diagram-resizer.d.ts +32 -0
- package/src/lib/diagram/model/diagram-section.d.ts +27 -3
- package/src/lib/interfaces/canvas.d.ts +15 -4
- package/src/lib/util/style.d.ts +2 -0
package/package.json
CHANGED
|
@@ -10,12 +10,18 @@ import { DiagramPort } from '../model/diagram-port';
|
|
|
10
10
|
import { DiagramSection } from '../model/diagram-section';
|
|
11
11
|
import { DiagramCanvas } from './diagram-canvas';
|
|
12
12
|
/**
|
|
13
|
-
* Checks if the given
|
|
13
|
+
* Checks if the given pointer event was produced with a secondary button press.
|
|
14
14
|
* @private
|
|
15
|
-
* @param event A
|
|
16
|
-
* @returns `true` if the given
|
|
15
|
+
* @param event A pointer event.
|
|
16
|
+
* @returns `true` if the given pointer event was produced with a secondary button press, `false` otherwise.
|
|
17
17
|
*/
|
|
18
18
|
export declare const isSecondaryButton: (event: MouseEvent) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Obtain the pointer event which is valid for passing to the `d3.pointer()` function.
|
|
21
|
+
* @param event A pointer event.
|
|
22
|
+
* @returns A pointer event which can be passed to the `d3.pointer()` function.
|
|
23
|
+
*/
|
|
24
|
+
export declare const getEventHoldingCoordinates: (event: MouseEvent | d3.D3DragEvent<Element, unknown, unknown>) => unknown;
|
|
19
25
|
/**
|
|
20
26
|
* Get the SVG path of a diagram connection.
|
|
21
27
|
* @private
|
|
@@ -26,6 +32,7 @@ export declare const setCursorStyle: (style?: CursorStyle) => void;
|
|
|
26
32
|
export declare const getRelatedNodeOrItself: (element: DiagramNode | DiagramSection | DiagramPort | DiagramField) => DiagramNode | DiagramSection | DiagramPort | DiagramField;
|
|
27
33
|
export declare const needsResizerX: (element: DiagramNode | DiagramSection) => boolean;
|
|
28
34
|
export declare const needsResizerY: (element: DiagramNode | DiagramSection) => boolean;
|
|
35
|
+
export declare const needsResizerXY: (element: DiagramNode | DiagramSection) => boolean;
|
|
29
36
|
export declare const initializeLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
|
|
30
37
|
export declare const SHAPED_LOOK_DEFAULTS: {
|
|
31
38
|
fillColor: string;
|
|
@@ -37,7 +44,7 @@ export declare const updateLook: (selection: d3.Selection<SVGGElement, DiagramNo
|
|
|
37
44
|
export declare const BACKGROUND_DEFAULTS: SolidBackgroundConfig;
|
|
38
45
|
export declare const GRID_DEFAULTS: EmptyGridConfig;
|
|
39
46
|
export declare const DOTS_GRID_DEFAULTS: DotsGridConfig;
|
|
40
|
-
export declare const initializeBackground: (
|
|
47
|
+
export declare const initializeBackground: (canvasView: d3.Selection<SVGGElement, unknown, null, unknown>, backgroundConfig: BackgroundConfig | undefined | null) => d3.Selection<SVGRectElement, unknown, null, unknown> | d3.Selection<SVGImageElement, unknown, null, unknown>;
|
|
41
48
|
export declare const applyGridDefaults: (gridConfig?: GridConfig) => GridConfig;
|
|
42
49
|
export declare const initializeGrid: (canvas: DiagramCanvas, canvasView: d3.Selection<SVGGElement, unknown, null, unknown>, canvasDefs: d3.Selection<SVGDefsElement, unknown, null, unknown>, gridPatternId: string, gridConfig: GridConfig) => d3.Selection<SVGRectElement, unknown, null, unknown> | undefined;
|
|
43
50
|
export declare const getGridSpacingX: (gridConfig: GridConfig) => number;
|
|
@@ -11,6 +11,7 @@ import { ActionStack, DiagramAction, DiagramActionMethod, DiagramActions } from
|
|
|
11
11
|
import { DiagramEvent } from '../diagram-event';
|
|
12
12
|
import { DiagramConnectionType } from '../model/diagram-connection';
|
|
13
13
|
import { DiagramModel } from '../model/diagram-model';
|
|
14
|
+
import { DiagramNode } from '../model/diagram-node';
|
|
14
15
|
import { DiagramContextMenu } from './diagram-context-menu';
|
|
15
16
|
import { DiagramUserHighlight } from './diagram-user-highlight';
|
|
16
17
|
import { DiagramUserSelection } from './diagram-user-selection';
|
|
@@ -19,11 +20,6 @@ import { DiagramUserSelection } from './diagram-user-selection';
|
|
|
19
20
|
* @private
|
|
20
21
|
*/
|
|
21
22
|
export declare const CONNECTION_PATH_BOX_THICKNESS = 12;
|
|
22
|
-
/**
|
|
23
|
-
* Thickness of the resizer line used to resize nodes and sections on drag, in diagram units.
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
26
|
-
export declare const RESIZER_THICKNESS = 6;
|
|
27
23
|
/**
|
|
28
24
|
* Maximum number of user actions that can be recorded in the user action stack.
|
|
29
25
|
* @private
|
|
@@ -109,11 +105,10 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
109
105
|
center(nodeIds?: string[], maxZoomLevel?: number, duration?: number): void;
|
|
110
106
|
getClosestGridPoint(point: Point): Point;
|
|
111
107
|
getCoordinatesOnScreen(): [Point, Point];
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
getPointerLocationRelativeToScreen(event: MouseEvent): Point;
|
|
108
|
+
getPointerLocationRelativeToCanvas(event: MouseEvent | d3.D3DragEvent<Element, unknown, unknown>): Point;
|
|
109
|
+
getPointerLocationRelativeToRoot(event: MouseEvent | d3.D3DragEvent<Element, unknown, unknown>): Point;
|
|
110
|
+
getPointerLocationRelativeToBody(event: MouseEvent | d3.D3DragEvent<Element, unknown, unknown>): Point;
|
|
111
|
+
getPointerLocationRelativeToScreen(event: MouseEvent | d3.D3DragEvent<Element, unknown, unknown>): Point;
|
|
117
112
|
updateModelInView(): void;
|
|
118
113
|
updateNodesInView(...ids: string[]): void;
|
|
119
114
|
updateSectionsInView(...ids: string[]): void;
|
|
@@ -124,6 +119,8 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
124
119
|
updateDecoratorsInView(...ids: string[]): void;
|
|
125
120
|
private updateConnectionLabelsInView;
|
|
126
121
|
private updateConnectionMarkersInView;
|
|
122
|
+
bringToFront(node: DiagramNode): void;
|
|
123
|
+
sendToBack(node: DiagramNode): void;
|
|
127
124
|
fieldRootFitsInView(id: string): boolean;
|
|
128
125
|
fitFieldRootInView(id: string, shrink?: boolean): void;
|
|
129
126
|
fitNodeInView(id: string, shrink?: boolean): void;
|
|
@@ -4,7 +4,7 @@ import { DiagramActions } from '../diagram-action';
|
|
|
4
4
|
import { Property } from '../property/property';
|
|
5
5
|
import { CanvasConfig } from './diagram-canvas-config';
|
|
6
6
|
import { ComponentsConfig } from './diagram-components-config';
|
|
7
|
-
import { ConnectionLookConfig, FieldLookConfig, ImageLookConfig, MarkerImageLookConfig, ShapedLookConfig, StretchableImageLookConfig } from './diagram-look-config';
|
|
7
|
+
import { ConnectionLookConfig, FieldLookConfig, ImageLookConfig, MarkerImageLookConfig, ResizerLookConfig, ShapedLookConfig, StretchableImageLookConfig } from './diagram-look-config';
|
|
8
8
|
/**
|
|
9
9
|
* The configuration for a diagram.
|
|
10
10
|
* @public
|
|
@@ -171,15 +171,25 @@ export interface NodeTypeConfig {
|
|
|
171
171
|
*/
|
|
172
172
|
minHeight?: number;
|
|
173
173
|
/**
|
|
174
|
-
*
|
|
174
|
+
* The default z coordinate of nodes of this type when rendering them in order relative to other diagram elements.
|
|
175
|
+
* @default 0
|
|
176
|
+
*/
|
|
177
|
+
defaultZ?: number;
|
|
178
|
+
/**
|
|
179
|
+
* Whether the user can resize nodes of this type horizontally.
|
|
175
180
|
* @default false
|
|
176
181
|
*/
|
|
177
|
-
resizableX?: boolean | ResizableMode;
|
|
182
|
+
resizableX?: boolean | ResizableMode | ResizerConfig;
|
|
178
183
|
/**
|
|
179
|
-
* Whether the user can resize nodes of this type
|
|
184
|
+
* Whether the user can resize nodes of this type vertically.
|
|
180
185
|
* @default false
|
|
181
186
|
*/
|
|
182
|
-
resizableY?: boolean | ResizableMode;
|
|
187
|
+
resizableY?: boolean | ResizableMode | ResizerConfig;
|
|
188
|
+
/**
|
|
189
|
+
* Whether the user can resize nodes of this type diagonally.
|
|
190
|
+
* @default false
|
|
191
|
+
*/
|
|
192
|
+
resizableXY?: boolean | ResizableMode | ResizerConfig;
|
|
183
193
|
/**
|
|
184
194
|
* By how much the location of nodes of this type should be offset when snapping to grid in diagram units.
|
|
185
195
|
* Each value corresponds to left, top, right and bottom respectively.
|
|
@@ -187,10 +197,11 @@ export interface NodeTypeConfig {
|
|
|
187
197
|
*/
|
|
188
198
|
snapToGridOffset?: [number, number, number, number];
|
|
189
199
|
/**
|
|
190
|
-
* The padding between the node and its children in diagram units if children are present.
|
|
200
|
+
* The padding between the node and its children in diagram units if children are present.
|
|
201
|
+
* May be a single number or an array of up to four numbers, in which case the value is interpreted in the same way as in CSS padding.
|
|
191
202
|
* @default 0
|
|
192
203
|
*/
|
|
193
|
-
padding?: number | number[];
|
|
204
|
+
padding?: number | [number] | [number, number] | [number, number, number] | [number, number, number, number];
|
|
194
205
|
/**
|
|
195
206
|
* Configuration for the label of nodes of this type.
|
|
196
207
|
* @default null
|
|
@@ -347,15 +358,17 @@ export interface FieldConfig {
|
|
|
347
358
|
*/
|
|
348
359
|
shrink?: boolean;
|
|
349
360
|
/**
|
|
350
|
-
* The margin around the field in diagram units.
|
|
361
|
+
* The margin around the field in diagram units.
|
|
362
|
+
* May be a single number or an array of up to four numbers, in which case the value is interpreted in the same way as in CSS margin.
|
|
351
363
|
* @default 0
|
|
352
364
|
*/
|
|
353
|
-
margin?: number | number[];
|
|
365
|
+
margin?: number | [number] | [number, number] | [number, number, number] | [number, number, number, number];
|
|
354
366
|
/**
|
|
355
|
-
* The padding around the field in diagram units.
|
|
367
|
+
* The padding around the field in diagram units.
|
|
368
|
+
* May be a single number or an array of up to four numbers, in which case the value is interpreted in the same way as in CSS padding.
|
|
356
369
|
* @default 0
|
|
357
370
|
*/
|
|
358
|
-
padding?: number | number[];
|
|
371
|
+
padding?: number | [number] | [number, number] | [number, number, number] | [number, number, number, number];
|
|
359
372
|
/**
|
|
360
373
|
* The horizontal alignment of the text of this field.
|
|
361
374
|
* @default 'center'
|
|
@@ -487,13 +500,19 @@ export interface SectionConfig {
|
|
|
487
500
|
* If undefined, inherits from the parent node's resizableX setting.
|
|
488
501
|
* @default undefined
|
|
489
502
|
*/
|
|
490
|
-
resizableX?: boolean | ResizableMode;
|
|
503
|
+
resizableX?: boolean | ResizableMode | ResizerConfig;
|
|
491
504
|
/**
|
|
492
505
|
* Whether this section can be resized vertically.
|
|
493
506
|
* If undefined, inherits from the parent node's resizableY setting.
|
|
494
507
|
* @default undefined
|
|
495
508
|
*/
|
|
496
|
-
resizableY?: boolean | ResizableMode;
|
|
509
|
+
resizableY?: boolean | ResizableMode | ResizerConfig;
|
|
510
|
+
/**
|
|
511
|
+
* Whether this section can be resized diagonally.
|
|
512
|
+
* If undefined, inherits from the parent node's resizableXY setting.
|
|
513
|
+
* @default undefined
|
|
514
|
+
*/
|
|
515
|
+
resizableXY?: boolean | ResizableMode | ResizerConfig;
|
|
497
516
|
}
|
|
498
517
|
/**
|
|
499
518
|
* Configuration for a type of connection.
|
|
@@ -544,6 +563,51 @@ export interface ConnectionTypeConfig {
|
|
|
544
563
|
*/
|
|
545
564
|
properties?: Property[];
|
|
546
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* Configuration for the resizers of a node or section.
|
|
568
|
+
* @public
|
|
569
|
+
* @see DiagramNode
|
|
570
|
+
* @see DiagramSection
|
|
571
|
+
*/
|
|
572
|
+
export interface ResizerConfig {
|
|
573
|
+
/**
|
|
574
|
+
* Mode of the resizer.
|
|
575
|
+
* @default ResizableMode.Never
|
|
576
|
+
*/
|
|
577
|
+
mode?: ResizableMode;
|
|
578
|
+
/**
|
|
579
|
+
* Thickness of the resizer.
|
|
580
|
+
* @default 10
|
|
581
|
+
*/
|
|
582
|
+
thickness?: number;
|
|
583
|
+
/**
|
|
584
|
+
* The margin around the resizer in diagram units. Used to shift the resizer relative to its default position.
|
|
585
|
+
* @default 0
|
|
586
|
+
*/
|
|
587
|
+
outerMargin?: number;
|
|
588
|
+
/**
|
|
589
|
+
* Configuration of the look of the resizer.
|
|
590
|
+
* @default { fillColor: 'transparent' }
|
|
591
|
+
*/
|
|
592
|
+
look?: ResizerLookConfig;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* The different modes for when a node or section can be resized.
|
|
596
|
+
* @public
|
|
597
|
+
* @see DiagramNode
|
|
598
|
+
* @see DiagramSection
|
|
599
|
+
*/
|
|
547
600
|
export declare enum ResizableMode {
|
|
548
|
-
|
|
601
|
+
/**
|
|
602
|
+
* Resizable mode for always being resizable.
|
|
603
|
+
*/
|
|
604
|
+
Always = 0,
|
|
605
|
+
/**
|
|
606
|
+
* Resizable mode for only being resizable while selected.
|
|
607
|
+
*/
|
|
608
|
+
OnlyWhenSelected = 1,
|
|
609
|
+
/**
|
|
610
|
+
* Resizable mode for never being resizable.
|
|
611
|
+
*/
|
|
612
|
+
Never = 2
|
|
549
613
|
}
|
|
@@ -65,11 +65,18 @@ export interface ConnectionLookConfig extends ConnectionLook, LookConfig<Connect
|
|
|
65
65
|
*/
|
|
66
66
|
export interface FieldLookConfig extends FieldLook, LookConfig<FieldLook> {
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Configuration for a look for a resizer.
|
|
70
|
+
* @public
|
|
71
|
+
* @see ResizerLook
|
|
72
|
+
*/
|
|
73
|
+
export interface ResizerLookConfig extends ResizerLook, LookConfig<ResizerLook> {
|
|
74
|
+
}
|
|
68
75
|
export interface Look {
|
|
69
76
|
/**
|
|
70
|
-
* String used to discern the type of look this is.
|
|
77
|
+
* String used to discern the type of look this is in cases where different types of looks can be used.
|
|
71
78
|
*/
|
|
72
|
-
lookType
|
|
79
|
+
lookType?: string;
|
|
73
80
|
}
|
|
74
81
|
/**
|
|
75
82
|
* Configuration for a look given by a shape.
|
|
@@ -178,7 +185,6 @@ export interface StretchableImageLook extends Look {
|
|
|
178
185
|
* @public
|
|
179
186
|
*/
|
|
180
187
|
export interface MarkerImageLook extends Look {
|
|
181
|
-
lookType: 'marker-image-look';
|
|
182
188
|
/**
|
|
183
189
|
* File path to the image used for the marker.
|
|
184
190
|
*/
|
|
@@ -213,7 +219,6 @@ export interface MarkerImageLook extends Look {
|
|
|
213
219
|
* @public
|
|
214
220
|
*/
|
|
215
221
|
export interface ConnectionLook extends Look {
|
|
216
|
-
lookType: 'connection-look';
|
|
217
222
|
/**
|
|
218
223
|
* Color of the line of connections of this type.
|
|
219
224
|
* @default '#000000'
|
|
@@ -240,7 +245,6 @@ export interface ConnectionLook extends Look {
|
|
|
240
245
|
* @public
|
|
241
246
|
*/
|
|
242
247
|
export interface FieldLook extends Look {
|
|
243
|
-
lookType: 'field-look';
|
|
244
248
|
/**
|
|
245
249
|
* Background color of this look.
|
|
246
250
|
* @default '#FFFFFF'
|
|
@@ -259,12 +263,33 @@ export interface FieldLook extends Look {
|
|
|
259
263
|
fontFamily?: string | null;
|
|
260
264
|
/**
|
|
261
265
|
* Font size of this field.
|
|
262
|
-
* @default
|
|
266
|
+
* @default 10
|
|
263
267
|
*/
|
|
264
268
|
fontSize?: number;
|
|
265
269
|
/**
|
|
266
270
|
* Font weight of this field.
|
|
267
|
-
* @default
|
|
271
|
+
* @default 400
|
|
268
272
|
*/
|
|
269
273
|
fontWeight?: number;
|
|
270
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Configuration for a look for a resizer.
|
|
277
|
+
* @public
|
|
278
|
+
*/
|
|
279
|
+
export interface ResizerLook extends Look {
|
|
280
|
+
/**
|
|
281
|
+
* Color of this resizer.
|
|
282
|
+
* @default 'transparent'
|
|
283
|
+
*/
|
|
284
|
+
fillColor?: string;
|
|
285
|
+
/**
|
|
286
|
+
* Border color of this resizer.
|
|
287
|
+
* @default 'transparent'
|
|
288
|
+
*/
|
|
289
|
+
borderColor?: string;
|
|
290
|
+
/**
|
|
291
|
+
* Border thickness of this resizer in diagram units.
|
|
292
|
+
* @default 0
|
|
293
|
+
*/
|
|
294
|
+
borderThickness?: number;
|
|
295
|
+
}
|
|
@@ -3,12 +3,12 @@ import { LineShape, LineStyle } from '../../util/line';
|
|
|
3
3
|
import { Side } from '../../util/svg-util';
|
|
4
4
|
import { ConnectionTypeConfig, FieldConfig } from '../config/diagram-config';
|
|
5
5
|
import { ConnectionLook, ConnectionLookConfig, MarkerImageLook, MarkerImageLookConfig } from '../config/diagram-look-config';
|
|
6
|
+
import { PropertySet } from '../property/property';
|
|
7
|
+
import { ValueSet } from '../property/value';
|
|
6
8
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
7
9
|
import { DiagramEntity, DiagramEntitySet } from './diagram-entity';
|
|
8
10
|
import { DiagramModel } from './diagram-model';
|
|
9
11
|
import { DiagramPort } from './diagram-port';
|
|
10
|
-
import { PropertySet } from '../property/property';
|
|
11
|
-
import { ValueSet } from '../property/value';
|
|
12
12
|
/**
|
|
13
13
|
* Default values of the parameters of a diagram connection.
|
|
14
14
|
* @private
|
|
@@ -18,7 +18,6 @@ export declare const DIAGRAM_CONNECTION_TYPE_DEFAULTS: {
|
|
|
18
18
|
name: string;
|
|
19
19
|
label: null;
|
|
20
20
|
look: {
|
|
21
|
-
lookType: string;
|
|
22
21
|
color: string;
|
|
23
22
|
thickness: number;
|
|
24
23
|
shape: LineShape;
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { DecoratorConfig, FieldConfig, NodeTypeConfig, PortConfig
|
|
4
|
+
import { DecoratorConfig, FieldConfig, NodeTypeConfig, PortConfig } from '../config/diagram-config';
|
|
5
5
|
import { ImageLook, ImageLookConfig, ShapedLook, ShapedLookConfig, StretchableImageLook, StretchableImageLookConfig } from '../config/diagram-look-config';
|
|
6
6
|
import { PropertySet } from '../property/property';
|
|
7
7
|
import { ValueSet } from '../property/value';
|
|
@@ -12,6 +12,7 @@ import { DiagramEntity, DiagramEntitySet } from './diagram-entity';
|
|
|
12
12
|
import { DiagramField, LabeledElement } from './diagram-field';
|
|
13
13
|
import { DiagramModel } from './diagram-model';
|
|
14
14
|
import { DiagramPort } from './diagram-port';
|
|
15
|
+
import { DiagramResizer } from './diagram-resizer';
|
|
15
16
|
import { DiagramSection, DiagramSectionGeometry, DiagramSectionGrid } from './diagram-section';
|
|
16
17
|
/**
|
|
17
18
|
* Default values of the look of a diagram node.
|
|
@@ -30,6 +31,7 @@ export declare const DIAGRAM_NODE_TYPE_DEFAULTS: {
|
|
|
30
31
|
defaultHeight: number;
|
|
31
32
|
minWidth: number;
|
|
32
33
|
minHeight: number;
|
|
34
|
+
defaultZ: number;
|
|
33
35
|
resizableX: boolean;
|
|
34
36
|
resizableY: boolean;
|
|
35
37
|
snapToGridOffset: [number, number, number, number];
|
|
@@ -47,6 +49,7 @@ export declare const DIAGRAM_NODE_TYPE_DEFAULTS: {
|
|
|
47
49
|
};
|
|
48
50
|
export type DiagramNodeGeometry = {
|
|
49
51
|
readonly coords: Point;
|
|
52
|
+
readonly z: number;
|
|
50
53
|
readonly width: number;
|
|
51
54
|
readonly height: number;
|
|
52
55
|
readonly sections: {
|
|
@@ -75,8 +78,10 @@ export declare class DiagramNodeType implements DiagramEntity {
|
|
|
75
78
|
defaultHeight: number;
|
|
76
79
|
minWidth: number;
|
|
77
80
|
minHeight: number;
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
defaultZ: number;
|
|
82
|
+
resizerX: DiagramResizer;
|
|
83
|
+
resizerY: DiagramResizer;
|
|
84
|
+
resizerXY: DiagramResizer;
|
|
80
85
|
snapToGridOffset: [number, number, number, number];
|
|
81
86
|
bottomPadding: number;
|
|
82
87
|
leftPadding: number;
|
|
@@ -170,6 +175,11 @@ export declare class DiagramNode extends DiagramElement implements LabeledElemen
|
|
|
170
175
|
* @public
|
|
171
176
|
*/
|
|
172
177
|
height: number;
|
|
178
|
+
/**
|
|
179
|
+
* The relative z coordinate of this node. Used to render this node below nodes with a higher z coordinate.
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
z: number;
|
|
173
183
|
/**
|
|
174
184
|
* Name of this node. Alias for this node's label's text.
|
|
175
185
|
* @public
|
|
@@ -182,7 +192,7 @@ export declare class DiagramNode extends DiagramElement implements LabeledElemen
|
|
|
182
192
|
private _highlightedLook?;
|
|
183
193
|
private _selectedAndHighlightedLook?;
|
|
184
194
|
/**
|
|
185
|
-
* Current look of this
|
|
195
|
+
* Current look of this node.
|
|
186
196
|
* @private
|
|
187
197
|
*/
|
|
188
198
|
get look(): NodeLook;
|
|
@@ -206,7 +216,26 @@ export declare class DiagramNode extends DiagramElement implements LabeledElemen
|
|
|
206
216
|
get removed(): boolean;
|
|
207
217
|
updateInView(): void;
|
|
208
218
|
raise(): void;
|
|
219
|
+
/**
|
|
220
|
+
* Put this element above other elements in the view if they have a lower z coordinate.
|
|
221
|
+
*/
|
|
222
|
+
raiseWithZ(): void;
|
|
209
223
|
getPriority(): number;
|
|
224
|
+
/**
|
|
225
|
+
* Returns the horizontal resizer of this node.
|
|
226
|
+
* @public
|
|
227
|
+
*/
|
|
228
|
+
getResizerX(): DiagramResizer;
|
|
229
|
+
/**
|
|
230
|
+
* Returns the vertical resizer of this node.
|
|
231
|
+
* @public
|
|
232
|
+
*/
|
|
233
|
+
getResizerY(): DiagramResizer;
|
|
234
|
+
/**
|
|
235
|
+
* Returns the diagonal resizer of this node.
|
|
236
|
+
* @public
|
|
237
|
+
*/
|
|
238
|
+
getResizerXY(): DiagramResizer;
|
|
210
239
|
/**
|
|
211
240
|
* Returns whether this node can be resized horizontally.
|
|
212
241
|
* @public
|
|
@@ -217,6 +246,11 @@ export declare class DiagramNode extends DiagramElement implements LabeledElemen
|
|
|
217
246
|
* @public
|
|
218
247
|
*/
|
|
219
248
|
getResizableY(): boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Returns whether this node can be resized diagonally.
|
|
251
|
+
* @public
|
|
252
|
+
*/
|
|
253
|
+
getResizableXY(): boolean;
|
|
220
254
|
/**
|
|
221
255
|
* Get the port of this node which is closest to the given coordinates.
|
|
222
256
|
* @param coords A point in the diagram.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ResizableMode, ResizerConfig } from '../config/diagram-config';
|
|
2
|
+
import { ResizerLook } from '../config/diagram-look-config';
|
|
3
|
+
import { DiagramNode } from './diagram-node';
|
|
4
|
+
import { DiagramSection } from './diagram-section';
|
|
5
|
+
/**
|
|
6
|
+
* Default values of the parameters of a diagram field.
|
|
7
|
+
* @private
|
|
8
|
+
* @see ResizerConfig
|
|
9
|
+
*/
|
|
10
|
+
export declare const DIAGRAM_RESIZER_DEFAULTS: ResizerConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Holds the data for the resizers of a type of node or section.
|
|
13
|
+
* @public
|
|
14
|
+
* @see DiagramNode
|
|
15
|
+
* @see DiagramSection
|
|
16
|
+
*/
|
|
17
|
+
export declare class DiagramResizer {
|
|
18
|
+
mode: ResizableMode;
|
|
19
|
+
thickness: number;
|
|
20
|
+
outerMargin: number;
|
|
21
|
+
defaultLook: ResizerLook;
|
|
22
|
+
selectedLook: ResizerLook;
|
|
23
|
+
highlightedLook: ResizerLook;
|
|
24
|
+
selectedAndHighlightedLook: ResizerLook;
|
|
25
|
+
constructor(options: boolean | ResizableMode | ResizerConfig);
|
|
26
|
+
/**
|
|
27
|
+
* Current look of this resizer.
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
getLook(rootElement?: DiagramNode | DiagramSection): ResizerLook;
|
|
31
|
+
}
|
|
32
|
+
export declare const DIAGRAM_DEFAULT_RESIZER: DiagramResizer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
2
|
import { Side } from '../../util/svg-util';
|
|
3
|
-
import { FieldConfig, PortConfig,
|
|
3
|
+
import { FieldConfig, PortConfig, SectionConfig, SectionGridConfig } from '../config/diagram-config';
|
|
4
4
|
import { ImageLookConfig, ShapedLookConfig, StretchableImageLookConfig } from '../config/diagram-look-config';
|
|
5
5
|
import { DiagramConnection } from './diagram-connection';
|
|
6
6
|
import { DiagramDecorator } from './diagram-decorator';
|
|
@@ -9,6 +9,7 @@ import { DiagramField, LabeledElement } from './diagram-field';
|
|
|
9
9
|
import { DiagramModel } from './diagram-model';
|
|
10
10
|
import { DiagramNode, NodeLook } from './diagram-node';
|
|
11
11
|
import { DiagramPort } from './diagram-port';
|
|
12
|
+
import { DiagramResizer } from './diagram-resizer';
|
|
12
13
|
/**
|
|
13
14
|
* Default value of the default width of a diagram section.
|
|
14
15
|
* @private
|
|
@@ -61,8 +62,9 @@ export declare class DiagramSectionType {
|
|
|
61
62
|
highlightedLook: NodeLook;
|
|
62
63
|
selectedAndHighlightedLook: NodeLook;
|
|
63
64
|
priority: number;
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
resizerX: DiagramResizer | undefined;
|
|
66
|
+
resizerY: DiagramResizer | undefined;
|
|
67
|
+
resizerXY: DiagramResizer | undefined;
|
|
66
68
|
constructor(options: SectionConfig);
|
|
67
69
|
}
|
|
68
70
|
/**
|
|
@@ -156,6 +158,21 @@ export declare class DiagramSection extends DiagramElement implements LabeledEle
|
|
|
156
158
|
getMinWidth(): number;
|
|
157
159
|
getMinHeight(): number;
|
|
158
160
|
getPriority(): number;
|
|
161
|
+
/**
|
|
162
|
+
* Returns the horizontal resizer of this section.
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
getResizerX(): DiagramResizer;
|
|
166
|
+
/**
|
|
167
|
+
* Returns the vertical resizer of this section.
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
getResizerY(): DiagramResizer;
|
|
171
|
+
/**
|
|
172
|
+
* Returns the diagonal resizer of this section.
|
|
173
|
+
* @public
|
|
174
|
+
*/
|
|
175
|
+
getResizerXY(): DiagramResizer;
|
|
159
176
|
/**
|
|
160
177
|
* Returns whether this section can be resized horizontally.
|
|
161
178
|
* If the section has a specific resizableX setting, it uses that.
|
|
@@ -170,6 +187,13 @@ export declare class DiagramSection extends DiagramElement implements LabeledEle
|
|
|
170
187
|
* @public
|
|
171
188
|
*/
|
|
172
189
|
getResizableY(): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Returns whether this section can be resized diagonally.
|
|
192
|
+
* If the section has a specific resizableXY setting, it uses that.
|
|
193
|
+
* Otherwise, it inherits from the parent node's resizableXY setting.
|
|
194
|
+
* @public
|
|
195
|
+
*/
|
|
196
|
+
getResizableXY(): boolean;
|
|
173
197
|
/**
|
|
174
198
|
* Get the port of this section which is closest to the given coordinates.
|
|
175
199
|
* @param coords A point in the diagram.
|
|
@@ -9,6 +9,7 @@ import { ActionStack, DiagramAction, DiagramActionMethod, DiagramActions } from
|
|
|
9
9
|
import { DiagramEvent } from '../diagram/diagram-event';
|
|
10
10
|
import { DiagramConnectionType } from '../diagram/model/diagram-connection';
|
|
11
11
|
import { DiagramModel } from '../diagram/model/diagram-model';
|
|
12
|
+
import { DiagramNode } from '../diagram/model/diagram-node';
|
|
12
13
|
import { DiagramValidator } from '../errors/diagram-validator';
|
|
13
14
|
import { Point } from '../util/canvas-util';
|
|
14
15
|
import { DiagramEditor } from './diagram-editor';
|
|
@@ -233,25 +234,25 @@ export interface Canvas {
|
|
|
233
234
|
* @private
|
|
234
235
|
* @param event A MouseEvent.
|
|
235
236
|
*/
|
|
236
|
-
getPointerLocationRelativeToCanvas(event: MouseEvent): Point;
|
|
237
|
+
getPointerLocationRelativeToCanvas(event: MouseEvent | d3.D3DragEvent<Element, unknown, unknown>): Point;
|
|
237
238
|
/**
|
|
238
239
|
* Get the location of the pointer in the given event relative to the svg element.
|
|
239
240
|
* @private
|
|
240
241
|
* @param event A MouseEvent.
|
|
241
242
|
*/
|
|
242
|
-
getPointerLocationRelativeToRoot(event: MouseEvent): Point;
|
|
243
|
+
getPointerLocationRelativeToRoot(event: MouseEvent | d3.D3DragEvent<Element, unknown, unknown>): Point;
|
|
243
244
|
/**
|
|
244
245
|
* Get the location of the pointer in the given event relative to the body.
|
|
245
246
|
* @private
|
|
246
247
|
* @param event A MouseEvent.
|
|
247
248
|
*/
|
|
248
|
-
getPointerLocationRelativeToBody(event: MouseEvent): Point;
|
|
249
|
+
getPointerLocationRelativeToBody(event: MouseEvent | d3.D3DragEvent<Element, unknown, unknown>): Point;
|
|
249
250
|
/**
|
|
250
251
|
* Get the location of the pointer in the given event relative to the screen.
|
|
251
252
|
* @private
|
|
252
253
|
* @param event A MouseEvent.
|
|
253
254
|
*/
|
|
254
|
-
getPointerLocationRelativeToScreen(event: MouseEvent): Point;
|
|
255
|
+
getPointerLocationRelativeToScreen(event: MouseEvent | d3.D3DragEvent<Element, unknown, unknown>): Point;
|
|
255
256
|
/**
|
|
256
257
|
* Adds a validator to the list of validators of the diagram.
|
|
257
258
|
* @public
|
|
@@ -318,6 +319,16 @@ export interface Canvas {
|
|
|
318
319
|
* @public
|
|
319
320
|
*/
|
|
320
321
|
updateDecoratorsInView(...ids: string[]): void;
|
|
322
|
+
/**
|
|
323
|
+
* Update the z coordinate of a node to be higher than any node that overlaps with it.
|
|
324
|
+
* @public
|
|
325
|
+
*/
|
|
326
|
+
bringToFront(node: DiagramNode): void;
|
|
327
|
+
/**
|
|
328
|
+
* Update the z coordinate of a node to be lower than any node that overlaps with it.
|
|
329
|
+
* @public
|
|
330
|
+
*/
|
|
331
|
+
sendToBack(node: DiagramNode): void;
|
|
321
332
|
/**
|
|
322
333
|
* Checks whether the root of a diagram field encompasses the totality of the field.
|
|
323
334
|
* @param id The id of a diagram field
|
package/src/lib/util/style.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export declare enum CursorStyle {
|
|
|
7
7
|
Grabbing = "grabbing",
|
|
8
8
|
Move = "move",
|
|
9
9
|
NoDrop = "no-drop",
|
|
10
|
+
NESWResize = "nesw-resize",
|
|
10
11
|
NSResize = "ns-resize",
|
|
12
|
+
NWSEResize = "nwse-resize",
|
|
11
13
|
NotAllowed = "not-allowed",
|
|
12
14
|
ZoomIn = "zoom-in",
|
|
13
15
|
ZoomOut = "zoom-out"
|