Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions types/event-calendar__core/event-calendar__core-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const dateFormat: Intl.DateTimeFormatOptions = {
day: "numeric",
};

// exact details of theme aren't checked by typescript, but at least test with realistic theme data
const defaultTheme = {
allDay: "ec-all-day",
active: "ec-active",
Expand All @@ -80,6 +81,7 @@ const defaultTheme = {
daySide: "ec-day-side",
draggable: "ec-draggable",
dragging: "ec-dragging",
endClipped: "ec-end-clipped",
event: "ec-event",
eventBody: "ec-event-body",
eventTag: "ec-event-tag",
Expand Down Expand Up @@ -109,6 +111,7 @@ const defaultTheme = {
selecting: "ec-selecting",
sidebar: "ec-sidebar",
sidebarTitle: "ec-sidebar-title",
startClipped: "ec-start-clipped",
today: "ec-today",
time: "ec-time",
times: "ec-times",
Expand Down Expand Up @@ -247,6 +250,7 @@ cal = createCalendar(target, plugins, {
slotWidth: 100,
snapDuration: 200,
theme: defaultTheme,
timeZone: "+02:00",
titleFormat: dateFormat,
unselect: (_info: Calendar.UnselectInfo) => {},
unselectAuto: true,
Expand Down Expand Up @@ -313,12 +317,21 @@ cal.setOption("buttonText", () => {
}
return result;
})
.setOption("timeZone", "UTC")
.setOption("titleFormat", (_s: Date, _e: Date) => "content")
.setOption("views", { resourceTimeGrid: { selectMinDistance: 300 } })
.setOption("buttonText", (text: Calendar.ButtonTextMapping) => {
return { ...text, foo: "bar" };
});

// define a custom view while inheriting options from a standard view
cal.setOption("views", {
resourceTimelineThreeDays: {
type: "resourceTimelineDay",
duration: { days: 3 },
},
});

// check some invalid combinations for FooInput and Foo types
// @ts-expect-error
let _incompleteEvent: Calendar.Event = { id: "123" };
Expand Down
4 changes: 4 additions & 0 deletions types/event-calendar__core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface Calendar {
refetchResources(): Calendar;
dateFromPoint(x: number, y: number): Calendar.DateClickInfo | null;
getView(): Calendar.View;
gotoDate(date: Date | Calendar.isoDateString): Calendar;
next(): Calendar;
prev(): Calendar;
unselect(): Calendar;
Expand Down Expand Up @@ -305,6 +306,7 @@ export namespace Calendar {
end: Date;
startStr: string;
endStr: string;
timeZone: string;
}

type EventSourceFunc = (
Expand Down Expand Up @@ -423,7 +425,9 @@ export namespace Calendar {
slotWidth?: number;
snapDuration?: DurationInput;
theme?: Theme | ((theme: Theme) => Theme);
timeZone?: string;
titleFormat?: Intl.DateTimeFormatOptions | ((start: Date, end: Date) => Content);
type?: string;
unselect?: (info: UnselectInfo) => void;
unselectAuto?: boolean;
unselectCancel?: string;
Expand Down
2 changes: 1 addition & 1 deletion types/event-calendar__core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"type": "module",
"name": "@types/event-calendar__core",
"version": "5.6.9999",
"version": "5.9.9999",
"projects": [
"https://vkurko.github.io/calendar/"
],
Expand Down
Loading