forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lobibox.d.ts
197 lines (188 loc) · 9.03 KB
/
lobibox.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
// Type definitions for lobibox 1.0.1
// Project: https://github.com/arboshiki/lobibox
// Definitions by: Sabeeh Ul Hussnain <https://github.com/itboy87>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var Lobibox: LobiboxModule.LobiboxStatic;
declare module "Lobibox" {
export = Lobibox;
}
declare module LobiboxModule {
interface MessageBoxesDefault {
title? : string;
horizontalOffset?: number;
width? : number;
height? : string; // Height is automatically given calculated by width
closeButton? : boolean; // Show close button or not
draggable? : boolean; // Make messagebox draggable
customBtnClass? : string; // Class for custom buttons
modal? : boolean;
debug? : boolean;
buttonsAlign? : string; // Position where buttons should be aligned
closeOnEsc? : boolean; // Close messagebox on Esc press
delayToRemove? : number;
baseClass? : string;
showClass? : string;
hideClass? : string;
msg? : string;
// methods
hide? (): MessageBoxesDefault;
show? (): MessageBoxesDefault;
setWidth? (width?: number): MessageBoxesDefault;
setHeight? (height?: number): MessageBoxesDefault;
setSize? (width?: number, height?: number): MessageBoxesDefault;
setPosition? (left?: number|string, top?: number): MessageBoxesDefault;
setTitle? (title?: string): MessageBoxesDefault;
getTitle? (): string;
// events
// when messagebox show is called but before it is actually shown
onShow? (lobibox:any): void ;
// after messagebox is shown
shown? (lobibox:any): void;
// when messagebox remove method is called but before it is actually hidden
beforeClose? (lobibox:any): void;
// after messagebox is hidden
closed? (lobibox:any): void;
}
interface MessageBoxesOptions extends MessageBoxesDefault {
bodyClass? : string;
modalClasses? : {
'error'? : string,
'success'? : string,
'info'? : string,
'warning'? : string,
'confirm'? : string,
'progress'? : string,
'prompt'? : string,
'default'? : string,
'window'? : string
},
buttonsAlign?: any;
buttons?: {
ok?: {
'class'?: string,
text?: string,
closeOnClick?: boolean
},
cancel?: {
'class'?: string,
text?: string,
closeOnClick?: boolean
},
yes?: {
'class'?: string,
text?: string,
closeOnClick?: boolean
},
no?: {
'class'?: string,
text?: string,
closeOnClick?: boolean
},
}|any;
callback? (lobibox:any, type?:string, ev?: any): void;
}
interface ConfirmOptions extends MessageBoxesOptions {
title? : string;
width? : number;
iconClass? : string;
}
interface PromptOptions extends MessageBoxesOptions, PromptMethods {
width?: number;
attrs?: any; // Object of any valid attribute of input field
value?: string; // Value which is given to textfield when messagebox is created
multiline?: boolean; // Set this true for multiline prompt
lines?: number; // This works only for multiline prompt. Number of lines
type?: string; // Prompt type. Available types (text|number|color)
label?: string; // Set some text which will be shown exactly on top of textfield
}
interface AlertOptions extends MessageBoxesOptions {
warning?: {
title?: string,
iconClass?: string // Change warning alert icon globally
};
info?:{
title?: string,
iconClass?: string // Change info alert icon globally
};
success?: {
title?: string,
iconClass?: string // Change success alert icon globally
};
error?: {
title?: string,
iconClass?: string // Change error alert icon globally
};
}
interface ProgressOptions extends MessageBoxesOptions, ProgressMethods, ProgressEvents {
width? : number;
showProgressLabel? : boolean; // Show percentage of progress
label? : string; // Show progress label
progressTpl? : boolean; //Template of progress bar
//Events
progressUpdated? : any;
progressCompleted? : any;
}
interface WindowOptions extends MessageBoxesOptions {
width? : number;
height? : any;
content? : any; // HTML Content of window
url? : string; // URL which will be used to load content
draggable? : boolean; // Override default option
autoload? : boolean; // Auto load from given url when window is created
loadMethod? : string; // Ajax method to load content
showAfterLoad? : boolean; // Show window after content is loaded or show and then load content
params? : {}; // Parameters which will be send by ajax for loading content
}
interface ProgressEvents {
progressUpdated? (lobibox:LobiboxStatic): void;
progressComplete? (lobibox:LobiboxStatic): void;
}
interface PromptMethods {
setValue? (val?:string): PromptMethods;
getValue? (): string;
}
interface ProgressMethods {
setProgress? (progress:number): ProgressMethods;
getProgress? (): number;
}
interface NotifyDefault {
title?: boolean; // Title of notification. If you do not include the title in options it will automatically takes its value
//from Lobibox.notify.OPTIONS object depending of the type of the notifications or set custom string. Set this false to disable title
size?: string; // normal, mini, large
soundPath?: string; // The folder path where sounds are located
soundExt?: string; // Default extension for all sounds
showClass?: string; // Show animation class.
hideClass?: string; // Hide animation class.
icon?: boolean; // Icon of notification. Leave as is for default icon or set custom string
msg?: string; // Message of notification
img?: string; // Image source string
closable?: boolean; // Make notifications closable
delay?: number; // Hide notification after this time (in miliseconds)
delayIndicator?: boolean; // Show timer indicator
closeOnClick?: boolean; // Close notifications by clicking on them
width?: number; // Width of notification box
sound?: boolean; // Sound of notification. Set this false to disable sound. Leave as is for default sound or set custom soud path
position?: string; // Place to show notification. Available options: "top left", "top right", "bottom left", "bottom right"
}
interface NotifyOptions extends NotifyDefault, NotifyMethods {
'class'?: string; //You can override options for large notifications from here
large?: {width?: number}; //You can override options for small notifications from here
mini?: {'class'?: string}; //Default options of different style notifications
success?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string};
error?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string};
warning?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string};
info?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string};
}
interface NotifyMethods {
remove? (): any;
}
interface LobiboxStatic {
base: {OPTIONS: MessageBoxesOptions, DEFAULTS: MessageBoxesDefault};
alert: {<T extends MessageBoxesDefault>(type: string, options?: T): LobiboxStatic, DEFAULTS: AlertOptions};
prompt: {<T extends MessageBoxesDefault>(type: string, options?: T): LobiboxStatic, DEFAULTS: PromptOptions};
confirm: {<T extends MessageBoxesDefault>(options?: ConfirmOptions): T, DEFAULTS: ConfirmOptions};
progress: {<T extends MessageBoxesDefault>(options: ProgressOptions): T, DEFAULTS: ProgressOptions};
window: {<T extends MessageBoxesDefault>(options: WindowOptions): T, DEFAULTS: WindowOptions};
notify: {<T extends NotifyDefault>(type: string, options?: NotifyOptions): T, DEFAULTS?: NotifyDefault,OPTIONS?:NotifyOptions};
}
}