Refactor calendar datasource and event management

Enhances calendar flexibility by introducing group-based column spanning and improving cross-mode event handling

Adds support for:
- Dynamic column grouping in date and resource modes
- Consistent event drag-and-drop across different calendar views
- More robust all-day event layout calculations

Improves event management logic to handle resource and date mode transitions more elegantly
This commit is contained in:
Janus C. H. Knudsen 2025-11-25 19:04:06 +01:00
parent 17909696ed
commit d8b9f6dabd
16 changed files with 192 additions and 79 deletions

View file

@ -9,6 +9,7 @@ export interface IColumnInfo {
identifier: string; // "2024-11-13" (date mode) or "person-1" (resource mode)
data: Date | IResource; // Date for date-mode, IResource for resource-mode
events: ICalendarEvent[]; // Events for this column (pre-filtered by datasource)
groupId: string; // Group ID for spanning logic - events can only span columns with same groupId
}
/**
@ -40,6 +41,11 @@ export interface IColumnDataSource {
*/
setCurrentDate(date: Date): void;
/**
* Get the current date
*/
getCurrentDate(): Date;
/**
* Update the current view (day/week/month)
* @param view - The new calendar view

View file

@ -43,6 +43,8 @@ export interface IDragEndEventPayload {
originalSourceColumn: IColumnBounds; // Original column where drag started
finalPosition: {
column: IColumnBounds | null; // Where drag ended
date: Date; // Always present - the date for this position
resourceId?: string; // Only in resource mode
snappedY: number;
};
target: 'swp-day-column' | 'swp-day-header' | null;