Tree drag options and destinations
treeRowDrag reorders siblings or changes parents within one tree. Enable it with {} and connect onChangeData. Omission disables dragging; manual moves are disabled while sorting.
Move contract
Section titled “Move contract”Moves the whole subtree, preserving collapsed descendants and expand values. Dropping inside a collapsed parent does not expand it. Restrict sources through rowProps.disabled/draggable. canDrop can narrow permission but cannot permit cycles or invalid destinations.
Start with pointer input or Space, choose a destination with arrow keys, confirm with Enter, or cancel with Escape. Left/right keys also apply when reparenting is enabled. A false onBeforeRowDrag veto produces no after notification. A started gesture reports its result through onAfterDragRow. See event payloads and Tree setup code.
CominsTreeRowDragConfig
Section titled “CominsTreeRowDragConfig”allowReparent
Section titled “allowReparent”allowReparent?: boolean;Default false. Allows only sibling moves under the same parent; true also permits moving between parents/root.
canDrop
Section titled “canDrop”canDrop?: (context: CominsTreeDropContext<TItem>) => boolean;Omission allows structurally valid moves. Return false to restrict them. May run during preview and commit; keep it synchronous and free of side effects.
CominsTreeMoveDestination
Section titled “CominsTreeMoveDestination”parentId
Section titled “parentId”parentId: CominsRowId | null;Required destination parent ID; null denotes the root array.
beforeRowId
Section titled “beforeRowId”beforeRowId: CominsRowId | null;Required sibling ID to insert before; null appends to the sibling array.
CominsTreeDropContext
Section titled “CominsTreeDropContext”source
Section titled “source”source: CominsVisibleTreeRow<TItem>;Visible source-node information.
target
Section titled “target”target: CominsVisibleTreeRow<TItem>;Target node selected by pointer/keyboard input.
destination
Section titled “destination”destination: CominsTreeMoveDestination;Resolved location as parentId and beforeRowId.
position
Section titled “position”position: CominsTreeDropPosition;before/after/inside relative to the target.
CominsVisibleTreeRow
Section titled “CominsVisibleTreeRow”depth: number;Zero-based depth; roots are 0.
expanded
Section titled “expanded”expanded: boolean;Current expansion state.
hasChildren
Section titled “hasChildren”hasChildren: boolean;Whether the node has children.
item: TItem;Source business data; treat as read-only.
path: readonly number[];Array-index path to the node, which can change after moving.
rowId: CominsRowId;Stable ID unique across all depths.
moveCominsTreeNode
Section titled “moveCominsTreeNode”export declare function moveCominsTreeNode<TItem>(nodes: readonly CominsTreeNode<TItem>[], rowId: CominsRowId, destination: CominsTreeMoveDestination, getRowId: (item: TItem, index: number) => CominsRowId, options?: { allowReparent?: boolean;}): readonly CominsTreeNode<TItem>[];Import from comins-table. nodes, rowId, destination, and getRowId are required; options.allowReparent defaults to false. Returns a new array, or the original reference for unchanged/invalid moves. Duplicate IDs throw. It emits no UI events and does not update state; apply the result to parent state.