makula-schedule 2.3.2 → 2.3.4

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) {
@@ -74,18 +74,28 @@ var DnDSource = exports["default"] = /*#__PURE__*/_createClass(function DnDSourc
74
74
  }
75
75
  });
76
76
  }
77
- if (hasConflict) {
78
- var conflictOccurred = props.conflictOccurred;
77
+ if (hasConflict && !config.allowConflicts) {
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
+ return;
85
+ }
86
+ if (isEvent) {
85
87
  if (moveEvent !== undefined) {
86
88
  moveEvent(schedulerData, item, slotId, slotName, newStart, newEnd);
87
89
  }
88
90
  } else if (newEvent !== undefined) newEvent(schedulerData, slotId, slotName, newStart, newEnd, type, item);
91
+ if (hasConflict && config.allowConflicts) {
92
+ var _conflictOccurred = props.conflictOccurred || dropResult.conflictOccurred;
93
+ if (_conflictOccurred !== undefined) {
94
+ _conflictOccurred(schedulerData, action, item, type, slotId, slotName, newStart, newEnd);
95
+ } else {
96
+ console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
97
+ }
98
+ }
89
99
  },
90
100
  canDrag: function canDrag(props) {
91
101
  var schedulerData = props.schedulerData,
@@ -282,20 +282,32 @@ 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
- });
285
+ if (!(hasConflict && !config.allowConflicts)) {
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
+ _this.setState({
295
+ left: left,
296
+ top: top,
297
+ width: width
298
+ });
299
+ _this.subscribeResizeEvent(_this.props);
300
+ return _context.a(2);
301
+ case 6:
302
+ if (updateEventStart !== undefined) updateEventStart(schedulerData, eventItem, newStart);
303
+ if (hasConflict && config.allowConflicts) {
291
304
  if (conflictOccurred !== undefined) {
292
305
  conflictOccurred(schedulerData, 'StartResize', eventItem, _default2.DnDTypes.EVENT, slotId, slotName, newStart, eventItem.end);
293
306
  } else {
294
307
  console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
295
308
  }
296
- _this.subscribeResizeEvent(_this.props);
297
- } else if (updateEventStart !== undefined) updateEventStart(schedulerData, eventItem, newStart);
298
- case 6:
309
+ }
310
+ case 7:
299
311
  return _context.a(2);
300
312
  }
301
313
  }, _callee);
@@ -448,22 +460,34 @@ var EventItem = /*#__PURE__*/function (_Component) {
448
460
  }
449
461
  });
450
462
  }
451
- if (hasConflict) {
452
- _this.setState({
453
- left: left,
454
- top: top,
455
- width: width
456
- });
463
+ if (!(hasConflict && !config.allowConflicts)) {
464
+ _context2.n = 6;
465
+ break;
466
+ }
467
+ if (conflictOccurred !== undefined) {
468
+ conflictOccurred(schedulerData, 'EndResize', eventItem, _default2.DnDTypes.EVENT, slotId, slot ? slot.name : null, eventItem.start, newEnd);
469
+ } else {
470
+ console.error('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
471
+ }
472
+ _this.setState({
473
+ left: left,
474
+ top: top,
475
+ width: width
476
+ });
477
+ _this.subscribeResizeEvent(_this.props);
478
+ return _context2.a(2);
479
+ case 6:
480
+ if (updateEventEnd !== undefined) {
481
+ updateEventEnd(schedulerData, eventItem, newEnd);
482
+ }
483
+ if (hasConflict && config.allowConflicts) {
457
484
  if (conflictOccurred !== undefined) {
458
485
  conflictOccurred(schedulerData, 'EndResize', eventItem, _default2.DnDTypes.EVENT, slotId, slot ? slot.name : null, eventItem.start, newEnd);
459
486
  } else {
460
487
  console.error('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
461
488
  }
462
- _this.subscribeResizeEvent(_this.props);
463
- } else if (updateEventEnd !== undefined) {
464
- updateEventEnd(schedulerData, eventItem, newEnd);
465
489
  }
466
- case 6:
490
+ case 7:
467
491
  return _context2.a(2);
468
492
  }
469
493
  }, _callee2);
@@ -193,7 +193,7 @@ var ResourceEvents = /*#__PURE__*/function (_Component) {
193
193
  }
194
194
  });
195
195
  }
196
- if (hasConflict) {
196
+ if (hasConflict && !config.allowConflicts) {
197
197
  var conflictOccurred = _this.props.conflictOccurred;
198
198
  if (conflictOccurred !== undefined) {
199
199
  conflictOccurred(schedulerData, 'New', {
@@ -207,7 +207,24 @@ 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
+ return;
211
+ }
212
+ if (newEvent !== undefined) newEvent(schedulerData, slotId, slotName, startTime, endTime);
213
+ if (hasConflict && config.allowConflicts) {
214
+ var _conflictOccurred = _this.props.conflictOccurred;
215
+ if (_conflictOccurred !== undefined) {
216
+ _conflictOccurred(schedulerData, 'New', {
217
+ id: undefined,
218
+ start: startTime,
219
+ end: endTime,
220
+ slotId: slotId,
221
+ slotName: slotName,
222
+ title: undefined
223
+ }, _default2.DnDTypes.EVENT, slotId, slotName, startTime, endTime);
224
+ } else {
225
+ console.log('Conflict occurred, set conflictOccurred func in Scheduler to handle it');
226
+ }
227
+ }
211
228
  });
212
229
  _defineProperty(_this, "cancelDrag", function (ev) {
213
230
  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.4",
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
+ }