Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TreeModel<_NodeData>

Type parameters

Hierarchy

  • TreeModel

Implements

  • IDisposable

Index

Constructors

Protected constructor

Properties

Private _isDisposed

_isDisposed: boolean = false

Private _onUpdated

_onUpdated: Observable<void> = this._onUpdatedSrc$.asObservable().pipe(debounceTime(0, animationFrameScheduler))

Private _onUpdatedSrc$

_onUpdatedSrc$: Subject<void> = new Subject<void>()

Protected idCache

idCache: Map<string, object> = new Map<string, Readonly<_NodeData>>()

Protected roots

roots: _NodeData[]

Accessors

isDisposed

  • get isDisposed(): boolean

nodes

  • get nodes(): ReadonlyArray<Readonly<_NodeData>>

onUpdated

  • get onUpdated(): Observable<void>

Protected onUpdatedSrc

  • get onUpdatedSrc(): Subject<void>

Methods

__@iterator

  • __@iterator(): Iterator<Readonly<_NodeData>>

addNewNode

  • addNewNode(node: _NodeData, parent: string, index?: number): void

deleteNode

  • deleteNode(node: _NodeData): void

dispose

  • dispose(): void

Protected fillIdCache

  • fillIdCache(): void

get

  • get(key: string): Readonly<_NodeData> | undefined

Protected indexOfNode

  • indexOfNode(node: _NodeData): number

Private insertNodeIntoParent

  • insertNodeIntoParent(toInsert: _NodeData, idx: number, parent?: _NodeData): _NodeData
  • Insert a childless node into a given parent.

    The parent must be different from the node's current parent.

    Parameters

    • toInsert: _NodeData

      The node to insert

    • idx: number

      The index to insert the node into

    • Optional parent: _NodeData

    Returns _NodeData

    The inserted node

moveNode

  • moveNode(node: _NodeData, newParent: string | undefined, index: number): void

Private removeNodeFromParent

  • removeNodeFromParent(toRemove: _NodeData): _NodeData
  • Unmount a node from it's parent.

    Parameters

    • toRemove: _NodeData

      The node to remove from the tree

    Returns _NodeData

    The removed node, with it's parent corrected.

Protected replaceNode

  • replaceNode(oldNode: _NodeData, newNode: _NodeData): _NodeData

selectNode

  • selectNode(key: string, unselectOthers?: boolean): void

update

  • update(key: string, node: Readonly<Partial<_NodeData>>): void

Static Create

  • Create<_NodeData>(nodes: (object & object)[]): TreeModel<_NodeData>

Static Protected InsertParentRefsAndDefaults

  • InsertParentRefsAndDefaults<T>(nodes: (object & object)[]): T[]

Static Protected IsValidUpdate

  • IsValidUpdate(node: Partial<TreeNode>): boolean

Static Protected VerifyNodeKeyUniqueness

  • VerifyNodeKeyUniqueness(nodes: (object & object)[]): boolean

Object literals

Static Private DefaultNode

DefaultNode: object

children

children: never[] = []

isCollapsed

isCollapsed: false = false

isSelected

isSelected: false = false

selectable

selectable: true = true

Generated using TypeDoc