@dayflow/core 2.0.7 → 3.0.0
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 +14 -24
- package/LICENSE +0 -21
- 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/types/calendar.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Date data interface
|
|
3
|
-
* Represents detailed information for a single date
|
|
4
|
-
*/
|
|
5
|
-
export interface DayData {
|
|
6
|
-
date: Date;
|
|
7
|
-
day: number;
|
|
8
|
-
month: number;
|
|
9
|
-
year: number;
|
|
10
|
-
monthName: string;
|
|
11
|
-
shortMonthName: string;
|
|
12
|
-
isToday: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Week data interface
|
|
16
|
-
* Represents a week's data, containing date information for 7 days
|
|
17
|
-
*/
|
|
18
|
-
export interface WeeksData {
|
|
19
|
-
days: DayData[];
|
|
20
|
-
startDate: Date;
|
|
21
|
-
monthYear: {
|
|
22
|
-
month: string;
|
|
23
|
-
monthIndex: number;
|
|
24
|
-
year: number;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Color configuration for a calendar type
|
|
3
|
-
*/
|
|
4
|
-
export interface CalendarColors {
|
|
5
|
-
/** Event background color */
|
|
6
|
-
eventColor: string;
|
|
7
|
-
/** Selected event background color */
|
|
8
|
-
eventSelectedColor: string;
|
|
9
|
-
/** Border/line color */
|
|
10
|
-
lineColor: string;
|
|
11
|
-
/** Text color */
|
|
12
|
-
textColor: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Calendar Type Definition
|
|
16
|
-
* Represents a category of events (e.g., Work, Personal, Study)
|
|
17
|
-
*/
|
|
18
|
-
export interface CalendarType {
|
|
19
|
-
/** Unique identifier (e.g., 'work', 'personal') */
|
|
20
|
-
id: string;
|
|
21
|
-
/** Display name (e.g., 'Work', 'Personal') */
|
|
22
|
-
name: string;
|
|
23
|
-
/** Optional description */
|
|
24
|
-
description?: string;
|
|
25
|
-
/** Light mode colors */
|
|
26
|
-
colors: CalendarColors;
|
|
27
|
-
/** Dark mode colors (optional, falls back to light mode if not provided) */
|
|
28
|
-
darkColors?: CalendarColors;
|
|
29
|
-
/** Optional icon (emoji or icon name) */
|
|
30
|
-
icon?: string;
|
|
31
|
-
/** Whether this is a system default type */
|
|
32
|
-
isDefault?: boolean;
|
|
33
|
-
/** Whether events of this type should be visible */
|
|
34
|
-
isVisible?: boolean;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Theme mode
|
|
38
|
-
*/
|
|
39
|
-
export type ThemeMode = 'light' | 'dark' | 'auto';
|
|
40
|
-
/**
|
|
41
|
-
* System-level theme colors
|
|
42
|
-
*/
|
|
43
|
-
export interface ThemeColors {
|
|
44
|
-
background?: string;
|
|
45
|
-
text?: string;
|
|
46
|
-
border?: string;
|
|
47
|
-
[key: string]: string | undefined;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Theme configuration
|
|
51
|
-
*/
|
|
52
|
-
export interface ThemeConfig {
|
|
53
|
-
/** Current theme mode */
|
|
54
|
-
mode: ThemeMode;
|
|
55
|
-
/** System-level theme colors (optional) */
|
|
56
|
-
colors?: ThemeColors;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Calendar configuration for the app
|
|
60
|
-
*/
|
|
61
|
-
export interface CalendarsConfig {
|
|
62
|
-
/** Array of calendar types */
|
|
63
|
-
calendars?: CalendarType[];
|
|
64
|
-
/** Default calendar for new events */
|
|
65
|
-
defaultCalendar?: string;
|
|
66
|
-
/** Theme configuration */
|
|
67
|
-
theme?: ThemeConfig;
|
|
68
|
-
}
|
package/dist/types/config.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ViewType } from './core';
|
|
2
|
-
/**
|
|
3
|
-
* Drag configuration type
|
|
4
|
-
* Defines configuration parameters for drag functionality
|
|
5
|
-
*/
|
|
6
|
-
export interface DragConfig {
|
|
7
|
-
viewType: ViewType;
|
|
8
|
-
getLineColor: (color: string) => string;
|
|
9
|
-
getDynamicPadding: (drag: {
|
|
10
|
-
endHour: number;
|
|
11
|
-
startHour: number;
|
|
12
|
-
}) => string;
|
|
13
|
-
HOUR_HEIGHT: number;
|
|
14
|
-
FIRST_HOUR: number;
|
|
15
|
-
LAST_HOUR: number;
|
|
16
|
-
MIN_DURATION: number;
|
|
17
|
-
TIME_COLUMN_WIDTH: number;
|
|
18
|
-
ALL_DAY_HEIGHT: number;
|
|
19
|
-
}
|
package/dist/types/core.d.ts
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Event } from './event';
|
|
3
|
-
import { ViewSwitcherMode } from '../components/common/ViewHeader';
|
|
4
|
-
import { CalendarType, ThemeConfig, ThemeMode } from './calendarTypes';
|
|
5
|
-
import { CalendarRegistry } from '../core/calendarRegistry';
|
|
6
|
-
import { Locale } from '../locale/types';
|
|
7
|
-
import { MobileEventRenderer } from './mobileEvent';
|
|
8
|
-
/**
|
|
9
|
-
* View type enum
|
|
10
|
-
*/
|
|
11
|
-
export declare enum ViewType {
|
|
12
|
-
DAY = "day",
|
|
13
|
-
WEEK = "week",
|
|
14
|
-
MONTH = "month",
|
|
15
|
-
YEAR = "year"
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Plugin interface
|
|
19
|
-
* Defines the basic structure of calendar plugins
|
|
20
|
-
*/
|
|
21
|
-
export interface CalendarPlugin {
|
|
22
|
-
name: string;
|
|
23
|
-
install: (app: CalendarApp) => void;
|
|
24
|
-
config?: Record<string, unknown>;
|
|
25
|
-
api?: unknown;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* View interface
|
|
29
|
-
* Defines the basic structure of calendar views
|
|
30
|
-
*/
|
|
31
|
-
export interface CalendarView {
|
|
32
|
-
type: ViewType;
|
|
33
|
-
component: React.ComponentType<any>;
|
|
34
|
-
config?: Record<string, unknown>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Calendar callbacks interface
|
|
38
|
-
* Defines calendar event callback functions
|
|
39
|
-
*/
|
|
40
|
-
export interface CalendarCallbacks {
|
|
41
|
-
onViewChange?: (view: ViewType) => void | Promise<void>;
|
|
42
|
-
onEventCreate?: (event: Event) => void | Promise<void>;
|
|
43
|
-
onEventUpdate?: (event: Event) => void | Promise<void>;
|
|
44
|
-
onEventDelete?: (eventId: string) => void | Promise<void>;
|
|
45
|
-
onDateChange?: (date: Date) => void | Promise<void>;
|
|
46
|
-
onRender?: () => void | Promise<void>;
|
|
47
|
-
onVisibleMonthChange?: (date: Date) => void | Promise<void>;
|
|
48
|
-
onCalendarUpdate?: (calendar: CalendarType) => void | Promise<void>;
|
|
49
|
-
onCalendarCreate?: (calendar: CalendarType) => void | Promise<void>;
|
|
50
|
-
onCalendarDelete?: (calendarId: string) => void | Promise<void>;
|
|
51
|
-
onCalendarMerge?: (sourceId: string, targetId: string) => void | Promise<void>;
|
|
52
|
-
onEventClick?: (event: Event) => void | Promise<void>;
|
|
53
|
-
onMoreEventsClick?: (date: Date) => void | Promise<void>;
|
|
54
|
-
}
|
|
55
|
-
export interface CreateCalendarDialogProps {
|
|
56
|
-
onClose: () => void;
|
|
57
|
-
onCreate: (calendar: CalendarType) => void;
|
|
58
|
-
colorPickerMode?: 'blossom' | 'default';
|
|
59
|
-
}
|
|
60
|
-
export interface CalendarHeaderProps {
|
|
61
|
-
calendar: CalendarApp;
|
|
62
|
-
switcherMode?: ViewSwitcherMode;
|
|
63
|
-
onAddCalendar?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
64
|
-
onSearchChange?: (value: string) => void;
|
|
65
|
-
/** Triggered when search icon is clicked (typically on mobile) */
|
|
66
|
-
onSearchClick?: () => void;
|
|
67
|
-
searchValue?: string;
|
|
68
|
-
isSearchOpen?: boolean;
|
|
69
|
-
isEditable?: boolean;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Sidebar render props
|
|
73
|
-
*/
|
|
74
|
-
export interface CalendarSidebarRenderProps {
|
|
75
|
-
app: CalendarApp;
|
|
76
|
-
calendars: CalendarType[];
|
|
77
|
-
toggleCalendarVisibility: (calendarId: string, visible: boolean) => void;
|
|
78
|
-
toggleAll: (visible: boolean) => void;
|
|
79
|
-
isCollapsed: boolean;
|
|
80
|
-
setCollapsed: (collapsed: boolean) => void;
|
|
81
|
-
renderCalendarContextMenu?: (calendar: CalendarType, onClose: () => void) => React.ReactNode;
|
|
82
|
-
createCalendarMode?: 'inline' | 'modal';
|
|
83
|
-
renderCreateCalendarDialog?: (props: CreateCalendarDialogProps) => React.ReactNode;
|
|
84
|
-
editingCalendarId?: string | null;
|
|
85
|
-
setEditingCalendarId?: (id: string | null) => void;
|
|
86
|
-
onCreateCalendar?: () => void;
|
|
87
|
-
colorPickerMode?: 'blossom' | 'default';
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Sidebar config
|
|
91
|
-
*/
|
|
92
|
-
export interface SidebarConfig {
|
|
93
|
-
enabled?: boolean;
|
|
94
|
-
width?: number | string;
|
|
95
|
-
initialCollapsed?: boolean;
|
|
96
|
-
render?: (props: CalendarSidebarRenderProps) => React.ReactNode;
|
|
97
|
-
renderCalendarContextMenu?: (calendar: CalendarType, onClose: () => void) => React.ReactNode;
|
|
98
|
-
createCalendarMode?: 'inline' | 'modal';
|
|
99
|
-
renderCreateCalendarDialog?: (props: CreateCalendarDialogProps) => React.ReactNode;
|
|
100
|
-
/** Color picker mode: 'blossom' for BlossomColorPicker, 'default' for react-color */
|
|
101
|
-
colorPickerMode?: 'blossom' | 'default';
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Calendar application configuration
|
|
105
|
-
* Used to initialize CalendarApp
|
|
106
|
-
*/
|
|
107
|
-
export interface CalendarAppConfig {
|
|
108
|
-
views: CalendarView[];
|
|
109
|
-
plugins?: CalendarPlugin[];
|
|
110
|
-
events?: Event[];
|
|
111
|
-
callbacks?: CalendarCallbacks;
|
|
112
|
-
defaultView?: ViewType;
|
|
113
|
-
initialDate?: Date;
|
|
114
|
-
switcherMode?: ViewSwitcherMode;
|
|
115
|
-
calendars?: CalendarType[];
|
|
116
|
-
defaultCalendar?: string;
|
|
117
|
-
theme?: ThemeConfig;
|
|
118
|
-
useSidebar?: boolean | SidebarConfig;
|
|
119
|
-
useEventDetailDialog?: boolean;
|
|
120
|
-
useCalendarHeader?: boolean | ((props: CalendarHeaderProps) => React.ReactNode);
|
|
121
|
-
customMobileEventRenderer?: MobileEventRenderer;
|
|
122
|
-
locale?: string | Locale;
|
|
123
|
-
readOnly?: boolean | ReadOnlyConfig;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Read-only configuration
|
|
127
|
-
*/
|
|
128
|
-
export interface ReadOnlyConfig {
|
|
129
|
-
draggable?: boolean;
|
|
130
|
-
viewable?: boolean;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Calendar application state
|
|
134
|
-
* Internal state of CalendarApp
|
|
135
|
-
*/
|
|
136
|
-
export interface CalendarAppState {
|
|
137
|
-
currentView: ViewType;
|
|
138
|
-
currentDate: Date;
|
|
139
|
-
events: Event[];
|
|
140
|
-
plugins: Map<string, CalendarPlugin>;
|
|
141
|
-
views: Map<ViewType, CalendarView>;
|
|
142
|
-
switcherMode?: ViewSwitcherMode;
|
|
143
|
-
sidebar?: SidebarConfig;
|
|
144
|
-
locale: string | Locale;
|
|
145
|
-
highlightedEventId?: string | null;
|
|
146
|
-
readOnly: boolean | ReadOnlyConfig;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Calendar application instance
|
|
150
|
-
* Core interface of CalendarApp
|
|
151
|
-
*/
|
|
152
|
-
export interface CalendarApp {
|
|
153
|
-
state: CalendarAppState;
|
|
154
|
-
getReadOnlyConfig: () => ReadOnlyConfig;
|
|
155
|
-
changeView: (view: ViewType) => void;
|
|
156
|
-
getCurrentView: () => CalendarView;
|
|
157
|
-
setCurrentDate: (date: Date) => void;
|
|
158
|
-
getCurrentDate: () => Date;
|
|
159
|
-
goToToday: () => void;
|
|
160
|
-
goToPrevious: () => void;
|
|
161
|
-
goToNext: () => void;
|
|
162
|
-
selectDate: (date: Date) => void;
|
|
163
|
-
addEvent: (event: Event) => void;
|
|
164
|
-
updateEvent: (id: string, event: Partial<Event>, isPending?: boolean) => void;
|
|
165
|
-
deleteEvent: (id: string) => void;
|
|
166
|
-
getEvents: () => Event[];
|
|
167
|
-
getAllEvents: () => Event[];
|
|
168
|
-
onEventClick: (event: Event) => void;
|
|
169
|
-
onMoreEventsClick: (date: Date) => void;
|
|
170
|
-
highlightEvent: (eventId: string | null) => void;
|
|
171
|
-
getCalendars: () => CalendarType[];
|
|
172
|
-
reorderCalendars: (fromIndex: number, toIndex: number) => void;
|
|
173
|
-
setCalendarVisibility: (calendarId: string, visible: boolean) => void;
|
|
174
|
-
setAllCalendarsVisibility: (visible: boolean) => void;
|
|
175
|
-
updateCalendar: (id: string, updates: Partial<CalendarType>) => void;
|
|
176
|
-
createCalendar: (calendar: CalendarType) => void;
|
|
177
|
-
deleteCalendar: (id: string) => void;
|
|
178
|
-
mergeCalendars: (sourceId: string, targetId: string) => void;
|
|
179
|
-
setVisibleMonth: (date: Date) => void;
|
|
180
|
-
getVisibleMonth: () => Date;
|
|
181
|
-
getPlugin: <T = unknown>(name: string) => T | undefined;
|
|
182
|
-
hasPlugin: (name: string) => boolean;
|
|
183
|
-
render: () => React.ReactElement;
|
|
184
|
-
getSidebarConfig: () => SidebarConfig;
|
|
185
|
-
getCalendarHeaderConfig: () => boolean | ((props: CalendarHeaderProps) => React.ReactNode);
|
|
186
|
-
triggerRender: () => void;
|
|
187
|
-
getCalendarRegistry: () => CalendarRegistry;
|
|
188
|
-
getUseEventDetailDialog: () => boolean;
|
|
189
|
-
getCustomMobileEventRenderer: () => MobileEventRenderer | undefined;
|
|
190
|
-
updateConfig: (config: Partial<CalendarAppConfig>) => void;
|
|
191
|
-
setTheme: (mode: ThemeMode) => void;
|
|
192
|
-
getTheme: () => ThemeMode;
|
|
193
|
-
subscribeThemeChange: (callback: (theme: ThemeMode) => void) => (() => void);
|
|
194
|
-
unsubscribeThemeChange: (callback: (theme: ThemeMode) => void) => void;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* useCalendarApp Hook return type
|
|
198
|
-
* Calendar application interface provided for React components
|
|
199
|
-
*/
|
|
200
|
-
export interface UseCalendarAppReturn {
|
|
201
|
-
app: CalendarApp;
|
|
202
|
-
currentView: ViewType;
|
|
203
|
-
currentDate: Date;
|
|
204
|
-
events: Event[];
|
|
205
|
-
changeView: (view: ViewType) => void;
|
|
206
|
-
setCurrentDate: (date: Date) => void;
|
|
207
|
-
addEvent: (event: Event) => void;
|
|
208
|
-
updateEvent: (id: string, event: Partial<Event>, isPending?: boolean) => void;
|
|
209
|
-
deleteEvent: (id: string) => void;
|
|
210
|
-
goToToday: () => void;
|
|
211
|
-
goToPrevious: () => void;
|
|
212
|
-
goToNext: () => void;
|
|
213
|
-
selectDate: (date: Date) => void;
|
|
214
|
-
getCalendars: () => CalendarType[];
|
|
215
|
-
createCalendar: (calendar: CalendarType) => void;
|
|
216
|
-
mergeCalendars: (sourceId: string, targetId: string) => void;
|
|
217
|
-
setCalendarVisibility: (calendarId: string, visible: boolean) => void;
|
|
218
|
-
setAllCalendarsVisibility: (visible: boolean) => void;
|
|
219
|
-
getAllEvents: () => Event[];
|
|
220
|
-
highlightEvent: (eventId: string | null) => void;
|
|
221
|
-
setVisibleMonth: (date: Date) => void;
|
|
222
|
-
getVisibleMonth: () => Date;
|
|
223
|
-
sidebarConfig: SidebarConfig;
|
|
224
|
-
readOnlyConfig: ReadOnlyConfig;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Calendar configuration system type
|
|
228
|
-
* Contains drag and view configurations
|
|
229
|
-
*/
|
|
230
|
-
export interface CalendarConfig {
|
|
231
|
-
locale?: string;
|
|
232
|
-
drag: {
|
|
233
|
-
HOUR_HEIGHT: number;
|
|
234
|
-
FIRST_HOUR: number;
|
|
235
|
-
LAST_HOUR: number;
|
|
236
|
-
MIN_DURATION: number;
|
|
237
|
-
TIME_COLUMN_WIDTH: number;
|
|
238
|
-
ALL_DAY_HEIGHT: number;
|
|
239
|
-
getLineColor: (color: string) => string;
|
|
240
|
-
getDynamicPadding: (drag: {
|
|
241
|
-
endHour: number;
|
|
242
|
-
startHour: number;
|
|
243
|
-
}) => string;
|
|
244
|
-
};
|
|
245
|
-
views: {
|
|
246
|
-
day: Record<string, unknown>;
|
|
247
|
-
week: Record<string, unknown>;
|
|
248
|
-
month: Record<string, unknown>;
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
export interface UseCalendarReturn {
|
|
252
|
-
view: ViewType;
|
|
253
|
-
currentDate: Date;
|
|
254
|
-
events: Event[];
|
|
255
|
-
currentWeekStart: Date;
|
|
256
|
-
changeView: (view: ViewType) => void;
|
|
257
|
-
goToToday: () => void;
|
|
258
|
-
goToPrevious: () => void;
|
|
259
|
-
goToNext: () => void;
|
|
260
|
-
selectDate: (date: Date) => void;
|
|
261
|
-
updateEvent: (eventId: string, updates: Partial<Event>, isPending?: boolean) => void;
|
|
262
|
-
deleteEvent: (eventId: string) => void;
|
|
263
|
-
addEvent: (event: Omit<Event, 'id'>) => void;
|
|
264
|
-
setEvents: (events: Event[] | ((prev: Event[]) => Event[])) => void;
|
|
265
|
-
}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { DragConfig, CalendarApp } from '../types';
|
|
2
|
-
import { EventLayout } from './layout';
|
|
3
|
-
import { Event } from './event';
|
|
4
|
-
import { UseDragCommonReturn, UseDragManagerReturn, UseDragStateReturn } from './hook';
|
|
5
|
-
/**
|
|
6
|
-
* Drag mode type
|
|
7
|
-
*/
|
|
8
|
-
export type Mode = 'create' | 'move' | 'resize' | null;
|
|
9
|
-
/**
|
|
10
|
-
* Drag reference interface
|
|
11
|
-
* Stores state information for drag operations
|
|
12
|
-
*/
|
|
13
|
-
export interface DragRef {
|
|
14
|
-
active: boolean;
|
|
15
|
-
mode: Mode;
|
|
16
|
-
eventId: string | null;
|
|
17
|
-
dayIndex: number;
|
|
18
|
-
startX: number;
|
|
19
|
-
startY: number;
|
|
20
|
-
startHour: number;
|
|
21
|
-
endHour: number;
|
|
22
|
-
originalDay: number;
|
|
23
|
-
originalStartHour: number;
|
|
24
|
-
originalEndHour: number;
|
|
25
|
-
resizeDirection: string | null;
|
|
26
|
-
hourOffset: number | null;
|
|
27
|
-
duration: number;
|
|
28
|
-
lastRawMouseHour: number | null;
|
|
29
|
-
lastUpdateTime: number;
|
|
30
|
-
initialMouseY: number;
|
|
31
|
-
lastClientY: number;
|
|
32
|
-
allDay: boolean;
|
|
33
|
-
eventDate?: Date;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Event detail position interface
|
|
37
|
-
* Used to position event detail popup
|
|
38
|
-
*/
|
|
39
|
-
export interface EventDetailPosition {
|
|
40
|
-
top: number;
|
|
41
|
-
left: number;
|
|
42
|
-
eventHeight: number;
|
|
43
|
-
eventMiddleY: number;
|
|
44
|
-
isSunday?: boolean;
|
|
45
|
-
}
|
|
46
|
-
export interface DragIndicatorProps {
|
|
47
|
-
drag: DragRef;
|
|
48
|
-
color?: string;
|
|
49
|
-
title?: string;
|
|
50
|
-
layout?: EventLayout | null;
|
|
51
|
-
allDay: boolean;
|
|
52
|
-
formatTime: (hour: number) => string;
|
|
53
|
-
getLineColor: (color: string) => string;
|
|
54
|
-
getDynamicPadding: (drag: DragRef) => string;
|
|
55
|
-
locale?: string;
|
|
56
|
-
isMobile?: boolean;
|
|
57
|
-
}
|
|
58
|
-
export interface DragIndicatorRenderer {
|
|
59
|
-
renderAllDayContent: (props: DragIndicatorProps) => React.ReactNode;
|
|
60
|
-
renderRegularContent: (props: DragIndicatorProps) => React.ReactNode;
|
|
61
|
-
renderDefaultContent: (props: DragIndicatorProps) => React.ReactNode;
|
|
62
|
-
}
|
|
63
|
-
export interface UnifiedDragRef extends DragRef {
|
|
64
|
-
targetDate?: Date | null;
|
|
65
|
-
originalDate?: Date | null;
|
|
66
|
-
originalEvent?: Event | null;
|
|
67
|
-
dragOffset?: number;
|
|
68
|
-
originalStartDate?: Date | null;
|
|
69
|
-
originalEndDate?: Date | null;
|
|
70
|
-
eventDate?: Date;
|
|
71
|
-
originalStartTime?: {
|
|
72
|
-
hour: number;
|
|
73
|
-
minute: number;
|
|
74
|
-
second: number;
|
|
75
|
-
} | null;
|
|
76
|
-
originalEndTime?: {
|
|
77
|
-
hour: number;
|
|
78
|
-
minute: number;
|
|
79
|
-
second: number;
|
|
80
|
-
} | null;
|
|
81
|
-
sourceElement?: HTMLElement | null;
|
|
82
|
-
indicatorVisible?: boolean;
|
|
83
|
-
eventDurationDays?: number;
|
|
84
|
-
currentSegmentDays?: number;
|
|
85
|
-
startDragDayIndex?: number;
|
|
86
|
-
calendarId?: string;
|
|
87
|
-
title?: string;
|
|
88
|
-
}
|
|
89
|
-
export interface useDragProps extends Partial<DragConfig> {
|
|
90
|
-
calendarRef: React.RefObject<HTMLDivElement | null>;
|
|
91
|
-
allDayRowRef?: React.RefObject<HTMLDivElement | null>;
|
|
92
|
-
onEventsUpdate: (updateFunc: (events: Event[]) => Event[], isResizing?: boolean) => void;
|
|
93
|
-
onEventCreate: (event: Event) => void;
|
|
94
|
-
onEventEdit?: (event: Event) => void;
|
|
95
|
-
calculateNewEventLayout?: (dayIndex: number, startHour: number, endHour: number) => EventLayout | null;
|
|
96
|
-
calculateDragLayout?: (event: Event, targetDay: number, targetStartHour: number, targetEndHour: number) => EventLayout | null;
|
|
97
|
-
currentWeekStart: Date;
|
|
98
|
-
events: Event[];
|
|
99
|
-
renderer?: DragIndicatorRenderer;
|
|
100
|
-
app?: CalendarApp;
|
|
101
|
-
isMobile?: boolean;
|
|
102
|
-
}
|
|
103
|
-
export type MonthDragState = {
|
|
104
|
-
active: boolean;
|
|
105
|
-
mode: 'create' | 'move' | 'resize' | null;
|
|
106
|
-
eventId: string | null;
|
|
107
|
-
targetDate: Date | null;
|
|
108
|
-
startDate: Date | null;
|
|
109
|
-
endDate: Date | null;
|
|
110
|
-
};
|
|
111
|
-
export type WeekDayDragState = {
|
|
112
|
-
active: boolean;
|
|
113
|
-
mode: 'create' | 'move' | 'resize' | null;
|
|
114
|
-
eventId: string | null;
|
|
115
|
-
dayIndex: number;
|
|
116
|
-
startHour: number;
|
|
117
|
-
endHour: number;
|
|
118
|
-
allDay: boolean;
|
|
119
|
-
};
|
|
120
|
-
export interface useDragReturn {
|
|
121
|
-
createDragIndicator: (drag: UnifiedDragRef, color?: string, title?: string, layout?: EventLayout | null, sourceElement?: HTMLElement) => void;
|
|
122
|
-
updateDragIndicator: (...args: (number | boolean | EventLayout | null | undefined)[]) => void;
|
|
123
|
-
removeDragIndicator: () => void;
|
|
124
|
-
handleCreateAllDayEvent?: (e: React.MouseEvent, dayIndex: number) => void;
|
|
125
|
-
handleCreateStart: (e: React.MouseEvent | React.TouchEvent, ...args: (Date | number)[]) => void;
|
|
126
|
-
handleMoveStart: (e: React.MouseEvent | React.TouchEvent, event: Event) => void;
|
|
127
|
-
handleResizeStart: (e: React.MouseEvent | React.TouchEvent, event: Event, direction: string) => void;
|
|
128
|
-
dragState: MonthDragState | WeekDayDragState;
|
|
129
|
-
isDragging: boolean;
|
|
130
|
-
pixelYToHour?: (y: number) => number;
|
|
131
|
-
getColumnDayIndex?: (x: number) => number;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Month view event drag state (alias for MonthDragState, maintains backward compatibility)
|
|
135
|
-
*/
|
|
136
|
-
export type MonthEventDragState = MonthDragState;
|
|
137
|
-
export interface UseMonthDragReturn {
|
|
138
|
-
daysDifference: (date1: Date, date2: Date) => number;
|
|
139
|
-
addDaysToDate: (date: Date, days: number) => Date;
|
|
140
|
-
getTargetDateFromPosition: (clientX: number, clientY: number) => Date | null;
|
|
141
|
-
}
|
|
142
|
-
export interface UseMonthDragParams {
|
|
143
|
-
options: useDragProps;
|
|
144
|
-
common: UseDragCommonReturn;
|
|
145
|
-
state: UseDragStateReturn;
|
|
146
|
-
manager: UseDragManagerReturn;
|
|
147
|
-
}
|
|
148
|
-
export interface UseWeekDayDragReturn {
|
|
149
|
-
handleCreateAllDayEvent: (e: React.MouseEvent, dayIndex: number) => void;
|
|
150
|
-
pixelYToHour: (y: number) => number;
|
|
151
|
-
getColumnDayIndex: (x: number) => number;
|
|
152
|
-
}
|
|
153
|
-
export interface UseWeekDayDragParams {
|
|
154
|
-
options: useDragProps;
|
|
155
|
-
common: UseDragCommonReturn;
|
|
156
|
-
state: UseDragStateReturn;
|
|
157
|
-
manager: UseDragManagerReturn;
|
|
158
|
-
handleDragMove: (e: MouseEvent) => void;
|
|
159
|
-
handleDragEnd: (e: MouseEvent) => void;
|
|
160
|
-
}
|
package/dist/types/event.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Temporal } from 'temporal-polyfill';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* Calendar event interface (using Temporal API)
|
|
5
|
-
* Unified event data structure supporting single-day, cross-day, and all-day events
|
|
6
|
-
*/
|
|
7
|
-
export interface Event {
|
|
8
|
-
id: string;
|
|
9
|
-
title: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
start: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
12
|
-
end: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
13
|
-
allDay?: boolean;
|
|
14
|
-
icon?: boolean | ReactNode;
|
|
15
|
-
calendarId?: string;
|
|
16
|
-
meta?: Record<string, any>;
|
|
17
|
-
day?: number;
|
|
18
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Event } from './event';
|
|
2
|
-
import { EventDetailPosition } from './dragIndicator';
|
|
3
|
-
import { CalendarApp } from '../types';
|
|
4
|
-
export type { EventDetailPosition } from './dragIndicator';
|
|
5
|
-
/**
|
|
6
|
-
* Event detail panel Props
|
|
7
|
-
*/
|
|
8
|
-
export interface EventDetailPanelProps {
|
|
9
|
-
/** Current event data */
|
|
10
|
-
event: Event;
|
|
11
|
-
/** Panel position information */
|
|
12
|
-
position: EventDetailPosition;
|
|
13
|
-
/** Panel DOM reference */
|
|
14
|
-
panelRef: React.RefObject<HTMLDivElement>;
|
|
15
|
-
/** Whether the event is all-day */
|
|
16
|
-
isAllDay: boolean;
|
|
17
|
-
/** Event visibility state */
|
|
18
|
-
eventVisibility: 'visible' | 'sticky-top' | 'sticky-bottom';
|
|
19
|
-
/** Calendar container reference */
|
|
20
|
-
calendarRef: React.RefObject<HTMLDivElement>;
|
|
21
|
-
/** Selected event element reference */
|
|
22
|
-
selectedEventElementRef: React.RefObject<HTMLDivElement>;
|
|
23
|
-
/** Event update callback */
|
|
24
|
-
onEventUpdate: (updatedEvent: Event) => void;
|
|
25
|
-
/** Event delete callback */
|
|
26
|
-
onEventDelete: (eventId: string) => void;
|
|
27
|
-
/** Close panel callback (optional) */
|
|
28
|
-
onClose?: () => void;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Custom event detail panel renderer (full panel including positioning and styling)
|
|
32
|
-
*/
|
|
33
|
-
export type EventDetailPanelRenderer = React.ComponentType<EventDetailPanelProps>;
|
|
34
|
-
/**
|
|
35
|
-
* Event detail content Props (excluding panel container, content only)
|
|
36
|
-
*/
|
|
37
|
-
export interface EventDetailContentProps {
|
|
38
|
-
/** Current event data */
|
|
39
|
-
event: Event;
|
|
40
|
-
/** Whether the event is all-day */
|
|
41
|
-
isAllDay: boolean;
|
|
42
|
-
/** Event update callback */
|
|
43
|
-
onEventUpdate: (updatedEvent: Event) => void;
|
|
44
|
-
/** Event delete callback */
|
|
45
|
-
onEventDelete: (eventId: string) => void;
|
|
46
|
-
/** Close panel callback (optional) */
|
|
47
|
-
onClose?: () => void;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Custom event detail content renderer (content only, will be wrapped in default panel)
|
|
51
|
-
*/
|
|
52
|
-
export type EventDetailContentRenderer = React.ComponentType<EventDetailContentProps>;
|
|
53
|
-
/**
|
|
54
|
-
* Event detail dialog Props
|
|
55
|
-
*/
|
|
56
|
-
export interface EventDetailDialogProps {
|
|
57
|
-
/** Current event data */
|
|
58
|
-
event: Event;
|
|
59
|
-
/** Whether the dialog is open */
|
|
60
|
-
isOpen: boolean;
|
|
61
|
-
/** Whether the event is all-day */
|
|
62
|
-
isAllDay: boolean;
|
|
63
|
-
/** Event update callback */
|
|
64
|
-
onEventUpdate: (updatedEvent: Event) => void;
|
|
65
|
-
/** Event delete callback */
|
|
66
|
-
onEventDelete: (eventId: string) => void;
|
|
67
|
-
/** Close dialog callback */
|
|
68
|
-
onClose: () => void;
|
|
69
|
-
app?: CalendarApp;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Custom event detail dialog renderer (Dialog/Modal mode)
|
|
73
|
-
*/
|
|
74
|
-
export type EventDetailDialogRenderer = React.ComponentType<EventDetailDialogProps>;
|