antd-select-pagination-scroll
Version:
react components base on antd
50 lines (49 loc) • 1.53 kB
TypeScript
import React from 'react';
import { SelectProps } from 'antd';
import { DefaultOptionType } from 'rc-select/lib/Select';
export interface FetchParams {
pageSize: number;
current: number;
searchValue: string;
}
export interface FetchData {
list: DefaultOptionType[];
total: number;
}
export declare enum ValueType {
ObjectValue = 1,
SimpleValue = 2,
ObjectArrayValue = 3
}
export interface AntdSelectPaginationScrollIProps {
/**
* 每页的数量
*/
scrollPageSize?: number;
/**
*
* @param params
* 获取下拉分页数据
*/
fetchData: (params: FetchParams) => Promise<FetchData>;
/**
* valueType为2的情况,该属性必须设置
* 用来获取label,初始化根据value获取label的值,之后根据label获取options
*/
fetchLabelByInit?: (value: string | number) => Promise<string>;
/**
* value的类型:1 类型为 {label,value} 2 类型为 number string 3 类型为多选,考虑这个是search select 类型只支持[{label,value}]]
* 默认为2
*/
valueType?: ValueType.ObjectValue | ValueType.SimpleValue | ValueType.ObjectArrayValue;
/**
* 触发search的debounce时间
*/
searchDebounceTime?: number;
/**
* 鼠标进去select的时候下拉框自动刷新,默认true
*/
mouseEnterRefresh?: boolean;
}
declare const AntdSelectPaginationScroll: React.FC<AntdSelectPaginationScrollIProps & SelectProps>;
export default AntdSelectPaginationScroll;