@dayflow/core 1.0.8 → 2.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/README.ja.md +325 -90
- package/README.md +319 -78
- package/README.zh.md +324 -89
- package/dist/components/common/CalendarHeader.d.ts +1 -10
- package/dist/components/common/ColorPicker.d.ts +1 -0
- package/dist/components/common/DefaultEventDetailPanel.d.ts +1 -1
- package/dist/components/common/MobileEventDrawer.d.ts +12 -0
- package/dist/components/common/MobileSearchDialog.d.ts +14 -0
- package/dist/components/common/QuickCreateEventPopup.d.ts +10 -0
- package/dist/components/common/SearchResultsList.d.ts +11 -0
- package/dist/components/common/ViewHeader.d.ts +0 -2
- package/dist/components/mobileEventDrawer/DefaultMobileEventDrawer.d.ts +3 -0
- package/dist/components/mobileEventDrawer/components/Switch.d.ts +7 -0
- package/dist/components/mobileEventDrawer/components/TimePickerWheel.d.ts +7 -0
- package/dist/components/mobileEventDrawer/index.d.ts +3 -0
- package/dist/components/monthView/MultiDayEvent.d.ts +7 -2
- package/dist/components/monthView/WeekComponent.d.ts +5 -3
- package/dist/components/monthView/util.d.ts +1 -1
- package/dist/components/search/MobileSearchDialog.d.ts +14 -0
- package/dist/components/search/SearchDrawer.d.ts +13 -0
- package/dist/components/search/SearchResultsList.d.ts +11 -0
- package/dist/components/sidebar/components/CalendarList.d.ts +2 -0
- package/dist/components/weekView/CalendarEvent.d.ts +7 -2
- package/dist/core/CalendarApp.d.ts +14 -1
- package/dist/hooks/virtualScroll/useVirtualMonthScroll.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/locale/types.d.ts +1 -1
- package/dist/styles/classNames.d.ts +7 -7
- package/dist/styles.css +336 -23
- package/dist/types/core.d.ts +33 -0
- package/dist/types/dragIndicator.d.ts +5 -3
- package/dist/types/event.d.ts +2 -0
- package/dist/types/hook.d.ts +7 -7
- package/dist/types/index.d.ts +1 -0
- package/dist/types/mobileEvent.d.ts +21 -0
- package/dist/types/monthView.d.ts +1 -0
- package/dist/types/plugin.d.ts +6 -4
- package/dist/utils/compareUtils.d.ts +5 -0
- package/dist/utils/eventUtils.d.ts +7 -0
- package/dist/utils/helpers.d.ts +2 -1
- package/dist/views/MonthView.d.ts +0 -2
- package/dist/views/WeekView.d.ts +0 -2
- package/package.json +1 -1
package/dist/types/core.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ViewSwitcherMode } from '../components/common/ViewHeader';
|
|
|
4
4
|
import { CalendarType, ThemeConfig, ThemeMode } from './calendarTypes';
|
|
5
5
|
import { CalendarRegistry } from '../core/calendarRegistry';
|
|
6
6
|
import { Locale } from '../locale/types';
|
|
7
|
+
import { MobileEventRenderer } from './mobileEvent';
|
|
7
8
|
/**
|
|
8
9
|
* View type enum
|
|
9
10
|
*/
|
|
@@ -48,11 +49,24 @@ export interface CalendarCallbacks {
|
|
|
48
49
|
onCalendarCreate?: (calendar: CalendarType) => void | Promise<void>;
|
|
49
50
|
onCalendarDelete?: (calendarId: string) => void | Promise<void>;
|
|
50
51
|
onCalendarMerge?: (sourceId: string, targetId: string) => void | Promise<void>;
|
|
52
|
+
onEventClick?: (event: Event) => void | Promise<void>;
|
|
53
|
+
onMoreEventsClick?: (date: Date) => void | Promise<void>;
|
|
51
54
|
}
|
|
52
55
|
export interface CreateCalendarDialogProps {
|
|
53
56
|
onClose: () => void;
|
|
54
57
|
onCreate: (calendar: CalendarType) => void;
|
|
55
58
|
}
|
|
59
|
+
export interface CalendarHeaderProps {
|
|
60
|
+
calendar: CalendarApp;
|
|
61
|
+
switcherMode?: ViewSwitcherMode;
|
|
62
|
+
onAddCalendar?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
63
|
+
onSearchChange?: (value: string) => void;
|
|
64
|
+
/** Triggered when search icon is clicked (typically on mobile) */
|
|
65
|
+
onSearchClick?: () => void;
|
|
66
|
+
searchValue?: string;
|
|
67
|
+
isSearchOpen?: boolean;
|
|
68
|
+
isEditable?: boolean;
|
|
69
|
+
}
|
|
56
70
|
/**
|
|
57
71
|
* Sidebar render props
|
|
58
72
|
*/
|
|
@@ -68,6 +82,7 @@ export interface CalendarSidebarRenderProps {
|
|
|
68
82
|
renderCreateCalendarDialog?: (props: CreateCalendarDialogProps) => React.ReactNode;
|
|
69
83
|
editingCalendarId?: string | null;
|
|
70
84
|
setEditingCalendarId?: (id: string | null) => void;
|
|
85
|
+
onCreateCalendar?: () => void;
|
|
71
86
|
}
|
|
72
87
|
/**
|
|
73
88
|
* Sidebar config
|
|
@@ -98,7 +113,17 @@ export interface CalendarAppConfig {
|
|
|
98
113
|
theme?: ThemeConfig;
|
|
99
114
|
useSidebar?: boolean | SidebarConfig;
|
|
100
115
|
useEventDetailDialog?: boolean;
|
|
116
|
+
useCalendarHeader?: boolean | ((props: CalendarHeaderProps) => React.ReactNode);
|
|
117
|
+
customMobileEventRenderer?: MobileEventRenderer;
|
|
101
118
|
locale?: string | Locale;
|
|
119
|
+
readOnly?: boolean | ReadOnlyConfig;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Read-only configuration
|
|
123
|
+
*/
|
|
124
|
+
export interface ReadOnlyConfig {
|
|
125
|
+
draggable?: boolean;
|
|
126
|
+
viewable?: boolean;
|
|
102
127
|
}
|
|
103
128
|
/**
|
|
104
129
|
* Calendar application state
|
|
@@ -114,6 +139,7 @@ export interface CalendarAppState {
|
|
|
114
139
|
sidebar?: SidebarConfig;
|
|
115
140
|
locale: string | Locale;
|
|
116
141
|
highlightedEventId?: string | null;
|
|
142
|
+
readOnly: boolean | ReadOnlyConfig;
|
|
117
143
|
}
|
|
118
144
|
/**
|
|
119
145
|
* Calendar application instance
|
|
@@ -121,6 +147,7 @@ export interface CalendarAppState {
|
|
|
121
147
|
*/
|
|
122
148
|
export interface CalendarApp {
|
|
123
149
|
state: CalendarAppState;
|
|
150
|
+
getReadOnlyConfig: () => ReadOnlyConfig;
|
|
124
151
|
changeView: (view: ViewType) => void;
|
|
125
152
|
getCurrentView: () => CalendarView;
|
|
126
153
|
setCurrentDate: (date: Date) => void;
|
|
@@ -134,6 +161,8 @@ export interface CalendarApp {
|
|
|
134
161
|
deleteEvent: (id: string) => void;
|
|
135
162
|
getEvents: () => Event[];
|
|
136
163
|
getAllEvents: () => Event[];
|
|
164
|
+
onEventClick: (event: Event) => void;
|
|
165
|
+
onMoreEventsClick: (date: Date) => void;
|
|
137
166
|
highlightEvent: (eventId: string | null) => void;
|
|
138
167
|
getCalendars: () => CalendarType[];
|
|
139
168
|
reorderCalendars: (fromIndex: number, toIndex: number) => void;
|
|
@@ -149,9 +178,12 @@ export interface CalendarApp {
|
|
|
149
178
|
hasPlugin: (name: string) => boolean;
|
|
150
179
|
render: () => React.ReactElement;
|
|
151
180
|
getSidebarConfig: () => SidebarConfig;
|
|
181
|
+
getCalendarHeaderConfig: () => boolean | ((props: CalendarHeaderProps) => React.ReactNode);
|
|
152
182
|
triggerRender: () => void;
|
|
153
183
|
getCalendarRegistry: () => CalendarRegistry;
|
|
154
184
|
getUseEventDetailDialog: () => boolean;
|
|
185
|
+
getCustomMobileEventRenderer: () => MobileEventRenderer | undefined;
|
|
186
|
+
updateConfig: (config: Partial<CalendarAppConfig>) => void;
|
|
155
187
|
setTheme: (mode: ThemeMode) => void;
|
|
156
188
|
getTheme: () => ThemeMode;
|
|
157
189
|
subscribeThemeChange: (callback: (theme: ThemeMode) => void) => (() => void);
|
|
@@ -185,6 +217,7 @@ export interface UseCalendarAppReturn {
|
|
|
185
217
|
setVisibleMonth: (date: Date) => void;
|
|
186
218
|
getVisibleMonth: () => Date;
|
|
187
219
|
sidebarConfig: SidebarConfig;
|
|
220
|
+
readOnlyConfig: ReadOnlyConfig;
|
|
188
221
|
}
|
|
189
222
|
/**
|
|
190
223
|
* Calendar configuration system type
|
|
@@ -53,6 +53,7 @@ export interface DragIndicatorProps {
|
|
|
53
53
|
getLineColor: (color: string) => string;
|
|
54
54
|
getDynamicPadding: (drag: DragRef) => string;
|
|
55
55
|
locale?: string;
|
|
56
|
+
isMobile?: boolean;
|
|
56
57
|
}
|
|
57
58
|
export interface DragIndicatorRenderer {
|
|
58
59
|
renderAllDayContent: (props: DragIndicatorProps) => React.ReactNode;
|
|
@@ -95,6 +96,7 @@ export interface useDragProps extends Partial<DragConfig> {
|
|
|
95
96
|
events: Event[];
|
|
96
97
|
renderer?: DragIndicatorRenderer;
|
|
97
98
|
app?: CalendarApp;
|
|
99
|
+
isMobile?: boolean;
|
|
98
100
|
}
|
|
99
101
|
export type MonthDragState = {
|
|
100
102
|
active: boolean;
|
|
@@ -118,9 +120,9 @@ export interface useDragReturn {
|
|
|
118
120
|
updateDragIndicator: (...args: (number | boolean | EventLayout | null | undefined)[]) => void;
|
|
119
121
|
removeDragIndicator: () => void;
|
|
120
122
|
handleCreateAllDayEvent?: (e: React.MouseEvent, dayIndex: number) => void;
|
|
121
|
-
handleCreateStart: (e: React.MouseEvent, ...args: (Date | number)[]) => void;
|
|
122
|
-
handleMoveStart: (e: React.MouseEvent, event: Event) => void;
|
|
123
|
-
handleResizeStart: (e: React.MouseEvent, event: Event, direction: string) => void;
|
|
123
|
+
handleCreateStart: (e: React.MouseEvent | React.TouchEvent, ...args: (Date | number)[]) => void;
|
|
124
|
+
handleMoveStart: (e: React.MouseEvent | React.TouchEvent, event: Event) => void;
|
|
125
|
+
handleResizeStart: (e: React.MouseEvent | React.TouchEvent, event: Event, direction: string) => void;
|
|
124
126
|
dragState: MonthDragState | WeekDayDragState;
|
|
125
127
|
isDragging: boolean;
|
|
126
128
|
pixelYToHour?: (y: number) => number;
|
package/dist/types/event.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Temporal } from 'temporal-polyfill';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
/**
|
|
3
4
|
* Calendar event interface (using Temporal API)
|
|
4
5
|
* Unified event data structure supporting single-day, cross-day, and all-day events
|
|
@@ -10,6 +11,7 @@ export interface Event {
|
|
|
10
11
|
start: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
11
12
|
end: Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime;
|
|
12
13
|
allDay?: boolean;
|
|
14
|
+
icon?: boolean | ReactNode;
|
|
13
15
|
calendarId?: string;
|
|
14
16
|
meta?: Record<string, any>;
|
|
15
17
|
day?: number;
|
package/dist/types/hook.d.ts
CHANGED
|
@@ -84,13 +84,13 @@ export interface UseDragManagerReturn {
|
|
|
84
84
|
* Drag handler Hook return value
|
|
85
85
|
*/
|
|
86
86
|
export interface UseDragHandlersReturn {
|
|
87
|
-
handleDragMove: (e: MouseEvent) => void;
|
|
88
|
-
handleDragEnd: (e: MouseEvent) => void;
|
|
89
|
-
handleCreateStart: (e: React.MouseEvent, ...args: (Date | number)[]) => void;
|
|
90
|
-
handleMoveStart: (e: React.MouseEvent, event: Event) => void;
|
|
91
|
-
handleResizeStart: (e: React.MouseEvent, event: Event, direction: string) => void;
|
|
92
|
-
handleUniversalDragMove: (e: MouseEvent) => void;
|
|
93
|
-
handleUniversalDragEnd: () => void;
|
|
87
|
+
handleDragMove: (e: MouseEvent | TouchEvent) => void;
|
|
88
|
+
handleDragEnd: (e: MouseEvent | TouchEvent) => void;
|
|
89
|
+
handleCreateStart: (e: React.MouseEvent | React.TouchEvent, ...args: (Date | number)[]) => void;
|
|
90
|
+
handleMoveStart: (e: React.MouseEvent | React.TouchEvent, event: Event) => void;
|
|
91
|
+
handleResizeStart: (e: React.MouseEvent | React.TouchEvent, event: Event, direction: string) => void;
|
|
92
|
+
handleUniversalDragMove: (e: MouseEvent | TouchEvent) => void;
|
|
93
|
+
handleUniversalDragEnd: (e?: MouseEvent | TouchEvent) => void;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Drag handler Hook parameters
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Event } from './event';
|
|
2
|
+
import { CalendarApp } from './core';
|
|
3
|
+
/**
|
|
4
|
+
* Mobile event drawer/dialog Props
|
|
5
|
+
*/
|
|
6
|
+
export interface MobileEventProps {
|
|
7
|
+
/** Whether the drawer/dialog is open */
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
/** Callback to close the drawer/dialog */
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
/** Callback to save the event (creates or updates) */
|
|
12
|
+
onSave: (event: Event) => void;
|
|
13
|
+
/** Current event data (newly created template or existing event) */
|
|
14
|
+
draftEvent: Event | null;
|
|
15
|
+
/** The CalendarApp instance providing built-in services */
|
|
16
|
+
app: CalendarApp;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Custom mobile event renderer (Drawer or Dialog)
|
|
20
|
+
*/
|
|
21
|
+
export type MobileEventRenderer = React.ComponentType<MobileEventProps>;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Event } from './event';
|
|
|
3
3
|
import { EventLayout } from './layout';
|
|
4
4
|
import { ViewType } from './core';
|
|
5
5
|
import { MonthDragState, WeekDayDragState } from './dragIndicator';
|
|
6
|
+
import { DragConfig } from './config';
|
|
6
7
|
/**
|
|
7
8
|
* Events service interface
|
|
8
9
|
* Provides various event management functions
|
|
@@ -33,7 +34,7 @@ export interface EventsPluginConfig {
|
|
|
33
34
|
/**
|
|
34
35
|
* Drag Hook options
|
|
35
36
|
*/
|
|
36
|
-
export interface DragHookOptions {
|
|
37
|
+
export interface DragHookOptions extends Partial<DragConfig> {
|
|
37
38
|
calendarRef: React.RefObject<HTMLDivElement | null>;
|
|
38
39
|
allDayRowRef?: React.RefObject<HTMLDivElement | null>;
|
|
39
40
|
viewType: ViewType;
|
|
@@ -44,14 +45,15 @@ export interface DragHookOptions {
|
|
|
44
45
|
events: Event[];
|
|
45
46
|
calculateNewEventLayout?: (dayIndex: number, startHour: number, endHour: number) => EventLayout | null;
|
|
46
47
|
calculateDragLayout?: (event: Event, targetDay: number, targetStartHour: number, targetEndHour: number) => EventLayout | null;
|
|
48
|
+
isMobile?: boolean;
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* Drag Hook return value
|
|
50
52
|
*/
|
|
51
53
|
export interface DragHookReturn {
|
|
52
|
-
handleMoveStart
|
|
53
|
-
handleCreateStart
|
|
54
|
-
handleResizeStart
|
|
54
|
+
handleMoveStart?: (e: React.MouseEvent | React.TouchEvent, event: Event) => void;
|
|
55
|
+
handleCreateStart?: (e: React.MouseEvent | React.TouchEvent, ...args: (Date | number)[]) => void;
|
|
56
|
+
handleResizeStart?: (e: React.MouseEvent | React.TouchEvent, event: Event, direction: string) => void;
|
|
55
57
|
handleCreateAllDayEvent?: (e: React.MouseEvent, dayIndex: number) => void;
|
|
56
58
|
dragState: MonthDragState | WeekDayDragState;
|
|
57
59
|
isDragging: boolean;
|
|
@@ -106,3 +106,10 @@ export declare const createEventWithPlainDateTime: (eventData: Omit<Event, "star
|
|
|
106
106
|
* Use when explicit timezone control is needed
|
|
107
107
|
*/
|
|
108
108
|
export declare const createEventWithZonedDateTime: (eventData: Omit<Event, "start" | "end">, weekStart: Date, timeZone: string) => Event;
|
|
109
|
+
/**
|
|
110
|
+
* Compare two events for equality
|
|
111
|
+
* @param event1 First event
|
|
112
|
+
* @param event2 Second event
|
|
113
|
+
* @returns Whether events are equal in content
|
|
114
|
+
*/
|
|
115
|
+
export declare const isEventEqual: (event1: Event | null, event2: Event | null) => boolean;
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { TIME_STEP, formatTime, formatEventTimeRange, roundToTimeStep, getEventE
|
|
|
21
21
|
export { weekDays, weekDaysFullName, monthNames, shortMonthNames, } from './dateConstants';
|
|
22
22
|
export { getWeekRange, getCurrentWeekDates } from './dateRangeUtils';
|
|
23
23
|
export { generateDayData, generateWeekData, getMonthYearOfWeek, generateWeeksData, generateWeekRange, } from './calendarDataUtils';
|
|
24
|
-
export { getEventsForDay, getAllDayEventsForDay, getDateByDayIndex, updateEventDateAndDay, createEventWithDate, calculateDayIndex, isEventInWeek, recalculateEventDays, getDayIndexByDate, getEventsForWeek, createEventWithRealDate, updateEventWithRealDate, } from './eventUtils';
|
|
24
|
+
export { getEventsForDay, getAllDayEventsForDay, getDateByDayIndex, updateEventDateAndDay, createEventWithDate, calculateDayIndex, isEventInWeek, recalculateEventDays, getDayIndexByDate, getEventsForWeek, createEventWithRealDate, updateEventWithRealDate, isEventEqual, } from './eventUtils';
|
|
25
25
|
export { getTestEvents } from './testDataUtils';
|
|
26
26
|
export { generateUniKey } from './utilityFunctions';
|
|
27
|
+
export { isDeepEqual } from './compareUtils';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CalendarApp } from '@/core';
|
|
3
3
|
import { EventDetailContentRenderer, EventDetailDialogRenderer } from '@/types';
|
|
4
|
-
import { ViewSwitcherMode } from '@/components/common/ViewHeader';
|
|
5
4
|
interface MonthViewProps {
|
|
6
5
|
app: CalendarApp;
|
|
7
6
|
customDetailPanelContent?: EventDetailContentRenderer;
|
|
8
7
|
customEventDetailDialog?: EventDetailDialogRenderer;
|
|
9
8
|
calendarRef: React.RefObject<HTMLDivElement>;
|
|
10
|
-
switcherMode?: ViewSwitcherMode;
|
|
11
9
|
}
|
|
12
10
|
declare const MonthView: React.FC<MonthViewProps>;
|
|
13
11
|
export default MonthView;
|
package/dist/views/WeekView.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CalendarApp } from '@/core';
|
|
3
3
|
import { EventDetailContentRenderer, EventDetailDialogRenderer } from '@/types';
|
|
4
|
-
import { ViewSwitcherMode } from '@/components/common/ViewHeader';
|
|
5
4
|
interface WeekViewProps {
|
|
6
5
|
app: CalendarApp;
|
|
7
6
|
customDetailPanelContent?: EventDetailContentRenderer;
|
|
8
7
|
customEventDetailDialog?: EventDetailDialogRenderer;
|
|
9
8
|
calendarRef: React.RefObject<HTMLDivElement>;
|
|
10
|
-
switcherMode?: ViewSwitcherMode;
|
|
11
9
|
}
|
|
12
10
|
declare const WeekView: React.FC<WeekViewProps>;
|
|
13
11
|
export default WeekView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dayflow/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A flexible and feature-rich calendar component library for React applications with drag-and-drop support, multiple views (Day, Week, Month, Year), and plugin architecture",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|