Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#70792 Add new options for @event-calendar/…
Browse files Browse the repository at this point in the history
…core v3.5 and v3.6 by @syncsynchalt
  • Loading branch information
syncsynchalt authored Oct 28, 2024
1 parent a5d04c1 commit 08f56a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions types/event-calendar__core/event-calendar__core-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ cal = new Calendar({
eventStartEditable: true,
eventTimeFormat: dateFormat,
eventTextColor: "yellow",
filterEventsWithResources: true,
filterResourcesWithEvents: false,
firstDay: 0,
flexibleSlotTimeLimits: true,
Expand All @@ -203,7 +204,7 @@ cal = new Calendar({
noEventsContent: "content",
nowIndicator: true,
pointer: true,
resources: [{ id: "foo" }, { id: "bar" }],
resources: [{ id: "foo" }, { id: "bar", extendedProps: { fred: "barney" } }],
resourceLabelContent: "content",
resourceLabelDidMount: (_info: Calendar.ResourceDidMountInfo) => {},
select: (_info: Calendar.SelectInfo) => {},
Expand Down Expand Up @@ -267,7 +268,7 @@ cal.setOption("buttonText", () => {
})
.setOption("titleFormat", (_s: Date, _e: Date) => "content")
.setOption("views", { resourceTimeGrid: { selectMinDistance: 300 } })
.setOption("buttonText", (text) => {
.setOption("buttonText", (text: Calendar.ButtonTextMapping) => {
return { ...text, foo: "bar" };
});

Expand All @@ -281,6 +282,7 @@ let validResource: Calendar.Resource = {
title: "content",
eventBackgroundColor: undefined,
eventTextColor: undefined,
extendedProps: { a: 1, b: "two", c: [] },
};
const { title, ...rest } = validResource;
// @ts-expect-error
Expand Down
3 changes: 3 additions & 0 deletions types/event-calendar__core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ declare namespace Calendar {
title?: Content;
eventBackgroundColor?: string;
eventTextColor?: string;
extendedProps?: Record<string, unknown>;
}

interface Resource {
id: string;
title: Content;
eventBackgroundColor: string | undefined;
eventTextColor: string | undefined;
extendedProps: Record<string, unknown>;
}

type durationHMS = string;
Expand Down Expand Up @@ -312,6 +314,7 @@ declare namespace Calendar {
eventStartEditable?: boolean;
eventTimeFormat?: Intl.DateTimeFormatOptions | ((start: Date, end: Date) => Content);
eventTextColor?: string;
filterEventsWithResources?: boolean;
filterResourcesWithEvents?: boolean;
firstDay?: dayOfWeek;
flexibleSlotTimeLimits?: boolean | { eventFilter: (e: Event) => boolean };
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": "3.4.9999",
"version": "3.6.9999",
"projects": [
"https://vkurko.github.io/calendar/"
],
Expand Down

0 comments on commit 08f56a2

Please sign in to comment.