226 lines
5.4 KiB
TypeScript
226 lines
5.4 KiB
TypeScript
|
|
import { CalendarConfig as ICalendarConfig, ViewPeriod, CalendarMode } from '../types/CalendarTypes';
|
||
|
|
/**
|
||
|
|
* All-day event layout constants
|
||
|
|
*/
|
||
|
|
export declare const ALL_DAY_CONSTANTS: {
|
||
|
|
readonly EVENT_HEIGHT: 22;
|
||
|
|
readonly EVENT_GAP: 2;
|
||
|
|
readonly CONTAINER_PADDING: 4;
|
||
|
|
readonly MAX_COLLAPSED_ROWS: 4;
|
||
|
|
readonly SINGLE_ROW_HEIGHT: number;
|
||
|
|
};
|
||
|
|
/**
|
||
|
|
* Layout and timing settings for the calendar grid
|
||
|
|
*/
|
||
|
|
interface GridSettings {
|
||
|
|
dayStartHour: number;
|
||
|
|
dayEndHour: number;
|
||
|
|
workStartHour: number;
|
||
|
|
workEndHour: number;
|
||
|
|
hourHeight: number;
|
||
|
|
snapInterval: number;
|
||
|
|
fitToWidth: boolean;
|
||
|
|
scrollToHour: number | null;
|
||
|
|
gridStartThresholdMinutes: number;
|
||
|
|
showCurrentTime: boolean;
|
||
|
|
showWorkHours: boolean;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* View settings for date-based calendar mode
|
||
|
|
*/
|
||
|
|
interface DateViewSettings {
|
||
|
|
period: ViewPeriod;
|
||
|
|
weekDays: number;
|
||
|
|
firstDayOfWeek: number;
|
||
|
|
showAllDay: boolean;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Work week configuration settings
|
||
|
|
*/
|
||
|
|
interface WorkWeekSettings {
|
||
|
|
id: string;
|
||
|
|
workDays: number[];
|
||
|
|
totalDays: number;
|
||
|
|
firstWorkDay: number;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* View settings for resource-based calendar mode
|
||
|
|
*/
|
||
|
|
interface ResourceViewSettings {
|
||
|
|
maxResources: number;
|
||
|
|
showAvatars: boolean;
|
||
|
|
avatarSize: number;
|
||
|
|
resourceNameFormat: 'full' | 'short';
|
||
|
|
showResourceDetails: boolean;
|
||
|
|
showAllDay: boolean;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Time format configuration settings
|
||
|
|
*/
|
||
|
|
interface TimeFormatConfig {
|
||
|
|
timezone: string;
|
||
|
|
use24HourFormat: boolean;
|
||
|
|
locale: string;
|
||
|
|
dateFormat: 'locale' | 'technical';
|
||
|
|
showSeconds: boolean;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Calendar configuration management
|
||
|
|
*/
|
||
|
|
export declare class CalendarConfig {
|
||
|
|
private config;
|
||
|
|
private calendarMode;
|
||
|
|
private selectedDate;
|
||
|
|
private gridSettings;
|
||
|
|
private dateViewSettings;
|
||
|
|
private resourceViewSettings;
|
||
|
|
private currentWorkWeek;
|
||
|
|
private timeFormatConfig;
|
||
|
|
constructor();
|
||
|
|
/**
|
||
|
|
* Load calendar type and date from URL parameters
|
||
|
|
*/
|
||
|
|
private loadCalendarType;
|
||
|
|
/**
|
||
|
|
* Load configuration from DOM data attributes
|
||
|
|
*/
|
||
|
|
private loadFromDOM;
|
||
|
|
/**
|
||
|
|
* Get a config value
|
||
|
|
*/
|
||
|
|
get<K extends keyof ICalendarConfig>(key: K): ICalendarConfig[K];
|
||
|
|
/**
|
||
|
|
* Set a config value
|
||
|
|
*/
|
||
|
|
set<K extends keyof ICalendarConfig>(key: K, value: ICalendarConfig[K]): void;
|
||
|
|
/**
|
||
|
|
* Update multiple config values
|
||
|
|
*/
|
||
|
|
update(updates: Partial<ICalendarConfig>): void;
|
||
|
|
/**
|
||
|
|
* Get all config
|
||
|
|
*/
|
||
|
|
getAll(): ICalendarConfig;
|
||
|
|
/**
|
||
|
|
* Calculate derived values
|
||
|
|
*/
|
||
|
|
get minuteHeight(): number;
|
||
|
|
get totalHours(): number;
|
||
|
|
get totalMinutes(): number;
|
||
|
|
get slotsPerHour(): number;
|
||
|
|
get totalSlots(): number;
|
||
|
|
get slotHeight(): number;
|
||
|
|
/**
|
||
|
|
* Validate snap interval
|
||
|
|
*/
|
||
|
|
isValidSnapInterval(interval: number): boolean;
|
||
|
|
/**
|
||
|
|
* Get grid display settings
|
||
|
|
*/
|
||
|
|
getGridSettings(): GridSettings;
|
||
|
|
/**
|
||
|
|
* Update grid display settings
|
||
|
|
*/
|
||
|
|
updateGridSettings(updates: Partial<GridSettings>): void;
|
||
|
|
/**
|
||
|
|
* Get date view settings
|
||
|
|
*/
|
||
|
|
getDateViewSettings(): DateViewSettings;
|
||
|
|
/**
|
||
|
|
* Update date view settings
|
||
|
|
*/
|
||
|
|
updateDateViewSettings(updates: Partial<DateViewSettings>): void;
|
||
|
|
/**
|
||
|
|
* Get resource view settings
|
||
|
|
*/
|
||
|
|
getResourceViewSettings(): ResourceViewSettings;
|
||
|
|
/**
|
||
|
|
* Update resource view settings
|
||
|
|
*/
|
||
|
|
updateResourceViewSettings(updates: Partial<ResourceViewSettings>): void;
|
||
|
|
/**
|
||
|
|
* Check if current mode is resource-based
|
||
|
|
*/
|
||
|
|
isResourceMode(): boolean;
|
||
|
|
/**
|
||
|
|
* Check if current mode is date-based
|
||
|
|
*/
|
||
|
|
isDateMode(): boolean;
|
||
|
|
/**
|
||
|
|
* Get calendar mode
|
||
|
|
*/
|
||
|
|
getCalendarMode(): CalendarMode;
|
||
|
|
/**
|
||
|
|
* Set calendar mode
|
||
|
|
*/
|
||
|
|
setCalendarMode(mode: CalendarMode): void;
|
||
|
|
/**
|
||
|
|
* Get selected date
|
||
|
|
*/
|
||
|
|
getSelectedDate(): Date | null;
|
||
|
|
/**
|
||
|
|
* Set selected date
|
||
|
|
* Note: Does not emit events - caller is responsible for event emission
|
||
|
|
*/
|
||
|
|
setSelectedDate(date: Date): void;
|
||
|
|
/**
|
||
|
|
* Get work week presets
|
||
|
|
*/
|
||
|
|
private getWorkWeekPresets;
|
||
|
|
/**
|
||
|
|
* Get current work week settings
|
||
|
|
*/
|
||
|
|
getWorkWeekSettings(): WorkWeekSettings;
|
||
|
|
/**
|
||
|
|
* Set work week preset
|
||
|
|
* Note: Does not emit events - caller is responsible for event emission
|
||
|
|
*/
|
||
|
|
setWorkWeek(workWeekId: string): void;
|
||
|
|
/**
|
||
|
|
* Get current work week ID
|
||
|
|
*/
|
||
|
|
getCurrentWorkWeek(): string;
|
||
|
|
/**
|
||
|
|
* Get time format settings
|
||
|
|
*/
|
||
|
|
getTimeFormatSettings(): TimeFormatConfig;
|
||
|
|
/**
|
||
|
|
* Update time format settings
|
||
|
|
*/
|
||
|
|
updateTimeFormatSettings(updates: Partial<TimeFormatConfig>): void;
|
||
|
|
/**
|
||
|
|
* Set timezone (convenience method)
|
||
|
|
*/
|
||
|
|
setTimezone(timezone: string): void;
|
||
|
|
/**
|
||
|
|
* Set 12/24 hour format (convenience method)
|
||
|
|
*/
|
||
|
|
set24HourFormat(use24Hour: boolean): void;
|
||
|
|
/**
|
||
|
|
* Get configured timezone
|
||
|
|
*/
|
||
|
|
getTimezone(): string;
|
||
|
|
/**
|
||
|
|
* Get configured locale
|
||
|
|
*/
|
||
|
|
getLocale(): string;
|
||
|
|
/**
|
||
|
|
* Check if using 24-hour format
|
||
|
|
*/
|
||
|
|
is24HourFormat(): boolean;
|
||
|
|
/**
|
||
|
|
* Set date format (convenience method)
|
||
|
|
*/
|
||
|
|
setDateFormat(format: 'locale' | 'technical'): void;
|
||
|
|
/**
|
||
|
|
* Set whether to show seconds (convenience method)
|
||
|
|
*/
|
||
|
|
setShowSeconds(show: boolean): void;
|
||
|
|
/**
|
||
|
|
* Get current date format
|
||
|
|
*/
|
||
|
|
getDateFormat(): 'locale' | 'technical';
|
||
|
|
}
|
||
|
|
export declare const calendarConfig: CalendarConfig;
|
||
|
|
export {};
|