material-react-table 0.6.3 → 0.6.4

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.
@@ -183,7 +183,7 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
183
183
  return applyFiltersToColumns(props.columns);
184
184
  }, [props.columns, applyFiltersToColumns]);
185
185
  var data = useMemo(function () {
186
- return !props.isLoading || !!props.data.length ? props.data : [].concat(Array(10)).map(function (_) {
186
+ return !props.isLoading || !!props.data.length ? props.data : [].concat(Array(10).fill(null)).map(function (_) {
187
187
  return Object.assign.apply(Object, [{}].concat(findLowestLevelCols(props.columns).map(function (c) {
188
188
  var _ref3;
189
189
 
@@ -260,7 +260,7 @@ var MRT_FILTER_TYPE;
260
260
  MRT_FILTER_TYPE["STARTS_WITH"] = "startsWith";
261
261
  })(MRT_FILTER_TYPE || (MRT_FILTER_TYPE = {}));
262
262
 
263
- var fuzzyFilterFN = function fuzzyFilterFN(rows, columnIds, filterValue) {
263
+ var fuzzy = function fuzzy(rows, columnIds, filterValue) {
264
264
  return matchSorter(rows, filterValue.toString().trim(), {
265
265
  keys: Array.isArray(columnIds) ? columnIds.map(function (c) {
266
266
  return "values." + c;
@@ -271,111 +271,111 @@ var fuzzyFilterFN = function fuzzyFilterFN(rows, columnIds, filterValue) {
271
271
  });
272
272
  };
273
273
 
274
- fuzzyFilterFN.autoRemove = function (val) {
274
+ fuzzy.autoRemove = function (val) {
275
275
  return !val;
276
276
  };
277
277
 
278
- var containsFilterFN = function containsFilterFN(rows, id, filterValue) {
278
+ var contains = function contains(rows, id, filterValue) {
279
279
  return rows.filter(function (row) {
280
280
  return row.values[id].toString().toLowerCase().trim().includes(filterValue.toString().toLowerCase().trim());
281
281
  });
282
282
  };
283
283
 
284
- containsFilterFN.autoRemove = function (val) {
284
+ contains.autoRemove = function (val) {
285
285
  return !val;
286
286
  };
287
287
 
288
- var startsWithFilterFN = function startsWithFilterFN(rows, id, filterValue) {
288
+ var startsWith = function startsWith(rows, id, filterValue) {
289
289
  return rows.filter(function (row) {
290
290
  return row.values[id].toString().toLowerCase().trim().startsWith(filterValue.toString().toLowerCase().trim());
291
291
  });
292
292
  };
293
293
 
294
- startsWithFilterFN.autoRemove = function (val) {
294
+ startsWith.autoRemove = function (val) {
295
295
  return !val;
296
296
  };
297
297
 
298
- var endsWithFilterFN = function endsWithFilterFN(rows, id, filterValue) {
298
+ var endsWith = function endsWith(rows, id, filterValue) {
299
299
  return rows.filter(function (row) {
300
300
  return row.values[id].toString().toLowerCase().trim().endsWith(filterValue.toString().toLowerCase().trim());
301
301
  });
302
302
  };
303
303
 
304
- endsWithFilterFN.autoRemove = function (val) {
304
+ endsWith.autoRemove = function (val) {
305
305
  return !val;
306
306
  };
307
307
 
308
- var equalsFilterFN = function equalsFilterFN(rows, id, filterValue) {
308
+ var equals = function equals(rows, id, filterValue) {
309
309
  return rows.filter(function (row) {
310
310
  return row.values[id].toString().toLowerCase().trim() === filterValue.toString().toLowerCase().trim();
311
311
  });
312
312
  };
313
313
 
314
- equalsFilterFN.autoRemove = function (val) {
314
+ equals.autoRemove = function (val) {
315
315
  return !val;
316
316
  };
317
317
 
318
- var notEqualsFilterFN = function notEqualsFilterFN(rows, id, filterValue) {
318
+ var notEquals = function notEquals(rows, id, filterValue) {
319
319
  return rows.filter(function (row) {
320
320
  return row.values[id].toString().toLowerCase().trim() !== filterValue.toString().toLowerCase().trim();
321
321
  });
322
322
  };
323
323
 
324
- notEqualsFilterFN.autoRemove = function (val) {
324
+ notEquals.autoRemove = function (val) {
325
325
  return !val;
326
326
  };
327
327
 
328
- var greaterThanFilterFN = function greaterThanFilterFN(rows, id, filterValue) {
328
+ var greaterThan = function greaterThan(rows, id, filterValue) {
329
329
  return rows.filter(function (row) {
330
330
  return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] > +filterValue : row.values[id].toString().toLowerCase().trim() > filterValue.toString().toLowerCase().trim();
331
331
  });
332
332
  };
333
333
 
334
- greaterThanFilterFN.autoRemove = function (val) {
334
+ greaterThan.autoRemove = function (val) {
335
335
  return !val;
336
336
  };
337
337
 
338
- var lessThanFilterFN = function lessThanFilterFN(rows, id, filterValue) {
338
+ var lessThan = function lessThan(rows, id, filterValue) {
339
339
  return rows.filter(function (row) {
340
340
  return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] < +filterValue : row.values[id].toString().toLowerCase().trim() < filterValue.toString().toLowerCase().trim();
341
341
  });
342
342
  };
343
343
 
344
- lessThanFilterFN.autoRemove = function (val) {
344
+ lessThan.autoRemove = function (val) {
345
345
  return !val;
346
346
  };
347
347
 
348
- var emptyFilterFN = function emptyFilterFN(rows, id, _filterValue) {
348
+ var empty = function empty(rows, id, _filterValue) {
349
349
  return rows.filter(function (row) {
350
350
  return !row.values[id].toString().toLowerCase().trim();
351
351
  });
352
352
  };
353
353
 
354
- emptyFilterFN.autoRemove = function (val) {
354
+ empty.autoRemove = function (val) {
355
355
  return !val;
356
356
  };
357
357
 
358
- var notEmptyFilterFN = function notEmptyFilterFN(rows, id, _filterValue) {
358
+ var notEmpty = function notEmpty(rows, id, _filterValue) {
359
359
  return rows.filter(function (row) {
360
360
  return !!row.values[id].toString().toLowerCase().trim();
361
361
  });
362
362
  };
363
363
 
364
- notEmptyFilterFN.autoRemove = function (val) {
364
+ notEmpty.autoRemove = function (val) {
365
365
  return !val;
366
366
  };
367
367
 
368
368
  var defaultFilterFNs = {
369
- contains: containsFilterFN,
370
- empty: emptyFilterFN,
371
- endsWith: endsWithFilterFN,
372
- equals: equalsFilterFN,
373
- fuzzy: fuzzyFilterFN,
374
- greaterThan: greaterThanFilterFN,
375
- lessThan: lessThanFilterFN,
376
- notEmpty: notEmptyFilterFN,
377
- notEquals: notEqualsFilterFN,
378
- startsWith: startsWithFilterFN
369
+ contains: contains,
370
+ empty: empty,
371
+ endsWith: endsWith,
372
+ equals: equals,
373
+ fuzzy: fuzzy,
374
+ greaterThan: greaterThan,
375
+ lessThan: lessThan,
376
+ notEmpty: notEmpty,
377
+ notEquals: notEquals,
378
+ startsWith: startsWith
379
379
  };
380
380
 
381
381
  var commonMenuItemStyles = {
@@ -399,52 +399,52 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
399
399
  type: MRT_FILTER_TYPE.FUZZY,
400
400
  label: localization.filterFuzzy,
401
401
  divider: false,
402
- fn: fuzzyFilterFN
402
+ fn: fuzzy
403
403
  }, {
404
404
  type: MRT_FILTER_TYPE.CONTAINS,
405
405
  label: localization.filterContains,
406
406
  divider: true,
407
- fn: containsFilterFN
407
+ fn: contains
408
408
  }, {
409
409
  type: MRT_FILTER_TYPE.STARTS_WITH,
410
410
  label: localization.filterStartsWith,
411
411
  divider: false,
412
- fn: startsWithFilterFN
412
+ fn: startsWith
413
413
  }, {
414
414
  type: MRT_FILTER_TYPE.ENDS_WITH,
415
415
  label: localization.filterEndsWith,
416
416
  divider: true,
417
- fn: endsWithFilterFN
417
+ fn: endsWith
418
418
  }, {
419
419
  type: MRT_FILTER_TYPE.EQUALS,
420
420
  label: localization.filterEquals,
421
421
  divider: false,
422
- fn: equalsFilterFN
422
+ fn: equals
423
423
  }, {
424
424
  type: MRT_FILTER_TYPE.NOT_EQUALS,
425
425
  label: localization.filterNotEquals,
426
426
  divider: true,
427
- fn: notEqualsFilterFN
427
+ fn: notEquals
428
428
  }, {
429
429
  type: MRT_FILTER_TYPE.GREATER_THAN,
430
430
  label: localization.filterGreaterThan,
431
431
  divider: false,
432
- fn: greaterThanFilterFN
432
+ fn: greaterThan
433
433
  }, {
434
434
  type: MRT_FILTER_TYPE.LESS_THAN,
435
435
  label: localization.filterLessThan,
436
436
  divider: true,
437
- fn: lessThanFilterFN
437
+ fn: lessThan
438
438
  }, {
439
439
  type: MRT_FILTER_TYPE.EMPTY,
440
440
  label: localization.filterEmpty,
441
441
  divider: false,
442
- fn: emptyFilterFN
442
+ fn: empty
443
443
  }, {
444
444
  type: MRT_FILTER_TYPE.NOT_EMPTY,
445
445
  label: localization.filterNotEmpty,
446
446
  divider: false,
447
- fn: notEmptyFilterFN
447
+ fn: notEmpty
448
448
  }];
449
449
  }, []);
450
450
 
@@ -496,7 +496,7 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
496
496
  };
497
497
 
498
498
  var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
499
- var _localization$filterB, _localization$clearFi, _column$filterSelectO;
499
+ var _localization$filterB, _localization$filterM, _localization$, _localization$clearFi, _column$filterSelectO;
500
500
 
501
501
  var column = _ref.column;
502
502
 
@@ -554,6 +554,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
554
554
  }));
555
555
  }
556
556
 
557
+ var filterId = "mrt-" + idPrefix + "-" + column.id + "-filter-text-field";
557
558
  var filterType = tableInstance.state.currentFilterTypes[column.id];
558
559
  var isSelectFilter = !!column.filterSelectOptions;
559
560
  var filterChipLabel = !(filterType instanceof Function) && [MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(filterType) ? //@ts-ignore
@@ -561,7 +562,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
561
562
  var filterPlaceholder = (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header));
562
563
  return React.createElement(React.Fragment, null, React.createElement(TextField, Object.assign({
563
564
  fullWidth: true,
564
- id: "mrt-" + idPrefix + "-" + column.id + "-filter-text-field",
565
+ id: filterId,
565
566
  inputProps: {
566
567
  disabled: !!filterChipLabel,
567
568
  sx: {
@@ -570,8 +571,11 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
570
571
  },
571
572
  title: filterPlaceholder
572
573
  },
573
- helperText: filterType instanceof Function ? '' : localization.filterMode.replace('{filterType}', // @ts-ignore
574
- localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))]),
574
+ helperText: React.createElement("label", {
575
+ htmlFor: filterId
576
+ }, filterType instanceof Function ? (_localization$filterM = localization.filterMode.replace('{filterType}', // @ts-ignore
577
+ (_localization$ = localization["filter" + (filterType.name.charAt(0).toUpperCase() + filterType.name.slice(1))]) != null ? _localization$ : '')) != null ? _localization$filterM : '' : localization.filterMode.replace('{filterType}', // @ts-ignore
578
+ localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))])),
575
579
  FormHelperTextProps: {
576
580
  sx: {
577
581
  fontSize: '0.6rem',
@@ -2971,7 +2975,7 @@ var MRT_TableContainer = function MRT_TableContainer() {
2971
2975
  height: fullScreen ? '100%' : undefined,
2972
2976
  left: fullScreen ? '0' : undefined,
2973
2977
  m: fullScreen ? '0' : undefined,
2974
- overflowY: 'hidden',
2978
+ overflowY: !fullScreen ? 'hidden' : undefined,
2975
2979
  position: fullScreen ? 'fixed' : undefined,
2976
2980
  right: fullScreen ? '0' : undefined,
2977
2981
  top: fullScreen ? '0' : undefined,