This commit is contained in:
Janus C. H. Knudsen 2025-10-06 21:55:52 +02:00
parent 69495ce00f
commit e838719d46
3 changed files with 4 additions and 122 deletions

View file

@ -43,49 +43,6 @@ export const CoreEvents = {
// Filter events (1) // Filter events (1)
FILTER_CHANGED: 'filter:changed', FILTER_CHANGED: 'filter:changed',
// Rendering events (1) // Rendering events (1)
EVENTS_RENDERED: 'events:rendered' EVENTS_RENDERED: 'events:rendered'
} as const; } as const;
// Type for the event values
export type CoreEventType = typeof CoreEvents[keyof typeof CoreEvents];
/**
* Migration map from old EventTypes to CoreEvents
* This helps transition existing code gradually
*/
export const EVENT_MIGRATION_MAP: Record<string, string> = {
// Lifecycle
'calendar:initialized': CoreEvents.INITIALIZED,
'calendar:ready': CoreEvents.READY,
// View
'calendar:viewchanged': CoreEvents.VIEW_CHANGED,
'calendar:viewrendered': CoreEvents.VIEW_RENDERED,
'calendar:workweekchanged': CoreEvents.WORKWEEK_CHANGED,
// Navigation
'calendar:datechanged': CoreEvents.DATE_CHANGED,
'calendar:navigationcompleted': CoreEvents.NAVIGATION_COMPLETED,
'calendar:periodinfoUpdate': CoreEvents.PERIOD_INFO_UPDATE,
// Data
'calendar:datafetchstart': CoreEvents.DATA_LOADING,
'calendar:datafetchsuccess': CoreEvents.DATA_LOADED,
'calendar:datafetcherror': CoreEvents.DATA_ERROR,
'calendar:eventsloaded': CoreEvents.DATA_LOADED,
// Grid
'calendar:gridrendered': CoreEvents.GRID_RENDERED,
'calendar:gridclick': CoreEvents.GRID_CLICKED,
// Event management
'calendar:eventcreated': CoreEvents.EVENT_CREATED,
'calendar:eventupdated': CoreEvents.EVENT_UPDATED,
'calendar:eventdeleted': CoreEvents.EVENT_DELETED,
'calendar:eventselected': CoreEvents.EVENT_SELECTED,
// System
'calendar:error': CoreEvents.ERROR,
'calendar:refreshrequested': CoreEvents.REFRESH_REQUESTED
};

View file

@ -97,49 +97,4 @@ export interface IEventBus {
emit(eventType: string, detail?: unknown): boolean; emit(eventType: string, detail?: unknown): boolean;
getEventLog(eventType?: string): EventLogEntry[]; getEventLog(eventType?: string): EventLogEntry[];
setDebug(enabled: boolean): void; setDebug(enabled: boolean): void;
} }
export interface GridPosition {
minutes: number;
time: string;
y: number;
}
export interface Period {
start: string;
end: string;
mode?: CalendarMode; // Optional: which calendar mode this period is for
}
export interface EventData {
events: CalendarEvent[];
meta: {
start: string;
end: string;
total: number;
mode?: CalendarMode; // Which calendar mode this data is for
};
}
/**
* Context interfaces for different calendar modes
*/
export interface DateModeContext {
mode: 'date';
currentWeek: Date;
period: ViewPeriod;
weekDays: number;
firstDayOfWeek: number;
}
export interface ResourceModeContext {
mode: 'resource';
selectedDate: Date;
resources: Resource[];
maxResources: number;
}
/**
* Union type for type-safe mode contexts
*/
export type CalendarModeContext = DateModeContext | ResourceModeContext;

View file

@ -1,40 +1,10 @@
/** /**
* Type definitions for calendar events * Type definitions for calendar events and drag operations
*/ */
import { ColumnBounds } from "../utils/ColumnDetectionUtils"; import { ColumnBounds } from "../utils/ColumnDetectionUtils";
import { CalendarEvent } from "./CalendarTypes"; import { CalendarEvent } from "./CalendarTypes";
export interface AllDayEvent {
id: string;
title: string;
start: Date | string;
end: Date | string;
allDay: true;
color?: string;
metadata?: {
color?: string;
category?: string;
location?: string;
};
}
export interface TimeEvent {
id: string;
title: string;
start: Date | string;
end: Date | string;
allDay?: false;
color?: string;
metadata?: {
color?: string;
category?: string;
location?: string;
};
}
export type CalendarEventData = AllDayEvent | TimeEvent;
/** /**
* Drag Event Payload Interfaces * Drag Event Payload Interfaces
* Type-safe interfaces for drag and drop events * Type-safe interfaces for drag and drop events