import { ToggleSubject } from '@rxap/rxjs'; import { IconConfig, WithChildren, WithIdentifier } from '@rxap/utilities'; export interface EventOptions { withChildren?: boolean; quite?: boolean; onlySelf?: boolean; } export type ExpandNodeFunction = (node: Node, options: EventOptions) => Promise; export type NodeToDisplayFunction = (item: T) => string; export type NodeGetTypeFunction = (item: T) => string | null; export type NodeGetIconFunction = (item: T) => IconConfig | IconConfig[] | null; export type NodeGetStyleFunction = (item: T) => Record; export type NodeHasDetailsFunction = (item: T) => boolean; export interface ShowHideOptions { /** * If true the show/hide operation will only be applied to the node itself */ onlySelf?: boolean; /** * If true the show/hide operation will be applied to all **direct** children */ forEachChild?: boolean; /** * If true the show/hide operation will be applied to the direct parent */ parent?: boolean; /** * If true the show/hide operation will be applied to all children (children of children) */ forEachChildren?: boolean; /** * If true the show/hide operation will be applied to all parents (parent of parent) */ parents?: boolean; } export declare class Node { readonly parent: Node | null; readonly item: T & WithChildren; private _depth; onExpand: ExpandNodeFunction; onCollapse: ExpandNodeFunction; display: string | null; icon: IconConfig[] | null; type: string | null; onSelect: ExpandNodeFunction | null; onDeselect: ExpandNodeFunction | null; hasDetails: boolean; style: Record; /** * Custom parameters passed to all child mode to transport non-standard * information to allow custom implementations */ private _parameters; hidden: boolean; constructor(parent: Node | null, item: T & WithChildren, children: Array>, _depth: number, onExpand: ExpandNodeFunction, onCollapse: ExpandNodeFunction, display?: string | null, icon?: IconConfig[] | null, type?: string | null, onSelect?: ExpandNodeFunction | null, onDeselect?: ExpandNodeFunction | null, hasDetails?: boolean, style?: Record, /** * Custom parameters passed to all child mode to transport non-standard * information to allow custom implementations */ _parameters?: CustomParameters | null, hidden?: boolean); readonly isLoading$: ToggleSubject; readonly id: string; get depth(): number; get children(): ReadonlyArray>; get hasVisibleChildren(): boolean; get isHidden(): boolean; get isVisible(): boolean; private _expanded; get expanded(): boolean; private _selected; get selected(): boolean; hasChildren: boolean; get parameters(): CustomParameters | null; set parameters(parameters: CustomParameters | null); private _children; static ToNode(parent: Node | null, item: T & WithChildren, depth: number, onExpand: ExpandNodeFunction, onCollapse: ExpandNodeFunction, toDisplay?: NodeToDisplayFunction, getIcon?: NodeGetIconFunction, getType?: NodeGetTypeFunction, onSelect?: ExpandNodeFunction | null, onDeselect?: ExpandNodeFunction | null, hasDetails?: NodeHasDetailsFunction, getStyle?: NodeGetStyleFunction, parameters?: CustomParameters | null): Node; setDepth(depth: number): void; addChild(child: Node, end?: boolean): void; addChildren(newChildren: Array>, end?: boolean): void; setChildren(children: Array>): void; clearChildren(): void; isNode(id: string): boolean; hasNode(id: string): boolean; getNode(id: string): Node | null; toggleExpand(options?: EventOptions): Promise; expand(options?: EventOptions): Promise; select(options?: EventOptions): Promise; deselect(options?: EventOptions): Promise; toggleSelect(): Promise; collapse(options?: EventOptions): Promise; hide(options?: ShowHideOptions): void; show(options?: ShowHideOptions): void; /** * Applies the callback to the **direct** children of this node only. */ forEachChild(fn: (child: Node) => void): void; /** * Applies the callback to **every** descendant of this node (depth-first). */ forEachDescendant(fn: (child: Node) => void): void; }