react-big-schedule 8.1.0 → 9.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.
Files changed (109) hide show
  1. package/README.md +20 -1129
  2. package/dist/calendar/Calendar.d.ts +28 -0
  3. package/dist/calendar/Calendar.js +95 -0
  4. package/dist/calendar/Toolbar.d.ts +18 -0
  5. package/dist/calendar/Toolbar.js +6 -0
  6. package/dist/calendar/recurrence.check.d.ts +1 -0
  7. package/dist/calendar/recurrence.check.js +49 -0
  8. package/dist/calendar/recurrence.d.ts +8 -0
  9. package/dist/calendar/recurrence.js +90 -0
  10. package/dist/calendar/timezone.d.ts +6 -0
  11. package/dist/calendar/timezone.js +14 -0
  12. package/dist/calendar/types.d.ts +187 -0
  13. package/dist/calendar/types.js +1 -0
  14. package/dist/calendar/useEventSources.d.ts +11 -0
  15. package/dist/calendar/useEventSources.js +89 -0
  16. package/dist/calendar/useRecurrence.d.ts +4 -0
  17. package/dist/calendar/useRecurrence.js +15 -0
  18. package/dist/calendar/utils.d.ts +38 -0
  19. package/dist/calendar/utils.js +143 -0
  20. package/dist/calendar/views/DayGridView.d.ts +3 -0
  21. package/dist/calendar/views/DayGridView.js +375 -0
  22. package/dist/calendar/views/ListView.d.ts +4 -0
  23. package/dist/calendar/views/ListView.js +56 -0
  24. package/dist/calendar/views/MultiMonthView.d.ts +4 -0
  25. package/dist/calendar/views/MultiMonthView.js +36 -0
  26. package/dist/calendar/views/TimeGridView.d.ts +3 -0
  27. package/dist/calendar/views/TimeGridView.js +334 -0
  28. package/dist/calendar/views/daygrid/DayCell.d.ts +19 -0
  29. package/dist/calendar/views/daygrid/DayCell.js +17 -0
  30. package/dist/calendar/views/daygrid/EventChip.d.ts +19 -0
  31. package/dist/calendar/views/daygrid/EventChip.js +40 -0
  32. package/dist/calendar/views/daygrid/layout.d.ts +30 -0
  33. package/dist/calendar/views/daygrid/layout.js +63 -0
  34. package/dist/calendar/views/list/bucket.d.ts +8 -0
  35. package/dist/calendar/views/list/bucket.js +37 -0
  36. package/dist/calendar/views/multimonth/Cell.d.ts +12 -0
  37. package/dist/calendar/views/multimonth/Cell.js +44 -0
  38. package/dist/calendar/views/multimonth/Continuous.d.ts +8 -0
  39. package/dist/calendar/views/multimonth/Continuous.js +28 -0
  40. package/dist/calendar/views/multimonth/MonthGrid.d.ts +10 -0
  41. package/dist/calendar/views/multimonth/MonthGrid.js +36 -0
  42. package/dist/calendar/views/multimonth/shared.d.ts +27 -0
  43. package/dist/calendar/views/multimonth/shared.js +40 -0
  44. package/dist/calendar/views/timegrid/DayColumn.d.ts +49 -0
  45. package/dist/calendar/views/timegrid/DayColumn.js +86 -0
  46. package/dist/calendar/views/timegrid/model.d.ts +55 -0
  47. package/dist/calendar/views/timegrid/model.js +102 -0
  48. package/dist/components/AddMore.d.ts +13 -0
  49. package/dist/components/AddMore.js +9 -42
  50. package/dist/components/AddMorePopover.d.ts +13 -0
  51. package/dist/components/AddMorePopover.js +24 -95
  52. package/dist/components/AgendaEventItem.d.ts +10 -0
  53. package/dist/components/AgendaEventItem.js +33 -81
  54. package/dist/components/AgendaResourceEvents.d.ts +10 -0
  55. package/dist/components/AgendaResourceEvents.js +37 -91
  56. package/dist/components/AgendaView.d.ts +9 -0
  57. package/dist/components/AgendaView.js +10 -69
  58. package/dist/components/BodyView.d.ts +11 -0
  59. package/dist/components/BodyView.js +36 -67
  60. package/dist/components/DnDContext.d.ts +48 -0
  61. package/dist/components/DnDContext.js +200 -221
  62. package/dist/components/DnDSource.d.ts +49 -0
  63. package/dist/components/DnDSource.js +125 -120
  64. package/dist/components/EventItem.d.ts +41 -0
  65. package/dist/components/EventItem.js +585 -787
  66. package/dist/components/EventItemPopover.d.ts +12 -0
  67. package/dist/components/EventItemPopover.js +19 -143
  68. package/dist/components/HeaderView.d.ts +14 -0
  69. package/dist/components/HeaderView.js +123 -186
  70. package/dist/components/ResourceEvents.d.ts +54 -0
  71. package/dist/components/ResourceEvents.js +534 -703
  72. package/dist/components/ResourceView.d.ts +26 -0
  73. package/dist/components/ResourceView.js +64 -184
  74. package/dist/components/SchedulerData.d.ts +136 -0
  75. package/dist/components/SchedulerData.js +1296 -1226
  76. package/dist/components/SchedulerHeader.d.ts +25 -0
  77. package/dist/components/SchedulerHeader.js +50 -150
  78. package/dist/components/SelectedArea.d.ts +8 -0
  79. package/dist/components/SelectedArea.js +11 -26
  80. package/dist/components/Summary.d.ts +11 -0
  81. package/dist/components/Summary.js +21 -50
  82. package/dist/components/WrapperFun.d.ts +2 -0
  83. package/dist/components/WrapperFun.js +5 -10
  84. package/dist/components/index.d.ts +44 -0
  85. package/dist/components/index.js +428 -654
  86. package/dist/components/ui/Icons.d.ts +8 -0
  87. package/dist/components/ui/Icons.js +7 -0
  88. package/dist/components/ui/MiniCalendar.d.ts +9 -0
  89. package/dist/components/ui/MiniCalendar.js +17 -0
  90. package/dist/components/ui/Popover.d.ts +13 -0
  91. package/dist/components/ui/Popover.js +80 -0
  92. package/dist/config/default.d.ts +36 -0
  93. package/dist/config/default.js +17 -26
  94. package/dist/config/i18n.d.ts +27 -0
  95. package/dist/config/i18n.js +21 -37
  96. package/dist/config/scheduler.d.ts +12 -0
  97. package/dist/config/scheduler.js +126 -119
  98. package/dist/css/style.css +2 -316
  99. package/dist/helper/behaviors.d.ts +14 -0
  100. package/dist/helper/behaviors.js +75 -75
  101. package/dist/helper/utility.d.ts +26 -0
  102. package/dist/helper/utility.js +23 -30
  103. package/dist/index.d.ts +6 -477
  104. package/dist/index.js +4 -2
  105. package/dist/sample-data/sample1.d.ts +11 -0
  106. package/dist/sample-data/sample1.js +427 -372
  107. package/dist/types.d.ts +267 -0
  108. package/dist/types.js +1 -0
  109. package/package.json +35 -26
package/README.md CHANGED
@@ -1,1155 +1,46 @@
1
- # React Big Schedule (react-big-schedule)
1
+ # React Big Schedule
2
2
 
3
- [![NPM version][npm-image]][npm-url] [![MIT License][mit-image]][mit-url] [![CodeFactor][codeFactor-badge]][codeFactor-link]
3
+ [![NPM version][npm-image]][npm-url] [![MIT License][mit-image]][mit-url]
4
4
 
5
5
  [npm-image]: http://img.shields.io/npm/v/react-big-schedule.svg
6
6
  [npm-url]: http://npmjs.org/package/react-big-schedule
7
7
  [mit-image]: https://img.shields.io/badge/License-MIT-green.svg
8
8
  [mit-url]: https://github.com/ansulagrawal/react-big-schedule/blob/master/LICENSE
9
- [codeFactor-badge]: https://www.codefactor.io/repository/github/ansulagrawal/react-big-schedule/badge
10
- [codeFactor-link]: https://www.codefactor.io/repository/github/ansulagrawal/react-big-schedule
11
9
 
12
- React Big Schedule is a powerful and intuitive scheduler and resource planning solution built with React. Seamlessly integrate this modern, browser-compatible component into your applications to effectively manage time, appointments, and resources. With drag-and-drop functionality, interactive UI, and granular views, react-big-schedule empowers users to effortlessly schedule and allocate resources with precision.
10
+ A free, MIT-licensed React calendar and resource scheduler: month, week, day, list and year views, a resource timeline, drag and drop, event sources, recurring events, time zones, five design styles with palettes, light and dark. TypeScript, no UI library.
13
11
 
14
- Enhance productivity and streamline your workflow with this React-based solution, designed to optimize time management and simplify calendar-based operations. Perfect for applications requiring advanced scheduling capabilities, react-big-schedule offers a seamless and intuitive experience for managing appointments, resource allocation, and time slots.
12
+ **Documentation, live demos and the full API: https://react-big-schedule.vercel.app**
15
13
 
16
- Unlock the potential of your React projects with react-big-schedule and revolutionize the way you handle scheduling and resource planning.
17
-
18
- ### This project code is forked from:
19
-
20
- - [react-big-scheduler](https://github.com/StephenChou1017/react-big-scheduler).
21
- - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
22
-
23
- ## Installation
24
-
25
- To install react-big-schedule, use your preferred package manager:
14
+ ## Install
26
15
 
27
16
  ```bash
28
- # npm
29
17
  npm install react-big-schedule
30
-
31
- # yarn
32
- yarn add react-big-schedule
33
-
34
- # pnpm
35
- pnpm add react-big-schedule
36
-
37
- # bun
38
- bun add react-big-schedule
39
- ```
40
-
41
- ## Tech Stack
42
-
43
- - React
44
- - Ant Design
45
- - react-dnd
46
- - react-dnd-html5-backend
47
- - webpack
48
- - dayjs
49
- - Biome (Linting & Formatting)
50
-
51
- ## Features
52
-
53
- - Modern and intuitive scheduler component for React applications.
54
- - Seamless integration with React projects.
55
- - Drag-and-drop functionality for effortless scheduling.
56
- - Interactive user interface for a smooth user experience
57
- - Granular views to manage time, appointments, and resources effectively.
58
- - Optimized for time management and calendar-based operations.
59
- - Perfect for applications requiring advanced scheduling capabilities.
60
-
61
- ## Contributions
62
-
63
- Contributions to react-big-schedule are welcome! If you find a bug or want to contribute to the project, please follow these steps:
64
-
65
- 1. Fork the repository on GitHub.
66
- 2. Create a new branch with a descriptive name.
67
- 3. Make your changes and commit them with clear messages.
68
- 4. Push your changes to your forked repository.
69
- 5. Submit a pull request to the master repository.
70
-
71
- Please ensure that your code adheres to the project's coding conventions and includes appropriate tests.
72
-
73
- ## License
74
-
75
- React Big Schedule is released under the MIT License. See the [LICENSE](https://github.com/ansulagrawal/react-big-schedule/blob/master/LICENSE) file for more details.
76
-
77
- ## Support
78
-
79
- If you have any questions or need support, please create an issue in the [GitHub repository](https://github.com/ansulagrawal/react-big-schedule/issues).
80
-
81
- ## Credits
82
-
83
- React Big Schedule is developed and maintained by the React Big Schedule team. We would like to thank the open-source community for their valuable contributions and feedback.
84
-
85
- Special thanks to the following contributors:
86
-
87
- - Ansul Agrawal ([@ansulagrawal](https://github.com/ansulagrawal))
88
- - Jitendra Soni ([@JitendraSoni1234](https://github.com/JitendraSoni1234))
89
- - hbatalhaStch [[@hbatalhaStch](https://github.com/hbatalhaStch))
90
- - DamyanBG ([@DamyanBG](https://github.com/DamyanBG))
91
-
92
- ## Acknowledgments
93
-
94
- We would like to acknowledge the following projects for their inspiration and contributions:
95
-
96
- - [react-big-scheduler](https://github.com/StephenChou1017/react-big-scheduler).
97
- - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
98
-
99
- ## Roadmap
100
-
101
- - Additional view options for different scheduling needs.
102
- - Support for recurring appointments.
103
- - Integration with popular calendar services.
104
- - Improved accessibility and localization support.
105
- - Performance optimizations for handling large data sets.
106
-
107
- We are continuously working on enhancing react-big-schedule and welcome your feedback and suggestions for future improvements.
108
-
109
-
110
- ## Supported versions
111
-
112
- Only **8.0.0 or later** is supported. Issues and security reports for older versions are not handled; please upgrade to the latest release first.
113
-
114
- ### Upgrading to 8.0
115
-
116
- - `besidesWidth` and `SchedulerData.setBesidesWidth()` are removed. The scheduler measures its own container, so just delete the option.
117
- - The locale is kept per `SchedulerData` instance (`setSchedulerLocale` / `localeDayjs.locale`) and no longer changes the global dayjs. Call `dayjs.locale(...)` yourself if your app needs the global locale to change.
118
- - Events in the vertical resource view can now be moved and resized like in the horizontal views. Set `movable`, `startResizable` and `endResizable` to `false` in the config to keep that view read-only.
119
-
120
- ## Use and Setup
121
-
122
- 1.) To install react-big-schedule, use your preferred package manager:
123
-
124
- ```bash
125
- # npm
126
- npm install react-big-schedule
127
-
128
- # yarn
129
- yarn add react-big-schedule
130
-
131
- # pnpm
132
- pnpm add react-big-schedule
133
-
134
- # bun
135
- bun add react-big-schedule
136
- ```
137
-
138
- 2.) Import dependencies
139
-
140
- ```
141
- import { Scheduler, SchedulerData, ViewType, DATE_FORMAT } from "react-big-schedule";
142
- import dayjs from "dayjs";
143
- import "react-big-schedule/dist/css/style.css";
144
- ```
145
-
146
- 3.) Basic Usage
147
-
148
- ```js
149
- const schedulerData = new SchedulerData(new dayjs().format(DATE_FORMAT), ViewType.Week);
150
-
151
- //set locale dayjs to the schedulerData, if your locale isn't English. By default, Scheduler comes with English(en, United States).
152
- schedulerData.setSchedulerLocale('pt-br'); // this uses dayjs, but it doesn't require dayjs to be installed as its called dynamically
153
- schedulerData.setCalendarPopoverLocale('pt_BR'); // this uses antd [List of supported locales](https://ant.design/docs/react/i18n#supported-languages)
154
-
155
- schedulerData.setResources([
156
- { id: 'r0', name: 'Resource0', groupOnly: true },
157
- { id: 'r1', name: 'Resource1' },
158
- { id: 'r2', name: 'Resource2', parentId: 'r0' },
159
- { id: 'r3', name: 'Resource3', parentId: 'r4' },
160
- { id: 'r4', name: 'Resource4', parentId: 'r2' },
161
- ]);
162
-
163
- // the event array should be sorted in ascending order by event.start property
164
- // otherwise there will be some rendering errors
165
- schedulerData.setEvents([
166
- {
167
- id: 1,
168
- start: '2022-12-18 09:30:00',
169
- end: '2022-12-19 23:30:00',
170
- resourceId: 'r1',
171
- title: 'I am finished',
172
- bgColor: '#D9D9D9',
173
- },
174
- {
175
- id: 2,
176
- start: '2022-12-18 12:30:00',
177
- end: '2022-12-26 23:30:00',
178
- resourceId: 'r2',
179
- title: 'I am not resizable',
180
- resizable: false,
181
- },
182
- {
183
- id: 3,
184
- start: '2022-12-19 12:30:00',
185
- end: '2022-12-20 23:30:00',
186
- resourceId: 'r3',
187
- title: 'I am not movable',
188
- movable: false,
189
- },
190
- {
191
- id: 4,
192
- start: '2022-12-19 14:30:00',
193
- end: '2022-12-20 23:30:00',
194
- resourceId: 'r1',
195
- title: 'I am not start-resizable',
196
- startResizable: false,
197
- },
198
- {
199
- id: 5,
200
- start: '2022-12-19 15:30:00',
201
- end: '2022-12-20 23:30:00',
202
- resourceId: 'r2',
203
- title: 'R2 has recurring tasks every week on Tuesday, Friday',
204
- rrule: 'FREQ=WEEKLY;DTSTART=20221219T013000Z;BYDAY=TU,FR',
205
- bgColor: '#f759ab',
206
- },
207
- ]);
208
-
209
- // ...
210
-
211
- //3. render the scheduler component, mind that the Scheduler component should be placed in a DragDropContext(father or ancestor).
212
-
213
- <Scheduler
214
- schedulerData={schedulerData}
215
- prevClick={this.prevClick}
216
- nextClick={this.nextClick}
217
- onSelectDate={this.onSelectDate}
218
- onViewChange={this.onViewChange}
219
- eventItemClick={this.eventClicked}
220
- />;
221
- ```
222
-
223
- ### Run examples locally
224
-
225
- - Clone this repository
226
- - Retrieve dependencies: `npm install` (or `yarn`, `pnpm`, `bun install`)
227
- - Check & Fix: `npm run fix`
228
- - Start: `npm run dev`
229
- - Open [http://localhost:8080](http://localhost:8080).
230
-
231
- If you fail to execute the installation command, remove the lock file (e.g., `package-lock.json`, `bun.lockb`) and try again.
232
-
233
- # API
234
-
235
- ### SchedulerData
236
-
237
- SchedulerData is the view model of Scheduler, we can modify it to control the view of the Scheduler.
238
-
239
- #### constructor
240
-
241
- ```js
242
- constructor(date=dayjs().format(DATE_FORMAT), viewType = ViewType.Week,
243
- showAgenda = false, isEventPerspective = false,
244
- newConfig = undefined, newBehaviors=undefined
245
- localeDayjs = undefined)
246
- ```
247
-
248
- - `date` is a string in `YYYY-MM-DD` format, and is the initial date Scheduler will render. Take the date `2022-12-20`
249
- for example, Scheduler will render the time window of the week from `2022-12-18` to `2022-12-24` in `ViewType.Week`
250
- view type, and will render the time window of the `2022-12` month in `ViewType.Month` view type.
251
- - `viewType` is the initial view type, now Scheduler supports `Day`, `Week`, `Month`, `Quarter`, `Year` 5 built-in view types,
252
- in addition Scheduler now supports `Custom`, `Custom1`, `Custom2` 3 custom view types at the same time, in which you can control
253
- the time window yourself, refer to [this example](https://react-big-schedule.vercel.app/custom-time). `viewType`,
254
- `showAgenda` and `isEventPerspective` are a group which should be contained in the SchedulerData.config.views array,
255
- and they together decide which view should be rendered. When `showAgenda` and `isEventPerspective` are both `false`,
256
- Scheduler will render the resource view, refer to [this example](https://react-big-schedule.vercel.app/basic).
257
- - `showAgenda` is a bool value, if true, Scheduler will display the agenda view of current view type. Agenda view is
258
- read only.
259
- - `isEventPerspective` is a bool value, if true, Scheduler will display the task view of current view type. In
260
- resource view, every slot(row) describes how many events a resource does in the time window, while in task view,
261
- every slot describes how many events a big task is divided into and who will make it done. Add a `groupId` and
262
- `groupName` property to every event object, so that the events having the same `groupId` will belong to the same big task and
263
- be rendered in the same slot in task view. If `groupId` and `groupName` are not provided, SchedulerData will take
264
- the `id` as the `groupId`, and take the `title` as the `groupName`. See the `eventsForTaskView` in the
265
- [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js) for details.
266
- - `newConfig` is a config object, used to override the [default config](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/config/scheduler.js)
267
- fully or partly.
268
- - `newBehaviors` is a config object, used to override the [default behaviors](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js)
269
- fully or partly.
270
- - `localeDayjs` is a locale dayjs object, which is unified used in react-big-scheduler. If not provided, Scheduler will come
271
- with English(en, United States) locale strings.
272
-
273
- #### Using SchedulerData with React state
274
-
275
- `SchedulerData` is mutable; its methods (`prev`, `next`, `setDate`, `setViewType`, `setEvents`, ...) notify the `Scheduler`, which re-renders itself. With a functional component, keep the same instance in state and call the methods in your handlers, then call `setState` with a new object only if you need the parent to re-render too:
276
-
277
- ```jsx
278
- const [schedulerData, setSchedulerData] = useState(() => new SchedulerData(dayjs(), ViewType.Week));
279
-
280
- const prevClick = data => {
281
- data.prev();
282
- data.setEvents(events);
283
- setSchedulerData(Object.assign(Object.create(Object.getPrototypeOf(data)), data)); // optional
284
- };
285
- ```
286
-
287
- #### Vertical resource view
288
-
289
- `ViewType.VerticalResource` shows resources as columns and time as rows. Events render and drag-to-create works across resources and time slots. Drag an event to another resource column and/or time row to move it (`moveEvent` receives the resource as `slotId`), and drag its top or bottom edge to change its start or end (`updateEventStart` / `updateEventEnd`). Row height grows with the number of overlapping events, like the horizontal views. Refer to [this example](https://react-big-schedule.vercel.app/vertical-view).
290
-
291
- #### Drop preview
292
-
293
- While an event, task or resource is dragged over a row, the cells where it would be placed are highlighted. Configure it in the `SchedulerData` config: `dropPreviewEnabled` (default `true`), `dropPreviewClassName` and `dropPreviewStyle` (an inline style object, e.g. `{ border: '2px dashed #52c41a', background: 'rgba(82, 196, 26, 0.16)' }`). Refer to [this example](https://react-big-schedule.vercel.app/drag-and-drop).
294
-
295
- #### Weekly / monthly columns
296
-
297
- Columns are days or hours by default. A custom view (`ViewType.Custom`, `Custom1`, `Custom2`) picks its own cadence through `behaviors.getCustomDateFunc`, which returns `cellUnit: CellUnit.Week`, `CellUnit.Month`, `CellUnit.Quarter` or `CellUnit.Year` along with the date range. Events then span the week/month cells they overlap. Header text comes from `nonAgendaWeekCellHeaderFormat` / `nonAgendaMonthCellHeaderFormat` / `nonAgendaQuarterCellHeaderFormat` / `nonAgendaYearCellHeaderFormat` (use `|` to split a header into lines). Per-cell totals come from `behaviors.getSummaryFunc`. Refer to [this example](https://react-big-schedule.vercel.app/cadence).
298
-
299
- #### Theming with antd `ConfigProvider`
300
-
301
- The antd parts (header controls, date picker popover, event popover) pick up an antd `ConfigProvider` placed above `<Scheduler>`, so antd theme tokens apply to them. The timeline grid itself is styled by the scheduler's own CSS.
302
-
303
- ```jsx
304
- <ConfigProvider theme={{ token: { colorPrimary: '#722ed1' } }}>
305
- <Scheduler schedulerData={schedulerData} /* ... */ />
306
- </ConfigProvider>
307
- ```
308
-
309
- #### setSchedulerLocale
310
-
311
- ```js
312
- setSchedulerLocale(preset);
313
- ```
314
-
315
- Used to set locale to the scheduler, it uses dayjs locales ([List of supported locales](https://github.com/iamkun/dayjs/tree/dev/src/locale)) and it is loaded on demand.
316
-
317
- `preset` will be locale imported from dayjs.
318
-
319
- #### example:
320
-
321
- ```js
322
- import * as dayjsLocale from 'dayjs/locale/pt-br';
323
-
324
- setSchedulerLocale(dayjsLocale);
325
- ```
326
-
327
- The locale is kept per `SchedulerData` instance, so several schedulers (and your own dayjs usage) can use different locales without affecting each other.
328
-
329
- By default, Scheduler comes with English(en, United States)
330
-
331
- #### setCalendarPopoverLocale
332
-
333
- ```js
334
- setCalendarPopoverLocale(lang);
335
- ```
336
-
337
- Used to set locale to the calendar popover. it uses antd locales ([List of supported locales](https://ant.design/docs/react/i18n#supported-languages)). By default, it comes with English(en, United States)
338
-
339
- #### example:
340
-
341
- ```js
342
- import * as antdLocale from 'antd/locale/pt_BR';
343
-
344
- setCalendarPopoverLocale(antdLocale);
345
- ```
346
-
347
- refer this for the demo of the locale.
348
-
349
- #### setResources
350
-
351
- ```js
352
- setResources(resources);
353
- ```
354
-
355
- Used to set the resources(the slots in resource view), make sure that there are no duplicated `resource.id` in the `resources`.
356
- See the demo `resources` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js).
357
-
358
- #### setEvents
359
-
360
- ```js
361
- setEvents(events);
362
- ```
363
-
364
- Used to set the events. the event array should be sorted in ascending order by event.start property.
365
- See the demo `events` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js).
366
- If we use the task view, we'd better add the `groupId` and the `groupName` property to each event object, see the
367
- `eventsForTaskView` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js) for details.
368
-
369
- ## Event Date Formats
370
-
371
- Events support both `YYYY-MM-DD HH:mm:ss` datetime strings and `YYYY-MM-DD` date-only strings for `start` and `end`.
372
- Date-only events are treated as spanning the full calendar day. Month view and the other scheduler views handle both
373
- formats consistently.
374
-
375
- #### prev
376
-
377
- ```js
378
- prev();
379
- ```
380
-
381
- Let the time window scroll to the left once. When `SchedulerData,viewType` is `ViewType.Month`, the time window will
382
- scroll a month, when `SchedulerData,viewType` is `ViewType.Week`, the time window will scroll a week. `SchedulerData.events`
383
- will be clear after calling this method.
384
-
385
- #### next
386
-
387
- ```js
388
- next();
389
- ```
390
-
391
- Let the time window scroll to the right once. `SchedulerData.events` will be clear after calling this method.
392
-
393
- #### setDate
394
-
395
- ```js
396
- setDate((date = dayjs().format(DATE_FORMAT)));
397
- ```
398
-
399
- Let the time window jump to the provided `date` directly. `SchedulerData.events` will be clear after calling this method.
400
-
401
- #### setViewType
402
-
403
- ```js
404
- setViewType((viewType = ViewType.Week), (showAgenda = false), (isEventPerspective = false));
405
- ```
406
-
407
- Tell SchedulerData to change current view, the `viewType`, `showAgenda` and `isEventPerspective` group should be
408
- provided, and should be contained in the `SchedulerData.config.views` array. `SchedulerData.events` will be clear
409
- after calling this method.
410
-
411
- #### setEventGroups
412
-
413
- ```js
414
- setEventGroups(eventGroups);
415
- ```
416
-
417
- Used to set the event groups(the slots in task view), make sure that there are no duplicated `eventGroup.id` in the `eventGroups`.
418
- This method is optional, and is needed only when `SchedulerData.eventGroupsAutoGenerated` is `false`.
419
-
420
- #### setEventGroupsAutoGenerated
421
-
422
- ```js
423
- setEventGroupsAutoGenerated(autoGenerated);
424
- ```
425
-
426
- Tell SchedulerData to generate `SchedulerData.eventGroups` automatically or not. If `true`, SchedulerData will generate the event
427
- groups(slots) automatically according to the `event.groupId` and 'event.groupName' automatically. If `groupId` and 'groupName' are
428
- not provided, SchedulerData will take `event.id` and `event.title` instead.
429
-
430
- #### setMinuteStep
431
-
432
- ```js
433
- setMinuteStep(minuteStep);
434
- ```
435
-
436
- Used to set minute step for daily view and refresh the render data.
437
-
438
- #### toggleExpandStatus
439
-
440
- ```js
441
- toggleExpandStatus(slotId);
442
- ```
443
-
444
- Used to toggle slot's(and its children's) expand status.
445
-
446
- #### getMinuteStepsInHour
447
-
448
- ```js
449
- getMinuteStepsInHour();
450
- ```
451
-
452
- Used to get minute steps in an hour, it equals 60 / SchedulerData.config.minuteStep.
453
-
454
- #### addResource
455
-
456
- ```js
457
- addResource(resource);
458
- ```
459
-
460
- Add the `resource` to the `SchedulerData.resources`, make sure that `resource.id` is not duplicated. Refer
461
- to [this example](https://react-big-schedule.vercel.app/customization).
462
-
463
- #### addEventGroup
464
-
465
- ```js
466
- addEventGroup(eventGroup);
467
- ```
468
-
469
- Add the `eventGroup` to the `SchedulerData.eventGroups`, make sure that `eventGroup.id` is not duplicated. Please note
470
- that the `eventGroup` added may be override when `SchedulerData.eventGroupsAutoGenerated` is `true` and
471
- `SchedulerData.eventGroups` is auto-generated.
472
-
473
- #### addEvent
474
-
475
- ```js
476
- addEvent(newEvent);
477
- ```
478
-
479
- Add the `newEvent` to the `SchedulerData.events`, make sure that `newEvent.id` is not duplicated. SchedulerData will
480
- place the `newEvent` in the right index according to the `newEvent.start` property.
481
-
482
- #### updateEventStart
483
-
484
- ```js
485
- updateEventStart(event, newStart);
486
- ```
487
-
488
- Update the `newStart` to the `event.start`, `newStart` is a string in `YYYY-MM-DD HH:mm:ss` format(similarly hereinafter).
489
- SchedulerData will replace the `event` in the right index according to the `newStart` value.
490
-
491
- #### updateEventEnd
492
-
493
- ```js
494
- updateEventEnd(event, newEnd);
495
- ```
496
-
497
- Update the `newEnd` to the `event.end`.
498
-
499
- #### moveEvent
500
-
501
- ```js
502
- moveEvent(event, newSlotId, newSlotName, newStart, newEnd);
503
- ```
504
-
505
- Update the `newSlotId`, `newSlotName`, `newStart`, `newEnd` of the `event`. In resource view, new slot is a resource,
506
- while in task view, new slot is a event group. SchedulerData will replace the `event` in the right index according
507
- to the `newStart` value.
508
-
509
- #### removeEvent
510
-
511
- ```js
512
- removeEvent(event);
513
- ```
514
-
515
- Remove the given event from `SchedeulerData.events`.
516
-
517
- #### removeEventById
518
-
519
- ```js
520
- removeEventById(eventId);
521
- ```
522
-
523
- Remove event from `SchedeulerData.events` by the given event id.
524
-
525
- #### getSlots
526
-
527
- ```js
528
- getSlots();
529
- ```
530
-
531
- Returns the slot array, `SchedulerData.resources` in resource view, `SchedulerData.eventGroups` in task view.
532
-
533
- #### getSlotById
534
-
535
- ```js
536
- getSlotById(slotId);
537
- ```
538
-
539
- Returns the slot by `slotId`, returns `undefined` if not found.
540
-
541
- #### getResourceById
542
-
543
- ```js
544
- getResourceById(resourceId);
545
- ```
546
-
547
- #### isEventInTimeWindow
548
-
549
- ```js
550
- isEventInTimeWindow(eventStart, eventEnd, windowStart, windowEnd);
551
- ```
552
-
553
- Returns whether an event is in the time window or not, remind that `eventStart`, `eventEnd`, `windowStart`, `windowEnd`
554
- are all dayjs | Date objects.
555
-
556
- #### getViewDates
557
-
558
- ```js
559
- getViewDates();
560
- ```
561
-
562
- Returns an object with the startDate and endDate of the currently selected view ({ startDate: Dayjs, endDate: Dayjs }).
563
-
564
- #### getViewStartDate
565
-
566
- ```js
567
- getViewStartDate();
568
- ```
569
-
570
- Returns a dayjs object with the startDate of the currently selected view.
571
-
572
- #### getViewEndDate
573
-
574
- ```js
575
- getViewEndDate();
576
- ```
577
-
578
- Returns a dayjs object with the endDate of the currently selected view.
579
-
580
- ### Locale support(Refer to [this example](https://react-big-schedule.vercel.app/custom-time) for details.)
581
-
582
- #### SchedulerData.config.resourceName
583
-
584
- The locale string of resource name.
585
-
586
- #### SchedulerData.config.taskName
587
-
588
- The locale string of task name.
589
-
590
- #### SchedulerData.config.agendaViewHeader
591
-
592
- The locale string of agenda view header.
593
-
594
- #### SchedulerData.config.addMorePopoverHeaderFormat
595
-
596
- The locale string of add more popover header format.
597
-
598
- #### SchedulerData.config.eventItemPopoverDateFormat
599
-
600
- The locale string of event item popover date format.
601
-
602
- #### SchedulerData.config.nonAgendaDayCellHeaderFormat
603
-
604
- The locale string of non-agenda view cell header format of day view type.
605
-
606
- #### SchedulerData.config.nonAgendaOtherCellHeaderFormat
607
-
608
- The locale string of non-agenda view cell header format of other view types.
609
-
610
- #### SchedulerData.behaviors.getDateLabelFunc
611
-
612
- Used to resolve the locale string of date label of Scheduler component.(Refer to the [getDateLabel](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js) func for example)
613
-
614
- ### SchedulerData.config(See the [config file](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/config/scheduler.js) for details.)
615
-
616
- #### schedulerWidth
617
-
618
- The width of Scheduler. Scheduler uses responsive layout so schedulerWidth should be a percentage.
619
-
620
- The Scheduler renders inside a container that is `width: 100%` and `max-height: 100%` of its parent, so it fills the parent
621
- and follows it when resized (it measures that container with a `ResizeObserver`).
622
- Resource columns keep their configured width and the time columns stretch to fill the rest.
623
-
624
- To size it differently, pass `className` (e.g. tailwind classes) or `style` to the `Scheduler` component, for example
625
- `<Scheduler className="w-1/2 max-h-[600px]" ... />`. Those win over the defaults, which have zero CSS specificity.
626
- When the parent has a fixed height the Scheduler scrolls inside it, otherwise it grows to fit its rows.
627
-
628
- #### responsiveByParent
629
-
630
- Only needed to make the Scheduler's *height* follow a parent element: pass that element through the `parentRef` prop of the
631
- Scheduler component. Without `parentRef` the window height is used.
632
-
633
- #### schedulerMaxHeight
634
-
635
- The max height of Scheduler. If the desired height is bigger than the max height, the header row of Scheduler will be
636
- frozen and vertical scroll bar will appear, but this won't happen when the max height is set to `0`. Refer
637
- to [this example](https://react-big-schedule.vercel.app/customization).
638
-
639
- **If you are using `responsiveByParent`, you can omit this setting or set it to `0` to ensure the Scheduler height conforms to the parent container.**
640
- When conforming to the parent container, the Scheduler will fill the available space and scroll bars will appear as needed.
641
-
642
- #### underneathHeight
643
-
644
- When using `responsiveByParent`, this property allows you to reserve space beneath the Scheduler (for example, for a footer or other fixed elements). The Scheduler's height will be reduced by this amount, ensuring it does not overlap with content below. Set this to the pixel height you want to reserve at the bottom of the parent container.
645
-
646
- **Example:** If your parent container is 600px tall and `underneathHeight` is 50, the Scheduler will use up to 550px of height.
647
-
648
- #### tableHeaderHeight
649
-
650
- Height of Scheduler table header.
651
-
652
- #### agendaResourceTableWidth
653
-
654
- Width of the left Scheduler resource column in agenda view.
655
-
656
- #### agendaMaxEventWidth
657
-
658
- Max width of an event item in agenda view.
659
-
660
- #### dayResourceTableWidth, weekResourceTableWidth, monthResourceTableWidth, yearResourceTableWidth, quarterResourceTableWidth
661
-
662
- Width of the left Scheduler resource column in resource view and task view of different view types.
663
-
664
- #### dayCellWidth, weekCellWidth, monthCellWidth, yearCellWidth, quarterCellWidth
665
-
666
- Width of Scheduler table cells in resource view and task view of different view types.
667
-
668
- #### dayMaxEvents, weekMaxEvents, monthMaxEvents, yearMaxEvents, quarterMaxEvents
669
-
670
- Max events count of a cell in resource view and task view of different view types. A '+N more' will appear when exceeded.
671
- Refer to [this example](https://react-big-schedule.vercel.app/add-more).
672
-
673
- #### eventItemHeight
674
-
675
- Height of an event item in 3 views.
676
-
677
- #### eventItemLineHeight
678
-
679
- Line height of an event item in 3 views.
680
-
681
- #### nonAgendaSlotMinHeight
682
-
683
- Min height of a slot in non-agenda views, default 0, means there is no min height.
684
-
685
- #### dayStartFrom
686
-
687
- Start hour rendered from in `ViewType.Day` in resource view and task view, default 0.
688
-
689
- #### dayStopTo
690
-
691
- End hour rendered to in `ViewType.Day` in resource view and task view, default 23.
692
-
693
- #### defaultEventBgColor
694
-
695
- Default event item background color in 3 views, will be override if there is a `bgColor` property in event object.
696
-
697
- #### selectedAreaColor
698
-
699
- Selected cells color in resource view and task view, cells are selectable only when `creatable` is `true`.
700
-
701
- #### nonWorkingTimeHeadColor
702
-
703
- Color of non-working time head cells. Modify `SchedulerData.behaviors.isNonWorkingTimeFunc` to re-define non-working time.
704
- Refer the `isNonWorkingTime` func in the [behaviors.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js).
705
-
706
- #### nonWorkingTimeHeadBgColor
707
-
708
- Background color of non-working time head cells.
709
-
710
- #### nonWorkingTimeBodyBgColor
711
-
712
- Background color of non-working time body cells.
713
-
714
- #### summaryColor
715
-
716
- Color of cell summary. Modify `SchedulerData.behaviors.getSummaryFunc` to display summary in a cell.
717
- Refer the `getSummary` func in the [behaviors.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js).
718
-
719
- #### summaryPos
720
-
721
- Position of cell summary, supports `SummaryPos.Top`, `SummaryPos.TopRight`, `SummaryPos.TopLeft`, `SummaryPos.Bottom`,
722
- `SummaryPos.BottomRight` and `SummaryPos.BottomLeft`.
723
-
724
- #### startResizable
725
-
726
- Controls whether to resize the start of every event item in resource view and task view. If `false`, all item starts are
727
- non-resizable, if `true`, all item starts are resizable except those who have a `resizable` or `startResizable`
728
- property and its value is `false`.
729
-
730
- #### endResizable
731
-
732
- Controls whether to resize the end of every event item in resource view and task view. If `false`, all item ends are
733
- non-resizable, if `true`, all item ends are resizable except those who have a `resizable` or `endResizable`
734
- property and its value is `false`.
735
-
736
- #### movable
737
-
738
- Controls whether to move every event item in resource view and task view. If `false`, all items are
739
- non-movable, if `true`, all items are movable except those who have a `movable` property and its value is `false`.
740
-
741
- #### creatable
742
-
743
- Controls whether to create new event item in resource view and task view.
744
-
745
- #### crossResourceMove
746
-
747
- Controls whether to cross-slot move an event item in resource view and task view. If `false`, the `slotId` and `slotName`
748
- won't change in the `moveEvent` method. Refer to [this example](https://react-big-schedule.vercel.app/customization).
749
-
750
- #### checkConflict
751
-
752
- Controls whether to check conflicts when creating, resizing or moving an event item in resource view and task view. If
753
- `true`, Scheduler will call the `conflictOccurred` function if given. Refer to
754
- [this example](https://react-big-schedule.vercel.app/customization).
755
-
756
- #### scrollToSpecialDayjsEnabled
757
-
758
- Controls Scheduler whether to scroll to special dayjs automatically when the time window contains special dayjs. If `true`, Scheduler
759
- horizontal bar will scroll to special dayjs after calling `setScrollToSpecialDayjs(true)` to SchedulerData. Use `SchedulerData.behaviors.getScrollSpecialDayjsFunc`
760
- to tell Scheduler what time the special dayjs is.
761
-
762
- #### eventItemPopoverEnabled
763
-
764
- Controls Scheduler whether to display event item popover when moving mouse on an event item, default `true`.
765
-
766
- #### eventItemPopoverTrigger
767
-
768
- Controls Scheduler event item popover trigger, default `hover`.
769
- Controls Scheduler whether to display event item popover when moving mouse on an event item, default `true`.
770
-
771
- #### eventItemPopoverPlacement
772
-
773
- Controls Scheduler event item popover placement (`'topLeftMousePosition' | 'bottomLeftMousePosition' | 'topRightMousePosition' | 'bottomRightMousePosition' | 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom'`), default `bottomLeft`.
774
-
775
- #### eventItemPopoverWidth
776
-
777
- Controls Scheduler event item popover width. Should be taken into account when you set `eventItemPopoverPlacement` to one of the `...MousePosition` options and you set your own event item popover by setting `eventItemPopoverTemplateResolver` as `eventItemPopoverWidth` is used to determine when the event item popover content goes off the screen so the popover can be adjusted accordingly. Defaults to 300.
778
-
779
- #### calendarPopoverEnabled
780
-
781
- Controls Scheduler whether to display calendar popover when clicking on a date label in header, default `true`.
782
-
783
- #### recurringEventsEnabled
784
-
785
- Controls Scheduler whether to support recurring event, refer to [this feature request](https://github.com/StephenChou1017/react-big-scheduler/issues/8), default `true`.
786
- If `true`, SchedulerData will filter out those template events who has a `rrule` string property in `setEvents` method,
787
- generate the recurring events in the time window, and insert them into the event array in the right orders. The recurring events
788
- generated from the same template event, all have a new id like `${templateEvent.id}-${number}`, and have a `recurringEventId`
789
- property with the value `templateEvent.id`.
790
-
791
- #### headerEnabled
792
-
793
- Controls Scheduler whether to display header, default `true`.
794
-
795
- #### resourceViewEnabled
796
-
797
- Controls Scheduler whether to display resource view, default `true`.
798
-
799
- #### displayWeekend
800
-
801
- Controls Scheduler whether to display weekends in non-agenda view, default `true`.
802
-
803
- #### relativeMove
804
-
805
- Controls Scheduler whether to move events(only DnDTypes.EVENT type) relatively or absolutely, default `true`, means relatively.
806
-
807
- #### minuteStep
808
-
809
- Minute step for day view type in non-agenda view, can be 10, 12, 15, 20, 30, 60, etc, default 30.
810
-
811
- #### views
812
-
813
- Array of view that Scheduler will support.
814
-
815
- #### dragAndDropEnabled
816
-
817
- Controls whether the dragAndDrop funcionality is enabled. If false there's no need for the [withDnDContext wrapper function](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/components/WrapperFun.jsx).
818
-
819
- ### SchedulerData.behaviors(See the [behaviors.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js) for details.)
820
-
821
- #### getEventTextFunc
822
-
823
- ```js
824
- getEventTextFunc(schedulerData, event);
825
- ```
826
-
827
- Method that defines the text displayed in the `event`.
828
-
829
- #### isNonWorkingTimeFunc
830
-
831
- ```js
832
- isNonWorkingTimeFunc(schedulerData, time);
833
- ```
834
-
835
- Method that defines non-working time.
836
-
837
- #### getSummaryFunc
838
-
839
- ```js
840
- getSummary(schedulerData, headerEvents, slotId, slotName, headerStart, headerEnd);
841
- ```
842
-
843
- Method that defines the summary text displayed in the Scheduler cells.Refer
844
- to [this example](https://react-big-schedule.vercel.app/customization).
845
-
846
- #### getCustomDateFunc
847
-
848
- ```js
849
- getCustomDate(schedulerData, num, (date = undefined));
850
- ```
851
-
852
- Method that controls the start and end of time window when current view type is Custom, Custom1 or Custom2.Refer
853
- to [this example](https://react-big-schedule.vercel.app/custom-time).
854
-
855
- #### getNonAgendaViewBodyCellBgColorFunc
856
-
857
- ```js
858
- getNonAgendaViewBodyCellBgColor(schedulerData, slotId, header);
859
- ```
860
-
861
- Method that sets the background color of cells dynamically.
862
-
863
- #### getScrollSpecialDayjsFunc
864
-
865
- ```js
866
- getScrollSpecialDayjs(schedulerData, startDayjs, endDayjs);
867
- ```
868
-
869
- Method that defines the special dayjs Scheduler will scroll to automatically, when the time window contains that dayjs.
870
-
871
- ### Scheduler.propTypes
872
-
873
- #### schedulerData
874
-
875
- ```js
876
- schedulerData: PropTypes.object.isRequired;
877
- ```
878
-
879
- View model of the Scheduler component, provides data.
880
-
881
- #### parentRef
882
-
883
- ```js
884
- parentRef: PropTypes.object;
885
- ```
886
-
887
- ref of the component that is the parent of the Scheduler component
888
-
889
- #### className
890
-
891
- ```js
892
- className: PropTypes.string;
893
- ```
894
-
895
- Class names for the Scheduler's container (e.g. tailwind classes such as `w-1/2 max-h-[600px]`). They override the default
896
- `width: 100%` / `max-height: 100%`.
897
-
898
- #### style
899
-
900
- ```js
901
- style: PropTypes.object;
902
- ```
903
-
904
- Inline style for the Scheduler's container.
905
-
906
- #### prevClick
907
-
908
- ```js
909
- prevClick: PropTypes.func.isRequired;
910
- prevClick(schedulerData);
18
+ # or: yarn add / pnpm add / bun add
911
19
  ```
912
20
 
913
- Callback function fired when the left point bracket '<' is clicked.
21
+ React 18 or 19 is a peer dependency. The package is ESM only and ships its own types.
914
22
 
915
- #### nextClick
916
-
917
- ```js
918
- nextClick: PropTypes.func.isRequired;
919
- nextClick(schedulerData);
920
- ```
23
+ ## Quick start
921
24
 
922
- Callback function fired when the right point bracket '>' is clicked.
25
+ ```tsx
26
+ import { Calendar } from 'react-big-schedule';
27
+ import 'react-big-schedule/dist/css/style.css';
923
28
 
924
- #### onViewChange
29
+ const events = [{ id: 1, title: 'Standup', start: '2026-10-12T09:00', end: '2026-10-12T09:30' }];
925
30
 
926
- ```js
927
- onViewChange: PropTypes.func.isRequired;
928
- onViewChange(schedulerData, view);
31
+ export default () => <Calendar events={events} theme="dark" look="material" palette="purple" editable selectable />;
929
32
  ```
930
33
 
931
- Callback function fired when the Scheduler view changed. `view` is a json such as { viewType: ViewType.Month,
932
- showAgenda: true, isEventPerspective: false}.
34
+ For the resource timeline use `Scheduler` with `SchedulerData`; see the website for a complete example.
933
35
 
934
- #### onSelectDate
36
+ ## Upgrading
935
37
 
936
- ```js
937
- onSelectDate: PropTypes.func.isRequired;
938
- onSelectDate(schedulerData, date);
939
- ```
940
-
941
- Callback function fired when a new date is selected. `date` is the new selected data, a string in `YYYY-MM-DD` format.
38
+ Only 9.0.0 or later is supported; earlier versions are deprecated on npm. antd is no longer a dependency, the package is ESM only and React is a peer dependency. See the [upgrade guide](https://react-big-schedule.vercel.app/#/docs) and the [release notes](.github/release-notes/v9.0.0.md).
942
39
 
943
- #### eventItemClick
40
+ ## Contributing
944
41
 
945
- ```js
946
- eventItemClick: PropTypes.func;
947
- eventItemClick(schedulerData, event);
948
- ```
42
+ Fork, branch, `bun install`, `bun run check`, open a pull request against `master`. See [CONTRIBUTING.md](CONTRIBUTING.md). Questions and bugs: [GitHub issues](https://github.com/ansulagrawal/react-big-schedule/issues).
949
43
 
950
- Callback function fired when you click an event item.
951
-
952
- #### updateEventStart
953
-
954
- ```js
955
- updateEventStart: PropTypes.func;
956
- updateEventStart(schedulerData, event, newStart);
957
- ```
958
-
959
- Callback function fired when resizing the start of the `event`, `newStart` is a string in `YYYY-MM-DD HH:mm:ss` format.
960
-
961
- #### updateEventEnd
962
-
963
- ```js
964
- updateEventEnd: PropTypes.func;
965
- updateEventEnd(schedulerData, event, newEnd);
966
- ```
967
-
968
- Callback function fired when resizing the end of the `event`, `newEnd` is a string in `YYYY-MM-DD HH:mm:ss` format.
969
-
970
- #### moveEvent
971
-
972
- ```js
973
- moveEvent: PropTypes.func;
974
- moveEvent((schedulerData, event, slotId, slotName, newStart, newEnd));
975
- ```
976
-
977
- Callback function fired when moving the `event`. `slotId`, `slotName` are the new `id` and `name` of the slot moving into,
978
- but they won't change if the `SchedulerData.config.crossResourceMove` is `false`. `newStart`, `newEnd` are the new beginning
979
- and ending of the `event`.
980
-
981
- #### newEvent
982
-
983
- ```js
984
- newEvent: PropTypes.func;
985
- newEvent(schedulerData, slotId, slotName, start, end, type, item);
986
- ```
987
-
988
- Callback function fired when creating a new event, or dragging an external item and dropping it into the resource view or task
989
- view. `slotId` and `slotName` are the slot creating in or dropping into, `start`, `end` are the beginning and ending of the
990
- event. If it's a drag&drop operation, the `type` is the DnDType of DnDSource registered to Scheduler, and the `item` is the
991
- external item.
992
-
993
- #### leftCustomHeader, rightCustomHeader
994
-
995
- ```js
996
- leftCustomHeader: PropTypes.object;
997
- rightCustomHeader: PropTypes.object;
998
- ```
999
-
1000
- Component you need to put in the Scheduler header, it could be a div or a react component. Refer
1001
- to [this example](https://react-big-schedule.vercel.app/customization).
1002
-
1003
- #### conflictOccurred
1004
-
1005
- ```js
1006
- conflictOccurred: PropTypes.func;
1007
- conflictOccurred(schedulerData, action, event, type, slotId, slotName, start, end);
1008
- ```
1009
-
1010
- Callback function fired when there is a conflict. This could happen when creating, resizing or moving an event, and when
1011
- `SchedulerData.config.checkConflict` is `true`.
1012
-
1013
- #### eventItemTemplateResolver
1014
-
1015
- ```js
1016
- eventItemTemplateResolver: PropTypes.func;
1017
- eventItemTemplateResolver(schedulerData, event, bgColor, isStart, isEnd, mustAddCssClass, mustBeHeight, agendaMaxEventWidth);
1018
- ```
1019
-
1020
- Use this function, you can customize the event style. Refer to [this example](https://react-big-schedule.vercel.app/customization).
1021
-
1022
- ### eventItemPopoverTemplateResolver
1023
-
1024
- ```js
1025
- eventItemPopoverTemplateResolver: PropTypes.func;
1026
- eventItemPopoverTemplateResolver(schedulerData, eventItem, title, start, end, statusColor);
1027
- ```
1028
-
1029
- Use this function, you can customize the event's popover style. Refer to [this example](https://react-big-schedule.vercel.app/customization).
1030
-
1031
- #### slotItemTemplateResolver
1032
-
1033
- ```js
1034
- slotItemTemplateResolver: PropTypes.func;
1035
- slotItemTemplateResolver(schedulerData, slot, slotClickedFunc, width, clsName);
1036
- ```
1037
-
1038
- Use this function, you can customize the left slot style. The returned element is rendered inside the resource cell, so a resource name can be any React node:
1039
-
1040
- ```jsx
1041
- <Scheduler
1042
- schedulerData={schedulerData}
1043
- slotItemTemplateResolver={(schedulerData, slot, slotClickedFunc, width, clsName) => (
1044
- <div className={clsName} style={{ width }} onClick={() => slotClickedFunc?.(schedulerData, slot)}>
1045
- <Avatar size="small" src={slot.avatar} /> <b>{slot.slotName}</b>
1046
- </div>
1047
- )}
1048
- />
1049
- ```
1050
-
1051
- #### nonAgendaCellHeaderTemplateResolver
1052
-
1053
- ```js
1054
- nonAgendaCellHeaderTemplateResolver: PropTypes.func;
1055
- nonAgendaCellHeaderTemplateResolver(schedulerData, item, formattedDateItems, style);
1056
- ```
1057
-
1058
- Use this function, you can customize the table header cell style. Refer to [this example](https://react-big-schedule.vercel.app/customization).
1059
-
1060
- #### onScrollLeft, onScrollRight
1061
-
1062
- ```js
1063
- onScrollLeft: PropTypes.func;
1064
- onScrollLeft(schedulerData, schedulerContent, maxScrollLeft);
1065
- onScrollRight: PropTypes.func;
1066
- onScrollRight(schedulerData, schedulerContent, maxScrollLeft);
1067
- ```
1068
-
1069
- Callback function fired when the scheduler content div scrolls to leftmost or rightmost. Refer to [this example](https://react-big-schedule.vercel.app/customization).
1070
-
1071
- #### onScrollTop, onScrollBottom
1072
-
1073
- ```js
1074
- onScrollTop: PropTypes.func;
1075
- onScrollTop(schedulerData, schedulerContent, maxScrollTop);
1076
- onScrollBottom: PropTypes.func;
1077
- onScrollBottom(schedulerData, schedulerContent, maxScrollTop);
1078
- ```
1079
-
1080
- Callback function fired when the scheduler content div scrolls to topmost or bottommost. Refer to [this example](https://react-big-schedule.vercel.app/customization).
1081
-
1082
- #### slotClickedFunc
1083
-
1084
- ```js
1085
- slotClickedFunc: PropTypes.func;
1086
- ```
1087
-
1088
- If it's set, slots will be clickable, and will fire this function when a slot is clicked. Refer
1089
- to [this example](https://react-big-schedule.vercel.app/customization).
1090
-
1091
- #### dndSources
1092
-
1093
- ```js
1094
- dndSources: PropTypes.array;
1095
- ```
1096
-
1097
- DnDSource array that registered to Scheduler. Use [DnDSource](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/components/DnDSource.js),
1098
- we can simplify the drag and drop coding in React-Big-Scheduler. Refer
1099
- to [this example](https://react-big-schedule.vercel.app/drag-and-drop).
1100
-
1101
- #### onSetAddMoreState
1102
-
1103
- ```js
1104
- onSetAddMoreState: PropTypes.func;
1105
- onSetAddMoreState(newState);
1106
- ```
1107
-
1108
- Callback function fired when a '+N more' is clicked, is used to control the visibility and the position of the `AddMorePopover`.
1109
- `newState` is a json such as {headerItem: headerItem, left: 20, top: 20, height: 100}. Refer
1110
- to [this example](https://react-big-schedule.vercel.app/add-more).
1111
-
1112
- #### subtitleGetter
1113
-
1114
- ```js
1115
- subtitleGetter: PropTypes.func;
1116
- subtitleGetter(schedulerData, event);
1117
- ```
1118
-
1119
- Use this function, you can display a subtitle in the `EventItemPopover`.
1120
-
1121
- #### viewEventClick
1122
-
1123
- ```js
1124
- viewEventClick: PropTypes.func;
1125
- viewEventClick(schedulerData, event);
1126
- ```
1127
-
1128
- Callback function fired when you click one operation link in the `EventItemPopover`. The operation link won't appear if this
1129
- function isn't set.
1130
-
1131
- #### viewEventText
1132
-
1133
- ```js
1134
- viewEventText: PropTypes.string;
1135
- ```
1136
-
1137
- Text of one operation link in the `EventItemPopover`. The operation link won't appear if this text isn't set.
1138
-
1139
- #### viewEvent2Click
1140
-
1141
- ```js
1142
- viewEvent2Click: PropTypes.func;
1143
- viewEvent2Click(schedulerData, event);
1144
- ```
1145
-
1146
- Callback function fired when you click the other operation link in the `EventItemPopover`. The other operation link won't
1147
- appear if this function isn't set.
1148
-
1149
- #### viewEvent2Text
1150
-
1151
- ```js
1152
- viewEvent2Text: PropTypes.string;
1153
- ```
44
+ ## License and credits
1154
45
 
1155
- Text of the other operation link in the `EventItemPopover`. The other operation link won't appear if this text isn't set.
46
+ [MIT](LICENSE). Forked from [react-big-scheduler](https://github.com/StephenChou1017/react-big-scheduler) and [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler); thanks to all [contributors](https://github.com/ansulagrawal/react-big-schedule/graphs/contributors).