1 | import * as React from 'react';
|
2 | import { PolymorphicProps, SlotComponentProps } from '../utils';
|
3 | import TablePaginationActions from './TablePaginationActions';
|
4 | import { ItemAriaLabelType } from './common.types';
|
5 | export interface LabelDisplayedRowsArgs {
|
6 | from: number;
|
7 | to: number;
|
8 | count: number;
|
9 | page: number;
|
10 | }
|
11 | export interface TablePaginationRootSlotPropsOverrides {
|
12 | }
|
13 | export interface TablePaginationActionsSlotPropsOverrides {
|
14 | }
|
15 | export interface TablePaginationSelectSlotPropsOverrides {
|
16 | }
|
17 | export interface TablePaginationSelectLabelSlotPropsOverrides {
|
18 | }
|
19 | export interface TablePaginationMenuItemSlotPropsOverrides {
|
20 | }
|
21 | export interface TablePaginationDisplayedRowsSlotPropsOverrides {
|
22 | }
|
23 | export interface TablePaginationToolbarSlotPropsOverrides {
|
24 | }
|
25 | export interface TablePaginationSpacerSlotPropsOverrides {
|
26 | }
|
27 | export interface TablePaginationOwnProps {
|
28 | |
29 |
|
30 |
|
31 | colSpan?: number;
|
32 | |
33 |
|
34 |
|
35 |
|
36 |
|
37 | slots?: TablePaginationSlots;
|
38 | |
39 |
|
40 |
|
41 |
|
42 | slotProps?: {
|
43 | root?: SlotComponentProps<'td', TablePaginationRootSlotPropsOverrides, TablePaginationOwnerState>;
|
44 | actions?: SlotComponentProps<typeof TablePaginationActions, TablePaginationActionsSlotPropsOverrides, TablePaginationOwnerState>;
|
45 | select?: SlotComponentProps<'select', TablePaginationSelectSlotPropsOverrides, TablePaginationOwnerState>;
|
46 | selectLabel?: SlotComponentProps<'p', TablePaginationSelectLabelSlotPropsOverrides, TablePaginationOwnerState>;
|
47 | menuItem?: SlotComponentProps<'option', TablePaginationMenuItemSlotPropsOverrides, TablePaginationOwnerState>;
|
48 | displayedRows?: SlotComponentProps<'p', TablePaginationDisplayedRowsSlotPropsOverrides, TablePaginationOwnerState>;
|
49 | toolbar?: SlotComponentProps<'div', TablePaginationToolbarSlotPropsOverrides, TablePaginationOwnerState>;
|
50 | spacer?: SlotComponentProps<'div', TablePaginationSpacerSlotPropsOverrides, TablePaginationOwnerState>;
|
51 | };
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 | count: number;
|
58 | |
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | getItemAriaLabel?: (type: ItemAriaLabelType) => string;
|
70 | |
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 | labelDisplayedRows?: (paginationInfo: LabelDisplayedRowsArgs) => React.ReactNode;
|
80 | |
81 |
|
82 |
|
83 | labelId?: string;
|
84 | |
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | labelRowsPerPage?: React.ReactNode;
|
91 | |
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 | onPageChange: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
|
98 | |
99 |
|
100 |
|
101 |
|
102 |
|
103 | onRowsPerPageChange?: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
|
104 | |
105 |
|
106 |
|
107 | page: number;
|
108 | |
109 |
|
110 |
|
111 |
|
112 |
|
113 | rowsPerPage: number;
|
114 | |
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 | rowsPerPageOptions?: Array<number | {
|
121 | value: number;
|
122 | label: string;
|
123 | }>;
|
124 | |
125 |
|
126 |
|
127 | selectId?: string;
|
128 | }
|
129 | export interface TablePaginationSlots {
|
130 | |
131 |
|
132 |
|
133 |
|
134 | root?: React.ElementType;
|
135 | |
136 |
|
137 |
|
138 |
|
139 | actions?: React.ElementType;
|
140 | |
141 |
|
142 |
|
143 |
|
144 | select?: React.ElementType;
|
145 | |
146 |
|
147 |
|
148 |
|
149 | selectLabel?: React.ElementType;
|
150 | |
151 |
|
152 |
|
153 |
|
154 | menuItem?: React.ElementType;
|
155 | |
156 |
|
157 |
|
158 |
|
159 | displayedRows?: React.ElementType;
|
160 | |
161 |
|
162 |
|
163 |
|
164 | toolbar?: React.ElementType;
|
165 | |
166 |
|
167 |
|
168 |
|
169 | spacer?: React.ElementType;
|
170 | }
|
171 | export interface TablePaginationTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'td'> {
|
172 | props: TablePaginationOwnProps & AdditionalProps;
|
173 | defaultComponent: RootComponentType;
|
174 | }
|
175 | export type TablePaginationProps<RootComponentType extends React.ElementType = TablePaginationTypeMap['defaultComponent']> = PolymorphicProps<TablePaginationTypeMap<{}, RootComponentType>, RootComponentType>;
|
176 | export type TablePaginationOwnerState = TablePaginationOwnProps;
|
177 | export type TablePaginationRootSlotProps = {
|
178 | children?: React.ReactNode;
|
179 | className?: string;
|
180 | colSpan?: number;
|
181 | ownerState: TablePaginationOwnerState;
|
182 | ref?: React.Ref<any>;
|
183 | };
|
184 | export type TablePaginationSelectSlotProps = {
|
185 | ['aria-label']: string;
|
186 | ['aria-labelledby']?: string;
|
187 | children?: React.ReactNode;
|
188 | className?: string;
|
189 | id?: string;
|
190 | onChange: (event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => void;
|
191 | ownerState: TablePaginationOwnerState;
|
192 | value: React.SelectHTMLAttributes<HTMLSelectElement>['value'];
|
193 | };
|
194 | export type TablePaginationActionsSlotProps = {
|
195 | className?: string;
|
196 | count: number;
|
197 | getItemAriaLabel: (type: ItemAriaLabelType) => string;
|
198 | onPageChange: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
|
199 | ownerState: TablePaginationOwnerState;
|
200 | page: number;
|
201 | rowsPerPage: number;
|
202 | };
|
203 | export type TablePaginationMenuItemSlotProps = {
|
204 | children?: React.ReactNode;
|
205 | className?: string;
|
206 | ownerState: TablePaginationOwnerState;
|
207 | value: React.SelectHTMLAttributes<HTMLSelectElement>['value'];
|
208 | };
|
209 | export type TablePaginationSelectLabelSlotProps = {
|
210 | children?: React.ReactNode;
|
211 | className?: string;
|
212 | id?: string;
|
213 | ownerState: TablePaginationOwnerState;
|
214 | };
|
215 | export type TablePaginationDisplayedRowsSlotProps = {
|
216 | children?: React.ReactNode;
|
217 | className?: string;
|
218 | ownerState: TablePaginationOwnerState;
|
219 | };
|
220 | export type TablePaginationToolbarSlotProps = {
|
221 | children?: React.ReactNode;
|
222 | className?: string;
|
223 | ownerState: TablePaginationOwnerState;
|
224 | };
|
225 | export type TablePaginationSpacerSlotProps = {
|
226 | className?: string;
|
227 | ownerState: TablePaginationOwnerState;
|
228 | };
|