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_Cell, MRT_TableInstance } from '..';
3
2
  interface Props<TData extends Record<string, any> = {}> {
4
3
  cell: MRT_Cell<TData>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { MRT_TableInstance } from '..';
3
2
  interface Props<TData extends Record<string, any> = {}> {
4
3
  table: MRT_TableInstance<TData>;
@@ -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;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MRT_Row, MRT_TableInstance } from '..';
3
2
  interface Props<TData extends Record<string, any> = {}> {
4
3
  open: boolean;
@@ -1,8 +1,7 @@
1
- import { FC, RefObject } from 'react';
1
+ import { FC } from 'react';
2
2
  import type { MRT_TableInstance } from '..';
3
3
  interface Props {
4
4
  table: MRT_TableInstance;
5
- tableContainerRef: RefObject<HTMLDivElement>;
6
5
  }
7
6
  export declare const MRT_TableBody: FC<Props>;
8
7
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MRT_Column, MRT_TableInstance } from '..';
3
2
  interface Props<TData extends Record<string, any> = {}> {
4
3
  column: MRT_Column<TData>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MRT_Row, MRT_TableInstance } from '..';
3
2
  interface Props<TData extends Record<string, any> = {}> {
4
3
  row: MRT_Row<TData>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { IconButtonProps } from '@mui/material';
3
2
  import { MRT_TableInstance } from '..';
4
3
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { IconButtonProps } from '@mui/material';
3
2
  import { MRT_TableInstance } from '..';
4
3
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { IconButtonProps } from '@mui/material';
3
2
  import { MRT_TableInstance } from '..';
4
3
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { IconButtonProps } from '@mui/material';
3
2
  import { MRT_TableInstance } from '..';
4
3
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { IconButtonProps } from '@mui/material';
3
2
  import { MRT_TableInstance } from '..';
4
3
  interface Props<TData extends Record<string, any> = {}> extends IconButtonProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { MRT_Cell, MRT_TableInstance } from '..';
3
2
  interface Props<TData extends Record<string, any> = {}> {
4
3
  cell: MRT_Cell<TData>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { MRT_TableInstance } from '..';
3
2
  interface Props<TData extends Record<string, any> = {}> {
4
3
  table: MRT_TableInstance<TData>;
@@ -1075,7 +1075,7 @@ const MRT_TablePagination = ({ table, position }) => {
1075
1075
  enableToolbarInternalActions &&
1076
1076
  !showGlobalFilter
1077
1077
  ? '3.5rem'
1078
- : '-0.25rem', position: 'relative', zIndex: 2 }, ((tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx) instanceof Function
1078
+ : undefined, position: 'relative', zIndex: 2 }, ((tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx) instanceof Function
1079
1079
  ? tablePaginationProps.sx(theme)
1080
1080
  : tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx))) })));
1081
1081
  };
@@ -1505,7 +1505,11 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
1505
1505
  if (textFieldProps.inputRef) {
1506
1506
  textFieldProps.inputRef = inputRef;
1507
1507
  }
1508
- }, sx: (theme) => (Object.assign({ p: 0, minWidth: !filterChipLabel ? '120px' : 'auto', width: '100%', '& .MuiSelect-icon': {
1508
+ }, sx: (theme) => (Object.assign({ p: 0, minWidth: columnDef.filterVariant === 'range'
1509
+ ? '90px'
1510
+ : !filterChipLabel
1511
+ ? '120px'
1512
+ : 'auto', width: '100%', '& .MuiSelect-icon': {
1509
1513
  mr: '1.5rem',
1510
1514
  } }, ((textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.sx) instanceof Function
1511
1515
  ? textFieldProps.sx(theme)
@@ -1696,7 +1700,7 @@ const MRT_TableHeadCell = ({ header, table }) => {
1696
1700
  return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
1697
1701
  };
1698
1702
  const getTotalRight = () => {
1699
- return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 150);
1703
+ return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 180);
1700
1704
  };
1701
1705
  const handleDragEnter = (_e) => {
1702
1706
  if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
@@ -2161,8 +2165,8 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
2161
2165
  renderDetailPanel && !row.getIsGrouped() && (React.createElement(MRT_TableDetailPanel, { row: row, table: table }))));
2162
2166
  };
2163
2167
 
2164
- const MRT_TableBody = ({ table, tableContainerRef }) => {
2165
- const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, } = table;
2168
+ const MRT_TableBody = ({ table }) => {
2169
+ const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef }, } = table;
2166
2170
  const { globalFilter, pagination, sorting } = getState();
2167
2171
  const tableBodyProps = muiTableBodyProps instanceof Function
2168
2172
  ? muiTableBodyProps({ table })
@@ -2303,7 +2307,7 @@ const MRT_TableFooter = ({ table }) => {
2303
2307
  : tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (React.createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
2304
2308
  };
2305
2309
 
2306
- const MRT_Table = ({ tableContainerRef, table }) => {
2310
+ const MRT_Table = ({ table }) => {
2307
2311
  const { getState, options: { enableColumnResizing, enableRowVirtualization, enableStickyHeader, enableTableFooter, enableTableHead, muiTableProps, }, } = table;
2308
2312
  const { isFullScreen } = getState();
2309
2313
  const tableProps = muiTableProps instanceof Function
@@ -2313,7 +2317,7 @@ const MRT_Table = ({ tableContainerRef, table }) => {
2313
2317
  ? tableProps.sx(theme)
2314
2318
  : tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))) }),
2315
2319
  enableTableHead && React.createElement(MRT_TableHead, { table: table }),
2316
- React.createElement(MRT_TableBody, { tableContainerRef: tableContainerRef, table: table }),
2320
+ React.createElement(MRT_TableBody, { table: table }),
2317
2321
  enableTableFooter && React.createElement(MRT_TableFooter, { table: table })));
2318
2322
  };
2319
2323
 
@@ -2348,7 +2352,7 @@ const MRT_TableContainer = ({ table }) => {
2348
2352
  : tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.sx))), style: Object.assign({ maxHeight: isFullScreen
2349
2353
  ? `calc(100vh - ${totalToolbarHeight}px)`
2350
2354
  : undefined }, tableContainerProps === null || tableContainerProps === void 0 ? void 0 : tableContainerProps.style) }),
2351
- React.createElement(MRT_Table, { tableContainerRef: tableContainerRef, table: table })));
2355
+ React.createElement(MRT_Table, { table: table })));
2352
2356
  };
2353
2357
 
2354
2358
  const MRT_TablePaper = ({ table }) => {
@@ -2526,9 +2530,9 @@ const MRT_TableRoot = (props) => {
2526
2530
  props.tableInstanceRef.current = table;
2527
2531
  }
2528
2532
  return (React.createElement(React.Fragment, null,
2529
- React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => setIsFullScreen(false), open: isFullScreen, transitionDuration: 400 },
2533
+ React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
2530
2534
  React.createElement(MRT_TablePaper, { table: table })),
2531
- !isFullScreen && React.createElement(MRT_TablePaper, { table: table }),
2535
+ !table.getState().isFullScreen && React.createElement(MRT_TablePaper, { table: table }),
2532
2536
  editingRow && props.editingMode === 'modal' && (React.createElement(MRT_EditRowModal, { row: editingRow, table: table, open: true }))));
2533
2537
  };
2534
2538