@fullcalendar/interaction 5.10.1 → 6.0.0-beta.1

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/main.js CHANGED
@@ -1,15 +1,15 @@
1
1
  /*!
2
- FullCalendar v5.10.1
2
+ FullCalendar v6.0.0-beta.1
3
3
  Docs & License: https://fullcalendar.io/
4
- (c) 2021 Adam Shaw
4
+ (c) 2022 Adam Shaw
5
5
  */
6
- import { config, elementClosest, Emitter, applyStyle, whenTransitionDone, removeElement, ScrollController, ElementScrollController, computeInnerRect, WindowScrollController, getElRoot, preventSelection, preventContextMenu, allowSelection, allowContextMenu, ElementDragging, computeRect, getClippingParents, pointInsideRect, isDateSpansEqual, constrainPoint, intersectRects, getRectCenter, diffPoints, mapHash, rangeContainsRange, interactionSettingsToStore, Interaction, isDateSelectionValid, enableCursor, disableCursor, triggerDateSelect, compareNumbers, getElSeg, getRelevantEvents, EventApi, createEmptyEventStore, applyMutationToEventStore, isInteractionValid, buildEventApis, interactionSettingsStore, startOfDay, diffDates, createDuration, getEventTargetViaRoot, identity, eventTupleToStore, parseDragMeta, elementMatches, refineEventDef, parseEventDef, getDefaultEventEnd, createEventInstance, BASE_OPTION_DEFAULTS, createPlugin } from '@fullcalendar/common';
7
- import { __extends, __assign } from 'tslib';
6
+ import { config, Emitter, elementClosest, applyStyle, whenTransitionDone, removeElement, ScrollController, ElementScrollController, computeInnerRect, WindowScrollController, getElRoot, ElementDragging, preventSelection, preventContextMenu, allowSelection, allowContextMenu, computeRect, getClippingParents, pointInsideRect, constrainPoint, intersectRects, getRectCenter, diffPoints, mapHash, rangeContainsRange, isDateSpansEqual, Interaction, interactionSettingsToStore, isDateSelectionValid, enableCursor, disableCursor, triggerDateSelect, compareNumbers, getElSeg, getRelevantEvents, EventApi, createEmptyEventStore, applyMutationToEventStore, isInteractionValid, buildEventApis, interactionSettingsStore, startOfDay, diffDates, createDuration, getEventTargetViaRoot, identity, eventTupleToStore, parseDragMeta, elementMatches, refineEventDef, parseEventDef, getDefaultEventEnd, createEventInstance, BASE_OPTION_DEFAULTS, createPlugin } from '@fullcalendar/common';
7
+ import { __assign } from 'tslib';
8
8
 
9
9
  config.touchMouseIgnoreWait = 500;
10
- var ignoreMouseDepth = 0;
11
- var listenerCnt = 0;
12
- var isWindowTouchMoveCancelled = false;
10
+ let ignoreMouseDepth = 0;
11
+ let listenerCnt = 0;
12
+ let isWindowTouchMoveCancelled = false;
13
13
  /*
14
14
  Uses a "pointer" abstraction, which monitors UI events for both mouse and touch.
15
15
  Tracks when the pointer "drags" on a certain element, meaning down+move+up.
@@ -23,9 +23,8 @@ emits:
23
23
  - pointermove
24
24
  - pointerup
25
25
  */
26
- var PointerDragging = /** @class */ (function () {
27
- function PointerDragging(containerEl) {
28
- var _this = this;
26
+ class PointerDragging {
27
+ constructor(containerEl) {
29
28
  this.subjectEl = null;
30
29
  // options that can be directly assigned by caller
31
30
  this.selector = ''; // will cause subjectEl in all emitted events to be this element
@@ -38,85 +37,85 @@ var PointerDragging = /** @class */ (function () {
38
37
  this.wasTouchScroll = false;
39
38
  // Mouse
40
39
  // ----------------------------------------------------------------------------------------------------
41
- this.handleMouseDown = function (ev) {
42
- if (!_this.shouldIgnoreMouse() &&
40
+ this.handleMouseDown = (ev) => {
41
+ if (!this.shouldIgnoreMouse() &&
43
42
  isPrimaryMouseButton(ev) &&
44
- _this.tryStart(ev)) {
45
- var pev = _this.createEventFromMouse(ev, true);
46
- _this.emitter.trigger('pointerdown', pev);
47
- _this.initScrollWatch(pev);
48
- if (!_this.shouldIgnoreMove) {
49
- document.addEventListener('mousemove', _this.handleMouseMove);
43
+ this.tryStart(ev)) {
44
+ let pev = this.createEventFromMouse(ev, true);
45
+ this.emitter.trigger('pointerdown', pev);
46
+ this.initScrollWatch(pev);
47
+ if (!this.shouldIgnoreMove) {
48
+ document.addEventListener('mousemove', this.handleMouseMove);
50
49
  }
51
- document.addEventListener('mouseup', _this.handleMouseUp);
50
+ document.addEventListener('mouseup', this.handleMouseUp);
52
51
  }
53
52
  };
54
- this.handleMouseMove = function (ev) {
55
- var pev = _this.createEventFromMouse(ev);
56
- _this.recordCoords(pev);
57
- _this.emitter.trigger('pointermove', pev);
53
+ this.handleMouseMove = (ev) => {
54
+ let pev = this.createEventFromMouse(ev);
55
+ this.recordCoords(pev);
56
+ this.emitter.trigger('pointermove', pev);
58
57
  };
59
- this.handleMouseUp = function (ev) {
60
- document.removeEventListener('mousemove', _this.handleMouseMove);
61
- document.removeEventListener('mouseup', _this.handleMouseUp);
62
- _this.emitter.trigger('pointerup', _this.createEventFromMouse(ev));
63
- _this.cleanup(); // call last so that pointerup has access to props
58
+ this.handleMouseUp = (ev) => {
59
+ document.removeEventListener('mousemove', this.handleMouseMove);
60
+ document.removeEventListener('mouseup', this.handleMouseUp);
61
+ this.emitter.trigger('pointerup', this.createEventFromMouse(ev));
62
+ this.cleanup(); // call last so that pointerup has access to props
64
63
  };
65
64
  // Touch
66
65
  // ----------------------------------------------------------------------------------------------------
67
- this.handleTouchStart = function (ev) {
68
- if (_this.tryStart(ev)) {
69
- _this.isTouchDragging = true;
70
- var pev = _this.createEventFromTouch(ev, true);
71
- _this.emitter.trigger('pointerdown', pev);
72
- _this.initScrollWatch(pev);
66
+ this.handleTouchStart = (ev) => {
67
+ if (this.tryStart(ev)) {
68
+ this.isTouchDragging = true;
69
+ let pev = this.createEventFromTouch(ev, true);
70
+ this.emitter.trigger('pointerdown', pev);
71
+ this.initScrollWatch(pev);
73
72
  // unlike mouse, need to attach to target, not document
74
73
  // https://stackoverflow.com/a/45760014
75
- var targetEl = ev.target;
76
- if (!_this.shouldIgnoreMove) {
77
- targetEl.addEventListener('touchmove', _this.handleTouchMove);
74
+ let targetEl = ev.target;
75
+ if (!this.shouldIgnoreMove) {
76
+ targetEl.addEventListener('touchmove', this.handleTouchMove);
78
77
  }
79
- targetEl.addEventListener('touchend', _this.handleTouchEnd);
80
- targetEl.addEventListener('touchcancel', _this.handleTouchEnd); // treat it as a touch end
78
+ targetEl.addEventListener('touchend', this.handleTouchEnd);
79
+ targetEl.addEventListener('touchcancel', this.handleTouchEnd); // treat it as a touch end
81
80
  // attach a handler to get called when ANY scroll action happens on the page.
82
81
  // this was impossible to do with normal on/off because 'scroll' doesn't bubble.
83
82
  // http://stackoverflow.com/a/32954565/96342
84
- window.addEventListener('scroll', _this.handleTouchScroll, true);
83
+ window.addEventListener('scroll', this.handleTouchScroll, true);
85
84
  }
86
85
  };
87
- this.handleTouchMove = function (ev) {
88
- var pev = _this.createEventFromTouch(ev);
89
- _this.recordCoords(pev);
90
- _this.emitter.trigger('pointermove', pev);
86
+ this.handleTouchMove = (ev) => {
87
+ let pev = this.createEventFromTouch(ev);
88
+ this.recordCoords(pev);
89
+ this.emitter.trigger('pointermove', pev);
91
90
  };
92
- this.handleTouchEnd = function (ev) {
93
- if (_this.isDragging) { // done to guard against touchend followed by touchcancel
94
- var targetEl = ev.target;
95
- targetEl.removeEventListener('touchmove', _this.handleTouchMove);
96
- targetEl.removeEventListener('touchend', _this.handleTouchEnd);
97
- targetEl.removeEventListener('touchcancel', _this.handleTouchEnd);
98
- window.removeEventListener('scroll', _this.handleTouchScroll, true); // useCaptured=true
99
- _this.emitter.trigger('pointerup', _this.createEventFromTouch(ev));
100
- _this.cleanup(); // call last so that pointerup has access to props
101
- _this.isTouchDragging = false;
91
+ this.handleTouchEnd = (ev) => {
92
+ if (this.isDragging) { // done to guard against touchend followed by touchcancel
93
+ let targetEl = ev.target;
94
+ targetEl.removeEventListener('touchmove', this.handleTouchMove);
95
+ targetEl.removeEventListener('touchend', this.handleTouchEnd);
96
+ targetEl.removeEventListener('touchcancel', this.handleTouchEnd);
97
+ window.removeEventListener('scroll', this.handleTouchScroll, true); // useCaptured=true
98
+ this.emitter.trigger('pointerup', this.createEventFromTouch(ev));
99
+ this.cleanup(); // call last so that pointerup has access to props
100
+ this.isTouchDragging = false;
102
101
  startIgnoringMouse();
103
102
  }
104
103
  };
105
- this.handleTouchScroll = function () {
106
- _this.wasTouchScroll = true;
104
+ this.handleTouchScroll = () => {
105
+ this.wasTouchScroll = true;
107
106
  };
108
- this.handleScroll = function (ev) {
109
- if (!_this.shouldIgnoreMove) {
110
- var pageX = (window.pageXOffset - _this.prevScrollX) + _this.prevPageX;
111
- var pageY = (window.pageYOffset - _this.prevScrollY) + _this.prevPageY;
112
- _this.emitter.trigger('pointermove', {
107
+ this.handleScroll = (ev) => {
108
+ if (!this.shouldIgnoreMove) {
109
+ let pageX = (window.pageXOffset - this.prevScrollX) + this.prevPageX;
110
+ let pageY = (window.pageYOffset - this.prevScrollY) + this.prevPageY;
111
+ this.emitter.trigger('pointermove', {
113
112
  origEvent: ev,
114
- isTouch: _this.isTouchDragging,
115
- subjectEl: _this.subjectEl,
116
- pageX: pageX,
117
- pageY: pageY,
118
- deltaX: pageX - _this.origPageX,
119
- deltaY: pageY - _this.origPageY,
113
+ isTouch: this.isTouchDragging,
114
+ subjectEl: this.subjectEl,
115
+ pageX,
116
+ pageY,
117
+ deltaX: pageX - this.origPageX,
118
+ deltaY: pageY - this.origPageY,
120
119
  });
121
120
  }
122
121
  };
@@ -126,14 +125,14 @@ var PointerDragging = /** @class */ (function () {
126
125
  containerEl.addEventListener('touchstart', this.handleTouchStart, { passive: true });
127
126
  listenerCreated();
128
127
  }
129
- PointerDragging.prototype.destroy = function () {
128
+ destroy() {
130
129
  this.containerEl.removeEventListener('mousedown', this.handleMouseDown);
131
130
  this.containerEl.removeEventListener('touchstart', this.handleTouchStart, { passive: true });
132
131
  listenerDestroyed();
133
- };
134
- PointerDragging.prototype.tryStart = function (ev) {
135
- var subjectEl = this.querySubjectEl(ev);
136
- var downEl = ev.target;
132
+ }
133
+ tryStart(ev) {
134
+ let subjectEl = this.querySubjectEl(ev);
135
+ let downEl = ev.target;
137
136
  if (subjectEl &&
138
137
  (!this.handleSelector || elementClosest(downEl, this.handleSelector))) {
139
138
  this.subjectEl = subjectEl;
@@ -142,55 +141,55 @@ var PointerDragging = /** @class */ (function () {
142
141
  return true;
143
142
  }
144
143
  return false;
145
- };
146
- PointerDragging.prototype.cleanup = function () {
144
+ }
145
+ cleanup() {
147
146
  isWindowTouchMoveCancelled = false;
148
147
  this.isDragging = false;
149
148
  this.subjectEl = null;
150
149
  // keep wasTouchScroll around for later access
151
150
  this.destroyScrollWatch();
152
- };
153
- PointerDragging.prototype.querySubjectEl = function (ev) {
151
+ }
152
+ querySubjectEl(ev) {
154
153
  if (this.selector) {
155
154
  return elementClosest(ev.target, this.selector);
156
155
  }
157
156
  return this.containerEl;
158
- };
159
- PointerDragging.prototype.shouldIgnoreMouse = function () {
157
+ }
158
+ shouldIgnoreMouse() {
160
159
  return ignoreMouseDepth || this.isTouchDragging;
161
- };
160
+ }
162
161
  // can be called by user of this class, to cancel touch-based scrolling for the current drag
163
- PointerDragging.prototype.cancelTouchScroll = function () {
162
+ cancelTouchScroll() {
164
163
  if (this.isDragging) {
165
164
  isWindowTouchMoveCancelled = true;
166
165
  }
167
- };
166
+ }
168
167
  // Scrolling that simulates pointermoves
169
168
  // ----------------------------------------------------------------------------------------------------
170
- PointerDragging.prototype.initScrollWatch = function (ev) {
169
+ initScrollWatch(ev) {
171
170
  if (this.shouldWatchScroll) {
172
171
  this.recordCoords(ev);
173
172
  window.addEventListener('scroll', this.handleScroll, true); // useCapture=true
174
173
  }
175
- };
176
- PointerDragging.prototype.recordCoords = function (ev) {
174
+ }
175
+ recordCoords(ev) {
177
176
  if (this.shouldWatchScroll) {
178
177
  this.prevPageX = ev.pageX;
179
178
  this.prevPageY = ev.pageY;
180
179
  this.prevScrollX = window.pageXOffset;
181
180
  this.prevScrollY = window.pageYOffset;
182
181
  }
183
- };
184
- PointerDragging.prototype.destroyScrollWatch = function () {
182
+ }
183
+ destroyScrollWatch() {
185
184
  if (this.shouldWatchScroll) {
186
185
  window.removeEventListener('scroll', this.handleScroll, true); // useCaptured=true
187
186
  }
188
- };
187
+ }
189
188
  // Event Normalization
190
189
  // ----------------------------------------------------------------------------------------------------
191
- PointerDragging.prototype.createEventFromMouse = function (ev, isFirst) {
192
- var deltaX = 0;
193
- var deltaY = 0;
190
+ createEventFromMouse(ev, isFirst) {
191
+ let deltaX = 0;
192
+ let deltaY = 0;
194
193
  // TODO: repeat code
195
194
  if (isFirst) {
196
195
  this.origPageX = ev.pageX;
@@ -206,16 +205,16 @@ var PointerDragging = /** @class */ (function () {
206
205
  subjectEl: this.subjectEl,
207
206
  pageX: ev.pageX,
208
207
  pageY: ev.pageY,
209
- deltaX: deltaX,
210
- deltaY: deltaY,
208
+ deltaX,
209
+ deltaY,
211
210
  };
212
- };
213
- PointerDragging.prototype.createEventFromTouch = function (ev, isFirst) {
214
- var touches = ev.touches;
215
- var pageX;
216
- var pageY;
217
- var deltaX = 0;
218
- var deltaY = 0;
211
+ }
212
+ createEventFromTouch(ev, isFirst) {
213
+ let touches = ev.touches;
214
+ let pageX;
215
+ let pageY;
216
+ let deltaX = 0;
217
+ let deltaY = 0;
219
218
  // if touch coords available, prefer,
220
219
  // because FF would give bad ev.pageX ev.pageY
221
220
  if (touches && touches.length) {
@@ -239,14 +238,13 @@ var PointerDragging = /** @class */ (function () {
239
238
  origEvent: ev,
240
239
  isTouch: true,
241
240
  subjectEl: this.subjectEl,
242
- pageX: pageX,
243
- pageY: pageY,
244
- deltaX: deltaX,
245
- deltaY: deltaY,
241
+ pageX,
242
+ pageY,
243
+ deltaX,
244
+ deltaY,
246
245
  };
247
- };
248
- return PointerDragging;
249
- }());
246
+ }
247
+ }
250
248
  // Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac)
251
249
  function isPrimaryMouseButton(ev) {
252
250
  return ev.button === 0 && !ev.ctrlKey;
@@ -255,7 +253,7 @@ function isPrimaryMouseButton(ev) {
255
253
  // ----------------------------------------------------------------------------------------------------
256
254
  function startIgnoringMouse() {
257
255
  ignoreMouseDepth += 1;
258
- setTimeout(function () {
256
+ setTimeout(() => {
259
257
  ignoreMouseDepth -= 1;
260
258
  }, config.touchMouseIgnoreWait);
261
259
  }
@@ -284,8 +282,8 @@ An effect in which an element follows the movement of a pointer across the scree
284
282
  The moving element is a clone of some other element.
285
283
  Must call start + handleMove + stop.
286
284
  */
287
- var ElementMirror = /** @class */ (function () {
288
- function ElementMirror() {
285
+ class ElementMirror {
286
+ constructor() {
289
287
  this.isVisible = false; // must be explicitly enabled
290
288
  this.sourceEl = null;
291
289
  this.mirrorEl = null;
@@ -295,7 +293,7 @@ var ElementMirror = /** @class */ (function () {
295
293
  this.zIndex = 9999;
296
294
  this.revertDuration = 0;
297
295
  }
298
- ElementMirror.prototype.start = function (sourceEl, pageX, pageY) {
296
+ start(sourceEl, pageX, pageY) {
299
297
  this.sourceEl = sourceEl;
300
298
  this.sourceElRect = this.sourceEl.getBoundingClientRect();
301
299
  this.origScreenX = pageX - window.pageXOffset;
@@ -303,14 +301,14 @@ var ElementMirror = /** @class */ (function () {
303
301
  this.deltaX = 0;
304
302
  this.deltaY = 0;
305
303
  this.updateElPosition();
306
- };
307
- ElementMirror.prototype.handleMove = function (pageX, pageY) {
304
+ }
305
+ handleMove(pageX, pageY) {
308
306
  this.deltaX = (pageX - window.pageXOffset) - this.origScreenX;
309
307
  this.deltaY = (pageY - window.pageYOffset) - this.origScreenY;
310
308
  this.updateElPosition();
311
- };
309
+ }
312
310
  // can be called before start
313
- ElementMirror.prototype.setIsVisible = function (bool) {
311
+ setIsVisible(bool) {
314
312
  if (bool) {
315
313
  if (!this.isVisible) {
316
314
  if (this.mirrorEl) {
@@ -326,12 +324,11 @@ var ElementMirror = /** @class */ (function () {
326
324
  }
327
325
  this.isVisible = bool;
328
326
  }
329
- };
327
+ }
330
328
  // always async
331
- ElementMirror.prototype.stop = function (needsRevertAnimation, callback) {
332
- var _this = this;
333
- var done = function () {
334
- _this.cleanup();
329
+ stop(needsRevertAnimation, callback) {
330
+ let done = () => {
331
+ this.cleanup();
335
332
  callback();
336
333
  };
337
334
  if (needsRevertAnimation &&
@@ -345,10 +342,10 @@ var ElementMirror = /** @class */ (function () {
345
342
  else {
346
343
  setTimeout(done, 0);
347
344
  }
348
- };
349
- ElementMirror.prototype.doRevertAnimation = function (callback, revertDuration) {
350
- var mirrorEl = this.mirrorEl;
351
- var finalSourceElRect = this.sourceEl.getBoundingClientRect(); // because autoscrolling might have happened
345
+ }
346
+ doRevertAnimation(callback, revertDuration) {
347
+ let mirrorEl = this.mirrorEl;
348
+ let finalSourceElRect = this.sourceEl.getBoundingClientRect(); // because autoscrolling might have happened
352
349
  mirrorEl.style.transition =
353
350
  'top ' + revertDuration + 'ms,' +
354
351
  'left ' + revertDuration + 'ms';
@@ -356,29 +353,29 @@ var ElementMirror = /** @class */ (function () {
356
353
  left: finalSourceElRect.left,
357
354
  top: finalSourceElRect.top,
358
355
  });
359
- whenTransitionDone(mirrorEl, function () {
356
+ whenTransitionDone(mirrorEl, () => {
360
357
  mirrorEl.style.transition = '';
361
358
  callback();
362
359
  });
363
- };
364
- ElementMirror.prototype.cleanup = function () {
360
+ }
361
+ cleanup() {
365
362
  if (this.mirrorEl) {
366
363
  removeElement(this.mirrorEl);
367
364
  this.mirrorEl = null;
368
365
  }
369
366
  this.sourceEl = null;
370
- };
371
- ElementMirror.prototype.updateElPosition = function () {
367
+ }
368
+ updateElPosition() {
372
369
  if (this.sourceEl && this.isVisible) {
373
370
  applyStyle(this.getMirrorEl(), {
374
371
  left: this.sourceElRect.left + this.deltaX,
375
372
  top: this.sourceElRect.top + this.deltaY,
376
373
  });
377
374
  }
378
- };
379
- ElementMirror.prototype.getMirrorEl = function () {
380
- var sourceElRect = this.sourceElRect;
381
- var mirrorEl = this.mirrorEl;
375
+ }
376
+ getMirrorEl() {
377
+ let sourceElRect = this.sourceElRect;
378
+ let mirrorEl = this.mirrorEl;
382
379
  if (!mirrorEl) {
383
380
  mirrorEl = this.mirrorEl = this.sourceEl.cloneNode(true); // cloneChildren=true
384
381
  // we don't want long taps or any mouse interaction causing selection/menus.
@@ -399,9 +396,8 @@ var ElementMirror = /** @class */ (function () {
399
396
  this.parentNode.appendChild(mirrorEl);
400
397
  }
401
398
  return mirrorEl;
402
- };
403
- return ElementMirror;
404
- }());
399
+ }
400
+ }
405
401
 
406
402
  /*
407
403
  Is a cache for a given element's scroll information (all the info that ScrollController stores)
@@ -411,41 +407,39 @@ The cache can be in one of two modes:
411
407
  - doesListening:false - ignores when the container is scrolled by someone else
412
408
  - doesListening:true - watch for scrolling and update the cache
413
409
  */
414
- var ScrollGeomCache = /** @class */ (function (_super) {
415
- __extends(ScrollGeomCache, _super);
416
- function ScrollGeomCache(scrollController, doesListening) {
417
- var _this = _super.call(this) || this;
418
- _this.handleScroll = function () {
419
- _this.scrollTop = _this.scrollController.getScrollTop();
420
- _this.scrollLeft = _this.scrollController.getScrollLeft();
421
- _this.handleScrollChange();
410
+ class ScrollGeomCache extends ScrollController {
411
+ constructor(scrollController, doesListening) {
412
+ super();
413
+ this.handleScroll = () => {
414
+ this.scrollTop = this.scrollController.getScrollTop();
415
+ this.scrollLeft = this.scrollController.getScrollLeft();
416
+ this.handleScrollChange();
422
417
  };
423
- _this.scrollController = scrollController;
424
- _this.doesListening = doesListening;
425
- _this.scrollTop = _this.origScrollTop = scrollController.getScrollTop();
426
- _this.scrollLeft = _this.origScrollLeft = scrollController.getScrollLeft();
427
- _this.scrollWidth = scrollController.getScrollWidth();
428
- _this.scrollHeight = scrollController.getScrollHeight();
429
- _this.clientWidth = scrollController.getClientWidth();
430
- _this.clientHeight = scrollController.getClientHeight();
431
- _this.clientRect = _this.computeClientRect(); // do last in case it needs cached values
432
- if (_this.doesListening) {
433
- _this.getEventTarget().addEventListener('scroll', _this.handleScroll);
434
- }
435
- return _this;
436
- }
437
- ScrollGeomCache.prototype.destroy = function () {
418
+ this.scrollController = scrollController;
419
+ this.doesListening = doesListening;
420
+ this.scrollTop = this.origScrollTop = scrollController.getScrollTop();
421
+ this.scrollLeft = this.origScrollLeft = scrollController.getScrollLeft();
422
+ this.scrollWidth = scrollController.getScrollWidth();
423
+ this.scrollHeight = scrollController.getScrollHeight();
424
+ this.clientWidth = scrollController.getClientWidth();
425
+ this.clientHeight = scrollController.getClientHeight();
426
+ this.clientRect = this.computeClientRect(); // do last in case it needs cached values
427
+ if (this.doesListening) {
428
+ this.getEventTarget().addEventListener('scroll', this.handleScroll);
429
+ }
430
+ }
431
+ destroy() {
438
432
  if (this.doesListening) {
439
433
  this.getEventTarget().removeEventListener('scroll', this.handleScroll);
440
434
  }
441
- };
442
- ScrollGeomCache.prototype.getScrollTop = function () {
435
+ }
436
+ getScrollTop() {
443
437
  return this.scrollTop;
444
- };
445
- ScrollGeomCache.prototype.getScrollLeft = function () {
438
+ }
439
+ getScrollLeft() {
446
440
  return this.scrollLeft;
447
- };
448
- ScrollGeomCache.prototype.setScrollTop = function (top) {
441
+ }
442
+ setScrollTop(top) {
449
443
  this.scrollController.setScrollTop(top);
450
444
  if (!this.doesListening) {
451
445
  // we are not relying on the element to normalize out-of-bounds scroll values
@@ -453,8 +447,8 @@ var ScrollGeomCache = /** @class */ (function (_super) {
453
447
  this.scrollTop = Math.max(Math.min(top, this.getMaxScrollTop()), 0);
454
448
  this.handleScrollChange();
455
449
  }
456
- };
457
- ScrollGeomCache.prototype.setScrollLeft = function (top) {
450
+ }
451
+ setScrollLeft(top) {
458
452
  this.scrollController.setScrollLeft(top);
459
453
  if (!this.doesListening) {
460
454
  // we are not relying on the element to normalize out-of-bounds scroll values
@@ -462,75 +456,69 @@ var ScrollGeomCache = /** @class */ (function (_super) {
462
456
  this.scrollLeft = Math.max(Math.min(top, this.getMaxScrollLeft()), 0);
463
457
  this.handleScrollChange();
464
458
  }
465
- };
466
- ScrollGeomCache.prototype.getClientWidth = function () {
459
+ }
460
+ getClientWidth() {
467
461
  return this.clientWidth;
468
- };
469
- ScrollGeomCache.prototype.getClientHeight = function () {
462
+ }
463
+ getClientHeight() {
470
464
  return this.clientHeight;
471
- };
472
- ScrollGeomCache.prototype.getScrollWidth = function () {
465
+ }
466
+ getScrollWidth() {
473
467
  return this.scrollWidth;
474
- };
475
- ScrollGeomCache.prototype.getScrollHeight = function () {
468
+ }
469
+ getScrollHeight() {
476
470
  return this.scrollHeight;
477
- };
478
- ScrollGeomCache.prototype.handleScrollChange = function () {
479
- };
480
- return ScrollGeomCache;
481
- }(ScrollController));
471
+ }
472
+ handleScrollChange() {
473
+ }
474
+ }
482
475
 
483
- var ElementScrollGeomCache = /** @class */ (function (_super) {
484
- __extends(ElementScrollGeomCache, _super);
485
- function ElementScrollGeomCache(el, doesListening) {
486
- return _super.call(this, new ElementScrollController(el), doesListening) || this;
476
+ class ElementScrollGeomCache extends ScrollGeomCache {
477
+ constructor(el, doesListening) {
478
+ super(new ElementScrollController(el), doesListening);
487
479
  }
488
- ElementScrollGeomCache.prototype.getEventTarget = function () {
480
+ getEventTarget() {
489
481
  return this.scrollController.el;
490
- };
491
- ElementScrollGeomCache.prototype.computeClientRect = function () {
482
+ }
483
+ computeClientRect() {
492
484
  return computeInnerRect(this.scrollController.el);
493
- };
494
- return ElementScrollGeomCache;
495
- }(ScrollGeomCache));
485
+ }
486
+ }
496
487
 
497
- var WindowScrollGeomCache = /** @class */ (function (_super) {
498
- __extends(WindowScrollGeomCache, _super);
499
- function WindowScrollGeomCache(doesListening) {
500
- return _super.call(this, new WindowScrollController(), doesListening) || this;
488
+ class WindowScrollGeomCache extends ScrollGeomCache {
489
+ constructor(doesListening) {
490
+ super(new WindowScrollController(), doesListening);
501
491
  }
502
- WindowScrollGeomCache.prototype.getEventTarget = function () {
492
+ getEventTarget() {
503
493
  return window;
504
- };
505
- WindowScrollGeomCache.prototype.computeClientRect = function () {
494
+ }
495
+ computeClientRect() {
506
496
  return {
507
497
  left: this.scrollLeft,
508
498
  right: this.scrollLeft + this.clientWidth,
509
499
  top: this.scrollTop,
510
500
  bottom: this.scrollTop + this.clientHeight,
511
501
  };
512
- };
502
+ }
513
503
  // the window is the only scroll object that changes it's rectangle relative
514
504
  // to the document's topleft as it scrolls
515
- WindowScrollGeomCache.prototype.handleScrollChange = function () {
505
+ handleScrollChange() {
516
506
  this.clientRect = this.computeClientRect();
517
- };
518
- return WindowScrollGeomCache;
519
- }(ScrollGeomCache));
507
+ }
508
+ }
520
509
 
521
510
  // If available we are using native "performance" API instead of "Date"
522
511
  // Read more about it on MDN:
523
512
  // https://developer.mozilla.org/en-US/docs/Web/API/Performance
524
- var getTime = typeof performance === 'function' ? performance.now : Date.now;
513
+ const getTime = typeof performance === 'function' ? performance.now : Date.now;
525
514
  /*
526
515
  For a pointer interaction, automatically scrolls certain scroll containers when the pointer
527
516
  approaches the edge.
528
517
 
529
518
  The caller must call start + handleMove + stop.
530
519
  */
531
- var AutoScroller = /** @class */ (function () {
532
- function AutoScroller() {
533
- var _this = this;
520
+ class AutoScroller {
521
+ constructor() {
534
522
  // options that can be set by caller
535
523
  this.isEnabled = true;
536
524
  this.scrollQuery = [window, '.fc-scroller'];
@@ -546,21 +534,21 @@ var AutoScroller = /** @class */ (function () {
546
534
  this.everMovedDown = false;
547
535
  this.everMovedLeft = false;
548
536
  this.everMovedRight = false;
549
- this.animate = function () {
550
- if (_this.isAnimating) { // wasn't cancelled between animation calls
551
- var edge = _this.computeBestEdge(_this.pointerScreenX + window.pageXOffset, _this.pointerScreenY + window.pageYOffset);
537
+ this.animate = () => {
538
+ if (this.isAnimating) { // wasn't cancelled between animation calls
539
+ let edge = this.computeBestEdge(this.pointerScreenX + window.pageXOffset, this.pointerScreenY + window.pageYOffset);
552
540
  if (edge) {
553
- var now = getTime();
554
- _this.handleSide(edge, (now - _this.msSinceRequest) / 1000);
555
- _this.requestAnimation(now);
541
+ let now = getTime();
542
+ this.handleSide(edge, (now - this.msSinceRequest) / 1000);
543
+ this.requestAnimation(now);
556
544
  }
557
545
  else {
558
- _this.isAnimating = false; // will stop animation
546
+ this.isAnimating = false; // will stop animation
559
547
  }
560
548
  }
561
549
  };
562
550
  }
563
- AutoScroller.prototype.start = function (pageX, pageY, scrollStartEl) {
551
+ start(pageX, pageY, scrollStartEl) {
564
552
  if (this.isEnabled) {
565
553
  this.scrollCaches = this.buildCaches(scrollStartEl);
566
554
  this.pointerScreenX = null;
@@ -571,13 +559,13 @@ var AutoScroller = /** @class */ (function () {
571
559
  this.everMovedRight = false;
572
560
  this.handleMove(pageX, pageY);
573
561
  }
574
- };
575
- AutoScroller.prototype.handleMove = function (pageX, pageY) {
562
+ }
563
+ handleMove(pageX, pageY) {
576
564
  if (this.isEnabled) {
577
- var pointerScreenX = pageX - window.pageXOffset;
578
- var pointerScreenY = pageY - window.pageYOffset;
579
- var yDelta = this.pointerScreenY === null ? 0 : pointerScreenY - this.pointerScreenY;
580
- var xDelta = this.pointerScreenX === null ? 0 : pointerScreenX - this.pointerScreenX;
565
+ let pointerScreenX = pageX - window.pageXOffset;
566
+ let pointerScreenY = pageY - window.pageYOffset;
567
+ let yDelta = this.pointerScreenY === null ? 0 : pointerScreenY - this.pointerScreenY;
568
+ let xDelta = this.pointerScreenX === null ? 0 : pointerScreenX - this.pointerScreenX;
581
569
  if (yDelta < 0) {
582
570
  this.everMovedUp = true;
583
571
  }
@@ -597,29 +585,28 @@ var AutoScroller = /** @class */ (function () {
597
585
  this.requestAnimation(getTime());
598
586
  }
599
587
  }
600
- };
601
- AutoScroller.prototype.stop = function () {
588
+ }
589
+ stop() {
602
590
  if (this.isEnabled) {
603
591
  this.isAnimating = false; // will stop animation
604
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
605
- var scrollCache = _a[_i];
592
+ for (let scrollCache of this.scrollCaches) {
606
593
  scrollCache.destroy();
607
594
  }
608
595
  this.scrollCaches = null;
609
596
  }
610
- };
611
- AutoScroller.prototype.requestAnimation = function (now) {
597
+ }
598
+ requestAnimation(now) {
612
599
  this.msSinceRequest = now;
613
600
  requestAnimationFrame(this.animate);
614
- };
615
- AutoScroller.prototype.handleSide = function (edge, seconds) {
616
- var scrollCache = edge.scrollCache;
617
- var edgeThreshold = this.edgeThreshold;
618
- var invDistance = edgeThreshold - edge.distance;
619
- var velocity = // the closer to the edge, the faster we scroll
601
+ }
602
+ handleSide(edge, seconds) {
603
+ let { scrollCache } = edge;
604
+ let { edgeThreshold } = this;
605
+ let invDistance = edgeThreshold - edge.distance;
606
+ let velocity = // the closer to the edge, the faster we scroll
620
607
  ((invDistance * invDistance) / (edgeThreshold * edgeThreshold)) * // quadratic
621
608
  this.maxVelocity * seconds;
622
- var sign = 1;
609
+ let sign = 1;
623
610
  switch (edge.name) {
624
611
  case 'left':
625
612
  sign = -1;
@@ -634,63 +621,61 @@ var AutoScroller = /** @class */ (function () {
634
621
  scrollCache.setScrollTop(scrollCache.getScrollTop() + velocity * sign);
635
622
  break;
636
623
  }
637
- };
624
+ }
638
625
  // left/top are relative to document topleft
639
- AutoScroller.prototype.computeBestEdge = function (left, top) {
640
- var edgeThreshold = this.edgeThreshold;
641
- var bestSide = null;
642
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
643
- var scrollCache = _a[_i];
644
- var rect = scrollCache.clientRect;
645
- var leftDist = left - rect.left;
646
- var rightDist = rect.right - left;
647
- var topDist = top - rect.top;
648
- var bottomDist = rect.bottom - top;
626
+ computeBestEdge(left, top) {
627
+ let { edgeThreshold } = this;
628
+ let bestSide = null;
629
+ let scrollCaches = this.scrollCaches || [];
630
+ for (let scrollCache of scrollCaches) {
631
+ let rect = scrollCache.clientRect;
632
+ let leftDist = left - rect.left;
633
+ let rightDist = rect.right - left;
634
+ let topDist = top - rect.top;
635
+ let bottomDist = rect.bottom - top;
649
636
  // completely within the rect?
650
637
  if (leftDist >= 0 && rightDist >= 0 && topDist >= 0 && bottomDist >= 0) {
651
638
  if (topDist <= edgeThreshold && this.everMovedUp && scrollCache.canScrollUp() &&
652
639
  (!bestSide || bestSide.distance > topDist)) {
653
- bestSide = { scrollCache: scrollCache, name: 'top', distance: topDist };
640
+ bestSide = { scrollCache, name: 'top', distance: topDist };
654
641
  }
655
642
  if (bottomDist <= edgeThreshold && this.everMovedDown && scrollCache.canScrollDown() &&
656
643
  (!bestSide || bestSide.distance > bottomDist)) {
657
- bestSide = { scrollCache: scrollCache, name: 'bottom', distance: bottomDist };
644
+ bestSide = { scrollCache, name: 'bottom', distance: bottomDist };
658
645
  }
659
646
  if (leftDist <= edgeThreshold && this.everMovedLeft && scrollCache.canScrollLeft() &&
660
647
  (!bestSide || bestSide.distance > leftDist)) {
661
- bestSide = { scrollCache: scrollCache, name: 'left', distance: leftDist };
648
+ bestSide = { scrollCache, name: 'left', distance: leftDist };
662
649
  }
663
650
  if (rightDist <= edgeThreshold && this.everMovedRight && scrollCache.canScrollRight() &&
664
651
  (!bestSide || bestSide.distance > rightDist)) {
665
- bestSide = { scrollCache: scrollCache, name: 'right', distance: rightDist };
652
+ bestSide = { scrollCache, name: 'right', distance: rightDist };
666
653
  }
667
654
  }
668
655
  }
669
656
  return bestSide;
670
- };
671
- AutoScroller.prototype.buildCaches = function (scrollStartEl) {
672
- return this.queryScrollEls(scrollStartEl).map(function (el) {
657
+ }
658
+ buildCaches(scrollStartEl) {
659
+ return this.queryScrollEls(scrollStartEl).map((el) => {
673
660
  if (el === window) {
674
661
  return new WindowScrollGeomCache(false); // false = don't listen to user-generated scrolls
675
662
  }
676
663
  return new ElementScrollGeomCache(el, false); // false = don't listen to user-generated scrolls
677
664
  });
678
- };
679
- AutoScroller.prototype.queryScrollEls = function (scrollStartEl) {
680
- var els = [];
681
- for (var _i = 0, _a = this.scrollQuery; _i < _a.length; _i++) {
682
- var query = _a[_i];
665
+ }
666
+ queryScrollEls(scrollStartEl) {
667
+ let els = [];
668
+ for (let query of this.scrollQuery) {
683
669
  if (typeof query === 'object') {
684
670
  els.push(query);
685
671
  }
686
672
  else {
687
- els.push.apply(els, Array.prototype.slice.call(getElRoot(scrollStartEl).querySelectorAll(query)));
673
+ els.push(...Array.prototype.slice.call(getElRoot(scrollStartEl).querySelectorAll(query)));
688
674
  }
689
675
  }
690
676
  return els;
691
- };
692
- return AutoScroller;
693
- }());
677
+ }
678
+ }
694
679
 
695
680
  /*
696
681
  Monitors dragging on an element. Has a number of high-level features:
@@ -698,27 +683,26 @@ Monitors dragging on an element. Has a number of high-level features:
698
683
  - minimum wait time ("delay") before dragging
699
684
  - a mirror element that follows the pointer
700
685
  */
701
- var FeaturefulElementDragging = /** @class */ (function (_super) {
702
- __extends(FeaturefulElementDragging, _super);
703
- function FeaturefulElementDragging(containerEl, selector) {
704
- var _this = _super.call(this, containerEl) || this;
705
- _this.containerEl = containerEl;
686
+ class FeaturefulElementDragging extends ElementDragging {
687
+ constructor(containerEl, selector) {
688
+ super(containerEl);
689
+ this.containerEl = containerEl;
706
690
  // options that can be directly set by caller
707
691
  // the caller can also set the PointerDragging's options as well
708
- _this.delay = null;
709
- _this.minDistance = 0;
710
- _this.touchScrollAllowed = true; // prevents drag from starting and blocks scrolling during drag
711
- _this.mirrorNeedsRevert = false;
712
- _this.isInteracting = false; // is the user validly moving the pointer? lasts until pointerup
713
- _this.isDragging = false; // is it INTENTFULLY dragging? lasts until after revert animation
714
- _this.isDelayEnded = false;
715
- _this.isDistanceSurpassed = false;
716
- _this.delayTimeoutId = null;
717
- _this.onPointerDown = function (ev) {
718
- if (!_this.isDragging) { // so new drag doesn't happen while revert animation is going
719
- _this.isInteracting = true;
720
- _this.isDelayEnded = false;
721
- _this.isDistanceSurpassed = false;
692
+ this.delay = null;
693
+ this.minDistance = 0;
694
+ this.touchScrollAllowed = true; // prevents drag from starting and blocks scrolling during drag
695
+ this.mirrorNeedsRevert = false;
696
+ this.isInteracting = false; // is the user validly moving the pointer? lasts until pointerup
697
+ this.isDragging = false; // is it INTENTFULLY dragging? lasts until after revert animation
698
+ this.isDelayEnded = false;
699
+ this.isDistanceSurpassed = false;
700
+ this.delayTimeoutId = null;
701
+ this.onPointerDown = (ev) => {
702
+ if (!this.isDragging) { // so new drag doesn't happen while revert animation is going
703
+ this.isInteracting = true;
704
+ this.isDelayEnded = false;
705
+ this.isDistanceSurpassed = false;
722
706
  preventSelection(document.body);
723
707
  preventContextMenu(document.body);
724
708
  // prevent links from being visited if there's an eventual drag.
@@ -727,95 +711,93 @@ var FeaturefulElementDragging = /** @class */ (function (_super) {
727
711
  if (!ev.isTouch) {
728
712
  ev.origEvent.preventDefault();
729
713
  }
730
- _this.emitter.trigger('pointerdown', ev);
731
- if (_this.isInteracting && // not destroyed via pointerdown handler
732
- !_this.pointer.shouldIgnoreMove) {
714
+ this.emitter.trigger('pointerdown', ev);
715
+ if (this.isInteracting && // not destroyed via pointerdown handler
716
+ !this.pointer.shouldIgnoreMove) {
733
717
  // actions related to initiating dragstart+dragmove+dragend...
734
- _this.mirror.setIsVisible(false); // reset. caller must set-visible
735
- _this.mirror.start(ev.subjectEl, ev.pageX, ev.pageY); // must happen on first pointer down
736
- _this.startDelay(ev);
737
- if (!_this.minDistance) {
738
- _this.handleDistanceSurpassed(ev);
718
+ this.mirror.setIsVisible(false); // reset. caller must set-visible
719
+ this.mirror.start(ev.subjectEl, ev.pageX, ev.pageY); // must happen on first pointer down
720
+ this.startDelay(ev);
721
+ if (!this.minDistance) {
722
+ this.handleDistanceSurpassed(ev);
739
723
  }
740
724
  }
741
725
  }
742
726
  };
743
- _this.onPointerMove = function (ev) {
744
- if (_this.isInteracting) {
745
- _this.emitter.trigger('pointermove', ev);
746
- if (!_this.isDistanceSurpassed) {
747
- var minDistance = _this.minDistance;
748
- var distanceSq = void 0; // current distance from the origin, squared
749
- var deltaX = ev.deltaX, deltaY = ev.deltaY;
727
+ this.onPointerMove = (ev) => {
728
+ if (this.isInteracting) {
729
+ this.emitter.trigger('pointermove', ev);
730
+ if (!this.isDistanceSurpassed) {
731
+ let minDistance = this.minDistance;
732
+ let distanceSq; // current distance from the origin, squared
733
+ let { deltaX, deltaY } = ev;
750
734
  distanceSq = deltaX * deltaX + deltaY * deltaY;
751
735
  if (distanceSq >= minDistance * minDistance) { // use pythagorean theorem
752
- _this.handleDistanceSurpassed(ev);
736
+ this.handleDistanceSurpassed(ev);
753
737
  }
754
738
  }
755
- if (_this.isDragging) {
739
+ if (this.isDragging) {
756
740
  // a real pointer move? (not one simulated by scrolling)
757
741
  if (ev.origEvent.type !== 'scroll') {
758
- _this.mirror.handleMove(ev.pageX, ev.pageY);
759
- _this.autoScroller.handleMove(ev.pageX, ev.pageY);
742
+ this.mirror.handleMove(ev.pageX, ev.pageY);
743
+ this.autoScroller.handleMove(ev.pageX, ev.pageY);
760
744
  }
761
- _this.emitter.trigger('dragmove', ev);
745
+ this.emitter.trigger('dragmove', ev);
762
746
  }
763
747
  }
764
748
  };
765
- _this.onPointerUp = function (ev) {
766
- if (_this.isInteracting) {
767
- _this.isInteracting = false;
749
+ this.onPointerUp = (ev) => {
750
+ if (this.isInteracting) {
751
+ this.isInteracting = false;
768
752
  allowSelection(document.body);
769
753
  allowContextMenu(document.body);
770
- _this.emitter.trigger('pointerup', ev); // can potentially set mirrorNeedsRevert
771
- if (_this.isDragging) {
772
- _this.autoScroller.stop();
773
- _this.tryStopDrag(ev); // which will stop the mirror
754
+ this.emitter.trigger('pointerup', ev); // can potentially set mirrorNeedsRevert
755
+ if (this.isDragging) {
756
+ this.autoScroller.stop();
757
+ this.tryStopDrag(ev); // which will stop the mirror
774
758
  }
775
- if (_this.delayTimeoutId) {
776
- clearTimeout(_this.delayTimeoutId);
777
- _this.delayTimeoutId = null;
759
+ if (this.delayTimeoutId) {
760
+ clearTimeout(this.delayTimeoutId);
761
+ this.delayTimeoutId = null;
778
762
  }
779
763
  }
780
764
  };
781
- var pointer = _this.pointer = new PointerDragging(containerEl);
782
- pointer.emitter.on('pointerdown', _this.onPointerDown);
783
- pointer.emitter.on('pointermove', _this.onPointerMove);
784
- pointer.emitter.on('pointerup', _this.onPointerUp);
765
+ let pointer = this.pointer = new PointerDragging(containerEl);
766
+ pointer.emitter.on('pointerdown', this.onPointerDown);
767
+ pointer.emitter.on('pointermove', this.onPointerMove);
768
+ pointer.emitter.on('pointerup', this.onPointerUp);
785
769
  if (selector) {
786
770
  pointer.selector = selector;
787
771
  }
788
- _this.mirror = new ElementMirror();
789
- _this.autoScroller = new AutoScroller();
790
- return _this;
772
+ this.mirror = new ElementMirror();
773
+ this.autoScroller = new AutoScroller();
791
774
  }
792
- FeaturefulElementDragging.prototype.destroy = function () {
775
+ destroy() {
793
776
  this.pointer.destroy();
794
777
  // HACK: simulate a pointer-up to end the current drag
795
778
  // TODO: fire 'dragend' directly and stop interaction. discourage use of pointerup event (b/c might not fire)
796
779
  this.onPointerUp({});
797
- };
798
- FeaturefulElementDragging.prototype.startDelay = function (ev) {
799
- var _this = this;
780
+ }
781
+ startDelay(ev) {
800
782
  if (typeof this.delay === 'number') {
801
- this.delayTimeoutId = setTimeout(function () {
802
- _this.delayTimeoutId = null;
803
- _this.handleDelayEnd(ev);
783
+ this.delayTimeoutId = setTimeout(() => {
784
+ this.delayTimeoutId = null;
785
+ this.handleDelayEnd(ev);
804
786
  }, this.delay); // not assignable to number!
805
787
  }
806
788
  else {
807
789
  this.handleDelayEnd(ev);
808
790
  }
809
- };
810
- FeaturefulElementDragging.prototype.handleDelayEnd = function (ev) {
791
+ }
792
+ handleDelayEnd(ev) {
811
793
  this.isDelayEnded = true;
812
794
  this.tryStartDrag(ev);
813
- };
814
- FeaturefulElementDragging.prototype.handleDistanceSurpassed = function (ev) {
795
+ }
796
+ handleDistanceSurpassed(ev) {
815
797
  this.isDistanceSurpassed = true;
816
798
  this.tryStartDrag(ev);
817
- };
818
- FeaturefulElementDragging.prototype.tryStartDrag = function (ev) {
799
+ }
800
+ tryStartDrag(ev) {
819
801
  if (this.isDelayEnded && this.isDistanceSurpassed) {
820
802
  if (!this.pointer.wasTouchScroll || this.touchScrollAllowed) {
821
803
  this.isDragging = true;
@@ -827,31 +809,30 @@ var FeaturefulElementDragging = /** @class */ (function (_super) {
827
809
  }
828
810
  }
829
811
  }
830
- };
831
- FeaturefulElementDragging.prototype.tryStopDrag = function (ev) {
812
+ }
813
+ tryStopDrag(ev) {
832
814
  // .stop() is ALWAYS asynchronous, which we NEED because we want all pointerup events
833
815
  // that come from the document to fire beforehand. much more convenient this way.
834
816
  this.mirror.stop(this.mirrorNeedsRevert, this.stopDrag.bind(this, ev));
835
- };
836
- FeaturefulElementDragging.prototype.stopDrag = function (ev) {
817
+ }
818
+ stopDrag(ev) {
837
819
  this.isDragging = false;
838
820
  this.emitter.trigger('dragend', ev);
839
- };
821
+ }
840
822
  // fill in the implementations...
841
- FeaturefulElementDragging.prototype.setIgnoreMove = function (bool) {
823
+ setIgnoreMove(bool) {
842
824
  this.pointer.shouldIgnoreMove = bool;
843
- };
844
- FeaturefulElementDragging.prototype.setMirrorIsVisible = function (bool) {
825
+ }
826
+ setMirrorIsVisible(bool) {
845
827
  this.mirror.setIsVisible(bool);
846
- };
847
- FeaturefulElementDragging.prototype.setMirrorNeedsRevert = function (bool) {
828
+ }
829
+ setMirrorNeedsRevert(bool) {
848
830
  this.mirrorNeedsRevert = bool;
849
- };
850
- FeaturefulElementDragging.prototype.setAutoScrollEnabled = function (bool) {
831
+ }
832
+ setAutoScrollEnabled(bool) {
851
833
  this.autoScroller.isEnabled = bool;
852
- };
853
- return FeaturefulElementDragging;
854
- }(ElementDragging));
834
+ }
835
+ }
855
836
 
856
837
  /*
857
838
  When this class is instantiated, it records the offset of an element (relative to the document topleft),
@@ -861,51 +842,46 @@ Does not access the DOM after instantiation, so highly performant.
861
842
  Also keeps track of all scrolling/overflow:hidden containers that are parents of the given element
862
843
  and an determine if a given point is inside the combined clipping rectangle.
863
844
  */
864
- var OffsetTracker = /** @class */ (function () {
865
- function OffsetTracker(el) {
845
+ class OffsetTracker {
846
+ constructor(el) {
866
847
  this.origRect = computeRect(el);
867
848
  // will work fine for divs that have overflow:hidden
868
- this.scrollCaches = getClippingParents(el).map(function (scrollEl) { return new ElementScrollGeomCache(scrollEl, true); });
849
+ this.scrollCaches = getClippingParents(el).map((scrollEl) => new ElementScrollGeomCache(scrollEl, true));
869
850
  }
870
- OffsetTracker.prototype.destroy = function () {
871
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
872
- var scrollCache = _a[_i];
851
+ destroy() {
852
+ for (let scrollCache of this.scrollCaches) {
873
853
  scrollCache.destroy();
874
854
  }
875
- };
876
- OffsetTracker.prototype.computeLeft = function () {
877
- var left = this.origRect.left;
878
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
879
- var scrollCache = _a[_i];
855
+ }
856
+ computeLeft() {
857
+ let left = this.origRect.left;
858
+ for (let scrollCache of this.scrollCaches) {
880
859
  left += scrollCache.origScrollLeft - scrollCache.getScrollLeft();
881
860
  }
882
861
  return left;
883
- };
884
- OffsetTracker.prototype.computeTop = function () {
885
- var top = this.origRect.top;
886
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
887
- var scrollCache = _a[_i];
862
+ }
863
+ computeTop() {
864
+ let top = this.origRect.top;
865
+ for (let scrollCache of this.scrollCaches) {
888
866
  top += scrollCache.origScrollTop - scrollCache.getScrollTop();
889
867
  }
890
868
  return top;
891
- };
892
- OffsetTracker.prototype.isWithinClipping = function (pageX, pageY) {
893
- var point = { left: pageX, top: pageY };
894
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
895
- var scrollCache = _a[_i];
869
+ }
870
+ isWithinClipping(pageX, pageY) {
871
+ let point = { left: pageX, top: pageY };
872
+ for (let scrollCache of this.scrollCaches) {
896
873
  if (!isIgnoredClipping(scrollCache.getEventTarget()) &&
897
874
  !pointInsideRect(point, scrollCache.clientRect)) {
898
875
  return false;
899
876
  }
900
877
  }
901
878
  return true;
902
- };
903
- return OffsetTracker;
904
- }());
879
+ }
880
+ }
905
881
  // certain clipping containers should never constrain interactions, like <html> and <body>
906
882
  // https://github.com/fullcalendar/fullcalendar/issues/3615
907
883
  function isIgnoredClipping(node) {
908
- var tagName = node.tagName;
884
+ let tagName = node.tagName;
909
885
  return tagName === 'HTML' || tagName === 'BODY';
910
886
  }
911
887
 
@@ -922,50 +898,49 @@ emits:
922
898
  - (hitchange - again, to null, if ended over a hit)
923
899
  - dragend
924
900
  */
925
- var HitDragging = /** @class */ (function () {
926
- function HitDragging(dragging, droppableStore) {
927
- var _this = this;
901
+ class HitDragging {
902
+ constructor(dragging, droppableStore) {
928
903
  // options that can be set by caller
929
904
  this.useSubjectCenter = false;
930
905
  this.requireInitial = true; // if doesn't start out on a hit, won't emit any events
931
906
  this.initialHit = null;
932
907
  this.movingHit = null;
933
908
  this.finalHit = null; // won't ever be populated if shouldIgnoreMove
934
- this.handlePointerDown = function (ev) {
935
- var dragging = _this.dragging;
936
- _this.initialHit = null;
937
- _this.movingHit = null;
938
- _this.finalHit = null;
939
- _this.prepareHits();
940
- _this.processFirstCoord(ev);
941
- if (_this.initialHit || !_this.requireInitial) {
909
+ this.handlePointerDown = (ev) => {
910
+ let { dragging } = this;
911
+ this.initialHit = null;
912
+ this.movingHit = null;
913
+ this.finalHit = null;
914
+ this.prepareHits();
915
+ this.processFirstCoord(ev);
916
+ if (this.initialHit || !this.requireInitial) {
942
917
  dragging.setIgnoreMove(false);
943
918
  // TODO: fire this before computing processFirstCoord, so listeners can cancel. this gets fired by almost every handler :(
944
- _this.emitter.trigger('pointerdown', ev);
919
+ this.emitter.trigger('pointerdown', ev);
945
920
  }
946
921
  else {
947
922
  dragging.setIgnoreMove(true);
948
923
  }
949
924
  };
950
- this.handleDragStart = function (ev) {
951
- _this.emitter.trigger('dragstart', ev);
952
- _this.handleMove(ev, true); // force = fire even if initially null
925
+ this.handleDragStart = (ev) => {
926
+ this.emitter.trigger('dragstart', ev);
927
+ this.handleMove(ev, true); // force = fire even if initially null
953
928
  };
954
- this.handleDragMove = function (ev) {
955
- _this.emitter.trigger('dragmove', ev);
956
- _this.handleMove(ev);
929
+ this.handleDragMove = (ev) => {
930
+ this.emitter.trigger('dragmove', ev);
931
+ this.handleMove(ev);
957
932
  };
958
- this.handlePointerUp = function (ev) {
959
- _this.releaseHits();
960
- _this.emitter.trigger('pointerup', ev);
933
+ this.handlePointerUp = (ev) => {
934
+ this.releaseHits();
935
+ this.emitter.trigger('pointerup', ev);
961
936
  };
962
- this.handleDragEnd = function (ev) {
963
- if (_this.movingHit) {
964
- _this.emitter.trigger('hitupdate', null, true, ev);
937
+ this.handleDragEnd = (ev) => {
938
+ if (this.movingHit) {
939
+ this.emitter.trigger('hitupdate', null, true, ev);
965
940
  }
966
- _this.finalHit = _this.movingHit;
967
- _this.movingHit = null;
968
- _this.emitter.trigger('dragend', ev);
941
+ this.finalHit = this.movingHit;
942
+ this.movingHit = null;
943
+ this.emitter.trigger('dragend', ev);
969
944
  };
970
945
  this.droppableStore = droppableStore;
971
946
  dragging.emitter.on('pointerdown', this.handlePointerDown);
@@ -978,19 +953,19 @@ var HitDragging = /** @class */ (function () {
978
953
  }
979
954
  // sets initialHit
980
955
  // sets coordAdjust
981
- HitDragging.prototype.processFirstCoord = function (ev) {
982
- var origPoint = { left: ev.pageX, top: ev.pageY };
983
- var adjustedPoint = origPoint;
984
- var subjectEl = ev.subjectEl;
985
- var subjectRect;
956
+ processFirstCoord(ev) {
957
+ let origPoint = { left: ev.pageX, top: ev.pageY };
958
+ let adjustedPoint = origPoint;
959
+ let subjectEl = ev.subjectEl;
960
+ let subjectRect;
986
961
  if (subjectEl instanceof HTMLElement) { // i.e. not a Document/ShadowRoot
987
962
  subjectRect = computeRect(subjectEl);
988
963
  adjustedPoint = constrainPoint(adjustedPoint, subjectRect);
989
964
  }
990
- var initialHit = this.initialHit = this.queryHitForOffset(adjustedPoint.left, adjustedPoint.top);
965
+ let initialHit = this.initialHit = this.queryHitForOffset(adjustedPoint.left, adjustedPoint.top);
991
966
  if (initialHit) {
992
967
  if (this.useSubjectCenter && subjectRect) {
993
- var slicedSubjectRect = intersectRects(subjectRect, initialHit.rect);
968
+ let slicedSubjectRect = intersectRects(subjectRect, initialHit.rect);
994
969
  if (slicedSubjectRect) {
995
970
  adjustedPoint = getRectCenter(slicedSubjectRect);
996
971
  }
@@ -1000,47 +975,47 @@ var HitDragging = /** @class */ (function () {
1000
975
  else {
1001
976
  this.coordAdjust = { left: 0, top: 0 };
1002
977
  }
1003
- };
1004
- HitDragging.prototype.handleMove = function (ev, forceHandle) {
1005
- var hit = this.queryHitForOffset(ev.pageX + this.coordAdjust.left, ev.pageY + this.coordAdjust.top);
978
+ }
979
+ handleMove(ev, forceHandle) {
980
+ let hit = this.queryHitForOffset(ev.pageX + this.coordAdjust.left, ev.pageY + this.coordAdjust.top);
1006
981
  if (forceHandle || !isHitsEqual(this.movingHit, hit)) {
1007
982
  this.movingHit = hit;
1008
983
  this.emitter.trigger('hitupdate', hit, false, ev);
1009
984
  }
1010
- };
1011
- HitDragging.prototype.prepareHits = function () {
1012
- this.offsetTrackers = mapHash(this.droppableStore, function (interactionSettings) {
985
+ }
986
+ prepareHits() {
987
+ this.offsetTrackers = mapHash(this.droppableStore, (interactionSettings) => {
1013
988
  interactionSettings.component.prepareHits();
1014
989
  return new OffsetTracker(interactionSettings.el);
1015
990
  });
1016
- };
1017
- HitDragging.prototype.releaseHits = function () {
1018
- var offsetTrackers = this.offsetTrackers;
1019
- for (var id in offsetTrackers) {
991
+ }
992
+ releaseHits() {
993
+ let { offsetTrackers } = this;
994
+ for (let id in offsetTrackers) {
1020
995
  offsetTrackers[id].destroy();
1021
996
  }
1022
997
  this.offsetTrackers = {};
1023
- };
1024
- HitDragging.prototype.queryHitForOffset = function (offsetLeft, offsetTop) {
1025
- var _a = this, droppableStore = _a.droppableStore, offsetTrackers = _a.offsetTrackers;
1026
- var bestHit = null;
1027
- for (var id in droppableStore) {
1028
- var component = droppableStore[id].component;
1029
- var offsetTracker = offsetTrackers[id];
998
+ }
999
+ queryHitForOffset(offsetLeft, offsetTop) {
1000
+ let { droppableStore, offsetTrackers } = this;
1001
+ let bestHit = null;
1002
+ for (let id in droppableStore) {
1003
+ let component = droppableStore[id].component;
1004
+ let offsetTracker = offsetTrackers[id];
1030
1005
  if (offsetTracker && // wasn't destroyed mid-drag
1031
1006
  offsetTracker.isWithinClipping(offsetLeft, offsetTop)) {
1032
- var originLeft = offsetTracker.computeLeft();
1033
- var originTop = offsetTracker.computeTop();
1034
- var positionLeft = offsetLeft - originLeft;
1035
- var positionTop = offsetTop - originTop;
1036
- var origRect = offsetTracker.origRect;
1037
- var width = origRect.right - origRect.left;
1038
- var height = origRect.bottom - origRect.top;
1007
+ let originLeft = offsetTracker.computeLeft();
1008
+ let originTop = offsetTracker.computeTop();
1009
+ let positionLeft = offsetLeft - originLeft;
1010
+ let positionTop = offsetTop - originTop;
1011
+ let { origRect } = offsetTracker;
1012
+ let width = origRect.right - origRect.left;
1013
+ let height = origRect.bottom - origRect.top;
1039
1014
  if (
1040
1015
  // must be within the element's bounds
1041
1016
  positionLeft >= 0 && positionLeft < width &&
1042
1017
  positionTop >= 0 && positionTop < height) {
1043
- var hit = component.queryHit(positionLeft, positionTop, width, height);
1018
+ let hit = component.queryHit(positionLeft, positionTop, width, height);
1044
1019
  if (hit && (
1045
1020
  // make sure the hit is within activeRange, meaning it's not a dead cell
1046
1021
  rangeContainsRange(hit.dateProfile.activeRange, hit.dateSpan.range)) &&
@@ -1058,9 +1033,8 @@ var HitDragging = /** @class */ (function () {
1058
1033
  }
1059
1034
  }
1060
1035
  return bestHit;
1061
- };
1062
- return HitDragging;
1063
- }());
1036
+ }
1037
+ }
1064
1038
  function isHitsEqual(hit0, hit1) {
1065
1039
  if (!hit0 && !hit1) {
1066
1040
  return true;
@@ -1072,9 +1046,8 @@ function isHitsEqual(hit0, hit1) {
1072
1046
  }
1073
1047
 
1074
1048
  function buildDatePointApiWithContext(dateSpan, context) {
1075
- var props = {};
1076
- for (var _i = 0, _a = context.pluginHooks.datePointTransforms; _i < _a.length; _i++) {
1077
- var transform = _a[_i];
1049
+ let props = {};
1050
+ for (let transform of context.pluginHooks.datePointTransforms) {
1078
1051
  __assign(props, transform(dateSpan, context));
1079
1052
  }
1080
1053
  __assign(props, buildDatePointApi(dateSpan, context.dateEnv));
@@ -1092,74 +1065,70 @@ function buildDatePointApi(span, dateEnv) {
1092
1065
  Monitors when the user clicks on a specific date/time of a component.
1093
1066
  A pointerdown+pointerup on the same "hit" constitutes a click.
1094
1067
  */
1095
- var DateClicking = /** @class */ (function (_super) {
1096
- __extends(DateClicking, _super);
1097
- function DateClicking(settings) {
1098
- var _this = _super.call(this, settings) || this;
1099
- _this.handlePointerDown = function (pev) {
1100
- var dragging = _this.dragging;
1101
- var downEl = pev.origEvent.target;
1068
+ class DateClicking extends Interaction {
1069
+ constructor(settings) {
1070
+ super(settings);
1071
+ this.handlePointerDown = (pev) => {
1072
+ let { dragging } = this;
1073
+ let downEl = pev.origEvent.target;
1102
1074
  // do this in pointerdown (not dragend) because DOM might be mutated by the time dragend is fired
1103
- dragging.setIgnoreMove(!_this.component.isValidDateDownEl(downEl));
1075
+ dragging.setIgnoreMove(!this.component.isValidDateDownEl(downEl));
1104
1076
  };
1105
1077
  // won't even fire if moving was ignored
1106
- _this.handleDragEnd = function (ev) {
1107
- var component = _this.component;
1108
- var pointer = _this.dragging.pointer;
1078
+ this.handleDragEnd = (ev) => {
1079
+ let { component } = this;
1080
+ let { pointer } = this.dragging;
1109
1081
  if (!pointer.wasTouchScroll) {
1110
- var _a = _this.hitDragging, initialHit = _a.initialHit, finalHit = _a.finalHit;
1082
+ let { initialHit, finalHit } = this.hitDragging;
1111
1083
  if (initialHit && finalHit && isHitsEqual(initialHit, finalHit)) {
1112
- var context = component.context;
1113
- var arg = __assign(__assign({}, buildDatePointApiWithContext(initialHit.dateSpan, context)), { dayEl: initialHit.dayEl, jsEvent: ev.origEvent, view: context.viewApi || context.calendarApi.view });
1084
+ let { context } = component;
1085
+ let arg = Object.assign(Object.assign({}, buildDatePointApiWithContext(initialHit.dateSpan, context)), { dayEl: initialHit.dayEl, jsEvent: ev.origEvent, view: context.viewApi || context.calendarApi.view });
1114
1086
  context.emitter.trigger('dateClick', arg);
1115
1087
  }
1116
1088
  }
1117
1089
  };
1118
1090
  // we DO want to watch pointer moves because otherwise finalHit won't get populated
1119
- _this.dragging = new FeaturefulElementDragging(settings.el);
1120
- _this.dragging.autoScroller.isEnabled = false;
1121
- var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsToStore(settings));
1122
- hitDragging.emitter.on('pointerdown', _this.handlePointerDown);
1123
- hitDragging.emitter.on('dragend', _this.handleDragEnd);
1124
- return _this;
1125
- }
1126
- DateClicking.prototype.destroy = function () {
1091
+ this.dragging = new FeaturefulElementDragging(settings.el);
1092
+ this.dragging.autoScroller.isEnabled = false;
1093
+ let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings));
1094
+ hitDragging.emitter.on('pointerdown', this.handlePointerDown);
1095
+ hitDragging.emitter.on('dragend', this.handleDragEnd);
1096
+ }
1097
+ destroy() {
1127
1098
  this.dragging.destroy();
1128
- };
1129
- return DateClicking;
1130
- }(Interaction));
1099
+ }
1100
+ }
1131
1101
 
1132
1102
  /*
1133
1103
  Tracks when the user selects a portion of time of a component,
1134
1104
  constituted by a drag over date cells, with a possible delay at the beginning of the drag.
1135
1105
  */
1136
- var DateSelecting = /** @class */ (function (_super) {
1137
- __extends(DateSelecting, _super);
1138
- function DateSelecting(settings) {
1139
- var _this = _super.call(this, settings) || this;
1140
- _this.dragSelection = null;
1141
- _this.handlePointerDown = function (ev) {
1142
- var _a = _this, component = _a.component, dragging = _a.dragging;
1143
- var options = component.context.options;
1144
- var canSelect = options.selectable &&
1106
+ class DateSelecting extends Interaction {
1107
+ constructor(settings) {
1108
+ super(settings);
1109
+ this.dragSelection = null;
1110
+ this.handlePointerDown = (ev) => {
1111
+ let { component, dragging } = this;
1112
+ let { options } = component.context;
1113
+ let canSelect = options.selectable &&
1145
1114
  component.isValidDateDownEl(ev.origEvent.target);
1146
1115
  // don't bother to watch expensive moves if component won't do selection
1147
1116
  dragging.setIgnoreMove(!canSelect);
1148
1117
  // if touch, require user to hold down
1149
1118
  dragging.delay = ev.isTouch ? getComponentTouchDelay$1(component) : null;
1150
1119
  };
1151
- _this.handleDragStart = function (ev) {
1152
- _this.component.context.calendarApi.unselect(ev); // unselect previous selections
1120
+ this.handleDragStart = (ev) => {
1121
+ this.component.context.calendarApi.unselect(ev); // unselect previous selections
1153
1122
  };
1154
- _this.handleHitUpdate = function (hit, isFinal) {
1155
- var context = _this.component.context;
1156
- var dragSelection = null;
1157
- var isInvalid = false;
1123
+ this.handleHitUpdate = (hit, isFinal) => {
1124
+ let { context } = this.component;
1125
+ let dragSelection = null;
1126
+ let isInvalid = false;
1158
1127
  if (hit) {
1159
- var initialHit = _this.hitDragging.initialHit;
1160
- var disallowed = hit.componentId === initialHit.componentId
1161
- && _this.isHitComboAllowed
1162
- && !_this.isHitComboAllowed(initialHit, hit);
1128
+ let initialHit = this.hitDragging.initialHit;
1129
+ let disallowed = hit.componentId === initialHit.componentId
1130
+ && this.isHitComboAllowed
1131
+ && !this.isHitComboAllowed(initialHit, hit);
1163
1132
  if (!disallowed) {
1164
1133
  dragSelection = joinHitsIntoSelection(initialHit, hit, context.pluginHooks.dateSelectionTransformers);
1165
1134
  }
@@ -1181,56 +1150,53 @@ var DateSelecting = /** @class */ (function (_super) {
1181
1150
  disableCursor();
1182
1151
  }
1183
1152
  if (!isFinal) {
1184
- _this.dragSelection = dragSelection; // only clear if moved away from all hits while dragging
1153
+ this.dragSelection = dragSelection; // only clear if moved away from all hits while dragging
1185
1154
  }
1186
1155
  };
1187
- _this.handlePointerUp = function (pev) {
1188
- if (_this.dragSelection) {
1156
+ this.handlePointerUp = (pev) => {
1157
+ if (this.dragSelection) {
1189
1158
  // selection is already rendered, so just need to report selection
1190
- triggerDateSelect(_this.dragSelection, pev, _this.component.context);
1191
- _this.dragSelection = null;
1159
+ triggerDateSelect(this.dragSelection, pev, this.component.context);
1160
+ this.dragSelection = null;
1192
1161
  }
1193
1162
  };
1194
- var component = settings.component;
1195
- var options = component.context.options;
1196
- var dragging = _this.dragging = new FeaturefulElementDragging(settings.el);
1163
+ let { component } = settings;
1164
+ let { options } = component.context;
1165
+ let dragging = this.dragging = new FeaturefulElementDragging(settings.el);
1197
1166
  dragging.touchScrollAllowed = false;
1198
1167
  dragging.minDistance = options.selectMinDistance || 0;
1199
1168
  dragging.autoScroller.isEnabled = options.dragScroll;
1200
- var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsToStore(settings));
1201
- hitDragging.emitter.on('pointerdown', _this.handlePointerDown);
1202
- hitDragging.emitter.on('dragstart', _this.handleDragStart);
1203
- hitDragging.emitter.on('hitupdate', _this.handleHitUpdate);
1204
- hitDragging.emitter.on('pointerup', _this.handlePointerUp);
1205
- return _this;
1206
- }
1207
- DateSelecting.prototype.destroy = function () {
1169
+ let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings));
1170
+ hitDragging.emitter.on('pointerdown', this.handlePointerDown);
1171
+ hitDragging.emitter.on('dragstart', this.handleDragStart);
1172
+ hitDragging.emitter.on('hitupdate', this.handleHitUpdate);
1173
+ hitDragging.emitter.on('pointerup', this.handlePointerUp);
1174
+ }
1175
+ destroy() {
1208
1176
  this.dragging.destroy();
1209
- };
1210
- return DateSelecting;
1211
- }(Interaction));
1177
+ }
1178
+ }
1212
1179
  function getComponentTouchDelay$1(component) {
1213
- var options = component.context.options;
1214
- var delay = options.selectLongPressDelay;
1180
+ let { options } = component.context;
1181
+ let delay = options.selectLongPressDelay;
1215
1182
  if (delay == null) {
1216
1183
  delay = options.longPressDelay;
1217
1184
  }
1218
1185
  return delay;
1219
1186
  }
1220
1187
  function joinHitsIntoSelection(hit0, hit1, dateSelectionTransformers) {
1221
- var dateSpan0 = hit0.dateSpan;
1222
- var dateSpan1 = hit1.dateSpan;
1223
- var ms = [
1188
+ let dateSpan0 = hit0.dateSpan;
1189
+ let dateSpan1 = hit1.dateSpan;
1190
+ let ms = [
1224
1191
  dateSpan0.range.start,
1225
1192
  dateSpan0.range.end,
1226
1193
  dateSpan1.range.start,
1227
1194
  dateSpan1.range.end,
1228
1195
  ];
1229
1196
  ms.sort(compareNumbers);
1230
- var props = {};
1231
- for (var _i = 0, dateSelectionTransformers_1 = dateSelectionTransformers; _i < dateSelectionTransformers_1.length; _i++) {
1232
- var transformer = dateSelectionTransformers_1[_i];
1233
- var res = transformer(hit0, hit1);
1197
+ let props = {};
1198
+ for (let transformer of dateSelectionTransformers) {
1199
+ let res = transformer(hit0, hit1);
1234
1200
  if (res === false) {
1235
1201
  return null;
1236
1202
  }
@@ -1243,30 +1209,29 @@ function joinHitsIntoSelection(hit0, hit1, dateSelectionTransformers) {
1243
1209
  return props;
1244
1210
  }
1245
1211
 
1246
- var EventDragging = /** @class */ (function (_super) {
1247
- __extends(EventDragging, _super);
1248
- function EventDragging(settings) {
1249
- var _this = _super.call(this, settings) || this;
1212
+ class EventDragging extends Interaction {
1213
+ constructor(settings) {
1214
+ super(settings);
1250
1215
  // internal state
1251
- _this.subjectEl = null;
1252
- _this.subjectSeg = null; // the seg being selected/dragged
1253
- _this.isDragging = false;
1254
- _this.eventRange = null;
1255
- _this.relevantEvents = null; // the events being dragged
1256
- _this.receivingContext = null;
1257
- _this.validMutation = null;
1258
- _this.mutatedRelevantEvents = null;
1259
- _this.handlePointerDown = function (ev) {
1260
- var origTarget = ev.origEvent.target;
1261
- var _a = _this, component = _a.component, dragging = _a.dragging;
1262
- var mirror = dragging.mirror;
1263
- var options = component.context.options;
1264
- var initialContext = component.context;
1265
- _this.subjectEl = ev.subjectEl;
1266
- var subjectSeg = _this.subjectSeg = getElSeg(ev.subjectEl);
1267
- var eventRange = _this.eventRange = subjectSeg.eventRange;
1268
- var eventInstanceId = eventRange.instance.instanceId;
1269
- _this.relevantEvents = getRelevantEvents(initialContext.getCurrentData().eventStore, eventInstanceId);
1216
+ this.subjectEl = null;
1217
+ this.subjectSeg = null; // the seg being selected/dragged
1218
+ this.isDragging = false;
1219
+ this.eventRange = null;
1220
+ this.relevantEvents = null; // the events being dragged
1221
+ this.receivingContext = null;
1222
+ this.validMutation = null;
1223
+ this.mutatedRelevantEvents = null;
1224
+ this.handlePointerDown = (ev) => {
1225
+ let origTarget = ev.origEvent.target;
1226
+ let { component, dragging } = this;
1227
+ let { mirror } = dragging;
1228
+ let { options } = component.context;
1229
+ let initialContext = component.context;
1230
+ this.subjectEl = ev.subjectEl;
1231
+ let subjectSeg = this.subjectSeg = getElSeg(ev.subjectEl);
1232
+ let eventRange = this.eventRange = subjectSeg.eventRange;
1233
+ let eventInstanceId = eventRange.instance.instanceId;
1234
+ this.relevantEvents = getRelevantEvents(initialContext.getCurrentData().eventStore, eventInstanceId);
1270
1235
  dragging.minDistance = ev.isTouch ? 0 : options.eventDragMinDistance;
1271
1236
  dragging.delay =
1272
1237
  // only do a touch delay if touch and this event hasn't been selected yet
@@ -1280,58 +1245,58 @@ var EventDragging = /** @class */ (function (_super) {
1280
1245
  mirror.parentNode = elementClosest(origTarget, '.fc');
1281
1246
  }
1282
1247
  mirror.revertDuration = options.dragRevertDuration;
1283
- var isValid = component.isValidSegDownEl(origTarget) &&
1248
+ let isValid = component.isValidSegDownEl(origTarget) &&
1284
1249
  !elementClosest(origTarget, '.fc-event-resizer'); // NOT on a resizer
1285
1250
  dragging.setIgnoreMove(!isValid);
1286
1251
  // disable dragging for elements that are resizable (ie, selectable)
1287
1252
  // but are not draggable
1288
- _this.isDragging = isValid &&
1253
+ this.isDragging = isValid &&
1289
1254
  ev.subjectEl.classList.contains('fc-event-draggable');
1290
1255
  };
1291
- _this.handleDragStart = function (ev) {
1292
- var initialContext = _this.component.context;
1293
- var eventRange = _this.eventRange;
1294
- var eventInstanceId = eventRange.instance.instanceId;
1256
+ this.handleDragStart = (ev) => {
1257
+ let initialContext = this.component.context;
1258
+ let eventRange = this.eventRange;
1259
+ let eventInstanceId = eventRange.instance.instanceId;
1295
1260
  if (ev.isTouch) {
1296
1261
  // need to select a different event?
1297
- if (eventInstanceId !== _this.component.props.eventSelection) {
1298
- initialContext.dispatch({ type: 'SELECT_EVENT', eventInstanceId: eventInstanceId });
1262
+ if (eventInstanceId !== this.component.props.eventSelection) {
1263
+ initialContext.dispatch({ type: 'SELECT_EVENT', eventInstanceId });
1299
1264
  }
1300
1265
  }
1301
1266
  else {
1302
1267
  // if now using mouse, but was previous touch interaction, clear selected event
1303
1268
  initialContext.dispatch({ type: 'UNSELECT_EVENT' });
1304
1269
  }
1305
- if (_this.isDragging) {
1270
+ if (this.isDragging) {
1306
1271
  initialContext.calendarApi.unselect(ev); // unselect *date* selection
1307
1272
  initialContext.emitter.trigger('eventDragStart', {
1308
- el: _this.subjectEl,
1273
+ el: this.subjectEl,
1309
1274
  event: new EventApi(initialContext, eventRange.def, eventRange.instance),
1310
1275
  jsEvent: ev.origEvent,
1311
1276
  view: initialContext.viewApi,
1312
1277
  });
1313
1278
  }
1314
1279
  };
1315
- _this.handleHitUpdate = function (hit, isFinal) {
1316
- if (!_this.isDragging) {
1280
+ this.handleHitUpdate = (hit, isFinal) => {
1281
+ if (!this.isDragging) {
1317
1282
  return;
1318
1283
  }
1319
- var relevantEvents = _this.relevantEvents;
1320
- var initialHit = _this.hitDragging.initialHit;
1321
- var initialContext = _this.component.context;
1284
+ let relevantEvents = this.relevantEvents;
1285
+ let initialHit = this.hitDragging.initialHit;
1286
+ let initialContext = this.component.context;
1322
1287
  // states based on new hit
1323
- var receivingContext = null;
1324
- var mutation = null;
1325
- var mutatedRelevantEvents = null;
1326
- var isInvalid = false;
1327
- var interaction = {
1288
+ let receivingContext = null;
1289
+ let mutation = null;
1290
+ let mutatedRelevantEvents = null;
1291
+ let isInvalid = false;
1292
+ let interaction = {
1328
1293
  affectedEvents: relevantEvents,
1329
1294
  mutatedEvents: createEmptyEventStore(),
1330
1295
  isEvent: true,
1331
1296
  };
1332
1297
  if (hit) {
1333
1298
  receivingContext = hit.context;
1334
- var receivingOptions = receivingContext.options;
1299
+ let receivingOptions = receivingContext.options;
1335
1300
  if (initialContext === receivingContext ||
1336
1301
  (receivingOptions.editable && receivingOptions.droppable)) {
1337
1302
  mutation = computeEventMutation(initialHit, hit, receivingContext.getCurrentData().pluginHooks.eventDragMutationMassagers);
@@ -1350,7 +1315,7 @@ var EventDragging = /** @class */ (function (_super) {
1350
1315
  receivingContext = null;
1351
1316
  }
1352
1317
  }
1353
- _this.displayDrag(receivingContext, interaction);
1318
+ this.displayDrag(receivingContext, interaction);
1354
1319
  if (!isInvalid) {
1355
1320
  enableCursor();
1356
1321
  }
@@ -1362,140 +1327,138 @@ var EventDragging = /** @class */ (function (_super) {
1362
1327
  isHitsEqual(initialHit, hit)) {
1363
1328
  mutation = null;
1364
1329
  }
1365
- _this.dragging.setMirrorNeedsRevert(!mutation);
1330
+ this.dragging.setMirrorNeedsRevert(!mutation);
1366
1331
  // render the mirror if no already-rendered mirror
1367
1332
  // TODO: wish we could somehow wait for dispatch to guarantee render
1368
- _this.dragging.setMirrorIsVisible(!hit || !getElRoot(_this.subjectEl).querySelector('.fc-event-mirror'));
1333
+ this.dragging.setMirrorIsVisible(!hit || !getElRoot(this.subjectEl).querySelector('.fc-event-mirror'));
1369
1334
  // assign states based on new hit
1370
- _this.receivingContext = receivingContext;
1371
- _this.validMutation = mutation;
1372
- _this.mutatedRelevantEvents = mutatedRelevantEvents;
1335
+ this.receivingContext = receivingContext;
1336
+ this.validMutation = mutation;
1337
+ this.mutatedRelevantEvents = mutatedRelevantEvents;
1373
1338
  }
1374
1339
  };
1375
- _this.handlePointerUp = function () {
1376
- if (!_this.isDragging) {
1377
- _this.cleanup(); // because handleDragEnd won't fire
1340
+ this.handlePointerUp = () => {
1341
+ if (!this.isDragging) {
1342
+ this.cleanup(); // because handleDragEnd won't fire
1378
1343
  }
1379
1344
  };
1380
- _this.handleDragEnd = function (ev) {
1381
- if (_this.isDragging) {
1382
- var initialContext_1 = _this.component.context;
1383
- var initialView = initialContext_1.viewApi;
1384
- var _a = _this, receivingContext_1 = _a.receivingContext, validMutation = _a.validMutation;
1385
- var eventDef = _this.eventRange.def;
1386
- var eventInstance = _this.eventRange.instance;
1387
- var eventApi = new EventApi(initialContext_1, eventDef, eventInstance);
1388
- var relevantEvents_1 = _this.relevantEvents;
1389
- var mutatedRelevantEvents_1 = _this.mutatedRelevantEvents;
1390
- var finalHit = _this.hitDragging.finalHit;
1391
- _this.clearDrag(); // must happen after revert animation
1392
- initialContext_1.emitter.trigger('eventDragStop', {
1393
- el: _this.subjectEl,
1345
+ this.handleDragEnd = (ev) => {
1346
+ if (this.isDragging) {
1347
+ let initialContext = this.component.context;
1348
+ let initialView = initialContext.viewApi;
1349
+ let { receivingContext, validMutation } = this;
1350
+ let eventDef = this.eventRange.def;
1351
+ let eventInstance = this.eventRange.instance;
1352
+ let eventApi = new EventApi(initialContext, eventDef, eventInstance);
1353
+ let relevantEvents = this.relevantEvents;
1354
+ let mutatedRelevantEvents = this.mutatedRelevantEvents;
1355
+ let { finalHit } = this.hitDragging;
1356
+ this.clearDrag(); // must happen after revert animation
1357
+ initialContext.emitter.trigger('eventDragStop', {
1358
+ el: this.subjectEl,
1394
1359
  event: eventApi,
1395
1360
  jsEvent: ev.origEvent,
1396
1361
  view: initialView,
1397
1362
  });
1398
1363
  if (validMutation) {
1399
1364
  // dropped within same calendar
1400
- if (receivingContext_1 === initialContext_1) {
1401
- var updatedEventApi = new EventApi(initialContext_1, mutatedRelevantEvents_1.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents_1.instances[eventInstance.instanceId] : null);
1402
- initialContext_1.dispatch({
1365
+ if (receivingContext === initialContext) {
1366
+ let updatedEventApi = new EventApi(initialContext, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null);
1367
+ initialContext.dispatch({
1403
1368
  type: 'MERGE_EVENTS',
1404
- eventStore: mutatedRelevantEvents_1,
1369
+ eventStore: mutatedRelevantEvents,
1405
1370
  });
1406
- var eventChangeArg = {
1371
+ let eventChangeArg = {
1407
1372
  oldEvent: eventApi,
1408
1373
  event: updatedEventApi,
1409
- relatedEvents: buildEventApis(mutatedRelevantEvents_1, initialContext_1, eventInstance),
1410
- revert: function () {
1411
- initialContext_1.dispatch({
1374
+ relatedEvents: buildEventApis(mutatedRelevantEvents, initialContext, eventInstance),
1375
+ revert() {
1376
+ initialContext.dispatch({
1412
1377
  type: 'MERGE_EVENTS',
1413
- eventStore: relevantEvents_1, // the pre-change data
1378
+ eventStore: relevantEvents, // the pre-change data
1414
1379
  });
1415
1380
  },
1416
1381
  };
1417
- var transformed = {};
1418
- for (var _i = 0, _b = initialContext_1.getCurrentData().pluginHooks.eventDropTransformers; _i < _b.length; _i++) {
1419
- var transformer = _b[_i];
1420
- __assign(transformed, transformer(validMutation, initialContext_1));
1382
+ let transformed = {};
1383
+ for (let transformer of initialContext.getCurrentData().pluginHooks.eventDropTransformers) {
1384
+ __assign(transformed, transformer(validMutation, initialContext));
1421
1385
  }
1422
- initialContext_1.emitter.trigger('eventDrop', __assign(__assign(__assign({}, eventChangeArg), transformed), { el: ev.subjectEl, delta: validMutation.datesDelta, jsEvent: ev.origEvent, view: initialView }));
1423
- initialContext_1.emitter.trigger('eventChange', eventChangeArg);
1386
+ initialContext.emitter.trigger('eventDrop', Object.assign(Object.assign(Object.assign({}, eventChangeArg), transformed), { el: ev.subjectEl, delta: validMutation.datesDelta, jsEvent: ev.origEvent, view: initialView }));
1387
+ initialContext.emitter.trigger('eventChange', eventChangeArg);
1424
1388
  // dropped in different calendar
1425
1389
  }
1426
- else if (receivingContext_1) {
1427
- var eventRemoveArg = {
1390
+ else if (receivingContext) {
1391
+ let eventRemoveArg = {
1428
1392
  event: eventApi,
1429
- relatedEvents: buildEventApis(relevantEvents_1, initialContext_1, eventInstance),
1430
- revert: function () {
1431
- initialContext_1.dispatch({
1393
+ relatedEvents: buildEventApis(relevantEvents, initialContext, eventInstance),
1394
+ revert() {
1395
+ initialContext.dispatch({
1432
1396
  type: 'MERGE_EVENTS',
1433
- eventStore: relevantEvents_1,
1397
+ eventStore: relevantEvents,
1434
1398
  });
1435
1399
  },
1436
1400
  };
1437
- initialContext_1.emitter.trigger('eventLeave', __assign(__assign({}, eventRemoveArg), { draggedEl: ev.subjectEl, view: initialView }));
1438
- initialContext_1.dispatch({
1401
+ initialContext.emitter.trigger('eventLeave', Object.assign(Object.assign({}, eventRemoveArg), { draggedEl: ev.subjectEl, view: initialView }));
1402
+ initialContext.dispatch({
1439
1403
  type: 'REMOVE_EVENTS',
1440
- eventStore: relevantEvents_1,
1404
+ eventStore: relevantEvents,
1441
1405
  });
1442
- initialContext_1.emitter.trigger('eventRemove', eventRemoveArg);
1443
- var addedEventDef = mutatedRelevantEvents_1.defs[eventDef.defId];
1444
- var addedEventInstance = mutatedRelevantEvents_1.instances[eventInstance.instanceId];
1445
- var addedEventApi = new EventApi(receivingContext_1, addedEventDef, addedEventInstance);
1446
- receivingContext_1.dispatch({
1406
+ initialContext.emitter.trigger('eventRemove', eventRemoveArg);
1407
+ let addedEventDef = mutatedRelevantEvents.defs[eventDef.defId];
1408
+ let addedEventInstance = mutatedRelevantEvents.instances[eventInstance.instanceId];
1409
+ let addedEventApi = new EventApi(receivingContext, addedEventDef, addedEventInstance);
1410
+ receivingContext.dispatch({
1447
1411
  type: 'MERGE_EVENTS',
1448
- eventStore: mutatedRelevantEvents_1,
1412
+ eventStore: mutatedRelevantEvents,
1449
1413
  });
1450
- var eventAddArg = {
1414
+ let eventAddArg = {
1451
1415
  event: addedEventApi,
1452
- relatedEvents: buildEventApis(mutatedRelevantEvents_1, receivingContext_1, addedEventInstance),
1453
- revert: function () {
1454
- receivingContext_1.dispatch({
1416
+ relatedEvents: buildEventApis(mutatedRelevantEvents, receivingContext, addedEventInstance),
1417
+ revert() {
1418
+ receivingContext.dispatch({
1455
1419
  type: 'REMOVE_EVENTS',
1456
- eventStore: mutatedRelevantEvents_1,
1420
+ eventStore: mutatedRelevantEvents,
1457
1421
  });
1458
1422
  },
1459
1423
  };
1460
- receivingContext_1.emitter.trigger('eventAdd', eventAddArg);
1424
+ receivingContext.emitter.trigger('eventAdd', eventAddArg);
1461
1425
  if (ev.isTouch) {
1462
- receivingContext_1.dispatch({
1426
+ receivingContext.dispatch({
1463
1427
  type: 'SELECT_EVENT',
1464
1428
  eventInstanceId: eventInstance.instanceId,
1465
1429
  });
1466
1430
  }
1467
- receivingContext_1.emitter.trigger('drop', __assign(__assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext_1)), { draggedEl: ev.subjectEl, jsEvent: ev.origEvent, view: finalHit.context.viewApi }));
1468
- receivingContext_1.emitter.trigger('eventReceive', __assign(__assign({}, eventAddArg), { draggedEl: ev.subjectEl, view: finalHit.context.viewApi }));
1431
+ receivingContext.emitter.trigger('drop', Object.assign(Object.assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext)), { draggedEl: ev.subjectEl, jsEvent: ev.origEvent, view: finalHit.context.viewApi }));
1432
+ receivingContext.emitter.trigger('eventReceive', Object.assign(Object.assign({}, eventAddArg), { draggedEl: ev.subjectEl, view: finalHit.context.viewApi }));
1469
1433
  }
1470
1434
  }
1471
1435
  else {
1472
- initialContext_1.emitter.trigger('_noEventDrop');
1436
+ initialContext.emitter.trigger('_noEventDrop');
1473
1437
  }
1474
1438
  }
1475
- _this.cleanup();
1439
+ this.cleanup();
1476
1440
  };
1477
- var component = _this.component;
1478
- var options = component.context.options;
1479
- var dragging = _this.dragging = new FeaturefulElementDragging(settings.el);
1441
+ let { component } = this;
1442
+ let { options } = component.context;
1443
+ let dragging = this.dragging = new FeaturefulElementDragging(settings.el);
1480
1444
  dragging.pointer.selector = EventDragging.SELECTOR;
1481
1445
  dragging.touchScrollAllowed = false;
1482
1446
  dragging.autoScroller.isEnabled = options.dragScroll;
1483
- var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsStore);
1447
+ let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsStore);
1484
1448
  hitDragging.useSubjectCenter = settings.useEventCenter;
1485
- hitDragging.emitter.on('pointerdown', _this.handlePointerDown);
1486
- hitDragging.emitter.on('dragstart', _this.handleDragStart);
1487
- hitDragging.emitter.on('hitupdate', _this.handleHitUpdate);
1488
- hitDragging.emitter.on('pointerup', _this.handlePointerUp);
1489
- hitDragging.emitter.on('dragend', _this.handleDragEnd);
1490
- return _this;
1491
- }
1492
- EventDragging.prototype.destroy = function () {
1449
+ hitDragging.emitter.on('pointerdown', this.handlePointerDown);
1450
+ hitDragging.emitter.on('dragstart', this.handleDragStart);
1451
+ hitDragging.emitter.on('hitupdate', this.handleHitUpdate);
1452
+ hitDragging.emitter.on('pointerup', this.handlePointerUp);
1453
+ hitDragging.emitter.on('dragend', this.handleDragEnd);
1454
+ }
1455
+ destroy() {
1493
1456
  this.dragging.destroy();
1494
- };
1457
+ }
1495
1458
  // render a drag state on the next receivingCalendar
1496
- EventDragging.prototype.displayDrag = function (nextContext, state) {
1497
- var initialContext = this.component.context;
1498
- var prevContext = this.receivingContext;
1459
+ displayDrag(nextContext, state) {
1460
+ let initialContext = this.component.context;
1461
+ let prevContext = this.receivingContext;
1499
1462
  // does the previous calendar need to be cleared?
1500
1463
  if (prevContext && prevContext !== nextContext) {
1501
1464
  // does the initial calendar need to be cleared?
@@ -1516,12 +1479,12 @@ var EventDragging = /** @class */ (function (_super) {
1516
1479
  }
1517
1480
  }
1518
1481
  if (nextContext) {
1519
- nextContext.dispatch({ type: 'SET_EVENT_DRAG', state: state });
1482
+ nextContext.dispatch({ type: 'SET_EVENT_DRAG', state });
1520
1483
  }
1521
- };
1522
- EventDragging.prototype.clearDrag = function () {
1523
- var initialCalendar = this.component.context;
1524
- var receivingContext = this.receivingContext;
1484
+ }
1485
+ clearDrag() {
1486
+ let initialCalendar = this.component.context;
1487
+ let { receivingContext } = this;
1525
1488
  if (receivingContext) {
1526
1489
  receivingContext.dispatch({ type: 'UNSET_EVENT_DRAG' });
1527
1490
  }
@@ -1529,8 +1492,8 @@ var EventDragging = /** @class */ (function (_super) {
1529
1492
  if (initialCalendar !== receivingContext) {
1530
1493
  initialCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' });
1531
1494
  }
1532
- };
1533
- EventDragging.prototype.cleanup = function () {
1495
+ }
1496
+ cleanup() {
1534
1497
  this.subjectSeg = null;
1535
1498
  this.isDragging = false;
1536
1499
  this.eventRange = null;
@@ -1538,18 +1501,17 @@ var EventDragging = /** @class */ (function (_super) {
1538
1501
  this.receivingContext = null;
1539
1502
  this.validMutation = null;
1540
1503
  this.mutatedRelevantEvents = null;
1541
- };
1542
- // TODO: test this in IE11
1543
- // QUESTION: why do we need it on the resizable???
1544
- EventDragging.SELECTOR = '.fc-event-draggable, .fc-event-resizable';
1545
- return EventDragging;
1546
- }(Interaction));
1504
+ }
1505
+ }
1506
+ // TODO: test this in IE11
1507
+ // QUESTION: why do we need it on the resizable???
1508
+ EventDragging.SELECTOR = '.fc-event-draggable, .fc-event-resizable';
1547
1509
  function computeEventMutation(hit0, hit1, massagers) {
1548
- var dateSpan0 = hit0.dateSpan;
1549
- var dateSpan1 = hit1.dateSpan;
1550
- var date0 = dateSpan0.range.start;
1551
- var date1 = dateSpan1.range.start;
1552
- var standardProps = {};
1510
+ let dateSpan0 = hit0.dateSpan;
1511
+ let dateSpan1 = hit1.dateSpan;
1512
+ let date0 = dateSpan0.range.start;
1513
+ let date1 = dateSpan1.range.start;
1514
+ let standardProps = {};
1553
1515
  if (dateSpan0.allDay !== dateSpan1.allDay) {
1554
1516
  standardProps.allDay = dateSpan1.allDay;
1555
1517
  standardProps.hasEnd = hit1.context.options.allDayMaintainDuration;
@@ -1559,59 +1521,57 @@ function computeEventMutation(hit0, hit1, massagers) {
1559
1521
  date0 = startOfDay(date0);
1560
1522
  }
1561
1523
  }
1562
- var delta = diffDates(date0, date1, hit0.context.dateEnv, hit0.componentId === hit1.componentId ?
1524
+ let delta = diffDates(date0, date1, hit0.context.dateEnv, hit0.componentId === hit1.componentId ?
1563
1525
  hit0.largeUnit :
1564
1526
  null);
1565
1527
  if (delta.milliseconds) { // has hours/minutes/seconds
1566
1528
  standardProps.allDay = false;
1567
1529
  }
1568
- var mutation = {
1530
+ let mutation = {
1569
1531
  datesDelta: delta,
1570
- standardProps: standardProps,
1532
+ standardProps,
1571
1533
  };
1572
- for (var _i = 0, massagers_1 = massagers; _i < massagers_1.length; _i++) {
1573
- var massager = massagers_1[_i];
1534
+ for (let massager of massagers) {
1574
1535
  massager(mutation, hit0, hit1);
1575
1536
  }
1576
1537
  return mutation;
1577
1538
  }
1578
1539
  function getComponentTouchDelay(component) {
1579
- var options = component.context.options;
1580
- var delay = options.eventLongPressDelay;
1540
+ let { options } = component.context;
1541
+ let delay = options.eventLongPressDelay;
1581
1542
  if (delay == null) {
1582
1543
  delay = options.longPressDelay;
1583
1544
  }
1584
1545
  return delay;
1585
1546
  }
1586
1547
 
1587
- var EventResizing = /** @class */ (function (_super) {
1588
- __extends(EventResizing, _super);
1589
- function EventResizing(settings) {
1590
- var _this = _super.call(this, settings) || this;
1548
+ class EventResizing extends Interaction {
1549
+ constructor(settings) {
1550
+ super(settings);
1591
1551
  // internal state
1592
- _this.draggingSegEl = null;
1593
- _this.draggingSeg = null; // TODO: rename to resizingSeg? subjectSeg?
1594
- _this.eventRange = null;
1595
- _this.relevantEvents = null;
1596
- _this.validMutation = null;
1597
- _this.mutatedRelevantEvents = null;
1598
- _this.handlePointerDown = function (ev) {
1599
- var component = _this.component;
1600
- var segEl = _this.querySegEl(ev);
1601
- var seg = getElSeg(segEl);
1602
- var eventRange = _this.eventRange = seg.eventRange;
1603
- _this.dragging.minDistance = component.context.options.eventDragMinDistance;
1552
+ this.draggingSegEl = null;
1553
+ this.draggingSeg = null; // TODO: rename to resizingSeg? subjectSeg?
1554
+ this.eventRange = null;
1555
+ this.relevantEvents = null;
1556
+ this.validMutation = null;
1557
+ this.mutatedRelevantEvents = null;
1558
+ this.handlePointerDown = (ev) => {
1559
+ let { component } = this;
1560
+ let segEl = this.querySegEl(ev);
1561
+ let seg = getElSeg(segEl);
1562
+ let eventRange = this.eventRange = seg.eventRange;
1563
+ this.dragging.minDistance = component.context.options.eventDragMinDistance;
1604
1564
  // if touch, need to be working with a selected event
1605
- _this.dragging.setIgnoreMove(!_this.component.isValidSegDownEl(ev.origEvent.target) ||
1606
- (ev.isTouch && _this.component.props.eventSelection !== eventRange.instance.instanceId));
1565
+ this.dragging.setIgnoreMove(!this.component.isValidSegDownEl(ev.origEvent.target) ||
1566
+ (ev.isTouch && this.component.props.eventSelection !== eventRange.instance.instanceId));
1607
1567
  };
1608
- _this.handleDragStart = function (ev) {
1609
- var context = _this.component.context;
1610
- var eventRange = _this.eventRange;
1611
- _this.relevantEvents = getRelevantEvents(context.getCurrentData().eventStore, _this.eventRange.instance.instanceId);
1612
- var segEl = _this.querySegEl(ev);
1613
- _this.draggingSegEl = segEl;
1614
- _this.draggingSeg = getElSeg(segEl);
1568
+ this.handleDragStart = (ev) => {
1569
+ let { context } = this.component;
1570
+ let eventRange = this.eventRange;
1571
+ this.relevantEvents = getRelevantEvents(context.getCurrentData().eventStore, this.eventRange.instance.instanceId);
1572
+ let segEl = this.querySegEl(ev);
1573
+ this.draggingSegEl = segEl;
1574
+ this.draggingSeg = getElSeg(segEl);
1615
1575
  context.calendarApi.unselect();
1616
1576
  context.emitter.trigger('eventResizeStart', {
1617
1577
  el: segEl,
@@ -1620,23 +1580,23 @@ var EventResizing = /** @class */ (function (_super) {
1620
1580
  view: context.viewApi,
1621
1581
  });
1622
1582
  };
1623
- _this.handleHitUpdate = function (hit, isFinal, ev) {
1624
- var context = _this.component.context;
1625
- var relevantEvents = _this.relevantEvents;
1626
- var initialHit = _this.hitDragging.initialHit;
1627
- var eventInstance = _this.eventRange.instance;
1628
- var mutation = null;
1629
- var mutatedRelevantEvents = null;
1630
- var isInvalid = false;
1631
- var interaction = {
1583
+ this.handleHitUpdate = (hit, isFinal, ev) => {
1584
+ let { context } = this.component;
1585
+ let relevantEvents = this.relevantEvents;
1586
+ let initialHit = this.hitDragging.initialHit;
1587
+ let eventInstance = this.eventRange.instance;
1588
+ let mutation = null;
1589
+ let mutatedRelevantEvents = null;
1590
+ let isInvalid = false;
1591
+ let interaction = {
1632
1592
  affectedEvents: relevantEvents,
1633
1593
  mutatedEvents: createEmptyEventStore(),
1634
1594
  isEvent: true,
1635
1595
  };
1636
1596
  if (hit) {
1637
- var disallowed = hit.componentId === initialHit.componentId
1638
- && _this.isHitComboAllowed
1639
- && !_this.isHitComboAllowed(initialHit, hit);
1597
+ let disallowed = hit.componentId === initialHit.componentId
1598
+ && this.isHitComboAllowed
1599
+ && !this.isHitComboAllowed(initialHit, hit);
1640
1600
  if (!disallowed) {
1641
1601
  mutation = computeMutation(initialHit, hit, ev.subjectEl.classList.contains('fc-event-resizer-start'), eventInstance.range);
1642
1602
  }
@@ -1670,77 +1630,75 @@ var EventResizing = /** @class */ (function (_super) {
1670
1630
  if (mutation && isHitsEqual(initialHit, hit)) {
1671
1631
  mutation = null;
1672
1632
  }
1673
- _this.validMutation = mutation;
1674
- _this.mutatedRelevantEvents = mutatedRelevantEvents;
1633
+ this.validMutation = mutation;
1634
+ this.mutatedRelevantEvents = mutatedRelevantEvents;
1675
1635
  }
1676
1636
  };
1677
- _this.handleDragEnd = function (ev) {
1678
- var context = _this.component.context;
1679
- var eventDef = _this.eventRange.def;
1680
- var eventInstance = _this.eventRange.instance;
1681
- var eventApi = new EventApi(context, eventDef, eventInstance);
1682
- var relevantEvents = _this.relevantEvents;
1683
- var mutatedRelevantEvents = _this.mutatedRelevantEvents;
1637
+ this.handleDragEnd = (ev) => {
1638
+ let { context } = this.component;
1639
+ let eventDef = this.eventRange.def;
1640
+ let eventInstance = this.eventRange.instance;
1641
+ let eventApi = new EventApi(context, eventDef, eventInstance);
1642
+ let relevantEvents = this.relevantEvents;
1643
+ let mutatedRelevantEvents = this.mutatedRelevantEvents;
1684
1644
  context.emitter.trigger('eventResizeStop', {
1685
- el: _this.draggingSegEl,
1645
+ el: this.draggingSegEl,
1686
1646
  event: eventApi,
1687
1647
  jsEvent: ev.origEvent,
1688
1648
  view: context.viewApi,
1689
1649
  });
1690
- if (_this.validMutation) {
1691
- var updatedEventApi = new EventApi(context, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null);
1650
+ if (this.validMutation) {
1651
+ let updatedEventApi = new EventApi(context, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null);
1692
1652
  context.dispatch({
1693
1653
  type: 'MERGE_EVENTS',
1694
1654
  eventStore: mutatedRelevantEvents,
1695
1655
  });
1696
- var eventChangeArg = {
1656
+ let eventChangeArg = {
1697
1657
  oldEvent: eventApi,
1698
1658
  event: updatedEventApi,
1699
1659
  relatedEvents: buildEventApis(mutatedRelevantEvents, context, eventInstance),
1700
- revert: function () {
1660
+ revert() {
1701
1661
  context.dispatch({
1702
1662
  type: 'MERGE_EVENTS',
1703
1663
  eventStore: relevantEvents, // the pre-change events
1704
1664
  });
1705
1665
  },
1706
1666
  };
1707
- context.emitter.trigger('eventResize', __assign(__assign({}, eventChangeArg), { el: _this.draggingSegEl, startDelta: _this.validMutation.startDelta || createDuration(0), endDelta: _this.validMutation.endDelta || createDuration(0), jsEvent: ev.origEvent, view: context.viewApi }));
1667
+ context.emitter.trigger('eventResize', Object.assign(Object.assign({}, eventChangeArg), { el: this.draggingSegEl, startDelta: this.validMutation.startDelta || createDuration(0), endDelta: this.validMutation.endDelta || createDuration(0), jsEvent: ev.origEvent, view: context.viewApi }));
1708
1668
  context.emitter.trigger('eventChange', eventChangeArg);
1709
1669
  }
1710
1670
  else {
1711
1671
  context.emitter.trigger('_noEventResize');
1712
1672
  }
1713
1673
  // reset all internal state
1714
- _this.draggingSeg = null;
1715
- _this.relevantEvents = null;
1716
- _this.validMutation = null;
1674
+ this.draggingSeg = null;
1675
+ this.relevantEvents = null;
1676
+ this.validMutation = null;
1717
1677
  // okay to keep eventInstance around. useful to set it in handlePointerDown
1718
1678
  };
1719
- var component = settings.component;
1720
- var dragging = _this.dragging = new FeaturefulElementDragging(settings.el);
1679
+ let { component } = settings;
1680
+ let dragging = this.dragging = new FeaturefulElementDragging(settings.el);
1721
1681
  dragging.pointer.selector = '.fc-event-resizer';
1722
1682
  dragging.touchScrollAllowed = false;
1723
1683
  dragging.autoScroller.isEnabled = component.context.options.dragScroll;
1724
- var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, interactionSettingsToStore(settings));
1725
- hitDragging.emitter.on('pointerdown', _this.handlePointerDown);
1726
- hitDragging.emitter.on('dragstart', _this.handleDragStart);
1727
- hitDragging.emitter.on('hitupdate', _this.handleHitUpdate);
1728
- hitDragging.emitter.on('dragend', _this.handleDragEnd);
1729
- return _this;
1730
- }
1731
- EventResizing.prototype.destroy = function () {
1684
+ let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings));
1685
+ hitDragging.emitter.on('pointerdown', this.handlePointerDown);
1686
+ hitDragging.emitter.on('dragstart', this.handleDragStart);
1687
+ hitDragging.emitter.on('hitupdate', this.handleHitUpdate);
1688
+ hitDragging.emitter.on('dragend', this.handleDragEnd);
1689
+ }
1690
+ destroy() {
1732
1691
  this.dragging.destroy();
1733
- };
1734
- EventResizing.prototype.querySegEl = function (ev) {
1692
+ }
1693
+ querySegEl(ev) {
1735
1694
  return elementClosest(ev.subjectEl, '.fc-event');
1736
- };
1737
- return EventResizing;
1738
- }(Interaction));
1695
+ }
1696
+ }
1739
1697
  function computeMutation(hit0, hit1, isFromStart, instanceRange) {
1740
- var dateEnv = hit0.context.dateEnv;
1741
- var date0 = hit0.dateSpan.range.start;
1742
- var date1 = hit1.dateSpan.range.start;
1743
- var delta = diffDates(date0, date1, dateEnv, hit0.largeUnit);
1698
+ let dateEnv = hit0.context.dateEnv;
1699
+ let date0 = hit0.dateSpan.range.start;
1700
+ let date1 = hit1.dateSpan.range.start;
1701
+ let delta = diffDates(date0, date1, dateEnv, hit0.largeUnit);
1744
1702
  if (isFromStart) {
1745
1703
  if (dateEnv.add(instanceRange.start, delta) < instanceRange.end) {
1746
1704
  return { startDelta: delta };
@@ -1752,47 +1710,46 @@ function computeMutation(hit0, hit1, isFromStart, instanceRange) {
1752
1710
  return null;
1753
1711
  }
1754
1712
 
1755
- var UnselectAuto = /** @class */ (function () {
1756
- function UnselectAuto(context) {
1757
- var _this = this;
1713
+ class UnselectAuto {
1714
+ constructor(context) {
1758
1715
  this.context = context;
1759
1716
  this.isRecentPointerDateSelect = false; // wish we could use a selector to detect date selection, but uses hit system
1760
1717
  this.matchesCancel = false;
1761
1718
  this.matchesEvent = false;
1762
- this.onSelect = function (selectInfo) {
1719
+ this.onSelect = (selectInfo) => {
1763
1720
  if (selectInfo.jsEvent) {
1764
- _this.isRecentPointerDateSelect = true;
1721
+ this.isRecentPointerDateSelect = true;
1765
1722
  }
1766
1723
  };
1767
- this.onDocumentPointerDown = function (pev) {
1768
- var unselectCancel = _this.context.options.unselectCancel;
1769
- var downEl = getEventTargetViaRoot(pev.origEvent);
1770
- _this.matchesCancel = !!elementClosest(downEl, unselectCancel);
1771
- _this.matchesEvent = !!elementClosest(downEl, EventDragging.SELECTOR); // interaction started on an event?
1724
+ this.onDocumentPointerDown = (pev) => {
1725
+ let unselectCancel = this.context.options.unselectCancel;
1726
+ let downEl = getEventTargetViaRoot(pev.origEvent);
1727
+ this.matchesCancel = !!elementClosest(downEl, unselectCancel);
1728
+ this.matchesEvent = !!elementClosest(downEl, EventDragging.SELECTOR); // interaction started on an event?
1772
1729
  };
1773
- this.onDocumentPointerUp = function (pev) {
1774
- var context = _this.context;
1775
- var documentPointer = _this.documentPointer;
1776
- var calendarState = context.getCurrentData();
1730
+ this.onDocumentPointerUp = (pev) => {
1731
+ let { context } = this;
1732
+ let { documentPointer } = this;
1733
+ let calendarState = context.getCurrentData();
1777
1734
  // touch-scrolling should never unfocus any type of selection
1778
1735
  if (!documentPointer.wasTouchScroll) {
1779
1736
  if (calendarState.dateSelection && // an existing date selection?
1780
- !_this.isRecentPointerDateSelect // a new pointer-initiated date selection since last onDocumentPointerUp?
1737
+ !this.isRecentPointerDateSelect // a new pointer-initiated date selection since last onDocumentPointerUp?
1781
1738
  ) {
1782
- var unselectAuto = context.options.unselectAuto;
1783
- if (unselectAuto && (!unselectAuto || !_this.matchesCancel)) {
1739
+ let unselectAuto = context.options.unselectAuto;
1740
+ if (unselectAuto && (!unselectAuto || !this.matchesCancel)) {
1784
1741
  context.calendarApi.unselect(pev);
1785
1742
  }
1786
1743
  }
1787
1744
  if (calendarState.eventSelection && // an existing event selected?
1788
- !_this.matchesEvent // interaction DIDN'T start on an event
1745
+ !this.matchesEvent // interaction DIDN'T start on an event
1789
1746
  ) {
1790
1747
  context.dispatch({ type: 'UNSELECT_EVENT' });
1791
1748
  }
1792
1749
  }
1793
- _this.isRecentPointerDateSelect = false;
1750
+ this.isRecentPointerDateSelect = false;
1794
1751
  };
1795
- var documentPointer = this.documentPointer = new PointerDragging(document);
1752
+ let documentPointer = this.documentPointer = new PointerDragging(document);
1796
1753
  documentPointer.shouldIgnoreMove = true;
1797
1754
  documentPointer.shouldWatchScroll = false;
1798
1755
  documentPointer.emitter.on('pointerdown', this.onDocumentPointerDown);
@@ -1802,17 +1759,16 @@ var UnselectAuto = /** @class */ (function () {
1802
1759
  */
1803
1760
  context.emitter.on('select', this.onSelect);
1804
1761
  }
1805
- UnselectAuto.prototype.destroy = function () {
1762
+ destroy() {
1806
1763
  this.context.emitter.off('select', this.onSelect);
1807
1764
  this.documentPointer.destroy();
1808
- };
1809
- return UnselectAuto;
1810
- }());
1765
+ }
1766
+ }
1811
1767
 
1812
- var OPTION_REFINERS = {
1768
+ const OPTION_REFINERS = {
1813
1769
  fixedMirrorParent: identity,
1814
1770
  };
1815
- var LISTENER_REFINERS = {
1771
+ const LISTENER_REFINERS = {
1816
1772
  dateClick: identity,
1817
1773
  eventDragStart: identity,
1818
1774
  eventDragStop: identity,
@@ -1830,30 +1786,29 @@ Given an already instantiated draggable object for one-or-more elements,
1830
1786
  Interprets any dragging as an attempt to drag an events that lives outside
1831
1787
  of a calendar onto a calendar.
1832
1788
  */
1833
- var ExternalElementDragging = /** @class */ (function () {
1834
- function ExternalElementDragging(dragging, suppliedDragMeta) {
1835
- var _this = this;
1789
+ class ExternalElementDragging {
1790
+ constructor(dragging, suppliedDragMeta) {
1836
1791
  this.receivingContext = null;
1837
1792
  this.droppableEvent = null; // will exist for all drags, even if create:false
1838
1793
  this.suppliedDragMeta = null;
1839
1794
  this.dragMeta = null;
1840
- this.handleDragStart = function (ev) {
1841
- _this.dragMeta = _this.buildDragMeta(ev.subjectEl);
1795
+ this.handleDragStart = (ev) => {
1796
+ this.dragMeta = this.buildDragMeta(ev.subjectEl);
1842
1797
  };
1843
- this.handleHitUpdate = function (hit, isFinal, ev) {
1844
- var dragging = _this.hitDragging.dragging;
1845
- var receivingContext = null;
1846
- var droppableEvent = null;
1847
- var isInvalid = false;
1848
- var interaction = {
1798
+ this.handleHitUpdate = (hit, isFinal, ev) => {
1799
+ let { dragging } = this.hitDragging;
1800
+ let receivingContext = null;
1801
+ let droppableEvent = null;
1802
+ let isInvalid = false;
1803
+ let interaction = {
1849
1804
  affectedEvents: createEmptyEventStore(),
1850
1805
  mutatedEvents: createEmptyEventStore(),
1851
- isEvent: _this.dragMeta.create,
1806
+ isEvent: this.dragMeta.create,
1852
1807
  };
1853
1808
  if (hit) {
1854
1809
  receivingContext = hit.context;
1855
- if (_this.canDropElOnCalendar(ev.subjectEl, receivingContext)) {
1856
- droppableEvent = computeEventForDateSpan(hit.dateSpan, _this.dragMeta, receivingContext);
1810
+ if (this.canDropElOnCalendar(ev.subjectEl, receivingContext)) {
1811
+ droppableEvent = computeEventForDateSpan(hit.dateSpan, this.dragMeta, receivingContext);
1857
1812
  interaction.mutatedEvents = eventTupleToStore(droppableEvent);
1858
1813
  isInvalid = !isInteractionValid(interaction, hit.dateProfile, receivingContext);
1859
1814
  if (isInvalid) {
@@ -1862,7 +1817,7 @@ var ExternalElementDragging = /** @class */ (function () {
1862
1817
  }
1863
1818
  }
1864
1819
  }
1865
- _this.displayDrag(receivingContext, interaction);
1820
+ this.displayDrag(receivingContext, interaction);
1866
1821
  // show mirror if no already-rendered mirror element OR if we are shutting down the mirror (?)
1867
1822
  // TODO: wish we could somehow wait for dispatch to guarantee render
1868
1823
  dragging.setMirrorIsVisible(isFinal || !droppableEvent || !document.querySelector('.fc-event-mirror'));
@@ -1874,23 +1829,23 @@ var ExternalElementDragging = /** @class */ (function () {
1874
1829
  }
1875
1830
  if (!isFinal) {
1876
1831
  dragging.setMirrorNeedsRevert(!droppableEvent);
1877
- _this.receivingContext = receivingContext;
1878
- _this.droppableEvent = droppableEvent;
1832
+ this.receivingContext = receivingContext;
1833
+ this.droppableEvent = droppableEvent;
1879
1834
  }
1880
1835
  };
1881
- this.handleDragEnd = function (pev) {
1882
- var _a = _this, receivingContext = _a.receivingContext, droppableEvent = _a.droppableEvent;
1883
- _this.clearDrag();
1836
+ this.handleDragEnd = (pev) => {
1837
+ let { receivingContext, droppableEvent } = this;
1838
+ this.clearDrag();
1884
1839
  if (receivingContext && droppableEvent) {
1885
- var finalHit = _this.hitDragging.finalHit;
1886
- var finalView = finalHit.context.viewApi;
1887
- var dragMeta = _this.dragMeta;
1888
- receivingContext.emitter.trigger('drop', __assign(__assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext)), { draggedEl: pev.subjectEl, jsEvent: pev.origEvent, view: finalView }));
1840
+ let finalHit = this.hitDragging.finalHit;
1841
+ let finalView = finalHit.context.viewApi;
1842
+ let dragMeta = this.dragMeta;
1843
+ receivingContext.emitter.trigger('drop', Object.assign(Object.assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext)), { draggedEl: pev.subjectEl, jsEvent: pev.origEvent, view: finalView }));
1889
1844
  if (dragMeta.create) {
1890
- var addingEvents_1 = eventTupleToStore(droppableEvent);
1845
+ let addingEvents = eventTupleToStore(droppableEvent);
1891
1846
  receivingContext.dispatch({
1892
1847
  type: 'MERGE_EVENTS',
1893
- eventStore: addingEvents_1,
1848
+ eventStore: addingEvents,
1894
1849
  });
1895
1850
  if (pev.isTouch) {
1896
1851
  receivingContext.dispatch({
@@ -1902,10 +1857,10 @@ var ExternalElementDragging = /** @class */ (function () {
1902
1857
  receivingContext.emitter.trigger('eventReceive', {
1903
1858
  event: new EventApi(receivingContext, droppableEvent.def, droppableEvent.instance),
1904
1859
  relatedEvents: [],
1905
- revert: function () {
1860
+ revert() {
1906
1861
  receivingContext.dispatch({
1907
1862
  type: 'REMOVE_EVENTS',
1908
- eventStore: addingEvents_1,
1863
+ eventStore: addingEvents,
1909
1864
  });
1910
1865
  },
1911
1866
  draggedEl: pev.subjectEl,
@@ -1913,17 +1868,17 @@ var ExternalElementDragging = /** @class */ (function () {
1913
1868
  });
1914
1869
  }
1915
1870
  }
1916
- _this.receivingContext = null;
1917
- _this.droppableEvent = null;
1871
+ this.receivingContext = null;
1872
+ this.droppableEvent = null;
1918
1873
  };
1919
- var hitDragging = this.hitDragging = new HitDragging(dragging, interactionSettingsStore);
1874
+ let hitDragging = this.hitDragging = new HitDragging(dragging, interactionSettingsStore);
1920
1875
  hitDragging.requireInitial = false; // will start outside of a component
1921
1876
  hitDragging.emitter.on('dragstart', this.handleDragStart);
1922
1877
  hitDragging.emitter.on('hitupdate', this.handleHitUpdate);
1923
1878
  hitDragging.emitter.on('dragend', this.handleDragEnd);
1924
1879
  this.suppliedDragMeta = suppliedDragMeta;
1925
1880
  }
1926
- ExternalElementDragging.prototype.buildDragMeta = function (subjectEl) {
1881
+ buildDragMeta(subjectEl) {
1927
1882
  if (typeof this.suppliedDragMeta === 'object') {
1928
1883
  return parseDragMeta(this.suppliedDragMeta);
1929
1884
  }
@@ -1931,23 +1886,23 @@ var ExternalElementDragging = /** @class */ (function () {
1931
1886
  return parseDragMeta(this.suppliedDragMeta(subjectEl));
1932
1887
  }
1933
1888
  return getDragMetaFromEl(subjectEl);
1934
- };
1935
- ExternalElementDragging.prototype.displayDrag = function (nextContext, state) {
1936
- var prevContext = this.receivingContext;
1889
+ }
1890
+ displayDrag(nextContext, state) {
1891
+ let prevContext = this.receivingContext;
1937
1892
  if (prevContext && prevContext !== nextContext) {
1938
1893
  prevContext.dispatch({ type: 'UNSET_EVENT_DRAG' });
1939
1894
  }
1940
1895
  if (nextContext) {
1941
- nextContext.dispatch({ type: 'SET_EVENT_DRAG', state: state });
1896
+ nextContext.dispatch({ type: 'SET_EVENT_DRAG', state });
1942
1897
  }
1943
- };
1944
- ExternalElementDragging.prototype.clearDrag = function () {
1898
+ }
1899
+ clearDrag() {
1945
1900
  if (this.receivingContext) {
1946
1901
  this.receivingContext.dispatch({ type: 'UNSET_EVENT_DRAG' });
1947
1902
  }
1948
- };
1949
- ExternalElementDragging.prototype.canDropElOnCalendar = function (el, receivingContext) {
1950
- var dropAccept = receivingContext.options.dropAccept;
1903
+ }
1904
+ canDropElOnCalendar(el, receivingContext) {
1905
+ let dropAccept = receivingContext.options.dropAccept;
1951
1906
  if (typeof dropAccept === 'function') {
1952
1907
  return dropAccept.call(receivingContext.calendarApi, el);
1953
1908
  }
@@ -1955,45 +1910,43 @@ var ExternalElementDragging = /** @class */ (function () {
1955
1910
  return Boolean(elementMatches(el, dropAccept));
1956
1911
  }
1957
1912
  return true;
1958
- };
1959
- return ExternalElementDragging;
1960
- }());
1913
+ }
1914
+ }
1961
1915
  // Utils for computing event store from the DragMeta
1962
1916
  // ----------------------------------------------------------------------------------------------------
1963
1917
  function computeEventForDateSpan(dateSpan, dragMeta, context) {
1964
- var defProps = __assign({}, dragMeta.leftoverProps);
1965
- for (var _i = 0, _a = context.pluginHooks.externalDefTransforms; _i < _a.length; _i++) {
1966
- var transform = _a[_i];
1918
+ let defProps = Object.assign({}, dragMeta.leftoverProps);
1919
+ for (let transform of context.pluginHooks.externalDefTransforms) {
1967
1920
  __assign(defProps, transform(dateSpan, dragMeta));
1968
1921
  }
1969
- var _b = refineEventDef(defProps, context), refined = _b.refined, extra = _b.extra;
1970
- var def = parseEventDef(refined, extra, dragMeta.sourceId, dateSpan.allDay, context.options.forceEventDuration || Boolean(dragMeta.duration), // hasEnd
1922
+ let { refined, extra } = refineEventDef(defProps, context);
1923
+ let def = parseEventDef(refined, extra, dragMeta.sourceId, dateSpan.allDay, context.options.forceEventDuration || Boolean(dragMeta.duration), // hasEnd
1971
1924
  context);
1972
- var start = dateSpan.range.start;
1925
+ let start = dateSpan.range.start;
1973
1926
  // only rely on time info if drop zone is all-day,
1974
1927
  // otherwise, we already know the time
1975
1928
  if (dateSpan.allDay && dragMeta.startTime) {
1976
1929
  start = context.dateEnv.add(start, dragMeta.startTime);
1977
1930
  }
1978
- var end = dragMeta.duration ?
1931
+ let end = dragMeta.duration ?
1979
1932
  context.dateEnv.add(start, dragMeta.duration) :
1980
1933
  getDefaultEventEnd(dateSpan.allDay, start, context);
1981
- var instance = createEventInstance(def.defId, { start: start, end: end });
1982
- return { def: def, instance: instance };
1934
+ let instance = createEventInstance(def.defId, { start, end });
1935
+ return { def, instance };
1983
1936
  }
1984
1937
  // Utils for extracting data from element
1985
1938
  // ----------------------------------------------------------------------------------------------------
1986
1939
  function getDragMetaFromEl(el) {
1987
- var str = getEmbeddedElData(el, 'event');
1988
- var obj = str ?
1940
+ let str = getEmbeddedElData(el, 'event');
1941
+ let obj = str ?
1989
1942
  JSON.parse(str) :
1990
1943
  { create: false }; // if no embedded data, assume no event creation
1991
1944
  return parseDragMeta(obj);
1992
1945
  }
1993
1946
  config.dataAttrPrefix = '';
1994
1947
  function getEmbeddedElData(el, name) {
1995
- var prefix = config.dataAttrPrefix;
1996
- var prefixedName = (prefix ? prefix + '-' : '') + name;
1948
+ let prefix = config.dataAttrPrefix;
1949
+ let prefixedName = (prefix ? prefix + '-' : '') + name;
1997
1950
  return el.getAttribute('data-' + prefixedName) || '';
1998
1951
  }
1999
1952
 
@@ -2002,13 +1955,11 @@ Makes an element (that is *external* to any calendar) draggable.
2002
1955
  Can pass in data that determines how an event will be created when dropped onto a calendar.
2003
1956
  Leverages FullCalendar's internal drag-n-drop functionality WITHOUT a third-party drag system.
2004
1957
  */
2005
- var ExternalDraggable = /** @class */ (function () {
2006
- function ExternalDraggable(el, settings) {
2007
- var _this = this;
2008
- if (settings === void 0) { settings = {}; }
2009
- this.handlePointerDown = function (ev) {
2010
- var dragging = _this.dragging;
2011
- var _a = _this.settings, minDistance = _a.minDistance, longPressDelay = _a.longPressDelay;
1958
+ class ExternalDraggable {
1959
+ constructor(el, settings = {}) {
1960
+ this.handlePointerDown = (ev) => {
1961
+ let { dragging } = this;
1962
+ let { minDistance, longPressDelay } = this.settings;
2012
1963
  dragging.minDistance =
2013
1964
  minDistance != null ?
2014
1965
  minDistance :
@@ -2018,15 +1969,15 @@ var ExternalDraggable = /** @class */ (function () {
2018
1969
  (longPressDelay != null ? longPressDelay : BASE_OPTION_DEFAULTS.longPressDelay) :
2019
1970
  0;
2020
1971
  };
2021
- this.handleDragStart = function (ev) {
1972
+ this.handleDragStart = (ev) => {
2022
1973
  if (ev.isTouch &&
2023
- _this.dragging.delay &&
1974
+ this.dragging.delay &&
2024
1975
  ev.subjectEl.classList.contains('fc-event')) {
2025
- _this.dragging.mirror.getMirrorEl().classList.add('fc-event-selected');
1976
+ this.dragging.mirror.getMirrorEl().classList.add('fc-event-selected');
2026
1977
  }
2027
1978
  };
2028
1979
  this.settings = settings;
2029
- var dragging = this.dragging = new FeaturefulElementDragging(el);
1980
+ let dragging = this.dragging = new FeaturefulElementDragging(el);
2030
1981
  dragging.touchScrollAllowed = false;
2031
1982
  if (settings.itemSelector != null) {
2032
1983
  dragging.pointer.selector = settings.itemSelector;
@@ -2038,11 +1989,10 @@ var ExternalDraggable = /** @class */ (function () {
2038
1989
  dragging.emitter.on('dragstart', this.handleDragStart);
2039
1990
  new ExternalElementDragging(dragging, settings.eventData); // eslint-disable-line no-new
2040
1991
  }
2041
- ExternalDraggable.prototype.destroy = function () {
1992
+ destroy() {
2042
1993
  this.dragging.destroy();
2043
- };
2044
- return ExternalDraggable;
2045
- }());
1994
+ }
1995
+ }
2046
1996
 
2047
1997
  /*
2048
1998
  Detects when a *THIRD-PARTY* drag-n-drop system interacts with elements.
@@ -2050,45 +2000,43 @@ The third-party system is responsible for drawing the visuals effects of the dra
2050
2000
  This class simply monitors for pointer movements and fires events.
2051
2001
  It also has the ability to hide the moving element (the "mirror") during the drag.
2052
2002
  */
2053
- var InferredElementDragging = /** @class */ (function (_super) {
2054
- __extends(InferredElementDragging, _super);
2055
- function InferredElementDragging(containerEl) {
2056
- var _this = _super.call(this, containerEl) || this;
2057
- _this.shouldIgnoreMove = false;
2058
- _this.mirrorSelector = '';
2059
- _this.currentMirrorEl = null;
2060
- _this.handlePointerDown = function (ev) {
2061
- _this.emitter.trigger('pointerdown', ev);
2062
- if (!_this.shouldIgnoreMove) {
2003
+ class InferredElementDragging extends ElementDragging {
2004
+ constructor(containerEl) {
2005
+ super(containerEl);
2006
+ this.shouldIgnoreMove = false;
2007
+ this.mirrorSelector = '';
2008
+ this.currentMirrorEl = null;
2009
+ this.handlePointerDown = (ev) => {
2010
+ this.emitter.trigger('pointerdown', ev);
2011
+ if (!this.shouldIgnoreMove) {
2063
2012
  // fire dragstart right away. does not support delay or min-distance
2064
- _this.emitter.trigger('dragstart', ev);
2013
+ this.emitter.trigger('dragstart', ev);
2065
2014
  }
2066
2015
  };
2067
- _this.handlePointerMove = function (ev) {
2068
- if (!_this.shouldIgnoreMove) {
2069
- _this.emitter.trigger('dragmove', ev);
2016
+ this.handlePointerMove = (ev) => {
2017
+ if (!this.shouldIgnoreMove) {
2018
+ this.emitter.trigger('dragmove', ev);
2070
2019
  }
2071
2020
  };
2072
- _this.handlePointerUp = function (ev) {
2073
- _this.emitter.trigger('pointerup', ev);
2074
- if (!_this.shouldIgnoreMove) {
2021
+ this.handlePointerUp = (ev) => {
2022
+ this.emitter.trigger('pointerup', ev);
2023
+ if (!this.shouldIgnoreMove) {
2075
2024
  // fire dragend right away. does not support a revert animation
2076
- _this.emitter.trigger('dragend', ev);
2025
+ this.emitter.trigger('dragend', ev);
2077
2026
  }
2078
2027
  };
2079
- var pointer = _this.pointer = new PointerDragging(containerEl);
2080
- pointer.emitter.on('pointerdown', _this.handlePointerDown);
2081
- pointer.emitter.on('pointermove', _this.handlePointerMove);
2082
- pointer.emitter.on('pointerup', _this.handlePointerUp);
2083
- return _this;
2028
+ let pointer = this.pointer = new PointerDragging(containerEl);
2029
+ pointer.emitter.on('pointerdown', this.handlePointerDown);
2030
+ pointer.emitter.on('pointermove', this.handlePointerMove);
2031
+ pointer.emitter.on('pointerup', this.handlePointerUp);
2084
2032
  }
2085
- InferredElementDragging.prototype.destroy = function () {
2033
+ destroy() {
2086
2034
  this.pointer.destroy();
2087
- };
2088
- InferredElementDragging.prototype.setIgnoreMove = function (bool) {
2035
+ }
2036
+ setIgnoreMove(bool) {
2089
2037
  this.shouldIgnoreMove = bool;
2090
- };
2091
- InferredElementDragging.prototype.setMirrorIsVisible = function (bool) {
2038
+ }
2039
+ setMirrorIsVisible(bool) {
2092
2040
  if (bool) {
2093
2041
  // restore a previously hidden element.
2094
2042
  // use the reference in case the selector class has already been removed.
@@ -2098,7 +2046,7 @@ var InferredElementDragging = /** @class */ (function (_super) {
2098
2046
  }
2099
2047
  }
2100
2048
  else {
2101
- var mirrorEl = this.mirrorSelector
2049
+ let mirrorEl = this.mirrorSelector
2102
2050
  // TODO: somehow query FullCalendars WITHIN shadow-roots
2103
2051
  ? document.querySelector(this.mirrorSelector)
2104
2052
  : null;
@@ -2107,17 +2055,16 @@ var InferredElementDragging = /** @class */ (function (_super) {
2107
2055
  mirrorEl.style.visibility = 'hidden';
2108
2056
  }
2109
2057
  }
2110
- };
2111
- return InferredElementDragging;
2112
- }(ElementDragging));
2058
+ }
2059
+ }
2113
2060
 
2114
2061
  /*
2115
2062
  Bridges third-party drag-n-drop systems with FullCalendar.
2116
2063
  Must be instantiated and destroyed by caller.
2117
2064
  */
2118
- var ThirdPartyDraggable = /** @class */ (function () {
2119
- function ThirdPartyDraggable(containerOrSettings, settings) {
2120
- var containerEl = document;
2065
+ class ThirdPartyDraggable {
2066
+ constructor(containerOrSettings, settings) {
2067
+ let containerEl = document;
2121
2068
  if (
2122
2069
  // wish we could just test instanceof EventTarget, but doesn't work in IE11
2123
2070
  containerOrSettings === document ||
@@ -2128,7 +2075,7 @@ var ThirdPartyDraggable = /** @class */ (function () {
2128
2075
  else {
2129
2076
  settings = (containerOrSettings || {});
2130
2077
  }
2131
- var dragging = this.dragging = new InferredElementDragging(containerEl);
2078
+ let dragging = this.dragging = new InferredElementDragging(containerEl);
2132
2079
  if (typeof settings.itemSelector === 'string') {
2133
2080
  dragging.pointer.selector = settings.itemSelector;
2134
2081
  }
@@ -2140,11 +2087,10 @@ var ThirdPartyDraggable = /** @class */ (function () {
2140
2087
  }
2141
2088
  new ExternalElementDragging(dragging, settings.eventData); // eslint-disable-line no-new
2142
2089
  }
2143
- ThirdPartyDraggable.prototype.destroy = function () {
2090
+ destroy() {
2144
2091
  this.dragging.destroy();
2145
- };
2146
- return ThirdPartyDraggable;
2147
- }());
2092
+ }
2093
+ }
2148
2094
 
2149
2095
  var main = createPlugin({
2150
2096
  componentInteractions: [DateClicking, DateSelecting, EventDragging, EventResizing],