material-react-table 0.9.6 → 0.11.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/README.md +2 -0
- package/dist/MaterialReactTable.d.ts +145 -131
- package/dist/body/MRT_TableBody.d.ts +1 -1
- package/dist/body/MRT_TableBodyCell.d.ts +1 -1
- package/dist/body/MRT_TableBodyRow.d.ts +1 -1
- package/dist/body/MRT_TableDetailPanel.d.ts +1 -1
- package/dist/buttons/MRT_ColumnPinningButtons.d.ts +1 -1
- package/dist/buttons/MRT_CopyButton.d.ts +1 -1
- package/dist/buttons/MRT_EditActionButtons.d.ts +1 -1
- package/dist/buttons/MRT_ExpandAllButton.d.ts +1 -1
- package/dist/buttons/MRT_ExpandButton.d.ts +1 -1
- package/dist/buttons/MRT_FullScreenToggleButton.d.ts +1 -1
- package/dist/buttons/MRT_GrabHandleButton.d.ts +1 -1
- package/dist/buttons/MRT_ShowHideColumnsButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleColumnActionMenuButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleFiltersButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleRowActionMenuButton.d.ts +1 -1
- package/dist/footer/MRT_TableFooter.d.ts +1 -1
- package/dist/footer/MRT_TableFooterCell.d.ts +1 -1
- package/dist/footer/MRT_TableFooterRow.d.ts +1 -1
- package/dist/head/MRT_DraggableTableHeadCell.d.ts +1 -1
- package/dist/head/MRT_TableHead.d.ts +1 -1
- package/dist/head/MRT_TableHeadCell.d.ts +1 -1
- package/dist/head/MRT_TableHeadCellFilterContainer.d.ts +1 -1
- package/dist/head/MRT_TableHeadCellFilterLabel.d.ts +1 -1
- package/dist/head/MRT_TableHeadCellResizeHandle.d.ts +1 -1
- package/dist/head/MRT_TableHeadCellSortLabel.d.ts +1 -1
- package/dist/head/MRT_TableHeadRow.d.ts +1 -1
- package/dist/inputs/MRT_EditCellTextField.d.ts +1 -1
- package/dist/inputs/MRT_FilterRangeFields.d.ts +1 -1
- package/dist/inputs/MRT_FilterTextField.d.ts +1 -1
- package/dist/inputs/MRT_SearchTextField.d.ts +1 -1
- package/dist/inputs/MRT_SelectCheckbox.d.ts +1 -1
- package/dist/material-react-table.cjs.development.js +565 -573
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +565 -573
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_ColumnActionMenu.d.ts +1 -1
- package/dist/menus/MRT_FilterOptionMenu.d.ts +1 -1
- package/dist/menus/MRT_RowActionMenu.d.ts +1 -1
- package/dist/menus/MRT_ShowHideColumnsMenu.d.ts +1 -1
- package/dist/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -1
- package/dist/table/MRT_Table.d.ts +1 -1
- package/dist/table/MRT_TableContainer.d.ts +1 -1
- package/dist/table/MRT_TablePaper.d.ts +2 -2
- package/dist/toolbar/MRT_LinearProgressBar.d.ts +1 -1
- package/dist/toolbar/MRT_TablePagination.d.ts +1 -1
- package/dist/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/toolbar/MRT_ToolbarBottom.d.ts +1 -1
- package/dist/toolbar/MRT_ToolbarInternalButtons.d.ts +1 -1
- package/dist/toolbar/MRT_ToolbarTop.d.ts +1 -1
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +175 -175
- package/src/body/MRT_TableBody.tsx +5 -8
- package/src/body/MRT_TableBodyCell.tsx +15 -19
- package/src/body/MRT_TableBodyRow.tsx +8 -8
- package/src/body/MRT_TableDetailPanel.tsx +13 -11
- package/src/buttons/MRT_ColumnPinningButtons.tsx +3 -6
- package/src/buttons/MRT_CopyButton.tsx +5 -9
- package/src/buttons/MRT_EditActionButtons.tsx +5 -5
- package/src/buttons/MRT_ExpandAllButton.tsx +3 -3
- package/src/buttons/MRT_ExpandButton.tsx +5 -5
- package/src/buttons/MRT_FullScreenToggleButton.tsx +6 -6
- package/src/buttons/MRT_GrabHandleButton.tsx +3 -3
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +4 -7
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +6 -6
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +6 -6
- package/src/buttons/MRT_ToggleFiltersButton.tsx +6 -9
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +7 -7
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +6 -9
- package/src/footer/MRT_TableFooter.tsx +5 -5
- package/src/footer/MRT_TableFooterCell.tsx +6 -6
- package/src/footer/MRT_TableFooterRow.tsx +5 -8
- package/src/head/MRT_DraggableTableHeadCell.tsx +4 -7
- package/src/head/MRT_TableHead.tsx +5 -5
- package/src/head/MRT_TableHeadCell.tsx +14 -22
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +6 -7
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +3 -3
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +3 -3
- package/src/head/MRT_TableHeadCellSortLabel.tsx +3 -6
- package/src/head/MRT_TableHeadRow.tsx +6 -6
- package/src/inputs/MRT_EditCellTextField.tsx +12 -12
- package/src/inputs/MRT_FilterRangeFields.tsx +5 -13
- package/src/inputs/MRT_FilterTextField.tsx +10 -14
- package/src/inputs/MRT_SearchTextField.tsx +7 -7
- package/src/inputs/MRT_SelectCheckbox.tsx +14 -20
- package/src/menus/MRT_ColumnActionMenu.tsx +5 -5
- package/src/menus/MRT_FilterOptionMenu.tsx +33 -33
- package/src/menus/MRT_RowActionMenu.tsx +4 -4
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +6 -6
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +9 -12
- package/src/table/MRT_Table.tsx +13 -8
- package/src/table/MRT_TableContainer.tsx +16 -12
- package/src/table/MRT_TablePaper.tsx +8 -14
- package/src/table/MRT_TableRoot.tsx +25 -30
- package/src/toolbar/MRT_LinearProgressBar.tsx +4 -7
- package/src/toolbar/MRT_TablePagination.tsx +4 -4
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +6 -8
- package/src/toolbar/MRT_ToolbarBottom.tsx +8 -8
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +10 -12
- package/src/toolbar/MRT_ToolbarTop.tsx +11 -10
- package/src/utils.ts +2 -2
- package/dist/enums.d.ts +0 -13
- package/src/enums.ts +0 -13
|
@@ -17,13 +17,10 @@ const commonIconButtonStyles = {
|
|
|
17
17
|
|
|
18
18
|
interface Props {
|
|
19
19
|
row: MRT_Row;
|
|
20
|
-
|
|
20
|
+
instance: MRT_TableInstance;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export const MRT_ToggleRowActionMenuButton: FC<Props> = ({
|
|
24
|
-
row,
|
|
25
|
-
tableInstance,
|
|
26
|
-
}) => {
|
|
23
|
+
export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row, instance }) => {
|
|
27
24
|
const {
|
|
28
25
|
getState,
|
|
29
26
|
options: {
|
|
@@ -34,7 +31,7 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({
|
|
|
34
31
|
renderRowActions,
|
|
35
32
|
},
|
|
36
33
|
setCurrentEditingRow,
|
|
37
|
-
} =
|
|
34
|
+
} = instance;
|
|
38
35
|
|
|
39
36
|
const { currentEditingRow } = getState();
|
|
40
37
|
|
|
@@ -54,9 +51,9 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({
|
|
|
54
51
|
return (
|
|
55
52
|
<>
|
|
56
53
|
{renderRowActions ? (
|
|
57
|
-
<>{renderRowActions({ row,
|
|
54
|
+
<>{renderRowActions({ row, instance })}</>
|
|
58
55
|
) : row.id === currentEditingRow?.id ? (
|
|
59
|
-
<MRT_EditActionButtons row={row}
|
|
56
|
+
<MRT_EditActionButtons row={row} instance={instance} />
|
|
60
57
|
) : !renderRowActionMenuItems && enableEditing ? (
|
|
61
58
|
<Tooltip placement="right" arrow title={localization.edit}>
|
|
62
59
|
<IconButton sx={commonIconButtonStyles} onClick={handleStartEditMode}>
|
|
@@ -85,7 +82,7 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({
|
|
|
85
82
|
handleEdit={handleStartEditMode}
|
|
86
83
|
row={row}
|
|
87
84
|
setAnchorEl={setAnchorEl}
|
|
88
|
-
|
|
85
|
+
instance={instance}
|
|
89
86
|
/>
|
|
90
87
|
</>
|
|
91
88
|
) : null}
|
|
@@ -4,19 +4,19 @@ import { MRT_TableFooterRow } from './MRT_TableFooterRow';
|
|
|
4
4
|
import type { MRT_TableInstance } from '..';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
|
|
7
|
+
instance: MRT_TableInstance;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const MRT_TableFooter: FC<Props> = ({
|
|
10
|
+
export const MRT_TableFooter: FC<Props> = ({ instance }) => {
|
|
11
11
|
const {
|
|
12
12
|
getFooterGroups,
|
|
13
13
|
|
|
14
14
|
options: { muiTableFooterProps },
|
|
15
|
-
} =
|
|
15
|
+
} = instance;
|
|
16
16
|
|
|
17
17
|
const tableFooterProps =
|
|
18
18
|
muiTableFooterProps instanceof Function
|
|
19
|
-
? muiTableFooterProps({
|
|
19
|
+
? muiTableFooterProps({ instance })
|
|
20
20
|
: muiTableFooterProps;
|
|
21
21
|
|
|
22
22
|
return (
|
|
@@ -25,7 +25,7 @@ export const MRT_TableFooter: FC<Props> = ({ tableInstance }) => {
|
|
|
25
25
|
<MRT_TableFooterRow
|
|
26
26
|
footerGroup={footerGroup as any}
|
|
27
27
|
key={footerGroup.id}
|
|
28
|
-
|
|
28
|
+
instance={instance}
|
|
29
29
|
/>
|
|
30
30
|
))}
|
|
31
31
|
</TableFooter>
|
|
@@ -4,14 +4,14 @@ import type { MRT_Header, MRT_TableInstance } from '..';
|
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
footer: MRT_Header;
|
|
7
|
-
|
|
7
|
+
instance: MRT_TableInstance;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const MRT_TableFooterCell: FC<Props> = ({ footer,
|
|
10
|
+
export const MRT_TableFooterCell: FC<Props> = ({ footer, instance }) => {
|
|
11
11
|
const {
|
|
12
12
|
getState,
|
|
13
13
|
options: { muiTableFooterCellProps, enableColumnResizing },
|
|
14
|
-
} =
|
|
14
|
+
} = instance;
|
|
15
15
|
|
|
16
16
|
const { isDensePadding } = getState();
|
|
17
17
|
|
|
@@ -21,12 +21,12 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, tableInstance }) => {
|
|
|
21
21
|
|
|
22
22
|
const mTableFooterCellProps =
|
|
23
23
|
muiTableFooterCellProps instanceof Function
|
|
24
|
-
? muiTableFooterCellProps({ column,
|
|
24
|
+
? muiTableFooterCellProps({ column, instance })
|
|
25
25
|
: muiTableFooterCellProps;
|
|
26
26
|
|
|
27
27
|
const mcTableFooterCellProps =
|
|
28
28
|
columnDef.muiTableFooterCellProps instanceof Function
|
|
29
|
-
? columnDef.muiTableFooterCellProps({ column,
|
|
29
|
+
? columnDef.muiTableFooterCellProps({ column, instance })
|
|
30
30
|
: columnDef.muiTableFooterCellProps;
|
|
31
31
|
|
|
32
32
|
const tableCellProps = {
|
|
@@ -62,7 +62,7 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, tableInstance }) => {
|
|
|
62
62
|
: (columnDef.Footer instanceof Function
|
|
63
63
|
? columnDef.Footer?.({
|
|
64
64
|
footer,
|
|
65
|
-
|
|
65
|
+
instance,
|
|
66
66
|
})
|
|
67
67
|
: columnDef.Footer) ??
|
|
68
68
|
columnDef.footer ??
|
|
@@ -5,16 +5,13 @@ import type { MRT_Header, MRT_HeaderGroup, MRT_TableInstance } from '..';
|
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
footerGroup: MRT_HeaderGroup;
|
|
8
|
-
|
|
8
|
+
instance: MRT_TableInstance;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const MRT_TableFooterRow: FC<Props> = ({
|
|
12
|
-
footerGroup,
|
|
13
|
-
tableInstance,
|
|
14
|
-
}) => {
|
|
11
|
+
export const MRT_TableFooterRow: FC<Props> = ({ footerGroup, instance }) => {
|
|
15
12
|
const {
|
|
16
13
|
options: { muiTableFooterRowProps },
|
|
17
|
-
} =
|
|
14
|
+
} = instance;
|
|
18
15
|
|
|
19
16
|
// if no content in row, skip row
|
|
20
17
|
if (
|
|
@@ -29,7 +26,7 @@ export const MRT_TableFooterRow: FC<Props> = ({
|
|
|
29
26
|
|
|
30
27
|
const tableRowProps =
|
|
31
28
|
muiTableFooterRowProps instanceof Function
|
|
32
|
-
? muiTableFooterRowProps({ footerGroup,
|
|
29
|
+
? muiTableFooterRowProps({ footerGroup, instance })
|
|
33
30
|
: muiTableFooterRowProps;
|
|
34
31
|
|
|
35
32
|
return (
|
|
@@ -38,7 +35,7 @@ export const MRT_TableFooterRow: FC<Props> = ({
|
|
|
38
35
|
<MRT_TableFooterCell
|
|
39
36
|
footer={footer}
|
|
40
37
|
key={footer.id}
|
|
41
|
-
|
|
38
|
+
instance={instance}
|
|
42
39
|
/>
|
|
43
40
|
))}
|
|
44
41
|
</TableRow>
|
|
@@ -6,18 +6,15 @@ import { reorderColumn } from '../utils';
|
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
header: MRT_Header;
|
|
9
|
-
|
|
9
|
+
instance: MRT_TableInstance;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const MRT_DraggableTableHeadCell: FC<Props> = ({
|
|
13
|
-
header,
|
|
14
|
-
tableInstance,
|
|
15
|
-
}) => {
|
|
12
|
+
export const MRT_DraggableTableHeadCell: FC<Props> = ({ header, instance }) => {
|
|
16
13
|
const {
|
|
17
14
|
getState,
|
|
18
15
|
options: {},
|
|
19
16
|
setColumnOrder,
|
|
20
|
-
} =
|
|
17
|
+
} = instance;
|
|
21
18
|
|
|
22
19
|
const { columnOrder } = getState();
|
|
23
20
|
|
|
@@ -44,7 +41,7 @@ export const MRT_DraggableTableHeadCell: FC<Props> = ({
|
|
|
44
41
|
header={header}
|
|
45
42
|
isDragging={isDragging}
|
|
46
43
|
previewRef={previewRef}
|
|
47
|
-
|
|
44
|
+
instance={instance}
|
|
48
45
|
/>
|
|
49
46
|
);
|
|
50
47
|
};
|
|
@@ -4,18 +4,18 @@ import { MRT_TableHeadRow } from './MRT_TableHeadRow';
|
|
|
4
4
|
import type { MRT_TableInstance } from '..';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
|
|
7
|
+
instance: MRT_TableInstance;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const MRT_TableHead: FC<Props> = ({
|
|
10
|
+
export const MRT_TableHead: FC<Props> = ({ instance }) => {
|
|
11
11
|
const {
|
|
12
12
|
getHeaderGroups,
|
|
13
13
|
options: { muiTableHeadProps },
|
|
14
|
-
} =
|
|
14
|
+
} = instance;
|
|
15
15
|
|
|
16
16
|
const tableHeadProps =
|
|
17
17
|
muiTableHeadProps instanceof Function
|
|
18
|
-
? muiTableHeadProps({
|
|
18
|
+
? muiTableHeadProps({ instance })
|
|
19
19
|
: muiTableHeadProps;
|
|
20
20
|
|
|
21
21
|
return (
|
|
@@ -24,7 +24,7 @@ export const MRT_TableHead: FC<Props> = ({ tableInstance }) => {
|
|
|
24
24
|
<MRT_TableHeadRow
|
|
25
25
|
headerGroup={headerGroup as any}
|
|
26
26
|
key={headerGroup.id}
|
|
27
|
-
|
|
27
|
+
instance={instance}
|
|
28
28
|
/>
|
|
29
29
|
))}
|
|
30
30
|
</TableHead>
|
|
@@ -14,7 +14,7 @@ interface Props {
|
|
|
14
14
|
header: MRT_Header;
|
|
15
15
|
isDragging?: boolean;
|
|
16
16
|
previewRef?: Ref<HTMLTableCellElement>;
|
|
17
|
-
|
|
17
|
+
instance: MRT_TableInstance;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export const MRT_TableHeadCell: FC<Props> = ({
|
|
@@ -23,7 +23,7 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
23
23
|
header,
|
|
24
24
|
isDragging,
|
|
25
25
|
previewRef,
|
|
26
|
-
|
|
26
|
+
instance,
|
|
27
27
|
}) => {
|
|
28
28
|
const {
|
|
29
29
|
getState,
|
|
@@ -35,7 +35,7 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
35
35
|
enableGrouping,
|
|
36
36
|
muiTableHeadCellProps,
|
|
37
37
|
},
|
|
38
|
-
} =
|
|
38
|
+
} = instance;
|
|
39
39
|
|
|
40
40
|
const { isDensePadding } = getState();
|
|
41
41
|
|
|
@@ -45,12 +45,12 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
45
45
|
|
|
46
46
|
const mTableHeadCellProps =
|
|
47
47
|
muiTableHeadCellProps instanceof Function
|
|
48
|
-
? muiTableHeadCellProps({ column,
|
|
48
|
+
? muiTableHeadCellProps({ column, instance })
|
|
49
49
|
: muiTableHeadCellProps;
|
|
50
50
|
|
|
51
51
|
const mcTableHeadCellProps =
|
|
52
52
|
columnDef.muiTableHeadCellProps instanceof Function
|
|
53
|
-
? columnDef.muiTableHeadCellProps({ column,
|
|
53
|
+
? columnDef.muiTableHeadCellProps({ column, instance })
|
|
54
54
|
: columnDef.muiTableHeadCellProps;
|
|
55
55
|
|
|
56
56
|
const tableCellProps = {
|
|
@@ -61,7 +61,7 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
61
61
|
const headerElement = ((columnDef?.Header instanceof Function
|
|
62
62
|
? columnDef?.Header?.({
|
|
63
63
|
header,
|
|
64
|
-
|
|
64
|
+
instance,
|
|
65
65
|
})
|
|
66
66
|
: columnDef?.Header) ??
|
|
67
67
|
header.renderHeader() ??
|
|
@@ -70,7 +70,7 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
70
70
|
const getIsLastLeftPinnedColumn = () => {
|
|
71
71
|
return (
|
|
72
72
|
column.getIsPinned() === 'left' &&
|
|
73
|
-
|
|
73
|
+
instance.getLeftLeafHeaders().length - 1 === column.getPinnedIndex()
|
|
74
74
|
);
|
|
75
75
|
};
|
|
76
76
|
|
|
@@ -80,9 +80,7 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
80
80
|
|
|
81
81
|
const getTotalRight = () => {
|
|
82
82
|
return (
|
|
83
|
-
(
|
|
84
|
-
1 -
|
|
85
|
-
column.getPinnedIndex()) *
|
|
83
|
+
(instance.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) *
|
|
86
84
|
150
|
|
87
85
|
);
|
|
88
86
|
};
|
|
@@ -171,17 +169,14 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
171
169
|
>
|
|
172
170
|
{headerElement}
|
|
173
171
|
{columnDefType === 'data' && column.getCanSort() && (
|
|
174
|
-
<MRT_TableHeadCellSortLabel
|
|
175
|
-
header={header}
|
|
176
|
-
tableInstance={tableInstance}
|
|
177
|
-
/>
|
|
172
|
+
<MRT_TableHeadCellSortLabel header={header} instance={instance} />
|
|
178
173
|
)}
|
|
179
174
|
{columnDefType === 'data' &&
|
|
180
175
|
enableColumnFilters &&
|
|
181
176
|
column.getCanFilter() && (
|
|
182
177
|
<MRT_TableHeadCellFilterLabel
|
|
183
178
|
header={header}
|
|
184
|
-
|
|
179
|
+
instance={instance}
|
|
185
180
|
/>
|
|
186
181
|
)}
|
|
187
182
|
</Box>
|
|
@@ -192,7 +187,7 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
192
187
|
(enableGrouping && columnDef.enableGrouping !== false)) && (
|
|
193
188
|
<MRT_GrabHandleButton
|
|
194
189
|
ref={dragRef as Ref<HTMLButtonElement>}
|
|
195
|
-
|
|
190
|
+
instance={instance}
|
|
196
191
|
/>
|
|
197
192
|
)}
|
|
198
193
|
{(enableColumnActions || columnDef.enableColumnActions) &&
|
|
@@ -200,23 +195,20 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
200
195
|
columnDefType !== 'group' && (
|
|
201
196
|
<MRT_ToggleColumnActionMenuButton
|
|
202
197
|
header={header}
|
|
203
|
-
|
|
198
|
+
instance={instance}
|
|
204
199
|
/>
|
|
205
200
|
)}
|
|
206
201
|
</Box>
|
|
207
202
|
{column.getCanResize() && (
|
|
208
203
|
<MRT_TableHeadCellResizeHandle
|
|
209
204
|
header={header}
|
|
210
|
-
|
|
205
|
+
instance={instance}
|
|
211
206
|
/>
|
|
212
207
|
)}
|
|
213
208
|
</Box>
|
|
214
209
|
)}
|
|
215
210
|
{columnDefType === 'data' && column.getCanFilter() && (
|
|
216
|
-
<MRT_TableHeadCellFilterContainer
|
|
217
|
-
header={header}
|
|
218
|
-
tableInstance={tableInstance}
|
|
219
|
-
/>
|
|
211
|
+
<MRT_TableHeadCellFilterContainer header={header} instance={instance} />
|
|
220
212
|
)}
|
|
221
213
|
</TableCell>
|
|
222
214
|
);
|
|
@@ -2,19 +2,18 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { Collapse } from '@mui/material';
|
|
3
3
|
import { MRT_FilterRangeFields } from '../inputs/MRT_FilterRangeFields';
|
|
4
4
|
import { MRT_FilterTextField } from '../inputs/MRT_FilterTextField';
|
|
5
|
-
import { MRT_FILTER_OPTION } from '../enums';
|
|
6
5
|
import { MRT_Header, MRT_TableInstance } from '..';
|
|
7
6
|
|
|
8
7
|
interface Props {
|
|
9
8
|
header: MRT_Header;
|
|
10
|
-
|
|
9
|
+
instance: MRT_TableInstance;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export const MRT_TableHeadCellFilterContainer: FC<Props> = ({
|
|
14
13
|
header,
|
|
15
|
-
|
|
14
|
+
instance,
|
|
16
15
|
}) => {
|
|
17
|
-
const { getState } =
|
|
16
|
+
const { getState } = instance;
|
|
18
17
|
|
|
19
18
|
const { currentFilterFns, showFilters } = getState();
|
|
20
19
|
|
|
@@ -22,10 +21,10 @@ export const MRT_TableHeadCellFilterContainer: FC<Props> = ({
|
|
|
22
21
|
|
|
23
22
|
return (
|
|
24
23
|
<Collapse in={showFilters} mountOnEnter unmountOnExit>
|
|
25
|
-
{currentFilterFns[column.id] ===
|
|
26
|
-
<MRT_FilterRangeFields header={header}
|
|
24
|
+
{currentFilterFns[column.id] === 'between' ? (
|
|
25
|
+
<MRT_FilterRangeFields header={header} instance={instance} />
|
|
27
26
|
) : (
|
|
28
|
-
<MRT_FilterTextField header={header}
|
|
27
|
+
<MRT_FilterTextField header={header} instance={instance} />
|
|
29
28
|
)}
|
|
30
29
|
</Collapse>
|
|
31
30
|
);
|
|
@@ -4,12 +4,12 @@ import { MRT_Header, MRT_TableInstance } from '..';
|
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
header: MRT_Header;
|
|
7
|
-
|
|
7
|
+
instance: MRT_TableInstance;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const MRT_TableHeadCellFilterLabel: FC<Props> = ({
|
|
11
11
|
header,
|
|
12
|
-
|
|
12
|
+
instance,
|
|
13
13
|
}) => {
|
|
14
14
|
const {
|
|
15
15
|
getState,
|
|
@@ -18,7 +18,7 @@ export const MRT_TableHeadCellFilterLabel: FC<Props> = ({
|
|
|
18
18
|
localization,
|
|
19
19
|
},
|
|
20
20
|
setShowFilters,
|
|
21
|
-
} =
|
|
21
|
+
} = instance;
|
|
22
22
|
|
|
23
23
|
const { showFilters } = getState();
|
|
24
24
|
|
|
@@ -4,14 +4,14 @@ import { MRT_Header, MRT_TableInstance } from '..';
|
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
header: MRT_Header;
|
|
7
|
-
|
|
7
|
+
instance: MRT_TableInstance;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const MRT_TableHeadCellResizeHandle: FC<Props> = ({
|
|
11
11
|
header,
|
|
12
|
-
|
|
12
|
+
instance,
|
|
13
13
|
}) => {
|
|
14
|
-
const { getState } =
|
|
14
|
+
const { getState } = instance;
|
|
15
15
|
|
|
16
16
|
const { showFilters } = getState();
|
|
17
17
|
|
|
@@ -4,16 +4,13 @@ import { MRT_Header, MRT_TableInstance } from '..';
|
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
header: MRT_Header;
|
|
7
|
-
|
|
7
|
+
instance: MRT_TableInstance;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const MRT_TableHeadCellSortLabel: FC<Props> = ({
|
|
11
|
-
header,
|
|
12
|
-
tableInstance,
|
|
13
|
-
}) => {
|
|
10
|
+
export const MRT_TableHeadCellSortLabel: FC<Props> = ({ header, instance }) => {
|
|
14
11
|
const {
|
|
15
12
|
options: { localization },
|
|
16
|
-
} =
|
|
13
|
+
} = instance;
|
|
17
14
|
|
|
18
15
|
const { column } = header;
|
|
19
16
|
|
|
@@ -6,17 +6,17 @@ import type { MRT_Header, MRT_HeaderGroup, MRT_TableInstance } from '..';
|
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
headerGroup: MRT_HeaderGroup;
|
|
9
|
-
|
|
9
|
+
instance: MRT_TableInstance;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const MRT_TableHeadRow: FC<Props> = ({ headerGroup,
|
|
12
|
+
export const MRT_TableHeadRow: FC<Props> = ({ headerGroup, instance }) => {
|
|
13
13
|
const {
|
|
14
14
|
options: { enableColumnOrdering, enableGrouping, muiTableHeadRowProps },
|
|
15
|
-
} =
|
|
15
|
+
} = instance;
|
|
16
16
|
|
|
17
17
|
const tableRowProps =
|
|
18
18
|
muiTableHeadRowProps instanceof Function
|
|
19
|
-
? muiTableHeadRowProps({ headerGroup,
|
|
19
|
+
? muiTableHeadRowProps({ headerGroup, instance })
|
|
20
20
|
: muiTableHeadRowProps;
|
|
21
21
|
|
|
22
22
|
return (
|
|
@@ -33,13 +33,13 @@ export const MRT_TableHeadRow: FC<Props> = ({ headerGroup, tableInstance }) => {
|
|
|
33
33
|
<MRT_DraggableTableHeadCell
|
|
34
34
|
header={header}
|
|
35
35
|
key={header.id || index}
|
|
36
|
-
|
|
36
|
+
instance={instance}
|
|
37
37
|
/>
|
|
38
38
|
) : (
|
|
39
39
|
<MRT_TableHeadCell
|
|
40
40
|
header={header}
|
|
41
41
|
key={header.id || index}
|
|
42
|
-
|
|
42
|
+
instance={instance}
|
|
43
43
|
/>
|
|
44
44
|
),
|
|
45
45
|
)}
|
|
@@ -10,22 +10,22 @@ import type { MRT_Cell, MRT_Row, MRT_TableInstance } from '..';
|
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
cell: MRT_Cell;
|
|
13
|
-
|
|
13
|
+
instance: MRT_TableInstance;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export const MRT_EditCellTextField: FC<Props> = ({ cell,
|
|
16
|
+
export const MRT_EditCellTextField: FC<Props> = ({ cell, instance }) => {
|
|
17
17
|
const {
|
|
18
18
|
getState,
|
|
19
19
|
options: {
|
|
20
20
|
tableId,
|
|
21
21
|
enableEditing,
|
|
22
22
|
muiTableBodyCellEditTextFieldProps,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
onHandleCellEditBlur,
|
|
24
|
+
onHandleCellEditChange,
|
|
25
25
|
},
|
|
26
26
|
setCurrentEditingCell,
|
|
27
27
|
setCurrentEditingRow,
|
|
28
|
-
} =
|
|
28
|
+
} = instance;
|
|
29
29
|
|
|
30
30
|
const [value, setValue] = useState(cell.getValue());
|
|
31
31
|
|
|
@@ -35,8 +35,8 @@ export const MRT_EditCellTextField: FC<Props> = ({ cell, tableInstance }) => {
|
|
|
35
35
|
|
|
36
36
|
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
|
|
37
37
|
setValue(event.target.value);
|
|
38
|
-
columnDef.
|
|
39
|
-
|
|
38
|
+
columnDef.onHandleCellEditChange?.({ event, cell, instance });
|
|
39
|
+
onHandleCellEditChange?.({ event, cell, instance });
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
|
|
@@ -46,20 +46,20 @@ export const MRT_EditCellTextField: FC<Props> = ({ cell, tableInstance }) => {
|
|
|
46
46
|
setCurrentEditingRow({ ...getState().currentEditingRow } as MRT_Row);
|
|
47
47
|
}
|
|
48
48
|
setCurrentEditingCell(null);
|
|
49
|
-
columnDef.
|
|
50
|
-
|
|
49
|
+
columnDef.onHandleCellEditBlur?.({ event, cell, instance });
|
|
50
|
+
onHandleCellEditBlur?.({ event, cell, instance });
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
const mTableBodyCellEditTextFieldProps =
|
|
54
54
|
muiTableBodyCellEditTextFieldProps instanceof Function
|
|
55
|
-
? muiTableBodyCellEditTextFieldProps({ cell,
|
|
55
|
+
? muiTableBodyCellEditTextFieldProps({ cell, instance })
|
|
56
56
|
: muiTableBodyCellEditTextFieldProps;
|
|
57
57
|
|
|
58
58
|
const mcTableBodyCellEditTextFieldProps =
|
|
59
59
|
columnDef.muiTableBodyCellEditTextFieldProps instanceof Function
|
|
60
60
|
? columnDef.muiTableBodyCellEditTextFieldProps({
|
|
61
61
|
cell,
|
|
62
|
-
|
|
62
|
+
instance,
|
|
63
63
|
})
|
|
64
64
|
: columnDef.muiTableBodyCellEditTextFieldProps;
|
|
65
65
|
|
|
@@ -69,7 +69,7 @@ export const MRT_EditCellTextField: FC<Props> = ({ cell, tableInstance }) => {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
if (enableEditing && columnDef.enableEditing !== false && columnDef.Edit) {
|
|
72
|
-
return <>{columnDef.Edit?.({ cell,
|
|
72
|
+
return <>{columnDef.Edit?.({ cell, instance })}</>;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return (
|
|
@@ -5,21 +5,17 @@ import { MRT_Header, MRT_TableInstance } from '..';
|
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
header: MRT_Header;
|
|
8
|
-
|
|
8
|
+
instance: MRT_TableInstance;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const MRT_FilterRangeFields: FC<Props> = ({ header,
|
|
11
|
+
export const MRT_FilterRangeFields: FC<Props> = ({ header, instance }) => {
|
|
12
12
|
const {
|
|
13
13
|
options: { localization },
|
|
14
|
-
} =
|
|
14
|
+
} = instance;
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Box sx={{ display: 'grid', gridTemplateColumns: '6fr auto 5fr' }}>
|
|
18
|
-
<MRT_FilterTextField
|
|
19
|
-
header={header}
|
|
20
|
-
inputIndex={0}
|
|
21
|
-
tableInstance={tableInstance}
|
|
22
|
-
/>
|
|
18
|
+
<MRT_FilterTextField header={header} inputIndex={0} instance={instance} />
|
|
23
19
|
<Box
|
|
24
20
|
sx={{
|
|
25
21
|
width: '100%',
|
|
@@ -29,11 +25,7 @@ export const MRT_FilterRangeFields: FC<Props> = ({ header, tableInstance }) => {
|
|
|
29
25
|
>
|
|
30
26
|
{localization.to}
|
|
31
27
|
</Box>
|
|
32
|
-
<MRT_FilterTextField
|
|
33
|
-
header={header}
|
|
34
|
-
inputIndex={1}
|
|
35
|
-
tableInstance={tableInstance}
|
|
36
|
-
/>
|
|
28
|
+
<MRT_FilterTextField header={header} inputIndex={1} instance={instance} />
|
|
37
29
|
</Box>
|
|
38
30
|
);
|
|
39
31
|
};
|