2025-08-20 19:42:13 +02:00
|
|
|
/**
|
2025-10-06 21:55:52 +02:00
|
|
|
* Type definitions for calendar events and drag operations
|
2025-08-20 19:42:13 +02:00
|
|
|
*/
|
|
|
|
|
|
2025-11-03 21:30:50 +01:00
|
|
|
import { IColumnBounds } from "../utils/ColumnDetectionUtils";
|
|
|
|
|
import { ICalendarEvent } from "./CalendarTypes";
|
2025-09-28 13:25:09 +02:00
|
|
|
|
2025-09-21 15:48:13 +02:00
|
|
|
/**
|
|
|
|
|
* Drag Event Payload Interfaces
|
|
|
|
|
* Type-safe interfaces for drag and drop events
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Common position interface
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IMousePosition {
|
2025-09-21 15:48:13 +02:00
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag start event payload
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IDragStartEventPayload {
|
2025-10-12 22:00:02 +02:00
|
|
|
originalElement: HTMLElement;
|
2025-09-26 22:53:49 +02:00
|
|
|
draggedClone: HTMLElement | null;
|
2025-11-03 21:30:50 +01:00
|
|
|
mousePosition: IMousePosition;
|
|
|
|
|
mouseOffset: IMousePosition;
|
|
|
|
|
columnBounds: IColumnBounds | null;
|
2025-09-21 15:48:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag move event payload
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IDragMoveEventPayload {
|
2025-10-12 22:00:02 +02:00
|
|
|
originalElement: HTMLElement;
|
2025-09-30 00:13:52 +02:00
|
|
|
draggedClone: HTMLElement;
|
2025-11-03 21:30:50 +01:00
|
|
|
mousePosition: IMousePosition;
|
|
|
|
|
mouseOffset: IMousePosition;
|
|
|
|
|
columnBounds: IColumnBounds | null;
|
2025-09-21 15:48:13 +02:00
|
|
|
snappedY: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag end event payload
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IDragEndEventPayload {
|
2025-09-30 00:13:52 +02:00
|
|
|
originalElement: HTMLElement;
|
2025-09-27 15:01:22 +02:00
|
|
|
draggedClone: HTMLElement | null;
|
2025-11-03 21:30:50 +01:00
|
|
|
mousePosition: IMousePosition;
|
2025-11-06 16:18:31 +01:00
|
|
|
originalSourceColumn: IColumnBounds; // Original column where drag started
|
2025-09-21 15:48:13 +02:00
|
|
|
finalPosition: {
|
2025-11-03 21:30:50 +01:00
|
|
|
column: IColumnBounds | null; // Where drag ended
|
2025-09-21 15:48:13 +02:00
|
|
|
snappedY: number;
|
|
|
|
|
};
|
|
|
|
|
target: 'swp-day-column' | 'swp-day-header' | null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag mouse enter header event payload
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IDragMouseEnterHeaderEventPayload {
|
|
|
|
|
targetColumn: IColumnBounds;
|
|
|
|
|
mousePosition: IMousePosition;
|
2025-09-21 15:48:13 +02:00
|
|
|
originalElement: HTMLElement | null;
|
2025-09-30 00:13:52 +02:00
|
|
|
draggedClone: HTMLElement;
|
2025-11-03 21:30:50 +01:00
|
|
|
calendarEvent: ICalendarEvent;
|
2025-10-04 23:10:09 +02:00
|
|
|
replaceClone: (newClone: HTMLElement) => void;
|
2025-09-21 15:48:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drag mouse leave header event payload
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IDragMouseLeaveHeaderEventPayload {
|
2025-09-21 15:48:13 +02:00
|
|
|
targetDate: string | null;
|
2025-11-03 21:30:50 +01:00
|
|
|
mousePosition: IMousePosition;
|
2025-09-21 15:48:13 +02:00
|
|
|
originalElement: HTMLElement| null;
|
2025-09-30 00:13:52 +02:00
|
|
|
draggedClone: HTMLElement| null;
|
2025-09-22 23:37:43 +02:00
|
|
|
}
|
|
|
|
|
|
2025-10-10 16:41:48 +02:00
|
|
|
// Drag mouse enter column event payload
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IDragMouseEnterColumnEventPayload {
|
|
|
|
|
targetColumn: IColumnBounds;
|
|
|
|
|
mousePosition: IMousePosition;
|
2025-10-10 16:41:48 +02:00
|
|
|
snappedY: number;
|
|
|
|
|
originalElement: HTMLElement | null;
|
|
|
|
|
draggedClone: HTMLElement;
|
2025-11-03 21:30:50 +01:00
|
|
|
calendarEvent: ICalendarEvent;
|
2025-10-10 16:41:48 +02:00
|
|
|
replaceClone: (newClone: HTMLElement) => void;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-26 22:11:57 +02:00
|
|
|
// Drag column change event payload
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IDragColumnChangeEventPayload {
|
2025-09-30 00:13:52 +02:00
|
|
|
originalElement: HTMLElement;
|
2025-10-11 09:19:33 +02:00
|
|
|
draggedClone: HTMLElement;
|
2025-11-03 21:30:50 +01:00
|
|
|
previousColumn: IColumnBounds | null;
|
|
|
|
|
newColumn: IColumnBounds;
|
|
|
|
|
mousePosition: IMousePosition;
|
2025-09-26 22:11:57 +02:00
|
|
|
}
|
|
|
|
|
|
2025-09-22 23:37:43 +02:00
|
|
|
// Header ready event payload
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IHeaderReadyEventPayload {
|
|
|
|
|
headerElements: IColumnBounds[];
|
2025-10-08 22:18:06 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Resize end event payload
|
2025-11-03 21:30:50 +01:00
|
|
|
export interface IResizeEndEventPayload {
|
2025-10-08 22:18:06 +02:00
|
|
|
eventId: string;
|
|
|
|
|
element: HTMLElement;
|
|
|
|
|
finalHeight: number;
|
2025-11-13 20:41:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Navigation button clicked event payload
|
|
|
|
|
export interface INavButtonClickedEventPayload {
|
|
|
|
|
direction: 'next' | 'previous' | 'today';
|
|
|
|
|
newDate: Date;
|
2025-09-21 15:48:13 +02:00
|
|
|
}
|