35 lines
1.8 KiB
TypeScript
35 lines
1.8 KiB
TypeScript
import { CombineService, PaginatedParams, BasePaginatedOptions, PaginatedOptionsWithFormat, PaginatedFormatReturn, PaginatedResult } from '@ahooksjs/use-request/lib/types';
|
|
export { CombineService, PaginatedParams, BasePaginatedOptions, PaginatedOptionsWithFormat, PaginatedFormatReturn, PaginatedResult, };
|
|
export interface Store {
|
|
[name: string]: any;
|
|
}
|
|
declare type Antd3ValidateFields = (fieldNames: string[], callback: (errors: any, values: any) => void) => void;
|
|
declare type Antd4ValidateFields = (fieldNames?: string[]) => Promise<any>;
|
|
export interface UseAntdTableFormUtils {
|
|
getFieldInstance?: (name: string) => {};
|
|
setFieldsValue: (value: Store) => void;
|
|
getFieldsValue: (...args: any) => Store;
|
|
resetFields: (...args: any) => void;
|
|
validateFields: Antd3ValidateFields | Antd4ValidateFields;
|
|
[key: string]: any;
|
|
}
|
|
export interface Result<Item> extends PaginatedResult<Item> {
|
|
search: {
|
|
type: 'simple' | 'advance';
|
|
changeType: () => void;
|
|
submit: () => void;
|
|
reset: () => void;
|
|
};
|
|
}
|
|
export interface BaseOptions<U> extends Omit<BasePaginatedOptions<U>, 'paginated'> {
|
|
form?: UseAntdTableFormUtils;
|
|
defaultType?: 'simple' | 'advance';
|
|
}
|
|
export interface OptionsWithFormat<R, Item, U> extends Omit<PaginatedOptionsWithFormat<R, Item, U>, 'paginated'> {
|
|
form?: UseAntdTableFormUtils;
|
|
defaultType?: 'simple' | 'advance';
|
|
}
|
|
declare function useAntdTable<R = any, Item = any, U extends Item = any>(service: CombineService<R, PaginatedParams>, options: OptionsWithFormat<R, Item, U>): Result<Item>;
|
|
declare function useAntdTable<R = any, Item = any, U extends Item = any>(service: CombineService<PaginatedFormatReturn<Item>, PaginatedParams>, options: BaseOptions<U>): Result<Item>;
|
|
export default useAntdTable;
|