Updates all-day event grid row layout

Ensures the all-day event container's grid layout is correctly updated to reflect the number of rows needed, even when the overall height doesn't change.
This prevents layout issues when events are rearranged without triggering a height recalculation.
Also updates the grid template when the height is updated in the BaseEventRenderer.
This commit is contained in:
Janus Knudsen 2025-08-27 20:54:06 +02:00
parent f9b7686b22
commit be4a8af7c4
3 changed files with 27 additions and 4 deletions

View file

@ -635,11 +635,27 @@ export class ColumnDetector {
Promise.all(animations.map(anim => anim.finished)).then(() => {
root.style.setProperty('--all-day-row-height', `${calculatedHeight}px`);
// Update grid-template-rows for all swp-allday-containers
const allDayContainers = document.querySelectorAll('swp-allday-container');
allDayContainers.forEach(container => {
const gridRows = `repeat(${maxRow}, var(--allday-event-height, 26px))`;
(container as HTMLElement).style.gridTemplateRows = gridRows;
});
// Notify ScrollManager about header height change
eventBus.emit('header:height-changed');
});
console.log(`Animated all-day height: ${currentAllDayHeight}px → ${calculatedHeight}px (max stack: ${maxRow})`);
} else {
// Height hasn't changed but we still need to update grid-template-rows in case of different row arrangements
const allDayContainers = document.querySelectorAll('swp-allday-container');
allDayContainers.forEach(container => {
const gridRows = `repeat(${maxRow}, var(--allday-event-height, 26px))`;
(container as HTMLElement).style.gridTemplateRows = gridRows;
});
console.log(`All-day height unchanged (${currentAllDayHeight}px) but updated grid-template-rows to ${maxRow} rows`);
}
}