1 | import * as React from 'react';
|
2 | import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
3 | import { Omit } from '@material-ui/types';
|
4 | import { TablePaginationActionsProps } from './TablePaginationActions';
|
5 | import { TableCellProps } from '../TableCell';
|
6 | import { IconButtonProps } from '../IconButton';
|
7 | import { SelectProps } from '../Select';
|
8 |
|
9 | export interface LabelDisplayedRowsArgs {
|
10 | from: number;
|
11 | to: number;
|
12 | count: number;
|
13 | page: number;
|
14 | }
|
15 |
|
16 | export interface TablePaginationTypeMap<P, D extends React.ElementType> {
|
17 | props: P &
|
18 | TablePaginationBaseProps & {
|
19 | ActionsComponent?: React.ElementType<TablePaginationActionsProps>;
|
20 | backIconButtonText?: string;
|
21 | backIconButtonProps?: Partial<IconButtonProps>;
|
22 | count: number;
|
23 | labelDisplayedRows?: (paginationInfo: LabelDisplayedRowsArgs) => React.ReactNode;
|
24 | labelRowsPerPage?: React.ReactNode;
|
25 | nextIconButtonProps?: Partial<IconButtonProps>;
|
26 | nextIconButtonText?: string;
|
27 | onChangePage: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
|
28 | onChangeRowsPerPage?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
|
29 | page: number;
|
30 | rowsPerPage: number;
|
31 | rowsPerPageOptions?: Array<number | { value: number; label: string }>;
|
32 | SelectProps?: Partial<SelectProps>;
|
33 | };
|
34 | defaultComponent: D;
|
35 | classKey: TablePaginationClassKey;
|
36 | }
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | declare const TablePagination: OverridableComponent<TablePaginationTypeMap<
|
50 | {},
|
51 | React.ComponentType<TablePaginationBaseProps>
|
52 | >>;
|
53 |
|
54 | export type TablePaginationClassKey =
|
55 | | 'root'
|
56 | | 'toolbar'
|
57 | | 'spacer'
|
58 | | 'menuItem'
|
59 | | 'caption'
|
60 | | 'input'
|
61 | | 'selectRoot'
|
62 | | 'select'
|
63 | | 'selectIcon'
|
64 | | 'actions';
|
65 |
|
66 | export type TablePaginationBaseProps = Omit<TableCellProps, 'classes' | 'component'>;
|
67 |
|
68 | export type TablePaginationProps<
|
69 | D extends React.ElementType = React.ComponentType<TablePaginationBaseProps>,
|
70 | P = {}
|
71 | > = OverrideProps<TablePaginationTypeMap<P, D>, D>;
|
72 |
|
73 | export default TablePagination;
|