Calendar/src/types/ColumnDataSource.ts
Janus C. H. Knudsen eeaeddeef8 Adds resource-based calendar view mode
Introduces new ResourceColumnDataSource and ResourceHeaderRenderer to support column rendering by resources instead of dates

Enables dynamic calendar mode switching between date and resource views
Updates core managers and services to support async column retrieval
Refactors data source interfaces to use Promise-based methods

Improves calendar flexibility and resource management capabilities
2025-11-22 19:42:12 +01:00

42 lines
1.2 KiB
TypeScript

import { IResource } from './ResourceTypes';
import { CalendarView } from './CalendarTypes';
/**
* Column information container
* Contains both identifier and actual data for a column
*/
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
}
/**
* IColumnDataSource - Defines the contract for providing column data
*
* This interface abstracts away whether columns represent dates or resources,
* allowing the calendar to switch between date-based and resource-based views.
*/
export interface IColumnDataSource {
/**
* Get the list of columns to render
* @returns Array of column information
*/
getColumns(): Promise<IColumnInfo[]>;
/**
* Get the type of columns this datasource provides
*/
getType(): 'date' | 'resource';
/**
* Update the current date for column calculations
* @param date - The new current date
*/
setCurrentDate(date: Date): void;
/**
* Update the current view (day/week/month)
* @param view - The new calendar view
*/
setCurrentView(view: CalendarView): void;
}