material-react-table 1.0.0-beta.1 → 1.0.0-beta.10
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/MaterialReactTable.d.ts +96 -19
- package/dist/cjs/_locales/en.d.ts +2 -0
- package/dist/cjs/_locales/es.d.ts +2 -0
- package/dist/cjs/body/MRT_EditRowModal.d.ts +0 -1
- package/dist/cjs/body/MRT_TableBody.d.ts +1 -2
- package/dist/cjs/body/MRT_TableBodyCellValue.d.ts +2 -2
- package/dist/cjs/buttons/MRT_ColumnPinningButtons.d.ts +0 -1
- package/dist/cjs/buttons/MRT_EditActionButtons.d.ts +0 -1
- package/dist/cjs/buttons/MRT_FullScreenToggleButton.d.ts +0 -1
- package/dist/cjs/buttons/MRT_ShowHideColumnsButton.d.ts +0 -1
- package/dist/cjs/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -1
- package/dist/cjs/buttons/MRT_ToggleFiltersButton.d.ts +0 -1
- package/dist/cjs/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -1
- package/dist/cjs/column.utils.d.ts +12 -1
- package/dist/cjs/index.d.ts +4 -3
- package/dist/cjs/index.js +235 -192
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/inputs/MRT_EditCellTextField.d.ts +0 -1
- package/dist/cjs/inputs/MRT_GlobalFilterTextField.d.ts +0 -1
- package/dist/cjs/menus/MRT_FilterOptionMenu.d.ts +3 -4
- package/dist/cjs/menus/MRT_ShowHideColumnsMenu.d.ts +0 -1
- package/dist/cjs/table/MRT_Table.d.ts +1 -2
- package/dist/cjs/table/MRT_TableRoot.d.ts +250 -3
- package/dist/cjs/toolbar/MRT_TablePagination.d.ts +3 -4
- package/dist/cjs/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/cjs/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -4
- package/dist/cjs/toolbar/MRT_TopToolbar.d.ts +1 -0
- package/dist/en.cjs +90 -0
- package/dist/en.cjs.d.ts +2 -0
- package/dist/en.cjs.map +1 -0
- package/dist/en.esm.d.ts +2 -0
- package/dist/en.esm.js +86 -0
- package/dist/en.esm.js.map +1 -0
- package/dist/esm/MaterialReactTable.d.ts +96 -19
- package/dist/esm/_locales/en.d.ts +2 -0
- package/dist/esm/_locales/es.d.ts +2 -0
- package/dist/esm/body/MRT_EditRowModal.d.ts +0 -1
- package/dist/esm/body/MRT_TableBody.d.ts +1 -2
- package/dist/esm/body/MRT_TableBodyCellValue.d.ts +2 -2
- package/dist/esm/buttons/MRT_ColumnPinningButtons.d.ts +0 -1
- package/dist/esm/buttons/MRT_EditActionButtons.d.ts +0 -1
- package/dist/esm/buttons/MRT_FullScreenToggleButton.d.ts +0 -1
- package/dist/esm/buttons/MRT_ShowHideColumnsButton.d.ts +0 -1
- package/dist/esm/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -1
- package/dist/esm/buttons/MRT_ToggleFiltersButton.d.ts +0 -1
- package/dist/esm/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -1
- package/dist/esm/column.utils.d.ts +12 -1
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/inputs/MRT_EditCellTextField.d.ts +0 -1
- package/dist/esm/inputs/MRT_GlobalFilterTextField.d.ts +0 -1
- package/dist/esm/material-react-table.esm.js +236 -195
- 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 +0 -1
- package/dist/esm/table/MRT_Table.d.ts +1 -2
- package/dist/esm/table/MRT_TableRoot.d.ts +250 -3
- package/dist/esm/toolbar/MRT_TablePagination.d.ts +3 -4
- package/dist/esm/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/esm/toolbar/MRT_ToolbarInternalButtons.d.ts +3 -4
- package/dist/esm/toolbar/MRT_TopToolbar.d.ts +1 -0
- package/dist/index.d.ts +47 -41
- package/package.json +7 -6
- package/src/MaterialReactTable.tsx +100 -23
- package/src/_locales/de.ts +0 -0
- package/src/{localization.ts → _locales/en.ts} +4 -82
- package/src/_locales/es.ts +86 -0
- package/src/_locales/fr.ts +0 -0
- package/src/_locales/hi.ts +0 -0
- package/src/_locales/id.ts +0 -0
- package/src/_locales/ja.ts +0 -0
- package/src/_locales/nl.ts +0 -0
- package/src/_locales/pt.ts +0 -0
- package/src/_locales/ru.ts +0 -0
- package/src/_locales/uk.ts +0 -0
- package/src/_locales/vi.ts +0 -0
- package/src/_locales/zh.ts +0 -0
- package/src/body/MRT_TableBody.tsx +54 -30
- package/src/body/MRT_TableBodyCell.tsx +11 -58
- package/src/body/MRT_TableBodyCellValue.tsx +7 -2
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +5 -8
- package/src/buttons/MRT_GrabHandleButton.tsx +2 -2
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +7 -2
- package/src/column.utils.ts +72 -0
- package/src/footer/MRT_TableFooter.tsx +3 -2
- package/src/footer/MRT_TableFooterCell.tsx +5 -15
- package/src/head/MRT_TableHead.tsx +10 -2
- package/src/head/MRT_TableHeadCell.tsx +9 -50
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +7 -7
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +5 -12
- package/src/index.tsx +6 -3
- package/src/inputs/MRT_FilterTextField.tsx +7 -6
- package/src/inputs/MRT_GlobalFilterTextField.tsx +1 -0
- package/src/menus/MRT_FilterOptionMenu.tsx +19 -2
- package/src/table/MRT_Table.tsx +3 -4
- package/src/table/MRT_TableContainer.tsx +2 -11
- package/src/table/MRT_TablePaper.tsx +34 -20
- package/src/table/MRT_TableRoot.tsx +34 -11
- package/src/toolbar/MRT_BottomToolbar.tsx +9 -3
- package/src/toolbar/MRT_TablePagination.tsx +8 -5
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +7 -1
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +8 -4
- package/src/toolbar/MRT_TopToolbar.tsx +8 -1
- package/dist/cjs/localization.d.ts +0 -82
- package/dist/esm/localization.d.ts +0 -82
|
@@ -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';
|
|
@@ -12,20 +12,17 @@ interface Props {
|
|
|
12
12
|
export const MRT_TablePaper: FC<Props> = ({ table }) => {
|
|
13
13
|
const {
|
|
14
14
|
getState,
|
|
15
|
-
options: {
|
|
15
|
+
options: {
|
|
16
|
+
enableBottomToolbar,
|
|
17
|
+
enableTopToolbar,
|
|
18
|
+
muiTablePaperProps,
|
|
19
|
+
renderBottomToolbar,
|
|
20
|
+
renderTopToolbar,
|
|
21
|
+
},
|
|
22
|
+
refs: { tablePaperRef },
|
|
16
23
|
} = table;
|
|
17
24
|
const { isFullScreen } = getState();
|
|
18
25
|
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (typeof window !== 'undefined') {
|
|
21
|
-
if (isFullScreen) {
|
|
22
|
-
document.body.style.height = '100vh';
|
|
23
|
-
} else {
|
|
24
|
-
document.body.style.height = 'auto';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}, [isFullScreen]);
|
|
28
|
-
|
|
29
26
|
const tablePaperProps =
|
|
30
27
|
muiTablePaperProps instanceof Function
|
|
31
28
|
? muiTablePaperProps({ table })
|
|
@@ -35,6 +32,13 @@ export const MRT_TablePaper: FC<Props> = ({ table }) => {
|
|
|
35
32
|
<Paper
|
|
36
33
|
elevation={2}
|
|
37
34
|
{...tablePaperProps}
|
|
35
|
+
ref={(ref: HTMLDivElement) => {
|
|
36
|
+
tablePaperRef.current = ref;
|
|
37
|
+
if (tablePaperProps?.ref) {
|
|
38
|
+
//@ts-ignore
|
|
39
|
+
tablePaperProps.ref.current = ref;
|
|
40
|
+
}
|
|
41
|
+
}}
|
|
38
42
|
sx={(theme) => ({
|
|
39
43
|
transition: 'all 0.2s ease-in-out',
|
|
40
44
|
...(tablePaperProps?.sx instanceof Function
|
|
@@ -43,17 +47,27 @@ export const MRT_TablePaper: FC<Props> = ({ table }) => {
|
|
|
43
47
|
})}
|
|
44
48
|
style={{
|
|
45
49
|
...tablePaperProps?.style,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
...(isFullScreen
|
|
51
|
+
? {
|
|
52
|
+
height: '100vh',
|
|
53
|
+
margin: 0,
|
|
54
|
+
maxHeight: '100vh',
|
|
55
|
+
maxWidth: '100vw',
|
|
56
|
+
padding: 0,
|
|
57
|
+
width: '100vw',
|
|
58
|
+
}
|
|
59
|
+
: {}),
|
|
52
60
|
}}
|
|
53
61
|
>
|
|
54
|
-
{enableTopToolbar &&
|
|
62
|
+
{enableTopToolbar &&
|
|
63
|
+
(renderTopToolbar instanceof Function
|
|
64
|
+
? renderTopToolbar({ table })
|
|
65
|
+
: renderTopToolbar ?? <MRT_TopToolbar table={table} />)}
|
|
55
66
|
<MRT_TableContainer table={table} />
|
|
56
|
-
{enableBottomToolbar &&
|
|
67
|
+
{enableBottomToolbar &&
|
|
68
|
+
(renderBottomToolbar instanceof Function
|
|
69
|
+
? renderBottomToolbar({ table })
|
|
70
|
+
: renderBottomToolbar ?? <MRT_BottomToolbar table={table} />)}
|
|
57
71
|
</Paper>
|
|
58
72
|
);
|
|
59
73
|
};
|
|
@@ -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,
|
|
@@ -34,17 +34,19 @@ import type {
|
|
|
34
34
|
MRT_TableInstance,
|
|
35
35
|
MRT_TableState,
|
|
36
36
|
MaterialReactTableProps,
|
|
37
|
+
MRT_Localization,
|
|
37
38
|
} from '..';
|
|
38
39
|
import { MRT_EditRowModal } from '../body/MRT_EditRowModal';
|
|
39
40
|
|
|
40
41
|
export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
41
|
-
props: MaterialReactTableProps<TData
|
|
42
|
+
props: MaterialReactTableProps<TData> & { localization: MRT_Localization },
|
|
42
43
|
) => {
|
|
43
44
|
const bottomToolbarRef = useRef<HTMLDivElement>(null);
|
|
44
45
|
const editInputRefs = useRef<Record<string, HTMLInputElement>>({});
|
|
45
46
|
const filterInputRefs = useRef<Record<string, HTMLInputElement>>({});
|
|
46
47
|
const searchInputRef = useRef<HTMLInputElement>(null);
|
|
47
48
|
const tableContainerRef = useRef<HTMLDivElement>(null);
|
|
49
|
+
const tablePaperRef = useRef<HTMLDivElement>(null);
|
|
48
50
|
const topToolbarRef = useRef<HTMLDivElement>(null);
|
|
49
51
|
|
|
50
52
|
const initialState: Partial<MRT_TableState<TData>> = useMemo(() => {
|
|
@@ -122,7 +124,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
122
124
|
(
|
|
123
125
|
[
|
|
124
126
|
columnOrder.includes('mrt-row-drag') && {
|
|
125
|
-
header: props.localization
|
|
127
|
+
header: props.localization.move,
|
|
126
128
|
size: 60,
|
|
127
129
|
...props.defaultDisplayColumn,
|
|
128
130
|
...props.displayColumnDefOptions?.['mrt-row-drag'],
|
|
@@ -136,7 +138,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
136
138
|
table={table as any}
|
|
137
139
|
/>
|
|
138
140
|
),
|
|
139
|
-
header: props.localization
|
|
141
|
+
header: props.localization.actions,
|
|
140
142
|
size: 70,
|
|
141
143
|
...props.defaultDisplayColumn,
|
|
142
144
|
...props.displayColumnDefOptions?.['mrt-row-actions'],
|
|
@@ -151,7 +153,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
151
153
|
props.enableExpandAll ? (
|
|
152
154
|
<MRT_ExpandAllButton table={table as any} />
|
|
153
155
|
) : null,
|
|
154
|
-
header: props.localization
|
|
156
|
+
header: props.localization.expand,
|
|
155
157
|
size: 60,
|
|
156
158
|
...props.defaultDisplayColumn,
|
|
157
159
|
...props.displayColumnDefOptions?.['mrt-row-expand'],
|
|
@@ -165,7 +167,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
165
167
|
props.enableSelectAll ? (
|
|
166
168
|
<MRT_SelectCheckbox selectAll table={table as any} />
|
|
167
169
|
) : null,
|
|
168
|
-
header: props.localization
|
|
170
|
+
header: props.localization.select,
|
|
169
171
|
size: 60,
|
|
170
172
|
...props.defaultDisplayColumn,
|
|
171
173
|
...props.displayColumnDefOptions?.['mrt-row-select'],
|
|
@@ -173,8 +175,8 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
173
175
|
},
|
|
174
176
|
columnOrder.includes('mrt-row-numbers') && {
|
|
175
177
|
Cell: ({ row }) => row.index + 1,
|
|
176
|
-
Header: () => props.localization
|
|
177
|
-
header: props.localization
|
|
178
|
+
Header: () => props.localization.rowNumber,
|
|
179
|
+
header: props.localization.rowNumbers,
|
|
178
180
|
size: 60,
|
|
179
181
|
...props.defaultDisplayColumn,
|
|
180
182
|
...props.displayColumnDefOptions?.['mrt-row-numbers'],
|
|
@@ -292,6 +294,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
292
294
|
filterInputRefs,
|
|
293
295
|
searchInputRef,
|
|
294
296
|
tableContainerRef,
|
|
297
|
+
tablePaperRef,
|
|
295
298
|
topToolbarRef,
|
|
296
299
|
},
|
|
297
300
|
setColumnFilterFns: props.onFilterFnsChange ?? setColumnFilterFns,
|
|
@@ -313,6 +316,24 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
313
316
|
props.tableInstanceRef.current = table;
|
|
314
317
|
}
|
|
315
318
|
|
|
319
|
+
const initialBodyHeight = useRef<string>();
|
|
320
|
+
|
|
321
|
+
useEffect(() => {
|
|
322
|
+
if (typeof window !== 'undefined') {
|
|
323
|
+
initialBodyHeight.current = document.body.style.height;
|
|
324
|
+
}
|
|
325
|
+
}, []);
|
|
326
|
+
|
|
327
|
+
useEffect(() => {
|
|
328
|
+
if (typeof window !== 'undefined') {
|
|
329
|
+
if (table.getState().isFullScreen) {
|
|
330
|
+
document.body.style.height = '100vh';
|
|
331
|
+
} else {
|
|
332
|
+
document.body.style.height = initialBodyHeight.current as string;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}, [table.getState().isFullScreen]);
|
|
336
|
+
|
|
316
337
|
return (
|
|
317
338
|
<>
|
|
318
339
|
<Dialog
|
|
@@ -321,13 +342,15 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
321
342
|
disablePortal
|
|
322
343
|
fullScreen
|
|
323
344
|
keepMounted={false}
|
|
324
|
-
onClose={() => setIsFullScreen(false)}
|
|
325
|
-
open={isFullScreen}
|
|
345
|
+
onClose={() => table.setIsFullScreen(false)}
|
|
346
|
+
open={table.getState().isFullScreen}
|
|
326
347
|
transitionDuration={400}
|
|
327
348
|
>
|
|
328
349
|
<MRT_TablePaper table={table as any} />
|
|
329
350
|
</Dialog>
|
|
330
|
-
{!isFullScreen &&
|
|
351
|
+
{!table.getState().isFullScreen && (
|
|
352
|
+
<MRT_TablePaper table={table as any} />
|
|
353
|
+
)}
|
|
331
354
|
{editingRow && props.editingMode === 'modal' && (
|
|
332
355
|
<MRT_EditRowModal row={editingRow as any} table={table} open />
|
|
333
356
|
)}
|
|
@@ -50,7 +50,10 @@ export const MRT_BottomToolbar: FC<Props> = ({ table }) => {
|
|
|
50
50
|
({
|
|
51
51
|
...commonToolbarStyles({ theme }),
|
|
52
52
|
bottom: isFullScreen ? '0' : undefined,
|
|
53
|
-
boxShadow:
|
|
53
|
+
boxShadow: `0 1px 2px -1px ${alpha(
|
|
54
|
+
theme.palette.common.black,
|
|
55
|
+
0.1,
|
|
56
|
+
)} inset`,
|
|
54
57
|
left: 0,
|
|
55
58
|
position: isFullScreen ? 'fixed' : 'relative',
|
|
56
59
|
right: 0,
|
|
@@ -62,14 +65,17 @@ export const MRT_BottomToolbar: FC<Props> = ({ table }) => {
|
|
|
62
65
|
>
|
|
63
66
|
<MRT_LinearProgressBar isTopToolbar={false} table={table} />
|
|
64
67
|
{positionToolbarAlertBanner === 'bottom' && (
|
|
65
|
-
<MRT_ToolbarAlertBanner
|
|
68
|
+
<MRT_ToolbarAlertBanner
|
|
69
|
+
stackAlertBanner={stackAlertBanner}
|
|
70
|
+
table={table}
|
|
71
|
+
/>
|
|
66
72
|
)}
|
|
67
73
|
{['both', 'bottom'].includes(positionToolbarDropZone ?? '') && (
|
|
68
74
|
<MRT_ToolbarDropZone table={table} />
|
|
69
75
|
)}
|
|
70
76
|
<Box
|
|
71
77
|
sx={{
|
|
72
|
-
alignItems: '
|
|
78
|
+
alignItems: 'center',
|
|
73
79
|
boxSizing: 'border-box',
|
|
74
80
|
display: 'flex',
|
|
75
81
|
justifyContent: 'space-between',
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import React, { ChangeEvent
|
|
1
|
+
import React, { ChangeEvent } from 'react';
|
|
2
2
|
import { TablePagination } from '@mui/material';
|
|
3
3
|
import { MRT_TableInstance } from '..';
|
|
4
4
|
|
|
5
|
-
interface Props {
|
|
6
|
-
table: MRT_TableInstance
|
|
5
|
+
interface Props<TData extends Record<string, any> = {}> {
|
|
6
|
+
table: MRT_TableInstance<TData>;
|
|
7
7
|
position: 'top' | 'bottom';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const MRT_TablePagination
|
|
10
|
+
export const MRT_TablePagination = <TData extends Record<string, any> = {}>({
|
|
11
|
+
table,
|
|
12
|
+
position,
|
|
13
|
+
}: Props<TData>) => {
|
|
11
14
|
const {
|
|
12
15
|
getPrePaginationRowModel,
|
|
13
16
|
getState,
|
|
@@ -58,7 +61,7 @@ export const MRT_TablePagination: FC<Props> = ({ table, position }) => {
|
|
|
58
61
|
enableToolbarInternalActions &&
|
|
59
62
|
!showGlobalFilter
|
|
60
63
|
? '3.5rem'
|
|
61
|
-
:
|
|
64
|
+
: undefined,
|
|
62
65
|
position: 'relative',
|
|
63
66
|
zIndex: 2,
|
|
64
67
|
...(tablePaginationProps?.sx instanceof Function
|
|
@@ -3,7 +3,7 @@ import { Alert, AlertTitle, Box, Chip, Collapse } from '@mui/material';
|
|
|
3
3
|
import { MRT_TableInstance } from '..';
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
|
-
stackAlertBanner
|
|
6
|
+
stackAlertBanner: boolean;
|
|
7
7
|
table: MRT_TableInstance;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -19,6 +19,7 @@ export const MRT_ToolbarAlertBanner: FC<Props> = ({
|
|
|
19
19
|
localization,
|
|
20
20
|
muiToolbarAlertBannerProps,
|
|
21
21
|
muiToolbarAlertBannerChipProps,
|
|
22
|
+
positionToolbarAlertBanner,
|
|
22
23
|
},
|
|
23
24
|
} = table;
|
|
24
25
|
const { grouping, showAlertBanner } = getState();
|
|
@@ -78,6 +79,11 @@ export const MRT_ToolbarAlertBanner: FC<Props> = ({
|
|
|
78
79
|
left: 0,
|
|
79
80
|
p: 0,
|
|
80
81
|
position: 'relative',
|
|
82
|
+
mb: stackAlertBanner
|
|
83
|
+
? 0
|
|
84
|
+
: positionToolbarAlertBanner === 'bottom'
|
|
85
|
+
? '-1rem'
|
|
86
|
+
: undefined,
|
|
81
87
|
right: 0,
|
|
82
88
|
top: 0,
|
|
83
89
|
width: '100%',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Box } from '@mui/material';
|
|
3
3
|
import { MRT_FullScreenToggleButton } from '../buttons/MRT_FullScreenToggleButton';
|
|
4
4
|
import { MRT_ShowHideColumnsButton } from '../buttons/MRT_ShowHideColumnsButton';
|
|
@@ -7,11 +7,15 @@ import { MRT_ToggleFiltersButton } from '../buttons/MRT_ToggleFiltersButton';
|
|
|
7
7
|
import { MRT_ToggleGlobalFilterButton } from '../buttons/MRT_ToggleGlobalFilterButton';
|
|
8
8
|
import type { MRT_TableInstance } from '..';
|
|
9
9
|
|
|
10
|
-
interface Props {
|
|
11
|
-
table: MRT_TableInstance
|
|
10
|
+
interface Props<TData extends Record<string, any> = {}> {
|
|
11
|
+
table: MRT_TableInstance<TData>;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const MRT_ToolbarInternalButtons
|
|
14
|
+
export const MRT_ToolbarInternalButtons = <
|
|
15
|
+
TData extends Record<string, any> = {},
|
|
16
|
+
>({
|
|
17
|
+
table,
|
|
18
|
+
}: Props<TData>) => {
|
|
15
19
|
const {
|
|
16
20
|
options: {
|
|
17
21
|
enableColumnFilters,
|
|
@@ -13,6 +13,7 @@ export const commonToolbarStyles = ({ theme }: { theme: Theme }) => ({
|
|
|
13
13
|
backgroundColor: lighten(theme.palette.background.default, 0.04),
|
|
14
14
|
backgroundImage: 'none',
|
|
15
15
|
display: 'grid',
|
|
16
|
+
flexWrap: 'wrap-reverse',
|
|
16
17
|
minHeight: '3.5rem',
|
|
17
18
|
overflow: 'hidden',
|
|
18
19
|
p: '0 !important',
|
|
@@ -102,7 +103,13 @@ export const MRT_TopToolbar: FC<Props> = ({ table }) => {
|
|
|
102
103
|
)}
|
|
103
104
|
{renderTopToolbarCustomActions?.({ table }) ?? <span />}
|
|
104
105
|
{enableToolbarInternalActions ? (
|
|
105
|
-
<Box
|
|
106
|
+
<Box
|
|
107
|
+
sx={{
|
|
108
|
+
display: 'flex',
|
|
109
|
+
flexWrap: 'wrap-reverse',
|
|
110
|
+
justifyContent: 'flex-end',
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
106
113
|
{enableGlobalFilter && positionGlobalFilter === 'right' && (
|
|
107
114
|
<MRT_GlobalFilterTextField table={table} />
|
|
108
115
|
)}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export interface MRT_Localization {
|
|
2
|
-
actions: string;
|
|
3
|
-
and: string;
|
|
4
|
-
cancel: string;
|
|
5
|
-
changeFilterMode: string;
|
|
6
|
-
changeSearchMode: string;
|
|
7
|
-
clearFilter: string;
|
|
8
|
-
clearSearch: string;
|
|
9
|
-
clearSort: string;
|
|
10
|
-
clickToCopy: string;
|
|
11
|
-
columnActions: string;
|
|
12
|
-
copiedToClipboard: string;
|
|
13
|
-
dropToGroupBy: string;
|
|
14
|
-
edit: string;
|
|
15
|
-
expand: string;
|
|
16
|
-
expandAll: string;
|
|
17
|
-
filterArrIncludes: string;
|
|
18
|
-
filterArrIncludesAll: string;
|
|
19
|
-
filterArrIncludesSome: string;
|
|
20
|
-
filterBetween: string;
|
|
21
|
-
filterBetweenInclusive: string;
|
|
22
|
-
filterByColumn: string;
|
|
23
|
-
filterContains: string;
|
|
24
|
-
filterEmpty: string;
|
|
25
|
-
filterEndsWith: string;
|
|
26
|
-
filterEquals: string;
|
|
27
|
-
filterEqualsString: string;
|
|
28
|
-
filterFuzzy: string;
|
|
29
|
-
filterGreaterThan: string;
|
|
30
|
-
filterGreaterThanOrEqualTo: string;
|
|
31
|
-
filterInNumberRange: string;
|
|
32
|
-
filterIncludesString: string;
|
|
33
|
-
filterIncludesStringSensitive: string;
|
|
34
|
-
filterLessThan: string;
|
|
35
|
-
filterLessThanOrEqualTo: string;
|
|
36
|
-
filterMode: string;
|
|
37
|
-
filterNotEmpty: string;
|
|
38
|
-
filterNotEquals: string;
|
|
39
|
-
filterStartsWith: string;
|
|
40
|
-
filterWeakEquals: string;
|
|
41
|
-
filteringByColumn: string;
|
|
42
|
-
grab: string;
|
|
43
|
-
groupByColumn: string;
|
|
44
|
-
groupedBy: string;
|
|
45
|
-
hideAll: string;
|
|
46
|
-
hideColumn: string;
|
|
47
|
-
max: string;
|
|
48
|
-
min: string;
|
|
49
|
-
move: string;
|
|
50
|
-
or: string;
|
|
51
|
-
pinToLeft: string;
|
|
52
|
-
pinToRight: string;
|
|
53
|
-
resetColumnSize: string;
|
|
54
|
-
resetOrder: string;
|
|
55
|
-
rowActions: string;
|
|
56
|
-
rowNumber: string;
|
|
57
|
-
rowNumbers: string;
|
|
58
|
-
save: string;
|
|
59
|
-
search: string;
|
|
60
|
-
select: string;
|
|
61
|
-
selectedCountOfRowCountRowsSelected: string;
|
|
62
|
-
showAll: string;
|
|
63
|
-
showAllColumns: string;
|
|
64
|
-
showHideColumns: string;
|
|
65
|
-
showHideFilters: string;
|
|
66
|
-
showHideSearch: string;
|
|
67
|
-
sortByColumnAsc: string;
|
|
68
|
-
sortByColumnDesc: string;
|
|
69
|
-
sortedByColumnAsc: string;
|
|
70
|
-
sortedByColumnDesc: string;
|
|
71
|
-
thenBy: string;
|
|
72
|
-
toggleDensity: string;
|
|
73
|
-
toggleFullScreen: string;
|
|
74
|
-
toggleSelectAll: string;
|
|
75
|
-
toggleSelectRow: string;
|
|
76
|
-
toggleVisibility: string;
|
|
77
|
-
ungroupByColumn: string;
|
|
78
|
-
unpin: string;
|
|
79
|
-
unpinAll: string;
|
|
80
|
-
unsorted: string;
|
|
81
|
-
}
|
|
82
|
-
export declare const MRT_DefaultLocalization_EN: MRT_Localization;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export interface MRT_Localization {
|
|
2
|
-
actions: string;
|
|
3
|
-
and: string;
|
|
4
|
-
cancel: string;
|
|
5
|
-
changeFilterMode: string;
|
|
6
|
-
changeSearchMode: string;
|
|
7
|
-
clearFilter: string;
|
|
8
|
-
clearSearch: string;
|
|
9
|
-
clearSort: string;
|
|
10
|
-
clickToCopy: string;
|
|
11
|
-
columnActions: string;
|
|
12
|
-
copiedToClipboard: string;
|
|
13
|
-
dropToGroupBy: string;
|
|
14
|
-
edit: string;
|
|
15
|
-
expand: string;
|
|
16
|
-
expandAll: string;
|
|
17
|
-
filterArrIncludes: string;
|
|
18
|
-
filterArrIncludesAll: string;
|
|
19
|
-
filterArrIncludesSome: string;
|
|
20
|
-
filterBetween: string;
|
|
21
|
-
filterBetweenInclusive: string;
|
|
22
|
-
filterByColumn: string;
|
|
23
|
-
filterContains: string;
|
|
24
|
-
filterEmpty: string;
|
|
25
|
-
filterEndsWith: string;
|
|
26
|
-
filterEquals: string;
|
|
27
|
-
filterEqualsString: string;
|
|
28
|
-
filterFuzzy: string;
|
|
29
|
-
filterGreaterThan: string;
|
|
30
|
-
filterGreaterThanOrEqualTo: string;
|
|
31
|
-
filterInNumberRange: string;
|
|
32
|
-
filterIncludesString: string;
|
|
33
|
-
filterIncludesStringSensitive: string;
|
|
34
|
-
filterLessThan: string;
|
|
35
|
-
filterLessThanOrEqualTo: string;
|
|
36
|
-
filterMode: string;
|
|
37
|
-
filterNotEmpty: string;
|
|
38
|
-
filterNotEquals: string;
|
|
39
|
-
filterStartsWith: string;
|
|
40
|
-
filterWeakEquals: string;
|
|
41
|
-
filteringByColumn: string;
|
|
42
|
-
grab: string;
|
|
43
|
-
groupByColumn: string;
|
|
44
|
-
groupedBy: string;
|
|
45
|
-
hideAll: string;
|
|
46
|
-
hideColumn: string;
|
|
47
|
-
max: string;
|
|
48
|
-
min: string;
|
|
49
|
-
move: string;
|
|
50
|
-
or: string;
|
|
51
|
-
pinToLeft: string;
|
|
52
|
-
pinToRight: string;
|
|
53
|
-
resetColumnSize: string;
|
|
54
|
-
resetOrder: string;
|
|
55
|
-
rowActions: string;
|
|
56
|
-
rowNumber: string;
|
|
57
|
-
rowNumbers: string;
|
|
58
|
-
save: string;
|
|
59
|
-
search: string;
|
|
60
|
-
select: string;
|
|
61
|
-
selectedCountOfRowCountRowsSelected: string;
|
|
62
|
-
showAll: string;
|
|
63
|
-
showAllColumns: string;
|
|
64
|
-
showHideColumns: string;
|
|
65
|
-
showHideFilters: string;
|
|
66
|
-
showHideSearch: string;
|
|
67
|
-
sortByColumnAsc: string;
|
|
68
|
-
sortByColumnDesc: string;
|
|
69
|
-
sortedByColumnAsc: string;
|
|
70
|
-
sortedByColumnDesc: string;
|
|
71
|
-
thenBy: string;
|
|
72
|
-
toggleDensity: string;
|
|
73
|
-
toggleFullScreen: string;
|
|
74
|
-
toggleSelectAll: string;
|
|
75
|
-
toggleSelectRow: string;
|
|
76
|
-
toggleVisibility: string;
|
|
77
|
-
ungroupByColumn: string;
|
|
78
|
-
unpin: string;
|
|
79
|
-
unpinAll: string;
|
|
80
|
-
unsorted: string;
|
|
81
|
-
}
|
|
82
|
-
export declare const MRT_DefaultLocalization_EN: MRT_Localization;
|