@ilamy/calendar 1.0.1 → 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 +30 -7
- package/dist/index.js +7 -7
- package/package.json +8 -12
package/dist/index.d.ts
CHANGED
|
@@ -193,6 +193,10 @@ interface Translations {
|
|
|
193
193
|
type TranslationKey = keyof Translations;
|
|
194
194
|
type TranslatorFunction = (key: TranslationKey | string) => string;
|
|
195
195
|
/**
|
|
196
|
+
* Available calendar view types.
|
|
197
|
+
*/
|
|
198
|
+
type CalendarView = "month" | "week" | "day" | "year";
|
|
199
|
+
/**
|
|
196
200
|
* This interface extends the base CalendarEvent but allows more flexible date types
|
|
197
201
|
* for the start and end properties. The component will automatically convert these
|
|
198
202
|
* to dayjs objects internally for consistent date handling.
|
|
@@ -218,7 +222,12 @@ interface IlamyCalendarProps {
|
|
|
218
222
|
* The initial view to display when the calendar loads.
|
|
219
223
|
* Defaults to 'month'.
|
|
220
224
|
*/
|
|
221
|
-
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;
|
|
222
231
|
/**
|
|
223
232
|
* Custom render function for calendar events.
|
|
224
233
|
* If provided, it will override the default event rendering.
|
|
@@ -238,7 +247,7 @@ interface IlamyCalendarProps {
|
|
|
238
247
|
* Callback when the calendar view changes (month, week, day, year).
|
|
239
248
|
* Useful for syncing with external state or analytics.
|
|
240
249
|
*/
|
|
241
|
-
onViewChange?: (view:
|
|
250
|
+
onViewChange?: (view: CalendarView) => void;
|
|
242
251
|
/**
|
|
243
252
|
* Callback when a new event is added to the calendar.
|
|
244
253
|
* Provides the newly created event object.
|
|
@@ -323,9 +332,23 @@ interface IlamyCalendarProps {
|
|
|
323
332
|
}
|
|
324
333
|
declare const IlamyCalendar: React3.FC<IlamyCalendarProps>;
|
|
325
334
|
import React4 from "react";
|
|
326
|
-
|
|
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"> {
|
|
327
350
|
/** Array of events to display */
|
|
328
|
-
events?:
|
|
351
|
+
events?: IlamyResourceCalendarPropEvent[];
|
|
329
352
|
/** Array of resources */
|
|
330
353
|
resources?: Resource[];
|
|
331
354
|
/** Custom render function for resources */
|
|
@@ -368,7 +391,7 @@ declare const IlamyResourceCalendar: React4.FC<IlamyResourceCalendarProps>;
|
|
|
368
391
|
*/
|
|
369
392
|
interface UseIlamyCalendarContextReturn {
|
|
370
393
|
readonly currentDate: dayjs.Dayjs;
|
|
371
|
-
readonly view:
|
|
394
|
+
readonly view: CalendarView;
|
|
372
395
|
readonly events: CalendarEvent[];
|
|
373
396
|
readonly isEventFormOpen: boolean;
|
|
374
397
|
readonly selectedEvent: CalendarEvent | null;
|
|
@@ -376,7 +399,7 @@ interface UseIlamyCalendarContextReturn {
|
|
|
376
399
|
readonly firstDayOfWeek: number;
|
|
377
400
|
readonly setCurrentDate: (date: dayjs.Dayjs) => void;
|
|
378
401
|
readonly selectDate: (date: dayjs.Dayjs) => void;
|
|
379
|
-
readonly setView: (view:
|
|
402
|
+
readonly setView: (view: CalendarView) => void;
|
|
380
403
|
readonly nextPeriod: () => void;
|
|
381
404
|
readonly prevPeriod: () => void;
|
|
382
405
|
readonly today: () => void;
|
|
@@ -407,4 +430,4 @@ declare const generateRecurringEvents: ({ event, currentEvents, startDate, endDa
|
|
|
407
430
|
import { Frequency, Weekday } from "rrule";
|
|
408
431
|
import { RRule } from "rrule";
|
|
409
432
|
declare const defaultTranslations: Translations;
|
|
410
|
-
export { useIlamyResourceCalendarContext, useIlamyCalendarContext, isRecurringEvent, generateRecurringEvents, defaultTranslations, Weekday, WeekDays, UseIlamyResourceCalendarContextReturn, UseIlamyCalendarContextReturn, TranslatorFunction, Translations, TranslationKey, ResourceCalendarEvent, Resource, RRuleOptions, RRule, IlamyResourceCalendarProps, IlamyResourceCalendar, IlamyCalendarProps, IlamyCalendar, Frequency, CalendarEvent };
|
|
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 };
|