UNPKG

@asup/tree-of-nodes

Version:
66 lines (64 loc) 2.23 kB
import React, { Key, ReactNode } from "react"; import { JSX } from "react/jsx-runtime"; export interface iNodeUpdate { success: boolean; ErrorText?: string; } export interface TreeNodeBase { id: Key; label: string; parentId?: Key; } export interface TreeNodeData<T> extends TreeNodeBase { data: T; } declare const getAncestors: (id: Key | Key[], included: TreeNodeBase[], hierarchyNodes: TreeNodeBase[]) => TreeNodeBase[]; interface WordEntryProps { id: Key; value?: string; editing?: boolean; saving?: boolean; setValue?: (ret: string) => void; sendEscape?: () => void; style?: React.CSSProperties; spellCheck?: "true" | "false"; } export const WordEntry: React.ForwardRefExoticComponent<WordEntryProps & React.RefAttributes<HTMLInputElement>>; interface TreeNodeProps { id: Key; indentLevel?: number; canRemove?: boolean; canRename?: boolean; canAddChildren?: boolean; canRemoveChildren?: boolean; canRenameChildren?: boolean; refresh?: () => void; } export const TreeNode: { ({ id, canRemove, canRename, canAddChildren, canRemoveChildren, canRenameChildren, }: TreeNodeProps): ReactNode; displayName: string; }; interface TreeOfNodesProps<T> { id: string; nodeList: TreeNodeData<T>[]; roots: Key[]; showCheckBox?: boolean; selected?: Key | Key[]; handleSelect?: (ret: Key | Key[]) => void; onAdd?: (parentId: Key, newName: string) => Promise<iNodeUpdate>; onRename?: (childId: Key, newName: string) => Promise<iNodeUpdate>; onRemove?: (childId: Key) => Promise<iNodeUpdate>; canRemoveRoot?: boolean; canRenameRoot?: boolean; canAddChildren?: boolean; canRemoveChildren?: boolean; canRenameChildren?: boolean; nodeHighlight?: string; textHighlight?: string; spellCheck?: "true" | "false"; } export const TreeOfNodes: { <T extends unknown>({ id, nodeList, roots, selected, showCheckBox, handleSelect, onAdd, onRename, onRemove, canRemoveRoot, canRenameRoot, canAddChildren, canRemoveChildren, canRenameChildren, nodeHighlight, textHighlight, spellCheck, }: TreeOfNodesProps<T>): JSX.Element; displayName: string; }; //# sourceMappingURL=tree-of-nodes.d.ts.map