@isma91/react-scheduler 4.0.0 → 4.0.2

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.
Files changed (132) hide show
  1. package/{dist/index.js → index.js} +218 -203
  2. package/package.json +4 -76
  3. package/.github/workflows/publish.yml +0 -29
  4. package/.github/workflows/tests.yml +0 -35
  5. package/.gitignore +0 -32
  6. package/.husky/pre-commit +0 -2
  7. package/.prettierignore +0 -1
  8. package/.prettierrc.json +0 -7
  9. package/.yarnrc.yml +0 -1
  10. package/dist/LICENSE +0 -24
  11. package/dist/README.md +0 -172
  12. package/dist/package.json +0 -65
  13. package/eslint.config.js +0 -79
  14. package/index.html +0 -41
  15. package/jest.config.ts +0 -194
  16. package/public/favicon.ico +0 -0
  17. package/public/logo192.png +0 -0
  18. package/public/logo512.png +0 -0
  19. package/public/manifest.json +0 -25
  20. package/public/robots.txt +0 -3
  21. package/scripts/post-pack.js +0 -34
  22. package/src/App.tsx +0 -25
  23. package/src/Page1.tsx +0 -67
  24. package/src/events.tsx +0 -227
  25. package/src/index.tsx +0 -21
  26. package/src/lib/SchedulerComponent.tsx +0 -78
  27. package/src/lib/__tests__/index.test.tsx +0 -24
  28. package/src/lib/components/common/Cell.tsx +0 -52
  29. package/src/lib/components/common/LocaleArrow.tsx +0 -38
  30. package/src/lib/components/common/ResourceHeader.tsx +0 -73
  31. package/src/lib/components/common/Tabs.tsx +0 -119
  32. package/src/lib/components/common/TodayTypo.tsx +0 -44
  33. package/src/lib/components/common/WithResources.tsx +0 -98
  34. package/src/lib/components/events/Actions.tsx +0 -65
  35. package/src/lib/components/events/AgendaEventsList.tsx +0 -115
  36. package/src/lib/components/events/CurrentTimeBar.tsx +0 -59
  37. package/src/lib/components/events/EmptyAgenda.tsx +0 -27
  38. package/src/lib/components/events/EventItem.tsx +0 -180
  39. package/src/lib/components/events/EventItemPopover.tsx +0 -179
  40. package/src/lib/components/events/MonthEvents.tsx +0 -141
  41. package/src/lib/components/events/TodayEvents.tsx +0 -99
  42. package/src/lib/components/hoc/DateProvider.tsx +0 -19
  43. package/src/lib/components/inputs/DatePicker.tsx +0 -95
  44. package/src/lib/components/inputs/Input.tsx +0 -113
  45. package/src/lib/components/inputs/SelectInput.tsx +0 -164
  46. package/src/lib/components/month/MonthTable.tsx +0 -207
  47. package/src/lib/components/nav/DayDateBtn.tsx +0 -77
  48. package/src/lib/components/nav/MonthDateBtn.tsx +0 -80
  49. package/src/lib/components/nav/Navigation.tsx +0 -201
  50. package/src/lib/components/nav/WeekDateBtn.tsx +0 -89
  51. package/src/lib/components/week/WeekTable.tsx +0 -229
  52. package/src/lib/helpers/constants.ts +0 -4
  53. package/src/lib/helpers/generals.tsx +0 -354
  54. package/src/lib/hooks/useArrowDisable.ts +0 -26
  55. package/src/lib/hooks/useCellAttributes.ts +0 -67
  56. package/src/lib/hooks/useDragAttributes.ts +0 -31
  57. package/src/lib/hooks/useEventPermissions.ts +0 -42
  58. package/src/lib/hooks/useStore.ts +0 -8
  59. package/src/lib/hooks/useSyncScroll.ts +0 -31
  60. package/src/lib/hooks/useWindowResize.ts +0 -37
  61. package/src/lib/index.tsx +0 -14
  62. package/src/lib/positionManger/context.ts +0 -14
  63. package/src/lib/positionManger/provider.tsx +0 -113
  64. package/src/lib/positionManger/usePosition.ts +0 -8
  65. package/src/lib/store/context.ts +0 -5
  66. package/src/lib/store/default.ts +0 -157
  67. package/src/lib/store/provider.tsx +0 -211
  68. package/src/lib/store/types.ts +0 -33
  69. package/src/lib/styles/styles.ts +0 -256
  70. package/src/lib/types.ts +0 -423
  71. package/src/lib/views/Day.tsx +0 -265
  72. package/src/lib/views/DayAgenda.tsx +0 -57
  73. package/src/lib/views/Editor.tsx +0 -258
  74. package/src/lib/views/Month.tsx +0 -82
  75. package/src/lib/views/MonthAgenda.tsx +0 -84
  76. package/src/lib/views/Week.tsx +0 -92
  77. package/src/lib/views/WeekAgenda.tsx +0 -81
  78. package/src/vite-env.d.ts +0 -3
  79. package/tsconfig.build.json +0 -5
  80. package/tsconfig.json +0 -27
  81. package/vite.config.js +0 -40
  82. /package/{dist/SchedulerComponent.d.ts → SchedulerComponent.d.ts} +0 -0
  83. /package/{dist/components → components}/common/Cell.d.ts +0 -0
  84. /package/{dist/components → components}/common/LocaleArrow.d.ts +0 -0
  85. /package/{dist/components → components}/common/ResourceHeader.d.ts +0 -0
  86. /package/{dist/components → components}/common/Tabs.d.ts +0 -0
  87. /package/{dist/components → components}/common/TodayTypo.d.ts +0 -0
  88. /package/{dist/components → components}/common/WithResources.d.ts +0 -0
  89. /package/{dist/components → components}/events/Actions.d.ts +0 -0
  90. /package/{dist/components → components}/events/AgendaEventsList.d.ts +0 -0
  91. /package/{dist/components → components}/events/CurrentTimeBar.d.ts +0 -0
  92. /package/{dist/components → components}/events/EmptyAgenda.d.ts +0 -0
  93. /package/{dist/components → components}/events/EventItem.d.ts +0 -0
  94. /package/{dist/components → components}/events/EventItemPopover.d.ts +0 -0
  95. /package/{dist/components → components}/events/MonthEvents.d.ts +0 -0
  96. /package/{dist/components → components}/events/TodayEvents.d.ts +0 -0
  97. /package/{dist/components → components}/hoc/DateProvider.d.ts +0 -0
  98. /package/{dist/components → components}/inputs/DatePicker.d.ts +0 -0
  99. /package/{dist/components → components}/inputs/Input.d.ts +0 -0
  100. /package/{dist/components → components}/inputs/SelectInput.d.ts +0 -0
  101. /package/{dist/components → components}/month/MonthTable.d.ts +0 -0
  102. /package/{dist/components → components}/nav/DayDateBtn.d.ts +0 -0
  103. /package/{dist/components → components}/nav/MonthDateBtn.d.ts +0 -0
  104. /package/{dist/components → components}/nav/Navigation.d.ts +0 -0
  105. /package/{dist/components → components}/nav/WeekDateBtn.d.ts +0 -0
  106. /package/{dist/components → components}/week/WeekTable.d.ts +0 -0
  107. /package/{dist/helpers → helpers}/constants.d.ts +0 -0
  108. /package/{dist/helpers → helpers}/generals.d.ts +0 -0
  109. /package/{dist/hooks → hooks}/useArrowDisable.d.ts +0 -0
  110. /package/{dist/hooks → hooks}/useCellAttributes.d.ts +0 -0
  111. /package/{dist/hooks → hooks}/useDragAttributes.d.ts +0 -0
  112. /package/{dist/hooks → hooks}/useEventPermissions.d.ts +0 -0
  113. /package/{dist/hooks → hooks}/useStore.d.ts +0 -0
  114. /package/{dist/hooks → hooks}/useSyncScroll.d.ts +0 -0
  115. /package/{dist/hooks → hooks}/useWindowResize.d.ts +0 -0
  116. /package/{dist/index.d.ts → index.d.ts} +0 -0
  117. /package/{dist/positionManger → positionManger}/context.d.ts +0 -0
  118. /package/{dist/positionManger → positionManger}/provider.d.ts +0 -0
  119. /package/{dist/positionManger → positionManger}/usePosition.d.ts +0 -0
  120. /package/{dist/store → store}/context.d.ts +0 -0
  121. /package/{dist/store → store}/default.d.ts +0 -0
  122. /package/{dist/store → store}/provider.d.ts +0 -0
  123. /package/{dist/store → store}/types.d.ts +0 -0
  124. /package/{dist/styles → styles}/styles.d.ts +0 -0
  125. /package/{dist/types.d.ts → types.d.ts} +0 -0
  126. /package/{dist/views → views}/Day.d.ts +0 -0
  127. /package/{dist/views → views}/DayAgenda.d.ts +0 -0
  128. /package/{dist/views → views}/Editor.d.ts +0 -0
  129. /package/{dist/views → views}/Month.d.ts +0 -0
  130. /package/{dist/views → views}/MonthAgenda.d.ts +0 -0
  131. /package/{dist/views → views}/Week.d.ts +0 -0
  132. /package/{dist/views → views}/WeekAgenda.d.ts +0 -0
@@ -1,256 +0,0 @@
1
- import { Paper, alpha, styled } from "@mui/material";
2
-
3
- export const Wrapper = styled("div")<{ dialog: number }>(({ theme, dialog }) => ({
4
- position: "relative",
5
- "& .rs__table_loading": {
6
- position: "absolute",
7
- left: 0,
8
- right: 0,
9
- top: 0,
10
- bottom: 0,
11
- zIndex: 999999,
12
- "& .rs__table_loading_internal": {
13
- background: dialog ? "" : alpha(theme.palette.background.paper, 0.4),
14
- height: "100%",
15
- "& > span": {
16
- display: "flex",
17
- alignItems: "center",
18
- justifyContent: "center",
19
- height: "100%",
20
- flexDirection: "column",
21
- "& >span": {
22
- marginBottom: 15,
23
- },
24
- },
25
- },
26
- },
27
- }));
28
-
29
- export const Table = styled("div")<{ resource_count: number }>(({ resource_count }) => ({
30
- position: "relative",
31
- display: "flex",
32
- flexDirection: resource_count > 1 ? "row" : "column",
33
- width: "100%",
34
- boxSizing: "content-box",
35
- "& > div": {
36
- flexShrink: 0,
37
- flexGrow: 1,
38
- },
39
- }));
40
-
41
- export const NavigationDiv = styled(Paper)<{ sticky?: string; offset?: number }>(
42
- ({ sticky = "0", offset = 0 }) => ({
43
- display: "flex",
44
- justifyContent: "space-between",
45
- alignItems: "center",
46
- position: sticky === "1" ? "sticky" : "relative",
47
- top: sticky === "1" ? offset : undefined,
48
- zIndex: sticky === "1" ? 999 : undefined,
49
- boxShadow: "none",
50
- padding: "2px 0",
51
- "& > .rs__view_navigator": {
52
- display: "flex",
53
- alignItems: "center",
54
- },
55
- })
56
- );
57
-
58
- export const AgendaDiv = styled("div")<{ stickyOffset?: number; stickyHeight?: number }>(
59
- ({ theme, stickyOffset = 0, stickyHeight = 40 }) => ({
60
- borderStyle: "solid",
61
- borderColor: theme.palette.grey[300],
62
- borderWidth: "1px 1px 0 0",
63
- "& > .rs__agenda_row": {
64
- display: "flex",
65
- "& >.rs__agenda__cell": {
66
- padding: 4,
67
- width: "100%",
68
- maxWidth: 60,
69
- "& > .MuiTypography-root": {
70
- position: "sticky",
71
- top: stickyOffset + stickyHeight,
72
- "&.rs__hover__op": {
73
- cursor: "pointer",
74
- "&:hover": {
75
- opacity: 0.7,
76
- textDecoration: "underline",
77
- },
78
- },
79
- },
80
- },
81
- "& .rs__cell": {
82
- borderStyle: "solid",
83
- borderColor: theme.palette.grey[300],
84
- borderWidth: "0 0 1px 1px",
85
- },
86
- "& > .rs__agenda_items": {
87
- flexGrow: 1,
88
- },
89
- },
90
- })
91
- );
92
-
93
- export const TableGrid = styled("div")<{
94
- days: number;
95
- sticky?: string;
96
- stickyNavigation?: boolean;
97
- stickyOffset?: number;
98
- stickyHeight?: number;
99
- indent?: string;
100
- }>(
101
- ({
102
- days,
103
- sticky = "0",
104
- stickyNavigation,
105
- indent = "1",
106
- theme,
107
- stickyOffset = 0,
108
- stickyHeight = 40,
109
- }) => ({
110
- display: "grid",
111
- gridTemplateColumns: +indent > 0 ? `10% repeat(${days}, 1fr)` : `repeat(${days}, 1fr)`,
112
- overflowX: "auto",
113
- overflowY: "hidden",
114
- position: sticky === "1" ? "sticky" : "relative",
115
- top: sticky === "1" ? (stickyNavigation ? stickyOffset + stickyHeight : 0) : undefined,
116
- zIndex: sticky === "1" ? 99 : undefined,
117
- [theme.breakpoints.down("sm")]: {
118
- gridTemplateColumns: +indent > 0 ? `30px repeat(${days}, 1fr)` : "",
119
- },
120
- borderStyle: "solid",
121
- borderColor: theme.palette.grey[300],
122
- borderWidth: "0 0 0 1px",
123
- "&:first-of-type": {
124
- borderWidth: "1px 0 0 1px",
125
- },
126
- "&:last-of-type": {
127
- borderWidth: "0 0 1px 1px",
128
- },
129
- "& .rs__cell": {
130
- background: theme.palette.background.paper,
131
- position: "relative",
132
- borderStyle: "solid",
133
- borderColor: theme.palette.grey[300],
134
- borderWidth: "0 1px 1px 0",
135
- "&.rs__header": {
136
- "& > :first-of-type": {
137
- padding: "2px 5px",
138
- },
139
- },
140
- "&.rs__header__center": {
141
- padding: "6px 0px",
142
- },
143
- "&.rs__time": {
144
- display: "flex",
145
- alignItems: "center",
146
- justifyContent: "center",
147
- position: "sticky",
148
- left: 0,
149
- zIndex: 99,
150
- [theme.breakpoints.down("sm")]: {
151
- writingMode: "vertical-rl",
152
- },
153
- },
154
- "& > button": {
155
- width: "100%",
156
- height: "100%",
157
- borderRadius: 0,
158
- cursor: "pointer",
159
- "&:hover": {
160
- background: alpha(theme.palette.primary.main, 0.1),
161
- },
162
- },
163
- "& .rs__event__item": {
164
- position: "absolute",
165
- zIndex: 1,
166
- },
167
- "& .rs__multi_day": {
168
- position: "absolute",
169
- zIndex: 1,
170
- textOverflow: "ellipsis",
171
- },
172
- "& .rs__block_col": {
173
- display: "block",
174
- position: "relative",
175
- },
176
- "& .rs__hover__op": {
177
- cursor: "pointer",
178
- "&:hover": {
179
- opacity: 0.7,
180
- textDecoration: "underline",
181
- },
182
- },
183
- "&:not(.rs__time)": {
184
- minWidth: 65,
185
- },
186
- },
187
- })
188
- );
189
-
190
- export const EventItemPaper = styled(Paper)<{ disabled?: boolean }>(({ disabled }) => ({
191
- width: "99.5%",
192
- height: "100%",
193
- display: "block",
194
- cursor: disabled ? "not-allowed" : "pointer",
195
- overflow: "hidden",
196
- "& .MuiButtonBase-root": {
197
- width: "100%",
198
- height: "100%",
199
- display: "block",
200
- textAlign: "left",
201
- "& > div": {
202
- height: "100%",
203
- // padding: "2px 4px",
204
- },
205
- },
206
- }));
207
-
208
- export const PopperInner = styled("div")(({ theme }) => ({
209
- maxWidth: "100%",
210
- width: 400,
211
- "& > div": {
212
- padding: "5px 10px",
213
- "& .rs__popper_actions": {
214
- display: "flex",
215
- alignItems: "center",
216
- justifyContent: "space-between",
217
- "& .MuiIconButton-root": {
218
- color: theme.palette.primary.contrastText,
219
- },
220
- },
221
- },
222
- }));
223
-
224
- export const EventActions = styled("div")(({ theme }) => ({
225
- display: "inherit",
226
- "& .MuiIconButton-root": {
227
- color: theme.palette.primary.contrastText,
228
- },
229
- "& .MuiButton-root": {
230
- "&.delete": {
231
- color: theme.palette.error.main,
232
- },
233
- "&.cancel": {
234
- color: theme.palette.action.disabled,
235
- },
236
- },
237
- }));
238
-
239
- export const TimeIndicatorBar = styled("div")<{ color?: string }>(({ theme, color }) => ({
240
- position: "absolute",
241
- zIndex: 9,
242
- width: "100%",
243
- display: "flex",
244
- "& > div:first-of-type": {
245
- height: 12,
246
- width: 12,
247
- borderRadius: "50%",
248
- background: color || theme.palette.error.light,
249
- marginLeft: -6,
250
- marginTop: -5,
251
- },
252
- "& > div:last-of-type": {
253
- borderTop: `solid 2px ${color || theme.palette.error.light}`,
254
- width: "100%",
255
- },
256
- }));
package/src/lib/types.ts DELETED
@@ -1,423 +0,0 @@
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 type { RRule } from "rrule";
10
-
11
- export type DayHours =
12
- | 0
13
- | 1
14
- | 2
15
- | 3
16
- | 4
17
- | 5
18
- | 6
19
- | 7
20
- | 8
21
- | 9
22
- | 10
23
- | 11
24
- | 12
25
- | 13
26
- | 14
27
- | 15
28
- | 16
29
- | 17
30
- | 18
31
- | 19
32
- | 20
33
- | 21
34
- | 22
35
- | 23
36
- | 24;
37
-
38
- export type WeekDays = 0 | 1 | 2 | 3 | 4 | 5 | 6;
39
-
40
- interface CommonWeekViewProps {
41
- weekDays: WeekDays[];
42
- weekStartOn: WeekDays;
43
- disableGoToDay?: boolean;
44
- }
45
-
46
- interface CommonViewProps {
47
- startHour: DayHours;
48
- endHour: DayHours;
49
- cellRenderer?(props: CellRenderedProps): React.ReactNode;
50
- headRenderer?(props: {
51
- day: Date;
52
- events: ProcessedEvent[];
53
- resource?: DefaultResource;
54
- }): React.ReactNode;
55
- navigation?: boolean;
56
- step: number;
57
- }
58
-
59
- export interface MonthProps extends CommonWeekViewProps, CommonViewProps {}
60
-
61
- export interface WeekProps extends CommonWeekViewProps, CommonViewProps {
62
- hourRenderer?(hour: string): React.ReactNode;
63
- }
64
-
65
- export interface DayProps extends CommonViewProps {
66
- hourRenderer?(hour: string): React.ReactNode;
67
- }
68
-
69
- export interface CellRenderedProps {
70
- day: Date;
71
- start: Date;
72
- end: Date;
73
- height: number;
74
- onClick(): void;
75
- onDragOver(e: DragEvent<HTMLButtonElement>): void;
76
- onDragEnter(e: DragEvent<HTMLButtonElement>): void;
77
- onDragLeave(e: DragEvent<HTMLButtonElement>): void;
78
- onDrop(e: DragEvent<HTMLButtonElement>): void;
79
- }
80
- interface CalendarEvent {
81
- event_id: number | string;
82
- title: React.ReactNode;
83
- subtitle?: React.ReactNode;
84
- start: Date;
85
- end: Date;
86
- recurring?: RRule;
87
- disabled?: boolean;
88
- color?: string;
89
- textColor?: string;
90
- editable?: boolean;
91
- deletable?: boolean;
92
- draggable?: boolean;
93
- allDay?: boolean;
94
- /**
95
- * @default " "
96
- * passed as a children to mui <Avatar /> component
97
- */
98
- agendaAvatar?: React.ReactElement | string;
99
- /** @internal Original start date before segment clipping */
100
- _originalStart?: Date;
101
- /** @internal Original end date before segment clipping */
102
- _originalEnd?: Date;
103
- /** @internal Segment continues from previous day */
104
- _hasPrev?: boolean;
105
- /** @internal Segment continues to next day */
106
- _hasNext?: boolean;
107
- }
108
- export interface Translations {
109
- navigation: Record<View, string> & { today: string; agenda: string };
110
- form: {
111
- addTitle: string;
112
- editTitle: string;
113
- confirm: string;
114
- delete: string;
115
- cancel: string;
116
- };
117
- event: Record<string, string> & {
118
- title: string;
119
- subtitle: string;
120
- start: string;
121
- end: string;
122
- allDay: string;
123
- };
124
- validation?: {
125
- required?: string;
126
- invalidEmail?: string;
127
- onlyNumbers?: string;
128
- min?: string | ((min: number) => string);
129
- max?: string | ((max: number) => string);
130
- };
131
- moreEvents: string;
132
- noDataToDisplay: string;
133
- loading: string;
134
- }
135
-
136
- export type InputTypes = "input" | "date" | "select" | "hidden";
137
-
138
- export interface EventRendererProps extends Pick<
139
- React.HTMLAttributes<HTMLElement>,
140
- "draggable" | "onDragStart" | "onDragEnd" | "onDragOver" | "onDragEnter" | "onClick"
141
- > {
142
- event: ProcessedEvent;
143
- }
144
- export interface FieldInputProps {
145
- /** Available to all InputTypes */
146
- label?: string;
147
- /** Available to all InputTypes */
148
- placeholder?: string;
149
- /** Available to all InputTypes
150
- * @default false
151
- */
152
- required?: boolean;
153
- /** Available to all InputTypes
154
- * @default "outline"
155
- */
156
- variant?: "standard" | "filled" | "outlined";
157
- /** Available to all InputTypes */
158
- disabled?: boolean;
159
- /** Available when @input="text" ONLY - Minimum length */
160
- min?: number;
161
- /** Available when @input="text" ONLY - Maximum length */
162
- max?: number;
163
- /** Available when @input="text" ONLY - Apply email Regex */
164
- email?: boolean;
165
- /** Available when @input="text" ONLY - Only numbers(int/float) allowed */
166
- decimal?: boolean;
167
- /** Available when @input="text" ONLY - Allow Multiline input. Use @rows property to set initial rows height */
168
- multiline?: boolean;
169
- /** Available when @input="text" ONLY - initial rows height*/
170
- rows?: number;
171
- /** Available when @input="date" ONLY
172
- * @default "datetime"
173
- */
174
- type?: "date" | "datetime";
175
- /** Available when @input="select" ONLY - Multi-Select input style.
176
- * if you use "default" property with this, make sure your "default" property is an instance of Array
177
- */
178
- multiple?: "chips" | "default";
179
- /** Available when @input="select" ONLY - display loading spinner instead of expand arrow */
180
- loading?: boolean;
181
- /** Available when @input="select" ONLY - Custom error message */
182
- errMsg?: string;
183
-
184
- /* Used for Grid alignment in a single row md | sm | xs */
185
- md?: GridSize;
186
- /* Used for Grid alignment in a single row md | sm | xs */
187
- sm?: GridSize;
188
- /* Used for Grid alignment in a single row md | sm | xs */
189
- xs?: GridSize;
190
- }
191
- export interface FieldProps {
192
- name: string;
193
- type: InputTypes;
194
- /** Required for type="select" */
195
- options?: Array<SelectOption>;
196
- default?: string | number | Date | any;
197
- config?: FieldInputProps;
198
- }
199
- export type ProcessedEvent = CalendarEvent & Record<string, any>;
200
- export type EventActions = "create" | "edit";
201
- export type RemoteQuery = {
202
- start: Date;
203
- end: Date;
204
- view: "day" | "week" | "month";
205
- };
206
- export type DefaultResource = {
207
- assignee?: string | number;
208
- text?: string;
209
- subtext?: string;
210
- avatar?: string;
211
- color?: string;
212
- } & Record<string, any>;
213
- export type ResourceFields = {
214
- idField: string;
215
- textField: string;
216
- subTextField?: string;
217
- avatarField?: string;
218
- colorField?: string;
219
- } & Record<string, string>;
220
-
221
- export interface SchedulerHelpers {
222
- state: Record<string, StateItem>;
223
- close(): void;
224
- loading(status: boolean): void;
225
- edited?: ProcessedEvent;
226
- onConfirm(event: ProcessedEvent | ProcessedEvent[], action: EventActions): void;
227
- [resourceKey: string]: unknown;
228
- }
229
- export interface SchedulerProps {
230
- /**Min height of table
231
- * @default 600
232
- */
233
- height: number;
234
- /** Initial view to load */
235
- view: View;
236
- /**Activate Agenda view */
237
- agenda?: boolean;
238
- /** if true, day rows without event will be shown */
239
- alwaysShowAgendaDays?: boolean;
240
- /**Month view settings */
241
- month: MonthProps | null;
242
- /**Week view settings */
243
- week: WeekProps | null;
244
- /**Day view settings */
245
- day: DayProps | null;
246
- /**Initial date selected */
247
- selectedDate: Date;
248
- /** Show/Hide date navigation */
249
- navigation?: boolean;
250
- /** Show/Hide view navigator */
251
- disableViewNavigator?: boolean;
252
- /** */
253
- navigationPickerProps?: Partial<
254
- Omit<
255
- DateCalendarProps,
256
- "open" | "onClose" | "openTo" | "views" | "value" | "readOnly" | "onChange"
257
- >
258
- >;
259
- /**Events to display */
260
- events: ProcessedEvent[];
261
- /** Custom event render method */
262
- eventRenderer?: (props: EventRendererProps) => React.ReactNode | null;
263
- /**Async function to load remote data with current view data. */
264
- getRemoteEvents?(params: RemoteQuery): Promise<ProcessedEvent[] | void>;
265
- /**Custom additional fields with it's settings */
266
- fields: FieldProps[];
267
- /**Table loading state */
268
- loading?: boolean;
269
- /** Custom loading component */
270
- loadingComponent?: React.ReactNode;
271
- /**Async function triggered when add/edit event */
272
- onConfirm?(event: ProcessedEvent, action: EventActions): Promise<ProcessedEvent>;
273
- /**Async function triggered when delete event */
274
- onDelete?(deletedId: string | number): Promise<string | number | void>;
275
- /**Override editor modal */
276
- customEditor?(scheduler: SchedulerHelpers): React.ReactNode;
277
- /** Custom viewer/popper component. If used, `viewerExtraComponent` & `viewerTitleComponent` will be ignored */
278
- customViewer?(event: ProcessedEvent, close: () => void): React.ReactNode;
279
- /**Additional component in event viewer popper */
280
- viewerExtraComponent?:
281
- | React.ReactNode
282
- | ((fields: FieldProps[], event: ProcessedEvent) => React.ReactNode);
283
- /**Override viewer title component */
284
- viewerTitleComponent?(event: ProcessedEvent): React.ReactNode;
285
- /**Override viewer subtitle component */
286
- viewerSubtitleComponent?(event: ProcessedEvent): React.ReactNode;
287
- /** if true, the viewer popover will be disabled globally */
288
- disableViewer?: boolean;
289
- /**Resources array to split event views with resources */
290
- resources: DefaultResource[];
291
- /**Map resources fields */
292
- resourceFields: ResourceFields;
293
- /**Override header component of resource */
294
- resourceHeaderComponent?(resource: DefaultResource): React.ReactNode;
295
- /** Triggered when resource tabs changes */
296
- onResourceChange?(resource: DefaultResource): void;
297
- /**Resource header view mode
298
- * @default "default"
299
- */
300
- resourceViewMode: "default" | "vertical" | "tabs";
301
- /**Direction of table */
302
- direction: "rtl" | "ltr";
303
- /**Editor dialog maxWith
304
- * @default "md"
305
- */
306
- dialogMaxWidth: DialogProps["maxWidth"];
307
- /**
308
- * date-fns Locale object
309
- */
310
- locale: Locale;
311
- /**
312
- * Localization
313
- */
314
- translations: Translations;
315
- /**
316
- * Hour Format
317
- */
318
- hourFormat: "12" | "24";
319
- /**
320
- * Time zone IANA ID: https://data.iana.org/time-zones/releases
321
- */
322
- timeZone?: string;
323
- /**
324
- * Triggered when event is dropped on time slot.
325
- */
326
- onEventDrop?(
327
- event: DragEvent<HTMLButtonElement>,
328
- droppedOn: Date,
329
- updatedEvent: ProcessedEvent,
330
- originalEvent: ProcessedEvent
331
- ): Promise<ProcessedEvent | void>;
332
- /**
333
- *
334
- */
335
- onEventClick?(event: ProcessedEvent): void;
336
- /**
337
- * Triggered when an event item is being edited from the popover
338
- */
339
- onEventEdit?(event: ProcessedEvent): void;
340
- /**
341
- * If event is deletable, applied to all events globally, overridden by event specific deletable prop
342
- * @default true
343
- */
344
- deletable?: boolean;
345
- /**
346
- * If calendar is editable, applied to all events/cells globally, overridden by event specific editable prop
347
- * @default true
348
- */
349
- editable?: boolean;
350
- /**
351
- * If event is draggable, applied to all events globally, overridden by event specific draggable prop
352
- * @default true
353
- */
354
- draggable?: boolean;
355
- /**
356
- * Triggered when the `selectedDate` prop changes by navigation date picker or `today` button.
357
- */
358
- onSelectedDateChange?(date: Date): void;
359
- /**
360
- * Triggered when navigation view changes.
361
- */
362
- onViewChange?(view: View, agenda?: boolean): void;
363
- /**
364
- * If true, the navigation controller bar will be sticky
365
- */
366
- stickyNavigation?: boolean;
367
- /**
368
- * Overrides the default behavior of more events button
369
- */
370
- onClickMore?(date: Date, gotToDay: (date: Date) => void): void;
371
- /**
372
- *
373
- */
374
- onCellClick?(start: Date, end: Date, resourceKey?: string, resourceVal?: string | number): void;
375
- /**
376
- * Custom content to display in the scheduler header.
377
- * Wrap with useCallback if using state/props to avoid re-renders.
378
- *
379
- * @example
380
- * const header = useCallback(() => <Button>{state}</Button>, [state]);
381
- */
382
- customHeaderContent?: () => React.ReactNode;
383
- /**
384
- * Top offset when sticky navigation is enabled (in pixels).
385
- * @default 0
386
- */
387
- stickyNavigationOffset?: number;
388
- /**
389
- * Height of the sticky navigation header in pixels.
390
- * Used to calculate offset for sticky elements below the header.
391
- * @default 40
392
- */
393
- stickyNavigationHeight?: number;
394
- /**
395
- * Override the current time used for the red indicator bar.
396
- * Useful when working with different timezones or for testing.
397
- */
398
- currentTime?: Date;
399
- /**
400
- * Show/hide the current time indicator bar.
401
- * @default true
402
- */
403
- showCurrentTimeBar?: boolean;
404
- /**
405
- * Color of the current time indicator bar.
406
- * @default theme.palette.error.light (red)
407
- */
408
- currentTimeBarColor?: string;
409
- /**
410
- * When true, events spanning multiple days with allDay: false
411
- * will be displayed in the time grid instead of the all-day header.
412
- * Events will be split visually at midnight boundaries.
413
- * @default false
414
- */
415
- forceInlineMultiDay?: boolean;
416
- }
417
-
418
- export interface SchedulerRef {
419
- el: HTMLDivElement;
420
- scheduler: Store;
421
- }
422
-
423
- export interface Scheduler extends Partial<SchedulerProps> {}