@dayflow/core 3.1.0 → 3.1.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/README.md +3 -3
- package/dist/index.d.ts +42 -13
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +118 -124
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,17 +16,17 @@ views, and plugin architecture.
|
|
|
16
16
|
|
|
17
17
|
| Monthly | Weekly |
|
|
18
18
|
| --------------------------------------- | -------------------------------------- |
|
|
19
|
-
|  |  |
|
|
20
20
|
|
|
21
21
|
| Daily | Event Stack Level |
|
|
22
22
|
| ------------------------------------- | ---------------------------------------- |
|
|
23
|
-
|  |  |
|
|
24
24
|
|
|
25
25
|
### Default Panel (with multiple Event Detail Panel options available)
|
|
26
26
|
|
|
27
27
|
| Detail Popup | Detail Dialog |
|
|
28
28
|
| ----------------------------------- | ------------------------------------ |
|
|
29
|
-
|  |  |
|
|
30
30
|
|
|
31
31
|
### Easy to resize and drag
|
|
32
32
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Temporal } from 'temporal-polyfill';
|
|
2
2
|
import * as preact from 'preact';
|
|
3
3
|
import { ComponentChildren, RefObject, h } from 'preact';
|
|
4
|
-
import { Event as Event$1 } from '@/types';
|
|
5
4
|
import * as preact_compat from 'preact/compat';
|
|
6
5
|
export { createPortal } from 'preact/compat';
|
|
7
6
|
import { BlossomColorPickerOptions } from '@dayflow/blossom-color-picker';
|
|
@@ -200,7 +199,7 @@ declare function getCalendarColorsForHex(hex: string): {
|
|
|
200
199
|
};
|
|
201
200
|
|
|
202
201
|
type LocaleCode = string;
|
|
203
|
-
type TranslationKey = 'allDay' | 'noEvents' | 'more' | 'eventTitle' | 'dateRange' | 'timeRange' | 'note' | 'addNotePlaceholder' | 'setAsAllDay' | 'setAsTimed' | 'delete' | 'confirm' | 'cancel' | 'today' | 'day' | 'week' | 'month' | 'year' | 'newEvent' | 'newAllDayEvent' | 'newCalendarEvent' | 'newAllDayCalendarEvent' | 'save' | 'deleteCalendar' | 'deleteCalendarMessage' | 'merge' | 'confirmDeleteTitle' | 'confirmDeleteMessage' | 'mergeConfirmTitle' | 'mergeConfirmMessage' | 'expandSidebar' | 'collapseSidebar' | 'calendars' | 'createCalendar' | 'calendarNamePlaceholder' | 'customColor' | 'create' | 'calendarOptions' | 'untitled' | 'search' | 'noResults' | 'calendar' | 'starts' | 'ends' | 'notes' | 'titlePlaceholder' | 'notesPlaceholder' | 'editEvent' | 'done' | 'quickCreateEvent' | 'quickCreatePlaceholder' | 'noSuggestions' | 'newCalendar' | 'refreshAll' | 'tomorrow' | 'importCalendar' | 'exportCalendar' | 'addSchedule' | 'importCalendarMessage' | 'ok' | 'cut' | 'copy' | 'pasteHere' | 'eventSummary';
|
|
202
|
+
type TranslationKey = 'allDay' | 'noEvents' | 'more' | 'eventTitle' | 'dateRange' | 'timeRange' | 'note' | 'addNotePlaceholder' | 'setAsAllDay' | 'setAsTimed' | 'delete' | 'confirm' | 'cancel' | 'today' | 'day' | 'week' | 'month' | 'year' | 'newEvent' | 'newAllDayEvent' | 'newCalendarEvent' | 'newAllDayCalendarEvent' | 'save' | 'deleteCalendar' | 'deleteCalendarMessage' | 'merge' | 'confirmDeleteTitle' | 'confirmDeleteMessage' | 'mergeConfirmTitle' | 'mergeConfirmMessage' | 'expandSidebar' | 'collapseSidebar' | 'calendars' | 'createCalendar' | 'calendarNamePlaceholder' | 'customColor' | 'create' | 'calendarOptions' | 'untitled' | 'search' | 'noResults' | 'calendar' | 'starts' | 'ends' | 'notes' | 'titlePlaceholder' | 'notesPlaceholder' | 'editEvent' | 'viewEvent' | 'done' | 'quickCreateEvent' | 'quickCreatePlaceholder' | 'noSuggestions' | 'newCalendar' | 'refreshAll' | 'tomorrow' | 'importCalendar' | 'exportCalendar' | 'addSchedule' | 'importCalendarMessage' | 'ok' | 'cut' | 'copy' | 'pasteHere' | 'eventSummary';
|
|
204
203
|
type LocaleDict = Partial<Record<TranslationKey, string>>;
|
|
205
204
|
type LocaleMessages = Partial<Record<TranslationKey, string>>;
|
|
206
205
|
interface Locale {
|
|
@@ -218,6 +217,8 @@ interface MobileEventProps {
|
|
|
218
217
|
onClose: () => void;
|
|
219
218
|
/** Callback to save the event (creates or updates) */
|
|
220
219
|
onSave: (event: Event) => void;
|
|
220
|
+
/** Callback to delete an existing event by id */
|
|
221
|
+
onEventDelete?: (id: string) => void;
|
|
221
222
|
/** Current event data (newly created template or existing event) */
|
|
222
223
|
draftEvent: Event | null;
|
|
223
224
|
/** The ICalendarApp instance providing built-in services */
|
|
@@ -260,18 +261,35 @@ interface CalendarView {
|
|
|
260
261
|
component: TComponent;
|
|
261
262
|
config?: Record<string, unknown>;
|
|
262
263
|
}
|
|
264
|
+
type RangeChangeReason = 'initial' | 'navigation' | 'viewChange' | 'scroll';
|
|
265
|
+
type EventChange = {
|
|
266
|
+
type: 'create';
|
|
267
|
+
event: Event;
|
|
268
|
+
} | {
|
|
269
|
+
type: 'update';
|
|
270
|
+
before: Event;
|
|
271
|
+
after: Event;
|
|
272
|
+
} | {
|
|
273
|
+
type: 'delete';
|
|
274
|
+
event: Event;
|
|
275
|
+
};
|
|
263
276
|
/**
|
|
264
277
|
* Calendar callbacks interface
|
|
265
278
|
* Defines calendar event callback functions
|
|
266
279
|
*/
|
|
267
280
|
interface CalendarCallbacks {
|
|
281
|
+
onEventBatchChange?: (changes: EventChange[]) => void | Promise<void>;
|
|
268
282
|
onViewChange?: (view: ViewType) => void | Promise<void>;
|
|
269
283
|
onEventCreate?: (event: Event) => void | Promise<void>;
|
|
270
284
|
onEventUpdate?: (event: Event) => void | Promise<void>;
|
|
271
285
|
onEventDelete?: (eventId: string) => void | Promise<void>;
|
|
272
286
|
onDateChange?: (date: Date) => void | Promise<void>;
|
|
273
287
|
onRender?: () => void | Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* @deprecated This method is retained for backward compatibility and will be removed in future releases. Use ``onVisibleRangeChange`` instead.
|
|
290
|
+
*/
|
|
274
291
|
onVisibleMonthChange?: (date: Date) => void | Promise<void>;
|
|
292
|
+
onVisibleRangeChange?: (start: Date, end: Date, reason: RangeChangeReason) => void | Promise<void>;
|
|
275
293
|
onCalendarUpdate?: (calendar: CalendarType) => void | Promise<void>;
|
|
276
294
|
onCalendarCreate?: (calendar: CalendarType) => void | Promise<void>;
|
|
277
295
|
onCalendarDelete?: (calendarId: string) => void | Promise<void>;
|
|
@@ -283,7 +301,7 @@ interface CalendarCallbacks {
|
|
|
283
301
|
interface CreateCalendarDialogProps {
|
|
284
302
|
onClose: () => void;
|
|
285
303
|
onCreate: (calendar: CalendarType) => void;
|
|
286
|
-
colorPickerMode?: '
|
|
304
|
+
colorPickerMode?: 'default' | 'custom';
|
|
287
305
|
}
|
|
288
306
|
interface CalendarHeaderProps {
|
|
289
307
|
calendar: ICalendarApp;
|
|
@@ -387,6 +405,7 @@ interface ICalendarApp {
|
|
|
387
405
|
mergeCalendars: (sourceId: string, targetId: string) => void;
|
|
388
406
|
setVisibleMonth: (date: Date) => void;
|
|
389
407
|
getVisibleMonth: () => Date;
|
|
408
|
+
emitVisibleRange: (start: Date, end: Date, reason?: RangeChangeReason) => void;
|
|
390
409
|
dismissUI: () => void;
|
|
391
410
|
getPlugin: <T = unknown>(name: string) => T | undefined;
|
|
392
411
|
hasPlugin: (name: string) => boolean;
|
|
@@ -437,6 +456,7 @@ interface UseCalendarAppReturn {
|
|
|
437
456
|
highlightEvent: (eventId: string | null) => void;
|
|
438
457
|
setVisibleMonth: (date: Date) => void;
|
|
439
458
|
getVisibleMonth: () => Date;
|
|
459
|
+
emitVisibleRange: (start: Date, end: Date, reason?: RangeChangeReason) => void;
|
|
440
460
|
readOnlyConfig: ReadOnlyConfig;
|
|
441
461
|
}
|
|
442
462
|
/**
|
|
@@ -889,6 +909,7 @@ interface UseVirtualMonthScrollReturn {
|
|
|
889
909
|
currentMonth: string;
|
|
890
910
|
currentYear: number;
|
|
891
911
|
isScrolling: boolean;
|
|
912
|
+
isNavigating: boolean;
|
|
892
913
|
virtualData: {
|
|
893
914
|
totalHeight: number;
|
|
894
915
|
visibleItems: VirtualWeekItem[];
|
|
@@ -1262,6 +1283,7 @@ declare class CalendarApp implements ICalendarApp {
|
|
|
1262
1283
|
state: CalendarAppState;
|
|
1263
1284
|
private callbacks;
|
|
1264
1285
|
private calendarRegistry;
|
|
1286
|
+
private store;
|
|
1265
1287
|
private visibleMonth;
|
|
1266
1288
|
private useEventDetailDialog;
|
|
1267
1289
|
private useCalendarHeader;
|
|
@@ -1272,6 +1294,7 @@ declare class CalendarApp implements ICalendarApp {
|
|
|
1272
1294
|
private pendingSnapshot;
|
|
1273
1295
|
private readonly MAX_UNDO_STACK;
|
|
1274
1296
|
constructor(config: CalendarAppConfig);
|
|
1297
|
+
private setupStoreListeners;
|
|
1275
1298
|
private resolveLocale;
|
|
1276
1299
|
subscribe: (listener: (app: ICalendarApp) => void) => (() => void);
|
|
1277
1300
|
private notify;
|
|
@@ -1285,6 +1308,8 @@ declare class CalendarApp implements ICalendarApp {
|
|
|
1285
1308
|
private isInternalEditable;
|
|
1286
1309
|
changeView: (view: ViewType) => void;
|
|
1287
1310
|
getCurrentView: () => CalendarView;
|
|
1311
|
+
emitVisibleRange: (start: Date, end: Date, reason?: RangeChangeReason) => void;
|
|
1312
|
+
handleVisibleRangeChange: (reason: RangeChangeReason) => void;
|
|
1288
1313
|
setCurrentDate: (date: Date) => void;
|
|
1289
1314
|
getCurrentDate: () => Date;
|
|
1290
1315
|
setVisibleMonth: (date: Date) => void;
|
|
@@ -1365,6 +1390,7 @@ declare class CustomRenderingStore {
|
|
|
1365
1390
|
private renderings;
|
|
1366
1391
|
private overrides;
|
|
1367
1392
|
private listeners;
|
|
1393
|
+
constructor(initialOverrides?: string[]);
|
|
1368
1394
|
/**
|
|
1369
1395
|
* Register a new custom rendering placeholder.
|
|
1370
1396
|
* Called by the ContentSlot Preact component.
|
|
@@ -1397,7 +1423,9 @@ declare class CalendarRenderer {
|
|
|
1397
1423
|
private customRenderingStore;
|
|
1398
1424
|
private unsubscribe;
|
|
1399
1425
|
private renderRequested;
|
|
1400
|
-
|
|
1426
|
+
private extraProps;
|
|
1427
|
+
constructor(app: ICalendarApp, initialOverrides?: string[]);
|
|
1428
|
+
setProps(props: Record<string, any>): void;
|
|
1401
1429
|
private requestRender;
|
|
1402
1430
|
/**
|
|
1403
1431
|
* Mount the calendar to a DOM container.
|
|
@@ -1970,13 +1998,14 @@ declare const formatTemporal: (value: Temporal.ZonedDateTime, format: string, ti
|
|
|
1970
1998
|
*/
|
|
1971
1999
|
declare function normalizeCssWidth(width?: number | string, defaultWidth?: string): string;
|
|
1972
2000
|
/**
|
|
1973
|
-
* Check if the
|
|
2001
|
+
* Check if the calendar's scrollbar takes up space in the layout.
|
|
1974
2002
|
*
|
|
1975
|
-
*
|
|
1976
|
-
*
|
|
1977
|
-
*
|
|
2003
|
+
* Tests inside a .df-calendar-container element so the library's scoped
|
|
2004
|
+
* scrollbar CSS applies (scrollbar-width: thin; ::-webkit-scrollbar { width: 2px }).
|
|
2005
|
+
* Also overrides any host-app CSS that hides scrollbars (e.g. display: none),
|
|
2006
|
+
* since we need to measure the actual rendered scrollbar width.
|
|
1978
2007
|
*
|
|
1979
|
-
* @returns true if scrollbar takes space, false otherwise
|
|
2008
|
+
* @returns true if the calendar scrollbar takes space, false otherwise
|
|
1980
2009
|
*/
|
|
1981
2010
|
declare function scrollbarTakesSpace(): boolean;
|
|
1982
2011
|
|
|
@@ -2259,8 +2288,8 @@ declare const groupSearchResults: (results: CalendarSearchEvent[], today: Date)
|
|
|
2259
2288
|
|
|
2260
2289
|
declare class ClipboardStore {
|
|
2261
2290
|
private lastCopiedEvent;
|
|
2262
|
-
setEvent(event: Event
|
|
2263
|
-
getEvent(): Event
|
|
2291
|
+
setEvent(event: Event): void;
|
|
2292
|
+
getEvent(): Event | null;
|
|
2264
2293
|
hasEvent(): boolean;
|
|
2265
2294
|
clear(): void;
|
|
2266
2295
|
}
|
|
@@ -2646,7 +2675,7 @@ declare const sidebarContainer = "df-sidebar flex h-full flex-col border-r borde
|
|
|
2646
2675
|
/**
|
|
2647
2676
|
* Sidebar header
|
|
2648
2677
|
*/
|
|
2649
|
-
declare const sidebarHeader = "df-sidebar-header flex items-center px-2 py-
|
|
2678
|
+
declare const sidebarHeader = "df-sidebar-header flex items-center px-2 py-1";
|
|
2650
2679
|
/**
|
|
2651
2680
|
* Sidebar header toggle button
|
|
2652
2681
|
*/
|
|
@@ -2657,4 +2686,4 @@ declare const sidebarHeaderToggle = "df-sidebar-header-toggle flex h-8 w-8 items
|
|
|
2657
2686
|
declare const sidebarHeaderTitle = "df-sidebar-header-title text-sm font-semibold text-gray-700 dark:text-gray-200";
|
|
2658
2687
|
|
|
2659
2688
|
export { BlossomColorPicker, CalendarApp, CalendarRegistry, CalendarRenderer, Check, ChevronRight, ChevronsUpDown, ContentSlot, ContextMenu, ContextMenuColorPicker, ContextMenuItem, ContextMenuLabel, ContextMenuSeparator, CreateCalendarDialog, CustomRenderingStore, DefaultColorPicker, LAYOUT_CONFIG, LOCALES, LocaleContext, LocaleProvider, MiniCalendar, PanelRightClose, PanelRightOpen, Plus, TIME_STEP, VIRTUAL_MONTH_SCROLL_CONFIG, ViewType, WeekDataCache, addDays, buildParseRegExp, calculateDayIndex, calendarPickerDropdown, cancelButton, capitalize, clipboardStore, conditionalTheme, convertDateEvent, convertDateEventWithTimeZone, createAllDayEvent, createDateWithHour, createDayView, createEvent, createEventWithDate, createEventWithRealDate, createEvents, createEventsPlugin, createMonthView, createStandardViews, createTemporalWithHour, createTimedEvent, createTimezoneEvent, createTimezoneEvents, createWeekView, createYearView, dateToPlainDate, dateToPlainDateTime, dateToZonedDateTime, daysBetween, daysDifference, downloadICS, en, extractHourFromDate, extractHourFromTemporal, formatDate, formatDateConsistent, formatDateToICSTimestamp, formatEventTimeRange, formatICSDate, formatMonthYear, formatTemporal, formatTime, generateDayData, generateICS, generateUniKey, generateWeekData, generateWeekRange, generateWeeksData, getAllDayEventsForDay, getCalendarColorsForHex, getCurrentWeekDates, getDateByDayIndex, getDateObj, getDayIndexByDate, getEndOfDay, getEndOfTemporal, getEventBgColor, getEventEndHour, getEventTextColor, getEventsForDay, getEventsForWeek, getIntlLabel, getLineColor, getMonthLabels, getMonthYearOfWeek, getPlainDate, getSearchHeaderInfo, getSelectedBgColor, getStartOfDay, getStartOfTemporal, getTestEvents, getWeekDaysLabels, getWeekRange, getZoneId, groupSearchResults, importICSFile, isDate, isDeepEqual, isEventEqual, isEventInWeek, isMultiDayEvent, isMultiDayTemporalEvent, isPlainDate, isPlainDateTime, isSameDay, isSamePlainDate, isSameTemporal, isValidLocale, isZonedDateTime, mergeClasses, mergeFormatTemplate, monthNames, normalizeCssWidth, normalizeDate, normalizeLocale, normalizeToZoned, now, pad, parseICS, parseICSDate, parseTemporalString, plainDateTimeToDate, plainDateToDate, recalculateEventDays, registerDragImplementation, registerLocale, registerSidebarImplementation, resolveAppliedTheme, roundToTimeStep, scrollbarTakesSpace, setHourInTemporal, shortMonthNames, sidebarContainer, sidebarHeader, sidebarHeaderTitle, sidebarHeaderToggle, t, temporalToDate, themeClasses, themeCn, today, updateEventDateAndDay, updateEventWithRealDate, useDragForView, useLocale, useSidebarBridge, weekDays, weekDaysFullName, zonedDateTimeToDate };
|
|
2660
|
-
export type { BalanceStrategy, BaseViewProps, CalendarAppConfig, CalendarAppState, CalendarCallbacks, CalendarColors, CalendarConfig, CalendarHeaderProps, CalendarPlugin, CalendarType, CalendarView, CalendarsConfig, CreateCalendarDialogProps, CreateEventParams, CreateTimezoneEventParams, CustomRendering, DayData, DayViewConfig, DayViewProps, DragConfig, DragHookOptions, DragHookReturn, DragIndicatorProps, DragIndicatorRenderer, DragIntegrationProps, DragPluginConfig, DragRef, DragService, Event, EventDetailContentProps, EventDetailContentRenderer, EventDetailDialogProps, EventDetailDialogRenderer, EventDetailPanelProps, EventDetailPanelRenderer, EventDetailPosition, EventGroup, EventLayout, EventRelations, EventsPluginConfig, EventsService, ICSDateParams, ICSExportOptions, ICSImportOptions, ICSImportResult, ICSParseError, ICSVEvent, ICalendarApp, Locale, LocaleCode, LocaleContextValue, LocaleDict, LocaleMessages, LocaleProviderProps, MobileEventProps, MobileEventRenderer, Mode, MonthDragState, MonthEventDragState, MonthViewConfig, MonthViewProps, NestedLayer, ReadOnlyConfig, SidebarBridgeReturn, SpecialLayoutRule, SubtreeAnalysis, SupportedLang, TComponent, TNode, ThemeColors, ThemeConfig, ThemeMode, TransferOperation, TranslationKey, UnifiedDragRef, UseCalendarAppReturn, UseCalendarReturn, UseDragCommonReturn, UseDragHandlersParams, UseDragHandlersReturn, UseDragManagerReturn, UseDragStateReturn, UseMonthDragParams, UseMonthDragReturn, UseVirtualMonthScrollProps, UseVirtualMonthScrollReturn, UseVirtualScrollProps, UseVirtualScrollReturn, UseWeekDayDragParams, UseWeekDayDragReturn, ViewAdapterProps, ViewFactory, ViewFactoryConfig, VirtualItem, VirtualScrollIntegrationProps, VirtualWeekItem, WeekDayDragState, WeekViewConfig, WeekViewProps, WeeksData, YearViewConfig, YearViewProps, useDragProps, useDragReturn };
|
|
2689
|
+
export type { BalanceStrategy, BaseViewProps, CalendarAppConfig, CalendarAppState, CalendarCallbacks, CalendarColors, CalendarConfig, CalendarHeaderProps, CalendarPlugin, CalendarType, CalendarView, CalendarsConfig, CreateCalendarDialogProps, CreateEventParams, CreateTimezoneEventParams, CustomRendering, DayData, DayViewConfig, DayViewProps, DragConfig, DragHookOptions, DragHookReturn, DragIndicatorProps, DragIndicatorRenderer, DragIntegrationProps, DragPluginConfig, DragRef, DragService, Event, EventChange, EventDetailContentProps, EventDetailContentRenderer, EventDetailDialogProps, EventDetailDialogRenderer, EventDetailPanelProps, EventDetailPanelRenderer, EventDetailPosition, EventGroup, EventLayout, EventRelations, EventsPluginConfig, EventsService, ICSDateParams, ICSExportOptions, ICSImportOptions, ICSImportResult, ICSParseError, ICSVEvent, ICalendarApp, Locale, LocaleCode, LocaleContextValue, LocaleDict, LocaleMessages, LocaleProviderProps, MobileEventProps, MobileEventRenderer, Mode, MonthDragState, MonthEventDragState, MonthViewConfig, MonthViewProps, NestedLayer, RangeChangeReason, ReadOnlyConfig, SidebarBridgeReturn, SpecialLayoutRule, SubtreeAnalysis, SupportedLang, TComponent, TNode, ThemeColors, ThemeConfig, ThemeMode, TransferOperation, TranslationKey, UnifiedDragRef, UseCalendarAppReturn, UseCalendarReturn, UseDragCommonReturn, UseDragHandlersParams, UseDragHandlersReturn, UseDragManagerReturn, UseDragStateReturn, UseMonthDragParams, UseMonthDragReturn, UseVirtualMonthScrollProps, UseVirtualMonthScrollReturn, UseVirtualScrollProps, UseVirtualScrollReturn, UseWeekDayDragParams, UseWeekDayDragReturn, ViewAdapterProps, ViewFactory, ViewFactoryConfig, VirtualItem, VirtualScrollIntegrationProps, VirtualWeekItem, WeekDayDragState, WeekViewConfig, WeekViewProps, WeeksData, YearViewConfig, YearViewProps, useDragProps, useDragReturn };
|