material-react-table 1.0.0-beta.5 → 1.0.0-beta.8

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/README.md CHANGED
@@ -48,10 +48,12 @@ See all [Props and Options](https://www.material-react-table.com/docs/api)
48
48
 
49
49
  View additional [storybook examples](https://www.material-react-table.dev/)
50
50
 
51
- ## Features (All Features work and are MVP, but are still being polished)
51
+ ## Features
52
52
 
53
53
  _All features can easily be enabled/disabled_
54
54
 
55
+ _**Fully Fleshed out [Docs](https://www.material-react-table.com/docs/guides#guides) are available for all features**_
56
+
55
57
  - [x] < 37kb gzipped - [Bundlephobia](https://bundlephobia.com/package/material-react-table)
56
58
  - [x] Advanced TypeScript Generics Support (TypeScript Optional)
57
59
  - [x] Aggregation and Grouping (Sum, Average, Count, etc.)
@@ -63,7 +65,7 @@ _All features can easily be enabled/disabled_
63
65
  - [x] Column Resizing
64
66
  - [x] Customize Icons
65
67
  - [x] Customize Styling of internal Mui Components
66
- - [x] Data Editing (3 different editing modes)
68
+ - [x] Data Editing (4 different editing modes)
67
69
  - [x] Density Toggle
68
70
  - [x] Detail Panels (Expansion)
69
71
  - [x] Filtering (supports client-side and server-side)
@@ -71,7 +73,7 @@ _All features can easily be enabled/disabled_
71
73
  - [x] Global Filtering (Search across all columns, rank by best match)
72
74
  - [x] Header Groups & Footers
73
75
  - [x] Localization (i18n) support
74
- - [x] Manage your own state
76
+ - [x] Manage your own state or let the table manage it internally for you
75
77
  - [x] Pagination (supports client-side and server-side)
76
78
  - [x] Row Actions (Your Custom Action Buttons)
77
79
  - [x] Row Numbers
@@ -112,33 +114,31 @@ npm install material-react-table
112
114
  import React, { useMemo, useRef, useState, useEffect } from 'react';
113
115
  import MaterialReactTable from 'material-react-table';
114
116
 
117
+ const data = [
118
+ {
119
+ name: 'John',
120
+ age: 30,
121
+ },
122
+ {
123
+ name: 'Sara',
124
+ age: 25,
125
+ },
126
+ ]
127
+
115
128
  export default function App() {
116
129
  const columns = useMemo(
117
130
  () => [
118
131
  {
119
132
  accessorKey: 'name', //simple recommended way to define a column
120
133
  header: 'Name',
121
- muiTableHeadCellProps: { sx: { color: 'green' } }, //custom props
134
+ muiTableHeadCellProps: { sx: { color: 'green' } }, //optional custom props
135
+ Cell: ({ cell}) => <span>{cell.getValue()}</span>, //optional custom cell render
122
136
  },
123
137
  {
124
138
  accessorFn: (row) => row.age, //alternate way
125
139
  id: 'age', //id required if you use accessorFn instead of accessorKey
126
140
  header: 'Age',
127
- Header: <i>Age</i>, //optional custom markup
128
- },
129
- ],
130
- [],
131
- );
132
-
133
- const data = useMemo(
134
- () => [
135
- {
136
- name: 'John',
137
- age: 30,
138
- },
139
- {
140
- name: 'Sara',
141
- age: 25,
141
+ Header: () => <i>Age</i>, //optional custom header render
142
142
  },
143
143
  ],
144
144
  [],
@@ -170,7 +170,7 @@ export default function App() {
170
170
  state={{ rowSelection }} //manage your own state, pass it back to the table (optional)
171
171
  tableInstanceRef={tableInstanceRef} //get a reference to the underlying table instance (optional)
172
172
  />
173
- );
173
+ );
174
174
  }
175
175
  ```
176
176
 
@@ -1,4 +1,4 @@
1
- import { Dispatch, DragEvent, MutableRefObject, ReactNode, SetStateAction } from 'react';
1
+ import { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react';
2
2
  import type { AlertProps, ButtonProps, CheckboxProps, ChipProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
3
3
  import type { Cell, Column, ColumnDef, DeepKeys, FilterFn, Header, HeaderGroup, OnChangeFn, Row, SortingFn, Table, TableOptions, TableState } from '@tanstack/react-table';
4
4
  import type { Options as VirtualizerOptions, VirtualItem } from 'react-virtual';
@@ -40,6 +40,7 @@ export declare type MRT_TableInstance<TData extends Record<string, any> = {}> =
40
40
  filterInputRefs: MutableRefObject<Record<string, HTMLInputElement>>;
41
41
  searchInputRef: MutableRefObject<HTMLInputElement>;
42
42
  tableContainerRef: MutableRefObject<HTMLDivElement>;
43
+ tablePaperRef: MutableRefObject<HTMLDivElement>;
43
44
  topToolbarRef: MutableRefObject<HTMLDivElement>;
44
45
  };
45
46
  setColumnFilterFns: Dispatch<SetStateAction<{
@@ -439,13 +440,6 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
439
440
  muiTopToolbarProps?: ToolbarProps | (({ table }: {
440
441
  table: MRT_TableInstance<TData>;
441
442
  }) => ToolbarProps);
442
- onColumnDrop?: ({ event, draggedColumn, targetColumn, }: {
443
- event: DragEvent<HTMLButtonElement>;
444
- draggedColumn: MRT_Column<TData>;
445
- targetColumn: MRT_Column<TData> | {
446
- id: string;
447
- } | null;
448
- }) => void;
449
443
  onDensityChange?: OnChangeFn<boolean>;
450
444
  onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
451
445
  onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
@@ -464,13 +458,6 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
464
458
  onHoveredColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
465
459
  onHoveredRowChange?: OnChangeFn<MRT_Row<TData> | null>;
466
460
  onIsFullScreenChange?: OnChangeFn<boolean>;
467
- onRowDrop?: ({ event, draggedRow, targetRow, }: {
468
- event: DragEvent<HTMLButtonElement>;
469
- draggedRow: MRT_Row<TData>;
470
- targetRow: MRT_Row<TData> | {
471
- id: string;
472
- } | null;
473
- }) => void;
474
461
  onShowAlertBannerChange?: OnChangeFn<boolean>;
475
462
  onShowFiltersChange?: OnChangeFn<boolean>;
476
463
  onShowGlobalFilterChange?: OnChangeFn<boolean>;
package/dist/cjs/index.js CHANGED
@@ -479,11 +479,11 @@ const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table,
479
479
  var _a;
480
480
  const { options: { icons: { DragHandleIcon }, localization, }, } = table;
481
481
  return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.move },
482
- React__default["default"].createElement(material.IconButton, Object.assign({ disableRipple: true, draggable: "true", onDragStart: onDragStart, onDragEnd: onDragEnd, size: "small" }, iconButtonProps, { onClick: (e) => {
482
+ React__default["default"].createElement(material.IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, iconButtonProps, { onClick: (e) => {
483
483
  var _a;
484
484
  e.stopPropagation();
485
485
  (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
486
- }, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
486
+ }, onDragStart: onDragStart, onDragEnd: onDragEnd, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
487
487
  backgroundColor: 'transparent',
488
488
  opacity: 1,
489
489
  }, '&:active': {
@@ -1312,7 +1312,11 @@ const MRT_TopToolbar = ({ table }) => {
1312
1312
  width: '100%',
1313
1313
  } },
1314
1314
  enableGlobalFilter && positionGlobalFilter === 'left' && (React__default["default"].createElement(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : React__default["default"].createElement("span", null),
1315
- enableToolbarInternalActions ? (React__default["default"].createElement(material.Box, { sx: { display: 'flex', flexWrap: 'wrap' } },
1315
+ enableToolbarInternalActions ? (React__default["default"].createElement(material.Box, { sx: {
1316
+ display: 'flex',
1317
+ flexWrap: 'wrap-reverse',
1318
+ justifyContent: 'flex-end',
1319
+ } },
1316
1320
  enableGlobalFilter && positionGlobalFilter === 'right' && (React__default["default"].createElement(MRT_GlobalFilterTextField, { table: table })),
1317
1321
  React__default["default"].createElement(MRT_ToolbarInternalButtons, { table: table }))) : (enableGlobalFilter &&
1318
1322
  positionGlobalFilter === 'right' && (React__default["default"].createElement(MRT_GlobalFilterTextField, { table: table })))),
@@ -1604,11 +1608,8 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1604
1608
  const { options: { icons: { FilterAltIcon }, localization, }, } = table;
1605
1609
  const { column } = header;
1606
1610
  const { columnDef } = column;
1607
- const isRangeFilter = [
1608
- 'between',
1609
- 'betweenInclusive',
1610
- 'inNumberRange',
1611
- ].includes(columnDef._filterFn);
1611
+ const isRangeFilter = columnDef.filterVariant === 'range' ||
1612
+ ['between', 'betweenInclusive', 'inNumberRange'].includes(columnDef._filterFn);
1612
1613
  const currentFilterOption = columnDef._filterFn;
1613
1614
  const filterTooltip = localization.filteringByColumn
1614
1615
  .replace('{column}', String(columnDef.header))
@@ -1620,8 +1621,8 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1620
1621
  ? column.getFilterValue().join(`" ${isRangeFilter ? localization.and : localization.or} "`)
1621
1622
  : column.getFilterValue()}"`)
1622
1623
  .replace('" "', '');
1623
- return (React__default["default"].createElement(material.Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && isRangeFilter) ||
1624
- (!isRangeFilter && // @ts-ignore
1624
+ return (React__default["default"].createElement(material.Grow, { unmountOnExit: true, in: (!!column.getFilterValue() && !isRangeFilter) ||
1625
+ (isRangeFilter && // @ts-ignore
1625
1626
  (!!((_b = column.getFilterValue()) === null || _b === void 0 ? void 0 : _b[0]) || !!((_c = column.getFilterValue()) === null || _c === void 0 ? void 0 : _c[1]))) },
1626
1627
  React__default["default"].createElement("span", null,
1627
1628
  React__default["default"].createElement(material.Tooltip, { arrow: true, placement: "top", title: filterTooltip },
@@ -1638,7 +1639,7 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
1638
1639
  };
1639
1640
 
1640
1641
  const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1641
- const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps, onColumnDrop, }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
1642
+ const { getState, options: { enableColumnOrdering, muiTableHeadCellDragHandleProps }, setColumnOrder, setDraggingColumn, setHoveredColumn, } = table;
1642
1643
  const { columnDef } = column;
1643
1644
  const { hoveredColumn, draggingColumn, columnOrder } = getState();
1644
1645
  const mIconButtonProps = muiTableHeadCellDragHandleProps instanceof Function
@@ -1648,16 +1649,15 @@ const MRT_TableHeadCellGrabHandle = ({ column, table, tableHeadCellRef, }) => {
1648
1649
  ? columnDef.muiTableHeadCellDragHandleProps({ column, table })
1649
1650
  : columnDef.muiTableHeadCellDragHandleProps;
1650
1651
  const iconButtonProps = Object.assign(Object.assign({}, mIconButtonProps), mcIconButtonProps);
1651
- const handleDragStart = (e) => {
1652
+ const handleDragStart = (event) => {
1653
+ var _a;
1654
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1652
1655
  setDraggingColumn(column);
1653
- e.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1656
+ event.dataTransfer.setDragImage(tableHeadCellRef.current, 0, 0);
1654
1657
  };
1655
1658
  const handleDragEnd = (event) => {
1656
- onColumnDrop === null || onColumnDrop === void 0 ? void 0 : onColumnDrop({
1657
- event,
1658
- draggedColumn: column,
1659
- targetColumn: hoveredColumn,
1660
- });
1659
+ var _a;
1660
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1661
1661
  if ((hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
1662
1662
  column.toggleGrouping();
1663
1663
  }
@@ -1946,21 +1946,20 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
1946
1946
  };
1947
1947
 
1948
1948
  const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
1949
- const { options: { muiTableBodyRowDragHandleProps, onRowDrop }, } = table;
1949
+ const { options: { muiTableBodyRowDragHandleProps }, } = table;
1950
1950
  const { row } = cell;
1951
1951
  const iconButtonProps = muiTableBodyRowDragHandleProps instanceof Function
1952
1952
  ? muiTableBodyRowDragHandleProps({ row, table })
1953
1953
  : muiTableBodyRowDragHandleProps;
1954
- const handleDragStart = (e) => {
1955
- e.dataTransfer.setDragImage(rowRef.current, 0, 0);
1954
+ const handleDragStart = (event) => {
1955
+ var _a;
1956
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragStart) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1957
+ event.dataTransfer.setDragImage(rowRef.current, 0, 0);
1956
1958
  table.setDraggingRow(row);
1957
1959
  };
1958
1960
  const handleDragEnd = (event) => {
1959
- onRowDrop === null || onRowDrop === void 0 ? void 0 : onRowDrop({
1960
- event,
1961
- draggedRow: table.getState().draggingRow,
1962
- targetRow: table.getState().hoveredRow,
1963
- });
1961
+ var _a;
1962
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
1964
1963
  table.setDraggingRow(null);
1965
1964
  table.setHoveredRow(null);
1966
1965
  };
@@ -2165,7 +2164,8 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
2165
2164
  };
2166
2165
 
2167
2166
  const MRT_TableBody = ({ table }) => {
2168
- const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, localization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef }, } = table;
2167
+ var _a;
2168
+ const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, localization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
2169
2169
  const { columnFilters, globalFilter, pagination, sorting } = getState();
2170
2170
  const tableBodyProps = muiTableBodyProps instanceof Function
2171
2171
  ? muiTableBodyProps({ table })
@@ -2231,10 +2231,12 @@ const MRT_TableBody = ({ table }) => {
2231
2231
  // ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
2232
2232
  // : 0;
2233
2233
  // }
2234
- return (React__default["default"].createElement(material.TableBody, Object.assign({}, tableBodyProps), !rows.length ? (React__default["default"].createElement(material.TableRow, null,
2235
- React__default["default"].createElement(material.TableCell, { colSpan: table.getVisibleLeafColumns().length },
2236
- React__default["default"].createElement(material.Box, { sx: {
2237
- maxWidth: '100vw',
2234
+ return (React__default["default"].createElement(material.TableBody, Object.assign({}, tableBodyProps), !rows.length ? (React__default["default"].createElement("tr", null,
2235
+ React__default["default"].createElement("td", { colSpan: table.getVisibleLeafColumns().length },
2236
+ React__default["default"].createElement(material.Typography, { sx: {
2237
+ color: 'text.secondary',
2238
+ fontStyle: 'italic',
2239
+ maxWidth: `min(100vw, ${(_a = tablePaperRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth}px)`,
2238
2240
  py: '2rem',
2239
2241
  textAlign: 'center',
2240
2242
  width: '100%',
@@ -2304,11 +2306,11 @@ const MRT_TableFooter = ({ table }) => {
2304
2306
  ? muiTableFooterProps({ table })
2305
2307
  : muiTableFooterProps;
2306
2308
  const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
2307
- return (React__default["default"].createElement(material.TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ position: stickFooter ? 'sticky' : undefined, bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.95 : undefined, outline: stickFooter
2309
+ return (React__default["default"].createElement(material.TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: material.lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.95 : undefined, outline: stickFooter
2308
2310
  ? theme.palette.mode === 'light'
2309
2311
  ? `1px solid ${theme.palette.grey[300]}`
2310
2312
  : `1px solid ${theme.palette.grey[700]}`
2311
- : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
2313
+ : undefined, position: stickFooter ? 'sticky' : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
2312
2314
  ? tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx(theme)
2313
2315
  : tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (React__default["default"].createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
2314
2316
  };
@@ -2362,24 +2364,29 @@ const MRT_TableContainer = ({ table }) => {
2362
2364
  };
2363
2365
 
2364
2366
  const MRT_TablePaper = ({ table }) => {
2365
- const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps }, } = table;
2367
+ const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps }, refs: { tablePaperRef }, } = table;
2366
2368
  const { isFullScreen } = getState();
2367
- React.useEffect(() => {
2368
- if (typeof window !== 'undefined') {
2369
- if (isFullScreen) {
2370
- document.body.style.height = '100vh';
2371
- }
2372
- else {
2373
- document.body.style.height = 'auto';
2374
- }
2375
- }
2376
- }, [isFullScreen]);
2377
2369
  const tablePaperProps = muiTablePaperProps instanceof Function
2378
2370
  ? muiTablePaperProps({ table })
2379
2371
  : muiTablePaperProps;
2380
- return (React__default["default"].createElement(material.Paper, Object.assign({ elevation: 2 }, tablePaperProps, { sx: (theme) => (Object.assign({ transition: 'all 0.2s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2372
+ return (React__default["default"].createElement(material.Paper, Object.assign({ elevation: 2 }, tablePaperProps, { ref: (ref) => {
2373
+ tablePaperRef.current = ref;
2374
+ if (tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.ref) {
2375
+ //@ts-ignore
2376
+ tablePaperProps.ref.current = ref;
2377
+ }
2378
+ }, sx: (theme) => (Object.assign({ transition: 'all 0.2s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2381
2379
  ? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
2382
- : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), { height: isFullScreen ? '100vh' : undefined, margin: isFullScreen ? '0' : undefined, maxHeight: isFullScreen ? '100vh' : undefined, maxWidth: isFullScreen ? '100vw' : undefined, padding: isFullScreen ? '0' : undefined, width: isFullScreen ? '100vw' : undefined }) }),
2380
+ : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
2381
+ ? {
2382
+ height: '100vh',
2383
+ margin: 0,
2384
+ maxHeight: '100vh',
2385
+ maxWidth: '100vw',
2386
+ padding: 0,
2387
+ width: '100vw',
2388
+ }
2389
+ : {})) }),
2383
2390
  enableTopToolbar && React__default["default"].createElement(MRT_TopToolbar, { table: table }),
2384
2391
  React__default["default"].createElement(MRT_TableContainer, { table: table }),
2385
2392
  enableBottomToolbar && React__default["default"].createElement(MRT_BottomToolbar, { table: table })));
@@ -2410,6 +2417,7 @@ const MRT_TableRoot = (props) => {
2410
2417
  const filterInputRefs = React.useRef({});
2411
2418
  const searchInputRef = React.useRef(null);
2412
2419
  const tableContainerRef = React.useRef(null);
2420
+ const tablePaperRef = React.useRef(null);
2413
2421
  const topToolbarRef = React.useRef(null);
2414
2422
  const initialState = React.useMemo(() => {
2415
2423
  var _a, _b;
@@ -2530,11 +2538,28 @@ const MRT_TableRoot = (props) => {
2530
2538
  filterInputRefs,
2531
2539
  searchInputRef,
2532
2540
  tableContainerRef,
2541
+ tablePaperRef,
2533
2542
  topToolbarRef,
2534
2543
  }, setColumnFilterFns: (_x = props.onFilterFnsChange) !== null && _x !== void 0 ? _x : setColumnFilterFns, setDensity: (_y = props.onDensityChange) !== null && _y !== void 0 ? _y : setDensity, setDraggingColumn: (_z = props.onDraggingColumnChange) !== null && _z !== void 0 ? _z : setDraggingColumn, setDraggingRow: (_0 = props.onDraggingRowChange) !== null && _0 !== void 0 ? _0 : setDraggingRow, setEditingCell: (_1 = props.onEditingCellChange) !== null && _1 !== void 0 ? _1 : setEditingCell, setEditingRow: (_2 = props.onEditingRowChange) !== null && _2 !== void 0 ? _2 : setEditingRow, setGlobalFilterFn: (_3 = props.onGlobalFilterFnChange) !== null && _3 !== void 0 ? _3 : setGlobalFilterFn, setHoveredColumn: (_4 = props.onHoveredColumnChange) !== null && _4 !== void 0 ? _4 : setHoveredColumn, setHoveredRow: (_5 = props.onHoveredRowChange) !== null && _5 !== void 0 ? _5 : setHoveredRow, setIsFullScreen: (_6 = props.onIsFullScreenChange) !== null && _6 !== void 0 ? _6 : setIsFullScreen, setShowAlertBanner: (_7 = props.onShowAlertBannerChange) !== null && _7 !== void 0 ? _7 : setShowAlertBanner, setShowFilters: (_8 = props.onShowFiltersChange) !== null && _8 !== void 0 ? _8 : setShowFilters, setShowGlobalFilter: (_9 = props.onShowGlobalFilterChange) !== null && _9 !== void 0 ? _9 : setShowGlobalFilter });
2535
2544
  if (props.tableInstanceRef) {
2536
2545
  props.tableInstanceRef.current = table;
2537
2546
  }
2547
+ const initialBodyHeight = React.useRef();
2548
+ React.useEffect(() => {
2549
+ if (typeof window !== 'undefined') {
2550
+ initialBodyHeight.current = document.body.style.height;
2551
+ }
2552
+ }, []);
2553
+ React.useEffect(() => {
2554
+ if (typeof window !== 'undefined') {
2555
+ if (table.getState().isFullScreen) {
2556
+ document.body.style.height = '100vh';
2557
+ }
2558
+ else {
2559
+ document.body.style.height = initialBodyHeight.current;
2560
+ }
2561
+ }
2562
+ }, [table.getState().isFullScreen]);
2538
2563
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
2539
2564
  React__default["default"].createElement(material.Dialog, { PaperComponent: material.Box, TransitionComponent: material.Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
2540
2565
  React__default["default"].createElement(MRT_TablePaper, { table: table })),