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_Cell, MRT_TableInstance } from '..';
2
3
  interface Props<TData extends Record<string, any> = {}> {
3
4
  cell: MRT_Cell<TData>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { MRT_TableInstance } from '..';
2
3
  interface Props<TData extends Record<string, any> = {}> {
3
4
  table: MRT_TableInstance<TData>;
@@ -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;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { MRT_Row, MRT_TableInstance } from '..';
2
3
  interface Props<TData extends Record<string, any> = {}> {
3
4
  open: boolean;
@@ -4,6 +4,7 @@ interface Props {
4
4
  row: MRT_Row;
5
5
  rowIndex: number;
6
6
  table: MRT_TableInstance;
7
+ virtualRow?: any;
7
8
  }
8
9
  export declare const MRT_TableBodyRow: FC<Props>;
9
10
  export {};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { MRT_Column, MRT_TableInstance } from '..';
2
3
  interface Props<TData extends Record<string, any> = {}> {
3
4
  column: MRT_Column<TData>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { MRT_Row, MRT_TableInstance } from '..';
2
3
  interface Props<TData extends Record<string, any> = {}> {
3
4
  row: MRT_Row<TData>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IconButtonProps } from '@mui/material';
2
3
  import { MRT_TableInstance } from '..';
3
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IconButtonProps } from '@mui/material';
2
3
  import { MRT_TableInstance } from '..';
3
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IconButtonProps } from '@mui/material';
2
3
  import { MRT_TableInstance } from '..';
3
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IconButtonProps } from '@mui/material';
2
3
  import { MRT_TableInstance } from '..';
3
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IconButtonProps } from '@mui/material';
2
3
  import { MRT_TableInstance } from '..';
3
4
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { MRT_Cell, MRT_TableInstance } from '..';
2
3
  interface Props<TData extends Record<string, any> = {}> {
3
4
  cell: MRT_Cell<TData>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { MRT_TableInstance } from '..';
2
3
  interface Props<TData extends Record<string, any> = {}> {
3
4
  table: MRT_TableInstance<TData>;
@@ -1867,11 +1867,11 @@ const MRT_TableBodyRowGrabHandle = ({ cell, rowRef, table, }) => {
1867
1867
  };
1868
1868
 
1869
1869
  const MRT_TableBodyCellValue = ({ cell, table }) => {
1870
- var _a, _b, _c, _d;
1870
+ var _a, _b;
1871
1871
  const { column, row } = cell;
1872
1872
  const { columnDef } = column;
1873
- return (React.createElement(React.Fragment, null, cell.getIsAggregated() && column.columnDef.aggregationFn
1874
- ? (_a = columnDef.AggregatedCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, {
1873
+ return (React.createElement(React.Fragment, null, cell.getIsAggregated() && columnDef.AggregatedCell
1874
+ ? columnDef.AggregatedCell({
1875
1875
  cell,
1876
1876
  column,
1877
1877
  row,
@@ -1879,14 +1879,14 @@ const MRT_TableBodyCellValue = ({ cell, table }) => {
1879
1879
  })
1880
1880
  : row.getIsGrouped() && !cell.getIsGrouped()
1881
1881
  ? null
1882
- : (cell.getIsGrouped() &&
1883
- ((_b = columnDef.GroupedCell) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
1882
+ : cell.getIsGrouped() && columnDef.GroupedCell
1883
+ ? columnDef.GroupedCell({
1884
1884
  cell,
1885
1885
  column,
1886
1886
  row,
1887
1887
  table,
1888
- }))) ||
1889
- ((_d = (_c = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, { cell, column, row, table })) !== null && _d !== void 0 ? _d : cell.renderValue())));
1888
+ })
1889
+ : (_b = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Cell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : cell.renderValue()));
1890
1890
  };
1891
1891
 
1892
1892
  const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
@@ -2042,7 +2042,7 @@ const MRT_TableDetailPanel = ({ row, table }) => {
2042
2042
  : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React.createElement(Collapse, { in: row.getIsExpanded() }, renderDetailPanel({ row, table }))))));
2043
2043
  };
2044
2044
 
2045
- const MRT_TableBodyRow = ({ row, rowIndex, table }) => {
2045
+ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
2046
2046
  var _a, _b;
2047
2047
  const theme = useTheme();
2048
2048
  const { getIsSomeColumnsPinned, getState, options: { enableRowOrdering, muiTableBodyRowProps, renderDetailPanel }, setHoveredRow, } = table;
@@ -2067,7 +2067,12 @@ const MRT_TableBodyRow = ({ row, rowIndex, table }) => {
2067
2067
  }
2068
2068
  : undefined;
2069
2069
  return (React.createElement(React.Fragment, null,
2070
- React.createElement(TableRow, Object.assign({ onDragEnter: handleDragEnter, hover: true, selected: row.getIsSelected(), ref: rowRef }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, transition: 'all 0.2s ease-in-out', '&:hover td': {
2070
+ React.createElement(TableRow, Object.assign({ onDragEnter: handleDragEnter, hover: true, selected: row.getIsSelected(), ref: (node) => {
2071
+ rowRef.current = node;
2072
+ if (virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.measureRef) {
2073
+ virtualRow.measureRef = node;
2074
+ }
2075
+ } }, tableRowProps, { sx: (theme) => (Object.assign(Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, transition: 'all 0.2s ease-in-out', '&:hover td': {
2071
2076
  backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned()
2072
2077
  ? theme.palette.mode === 'dark'
2073
2078
  ? `${lighten(theme.palette.background.default, 0.12)}`
@@ -2147,7 +2152,7 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
2147
2152
  const row = enableRowVirtualization
2148
2153
  ? rows[rowOrVirtualRow.index]
2149
2154
  : rowOrVirtualRow;
2150
- return (React.createElement(MRT_TableBodyRow, { key: row.id, row: row, rowIndex: enableRowVirtualization ? rowOrVirtualRow.index : rowIndex, table: table }));
2155
+ return (React.createElement(MRT_TableBodyRow, { key: row.id, row: row, rowIndex: enableRowVirtualization ? rowOrVirtualRow.index : rowIndex, table: table, virtualRow: enableRowVirtualization ? rowOrVirtualRow : null }));
2151
2156
  }),
2152
2157
  enableRowVirtualization && paddingBottom > 0 && (React.createElement("tr", null,
2153
2158
  React.createElement("td", { style: { height: `${paddingBottom}px` } })))));