import type { Option, DataProps, ToArray } from '../internals/types'; import type { BoxProps } from '../internals/Box'; export interface SelectNode { itemData: Option; cascadePaths: Option[]; isLeafNode: boolean; } export interface CascadeColumn { items: readonly Option[]; parentItem?: Option; layer?: number; } export interface CascadeTreeProps extends BoxProps, DataProps> { /** * Initial value */ defaultValue?: V; /** * Selected value */ value?: V; /** * Sets the width of the menu */ columnWidth?: number; /** * Sets the height of the menu */ columnHeight?: number; /** * Disabled items */ disabledItemValues?: ToArray>; /** * Whether dispaly search input box */ searchable?: boolean; /** * A collection of localized strings. */ locale?: Partial; /** * Custom render columns */ renderColumn?: (childNodes: React.ReactNode, column: CascadeColumn) => React.ReactNode; /** * Custom render tree node */ renderTreeNode?: (node: React.ReactNode, itemData: Option) => React.ReactNode; /** * Custom render search items */ renderSearchItem?: (node: React.ReactNode, items: Option[]) => React.ReactNode; /** * Called when the option is selected */ onSelect?: (value: Option, selectedPaths: Option[], event: React.SyntheticEvent) => void; /** * Called after the value has been changed */ onChange?: (value: V, event: React.SyntheticEvent) => void; /** * Called when searching */ onSearch?: (value: string, event: React.SyntheticEvent) => void; /** * Asynchronously load the children of the tree node. */ getChildren?: (childNodes: Option) => Option[] | Promise[]>; }