import { BaseType, FieldString } from '../_utils/types'; import { TagProps } from '../tag'; export type CascaderOptionValue = BaseType | Record; export type CascaderPathValue = CascaderOptionValue[]; export type CascaderSingleValue = CascaderOptionValue | CascaderPathValue; export type CascaderModelValue = CascaderSingleValue | CascaderSingleValue[] | undefined; export type CascaderFallback = (value: CascaderSingleValue) => string; export type CascaderFormatLabel = (options: CascaderOption[]) => string; export type CascaderLoadMore = (option: CascaderOption, done: (children?: CascaderOption[]) => void) => void; export type CascaderChangeHandler = (value: CascaderModelValue) => void; export type CascaderSearchHandler = (value: string) => void; export interface CascaderOption { value?: CascaderOptionValue; label?: string; disabled?: boolean; tagProps?: TagProps; children?: CascaderOption[]; isLeaf?: boolean; [other: string]: unknown; } export type CascaderFieldNames = FieldString; export interface CascaderOptionWithTotal extends CascaderOption { children?: CascaderOptionWithTotal[]; totalLeafOptions?: number; } export interface CascaderNode extends CascaderOption { parent?: CascaderNode; checked?: boolean; indeterminate?: boolean; level: number; index: number; path: CascaderNode[]; children?: CascaderNode[]; checkedValues?: Set; nodes: CascaderNode[]; enabledNodes: CascaderNode[]; raw: CascaderOption; } export interface CascaderOptionInfo extends CascaderOptionWithTotal { raw: CascaderOption; key: string; valueKey: string; level: number; index: number; value: CascaderOptionValue; label: string; disabled: boolean; selectionDisabled: boolean; isLeaf: boolean; parent?: CascaderOptionInfo; children?: CascaderOptionInfo[]; path: CascaderOptionInfo[]; pathValue: CascaderPathValue; }