mui-table-2026 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +4 -16
- package/src/MUIDataTable.js +213 -217
- package/src/components/TableBody.js +41 -38
- package/src/components/TableFilter.js +98 -90
- package/src/components/TableToolbar.js +134 -126
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { Typography } from
|
|
3
|
-
import { Toolbar } from
|
|
4
|
-
import { IconButton } from
|
|
5
|
-
import { Menu } from
|
|
6
|
-
import { MenuItem } from
|
|
7
|
-
import { ListItemIcon } from
|
|
8
|
-
import { ListItemText } from
|
|
9
|
-
import Popover from
|
|
10
|
-
import TableFilter from
|
|
11
|
-
import TableViewCol from
|
|
12
|
-
import TableSearch from
|
|
13
|
-
import { Search as SearchIcon } from
|
|
14
|
-
import DownloadIcon from
|
|
15
|
-
import { Print as PrintIcon } from
|
|
16
|
-
import { ViewColumn as ViewColumnIcon } from
|
|
17
|
-
import FilterIcon from
|
|
18
|
-
import { FileDownload as FileDownloadIcon } from
|
|
19
|
-
import { PictureAsPdf as PictureAsPdfIcon } from
|
|
20
|
-
import { TableChart as TableChartIcon } from
|
|
21
|
-
import html2canvas from
|
|
22
|
-
import jsPDF from
|
|
23
|
-
import find from
|
|
24
|
-
import { withStyles } from
|
|
25
|
-
import { createCSVDownload, downloadCSV } from
|
|
26
|
-
import MuiTooltip from
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Typography } from "@mui/material";
|
|
3
|
+
import { Toolbar } from "@mui/material";
|
|
4
|
+
import { IconButton } from "@mui/material";
|
|
5
|
+
import { Menu } from "@mui/material";
|
|
6
|
+
import { MenuItem } from "@mui/material";
|
|
7
|
+
import { ListItemIcon } from "@mui/material";
|
|
8
|
+
import { ListItemText } from "@mui/material";
|
|
9
|
+
import Popover from "./Popover";
|
|
10
|
+
import TableFilter from "./TableFilter";
|
|
11
|
+
import TableViewCol from "./TableViewCol";
|
|
12
|
+
import TableSearch from "./TableSearch";
|
|
13
|
+
import { Search as SearchIcon } from "@mui/icons-material";
|
|
14
|
+
import DownloadIcon from "@mui/icons-material/CloudDownload";
|
|
15
|
+
import { Print as PrintIcon } from "@mui/icons-material";
|
|
16
|
+
import { ViewColumn as ViewColumnIcon } from "@mui/icons-material";
|
|
17
|
+
import FilterIcon from "@mui/icons-material/FilterList";
|
|
18
|
+
import { FileDownload as FileDownloadIcon } from "@mui/icons-material";
|
|
19
|
+
import { PictureAsPdf as PictureAsPdfIcon } from "@mui/icons-material";
|
|
20
|
+
import { TableChart as TableChartIcon } from "@mui/icons-material";
|
|
21
|
+
import html2canvas from "html2canvas";
|
|
22
|
+
import jsPDF from "jspdf";
|
|
23
|
+
import { find } from "lodash-es";
|
|
24
|
+
import { withStyles } from "tss-react/mui";
|
|
25
|
+
import { createCSVDownload, downloadCSV } from "../utils";
|
|
26
|
+
import MuiTooltip from "@mui/material/Tooltip";
|
|
27
27
|
|
|
28
28
|
export const defaultToolbarStyles = (theme) => ({
|
|
29
29
|
root: {
|
|
30
|
-
|
|
31
|
-
display:
|
|
30
|
+
"@media print": {
|
|
31
|
+
display: "none",
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
fullWidthRoot: {},
|
|
35
35
|
left: {
|
|
36
|
-
flex:
|
|
36
|
+
flex: "1 1 auto",
|
|
37
37
|
},
|
|
38
38
|
fullWidthLeft: {
|
|
39
|
-
flex:
|
|
39
|
+
flex: "1 1 auto",
|
|
40
40
|
},
|
|
41
41
|
actions: {
|
|
42
|
-
flex:
|
|
43
|
-
textAlign:
|
|
42
|
+
flex: "1 1 auto",
|
|
43
|
+
textAlign: "right",
|
|
44
44
|
},
|
|
45
45
|
fullWidthActions: {
|
|
46
|
-
flex:
|
|
47
|
-
textAlign:
|
|
46
|
+
flex: "1 1 auto",
|
|
47
|
+
textAlign: "right",
|
|
48
48
|
},
|
|
49
49
|
titleRoot: {},
|
|
50
50
|
titleText: {},
|
|
51
51
|
fullWidthTitleText: {
|
|
52
|
-
textAlign:
|
|
52
|
+
textAlign: "left",
|
|
53
53
|
},
|
|
54
54
|
icon: {
|
|
55
|
-
|
|
55
|
+
"&:hover": {
|
|
56
56
|
color: theme.palette.primary.main,
|
|
57
57
|
},
|
|
58
58
|
},
|
|
@@ -60,69 +60,69 @@ export const defaultToolbarStyles = (theme) => ({
|
|
|
60
60
|
color: theme.palette.primary.main,
|
|
61
61
|
},
|
|
62
62
|
filterPaper: {
|
|
63
|
-
maxWidth:
|
|
63
|
+
maxWidth: "50%",
|
|
64
64
|
},
|
|
65
65
|
filterCloseIcon: {
|
|
66
|
-
position:
|
|
66
|
+
position: "absolute",
|
|
67
67
|
right: 0,
|
|
68
68
|
top: 0,
|
|
69
69
|
zIndex: 100,
|
|
70
70
|
},
|
|
71
71
|
searchIcon: {
|
|
72
|
-
display:
|
|
73
|
-
marginTop:
|
|
74
|
-
marginRight:
|
|
72
|
+
display: "inline-flex",
|
|
73
|
+
marginTop: "10px",
|
|
74
|
+
marginRight: "8px",
|
|
75
75
|
},
|
|
76
76
|
exportMenu: {
|
|
77
|
-
|
|
78
|
-
borderRadius:
|
|
79
|
-
boxShadow:
|
|
80
|
-
border:
|
|
77
|
+
"& .MuiPaper-root": {
|
|
78
|
+
borderRadius: "8px",
|
|
79
|
+
boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1)",
|
|
80
|
+
border: "1px solid #e5e7eb",
|
|
81
81
|
},
|
|
82
82
|
},
|
|
83
83
|
exportMenuItem: {
|
|
84
|
-
|
|
85
|
-
backgroundColor:
|
|
84
|
+
"&:hover": {
|
|
85
|
+
backgroundColor: "#f3f4f6",
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
|
-
[theme.breakpoints.down(
|
|
88
|
+
[theme.breakpoints.down("md")]: {
|
|
89
89
|
titleRoot: {},
|
|
90
90
|
titleText: {
|
|
91
|
-
fontSize:
|
|
91
|
+
fontSize: "16px",
|
|
92
92
|
},
|
|
93
93
|
spacer: {
|
|
94
|
-
display:
|
|
94
|
+
display: "none",
|
|
95
95
|
},
|
|
96
96
|
left: {
|
|
97
97
|
// flex: "1 1 40%",
|
|
98
|
-
padding:
|
|
98
|
+
padding: "8px 0px",
|
|
99
99
|
},
|
|
100
100
|
actions: {
|
|
101
101
|
// flex: "1 1 60%",
|
|
102
|
-
textAlign:
|
|
102
|
+
textAlign: "right",
|
|
103
103
|
},
|
|
104
104
|
},
|
|
105
|
-
[theme.breakpoints.down(
|
|
105
|
+
[theme.breakpoints.down("sm")]: {
|
|
106
106
|
root: {
|
|
107
|
-
display:
|
|
108
|
-
|
|
109
|
-
display:
|
|
107
|
+
display: "block",
|
|
108
|
+
"@media print": {
|
|
109
|
+
display: "none !important",
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
112
|
left: {
|
|
113
|
-
padding:
|
|
113
|
+
padding: "8px 0px 0px 0px",
|
|
114
114
|
},
|
|
115
115
|
titleText: {
|
|
116
|
-
textAlign:
|
|
116
|
+
textAlign: "center",
|
|
117
117
|
},
|
|
118
118
|
actions: {
|
|
119
|
-
textAlign:
|
|
119
|
+
textAlign: "center",
|
|
120
120
|
},
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
"@media screen and (max-width: 480px)": {},
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
const RESPONSIVE_FULL_WIDTH_NAME =
|
|
125
|
+
const RESPONSIVE_FULL_WIDTH_NAME = "scrollFullHeightFullWidth";
|
|
126
126
|
|
|
127
127
|
class TableToolbar extends React.Component {
|
|
128
128
|
state = {
|
|
@@ -183,10 +183,10 @@ class TableToolbar extends React.Component {
|
|
|
183
183
|
// that matches the dataIndex and column
|
|
184
184
|
// TODO: Create a utility function for checking whether or not something is a react object
|
|
185
185
|
let val =
|
|
186
|
-
typeof column ===
|
|
186
|
+
typeof column === "object" && column !== null && !Array.isArray(column)
|
|
187
187
|
? find(data, (d) => d.index === row.dataIndex).data[i]
|
|
188
188
|
: column;
|
|
189
|
-
val = typeof val ===
|
|
189
|
+
val = typeof val === "function" ? find(data, (d) => d.index === row.dataIndex).data[i] : val;
|
|
190
190
|
return val;
|
|
191
191
|
}),
|
|
192
192
|
};
|
|
@@ -204,10 +204,10 @@ class TableToolbar extends React.Component {
|
|
|
204
204
|
|
|
205
205
|
// now, check columns:
|
|
206
206
|
if (options.downloadOptions.filterOptions.useDisplayedColumnsOnly) {
|
|
207
|
-
columnsToDownload = columnsToDownload.filter((_) => _.display ===
|
|
207
|
+
columnsToDownload = columnsToDownload.filter((_) => _.display === "true");
|
|
208
208
|
|
|
209
209
|
dataToDownload = dataToDownload.map((row) => {
|
|
210
|
-
row.data = row.data.filter((_, index) => columns[columnOrderCopy[index]].display ===
|
|
210
|
+
row.data = row.data.filter((_, index) => columns[columnOrderCopy[index]].display === "true");
|
|
211
211
|
return row;
|
|
212
212
|
});
|
|
213
213
|
}
|
|
@@ -241,37 +241,37 @@ class TableToolbar extends React.Component {
|
|
|
241
241
|
scale: 2,
|
|
242
242
|
useCORS: true,
|
|
243
243
|
allowTaint: true,
|
|
244
|
-
backgroundColor:
|
|
244
|
+
backgroundColor: "#ffffff",
|
|
245
245
|
});
|
|
246
246
|
|
|
247
|
-
const imgData = canvas.toDataURL(
|
|
248
|
-
const pdf = new jsPDF(
|
|
247
|
+
const imgData = canvas.toDataURL("image/png");
|
|
248
|
+
const pdf = new jsPDF("p", "mm", "a4");
|
|
249
249
|
const imgWidth = 210;
|
|
250
250
|
const pageHeight = 295;
|
|
251
251
|
const imgHeight = (canvas.height * imgWidth) / canvas.width;
|
|
252
252
|
let heightLeft = imgHeight;
|
|
253
253
|
let position = 0;
|
|
254
254
|
|
|
255
|
-
pdf.addImage(imgData,
|
|
255
|
+
pdf.addImage(imgData, "PNG", 0, position, imgWidth, imgHeight);
|
|
256
256
|
heightLeft -= pageHeight;
|
|
257
257
|
|
|
258
258
|
while (heightLeft >= 0) {
|
|
259
259
|
position = heightLeft - imgHeight;
|
|
260
260
|
pdf.addPage();
|
|
261
|
-
pdf.addImage(imgData,
|
|
261
|
+
pdf.addImage(imgData, "PNG", 0, position, imgWidth, imgHeight);
|
|
262
262
|
heightLeft -= pageHeight;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
pdf.save(
|
|
265
|
+
pdf.save("table-export.pdf");
|
|
266
266
|
} catch (error) {
|
|
267
|
-
console.error(
|
|
267
|
+
console.error("Print error:", error);
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
270
|
|
|
271
271
|
handleCustomExport = (type) => {
|
|
272
272
|
this.handleExportMenuClose();
|
|
273
273
|
const { onExport } = this.props.options || {};
|
|
274
|
-
if (onExport && typeof onExport ===
|
|
274
|
+
if (onExport && typeof onExport === "function") {
|
|
275
275
|
onExport(type);
|
|
276
276
|
}
|
|
277
277
|
};
|
|
@@ -286,14 +286,14 @@ class TableToolbar extends React.Component {
|
|
|
286
286
|
() => {
|
|
287
287
|
const { iconActive, prevIconActive } = this.state;
|
|
288
288
|
|
|
289
|
-
if (iconActive ===
|
|
290
|
-
this.props.setTableAction(
|
|
289
|
+
if (iconActive === "filter") {
|
|
290
|
+
this.props.setTableAction("onFilterDialogOpen");
|
|
291
291
|
if (this.props.options.onFilterDialogOpen) {
|
|
292
292
|
this.props.options.onFilterDialogOpen();
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
if (iconActive === undefined && prevIconActive ===
|
|
296
|
-
this.props.setTableAction(
|
|
295
|
+
if (iconActive === undefined && prevIconActive === "filter") {
|
|
296
|
+
this.props.setTableAction("onFilterDialogClose");
|
|
297
297
|
if (this.props.options.onFilterDialogClose) {
|
|
298
298
|
this.props.options.onFilterDialogClose();
|
|
299
299
|
}
|
|
@@ -313,11 +313,11 @@ class TableToolbar extends React.Component {
|
|
|
313
313
|
nextVal = true;
|
|
314
314
|
} else {
|
|
315
315
|
const { onSearchClose } = this.props.options;
|
|
316
|
-
this.props.setTableAction(
|
|
316
|
+
this.props.setTableAction("onSearchClose");
|
|
317
317
|
if (onSearchClose) onSearchClose();
|
|
318
318
|
nextVal = false;
|
|
319
319
|
}
|
|
320
|
-
} else if (iconName ===
|
|
320
|
+
} else if (iconName === "search") {
|
|
321
321
|
nextVal = this.showSearch();
|
|
322
322
|
}
|
|
323
323
|
return nextVal;
|
|
@@ -325,7 +325,7 @@ class TableToolbar extends React.Component {
|
|
|
325
325
|
|
|
326
326
|
getActiveIcon = (styles, iconName) => {
|
|
327
327
|
let isActive = this.state.iconActive === iconName;
|
|
328
|
-
if (iconName ===
|
|
328
|
+
if (iconName === "search") {
|
|
329
329
|
const { showSearch, searchText } = this.state;
|
|
330
330
|
isActive = isActive || showSearch || searchText;
|
|
331
331
|
}
|
|
@@ -333,7 +333,7 @@ class TableToolbar extends React.Component {
|
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
showSearch = () => {
|
|
336
|
-
this.props.setTableAction(
|
|
336
|
+
this.props.setTableAction("onSearchOpen");
|
|
337
337
|
!!this.props.options.onSearchOpen && this.props.options.onSearchOpen();
|
|
338
338
|
return true;
|
|
339
339
|
};
|
|
@@ -341,7 +341,7 @@ class TableToolbar extends React.Component {
|
|
|
341
341
|
hideSearch = () => {
|
|
342
342
|
const { onSearchClose } = this.props.options;
|
|
343
343
|
|
|
344
|
-
this.props.setTableAction(
|
|
344
|
+
this.props.setTableAction("onSearchClose");
|
|
345
345
|
if (onSearchClose) onSearchClose();
|
|
346
346
|
this.props.searchClose();
|
|
347
347
|
|
|
@@ -362,7 +362,7 @@ class TableToolbar extends React.Component {
|
|
|
362
362
|
if (showSearch && !searchText) {
|
|
363
363
|
this.hideSearch();
|
|
364
364
|
} else {
|
|
365
|
-
this.setActiveIcon(
|
|
365
|
+
this.setActiveIcon("search");
|
|
366
366
|
}
|
|
367
367
|
};
|
|
368
368
|
|
|
@@ -375,11 +375,11 @@ class TableToolbar extends React.Component {
|
|
|
375
375
|
scale: 2,
|
|
376
376
|
useCORS: true,
|
|
377
377
|
allowTaint: true,
|
|
378
|
-
backgroundColor:
|
|
378
|
+
backgroundColor: "#ffffff",
|
|
379
379
|
});
|
|
380
380
|
|
|
381
|
-
const imgData = canvas.toDataURL(
|
|
382
|
-
const pdf = new jsPDF(
|
|
381
|
+
const imgData = canvas.toDataURL("image/png");
|
|
382
|
+
const pdf = new jsPDF("p", "mm", "a4");
|
|
383
383
|
const imgWidth = 210;
|
|
384
384
|
const pageHeight = 295;
|
|
385
385
|
const imgHeight = (canvas.height * imgWidth) / canvas.width;
|
|
@@ -387,19 +387,19 @@ class TableToolbar extends React.Component {
|
|
|
387
387
|
|
|
388
388
|
let position = 0;
|
|
389
389
|
|
|
390
|
-
pdf.addImage(imgData,
|
|
390
|
+
pdf.addImage(imgData, "PNG", 0, position, imgWidth, imgHeight);
|
|
391
391
|
heightLeft -= pageHeight;
|
|
392
392
|
|
|
393
393
|
while (heightLeft >= 0) {
|
|
394
394
|
position = heightLeft - imgHeight;
|
|
395
395
|
pdf.addPage();
|
|
396
|
-
pdf.addImage(imgData,
|
|
396
|
+
pdf.addImage(imgData, "PNG", 0, position, imgWidth, imgHeight);
|
|
397
397
|
heightLeft -= pageHeight;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
pdf.save(
|
|
400
|
+
pdf.save("table-export.pdf");
|
|
401
401
|
} catch (error) {
|
|
402
|
-
console.error(
|
|
402
|
+
console.error("Print error:", error);
|
|
403
403
|
}
|
|
404
404
|
};
|
|
405
405
|
|
|
@@ -444,8 +444,9 @@ class TableToolbar extends React.Component {
|
|
|
444
444
|
return (
|
|
445
445
|
<Toolbar
|
|
446
446
|
className={options.responsive !== RESPONSIVE_FULL_WIDTH_NAME ? classes.root : classes.fullWidthRoot}
|
|
447
|
-
role={
|
|
448
|
-
aria-label={
|
|
447
|
+
role={"toolbar"}
|
|
448
|
+
aria-label={"Table Toolbar"}
|
|
449
|
+
>
|
|
449
450
|
<div className={options.responsive !== RESPONSIVE_FULL_WIDTH_NAME ? classes.left : classes.fullWidthLeft}>
|
|
450
451
|
{showSearch === true ? (
|
|
451
452
|
options.customSearchRender ? (
|
|
@@ -458,43 +459,46 @@ class TableToolbar extends React.Component {
|
|
|
458
459
|
options={options}
|
|
459
460
|
/>
|
|
460
461
|
)
|
|
461
|
-
) : typeof title !==
|
|
462
|
+
) : typeof title !== "string" ? (
|
|
462
463
|
title
|
|
463
464
|
) : (
|
|
464
|
-
<div className={classes.titleRoot} aria-hidden={
|
|
465
|
+
<div className={classes.titleRoot} aria-hidden={"true"}>
|
|
465
466
|
<Typography
|
|
466
467
|
variant="h6"
|
|
467
468
|
className={
|
|
468
469
|
options.responsive !== RESPONSIVE_FULL_WIDTH_NAME ? classes.titleText : classes.fullWidthTitleText
|
|
469
|
-
}
|
|
470
|
+
}
|
|
471
|
+
>
|
|
470
472
|
{title}
|
|
471
473
|
</Typography>
|
|
472
474
|
</div>
|
|
473
475
|
)}
|
|
474
476
|
</div>
|
|
475
477
|
<div className={options.responsive !== RESPONSIVE_FULL_WIDTH_NAME ? classes.actions : classes.fullWidthActions}>
|
|
476
|
-
{!(options.search === false || options.search ===
|
|
478
|
+
{!(options.search === false || options.search === "false" || options.searchAlwaysOpen === true) && (
|
|
477
479
|
<Tooltip title={search} disableFocusListener>
|
|
478
480
|
<IconButton
|
|
479
481
|
aria-label={search}
|
|
480
|
-
data-testid={search +
|
|
482
|
+
data-testid={search + "-iconButton"}
|
|
481
483
|
ref={(el) => (this.searchButton = el)}
|
|
482
|
-
classes={{ root: this.getActiveIcon(classes,
|
|
483
|
-
disabled={options.search ===
|
|
484
|
-
onClick={this.handleSearchIconClick}
|
|
484
|
+
classes={{ root: this.getActiveIcon(classes, "search") }}
|
|
485
|
+
disabled={options.search === "disabled"}
|
|
486
|
+
onClick={this.handleSearchIconClick}
|
|
487
|
+
>
|
|
485
488
|
<SearchIconComponent />
|
|
486
489
|
</IconButton>
|
|
487
490
|
</Tooltip>
|
|
488
491
|
)}
|
|
489
|
-
{!(options.download === false || options.download ===
|
|
492
|
+
{!(options.download === false || options.download === "false") && (
|
|
490
493
|
<>
|
|
491
494
|
<Tooltip title="Export Options" disableFocusListener>
|
|
492
495
|
<IconButton
|
|
493
496
|
data-testid="export-menu-iconButton"
|
|
494
497
|
aria-label="Export Options"
|
|
495
498
|
classes={{ root: classes.icon }}
|
|
496
|
-
disabled={options.download ===
|
|
497
|
-
onClick={this.handleExportMenuOpen}
|
|
499
|
+
disabled={options.download === "disabled"}
|
|
500
|
+
onClick={this.handleExportMenuOpen}
|
|
501
|
+
>
|
|
498
502
|
<FileDownloadIcon />
|
|
499
503
|
</IconButton>
|
|
500
504
|
</Tooltip>
|
|
@@ -504,13 +508,14 @@ class TableToolbar extends React.Component {
|
|
|
504
508
|
onClose={this.handleExportMenuClose}
|
|
505
509
|
classes={{ paper: classes.exportMenu }}
|
|
506
510
|
anchorOrigin={{
|
|
507
|
-
vertical:
|
|
508
|
-
horizontal:
|
|
511
|
+
vertical: "bottom",
|
|
512
|
+
horizontal: "right",
|
|
509
513
|
}}
|
|
510
514
|
transformOrigin={{
|
|
511
|
-
vertical:
|
|
512
|
-
horizontal:
|
|
513
|
-
}}
|
|
515
|
+
vertical: "top",
|
|
516
|
+
horizontal: "right",
|
|
517
|
+
}}
|
|
518
|
+
>
|
|
514
519
|
<MenuItem onClick={this.exportToCSV} className={classes.exportMenuItem}>
|
|
515
520
|
<ListItemIcon>
|
|
516
521
|
<TableChartIcon fontSize="small" />
|
|
@@ -530,7 +535,7 @@ class TableToolbar extends React.Component {
|
|
|
530
535
|
<ListItemText>Export to PDF</ListItemText>
|
|
531
536
|
</MenuItem>
|
|
532
537
|
{this.props.options?.onExport && (
|
|
533
|
-
<MenuItem onClick={() => this.handleCustomExport(
|
|
538
|
+
<MenuItem onClick={() => this.handleCustomExport("custom")} className={classes.exportMenuItem}>
|
|
534
539
|
<ListItemIcon>
|
|
535
540
|
<FileDownloadIcon fontSize="small" />
|
|
536
541
|
</ListItemIcon>
|
|
@@ -540,34 +545,36 @@ class TableToolbar extends React.Component {
|
|
|
540
545
|
</Menu>
|
|
541
546
|
</>
|
|
542
547
|
)}
|
|
543
|
-
{!(options.print === false || options.print ===
|
|
548
|
+
{!(options.print === false || options.print === "false") && (
|
|
544
549
|
<Tooltip title={print}>
|
|
545
550
|
<span>
|
|
546
551
|
<IconButton
|
|
547
|
-
data-testid={print +
|
|
552
|
+
data-testid={print + "-iconButton"}
|
|
548
553
|
aria-label={print}
|
|
549
|
-
disabled={options.print ===
|
|
554
|
+
disabled={options.print === "disabled"}
|
|
550
555
|
onClick={this.handlePrint}
|
|
551
|
-
classes={{ root: classes.icon }}
|
|
556
|
+
classes={{ root: classes.icon }}
|
|
557
|
+
>
|
|
552
558
|
<PrintIconComponent />
|
|
553
559
|
</IconButton>
|
|
554
560
|
</span>
|
|
555
561
|
</Tooltip>
|
|
556
562
|
)}
|
|
557
|
-
{!(options.viewColumns === false || options.viewColumns ===
|
|
563
|
+
{!(options.viewColumns === false || options.viewColumns === "false") && (
|
|
558
564
|
<Popover
|
|
559
565
|
refExit={this.setActiveIcon.bind(null)}
|
|
560
566
|
classes={{ closeIcon: classes.filterCloseIcon }}
|
|
561
|
-
hide={options.viewColumns ===
|
|
567
|
+
hide={options.viewColumns === "disabled"}
|
|
562
568
|
trigger={
|
|
563
569
|
<Tooltip title={viewColumns} disableFocusListener>
|
|
564
570
|
<span>
|
|
565
571
|
<IconButton
|
|
566
|
-
data-testid={viewColumns +
|
|
572
|
+
data-testid={viewColumns + "-iconButton"}
|
|
567
573
|
aria-label={viewColumns}
|
|
568
|
-
classes={{ root: this.getActiveIcon(classes,
|
|
569
|
-
disabled={options.viewColumns ===
|
|
570
|
-
onClick={this.setActiveIcon.bind(null,
|
|
574
|
+
classes={{ root: this.getActiveIcon(classes, "viewcolumns") }}
|
|
575
|
+
disabled={options.viewColumns === "disabled"}
|
|
576
|
+
onClick={this.setActiveIcon.bind(null, "viewcolumns")}
|
|
577
|
+
>
|
|
571
578
|
<ViewColumnIconComponent />
|
|
572
579
|
</IconButton>
|
|
573
580
|
</span>
|
|
@@ -585,20 +592,21 @@ class TableToolbar extends React.Component {
|
|
|
585
592
|
}
|
|
586
593
|
/>
|
|
587
594
|
)}
|
|
588
|
-
{!(options.filter === false || options.filter ===
|
|
595
|
+
{!(options.filter === false || options.filter === "false") && (
|
|
589
596
|
<Popover
|
|
590
597
|
refExit={filterPopoverExit}
|
|
591
|
-
hide={this.state.hideFilterPopover || options.filter ===
|
|
598
|
+
hide={this.state.hideFilterPopover || options.filter === "disabled"}
|
|
592
599
|
classes={{ paper: classes.filterPaper, closeIcon: classes.filterCloseIcon }}
|
|
593
600
|
trigger={
|
|
594
601
|
<Tooltip title={filterTable} disableFocusListener>
|
|
595
602
|
<span>
|
|
596
603
|
<IconButton
|
|
597
|
-
data-testid={filterTable +
|
|
604
|
+
data-testid={filterTable + "-iconButton"}
|
|
598
605
|
aria-label={filterTable}
|
|
599
|
-
classes={{ root: this.getActiveIcon(classes,
|
|
600
|
-
disabled={options.filter ===
|
|
601
|
-
onClick={this.setActiveIcon.bind(null,
|
|
606
|
+
classes={{ root: this.getActiveIcon(classes, "filter") }}
|
|
607
|
+
disabled={options.filter === "disabled"}
|
|
608
|
+
onClick={this.setActiveIcon.bind(null, "filter")}
|
|
609
|
+
>
|
|
602
610
|
<FilterIconComponent />
|
|
603
611
|
</IconButton>
|
|
604
612
|
</span>
|
|
@@ -627,4 +635,4 @@ class TableToolbar extends React.Component {
|
|
|
627
635
|
}
|
|
628
636
|
}
|
|
629
637
|
|
|
630
|
-
export default withStyles(TableToolbar, defaultToolbarStyles, { name:
|
|
638
|
+
export default withStyles(TableToolbar, defaultToolbarStyles, { name: "MUIDataTableToolbar" });
|