@dooherceg/material-react-table 4.0.5 → 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 +18 -1
- package/dist/index.esm.js +281 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +280 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -490,6 +490,12 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
|
|
|
490
490
|
[getColumnId(col)]: ''
|
|
491
491
|
}))), rowIndex, depth, subRows, parentId);
|
|
492
492
|
|
|
493
|
+
// Loading indicators fade in after a short delay
|
|
494
|
+
// (`animation: ${mrtDelayedFadeIn}`), so fast responses don't flash them.
|
|
495
|
+
const mrtDelayedFadeIn = `${styles.keyframes`
|
|
496
|
+
from { opacity: 0; }
|
|
497
|
+
to { opacity: 1; }
|
|
498
|
+
`} 150ms ease-out 200ms both`;
|
|
493
499
|
const parseCSSVarId = id => id.replace(/[^a-zA-Z0-9]/g, '_');
|
|
494
500
|
const getMRTTheme = (mrtTheme, muiTheme) => {
|
|
495
501
|
const mrtThemeOverrides = parseFromValuesOrFunc(mrtTheme, muiTheme);
|
|
@@ -4019,6 +4025,7 @@ const useMRT_TableOptions = ({
|
|
|
4019
4025
|
positionActionsColumn = 'first',
|
|
4020
4026
|
positionExpandColumn = 'first',
|
|
4021
4027
|
positionPagination = 'bottom',
|
|
4028
|
+
positionProgressBars = 'both',
|
|
4022
4029
|
positionToolbarAlertBanner = 'top',
|
|
4023
4030
|
positionToolbarDropZone = 'top',
|
|
4024
4031
|
rowNumberDisplayMode = 'static',
|
|
@@ -4155,6 +4162,7 @@ const useMRT_TableOptions = ({
|
|
|
4155
4162
|
positionActionsColumn,
|
|
4156
4163
|
positionExpandColumn,
|
|
4157
4164
|
positionPagination,
|
|
4165
|
+
positionProgressBars,
|
|
4158
4166
|
positionToolbarAlertBanner,
|
|
4159
4167
|
positionToolbarDropZone,
|
|
4160
4168
|
rowNumberDisplayMode,
|
|
@@ -4569,9 +4577,9 @@ const useMRT_TableInstance = definedTableOptions => {
|
|
|
4569
4577
|
// pageSize changes while skeletons are already showing, the skeleton row
|
|
4570
4578
|
// *count* stays as-is until loading toggles again — cosmetic only, no data
|
|
4571
4579
|
// is affected.
|
|
4572
|
-
statefulTableOptions.data = react.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 => ({
|
|
4580
|
+
statefulTableOptions.data = react.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 => ({
|
|
4573
4581
|
[getColumnId(col)]: null
|
|
4574
|
-
})))) : rows, [rows, statefulTableOptions.columns, statefulTableOptions.state.isLoading, statefulTableOptions.state.showSkeletons]);
|
|
4582
|
+
})))) : rows, [rows, statefulTableOptions.columns, statefulTableOptions.state.isLoading, statefulTableOptions.state.showSkeletons, statefulTableOptions.skeletonMode]);
|
|
4575
4583
|
const table = reactTable.useTable({
|
|
4576
4584
|
features: MRT_tableFeatures,
|
|
4577
4585
|
// Only wire our atom in for a slice when the consumer hasn't taken over
|
|
@@ -11299,6 +11307,7 @@ const MRT_BottomToolbar = ({
|
|
|
11299
11307
|
enableRowSelection,
|
|
11300
11308
|
muiBottomToolbarProps,
|
|
11301
11309
|
positionPagination,
|
|
11310
|
+
positionProgressBars,
|
|
11302
11311
|
positionToolbarDropZone,
|
|
11303
11312
|
renderBottomToolbarCustomActions
|
|
11304
11313
|
},
|
|
@@ -11335,7 +11344,7 @@ const MRT_BottomToolbar = ({
|
|
|
11335
11344
|
right: 0,
|
|
11336
11345
|
...parseFromValuesOrFunc(toolbarProps?.sx, theme)
|
|
11337
11346
|
}),
|
|
11338
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(MRT_LinearProgressBar, {
|
|
11347
|
+
children: [['both', 'bottom'].includes(positionProgressBars ?? '') && /*#__PURE__*/jsxRuntime.jsx(MRT_LinearProgressBar, {
|
|
11339
11348
|
isTopToolbar: false,
|
|
11340
11349
|
table: table
|
|
11341
11350
|
}), ['both', 'bottom'].includes(positionToolbarDropZone ?? '') && /*#__PURE__*/jsxRuntime.jsx(MRT_ToolbarDropZone, {
|
|
@@ -13406,6 +13415,7 @@ const MRT_TopToolbar = ({
|
|
|
13406
13415
|
enableToolbarInternalActions,
|
|
13407
13416
|
muiTopToolbarProps,
|
|
13408
13417
|
positionPagination,
|
|
13418
|
+
positionProgressBars,
|
|
13409
13419
|
positionToolbarDropZone,
|
|
13410
13420
|
renderTopToolbarCustomActions
|
|
13411
13421
|
},
|
|
@@ -13479,7 +13489,7 @@ const MRT_TopToolbar = ({
|
|
|
13479
13489
|
}), enablePagination && ['both', 'top'].includes(positionPagination ?? '') && /*#__PURE__*/jsxRuntime.jsx(MRT_TablePagination, {
|
|
13480
13490
|
position: "top",
|
|
13481
13491
|
table: table
|
|
13482
|
-
}), /*#__PURE__*/jsxRuntime.jsx(MRT_LinearProgressBar, {
|
|
13492
|
+
}), ['both', 'top'].includes(positionProgressBars ?? '') && /*#__PURE__*/jsxRuntime.jsx(MRT_LinearProgressBar, {
|
|
13483
13493
|
isTopToolbar: true,
|
|
13484
13494
|
table: table
|
|
13485
13495
|
})]
|
|
@@ -13652,6 +13662,93 @@ const MRT_CellActionMenu = ({
|
|
|
13652
13662
|
});
|
|
13653
13663
|
};
|
|
13654
13664
|
|
|
13665
|
+
const PLACEHOLDER_ROW_COUNT = 8;
|
|
13666
|
+
// bar length per cell (% of the cell), picked deterministically so the ghost
|
|
13667
|
+
// rows look like varied content rather than a uniform grid
|
|
13668
|
+
const BAR_WIDTHS = [72, 48, 85, 60, 40, 66, 78, 54, 82, 45];
|
|
13669
|
+
|
|
13670
|
+
// animates the row's own opacity around its fade-to-bottom level (--mrt-ghost-o)
|
|
13671
|
+
const pulse = styles.keyframes`
|
|
13672
|
+
0%, 100% { opacity: var(--mrt-ghost-o); }
|
|
13673
|
+
50% { opacity: calc(var(--mrt-ghost-o) * 0.45); }
|
|
13674
|
+
`;
|
|
13675
|
+
// skeletonMode: 'placeholder'. Ghost rows instead of a MUI Skeleton in every
|
|
13676
|
+
// cell: plain <td><span> per visible column (no MRT cell logic, hooks or store
|
|
13677
|
+
// subscriptions), sized with the same --col-* CSS vars as real cells, so the
|
|
13678
|
+
// layout doesn't shift when data arrives. Styles live on the row's sx via
|
|
13679
|
+
// descendant selectors (one emotion class shared by all rows), and only the
|
|
13680
|
+
// rows' opacity animates.
|
|
13681
|
+
const MRT_TableBodyLoadingPlaceholder = ({
|
|
13682
|
+
columns,
|
|
13683
|
+
density,
|
|
13684
|
+
layoutMode
|
|
13685
|
+
}) => {
|
|
13686
|
+
const rowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
|
|
13687
|
+
const isGridLayout = layoutMode?.startsWith('grid');
|
|
13688
|
+
const cells = columns.map((column, columnIndex) => {
|
|
13689
|
+
const sizeVar = `var(--col-${parseCSSVarId(column.id)}-size)`;
|
|
13690
|
+
const {
|
|
13691
|
+
columnDefType,
|
|
13692
|
+
grow,
|
|
13693
|
+
minSize
|
|
13694
|
+
} = column.columnDef;
|
|
13695
|
+
return {
|
|
13696
|
+
columnIndex,
|
|
13697
|
+
id: column.id,
|
|
13698
|
+
isDisplay: columnDefType === 'display',
|
|
13699
|
+
style: {
|
|
13700
|
+
flex: layoutMode === 'grid' ? `${[0, false].includes(grow) ? 0 : sizeVar} 0 auto` : layoutMode === 'grid-no-grow' ? `${+(grow || 0)} 0 auto` : undefined,
|
|
13701
|
+
minWidth: `max(calc(${sizeVar} * 1px), ${minSize ?? 30}px)`,
|
|
13702
|
+
width: `calc(${sizeVar} * 1px)`
|
|
13703
|
+
}
|
|
13704
|
+
};
|
|
13705
|
+
});
|
|
13706
|
+
return Array.from({
|
|
13707
|
+
length: PLACEHOLDER_ROW_COUNT
|
|
13708
|
+
}, (_, rowIndex) => /*#__PURE__*/jsxRuntime.jsx(Box, {
|
|
13709
|
+
"aria-hidden": true,
|
|
13710
|
+
component: "tr",
|
|
13711
|
+
style: {
|
|
13712
|
+
'--mrt-ghost-o': 1 - rowIndex / PLACEHOLDER_ROW_COUNT * 0.85,
|
|
13713
|
+
animationDelay: `${rowIndex * 90}ms`
|
|
13714
|
+
},
|
|
13715
|
+
sx: theme => ({
|
|
13716
|
+
animation: `${pulse} 1.6s ease-in-out infinite`,
|
|
13717
|
+
display: isGridLayout ? 'flex' : undefined,
|
|
13718
|
+
height: rowHeight,
|
|
13719
|
+
opacity: 'var(--mrt-ghost-o)',
|
|
13720
|
+
width: '100%',
|
|
13721
|
+
'& > td': {
|
|
13722
|
+
alignItems: isGridLayout ? 'center' : undefined,
|
|
13723
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
13724
|
+
boxSizing: 'border-box',
|
|
13725
|
+
display: isGridLayout ? 'flex' : undefined,
|
|
13726
|
+
overflow: 'hidden',
|
|
13727
|
+
p: 'var(--mrt-cell-p)'
|
|
13728
|
+
},
|
|
13729
|
+
'& > td > span': {
|
|
13730
|
+
backgroundColor: styles.alpha(theme.palette.text.primary, 0.1),
|
|
13731
|
+
borderRadius: 999,
|
|
13732
|
+
display: 'block',
|
|
13733
|
+
height: 10
|
|
13734
|
+
}
|
|
13735
|
+
}),
|
|
13736
|
+
children: cells.map(({
|
|
13737
|
+
columnIndex,
|
|
13738
|
+
id,
|
|
13739
|
+
isDisplay,
|
|
13740
|
+
style
|
|
13741
|
+
}) => /*#__PURE__*/jsxRuntime.jsx("td", {
|
|
13742
|
+
style: style,
|
|
13743
|
+
children: !isDisplay && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
13744
|
+
style: {
|
|
13745
|
+
width: `${BAR_WIDTHS[(columnIndex * 3 + rowIndex * 7) % BAR_WIDTHS.length]}%`
|
|
13746
|
+
}
|
|
13747
|
+
})
|
|
13748
|
+
}, id))
|
|
13749
|
+
}, rowIndex));
|
|
13750
|
+
};
|
|
13751
|
+
|
|
13655
13752
|
const MRT_DisplayColumnCellRenderer = t0 => {
|
|
13656
13753
|
const $ = compilerRuntime.c(12);
|
|
13657
13754
|
const {
|
|
@@ -13759,6 +13856,8 @@ const MRT_TableBodyCellValue = ({
|
|
|
13759
13856
|
|
|
13760
13857
|
const MRT_TableBodyCell = ({
|
|
13761
13858
|
cell,
|
|
13859
|
+
columnPinningKey: _columnPinningKey,
|
|
13860
|
+
isSkeleton: _isSkeleton,
|
|
13762
13861
|
numRows,
|
|
13763
13862
|
rowRef,
|
|
13764
13863
|
staticColumnIndex,
|
|
@@ -13815,7 +13914,12 @@ const MRT_TableBodyCell = ({
|
|
|
13815
13914
|
draggingRow: state.draggingRow,
|
|
13816
13915
|
hoveredColumn: state.hoveredColumn,
|
|
13817
13916
|
hoveredRow: state.hoveredRow
|
|
13818
|
-
})
|
|
13917
|
+
}),
|
|
13918
|
+
// The selector returns a new object every time; the default `===` compare would
|
|
13919
|
+
// re-render every cell on any store update (e.g. a filter change), bypassing memo.
|
|
13920
|
+
{
|
|
13921
|
+
compare: shallowEqual
|
|
13922
|
+
});
|
|
13819
13923
|
const isResizingThisColumn = columnResizing.isResizingColumn === column.id;
|
|
13820
13924
|
const isActionCell = actionCell?.id === cell.id;
|
|
13821
13925
|
const isDraggingColumn = draggingColumn?.id === column.id;
|
|
@@ -13964,7 +14068,11 @@ const Memo_MRT_TableBodyCell = /*#__PURE__*/react.memo(MRT_TableBodyCell, (prev,
|
|
|
13964
14068
|
// without this, a cell whose own reference is stable but whose row moved to/from
|
|
13965
14069
|
// the last position (e.g. after a filter/sort changed row count) would keep a
|
|
13966
14070
|
// stale border.
|
|
13967
|
-
prev.staticRowIndex === next.staticRowIndex && prev.numRows === next.numRows
|
|
14071
|
+
prev.staticRowIndex === next.staticRowIndex && prev.numRows === next.numRows &&
|
|
14072
|
+
// data-index for the column virtualizer (column order/visibility changes)
|
|
14073
|
+
prev.staticColumnIndex === next.staticColumnIndex &&
|
|
14074
|
+
// Read outside of `cell`: theme (sx), pinning (sticky offsets) and skeletons
|
|
14075
|
+
prev.theme === next.theme && prev.columnPinningKey === next.columnPinningKey && prev.isSkeleton === next.isSkeleton);
|
|
13968
14076
|
|
|
13969
14077
|
const MRT_TableDetailPanel = t0 => {
|
|
13970
14078
|
const $ = compilerRuntime.c(51);
|
|
@@ -14222,7 +14330,10 @@ const MRT_TableBodyRow = ({
|
|
|
14222
14330
|
}
|
|
14223
14331
|
} = table;
|
|
14224
14332
|
const {
|
|
14225
|
-
|
|
14333
|
+
columnPinning,
|
|
14334
|
+
isLoading,
|
|
14335
|
+
rowPinning,
|
|
14336
|
+
showSkeletons
|
|
14226
14337
|
} = getState();
|
|
14227
14338
|
const {
|
|
14228
14339
|
density,
|
|
@@ -14234,7 +14345,12 @@ const MRT_TableBodyRow = ({
|
|
|
14234
14345
|
draggingColumn: state.draggingColumn,
|
|
14235
14346
|
draggingRow: state.draggingRow,
|
|
14236
14347
|
hoveredRow: state.hoveredRow
|
|
14237
|
-
})
|
|
14348
|
+
}),
|
|
14349
|
+
// New object per call — compare shallowly so unrelated store updates don't re-render
|
|
14350
|
+
{
|
|
14351
|
+
compare: shallowEqual
|
|
14352
|
+
});
|
|
14353
|
+
const columnPinningKey = `${columnPinning.start?.join() ?? ''}|${columnPinning.end?.join() ?? ''}`;
|
|
14238
14354
|
const isDraggingRow = draggingRow?.id === row.id;
|
|
14239
14355
|
const isHoveredRow = hoveredRow?.id === row.id;
|
|
14240
14356
|
const isAnyDragging = !!draggingColumn || !!draggingRow;
|
|
@@ -14344,6 +14460,8 @@ const MRT_TableBodyRow = ({
|
|
|
14344
14460
|
}
|
|
14345
14461
|
const props = {
|
|
14346
14462
|
cell,
|
|
14463
|
+
columnPinningKey,
|
|
14464
|
+
isSkeleton: showSkeletons !== false && (isLoading || showSkeletons),
|
|
14347
14465
|
numRows,
|
|
14348
14466
|
rowRef,
|
|
14349
14467
|
staticColumnIndex,
|
|
@@ -14399,7 +14517,8 @@ const MRT_TableBody = ({
|
|
|
14399
14517
|
muiTableBodyProps,
|
|
14400
14518
|
renderDetailPanel,
|
|
14401
14519
|
renderEmptyRowsFallback,
|
|
14402
|
-
rowPinningDisplayMode
|
|
14520
|
+
rowPinningDisplayMode,
|
|
14521
|
+
skeletonMode
|
|
14403
14522
|
},
|
|
14404
14523
|
refs: {
|
|
14405
14524
|
tableFooterRef,
|
|
@@ -14409,8 +14528,11 @@ const MRT_TableBody = ({
|
|
|
14409
14528
|
} = table;
|
|
14410
14529
|
const {
|
|
14411
14530
|
filters,
|
|
14412
|
-
|
|
14531
|
+
isLoading,
|
|
14532
|
+
rowPinning,
|
|
14533
|
+
showSkeletons
|
|
14413
14534
|
} = getState();
|
|
14535
|
+
const showLoadingPlaceholder = skeletonMode === 'placeholder' && showSkeletons !== false && (isLoading || showSkeletons);
|
|
14414
14536
|
const density = reactStore.useSelector(table.store, state => state.density);
|
|
14415
14537
|
|
|
14416
14538
|
//read once per body render instead of once per row/cell, since every
|
|
@@ -14479,15 +14601,30 @@ const MRT_TableBody = ({
|
|
|
14479
14601
|
}, row_0.id);
|
|
14480
14602
|
})
|
|
14481
14603
|
}), /*#__PURE__*/jsxRuntime.jsx(TableBody, {
|
|
14604
|
+
"data-loading-placeholder": showLoadingPlaceholder && !rows.length ? true : undefined,
|
|
14605
|
+
"data-refetching": isLoading && rows.length ? true : undefined,
|
|
14482
14606
|
...tableBodyProps,
|
|
14483
14607
|
sx: theme_1 => ({
|
|
14484
14608
|
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
|
14609
|
+
'&[data-loading-placeholder]': {
|
|
14610
|
+
animation: mrtDelayedFadeIn
|
|
14611
|
+
},
|
|
14612
|
+
//refetch with the old rows still shown: dim them (after a short
|
|
14613
|
+
//delay, so fast responses don't flash) instead of re-rendering cells
|
|
14614
|
+
'&[data-refetching]': {
|
|
14615
|
+
opacity: 0.6,
|
|
14616
|
+
transition: 'opacity 150ms ease-out 200ms'
|
|
14617
|
+
},
|
|
14485
14618
|
height: rowVirtualizer ? `${rowVirtualizer.getTotalSize()}px` : undefined,
|
|
14486
14619
|
minHeight: !rows.length ? '100px' : undefined,
|
|
14487
14620
|
position: 'relative',
|
|
14488
14621
|
...parseFromValuesOrFunc(tableBodyProps?.sx, theme_1)
|
|
14489
14622
|
}),
|
|
14490
|
-
children: tableBodyProps?.children ?? (!rows.length ? /*#__PURE__*/jsxRuntime.jsx(
|
|
14623
|
+
children: tableBodyProps?.children ?? (!rows.length ? showLoadingPlaceholder ? /*#__PURE__*/jsxRuntime.jsx(MRT_TableBodyLoadingPlaceholder, {
|
|
14624
|
+
columns: table.getVisibleLeafColumns(),
|
|
14625
|
+
density: density,
|
|
14626
|
+
layoutMode: layoutMode
|
|
14627
|
+
}) : /*#__PURE__*/jsxRuntime.jsx("tr", {
|
|
14491
14628
|
style: {
|
|
14492
14629
|
display: layoutMode?.startsWith('grid') ? 'grid' : undefined
|
|
14493
14630
|
},
|
|
@@ -16824,6 +16961,127 @@ const MRT_Table = ({
|
|
|
16824
16961
|
});
|
|
16825
16962
|
};
|
|
16826
16963
|
|
|
16964
|
+
// positionProgressBars: 'header'. A zero-height box that sticks to the top-left
|
|
16965
|
+
// of the scroll container (so the bar stays in view while scrolling horizontally,
|
|
16966
|
+
// and vertically too with a sticky header), with the bar placed at the head's
|
|
16967
|
+
// bottom edge. The fade-in delay keeps fast refetches from flashing it.
|
|
16968
|
+
const MRT_TableHeadProgressBar = t0 => {
|
|
16969
|
+
const $ = compilerRuntime.c(16);
|
|
16970
|
+
const {
|
|
16971
|
+
table
|
|
16972
|
+
} = t0;
|
|
16973
|
+
const {
|
|
16974
|
+
options: t1,
|
|
16975
|
+
refs: t2
|
|
16976
|
+
} = table;
|
|
16977
|
+
const {
|
|
16978
|
+
enableStickyHeader
|
|
16979
|
+
} = t1;
|
|
16980
|
+
const {
|
|
16981
|
+
tableHeadRef
|
|
16982
|
+
} = t2;
|
|
16983
|
+
const [headHeight, setHeadHeight] = react.useState(0);
|
|
16984
|
+
let t3;
|
|
16985
|
+
let t4;
|
|
16986
|
+
if ($[0] !== tableHeadRef) {
|
|
16987
|
+
t3 = () => {
|
|
16988
|
+
const head = tableHeadRef.current;
|
|
16989
|
+
if (!head) {
|
|
16990
|
+
return;
|
|
16991
|
+
}
|
|
16992
|
+
const observer = new ResizeObserver(() => setHeadHeight(head.offsetHeight));
|
|
16993
|
+
observer.observe(head);
|
|
16994
|
+
return () => observer.disconnect();
|
|
16995
|
+
};
|
|
16996
|
+
t4 = [tableHeadRef];
|
|
16997
|
+
$[0] = tableHeadRef;
|
|
16998
|
+
$[1] = t3;
|
|
16999
|
+
$[2] = t4;
|
|
17000
|
+
} else {
|
|
17001
|
+
t3 = $[1];
|
|
17002
|
+
t4 = $[2];
|
|
17003
|
+
}
|
|
17004
|
+
react.useEffect(t3, t4);
|
|
17005
|
+
const t5 = enableStickyHeader ? 0 : undefined;
|
|
17006
|
+
let t6;
|
|
17007
|
+
if ($[3] !== t5) {
|
|
17008
|
+
t6 = {
|
|
17009
|
+
flexShrink: 0,
|
|
17010
|
+
height: 0,
|
|
17011
|
+
left: 0,
|
|
17012
|
+
position: "sticky",
|
|
17013
|
+
top: t5,
|
|
17014
|
+
width: "100%",
|
|
17015
|
+
zIndex: 3
|
|
17016
|
+
};
|
|
17017
|
+
$[3] = t5;
|
|
17018
|
+
$[4] = t6;
|
|
17019
|
+
} else {
|
|
17020
|
+
t6 = $[4];
|
|
17021
|
+
}
|
|
17022
|
+
let t7;
|
|
17023
|
+
if ($[5] !== headHeight) {
|
|
17024
|
+
t7 = {
|
|
17025
|
+
left: 0,
|
|
17026
|
+
position: "absolute",
|
|
17027
|
+
right: 0,
|
|
17028
|
+
top: headHeight
|
|
17029
|
+
};
|
|
17030
|
+
$[5] = headHeight;
|
|
17031
|
+
$[6] = t7;
|
|
17032
|
+
} else {
|
|
17033
|
+
t7 = $[6];
|
|
17034
|
+
}
|
|
17035
|
+
let t8;
|
|
17036
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
17037
|
+
t8 = {
|
|
17038
|
+
animation: mrtDelayedFadeIn,
|
|
17039
|
+
height: 2,
|
|
17040
|
+
position: "relative"
|
|
17041
|
+
};
|
|
17042
|
+
$[7] = t8;
|
|
17043
|
+
} else {
|
|
17044
|
+
t8 = $[7];
|
|
17045
|
+
}
|
|
17046
|
+
let t9;
|
|
17047
|
+
if ($[8] !== table) {
|
|
17048
|
+
t9 = /*#__PURE__*/jsxRuntime.jsx(MRT_LinearProgressBar, {
|
|
17049
|
+
isTopToolbar: false,
|
|
17050
|
+
sx: t8,
|
|
17051
|
+
table: table
|
|
17052
|
+
});
|
|
17053
|
+
$[8] = table;
|
|
17054
|
+
$[9] = t9;
|
|
17055
|
+
} else {
|
|
17056
|
+
t9 = $[9];
|
|
17057
|
+
}
|
|
17058
|
+
let t10;
|
|
17059
|
+
if ($[10] !== t7 || $[11] !== t9) {
|
|
17060
|
+
t10 = /*#__PURE__*/jsxRuntime.jsx(Box, {
|
|
17061
|
+
sx: t7,
|
|
17062
|
+
children: t9
|
|
17063
|
+
});
|
|
17064
|
+
$[10] = t7;
|
|
17065
|
+
$[11] = t9;
|
|
17066
|
+
$[12] = t10;
|
|
17067
|
+
} else {
|
|
17068
|
+
t10 = $[12];
|
|
17069
|
+
}
|
|
17070
|
+
let t11;
|
|
17071
|
+
if ($[13] !== t10 || $[14] !== t6) {
|
|
17072
|
+
t11 = /*#__PURE__*/jsxRuntime.jsx(Box, {
|
|
17073
|
+
sx: t6,
|
|
17074
|
+
children: t10
|
|
17075
|
+
});
|
|
17076
|
+
$[13] = t10;
|
|
17077
|
+
$[14] = t6;
|
|
17078
|
+
$[15] = t11;
|
|
17079
|
+
} else {
|
|
17080
|
+
t11 = $[15];
|
|
17081
|
+
}
|
|
17082
|
+
return t11;
|
|
17083
|
+
};
|
|
17084
|
+
|
|
16827
17085
|
const MRT_TableLoadingOverlay = t0 => {
|
|
16828
17086
|
const $ = compilerRuntime.c(20);
|
|
16829
17087
|
let rest;
|
|
@@ -16946,7 +17204,8 @@ const MRT_TableContainer = ({
|
|
|
16946
17204
|
options: {
|
|
16947
17205
|
enableCellActions,
|
|
16948
17206
|
enableRowVirtualization,
|
|
16949
|
-
muiTableContainerProps
|
|
17207
|
+
muiTableContainerProps,
|
|
17208
|
+
positionProgressBars
|
|
16950
17209
|
},
|
|
16951
17210
|
refs: {
|
|
16952
17211
|
resizeIndicatorRef,
|
|
@@ -17027,6 +17286,8 @@ const MRT_TableContainer = ({
|
|
|
17027
17286
|
width: '2px',
|
|
17028
17287
|
zIndex: 3
|
|
17029
17288
|
}
|
|
17289
|
+
}), positionProgressBars === 'header' && /*#__PURE__*/jsxRuntime.jsx(MRT_TableHeadProgressBar, {
|
|
17290
|
+
table: table
|
|
17030
17291
|
}), /*#__PURE__*/jsxRuntime.jsx(MRT_Table, {
|
|
17031
17292
|
table: table
|
|
17032
17293
|
}), newEntryModal.open && /*#__PURE__*/jsxRuntime.jsx(react.Suspense, {
|
|
@@ -17713,6 +17974,10 @@ const MaterialReactServerTableInstanceComponent = ({
|
|
|
17713
17974
|
const [pageCount, setPageCount] = react.useState(undefined);
|
|
17714
17975
|
const [rowCount, setRowCount] = react.useState(0);
|
|
17715
17976
|
const [isLoading, setIsLoading] = react.useState(false);
|
|
17977
|
+
// Skeletons only until the first data arrives. On later refetches (filter, sort, paging)
|
|
17978
|
+
// the current rows stay visible with a progress bar - swapping every cell to a Skeleton
|
|
17979
|
+
// and back remounts the whole table body twice per refetch.
|
|
17980
|
+
const [hasLoadedOnce, setHasLoadedOnce] = react.useState(false);
|
|
17716
17981
|
|
|
17717
17982
|
// Filter availableExports by exportPermissions if provided.
|
|
17718
17983
|
// exportPermissions maps export key → required permission strings.
|
|
@@ -17762,7 +18027,8 @@ const MaterialReactServerTableInstanceComponent = ({
|
|
|
17762
18027
|
enableRowPinning: false,
|
|
17763
18028
|
getRowId: originalRow => originalRow.id,
|
|
17764
18029
|
state: {
|
|
17765
|
-
showSkeletons: isLoading,
|
|
18030
|
+
showSkeletons: isLoading && !hasLoadedOnce,
|
|
18031
|
+
showProgressBars: isLoading,
|
|
17766
18032
|
...tableState
|
|
17767
18033
|
},
|
|
17768
18034
|
enableResetState,
|
|
@@ -17797,6 +18063,7 @@ const MaterialReactServerTableInstanceComponent = ({
|
|
|
17797
18063
|
hasNextPage
|
|
17798
18064
|
} = await loadData(tableInstance.getState());
|
|
17799
18065
|
tableInstance.setRows(newData);
|
|
18066
|
+
setHasLoadedOnce(true);
|
|
17800
18067
|
if (hasNextPage) {
|
|
17801
18068
|
setPageCount(-1);
|
|
17802
18069
|
setRowCount(0);
|