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.
@@ -143,5 +143,5 @@ export declare type MaterialReactTableProps<D extends {} = {}> = UseTableOptions
143
143
  MRT_FullScreenToggleButton: FC<IconButtonProps>;
144
144
  }) => ReactNode;
145
145
  };
146
- declare const _default: <D extends {}>({ defaultColumn, filterTypes, globalFilter, icons, localization, positionActionsColumn, positionPagination, positionToolbarActions, positionToolbarAlertBanner, ...rest }: MaterialReactTableProps<D>) => JSX.Element;
146
+ declare const _default: <D extends {} = {}>({ defaultColumn, filterTypes, globalFilter, icons, localization, positionActionsColumn, positionPagination, positionToolbarActions, positionToolbarAlertBanner, ...rest }: MaterialReactTableProps<D>) => JSX.Element;
147
147
  export default _default;
@@ -1,41 +1,41 @@
1
1
  import { MRT_Row } from '.';
2
- export declare const fuzzyFilterFN: {
2
+ export declare const fuzzy: {
3
3
  (rows: MRT_Row[], columnIds: string[] | string, filterValue: string | number): MRT_Row<{}>[];
4
4
  autoRemove(val: any): boolean;
5
5
  };
6
- export declare const containsFilterFN: {
6
+ export declare const contains: {
7
7
  (rows: MRT_Row[], id: string, filterValue: string | number): MRT_Row<{}>[];
8
8
  autoRemove(val: any): boolean;
9
9
  };
10
- export declare const startsWithFilterFN: {
10
+ export declare const startsWith: {
11
11
  (rows: MRT_Row[], id: string, filterValue: string | number): MRT_Row<{}>[];
12
12
  autoRemove(val: any): boolean;
13
13
  };
14
- export declare const endsWithFilterFN: {
14
+ export declare const endsWith: {
15
15
  (rows: MRT_Row[], id: string, filterValue: string | number): MRT_Row<{}>[];
16
16
  autoRemove(val: any): boolean;
17
17
  };
18
- export declare const equalsFilterFN: {
18
+ export declare const equals: {
19
19
  (rows: MRT_Row[], id: string, filterValue: string | number): MRT_Row<{}>[];
20
20
  autoRemove(val: any): boolean;
21
21
  };
22
- export declare const notEqualsFilterFN: {
22
+ export declare const notEquals: {
23
23
  (rows: MRT_Row[], id: string, filterValue: string | number): MRT_Row<{}>[];
24
24
  autoRemove(val: any): boolean;
25
25
  };
26
- export declare const greaterThanFilterFN: {
26
+ export declare const greaterThan: {
27
27
  (rows: MRT_Row[], id: string, filterValue: string | number): MRT_Row<{}>[];
28
28
  autoRemove(val: any): boolean;
29
29
  };
30
- export declare const lessThanFilterFN: {
30
+ export declare const lessThan: {
31
31
  (rows: MRT_Row[], id: string, filterValue: string | number): MRT_Row<{}>[];
32
32
  autoRemove(val: any): boolean;
33
33
  };
34
- export declare const emptyFilterFN: {
34
+ export declare const empty: {
35
35
  (rows: MRT_Row[], id: string, _filterValue: string | number): MRT_Row<{}>[];
36
36
  autoRemove(val: any): boolean;
37
37
  };
38
- export declare const notEmptyFilterFN: {
38
+ export declare const notEmpty: {
39
39
  (rows: MRT_Row[], id: string, _filterValue: string | number): MRT_Row<{}>[];
40
40
  autoRemove(val: any): boolean;
41
41
  };
@@ -190,7 +190,7 @@ var MaterialReactTableProvider = function MaterialReactTableProvider(props) {
190
190
  return applyFiltersToColumns(props.columns);
191
191
  }, [props.columns, applyFiltersToColumns]);
192
192
  var data = React.useMemo(function () {
193
- return !props.isLoading || !!props.data.length ? props.data : [].concat(Array(10)).map(function (_) {
193
+ return !props.isLoading || !!props.data.length ? props.data : [].concat(Array(10).fill(null)).map(function (_) {
194
194
  return Object.assign.apply(Object, [{}].concat(findLowestLevelCols(props.columns).map(function (c) {
195
195
  var _ref3;
196
196
 
@@ -267,7 +267,7 @@ var MRT_FILTER_TYPE;
267
267
  MRT_FILTER_TYPE["STARTS_WITH"] = "startsWith";
268
268
  })(MRT_FILTER_TYPE || (MRT_FILTER_TYPE = {}));
269
269
 
270
- var fuzzyFilterFN = function fuzzyFilterFN(rows, columnIds, filterValue) {
270
+ var fuzzy = function fuzzy(rows, columnIds, filterValue) {
271
271
  return matchSorter.matchSorter(rows, filterValue.toString().trim(), {
272
272
  keys: Array.isArray(columnIds) ? columnIds.map(function (c) {
273
273
  return "values." + c;
@@ -278,111 +278,111 @@ var fuzzyFilterFN = function fuzzyFilterFN(rows, columnIds, filterValue) {
278
278
  });
279
279
  };
280
280
 
281
- fuzzyFilterFN.autoRemove = function (val) {
281
+ fuzzy.autoRemove = function (val) {
282
282
  return !val;
283
283
  };
284
284
 
285
- var containsFilterFN = function containsFilterFN(rows, id, filterValue) {
285
+ var contains = function contains(rows, id, filterValue) {
286
286
  return rows.filter(function (row) {
287
287
  return row.values[id].toString().toLowerCase().trim().includes(filterValue.toString().toLowerCase().trim());
288
288
  });
289
289
  };
290
290
 
291
- containsFilterFN.autoRemove = function (val) {
291
+ contains.autoRemove = function (val) {
292
292
  return !val;
293
293
  };
294
294
 
295
- var startsWithFilterFN = function startsWithFilterFN(rows, id, filterValue) {
295
+ var startsWith = function startsWith(rows, id, filterValue) {
296
296
  return rows.filter(function (row) {
297
297
  return row.values[id].toString().toLowerCase().trim().startsWith(filterValue.toString().toLowerCase().trim());
298
298
  });
299
299
  };
300
300
 
301
- startsWithFilterFN.autoRemove = function (val) {
301
+ startsWith.autoRemove = function (val) {
302
302
  return !val;
303
303
  };
304
304
 
305
- var endsWithFilterFN = function endsWithFilterFN(rows, id, filterValue) {
305
+ var endsWith = function endsWith(rows, id, filterValue) {
306
306
  return rows.filter(function (row) {
307
307
  return row.values[id].toString().toLowerCase().trim().endsWith(filterValue.toString().toLowerCase().trim());
308
308
  });
309
309
  };
310
310
 
311
- endsWithFilterFN.autoRemove = function (val) {
311
+ endsWith.autoRemove = function (val) {
312
312
  return !val;
313
313
  };
314
314
 
315
- var equalsFilterFN = function equalsFilterFN(rows, id, filterValue) {
315
+ var equals = function equals(rows, id, filterValue) {
316
316
  return rows.filter(function (row) {
317
317
  return row.values[id].toString().toLowerCase().trim() === filterValue.toString().toLowerCase().trim();
318
318
  });
319
319
  };
320
320
 
321
- equalsFilterFN.autoRemove = function (val) {
321
+ equals.autoRemove = function (val) {
322
322
  return !val;
323
323
  };
324
324
 
325
- var notEqualsFilterFN = function notEqualsFilterFN(rows, id, filterValue) {
325
+ var notEquals = function notEquals(rows, id, filterValue) {
326
326
  return rows.filter(function (row) {
327
327
  return row.values[id].toString().toLowerCase().trim() !== filterValue.toString().toLowerCase().trim();
328
328
  });
329
329
  };
330
330
 
331
- notEqualsFilterFN.autoRemove = function (val) {
331
+ notEquals.autoRemove = function (val) {
332
332
  return !val;
333
333
  };
334
334
 
335
- var greaterThanFilterFN = function greaterThanFilterFN(rows, id, filterValue) {
335
+ var greaterThan = function greaterThan(rows, id, filterValue) {
336
336
  return rows.filter(function (row) {
337
337
  return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] > +filterValue : row.values[id].toString().toLowerCase().trim() > filterValue.toString().toLowerCase().trim();
338
338
  });
339
339
  };
340
340
 
341
- greaterThanFilterFN.autoRemove = function (val) {
341
+ greaterThan.autoRemove = function (val) {
342
342
  return !val;
343
343
  };
344
344
 
345
- var lessThanFilterFN = function lessThanFilterFN(rows, id, filterValue) {
345
+ var lessThan = function lessThan(rows, id, filterValue) {
346
346
  return rows.filter(function (row) {
347
347
  return !isNaN(+filterValue) && !isNaN(+row.values[id]) ? +row.values[id] < +filterValue : row.values[id].toString().toLowerCase().trim() < filterValue.toString().toLowerCase().trim();
348
348
  });
349
349
  };
350
350
 
351
- lessThanFilterFN.autoRemove = function (val) {
351
+ lessThan.autoRemove = function (val) {
352
352
  return !val;
353
353
  };
354
354
 
355
- var emptyFilterFN = function emptyFilterFN(rows, id, _filterValue) {
355
+ var empty = function empty(rows, id, _filterValue) {
356
356
  return rows.filter(function (row) {
357
357
  return !row.values[id].toString().toLowerCase().trim();
358
358
  });
359
359
  };
360
360
 
361
- emptyFilterFN.autoRemove = function (val) {
361
+ empty.autoRemove = function (val) {
362
362
  return !val;
363
363
  };
364
364
 
365
- var notEmptyFilterFN = function notEmptyFilterFN(rows, id, _filterValue) {
365
+ var notEmpty = function notEmpty(rows, id, _filterValue) {
366
366
  return rows.filter(function (row) {
367
367
  return !!row.values[id].toString().toLowerCase().trim();
368
368
  });
369
369
  };
370
370
 
371
- notEmptyFilterFN.autoRemove = function (val) {
371
+ notEmpty.autoRemove = function (val) {
372
372
  return !val;
373
373
  };
374
374
 
375
375
  var defaultFilterFNs = {
376
- contains: containsFilterFN,
377
- empty: emptyFilterFN,
378
- endsWith: endsWithFilterFN,
379
- equals: equalsFilterFN,
380
- fuzzy: fuzzyFilterFN,
381
- greaterThan: greaterThanFilterFN,
382
- lessThan: lessThanFilterFN,
383
- notEmpty: notEmptyFilterFN,
384
- notEquals: notEqualsFilterFN,
385
- startsWith: startsWithFilterFN
376
+ contains: contains,
377
+ empty: empty,
378
+ endsWith: endsWith,
379
+ equals: equals,
380
+ fuzzy: fuzzy,
381
+ greaterThan: greaterThan,
382
+ lessThan: lessThan,
383
+ notEmpty: notEmpty,
384
+ notEquals: notEquals,
385
+ startsWith: startsWith
386
386
  };
387
387
 
388
388
  var commonMenuItemStyles = {
@@ -406,52 +406,52 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
406
406
  type: MRT_FILTER_TYPE.FUZZY,
407
407
  label: localization.filterFuzzy,
408
408
  divider: false,
409
- fn: fuzzyFilterFN
409
+ fn: fuzzy
410
410
  }, {
411
411
  type: MRT_FILTER_TYPE.CONTAINS,
412
412
  label: localization.filterContains,
413
413
  divider: true,
414
- fn: containsFilterFN
414
+ fn: contains
415
415
  }, {
416
416
  type: MRT_FILTER_TYPE.STARTS_WITH,
417
417
  label: localization.filterStartsWith,
418
418
  divider: false,
419
- fn: startsWithFilterFN
419
+ fn: startsWith
420
420
  }, {
421
421
  type: MRT_FILTER_TYPE.ENDS_WITH,
422
422
  label: localization.filterEndsWith,
423
423
  divider: true,
424
- fn: endsWithFilterFN
424
+ fn: endsWith
425
425
  }, {
426
426
  type: MRT_FILTER_TYPE.EQUALS,
427
427
  label: localization.filterEquals,
428
428
  divider: false,
429
- fn: equalsFilterFN
429
+ fn: equals
430
430
  }, {
431
431
  type: MRT_FILTER_TYPE.NOT_EQUALS,
432
432
  label: localization.filterNotEquals,
433
433
  divider: true,
434
- fn: notEqualsFilterFN
434
+ fn: notEquals
435
435
  }, {
436
436
  type: MRT_FILTER_TYPE.GREATER_THAN,
437
437
  label: localization.filterGreaterThan,
438
438
  divider: false,
439
- fn: greaterThanFilterFN
439
+ fn: greaterThan
440
440
  }, {
441
441
  type: MRT_FILTER_TYPE.LESS_THAN,
442
442
  label: localization.filterLessThan,
443
443
  divider: true,
444
- fn: lessThanFilterFN
444
+ fn: lessThan
445
445
  }, {
446
446
  type: MRT_FILTER_TYPE.EMPTY,
447
447
  label: localization.filterEmpty,
448
448
  divider: false,
449
- fn: emptyFilterFN
449
+ fn: empty
450
450
  }, {
451
451
  type: MRT_FILTER_TYPE.NOT_EMPTY,
452
452
  label: localization.filterNotEmpty,
453
453
  divider: false,
454
- fn: notEmptyFilterFN
454
+ fn: notEmpty
455
455
  }];
456
456
  }, []);
457
457
 
@@ -503,7 +503,7 @@ var MRT_FilterTypeMenu = function MRT_FilterTypeMenu(_ref) {
503
503
  };
504
504
 
505
505
  var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
506
- var _localization$filterB, _localization$clearFi, _column$filterSelectO;
506
+ var _localization$filterB, _localization$filterM, _localization$, _localization$clearFi, _column$filterSelectO;
507
507
 
508
508
  var column = _ref.column;
509
509
 
@@ -561,6 +561,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
561
561
  }));
562
562
  }
563
563
 
564
+ var filterId = "mrt-" + idPrefix + "-" + column.id + "-filter-text-field";
564
565
  var filterType = tableInstance.state.currentFilterTypes[column.id];
565
566
  var isSelectFilter = !!column.filterSelectOptions;
566
567
  var filterChipLabel = !(filterType instanceof Function) && [MRT_FILTER_TYPE.EMPTY, MRT_FILTER_TYPE.NOT_EMPTY].includes(filterType) ? //@ts-ignore
@@ -568,7 +569,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
568
569
  var filterPlaceholder = (_localization$filterB = localization.filterByColumn) == null ? void 0 : _localization$filterB.replace('{column}', String(column.Header));
569
570
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(material.TextField, Object.assign({
570
571
  fullWidth: true,
571
- id: "mrt-" + idPrefix + "-" + column.id + "-filter-text-field",
572
+ id: filterId,
572
573
  inputProps: {
573
574
  disabled: !!filterChipLabel,
574
575
  sx: {
@@ -577,8 +578,11 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
577
578
  },
578
579
  title: filterPlaceholder
579
580
  },
580
- helperText: filterType instanceof Function ? '' : localization.filterMode.replace('{filterType}', // @ts-ignore
581
- localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))]),
581
+ helperText: React__default.createElement("label", {
582
+ htmlFor: filterId
583
+ }, filterType instanceof Function ? (_localization$filterM = localization.filterMode.replace('{filterType}', // @ts-ignore
584
+ (_localization$ = localization["filter" + (filterType.name.charAt(0).toUpperCase() + filterType.name.slice(1))]) != null ? _localization$ : '')) != null ? _localization$filterM : '' : localization.filterMode.replace('{filterType}', // @ts-ignore
585
+ localization["filter" + (filterType.charAt(0).toUpperCase() + filterType.slice(1))])),
582
586
  FormHelperTextProps: {
583
587
  sx: {
584
588
  fontSize: '0.6rem',
@@ -2978,7 +2982,7 @@ var MRT_TableContainer = function MRT_TableContainer() {
2978
2982
  height: fullScreen ? '100%' : undefined,
2979
2983
  left: fullScreen ? '0' : undefined,
2980
2984
  m: fullScreen ? '0' : undefined,
2981
- overflowY: 'hidden',
2985
+ overflowY: !fullScreen ? 'hidden' : undefined,
2982
2986
  position: fullScreen ? 'fixed' : undefined,
2983
2987
  right: fullScreen ? '0' : undefined,
2984
2988
  top: fullScreen ? '0' : undefined,