|
1 | 1 | import Paper, { type PaperProps } from '@mui/material/Paper'; |
2 | | -import FocusTrap from '@mui/material/Unstable_TrapFocus/FocusTrap'; |
3 | 2 | import { useTheme } from '@mui/material/styles'; |
4 | 3 | import { MRT_TableContainer } from './MRT_TableContainer'; |
5 | 4 | import { type MRT_RowData, type MRT_TableInstance } from '../../types'; |
@@ -38,55 +37,53 @@ export const MRT_TablePaper = <TData extends MRT_RowData>({ |
38 | 37 | const theme = useTheme(); |
39 | 38 |
|
40 | 39 | return ( |
41 | | - <FocusTrap disableEnforceFocus open={isFullScreen}> |
42 | | - <Paper |
43 | | - elevation={2} |
44 | | - onKeyDown={(e) => e.key === 'Escape' && table.setIsFullScreen(false)} |
45 | | - {...paperProps} |
46 | | - ref={(ref: HTMLDivElement) => { |
47 | | - tablePaperRef.current = ref; |
48 | | - if (paperProps?.ref) { |
49 | | - //@ts-ignore |
50 | | - paperProps.ref.current = ref; |
51 | | - } |
52 | | - }} |
53 | | - style={{ |
54 | | - ...(isFullScreen |
55 | | - ? { |
56 | | - bottom: 0, |
57 | | - height: '100dvh', |
58 | | - left: 0, |
59 | | - margin: 0, |
60 | | - maxHeight: '100dvh', |
61 | | - maxWidth: '100dvw', |
62 | | - padding: 0, |
63 | | - position: 'fixed', |
64 | | - right: 0, |
65 | | - top: 0, |
66 | | - width: '100dvw', |
67 | | - zIndex: theme.zIndex.modal, |
68 | | - } |
69 | | - : {}), |
70 | | - ...paperProps?.style, |
71 | | - }} |
72 | | - sx={(theme) => ({ |
73 | | - backgroundColor: baseBackgroundColor, |
74 | | - backgroundImage: 'unset', |
75 | | - overflow: 'hidden', |
76 | | - transition: 'all 100ms ease-in-out', |
77 | | - ...(parseFromValuesOrFunc(paperProps?.sx, theme) as any), |
78 | | - })} |
79 | | - > |
80 | | - {enableTopToolbar && |
81 | | - (parseFromValuesOrFunc(renderTopToolbar, { table }) ?? ( |
82 | | - <MRT_TopToolbar table={table} /> |
83 | | - ))} |
84 | | - <MRT_TableContainer table={table} /> |
85 | | - {enableBottomToolbar && |
86 | | - (parseFromValuesOrFunc(renderBottomToolbar, { table }) ?? ( |
87 | | - <MRT_BottomToolbar table={table} /> |
88 | | - ))} |
89 | | - </Paper> |
90 | | - </FocusTrap> |
| 40 | + <Paper |
| 41 | + elevation={2} |
| 42 | + onKeyDown={(e) => e.key === 'Escape' && table.setIsFullScreen(false)} |
| 43 | + {...paperProps} |
| 44 | + ref={(ref: HTMLDivElement) => { |
| 45 | + tablePaperRef.current = ref; |
| 46 | + if (paperProps?.ref) { |
| 47 | + //@ts-ignore |
| 48 | + paperProps.ref.current = ref; |
| 49 | + } |
| 50 | + }} |
| 51 | + style={{ |
| 52 | + ...(isFullScreen |
| 53 | + ? { |
| 54 | + bottom: 0, |
| 55 | + height: '100dvh', |
| 56 | + left: 0, |
| 57 | + margin: 0, |
| 58 | + maxHeight: '100dvh', |
| 59 | + maxWidth: '100dvw', |
| 60 | + padding: 0, |
| 61 | + position: 'fixed', |
| 62 | + right: 0, |
| 63 | + top: 0, |
| 64 | + width: '100dvw', |
| 65 | + zIndex: theme.zIndex.modal, |
| 66 | + } |
| 67 | + : {}), |
| 68 | + ...paperProps?.style, |
| 69 | + }} |
| 70 | + sx={(theme) => ({ |
| 71 | + backgroundColor: baseBackgroundColor, |
| 72 | + backgroundImage: 'unset', |
| 73 | + overflow: 'hidden', |
| 74 | + transition: 'all 100ms ease-in-out', |
| 75 | + ...(parseFromValuesOrFunc(paperProps?.sx, theme) as any), |
| 76 | + })} |
| 77 | + > |
| 78 | + {enableTopToolbar && |
| 79 | + (parseFromValuesOrFunc(renderTopToolbar, { table }) ?? ( |
| 80 | + <MRT_TopToolbar table={table} /> |
| 81 | + ))} |
| 82 | + <MRT_TableContainer table={table} /> |
| 83 | + {enableBottomToolbar && |
| 84 | + (parseFromValuesOrFunc(renderBottomToolbar, { table }) ?? ( |
| 85 | + <MRT_BottomToolbar table={table} /> |
| 86 | + ))} |
| 87 | + </Paper> |
91 | 88 | ); |
92 | 89 | }; |
0 commit comments