acud
Version:
acg react 组件库
91 lines (90 loc) • 3.5 kB
TypeScript
import React from 'react';
import { CascaderValueType, CascaderMultiValueType } from './Cascader';
import { SizeType } from '../config-provider/SizeContext';
export type CascaderExpandTrigger = 'click' | 'hover';
export interface FieldNamesType {
value?: string | number;
label?: string;
children?: string;
}
export interface FilledFieldNamesType {
value: string | number;
label: string;
children: string;
}
export interface CascaderOptionType {
value?: string | number;
label?: React.ReactNode;
disabled?: boolean;
isLeaf?: boolean;
loading?: boolean;
children?: Array<CascaderOptionType>;
[key: string]: any;
}
export interface ShowSearchType {
filter?: (inputValue: string, path: CascaderOptionType[], names: FilledFieldNamesType) => boolean;
render?: (inputValue: string, path: CascaderOptionType[], prefixCls: string | undefined, names: FilledFieldNamesType) => React.ReactNode;
sort?: (a: CascaderOptionType[], b: CascaderOptionType[], inputValue: string, names: FilledFieldNamesType) => number;
matchInputWidth?: boolean;
limit?: number | false;
}
export interface CascaderLocale {
checkAll?: string;
placeholder?: string;
empty?: string;
filterEmpty?: string;
}
export type CascaderLocaleOmit = Omit<CascaderLocale, 'placeholder'>;
export interface CascaderProps {
defaultValue?: CascaderMultiValueType;
value?: CascaderMultiValueType;
mode?: 'multiple';
options: CascaderOptionType[];
style?: React.CSSProperties;
className?: string;
prefixCls?: string;
/** 输入框 id */
id?: string;
/** 输入框 name */
name?: string;
/** 输入框大小,可选 `large` `default` `small` */
size?: SizeType;
inputPrefixCls?: string;
disabled?: boolean;
bordered?: boolean;
allowClear?: boolean;
autoFocus?: boolean;
showSearch?: boolean | ShowSearchType;
showCheckAll?: boolean;
placeholder?: string;
locale?: CascaderLocaleOmit;
/** 次级菜单的展开方式,可选 'click' 和 'hover' */
expandTrigger?: CascaderExpandTrigger;
expandIcon?: React.ReactNode;
suffixIcon?: React.ReactNode;
menusEdgeBuffer?: number;
changeOnSelect?: boolean;
fieldNames?: FieldNamesType;
notFoundContent?: React.ReactNode;
virtual?: boolean;
popupVisible?: boolean;
popupClassName?: string;
/** 浮层预设位置:`bottomLeft` `bottomRight` `topLeft` `topRight` */
popupPlacement?: string;
autoComplete?: string;
maxTagTextLength?: number;
maxTagCount?: number;
transitionName?: string;
children?: React.ReactElement;
loadData?: (selectedOptions?: CascaderOptionType[]) => void;
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
displayRender?: (label: string[], selectedOptions?: CascaderOptionType[]) => React.ReactNode;
dropdownRender?: (menus: React.ReactNode) => React.ReactNode;
dropdownMenuRender?: (menu: React.ReactNode, menuIndex: number, hoveredValue: CascaderValueType) => React.ReactNode;
onPopupVisibleChange?: (popupVisible: boolean) => void;
onChange?: (value: CascaderValueType | CascaderMultiValueType, selectedOptions?: CascaderOptionType[]) => void;
onClear?: () => void;
onDropdownMenuScroll?: (e: React.UIEvent<HTMLUListElement>, menuIndex: number) => void;
}
declare const _default: React.ForwardRefExoticComponent<CascaderProps & React.RefAttributes<unknown>>;
export default _default;