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.
- package/README.md +20 -20
- package/dist/cjs/index.js +26 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/material-react-table.esm.js +26 -11
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/table/MRT_TablePaper.tsx +11 -17
- package/src/table/MRT_TableRoot.tsx +19 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
2
|
import { Paper } from '@mui/material';
|
|
3
3
|
import { MRT_TopToolbar } from '../toolbar/MRT_TopToolbar';
|
|
4
4
|
import { MRT_BottomToolbar } from '../toolbar/MRT_BottomToolbar';
|
|
@@ -17,16 +17,6 @@ export const MRT_TablePaper: FC<Props> = ({ table }) => {
|
|
|
17
17
|
} = table;
|
|
18
18
|
const { isFullScreen } = getState();
|
|
19
19
|
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (typeof window !== 'undefined') {
|
|
22
|
-
if (isFullScreen) {
|
|
23
|
-
document.body.style.height = '100vh';
|
|
24
|
-
} else {
|
|
25
|
-
document.body.style.height = 'auto';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}, [isFullScreen]);
|
|
29
|
-
|
|
30
20
|
const tablePaperProps =
|
|
31
21
|
muiTablePaperProps instanceof Function
|
|
32
22
|
? muiTablePaperProps({ table })
|
|
@@ -51,12 +41,16 @@ export const MRT_TablePaper: FC<Props> = ({ table }) => {
|
|
|
51
41
|
})}
|
|
52
42
|
style={{
|
|
53
43
|
...tablePaperProps?.style,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
...(isFullScreen
|
|
45
|
+
? {
|
|
46
|
+
height: '100vh',
|
|
47
|
+
margin: 0,
|
|
48
|
+
maxHeight: '100vh',
|
|
49
|
+
maxWidth: '100vw',
|
|
50
|
+
padding: 0,
|
|
51
|
+
width: '100vw',
|
|
52
|
+
}
|
|
53
|
+
: {}),
|
|
60
54
|
}}
|
|
61
55
|
>
|
|
62
56
|
{enableTopToolbar && <MRT_TopToolbar table={table} />}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo, useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
TableState,
|
|
4
4
|
getCoreRowModel,
|
|
@@ -315,6 +315,24 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
315
315
|
props.tableInstanceRef.current = table;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
const initialBodyHeight = useRef<string>();
|
|
319
|
+
|
|
320
|
+
useEffect(() => {
|
|
321
|
+
if (typeof window !== 'undefined') {
|
|
322
|
+
initialBodyHeight.current = document.body.style.height;
|
|
323
|
+
}
|
|
324
|
+
}, []);
|
|
325
|
+
|
|
326
|
+
useEffect(() => {
|
|
327
|
+
if (typeof window !== 'undefined') {
|
|
328
|
+
if (table.getState().isFullScreen) {
|
|
329
|
+
document.body.style.height = '100vh';
|
|
330
|
+
} else {
|
|
331
|
+
document.body.style.height = initialBodyHeight.current as string;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}, [table.getState().isFullScreen]);
|
|
335
|
+
|
|
318
336
|
return (
|
|
319
337
|
<>
|
|
320
338
|
<Dialog
|