material-react-table 0.22.1 → 0.22.2

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.22.1",
2
+ "version": "0.22.2",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI implementation of TanStack React Table, inspired by material-table and the MUI X DataGrid, written from the ground up in TypeScript.",
@@ -131,7 +131,7 @@ export type MRT_TableState<TData extends Record<string, any> = {}> =
131
131
  isLoading: boolean;
132
132
  isFullScreen: boolean;
133
133
  showAlertBanner: boolean;
134
- showFilters: boolean;
134
+ showColumnFilters: boolean;
135
135
  showGlobalFilter: boolean;
136
136
  showProgressBars: boolean;
137
137
  showSkeletons: boolean;
@@ -50,7 +50,6 @@ export const MRT_CopyButton: FC<Props> = ({ cell, children, table }) => {
50
50
  title={copied ? localization.copiedToClipboard : localization.clickToCopy}
51
51
  >
52
52
  <Button
53
- aria-label={localization.clickToCopy}
54
53
  onClick={() => handleCopy(cell.getValue())}
55
54
  size="small"
56
55
  type="button"
@@ -15,10 +15,10 @@ export const MRT_ToggleFiltersButton: FC<Props> = ({ table, ...rest }) => {
15
15
  },
16
16
  setShowFilters,
17
17
  } = table;
18
- const { showFilters } = getState();
18
+ const { showColumnFilters } = getState();
19
19
 
20
20
  const handleToggleShowFilters = () => {
21
- setShowFilters(!showFilters);
21
+ setShowFilters(!showColumnFilters);
22
22
  };
23
23
 
24
24
  return (
@@ -28,7 +28,7 @@ export const MRT_ToggleFiltersButton: FC<Props> = ({ table, ...rest }) => {
28
28
  onClick={handleToggleShowFilters}
29
29
  {...rest}
30
30
  >
31
- {showFilters ? <FilterListOffIcon /> : <FilterListIcon />}
31
+ {showColumnFilters ? <FilterListOffIcon /> : <FilterListIcon />}
32
32
  </IconButton>
33
33
  </Tooltip>
34
34
  );
package/src/filtersFns.ts CHANGED
@@ -4,10 +4,10 @@ import { filterFns, Row } from '@tanstack/react-table';
4
4
  export const fuzzy = <TData extends Record<string, any> = {}>(
5
5
  row: Row<TData>,
6
6
  columnId: string,
7
- filterValue: string,
7
+ filterValue: string | number,
8
8
  addMeta: (item: RankingInfo) => void,
9
9
  ) => {
10
- const itemRank = rankItem(row.getValue(columnId), filterValue, {
10
+ const itemRank = rankItem(row.getValue(columnId), filterValue as string, {
11
11
  threshold: rankings.MATCHES,
12
12
  });
13
13
  addMeta(itemRank);
@@ -14,11 +14,11 @@ export const MRT_TableHeadCellFilterContainer: FC<Props> = ({
14
14
  table,
15
15
  }) => {
16
16
  const { getState } = table;
17
- const { currentFilterFns, showFilters } = getState();
17
+ const { currentFilterFns, showColumnFilters } = getState();
18
18
  const { column } = header;
19
19
 
20
20
  return (
21
- <Collapse in={showFilters} mountOnEnter unmountOnExit>
21
+ <Collapse in={showColumnFilters} mountOnEnter unmountOnExit>
22
22
  {currentFilterFns[column.id] === 'between' ? (
23
23
  <MRT_FilterRangeFields header={header} table={table} />
24
24
  ) : (
@@ -12,7 +12,7 @@ export const MRT_TableHeadCellResizeHandle: FC<Props> = ({ header, table }) => {
12
12
  getState,
13
13
  options: { columnResizeMode },
14
14
  } = table;
15
- const { density, showFilters } = getState();
15
+ const { density, showColumnFilters } = getState();
16
16
  const { column } = header;
17
17
  const { columnDef } = column;
18
18
  const { columnDefType } = columnDef;
@@ -26,7 +26,7 @@ export const MRT_TableHeadCellResizeHandle: FC<Props> = ({ header, table }) => {
26
26
  borderRadius: '2px',
27
27
  borderRightWidth: '2px',
28
28
  cursor: 'col-resize',
29
- height: showFilters && columnDefType === 'data' ? '4rem' : '2rem',
29
+ height: showColumnFilters && columnDefType === 'data' ? '4rem' : '2rem',
30
30
  mr: density === 'compact' ? '-0.5rem' : '-1rem',
31
31
  opacity: 0.8,
32
32
  position: 'absolute',
@@ -65,8 +65,8 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
65
65
  const [showAlertBanner, setShowAlertBanner] = useState(
66
66
  props.initialState?.showAlertBanner ?? false,
67
67
  );
68
- const [showFilters, setShowFilters] = useState(
69
- initialState?.showFilters ?? false,
68
+ const [showColumnFilters, setShowFilters] = useState(
69
+ initialState?.showColumnFilters ?? false,
70
70
  );
71
71
  const [showGlobalFilter, setShowGlobalFilter] = useState(
72
72
  initialState?.showGlobalFilter ?? false,
@@ -230,7 +230,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
230
230
  density,
231
231
  isFullScreen,
232
232
  showAlertBanner,
233
- showFilters,
233
+ showColumnFilters,
234
234
  showGlobalFilter,
235
235
  ...props.state,
236
236
  } as TableState,