react-big-schedule 7.0.0 → 7.1.1-beta.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
@@ -17,7 +17,7 @@ Unlock the potential of your React projects with react-big-schedule and revoluti
17
17
 
18
18
  ### This project code is forked from:
19
19
 
20
- - [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
20
+ - [react-big-scheduler](https://github.com/StephenChou1017/react-big-scheduler).
21
21
  - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
22
22
 
23
23
  ## Installation
@@ -93,7 +93,7 @@ Special thanks to the following contributors:
93
93
 
94
94
  We would like to acknowledge the following projects for their inspiration and contributions:
95
95
 
96
- - [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
96
+ - [react-big-scheduler](https://github.com/StephenChou1017/react-big-scheduler).
97
97
  - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
98
98
 
99
99
  ## Roadmap
@@ -240,10 +240,10 @@ constructor(date=dayjs().format(DATE_FORMAT), viewType = ViewType.Week,
240
240
  view type, and will render the time window of the `2022-12` month in `ViewType.Month` view type.
241
241
  - `viewType` is the initial view type, now Scheduler supports `Day`, `Week`, `Month`, `Quarter`, `Year` 5 built-in view types,
242
242
  in addition Scheduler now supports `Custom`, `Custom1`, `Custom2` 3 custom view types at the same time, in which you can control
243
- the time window yourself, refer to [this example](https://stephenchou1017.github.io/scheduler/#/customtimewindow). `viewType`,
243
+ the time window yourself, refer to [this example](https://react-big-schedule.vercel.app/custom-time). `viewType`,
244
244
  `showAgenda` and `isEventPerspective` are a group which should be contained in the SchedulerData.config.views array,
245
245
  and they together decide which view should be rendered. When `showAgenda` and `isEventPerspective` are both `false`,
246
- Scheduler will render the resource view, refer to [this example](https://stephenchou1017.github.io/scheduler/#/views).
246
+ Scheduler will render the resource view, refer to [this example](https://react-big-schedule.vercel.app/basic).
247
247
  - `showAgenda` is a bool value, if true, Scheduler will display the agenda view of current view type. Agenda view is
248
248
  read only.
249
249
  - `isEventPerspective` is a bool value, if true, Scheduler will display the task view of current view type. In
@@ -410,7 +410,7 @@ addResource(resource);
410
410
  ```
411
411
 
412
412
  Add the `resource` to the `SchedulerData.resources`, make sure that `resource.id` is not duplicated. Refer
413
- to [this example](https://stephenchou1017.github.io/scheduler/#/addresource).
413
+ to [this example](https://react-big-schedule.vercel.app/customization).
414
414
 
415
415
  #### addEventGroup
416
416
 
@@ -529,7 +529,7 @@ getViewEndDate();
529
529
 
530
530
  Returns a dayjs object with the endDate of the currently selected view.
531
531
 
532
- ### Locale support(Refer to [this example](https://stephenchou1017.github.io/scheduler/#/locale) for details.)
532
+ ### Locale support(Refer to [this example](https://react-big-schedule.vercel.app/custom-time) for details.)
533
533
 
534
534
  #### SchedulerData.config.resourceName
535
535
 
@@ -586,7 +586,7 @@ Scheduler component. Without `parentRef` the window height is used.
586
586
 
587
587
  The max height of Scheduler. If the desired height is bigger than the max height, the header row of Scheduler will be
588
588
  frozen and vertical scroll bar will appear, but this won't happen when the max height is set to `0`. Refer
589
- to [this example](https://stephenchou1017.github.io/scheduler/#/freezefirstrow).
589
+ to [this example](https://react-big-schedule.vercel.app/customization).
590
590
 
591
591
  **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.**
592
592
  When conforming to the parent container, the Scheduler will fill the available space and scroll bars will appear as needed.
@@ -620,7 +620,7 @@ Width of Scheduler table cells in resource view and task view of different view
620
620
  #### dayMaxEvents, weekMaxEvents, monthMaxEvents, yearMaxEvents, quarterMaxEvents
621
621
 
622
622
  Max events count of a cell in resource view and task view of different view types. A '+N more' will appear when exceeded.
623
- Refer to [this example](https://stephenchou1017.github.io/scheduler/#/addmore).
623
+ Refer to [this example](https://react-big-schedule.vercel.app/add-more).
624
624
 
625
625
  #### eventItemHeight
626
626
 
@@ -697,13 +697,13 @@ Controls whether to create new event item in resource view and task view.
697
697
  #### crossResourceMove
698
698
 
699
699
  Controls whether to cross-slot move an event item in resource view and task view. If `false`, the `slotId` and `slotName`
700
- won't change in the `moveEvent` method. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/nocrossslotmove).
700
+ won't change in the `moveEvent` method. Refer to [this example](https://react-big-schedule.vercel.app/customization).
701
701
 
702
702
  #### checkConflict
703
703
 
704
704
  Controls whether to check conflicts when creating, resizing or moving an event item in resource view and task view. If
705
705
  `true`, Scheduler will call the `conflictOccurred` function if given. Refer to
706
- [this example](https://stephenchou1017.github.io/scheduler/#/overlapcheck).
706
+ [this example](https://react-big-schedule.vercel.app/customization).
707
707
 
708
708
  #### scrollToSpecialDayjsEnabled
709
709
 
@@ -793,7 +793,7 @@ getSummary(schedulerData, headerEvents, slotId, slotName, headerStart, headerEnd
793
793
  ```
794
794
 
795
795
  Method that defines the summary text displayed in the Scheduler cells.Refer
796
- to [this example](https://stephenchou1017.github.io/scheduler/#/summary).
796
+ to [this example](https://react-big-schedule.vercel.app/customization).
797
797
 
798
798
  #### getCustomDateFunc
799
799
 
@@ -802,7 +802,7 @@ getCustomDate(schedulerData, num, (date = undefined));
802
802
  ```
803
803
 
804
804
  Method that controls the start and end of time window when current view type is Custom, Custom1 or Custom2.Refer
805
- to [this example](https://stephenchou1017.github.io/scheduler/#/customtimewindow).
805
+ to [this example](https://react-big-schedule.vercel.app/custom-time).
806
806
 
807
807
  #### getNonAgendaViewBodyCellBgColorFunc
808
808
 
@@ -950,7 +950,7 @@ rightCustomHeader: PropTypes.object;
950
950
  ```
951
951
 
952
952
  Component you need to put in the Scheduler header, it could be a div or a react component. Refer
953
- to [this example](https://stephenchou1017.github.io/scheduler/#/customheader).
953
+ to [this example](https://react-big-schedule.vercel.app/customization).
954
954
 
955
955
  #### conflictOccurred
956
956
 
@@ -969,7 +969,7 @@ eventItemTemplateResolver: PropTypes.func;
969
969
  eventItemTemplateResolver(schedulerData, event, bgColor, isStart, isEnd, mustAddCssClass, mustBeHeight, agendaMaxEventWidth);
970
970
  ```
971
971
 
972
- Use this function, you can customize the event style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/customeventstyle).
972
+ Use this function, you can customize the event style. Refer to [this example](https://react-big-schedule.vercel.app/customization).
973
973
 
974
974
  ### eventItemPopoverTemplateResolver
975
975
 
@@ -978,7 +978,7 @@ eventItemPopoverTemplateResolver: PropTypes.func;
978
978
  eventItemPopoverTemplateResolver(schedulerData, eventItem, title, start, end, statusColor);
979
979
  ```
980
980
 
981
- Use this function, you can customize the event's popover style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/custompopover).
981
+ Use this function, you can customize the event's popover style. Refer to [this example](https://react-big-schedule.vercel.app/customization).
982
982
 
983
983
  #### slotItemTemplateResolver
984
984
 
@@ -996,7 +996,7 @@ nonAgendaCellHeaderTemplateResolver: PropTypes.func;
996
996
  nonAgendaCellHeaderTemplateResolver(schedulerData, item, formattedDateItems, style);
997
997
  ```
998
998
 
999
- Use this function, you can customize the table header cell style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/customtableheaders).
999
+ Use this function, you can customize the table header cell style. Refer to [this example](https://react-big-schedule.vercel.app/customization).
1000
1000
 
1001
1001
  #### onScrollLeft, onScrollRight
1002
1002
 
@@ -1007,7 +1007,7 @@ onScrollRight: PropTypes.func;
1007
1007
  onScrollRight(schedulerData, schedulerContent, maxScrollLeft);
1008
1008
  ```
1009
1009
 
1010
- Callback function fired when the scheduler content div scrolls to leftmost or rightmost. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/infinitescroll).
1010
+ Callback function fired when the scheduler content div scrolls to leftmost or rightmost. Refer to [this example](https://react-big-schedule.vercel.app/customization).
1011
1011
 
1012
1012
  #### onScrollTop, onScrollBottom
1013
1013
 
@@ -1018,7 +1018,7 @@ onScrollBottom: PropTypes.func;
1018
1018
  onScrollBottom(schedulerData, schedulerContent, maxScrollTop);
1019
1019
  ```
1020
1020
 
1021
- Callback function fired when the scheduler content div scrolls to topmost or bottommost. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/infinitescroll).
1021
+ Callback function fired when the scheduler content div scrolls to topmost or bottommost. Refer to [this example](https://react-big-schedule.vercel.app/customization).
1022
1022
 
1023
1023
  #### slotClickedFunc
1024
1024
 
@@ -1027,7 +1027,7 @@ slotClickedFunc: PropTypes.func;
1027
1027
  ```
1028
1028
 
1029
1029
  If it's set, slots will be clickable, and will fire this function when a slot is clicked. Refer
1030
- to [this example](https://stephenchou1017.github.io/scheduler/#/resourceclickable).
1030
+ to [this example](https://react-big-schedule.vercel.app/customization).
1031
1031
 
1032
1032
  #### dndSources
1033
1033
 
@@ -1037,7 +1037,7 @@ dndSources: PropTypes.array;
1037
1037
 
1038
1038
  DnDSource array that registered to Scheduler. Use [DnDSource](https://github.com/ansulagrawal/react-big-schedule/blob/master/src/components/DnDSource.js),
1039
1039
  we can simplify the drag and drop coding in React-Big-Scheduler. Refer
1040
- to [this example](https://stephenchou1017.github.io/scheduler/#/draganddrop).
1040
+ to [this example](https://react-big-schedule.vercel.app/drag-and-drop).
1041
1041
 
1042
1042
  #### onSetAddMoreState
1043
1043
 
@@ -1048,7 +1048,7 @@ onSetAddMoreState(newState);
1048
1048
 
1049
1049
  Callback function fired when a '+N more' is clicked, is used to control the visibility and the position of the `AddMorePopover`.
1050
1050
  `newState` is a json such as {headerItem: headerItem, left: 20, top: 20, height: 100}. Refer
1051
- to [this example](https://stephenchou1017.github.io/scheduler/#/addmore).
1051
+ to [this example](https://react-big-schedule.vercel.app/add-more).
1052
1052
 
1053
1053
  #### subtitleGetter
1054
1054
 
@@ -720,7 +720,8 @@ EventItem.propTypes = {
720
720
  viewEvent2Click: PropTypes.func,
721
721
  viewEvent2Text: PropTypes.string,
722
722
  conflictOccurred: PropTypes.func,
723
- eventItemTemplateResolver: PropTypes.func
723
+ eventItemTemplateResolver: PropTypes.func,
724
+ eventItemPopoverTemplateResolver: PropTypes.func
724
725
  };
725
726
  EventItem.defaultProps = {
726
727
  isDragging: undefined,
@@ -736,5 +737,6 @@ EventItem.defaultProps = {
736
737
  viewEvent2Click: undefined,
737
738
  viewEvent2Text: undefined,
738
739
  conflictOccurred: undefined,
739
- eventItemTemplateResolver: undefined
740
+ eventItemTemplateResolver: undefined,
741
+ eventItemPopoverTemplateResolver: undefined
740
742
  };
@@ -29,6 +29,7 @@ class ResourceEvents extends PureComponent {
29
29
  viewEvent2Text: PropTypes.string,
30
30
  newEvent: PropTypes.func,
31
31
  eventItemTemplateResolver: PropTypes.func,
32
+ eventItemPopoverTemplateResolver: PropTypes.func,
32
33
  onSelectionChange: PropTypes.func,
33
34
  isRowSelected: PropTypes.bool,
34
35
  selectionPreview: PropTypes.shape({
@@ -268,7 +269,7 @@ class ResourceEvents extends PureComponent {
268
269
  rightIndex
269
270
  } = this.state;
270
271
  this.cleanupDragInteraction();
271
- if (headers.length === 0 || !resourceEvents.headerItems || resourceEvents.headerItems.length === 0) {
272
+ const resetSelection = () => {
272
273
  this.setState({
273
274
  startX: 0,
274
275
  leftIndex: 0,
@@ -284,13 +285,25 @@ class ResourceEvents extends PureComponent {
284
285
  left: 0,
285
286
  width: 0
286
287
  });
288
+ };
289
+ if (headers.length === 0 || !resourceEvents.headerItems || resourceEvents.headerItems.length === 0) {
290
+ resetSelection();
287
291
  return;
288
292
  }
293
+
294
+ // a cell width of 0 (container not measured yet) makes the drag indexes NaN or Infinity
295
+ const toIndex = (value, fallback) => Number.isFinite(value) ? value : fallback;
289
296
  const maxLeftIndex = headers.length - 1;
290
- const safeLeftIndex = Math.max(0, Math.min(leftIndex, maxLeftIndex));
297
+ const safeLeftIndex = Math.max(0, Math.min(toIndex(leftIndex, 0), maxLeftIndex));
291
298
  const maxRightIndex = Math.min(headers.length, resourceEvents.headerItems.length);
292
- let safeRightIndex = Math.max(1, rightIndex, safeLeftIndex + 1);
299
+ let safeRightIndex = Math.max(1, toIndex(rightIndex, 1), safeLeftIndex + 1);
293
300
  safeRightIndex = Math.min(safeRightIndex, maxRightIndex);
301
+
302
+ // headers and headerItems can be out of step while the view rebuilds; drop the selection instead of throwing
303
+ if (!headers[safeLeftIndex] || !resourceEvents.headerItems[safeRightIndex - 1]) {
304
+ resetSelection();
305
+ return;
306
+ }
294
307
  const isVertical = schedulerData.isVerticalResourceView();
295
308
  // vertical view: rows are time slots and columns are resources, so the roles swap
296
309
  const selectedRowIds = this.getSelectedResourceIds();
@@ -575,6 +588,7 @@ class ResourceEvents extends PureComponent {
575
588
  viewEvent2Click: this.props.viewEvent2Click,
576
589
  viewEvent2Text: this.props.viewEvent2Text,
577
590
  eventItemTemplateResolver: this.props.eventItemTemplateResolver,
591
+ eventItemPopoverTemplateResolver: this.props.eventItemPopoverTemplateResolver,
578
592
  subtitleGetter: this.props.subtitleGetter,
579
593
  updateEventStart: this.props.updateEventStart,
580
594
  updateEventEnd: this.props.updateEventEnd,
@@ -364,10 +364,11 @@ function Scheduler(props) {
364
364
  viewEvent2Text: props.viewEvent2Text,
365
365
  newEvent: props.newEvent,
366
366
  eventItemTemplateResolver: props.eventItemTemplateResolver,
367
+ eventItemPopoverTemplateResolver: props.eventItemPopoverTemplateResolver,
367
368
  onSelectionChange: handleSelectionChange,
368
369
  isRowSelected: selectedIdsSet.has(item.slotId),
369
370
  selectionPreview: selectionPreview
370
- }, item.slotId)), [displayRenderData, schedulerData, schedulerDataVersion, eventDndSource, dndContext, props.onSetAddMoreState, props.updateEventStart, props.updateEventEnd, props.moveEvent, props.movingEvent, props.conflictOccurred, props.subtitleGetter, props.eventItemClick, props.viewEventClick, props.viewEventText, props.viewEvent2Click, props.viewEvent2Text, props.newEvent, props.eventItemTemplateResolver, handleSelectionChange, selectedIdsSet, selectionPreview]);
371
+ }, item.slotId)), [displayRenderData, schedulerData, schedulerDataVersion, eventDndSource, dndContext, props.onSetAddMoreState, props.updateEventStart, props.updateEventEnd, props.moveEvent, props.movingEvent, props.conflictOccurred, props.subtitleGetter, props.eventItemClick, props.viewEventClick, props.viewEventText, props.viewEvent2Click, props.viewEvent2Text, props.newEvent, props.eventItemTemplateResolver, props.eventItemPopoverTemplateResolver, handleSelectionChange, selectedIdsSet, selectionPreview]);
371
372
  let tbodyContent = /*#__PURE__*/_jsx("tr", {});
372
373
  if (showAgenda) {
373
374
  tbodyContent = /*#__PURE__*/_jsx(AgendaView, {
@@ -655,6 +656,7 @@ Scheduler.propTypes = {
655
656
  viewEvent2Text: PropTypes.string,
656
657
  conflictOccurred: PropTypes.func,
657
658
  eventItemTemplateResolver: PropTypes.func,
659
+ eventItemPopoverTemplateResolver: PropTypes.func,
658
660
  dndSources: PropTypes.array,
659
661
  slotClickedFunc: PropTypes.func,
660
662
  toggleExpandFunc: PropTypes.func,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-big-schedule",
3
- "version": "7.0.0",
3
+ "version": "7.1.1-beta.0",
4
4
  "description": "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. 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. Unlock the potential of your React projects with react-big-schedule and revolutionize the way you handle scheduling and resource planning. It is the updated version of react-big-scheduler",
5
5
  "keywords": [
6
6
  "react-big-schedule",