@omidrahmati/react-slot-scheduler 1.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.
@@ -0,0 +1,217 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type CalendarViewMode = 'day' | 'week';
4
+ type SchedulerMode = 'time-grid' | 'task-timeline' | 'resource-planner';
5
+ type SlotStatus = 'available' | 'booked' | 'blocked' | 'outside' | 'custom';
6
+ interface CalendarSlot {
7
+ startTime: string;
8
+ endTime: string;
9
+ status: SlotStatus;
10
+ itemId?: string;
11
+ /** @deprecated Use itemId */
12
+ bookingId?: string;
13
+ title?: string;
14
+ description?: string;
15
+ }
16
+ interface DaySchedule {
17
+ date: string;
18
+ isWorkingDay: boolean;
19
+ workStartTime?: string;
20
+ workEndTime?: string;
21
+ slots: CalendarSlot[];
22
+ }
23
+ interface TaskTimelineItem {
24
+ id: string;
25
+ date: string;
26
+ endDate?: string;
27
+ startTime: string;
28
+ endTime: string;
29
+ title: string;
30
+ status?: SlotStatus;
31
+ description?: string;
32
+ assignee?: string;
33
+ progress?: number;
34
+ resourceId?: string;
35
+ meta?: Record<string, unknown>;
36
+ }
37
+ interface ResourcePlannerItem {
38
+ id: string;
39
+ date: string;
40
+ startTime: string;
41
+ endTime: string;
42
+ resourceId: string;
43
+ title: string;
44
+ status?: SlotStatus;
45
+ description?: string;
46
+ meta?: Record<string, unknown>;
47
+ }
48
+ interface ResourceDefinition {
49
+ id: string;
50
+ title: string;
51
+ meta?: Record<string, unknown>;
52
+ }
53
+ interface GanttRow {
54
+ id: string;
55
+ label: string;
56
+ subLabel?: string;
57
+ color?: string;
58
+ }
59
+ interface GanttItem {
60
+ id: string;
61
+ rowId: string;
62
+ date: string;
63
+ endDate?: string;
64
+ startTime: string;
65
+ endTime: string;
66
+ title: string;
67
+ subTitle?: string;
68
+ status: SlotStatus;
69
+ }
70
+ interface GanttMovePayload {
71
+ item: GanttItem;
72
+ newRowId: string;
73
+ newStartTime: string;
74
+ newEndTime: string;
75
+ newDate: string;
76
+ newEndDate?: string;
77
+ }
78
+ interface GanttResizePayload {
79
+ item: GanttItem;
80
+ newStartTime: string;
81
+ newEndTime: string;
82
+ }
83
+ interface GanttCreatePayload {
84
+ rowId: string;
85
+ date: string;
86
+ endDate?: string;
87
+ startTime: string;
88
+ endTime: string;
89
+ }
90
+ type GanttTimeUnit = 'hour' | 'day';
91
+ type GanttScale = 'day' | 'week' | 'month';
92
+ interface GanttDataAdapter<TData = unknown> {
93
+ toGantt: (input: TData, options: {
94
+ date: Date;
95
+ locale: string;
96
+ }) => {
97
+ rows: GanttRow[];
98
+ items: GanttItem[];
99
+ timeStart: number;
100
+ timeEnd: number;
101
+ granularity: number;
102
+ timeUnit: GanttTimeUnit;
103
+ scale?: GanttScale;
104
+ };
105
+ }
106
+ interface SchedulerDataAdapter<TData = unknown> {
107
+ toSchedules: (input: TData) => DaySchedule[];
108
+ toGantt?: never;
109
+ }
110
+ interface SlotMovePayload {
111
+ slot: CalendarSlot;
112
+ from: {
113
+ date: string;
114
+ startTime: string;
115
+ endTime: string;
116
+ };
117
+ to: {
118
+ date: string;
119
+ startTime: string;
120
+ endTime: string;
121
+ };
122
+ }
123
+ interface SlotConflictPayload extends SlotMovePayload {
124
+ reason: 'overlap' | 'blocked-by-policy';
125
+ conflictingSlot?: CalendarSlot;
126
+ }
127
+ interface CalendarTheme {
128
+ primary: string;
129
+ bg: string;
130
+ panel: string;
131
+ border: string;
132
+ text: string;
133
+ mutedText: string;
134
+ availableBg: string;
135
+ bookedBg: string;
136
+ blockedBg: string;
137
+ customBg: string;
138
+ }
139
+ interface BookingCalendarProps {
140
+ value: Date;
141
+ onChange: (date: Date) => void;
142
+ schedules: DaySchedule[];
143
+ mode?: SchedulerMode;
144
+ dataAdapter?: SchedulerDataAdapter<any> | GanttDataAdapter<any>;
145
+ ganttTimeUnit?: GanttTimeUnit;
146
+ ganttScale?: GanttScale;
147
+ dataSource?: unknown;
148
+ resources?: ResourceDefinition[];
149
+ viewMode?: CalendarViewMode;
150
+ onViewModeChange?: (mode: CalendarViewMode) => void;
151
+ onSlotClick?: (date: string, slot: CalendarSlot) => void;
152
+ onItemClick?: (itemId: string) => void;
153
+ /** @deprecated Use onItemClick */
154
+ onBookingClick?: (bookingId: string) => void;
155
+ onSlotMove?: (payload: SlotMovePayload) => void;
156
+ onGanttItemMove?: (payload: GanttMovePayload) => void;
157
+ onGanttItemResize?: (payload: GanttResizePayload) => void;
158
+ onGanttItemCreate?: (payload: GanttCreatePayload) => void;
159
+ onBeforeSlotMove?: (payload: SlotMovePayload) => boolean | Promise<boolean>;
160
+ onSlotConflict?: (payload: SlotConflictPayload) => void;
161
+ draggableSlots?: boolean;
162
+ selectionMode?: boolean;
163
+ selectedSlots?: Array<{
164
+ date: string;
165
+ startTime: string;
166
+ endTime: string;
167
+ }>;
168
+ onSelectionChange?: (slots: Array<{
169
+ date: string;
170
+ startTime: string;
171
+ endTime: string;
172
+ }>) => void;
173
+ onSlotDragSelectStart?: (slot: {
174
+ date: string;
175
+ startTime: string;
176
+ endTime: string;
177
+ }) => void;
178
+ onSlotDragSelectMove?: (slot: {
179
+ date: string;
180
+ startTime: string;
181
+ endTime: string;
182
+ }) => void;
183
+ onSlotDragSelectEnd?: (slots: Array<{
184
+ date: string;
185
+ startTime: string;
186
+ endTime: string;
187
+ }>) => void;
188
+ isSlotSelected?: (slot: {
189
+ date: string;
190
+ startTime: string;
191
+ endTime: string;
192
+ }) => boolean;
193
+ slotGranularity?: number;
194
+ locale?: string;
195
+ weekStartsOn?: 0 | 1 | 6;
196
+ direction?: 'rtl' | 'ltr' | 'auto';
197
+ translations?: Partial<{
198
+ previous: string;
199
+ today: string;
200
+ next: string;
201
+ day: string;
202
+ week: string;
203
+ }>;
204
+ theme?: Partial<CalendarTheme>;
205
+ hideTimeColumn?: boolean;
206
+ className?: string;
207
+ }
208
+ type SlotCalendarProps = BookingCalendarProps;
209
+
210
+ declare function BookingCalendar({ value, onChange, schedules, mode: schedulerMode, dataAdapter, dataSource, ganttTimeUnit, ganttScale, viewMode, onViewModeChange, onSlotClick, onItemClick, onBookingClick, onSlotMove, onGanttItemMove, onGanttItemResize, onGanttItemCreate, onBeforeSlotMove, onSlotConflict, draggableSlots, selectionMode, selectedSlots, onSelectionChange, onSlotDragSelectStart, onSlotDragSelectMove, onSlotDragSelectEnd, isSlotSelected, slotGranularity, locale, weekStartsOn, direction, translations, theme, hideTimeColumn, className }: BookingCalendarProps): react_jsx_runtime.JSX.Element;
211
+
212
+ declare function createTaskTimelineAdapter(): GanttDataAdapter<TaskTimelineItem[]>;
213
+ declare function createResourcePlannerAdapter(resources: ResourceDefinition[]): GanttDataAdapter<ResourcePlannerItem[]>;
214
+
215
+ declare const defaultTheme: CalendarTheme;
216
+
217
+ export { BookingCalendar, BookingCalendar as BookingCalendarDefault, type BookingCalendarProps, type CalendarSlot, type CalendarTheme, type CalendarViewMode, type DaySchedule, type GanttCreatePayload, type GanttDataAdapter, type GanttItem, type GanttMovePayload, type GanttResizePayload, type GanttRow, type GanttScale, type GanttTimeUnit, type ResourceDefinition, type ResourcePlannerItem, type SchedulerDataAdapter, type SchedulerMode, BookingCalendar as SlotCalendar, type SlotCalendarProps, type SlotConflictPayload, type SlotMovePayload, BookingCalendar as SlotScheduler, type SlotStatus, type TaskTimelineItem, createResourcePlannerAdapter, createTaskTimelineAdapter, defaultTheme };
@@ -0,0 +1,217 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type CalendarViewMode = 'day' | 'week';
4
+ type SchedulerMode = 'time-grid' | 'task-timeline' | 'resource-planner';
5
+ type SlotStatus = 'available' | 'booked' | 'blocked' | 'outside' | 'custom';
6
+ interface CalendarSlot {
7
+ startTime: string;
8
+ endTime: string;
9
+ status: SlotStatus;
10
+ itemId?: string;
11
+ /** @deprecated Use itemId */
12
+ bookingId?: string;
13
+ title?: string;
14
+ description?: string;
15
+ }
16
+ interface DaySchedule {
17
+ date: string;
18
+ isWorkingDay: boolean;
19
+ workStartTime?: string;
20
+ workEndTime?: string;
21
+ slots: CalendarSlot[];
22
+ }
23
+ interface TaskTimelineItem {
24
+ id: string;
25
+ date: string;
26
+ endDate?: string;
27
+ startTime: string;
28
+ endTime: string;
29
+ title: string;
30
+ status?: SlotStatus;
31
+ description?: string;
32
+ assignee?: string;
33
+ progress?: number;
34
+ resourceId?: string;
35
+ meta?: Record<string, unknown>;
36
+ }
37
+ interface ResourcePlannerItem {
38
+ id: string;
39
+ date: string;
40
+ startTime: string;
41
+ endTime: string;
42
+ resourceId: string;
43
+ title: string;
44
+ status?: SlotStatus;
45
+ description?: string;
46
+ meta?: Record<string, unknown>;
47
+ }
48
+ interface ResourceDefinition {
49
+ id: string;
50
+ title: string;
51
+ meta?: Record<string, unknown>;
52
+ }
53
+ interface GanttRow {
54
+ id: string;
55
+ label: string;
56
+ subLabel?: string;
57
+ color?: string;
58
+ }
59
+ interface GanttItem {
60
+ id: string;
61
+ rowId: string;
62
+ date: string;
63
+ endDate?: string;
64
+ startTime: string;
65
+ endTime: string;
66
+ title: string;
67
+ subTitle?: string;
68
+ status: SlotStatus;
69
+ }
70
+ interface GanttMovePayload {
71
+ item: GanttItem;
72
+ newRowId: string;
73
+ newStartTime: string;
74
+ newEndTime: string;
75
+ newDate: string;
76
+ newEndDate?: string;
77
+ }
78
+ interface GanttResizePayload {
79
+ item: GanttItem;
80
+ newStartTime: string;
81
+ newEndTime: string;
82
+ }
83
+ interface GanttCreatePayload {
84
+ rowId: string;
85
+ date: string;
86
+ endDate?: string;
87
+ startTime: string;
88
+ endTime: string;
89
+ }
90
+ type GanttTimeUnit = 'hour' | 'day';
91
+ type GanttScale = 'day' | 'week' | 'month';
92
+ interface GanttDataAdapter<TData = unknown> {
93
+ toGantt: (input: TData, options: {
94
+ date: Date;
95
+ locale: string;
96
+ }) => {
97
+ rows: GanttRow[];
98
+ items: GanttItem[];
99
+ timeStart: number;
100
+ timeEnd: number;
101
+ granularity: number;
102
+ timeUnit: GanttTimeUnit;
103
+ scale?: GanttScale;
104
+ };
105
+ }
106
+ interface SchedulerDataAdapter<TData = unknown> {
107
+ toSchedules: (input: TData) => DaySchedule[];
108
+ toGantt?: never;
109
+ }
110
+ interface SlotMovePayload {
111
+ slot: CalendarSlot;
112
+ from: {
113
+ date: string;
114
+ startTime: string;
115
+ endTime: string;
116
+ };
117
+ to: {
118
+ date: string;
119
+ startTime: string;
120
+ endTime: string;
121
+ };
122
+ }
123
+ interface SlotConflictPayload extends SlotMovePayload {
124
+ reason: 'overlap' | 'blocked-by-policy';
125
+ conflictingSlot?: CalendarSlot;
126
+ }
127
+ interface CalendarTheme {
128
+ primary: string;
129
+ bg: string;
130
+ panel: string;
131
+ border: string;
132
+ text: string;
133
+ mutedText: string;
134
+ availableBg: string;
135
+ bookedBg: string;
136
+ blockedBg: string;
137
+ customBg: string;
138
+ }
139
+ interface BookingCalendarProps {
140
+ value: Date;
141
+ onChange: (date: Date) => void;
142
+ schedules: DaySchedule[];
143
+ mode?: SchedulerMode;
144
+ dataAdapter?: SchedulerDataAdapter<any> | GanttDataAdapter<any>;
145
+ ganttTimeUnit?: GanttTimeUnit;
146
+ ganttScale?: GanttScale;
147
+ dataSource?: unknown;
148
+ resources?: ResourceDefinition[];
149
+ viewMode?: CalendarViewMode;
150
+ onViewModeChange?: (mode: CalendarViewMode) => void;
151
+ onSlotClick?: (date: string, slot: CalendarSlot) => void;
152
+ onItemClick?: (itemId: string) => void;
153
+ /** @deprecated Use onItemClick */
154
+ onBookingClick?: (bookingId: string) => void;
155
+ onSlotMove?: (payload: SlotMovePayload) => void;
156
+ onGanttItemMove?: (payload: GanttMovePayload) => void;
157
+ onGanttItemResize?: (payload: GanttResizePayload) => void;
158
+ onGanttItemCreate?: (payload: GanttCreatePayload) => void;
159
+ onBeforeSlotMove?: (payload: SlotMovePayload) => boolean | Promise<boolean>;
160
+ onSlotConflict?: (payload: SlotConflictPayload) => void;
161
+ draggableSlots?: boolean;
162
+ selectionMode?: boolean;
163
+ selectedSlots?: Array<{
164
+ date: string;
165
+ startTime: string;
166
+ endTime: string;
167
+ }>;
168
+ onSelectionChange?: (slots: Array<{
169
+ date: string;
170
+ startTime: string;
171
+ endTime: string;
172
+ }>) => void;
173
+ onSlotDragSelectStart?: (slot: {
174
+ date: string;
175
+ startTime: string;
176
+ endTime: string;
177
+ }) => void;
178
+ onSlotDragSelectMove?: (slot: {
179
+ date: string;
180
+ startTime: string;
181
+ endTime: string;
182
+ }) => void;
183
+ onSlotDragSelectEnd?: (slots: Array<{
184
+ date: string;
185
+ startTime: string;
186
+ endTime: string;
187
+ }>) => void;
188
+ isSlotSelected?: (slot: {
189
+ date: string;
190
+ startTime: string;
191
+ endTime: string;
192
+ }) => boolean;
193
+ slotGranularity?: number;
194
+ locale?: string;
195
+ weekStartsOn?: 0 | 1 | 6;
196
+ direction?: 'rtl' | 'ltr' | 'auto';
197
+ translations?: Partial<{
198
+ previous: string;
199
+ today: string;
200
+ next: string;
201
+ day: string;
202
+ week: string;
203
+ }>;
204
+ theme?: Partial<CalendarTheme>;
205
+ hideTimeColumn?: boolean;
206
+ className?: string;
207
+ }
208
+ type SlotCalendarProps = BookingCalendarProps;
209
+
210
+ declare function BookingCalendar({ value, onChange, schedules, mode: schedulerMode, dataAdapter, dataSource, ganttTimeUnit, ganttScale, viewMode, onViewModeChange, onSlotClick, onItemClick, onBookingClick, onSlotMove, onGanttItemMove, onGanttItemResize, onGanttItemCreate, onBeforeSlotMove, onSlotConflict, draggableSlots, selectionMode, selectedSlots, onSelectionChange, onSlotDragSelectStart, onSlotDragSelectMove, onSlotDragSelectEnd, isSlotSelected, slotGranularity, locale, weekStartsOn, direction, translations, theme, hideTimeColumn, className }: BookingCalendarProps): react_jsx_runtime.JSX.Element;
211
+
212
+ declare function createTaskTimelineAdapter(): GanttDataAdapter<TaskTimelineItem[]>;
213
+ declare function createResourcePlannerAdapter(resources: ResourceDefinition[]): GanttDataAdapter<ResourcePlannerItem[]>;
214
+
215
+ declare const defaultTheme: CalendarTheme;
216
+
217
+ export { BookingCalendar, BookingCalendar as BookingCalendarDefault, type BookingCalendarProps, type CalendarSlot, type CalendarTheme, type CalendarViewMode, type DaySchedule, type GanttCreatePayload, type GanttDataAdapter, type GanttItem, type GanttMovePayload, type GanttResizePayload, type GanttRow, type GanttScale, type GanttTimeUnit, type ResourceDefinition, type ResourcePlannerItem, type SchedulerDataAdapter, type SchedulerMode, BookingCalendar as SlotCalendar, type SlotCalendarProps, type SlotConflictPayload, type SlotMovePayload, BookingCalendar as SlotScheduler, type SlotStatus, type TaskTimelineItem, createResourcePlannerAdapter, createTaskTimelineAdapter, defaultTheme };