react-big-schedule 4.2.0 → 4.2.2

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