forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fullCalendar.d.ts
400 lines (332 loc) · 12.5 KB
/
fullCalendar.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
// Type definitions for FullCalendar 1.6.1
// Project: http://arshaw.com/fullcalendar/
// Definitions by: Neil Stalker <https://github.com/nestalk>, Marcelo Camargo <https://github.com/hasellcamargo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
declare module FullCalendar {
export interface Calendar {
/**
* Formats a Date object into a string.
*/
formatDate(date: Date, format: string, options?: Options): string;
/**
* Formats a date range (two Date objects) into a string.
*/
formatDates(date1: Date, date2: Date, format: string, options?: Options): string;
/**
* Parses a string into a Date object.
*/
parseDate(dateString: string, ignoreTimezone?: boolean): Date;
/**
* Parses an ISO8601 string into a Date object.
*/
parseISO8601(dateString: string, ignoreTimezone?: boolean): Date;
/**
* Gets the version of Fullcalendar
*/
version: string;
}
export interface Options {
// General display - http://arshaw.com/fullcalendar/docs/display/
header?: {
left: string;
center: string;
right: string;
}
theme?: boolean
buttonIcons?: {
prev: string;
next: string;
}
firstDay?: number;
isRTL?: boolean;
weekends?: boolean;
hiddenDays?: number[];
weekMode?: string;
weekNumbers?: boolean;
weekNumberCalculation?: any; // String/Function
height?: number;
contentHeight?: number;
aspectRatio?: number;
handleWindowResize?: boolean;
viewRender?: (view: View, element: JQuery) => void;
viewDestroy?: (view: View, element: JQuery) => void;
dayRender?: (date: Date, cell: HTMLTableDataCellElement) => void;
windowResize?: (view: View) => void;
// Views - http://arshaw.com/fullcalendar/docs/views/
defaultView?: string;
// Current Date - http://arshaw.com/fullcalendar/docs/current_date/
year?: number;
month?: number;
date?: number;
// Text/Time Customization - http://arshaw.com/fullcalendar/docs/text/
timeFormat?: any; // String/ViewOptionHash
columnFormat?: any; // String/ViewOptionHash
titleFormat?: any; // String/ViewOptionHash
buttonText?: ButtonTextObject;
monthNames?: Array<string>;
monthNamesShort?: Array<string>;
dayNames?: Array<string>;
dayNamesShort?: Array<string>;
weekNumberTitle?: string;
// Clicking & Hovering - http://arshaw.com/fullcalendar/docs/mouse/
dayClick?: (date: Date, allDay: boolean, jsEvent: MouseEvent, view: View) => void;
eventClick?: (event: EventObject, jsEvent: MouseEvent, view: View) => any; // return type boolean or void
eventMouseover?: (event: EventObject, jsEvent: MouseEvent, view: View) => void;
eventMouseout?: (event: EventObject, jsEvent: MouseEvent, view: View) => void;
// Selection - http://arshaw.com/fullcalendar/docs/selection/
selectable?: any; // Boolean/ViewOptionHash
selectHelper?: any; // Boolean/Function
unselectAuto?: boolean;
unselectCancel?: string;
select?: (startDate: Date | string, endDate: Date | string, allDay: boolean, jsEvent: MouseEvent, view: View) => void;
unselect?: (view: View, jsEvent: Event) => void;
// Event Data - http://arshaw.com/fullcalendar/docs/event_data/
/**
* This has one of the following types:
*
* - EventObject[]
* - string (JSON feed)
* - (start: Date | string, end: Date | string, callback: {(events: EventObject[]) => void;}) => void;
*/
events?: any;
/**
* An array, each element being one of the following types:
*
* - EventSource
* - EventObject[]
* - string (JSON feed)
* - (start: Date | string, end: Date | string, callback: {(events: EventObject[]) => void;}) => void;
*/
eventSources?: any[];
allDayDefault?: boolean;
ignoreTimezone?: boolean;
startParam?: string;
endParam?: string
lazyFetching?: boolean;
eventDataTransform?: (eventData: any) => EventObject;
loading?: (isLoading: boolean, view: View) => void;
// Event Rendering - http://arshaw.com/fullcalendar/docs/event_rendering/
eventColor?: string;
eventBackgroundColor?: string;
eventBorderColor?: string;
eventTextColor?: string;
eventRender?: (event: EventObject, element: HTMLDivElement, view: View) => void;
eventAfterRender?: (event: EventObject, element: HTMLDivElement, view: View) => void;
eventAfterAllRender?: (view: View) => void;
eventDestroy?: (event: EventObject, element: JQuery, view: View) => void;
// Event Dragging & Resizing
editable?: boolean;
eventStartEditable?: boolean;
eventDurationEditable?: boolean;
dragRevertDuration?: number;
dragOpacity?: any; // Float/ViewOptionHash
eventDragStart?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: View) => void;
eventDragStop?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: View) => void;
eventDrop?: (event: EventObject, dayDelta: number, minuteDelta: number, revertFunc: Function, jsEvent: Event, ui: any, view: View) => void;
eventResizeStart?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: View) => void;
eventResizeStop?: (event: EventObject, jsEvent: MouseEvent, ui: any, view: View) => void;
eventResize?: (event: EventObject, dayDelta: number, minuteDelta: number, revertFunc: Function, jsEvent: Event, ui: any, view: View) => void;
droppable?: boolean;
dropAccept?: any; // String/Function
drop?: (date: Date, allDay: boolean, jsEvent: MouseEvent, ui: any) => void;
}
export interface View {
name: string;
title: string;
start: Date | string;
end: Date | string;
visStart: Date;
visEnd: Date;
}
export interface ViewOptionHash {
month?: any;
week?: any;
day?: any;
agenda?: any;
agendaDay?: any;
agendaWeek?: any;
basic?: any;
basicDay?: any;
basicWeek?: any;
''?: any;
}
/**
* Agenda Options - http://arshaw.com/fullcalendar/docs/agenda/
*/
export interface AgendaOptions {
allDaySlot?: boolean;
allDayText?: string;
axisFormat?: string;
slotMinutes?: number;
snapMinutes?: number;
defaultEventMinutes?: number;
firstHour?: number;
minTime?: any; // Integer/String
maxTime?: any; // Integer/String
slotEventOverlap?: boolean;
}
export interface ButtonTextObject {
prev?: string;
next?: string;
prevYear?: string;
nextYear?: string;
today?: string;
month?: string;
week?: string;
day?: string;
}
export interface EventObject {
id?: any // String/number
title: string;
allDay?: boolean;
start: Date | string;
end?: Date | string;
url?: string;
className?: any; // string/Array<string>
editable?: boolean;
source?: EventSource;
color?: string;
backgroundColor?: string;
borderColor?: string;
textColor?: string;
}
export interface EventSource extends JQueryAjaxSettings {
/**
* This has one of the following types:
*
* - EventObject[]
* - string (JSON feed)
* - (start: Date | string, end: Date | string, callback: {(events: EventObject[]) => void;}) => void;
*/
events?: any;
color?: string;
backgroundColor?: string;
borderColor?: string;
textColor?: string;
className?: any; // string/Array<string>
editable?: boolean;
allDayDefault?: boolean;
ignoreTimezone?: boolean;
eventTransform?: any;
startParam?: string;
endParam?: string
}
}
interface JQuery {
/**
* Get/Set option value
*/
fullCalendar(method: 'option', option: string, value?: any): void;
/**
* Immediately forces the calendar to render and/or readjusts its size.
*/
fullCalendar(method: 'render'): void;
/**
* Restores the element to the state before FullCalendar was initialized.
*/
fullCalendar(method: 'destroy'): void;
/**
* Returns the View Object for the current view.
*/
fullCalendar(method: 'getView'): FullCalendar.View;
/**
* Immediately switches to a different view.
*/
fullCalendar(method: 'changeView', viewName: string): void;
/**
* Moves the calendar one step back (either by a month, week, or day).
*/
fullCalendar(method: 'prev'): void;
/**
* Moves the calendar one step forward (either by a month, week, or day).
*/
fullCalendar(method: 'next'): void;
/**
* Moves the calendar back one year.
*/
fullCalendar(method: 'prevYear'): void;
/**
* Moves the calendar forward one year.
*/
fullCalendar(method: 'nextYear'): void;
/**
* Moves the calendar to the current date.
*/
fullCalendar(method: 'today'): void;
/**
* Moves the calendar to an arbitrary year/month/date.
*/
fullCalendar(method: 'gotoDate', year: number, month?: number, date?: number): void;
/**
* Moves the calendar to an arbitrary date.
*/
fullCalendar(method: 'gotoDate', date: Date | string): void;
/**
* Moves the calendar forward/backward an arbitrary amount of time.
*/
fullCalendar(method: 'incrementDate', year: number, month?: number, date?: number): void;
/**
* Returns a Date object for the current date of the calendar.
*/
fullCalendar(method: 'getDate'): Date;
/**
* A method for programmatically selecting a period of time.
*/
fullCalendar(method: 'select', startDate: Date, endDate: Date, allDay: boolean): void;
/**
* A method for programmatically clearing the current selection.
*/
fullCalendar(method: 'unselect'): void;
/**
* Reports changes to an event and renders them on the calendar.
*/
fullCalendar(method: 'updateEvent', event: FullCalendar.EventObject): void;
/**
* Retrieves events that FullCalendar has in memory.
*/
fullCalendar(method: 'clientEvents', idOrfilter?: any): Array<FullCalendar.EventObject>;
/**
* Retrieves events that FullCalendar has in memory.
*/
fullCalendar(method: 'clientEvents', idOrfilter?: (e: FullCalendar.EventObject) => boolean): Array<FullCalendar.EventObject>;
/**
* Removes events from the calendar.
*/
fullCalendar(method: 'removeEvents', idOrfilter?: any): void;
/**
* Removes events from the calendar.
*/
fullCalendar(method: 'removeEvents', idOrfilter?: (e: FullCalendar.EventObject) => boolean): void;
/**
* Refetches events from all sources and rerenders them on the screen.
*/
fullCalendar(method: 'refetchEvents'): void;
/**
* Dynamically adds an event source.
*/
fullCalendar(method: 'addEventSource', source: any): void;
/**
* Dynamically removes an event source.
*/
fullCalendar(method: 'removeEventSource', source: any): void;
/**
* Renders a new event on the calendar.
*/
fullCalendar(method: 'renderEvent', event: FullCalendar.EventObject, stick?: boolean): void;
/**
* Rerenders all events on the calendar.
*/
fullCalendar(method: 'rerenderEvents'): void;
/**
* Create calendar object
*/
fullCalendar(options: FullCalendar.Options): JQuery;
/**
* Generic method function
*/
fullCalendar(method: string, arg1: any, arg2: any, arg3: any): void;
}
interface JQueryStatic {
fullCalendar: FullCalendar.Calendar;
}