Refactors all-day event rendering and DOM access

Decouples all-day event rendering, making it reactive to header readiness with period data.
Eliminates explicit DOM element caching, simplifying element access.
Enhances the `header:ready` event payload with `startDate` and `endDate`.
Improves all-day row height animation and calculation.
This commit is contained in:
Janus C. H. Knudsen 2025-09-22 23:37:43 +02:00
parent f5e9909935
commit 6498b0ba8e
6 changed files with 98 additions and 116 deletions

View file

@ -4,7 +4,8 @@ import { CalendarTypeFactory } from '../factories/CalendarTypeFactory';
import { CoreEvents } from '../constants/CoreEvents';
import { HeaderRenderContext } from '../renderers/HeaderRenderer';
import { ResourceCalendarData } from '../types/CalendarTypes';
import { DragMouseEnterHeaderEventPayload, DragMouseLeaveHeaderEventPayload } from '../types/EventTypes';
import { DragMouseEnterHeaderEventPayload, DragMouseLeaveHeaderEventPayload, HeaderReadyEventPayload } from '../types/EventTypes';
import { DateCalculator } from '../utils/DateCalculator';
/**
* HeaderManager - Handles all header-related event logic
@ -172,10 +173,18 @@ export class HeaderManager {
// Setup event listeners on the new content
this.setupHeaderDragListeners();
// Notify other managers that header is ready
eventBus.emit('header:ready', {
headerElement: calendarHeader
});
// Calculate period from current date
const weekStart = DateCalculator.getISOWeekStart(currentDate);
const weekEnd = DateCalculator.addDays(weekStart, 6);
// Notify other managers that header is ready with period data
const payload: HeaderReadyEventPayload = {
headerElement: calendarHeader,
startDate: weekStart,
endDate: weekEnd,
isNavigation: false
};
eventBus.emit('header:ready', payload);
}
/**