-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathindex.d.ts
148 lines (143 loc) · 3.6 KB
/
index.d.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import "jsplumb";
import * as React from "react";
// export = ReactDAG;
export as namespace ReactDAG;
// export default DAG;
export type endpointUUID = string;
export interface IEventProps {
[anyProp: string]: (...args: any[]) => void;
}
export interface INodeProps {
id: string;
config?: INodeConfig;
initNode?: (initConfig: IInitNodeProps) => void;
onDelete?: (nodeId: string, endoints: endpointUUID[]) => void;
}
export class DefaultNode extends React.Component<INodeProps, {}> {
static defaultProps: Partial<INodeProps>;
private rootRef;
componentDidMount(): void;
render(): JSX.Element;
}
export interface IRegisterTypesProps {
connections: {
[anyProp: string]: any;
};
endpoints: {
[anyProp: string]: any;
};
}
export interface IChangeProps {
nodes: INode[];
connections: IConnectionParams[];
}
export interface IDAGProps {
className?: string;
connectionDecoders?: IConnectionRule[];
connectionEncoders?: IConnectionRule[];
connections: IConnectionParams[];
eventListeners?: IEventProps;
jsPlumbSettings?: object;
onChange?: (changeParams: IChangeProps) => void;
registerTypes?: IRegisterTypesProps;
nodes: INode[];
zoom: number;
panPositionX?: number;
panPositionY?: number;
onPanMove?: (x: number, y: number) => void;
}
export interface IDAGState {
jsPlumbInstance: jsPlumbInstance;
isJsPlumbInstanceCreated: boolean;
nodes: INode[];
connections: IConnectionParams[];
zoom: number;
}
export default class DAG extends React.Component<IDAGProps, IDAGState> {
static defaultProps: Partial<IDAGProps>;
private removeNode;
private addConnection;
private removeConnection;
private updateParent;
state: {
connections: IConnectionParams[];
isJsPlumbInstanceCreated: boolean;
jsPlumbInstance: any;
nodes: INode[];
zoom: number;
};
componentWillReceiveProps(nextProps: IDAGProps): void;
componentDidMount(): void;
componentDidUpdate(): void;
private setZoom;
private registerTypes;
private setEventListeners;
initNode: (
{
nodeId,
endPointParams,
makeSourceParams,
makeTargetParams,
}: IInitNodeProps
) => void;
makeConnections: () => void;
addEndpoint: (
element: HTMLElement | null,
params?: Object,
referenceParams?: Object
) => void;
makeNodeDraggable: (id: string) => void;
getNewConnectionObj: (
connObj: IConnectionParams,
encoders?: IConnectionRule[]
) => IConnectionParams;
onConnection: (connObj: IConnectionParams, originalEvent: boolean) => void;
onConnectionDetached: (
detachedConnObj: IConnectionParams,
originalEvent: boolean
) => void;
private getNodeConfig;
onDeleteNode: (nodeId: string) => void;
private renderChildren();
render(): JSX.Element;
}
export interface INodeConfig {
label?: string;
[newProps: string]: any;
}
export interface INode {
id: string;
config?: INodeConfig;
}
export interface IConnections {
from: string;
to: string;
}
export interface IData {
nodes: INode[];
connections: IConnectionParams[];
[extraProps: string]: any;
}
export interface IConnectionParams extends ConnectParams {
[extraProps: string]: any;
source?: any;
target?: any;
sourceId: string;
targetId: string;
}
export interface IEndPointArgs {
element: HTMLElement | null;
params?: EndpointParams;
referenceParams?: EndpointParams;
}
export interface IInitNodeProps {
nodeId: string;
endPointParams?: IEndPointArgs[];
makeSourceParams?: any;
makeTargetParams?: any;
}
export type IConnectionRule = (
connectionObj: IConnectionParams,
jsplumbInstance: jsPlumbInstance,
matchingNodes: INode[]
) => IConnectionParams;