material-react-table 1.0.0-beta.1 → 1.0.0-beta.2

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.
Files changed (43) hide show
  1. package/dist/cjs/body/MRT_EditRowModal.d.ts +0 -1
  2. package/dist/cjs/body/MRT_TableBody.d.ts +1 -2
  3. package/dist/cjs/buttons/MRT_ColumnPinningButtons.d.ts +0 -1
  4. package/dist/cjs/buttons/MRT_EditActionButtons.d.ts +0 -1
  5. package/dist/cjs/buttons/MRT_FullScreenToggleButton.d.ts +0 -1
  6. package/dist/cjs/buttons/MRT_ShowHideColumnsButton.d.ts +0 -1
  7. package/dist/cjs/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -1
  8. package/dist/cjs/buttons/MRT_ToggleFiltersButton.d.ts +0 -1
  9. package/dist/cjs/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -1
  10. package/dist/cjs/index.js +14 -10
  11. package/dist/cjs/index.js.map +1 -1
  12. package/dist/cjs/inputs/MRT_EditCellTextField.d.ts +0 -1
  13. package/dist/cjs/inputs/MRT_GlobalFilterTextField.d.ts +0 -1
  14. package/dist/cjs/menus/MRT_FilterOptionMenu.d.ts +0 -1
  15. package/dist/cjs/menus/MRT_ShowHideColumnsMenu.d.ts +0 -1
  16. package/dist/cjs/table/MRT_Table.d.ts +1 -2
  17. package/dist/cjs/table/MRT_TableRoot.d.ts +0 -1
  18. package/dist/esm/body/MRT_EditRowModal.d.ts +0 -1
  19. package/dist/esm/body/MRT_TableBody.d.ts +1 -2
  20. package/dist/esm/buttons/MRT_ColumnPinningButtons.d.ts +0 -1
  21. package/dist/esm/buttons/MRT_EditActionButtons.d.ts +0 -1
  22. package/dist/esm/buttons/MRT_FullScreenToggleButton.d.ts +0 -1
  23. package/dist/esm/buttons/MRT_ShowHideColumnsButton.d.ts +0 -1
  24. package/dist/esm/buttons/MRT_ToggleDensePaddingButton.d.ts +0 -1
  25. package/dist/esm/buttons/MRT_ToggleFiltersButton.d.ts +0 -1
  26. package/dist/esm/buttons/MRT_ToggleGlobalFilterButton.d.ts +0 -1
  27. package/dist/esm/inputs/MRT_EditCellTextField.d.ts +0 -1
  28. package/dist/esm/inputs/MRT_GlobalFilterTextField.d.ts +0 -1
  29. package/dist/esm/material-react-table.esm.js +14 -10
  30. package/dist/esm/material-react-table.esm.js.map +1 -1
  31. package/dist/esm/menus/MRT_FilterOptionMenu.d.ts +0 -1
  32. package/dist/esm/menus/MRT_ShowHideColumnsMenu.d.ts +0 -1
  33. package/dist/esm/table/MRT_Table.d.ts +1 -2
  34. package/dist/esm/table/MRT_TableRoot.d.ts +0 -1
  35. package/dist/index.d.ts +0 -1
  36. package/package.json +6 -6
  37. package/src/body/MRT_TableBody.tsx +3 -3
  38. package/src/head/MRT_TableHeadCell.tsx +1 -1
  39. package/src/inputs/MRT_FilterTextField.tsx +6 -1
  40. package/src/table/MRT_Table.tsx +3 -4
  41. package/src/table/MRT_TableContainer.tsx +2 -11
  42. package/src/table/MRT_TableRoot.tsx +3 -3
  43. package/src/toolbar/MRT_TablePagination.tsx +1 -1
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MRT_Header, MRT_InternalFilterOption, MRT_TableInstance } from '..';
3
2
  import { MRT_Localization } from '../localization';
4
3
  export declare const mrtFilterOptions: (localization: MRT_Localization) => MRT_InternalFilterOption[];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MRT_TableInstance } from '..';
3
2
  interface Props<TData extends Record<string, any> = {}> {
4
3
  anchorEl: HTMLElement | null;
@@ -1,7 +1,6 @@
1
- import { FC, RefObject } from 'react';
1
+ import { FC } from 'react';
2
2
  import { MRT_TableInstance } from '..';
3
3
  interface Props {
4
- tableContainerRef: RefObject<HTMLDivElement>;
5
4
  table: MRT_TableInstance;
6
5
  }
7
6
  export declare const MRT_Table: FC<Props>;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { MaterialReactTableProps } from '..';
3
2
  export declare const MRT_TableRoot: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { MutableRefObject, Dispatch, SetStateAction, ReactNode, DragEvent } from 'react';
3
2
  import { ButtonProps, TextFieldProps, TableCellProps, IconButtonProps, ToolbarProps, LinearProgressProps, CheckboxProps, SkeletonProps, TableBodyProps, TableRowProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, PaperProps, TableProps, ChipProps, AlertProps } from '@mui/material';
4
3
  import { Row, Table, TableState, ColumnDef, DeepKeys, Column, Header, HeaderGroup, Cell, SortingFn, FilterFn, TableOptions, OnChangeFn } from '@tanstack/react-table';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0-beta.1",
2
+ "version": "1.0.0-beta.2",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -51,8 +51,8 @@
51
51
  "devDependencies": {
52
52
  "@babel/core": "^7.18.13",
53
53
  "@babel/preset-react": "^7.18.6",
54
- "@emotion/react": "^11.10.0",
55
- "@emotion/styled": "^11.10.0",
54
+ "@emotion/react": "^11.10.4",
55
+ "@emotion/styled": "^11.10.4",
56
56
  "@faker-js/faker": "^7.5.0",
57
57
  "@mui/icons-material": "^5.10.3",
58
58
  "@mui/material": "^5.10.3",
@@ -68,7 +68,7 @@
68
68
  "@storybook/addon-storysource": "^6.5.10",
69
69
  "@storybook/addons": "^6.5.10",
70
70
  "@storybook/react": "^6.5.10",
71
- "@types/react": "^18.0.17",
71
+ "@types/react": "^18.0.18",
72
72
  "@types/react-dom": "^18.0.6",
73
73
  "babel-loader": "^8.2.5",
74
74
  "eslint": "^8.23.0",
@@ -78,7 +78,7 @@
78
78
  "react": "^18.2.0",
79
79
  "react-dom": "^18.2.0",
80
80
  "react-is": "^18.2.0",
81
- "rollup": "^2.78.1",
81
+ "rollup": "^2.79.0",
82
82
  "rollup-plugin-dts": "^4.2.2",
83
83
  "rollup-plugin-peer-deps-external": "^2.2.4",
84
84
  "size-limit": "^8.0.1",
@@ -95,7 +95,7 @@
95
95
  },
96
96
  "dependencies": {
97
97
  "@tanstack/match-sorter-utils": "8.1.1",
98
- "@tanstack/react-table": "8.5.11",
98
+ "@tanstack/react-table": "8.5.13",
99
99
  "react-virtual": "^2.10.4"
100
100
  }
101
101
  }
@@ -1,4 +1,4 @@
1
- import React, { FC, RefObject, useMemo } from 'react';
1
+ import React, { FC, useMemo } from 'react';
2
2
  import { useVirtual } from 'react-virtual'; //stuck on v2 for now
3
3
  // import { useVirtualizer, Virtualizer } from '@tanstack/react-virtual';
4
4
  import { TableBody } from '@mui/material';
@@ -8,10 +8,9 @@ import type { MRT_Row, MRT_TableInstance } from '..';
8
8
 
9
9
  interface Props {
10
10
  table: MRT_TableInstance;
11
- tableContainerRef: RefObject<HTMLDivElement>;
12
11
  }
13
12
 
14
- export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
13
+ export const MRT_TableBody: FC<Props> = ({ table }) => {
15
14
  const {
16
15
  getRowModel,
17
16
  getPrePaginationRowModel,
@@ -26,6 +25,7 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
26
25
  virtualizerInstanceRef,
27
26
  virtualizerProps,
28
27
  },
28
+ refs: { tableContainerRef },
29
29
  } = table;
30
30
  const { globalFilter, pagination, sorting } = getState();
31
31
 
@@ -67,7 +67,7 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
67
67
 
68
68
  const getTotalRight = () => {
69
69
  return (
70
- (table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150
70
+ (table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 180
71
71
  );
72
72
  };
73
73
 
@@ -313,7 +313,12 @@ export const MRT_FilterTextField: FC<Props> = ({
313
313
  }}
314
314
  sx={(theme) => ({
315
315
  p: 0,
316
- minWidth: !filterChipLabel ? '120px' : 'auto',
316
+ minWidth:
317
+ columnDef.filterVariant === 'range'
318
+ ? '90px'
319
+ : !filterChipLabel
320
+ ? '120px'
321
+ : 'auto',
317
322
  width: '100%',
318
323
  '& .MuiSelect-icon': {
319
324
  mr: '1.5rem',
@@ -1,4 +1,4 @@
1
- import React, { FC, RefObject } from 'react';
1
+ import React, { FC } from 'react';
2
2
  import { Table } from '@mui/material';
3
3
  import { MRT_TableHead } from '../head/MRT_TableHead';
4
4
  import { MRT_TableBody } from '../body/MRT_TableBody';
@@ -6,11 +6,10 @@ import { MRT_TableFooter } from '../footer/MRT_TableFooter';
6
6
  import { MRT_TableInstance } from '..';
7
7
 
8
8
  interface Props {
9
- tableContainerRef: RefObject<HTMLDivElement>;
10
9
  table: MRT_TableInstance;
11
10
  }
12
11
 
13
- export const MRT_Table: FC<Props> = ({ tableContainerRef, table }) => {
12
+ export const MRT_Table: FC<Props> = ({ table }) => {
14
13
  const {
15
14
  getState,
16
15
  options: {
@@ -44,7 +43,7 @@ export const MRT_Table: FC<Props> = ({ tableContainerRef, table }) => {
44
43
  })}
45
44
  >
46
45
  {enableTableHead && <MRT_TableHead table={table} />}
47
- <MRT_TableBody tableContainerRef={tableContainerRef} table={table} />
46
+ <MRT_TableBody table={table} />
48
47
  {enableTableFooter && <MRT_TableFooter table={table} />}
49
48
  </Table>
50
49
  );
@@ -1,10 +1,4 @@
1
- import React, {
2
- FC,
3
- RefObject,
4
- useEffect,
5
- useLayoutEffect,
6
- useState,
7
- } from 'react';
1
+ import React, { FC, useEffect, useLayoutEffect, useState } from 'react';
8
2
  import { TableContainer } from '@mui/material';
9
3
  import { MRT_Table } from './MRT_Table';
10
4
  import type { MRT_TableInstance } from '..';
@@ -77,10 +71,7 @@ export const MRT_TableContainer: FC<Props> = ({ table }) => {
77
71
  ...tableContainerProps?.style,
78
72
  }}
79
73
  >
80
- <MRT_Table
81
- tableContainerRef={tableContainerRef as RefObject<HTMLDivElement>}
82
- table={table}
83
- />
74
+ <MRT_Table table={table} />
84
75
  </TableContainer>
85
76
  );
86
77
  };
@@ -321,13 +321,13 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
321
321
  disablePortal
322
322
  fullScreen
323
323
  keepMounted={false}
324
- onClose={() => setIsFullScreen(false)}
325
- open={isFullScreen}
324
+ onClose={() => table.setIsFullScreen(false)}
325
+ open={table.getState().isFullScreen}
326
326
  transitionDuration={400}
327
327
  >
328
328
  <MRT_TablePaper table={table as any} />
329
329
  </Dialog>
330
- {!isFullScreen && <MRT_TablePaper table={table as any} />}
330
+ {!table.getState().isFullScreen && <MRT_TablePaper table={table as any} />}
331
331
  {editingRow && props.editingMode === 'modal' && (
332
332
  <MRT_EditRowModal row={editingRow as any} table={table} open />
333
333
  )}
@@ -58,7 +58,7 @@ export const MRT_TablePagination: FC<Props> = ({ table, position }) => {
58
58
  enableToolbarInternalActions &&
59
59
  !showGlobalFilter
60
60
  ? '3.5rem'
61
- : '-0.25rem',
61
+ : undefined,
62
62
  position: 'relative',
63
63
  zIndex: 2,
64
64
  ...(tablePaginationProps?.sx instanceof Function