Adds date-based column retrieval

Adds a method to retrieve column bounds based on a given date, enhancing date-specific event placement.

Removes unnecessary data storage for overflow event titles, simplifying overflow event handling.
This commit is contained in:
Janus C. H. Knudsen 2025-09-30 23:45:07 +02:00
parent 67dfb6e894
commit 6a17bba343
2 changed files with 18 additions and 8 deletions

View file

@ -551,10 +551,6 @@ export class AllDayManager {
const gridRow = parseInt(event.style.gridRow) || 1;
if (gridRow === 4) {
// Store original content before converting to indicator
if (!event.dataset.originalTitle) {
event.dataset.originalTitle = event.dataset.title || event.innerHTML;
}
// Convert row 4 events to indicators
const overflowCount = this.actualRowCount - 3; // Total overflow rows
@ -586,8 +582,6 @@ export class AllDayManager {
// Restore original title from data-title
if (htmlEvent.dataset.title) {
htmlEvent.innerHTML = htmlEvent.dataset.title;
} else if (htmlEvent.dataset.originalTitle) {
htmlEvent.innerHTML = htmlEvent.dataset.originalTitle;
}
});

View file

@ -67,6 +67,22 @@ export class ColumnDetectionUtils {
return null;
}
/**
* Get column bounds by Date
*/
public static getColumnBoundsByDate(date: Date): ColumnBounds | null {
if (this.columnBoundsCache.length === 0) {
this.updateColumnBoundsCache();
}
// Convert Date to YYYY-MM-DD format
var dateString = date.toISOString().split('T')[0];
// Find column that matches the date
var column = this.columnBoundsCache.find(col => col.date === dateString);
return column || null;
}
/**
* Clear cache (useful for testing or when DOM structure changes)
*/