Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_this.handleDragEnd = function (ev) {
if (_this.isDragging) {
var initialCalendar_1 = _this.component.calendar;
var initialView = _this.component.view;
var _a = _this, receivingCalendar = _a.receivingCalendar, validMutation = _a.validMutation;
var eventDef = _this.eventRange.def;
var eventInstance = _this.eventRange.instance;
var eventApi = new EventApi(initialCalendar_1, eventDef, eventInstance);
var relevantEvents_1 = _this.relevantEvents;
var mutatedRelevantEvents = _this.mutatedRelevantEvents;
var finalHit = _this.hitDragging.finalHit;
_this.clearDrag(); // must happen after revert animation
initialCalendar_1.publiclyTrigger('eventDragStop', [
{
el: _this.subjectSeg.el,
event: eventApi,
jsEvent: ev.origEvent,
view: initialView
}
]);
if (validMutation) {
// dropped within same calendar
if (receivingCalendar === initialCalendar_1) {
initialCalendar_1.dispatch({
type: 'MERGE_EVENTS',
eventStore: eventTupleToStore(droppableEvent)
})
if (pev.isTouch) {
receivingCalendar.dispatch({
type: 'SELECT_EVENT',
eventInstanceId: droppableEvent.instance.instanceId
})
}
// signal that an external event landed
receivingCalendar.publiclyTrigger('eventReceive', [
{
draggedEl: pev.subjectEl as HTMLElement,
event: new EventApi(
receivingCalendar,
droppableEvent.def,
droppableEvent.instance
),
view: finalView
}
])
}
}
this.receivingCalendar = null
this.droppableEvent = null
}
type: 'MERGE_EVENTS',
eventStore: _this.mutatedRelevantEvents
});
if (ev.isTouch) {
receivingCalendar.dispatch({
type: 'SELECT_EVENT',
eventInstanceId: eventInstance.instanceId
});
}
var dropArg = __assign({}, receivingCalendar.buildDatePointApi(finalHit.dateSpan), { draggedEl: ev.subjectEl, jsEvent: ev.origEvent, view: finalHit.component // should this be finalHit.component.view? See #4644
});
receivingCalendar.publiclyTrigger('drop', [dropArg]);
receivingCalendar.publiclyTrigger('eventReceive', [
{
draggedEl: ev.subjectEl,
event: new EventApi(// the data AFTER the mutation
receivingCalendar, mutatedRelevantEvents.defs[eventDef.defId], mutatedRelevantEvents.instances[eventInstance.instanceId]),
view: finalHit.component // should this be finalHit.component.view? See #4644
}
]);
}
}
else {
initialCalendar_1.publiclyTrigger('_noEventDrop');
}
}
_this.cleanup();
};
var component = _this.component;
if (dragMeta.create) {
receivingCalendar.dispatch({
type: 'MERGE_EVENTS',
eventStore: eventTupleToStore(droppableEvent)
});
if (pev.isTouch) {
receivingCalendar.dispatch({
type: 'SELECT_EVENT',
eventInstanceId: droppableEvent.instance.instanceId
});
}
// signal that an external event landed
receivingCalendar.publiclyTrigger('eventReceive', [
{
draggedEl: pev.subjectEl,
event: new EventApi(receivingCalendar, droppableEvent.def, droppableEvent.instance),
view: finalView
}
]);
}
}
_this.receivingCalendar = null;
_this.droppableEvent = null;
};
var hitDragging = this.hitDragging = new HitDragging(dragging, interactionSettingsStore);
handleDragEnd = (ev: PointerDragEvent) => {
let { calendar, view } = this.component.context
let eventDef = this.eventRange!.def
let eventInstance = this.eventRange!.instance
let eventApi = new EventApi(calendar, eventDef, eventInstance)
let relevantEvents = this.relevantEvents!
let mutatedRelevantEvents = this.mutatedRelevantEvents!
calendar.publiclyTrigger('eventResizeStop', [
{
el: this.draggingSeg.el,
event: eventApi,
jsEvent: ev.origEvent as MouseEvent, // Is this always a mouse event? See #4655
view
}
])
if (this.validMutation) {
calendar.dispatch({
type: 'MERGE_EVENTS',
eventStore: mutatedRelevantEvents
if (ev.isTouch) {
// need to select a different event?
if (eventInstanceId !== _this.component.props.eventSelection) {
initialCalendar.dispatch({ type: 'SELECT_EVENT', eventInstanceId: eventInstanceId });
}
}
else {
// if now using mouse, but was previous touch interaction, clear selected event
initialCalendar.dispatch({ type: 'UNSELECT_EVENT' });
}
if (_this.isDragging) {
initialCalendar.unselect(ev); // unselect *date* selection
initialCalendar.publiclyTrigger('eventDragStart', [
{
el: _this.subjectSeg.el,
event: new EventApi(initialCalendar, eventRange.def, eventRange.instance),
jsEvent: ev.origEvent,
view: _this.component.view
}
]);
}
};
_this.handleHitUpdate = function (hit, isFinal) {
jsEvent: ev.origEvent,
view: view
}
]);
if (_this.validMutation) {
calendar.dispatch({
type: 'MERGE_EVENTS',
eventStore: mutatedRelevantEvents
});
calendar.publiclyTrigger('eventResize', [
{
el: _this.draggingSeg.el,
startDelta: _this.validMutation.startDelta || createDuration(0),
endDelta: _this.validMutation.endDelta || createDuration(0),
prevEvent: eventApi,
event: new EventApi(// the data AFTER the mutation
calendar, mutatedRelevantEvents.defs[eventDef.defId], eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null),
revert: function () {
calendar.dispatch({
type: 'MERGE_EVENTS',
eventStore: relevantEvents
});
},
jsEvent: ev.origEvent,
view: view
}
]);
}
else {
calendar.publiclyTrigger('_noEventResize');
}
// reset all internal state
}
])
if (this.validMutation) {
calendar.dispatch({
type: 'MERGE_EVENTS',
eventStore: mutatedRelevantEvents
})
calendar.publiclyTrigger('eventResize', [
{
el: this.draggingSeg.el,
startDelta: this.validMutation.startDelta || createDuration(0),
endDelta: this.validMutation.endDelta || createDuration(0),
prevEvent: eventApi,
event: new EventApi( // the data AFTER the mutation
calendar,
mutatedRelevantEvents.defs[eventDef.defId],
eventInstance ? mutatedRelevantEvents.instances[eventInstance.instanceId] : null
),
revert: function() {
calendar.dispatch({
type: 'MERGE_EVENTS',
eventStore: relevantEvents
})
},
jsEvent: ev.origEvent,
view
}
])
} else {
_this.handleDragStart = function (ev) {
var calendar = _this.component.calendar;
var eventRange = _this.eventRange;
_this.relevantEvents = getRelevantEvents(calendar.state.eventStore, _this.eventRange.instance.instanceId);
_this.draggingSeg = _this.querySeg(ev);
calendar.unselect();
calendar.publiclyTrigger('eventResizeStart', [
{
el: _this.draggingSeg.el,
event: new EventApi(calendar, eventRange.def, eventRange.instance),
jsEvent: ev.origEvent,
view: _this.component.view
}
]);
};
_this.handleHitUpdate = function (hit, isFinal, ev) {
_this.handleDragEnd = function (ev) {
var calendar = _this.component.calendar;
var view = _this.component.view;
var eventDef = _this.eventRange.def;
var eventInstance = _this.eventRange.instance;
var eventApi = new EventApi(calendar, eventDef, eventInstance);
var relevantEvents = _this.relevantEvents;
var mutatedRelevantEvents = _this.mutatedRelevantEvents;
calendar.publiclyTrigger('eventResizeStop', [
{
el: _this.draggingSeg.el,
event: eventApi,
jsEvent: ev.origEvent,
view: view
}
]);
if (_this.validMutation) {
calendar.dispatch({
type: 'MERGE_EVENTS',
eventStore: mutatedRelevantEvents
});
calendar.publiclyTrigger('eventResize', [