makula-schedule 2.3.2 → 2.3.3

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.
@@ -40,7 +40,8 @@ var DnDContext = exports["default"] = /*#__PURE__*/_createClass(function DnDCont
40
40
  return {
41
41
  drop: function drop(props, monitor, component) {
42
42
  var schedulerData = props.schedulerData,
43
- resourceEvents = props.resourceEvents;
43
+ resourceEvents = props.resourceEvents,
44
+ conflictOccurred = props.conflictOccurred;
44
45
  var cellUnit = schedulerData.cellUnit,
45
46
  localeDayjs = schedulerData.localeDayjs;
46
47
  var type = monitor.getItemType();
@@ -68,7 +69,8 @@ var DnDContext = exports["default"] = /*#__PURE__*/_createClass(function DnDCont
68
69
  start: startTime,
69
70
  end: endTime,
70
71
  initialStart: initialStartTime,
71
- initialEnd: initialEndTime
72
+ initialEnd: initialEndTime,
73
+ conflictOccurred: conflictOccurred
72
74
  };
73
75
  },
74
76
  hover: function hover(props, monitor, component) {
@@ -75,13 +75,15 @@ var DnDSource = exports["default"] = /*#__PURE__*/_createClass(function DnDSourc
75
75
  });
76
76
  }
77
77
  if (hasConflict) {
78
- var conflictOccurred = props.conflictOccurred;
78
+ var conflictOccurred = props.conflictOccurred || dropResult.conflictOccurred;
79
79
  if (conflictOccurred !== undefined) {
80
80
  conflictOccurred(schedulerData, action, item, type, slotId, slotName, newStart, newEnd);
81
81
  } else {
82
82
  console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
83
83
  }
84
- } else if (isEvent) {
84
+ if (!config.allowConflicts) return;
85
+ }
86
+ if (isEvent) {
85
87
  if (moveEvent !== undefined) {
86
88
  moveEvent(schedulerData, item, slotId, slotName, newStart, newEnd);
87
89
  }
@@ -282,20 +282,29 @@ var EventItem = /*#__PURE__*/function (_Component) {
282
282
  }
283
283
  });
284
284
  }
285
- if (hasConflict) {
286
- _this.setState({
287
- left: left,
288
- top: top,
289
- width: width
290
- });
291
- if (conflictOccurred !== undefined) {
292
- conflictOccurred(schedulerData, 'StartResize', eventItem, _default2.DnDTypes.EVENT, slotId, slotName, newStart, eventItem.end);
293
- } else {
294
- console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
295
- }
296
- _this.subscribeResizeEvent(_this.props);
297
- } else if (updateEventStart !== undefined) updateEventStart(schedulerData, eventItem, newStart);
285
+ if (!hasConflict) {
286
+ _context.n = 6;
287
+ break;
288
+ }
289
+ if (conflictOccurred !== undefined) {
290
+ conflictOccurred(schedulerData, 'StartResize', eventItem, _default2.DnDTypes.EVENT, slotId, slotName, newStart, eventItem.end);
291
+ } else {
292
+ console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
293
+ }
294
+ if (config.allowConflicts) {
295
+ _context.n = 6;
296
+ break;
297
+ }
298
+ _this.setState({
299
+ left: left,
300
+ top: top,
301
+ width: width
302
+ });
303
+ _this.subscribeResizeEvent(_this.props);
304
+ return _context.a(2);
298
305
  case 6:
306
+ if (updateEventStart !== undefined) updateEventStart(schedulerData, eventItem, newStart);
307
+ case 7:
299
308
  return _context.a(2);
300
309
  }
301
310
  }, _callee);
@@ -448,22 +457,31 @@ var EventItem = /*#__PURE__*/function (_Component) {
448
457
  }
449
458
  });
450
459
  }
451
- if (hasConflict) {
452
- _this.setState({
453
- left: left,
454
- top: top,
455
- width: width
456
- });
457
- if (conflictOccurred !== undefined) {
458
- conflictOccurred(schedulerData, 'EndResize', eventItem, _default2.DnDTypes.EVENT, slotId, slot ? slot.name : null, eventItem.start, newEnd);
459
- } else {
460
- console.error('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
461
- }
462
- _this.subscribeResizeEvent(_this.props);
463
- } else if (updateEventEnd !== undefined) {
464
- updateEventEnd(schedulerData, eventItem, newEnd);
460
+ if (!hasConflict) {
461
+ _context2.n = 6;
462
+ break;
465
463
  }
464
+ if (conflictOccurred !== undefined) {
465
+ conflictOccurred(schedulerData, 'EndResize', eventItem, _default2.DnDTypes.EVENT, slotId, slot ? slot.name : null, eventItem.start, newEnd);
466
+ } else {
467
+ console.error('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
468
+ }
469
+ if (config.allowConflicts) {
470
+ _context2.n = 6;
471
+ break;
472
+ }
473
+ _this.setState({
474
+ left: left,
475
+ top: top,
476
+ width: width
477
+ });
478
+ _this.subscribeResizeEvent(_this.props);
479
+ return _context2.a(2);
466
480
  case 6:
481
+ if (updateEventEnd !== undefined) {
482
+ updateEventEnd(schedulerData, eventItem, newEnd);
483
+ }
484
+ case 7:
467
485
  return _context2.a(2);
468
486
  }
469
487
  }, _callee2);
@@ -207,7 +207,9 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
207
207
  } else {
208
208
  console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
209
209
  }
210
- } else if (newEvent !== undefined) newEvent(schedulerData, slotId, slotName, startTime, endTime);
210
+ if (!config.allowConflicts) return;
211
+ }
212
+ if (newEvent !== undefined) newEvent(schedulerData, slotId, slotName, startTime, endTime);
211
213
  });
212
214
  _defineProperty(_this, "cancelDrag", function (ev) {
213
215
  ev.stopPropagation();
@@ -67,6 +67,7 @@ var _default = exports["default"] = {
67
67
  creatable: true,
68
68
  crossResourceMove: true,
69
69
  checkConflict: false,
70
+ allowConflicts: false,
70
71
  scrollToSpecialDayjsEnabled: true,
71
72
  eventItemPopoverEnabled: true,
72
73
  eventItemPopoverShowColor: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makula-schedule",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
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",
@@ -109,4 +109,4 @@
109
109
  "webpack-cli": "^6.0.1",
110
110
  "webpack-dev-server": "^5.2.3"
111
111
  }
112
- }
112
+ }