@ilamy/calendar 1.0.0 → 1.0.2
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/dist/index.d.ts +51 -29
- package/dist/index.js +7 -7
- package/package.json +11 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import React3 from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Options } from "rrule";
|
|
3
|
+
/**
|
|
4
|
+
* Re-rrule.js Options with practical TypeScript interface.
|
|
5
|
+
* Makes all properties optional except freq and dtstart (which are required by RFC 5545).
|
|
6
|
+
* This allows clean object creation without needing explicit null values.
|
|
7
|
+
*
|
|
8
|
+
* @see https://tools.ietf.org/html/rfc5545 - RFC 5545 iCalendar specification
|
|
9
|
+
* @see https://github.com/jakubroztocil/rrule - rrule.js library documentation
|
|
10
|
+
*/
|
|
11
|
+
type RRuleOptions = {
|
|
12
|
+
/**
|
|
13
|
+
* The frequency of the event. Must be one of the following: DAILY, WEEKLY, MONTHLY, etc.
|
|
14
|
+
*/
|
|
15
|
+
freq: Options["freq"];
|
|
16
|
+
/**
|
|
17
|
+
* The start date of the recurrence rule. This defines when the recurrence pattern begins.
|
|
18
|
+
* Required for proper RRULE functionality according to RFC 5545.
|
|
19
|
+
* @important Same as the event start date.
|
|
20
|
+
*/
|
|
21
|
+
dtstart: Date;
|
|
22
|
+
} & Partial<Omit<Options, "freq" | "dtstart">>;
|
|
3
23
|
/**
|
|
4
24
|
* Core calendar event interface representing a single calendar event.
|
|
5
25
|
* This is the primary data structure for calendar events.
|
|
@@ -173,6 +193,10 @@ interface Translations {
|
|
|
173
193
|
type TranslationKey = keyof Translations;
|
|
174
194
|
type TranslatorFunction = (key: TranslationKey | string) => string;
|
|
175
195
|
/**
|
|
196
|
+
* Available calendar view types.
|
|
197
|
+
*/
|
|
198
|
+
type CalendarView = "month" | "week" | "day" | "year";
|
|
199
|
+
/**
|
|
176
200
|
* This interface extends the base CalendarEvent but allows more flexible date types
|
|
177
201
|
* for the start and end properties. The component will automatically convert these
|
|
178
202
|
* to dayjs objects internally for consistent date handling.
|
|
@@ -198,7 +222,12 @@ interface IlamyCalendarProps {
|
|
|
198
222
|
* The initial view to display when the calendar loads.
|
|
199
223
|
* Defaults to 'month'.
|
|
200
224
|
*/
|
|
201
|
-
initialView?:
|
|
225
|
+
initialView?: CalendarView;
|
|
226
|
+
/**
|
|
227
|
+
* The initial date to display when the calendar loads.
|
|
228
|
+
* If not provided, the calendar will default to today's date.
|
|
229
|
+
*/
|
|
230
|
+
initialDate?: dayjs.Dayjs | Date | string;
|
|
202
231
|
/**
|
|
203
232
|
* Custom render function for calendar events.
|
|
204
233
|
* If provided, it will override the default event rendering.
|
|
@@ -218,7 +247,7 @@ interface IlamyCalendarProps {
|
|
|
218
247
|
* Callback when the calendar view changes (month, week, day, year).
|
|
219
248
|
* Useful for syncing with external state or analytics.
|
|
220
249
|
*/
|
|
221
|
-
onViewChange?: (view:
|
|
250
|
+
onViewChange?: (view: CalendarView) => void;
|
|
222
251
|
/**
|
|
223
252
|
* Callback when a new event is added to the calendar.
|
|
224
253
|
* Provides the newly created event object.
|
|
@@ -303,9 +332,23 @@ interface IlamyCalendarProps {
|
|
|
303
332
|
}
|
|
304
333
|
declare const IlamyCalendar: React3.FC<IlamyCalendarProps>;
|
|
305
334
|
import React4 from "react";
|
|
306
|
-
|
|
335
|
+
/**
|
|
336
|
+
* Public-facing resource calendar event interface with flexible date types.
|
|
337
|
+
* Similar to IlamyCalendarPropEvent but with resource assignment fields.
|
|
338
|
+
* Dates can be provided as dayjs.Dayjs, Date, or string and will be normalized internally.
|
|
339
|
+
*
|
|
340
|
+
* @interface IlamyResourceCalendarPropEvent
|
|
341
|
+
* @extends {IlamyCalendarPropEvent}
|
|
342
|
+
*/
|
|
343
|
+
interface IlamyResourceCalendarPropEvent extends IlamyCalendarPropEvent {
|
|
344
|
+
/** Single resource assignment */
|
|
345
|
+
resourceId?: string | number;
|
|
346
|
+
/** Multiple resource assignment (cross-resource events) */
|
|
347
|
+
resourceIds?: (string | number)[];
|
|
348
|
+
}
|
|
349
|
+
interface IlamyResourceCalendarProps extends Omit<IlamyCalendarProps, "events"> {
|
|
307
350
|
/** Array of events to display */
|
|
308
|
-
events?:
|
|
351
|
+
events?: IlamyResourceCalendarPropEvent[];
|
|
309
352
|
/** Array of resources */
|
|
310
353
|
resources?: Resource[];
|
|
311
354
|
/** Custom render function for resources */
|
|
@@ -342,34 +385,13 @@ interface ResourceCalendarEvent extends CalendarEvent {
|
|
|
342
385
|
resourceIds?: (string | number)[];
|
|
343
386
|
}
|
|
344
387
|
declare const IlamyResourceCalendar: React4.FC<IlamyResourceCalendarProps>;
|
|
345
|
-
import { Options } from "rrule";
|
|
346
|
-
/**
|
|
347
|
-
* Re-rrule.js Options with practical TypeScript interface.
|
|
348
|
-
* Makes all properties optional except freq and dtstart (which are required by RFC 5545).
|
|
349
|
-
* This allows clean object creation without needing explicit null values.
|
|
350
|
-
*
|
|
351
|
-
* @see https://tools.ietf.org/html/rfc5545 - RFC 5545 iCalendar specification
|
|
352
|
-
* @see https://github.com/jakubroztocil/rrule - rrule.js library documentation
|
|
353
|
-
*/
|
|
354
|
-
type RRuleOptions2 = {
|
|
355
|
-
/**
|
|
356
|
-
* The frequency of the event. Must be one of the following: DAILY, WEEKLY, MONTHLY, etc.
|
|
357
|
-
*/
|
|
358
|
-
freq: Options["freq"]
|
|
359
|
-
/**
|
|
360
|
-
* The start date of the recurrence rule. This defines when the recurrence pattern begins.
|
|
361
|
-
* Required for proper RRULE functionality according to RFC 5545.
|
|
362
|
-
* @important Same as the event start date.
|
|
363
|
-
*/
|
|
364
|
-
dtstart: Date
|
|
365
|
-
} & Partial<Omit<Options, "freq" | "dtstart">>;
|
|
366
388
|
/**
|
|
367
389
|
* Simplified calendar context type for external use
|
|
368
390
|
* Contains only the most commonly used calendar operations
|
|
369
391
|
*/
|
|
370
392
|
interface UseIlamyCalendarContextReturn {
|
|
371
393
|
readonly currentDate: dayjs.Dayjs;
|
|
372
|
-
readonly view:
|
|
394
|
+
readonly view: CalendarView;
|
|
373
395
|
readonly events: CalendarEvent[];
|
|
374
396
|
readonly isEventFormOpen: boolean;
|
|
375
397
|
readonly selectedEvent: CalendarEvent | null;
|
|
@@ -377,7 +399,7 @@ interface UseIlamyCalendarContextReturn {
|
|
|
377
399
|
readonly firstDayOfWeek: number;
|
|
378
400
|
readonly setCurrentDate: (date: dayjs.Dayjs) => void;
|
|
379
401
|
readonly selectDate: (date: dayjs.Dayjs) => void;
|
|
380
|
-
readonly setView: (view:
|
|
402
|
+
readonly setView: (view: CalendarView) => void;
|
|
381
403
|
readonly nextPeriod: () => void;
|
|
382
404
|
readonly prevPeriod: () => void;
|
|
383
405
|
readonly today: () => void;
|
|
@@ -408,4 +430,4 @@ declare const generateRecurringEvents: ({ event, currentEvents, startDate, endDa
|
|
|
408
430
|
import { Frequency, Weekday } from "rrule";
|
|
409
431
|
import { RRule } from "rrule";
|
|
410
432
|
declare const defaultTranslations: Translations;
|
|
411
|
-
export { useIlamyResourceCalendarContext, useIlamyCalendarContext, isRecurringEvent, generateRecurringEvents, defaultTranslations, Weekday, WeekDays, UseIlamyResourceCalendarContextReturn, UseIlamyCalendarContextReturn, TranslatorFunction, Translations, TranslationKey, ResourceCalendarEvent, Resource,
|
|
433
|
+
export { useIlamyResourceCalendarContext, useIlamyCalendarContext, isRecurringEvent, generateRecurringEvents, defaultTranslations, Weekday, WeekDays, UseIlamyResourceCalendarContextReturn, UseIlamyCalendarContextReturn, TranslatorFunction, Translations, TranslationKey, ResourceCalendarEvent, Resource, RRuleOptions, RRule, IlamyResourceCalendarProps, IlamyResourceCalendar, IlamyCalendarProps, IlamyCalendar, Frequency, CalendarView, CalendarEvent };
|