Rezi
    Preparing search index...

    Function flattenTree

    • Flatten a tree into a list of visible nodes.

      Only includes nodes whose ancestors are all expanded. Order is depth-first pre-order traversal.

      Type Parameters

      • T

      Parameters

      • data: T | readonly T[]

        Root node(s)

      • getKey: (node: T) => string

        Function to get node key

      • getChildren: ((node: T) => readonly T[] | undefined) | undefined

        Function to get node children

      • hasChildrenFn: ((node: T) => boolean) | undefined

        Function to check if node has children

      • expanded: readonly string[]

        Set of expanded node keys

      • OptionalexpandedSet: ReadonlySet<string>

      Returns readonly Readonly<
          {
              ancestorIsLast: readonly boolean[];
              depth: number;
              hasChildren: boolean;
              key: string;
              node: T;
              parentKey: string
              | null;
              siblingCount: number;
              siblingIndex: number;
          },
      >[]

      Array of flattened nodes