material-react-table 0.5.8 → 0.6.1
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/MaterialReactTable.d.ts +1 -10
- 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_EditActionButtons.d.ts +1 -1
- package/dist/buttons/MRT_ExpandButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleColumnActionMenuButton.d.ts +1 -1
- package/dist/buttons/MRT_ToggleRowActionMenuButton.d.ts +1 -1
- package/dist/enums.d.ts +12 -0
- package/dist/filtersFNs.d.ts +20 -0
- package/dist/footer/MRT_TableFooterCell.d.ts +1 -1
- package/dist/footer/MRT_TableFooterRow.d.ts +1 -1
- package/dist/head/MRT_TableHeadCell.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_FilterTextField.d.ts +1 -1
- package/dist/inputs/MRT_SelectCheckbox.d.ts +1 -1
- package/dist/localization.d.ts +43 -44
- package/dist/material-react-table.cjs.development.js +375 -227
- 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 +367 -221
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_ColumnActionMenu.d.ts +1 -1
- package/dist/menus/MRT_FilterTypeMenu.d.ts +1 -1
- package/dist/menus/MRT_RowActionMenu.d.ts +1 -1
- package/dist/menus/MRT_ShowHideColumnsMenu.d.ts +3 -2
- package/dist/menus/MRT_ShowHideColumnsMenuItems.d.ts +8 -0
- package/dist/useMRT.d.ts +1 -1
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +1 -11
- package/src/body/MRT_TableBody.tsx +1 -1
- package/src/body/MRT_TableBodyCell.tsx +1 -1
- package/src/body/MRT_TableBodyRow.tsx +1 -1
- package/src/body/MRT_TableDetailPanel.tsx +1 -1
- package/src/buttons/MRT_EditActionButtons.tsx +5 -8
- package/src/buttons/MRT_ExpandAllButton.tsx +2 -2
- package/src/buttons/MRT_ExpandButton.tsx +3 -3
- package/src/buttons/MRT_FullScreenToggleButton.tsx +2 -2
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +4 -52
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +4 -3
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -2
- package/src/buttons/MRT_ToggleFiltersButton.tsx +2 -2
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +4 -8
- package/src/buttons/MRT_ToggleSearchButton.tsx +1 -1
- package/src/enums.ts +12 -0
- package/src/filtersFNs.ts +31 -0
- package/src/footer/MRT_TableFooter.tsx +1 -1
- package/src/footer/MRT_TableFooterCell.tsx +1 -1
- package/src/footer/MRT_TableFooterRow.tsx +1 -1
- package/src/head/MRT_TableHead.tsx +1 -1
- package/src/head/MRT_TableHeadCell.tsx +20 -7
- package/src/head/MRT_TableHeadCellActions.tsx +1 -1
- package/src/head/MRT_TableHeadRow.tsx +1 -1
- package/src/inputs/MRT_EditCellTextField.tsx +1 -1
- package/src/inputs/MRT_FilterTextField.tsx +35 -11
- package/src/inputs/MRT_SearchTextField.tsx +3 -3
- package/src/inputs/MRT_SelectCheckbox.tsx +5 -5
- package/src/localization.ts +87 -88
- package/src/menus/MRT_ColumnActionMenu.tsx +60 -15
- package/src/menus/MRT_FilterTypeMenu.tsx +45 -11
- package/src/menus/MRT_RowActionMenu.tsx +2 -2
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +53 -36
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +57 -0
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +3 -3
- package/src/useMRT.tsx +22 -4
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { MRT_ColumnInstance } from '..';
|
|
3
2
|
interface Props {
|
|
4
|
-
|
|
3
|
+
anchorEl: HTMLElement | null;
|
|
4
|
+
isSubMenu?: boolean;
|
|
5
|
+
setAnchorEl: (anchorEl: HTMLElement | null) => void;
|
|
5
6
|
}
|
|
6
7
|
export declare const MRT_ShowHideColumnsMenu: FC<Props>;
|
|
7
8
|
export {};
|
package/dist/useMRT.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren, Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { MRT_FilterType, MRT_Row, MRT_TableInstance } from '.';
|
|
2
|
+
import type { MRT_FilterType, MRT_Row, MRT_TableInstance } from '.';
|
|
3
3
|
import { MRT_Icons } from './icons';
|
|
4
4
|
import { MRT_Localization } from './localization';
|
|
5
5
|
import { MaterialReactTableProps } from './MaterialReactTable';
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.6.1",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "material-react-table",
|
|
5
5
|
"description": "A fully featured Material-UI implementation of react-table, inspired by material-table and the mui DataGrid, written from the ground up in TypeScript.",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
],
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@babel/core": "^7.17.5",
|
|
59
|
-
"@emotion/react": "^11.8.
|
|
59
|
+
"@emotion/react": "^11.8.2",
|
|
60
60
|
"@emotion/styled": "^11.8.1",
|
|
61
61
|
"@etchteam/storybook-addon-status": "^4.2.0",
|
|
62
62
|
"@faker-js/faker": "^6.0.0-beta.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@storybook/addons": "^6.4.19",
|
|
74
74
|
"@storybook/react": "^6.4.19",
|
|
75
75
|
"@types/faker": "^6.6.8",
|
|
76
|
-
"@types/react": "^17.0.
|
|
76
|
+
"@types/react": "^17.0.40",
|
|
77
77
|
"@types/react-dom": "^17.0.13",
|
|
78
78
|
"@types/react-table": "^7.7.9",
|
|
79
79
|
"babel-loader": "^8.2.3",
|
|
@@ -77,6 +77,7 @@ import { MaterialReactTableProvider } from './useMRT';
|
|
|
77
77
|
import { MRT_TableContainer } from './table/MRT_TableContainer';
|
|
78
78
|
import { MRT_Localization, MRT_DefaultLocalization_EN } from './localization';
|
|
79
79
|
import { MRT_Default_Icons, MRT_Icons } from './icons';
|
|
80
|
+
import { MRT_FILTER_TYPE } from './enums';
|
|
80
81
|
|
|
81
82
|
export type MRT_TableOptions<D extends {} = {}> = TableOptions<D> &
|
|
82
83
|
UseExpandedOptions<D> &
|
|
@@ -186,17 +187,6 @@ export type MRT_Cell<D extends {} = {}, _V = any> = Cell<D> &
|
|
|
186
187
|
UseGroupByCellProps<D> &
|
|
187
188
|
UseRowStateCellProps<D> & {};
|
|
188
189
|
|
|
189
|
-
export enum MRT_FILTER_TYPE {
|
|
190
|
-
CONTAINS = 'contains',
|
|
191
|
-
EMPTY = 'empty',
|
|
192
|
-
ENDS_WITH = 'endsWith',
|
|
193
|
-
EQUALS = 'equals',
|
|
194
|
-
FUZZY = 'fuzzy',
|
|
195
|
-
NOT_EMPTY = 'notEmpty',
|
|
196
|
-
NOT_EQUALS = 'notEquals',
|
|
197
|
-
STARTS_WITH = 'startsWith',
|
|
198
|
-
}
|
|
199
|
-
|
|
200
190
|
export type MRT_FilterType = MRT_FILTER_TYPE | Function;
|
|
201
191
|
|
|
202
192
|
export type MRT_TableState<D extends {} = {}> = TableState<D> &
|
|
@@ -2,7 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { TableBody } from '@mui/material';
|
|
3
3
|
import { MRT_TableBodyRow } from './MRT_TableBodyRow';
|
|
4
4
|
import { useMRT } from '../useMRT';
|
|
5
|
-
import { MRT_Row } from '..';
|
|
5
|
+
import type { MRT_Row } from '..';
|
|
6
6
|
|
|
7
7
|
interface Props {}
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import React, { FC, MouseEvent } from 'react';
|
|
|
2
2
|
import { Skeleton, TableCell, TableCellProps } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
4
|
import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
|
|
5
|
-
import { MRT_Cell } from '..';
|
|
5
|
+
import type { MRT_Cell } from '..';
|
|
6
6
|
|
|
7
7
|
export const commonTableBodyCellStyles = (densePadding: boolean) => ({
|
|
8
8
|
p: densePadding ? '0.5rem' : '1rem',
|
|
@@ -9,7 +9,7 @@ import { MRT_TableDetailPanel } from './MRT_TableDetailPanel';
|
|
|
9
9
|
import { MRT_ExpandButton } from '../buttons/MRT_ExpandButton';
|
|
10
10
|
import { MRT_SelectCheckbox } from '../inputs/MRT_SelectCheckbox';
|
|
11
11
|
import { MRT_ToggleRowActionMenuButton } from '../buttons/MRT_ToggleRowActionMenuButton';
|
|
12
|
-
import { MRT_Cell, MRT_Row } from '..';
|
|
12
|
+
import type { MRT_Cell, MRT_Row } from '..';
|
|
13
13
|
|
|
14
14
|
interface Props {
|
|
15
15
|
row: MRT_Row;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { Box, IconButton, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
|
-
import { MRT_Row } from '..';
|
|
4
|
+
import type { MRT_Row } from '..';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
row: MRT_Row;
|
|
@@ -30,17 +30,14 @@ export const MRT_EditActionButtons: FC<Props> = ({ row }) => {
|
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
32
|
<Box sx={{ display: 'flex', gap: '0.75rem' }}>
|
|
33
|
-
<Tooltip arrow title={localization.
|
|
34
|
-
<IconButton
|
|
35
|
-
aria-label={localization.rowActionButtonCancel}
|
|
36
|
-
onClick={handleCancel}
|
|
37
|
-
>
|
|
33
|
+
<Tooltip arrow title={localization.cancel}>
|
|
34
|
+
<IconButton aria-label={localization.cancel} onClick={handleCancel}>
|
|
38
35
|
<CancelIcon />
|
|
39
36
|
</IconButton>
|
|
40
37
|
</Tooltip>
|
|
41
|
-
<Tooltip arrow title={localization.
|
|
38
|
+
<Tooltip arrow title={localization.save}>
|
|
42
39
|
<IconButton
|
|
43
|
-
aria-label={localization.
|
|
40
|
+
aria-label={localization.save}
|
|
44
41
|
color="info"
|
|
45
42
|
onClick={handleSave}
|
|
46
43
|
>
|
|
@@ -20,8 +20,8 @@ export const MRT_ExpandAllButton: FC<Props> = () => {
|
|
|
20
20
|
sx={commonTableBodyButtonCellStyles(tableInstance.state.densePadding)}
|
|
21
21
|
>
|
|
22
22
|
<IconButton
|
|
23
|
-
aria-label={localization.
|
|
24
|
-
title={localization.
|
|
23
|
+
aria-label={localization.expandAll}
|
|
24
|
+
title={localization.expandAll}
|
|
25
25
|
>
|
|
26
26
|
<DoubleArrowDownIcon
|
|
27
27
|
style={{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { IconButton, TableCell } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
|
-
import { MRT_Row } from '..';
|
|
4
|
+
import type { MRT_Row } from '..';
|
|
5
5
|
import { commonTableBodyButtonCellStyles } from '../body/MRT_TableBodyCell';
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
@@ -28,9 +28,9 @@ export const MRT_ExpandButton: FC<Props> = ({ row }) => {
|
|
|
28
28
|
}}
|
|
29
29
|
>
|
|
30
30
|
<IconButton
|
|
31
|
-
aria-label={localization.
|
|
31
|
+
aria-label={localization.expand}
|
|
32
32
|
disabled={!row.canExpand && !renderDetailPanel}
|
|
33
|
-
title={localization.
|
|
33
|
+
title={localization.expand}
|
|
34
34
|
{...row.getToggleRowExpandedProps()}
|
|
35
35
|
>
|
|
36
36
|
<ExpandMoreIcon
|
|
@@ -15,9 +15,9 @@ export const MRT_FullScreenToggleButton: FC<Props> = ({ ...rest }) => {
|
|
|
15
15
|
} = useMRT();
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<Tooltip arrow title={localization.
|
|
18
|
+
<Tooltip arrow title={localization.toggleFullScreen}>
|
|
19
19
|
<IconButton
|
|
20
|
-
aria-label={localization.
|
|
20
|
+
aria-label={localization.showHideFilters}
|
|
21
21
|
onClick={() => setFullScreen(!fullScreen)}
|
|
22
22
|
size="small"
|
|
23
23
|
{...rest}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import React, { FC, MouseEvent, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Button,
|
|
4
|
-
IconButton,
|
|
5
|
-
Menu,
|
|
6
|
-
Tooltip,
|
|
7
|
-
Divider,
|
|
8
|
-
IconButtonProps,
|
|
9
|
-
Box,
|
|
10
|
-
} from '@mui/material';
|
|
2
|
+
import { IconButton, Tooltip, IconButtonProps } from '@mui/material';
|
|
11
3
|
import { useMRT } from '../useMRT';
|
|
12
4
|
import { MRT_ShowHideColumnsMenu } from '../menus/MRT_ShowHideColumnsMenu';
|
|
13
|
-
import { MRT_ColumnInstance } from '..';
|
|
14
5
|
|
|
15
6
|
interface Props extends IconButtonProps {}
|
|
16
7
|
|
|
@@ -18,7 +9,6 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
|
18
9
|
const {
|
|
19
10
|
icons: { ViewColumnIcon },
|
|
20
11
|
localization,
|
|
21
|
-
tableInstance,
|
|
22
12
|
} = useMRT();
|
|
23
13
|
|
|
24
14
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
@@ -29,9 +19,9 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
|
29
19
|
|
|
30
20
|
return (
|
|
31
21
|
<>
|
|
32
|
-
<Tooltip arrow title={localization.
|
|
22
|
+
<Tooltip arrow title={localization.showHideColumns}>
|
|
33
23
|
<IconButton
|
|
34
|
-
aria-label={localization.
|
|
24
|
+
aria-label={localization.showHideColumns}
|
|
35
25
|
onClick={handleClick}
|
|
36
26
|
size="small"
|
|
37
27
|
{...rest}
|
|
@@ -39,45 +29,7 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
|
39
29
|
<ViewColumnIcon />
|
|
40
30
|
</IconButton>
|
|
41
31
|
</Tooltip>
|
|
42
|
-
<
|
|
43
|
-
anchorEl={anchorEl}
|
|
44
|
-
open={!!anchorEl}
|
|
45
|
-
onClose={() => setAnchorEl(null)}
|
|
46
|
-
MenuListProps={{
|
|
47
|
-
dense: tableInstance.state.densePadding,
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
<Box
|
|
51
|
-
sx={{
|
|
52
|
-
display: 'flex',
|
|
53
|
-
justifyContent: 'space-between',
|
|
54
|
-
p: '0.5rem',
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
<Button
|
|
58
|
-
disabled={
|
|
59
|
-
!tableInstance.getToggleHideAllColumnsProps().checked &&
|
|
60
|
-
!tableInstance.getToggleHideAllColumnsProps().indeterminate
|
|
61
|
-
}
|
|
62
|
-
onClick={() => tableInstance.toggleHideAllColumns(true)}
|
|
63
|
-
>
|
|
64
|
-
{localization.columnShowHideMenuHideAll}
|
|
65
|
-
</Button>
|
|
66
|
-
<Button
|
|
67
|
-
disabled={tableInstance.getToggleHideAllColumnsProps().checked}
|
|
68
|
-
onClick={() => tableInstance.toggleHideAllColumns(false)}
|
|
69
|
-
>
|
|
70
|
-
{localization.columnShowHideMenuShowAll}
|
|
71
|
-
</Button>
|
|
72
|
-
</Box>
|
|
73
|
-
<Divider />
|
|
74
|
-
{tableInstance.columns.map((column: MRT_ColumnInstance, index) => (
|
|
75
|
-
<MRT_ShowHideColumnsMenu
|
|
76
|
-
key={`${index}-${column.id}`}
|
|
77
|
-
column={column}
|
|
78
|
-
/>
|
|
79
|
-
))}
|
|
80
|
-
</Menu>
|
|
32
|
+
<MRT_ShowHideColumnsMenu anchorEl={anchorEl} setAnchorEl={setAnchorEl} />
|
|
81
33
|
</>
|
|
82
34
|
);
|
|
83
35
|
};
|
|
@@ -2,7 +2,7 @@ import React, { FC, MouseEvent, useState } from 'react';
|
|
|
2
2
|
import { IconButton, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
4
|
import { MRT_ColumnActionMenu } from '../menus/MRT_ColumnActionMenu';
|
|
5
|
-
import { MRT_HeaderGroup } from '..';
|
|
5
|
+
import type { MRT_HeaderGroup } from '..';
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
column: MRT_HeaderGroup;
|
|
@@ -28,10 +28,11 @@ export const MRT_ToggleColumnActionMenuButton: FC<Props> = ({ column }) => {
|
|
|
28
28
|
arrow
|
|
29
29
|
enterDelay={1000}
|
|
30
30
|
enterNextDelay={1000}
|
|
31
|
-
|
|
31
|
+
placement="top"
|
|
32
|
+
title={localization.columnActions}
|
|
32
33
|
>
|
|
33
34
|
<IconButton
|
|
34
|
-
aria-label={localization.
|
|
35
|
+
aria-label={localization.columnActions}
|
|
35
36
|
onClick={handleClick}
|
|
36
37
|
size="small"
|
|
37
38
|
sx={{
|
|
@@ -15,9 +15,9 @@ export const MRT_ToggleDensePaddingButton: FC<Props> = ({ ...rest }) => {
|
|
|
15
15
|
} = useMRT();
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<Tooltip arrow title={localization.
|
|
18
|
+
<Tooltip arrow title={localization.toggleDensePadding}>
|
|
19
19
|
<IconButton
|
|
20
|
-
aria-label={localization.
|
|
20
|
+
aria-label={localization.toggleDensePadding}
|
|
21
21
|
onClick={() => setDensePadding(!densePadding)}
|
|
22
22
|
size="small"
|
|
23
23
|
{...rest}
|
|
@@ -15,9 +15,9 @@ export const MRT_ToggleFiltersButton: FC<Props> = ({ ...rest }) => {
|
|
|
15
15
|
} = useMRT();
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<Tooltip arrow title={localization.
|
|
18
|
+
<Tooltip arrow title={localization.showHideFilters}>
|
|
19
19
|
<IconButton
|
|
20
|
-
aria-label={localization.
|
|
20
|
+
aria-label={localization.showHideFilters}
|
|
21
21
|
onClick={() => setShowFilters(!showFilters)}
|
|
22
22
|
size="small"
|
|
23
23
|
{...rest}
|
|
@@ -3,7 +3,7 @@ import { IconButton, TableCell, Tooltip } from '@mui/material';
|
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
4
|
import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
|
|
5
5
|
import { MRT_EditActionButtons } from './MRT_EditActionButtons';
|
|
6
|
-
import { MRT_Row } from '..';
|
|
6
|
+
import type { MRT_Row } from '..';
|
|
7
7
|
import { commonTableBodyButtonCellStyles } from '../body/MRT_TableBodyCell';
|
|
8
8
|
|
|
9
9
|
const commonIconButtonStyles = {
|
|
@@ -54,11 +54,7 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
|
54
54
|
) : row.id === tableInstance.state.currentEditingRow?.id ? (
|
|
55
55
|
<MRT_EditActionButtons row={row} />
|
|
56
56
|
) : !renderRowActionMenuItems && enableRowEditing ? (
|
|
57
|
-
<Tooltip
|
|
58
|
-
placement="right"
|
|
59
|
-
arrow
|
|
60
|
-
title={localization.rowActionMenuItemEdit}
|
|
61
|
-
>
|
|
57
|
+
<Tooltip placement="right" arrow title={localization.edit}>
|
|
62
58
|
<IconButton sx={commonIconButtonStyles} onClick={handleEdit}>
|
|
63
59
|
<EditIcon />
|
|
64
60
|
</IconButton>
|
|
@@ -69,10 +65,10 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
|
69
65
|
arrow
|
|
70
66
|
enterDelay={1000}
|
|
71
67
|
enterNextDelay={1000}
|
|
72
|
-
title={localization.
|
|
68
|
+
title={localization.rowActions}
|
|
73
69
|
>
|
|
74
70
|
<IconButton
|
|
75
|
-
aria-label={localization.
|
|
71
|
+
aria-label={localization.rowActions}
|
|
76
72
|
onClick={handleOpenRowActionMenu}
|
|
77
73
|
size="small"
|
|
78
74
|
sx={commonIconButtonStyles}
|
|
@@ -30,7 +30,7 @@ export const MRT_ToggleSearchButton: FC<Props> = ({ ...rest }) => {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<Tooltip arrow title={localization.
|
|
33
|
+
<Tooltip arrow title={localization.showHideSearch}>
|
|
34
34
|
<IconButton size="small" onClick={handleToggleSearch} {...rest}>
|
|
35
35
|
{showSearch ? <SearchOffIcon /> : <SearchIcon />}
|
|
36
36
|
</IconButton>
|
package/src/enums.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export enum MRT_FILTER_TYPE {
|
|
2
|
+
CONTAINS = 'contains',
|
|
3
|
+
EMPTY = 'empty',
|
|
4
|
+
ENDS_WITH = 'endsWith',
|
|
5
|
+
EQUALS = 'equals',
|
|
6
|
+
FUZZY = 'fuzzy',
|
|
7
|
+
GREATER_THAN = 'greaterThan',
|
|
8
|
+
LESS_THAN = 'lessThan',
|
|
9
|
+
NOT_EMPTY = 'notEmpty',
|
|
10
|
+
NOT_EQUALS = 'notEquals',
|
|
11
|
+
STARTS_WITH = 'startsWith',
|
|
12
|
+
}
|
package/src/filtersFNs.ts
CHANGED
|
@@ -96,6 +96,34 @@ export const notEqualsFilterFN = (
|
|
|
96
96
|
|
|
97
97
|
notEqualsFilterFN.autoRemove = (val: any) => !val;
|
|
98
98
|
|
|
99
|
+
export const greaterThanFilterFN = (
|
|
100
|
+
rows: MRT_Row[],
|
|
101
|
+
id: string,
|
|
102
|
+
filterValue: string | number,
|
|
103
|
+
) =>
|
|
104
|
+
rows.filter((row) =>
|
|
105
|
+
!isNaN(+filterValue) && !isNaN(+row.values[id])
|
|
106
|
+
? +row.values[id] > +filterValue
|
|
107
|
+
: row.values[id].toString().toLowerCase().trim() >
|
|
108
|
+
filterValue.toString().toLowerCase().trim(),
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
greaterThanFilterFN.autoRemove = (val: any) => !val;
|
|
112
|
+
|
|
113
|
+
export const lessThanFilterFN = (
|
|
114
|
+
rows: MRT_Row[],
|
|
115
|
+
id: string,
|
|
116
|
+
filterValue: string | number,
|
|
117
|
+
) =>
|
|
118
|
+
rows.filter((row) =>
|
|
119
|
+
!isNaN(+filterValue) && !isNaN(+row.values[id])
|
|
120
|
+
? +row.values[id] < +filterValue
|
|
121
|
+
: row.values[id].toString().toLowerCase().trim() <
|
|
122
|
+
filterValue.toString().toLowerCase().trim(),
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
lessThanFilterFN.autoRemove = (val: any) => !val;
|
|
126
|
+
|
|
99
127
|
export const emptyFilterFN = (
|
|
100
128
|
rows: MRT_Row[],
|
|
101
129
|
id: string,
|
|
@@ -118,6 +146,9 @@ export const defaultFilterFNs = {
|
|
|
118
146
|
endsWith: endsWithFilterFN,
|
|
119
147
|
equals: equalsFilterFN,
|
|
120
148
|
fuzzy: fuzzyFilterFN,
|
|
149
|
+
globalFuzzy: fuzzySearchFN,
|
|
150
|
+
greaterThan: greaterThanFilterFN,
|
|
151
|
+
lessThan: lessThanFilterFN,
|
|
121
152
|
notEmpty: notEmptyFilterFN,
|
|
122
153
|
notEquals: notEqualsFilterFN,
|
|
123
154
|
startsWith: startsWithFilterFN,
|
|
@@ -2,7 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { TableFooter } from '@mui/material';
|
|
3
3
|
import { MRT_TableFooterRow } from './MRT_TableFooterRow';
|
|
4
4
|
import { useMRT } from '../useMRT';
|
|
5
|
-
import { MRT_HeaderGroup } from '..';
|
|
5
|
+
import type { MRT_HeaderGroup } from '..';
|
|
6
6
|
|
|
7
7
|
interface Props {}
|
|
8
8
|
|
|
@@ -3,7 +3,7 @@ import { TableRow } from '@mui/material';
|
|
|
3
3
|
import { MRT_TableFooterCell } from './MRT_TableFooterCell';
|
|
4
4
|
import { MRT_TableSpacerCell } from '../table/MRT_TableSpacerCell';
|
|
5
5
|
import { useMRT } from '../useMRT';
|
|
6
|
-
import { MRT_HeaderGroup } from '..';
|
|
6
|
+
import type { MRT_HeaderGroup } from '..';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
footerGroup: MRT_HeaderGroup;
|
|
@@ -2,7 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { TableHead } from '@mui/material';
|
|
3
3
|
import { MRT_TableHeadRow } from './MRT_TableHeadRow';
|
|
4
4
|
import { useMRT } from '../useMRT';
|
|
5
|
-
import { MRT_HeaderGroup } from '..';
|
|
5
|
+
import type { MRT_HeaderGroup } from '..';
|
|
6
6
|
|
|
7
7
|
interface Props {}
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { useMRT } from '../useMRT';
|
|
12
12
|
import { MRT_FilterTextField } from '../inputs/MRT_FilterTextField';
|
|
13
13
|
import { MRT_ToggleColumnActionMenuButton } from '../buttons/MRT_ToggleColumnActionMenuButton';
|
|
14
|
-
import { MRT_HeaderGroup } from '..';
|
|
14
|
+
import type { MRT_HeaderGroup } from '..';
|
|
15
15
|
|
|
16
16
|
export const commonTableHeadCellStyles = (
|
|
17
17
|
densePadding: boolean,
|
|
@@ -66,21 +66,34 @@ export const MRT_TableHeadCell: FC<Props> = ({ column }) => {
|
|
|
66
66
|
|
|
67
67
|
const sortTooltip = column.isSorted
|
|
68
68
|
? column.isSortedDesc
|
|
69
|
-
? localization.
|
|
70
|
-
: localization.
|
|
69
|
+
? localization.clearSort
|
|
70
|
+
: localization.sortByColumnDesc?.replace(
|
|
71
71
|
'{column}',
|
|
72
72
|
column.Header as string,
|
|
73
73
|
)
|
|
74
|
-
: localization.
|
|
74
|
+
: localization.sortByColumnAsc?.replace(
|
|
75
75
|
'{column}',
|
|
76
76
|
column.Header as string,
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
+
const filterType = tableInstance.state.currentFilterTypes[column.id];
|
|
80
|
+
|
|
79
81
|
const filterTooltip = !!column.filterValue
|
|
80
|
-
? localization.
|
|
82
|
+
? localization.filteringByColumn
|
|
81
83
|
.replace('{column}', String(column.Header))
|
|
82
|
-
.replace(
|
|
83
|
-
|
|
84
|
+
.replace(
|
|
85
|
+
'{filterType}',
|
|
86
|
+
filterType instanceof Function
|
|
87
|
+
? ''
|
|
88
|
+
: // @ts-ignore
|
|
89
|
+
localization[
|
|
90
|
+
`filter${
|
|
91
|
+
filterType.charAt(0).toUpperCase() + filterType.slice(1)
|
|
92
|
+
}`
|
|
93
|
+
],
|
|
94
|
+
)
|
|
95
|
+
.replace('{filterValue}', column.filterValue)
|
|
96
|
+
: localization.showHideFilters;
|
|
84
97
|
|
|
85
98
|
const columnHeader = column.render('Header') as string;
|
|
86
99
|
|
|
@@ -18,7 +18,7 @@ export const MRT_TableHeadCellActions: FC<Props> = () => {
|
|
|
18
18
|
style={{ textAlign: 'center' }}
|
|
19
19
|
sx={{ ...commonTableHeadCellStyles(densePadding), textAlign: 'center' }}
|
|
20
20
|
>
|
|
21
|
-
{localization.
|
|
21
|
+
{localization.actions}
|
|
22
22
|
</TableCell>
|
|
23
23
|
);
|
|
24
24
|
};
|
|
@@ -9,7 +9,7 @@ import { MRT_SelectCheckbox } from '../inputs/MRT_SelectCheckbox';
|
|
|
9
9
|
import { MRT_ExpandAllButton } from '../buttons/MRT_ExpandAllButton';
|
|
10
10
|
import { MRT_TableSpacerCell } from '../table/MRT_TableSpacerCell';
|
|
11
11
|
import { MRT_TableHeadCellActions } from './MRT_TableHeadCellActions';
|
|
12
|
-
import { MRT_HeaderGroup } from '..';
|
|
12
|
+
import type { MRT_HeaderGroup } from '..';
|
|
13
13
|
|
|
14
14
|
interface Props {
|
|
15
15
|
headerGroup: MRT_HeaderGroup;
|