mui-table-2026 1.0.0 → 1.0.2

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.
@@ -1,107 +1,102 @@
1
- import { Paper } from '@mui/material';
2
- import { Table as MuiTable } from '@mui/material';
3
- import { Tooltip as MuiTooltip } from '@mui/material';
4
- import { withStyles } from 'tss-react/mui';
5
- import clsx from 'clsx';
6
- import assignwith from 'lodash.assignwith';
7
- import cloneDeep from 'lodash.clonedeep';
8
- import find from 'lodash.find';
9
- import isEqual from 'lodash.isequal';
10
- import isUndefined from 'lodash.isundefined';
11
- import merge from 'lodash.merge';
12
- import PropTypes from 'prop-types';
13
- import React from 'react';
14
- import DefaultTableBody from './components/TableBody';
15
- import DefaultTableFilter from './components/TableFilter';
16
- import DefaultTableFilterList from './components/TableFilterList';
17
- import DefaultTableFooter from './components/TableFooter';
18
- import DefaultTableHead from './components/TableHead';
19
- import DefaultTableResize from './components/TableResize';
20
- import DefaultTableToolbar from './components/TableToolbar';
21
- import DefaultTableToolbarSelect from './components/TableToolbarSelect';
22
- import getTextLabels from './textLabels';
23
- import { buildMap, getCollatorComparator, getPageValue, sortCompare, warnDeprecated, warnInfo } from './utils';
24
- import { DndProvider } from 'react-dnd';
25
- import { HTML5Backend } from 'react-dnd-html5-backend';
26
- import { load, save } from './localStorage';
1
+ import { Paper } from "@mui/material";
2
+ import { Table as MuiTable } from "@mui/material";
3
+ import { Tooltip as MuiTooltip } from "@mui/material";
4
+ import { withStyles } from "tss-react/mui";
5
+ import clsx from "clsx";
6
+ import { assignWith, cloneDeep, find, isEqual, isUndefined, merge } from "lodash-es";
7
+ import PropTypes from "prop-types";
8
+ import React from "react";
9
+ import DefaultTableBody from "./components/TableBody";
10
+ import DefaultTableFilter from "./components/TableFilter";
11
+ import DefaultTableFilterList from "./components/TableFilterList";
12
+ import DefaultTableFooter from "./components/TableFooter";
13
+ import DefaultTableHead from "./components/TableHead";
14
+ import DefaultTableResize from "./components/TableResize";
15
+ import DefaultTableToolbar from "./components/TableToolbar";
16
+ import DefaultTableToolbarSelect from "./components/TableToolbarSelect";
17
+ import getTextLabels from "./textLabels";
18
+ import { buildMap, getCollatorComparator, getPageValue, sortCompare, warnDeprecated, warnInfo } from "./utils";
19
+ import { DndProvider } from "react-dnd";
20
+ import { HTML5Backend } from "react-dnd-html5-backend";
21
+ import { load, save } from "./localStorage";
27
22
 
28
23
  const defaultTableStyles = (theme) => ({
29
24
  root: {
30
- '& .datatables-noprint': {
31
- '@media print': {
32
- display: 'none',
25
+ "& .datatables-noprint": {
26
+ "@media print": {
27
+ display: "none",
33
28
  },
34
29
  },
35
30
  // Modern table styling
36
- borderRadius: '8px',
37
- overflow: 'hidden',
38
- boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
31
+ borderRadius: "8px",
32
+ overflow: "hidden",
33
+ boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
39
34
 
40
- backgroundColor: '#ffffff',
35
+ backgroundColor: "#ffffff",
41
36
  // Z-index management
42
- '& .MuiPopper-root': {
37
+ "& .MuiPopper-root": {
43
38
  zIndex: 9999,
44
39
  },
45
40
  },
46
41
  paper: {
47
- isolation: 'auto',
42
+ isolation: "auto",
48
43
  // Modern paper styling
49
- borderRadius: '8px',
50
- boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
51
- border: '1px solid #e5e7eb',
52
- overflow: 'hidden',
44
+ borderRadius: "8px",
45
+ boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
46
+ border: "1px solid #e5e7eb",
47
+ overflow: "hidden",
53
48
  },
54
49
  paperResponsiveScrollFullHeightFullWidth: {
55
- position: 'absolute',
50
+ position: "absolute",
56
51
  },
57
52
  tableRoot: {
58
- outline: 'none',
59
- borderTop: '2px solid #e5e7eb',
53
+ outline: "none",
54
+ borderTop: "2px solid #e5e7eb",
60
55
  },
61
56
  responsiveBase: {
62
- overflow: 'auto',
63
- '@media print': {
64
- height: 'auto !important',
57
+ overflow: "auto",
58
+ "@media print": {
59
+ height: "auto !important",
65
60
  },
66
61
  },
67
62
 
68
63
  // deprecated, but continuing support through v3.x
69
64
  responsiveScroll: {
70
- overflow: 'auto',
71
- height: '100%',
65
+ overflow: "auto",
66
+ height: "100%",
72
67
  },
73
68
  // deprecated, but continuing support through v3.x
74
69
  responsiveScrollMaxHeight: {
75
- overflow: 'auto',
76
- height: '100%',
70
+ overflow: "auto",
71
+ height: "100%",
77
72
  },
78
73
  // deprecated, but continuing support through v3.x
79
74
  responsiveScrollFullHeight: {
80
- height: '100%',
75
+ height: "100%",
81
76
  },
82
77
  // deprecated, but continuing support through v3.x
83
78
  responsiveStacked: {
84
- overflow: 'auto',
85
- [theme.breakpoints.down('md')]: {
86
- overflow: 'hidden',
79
+ overflow: "auto",
80
+ [theme.breakpoints.down("md")]: {
81
+ overflow: "hidden",
87
82
  },
88
83
  },
89
84
  // deprecated, but continuing support through v3.x
90
85
  responsiveStackedFullWidth: {},
91
86
  caption: {
92
- position: 'absolute',
93
- left: '-3000px',
87
+ position: "absolute",
88
+ left: "-3000px",
94
89
  },
95
90
 
96
91
  liveAnnounce: {
97
- border: '0',
98
- clip: 'rect(0 0 0 0)',
99
- height: '1px',
100
- margin: '-1px',
101
- overflow: 'hidden',
102
- padding: '0',
103
- position: 'absolute',
104
- width: '1px',
92
+ border: "0",
93
+ clip: "rect(0 0 0 0)",
94
+ height: "1px",
95
+ margin: "-1px",
96
+ overflow: "hidden",
97
+ padding: "0",
98
+ position: "absolute",
99
+ width: "1px",
105
100
  },
106
101
  });
107
102
 
@@ -111,7 +106,7 @@ const TABLE_LOAD = {
111
106
  };
112
107
 
113
108
  // Populate this list with anything that might render in the toolbar to determine if we hide the toolbar
114
- const TOOLBAR_ITEMS = ['title', 'filter', 'search', 'print', 'download', 'viewColumns', 'customToolbar'];
109
+ const TOOLBAR_ITEMS = ["title", "filter", "search", "print", "download", "viewColumns", "customToolbar"];
115
110
 
116
111
  const hasToolbarItem = (options, title) => {
117
112
  options.title = title;
@@ -121,10 +116,10 @@ const hasToolbarItem = (options, title) => {
121
116
 
122
117
  // Select Toolbar Placement options
123
118
  const STP = {
124
- REPLACE: 'replace',
125
- ABOVE: 'above',
126
- NONE: 'none',
127
- ALWAYS: 'always',
119
+ REPLACE: "replace",
120
+ ABOVE: "above",
121
+ NONE: "none",
122
+ ALWAYS: "always",
128
123
  };
129
124
 
130
125
  class MUIDataTable extends React.Component {
@@ -141,7 +136,7 @@ class MUIDataTable extends React.Component {
141
136
  label: PropTypes.string,
142
137
  name: PropTypes.string.isRequired,
143
138
  options: PropTypes.shape({
144
- display: PropTypes.oneOf(['true', 'false', 'excluded', 'always', true, false]),
139
+ display: PropTypes.oneOf(["true", "false", "excluded", "always", true, false]),
145
140
  empty: PropTypes.bool,
146
141
  filter: PropTypes.bool,
147
142
  sort: PropTypes.bool,
@@ -158,7 +153,7 @@ class MUIDataTable extends React.Component {
158
153
  display: PropTypes.func,
159
154
  }),
160
155
  ]),
161
- filterType: PropTypes.oneOf(['dropdown', 'checkbox', 'multiselect', 'textField', 'custom']),
156
+ filterType: PropTypes.oneOf(["dropdown", "checkbox", "multiselect", "textField", "custom"]),
162
157
  customHeadRender: PropTypes.func,
163
158
  customBodyRender: PropTypes.func,
164
159
  customBodyRenderLite: PropTypes.func,
@@ -199,7 +194,7 @@ class MUIDataTable extends React.Component {
199
194
  expandableRowsHeader: PropTypes.bool,
200
195
  expandableRowsOnClick: PropTypes.bool,
201
196
  disableToolbarSelect: PropTypes.bool,
202
- download: PropTypes.oneOf([true, false, 'true', 'false', 'disabled']),
197
+ download: PropTypes.oneOf([true, false, "true", "false", "disabled"]),
203
198
  downloadOptions: PropTypes.shape({
204
199
  filename: PropTypes.string,
205
200
  separator: PropTypes.string,
@@ -208,9 +203,9 @@ class MUIDataTable extends React.Component {
208
203
  useDisplayedRowsOnly: PropTypes.bool,
209
204
  }),
210
205
  }),
211
- filter: PropTypes.oneOf([true, false, 'true', 'false', 'disabled']),
206
+ filter: PropTypes.oneOf([true, false, "true", "false", "disabled"]),
212
207
  filterArrayFullMatch: PropTypes.bool,
213
- filterType: PropTypes.oneOf(['dropdown', 'checkbox', 'multiselect', 'textField', 'custom']),
208
+ filterType: PropTypes.oneOf(["dropdown", "checkbox", "multiselect", "textField", "custom"]),
214
209
  fixedHeader: PropTypes.bool,
215
210
  fixedSelectColumn: PropTypes.bool,
216
211
  getTextLabels: PropTypes.func,
@@ -232,9 +227,9 @@ class MUIDataTable extends React.Component {
232
227
  onTableInit: PropTypes.func,
233
228
  page: PropTypes.number,
234
229
  pagination: PropTypes.bool,
235
- print: PropTypes.oneOf([true, false, 'true', 'false', 'disabled']),
230
+ print: PropTypes.oneOf([true, false, "true", "false", "disabled"]),
236
231
  searchProps: PropTypes.object,
237
- selectableRows: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['none', 'single', 'multiple'])]),
232
+ selectableRows: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(["none", "single", "multiple"])]),
238
233
  selectableRowsHeader: PropTypes.bool,
239
234
  selectableRowsHideCheckboxes: PropTypes.bool,
240
235
  selectableRowsOnClick: PropTypes.bool,
@@ -244,13 +239,13 @@ class MUIDataTable extends React.Component {
244
239
  tableBodyMaxHeight: PropTypes.string,
245
240
  renderExpandableRow: PropTypes.func,
246
241
  resizableColumns: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
247
- responsive: PropTypes.oneOf(['standard', 'vertical', 'verticalAlways', 'simple']),
242
+ responsive: PropTypes.oneOf(["standard", "vertical", "verticalAlways", "simple"]),
248
243
  rowHover: PropTypes.bool,
249
244
  rowsExpanded: PropTypes.array,
250
245
  rowsPerPage: PropTypes.number,
251
246
  rowsPerPageOptions: PropTypes.array,
252
247
  rowsSelected: PropTypes.array,
253
- search: PropTypes.oneOf([true, false, 'true', 'false', 'disabled']),
248
+ search: PropTypes.oneOf([true, false, "true", "false", "disabled"]),
254
249
  searchOpen: PropTypes.bool,
255
250
  searchAlwaysOpen: PropTypes.bool,
256
251
  searchPlaceholder: PropTypes.string,
@@ -265,7 +260,7 @@ class MUIDataTable extends React.Component {
265
260
  sort: PropTypes.bool,
266
261
  sortOrder: PropTypes.object,
267
262
  storageKey: PropTypes.string,
268
- viewColumns: PropTypes.oneOf([true, false, 'true', 'false', 'disabled']),
263
+ viewColumns: PropTypes.oneOf([true, false, "true", "false", "disabled"]),
269
264
  }),
270
265
  /** Pass and use className to style MUIDataTable as desired */
271
266
  className: PropTypes.string,
@@ -273,7 +268,7 @@ class MUIDataTable extends React.Component {
273
268
  };
274
269
 
275
270
  static defaultProps = {
276
- title: '',
271
+ title: "",
277
272
  options: {},
278
273
  data: [],
279
274
  columns: [],
@@ -343,7 +338,7 @@ class MUIDataTable extends React.Component {
343
338
  // When we have a search, we must reset page to view it unless on serverSide since paging is handled by the user.
344
339
  if (this.props.options.searchText && !this.props.options.serverSide) this.setState({ page: 0 });
345
340
 
346
- this.setTableInit('tableInitialized');
341
+ this.setTableInit("tableInitialized");
347
342
  }
348
343
 
349
344
  componentDidUpdate(prevProps) {
@@ -360,7 +355,7 @@ class MUIDataTable extends React.Component {
360
355
  }
361
356
 
362
357
  this.setTableData(this.props, TABLE_LOAD.INITIAL, didDataUpdate, () => {
363
- this.setTableAction('propsUpdate');
358
+ this.setTableAction("propsUpdate");
364
359
  });
365
360
  }
366
361
 
@@ -387,12 +382,12 @@ class MUIDataTable extends React.Component {
387
382
 
388
383
  // provide default tableId when no tableId has been passed as prop
389
384
  if (!props.options.tableId) {
390
- props.options.tableId = (Math.random() + '').replace(/\./, '');
385
+ props.options.tableId = (Math.random() + "").replace(/\./, "");
391
386
  }
392
387
 
393
- this.options = assignwith(options, props.options, (objValue, srcValue, key) => {
388
+ this.options = assignWith(options, props.options, (objValue, srcValue, key) => {
394
389
  // Merge any default options that are objects, as they will be overwritten otherwise
395
- if (key === 'textLabels' || key === 'downloadOptions') return merge(objValue, srcValue);
390
+ if (key === "textLabels" || key === "downloadOptions") return merge(objValue, srcValue);
396
391
  return;
397
392
  });
398
393
 
@@ -405,32 +400,32 @@ class MUIDataTable extends React.Component {
405
400
  disableToolbarSelect: false,
406
401
  download: true,
407
402
  downloadOptions: {
408
- filename: 'tableDownload.csv',
409
- separator: ',',
403
+ filename: "tableDownload.csv",
404
+ separator: ",",
410
405
  },
411
406
  draggableColumns: {
412
407
  enabled: false,
413
408
  transitionTime: 300,
414
409
  },
415
410
  elevation: 4,
416
- enableNestedDataAccess: '',
411
+ enableNestedDataAccess: "",
417
412
  expandableRows: false,
418
413
  expandableRowsHeader: true,
419
414
  expandableRowsOnClick: false,
420
415
  filter: true,
421
416
  filterArrayFullMatch: true,
422
- filterType: 'dropdown',
417
+ filterType: "dropdown",
423
418
  fixedHeader: true,
424
419
  fixedSelectColumn: true,
425
420
  pagination: true,
426
421
  print: true,
427
422
  resizableColumns: false,
428
- responsive: 'vertical',
423
+ responsive: "vertical",
429
424
  rowHover: true,
430
425
  //rowsPerPage: 10,
431
426
  rowsPerPageOptions: [10, 15, 100],
432
427
  search: true,
433
- selectableRows: 'multiple',
428
+ selectableRows: "multiple",
434
429
  selectableRowsHideCheckboxes: false,
435
430
  selectableRowsOnClick: false,
436
431
  selectableRowsHeader: true,
@@ -439,7 +434,7 @@ class MUIDataTable extends React.Component {
439
434
  setTableProps: () => ({}),
440
435
  sort: true,
441
436
  sortFilterList: true,
442
- tableBodyHeight: 'auto',
437
+ tableBodyHeight: "auto",
443
438
  tableBodyMaxHeight: null, // if set, it will override tableBodyHeight
444
439
  sortOrder: {},
445
440
  textLabels: getTextLabels(),
@@ -456,71 +451,71 @@ class MUIDataTable extends React.Component {
456
451
  };
457
452
 
458
453
  handleOptionDeprecation = (props) => {
459
- if (typeof this.options.selectableRows === 'boolean') {
454
+ if (typeof this.options.selectableRows === "boolean") {
460
455
  this.warnDep(
461
- 'Using a boolean for selectableRows has been deprecated. Please use string option: multiple | single | none',
456
+ "Using a boolean for selectableRows has been deprecated. Please use string option: multiple | single | none",
462
457
  );
463
- this.options.selectableRows = this.options.selectableRows ? 'multiple' : 'none';
458
+ this.options.selectableRows = this.options.selectableRows ? "multiple" : "none";
464
459
  }
465
- if (['standard', 'vertical', 'verticalAlways', 'simple'].indexOf(this.options.responsive) === -1) {
460
+ if (["standard", "vertical", "verticalAlways", "simple"].indexOf(this.options.responsive) === -1) {
466
461
  if (
467
462
  [
468
- 'scrollMaxHeight',
469
- 'scrollFullHeight',
470
- 'stacked',
471
- 'stackedFullWidth',
472
- 'scrollFullHeightFullWidth',
473
- 'scroll',
463
+ "scrollMaxHeight",
464
+ "scrollFullHeight",
465
+ "stacked",
466
+ "stackedFullWidth",
467
+ "scrollFullHeightFullWidth",
468
+ "scroll",
474
469
  ].indexOf(this.options.responsive) !== -1
475
470
  ) {
476
471
  this.warnDep(
477
472
  this.options.responsive +
478
- ' has been deprecated, but will still work in version 3.x. Please use string option: standard | vertical | simple. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md',
473
+ " has been deprecated, but will still work in version 3.x. Please use string option: standard | vertical | simple. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md",
479
474
  );
480
475
  } else {
481
476
  this.warnInfo(
482
477
  this.options.responsive +
483
- ' is not recognized as a valid input for responsive option. Please use string option: standard | vertical | simple. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md',
478
+ " is not recognized as a valid input for responsive option. Please use string option: standard | vertical | simple. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md",
484
479
  );
485
480
  }
486
481
  }
487
482
  if (this.options.onRowsSelect) {
488
483
  this.warnDep(
489
- 'onRowsSelect has been renamed onRowSelectionChange. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md',
484
+ "onRowsSelect has been renamed onRowSelectionChange. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md",
490
485
  );
491
486
  }
492
487
  if (this.options.onRowsExpand) {
493
488
  this.warnDep(
494
- 'onRowsExpand has been renamed onRowExpansionChange. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md',
489
+ "onRowsExpand has been renamed onRowExpansionChange. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md",
495
490
  );
496
491
  }
497
492
  if (this.options.fixedHeaderOptions) {
498
493
  if (
499
- typeof this.options.fixedHeaderOptions.yAxis !== 'undefined' &&
500
- typeof this.options.fixedHeader === 'undefined'
494
+ typeof this.options.fixedHeaderOptions.yAxis !== "undefined" &&
495
+ typeof this.options.fixedHeader === "undefined"
501
496
  ) {
502
497
  this.options.fixedHeader = this.options.fixedHeaderOptions.yAxis;
503
498
  }
504
499
  if (
505
- typeof this.options.fixedHeaderOptions.xAxis !== 'undefined' &&
506
- typeof this.options.fixedSelectColumn === 'undefined'
500
+ typeof this.options.fixedHeaderOptions.xAxis !== "undefined" &&
501
+ typeof this.options.fixedSelectColumn === "undefined"
507
502
  ) {
508
503
  this.options.fixedSelectColumn = this.options.fixedHeaderOptions.xAxis;
509
504
  }
510
505
  this.warnDep(
511
- 'fixedHeaderOptions will still work but has been deprecated in favor of fixedHeader and fixedSelectColumn. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md',
506
+ "fixedHeaderOptions will still work but has been deprecated in favor of fixedHeader and fixedSelectColumn. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md",
512
507
  );
513
508
  }
514
509
  if (this.options.serverSideFilterList) {
515
510
  this.warnDep(
516
- 'serverSideFilterList will still work but has been deprecated in favor of the confirmFilters option. See this example for details: https://github.com/gregnb/mui-datatables/blob/master/examples/serverside-filters/index.js More info here: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md',
511
+ "serverSideFilterList will still work but has been deprecated in favor of the confirmFilters option. See this example for details: https://github.com/gregnb/mui-datatables/blob/master/examples/serverside-filters/index.js More info here: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md",
517
512
  );
518
513
  }
519
514
 
520
515
  props.columns.map((c) => {
521
516
  if (c.options && c.options.customFilterListRender) {
522
517
  this.warnDep(
523
- 'The customFilterListRender option has been deprecated. It is being replaced by customFilterListOptions.render (Specify customFilterListOptions: { render: Function } in column options.)',
518
+ "The customFilterListRender option has been deprecated. It is being replaced by customFilterListOptions.render (Specify customFilterListOptions: { render: Function } in column options.)",
524
519
  );
525
520
  }
526
521
  });
@@ -535,7 +530,7 @@ class MUIDataTable extends React.Component {
535
530
  if (Object.values) {
536
531
  if (Object.values(STP).indexOf(this.options.selectToolbarPlacement) === -1) {
537
532
  this.warnDep(
538
- 'Invalid option value for selectToolbarPlacement. Please check the documentation: https://github.com/gregnb/mui-datatables#options',
533
+ "Invalid option value for selectToolbarPlacement. Please check the documentation: https://github.com/gregnb/mui-datatables#options",
539
534
  );
540
535
  }
541
536
  }
@@ -554,18 +549,18 @@ class MUIDataTable extends React.Component {
554
549
 
555
550
  validateOptions(options) {
556
551
  if (options.serverSide && options.onTableChange === undefined) {
557
- throw Error('onTableChange callback must be provided when using serverSide option');
552
+ throw Error("onTableChange callback must be provided when using serverSide option");
558
553
  }
559
554
  if (options.expandableRows && options.renderExpandableRow === undefined) {
560
- throw Error('renderExpandableRow must be provided when using expandableRows option');
555
+ throw Error("renderExpandableRow must be provided when using expandableRows option");
561
556
  }
562
557
  if (options.rowsSelected && Array.isArray(options.rowsSelected) && options.rowsSelected.some(isNaN)) {
563
- warnInfo('When using the rowsSelected option, must be provided an array of numbers only.');
558
+ warnInfo("When using the rowsSelected option, must be provided an array of numbers only.");
564
559
  }
565
560
  }
566
561
 
567
562
  setTableAction = (action) => {
568
- if (typeof this.options.onTableChange === 'function') {
563
+ if (typeof this.options.onTableChange === "function") {
569
564
  this.options.onTableChange(action, this.state);
570
565
  }
571
566
  if (this.options.storageKey) {
@@ -574,13 +569,13 @@ class MUIDataTable extends React.Component {
574
569
  };
575
570
 
576
571
  setTableInit = (action) => {
577
- if (typeof this.options.onTableInit === 'function') {
572
+ if (typeof this.options.onTableInit === "function") {
578
573
  this.options.onTableInit(action, this.state);
579
574
  }
580
575
  };
581
576
 
582
577
  getInitTableOptions() {
583
- const optionNames = ['rowsPerPage', 'page', 'rowsSelected', 'rowsPerPageOptions'];
578
+ const optionNames = ["rowsPerPage", "page", "rowsSelected", "rowsPerPageOptions"];
584
579
  const optState = optionNames.reduce((acc, cur) => {
585
580
  if (this.options[cur] !== undefined) {
586
581
  acc[cur] = this.options[cur];
@@ -618,7 +613,7 @@ class MUIDataTable extends React.Component {
618
613
 
619
614
  newColumns.forEach((column, colIndex) => {
620
615
  let columnOptions = {
621
- display: 'true',
616
+ display: "true",
622
617
  empty: false,
623
618
  filter: true,
624
619
  sort: true,
@@ -634,7 +629,7 @@ class MUIDataTable extends React.Component {
634
629
  columnOrder.push(colIndex);
635
630
  const options = { ...column.options };
636
631
 
637
- if (typeof column === 'object') {
632
+ if (typeof column === "object") {
638
633
  if (options) {
639
634
  if (options.display !== undefined) {
640
635
  options.display = options.display.toString();
@@ -642,14 +637,14 @@ class MUIDataTable extends React.Component {
642
637
 
643
638
  if (options.sortDirection === null || options.sortDirection) {
644
639
  this.warnDep(
645
- 'The sortDirection column field has been deprecated. Please use the sortOrder option on the options object. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md',
640
+ "The sortDirection column field has been deprecated. Please use the sortOrder option on the options object. More info: https://github.com/gregnb/mui-datatables/tree/master/docs/v2_to_v3_guide.md",
646
641
  );
647
642
  }
648
643
  }
649
644
 
650
645
  // remember stored version of display if not overwritten
651
646
  if (
652
- typeof options.display === 'undefined' &&
647
+ typeof options.display === "undefined" &&
653
648
  prevColumns[colIndex] &&
654
649
  prevColumns[colIndex].name === column.name &&
655
650
  prevColumns[colIndex].display
@@ -724,7 +719,7 @@ class MUIDataTable extends React.Component {
724
719
  );
725
720
 
726
721
  let sortIndex = null;
727
- let sortDirection = 'none';
722
+ let sortDirection = "none";
728
723
  let tableMeta;
729
724
 
730
725
  let sortOrder;
@@ -736,7 +731,7 @@ class MUIDataTable extends React.Component {
736
731
  // if no sortOrder, check and see if there's a sortDirection on one of the columns (deprecation notice for this is given above)
737
732
  if (!sortOrder.direction) {
738
733
  props.columns.forEach((column, colIndex) => {
739
- if (column.options && (column.options.sortDirection === 'asc' || column.options.sortDirection === 'desc')) {
734
+ if (column.options && (column.options.sortDirection === "asc" || column.options.sortDirection === "desc")) {
740
735
  sortOrder.name = column.name;
741
736
  sortOrder.sortDirection = column.sortDirection;
742
737
  }
@@ -747,17 +742,17 @@ class MUIDataTable extends React.Component {
747
742
  const data = status === TABLE_LOAD.INITIAL ? this.transformData(columns, props.data) : props.data;
748
743
  let searchText = status === TABLE_LOAD.INITIAL ? this.options.searchText : null;
749
744
 
750
- if (typeof this.options.searchText === 'undefined' && typeof this.state.searchText !== 'undefined') {
745
+ if (typeof this.options.searchText === "undefined" && typeof this.state.searchText !== "undefined") {
751
746
  searchText = this.state.searchText;
752
747
  }
753
748
 
754
749
  let rowsPerPage = this.state.rowsPerPage;
755
- if (typeof this.options.rowsPerPage === 'number') {
750
+ if (typeof this.options.rowsPerPage === "number") {
756
751
  rowsPerPage = this.options.rowsPerPage;
757
752
  }
758
753
 
759
754
  let page = this.state.page;
760
- if (typeof this.options.page === 'number') {
755
+ if (typeof this.options.page === "number") {
761
756
  page = this.options.page;
762
757
  }
763
758
 
@@ -765,7 +760,7 @@ class MUIDataTable extends React.Component {
765
760
  for (let rowIndex = 0; rowIndex < data.length; rowIndex++) {
766
761
  let value = status === TABLE_LOAD.INITIAL ? data[rowIndex][colIndex] : data[rowIndex].data[colIndex];
767
762
 
768
- if (typeof tableData[rowIndex] === 'undefined') {
763
+ if (typeof tableData[rowIndex] === "undefined") {
769
764
  tableData.push({
770
765
  index: status === TABLE_LOAD.INITIAL ? rowIndex : data[rowIndex].index,
771
766
  data: status === TABLE_LOAD.INITIAL ? data[rowIndex] : data[rowIndex].data,
@@ -773,22 +768,22 @@ class MUIDataTable extends React.Component {
773
768
  }
774
769
 
775
770
  if (column.filter !== false) {
776
- if (typeof column.customBodyRender === 'function') {
771
+ if (typeof column.customBodyRender === "function") {
777
772
  const rowData = tableData[rowIndex].data;
778
773
  tableMeta = this.getTableMeta(rowIndex, colIndex, rowData, column, data, this.state, tableData);
779
774
  const funcResult = column.customBodyRender(value, tableMeta);
780
775
 
781
776
  if (React.isValidElement(funcResult) && funcResult.props.value) {
782
777
  value = funcResult.props.value;
783
- } else if (typeof funcResult === 'string') {
778
+ } else if (typeof funcResult === "string") {
784
779
  value = funcResult;
785
780
  }
786
781
  }
787
782
 
788
- if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
783
+ if (typeof value === "object" && !Array.isArray(value) && value !== null) {
789
784
  // it's extremely rare but possible to create an object without a toString method, ex: var x = Object.create(null);
790
785
  // so this check has to be made
791
- value = value.toString ? value.toString() : '';
786
+ value = value.toString ? value.toString() : "";
792
787
  }
793
788
 
794
789
  if (filterData[colIndex].indexOf(value) < 0 && !Array.isArray(value)) {
@@ -796,8 +791,8 @@ class MUIDataTable extends React.Component {
796
791
  } else if (Array.isArray(value)) {
797
792
  value.forEach((element) => {
798
793
  let elmVal;
799
- if ((typeof element === 'object' && element !== null) || typeof element === 'function') {
800
- elmVal = element.toString ? element.toString() : '';
794
+ if ((typeof element === "object" && element !== null) || typeof element === "function") {
795
+ elmVal = element.toString ? element.toString() : "";
801
796
  } else {
802
797
  elmVal = element;
803
798
  }
@@ -814,7 +809,7 @@ class MUIDataTable extends React.Component {
814
809
  if (Array.isArray(column.filterOptions)) {
815
810
  filterData[colIndex] = cloneDeep(column.filterOptions);
816
811
  this.warnDep(
817
- 'filterOptions must now be an object. see https://github.com/gregnb/mui-datatables/tree/master/examples/customize-filter example',
812
+ "filterOptions must now be an object. see https://github.com/gregnb/mui-datatables/tree/master/examples/customize-filter example",
818
813
  );
819
814
  } else if (Array.isArray(column.filterOptions.names)) {
820
815
  filterData[colIndex] = cloneDeep(column.filterOptions.names);
@@ -854,7 +849,7 @@ class MUIDataTable extends React.Component {
854
849
 
855
850
  if (TABLE_LOAD.INITIAL) {
856
851
  // Multiple row selection customization
857
- if (this.options.rowsSelected && this.options.rowsSelected.length && this.options.selectableRows === 'multiple') {
852
+ if (this.options.rowsSelected && this.options.rowsSelected.length && this.options.selectableRows === "multiple") {
858
853
  this.options.rowsSelected
859
854
  .filter((selectedRowIndex) => selectedRowIndex === 0 || (Number(selectedRowIndex) && selectedRowIndex > 0))
860
855
  .forEach((row) => {
@@ -875,7 +870,7 @@ class MUIDataTable extends React.Component {
875
870
  } else if (
876
871
  this.options.rowsSelected &&
877
872
  this.options.rowsSelected.length === 1 &&
878
- this.options.selectableRows === 'single'
873
+ this.options.selectableRows === "single"
879
874
  ) {
880
875
  let rowPos = this.options.rowsSelected[0];
881
876
 
@@ -891,12 +886,12 @@ class MUIDataTable extends React.Component {
891
886
  } else if (
892
887
  this.options.rowsSelected &&
893
888
  this.options.rowsSelected.length > 1 &&
894
- this.options.selectableRows === 'single'
889
+ this.options.selectableRows === "single"
895
890
  ) {
896
891
  console.error(
897
892
  'Multiple values provided for selectableRows, but selectableRows set to "single". Either supply only a single value or use "multiple".',
898
893
  );
899
- } else if (typeof this.options.rowsSelected === 'undefined' && dataUpdated === false) {
894
+ } else if (typeof this.options.rowsSelected === "undefined" && dataUpdated === false) {
900
895
  if (this.state.selectedRows) {
901
896
  selectedRowsData = Object.assign({}, this.state.selectedRows);
902
897
  }
@@ -916,7 +911,7 @@ class MUIDataTable extends React.Component {
916
911
  expandedRowsData.data.push({ index: rowPos, dataIndex: row });
917
912
  expandedRowsData.lookup[row] = true;
918
913
  });
919
- } else if (typeof this.options.rowsExpanded === 'undefined' && dataUpdated === false && this.state.expandedRows) {
914
+ } else if (typeof this.options.rowsExpanded === "undefined" && dataUpdated === false && this.state.expandedRows) {
920
915
  expandedRowsData = Object.assign({}, this.state.expandedRows);
921
916
  }
922
917
  }
@@ -999,7 +994,7 @@ class MUIDataTable extends React.Component {
999
994
 
1000
995
  /* drill down to get the value of a cell */
1001
996
  columnValue =
1002
- typeof funcResult === 'string' || !funcResult
997
+ typeof funcResult === "string" || !funcResult
1003
998
  ? funcResult
1004
999
  : funcResult.props && funcResult.props.value
1005
1000
  ? funcResult.props.value
@@ -1010,23 +1005,23 @@ class MUIDataTable extends React.Component {
1010
1005
  displayRow.push(columnDisplay);
1011
1006
  }
1012
1007
 
1013
- const columnVal = columnValue === null || columnValue === undefined ? '' : columnValue.toString();
1008
+ const columnVal = columnValue === null || columnValue === undefined ? "" : columnValue.toString();
1014
1009
 
1015
1010
  const filterVal = filterList[index];
1016
1011
  const caseSensitive = options.caseSensitive;
1017
1012
  const filterType = column.filterType || options.filterType;
1018
- if (filterVal.length || filterType === 'custom') {
1013
+ if (filterVal.length || filterType === "custom") {
1019
1014
  if (column.filterOptions && column.filterOptions.logic) {
1020
1015
  if (column.filterOptions.logic(columnValue, filterVal, row)) isFiltered = true;
1021
- } else if (filterType === 'textField' && !this.hasSearchText(columnVal, filterVal, caseSensitive)) {
1016
+ } else if (filterType === "textField" && !this.hasSearchText(columnVal, filterVal, caseSensitive)) {
1022
1017
  isFiltered = true;
1023
1018
  } else if (
1024
- filterType !== 'textField' &&
1019
+ filterType !== "textField" &&
1025
1020
  Array.isArray(columnValue) === false &&
1026
1021
  filterVal.indexOf(columnValue) < 0
1027
1022
  ) {
1028
1023
  isFiltered = true;
1029
- } else if (filterType !== 'textField' && Array.isArray(columnValue)) {
1024
+ } else if (filterType !== "textField" && Array.isArray(columnValue)) {
1030
1025
  if (options.filterArrayFullMatch) {
1031
1026
  //true if every filterVal exists in columnVal, false otherwise
1032
1027
  const isFullMatch = filterVal.every((el) => {
@@ -1050,9 +1045,9 @@ class MUIDataTable extends React.Component {
1050
1045
 
1051
1046
  if (
1052
1047
  searchText &&
1053
- column.display !== 'excluded' &&
1048
+ column.display !== "excluded" &&
1054
1049
  this.hasSearchText(columnVal, searchText, caseSensitive) &&
1055
- column.display !== 'false' &&
1050
+ column.display !== "false" &&
1056
1051
  column.searchable
1057
1052
  ) {
1058
1053
  isSearchFound = true;
@@ -1063,8 +1058,8 @@ class MUIDataTable extends React.Component {
1063
1058
 
1064
1059
  if (searchText && customSearch) {
1065
1060
  const customSearchResult = customSearch(searchText, row, columns);
1066
- if (typeof customSearchResult !== 'boolean') {
1067
- console.error('customSearch must return a boolean');
1061
+ if (typeof customSearchResult !== "boolean") {
1062
+ console.error("customSearch must return a boolean");
1068
1063
  } else {
1069
1064
  isSearchFound = customSearchResult;
1070
1065
  }
@@ -1072,7 +1067,7 @@ class MUIDataTable extends React.Component {
1072
1067
 
1073
1068
  if (options.serverSide) {
1074
1069
  if (customSearch) {
1075
- console.warn('Server-side filtering is enabled, hence custom search will be ignored.');
1070
+ console.warn("Server-side filtering is enabled, hence custom search will be ignored.");
1076
1071
  }
1077
1072
 
1078
1073
  return displayRow;
@@ -1113,7 +1108,7 @@ class MUIDataTable extends React.Component {
1113
1108
  const filterValue =
1114
1109
  React.isValidElement(funcResult) && funcResult.props.value
1115
1110
  ? funcResult.props.value
1116
- : prevState['data'][row][index];
1111
+ : prevState["data"][row][index];
1117
1112
 
1118
1113
  const prevFilterIndex = filterData[index].indexOf(filterValue);
1119
1114
  filterData[index].splice(prevFilterIndex, 1, filterValue);
@@ -1186,17 +1181,17 @@ class MUIDataTable extends React.Component {
1186
1181
  this.setState(
1187
1182
  (prevState) => {
1188
1183
  const columns = cloneDeep(prevState.columns);
1189
- columns[index].display = columns[index].display === 'true' ? 'false' : 'true';
1184
+ columns[index].display = columns[index].display === "true" ? "false" : "true";
1190
1185
  return {
1191
1186
  columns: columns,
1192
1187
  };
1193
1188
  },
1194
1189
  () => {
1195
- this.setTableAction('viewColumnsChange');
1190
+ this.setTableAction("viewColumnsChange");
1196
1191
  var cb = this.options.onViewColumnsChange || this.options.onColumnViewChange;
1197
1192
 
1198
1193
  if (cb) {
1199
- cb(this.state.columns[index].name, this.state.columns[index].display === 'true' ? 'add' : 'remove');
1194
+ cb(this.state.columns[index].name, this.state.columns[index].display === "true" ? "add" : "remove");
1200
1195
  }
1201
1196
  },
1202
1197
  );
@@ -1210,11 +1205,11 @@ class MUIDataTable extends React.Component {
1210
1205
  };
1211
1206
  },
1212
1207
  () => {
1213
- this.setTableAction('viewColumnsChange');
1208
+ this.setTableAction("viewColumnsChange");
1214
1209
  var cb = this.options.onViewColumnsChange || this.options.onColumnViewChange;
1215
1210
 
1216
1211
  if (cb) {
1217
- cb(null, 'update', newColumns);
1212
+ cb(null, "update", newColumns);
1218
1213
  }
1219
1214
  },
1220
1215
  );
@@ -1222,14 +1217,14 @@ class MUIDataTable extends React.Component {
1222
1217
 
1223
1218
  getSortDirectionLabel(sortOrder) {
1224
1219
  switch (sortOrder.direction) {
1225
- case 'asc':
1226
- return 'ascending';
1227
- case 'desc':
1228
- return 'descending';
1229
- case 'none':
1230
- return 'none';
1220
+ case "asc":
1221
+ return "ascending";
1222
+ case "desc":
1223
+ return "descending";
1224
+ case "none":
1225
+ return "none";
1231
1226
  default:
1232
- return '';
1227
+ return "";
1233
1228
  }
1234
1229
  }
1235
1230
 
@@ -1247,14 +1242,14 @@ class MUIDataTable extends React.Component {
1247
1242
  (prevState) => {
1248
1243
  let columns = cloneDeep(prevState.columns);
1249
1244
  let data = prevState.data;
1250
- let newOrder = columns[index].sortDescFirst ? 'desc' : 'asc'; // default
1245
+ let newOrder = columns[index].sortDescFirst ? "desc" : "asc"; // default
1251
1246
 
1252
- let sequenceOrder = ['asc', 'desc'];
1247
+ let sequenceOrder = ["asc", "desc"];
1253
1248
  if (columns[index].sortDescFirst) {
1254
- sequenceOrder = ['desc', 'asc'];
1249
+ sequenceOrder = ["desc", "asc"];
1255
1250
  }
1256
1251
  if (columns[index].sortThirdClickReset) {
1257
- sequenceOrder.push('none');
1252
+ sequenceOrder.push("none");
1258
1253
  }
1259
1254
 
1260
1255
  if (columns[index].name === this.state.sortOrder.name) {
@@ -1311,7 +1306,7 @@ class MUIDataTable extends React.Component {
1311
1306
  return newState;
1312
1307
  },
1313
1308
  () => {
1314
- this.setTableAction('sort');
1309
+ this.setTableAction("sort");
1315
1310
 
1316
1311
  if (this.options.onColumnSortChange) {
1317
1312
  this.options.onColumnSortChange(this.state.sortOrder.name, this.state.sortOrder.direction);
@@ -1329,7 +1324,7 @@ class MUIDataTable extends React.Component {
1329
1324
  page: getPageValue(rowCount, rows, this.state.page),
1330
1325
  }),
1331
1326
  () => {
1332
- this.setTableAction('changeRowsPerPage');
1327
+ this.setTableAction("changeRowsPerPage");
1333
1328
 
1334
1329
  if (this.options.onChangeRowsPerPage) {
1335
1330
  this.options.onChangeRowsPerPage(this.state.rowsPerPage);
@@ -1344,7 +1339,7 @@ class MUIDataTable extends React.Component {
1344
1339
  page: page,
1345
1340
  }),
1346
1341
  () => {
1347
- this.setTableAction('changePage');
1342
+ this.setTableAction("changePage");
1348
1343
  if (this.options.onChangePage) {
1349
1344
  this.options.onChangePage(this.state.page);
1350
1345
  }
@@ -1361,7 +1356,7 @@ class MUIDataTable extends React.Component {
1361
1356
  : this.getDisplayData(prevState.columns, prevState.data, prevState.filterList, null, null, this.props),
1362
1357
  }),
1363
1358
  () => {
1364
- this.setTableAction('search');
1359
+ this.setTableAction("search");
1365
1360
  if (this.options.onSearchChange) {
1366
1361
  this.options.onSearchChange(this.state.searchText);
1367
1362
  }
@@ -1379,7 +1374,7 @@ class MUIDataTable extends React.Component {
1379
1374
  : this.getDisplayData(prevState.columns, prevState.data, prevState.filterList, text, null, this.props),
1380
1375
  }),
1381
1376
  () => {
1382
- this.setTableAction('search');
1377
+ this.setTableAction("search");
1383
1378
  if (this.options.onSearchChange) {
1384
1379
  this.options.onSearchChange(this.state.searchText);
1385
1380
  }
@@ -1407,9 +1402,9 @@ class MUIDataTable extends React.Component {
1407
1402
  };
1408
1403
  },
1409
1404
  () => {
1410
- this.setTableAction('resetFilters');
1405
+ this.setTableAction("resetFilters");
1411
1406
  if (this.options.onFilterChange) {
1412
- this.options.onFilterChange(null, this.state.filterList, 'reset', null);
1407
+ this.options.onFilterChange(null, this.state.filterList, "reset", null);
1413
1408
  }
1414
1409
  },
1415
1410
  );
@@ -1419,19 +1414,19 @@ class MUIDataTable extends React.Component {
1419
1414
  const filterPos = filterList[index].findIndex((filter) => isEqual(filter, value));
1420
1415
 
1421
1416
  switch (type) {
1422
- case 'checkbox':
1417
+ case "checkbox":
1423
1418
  filterPos >= 0 ? filterList[index].splice(filterPos, 1) : filterList[index].push(value);
1424
1419
  break;
1425
- case 'chip':
1420
+ case "chip":
1426
1421
  filterPos >= 0 ? filterList[index].splice(filterPos, 1) : filterList[index].push(value);
1427
1422
  break;
1428
- case 'multiselect':
1429
- filterList[index] = value === '' ? [] : value;
1423
+ case "multiselect":
1424
+ filterList[index] = value === "" ? [] : value;
1430
1425
  break;
1431
- case 'dropdown':
1426
+ case "dropdown":
1432
1427
  filterList[index] = value;
1433
1428
  break;
1434
- case 'custom':
1429
+ case "custom":
1435
1430
  if (customUpdate) {
1436
1431
  filterList = customUpdate(filterList, filterPos, index);
1437
1432
  } else {
@@ -1439,7 +1434,7 @@ class MUIDataTable extends React.Component {
1439
1434
  }
1440
1435
  break;
1441
1436
  default:
1442
- filterList[index] = filterPos >= 0 || value === '' ? [] : [value];
1437
+ filterList[index] = filterPos >= 0 || value === "" ? [] : [value];
1443
1438
  }
1444
1439
  };
1445
1440
 
@@ -1466,7 +1461,7 @@ class MUIDataTable extends React.Component {
1466
1461
  };
1467
1462
  },
1468
1463
  () => {
1469
- this.setTableAction('filterChange');
1464
+ this.setTableAction("filterChange");
1470
1465
  if (this.options.onFilterChange) {
1471
1466
  this.options.onFilterChange(column, this.state.filterList, type, index, this.state.displayData);
1472
1467
  }
@@ -1514,7 +1509,7 @@ class MUIDataTable extends React.Component {
1514
1509
  },
1515
1510
  },
1516
1511
  () => {
1517
- this.setTableAction('expandRow');
1512
+ this.setTableAction("expandRow");
1518
1513
  if (this.options.onRowExpansionChange) {
1519
1514
  this.options.onRowExpansionChange(
1520
1515
  affecttedRows,
@@ -1538,7 +1533,7 @@ class MUIDataTable extends React.Component {
1538
1533
  };
1539
1534
  },
1540
1535
  () => {
1541
- this.setTableAction('columnOrderChange');
1536
+ this.setTableAction("columnOrderChange");
1542
1537
  if (this.options.onColumnOrderChange) {
1543
1538
  this.options.onColumnOrderChange(this.state.columnOrder, columnIndex, newPosition);
1544
1539
  }
@@ -1573,7 +1568,7 @@ class MUIDataTable extends React.Component {
1573
1568
  TABLE_LOAD.UPDATE,
1574
1569
  true,
1575
1570
  () => {
1576
- this.setTableAction('rowDelete');
1571
+ this.setTableAction("rowDelete");
1577
1572
  },
1578
1573
  );
1579
1574
  };
@@ -1613,7 +1608,7 @@ class MUIDataTable extends React.Component {
1613
1608
  },
1614
1609
  },
1615
1610
  () => {
1616
- this.setTableAction('rowExpansionChange');
1611
+ this.setTableAction("rowExpansionChange");
1617
1612
  if (this.options.onRowExpansionChange || this.options.onRowsExpand) {
1618
1613
  let expandCallback = this.options.onRowExpansionChange || this.options.onRowsExpand;
1619
1614
  expandCallback(this.state.curExpandedRows, this.state.expandedRows.data);
@@ -1625,11 +1620,11 @@ class MUIDataTable extends React.Component {
1625
1620
  selectRowUpdate = (type, value, shiftAdjacentRows = []) => {
1626
1621
  // safety check
1627
1622
  const { selectableRows } = this.options;
1628
- if (selectableRows === 'none') {
1623
+ if (selectableRows === "none") {
1629
1624
  return;
1630
1625
  }
1631
1626
 
1632
- if (type === 'head') {
1627
+ if (type === "head") {
1633
1628
  const { isRowSelectable } = this.options;
1634
1629
  this.setState(
1635
1630
  (prevState) => {
@@ -1675,7 +1670,7 @@ class MUIDataTable extends React.Component {
1675
1670
  };
1676
1671
  },
1677
1672
  () => {
1678
- this.setTableAction('rowSelectionChange');
1673
+ this.setTableAction("rowSelectionChange");
1679
1674
  if (this.options.onRowSelectionChange) {
1680
1675
  this.options.onRowSelectionChange(
1681
1676
  this.state.curSelectedRows,
@@ -1691,7 +1686,7 @@ class MUIDataTable extends React.Component {
1691
1686
  }
1692
1687
  },
1693
1688
  );
1694
- } else if (type === 'cell') {
1689
+ } else if (type === "cell") {
1695
1690
  this.setState(
1696
1691
  (prevState) => {
1697
1692
  const { dataIndex } = value;
@@ -1717,7 +1712,7 @@ class MUIDataTable extends React.Component {
1717
1712
  }
1718
1713
  }
1719
1714
  }
1720
- } else if (selectableRows === 'single') {
1715
+ } else if (selectableRows === "single") {
1721
1716
  selectedRows = [value];
1722
1717
  } else {
1723
1718
  // multiple
@@ -1743,7 +1738,7 @@ class MUIDataTable extends React.Component {
1743
1738
  };
1744
1739
  },
1745
1740
  () => {
1746
- this.setTableAction('rowSelectionChange');
1741
+ this.setTableAction("rowSelectionChange");
1747
1742
  if (this.options.onRowSelectionChange) {
1748
1743
  this.options.onRowSelectionChange(
1749
1744
  [value],
@@ -1759,7 +1754,7 @@ class MUIDataTable extends React.Component {
1759
1754
  }
1760
1755
  },
1761
1756
  );
1762
- } else if (type === 'custom') {
1757
+ } else if (type === "custom") {
1763
1758
  const { displayData } = this.state;
1764
1759
 
1765
1760
  const data = value.map((row) => ({ index: row, dataIndex: displayData[row].dataIndex }));
@@ -1771,7 +1766,7 @@ class MUIDataTable extends React.Component {
1771
1766
  previousSelectedRow: null,
1772
1767
  },
1773
1768
  () => {
1774
- this.setTableAction('rowSelectionChange');
1769
+ this.setTableAction("rowSelectionChange");
1775
1770
  if (this.options.onRowSelectionChange) {
1776
1771
  this.options.onRowSelectionChange(
1777
1772
  this.state.selectedRows.data,
@@ -1794,12 +1789,12 @@ class MUIDataTable extends React.Component {
1794
1789
  let hasCustomTableSort = this.options.customSort && !columnSortCompare;
1795
1790
  let meta = { selectedRows: this.state.selectedRows }; // meta for customSort
1796
1791
  let dataSrc = hasCustomTableSort
1797
- ? this.options.customSort(data, col, order || (this.options.sortDescFirst ? 'desc' : 'asc'), meta)
1792
+ ? this.options.customSort(data, col, order || (this.options.sortDescFirst ? "desc" : "asc"), meta)
1798
1793
  : data;
1799
1794
 
1800
1795
  // reset the order by index
1801
1796
  let noSortData;
1802
- if (order === 'none') {
1797
+ if (order === "none") {
1803
1798
  noSortData = data.reduce((r, i) => {
1804
1799
  r[i.index] = i;
1805
1800
  return r;
@@ -1830,7 +1825,7 @@ class MUIDataTable extends React.Component {
1830
1825
  }
1831
1826
 
1832
1827
  return {
1833
- data: order === 'none' ? noSortData : tableData,
1828
+ data: order === "none" ? noSortData : tableData,
1834
1829
  selectedRows: {
1835
1830
  lookup: buildMap(selectedRows),
1836
1831
  data: selectedRows,
@@ -1894,35 +1889,35 @@ class MUIDataTable extends React.Component {
1894
1889
 
1895
1890
  switch (responsiveOption) {
1896
1891
  // deprecated
1897
- case 'scroll':
1892
+ case "scroll":
1898
1893
  responsiveClass = classes.responsiveScroll;
1899
- maxHeight = '499px';
1894
+ maxHeight = "499px";
1900
1895
  break;
1901
1896
  // deprecated
1902
- case 'scrollMaxHeight':
1897
+ case "scrollMaxHeight":
1903
1898
  responsiveClass = classes.responsiveScrollMaxHeight;
1904
- maxHeight = '499px';
1899
+ maxHeight = "499px";
1905
1900
  break;
1906
1901
  // deprecated
1907
- case 'scrollFullHeight':
1902
+ case "scrollFullHeight":
1908
1903
  responsiveClass = classes.responsiveScrollFullHeight;
1909
- maxHeight = 'none';
1904
+ maxHeight = "none";
1910
1905
  break;
1911
1906
  // deprecated
1912
- case 'scrollFullHeightFullWidth':
1907
+ case "scrollFullHeightFullWidth":
1913
1908
  responsiveClass = classes.responsiveScrollFullHeight;
1914
1909
  paperClasses = `${classes.paperResponsiveScrollFullHeightFullWidth} ${className}`;
1915
1910
  break;
1916
1911
  // deprecated
1917
- case 'stacked':
1912
+ case "stacked":
1918
1913
  responsiveClass = classes.responsiveStacked;
1919
- maxHeight = 'none';
1914
+ maxHeight = "none";
1920
1915
  break;
1921
1916
  // deprecated
1922
- case 'stackedFullWidth':
1917
+ case "stackedFullWidth":
1923
1918
  responsiveClass = classes.responsiveStackedFullWidth;
1924
1919
  paperClasses = `${classes.paperResponsiveScrollFullHeightFullWidth} ${className}`;
1925
- maxHeight = 'none';
1920
+ maxHeight = "none";
1926
1921
  break;
1927
1922
 
1928
1923
  default:
@@ -1943,7 +1938,7 @@ class MUIDataTable extends React.Component {
1943
1938
  delete tableProps.className; // remove className from props to avoid the className being applied twice
1944
1939
 
1945
1940
  const dndProps = {};
1946
- if (typeof window !== 'undefined') {
1941
+ if (typeof window !== "undefined") {
1947
1942
  dndProps.context = window;
1948
1943
  }
1949
1944
 
@@ -2004,7 +1999,7 @@ class MUIDataTable extends React.Component {
2004
1999
  filterUpdate={this.filterUpdate}
2005
2000
  columnNames={columnNames}
2006
2001
  />
2007
- <div style={{ position: 'relative', ...tableHeightVal }} className={responsiveClass}>
2002
+ <div style={{ position: "relative", ...tableHeightVal }} className={responsiveClass}>
2008
2003
  {(this.options.resizableColumns === true ||
2009
2004
  (this.options.resizableColumns && this.options.resizableColumns.enabled)) && (
2010
2005
  <TableResizeComponent
@@ -2020,10 +2015,11 @@ class MUIDataTable extends React.Component {
2020
2015
  const components = (
2021
2016
  <MuiTable
2022
2017
  ref={(el) => (this.tableRef = el)}
2023
- tabIndex={'0'}
2024
- role={'grid'}
2018
+ tabIndex={"0"}
2019
+ role={"grid"}
2025
2020
  className={tableClassNames}
2026
- {...tableProps}>
2021
+ {...tableProps}
2022
+ >
2027
2023
  <caption className={classes.caption}>{title}</caption>
2028
2024
  <TableHeadComponent
2029
2025
  columns={columns}
@@ -2096,7 +2092,7 @@ class MUIDataTable extends React.Component {
2096
2092
  changeRowsPerPage={this.changeRowsPerPage}
2097
2093
  changePage={this.changePage}
2098
2094
  />
2099
- <div className={classes.liveAnnounce} aria-live={'polite'}>
2095
+ <div className={classes.liveAnnounce} aria-live={"polite"}>
2100
2096
  {announceText}
2101
2097
  </div>
2102
2098
  </Paper>
@@ -2104,4 +2100,4 @@ class MUIDataTable extends React.Component {
2104
2100
  }
2105
2101
  }
2106
2102
 
2107
- export default withStyles(MUIDataTable, defaultTableStyles, { name: 'MUIDataTable' });
2103
+ export default withStyles(MUIDataTable, defaultTableStyles, { name: "MUIDataTable" });