import type * as React from "react"; /** Normalized tree node — the conventional `treeData` / Cascader `options` shape. */ export type TreeOption = { value: string; label: React.ReactNode; disabled?: boolean; disableCheckbox?: boolean; /** When false with `loadData`, shows expand affordance */ isLeaf?: boolean; /** * Per-node glyph, drawn by `Tree` when `showIcon` is on. Carried through the normalizer so the * page tree and the dropdown tree keep ONE node shape; `TreeSelect` simply never reads it. */ icon?: React.ReactNode; children?: TreeOption[]; }; export type TreeFieldNames = { label?: string; value?: string; children?: string; }; export type NormalizedTreeOption = TreeOption & { children?: NormalizedTreeOption[]; }; type RawTreeNode = Record; export declare function reactNodeText(value: React.ReactNode): string; export declare function normalizeTreeOptions(nodes: RawTreeNode[] | undefined, fieldNames?: TreeFieldNames): NormalizedTreeOption[]; export declare function getNodeByPath(options: NormalizedTreeOption[], path: string[]): NormalizedTreeOption[]; export declare function getOptionsAtPath(options: NormalizedTreeOption[], path: string[]): NormalizedTreeOption[]; export declare function formatPathLabels(chain: NormalizedTreeOption[], separator?: string): string; export type TreePath = { path: string[]; labels: string[]; }; export declare function collectLeafPaths(options: NormalizedTreeOption[], prefix?: string[], root?: NormalizedTreeOption[]): TreePath[]; export declare function collectAllPaths(options: NormalizedTreeOption[], prefix?: string[], root?: NormalizedTreeOption[]): TreePath[]; export declare function pathKey(path: string[]): string; export declare function pathsEqual(a: string[], b: string[]): boolean; export declare function filterTreeOptions(options: NormalizedTreeOption[], query: string, filter?: (query: string, path: NormalizedTreeOption[]) => boolean): TreePath[]; export declare function getDescendantValues(node: NormalizedTreeOption): string[]; export declare function flattenVisibleTree(options: NormalizedTreeOption[], expandedKeys: Set, depth?: number): { node: NormalizedTreeOption; depth: number; hasChildren: boolean; }[]; export declare function filterVisibleTree(options: NormalizedTreeOption[], query: string): { node: NormalizedTreeOption; depth: number; hasChildren: boolean; }[]; export declare function collectAllExpandableKeys(options: NormalizedTreeOption[]): string[]; export declare function findNodeByValue(options: NormalizedTreeOption[], value: string): NormalizedTreeOption | undefined; /** * rc-tree gives up on a node after this many rejected `loadData` calls and treats it as loaded * (rc-tree `MAX_RETRY_TIMES`), so a permanently broken endpoint cannot be hammered forever. */ export declare const MAX_LAZY_LOAD_RETRIES = 10; /** * The lazy-children ledger shared by `Tree`, `TreeSelect` and `Cascader` — rc-tree's * `loadedKeys` / `loadingKeys` / `loadingRetryTimes`, in one place (gh#1041). * * A key is asked for at most once while in flight and never again once it RESOLVED. A REJECTED * load is not "loaded": the key leaves the in-flight set and the next expand asks again, until * `MAX_LAZY_LOAD_RETRIES` failures. The old per-component ledgers recorded the key before the * promise settled and never cleared it, so one network blip left a branch unloadable for the life * of the component. */ export type LazyLoadLedger = { /** * Call `load` for `key` unless it is in flight or already loaded. A synchronous throw counts * as a rejection. `onSettle(ok)` runs once the load settles. Returns whether `load` was called. */ run: (key: string, load: () => void | Promise, onSettle?: (ok: boolean) => void) => boolean; }; export declare function createLazyLoadLedger(): LazyLoadLedger; export {};