Renders all-day events based on header data
Refactors all-day event rendering to use header column data. This ensures events are rendered based on the actual visible dates in the header, improving accuracy and responsiveness to view changes. Removes direct dependency on week dates in `AllDayManager` and `EventRenderingService`, instead, the all-day manager is instantiated with event manager. Updates `HeaderManager` to emit header bounds.
This commit is contained in:
parent
ae3aab5dd0
commit
d7867d4a9f
7 changed files with 108 additions and 157 deletions
|
|
@ -87,4 +87,32 @@ export class ColumnDetectionUtils {
|
|||
public static getColumns(): ColumnBounds[] {
|
||||
return [...this.columnBoundsCache];
|
||||
}
|
||||
public static getHeaderColumns(): ColumnBounds[] {
|
||||
|
||||
let dayHeaders: ColumnBounds[] = [];
|
||||
|
||||
const dayColumns = document.querySelectorAll('swp-calendar-header swp-day-header');
|
||||
let index = 1;
|
||||
// Cache hver kolonnes x-grænser
|
||||
dayColumns.forEach(column => {
|
||||
const rect = column.getBoundingClientRect();
|
||||
const date = (column as HTMLElement).dataset.date;
|
||||
|
||||
if (date) {
|
||||
dayHeaders.push({
|
||||
boundingClientRect : rect,
|
||||
element: column as HTMLElement,
|
||||
date,
|
||||
left: rect.left,
|
||||
right: rect.right,
|
||||
index: index++
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Sorter efter x-position (fra venstre til højre)
|
||||
dayHeaders.sort((a, b) => a.left - b.left);
|
||||
return dayHeaders;
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue