@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    Class FilterableArrayTreeDatasource<T>

    An in-memory tree datasource that supports filtering via a CompiledFilter.

    When an expression is applied the datasource compiles it into a single predicate, re-derives its visible tree structure from the original data, and exposes only the matching nodes (plus their ancestors). The underlying tree is never mutated.

    const ds = new FilterableArrayTreeDatasource([
    { id: '1', data: 'Root', children: [
    { id: '1.1', data: 'Child A' },
    { id: '1.2', data: 'Child B' },
    ]},
    ]);

    // Show only nodes containing 'A' in their data
    ds.filterBy([{ predicate: node => String(node).includes('A') }]);

    Type Parameters

    • T = unknown

      The data payload type.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Accessors

    • get allRoots(): TreeNode<T>[]

      The full, unfiltered root nodes.

      Useful when consumers need to inspect the original tree structure while a filter is active.

      Returns TreeNode<T>[]

    Methods

    • Clears any active filter, restoring all nodes.

      Returns void

    • Applies a structured CompiledFilter to the tree.

      The expression is compiled into a single predicate once, which is then applied to each node's data. Matching nodes and their ancestors are kept. Pass an empty array (or null / undefined) to clear the filter and show all nodes.

      • Property-level entries test a single property of T.
      • Row-level entries test the entire T object.
      • All entries must pass (AND) for a node to be included.

      Parameters

      Returns void