material-react-table 0.38.3 → 0.38.4

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 (37) hide show
  1. package/dist/cjs/body/MRT_EditRowModal.d.ts +1 -0
  2. package/dist/cjs/body/MRT_TableBodyRow.d.ts +1 -0
  3. package/dist/cjs/buttons/MRT_ColumnPinningButtons.d.ts +1 -0
  4. package/dist/cjs/buttons/MRT_EditActionButtons.d.ts +1 -0
  5. package/dist/cjs/buttons/MRT_FullScreenToggleButton.d.ts +1 -0
  6. package/dist/cjs/buttons/MRT_ShowHideColumnsButton.d.ts +1 -0
  7. package/dist/cjs/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -0
  8. package/dist/cjs/buttons/MRT_ToggleFiltersButton.d.ts +1 -0
  9. package/dist/cjs/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -0
  10. package/dist/cjs/index.js +15 -10
  11. package/dist/cjs/index.js.map +1 -1
  12. package/dist/cjs/inputs/MRT_EditCellTextField.d.ts +1 -0
  13. package/dist/cjs/inputs/MRT_GlobalFilterTextField.d.ts +1 -0
  14. package/dist/cjs/menus/MRT_FilterOptionMenu.d.ts +1 -0
  15. package/dist/cjs/menus/MRT_ShowHideColumnsMenu.d.ts +1 -0
  16. package/dist/cjs/table/MRT_TableRoot.d.ts +1 -0
  17. package/dist/esm/body/MRT_EditRowModal.d.ts +1 -0
  18. package/dist/esm/body/MRT_TableBodyRow.d.ts +1 -0
  19. package/dist/esm/buttons/MRT_ColumnPinningButtons.d.ts +1 -0
  20. package/dist/esm/buttons/MRT_EditActionButtons.d.ts +1 -0
  21. package/dist/esm/buttons/MRT_FullScreenToggleButton.d.ts +1 -0
  22. package/dist/esm/buttons/MRT_ShowHideColumnsButton.d.ts +1 -0
  23. package/dist/esm/buttons/MRT_ToggleDensePaddingButton.d.ts +1 -0
  24. package/dist/esm/buttons/MRT_ToggleFiltersButton.d.ts +1 -0
  25. package/dist/esm/buttons/MRT_ToggleGlobalFilterButton.d.ts +1 -0
  26. package/dist/esm/inputs/MRT_EditCellTextField.d.ts +1 -0
  27. package/dist/esm/inputs/MRT_GlobalFilterTextField.d.ts +1 -0
  28. package/dist/esm/material-react-table.esm.js +15 -10
  29. package/dist/esm/material-react-table.esm.js.map +1 -1
  30. package/dist/esm/menus/MRT_FilterOptionMenu.d.ts +1 -0
  31. package/dist/esm/menus/MRT_ShowHideColumnsMenu.d.ts +1 -0
  32. package/dist/esm/table/MRT_TableRoot.d.ts +1 -0
  33. package/dist/index.d.ts +1 -0
  34. package/package.json +2 -2
  35. package/src/body/MRT_TableBody.tsx +1 -0
  36. package/src/body/MRT_TableBodyCellValue.tsx +10 -11
  37. package/src/body/MRT_TableBodyRow.tsx +14 -3
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { MRT_Header, MRT_TableInstance } from '..';
2
3
  import { MRT_Localization } from '../localization';
3
4
  export declare const internalFilterOptions: (localization: MRT_Localization) => {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { MRT_TableInstance } from '..';
2
3
  interface Props<TData extends Record<string, any> = {}> {
3
4
  anchorEl: HTMLElement | null;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { MaterialReactTableProps } from '..';
2
3
  export declare const MRT_TableRoot: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { MutableRefObject, Dispatch, SetStateAction, ReactNode, DragEvent } from 'react';
2
3
  import { ButtonProps, TextFieldProps, TableCellProps, IconButtonProps, ToolbarProps, LinearProgressProps, CheckboxProps, SkeletonProps, TableBodyProps, TableRowProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, PaperProps, TableProps, ChipProps, AlertProps } from '@mui/material';
3
4
  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": "0.38.3",
2
+ "version": "0.38.4",
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.",
@@ -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.0",
81
+ "rollup": "^2.78.1",
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",
@@ -124,6 +124,7 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
124
124
  enableRowVirtualization ? rowOrVirtualRow.index : rowIndex
125
125
  }
126
126
  table={table}
127
+ virtualRow={enableRowVirtualization ? rowOrVirtualRow : null}
127
128
  />
128
129
  );
129
130
  },
@@ -12,8 +12,8 @@ export const MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
12
12
 
13
13
  return (
14
14
  <>
15
- {cell.getIsAggregated() && column.columnDef.aggregationFn
16
- ? columnDef.AggregatedCell?.({
15
+ {cell.getIsAggregated() && columnDef.AggregatedCell
16
+ ? columnDef.AggregatedCell({
17
17
  cell,
18
18
  column,
19
19
  row,
@@ -21,15 +21,14 @@ export const MRT_TableBodyCellValue: FC<Props> = ({ cell, table }) => {
21
21
  })
22
22
  : row.getIsGrouped() && !cell.getIsGrouped()
23
23
  ? null
24
- : (cell.getIsGrouped() &&
25
- columnDef.GroupedCell?.({
26
- cell,
27
- column,
28
- row,
29
- table,
30
- })) ||
31
- (columnDef?.Cell?.({ cell, column, row, table }) ??
32
- cell.renderValue())}
24
+ : cell.getIsGrouped() && columnDef.GroupedCell
25
+ ? columnDef.GroupedCell({
26
+ cell,
27
+ column,
28
+ row,
29
+ table,
30
+ })
31
+ : columnDef?.Cell?.({ cell, column, row, table }) ?? cell.renderValue()}
33
32
  </>
34
33
  );
35
34
  };
@@ -8,9 +8,15 @@ interface Props {
8
8
  row: MRT_Row;
9
9
  rowIndex: number;
10
10
  table: MRT_TableInstance;
11
+ virtualRow?: any;
11
12
  }
12
13
 
13
- export const MRT_TableBodyRow: FC<Props> = ({ row, rowIndex, table }) => {
14
+ export const MRT_TableBodyRow: FC<Props> = ({
15
+ row,
16
+ rowIndex,
17
+ table,
18
+ virtualRow,
19
+ }) => {
14
20
  const theme = useTheme();
15
21
  const {
16
22
  getIsSomeColumnsPinned,
@@ -31,7 +37,7 @@ export const MRT_TableBodyRow: FC<Props> = ({ row, rowIndex, table }) => {
31
37
  }
32
38
  };
33
39
 
34
- const rowRef = useRef<HTMLTableRowElement>(null);
40
+ const rowRef = useRef<HTMLTableRowElement | null>(null);
35
41
 
36
42
  const draggingBorder =
37
43
  draggingRow?.id === row.id
@@ -52,7 +58,12 @@ export const MRT_TableBodyRow: FC<Props> = ({ row, rowIndex, table }) => {
52
58
  onDragEnter={handleDragEnter}
53
59
  hover
54
60
  selected={row.getIsSelected()}
55
- ref={rowRef}
61
+ ref={(node) => {
62
+ rowRef.current = node;
63
+ if (virtualRow?.measureRef) {
64
+ virtualRow.measureRef = node;
65
+ }
66
+ }}
56
67
  {...tableRowProps}
57
68
  sx={(theme) => ({
58
69
  backgroundColor: lighten(theme.palette.background.default, 0.06),