Separates all-day event rendering; handles header lifecycle

Event rendering strategies now exclusively handle timed events, while all-day events are managed by a dedicated renderer.

Centralizes calendar header creation within `GridRenderer`, ensuring the header element is always present from initial DOM construction. `HeaderManager` and `ScrollManager` now react to a `header:ready` event, which signifies the header is fully initialized.

Synchronizes all-day event rendering with header readiness, temporarily queuing events until the header is prepared. Emits an `allday:checkHeight` event to prompt all-day container height adjustments after rendering.
This commit is contained in:
Janus C. H. Knudsen 2025-09-22 21:53:18 +02:00
parent 996459f226
commit f5e9909935
6 changed files with 128 additions and 18 deletions

View file

@ -172,27 +172,21 @@ export class HeaderManager {
// Setup event listeners on the new content
this.setupHeaderDragListeners();
// Notify other managers that header was rebuilt
eventBus.emit('header:rebuilt', {
// Notify other managers that header is ready
eventBus.emit('header:ready', {
headerElement: calendarHeader
});
}
/**
* Get or create calendar header element
* Get calendar header element - header always exists now
*/
private getOrCreateCalendarHeader(): HTMLElement | null {
let calendarHeader = this.getCalendarHeader();
const calendarHeader = this.getCalendarHeader();
if (!calendarHeader) {
// Find grid container and create header
const gridContainer = document.querySelector('swp-grid-container');
if (gridContainer) {
calendarHeader = document.createElement('swp-calendar-header');
// Insert header as first child
gridContainer.insertBefore(calendarHeader, gridContainer.firstChild);
}
console.warn('HeaderManager: Calendar header not found - should always exist now!');
return null;
}
return calendarHeader;