@fullcalendar/interaction 7.0.0-beta.3 → 7.0.0-beta.5
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/LICENSE.md +1 -1
- package/README.md +7 -1
- package/{index.cjs → cjs/index.cjs} +211 -179
- package/{index.d.ts → esm/index.d.ts} +55 -48
- package/{index.js → esm/index.js} +103 -75
- package/{index.global.js → global.js} +108 -77
- package/global.min.js +6 -0
- package/package.json +17 -14
- package/index.global.min.js +0 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatePointApi, ViewApi, EventApi,
|
|
2
|
-
import { Emitter, PointerDragEvent, Rect, ScrollController, ElementDragging, Identity, DragMetaInput } from '@fullcalendar/core/internal';
|
|
1
|
+
import { DatePointApi, ViewApi, EventApi, EventChangeData, Duration, EventDropData, PluginDef } from '@fullcalendar/core';
|
|
2
|
+
import { Emitter, PointerDragEvent, Rect, ScrollController, ElementDragging, RawOptionsFromRefiners, RefinedOptionsFromRefiners, Identity, DragMetaInput } from '@fullcalendar/core/internal';
|
|
3
3
|
|
|
4
4
|
declare class PointerDragging {
|
|
5
5
|
containerEl: EventTarget;
|
|
@@ -9,17 +9,18 @@ declare class PointerDragging {
|
|
|
9
9
|
handleSelector: string;
|
|
10
10
|
shouldIgnoreMove: boolean;
|
|
11
11
|
shouldWatchScroll: boolean;
|
|
12
|
-
isDragging
|
|
13
|
-
isTouchDragging
|
|
12
|
+
private isDragging;
|
|
13
|
+
private isTouchDragging;
|
|
14
14
|
wasTouchScroll: boolean;
|
|
15
|
-
origPageX
|
|
16
|
-
origPageY
|
|
17
|
-
prevPageX
|
|
18
|
-
prevPageY
|
|
19
|
-
prevScrollX
|
|
20
|
-
prevScrollY
|
|
15
|
+
private origPageX;
|
|
16
|
+
private origPageY;
|
|
17
|
+
private prevPageX;
|
|
18
|
+
private prevPageY;
|
|
19
|
+
private prevScrollX;
|
|
20
|
+
private prevScrollY;
|
|
21
21
|
constructor(containerEl: EventTarget);
|
|
22
22
|
destroy(): void;
|
|
23
|
+
cancel(): void;
|
|
23
24
|
tryStart(ev: UIEvent): boolean;
|
|
24
25
|
cleanup(): void;
|
|
25
26
|
querySubjectEl(ev: UIEvent): HTMLElement;
|
|
@@ -123,12 +124,12 @@ declare class FeaturefulElementDragging extends ElementDragging {
|
|
|
123
124
|
delay: number | null;
|
|
124
125
|
minDistance: number;
|
|
125
126
|
touchScrollAllowed: boolean;
|
|
126
|
-
mirrorNeedsRevert
|
|
127
|
-
isInteracting
|
|
128
|
-
isDragging
|
|
129
|
-
isDelayEnded
|
|
130
|
-
isDistanceSurpassed
|
|
131
|
-
delayTimeoutId
|
|
127
|
+
private mirrorNeedsRevert;
|
|
128
|
+
private isInteracting;
|
|
129
|
+
private isDragging;
|
|
130
|
+
private isDelayEnded;
|
|
131
|
+
private isDistanceSurpassed;
|
|
132
|
+
private delayTimeoutId;
|
|
132
133
|
constructor(containerEl: HTMLElement, selector?: string);
|
|
133
134
|
destroy(): void;
|
|
134
135
|
onPointerDown: (ev: PointerDragEvent) => void;
|
|
@@ -140,36 +141,36 @@ declare class FeaturefulElementDragging extends ElementDragging {
|
|
|
140
141
|
tryStartDrag(ev: PointerDragEvent): void;
|
|
141
142
|
tryStopDrag(ev: PointerDragEvent): void;
|
|
142
143
|
stopDrag(ev: PointerDragEvent): void;
|
|
143
|
-
|
|
144
|
+
cancel(): void;
|
|
144
145
|
setMirrorIsVisible(bool: boolean): void;
|
|
145
146
|
setMirrorNeedsRevert(bool: boolean): void;
|
|
146
147
|
setAutoScrollEnabled(bool: boolean): void;
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
interface
|
|
150
|
+
interface DateClickData extends DatePointApi {
|
|
150
151
|
dayEl: HTMLElement;
|
|
151
152
|
jsEvent: MouseEvent;
|
|
152
153
|
view: ViewApi;
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
type
|
|
156
|
-
type
|
|
157
|
-
interface
|
|
156
|
+
type EventDragStopData = EventDragData;
|
|
157
|
+
type EventDragStartData = EventDragData;
|
|
158
|
+
interface EventDragData {
|
|
158
159
|
el: HTMLElement;
|
|
159
160
|
event: EventApi;
|
|
160
161
|
jsEvent: MouseEvent;
|
|
161
162
|
view: ViewApi;
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
type
|
|
165
|
-
type
|
|
166
|
-
interface
|
|
165
|
+
type EventResizeStartData = EventResizeStartStopData;
|
|
166
|
+
type EventResizeStopData = EventResizeStartStopData;
|
|
167
|
+
interface EventResizeStartStopData {
|
|
167
168
|
el: HTMLElement;
|
|
168
169
|
event: EventApi;
|
|
169
170
|
jsEvent: MouseEvent;
|
|
170
171
|
view: ViewApi;
|
|
171
172
|
}
|
|
172
|
-
interface
|
|
173
|
+
interface EventResizeDoneData extends EventChangeData {
|
|
173
174
|
el: HTMLElement;
|
|
174
175
|
startDelta: Duration;
|
|
175
176
|
endDelta: Duration;
|
|
@@ -177,14 +178,14 @@ interface EventResizeDoneArg extends EventChangeArg {
|
|
|
177
178
|
view: ViewApi;
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
interface
|
|
181
|
+
interface DropData extends DatePointApi {
|
|
181
182
|
draggedEl: HTMLElement;
|
|
182
183
|
jsEvent: MouseEvent;
|
|
183
184
|
view: ViewApi;
|
|
184
185
|
}
|
|
185
|
-
type
|
|
186
|
-
type
|
|
187
|
-
interface
|
|
186
|
+
type EventReceiveData = EventReceiveLeaveData;
|
|
187
|
+
type EventLeaveData = EventReceiveLeaveData;
|
|
188
|
+
interface EventReceiveLeaveData {
|
|
188
189
|
draggedEl: HTMLElement;
|
|
189
190
|
event: EventApi;
|
|
190
191
|
relatedEvents: EventApi[];
|
|
@@ -192,28 +193,34 @@ interface EventReceiveLeaveArg {
|
|
|
192
193
|
view: ViewApi;
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
declare const OPTION_REFINERS: {
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
declare const OPTION_REFINERS: {};
|
|
197
|
+
type InteractionOptionRefiners = typeof OPTION_REFINERS;
|
|
198
|
+
type InteractionOptions = RawOptionsFromRefiners<InteractionOptionRefiners>;
|
|
199
|
+
type InteractionOptionsRefined = RefinedOptionsFromRefiners<InteractionOptionRefiners>;
|
|
198
200
|
declare const LISTENER_REFINERS: {
|
|
199
|
-
dateClick: Identity<(
|
|
200
|
-
eventDragStart: Identity<(
|
|
201
|
-
eventDragStop: Identity<(
|
|
202
|
-
eventDrop: Identity<(
|
|
203
|
-
eventResizeStart: Identity<(
|
|
204
|
-
eventResizeStop: Identity<(
|
|
205
|
-
eventResize: Identity<(
|
|
206
|
-
drop: Identity<(
|
|
207
|
-
eventReceive: Identity<(
|
|
208
|
-
eventLeave: Identity<(
|
|
201
|
+
dateClick: Identity<(data: DateClickData) => void>;
|
|
202
|
+
eventDragStart: Identity<(data: EventDragStartData) => void>;
|
|
203
|
+
eventDragStop: Identity<(data: EventDragStopData) => void>;
|
|
204
|
+
eventDrop: Identity<(data: EventDropData) => void>;
|
|
205
|
+
eventResizeStart: Identity<(data: EventResizeStartData) => void>;
|
|
206
|
+
eventResizeStop: Identity<(data: EventResizeStopData) => void>;
|
|
207
|
+
eventResize: Identity<(data: EventResizeDoneData) => void>;
|
|
208
|
+
drop: Identity<(data: DropData) => void>;
|
|
209
|
+
eventReceive: Identity<(data: EventReceiveData) => void>;
|
|
210
|
+
eventLeave: Identity<(data: EventLeaveData) => void>;
|
|
209
211
|
};
|
|
212
|
+
type InteractionListenerRefiners = typeof LISTENER_REFINERS;
|
|
213
|
+
type InteractionListeners = RawOptionsFromRefiners<InteractionListenerRefiners>;
|
|
214
|
+
type InteractionListenersRefined = RefinedOptionsFromRefiners<InteractionListenerRefiners>;
|
|
210
215
|
|
|
211
|
-
type ExtraOptionRefiners = typeof OPTION_REFINERS;
|
|
212
|
-
type ExtraListenerRefiners = typeof LISTENER_REFINERS;
|
|
213
216
|
declare module '@fullcalendar/core/internal' {
|
|
214
|
-
interface
|
|
217
|
+
interface BaseOptions extends InteractionOptions {
|
|
218
|
+
}
|
|
219
|
+
interface BaseOptionsRefined extends InteractionOptionsRefined {
|
|
220
|
+
}
|
|
221
|
+
interface CalendarListeners extends InteractionListeners {
|
|
215
222
|
}
|
|
216
|
-
interface
|
|
223
|
+
interface CalendarListenersRefined extends InteractionListenersRefined {
|
|
217
224
|
}
|
|
218
225
|
}
|
|
219
226
|
//# sourceMappingURL=ambient.d.ts.map
|
|
@@ -246,7 +253,7 @@ declare class InferredElementDragging extends ElementDragging {
|
|
|
246
253
|
handlePointerDown: (ev: PointerDragEvent) => void;
|
|
247
254
|
handlePointerMove: (ev: PointerDragEvent) => void;
|
|
248
255
|
handlePointerUp: (ev: PointerDragEvent) => void;
|
|
249
|
-
|
|
256
|
+
cancel(): void;
|
|
250
257
|
setMirrorIsVisible(bool: boolean): void;
|
|
251
258
|
}
|
|
252
259
|
|
|
@@ -264,4 +271,4 @@ declare class ThirdPartyDraggable {
|
|
|
264
271
|
declare const _default: PluginDef;
|
|
265
272
|
//# sourceMappingURL=index.d.ts.map
|
|
266
273
|
|
|
267
|
-
export {
|
|
274
|
+
export { DateClickData, ExternalDraggable as Draggable, DropData, EventDragStartData, EventDragStopData, EventLeaveData, EventReceiveData, EventResizeDoneData, EventResizeStartData, EventResizeStopData, InteractionListeners, InteractionOptions, ThirdPartyDraggable, _default as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createPlugin } from '@fullcalendar/core
|
|
2
|
-
import { config, Emitter, applyStyle, whenTransitionDone, ScrollController, ElementScrollController, computeInnerRect, WindowScrollController, ElementDragging, preventSelection, preventContextMenu, allowSelection, allowContextMenu, computeRect, getClippingParents, pointInsideRect, constrainPoint, intersectRects, getRectCenter, diffPoints, mapHash, rangeContainsRange, isDateSpansEqual, Interaction, interactionSettingsToStore, isDateSelectionValid, enableCursor, disableCursor, triggerDateSelect, compareNumbers, getElEventRange, getRelevantEvents, EventImpl, createEmptyEventStore, applyMutationToEventStore, isInteractionValid, buildEventApis, interactionSettingsStore, startOfDay, diffDates, createDuration, getEventTargetViaRoot, identity, eventTupleToStore, parseDragMeta, refineEventDef, parseEventDef, getDefaultEventEnd, createEventInstance, BASE_OPTION_DEFAULTS } from '@fullcalendar/core/internal
|
|
1
|
+
import { createPlugin } from '@fullcalendar/core';
|
|
2
|
+
import { config, Emitter, applyStyle, whenTransitionDone, ScrollController, ElementScrollController, computeInnerRect, WindowScrollController, ElementDragging, preventSelection, preventContextMenu, allowSelection, allowContextMenu, computeRect, computeElIsRtl, getClippingParents, pointInsideRect, constrainPoint, intersectRects, getRectCenter, diffPoints, mapHash, rangeContainsRange, isDateSpansEqual, Interaction, interactionSettingsToStore, isDateSelectionValid, enableCursor, disableCursor, triggerDateSelect, compareNumbers, getElEventRange, getRelevantEvents, getAppendableRoot, EventImpl, createEmptyEventStore, applyMutationToEventStore, isInteractionValid, buildEventApis, interactionSettingsStore, startOfDay, diffDates, createDuration, getEventTargetViaRoot, identity, eventTupleToStore, parseDragMeta, refineEventDef, parseEventDef, getDefaultEventEnd, createEventInstance, BASE_OPTION_DEFAULTS } from '@fullcalendar/core/internal';
|
|
3
|
+
import classNames from '@fullcalendar/core/internal-classnames';
|
|
3
4
|
|
|
4
5
|
config.touchMouseIgnoreWait = 500;
|
|
5
6
|
let ignoreMouseDepth = 0;
|
|
@@ -29,7 +30,7 @@ class PointerDragging {
|
|
|
29
30
|
// internal states
|
|
30
31
|
this.isDragging = false;
|
|
31
32
|
this.isTouchDragging = false;
|
|
32
|
-
this.wasTouchScroll = false;
|
|
33
|
+
this.wasTouchScroll = false; // HACK public
|
|
33
34
|
// Mouse
|
|
34
35
|
// ----------------------------------------------------------------------------------------------------
|
|
35
36
|
this.handleMouseDown = (ev) => {
|
|
@@ -79,9 +80,11 @@ class PointerDragging {
|
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
82
|
this.handleTouchMove = (ev) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
if (this.isDragging) {
|
|
84
|
+
let pev = this.createEventFromTouch(ev);
|
|
85
|
+
this.recordCoords(pev);
|
|
86
|
+
this.emitter.trigger('pointermove', pev);
|
|
87
|
+
}
|
|
85
88
|
};
|
|
86
89
|
this.handleTouchEnd = (ev) => {
|
|
87
90
|
if (this.isDragging) { // done to guard against touchend followed by touchcancel
|
|
@@ -125,6 +128,11 @@ class PointerDragging {
|
|
|
125
128
|
this.containerEl.removeEventListener('touchstart', this.handleTouchStart, { passive: true });
|
|
126
129
|
listenerDestroyed();
|
|
127
130
|
}
|
|
131
|
+
cancel() {
|
|
132
|
+
if (this.isDragging) {
|
|
133
|
+
this.cleanup();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
128
136
|
tryStart(ev) {
|
|
129
137
|
let subjectEl = this.querySubjectEl(ev);
|
|
130
138
|
let downEl = ev.target;
|
|
@@ -307,7 +315,9 @@ class ElementMirror {
|
|
|
307
315
|
if (bool) {
|
|
308
316
|
if (!this.isVisible) {
|
|
309
317
|
if (this.mirrorEl) {
|
|
310
|
-
|
|
318
|
+
// important because competes with util.module.css classNames, which are all important
|
|
319
|
+
// TODO: attach a util className here instead?
|
|
320
|
+
this.mirrorEl.style.setProperty('display', '', 'important');
|
|
311
321
|
}
|
|
312
322
|
this.isVisible = bool; // needs to happen before updateElPosition
|
|
313
323
|
this.updateElPosition(); // because was not updating the position while invisible
|
|
@@ -315,7 +325,9 @@ class ElementMirror {
|
|
|
315
325
|
}
|
|
316
326
|
else if (this.isVisible) {
|
|
317
327
|
if (this.mirrorEl) {
|
|
318
|
-
|
|
328
|
+
// important because competes with util.module.css classNames, which are all important
|
|
329
|
+
// TODO: attach a util className here instead?
|
|
330
|
+
this.mirrorEl.style.setProperty('display', 'none', 'important');
|
|
319
331
|
}
|
|
320
332
|
this.isVisible = bool;
|
|
321
333
|
}
|
|
@@ -375,10 +387,10 @@ class ElementMirror {
|
|
|
375
387
|
mirrorEl = this.mirrorEl = this.sourceEl.cloneNode(true); // cloneChildren=true
|
|
376
388
|
// we don't want long taps or any mouse interaction causing selection/menus.
|
|
377
389
|
// would use preventSelection(), but that prevents selectstart, causing problems.
|
|
390
|
+
// TODO: make className for this?
|
|
378
391
|
mirrorEl.style.userSelect = 'none';
|
|
379
392
|
mirrorEl.style.webkitUserSelect = 'none';
|
|
380
393
|
mirrorEl.style.pointerEvents = 'none';
|
|
381
|
-
mirrorEl.classList.add('fc-event-dragging');
|
|
382
394
|
applyStyle(mirrorEl, {
|
|
383
395
|
position: 'fixed',
|
|
384
396
|
zIndex: this.zIndex,
|
|
@@ -518,7 +530,7 @@ class AutoScroller {
|
|
|
518
530
|
constructor() {
|
|
519
531
|
// options that can be set by caller
|
|
520
532
|
this.isEnabled = true;
|
|
521
|
-
this.scrollQuery = [window,
|
|
533
|
+
this.scrollQuery = [window, `.${classNames.internalScroller}`];
|
|
522
534
|
this.edgeThreshold = 50; // pixels
|
|
523
535
|
this.maxVelocity = 300; // pixels per second
|
|
524
536
|
// internal state
|
|
@@ -708,17 +720,16 @@ class FeaturefulElementDragging extends ElementDragging {
|
|
|
708
720
|
this.isInteracting = true;
|
|
709
721
|
this.isDelayEnded = false;
|
|
710
722
|
this.isDistanceSurpassed = false;
|
|
711
|
-
preventSelection(document.body);
|
|
712
|
-
preventContextMenu(document.body);
|
|
713
|
-
// prevent links from being visited if there's an eventual drag.
|
|
714
|
-
// also prevents selection in older browsers (maybe?).
|
|
715
|
-
// not necessary for touch, besides, browser would complain about passiveness.
|
|
716
|
-
if (!ev.isTouch) {
|
|
717
|
-
ev.origEvent.preventDefault();
|
|
718
|
-
}
|
|
719
723
|
this.emitter.trigger('pointerdown', ev);
|
|
720
|
-
if (this.isInteracting
|
|
721
|
-
|
|
724
|
+
if (this.isInteracting) { // not cancelled?
|
|
725
|
+
preventSelection(document.body);
|
|
726
|
+
preventContextMenu(document.body);
|
|
727
|
+
// prevent links from being visited if there's an eventual drag.
|
|
728
|
+
// also prevents selection in older browsers (maybe?).
|
|
729
|
+
// not necessary for touch, besides, browser would complain about passiveness.
|
|
730
|
+
if (!ev.isTouch) {
|
|
731
|
+
ev.origEvent.preventDefault();
|
|
732
|
+
}
|
|
722
733
|
// actions related to initiating dragstart+dragmove+dragend...
|
|
723
734
|
this.mirror.setIsVisible(false); // reset. caller must set-visible
|
|
724
735
|
this.mirror.start(ev.subjectEl, ev.pageX, ev.pageY); // must happen on first pointer down
|
|
@@ -825,8 +836,14 @@ class FeaturefulElementDragging extends ElementDragging {
|
|
|
825
836
|
this.emitter.trigger('dragend', ev);
|
|
826
837
|
}
|
|
827
838
|
// fill in the implementations...
|
|
828
|
-
|
|
829
|
-
|
|
839
|
+
/*
|
|
840
|
+
Can only be called by pointerdown to prevent drag
|
|
841
|
+
*/
|
|
842
|
+
cancel() {
|
|
843
|
+
if (this.isInteracting) {
|
|
844
|
+
this.isInteracting = false;
|
|
845
|
+
this.pointer.cancel();
|
|
846
|
+
}
|
|
830
847
|
}
|
|
831
848
|
setMirrorIsVisible(bool) {
|
|
832
849
|
this.mirror.setIsVisible(bool);
|
|
@@ -851,6 +868,7 @@ class OffsetTracker {
|
|
|
851
868
|
constructor(el) {
|
|
852
869
|
this.el = el;
|
|
853
870
|
this.origRect = computeRect(el);
|
|
871
|
+
this.isRtl = computeElIsRtl(el);
|
|
854
872
|
// will work fine for divs that have overflow:hidden
|
|
855
873
|
this.scrollCaches = getClippingParents(el).map((scrollEl) => new ElementScrollGeomCache(scrollEl, true));
|
|
856
874
|
}
|
|
@@ -921,12 +939,11 @@ class HitDragging {
|
|
|
921
939
|
this.prepareHits();
|
|
922
940
|
this.processFirstCoord(ev);
|
|
923
941
|
if (this.initialHit || !this.requireInitial) {
|
|
924
|
-
dragging.setIgnoreMove(false);
|
|
925
942
|
// TODO: fire this before computing processFirstCoord, so listeners can cancel. this gets fired by almost every handler :(
|
|
926
943
|
this.emitter.trigger('pointerdown', ev);
|
|
927
944
|
}
|
|
928
945
|
else {
|
|
929
|
-
dragging.
|
|
946
|
+
dragging.cancel();
|
|
930
947
|
}
|
|
931
948
|
};
|
|
932
949
|
this.handleDragStart = (ev) => {
|
|
@@ -1022,7 +1039,7 @@ class HitDragging {
|
|
|
1022
1039
|
// must be within the element's bounds
|
|
1023
1040
|
positionLeft >= 0 && positionLeft < width &&
|
|
1024
1041
|
positionTop >= 0 && positionTop < height) {
|
|
1025
|
-
let hit = component.queryHit(positionLeft, positionTop, width, height);
|
|
1042
|
+
let hit = component.queryHit(offsetTracker.isRtl, positionLeft, positionTop, width, height);
|
|
1026
1043
|
if (hit && (
|
|
1027
1044
|
// make sure the hit is within activeRange, meaning it's not a dead cell
|
|
1028
1045
|
rangeContainsRange(hit.dateProfile.activeRange, hit.dateSpan.range)) &&
|
|
@@ -1085,8 +1102,14 @@ class DateClicking extends Interaction {
|
|
|
1085
1102
|
this.handlePointerDown = (pev) => {
|
|
1086
1103
|
let { dragging } = this;
|
|
1087
1104
|
let downEl = pev.origEvent.target;
|
|
1088
|
-
|
|
1089
|
-
|
|
1105
|
+
/*
|
|
1106
|
+
If no dateClick, allow text on dates to be text-selectable
|
|
1107
|
+
*/
|
|
1108
|
+
const canDateClick = this.component.context.emitter.hasHandlers('dateClick') &&
|
|
1109
|
+
this.component.isValidDateDownEl(downEl);
|
|
1110
|
+
if (!canDateClick) {
|
|
1111
|
+
dragging.cancel();
|
|
1112
|
+
}
|
|
1090
1113
|
};
|
|
1091
1114
|
// won't even fire if moving was ignored
|
|
1092
1115
|
this.handleDragEnd = (ev) => {
|
|
@@ -1096,8 +1119,8 @@ class DateClicking extends Interaction {
|
|
|
1096
1119
|
let { initialHit, finalHit } = this.hitDragging;
|
|
1097
1120
|
if (initialHit && finalHit && isHitsEqual(initialHit, finalHit)) {
|
|
1098
1121
|
let { context } = component;
|
|
1099
|
-
let
|
|
1100
|
-
context.emitter.trigger('dateClick',
|
|
1122
|
+
let data = Object.assign(Object.assign({}, buildDatePointApiWithContext(initialHit.dateSpan, context)), { dayEl: initialHit.getDayEl(), jsEvent: ev.origEvent, view: context.viewApi || context.calendarApi.view });
|
|
1123
|
+
context.emitter.trigger('dateClick', data);
|
|
1101
1124
|
}
|
|
1102
1125
|
}
|
|
1103
1126
|
};
|
|
@@ -1124,12 +1147,15 @@ class DateSelecting extends Interaction {
|
|
|
1124
1147
|
this.handlePointerDown = (ev) => {
|
|
1125
1148
|
let { component, dragging } = this;
|
|
1126
1149
|
let { options } = component.context;
|
|
1127
|
-
let
|
|
1150
|
+
let canDateSelect = options.selectable &&
|
|
1128
1151
|
component.isValidDateDownEl(ev.origEvent.target);
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1152
|
+
if (!canDateSelect) {
|
|
1153
|
+
dragging.cancel();
|
|
1154
|
+
}
|
|
1155
|
+
else {
|
|
1156
|
+
// if touch, require user to hold down
|
|
1157
|
+
dragging.delay = ev.isTouch ? getComponentTouchDelay$1(component) : null;
|
|
1158
|
+
}
|
|
1133
1159
|
};
|
|
1134
1160
|
this.handleDragStart = (ev) => {
|
|
1135
1161
|
this.component.context.calendarApi.unselect(ev); // unselect previous selections
|
|
@@ -1250,20 +1276,20 @@ class EventDragging extends Interaction {
|
|
|
1250
1276
|
(ev.isTouch && eventInstanceId !== component.props.eventSelection) ?
|
|
1251
1277
|
getComponentTouchDelay(component) :
|
|
1252
1278
|
null;
|
|
1253
|
-
|
|
1254
|
-
|
|
1279
|
+
mirror.parentNode = getAppendableRoot(origTarget);
|
|
1280
|
+
mirror.revertDuration = options.dragRevertDuration;
|
|
1281
|
+
let isValid = component.isValidSegDownEl(origTarget) &&
|
|
1282
|
+
!origTarget.closest(`.${classNames.internalEventResizer}`); // NOT on a resizer
|
|
1283
|
+
if (!isValid) {
|
|
1284
|
+
dragging.cancel();
|
|
1255
1285
|
}
|
|
1256
1286
|
else {
|
|
1257
|
-
|
|
1287
|
+
// disable dragging for elements that are resizable (ie, selectable)
|
|
1288
|
+
// but are not draggable
|
|
1289
|
+
// TODO: merge this with .cancel() ?
|
|
1290
|
+
this.isDragging = ev.subjectEl
|
|
1291
|
+
.classList.contains(classNames.internalEventDraggable);
|
|
1258
1292
|
}
|
|
1259
|
-
mirror.revertDuration = options.dragRevertDuration;
|
|
1260
|
-
let isValid = component.isValidSegDownEl(origTarget) &&
|
|
1261
|
-
!origTarget.closest('.fc-event-resizer'); // NOT on a resizer
|
|
1262
|
-
dragging.setIgnoreMove(!isValid);
|
|
1263
|
-
// disable dragging for elements that are resizable (ie, selectable)
|
|
1264
|
-
// but are not draggable
|
|
1265
|
-
this.isDragging = isValid &&
|
|
1266
|
-
ev.subjectEl.classList.contains('fc-event-draggable');
|
|
1267
1293
|
};
|
|
1268
1294
|
this.handleDragStart = (ev) => {
|
|
1269
1295
|
let initialContext = this.component.context;
|
|
@@ -1342,7 +1368,7 @@ class EventDragging extends Interaction {
|
|
|
1342
1368
|
this.dragging.setMirrorNeedsRevert(!mutation);
|
|
1343
1369
|
// render the mirror if no already-rendered mirror
|
|
1344
1370
|
// TODO: wish we could somehow wait for dispatch to guarantee render
|
|
1345
|
-
this.dragging.setMirrorIsVisible(!hit || !this.subjectEl.getRootNode().querySelector(
|
|
1371
|
+
this.dragging.setMirrorIsVisible(!hit || !this.subjectEl.getRootNode().querySelector(`.${classNames.internalEventMirror}`));
|
|
1346
1372
|
// assign states based on new hit
|
|
1347
1373
|
this.receivingContext = receivingContext;
|
|
1348
1374
|
this.validMutation = mutation;
|
|
@@ -1380,7 +1406,7 @@ class EventDragging extends Interaction {
|
|
|
1380
1406
|
type: 'MERGE_EVENTS',
|
|
1381
1407
|
eventStore: mutatedRelevantEvents,
|
|
1382
1408
|
});
|
|
1383
|
-
let
|
|
1409
|
+
let eventChangeData = {
|
|
1384
1410
|
oldEvent: eventApi,
|
|
1385
1411
|
event: updatedEventApi,
|
|
1386
1412
|
relatedEvents: buildEventApis(mutatedRelevantEvents, initialContext, eventInstance),
|
|
@@ -1395,12 +1421,12 @@ class EventDragging extends Interaction {
|
|
|
1395
1421
|
for (let transformer of initialContext.getCurrentData().pluginHooks.eventDropTransformers) {
|
|
1396
1422
|
Object.assign(transformed, transformer(validMutation, initialContext));
|
|
1397
1423
|
}
|
|
1398
|
-
initialContext.emitter.trigger('eventDrop', Object.assign(Object.assign(Object.assign({},
|
|
1399
|
-
initialContext.emitter.trigger('eventChange',
|
|
1424
|
+
initialContext.emitter.trigger('eventDrop', Object.assign(Object.assign(Object.assign({}, eventChangeData), transformed), { el: ev.subjectEl, delta: validMutation.datesDelta, jsEvent: ev.origEvent, view: initialView }));
|
|
1425
|
+
initialContext.emitter.trigger('eventChange', eventChangeData);
|
|
1400
1426
|
// dropped in different calendar
|
|
1401
1427
|
}
|
|
1402
1428
|
else if (receivingContext) {
|
|
1403
|
-
let
|
|
1429
|
+
let eventRemoveData = {
|
|
1404
1430
|
event: eventApi,
|
|
1405
1431
|
relatedEvents: buildEventApis(relevantEvents, initialContext, eventInstance),
|
|
1406
1432
|
revert() {
|
|
@@ -1410,12 +1436,12 @@ class EventDragging extends Interaction {
|
|
|
1410
1436
|
});
|
|
1411
1437
|
},
|
|
1412
1438
|
};
|
|
1413
|
-
initialContext.emitter.trigger('eventLeave', Object.assign(Object.assign({},
|
|
1439
|
+
initialContext.emitter.trigger('eventLeave', Object.assign(Object.assign({}, eventRemoveData), { draggedEl: ev.subjectEl, view: initialView }));
|
|
1414
1440
|
initialContext.dispatch({
|
|
1415
1441
|
type: 'REMOVE_EVENTS',
|
|
1416
1442
|
eventStore: relevantEvents,
|
|
1417
1443
|
});
|
|
1418
|
-
initialContext.emitter.trigger('eventRemove',
|
|
1444
|
+
initialContext.emitter.trigger('eventRemove', eventRemoveData);
|
|
1419
1445
|
let addedEventDef = mutatedRelevantEvents.defs[eventDef.defId];
|
|
1420
1446
|
let addedEventInstance = mutatedRelevantEvents.instances[eventInstance.instanceId];
|
|
1421
1447
|
let addedEventApi = new EventImpl(receivingContext, addedEventDef, addedEventInstance);
|
|
@@ -1423,7 +1449,7 @@ class EventDragging extends Interaction {
|
|
|
1423
1449
|
type: 'MERGE_EVENTS',
|
|
1424
1450
|
eventStore: mutatedRelevantEvents,
|
|
1425
1451
|
});
|
|
1426
|
-
let
|
|
1452
|
+
let eventAddData = {
|
|
1427
1453
|
event: addedEventApi,
|
|
1428
1454
|
relatedEvents: buildEventApis(mutatedRelevantEvents, receivingContext, addedEventInstance),
|
|
1429
1455
|
revert() {
|
|
@@ -1433,7 +1459,7 @@ class EventDragging extends Interaction {
|
|
|
1433
1459
|
});
|
|
1434
1460
|
},
|
|
1435
1461
|
};
|
|
1436
|
-
receivingContext.emitter.trigger('eventAdd',
|
|
1462
|
+
receivingContext.emitter.trigger('eventAdd', eventAddData);
|
|
1437
1463
|
if (ev.isTouch) {
|
|
1438
1464
|
receivingContext.dispatch({
|
|
1439
1465
|
type: 'SELECT_EVENT',
|
|
@@ -1441,7 +1467,7 @@ class EventDragging extends Interaction {
|
|
|
1441
1467
|
});
|
|
1442
1468
|
}
|
|
1443
1469
|
receivingContext.emitter.trigger('drop', Object.assign(Object.assign({}, buildDatePointApiWithContext(finalHit.dateSpan, receivingContext)), { draggedEl: ev.subjectEl, jsEvent: ev.origEvent, view: finalHit.context.viewApi }));
|
|
1444
|
-
receivingContext.emitter.trigger('eventReceive', Object.assign(Object.assign({},
|
|
1470
|
+
receivingContext.emitter.trigger('eventReceive', Object.assign(Object.assign({}, eventAddData), { draggedEl: ev.subjectEl, view: finalHit.context.viewApi }));
|
|
1445
1471
|
}
|
|
1446
1472
|
}
|
|
1447
1473
|
else {
|
|
@@ -1516,7 +1542,7 @@ class EventDragging extends Interaction {
|
|
|
1516
1542
|
}
|
|
1517
1543
|
// TODO: test this in IE11
|
|
1518
1544
|
// QUESTION: why do we need it on the resizable???
|
|
1519
|
-
EventDragging.SELECTOR =
|
|
1545
|
+
EventDragging.SELECTOR = `.${classNames.internalEventDraggable}, .${classNames.internalEventResizable}`;
|
|
1520
1546
|
function computeEventMutation(hit0, hit1, eventInstanceStart, massagers) {
|
|
1521
1547
|
let dateSpan0 = hit0.dateSpan;
|
|
1522
1548
|
let dateSpan1 = hit1.dateSpan;
|
|
@@ -1576,9 +1602,11 @@ class EventResizing extends Interaction {
|
|
|
1576
1602
|
let segEl = this.querySegEl(ev);
|
|
1577
1603
|
let eventRange = this.eventRange = getElEventRange(segEl);
|
|
1578
1604
|
this.dragging.minDistance = component.context.options.eventDragMinDistance;
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1605
|
+
const isValid = this.component.isValidSegDownEl(ev.origEvent.target) &&
|
|
1606
|
+
!(ev.isTouch && this.component.props.eventSelection !== eventRange.instance.instanceId);
|
|
1607
|
+
if (!isValid) {
|
|
1608
|
+
this.dragging.cancel();
|
|
1609
|
+
}
|
|
1582
1610
|
};
|
|
1583
1611
|
this.handleDragStart = (ev) => {
|
|
1584
1612
|
let { context } = this.component;
|
|
@@ -1613,7 +1641,7 @@ class EventResizing extends Interaction {
|
|
|
1613
1641
|
&& this.isHitComboAllowed
|
|
1614
1642
|
&& !this.isHitComboAllowed(initialHit, hit);
|
|
1615
1643
|
if (!disallowed) {
|
|
1616
|
-
mutation = computeMutation(initialHit, hit, ev.subjectEl.classList.contains(
|
|
1644
|
+
mutation = computeMutation(initialHit, hit, ev.subjectEl.classList.contains(classNames.internalEventResizerStart), eventInstance.range);
|
|
1617
1645
|
}
|
|
1618
1646
|
}
|
|
1619
1647
|
if (mutation) {
|
|
@@ -1668,7 +1696,7 @@ class EventResizing extends Interaction {
|
|
|
1668
1696
|
type: 'MERGE_EVENTS',
|
|
1669
1697
|
eventStore: mutatedRelevantEvents,
|
|
1670
1698
|
});
|
|
1671
|
-
let
|
|
1699
|
+
let eventChangeData = {
|
|
1672
1700
|
oldEvent: eventApi,
|
|
1673
1701
|
event: updatedEventApi,
|
|
1674
1702
|
relatedEvents: buildEventApis(mutatedRelevantEvents, context, eventInstance),
|
|
@@ -1679,8 +1707,8 @@ class EventResizing extends Interaction {
|
|
|
1679
1707
|
});
|
|
1680
1708
|
},
|
|
1681
1709
|
};
|
|
1682
|
-
context.emitter.trigger('eventResize', Object.assign(Object.assign({},
|
|
1683
|
-
context.emitter.trigger('eventChange',
|
|
1710
|
+
context.emitter.trigger('eventResize', Object.assign(Object.assign({}, eventChangeData), { el: this.draggingSegEl, startDelta: this.validMutation.startDelta || createDuration(0), endDelta: this.validMutation.endDelta || createDuration(0), jsEvent: ev.origEvent, view: context.viewApi }));
|
|
1711
|
+
context.emitter.trigger('eventChange', eventChangeData);
|
|
1684
1712
|
}
|
|
1685
1713
|
else {
|
|
1686
1714
|
context.emitter.trigger('_noEventResize');
|
|
@@ -1693,7 +1721,7 @@ class EventResizing extends Interaction {
|
|
|
1693
1721
|
};
|
|
1694
1722
|
let { component } = settings;
|
|
1695
1723
|
let dragging = this.dragging = new FeaturefulElementDragging(settings.el);
|
|
1696
|
-
dragging.pointer.selector =
|
|
1724
|
+
dragging.pointer.selector = `.${classNames.internalEventResizer}`;
|
|
1697
1725
|
dragging.touchScrollAllowed = false;
|
|
1698
1726
|
dragging.autoScroller.isEnabled = component.context.options.dragScroll;
|
|
1699
1727
|
let hitDragging = this.hitDragging = new HitDragging(this.dragging, interactionSettingsToStore(settings));
|
|
@@ -1706,7 +1734,7 @@ class EventResizing extends Interaction {
|
|
|
1706
1734
|
this.dragging.destroy();
|
|
1707
1735
|
}
|
|
1708
1736
|
querySegEl(ev) {
|
|
1709
|
-
return ev.subjectEl.closest(
|
|
1737
|
+
return ev.subjectEl.closest(`.${classNames.internalEvent}`);
|
|
1710
1738
|
}
|
|
1711
1739
|
}
|
|
1712
1740
|
function computeMutation(hit0, hit1, isFromStart, instanceRange) {
|
|
@@ -1731,8 +1759,8 @@ class UnselectAuto {
|
|
|
1731
1759
|
this.isRecentPointerDateSelect = false; // wish we could use a selector to detect date selection, but uses hit system
|
|
1732
1760
|
this.matchesCancel = false;
|
|
1733
1761
|
this.matchesEvent = false;
|
|
1734
|
-
this.onSelect = (
|
|
1735
|
-
if (
|
|
1762
|
+
this.onSelect = (selectData) => {
|
|
1763
|
+
if (selectData.jsEvent) {
|
|
1736
1764
|
this.isRecentPointerDateSelect = true;
|
|
1737
1765
|
}
|
|
1738
1766
|
};
|
|
@@ -1780,9 +1808,7 @@ class UnselectAuto {
|
|
|
1780
1808
|
}
|
|
1781
1809
|
}
|
|
1782
1810
|
|
|
1783
|
-
const OPTION_REFINERS = {
|
|
1784
|
-
fixedMirrorParent: identity,
|
|
1785
|
-
};
|
|
1811
|
+
const OPTION_REFINERS = {};
|
|
1786
1812
|
const LISTENER_REFINERS = {
|
|
1787
1813
|
dateClick: identity,
|
|
1788
1814
|
eventDragStart: identity,
|
|
@@ -1835,7 +1861,9 @@ class ExternalElementDragging {
|
|
|
1835
1861
|
this.displayDrag(receivingContext, interaction);
|
|
1836
1862
|
// show mirror if no already-rendered mirror element OR if we are shutting down the mirror (?)
|
|
1837
1863
|
// TODO: wish we could somehow wait for dispatch to guarantee render
|
|
1838
|
-
dragging.setMirrorIsVisible(isFinal ||
|
|
1864
|
+
dragging.setMirrorIsVisible(isFinal ||
|
|
1865
|
+
!droppableEvent ||
|
|
1866
|
+
!document.querySelector(`.${classNames.internalEventMirror}`));
|
|
1839
1867
|
if (!isInvalid) {
|
|
1840
1868
|
enableCursor();
|
|
1841
1869
|
}
|
|
@@ -1987,8 +2015,8 @@ class ExternalDraggable {
|
|
|
1987
2015
|
this.handleDragStart = (ev) => {
|
|
1988
2016
|
if (ev.isTouch &&
|
|
1989
2017
|
this.dragging.delay &&
|
|
1990
|
-
ev.subjectEl.classList.contains(
|
|
1991
|
-
this.dragging.mirror.getMirrorEl().classList.add(
|
|
2018
|
+
ev.subjectEl.classList.contains(classNames.internalEvent)) {
|
|
2019
|
+
this.dragging.mirror.getMirrorEl().classList.add(classNames.internalEventSelected);
|
|
1992
2020
|
}
|
|
1993
2021
|
};
|
|
1994
2022
|
this.settings = settings;
|
|
@@ -2048,8 +2076,8 @@ class InferredElementDragging extends ElementDragging {
|
|
|
2048
2076
|
destroy() {
|
|
2049
2077
|
this.pointer.destroy();
|
|
2050
2078
|
}
|
|
2051
|
-
|
|
2052
|
-
this.shouldIgnoreMove =
|
|
2079
|
+
cancel() {
|
|
2080
|
+
this.shouldIgnoreMove = true;
|
|
2053
2081
|
}
|
|
2054
2082
|
setMirrorIsVisible(bool) {
|
|
2055
2083
|
if (bool) {
|