react-big-schedule 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,1061 +1,1061 @@
1
- # React Big Schedule (react-big-schedule)
2
-
3
- [![NPM version][npm-image]][npm-url] [![MIT License][mit-image]][mit-url] [![CodeQL][codeql-image]][codeql-url] [![CodeFactor][codeFactor-badge]][codeFactor-link]
4
-
5
- [npm-image]: http://img.shields.io/npm/v/react-big-schedule.svg
6
- [npm-url]: http://npmjs.org/package/react-big-schedule
7
- [mit-image]: https://img.shields.io/badge/License-MIT-green.svg
8
- [mit-url]: https://github.com/ansulagrawal/react-big-schedule/blob/master/LICENSE
9
- [codeql-image]: https://github.com/ansulagrawal/react-big-schedule/actions/workflows/github-code-scanning/codeql/badge.svg?branch=master
10
- [codeql-url]: https://github.com/ansulagrawal/react-big-schedule/actions/workflows/github-code-scanning/codeql
11
- [codeFactor-badge]: https://www.codefactor.io/repository/github/ansulagrawal/react-big-schedule/badge
12
- [codeFactor-link]: https://www.codefactor.io/repository/github/ansulagrawal/react-big-schedule
13
-
14
- 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.
15
-
16
- 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.
17
-
18
- Unlock the potential of your React projects with react-big-schedule and revolutionize the way you handle scheduling and resource planning.
19
-
20
- ### This project code is forked from:
21
-
22
- - [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
23
- - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
24
-
25
- ## Installation
26
-
27
- To install react-big-schedule, use npm:
28
-
29
- ```bash
30
- npm install react-big-schedule
31
- ```
32
-
33
- ## Tech Stack
34
-
35
- - React
36
- - Ant Design
37
- - react-dnd
38
- - react-dnd-html5-backend
39
- - webpack
40
- - dayjs
41
-
42
- ## Features
43
-
44
- - Modern and intuitive scheduler component for React applications.
45
- - Seamless integration with React projects.
46
- - Drag-and-drop functionality for effortless scheduling.
47
- - Interactive user interface for a smooth user experience
48
- - Granular views to manage time, appointments, and resources effectively.
49
- - Optimized for time management and calendar-based operations.
50
- - Perfect for applications requiring advanced scheduling capabilities.
51
-
52
- ## Contributions
53
-
54
- Contributions to react-big-schedule are welcome! If you find a bug or want to contribute to the project, please follow these steps:
55
-
56
- 1. Fork the repository on GitHub.
57
- 2. Create a new branch with a descriptive name.
58
- 3. Make your changes and commit them with clear messages.
59
- 4. Push your changes to your forked repository.
60
- 5. Submit a pull request to the master repository.
61
-
62
- Please ensure that your code adheres to the project's coding conventions and includes appropriate tests.
63
-
64
- ## License
65
-
66
- 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.
67
-
68
- ## Support
69
-
70
- If you have any questions or need support, please create an issue in the [GitHub repository](https://github.com/ansulagrawal/react-big-schedule/issues).
71
-
72
- ## Credits
73
-
74
- 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.
75
-
76
- Special thanks to the following contributors:
77
-
78
- - Ansul Agrawal ([@ansulagrawal](https://github.com/ansulagrawal))
79
- - Jitendra Soni ([@JitendraSoni1234](https://github.com/JitendraSoni1234))
80
- - hbatalhaStch [[@hbatalhaStch](https://github.com/hbatalhaStch))
81
- - DamyanBG ([@DamyanBG](https://github.com/DamyanBG))
82
-
83
- ## Acknowledgments
84
-
85
- We would like to acknowledge the following projects for their inspiration and contributions:
86
-
87
- - [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
88
- - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
89
-
90
- ## Roadmap
91
-
92
- - Additional view options for different scheduling needs.
93
- - Support for recurring appointments.
94
- - Integration with popular calendar services.
95
- - Improved accessibility and localization support.
96
- - Performance optimizations for handling large data sets.
97
-
98
- We are continuously working on enhancing react-big-schedule and welcome your feedback and suggestions for future improvements.
99
-
100
- ## Changelog
101
-
102
- Please refer to the [CHANGELOG.md](https://github.com/ansulagrawal/react-big-schedule/blob/master/CHANGELOG.md) file.
103
-
104
- ## Use and Setup
105
-
106
- 1.) Installation
107
-
108
- ```
109
- npm i react-big-schedule
110
- ```
111
-
112
- or
113
-
114
- ```
115
- yarn add react-big-schedule
116
- ```
117
-
118
- 2.) Import dependencies
119
-
120
- ```
121
- import { Scheduler, SchedulerData, ViewType, DATE_FORMAT } from "react-big-schedule";
122
- import dayjs from "dayjs";
123
- import "react-big-schedule/dist/css/style.css";
124
- ```
125
-
126
- 3.) Basic Usage
127
-
128
- ```js
129
- const schedulerData = new SchedulerData(new dayjs().format(DATE_FORMAT), ViewType.Week);
130
-
131
- //set locale dayjs to the schedulerData, if your locale isn't English. By default, Scheduler comes with English(en, United States).
132
- schedulerData.setSchedulerLocale('pt-br'); // this uses dayjs, but it doesn't require dayjs to be installed as its called dynamically
133
- schedulerData.setCalendarPopoverLocale('pt_BR'); // this uses antd [List of supported locales](https://ant.design/docs/react/i18n#supported-languages)
134
-
135
- schedulerData.setResources([
136
- { id: 'r0', name: 'Resource0', groupOnly: true },
137
- { id: 'r1', name: 'Resource1' },
138
- { id: 'r2', name: 'Resource2', parentId: 'r0' },
139
- { id: 'r3', name: 'Resource3', parentId: 'r4' },
140
- { id: 'r4', name: 'Resource4', parentId: 'r2' },
141
- ]);
142
-
143
- // the event array should be sorted in ascending order by event.start property
144
- // otherwise there will be some rendering errors
145
- schedulerData.setEvents([
146
- {
147
- id: 1,
148
- start: '2022-12-18 09:30:00',
149
- end: '2022-12-19 23:30:00',
150
- resourceId: 'r1',
151
- title: 'I am finished',
152
- bgColor: '#D9D9D9',
153
- },
154
- {
155
- id: 2,
156
- start: '2022-12-18 12:30:00',
157
- end: '2022-12-26 23:30:00',
158
- resourceId: 'r2',
159
- title: 'I am not resizable',
160
- resizable: false,
161
- },
162
- {
163
- id: 3,
164
- start: '2022-12-19 12:30:00',
165
- end: '2022-12-20 23:30:00',
166
- resourceId: 'r3',
167
- title: 'I am not movable',
168
- movable: false,
169
- },
170
- {
171
- id: 4,
172
- start: '2022-12-19 14:30:00',
173
- end: '2022-12-20 23:30:00',
174
- resourceId: 'r1',
175
- title: 'I am not start-resizable',
176
- startResizable: false,
177
- },
178
- {
179
- id: 5,
180
- start: '2022-12-19 15:30:00',
181
- end: '2022-12-20 23:30:00',
182
- resourceId: 'r2',
183
- title: 'R2 has recurring tasks every week on Tuesday, Friday',
184
- rrule: 'FREQ=WEEKLY;DTSTART=20221219T013000Z;BYDAY=TU,FR',
185
- bgColor: '#f759ab',
186
- },
187
- ]);
188
-
189
- // ...
190
-
191
- //3. render the scheduler component, mind that the Scheduler component should be placed in a DragDropContext(father or ancestor).
192
-
193
- <Scheduler
194
- schedulerData={schedulerData}
195
- prevClick={this.prevClick}
196
- nextClick={this.nextClick}
197
- onSelectDate={this.onSelectDate}
198
- onViewChange={this.onViewChange}
199
- eventItemClick={this.eventClicked}
200
- />;
201
- ```
202
-
203
- ### Run examples locally
204
-
205
- - Clone this repository
206
- - Retrieve dependencies: `npm install` or `npm i`
207
- - Start: `npm run start`
208
- - Open [http://localhost:8080](http://localhost:8080).
209
-
210
- If you fail to execute the `npm install` command, remove the package-lock.json file and try again.
211
-
212
- # API
213
-
214
- ### SchedulerData
215
-
216
- SchedulerData is the view model of Scheduler, we can modify it to control the view of the Scheduler.
217
-
218
- #### constructor
219
-
220
- ```js
221
- constructor(date=dayjs().format(DATE_FORMAT), viewType = ViewType.Week,
222
- showAgenda = false, isEventPerspective = false,
223
- newConfig = undefined, newBehaviors=undefined
224
- localeDayjs = undefined)
225
- ```
226
-
227
- - `date` is a string in `YYYY-MM-DD` format, and is the initial date Scheduler will render. Take the date `2022-12-20`
228
- for example, Scheduler will render the time window of the week from `2022-12-18` to `2022-12-24` in `ViewType.Week`
229
- view type, and will render the time window of the `2022-12` month in `ViewType.Month` view type.
230
- - `viewType` is the initial view type, now Scheduler supports `Day`, `Week`, `Month`, `Quarter`, `Year` 5 built-in view types,
231
- in addition Scheduler now supports `Custom`, `Custom1`, `Custom2` 3 custom view types at the same time, in which you can control
232
- the time window yourself, refer to [this example](https://stephenchou1017.github.io/scheduler/#/customtimewindow). `viewType`,
233
- `showAgenda` and `isEventPerspective` are a group which should be contained in the SchedulerData.config.views array,
234
- and they together decide which view should be rendered. When `showAgenda` and `isEventPerspective` are both `false`,
235
- Scheduler will render the resource view, refer to [this example](https://stephenchou1017.github.io/scheduler/#/views).
236
- - `showAgenda` is a bool value, if true, Scheduler will display the agenda view of current view type. Agenda view is
237
- read only.
238
- - `isEventPerspective` is a bool value, if true, Scheduler will display the task view of current view type. In
239
- resource view, every slot(row) describes how many events a resource does in the time window, while in task view,
240
- every slot describes how many events a big task is divided into and who will make it done. Add a `groupId` and
241
- `groupName` property to every event object, so that the events having the same `groupId` will belong to the same big task and
242
- be rendered in the same slot in task view. If `groupId` and `groupName` are not provided, SchedulerData will take
243
- the `id` as the `groupId`, and take the `title` as the `groupName`. See the `eventsForTaskView` in the
244
- [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js) for details.
245
- - `newConfig` is a config object, used to override the [default config](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/config/scheduler.js)
246
- fully or partly.
247
- - `newBehaviors` is a config object, used to override the [default behaviors](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js)
248
- fully or partly.
249
- - `localeDayjs` is a locale dayjs object, which is unified used in react-big-scheduler. If not provided, Scheduler will come
250
- with English(en, United States) locale strings.
251
-
252
- #### setSchedulerLocale
253
-
254
- ```js
255
- setSchedulerLocale(preset);
256
- ```
257
-
258
- 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.
259
-
260
- `preset` will be locale imported from dayjs.
261
-
262
- #### example:
263
-
264
- ```js
265
- import * as dayjsLocale from 'dayjs/locale/pt-br';
266
-
267
- setSchedulerLocale(dayjsLocale);
268
- ```
269
-
270
- By default, Scheduler comes with English(en, United States)
271
-
272
- #### setCalendarPopoverLocale
273
-
274
- ```js
275
- setCalendarPopoverLocale(lang);
276
- ```
277
-
278
- 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)
279
-
280
- #### example:
281
-
282
- ```js
283
- import * as antdLocale from 'antd/locale/pt_BR';
284
-
285
- setCalendarPopoverLocale(antdLocale);
286
- ```
287
-
288
- refer this for the demo of the locale.
289
-
290
- #### setResources
291
-
292
- ```js
293
- setResources(resources);
294
- ```
295
-
296
- Used to set the resources(the slots in resource view), make sure that there are no duplicated `resource.id` in the `resources`.
297
- See the demo `resources` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js).
298
-
299
- #### setEvents
300
-
301
- ```js
302
- setEvents(events);
303
- ```
304
-
305
- Used to set the events. the event array should be sorted in ascending order by event.start property.
306
- See the demo `events` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js).
307
- If we use the task view, we'd better add the `groupId` and the `groupName` property to each event object, see the
308
- `eventsForTaskView` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js) for details.
309
-
310
- #### prev
311
-
312
- ```js
313
- prev();
314
- ```
315
-
316
- Let the time window scroll to the left once. When `SchedulerData,viewType` is `ViewType.Month`, the time window will
317
- scroll a month, when `SchedulerData,viewType` is `ViewType.Week`, the time window will scroll a week. `SchedulerData.events`
318
- will be clear after calling this method.
319
-
320
- #### next
321
-
322
- ```js
323
- next();
324
- ```
325
-
326
- Let the time window scroll to the right once. `SchedulerData.events` will be clear after calling this method.
327
-
328
- #### setDate
329
-
330
- ```js
331
- setDate((date = dayjs().format(DATE_FORMAT)));
332
- ```
333
-
334
- Let the time window jump to the provided `date` directly. `SchedulerData.events` will be clear after calling this method.
335
-
336
- #### setViewType
337
-
338
- ```js
339
- setViewType((viewType = ViewType.Week), (showAgenda = false), (isEventPerspective = false));
340
- ```
341
-
342
- Tell SchedulerData to change current view, the `viewType`, `showAgenda` and `isEventPerspective` group should be
343
- provided, and should be contained in the `SchedulerData.config.views` array. `SchedulerData.events` will be clear
344
- after calling this method.
345
-
346
- #### setEventGroups
347
-
348
- ```js
349
- setEventGroups(eventGroups);
350
- ```
351
-
352
- Used to set the event groups(the slots in task view), make sure that there are no duplicated `eventGroup.id` in the `eventGroups`.
353
- This method is optional, and is needed only when `SchedulerData.eventGroupsAutoGenerated` is `false`.
354
-
355
- #### setEventGroupsAutoGenerated
356
-
357
- ```js
358
- setEventGroupsAutoGenerated(autoGenerated);
359
- ```
360
-
361
- Tell SchedulerData to generate `SchedulerData.eventGroups` automatically or not. If `true`, SchedulerData will generate the event
362
- groups(slots) automatically according to the `event.groupId` and 'event.groupName' automatically. If `groupId` and 'groupName' are
363
- not provided, SchedulerData will take `event.id` and `event.title` instead.
364
-
365
- #### setMinuteStep
366
-
367
- ```js
368
- setMinuteStep(minuteStep);
369
- ```
370
-
371
- Used to set minute step for daily view and refresh the render data.
372
-
373
- #### toggleExpandStatus
374
-
375
- ```js
376
- toggleExpandStatus(slotId);
377
- ```
378
-
379
- Used to toggle slot's(and its children's) expand status.
380
-
381
- #### getMinuteStepsInHour
382
-
383
- ```js
384
- getMinuteStepsInHour();
385
- ```
386
-
387
- Used to get minute steps in an hour, it equals 60 / SchedulerData.config.minuteStep.
388
-
389
- #### addResource
390
-
391
- ```js
392
- addResource(resource);
393
- ```
394
-
395
- Add the `resource` to the `SchedulerData.resources`, make sure that `resource.id` is not duplicated. Refer
396
- to [this example](https://stephenchou1017.github.io/scheduler/#/addresource).
397
-
398
- #### addEventGroup
399
-
400
- ```js
401
- addEventGroup(eventGroup);
402
- ```
403
-
404
- Add the `eventGroup` to the `SchedulerData.eventGroups`, make sure that `eventGroup.id` is not duplicated. Please note
405
- that the `eventGroup` added may be override when `SchedulerData.eventGroupsAutoGenerated` is `true` and
406
- `SchedulerData.eventGroups` is auto-generated.
407
-
408
- #### addEvent
409
-
410
- ```js
411
- addEvent(newEvent);
412
- ```
413
-
414
- Add the `newEvent` to the `SchedulerData.events`, make sure that `newEvent.id` is not duplicated. SchedulerData will
415
- place the `newEvent` in the right index according to the `newEvent.start` property.
416
-
417
- #### updateEventStart
418
-
419
- ```js
420
- updateEventStart(event, newStart);
421
- ```
422
-
423
- Update the `newStart` to the `event.start`, `newStart` is a string in `YYYY-MM-DD HH:mm:ss` format(similarly hereinafter).
424
- SchedulerData will replace the `event` in the right index according to the `newStart` value.
425
-
426
- #### updateEventEnd
427
-
428
- ```js
429
- updateEventEnd(event, newEnd);
430
- ```
431
-
432
- Update the `newEnd` to the `event.end`.
433
-
434
- #### moveEvent
435
-
436
- ```js
437
- moveEvent(event, newSlotId, newSlotName, newStart, newEnd);
438
- ```
439
-
440
- Update the `newSlotId`, `newSlotName`, `newStart`, `newEnd` of the `event`. In resource view, new slot is a resource,
441
- while in task view, new slot is a event group. SchedulerData will replace the `event` in the right index according
442
- to the `newStart` value.
443
-
444
- #### removeEvent
445
-
446
- ```js
447
- removeEvent(event);
448
- ```
449
-
450
- Remove the given event from `SchedeulerData.events`.
451
-
452
- #### removeEventById
453
-
454
- ```js
455
- removeEventById(eventId);
456
- ```
457
-
458
- Remove event from `SchedeulerData.events` by the given event id.
459
-
460
- #### getSlots
461
-
462
- ```js
463
- getSlots();
464
- ```
465
-
466
- Returns the slot array, `SchedulerData.resources` in resource view, `SchedulerData.eventGroups` in task view.
467
-
468
- #### getSlotById
469
-
470
- ```js
471
- getSlotById(slotId);
472
- ```
473
-
474
- Returns the slot by `slotId`, returns `undefined` if not found.
475
-
476
- #### getResourceById
477
-
478
- ```js
479
- getResourceById(resourceId);
480
- ```
481
-
482
- #### isEventInTimeWindow
483
-
484
- ```js
485
- isEventInTimeWindow(eventStart, eventEnd, windowStart, windowEnd);
486
- ```
487
-
488
- Returns whether an event is in the time window or not, remind that `eventStart`, `eventEnd`, `windowStart`, `windowEnd`
489
- are all dayjs | Date objects.
490
-
491
- #### getViewDates
492
-
493
- ```js
494
- getViewDates();
495
- ```
496
-
497
- Returns an object with the startDate and endDate of the currently selected view ({ startDate: Dayjs, endDate: Dayjs }).
498
-
499
- #### getViewStartDate
500
-
501
- ```js
502
- getViewStartDate();
503
- ```
504
-
505
- Returns a dayjs object with the startDate of the currently selected view.
506
-
507
- #### getViewEndDate
508
-
509
- ```js
510
- getViewEndDate();
511
- ```
512
-
513
- Returns a dayjs object with the endDate of the currently selected view.
514
-
515
- ### Locale support(Refer to [this example](https://stephenchou1017.github.io/scheduler/#/locale) for details.)
516
-
517
- #### SchedulerData.config.resourceName
518
-
519
- The locale string of resource name.
520
-
521
- #### SchedulerData.config.taskName
522
-
523
- The locale string of task name.
524
-
525
- #### SchedulerData.config.agendaViewHeader
526
-
527
- The locale string of agenda view header.
528
-
529
- #### SchedulerData.config.addMorePopoverHeaderFormat
530
-
531
- The locale string of add more popover header format.
532
-
533
- #### SchedulerData.config.eventItemPopoverDateFormat
534
-
535
- The locale string of event item popover date format.
536
-
537
- #### SchedulerData.config.nonAgendaDayCellHeaderFormat
538
-
539
- The locale string of non-agenda view cell header format of day view type.
540
-
541
- #### SchedulerData.config.nonAgendaOtherCellHeaderFormat
542
-
543
- The locale string of non-agenda view cell header format of other view types.
544
-
545
- #### SchedulerData.behaviors.getDateLabelFunc
546
-
547
- 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)
548
-
549
- ### SchedulerData.config(See the [config file](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/config/scheduler.js) for details.)
550
-
551
- #### schedulerWidth
552
-
553
- The width of Scheduler. Scheduler uses responsive layout so schedulerWidth should be a percentage,
554
- Scheduler in the responsive layout:
555
- `actual width of Scheduler = (SchedulerData.documentWidth - SchedulerData.config.besidesWidth) * SchedulerData.config.schedulerWidth`
556
- `SchedulerData.documentWidth` is the window width of browser (or the the parent width in case SchedulerData.config.responsiveByParent
557
- and Scheduler component prop parentRef is passed) and will change automatically when resized.
558
-
559
- #### responsiveByParent
560
-
561
- When true, Scheduler resposiveness will not be determined by the window width of browser but instead by the
562
- width of the of the parent (the parent ref must be passed to the Scheduler component prop named `parentRef`,
563
- in case it is not passed resposiveness will fall back to being determined by the window width).
564
- Meaning:
565
- `SchedulerData.documentWidth` is the width of the parent and will change automatically when resized
566
-
567
- #### schedulerMaxHeight
568
-
569
- The max height of Scheduler. If the desired height is bigger than the max height, the header row of Scheduler will be
570
- frozen and vertical scroll bar will appear, but this won't happen when the max height is set to `0`. Refer
571
- to [this example](https://stephenchou1017.github.io/scheduler/#/freezefirstrow).
572
-
573
- **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.**
574
- When conforming to the parent container, the Scheduler will fill the available space and scroll bars will appear as needed.
575
-
576
- #### underneathHeight
577
-
578
- 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.
579
-
580
- **Example:** If your parent container is 600px tall and `underneathHeight` is 50, the Scheduler will use up to 550px of height.
581
-
582
- #### tableHeaderHeight
583
-
584
- Height of Scheduler table header.
585
-
586
- #### agendaResourceTableWidth
587
-
588
- Width of the left Scheduler resource column in agenda view.
589
-
590
- #### agendaMaxEventWidth
591
-
592
- Max width of an event item in agenda view.
593
-
594
- #### dayResourceTableWidth, weekResourceTableWidth, monthResourceTableWidth, yearResourceTableWidth, quarterResourceTableWidth
595
-
596
- Width of the left Scheduler resource column in resource view and task view of different view types.
597
-
598
- #### dayCellWidth, weekCellWidth, monthCellWidth, yearCellWidth, quarterCellWidth
599
-
600
- Width of Scheduler table cells in resource view and task view of different view types.
601
-
602
- #### dayMaxEvents, weekMaxEvents, monthMaxEvents, yearMaxEvents, quarterMaxEvents
603
-
604
- Max events count of a cell in resource view and task view of different view types. A '+N more' will appear when exceeded.
605
- Refer to [this example](https://stephenchou1017.github.io/scheduler/#/addmore).
606
-
607
- #### eventItemHeight
608
-
609
- Height of an event item in 3 views.
610
-
611
- #### eventItemLineHeight
612
-
613
- Line height of an event item in 3 views.
614
-
615
- #### nonAgendaSlotMinHeight
616
-
617
- Min height of a slot in non-agenda views, default 0, means there is no min height.
618
-
619
- #### dayStartFrom
620
-
621
- Start hour rendered from in `ViewType.Day` in resource view and task view, default 0.
622
-
623
- #### dayStopTo
624
-
625
- End hour rendered to in `ViewType.Day` in resource view and task view, default 23.
626
-
627
- #### defaultEventBgColor
628
-
629
- Default event item background color in 3 views, will be override if there is a `bgColor` property in event object.
630
-
631
- #### selectedAreaColor
632
-
633
- Selected cells color in resource view and task view, cells are selectable only when `creatable` is `true`.
634
-
635
- #### nonWorkingTimeHeadColor
636
-
637
- Color of non-working time head cells. Modify `SchedulerData.behaviors.isNonWorkingTimeFunc` to re-define non-working time.
638
- Refer the `isNonWorkingTime` func in the [behaviors.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js).
639
-
640
- #### nonWorkingTimeHeadBgColor
641
-
642
- Background color of non-working time head cells.
643
-
644
- #### nonWorkingTimeBodyBgColor
645
-
646
- Background color of non-working time body cells.
647
-
648
- #### summaryColor
649
-
650
- Color of cell summary. Modify `SchedulerData.behaviors.getSummaryFunc` to display summary in a cell.
651
- Refer the `getSummary` func in the [behaviors.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js).
652
-
653
- #### summaryPos
654
-
655
- Position of cell summary, supports `SummaryPos.Top`, `SummaryPos.TopRight`, `SummaryPos.TopLeft`, `SummaryPos.Bottom`,
656
- `SummaryPos.BottomRight` and `SummaryPos.BottomLeft`.
657
-
658
- #### startResizable
659
-
660
- Controls whether to resize the start of every event item in resource view and task view. If `false`, all item starts are
661
- non-resizable, if `true`, all item starts are resizable except those who have a `resizable` or `startResizable`
662
- property and its value is `false`.
663
-
664
- #### endResizable
665
-
666
- Controls whether to resize the end of every event item in resource view and task view. If `false`, all item ends are
667
- non-resizable, if `true`, all item ends are resizable except those who have a `resizable` or `endResizable`
668
- property and its value is `false`.
669
-
670
- #### movable
671
-
672
- Controls whether to move every event item in resource view and task view. If `false`, all items are
673
- non-movable, if `true`, all items are movable except those who have a `movable` property and its value is `false`.
674
-
675
- #### creatable
676
-
677
- Controls whether to create new event item in resource view and task view.
678
-
679
- #### crossResourceMove
680
-
681
- Controls whether to cross-slot move an event item in resource view and task view. If `false`, the `slotId` and `slotName`
682
- won't change in the `moveEvent` method. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/nocrossslotmove).
683
-
684
- #### checkConflict
685
-
686
- Controls whether to check conflicts when creating, resizing or moving an event item in resource view and task view. If
687
- `true`, Scheduler will call the `conflictOccurred` function if given. Refer to
688
- [this example](https://stephenchou1017.github.io/scheduler/#/overlapcheck).
689
-
690
- #### scrollToSpecialDayjsEnabled
691
-
692
- Controls Scheduler whether to scroll to special dayjs automatically when the time window contains special dayjs. If `true`, Scheduler
693
- horizontal bar will scroll to special dayjs after calling `setScrollToSpecialDayjs(true)` to SchedulerData. Use `SchedulerData.behaviors.getScrollSpecialDayjsFunc`
694
- to tell Scheduler what time the special dayjs is.
695
-
696
- #### eventItemPopoverEnabled
697
-
698
- Controls Scheduler whether to display event item popover when moving mouse on an event item, default `true`.
699
-
700
- #### eventItemPopoverTrigger
701
-
702
- Controls Scheduler event item popover trigger, default `hover`.
703
- Controls Scheduler whether to display event item popover when moving mouse on an event item, default `true`.
704
-
705
- #### eventItemPopoverPlacement
706
-
707
- Controls Scheduler event item popover placement (`'topLeftMousePosition' | 'bottomLeftMousePosition' | 'topRightMousePosition' | 'bottomRightMousePosition' | 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom'`), default `bottomLeft`.
708
-
709
- #### eventItemPopoverWidth
710
-
711
- 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.
712
-
713
- #### calendarPopoverEnabled
714
-
715
- Controls Scheduler whether to display calendar popover when clicking on a date label in header, default `true`.
716
-
717
- #### recurringEventsEnabled
718
-
719
- Controls Scheduler whether to support recurring event, refer to [this feature request](https://github.com/StephenChou1017/react-big-scheduler/issues/8), default `true`.
720
- If `true`, SchedulerData will filter out those template events who has a `rrule` string property in `setEvents` method,
721
- generate the recurring events in the time window, and insert them into the event array in the right orders. The recurring events
722
- generated from the same template event, all have a new id like `${templateEvent.id}-${number}`, and have a `recurringEventId`
723
- property with the value `templateEvent.id`.
724
-
725
- #### headerEnabled
726
-
727
- Controls Scheduler whether to display header, default `true`.
728
-
729
- #### resourceViewEnabled
730
-
731
- Controls Scheduler whether to display resource view, default `true`.
732
-
733
- #### displayWeekend
734
-
735
- Controls Scheduler whether to display weekends in non-agenda view, default `true`.
736
-
737
- #### relativeMove
738
-
739
- Controls Scheduler whether to move events(only DnDTypes.EVENT type) relatively or absolutely, default `true`, means relatively.
740
-
741
- #### minuteStep
742
-
743
- Minute step for day view type in non-agenda view, can be 10, 12, 15, 20, 30, 60, etc, default 30.
744
-
745
- #### views
746
-
747
- Array of view that Scheduler will support.
748
-
749
- #### dragAndDropEnabled
750
-
751
- 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).
752
-
753
- ### SchedulerData.behaviors(See the [behaviors.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js) for details.)
754
-
755
- #### getEventTextFunc
756
-
757
- ```js
758
- getEventTextFunc(schedulerData, event);
759
- ```
760
-
761
- Method that defines the text displayed in the `event`.
762
-
763
- #### isNonWorkingTimeFunc
764
-
765
- ```js
766
- isNonWorkingTimeFunc(schedulerData, time);
767
- ```
768
-
769
- Method that defines non-working time.
770
-
771
- #### getSummaryFunc
772
-
773
- ```js
774
- getSummary(schedulerData, headerEvents, slotId, slotName, headerStart, headerEnd);
775
- ```
776
-
777
- Method that defines the summary text displayed in the Scheduler cells.Refer
778
- to [this example](https://stephenchou1017.github.io/scheduler/#/summary).
779
-
780
- #### getCustomDateFunc
781
-
782
- ```js
783
- getCustomDate(schedulerData, num, (date = undefined));
784
- ```
785
-
786
- Method that controls the start and end of time window when current view type is Custom, Custom1 or Custom2.Refer
787
- to [this example](https://stephenchou1017.github.io/scheduler/#/customtimewindow).
788
-
789
- #### getNonAgendaViewBodyCellBgColorFunc
790
-
791
- ```js
792
- getNonAgendaViewBodyCellBgColor(schedulerData, slotId, header);
793
- ```
794
-
795
- Method that sets the background color of cells dynamically.
796
-
797
- #### getScrollSpecialDayjsFunc
798
-
799
- ```js
800
- getScrollSpecialDayjs(schedulerData, startDayjs, endDayjs);
801
- ```
802
-
803
- Method that defines the special dayjs Scheduler will scroll to automatically, when the time window contains that dayjs.
804
-
805
- ### Scheduler.propTypes
806
-
807
- #### schedulerData
808
-
809
- ```js
810
- schedulerData: PropTypes.object.isRequired;
811
- ```
812
-
813
- View model of the Scheduler component, provides data.
814
-
815
- #### parentRef
816
-
817
- ```js
818
- parentRef: PropTypes.object;
819
- ```
820
-
821
- ref of the component that is the parent of the Scheduler component
822
-
823
- #### prevClick
824
-
825
- ```js
826
- prevClick: PropTypes.func.isRequired;
827
- prevClick(schedulerData);
828
- ```
829
-
830
- Callback function fired when the left point bracket '<' is clicked.
831
-
832
- #### nextClick
833
-
834
- ```js
835
- nextClick: PropTypes.func.isRequired;
836
- nextClick(schedulerData);
837
- ```
838
-
839
- Callback function fired when the right point bracket '>' is clicked.
840
-
841
- #### onViewChange
842
-
843
- ```js
844
- onViewChange: PropTypes.func.isRequired;
845
- onViewChange(schedulerData, view);
846
- ```
847
-
848
- Callback function fired when the Scheduler view changed. `view` is a json such as { viewType: ViewType.Month,
849
- showAgenda: true, isEventPerspective: false}.
850
-
851
- #### onSelectDate
852
-
853
- ```js
854
- onSelectDate: PropTypes.func.isRequired;
855
- onSelectDate(schedulerData, date);
856
- ```
857
-
858
- Callback function fired when a new date is selected. `date` is the new selected data, a string in `YYYY-MM-DD` format.
859
-
860
- #### eventItemClick
861
-
862
- ```js
863
- eventItemClick: PropTypes.func;
864
- eventItemClick(schedulerData, event);
865
- ```
866
-
867
- Callback function fired when you click an event item.
868
-
869
- #### updateEventStart
870
-
871
- ```js
872
- updateEventStart: PropTypes.func;
873
- updateEventStart(schedulerData, event, newStart);
874
- ```
875
-
876
- Callback function fired when resizing the start of the `event`, `newStart` is a string in `YYYY-MM-DD HH:mm:ss` format.
877
-
878
- #### updateEventEnd
879
-
880
- ```js
881
- updateEventEnd: PropTypes.func;
882
- updateEventEnd(schedulerData, event, newEnd);
883
- ```
884
-
885
- Callback function fired when resizing the end of the `event`, `newEnd` is a string in `YYYY-MM-DD HH:mm:ss` format.
886
-
887
- #### moveEvent
888
-
889
- ```js
890
- moveEvent: PropTypes.func;
891
- moveEvent((schedulerData, event, slotId, slotName, newStart, newEnd));
892
- ```
893
-
894
- Callback function fired when moving the `event`. `slotId`, `slotName` are the new `id` and `name` of the slot moving into,
895
- but they won't change if the `SchedulerData.config.crossResourceMove` is `false`. `newStart`, `newEnd` are the new beginning
896
- and ending of the `event`.
897
-
898
- #### newEvent
899
-
900
- ```js
901
- newEvent: PropTypes.func;
902
- newEvent(schedulerData, slotId, slotName, start, end, type, item);
903
- ```
904
-
905
- Callback function fired when creating a new event, or dragging an external item and dropping it into the resource view or task
906
- view. `slotId` and `slotName` are the slot creating in or dropping into, `start`, `end` are the beginning and ending of the
907
- event. If it's a drag&drop operation, the `type` is the DnDType of DnDSource registered to Scheduler, and the `item` is the
908
- external item.
909
-
910
- #### leftCustomHeader, rightCustomHeader
911
-
912
- ```js
913
- leftCustomHeader: PropTypes.object;
914
- rightCustomHeader: PropTypes.object;
915
- ```
916
-
917
- Component you need to put in the Scheduler header, it could be a div or a react component. Refer
918
- to [this example](https://stephenchou1017.github.io/scheduler/#/customheader).
919
-
920
- #### conflictOccurred
921
-
922
- ```js
923
- conflictOccurred: PropTypes.func;
924
- conflictOccurred(schedulerData, action, event, type, slotId, slotName, start, end);
925
- ```
926
-
927
- Callback function fired when there is a conflict. This could happen when creating, resizing or moving an event, and when
928
- `SchedulerData.config.checkConflict` is `true`.
929
-
930
- #### eventItemTemplateResolver
931
-
932
- ```js
933
- eventItemTemplateResolver: PropTypes.func;
934
- eventItemTemplateResolver(schedulerData, event, bgColor, isStart, isEnd, mustAddCssClass, mustBeHeight, agendaMaxEventWidth);
935
- ```
936
-
937
- Use this function, you can customize the event style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/customeventstyle).
938
-
939
- ### eventItemPopoverTemplateResolver
940
-
941
- ```js
942
- eventItemPopoverTemplateResolver: PropTypes.func;
943
- eventItemPopoverTemplateResolver(schedulerData, eventItem, title, start, end, statusColor);
944
- ```
945
-
946
- Use this function, you can customize the event's popover style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/custompopover).
947
-
948
- #### slotItemTemplateResolver
949
-
950
- ```js
951
- slotItemTemplateResolver: PropTypes.func;
952
- slotItemTemplateResolver(schedulerData, slot, slotClickedFunc, width, clsName);
953
- ```
954
-
955
- Use this function, you can customize the left slot style.
956
-
957
- #### nonAgendaCellHeaderTemplateResolver
958
-
959
- ```js
960
- nonAgendaCellHeaderTemplateResolver: PropTypes.func;
961
- nonAgendaCellHeaderTemplateResolver(schedulerData, item, formattedDateItems, style);
962
- ```
963
-
964
- Use this function, you can customize the table header cell style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/customtableheaders).
965
-
966
- #### onScrollLeft, onScrollRight
967
-
968
- ```js
969
- onScrollLeft: PropTypes.func;
970
- onScrollLeft(schedulerData, schedulerContent, maxScrollLeft);
971
- onScrollRight: PropTypes.func;
972
- onScrollRight(schedulerData, schedulerContent, maxScrollLeft);
973
- ```
974
-
975
- Callback function fired when the scheduler content div scrolls to leftmost or rightmost. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/infinitescroll).
976
-
977
- #### onScrollTop, onScrollBottom
978
-
979
- ```js
980
- onScrollTop: PropTypes.func;
981
- onScrollTop(schedulerData, schedulerContent, maxScrollTop);
982
- onScrollBottom: PropTypes.func;
983
- onScrollBottom(schedulerData, schedulerContent, maxScrollTop);
984
- ```
985
-
986
- Callback function fired when the scheduler content div scrolls to topmost or bottommost. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/infinitescroll).
987
-
988
- #### slotClickedFunc
989
-
990
- ```js
991
- slotClickedFunc: PropTypes.func;
992
- ```
993
-
994
- If it's set, slots will be clickable, and will fire this function when a slot is clicked. Refer
995
- to [this example](https://stephenchou1017.github.io/scheduler/#/resourceclickable).
996
-
997
- #### dndSources
998
-
999
- ```js
1000
- dndSources: PropTypes.array;
1001
- ```
1002
-
1003
- DnDSource array that registered to Scheduler. Use [DnDSource](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/components/DnDSource.js),
1004
- we can simplify the drag and drop coding in React-Big-Scheduler. Refer
1005
- to [this example](https://stephenchou1017.github.io/scheduler/#/draganddrop).
1006
-
1007
- #### onSetAddMoreState
1008
-
1009
- ```js
1010
- onSetAddMoreState: PropTypes.func;
1011
- onSetAddMoreState(newState);
1012
- ```
1013
-
1014
- Callback function fired when a '+N more' is clicked, is used to control the visibility and the position of the `AddMorePopover`.
1015
- `newState` is a json such as {headerItem: headerItem, left: 20, top: 20, height: 100}. Refer
1016
- to [this example](https://stephenchou1017.github.io/scheduler/#/addmore).
1017
-
1018
- #### subtitleGetter
1019
-
1020
- ```js
1021
- subtitleGetter: PropTypes.func;
1022
- subtitleGetter(schedulerData, event);
1023
- ```
1024
-
1025
- Use this function, you can display a subtitle in the `EventItemPopover`.
1026
-
1027
- #### viewEventClick
1028
-
1029
- ```js
1030
- viewEventClick: PropTypes.func;
1031
- viewEventClick(schedulerData, event);
1032
- ```
1033
-
1034
- Callback function fired when you click one operation link in the `EventItemPopover`. The operation link won't appear if this
1035
- function isn't set.
1036
-
1037
- #### viewEventText
1038
-
1039
- ```js
1040
- viewEventText: PropTypes.string;
1041
- ```
1042
-
1043
- Text of one operation link in the `EventItemPopover`. The operation link won't appear if this text isn't set.
1044
-
1045
- #### viewEvent2Click
1046
-
1047
- ```js
1048
- viewEvent2Click: PropTypes.func;
1049
- viewEvent2Click(schedulerData, event);
1050
- ```
1051
-
1052
- Callback function fired when you click the other operation link in the `EventItemPopover`. The other operation link won't
1053
- appear if this function isn't set.
1054
-
1055
- #### viewEvent2Text
1056
-
1057
- ```js
1058
- viewEvent2Text: PropTypes.string;
1059
- ```
1060
-
1061
- Text of the other operation link in the `EventItemPopover`. The other operation link won't appear if this text isn't set.
1
+ # React Big Schedule (react-big-schedule)
2
+
3
+ [![NPM version][npm-image]][npm-url] [![MIT License][mit-image]][mit-url] [![CodeQL][codeql-image]][codeql-url] [![CodeFactor][codeFactor-badge]][codeFactor-link]
4
+
5
+ [npm-image]: http://img.shields.io/npm/v/react-big-schedule.svg
6
+ [npm-url]: http://npmjs.org/package/react-big-schedule
7
+ [mit-image]: https://img.shields.io/badge/License-MIT-green.svg
8
+ [mit-url]: https://github.com/ansulagrawal/react-big-schedule/blob/master/LICENSE
9
+ [codeql-image]: https://github.com/ansulagrawal/react-big-schedule/actions/workflows/github-code-scanning/codeql/badge.svg?branch=master
10
+ [codeql-url]: https://github.com/ansulagrawal/react-big-schedule/actions/workflows/github-code-scanning/codeql
11
+ [codeFactor-badge]: https://www.codefactor.io/repository/github/ansulagrawal/react-big-schedule/badge
12
+ [codeFactor-link]: https://www.codefactor.io/repository/github/ansulagrawal/react-big-schedule
13
+
14
+ 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.
15
+
16
+ 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.
17
+
18
+ Unlock the potential of your React projects with react-big-schedule and revolutionize the way you handle scheduling and resource planning.
19
+
20
+ ### This project code is forked from:
21
+
22
+ - [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
23
+ - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
24
+
25
+ ## Installation
26
+
27
+ To install react-big-schedule, use npm:
28
+
29
+ ```bash
30
+ npm install react-big-schedule
31
+ ```
32
+
33
+ ## Tech Stack
34
+
35
+ - React
36
+ - Ant Design
37
+ - react-dnd
38
+ - react-dnd-html5-backend
39
+ - webpack
40
+ - dayjs
41
+
42
+ ## Features
43
+
44
+ - Modern and intuitive scheduler component for React applications.
45
+ - Seamless integration with React projects.
46
+ - Drag-and-drop functionality for effortless scheduling.
47
+ - Interactive user interface for a smooth user experience
48
+ - Granular views to manage time, appointments, and resources effectively.
49
+ - Optimized for time management and calendar-based operations.
50
+ - Perfect for applications requiring advanced scheduling capabilities.
51
+
52
+ ## Contributions
53
+
54
+ Contributions to react-big-schedule are welcome! If you find a bug or want to contribute to the project, please follow these steps:
55
+
56
+ 1. Fork the repository on GitHub.
57
+ 2. Create a new branch with a descriptive name.
58
+ 3. Make your changes and commit them with clear messages.
59
+ 4. Push your changes to your forked repository.
60
+ 5. Submit a pull request to the master repository.
61
+
62
+ Please ensure that your code adheres to the project's coding conventions and includes appropriate tests.
63
+
64
+ ## License
65
+
66
+ 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.
67
+
68
+ ## Support
69
+
70
+ If you have any questions or need support, please create an issue in the [GitHub repository](https://github.com/ansulagrawal/react-big-schedule/issues).
71
+
72
+ ## Credits
73
+
74
+ 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.
75
+
76
+ Special thanks to the following contributors:
77
+
78
+ - Ansul Agrawal ([@ansulagrawal](https://github.com/ansulagrawal))
79
+ - Jitendra Soni ([@JitendraSoni1234](https://github.com/JitendraSoni1234))
80
+ - hbatalhaStch [[@hbatalhaStch](https://github.com/hbatalhaStch))
81
+ - DamyanBG ([@DamyanBG](https://github.com/DamyanBG))
82
+
83
+ ## Acknowledgments
84
+
85
+ We would like to acknowledge the following projects for their inspiration and contributions:
86
+
87
+ - [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
88
+ - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
89
+
90
+ ## Roadmap
91
+
92
+ - Additional view options for different scheduling needs.
93
+ - Support for recurring appointments.
94
+ - Integration with popular calendar services.
95
+ - Improved accessibility and localization support.
96
+ - Performance optimizations for handling large data sets.
97
+
98
+ We are continuously working on enhancing react-big-schedule and welcome your feedback and suggestions for future improvements.
99
+
100
+ ## Changelog
101
+
102
+ Please refer to the [CHANGELOG.md](https://github.com/ansulagrawal/react-big-schedule/blob/master/CHANGELOG.md) file.
103
+
104
+ ## Use and Setup
105
+
106
+ 1.) Installation
107
+
108
+ ```
109
+ npm i react-big-schedule
110
+ ```
111
+
112
+ or
113
+
114
+ ```
115
+ yarn add react-big-schedule
116
+ ```
117
+
118
+ 2.) Import dependencies
119
+
120
+ ```
121
+ import { Scheduler, SchedulerData, ViewType, DATE_FORMAT } from "react-big-schedule";
122
+ import dayjs from "dayjs";
123
+ import "react-big-schedule/dist/css/style.css";
124
+ ```
125
+
126
+ 3.) Basic Usage
127
+
128
+ ```js
129
+ const schedulerData = new SchedulerData(new dayjs().format(DATE_FORMAT), ViewType.Week);
130
+
131
+ //set locale dayjs to the schedulerData, if your locale isn't English. By default, Scheduler comes with English(en, United States).
132
+ schedulerData.setSchedulerLocale('pt-br'); // this uses dayjs, but it doesn't require dayjs to be installed as its called dynamically
133
+ schedulerData.setCalendarPopoverLocale('pt_BR'); // this uses antd [List of supported locales](https://ant.design/docs/react/i18n#supported-languages)
134
+
135
+ schedulerData.setResources([
136
+ { id: 'r0', name: 'Resource0', groupOnly: true },
137
+ { id: 'r1', name: 'Resource1' },
138
+ { id: 'r2', name: 'Resource2', parentId: 'r0' },
139
+ { id: 'r3', name: 'Resource3', parentId: 'r4' },
140
+ { id: 'r4', name: 'Resource4', parentId: 'r2' },
141
+ ]);
142
+
143
+ // the event array should be sorted in ascending order by event.start property
144
+ // otherwise there will be some rendering errors
145
+ schedulerData.setEvents([
146
+ {
147
+ id: 1,
148
+ start: '2022-12-18 09:30:00',
149
+ end: '2022-12-19 23:30:00',
150
+ resourceId: 'r1',
151
+ title: 'I am finished',
152
+ bgColor: '#D9D9D9',
153
+ },
154
+ {
155
+ id: 2,
156
+ start: '2022-12-18 12:30:00',
157
+ end: '2022-12-26 23:30:00',
158
+ resourceId: 'r2',
159
+ title: 'I am not resizable',
160
+ resizable: false,
161
+ },
162
+ {
163
+ id: 3,
164
+ start: '2022-12-19 12:30:00',
165
+ end: '2022-12-20 23:30:00',
166
+ resourceId: 'r3',
167
+ title: 'I am not movable',
168
+ movable: false,
169
+ },
170
+ {
171
+ id: 4,
172
+ start: '2022-12-19 14:30:00',
173
+ end: '2022-12-20 23:30:00',
174
+ resourceId: 'r1',
175
+ title: 'I am not start-resizable',
176
+ startResizable: false,
177
+ },
178
+ {
179
+ id: 5,
180
+ start: '2022-12-19 15:30:00',
181
+ end: '2022-12-20 23:30:00',
182
+ resourceId: 'r2',
183
+ title: 'R2 has recurring tasks every week on Tuesday, Friday',
184
+ rrule: 'FREQ=WEEKLY;DTSTART=20221219T013000Z;BYDAY=TU,FR',
185
+ bgColor: '#f759ab',
186
+ },
187
+ ]);
188
+
189
+ // ...
190
+
191
+ //3. render the scheduler component, mind that the Scheduler component should be placed in a DragDropContext(father or ancestor).
192
+
193
+ <Scheduler
194
+ schedulerData={schedulerData}
195
+ prevClick={this.prevClick}
196
+ nextClick={this.nextClick}
197
+ onSelectDate={this.onSelectDate}
198
+ onViewChange={this.onViewChange}
199
+ eventItemClick={this.eventClicked}
200
+ />;
201
+ ```
202
+
203
+ ### Run examples locally
204
+
205
+ - Clone this repository
206
+ - Retrieve dependencies: `npm install` or `npm i`
207
+ - Start: `npm run start`
208
+ - Open [http://localhost:8080](http://localhost:8080).
209
+
210
+ If you fail to execute the `npm install` command, remove the package-lock.json file and try again.
211
+
212
+ # API
213
+
214
+ ### SchedulerData
215
+
216
+ SchedulerData is the view model of Scheduler, we can modify it to control the view of the Scheduler.
217
+
218
+ #### constructor
219
+
220
+ ```js
221
+ constructor(date=dayjs().format(DATE_FORMAT), viewType = ViewType.Week,
222
+ showAgenda = false, isEventPerspective = false,
223
+ newConfig = undefined, newBehaviors=undefined
224
+ localeDayjs = undefined)
225
+ ```
226
+
227
+ - `date` is a string in `YYYY-MM-DD` format, and is the initial date Scheduler will render. Take the date `2022-12-20`
228
+ for example, Scheduler will render the time window of the week from `2022-12-18` to `2022-12-24` in `ViewType.Week`
229
+ view type, and will render the time window of the `2022-12` month in `ViewType.Month` view type.
230
+ - `viewType` is the initial view type, now Scheduler supports `Day`, `Week`, `Month`, `Quarter`, `Year` 5 built-in view types,
231
+ in addition Scheduler now supports `Custom`, `Custom1`, `Custom2` 3 custom view types at the same time, in which you can control
232
+ the time window yourself, refer to [this example](https://stephenchou1017.github.io/scheduler/#/customtimewindow). `viewType`,
233
+ `showAgenda` and `isEventPerspective` are a group which should be contained in the SchedulerData.config.views array,
234
+ and they together decide which view should be rendered. When `showAgenda` and `isEventPerspective` are both `false`,
235
+ Scheduler will render the resource view, refer to [this example](https://stephenchou1017.github.io/scheduler/#/views).
236
+ - `showAgenda` is a bool value, if true, Scheduler will display the agenda view of current view type. Agenda view is
237
+ read only.
238
+ - `isEventPerspective` is a bool value, if true, Scheduler will display the task view of current view type. In
239
+ resource view, every slot(row) describes how many events a resource does in the time window, while in task view,
240
+ every slot describes how many events a big task is divided into and who will make it done. Add a `groupId` and
241
+ `groupName` property to every event object, so that the events having the same `groupId` will belong to the same big task and
242
+ be rendered in the same slot in task view. If `groupId` and `groupName` are not provided, SchedulerData will take
243
+ the `id` as the `groupId`, and take the `title` as the `groupName`. See the `eventsForTaskView` in the
244
+ [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js) for details.
245
+ - `newConfig` is a config object, used to override the [default config](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/config/scheduler.js)
246
+ fully or partly.
247
+ - `newBehaviors` is a config object, used to override the [default behaviors](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js)
248
+ fully or partly.
249
+ - `localeDayjs` is a locale dayjs object, which is unified used in react-big-scheduler. If not provided, Scheduler will come
250
+ with English(en, United States) locale strings.
251
+
252
+ #### setSchedulerLocale
253
+
254
+ ```js
255
+ setSchedulerLocale(preset);
256
+ ```
257
+
258
+ 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.
259
+
260
+ `preset` will be locale imported from dayjs.
261
+
262
+ #### example:
263
+
264
+ ```js
265
+ import * as dayjsLocale from 'dayjs/locale/pt-br';
266
+
267
+ setSchedulerLocale(dayjsLocale);
268
+ ```
269
+
270
+ By default, Scheduler comes with English(en, United States)
271
+
272
+ #### setCalendarPopoverLocale
273
+
274
+ ```js
275
+ setCalendarPopoverLocale(lang);
276
+ ```
277
+
278
+ 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)
279
+
280
+ #### example:
281
+
282
+ ```js
283
+ import * as antdLocale from 'antd/locale/pt_BR';
284
+
285
+ setCalendarPopoverLocale(antdLocale);
286
+ ```
287
+
288
+ refer this for the demo of the locale.
289
+
290
+ #### setResources
291
+
292
+ ```js
293
+ setResources(resources);
294
+ ```
295
+
296
+ Used to set the resources(the slots in resource view), make sure that there are no duplicated `resource.id` in the `resources`.
297
+ See the demo `resources` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js).
298
+
299
+ #### setEvents
300
+
301
+ ```js
302
+ setEvents(events);
303
+ ```
304
+
305
+ Used to set the events. the event array should be sorted in ascending order by event.start property.
306
+ See the demo `events` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js).
307
+ If we use the task view, we'd better add the `groupId` and the `groupName` property to each event object, see the
308
+ `eventsForTaskView` in the [sample1.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/sample-data/sample1.js) for details.
309
+
310
+ #### prev
311
+
312
+ ```js
313
+ prev();
314
+ ```
315
+
316
+ Let the time window scroll to the left once. When `SchedulerData,viewType` is `ViewType.Month`, the time window will
317
+ scroll a month, when `SchedulerData,viewType` is `ViewType.Week`, the time window will scroll a week. `SchedulerData.events`
318
+ will be clear after calling this method.
319
+
320
+ #### next
321
+
322
+ ```js
323
+ next();
324
+ ```
325
+
326
+ Let the time window scroll to the right once. `SchedulerData.events` will be clear after calling this method.
327
+
328
+ #### setDate
329
+
330
+ ```js
331
+ setDate((date = dayjs().format(DATE_FORMAT)));
332
+ ```
333
+
334
+ Let the time window jump to the provided `date` directly. `SchedulerData.events` will be clear after calling this method.
335
+
336
+ #### setViewType
337
+
338
+ ```js
339
+ setViewType((viewType = ViewType.Week), (showAgenda = false), (isEventPerspective = false));
340
+ ```
341
+
342
+ Tell SchedulerData to change current view, the `viewType`, `showAgenda` and `isEventPerspective` group should be
343
+ provided, and should be contained in the `SchedulerData.config.views` array. `SchedulerData.events` will be clear
344
+ after calling this method.
345
+
346
+ #### setEventGroups
347
+
348
+ ```js
349
+ setEventGroups(eventGroups);
350
+ ```
351
+
352
+ Used to set the event groups(the slots in task view), make sure that there are no duplicated `eventGroup.id` in the `eventGroups`.
353
+ This method is optional, and is needed only when `SchedulerData.eventGroupsAutoGenerated` is `false`.
354
+
355
+ #### setEventGroupsAutoGenerated
356
+
357
+ ```js
358
+ setEventGroupsAutoGenerated(autoGenerated);
359
+ ```
360
+
361
+ Tell SchedulerData to generate `SchedulerData.eventGroups` automatically or not. If `true`, SchedulerData will generate the event
362
+ groups(slots) automatically according to the `event.groupId` and 'event.groupName' automatically. If `groupId` and 'groupName' are
363
+ not provided, SchedulerData will take `event.id` and `event.title` instead.
364
+
365
+ #### setMinuteStep
366
+
367
+ ```js
368
+ setMinuteStep(minuteStep);
369
+ ```
370
+
371
+ Used to set minute step for daily view and refresh the render data.
372
+
373
+ #### toggleExpandStatus
374
+
375
+ ```js
376
+ toggleExpandStatus(slotId);
377
+ ```
378
+
379
+ Used to toggle slot's(and its children's) expand status.
380
+
381
+ #### getMinuteStepsInHour
382
+
383
+ ```js
384
+ getMinuteStepsInHour();
385
+ ```
386
+
387
+ Used to get minute steps in an hour, it equals 60 / SchedulerData.config.minuteStep.
388
+
389
+ #### addResource
390
+
391
+ ```js
392
+ addResource(resource);
393
+ ```
394
+
395
+ Add the `resource` to the `SchedulerData.resources`, make sure that `resource.id` is not duplicated. Refer
396
+ to [this example](https://stephenchou1017.github.io/scheduler/#/addresource).
397
+
398
+ #### addEventGroup
399
+
400
+ ```js
401
+ addEventGroup(eventGroup);
402
+ ```
403
+
404
+ Add the `eventGroup` to the `SchedulerData.eventGroups`, make sure that `eventGroup.id` is not duplicated. Please note
405
+ that the `eventGroup` added may be override when `SchedulerData.eventGroupsAutoGenerated` is `true` and
406
+ `SchedulerData.eventGroups` is auto-generated.
407
+
408
+ #### addEvent
409
+
410
+ ```js
411
+ addEvent(newEvent);
412
+ ```
413
+
414
+ Add the `newEvent` to the `SchedulerData.events`, make sure that `newEvent.id` is not duplicated. SchedulerData will
415
+ place the `newEvent` in the right index according to the `newEvent.start` property.
416
+
417
+ #### updateEventStart
418
+
419
+ ```js
420
+ updateEventStart(event, newStart);
421
+ ```
422
+
423
+ Update the `newStart` to the `event.start`, `newStart` is a string in `YYYY-MM-DD HH:mm:ss` format(similarly hereinafter).
424
+ SchedulerData will replace the `event` in the right index according to the `newStart` value.
425
+
426
+ #### updateEventEnd
427
+
428
+ ```js
429
+ updateEventEnd(event, newEnd);
430
+ ```
431
+
432
+ Update the `newEnd` to the `event.end`.
433
+
434
+ #### moveEvent
435
+
436
+ ```js
437
+ moveEvent(event, newSlotId, newSlotName, newStart, newEnd);
438
+ ```
439
+
440
+ Update the `newSlotId`, `newSlotName`, `newStart`, `newEnd` of the `event`. In resource view, new slot is a resource,
441
+ while in task view, new slot is a event group. SchedulerData will replace the `event` in the right index according
442
+ to the `newStart` value.
443
+
444
+ #### removeEvent
445
+
446
+ ```js
447
+ removeEvent(event);
448
+ ```
449
+
450
+ Remove the given event from `SchedeulerData.events`.
451
+
452
+ #### removeEventById
453
+
454
+ ```js
455
+ removeEventById(eventId);
456
+ ```
457
+
458
+ Remove event from `SchedeulerData.events` by the given event id.
459
+
460
+ #### getSlots
461
+
462
+ ```js
463
+ getSlots();
464
+ ```
465
+
466
+ Returns the slot array, `SchedulerData.resources` in resource view, `SchedulerData.eventGroups` in task view.
467
+
468
+ #### getSlotById
469
+
470
+ ```js
471
+ getSlotById(slotId);
472
+ ```
473
+
474
+ Returns the slot by `slotId`, returns `undefined` if not found.
475
+
476
+ #### getResourceById
477
+
478
+ ```js
479
+ getResourceById(resourceId);
480
+ ```
481
+
482
+ #### isEventInTimeWindow
483
+
484
+ ```js
485
+ isEventInTimeWindow(eventStart, eventEnd, windowStart, windowEnd);
486
+ ```
487
+
488
+ Returns whether an event is in the time window or not, remind that `eventStart`, `eventEnd`, `windowStart`, `windowEnd`
489
+ are all dayjs | Date objects.
490
+
491
+ #### getViewDates
492
+
493
+ ```js
494
+ getViewDates();
495
+ ```
496
+
497
+ Returns an object with the startDate and endDate of the currently selected view ({ startDate: Dayjs, endDate: Dayjs }).
498
+
499
+ #### getViewStartDate
500
+
501
+ ```js
502
+ getViewStartDate();
503
+ ```
504
+
505
+ Returns a dayjs object with the startDate of the currently selected view.
506
+
507
+ #### getViewEndDate
508
+
509
+ ```js
510
+ getViewEndDate();
511
+ ```
512
+
513
+ Returns a dayjs object with the endDate of the currently selected view.
514
+
515
+ ### Locale support(Refer to [this example](https://stephenchou1017.github.io/scheduler/#/locale) for details.)
516
+
517
+ #### SchedulerData.config.resourceName
518
+
519
+ The locale string of resource name.
520
+
521
+ #### SchedulerData.config.taskName
522
+
523
+ The locale string of task name.
524
+
525
+ #### SchedulerData.config.agendaViewHeader
526
+
527
+ The locale string of agenda view header.
528
+
529
+ #### SchedulerData.config.addMorePopoverHeaderFormat
530
+
531
+ The locale string of add more popover header format.
532
+
533
+ #### SchedulerData.config.eventItemPopoverDateFormat
534
+
535
+ The locale string of event item popover date format.
536
+
537
+ #### SchedulerData.config.nonAgendaDayCellHeaderFormat
538
+
539
+ The locale string of non-agenda view cell header format of day view type.
540
+
541
+ #### SchedulerData.config.nonAgendaOtherCellHeaderFormat
542
+
543
+ The locale string of non-agenda view cell header format of other view types.
544
+
545
+ #### SchedulerData.behaviors.getDateLabelFunc
546
+
547
+ 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)
548
+
549
+ ### SchedulerData.config(See the [config file](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/config/scheduler.js) for details.)
550
+
551
+ #### schedulerWidth
552
+
553
+ The width of Scheduler. Scheduler uses responsive layout so schedulerWidth should be a percentage,
554
+ Scheduler in the responsive layout:
555
+ `actual width of Scheduler = (SchedulerData.documentWidth - SchedulerData.config.besidesWidth) * SchedulerData.config.schedulerWidth`
556
+ `SchedulerData.documentWidth` is the window width of browser (or the the parent width in case SchedulerData.config.responsiveByParent
557
+ and Scheduler component prop parentRef is passed) and will change automatically when resized.
558
+
559
+ #### responsiveByParent
560
+
561
+ When true, Scheduler resposiveness will not be determined by the window width of browser but instead by the
562
+ width of the of the parent (the parent ref must be passed to the Scheduler component prop named `parentRef`,
563
+ in case it is not passed resposiveness will fall back to being determined by the window width).
564
+ Meaning:
565
+ `SchedulerData.documentWidth` is the width of the parent and will change automatically when resized
566
+
567
+ #### schedulerMaxHeight
568
+
569
+ The max height of Scheduler. If the desired height is bigger than the max height, the header row of Scheduler will be
570
+ frozen and vertical scroll bar will appear, but this won't happen when the max height is set to `0`. Refer
571
+ to [this example](https://stephenchou1017.github.io/scheduler/#/freezefirstrow).
572
+
573
+ **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.**
574
+ When conforming to the parent container, the Scheduler will fill the available space and scroll bars will appear as needed.
575
+
576
+ #### underneathHeight
577
+
578
+ 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.
579
+
580
+ **Example:** If your parent container is 600px tall and `underneathHeight` is 50, the Scheduler will use up to 550px of height.
581
+
582
+ #### tableHeaderHeight
583
+
584
+ Height of Scheduler table header.
585
+
586
+ #### agendaResourceTableWidth
587
+
588
+ Width of the left Scheduler resource column in agenda view.
589
+
590
+ #### agendaMaxEventWidth
591
+
592
+ Max width of an event item in agenda view.
593
+
594
+ #### dayResourceTableWidth, weekResourceTableWidth, monthResourceTableWidth, yearResourceTableWidth, quarterResourceTableWidth
595
+
596
+ Width of the left Scheduler resource column in resource view and task view of different view types.
597
+
598
+ #### dayCellWidth, weekCellWidth, monthCellWidth, yearCellWidth, quarterCellWidth
599
+
600
+ Width of Scheduler table cells in resource view and task view of different view types.
601
+
602
+ #### dayMaxEvents, weekMaxEvents, monthMaxEvents, yearMaxEvents, quarterMaxEvents
603
+
604
+ Max events count of a cell in resource view and task view of different view types. A '+N more' will appear when exceeded.
605
+ Refer to [this example](https://stephenchou1017.github.io/scheduler/#/addmore).
606
+
607
+ #### eventItemHeight
608
+
609
+ Height of an event item in 3 views.
610
+
611
+ #### eventItemLineHeight
612
+
613
+ Line height of an event item in 3 views.
614
+
615
+ #### nonAgendaSlotMinHeight
616
+
617
+ Min height of a slot in non-agenda views, default 0, means there is no min height.
618
+
619
+ #### dayStartFrom
620
+
621
+ Start hour rendered from in `ViewType.Day` in resource view and task view, default 0.
622
+
623
+ #### dayStopTo
624
+
625
+ End hour rendered to in `ViewType.Day` in resource view and task view, default 23.
626
+
627
+ #### defaultEventBgColor
628
+
629
+ Default event item background color in 3 views, will be override if there is a `bgColor` property in event object.
630
+
631
+ #### selectedAreaColor
632
+
633
+ Selected cells color in resource view and task view, cells are selectable only when `creatable` is `true`.
634
+
635
+ #### nonWorkingTimeHeadColor
636
+
637
+ Color of non-working time head cells. Modify `SchedulerData.behaviors.isNonWorkingTimeFunc` to re-define non-working time.
638
+ Refer the `isNonWorkingTime` func in the [behaviors.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js).
639
+
640
+ #### nonWorkingTimeHeadBgColor
641
+
642
+ Background color of non-working time head cells.
643
+
644
+ #### nonWorkingTimeBodyBgColor
645
+
646
+ Background color of non-working time body cells.
647
+
648
+ #### summaryColor
649
+
650
+ Color of cell summary. Modify `SchedulerData.behaviors.getSummaryFunc` to display summary in a cell.
651
+ Refer the `getSummary` func in the [behaviors.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js).
652
+
653
+ #### summaryPos
654
+
655
+ Position of cell summary, supports `SummaryPos.Top`, `SummaryPos.TopRight`, `SummaryPos.TopLeft`, `SummaryPos.Bottom`,
656
+ `SummaryPos.BottomRight` and `SummaryPos.BottomLeft`.
657
+
658
+ #### startResizable
659
+
660
+ Controls whether to resize the start of every event item in resource view and task view. If `false`, all item starts are
661
+ non-resizable, if `true`, all item starts are resizable except those who have a `resizable` or `startResizable`
662
+ property and its value is `false`.
663
+
664
+ #### endResizable
665
+
666
+ Controls whether to resize the end of every event item in resource view and task view. If `false`, all item ends are
667
+ non-resizable, if `true`, all item ends are resizable except those who have a `resizable` or `endResizable`
668
+ property and its value is `false`.
669
+
670
+ #### movable
671
+
672
+ Controls whether to move every event item in resource view and task view. If `false`, all items are
673
+ non-movable, if `true`, all items are movable except those who have a `movable` property and its value is `false`.
674
+
675
+ #### creatable
676
+
677
+ Controls whether to create new event item in resource view and task view.
678
+
679
+ #### crossResourceMove
680
+
681
+ Controls whether to cross-slot move an event item in resource view and task view. If `false`, the `slotId` and `slotName`
682
+ won't change in the `moveEvent` method. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/nocrossslotmove).
683
+
684
+ #### checkConflict
685
+
686
+ Controls whether to check conflicts when creating, resizing or moving an event item in resource view and task view. If
687
+ `true`, Scheduler will call the `conflictOccurred` function if given. Refer to
688
+ [this example](https://stephenchou1017.github.io/scheduler/#/overlapcheck).
689
+
690
+ #### scrollToSpecialDayjsEnabled
691
+
692
+ Controls Scheduler whether to scroll to special dayjs automatically when the time window contains special dayjs. If `true`, Scheduler
693
+ horizontal bar will scroll to special dayjs after calling `setScrollToSpecialDayjs(true)` to SchedulerData. Use `SchedulerData.behaviors.getScrollSpecialDayjsFunc`
694
+ to tell Scheduler what time the special dayjs is.
695
+
696
+ #### eventItemPopoverEnabled
697
+
698
+ Controls Scheduler whether to display event item popover when moving mouse on an event item, default `true`.
699
+
700
+ #### eventItemPopoverTrigger
701
+
702
+ Controls Scheduler event item popover trigger, default `hover`.
703
+ Controls Scheduler whether to display event item popover when moving mouse on an event item, default `true`.
704
+
705
+ #### eventItemPopoverPlacement
706
+
707
+ Controls Scheduler event item popover placement (`'topLeftMousePosition' | 'bottomLeftMousePosition' | 'topRightMousePosition' | 'bottomRightMousePosition' | 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom'`), default `bottomLeft`.
708
+
709
+ #### eventItemPopoverWidth
710
+
711
+ 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.
712
+
713
+ #### calendarPopoverEnabled
714
+
715
+ Controls Scheduler whether to display calendar popover when clicking on a date label in header, default `true`.
716
+
717
+ #### recurringEventsEnabled
718
+
719
+ Controls Scheduler whether to support recurring event, refer to [this feature request](https://github.com/StephenChou1017/react-big-scheduler/issues/8), default `true`.
720
+ If `true`, SchedulerData will filter out those template events who has a `rrule` string property in `setEvents` method,
721
+ generate the recurring events in the time window, and insert them into the event array in the right orders. The recurring events
722
+ generated from the same template event, all have a new id like `${templateEvent.id}-${number}`, and have a `recurringEventId`
723
+ property with the value `templateEvent.id`.
724
+
725
+ #### headerEnabled
726
+
727
+ Controls Scheduler whether to display header, default `true`.
728
+
729
+ #### resourceViewEnabled
730
+
731
+ Controls Scheduler whether to display resource view, default `true`.
732
+
733
+ #### displayWeekend
734
+
735
+ Controls Scheduler whether to display weekends in non-agenda view, default `true`.
736
+
737
+ #### relativeMove
738
+
739
+ Controls Scheduler whether to move events(only DnDTypes.EVENT type) relatively or absolutely, default `true`, means relatively.
740
+
741
+ #### minuteStep
742
+
743
+ Minute step for day view type in non-agenda view, can be 10, 12, 15, 20, 30, 60, etc, default 30.
744
+
745
+ #### views
746
+
747
+ Array of view that Scheduler will support.
748
+
749
+ #### dragAndDropEnabled
750
+
751
+ 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).
752
+
753
+ ### SchedulerData.behaviors(See the [behaviors.js](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/helper/behaviors.js) for details.)
754
+
755
+ #### getEventTextFunc
756
+
757
+ ```js
758
+ getEventTextFunc(schedulerData, event);
759
+ ```
760
+
761
+ Method that defines the text displayed in the `event`.
762
+
763
+ #### isNonWorkingTimeFunc
764
+
765
+ ```js
766
+ isNonWorkingTimeFunc(schedulerData, time);
767
+ ```
768
+
769
+ Method that defines non-working time.
770
+
771
+ #### getSummaryFunc
772
+
773
+ ```js
774
+ getSummary(schedulerData, headerEvents, slotId, slotName, headerStart, headerEnd);
775
+ ```
776
+
777
+ Method that defines the summary text displayed in the Scheduler cells.Refer
778
+ to [this example](https://stephenchou1017.github.io/scheduler/#/summary).
779
+
780
+ #### getCustomDateFunc
781
+
782
+ ```js
783
+ getCustomDate(schedulerData, num, (date = undefined));
784
+ ```
785
+
786
+ Method that controls the start and end of time window when current view type is Custom, Custom1 or Custom2.Refer
787
+ to [this example](https://stephenchou1017.github.io/scheduler/#/customtimewindow).
788
+
789
+ #### getNonAgendaViewBodyCellBgColorFunc
790
+
791
+ ```js
792
+ getNonAgendaViewBodyCellBgColor(schedulerData, slotId, header);
793
+ ```
794
+
795
+ Method that sets the background color of cells dynamically.
796
+
797
+ #### getScrollSpecialDayjsFunc
798
+
799
+ ```js
800
+ getScrollSpecialDayjs(schedulerData, startDayjs, endDayjs);
801
+ ```
802
+
803
+ Method that defines the special dayjs Scheduler will scroll to automatically, when the time window contains that dayjs.
804
+
805
+ ### Scheduler.propTypes
806
+
807
+ #### schedulerData
808
+
809
+ ```js
810
+ schedulerData: PropTypes.object.isRequired;
811
+ ```
812
+
813
+ View model of the Scheduler component, provides data.
814
+
815
+ #### parentRef
816
+
817
+ ```js
818
+ parentRef: PropTypes.object;
819
+ ```
820
+
821
+ ref of the component that is the parent of the Scheduler component
822
+
823
+ #### prevClick
824
+
825
+ ```js
826
+ prevClick: PropTypes.func.isRequired;
827
+ prevClick(schedulerData);
828
+ ```
829
+
830
+ Callback function fired when the left point bracket '<' is clicked.
831
+
832
+ #### nextClick
833
+
834
+ ```js
835
+ nextClick: PropTypes.func.isRequired;
836
+ nextClick(schedulerData);
837
+ ```
838
+
839
+ Callback function fired when the right point bracket '>' is clicked.
840
+
841
+ #### onViewChange
842
+
843
+ ```js
844
+ onViewChange: PropTypes.func.isRequired;
845
+ onViewChange(schedulerData, view);
846
+ ```
847
+
848
+ Callback function fired when the Scheduler view changed. `view` is a json such as { viewType: ViewType.Month,
849
+ showAgenda: true, isEventPerspective: false}.
850
+
851
+ #### onSelectDate
852
+
853
+ ```js
854
+ onSelectDate: PropTypes.func.isRequired;
855
+ onSelectDate(schedulerData, date);
856
+ ```
857
+
858
+ Callback function fired when a new date is selected. `date` is the new selected data, a string in `YYYY-MM-DD` format.
859
+
860
+ #### eventItemClick
861
+
862
+ ```js
863
+ eventItemClick: PropTypes.func;
864
+ eventItemClick(schedulerData, event);
865
+ ```
866
+
867
+ Callback function fired when you click an event item.
868
+
869
+ #### updateEventStart
870
+
871
+ ```js
872
+ updateEventStart: PropTypes.func;
873
+ updateEventStart(schedulerData, event, newStart);
874
+ ```
875
+
876
+ Callback function fired when resizing the start of the `event`, `newStart` is a string in `YYYY-MM-DD HH:mm:ss` format.
877
+
878
+ #### updateEventEnd
879
+
880
+ ```js
881
+ updateEventEnd: PropTypes.func;
882
+ updateEventEnd(schedulerData, event, newEnd);
883
+ ```
884
+
885
+ Callback function fired when resizing the end of the `event`, `newEnd` is a string in `YYYY-MM-DD HH:mm:ss` format.
886
+
887
+ #### moveEvent
888
+
889
+ ```js
890
+ moveEvent: PropTypes.func;
891
+ moveEvent((schedulerData, event, slotId, slotName, newStart, newEnd));
892
+ ```
893
+
894
+ Callback function fired when moving the `event`. `slotId`, `slotName` are the new `id` and `name` of the slot moving into,
895
+ but they won't change if the `SchedulerData.config.crossResourceMove` is `false`. `newStart`, `newEnd` are the new beginning
896
+ and ending of the `event`.
897
+
898
+ #### newEvent
899
+
900
+ ```js
901
+ newEvent: PropTypes.func;
902
+ newEvent(schedulerData, slotId, slotName, start, end, type, item);
903
+ ```
904
+
905
+ Callback function fired when creating a new event, or dragging an external item and dropping it into the resource view or task
906
+ view. `slotId` and `slotName` are the slot creating in or dropping into, `start`, `end` are the beginning and ending of the
907
+ event. If it's a drag&drop operation, the `type` is the DnDType of DnDSource registered to Scheduler, and the `item` is the
908
+ external item.
909
+
910
+ #### leftCustomHeader, rightCustomHeader
911
+
912
+ ```js
913
+ leftCustomHeader: PropTypes.object;
914
+ rightCustomHeader: PropTypes.object;
915
+ ```
916
+
917
+ Component you need to put in the Scheduler header, it could be a div or a react component. Refer
918
+ to [this example](https://stephenchou1017.github.io/scheduler/#/customheader).
919
+
920
+ #### conflictOccurred
921
+
922
+ ```js
923
+ conflictOccurred: PropTypes.func;
924
+ conflictOccurred(schedulerData, action, event, type, slotId, slotName, start, end);
925
+ ```
926
+
927
+ Callback function fired when there is a conflict. This could happen when creating, resizing or moving an event, and when
928
+ `SchedulerData.config.checkConflict` is `true`.
929
+
930
+ #### eventItemTemplateResolver
931
+
932
+ ```js
933
+ eventItemTemplateResolver: PropTypes.func;
934
+ eventItemTemplateResolver(schedulerData, event, bgColor, isStart, isEnd, mustAddCssClass, mustBeHeight, agendaMaxEventWidth);
935
+ ```
936
+
937
+ Use this function, you can customize the event style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/customeventstyle).
938
+
939
+ ### eventItemPopoverTemplateResolver
940
+
941
+ ```js
942
+ eventItemPopoverTemplateResolver: PropTypes.func;
943
+ eventItemPopoverTemplateResolver(schedulerData, eventItem, title, start, end, statusColor);
944
+ ```
945
+
946
+ Use this function, you can customize the event's popover style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/custompopover).
947
+
948
+ #### slotItemTemplateResolver
949
+
950
+ ```js
951
+ slotItemTemplateResolver: PropTypes.func;
952
+ slotItemTemplateResolver(schedulerData, slot, slotClickedFunc, width, clsName);
953
+ ```
954
+
955
+ Use this function, you can customize the left slot style.
956
+
957
+ #### nonAgendaCellHeaderTemplateResolver
958
+
959
+ ```js
960
+ nonAgendaCellHeaderTemplateResolver: PropTypes.func;
961
+ nonAgendaCellHeaderTemplateResolver(schedulerData, item, formattedDateItems, style);
962
+ ```
963
+
964
+ Use this function, you can customize the table header cell style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/customtableheaders).
965
+
966
+ #### onScrollLeft, onScrollRight
967
+
968
+ ```js
969
+ onScrollLeft: PropTypes.func;
970
+ onScrollLeft(schedulerData, schedulerContent, maxScrollLeft);
971
+ onScrollRight: PropTypes.func;
972
+ onScrollRight(schedulerData, schedulerContent, maxScrollLeft);
973
+ ```
974
+
975
+ Callback function fired when the scheduler content div scrolls to leftmost or rightmost. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/infinitescroll).
976
+
977
+ #### onScrollTop, onScrollBottom
978
+
979
+ ```js
980
+ onScrollTop: PropTypes.func;
981
+ onScrollTop(schedulerData, schedulerContent, maxScrollTop);
982
+ onScrollBottom: PropTypes.func;
983
+ onScrollBottom(schedulerData, schedulerContent, maxScrollTop);
984
+ ```
985
+
986
+ Callback function fired when the scheduler content div scrolls to topmost or bottommost. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/infinitescroll).
987
+
988
+ #### slotClickedFunc
989
+
990
+ ```js
991
+ slotClickedFunc: PropTypes.func;
992
+ ```
993
+
994
+ If it's set, slots will be clickable, and will fire this function when a slot is clicked. Refer
995
+ to [this example](https://stephenchou1017.github.io/scheduler/#/resourceclickable).
996
+
997
+ #### dndSources
998
+
999
+ ```js
1000
+ dndSources: PropTypes.array;
1001
+ ```
1002
+
1003
+ DnDSource array that registered to Scheduler. Use [DnDSource](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/components/DnDSource.js),
1004
+ we can simplify the drag and drop coding in React-Big-Scheduler. Refer
1005
+ to [this example](https://stephenchou1017.github.io/scheduler/#/draganddrop).
1006
+
1007
+ #### onSetAddMoreState
1008
+
1009
+ ```js
1010
+ onSetAddMoreState: PropTypes.func;
1011
+ onSetAddMoreState(newState);
1012
+ ```
1013
+
1014
+ Callback function fired when a '+N more' is clicked, is used to control the visibility and the position of the `AddMorePopover`.
1015
+ `newState` is a json such as {headerItem: headerItem, left: 20, top: 20, height: 100}. Refer
1016
+ to [this example](https://stephenchou1017.github.io/scheduler/#/addmore).
1017
+
1018
+ #### subtitleGetter
1019
+
1020
+ ```js
1021
+ subtitleGetter: PropTypes.func;
1022
+ subtitleGetter(schedulerData, event);
1023
+ ```
1024
+
1025
+ Use this function, you can display a subtitle in the `EventItemPopover`.
1026
+
1027
+ #### viewEventClick
1028
+
1029
+ ```js
1030
+ viewEventClick: PropTypes.func;
1031
+ viewEventClick(schedulerData, event);
1032
+ ```
1033
+
1034
+ Callback function fired when you click one operation link in the `EventItemPopover`. The operation link won't appear if this
1035
+ function isn't set.
1036
+
1037
+ #### viewEventText
1038
+
1039
+ ```js
1040
+ viewEventText: PropTypes.string;
1041
+ ```
1042
+
1043
+ Text of one operation link in the `EventItemPopover`. The operation link won't appear if this text isn't set.
1044
+
1045
+ #### viewEvent2Click
1046
+
1047
+ ```js
1048
+ viewEvent2Click: PropTypes.func;
1049
+ viewEvent2Click(schedulerData, event);
1050
+ ```
1051
+
1052
+ Callback function fired when you click the other operation link in the `EventItemPopover`. The other operation link won't
1053
+ appear if this function isn't set.
1054
+
1055
+ #### viewEvent2Text
1056
+
1057
+ ```js
1058
+ viewEvent2Text: PropTypes.string;
1059
+ ```
1060
+
1061
+ Text of the other operation link in the `EventItemPopover`. The other operation link won't appear if this text isn't set.