For AI agents: the complete documentation index is available at https://gultyayev.github.io/ngx-virtual-dnd/llms.txt, the full documentation bundle is available at https://gultyayev.github.io/ngx-virtual-dnd/llms-full.txt, and this page is available as Markdown at https://gultyayev.github.io/ngx-virtual-dnd/api/utilities.md.

Utilities

See Handling drops for how to choose between them.

moveItem

function moveItem<T>(event: DropEvent, lists: Record<string, WritableSignal<T[]>>): void;

Moves the item between (or within) signal-based lists, keyed by droppable ID. Same-list drops are delegated to reorderItems. If either droppable ID is missing from lists, or the source item does not exist, nothing happens and a warning is logged in dev mode.

reorderItems

function reorderItems<T>(event: DropEvent, list: WritableSignal<T[]>): void;

Reorders a single signal-based list. Use it for same-list drops only. If the source item does not exist (for example, the list changed during the drag), nothing happens and a warning is logged in dev mode.

applyMove

function applyMove<T>(event: DropEvent, lists: Record<string, T[]>): Record<string, T[]>;

Immutable version for stores. Returns a shallow copy of lists with new arrays for the source and destination. If the source item does not exist, it returns a shallow copy with the original arrays.

isNoOpDrop

function isNoOpDrop(event: DropEvent): boolean;

true when the source and destination droppable and index are equal, meaning the item was dropped where it started.

insertAt / removeAt

function insertAt<T>(list: T[], item: T, index: number): T[];
function removeAt<T>(list: T[], index: number): T[];

Return new arrays; the input is not modified.