@dooherceg/material-react-table 4.0.4 → 4.1.0

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.
package/dist/index.d.ts CHANGED
@@ -1202,6 +1202,13 @@ interface MRT_TableOptions<TData extends MRT_RowData> extends Omit<Partial<Table
1202
1202
  positionActionsColumn?: 'first' | 'last';
1203
1203
  positionExpandColumn?: 'first' | 'last';
1204
1204
  positionPagination?: 'both' | 'bottom' | 'none' | 'top';
1205
+ /**
1206
+ * Where the loading progress bar is shown.
1207
+ * - `'both'` (default): bottom edge of the top toolbar and top edge of the bottom toolbar.
1208
+ * - `'header'`: a single thin bar on the bottom edge of the column header, shown after a
1209
+ * short delay so fast responses don't flash it.
1210
+ */
1211
+ positionProgressBars?: 'both' | 'bottom' | 'header' | 'none' | 'top';
1205
1212
  positionToolbarAlertBanner?: 'bottom' | 'head-overlay' | 'none' | 'top';
1206
1213
  positionToolbarDropZone?: 'both' | 'bottom' | 'none' | 'top';
1207
1214
  renderBottomToolbar?: ((props: {
@@ -1269,6 +1276,14 @@ interface MRT_TableOptions<TData extends MRT_RowData> extends Omit<Partial<Table
1269
1276
  table: MRT_TableInstance<TData>;
1270
1277
  }) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>) | Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>;
1271
1278
  selectAllMode?: 'all' | 'page';
1279
+ /**
1280
+ * How the body looks while loading with no rows yet (`isLoading`/`showSkeletons`).
1281
+ * - `'cells'` (default): placeholder rows with a MUI Skeleton in every cell.
1282
+ * - `'placeholder'`: lightweight pulsing ghost rows aligned to the real columns (plain
1283
+ * elements, no MRT cell logic), shown after a short delay. No throwaway rows to unmount
1284
+ * when data arrives.
1285
+ */
1286
+ skeletonMode?: 'cells' | 'placeholder';
1272
1287
  /**
1273
1288
  * Manage state externally any way you want, then pass it back into MRT.
1274
1289
  */
@@ -1686,6 +1701,8 @@ declare const Memo_MRT_TableBody: typeof MRT_TableBody;
1686
1701
 
1687
1702
  interface MRT_TableBodyCellProps<TData extends MRT_RowData> extends TableCellProps {
1688
1703
  cell: MRT_Cell<TData>;
1704
+ columnPinningKey?: string;
1705
+ isSkeleton?: boolean;
1689
1706
  numRows?: number;
1690
1707
  rowRef: RefObject<HTMLTableRowElement | null>;
1691
1708
  staticColumnIndex?: number;
@@ -1693,7 +1710,7 @@ interface MRT_TableBodyCellProps<TData extends MRT_RowData> extends TableCellPro
1693
1710
  table: MRT_TableInstance<TData>;
1694
1711
  theme: Theme;
1695
1712
  }
1696
- declare const MRT_TableBodyCell: <TData extends MRT_RowData>({ cell, numRows, rowRef, staticColumnIndex, staticRowIndex, table, theme, ...rest }: MRT_TableBodyCellProps<TData>) => react.JSX.Element;
1713
+ declare const MRT_TableBodyCell: <TData extends MRT_RowData>({ cell, columnPinningKey: _columnPinningKey, isSkeleton: _isSkeleton, numRows, rowRef, staticColumnIndex, staticRowIndex, table, theme, ...rest }: MRT_TableBodyCellProps<TData>) => react.JSX.Element;
1697
1714
  declare const Memo_MRT_TableBodyCell: typeof MRT_TableBodyCell;
1698
1715
 
1699
1716
  interface MRT_TableBodyCellValueProps<TData extends MRT_RowData> {
package/dist/index.esm.js CHANGED
@@ -11,7 +11,7 @@ import Stack from '@mui/material/Stack';
11
11
  import { c } from 'react/compiler-runtime';
12
12
  import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
13
13
  import Tooltip from '@mui/material/Tooltip';
14
- import { darken, lighten, alpha, useTheme } from '@mui/material/styles';
14
+ import { keyframes, darken, lighten, alpha, useTheme } from '@mui/material/styles';
15
15
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
16
16
  import EditNoteIcon from '@mui/icons-material/EditNote';
17
17
  import FileDownloadIcon from '@mui/icons-material/FileDownload';
@@ -488,6 +488,12 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
488
488
  [getColumnId(col)]: ''
489
489
  }))), rowIndex, depth, subRows, parentId);
490
490
 
491
+ // Loading indicators fade in after a short delay
492
+ // (`animation: ${mrtDelayedFadeIn}`), so fast responses don't flash them.
493
+ const mrtDelayedFadeIn = `${keyframes`
494
+ from { opacity: 0; }
495
+ to { opacity: 1; }
496
+ `} 150ms ease-out 200ms both`;
491
497
  const parseCSSVarId = id => id.replace(/[^a-zA-Z0-9]/g, '_');
492
498
  const getMRTTheme = (mrtTheme, muiTheme) => {
493
499
  const mrtThemeOverrides = parseFromValuesOrFunc(mrtTheme, muiTheme);
@@ -4017,6 +4023,7 @@ const useMRT_TableOptions = ({
4017
4023
  positionActionsColumn = 'first',
4018
4024
  positionExpandColumn = 'first',
4019
4025
  positionPagination = 'bottom',
4026
+ positionProgressBars = 'both',
4020
4027
  positionToolbarAlertBanner = 'top',
4021
4028
  positionToolbarDropZone = 'top',
4022
4029
  rowNumberDisplayMode = 'static',
@@ -4153,6 +4160,7 @@ const useMRT_TableOptions = ({
4153
4160
  positionActionsColumn,
4154
4161
  positionExpandColumn,
4155
4162
  positionPagination,
4163
+ positionProgressBars,
4156
4164
  positionToolbarAlertBanner,
4157
4165
  positionToolbarDropZone,
4158
4166
  rowNumberDisplayMode,
@@ -4567,9 +4575,9 @@ const useMRT_TableInstance = definedTableOptions => {
4567
4575
  // pageSize changes while skeletons are already showing, the skeleton row
4568
4576
  // *count* stays as-is until loading toggles again — cosmetic only, no data
4569
4577
  // is affected.
4570
- statefulTableOptions.data = useMemo(() => (statefulTableOptions.state.isLoading || statefulTableOptions.state.showSkeletons) && !rows.length ? [...Array(Math.min(statefulTableOptions.state.pagination.pageSize, 20)).fill(null)].map(() => Object.assign({}, ...getAllLeafColumnDefs(statefulTableOptions.columns).map(col => ({
4578
+ statefulTableOptions.data = useMemo(() => statefulTableOptions.skeletonMode !== 'placeholder' && (statefulTableOptions.state.isLoading || statefulTableOptions.state.showSkeletons) && !rows.length ? [...Array(Math.min(statefulTableOptions.state.pagination.pageSize, 20)).fill(null)].map(() => Object.assign({}, ...getAllLeafColumnDefs(statefulTableOptions.columns).map(col => ({
4571
4579
  [getColumnId(col)]: null
4572
- })))) : rows, [rows, statefulTableOptions.columns, statefulTableOptions.state.isLoading, statefulTableOptions.state.showSkeletons]);
4580
+ })))) : rows, [rows, statefulTableOptions.columns, statefulTableOptions.state.isLoading, statefulTableOptions.state.showSkeletons, statefulTableOptions.skeletonMode]);
4573
4581
  const table = useTable({
4574
4582
  features: MRT_tableFeatures,
4575
4583
  // Only wire our atom in for a slice when the consumer hasn't taken over
@@ -11297,6 +11305,7 @@ const MRT_BottomToolbar = ({
11297
11305
  enableRowSelection,
11298
11306
  muiBottomToolbarProps,
11299
11307
  positionPagination,
11308
+ positionProgressBars,
11300
11309
  positionToolbarDropZone,
11301
11310
  renderBottomToolbarCustomActions
11302
11311
  },
@@ -11333,7 +11342,7 @@ const MRT_BottomToolbar = ({
11333
11342
  right: 0,
11334
11343
  ...parseFromValuesOrFunc(toolbarProps?.sx, theme)
11335
11344
  }),
11336
- children: [/*#__PURE__*/jsx(MRT_LinearProgressBar, {
11345
+ children: [['both', 'bottom'].includes(positionProgressBars ?? '') && /*#__PURE__*/jsx(MRT_LinearProgressBar, {
11337
11346
  isTopToolbar: false,
11338
11347
  table: table
11339
11348
  }), ['both', 'bottom'].includes(positionToolbarDropZone ?? '') && /*#__PURE__*/jsx(MRT_ToolbarDropZone, {
@@ -13404,6 +13413,7 @@ const MRT_TopToolbar = ({
13404
13413
  enableToolbarInternalActions,
13405
13414
  muiTopToolbarProps,
13406
13415
  positionPagination,
13416
+ positionProgressBars,
13407
13417
  positionToolbarDropZone,
13408
13418
  renderTopToolbarCustomActions
13409
13419
  },
@@ -13477,7 +13487,7 @@ const MRT_TopToolbar = ({
13477
13487
  }), enablePagination && ['both', 'top'].includes(positionPagination ?? '') && /*#__PURE__*/jsx(MRT_TablePagination, {
13478
13488
  position: "top",
13479
13489
  table: table
13480
- }), /*#__PURE__*/jsx(MRT_LinearProgressBar, {
13490
+ }), ['both', 'top'].includes(positionProgressBars ?? '') && /*#__PURE__*/jsx(MRT_LinearProgressBar, {
13481
13491
  isTopToolbar: true,
13482
13492
  table: table
13483
13493
  })]
@@ -13650,6 +13660,93 @@ const MRT_CellActionMenu = ({
13650
13660
  });
13651
13661
  };
13652
13662
 
13663
+ const PLACEHOLDER_ROW_COUNT = 8;
13664
+ // bar length per cell (% of the cell), picked deterministically so the ghost
13665
+ // rows look like varied content rather than a uniform grid
13666
+ const BAR_WIDTHS = [72, 48, 85, 60, 40, 66, 78, 54, 82, 45];
13667
+
13668
+ // animates the row's own opacity around its fade-to-bottom level (--mrt-ghost-o)
13669
+ const pulse = keyframes`
13670
+ 0%, 100% { opacity: var(--mrt-ghost-o); }
13671
+ 50% { opacity: calc(var(--mrt-ghost-o) * 0.45); }
13672
+ `;
13673
+ // skeletonMode: 'placeholder'. Ghost rows instead of a MUI Skeleton in every
13674
+ // cell: plain <td><span> per visible column (no MRT cell logic, hooks or store
13675
+ // subscriptions), sized with the same --col-* CSS vars as real cells, so the
13676
+ // layout doesn't shift when data arrives. Styles live on the row's sx via
13677
+ // descendant selectors (one emotion class shared by all rows), and only the
13678
+ // rows' opacity animates.
13679
+ const MRT_TableBodyLoadingPlaceholder = ({
13680
+ columns,
13681
+ density,
13682
+ layoutMode
13683
+ }) => {
13684
+ const rowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
13685
+ const isGridLayout = layoutMode?.startsWith('grid');
13686
+ const cells = columns.map((column, columnIndex) => {
13687
+ const sizeVar = `var(--col-${parseCSSVarId(column.id)}-size)`;
13688
+ const {
13689
+ columnDefType,
13690
+ grow,
13691
+ minSize
13692
+ } = column.columnDef;
13693
+ return {
13694
+ columnIndex,
13695
+ id: column.id,
13696
+ isDisplay: columnDefType === 'display',
13697
+ style: {
13698
+ flex: layoutMode === 'grid' ? `${[0, false].includes(grow) ? 0 : sizeVar} 0 auto` : layoutMode === 'grid-no-grow' ? `${+(grow || 0)} 0 auto` : undefined,
13699
+ minWidth: `max(calc(${sizeVar} * 1px), ${minSize ?? 30}px)`,
13700
+ width: `calc(${sizeVar} * 1px)`
13701
+ }
13702
+ };
13703
+ });
13704
+ return Array.from({
13705
+ length: PLACEHOLDER_ROW_COUNT
13706
+ }, (_, rowIndex) => /*#__PURE__*/jsx(Box, {
13707
+ "aria-hidden": true,
13708
+ component: "tr",
13709
+ style: {
13710
+ '--mrt-ghost-o': 1 - rowIndex / PLACEHOLDER_ROW_COUNT * 0.85,
13711
+ animationDelay: `${rowIndex * 90}ms`
13712
+ },
13713
+ sx: theme => ({
13714
+ animation: `${pulse} 1.6s ease-in-out infinite`,
13715
+ display: isGridLayout ? 'flex' : undefined,
13716
+ height: rowHeight,
13717
+ opacity: 'var(--mrt-ghost-o)',
13718
+ width: '100%',
13719
+ '& > td': {
13720
+ alignItems: isGridLayout ? 'center' : undefined,
13721
+ borderBottom: `1px solid ${theme.palette.divider}`,
13722
+ boxSizing: 'border-box',
13723
+ display: isGridLayout ? 'flex' : undefined,
13724
+ overflow: 'hidden',
13725
+ p: 'var(--mrt-cell-p)'
13726
+ },
13727
+ '& > td > span': {
13728
+ backgroundColor: alpha(theme.palette.text.primary, 0.1),
13729
+ borderRadius: 999,
13730
+ display: 'block',
13731
+ height: 10
13732
+ }
13733
+ }),
13734
+ children: cells.map(({
13735
+ columnIndex,
13736
+ id,
13737
+ isDisplay,
13738
+ style
13739
+ }) => /*#__PURE__*/jsx("td", {
13740
+ style: style,
13741
+ children: !isDisplay && /*#__PURE__*/jsx("span", {
13742
+ style: {
13743
+ width: `${BAR_WIDTHS[(columnIndex * 3 + rowIndex * 7) % BAR_WIDTHS.length]}%`
13744
+ }
13745
+ })
13746
+ }, id))
13747
+ }, rowIndex));
13748
+ };
13749
+
13653
13750
  const MRT_DisplayColumnCellRenderer = t0 => {
13654
13751
  const $ = c(12);
13655
13752
  const {
@@ -13757,6 +13854,8 @@ const MRT_TableBodyCellValue = ({
13757
13854
 
13758
13855
  const MRT_TableBodyCell = ({
13759
13856
  cell,
13857
+ columnPinningKey: _columnPinningKey,
13858
+ isSkeleton: _isSkeleton,
13760
13859
  numRows,
13761
13860
  rowRef,
13762
13861
  staticColumnIndex,
@@ -13813,7 +13912,12 @@ const MRT_TableBodyCell = ({
13813
13912
  draggingRow: state.draggingRow,
13814
13913
  hoveredColumn: state.hoveredColumn,
13815
13914
  hoveredRow: state.hoveredRow
13816
- }));
13915
+ }),
13916
+ // The selector returns a new object every time; the default `===` compare would
13917
+ // re-render every cell on any store update (e.g. a filter change), bypassing memo.
13918
+ {
13919
+ compare: shallowEqual
13920
+ });
13817
13921
  const isResizingThisColumn = columnResizing.isResizingColumn === column.id;
13818
13922
  const isActionCell = actionCell?.id === cell.id;
13819
13923
  const isDraggingColumn = draggingColumn?.id === column.id;
@@ -13898,6 +14002,7 @@ const MRT_TableBodyCell = ({
13898
14002
  align: theme.direction === 'rtl' ? 'right' : 'left',
13899
14003
  "data-index": staticColumnIndex,
13900
14004
  "data-pinned": !!isColumnPinned || undefined,
14005
+ "data-testid": `body-cell-${cell.id}`,
13901
14006
  ...tableCellProps,
13902
14007
  onContextMenu: handleContextMenu,
13903
14008
  onDragEnter: handleDragEnter,
@@ -13961,7 +14066,11 @@ const Memo_MRT_TableBodyCell = /*#__PURE__*/memo(MRT_TableBodyCell, (prev, next)
13961
14066
  // without this, a cell whose own reference is stable but whose row moved to/from
13962
14067
  // the last position (e.g. after a filter/sort changed row count) would keep a
13963
14068
  // stale border.
13964
- prev.staticRowIndex === next.staticRowIndex && prev.numRows === next.numRows);
14069
+ prev.staticRowIndex === next.staticRowIndex && prev.numRows === next.numRows &&
14070
+ // data-index for the column virtualizer (column order/visibility changes)
14071
+ prev.staticColumnIndex === next.staticColumnIndex &&
14072
+ // Read outside of `cell`: theme (sx), pinning (sticky offsets) and skeletons
14073
+ prev.theme === next.theme && prev.columnPinningKey === next.columnPinningKey && prev.isSkeleton === next.isSkeleton);
13965
14074
 
13966
14075
  const MRT_TableDetailPanel = t0 => {
13967
14076
  const $ = c(51);
@@ -14219,7 +14328,10 @@ const MRT_TableBodyRow = ({
14219
14328
  }
14220
14329
  } = table;
14221
14330
  const {
14222
- rowPinning
14331
+ columnPinning,
14332
+ isLoading,
14333
+ rowPinning,
14334
+ showSkeletons
14223
14335
  } = getState();
14224
14336
  const {
14225
14337
  density,
@@ -14231,7 +14343,12 @@ const MRT_TableBodyRow = ({
14231
14343
  draggingColumn: state.draggingColumn,
14232
14344
  draggingRow: state.draggingRow,
14233
14345
  hoveredRow: state.hoveredRow
14234
- }));
14346
+ }),
14347
+ // New object per call — compare shallowly so unrelated store updates don't re-render
14348
+ {
14349
+ compare: shallowEqual
14350
+ });
14351
+ const columnPinningKey = `${columnPinning.start?.join() ?? ''}|${columnPinning.end?.join() ?? ''}`;
14235
14352
  const isDraggingRow = draggingRow?.id === row.id;
14236
14353
  const isHoveredRow = hoveredRow?.id === row.id;
14237
14354
  const isAnyDragging = !!draggingColumn || !!draggingRow;
@@ -14341,6 +14458,8 @@ const MRT_TableBodyRow = ({
14341
14458
  }
14342
14459
  const props = {
14343
14460
  cell,
14461
+ columnPinningKey,
14462
+ isSkeleton: showSkeletons !== false && (isLoading || showSkeletons),
14344
14463
  numRows,
14345
14464
  rowRef,
14346
14465
  staticColumnIndex,
@@ -14396,7 +14515,8 @@ const MRT_TableBody = ({
14396
14515
  muiTableBodyProps,
14397
14516
  renderDetailPanel,
14398
14517
  renderEmptyRowsFallback,
14399
- rowPinningDisplayMode
14518
+ rowPinningDisplayMode,
14519
+ skeletonMode
14400
14520
  },
14401
14521
  refs: {
14402
14522
  tableFooterRef,
@@ -14406,8 +14526,11 @@ const MRT_TableBody = ({
14406
14526
  } = table;
14407
14527
  const {
14408
14528
  filters,
14409
- rowPinning
14529
+ isLoading,
14530
+ rowPinning,
14531
+ showSkeletons
14410
14532
  } = getState();
14533
+ const showLoadingPlaceholder = skeletonMode === 'placeholder' && showSkeletons !== false && (isLoading || showSkeletons);
14411
14534
  const density = useSelector(table.store, state => state.density);
14412
14535
 
14413
14536
  //read once per body render instead of once per row/cell, since every
@@ -14476,15 +14599,30 @@ const MRT_TableBody = ({
14476
14599
  }, row_0.id);
14477
14600
  })
14478
14601
  }), /*#__PURE__*/jsx(TableBody, {
14602
+ "data-loading-placeholder": showLoadingPlaceholder && !rows.length ? true : undefined,
14603
+ "data-refetching": isLoading && rows.length ? true : undefined,
14479
14604
  ...tableBodyProps,
14480
14605
  sx: theme_1 => ({
14481
14606
  display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
14607
+ '&[data-loading-placeholder]': {
14608
+ animation: mrtDelayedFadeIn
14609
+ },
14610
+ //refetch with the old rows still shown: dim them (after a short
14611
+ //delay, so fast responses don't flash) instead of re-rendering cells
14612
+ '&[data-refetching]': {
14613
+ opacity: 0.6,
14614
+ transition: 'opacity 150ms ease-out 200ms'
14615
+ },
14482
14616
  height: rowVirtualizer ? `${rowVirtualizer.getTotalSize()}px` : undefined,
14483
14617
  minHeight: !rows.length ? '100px' : undefined,
14484
14618
  position: 'relative',
14485
14619
  ...parseFromValuesOrFunc(tableBodyProps?.sx, theme_1)
14486
14620
  }),
14487
- children: tableBodyProps?.children ?? (!rows.length ? /*#__PURE__*/jsx("tr", {
14621
+ children: tableBodyProps?.children ?? (!rows.length ? showLoadingPlaceholder ? /*#__PURE__*/jsx(MRT_TableBodyLoadingPlaceholder, {
14622
+ columns: table.getVisibleLeafColumns(),
14623
+ density: density,
14624
+ layoutMode: layoutMode
14625
+ }) : /*#__PURE__*/jsx("tr", {
14488
14626
  style: {
14489
14627
  display: layoutMode?.startsWith('grid') ? 'grid' : undefined
14490
14628
  },
@@ -16821,6 +16959,127 @@ const MRT_Table = ({
16821
16959
  });
16822
16960
  };
16823
16961
 
16962
+ // positionProgressBars: 'header'. A zero-height box that sticks to the top-left
16963
+ // of the scroll container (so the bar stays in view while scrolling horizontally,
16964
+ // and vertically too with a sticky header), with the bar placed at the head's
16965
+ // bottom edge. The fade-in delay keeps fast refetches from flashing it.
16966
+ const MRT_TableHeadProgressBar = t0 => {
16967
+ const $ = c(16);
16968
+ const {
16969
+ table
16970
+ } = t0;
16971
+ const {
16972
+ options: t1,
16973
+ refs: t2
16974
+ } = table;
16975
+ const {
16976
+ enableStickyHeader
16977
+ } = t1;
16978
+ const {
16979
+ tableHeadRef
16980
+ } = t2;
16981
+ const [headHeight, setHeadHeight] = useState(0);
16982
+ let t3;
16983
+ let t4;
16984
+ if ($[0] !== tableHeadRef) {
16985
+ t3 = () => {
16986
+ const head = tableHeadRef.current;
16987
+ if (!head) {
16988
+ return;
16989
+ }
16990
+ const observer = new ResizeObserver(() => setHeadHeight(head.offsetHeight));
16991
+ observer.observe(head);
16992
+ return () => observer.disconnect();
16993
+ };
16994
+ t4 = [tableHeadRef];
16995
+ $[0] = tableHeadRef;
16996
+ $[1] = t3;
16997
+ $[2] = t4;
16998
+ } else {
16999
+ t3 = $[1];
17000
+ t4 = $[2];
17001
+ }
17002
+ useEffect(t3, t4);
17003
+ const t5 = enableStickyHeader ? 0 : undefined;
17004
+ let t6;
17005
+ if ($[3] !== t5) {
17006
+ t6 = {
17007
+ flexShrink: 0,
17008
+ height: 0,
17009
+ left: 0,
17010
+ position: "sticky",
17011
+ top: t5,
17012
+ width: "100%",
17013
+ zIndex: 3
17014
+ };
17015
+ $[3] = t5;
17016
+ $[4] = t6;
17017
+ } else {
17018
+ t6 = $[4];
17019
+ }
17020
+ let t7;
17021
+ if ($[5] !== headHeight) {
17022
+ t7 = {
17023
+ left: 0,
17024
+ position: "absolute",
17025
+ right: 0,
17026
+ top: headHeight
17027
+ };
17028
+ $[5] = headHeight;
17029
+ $[6] = t7;
17030
+ } else {
17031
+ t7 = $[6];
17032
+ }
17033
+ let t8;
17034
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
17035
+ t8 = {
17036
+ animation: mrtDelayedFadeIn,
17037
+ height: 2,
17038
+ position: "relative"
17039
+ };
17040
+ $[7] = t8;
17041
+ } else {
17042
+ t8 = $[7];
17043
+ }
17044
+ let t9;
17045
+ if ($[8] !== table) {
17046
+ t9 = /*#__PURE__*/jsx(MRT_LinearProgressBar, {
17047
+ isTopToolbar: false,
17048
+ sx: t8,
17049
+ table: table
17050
+ });
17051
+ $[8] = table;
17052
+ $[9] = t9;
17053
+ } else {
17054
+ t9 = $[9];
17055
+ }
17056
+ let t10;
17057
+ if ($[10] !== t7 || $[11] !== t9) {
17058
+ t10 = /*#__PURE__*/jsx(Box, {
17059
+ sx: t7,
17060
+ children: t9
17061
+ });
17062
+ $[10] = t7;
17063
+ $[11] = t9;
17064
+ $[12] = t10;
17065
+ } else {
17066
+ t10 = $[12];
17067
+ }
17068
+ let t11;
17069
+ if ($[13] !== t10 || $[14] !== t6) {
17070
+ t11 = /*#__PURE__*/jsx(Box, {
17071
+ sx: t6,
17072
+ children: t10
17073
+ });
17074
+ $[13] = t10;
17075
+ $[14] = t6;
17076
+ $[15] = t11;
17077
+ } else {
17078
+ t11 = $[15];
17079
+ }
17080
+ return t11;
17081
+ };
17082
+
16824
17083
  const MRT_TableLoadingOverlay = t0 => {
16825
17084
  const $ = c(20);
16826
17085
  let rest;
@@ -16943,7 +17202,8 @@ const MRT_TableContainer = ({
16943
17202
  options: {
16944
17203
  enableCellActions,
16945
17204
  enableRowVirtualization,
16946
- muiTableContainerProps
17205
+ muiTableContainerProps,
17206
+ positionProgressBars
16947
17207
  },
16948
17208
  refs: {
16949
17209
  resizeIndicatorRef,
@@ -17024,6 +17284,8 @@ const MRT_TableContainer = ({
17024
17284
  width: '2px',
17025
17285
  zIndex: 3
17026
17286
  }
17287
+ }), positionProgressBars === 'header' && /*#__PURE__*/jsx(MRT_TableHeadProgressBar, {
17288
+ table: table
17027
17289
  }), /*#__PURE__*/jsx(MRT_Table, {
17028
17290
  table: table
17029
17291
  }), newEntryModal.open && /*#__PURE__*/jsx(Suspense, {
@@ -17710,6 +17972,10 @@ const MaterialReactServerTableInstanceComponent = ({
17710
17972
  const [pageCount, setPageCount] = useState(undefined);
17711
17973
  const [rowCount, setRowCount] = useState(0);
17712
17974
  const [isLoading, setIsLoading] = useState(false);
17975
+ // Skeletons only until the first data arrives. On later refetches (filter, sort, paging)
17976
+ // the current rows stay visible with a progress bar - swapping every cell to a Skeleton
17977
+ // and back remounts the whole table body twice per refetch.
17978
+ const [hasLoadedOnce, setHasLoadedOnce] = useState(false);
17713
17979
 
17714
17980
  // Filter availableExports by exportPermissions if provided.
17715
17981
  // exportPermissions maps export key → required permission strings.
@@ -17759,7 +18025,8 @@ const MaterialReactServerTableInstanceComponent = ({
17759
18025
  enableRowPinning: false,
17760
18026
  getRowId: originalRow => originalRow.id,
17761
18027
  state: {
17762
- showSkeletons: isLoading,
18028
+ showSkeletons: isLoading && !hasLoadedOnce,
18029
+ showProgressBars: isLoading,
17763
18030
  ...tableState
17764
18031
  },
17765
18032
  enableResetState,
@@ -17794,6 +18061,7 @@ const MaterialReactServerTableInstanceComponent = ({
17794
18061
  hasNextPage
17795
18062
  } = await loadData(tableInstance.getState());
17796
18063
  tableInstance.setRows(newData);
18064
+ setHasLoadedOnce(true);
17797
18065
  if (hasNextPage) {
17798
18066
  setPageCount(-1);
17799
18067
  setRowCount(0);