import type { ReactiveController } from 'lit'; import type { ColumnConfiguration, GridHost, Keys } from '../internal/types.js'; /** * Live drag state surfaced to the header row so it can render the floating * "ghost" element that follows the cursor. * * @remarks * The dragged column itself stays in the columns array — we live-swap it * with neighbours as the cursor crosses their midpoints, so the rendered * order updates while the user is still dragging. The ghost is purely a * visual indicator of what the user is grabbing. */ interface ReorderState { /** The column currently being dragged. */ sourceKey: Keys; /** Ghost position (viewport-relative top-left, in CSS pixels). */ ghostX: number; ghostY: number; /** Ghost size — fixed at the source header's initial bounding rect. */ ghostWidth: number; ghostHeight: number; /** Cursor offset within the ghost so the grab point stays under the cursor. */ pointerOffsetX: number; pointerOffsetY: number; /** Display label for the ghost (header text or column key). */ label: string; } /** * Reactive controller backing pointer-driven column reordering with a * floating ghost and live mid-drag swaps. * * @remarks * Headers feed `pointerdown` / `pointermove` / `pointerup` events into the * controller. While dragging, the controller updates the ghost position and * decides whether the cursor has crossed an adjacent column's midpoint — * if so it calls {@link ApexGrid.moveColumn} immediately, so the swap * happens during the drag instead of waiting for drop. The same cancellable * `columnMoving` / follow-up `columnMoved` event pipeline applies for * every swap. */ export declare class ReorderController implements ReactiveController { #private; protected host: GridHost; state: ReorderState | null; constructor(host: GridHost); hostConnected(): void; protected get headerRow(): (HTMLElement & { headers?: Array; }>; }) | undefined; /** * Whether reordering is enabled for the given column. */ isDraggable(column: ColumnConfiguration): boolean; /** * Whether `source` may be dropped onto `target`. Cross-pinning-group moves * are blocked so the drag can't escape its pin region. */ canDrop(source: ColumnConfiguration, target: ColumnConfiguration): boolean; /** * Begins a drag from `sourceKey`. Captures the source's bounding rect and * the cursor offset within it so the ghost stays anchored to the grab * point as the cursor moves. */ start(sourceKey: Keys, sourceRect: DOMRect, initialClientX: number, initialClientY: number, label: string): void; /** * Updates the ghost position and decides whether to swap with an adjacent * column. */ move(clientX: number, clientY: number): void; /** * Ends the drag session. The columns are already in their final order * because we live-swapped during the drag, so there's nothing to commit. */ end(): void; } export {};