material-react-table 1.5.3 → 1.5.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.
Files changed (48) hide show
  1. package/dist/cjs/index.js +15 -6
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/buttons/MRT_ExpandAllButton.d.ts +1 -1
  4. package/dist/cjs/types/buttons/MRT_FullScreenToggleButton.d.ts +1 -1
  5. package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +1 -1
  6. package/dist/cjs/types/buttons/MRT_ShowHideColumnsButton.d.ts +1 -1
  7. package/dist/cjs/types/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -1
  8. package/dist/cjs/types/buttons/MRT_ToggleFiltersButton.d.ts +1 -1
  9. package/dist/cjs/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -1
  10. package/dist/cjs/types/inputs/MRT_GlobalFilterTextField.d.ts +1 -1
  11. package/dist/cjs/types/table/MRT_Table.d.ts +1 -1
  12. package/dist/cjs/types/toolbar/MRT_LinearProgressBar.d.ts +1 -1
  13. package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +1 -1
  14. package/dist/cjs/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
  15. package/dist/cjs/types/toolbar/MRT_ToolbarDropZone.d.ts +1 -1
  16. package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +1 -1
  17. package/dist/esm/material-react-table.esm.js +15 -6
  18. package/dist/esm/material-react-table.esm.js.map +1 -1
  19. package/dist/esm/types/buttons/MRT_ExpandAllButton.d.ts +1 -1
  20. package/dist/esm/types/buttons/MRT_FullScreenToggleButton.d.ts +1 -1
  21. package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +1 -1
  22. package/dist/esm/types/buttons/MRT_ShowHideColumnsButton.d.ts +1 -1
  23. package/dist/esm/types/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -1
  24. package/dist/esm/types/buttons/MRT_ToggleFiltersButton.d.ts +1 -1
  25. package/dist/esm/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -1
  26. package/dist/esm/types/inputs/MRT_GlobalFilterTextField.d.ts +1 -1
  27. package/dist/esm/types/table/MRT_Table.d.ts +1 -1
  28. package/dist/esm/types/toolbar/MRT_LinearProgressBar.d.ts +1 -1
  29. package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +1 -1
  30. package/dist/esm/types/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
  31. package/dist/esm/types/toolbar/MRT_ToolbarDropZone.d.ts +1 -1
  32. package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +1 -1
  33. package/package.json +1 -1
  34. package/src/buttons/MRT_ExpandAllButton.tsx +1 -1
  35. package/src/buttons/MRT_FullScreenToggleButton.tsx +1 -1
  36. package/src/buttons/MRT_GrabHandleButton.tsx +1 -1
  37. package/src/buttons/MRT_ShowHideColumnsButton.tsx +1 -1
  38. package/src/buttons/MRT_ToggleDensePaddingButton.tsx +1 -1
  39. package/src/buttons/MRT_ToggleFiltersButton.tsx +1 -1
  40. package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +1 -1
  41. package/src/inputs/MRT_FilterTextField.tsx +16 -7
  42. package/src/inputs/MRT_GlobalFilterTextField.tsx +1 -1
  43. package/src/table/MRT_Table.tsx +1 -1
  44. package/src/toolbar/MRT_LinearProgressBar.tsx +1 -1
  45. package/src/toolbar/MRT_TablePagination.tsx +1 -1
  46. package/src/toolbar/MRT_ToolbarAlertBanner.tsx +1 -1
  47. package/src/toolbar/MRT_ToolbarDropZone.tsx +1 -1
  48. package/src/toolbar/MRT_TopToolbar.tsx +1 -1
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { MRT_TableInstance } from '..';
2
+ import type { MRT_TableInstance } from '..';
3
3
  interface Props {
4
4
  table: MRT_TableInstance;
5
5
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { IconButtonProps } from '@mui/material/IconButton';
3
- import { MRT_TableInstance } from '..';
3
+ import type { MRT_TableInstance } from '..';
4
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
5
5
  table: MRT_TableInstance<TData>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { DragEventHandler } from 'react';
2
2
  import type { IconButtonProps } from '@mui/material/IconButton';
3
- import { MRT_TableInstance } from '..';
3
+ import type { MRT_TableInstance } from '..';
4
4
  interface Props<TData extends Record<string, any> = {}> {
5
5
  iconButtonProps?: IconButtonProps;
6
6
  onDragStart: DragEventHandler<HTMLButtonElement>;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { IconButtonProps } from '@mui/material/IconButton';
3
- import { MRT_TableInstance } from '..';
3
+ import type { MRT_TableInstance } from '..';
4
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
5
5
  table: MRT_TableInstance<TData>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { IconButtonProps } from '@mui/material/IconButton';
3
- import { MRT_TableInstance } from '..';
3
+ import type { MRT_TableInstance } from '..';
4
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
5
5
  table: MRT_TableInstance<TData>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { IconButtonProps } from '@mui/material/IconButton';
3
- import { MRT_TableInstance } from '..';
3
+ import type { MRT_TableInstance } from '..';
4
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
5
5
  table: MRT_TableInstance<TData>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { IconButtonProps } from '@mui/material/IconButton';
3
- import { MRT_TableInstance } from '..';
3
+ import type { MRT_TableInstance } from '..';
4
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
5
5
  table: MRT_TableInstance<TData>;
6
6
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { MRT_TableInstance } from '..';
2
+ import type { MRT_TableInstance } from '..';
3
3
  interface Props<TData extends Record<string, any> = {}> {
4
4
  table: MRT_TableInstance<TData>;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { MRT_TableInstance } from '..';
2
+ import type { MRT_TableInstance } from '..';
3
3
  interface Props {
4
4
  table: MRT_TableInstance;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { MRT_TableInstance } from '..';
2
+ import type { MRT_TableInstance } from '..';
3
3
  interface Props {
4
4
  isTopToolbar: boolean;
5
5
  table: MRT_TableInstance;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { MRT_TableInstance } from '..';
2
+ import type { MRT_TableInstance } from '..';
3
3
  interface Props<TData extends Record<string, any> = {}> {
4
4
  position?: 'top' | 'bottom';
5
5
  table: MRT_TableInstance<TData>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { MRT_TableInstance } from '..';
2
+ import type { MRT_TableInstance } from '..';
3
3
  interface Props<TData extends Record<string, any> = {}> {
4
4
  stackAlertBanner: boolean;
5
5
  table: MRT_TableInstance<TData>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { MRT_TableInstance } from '..';
2
+ import type { MRT_TableInstance } from '..';
3
3
  interface Props<TData extends Record<string, any> = {}> {
4
4
  table: MRT_TableInstance<TData>;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { MRT_TableInstance } from '..';
2
+ import type { MRT_TableInstance } from '..';
3
3
  import type { Theme } from '@mui/material/styles';
4
4
  export declare const commonToolbarStyles: ({ theme }: {
5
5
  theme: Theme;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.3",
2
+ "version": "1.5.4",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -1,7 +1,7 @@
1
1
  import React, { FC } from 'react';
2
2
  import IconButton from '@mui/material/IconButton';
3
3
  import Tooltip from '@mui/material/Tooltip';
4
- import { MRT_TableInstance } from '..';
4
+ import type { MRT_TableInstance } from '..';
5
5
 
6
6
  interface Props {
7
7
  table: MRT_TableInstance;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import IconButton from '@mui/material/IconButton';
3
3
  import type { IconButtonProps } from '@mui/material/IconButton';
4
4
  import Tooltip from '@mui/material/Tooltip';
5
- import { MRT_TableInstance } from '..';
5
+ import type { MRT_TableInstance } from '..';
6
6
 
7
7
  interface Props<TData extends Record<string, any> = {}>
8
8
  extends IconButtonProps {
@@ -2,7 +2,7 @@ import React, { DragEventHandler } from 'react';
2
2
  import IconButton from '@mui/material/IconButton';
3
3
  import type { IconButtonProps } from '@mui/material/IconButton';
4
4
  import Tooltip from '@mui/material/Tooltip';
5
- import { MRT_TableInstance } from '..';
5
+ import type { MRT_TableInstance } from '..';
6
6
 
7
7
  interface Props<TData extends Record<string, any> = {}> {
8
8
  iconButtonProps?: IconButtonProps;
@@ -3,7 +3,7 @@ import IconButton from '@mui/material/IconButton';
3
3
  import type { IconButtonProps } from '@mui/material/IconButton';
4
4
  import Tooltip from '@mui/material/Tooltip';
5
5
  import { MRT_ShowHideColumnsMenu } from '../menus/MRT_ShowHideColumnsMenu';
6
- import { MRT_TableInstance } from '..';
6
+ import type { MRT_TableInstance } from '..';
7
7
 
8
8
  interface Props<TData extends Record<string, any> = {}>
9
9
  extends IconButtonProps {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import IconButton from '@mui/material/IconButton';
3
3
  import type { IconButtonProps } from '@mui/material/IconButton';
4
4
  import Tooltip from '@mui/material/Tooltip';
5
- import { MRT_TableInstance } from '..';
5
+ import type { MRT_TableInstance } from '..';
6
6
 
7
7
  interface Props<TData extends Record<string, any> = {}>
8
8
  extends IconButtonProps {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import IconButton from '@mui/material/IconButton';
3
3
  import type { IconButtonProps } from '@mui/material/IconButton';
4
4
  import Tooltip from '@mui/material/Tooltip';
5
- import { MRT_TableInstance } from '..';
5
+ import type { MRT_TableInstance } from '..';
6
6
 
7
7
  interface Props<TData extends Record<string, any> = {}>
8
8
  extends IconButtonProps {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import IconButton from '@mui/material/IconButton';
3
3
  import type { IconButtonProps } from '@mui/material/IconButton';
4
4
  import Tooltip from '@mui/material/Tooltip';
5
- import { MRT_TableInstance } from '..';
5
+ import type { MRT_TableInstance } from '..';
6
6
 
7
7
  interface Props<TData extends Record<string, any> = {}>
8
8
  extends IconButtonProps {
@@ -16,9 +16,9 @@ import MenuItem from '@mui/material/MenuItem';
16
16
  import TextField from '@mui/material/TextField';
17
17
  import Tooltip from '@mui/material/Tooltip';
18
18
  import { debounce } from '@mui/material/utils';
19
+ import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
19
20
  import type { TextFieldProps } from '@mui/material/TextField';
20
21
  import type { MRT_Header, MRT_TableInstance } from '..';
21
- import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
22
22
 
23
23
  interface Props {
24
24
  header: MRT_Header;
@@ -165,9 +165,10 @@ export const MRT_FilterTextField: FC<Props> = ({
165
165
  column.setFilterValue(undefined);
166
166
  setColumnFilterFns((prev) => ({
167
167
  ...prev,
168
- [header.id]: columnDef.columnFilterModeOptions?.[0]
169
- ?? columnFilterModeOptions?.[0]
170
- ?? 'fuzzy',
168
+ [header.id]:
169
+ columnDef.columnFilterModeOptions?.[0] ??
170
+ columnFilterModeOptions?.[0] ??
171
+ 'fuzzy',
171
172
  }));
172
173
  };
173
174
 
@@ -178,9 +179,17 @@ export const MRT_FilterTextField: FC<Props> = ({
178
179
  const isMounted = useRef(false);
179
180
 
180
181
  useEffect(() => {
181
- if (isMounted.current && column.getFilterValue() === undefined) {
182
- handleClear();
182
+ if (isMounted.current) {
183
+ const filterValue = column.getFilterValue();
184
+ if (filterValue === undefined) {
185
+ handleClear();
186
+ } else if (isRangeFilter && rangeFilterIndex !== undefined) {
187
+ setFilterValue((filterValue as [string, string])[rangeFilterIndex]);
188
+ } else {
189
+ setFilterValue(filterValue as string);
190
+ }
183
191
  }
192
+
184
193
  isMounted.current = true;
185
194
  }, [column.getFilterValue()]);
186
195
 
@@ -269,7 +278,7 @@ export const MRT_FilterTextField: FC<Props> = ({
269
278
  <span>
270
279
  <IconButton
271
280
  aria-label={localization.clearFilter}
272
- disabled={!filterValue?.length}
281
+ disabled={!filterValue?.toString()?.length}
273
282
  onClick={handleClear}
274
283
  size="small"
275
284
  sx={{
@@ -12,7 +12,7 @@ import TextField from '@mui/material/TextField';
12
12
  import Tooltip from '@mui/material/Tooltip';
13
13
  import { debounce } from '@mui/material/utils';
14
14
  import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
15
- import { MRT_TableInstance } from '..';
15
+ import type { MRT_TableInstance } from '..';
16
16
 
17
17
  interface Props<TData extends Record<string, any> = {}> {
18
18
  table: MRT_TableInstance<TData>;
@@ -9,7 +9,7 @@ import Table from '@mui/material/Table';
9
9
  import { MRT_TableHead } from '../head/MRT_TableHead';
10
10
  import { Memo_MRT_TableBody, MRT_TableBody } from '../body/MRT_TableBody';
11
11
  import { MRT_TableFooter } from '../footer/MRT_TableFooter';
12
- import { MRT_TableInstance } from '..';
12
+ import type { MRT_TableInstance } from '..';
13
13
 
14
14
  interface Props {
15
15
  table: MRT_TableInstance;
@@ -1,7 +1,7 @@
1
1
  import React, { FC } from 'react';
2
2
  import Collapse from '@mui/material/Collapse';
3
3
  import LinearProgress from '@mui/material/LinearProgress';
4
- import { MRT_TableInstance } from '..';
4
+ import type { MRT_TableInstance } from '..';
5
5
 
6
6
  interface Props {
7
7
  isTopToolbar: boolean;
@@ -1,6 +1,6 @@
1
1
  import React, { ChangeEvent } from 'react';
2
2
  import TablePagination from '@mui/material/TablePagination';
3
- import { MRT_TableInstance } from '..';
3
+ import type { MRT_TableInstance } from '..';
4
4
 
5
5
  interface Props<TData extends Record<string, any> = {}> {
6
6
  position?: 'top' | 'bottom';
@@ -4,7 +4,7 @@ import AlertTitle from '@mui/material/AlertTitle';
4
4
  import Box from '@mui/material/Box';
5
5
  import Chip from '@mui/material/Chip';
6
6
  import Collapse from '@mui/material/Collapse';
7
- import { MRT_TableInstance } from '..';
7
+ import type { MRT_TableInstance } from '..';
8
8
 
9
9
  interface Props<TData extends Record<string, any> = {}> {
10
10
  stackAlertBanner: boolean;
@@ -3,7 +3,7 @@ import { alpha } from '@mui/material/styles';
3
3
  import Box from '@mui/material/Box';
4
4
  import Fade from '@mui/material/Fade';
5
5
  import Typography from '@mui/material/Typography';
6
- import { MRT_TableInstance } from '..';
6
+ import type { MRT_TableInstance } from '..';
7
7
 
8
8
  interface Props<TData extends Record<string, any> = {}> {
9
9
  table: MRT_TableInstance<TData>;
@@ -5,7 +5,7 @@ import useMediaQuery from '@mui/material/useMediaQuery';
5
5
  import { lighten } from '@mui/material/styles';
6
6
  import { MRT_GlobalFilterTextField } from '../inputs/MRT_GlobalFilterTextField';
7
7
  import { MRT_LinearProgressBar } from './MRT_LinearProgressBar';
8
- import { MRT_TableInstance } from '..';
8
+ import type { MRT_TableInstance } from '..';
9
9
  import { MRT_TablePagination } from './MRT_TablePagination';
10
10
  import { MRT_ToolbarAlertBanner } from './MRT_ToolbarAlertBanner';
11
11
  import { MRT_ToolbarInternalButtons } from './MRT_ToolbarInternalButtons';