@dooherceg/material-react-table 3.2.2-alpha.8 → 3.2.2-alpha.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
@@ -1,9 +1,8 @@
1
- import { RowData } from '@tanstack/table-core';
1
+ import * as _tanstack_react_table from '@tanstack/react-table';
2
+ import { Row, ColumnFiltersState, ColumnOrderState, ColumnPinningState, ColumnSizingInfoState, ColumnSizingState, ExpandedState, GroupingState, PaginationState, RowSelectionState, SortingState, Updater, VisibilityState, AccessorFn, DeepKeys, DeepValue, Table, TableState, Column, Header, HeaderGroup, Cell, AggregationFn, SortingFn, FilterFn, TableOptions, OnChangeFn, ColumnDef, RowData, Renderable, RowPinningPosition } from '@tanstack/react-table';
2
3
  import * as React from 'react';
3
4
  import React__default, { ReactNode, RefObject, Dispatch, SetStateAction, ChangeEvent, MouseEvent, JSX, Ref, ReactElement, DragEventHandler, HTMLAttributes, FormEventHandler } from 'react';
4
5
  import { RegisterOptions, UseFormReturn } from 'react-hook-form';
5
- import * as _tanstack_react_table from '@tanstack/react-table';
6
- import { Row, ColumnFiltersState, ColumnOrderState, ColumnPinningState, ColumnSizingInfoState, ColumnSizingState, ExpandedState, GroupingState, PaginationState, RowSelectionState, SortingState, Updater, VisibilityState, AccessorFn, DeepKeys, DeepValue, Table, TableState, Column, Header, HeaderGroup, Cell, AggregationFn, SortingFn, FilterFn, TableOptions, OnChangeFn, ColumnDef, Renderable, RowPinningPosition } from '@tanstack/react-table';
7
6
  import { VirtualItem, VirtualizerOptions, Virtualizer } from '@tanstack/react-virtual';
8
7
  import { AlertProps } from '@mui/material/Alert';
9
8
  import { AutocompleteProps } from '@mui/material/Autocomplete';
@@ -1572,17 +1571,7 @@ interface MRT_DimensionsDef {
1572
1571
  };
1573
1572
  fieldsPerRow?: number;
1574
1573
  }
1575
- declare module '@tanstack/table-core' {
1576
- interface ColumnMeta<TData extends RowData, TValue> {
1577
- enumValues?: Array<{
1578
- value: string;
1579
- label: string;
1580
- }>;
1581
- availableIcons?: MRT_AvailableIconOption[];
1582
- dimensions?: MRT_DimensionsDef;
1583
- extraFieldFilters?: MRT_ColumnDef<TData, TValue>[];
1584
- }
1585
- }
1574
+ type MRT_ColumnMetaExtraFieldFilters<TData extends RowData> = TData extends MRT_RowData ? MRT_ColumnDef<TData>[] : never;
1586
1575
  declare module '@tanstack/react-table' {
1587
1576
  interface ColumnMeta<TData extends RowData, TValue> {
1588
1577
  enumValues?: Array<{
@@ -1591,7 +1580,7 @@ declare module '@tanstack/react-table' {
1591
1580
  }>;
1592
1581
  availableIcons?: MRT_AvailableIconOption[];
1593
1582
  dimensions?: MRT_DimensionsDef;
1594
- extraFieldFilters?: MRT_ColumnDef<TData, TValue>[];
1583
+ extraFieldFilters?: MRT_ColumnMetaExtraFieldFilters<TData>;
1595
1584
  }
1596
1585
  }
1597
1586
 
package/dist/index.esm.js CHANGED
@@ -4263,14 +4263,11 @@ const getFilterableColumns = (table) => {
4263
4263
  // Users define them as regular MRT_ColumnDef (same API), but they are not rendered as a column in the table.
4264
4264
  const virtualColumns = allLeafColumns.flatMap((column) => {
4265
4265
  var _a, _b;
4266
- return ((_b = (_a = column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.extraFieldFilters) !== null && _b !== void 0 ? _b : []).map((extraColumnDef) => {
4267
- var _a;
4268
- return ({
4269
- // accessorKey is the primary identifier; id as fallback
4270
- id: String((_a = extraColumnDef.accessorKey) !== null && _a !== void 0 ? _a : extraColumnDef.field),
4271
- columnDef: Object.assign(Object.assign({}, extraColumnDef), { columnDefType: 'data', enableColumnFilter: true }),
4272
- });
4273
- });
4266
+ return ((_b = (_a = column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.extraFieldFilters) !== null && _b !== void 0 ? _b : []).map((extraColumnDef) => ({
4267
+ // accessorKey is the primary identifier; id as fallback
4268
+ id: getColumnId(extraColumnDef),
4269
+ columnDef: Object.assign(Object.assign({}, extraColumnDef), { columnDefType: 'data', enableColumnFilter: true }),
4270
+ }));
4274
4271
  });
4275
4272
  return [...realFilterableColumns, ...virtualColumns];
4276
4273
  };