import type { PropsWithChildren, ReactElement, Ref } from 'react'; import type { AntdTableResult, Data, Params } from 'ahooks/lib/useAntdTable/types'; import type { PaginationOptions } from 'ahooks/lib/usePagination/types'; import type { Option } from '@baic/yolk-browser-base/lib/request/request'; import type { FormItemProps } from '../form/form-item'; import type { FormInstance } from '../form/use-form'; import type { SearchLayoutProps } from '../search-layout'; import type { Column as TableColumn, TableProps, TableStaticInterface } from '../table'; export type PagingTableInstance = Pick, 'refresh'> & { submit: AntdTableResult['search']['submit']; reset: AntdTableResult['search']['reset']; form: FormInstance; getRequestParams: () => Promise>; }; export type ColumnSearchMode = 'text' | 'textarea' | 'number' | 'mobile' | 'bank' | 'date' | 'range-number' | 'range-date'; export type ColumnSearchType = { /** 表单属性 */ formItemProps?: FormItemProps; /** 节点render函数 */ render?: (column?: Column) => ReactElement; }; export type Column = TableColumn; export type Columns = (Column | null | undefined)[]; export type PagingTableProps = TableProps & { /** 请求接口 */ url: string; /** 请求参数 */ data?: Record; /** 转换请求参数 */ onRequestParams?: (data: Record) => Record | Promise>; /** 默认分页开始 */ defaultCurrent?: number; /** 默认每页长度 */ defaultPageSize?: number; /** 请求成功事件 */ onRequestSuccess?: PaginationOptions['onSuccess']; requestOption?: O; /** 转换接口数据 */ formatResponseData?: (data: ResponseData) => TableResponseData; /** 请求转换分页参数 */ formatPagingParams?: (param: Params[0]) => Record; /** 请求资源转换 */ transformSource?: (url: string, params: any, pagingParams: Record) => Promise; /** 如果dataSource为空数组,检查当前 pagination.current > 1 重新刷新 */ emptyDataSourceBackCurrent?: boolean; /** 查询绑定回车键 */ searchBindEnterKey?: boolean; form?: FormInstance; /** 查询组件 */ search?: ((form: FormInstance) => SearchLayoutProps['data']) | SearchLayoutProps['data']; /** searchLayout的Props */ searchLayoutProps?: Pick; columns?: (Column | null | undefined)[]; /** 查询事件 */ onSearch?: () => void; /** 重置事件 */ onReset?: () => void; }; export type InternalPagingTableType = (props: PropsWithChildren> & { ref?: Ref; }) => ReactElement; export type PagingTableInterface = InternalPagingTableType & TableStaticInterface; declare const PagingTable: PagingTableInterface; export default PagingTable;