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

    Simple in-memory tree datasource backed by an array of root nodes.

    The constructor takes a defensive copy of the root array so that external mutations do not affect the tree. Child nodes are read from a configurable property on each TreeNode, defaulting to 'children'.

    // Default — reads children from `node.children`
    const ds = new ArrayTreeDatasource([
    { id: '1', data: 'Root', children: [
    { id: '1.1', data: 'Child' },
    ]},
    ]);

    // Custom property — reads children from `node.items`
    const ds2 = new ArrayTreeDatasource(roots, 'items');

    Type Parameters

    • T = unknown

      The data payload type.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Methods

    • Returns true when the node has at least one child.

      Parameters

      Returns boolean