calendarkit-pro 1.2.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -2
- package/dist/index.d.mts +50 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +1461 -977
- package/dist/index.mjs +1371 -884
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -84,7 +84,9 @@ function MyCalendar() {
|
|
|
84
84
|
| `onEventCreate` | `(event: Partial<CalendarEvent>) => void` | Event creation callback |
|
|
85
85
|
| `onEventUpdate` | `(event: CalendarEvent) => void` | Event update callback |
|
|
86
86
|
| `onEventDelete` | `(eventId: string) => void` | Event deletion callback |
|
|
87
|
-
| `
|
|
87
|
+
| `onEventDrop` | `(event, start, end) => void` | Called when an event is dropped (with the event before the move and its new dates), alongside `onEventUpdate` |
|
|
88
|
+
| `onEventResize` | `(event, start, end) => void` | Called when an event is resized, alongside `onEventUpdate` (both fire, so update your state in only one of them) |
|
|
89
|
+
| `onOccurrenceDelete` | `(occurrence, updatedSeries) => void` | Delete a single occurrence of a recurring event: persist `updatedSeries` (it has the date in `recurrence.exdates`). Without it, deleting an occurrence deletes the series |
|
|
88
90
|
| `calendars` | `Calendar[]` | Multiple calendar support |
|
|
89
91
|
| `resources` | `Resource[]` | Resources for resource view |
|
|
90
92
|
| `eventTypes` | `EventType[]` | Pre-defined event types |
|
|
@@ -125,7 +127,8 @@ interface CalendarEvent {
|
|
|
125
127
|
interval?: number;
|
|
126
128
|
count?: number;
|
|
127
129
|
until?: Date;
|
|
128
|
-
byweekday?: number[];
|
|
130
|
+
byweekday?: number[]; // 0 = Monday … 6 = Sunday
|
|
131
|
+
exdates?: Date[]; // occurrence starts excluded from the series
|
|
129
132
|
};
|
|
130
133
|
}
|
|
131
134
|
```
|
|
@@ -192,6 +195,25 @@ const recurringEvent: CalendarEvent = {
|
|
|
192
195
|
};
|
|
193
196
|
```
|
|
194
197
|
|
|
198
|
+
Occurrences keep their wall-clock time across daylight-saving changes, in the `timezone` prop's zone (or the browser's).
|
|
199
|
+
|
|
200
|
+
Moving, resizing or editing one occurrence updates the whole series by the same amount (`onEventUpdate` receives the recurring event). To delete a single occurrence, handle `onOccurrenceDelete`:
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
<Scheduler
|
|
204
|
+
events={events}
|
|
205
|
+
onOccurrenceDelete={(occurrence, updatedSeries) => {
|
|
206
|
+
setEvents(events.map(e => (e.id === updatedSeries.id ? updatedSeries : e)));
|
|
207
|
+
}}
|
|
208
|
+
/>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Invalid data
|
|
212
|
+
|
|
213
|
+
Dates may be `Date` objects, ISO strings or timestamps. Events with an invalid date or an end before their start are skipped, with a warning in development. Event ids must be unique (duplicates are rendered but warned about, and break drag & drop).
|
|
214
|
+
|
|
215
|
+
Treat events as immutable: to change an event, pass a new object (`events.map(e => e.id === id ? { ...e, title } : e)`). Computations are cached per event object, so mutating an event in place may not be reflected.
|
|
216
|
+
|
|
195
217
|
## Timezone Support
|
|
196
218
|
|
|
197
219
|
```tsx
|
|
@@ -223,6 +245,10 @@ const frenchTranslations = {
|
|
|
223
245
|
/>
|
|
224
246
|
```
|
|
225
247
|
|
|
248
|
+
All interface texts (views, event form, sidebar, accessible labels) come from the language pack selected by `language`; `translations` overrides individual keys. Calendars are only listed in the sidebar when you pass `calendars`.
|
|
249
|
+
|
|
250
|
+
Right-click an event to edit, duplicate or delete it (disabled in `readOnly`).
|
|
251
|
+
|
|
226
252
|
## Theming
|
|
227
253
|
|
|
228
254
|
```tsx
|
package/dist/index.d.mts
CHANGED
|
@@ -70,6 +70,44 @@ declare const en: {
|
|
|
70
70
|
noEventsScheduled: string;
|
|
71
71
|
noUpcoming: string;
|
|
72
72
|
noUpcomingHint: string;
|
|
73
|
+
newEvent: string;
|
|
74
|
+
saveChanges: string;
|
|
75
|
+
close: string;
|
|
76
|
+
noTitle: string;
|
|
77
|
+
openInMaps: string;
|
|
78
|
+
notesLabel: string;
|
|
79
|
+
addNotes: string;
|
|
80
|
+
attachments: string;
|
|
81
|
+
reminders: string;
|
|
82
|
+
add: string;
|
|
83
|
+
calendar: string;
|
|
84
|
+
select: string;
|
|
85
|
+
addLocation: string;
|
|
86
|
+
guestSingular: string;
|
|
87
|
+
addGuestPlaceholder: string;
|
|
88
|
+
invalidEmail: string;
|
|
89
|
+
removeGuest: string;
|
|
90
|
+
reminderAtTime: string;
|
|
91
|
+
reminderMinutes: string;
|
|
92
|
+
reminderHour: string;
|
|
93
|
+
reminderHours: string;
|
|
94
|
+
reminderDay: string;
|
|
95
|
+
reminderDays: string;
|
|
96
|
+
reminderWeek: string;
|
|
97
|
+
removeReminder: string;
|
|
98
|
+
durationMinutes: string;
|
|
99
|
+
durationHours: string;
|
|
100
|
+
durationHoursMinutes: string;
|
|
101
|
+
moreEvents: string;
|
|
102
|
+
idLabel: string;
|
|
103
|
+
previous: string;
|
|
104
|
+
next: string;
|
|
105
|
+
previousMonth: string;
|
|
106
|
+
nextMonth: string;
|
|
107
|
+
toggleSidebar: string;
|
|
108
|
+
toggleTheme: string;
|
|
109
|
+
switchLanguage: string;
|
|
110
|
+
eventColor: string;
|
|
73
111
|
};
|
|
74
112
|
|
|
75
113
|
type ViewType = 'month' | 'week' | 'day' | 'agenda' | 'resource';
|
|
@@ -111,7 +149,13 @@ interface CalendarEvent {
|
|
|
111
149
|
count?: number;
|
|
112
150
|
until?: Date;
|
|
113
151
|
byweekday?: number[];
|
|
152
|
+
/** Occurrence start dates excluded from the series. */
|
|
153
|
+
exdates?: Date[];
|
|
114
154
|
};
|
|
155
|
+
/** Set on expanded occurrences: id of the recurring (master) event. */
|
|
156
|
+
originalEventId?: string;
|
|
157
|
+
/** Set on expanded occurrences: start of this occurrence. */
|
|
158
|
+
occurrenceStart?: Date;
|
|
115
159
|
[key: string]: any;
|
|
116
160
|
}
|
|
117
161
|
interface EventType {
|
|
@@ -154,6 +198,12 @@ interface CalendarProps {
|
|
|
154
198
|
onEventCreate?: (event: Partial<CalendarEvent>) => void;
|
|
155
199
|
onEventUpdate?: (event: CalendarEvent) => void;
|
|
156
200
|
onEventDelete?: (eventId: string) => void;
|
|
201
|
+
/**
|
|
202
|
+
* Called when a single occurrence of a recurring event is deleted. `updatedSeries` is the master
|
|
203
|
+
* event with that occurrence added to `recurrence.exdates`: persist it to delete only this
|
|
204
|
+
* occurrence. Without this prop, deleting an occurrence deletes the whole series (`onEventDelete`).
|
|
205
|
+
*/
|
|
206
|
+
onOccurrenceDelete?: (occurrence: CalendarEvent, updatedSeries: CalendarEvent) => void;
|
|
157
207
|
theme?: CalendarTheme;
|
|
158
208
|
locale?: Locale;
|
|
159
209
|
timezone?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,44 @@ declare const en: {
|
|
|
70
70
|
noEventsScheduled: string;
|
|
71
71
|
noUpcoming: string;
|
|
72
72
|
noUpcomingHint: string;
|
|
73
|
+
newEvent: string;
|
|
74
|
+
saveChanges: string;
|
|
75
|
+
close: string;
|
|
76
|
+
noTitle: string;
|
|
77
|
+
openInMaps: string;
|
|
78
|
+
notesLabel: string;
|
|
79
|
+
addNotes: string;
|
|
80
|
+
attachments: string;
|
|
81
|
+
reminders: string;
|
|
82
|
+
add: string;
|
|
83
|
+
calendar: string;
|
|
84
|
+
select: string;
|
|
85
|
+
addLocation: string;
|
|
86
|
+
guestSingular: string;
|
|
87
|
+
addGuestPlaceholder: string;
|
|
88
|
+
invalidEmail: string;
|
|
89
|
+
removeGuest: string;
|
|
90
|
+
reminderAtTime: string;
|
|
91
|
+
reminderMinutes: string;
|
|
92
|
+
reminderHour: string;
|
|
93
|
+
reminderHours: string;
|
|
94
|
+
reminderDay: string;
|
|
95
|
+
reminderDays: string;
|
|
96
|
+
reminderWeek: string;
|
|
97
|
+
removeReminder: string;
|
|
98
|
+
durationMinutes: string;
|
|
99
|
+
durationHours: string;
|
|
100
|
+
durationHoursMinutes: string;
|
|
101
|
+
moreEvents: string;
|
|
102
|
+
idLabel: string;
|
|
103
|
+
previous: string;
|
|
104
|
+
next: string;
|
|
105
|
+
previousMonth: string;
|
|
106
|
+
nextMonth: string;
|
|
107
|
+
toggleSidebar: string;
|
|
108
|
+
toggleTheme: string;
|
|
109
|
+
switchLanguage: string;
|
|
110
|
+
eventColor: string;
|
|
73
111
|
};
|
|
74
112
|
|
|
75
113
|
type ViewType = 'month' | 'week' | 'day' | 'agenda' | 'resource';
|
|
@@ -111,7 +149,13 @@ interface CalendarEvent {
|
|
|
111
149
|
count?: number;
|
|
112
150
|
until?: Date;
|
|
113
151
|
byweekday?: number[];
|
|
152
|
+
/** Occurrence start dates excluded from the series. */
|
|
153
|
+
exdates?: Date[];
|
|
114
154
|
};
|
|
155
|
+
/** Set on expanded occurrences: id of the recurring (master) event. */
|
|
156
|
+
originalEventId?: string;
|
|
157
|
+
/** Set on expanded occurrences: start of this occurrence. */
|
|
158
|
+
occurrenceStart?: Date;
|
|
115
159
|
[key: string]: any;
|
|
116
160
|
}
|
|
117
161
|
interface EventType {
|
|
@@ -154,6 +198,12 @@ interface CalendarProps {
|
|
|
154
198
|
onEventCreate?: (event: Partial<CalendarEvent>) => void;
|
|
155
199
|
onEventUpdate?: (event: CalendarEvent) => void;
|
|
156
200
|
onEventDelete?: (eventId: string) => void;
|
|
201
|
+
/**
|
|
202
|
+
* Called when a single occurrence of a recurring event is deleted. `updatedSeries` is the master
|
|
203
|
+
* event with that occurrence added to `recurrence.exdates`: persist it to delete only this
|
|
204
|
+
* occurrence. Without this prop, deleting an occurrence deletes the whole series (`onEventDelete`).
|
|
205
|
+
*/
|
|
206
|
+
onOccurrenceDelete?: (occurrence: CalendarEvent, updatedSeries: CalendarEvent) => void;
|
|
157
207
|
theme?: CalendarTheme;
|
|
158
208
|
locale?: Locale;
|
|
159
209
|
timezone?: string;
|