Calendar/src/types/ColumnDataSource.ts

43 lines
1.2 KiB
TypeScript
Raw Normal View History

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;
}