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 | |
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | onChangePage?: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
|
35 | onPageChange: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
|
36 | |
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | onChangeRowsPerPage?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
|
43 | onRowsPerPageChange?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
|
44 | page: number;
|
45 | rowsPerPage: number;
|
46 | rowsPerPageOptions?: Array<number | { value: number; label: string }>;
|
47 | SelectProps?: Partial<SelectProps>;
|
48 | };
|
49 | defaultComponent: D;
|
50 | classKey: TablePaginationClassKey;
|
51 | }
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | declare const TablePagination: OverridableComponent<TablePaginationTypeMap<
|
65 | {},
|
66 | React.ComponentType<TablePaginationBaseProps>
|
67 | >>;
|
68 |
|
69 | export type TablePaginationClassKey =
|
70 | | 'root'
|
71 | | 'toolbar'
|
72 | | 'spacer'
|
73 | | 'menuItem'
|
74 | | 'caption'
|
75 | | 'input'
|
76 | | 'selectRoot'
|
77 | | 'select'
|
78 | | 'selectIcon'
|
79 | | 'actions';
|
80 |
|
81 | export type TablePaginationBaseProps = Omit<TableCellProps, 'classes' | 'component'>;
|
82 |
|
83 | export type TablePaginationProps<
|
84 | D extends React.ElementType = React.ComponentType<TablePaginationBaseProps>,
|
85 | P = {}
|
86 | > = OverrideProps<TablePaginationTypeMap<P, D>, D>;
|
87 |
|
88 | export default TablePagination;
|