Needs work... changes css directly
This commit is contained in:
parent
b95a516806
commit
3db93a9e89
1 changed files with 47 additions and 2 deletions
|
|
@ -32,6 +32,11 @@ export class AllDayManager {
|
||||||
const { targetDate, originalElement } = (event as CustomEvent).detail;
|
const { targetDate, originalElement } = (event as CustomEvent).detail;
|
||||||
this.handleConvertToAllDay(targetDate, originalElement);
|
this.handleConvertToAllDay(targetDate, originalElement);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eventBus.on('drag:convert-from-allday', (event) => {
|
||||||
|
const { draggedEventId } = (event as CustomEvent).detail;
|
||||||
|
this.handleConvertFromAllDay(draggedEventId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -261,18 +266,58 @@ export class AllDayManager {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check if all-day event already exists for this event ID
|
||||||
|
const existingAllDayEvent = document.querySelector(`swp-allday-container swp-allday-event[data-event-id="${eventId}"]`);
|
||||||
|
if (existingAllDayEvent) {
|
||||||
|
// All-day event already exists, just ensure clone is hidden
|
||||||
|
const dragClone = document.querySelector(`swp-event[data-event-id="clone-${eventId}"]`);
|
||||||
|
if (dragClone) {
|
||||||
|
(dragClone as HTMLElement).style.display = 'none';
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Use renderer to create and add all-day event
|
// Use renderer to create and add all-day event
|
||||||
const allDayElement = this.allDayEventRenderer.renderAllDayEvent(calendarEvent, targetDate);
|
const allDayElement = this.allDayEventRenderer.renderAllDayEvent(calendarEvent, targetDate);
|
||||||
|
|
||||||
if (allDayElement) {
|
if (allDayElement) {
|
||||||
// Remove original timed event
|
// Hide drag clone completely
|
||||||
originalElement.remove();
|
const dragClone = document.querySelector(`swp-event[data-event-id="clone-${eventId}"]`);
|
||||||
|
if (dragClone) {
|
||||||
|
(dragClone as HTMLElement).style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
// Animate height change
|
// Animate height change
|
||||||
this.checkAndAnimateAllDayHeight();
|
this.checkAndAnimateAllDayHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle conversion from all-day event back to day event
|
||||||
|
*/
|
||||||
|
private handleConvertFromAllDay(draggedEventId: string): void {
|
||||||
|
// Find and remove all-day event specifically in the container
|
||||||
|
const allDayEvent = document.querySelector(`swp-allday-container swp-allday-event[data-event-id="${draggedEventId}"]`);
|
||||||
|
if (allDayEvent) {
|
||||||
|
allDayEvent.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show drag clone again with reset styles
|
||||||
|
const dragClone = document.querySelector(`swp-event[data-event-id="clone-${draggedEventId}"]`);
|
||||||
|
if (dragClone) {
|
||||||
|
const clone = dragClone as HTMLElement;
|
||||||
|
|
||||||
|
// Reset to standard day event styles
|
||||||
|
clone.style.display = 'block';
|
||||||
|
clone.style.zIndex = ''; // Fjern drag z-index
|
||||||
|
clone.style.cursor = ''; // Fjern drag cursor
|
||||||
|
clone.style.opacity = ''; // Fjern evt. opacity
|
||||||
|
clone.style.transform = ''; // Fjern evt. transforms
|
||||||
|
|
||||||
|
// Position styles (top, height, left, right) bevares
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update row height when all-day events change
|
* Update row height when all-day events change
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue