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