moveTreeViewItem
A helper function which moves a TreeView item in an immutable way.
Parameters
sourceItemHierarchicalIndex string
The hierarchical index of the item that will be moved.
sourceData any[] | null | undefined
The tree which contains the item that will be moved.
operation "before" | "after" | "child"
The specific move operation.
The available options are:
before
—Indicates that the source item will become the previous sibling of the target item.after
—Indicates that the source item will become the next sibling of the target item.child
—Indicates that the source item will become a child of the target item.
targetItemHierarchicalIndex string
The hierarchical index of the item next to which the source item will be moved.
targetData? any[] | null
The tree which contains the target item.
If the argument is skipped, then the move operation will be executed within the same tree.
Setting the sourceData
and targetData
arguments to the same tree is also supported.
childrenField? string
The field that points to the dataItem sub items. Defaults to items
.
Returns
any[] | { sourceData: any[]; targetData: any[]; } - The updated copies of the sourceData
and targetData
input arguments.
If targetData
is not passed, then only the updated copy of the sourceData
will be returned.
Parameters
sourceItemHierarchicalIndex
string
sourceData
undefined | "null" | any[]
operation
"after" | "before" | "child"
targetItemHierarchicalIndex
string
targetData?
"null" | any[]
childrenField?
string
Returns
undefined | "null" | any[] | { sourceData: undefined | "null" | any[]; targetData: any[]; }