Skip to content

@eightkk/vue-weave / core / moveTimelineRow

Function: moveTimelineRow() ​

moveTimelineRow<R>(rows, id, target): R[]

Defined in: src/core/rowHierarchy.ts:48

Move a row, with its subtree, under target.parentId (a root row without it) at sibling position target.index. The index counts the new siblings without the moved row, from 0 (first) to their count (last). Returns the rows in tree preorder, so every subtree follows its row; the moved row is a new object and every other row keeps its identity. The input is not modified. Throws an Error for an unknown row or parent or a move into the row's own subtree, and a RangeError for an index that is not an integer in range.

Type Parameters ​

R ​

R extends TimelineRow<unknown>

Parameters ​

rows ​

readonly R[]

id ​

string

target ​

TimelineRowPosition

Returns ​

R[]

Released under the MIT License.