Skip to main content

TreeActions<T>

TreeActions<T> = object

Stateless collection of transform actions to simplify tree operations

Type Parameters

T

T

Properties

collapseAll()

collapseAll: () => TreeData<T>

Collapses all nodes in the tree

Returns

TreeData<T>


expandAll()

expandAll: () => TreeData<T>

Expands all nodes in the tree

Returns

TreeData<T>


getNode()

getNode: (key) => TreeNode<T>

Retrieves a specific tree node by key If not found, throws error

Parameters

key

Key

Returns

TreeNode<T>


hideAll()

hideAll: () => TreeData<T>

Hides all nodes in the tree

Returns

TreeData<T>


insertAfter()

insertAfter: (target, nodes) => TreeData<T>

Inserts nodes after the target node

Parameters

target

Key | null

nodes

TreeNode<T>[]

Returns

TreeData<T>


insertBefore()

insertBefore: (target, nodes) => TreeData<T>

Inserts nodes before the target node

Parameters

target

Key | null

nodes

TreeNode<T>[]

Returns

TreeData<T>


insertInto()

insertInto: (target, nodes) => TreeData<T>

Inserts nodes as children of the target node

Parameters

target

Key | null

nodes

TreeNode<T>[]

Returns

TreeData<T>


moveAfter()

moveAfter: (target, nodes) => TreeData<T>

Moves nodes after the target node

Parameters

target

Key | null

nodes

Set<Key>

Returns

TreeData<T>


moveBefore()

moveBefore: (target, nodes) => TreeData<T>

Moves nodes before the target node

Parameters

target

Key | null

nodes

Set<Key>

Returns

TreeData<T>


moveInto()

moveInto: (target, nodes) => TreeData<T>

Moves nodes as children of the target node

Parameters

target

Key | null

nodes

Set<Key>

Returns

TreeData<T>


onExpandedChange()

onExpandedChange: (keys) => TreeData<T>

Updates the expansion state of nodes. If a key is not in the set, it is collapsed.

Parameters

keys

Set<Key>

Returns

TreeData<T>


onSelectionChange()

onSelectionChange: (keys) => TreeData<T>

Updates the selection state of nodes. If a key is not in the Set, it is unselected.

Parameters

keys

Set<Key>

Returns

TreeData<T>


onVisibilityChange()

onVisibilityChange: (keys) => TreeData<T>

Changes visibility of nodes. Updates both isVisible and isViewable properties. If a key is not in the Set, it will be hidden.

Parameters

keys

Set<Key>

Returns

TreeData<T>


remove()

remove: (keys) => TreeData<T>

Removes one or more nodes from the tree by their keys. Does nothing if the key is not found.

Parameters

keys

Set<Key>

Returns

TreeData<T>


revealAll()

revealAll: () => TreeData<T>

Makes all nodes visible in the tree

Returns

TreeData<T>


selectAll()

selectAll: () => TreeData<T>

Selects all nodes in the tree

Returns

TreeData<T>


unselectAll()

unselectAll: () => TreeData<T>

Unselects all nodes in the tree

Returns

TreeData<T>


updateNode()

updateNode: (key, callback) => TreeData<T>

Updates a specific node using a callback function

Parameters

key

Key

callback

(node) => TreeNode<T>

Returns

TreeData<T>