material-react-table 1.8.0 → 1.8.2
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/cjs/index.js +18 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +38 -23
- package/dist/cjs/types/body/MRT_TableBody.d.ts +4 -3
- package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +3 -2
- package/dist/cjs/types/body/MRT_TableBodyRow.d.ts +5 -4
- package/dist/cjs/types/body/MRT_TableDetailPanel.d.ts +3 -2
- package/dist/cjs/types/column.utils.d.ts +21 -5
- package/dist/cjs/types/footer/MRT_TableFooter.d.ts +3 -2
- package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHead.d.ts +3 -2
- package/dist/cjs/types/head/MRT_TableHeadRow.d.ts +3 -2
- package/dist/cjs/types/sortingFns.d.ts +117 -1
- package/dist/esm/material-react-table.esm.js +18 -6
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +38 -23
- package/dist/esm/types/body/MRT_TableBody.d.ts +4 -3
- package/dist/esm/types/body/MRT_TableBodyCell.d.ts +3 -2
- package/dist/esm/types/body/MRT_TableBodyRow.d.ts +5 -4
- package/dist/esm/types/body/MRT_TableDetailPanel.d.ts +3 -2
- package/dist/esm/types/column.utils.d.ts +21 -5
- package/dist/esm/types/footer/MRT_TableFooter.d.ts +3 -2
- package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHead.d.ts +3 -2
- package/dist/esm/types/head/MRT_TableHeadRow.d.ts +3 -2
- package/dist/esm/types/sortingFns.d.ts +117 -1
- package/dist/index.d.ts +39 -24
- package/package.json +15 -15
- package/src/MaterialReactTable.tsx +655 -624
- package/src/body/MRT_TableBody.tsx +10 -11
- package/src/body/MRT_TableBodyCell.tsx +3 -2
- package/src/body/MRT_TableBodyRow.tsx +7 -14
- package/src/body/MRT_TableDetailPanel.tsx +3 -2
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +1 -1
- package/src/column.utils.ts +6 -8
- package/src/footer/MRT_TableFooter.tsx +3 -2
- package/src/footer/MRT_TableFooterRow.tsx +3 -7
- package/src/head/MRT_TableHead.tsx +3 -2
- package/src/head/MRT_TableHeadCellSortLabel.tsx +4 -0
- package/src/head/MRT_TableHeadRow.tsx +3 -7
- package/src/menus/MRT_FilterOptionMenu.tsx +8 -3
- package/src/table/MRT_Table.tsx +4 -3
- package/src/table/MRT_TableRoot.tsx +6 -0
@@ -28,9 +28,12 @@ export { MRT_AggregationFns, MRT_FilterFns, MRT_SortingFns };
|
|
28
28
|
/**
|
29
29
|
* Most of this file is just TypeScript types
|
30
30
|
*/
|
31
|
+
type Prettify<T> = {
|
32
|
+
[K in keyof T]: T[K];
|
33
|
+
} & {};
|
34
|
+
type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
|
31
35
|
export type MRT_DensityState = 'comfortable' | 'compact' | 'spacious';
|
32
36
|
export type { ColumnFiltersState as MRT_ColumnFiltersState, ColumnOrderState as MRT_ColumnOrderState, ColumnPinningState as MRT_ColumnPinningState, ColumnSizingInfoState as MRT_ColumnSizingInfoState, ColumnSizingState as MRT_ColumnSizingState, ExpandedState as MRT_ExpandedState, GroupingState as MRT_GroupingState, PaginationState as MRT_PaginationState, RowSelectionState as MRT_RowSelectionState, SortingState as MRT_SortingState, VirtualItem as MRT_VirtualItem, Virtualizer as MRT_Virtualizer, VirtualizerOptions as MRT_VirtualizerOptions, VisibilityState as MRT_VisibilityState, };
|
33
|
-
type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
|
34
37
|
export interface MRT_Localization {
|
35
38
|
actions: string;
|
36
39
|
and: string;
|
@@ -129,7 +132,7 @@ export interface MRT_RowModel<TData extends Record<string, any> = {}> {
|
|
129
132
|
[key: string]: MRT_Row<TData>;
|
130
133
|
};
|
131
134
|
}
|
132
|
-
export type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<Table<TData>, 'getAllColumns' | 'getAllFlatColumns' | 'getAllLeafColumns' | 'getCenterLeafColumns' | 'getColumn' | 'getExpandedRowModel' | 'getFlatHeaders' | 'getLeftLeafColumns' | 'getPaginationRowModel' | 'getPreFilteredRowModel' | 'getPrePaginationRowModel' | 'getRightLeafColumns' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'options'> & {
|
135
|
+
export type MRT_TableInstance<TData extends Record<string, any> = {}> = Prettify<Omit<Table<TData>, 'getAllColumns' | 'getAllFlatColumns' | 'getAllLeafColumns' | 'getCenterLeafColumns' | 'getColumn' | 'getExpandedRowModel' | 'getFlatHeaders' | 'getLeftLeafColumns' | 'getPaginationRowModel' | 'getPreFilteredRowModel' | 'getPrePaginationRowModel' | 'getRightLeafColumns' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'options'> & {
|
133
136
|
getAllColumns: () => MRT_Column<TData>[];
|
134
137
|
getAllFlatColumns: () => MRT_Column<TData>[];
|
135
138
|
getAllLeafColumns: () => MRT_Column<TData>[];
|
@@ -179,8 +182,8 @@ export type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<Tab
|
|
179
182
|
setShowFilters: Dispatch<SetStateAction<boolean>>;
|
180
183
|
setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
|
181
184
|
setShowToolbarDropZone: Dispatch<SetStateAction<boolean>>;
|
182
|
-
}
|
183
|
-
export type MRT_TableState<TData extends Record<string, any> = {}> = TableState & {
|
185
|
+
}>;
|
186
|
+
export type MRT_TableState<TData extends Record<string, any> = {}> = Prettify<TableState & {
|
184
187
|
columnFilterFns: Record<string, MRT_FilterOption>;
|
185
188
|
density: MRT_DensityState;
|
186
189
|
draggingColumn: MRT_Column<TData> | null;
|
@@ -202,7 +205,7 @@ export type MRT_TableState<TData extends Record<string, any> = {}> = TableState
|
|
202
205
|
showProgressBars: boolean;
|
203
206
|
showSkeletons: boolean;
|
204
207
|
showToolbarDropZone: boolean;
|
205
|
-
}
|
208
|
+
}>;
|
206
209
|
export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<ColumnDef<TData, unknown>, 'accessorKey' | 'aggregatedCell' | 'aggregationFn' | 'cell' | 'columns' | 'filterFn' | 'footer' | 'header' | 'id' | 'sortingFn'> & {
|
207
210
|
AggregatedCell?: (props: {
|
208
211
|
cell: MRT_Cell<TData>;
|
@@ -383,22 +386,22 @@ export type MRT_Column<TData extends Record<string, any> = {}> = Omit<Column<TDa
|
|
383
386
|
footer: string;
|
384
387
|
header: string;
|
385
388
|
};
|
386
|
-
export type MRT_Header<TData extends Record<string, any> = {}> = Omit<Header<TData, unknown>, 'column'> & {
|
389
|
+
export type MRT_Header<TData extends Record<string, any> = {}> = Prettify<Omit<Header<TData, unknown>, 'column'> & {
|
387
390
|
column: MRT_Column<TData>;
|
388
|
-
}
|
389
|
-
export type MRT_HeaderGroup<TData extends Record<string, any> = {}> = Omit<HeaderGroup<TData>, 'headers'> & {
|
391
|
+
}>;
|
392
|
+
export type MRT_HeaderGroup<TData extends Record<string, any> = {}> = Prettify<Omit<HeaderGroup<TData>, 'headers'> & {
|
390
393
|
headers: MRT_Header<TData>[];
|
391
|
-
}
|
392
|
-
export type MRT_Row<TData extends Record<string, any> = {}> = Omit<Row<TData>, 'getVisibleCells' | 'getAllCells' | 'subRows' | '_valuesCache'> & {
|
394
|
+
}>;
|
395
|
+
export type MRT_Row<TData extends Record<string, any> = {}> = Prettify<Omit<Row<TData>, 'getVisibleCells' | 'getAllCells' | 'subRows' | '_valuesCache'> & {
|
393
396
|
getAllCells: () => MRT_Cell<TData>[];
|
394
397
|
getVisibleCells: () => MRT_Cell<TData>[];
|
395
398
|
subRows?: MRT_Row<TData>[];
|
396
399
|
_valuesCache: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
|
397
|
-
}
|
398
|
-
export type MRT_Cell<TData extends Record<string, any> = {}> = Omit<Cell<TData, unknown>, 'column' | 'row'> & {
|
400
|
+
}>;
|
401
|
+
export type MRT_Cell<TData extends Record<string, any> = {}> = Prettify<Omit<Cell<TData, unknown>, 'column' | 'row'> & {
|
399
402
|
column: MRT_Column<TData>;
|
400
403
|
row: MRT_Row<TData>;
|
401
|
-
}
|
404
|
+
}>;
|
402
405
|
export type MRT_AggregationOption = string & keyof typeof MRT_AggregationFns;
|
403
406
|
export type MRT_AggregationFn<TData extends Record<string, any> = {}> = AggregationFn<TData> | MRT_AggregationOption;
|
404
407
|
export type MRT_SortingOption = LiteralUnion<string & keyof typeof MRT_SortingFns>;
|
@@ -412,8 +415,9 @@ export type MRT_InternalFilterOption = {
|
|
412
415
|
divider: boolean;
|
413
416
|
};
|
414
417
|
export type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' | 'mrt-row-expand' | 'mrt-row-numbers' | 'mrt-row-select';
|
418
|
+
export type MRT_CreateTableFeature<TData extends Record<string, any> = {}, TFeature = any> = (table: MRT_TableInstance<TData>) => TFeature;
|
415
419
|
/**
|
416
|
-
* `columns` and `data` props are the only required props, but there are over
|
420
|
+
* `columns` and `data` props are the only required props, but there are over 170 other optional props.
|
417
421
|
*
|
418
422
|
* See more info on creating columns and data on the official docs site:
|
419
423
|
* @link https://www.material-react-table.com/docs/getting-started/usage
|
@@ -421,7 +425,7 @@ export type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' | 'mrt-row
|
|
421
425
|
* See the full props list on the official docs site:
|
422
426
|
* @link https://www.material-react-table.com/docs/api/props
|
423
427
|
*/
|
424
|
-
export type MaterialReactTableProps<TData extends Record<string, any> = {}> = Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'defaultColumn' | 'enableRowSelection' | 'expandRowsFn' | 'getRowId' | 'globalFilterFn' | 'initialState' | 'onStateChange' | 'state'> & {
|
428
|
+
export type MaterialReactTableProps<TData extends Record<string, any> = {}> = Prettify<Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'defaultColumn' | 'enableRowSelection' | 'expandRowsFn' | 'getRowId' | 'globalFilterFn' | 'initialState' | 'onStateChange' | 'state'> & {
|
425
429
|
columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
426
430
|
/**
|
427
431
|
* The columns to display in the table. `accessorKey`s or `accessorFn`s must match keys in the `data` prop.
|
@@ -709,15 +713,17 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> = Om
|
|
709
713
|
rowCount?: number;
|
710
714
|
rowNumberMode?: 'original' | 'static';
|
711
715
|
selectAllMode?: 'all' | 'page';
|
716
|
+
/**
|
717
|
+
* Manage state externally any way you want, then pass it back into MRT.
|
718
|
+
*/
|
712
719
|
state?: Partial<MRT_TableState<TData>>;
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
}) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>);
|
720
|
+
/**
|
721
|
+
* Sequence of features important any dependent feature must be defined first
|
722
|
+
*/
|
723
|
+
tableFeatures?: Array<MRT_CreateTableFeature<TData>>;
|
724
|
+
/**
|
725
|
+
* Get access to the table instance via a ref to read state or call built-in methods
|
726
|
+
*/
|
721
727
|
tableInstanceRef?: MutableRefObject<MRT_TableInstance<TData> | null>;
|
722
728
|
/**
|
723
729
|
* @deprecated Use `rowVirtualizerInstanceRef` instead
|
@@ -727,6 +733,15 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> = Om
|
|
727
733
|
* @deprecated Use `rowVirtualizerProps` instead
|
728
734
|
*/
|
729
735
|
virtualizerProps?: any;
|
736
|
+
}> & {
|
737
|
+
columnVirtualizerInstanceRef?: MutableRefObject<Virtualizer<HTMLDivElement, HTMLTableCellElement> | null>;
|
738
|
+
columnVirtualizerProps?: Partial<VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>> | ((props: {
|
739
|
+
table: MRT_TableInstance<TData>;
|
740
|
+
}) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableCellElement>>);
|
741
|
+
rowVirtualizerInstanceRef?: MutableRefObject<Virtualizer<HTMLDivElement, HTMLTableRowElement> | null>;
|
742
|
+
rowVirtualizerProps?: Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>> | ((props: {
|
743
|
+
table: MRT_TableInstance<TData>;
|
744
|
+
}) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>);
|
730
745
|
};
|
731
746
|
declare const MaterialReactTable: <TData extends Record<string, any> = {}>({ aggregationFns, autoResetExpanded, columnResizeMode, defaultColumn, defaultDisplayColumn, editingMode, enableBottomToolbar, enableColumnActions, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableFilterMatchHighlighting, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarInternalActions, enableTopToolbar, filterFns, icons, layoutMode, localization, manualFiltering, manualGrouping, manualPagination, manualSorting, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, rowNumberMode, selectAllMode, sortingFns, ...rest }: MaterialReactTableProps<TData>) => JSX.Element;
|
732
747
|
export default MaterialReactTable;
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import
|
2
|
+
import { VirtualItem, Virtualizer } from '@tanstack/react-virtual';
|
3
|
+
import type { MRT_TableInstance } from '..';
|
3
4
|
interface Props {
|
4
|
-
columnVirtualizer?:
|
5
|
+
columnVirtualizer?: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
5
6
|
table: MRT_TableInstance;
|
6
|
-
virtualColumns?:
|
7
|
+
virtualColumns?: VirtualItem[];
|
7
8
|
virtualPaddingLeft?: number;
|
8
9
|
virtualPaddingRight?: number;
|
9
10
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { RefObject } from 'react';
|
2
|
-
import type {
|
2
|
+
import type { VirtualItem } from '@tanstack/react-virtual';
|
3
|
+
import type { MRT_Cell, MRT_TableInstance } from '..';
|
3
4
|
interface Props {
|
4
5
|
cell: MRT_Cell;
|
5
6
|
enableHover?: boolean;
|
@@ -8,7 +9,7 @@ interface Props {
|
|
8
9
|
rowIndex: number;
|
9
10
|
rowRef: RefObject<HTMLTableRowElement>;
|
10
11
|
table: MRT_TableInstance;
|
11
|
-
virtualCell?:
|
12
|
+
virtualCell?: VirtualItem;
|
12
13
|
}
|
13
14
|
export declare const MRT_TableBodyCell: ({ cell, enableHover, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }: Props) => JSX.Element;
|
14
15
|
export declare const Memo_MRT_TableBodyCell: React.MemoExoticComponent<({ cell, enableHover, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }: Props) => JSX.Element>;
|
@@ -1,16 +1,17 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type {
|
2
|
+
import type { VirtualItem, Virtualizer } from '@tanstack/react-virtual';
|
3
|
+
import type { MRT_Row, MRT_TableInstance } from '..';
|
3
4
|
interface Props {
|
4
|
-
columnVirtualizer?:
|
5
|
+
columnVirtualizer?: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
5
6
|
measureElement?: (element: HTMLTableRowElement) => void;
|
6
7
|
numRows: number;
|
7
8
|
row: MRT_Row;
|
8
9
|
rowIndex: number;
|
9
10
|
table: MRT_TableInstance;
|
10
|
-
virtualColumns?:
|
11
|
+
virtualColumns?: VirtualItem[];
|
11
12
|
virtualPaddingLeft?: number;
|
12
13
|
virtualPaddingRight?: number;
|
13
|
-
virtualRow?:
|
14
|
+
virtualRow?: VirtualItem;
|
14
15
|
}
|
15
16
|
export declare const MRT_TableBodyRow: ({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }: Props) => JSX.Element;
|
16
17
|
export declare const Memo_MRT_TableBodyRow: React.MemoExoticComponent<({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }: Props) => JSX.Element>;
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type {
|
2
|
+
import type { VirtualItem } from '@tanstack/react-virtual';
|
3
|
+
import type { MRT_Row, MRT_TableInstance } from '..';
|
3
4
|
interface Props {
|
4
5
|
parentRowRef: React.RefObject<HTMLTableRowElement>;
|
5
6
|
row: MRT_Row;
|
6
7
|
table: MRT_TableInstance;
|
7
|
-
virtualRow?:
|
8
|
+
virtualRow?: VirtualItem;
|
8
9
|
}
|
9
10
|
export declare const MRT_TableDetailPanel: ({ parentRowRef, row, table, virtualRow, }: Props) => JSX.Element;
|
10
11
|
export {};
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import type {
|
1
|
+
import type { Row } from '@tanstack/react-table';
|
2
2
|
import { MRT_AggregationFns } from './aggregationFns';
|
3
3
|
import { MRT_FilterFns } from './filterFns';
|
4
4
|
import { MRT_SortingFns } from './sortingFns';
|
5
5
|
import type { TableCellProps } from '@mui/material/TableCell';
|
6
6
|
import type { Theme } from '@mui/material/styles';
|
7
|
-
import type { MaterialReactTableProps, MRT_Column, MRT_ColumnDef, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterOption, MRT_Header, MRT_TableInstance } from '.';
|
7
|
+
import type { MaterialReactTableProps, MRT_Column, MRT_ColumnDef, MRT_ColumnOrderState, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterOption, MRT_GroupingState, MRT_Header, MRT_TableInstance } from '.';
|
8
8
|
export declare const getColumnId: <TData extends Record<string, any> = {}>(columnDef: MRT_ColumnDef<TData>) => string;
|
9
9
|
export declare const getAllLeafColumnDefs: <TData extends Record<string, any> = {}>(columns: MRT_ColumnDef<TData>[]) => MRT_ColumnDef<TData>[];
|
10
10
|
export declare const prepareColumns: <TData extends Record<string, any> = {}>({ aggregationFns, columnDefs, columnFilterFns, defaultDisplayColumn, filterFns, sortingFns, }: {
|
@@ -100,8 +100,8 @@ export declare const prepareColumns: <TData extends Record<string, any> = {}>({
|
|
100
100
|
basic: import("@tanstack/react-table").SortingFn<any>;
|
101
101
|
} & Record<string, import("@tanstack/react-table").SortingFn<any>>;
|
102
102
|
}) => MRT_DefinedColumnDef<TData>[];
|
103
|
-
export declare const reorderColumn: <TData extends Record<string, any> = {}>(draggedColumn: MRT_Column<TData>, targetColumn: MRT_Column<TData>, columnOrder:
|
104
|
-
export declare const showExpandColumn: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>, grouping?:
|
103
|
+
export declare const reorderColumn: <TData extends Record<string, any> = {}>(draggedColumn: MRT_Column<TData>, targetColumn: MRT_Column<TData>, columnOrder: MRT_ColumnOrderState) => MRT_ColumnOrderState;
|
104
|
+
export declare const showExpandColumn: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>, grouping?: MRT_GroupingState) => boolean;
|
105
105
|
export declare const getLeadingDisplayColumnIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => MRT_DisplayColumnIds[];
|
106
106
|
export declare const getTrailingDisplayColumnIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => (string | false | undefined)[];
|
107
107
|
export declare const getDefaultColumnOrderIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => string[];
|
@@ -113,7 +113,23 @@ export declare const getIsFirstRightPinnedColumn: (column: MRT_Column) => boolea
|
|
113
113
|
export declare const getTotalRight: (table: MRT_TableInstance, column: MRT_Column) => number;
|
114
114
|
export declare const getCommonCellStyles: ({ column, header, table, tableCellProps, theme, }: {
|
115
115
|
column: MRT_Column;
|
116
|
-
header?:
|
116
|
+
header?: {
|
117
|
+
id: string;
|
118
|
+
getContext: () => import("@tanstack/react-table").HeaderContext<{}, unknown>;
|
119
|
+
getLeafHeaders: () => import("@tanstack/react-table").Header<{}, unknown>[];
|
120
|
+
depth: number;
|
121
|
+
getSize: () => number;
|
122
|
+
getStart: (position?: import("@tanstack/react-table").ColumnPinningPosition | undefined) => number;
|
123
|
+
index: number;
|
124
|
+
colSpan: number;
|
125
|
+
rowSpan: number;
|
126
|
+
headerGroup: import("@tanstack/react-table").HeaderGroup<{}>;
|
127
|
+
subHeaders: import("@tanstack/react-table").Header<{}, unknown>[];
|
128
|
+
isPlaceholder: boolean;
|
129
|
+
placeholderId?: string | undefined;
|
130
|
+
getResizeHandler: () => (event: unknown) => void;
|
131
|
+
column: MRT_Column<{}>;
|
132
|
+
} | undefined;
|
117
133
|
table: MRT_TableInstance;
|
118
134
|
tableCellProps: TableCellProps;
|
119
135
|
theme: Theme;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import type {
|
2
|
+
import type { VirtualItem } from '@tanstack/react-virtual';
|
3
|
+
import type { MRT_TableInstance } from '..';
|
3
4
|
interface Props {
|
4
5
|
table: MRT_TableInstance;
|
5
|
-
virtualColumns?:
|
6
|
+
virtualColumns?: VirtualItem[];
|
6
7
|
virtualPaddingLeft?: number;
|
7
8
|
virtualPaddingRight?: number;
|
8
9
|
}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import
|
2
|
+
import { VirtualItem } from '@tanstack/react-virtual';
|
3
|
+
import type { MRT_HeaderGroup, MRT_TableInstance } from '..';
|
3
4
|
interface Props {
|
4
5
|
footerGroup: MRT_HeaderGroup;
|
5
6
|
table: MRT_TableInstance;
|
6
|
-
virtualColumns?:
|
7
|
+
virtualColumns?: VirtualItem[];
|
7
8
|
virtualPaddingLeft?: number;
|
8
9
|
virtualPaddingRight?: number;
|
9
10
|
}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import type {
|
2
|
+
import type { VirtualItem } from '@tanstack/react-virtual';
|
3
|
+
import type { MRT_TableInstance } from '..';
|
3
4
|
interface Props {
|
4
5
|
table: MRT_TableInstance;
|
5
|
-
virtualColumns?:
|
6
|
+
virtualColumns?: VirtualItem[];
|
6
7
|
virtualPaddingLeft?: number;
|
7
8
|
virtualPaddingRight?: number;
|
8
9
|
}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import type {
|
2
|
+
import type { VirtualItem } from '@tanstack/react-virtual';
|
3
|
+
import type { MRT_HeaderGroup, MRT_TableInstance } from '..';
|
3
4
|
interface Props {
|
4
5
|
headerGroup: MRT_HeaderGroup;
|
5
6
|
table: MRT_TableInstance;
|
6
|
-
virtualColumns?:
|
7
|
+
virtualColumns?: VirtualItem[];
|
7
8
|
virtualPaddingLeft?: number;
|
8
9
|
virtualPaddingRight?: number;
|
9
10
|
}
|
@@ -9,4 +9,120 @@ export declare const MRT_SortingFns: {
|
|
9
9
|
datetime: import("@tanstack/react-table").SortingFn<any>;
|
10
10
|
basic: import("@tanstack/react-table").SortingFn<any>;
|
11
11
|
};
|
12
|
-
export declare const rankGlobalFuzzy: <TData extends Record<string, any> = {}>(rowA:
|
12
|
+
export declare const rankGlobalFuzzy: <TData extends Record<string, any> = {}>(rowA: {
|
13
|
+
getValue: <TValue>(columnId: string) => TValue;
|
14
|
+
renderValue: <TValue_1>(columnId: string) => TValue_1;
|
15
|
+
id: string;
|
16
|
+
getIsGrouped: () => boolean;
|
17
|
+
depth: number;
|
18
|
+
index: number;
|
19
|
+
original: TData;
|
20
|
+
_uniqueValuesCache: Record<string, unknown>;
|
21
|
+
getUniqueValues: <TValue_2>(columnId: string) => TValue_2[];
|
22
|
+
getLeafRows: () => Row<TData>[];
|
23
|
+
originalSubRows?: TData[] | undefined;
|
24
|
+
_getAllCellsByColumnId: () => Record<string, import("@tanstack/react-table").Cell<TData, unknown>>;
|
25
|
+
_getAllVisibleCells: () => import("@tanstack/react-table").Cell<TData, unknown>[];
|
26
|
+
getLeftVisibleCells: () => import("@tanstack/react-table").Cell<TData, unknown>[];
|
27
|
+
getCenterVisibleCells: () => import("@tanstack/react-table").Cell<TData, unknown>[];
|
28
|
+
getRightVisibleCells: () => import("@tanstack/react-table").Cell<TData, unknown>[];
|
29
|
+
columnFilters: Record<string, boolean>;
|
30
|
+
columnFiltersMeta: Record<string, import("@tanstack/react-table").FilterMeta>;
|
31
|
+
groupingColumnId?: string | undefined;
|
32
|
+
groupingValue?: unknown;
|
33
|
+
_groupingValuesCache: Record<string, any>;
|
34
|
+
getIsSelected: () => boolean;
|
35
|
+
getIsSomeSelected: () => boolean;
|
36
|
+
getIsAllSubRowsSelected: () => boolean;
|
37
|
+
getCanSelect: () => boolean;
|
38
|
+
getCanMultiSelect: () => boolean;
|
39
|
+
getCanSelectSubRows: () => boolean;
|
40
|
+
toggleSelected: (value?: boolean | undefined) => void;
|
41
|
+
getToggleSelectedHandler: () => (event: unknown) => void;
|
42
|
+
toggleExpanded: (expanded?: boolean | undefined) => void;
|
43
|
+
getIsExpanded: () => boolean;
|
44
|
+
getCanExpand: () => boolean;
|
45
|
+
getToggleExpandedHandler: () => () => void;
|
46
|
+
getAllCells: () => {
|
47
|
+
getValue: import("@tanstack/react-table").Getter<unknown>;
|
48
|
+
renderValue: import("@tanstack/react-table").Getter<unknown>;
|
49
|
+
id: string;
|
50
|
+
getContext: () => import("@tanstack/react-table").CellContext<TData, unknown>;
|
51
|
+
getIsGrouped: () => boolean;
|
52
|
+
getIsPlaceholder: () => boolean;
|
53
|
+
getIsAggregated: () => boolean;
|
54
|
+
column: import("./MaterialReactTable").MRT_Column<TData>;
|
55
|
+
row: any;
|
56
|
+
}[];
|
57
|
+
getVisibleCells: () => {
|
58
|
+
getValue: import("@tanstack/react-table").Getter<unknown>;
|
59
|
+
renderValue: import("@tanstack/react-table").Getter<unknown>;
|
60
|
+
id: string;
|
61
|
+
getContext: () => import("@tanstack/react-table").CellContext<TData, unknown>;
|
62
|
+
getIsGrouped: () => boolean;
|
63
|
+
getIsPlaceholder: () => boolean;
|
64
|
+
getIsAggregated: () => boolean;
|
65
|
+
column: import("./MaterialReactTable").MRT_Column<TData>;
|
66
|
+
row: any;
|
67
|
+
}[];
|
68
|
+
subRows?: any[] | undefined;
|
69
|
+
_valuesCache: Record<(string & Record<never, never>) | (string & import("@tanstack/react-table").DeepKeys<TData>), any>;
|
70
|
+
}, rowB: {
|
71
|
+
getValue: <TValue>(columnId: string) => TValue;
|
72
|
+
renderValue: <TValue_1>(columnId: string) => TValue_1;
|
73
|
+
id: string;
|
74
|
+
getIsGrouped: () => boolean;
|
75
|
+
depth: number;
|
76
|
+
index: number;
|
77
|
+
original: TData;
|
78
|
+
_uniqueValuesCache: Record<string, unknown>;
|
79
|
+
getUniqueValues: <TValue_2>(columnId: string) => TValue_2[];
|
80
|
+
getLeafRows: () => Row<TData>[];
|
81
|
+
originalSubRows?: TData[] | undefined;
|
82
|
+
_getAllCellsByColumnId: () => Record<string, import("@tanstack/react-table").Cell<TData, unknown>>;
|
83
|
+
_getAllVisibleCells: () => import("@tanstack/react-table").Cell<TData, unknown>[];
|
84
|
+
getLeftVisibleCells: () => import("@tanstack/react-table").Cell<TData, unknown>[];
|
85
|
+
getCenterVisibleCells: () => import("@tanstack/react-table").Cell<TData, unknown>[];
|
86
|
+
getRightVisibleCells: () => import("@tanstack/react-table").Cell<TData, unknown>[];
|
87
|
+
columnFilters: Record<string, boolean>;
|
88
|
+
columnFiltersMeta: Record<string, import("@tanstack/react-table").FilterMeta>;
|
89
|
+
groupingColumnId?: string | undefined;
|
90
|
+
groupingValue?: unknown;
|
91
|
+
_groupingValuesCache: Record<string, any>;
|
92
|
+
getIsSelected: () => boolean;
|
93
|
+
getIsSomeSelected: () => boolean;
|
94
|
+
getIsAllSubRowsSelected: () => boolean;
|
95
|
+
getCanSelect: () => boolean;
|
96
|
+
getCanMultiSelect: () => boolean;
|
97
|
+
getCanSelectSubRows: () => boolean;
|
98
|
+
toggleSelected: (value?: boolean | undefined) => void;
|
99
|
+
getToggleSelectedHandler: () => (event: unknown) => void;
|
100
|
+
toggleExpanded: (expanded?: boolean | undefined) => void;
|
101
|
+
getIsExpanded: () => boolean;
|
102
|
+
getCanExpand: () => boolean;
|
103
|
+
getToggleExpandedHandler: () => () => void;
|
104
|
+
getAllCells: () => {
|
105
|
+
getValue: import("@tanstack/react-table").Getter<unknown>;
|
106
|
+
renderValue: import("@tanstack/react-table").Getter<unknown>;
|
107
|
+
id: string;
|
108
|
+
getContext: () => import("@tanstack/react-table").CellContext<TData, unknown>;
|
109
|
+
getIsGrouped: () => boolean;
|
110
|
+
getIsPlaceholder: () => boolean;
|
111
|
+
getIsAggregated: () => boolean;
|
112
|
+
column: import("./MaterialReactTable").MRT_Column<TData>;
|
113
|
+
row: any;
|
114
|
+
}[];
|
115
|
+
getVisibleCells: () => {
|
116
|
+
getValue: import("@tanstack/react-table").Getter<unknown>;
|
117
|
+
renderValue: import("@tanstack/react-table").Getter<unknown>;
|
118
|
+
id: string;
|
119
|
+
getContext: () => import("@tanstack/react-table").CellContext<TData, unknown>;
|
120
|
+
getIsGrouped: () => boolean;
|
121
|
+
getIsPlaceholder: () => boolean;
|
122
|
+
getIsAggregated: () => boolean;
|
123
|
+
column: import("./MaterialReactTable").MRT_Column<TData>;
|
124
|
+
row: any;
|
125
|
+
}[];
|
126
|
+
subRows?: any[] | undefined;
|
127
|
+
_valuesCache: Record<(string & Record<never, never>) | (string & import("@tanstack/react-table").DeepKeys<TData>), any>;
|
128
|
+
}) => number;
|
@@ -581,15 +581,18 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
581
581
|
}
|
582
582
|
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
|
583
583
|
['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'].includes(option)) {
|
584
|
-
if (currentFilterValue
|
584
|
+
if (currentFilterValue instanceof String ||
|
585
|
+
(currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.length)) {
|
585
586
|
column.setFilterValue([]);
|
586
587
|
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue([]);
|
587
588
|
}
|
588
589
|
}
|
589
590
|
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range' ||
|
590
591
|
['between', 'betweenInclusive', 'inNumberRange'].includes(option)) {
|
591
|
-
|
592
|
-
|
592
|
+
if (!(currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.every((v) => v === ''))) {
|
593
|
+
column.setFilterValue(['', '']);
|
594
|
+
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
595
|
+
}
|
593
596
|
}
|
594
597
|
else {
|
595
598
|
if (!['', undefined].includes(currentFilterValue)) {
|
@@ -1047,7 +1050,7 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
|
1047
1050
|
setEditingRow(Object.assign({}, row));
|
1048
1051
|
setAnchorEl(null);
|
1049
1052
|
};
|
1050
|
-
return (React.createElement(React.Fragment, null, renderRowActions ? (
|
1053
|
+
return (React.createElement(React.Fragment, null, renderRowActions ? (renderRowActions({ cell, row, table })) : row.id === (editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) && editingMode === 'row' ? (React.createElement(MRT_EditActionButtons, { row: row, table: table })) : !renderRowActionMenuItems &&
|
1051
1054
|
(enableEditing instanceof Function
|
1052
1055
|
? enableEditing(row)
|
1053
1056
|
: enableEditing) ? (React.createElement(Tooltip, { placement: "right", arrow: true, title: localization.edit },
|
@@ -1879,7 +1882,11 @@ const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
|
1879
1882
|
transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
|
1880
1883
|
? 'translateX(-0.5ch)'
|
1881
1884
|
: undefined,
|
1882
|
-
}, IconComponent: ArrowDownwardIcon
|
1885
|
+
}, IconComponent: ArrowDownwardIcon, onClick: (e) => {
|
1886
|
+
var _a;
|
1887
|
+
e.stopPropagation();
|
1888
|
+
(_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
|
1889
|
+
} })));
|
1883
1890
|
};
|
1884
1891
|
|
1885
1892
|
const MRT_TableHeadCell = ({ header, table }) => {
|
@@ -2670,7 +2677,7 @@ const MRT_Table = ({ table }) => {
|
|
2670
2677
|
colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
|
2671
2678
|
}
|
2672
2679
|
return colSizes;
|
2673
|
-
}, [columns, columnSizing, columnSizingInfo]);
|
2680
|
+
}, [columns, columnSizing, columnSizingInfo, columnVisibility]);
|
2674
2681
|
//get first 16 column widths and average them
|
2675
2682
|
const averageColumnWidth = useMemo(() => {
|
2676
2683
|
var _a, _b, _c, _d;
|
@@ -2952,6 +2959,11 @@ const MRT_TableRoot = (props) => {
|
|
2952
2959
|
tablePaperRef,
|
2953
2960
|
topToolbarRef,
|
2954
2961
|
}, setColumnFilterFns: (_0 = props.onColumnFilterFnsChange) !== null && _0 !== void 0 ? _0 : setColumnFilterFns, setDensity: (_1 = props.onDensityChange) !== null && _1 !== void 0 ? _1 : setDensity, setDraggingColumn: (_2 = props.onDraggingColumnChange) !== null && _2 !== void 0 ? _2 : setDraggingColumn, setDraggingRow: (_3 = props.onDraggingRowChange) !== null && _3 !== void 0 ? _3 : setDraggingRow, setEditingCell: (_4 = props.onEditingCellChange) !== null && _4 !== void 0 ? _4 : setEditingCell, setEditingRow: (_5 = props.onEditingRowChange) !== null && _5 !== void 0 ? _5 : setEditingRow, setGlobalFilterFn: (_6 = props.onGlobalFilterFnChange) !== null && _6 !== void 0 ? _6 : setGlobalFilterFn, setHoveredColumn: (_7 = props.onHoveredColumnChange) !== null && _7 !== void 0 ? _7 : setHoveredColumn, setHoveredRow: (_8 = props.onHoveredRowChange) !== null && _8 !== void 0 ? _8 : setHoveredRow, setIsFullScreen: (_9 = props.onIsFullScreenChange) !== null && _9 !== void 0 ? _9 : setIsFullScreen, setShowAlertBanner: (_10 = props.onShowAlertBannerChange) !== null && _10 !== void 0 ? _10 : setShowAlertBanner, setShowFilters: (_11 = props.onShowFiltersChange) !== null && _11 !== void 0 ? _11 : setShowFilters, setShowGlobalFilter: (_12 = props.onShowGlobalFilterChange) !== null && _12 !== void 0 ? _12 : setShowGlobalFilter, setShowToolbarDropZone: (_13 = props.onShowToolbarDropZoneChange) !== null && _13 !== void 0 ? _13 : setShowToolbarDropZone });
|
2962
|
+
if (props.tableFeatures) {
|
2963
|
+
props.tableFeatures.forEach((feature) => {
|
2964
|
+
Object.assign(table, feature(table));
|
2965
|
+
});
|
2966
|
+
}
|
2955
2967
|
if (props.tableInstanceRef) {
|
2956
2968
|
props.tableInstanceRef.current = table;
|
2957
2969
|
}
|