Skip to content

Commit 9d8a032

Browse files
authored
🤖 Merge PR DefinitelyTyped#74798 [@event-calendar/core]Added new methods and options up to version 5.5 by @tmpie
1 parent f086725 commit 9d8a032

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

‎types/event-calendar__core/event-calendar__core-tests.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ cal.removeEventById(345)
4747
end: new Date(Date.now() + 2 * 60 * 60 * 1000),
4848
});
4949
cal.refetchEvents();
50+
cal.refetchResources();
5051
cal.dateFromPoint(0, 0);
5152
cal.getView();
5253
cal.next();
@@ -136,6 +137,7 @@ cal = createCalendar(target, plugins, {
136137
click: () => undefined,
137138
},
138139
},
140+
customScrollbars: true,
139141
date: "1997-04-12",
140142
dateClick: (_info: Calendar.DateClickInfo) => {},
141143
datesAboveResources: false,
@@ -205,18 +207,22 @@ cal = createCalendar(target, plugins, {
205207
height: "100%",
206208
hiddenDays: [2],
207209
highlightedDates: ["2024-01-01", new Date()],
210+
icons: { collapse: { html: "−" }, expand: { html: "+" } },
208211
lazyFetching: true,
209212
listDayFormat: dateFormat,
210213
listDaySideFormat: dateFormat,
211214
loading: (_isLoading: boolean) => {},
212215
locale: "en-US",
213216
longPressDelay: 100,
217+
monthHeaderFormat: { month: "long" },
214218
moreLinkContent: "content",
215219
noEventsClick: (_info: Calendar.NoEventsClickInfo) => {},
216220
noEventsContent: "content",
217221
nowIndicator: true,
218222
pointer: true,
223+
refetchResourcesOnNavigate: true,
219224
resizeConstraint: (_info: Calendar.EventResizeInfo) => true,
225+
resourceExpand: (_info: Calendar.ResourceExpandInfo) => {},
220226
resources: [{ id: "foo" }, { id: "bar", extendedProps: { fred: "barney" } }],
221227
resourceLabelContent: "content",
222228
resourceLabelDidMount: (_info: Calendar.ResourceDidMountInfo) => {},
@@ -237,6 +243,7 @@ cal = createCalendar(target, plugins, {
237243
slotMinTime: 300,
238244
slotMaxTime: "04:00:00",
239245
slotWidth: 100,
246+
snapDuration: 200,
240247
theme: defaultTheme,
241248
titleFormat: dateFormat,
242249
unselect: (_info: Calendar.UnselectInfo) => {},
@@ -275,8 +282,10 @@ cal.setOption("buttonText", () => {
275282
})
276283
.setOption("eventTimeFormat", (_start: Date, _end: Date) => "content")
277284
.setOption("flexibleSlotTimeLimits", { eventFilter: (_ev: Calendar.Event) => false })
285+
.setOption("icons", (_icons: Calendar.Icons) => ({ expand: "content" }))
278286
.setOption("listDayFormat", (_d: Date) => "content")
279287
.setOption("listDaySideFormat", (_d: Date) => "content")
288+
.setOption("monthHeaderFormat", (_date: Date) => "content")
280289
.setOption("moreLinkContent", (_info: Calendar.MoreLinkInfo) => "content")
281290
.setOption("noEventsContent", () => "content")
282291
.setOption("resourceLabelContent", (_info: Calendar.ResourceLabelInfo) => "content")

‎types/event-calendar__core/index.d.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface Calendar {
2727
removeEventById(id: number | string): Calendar;
2828
updateEvent(event: Calendar.Event | Calendar.EventInput): Calendar;
2929
refetchEvents(): Calendar;
30+
refetchResources(): Calendar;
3031
dateFromPoint(x: number, y: number): Calendar.DateClickInfo | null;
3132
getView(): Calendar.View;
3233
next(): Calendar;
@@ -59,6 +60,10 @@ export namespace Calendar {
5960
[key: string]: CustomButton;
6061
}
6162

63+
interface Icons {
64+
[key: string]: Content;
65+
}
66+
6267
interface View {
6368
type: string;
6469
title: string;
@@ -224,6 +229,12 @@ export namespace Calendar {
224229
view: View;
225230
}
226231

232+
interface ResourceExpandInfo {
233+
resource: Resource;
234+
jsEvent: DomEvent;
235+
view: View;
236+
}
237+
227238
interface ResourceLabelInfo {
228239
resource: Resource;
229240
date: Date;
@@ -312,6 +323,7 @@ export namespace Calendar {
312323
buttonText?: ButtonTextMapping | ((text: ButtonTextMapping) => ButtonTextMapping);
313324
columnWidth?: cssLength;
314325
customButtons?: CustomButtons | ((customButtons: CustomButtons) => CustomButtons);
326+
customScrollbars?: boolean;
315327
date?: Date | string | undefined;
316328
dateClick?: (info: DateClickInfo) => void;
317329
datesAboveResources?: boolean;
@@ -364,18 +376,22 @@ export namespace Calendar {
364376
height?: string;
365377
hiddenDays?: dayOfWeek[];
366378
highlightedDates?: Array<isoDateString | Date>;
379+
icons?: Icons | ((icons: Icons) => Icons);
367380
lazyFetching?: boolean;
368381
listDayFormat?: Intl.DateTimeFormatOptions | ((d: Date) => Content);
369382
listDaySideFormat?: Intl.DateTimeFormatOptions | ((d: Date) => Content);
370383
loading?: (isLoading: boolean) => void;
371384
locale?: string;
372385
longPressDelay?: number;
386+
monthHeaderFormat?: Intl.DateTimeFormatOptions | ((date: Date) => Content);
373387
moreLinkContent?: Content | ((info: MoreLinkInfo) => Content);
374388
noEventsClick?: (info: NoEventsClickInfo) => void;
375389
noEventsContent?: Content | (() => Content);
376390
nowIndicator?: boolean;
377391
pointer?: boolean;
392+
refetchResourcesOnNavigate?: boolean;
378393
resizeConstraint?: (info: EventResizeInfo) => boolean;
394+
resourceExpand?: (info: ResourceExpandInfo) => void;
379395
resources?: ResourceInput[];
380396
resourceLabelContent?: Content | ((info: ResourceLabelInfo) => Content);
381397
resourceLabelDidMount?: (info: ResourceDidMountInfo) => void;
@@ -394,6 +410,7 @@ export namespace Calendar {
394410
slotMaxTime?: DurationInput;
395411
slotMinTime?: DurationInput;
396412
slotWidth?: number;
413+
snapDuration?: DurationInput;
397414
theme?: Theme | ((theme: Theme) => Theme);
398415
titleFormat?: Intl.DateTimeFormatOptions | ((start: Date, end: Date) => Content);
399416
unselect?: (info: UnselectInfo) => void;

‎types/event-calendar__core/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"type": "module",
44
"name": "@types/event-calendar__core",
5-
"version": "5.0.9999",
5+
"version": "5.5.9999",
66
"projects": [
77
"https://vkurko.github.io/calendar/"
88
],

0 commit comments

Comments
 (0)