/** @packageDocumentation * @module Tree */ import { Observable } from "rxjs/internal/Observable"; import { TreeNodeItem } from "../TreeDataProvider"; import { BeInspireTree, BeInspireTreeNode } from "./component/BeInspireTree"; /** @internal @deprecated */ export interface NodeLoadingOrchestratorCallbacks { onLoadProgress: (loaded: number, total: number, cancel: () => void) => void; onLoadCanceled: () => void; onLoadFinished: () => void; } /** * @internal @deprecated * Loads tree nodes for event handling. Makes sure that the order of * subscribers that receive loaded nodes is the same as their subscription order. */ export declare class NodeLoadingOrchestrator { private _model; private _nodeLoadEvents; private _onNodesLoaded; private _pendingNodeTracker; private _callbacks; private _cancelLoading; private _onLoadingCanceled; private _activeNodeLoads; constructor(model: BeInspireTree, callbacks: NodeLoadingOrchestratorCallbacks); /** Stops all ongoing node preparation operations. */ cancelLoading(): void; /** * Makes sure that all input nodes are loaded. * @returns Observable that first emits already loaded input node * synchronously (empty array if none) and then the rest as nodes get loaded. */ prepareNodes(nodes: Array>): Observable>>; /** * Makes sure that all nodes between and including the input nodes are loaded. * Input nodes can be supplied in any order and are assumed to be loaded. * @returns Observable that first emits already loaded nodes synchronously * (empty array if none) and then the rest as nodes and their children get loaded. */ prepareNodesBetween(node1: BeInspireTreeNode, node2: BeInspireTreeNode): Observable>>; /** * Makes sure that all currently pending nodes get loaded. * @returns Observable that emits nodes once they are loaded. */ preparePendingNodes(): Observable>>; /** Returns observable that emits loaded visible nodes and then completes synchronously. */ prepareLoadedNodes(): Observable>>; /** Notifies the consumer about load progress and makes a request to load some pending nodes. */ private requestPendingNodeLoad; private _reportProgress; private requestNodeLoad; /** * Sorts input nodes into loaded and pending node groups. * @returns A [loadedNodes, pendingNodes] tuple. */ private static sortNodesByLoadingState; } /** * @internal @deprecated * Keeps track of which nodes are queued for loading. */ export declare class PendingNodeTracker implements Iterable { /** Nodes that do not yet have payload */ private _pendingNodes; /** Nodes that do not yet have payload and need their children to be queued for loading too */ private _pendingNodesRecursive; /** Amount of total unique nodes that were queued for loading */ private _totalAddedNodes; /** Queues input nodes for loading. When node's payload gets loaded, the node is removed from this collection. */ addNodes(nodes: Iterable): void; /** * Queues input nodes for loading. When node's payload gets loaded, the node * is removed and its children are queued recursively. */ addNodesRecursively(nodes: Iterable): void; /** * Notifies the tracker that a node got its payload loaded. Queues node's * children for loading if the parent is set to load recursively. * @returns A list of nodes that have been awaited and got loaded. */ onNodeLoaded(loadedNode: BeInspireTreeNode): Array>; /** Resets the traker's state. */ reset(): void; /** Returns the total amount of nodes that were queued for loading. */ getTotalAddedNodes(): number; /** * Returns the number of nodes that are currently being awaited, including * loaded nodes with pending child lists. */ getNumPendingNodes(): number; /** Returns `true` if the tracker has some pending nodes; otherwise `false`. */ get empty(): boolean; /** * Iterates over nodes that are pending payload load. Does not include loaded * nodes with pending child lists. */ [Symbol.iterator](): IterableIterator; /** * Recursively adds children to pending nodes collection. * @returns Array of nodes that have their payload loaded and (including `parent`). */ private addChildNodesRecursively; } /** * @internal @deprecated * Node identifier used by [[NodeSet]] */ export declare class NodeKey { parentId: string | undefined; childIndex: number; constructor(parentId: string | undefined, childIndex: number); /** Retrieves a node from the input tree that is represented by this key. */ toNode(tree: BeInspireTree): BeInspireTreeNode; /** Creates a [[NodeKey]] which represents the input node. */ static for(node: BeInspireTreeNode): NodeKey; /** Identifies the input node's parent. */ private static getParentId; /** Returns input node index in its parent's child list */ private static getChildIndex; } /** * @internal * A set that stores unique nodes of a tree. Nodes are identified by their position in the hierarchy. */ export declare class NodeSet implements Iterable { private _parentToChildToValue; /** Constructs the set and inserts input nodes */ constructor(nodes?: NodeKey[]); /** Calculates the number of nodes in the set. */ get size(): number; /** Checks whether the set is empty */ get empty(): boolean; /** * Adds a node to the set. * @returns `this`. */ add(node: NodeKey): NodeSet; /** * Removes node from the set. * @returns `true` if an element in the map existed and has been removed, or `false` if the element does not exist. */ delete(node: NodeKey): boolean; /** Removes all nodes from the set. */ clear(): void; /** Checks whether the input node is present in the set. */ has(node: NodeKey): boolean; /** * Iterates over each value in the set. Unlike regular `Set`, this class does not preserve element insertion order. */ [Symbol.iterator](): IterableIterator; } /** * @internal * Creates a hot `Observable` that receives values from function invocations. * @returns A tuple of `[nextFunc, observable]`. */ export declare function makeObservableCallback(): [(value: T) => void, Observable]; /** * @internal * Invokes `onCanceled` callback if error occurs or if the observable is unsubscribed from before having been completed. * @returns An `Observable` that emits each value from the input `Observable` and then completes. */ export declare function onCancelation(onCanceled: () => void): (observable: Observable) => Observable; //# sourceMappingURL=NodeLoadingOrchestrator.d.ts.map