material-react-table 1.0.0-beta.7 → 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.
@@ -2358,16 +2358,6 @@ const MRT_TableContainer = ({ table }) => {
2358
2358
  const MRT_TablePaper = ({ table }) => {
2359
2359
  const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps }, refs: { tablePaperRef }, } = table;
2360
2360
  const { isFullScreen } = getState();
2361
- useEffect(() => {
2362
- if (typeof window !== 'undefined') {
2363
- if (isFullScreen) {
2364
- document.body.style.height = '100vh';
2365
- }
2366
- else {
2367
- document.body.style.height = 'auto';
2368
- }
2369
- }
2370
- }, [isFullScreen]);
2371
2361
  const tablePaperProps = muiTablePaperProps instanceof Function
2372
2362
  ? muiTablePaperProps({ table })
2373
2363
  : muiTablePaperProps;
@@ -2379,7 +2369,16 @@ const MRT_TablePaper = ({ table }) => {
2379
2369
  }
2380
2370
  }, sx: (theme) => (Object.assign({ transition: 'all 0.2s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2381
2371
  ? 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 }) }),
2372
+ : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
2373
+ ? {
2374
+ height: '100vh',
2375
+ margin: 0,
2376
+ maxHeight: '100vh',
2377
+ maxWidth: '100vw',
2378
+ padding: 0,
2379
+ width: '100vw',
2380
+ }
2381
+ : {})) }),
2383
2382
  enableTopToolbar && React.createElement(MRT_TopToolbar, { table: table }),
2384
2383
  React.createElement(MRT_TableContainer, { table: table }),
2385
2384
  enableBottomToolbar && React.createElement(MRT_BottomToolbar, { table: table })));
@@ -2537,6 +2536,22 @@ const MRT_TableRoot = (props) => {
2537
2536
  if (props.tableInstanceRef) {
2538
2537
  props.tableInstanceRef.current = table;
2539
2538
  }
2539
+ const initialBodyHeight = useRef();
2540
+ useEffect(() => {
2541
+ if (typeof window !== 'undefined') {
2542
+ initialBodyHeight.current = document.body.style.height;
2543
+ }
2544
+ }, []);
2545
+ useEffect(() => {
2546
+ if (typeof window !== 'undefined') {
2547
+ if (table.getState().isFullScreen) {
2548
+ document.body.style.height = '100vh';
2549
+ }
2550
+ else {
2551
+ document.body.style.height = initialBodyHeight.current;
2552
+ }
2553
+ }
2554
+ }, [table.getState().isFullScreen]);
2540
2555
  return (React.createElement(React.Fragment, null,
2541
2556
  React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
2542
2557
  React.createElement(MRT_TablePaper, { table: table })),