Replies: 8 comments 9 replies
-
Hi @doug-benn Thanks for your interest in the Event Calendar!
Well, this was not part of my plans to improve the calendar. I need to figure out how complex the implementation might be. But if someone has a desire to write code and make a pull request, this is only welcome 😄 |
Beta Was this translation helpful? Give feedback.
-
Focusing on FullCalendar, it seems to me that the task is not trivial. Much will have to be done. I will try to implement the basic functionality if more people ask for it in this ticket. Or when I have enough free time 😄 In any case, thanks for pointing out what could be improved in the calendar. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
For people trying to do this I was able to replicate a similar behavior by having an array of pending events as buttons. When user click on the button a "pendingEvent" variable will get the event object and then on calendar dateClick the event will be added. That will import the event into the calendar which then can be move around normally.
|
Beta Was this translation helpful? Give feedback.
-
A drag and drop function such as full cals would be amazing! I think that is the only thing I really wish could be added. |
Beta Was this translation helpful? Give feedback.
-
I would like to start contributing in some manner, can you advise me of a place you need/want help in or something that is popular with the community that I can look into? |
Beta Was this translation helpful? Give feedback.
-
Based on #61 I have put together a workaround, that is pretty close. It's not a real drag&drop, as it initiates the drag on click and completes on another, and it's not quite finished, but works for the most part: initClickToDragUnscheduled = () => {
this.unassignedTaskListTarget.querySelectorAll('.draggableHandle').forEach((handle) => {
handle.addEventListener('click', (e) => {
e.preventDefault();
const task = e.target.closest('.draggable');
this.draggingEventId = task.dataset.taskId;
const initialStyle = {
position: task.style.position,
zIndex: task.style.zIndex,
pointerEvents: task.style.pointerEvents,
left: task.style.left,
top: task.style.top
}
task.style.position = 'absolute';
task.style.pointerEvents = 'none';
task.style.zIndex = 10;
const initialPositionInPage = {
x: e.pageX - e.offsetX - task.offsetLeft,
y: e.pageY - e.offsetY - task.offsetTop
};
function moveAt(pageX, pageY) {
task.style.left = pageX - initialPositionInPage.x + 'px';
task.style.top = pageY - initialPositionInPage.y + 'px';
}
function onMouseMove(event) {
moveAt(event.pageX, event.pageY);
}
document.addEventListener('mousemove', onMouseMove);
document.addEventListener('mouseup', (event) => {
document.removeEventListener('mousemove', onMouseMove);
// document.removeEventListener('mouseup', onMouseUp);
// reset style
task.style.position = initialStyle.position;
task.style.zIndex = initialStyle.zIndex;
task.style.pointerEvents = initialStyle.pointerEvents;
task.style.left = initialStyle.left;
task.style.top = initialStyle.top;
});
});
});
} Then on handleDateClick = async (info) => {
if (!this.draggingEventId) {
return;
}
const result = await this._scheduleTask(
this.draggingEventId,
info.date,
info.resource.id
);
if (!result) {
// drag reverts by resetting item style
}
} Then in scheduleTask you can either call |
Beta Was this translation helpful? Give feedback.
-
Still no plans to add External Events in this calc? very very need it |
Beta Was this translation helpful? Give feedback.
-
Hello,
Firstly great work! Docs are great so thank you.
Would it be possible todo an external drag and drop into the calendar? E.g. a List of unscheduled events on the right of the calender then drag them in to schedual them? A working example I've found - https://demo.mobiscroll.com/javascript/eventcalendar/external-drag-drop#
I'll be honest I'm new to svelte and I'd like to use this calender for a firsrt learning project so thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions