2025-08-20 19:42:13 +02:00
|
|
|
/**
|
|
|
|
|
* Type definitions for calendar events
|
|
|
|
|
*/
|
|
|
|
|
|
2025-09-28 13:25:09 +02:00
|
|
|
import { ColumnBounds } from "../utils/ColumnDetectionUtils";
|
|
|
|
|
|
2025-08-20 19:42:13 +02:00
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-21 15:48:13 +02:00
|
|
|
export type CalendarEventData = AllDayEvent | TimeEvent;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Drag Event Payload Interfaces
|
|
|
|
|
* Type-safe interfaces for drag and drop events
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Common position interface
|
|
|
|
|
export interface MousePosition {
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag start event payload
|
|
|
|
|
export interface DragStartEventPayload {
|
|
|
|
|
draggedElement: HTMLElement;
|
2025-09-26 22:53:49 +02:00
|
|
|
draggedClone: HTMLElement | null;
|
2025-09-21 15:48:13 +02:00
|
|
|
mousePosition: MousePosition;
|
|
|
|
|
mouseOffset: MousePosition;
|
2025-09-28 13:25:09 +02:00
|
|
|
columnBounds: ColumnBounds | null;
|
2025-09-21 15:48:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag move event payload
|
|
|
|
|
export interface DragMoveEventPayload {
|
|
|
|
|
draggedElement: HTMLElement;
|
|
|
|
|
mousePosition: MousePosition;
|
|
|
|
|
mouseOffset: MousePosition;
|
2025-09-28 13:25:09 +02:00
|
|
|
columnBounds: ColumnBounds | null;
|
2025-09-21 15:48:13 +02:00
|
|
|
snappedY: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag end event payload
|
|
|
|
|
export interface DragEndEventPayload {
|
|
|
|
|
draggedElement: HTMLElement;
|
2025-09-27 15:01:22 +02:00
|
|
|
draggedClone: HTMLElement | null;
|
2025-09-21 15:48:13 +02:00
|
|
|
mousePosition: MousePosition;
|
|
|
|
|
finalPosition: {
|
2025-09-28 13:25:09 +02:00
|
|
|
column: ColumnBounds | null;
|
2025-09-21 15:48:13 +02:00
|
|
|
snappedY: number;
|
|
|
|
|
};
|
|
|
|
|
target: 'swp-day-column' | 'swp-day-header' | null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag mouse enter header event payload
|
|
|
|
|
export interface DragMouseEnterHeaderEventPayload {
|
2025-09-28 13:25:09 +02:00
|
|
|
targetColumn: ColumnBounds;
|
2025-09-21 15:48:13 +02:00
|
|
|
mousePosition: MousePosition;
|
|
|
|
|
originalElement: HTMLElement | null;
|
|
|
|
|
cloneElement: HTMLElement | null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag mouse leave header event payload
|
|
|
|
|
export interface DragMouseLeaveHeaderEventPayload {
|
|
|
|
|
targetDate: string | null;
|
|
|
|
|
mousePosition: MousePosition;
|
|
|
|
|
originalElement: HTMLElement| null;
|
|
|
|
|
cloneElement: HTMLElement| null;
|
2025-09-22 23:37:43 +02:00
|
|
|
}
|
|
|
|
|
|
2025-09-26 22:11:57 +02:00
|
|
|
// Drag column change event payload
|
|
|
|
|
export interface DragColumnChangeEventPayload {
|
|
|
|
|
draggedElement: HTMLElement;
|
2025-09-26 22:53:49 +02:00
|
|
|
draggedClone: HTMLElement | null;
|
2025-09-28 13:25:09 +02:00
|
|
|
previousColumn: ColumnBounds | null;
|
|
|
|
|
newColumn: ColumnBounds;
|
2025-09-26 22:11:57 +02:00
|
|
|
mousePosition: MousePosition;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-22 23:37:43 +02:00
|
|
|
// Header ready event payload
|
|
|
|
|
export interface HeaderReadyEventPayload {
|
|
|
|
|
headerElement: HTMLElement;
|
|
|
|
|
startDate: Date;
|
|
|
|
|
endDate: Date;
|
|
|
|
|
isNavigation?: boolean;
|
2025-09-21 15:48:13 +02:00
|
|
|
}
|