@dayflow/core 2.0.7 → 3.0.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/dist/index.d.ts +2555 -39
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +2126 -3107
- package/package.json +21 -32
- package/README.ja.md +0 -47
- package/README.md +0 -49
- package/README.zh.md +0 -47
- package/dist/components/calendarEvent/components/AllDayContent.d.ts +0 -9
- package/dist/components/calendarEvent/components/MonthAllDayContent.d.ts +0 -8
- package/dist/components/calendarEvent/components/MonthRegularContent.d.ts +0 -11
- package/dist/components/calendarEvent/components/RegularEventContent.d.ts +0 -20
- package/dist/components/calendarEvent/index.d.ts +0 -4
- package/dist/components/calendarEvent/types.d.ts +0 -48
- package/dist/components/common/CalendarHeader.d.ts +0 -4
- package/dist/components/common/CalendarPicker.d.ts +0 -19
- package/dist/components/common/ColorPicker.d.ts +0 -19
- package/dist/components/common/ContextMenu.d.ts +0 -25
- package/dist/components/common/CreateCalendarDialog.d.ts +0 -3
- package/dist/components/common/DefaultEventDetailDialog.d.ts +0 -12
- package/dist/components/common/DefaultEventDetailPanel.d.ts +0 -11
- package/dist/components/common/EventDetailPanelWithContent.d.ts +0 -11
- package/dist/components/common/MiniCalendar.d.ts +0 -11
- package/dist/components/common/QuickCreateEventPopup.d.ts +0 -10
- package/dist/components/common/TodayBox.d.ts +0 -7
- package/dist/components/common/ViewHeader.d.ts +0 -33
- package/dist/components/common/ViewSwitcher.d.ts +0 -8
- package/dist/components/contextMenu/components/EventContextMenu.d.ts +0 -13
- package/dist/components/contextMenu/components/GridContextMenu.d.ts +0 -13
- package/dist/components/contextMenu/components/Primitives.d.ts +0 -41
- package/dist/components/contextMenu/index.d.ts +0 -4
- package/dist/components/contextMenu/utils.d.ts +0 -5
- package/dist/components/dayView/DayContent.d.ts +0 -55
- package/dist/components/dayView/RightPanel.d.ts +0 -16
- package/dist/components/dayView/util.d.ts +0 -8
- package/dist/components/eventLayout/constants.d.ts +0 -8
- package/dist/components/eventLayout/index.d.ts +0 -129
- package/dist/components/eventLayout/types.d.ts +0 -23
- package/dist/components/eventLayout/utils.d.ts +0 -5
- package/dist/components/mobileEventDrawer/DefaultMobileEventDrawer.d.ts +0 -3
- package/dist/components/mobileEventDrawer/components/Switch.d.ts +0 -7
- package/dist/components/mobileEventDrawer/components/TimePickerWheel.d.ts +0 -7
- package/dist/components/mobileEventDrawer/index.d.ts +0 -3
- package/dist/components/monthView/MonthDragIndicator.d.ts +0 -12
- package/dist/components/monthView/MultiDayEvent.d.ts +0 -31
- package/dist/components/monthView/WeekComponent.d.ts +0 -52
- package/dist/components/monthView/util.d.ts +0 -11
- package/dist/components/rangePicker/components/CalendarGrid.d.ts +0 -13
- package/dist/components/rangePicker/components/CalendarHeader.d.ts +0 -11
- package/dist/components/rangePicker/components/RangePickerPanel.d.ts +0 -25
- package/dist/components/rangePicker/components/TimeSelector.d.ts +0 -21
- package/dist/components/rangePicker/constants.d.ts +0 -5
- package/dist/components/rangePicker/index.d.ts +0 -4
- package/dist/components/rangePicker/types.d.ts +0 -23
- package/dist/components/rangePicker/utils.d.ts +0 -2
- package/dist/components/search/MobileSearchDialog.d.ts +0 -14
- package/dist/components/search/SearchDrawer.d.ts +0 -13
- package/dist/components/search/SearchResultsList.d.ts +0 -11
- package/dist/components/sidebar/DefaultCalendarSidebar.d.ts +0 -4
- package/dist/components/sidebar/components/CalendarList.d.ts +0 -16
- package/dist/components/sidebar/components/DeleteCalendarDialog.d.ts +0 -14
- package/dist/components/sidebar/components/ImportCalendarDialog.d.ts +0 -11
- package/dist/components/sidebar/components/MergeCalendarDialog.d.ts +0 -9
- package/dist/components/sidebar/components/MergeMenuItem.d.ts +0 -9
- package/dist/components/sidebar/components/SidebarHeader.d.ts +0 -7
- package/dist/components/weekView/AllDayRow.d.ts +0 -49
- package/dist/components/weekView/DragIndicator/DefaultDragIndicator.d.ts +0 -2
- package/dist/components/weekView/DragIndicator/DragIndicatorComponent.d.ts +0 -7
- package/dist/components/weekView/TimeGrid.d.ts +0 -52
- package/dist/components/weekView/util.d.ts +0 -9
- package/dist/components/yearView/DefaultYearView.d.ts +0 -14
- package/dist/components/yearView/FixedWeekYearView.d.ts +0 -17
- package/dist/components/yearView/YearDayCell.d.ts +0 -13
- package/dist/components/yearView/YearMultiDayEvent.d.ts +0 -22
- package/dist/components/yearView/YearRowComponent.d.ts +0 -26
- package/dist/components/yearView/utils.d.ts +0 -19
- package/dist/contexts/ThemeContext.d.ts +0 -38
- package/dist/core/CalendarApp.d.ts +0 -85
- package/dist/core/DayFlowCalendar.d.ts +0 -20
- package/dist/core/calendarRegistry.d.ts +0 -121
- package/dist/core/config.d.ts +0 -60
- package/dist/core/index.d.ts +0 -6
- package/dist/core/useCalendarApp.d.ts +0 -2
- package/dist/factories/ViewAdapter.d.ts +0 -4
- package/dist/factories/createDayView.d.ts +0 -3
- package/dist/factories/createMonthView.d.ts +0 -3
- package/dist/factories/createWeekView.d.ts +0 -3
- package/dist/factories/createYearView.d.ts +0 -3
- package/dist/factories/index.d.ts +0 -10
- package/dist/hooks/drag/index.d.ts +0 -7
- package/dist/hooks/drag/useDrag.d.ts +0 -2
- package/dist/hooks/drag/useDragCommon.d.ts +0 -2
- package/dist/hooks/drag/useDragHandlers.d.ts +0 -2
- package/dist/hooks/drag/useDragManager.d.ts +0 -2
- package/dist/hooks/drag/useDragState.d.ts +0 -2
- package/dist/hooks/drag/useMonthDrag.d.ts +0 -2
- package/dist/hooks/drag/useWeekDayDrag.d.ts +0 -2
- package/dist/hooks/useCalendarDrop.d.ts +0 -19
- package/dist/hooks/useKeyboardShortcuts.d.ts +0 -12
- package/dist/hooks/virtualScroll/index.d.ts +0 -2
- package/dist/hooks/virtualScroll/useVirtualMonthScroll.d.ts +0 -7
- package/dist/hooks/virtualScroll/useVirtualScroll.d.ts +0 -48
- package/dist/locale/LocaleContext.d.ts +0 -10
- package/dist/locale/LocaleProvider.d.ts +0 -8
- package/dist/locale/index.d.ts +0 -7
- package/dist/locale/intl.d.ts +0 -16
- package/dist/locale/locales/de.d.ts +0 -3
- package/dist/locale/locales/en.d.ts +0 -3
- package/dist/locale/locales/es.d.ts +0 -3
- package/dist/locale/locales/fr.d.ts +0 -3
- package/dist/locale/locales/index.d.ts +0 -18
- package/dist/locale/locales/ja.d.ts +0 -3
- package/dist/locale/locales/ko.d.ts +0 -3
- package/dist/locale/locales/zh.d.ts +0 -3
- package/dist/locale/translator.d.ts +0 -9
- package/dist/locale/types.d.ts +0 -8
- package/dist/locale/useLocale.d.ts +0 -5
- package/dist/locale/utils.d.ts +0 -10
- package/dist/plugins/dragPlugin.d.ts +0 -5
- package/dist/plugins/eventsPlugin.d.ts +0 -3
- package/dist/plugins/index.d.ts +0 -6
- package/dist/setupTests.d.ts +0 -1
- package/dist/styles/classNames.d.ts +0 -381
- package/dist/types/calendar.d.ts +0 -26
- package/dist/types/calendarTypes.d.ts +0 -68
- package/dist/types/config.d.ts +0 -19
- package/dist/types/core.d.ts +0 -265
- package/dist/types/dragIndicator.d.ts +0 -160
- package/dist/types/event.d.ts +0 -18
- package/dist/types/eventDetail.d.ts +0 -74
- package/dist/types/factory.d.ts +0 -156
- package/dist/types/hook.d.ts +0 -103
- package/dist/types/index.d.ts +0 -13
- package/dist/types/layout.d.ts +0 -113
- package/dist/types/mobileEvent.d.ts +0 -21
- package/dist/types/monthView.d.ts +0 -65
- package/dist/types/plugin.d.ts +0 -80
- package/dist/types/search.d.ts +0 -35
- package/dist/utils/calendarDataUtils.d.ts +0 -83
- package/dist/utils/clipboardStore.d.ts +0 -10
- package/dist/utils/colorUtils.d.ts +0 -27
- package/dist/utils/compareUtils.d.ts +0 -5
- package/dist/utils/dateConstants.d.ts +0 -22
- package/dist/utils/dateFormat.d.ts +0 -15
- package/dist/utils/dateRangeUtils.d.ts +0 -24
- package/dist/utils/dateTimeUtils.d.ts +0 -49
- package/dist/utils/eventHelpers.d.ts +0 -143
- package/dist/utils/eventUtils.d.ts +0 -115
- package/dist/utils/helpers.d.ts +0 -27
- package/dist/utils/ics/icsDateUtils.d.ts +0 -37
- package/dist/utils/ics/icsGenerator.d.ts +0 -23
- package/dist/utils/ics/icsParser.d.ts +0 -15
- package/dist/utils/ics/index.d.ts +0 -16
- package/dist/utils/ics/types.d.ts +0 -91
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/logger.d.ts +0 -15
- package/dist/utils/rangePicker.d.ts +0 -8
- package/dist/utils/searchUtils.d.ts +0 -35
- package/dist/utils/styleUtils.d.ts +0 -24
- package/dist/utils/temporal.d.ts +0 -100
- package/dist/utils/temporalTypeGuards.d.ts +0 -63
- package/dist/utils/testDataUtils.d.ts +0 -14
- package/dist/utils/themeUtils.d.ts +0 -93
- package/dist/utils/throttle.d.ts +0 -11
- package/dist/utils/timeUtils.d.ts +0 -38
- package/dist/utils/utilityFunctions.d.ts +0 -11
- package/dist/views/DayView.d.ts +0 -4
- package/dist/views/MonthView.d.ts +0 -4
- package/dist/views/WeekView.d.ts +0 -4
- package/dist/views/YearView.d.ts +0 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,2555 @@
|
|
|
1
|
-
import '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
|
+
import * as preact from 'preact';
|
|
3
|
+
import { ComponentChildren, RefObject } from 'preact';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Calendar event interface (using Temporal API)
|
|
7
|
+
* Unified event data structure supporting single-day, cross-day, and all-day events
|
|
8
|
+
*/
|
|
9
|
+
interface Event {
|
|
10
|
+
id: string;
|
|
11
|
+
title: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
start: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
14
|
+
end: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
15
|
+
allDay?: boolean;
|
|
16
|
+
icon?: boolean | ComponentChildren;
|
|
17
|
+
calendarId?: string;
|
|
18
|
+
meta?: Record<string, any>;
|
|
19
|
+
day?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type ViewSwitcherMode = 'buttons' | 'select';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Color configuration for a calendar type
|
|
26
|
+
*/
|
|
27
|
+
interface CalendarColors {
|
|
28
|
+
/** Event background color */
|
|
29
|
+
eventColor: string;
|
|
30
|
+
/** Selected event background color */
|
|
31
|
+
eventSelectedColor: string;
|
|
32
|
+
/** Border/line color */
|
|
33
|
+
lineColor: string;
|
|
34
|
+
/** Text color */
|
|
35
|
+
textColor: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Calendar Type Definition
|
|
39
|
+
* Represents a category of events (e.g., Work, Personal, Study)
|
|
40
|
+
*/
|
|
41
|
+
interface CalendarType {
|
|
42
|
+
/** Unique identifier (e.g., 'work', 'personal') */
|
|
43
|
+
id: string;
|
|
44
|
+
/** Display name (e.g., 'Work', 'Personal') */
|
|
45
|
+
name: string;
|
|
46
|
+
/** Optional description */
|
|
47
|
+
description?: string;
|
|
48
|
+
/** Light mode colors */
|
|
49
|
+
colors: CalendarColors;
|
|
50
|
+
/** Dark mode colors (optional, falls back to light mode if not provided) */
|
|
51
|
+
darkColors?: CalendarColors;
|
|
52
|
+
/** Optional icon (emoji or icon name) */
|
|
53
|
+
icon?: string;
|
|
54
|
+
/** Whether this is a system default type */
|
|
55
|
+
isDefault?: boolean;
|
|
56
|
+
/** Whether events of this type should be visible */
|
|
57
|
+
isVisible?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Theme mode
|
|
61
|
+
*/
|
|
62
|
+
type ThemeMode = 'light' | 'dark' | 'auto';
|
|
63
|
+
/**
|
|
64
|
+
* System-level theme colors
|
|
65
|
+
*/
|
|
66
|
+
interface ThemeColors {
|
|
67
|
+
background?: string;
|
|
68
|
+
text?: string;
|
|
69
|
+
border?: string;
|
|
70
|
+
[key: string]: string | undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Theme configuration
|
|
74
|
+
*/
|
|
75
|
+
interface ThemeConfig {
|
|
76
|
+
/** Current theme mode */
|
|
77
|
+
mode: ThemeMode;
|
|
78
|
+
/** System-level theme colors (optional) */
|
|
79
|
+
colors?: ThemeColors;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Calendar configuration for the app
|
|
83
|
+
*/
|
|
84
|
+
interface CalendarsConfig {
|
|
85
|
+
/** Array of calendar types */
|
|
86
|
+
calendars?: CalendarType[];
|
|
87
|
+
/** Default calendar for new events */
|
|
88
|
+
defaultCalendar?: string;
|
|
89
|
+
/** Theme configuration */
|
|
90
|
+
theme?: ThemeConfig;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Calendar Registry
|
|
95
|
+
* Manages calendar types and provides color resolution
|
|
96
|
+
*/
|
|
97
|
+
declare class CalendarRegistry {
|
|
98
|
+
private calendars;
|
|
99
|
+
private defaultCalendarId;
|
|
100
|
+
private currentTheme;
|
|
101
|
+
constructor(customCalendars?: CalendarType[], defaultCalendarId?: string, theme?: ThemeMode);
|
|
102
|
+
/**
|
|
103
|
+
* Register a new calendar type
|
|
104
|
+
*/
|
|
105
|
+
register(calendar: CalendarType): void;
|
|
106
|
+
/**
|
|
107
|
+
* Unregister a calendar type
|
|
108
|
+
*/
|
|
109
|
+
unregister(calendarId: string): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Get a calendar type by ID
|
|
112
|
+
*/
|
|
113
|
+
get(calendarId: string): CalendarType | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Get all calendar types
|
|
116
|
+
*/
|
|
117
|
+
getAll(): CalendarType[];
|
|
118
|
+
/**
|
|
119
|
+
* Get visible calendar types
|
|
120
|
+
*/
|
|
121
|
+
getVisible(): CalendarType[];
|
|
122
|
+
/**
|
|
123
|
+
* Check if a calendar exists
|
|
124
|
+
*/
|
|
125
|
+
has(calendarId: string): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Reorder calendars
|
|
128
|
+
* @param fromIndex - Source index
|
|
129
|
+
* @param toIndex - Destination index
|
|
130
|
+
*/
|
|
131
|
+
reorder(fromIndex: number, toIndex: number): void;
|
|
132
|
+
/**
|
|
133
|
+
* Update visibility of a specific calendar type
|
|
134
|
+
*/
|
|
135
|
+
setVisibility(calendarId: string, visible: boolean): void;
|
|
136
|
+
/**
|
|
137
|
+
* Update visibility for all calendar types
|
|
138
|
+
*/
|
|
139
|
+
setAllVisibility(visible: boolean): void;
|
|
140
|
+
/**
|
|
141
|
+
* Update calendar properties
|
|
142
|
+
*/
|
|
143
|
+
updateCalendar(calendarId: string, updates: Partial<CalendarType>): void;
|
|
144
|
+
/**
|
|
145
|
+
* Set the default calendar ID
|
|
146
|
+
*/
|
|
147
|
+
setDefaultCalendar(calendarId: string): void;
|
|
148
|
+
/**
|
|
149
|
+
* Get the default calendar ID
|
|
150
|
+
*/
|
|
151
|
+
getDefaultCalendarId(): string;
|
|
152
|
+
/**
|
|
153
|
+
* Get the default calendar type
|
|
154
|
+
*/
|
|
155
|
+
getDefaultCalendar(): CalendarType;
|
|
156
|
+
/**
|
|
157
|
+
* Set the current theme
|
|
158
|
+
*/
|
|
159
|
+
setTheme(theme: ThemeMode): void;
|
|
160
|
+
/**
|
|
161
|
+
* Get the current theme
|
|
162
|
+
*/
|
|
163
|
+
getTheme(): ThemeMode;
|
|
164
|
+
/**
|
|
165
|
+
* Resolve colors for a calendar ID based on current theme
|
|
166
|
+
*/
|
|
167
|
+
resolveColors(calendarId?: string, theme?: ThemeMode): CalendarColors;
|
|
168
|
+
/**
|
|
169
|
+
* Get selected background color
|
|
170
|
+
*/
|
|
171
|
+
getSelectedBgColor(calendarId?: string, theme?: ThemeMode): string;
|
|
172
|
+
/**
|
|
173
|
+
* Get line color
|
|
174
|
+
*/
|
|
175
|
+
getLineColor(calendarId?: string, theme?: ThemeMode): string;
|
|
176
|
+
/**
|
|
177
|
+
* Get text color
|
|
178
|
+
*/
|
|
179
|
+
getTextColor(calendarId?: string, theme?: ThemeMode): string;
|
|
180
|
+
/**
|
|
181
|
+
* Check if the current theme is dark
|
|
182
|
+
*/
|
|
183
|
+
private isDarkTheme;
|
|
184
|
+
/**
|
|
185
|
+
* Validate calendar configuration
|
|
186
|
+
*/
|
|
187
|
+
validate(calendar: Partial<CalendarType>): string[];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
type LocaleCode = string;
|
|
191
|
+
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';
|
|
192
|
+
type LocaleDict = Partial<Record<TranslationKey, string>>;
|
|
193
|
+
type LocaleMessages = Partial<Record<TranslationKey, string>>;
|
|
194
|
+
interface Locale {
|
|
195
|
+
code: string;
|
|
196
|
+
messages: LocaleDict;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Mobile event drawer/dialog Props
|
|
201
|
+
*/
|
|
202
|
+
interface MobileEventProps {
|
|
203
|
+
/** Whether the drawer/dialog is open */
|
|
204
|
+
isOpen: boolean;
|
|
205
|
+
/** Callback to close the drawer/dialog */
|
|
206
|
+
onClose: () => void;
|
|
207
|
+
/** Callback to save the event (creates or updates) */
|
|
208
|
+
onSave: (event: Event) => void;
|
|
209
|
+
/** Current event data (newly created template or existing event) */
|
|
210
|
+
draftEvent: Event | null;
|
|
211
|
+
/** The ICalendarApp instance providing built-in services */
|
|
212
|
+
app: ICalendarApp;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Custom mobile event renderer (Drawer or Dialog)
|
|
216
|
+
*/
|
|
217
|
+
type MobileEventRenderer = any;
|
|
218
|
+
|
|
219
|
+
/** Generic type for framework-specific components */
|
|
220
|
+
type TComponent = any;
|
|
221
|
+
/** Generic type for framework-specific nodes/elements */
|
|
222
|
+
type TNode = any;
|
|
223
|
+
/**
|
|
224
|
+
* View type enum
|
|
225
|
+
*/
|
|
226
|
+
declare enum ViewType {
|
|
227
|
+
DAY = "day",
|
|
228
|
+
WEEK = "week",
|
|
229
|
+
MONTH = "month",
|
|
230
|
+
YEAR = "year"
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Plugin interface
|
|
234
|
+
* Defines the basic structure of calendar plugins
|
|
235
|
+
*/
|
|
236
|
+
interface CalendarPlugin {
|
|
237
|
+
name: string;
|
|
238
|
+
install: (app: ICalendarApp) => void;
|
|
239
|
+
config?: Record<string, unknown>;
|
|
240
|
+
api?: unknown;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* View interface
|
|
244
|
+
* Defines the basic structure of calendar views
|
|
245
|
+
*/
|
|
246
|
+
interface CalendarView {
|
|
247
|
+
type: ViewType;
|
|
248
|
+
component: TComponent;
|
|
249
|
+
config?: Record<string, unknown>;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Calendar callbacks interface
|
|
253
|
+
* Defines calendar event callback functions
|
|
254
|
+
*/
|
|
255
|
+
interface CalendarCallbacks {
|
|
256
|
+
onViewChange?: (view: ViewType) => void | Promise<void>;
|
|
257
|
+
onEventCreate?: (event: Event) => void | Promise<void>;
|
|
258
|
+
onEventUpdate?: (event: Event) => void | Promise<void>;
|
|
259
|
+
onEventDelete?: (eventId: string) => void | Promise<void>;
|
|
260
|
+
onDateChange?: (date: Date) => void | Promise<void>;
|
|
261
|
+
onRender?: () => void | Promise<void>;
|
|
262
|
+
onVisibleMonthChange?: (date: Date) => void | Promise<void>;
|
|
263
|
+
onCalendarUpdate?: (calendar: CalendarType) => void | Promise<void>;
|
|
264
|
+
onCalendarCreate?: (calendar: CalendarType) => void | Promise<void>;
|
|
265
|
+
onCalendarDelete?: (calendarId: string) => void | Promise<void>;
|
|
266
|
+
onCalendarMerge?: (sourceId: string, targetId: string) => void | Promise<void>;
|
|
267
|
+
onEventClick?: (event: Event) => void | Promise<void>;
|
|
268
|
+
onMoreEventsClick?: (date: Date) => void | Promise<void>;
|
|
269
|
+
}
|
|
270
|
+
interface CreateCalendarDialogProps {
|
|
271
|
+
onClose: () => void;
|
|
272
|
+
onCreate: (calendar: CalendarType) => void;
|
|
273
|
+
colorPickerMode?: 'blossom' | 'default';
|
|
274
|
+
}
|
|
275
|
+
interface CalendarHeaderProps {
|
|
276
|
+
calendar: ICalendarApp;
|
|
277
|
+
switcherMode?: ViewSwitcherMode;
|
|
278
|
+
onAddCalendar?: (e: any) => void;
|
|
279
|
+
onSearchChange?: (value: string) => void;
|
|
280
|
+
/** Triggered when search icon is clicked (typically on mobile) */
|
|
281
|
+
onSearchClick?: () => void;
|
|
282
|
+
searchValue?: string;
|
|
283
|
+
isSearchOpen?: boolean;
|
|
284
|
+
isEditable?: boolean;
|
|
285
|
+
/** Left safe area padding (px) to avoid overlapping with traffic light buttons in macMode */
|
|
286
|
+
safeAreaLeft?: number;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Sidebar render props
|
|
290
|
+
*/
|
|
291
|
+
interface CalendarSidebarRenderProps {
|
|
292
|
+
app: ICalendarApp;
|
|
293
|
+
calendars: CalendarType[];
|
|
294
|
+
toggleCalendarVisibility: (calendarId: string, visible: boolean) => void;
|
|
295
|
+
toggleAll: (visible: boolean) => void;
|
|
296
|
+
isCollapsed: boolean;
|
|
297
|
+
setCollapsed: (collapsed: boolean) => void;
|
|
298
|
+
renderCalendarContextMenu?: (calendar: CalendarType, onClose: () => void) => TNode;
|
|
299
|
+
createCalendarMode?: 'inline' | 'modal';
|
|
300
|
+
renderCreateCalendarDialog?: (props: CreateCalendarDialogProps) => TNode;
|
|
301
|
+
editingCalendarId?: string | null;
|
|
302
|
+
setEditingCalendarId?: (id: string | null) => void;
|
|
303
|
+
onCreateCalendar?: () => void;
|
|
304
|
+
colorPickerMode?: 'blossom' | 'default';
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Sidebar config
|
|
308
|
+
*/
|
|
309
|
+
interface SidebarConfig {
|
|
310
|
+
enabled?: boolean;
|
|
311
|
+
width?: number | string;
|
|
312
|
+
initialCollapsed?: boolean;
|
|
313
|
+
render?: (props: CalendarSidebarRenderProps) => TNode;
|
|
314
|
+
renderCalendarContextMenu?: (calendar: CalendarType, onClose: () => void) => TNode;
|
|
315
|
+
createCalendarMode?: 'inline' | 'modal';
|
|
316
|
+
renderCreateCalendarDialog?: (props: CreateCalendarDialogProps) => TNode;
|
|
317
|
+
/** Color picker mode: 'blossom' for BlossomColorPicker, 'default' for react-color */
|
|
318
|
+
colorPickerMode?: 'blossom' | 'default';
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Calendar application configuration
|
|
322
|
+
* Used to initialize CalendarApp
|
|
323
|
+
*/
|
|
324
|
+
interface CalendarAppConfig {
|
|
325
|
+
views: CalendarView[];
|
|
326
|
+
plugins?: CalendarPlugin[];
|
|
327
|
+
events?: Event[];
|
|
328
|
+
callbacks?: CalendarCallbacks;
|
|
329
|
+
defaultView?: ViewType;
|
|
330
|
+
initialDate?: Date;
|
|
331
|
+
switcherMode?: ViewSwitcherMode;
|
|
332
|
+
calendars?: CalendarType[];
|
|
333
|
+
defaultCalendar?: string;
|
|
334
|
+
theme?: ThemeConfig;
|
|
335
|
+
useSidebar?: boolean | SidebarConfig;
|
|
336
|
+
useEventDetailDialog?: boolean;
|
|
337
|
+
useCalendarHeader?: boolean | ((props: CalendarHeaderProps) => TNode);
|
|
338
|
+
customMobileEventRenderer?: MobileEventRenderer;
|
|
339
|
+
locale?: string | Locale;
|
|
340
|
+
readOnly?: boolean | ReadOnlyConfig;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Read-only configuration
|
|
344
|
+
*/
|
|
345
|
+
interface ReadOnlyConfig {
|
|
346
|
+
draggable?: boolean;
|
|
347
|
+
viewable?: boolean;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Calendar application state
|
|
351
|
+
* Internal state of CalendarApp
|
|
352
|
+
*/
|
|
353
|
+
interface CalendarAppState {
|
|
354
|
+
currentView: ViewType;
|
|
355
|
+
currentDate: Date;
|
|
356
|
+
events: Event[];
|
|
357
|
+
plugins: Map<string, CalendarPlugin>;
|
|
358
|
+
views: Map<ViewType, CalendarView>;
|
|
359
|
+
switcherMode?: ViewSwitcherMode;
|
|
360
|
+
sidebar?: SidebarConfig;
|
|
361
|
+
locale: string | Locale;
|
|
362
|
+
highlightedEventId?: string | null;
|
|
363
|
+
readOnly: boolean | ReadOnlyConfig;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Calendar application instance
|
|
367
|
+
* Core interface of CalendarApp
|
|
368
|
+
*/
|
|
369
|
+
interface ICalendarApp {
|
|
370
|
+
state: CalendarAppState;
|
|
371
|
+
getReadOnlyConfig: () => ReadOnlyConfig;
|
|
372
|
+
subscribe: (listener: (app: ICalendarApp) => void) => () => void;
|
|
373
|
+
changeView: (view: ViewType) => void;
|
|
374
|
+
getCurrentView: () => CalendarView;
|
|
375
|
+
getViewConfig: (viewType: ViewType) => Record<string, unknown>;
|
|
376
|
+
setCurrentDate: (date: Date) => void;
|
|
377
|
+
getCurrentDate: () => Date;
|
|
378
|
+
goToToday: () => void;
|
|
379
|
+
goToPrevious: () => void;
|
|
380
|
+
goToNext: () => void;
|
|
381
|
+
selectDate: (date: Date) => void;
|
|
382
|
+
undo: () => void;
|
|
383
|
+
applyEventsChanges: (changes: {
|
|
384
|
+
add?: Event[];
|
|
385
|
+
update?: Array<{
|
|
386
|
+
id: string;
|
|
387
|
+
updates: Partial<Event>;
|
|
388
|
+
}>;
|
|
389
|
+
delete?: string[];
|
|
390
|
+
}, isPending?: boolean) => void;
|
|
391
|
+
addEvent: (event: Event) => void;
|
|
392
|
+
updateEvent: (id: string, event: Partial<Event>, isPending?: boolean) => void;
|
|
393
|
+
deleteEvent: (id: string) => void;
|
|
394
|
+
getEvents: () => Event[];
|
|
395
|
+
getAllEvents: () => Event[];
|
|
396
|
+
onEventClick: (event: Event) => void;
|
|
397
|
+
onMoreEventsClick: (date: Date) => void;
|
|
398
|
+
highlightEvent: (eventId: string | null) => void;
|
|
399
|
+
getCalendars: () => CalendarType[];
|
|
400
|
+
reorderCalendars: (fromIndex: number, toIndex: number) => void;
|
|
401
|
+
setCalendarVisibility: (calendarId: string, visible: boolean) => void;
|
|
402
|
+
setAllCalendarsVisibility: (visible: boolean) => void;
|
|
403
|
+
updateCalendar: (id: string, updates: Partial<CalendarType>, isPending?: boolean) => void;
|
|
404
|
+
createCalendar: (calendar: CalendarType) => void;
|
|
405
|
+
deleteCalendar: (id: string) => void;
|
|
406
|
+
mergeCalendars: (sourceId: string, targetId: string) => void;
|
|
407
|
+
setVisibleMonth: (date: Date) => void;
|
|
408
|
+
getVisibleMonth: () => Date;
|
|
409
|
+
getPlugin: <T = unknown>(name: string) => T | undefined;
|
|
410
|
+
hasPlugin: (name: string) => boolean;
|
|
411
|
+
getSidebarConfig: () => SidebarConfig;
|
|
412
|
+
getCalendarHeaderConfig: () => boolean | ((props: CalendarHeaderProps) => TNode);
|
|
413
|
+
triggerRender: () => void;
|
|
414
|
+
getCalendarRegistry: () => CalendarRegistry;
|
|
415
|
+
getUseEventDetailDialog: () => boolean;
|
|
416
|
+
getCustomMobileEventRenderer: () => MobileEventRenderer | undefined;
|
|
417
|
+
updateConfig: (config: Partial<CalendarAppConfig>) => void;
|
|
418
|
+
setTheme: (mode: ThemeMode) => void;
|
|
419
|
+
getTheme: () => ThemeMode;
|
|
420
|
+
subscribeThemeChange: (callback: (theme: ThemeMode) => void) => () => void;
|
|
421
|
+
unsubscribeThemeChange: (callback: (theme: ThemeMode) => void) => void;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* useCalendarApp Hook return type
|
|
425
|
+
* Calendar application interface provided for React components
|
|
426
|
+
*/
|
|
427
|
+
interface UseCalendarAppReturn {
|
|
428
|
+
app: ICalendarApp;
|
|
429
|
+
currentView: ViewType;
|
|
430
|
+
currentDate: Date;
|
|
431
|
+
events: Event[];
|
|
432
|
+
applyEventsChanges: (changes: {
|
|
433
|
+
add?: Event[];
|
|
434
|
+
update?: Array<{
|
|
435
|
+
id: string;
|
|
436
|
+
updates: Partial<Event>;
|
|
437
|
+
}>;
|
|
438
|
+
delete?: string[];
|
|
439
|
+
}, isPending?: boolean) => void;
|
|
440
|
+
changeView: (view: ViewType) => void;
|
|
441
|
+
setCurrentDate: (date: Date) => void;
|
|
442
|
+
addEvent: (event: Event) => void;
|
|
443
|
+
updateEvent: (id: string, event: Partial<Event>, isPending?: boolean) => void;
|
|
444
|
+
deleteEvent: (id: string) => void;
|
|
445
|
+
goToToday: () => void;
|
|
446
|
+
goToPrevious: () => void;
|
|
447
|
+
goToNext: () => void;
|
|
448
|
+
selectDate: (date: Date) => void;
|
|
449
|
+
undo: () => void;
|
|
450
|
+
getCalendars: () => CalendarType[];
|
|
451
|
+
createCalendar: (calendar: CalendarType) => void;
|
|
452
|
+
mergeCalendars: (sourceId: string, targetId: string) => void;
|
|
453
|
+
setCalendarVisibility: (calendarId: string, visible: boolean) => void;
|
|
454
|
+
setAllCalendarsVisibility: (visible: boolean) => void;
|
|
455
|
+
getAllEvents: () => Event[];
|
|
456
|
+
highlightEvent: (eventId: string | null) => void;
|
|
457
|
+
setVisibleMonth: (date: Date) => void;
|
|
458
|
+
getVisibleMonth: () => Date;
|
|
459
|
+
sidebarConfig: SidebarConfig;
|
|
460
|
+
readOnlyConfig: ReadOnlyConfig;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Calendar configuration system type
|
|
464
|
+
* Contains drag and view configurations
|
|
465
|
+
*/
|
|
466
|
+
interface CalendarConfig {
|
|
467
|
+
locale?: string;
|
|
468
|
+
drag: {
|
|
469
|
+
HOUR_HEIGHT: number;
|
|
470
|
+
FIRST_HOUR: number;
|
|
471
|
+
LAST_HOUR: number;
|
|
472
|
+
MIN_DURATION: number;
|
|
473
|
+
TIME_COLUMN_WIDTH: number;
|
|
474
|
+
ALL_DAY_HEIGHT: number;
|
|
475
|
+
getLineColor: (color: string) => string;
|
|
476
|
+
getDynamicPadding: (drag: {
|
|
477
|
+
endHour: number;
|
|
478
|
+
startHour: number;
|
|
479
|
+
}) => string;
|
|
480
|
+
};
|
|
481
|
+
views: {
|
|
482
|
+
day: Record<string, unknown>;
|
|
483
|
+
week: Record<string, unknown>;
|
|
484
|
+
month: Record<string, unknown>;
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
interface UseCalendarReturn {
|
|
488
|
+
view: ViewType;
|
|
489
|
+
currentDate: Date;
|
|
490
|
+
events: Event[];
|
|
491
|
+
currentWeekStart: Date;
|
|
492
|
+
changeView: (view: ViewType) => void;
|
|
493
|
+
goToToday: () => void;
|
|
494
|
+
goToPrevious: () => void;
|
|
495
|
+
goToNext: () => void;
|
|
496
|
+
selectDate: (date: Date) => void;
|
|
497
|
+
updateEvent: (eventId: string, updates: Partial<Event>, isPending?: boolean) => void;
|
|
498
|
+
deleteEvent: (eventId: string) => void;
|
|
499
|
+
addEvent: (event: Omit<Event, 'id'>) => void;
|
|
500
|
+
setEvents: (events: Event[] | ((prev: Event[]) => Event[])) => void;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Date data interface
|
|
505
|
+
* Represents detailed information for a single date
|
|
506
|
+
*/
|
|
507
|
+
interface DayData {
|
|
508
|
+
date: Date;
|
|
509
|
+
day: number;
|
|
510
|
+
month: number;
|
|
511
|
+
year: number;
|
|
512
|
+
monthName: string;
|
|
513
|
+
shortMonthName: string;
|
|
514
|
+
isToday: boolean;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Week data interface
|
|
518
|
+
* Represents a week's data, containing date information for 7 days
|
|
519
|
+
*/
|
|
520
|
+
interface WeeksData {
|
|
521
|
+
days: DayData[];
|
|
522
|
+
startDate: Date;
|
|
523
|
+
monthYear: {
|
|
524
|
+
month: string;
|
|
525
|
+
monthIndex: number;
|
|
526
|
+
year: number;
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Event layout configuration constants
|
|
532
|
+
* Controls visual presentation of events in the calendar
|
|
533
|
+
*/
|
|
534
|
+
declare const LAYOUT_CONFIG: {
|
|
535
|
+
readonly INDENT_STEP: 2;
|
|
536
|
+
readonly MIN_WIDTH: 25;
|
|
537
|
+
readonly MARGIN_BETWEEN: 2;
|
|
538
|
+
readonly CONTAINER_WIDTH: 320;
|
|
539
|
+
readonly OVERLAP_THRESHOLD: 0.25;
|
|
540
|
+
readonly EDGE_MARGIN: 3;
|
|
541
|
+
readonly MAX_LOAD_IMBALANCE: 0;
|
|
542
|
+
readonly REBALANCE_THRESHOLD: 2;
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* Event layout interface
|
|
546
|
+
* Defines position and styling of events in the UI
|
|
547
|
+
*/
|
|
548
|
+
interface EventLayout {
|
|
549
|
+
id: string;
|
|
550
|
+
left: number;
|
|
551
|
+
width: number;
|
|
552
|
+
zIndex: number;
|
|
553
|
+
level: number;
|
|
554
|
+
isPrimary: boolean;
|
|
555
|
+
indentOffset: number;
|
|
556
|
+
importance: number;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Nested layer interface
|
|
560
|
+
* Represents hierarchical relationships of events
|
|
561
|
+
*/
|
|
562
|
+
interface NestedLayer {
|
|
563
|
+
events: Event[];
|
|
564
|
+
level: number;
|
|
565
|
+
parentEvent?: Event;
|
|
566
|
+
timeSlot?: {
|
|
567
|
+
start: number;
|
|
568
|
+
end: number;
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Event group interface
|
|
573
|
+
* Represents a group of related events and their nested structure
|
|
574
|
+
*/
|
|
575
|
+
interface EventGroup {
|
|
576
|
+
events: Event[];
|
|
577
|
+
startHour: number;
|
|
578
|
+
endHour: number;
|
|
579
|
+
primaryEvent?: Event;
|
|
580
|
+
nestedStructure: NestedLayer[];
|
|
581
|
+
specialLayoutRules?: SpecialLayoutRule[];
|
|
582
|
+
originalBranchMap?: Map<string, Event>;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Event relationship information interface
|
|
586
|
+
* Describes relationships of events in nested structures
|
|
587
|
+
*/
|
|
588
|
+
interface EventRelations {
|
|
589
|
+
directChildren: Event[];
|
|
590
|
+
allDescendants: Event[];
|
|
591
|
+
directParent: Event | null;
|
|
592
|
+
layer: NestedLayer | null;
|
|
593
|
+
subtreeSize: number;
|
|
594
|
+
isLeaf: boolean;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Subtree analysis interface
|
|
598
|
+
* Used to analyze structural information of event trees
|
|
599
|
+
*/
|
|
600
|
+
interface SubtreeAnalysis {
|
|
601
|
+
rootEvent: Event;
|
|
602
|
+
allDescendants: Event[];
|
|
603
|
+
timeSpan: {
|
|
604
|
+
start: number;
|
|
605
|
+
end: number;
|
|
606
|
+
duration: number;
|
|
607
|
+
};
|
|
608
|
+
descendantCount: number;
|
|
609
|
+
maxDepth: number;
|
|
610
|
+
branchPath: Event[];
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Balance strategy interface
|
|
614
|
+
* Used for balance algorithms to optimize event layouts
|
|
615
|
+
*/
|
|
616
|
+
interface BalanceStrategy {
|
|
617
|
+
type: 'count_balance' | 'timespan_balance';
|
|
618
|
+
transfers: TransferOperation[];
|
|
619
|
+
specialLayoutRules: SpecialLayoutRule[];
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Transfer operation interface
|
|
623
|
+
* Describes movement of events in layout optimization
|
|
624
|
+
*/
|
|
625
|
+
interface TransferOperation {
|
|
626
|
+
event: Event;
|
|
627
|
+
fromParent: Event;
|
|
628
|
+
toParent: Event;
|
|
629
|
+
reason: string;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Special layout rule interface
|
|
633
|
+
* Defines layout constraints for specific events
|
|
634
|
+
*/
|
|
635
|
+
interface SpecialLayoutRule {
|
|
636
|
+
eventId: string;
|
|
637
|
+
layoutType: 'align_with_ancestor' | 'full_width' | 'full_width_from_level' | 'align_with_sibling';
|
|
638
|
+
referenceEvent?: Event;
|
|
639
|
+
targetLevel?: number;
|
|
640
|
+
reason?: string;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Virtual scroll item interface (YearView)
|
|
645
|
+
*/
|
|
646
|
+
interface VirtualItem {
|
|
647
|
+
index: number;
|
|
648
|
+
year: number;
|
|
649
|
+
top: number;
|
|
650
|
+
height: number;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Virtual scroll Hook parameters interface (YearView)
|
|
654
|
+
*/
|
|
655
|
+
interface UseVirtualScrollProps {
|
|
656
|
+
currentDate: Date;
|
|
657
|
+
yearHeight: number;
|
|
658
|
+
onCurrentYearChange?: (year: number) => void;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Virtual scroll Hook return value interface (YearView)
|
|
662
|
+
*/
|
|
663
|
+
interface UseVirtualScrollReturn {
|
|
664
|
+
scrollTop: number;
|
|
665
|
+
containerHeight: number;
|
|
666
|
+
currentYear: number;
|
|
667
|
+
isScrolling: boolean;
|
|
668
|
+
virtualData: {
|
|
669
|
+
totalHeight: number;
|
|
670
|
+
visibleItems: VirtualItem[];
|
|
671
|
+
};
|
|
672
|
+
scrollElementRef: any;
|
|
673
|
+
handleScroll: (e: any) => void;
|
|
674
|
+
scrollToYear: (targetYear: number, smooth?: boolean) => void;
|
|
675
|
+
handlePreviousYear: () => void;
|
|
676
|
+
handleNextYear: () => void;
|
|
677
|
+
handleToday: () => void;
|
|
678
|
+
setScrollTop: (val: number | ((prev: number) => number)) => void;
|
|
679
|
+
setContainerHeight: (val: number | ((prev: number) => number)) => void;
|
|
680
|
+
setCurrentYear: (val: number | ((prev: number) => number)) => void;
|
|
681
|
+
setIsScrolling: (val: boolean | ((prev: boolean) => boolean)) => void;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Drag state Hook return value
|
|
685
|
+
*/
|
|
686
|
+
interface UseDragStateReturn {
|
|
687
|
+
dragRef: RefObject<UnifiedDragRef>;
|
|
688
|
+
currentDragRef: RefObject<{
|
|
689
|
+
x: number;
|
|
690
|
+
y: number;
|
|
691
|
+
}>;
|
|
692
|
+
dragState: MonthDragState | WeekDayDragState;
|
|
693
|
+
setDragState: (val: MonthDragState | WeekDayDragState | ((prev: MonthDragState | WeekDayDragState) => MonthDragState | WeekDayDragState)) => void;
|
|
694
|
+
resetDragState: () => void;
|
|
695
|
+
throttledSetEvents: (updateFunc: (events: Event[]) => Event[], dragState?: string) => void;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Drag common utilities Hook return value
|
|
699
|
+
*/
|
|
700
|
+
interface UseDragCommonReturn {
|
|
701
|
+
pixelYToHour: (y: number) => number;
|
|
702
|
+
getColumnDayIndex: (x: number) => number;
|
|
703
|
+
checkIfInAllDayArea: (clientY: number) => boolean;
|
|
704
|
+
handleDirectScroll: (clientY: number) => void;
|
|
705
|
+
daysDifference: (date1: Date, date2: Date) => number;
|
|
706
|
+
addDaysToDate: (date: Date, days: number) => Date;
|
|
707
|
+
getTargetDateFromPosition: (clientX: number, clientY: number) => Date | null;
|
|
708
|
+
ONE_DAY_MS: number;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Drag management Hook return value
|
|
712
|
+
*/
|
|
713
|
+
interface UseDragManagerReturn {
|
|
714
|
+
dragIndicatorRef: RefObject<HTMLDivElement | null>;
|
|
715
|
+
removeDragIndicator: () => void;
|
|
716
|
+
createDragIndicator: (drag: UnifiedDragRef, color?: string, title?: string, layout?: EventLayout | null, sourceElement?: HTMLElement) => void;
|
|
717
|
+
updateDragIndicator: (...args: (number | boolean | EventLayout | null | undefined)[]) => void;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Drag handler Hook return value
|
|
721
|
+
*/
|
|
722
|
+
interface UseDragHandlersReturn {
|
|
723
|
+
handleDragMove: (e: MouseEvent | TouchEvent) => void;
|
|
724
|
+
handleDragEnd: (e: MouseEvent | TouchEvent) => void;
|
|
725
|
+
handleCreateStart: (e: any | any, ...args: (Date | number)[]) => void;
|
|
726
|
+
handleMoveStart: (e: any | any, event: Event) => void;
|
|
727
|
+
handleResizeStart: (e: any | any, event: Event, direction: string) => void;
|
|
728
|
+
handleUniversalDragMove: (e: MouseEvent | TouchEvent) => void;
|
|
729
|
+
handleUniversalDragEnd: (e?: MouseEvent | TouchEvent) => void;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Drag handler Hook parameters
|
|
733
|
+
*/
|
|
734
|
+
interface UseDragHandlersParams {
|
|
735
|
+
options: useDragProps;
|
|
736
|
+
common: UseDragCommonReturn;
|
|
737
|
+
state: UseDragStateReturn;
|
|
738
|
+
manager: UseDragManagerReturn;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Drag mode type
|
|
743
|
+
*/
|
|
744
|
+
type Mode = 'create' | 'move' | 'resize' | null;
|
|
745
|
+
/**
|
|
746
|
+
* Drag reference interface
|
|
747
|
+
* Stores state information for drag operations
|
|
748
|
+
*/
|
|
749
|
+
interface DragRef {
|
|
750
|
+
active: boolean;
|
|
751
|
+
mode: Mode;
|
|
752
|
+
eventId: string | null;
|
|
753
|
+
dayIndex: number;
|
|
754
|
+
startX: number;
|
|
755
|
+
startY: number;
|
|
756
|
+
startHour: number;
|
|
757
|
+
endHour: number;
|
|
758
|
+
originalDay: number;
|
|
759
|
+
originalStartHour: number;
|
|
760
|
+
originalEndHour: number;
|
|
761
|
+
resizeDirection: string | null;
|
|
762
|
+
hourOffset: number | null;
|
|
763
|
+
duration: number;
|
|
764
|
+
lastRawMouseHour: number | null;
|
|
765
|
+
lastUpdateTime: number;
|
|
766
|
+
initialMouseY: number;
|
|
767
|
+
lastClientY: number;
|
|
768
|
+
allDay: boolean;
|
|
769
|
+
eventDate?: Date;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Event detail position interface
|
|
773
|
+
* Used to position event detail popup
|
|
774
|
+
*/
|
|
775
|
+
interface EventDetailPosition {
|
|
776
|
+
top: number;
|
|
777
|
+
left: number;
|
|
778
|
+
eventHeight: number;
|
|
779
|
+
eventMiddleY: number;
|
|
780
|
+
isSunday?: boolean;
|
|
781
|
+
}
|
|
782
|
+
interface DragIndicatorProps {
|
|
783
|
+
drag: DragRef;
|
|
784
|
+
color?: string;
|
|
785
|
+
title?: string;
|
|
786
|
+
layout?: EventLayout | null;
|
|
787
|
+
allDay: boolean;
|
|
788
|
+
formatTime: (hour: number) => string;
|
|
789
|
+
getLineColor: (color: string) => string;
|
|
790
|
+
getDynamicPadding: (drag: DragRef) => string;
|
|
791
|
+
locale?: string;
|
|
792
|
+
isMobile?: boolean;
|
|
793
|
+
}
|
|
794
|
+
interface DragIndicatorRenderer {
|
|
795
|
+
renderAllDayContent: (props: DragIndicatorProps) => any;
|
|
796
|
+
renderRegularContent: (props: DragIndicatorProps) => any;
|
|
797
|
+
renderDefaultContent: (props: DragIndicatorProps) => any;
|
|
798
|
+
}
|
|
799
|
+
interface UnifiedDragRef extends DragRef {
|
|
800
|
+
targetDate?: Date | null;
|
|
801
|
+
originalDate?: Date | null;
|
|
802
|
+
originalEvent?: Event | null;
|
|
803
|
+
dragOffset?: number;
|
|
804
|
+
originalStartDate?: Date | null;
|
|
805
|
+
originalEndDate?: Date | null;
|
|
806
|
+
eventDate?: Date;
|
|
807
|
+
originalStartTime?: {
|
|
808
|
+
hour: number;
|
|
809
|
+
minute: number;
|
|
810
|
+
second: number;
|
|
811
|
+
} | null;
|
|
812
|
+
originalEndTime?: {
|
|
813
|
+
hour: number;
|
|
814
|
+
minute: number;
|
|
815
|
+
second: number;
|
|
816
|
+
} | null;
|
|
817
|
+
sourceElement?: HTMLElement | null;
|
|
818
|
+
indicatorVisible?: boolean;
|
|
819
|
+
eventDurationDays?: number;
|
|
820
|
+
currentSegmentDays?: number;
|
|
821
|
+
startDragDayIndex?: number;
|
|
822
|
+
calendarId?: string;
|
|
823
|
+
title?: string;
|
|
824
|
+
}
|
|
825
|
+
interface useDragProps extends Partial<DragConfig> {
|
|
826
|
+
calendarRef: any;
|
|
827
|
+
allDayRowRef?: any;
|
|
828
|
+
onEventsUpdate: (updateFunc: (events: Event[]) => Event[], isResizing?: boolean) => void;
|
|
829
|
+
onEventCreate: (event: Event) => void;
|
|
830
|
+
onEventEdit?: (event: Event) => void;
|
|
831
|
+
calculateNewEventLayout?: (dayIndex: number, startHour: number, endHour: number) => EventLayout | null;
|
|
832
|
+
calculateDragLayout?: (event: Event, targetDay: number, targetStartHour: number, targetEndHour: number) => EventLayout | null;
|
|
833
|
+
currentWeekStart: Date;
|
|
834
|
+
events: Event[];
|
|
835
|
+
renderer?: DragIndicatorRenderer;
|
|
836
|
+
app?: ICalendarApp;
|
|
837
|
+
isMobile?: boolean;
|
|
838
|
+
}
|
|
839
|
+
type MonthDragState = {
|
|
840
|
+
active: boolean;
|
|
841
|
+
mode: 'create' | 'move' | 'resize' | null;
|
|
842
|
+
eventId: string | null;
|
|
843
|
+
targetDate: Date | null;
|
|
844
|
+
startDate: Date | null;
|
|
845
|
+
endDate: Date | null;
|
|
846
|
+
};
|
|
847
|
+
type WeekDayDragState = {
|
|
848
|
+
active: boolean;
|
|
849
|
+
mode: 'create' | 'move' | 'resize' | null;
|
|
850
|
+
eventId: string | null;
|
|
851
|
+
dayIndex: number;
|
|
852
|
+
startHour: number;
|
|
853
|
+
endHour: number;
|
|
854
|
+
allDay: boolean;
|
|
855
|
+
};
|
|
856
|
+
interface useDragReturn {
|
|
857
|
+
createDragIndicator: (drag: UnifiedDragRef, color?: string, title?: string, layout?: EventLayout | null, sourceElement?: HTMLElement) => void;
|
|
858
|
+
updateDragIndicator: (...args: (number | boolean | EventLayout | null | undefined)[]) => void;
|
|
859
|
+
removeDragIndicator: () => void;
|
|
860
|
+
handleCreateAllDayEvent?: (e: any, dayIndex: number) => void;
|
|
861
|
+
handleCreateStart: (e: any | any, ...args: (Date | number)[]) => void;
|
|
862
|
+
handleMoveStart: (e: any | any, event: Event) => void;
|
|
863
|
+
handleResizeStart: (e: any | any, event: Event, direction: string) => void;
|
|
864
|
+
dragState: MonthDragState | WeekDayDragState;
|
|
865
|
+
isDragging: boolean;
|
|
866
|
+
pixelYToHour?: (y: number) => number;
|
|
867
|
+
getColumnDayIndex?: (x: number) => number;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Month view event drag state (alias for MonthDragState, maintains backward compatibility)
|
|
871
|
+
*/
|
|
872
|
+
type MonthEventDragState = MonthDragState;
|
|
873
|
+
interface UseMonthDragReturn {
|
|
874
|
+
daysDifference: (date1: Date, date2: Date) => number;
|
|
875
|
+
addDaysToDate: (date: Date, days: number) => Date;
|
|
876
|
+
getTargetDateFromPosition: (clientX: number, clientY: number) => Date | null;
|
|
877
|
+
}
|
|
878
|
+
interface UseMonthDragParams {
|
|
879
|
+
options: useDragProps;
|
|
880
|
+
common: UseDragCommonReturn;
|
|
881
|
+
state: UseDragStateReturn;
|
|
882
|
+
manager: UseDragManagerReturn;
|
|
883
|
+
}
|
|
884
|
+
interface UseWeekDayDragReturn {
|
|
885
|
+
handleCreateAllDayEvent: (e: any, dayIndex: number) => void;
|
|
886
|
+
pixelYToHour: (y: number) => number;
|
|
887
|
+
getColumnDayIndex: (x: number) => number;
|
|
888
|
+
}
|
|
889
|
+
interface UseWeekDayDragParams {
|
|
890
|
+
options: useDragProps;
|
|
891
|
+
common: UseDragCommonReturn;
|
|
892
|
+
state: UseDragStateReturn;
|
|
893
|
+
manager: UseDragManagerReturn;
|
|
894
|
+
handleDragMove: (e: MouseEvent) => void;
|
|
895
|
+
handleDragEnd: (e: MouseEvent) => void;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
interface UseVirtualMonthScrollProps {
|
|
899
|
+
currentDate: Date;
|
|
900
|
+
weekHeight: number;
|
|
901
|
+
onCurrentMonthChange?: (month: string, year: number) => void;
|
|
902
|
+
initialWeeksToLoad?: number;
|
|
903
|
+
locale?: string;
|
|
904
|
+
isEnabled?: boolean;
|
|
905
|
+
}
|
|
906
|
+
interface UseVirtualMonthScrollReturn {
|
|
907
|
+
scrollTop: number;
|
|
908
|
+
containerHeight: number;
|
|
909
|
+
currentMonth: string;
|
|
910
|
+
currentYear: number;
|
|
911
|
+
isScrolling: boolean;
|
|
912
|
+
virtualData: {
|
|
913
|
+
totalHeight: number;
|
|
914
|
+
visibleItems: VirtualWeekItem[];
|
|
915
|
+
displayStartIndex: number;
|
|
916
|
+
};
|
|
917
|
+
scrollElementRef: any;
|
|
918
|
+
handleScroll: (e: any) => void;
|
|
919
|
+
scrollToDate: (targetDate: Date, smooth?: boolean) => void;
|
|
920
|
+
handlePreviousMonth: () => void;
|
|
921
|
+
handleNextMonth: () => void;
|
|
922
|
+
handleToday: () => void;
|
|
923
|
+
setScrollTop: React.Dispatch<React.SetStateAction<number>>;
|
|
924
|
+
setContainerHeight: React.Dispatch<React.SetStateAction<number>>;
|
|
925
|
+
setCurrentMonth: React.Dispatch<React.SetStateAction<string>>;
|
|
926
|
+
setCurrentYear: React.Dispatch<React.SetStateAction<number>>;
|
|
927
|
+
setIsScrolling: React.Dispatch<React.SetStateAction<boolean>>;
|
|
928
|
+
cache: WeekDataCache;
|
|
929
|
+
scrollElementRefCallback: (element: HTMLDivElement | null) => void;
|
|
930
|
+
weeksData: WeeksData[];
|
|
931
|
+
}
|
|
932
|
+
declare const VIRTUAL_MONTH_SCROLL_CONFIG: {
|
|
933
|
+
readonly OVERSCAN: 6;
|
|
934
|
+
readonly BUFFER_SIZE: 100;
|
|
935
|
+
readonly MIN_YEAR: 1900;
|
|
936
|
+
readonly MAX_YEAR: 2200;
|
|
937
|
+
readonly SCROLL_THROTTLE: 8;
|
|
938
|
+
readonly SCROLL_DEBOUNCE: 150;
|
|
939
|
+
readonly CACHE_CLEANUP_THRESHOLD: 200;
|
|
940
|
+
readonly MOBILE_WEEK_HEIGHT: 80;
|
|
941
|
+
readonly TABLET_WEEK_HEIGHT: 90;
|
|
942
|
+
readonly WEEK_HEIGHT: 119;
|
|
943
|
+
};
|
|
944
|
+
interface VirtualWeekItem {
|
|
945
|
+
index: number;
|
|
946
|
+
weekData: WeeksData;
|
|
947
|
+
top: number;
|
|
948
|
+
height: number;
|
|
949
|
+
}
|
|
950
|
+
declare class WeekDataCache {
|
|
951
|
+
private cache;
|
|
952
|
+
private accessOrder;
|
|
953
|
+
private maxSize;
|
|
954
|
+
constructor(maxSize?: number);
|
|
955
|
+
private getKey;
|
|
956
|
+
get(weekStartDate: Date): WeeksData | undefined;
|
|
957
|
+
set(weekStartDate: Date, data: WeeksData): void;
|
|
958
|
+
private updateAccessOrder;
|
|
959
|
+
getSize(): number;
|
|
960
|
+
clear(): void;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Event detail panel Props
|
|
965
|
+
*/
|
|
966
|
+
interface EventDetailPanelProps {
|
|
967
|
+
/** Current event data */
|
|
968
|
+
event: Event;
|
|
969
|
+
/** Panel position information */
|
|
970
|
+
position: EventDetailPosition;
|
|
971
|
+
/** Panel DOM reference */
|
|
972
|
+
panelRef: any;
|
|
973
|
+
/** Whether the event is all-day */
|
|
974
|
+
isAllDay: boolean;
|
|
975
|
+
/** Event visibility state */
|
|
976
|
+
eventVisibility: 'visible' | 'sticky-top' | 'sticky-bottom';
|
|
977
|
+
/** Calendar container reference */
|
|
978
|
+
calendarRef: any;
|
|
979
|
+
/** Selected event element reference */
|
|
980
|
+
selectedEventElementRef: any;
|
|
981
|
+
/** Event update callback */
|
|
982
|
+
onEventUpdate: (updatedEvent: Event) => void;
|
|
983
|
+
/** Event delete callback */
|
|
984
|
+
onEventDelete: (eventId: string) => void;
|
|
985
|
+
/** Close panel callback (optional) */
|
|
986
|
+
onClose?: () => void;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Custom event detail panel renderer (full panel including positioning and styling)
|
|
990
|
+
*/
|
|
991
|
+
type EventDetailPanelRenderer = any;
|
|
992
|
+
/**
|
|
993
|
+
* Event detail content Props (excluding panel container, content only)
|
|
994
|
+
*/
|
|
995
|
+
interface EventDetailContentProps {
|
|
996
|
+
/** Current event data */
|
|
997
|
+
event: Event;
|
|
998
|
+
/** Whether the event is all-day */
|
|
999
|
+
isAllDay: boolean;
|
|
1000
|
+
/** Event update callback */
|
|
1001
|
+
onEventUpdate: (updatedEvent: Event) => void;
|
|
1002
|
+
/** Event delete callback */
|
|
1003
|
+
onEventDelete: (eventId: string) => void;
|
|
1004
|
+
/** Close panel callback (optional) */
|
|
1005
|
+
onClose?: () => void;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Custom event detail content renderer (content only, will be wrapped in default panel)
|
|
1009
|
+
*/
|
|
1010
|
+
type EventDetailContentRenderer = any;
|
|
1011
|
+
/**
|
|
1012
|
+
* Event detail dialog Props
|
|
1013
|
+
*/
|
|
1014
|
+
interface EventDetailDialogProps {
|
|
1015
|
+
/** Current event data */
|
|
1016
|
+
event: Event;
|
|
1017
|
+
/** Whether the dialog is open */
|
|
1018
|
+
isOpen: boolean;
|
|
1019
|
+
/** Whether the event is all-day */
|
|
1020
|
+
isAllDay: boolean;
|
|
1021
|
+
/** Event update callback */
|
|
1022
|
+
onEventUpdate: (updatedEvent: Event) => void;
|
|
1023
|
+
/** Event delete callback */
|
|
1024
|
+
onEventDelete: (eventId: string) => void;
|
|
1025
|
+
/** Close dialog callback */
|
|
1026
|
+
onClose: () => void;
|
|
1027
|
+
app?: ICalendarApp;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Custom event detail dialog renderer (Dialog/Modal mode)
|
|
1031
|
+
*/
|
|
1032
|
+
type EventDetailDialogRenderer = any;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Common Props interface for view components
|
|
1036
|
+
* Base properties for all view components
|
|
1037
|
+
*/
|
|
1038
|
+
interface BaseViewProps<TConfig = any> {
|
|
1039
|
+
app: ICalendarApp;
|
|
1040
|
+
currentDate?: Date;
|
|
1041
|
+
currentView?: ViewType;
|
|
1042
|
+
events?: Event[];
|
|
1043
|
+
onEventUpdate?: (event: Event) => void;
|
|
1044
|
+
onEventDelete?: (eventId: string) => void;
|
|
1045
|
+
onEventCreate?: (event: Event) => void;
|
|
1046
|
+
onDateChange?: (date: Date) => void;
|
|
1047
|
+
onViewChange?: (view: ViewType) => void;
|
|
1048
|
+
config: TConfig;
|
|
1049
|
+
selectedEventId?: string | null;
|
|
1050
|
+
onEventSelect?: (eventId: string | null) => void;
|
|
1051
|
+
detailPanelEventId?: string | null;
|
|
1052
|
+
onDetailPanelToggle?: (eventId: string | null) => void;
|
|
1053
|
+
customDetailPanelContent?: EventDetailContentRenderer;
|
|
1054
|
+
customEventDetailDialog?: EventDetailDialogRenderer;
|
|
1055
|
+
calendarRef: any;
|
|
1056
|
+
switcherMode?: ViewSwitcherMode;
|
|
1057
|
+
meta?: Record<string, any>;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Day view specific Props
|
|
1061
|
+
*/
|
|
1062
|
+
interface DayViewProps extends BaseViewProps<DayViewConfig> {
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Week view specific Props
|
|
1066
|
+
*/
|
|
1067
|
+
interface WeekViewProps extends BaseViewProps<WeekViewConfig> {
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Month view specific Props
|
|
1071
|
+
*/
|
|
1072
|
+
interface MonthViewProps extends BaseViewProps<MonthViewConfig> {
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Year view specific Props
|
|
1076
|
+
*/
|
|
1077
|
+
interface YearViewProps extends BaseViewProps<YearViewConfig> {
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* View factory configuration interface
|
|
1081
|
+
* Base configuration for creating views
|
|
1082
|
+
*/
|
|
1083
|
+
interface ViewFactoryConfig {
|
|
1084
|
+
enableDrag?: boolean;
|
|
1085
|
+
enableResize?: boolean;
|
|
1086
|
+
enableCreate?: boolean;
|
|
1087
|
+
dragConfig?: Record<string, any>;
|
|
1088
|
+
eventsConfig?: Record<string, any>;
|
|
1089
|
+
virtualScrollConfig?: Record<string, any>;
|
|
1090
|
+
viewConfig?: Record<string, any>;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Day view factory configuration
|
|
1094
|
+
*/
|
|
1095
|
+
interface DayViewConfig extends ViewFactoryConfig {
|
|
1096
|
+
showMiniCalendar?: boolean;
|
|
1097
|
+
showAllDay?: boolean;
|
|
1098
|
+
scrollToCurrentTime?: boolean;
|
|
1099
|
+
hourHeight?: number;
|
|
1100
|
+
firstHour?: number;
|
|
1101
|
+
lastHour?: number;
|
|
1102
|
+
HOUR_HEIGHT?: number;
|
|
1103
|
+
FIRST_HOUR?: number;
|
|
1104
|
+
LAST_HOUR?: number;
|
|
1105
|
+
ALL_DAY_HEIGHT?: number;
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Week view factory configuration
|
|
1109
|
+
*/
|
|
1110
|
+
interface WeekViewConfig extends ViewFactoryConfig {
|
|
1111
|
+
showWeekends?: boolean;
|
|
1112
|
+
showAllDay?: boolean;
|
|
1113
|
+
startOfWeek?: number;
|
|
1114
|
+
scrollToCurrentTime?: boolean;
|
|
1115
|
+
hourHeight?: number;
|
|
1116
|
+
firstHour?: number;
|
|
1117
|
+
lastHour?: number;
|
|
1118
|
+
HOUR_HEIGHT?: number;
|
|
1119
|
+
FIRST_HOUR?: number;
|
|
1120
|
+
LAST_HOUR?: number;
|
|
1121
|
+
ALL_DAY_HEIGHT?: number;
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Month view factory configuration
|
|
1125
|
+
*/
|
|
1126
|
+
interface MonthViewConfig extends ViewFactoryConfig {
|
|
1127
|
+
showOtherMonth?: boolean;
|
|
1128
|
+
weekHeight?: number;
|
|
1129
|
+
showWeekNumbers?: boolean;
|
|
1130
|
+
enableVirtualScroll?: boolean;
|
|
1131
|
+
initialWeeksToLoad?: number;
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Year view factory configuration
|
|
1135
|
+
*/
|
|
1136
|
+
interface YearViewConfig extends ViewFactoryConfig {
|
|
1137
|
+
enableVirtualScroll?: boolean;
|
|
1138
|
+
showDebugInfo?: boolean;
|
|
1139
|
+
mode?: 'year-canvas' | 'fixed-week';
|
|
1140
|
+
showTimedEventsInYearView?: boolean;
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* View adapter Props
|
|
1144
|
+
* Adapter properties for wrapping original components
|
|
1145
|
+
*/
|
|
1146
|
+
interface ViewAdapterProps extends BaseViewProps {
|
|
1147
|
+
viewType: ViewType;
|
|
1148
|
+
originalComponent: any;
|
|
1149
|
+
config: ViewFactoryConfig;
|
|
1150
|
+
className?: string;
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Drag integration Props
|
|
1154
|
+
* Properties for integrating drag functionality into views
|
|
1155
|
+
*/
|
|
1156
|
+
interface DragIntegrationProps {
|
|
1157
|
+
app: ICalendarApp;
|
|
1158
|
+
viewType: ViewType;
|
|
1159
|
+
calendarRef: any;
|
|
1160
|
+
allDayRowRef?: any;
|
|
1161
|
+
events: Event[];
|
|
1162
|
+
onEventsUpdate: (updateFunc: (events: Event[]) => Event[]) => void;
|
|
1163
|
+
onEventCreate: (event: Event) => void;
|
|
1164
|
+
calculateNewEventLayout?: (dayIndex: number, startHour: number, endHour: number) => EventLayout | null;
|
|
1165
|
+
calculateDragLayout?: (event: Event, targetDay: number, targetStartHour: number, targetEndHour: number) => EventLayout | null;
|
|
1166
|
+
currentWeekStart: Date;
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Virtual scroll integration Props
|
|
1170
|
+
* Properties for integrating virtual scroll functionality into views
|
|
1171
|
+
*/
|
|
1172
|
+
interface VirtualScrollIntegrationProps {
|
|
1173
|
+
app: ICalendarApp;
|
|
1174
|
+
currentDate: Date;
|
|
1175
|
+
weekHeight?: number;
|
|
1176
|
+
onCurrentMonthChange?: (month: string, year: number) => void;
|
|
1177
|
+
initialWeeksToLoad?: number;
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Factory function return type
|
|
1181
|
+
* Type definition for view factory functions
|
|
1182
|
+
*/
|
|
1183
|
+
interface ViewFactory<TConfig = ViewFactoryConfig> {
|
|
1184
|
+
(config?: TConfig): CalendarView;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* Drag configuration type
|
|
1189
|
+
* Defines configuration parameters for drag functionality
|
|
1190
|
+
*/
|
|
1191
|
+
interface DragConfig {
|
|
1192
|
+
viewType: ViewType;
|
|
1193
|
+
getLineColor: (color: string) => string;
|
|
1194
|
+
getDynamicPadding: (drag: {
|
|
1195
|
+
endHour: number;
|
|
1196
|
+
startHour: number;
|
|
1197
|
+
}) => string;
|
|
1198
|
+
HOUR_HEIGHT: number;
|
|
1199
|
+
FIRST_HOUR: number;
|
|
1200
|
+
LAST_HOUR: number;
|
|
1201
|
+
MIN_DURATION: number;
|
|
1202
|
+
TIME_COLUMN_WIDTH: number;
|
|
1203
|
+
ALL_DAY_HEIGHT: number;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Events service interface
|
|
1208
|
+
* Provides various event management functions
|
|
1209
|
+
*/
|
|
1210
|
+
interface EventsService {
|
|
1211
|
+
getAll: () => Event[];
|
|
1212
|
+
getById: (id: string) => Event | undefined;
|
|
1213
|
+
add: (event: Event) => void;
|
|
1214
|
+
update: (id: string, updates: Partial<Event>) => Event;
|
|
1215
|
+
delete: (id: string) => void;
|
|
1216
|
+
getByDate: (date: Date) => Event[];
|
|
1217
|
+
getByDateRange: (startDate: Date, endDate: Date) => Event[];
|
|
1218
|
+
getByDay: (dayIndex: number, weekStart: Date) => Event[];
|
|
1219
|
+
getAllDayEvents: (dayIndex: number, events: Event[]) => Event[];
|
|
1220
|
+
recalculateEventDays: (events: Event[], weekStart: Date) => Event[];
|
|
1221
|
+
validateEvent: (event: Partial<Event>) => string[];
|
|
1222
|
+
filterEvents: (events: Event[], filter: (event: Event) => boolean) => Event[];
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Events plugin configuration
|
|
1226
|
+
*/
|
|
1227
|
+
interface EventsPluginConfig {
|
|
1228
|
+
enableAutoRecalculate?: boolean;
|
|
1229
|
+
enableValidation?: boolean;
|
|
1230
|
+
defaultEvents?: Event[];
|
|
1231
|
+
maxEventsPerDay?: number;
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Drag Hook options
|
|
1235
|
+
*/
|
|
1236
|
+
interface DragHookOptions extends Partial<DragConfig> {
|
|
1237
|
+
calendarRef: any;
|
|
1238
|
+
allDayRowRef?: any;
|
|
1239
|
+
viewType: ViewType;
|
|
1240
|
+
onEventsUpdate: (updateFunc: (events: Event[]) => Event[], isResizing?: boolean) => void;
|
|
1241
|
+
onEventCreate: (event: Event) => void;
|
|
1242
|
+
onEventEdit: (event: Event) => void;
|
|
1243
|
+
currentWeekStart: Date;
|
|
1244
|
+
events: Event[];
|
|
1245
|
+
calculateNewEventLayout?: (dayIndex: number, startHour: number, endHour: number) => EventLayout | null;
|
|
1246
|
+
calculateDragLayout?: (event: Event, targetDay: number, targetStartHour: number, targetEndHour: number) => EventLayout | null;
|
|
1247
|
+
isMobile?: boolean;
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Drag Hook return value
|
|
1251
|
+
*/
|
|
1252
|
+
interface DragHookReturn {
|
|
1253
|
+
handleMoveStart?: (e: any | any, event: Event) => void;
|
|
1254
|
+
handleCreateStart?: (e: any | any, ...args: (Date | number)[]) => void;
|
|
1255
|
+
handleResizeStart?: (e: any | any, event: Event, direction: string) => void;
|
|
1256
|
+
handleCreateAllDayEvent?: (e: any, dayIndex: number) => void;
|
|
1257
|
+
dragState: MonthDragState | WeekDayDragState;
|
|
1258
|
+
isDragging: boolean;
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Drag plugin configuration
|
|
1262
|
+
*/
|
|
1263
|
+
interface DragPluginConfig {
|
|
1264
|
+
enableDrag: boolean;
|
|
1265
|
+
enableResize: boolean;
|
|
1266
|
+
enableCreate: boolean;
|
|
1267
|
+
enableAllDayCreate: boolean;
|
|
1268
|
+
supportedViews: ViewType[];
|
|
1269
|
+
[key: string]: unknown;
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Drag service interface
|
|
1273
|
+
* Provides drag capability for views
|
|
1274
|
+
*/
|
|
1275
|
+
interface DragService {
|
|
1276
|
+
getConfig: () => DragPluginConfig;
|
|
1277
|
+
updateConfig: (updates: Partial<DragPluginConfig>) => void;
|
|
1278
|
+
isViewSupported: (viewType: ViewType) => boolean;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
declare class CalendarApp implements ICalendarApp {
|
|
1282
|
+
state: CalendarAppState;
|
|
1283
|
+
private callbacks;
|
|
1284
|
+
private calendarRegistry;
|
|
1285
|
+
private sidebarConfig;
|
|
1286
|
+
private visibleMonth;
|
|
1287
|
+
private useEventDetailDialog;
|
|
1288
|
+
private useCalendarHeader;
|
|
1289
|
+
private customMobileEventRenderer?;
|
|
1290
|
+
private themeChangeListeners;
|
|
1291
|
+
private listeners;
|
|
1292
|
+
private undoStack;
|
|
1293
|
+
private pendingSnapshot;
|
|
1294
|
+
private readonly MAX_UNDO_STACK;
|
|
1295
|
+
constructor(config: CalendarAppConfig);
|
|
1296
|
+
private resolveLocale;
|
|
1297
|
+
subscribe: (listener: (app: ICalendarApp) => void) => (() => void);
|
|
1298
|
+
private notify;
|
|
1299
|
+
private pushToUndo;
|
|
1300
|
+
undo: () => void;
|
|
1301
|
+
getReadOnlyConfig: () => ReadOnlyConfig;
|
|
1302
|
+
/**
|
|
1303
|
+
* Helper to check if the calendar is in any form of read-only mode.
|
|
1304
|
+
* If readOnly config is present, it's considered non-editable.
|
|
1305
|
+
*/
|
|
1306
|
+
private isInternalEditable;
|
|
1307
|
+
changeView: (view: ViewType) => void;
|
|
1308
|
+
getCurrentView: () => CalendarView;
|
|
1309
|
+
setCurrentDate: (date: Date) => void;
|
|
1310
|
+
getCurrentDate: () => Date;
|
|
1311
|
+
setVisibleMonth: (date: Date) => void;
|
|
1312
|
+
getVisibleMonth: () => Date;
|
|
1313
|
+
goToToday: () => void;
|
|
1314
|
+
goToPrevious: () => void;
|
|
1315
|
+
goToNext: () => void;
|
|
1316
|
+
selectDate: (date: Date) => void;
|
|
1317
|
+
applyEventsChanges: (changes: {
|
|
1318
|
+
add?: Event[];
|
|
1319
|
+
update?: Array<{
|
|
1320
|
+
id: string;
|
|
1321
|
+
updates: Partial<Event>;
|
|
1322
|
+
}>;
|
|
1323
|
+
delete?: string[];
|
|
1324
|
+
}, isPending?: boolean) => void;
|
|
1325
|
+
addEvent: (event: Event) => void;
|
|
1326
|
+
updateEvent: (id: string, eventUpdate: Partial<Event>, isPending?: boolean) => void;
|
|
1327
|
+
deleteEvent: (id: string) => void;
|
|
1328
|
+
getAllEvents: () => Event[];
|
|
1329
|
+
onEventClick: (event: Event) => void;
|
|
1330
|
+
onMoreEventsClick: (date: Date) => void;
|
|
1331
|
+
highlightEvent: (eventId: string | null) => void;
|
|
1332
|
+
getEvents: () => Event[];
|
|
1333
|
+
getCalendars: () => CalendarType[];
|
|
1334
|
+
reorderCalendars: (fromIndex: number, toIndex: number) => void;
|
|
1335
|
+
setCalendarVisibility: (calendarId: string, visible: boolean) => void;
|
|
1336
|
+
setAllCalendarsVisibility: (visible: boolean) => void;
|
|
1337
|
+
updateCalendar: (id: string, updates: Partial<CalendarType>, isPending?: boolean) => void;
|
|
1338
|
+
createCalendar: (calendar: CalendarType) => void;
|
|
1339
|
+
deleteCalendar: (id: string) => void;
|
|
1340
|
+
mergeCalendars: (sourceId: string, targetId: string) => void;
|
|
1341
|
+
getSidebarConfig: () => SidebarConfig;
|
|
1342
|
+
getCalendarHeaderConfig: () => boolean | ((props: any) => TNode);
|
|
1343
|
+
private installPlugin;
|
|
1344
|
+
getPlugin: <T = unknown>(name: string) => T | undefined;
|
|
1345
|
+
hasPlugin: (name: string) => boolean;
|
|
1346
|
+
getPluginConfig: (pluginName: string) => Record<string, unknown>;
|
|
1347
|
+
updatePluginConfig: (pluginName: string, config: Record<string, unknown>) => void;
|
|
1348
|
+
getViewConfig: (viewType: ViewType) => Record<string, unknown>;
|
|
1349
|
+
triggerRender: () => void;
|
|
1350
|
+
getCalendarRegistry: () => CalendarRegistry;
|
|
1351
|
+
getUseEventDetailDialog: () => boolean;
|
|
1352
|
+
getCustomMobileEventRenderer: () => MobileEventRenderer | undefined;
|
|
1353
|
+
updateConfig: (config: Partial<CalendarAppConfig>) => void;
|
|
1354
|
+
/**
|
|
1355
|
+
* Set theme mode
|
|
1356
|
+
* @param mode - Theme mode ('light', 'dark', or 'auto')
|
|
1357
|
+
*/
|
|
1358
|
+
setTheme: (mode: ThemeMode) => void;
|
|
1359
|
+
/**
|
|
1360
|
+
* Get current theme mode
|
|
1361
|
+
* @returns Current theme mode
|
|
1362
|
+
*/
|
|
1363
|
+
getTheme: () => ThemeMode;
|
|
1364
|
+
/**
|
|
1365
|
+
* Subscribe to theme changes
|
|
1366
|
+
* @param callback - Function to call when theme changes
|
|
1367
|
+
* @returns Unsubscribe function
|
|
1368
|
+
*/
|
|
1369
|
+
subscribeThemeChange: (callback: (theme: ThemeMode) => void) => (() => void);
|
|
1370
|
+
/**
|
|
1371
|
+
* Unsubscribe from theme changes
|
|
1372
|
+
* @param callback - Function to remove from listeners
|
|
1373
|
+
*/
|
|
1374
|
+
unsubscribeThemeChange: (callback: (theme: ThemeMode) => void) => void;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
interface CustomRendering {
|
|
1378
|
+
id: string;
|
|
1379
|
+
containerEl: HTMLElement;
|
|
1380
|
+
generatorName: string;
|
|
1381
|
+
generatorArgs: any;
|
|
1382
|
+
}
|
|
1383
|
+
type CustomRenderingListener = (map: Map<string, CustomRendering>) => void;
|
|
1384
|
+
declare class CustomRenderingStore {
|
|
1385
|
+
private renderings;
|
|
1386
|
+
private overrides;
|
|
1387
|
+
private listeners;
|
|
1388
|
+
/**
|
|
1389
|
+
* Register a new custom rendering placeholder.
|
|
1390
|
+
* Called by the ContentSlot Preact component.
|
|
1391
|
+
*/
|
|
1392
|
+
register(rendering: CustomRendering): void;
|
|
1393
|
+
/**
|
|
1394
|
+
* Unregister a custom rendering placeholder.
|
|
1395
|
+
*/
|
|
1396
|
+
unregister(id: string): void;
|
|
1397
|
+
/**
|
|
1398
|
+
* Set the list of generator names that have custom overrides.
|
|
1399
|
+
* Called by framework adapters (React/Vue/etc.)
|
|
1400
|
+
*/
|
|
1401
|
+
setOverrides(names: string[]): void;
|
|
1402
|
+
/**
|
|
1403
|
+
* Check if a specific generator has a custom override.
|
|
1404
|
+
*/
|
|
1405
|
+
isOverridden(generatorName: string): boolean;
|
|
1406
|
+
/**
|
|
1407
|
+
* Subscribe to updates of the renderings map.
|
|
1408
|
+
* Called by the framework adapter (React/Vue/etc.)
|
|
1409
|
+
*/
|
|
1410
|
+
subscribe(listener: CustomRenderingListener): () => void;
|
|
1411
|
+
private notify;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
declare class CalendarRenderer {
|
|
1415
|
+
private app;
|
|
1416
|
+
private container;
|
|
1417
|
+
private customRenderingStore;
|
|
1418
|
+
private unsubscribe;
|
|
1419
|
+
private renderRequested;
|
|
1420
|
+
constructor(app: ICalendarApp);
|
|
1421
|
+
private requestRender;
|
|
1422
|
+
/**
|
|
1423
|
+
* Mount the calendar to a DOM container.
|
|
1424
|
+
*/
|
|
1425
|
+
mount(container: HTMLElement): void;
|
|
1426
|
+
/**
|
|
1427
|
+
* Unmount the calendar and cleanup.
|
|
1428
|
+
*/
|
|
1429
|
+
unmount(): void;
|
|
1430
|
+
getCustomRenderingStore(): CustomRenderingStore;
|
|
1431
|
+
private render;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* Date and Time Conversion Utilities
|
|
1436
|
+
*
|
|
1437
|
+
* This module provides utilities for converting between Date and Temporal API objects,
|
|
1438
|
+
* extracting time components, and performing date comparisons.
|
|
1439
|
+
*
|
|
1440
|
+
* All functions support both legacy Date objects and modern Temporal API types
|
|
1441
|
+
* for backward compatibility and future-proofing.
|
|
1442
|
+
*/
|
|
1443
|
+
|
|
1444
|
+
/**
|
|
1445
|
+
* Extract hour number from Date or Temporal object (with decimal for minutes, e.g., 14.5 = 14:30)
|
|
1446
|
+
* @param dateTime Date or Temporal object
|
|
1447
|
+
* @returns Hour number (0-24, supports decimals)
|
|
1448
|
+
*/
|
|
1449
|
+
declare const extractHourFromDate: (dateTime: Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime) => number;
|
|
1450
|
+
/**
|
|
1451
|
+
* Create a new date-time object based on given date but set to specified hour
|
|
1452
|
+
* @param baseDateTime Base date-time
|
|
1453
|
+
* @param hour Hour number (supports decimals, e.g., 14.5 = 14:30)
|
|
1454
|
+
* @returns Date or Temporal (PlainDateTime or ZonedDateTime)
|
|
1455
|
+
*/
|
|
1456
|
+
declare const createDateWithHour: (baseDateTime: Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime, hour: number) => Date | Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
1457
|
+
/**
|
|
1458
|
+
* Get start of day (00:00:00.000)
|
|
1459
|
+
* @param dateTime Date-time
|
|
1460
|
+
* @returns Start of day
|
|
1461
|
+
*/
|
|
1462
|
+
declare const getStartOfDay: (dateTime: Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime) => Date | Temporal.ZonedDateTime;
|
|
1463
|
+
/**
|
|
1464
|
+
* Get end of day (23:59:59.999)
|
|
1465
|
+
* @param dateTime Date-time
|
|
1466
|
+
* @returns End of day
|
|
1467
|
+
*/
|
|
1468
|
+
declare const getEndOfDay: (dateTime: Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime) => Date | Temporal.ZonedDateTime;
|
|
1469
|
+
/**
|
|
1470
|
+
* Check if two dates are on the same day
|
|
1471
|
+
* @param date1 Date 1
|
|
1472
|
+
* @param date2 Date 2
|
|
1473
|
+
* @returns Whether they are the same day
|
|
1474
|
+
*/
|
|
1475
|
+
declare const isSameDay: (date1: Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime, date2: Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime) => boolean;
|
|
1476
|
+
/**
|
|
1477
|
+
* Check if event spans multiple days
|
|
1478
|
+
* @param start Start time
|
|
1479
|
+
* @param end End time
|
|
1480
|
+
* @returns Whether it's a multi-day event
|
|
1481
|
+
*/
|
|
1482
|
+
declare const isMultiDayEvent: (start: Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime, end: Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime) => boolean;
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* Color Utilities
|
|
1486
|
+
*
|
|
1487
|
+
* This module provides utilities for resolving event colors using the calendar registry.
|
|
1488
|
+
* All color functions return actual color values (not CSS classes) for inline styles.
|
|
1489
|
+
*/
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* Get event background color (actual color value, not CSS class)
|
|
1493
|
+
* Use this for inline styles
|
|
1494
|
+
*/
|
|
1495
|
+
declare const getEventBgColor: (calendarIdOrColor: string, registry?: CalendarRegistry) => string;
|
|
1496
|
+
/**
|
|
1497
|
+
* Get event text color (actual color value, not CSS class)
|
|
1498
|
+
* Use this for inline styles
|
|
1499
|
+
*/
|
|
1500
|
+
declare const getEventTextColor: (calendarIdOrColor: string, registry?: CalendarRegistry) => string;
|
|
1501
|
+
/**
|
|
1502
|
+
* Get selected background color
|
|
1503
|
+
* Now uses the calendar registry for color resolution
|
|
1504
|
+
*/
|
|
1505
|
+
declare const getSelectedBgColor: (calendarIdOrColor: string, registry?: CalendarRegistry) => string;
|
|
1506
|
+
/**
|
|
1507
|
+
* Get line color
|
|
1508
|
+
* Now uses the calendar registry for color resolution
|
|
1509
|
+
*/
|
|
1510
|
+
declare const getLineColor: (calendarIdOrColor: string, registry?: CalendarRegistry) => string;
|
|
1511
|
+
|
|
1512
|
+
/**
|
|
1513
|
+
* Time Utilities
|
|
1514
|
+
*
|
|
1515
|
+
* This module provides utilities for time formatting, calculations, and time step operations.
|
|
1516
|
+
* Handles 24-hour format, time rounding, and special cases like midnight crossings.
|
|
1517
|
+
*/
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* Time step for calendar grid (0.25 = 15 minutes)
|
|
1521
|
+
*/
|
|
1522
|
+
declare const TIME_STEP = 0.25;
|
|
1523
|
+
/**
|
|
1524
|
+
* Format hours and minutes to HH:MM format
|
|
1525
|
+
* @param hours Hour number (supports decimals, e.g., 14.5 = 14:30)
|
|
1526
|
+
* @param minutes Optional minutes (if not provided, extracted from decimal hours)
|
|
1527
|
+
* @returns Formatted time string (e.g., "14:30")
|
|
1528
|
+
*/
|
|
1529
|
+
declare const formatTime: (hours: number, minutes?: number) => string;
|
|
1530
|
+
/**
|
|
1531
|
+
* Format event time range as a string
|
|
1532
|
+
* @param event Event object
|
|
1533
|
+
* @returns Formatted time range (e.g., "14:00 - 16:00" or "All day")
|
|
1534
|
+
*/
|
|
1535
|
+
declare const formatEventTimeRange: (event: Event) => string;
|
|
1536
|
+
/**
|
|
1537
|
+
* Round hour to nearest time step
|
|
1538
|
+
* @param hour Hour number
|
|
1539
|
+
* @returns Rounded hour
|
|
1540
|
+
*/
|
|
1541
|
+
declare const roundToTimeStep: (hour: number) => number;
|
|
1542
|
+
/**
|
|
1543
|
+
* Get event end hour (handles cross-day events less than 24 hours)
|
|
1544
|
+
* When an event ends exactly at midnight of the next day and duration is less than 24 hours,
|
|
1545
|
+
* it should be treated as 24:00 of the current day in week/day views to avoid displaying as next day 00:00.
|
|
1546
|
+
* @param event Event object
|
|
1547
|
+
* @returns End hour (0-24)
|
|
1548
|
+
*/
|
|
1549
|
+
declare const getEventEndHour: (event: Event) => number;
|
|
1550
|
+
|
|
1551
|
+
/**
|
|
1552
|
+
* Date Constants
|
|
1553
|
+
*
|
|
1554
|
+
* This module provides constant arrays for day and month names in various formats.
|
|
1555
|
+
* Used throughout the application for displaying date information.
|
|
1556
|
+
*/
|
|
1557
|
+
/**
|
|
1558
|
+
* Week day abbreviations (Mon-Sun)
|
|
1559
|
+
*/
|
|
1560
|
+
declare const weekDays: string[];
|
|
1561
|
+
/**
|
|
1562
|
+
* Full week day names (Monday-Sunday)
|
|
1563
|
+
*/
|
|
1564
|
+
declare const weekDaysFullName: string[];
|
|
1565
|
+
/**
|
|
1566
|
+
* Full month names (January-December)
|
|
1567
|
+
*/
|
|
1568
|
+
declare const monthNames: string[];
|
|
1569
|
+
/**
|
|
1570
|
+
* Month abbreviations (Jan-Dec)
|
|
1571
|
+
*/
|
|
1572
|
+
declare const shortMonthNames: string[];
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Date Range Utilities
|
|
1576
|
+
*
|
|
1577
|
+
* This module provides utilities for calculating date ranges, particularly
|
|
1578
|
+
* for week-based operations (Monday-Sunday).
|
|
1579
|
+
*/
|
|
1580
|
+
/**
|
|
1581
|
+
* Get the Monday-Sunday range for a given date
|
|
1582
|
+
* @param date Input date
|
|
1583
|
+
* @returns Object with monday and sunday dates
|
|
1584
|
+
*/
|
|
1585
|
+
declare const getWeekRange: (date: Date) => {
|
|
1586
|
+
monday: Date;
|
|
1587
|
+
sunday: Date;
|
|
1588
|
+
};
|
|
1589
|
+
/**
|
|
1590
|
+
* Get current week dates (Monday-Sunday) with today indicator
|
|
1591
|
+
* @returns Array of 7 date objects with date, month, and isToday flag
|
|
1592
|
+
*/
|
|
1593
|
+
declare const getCurrentWeekDates: () => {
|
|
1594
|
+
date: number;
|
|
1595
|
+
month: string;
|
|
1596
|
+
isToday: boolean;
|
|
1597
|
+
}[];
|
|
1598
|
+
|
|
1599
|
+
/**
|
|
1600
|
+
* Calendar Data Generation Utilities
|
|
1601
|
+
*
|
|
1602
|
+
* This module provides utilities for generating calendar data structures
|
|
1603
|
+
* including days, weeks, and month/year metadata.
|
|
1604
|
+
*/
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Generate day data object from a date
|
|
1608
|
+
* @param date Date to generate data for
|
|
1609
|
+
* @returns Day data with date, day, month, year, and isToday flag
|
|
1610
|
+
*/
|
|
1611
|
+
declare const generateDayData: (date: string | number | Date) => {
|
|
1612
|
+
date: Date;
|
|
1613
|
+
day: number;
|
|
1614
|
+
month: number;
|
|
1615
|
+
year: number;
|
|
1616
|
+
monthName: string;
|
|
1617
|
+
shortMonthName: string;
|
|
1618
|
+
isToday: boolean;
|
|
1619
|
+
};
|
|
1620
|
+
/**
|
|
1621
|
+
* Generate week data (7 days starting from given date)
|
|
1622
|
+
* @param startDate Week start date
|
|
1623
|
+
* @returns Week data with days array, startDate, and monthYear
|
|
1624
|
+
*/
|
|
1625
|
+
declare const generateWeekData: (startDate: string | number | Date) => {
|
|
1626
|
+
days: {
|
|
1627
|
+
date: Date;
|
|
1628
|
+
day: number;
|
|
1629
|
+
month: number;
|
|
1630
|
+
year: number;
|
|
1631
|
+
monthName: string;
|
|
1632
|
+
shortMonthName: string;
|
|
1633
|
+
isToday: boolean;
|
|
1634
|
+
}[];
|
|
1635
|
+
startDate: Date;
|
|
1636
|
+
monthYear: {
|
|
1637
|
+
month: string;
|
|
1638
|
+
monthIndex: number;
|
|
1639
|
+
year: number;
|
|
1640
|
+
};
|
|
1641
|
+
};
|
|
1642
|
+
/**
|
|
1643
|
+
* Determine which month and year a week belongs to (based on majority of days)
|
|
1644
|
+
* @param days Array of day data
|
|
1645
|
+
* @returns Month name, month index, and year
|
|
1646
|
+
*/
|
|
1647
|
+
declare const getMonthYearOfWeek: (days: DayData[]) => {
|
|
1648
|
+
month: string;
|
|
1649
|
+
monthIndex: number;
|
|
1650
|
+
year: number;
|
|
1651
|
+
};
|
|
1652
|
+
/**
|
|
1653
|
+
* Generate weeks data around a central date
|
|
1654
|
+
* @param centralDate Central date for range
|
|
1655
|
+
* @param monthsToLoad Number of months to load (default: 3)
|
|
1656
|
+
* @returns Array of week data
|
|
1657
|
+
*/
|
|
1658
|
+
declare const generateWeeksData: (centralDate: Date, monthsToLoad?: number) => {
|
|
1659
|
+
days: {
|
|
1660
|
+
date: Date;
|
|
1661
|
+
day: number;
|
|
1662
|
+
month: number;
|
|
1663
|
+
year: number;
|
|
1664
|
+
monthName: string;
|
|
1665
|
+
shortMonthName: string;
|
|
1666
|
+
isToday: boolean;
|
|
1667
|
+
}[];
|
|
1668
|
+
startDate: Date;
|
|
1669
|
+
monthYear: {
|
|
1670
|
+
month: string;
|
|
1671
|
+
monthIndex: number;
|
|
1672
|
+
year: number;
|
|
1673
|
+
};
|
|
1674
|
+
}[];
|
|
1675
|
+
/**
|
|
1676
|
+
* Generate week range around a center date
|
|
1677
|
+
* @param centerDate Center date for range
|
|
1678
|
+
* @param totalWeeks Total number of weeks to generate
|
|
1679
|
+
* @returns Array of weeks data
|
|
1680
|
+
*/
|
|
1681
|
+
declare function generateWeekRange(centerDate: Date, totalWeeks: number): WeeksData[];
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* Event Utilities
|
|
1685
|
+
*
|
|
1686
|
+
* This module provides utilities for event operations including:
|
|
1687
|
+
* - Filtering events by day and type
|
|
1688
|
+
* - Calculating day indices based on week start dates
|
|
1689
|
+
* - Creating and updating events with proper date/time handling
|
|
1690
|
+
* - Converting between Date and Temporal API objects
|
|
1691
|
+
*/
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Get regular (non-all-day) events for a specific day index
|
|
1695
|
+
* @param dayIndex Day index (0-6, Monday-Sunday)
|
|
1696
|
+
* @param events Array of events
|
|
1697
|
+
* @returns Filtered events
|
|
1698
|
+
*/
|
|
1699
|
+
declare const getEventsForDay: (dayIndex: number, events: Event[]) => Event[];
|
|
1700
|
+
/**
|
|
1701
|
+
* Get all-day events for a specific day index
|
|
1702
|
+
* Supports date range checking when weekStart is provided
|
|
1703
|
+
* @param dayIndex Day index (0-6, Monday-Sunday)
|
|
1704
|
+
* @param events Array of events
|
|
1705
|
+
* @param weekStart Optional week start date for accurate date range checking
|
|
1706
|
+
* @returns Filtered all-day events
|
|
1707
|
+
*/
|
|
1708
|
+
declare const getAllDayEventsForDay: (dayIndex: number, events: Event[], weekStart?: Date) => Event[];
|
|
1709
|
+
/**
|
|
1710
|
+
* Get Date object for a specific day index relative to week start
|
|
1711
|
+
* @param weekStart Week start date
|
|
1712
|
+
* @param dayIndex Day index (0-6)
|
|
1713
|
+
* @returns Date object
|
|
1714
|
+
*/
|
|
1715
|
+
declare const getDateByDayIndex: (weekStart: Date, dayIndex: number) => Date;
|
|
1716
|
+
/**
|
|
1717
|
+
* Update event's date and dayIndex
|
|
1718
|
+
* @param event Event to update
|
|
1719
|
+
* @param newDayIndex New day index
|
|
1720
|
+
* @param weekStart Week start date
|
|
1721
|
+
* @returns Updated event
|
|
1722
|
+
*/
|
|
1723
|
+
declare const updateEventDateAndDay: (event: Event, newDayIndex: number, weekStart: Date) => Event;
|
|
1724
|
+
/**
|
|
1725
|
+
* Create new event with Date fields set
|
|
1726
|
+
* @param eventData Event data without start/end
|
|
1727
|
+
* @param weekStart Week start date
|
|
1728
|
+
* @returns Complete event with Temporal start/end
|
|
1729
|
+
*/
|
|
1730
|
+
declare const createEventWithDate: (eventData: Omit<Event, "start" | "end">, weekStart: Date) => Event;
|
|
1731
|
+
/**
|
|
1732
|
+
* Calculate day index based on real date and current week start
|
|
1733
|
+
* @param eventDate Event date
|
|
1734
|
+
* @param weekStart Week start date
|
|
1735
|
+
* @returns Day index (can be outside 0-6 range for events outside current week)
|
|
1736
|
+
*/
|
|
1737
|
+
declare const calculateDayIndex: (eventDate: Date, weekStart: Date) => number;
|
|
1738
|
+
/**
|
|
1739
|
+
* Check if event is within current week range
|
|
1740
|
+
* @param eventDate Event date
|
|
1741
|
+
* @param weekStart Week start date
|
|
1742
|
+
* @returns Whether event is in the week
|
|
1743
|
+
*/
|
|
1744
|
+
declare const isEventInWeek: (eventDate: Date, weekStart: Date) => boolean;
|
|
1745
|
+
/**
|
|
1746
|
+
* Recalculate day field for all events (based on current week)
|
|
1747
|
+
* @param events Array of events
|
|
1748
|
+
* @param weekStart Week start date
|
|
1749
|
+
* @returns Events with updated day indices
|
|
1750
|
+
*/
|
|
1751
|
+
declare const recalculateEventDays: (events: Event[], weekStart: Date) => Event[];
|
|
1752
|
+
/**
|
|
1753
|
+
* Get day index by Date (relative to week start)
|
|
1754
|
+
* @param weekStart Week start date
|
|
1755
|
+
* @param targetDate Target date
|
|
1756
|
+
* @returns Day index
|
|
1757
|
+
*/
|
|
1758
|
+
declare const getDayIndexByDate: (weekStart: Date, targetDate: Date) => number;
|
|
1759
|
+
/**
|
|
1760
|
+
* Get events within specified week range
|
|
1761
|
+
* @param events Array of events
|
|
1762
|
+
* @param weekStart Week start date
|
|
1763
|
+
* @returns Filtered and recalculated events
|
|
1764
|
+
*/
|
|
1765
|
+
declare const getEventsForWeek: (events: Event[], weekStart: Date) => Event[];
|
|
1766
|
+
/**
|
|
1767
|
+
* Create event with real date
|
|
1768
|
+
* @param eventData Event data without start/end
|
|
1769
|
+
* @param weekStart Week start date
|
|
1770
|
+
* @returns Complete event
|
|
1771
|
+
*/
|
|
1772
|
+
declare const createEventWithRealDate: (eventData: Omit<Event, "start" | "end">, weekStart: Date) => Event;
|
|
1773
|
+
/**
|
|
1774
|
+
* Update event with real date
|
|
1775
|
+
* @param event Event to update
|
|
1776
|
+
* @param newDayIndex New day index
|
|
1777
|
+
* @param weekStart Week start date
|
|
1778
|
+
* @returns Updated event
|
|
1779
|
+
*/
|
|
1780
|
+
declare const updateEventWithRealDate: (event: Event, newDayIndex: number, weekStart: Date) => Event;
|
|
1781
|
+
/**
|
|
1782
|
+
* Compare two events for equality
|
|
1783
|
+
* @param event1 First event
|
|
1784
|
+
* @param event2 Second event
|
|
1785
|
+
* @returns Whether events are equal in content
|
|
1786
|
+
*/
|
|
1787
|
+
declare const isEventEqual: (event1: Event | null, event2: Event | null) => boolean;
|
|
1788
|
+
|
|
1789
|
+
/**
|
|
1790
|
+
* Test Data Generation Utilities
|
|
1791
|
+
*
|
|
1792
|
+
* This module provides test/demo event data for calendar development and testing.
|
|
1793
|
+
* The generated events are relative to the current week for consistent demo experience.
|
|
1794
|
+
*/
|
|
1795
|
+
|
|
1796
|
+
/**
|
|
1797
|
+
* Generate test events for calendar demo/testing
|
|
1798
|
+
* Events are generated relative to the current week (Monday-Sunday)
|
|
1799
|
+
* Includes various overlapping events, all-day events, and edge cases
|
|
1800
|
+
* @returns Array of test events
|
|
1801
|
+
*/
|
|
1802
|
+
declare function getTestEvents(): Event[];
|
|
1803
|
+
|
|
1804
|
+
/**
|
|
1805
|
+
* General Utility Functions
|
|
1806
|
+
*
|
|
1807
|
+
* This module provides general-purpose utility functions that don't fit
|
|
1808
|
+
* into other specialized categories.
|
|
1809
|
+
*/
|
|
1810
|
+
/**
|
|
1811
|
+
* Generate unique key (using timestamp and random number combination)
|
|
1812
|
+
* @returns Unique key string
|
|
1813
|
+
*/
|
|
1814
|
+
declare function generateUniKey(): string;
|
|
1815
|
+
|
|
1816
|
+
/**
|
|
1817
|
+
* Performs a deep comparison between two values to determine if they are equivalent.
|
|
1818
|
+
* Supports primitives, Date objects, and plain objects/arrays.
|
|
1819
|
+
*/
|
|
1820
|
+
declare function isDeepEqual(a: any, b: any): boolean;
|
|
1821
|
+
|
|
1822
|
+
/**
|
|
1823
|
+
* Format date to DD/MM/YYYY format
|
|
1824
|
+
* Ensures consistent server and client rendering
|
|
1825
|
+
*/
|
|
1826
|
+
declare const formatDateConsistent: (date?: Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime) => string;
|
|
1827
|
+
/**
|
|
1828
|
+
* Format month and year to consistent format
|
|
1829
|
+
*/
|
|
1830
|
+
declare const formatMonthYear: (date: Date) => string;
|
|
1831
|
+
/**
|
|
1832
|
+
* Format date to "DD MMM YYYY" format (e.g., "15 Jan 2025")
|
|
1833
|
+
* Used for event detail display
|
|
1834
|
+
*/
|
|
1835
|
+
declare const formatDate: (temporal: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime) => string;
|
|
1836
|
+
|
|
1837
|
+
/**
|
|
1838
|
+
* Temporal Type Guards and Conversion Utilities
|
|
1839
|
+
*
|
|
1840
|
+
* This module provides type guards for distinguishing between different Temporal types
|
|
1841
|
+
* and unified conversion functions for internal processing.
|
|
1842
|
+
*/
|
|
1843
|
+
|
|
1844
|
+
/**
|
|
1845
|
+
* Check if temporal is PlainDate (date only, no time)
|
|
1846
|
+
*/
|
|
1847
|
+
declare function isPlainDate(temporal: any): temporal is Temporal.PlainDate;
|
|
1848
|
+
/**
|
|
1849
|
+
* Check if temporal is PlainDateTime (date + time, no timezone)
|
|
1850
|
+
*/
|
|
1851
|
+
declare function isPlainDateTime(temporal: any): temporal is Temporal.PlainDateTime;
|
|
1852
|
+
/**
|
|
1853
|
+
* Check if temporal is ZonedDateTime (date + time + timezone)
|
|
1854
|
+
*/
|
|
1855
|
+
declare function isZonedDateTime(temporal: any): temporal is Temporal.ZonedDateTime;
|
|
1856
|
+
/**
|
|
1857
|
+
* Convert any Temporal type or Date to Date (for internal processing)
|
|
1858
|
+
* Handles all three Temporal types and native Date uniformly
|
|
1859
|
+
*/
|
|
1860
|
+
declare function temporalToDate(temporal: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Date): Date;
|
|
1861
|
+
/**
|
|
1862
|
+
* Convert Date to PlainDate (for all-day events)
|
|
1863
|
+
*/
|
|
1864
|
+
declare function dateToPlainDate(date: Date): Temporal.PlainDate;
|
|
1865
|
+
/**
|
|
1866
|
+
* Convert Date to PlainDateTime (for local events without timezone)
|
|
1867
|
+
*/
|
|
1868
|
+
declare function dateToPlainDateTime(date: Date): Temporal.PlainDateTime;
|
|
1869
|
+
/**
|
|
1870
|
+
* Convert Date to ZonedDateTime (for timezone-aware events)
|
|
1871
|
+
*/
|
|
1872
|
+
declare function dateToZonedDateTime(date: Date, timeZone: string): Temporal.ZonedDateTime;
|
|
1873
|
+
/**
|
|
1874
|
+
* Convert PlainDateTime to Date
|
|
1875
|
+
*/
|
|
1876
|
+
declare function plainDateTimeToDate(pdt: Temporal.PlainDateTime): Date;
|
|
1877
|
+
/**
|
|
1878
|
+
* Convert PlainDate to Date (at midnight)
|
|
1879
|
+
*/
|
|
1880
|
+
declare function plainDateToDate(pd: Temporal.PlainDate): Date;
|
|
1881
|
+
/**
|
|
1882
|
+
* Extract hour from any Temporal type (with decimal for minutes)
|
|
1883
|
+
* @returns Hour number (0-24, with decimals, e.g., 14.5 = 14:30)
|
|
1884
|
+
*/
|
|
1885
|
+
declare function extractHourFromTemporal(temporal: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Date): number;
|
|
1886
|
+
/**
|
|
1887
|
+
* Create a new Temporal with specified hour (supports PlainDateTime and ZonedDateTime)
|
|
1888
|
+
* @param temporal Base temporal object
|
|
1889
|
+
* @param hour Hour with decimals (e.g., 14.5 = 14:30)
|
|
1890
|
+
*/
|
|
1891
|
+
declare function setHourInTemporal(temporal: Temporal.PlainDateTime | Temporal.ZonedDateTime, hour: number): Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
1892
|
+
/**
|
|
1893
|
+
* Check if two Temporal objects represent the same day
|
|
1894
|
+
*/
|
|
1895
|
+
declare function isSameTemporal(t1: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Date, t2: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Date): boolean;
|
|
1896
|
+
/**
|
|
1897
|
+
* Get PlainDate from any Temporal type or Date
|
|
1898
|
+
*/
|
|
1899
|
+
declare function getPlainDate(temporal: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Date): Temporal.PlainDate;
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* Temporal API utility functions
|
|
1903
|
+
* Provides date-time processing, conversion, and compatibility support
|
|
1904
|
+
*/
|
|
1905
|
+
|
|
1906
|
+
/**
|
|
1907
|
+
* Check if value is Date object
|
|
1908
|
+
*/
|
|
1909
|
+
declare function isDate(value: any): value is Date;
|
|
1910
|
+
/**
|
|
1911
|
+
* Convert Temporal.ZonedDateTime to Date
|
|
1912
|
+
* @param zdt Temporal.ZonedDateTime
|
|
1913
|
+
* @returns Date object
|
|
1914
|
+
*/
|
|
1915
|
+
declare function zonedDateTimeToDate(zdt: Temporal.ZonedDateTime): Date;
|
|
1916
|
+
/**
|
|
1917
|
+
* Create new Temporal object with specified hour
|
|
1918
|
+
* @param temporal Base Temporal object
|
|
1919
|
+
* @param hour Hour number (supports decimals)
|
|
1920
|
+
* @returns New Temporal (PlainDateTime or ZonedDateTime)
|
|
1921
|
+
*/
|
|
1922
|
+
declare function createTemporalWithHour(temporal: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime, hour: number): Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
1923
|
+
/**
|
|
1924
|
+
* Check if two Temporal dates are on the same day
|
|
1925
|
+
*/
|
|
1926
|
+
declare function isSamePlainDate(date1: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Date, date2: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Date): boolean;
|
|
1927
|
+
/**
|
|
1928
|
+
* Check if event spans multiple days
|
|
1929
|
+
*/
|
|
1930
|
+
declare function isMultiDayTemporalEvent(start: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Date, end: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Date): boolean;
|
|
1931
|
+
/**
|
|
1932
|
+
* Get start time of Temporal date (00:00:00)
|
|
1933
|
+
*/
|
|
1934
|
+
declare function getStartOfTemporal(temporal: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime, timeZone?: string): Temporal.ZonedDateTime;
|
|
1935
|
+
/**
|
|
1936
|
+
* Get end time of Temporal date (23:59:59.999)
|
|
1937
|
+
*/
|
|
1938
|
+
declare function getEndOfTemporal(temporal: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime, timeZone?: string): Temporal.ZonedDateTime;
|
|
1939
|
+
/**
|
|
1940
|
+
* Calculate days difference between two Temporal dates
|
|
1941
|
+
*/
|
|
1942
|
+
declare function daysBetween(start: Temporal.PlainDate | Temporal.ZonedDateTime, end: Temporal.PlainDate | Temporal.ZonedDateTime): number;
|
|
1943
|
+
/**
|
|
1944
|
+
* Calculate days difference between two Date objects (ignoring time component)
|
|
1945
|
+
*/
|
|
1946
|
+
declare function daysDifference(date1: Date, date2: Date): number;
|
|
1947
|
+
/**
|
|
1948
|
+
* Add specified days to a date
|
|
1949
|
+
*/
|
|
1950
|
+
declare function addDays(date: Date, days: number): Date;
|
|
1951
|
+
/**
|
|
1952
|
+
* Get current time (Temporal.ZonedDateTime)
|
|
1953
|
+
*/
|
|
1954
|
+
declare function now(timeZone?: string): Temporal.ZonedDateTime;
|
|
1955
|
+
/**
|
|
1956
|
+
* Get today's date (Temporal.PlainDate)
|
|
1957
|
+
*/
|
|
1958
|
+
declare function today(timeZone?: string): Temporal.PlainDate;
|
|
1959
|
+
|
|
1960
|
+
declare const pad: (input: number) => string;
|
|
1961
|
+
declare const mergeFormatTemplate: (dateFormat: string, timeFormat: string) => string;
|
|
1962
|
+
declare const buildParseRegExp: (template: string) => RegExp;
|
|
1963
|
+
declare const parseTemporalString: (input: string, regExp: RegExp, reference: Temporal.ZonedDateTime, zoneId: string) => Temporal.ZonedDateTime | null;
|
|
1964
|
+
declare const getZoneId: (value: Temporal.ZonedDateTime) => string;
|
|
1965
|
+
declare const normalizeToZoned: (input: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime, fallbackZone?: string, fallbackTemporal?: Temporal.ZonedDateTime) => Temporal.ZonedDateTime;
|
|
1966
|
+
declare const formatTemporal: (value: Temporal.ZonedDateTime, format: string, timeFormat: string) => string;
|
|
1967
|
+
|
|
1968
|
+
/**
|
|
1969
|
+
* Style Utility Functions
|
|
1970
|
+
*
|
|
1971
|
+
* This module provides utility functions for working with CSS styles.
|
|
1972
|
+
*/
|
|
1973
|
+
/**
|
|
1974
|
+
* Normalize a width value to a CSS string
|
|
1975
|
+
*
|
|
1976
|
+
* Converts numeric values to pixels and validates string values.
|
|
1977
|
+
* Returns a default width if the input is invalid.
|
|
1978
|
+
*
|
|
1979
|
+
* @param width - Width as number (pixels) or CSS string
|
|
1980
|
+
* @param defaultWidth - Default width to use if input is invalid (default: '240px')
|
|
1981
|
+
* @returns Normalized CSS width string
|
|
1982
|
+
*
|
|
1983
|
+
* @example
|
|
1984
|
+
* ```ts
|
|
1985
|
+
* normalizeCssWidth(300) // '300px'
|
|
1986
|
+
* normalizeCssWidth('20rem') // '20rem'
|
|
1987
|
+
* normalizeCssWidth('') // '240px'
|
|
1988
|
+
* normalizeCssWidth(undefined) // '240px'
|
|
1989
|
+
* ```
|
|
1990
|
+
*/
|
|
1991
|
+
declare function normalizeCssWidth(width?: number | string, defaultWidth?: string): string;
|
|
1992
|
+
/**
|
|
1993
|
+
* Check if the browser's scrollbar takes up space in the layout.
|
|
1994
|
+
*
|
|
1995
|
+
* Some browsers (like Safari on macOS with "Show scroll bars: When scrolling" setting)
|
|
1996
|
+
* use overlay scrollbars that don't take up space, while others (like Chrome on Windows)
|
|
1997
|
+
* use scrollbars that reduce the available width of the container.
|
|
1998
|
+
*
|
|
1999
|
+
* @returns true if scrollbar takes space, false otherwise
|
|
2000
|
+
*/
|
|
2001
|
+
declare function scrollbarTakesSpace(): boolean;
|
|
2002
|
+
|
|
2003
|
+
/**
|
|
2004
|
+
* Theme Utility Functions
|
|
2005
|
+
*
|
|
2006
|
+
* This module provides utility functions for working with theme-aware class names.
|
|
2007
|
+
*/
|
|
2008
|
+
/**
|
|
2009
|
+
* Combine class names with theme-specific variants
|
|
2010
|
+
*
|
|
2011
|
+
* @param base - Base class names (applied in both themes)
|
|
2012
|
+
* @param light - Light mode specific class names
|
|
2013
|
+
* @param dark - Dark mode specific class names (will be prefixed with 'dark:')
|
|
2014
|
+
* @returns Combined class name string
|
|
2015
|
+
*
|
|
2016
|
+
* @example
|
|
2017
|
+
* ```ts
|
|
2018
|
+
* themeCn('p-4 rounded', 'bg-white text-black', 'bg-gray-900 text-white')
|
|
2019
|
+
* // Returns: 'p-4 rounded bg-white text-black dark:bg-gray-900 dark:text-white'
|
|
2020
|
+
* ```
|
|
2021
|
+
*/
|
|
2022
|
+
declare const themeCn: (base: string, light: string, dark: string) => string;
|
|
2023
|
+
/**
|
|
2024
|
+
* Common theme class combinations
|
|
2025
|
+
*
|
|
2026
|
+
* Pre-defined class combinations for common UI elements.
|
|
2027
|
+
* Use these for consistency across the application.
|
|
2028
|
+
*/
|
|
2029
|
+
declare const themeClasses: {
|
|
2030
|
+
container: string;
|
|
2031
|
+
card: string;
|
|
2032
|
+
sidebar: string;
|
|
2033
|
+
text: string;
|
|
2034
|
+
textMuted: string;
|
|
2035
|
+
textSubtle: string;
|
|
2036
|
+
textEmphasis: string;
|
|
2037
|
+
border: string;
|
|
2038
|
+
borderLight: string;
|
|
2039
|
+
borderStrong: string;
|
|
2040
|
+
bgPrimary: string;
|
|
2041
|
+
bgSecondary: string;
|
|
2042
|
+
bgTertiary: string;
|
|
2043
|
+
bgMuted: string;
|
|
2044
|
+
hover: string;
|
|
2045
|
+
hoverSubtle: string;
|
|
2046
|
+
active: string;
|
|
2047
|
+
focus: string;
|
|
2048
|
+
input: string;
|
|
2049
|
+
inputFocus: string;
|
|
2050
|
+
buttonPrimary: string;
|
|
2051
|
+
buttonSecondary: string;
|
|
2052
|
+
buttonDanger: string;
|
|
2053
|
+
buttonSuccess: string;
|
|
2054
|
+
shadow: string;
|
|
2055
|
+
shadowMd: string;
|
|
2056
|
+
shadowLg: string;
|
|
2057
|
+
divider: string;
|
|
2058
|
+
};
|
|
2059
|
+
/**
|
|
2060
|
+
* Conditional theme class
|
|
2061
|
+
*
|
|
2062
|
+
* Returns different class names based on a condition.
|
|
2063
|
+
*
|
|
2064
|
+
* @param condition - Condition to evaluate
|
|
2065
|
+
* @param whenTrue - Class names when condition is true
|
|
2066
|
+
* @param whenFalse - Class names when condition is false
|
|
2067
|
+
* @returns Class name string based on condition
|
|
2068
|
+
*
|
|
2069
|
+
* @example
|
|
2070
|
+
* ```ts
|
|
2071
|
+
* conditionalTheme(isActive, 'bg-blue-500 dark:bg-blue-600', 'bg-gray-200 dark:bg-gray-700')
|
|
2072
|
+
* ```
|
|
2073
|
+
*/
|
|
2074
|
+
declare const conditionalTheme: (condition: boolean, whenTrue: string, whenFalse: string) => string;
|
|
2075
|
+
/**
|
|
2076
|
+
* Merge multiple class names, filtering out falsy values
|
|
2077
|
+
*
|
|
2078
|
+
* @param classes - Array of class names or falsy values
|
|
2079
|
+
* @returns Merged class name string
|
|
2080
|
+
*
|
|
2081
|
+
* @example
|
|
2082
|
+
* ```ts
|
|
2083
|
+
* mergeClasses('p-4', isActive && 'bg-blue-500', 'rounded')
|
|
2084
|
+
* // Returns: 'p-4 bg-blue-500 rounded' (if isActive is true)
|
|
2085
|
+
* ```
|
|
2086
|
+
*/
|
|
2087
|
+
declare const mergeClasses: (...classes: (string | undefined | null | false)[]) => string;
|
|
2088
|
+
/**
|
|
2089
|
+
* Resolve the currently applied theme on the document.
|
|
2090
|
+
*
|
|
2091
|
+
* This inspects common override hooks (like `data-dayflow-theme-override` or
|
|
2092
|
+
* manual `dark`/`light` classes) so host applications can force a theme even
|
|
2093
|
+
* when DayFlow is configured in `auto` mode.
|
|
2094
|
+
*/
|
|
2095
|
+
declare const resolveAppliedTheme: (effectiveTheme: "light" | "dark") => "light" | "dark";
|
|
2096
|
+
|
|
2097
|
+
/**
|
|
2098
|
+
* Event Helper Functions
|
|
2099
|
+
*
|
|
2100
|
+
* This module provides simplified APIs for creating events.
|
|
2101
|
+
* Provides multiple layers of abstraction:
|
|
2102
|
+
* - Simple API: createSimpleEvent() - for local events without timezone complexity
|
|
2103
|
+
* - Advanced API: createEventWithTimeZone() - for timezone-aware events
|
|
2104
|
+
* - Direct API: Users can still use Temporal API directly for full control
|
|
2105
|
+
*/
|
|
2106
|
+
|
|
2107
|
+
/**
|
|
2108
|
+
* Event creation parameters - supports both Date and Temporal types
|
|
2109
|
+
* For local events (no timezone)
|
|
2110
|
+
*/
|
|
2111
|
+
interface CreateEventParams {
|
|
2112
|
+
id: string;
|
|
2113
|
+
title: string;
|
|
2114
|
+
description?: string;
|
|
2115
|
+
start: Date | Temporal.PlainDate | Temporal.PlainDateTime;
|
|
2116
|
+
end: Date | Temporal.PlainDate | Temporal.PlainDateTime;
|
|
2117
|
+
allDay?: boolean;
|
|
2118
|
+
calendarId?: string;
|
|
2119
|
+
meta?: Record<string, any>;
|
|
2120
|
+
}
|
|
2121
|
+
/**
|
|
2122
|
+
* Timezone event creation parameters
|
|
2123
|
+
* For events that need explicit timezone handling
|
|
2124
|
+
*/
|
|
2125
|
+
interface CreateTimezoneEventParams {
|
|
2126
|
+
id: string;
|
|
2127
|
+
title: string;
|
|
2128
|
+
description?: string;
|
|
2129
|
+
start: Date | Temporal.ZonedDateTime;
|
|
2130
|
+
end: Date | Temporal.ZonedDateTime;
|
|
2131
|
+
timeZone: string;
|
|
2132
|
+
calendarId?: string;
|
|
2133
|
+
meta?: Record<string, any>;
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* Create local event (recommended for most use cases)
|
|
2137
|
+
*
|
|
2138
|
+
* Supports flexible input types:
|
|
2139
|
+
* - Date objects (automatically converted)
|
|
2140
|
+
* - Temporal.PlainDate (for all-day events)
|
|
2141
|
+
* - Temporal.PlainDateTime (for timed events)
|
|
2142
|
+
*
|
|
2143
|
+
* @example
|
|
2144
|
+
* // Using Date objects
|
|
2145
|
+
* createEvent({
|
|
2146
|
+
* id: '1',
|
|
2147
|
+
* title: 'Team Meeting',
|
|
2148
|
+
* start: new Date(2025, 0, 15, 14, 30),
|
|
2149
|
+
* end: new Date(2025, 0, 15, 16, 0),
|
|
2150
|
+
* });
|
|
2151
|
+
*
|
|
2152
|
+
* @example
|
|
2153
|
+
* // Using Temporal.PlainDateTime
|
|
2154
|
+
* createEvent({
|
|
2155
|
+
* id: '2',
|
|
2156
|
+
* title: 'Workshop',
|
|
2157
|
+
* start: Temporal.PlainDateTime.from('2025-01-15T09:00'),
|
|
2158
|
+
* end: Temporal.PlainDateTime.from('2025-01-15T17:00'),
|
|
2159
|
+
* });
|
|
2160
|
+
*
|
|
2161
|
+
* @example
|
|
2162
|
+
* // All-day event
|
|
2163
|
+
* createEvent({
|
|
2164
|
+
* id: '3',
|
|
2165
|
+
* title: 'Birthday',
|
|
2166
|
+
* start: new Date(2025, 0, 15),
|
|
2167
|
+
* end: new Date(2025, 0, 15),
|
|
2168
|
+
* allDay: true,
|
|
2169
|
+
* });
|
|
2170
|
+
*/
|
|
2171
|
+
declare function createEvent(params: CreateEventParams): Event;
|
|
2172
|
+
/**
|
|
2173
|
+
* Create timezone-aware event
|
|
2174
|
+
*
|
|
2175
|
+
* Use this when you need explicit timezone control, such as:
|
|
2176
|
+
* - International meetings across timezones
|
|
2177
|
+
* - Flight schedules
|
|
2178
|
+
* - Events that need to show in different timezones
|
|
2179
|
+
*
|
|
2180
|
+
* Supports flexible input types:
|
|
2181
|
+
* - Date objects (converted using specified timezone)
|
|
2182
|
+
* - Temporal.ZonedDateTime (used directly)
|
|
2183
|
+
*
|
|
2184
|
+
* @example
|
|
2185
|
+
* // Using Date objects
|
|
2186
|
+
* createTimezoneEvent({
|
|
2187
|
+
* id: '1',
|
|
2188
|
+
* title: 'International Conference',
|
|
2189
|
+
* start: new Date(2025, 0, 15, 14, 0),
|
|
2190
|
+
* end: new Date(2025, 0, 15, 16, 0),
|
|
2191
|
+
* timeZone: 'America/New_York'
|
|
2192
|
+
* });
|
|
2193
|
+
*
|
|
2194
|
+
* @example
|
|
2195
|
+
* // Using ZonedDateTime
|
|
2196
|
+
* createTimezoneEvent({
|
|
2197
|
+
* id: '2',
|
|
2198
|
+
* title: 'Asia-US Sync',
|
|
2199
|
+
* start: Temporal.ZonedDateTime.from('2025-01-15T09:00[Asia/Shanghai]'),
|
|
2200
|
+
* end: Temporal.ZonedDateTime.from('2025-01-15T10:00[Asia/Shanghai]'),
|
|
2201
|
+
* timeZone: 'Asia/Shanghai', // Only used if start/end are Date objects
|
|
2202
|
+
* });
|
|
2203
|
+
*/
|
|
2204
|
+
declare function createTimezoneEvent(params: CreateTimezoneEventParams): Event;
|
|
2205
|
+
/**
|
|
2206
|
+
* Create multiple local events at once
|
|
2207
|
+
*/
|
|
2208
|
+
declare function createEvents(paramsArray: CreateEventParams[]): Event[];
|
|
2209
|
+
/**
|
|
2210
|
+
* Create multiple timezone-aware events at once
|
|
2211
|
+
*/
|
|
2212
|
+
declare function createTimezoneEvents(paramsArray: CreateTimezoneEventParams[]): Event[];
|
|
2213
|
+
/**
|
|
2214
|
+
* Quick create all-day event
|
|
2215
|
+
*/
|
|
2216
|
+
declare function createAllDayEvent(id: string, title: string, date: Date, options?: Omit<CreateEventParams, 'id' | 'title' | 'start' | 'end' | 'allDay'>): Event;
|
|
2217
|
+
/**
|
|
2218
|
+
* Quick create timed event
|
|
2219
|
+
*/
|
|
2220
|
+
declare function createTimedEvent(id: string, title: string, start: Date, end: Date, options?: Omit<CreateEventParams, 'id' | 'title' | 'start' | 'end'>): Event;
|
|
2221
|
+
/**
|
|
2222
|
+
* Convert legacy Date-based event to Temporal-based event
|
|
2223
|
+
* @deprecated Use createEvent() directly with Date objects instead
|
|
2224
|
+
*/
|
|
2225
|
+
declare function convertDateEvent(id: string, title: string, startDate: Date, endDate: Date, allDay?: boolean, options?: {
|
|
2226
|
+
description?: string;
|
|
2227
|
+
calendarId?: string;
|
|
2228
|
+
meta?: Record<string, any>;
|
|
2229
|
+
}): Event;
|
|
2230
|
+
/**
|
|
2231
|
+
* Convert legacy Date-based event to timezone-aware event
|
|
2232
|
+
* @deprecated Use createTimezoneEvent() directly with Date objects instead
|
|
2233
|
+
*/
|
|
2234
|
+
declare function convertDateEventWithTimeZone(id: string, title: string, startDate: Date, endDate: Date, timeZone: string, options?: {
|
|
2235
|
+
description?: string;
|
|
2236
|
+
calendarId?: string;
|
|
2237
|
+
meta?: Record<string, any>;
|
|
2238
|
+
}): Event;
|
|
2239
|
+
|
|
2240
|
+
type CalendarSearchEvent = Event & {
|
|
2241
|
+
color?: string;
|
|
2242
|
+
[key: string]: any;
|
|
2243
|
+
};
|
|
2244
|
+
|
|
2245
|
+
/**
|
|
2246
|
+
* Helper to get date object from event start
|
|
2247
|
+
* @param dateInput Date, string, or Temporal object
|
|
2248
|
+
* @returns Date object
|
|
2249
|
+
*/
|
|
2250
|
+
declare const getDateObj: (dateInput: any) => Date;
|
|
2251
|
+
/**
|
|
2252
|
+
* Helper to normalize date (reset time to 00:00:00)
|
|
2253
|
+
* @param date Date object
|
|
2254
|
+
* @returns Normalized Date object
|
|
2255
|
+
*/
|
|
2256
|
+
declare const normalizeDate: (date: Date) => Date;
|
|
2257
|
+
/**
|
|
2258
|
+
* Helper to get header text and color for a date group in search results
|
|
2259
|
+
* @param groupDate The date of the group
|
|
2260
|
+
* @param today Reference today date (normalized)
|
|
2261
|
+
* @param locale Locale string
|
|
2262
|
+
* @param t Translation function
|
|
2263
|
+
* @returns Object with title and colorClass
|
|
2264
|
+
*/
|
|
2265
|
+
declare const getSearchHeaderInfo: (groupDate: Date, today: Date, locale: string, t: (key: any) => string) => {
|
|
2266
|
+
title: string;
|
|
2267
|
+
colorClass: string;
|
|
2268
|
+
};
|
|
2269
|
+
/**
|
|
2270
|
+
* Helper to group search results by date
|
|
2271
|
+
* @param results List of search events
|
|
2272
|
+
* @param today Reference today date (normalized)
|
|
2273
|
+
* @returns Array of grouped events
|
|
2274
|
+
*/
|
|
2275
|
+
declare const groupSearchResults: (results: CalendarSearchEvent[], today: Date) => Array<{
|
|
2276
|
+
date: Date;
|
|
2277
|
+
events: CalendarSearchEvent[];
|
|
2278
|
+
}>;
|
|
2279
|
+
|
|
2280
|
+
/**
|
|
2281
|
+
* ICS (iCalendar) Types
|
|
2282
|
+
*
|
|
2283
|
+
* Type definitions for ICS file import/export functionality.
|
|
2284
|
+
* Based on RFC 5545 iCalendar specification.
|
|
2285
|
+
*/
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* ICS VEVENT raw data structure (intermediate format after parsing)
|
|
2289
|
+
*/
|
|
2290
|
+
interface ICSVEvent {
|
|
2291
|
+
/** Unique identifier */
|
|
2292
|
+
uid: string;
|
|
2293
|
+
/** Event summary/title */
|
|
2294
|
+
summary: string;
|
|
2295
|
+
/** Event description */
|
|
2296
|
+
description?: string;
|
|
2297
|
+
/** Start date/time in ICS format */
|
|
2298
|
+
dtstart: string;
|
|
2299
|
+
/** End date/time in ICS format */
|
|
2300
|
+
dtend: string;
|
|
2301
|
+
/** DTSTART parameters */
|
|
2302
|
+
dtstartParams?: ICSDateParams;
|
|
2303
|
+
/** DTEND parameters */
|
|
2304
|
+
dtendParams?: ICSDateParams;
|
|
2305
|
+
/** Event location */
|
|
2306
|
+
location?: string;
|
|
2307
|
+
/** Event categories */
|
|
2308
|
+
categories?: string[];
|
|
2309
|
+
}
|
|
2310
|
+
/**
|
|
2311
|
+
* ICS date/time parameters
|
|
2312
|
+
*/
|
|
2313
|
+
interface ICSDateParams {
|
|
2314
|
+
/** Value type: DATE for all-day, DATE-TIME for timed events */
|
|
2315
|
+
value?: 'DATE' | 'DATE-TIME';
|
|
2316
|
+
/** Timezone identifier (e.g., "America/New_York") */
|
|
2317
|
+
tzid?: string;
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* ICS import options
|
|
2321
|
+
*/
|
|
2322
|
+
interface ICSImportOptions {
|
|
2323
|
+
/** Default calendar ID for imported events */
|
|
2324
|
+
calendarId?: string;
|
|
2325
|
+
/** Generate new IDs for imported events (default: true) */
|
|
2326
|
+
generateNewIds?: boolean;
|
|
2327
|
+
/** ID prefix for generated IDs (default: "ics-") */
|
|
2328
|
+
idPrefix?: string;
|
|
2329
|
+
/** Default timezone when ICS has no timezone info */
|
|
2330
|
+
defaultTimeZone?: string;
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* ICS export options
|
|
2334
|
+
*/
|
|
2335
|
+
interface ICSExportOptions {
|
|
2336
|
+
/** Calendar name in exported file */
|
|
2337
|
+
calendarName?: string;
|
|
2338
|
+
/** Product identifier */
|
|
2339
|
+
productId?: string;
|
|
2340
|
+
/** Include timezone information */
|
|
2341
|
+
includeTimezone?: boolean;
|
|
2342
|
+
/** Export filename (without extension) */
|
|
2343
|
+
filename?: string;
|
|
2344
|
+
}
|
|
2345
|
+
/**
|
|
2346
|
+
* ICS import result
|
|
2347
|
+
*/
|
|
2348
|
+
interface ICSImportResult {
|
|
2349
|
+
/** Whether import completed without errors */
|
|
2350
|
+
success: boolean;
|
|
2351
|
+
/** Successfully imported events */
|
|
2352
|
+
events: Event[];
|
|
2353
|
+
/** Parse errors encountered */
|
|
2354
|
+
errors: ICSParseError[];
|
|
2355
|
+
/** Total VEVENTs found in file */
|
|
2356
|
+
totalParsed: number;
|
|
2357
|
+
/** Successfully imported event count */
|
|
2358
|
+
totalImported: number;
|
|
2359
|
+
}
|
|
2360
|
+
/**
|
|
2361
|
+
* ICS parse error
|
|
2362
|
+
*/
|
|
2363
|
+
interface ICSParseError {
|
|
2364
|
+
/** Line number where error occurred */
|
|
2365
|
+
line?: number;
|
|
2366
|
+
/** Error message */
|
|
2367
|
+
message: string;
|
|
2368
|
+
/** UID of the event that failed (if available) */
|
|
2369
|
+
eventUid?: string;
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
/**
|
|
2373
|
+
* ICS Date Utilities
|
|
2374
|
+
*
|
|
2375
|
+
* Convert between ICS date formats (RFC 5545) and Temporal API types.
|
|
2376
|
+
*
|
|
2377
|
+
* ICS Date Formats:
|
|
2378
|
+
* 1. DATE (all-day): YYYYMMDD (e.g., 20250115)
|
|
2379
|
+
* 2. DATE-TIME (local): YYYYMMDDTHHMMSS (e.g., 20250115T143000)
|
|
2380
|
+
* 3. DATE-TIME (UTC): YYYYMMDDTHHMMSSZ (e.g., 20250115T143000Z)
|
|
2381
|
+
* 4. DATE-TIME (with TZID): DTSTART;TZID=America/New_York:20250115T143000
|
|
2382
|
+
*/
|
|
2383
|
+
|
|
2384
|
+
/**
|
|
2385
|
+
* Parse ICS date string to Temporal type
|
|
2386
|
+
*
|
|
2387
|
+
* @param dateStr - ICS date string
|
|
2388
|
+
* @param params - Date parameters (VALUE, TZID)
|
|
2389
|
+
* @param defaultTimeZone - Default timezone when none specified
|
|
2390
|
+
* @returns Temporal.PlainDate, PlainDateTime, or ZonedDateTime
|
|
2391
|
+
*/
|
|
2392
|
+
declare function parseICSDate(dateStr: string, params?: ICSDateParams, defaultTimeZone?: string): Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
2393
|
+
/**
|
|
2394
|
+
* Format Temporal type to ICS date string
|
|
2395
|
+
*
|
|
2396
|
+
* @param temporal - Temporal date/time object
|
|
2397
|
+
* @param allDay - Force all-day format
|
|
2398
|
+
* @returns Object with value and optional params
|
|
2399
|
+
*/
|
|
2400
|
+
declare function formatICSDate(temporal: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime, allDay?: boolean): {
|
|
2401
|
+
value: string;
|
|
2402
|
+
params?: Record<string, string>;
|
|
2403
|
+
};
|
|
2404
|
+
/**
|
|
2405
|
+
* Format a Date to ICS timestamp (UTC format for DTSTAMP)
|
|
2406
|
+
*/
|
|
2407
|
+
declare function formatDateToICSTimestamp(date: Date): string;
|
|
2408
|
+
|
|
2409
|
+
/**
|
|
2410
|
+
* ICS Parser
|
|
2411
|
+
*
|
|
2412
|
+
* Parses iCalendar (.ics) format into DayFlow Event objects.
|
|
2413
|
+
* Supports standard RFC 5545 VEVENT components.
|
|
2414
|
+
*/
|
|
2415
|
+
|
|
2416
|
+
/**
|
|
2417
|
+
* Main function to parse ICS content string
|
|
2418
|
+
*
|
|
2419
|
+
* @param icsContent - Raw string content of the .ics file
|
|
2420
|
+
* @param options - Import options
|
|
2421
|
+
* @returns Result object containing success flag, events, and errors
|
|
2422
|
+
*/
|
|
2423
|
+
declare function parseICS(icsContent: string, options?: ICSImportOptions): ICSImportResult;
|
|
2424
|
+
|
|
2425
|
+
/**
|
|
2426
|
+
* ICS Generator
|
|
2427
|
+
*
|
|
2428
|
+
* Generates iCalendar (.ics) files from DayFlow Event objects.
|
|
2429
|
+
* Supports standard RFC 5545 components.
|
|
2430
|
+
*/
|
|
2431
|
+
|
|
2432
|
+
/**
|
|
2433
|
+
* Generate ICS content string from events
|
|
2434
|
+
*
|
|
2435
|
+
* @param events - List of DayFlow events to export
|
|
2436
|
+
* @param options - Export options
|
|
2437
|
+
* @returns ICS file content string
|
|
2438
|
+
*/
|
|
2439
|
+
declare function generateICS(events: Event[], options?: ICSExportOptions): string;
|
|
2440
|
+
/**
|
|
2441
|
+
* Trigger download of ICS file (Browser only)
|
|
2442
|
+
*
|
|
2443
|
+
* @param events - Events to export
|
|
2444
|
+
* @param options - Export options
|
|
2445
|
+
*/
|
|
2446
|
+
declare function downloadICS(events: Event[], options?: ICSExportOptions): void;
|
|
2447
|
+
|
|
2448
|
+
/**
|
|
2449
|
+
* ICS Utilities Module
|
|
2450
|
+
*/
|
|
2451
|
+
|
|
2452
|
+
/**
|
|
2453
|
+
* Import events from an ICS file object
|
|
2454
|
+
*
|
|
2455
|
+
* @param file - The File object (from input[type="file"])
|
|
2456
|
+
* @param options - Import options
|
|
2457
|
+
* @returns Promise resolving to import result
|
|
2458
|
+
*/
|
|
2459
|
+
declare function importICSFile(file: File, options?: ICSImportOptions): Promise<ICSImportResult>;
|
|
2460
|
+
|
|
2461
|
+
/**
|
|
2462
|
+
* Core translation function.
|
|
2463
|
+
* 1. Try Intl API for standard terms.
|
|
2464
|
+
* 2. Fall back to language-specific dictionary.
|
|
2465
|
+
* 3. Fall back to English dictionary.
|
|
2466
|
+
* 4. Fall back to the key itself.
|
|
2467
|
+
*/
|
|
2468
|
+
declare function t(key: TranslationKey, locale?: LocaleCode): string;
|
|
2469
|
+
|
|
2470
|
+
/**
|
|
2471
|
+
* Encapsulates Intl API calls for standard calendar terms.
|
|
2472
|
+
*/
|
|
2473
|
+
declare function getIntlLabel(key: 'today' | 'day' | 'week' | 'month' | 'year', locale: string): string | null;
|
|
2474
|
+
/**
|
|
2475
|
+
* Capitalizes the first letter of a string.
|
|
2476
|
+
*/
|
|
2477
|
+
declare function capitalize(str: string): string;
|
|
2478
|
+
/**
|
|
2479
|
+
* Get localized weekday labels (Mon, Tue, etc.)
|
|
2480
|
+
*/
|
|
2481
|
+
declare const getWeekDaysLabels: (locale: string, format?: "long" | "short" | "narrow") => string[];
|
|
2482
|
+
/**
|
|
2483
|
+
* Get localized month labels
|
|
2484
|
+
*/
|
|
2485
|
+
declare const getMonthLabels: (locale: string, format?: "long" | "short" | "narrow" | "numeric" | "2-digit") => string[];
|
|
2486
|
+
|
|
2487
|
+
declare const en: Locale;
|
|
2488
|
+
|
|
2489
|
+
declare const zh: Locale;
|
|
2490
|
+
|
|
2491
|
+
declare const ja: Locale;
|
|
2492
|
+
|
|
2493
|
+
declare const ko: Locale;
|
|
2494
|
+
|
|
2495
|
+
declare const fr: Locale;
|
|
2496
|
+
|
|
2497
|
+
declare const de: Locale;
|
|
2498
|
+
|
|
2499
|
+
declare const es: Locale;
|
|
2500
|
+
|
|
2501
|
+
declare const LOCALES: {
|
|
2502
|
+
en: Locale;
|
|
2503
|
+
zh: Locale;
|
|
2504
|
+
ja: Locale;
|
|
2505
|
+
ko: Locale;
|
|
2506
|
+
fr: Locale;
|
|
2507
|
+
de: Locale;
|
|
2508
|
+
es: Locale;
|
|
2509
|
+
};
|
|
2510
|
+
type SupportedLang = keyof typeof LOCALES;
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Normalizes a locale string to a supported language code.
|
|
2514
|
+
* e.g., 'en-US' -> 'en', 'zh-CN' -> 'zh'
|
|
2515
|
+
*/
|
|
2516
|
+
declare function normalizeLocale(locale: string): SupportedLang;
|
|
2517
|
+
/**
|
|
2518
|
+
* Checks if a string is a valid locale identifier.
|
|
2519
|
+
*/
|
|
2520
|
+
declare function isValidLocale(locale: string): boolean;
|
|
2521
|
+
|
|
2522
|
+
interface LocaleContextValue {
|
|
2523
|
+
locale: LocaleCode;
|
|
2524
|
+
t: (key: TranslationKey, vars?: Record<string, string>) => string;
|
|
2525
|
+
getWeekDaysLabels: (locale: string, format?: 'long' | 'short' | 'narrow') => string[];
|
|
2526
|
+
getMonthLabels: (locale: string, format?: 'long' | 'short' | 'narrow' | 'numeric' | '2-digit') => string[];
|
|
2527
|
+
isDefault?: boolean;
|
|
2528
|
+
}
|
|
2529
|
+
declare const LocaleContext: preact.Context<LocaleContextValue>;
|
|
2530
|
+
|
|
2531
|
+
/**
|
|
2532
|
+
* Hook to use the locale context in functional components.
|
|
2533
|
+
*/
|
|
2534
|
+
declare function useLocale(): LocaleContextValue;
|
|
2535
|
+
|
|
2536
|
+
declare const createDayView: ViewFactory<DayViewConfig>;
|
|
2537
|
+
|
|
2538
|
+
declare const createWeekView: ViewFactory<WeekViewConfig>;
|
|
2539
|
+
|
|
2540
|
+
declare const createMonthView: ViewFactory<MonthViewConfig>;
|
|
2541
|
+
|
|
2542
|
+
declare const createYearView: ViewFactory<YearViewConfig>;
|
|
2543
|
+
|
|
2544
|
+
declare function createStandardViews(config?: {
|
|
2545
|
+
day?: Partial<DayViewConfig>;
|
|
2546
|
+
week?: Partial<WeekViewConfig>;
|
|
2547
|
+
month?: Partial<MonthViewConfig>;
|
|
2548
|
+
}): CalendarView[];
|
|
2549
|
+
|
|
2550
|
+
declare function createDragPlugin(config?: Partial<DragPluginConfig>): CalendarPlugin;
|
|
2551
|
+
|
|
2552
|
+
declare function createEventsPlugin(config?: EventsPluginConfig): CalendarPlugin;
|
|
2553
|
+
|
|
2554
|
+
export { CalendarApp, CalendarRegistry, CalendarRenderer, CustomRenderingStore, LAYOUT_CONFIG, LOCALES, LocaleContext, TIME_STEP, VIRTUAL_MONTH_SCROLL_CONFIG, ViewType, WeekDataCache, addDays, buildParseRegExp, calculateDayIndex, capitalize, conditionalTheme, convertDateEvent, convertDateEventWithTimeZone, createAllDayEvent, createDateWithHour, createDayView, createDragPlugin, createEvent, createEventWithDate, createEventWithRealDate, createEvents, createEventsPlugin, createMonthView, createStandardViews, createTemporalWithHour, createTimedEvent, createTimezoneEvent, createTimezoneEvents, createWeekView, createYearView, dateToPlainDate, dateToPlainDateTime, dateToZonedDateTime, daysBetween, daysDifference, de, downloadICS, en, es, extractHourFromDate, extractHourFromTemporal, formatDate, formatDateConsistent, formatDateToICSTimestamp, formatEventTimeRange, formatICSDate, formatMonthYear, formatTemporal, formatTime, fr, generateDayData, generateICS, generateUniKey, generateWeekData, generateWeekRange, generateWeeksData, getAllDayEventsForDay, 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, ja, ko, mergeClasses, mergeFormatTemplate, monthNames, normalizeCssWidth, normalizeDate, normalizeLocale, normalizeToZoned, now, pad, parseICS, parseICSDate, parseTemporalString, plainDateTimeToDate, plainDateToDate, recalculateEventDays, resolveAppliedTheme, roundToTimeStep, scrollbarTakesSpace, setHourInTemporal, shortMonthNames, t, temporalToDate, themeClasses, themeCn, today, updateEventDateAndDay, updateEventWithRealDate, useLocale, weekDays, weekDaysFullName, zh, zonedDateTimeToDate };
|
|
2555
|
+
export type { BalanceStrategy, BaseViewProps, CalendarAppConfig, CalendarAppState, CalendarCallbacks, CalendarColors, CalendarConfig, CalendarHeaderProps, CalendarPlugin, CalendarSidebarRenderProps, 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, MobileEventProps, MobileEventRenderer, Mode, MonthDragState, MonthEventDragState, MonthViewConfig, MonthViewProps, NestedLayer, ReadOnlyConfig, SidebarConfig, 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 };
|