material-react-table 0.2.0 → 0.3.3
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 +32 -162
- package/dist/MaterialReactTable.d.ts +55 -50
- package/dist/body/MRT_TableBodyRow.d.ts +16 -1
- package/dist/buttons/MRT_EditActionButtons.d.ts +7 -0
- package/dist/buttons/MRT_ToggleFiltersButton.d.ts +4 -0
- package/dist/buttons/MRT_ToggleRowActionMenuButton.d.ts +7 -0
- package/dist/head/MRT_TableHeadCell.d.ts +4 -1
- package/dist/index.d.ts +2 -0
- package/dist/inputs/MRT_DensePaddingSwitch.d.ts +5 -0
- package/dist/inputs/MRT_EditCellTextfield.d.ts +7 -0
- package/dist/material-react-table.cjs.development.js +1659 -440
- 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 +1669 -450
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_RowActionMenu.d.ts +9 -0
- package/dist/{footer → toolbar}/MRT_TablePagination.d.ts +0 -0
- package/dist/toolbar/MRT_ToolbarBottom.d.ts +5 -0
- package/dist/toolbar/MRT_ToolbarButtons.d.ts +5 -0
- package/dist/toolbar/{MRT_Toolbar.d.ts → MRT_ToolbarTop.d.ts} +1 -1
- package/dist/useMaterialReactTable.d.ts +10 -5
- package/dist/utils/localization.d.ts +23 -12
- package/package.json +20 -17
- package/src/@types/faker.d.ts +4 -0
- package/src/@types/react-table-config.d.ts +153 -0
- package/src/MaterialReactTable.tsx +125 -97
- package/src/body/MRT_TableBody.tsx +18 -40
- package/src/body/MRT_TableBodyCell.tsx +53 -9
- package/src/body/MRT_TableBodyRow.tsx +49 -21
- package/src/body/MRT_TableDetailPanel.tsx +50 -15
- package/src/buttons/MRT_EditActionButtons.tsx +55 -0
- package/src/buttons/MRT_ExpandAllButton.tsx +22 -15
- package/src/buttons/MRT_ExpandButton.tsx +30 -18
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +12 -12
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +3 -1
- package/src/buttons/MRT_ToggleFiltersButton.tsx +23 -0
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +65 -0
- package/src/footer/MRT_TableFooter.tsx +4 -19
- package/src/footer/MRT_TableFooterCell.tsx +36 -9
- package/src/footer/MRT_TableFooterRow.tsx +31 -13
- package/src/head/MRT_TableHead.tsx +8 -20
- package/src/head/MRT_TableHeadCell.tsx +73 -30
- package/src/head/MRT_TableHeadRow.tsx +46 -19
- package/src/index.tsx +2 -0
- package/src/inputs/MRT_DensePaddingSwitch.tsx +21 -0
- package/src/inputs/MRT_EditCellTextfield.tsx +57 -0
- package/src/inputs/MRT_FilterTextField.tsx +4 -0
- package/src/inputs/MRT_SearchTextField.tsx +17 -8
- package/src/inputs/MRT_SelectAllCheckbox.tsx +16 -5
- package/src/inputs/MRT_SelectCheckbox.tsx +12 -4
- package/src/menus/MRT_ColumnActionMenu.tsx +37 -12
- package/src/menus/MRT_RowActionMenu.tsx +52 -0
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +2 -2
- package/src/table/MRT_Table.tsx +13 -4
- package/src/table/MRT_TableContainer.tsx +37 -5
- package/src/table/MRT_TableSpacerCell.tsx +17 -1
- package/src/toolbar/MRT_TablePagination.tsx +37 -0
- package/src/toolbar/MRT_ToolbarBottom.tsx +43 -0
- package/src/toolbar/MRT_ToolbarButtons.tsx +27 -0
- package/src/toolbar/MRT_ToolbarTop.tsx +68 -0
- package/src/useMaterialReactTable.tsx +39 -23
- package/src/utils/localization.ts +36 -14
- package/dist/utils/overrideWarnings.d.ts +0 -1
- package/src/footer/MRT_TablePagination.tsx +0 -39
- package/src/toolbar/MRT_Toolbar.tsx +0 -39
- package/src/utils/overrideWarnings.ts +0 -41
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
2
|
-
import { styled, Toolbar as MuiToolbar, Typography } from '@mui/material';
|
|
3
|
-
import { MRT_SearchTextField } from '../inputs/MRT_SearchTextField';
|
|
4
|
-
import { useMaterialReactTable } from '../useMaterialReactTable';
|
|
5
|
-
|
|
6
|
-
const Toolbar = styled(MuiToolbar)({
|
|
7
|
-
padding: '0.5rem',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
justifyContent: 'space-between',
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
interface Props {}
|
|
13
|
-
|
|
14
|
-
export const MRT_Toolbar: FC<Props> = () => {
|
|
15
|
-
const {
|
|
16
|
-
OverrideTableToolbarComponent,
|
|
17
|
-
enableSearch,
|
|
18
|
-
tableInstance,
|
|
19
|
-
tableTitleProps,
|
|
20
|
-
tableToolbarProps,
|
|
21
|
-
title,
|
|
22
|
-
} = useMaterialReactTable();
|
|
23
|
-
|
|
24
|
-
if (OverrideTableToolbarComponent) {
|
|
25
|
-
return <>{OverrideTableToolbarComponent(tableInstance)}</>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//if no features in the toolbar are enabled, don't render anything
|
|
29
|
-
if (!enableSearch && !title && !tableToolbarProps) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Toolbar variant="dense" {...tableToolbarProps}>
|
|
35
|
-
{title ? <Typography {...tableTitleProps}>{title}</Typography> : <span />}
|
|
36
|
-
{enableSearch && <MRT_SearchTextField />}
|
|
37
|
-
</Toolbar>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export const showOverrideWarnings = (props: any) => {
|
|
2
|
-
if (props.OverrideTableBodyCellComponent) {
|
|
3
|
-
showWarning('TableCell', 'props');
|
|
4
|
-
}
|
|
5
|
-
if (props.OverrideTableBodyComponent) {
|
|
6
|
-
showWarning('TableBody', 'tableBodyProps');
|
|
7
|
-
}
|
|
8
|
-
if (props.OverrideTableBodyRowComponent) {
|
|
9
|
-
showWarning('TableRow', 'props');
|
|
10
|
-
}
|
|
11
|
-
if (props.OverrideTableDetailPanelComponent) {
|
|
12
|
-
showWarning('Detail Panel', 'tableDetailPanelProps');
|
|
13
|
-
}
|
|
14
|
-
if (props.OverrideTableFooterComponent) {
|
|
15
|
-
showWarning('TableFooter', 'tableFooterProps');
|
|
16
|
-
}
|
|
17
|
-
if (props.OverrideTableFooterCellComponent) {
|
|
18
|
-
showWarning('TableCell', 'props');
|
|
19
|
-
}
|
|
20
|
-
if (props.OverrideTableFooterRowComponent) {
|
|
21
|
-
showWarning('TableRow', 'props');
|
|
22
|
-
}
|
|
23
|
-
if (props.OverrideTableHeadComponent) {
|
|
24
|
-
showWarning('TableHead', 'tableHeadProps');
|
|
25
|
-
}
|
|
26
|
-
if (props.OverrideTableHeadRowComponent) {
|
|
27
|
-
showWarning('TableRow', 'props');
|
|
28
|
-
}
|
|
29
|
-
if (props.OverrideTablePaginationComponent) {
|
|
30
|
-
showWarning('', 'props');
|
|
31
|
-
}
|
|
32
|
-
if (props.OverrideTableToolbarComponent) {
|
|
33
|
-
showWarning('TableBodyCell', 'props');
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const showWarning = (componentName: string, propsName: string) => {
|
|
38
|
-
console.warn(
|
|
39
|
-
`Caution.\nYou are overriding the built-in Mui ${componentName} Component in material-react-table.\n\nYou should only use this as a last resort!\n\nConsider customizing the Mui ${componentName} Component instead with ${propsName}.`,
|
|
40
|
-
);
|
|
41
|
-
};
|