[#77] blocked resize and DnD on recurring events
This commit is contained in:
@@ -14,6 +14,7 @@ import { CalendarEvent } from "../../features/Events/EventsTypes";
|
|||||||
import CalendarSelection from "./CalendarSelection";
|
import CalendarSelection from "./CalendarSelection";
|
||||||
import {
|
import {
|
||||||
getCalendarDetailAsync,
|
getCalendarDetailAsync,
|
||||||
|
getEventAsync,
|
||||||
putEventAsync,
|
putEventAsync,
|
||||||
updateEventLocal,
|
updateEventLocal,
|
||||||
} from "../../features/Calendars/CalendarSlice";
|
} from "../../features/Calendars/CalendarSlice";
|
||||||
@@ -326,11 +327,21 @@ export default function CalendarApp() {
|
|||||||
setEventDisplayedCalId(info.event.extendedProps.calId);
|
setEventDisplayedCalId(info.event.extendedProps.calId);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
eventAllow={(dropInfo, draggedEvent) => {
|
||||||
|
if (
|
||||||
|
draggedEvent?.extendedProps.uid &&
|
||||||
|
draggedEvent.extendedProps.uid.split("/")[1]
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}}
|
||||||
eventDrop={(arg) => {
|
eventDrop={(arg) => {
|
||||||
const event =
|
const event =
|
||||||
calendars[arg.event._def.extendedProps.calId].events[
|
calendars[arg.event._def.extendedProps.calId].events[
|
||||||
arg.event._def.extendedProps.uid
|
arg.event._def.extendedProps.uid
|
||||||
];
|
];
|
||||||
|
|
||||||
const totalDeltaMs = getDeltaInMilliseconds(arg.delta);
|
const totalDeltaMs = getDeltaInMilliseconds(arg.delta);
|
||||||
|
|
||||||
const originalStart = new Date(event.start);
|
const originalStart = new Date(event.start);
|
||||||
@@ -358,7 +369,9 @@ export default function CalendarApp() {
|
|||||||
calendars[arg.event._def.extendedProps.calId].events[
|
calendars[arg.event._def.extendedProps.calId].events[
|
||||||
arg.event._def.extendedProps.uid
|
arg.event._def.extendedProps.uid
|
||||||
];
|
];
|
||||||
|
if (event.uid.split("/")[1]) {
|
||||||
|
dispatch(getEventAsync(event));
|
||||||
|
}
|
||||||
const originalStart = new Date(event.start);
|
const originalStart = new Date(event.start);
|
||||||
const computedNewStart = new Date(
|
const computedNewStart = new Date(
|
||||||
originalStart.getTime() + getDeltaInMilliseconds(arg.startDelta)
|
originalStart.getTime() + getDeltaInMilliseconds(arg.startDelta)
|
||||||
@@ -372,7 +385,7 @@ export default function CalendarApp() {
|
|||||||
start: computedNewStart,
|
start: computedNewStart,
|
||||||
end: computedNewEnd,
|
end: computedNewEnd,
|
||||||
} as CalendarEvent;
|
} as CalendarEvent;
|
||||||
console.log(event , newEvent);
|
console.log(event, newEvent);
|
||||||
dispatch(
|
dispatch(
|
||||||
putEventAsync({ cal: calendars[newEvent.calId], newEvent })
|
putEventAsync({ cal: calendars[newEvent.calId], newEvent })
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user