UNPKG

@schema-render/search-table-react

Version:
28 lines (27 loc) 1.27 kB
import type { IObjectAny, IPartRequired } from '@schema-render/core-react'; import type { TablePaginationConfig } from 'antd'; import type { MutableRefObject } from 'react'; import type { ILocale, IRequestExtraParams, IRequestOptions, IRequestParams, IRequestResult, ISearchTableProps, ISearchTableRef } from '../typings/index.d'; interface IUseRequest { request: ISearchTableProps['request']; updateScrollY: ISearchTableRef['updateScrollY']; table: ISearchTableProps['table']; searchValueRef: MutableRefObject<IObjectAny>; locale: ILocale; } /** * 数据请求模块 */ export default function useRequest({ request, updateScrollY, table, searchValueRef, locale, }: IUseRequest): { loading: boolean; dataSource: IObjectAny[]; updateDataSource: (data: IObjectAny[]) => void; summaryData: IObjectAny; updateSummaryData: (data: IObjectAny) => void; requestParamsRef: MutableRefObject<IObjectAny>; requestExtraParamsRef: MutableRefObject<IRequestExtraParams>; updateRequestExtraParams: (data: IRequestExtraParams) => void; finalPagination: false | TablePaginationConfig; runRequest: (params?: IRequestParams, options?: IRequestOptions) => Promise<IPartRequired<IRequestResult, "data" | "total">>; }; export {};