import React from "react"; import ListItem from "./ListItem"; export declare const version = "%VERSION%"; export declare type ItemData = Record<string | number, any>; export declare type ValueType = number | string; export declare type Item = { value: any; label: React.ReactNode; disabled: boolean; children?: Item[]; data: ItemData; ref: React.RefObject<ListItem>; }; export interface ListBoxProps { /** 样式前缀 */ prefixCls?: string; /** 样式名 */ className?: string; /** 样式属性 */ style?: React.CSSProperties; /** tabIndex值 */ tabIndex?: number; /** 支持多选,开启多选后,defaultValue/value为数组 */ multiple?: boolean; /** 默认选中值 */ defaultValue?: ValueType | ValueType[]; /** 选中值(受控) */ value?: ValueType | ValueType[]; /** 禁用 */ disabled?: boolean; /** 只读 */ readOnly?: boolean; /** 自动获取焦点 */ autoFocus?: boolean; /** 数据集 */ data?: ItemData[]; /** 设置data数据的值字段 */ valueField?: string; /** 设置data数据的显示字段 */ labelField?: string; /** 设置data数据的禁用字段 */ disabledField?: string; /** 设置data数据的子节点字段 */ childrenField?: string; /** 设置renderHeader后CSS属性 */ headerStyle?: React.CSSProperties; /** 设置renderFooter后CSS属性 */ footerStyle?: React.CSSProperties; /** 设置列表容器CSS属性 */ bodyStyle?: React.CSSProperties; /** 无数据时显示内容 */ emptyLabel?: React.ReactNode; /** 获取列表项属性 */ getItemProps?: (data: ItemData) => React.HTMLAttributes<HTMLElement>; /** 获取分组标题项属性 */ getGroupTitleProps?: (data: ItemData) => React.HTMLAttributes<HTMLElement>; /** 自定义渲染分组标题 */ renderGroupTitle?: (data: ItemData) => React.ReactNode; /** 自定义渲染列表项内容 */ renderItem?: (data: ItemData, item: Item) => React.ReactNode; /** 自定义渲染器 */ renderer?: (listBody: React.ReactNode) => React.ReactNode; computedState?: { items: Item[]; itemList: Item[]; itemsMap: Record<any, Item>; }; fixListBodyHeightOnIE?: boolean; onSelect?: (value: string | number, data: ItemData) => void; onDeselect?: (value: ValueType, data: ItemData) => void; onChange?: (value: ValueType | ValueType[], data: ItemData[] | ItemData) => void; onFocus?: (e: React.FocusEvent) => void; onBlur?: (e: React.FocusEvent) => void; onKeyDown?: (e: React.KeyboardEvent) => void; onMouseLeave?: (e: React.MouseEvent) => void; wrapperComponent: React.ElementType; bodyWrapperComponent: React.ElementType; } export interface ListBoxState { items: Item[]; itemList: Item[]; itemsMap: Record<any, Item>; value: any[]; prevProps?: ListBoxProps; activeItem?: Item | null; } export declare function dataProcessor(props: Pick<ListBoxProps, "data" | "valueField" | "childrenField" | "labelField" | "disabledField">): { items: Item[]; itemList: Item[]; itemsMap: Record<any, Item>; }; export declare class ListBox extends React.Component<ListBoxProps, ListBoxState> { static defaultProps: ListBoxProps; static getDerivedStateFromProps(nextProps: ListBoxProps, state: ListBoxState): { value: any[]; prevProps: ListBoxProps; items: Item[]; itemList: Item[]; itemsMap: Record<any, Item>; } | null; constructor(props: ListBoxProps, context: any); focus(): void; blur(): void; getItemByValue(value: any): Item | null; protected fireSelect(item: Item): void; protected fireDeselect(item: Item): void; protected setValue(newValue: any[]): void; scrollActiveItemIntoView(): void; protected getActiveIndex(): number; protected getNextActiveItem(code: React.KeyboardEvent<Element>["keyCode"]): Item | null; toggleSelectItem(item: Item): void; onKeyDown: (e: React.KeyboardEvent) => void; protected handleMouseLeave: (e: React.MouseEvent) => void; protected handleItemMouseEnter: (cValue: any) => void; protected handleItemMouseLeave: (cValue: any) => void; protected handleItemClick: (cValue: any, e: React.MouseEvent<HTMLElement>) => void; protected getItemProps: (data: ItemData) => React.HTMLAttributes<HTMLElement>; protected renderListItems(items: Item[]): JSX.Element[]; protected renderList(): {} | null | undefined; componentDidMount(): void; protected renderBody(): JSX.Element; render(): JSX.Element; } export default ListBox;