material-react-table 0.33.6 → 0.35.0
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/MaterialReactTable.d.ts +45 -53
- package/dist/cjs/buttons/MRT_ColumnPinningButtons.d.ts +4 -5
- package/dist/cjs/buttons/MRT_FullScreenToggleButton.d.ts +3 -4
- package/dist/cjs/buttons/MRT_GrabHandleButton.d.ts +4 -4
- package/dist/cjs/buttons/MRT_ShowHideColumnsButton.d.ts +3 -4
- package/dist/cjs/buttons/MRT_ToggleDensePaddingButton.d.ts +3 -4
- package/dist/cjs/buttons/MRT_ToggleFiltersButton.d.ts +3 -4
- package/dist/cjs/buttons/MRT_ToggleGlobalFilterButton.d.ts +3 -4
- package/dist/cjs/index.d.ts +8 -2
- package/dist/cjs/index.js +651 -140
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/inputs/MRT_GlobalFilterTextField.d.ts +3 -4
- package/dist/cjs/menus/MRT_FilterOptionMenu.d.ts +3 -4
- package/dist/cjs/menus/MRT_ShowHideColumnsMenu.d.ts +3 -4
- package/dist/cjs/menus/MRT_ShowHideColumnsMenuItems.d.ts +8 -8
- package/dist/cjs/table/MRT_TableRoot.d.ts +0 -1
- package/dist/cjs/toolbar/MRT_ToolbarInternalButtons.d.ts +1 -1
- package/dist/esm/MaterialReactTable.d.ts +45 -53
- package/dist/esm/buttons/MRT_ColumnPinningButtons.d.ts +4 -5
- package/dist/esm/buttons/MRT_FullScreenToggleButton.d.ts +3 -4
- package/dist/esm/buttons/MRT_GrabHandleButton.d.ts +4 -4
- package/dist/esm/buttons/MRT_ShowHideColumnsButton.d.ts +3 -4
- package/dist/esm/buttons/MRT_ToggleDensePaddingButton.d.ts +3 -4
- package/dist/esm/buttons/MRT_ToggleFiltersButton.d.ts +3 -4
- package/dist/esm/buttons/MRT_ToggleGlobalFilterButton.d.ts +3 -4
- package/dist/esm/index.d.ts +8 -2
- package/dist/esm/inputs/MRT_GlobalFilterTextField.d.ts +3 -4
- package/dist/esm/material-react-table.esm.js +644 -141
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/menus/MRT_FilterOptionMenu.d.ts +3 -4
- package/dist/esm/menus/MRT_ShowHideColumnsMenu.d.ts +3 -4
- package/dist/esm/menus/MRT_ShowHideColumnsMenuItems.d.ts +8 -8
- package/dist/esm/table/MRT_TableRoot.d.ts +0 -1
- package/dist/esm/toolbar/MRT_ToolbarInternalButtons.d.ts +1 -1
- package/dist/index.d.ts +76 -54
- package/package.json +5 -5
- package/src/MaterialReactTable.tsx +49 -50
- package/src/body/MRT_TableBody.tsx +30 -11
- package/src/body/MRT_TableBodyCell.tsx +17 -18
- package/src/body/MRT_TableBodyRow.tsx +7 -10
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +5 -5
- package/src/buttons/MRT_ColumnPinningButtons.tsx +10 -5
- package/src/buttons/MRT_EditActionButtons.tsx +10 -6
- package/src/buttons/MRT_FullScreenToggleButton.tsx +10 -4
- package/src/buttons/MRT_GrabHandleButton.tsx +5 -5
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +10 -4
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +10 -4
- package/src/buttons/MRT_ToggleFiltersButton.tsx +10 -4
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +10 -4
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +4 -4
- package/src/head/MRT_TableHeadCell.tsx +11 -16
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +11 -12
- package/src/index.tsx +17 -3
- package/src/inputs/MRT_EditCellTextField.tsx +13 -13
- package/src/inputs/MRT_GlobalFilterTextField.tsx +8 -10
- package/src/menus/MRT_FilterOptionMenu.tsx +5 -5
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +13 -10
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +24 -22
- package/src/table/MRT_TableRoot.tsx +59 -66
- package/src/toolbar/MRT_ToolbarDropZone.tsx +6 -10
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +2 -7
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
1
|
import type { MRT_Header, MRT_TableInstance } from '..';
|
|
3
2
|
import { MRT_Localization } from '../localization';
|
|
4
3
|
export declare const internalFilterOptions: (localization: MRT_Localization) => {
|
|
@@ -7,12 +6,12 @@ export declare const internalFilterOptions: (localization: MRT_Localization) =>
|
|
|
7
6
|
label: string;
|
|
8
7
|
divider: boolean;
|
|
9
8
|
}[];
|
|
10
|
-
interface Props {
|
|
9
|
+
interface Props<TData extends Record<string, any> = {}> {
|
|
11
10
|
anchorEl: HTMLElement | null;
|
|
12
11
|
header?: MRT_Header;
|
|
13
12
|
onSelect?: () => void;
|
|
14
13
|
setAnchorEl: (anchorEl: HTMLElement | null) => void;
|
|
15
|
-
table: MRT_TableInstance
|
|
14
|
+
table: MRT_TableInstance<TData>;
|
|
16
15
|
}
|
|
17
|
-
export declare const MRT_FilterOptionMenu:
|
|
16
|
+
export declare const MRT_FilterOptionMenu: <TData extends Record<string, any> = {}>({ anchorEl, header, onSelect, setAnchorEl, table, }: Props<TData>) => JSX.Element;
|
|
18
17
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
1
|
import type { MRT_TableInstance } from '..';
|
|
3
|
-
interface Props {
|
|
2
|
+
interface Props<TData extends Record<string, any> = {}> {
|
|
4
3
|
anchorEl: HTMLElement | null;
|
|
5
4
|
isSubMenu?: boolean;
|
|
6
5
|
setAnchorEl: (anchorEl: HTMLElement | null) => void;
|
|
7
|
-
table: MRT_TableInstance
|
|
6
|
+
table: MRT_TableInstance<TData>;
|
|
8
7
|
}
|
|
9
|
-
export declare const MRT_ShowHideColumnsMenu:
|
|
8
|
+
export declare const MRT_ShowHideColumnsMenu: <TData extends Record<string, any> = {}>({ anchorEl, isSubMenu, setAnchorEl, table, }: Props<TData>) => JSX.Element;
|
|
10
9
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Dispatch,
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import type { MRT_Column, MRT_TableInstance } from '..';
|
|
3
|
-
interface Props {
|
|
4
|
-
allColumns: MRT_Column[];
|
|
5
|
-
column: MRT_Column
|
|
6
|
-
|
|
3
|
+
interface Props<TData extends Record<string, any> = {}> {
|
|
4
|
+
allColumns: MRT_Column<TData>[];
|
|
5
|
+
column: MRT_Column<TData>;
|
|
6
|
+
hoveredColumn: MRT_Column<TData> | null;
|
|
7
7
|
isSubMenu?: boolean;
|
|
8
|
-
|
|
9
|
-
table: MRT_TableInstance
|
|
8
|
+
setHoveredColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
|
|
9
|
+
table: MRT_TableInstance<TData>;
|
|
10
10
|
}
|
|
11
|
-
export declare const MRT_ShowHideColumnsMenuItems:
|
|
11
|
+
export declare const MRT_ShowHideColumnsMenuItems: <TData extends Record<string, any> = {}>({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }: Props<TData>) => JSX.Element;
|
|
12
12
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction, ReactNode, FocusEvent, ChangeEvent, DragEvent
|
|
1
|
+
import { Dispatch, SetStateAction, ReactNode, FocusEvent, ChangeEvent, DragEvent } from 'react';
|
|
2
2
|
import { ButtonProps, TextFieldProps, TableCellProps, IconButtonProps, LinearProgressProps, CheckboxProps, SkeletonProps, TableBodyProps, TableRowProps, ToolbarProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, PaperProps, TableProps, AlertProps } from '@mui/material';
|
|
3
3
|
import { Row, Table, TableState, ColumnDef, DeepKeys, Column, Header, HeaderGroup, Cell, SortingFn, FilterFn, TableOptions, OnChangeFn } from '@tanstack/react-table';
|
|
4
|
-
import {
|
|
4
|
+
import { Options } from 'react-virtual';
|
|
5
5
|
import * as _tanstack_table_core from '@tanstack/table-core';
|
|
6
6
|
import { RankingInfo } from '@tanstack/match-sorter-utils';
|
|
7
7
|
|
|
@@ -226,40 +226,40 @@ declare type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<Ta
|
|
|
226
226
|
tableId: string;
|
|
227
227
|
localization: MRT_Localization;
|
|
228
228
|
};
|
|
229
|
-
setCurrentDraggingColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
|
|
230
|
-
setCurrentDraggingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
|
|
231
|
-
setCurrentEditingCell: Dispatch<SetStateAction<MRT_Cell | null>>;
|
|
232
|
-
setCurrentEditingRow: Dispatch<SetStateAction<MRT_Row | null>>;
|
|
233
229
|
setColumnFilterFns: Dispatch<SetStateAction<{
|
|
234
230
|
[key: string]: MRT_FilterOption;
|
|
235
231
|
}>>;
|
|
232
|
+
setDensity: Dispatch<SetStateAction<'comfortable' | 'compact' | 'spacious'>>;
|
|
233
|
+
setDraggingColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
|
|
234
|
+
setDraggingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
|
|
235
|
+
setEditingCell: Dispatch<SetStateAction<MRT_Cell | null>>;
|
|
236
|
+
setEditingRow: Dispatch<SetStateAction<MRT_Row | null>>;
|
|
236
237
|
setGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterOption>>;
|
|
237
|
-
|
|
238
|
+
setHoveredColumn: Dispatch<SetStateAction<MRT_Column<TData> | {
|
|
238
239
|
id: string;
|
|
239
240
|
} | null>>;
|
|
240
|
-
|
|
241
|
+
setHoveredRow: Dispatch<SetStateAction<MRT_Row<TData> | {
|
|
241
242
|
id: string;
|
|
242
243
|
} | null>>;
|
|
243
|
-
setDensity: Dispatch<SetStateAction<'comfortable' | 'compact' | 'spacious'>>;
|
|
244
244
|
setIsFullScreen: Dispatch<SetStateAction<boolean>>;
|
|
245
245
|
setShowAlertBanner: Dispatch<SetStateAction<boolean>>;
|
|
246
246
|
setShowFilters: Dispatch<SetStateAction<boolean>>;
|
|
247
247
|
setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
|
|
248
248
|
};
|
|
249
249
|
declare type MRT_TableState<TData extends Record<string, any> = {}> = TableState & {
|
|
250
|
-
currentDraggingColumn: MRT_Column<TData> | null;
|
|
251
|
-
currentDraggingRow: MRT_Row<TData> | null;
|
|
252
|
-
currentEditingCell: MRT_Cell<TData> | null;
|
|
253
|
-
currentEditingRow: MRT_Row<TData> | null;
|
|
254
250
|
columnFilterFns: Record<string, MRT_FilterOption>;
|
|
255
|
-
|
|
256
|
-
|
|
251
|
+
density: 'comfortable' | 'compact' | 'spacious';
|
|
252
|
+
draggingColumn: MRT_Column<TData> | null;
|
|
253
|
+
draggingRow: MRT_Row<TData> | null;
|
|
254
|
+
editingCell: MRT_Cell<TData> | null;
|
|
255
|
+
editingRow: MRT_Row<TData> | null;
|
|
256
|
+
globalFilterFn: MRT_FilterOption;
|
|
257
|
+
hoveredColumn: MRT_Column<TData> | {
|
|
257
258
|
id: string;
|
|
258
259
|
} | null;
|
|
259
|
-
|
|
260
|
+
hoveredRow: MRT_Row<TData> | {
|
|
260
261
|
id: string;
|
|
261
262
|
} | null;
|
|
262
|
-
density: 'comfortable' | 'compact' | 'spacious';
|
|
263
263
|
isFullScreen: boolean;
|
|
264
264
|
isLoading: boolean;
|
|
265
265
|
showAlertBanner: boolean;
|
|
@@ -389,15 +389,17 @@ declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<Column
|
|
|
389
389
|
table: MRT_TableInstance<TData>;
|
|
390
390
|
column: MRT_Column<TData>;
|
|
391
391
|
}) => TableCellProps);
|
|
392
|
-
onCellEditBlur?: ({ cell, event, table, }: {
|
|
392
|
+
onCellEditBlur?: ({ cell, event, table, value, }: {
|
|
393
393
|
event: FocusEvent<HTMLInputElement>;
|
|
394
394
|
cell: MRT_Cell<TData>;
|
|
395
395
|
table: MRT_TableInstance<TData>;
|
|
396
|
+
value: string;
|
|
396
397
|
}) => void;
|
|
397
|
-
onCellEditChange?: ({ cell, event, table, }: {
|
|
398
|
+
onCellEditChange?: ({ cell, event, table, value, }: {
|
|
398
399
|
event: ChangeEvent<HTMLInputElement>;
|
|
399
400
|
cell: MRT_Cell<TData>;
|
|
400
401
|
table: MRT_TableInstance<TData>;
|
|
402
|
+
value: string;
|
|
401
403
|
}) => void;
|
|
402
404
|
sortingFn?: MRT_SortingFn;
|
|
403
405
|
};
|
|
@@ -422,7 +424,7 @@ declare type MRT_Row<TData extends Record<string, any> = {}> = Omit<Row<TData>,
|
|
|
422
424
|
getAllCells: () => MRT_Cell<TData>[];
|
|
423
425
|
getVisibleCells: () => MRT_Cell<TData>[];
|
|
424
426
|
subRows?: MRT_Row<TData>[];
|
|
425
|
-
_valuesCache
|
|
427
|
+
_valuesCache: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
|
|
426
428
|
};
|
|
427
429
|
declare type MRT_Cell<TData extends Record<string, any> = {}> = Omit<Cell<TData, unknown>, 'column' | 'row'> & {
|
|
428
430
|
column: MRT_Column<TData>;
|
|
@@ -442,10 +444,11 @@ declare type MRT_DisplayColumnIds = 'mrt-row-drag' | 'mrt-row-actions' | 'mrt-ro
|
|
|
442
444
|
* See the full props list on the official docs site:
|
|
443
445
|
* @link https://www.material-react-table.com/docs/api/props
|
|
444
446
|
*/
|
|
445
|
-
declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'expandRowsFn' | 'initialState' | 'onStateChange' | 'state'> & {
|
|
447
|
+
declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'defaultColumn' | 'enableRowSelection' | 'expandRowsFn' | 'initialState' | 'onStateChange' | 'state'> & {
|
|
446
448
|
columnFilterModeOptions?: (MRT_FilterOption | string)[] | null;
|
|
447
449
|
columns: MRT_ColumnDef<TData>[];
|
|
448
450
|
data: TData[];
|
|
451
|
+
defaultColumn?: Partial<MRT_ColumnDef<TData>>;
|
|
449
452
|
displayColumnDefOptions?: Partial<{
|
|
450
453
|
[key in MRT_DisplayColumnIds]: Partial<MRT_ColumnDef>;
|
|
451
454
|
}>;
|
|
@@ -467,6 +470,7 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
467
470
|
enableRowDragging?: boolean;
|
|
468
471
|
enableRowNumbers?: boolean;
|
|
469
472
|
enableRowOrdering?: boolean;
|
|
473
|
+
enableRowSelection?: boolean | ((row: MRT_Row<TData>) => boolean);
|
|
470
474
|
enableRowVirtualization?: boolean;
|
|
471
475
|
enableSelectAll?: boolean;
|
|
472
476
|
enableStickyHeader?: boolean;
|
|
@@ -587,15 +591,17 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
587
591
|
muiTableTopToolbarProps?: ToolbarProps | (({ table }: {
|
|
588
592
|
table: MRT_TableInstance<TData>;
|
|
589
593
|
}) => ToolbarProps);
|
|
590
|
-
onCellEditBlur?: ({ cell, event, table, }: {
|
|
594
|
+
onCellEditBlur?: ({ cell, event, table, value, }: {
|
|
591
595
|
event: FocusEvent<HTMLInputElement>;
|
|
592
596
|
cell: MRT_Cell<TData>;
|
|
593
597
|
table: MRT_TableInstance<TData>;
|
|
598
|
+
value: string;
|
|
594
599
|
}) => void;
|
|
595
|
-
onCellEditChange?: ({ cell, event, table, }: {
|
|
600
|
+
onCellEditChange?: ({ cell, event, table, value, }: {
|
|
596
601
|
event: ChangeEvent<HTMLInputElement>;
|
|
597
602
|
cell: MRT_Cell<TData>;
|
|
598
603
|
table: MRT_TableInstance<TData>;
|
|
604
|
+
value: string;
|
|
599
605
|
}) => void;
|
|
600
606
|
onColumnDrop?: ({ event, draggedColumn, targetColumn, }: {
|
|
601
607
|
event: DragEvent<HTMLButtonElement>;
|
|
@@ -604,21 +610,22 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
604
610
|
id: string;
|
|
605
611
|
} | null;
|
|
606
612
|
}) => void;
|
|
607
|
-
onCurrentDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
608
|
-
onCurrentDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
609
|
-
onCurrentEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
|
|
610
|
-
onCurrentEditingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
611
|
-
onCurrentFilterFnsChange?: OnChangeFn<{
|
|
612
|
-
[key: string]: MRT_FilterOption;
|
|
613
|
-
}>;
|
|
614
|
-
onCurrentGlobalFilterFnChange?: OnChangeFn<MRT_FilterOption>;
|
|
615
|
-
onCurrentHoveredColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
616
|
-
onCurrentHoveredRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
617
613
|
onDensityChange?: OnChangeFn<boolean>;
|
|
618
|
-
|
|
614
|
+
onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
615
|
+
onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
616
|
+
onEditRowSubmit?: ({ row, table, values, }: {
|
|
619
617
|
row: MRT_Row<TData>;
|
|
620
618
|
table: MRT_TableInstance<TData>;
|
|
619
|
+
values: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
|
|
621
620
|
}) => Promise<void> | void;
|
|
621
|
+
onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
|
|
622
|
+
onEditingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
623
|
+
onFilterFnsChange?: OnChangeFn<{
|
|
624
|
+
[key: string]: MRT_FilterOption;
|
|
625
|
+
}>;
|
|
626
|
+
onGlobalFilterFnChange?: OnChangeFn<MRT_FilterOption>;
|
|
627
|
+
onHoveredColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
628
|
+
onHoveredRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
622
629
|
onIsFullScreenChange?: OnChangeFn<boolean>;
|
|
623
630
|
onRowDrop?: ({ event, draggedRow, targetRow, }: {
|
|
624
631
|
event: DragEvent<HTMLButtonElement>;
|
|
@@ -652,23 +659,8 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
652
659
|
row: MRT_Row<TData>;
|
|
653
660
|
table: MRT_TableInstance<TData>;
|
|
654
661
|
}) => ReactNode;
|
|
655
|
-
renderToolbarInternalActions?: ({ table,
|
|
656
|
-
table: MRT_TableInstance<TData>;
|
|
657
|
-
MRT_ToggleGlobalFilterButton: FC<IconButtonProps & {
|
|
658
|
-
table: MRT_TableInstance<TData>;
|
|
659
|
-
}>;
|
|
660
|
-
MRT_ToggleFiltersButton: FC<IconButtonProps & {
|
|
661
|
-
table: MRT_TableInstance<TData>;
|
|
662
|
-
}>;
|
|
663
|
-
MRT_ShowHideColumnsButton: FC<IconButtonProps & {
|
|
664
|
-
table: MRT_TableInstance<TData>;
|
|
665
|
-
}>;
|
|
666
|
-
MRT_ToggleDensePaddingButton: FC<IconButtonProps & {
|
|
667
|
-
table: MRT_TableInstance<TData>;
|
|
668
|
-
}>;
|
|
669
|
-
MRT_FullScreenToggleButton: FC<IconButtonProps & {
|
|
670
|
-
table: MRT_TableInstance<TData>;
|
|
671
|
-
}>;
|
|
662
|
+
renderToolbarInternalActions?: ({ table, }: {
|
|
663
|
+
table: MRT_TableInstance<TData>;
|
|
672
664
|
}) => ReactNode;
|
|
673
665
|
renderTopToolbarCustomActions?: ({ table, }: {
|
|
674
666
|
table: MRT_TableInstance<TData>;
|
|
@@ -678,10 +670,40 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
678
670
|
selectAllMode?: 'all' | 'page';
|
|
679
671
|
state?: Partial<MRT_TableState<TData>>;
|
|
680
672
|
tableId?: string;
|
|
681
|
-
virtualizerProps?: Partial<
|
|
673
|
+
virtualizerProps?: Partial<Options<HTMLDivElement>> | (({ table, }: {
|
|
682
674
|
table: MRT_TableInstance<TData>;
|
|
683
|
-
}) => Partial<
|
|
675
|
+
}) => Partial<Options<HTMLDivElement>>);
|
|
684
676
|
};
|
|
685
677
|
declare const _default: <TData extends Record<string, any> = {}>({ aggregationFns, autoResetExpanded, columnResizeMode, defaultColumn, editingMode, enableBottomToolbar, enableColumnActions, enableColumnFilterChangeMode, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterChangeMode, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarInternalActions, enableTopToolbar, filterFns, icons, localization, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, rowNumberMode, selectAllMode, sortingFns, ...rest }: MaterialReactTableProps<TData>) => JSX.Element;
|
|
686
678
|
|
|
687
|
-
|
|
679
|
+
interface Props$5<TData extends Record<string, any> = {}> extends IconButtonProps {
|
|
680
|
+
table: MRT_TableInstance<TData>;
|
|
681
|
+
}
|
|
682
|
+
declare const MRT_FullScreenToggleButton: <TData extends Record<string, any> = {}>({ table, ...rest }: Props$5<TData>) => JSX.Element;
|
|
683
|
+
|
|
684
|
+
interface Props$4<TData extends Record<string, any> = {}> {
|
|
685
|
+
table: MRT_TableInstance<TData>;
|
|
686
|
+
}
|
|
687
|
+
declare const MRT_GlobalFilterTextField: <TData extends Record<string, any> = {}>({ table, }: Props$4<TData>) => JSX.Element;
|
|
688
|
+
|
|
689
|
+
interface Props$3<TData extends Record<string, any> = {}> extends IconButtonProps {
|
|
690
|
+
table: MRT_TableInstance<TData>;
|
|
691
|
+
}
|
|
692
|
+
declare const MRT_ShowHideColumnsButton: <TData extends Record<string, any> = {}>({ table, ...rest }: Props$3<TData>) => JSX.Element;
|
|
693
|
+
|
|
694
|
+
interface Props$2<TData extends Record<string, any> = {}> extends IconButtonProps {
|
|
695
|
+
table: MRT_TableInstance<TData>;
|
|
696
|
+
}
|
|
697
|
+
declare const MRT_ToggleDensePaddingButton: <TData extends Record<string, any> = {}>({ table, ...rest }: Props$2<TData>) => JSX.Element;
|
|
698
|
+
|
|
699
|
+
interface Props$1<TData extends Record<string, any> = {}> extends IconButtonProps {
|
|
700
|
+
table: MRT_TableInstance<TData>;
|
|
701
|
+
}
|
|
702
|
+
declare const MRT_ToggleFiltersButton: <TData extends Record<string, any> = {}>({ table, ...rest }: Props$1<TData>) => JSX.Element;
|
|
703
|
+
|
|
704
|
+
interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
|
|
705
|
+
table: MRT_TableInstance<TData>;
|
|
706
|
+
}
|
|
707
|
+
declare const MRT_ToggleGlobalFilterButton: <TData extends Record<string, any> = {}>({ table, ...rest }: Props<TData>) => JSX.Element;
|
|
708
|
+
|
|
709
|
+
export { MRT_Cell, MRT_Column, MRT_ColumnDef, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterFn, MRT_FilterOption, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_Header, MRT_HeaderGroup, MRT_Icons, MRT_Localization, MRT_Row, MRT_RowModel, MRT_ShowHideColumnsButton, MRT_SortingFn, MRT_SortingOption, MRT_TableInstance, MRT_TableState, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTableProps, _default as default };
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.35.0",
|
|
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.",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@emotion/styled": "^11.10.0",
|
|
56
56
|
"@faker-js/faker": "^7.3.0",
|
|
57
57
|
"@mui/icons-material": "^5.8.4",
|
|
58
|
-
"@mui/material": "^5.
|
|
58
|
+
"@mui/material": "^5.10.0",
|
|
59
59
|
"@rollup/plugin-babel": "^5.3.1",
|
|
60
60
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
61
61
|
"@rollup/plugin-typescript": "^8.3.4",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@storybook/addon-storysource": "^6.5.10",
|
|
69
69
|
"@storybook/addons": "^6.5.10",
|
|
70
70
|
"@storybook/react": "^6.5.10",
|
|
71
|
-
"@types/react": "^18.0.
|
|
71
|
+
"@types/react": "^18.0.17",
|
|
72
72
|
"@types/react-dom": "^18.0.6",
|
|
73
73
|
"babel-loader": "^8.2.5",
|
|
74
74
|
"eslint": "^8.21.0",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@tanstack/match-sorter-utils": "8.1.1",
|
|
98
|
-
"@tanstack/react-table": "8.5.
|
|
99
|
-
"
|
|
98
|
+
"@tanstack/react-table": "8.5.11",
|
|
99
|
+
"react-virtual": "^2.10.4"
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -2,7 +2,6 @@ import React, {
|
|
|
2
2
|
ChangeEvent,
|
|
3
3
|
Dispatch,
|
|
4
4
|
DragEvent,
|
|
5
|
-
FC,
|
|
6
5
|
FocusEvent,
|
|
7
6
|
ReactNode,
|
|
8
7
|
SetStateAction,
|
|
@@ -41,7 +40,8 @@ import type {
|
|
|
41
40
|
TableOptions,
|
|
42
41
|
TableState,
|
|
43
42
|
} from '@tanstack/react-table';
|
|
44
|
-
import type { VirtualizerOptions } from '
|
|
43
|
+
import type { Options as VirtualizerOptions } from 'react-virtual';
|
|
44
|
+
// import type { VirtualizerOptions } from '@tanstack/react-virtual';
|
|
45
45
|
import { MRT_AggregationFns } from './aggregationFns';
|
|
46
46
|
import { MRT_Default_Icons, MRT_Icons } from './icons';
|
|
47
47
|
import { MRT_FilterFns } from './filterFns';
|
|
@@ -96,23 +96,21 @@ export type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<
|
|
|
96
96
|
tableId: string;
|
|
97
97
|
localization: MRT_Localization;
|
|
98
98
|
};
|
|
99
|
-
setCurrentDraggingColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
|
|
100
|
-
setCurrentDraggingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
|
|
101
|
-
setCurrentEditingCell: Dispatch<SetStateAction<MRT_Cell | null>>;
|
|
102
|
-
setCurrentEditingRow: Dispatch<SetStateAction<MRT_Row | null>>;
|
|
103
99
|
setColumnFilterFns: Dispatch<
|
|
104
|
-
SetStateAction<{
|
|
105
|
-
[key: string]: MRT_FilterOption;
|
|
106
|
-
}>
|
|
100
|
+
SetStateAction<{ [key: string]: MRT_FilterOption }>
|
|
107
101
|
>;
|
|
102
|
+
setDensity: Dispatch<SetStateAction<'comfortable' | 'compact' | 'spacious'>>;
|
|
103
|
+
setDraggingColumn: Dispatch<SetStateAction<MRT_Column<TData> | null>>;
|
|
104
|
+
setDraggingRow: Dispatch<SetStateAction<MRT_Row<TData> | null>>;
|
|
105
|
+
setEditingCell: Dispatch<SetStateAction<MRT_Cell | null>>;
|
|
106
|
+
setEditingRow: Dispatch<SetStateAction<MRT_Row | null>>;
|
|
108
107
|
setGlobalFilterFn: Dispatch<SetStateAction<MRT_FilterOption>>;
|
|
109
|
-
|
|
108
|
+
setHoveredColumn: Dispatch<
|
|
110
109
|
SetStateAction<MRT_Column<TData> | { id: string } | null>
|
|
111
110
|
>;
|
|
112
|
-
|
|
111
|
+
setHoveredRow: Dispatch<
|
|
113
112
|
SetStateAction<MRT_Row<TData> | { id: string } | null>
|
|
114
113
|
>;
|
|
115
|
-
setDensity: Dispatch<SetStateAction<'comfortable' | 'compact' | 'spacious'>>;
|
|
116
114
|
setIsFullScreen: Dispatch<SetStateAction<boolean>>;
|
|
117
115
|
setShowAlertBanner: Dispatch<SetStateAction<boolean>>;
|
|
118
116
|
setShowFilters: Dispatch<SetStateAction<boolean>>;
|
|
@@ -121,15 +119,15 @@ export type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<
|
|
|
121
119
|
|
|
122
120
|
export type MRT_TableState<TData extends Record<string, any> = {}> =
|
|
123
121
|
TableState & {
|
|
124
|
-
currentDraggingColumn: MRT_Column<TData> | null;
|
|
125
|
-
currentDraggingRow: MRT_Row<TData> | null;
|
|
126
|
-
currentEditingCell: MRT_Cell<TData> | null;
|
|
127
|
-
currentEditingRow: MRT_Row<TData> | null;
|
|
128
122
|
columnFilterFns: Record<string, MRT_FilterOption>;
|
|
129
|
-
globalFilterFn: Record<string, MRT_FilterOption>;
|
|
130
|
-
currentHoveredColumn: MRT_Column<TData> | { id: string } | null;
|
|
131
|
-
currentHoveredRow: MRT_Row<TData> | { id: string } | null;
|
|
132
123
|
density: 'comfortable' | 'compact' | 'spacious';
|
|
124
|
+
draggingColumn: MRT_Column<TData> | null;
|
|
125
|
+
draggingRow: MRT_Row<TData> | null;
|
|
126
|
+
editingCell: MRT_Cell<TData> | null;
|
|
127
|
+
editingRow: MRT_Row<TData> | null;
|
|
128
|
+
globalFilterFn: MRT_FilterOption;
|
|
129
|
+
hoveredColumn: MRT_Column<TData> | { id: string } | null;
|
|
130
|
+
hoveredRow: MRT_Row<TData> | { id: string } | null;
|
|
133
131
|
isFullScreen: boolean;
|
|
134
132
|
isLoading: boolean;
|
|
135
133
|
showAlertBanner: boolean;
|
|
@@ -340,19 +338,23 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
|
|
|
340
338
|
cell,
|
|
341
339
|
event,
|
|
342
340
|
table,
|
|
341
|
+
value,
|
|
343
342
|
}: {
|
|
344
343
|
event: FocusEvent<HTMLInputElement>;
|
|
345
344
|
cell: MRT_Cell<TData>;
|
|
346
345
|
table: MRT_TableInstance<TData>;
|
|
346
|
+
value: string;
|
|
347
347
|
}) => void;
|
|
348
348
|
onCellEditChange?: ({
|
|
349
349
|
cell,
|
|
350
350
|
event,
|
|
351
351
|
table,
|
|
352
|
+
value,
|
|
352
353
|
}: {
|
|
353
354
|
event: ChangeEvent<HTMLInputElement>;
|
|
354
355
|
cell: MRT_Cell<TData>;
|
|
355
356
|
table: MRT_TableInstance<TData>;
|
|
357
|
+
value: string;
|
|
356
358
|
}) => void;
|
|
357
359
|
sortingFn?: MRT_SortingFn;
|
|
358
360
|
};
|
|
@@ -397,7 +399,7 @@ export type MRT_Row<TData extends Record<string, any> = {}> = Omit<
|
|
|
397
399
|
getAllCells: () => MRT_Cell<TData>[];
|
|
398
400
|
getVisibleCells: () => MRT_Cell<TData>[];
|
|
399
401
|
subRows?: MRT_Row<TData>[];
|
|
400
|
-
_valuesCache
|
|
402
|
+
_valuesCache: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
|
|
401
403
|
};
|
|
402
404
|
|
|
403
405
|
export type MRT_Cell<TData extends Record<string, any> = {}> = Omit<
|
|
@@ -445,6 +447,8 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
445
447
|
Partial<TableOptions<TData>>,
|
|
446
448
|
| 'columns'
|
|
447
449
|
| 'data'
|
|
450
|
+
| 'defaultColumn'
|
|
451
|
+
| 'enableRowSelection'
|
|
448
452
|
| 'expandRowsFn'
|
|
449
453
|
| 'initialState'
|
|
450
454
|
| 'onStateChange'
|
|
@@ -453,6 +457,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
453
457
|
columnFilterModeOptions?: (MRT_FilterOption | string)[] | null;
|
|
454
458
|
columns: MRT_ColumnDef<TData>[];
|
|
455
459
|
data: TData[];
|
|
460
|
+
defaultColumn?: Partial<MRT_ColumnDef<TData>>;
|
|
456
461
|
displayColumnDefOptions?: Partial<{
|
|
457
462
|
[key in MRT_DisplayColumnIds]: Partial<MRT_ColumnDef>;
|
|
458
463
|
}>;
|
|
@@ -474,6 +479,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
474
479
|
enableRowDragging?: boolean;
|
|
475
480
|
enableRowNumbers?: boolean;
|
|
476
481
|
enableRowOrdering?: boolean;
|
|
482
|
+
enableRowSelection?: boolean | ((row: MRT_Row<TData>) => boolean);
|
|
477
483
|
enableRowVirtualization?: boolean;
|
|
478
484
|
enableSelectAll?: boolean;
|
|
479
485
|
enableStickyHeader?: boolean;
|
|
@@ -691,19 +697,23 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
691
697
|
cell,
|
|
692
698
|
event,
|
|
693
699
|
table,
|
|
700
|
+
value,
|
|
694
701
|
}: {
|
|
695
702
|
event: FocusEvent<HTMLInputElement>;
|
|
696
703
|
cell: MRT_Cell<TData>;
|
|
697
704
|
table: MRT_TableInstance<TData>;
|
|
705
|
+
value: string;
|
|
698
706
|
}) => void;
|
|
699
707
|
onCellEditChange?: ({
|
|
700
708
|
cell,
|
|
701
709
|
event,
|
|
702
710
|
table,
|
|
711
|
+
value,
|
|
703
712
|
}: {
|
|
704
713
|
event: ChangeEvent<HTMLInputElement>;
|
|
705
714
|
cell: MRT_Cell<TData>;
|
|
706
715
|
table: MRT_TableInstance<TData>;
|
|
716
|
+
value: string;
|
|
707
717
|
}) => void;
|
|
708
718
|
onColumnDrop?: ({
|
|
709
719
|
event,
|
|
@@ -714,22 +724,24 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
714
724
|
draggedColumn: MRT_Column<TData>;
|
|
715
725
|
targetColumn: MRT_Column<TData> | { id: string } | null;
|
|
716
726
|
}) => void;
|
|
717
|
-
onCurrentDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
718
|
-
onCurrentDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
719
|
-
onCurrentEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
|
|
720
|
-
onCurrentEditingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
721
|
-
onCurrentFilterFnsChange?: OnChangeFn<{ [key: string]: MRT_FilterOption }>;
|
|
722
|
-
onCurrentGlobalFilterFnChange?: OnChangeFn<MRT_FilterOption>;
|
|
723
|
-
onCurrentHoveredColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
724
|
-
onCurrentHoveredRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
725
727
|
onDensityChange?: OnChangeFn<boolean>;
|
|
728
|
+
onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
729
|
+
onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
726
730
|
onEditRowSubmit?: ({
|
|
727
731
|
row,
|
|
728
732
|
table,
|
|
733
|
+
values,
|
|
729
734
|
}: {
|
|
730
735
|
row: MRT_Row<TData>;
|
|
731
736
|
table: MRT_TableInstance<TData>;
|
|
737
|
+
values: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
|
|
732
738
|
}) => Promise<void> | void;
|
|
739
|
+
onEditingCellChange?: OnChangeFn<MRT_Cell<TData> | null>;
|
|
740
|
+
onEditingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
741
|
+
onFilterFnsChange?: OnChangeFn<{ [key: string]: MRT_FilterOption }>;
|
|
742
|
+
onGlobalFilterFnChange?: OnChangeFn<MRT_FilterOption>;
|
|
743
|
+
onHoveredColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
744
|
+
onHoveredRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
733
745
|
onIsFullScreenChange?: OnChangeFn<boolean>;
|
|
734
746
|
onRowDrop?: ({
|
|
735
747
|
event,
|
|
@@ -779,28 +791,8 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
779
791
|
}) => ReactNode;
|
|
780
792
|
renderToolbarInternalActions?: ({
|
|
781
793
|
table,
|
|
782
|
-
MRT_ToggleGlobalFilterButton,
|
|
783
|
-
MRT_ToggleFiltersButton,
|
|
784
|
-
MRT_ShowHideColumnsButton,
|
|
785
|
-
MRT_ToggleDensePaddingButton,
|
|
786
|
-
MRT_FullScreenToggleButton,
|
|
787
794
|
}: {
|
|
788
795
|
table: MRT_TableInstance<TData>;
|
|
789
|
-
MRT_ToggleGlobalFilterButton: FC<
|
|
790
|
-
IconButtonProps & { table: MRT_TableInstance<TData> }
|
|
791
|
-
>;
|
|
792
|
-
MRT_ToggleFiltersButton: FC<
|
|
793
|
-
IconButtonProps & { table: MRT_TableInstance<TData> }
|
|
794
|
-
>;
|
|
795
|
-
MRT_ShowHideColumnsButton: FC<
|
|
796
|
-
IconButtonProps & { table: MRT_TableInstance<TData> }
|
|
797
|
-
>;
|
|
798
|
-
MRT_ToggleDensePaddingButton: FC<
|
|
799
|
-
IconButtonProps & { table: MRT_TableInstance<TData> }
|
|
800
|
-
>;
|
|
801
|
-
MRT_FullScreenToggleButton: FC<
|
|
802
|
-
IconButtonProps & { table: MRT_TableInstance<TData> }
|
|
803
|
-
>;
|
|
804
796
|
}) => ReactNode;
|
|
805
797
|
renderTopToolbarCustomActions?: ({
|
|
806
798
|
table,
|
|
@@ -813,12 +805,19 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
813
805
|
state?: Partial<MRT_TableState<TData>>;
|
|
814
806
|
tableId?: string;
|
|
815
807
|
virtualizerProps?:
|
|
816
|
-
| Partial<VirtualizerOptions<HTMLDivElement
|
|
808
|
+
| Partial<VirtualizerOptions<HTMLDivElement>>
|
|
817
809
|
| (({
|
|
818
810
|
table,
|
|
819
811
|
}: {
|
|
820
812
|
table: MRT_TableInstance<TData>;
|
|
821
|
-
}) => Partial<VirtualizerOptions<HTMLDivElement
|
|
813
|
+
}) => Partial<VirtualizerOptions<HTMLDivElement>>);
|
|
814
|
+
// virtualizerProps?:
|
|
815
|
+
// | Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>
|
|
816
|
+
// | (({
|
|
817
|
+
// table,
|
|
818
|
+
// }: {
|
|
819
|
+
// table: MRT_TableInstance<TData>;
|
|
820
|
+
// }) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>);
|
|
822
821
|
};
|
|
823
822
|
|
|
824
823
|
export default <TData extends Record<string, any> = {}>({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { FC, RefObject, useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useVirtual } from 'react-virtual';
|
|
3
|
+
// import { useVirtualizer, Virtualizer } from '@tanstack/react-virtual';
|
|
3
4
|
import { TableBody } from '@mui/material';
|
|
4
5
|
import { MRT_TableBodyRow } from './MRT_TableBodyRow';
|
|
5
6
|
import { rankGlobalFuzzy } from '../sortingFns';
|
|
@@ -23,7 +24,7 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
23
24
|
virtualizerProps,
|
|
24
25
|
},
|
|
25
26
|
} = table;
|
|
26
|
-
const {
|
|
27
|
+
const { globalFilter, pagination, sorting } = getState();
|
|
27
28
|
|
|
28
29
|
const tableBodyProps =
|
|
29
30
|
muiTableBodyProps instanceof Function
|
|
@@ -61,28 +62,47 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
61
62
|
globalFilter,
|
|
62
63
|
]);
|
|
63
64
|
|
|
64
|
-
const rowVirtualizer
|
|
65
|
-
?
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
overscan: 10,
|
|
65
|
+
const rowVirtualizer = enableRowVirtualization
|
|
66
|
+
? useVirtual({
|
|
67
|
+
size: rows.length,
|
|
68
|
+
parentRef: tableContainerRef,
|
|
69
|
+
overscan: 15,
|
|
70
70
|
...vProps,
|
|
71
71
|
})
|
|
72
72
|
: ({} as any);
|
|
73
73
|
|
|
74
|
+
// const rowVirtualizer: Virtualizer = enableRowVirtualization
|
|
75
|
+
// ? useVirtualizer({
|
|
76
|
+
// count: rows.length,
|
|
77
|
+
// estimateSize: () => (density === 'compact' ? 25 : 50),
|
|
78
|
+
// getScrollElement: () => tableContainerRef.current as HTMLDivElement,
|
|
79
|
+
// overscan: 15,
|
|
80
|
+
// ...vProps,
|
|
81
|
+
// })
|
|
82
|
+
// : ({} as any);
|
|
83
|
+
|
|
74
84
|
const virtualRows = enableRowVirtualization
|
|
75
|
-
? rowVirtualizer.
|
|
85
|
+
? rowVirtualizer.virtualItems
|
|
76
86
|
: [];
|
|
77
87
|
|
|
88
|
+
// const virtualRows = enableRowVirtualization
|
|
89
|
+
// ? rowVirtualizer.getVirtualItems()
|
|
90
|
+
// : [];
|
|
91
|
+
|
|
78
92
|
let paddingTop = 0;
|
|
79
93
|
let paddingBottom = 0;
|
|
80
94
|
if (enableRowVirtualization) {
|
|
81
95
|
paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
|
|
82
96
|
paddingBottom = !!virtualRows.length
|
|
83
|
-
? rowVirtualizer.
|
|
97
|
+
? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end
|
|
84
98
|
: 0;
|
|
85
99
|
}
|
|
100
|
+
// if (enableRowVirtualization) {
|
|
101
|
+
// paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
|
|
102
|
+
// paddingBottom = !!virtualRows.length
|
|
103
|
+
// ? rowVirtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
|
|
104
|
+
// : 0;
|
|
105
|
+
// }
|
|
86
106
|
|
|
87
107
|
return (
|
|
88
108
|
<TableBody {...tableBodyProps}>
|
|
@@ -91,7 +111,6 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
91
111
|
<td style={{ height: `${paddingTop}px` }} />
|
|
92
112
|
</tr>
|
|
93
113
|
)}
|
|
94
|
-
{/* @ts-ignore */}
|
|
95
114
|
{(enableRowVirtualization ? virtualRows : rows).map(
|
|
96
115
|
(rowOrVirtualRow: any, rowIndex: number) => {
|
|
97
116
|
const row = enableRowVirtualization
|