1 | import { EventCallback, INode, INodeRef, NodeId } from "./types";
|
2 | export declare const noop: () => void;
|
3 | export declare const composeHandlers: (...handlers: EventCallback[]) => EventCallback;
|
4 | export declare const difference: (a: Set<NodeId>, b: Set<NodeId>) => Set<NodeId>;
|
5 | export declare const symmetricDifference: (a: Set<NodeId>, b: Set<NodeId>) => Set<NodeId>;
|
6 | export declare const usePrevious: (x: Set<NodeId>) => Set<NodeId> | undefined;
|
7 | export declare const usePreviousData: (value: INode[]) => INode<IFlatMetadata>[] | undefined;
|
8 | export declare const isBranchNode: (data: INode[], i: NodeId) => boolean;
|
9 | export declare const scrollToRef: (ref: INodeRef) => void;
|
10 | export declare const focusRef: (ref: INodeRef) => void;
|
11 | export declare const getParent: (data: INode[], id: NodeId) => NodeId | null;
|
12 | export declare const getAncestors: (data: INode[], childId: NodeId, disabledIds: Set<NodeId>) => NodeId[];
|
13 | export declare const getDescendants: (data: INode[], id: NodeId, disabledIds: Set<NodeId>) => NodeId[];
|
14 | export declare const getChildren: (data: INode[], id: NodeId) => NodeId[];
|
15 | export declare const getSibling: (data: INode[], id: NodeId, diff: number) => NodeId | null;
|
16 | export declare const getLastAccessible: (data: INode[], id: NodeId, expandedIds: Set<NodeId>) => NodeId;
|
17 | export declare const getPreviousAccessible: (data: INode[], id: NodeId, expandedIds: Set<NodeId>) => NodeId | null;
|
18 | export declare const getNextAccessible: (data: INode[], id: NodeId, expandedIds: Set<NodeId>) => NodeId | null;
|
19 | export declare const propagateSelectChange: (data: INode[], ids: Set<NodeId>, selectedIds: Set<NodeId>, disabledIds: Set<NodeId>, halfSelectedIds: Set<NodeId>, multiSelect?: boolean) => {
|
20 | every: Set<NodeId>;
|
21 | some: Set<NodeId>;
|
22 | none: Set<NodeId>;
|
23 | };
|
24 | export declare const getAccessibleRange: ({ data, expandedIds, from, to, }: {
|
25 | data: INode[];
|
26 | expandedIds: Set<NodeId>;
|
27 | from: NodeId;
|
28 | to: NodeId;
|
29 | }) => NodeId[];
|
30 |
|
31 |
|
32 |
|
33 | export type IFlatMetadata = Record<string, string | number | undefined | null>;
|
34 | interface ITreeNode<M extends IFlatMetadata> {
|
35 | id?: NodeId;
|
36 | name: string;
|
37 | isBranch?: boolean;
|
38 | children?: ITreeNode<M>[];
|
39 | metadata?: M;
|
40 | }
|
41 | export declare const flattenTree: <M extends IFlatMetadata>(tree: ITreeNode<M>) => INode<M>[];
|
42 | export declare const getAriaSelected: ({ isSelected, isDisabled, multiSelect, }: {
|
43 | isSelected: boolean;
|
44 | isDisabled: boolean;
|
45 | multiSelect: boolean;
|
46 | }) => boolean | undefined;
|
47 | export declare const getAriaChecked: ({ isSelected, isDisabled, isHalfSelected, multiSelect, }: {
|
48 | isSelected: boolean;
|
49 | isDisabled: boolean;
|
50 | isHalfSelected: boolean;
|
51 | multiSelect: boolean;
|
52 | }) => boolean | undefined | "mixed";
|
53 | export declare const propagatedIds: (data: INode[], ids: NodeId[], disabledIds: Set<NodeId>) => NodeId[];
|
54 | export declare const onComponentBlur: (event: React.FocusEvent, treeNode: HTMLUListElement | null, callback: () => void) => void;
|
55 | export declare const isBranchSelectedAndHasSelectedDescendants: (data: INode[], elementId: NodeId, selectedIds: Set<NodeId>) => boolean;
|
56 | export declare const isBranchSelectedAndHasAllSelectedEnabledDescendants: (data: INode[], elementId: NodeId, selectedIds: Set<NodeId>, disabledIds: Set<NodeId>) => boolean;
|
57 | export declare const isBranchNotSelectedAndHasOnlySelectedChild: (data: INode[], elementId: NodeId, selectedIds: Set<NodeId>) => boolean;
|
58 | export declare const isBranchSelectedAndHasOnlySelectedChild: (data: INode[], elementId: NodeId, selectedIds: Set<NodeId>) => boolean;
|
59 | export declare const getOnSelectTreeAction: (data: INode[], elementId: NodeId, selectedIds: Set<NodeId>, disabledIds: Set<NodeId>) => "HALF_SELECT" | "TOGGLE_SELECT";
|
60 | export declare const getTreeParent: (data: INode[]) => INode;
|
61 | export declare const getTreeNode: (data: INode[], id: NodeId) => INode;
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | export declare const validateTreeViewData: (data: INode[]) => void;
|
72 | export {};
|