@metadev/daga 3.1.4 → 3.1.5
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 +14 -0
- package/index.cjs.js +190 -77
- package/index.esm.js +190 -78
- package/package.json +1 -1
- package/src/index.d.ts +2 -2
- package/src/lib/diagram/converters/daga-model.d.ts +2 -0
- package/src/lib/diagram/diagram-config.d.ts +81 -26
- package/src/lib/diagram/model/diagram-node.d.ts +4 -4
- package/src/lib/diagram/model/diagram-port.d.ts +71 -6
- package/src/lib/diagram/model/diagram-section.d.ts +3 -3
|
@@ -60,6 +60,16 @@ export interface DiagramConfig {
|
|
|
60
60
|
* @default undefined
|
|
61
61
|
*/
|
|
62
62
|
nodeTypes?: NodeTypeConfig[];
|
|
63
|
+
/**
|
|
64
|
+
* Default attributes for each of the types of port of this diagram. By default, no attributes are set.
|
|
65
|
+
* @default undefined
|
|
66
|
+
*/
|
|
67
|
+
portTypeDefaults?: Partial<PortTypeConfig>;
|
|
68
|
+
/**
|
|
69
|
+
* List of the types of port that can be used in this diagram. By default, no types are created.
|
|
70
|
+
* @default undefined
|
|
71
|
+
*/
|
|
72
|
+
portTypes?: PortTypeConfig[];
|
|
63
73
|
/**
|
|
64
74
|
* Default attributes for each of the types of connection of this diagram. By default, no attributes are set.
|
|
65
75
|
* @default undefined
|
|
@@ -338,7 +348,7 @@ export interface NodeTemplateConfig {
|
|
|
338
348
|
/**
|
|
339
349
|
* 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
350
|
*/
|
|
341
|
-
look?:
|
|
351
|
+
look?: ShapedLook | ImageLook | StretchableImageLook;
|
|
342
352
|
/**
|
|
343
353
|
* Label of this template as it appears on the palette and label that will be given to nodes created from this template.
|
|
344
354
|
*/
|
|
@@ -461,7 +471,7 @@ export interface NodeTypeConfig {
|
|
|
461
471
|
* Configuration of the look of nodes of this type as it should appear to the user.
|
|
462
472
|
* @default {lookType: 'shaped-look', shape: ClosedShape.Rectangle, fillColor: '#FFFFFF', borderColor: '#000000', selectedFillColor: '#FFFFFF', selectedBorderColor: '#000000'}
|
|
463
473
|
*/
|
|
464
|
-
look?:
|
|
474
|
+
look?: ShapedLook | ImageLook | StretchableImageLook;
|
|
465
475
|
/**
|
|
466
476
|
* If true and a node of this type already exists in the diagram, the user can't create more nodes of this type.
|
|
467
477
|
* @default false
|
|
@@ -489,6 +499,71 @@ export interface NodeTypeConfig {
|
|
|
489
499
|
*/
|
|
490
500
|
properties?: Property[];
|
|
491
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Configuration for a type of port.
|
|
504
|
+
* @public
|
|
505
|
+
* @see DiagramPortType
|
|
506
|
+
*/
|
|
507
|
+
export interface PortTypeConfig {
|
|
508
|
+
/**
|
|
509
|
+
* Id of this type of port used to reference this type of port internally.
|
|
510
|
+
*/
|
|
511
|
+
id: string;
|
|
512
|
+
/**
|
|
513
|
+
* Name of this type of port as displayed to the user.
|
|
514
|
+
*/
|
|
515
|
+
name?: string;
|
|
516
|
+
/**
|
|
517
|
+
* Whether this type of port can be used as a connection start point.
|
|
518
|
+
* @default true
|
|
519
|
+
*/
|
|
520
|
+
allowsOutgoing?: boolean;
|
|
521
|
+
/**
|
|
522
|
+
* Whether this type of port can be used as a connection end point.
|
|
523
|
+
* @default true
|
|
524
|
+
*/
|
|
525
|
+
allowsIncoming?: boolean;
|
|
526
|
+
/**
|
|
527
|
+
* Configuration for the label of nodes of this type.
|
|
528
|
+
* @default null
|
|
529
|
+
*/
|
|
530
|
+
label?: FieldConfig | null;
|
|
531
|
+
/**
|
|
532
|
+
* Width of this type of port as it appears in the diagram in diagram units.
|
|
533
|
+
* @default 24
|
|
534
|
+
*/
|
|
535
|
+
width?: number;
|
|
536
|
+
/**
|
|
537
|
+
* Configuration of the look of ports of this type as they should appear to the user. Can be used to override the default look of ports.
|
|
538
|
+
* @default undefined
|
|
539
|
+
*/
|
|
540
|
+
look?: ImageLook;
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Configuration for a port that is part of another element.
|
|
544
|
+
* @public
|
|
545
|
+
* @see DiagramPort
|
|
546
|
+
*/
|
|
547
|
+
export interface PortConfig {
|
|
548
|
+
/**
|
|
549
|
+
* Id of the type of this port. May be left `undefined` to use the default look. If set, it must correspond to the id of a type of port defined in the portTypes list.
|
|
550
|
+
* @default undefined
|
|
551
|
+
*/
|
|
552
|
+
type?: string;
|
|
553
|
+
/**
|
|
554
|
+
* Coordinates of this port relative to its root element's coordinates.
|
|
555
|
+
*/
|
|
556
|
+
coords: Point;
|
|
557
|
+
/**
|
|
558
|
+
* Optional coordinates of the point where connections start and end within this port relative to its root element's coordinates.
|
|
559
|
+
* By default, it is the same as the port's coordinates.
|
|
560
|
+
*/
|
|
561
|
+
connectionPoint?: Point;
|
|
562
|
+
/**
|
|
563
|
+
* Direction that the connections passing by this port follow at the point of the port.
|
|
564
|
+
*/
|
|
565
|
+
direction: Side;
|
|
566
|
+
}
|
|
492
567
|
/**
|
|
493
568
|
* Configuration for a field that is part of another element.
|
|
494
569
|
* @public
|
|
@@ -548,26 +623,6 @@ export interface FieldConfig {
|
|
|
548
623
|
*/
|
|
549
624
|
fit?: boolean;
|
|
550
625
|
}
|
|
551
|
-
/**
|
|
552
|
-
* Configuration for a port that is part of another element.
|
|
553
|
-
* @public
|
|
554
|
-
* @see DiagramPort
|
|
555
|
-
*/
|
|
556
|
-
export interface PortConfig {
|
|
557
|
-
/**
|
|
558
|
-
* Coordinates of this port relative to its root element's coordinates.
|
|
559
|
-
*/
|
|
560
|
-
coords: Point;
|
|
561
|
-
/**
|
|
562
|
-
* Direction that the connections passing by this port follow at the point of the port.
|
|
563
|
-
*/
|
|
564
|
-
direction: Side;
|
|
565
|
-
/**
|
|
566
|
-
* Configuration for the label of this port.
|
|
567
|
-
* @default null
|
|
568
|
-
*/
|
|
569
|
-
label?: FieldConfig | null;
|
|
570
|
-
}
|
|
571
626
|
/**
|
|
572
627
|
* Configuration for the grid of sections of a node.
|
|
573
628
|
* @public
|
|
@@ -621,7 +676,7 @@ export interface SectionConfig {
|
|
|
621
676
|
* Configuration of the look of the sections as it should appear to the user.
|
|
622
677
|
* @default {lookType: 'shaped-look', shape: ClosedShape.Rectangle, color: '#FFFFFF', borderColor: '#000000', selectedColor: '#FFFFFF', selectedBorderColor: '#000000'}
|
|
623
678
|
*/
|
|
624
|
-
look?:
|
|
679
|
+
look?: ShapedLook | ImageLook | StretchableImageLook;
|
|
625
680
|
/**
|
|
626
681
|
* The priority of this section when filtering out sections below a given threshold.
|
|
627
682
|
* @default 0
|
|
@@ -632,7 +687,7 @@ export interface SectionConfig {
|
|
|
632
687
|
* Configuration for the look of a node given by shape and color.
|
|
633
688
|
* @public
|
|
634
689
|
*/
|
|
635
|
-
export interface
|
|
690
|
+
export interface ShapedLook {
|
|
636
691
|
/**
|
|
637
692
|
* String used to discern the type of node look this is.
|
|
638
693
|
*/
|
|
@@ -662,7 +717,7 @@ export interface NodeShapedLook {
|
|
|
662
717
|
* Configuration for the look of a node given by an image.
|
|
663
718
|
* @public
|
|
664
719
|
*/
|
|
665
|
-
export interface
|
|
720
|
+
export interface ImageLook {
|
|
666
721
|
/**
|
|
667
722
|
* String used to discern the type of node look this is.
|
|
668
723
|
*/
|
|
@@ -680,7 +735,7 @@ export interface NodeImageLook {
|
|
|
680
735
|
* Configuration for the look of a node given by fixed size images in the corners and stretchable images in the middle.
|
|
681
736
|
* @public
|
|
682
737
|
*/
|
|
683
|
-
export interface
|
|
738
|
+
export interface StretchableImageLook {
|
|
684
739
|
/**
|
|
685
740
|
* String used to discern the type of node look this is.
|
|
686
741
|
*/
|
|
@@ -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 { FieldConfig,
|
|
4
|
+
import { FieldConfig, ImageLook, NodeTypeConfig, PortConfig, SectionGridConfig, ShapedLook, StretchableImageLook } from '../diagram-config';
|
|
5
5
|
import { DiagramConnection } from './diagram-connection';
|
|
6
6
|
import { DiagramDecorator } from './diagram-decorator';
|
|
7
7
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
@@ -16,7 +16,7 @@ import { DiagramSection, DiagramSectionGeometry } from './diagram-section';
|
|
|
16
16
|
* @private
|
|
17
17
|
* @see DIAGRAM_NODE_TYPE_DEFAULTS
|
|
18
18
|
*/
|
|
19
|
-
export declare const DIAGRAM_NODE_LOOK_DEFAULTS:
|
|
19
|
+
export declare const DIAGRAM_NODE_LOOK_DEFAULTS: ShapedLook;
|
|
20
20
|
/**
|
|
21
21
|
* Default values of the parameters of a diagram node.
|
|
22
22
|
* @private
|
|
@@ -34,7 +34,7 @@ export declare const DIAGRAM_NODE_TYPE_DEFAULTS: {
|
|
|
34
34
|
label: null;
|
|
35
35
|
ports: never[];
|
|
36
36
|
sectionGrid: null;
|
|
37
|
-
look:
|
|
37
|
+
look: ShapedLook;
|
|
38
38
|
isUnique: boolean;
|
|
39
39
|
canBeParentless: boolean;
|
|
40
40
|
childrenTypes: never[];
|
|
@@ -73,7 +73,7 @@ export declare class DiagramNodeType implements DiagramEntity {
|
|
|
73
73
|
label: FieldConfig | null;
|
|
74
74
|
ports: PortConfig[];
|
|
75
75
|
sectionGrid: SectionGridConfig | null;
|
|
76
|
-
look:
|
|
76
|
+
look: ShapedLook | ImageLook | StretchableImageLook;
|
|
77
77
|
isUnique: boolean;
|
|
78
78
|
canBeParentless: boolean;
|
|
79
79
|
childrenTypes: string[];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
2
|
import { Side } from '../../util/svg-util';
|
|
3
|
+
import { FieldConfig, ImageLook, PortTypeConfig } from '../diagram-config';
|
|
3
4
|
import { DiagramConnection } from './diagram-connection';
|
|
4
5
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
6
|
+
import { DiagramEntity, DiagramEntitySet } from './diagram-entity';
|
|
5
7
|
import { DiagramField, LabeledElement } from './diagram-field';
|
|
6
8
|
import { DiagramModel } from './diagram-model';
|
|
7
9
|
import { DiagramNode } from './diagram-node';
|
|
@@ -12,10 +14,48 @@ import { DiagramSection } from './diagram-section';
|
|
|
12
14
|
* @see DiagramPort
|
|
13
15
|
*/
|
|
14
16
|
export declare const DIAGRAM_PORT_DEFAULTS: {
|
|
15
|
-
radius: number;
|
|
16
17
|
highlightedColor: string;
|
|
17
18
|
selectedColor: string;
|
|
18
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Default values of the parameters of a diagram port.
|
|
22
|
+
* @private
|
|
23
|
+
* @see DiagramPort
|
|
24
|
+
*/
|
|
25
|
+
export declare const DIAGRAM_PORT_TYPE_DEFAULTS: {
|
|
26
|
+
name: string;
|
|
27
|
+
label: null;
|
|
28
|
+
allowsOutgoing: boolean;
|
|
29
|
+
allowsIncoming: boolean;
|
|
30
|
+
width: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A port type, which holds properties that ports of this type share in common.
|
|
34
|
+
* @public
|
|
35
|
+
* @see PortTypeConfig
|
|
36
|
+
*/
|
|
37
|
+
export declare class DiagramPortType implements DiagramEntity {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
label: FieldConfig | null;
|
|
41
|
+
/**
|
|
42
|
+
* Whether ports of this type can be used as a connection start point.
|
|
43
|
+
*/
|
|
44
|
+
allowsOutgoing: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether ports of this type can be used as a connection end point.
|
|
47
|
+
*/
|
|
48
|
+
allowsIncoming: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Width of ports of this type in diagram units.
|
|
51
|
+
*/
|
|
52
|
+
width: number;
|
|
53
|
+
/**
|
|
54
|
+
* Look of ports of this type.
|
|
55
|
+
*/
|
|
56
|
+
look?: ImageLook;
|
|
57
|
+
constructor(options: PortTypeConfig);
|
|
58
|
+
}
|
|
19
59
|
/**
|
|
20
60
|
* A port which is part of a node or section and at which connections can start or end.
|
|
21
61
|
* @public
|
|
@@ -24,6 +64,7 @@ export declare const DIAGRAM_PORT_DEFAULTS: {
|
|
|
24
64
|
* @see DiagramSection
|
|
25
65
|
*/
|
|
26
66
|
export declare class DiagramPort extends DiagramElement implements LabeledElement {
|
|
67
|
+
type: DiagramPortType | undefined;
|
|
27
68
|
/**
|
|
28
69
|
* Element that this port belongs to.
|
|
29
70
|
* @public
|
|
@@ -34,16 +75,29 @@ export declare class DiagramPort extends DiagramElement implements LabeledElemen
|
|
|
34
75
|
* @public
|
|
35
76
|
*/
|
|
36
77
|
label?: DiagramField;
|
|
78
|
+
/**
|
|
79
|
+
* Coordinates of this port.
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
coords: Point;
|
|
83
|
+
/**
|
|
84
|
+
* Coordinates of the point where connections end and start from this port.
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
connectionPoint: Point;
|
|
37
88
|
/**
|
|
38
89
|
* Direction of the connections of this port at the coordinates of this port.
|
|
39
90
|
* @public
|
|
40
91
|
*/
|
|
41
92
|
direction: Side;
|
|
42
93
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
94
|
+
* Whether this port can be used as a connection start point.
|
|
45
95
|
*/
|
|
46
|
-
|
|
96
|
+
get allowsOutgoing(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Whether this port can be used as a connection end point.
|
|
99
|
+
*/
|
|
100
|
+
get allowsIncoming(): boolean;
|
|
47
101
|
/**
|
|
48
102
|
* Connections that start at this port.
|
|
49
103
|
* @public
|
|
@@ -54,7 +108,13 @@ export declare class DiagramPort extends DiagramElement implements LabeledElemen
|
|
|
54
108
|
* @public
|
|
55
109
|
*/
|
|
56
110
|
incomingConnections: DiagramConnection[];
|
|
57
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Name of this port. Alias for this port's label's text.
|
|
113
|
+
* @public
|
|
114
|
+
*/
|
|
115
|
+
get name(): string;
|
|
116
|
+
set name(name: string);
|
|
117
|
+
constructor(model: DiagramModel, type: DiagramPortType | undefined, rootElement: DiagramNode | DiagramSection | undefined, coords: Point, connectionPoint: Point | undefined, direction: Side, id: string);
|
|
58
118
|
get removed(): boolean;
|
|
59
119
|
updateInView(): void;
|
|
60
120
|
raise(): void;
|
|
@@ -87,6 +147,11 @@ export declare class DiagramPort extends DiagramElement implements LabeledElemen
|
|
|
87
147
|
}
|
|
88
148
|
export declare class DiagramPortSet extends DiagramElementSet<DiagramPort> {
|
|
89
149
|
private model;
|
|
150
|
+
/**
|
|
151
|
+
* Set of the possible types of port that the ports of this set can have.
|
|
152
|
+
* @public
|
|
153
|
+
*/
|
|
154
|
+
types: DiagramEntitySet<DiagramPortType>;
|
|
90
155
|
/**
|
|
91
156
|
* Instance a set of ports for the given model. This method is used internally.
|
|
92
157
|
* @private
|
|
@@ -96,6 +161,6 @@ export declare class DiagramPortSet extends DiagramElementSet<DiagramPort> {
|
|
|
96
161
|
* Instance a new port and add it to this set. This method is normally called when instancing an element with a port and it is rarely called by itself.
|
|
97
162
|
* @private
|
|
98
163
|
*/
|
|
99
|
-
new(rootElement: DiagramNode | DiagramSection | undefined, coords: Point, direction: Side, id: string): DiagramPort;
|
|
164
|
+
new(type: DiagramPortType | undefined, rootElement: DiagramNode | DiagramSection | undefined, coords: Point, connectionPoint: Point | undefined, direction: Side, id: string): DiagramPort;
|
|
100
165
|
remove(id: string): void;
|
|
101
166
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
2
|
import { Side } from '../../util/svg-util';
|
|
3
|
-
import {
|
|
3
|
+
import { SectionConfig, ShapedLook } from '../diagram-config';
|
|
4
4
|
import { DiagramConnection } from './diagram-connection';
|
|
5
5
|
import { DiagramDecorator } from './diagram-decorator';
|
|
6
6
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
@@ -13,7 +13,7 @@ import { DiagramPort } from './diagram-port';
|
|
|
13
13
|
* @private
|
|
14
14
|
* @see DIAGRAM_SECTION_DEFAULTS
|
|
15
15
|
*/
|
|
16
|
-
export declare const DIAGRAM_SECTION_LOOK_DEFAULTS:
|
|
16
|
+
export declare const DIAGRAM_SECTION_LOOK_DEFAULTS: ShapedLook;
|
|
17
17
|
/**
|
|
18
18
|
* Default values of the parameters of a diagram section.
|
|
19
19
|
* @private
|
|
@@ -22,7 +22,7 @@ export declare const DIAGRAM_SECTION_LOOK_DEFAULTS: NodeShapedLook;
|
|
|
22
22
|
export declare const DIAGRAM_SECTION_DEFAULTS: {
|
|
23
23
|
label: null;
|
|
24
24
|
ports: never[];
|
|
25
|
-
look:
|
|
25
|
+
look: ShapedLook;
|
|
26
26
|
priority: number;
|
|
27
27
|
};
|
|
28
28
|
/**
|