forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.window.d.ts
460 lines (445 loc) · 12.3 KB
/
jquery.window.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
// Type definitions for Window plugin for jQuery 5.0.4
// Project: http://fstoke.me/jquery/window/
// Definitions by: Ryan Graham <https://github.com/ryan-codingintrigue/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
declare module JQueryWindow {
// Instance methods
interface Window {
/**
get window id
**/
getWindowId(): string;
/**
get window container's parent panel, it's a jQuery object
**/
getCaller(): JQuery;
/**
get window container panel, it's a jQuery object
**/
getContainer(): JQuery;
/**
get window header panel, it's a jQuery object
**/
getHeader(): JQuery;
/**
get window frame panel, it's a jQuery object
**/
getFrame(): JQuery;
/**
get window footer panel, it's a jQuery object
**/
getFooter(): JQuery;
/**
set current window as screen center
**/
alignCenter(): void;
/**
set current window as horizontal center
**/
alignHorizontalCenter(): void;
/**
set current window as vertical center
**/
alignVerticalCenter(): void;
/**
select current window, it will increase the original z-index value with 2
**/
select(): void;
/**
unselect current window, it will set the z-index as original options.z
**/
unselect(): void;
/**
move current window to target position or shift it by passed distance
**/
move(x: number, y: number, bShift: boolean): void;
/**
resize current window to target width/height
**/
resize(width: number, height: number): void;
/**
maximize current window
**/
maximize(): void;
/**
minimize current window
**/
minimize(): void;
/**
restore current window, it could be maximized or cascade status
**/
restore(): void;
/**
close current window
**/
close(quiet: boolean): void;
/**
hide current window
**/
hide(): void;
/**
show current window
**/
show(): void;
/**
change window title
**/
setTitle(title: string): void;
/**
change iframe url
**/
setUrl(url: string): void;
/**
change frame content
**/
setContent(content: string|JQuery|HTMLElement): void;
/**
change footer content
**/
setFooterContent(content: string|JQuery|HTMLElement): void;
/**
get window title text
**/
getTitle(): string;
/**
get url string
**/
getUrl(): string;
/**
get frame html content
**/
getContent(): string;
/**
get footer html content
**/
getFooterContent(): string;
/**
get window maximized status
**/
isMaximized(): boolean;
/**
get window minmized status
**/
isMinimized(): boolean;
/**
get window selected status
**/
isSelected(): boolean;
/**
set window icon
**/
setIcon(iconUrl: string): void;
/**
show window icon
**/
showIcon(): void;
/**
hide window icon
**/
hideIcon(): void;
}
// Static methods
interface Static {
(options: WindowOptions): JQueryWindow.Window;
/**
initialize with customerized static setting attributes
**/
prepare(options?: StaticOptions): void;
/**
close all created windows
**/
closeAll(quiet?: boolean): void;
/**
hide all created windows
**/
hideAll(): void;
/**
show all created windows
**/
showAll(): void;
/**
return all created windows instance
**/
getAll(): Array<JQueryWindow.Window>;
/**
get the window instance by passed window id
**/
getWindow(windowId: string): JQueryWindow.Window;
/**
get the selected window instance
**/
getSelectedWindow(): JQueryWindow.Window;
}
// Static options
interface StaticOptions {
/**
the direction of minimized window dock at. the available values are [left, right, top, bottom]
**/
dock?: string;
/**
the area which the windows will dock at
**/
dockArea?: JQuery|HTMLElement;
/**
the speed of animations: maximize, minimize, restore, shift, in milliseconds
**/
animationSpeed?: number;
/**
the narrow dimension of minimized window
**/
minWinNarrow?: number;
/**
the long dimension of minimized window
**/
minWinLong?: number;
/**
to handle browser scrollbar when window status changed(maximize, minimize, cascade)
**/
handleScrollbar?: boolean;
/**
to decide show log in firebug, IE8, chrome console
**/
showLog?: boolean;
}
// Instance options
interface WindowOptions {
/**
an icon image url string. if this attribute is given, it will force to replace the original favicon of remote page on window. or you can set it as null to hide icon.
**/
icon?: string;
/**
the title text of window
**/
title: string;
/**
the target url of iframe ready to load.
**/
url?: string;
/**
this attribute only works when url is null. when passing a jquery object or a element, it will clone the original one to append.
**/
content?: string|JQuery|HTMLElement;
/**
same as content attribute, but it's put on footer panel.
**/
footerContent?: string|JQuery|HTMLElement;
/**
container extra class
**/
containerClass?: string;
/**
header extra class
**/
headerClass?: string;
/**
frame extra class
**/
frameClass?: string;
/**
footer extra class
**/
footerClass?: string;
/**
selected header extra class
**/
selectedHeaderClass?: string;
/**
the x-axis value on screen(or caller element), if -1 means put on screen(or caller element) center
**/
x?: number;
/**
the y-axis value on screen(or caller element), if -1 means put on screen(or caller element) center
**/
y?: number;
/**
the css z-index value
**/
z?: number;
/**
window width
**/
width?: number;
/**
window height
**/
height?: number;
/**
the minimum width, if -1 means no checking
**/
minWidth?: number;
/**
the minimum height, if -1 means no checking
**/
minHeight?: number;
/**
the maximum width, if -1 means no checking
**/
maxWidth?: number;
/**
the maximum height, if -1 means no checking
**/
maxHeight?: number;
/**
to control show modal on background
**/
showModal?: boolean;
/**
the opacity of modal dialog
**/
modalOpacity?: number;
/**
to control show footer panel
**/
showFooter?: boolean;
/**
to control display window as round corner
**/
showRoundCorner?: boolean;
/**
to control window closable
**/
closable?: boolean;
/**
to control window minimizable
**/
minimizable?: boolean;
/**
to control window maximizable
**/
maximizable?: boolean;
/**
to control window with remote url could be bookmarked
**/
bookmarkable?: boolean;
/**
to control window draggable
**/
draggable?: boolean;
/**
to control window resizable
**/
resizable?: boolean;
/**
to show scroll bar or not
**/
scrollable?: boolean;
/**
to check window dialog overflow html body or caller element
**/
checkBoundary?: boolean;
/**
to limit window only can be dragged within browser window. this attribute only works when checkBoundary is true and caller is null.
**/
withinBrowserWindow?: boolean;
/**
to describe the customized button display and callback function
**/
custBtns?: Array<JQueryWindow.Button>;
/**
a callback function while container is added into body
**/
onOpen?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while whole window display routine is finished
**/
onShow?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while user click close button
**/
onClose?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while user select the window
**/
onSelect?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while window unselected
**/
onUnselect?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while window is going to drag
**/
onDrag?: (wnd: JQueryWindow.Window) => void;
/**
a callback function after window dragged
**/
afterDrag?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while window is going to resize
**/
onResize?: (wnd: JQueryWindow.Window) => void;
/**
a callback function after window resized
**/
afterResize?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while window is going to minimize
**/
onMinimize?: (wnd: JQueryWindow.Window) => void;
/**
a callback function after window minimized
**/
afterMinimize?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while window is going to maximize
**/
onMaximize?: (wnd: JQueryWindow.Window) => void;
/**
a callback function after window maximized
**/
afterMaximize?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while window is going to cascade
**/
onCascade?: (wnd: JQueryWindow.Window) => void;
/**
a callback function after window cascaded
**/
afterCascade?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while iframe ready to connect remoting url. this attribute only works while url attribute is given
**/
onIframeStart?: (wnd: JQueryWindow.Window) => void;
/**
a callback function while iframe load finished. this attribute only works while url attribute is given
**/
onIframeEnd?: (wnd: JQueryWindow.Window) => void;
/**
if null means no check, or pass a string to show warning message while iframe is going to redirect current top page
**/
iframeRedirectCheckMsg?: string;
/**
random the new created window position, it only works when options x,y value both are -1
**/
createRandomOffset?: { x: number; y: number };
}
// Button definition
interface Button {
/**
**/
id: string;
/**
**/
title?: string;
/**
**/
clazz?: string;
/**
**/
style?: string;
/**
**/
image: string;
/**
**/
callback: (btn: JQueryWindow.Button, wnd: JQueryWindow.Window) => void;
}
}
// Register with JQuery instance
interface JQuery {
window(options: JQueryWindow.WindowOptions): JQueryWindow.Window;
}
// Register with JQuery static
interface JQueryStatic {
window: JQueryWindow.Static;
}