Skip to content

Tree

Type Parameters

T

Properties

activeDom

activeDom: null | TreeNode<T>

Currently active item in tree view


app

app: App

Reference to App


containerEl

containerEl: HTMLElement

Container element of the tree view


focusedItem

focusedItem: null | TreeNode<T>

Currently focused item in tree view


handleCollapseAll()

handleCollapseAll: () => void

Handle collapsing of all nodes

Returns

void


handleRenameFocusedItem()

handleRenameFocusedItem: () => void

Handle renaming of focused item

Returns

void


id

id: string

ID of the view the tree is associated with


isAllCollapsed

isAllCollapsed: boolean

Whether all items in the tree are collapsed


prefersCollapsed

prefersCollapsed: boolean

Whether tree items should default to collapsed state


requestSaveFolds()

requestSaveFolds: () => void

Request saving of the current fold states

Returns

void


scope

scope: Scope

Key scope for tree view


selectedDoms

selectedDoms: Set<TreeNode<T>>

Currently selected items in tree view


view

view: View

The view the tree is associated with

Accessors

root

get root(): TreeNode<T>

Root item of the tree view

Returns

TreeNode<T>

Methods

changeFocusedItem()

changeFocusedItem(direction): void

Change the focused item to the next item in specified direction

Parameters

direction: "forwards" | "backwards"

Returns

void


clearSelectedDoms()

clearSelectedDoms(): void

Unselect all selected items in the tree view

Returns

void


deselectItem()

deselectItem(node): void

Mark tree item as deselected

Parameters

node: TreeNode<T>

Returns

void


getFoldKey()

getFoldKey(): string

Get the local storage key for the saved tree view folds

Returns

string


getNodeId()

getNodeId(node): undefined | string

Gets the ID of a tree item given its Node

Parameters

node: TreeNode<T>

Returns

undefined | string


handleDeleteSelectedItems()

handleDeleteSelectedItems(event): Promise<void>

Handle deletion of selected nodes

Parameters

event: KeyboardEvent

Returns

Promise<void>


handleItemSelection()

handleItemSelection(event, node): void

Handle selection of tree item via keyboard event

Parameters

event: MouseEvent

node: TreeNode<T>

Returns

void


isItem()

isItem(node): boolean

Check whether item is a valid tree item

Parameters

node: undefined | TreeNode<T>

Returns

boolean


loadFolds()

loadFolds(): void

Load the saved fold states of the tree view from local storage

Returns

void


onKeyArrowDown()

onKeyArrowDown(event): void

Handle keyboard event for moving/selecting tree item below

Parameters

event: KeyboardEvent

Returns

void


onKeyArrowLeft()

onKeyArrowLeft(event): void

Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding)

Parameters

event: KeyboardEvent

Returns

void


onKeyArrowRight()

onKeyArrowRight(event): void

Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding)

Parameters

event: KeyboardEvent

Returns

void


onKeyArrowUp()

onKeyArrowUp(event): void

Handle keyboard event for moving/selecting tree item above

Parameters

event: KeyboardEvent

Returns

void


onKeyOpen()

onKeyOpen(event): void

Handle keyboard event for opening tree item

Parameters

event: KeyboardEvent

Returns

void


saveFolds()

saveFolds(): void

Save the current fold states of the tree view to local storage

Returns

void


selectItem()

selectItem(node): void

Mark tree item as selected

Parameters

node: TreeNode<T>

Returns

void


setCollapseAll()

setCollapseAll(collapse): void

Set all items in the tree view to be collapsed or expanded

Parameters

collapse: boolean

Returns

void


setFocusedItem()

setFocusedItem(node, scrollIntoView?): void

Set the focused item in the tree view

Parameters

node: TreeNode<T>

scrollIntoView?: boolean

Returns

void


toggleCollapseAll()

toggleCollapseAll(): void

(Un)Collapse all items in the tree view

Returns

void