material-react-table 0.40.6 → 0.40.9

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.
package/dist/index.d.ts CHANGED
@@ -322,7 +322,7 @@ declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<Column
322
322
  *
323
323
  * @example accessorFn: (row) => row.username
324
324
  */
325
- accessorFn?: (row: TData) => any;
325
+ accessorFn?: (originalRow: TData) => any;
326
326
  /**
327
327
  * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
328
328
  * Specify which key in the row this column should use to access the correct data.
@@ -352,7 +352,7 @@ declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<Column
352
352
  filterFn?: MRT_FilterFn<TData>;
353
353
  filterSelectOptions?: (string | {
354
354
  text: string;
355
- value: string;
355
+ value: any;
356
356
  })[];
357
357
  filterVariant?: 'text' | 'select' | 'multi-select' | 'range';
358
358
  /**
@@ -503,7 +503,7 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
503
503
  enableTableHead?: boolean;
504
504
  enableToolbarInternalActions?: boolean;
505
505
  enableTopToolbar?: boolean;
506
- enabledGlobalFilterOptions?: (MRT_FilterOption | string)[] | null;
506
+ globalFilterModeOptions?: (MRT_FilterOption | string)[] | null;
507
507
  expandRowsFn?: (dataRow: TData) => TData[];
508
508
  icons?: Partial<MRT_Icons>;
509
509
  initialState?: Partial<MRT_TableState<TData>>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.40.6",
2
+ "version": "0.40.9",
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.",
@@ -58,7 +58,7 @@
58
58
  "@mui/material": "^5.10.2",
59
59
  "@rollup/plugin-babel": "^5.3.1",
60
60
  "@rollup/plugin-node-resolve": "^13.3.0",
61
- "@rollup/plugin-typescript": "^8.3.4",
61
+ "@rollup/plugin-typescript": "^8.4.0",
62
62
  "@size-limit/preset-small-lib": "^8.0.1",
63
63
  "@storybook/addon-a11y": "^6.5.10",
64
64
  "@storybook/addon-actions": "^6.5.10",
@@ -71,7 +71,7 @@
71
71
  "@types/react": "^18.0.17",
72
72
  "@types/react-dom": "^18.0.6",
73
73
  "babel-loader": "^8.2.5",
74
- "eslint": "^8.22.0",
74
+ "eslint": "^8.23.0",
75
75
  "eslint-plugin-react-hooks": "^4.6.0",
76
76
  "husky": "^8.0.1",
77
77
  "prettier": "^2.7.1",
@@ -84,7 +84,7 @@
84
84
  "size-limit": "^8.0.1",
85
85
  "storybook-dark-mode": "^1.1.0",
86
86
  "tslib": "^2.4.0",
87
- "typescript": "^4.7.4"
87
+ "typescript": "^4.8.2"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "@emotion/react": ">=11",
@@ -236,7 +236,7 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
236
236
  *
237
237
  * @example accessorFn: (row) => row.username
238
238
  */
239
- accessorFn?: (row: TData) => any;
239
+ accessorFn?: (originalRow: TData) => any;
240
240
  /**
241
241
  * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
242
242
  * Specify which key in the row this column should use to access the correct data.
@@ -264,7 +264,7 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
264
264
  enableColumnOrdering?: boolean;
265
265
  enableEditing?: boolean;
266
266
  filterFn?: MRT_FilterFn<TData>;
267
- filterSelectOptions?: (string | { text: string; value: string })[];
267
+ filterSelectOptions?: (string | { text: string; value: any })[];
268
268
  filterVariant?: 'text' | 'select' | 'multi-select' | 'range';
269
269
  /**
270
270
  * footer must be a string. If you want custom JSX to render the footer, you can also specify a `Footer` option. (Capital F)
@@ -521,7 +521,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
521
521
  enableTableHead?: boolean;
522
522
  enableToolbarInternalActions?: boolean;
523
523
  enableTopToolbar?: boolean;
524
- enabledGlobalFilterOptions?: (MRT_FilterOption | string)[] | null;
524
+ globalFilterModeOptions?: (MRT_FilterOption | string)[] | null;
525
525
  expandRowsFn?: (dataRow: TData) => TData[];
526
526
  icons?: Partial<MRT_Icons>;
527
527
  initialState?: Partial<MRT_TableState<TData>>;
@@ -51,7 +51,8 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
51
51
  rankGlobalFuzzy(a, b),
52
52
  );
53
53
  if (enablePagination) {
54
- return rankedRows.slice(pagination.pageIndex, pagination.pageSize);
54
+ const start = pagination.pageIndex * pagination.pageSize;
55
+ return rankedRows.slice(start, start + pagination.pageSize);
55
56
  }
56
57
  return rankedRows;
57
58
  }
@@ -65,6 +66,8 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
65
66
  ? getPrePaginationRowModel().rows
66
67
  : getRowModel().rows,
67
68
  globalFilter,
69
+ pagination.pageIndex,
70
+ pagination.pageSize,
68
71
  ]);
69
72
 
70
73
  const virtualizer = enableRowVirtualization
@@ -1,9 +1,4 @@
1
- import React, {
2
- ChangeEvent,
3
- FocusEvent,
4
- KeyboardEvent,
5
- useState,
6
- } from 'react';
1
+ import React, { ChangeEvent, FocusEvent, KeyboardEvent, useState } from 'react';
7
2
  import { TextField, TextFieldProps } from '@mui/material';
8
3
  import type { MRT_Cell, MRT_TableInstance } from '..';
9
4
 
@@ -115,8 +115,8 @@ export const MRT_FilterOptionMenu = <TData extends Record<string, any> = {}>({
115
115
  const {
116
116
  getState,
117
117
  options: {
118
- enabledGlobalFilterOptions,
119
118
  columnFilterModeOptions,
119
+ globalFilterModeOptions,
120
120
  localization,
121
121
  renderColumnFilterModeMenuItems,
122
122
  renderGlobalFilterModeMenuItems,
@@ -137,8 +137,8 @@ export const MRT_FilterOptionMenu = <TData extends Record<string, any> = {}>({
137
137
  columnDef
138
138
  ? allowedColumnFilterOptions === undefined ||
139
139
  allowedColumnFilterOptions?.includes(filterOption.option)
140
- : (!enabledGlobalFilterOptions ||
141
- enabledGlobalFilterOptions.includes(filterOption.option)) &&
140
+ : (!globalFilterModeOptions ||
141
+ globalFilterModeOptions.includes(filterOption.option)) &&
142
142
  ['fuzzy', 'contains', 'startsWith'].includes(filterOption.option),
143
143
  ),
144
144
  [],