);
- }
- }
+ },
+ },
},
- "Location"
+ 'Location',
];
const data = [
- ["Gabby George ", "Business Analyst", "Minneapolis"],
- ["Aiden Lloyd", "Business Consultant at Tony's Burger Palace and CEO of Johnny's Blueberry Sundaes", "Dallas"],
- ["Jaden Collins", "Attorney", "Santa Ana"],
- ["Franky Rees", "Business Analyst", "St. Petersburg"],
- ["Aaren Rose", null, "Toledo"]
+ ['Gabby George ', 'Business Analyst', 'Minneapolis'],
+ ['Aiden Lloyd', "Business Consultant at Tony's Burger Palace and CEO of Johnny's Blueberry Sundaes", 'Dallas'],
+ ['Jaden Collins', 'Attorney', 'Santa Ana'],
+ ['Franky Rees', 'Business Analyst', 'St. Petersburg'],
+ ['Aaren Rose', null, 'Toledo'],
];
const options = {
@@ -85,20 +82,25 @@ function Example(props) {
selectableRows: selectableRows,
draggableColumns: {
enabled: true,
- }
+ },
};
return (
<>
-
+
>
);
diff --git a/examples/selectable-rows/index.js b/examples/selectable-rows/index.js
index 6041c67b5..b72940ff6 100644
--- a/examples/selectable-rows/index.js
+++ b/examples/selectable-rows/index.js
@@ -1,41 +1,40 @@
-import React from "react";
-import ReactDOM from "react-dom";
-import MUIDataTable from "../../src/";
+import React from 'react';
+import MUIDataTable from '../../src/';
import Switch from '@mui/material/Switch';
import FormGroup from '@mui/material/FormGroup';
import FormControlLabel from '@mui/material/FormControlLabel';
const data = [
- ["Gabby George", "Business Analyst", "Minneapolis", 30, 100000],
- ["Aiden Lloyd", "Business Consultant", "Dallas", 55, 200000],
- ["Jaden Collins", "Attorney", "Santa Ana", 27, 500000],
- ["Franky Rees", "Business Analyst", "St. Petersburg", 22, 50000],
- ["Aaren Rose", "Business Consultant", "Toledo", 28, 75000],
- ["Blake Duncan", "Business Management Analyst", "San Diego", 65, 94000],
- ["Frankie Parry", "Agency Legal Counsel", "Jacksonville", 71, 210000],
- ["Lane Wilson", "Commercial Specialist", "Omaha", 19, 65000],
- ["Robin Duncan", "Business Analyst", "Los Angeles", 20, 77000],
- ["Mel Brooks", "Business Consultant", "Oklahoma City", 37, 135000],
- ["Harper White", "Attorney", "Pittsburgh", 52, 420000],
- ["Kris Humphrey", "Agency Legal Counsel", "Laredo", 30, 150000],
- ["Frankie Long", "Industrial Analyst", "Austin", 31, 170000],
- ["Brynn Robbins", "Business Analyst", "Norfolk", 22, 90000],
- ["Justice Mann", "Business Consultant", "Chicago", 24, 133000],
- ["Addison Navarro", "Business Management Analyst", "New York", 50, 295000],
- ["Jesse Welch", "Agency Legal Counsel", "Seattle", 28, 200000],
- ["Eli Mejia", "Commercial Specialist", "Long Beach", 65, 400000],
- ["Gene Leblanc", "Industrial Analyst", "Hartford", 34, 110000],
- ["Danny Leon", "Computer Scientist", "Newark", 60, 220000],
- ["Lane Lee", "Corporate Counselor", "Cincinnati", 52, 180000],
- ["Jesse Hall", "Business Analyst", "Baltimore", 44, 99000],
- ["Danni Hudson", "Agency Legal Counsel", "Tampa", 37, 90000],
- ["Terry Macdonald", "Commercial Specialist", "Miami", 39, 140000],
- ["Justice Mccarthy", "Attorney", "Tucson", 26, 330000],
- ["Silver Carey", "Computer Scientist", "Memphis", 47, 250000],
- ["Franky Miles", "Industrial Analyst", "Buffalo", 49, 190000],
- ["Glen Nixon", "Corporate Counselor", "Arlington", 44, 80000],
- ["Gabby Strickland", "Business Process Consultant", "Scottsdale", 26, 45000],
- ["Mason Ray", "Computer Scientist", "San Francisco", 39, 142000]
+ ['Gabby George', 'Business Analyst', 'Minneapolis', 30, 100000],
+ ['Aiden Lloyd', 'Business Consultant', 'Dallas', 55, 200000],
+ ['Jaden Collins', 'Attorney', 'Santa Ana', 27, 500000],
+ ['Franky Rees', 'Business Analyst', 'St. Petersburg', 22, 50000],
+ ['Aaren Rose', 'Business Consultant', 'Toledo', 28, 75000],
+ ['Blake Duncan', 'Business Management Analyst', 'San Diego', 65, 94000],
+ ['Frankie Parry', 'Agency Legal Counsel', 'Jacksonville', 71, 210000],
+ ['Lane Wilson', 'Commercial Specialist', 'Omaha', 19, 65000],
+ ['Robin Duncan', 'Business Analyst', 'Los Angeles', 20, 77000],
+ ['Mel Brooks', 'Business Consultant', 'Oklahoma City', 37, 135000],
+ ['Harper White', 'Attorney', 'Pittsburgh', 52, 420000],
+ ['Kris Humphrey', 'Agency Legal Counsel', 'Laredo', 30, 150000],
+ ['Frankie Long', 'Industrial Analyst', 'Austin', 31, 170000],
+ ['Brynn Robbins', 'Business Analyst', 'Norfolk', 22, 90000],
+ ['Justice Mann', 'Business Consultant', 'Chicago', 24, 133000],
+ ['Addison Navarro', 'Business Management Analyst', 'New York', 50, 295000],
+ ['Jesse Welch', 'Agency Legal Counsel', 'Seattle', 28, 200000],
+ ['Eli Mejia', 'Commercial Specialist', 'Long Beach', 65, 400000],
+ ['Gene Leblanc', 'Industrial Analyst', 'Hartford', 34, 110000],
+ ['Danny Leon', 'Computer Scientist', 'Newark', 60, 220000],
+ ['Lane Lee', 'Corporate Counselor', 'Cincinnati', 52, 180000],
+ ['Jesse Hall', 'Business Analyst', 'Baltimore', 44, 99000],
+ ['Danni Hudson', 'Agency Legal Counsel', 'Tampa', 37, 90000],
+ ['Terry Macdonald', 'Commercial Specialist', 'Miami', 39, 140000],
+ ['Justice Mccarthy', 'Attorney', 'Tucson', 26, 330000],
+ ['Silver Carey', 'Computer Scientist', 'Memphis', 47, 250000],
+ ['Franky Miles', 'Industrial Analyst', 'Buffalo', 49, 190000],
+ ['Glen Nixon', 'Corporate Counselor', 'Arlington', 44, 80000],
+ ['Gabby Strickland', 'Business Process Consultant', 'Scottsdale', 26, 45000],
+ ['Mason Ray', 'Computer Scientist', 'San Francisco', 39, 142000],
];
class Example extends React.Component {
@@ -44,27 +43,20 @@ class Example extends React.Component {
data: data,
};
- updateSelectableRowsHideCheckboxes = (event) => {
+ updateSelectableRowsHideCheckboxes = event => {
this.setState({
- selectableRowsHideCheckboxes: event.target.checked
+ selectableRowsHideCheckboxes: event.target.checked,
});
- }
+ };
render() {
-
- const columns = [
- "Name",
- "Title",
- "Location",
- "Age",
- { name: "Salary", options: { hint: "USD / year"}}
- ];
+ const columns = ['Name', 'Title', 'Location', 'Age', { name: 'Salary', options: { hint: 'USD / year' } }];
const options = {
textLabels: {
body: {
noMatch: '',
- }
+ },
},
filter: true,
selectableRows: 'multiple',
@@ -83,19 +75,19 @@ class Example extends React.Component {
console.dir(rowsDeleted);
console.dir(newData);
if (rowsDeleted && rowsDeleted.data && rowsDeleted.data[0] && rowsDeleted.data[0].dataIndex === 0) {
- window.alert('Can\'t delete this!');
+ window.alert("Can't delete this!");
return false;
- };
- this.setState({
+ }
+ this.setState({
data: newData,
- rowsSelected: []
+ rowsSelected: [],
});
- console.log(rowsDeleted, "were deleted!");
+ console.log(rowsDeleted, 'were deleted!');
},
- onChangePage: (numberRows) => {
+ onChangePage: numberRows => {
console.log(numberRows);
},
- onSearchChange: (searchText) => {
+ onSearchChange: searchText => {
console.log(searchText);
},
onColumnSortChange: (column, direction) => {
@@ -115,11 +107,12 @@ class Example extends React.Component {
},
isRowSelectable: (dataIndex, selectedRows) => {
//prevents selection of any additional row after the third
- if (selectedRows.data.length > 2 && selectedRows.data.filter(d => d.dataIndex === dataIndex).length === 0) return false;
+ if (selectedRows.data.length > 2 && selectedRows.data.filter(d => d.dataIndex === dataIndex).length === 0)
+ return false;
//prevents selection of row with title "Attorney"
- return data[dataIndex][1] != "Attorney";
+ return data[dataIndex][1] != 'Attorney';
},
- selectableRowsHeader: false
+ selectableRowsHeader: false,
};
return (
@@ -138,10 +131,9 @@ class Example extends React.Component {
label="Hide Checkboxes"
/>
-
+
>
);
-
}
}
diff --git a/examples/serverside-filters/index.js b/examples/serverside-filters/index.js
index 3e8e7819a..f2421f569 100644
--- a/examples/serverside-filters/index.js
+++ b/examples/serverside-filters/index.js
@@ -1,6 +1,5 @@
import { Button, CircularProgress } from '@mui/material';
import React from 'react';
-import ReactDOM from 'react-dom';
import MUIDataTable from '../../src';
const theData = [
@@ -39,45 +38,41 @@ const theData = [
class Example extends React.Component {
state = {
isLoading: false,
- data: theData
+ data: theData,
};
// mock async function
xhrRequest = (url, filterList) => {
return new Promise(resolve => {
- window.setTimeout(
- () => {
- const data = theData;
+ window.setTimeout(() => {
+ const data = theData;
- if (
- filterList.reduce( (accu, cur) => accu + cur.length, 0) === 0
- ) {
- resolve({ data });
- } else {
-
- /*
+ if (filterList.reduce((accu, cur) => accu + cur.length, 0) === 0) {
+ resolve({ data });
+ } else {
+ /*
This code simulates filtering that would occur on the back-end
*/
- var filteredData = data.filter(row => {
- var ret = true;
-
- for (var ii = 0; ii <= 4; ii++) {
- if (filterList[ii] && filterList[ii].length) {
- ret = ret && filterList[ii].filter(ff => {
+ var filteredData = data.filter(row => {
+ var ret = true;
+
+ for (var ii = 0; ii <= 4; ii++) {
+ if (filterList[ii] && filterList[ii].length) {
+ ret =
+ ret &&
+ filterList[ii].filter(ff => {
return row[ii] == ff;
}).length > 0;
- }
}
- return ret;
- });
+ }
+ return ret;
+ });
- resolve({ data: filteredData });
- }
- },
- 2000
- );
+ resolve({ data: filteredData });
+ }
+ }, 2000);
});
- }
+ };
handleFilterSubmit = applyFilters => {
let filterList = applyFilters();
@@ -133,21 +128,23 @@ class Example extends React.Component {
rowsPerPage: 50,
rowsPerPageOptions: [50],
- // makes it so filters have to be "confirmed" before being applied to the
+ // makes it so filters have to be "confirmed" before being applied to the
// table's internal filterList
- confirmFilters: true,
+ confirmFilters: true,
- // Calling the applyNewFilters parameter applies the selected filters to the table
+ // Calling the applyNewFilters parameter applies the selected filters to the table
customFilterDialogFooter: (currentFilterList, applyNewFilters) => {
return (
-
+
);
},
// callback that gets executed when filters are confirmed
- onFilterConfirm: (filterList) => {
+ onFilterConfirm: filterList => {
console.log('onFilterConfirm');
console.dir(filterList);
},
@@ -160,7 +157,7 @@ class Example extends React.Component {
},
onFilterChange: (column, filterList, type) => {
if (type === 'chip') {
- var newFilters = () => (filterList);
+ var newFilters = () => filterList;
console.log('updating filters via chip');
this.handleFilterSubmit(newFilters);
}
diff --git a/examples/serverside-sorting/cities.js b/examples/serverside-sorting/cities.js
index 0de7fbfaa..c6110094e 100644
--- a/examples/serverside-sorting/cities.js
+++ b/examples/serverside-sorting/cities.js
@@ -398,6 +398,7 @@ class Cities extends React.Component {
'Yakima',
'Yonkers',
'York',
+
'Youngstown',
];
diff --git a/examples/serverside-sorting/index.js b/examples/serverside-sorting/index.js
index 807132f56..b5dd34de6 100644
--- a/examples/serverside-sorting/index.js
+++ b/examples/serverside-sorting/index.js
@@ -1,5 +1,4 @@
import React from 'react';
-import ReactDOM from 'react-dom';
import MUIDataTable from '../../src';
import { CircularProgress, Typography } from '@mui/material';
import Cities from './cities';
@@ -76,8 +75,8 @@ class Example extends React.Component {
if (order === 'asc') {
var tempData = srcData.sort((a, b) => {
- if ( a[sortCol] < b[sortCol] ) return -1;
- if ( a[sortCol] > b[sortCol] ) return 1;
+ if (a[sortCol] < b[sortCol]) return -1;
+ if (a[sortCol] > b[sortCol]) return 1;
return 0;
});
@@ -87,8 +86,8 @@ class Example extends React.Component {
: tempData.slice(offset, offset + 10);
} else {
tempData = srcData.sort((a, b) => {
- if ( a[sortCol] < b[sortCol] ) return 1;
- if ( a[sortCol] > b[sortCol] ) return -1;
+ if (a[sortCol] < b[sortCol]) return 1;
+ if (a[sortCol] > b[sortCol]) return -1;
return 0;
});
@@ -97,7 +96,6 @@ class Example extends React.Component {
? tempData.slice(offset, srcData.length)
: tempData.slice(offset, offset + 10);
}
-
} else {
data =
offset + 10 >= srcData.length ? srcData.slice(offset, srcData.length) : srcData.slice(offset, offset + 10);
@@ -120,8 +118,8 @@ class Example extends React.Component {
data,
sortOrder: {
name: column,
- direction: order
- }
+ direction: order,
+ },
});
});
};
@@ -133,7 +131,7 @@ class Example extends React.Component {
options: {
customFilterListOptions: {
render: v => `Name: ${v}`,
- }
+ },
},
},
{
@@ -141,7 +139,7 @@ class Example extends React.Component {
options: {
customFilterListOptions: {
render: v => `Title: ${v}`,
- }
+ },
},
},
{
@@ -179,11 +177,11 @@ class Example extends React.Component {
this.sort(changedColumn, order);
},
- onChangePage: (page) => {
- this.setState({page}, () => {
+ onChangePage: page => {
+ this.setState({ page }, () => {
this.sort(this.state.sortOrder.name, this.state.sortOrder.direction);
});
- }
+ },
};
return (
diff --git a/examples/simple-no-toolbar/index.js b/examples/simple-no-toolbar/index.js
index ddadc0314..f7768075a 100644
--- a/examples/simple-no-toolbar/index.js
+++ b/examples/simple-no-toolbar/index.js
@@ -1,17 +1,16 @@
-import React from "react";
-import ReactDOM from "react-dom";
-import MUIDataTable from "../../src/";
+import React from 'react';
+import MUIDataTable from '../../src/';
class Example extends React.Component {
render() {
- const columns = ["Name", "Title", "Location"];
+ const columns = ['Name', 'Title', 'Location'];
const data = [
- ["Gabby George", "Business Analyst", "Minneapolis"],
- ["Aiden Lloyd", "Business Consultant", "Dallas"],
- ["Jaden Collins", "Attorney", "Santa Ana"],
- ["Franky Rees", "Business Analyst", "St. Petersburg"],
- ["Aaren Rose", null, "Toledo"]
+ ['Gabby George', 'Business Analyst', 'Minneapolis'],
+ ['Aiden Lloyd', 'Business Consultant', 'Dallas'],
+ ['Jaden Collins', 'Attorney', 'Santa Ana'],
+ ['Franky Rees', 'Business Analyst', 'St. Petersburg'],
+ ['Aaren Rose', null, 'Toledo'],
];
const options = {
@@ -21,12 +20,10 @@ class Example extends React.Component {
download: false,
viewColumns: false,
customToolbar: null,
- responsive: 'vertical'
+ responsive: 'vertical',
};
- return (
-
- );
+ return
;
}
}
diff --git a/examples/text-localization/index.js b/examples/text-localization/index.js
index 9da848a01..fcf87b8ba 100644
--- a/examples/text-localization/index.js
+++ b/examples/text-localization/index.js
@@ -1,44 +1,41 @@
-import React from "react";
-import ReactDOM from "react-dom";
-import MUIDataTable from "../../src/";
+import React from 'react';
+import MUIDataTable from '../../src/';
class Example extends React.Component {
-
render() {
-
- const columns = ["Name", "Title", "Location", "Age", "Salary"];
+ const columns = ['Name', 'Title', 'Location', 'Age', 'Salary'];
const data = [
- ["Gabby George", "Business Analyst", "Minneapolis", 30, "$100,000"],
- ["Aiden Lloyd", "Business Consultant", "Dallas", 55, "$200,000"],
- ["Jaden Collins", "Attorney", "Santa Ana", 27, "$500,000"],
- ["Franky Rees", "Business Analyst", "St. Petersburg", 22, "$50,000"],
- ["Aaren Rose", "Business Consultant", "Toledo", 28, "$75,000"],
- ["Blake Duncan", "Business Management Analyst", "San Diego", 65, "$94,000"],
- ["Frankie Parry", "Agency Legal Counsel", "Jacksonville", 71, "$210,000"],
- ["Lane Wilson", "Commercial Specialist", "Omaha", 19, "$65,000"],
- ["Robin Duncan", "Business Analyst", "Los Angeles", 20, "$77,000"],
- ["Mel Brooks", "Business Consultant", "Oklahoma City", 37, "$135,000"],
- ["Harper White", "Attorney", "Pittsburgh", 52, "$420,000"],
- ["Kris Humphrey", "Agency Legal Counsel", "Laredo", 30, "$150,000"],
- ["Frankie Long", "Industrial Analyst", "Austin", 31, "$170,000"],
- ["Brynn Robbins", "Business Analyst", "Norfolk", 22, "$90,000"],
- ["Justice Mann", "Business Consultant", "Chicago", 24, "$133,000"],
- ["Addison Navarro", "Business Management Analyst", "New York", 50, "$295,000"],
- ["Jesse Welch", "Agency Legal Counsel", "Seattle", 28, "$200,000"],
- ["Eli Mejia", "Commercial Specialist", "Long Beach", 65, "$400,000"],
- ["Gene Leblanc", "Industrial Analyst", "Hartford", 34, "$110,000"],
- ["Danny Leon", "Computer Scientist", "Newark", 60, "$220,000"],
- ["Lane Lee", "Corporate Counselor", "Cincinnati", 52, "$180,000"],
- ["Jesse Hall", "Business Analyst", "Baltimore", 44, "$99,000"],
- ["Danni Hudson", "Agency Legal Counsel", "Tampa", 37, "$90,000"],
- ["Terry Macdonald", "Commercial Specialist", "Miami", 39, "$140,000"],
- ["Justice Mccarthy", "Attorney", "Tucson", 26, "$330,000"],
- ["Silver Carey", "Computer Scientist", "Memphis", 47, "$250,000" ],
- ["Franky Miles", "Industrial Analyst", "Buffalo", 49, "$190,000"],
- ["Glen Nixon", "Corporate Counselor", "Arlington", 44, "$80,000"],
- ["Gabby Strickland", "Business Process Consultant", "Scottsdale", 26, "$45,000"],
- ["Mason Ray", "Computer Scientist", "San Francisco", 39, "$142,000"]
+ ['Gabby George', 'Business Analyst', 'Minneapolis', 30, '$100,000'],
+ ['Aiden Lloyd', 'Business Consultant', 'Dallas', 55, '$200,000'],
+ ['Jaden Collins', 'Attorney', 'Santa Ana', 27, '$500,000'],
+ ['Franky Rees', 'Business Analyst', 'St. Petersburg', 22, '$50,000'],
+ ['Aaren Rose', 'Business Consultant', 'Toledo', 28, '$75,000'],
+ ['Blake Duncan', 'Business Management Analyst', 'San Diego', 65, '$94,000'],
+ ['Frankie Parry', 'Agency Legal Counsel', 'Jacksonville', 71, '$210,000'],
+ ['Lane Wilson', 'Commercial Specialist', 'Omaha', 19, '$65,000'],
+ ['Robin Duncan', 'Business Analyst', 'Los Angeles', 20, '$77,000'],
+ ['Mel Brooks', 'Business Consultant', 'Oklahoma City', 37, '$135,000'],
+ ['Harper White', 'Attorney', 'Pittsburgh', 52, '$420,000'],
+ ['Kris Humphrey', 'Agency Legal Counsel', 'Laredo', 30, '$150,000'],
+ ['Frankie Long', 'Industrial Analyst', 'Austin', 31, '$170,000'],
+ ['Brynn Robbins', 'Business Analyst', 'Norfolk', 22, '$90,000'],
+ ['Justice Mann', 'Business Consultant', 'Chicago', 24, '$133,000'],
+ ['Addison Navarro', 'Business Management Analyst', 'New York', 50, '$295,000'],
+ ['Jesse Welch', 'Agency Legal Counsel', 'Seattle', 28, '$200,000'],
+ ['Eli Mejia', 'Commercial Specialist', 'Long Beach', 65, '$400,000'],
+ ['Gene Leblanc', 'Industrial Analyst', 'Hartford', 34, '$110,000'],
+ ['Danny Leon', 'Computer Scientist', 'Newark', 60, '$220,000'],
+ ['Lane Lee', 'Corporate Counselor', 'Cincinnati', 52, '$180,000'],
+ ['Jesse Hall', 'Business Analyst', 'Baltimore', 44, '$99,000'],
+ ['Danni Hudson', 'Agency Legal Counsel', 'Tampa', 37, '$90,000'],
+ ['Terry Macdonald', 'Commercial Specialist', 'Miami', 39, '$140,000'],
+ ['Justice Mccarthy', 'Attorney', 'Tucson', 26, '$330,000'],
+ ['Silver Carey', 'Computer Scientist', 'Memphis', 47, '$250,000'],
+ ['Franky Miles', 'Industrial Analyst', 'Buffalo', 49, '$190,000'],
+ ['Glen Nixon', 'Corporate Counselor', 'Arlington', 44, '$80,000'],
+ ['Gabby Strickland', 'Business Process Consultant', 'Scottsdale', 26, '$45,000'],
+ ['Mason Ray', 'Computer Scientist', 'San Francisco', 39, '$142,000'],
];
const options = {
@@ -47,29 +44,26 @@ class Example extends React.Component {
responsive: 'vertical',
textLabels: {
body: {
- noMatch: "Sorry we could not find any records!",
+ noMatch: 'Sorry we could not find any records!',
},
- pagination:{
- next: "Following page",
- previous: "Preceding page"
+ pagination: {
+ next: 'Following page',
+ previous: 'Preceding page',
},
filter: {
- all: "All Records",
- title: "OUR FILTERS",
- reset: "PERFORM RESET",
+ all: 'All Records',
+ title: 'OUR FILTERS',
+ reset: 'PERFORM RESET',
},
selectedRows: {
- text: "rows has been deleted",
- delete: "Delete Row",
- deleteAria: "Deleted Selected Rows"
+ text: 'rows has been deleted',
+ delete: 'Delete Row',
+ deleteAria: 'Deleted Selected Rows',
},
- }
+ },
};
- return (
-
- );
-
+ return
;
}
}
diff --git a/package.json b/package.json
index 361215c7f..78dd51e2c 100644
--- a/package.json
+++ b/package.json
@@ -99,15 +99,13 @@
"@mui/icons-material": "^5.0.1",
"@mui/material": "^5.0.1",
"react": "^16.8.0 || ^17.0.2",
- "react-dom": "^16.8.0 || ^17.0.2",
- "tss-react": "^3.4.1"
+ "react-dom": "^16.8.0 || ^17.0.2"
},
"dependencies": {
"@babel/runtime-corejs3": "^7.12.1",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@emotion/cache": "^11.7.1",
- "tss-react": "^3.4.1",
"clsx": "^1.1.1",
"lodash.assignwith": "^4.2.0",
"lodash.clonedeep": "^4.5.0",
diff --git a/src/MUIDataTable.js b/src/MUIDataTable.js
index 3e11cd945..81d6dac28 100644
--- a/src/MUIDataTable.js
+++ b/src/MUIDataTable.js
@@ -1,7 +1,6 @@
import Paper from '@mui/material/Paper';
import MuiTable from '@mui/material/Table';
import MuiTooltip from '@mui/material/Tooltip';
-import { withStyles } from 'tss-react/mui';
import clsx from 'clsx';
import assignwith from 'lodash.assignwith';
import cloneDeep from 'lodash.clonedeep';
@@ -10,6 +9,7 @@ import isEqual from 'lodash.isequal';
import isUndefined from 'lodash.isundefined';
import merge from 'lodash.merge';
import PropTypes from 'prop-types';
+import { styled } from '@mui/material/styles';
import React from 'react';
import DefaultTableBody from './components/TableBody';
import DefaultTableFilter from './components/TableFilter';
@@ -25,16 +25,33 @@ import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { load, save } from './localStorage';
-const defaultTableStyles = theme => ({
- root: {},
- paper: {},
- paperResponsiveScrollFullHeightFullWidth: {
+const PREFIX = 'MUIDataTable';
+
+const classes = {
+ root: `${PREFIX}-root`,
+ paper: `${PREFIX}-paper`,
+ paperResponsiveScrollFullHeightFullWidth: `${PREFIX}-paperResponsiveScrollFullHeightFullWidth`,
+ tableRoot: `${PREFIX}-tableRoot`,
+ responsiveBase: `${PREFIX}-responsiveBase`,
+ responsiveScroll: `${PREFIX}-responsiveScroll`,
+ responsiveScrollMaxHeight: `${PREFIX}-responsiveScrollMaxHeight`,
+ responsiveScrollFullHeight: `${PREFIX}-responsiveScrollFullHeight`,
+ responsiveStacked: `${PREFIX}-responsiveStacked`,
+ responsiveStackedFullWidth: `${PREFIX}-responsiveStackedFullWidth`,
+ caption: `${PREFIX}-caption`,
+ liveAnnounce: `${PREFIX}-liveAnnounce`,
+};
+
+const StyledMuiTable = styled(Paper)(({ theme }) => ({
+ [`& .${classes.root}`]: {},
+ [`& .${classes.paper}`]: {},
+ [`& .${classes.paperResponsiveScrollFullHeightFullWidth}`]: {
position: 'absolute',
},
- tableRoot: {
+ [`& .${classes.tableRoot}`]: {
outline: 'none',
},
- responsiveBase: {
+ [`& .${classes.responsiveBase}`]: {
overflow: 'auto',
'@media print': {
height: 'auto !important',
@@ -42,34 +59,35 @@ const defaultTableStyles = theme => ({
},
// deprecated, but continuing support through v3.x
- responsiveScroll: {
+ [`& .${classes.responsiveScroll}`]: {
overflow: 'auto',
height: '100%',
},
// deprecated, but continuing support through v3.x
- responsiveScrollMaxHeight: {
+ [`& .${classes.responsiveScrollMaxHeight}`]: {
overflow: 'auto',
height: '100%',
},
// deprecated, but continuing support through v3.x
- responsiveScrollFullHeight: {
+ [`& .${classes.responsiveScrollFullHeight}`]: {
height: '100%',
},
// deprecated, but continuing support through v3.x
- responsiveStacked: {
+ [`& .${classes.responsiveStacked}`]: {
overflow: 'auto',
[theme.breakpoints.down('md')]: {
overflow: 'hidden',
},
},
// deprecated, but continuing support through v3.x
- responsiveStackedFullWidth: {},
- caption: {
+ [`& .${classes.responsiveStackedFullWidth}`]: {},
+
+ [`& .${classes.caption}`]: {
position: 'absolute',
left: '-3000px',
},
- liveAnnounce: {
+ [`& .${classes.liveAnnounce}`]: {
border: '0',
clip: 'rect(0 0 0 0)',
height: '1px',
@@ -86,7 +104,7 @@ const defaultTableStyles = theme => ({
},
},
},
-});
+}));
const TABLE_LOAD = {
INITIAL: 1,
@@ -1216,7 +1234,6 @@ class MUIDataTable extends React.Component {
}
getTableProps() {
- const { classes } = this.props;
const tableProps = this.options.setTableProps() || {};
tableProps.className = clsx(classes.tableRoot, tableProps.className);
@@ -1822,7 +1839,6 @@ class MUIDataTable extends React.Component {
render() {
const {
- classes,
className,
title,
components: {
@@ -1930,7 +1946,7 @@ class MUIDataTable extends React.Component {
}
return (
-
+
{selectedRows.data.length > 0 && this.options.selectToolbarPlacement !== STP.NONE && (
{announceText}
-
+
);
}
}
-export default withStyles(MUIDataTable, defaultTableStyles, { name: 'MUIDataTable' });
+export default MUIDataTable;
diff --git a/src/components/JumpToPage.js b/src/components/JumpToPage.js
index 048a888c7..06d1427dd 100644
--- a/src/components/JumpToPage.js
+++ b/src/components/JumpToPage.js
@@ -1,27 +1,41 @@
import React from 'react';
+import { styled } from '@mui/material/styles';
import PropTypes from 'prop-types';
import InputBase from '@mui/material/InputBase';
import MenuItem from '@mui/material/MenuItem';
import Select from '@mui/material/Select';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
-import { makeStyles } from 'tss-react/mui';
import { getPageValue } from '../utils.js';
import clsx from 'clsx';
-const useStyles = makeStyles({ name: 'MUIDataTableJumpToPage' })(theme => ({
- root: {
+const PREFIX = 'MUIDataTableJumpToPage';
+
+const classes = {
+ root: `${PREFIX}-root`,
+ caption: `${PREFIX}-caption`,
+ selectRoot: `${PREFIX}-selectRoot`,
+ select: `${PREFIX}-select`,
+ selectIcon: `${PREFIX}-selectIcon`,
+ input: `${PREFIX}-input`,
+};
+
+const StyledToolbar = styled(Toolbar)(({ theme }) => ({
+ [`&.${classes.root}`]: {
color: theme.palette.text.primary,
},
- caption: {
+
+ [`& .${classes.caption}`]: {
flexShrink: 0,
},
+
/* Styles applied to the Select component root element */
- selectRoot: {
+ [`& .${classes.selectRoot}`]: {
marginRight: 32,
marginLeft: 8,
},
- select: {
+
+ [`& .${classes.select}`]: {
paddingTop: 6,
paddingBottom: 7,
paddingLeft: 8,
@@ -30,10 +44,12 @@ const useStyles = makeStyles({ name: 'MUIDataTableJumpToPage' })(theme => ({
textAlignLast: 'right',
fontSize: theme.typography.pxToRem(14),
},
+
/* Styles applied to Select component icon class */
- selectIcon: {},
+ [`& .${classes.selectIcon}`]: {},
+
/* Styles applied to InputBase component */
- input: {
+ [`& .${classes.input}`]: {
color: 'inhert',
fontSize: 'inhert',
flexShrink: 0,
@@ -41,8 +57,6 @@ const useStyles = makeStyles({ name: 'MUIDataTableJumpToPage' })(theme => ({
}));
function JumpToPage(props) {
- const { classes } = useStyles();
-
const handlePageChange = event => {
props.changePage(parseInt(event.target.value, 10));
};
@@ -66,7 +80,7 @@ function JumpToPage(props) {
};
return (
-
+
);
}
diff --git a/src/components/TableBody.js b/src/components/TableBody.js
index ebfc4a75d..31d5a2e45 100644
--- a/src/components/TableBody.js
+++ b/src/components/TableBody.js
@@ -1,35 +1,47 @@
import React from 'react';
+import { styled } from '@mui/material/styles';
import PropTypes from 'prop-types';
import Typography from '@mui/material/Typography';
import MuiTableBody from '@mui/material/TableBody';
import TableBodyCell from './TableBodyCell';
import TableBodyRow from './TableBodyRow';
import TableSelectCell from './TableSelectCell';
-import { withStyles } from 'tss-react/mui';
import cloneDeep from 'lodash.clonedeep';
import { getPageValue } from '../utils';
import clsx from 'clsx';
-const defaultBodyStyles = theme => ({
- root: {},
- emptyTitle: {
+const PREFIX = 'MUIDataTableBody';
+
+const classes = {
+ root: `${PREFIX}-root`,
+ emptyTitle: `${PREFIX}-emptyTitle`,
+ lastStackedCell: `${PREFIX}-lastStackedCell`,
+ lastSimpleCell: `${PREFIX}-lastSimpleCell`,
+};
+
+const StyledMuiTableBody = styled(MuiTableBody)(({ theme }) => ({
+ [`& .${classes.root}`]: {},
+
+ [`& .${classes.emptyTitle}`]: {
textAlign: 'center',
},
- lastStackedCell: {
+
+ [`& .${classes.lastStackedCell}`]: {
[theme.breakpoints.down('md')]: {
'& td:last-child': {
borderBottom: 'none',
},
},
},
- lastSimpleCell: {
+
+ [`& .${classes.lastSimpleCell}`]: {
[theme.breakpoints.down('sm')]: {
'& td:last-child': {
borderBottom: 'none',
},
},
},
-});
+}));
class TableBody extends React.Component {
static propTypes = {
@@ -223,7 +235,6 @@ class TableBody extends React.Component {
render() {
const {
- classes,
columns,
toggleExpandRow,
options,
@@ -235,7 +246,7 @@ class TableBody extends React.Component {
const visibleColCnt = columns.filter(c => c.display === 'true').length;
return (
-
+
);
}
}
-export default withStyles(TableBody, defaultBodyStyles, { name: 'MUIDataTableBody' });
+export default TableBody;
diff --git a/src/components/TableBodyCell.js b/src/components/TableBodyCell.js
index f4229b84b..69f17e949 100644
--- a/src/components/TableBodyCell.js
+++ b/src/components/TableBodyCell.js
@@ -1,14 +1,33 @@
import React, { useCallback } from 'react';
+import { styled } from '@mui/material/styles';
import clsx from 'clsx';
import TableCell from '@mui/material/TableCell';
-import { makeStyles } from 'tss-react/mui';
-const useStyles = makeStyles({ name: 'MUIDataTableBodyCell' })(theme => ({
- root: {},
- cellHide: {
+const PREFIX = 'MUIDataTableBodyCell';
+
+const classes = {
+ root: `${PREFIX}-root`,
+ cellHide: `${PREFIX}-cellHide`,
+ simpleHeader: `${PREFIX}-simpleHeader`,
+ simpleCell: `${PREFIX}-simpleCell`,
+ stackedHeader: `${PREFIX}-stackedHeader`,
+ stackedCommon: `${PREFIX}-stackedCommon`,
+ stackedCommonAlways: `${PREFIX}-stackedCommonAlways`,
+ stackedParent: `${PREFIX}-stackedParent`,
+ stackedParentAlways: `${PREFIX}-stackedParentAlways`,
+ cellStackedSmall: `${PREFIX}-cellStackedSmall`,
+ responsiveStackedSmall: `${PREFIX}-responsiveStackedSmall`,
+ responsiveStackedSmallParent: `${PREFIX}-responsiveStackedSmallParent`,
+};
+
+const StyledTableCell = styled(TableCell)(({ theme }) => ({
+ [`&.${classes.root}`]: {},
+
+ [`& .${classes.cellHide}`]: {
display: 'none',
},
- simpleHeader: {
+
+ [`& .${classes.simpleHeader}`]: {
[theme.breakpoints.down('sm')]: {
display: 'inline-block',
fontWeight: 'bold',
@@ -16,17 +35,20 @@ const useStyles = makeStyles({ name: 'MUIDataTableBodyCell' })(theme => ({
boxSizing: 'border-box',
},
},
- simpleCell: {
+
+ [`&.${classes.simpleCell}`]: {
[theme.breakpoints.down('sm')]: {
display: 'inline-block',
width: '100%',
boxSizing: 'border-box',
},
},
- stackedHeader: {
+
+ [`& .${classes.stackedHeader}`]: {
verticalAlign: 'top',
},
- stackedCommon: {
+
+ [`& .${classes.stackedCommon}`]: {
[theme.breakpoints.down('md')]: {
display: 'inline-block',
fontSize: '16px',
@@ -41,7 +63,8 @@ const useStyles = makeStyles({ name: 'MUIDataTableBodyCell' })(theme => ({
},
},
},
- stackedCommonAlways: {
+
+ [`& .${classes.stackedCommonAlways}`]: {
display: 'inline-block',
fontSize: '16px',
height: 'auto',
@@ -54,7 +77,8 @@ const useStyles = makeStyles({ name: 'MUIDataTableBodyCell' })(theme => ({
borderBottom: 'none',
},
},
- stackedParent: {
+
+ [`&.${classes.stackedParent}`]: {
[theme.breakpoints.down('md')]: {
display: 'inline-block',
fontSize: '16px',
@@ -63,26 +87,30 @@ const useStyles = makeStyles({ name: 'MUIDataTableBodyCell' })(theme => ({
boxSizing: 'border-box',
},
},
- stackedParentAlways: {
+
+ [`&.${classes.stackedParentAlways}`]: {
display: 'inline-block',
fontSize: '16px',
height: 'auto',
width: 'calc(100%)',
boxSizing: 'border-box',
},
- cellStackedSmall: {
+
+ [`& .${classes.cellStackedSmall}`]: {
[theme.breakpoints.down('md')]: {
width: '50%',
boxSizing: 'border-box',
},
},
- responsiveStackedSmall: {
+
+ [`& .${classes.responsiveStackedSmall}`]: {
[theme.breakpoints.down('md')]: {
width: '50%',
boxSizing: 'border-box',
},
},
- responsiveStackedSmallParent: {
+
+ [`&.${classes.responsiveStackedSmallParent}`]: {
[theme.breakpoints.down('md')]: {
width: '100%',
boxSizing: 'border-box',
@@ -91,7 +119,6 @@ const useStyles = makeStyles({ name: 'MUIDataTableBodyCell' })(theme => ({
}));
function TableBodyCell(props) {
- const { classes } = useStyles();
const {
children,
colIndex,
@@ -177,7 +204,7 @@ function TableBodyCell(props) {
}
return (
-
+
);
}
diff --git a/src/components/TableBodyRow.js b/src/components/TableBodyRow.js
index 51c783cd0..6541ebf06 100644
--- a/src/components/TableBodyRow.js
+++ b/src/components/TableBodyRow.js
@@ -1,11 +1,20 @@
import React from 'react';
+import { styled } from '@mui/material/styles';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import TableRow from '@mui/material/TableRow';
-import { withStyles } from 'tss-react/mui';
-const defaultBodyRowStyles = theme => ({
- root: {
+const PREFIX = 'MUIDataTableBodyRow';
+
+const classes = {
+ root: `${PREFIX}-root`,
+ hoverCursor: `${PREFIX}-hoverCursor`,
+ responsiveStacked: `${PREFIX}-responsiveStacked`,
+ responsiveSimple: `${PREFIX}-responsiveSimple`,
+};
+
+const StyledTableRow = styled(TableRow)(({ theme }) => ({
+ [`&.${classes.root}`]: {
// material v4
'&.Mui-selected': {
backgroundColor: theme.palette.action.selected,
@@ -16,8 +25,10 @@ const defaultBodyRowStyles = theme => ({
backgroundColor: theme.palette.action.selected,
},
},
- hoverCursor: { cursor: 'pointer' },
- responsiveStacked: {
+
+ [`&.${classes.hoverCursor}`]: { cursor: 'pointer' },
+
+ [`&.${classes.responsiveStacked}`]: {
[theme.breakpoints.down('md')]: {
borderTop: 'solid 2px rgba(0, 0, 0, 0.15)',
borderBottom: 'solid 2px rgba(0, 0, 0, 0.15)',
@@ -25,7 +36,8 @@ const defaultBodyRowStyles = theme => ({
margin: 0,
},
},
- responsiveSimple: {
+
+ [`&.${classes.responsiveSimple}`]: {
[theme.breakpoints.down('sm')]: {
borderTop: 'solid 2px rgba(0, 0, 0, 0.15)',
borderBottom: 'solid 2px rgba(0, 0, 0, 0.15)',
@@ -33,7 +45,7 @@ const defaultBodyRowStyles = theme => ({
margin: 0,
},
},
-});
+}));
class TableBodyRow extends React.Component {
static propTypes = {
@@ -48,7 +60,7 @@ class TableBodyRow extends React.Component {
};
render() {
- const { classes, options, rowSelected, onClick, className, isRowSelectable, ...rest } = this.props;
+ const { options, rowSelected, onClick, className, isRowSelectable, ...rest } = this.props;
var methods = {};
if (onClick) {
@@ -56,7 +68,7 @@ class TableBodyRow extends React.Component {
}
return (
-
+
);
}
}
-export default withStyles(TableBodyRow, defaultBodyRowStyles, { name: 'MUIDataTableBodyRow' });
+export default TableBodyRow;
diff --git a/src/components/TableFilter.js b/src/components/TableFilter.js
index d23283448..6b116de0f 100644
--- a/src/components/TableFilter.js
+++ b/src/components/TableFilter.js
@@ -1,4 +1,5 @@
import Button from '@mui/material/Button';
+import { styled } from '@mui/material/styles';
import Checkbox from '@mui/material/Checkbox';
import FormControl from '@mui/material/FormControl';
import FormControlLabel from '@mui/material/FormControlLabel';
@@ -14,45 +15,71 @@ import Select from '@mui/material/Select';
import TextField from '@mui/material/TextField';
import Typography from '@mui/material/Typography';
import clsx from 'clsx';
-import { withStyles } from 'tss-react/mui';
import cloneDeep from 'lodash.clonedeep';
-export const defaultFilterStyles = theme => ({
- root: {
+const PREFIX = 'MUIDataTableFilter';
+
+const classes = {
+ root: `${PREFIX}-root`,
+ header: `${PREFIX}-header`,
+ title: `${PREFIX}-title`,
+ noMargin: `${PREFIX}-noMargin`,
+ reset: `${PREFIX}-reset`,
+ resetLink: `${PREFIX}-resetLink`,
+ filtersSelected: `${PREFIX}-filtersSelected`,
+ checkboxListTitle: `${PREFIX}-checkboxListTitle`,
+ checkboxFormGroup: `${PREFIX}-checkboxFormGroup`,
+ checkboxFormControl: `${PREFIX}-checkboxFormControl`,
+ checkboxFormControlLabel: `${PREFIX}-checkboxFormControlLabel`,
+ checkboxIcon: `${PREFIX}-checkboxIcon`,
+ checkbox: `${PREFIX}-checkbox`,
+ checked: `${PREFIX}-checked`,
+ gridListTile: `${PREFIX}-gridListTile`,
+};
+
+const Root = styled('div')(({ theme }) => ({
+ [`&.${classes.root}`]: {
backgroundColor: theme.palette.background.default,
padding: '24px 24px 36px 24px',
fontFamily: 'Roboto',
},
- header: {
+
+ [`& .${classes.header}`]: {
flex: '0 0 auto',
marginBottom: '16px',
width: '100%',
display: 'flex',
justifyContent: 'space-between',
},
- title: {
+
+ [`& .${classes.title}`]: {
display: 'inline-block',
marginLeft: '7px',
color: theme.palette.text.primary,
fontSize: '14px',
fontWeight: 500,
},
- noMargin: {
+
+ [`& .${classes.noMargin}`]: {
marginLeft: '0px',
},
- reset: {
+
+ [`& .${classes.reset}`]: {
alignSelf: 'left',
},
- resetLink: {
+
+ [`& .${classes.resetLink}`]: {
marginLeft: '16px',
fontSize: '12px',
cursor: 'pointer',
},
- filtersSelected: {
+
+ [`& .${classes.filtersSelected}`]: {
alignSelf: 'right',
},
+
/* checkbox */
- checkboxListTitle: {
+ [`& .${classes.checkboxListTitle}`]: {
marginLeft: '7px',
marginBottom: '8px',
fontSize: '14px',
@@ -60,27 +87,35 @@ export const defaultFilterStyles = theme => ({
textAlign: 'left',
fontWeight: 500,
},
- checkboxFormGroup: {
+
+ [`& .${classes.checkboxFormGroup}`]: {
marginTop: '8px',
},
- checkboxFormControl: {
+
+ [`& .${classes.checkboxFormControl}`]: {
margin: '0px',
},
- checkboxFormControlLabel: {
+
+ [`& .${classes.checkboxFormControlLabel}`]: {
fontSize: '15px',
marginLeft: '8px',
color: theme.palette.text.primary,
},
- checkboxIcon: {
+
+ [`& .${classes.checkboxIcon}`]: {
width: '32px',
height: '32px',
},
- checkbox: {},
- checked: {},
- gridListTile: {
+
+ [`& .${classes.checkbox}`]: {},
+ [`& .${classes.checked}`]: {},
+
+ [`& .${classes.gridListTile}`]: {
marginTop: '16px',
},
-});
+}));
+
+export {};
class TableFilter extends React.Component {
static propTypes = {
@@ -159,7 +194,7 @@ class TableFilter extends React.Component {
renderCheckbox(column, index, components = {}) {
const CheckboxComponent = components.Checkbox || Checkbox;
- const { classes, filterData } = this.props;
+ const { filterData } = this.props;
const { filterList } = this.state;
const renderItem =
column.filterOptions && column.filterOptions.renderValue ? column.filterOptions.renderValue : v => v;
@@ -206,7 +241,7 @@ class TableFilter extends React.Component {
}
renderSelect(column, index) {
- const { classes, filterData, options } = this.props;
+ const { filterData, options } = this.props;
const { filterList } = this.state;
const textLabels = options.textLabels.filter;
const renderItem =
@@ -244,7 +279,7 @@ class TableFilter extends React.Component {
}
renderTextField(column, index) {
- const { classes } = this.props;
+ const {} = this.props;
const { filterList } = this.state;
if (column.filterOptions && column.filterOptions.renderValue) {
console.warn('Custom renderValue not supported for textField filters');
@@ -274,7 +309,7 @@ class TableFilter extends React.Component {
renderMultiselect(column, index, components = {}) {
const CheckboxComponent = components.Checkbox || Checkbox;
- const { classes, filterData } = this.props;
+ const { filterData } = this.props;
const { filterList } = this.state;
const renderItem =
column.filterOptions && column.filterOptions.renderValue ? column.filterOptions.renderValue : v => v;
@@ -318,7 +353,7 @@ class TableFilter extends React.Component {
}
renderCustomField(column, index) {
- const { classes, filterData, options } = this.props;
+ const { filterData, options } = this.props;
const { filterList } = this.state;
const width = (column.filterOptions && column.filterOptions.fullWidth) === true ? 12 : 6;
const display =
@@ -370,11 +405,11 @@ class TableFilter extends React.Component {
};
render() {
- const { classes, columns, options, customFooter, filterList, components = {} } = this.props;
+ const { columns, options, customFooter, filterList, components = {} } = this.props;
const textLabels = options.textLabels.filter;
return (
-