forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.jsPlumb.d.ts
131 lines (114 loc) · 3.33 KB
/
jquery.jsPlumb.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
// Type definitions for jsPlumb 1.3.16 jQuery adapter
// Project: http://jsplumb.org
// Definitions by: Steve Shearn <https://github.com/shearnie/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
declare var jsPlumb: jsPlumbInstance;
interface jsPlumbInstance {
setRenderMode(renderMode: string): string;
bind(event: string, callback: (e) => void ): void;
unbind(event?: string): void;
ready(callback: () => void): void;
importDefaults(defaults: Defaults): void;
Defaults: Defaults;
restoreDefaults(): void;
addClass(el: any, clazz: string): void;
addEndpoint(ep: string): any;
removeClass(el: any, clazz: string): void;
hasClass(el: any, clazz: string): void;
draggable(el: string, options?: DragOptions): jsPlumbInstance;
draggable(ids: string[], options?: DragOptions): jsPlumbInstance;
connect(connection: ConnectParams, referenceParams?: ConnectParams): Connection;
makeSource(el: string, options: SourceOptions): void;
makeTarget(el: string, options: TargetOptions): void;
repaintEverything(): void;
detachEveryConnection(): void;
detachAllConnections(el: string): void;
removeAllEndpoints(el: string, recurse?: boolean): jsPlumbInstance;
removeAllEndpoints(el: Element, recurse?: boolean): jsPlumbInstance;
select(params: SelectParams): Connections;
getConnections(options?: any, flat?: any): any[];
deleteEndpoint(uuid: string, doNotRepaintAfterwards?: boolean): jsPlumbInstance;
deleteEndpoint(endpoint: Endpoint, doNotRepaintAfterwards?: boolean): jsPlumbInstance;
repaint(el: string): jsPlumbInstance;
repaint(el: Element): jsPlumbInstance;
getInstance(): jsPlumbInstance;
getInstance(defaults: Defaults): jsPlumbInstance;
getInstanceIndex(): number;
SVG: string;
CANVAS: string;
VML: string;
}
interface Defaults {
Endpoint?: any[];
PaintStyle?: PaintStyle;
HoverPaintStyle?: PaintStyle;
ConnectionsDetachable?: boolean;
ReattachConnections?: boolean;
ConnectionOverlays?: any[][];
Container?: any; // string(selector or id) or element
DragOptions?: DragOptions;
}
interface PaintStyle {
strokeStyle: string;
lineWidth: number;
}
interface ArrowOverlay {
location: number;
id: string;
length: number;
foldback: number;
}
interface LabelOverlay {
label: string;
id: string;
location: number;
}
interface Connections {
detach(): void;
length: number;
}
interface ConnectParams {
source?: any; // string, element or endpoint
target?: any; // string, element or endpoint
detachable?: boolean;
deleteEndpointsOnDetach?: boolean;
endPoint?: string;
anchor?: string;
anchors?: any[];
label?: string;
}
interface DragOptions {
containment?: string;
}
interface SourceOptions {
parent: string;
endpoint?: string;
anchor?: string;
connector?: any[];
connectorStyle?: PaintStyle;
}
interface TargetOptions {
isTarget?: boolean;
maxConnections?: number;
uniqueEndpoint?: boolean;
deleteEndpointsOnDetach?: boolean;
endpoint?: string;
dropOptions?: DropOptions;
anchor?: any;
}
interface DropOptions {
hoverClass: string;
}
interface SelectParams {
scope?: string;
source: string;
target: string;
}
interface Connection {
setDetachable(detachable: boolean): void;
setParameter<T>(name: string, value: T): void;
endpoints: Endpoint[];
}
interface Endpoint {
}