@fullcalendar/interaction 5.11.2 → 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,5 +1,5 @@
1
1
  /*!
2
- FullCalendar v5.11.2
2
+ FullCalendar v6.0.0-beta.1
3
3
  Docs & License: https://fullcalendar.io/
4
4
  (c) 2022 Adam Shaw
5
5
  */
@@ -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,64 +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
- var scrollCaches = this.scrollCaches || [];
647
- for (var _i = 0, scrollCaches_1 = scrollCaches; _i < scrollCaches_1.length; _i++) {
648
- var scrollCache = scrollCaches_1[_i];
649
- var rect = scrollCache.clientRect;
650
- var leftDist = left - rect.left;
651
- var rightDist = rect.right - left;
652
- var topDist = top - rect.top;
653
- 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;
654
640
  // completely within the rect?
655
641
  if (leftDist >= 0 && rightDist >= 0 && topDist >= 0 && bottomDist >= 0) {
656
642
  if (topDist <= edgeThreshold && this.everMovedUp && scrollCache.canScrollUp() &&
657
643
  (!bestSide || bestSide.distance > topDist)) {
658
- bestSide = { scrollCache: scrollCache, name: 'top', distance: topDist };
644
+ bestSide = { scrollCache, name: 'top', distance: topDist };
659
645
  }
660
646
  if (bottomDist <= edgeThreshold && this.everMovedDown && scrollCache.canScrollDown() &&
661
647
  (!bestSide || bestSide.distance > bottomDist)) {
662
- bestSide = { scrollCache: scrollCache, name: 'bottom', distance: bottomDist };
648
+ bestSide = { scrollCache, name: 'bottom', distance: bottomDist };
663
649
  }
664
650
  if (leftDist <= edgeThreshold && this.everMovedLeft && scrollCache.canScrollLeft() &&
665
651
  (!bestSide || bestSide.distance > leftDist)) {
666
- bestSide = { scrollCache: scrollCache, name: 'left', distance: leftDist };
652
+ bestSide = { scrollCache, name: 'left', distance: leftDist };
667
653
  }
668
654
  if (rightDist <= edgeThreshold && this.everMovedRight && scrollCache.canScrollRight() &&
669
655
  (!bestSide || bestSide.distance > rightDist)) {
670
- bestSide = { scrollCache: scrollCache, name: 'right', distance: rightDist };
656
+ bestSide = { scrollCache, name: 'right', distance: rightDist };
671
657
  }
672
658
  }
673
659
  }
674
660
  return bestSide;
675
- };
676
- AutoScroller.prototype.buildCaches = function (scrollStartEl) {
677
- return this.queryScrollEls(scrollStartEl).map(function (el) {
661
+ }
662
+ buildCaches(scrollStartEl) {
663
+ return this.queryScrollEls(scrollStartEl).map((el) => {
678
664
  if (el === window) {
679
665
  return new WindowScrollGeomCache(false); // false = don't listen to user-generated scrolls
680
666
  }
681
667
  return new ElementScrollGeomCache(el, false); // false = don't listen to user-generated scrolls
682
668
  });
683
- };
684
- AutoScroller.prototype.queryScrollEls = function (scrollStartEl) {
685
- var els = [];
686
- for (var _i = 0, _a = this.scrollQuery; _i < _a.length; _i++) {
687
- var query = _a[_i];
669
+ }
670
+ queryScrollEls(scrollStartEl) {
671
+ let els = [];
672
+ for (let query of this.scrollQuery) {
688
673
  if (typeof query === 'object') {
689
674
  els.push(query);
690
675
  }
691
676
  else {
692
- 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)));
693
678
  }
694
679
  }
695
680
  return els;
696
- };
697
- return AutoScroller;
698
- }());
681
+ }
682
+ }
699
683
 
700
684
  /*
701
685
  Monitors dragging on an element. Has a number of high-level features:
@@ -703,27 +687,26 @@ Monitors dragging on an element. Has a number of high-level features:
703
687
  - minimum wait time ("delay") before dragging
704
688
  - a mirror element that follows the pointer
705
689
  */
706
- var FeaturefulElementDragging = /** @class */ (function (_super) {
707
- tslib.__extends(FeaturefulElementDragging, _super);
708
- function FeaturefulElementDragging(containerEl, selector) {
709
- var _this = _super.call(this, containerEl) || this;
710
- _this.containerEl = containerEl;
690
+ class FeaturefulElementDragging extends common.ElementDragging {
691
+ constructor(containerEl, selector) {
692
+ super(containerEl);
693
+ this.containerEl = containerEl;
711
694
  // options that can be directly set by caller
712
695
  // the caller can also set the PointerDragging's options as well
713
- _this.delay = null;
714
- _this.minDistance = 0;
715
- _this.touchScrollAllowed = true; // prevents drag from starting and blocks scrolling during drag
716
- _this.mirrorNeedsRevert = false;
717
- _this.isInteracting = false; // is the user validly moving the pointer? lasts until pointerup
718
- _this.isDragging = false; // is it INTENTFULLY dragging? lasts until after revert animation
719
- _this.isDelayEnded = false;
720
- _this.isDistanceSurpassed = false;
721
- _this.delayTimeoutId = null;
722
- _this.onPointerDown = function (ev) {
723
- if (!_this.isDragging) { // so new drag doesn't happen while revert animation is going
724
- _this.isInteracting = true;
725
- _this.isDelayEnded = false;
726
- _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;
727
710
  common.preventSelection(document.body);
728
711
  common.preventContextMenu(document.body);
729
712
  // prevent links from being visited if there's an eventual drag.
@@ -732,95 +715,93 @@ var FeaturefulElementDragging = /** @class */ (function (_super) {
732
715
  if (!ev.isTouch) {
733
716
  ev.origEvent.preventDefault();
734
717
  }
735
- _this.emitter.trigger('pointerdown', ev);
736
- if (_this.isInteracting && // not destroyed via pointerdown handler
737
- !_this.pointer.shouldIgnoreMove) {
718
+ this.emitter.trigger('pointerdown', ev);
719
+ if (this.isInteracting && // not destroyed via pointerdown handler
720
+ !this.pointer.shouldIgnoreMove) {
738
721
  // actions related to initiating dragstart+dragmove+dragend...
739
- _this.mirror.setIsVisible(false); // reset. caller must set-visible
740
- _this.mirror.start(ev.subjectEl, ev.pageX, ev.pageY); // must happen on first pointer down
741
- _this.startDelay(ev);
742
- if (!_this.minDistance) {
743
- _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);
744
727
  }
745
728
  }
746
729
  }
747
730
  };
748
- _this.onPointerMove = function (ev) {
749
- if (_this.isInteracting) {
750
- _this.emitter.trigger('pointermove', ev);
751
- if (!_this.isDistanceSurpassed) {
752
- var minDistance = _this.minDistance;
753
- var distanceSq = void 0; // current distance from the origin, squared
754
- 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;
755
738
  distanceSq = deltaX * deltaX + deltaY * deltaY;
756
739
  if (distanceSq >= minDistance * minDistance) { // use pythagorean theorem
757
- _this.handleDistanceSurpassed(ev);
740
+ this.handleDistanceSurpassed(ev);
758
741
  }
759
742
  }
760
- if (_this.isDragging) {
743
+ if (this.isDragging) {
761
744
  // a real pointer move? (not one simulated by scrolling)
762
745
  if (ev.origEvent.type !== 'scroll') {
763
- _this.mirror.handleMove(ev.pageX, ev.pageY);
764
- _this.autoScroller.handleMove(ev.pageX, ev.pageY);
746
+ this.mirror.handleMove(ev.pageX, ev.pageY);
747
+ this.autoScroller.handleMove(ev.pageX, ev.pageY);
765
748
  }
766
- _this.emitter.trigger('dragmove', ev);
749
+ this.emitter.trigger('dragmove', ev);
767
750
  }
768
751
  }
769
752
  };
770
- _this.onPointerUp = function (ev) {
771
- if (_this.isInteracting) {
772
- _this.isInteracting = false;
753
+ this.onPointerUp = (ev) => {
754
+ if (this.isInteracting) {
755
+ this.isInteracting = false;
773
756
  common.allowSelection(document.body);
774
757
  common.allowContextMenu(document.body);
775
- _this.emitter.trigger('pointerup', ev); // can potentially set mirrorNeedsRevert
776
- if (_this.isDragging) {
777
- _this.autoScroller.stop();
778
- _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
779
762
  }
780
- if (_this.delayTimeoutId) {
781
- clearTimeout(_this.delayTimeoutId);
782
- _this.delayTimeoutId = null;
763
+ if (this.delayTimeoutId) {
764
+ clearTimeout(this.delayTimeoutId);
765
+ this.delayTimeoutId = null;
783
766
  }
784
767
  }
785
768
  };
786
- var pointer = _this.pointer = new PointerDragging(containerEl);
787
- pointer.emitter.on('pointerdown', _this.onPointerDown);
788
- pointer.emitter.on('pointermove', _this.onPointerMove);
789
- 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);
790
773
  if (selector) {
791
774
  pointer.selector = selector;
792
775
  }
793
- _this.mirror = new ElementMirror();
794
- _this.autoScroller = new AutoScroller();
795
- return _this;
776
+ this.mirror = new ElementMirror();
777
+ this.autoScroller = new AutoScroller();
796
778
  }
797
- FeaturefulElementDragging.prototype.destroy = function () {
779
+ destroy() {
798
780
  this.pointer.destroy();
799
781
  // HACK: simulate a pointer-up to end the current drag
800
782
  // TODO: fire 'dragend' directly and stop interaction. discourage use of pointerup event (b/c might not fire)
801
783
  this.onPointerUp({});
802
- };
803
- FeaturefulElementDragging.prototype.startDelay = function (ev) {
804
- var _this = this;
784
+ }
785
+ startDelay(ev) {
805
786
  if (typeof this.delay === 'number') {
806
- this.delayTimeoutId = setTimeout(function () {
807
- _this.delayTimeoutId = null;
808
- _this.handleDelayEnd(ev);
787
+ this.delayTimeoutId = setTimeout(() => {
788
+ this.delayTimeoutId = null;
789
+ this.handleDelayEnd(ev);
809
790
  }, this.delay); // not assignable to number!
810
791
  }
811
792
  else {
812
793
  this.handleDelayEnd(ev);
813
794
  }
814
- };
815
- FeaturefulElementDragging.prototype.handleDelayEnd = function (ev) {
795
+ }
796
+ handleDelayEnd(ev) {
816
797
  this.isDelayEnded = true;
817
798
  this.tryStartDrag(ev);
818
- };
819
- FeaturefulElementDragging.prototype.handleDistanceSurpassed = function (ev) {
799
+ }
800
+ handleDistanceSurpassed(ev) {
820
801
  this.isDistanceSurpassed = true;
821
802
  this.tryStartDrag(ev);
822
- };
823
- FeaturefulElementDragging.prototype.tryStartDrag = function (ev) {
803
+ }
804
+ tryStartDrag(ev) {
824
805
  if (this.isDelayEnded && this.isDistanceSurpassed) {
825
806
  if (!this.pointer.wasTouchScroll || this.touchScrollAllowed) {
826
807
  this.isDragging = true;
@@ -832,31 +813,30 @@ var FeaturefulElementDragging = /** @class */ (function (_super) {
832
813
  }
833
814
  }
834
815
  }
835
- };
836
- FeaturefulElementDragging.prototype.tryStopDrag = function (ev) {
816
+ }
817
+ tryStopDrag(ev) {
837
818
  // .stop() is ALWAYS asynchronous, which we NEED because we want all pointerup events
838
819
  // that come from the document to fire beforehand. much more convenient this way.
839
820
  this.mirror.stop(this.mirrorNeedsRevert, this.stopDrag.bind(this, ev));
840
- };
841
- FeaturefulElementDragging.prototype.stopDrag = function (ev) {
821
+ }
822
+ stopDrag(ev) {
842
823
  this.isDragging = false;
843
824
  this.emitter.trigger('dragend', ev);
844
- };
825
+ }
845
826
  // fill in the implementations...
846
- FeaturefulElementDragging.prototype.setIgnoreMove = function (bool) {
827
+ setIgnoreMove(bool) {
847
828
  this.pointer.shouldIgnoreMove = bool;
848
- };
849
- FeaturefulElementDragging.prototype.setMirrorIsVisible = function (bool) {
829
+ }
830
+ setMirrorIsVisible(bool) {
850
831
  this.mirror.setIsVisible(bool);
851
- };
852
- FeaturefulElementDragging.prototype.setMirrorNeedsRevert = function (bool) {
832
+ }
833
+ setMirrorNeedsRevert(bool) {
853
834
  this.mirrorNeedsRevert = bool;
854
- };
855
- FeaturefulElementDragging.prototype.setAutoScrollEnabled = function (bool) {
835
+ }
836
+ setAutoScrollEnabled(bool) {
856
837
  this.autoScroller.isEnabled = bool;
857
- };
858
- return FeaturefulElementDragging;
859
- }(common.ElementDragging));
838
+ }
839
+ }
860
840
 
861
841
  /*
862
842
  When this class is instantiated, it records the offset of an element (relative to the document topleft),
@@ -866,51 +846,46 @@ Does not access the DOM after instantiation, so highly performant.
866
846
  Also keeps track of all scrolling/overflow:hidden containers that are parents of the given element
867
847
  and an determine if a given point is inside the combined clipping rectangle.
868
848
  */
869
- var OffsetTracker = /** @class */ (function () {
870
- function OffsetTracker(el) {
849
+ class OffsetTracker {
850
+ constructor(el) {
871
851
  this.origRect = common.computeRect(el);
872
852
  // will work fine for divs that have overflow:hidden
873
- 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));
874
854
  }
875
- OffsetTracker.prototype.destroy = function () {
876
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
877
- var scrollCache = _a[_i];
855
+ destroy() {
856
+ for (let scrollCache of this.scrollCaches) {
878
857
  scrollCache.destroy();
879
858
  }
880
- };
881
- OffsetTracker.prototype.computeLeft = function () {
882
- var left = this.origRect.left;
883
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
884
- var scrollCache = _a[_i];
859
+ }
860
+ computeLeft() {
861
+ let left = this.origRect.left;
862
+ for (let scrollCache of this.scrollCaches) {
885
863
  left += scrollCache.origScrollLeft - scrollCache.getScrollLeft();
886
864
  }
887
865
  return left;
888
- };
889
- OffsetTracker.prototype.computeTop = function () {
890
- var top = this.origRect.top;
891
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
892
- var scrollCache = _a[_i];
866
+ }
867
+ computeTop() {
868
+ let top = this.origRect.top;
869
+ for (let scrollCache of this.scrollCaches) {
893
870
  top += scrollCache.origScrollTop - scrollCache.getScrollTop();
894
871
  }
895
872
  return top;
896
- };
897
- OffsetTracker.prototype.isWithinClipping = function (pageX, pageY) {
898
- var point = { left: pageX, top: pageY };
899
- for (var _i = 0, _a = this.scrollCaches; _i < _a.length; _i++) {
900
- var scrollCache = _a[_i];
873
+ }
874
+ isWithinClipping(pageX, pageY) {
875
+ let point = { left: pageX, top: pageY };
876
+ for (let scrollCache of this.scrollCaches) {
901
877
  if (!isIgnoredClipping(scrollCache.getEventTarget()) &&
902
878
  !common.pointInsideRect(point, scrollCache.clientRect)) {
903
879
  return false;
904
880
  }
905
881
  }
906
882
  return true;
907
- };
908
- return OffsetTracker;
909
- }());
883
+ }
884
+ }
910
885
  // certain clipping containers should never constrain interactions, like <html> and <body>
911
886
  // https://github.com/fullcalendar/fullcalendar/issues/3615
912
887
  function isIgnoredClipping(node) {
913
- var tagName = node.tagName;
888
+ let tagName = node.tagName;
914
889
  return tagName === 'HTML' || tagName === 'BODY';
915
890
  }
916
891
 
@@ -927,50 +902,49 @@ emits:
927
902
  - (hitchange - again, to null, if ended over a hit)
928
903
  - dragend
929
904
  */
930
- var HitDragging = /** @class */ (function () {
931
- function HitDragging(dragging, droppableStore) {
932
- var _this = this;
905
+ class HitDragging {
906
+ constructor(dragging, droppableStore) {
933
907
  // options that can be set by caller
934
908
  this.useSubjectCenter = false;
935
909
  this.requireInitial = true; // if doesn't start out on a hit, won't emit any events
936
910
  this.initialHit = null;
937
911
  this.movingHit = null;
938
912
  this.finalHit = null; // won't ever be populated if shouldIgnoreMove
939
- this.handlePointerDown = function (ev) {
940
- var dragging = _this.dragging;
941
- _this.initialHit = null;
942
- _this.movingHit = null;
943
- _this.finalHit = null;
944
- _this.prepareHits();
945
- _this.processFirstCoord(ev);
946
- 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) {
947
921
  dragging.setIgnoreMove(false);
948
922
  // TODO: fire this before computing processFirstCoord, so listeners can cancel. this gets fired by almost every handler :(
949
- _this.emitter.trigger('pointerdown', ev);
923
+ this.emitter.trigger('pointerdown', ev);
950
924
  }
951
925
  else {
952
926
  dragging.setIgnoreMove(true);
953
927
  }
954
928
  };
955
- this.handleDragStart = function (ev) {
956
- _this.emitter.trigger('dragstart', ev);
957
- _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
958
932
  };
959
- this.handleDragMove = function (ev) {
960
- _this.emitter.trigger('dragmove', ev);
961
- _this.handleMove(ev);
933
+ this.handleDragMove = (ev) => {
934
+ this.emitter.trigger('dragmove', ev);
935
+ this.handleMove(ev);
962
936
  };
963
- this.handlePointerUp = function (ev) {
964
- _this.releaseHits();
965
- _this.emitter.trigger('pointerup', ev);
937
+ this.handlePointerUp = (ev) => {
938
+ this.releaseHits();
939
+ this.emitter.trigger('pointerup', ev);
966
940
  };
967
- this.handleDragEnd = function (ev) {
968
- if (_this.movingHit) {
969
- _this.emitter.trigger('hitupdate', null, true, ev);
941
+ this.handleDragEnd = (ev) => {
942
+ if (this.movingHit) {
943
+ this.emitter.trigger('hitupdate', null, true, ev);
970
944
  }
971
- _this.finalHit = _this.movingHit;
972
- _this.movingHit = null;
973
- _this.emitter.trigger('dragend', ev);
945
+ this.finalHit = this.movingHit;
946
+ this.movingHit = null;
947
+ this.emitter.trigger('dragend', ev);
974
948
  };
975
949
  this.droppableStore = droppableStore;
976
950
  dragging.emitter.on('pointerdown', this.handlePointerDown);
@@ -983,19 +957,19 @@ var HitDragging = /** @class */ (function () {
983
957
  }
984
958
  // sets initialHit
985
959
  // sets coordAdjust
986
- HitDragging.prototype.processFirstCoord = function (ev) {
987
- var origPoint = { left: ev.pageX, top: ev.pageY };
988
- var adjustedPoint = origPoint;
989
- var subjectEl = ev.subjectEl;
990
- 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;
991
965
  if (subjectEl instanceof HTMLElement) { // i.e. not a Document/ShadowRoot
992
966
  subjectRect = common.computeRect(subjectEl);
993
967
  adjustedPoint = common.constrainPoint(adjustedPoint, subjectRect);
994
968
  }
995
- var initialHit = this.initialHit = this.queryHitForOffset(adjustedPoint.left, adjustedPoint.top);
969
+ let initialHit = this.initialHit = this.queryHitForOffset(adjustedPoint.left, adjustedPoint.top);
996
970
  if (initialHit) {
997
971
  if (this.useSubjectCenter && subjectRect) {
998
- var slicedSubjectRect = common.intersectRects(subjectRect, initialHit.rect);
972
+ let slicedSubjectRect = common.intersectRects(subjectRect, initialHit.rect);
999
973
  if (slicedSubjectRect) {
1000
974
  adjustedPoint = common.getRectCenter(slicedSubjectRect);
1001
975
  }
@@ -1005,47 +979,47 @@ var HitDragging = /** @class */ (function () {
1005
979
  else {
1006
980
  this.coordAdjust = { left: 0, top: 0 };
1007
981
  }
1008
- };
1009
- HitDragging.prototype.handleMove = function (ev, forceHandle) {
1010
- 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);
1011
985
  if (forceHandle || !isHitsEqual(this.movingHit, hit)) {
1012
986
  this.movingHit = hit;
1013
987
  this.emitter.trigger('hitupdate', hit, false, ev);
1014
988
  }
1015
- };
1016
- HitDragging.prototype.prepareHits = function () {
1017
- this.offsetTrackers = common.mapHash(this.droppableStore, function (interactionSettings) {
989
+ }
990
+ prepareHits() {
991
+ this.offsetTrackers = common.mapHash(this.droppableStore, (interactionSettings) => {
1018
992
  interactionSettings.component.prepareHits();
1019
993
  return new OffsetTracker(interactionSettings.el);
1020
994
  });
1021
- };
1022
- HitDragging.prototype.releaseHits = function () {
1023
- var offsetTrackers = this.offsetTrackers;
1024
- for (var id in offsetTrackers) {
995
+ }
996
+ releaseHits() {
997
+ let { offsetTrackers } = this;
998
+ for (let id in offsetTrackers) {
1025
999
  offsetTrackers[id].destroy();
1026
1000
  }
1027
1001
  this.offsetTrackers = {};
1028
- };
1029
- HitDragging.prototype.queryHitForOffset = function (offsetLeft, offsetTop) {
1030
- var _a = this, droppableStore = _a.droppableStore, offsetTrackers = _a.offsetTrackers;
1031
- var bestHit = null;
1032
- for (var id in droppableStore) {
1033
- var component = droppableStore[id].component;
1034
- 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];
1035
1009
  if (offsetTracker && // wasn't destroyed mid-drag
1036
1010
  offsetTracker.isWithinClipping(offsetLeft, offsetTop)) {
1037
- var originLeft = offsetTracker.computeLeft();
1038
- var originTop = offsetTracker.computeTop();
1039
- var positionLeft = offsetLeft - originLeft;
1040
- var positionTop = offsetTop - originTop;
1041
- var origRect = offsetTracker.origRect;
1042
- var width = origRect.right - origRect.left;
1043
- 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;
1044
1018
  if (
1045
1019
  // must be within the element's bounds
1046
1020
  positionLeft >= 0 && positionLeft < width &&
1047
1021
  positionTop >= 0 && positionTop < height) {
1048
- var hit = component.queryHit(positionLeft, positionTop, width, height);
1022
+ let hit = component.queryHit(positionLeft, positionTop, width, height);
1049
1023
  if (hit && (
1050
1024
  // make sure the hit is within activeRange, meaning it's not a dead cell
1051
1025
  common.rangeContainsRange(hit.dateProfile.activeRange, hit.dateSpan.range)) &&
@@ -1063,9 +1037,8 @@ var HitDragging = /** @class */ (function () {
1063
1037
  }
1064
1038
  }
1065
1039
  return bestHit;
1066
- };
1067
- return HitDragging;
1068
- }());
1040
+ }
1041
+ }
1069
1042
  function isHitsEqual(hit0, hit1) {
1070
1043
  if (!hit0 && !hit1) {
1071
1044
  return true;
@@ -1077,9 +1050,8 @@ function isHitsEqual(hit0, hit1) {
1077
1050
  }
1078
1051
 
1079
1052
  function buildDatePointApiWithContext(dateSpan, context) {
1080
- var props = {};
1081
- for (var _i = 0, _a = context.pluginHooks.datePointTransforms; _i < _a.length; _i++) {
1082
- var transform = _a[_i];
1053
+ let props = {};
1054
+ for (let transform of context.pluginHooks.datePointTransforms) {
1083
1055
  tslib.__assign(props, transform(dateSpan, context));
1084
1056
  }
1085
1057
  tslib.__assign(props, buildDatePointApi(dateSpan, context.dateEnv));
@@ -1097,74 +1069,70 @@ function buildDatePointApi(span, dateEnv) {
1097
1069
  Monitors when the user clicks on a specific date/time of a component.
1098
1070
  A pointerdown+pointerup on the same "hit" constitutes a click.
1099
1071
  */
1100
- var DateClicking = /** @class */ (function (_super) {
1101
- tslib.__extends(DateClicking, _super);
1102
- function DateClicking(settings) {
1103
- var _this = _super.call(this, settings) || this;
1104
- _this.handlePointerDown = function (pev) {
1105
- var dragging = _this.dragging;
1106
- 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;
1107
1078
  // do this in pointerdown (not dragend) because DOM might be mutated by the time dragend is fired
1108
- dragging.setIgnoreMove(!_this.component.isValidDateDownEl(downEl));
1079
+ dragging.setIgnoreMove(!this.component.isValidDateDownEl(downEl));
1109
1080
  };
1110
1081
  // won't even fire if moving was ignored
1111
- _this.handleDragEnd = function (ev) {
1112
- var component = _this.component;
1113
- var pointer = _this.dragging.pointer;
1082
+ this.handleDragEnd = (ev) => {
1083
+ let { component } = this;
1084
+ let { pointer } = this.dragging;
1114
1085
  if (!pointer.wasTouchScroll) {
1115
- var _a = _this.hitDragging, initialHit = _a.initialHit, finalHit = _a.finalHit;
1086
+ let { initialHit, finalHit } = this.hitDragging;
1116
1087
  if (initialHit && finalHit && isHitsEqual(initialHit, finalHit)) {
1117
- var context = component.context;
1118
- 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 });
1119
1090
  context.emitter.trigger('dateClick', arg);
1120
1091
  }
1121
1092
  }
1122
1093
  };
1123
1094
  // we DO want to watch pointer moves because otherwise finalHit won't get populated
1124
- _this.dragging = new FeaturefulElementDragging(settings.el);
1125
- _this.dragging.autoScroller.isEnabled = false;
1126
- var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, common.interactionSettingsToStore(settings));
1127
- hitDragging.emitter.on('pointerdown', _this.handlePointerDown);
1128
- hitDragging.emitter.on('dragend', _this.handleDragEnd);
1129
- return _this;
1130
- }
1131
- 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() {
1132
1102
  this.dragging.destroy();
1133
- };
1134
- return DateClicking;
1135
- }(common.Interaction));
1103
+ }
1104
+ }
1136
1105
 
1137
1106
  /*
1138
1107
  Tracks when the user selects a portion of time of a component,
1139
1108
  constituted by a drag over date cells, with a possible delay at the beginning of the drag.
1140
1109
  */
1141
- var DateSelecting = /** @class */ (function (_super) {
1142
- tslib.__extends(DateSelecting, _super);
1143
- function DateSelecting(settings) {
1144
- var _this = _super.call(this, settings) || this;
1145
- _this.dragSelection = null;
1146
- _this.handlePointerDown = function (ev) {
1147
- var _a = _this, component = _a.component, dragging = _a.dragging;
1148
- var options = component.context.options;
1149
- 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 &&
1150
1118
  component.isValidDateDownEl(ev.origEvent.target);
1151
1119
  // don't bother to watch expensive moves if component won't do selection
1152
1120
  dragging.setIgnoreMove(!canSelect);
1153
1121
  // if touch, require user to hold down
1154
1122
  dragging.delay = ev.isTouch ? getComponentTouchDelay$1(component) : null;
1155
1123
  };
1156
- _this.handleDragStart = function (ev) {
1157
- _this.component.context.calendarApi.unselect(ev); // unselect previous selections
1124
+ this.handleDragStart = (ev) => {
1125
+ this.component.context.calendarApi.unselect(ev); // unselect previous selections
1158
1126
  };
1159
- _this.handleHitUpdate = function (hit, isFinal) {
1160
- var context = _this.component.context;
1161
- var dragSelection = null;
1162
- var isInvalid = false;
1127
+ this.handleHitUpdate = (hit, isFinal) => {
1128
+ let { context } = this.component;
1129
+ let dragSelection = null;
1130
+ let isInvalid = false;
1163
1131
  if (hit) {
1164
- var initialHit = _this.hitDragging.initialHit;
1165
- var disallowed = hit.componentId === initialHit.componentId
1166
- && _this.isHitComboAllowed
1167
- && !_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);
1168
1136
  if (!disallowed) {
1169
1137
  dragSelection = joinHitsIntoSelection(initialHit, hit, context.pluginHooks.dateSelectionTransformers);
1170
1138
  }
@@ -1186,56 +1154,53 @@ var DateSelecting = /** @class */ (function (_super) {
1186
1154
  common.disableCursor();
1187
1155
  }
1188
1156
  if (!isFinal) {
1189
- _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
1190
1158
  }
1191
1159
  };
1192
- _this.handlePointerUp = function (pev) {
1193
- if (_this.dragSelection) {
1160
+ this.handlePointerUp = (pev) => {
1161
+ if (this.dragSelection) {
1194
1162
  // selection is already rendered, so just need to report selection
1195
- common.triggerDateSelect(_this.dragSelection, pev, _this.component.context);
1196
- _this.dragSelection = null;
1163
+ common.triggerDateSelect(this.dragSelection, pev, this.component.context);
1164
+ this.dragSelection = null;
1197
1165
  }
1198
1166
  };
1199
- var component = settings.component;
1200
- var options = component.context.options;
1201
- 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);
1202
1170
  dragging.touchScrollAllowed = false;
1203
1171
  dragging.minDistance = options.selectMinDistance || 0;
1204
1172
  dragging.autoScroller.isEnabled = options.dragScroll;
1205
- var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, common.interactionSettingsToStore(settings));
1206
- hitDragging.emitter.on('pointerdown', _this.handlePointerDown);
1207
- hitDragging.emitter.on('dragstart', _this.handleDragStart);
1208
- hitDragging.emitter.on('hitupdate', _this.handleHitUpdate);
1209
- hitDragging.emitter.on('pointerup', _this.handlePointerUp);
1210
- return _this;
1211
- }
1212
- 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() {
1213
1180
  this.dragging.destroy();
1214
- };
1215
- return DateSelecting;
1216
- }(common.Interaction));
1181
+ }
1182
+ }
1217
1183
  function getComponentTouchDelay$1(component) {
1218
- var options = component.context.options;
1219
- var delay = options.selectLongPressDelay;
1184
+ let { options } = component.context;
1185
+ let delay = options.selectLongPressDelay;
1220
1186
  if (delay == null) {
1221
1187
  delay = options.longPressDelay;
1222
1188
  }
1223
1189
  return delay;
1224
1190
  }
1225
1191
  function joinHitsIntoSelection(hit0, hit1, dateSelectionTransformers) {
1226
- var dateSpan0 = hit0.dateSpan;
1227
- var dateSpan1 = hit1.dateSpan;
1228
- var ms = [
1192
+ let dateSpan0 = hit0.dateSpan;
1193
+ let dateSpan1 = hit1.dateSpan;
1194
+ let ms = [
1229
1195
  dateSpan0.range.start,
1230
1196
  dateSpan0.range.end,
1231
1197
  dateSpan1.range.start,
1232
1198
  dateSpan1.range.end,
1233
1199
  ];
1234
1200
  ms.sort(common.compareNumbers);
1235
- var props = {};
1236
- for (var _i = 0, dateSelectionTransformers_1 = dateSelectionTransformers; _i < dateSelectionTransformers_1.length; _i++) {
1237
- var transformer = dateSelectionTransformers_1[_i];
1238
- var res = transformer(hit0, hit1);
1201
+ let props = {};
1202
+ for (let transformer of dateSelectionTransformers) {
1203
+ let res = transformer(hit0, hit1);
1239
1204
  if (res === false) {
1240
1205
  return null;
1241
1206
  }
@@ -1248,30 +1213,29 @@ function joinHitsIntoSelection(hit0, hit1, dateSelectionTransformers) {
1248
1213
  return props;
1249
1214
  }
1250
1215
 
1251
- var EventDragging = /** @class */ (function (_super) {
1252
- tslib.__extends(EventDragging, _super);
1253
- function EventDragging(settings) {
1254
- var _this = _super.call(this, settings) || this;
1216
+ class EventDragging extends common.Interaction {
1217
+ constructor(settings) {
1218
+ super(settings);
1255
1219
  // internal state
1256
- _this.subjectEl = null;
1257
- _this.subjectSeg = null; // the seg being selected/dragged
1258
- _this.isDragging = false;
1259
- _this.eventRange = null;
1260
- _this.relevantEvents = null; // the events being dragged
1261
- _this.receivingContext = null;
1262
- _this.validMutation = null;
1263
- _this.mutatedRelevantEvents = null;
1264
- _this.handlePointerDown = function (ev) {
1265
- var origTarget = ev.origEvent.target;
1266
- var _a = _this, component = _a.component, dragging = _a.dragging;
1267
- var mirror = dragging.mirror;
1268
- var options = component.context.options;
1269
- var initialContext = component.context;
1270
- _this.subjectEl = ev.subjectEl;
1271
- var subjectSeg = _this.subjectSeg = common.getElSeg(ev.subjectEl);
1272
- var eventRange = _this.eventRange = subjectSeg.eventRange;
1273
- var eventInstanceId = eventRange.instance.instanceId;
1274
- _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);
1275
1239
  dragging.minDistance = ev.isTouch ? 0 : options.eventDragMinDistance;
1276
1240
  dragging.delay =
1277
1241
  // only do a touch delay if touch and this event hasn't been selected yet
@@ -1285,58 +1249,58 @@ var EventDragging = /** @class */ (function (_super) {
1285
1249
  mirror.parentNode = common.elementClosest(origTarget, '.fc');
1286
1250
  }
1287
1251
  mirror.revertDuration = options.dragRevertDuration;
1288
- var isValid = component.isValidSegDownEl(origTarget) &&
1252
+ let isValid = component.isValidSegDownEl(origTarget) &&
1289
1253
  !common.elementClosest(origTarget, '.fc-event-resizer'); // NOT on a resizer
1290
1254
  dragging.setIgnoreMove(!isValid);
1291
1255
  // disable dragging for elements that are resizable (ie, selectable)
1292
1256
  // but are not draggable
1293
- _this.isDragging = isValid &&
1257
+ this.isDragging = isValid &&
1294
1258
  ev.subjectEl.classList.contains('fc-event-draggable');
1295
1259
  };
1296
- _this.handleDragStart = function (ev) {
1297
- var initialContext = _this.component.context;
1298
- var eventRange = _this.eventRange;
1299
- 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;
1300
1264
  if (ev.isTouch) {
1301
1265
  // need to select a different event?
1302
- if (eventInstanceId !== _this.component.props.eventSelection) {
1303
- initialContext.dispatch({ type: 'SELECT_EVENT', eventInstanceId: eventInstanceId });
1266
+ if (eventInstanceId !== this.component.props.eventSelection) {
1267
+ initialContext.dispatch({ type: 'SELECT_EVENT', eventInstanceId });
1304
1268
  }
1305
1269
  }
1306
1270
  else {
1307
1271
  // if now using mouse, but was previous touch interaction, clear selected event
1308
1272
  initialContext.dispatch({ type: 'UNSELECT_EVENT' });
1309
1273
  }
1310
- if (_this.isDragging) {
1274
+ if (this.isDragging) {
1311
1275
  initialContext.calendarApi.unselect(ev); // unselect *date* selection
1312
1276
  initialContext.emitter.trigger('eventDragStart', {
1313
- el: _this.subjectEl,
1277
+ el: this.subjectEl,
1314
1278
  event: new common.EventApi(initialContext, eventRange.def, eventRange.instance),
1315
1279
  jsEvent: ev.origEvent,
1316
1280
  view: initialContext.viewApi,
1317
1281
  });
1318
1282
  }
1319
1283
  };
1320
- _this.handleHitUpdate = function (hit, isFinal) {
1321
- if (!_this.isDragging) {
1284
+ this.handleHitUpdate = (hit, isFinal) => {
1285
+ if (!this.isDragging) {
1322
1286
  return;
1323
1287
  }
1324
- var relevantEvents = _this.relevantEvents;
1325
- var initialHit = _this.hitDragging.initialHit;
1326
- var initialContext = _this.component.context;
1288
+ let relevantEvents = this.relevantEvents;
1289
+ let initialHit = this.hitDragging.initialHit;
1290
+ let initialContext = this.component.context;
1327
1291
  // states based on new hit
1328
- var receivingContext = null;
1329
- var mutation = null;
1330
- var mutatedRelevantEvents = null;
1331
- var isInvalid = false;
1332
- var interaction = {
1292
+ let receivingContext = null;
1293
+ let mutation = null;
1294
+ let mutatedRelevantEvents = null;
1295
+ let isInvalid = false;
1296
+ let interaction = {
1333
1297
  affectedEvents: relevantEvents,
1334
1298
  mutatedEvents: common.createEmptyEventStore(),
1335
1299
  isEvent: true,
1336
1300
  };
1337
1301
  if (hit) {
1338
1302
  receivingContext = hit.context;
1339
- var receivingOptions = receivingContext.options;
1303
+ let receivingOptions = receivingContext.options;
1340
1304
  if (initialContext === receivingContext ||
1341
1305
  (receivingOptions.editable && receivingOptions.droppable)) {
1342
1306
  mutation = computeEventMutation(initialHit, hit, receivingContext.getCurrentData().pluginHooks.eventDragMutationMassagers);
@@ -1355,7 +1319,7 @@ var EventDragging = /** @class */ (function (_super) {
1355
1319
  receivingContext = null;
1356
1320
  }
1357
1321
  }
1358
- _this.displayDrag(receivingContext, interaction);
1322
+ this.displayDrag(receivingContext, interaction);
1359
1323
  if (!isInvalid) {
1360
1324
  common.enableCursor();
1361
1325
  }
@@ -1367,140 +1331,138 @@ var EventDragging = /** @class */ (function (_super) {
1367
1331
  isHitsEqual(initialHit, hit)) {
1368
1332
  mutation = null;
1369
1333
  }
1370
- _this.dragging.setMirrorNeedsRevert(!mutation);
1334
+ this.dragging.setMirrorNeedsRevert(!mutation);
1371
1335
  // render the mirror if no already-rendered mirror
1372
1336
  // TODO: wish we could somehow wait for dispatch to guarantee render
1373
- _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'));
1374
1338
  // assign states based on new hit
1375
- _this.receivingContext = receivingContext;
1376
- _this.validMutation = mutation;
1377
- _this.mutatedRelevantEvents = mutatedRelevantEvents;
1339
+ this.receivingContext = receivingContext;
1340
+ this.validMutation = mutation;
1341
+ this.mutatedRelevantEvents = mutatedRelevantEvents;
1378
1342
  }
1379
1343
  };
1380
- _this.handlePointerUp = function () {
1381
- if (!_this.isDragging) {
1382
- _this.cleanup(); // because handleDragEnd won't fire
1344
+ this.handlePointerUp = () => {
1345
+ if (!this.isDragging) {
1346
+ this.cleanup(); // because handleDragEnd won't fire
1383
1347
  }
1384
1348
  };
1385
- _this.handleDragEnd = function (ev) {
1386
- if (_this.isDragging) {
1387
- var initialContext_1 = _this.component.context;
1388
- var initialView = initialContext_1.viewApi;
1389
- var _a = _this, receivingContext_1 = _a.receivingContext, validMutation = _a.validMutation;
1390
- var eventDef = _this.eventRange.def;
1391
- var eventInstance = _this.eventRange.instance;
1392
- var eventApi = new common.EventApi(initialContext_1, eventDef, eventInstance);
1393
- var relevantEvents_1 = _this.relevantEvents;
1394
- var mutatedRelevantEvents_1 = _this.mutatedRelevantEvents;
1395
- var finalHit = _this.hitDragging.finalHit;
1396
- _this.clearDrag(); // must happen after revert animation
1397
- initialContext_1.emitter.trigger('eventDragStop', {
1398
- 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,
1399
1363
  event: eventApi,
1400
1364
  jsEvent: ev.origEvent,
1401
1365
  view: initialView,
1402
1366
  });
1403
1367
  if (validMutation) {
1404
1368
  // dropped within same calendar
1405
- if (receivingContext_1 === initialContext_1) {
1406
- var updatedEventApi = new common.EventApi(initialContext_1, mutatedRelevantEvents_1.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents_1.instances[eventInstance.instanceId] : null);
1407
- 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({
1408
1372
  type: 'MERGE_EVENTS',
1409
- eventStore: mutatedRelevantEvents_1,
1373
+ eventStore: mutatedRelevantEvents,
1410
1374
  });
1411
- var eventChangeArg = {
1375
+ let eventChangeArg = {
1412
1376
  oldEvent: eventApi,
1413
1377
  event: updatedEventApi,
1414
- relatedEvents: common.buildEventApis(mutatedRelevantEvents_1, initialContext_1, eventInstance),
1415
- revert: function () {
1416
- initialContext_1.dispatch({
1378
+ relatedEvents: common.buildEventApis(mutatedRelevantEvents, initialContext, eventInstance),
1379
+ revert() {
1380
+ initialContext.dispatch({
1417
1381
  type: 'MERGE_EVENTS',
1418
- eventStore: relevantEvents_1, // the pre-change data
1382
+ eventStore: relevantEvents, // the pre-change data
1419
1383
  });
1420
1384
  },
1421
1385
  };
1422
- var transformed = {};
1423
- for (var _i = 0, _b = initialContext_1.getCurrentData().pluginHooks.eventDropTransformers; _i < _b.length; _i++) {
1424
- var transformer = _b[_i];
1425
- 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));
1426
1389
  }
1427
- initialContext_1.emitter.trigger('eventDrop', tslib.__assign(tslib.__assign(tslib.__assign({}, eventChangeArg), transformed), { el: ev.subjectEl, delta: validMutation.datesDelta, jsEvent: ev.origEvent, view: initialView }));
1428
- 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);
1429
1392
  // dropped in different calendar
1430
1393
  }
1431
- else if (receivingContext_1) {
1432
- var eventRemoveArg = {
1394
+ else if (receivingContext) {
1395
+ let eventRemoveArg = {
1433
1396
  event: eventApi,
1434
- relatedEvents: common.buildEventApis(relevantEvents_1, initialContext_1, eventInstance),
1435
- revert: function () {
1436
- initialContext_1.dispatch({
1397
+ relatedEvents: common.buildEventApis(relevantEvents, initialContext, eventInstance),
1398
+ revert() {
1399
+ initialContext.dispatch({
1437
1400
  type: 'MERGE_EVENTS',
1438
- eventStore: relevantEvents_1,
1401
+ eventStore: relevantEvents,
1439
1402
  });
1440
1403
  },
1441
1404
  };
1442
- initialContext_1.emitter.trigger('eventLeave', tslib.__assign(tslib.__assign({}, eventRemoveArg), { draggedEl: ev.subjectEl, view: initialView }));
1443
- initialContext_1.dispatch({
1405
+ initialContext.emitter.trigger('eventLeave', Object.assign(Object.assign({}, eventRemoveArg), { draggedEl: ev.subjectEl, view: initialView }));
1406
+ initialContext.dispatch({
1444
1407
  type: 'REMOVE_EVENTS',
1445
- eventStore: relevantEvents_1,
1408
+ eventStore: relevantEvents,
1446
1409
  });
1447
- initialContext_1.emitter.trigger('eventRemove', eventRemoveArg);
1448
- var addedEventDef = mutatedRelevantEvents_1.defs[eventDef.defId];
1449
- var addedEventInstance = mutatedRelevantEvents_1.instances[eventInstance.instanceId];
1450
- var addedEventApi = new common.EventApi(receivingContext_1, addedEventDef, addedEventInstance);
1451
- 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({
1452
1415
  type: 'MERGE_EVENTS',
1453
- eventStore: mutatedRelevantEvents_1,
1416
+ eventStore: mutatedRelevantEvents,
1454
1417
  });
1455
- var eventAddArg = {
1418
+ let eventAddArg = {
1456
1419
  event: addedEventApi,
1457
- relatedEvents: common.buildEventApis(mutatedRelevantEvents_1, receivingContext_1, addedEventInstance),
1458
- revert: function () {
1459
- receivingContext_1.dispatch({
1420
+ relatedEvents: common.buildEventApis(mutatedRelevantEvents, receivingContext, addedEventInstance),
1421
+ revert() {
1422
+ receivingContext.dispatch({
1460
1423
  type: 'REMOVE_EVENTS',
1461
- eventStore: mutatedRelevantEvents_1,
1424
+ eventStore: mutatedRelevantEvents,
1462
1425
  });
1463
1426
  },
1464
1427
  };
1465
- receivingContext_1.emitter.trigger('eventAdd', eventAddArg);
1428
+ receivingContext.emitter.trigger('eventAdd', eventAddArg);
1466
1429
  if (ev.isTouch) {
1467
- receivingContext_1.dispatch({
1430
+ receivingContext.dispatch({
1468
1431
  type: 'SELECT_EVENT',
1469
1432
  eventInstanceId: eventInstance.instanceId,
1470
1433
  });
1471
1434
  }
1472
- receivingContext_1.emitter.trigger('drop', tslib.__assign(tslib.__assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext_1)), { draggedEl: ev.subjectEl, jsEvent: ev.origEvent, view: finalHit.context.viewApi }));
1473
- 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 }));
1474
1437
  }
1475
1438
  }
1476
1439
  else {
1477
- initialContext_1.emitter.trigger('_noEventDrop');
1440
+ initialContext.emitter.trigger('_noEventDrop');
1478
1441
  }
1479
1442
  }
1480
- _this.cleanup();
1443
+ this.cleanup();
1481
1444
  };
1482
- var component = _this.component;
1483
- var options = component.context.options;
1484
- 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);
1485
1448
  dragging.pointer.selector = EventDragging.SELECTOR;
1486
1449
  dragging.touchScrollAllowed = false;
1487
1450
  dragging.autoScroller.isEnabled = options.dragScroll;
1488
- var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, common.interactionSettingsStore);
1451
+ let hitDragging = this.hitDragging = new HitDragging(this.dragging, common.interactionSettingsStore);
1489
1452
  hitDragging.useSubjectCenter = settings.useEventCenter;
1490
- hitDragging.emitter.on('pointerdown', _this.handlePointerDown);
1491
- hitDragging.emitter.on('dragstart', _this.handleDragStart);
1492
- hitDragging.emitter.on('hitupdate', _this.handleHitUpdate);
1493
- hitDragging.emitter.on('pointerup', _this.handlePointerUp);
1494
- hitDragging.emitter.on('dragend', _this.handleDragEnd);
1495
- return _this;
1496
- }
1497
- 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() {
1498
1460
  this.dragging.destroy();
1499
- };
1461
+ }
1500
1462
  // render a drag state on the next receivingCalendar
1501
- EventDragging.prototype.displayDrag = function (nextContext, state) {
1502
- var initialContext = this.component.context;
1503
- var prevContext = this.receivingContext;
1463
+ displayDrag(nextContext, state) {
1464
+ let initialContext = this.component.context;
1465
+ let prevContext = this.receivingContext;
1504
1466
  // does the previous calendar need to be cleared?
1505
1467
  if (prevContext && prevContext !== nextContext) {
1506
1468
  // does the initial calendar need to be cleared?
@@ -1521,12 +1483,12 @@ var EventDragging = /** @class */ (function (_super) {
1521
1483
  }
1522
1484
  }
1523
1485
  if (nextContext) {
1524
- nextContext.dispatch({ type: 'SET_EVENT_DRAG', state: state });
1486
+ nextContext.dispatch({ type: 'SET_EVENT_DRAG', state });
1525
1487
  }
1526
- };
1527
- EventDragging.prototype.clearDrag = function () {
1528
- var initialCalendar = this.component.context;
1529
- var receivingContext = this.receivingContext;
1488
+ }
1489
+ clearDrag() {
1490
+ let initialCalendar = this.component.context;
1491
+ let { receivingContext } = this;
1530
1492
  if (receivingContext) {
1531
1493
  receivingContext.dispatch({ type: 'UNSET_EVENT_DRAG' });
1532
1494
  }
@@ -1534,8 +1496,8 @@ var EventDragging = /** @class */ (function (_super) {
1534
1496
  if (initialCalendar !== receivingContext) {
1535
1497
  initialCalendar.dispatch({ type: 'UNSET_EVENT_DRAG' });
1536
1498
  }
1537
- };
1538
- EventDragging.prototype.cleanup = function () {
1499
+ }
1500
+ cleanup() {
1539
1501
  this.subjectSeg = null;
1540
1502
  this.isDragging = false;
1541
1503
  this.eventRange = null;
@@ -1543,18 +1505,17 @@ var EventDragging = /** @class */ (function (_super) {
1543
1505
  this.receivingContext = null;
1544
1506
  this.validMutation = null;
1545
1507
  this.mutatedRelevantEvents = null;
1546
- };
1547
- // TODO: test this in IE11
1548
- // QUESTION: why do we need it on the resizable???
1549
- EventDragging.SELECTOR = '.fc-event-draggable, .fc-event-resizable';
1550
- return EventDragging;
1551
- }(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';
1552
1513
  function computeEventMutation(hit0, hit1, massagers) {
1553
- var dateSpan0 = hit0.dateSpan;
1554
- var dateSpan1 = hit1.dateSpan;
1555
- var date0 = dateSpan0.range.start;
1556
- var date1 = dateSpan1.range.start;
1557
- 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 = {};
1558
1519
  if (dateSpan0.allDay !== dateSpan1.allDay) {
1559
1520
  standardProps.allDay = dateSpan1.allDay;
1560
1521
  standardProps.hasEnd = hit1.context.options.allDayMaintainDuration;
@@ -1564,59 +1525,57 @@ function computeEventMutation(hit0, hit1, massagers) {
1564
1525
  date0 = common.startOfDay(date0);
1565
1526
  }
1566
1527
  }
1567
- 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 ?
1568
1529
  hit0.largeUnit :
1569
1530
  null);
1570
1531
  if (delta.milliseconds) { // has hours/minutes/seconds
1571
1532
  standardProps.allDay = false;
1572
1533
  }
1573
- var mutation = {
1534
+ let mutation = {
1574
1535
  datesDelta: delta,
1575
- standardProps: standardProps,
1536
+ standardProps,
1576
1537
  };
1577
- for (var _i = 0, massagers_1 = massagers; _i < massagers_1.length; _i++) {
1578
- var massager = massagers_1[_i];
1538
+ for (let massager of massagers) {
1579
1539
  massager(mutation, hit0, hit1);
1580
1540
  }
1581
1541
  return mutation;
1582
1542
  }
1583
1543
  function getComponentTouchDelay(component) {
1584
- var options = component.context.options;
1585
- var delay = options.eventLongPressDelay;
1544
+ let { options } = component.context;
1545
+ let delay = options.eventLongPressDelay;
1586
1546
  if (delay == null) {
1587
1547
  delay = options.longPressDelay;
1588
1548
  }
1589
1549
  return delay;
1590
1550
  }
1591
1551
 
1592
- var EventResizing = /** @class */ (function (_super) {
1593
- tslib.__extends(EventResizing, _super);
1594
- function EventResizing(settings) {
1595
- var _this = _super.call(this, settings) || this;
1552
+ class EventResizing extends common.Interaction {
1553
+ constructor(settings) {
1554
+ super(settings);
1596
1555
  // internal state
1597
- _this.draggingSegEl = null;
1598
- _this.draggingSeg = null; // TODO: rename to resizingSeg? subjectSeg?
1599
- _this.eventRange = null;
1600
- _this.relevantEvents = null;
1601
- _this.validMutation = null;
1602
- _this.mutatedRelevantEvents = null;
1603
- _this.handlePointerDown = function (ev) {
1604
- var component = _this.component;
1605
- var segEl = _this.querySegEl(ev);
1606
- var seg = common.getElSeg(segEl);
1607
- var eventRange = _this.eventRange = seg.eventRange;
1608
- _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;
1609
1568
  // if touch, need to be working with a selected event
1610
- _this.dragging.setIgnoreMove(!_this.component.isValidSegDownEl(ev.origEvent.target) ||
1611
- (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));
1612
1571
  };
1613
- _this.handleDragStart = function (ev) {
1614
- var context = _this.component.context;
1615
- var eventRange = _this.eventRange;
1616
- _this.relevantEvents = common.getRelevantEvents(context.getCurrentData().eventStore, _this.eventRange.instance.instanceId);
1617
- var segEl = _this.querySegEl(ev);
1618
- _this.draggingSegEl = segEl;
1619
- _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);
1620
1579
  context.calendarApi.unselect();
1621
1580
  context.emitter.trigger('eventResizeStart', {
1622
1581
  el: segEl,
@@ -1625,23 +1584,23 @@ var EventResizing = /** @class */ (function (_super) {
1625
1584
  view: context.viewApi,
1626
1585
  });
1627
1586
  };
1628
- _this.handleHitUpdate = function (hit, isFinal, ev) {
1629
- var context = _this.component.context;
1630
- var relevantEvents = _this.relevantEvents;
1631
- var initialHit = _this.hitDragging.initialHit;
1632
- var eventInstance = _this.eventRange.instance;
1633
- var mutation = null;
1634
- var mutatedRelevantEvents = null;
1635
- var isInvalid = false;
1636
- 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 = {
1637
1596
  affectedEvents: relevantEvents,
1638
1597
  mutatedEvents: common.createEmptyEventStore(),
1639
1598
  isEvent: true,
1640
1599
  };
1641
1600
  if (hit) {
1642
- var disallowed = hit.componentId === initialHit.componentId
1643
- && _this.isHitComboAllowed
1644
- && !_this.isHitComboAllowed(initialHit, hit);
1601
+ let disallowed = hit.componentId === initialHit.componentId
1602
+ && this.isHitComboAllowed
1603
+ && !this.isHitComboAllowed(initialHit, hit);
1645
1604
  if (!disallowed) {
1646
1605
  mutation = computeMutation(initialHit, hit, ev.subjectEl.classList.contains('fc-event-resizer-start'), eventInstance.range);
1647
1606
  }
@@ -1675,77 +1634,75 @@ var EventResizing = /** @class */ (function (_super) {
1675
1634
  if (mutation && isHitsEqual(initialHit, hit)) {
1676
1635
  mutation = null;
1677
1636
  }
1678
- _this.validMutation = mutation;
1679
- _this.mutatedRelevantEvents = mutatedRelevantEvents;
1637
+ this.validMutation = mutation;
1638
+ this.mutatedRelevantEvents = mutatedRelevantEvents;
1680
1639
  }
1681
1640
  };
1682
- _this.handleDragEnd = function (ev) {
1683
- var context = _this.component.context;
1684
- var eventDef = _this.eventRange.def;
1685
- var eventInstance = _this.eventRange.instance;
1686
- var eventApi = new common.EventApi(context, eventDef, eventInstance);
1687
- var relevantEvents = _this.relevantEvents;
1688
- 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;
1689
1648
  context.emitter.trigger('eventResizeStop', {
1690
- el: _this.draggingSegEl,
1649
+ el: this.draggingSegEl,
1691
1650
  event: eventApi,
1692
1651
  jsEvent: ev.origEvent,
1693
1652
  view: context.viewApi,
1694
1653
  });
1695
- if (_this.validMutation) {
1696
- 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);
1697
1656
  context.dispatch({
1698
1657
  type: 'MERGE_EVENTS',
1699
1658
  eventStore: mutatedRelevantEvents,
1700
1659
  });
1701
- var eventChangeArg = {
1660
+ let eventChangeArg = {
1702
1661
  oldEvent: eventApi,
1703
1662
  event: updatedEventApi,
1704
1663
  relatedEvents: common.buildEventApis(mutatedRelevantEvents, context, eventInstance),
1705
- revert: function () {
1664
+ revert() {
1706
1665
  context.dispatch({
1707
1666
  type: 'MERGE_EVENTS',
1708
1667
  eventStore: relevantEvents, // the pre-change events
1709
1668
  });
1710
1669
  },
1711
1670
  };
1712
- 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 }));
1713
1672
  context.emitter.trigger('eventChange', eventChangeArg);
1714
1673
  }
1715
1674
  else {
1716
1675
  context.emitter.trigger('_noEventResize');
1717
1676
  }
1718
1677
  // reset all internal state
1719
- _this.draggingSeg = null;
1720
- _this.relevantEvents = null;
1721
- _this.validMutation = null;
1678
+ this.draggingSeg = null;
1679
+ this.relevantEvents = null;
1680
+ this.validMutation = null;
1722
1681
  // okay to keep eventInstance around. useful to set it in handlePointerDown
1723
1682
  };
1724
- var component = settings.component;
1725
- var dragging = _this.dragging = new FeaturefulElementDragging(settings.el);
1683
+ let { component } = settings;
1684
+ let dragging = this.dragging = new FeaturefulElementDragging(settings.el);
1726
1685
  dragging.pointer.selector = '.fc-event-resizer';
1727
1686
  dragging.touchScrollAllowed = false;
1728
1687
  dragging.autoScroller.isEnabled = component.context.options.dragScroll;
1729
- var hitDragging = _this.hitDragging = new HitDragging(_this.dragging, common.interactionSettingsToStore(settings));
1730
- hitDragging.emitter.on('pointerdown', _this.handlePointerDown);
1731
- hitDragging.emitter.on('dragstart', _this.handleDragStart);
1732
- hitDragging.emitter.on('hitupdate', _this.handleHitUpdate);
1733
- hitDragging.emitter.on('dragend', _this.handleDragEnd);
1734
- return _this;
1735
- }
1736
- 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() {
1737
1695
  this.dragging.destroy();
1738
- };
1739
- EventResizing.prototype.querySegEl = function (ev) {
1696
+ }
1697
+ querySegEl(ev) {
1740
1698
  return common.elementClosest(ev.subjectEl, '.fc-event');
1741
- };
1742
- return EventResizing;
1743
- }(common.Interaction));
1699
+ }
1700
+ }
1744
1701
  function computeMutation(hit0, hit1, isFromStart, instanceRange) {
1745
- var dateEnv = hit0.context.dateEnv;
1746
- var date0 = hit0.dateSpan.range.start;
1747
- var date1 = hit1.dateSpan.range.start;
1748
- 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);
1749
1706
  if (isFromStart) {
1750
1707
  if (dateEnv.add(instanceRange.start, delta) < instanceRange.end) {
1751
1708
  return { startDelta: delta };
@@ -1757,47 +1714,46 @@ function computeMutation(hit0, hit1, isFromStart, instanceRange) {
1757
1714
  return null;
1758
1715
  }
1759
1716
 
1760
- var UnselectAuto = /** @class */ (function () {
1761
- function UnselectAuto(context) {
1762
- var _this = this;
1717
+ class UnselectAuto {
1718
+ constructor(context) {
1763
1719
  this.context = context;
1764
1720
  this.isRecentPointerDateSelect = false; // wish we could use a selector to detect date selection, but uses hit system
1765
1721
  this.matchesCancel = false;
1766
1722
  this.matchesEvent = false;
1767
- this.onSelect = function (selectInfo) {
1723
+ this.onSelect = (selectInfo) => {
1768
1724
  if (selectInfo.jsEvent) {
1769
- _this.isRecentPointerDateSelect = true;
1725
+ this.isRecentPointerDateSelect = true;
1770
1726
  }
1771
1727
  };
1772
- this.onDocumentPointerDown = function (pev) {
1773
- var unselectCancel = _this.context.options.unselectCancel;
1774
- var downEl = common.getEventTargetViaRoot(pev.origEvent);
1775
- _this.matchesCancel = !!common.elementClosest(downEl, unselectCancel);
1776
- _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?
1777
1733
  };
1778
- this.onDocumentPointerUp = function (pev) {
1779
- var context = _this.context;
1780
- var documentPointer = _this.documentPointer;
1781
- var calendarState = context.getCurrentData();
1734
+ this.onDocumentPointerUp = (pev) => {
1735
+ let { context } = this;
1736
+ let { documentPointer } = this;
1737
+ let calendarState = context.getCurrentData();
1782
1738
  // touch-scrolling should never unfocus any type of selection
1783
1739
  if (!documentPointer.wasTouchScroll) {
1784
1740
  if (calendarState.dateSelection && // an existing date selection?
1785
- !_this.isRecentPointerDateSelect // a new pointer-initiated date selection since last onDocumentPointerUp?
1741
+ !this.isRecentPointerDateSelect // a new pointer-initiated date selection since last onDocumentPointerUp?
1786
1742
  ) {
1787
- var unselectAuto = context.options.unselectAuto;
1788
- if (unselectAuto && (!unselectAuto || !_this.matchesCancel)) {
1743
+ let unselectAuto = context.options.unselectAuto;
1744
+ if (unselectAuto && (!unselectAuto || !this.matchesCancel)) {
1789
1745
  context.calendarApi.unselect(pev);
1790
1746
  }
1791
1747
  }
1792
1748
  if (calendarState.eventSelection && // an existing event selected?
1793
- !_this.matchesEvent // interaction DIDN'T start on an event
1749
+ !this.matchesEvent // interaction DIDN'T start on an event
1794
1750
  ) {
1795
1751
  context.dispatch({ type: 'UNSELECT_EVENT' });
1796
1752
  }
1797
1753
  }
1798
- _this.isRecentPointerDateSelect = false;
1754
+ this.isRecentPointerDateSelect = false;
1799
1755
  };
1800
- var documentPointer = this.documentPointer = new PointerDragging(document);
1756
+ let documentPointer = this.documentPointer = new PointerDragging(document);
1801
1757
  documentPointer.shouldIgnoreMove = true;
1802
1758
  documentPointer.shouldWatchScroll = false;
1803
1759
  documentPointer.emitter.on('pointerdown', this.onDocumentPointerDown);
@@ -1807,17 +1763,16 @@ var UnselectAuto = /** @class */ (function () {
1807
1763
  */
1808
1764
  context.emitter.on('select', this.onSelect);
1809
1765
  }
1810
- UnselectAuto.prototype.destroy = function () {
1766
+ destroy() {
1811
1767
  this.context.emitter.off('select', this.onSelect);
1812
1768
  this.documentPointer.destroy();
1813
- };
1814
- return UnselectAuto;
1815
- }());
1769
+ }
1770
+ }
1816
1771
 
1817
- var OPTION_REFINERS = {
1772
+ const OPTION_REFINERS = {
1818
1773
  fixedMirrorParent: common.identity,
1819
1774
  };
1820
- var LISTENER_REFINERS = {
1775
+ const LISTENER_REFINERS = {
1821
1776
  dateClick: common.identity,
1822
1777
  eventDragStart: common.identity,
1823
1778
  eventDragStop: common.identity,
@@ -1835,30 +1790,29 @@ Given an already instantiated draggable object for one-or-more elements,
1835
1790
  Interprets any dragging as an attempt to drag an events that lives outside
1836
1791
  of a calendar onto a calendar.
1837
1792
  */
1838
- var ExternalElementDragging = /** @class */ (function () {
1839
- function ExternalElementDragging(dragging, suppliedDragMeta) {
1840
- var _this = this;
1793
+ class ExternalElementDragging {
1794
+ constructor(dragging, suppliedDragMeta) {
1841
1795
  this.receivingContext = null;
1842
1796
  this.droppableEvent = null; // will exist for all drags, even if create:false
1843
1797
  this.suppliedDragMeta = null;
1844
1798
  this.dragMeta = null;
1845
- this.handleDragStart = function (ev) {
1846
- _this.dragMeta = _this.buildDragMeta(ev.subjectEl);
1799
+ this.handleDragStart = (ev) => {
1800
+ this.dragMeta = this.buildDragMeta(ev.subjectEl);
1847
1801
  };
1848
- this.handleHitUpdate = function (hit, isFinal, ev) {
1849
- var dragging = _this.hitDragging.dragging;
1850
- var receivingContext = null;
1851
- var droppableEvent = null;
1852
- var isInvalid = false;
1853
- 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 = {
1854
1808
  affectedEvents: common.createEmptyEventStore(),
1855
1809
  mutatedEvents: common.createEmptyEventStore(),
1856
- isEvent: _this.dragMeta.create,
1810
+ isEvent: this.dragMeta.create,
1857
1811
  };
1858
1812
  if (hit) {
1859
1813
  receivingContext = hit.context;
1860
- if (_this.canDropElOnCalendar(ev.subjectEl, receivingContext)) {
1861
- droppableEvent = computeEventForDateSpan(hit.dateSpan, _this.dragMeta, receivingContext);
1814
+ if (this.canDropElOnCalendar(ev.subjectEl, receivingContext)) {
1815
+ droppableEvent = computeEventForDateSpan(hit.dateSpan, this.dragMeta, receivingContext);
1862
1816
  interaction.mutatedEvents = common.eventTupleToStore(droppableEvent);
1863
1817
  isInvalid = !common.isInteractionValid(interaction, hit.dateProfile, receivingContext);
1864
1818
  if (isInvalid) {
@@ -1867,7 +1821,7 @@ var ExternalElementDragging = /** @class */ (function () {
1867
1821
  }
1868
1822
  }
1869
1823
  }
1870
- _this.displayDrag(receivingContext, interaction);
1824
+ this.displayDrag(receivingContext, interaction);
1871
1825
  // show mirror if no already-rendered mirror element OR if we are shutting down the mirror (?)
1872
1826
  // TODO: wish we could somehow wait for dispatch to guarantee render
1873
1827
  dragging.setMirrorIsVisible(isFinal || !droppableEvent || !document.querySelector('.fc-event-mirror'));
@@ -1879,23 +1833,23 @@ var ExternalElementDragging = /** @class */ (function () {
1879
1833
  }
1880
1834
  if (!isFinal) {
1881
1835
  dragging.setMirrorNeedsRevert(!droppableEvent);
1882
- _this.receivingContext = receivingContext;
1883
- _this.droppableEvent = droppableEvent;
1836
+ this.receivingContext = receivingContext;
1837
+ this.droppableEvent = droppableEvent;
1884
1838
  }
1885
1839
  };
1886
- this.handleDragEnd = function (pev) {
1887
- var _a = _this, receivingContext = _a.receivingContext, droppableEvent = _a.droppableEvent;
1888
- _this.clearDrag();
1840
+ this.handleDragEnd = (pev) => {
1841
+ let { receivingContext, droppableEvent } = this;
1842
+ this.clearDrag();
1889
1843
  if (receivingContext && droppableEvent) {
1890
- var finalHit = _this.hitDragging.finalHit;
1891
- var finalView = finalHit.context.viewApi;
1892
- var dragMeta = _this.dragMeta;
1893
- 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 }));
1894
1848
  if (dragMeta.create) {
1895
- var addingEvents_1 = common.eventTupleToStore(droppableEvent);
1849
+ let addingEvents = common.eventTupleToStore(droppableEvent);
1896
1850
  receivingContext.dispatch({
1897
1851
  type: 'MERGE_EVENTS',
1898
- eventStore: addingEvents_1,
1852
+ eventStore: addingEvents,
1899
1853
  });
1900
1854
  if (pev.isTouch) {
1901
1855
  receivingContext.dispatch({
@@ -1907,10 +1861,10 @@ var ExternalElementDragging = /** @class */ (function () {
1907
1861
  receivingContext.emitter.trigger('eventReceive', {
1908
1862
  event: new common.EventApi(receivingContext, droppableEvent.def, droppableEvent.instance),
1909
1863
  relatedEvents: [],
1910
- revert: function () {
1864
+ revert() {
1911
1865
  receivingContext.dispatch({
1912
1866
  type: 'REMOVE_EVENTS',
1913
- eventStore: addingEvents_1,
1867
+ eventStore: addingEvents,
1914
1868
  });
1915
1869
  },
1916
1870
  draggedEl: pev.subjectEl,
@@ -1918,17 +1872,17 @@ var ExternalElementDragging = /** @class */ (function () {
1918
1872
  });
1919
1873
  }
1920
1874
  }
1921
- _this.receivingContext = null;
1922
- _this.droppableEvent = null;
1875
+ this.receivingContext = null;
1876
+ this.droppableEvent = null;
1923
1877
  };
1924
- var hitDragging = this.hitDragging = new HitDragging(dragging, common.interactionSettingsStore);
1878
+ let hitDragging = this.hitDragging = new HitDragging(dragging, common.interactionSettingsStore);
1925
1879
  hitDragging.requireInitial = false; // will start outside of a component
1926
1880
  hitDragging.emitter.on('dragstart', this.handleDragStart);
1927
1881
  hitDragging.emitter.on('hitupdate', this.handleHitUpdate);
1928
1882
  hitDragging.emitter.on('dragend', this.handleDragEnd);
1929
1883
  this.suppliedDragMeta = suppliedDragMeta;
1930
1884
  }
1931
- ExternalElementDragging.prototype.buildDragMeta = function (subjectEl) {
1885
+ buildDragMeta(subjectEl) {
1932
1886
  if (typeof this.suppliedDragMeta === 'object') {
1933
1887
  return common.parseDragMeta(this.suppliedDragMeta);
1934
1888
  }
@@ -1936,23 +1890,23 @@ var ExternalElementDragging = /** @class */ (function () {
1936
1890
  return common.parseDragMeta(this.suppliedDragMeta(subjectEl));
1937
1891
  }
1938
1892
  return getDragMetaFromEl(subjectEl);
1939
- };
1940
- ExternalElementDragging.prototype.displayDrag = function (nextContext, state) {
1941
- var prevContext = this.receivingContext;
1893
+ }
1894
+ displayDrag(nextContext, state) {
1895
+ let prevContext = this.receivingContext;
1942
1896
  if (prevContext && prevContext !== nextContext) {
1943
1897
  prevContext.dispatch({ type: 'UNSET_EVENT_DRAG' });
1944
1898
  }
1945
1899
  if (nextContext) {
1946
- nextContext.dispatch({ type: 'SET_EVENT_DRAG', state: state });
1900
+ nextContext.dispatch({ type: 'SET_EVENT_DRAG', state });
1947
1901
  }
1948
- };
1949
- ExternalElementDragging.prototype.clearDrag = function () {
1902
+ }
1903
+ clearDrag() {
1950
1904
  if (this.receivingContext) {
1951
1905
  this.receivingContext.dispatch({ type: 'UNSET_EVENT_DRAG' });
1952
1906
  }
1953
- };
1954
- ExternalElementDragging.prototype.canDropElOnCalendar = function (el, receivingContext) {
1955
- var dropAccept = receivingContext.options.dropAccept;
1907
+ }
1908
+ canDropElOnCalendar(el, receivingContext) {
1909
+ let dropAccept = receivingContext.options.dropAccept;
1956
1910
  if (typeof dropAccept === 'function') {
1957
1911
  return dropAccept.call(receivingContext.calendarApi, el);
1958
1912
  }
@@ -1960,45 +1914,43 @@ var ExternalElementDragging = /** @class */ (function () {
1960
1914
  return Boolean(common.elementMatches(el, dropAccept));
1961
1915
  }
1962
1916
  return true;
1963
- };
1964
- return ExternalElementDragging;
1965
- }());
1917
+ }
1918
+ }
1966
1919
  // Utils for computing event store from the DragMeta
1967
1920
  // ----------------------------------------------------------------------------------------------------
1968
1921
  function computeEventForDateSpan(dateSpan, dragMeta, context) {
1969
- var defProps = tslib.__assign({}, dragMeta.leftoverProps);
1970
- for (var _i = 0, _a = context.pluginHooks.externalDefTransforms; _i < _a.length; _i++) {
1971
- var transform = _a[_i];
1922
+ let defProps = Object.assign({}, dragMeta.leftoverProps);
1923
+ for (let transform of context.pluginHooks.externalDefTransforms) {
1972
1924
  tslib.__assign(defProps, transform(dateSpan, dragMeta));
1973
1925
  }
1974
- var _b = common.refineEventDef(defProps, context), refined = _b.refined, extra = _b.extra;
1975
- 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
1976
1928
  context);
1977
- var start = dateSpan.range.start;
1929
+ let start = dateSpan.range.start;
1978
1930
  // only rely on time info if drop zone is all-day,
1979
1931
  // otherwise, we already know the time
1980
1932
  if (dateSpan.allDay && dragMeta.startTime) {
1981
1933
  start = context.dateEnv.add(start, dragMeta.startTime);
1982
1934
  }
1983
- var end = dragMeta.duration ?
1935
+ let end = dragMeta.duration ?
1984
1936
  context.dateEnv.add(start, dragMeta.duration) :
1985
1937
  common.getDefaultEventEnd(dateSpan.allDay, start, context);
1986
- var instance = common.createEventInstance(def.defId, { start: start, end: end });
1987
- return { def: def, instance: instance };
1938
+ let instance = common.createEventInstance(def.defId, { start, end });
1939
+ return { def, instance };
1988
1940
  }
1989
1941
  // Utils for extracting data from element
1990
1942
  // ----------------------------------------------------------------------------------------------------
1991
1943
  function getDragMetaFromEl(el) {
1992
- var str = getEmbeddedElData(el, 'event');
1993
- var obj = str ?
1944
+ let str = getEmbeddedElData(el, 'event');
1945
+ let obj = str ?
1994
1946
  JSON.parse(str) :
1995
1947
  { create: false }; // if no embedded data, assume no event creation
1996
1948
  return common.parseDragMeta(obj);
1997
1949
  }
1998
1950
  common.config.dataAttrPrefix = '';
1999
1951
  function getEmbeddedElData(el, name) {
2000
- var prefix = common.config.dataAttrPrefix;
2001
- var prefixedName = (prefix ? prefix + '-' : '') + name;
1952
+ let prefix = common.config.dataAttrPrefix;
1953
+ let prefixedName = (prefix ? prefix + '-' : '') + name;
2002
1954
  return el.getAttribute('data-' + prefixedName) || '';
2003
1955
  }
2004
1956
 
@@ -2007,13 +1959,11 @@ Makes an element (that is *external* to any calendar) draggable.
2007
1959
  Can pass in data that determines how an event will be created when dropped onto a calendar.
2008
1960
  Leverages FullCalendar's internal drag-n-drop functionality WITHOUT a third-party drag system.
2009
1961
  */
2010
- var ExternalDraggable = /** @class */ (function () {
2011
- function ExternalDraggable(el, settings) {
2012
- var _this = this;
2013
- if (settings === void 0) { settings = {}; }
2014
- this.handlePointerDown = function (ev) {
2015
- var dragging = _this.dragging;
2016
- 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;
2017
1967
  dragging.minDistance =
2018
1968
  minDistance != null ?
2019
1969
  minDistance :
@@ -2023,15 +1973,15 @@ var ExternalDraggable = /** @class */ (function () {
2023
1973
  (longPressDelay != null ? longPressDelay : common.BASE_OPTION_DEFAULTS.longPressDelay) :
2024
1974
  0;
2025
1975
  };
2026
- this.handleDragStart = function (ev) {
1976
+ this.handleDragStart = (ev) => {
2027
1977
  if (ev.isTouch &&
2028
- _this.dragging.delay &&
1978
+ this.dragging.delay &&
2029
1979
  ev.subjectEl.classList.contains('fc-event')) {
2030
- _this.dragging.mirror.getMirrorEl().classList.add('fc-event-selected');
1980
+ this.dragging.mirror.getMirrorEl().classList.add('fc-event-selected');
2031
1981
  }
2032
1982
  };
2033
1983
  this.settings = settings;
2034
- var dragging = this.dragging = new FeaturefulElementDragging(el);
1984
+ let dragging = this.dragging = new FeaturefulElementDragging(el);
2035
1985
  dragging.touchScrollAllowed = false;
2036
1986
  if (settings.itemSelector != null) {
2037
1987
  dragging.pointer.selector = settings.itemSelector;
@@ -2043,11 +1993,10 @@ var ExternalDraggable = /** @class */ (function () {
2043
1993
  dragging.emitter.on('dragstart', this.handleDragStart);
2044
1994
  new ExternalElementDragging(dragging, settings.eventData); // eslint-disable-line no-new
2045
1995
  }
2046
- ExternalDraggable.prototype.destroy = function () {
1996
+ destroy() {
2047
1997
  this.dragging.destroy();
2048
- };
2049
- return ExternalDraggable;
2050
- }());
1998
+ }
1999
+ }
2051
2000
 
2052
2001
  /*
2053
2002
  Detects when a *THIRD-PARTY* drag-n-drop system interacts with elements.
@@ -2055,45 +2004,43 @@ The third-party system is responsible for drawing the visuals effects of the dra
2055
2004
  This class simply monitors for pointer movements and fires events.
2056
2005
  It also has the ability to hide the moving element (the "mirror") during the drag.
2057
2006
  */
2058
- var InferredElementDragging = /** @class */ (function (_super) {
2059
- tslib.__extends(InferredElementDragging, _super);
2060
- function InferredElementDragging(containerEl) {
2061
- var _this = _super.call(this, containerEl) || this;
2062
- _this.shouldIgnoreMove = false;
2063
- _this.mirrorSelector = '';
2064
- _this.currentMirrorEl = null;
2065
- _this.handlePointerDown = function (ev) {
2066
- _this.emitter.trigger('pointerdown', ev);
2067
- 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) {
2068
2016
  // fire dragstart right away. does not support delay or min-distance
2069
- _this.emitter.trigger('dragstart', ev);
2017
+ this.emitter.trigger('dragstart', ev);
2070
2018
  }
2071
2019
  };
2072
- _this.handlePointerMove = function (ev) {
2073
- if (!_this.shouldIgnoreMove) {
2074
- _this.emitter.trigger('dragmove', ev);
2020
+ this.handlePointerMove = (ev) => {
2021
+ if (!this.shouldIgnoreMove) {
2022
+ this.emitter.trigger('dragmove', ev);
2075
2023
  }
2076
2024
  };
2077
- _this.handlePointerUp = function (ev) {
2078
- _this.emitter.trigger('pointerup', ev);
2079
- if (!_this.shouldIgnoreMove) {
2025
+ this.handlePointerUp = (ev) => {
2026
+ this.emitter.trigger('pointerup', ev);
2027
+ if (!this.shouldIgnoreMove) {
2080
2028
  // fire dragend right away. does not support a revert animation
2081
- _this.emitter.trigger('dragend', ev);
2029
+ this.emitter.trigger('dragend', ev);
2082
2030
  }
2083
2031
  };
2084
- var pointer = _this.pointer = new PointerDragging(containerEl);
2085
- pointer.emitter.on('pointerdown', _this.handlePointerDown);
2086
- pointer.emitter.on('pointermove', _this.handlePointerMove);
2087
- pointer.emitter.on('pointerup', _this.handlePointerUp);
2088
- 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);
2089
2036
  }
2090
- InferredElementDragging.prototype.destroy = function () {
2037
+ destroy() {
2091
2038
  this.pointer.destroy();
2092
- };
2093
- InferredElementDragging.prototype.setIgnoreMove = function (bool) {
2039
+ }
2040
+ setIgnoreMove(bool) {
2094
2041
  this.shouldIgnoreMove = bool;
2095
- };
2096
- InferredElementDragging.prototype.setMirrorIsVisible = function (bool) {
2042
+ }
2043
+ setMirrorIsVisible(bool) {
2097
2044
  if (bool) {
2098
2045
  // restore a previously hidden element.
2099
2046
  // use the reference in case the selector class has already been removed.
@@ -2103,7 +2050,7 @@ var InferredElementDragging = /** @class */ (function (_super) {
2103
2050
  }
2104
2051
  }
2105
2052
  else {
2106
- var mirrorEl = this.mirrorSelector
2053
+ let mirrorEl = this.mirrorSelector
2107
2054
  // TODO: somehow query FullCalendars WITHIN shadow-roots
2108
2055
  ? document.querySelector(this.mirrorSelector)
2109
2056
  : null;
@@ -2112,17 +2059,16 @@ var InferredElementDragging = /** @class */ (function (_super) {
2112
2059
  mirrorEl.style.visibility = 'hidden';
2113
2060
  }
2114
2061
  }
2115
- };
2116
- return InferredElementDragging;
2117
- }(common.ElementDragging));
2062
+ }
2063
+ }
2118
2064
 
2119
2065
  /*
2120
2066
  Bridges third-party drag-n-drop systems with FullCalendar.
2121
2067
  Must be instantiated and destroyed by caller.
2122
2068
  */
2123
- var ThirdPartyDraggable = /** @class */ (function () {
2124
- function ThirdPartyDraggable(containerOrSettings, settings) {
2125
- var containerEl = document;
2069
+ class ThirdPartyDraggable {
2070
+ constructor(containerOrSettings, settings) {
2071
+ let containerEl = document;
2126
2072
  if (
2127
2073
  // wish we could just test instanceof EventTarget, but doesn't work in IE11
2128
2074
  containerOrSettings === document ||
@@ -2133,7 +2079,7 @@ var ThirdPartyDraggable = /** @class */ (function () {
2133
2079
  else {
2134
2080
  settings = (containerOrSettings || {});
2135
2081
  }
2136
- var dragging = this.dragging = new InferredElementDragging(containerEl);
2082
+ let dragging = this.dragging = new InferredElementDragging(containerEl);
2137
2083
  if (typeof settings.itemSelector === 'string') {
2138
2084
  dragging.pointer.selector = settings.itemSelector;
2139
2085
  }
@@ -2145,11 +2091,10 @@ var ThirdPartyDraggable = /** @class */ (function () {
2145
2091
  }
2146
2092
  new ExternalElementDragging(dragging, settings.eventData); // eslint-disable-line no-new
2147
2093
  }
2148
- ThirdPartyDraggable.prototype.destroy = function () {
2094
+ destroy() {
2149
2095
  this.dragging.destroy();
2150
- };
2151
- return ThirdPartyDraggable;
2152
- }());
2096
+ }
2097
+ }
2153
2098
 
2154
2099
  var main = common.createPlugin({
2155
2100
  componentInteractions: [DateClicking, DateSelecting, EventDragging, EventResizing],