UNPKG

table-reuse

Version:

A reusable table built on top of Antd ProTable

20 lines (19 loc) 949 B
import type { SortOrder } from "antd/es/table/interface"; import type { TRecord, TParams, TRequestFunc } from "../../../dataTypes"; export type Params = { pageSize?: number; current?: number; keyword?: string; [key: string]: any; }; export type Filter = Record<string, (string | number)[] | undefined>; export type Sorter = Record<string, SortOrder>; export type FetchResult<T> = { data: T[]; total: number; }; /** * 创建 ProTable 的 request 方法 * 在标准化 filter 后合并 tabFilter */ export declare function createRequestFunction<TItem extends TRecord, TFilterShape extends TRecord, TTabFilterShape extends TRecord, TApiVariableShape extends TRecord = TRecord>(onList: (payload: TApiVariableShape & TParams<TItem>) => Promise<FetchResult<TItem>>, searchParams?: TFilterShape, tabFilter?: TTabFilterShape, buildApiPayload?: (filter: TFilterShape) => TApiVariableShape): TRequestFunc<TItem>;