@isma91/react-scheduler 4.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/.github/workflows/publish.yml +29 -0
- package/.github/workflows/tests.yml +35 -0
- package/.gitignore +32 -0
- package/.husky/pre-commit +2 -0
- package/.prettierignore +1 -0
- package/.prettierrc.json +7 -0
- package/.yarnrc.yml +1 -0
- package/LICENSE +24 -0
- package/README.md +172 -0
- package/dist/LICENSE +24 -0
- package/dist/README.md +172 -0
- package/dist/SchedulerComponent.d.ts +3 -0
- package/dist/components/common/Cell.d.ts +13 -0
- package/dist/components/common/LocaleArrow.d.ts +8 -0
- package/dist/components/common/ResourceHeader.d.ts +6 -0
- package/dist/components/common/Tabs.d.ts +16 -0
- package/dist/components/common/TodayTypo.d.ts +8 -0
- package/dist/components/common/WithResources.d.ts +6 -0
- package/dist/components/events/Actions.d.ts +8 -0
- package/dist/components/events/AgendaEventsList.d.ts +7 -0
- package/dist/components/events/CurrentTimeBar.d.ts +11 -0
- package/dist/components/events/EmptyAgenda.d.ts +2 -0
- package/dist/components/events/EventItem.d.ts +10 -0
- package/dist/components/events/EventItemPopover.d.ts +9 -0
- package/dist/components/events/MonthEvents.d.ts +13 -0
- package/dist/components/events/TodayEvents.d.ts +16 -0
- package/dist/components/hoc/DateProvider.d.ts +5 -0
- package/dist/components/inputs/DatePicker.d.ts +14 -0
- package/dist/components/inputs/Input.d.ts +19 -0
- package/dist/components/inputs/SelectInput.d.ts +22 -0
- package/dist/components/month/MonthTable.d.ts +8 -0
- package/dist/components/nav/DayDateBtn.d.ts +6 -0
- package/dist/components/nav/MonthDateBtn.d.ts +6 -0
- package/dist/components/nav/Navigation.d.ts +3 -0
- package/dist/components/nav/WeekDateBtn.d.ts +8 -0
- package/dist/components/week/WeekTable.d.ts +11 -0
- package/dist/helpers/constants.d.ts +4 -0
- package/dist/helpers/generals.d.ts +78 -0
- package/dist/hooks/useArrowDisable.d.ts +5 -0
- package/dist/hooks/useCellAttributes.d.ts +18 -0
- package/dist/hooks/useDragAttributes.d.ts +10 -0
- package/dist/hooks/useEventPermissions.d.ts +7 -0
- package/dist/hooks/useStore.d.ts +2 -0
- package/dist/hooks/useSyncScroll.d.ts +8 -0
- package/dist/hooks/useWindowResize.d.ts +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2853 -0
- package/dist/package.json +65 -0
- package/dist/positionManger/context.d.ts +14 -0
- package/dist/positionManger/provider.d.ts +5 -0
- package/dist/positionManger/usePosition.d.ts +4 -0
- package/dist/store/context.d.ts +2 -0
- package/dist/store/default.d.ts +245 -0
- package/dist/store/provider.d.ts +7 -0
- package/dist/store/types.d.ts +27 -0
- package/dist/styles/styles.d.ts +30 -0
- package/dist/types.d.ts +372 -0
- package/dist/views/Day.d.ts +2 -0
- package/dist/views/DayAgenda.d.ts +7 -0
- package/dist/views/Editor.d.ts +11 -0
- package/dist/views/Month.d.ts +2 -0
- package/dist/views/MonthAgenda.d.ts +7 -0
- package/dist/views/Week.d.ts +2 -0
- package/dist/views/WeekAgenda.d.ts +8 -0
- package/eslint.config.js +79 -0
- package/index.html +41 -0
- package/jest.config.ts +194 -0
- package/package.json +137 -0
- package/public/favicon.ico +0 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/scripts/post-pack.js +34 -0
- package/src/App.tsx +25 -0
- package/src/Page1.tsx +67 -0
- package/src/events.tsx +227 -0
- package/src/index.tsx +21 -0
- package/src/lib/SchedulerComponent.tsx +78 -0
- package/src/lib/__tests__/index.test.tsx +24 -0
- package/src/lib/components/common/Cell.tsx +52 -0
- package/src/lib/components/common/LocaleArrow.tsx +38 -0
- package/src/lib/components/common/ResourceHeader.tsx +73 -0
- package/src/lib/components/common/Tabs.tsx +119 -0
- package/src/lib/components/common/TodayTypo.tsx +44 -0
- package/src/lib/components/common/WithResources.tsx +98 -0
- package/src/lib/components/events/Actions.tsx +65 -0
- package/src/lib/components/events/AgendaEventsList.tsx +115 -0
- package/src/lib/components/events/CurrentTimeBar.tsx +59 -0
- package/src/lib/components/events/EmptyAgenda.tsx +27 -0
- package/src/lib/components/events/EventItem.tsx +180 -0
- package/src/lib/components/events/EventItemPopover.tsx +179 -0
- package/src/lib/components/events/MonthEvents.tsx +141 -0
- package/src/lib/components/events/TodayEvents.tsx +99 -0
- package/src/lib/components/hoc/DateProvider.tsx +19 -0
- package/src/lib/components/inputs/DatePicker.tsx +95 -0
- package/src/lib/components/inputs/Input.tsx +113 -0
- package/src/lib/components/inputs/SelectInput.tsx +164 -0
- package/src/lib/components/month/MonthTable.tsx +207 -0
- package/src/lib/components/nav/DayDateBtn.tsx +77 -0
- package/src/lib/components/nav/MonthDateBtn.tsx +80 -0
- package/src/lib/components/nav/Navigation.tsx +201 -0
- package/src/lib/components/nav/WeekDateBtn.tsx +89 -0
- package/src/lib/components/week/WeekTable.tsx +229 -0
- package/src/lib/helpers/constants.ts +4 -0
- package/src/lib/helpers/generals.tsx +354 -0
- package/src/lib/hooks/useArrowDisable.ts +26 -0
- package/src/lib/hooks/useCellAttributes.ts +67 -0
- package/src/lib/hooks/useDragAttributes.ts +31 -0
- package/src/lib/hooks/useEventPermissions.ts +42 -0
- package/src/lib/hooks/useStore.ts +8 -0
- package/src/lib/hooks/useSyncScroll.ts +31 -0
- package/src/lib/hooks/useWindowResize.ts +37 -0
- package/src/lib/index.tsx +14 -0
- package/src/lib/positionManger/context.ts +14 -0
- package/src/lib/positionManger/provider.tsx +113 -0
- package/src/lib/positionManger/usePosition.ts +8 -0
- package/src/lib/store/context.ts +5 -0
- package/src/lib/store/default.ts +157 -0
- package/src/lib/store/provider.tsx +211 -0
- package/src/lib/store/types.ts +33 -0
- package/src/lib/styles/styles.ts +256 -0
- package/src/lib/types.ts +423 -0
- package/src/lib/views/Day.tsx +265 -0
- package/src/lib/views/DayAgenda.tsx +57 -0
- package/src/lib/views/Editor.tsx +258 -0
- package/src/lib/views/Month.tsx +82 -0
- package/src/lib/views/MonthAgenda.tsx +84 -0
- package/src/lib/views/Week.tsx +92 -0
- package/src/lib/views/WeekAgenda.tsx +81 -0
- package/src/vite-env.d.ts +3 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +27 -0
- package/vite.config.js +40 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { DialogProps, GridSize } from '@mui/material';
|
|
2
|
+
import { DateCalendarProps } from '@mui/x-date-pickers';
|
|
3
|
+
import { Locale } from 'date-fns';
|
|
4
|
+
import { DragEvent } from 'react';
|
|
5
|
+
import { SelectOption } from './components/inputs/SelectInput';
|
|
6
|
+
import { View } from './components/nav/Navigation';
|
|
7
|
+
import { Store } from './store/types';
|
|
8
|
+
import { StateItem } from './views/Editor';
|
|
9
|
+
import { RRule } from 'rrule';
|
|
10
|
+
export type DayHours = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;
|
|
11
|
+
export type WeekDays = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
12
|
+
interface CommonWeekViewProps {
|
|
13
|
+
weekDays: WeekDays[];
|
|
14
|
+
weekStartOn: WeekDays;
|
|
15
|
+
disableGoToDay?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface CommonViewProps {
|
|
18
|
+
startHour: DayHours;
|
|
19
|
+
endHour: DayHours;
|
|
20
|
+
cellRenderer?(props: CellRenderedProps): React.ReactNode;
|
|
21
|
+
headRenderer?(props: {
|
|
22
|
+
day: Date;
|
|
23
|
+
events: ProcessedEvent[];
|
|
24
|
+
resource?: DefaultResource;
|
|
25
|
+
}): React.ReactNode;
|
|
26
|
+
navigation?: boolean;
|
|
27
|
+
step: number;
|
|
28
|
+
}
|
|
29
|
+
export interface MonthProps extends CommonWeekViewProps, CommonViewProps {
|
|
30
|
+
}
|
|
31
|
+
export interface WeekProps extends CommonWeekViewProps, CommonViewProps {
|
|
32
|
+
hourRenderer?(hour: string): React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export interface DayProps extends CommonViewProps {
|
|
35
|
+
hourRenderer?(hour: string): React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
export interface CellRenderedProps {
|
|
38
|
+
day: Date;
|
|
39
|
+
start: Date;
|
|
40
|
+
end: Date;
|
|
41
|
+
height: number;
|
|
42
|
+
onClick(): void;
|
|
43
|
+
onDragOver(e: DragEvent<HTMLButtonElement>): void;
|
|
44
|
+
onDragEnter(e: DragEvent<HTMLButtonElement>): void;
|
|
45
|
+
onDragLeave(e: DragEvent<HTMLButtonElement>): void;
|
|
46
|
+
onDrop(e: DragEvent<HTMLButtonElement>): void;
|
|
47
|
+
}
|
|
48
|
+
interface CalendarEvent {
|
|
49
|
+
event_id: number | string;
|
|
50
|
+
title: React.ReactNode;
|
|
51
|
+
subtitle?: React.ReactNode;
|
|
52
|
+
start: Date;
|
|
53
|
+
end: Date;
|
|
54
|
+
recurring?: RRule;
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
color?: string;
|
|
57
|
+
textColor?: string;
|
|
58
|
+
editable?: boolean;
|
|
59
|
+
deletable?: boolean;
|
|
60
|
+
draggable?: boolean;
|
|
61
|
+
allDay?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* @default " "
|
|
64
|
+
* passed as a children to mui <Avatar /> component
|
|
65
|
+
*/
|
|
66
|
+
agendaAvatar?: React.ReactElement | string;
|
|
67
|
+
/** @internal Original start date before segment clipping */
|
|
68
|
+
_originalStart?: Date;
|
|
69
|
+
/** @internal Original end date before segment clipping */
|
|
70
|
+
_originalEnd?: Date;
|
|
71
|
+
/** @internal Segment continues from previous day */
|
|
72
|
+
_hasPrev?: boolean;
|
|
73
|
+
/** @internal Segment continues to next day */
|
|
74
|
+
_hasNext?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface Translations {
|
|
77
|
+
navigation: Record<View, string> & {
|
|
78
|
+
today: string;
|
|
79
|
+
agenda: string;
|
|
80
|
+
};
|
|
81
|
+
form: {
|
|
82
|
+
addTitle: string;
|
|
83
|
+
editTitle: string;
|
|
84
|
+
confirm: string;
|
|
85
|
+
delete: string;
|
|
86
|
+
cancel: string;
|
|
87
|
+
};
|
|
88
|
+
event: Record<string, string> & {
|
|
89
|
+
title: string;
|
|
90
|
+
subtitle: string;
|
|
91
|
+
start: string;
|
|
92
|
+
end: string;
|
|
93
|
+
allDay: string;
|
|
94
|
+
};
|
|
95
|
+
validation?: {
|
|
96
|
+
required?: string;
|
|
97
|
+
invalidEmail?: string;
|
|
98
|
+
onlyNumbers?: string;
|
|
99
|
+
min?: string | ((min: number) => string);
|
|
100
|
+
max?: string | ((max: number) => string);
|
|
101
|
+
};
|
|
102
|
+
moreEvents: string;
|
|
103
|
+
noDataToDisplay: string;
|
|
104
|
+
loading: string;
|
|
105
|
+
}
|
|
106
|
+
export type InputTypes = "input" | "date" | "select" | "hidden";
|
|
107
|
+
export interface EventRendererProps extends Pick<React.HTMLAttributes<HTMLElement>, "draggable" | "onDragStart" | "onDragEnd" | "onDragOver" | "onDragEnter" | "onClick"> {
|
|
108
|
+
event: ProcessedEvent;
|
|
109
|
+
}
|
|
110
|
+
export interface FieldInputProps {
|
|
111
|
+
/** Available to all InputTypes */
|
|
112
|
+
label?: string;
|
|
113
|
+
/** Available to all InputTypes */
|
|
114
|
+
placeholder?: string;
|
|
115
|
+
/** Available to all InputTypes
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
required?: boolean;
|
|
119
|
+
/** Available to all InputTypes
|
|
120
|
+
* @default "outline"
|
|
121
|
+
*/
|
|
122
|
+
variant?: "standard" | "filled" | "outlined";
|
|
123
|
+
/** Available to all InputTypes */
|
|
124
|
+
disabled?: boolean;
|
|
125
|
+
/** Available when @input="text" ONLY - Minimum length */
|
|
126
|
+
min?: number;
|
|
127
|
+
/** Available when @input="text" ONLY - Maximum length */
|
|
128
|
+
max?: number;
|
|
129
|
+
/** Available when @input="text" ONLY - Apply email Regex */
|
|
130
|
+
email?: boolean;
|
|
131
|
+
/** Available when @input="text" ONLY - Only numbers(int/float) allowed */
|
|
132
|
+
decimal?: boolean;
|
|
133
|
+
/** Available when @input="text" ONLY - Allow Multiline input. Use @rows property to set initial rows height */
|
|
134
|
+
multiline?: boolean;
|
|
135
|
+
/** Available when @input="text" ONLY - initial rows height*/
|
|
136
|
+
rows?: number;
|
|
137
|
+
/** Available when @input="date" ONLY
|
|
138
|
+
* @default "datetime"
|
|
139
|
+
*/
|
|
140
|
+
type?: "date" | "datetime";
|
|
141
|
+
/** Available when @input="select" ONLY - Multi-Select input style.
|
|
142
|
+
* if you use "default" property with this, make sure your "default" property is an instance of Array
|
|
143
|
+
*/
|
|
144
|
+
multiple?: "chips" | "default";
|
|
145
|
+
/** Available when @input="select" ONLY - display loading spinner instead of expand arrow */
|
|
146
|
+
loading?: boolean;
|
|
147
|
+
/** Available when @input="select" ONLY - Custom error message */
|
|
148
|
+
errMsg?: string;
|
|
149
|
+
md?: GridSize;
|
|
150
|
+
sm?: GridSize;
|
|
151
|
+
xs?: GridSize;
|
|
152
|
+
}
|
|
153
|
+
export interface FieldProps {
|
|
154
|
+
name: string;
|
|
155
|
+
type: InputTypes;
|
|
156
|
+
/** Required for type="select" */
|
|
157
|
+
options?: Array<SelectOption>;
|
|
158
|
+
default?: string | number | Date | any;
|
|
159
|
+
config?: FieldInputProps;
|
|
160
|
+
}
|
|
161
|
+
export type ProcessedEvent = CalendarEvent & Record<string, any>;
|
|
162
|
+
export type EventActions = "create" | "edit";
|
|
163
|
+
export type RemoteQuery = {
|
|
164
|
+
start: Date;
|
|
165
|
+
end: Date;
|
|
166
|
+
view: "day" | "week" | "month";
|
|
167
|
+
};
|
|
168
|
+
export type DefaultResource = {
|
|
169
|
+
assignee?: string | number;
|
|
170
|
+
text?: string;
|
|
171
|
+
subtext?: string;
|
|
172
|
+
avatar?: string;
|
|
173
|
+
color?: string;
|
|
174
|
+
} & Record<string, any>;
|
|
175
|
+
export type ResourceFields = {
|
|
176
|
+
idField: string;
|
|
177
|
+
textField: string;
|
|
178
|
+
subTextField?: string;
|
|
179
|
+
avatarField?: string;
|
|
180
|
+
colorField?: string;
|
|
181
|
+
} & Record<string, string>;
|
|
182
|
+
export interface SchedulerHelpers {
|
|
183
|
+
state: Record<string, StateItem>;
|
|
184
|
+
close(): void;
|
|
185
|
+
loading(status: boolean): void;
|
|
186
|
+
edited?: ProcessedEvent;
|
|
187
|
+
onConfirm(event: ProcessedEvent | ProcessedEvent[], action: EventActions): void;
|
|
188
|
+
[resourceKey: string]: unknown;
|
|
189
|
+
}
|
|
190
|
+
export interface SchedulerProps {
|
|
191
|
+
/**Min height of table
|
|
192
|
+
* @default 600
|
|
193
|
+
*/
|
|
194
|
+
height: number;
|
|
195
|
+
/** Initial view to load */
|
|
196
|
+
view: View;
|
|
197
|
+
/**Activate Agenda view */
|
|
198
|
+
agenda?: boolean;
|
|
199
|
+
/** if true, day rows without event will be shown */
|
|
200
|
+
alwaysShowAgendaDays?: boolean;
|
|
201
|
+
/**Month view settings */
|
|
202
|
+
month: MonthProps | null;
|
|
203
|
+
/**Week view settings */
|
|
204
|
+
week: WeekProps | null;
|
|
205
|
+
/**Day view settings */
|
|
206
|
+
day: DayProps | null;
|
|
207
|
+
/**Initial date selected */
|
|
208
|
+
selectedDate: Date;
|
|
209
|
+
/** Show/Hide date navigation */
|
|
210
|
+
navigation?: boolean;
|
|
211
|
+
/** Show/Hide view navigator */
|
|
212
|
+
disableViewNavigator?: boolean;
|
|
213
|
+
/** */
|
|
214
|
+
navigationPickerProps?: Partial<Omit<DateCalendarProps, "open" | "onClose" | "openTo" | "views" | "value" | "readOnly" | "onChange">>;
|
|
215
|
+
/**Events to display */
|
|
216
|
+
events: ProcessedEvent[];
|
|
217
|
+
/** Custom event render method */
|
|
218
|
+
eventRenderer?: (props: EventRendererProps) => React.ReactNode | null;
|
|
219
|
+
/**Async function to load remote data with current view data. */
|
|
220
|
+
getRemoteEvents?(params: RemoteQuery): Promise<ProcessedEvent[] | void>;
|
|
221
|
+
/**Custom additional fields with it's settings */
|
|
222
|
+
fields: FieldProps[];
|
|
223
|
+
/**Table loading state */
|
|
224
|
+
loading?: boolean;
|
|
225
|
+
/** Custom loading component */
|
|
226
|
+
loadingComponent?: React.ReactNode;
|
|
227
|
+
/**Async function triggered when add/edit event */
|
|
228
|
+
onConfirm?(event: ProcessedEvent, action: EventActions): Promise<ProcessedEvent>;
|
|
229
|
+
/**Async function triggered when delete event */
|
|
230
|
+
onDelete?(deletedId: string | number): Promise<string | number | void>;
|
|
231
|
+
/**Override editor modal */
|
|
232
|
+
customEditor?(scheduler: SchedulerHelpers): React.ReactNode;
|
|
233
|
+
/** Custom viewer/popper component. If used, `viewerExtraComponent` & `viewerTitleComponent` will be ignored */
|
|
234
|
+
customViewer?(event: ProcessedEvent, close: () => void): React.ReactNode;
|
|
235
|
+
/**Additional component in event viewer popper */
|
|
236
|
+
viewerExtraComponent?: React.ReactNode | ((fields: FieldProps[], event: ProcessedEvent) => React.ReactNode);
|
|
237
|
+
/**Override viewer title component */
|
|
238
|
+
viewerTitleComponent?(event: ProcessedEvent): React.ReactNode;
|
|
239
|
+
/**Override viewer subtitle component */
|
|
240
|
+
viewerSubtitleComponent?(event: ProcessedEvent): React.ReactNode;
|
|
241
|
+
/** if true, the viewer popover will be disabled globally */
|
|
242
|
+
disableViewer?: boolean;
|
|
243
|
+
/**Resources array to split event views with resources */
|
|
244
|
+
resources: DefaultResource[];
|
|
245
|
+
/**Map resources fields */
|
|
246
|
+
resourceFields: ResourceFields;
|
|
247
|
+
/**Override header component of resource */
|
|
248
|
+
resourceHeaderComponent?(resource: DefaultResource): React.ReactNode;
|
|
249
|
+
/** Triggered when resource tabs changes */
|
|
250
|
+
onResourceChange?(resource: DefaultResource): void;
|
|
251
|
+
/**Resource header view mode
|
|
252
|
+
* @default "default"
|
|
253
|
+
*/
|
|
254
|
+
resourceViewMode: "default" | "vertical" | "tabs";
|
|
255
|
+
/**Direction of table */
|
|
256
|
+
direction: "rtl" | "ltr";
|
|
257
|
+
/**Editor dialog maxWith
|
|
258
|
+
* @default "md"
|
|
259
|
+
*/
|
|
260
|
+
dialogMaxWidth: DialogProps["maxWidth"];
|
|
261
|
+
/**
|
|
262
|
+
* date-fns Locale object
|
|
263
|
+
*/
|
|
264
|
+
locale: Locale;
|
|
265
|
+
/**
|
|
266
|
+
* Localization
|
|
267
|
+
*/
|
|
268
|
+
translations: Translations;
|
|
269
|
+
/**
|
|
270
|
+
* Hour Format
|
|
271
|
+
*/
|
|
272
|
+
hourFormat: "12" | "24";
|
|
273
|
+
/**
|
|
274
|
+
* Time zone IANA ID: https://data.iana.org/time-zones/releases
|
|
275
|
+
*/
|
|
276
|
+
timeZone?: string;
|
|
277
|
+
/**
|
|
278
|
+
* Triggered when event is dropped on time slot.
|
|
279
|
+
*/
|
|
280
|
+
onEventDrop?(event: DragEvent<HTMLButtonElement>, droppedOn: Date, updatedEvent: ProcessedEvent, originalEvent: ProcessedEvent): Promise<ProcessedEvent | void>;
|
|
281
|
+
/**
|
|
282
|
+
*
|
|
283
|
+
*/
|
|
284
|
+
onEventClick?(event: ProcessedEvent): void;
|
|
285
|
+
/**
|
|
286
|
+
* Triggered when an event item is being edited from the popover
|
|
287
|
+
*/
|
|
288
|
+
onEventEdit?(event: ProcessedEvent): void;
|
|
289
|
+
/**
|
|
290
|
+
* If event is deletable, applied to all events globally, overridden by event specific deletable prop
|
|
291
|
+
* @default true
|
|
292
|
+
*/
|
|
293
|
+
deletable?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* If calendar is editable, applied to all events/cells globally, overridden by event specific editable prop
|
|
296
|
+
* @default true
|
|
297
|
+
*/
|
|
298
|
+
editable?: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* If event is draggable, applied to all events globally, overridden by event specific draggable prop
|
|
301
|
+
* @default true
|
|
302
|
+
*/
|
|
303
|
+
draggable?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Triggered when the `selectedDate` prop changes by navigation date picker or `today` button.
|
|
306
|
+
*/
|
|
307
|
+
onSelectedDateChange?(date: Date): void;
|
|
308
|
+
/**
|
|
309
|
+
* Triggered when navigation view changes.
|
|
310
|
+
*/
|
|
311
|
+
onViewChange?(view: View, agenda?: boolean): void;
|
|
312
|
+
/**
|
|
313
|
+
* If true, the navigation controller bar will be sticky
|
|
314
|
+
*/
|
|
315
|
+
stickyNavigation?: boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Overrides the default behavior of more events button
|
|
318
|
+
*/
|
|
319
|
+
onClickMore?(date: Date, gotToDay: (date: Date) => void): void;
|
|
320
|
+
/**
|
|
321
|
+
*
|
|
322
|
+
*/
|
|
323
|
+
onCellClick?(start: Date, end: Date, resourceKey?: string, resourceVal?: string | number): void;
|
|
324
|
+
/**
|
|
325
|
+
* Custom content to display in the scheduler header.
|
|
326
|
+
* Wrap with useCallback if using state/props to avoid re-renders.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* const header = useCallback(() => <Button>{state}</Button>, [state]);
|
|
330
|
+
*/
|
|
331
|
+
customHeaderContent?: () => React.ReactNode;
|
|
332
|
+
/**
|
|
333
|
+
* Top offset when sticky navigation is enabled (in pixels).
|
|
334
|
+
* @default 0
|
|
335
|
+
*/
|
|
336
|
+
stickyNavigationOffset?: number;
|
|
337
|
+
/**
|
|
338
|
+
* Height of the sticky navigation header in pixels.
|
|
339
|
+
* Used to calculate offset for sticky elements below the header.
|
|
340
|
+
* @default 40
|
|
341
|
+
*/
|
|
342
|
+
stickyNavigationHeight?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Override the current time used for the red indicator bar.
|
|
345
|
+
* Useful when working with different timezones or for testing.
|
|
346
|
+
*/
|
|
347
|
+
currentTime?: Date;
|
|
348
|
+
/**
|
|
349
|
+
* Show/hide the current time indicator bar.
|
|
350
|
+
* @default true
|
|
351
|
+
*/
|
|
352
|
+
showCurrentTimeBar?: boolean;
|
|
353
|
+
/**
|
|
354
|
+
* Color of the current time indicator bar.
|
|
355
|
+
* @default theme.palette.error.light (red)
|
|
356
|
+
*/
|
|
357
|
+
currentTimeBarColor?: string;
|
|
358
|
+
/**
|
|
359
|
+
* When true, events spanning multiple days with allDay: false
|
|
360
|
+
* will be displayed in the time grid instead of the all-day header.
|
|
361
|
+
* Events will be split visually at midnight boundaries.
|
|
362
|
+
* @default false
|
|
363
|
+
*/
|
|
364
|
+
forceInlineMultiDay?: boolean;
|
|
365
|
+
}
|
|
366
|
+
export interface SchedulerRef {
|
|
367
|
+
el: HTMLDivElement;
|
|
368
|
+
scheduler: Store;
|
|
369
|
+
}
|
|
370
|
+
export interface Scheduler extends Partial<SchedulerProps> {
|
|
371
|
+
}
|
|
372
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectedRange } from '../store/types';
|
|
2
|
+
import { FieldInputProps, InputTypes, ProcessedEvent } from '../types';
|
|
3
|
+
export type StateItem = {
|
|
4
|
+
value: any;
|
|
5
|
+
validity: boolean;
|
|
6
|
+
type: InputTypes;
|
|
7
|
+
config?: FieldInputProps;
|
|
8
|
+
};
|
|
9
|
+
export type StateEvent = (ProcessedEvent & SelectedRange) | Record<string, any>;
|
|
10
|
+
declare const Editor: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Editor;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DefaultResource, ProcessedEvent } from '../types';
|
|
2
|
+
type Props = {
|
|
3
|
+
events: ProcessedEvent[];
|
|
4
|
+
resource?: DefaultResource;
|
|
5
|
+
};
|
|
6
|
+
declare const MonthAgenda: ({ events, resource }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { MonthAgenda };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DefaultResource, ProcessedEvent } from '../types';
|
|
2
|
+
type Props = {
|
|
3
|
+
daysList: Date[];
|
|
4
|
+
resource?: DefaultResource;
|
|
5
|
+
events: ProcessedEvent[];
|
|
6
|
+
};
|
|
7
|
+
declare const WeekAgenda: ({ daysList, resource, events }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export { WeekAgenda };
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import react from "eslint-plugin-react";
|
|
2
|
+
import tseslint, { configs as tseslintConfigs } from "typescript-eslint";
|
|
3
|
+
import globals from "globals";
|
|
4
|
+
import js from "@eslint/js";
|
|
5
|
+
import * as reactHooks from "eslint-plugin-react-hooks";
|
|
6
|
+
import reactRefresh from "eslint-plugin-react-refresh";
|
|
7
|
+
import pluginImport from "eslint-plugin-import";
|
|
8
|
+
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
|
9
|
+
import pluginPromise from "eslint-plugin-promise";
|
|
10
|
+
|
|
11
|
+
export default tseslint.config(
|
|
12
|
+
{ ignores: ["jest.config.ts", "scripts", "dist", "vite.config.js"] },
|
|
13
|
+
pluginJsxA11y.flatConfigs.recommended,
|
|
14
|
+
pluginPromise.configs["flat/recommended"],
|
|
15
|
+
pluginImport.flatConfigs.recommended,
|
|
16
|
+
{
|
|
17
|
+
extends: [js.configs.recommended, ...tseslintConfigs.recommended],
|
|
18
|
+
plugins: {
|
|
19
|
+
"react-hooks": reactHooks,
|
|
20
|
+
"react-refresh": reactRefresh,
|
|
21
|
+
react,
|
|
22
|
+
},
|
|
23
|
+
files: ["**/*.{ts,tsx}"],
|
|
24
|
+
languageOptions: {
|
|
25
|
+
globals: {
|
|
26
|
+
...globals.browser,
|
|
27
|
+
React: "readonly",
|
|
28
|
+
},
|
|
29
|
+
ecmaVersion: "latest",
|
|
30
|
+
sourceType: "module",
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
settings: {
|
|
34
|
+
react: {
|
|
35
|
+
version: "detect",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
rules: {
|
|
40
|
+
...reactHooks.configs.recommended.rules,
|
|
41
|
+
"linebreak-style": ["error", "unix"],
|
|
42
|
+
|
|
43
|
+
quotes: [
|
|
44
|
+
"error",
|
|
45
|
+
"double",
|
|
46
|
+
{
|
|
47
|
+
allowTemplateLiterals: true,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
|
|
51
|
+
semi: ["error", "always"],
|
|
52
|
+
"@typescript-eslint/no-non-null-assertion": 0,
|
|
53
|
+
"no-useless-catch": 0,
|
|
54
|
+
"@typescript-eslint/no-explicit-any": 0,
|
|
55
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": 0,
|
|
56
|
+
"no-case-declarations": 0,
|
|
57
|
+
"@typescript-eslint/no-empty-interface": 0,
|
|
58
|
+
"@typescript-eslint/no-empty-function": 0,
|
|
59
|
+
"@typescript-eslint/no-empty-object-type": [
|
|
60
|
+
"error",
|
|
61
|
+
{ allowInterfaces: "with-single-extends" },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
// Checks importing of different files
|
|
67
|
+
settings: {
|
|
68
|
+
"import/parsers": {
|
|
69
|
+
"@typescript-eslint/parser": [".ts", ".tsx"],
|
|
70
|
+
},
|
|
71
|
+
"import/resolver": {
|
|
72
|
+
typescript: {
|
|
73
|
+
alwaysTryTypes: true,
|
|
74
|
+
project: "./",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
);
|
package/index.html
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" dir="ltr">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<link rel="icon" href="/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="theme-color" content="#000000" />
|
|
8
|
+
<meta name="description" content="Web site created using create-react-app" />
|
|
9
|
+
<link rel="apple-touch-icon" href="/logo192.png" />
|
|
10
|
+
<!--
|
|
11
|
+
manifest.json provides metadata used when your web app is installed on a
|
|
12
|
+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
13
|
+
-->
|
|
14
|
+
<link rel="manifest" href="/manifest.json" />
|
|
15
|
+
<!--
|
|
16
|
+
Notice the use of in the tags above.
|
|
17
|
+
It will be replaced with the URL of the `public` folder during the build.
|
|
18
|
+
Only files inside the `public` folder can be referenced from the HTML.
|
|
19
|
+
|
|
20
|
+
Unlike "/favicon.ico" or "favicon.ico", "/favicon.ico" will
|
|
21
|
+
work correctly both with client-side routing and a non-root public URL.
|
|
22
|
+
Learn how to configure a non-root public URL by running `npm run build`.
|
|
23
|
+
-->
|
|
24
|
+
<title>React App</title>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
28
|
+
<div id="root"></div>
|
|
29
|
+
<!--
|
|
30
|
+
This HTML file is a template.
|
|
31
|
+
If you open it directly in the browser, you will see an empty page.
|
|
32
|
+
|
|
33
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
34
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
35
|
+
|
|
36
|
+
To begin the development, run `npm start` or `yarn start`.
|
|
37
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
|
38
|
+
-->
|
|
39
|
+
<script type="module" src="/src/index.tsx"></script>
|
|
40
|
+
</body>
|
|
41
|
+
</html>
|