import React from 'react'; import { Table, TableProps, TableColumnInfo } from '@autobest-ui/components'; import { SceneTablePaginationProps } from './pagination'; export interface SceneTableColumnOptionItemInfo { /** * 如果name是string,则通过name的值去columnInfo寻找对应的key值 * 否则,直接按照name拼接columns项 */ name: string | TableColumnInfo; /** * 该列是否有排序功能 */ isSort?: boolean; } export declare const TableThemeType: { readonly Blue: "blue"; readonly Grey: "grey"; readonly BlueWithBorderPagination: "blueWithBorder"; readonly BlueWithUnderlinePagination: "blueWithUnderline"; readonly GreyWithBorderPagination: "greyWithBorder"; readonly GreyWithUnderlinePagination: "greyWithUnderline"; }; export declare type TableTheme = typeof TableThemeType.Blue | typeof TableThemeType.Grey | typeof TableThemeType.BlueWithBorderPagination | typeof TableThemeType.BlueWithUnderlinePagination | typeof TableThemeType.GreyWithBorderPagination | typeof TableThemeType.GreyWithUnderlinePagination; export declare type TablePaginationPlacement = typeof PaginationPlacementType.BottomLeft | typeof PaginationPlacementType.BottomCenter | typeof PaginationPlacementType.BottomRight; declare const PaginationPlacementType: { readonly BottomLeft: "BottomLeft"; readonly BottomCenter: "BottomCenter"; readonly BottomRight: "BottomRight"; }; export interface SceneTableOnChangeParams { currentPage: number; pageTotal: number; currentUnit: number; sortName: string; isSortDesc: boolean; } interface SceneTablePaginationInfo extends Pick { /** * 翻页组件所处相对于Table位置 */ paginationPlacement?: TablePaginationPlacement; /** * 当只有一页时,隐藏翻页功能 */ hideOnSinglePage?: boolean; } export interface SceneTableProps extends Omit, 'sortIcon' | 'columns' | 'onSortChange'>, Partial, 'columns'>>, SceneTablePaginationInfo { /** * 页码/排序修改时的回调函数 */ onChange?: (v: SceneTableOnChangeParams) => void; /** * 是否要在组件加载完的时候调用onChange * tableTheme: grey,默认值为false * tableTheme: blue,默认值为true */ autoLoadOnMounted?: boolean; /** * 如果有传入的columns,直接使用;没有,就通过columnList和columnInfo拼接columns * columnList传递当前要显示的columnInfo项 */ columnList?: SceneTableColumnOptionItemInfo[]; /** * 如果有传入的columns,直接使用;没有,就通过columnList和columnInfo拼接columns * columnInfo列举所有可能用到的columns项 */ columnInfo?: { [propName: string]: TableColumnInfo; }; /** * onChange时清空选项,默认true --清空 */ clearTableSelectionOnChange?: boolean; /** * 组件样式类型(Table + Pagination) */ theme?: TableTheme; /** * 默认排序列 */ defaultSortName?: string | (() => string); /** * 默认排序顺序 */ defaultIsSortDesc?: boolean | (() => boolean); /** * (pageTotal和total都没有传值时,会隐藏翻页功能) * 总页码 */ pageTotal?: number; /** * (pageTotal和total都没有传值时,会隐藏翻页功能) * 总数据数 * 当pageTotal没有传值的时候,会根据total和unit计算出pageTotal的值 */ total?: number; /** * (有翻页功能时才生效) * 当前页码 */ currentPage?: number; /** * (有翻页功能时才生效) * 默认当前页码 */ defaultCurrentPage?: number | (() => number); /** * (有翻页功能时才生效) * 可支持的每页显示数据条数,没值的时候没有切换条数功能 * 在unitList有值,defaultCurrentUnit没有值的情况下,会把unitList[0]作为defaultCurrentUnit使用 */ unitList?: number[]; /** * (有翻页功能时才生效) * 默认每页显示数据条数 */ defaultCurrentUnit?: number | (() => number); } interface SceneTableState extends SceneTableOnChangeParams { columns: TableColumnInfo[]; tableTheme: string; paginationTheme: string; pagination: SceneTablePaginationInfo & { placementCls?: string; }; autoLoadOnMounted: boolean; } declare class SceneTable extends React.Component, SceneTableState> { prefixCls: string; tableRef: React.RefObject>; static underlinePaginationThemeDefaultProps: { paginationPlacement: "BottomRight"; maxPageSize: number; hideOnSinglePage: boolean; ellipseVisible: boolean; pageTurnVisible: boolean; quickJumperVisible: boolean; }; static borderPaginationThemeDefaultProps: { paginationPlacement: "BottomLeft"; maxPageSize: number; hideOnSinglePage: boolean; ellipseVisible: boolean; pageTurnVisible: boolean; quickJumperVisible: boolean; }; static defaultProps: { columnList: any[]; dataSource: any[]; rowKey: string; theme: "greyWithUnderline"; clearTableSelectionOnChange: boolean; defaultCurrentPage: number; total: number; defaultCurrentUnit: number; defaultIsSortDesc: boolean; }; constructor(props: SceneTableProps); static getDerivedStateFromProps(nextProps: SceneTableProps, prevState: SceneTableState): Partial>; componentDidMount(): void; clearTableSelection: () => void; resetDefaultProps: () => void; getDefaultValue: (defaultValue: any) => any; onChangeCallback: () => void; onSortChange: (isSortDesc: any, sortName: any) => void; onPageChange: (page: any) => void; onUnitChange: (unit: any) => void; sortIcon: (isSortedDescending: any) => JSX.Element; render(): JSX.Element; } export default SceneTable;