material-react-table 1.3.8 → 1.3.10

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.
@@ -13,7 +13,7 @@ export declare const MRT_TableRoot: <TData extends Record<string, any> = {}>(pro
13
13
  "mrt-row-select": Partial<MRT_ColumnDef<{}>>;
14
14
  "mrt-row-numbers": Partial<MRT_ColumnDef<{}>>;
15
15
  }> | undefined;
16
- editingMode?: "cell" | "row" | "table" | "modal" | undefined;
16
+ editingMode?: "row" | "cell" | "table" | "modal" | undefined;
17
17
  enableBottomToolbar?: boolean | undefined;
18
18
  enableClickToCopy?: boolean | undefined;
19
19
  enableColumnActions?: boolean | undefined;
@@ -27,8 +27,8 @@ import { MRT_SortingFns } from './sortingFns';
27
27
  /**
28
28
  * Most of this file is just TypeScript types
29
29
  */
30
- export declare type DensityState = 'comfortable' | 'compact' | 'spacious';
31
- declare type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
30
+ export type DensityState = 'comfortable' | 'compact' | 'spacious';
31
+ type LiteralUnion<T extends U, U = string> = T | (U & Record<never, never>);
32
32
  export interface MRT_Localization {
33
33
  actions: string;
34
34
  and: string;
@@ -125,7 +125,7 @@ export interface MRT_RowModel<TData extends Record<string, any> = {}> {
125
125
  [key: string]: MRT_Row<TData>;
126
126
  };
127
127
  }
128
- export declare type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<Table<TData>, 'getAllColumns' | 'getAllFlatColumns' | 'getAllLeafColumns' | 'getCenterLeafColumns' | 'getColumn' | 'getExpandedRowModel' | 'getFlatHeaders' | 'getLeftLeafColumns' | 'getPaginationRowModel' | 'getPreFilteredRowModel' | 'getPrePaginationRowModel' | 'getRightLeafColumns' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'options'> & {
128
+ export type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<Table<TData>, 'getAllColumns' | 'getAllFlatColumns' | 'getAllLeafColumns' | 'getCenterLeafColumns' | 'getColumn' | 'getExpandedRowModel' | 'getFlatHeaders' | 'getLeftLeafColumns' | 'getPaginationRowModel' | 'getPreFilteredRowModel' | 'getPrePaginationRowModel' | 'getRightLeafColumns' | 'getRowModel' | 'getSelectedRowModel' | 'getState' | 'options'> & {
129
129
  getAllColumns: () => MRT_Column<TData>[];
130
130
  getAllFlatColumns: () => MRT_Column<TData>[];
131
131
  getAllLeafColumns: () => MRT_Column<TData>[];
@@ -175,7 +175,7 @@ export declare type MRT_TableInstance<TData extends Record<string, any> = {}> =
175
175
  setShowFilters: Dispatch<SetStateAction<boolean>>;
176
176
  setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
177
177
  };
178
- export declare type MRT_TableState<TData extends Record<string, any> = {}> = TableState & {
178
+ export type MRT_TableState<TData extends Record<string, any> = {}> = TableState & {
179
179
  columnFilterFns: Record<string, MRT_FilterOption>;
180
180
  density: DensityState;
181
181
  draggingColumn: MRT_Column<TData> | null;
@@ -197,7 +197,7 @@ export declare type MRT_TableState<TData extends Record<string, any> = {}> = Tab
197
197
  showProgressBars: boolean;
198
198
  showSkeletons: boolean;
199
199
  };
200
- export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<ColumnDef<TData, unknown>, 'accessorKey' | 'aggregatedCell' | 'aggregationFn' | 'cell' | 'columns' | 'filterFn' | 'footer' | 'header' | 'id' | 'sortingFn'> & {
200
+ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<ColumnDef<TData, unknown>, 'accessorKey' | 'aggregatedCell' | 'aggregationFn' | 'cell' | 'columns' | 'filterFn' | 'footer' | 'header' | 'id' | 'sortingFn'> & {
201
201
  AggregatedCell?: ({ cell, column, row, table, }: {
202
202
  cell: MRT_Cell<TData>;
203
203
  column: MRT_Column<TData>;
@@ -352,47 +352,47 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
352
352
  }) => ReactNode[];
353
353
  sortingFn?: MRT_SortingFn<TData>;
354
354
  };
355
- export declare type MRT_DefinedColumnDef<TData extends Record<string, any> = {}> = Omit<MRT_ColumnDef<TData>, 'id' | 'defaultDisplayColumn'> & {
355
+ export type MRT_DefinedColumnDef<TData extends Record<string, any> = {}> = Omit<MRT_ColumnDef<TData>, 'id' | 'defaultDisplayColumn'> & {
356
356
  defaultDisplayColumn: Partial<MRT_ColumnDef<TData>>;
357
357
  id: string;
358
358
  _filterFn: MRT_FilterOption;
359
359
  };
360
- export declare type MRT_Column<TData extends Record<string, any> = {}> = Omit<Column<TData, unknown>, 'header' | 'footer' | 'columns' | 'columnDef' | 'filterFn'> & {
360
+ export type MRT_Column<TData extends Record<string, any> = {}> = Omit<Column<TData, unknown>, 'header' | 'footer' | 'columns' | 'columnDef' | 'filterFn'> & {
361
361
  columnDef: MRT_DefinedColumnDef<TData>;
362
362
  columns?: MRT_Column<TData>[];
363
363
  filterFn?: MRT_FilterFn<TData>;
364
364
  footer: string;
365
365
  header: string;
366
366
  };
367
- export declare type MRT_Header<TData extends Record<string, any> = {}> = Omit<Header<TData, unknown>, 'column'> & {
367
+ export type MRT_Header<TData extends Record<string, any> = {}> = Omit<Header<TData, unknown>, 'column'> & {
368
368
  column: MRT_Column<TData>;
369
369
  };
370
- export declare type MRT_HeaderGroup<TData extends Record<string, any> = {}> = Omit<HeaderGroup<TData>, 'headers'> & {
370
+ export type MRT_HeaderGroup<TData extends Record<string, any> = {}> = Omit<HeaderGroup<TData>, 'headers'> & {
371
371
  headers: MRT_Header<TData>[];
372
372
  };
373
- export declare type MRT_Row<TData extends Record<string, any> = {}> = Omit<Row<TData>, 'getVisibleCells' | 'getAllCells' | 'subRows' | '_valuesCache'> & {
373
+ export type MRT_Row<TData extends Record<string, any> = {}> = Omit<Row<TData>, 'getVisibleCells' | 'getAllCells' | 'subRows' | '_valuesCache'> & {
374
374
  getAllCells: () => MRT_Cell<TData>[];
375
375
  getVisibleCells: () => MRT_Cell<TData>[];
376
376
  subRows?: MRT_Row<TData>[];
377
377
  _valuesCache: Record<LiteralUnion<string & DeepKeys<TData>>, any>;
378
378
  };
379
- export declare type MRT_Cell<TData extends Record<string, any> = {}> = Omit<Cell<TData, unknown>, 'column' | 'row'> & {
379
+ export type MRT_Cell<TData extends Record<string, any> = {}> = Omit<Cell<TData, unknown>, 'column' | 'row'> & {
380
380
  column: MRT_Column<TData>;
381
381
  row: MRT_Row<TData>;
382
382
  };
383
- export declare type MRT_AggregationOption = string & keyof typeof MRT_AggregationFns;
384
- export declare type MRT_AggregationFn<TData extends Record<string, any> = {}> = AggregationFn<TData> | MRT_AggregationOption;
385
- export declare type MRT_SortingOption = LiteralUnion<string & keyof typeof MRT_SortingFns>;
386
- export declare type MRT_SortingFn<TData extends Record<string, any> = {}> = SortingFn<TData> | MRT_SortingOption;
387
- export declare type MRT_FilterOption = LiteralUnion<string & keyof typeof MRT_FilterFns>;
388
- export declare type MRT_FilterFn<TData extends Record<string, any> = {}> = FilterFn<TData> | MRT_FilterOption;
389
- export declare type MRT_InternalFilterOption = {
383
+ export type MRT_AggregationOption = string & keyof typeof MRT_AggregationFns;
384
+ export type MRT_AggregationFn<TData extends Record<string, any> = {}> = AggregationFn<TData> | MRT_AggregationOption;
385
+ export type MRT_SortingOption = LiteralUnion<string & keyof typeof MRT_SortingFns>;
386
+ export type MRT_SortingFn<TData extends Record<string, any> = {}> = SortingFn<TData> | MRT_SortingOption;
387
+ export type MRT_FilterOption = LiteralUnion<string & keyof typeof MRT_FilterFns>;
388
+ export type MRT_FilterFn<TData extends Record<string, any> = {}> = FilterFn<TData> | MRT_FilterOption;
389
+ export type MRT_InternalFilterOption = {
390
390
  option: string;
391
391
  symbol: string;
392
392
  label: string;
393
393
  divider: boolean;
394
394
  };
395
- export declare type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' | 'mrt-row-expand' | 'mrt-row-numbers' | 'mrt-row-select';
395
+ export type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' | 'mrt-row-expand' | 'mrt-row-numbers' | 'mrt-row-select';
396
396
  /**
397
397
  * `columns` and `data` props are the only required props, but there are over 150 other optional props.
398
398
  *
@@ -402,7 +402,7 @@ export declare type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' |
402
402
  * See the full props list on the official docs site:
403
403
  * @link https://www.material-react-table.com/docs/api/props
404
404
  */
405
- export declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'defaultColumn' | 'enableRowSelection' | 'expandRowsFn' | 'getRowId' | 'globalFilterFn' | 'initialState' | 'onStateChange' | 'state'> & {
405
+ export type MaterialReactTableProps<TData extends Record<string, any> = {}> = Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'defaultColumn' | 'enableRowSelection' | 'expandRowsFn' | 'getRowId' | 'globalFilterFn' | 'initialState' | 'onStateChange' | 'state'> & {
406
406
  columnFilterModeOptions?: (MRT_FilterOption | string)[] | null;
407
407
  /**
408
408
  * The columns to display in the table. `accessorKey`s or `accessorFn`s must match keys in the `data` prop.
@@ -685,7 +685,7 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
685
685
  }) => Partial<VirtualizerOptions<HTMLDivElement>>);
686
686
  virtualizerInstanceRef?: MutableRefObject<Virtualizer | null>;
687
687
  };
688
- export declare type Virtualizer = {
688
+ export type Virtualizer = {
689
689
  virtualItems: VirtualItem[];
690
690
  totalSize: number;
691
691
  scrollToOffset: (index: number, options?: any | undefined) => void;
@@ -0,0 +1,2 @@
1
+ import { MRT_Localization } from '../MaterialReactTable';
2
+ export declare const MRT_Localization_FR: MRT_Localization;
@@ -2304,7 +2304,7 @@ const MRT_TableBodyRow = ({ numRows, row, rowIndex, table, virtualRow, }) => {
2304
2304
  const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row);
2305
2305
 
2306
2306
  const MRT_TableBody = ({ table }) => {
2307
- var _a;
2307
+ var _a, _b;
2308
2308
  const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, localization, manualFiltering, manualSorting, memoMode, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
2309
2309
  const { columnFilters, globalFilter, pagination, sorting } = getState();
2310
2310
  const tableBodyProps = muiTableBodyProps instanceof Function
@@ -2371,12 +2371,12 @@ const MRT_TableBody = ({ table }) => {
2371
2371
  // ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
2372
2372
  // : 0;
2373
2373
  // }
2374
- return (React.createElement(TableBody, Object.assign({}, tableBodyProps), !rows.length ? (React.createElement("tr", null,
2374
+ return (React.createElement(TableBody, Object.assign({}, tableBodyProps), ((_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : !rows.length) ? (React.createElement("tr", null,
2375
2375
  React.createElement("td", { colSpan: table.getVisibleLeafColumns().length },
2376
2376
  React.createElement(Typography, { sx: {
2377
2377
  color: 'text.secondary',
2378
2378
  fontStyle: 'italic',
2379
- maxWidth: `min(100vw, ${(_a = tablePaperRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth}px)`,
2379
+ maxWidth: `min(100vw, ${(_b = tablePaperRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth}px)`,
2380
2380
  py: '2rem',
2381
2381
  textAlign: 'center',
2382
2382
  width: '100%',