|
@@ -1,109 +1,272 @@
|
1
|
1
|
import * as React from 'react';
|
2
|
2
|
import PropTypes from 'prop-types';
|
3
|
|
-import { useTheme } from '@mui/material/styles';
|
|
3
|
+import { alpha } from '@mui/material/styles';
|
4
|
4
|
import Box from '@mui/material/Box';
|
5
|
5
|
import Table from '@mui/material/Table';
|
6
|
6
|
import TableBody from '@mui/material/TableBody';
|
7
|
7
|
import TableCell from '@mui/material/TableCell';
|
8
|
8
|
import TableContainer from '@mui/material/TableContainer';
|
9
|
|
-import TableFooter from '@mui/material/TableFooter';
|
|
9
|
+import TableHead from '@mui/material/TableHead';
|
10
|
10
|
import TablePagination from '@mui/material/TablePagination';
|
11
|
11
|
import TableRow from '@mui/material/TableRow';
|
|
12
|
+import TableSortLabel from '@mui/material/TableSortLabel';
|
|
13
|
+import Toolbar from '@mui/material/Toolbar';
|
|
14
|
+import Typography from '@mui/material/Typography';
|
12
|
15
|
import Paper from '@mui/material/Paper';
|
|
16
|
+import Checkbox from '@mui/material/Checkbox';
|
13
|
17
|
import IconButton from '@mui/material/IconButton';
|
14
|
|
-import FirstPageIcon from '@mui/icons-material/FirstPage';
|
15
|
|
-import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft';
|
16
|
|
-import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight';
|
17
|
|
-import LastPageIcon from '@mui/icons-material/LastPage';
|
|
18
|
+import Tooltip from '@mui/material/Tooltip';
|
|
19
|
+import FormControlLabel from '@mui/material/FormControlLabel';
|
|
20
|
+import Switch from '@mui/material/Switch';
|
|
21
|
+import DeleteIcon from '@mui/icons-material/Delete';
|
|
22
|
+import FilterListIcon from '@mui/icons-material/FilterList';
|
|
23
|
+import { visuallyHidden } from '@mui/utils';
|
18
|
24
|
|
19
|
|
-function TablePaginationActions(props) {
|
20
|
|
- const theme = useTheme();
|
21
|
|
- const { count, page, rowsPerPage, onPageChange } = props;
|
22
|
|
-
|
23
|
|
- const handleFirstPageButtonClick = (event) => {
|
24
|
|
- onPageChange(event, 0);
|
|
25
|
+function createData(name, calories, fat, carbs, protein) {
|
|
26
|
+ return {
|
|
27
|
+ name,
|
|
28
|
+ calories,
|
|
29
|
+ fat,
|
|
30
|
+ carbs,
|
|
31
|
+ protein,
|
25
|
32
|
};
|
|
33
|
+}
|
26
|
34
|
|
27
|
|
- const handleBackButtonClick = (event) => {
|
28
|
|
- onPageChange(event, page - 1);
|
29
|
|
- };
|
|
35
|
+const rows = [
|
|
36
|
+ createData('Cupcake', 305, 3.7, 67, 4.3),
|
|
37
|
+ createData('Donut', 452, 25.0, 51, 4.9),
|
|
38
|
+ createData('Eclair', 262, 16.0, 24, 6.0),
|
|
39
|
+ createData('Frozen yoghurt', 159, 6.0, 24, 4.0),
|
|
40
|
+ createData('Gingerbread', 356, 16.0, 49, 3.9),
|
|
41
|
+ createData('Honeycomb', 408, 3.2, 87, 6.5),
|
|
42
|
+ createData('Ice cream sandwich', 237, 9.0, 37, 4.3),
|
|
43
|
+ createData('Jelly Bean', 375, 0.0, 94, 0.0),
|
|
44
|
+ createData('KitKat', 518, 26.0, 65, 7.0),
|
|
45
|
+ createData('Lollipop', 392, 0.2, 98, 0.0),
|
|
46
|
+ createData('Marshmallow', 318, 0, 81, 2.0),
|
|
47
|
+ createData('Nougat', 360, 19.0, 9, 37.0),
|
|
48
|
+ createData('Oreo', 437, 18.0, 63, 4.0),
|
|
49
|
+];
|
30
|
50
|
|
31
|
|
- const handleNextButtonClick = (event) => {
|
32
|
|
- onPageChange(event, page + 1);
|
33
|
|
- };
|
|
51
|
+function descendingComparator(a, b, orderBy) {
|
|
52
|
+ if (b[orderBy] < a[orderBy]) {
|
|
53
|
+ return -1;
|
|
54
|
+ }
|
|
55
|
+ if (b[orderBy] > a[orderBy]) {
|
|
56
|
+ return 1;
|
|
57
|
+ }
|
|
58
|
+ return 0;
|
|
59
|
+}
|
|
60
|
+
|
|
61
|
+function getComparator(order, orderBy) {
|
|
62
|
+ return order === 'desc'
|
|
63
|
+ ? (a, b) => descendingComparator(a, b, orderBy)
|
|
64
|
+ : (a, b) => -descendingComparator(a, b, orderBy);
|
|
65
|
+}
|
|
66
|
+
|
|
67
|
+// This method is created for cross-browser compatibility, if you don't
|
|
68
|
+// need to support IE11, you can use Array.prototype.sort() directly
|
|
69
|
+function stableSort(array, comparator) {
|
|
70
|
+ const stabilizedThis = array.map((el, index) => [el, index]);
|
|
71
|
+ stabilizedThis.sort((a, b) => {
|
|
72
|
+ const order = comparator(a[0], b[0]);
|
|
73
|
+ if (order !== 0) {
|
|
74
|
+ return order;
|
|
75
|
+ }
|
|
76
|
+ return a[1] - b[1];
|
|
77
|
+ });
|
|
78
|
+ return stabilizedThis.map((el) => el[0]);
|
|
79
|
+}
|
34
|
80
|
|
35
|
|
- const handleLastPageButtonClick = (event) => {
|
36
|
|
- onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
|
81
|
+const headCells = [
|
|
82
|
+ {
|
|
83
|
+ id: 'name',
|
|
84
|
+ numeric: false,
|
|
85
|
+ disablePadding: true,
|
|
86
|
+ label: 'Dessert (100g serving)',
|
|
87
|
+ },
|
|
88
|
+ {
|
|
89
|
+ id: 'calories',
|
|
90
|
+ numeric: true,
|
|
91
|
+ disablePadding: false,
|
|
92
|
+ label: 'Calories',
|
|
93
|
+ },
|
|
94
|
+ {
|
|
95
|
+ id: 'fat',
|
|
96
|
+ numeric: true,
|
|
97
|
+ disablePadding: false,
|
|
98
|
+ label: 'Fat (g)',
|
|
99
|
+ },
|
|
100
|
+ {
|
|
101
|
+ id: 'carbs',
|
|
102
|
+ numeric: true,
|
|
103
|
+ disablePadding: false,
|
|
104
|
+ label: 'Carbs (g)',
|
|
105
|
+ },
|
|
106
|
+ {
|
|
107
|
+ id: 'protein',
|
|
108
|
+ numeric: true,
|
|
109
|
+ disablePadding: false,
|
|
110
|
+ label: 'Protein (g)',
|
|
111
|
+ },
|
|
112
|
+];
|
|
113
|
+
|
|
114
|
+function EnhancedTableHead(props) {
|
|
115
|
+
|
|
116
|
+ const { onSelectAllClick, order, orderBy, numSelected, rowCount, onRequestSort } =
|
|
117
|
+ props;
|
|
118
|
+ const createSortHandler = (property) => (event) => {
|
|
119
|
+ onRequestSort(event, property);
|
37
|
120
|
};
|
38
|
121
|
|
39
|
122
|
return (
|
40
|
|
- <Box sx={{ flexShrink: 0, ml: 2.5 }}>
|
41
|
|
- <IconButton
|
42
|
|
- onClick={handleFirstPageButtonClick}
|
43
|
|
- disabled={page === 0}
|
44
|
|
- aria-label="first page"
|
45
|
|
- >
|
46
|
|
- {theme.direction === 'rtl' ? <LastPageIcon /> : <FirstPageIcon />}
|
47
|
|
- </IconButton>
|
48
|
|
- <IconButton
|
49
|
|
- onClick={handleBackButtonClick}
|
50
|
|
- disabled={page === 0}
|
51
|
|
- aria-label="previous page"
|
52
|
|
- >
|
53
|
|
- {theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
|
54
|
|
- </IconButton>
|
55
|
|
- <IconButton
|
56
|
|
- onClick={handleNextButtonClick}
|
57
|
|
- disabled={page >= Math.ceil(count / rowsPerPage) - 1}
|
58
|
|
- aria-label="next page"
|
59
|
|
- >
|
60
|
|
- {theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
|
61
|
|
- </IconButton>
|
62
|
|
- <IconButton
|
63
|
|
- onClick={handleLastPageButtonClick}
|
64
|
|
- disabled={page >= Math.ceil(count / rowsPerPage) - 1}
|
65
|
|
- aria-label="last page"
|
66
|
|
- >
|
67
|
|
- {theme.direction === 'rtl' ? <FirstPageIcon /> : <LastPageIcon />}
|
68
|
|
- </IconButton>
|
69
|
|
- </Box>
|
|
123
|
+ <TableHead>
|
|
124
|
+ <TableRow>
|
|
125
|
+ <TableCell padding="checkbox">
|
|
126
|
+ <Checkbox
|
|
127
|
+ color="primary"
|
|
128
|
+ indeterminate={numSelected > 0 && numSelected < rowCount}
|
|
129
|
+ checked={rowCount > 0 && numSelected === rowCount}
|
|
130
|
+ onChange={onSelectAllClick}
|
|
131
|
+ inputProps={{
|
|
132
|
+ 'aria-label': 'select all desserts',
|
|
133
|
+ }}
|
|
134
|
+ />
|
|
135
|
+ </TableCell>
|
|
136
|
+ {headCells.map((headCell) => (
|
|
137
|
+ <TableCell
|
|
138
|
+ key={headCell.id}
|
|
139
|
+ align={headCell.numeric ? 'right' : 'left'}
|
|
140
|
+ padding={headCell.disablePadding ? 'none' : 'normal'}
|
|
141
|
+ sortDirection={orderBy === headCell.id ? order : false}
|
|
142
|
+ >
|
|
143
|
+ <TableSortLabel
|
|
144
|
+ active={orderBy === headCell.id}
|
|
145
|
+ direction={orderBy === headCell.id ? order : 'asc'}
|
|
146
|
+ onClick={createSortHandler(headCell.id)}
|
|
147
|
+ >
|
|
148
|
+ {headCell.label}
|
|
149
|
+ {orderBy === headCell.id ? (
|
|
150
|
+ <Box component="span" sx={visuallyHidden}>
|
|
151
|
+ {order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
|
152
|
+ </Box>
|
|
153
|
+ ) : null}
|
|
154
|
+ </TableSortLabel>
|
|
155
|
+ </TableCell>
|
|
156
|
+ ))}
|
|
157
|
+ </TableRow>
|
|
158
|
+ </TableHead>
|
70
|
159
|
);
|
71
|
160
|
}
|
72
|
161
|
|
73
|
|
-TablePaginationActions.propTypes = {
|
74
|
|
- count: PropTypes.number.isRequired,
|
75
|
|
- onPageChange: PropTypes.func.isRequired,
|
76
|
|
- page: PropTypes.number.isRequired,
|
77
|
|
- rowsPerPage: PropTypes.number.isRequired,
|
|
162
|
+EnhancedTableHead.propTypes = {
|
|
163
|
+ numSelected: PropTypes.number.isRequired,
|
|
164
|
+ onRequestSort: PropTypes.func.isRequired,
|
|
165
|
+ onSelectAllClick: PropTypes.func.isRequired,
|
|
166
|
+ order: PropTypes.oneOf(['asc', 'desc']).isRequired,
|
|
167
|
+ orderBy: PropTypes.string.isRequired,
|
|
168
|
+ rowCount: PropTypes.number.isRequired,
|
78
|
169
|
};
|
79
|
170
|
|
80
|
|
-function createData(name, calories, fat) {
|
81
|
|
- return { name, calories, fat };
|
82
|
|
-}
|
|
171
|
+const EnhancedTableToolbar = (props) => {
|
83
|
172
|
|
84
|
|
-const rows = [
|
85
|
|
- createData('Cupcake', 305, 3.7),
|
86
|
|
- createData('Donut', 452, 25.0),
|
87
|
|
- createData('Eclair', 262, 16.0),
|
88
|
|
- createData('Frozen yoghurt', 159, 6.0),
|
89
|
|
- createData('Gingerbread', 356, 16.0),
|
90
|
|
- createData('Honeycomb', 408, 3.2),
|
91
|
|
- createData('Ice cream sandwich', 237, 9.0),
|
92
|
|
- createData('Jelly Bean', 375, 0.0),
|
93
|
|
- createData('KitKat', 518, 26.0),
|
94
|
|
- createData('Lollipop', 392, 0.2),
|
95
|
|
- createData('Marshmallow', 318, 0),
|
96
|
|
- createData('Nougat', 360, 19.0),
|
97
|
|
- createData('Oreo', 437, 18.0),
|
98
|
|
-].sort((a, b) => (a.calories < b.calories ? -1 : 1));
|
99
|
|
-
|
100
|
|
-export default function CustomPaginationActionsTable() {
|
|
173
|
+ const { numSelected } = props;
|
|
174
|
+
|
|
175
|
+ return (
|
|
176
|
+ <Toolbar
|
|
177
|
+ sx={{
|
|
178
|
+ pl: { sm: 2 },
|
|
179
|
+ pr: { xs: 1, sm: 1 },
|
|
180
|
+ ...(numSelected > 0 && {
|
|
181
|
+ bgcolor: (theme) =>
|
|
182
|
+ alpha(theme.palette.primary.main, theme.palette.action.activatedOpacity),
|
|
183
|
+ }),
|
|
184
|
+ }}
|
|
185
|
+ >
|
|
186
|
+ {numSelected > 0 ? (
|
|
187
|
+ <Typography
|
|
188
|
+ sx={{ flex: '1 1 100%' }}
|
|
189
|
+ color="inherit"
|
|
190
|
+ variant="subtitle1"
|
|
191
|
+ component="div"
|
|
192
|
+ >
|
|
193
|
+ {numSelected} selected
|
|
194
|
+ </Typography>
|
|
195
|
+ ) : (
|
|
196
|
+ <Typography
|
|
197
|
+ sx={{ flex: '1 1 100%' }}
|
|
198
|
+ variant="h6"
|
|
199
|
+ id="tableTitle"
|
|
200
|
+ component="div"
|
|
201
|
+ >
|
|
202
|
+ Nutrition
|
|
203
|
+ </Typography>
|
|
204
|
+ )}
|
|
205
|
+
|
|
206
|
+ {numSelected > 0 ? (
|
|
207
|
+ <Tooltip title="Delete">
|
|
208
|
+ <IconButton>
|
|
209
|
+ <DeleteIcon />
|
|
210
|
+ </IconButton>
|
|
211
|
+ </Tooltip>
|
|
212
|
+ ) : (
|
|
213
|
+ <Tooltip title="Filter list">
|
|
214
|
+ <IconButton>
|
|
215
|
+ <FilterListIcon />
|
|
216
|
+ </IconButton>
|
|
217
|
+ </Tooltip>
|
|
218
|
+ )}
|
|
219
|
+ </Toolbar>
|
|
220
|
+ );
|
|
221
|
+};
|
|
222
|
+
|
|
223
|
+EnhancedTableToolbar.propTypes = {
|
|
224
|
+ numSelected: PropTypes.number.isRequired,
|
|
225
|
+};
|
|
226
|
+
|
|
227
|
+export default function EnhancedTable() {
|
|
228
|
+
|
|
229
|
+ const [order, setOrder] = React.useState('asc');
|
|
230
|
+ const [orderBy, setOrderBy] = React.useState('calories');
|
|
231
|
+ const [selected, setSelected] = React.useState([]);
|
101
|
232
|
const [page, setPage] = React.useState(0);
|
|
233
|
+ const [dense, setDense] = React.useState(false);
|
102
|
234
|
const [rowsPerPage, setRowsPerPage] = React.useState(5);
|
103
|
235
|
|
104
|
|
- // Avoid a layout jump when reaching the last page with empty rows.
|
105
|
|
- const emptyRows =
|
106
|
|
- page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0;
|
|
236
|
+ const handleRequestSort = (event, property) => {
|
|
237
|
+ const isAsc = orderBy === property && order === 'asc';
|
|
238
|
+ setOrder(isAsc ? 'desc' : 'asc');
|
|
239
|
+ setOrderBy(property);
|
|
240
|
+ };
|
|
241
|
+
|
|
242
|
+ const handleSelectAllClick = (event) => {
|
|
243
|
+ if (event.target.checked) {
|
|
244
|
+ const newSelecteds = rows.map((n) => n.name);
|
|
245
|
+ setSelected(newSelecteds);
|
|
246
|
+ return;
|
|
247
|
+ }
|
|
248
|
+ setSelected([]);
|
|
249
|
+ };
|
|
250
|
+
|
|
251
|
+ const handleClick = (event, name) => {
|
|
252
|
+ const selectedIndex = selected.indexOf(name);
|
|
253
|
+ let newSelected = [];
|
|
254
|
+
|
|
255
|
+ if (selectedIndex === -1) {
|
|
256
|
+ newSelected = newSelected.concat(selected, name);
|
|
257
|
+ } else if (selectedIndex === 0) {
|
|
258
|
+ newSelected = newSelected.concat(selected.slice(1));
|
|
259
|
+ } else if (selectedIndex === selected.length - 1) {
|
|
260
|
+ newSelected = newSelected.concat(selected.slice(0, -1));
|
|
261
|
+ } else if (selectedIndex > 0) {
|
|
262
|
+ newSelected = newSelected.concat(
|
|
263
|
+ selected.slice(0, selectedIndex),
|
|
264
|
+ selected.slice(selectedIndex + 1),
|
|
265
|
+ );
|
|
266
|
+ }
|
|
267
|
+
|
|
268
|
+ setSelected(newSelected);
|
|
269
|
+ };
|
107
|
270
|
|
108
|
271
|
const handleChangePage = (event, newPage) => {
|
109
|
272
|
setPage(newPage);
|
|
@@ -114,54 +277,102 @@ export default function CustomPaginationActionsTable() {
|
114
|
277
|
setPage(0);
|
115
|
278
|
};
|
116
|
279
|
|
|
280
|
+ const handleChangeDense = (event) => {
|
|
281
|
+ setDense(event.target.checked);
|
|
282
|
+ };
|
|
283
|
+
|
|
284
|
+ const isSelected = (name) => selected.indexOf(name) !== -1;
|
|
285
|
+
|
|
286
|
+ // Avoid a layout jump when reaching the last page with empty rows.
|
|
287
|
+ const emptyRows = page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0;
|
|
288
|
+
|
117
|
289
|
return (
|
118
|
|
- <TableContainer component={Paper}>
|
119
|
|
- <Table sx={{ minWidth: 500 }} aria-label="custom pagination table">
|
120
|
|
- <TableBody>
|
121
|
|
- {(rowsPerPage > 0
|
122
|
|
- ? rows.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
123
|
|
- : rows
|
124
|
|
- ).map((row) => (
|
125
|
|
- <TableRow key={row.name}>
|
126
|
|
- <TableCell component="th" scope="row">
|
127
|
|
- {row.name}
|
128
|
|
- </TableCell>
|
129
|
|
- <TableCell style={{ width: 160 }} align="right">
|
130
|
|
- {row.calories}
|
131
|
|
- </TableCell>
|
132
|
|
- <TableCell style={{ width: 160 }} align="right">
|
133
|
|
- {row.fat}
|
134
|
|
- </TableCell>
|
135
|
|
- </TableRow>
|
136
|
|
- ))}
|
137
|
|
-
|
138
|
|
- {emptyRows > 0 && (
|
139
|
|
- <TableRow style={{ height: 53 * emptyRows }}>
|
140
|
|
- <TableCell colSpan={6} />
|
141
|
|
- </TableRow>
|
142
|
|
- )}
|
143
|
|
- </TableBody>
|
144
|
|
- <TableFooter>
|
145
|
|
- <TableRow>
|
146
|
|
- <TablePagination
|
147
|
|
- rowsPerPageOptions={[5, 10, 25, { label: 'All', value: -1 }]}
|
148
|
|
- colSpan={3}
|
149
|
|
- count={rows.length}
|
150
|
|
- rowsPerPage={rowsPerPage}
|
151
|
|
- page={page}
|
152
|
|
- SelectProps={{
|
153
|
|
- inputProps: {
|
154
|
|
- 'aria-label': 'rows per page',
|
155
|
|
- },
|
156
|
|
- native: true,
|
157
|
|
- }}
|
158
|
|
- onPageChange={handleChangePage}
|
159
|
|
- onRowsPerPageChange={handleChangeRowsPerPage}
|
160
|
|
- ActionsComponent={TablePaginationActions}
|
|
290
|
+ <Box sx={{ width: '100%' }}>
|
|
291
|
+ <Paper sx={{ width: '100%', mb: 2 }}>
|
|
292
|
+ <EnhancedTableToolbar numSelected={selected.length} />
|
|
293
|
+ <TableContainer>
|
|
294
|
+ <Table
|
|
295
|
+ sx={{ minWidth: 750 }}
|
|
296
|
+ aria-labelledby="tableTitle"
|
|
297
|
+ size={dense ? 'small' : 'medium'}
|
|
298
|
+ >
|
|
299
|
+ <EnhancedTableHead
|
|
300
|
+ numSelected={selected.length}
|
|
301
|
+ order={order}
|
|
302
|
+ orderBy={orderBy}
|
|
303
|
+ onSelectAllClick={handleSelectAllClick}
|
|
304
|
+ onRequestSort={handleRequestSort}
|
|
305
|
+ rowCount={rows.length}
|
161
|
306
|
/>
|
162
|
|
- </TableRow>
|
163
|
|
- </TableFooter>
|
164
|
|
- </Table>
|
165
|
|
- </TableContainer>
|
|
307
|
+ <TableBody>
|
|
308
|
+ {/* if you don't need to support IE11, you can replace the `stableSort` call with:
|
|
309
|
+ rows.slice().sort(getComparator(order, orderBy)) */}
|
|
310
|
+ {stableSort(rows, getComparator(order, orderBy))
|
|
311
|
+ .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
312
|
+ .map((row, index) => {
|
|
313
|
+ const isItemSelected = isSelected(row.name);
|
|
314
|
+ const labelId = `enhanced-table-checkbox-${index}`;
|
|
315
|
+
|
|
316
|
+ return (
|
|
317
|
+ <TableRow
|
|
318
|
+ hover
|
|
319
|
+ onClick={(event) => handleClick(event, row.name)}
|
|
320
|
+ role="checkbox"
|
|
321
|
+ aria-checked={isItemSelected}
|
|
322
|
+ tabIndex={-1}
|
|
323
|
+ key={row.name}
|
|
324
|
+ selected={isItemSelected}
|
|
325
|
+ >
|
|
326
|
+ <TableCell padding="checkbox">
|
|
327
|
+ <Checkbox
|
|
328
|
+ color="primary"
|
|
329
|
+ checked={isItemSelected}
|
|
330
|
+ inputProps={{
|
|
331
|
+ 'aria-labelledby': labelId,
|
|
332
|
+ }}
|
|
333
|
+ />
|
|
334
|
+ </TableCell>
|
|
335
|
+ <TableCell
|
|
336
|
+ component="th"
|
|
337
|
+ id={labelId}
|
|
338
|
+ scope="row"
|
|
339
|
+ padding="none"
|
|
340
|
+ >
|
|
341
|
+ {row.name}
|
|
342
|
+ </TableCell>
|
|
343
|
+ <TableCell align="right">{row.calories}</TableCell>
|
|
344
|
+ <TableCell align="right">{row.fat}</TableCell>
|
|
345
|
+ <TableCell align="right">{row.carbs}</TableCell>
|
|
346
|
+ <TableCell align="right">{row.protein}</TableCell>
|
|
347
|
+ </TableRow>
|
|
348
|
+ );
|
|
349
|
+ })}
|
|
350
|
+ {emptyRows > 0 && (
|
|
351
|
+ <TableRow
|
|
352
|
+ style={{
|
|
353
|
+ height: (dense ? 33 : 53) * emptyRows,
|
|
354
|
+ }}
|
|
355
|
+ >
|
|
356
|
+ <TableCell colSpan={6} />
|
|
357
|
+ </TableRow>
|
|
358
|
+ )}
|
|
359
|
+ </TableBody>
|
|
360
|
+ </Table>
|
|
361
|
+ </TableContainer>
|
|
362
|
+ <TablePagination
|
|
363
|
+ rowsPerPageOptions={[5, 10, 25]}
|
|
364
|
+ component="div"
|
|
365
|
+ count={rows.length}
|
|
366
|
+ rowsPerPage={rowsPerPage}
|
|
367
|
+ page={page}
|
|
368
|
+ onPageChange={handleChangePage}
|
|
369
|
+ onRowsPerPageChange={handleChangeRowsPerPage}
|
|
370
|
+ />
|
|
371
|
+ </Paper>
|
|
372
|
+ <FormControlLabel
|
|
373
|
+ control={<Switch checked={dense} onChange={handleChangeDense} />}
|
|
374
|
+ label="Dense padding"
|
|
375
|
+ />
|
|
376
|
+ </Box>
|
166
|
377
|
);
|
167
|
378
|
}
|