material-react-table 2.6.1 → 2.8.0
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/dist/index.d.ts +390 -260
- package/dist/index.esm.js +1977 -1921
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2372 -2318
- package/dist/index.js.map +1 -1
- package/package.json +20 -20
- package/src/{MaterialReactTable.tsx → components/MaterialReactTable.tsx} +3 -3
- package/src/{body → components/body}/MRT_TableBody.tsx +6 -28
- package/src/{body → components/body}/MRT_TableBodyCell.tsx +6 -23
- package/src/{body → components/body}/MRT_TableBodyCellValue.tsx +2 -2
- package/src/{body → components/body}/MRT_TableBodyRow.tsx +7 -5
- package/src/{body → components/body}/MRT_TableBodyRowGrabHandle.tsx +3 -3
- package/src/{body → components/body}/MRT_TableBodyRowPinButton.tsx +3 -3
- package/src/{body → components/body}/MRT_TableDetailPanel.tsx +6 -6
- package/src/{buttons → components/buttons}/MRT_ColumnPinningButtons.tsx +2 -2
- package/src/{buttons → components/buttons}/MRT_CopyButton.tsx +4 -5
- package/src/{buttons → components/buttons}/MRT_EditActionButtons.tsx +2 -2
- package/src/{buttons → components/buttons}/MRT_ExpandAllButton.tsx +4 -4
- package/src/{buttons → components/buttons}/MRT_ExpandButton.tsx +10 -4
- package/src/{buttons → components/buttons}/MRT_GrabHandleButton.tsx +4 -5
- package/src/{buttons → components/buttons}/MRT_RowPinButton.tsx +4 -4
- package/src/{buttons → components/buttons}/MRT_ShowHideColumnsButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleDensePaddingButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleFiltersButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleFullScreenButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleGlobalFilterButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleRowActionMenuButton.tsx +9 -9
- package/src/{footer → components/footer}/MRT_TableFooter.tsx +2 -2
- package/src/{footer → components/footer}/MRT_TableFooterCell.tsx +3 -3
- package/src/{footer → components/footer}/MRT_TableFooterRow.tsx +3 -3
- package/src/{head → components/head}/MRT_TableHead.tsx +3 -3
- package/src/{head → components/head}/MRT_TableHeadCell.tsx +3 -3
- package/src/{head → components/head}/MRT_TableHeadCellColumnActionsButton.tsx +5 -6
- package/src/{head → components/head}/MRT_TableHeadCellFilterContainer.tsx +5 -5
- package/src/{head → components/head}/MRT_TableHeadCellFilterLabel.tsx +2 -2
- package/src/{head → components/head}/MRT_TableHeadCellGrabHandle.tsx +4 -3
- package/src/{head → components/head}/MRT_TableHeadCellResizeHandle.tsx +2 -2
- package/src/{head → components/head}/MRT_TableHeadCellSortLabel.tsx +2 -2
- package/src/{head → components/head}/MRT_TableHeadRow.tsx +3 -3
- package/src/{inputs → components/inputs}/MRT_EditCellTextField.tsx +12 -4
- package/src/{inputs → components/inputs}/MRT_FilterCheckbox.tsx +4 -4
- package/src/{inputs → components/inputs}/MRT_FilterRangeFields.tsx +2 -2
- package/src/{inputs → components/inputs}/MRT_FilterRangeSlider.tsx +2 -2
- package/src/{inputs → components/inputs}/MRT_FilterTextField.tsx +3 -3
- package/src/{inputs → components/inputs}/MRT_GlobalFilterTextField.tsx +2 -2
- package/src/{inputs → components/inputs}/MRT_SelectCheckbox.tsx +4 -4
- package/src/{menus → components/menus}/MRT_ColumnActionMenu.tsx +9 -1
- package/src/{menus → components/menus}/MRT_FilterOptionMenu.tsx +9 -1
- package/src/{menus → components/menus}/MRT_RowActionMenu.tsx +13 -2
- package/src/{menus → components/menus}/MRT_ShowHideColumnsMenu.tsx +11 -5
- package/src/{menus → components/menus}/MRT_ShowHideColumnsMenuItems.tsx +7 -7
- package/src/{modals → components/modals}/MRT_EditRowModal.tsx +4 -4
- package/src/{table → components/table}/MRT_Table.tsx +4 -4
- package/src/{table → components/table}/MRT_TableContainer.tsx +3 -3
- package/src/{table → components/table}/MRT_TableLoadingOverlay.tsx +3 -3
- package/src/{table → components/table}/MRT_TablePaper.tsx +3 -3
- package/src/{toolbar → components/toolbar}/MRT_BottomToolbar.tsx +3 -3
- package/src/{toolbar → components/toolbar}/MRT_LinearProgressBar.tsx +2 -2
- package/src/{toolbar → components/toolbar}/MRT_TablePagination.tsx +9 -7
- package/src/{toolbar → components/toolbar}/MRT_ToolbarAlertBanner.tsx +3 -3
- package/src/{toolbar → components/toolbar}/MRT_ToolbarDropZone.tsx +2 -2
- package/src/{toolbar → components/toolbar}/MRT_ToolbarInternalButtons.tsx +2 -2
- package/src/{toolbar → components/toolbar}/MRT_TopToolbar.tsx +3 -3
- package/src/{filterFns.ts → fns/filterFns.ts} +1 -1
- package/src/{sortingFns.ts → fns/sortingFns.ts} +1 -1
- package/src/hooks/display-columns/getMRT_DisplayColumns.tsx +26 -0
- package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +34 -0
- package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +35 -0
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +96 -0
- package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +36 -0
- package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +30 -0
- package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +40 -0
- package/src/hooks/display-columns/getMRT_RowSpacerColumnDef.tsx +40 -0
- package/src/hooks/useMRT_ColumnVirtualizer.ts +2 -4
- package/src/hooks/useMRT_Effects.ts +7 -6
- package/src/hooks/useMRT_RowVirtualizer.ts +2 -4
- package/src/hooks/useMRT_Rows.ts +32 -6
- package/src/hooks/useMRT_TableInstance.ts +91 -87
- package/src/hooks/useMRT_TableOptions.ts +5 -3
- package/src/{useMaterialReactTable.ts → hooks/useMaterialReactTable.ts} +3 -3
- package/src/icons.ts +4 -38
- package/src/index.ts +88 -17
- package/src/types.ts +59 -26
- package/src/utils/column.utils.ts +173 -0
- package/src/utils/displayColumn.utils.ts +134 -0
- package/src/utils/row.utils.ts +26 -0
- package/src/{style.utils.ts → utils/style.utils.ts} +50 -28
- package/src/utils/tanstack.helpers.ts +64 -0
- package/src/utils/utils.ts +23 -0
- package/src/utils/virtualization.utils.ts +19 -0
- package/src/utils.ts +0 -0
- package/src/body/index.ts +0 -7
- package/src/buttons/index.ts +0 -13
- package/src/column.utils.ts +0 -368
- package/src/footer/index.ts +0 -3
- package/src/head/index.ts +0 -9
- package/src/hooks/index.ts +0 -7
- package/src/hooks/useMRT_DisplayColumns.tsx +0 -299
- package/src/inputs/index.ts +0 -7
- package/src/menus/index.ts +0 -5
- package/src/modals/index.ts +0 -1
- package/src/table/index.ts +0 -5
- package/src/toolbar/index.ts +0 -7
- /package/src/{aggregationFns.ts → fns/aggregationFns.ts} +0 -0
@@ -1,11 +1,11 @@
|
|
1
1
|
import TableFooter, { type TableFooterProps } from '@mui/material/TableFooter';
|
2
2
|
import { MRT_TableFooterRow } from './MRT_TableFooterRow';
|
3
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
4
3
|
import {
|
5
4
|
type MRT_ColumnVirtualizer,
|
6
5
|
type MRT_RowData,
|
7
6
|
type MRT_TableInstance,
|
8
|
-
} from '
|
7
|
+
} from '../../types';
|
8
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
9
9
|
|
10
10
|
interface Props<TData extends MRT_RowData> extends TableFooterProps {
|
11
11
|
columnVirtualizer?: MRT_ColumnVirtualizer;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import TableCell, { type TableCellProps } from '@mui/material/TableCell';
|
2
2
|
import { useTheme } from '@mui/material/styles';
|
3
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
4
|
-
import { getCommonMRTCellStyles } from '../style.utils';
|
5
3
|
import {
|
6
4
|
type MRT_Header,
|
7
5
|
type MRT_RowData,
|
8
6
|
type MRT_TableInstance,
|
9
|
-
} from '
|
7
|
+
} from '../../types';
|
8
|
+
import { getCommonMRTCellStyles } from '../../utils/style.utils';
|
9
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
10
10
|
|
11
11
|
interface Props<TData extends MRT_RowData> extends TableCellProps {
|
12
12
|
footer: MRT_Header<TData>;
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import TableRow, { type TableRowProps } from '@mui/material/TableRow';
|
2
2
|
import { MRT_TableFooterCell } from './MRT_TableFooterCell';
|
3
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
4
|
-
import { getMRTTheme } from '../style.utils';
|
5
3
|
import {
|
6
4
|
type MRT_ColumnVirtualizer,
|
7
5
|
type MRT_Header,
|
8
6
|
type MRT_HeaderGroup,
|
9
7
|
type MRT_RowData,
|
10
8
|
type MRT_TableInstance,
|
11
|
-
} from '
|
9
|
+
} from '../../types';
|
10
|
+
import { getMRTTheme } from '../../utils/style.utils';
|
11
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
12
12
|
|
13
13
|
interface Props<TData extends MRT_RowData> extends TableRowProps {
|
14
14
|
columnVirtualizer?: MRT_ColumnVirtualizer;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import TableHead, { type TableHeadProps } from '@mui/material/TableHead';
|
2
2
|
import { MRT_TableHeadRow } from './MRT_TableHeadRow';
|
3
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
4
|
-
import { MRT_ToolbarAlertBanner } from '../toolbar';
|
5
3
|
import {
|
6
4
|
type MRT_ColumnVirtualizer,
|
7
5
|
type MRT_RowData,
|
8
6
|
type MRT_TableInstance,
|
9
|
-
} from '
|
7
|
+
} from '../../types';
|
8
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
9
|
+
import { MRT_ToolbarAlertBanner } from '../toolbar/MRT_ToolbarAlertBanner';
|
10
10
|
|
11
11
|
interface Props<TData extends MRT_RowData> extends TableHeadProps {
|
12
12
|
columnVirtualizer?: MRT_ColumnVirtualizer;
|
@@ -9,13 +9,13 @@ import { MRT_TableHeadCellFilterLabel } from './MRT_TableHeadCellFilterLabel';
|
|
9
9
|
import { MRT_TableHeadCellGrabHandle } from './MRT_TableHeadCellGrabHandle';
|
10
10
|
import { MRT_TableHeadCellResizeHandle } from './MRT_TableHeadCellResizeHandle';
|
11
11
|
import { MRT_TableHeadCellSortLabel } from './MRT_TableHeadCellSortLabel';
|
12
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
13
|
-
import { getCommonMRTCellStyles, getMRTTheme } from '../style.utils';
|
14
12
|
import {
|
15
13
|
type MRT_Header,
|
16
14
|
type MRT_RowData,
|
17
15
|
type MRT_TableInstance,
|
18
|
-
} from '
|
16
|
+
} from '../../types';
|
17
|
+
import { getCommonMRTCellStyles, getMRTTheme } from '../../utils/style.utils';
|
18
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
19
19
|
|
20
20
|
interface Props<TData extends MRT_RowData> extends TableCellProps {
|
21
21
|
header: MRT_Header<TData>;
|
@@ -1,13 +1,14 @@
|
|
1
1
|
import { type MouseEvent, useState } from 'react';
|
2
2
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
5
|
-
import { MRT_ColumnActionMenu } from '../menus/MRT_ColumnActionMenu';
|
6
4
|
import {
|
7
5
|
type MRT_Header,
|
8
6
|
type MRT_RowData,
|
9
7
|
type MRT_TableInstance,
|
10
|
-
} from '
|
8
|
+
} from '../../types';
|
9
|
+
import { getCommonTooltipProps } from '../../utils/style.utils';
|
10
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
11
|
+
import { MRT_ColumnActionMenu } from '../menus/MRT_ColumnActionMenu';
|
11
12
|
|
12
13
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
13
14
|
header: MRT_Header<TData>;
|
@@ -54,9 +55,7 @@ export const MRT_TableHeadCellColumnActionsButton = <
|
|
54
55
|
return (
|
55
56
|
<>
|
56
57
|
<Tooltip
|
57
|
-
|
58
|
-
enterNextDelay={1000}
|
59
|
-
placement="top"
|
58
|
+
{...getCommonTooltipProps('top')}
|
60
59
|
title={iconButtonProps?.title ?? localization.columnActions}
|
61
60
|
>
|
62
61
|
<IconButton
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import Collapse, { type CollapseProps } from '@mui/material/Collapse';
|
2
|
-
import { MRT_FilterCheckbox } from '../inputs/MRT_FilterCheckbox';
|
3
|
-
import { MRT_FilterRangeFields } from '../inputs/MRT_FilterRangeFields';
|
4
|
-
import { MRT_FilterRangeSlider } from '../inputs/MRT_FilterRangeSlider';
|
5
|
-
import { MRT_FilterTextField } from '../inputs/MRT_FilterTextField';
|
6
2
|
import {
|
7
3
|
type MRT_Header,
|
8
4
|
type MRT_RowData,
|
9
5
|
type MRT_TableInstance,
|
10
|
-
} from '
|
6
|
+
} from '../../types';
|
7
|
+
import { MRT_FilterCheckbox } from '../inputs/MRT_FilterCheckbox';
|
8
|
+
import { MRT_FilterRangeFields } from '../inputs/MRT_FilterRangeFields';
|
9
|
+
import { MRT_FilterRangeSlider } from '../inputs/MRT_FilterRangeSlider';
|
10
|
+
import { MRT_FilterTextField } from '../inputs/MRT_FilterTextField';
|
11
11
|
|
12
12
|
interface Props<TData extends MRT_RowData> extends CollapseProps {
|
13
13
|
header: MRT_Header<TData>;
|
@@ -5,12 +5,12 @@ import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
|
5
5
|
import Popover from '@mui/material/Popover';
|
6
6
|
import Tooltip from '@mui/material/Tooltip';
|
7
7
|
import { MRT_TableHeadCellFilterContainer } from './MRT_TableHeadCellFilterContainer';
|
8
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
9
8
|
import {
|
10
9
|
type MRT_Header,
|
11
10
|
type MRT_RowData,
|
12
11
|
type MRT_TableInstance,
|
13
|
-
} from '
|
12
|
+
} from '../../types';
|
13
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
14
14
|
|
15
15
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
16
16
|
header: MRT_Header<TData>;
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { type DragEvent, type RefObject } from 'react';
|
2
2
|
import { type IconButtonProps } from '@mui/material/IconButton';
|
3
|
-
import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
|
4
|
-
import { parseFromValuesOrFunc, reorderColumn } from '../column.utils';
|
5
3
|
import {
|
6
4
|
type MRT_Column,
|
7
5
|
type MRT_RowData,
|
8
6
|
type MRT_TableInstance,
|
9
|
-
} from '
|
7
|
+
} from '../../types';
|
8
|
+
import { reorderColumn } from '../../utils/column.utils';
|
9
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
10
|
+
import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
|
10
11
|
|
11
12
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
12
13
|
column: MRT_Column<TData>;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import Box from '@mui/material/Box';
|
2
2
|
import Divider, { type DividerProps } from '@mui/material/Divider';
|
3
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
4
3
|
import {
|
5
4
|
type MRT_Header,
|
6
5
|
type MRT_RowData,
|
7
6
|
type MRT_TableInstance,
|
8
|
-
} from '
|
7
|
+
} from '../../types';
|
8
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
9
9
|
|
10
10
|
interface Props<TData extends MRT_RowData> extends DividerProps {
|
11
11
|
header: MRT_Header<TData>;
|
@@ -3,12 +3,12 @@ import TableSortLabel, {
|
|
3
3
|
type TableSortLabelProps,
|
4
4
|
} from '@mui/material/TableSortLabel';
|
5
5
|
import Tooltip from '@mui/material/Tooltip';
|
6
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
7
6
|
import {
|
8
7
|
type MRT_Header,
|
9
8
|
type MRT_RowData,
|
10
9
|
type MRT_TableInstance,
|
11
|
-
} from '
|
10
|
+
} from '../../types';
|
11
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
12
12
|
|
13
13
|
interface Props<TData extends MRT_RowData> extends TableSortLabelProps {
|
14
14
|
header: MRT_Header<TData>;
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import TableRow, { type TableRowProps } from '@mui/material/TableRow';
|
2
2
|
import { alpha } from '@mui/material/styles';
|
3
3
|
import { MRT_TableHeadCell } from './MRT_TableHeadCell';
|
4
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
5
|
-
import { getMRTTheme } from '../style.utils';
|
6
4
|
import {
|
7
5
|
type MRT_ColumnVirtualizer,
|
8
6
|
type MRT_Header,
|
9
7
|
type MRT_HeaderGroup,
|
10
8
|
type MRT_RowData,
|
11
9
|
type MRT_TableInstance,
|
12
|
-
} from '
|
10
|
+
} from '../../types';
|
11
|
+
import { getMRTTheme } from '../../utils/style.utils';
|
12
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
13
13
|
|
14
14
|
interface Props<TData extends MRT_RowData> extends TableRowProps {
|
15
15
|
columnVirtualizer?: MRT_ColumnVirtualizer;
|
@@ -7,12 +7,12 @@ import {
|
|
7
7
|
import MenuItem from '@mui/material/MenuItem';
|
8
8
|
import TextField from '@mui/material/TextField';
|
9
9
|
import { type TextFieldProps } from '@mui/material/TextField';
|
10
|
-
import { getValueAndLabel, parseFromValuesOrFunc } from '../column.utils';
|
11
10
|
import {
|
12
11
|
type MRT_Cell,
|
13
12
|
type MRT_RowData,
|
14
13
|
type MRT_TableInstance,
|
15
|
-
} from '
|
14
|
+
} from '../../types';
|
15
|
+
import { getValueAndLabel, parseFromValuesOrFunc } from '../../utils/utils';
|
16
16
|
|
17
17
|
interface Props<TData extends MRT_RowData> extends TextFieldProps<'standard'> {
|
18
18
|
cell: MRT_Cell<TData>;
|
@@ -35,6 +35,7 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
35
35
|
const { column, row } = cell;
|
36
36
|
const { columnDef } = column;
|
37
37
|
const { creatingRow, editingRow } = getState();
|
38
|
+
const { editSelectOptions } = columnDef;
|
38
39
|
|
39
40
|
const isCreating = creatingRow?.id === row.id;
|
40
41
|
const isEditing = editingRow?.id === row.id;
|
@@ -58,6 +59,13 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
58
59
|
...rest,
|
59
60
|
};
|
60
61
|
|
62
|
+
const selectOptions = parseFromValuesOrFunc(editSelectOptions, {
|
63
|
+
cell,
|
64
|
+
column,
|
65
|
+
row,
|
66
|
+
table,
|
67
|
+
});
|
68
|
+
|
61
69
|
const saveInputValueToRowCache = (newValue: string) => {
|
62
70
|
//@ts-ignore
|
63
71
|
row._valuesCache[column.id] = newValue;
|
@@ -123,7 +131,7 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
123
131
|
}
|
124
132
|
select={isSelectEdit}
|
125
133
|
size="small"
|
126
|
-
value={value}
|
134
|
+
value={value ?? ''}
|
127
135
|
variant="standard"
|
128
136
|
{...textFieldProps}
|
129
137
|
InputProps={{
|
@@ -152,7 +160,7 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
152
160
|
onKeyDown={handleEnterKeyDown}
|
153
161
|
>
|
154
162
|
{textFieldProps.children ??
|
155
|
-
|
163
|
+
selectOptions?.map((option) => {
|
156
164
|
const { label, value } = getValueAndLabel(option);
|
157
165
|
return (
|
158
166
|
<MenuItem
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import Checkbox, { type CheckboxProps } from '@mui/material/Checkbox';
|
2
2
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
5
4
|
import {
|
6
5
|
type MRT_Column,
|
7
6
|
type MRT_RowData,
|
8
7
|
type MRT_TableInstance,
|
9
|
-
} from '
|
8
|
+
} from '../../types';
|
9
|
+
import { getCommonTooltipProps } from '../../utils/style.utils';
|
10
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
10
11
|
|
11
12
|
interface Props<TData extends MRT_RowData> extends CheckboxProps {
|
12
13
|
column: MRT_Column<TData>;
|
@@ -44,8 +45,7 @@ export const MRT_FilterCheckbox = <TData extends MRT_RowData>({
|
|
44
45
|
|
45
46
|
return (
|
46
47
|
<Tooltip
|
47
|
-
|
48
|
-
enterNextDelay={1000}
|
48
|
+
{...getCommonTooltipProps()}
|
49
49
|
title={checkboxProps?.title ?? filterLabel}
|
50
50
|
>
|
51
51
|
<FormControlLabel
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import Box, { type BoxProps } from '@mui/material/Box';
|
2
2
|
import { MRT_FilterTextField } from './MRT_FilterTextField';
|
3
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
4
3
|
import {
|
5
4
|
type MRT_Header,
|
6
5
|
type MRT_RowData,
|
7
6
|
type MRT_TableInstance,
|
8
|
-
} from '
|
7
|
+
} from '../../types';
|
8
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
9
9
|
|
10
10
|
interface Props<TData extends MRT_RowData> extends BoxProps {
|
11
11
|
header: MRT_Header<TData>;
|
@@ -2,12 +2,12 @@ import { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import FormHelperText from '@mui/material/FormHelperText';
|
3
3
|
import Slider, { type SliderProps } from '@mui/material/Slider';
|
4
4
|
import Stack from '@mui/material/Stack';
|
5
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
6
5
|
import {
|
7
6
|
type MRT_Header,
|
8
7
|
type MRT_RowData,
|
9
8
|
type MRT_TableInstance,
|
10
|
-
} from '
|
9
|
+
} from '../../types';
|
10
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
11
11
|
|
12
12
|
interface Props<TData extends MRT_RowData> extends SliderProps {
|
13
13
|
header: MRT_Header<TData>;
|
@@ -29,13 +29,13 @@ import {
|
|
29
29
|
TimePicker,
|
30
30
|
type TimePickerProps,
|
31
31
|
} from '@mui/x-date-pickers/TimePicker';
|
32
|
-
import { getValueAndLabel, parseFromValuesOrFunc } from '../column.utils';
|
33
|
-
import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
|
34
32
|
import {
|
35
33
|
type MRT_Header,
|
36
34
|
type MRT_RowData,
|
37
35
|
type MRT_TableInstance,
|
38
|
-
} from '
|
36
|
+
} from '../../types';
|
37
|
+
import { getValueAndLabel, parseFromValuesOrFunc } from '../../utils/utils';
|
38
|
+
import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
|
39
39
|
|
40
40
|
interface Props<TData extends MRT_RowData> extends TextFieldProps<'standard'> {
|
41
41
|
header: MRT_Header<TData>;
|
@@ -12,9 +12,9 @@ import InputAdornment from '@mui/material/InputAdornment';
|
|
12
12
|
import TextField, { type TextFieldProps } from '@mui/material/TextField';
|
13
13
|
import Tooltip from '@mui/material/Tooltip';
|
14
14
|
import { debounce } from '@mui/material/utils';
|
15
|
-
import {
|
15
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
16
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
16
17
|
import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
|
17
|
-
import { type MRT_RowData, type MRT_TableInstance } from '../types';
|
18
18
|
|
19
19
|
interface Props<TData extends MRT_RowData> extends TextFieldProps<'standard'> {
|
20
20
|
table: MRT_TableInstance<TData>;
|
@@ -3,12 +3,13 @@ import Checkbox, { type CheckboxProps } from '@mui/material/Checkbox';
|
|
3
3
|
import Radio, { type RadioProps } from '@mui/material/Radio';
|
4
4
|
import Tooltip from '@mui/material/Tooltip';
|
5
5
|
import { type Theme } from '@mui/material/styles';
|
6
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
7
6
|
import {
|
8
7
|
type MRT_Row,
|
9
8
|
type MRT_RowData,
|
10
9
|
type MRT_TableInstance,
|
11
|
-
} from '
|
10
|
+
} from '../../types';
|
11
|
+
import { getCommonTooltipProps } from '../../utils/style.utils';
|
12
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
12
13
|
|
13
14
|
interface Props<TData extends MRT_RowData> extends CheckboxProps {
|
14
15
|
row?: MRT_Row<TData>;
|
@@ -124,8 +125,7 @@ export const MRT_SelectCheckbox = <TData extends MRT_RowData>({
|
|
124
125
|
|
125
126
|
return (
|
126
127
|
<Tooltip
|
127
|
-
|
128
|
-
enterNextDelay={1000}
|
128
|
+
{...getCommonTooltipProps()}
|
129
129
|
title={
|
130
130
|
checkboxProps?.title ??
|
131
131
|
(selectAll
|
@@ -5,12 +5,14 @@ import IconButton from '@mui/material/IconButton';
|
|
5
5
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
6
6
|
import Menu, { type MenuProps } from '@mui/material/Menu';
|
7
7
|
import MenuItem from '@mui/material/MenuItem';
|
8
|
+
import { useTheme } from '@mui/material/styles';
|
8
9
|
import { MRT_FilterOptionMenu } from './MRT_FilterOptionMenu';
|
9
10
|
import {
|
10
11
|
type MRT_Header,
|
11
12
|
type MRT_RowData,
|
12
13
|
type MRT_TableInstance,
|
13
|
-
} from '
|
14
|
+
} from '../../types';
|
15
|
+
import { getMRTTheme } from '../../utils/style.utils';
|
14
16
|
|
15
17
|
export const commonMenuItemStyles = {
|
16
18
|
alignItems: 'center',
|
@@ -396,10 +398,16 @@ export const MRT_ColumnActionMenu = <TData extends MRT_RowData>({
|
|
396
398
|
: []),
|
397
399
|
].filter(Boolean);
|
398
400
|
|
401
|
+
const theme = useTheme();
|
402
|
+
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
403
|
+
|
399
404
|
return (
|
400
405
|
<Menu
|
401
406
|
MenuListProps={{
|
402
407
|
dense: density === 'compact',
|
408
|
+
sx: {
|
409
|
+
backgroundColor: menuBackgroundColor,
|
410
|
+
},
|
403
411
|
}}
|
404
412
|
anchorEl={anchorEl}
|
405
413
|
onClose={() => setAnchorEl(null)}
|
@@ -2,6 +2,7 @@ import { useMemo } from 'react';
|
|
2
2
|
import Box from '@mui/material/Box';
|
3
3
|
import Menu, { type MenuProps } from '@mui/material/Menu';
|
4
4
|
import MenuItem from '@mui/material/MenuItem';
|
5
|
+
import { useTheme } from '@mui/material/styles';
|
5
6
|
import {
|
6
7
|
type MRT_FilterOption,
|
7
8
|
type MRT_Header,
|
@@ -9,7 +10,8 @@ import {
|
|
9
10
|
type MRT_Localization,
|
10
11
|
type MRT_RowData,
|
11
12
|
type MRT_TableInstance,
|
12
|
-
} from '
|
13
|
+
} from '../../types';
|
14
|
+
import { getMRTTheme } from '../../utils/style.utils';
|
13
15
|
|
14
16
|
export const mrtFilterOptions = (
|
15
17
|
localization: MRT_Localization,
|
@@ -237,10 +239,16 @@ export const MRT_FilterOptionMenu = <TData extends MRT_RowData>({
|
|
237
239
|
const filterOption =
|
238
240
|
!!header && columnDef ? columnDef._filterFn : globalFilterFn;
|
239
241
|
|
242
|
+
const theme = useTheme();
|
243
|
+
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
244
|
+
|
240
245
|
return (
|
241
246
|
<Menu
|
242
247
|
MenuListProps={{
|
243
248
|
dense: density === 'compact',
|
249
|
+
sx: {
|
250
|
+
backgroundColor: menuBackgroundColor,
|
251
|
+
},
|
244
252
|
}}
|
245
253
|
anchorEl={anchorEl}
|
246
254
|
anchorOrigin={{ horizontal: 'right', vertical: 'center' }}
|
@@ -3,22 +3,25 @@ import Box from '@mui/material/Box';
|
|
3
3
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
4
4
|
import Menu, { type MenuProps } from '@mui/material/Menu';
|
5
5
|
import MenuItem from '@mui/material/MenuItem';
|
6
|
+
import { useTheme } from '@mui/material/styles';
|
6
7
|
import {
|
7
8
|
commonListItemStyles,
|
8
9
|
commonMenuItemStyles,
|
9
10
|
} from './MRT_ColumnActionMenu';
|
10
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
11
11
|
import {
|
12
12
|
type MRT_Row,
|
13
13
|
type MRT_RowData,
|
14
14
|
type MRT_TableInstance,
|
15
|
-
} from '
|
15
|
+
} from '../../types';
|
16
|
+
import { getMRTTheme } from '../../utils/style.utils';
|
17
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
16
18
|
|
17
19
|
interface Props<TData extends MRT_RowData> extends Partial<MenuProps> {
|
18
20
|
anchorEl: HTMLElement | null;
|
19
21
|
handleEdit: (event: MouseEvent) => void;
|
20
22
|
row: MRT_Row<TData>;
|
21
23
|
setAnchorEl: (anchorEl: HTMLElement | null) => void;
|
24
|
+
staticRowIndex?: number;
|
22
25
|
table: MRT_TableInstance<TData>;
|
23
26
|
}
|
24
27
|
|
@@ -27,6 +30,7 @@ export const MRT_RowActionMenu = <TData extends MRT_RowData>({
|
|
27
30
|
handleEdit,
|
28
31
|
row,
|
29
32
|
setAnchorEl,
|
33
|
+
staticRowIndex,
|
30
34
|
table,
|
31
35
|
...rest
|
32
36
|
}: Props<TData>) => {
|
@@ -42,10 +46,16 @@ export const MRT_RowActionMenu = <TData extends MRT_RowData>({
|
|
42
46
|
} = table;
|
43
47
|
const { density } = getState();
|
44
48
|
|
49
|
+
const theme = useTheme();
|
50
|
+
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
51
|
+
|
45
52
|
return (
|
46
53
|
<Menu
|
47
54
|
MenuListProps={{
|
48
55
|
dense: density === 'compact',
|
56
|
+
sx: {
|
57
|
+
backgroundColor: menuBackgroundColor,
|
58
|
+
},
|
49
59
|
}}
|
50
60
|
anchorEl={anchorEl}
|
51
61
|
onClick={(event) => event.stopPropagation()}
|
@@ -67,6 +77,7 @@ export const MRT_RowActionMenu = <TData extends MRT_RowData>({
|
|
67
77
|
{renderRowActionMenuItems?.({
|
68
78
|
closeMenu: () => setAnchorEl(null),
|
69
79
|
row,
|
80
|
+
staticRowIndex,
|
70
81
|
table,
|
71
82
|
})}
|
72
83
|
</Menu>
|
@@ -3,13 +3,15 @@ import Box from '@mui/material/Box';
|
|
3
3
|
import Button from '@mui/material/Button';
|
4
4
|
import Divider from '@mui/material/Divider';
|
5
5
|
import Menu, { type MenuProps } from '@mui/material/Menu';
|
6
|
+
import { useTheme } from '@mui/material/styles';
|
6
7
|
import { MRT_ShowHideColumnsMenuItems } from './MRT_ShowHideColumnsMenuItems';
|
7
|
-
import { getDefaultColumnOrderIds } from '../column.utils';
|
8
8
|
import {
|
9
9
|
type MRT_Column,
|
10
10
|
type MRT_RowData,
|
11
11
|
type MRT_TableInstance,
|
12
|
-
} from '
|
12
|
+
} from '../../types';
|
13
|
+
import { getDefaultColumnOrderIds } from '../../utils/displayColumn.utils';
|
14
|
+
import { getMRTTheme } from '../../utils/style.utils';
|
13
15
|
|
14
16
|
interface Props<TData extends MRT_RowData> extends Partial<MenuProps> {
|
15
17
|
anchorEl: HTMLElement | null;
|
@@ -77,10 +79,16 @@ export const MRT_ShowHideColumnsMenu = <TData extends MRT_RowData>({
|
|
77
79
|
null,
|
78
80
|
);
|
79
81
|
|
82
|
+
const theme = useTheme();
|
83
|
+
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
84
|
+
|
80
85
|
return (
|
81
86
|
<Menu
|
82
87
|
MenuListProps={{
|
83
88
|
dense: density === 'compact',
|
89
|
+
sx: {
|
90
|
+
backgroundColor: menuBackgroundColor,
|
91
|
+
},
|
84
92
|
}}
|
85
93
|
anchorEl={anchorEl}
|
86
94
|
onClose={() => setAnchorEl(null)}
|
@@ -106,9 +114,7 @@ export const MRT_ShowHideColumnsMenu = <TData extends MRT_RowData>({
|
|
106
114
|
{enableColumnOrdering && (
|
107
115
|
<Button
|
108
116
|
onClick={() =>
|
109
|
-
table.setColumnOrder(
|
110
|
-
getDefaultColumnOrderIds(table.options as any),
|
111
|
-
)
|
117
|
+
table.setColumnOrder(getDefaultColumnOrderIds(table.options))
|
112
118
|
}
|
113
119
|
>
|
114
120
|
{localization.resetOrder}
|
@@ -11,15 +11,16 @@ import MenuItem, { type MenuItemProps } from '@mui/material/MenuItem';
|
|
11
11
|
import Switch from '@mui/material/Switch';
|
12
12
|
import Tooltip from '@mui/material/Tooltip';
|
13
13
|
import Typography from '@mui/material/Typography';
|
14
|
-
import { MRT_ColumnPinningButtons } from '../buttons/MRT_ColumnPinningButtons';
|
15
|
-
import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
|
16
|
-
import { parseFromValuesOrFunc, reorderColumn } from '../column.utils';
|
17
|
-
import { getMRTTheme } from '../style.utils';
|
18
14
|
import {
|
19
15
|
type MRT_Column,
|
20
16
|
type MRT_RowData,
|
21
17
|
type MRT_TableInstance,
|
22
|
-
} from '
|
18
|
+
} from '../../types';
|
19
|
+
import { reorderColumn } from '../../utils/column.utils';
|
20
|
+
import { getCommonTooltipProps, getMRTTheme } from '../../utils/style.utils';
|
21
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
22
|
+
import { MRT_ColumnPinningButtons } from '../buttons/MRT_ColumnPinningButtons';
|
23
|
+
import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
|
23
24
|
|
24
25
|
interface Props<TData extends MRT_RowData> extends MenuItemProps {
|
25
26
|
allColumns: MRT_Column<TData>[];
|
@@ -160,8 +161,7 @@ export const MRT_ShowHideColumnsMenuItems = <TData extends MRT_RowData>({
|
|
160
161
|
}}
|
161
162
|
control={
|
162
163
|
<Tooltip
|
163
|
-
|
164
|
-
enterNextDelay={1000}
|
164
|
+
{...getCommonTooltipProps()}
|
165
165
|
title={localization.toggleVisibility}
|
166
166
|
>
|
167
167
|
<Switch />
|
@@ -3,14 +3,14 @@ import DialogActions from '@mui/material/DialogActions';
|
|
3
3
|
import DialogContent from '@mui/material/DialogContent';
|
4
4
|
import DialogTitle from '@mui/material/DialogTitle';
|
5
5
|
import Stack from '@mui/material/Stack';
|
6
|
-
import { MRT_EditActionButtons } from '../buttons/MRT_EditActionButtons';
|
7
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
8
|
-
import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
|
9
6
|
import {
|
10
7
|
type MRT_Row,
|
11
8
|
type MRT_RowData,
|
12
9
|
type MRT_TableInstance,
|
13
|
-
} from '
|
10
|
+
} from '../../types';
|
11
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
12
|
+
import { MRT_EditActionButtons } from '../buttons/MRT_EditActionButtons';
|
13
|
+
import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
|
14
14
|
|
15
15
|
interface Props<TData extends MRT_RowData> extends Partial<DialogProps> {
|
16
16
|
open: boolean;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { useMemo } from 'react';
|
2
2
|
import Table, { type TableProps } from '@mui/material/Table';
|
3
|
+
import { useMRT_ColumnVirtualizer } from '../../hooks/useMRT_ColumnVirtualizer';
|
4
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
5
|
+
import { parseCSSVarId } from '../../utils/style.utils';
|
6
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
3
7
|
import { MRT_TableBody, Memo_MRT_TableBody } from '../body/MRT_TableBody';
|
4
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
5
8
|
import { MRT_TableFooter } from '../footer/MRT_TableFooter';
|
6
9
|
import { MRT_TableHead } from '../head/MRT_TableHead';
|
7
|
-
import { useMRT_ColumnVirtualizer } from '../hooks/useMRT_ColumnVirtualizer';
|
8
|
-
import { parseCSSVarId } from '../style.utils';
|
9
|
-
import { type MRT_RowData, type MRT_TableInstance } from '../types';
|
10
10
|
|
11
11
|
interface Props<TData extends MRT_RowData> extends TableProps {
|
12
12
|
table: MRT_TableInstance<TData>;
|
@@ -4,9 +4,9 @@ import TableContainer, {
|
|
4
4
|
} from '@mui/material/TableContainer';
|
5
5
|
import { MRT_Table } from './MRT_Table';
|
6
6
|
import { MRT_TableLoadingOverlay } from './MRT_TableLoadingOverlay';
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
7
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
8
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
9
|
+
import { MRT_EditRowModal } from '../modals/MRT_EditRowModal';
|
10
10
|
|
11
11
|
const useIsomorphicLayoutEffect =
|
12
12
|
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|