-
Notifications
You must be signed in to change notification settings - Fork 45
/
DiagramRenderer.types.ts
106 lines (93 loc) · 2.72 KB
/
DiagramRenderer.types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*******************************************************************************
* Copyright (c) 2023, 2024 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
import { Edge, Node } from 'reactflow';
import { GQLNodeDescription } from '../graphql/query/nodeDescriptionFragment.types';
import { GQLDiagramRefreshedEventPayload } from '../graphql/subscription/diagramEventSubscription.types';
import { MultiLabelEdgeData } from './edge/MultiLabelEdge.types';
import { ConnectionHandle } from './handles/ConnectionHandles.types';
import { DiagramNodeType } from './node/NodeTypes.types';
export interface DiagramRendererProps {
diagramRefreshedEventPayload: GQLDiagramRefreshedEventPayload;
}
export interface DiagramPaletteState {
opened: boolean;
x: number;
y: number;
}
export interface Diagram {
metadata: DiagramMetadata;
nodes: Node<NodeData, DiagramNodeType>[];
edges: Edge<MultiLabelEdgeData>[];
}
export interface DiagramMetadata {
id: string;
kind: string;
label: string;
targetObjectId: string;
}
export type OutsideLabelLocation = 'BOTTOM_BEGIN' | 'BOTTOM_MIDDLE' | 'BOTTOM_END';
export type OutsideLabels = Partial<Record<OutsideLabelLocation, OutsideLabel>>;
export interface NodeData {
targetObjectId: string;
targetObjectKind: string;
targetObjectLabel: string;
descriptionId: string;
insideLabel: InsideLabel | null;
outsideLabels: OutsideLabels;
faded: boolean;
pinned: boolean;
nodeDescription: GQLNodeDescription;
defaultWidth: number | null;
defaultHeight: number | null;
isBorderNode: boolean;
borderNodePosition: BorderNodePosition | null;
labelEditable: boolean;
style: React.CSSProperties;
connectionHandles: ConnectionHandle[];
isNew: boolean;
resizedByUser: boolean;
}
export enum BorderNodePosition {
NORTH,
EAST,
SOUTH,
WEST,
}
export interface EdgeData {
targetObjectId: string;
targetObjectKind: string;
targetObjectLabel: string;
label: EdgeLabel | null;
faded: boolean;
centerLabelEditable: boolean;
}
export interface InsideLabel {
id: string;
text: string;
iconURL: string[];
style: React.CSSProperties;
isHeader: boolean;
displayHeaderSeparator: boolean;
}
export interface EdgeLabel {
id: string;
text: string;
iconURL: string[];
style: React.CSSProperties;
}
export interface OutsideLabel {
id: string;
text: string;
iconURL: string[];
style: React.CSSProperties;
}