Centralizes date calculation logic into DateColumnDataSource Improves separation of concerns across rendering components Key changes: - Introduces IColumnInfo interface for flexible column data - Moves date calculation from multiple managers to dedicated datasource - Removes duplicate date rendering logic - Prepares architecture for future resource-based views
106 lines
No EOL
2.7 KiB
TypeScript
106 lines
No EOL
2.7 KiB
TypeScript
/**
|
|
* Type definitions for calendar events and drag operations
|
|
*/
|
|
|
|
import { IColumnBounds } from "../utils/ColumnDetectionUtils";
|
|
import { ICalendarEvent } from "./CalendarTypes";
|
|
|
|
/**
|
|
* Drag Event Payload Interfaces
|
|
* Type-safe interfaces for drag and drop events
|
|
*/
|
|
|
|
// Common position interface
|
|
export interface IMousePosition {
|
|
x: number;
|
|
y: number;
|
|
}
|
|
|
|
// Drag start event payload
|
|
export interface IDragStartEventPayload {
|
|
originalElement: HTMLElement;
|
|
draggedClone: HTMLElement | null;
|
|
mousePosition: IMousePosition;
|
|
mouseOffset: IMousePosition;
|
|
columnBounds: IColumnBounds | null;
|
|
}
|
|
|
|
// Drag move event payload
|
|
export interface IDragMoveEventPayload {
|
|
originalElement: HTMLElement;
|
|
draggedClone: HTMLElement;
|
|
mousePosition: IMousePosition;
|
|
mouseOffset: IMousePosition;
|
|
columnBounds: IColumnBounds | null;
|
|
snappedY: number;
|
|
}
|
|
|
|
// Drag end event payload
|
|
export interface IDragEndEventPayload {
|
|
originalElement: HTMLElement;
|
|
draggedClone: HTMLElement | null;
|
|
mousePosition: IMousePosition;
|
|
originalSourceColumn: IColumnBounds; // Original column where drag started
|
|
finalPosition: {
|
|
column: IColumnBounds | null; // Where drag ended
|
|
snappedY: number;
|
|
};
|
|
target: 'swp-day-column' | 'swp-day-header' | null;
|
|
}
|
|
|
|
// Drag mouse enter header event payload
|
|
export interface IDragMouseEnterHeaderEventPayload {
|
|
targetColumn: IColumnBounds;
|
|
mousePosition: IMousePosition;
|
|
originalElement: HTMLElement | null;
|
|
draggedClone: HTMLElement;
|
|
calendarEvent: ICalendarEvent;
|
|
replaceClone: (newClone: HTMLElement) => void;
|
|
}
|
|
|
|
// Drag mouse leave header event payload
|
|
export interface IDragMouseLeaveHeaderEventPayload {
|
|
targetColumn: IColumnBounds | null;
|
|
mousePosition: IMousePosition;
|
|
originalElement: HTMLElement| null;
|
|
draggedClone: HTMLElement| null;
|
|
}
|
|
|
|
// Drag mouse enter column event payload
|
|
export interface IDragMouseEnterColumnEventPayload {
|
|
targetColumn: IColumnBounds;
|
|
mousePosition: IMousePosition;
|
|
snappedY: number;
|
|
originalElement: HTMLElement | null;
|
|
draggedClone: HTMLElement;
|
|
calendarEvent: ICalendarEvent;
|
|
replaceClone: (newClone: HTMLElement) => void;
|
|
}
|
|
|
|
// Drag column change event payload
|
|
export interface IDragColumnChangeEventPayload {
|
|
originalElement: HTMLElement;
|
|
draggedClone: HTMLElement;
|
|
previousColumn: IColumnBounds | null;
|
|
newColumn: IColumnBounds;
|
|
mousePosition: IMousePosition;
|
|
}
|
|
|
|
// Header ready event payload
|
|
export interface IHeaderReadyEventPayload {
|
|
headerElements: IColumnBounds[];
|
|
|
|
}
|
|
|
|
// Resize end event payload
|
|
export interface IResizeEndEventPayload {
|
|
eventId: string;
|
|
element: HTMLElement;
|
|
finalHeight: number;
|
|
}
|
|
|
|
// Navigation button clicked event payload
|
|
export interface INavButtonClickedEventPayload {
|
|
direction: 'next' | 'previous' | 'today';
|
|
newDate: Date;
|
|
} |