@fullcalendar/interaction 6.0.2 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{index.cjs → index.esm.js} +122 -128
- package/index.global.js +1 -1
- package/index.global.min.js +1 -1
- package/index.js +128 -122
- package/package.json +6 -8
- package/index.js.map +0 -1
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { createPlugin } from '@fullcalendar/core';
|
|
2
|
+
import { config, Emitter, elementClosest, applyStyle, whenTransitionDone, removeElement, ScrollController, ElementScrollController, computeInnerRect, WindowScrollController, getElRoot, ElementDragging, preventSelection, preventContextMenu, allowSelection, allowContextMenu, computeRect, getClippingParents, pointInsideRect, constrainPoint, intersectRects, getRectCenter, diffPoints, mapHash, rangeContainsRange, isDateSpansEqual, Interaction, interactionSettingsToStore, isDateSelectionValid, enableCursor, disableCursor, triggerDateSelect, compareNumbers, getElSeg, getRelevantEvents, EventImpl, createEmptyEventStore, applyMutationToEventStore, isInteractionValid, buildEventApis, interactionSettingsStore, startOfDay, diffDates, createDuration, getEventTargetViaRoot, identity, eventTupleToStore, parseDragMeta, elementMatches, refineEventDef, parseEventDef, getDefaultEventEnd, createEventInstance, BASE_OPTION_DEFAULTS } from '@fullcalendar/core/internal';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var index_cjs = require('@fullcalendar/core/index.cjs');
|
|
6
|
-
var internal_cjs = require('@fullcalendar/core/internal.cjs');
|
|
7
|
-
|
|
8
|
-
internal_cjs.config.touchMouseIgnoreWait = 500;
|
|
4
|
+
config.touchMouseIgnoreWait = 500;
|
|
9
5
|
let ignoreMouseDepth = 0;
|
|
10
6
|
let listenerCnt = 0;
|
|
11
7
|
let isWindowTouchMoveCancelled = false;
|
|
@@ -119,7 +115,7 @@ class PointerDragging {
|
|
|
119
115
|
}
|
|
120
116
|
};
|
|
121
117
|
this.containerEl = containerEl;
|
|
122
|
-
this.emitter = new
|
|
118
|
+
this.emitter = new Emitter();
|
|
123
119
|
containerEl.addEventListener('mousedown', this.handleMouseDown);
|
|
124
120
|
containerEl.addEventListener('touchstart', this.handleTouchStart, { passive: true });
|
|
125
121
|
listenerCreated();
|
|
@@ -133,7 +129,7 @@ class PointerDragging {
|
|
|
133
129
|
let subjectEl = this.querySubjectEl(ev);
|
|
134
130
|
let downEl = ev.target;
|
|
135
131
|
if (subjectEl &&
|
|
136
|
-
(!this.handleSelector ||
|
|
132
|
+
(!this.handleSelector || elementClosest(downEl, this.handleSelector))) {
|
|
137
133
|
this.subjectEl = subjectEl;
|
|
138
134
|
this.isDragging = true; // do this first so cancelTouchScroll will work
|
|
139
135
|
this.wasTouchScroll = false;
|
|
@@ -150,7 +146,7 @@ class PointerDragging {
|
|
|
150
146
|
}
|
|
151
147
|
querySubjectEl(ev) {
|
|
152
148
|
if (this.selector) {
|
|
153
|
-
return
|
|
149
|
+
return elementClosest(ev.target, this.selector);
|
|
154
150
|
}
|
|
155
151
|
return this.containerEl;
|
|
156
152
|
}
|
|
@@ -254,7 +250,7 @@ function startIgnoringMouse() {
|
|
|
254
250
|
ignoreMouseDepth += 1;
|
|
255
251
|
setTimeout(() => {
|
|
256
252
|
ignoreMouseDepth -= 1;
|
|
257
|
-
},
|
|
253
|
+
}, config.touchMouseIgnoreWait);
|
|
258
254
|
}
|
|
259
255
|
// We want to attach touchmove as early as possible for Safari
|
|
260
256
|
// ----------------------------------------------------------------------------------------------------
|
|
@@ -348,25 +344,25 @@ class ElementMirror {
|
|
|
348
344
|
mirrorEl.style.transition =
|
|
349
345
|
'top ' + revertDuration + 'ms,' +
|
|
350
346
|
'left ' + revertDuration + 'ms';
|
|
351
|
-
|
|
347
|
+
applyStyle(mirrorEl, {
|
|
352
348
|
left: finalSourceElRect.left,
|
|
353
349
|
top: finalSourceElRect.top,
|
|
354
350
|
});
|
|
355
|
-
|
|
351
|
+
whenTransitionDone(mirrorEl, () => {
|
|
356
352
|
mirrorEl.style.transition = '';
|
|
357
353
|
callback();
|
|
358
354
|
});
|
|
359
355
|
}
|
|
360
356
|
cleanup() {
|
|
361
357
|
if (this.mirrorEl) {
|
|
362
|
-
|
|
358
|
+
removeElement(this.mirrorEl);
|
|
363
359
|
this.mirrorEl = null;
|
|
364
360
|
}
|
|
365
361
|
this.sourceEl = null;
|
|
366
362
|
}
|
|
367
363
|
updateElPosition() {
|
|
368
364
|
if (this.sourceEl && this.isVisible) {
|
|
369
|
-
|
|
365
|
+
applyStyle(this.getMirrorEl(), {
|
|
370
366
|
left: this.sourceElRect.left + this.deltaX,
|
|
371
367
|
top: this.sourceElRect.top + this.deltaY,
|
|
372
368
|
});
|
|
@@ -381,7 +377,7 @@ class ElementMirror {
|
|
|
381
377
|
// would use preventSelection(), but that prevents selectstart, causing problems.
|
|
382
378
|
mirrorEl.classList.add('fc-unselectable');
|
|
383
379
|
mirrorEl.classList.add('fc-event-dragging');
|
|
384
|
-
|
|
380
|
+
applyStyle(mirrorEl, {
|
|
385
381
|
position: 'fixed',
|
|
386
382
|
zIndex: this.zIndex,
|
|
387
383
|
visibility: '',
|
|
@@ -406,7 +402,7 @@ The cache can be in one of two modes:
|
|
|
406
402
|
- doesListening:false - ignores when the container is scrolled by someone else
|
|
407
403
|
- doesListening:true - watch for scrolling and update the cache
|
|
408
404
|
*/
|
|
409
|
-
class ScrollGeomCache extends
|
|
405
|
+
class ScrollGeomCache extends ScrollController {
|
|
410
406
|
constructor(scrollController, doesListening) {
|
|
411
407
|
super();
|
|
412
408
|
this.handleScroll = () => {
|
|
@@ -474,19 +470,19 @@ class ScrollGeomCache extends internal_cjs.ScrollController {
|
|
|
474
470
|
|
|
475
471
|
class ElementScrollGeomCache extends ScrollGeomCache {
|
|
476
472
|
constructor(el, doesListening) {
|
|
477
|
-
super(new
|
|
473
|
+
super(new ElementScrollController(el), doesListening);
|
|
478
474
|
}
|
|
479
475
|
getEventTarget() {
|
|
480
476
|
return this.scrollController.el;
|
|
481
477
|
}
|
|
482
478
|
computeClientRect() {
|
|
483
|
-
return
|
|
479
|
+
return computeInnerRect(this.scrollController.el);
|
|
484
480
|
}
|
|
485
481
|
}
|
|
486
482
|
|
|
487
483
|
class WindowScrollGeomCache extends ScrollGeomCache {
|
|
488
484
|
constructor(doesListening) {
|
|
489
|
-
super(new
|
|
485
|
+
super(new WindowScrollController(), doesListening);
|
|
490
486
|
}
|
|
491
487
|
getEventTarget() {
|
|
492
488
|
return window;
|
|
@@ -669,7 +665,7 @@ class AutoScroller {
|
|
|
669
665
|
els.push(query);
|
|
670
666
|
}
|
|
671
667
|
else {
|
|
672
|
-
els.push(...Array.prototype.slice.call(
|
|
668
|
+
els.push(...Array.prototype.slice.call(getElRoot(scrollStartEl).querySelectorAll(query)));
|
|
673
669
|
}
|
|
674
670
|
}
|
|
675
671
|
return els;
|
|
@@ -682,7 +678,7 @@ Monitors dragging on an element. Has a number of high-level features:
|
|
|
682
678
|
- minimum wait time ("delay") before dragging
|
|
683
679
|
- a mirror element that follows the pointer
|
|
684
680
|
*/
|
|
685
|
-
class FeaturefulElementDragging extends
|
|
681
|
+
class FeaturefulElementDragging extends ElementDragging {
|
|
686
682
|
constructor(containerEl, selector) {
|
|
687
683
|
super(containerEl);
|
|
688
684
|
this.containerEl = containerEl;
|
|
@@ -702,8 +698,8 @@ class FeaturefulElementDragging extends internal_cjs.ElementDragging {
|
|
|
702
698
|
this.isInteracting = true;
|
|
703
699
|
this.isDelayEnded = false;
|
|
704
700
|
this.isDistanceSurpassed = false;
|
|
705
|
-
|
|
706
|
-
|
|
701
|
+
preventSelection(document.body);
|
|
702
|
+
preventContextMenu(document.body);
|
|
707
703
|
// prevent links from being visited if there's an eventual drag.
|
|
708
704
|
// also prevents selection in older browsers (maybe?).
|
|
709
705
|
// not necessary for touch, besides, browser would complain about passiveness.
|
|
@@ -748,8 +744,8 @@ class FeaturefulElementDragging extends internal_cjs.ElementDragging {
|
|
|
748
744
|
this.onPointerUp = (ev) => {
|
|
749
745
|
if (this.isInteracting) {
|
|
750
746
|
this.isInteracting = false;
|
|
751
|
-
|
|
752
|
-
|
|
747
|
+
allowSelection(document.body);
|
|
748
|
+
allowContextMenu(document.body);
|
|
753
749
|
this.emitter.trigger('pointerup', ev); // can potentially set mirrorNeedsRevert
|
|
754
750
|
if (this.isDragging) {
|
|
755
751
|
this.autoScroller.stop();
|
|
@@ -843,9 +839,9 @@ and an determine if a given point is inside the combined clipping rectangle.
|
|
|
843
839
|
*/
|
|
844
840
|
class OffsetTracker {
|
|
845
841
|
constructor(el) {
|
|
846
|
-
this.origRect =
|
|
842
|
+
this.origRect = computeRect(el);
|
|
847
843
|
// will work fine for divs that have overflow:hidden
|
|
848
|
-
this.scrollCaches =
|
|
844
|
+
this.scrollCaches = getClippingParents(el).map((scrollEl) => new ElementScrollGeomCache(scrollEl, true));
|
|
849
845
|
}
|
|
850
846
|
destroy() {
|
|
851
847
|
for (let scrollCache of this.scrollCaches) {
|
|
@@ -870,7 +866,7 @@ class OffsetTracker {
|
|
|
870
866
|
let point = { left: pageX, top: pageY };
|
|
871
867
|
for (let scrollCache of this.scrollCaches) {
|
|
872
868
|
if (!isIgnoredClipping(scrollCache.getEventTarget()) &&
|
|
873
|
-
!
|
|
869
|
+
!pointInsideRect(point, scrollCache.clientRect)) {
|
|
874
870
|
return false;
|
|
875
871
|
}
|
|
876
872
|
}
|
|
@@ -948,7 +944,7 @@ class HitDragging {
|
|
|
948
944
|
dragging.emitter.on('pointerup', this.handlePointerUp);
|
|
949
945
|
dragging.emitter.on('dragend', this.handleDragEnd);
|
|
950
946
|
this.dragging = dragging;
|
|
951
|
-
this.emitter = new
|
|
947
|
+
this.emitter = new Emitter();
|
|
952
948
|
}
|
|
953
949
|
// sets initialHit
|
|
954
950
|
// sets coordAdjust
|
|
@@ -958,18 +954,18 @@ class HitDragging {
|
|
|
958
954
|
let subjectEl = ev.subjectEl;
|
|
959
955
|
let subjectRect;
|
|
960
956
|
if (subjectEl instanceof HTMLElement) { // i.e. not a Document/ShadowRoot
|
|
961
|
-
subjectRect =
|
|
962
|
-
adjustedPoint =
|
|
957
|
+
subjectRect = computeRect(subjectEl);
|
|
958
|
+
adjustedPoint = constrainPoint(adjustedPoint, subjectRect);
|
|
963
959
|
}
|
|
964
960
|
let initialHit = this.initialHit = this.queryHitForOffset(adjustedPoint.left, adjustedPoint.top);
|
|
965
961
|
if (initialHit) {
|
|
966
962
|
if (this.useSubjectCenter && subjectRect) {
|
|
967
|
-
let slicedSubjectRect =
|
|
963
|
+
let slicedSubjectRect = intersectRects(subjectRect, initialHit.rect);
|
|
968
964
|
if (slicedSubjectRect) {
|
|
969
|
-
adjustedPoint =
|
|
965
|
+
adjustedPoint = getRectCenter(slicedSubjectRect);
|
|
970
966
|
}
|
|
971
967
|
}
|
|
972
|
-
this.coordAdjust =
|
|
968
|
+
this.coordAdjust = diffPoints(adjustedPoint, origPoint);
|
|
973
969
|
}
|
|
974
970
|
else {
|
|
975
971
|
this.coordAdjust = { left: 0, top: 0 };
|
|
@@ -983,7 +979,7 @@ class HitDragging {
|
|
|
983
979
|
}
|
|
984
980
|
}
|
|
985
981
|
prepareHits() {
|
|
986
|
-
this.offsetTrackers =
|
|
982
|
+
this.offsetTrackers = mapHash(this.droppableStore, (interactionSettings) => {
|
|
987
983
|
interactionSettings.component.prepareHits();
|
|
988
984
|
return new OffsetTracker(interactionSettings.el);
|
|
989
985
|
});
|
|
@@ -1017,7 +1013,7 @@ class HitDragging {
|
|
|
1017
1013
|
let hit = component.queryHit(positionLeft, positionTop, width, height);
|
|
1018
1014
|
if (hit && (
|
|
1019
1015
|
// make sure the hit is within activeRange, meaning it's not a dead cell
|
|
1020
|
-
|
|
1016
|
+
rangeContainsRange(hit.dateProfile.activeRange, hit.dateSpan.range)) &&
|
|
1021
1017
|
(!bestHit || hit.layer > bestHit.layer)) {
|
|
1022
1018
|
hit.componentId = id;
|
|
1023
1019
|
hit.context = component.context;
|
|
@@ -1041,7 +1037,7 @@ function isHitsEqual(hit0, hit1) {
|
|
|
1041
1037
|
if (Boolean(hit0) !== Boolean(hit1)) {
|
|
1042
1038
|
return false;
|
|
1043
1039
|
}
|
|
1044
|
-
return
|
|
1040
|
+
return isDateSpansEqual(hit0.dateSpan, hit1.dateSpan);
|
|
1045
1041
|
}
|
|
1046
1042
|
|
|
1047
1043
|
function buildDatePointApiWithContext(dateSpan, context) {
|
|
@@ -1064,7 +1060,7 @@ function buildDatePointApi(span, dateEnv) {
|
|
|
1064
1060
|
Monitors when the user clicks on a specific date/time of a component.
|
|
1065
1061
|
A pointerdown+pointerup on the same "hit" constitutes a click.
|
|
1066
1062
|
*/
|
|
1067
|
-
class DateClicking extends
|
|
1063
|
+
class DateClicking extends Interaction {
|
|
1068
1064
|
constructor(settings) {
|
|
1069
1065
|
super(settings);
|
|
1070
1066
|
this.handlePointerDown = (pev) => {
|
|
@@ -1089,7 +1085,7 @@ class DateClicking extends internal_cjs.Interaction {
|
|
|
1089
1085
|
// we DO want to watch pointer moves because otherwise finalHit won't get populated
|
|
1090
1086
|
this.dragging = new FeaturefulElementDragging(settings.el);
|
|
1091
1087
|
this.dragging.autoScroller.isEnabled = false;
|
|
1092
|
-
let hitDragging = this.hitDragging = new HitDragging(this.dragging,
|
|
1088
|
+
let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings));
|
|
1093
1089
|
hitDragging.emitter.on('pointerdown', this.handlePointerDown);
|
|
1094
1090
|
hitDragging.emitter.on('dragend', this.handleDragEnd);
|
|
1095
1091
|
}
|
|
@@ -1102,7 +1098,7 @@ class DateClicking extends internal_cjs.Interaction {
|
|
|
1102
1098
|
Tracks when the user selects a portion of time of a component,
|
|
1103
1099
|
constituted by a drag over date cells, with a possible delay at the beginning of the drag.
|
|
1104
1100
|
*/
|
|
1105
|
-
class DateSelecting extends
|
|
1101
|
+
class DateSelecting extends Interaction {
|
|
1106
1102
|
constructor(settings) {
|
|
1107
1103
|
super(settings);
|
|
1108
1104
|
this.dragSelection = null;
|
|
@@ -1131,7 +1127,7 @@ class DateSelecting extends internal_cjs.Interaction {
|
|
|
1131
1127
|
if (!disallowed) {
|
|
1132
1128
|
dragSelection = joinHitsIntoSelection(initialHit, hit, context.pluginHooks.dateSelectionTransformers);
|
|
1133
1129
|
}
|
|
1134
|
-
if (!dragSelection || !
|
|
1130
|
+
if (!dragSelection || !isDateSelectionValid(dragSelection, hit.dateProfile, context)) {
|
|
1135
1131
|
isInvalid = true;
|
|
1136
1132
|
dragSelection = null;
|
|
1137
1133
|
}
|
|
@@ -1143,10 +1139,10 @@ class DateSelecting extends internal_cjs.Interaction {
|
|
|
1143
1139
|
context.dispatch({ type: 'UNSELECT_DATES' });
|
|
1144
1140
|
}
|
|
1145
1141
|
if (!isInvalid) {
|
|
1146
|
-
|
|
1142
|
+
enableCursor();
|
|
1147
1143
|
}
|
|
1148
1144
|
else {
|
|
1149
|
-
|
|
1145
|
+
disableCursor();
|
|
1150
1146
|
}
|
|
1151
1147
|
if (!isFinal) {
|
|
1152
1148
|
this.dragSelection = dragSelection; // only clear if moved away from all hits while dragging
|
|
@@ -1155,7 +1151,7 @@ class DateSelecting extends internal_cjs.Interaction {
|
|
|
1155
1151
|
this.handlePointerUp = (pev) => {
|
|
1156
1152
|
if (this.dragSelection) {
|
|
1157
1153
|
// selection is already rendered, so just need to report selection
|
|
1158
|
-
|
|
1154
|
+
triggerDateSelect(this.dragSelection, pev, this.component.context);
|
|
1159
1155
|
this.dragSelection = null;
|
|
1160
1156
|
}
|
|
1161
1157
|
};
|
|
@@ -1165,7 +1161,7 @@ class DateSelecting extends internal_cjs.Interaction {
|
|
|
1165
1161
|
dragging.touchScrollAllowed = false;
|
|
1166
1162
|
dragging.minDistance = options.selectMinDistance || 0;
|
|
1167
1163
|
dragging.autoScroller.isEnabled = options.dragScroll;
|
|
1168
|
-
let hitDragging = this.hitDragging = new HitDragging(this.dragging,
|
|
1164
|
+
let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings));
|
|
1169
1165
|
hitDragging.emitter.on('pointerdown', this.handlePointerDown);
|
|
1170
1166
|
hitDragging.emitter.on('dragstart', this.handleDragStart);
|
|
1171
1167
|
hitDragging.emitter.on('hitupdate', this.handleHitUpdate);
|
|
@@ -1192,7 +1188,7 @@ function joinHitsIntoSelection(hit0, hit1, dateSelectionTransformers) {
|
|
|
1192
1188
|
dateSpan1.range.start,
|
|
1193
1189
|
dateSpan1.range.end,
|
|
1194
1190
|
];
|
|
1195
|
-
ms.sort(
|
|
1191
|
+
ms.sort(compareNumbers);
|
|
1196
1192
|
let props = {};
|
|
1197
1193
|
for (let transformer of dateSelectionTransformers) {
|
|
1198
1194
|
let res = transformer(hit0, hit1);
|
|
@@ -1208,7 +1204,7 @@ function joinHitsIntoSelection(hit0, hit1, dateSelectionTransformers) {
|
|
|
1208
1204
|
return props;
|
|
1209
1205
|
}
|
|
1210
1206
|
|
|
1211
|
-
class EventDragging extends
|
|
1207
|
+
class EventDragging extends Interaction {
|
|
1212
1208
|
constructor(settings) {
|
|
1213
1209
|
super(settings);
|
|
1214
1210
|
// internal state
|
|
@@ -1227,10 +1223,10 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1227
1223
|
let { options } = component.context;
|
|
1228
1224
|
let initialContext = component.context;
|
|
1229
1225
|
this.subjectEl = ev.subjectEl;
|
|
1230
|
-
let subjectSeg = this.subjectSeg =
|
|
1226
|
+
let subjectSeg = this.subjectSeg = getElSeg(ev.subjectEl);
|
|
1231
1227
|
let eventRange = this.eventRange = subjectSeg.eventRange;
|
|
1232
1228
|
let eventInstanceId = eventRange.instance.instanceId;
|
|
1233
|
-
this.relevantEvents =
|
|
1229
|
+
this.relevantEvents = getRelevantEvents(initialContext.getCurrentData().eventStore, eventInstanceId);
|
|
1234
1230
|
dragging.minDistance = ev.isTouch ? 0 : options.eventDragMinDistance;
|
|
1235
1231
|
dragging.delay =
|
|
1236
1232
|
// only do a touch delay if touch and this event hasn't been selected yet
|
|
@@ -1241,11 +1237,11 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1241
1237
|
mirror.parentNode = options.fixedMirrorParent;
|
|
1242
1238
|
}
|
|
1243
1239
|
else {
|
|
1244
|
-
mirror.parentNode =
|
|
1240
|
+
mirror.parentNode = elementClosest(origTarget, '.fc');
|
|
1245
1241
|
}
|
|
1246
1242
|
mirror.revertDuration = options.dragRevertDuration;
|
|
1247
1243
|
let isValid = component.isValidSegDownEl(origTarget) &&
|
|
1248
|
-
!
|
|
1244
|
+
!elementClosest(origTarget, '.fc-event-resizer'); // NOT on a resizer
|
|
1249
1245
|
dragging.setIgnoreMove(!isValid);
|
|
1250
1246
|
// disable dragging for elements that are resizable (ie, selectable)
|
|
1251
1247
|
// but are not draggable
|
|
@@ -1270,7 +1266,7 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1270
1266
|
initialContext.calendarApi.unselect(ev); // unselect *date* selection
|
|
1271
1267
|
initialContext.emitter.trigger('eventDragStart', {
|
|
1272
1268
|
el: this.subjectEl,
|
|
1273
|
-
event: new
|
|
1269
|
+
event: new EventImpl(initialContext, eventRange.def, eventRange.instance),
|
|
1274
1270
|
jsEvent: ev.origEvent,
|
|
1275
1271
|
view: initialContext.viewApi,
|
|
1276
1272
|
});
|
|
@@ -1290,7 +1286,7 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1290
1286
|
let isInvalid = false;
|
|
1291
1287
|
let interaction = {
|
|
1292
1288
|
affectedEvents: relevantEvents,
|
|
1293
|
-
mutatedEvents:
|
|
1289
|
+
mutatedEvents: createEmptyEventStore(),
|
|
1294
1290
|
isEvent: true,
|
|
1295
1291
|
};
|
|
1296
1292
|
if (hit) {
|
|
@@ -1300,13 +1296,13 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1300
1296
|
(receivingOptions.editable && receivingOptions.droppable)) {
|
|
1301
1297
|
mutation = computeEventMutation(initialHit, hit, receivingContext.getCurrentData().pluginHooks.eventDragMutationMassagers);
|
|
1302
1298
|
if (mutation) {
|
|
1303
|
-
mutatedRelevantEvents =
|
|
1299
|
+
mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, receivingContext.getCurrentData().eventUiBases, mutation, receivingContext);
|
|
1304
1300
|
interaction.mutatedEvents = mutatedRelevantEvents;
|
|
1305
|
-
if (!
|
|
1301
|
+
if (!isInteractionValid(interaction, hit.dateProfile, receivingContext)) {
|
|
1306
1302
|
isInvalid = true;
|
|
1307
1303
|
mutation = null;
|
|
1308
1304
|
mutatedRelevantEvents = null;
|
|
1309
|
-
interaction.mutatedEvents =
|
|
1305
|
+
interaction.mutatedEvents = createEmptyEventStore();
|
|
1310
1306
|
}
|
|
1311
1307
|
}
|
|
1312
1308
|
}
|
|
@@ -1316,10 +1312,10 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1316
1312
|
}
|
|
1317
1313
|
this.displayDrag(receivingContext, interaction);
|
|
1318
1314
|
if (!isInvalid) {
|
|
1319
|
-
|
|
1315
|
+
enableCursor();
|
|
1320
1316
|
}
|
|
1321
1317
|
else {
|
|
1322
|
-
|
|
1318
|
+
disableCursor();
|
|
1323
1319
|
}
|
|
1324
1320
|
if (!isFinal) {
|
|
1325
1321
|
if (initialContext === receivingContext && // TODO: write test for this
|
|
@@ -1329,7 +1325,7 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1329
1325
|
this.dragging.setMirrorNeedsRevert(!mutation);
|
|
1330
1326
|
// render the mirror if no already-rendered mirror
|
|
1331
1327
|
// TODO: wish we could somehow wait for dispatch to guarantee render
|
|
1332
|
-
this.dragging.setMirrorIsVisible(!hit || !
|
|
1328
|
+
this.dragging.setMirrorIsVisible(!hit || !getElRoot(this.subjectEl).querySelector('.fc-event-mirror'));
|
|
1333
1329
|
// assign states based on new hit
|
|
1334
1330
|
this.receivingContext = receivingContext;
|
|
1335
1331
|
this.validMutation = mutation;
|
|
@@ -1348,7 +1344,7 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1348
1344
|
let { receivingContext, validMutation } = this;
|
|
1349
1345
|
let eventDef = this.eventRange.def;
|
|
1350
1346
|
let eventInstance = this.eventRange.instance;
|
|
1351
|
-
let eventApi = new
|
|
1347
|
+
let eventApi = new EventImpl(initialContext, eventDef, eventInstance);
|
|
1352
1348
|
let relevantEvents = this.relevantEvents;
|
|
1353
1349
|
let mutatedRelevantEvents = this.mutatedRelevantEvents;
|
|
1354
1350
|
let { finalHit } = this.hitDragging;
|
|
@@ -1362,7 +1358,7 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1362
1358
|
if (validMutation) {
|
|
1363
1359
|
// dropped within same calendar
|
|
1364
1360
|
if (receivingContext === initialContext) {
|
|
1365
|
-
let updatedEventApi = new
|
|
1361
|
+
let updatedEventApi = new EventImpl(initialContext, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null);
|
|
1366
1362
|
initialContext.dispatch({
|
|
1367
1363
|
type: 'MERGE_EVENTS',
|
|
1368
1364
|
eventStore: mutatedRelevantEvents,
|
|
@@ -1370,7 +1366,7 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1370
1366
|
let eventChangeArg = {
|
|
1371
1367
|
oldEvent: eventApi,
|
|
1372
1368
|
event: updatedEventApi,
|
|
1373
|
-
relatedEvents:
|
|
1369
|
+
relatedEvents: buildEventApis(mutatedRelevantEvents, initialContext, eventInstance),
|
|
1374
1370
|
revert() {
|
|
1375
1371
|
initialContext.dispatch({
|
|
1376
1372
|
type: 'MERGE_EVENTS',
|
|
@@ -1389,7 +1385,7 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1389
1385
|
else if (receivingContext) {
|
|
1390
1386
|
let eventRemoveArg = {
|
|
1391
1387
|
event: eventApi,
|
|
1392
|
-
relatedEvents:
|
|
1388
|
+
relatedEvents: buildEventApis(relevantEvents, initialContext, eventInstance),
|
|
1393
1389
|
revert() {
|
|
1394
1390
|
initialContext.dispatch({
|
|
1395
1391
|
type: 'MERGE_EVENTS',
|
|
@@ -1405,14 +1401,14 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1405
1401
|
initialContext.emitter.trigger('eventRemove', eventRemoveArg);
|
|
1406
1402
|
let addedEventDef = mutatedRelevantEvents.defs[eventDef.defId];
|
|
1407
1403
|
let addedEventInstance = mutatedRelevantEvents.instances[eventInstance.instanceId];
|
|
1408
|
-
let addedEventApi = new
|
|
1404
|
+
let addedEventApi = new EventImpl(receivingContext, addedEventDef, addedEventInstance);
|
|
1409
1405
|
receivingContext.dispatch({
|
|
1410
1406
|
type: 'MERGE_EVENTS',
|
|
1411
1407
|
eventStore: mutatedRelevantEvents,
|
|
1412
1408
|
});
|
|
1413
1409
|
let eventAddArg = {
|
|
1414
1410
|
event: addedEventApi,
|
|
1415
|
-
relatedEvents:
|
|
1411
|
+
relatedEvents: buildEventApis(mutatedRelevantEvents, receivingContext, addedEventInstance),
|
|
1416
1412
|
revert() {
|
|
1417
1413
|
receivingContext.dispatch({
|
|
1418
1414
|
type: 'REMOVE_EVENTS',
|
|
@@ -1443,7 +1439,7 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1443
1439
|
dragging.pointer.selector = EventDragging.SELECTOR;
|
|
1444
1440
|
dragging.touchScrollAllowed = false;
|
|
1445
1441
|
dragging.autoScroller.isEnabled = options.dragScroll;
|
|
1446
|
-
let hitDragging = this.hitDragging = new HitDragging(this.dragging,
|
|
1442
|
+
let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsStore);
|
|
1447
1443
|
hitDragging.useSubjectCenter = settings.useEventCenter;
|
|
1448
1444
|
hitDragging.emitter.on('pointerdown', this.handlePointerDown);
|
|
1449
1445
|
hitDragging.emitter.on('dragstart', this.handleDragStart);
|
|
@@ -1467,7 +1463,7 @@ class EventDragging extends internal_cjs.Interaction {
|
|
|
1467
1463
|
type: 'SET_EVENT_DRAG',
|
|
1468
1464
|
state: {
|
|
1469
1465
|
affectedEvents: state.affectedEvents,
|
|
1470
|
-
mutatedEvents:
|
|
1466
|
+
mutatedEvents: createEmptyEventStore(),
|
|
1471
1467
|
isEvent: true,
|
|
1472
1468
|
},
|
|
1473
1469
|
});
|
|
@@ -1517,10 +1513,10 @@ function computeEventMutation(hit0, hit1, massagers) {
|
|
|
1517
1513
|
if (dateSpan1.allDay) {
|
|
1518
1514
|
// means date1 is already start-of-day,
|
|
1519
1515
|
// but date0 needs to be converted
|
|
1520
|
-
date0 =
|
|
1516
|
+
date0 = startOfDay(date0);
|
|
1521
1517
|
}
|
|
1522
1518
|
}
|
|
1523
|
-
let delta =
|
|
1519
|
+
let delta = diffDates(date0, date1, hit0.context.dateEnv, hit0.componentId === hit1.componentId ?
|
|
1524
1520
|
hit0.largeUnit :
|
|
1525
1521
|
null);
|
|
1526
1522
|
if (delta.milliseconds) { // has hours/minutes/seconds
|
|
@@ -1544,7 +1540,7 @@ function getComponentTouchDelay(component) {
|
|
|
1544
1540
|
return delay;
|
|
1545
1541
|
}
|
|
1546
1542
|
|
|
1547
|
-
class EventResizing extends
|
|
1543
|
+
class EventResizing extends Interaction {
|
|
1548
1544
|
constructor(settings) {
|
|
1549
1545
|
super(settings);
|
|
1550
1546
|
// internal state
|
|
@@ -1557,7 +1553,7 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1557
1553
|
this.handlePointerDown = (ev) => {
|
|
1558
1554
|
let { component } = this;
|
|
1559
1555
|
let segEl = this.querySegEl(ev);
|
|
1560
|
-
let seg =
|
|
1556
|
+
let seg = getElSeg(segEl);
|
|
1561
1557
|
let eventRange = this.eventRange = seg.eventRange;
|
|
1562
1558
|
this.dragging.minDistance = component.context.options.eventDragMinDistance;
|
|
1563
1559
|
// if touch, need to be working with a selected event
|
|
@@ -1567,14 +1563,14 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1567
1563
|
this.handleDragStart = (ev) => {
|
|
1568
1564
|
let { context } = this.component;
|
|
1569
1565
|
let eventRange = this.eventRange;
|
|
1570
|
-
this.relevantEvents =
|
|
1566
|
+
this.relevantEvents = getRelevantEvents(context.getCurrentData().eventStore, this.eventRange.instance.instanceId);
|
|
1571
1567
|
let segEl = this.querySegEl(ev);
|
|
1572
1568
|
this.draggingSegEl = segEl;
|
|
1573
|
-
this.draggingSeg =
|
|
1569
|
+
this.draggingSeg = getElSeg(segEl);
|
|
1574
1570
|
context.calendarApi.unselect();
|
|
1575
1571
|
context.emitter.trigger('eventResizeStart', {
|
|
1576
1572
|
el: segEl,
|
|
1577
|
-
event: new
|
|
1573
|
+
event: new EventImpl(context, eventRange.def, eventRange.instance),
|
|
1578
1574
|
jsEvent: ev.origEvent,
|
|
1579
1575
|
view: context.viewApi,
|
|
1580
1576
|
});
|
|
@@ -1589,7 +1585,7 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1589
1585
|
let isInvalid = false;
|
|
1590
1586
|
let interaction = {
|
|
1591
1587
|
affectedEvents: relevantEvents,
|
|
1592
|
-
mutatedEvents:
|
|
1588
|
+
mutatedEvents: createEmptyEventStore(),
|
|
1593
1589
|
isEvent: true,
|
|
1594
1590
|
};
|
|
1595
1591
|
if (hit) {
|
|
@@ -1601,9 +1597,9 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1601
1597
|
}
|
|
1602
1598
|
}
|
|
1603
1599
|
if (mutation) {
|
|
1604
|
-
mutatedRelevantEvents =
|
|
1600
|
+
mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, context.getCurrentData().eventUiBases, mutation, context);
|
|
1605
1601
|
interaction.mutatedEvents = mutatedRelevantEvents;
|
|
1606
|
-
if (!
|
|
1602
|
+
if (!isInteractionValid(interaction, hit.dateProfile, context)) {
|
|
1607
1603
|
isInvalid = true;
|
|
1608
1604
|
mutation = null;
|
|
1609
1605
|
mutatedRelevantEvents = null;
|
|
@@ -1620,10 +1616,10 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1620
1616
|
context.dispatch({ type: 'UNSET_EVENT_RESIZE' });
|
|
1621
1617
|
}
|
|
1622
1618
|
if (!isInvalid) {
|
|
1623
|
-
|
|
1619
|
+
enableCursor();
|
|
1624
1620
|
}
|
|
1625
1621
|
else {
|
|
1626
|
-
|
|
1622
|
+
disableCursor();
|
|
1627
1623
|
}
|
|
1628
1624
|
if (!isFinal) {
|
|
1629
1625
|
if (mutation && isHitsEqual(initialHit, hit)) {
|
|
@@ -1637,7 +1633,7 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1637
1633
|
let { context } = this.component;
|
|
1638
1634
|
let eventDef = this.eventRange.def;
|
|
1639
1635
|
let eventInstance = this.eventRange.instance;
|
|
1640
|
-
let eventApi = new
|
|
1636
|
+
let eventApi = new EventImpl(context, eventDef, eventInstance);
|
|
1641
1637
|
let relevantEvents = this.relevantEvents;
|
|
1642
1638
|
let mutatedRelevantEvents = this.mutatedRelevantEvents;
|
|
1643
1639
|
context.emitter.trigger('eventResizeStop', {
|
|
@@ -1647,7 +1643,7 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1647
1643
|
view: context.viewApi,
|
|
1648
1644
|
});
|
|
1649
1645
|
if (this.validMutation) {
|
|
1650
|
-
let updatedEventApi = new
|
|
1646
|
+
let updatedEventApi = new EventImpl(context, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null);
|
|
1651
1647
|
context.dispatch({
|
|
1652
1648
|
type: 'MERGE_EVENTS',
|
|
1653
1649
|
eventStore: mutatedRelevantEvents,
|
|
@@ -1655,7 +1651,7 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1655
1651
|
let eventChangeArg = {
|
|
1656
1652
|
oldEvent: eventApi,
|
|
1657
1653
|
event: updatedEventApi,
|
|
1658
|
-
relatedEvents:
|
|
1654
|
+
relatedEvents: buildEventApis(mutatedRelevantEvents, context, eventInstance),
|
|
1659
1655
|
revert() {
|
|
1660
1656
|
context.dispatch({
|
|
1661
1657
|
type: 'MERGE_EVENTS',
|
|
@@ -1663,7 +1659,7 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1663
1659
|
});
|
|
1664
1660
|
},
|
|
1665
1661
|
};
|
|
1666
|
-
context.emitter.trigger('eventResize', Object.assign(Object.assign({}, eventChangeArg), { el: this.draggingSegEl, startDelta: this.validMutation.startDelta ||
|
|
1662
|
+
context.emitter.trigger('eventResize', Object.assign(Object.assign({}, eventChangeArg), { el: this.draggingSegEl, startDelta: this.validMutation.startDelta || createDuration(0), endDelta: this.validMutation.endDelta || createDuration(0), jsEvent: ev.origEvent, view: context.viewApi }));
|
|
1667
1663
|
context.emitter.trigger('eventChange', eventChangeArg);
|
|
1668
1664
|
}
|
|
1669
1665
|
else {
|
|
@@ -1680,7 +1676,7 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1680
1676
|
dragging.pointer.selector = '.fc-event-resizer';
|
|
1681
1677
|
dragging.touchScrollAllowed = false;
|
|
1682
1678
|
dragging.autoScroller.isEnabled = component.context.options.dragScroll;
|
|
1683
|
-
let hitDragging = this.hitDragging = new HitDragging(this.dragging,
|
|
1679
|
+
let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings));
|
|
1684
1680
|
hitDragging.emitter.on('pointerdown', this.handlePointerDown);
|
|
1685
1681
|
hitDragging.emitter.on('dragstart', this.handleDragStart);
|
|
1686
1682
|
hitDragging.emitter.on('hitupdate', this.handleHitUpdate);
|
|
@@ -1690,14 +1686,14 @@ class EventResizing extends internal_cjs.Interaction {
|
|
|
1690
1686
|
this.dragging.destroy();
|
|
1691
1687
|
}
|
|
1692
1688
|
querySegEl(ev) {
|
|
1693
|
-
return
|
|
1689
|
+
return elementClosest(ev.subjectEl, '.fc-event');
|
|
1694
1690
|
}
|
|
1695
1691
|
}
|
|
1696
1692
|
function computeMutation(hit0, hit1, isFromStart, instanceRange) {
|
|
1697
1693
|
let dateEnv = hit0.context.dateEnv;
|
|
1698
1694
|
let date0 = hit0.dateSpan.range.start;
|
|
1699
1695
|
let date1 = hit1.dateSpan.range.start;
|
|
1700
|
-
let delta =
|
|
1696
|
+
let delta = diffDates(date0, date1, dateEnv, hit0.largeUnit);
|
|
1701
1697
|
if (isFromStart) {
|
|
1702
1698
|
if (dateEnv.add(instanceRange.start, delta) < instanceRange.end) {
|
|
1703
1699
|
return { startDelta: delta };
|
|
@@ -1722,9 +1718,9 @@ class UnselectAuto {
|
|
|
1722
1718
|
};
|
|
1723
1719
|
this.onDocumentPointerDown = (pev) => {
|
|
1724
1720
|
let unselectCancel = this.context.options.unselectCancel;
|
|
1725
|
-
let downEl =
|
|
1726
|
-
this.matchesCancel = !!
|
|
1727
|
-
this.matchesEvent = !!
|
|
1721
|
+
let downEl = getEventTargetViaRoot(pev.origEvent);
|
|
1722
|
+
this.matchesCancel = !!elementClosest(downEl, unselectCancel);
|
|
1723
|
+
this.matchesEvent = !!elementClosest(downEl, EventDragging.SELECTOR); // interaction started on an event?
|
|
1728
1724
|
};
|
|
1729
1725
|
this.onDocumentPointerUp = (pev) => {
|
|
1730
1726
|
let { context } = this;
|
|
@@ -1765,19 +1761,19 @@ class UnselectAuto {
|
|
|
1765
1761
|
}
|
|
1766
1762
|
|
|
1767
1763
|
const OPTION_REFINERS = {
|
|
1768
|
-
fixedMirrorParent:
|
|
1764
|
+
fixedMirrorParent: identity,
|
|
1769
1765
|
};
|
|
1770
1766
|
const LISTENER_REFINERS = {
|
|
1771
|
-
dateClick:
|
|
1772
|
-
eventDragStart:
|
|
1773
|
-
eventDragStop:
|
|
1774
|
-
eventDrop:
|
|
1775
|
-
eventResizeStart:
|
|
1776
|
-
eventResizeStop:
|
|
1777
|
-
eventResize:
|
|
1778
|
-
drop:
|
|
1779
|
-
eventReceive:
|
|
1780
|
-
eventLeave:
|
|
1767
|
+
dateClick: identity,
|
|
1768
|
+
eventDragStart: identity,
|
|
1769
|
+
eventDragStop: identity,
|
|
1770
|
+
eventDrop: identity,
|
|
1771
|
+
eventResizeStart: identity,
|
|
1772
|
+
eventResizeStop: identity,
|
|
1773
|
+
eventResize: identity,
|
|
1774
|
+
drop: identity,
|
|
1775
|
+
eventReceive: identity,
|
|
1776
|
+
eventLeave: identity,
|
|
1781
1777
|
};
|
|
1782
1778
|
|
|
1783
1779
|
/*
|
|
@@ -1800,18 +1796,18 @@ class ExternalElementDragging {
|
|
|
1800
1796
|
let droppableEvent = null;
|
|
1801
1797
|
let isInvalid = false;
|
|
1802
1798
|
let interaction = {
|
|
1803
|
-
affectedEvents:
|
|
1804
|
-
mutatedEvents:
|
|
1799
|
+
affectedEvents: createEmptyEventStore(),
|
|
1800
|
+
mutatedEvents: createEmptyEventStore(),
|
|
1805
1801
|
isEvent: this.dragMeta.create,
|
|
1806
1802
|
};
|
|
1807
1803
|
if (hit) {
|
|
1808
1804
|
receivingContext = hit.context;
|
|
1809
1805
|
if (this.canDropElOnCalendar(ev.subjectEl, receivingContext)) {
|
|
1810
1806
|
droppableEvent = computeEventForDateSpan(hit.dateSpan, this.dragMeta, receivingContext);
|
|
1811
|
-
interaction.mutatedEvents =
|
|
1812
|
-
isInvalid = !
|
|
1807
|
+
interaction.mutatedEvents = eventTupleToStore(droppableEvent);
|
|
1808
|
+
isInvalid = !isInteractionValid(interaction, hit.dateProfile, receivingContext);
|
|
1813
1809
|
if (isInvalid) {
|
|
1814
|
-
interaction.mutatedEvents =
|
|
1810
|
+
interaction.mutatedEvents = createEmptyEventStore();
|
|
1815
1811
|
droppableEvent = null;
|
|
1816
1812
|
}
|
|
1817
1813
|
}
|
|
@@ -1821,10 +1817,10 @@ class ExternalElementDragging {
|
|
|
1821
1817
|
// TODO: wish we could somehow wait for dispatch to guarantee render
|
|
1822
1818
|
dragging.setMirrorIsVisible(isFinal || !droppableEvent || !document.querySelector('.fc-event-mirror'));
|
|
1823
1819
|
if (!isInvalid) {
|
|
1824
|
-
|
|
1820
|
+
enableCursor();
|
|
1825
1821
|
}
|
|
1826
1822
|
else {
|
|
1827
|
-
|
|
1823
|
+
disableCursor();
|
|
1828
1824
|
}
|
|
1829
1825
|
if (!isFinal) {
|
|
1830
1826
|
dragging.setMirrorNeedsRevert(!droppableEvent);
|
|
@@ -1841,7 +1837,7 @@ class ExternalElementDragging {
|
|
|
1841
1837
|
let dragMeta = this.dragMeta;
|
|
1842
1838
|
receivingContext.emitter.trigger('drop', Object.assign(Object.assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext)), { draggedEl: pev.subjectEl, jsEvent: pev.origEvent, view: finalView }));
|
|
1843
1839
|
if (dragMeta.create) {
|
|
1844
|
-
let addingEvents =
|
|
1840
|
+
let addingEvents = eventTupleToStore(droppableEvent);
|
|
1845
1841
|
receivingContext.dispatch({
|
|
1846
1842
|
type: 'MERGE_EVENTS',
|
|
1847
1843
|
eventStore: addingEvents,
|
|
@@ -1854,7 +1850,7 @@ class ExternalElementDragging {
|
|
|
1854
1850
|
}
|
|
1855
1851
|
// signal that an external event landed
|
|
1856
1852
|
receivingContext.emitter.trigger('eventReceive', {
|
|
1857
|
-
event: new
|
|
1853
|
+
event: new EventImpl(receivingContext, droppableEvent.def, droppableEvent.instance),
|
|
1858
1854
|
relatedEvents: [],
|
|
1859
1855
|
revert() {
|
|
1860
1856
|
receivingContext.dispatch({
|
|
@@ -1870,7 +1866,7 @@ class ExternalElementDragging {
|
|
|
1870
1866
|
this.receivingContext = null;
|
|
1871
1867
|
this.droppableEvent = null;
|
|
1872
1868
|
};
|
|
1873
|
-
let hitDragging = this.hitDragging = new HitDragging(dragging,
|
|
1869
|
+
let hitDragging = this.hitDragging = new HitDragging(dragging, interactionSettingsStore);
|
|
1874
1870
|
hitDragging.requireInitial = false; // will start outside of a component
|
|
1875
1871
|
hitDragging.emitter.on('dragstart', this.handleDragStart);
|
|
1876
1872
|
hitDragging.emitter.on('hitupdate', this.handleHitUpdate);
|
|
@@ -1879,10 +1875,10 @@ class ExternalElementDragging {
|
|
|
1879
1875
|
}
|
|
1880
1876
|
buildDragMeta(subjectEl) {
|
|
1881
1877
|
if (typeof this.suppliedDragMeta === 'object') {
|
|
1882
|
-
return
|
|
1878
|
+
return parseDragMeta(this.suppliedDragMeta);
|
|
1883
1879
|
}
|
|
1884
1880
|
if (typeof this.suppliedDragMeta === 'function') {
|
|
1885
|
-
return
|
|
1881
|
+
return parseDragMeta(this.suppliedDragMeta(subjectEl));
|
|
1886
1882
|
}
|
|
1887
1883
|
return getDragMetaFromEl(subjectEl);
|
|
1888
1884
|
}
|
|
@@ -1906,7 +1902,7 @@ class ExternalElementDragging {
|
|
|
1906
1902
|
return dropAccept.call(receivingContext.calendarApi, el);
|
|
1907
1903
|
}
|
|
1908
1904
|
if (typeof dropAccept === 'string' && dropAccept) {
|
|
1909
|
-
return Boolean(
|
|
1905
|
+
return Boolean(elementMatches(el, dropAccept));
|
|
1910
1906
|
}
|
|
1911
1907
|
return true;
|
|
1912
1908
|
}
|
|
@@ -1918,8 +1914,8 @@ function computeEventForDateSpan(dateSpan, dragMeta, context) {
|
|
|
1918
1914
|
for (let transform of context.pluginHooks.externalDefTransforms) {
|
|
1919
1915
|
Object.assign(defProps, transform(dateSpan, dragMeta));
|
|
1920
1916
|
}
|
|
1921
|
-
let { refined, extra } =
|
|
1922
|
-
let def =
|
|
1917
|
+
let { refined, extra } = refineEventDef(defProps, context);
|
|
1918
|
+
let def = parseEventDef(refined, extra, dragMeta.sourceId, dateSpan.allDay, context.options.forceEventDuration || Boolean(dragMeta.duration), // hasEnd
|
|
1923
1919
|
context);
|
|
1924
1920
|
let start = dateSpan.range.start;
|
|
1925
1921
|
// only rely on time info if drop zone is all-day,
|
|
@@ -1929,8 +1925,8 @@ function computeEventForDateSpan(dateSpan, dragMeta, context) {
|
|
|
1929
1925
|
}
|
|
1930
1926
|
let end = dragMeta.duration ?
|
|
1931
1927
|
context.dateEnv.add(start, dragMeta.duration) :
|
|
1932
|
-
|
|
1933
|
-
let instance =
|
|
1928
|
+
getDefaultEventEnd(dateSpan.allDay, start, context);
|
|
1929
|
+
let instance = createEventInstance(def.defId, { start, end });
|
|
1934
1930
|
return { def, instance };
|
|
1935
1931
|
}
|
|
1936
1932
|
// Utils for extracting data from element
|
|
@@ -1940,11 +1936,11 @@ function getDragMetaFromEl(el) {
|
|
|
1940
1936
|
let obj = str ?
|
|
1941
1937
|
JSON.parse(str) :
|
|
1942
1938
|
{ create: false }; // if no embedded data, assume no event creation
|
|
1943
|
-
return
|
|
1939
|
+
return parseDragMeta(obj);
|
|
1944
1940
|
}
|
|
1945
|
-
|
|
1941
|
+
config.dataAttrPrefix = '';
|
|
1946
1942
|
function getEmbeddedElData(el, name) {
|
|
1947
|
-
let prefix =
|
|
1943
|
+
let prefix = config.dataAttrPrefix;
|
|
1948
1944
|
let prefixedName = (prefix ? prefix + '-' : '') + name;
|
|
1949
1945
|
return el.getAttribute('data-' + prefixedName) || '';
|
|
1950
1946
|
}
|
|
@@ -1962,10 +1958,10 @@ class ExternalDraggable {
|
|
|
1962
1958
|
dragging.minDistance =
|
|
1963
1959
|
minDistance != null ?
|
|
1964
1960
|
minDistance :
|
|
1965
|
-
(ev.isTouch ? 0 :
|
|
1961
|
+
(ev.isTouch ? 0 : BASE_OPTION_DEFAULTS.eventDragMinDistance);
|
|
1966
1962
|
dragging.delay =
|
|
1967
1963
|
ev.isTouch ? // TODO: eventually read eventLongPressDelay instead vvv
|
|
1968
|
-
(longPressDelay != null ? longPressDelay :
|
|
1964
|
+
(longPressDelay != null ? longPressDelay : BASE_OPTION_DEFAULTS.longPressDelay) :
|
|
1969
1965
|
0;
|
|
1970
1966
|
};
|
|
1971
1967
|
this.handleDragStart = (ev) => {
|
|
@@ -1999,7 +1995,7 @@ The third-party system is responsible for drawing the visuals effects of the dra
|
|
|
1999
1995
|
This class simply monitors for pointer movements and fires events.
|
|
2000
1996
|
It also has the ability to hide the moving element (the "mirror") during the drag.
|
|
2001
1997
|
*/
|
|
2002
|
-
class InferredElementDragging extends
|
|
1998
|
+
class InferredElementDragging extends ElementDragging {
|
|
2003
1999
|
constructor(containerEl) {
|
|
2004
2000
|
super(containerEl);
|
|
2005
2001
|
this.shouldIgnoreMove = false;
|
|
@@ -2091,7 +2087,7 @@ class ThirdPartyDraggable {
|
|
|
2091
2087
|
}
|
|
2092
2088
|
}
|
|
2093
2089
|
|
|
2094
|
-
var index =
|
|
2090
|
+
var index = createPlugin({
|
|
2095
2091
|
name: '@fullcalendar/interaction',
|
|
2096
2092
|
componentInteractions: [DateClicking, DateSelecting, EventDragging, EventResizing],
|
|
2097
2093
|
calendarInteractions: [UnselectAuto],
|
|
@@ -2100,6 +2096,4 @@ var index = index_cjs.createPlugin({
|
|
|
2100
2096
|
listenerRefiners: LISTENER_REFINERS,
|
|
2101
2097
|
});
|
|
2102
2098
|
|
|
2103
|
-
|
|
2104
|
-
exports.ThirdPartyDraggable = ThirdPartyDraggable;
|
|
2105
|
-
exports["default"] = index;
|
|
2099
|
+
export { ExternalDraggable as Draggable, ThirdPartyDraggable, index as default };
|