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.
@@ -130,7 +130,7 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
130
130
  *
131
131
  * @example accessorFn: (row) => row.username
132
132
  */
133
- accessorFn?: (row: TData) => any;
133
+ accessorFn?: (originalRow: TData) => any;
134
134
  /**
135
135
  * Either an `accessorKey` or a combination of an `accessorFn` and `id` are required for a data column definition.
136
136
  * Specify which key in the row this column should use to access the correct data.
@@ -160,7 +160,7 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
160
160
  filterFn?: MRT_FilterFn<TData>;
161
161
  filterSelectOptions?: (string | {
162
162
  text: string;
163
- value: string;
163
+ value: any;
164
164
  })[];
165
165
  filterVariant?: 'text' | 'select' | 'multi-select' | 'range';
166
166
  /**
@@ -311,7 +311,7 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
311
311
  enableTableHead?: boolean;
312
312
  enableToolbarInternalActions?: boolean;
313
313
  enableTopToolbar?: boolean;
314
- enabledGlobalFilterOptions?: (MRT_FilterOption | string)[] | null;
314
+ globalFilterModeOptions?: (MRT_FilterOption | string)[] | null;
315
315
  expandRowsFn?: (dataRow: TData) => TData[];
316
316
  icons?: Partial<MRT_Icons>;
317
317
  initialState?: Partial<MRT_TableState<TData>>;
@@ -383,7 +383,7 @@ const mrtFilterOptions = (localization) => [
383
383
  ];
384
384
  const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table, }) => {
385
385
  var _a, _b, _c, _d;
386
- const { getState, options: { enabledGlobalFilterOptions, columnFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
386
+ const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
387
387
  const { globalFilterFn, density } = getState();
388
388
  const { column } = header !== null && header !== void 0 ? header : {};
389
389
  const { columnDef } = column !== null && column !== void 0 ? column : {};
@@ -391,8 +391,8 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table,
391
391
  const internalFilterOptions = useMemo(() => mrtFilterOptions(localization).filter((filterOption) => columnDef
392
392
  ? allowedColumnFilterOptions === undefined ||
393
393
  (allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.includes(filterOption.option))
394
- : (!enabledGlobalFilterOptions ||
395
- enabledGlobalFilterOptions.includes(filterOption.option)) &&
394
+ : (!globalFilterModeOptions ||
395
+ globalFilterModeOptions.includes(filterOption.option)) &&
396
396
  ['fuzzy', 'contains', 'startsWith'].includes(filterOption.option)), []);
397
397
  const handleSelectFilterMode = (option) => {
398
398
  if (header && column) {
@@ -2154,7 +2154,8 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
2154
2154
  !Object.values(sorting).some(Boolean)) {
2155
2155
  const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
2156
2156
  if (enablePagination) {
2157
- return rankedRows.slice(pagination.pageIndex, pagination.pageSize);
2157
+ const start = pagination.pageIndex * pagination.pageSize;
2158
+ return rankedRows.slice(start, start + pagination.pageSize);
2158
2159
  }
2159
2160
  return rankedRows;
2160
2161
  }
@@ -2167,6 +2168,8 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
2167
2168
  ? getPrePaginationRowModel().rows
2168
2169
  : getRowModel().rows,
2169
2170
  globalFilter,
2171
+ pagination.pageIndex,
2172
+ pagination.pageSize,
2170
2173
  ]);
2171
2174
  const virtualizer = enableRowVirtualization
2172
2175
  ? useVirtual(Object.assign({ size: rows.length, parentRef: tableContainerRef, overscan: 15 }, vProps))