@dooherceg/material-react-table 4.1.5 → 4.1.7
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/README.md +64 -0
- package/dist/index.d.ts +17 -22
- package/dist/index.esm.js +1274 -727
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1274 -727
- package/dist/index.js.map +1 -1
- package/locales/en/index.esm.js +1 -0
- package/locales/en/index.js +1 -0
- package/locales/hr/index.esm.js +1 -0
- package/locales/hr/index.js +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sortFns, flexRender as flexRender$1, constructRow, Subscribe, aggregationFns, makeStateUpdater, setStateSlice, tableFeatures, rowSortingFeature, columnGroupingFeature, rowAggregationFeature, rowExpandingFeature, rowPaginationFeature, rowSelectionFeature, rowPinningFeature, columnPinningFeature, columnVisibilityFeature, columnOrderingFeature, columnSizingFeature, columnResizingFeature, createSortedRowModel, createPaginatedRowModel, createExpandedRowModel, createGroupedRowModel, useTable, functionalUpdate } from '@tanstack/react-table';
|
|
2
|
-
import { useState, useMemo, useRef, useId, useCallback, useEffect, createContext, useContext, forwardRef, Fragment as Fragment$1, memo, useReducer, Suspense, lazy, useImperativeHandle } from 'react';
|
|
2
|
+
import { useState, useMemo, useRef, useId, useCallback, useEffect, createContext, useContext, forwardRef, Fragment as Fragment$1, useLayoutEffect, memo, useReducer, Suspense, lazy, useImperativeHandle } from 'react';
|
|
3
3
|
import CancelIcon from '@mui/icons-material/Cancel';
|
|
4
4
|
import Button from '@mui/material/Button';
|
|
5
5
|
import Dialog from '@mui/material/Dialog';
|
|
@@ -95,6 +95,7 @@ import CheckIcon from '@mui/icons-material/Check';
|
|
|
95
95
|
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
96
96
|
import ErrorOutlineRoundedIcon from '@mui/icons-material/ErrorOutlineRounded';
|
|
97
97
|
import Paper from '@mui/material/Paper';
|
|
98
|
+
import Alert from '@mui/material/Alert';
|
|
98
99
|
import Collapse from '@mui/material/Collapse';
|
|
99
100
|
import LinearProgress from '@mui/material/LinearProgress';
|
|
100
101
|
import Pagination from '@mui/material/Pagination';
|
|
@@ -106,6 +107,7 @@ import ListItemIcon from '@mui/material/ListItemIcon';
|
|
|
106
107
|
import ListItemText from '@mui/material/ListItemText';
|
|
107
108
|
import BookmarkIcon from '@mui/icons-material/Bookmark';
|
|
108
109
|
import DeleteForeverIcon from '@mui/icons-material/DeleteForever';
|
|
110
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
109
111
|
import Switch from '@mui/material/Switch';
|
|
110
112
|
import Badge from '@mui/material/Badge';
|
|
111
113
|
import TableContainer from '@mui/material/TableContainer';
|
|
@@ -122,7 +124,6 @@ import Accordion from '@mui/material/Accordion';
|
|
|
122
124
|
import AccordionDetails from '@mui/material/AccordionDetails';
|
|
123
125
|
import AccordionSummary from '@mui/material/AccordionSummary';
|
|
124
126
|
import Modal from '@mui/material/Modal';
|
|
125
|
-
import Alert from '@mui/material/Alert';
|
|
126
127
|
import AlertTitle from '@mui/material/AlertTitle';
|
|
127
128
|
|
|
128
129
|
const MRT_SortingFns = {
|
|
@@ -144,6 +145,15 @@ const getAllLeafColumnDefs = columns => {
|
|
|
144
145
|
getLeafColumns(columns);
|
|
145
146
|
return allLeafColumnDefs;
|
|
146
147
|
};
|
|
148
|
+
|
|
149
|
+
// Must run on the raw, user-authored column array — by the time TanStack
|
|
150
|
+
// resolves column.columnDef.size (via constructColumn's `{...defaultColumn,
|
|
151
|
+
// ...columnDef}` merge), a column the consumer never gave a size backfills
|
|
152
|
+
// MRT_DefaultColumn.size (180) directly into columnDef.size, indistinguishable
|
|
153
|
+
// from a column that explicitly asked for 180. Checking `size === undefined`
|
|
154
|
+
// here, before that merge happens, is the only point where the distinction
|
|
155
|
+
// still exists.
|
|
156
|
+
const getAutoSizeCandidateColumnIds = columnDefs => new Set(getAllLeafColumnDefs(columnDefs).filter(columnDef => columnDef.size === undefined).map(columnDef => getColumnId(columnDef)));
|
|
147
157
|
const prepareColumns = ({
|
|
148
158
|
columnDefs,
|
|
149
159
|
tableOptions
|
|
@@ -194,6 +204,7 @@ const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
|
|
|
194
204
|
};
|
|
195
205
|
|
|
196
206
|
function defaultDisplayColumnProps({
|
|
207
|
+
columnSpecificDefaults,
|
|
197
208
|
header,
|
|
198
209
|
id,
|
|
199
210
|
size,
|
|
@@ -208,6 +219,7 @@ function defaultDisplayColumnProps({
|
|
|
208
219
|
...defaultDisplayColumn,
|
|
209
220
|
header: header ? localization[header] : '',
|
|
210
221
|
size,
|
|
222
|
+
...columnSpecificDefaults,
|
|
211
223
|
...displayColumnDefOptions?.[id],
|
|
212
224
|
id
|
|
213
225
|
};
|
|
@@ -246,42 +258,10 @@ const getTrailingDisplayColumnIds = tableOptions => [tableOptions.positionAction
|
|
|
246
258
|
/** The internal ID used by TanStack Table for the row-selection checkbox column */
|
|
247
259
|
const CHECKBOX_DISPLAY_COLUMN_ID = '__check__';
|
|
248
260
|
|
|
249
|
-
/**
|
|
250
|
-
* Builds the default columnPinning state so that the checkbox column
|
|
251
|
-
* is always the first start-pinned column when row selection is enabled.
|
|
252
|
-
* The checkbox is pinned for sticky positioning only — its visual styles are
|
|
253
|
-
* intentionally overridden in style.utils.ts to match center column appearance.
|
|
254
|
-
* Any user-supplied start-pinned column IDs are kept, but appended after the
|
|
255
|
-
* checkbox so they never appear before it.
|
|
256
|
-
*/
|
|
257
|
-
const getDefaultColumnPinningState = (tableOptions, existingColumnPinning = {}) => {
|
|
258
|
-
const existingStart = existingColumnPinning.start ?? [];
|
|
259
|
-
const existingEnd = existingColumnPinning.end ?? [];
|
|
260
|
-
|
|
261
|
-
// Only pin the checkbox automatically when the column is actually rendered
|
|
262
|
-
if (!tableOptions.enableRowSelection) {
|
|
263
|
-
return {
|
|
264
|
-
start: existingStart,
|
|
265
|
-
end: existingEnd
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// Remove checkbox from wherever it is to check remaining pinned columns
|
|
270
|
-
const startWithoutCheckbox = existingStart.filter(colId => colId !== CHECKBOX_DISPLAY_COLUMN_ID);
|
|
271
|
-
|
|
272
|
-
// Only force checkbox to the front when start or end pinned columns exist
|
|
273
|
-
const updatedStart = existingStart.length > 0 ? [CHECKBOX_DISPLAY_COLUMN_ID, ...startWithoutCheckbox] : existingStart;
|
|
274
|
-
return {
|
|
275
|
-
start: updatedStart,
|
|
276
|
-
end: existingEnd
|
|
277
|
-
};
|
|
278
|
-
};
|
|
279
|
-
|
|
280
261
|
/**
|
|
281
262
|
* Forces mrt-row-expand to a fixed slot in columnOrder: right after the
|
|
282
263
|
* checkbox column when row selection is enabled, otherwise the very first
|
|
283
|
-
* column.
|
|
284
|
-
* forces the checkbox column itself to the front of columnPinning.start.
|
|
264
|
+
* column. This slot is independent of column pinning.
|
|
285
265
|
*/
|
|
286
266
|
const normalizeRowExpandColumnOrder = (tableOptions, columnOrder) => {
|
|
287
267
|
if (!showRowExpandColumn(tableOptions)) {
|
|
@@ -503,6 +483,89 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
|
|
|
503
483
|
[getColumnId(col)]: ''
|
|
504
484
|
}))), rowIndex, depth, subRows, parentId);
|
|
505
485
|
|
|
486
|
+
/** Resolved column limits shared by measurement, resizing, and cell layout. */
|
|
487
|
+
const getColumnSizeBounds = ({
|
|
488
|
+
minSize = 40,
|
|
489
|
+
maxSize = 1000
|
|
490
|
+
}) => {
|
|
491
|
+
const min = Number.isFinite(minSize) ? Math.max(0, minSize) : 40;
|
|
492
|
+
const max = Number.isNaN(maxSize) ? 1000 : Math.max(min, maxSize);
|
|
493
|
+
return {
|
|
494
|
+
minSize: min,
|
|
495
|
+
maxSize: max
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
// `el` normally has an explicit width/min-width/flex-basis (driven by the
|
|
500
|
+
// column's size CSS var), so nothing overflows and `getBoundingClientRect`
|
|
501
|
+
// just reports that forced size back — and `min-width` alone would otherwise
|
|
502
|
+
// stop it from ever shrinking below the current (large) column size.
|
|
503
|
+
// Temporarily switching to `max-content` with min-width/grow/shrink zeroed
|
|
504
|
+
// out lets the browser lay it out at its natural content size instead — then
|
|
505
|
+
// the inline style is restored before this task yields, so there's no
|
|
506
|
+
// visible flash.
|
|
507
|
+
const measureIntrinsicWidth = el => {
|
|
508
|
+
const {
|
|
509
|
+
width,
|
|
510
|
+
minWidth,
|
|
511
|
+
maxWidth,
|
|
512
|
+
flexBasis,
|
|
513
|
+
flexGrow,
|
|
514
|
+
flexShrink
|
|
515
|
+
} = el.style;
|
|
516
|
+
el.style.width = 'max-content';
|
|
517
|
+
el.style.minWidth = '0';
|
|
518
|
+
el.style.maxWidth = 'none';
|
|
519
|
+
el.style.flexBasis = 'auto';
|
|
520
|
+
el.style.flexGrow = '0';
|
|
521
|
+
el.style.flexShrink = '0';
|
|
522
|
+
const measured = Math.ceil(el.getBoundingClientRect().width);
|
|
523
|
+
el.style.width = width;
|
|
524
|
+
el.style.minWidth = minWidth;
|
|
525
|
+
el.style.maxWidth = maxWidth;
|
|
526
|
+
el.style.flexBasis = flexBasis;
|
|
527
|
+
el.style.flexGrow = flexGrow;
|
|
528
|
+
el.style.flexShrink = flexShrink;
|
|
529
|
+
return measured;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* The single measurement this library uses anywhere it decides "what's the
|
|
534
|
+
* right width for this column's current content" — shared by the resize
|
|
535
|
+
* handle's double-click autosize and the initial autosize effect
|
|
536
|
+
* (MRT_AutoSizeColumnsEffect), so both agree on the exact same answer.
|
|
537
|
+
*
|
|
538
|
+
* Driven purely by body cell content: the header title never contributes,
|
|
539
|
+
* so a long header simply ellipsizes when its values are narrower.
|
|
540
|
+
*
|
|
541
|
+
* Only the currently rendered (visible, due to row virtualization) body
|
|
542
|
+
* cells can be measured — a full-dataset autosize would require rendering
|
|
543
|
+
* every row off-screen, which defeats the point of virtualization.
|
|
544
|
+
*/
|
|
545
|
+
// Absorbs the sub-pixel rounding gap between measurement time (forced
|
|
546
|
+
// `max-content`, read via `Math.ceil`) and final render time (the actual
|
|
547
|
+
// `calc(var(--col-x-size) * 1px)` width) — without it, a column can land
|
|
548
|
+
// exactly 1px short of its own measured content and still clip/ellipsize.
|
|
549
|
+
const MEASUREMENT_SAFETY_MARGIN_PX = 2;
|
|
550
|
+
const computeAutoSizedColumnWidth = ({
|
|
551
|
+
bodyCellEls,
|
|
552
|
+
maxSize,
|
|
553
|
+
minSize
|
|
554
|
+
}) => {
|
|
555
|
+
let contentWidth = 0;
|
|
556
|
+
for (const cellEl of bodyCellEls ?? []) {
|
|
557
|
+
contentWidth = Math.max(contentWidth, measureIntrinsicWidth(cellEl));
|
|
558
|
+
}
|
|
559
|
+
if (contentWidth > 0) {
|
|
560
|
+
contentWidth = Math.ceil(contentWidth) + MEASUREMENT_SAFETY_MARGIN_PX;
|
|
561
|
+
}
|
|
562
|
+
const bounds = getColumnSizeBounds({
|
|
563
|
+
minSize,
|
|
564
|
+
maxSize
|
|
565
|
+
});
|
|
566
|
+
return Math.min(Math.max(contentWidth, bounds.minSize), bounds.maxSize);
|
|
567
|
+
};
|
|
568
|
+
|
|
506
569
|
// Loading indicators fade in after a short delay
|
|
507
570
|
// (`animation: ${mrtDelayedFadeIn}`), so fast responses don't flash them.
|
|
508
571
|
const mrtDelayedFadeIn = `${keyframes`
|
|
@@ -534,6 +597,7 @@ const commonCellBeforeAfterStyles = {
|
|
|
534
597
|
zIndex: -1
|
|
535
598
|
};
|
|
536
599
|
const getCommonPinnedCellStyles = ({
|
|
600
|
+
column,
|
|
537
601
|
table,
|
|
538
602
|
theme
|
|
539
603
|
}) => {
|
|
@@ -543,12 +607,30 @@ const getCommonPinnedCellStyles = ({
|
|
|
543
607
|
return {
|
|
544
608
|
'&[data-pinned="true"]': {
|
|
545
609
|
'&:before': {
|
|
546
|
-
backgroundColor:
|
|
610
|
+
backgroundColor: baseBackgroundColor,
|
|
611
|
+
// Draw only the edge facing the center region, including when other
|
|
612
|
+
// pinned columns are hidden. Logical borders also handle RTL layouts.
|
|
613
|
+
borderInlineEnd: column?.getIsPinned() === 'start' && column.getIsLastColumn('start') ? `1px solid ${theme.palette.divider}` : undefined,
|
|
614
|
+
borderInlineStart: column?.getIsPinned() === 'end' && column.getIsFirstColumn('end') ? `1px solid ${theme.palette.divider}` : undefined,
|
|
615
|
+
boxSizing: 'border-box',
|
|
547
616
|
...commonCellBeforeAfterStyles
|
|
548
617
|
}
|
|
549
618
|
}
|
|
550
619
|
};
|
|
551
620
|
};
|
|
621
|
+
|
|
622
|
+
// Shared by cell styles and the imperative sizing subscription: resizing must
|
|
623
|
+
// update growth even when memoized cells do not render again.
|
|
624
|
+
const getColumnGrowWeight = (column, table) => {
|
|
625
|
+
const {
|
|
626
|
+
columnDef
|
|
627
|
+
} = column;
|
|
628
|
+
const sizing = table.getState().columnSizing[column.id];
|
|
629
|
+
const hasUserSize = sizing !== undefined && sizing !== table.refs.autoSizedColumnWidthsRef.current[column.id];
|
|
630
|
+
if (column.getIsPinned() || !table.refs.autoSizeColumnIdsRef.current.has(column.id) || hasUserSize) return 0;
|
|
631
|
+
if (typeof columnDef.grow === 'number') return Math.max(0, columnDef.grow);
|
|
632
|
+
return columnDef.grow === false ? 0 : 1;
|
|
633
|
+
};
|
|
552
634
|
const getCommonMRTCellStyles = ({
|
|
553
635
|
column,
|
|
554
636
|
header,
|
|
@@ -571,67 +653,33 @@ const getCommonMRTCellStyles = ({
|
|
|
571
653
|
columnDefType
|
|
572
654
|
} = columnDef;
|
|
573
655
|
const isColumnPinned = columnDef.columnDefType !== 'group' && column.getIsPinned();
|
|
656
|
+
const {
|
|
657
|
+
minSize,
|
|
658
|
+
maxSize
|
|
659
|
+
} = getColumnSizeBounds(columnDef);
|
|
660
|
+
const sizeVar = `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size) * 1px)`;
|
|
661
|
+
const boundedSize = Number.isFinite(maxSize) ? `clamp(${minSize}px, ${sizeVar}, ${maxSize}px)` : `max(${minSize}px, ${sizeVar})`;
|
|
574
662
|
const widthStyles = {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
663
|
+
// Group headers span already-bounded child columns; the default leaf
|
|
664
|
+
// maximum must not truncate the sum of their widths.
|
|
665
|
+
maxWidth: columnDefType === 'group' ? sizeVar : Number.isFinite(maxSize) ? `${maxSize}px` : 'none',
|
|
666
|
+
minWidth: columnDefType === 'group' ? sizeVar : boundedSize,
|
|
667
|
+
width: columnDefType === 'group' ? sizeVar : boundedSize
|
|
578
668
|
};
|
|
579
669
|
if (layoutMode === 'grid' || layoutMode === 'grid-no-grow') {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
// handful of columns fill a wide viewport evenly, and widening one via resize
|
|
585
|
-
// shrinks the others to keep the row's total width pinned to the container — all
|
|
586
|
-
// through native flexbox, no JS redistribution needed.
|
|
587
|
-
const weight = isColumnPinned ? 0 : [0, false].includes(columnDef.grow) ? 0 : typeof columnDef.grow === 'number' ? columnDef.grow : `var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size)`;
|
|
588
|
-
widthStyles.flex = `${weight} ${weight} auto`;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// The checkbox column is technically pinned (for sticky positioning) but
|
|
592
|
-
// should look like a regular center column — no background overlay or shadow.
|
|
593
|
-
const isCheckboxColumn = column.id === CHECKBOX_DISPLAY_COLUMN_ID;
|
|
594
|
-
|
|
595
|
-
// Count all currently pinned column IDs across both sides.
|
|
596
|
-
// Checkbox is always pinned (counts as 1), so > 1 means the user has
|
|
597
|
-
// explicitly pinned at least one additional column.
|
|
598
|
-
// Avoid spreading into a new array on this per-cell hot path — a length sum
|
|
599
|
-
// is enough, we never need the combined array itself.
|
|
600
|
-
const {
|
|
601
|
-
columnPinning
|
|
602
|
-
} = table.getState();
|
|
603
|
-
const totalPinnedColumnCount = (columnPinning.start?.length ?? 0) + (columnPinning.end?.length ?? 0);
|
|
604
|
-
const hasNoPinnedColumns = totalPinnedColumnCount === 0;
|
|
670
|
+
const weight = getColumnGrowWeight(column, table);
|
|
671
|
+
const growVar = `var(--col-${parseCSSVarId(column.id)}-grow, ${weight})`;
|
|
672
|
+
widthStyles.flex = `${growVar} 0 auto`;
|
|
673
|
+
}
|
|
605
674
|
const pinnedStyles = isColumnPinned ? {
|
|
606
|
-
|
|
607
|
-
// columns are also pinned (> 1 total). When it is the sole pinned column
|
|
608
|
-
// no override is needed. For all other columns apply standard pinned styles.
|
|
609
|
-
...(isCheckboxColumn ? hasNoPinnedColumns ? {
|
|
610
|
-
// Use doubled class selector (&&) to beat the row-level
|
|
611
|
-
// td[data-pinned="true"]:before specificity from MRT_TableBodyRow.
|
|
612
|
-
'&&[data-pinned="true"]': {
|
|
613
|
-
'&:before': {
|
|
614
|
-
backgroundColor: 'transparent',
|
|
615
|
-
boxShadow: 'none'
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
} :
|
|
619
|
-
// Other columns are also pinned — apply standard pinned background
|
|
620
|
-
// so the checkbox header matches the pinned row cells below it.
|
|
621
|
-
getCommonPinnedCellStyles({
|
|
622
|
-
column,
|
|
623
|
-
table,
|
|
624
|
-
theme
|
|
625
|
-
}) : getCommonPinnedCellStyles({
|
|
675
|
+
...getCommonPinnedCellStyles({
|
|
626
676
|
column,
|
|
627
677
|
table,
|
|
628
678
|
theme
|
|
629
|
-
})
|
|
679
|
+
}),
|
|
630
680
|
// Logical CSS insets (not left/right) so pinning stays correct in RTL
|
|
631
681
|
// without branching on theme.direction here.
|
|
632
682
|
insetInlineStart: isColumnPinned === 'start' ? `${column.getStart('start')}px` : undefined,
|
|
633
|
-
// Skip opacity reduction for checkbox — keep it fully opaque like center columns
|
|
634
|
-
opacity: isCheckboxColumn ? undefined : 0.97,
|
|
635
683
|
position: 'sticky',
|
|
636
684
|
insetInlineEnd: isColumnPinned === 'end' ? `${column.getAfter('end')}px` : undefined
|
|
637
685
|
} : {};
|
|
@@ -2084,7 +2132,7 @@ const MRT_ToggleRowActionMenuButton = t0 => {
|
|
|
2084
2132
|
staticRowIndex,
|
|
2085
2133
|
table
|
|
2086
2134
|
}) : renderRowActionMenuItems?.({
|
|
2087
|
-
closeMenu: _temp$
|
|
2135
|
+
closeMenu: _temp$B,
|
|
2088
2136
|
row,
|
|
2089
2137
|
staticRowIndex,
|
|
2090
2138
|
table
|
|
@@ -2134,7 +2182,7 @@ const MRT_ToggleRowActionMenuButton = t0 => {
|
|
|
2134
2182
|
}
|
|
2135
2183
|
return t5;
|
|
2136
2184
|
};
|
|
2137
|
-
function _temp$
|
|
2185
|
+
function _temp$B() {}
|
|
2138
2186
|
|
|
2139
2187
|
const getMRT_RowActionsColumnDef = tableOptions => {
|
|
2140
2188
|
return {
|
|
@@ -2150,14 +2198,17 @@ const getMRT_RowActionsColumnDef = tableOptions => {
|
|
|
2150
2198
|
table: table
|
|
2151
2199
|
}),
|
|
2152
2200
|
...(tableOptions.positionActionsColumn === 'last' && {
|
|
2153
|
-
grow: true
|
|
2154
|
-
muiTableBodyCellProps: {
|
|
2155
|
-
sx: {
|
|
2156
|
-
minWidth: 'max-content'
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
2201
|
+
grow: true
|
|
2159
2202
|
}),
|
|
2160
2203
|
...defaultDisplayColumnProps({
|
|
2204
|
+
// Unlike other display columns, the actions column is draggable,
|
|
2205
|
+
// orderable, and resizable by default — it behaves like a user column
|
|
2206
|
+
// for layout purposes, just without filtering/sorting/hiding.
|
|
2207
|
+
columnSpecificDefaults: {
|
|
2208
|
+
enableColumnDragging: true,
|
|
2209
|
+
enableColumnOrdering: true,
|
|
2210
|
+
enableResizing: true
|
|
2211
|
+
},
|
|
2161
2212
|
header: 'actions',
|
|
2162
2213
|
id: 'mrt-row-actions',
|
|
2163
2214
|
size: 70,
|
|
@@ -2210,7 +2261,7 @@ const MRT_ExpandAllButton = t0 => {
|
|
|
2210
2261
|
const {
|
|
2211
2262
|
isLoading
|
|
2212
2263
|
} = t3;
|
|
2213
|
-
const density = useSelector(table.store, _temp$
|
|
2264
|
+
const density = useSelector(table.store, _temp$A);
|
|
2214
2265
|
let t4;
|
|
2215
2266
|
if ($[5] !== muiExpandAllButtonProps || $[6] !== table) {
|
|
2216
2267
|
t4 = parseFromValuesOrFunc(muiExpandAllButtonProps, {
|
|
@@ -2299,7 +2350,7 @@ const MRT_ExpandAllButton = t0 => {
|
|
|
2299
2350
|
}
|
|
2300
2351
|
return t7;
|
|
2301
2352
|
};
|
|
2302
|
-
function _temp$
|
|
2353
|
+
function _temp$A(state) {
|
|
2303
2354
|
return state.density;
|
|
2304
2355
|
}
|
|
2305
2356
|
|
|
@@ -2382,10 +2433,12 @@ const MRT_ExpandButton = ({
|
|
|
2382
2433
|
"aria-label": localization.expand,
|
|
2383
2434
|
disabled: !canExpand && !detailPanel,
|
|
2384
2435
|
...iconButtonProps,
|
|
2436
|
+
disableRipple: true,
|
|
2385
2437
|
onClick: handleToggleExpand,
|
|
2386
2438
|
sx: theme_0 => ({
|
|
2387
2439
|
opacity: !canExpand && !detailPanel ? 0.3 : 1,
|
|
2388
2440
|
[theme_0.direction === 'rtl' || positionExpandColumn === 'last' ? 'mr' : 'ml']: `${row.depth * 16}px`,
|
|
2441
|
+
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
2389
2442
|
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
2390
2443
|
...parseFromValuesOrFunc(iconButtonProps?.sx, theme_0)
|
|
2391
2444
|
}),
|
|
@@ -2512,13 +2565,16 @@ const MRT_ReorderRowCheckbox = t0 => {
|
|
|
2512
2565
|
onChange,
|
|
2513
2566
|
isSelected
|
|
2514
2567
|
} = t0;
|
|
2515
|
-
const handleClick = _temp$
|
|
2568
|
+
const handleClick = _temp$z;
|
|
2516
2569
|
let t1;
|
|
2517
2570
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
2518
2571
|
t1 = {
|
|
2519
2572
|
color: _temp2$d,
|
|
2573
|
+
height: "1.75rem",
|
|
2574
|
+
m: "-0.4rem",
|
|
2575
|
+
width: "1.75rem",
|
|
2520
2576
|
"&.Mui-checked": {
|
|
2521
|
-
color: _temp3$
|
|
2577
|
+
color: _temp3$5
|
|
2522
2578
|
}
|
|
2523
2579
|
};
|
|
2524
2580
|
$[0] = t1;
|
|
@@ -2533,6 +2589,7 @@ const MRT_ReorderRowCheckbox = t0 => {
|
|
|
2533
2589
|
disableRipple: true,
|
|
2534
2590
|
onChange: onChange,
|
|
2535
2591
|
onClick: handleClick,
|
|
2592
|
+
size: "small",
|
|
2536
2593
|
sx: t1
|
|
2537
2594
|
});
|
|
2538
2595
|
$[1] = isSelected;
|
|
@@ -2543,13 +2600,13 @@ const MRT_ReorderRowCheckbox = t0 => {
|
|
|
2543
2600
|
}
|
|
2544
2601
|
return t2;
|
|
2545
2602
|
};
|
|
2546
|
-
function _temp$
|
|
2603
|
+
function _temp$z(event) {
|
|
2547
2604
|
event.stopPropagation();
|
|
2548
2605
|
}
|
|
2549
2606
|
function _temp2$d(theme) {
|
|
2550
2607
|
return theme.palette.warning.main;
|
|
2551
2608
|
}
|
|
2552
|
-
function _temp3$
|
|
2609
|
+
function _temp3$5(theme_0) {
|
|
2553
2610
|
return theme_0.palette.warning.main;
|
|
2554
2611
|
}
|
|
2555
2612
|
|
|
@@ -2868,7 +2925,7 @@ const useTreeRowReorderingHeader = t0 => {
|
|
|
2868
2925
|
enableRowReordering,
|
|
2869
2926
|
onTreeRowReorder
|
|
2870
2927
|
} = t0;
|
|
2871
|
-
const rowReorderingSelection = useSelector(table.store, _temp$
|
|
2928
|
+
const rowReorderingSelection = useSelector(table.store, _temp$y);
|
|
2872
2929
|
let selectedReorderRowIds;
|
|
2873
2930
|
let selectedRowsForReorder;
|
|
2874
2931
|
let t1;
|
|
@@ -2931,7 +2988,7 @@ const useTreeRowReorderingHeader = t0 => {
|
|
|
2931
2988
|
}
|
|
2932
2989
|
return t3;
|
|
2933
2990
|
};
|
|
2934
|
-
function _temp$
|
|
2991
|
+
function _temp$y(state) {
|
|
2935
2992
|
return state.rowReorderingSelection;
|
|
2936
2993
|
}
|
|
2937
2994
|
function _temp2$c(selectedRow) {
|
|
@@ -3274,7 +3331,7 @@ const MRT_TableBodyRowPinButton = t0 => {
|
|
|
3274
3331
|
enableRowPinning,
|
|
3275
3332
|
rowPinningDisplayMode
|
|
3276
3333
|
} = t1;
|
|
3277
|
-
const density = useSelector(table.store, _temp$
|
|
3334
|
+
const density = useSelector(table.store, _temp$x);
|
|
3278
3335
|
const canPin = parseFromValuesOrFunc(enableRowPinning, row);
|
|
3279
3336
|
if (!canPin) {
|
|
3280
3337
|
return null;
|
|
@@ -3355,7 +3412,7 @@ const MRT_TableBodyRowPinButton = t0 => {
|
|
|
3355
3412
|
}
|
|
3356
3413
|
return t4;
|
|
3357
3414
|
};
|
|
3358
|
-
function _temp$
|
|
3415
|
+
function _temp$x(state) {
|
|
3359
3416
|
return state.density;
|
|
3360
3417
|
}
|
|
3361
3418
|
|
|
@@ -3378,166 +3435,6 @@ const getMRT_RowPinningColumnDef = tableOptions => {
|
|
|
3378
3435
|
};
|
|
3379
3436
|
};
|
|
3380
3437
|
|
|
3381
|
-
const MRT_SelectAllMenu = ({
|
|
3382
|
-
table
|
|
3383
|
-
}) => {
|
|
3384
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
|
3385
|
-
const [isSelectingAllPages, setIsSelectingAllPages] = useState(false);
|
|
3386
|
-
const {
|
|
3387
|
-
getState,
|
|
3388
|
-
options: {
|
|
3389
|
-
enableRowPinning,
|
|
3390
|
-
getAllSelectableRowIds,
|
|
3391
|
-
localization,
|
|
3392
|
-
rowPinningDisplayMode
|
|
3393
|
-
},
|
|
3394
|
-
refs: {
|
|
3395
|
-
allSelectableRowIdsRef
|
|
3396
|
-
}
|
|
3397
|
-
} = table;
|
|
3398
|
-
const {
|
|
3399
|
-
isLoading
|
|
3400
|
-
} = getState();
|
|
3401
|
-
const handleOpen = event => {
|
|
3402
|
-
setAnchorEl(event.currentTarget);
|
|
3403
|
-
};
|
|
3404
|
-
const handleClose = () => {
|
|
3405
|
-
setAnchorEl(null);
|
|
3406
|
-
};
|
|
3407
|
-
|
|
3408
|
-
// Clears row pinning on every bulk selection/deselection
|
|
3409
|
-
const clearPinning = () => {
|
|
3410
|
-
if (enableRowPinning && rowPinningDisplayMode?.includes('select')) {
|
|
3411
|
-
table.setRowPinning({
|
|
3412
|
-
bottom: [],
|
|
3413
|
-
top: []
|
|
3414
|
-
});
|
|
3415
|
-
}
|
|
3416
|
-
};
|
|
3417
|
-
|
|
3418
|
-
// ── Current-page actions ────────────────────────────────────────────────────
|
|
3419
|
-
|
|
3420
|
-
const handleSelectCurrentPage = () => {
|
|
3421
|
-
table.toggleAllPageRowsSelected(true);
|
|
3422
|
-
clearPinning();
|
|
3423
|
-
handleClose();
|
|
3424
|
-
};
|
|
3425
|
-
const handleDeselectCurrentPage = () => {
|
|
3426
|
-
if (allSelectableRowIdsRef.current.length > 0) {
|
|
3427
|
-
// When all pages are selected, deselecting the current page must clear the entire selection — otherwise rows on other pages remain "ghost-selected" but the user can't see them.
|
|
3428
|
-
table.setRowSelection({});
|
|
3429
|
-
allSelectableRowIdsRef.current = [];
|
|
3430
|
-
} else {
|
|
3431
|
-
table.toggleAllPageRowsSelected(false);
|
|
3432
|
-
}
|
|
3433
|
-
clearPinning();
|
|
3434
|
-
handleClose();
|
|
3435
|
-
};
|
|
3436
|
-
|
|
3437
|
-
// ── All-pages actions ───────────────────────────────────────────────────────
|
|
3438
|
-
|
|
3439
|
-
const handleSelectAllPages = async () => {
|
|
3440
|
-
handleClose();
|
|
3441
|
-
if (getAllSelectableRowIds) {
|
|
3442
|
-
// Server-side: IDs are not available locally, fetch them from the API
|
|
3443
|
-
setIsSelectingAllPages(true);
|
|
3444
|
-
table.setShowProgressBars(true);
|
|
3445
|
-
try {
|
|
3446
|
-
const ids = await getAllSelectableRowIds({
|
|
3447
|
-
table
|
|
3448
|
-
});
|
|
3449
|
-
allSelectableRowIdsRef.current = ids;
|
|
3450
|
-
const newSelection = {};
|
|
3451
|
-
ids.forEach(id => {
|
|
3452
|
-
newSelection[id] = true;
|
|
3453
|
-
});
|
|
3454
|
-
table.setRowSelection(newSelection);
|
|
3455
|
-
clearPinning();
|
|
3456
|
-
} finally {
|
|
3457
|
-
setIsSelectingAllPages(false);
|
|
3458
|
-
table.setShowProgressBars(false);
|
|
3459
|
-
}
|
|
3460
|
-
} else {
|
|
3461
|
-
// Client-side: all data is available locally
|
|
3462
|
-
table.toggleAllRowsSelected(true);
|
|
3463
|
-
clearPinning();
|
|
3464
|
-
}
|
|
3465
|
-
};
|
|
3466
|
-
const handleDeselectAllPages = () => {
|
|
3467
|
-
if (getAllSelectableRowIds) {
|
|
3468
|
-
table.setRowSelection({});
|
|
3469
|
-
} else {
|
|
3470
|
-
table.toggleAllRowsSelected(false);
|
|
3471
|
-
}
|
|
3472
|
-
allSelectableRowIdsRef.current = [];
|
|
3473
|
-
clearPinning();
|
|
3474
|
-
handleClose();
|
|
3475
|
-
};
|
|
3476
|
-
const isDisabled = isLoading || isSelectingAllPages;
|
|
3477
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
3478
|
-
children: [/*#__PURE__*/jsx(Tooltip, {
|
|
3479
|
-
...getCommonTooltipProps(),
|
|
3480
|
-
title: localization.toggleSelectAll,
|
|
3481
|
-
children: /*#__PURE__*/jsx("span", {
|
|
3482
|
-
children: /*#__PURE__*/jsx(IconButton, {
|
|
3483
|
-
"aria-label": localization.toggleSelectAll,
|
|
3484
|
-
disabled: isDisabled,
|
|
3485
|
-
onClick: handleOpen,
|
|
3486
|
-
size: "small",
|
|
3487
|
-
sx: {
|
|
3488
|
-
height: '1.5rem',
|
|
3489
|
-
width: '1.5rem'
|
|
3490
|
-
},
|
|
3491
|
-
children: /*#__PURE__*/jsx(table.options.icons.MoreVertIcon, {
|
|
3492
|
-
style: {
|
|
3493
|
-
transform: 'scale(0.85)'
|
|
3494
|
-
}
|
|
3495
|
-
})
|
|
3496
|
-
})
|
|
3497
|
-
})
|
|
3498
|
-
}), /*#__PURE__*/jsx(Menu, {
|
|
3499
|
-
anchorEl: anchorEl,
|
|
3500
|
-
onClose: handleClose,
|
|
3501
|
-
open: Boolean(anchorEl),
|
|
3502
|
-
children: /*#__PURE__*/jsx(Subscribe, {
|
|
3503
|
-
selector: state => ({
|
|
3504
|
-
pagination: state.pagination,
|
|
3505
|
-
rowSelection: state.rowSelection
|
|
3506
|
-
}),
|
|
3507
|
-
source: table.store,
|
|
3508
|
-
children: ({
|
|
3509
|
-
rowSelection
|
|
3510
|
-
}) => {
|
|
3511
|
-
const isAllCurrentPageSelected = table.getIsAllPageRowsSelected();
|
|
3512
|
-
const isAllPagesActive = getIsAllPagesSelectionActive(table, rowSelection);
|
|
3513
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
3514
|
-
children: [isAllCurrentPageSelected ? /*#__PURE__*/jsx(MenuItem, {
|
|
3515
|
-
onClick: handleDeselectCurrentPage,
|
|
3516
|
-
children: localization.deselectAllOnCurrentPage
|
|
3517
|
-
}) : /*#__PURE__*/jsx(MenuItem, {
|
|
3518
|
-
onClick: handleSelectCurrentPage,
|
|
3519
|
-
children: localization.selectAllOnCurrentPage
|
|
3520
|
-
}), isAllPagesActive ? /*#__PURE__*/jsx(MenuItem, {
|
|
3521
|
-
onClick: handleDeselectAllPages,
|
|
3522
|
-
children: localization.deselectAllOnAllPages
|
|
3523
|
-
}) : /*#__PURE__*/jsxs(MenuItem, {
|
|
3524
|
-
disabled: isSelectingAllPages,
|
|
3525
|
-
onClick: handleSelectAllPages,
|
|
3526
|
-
children: [isSelectingAllPages && /*#__PURE__*/jsx(CircularProgress, {
|
|
3527
|
-
"aria-label": "Loading",
|
|
3528
|
-
size: 14,
|
|
3529
|
-
sx: {
|
|
3530
|
-
mr: 1
|
|
3531
|
-
}
|
|
3532
|
-
}), localization.selectAllOnAllPages]
|
|
3533
|
-
})]
|
|
3534
|
-
});
|
|
3535
|
-
}
|
|
3536
|
-
})
|
|
3537
|
-
})]
|
|
3538
|
-
});
|
|
3539
|
-
};
|
|
3540
|
-
|
|
3541
3438
|
const MRT_SelectCheckbox = t0 => {
|
|
3542
3439
|
const $ = c(32);
|
|
3543
3440
|
let rest;
|
|
@@ -3584,7 +3481,7 @@ const MRT_SelectCheckbox = t0 => {
|
|
|
3584
3481
|
const {
|
|
3585
3482
|
isLoading
|
|
3586
3483
|
} = t2;
|
|
3587
|
-
const density = useSelector(table.store, _temp$
|
|
3484
|
+
const density = useSelector(table.store, _temp$w);
|
|
3588
3485
|
const selectAll = !row;
|
|
3589
3486
|
let t3;
|
|
3590
3487
|
if ($[7] !== row || $[8] !== staticRowIndex || $[9] !== table) {
|
|
@@ -3702,7 +3599,7 @@ const MRT_SelectCheckbox = t0 => {
|
|
|
3702
3599
|
}
|
|
3703
3600
|
return t6;
|
|
3704
3601
|
};
|
|
3705
|
-
function _temp$
|
|
3602
|
+
function _temp$w(state) {
|
|
3706
3603
|
return state.density;
|
|
3707
3604
|
}
|
|
3708
3605
|
function _temp2$b(state_0) {
|
|
@@ -3729,23 +3626,18 @@ const getMRT_RowSelectColumnDef = tableOptions => {
|
|
|
3729
3626
|
}),
|
|
3730
3627
|
Header: enableSelectAll && enableMultiRowSelection ? ({
|
|
3731
3628
|
table
|
|
3732
|
-
}) => /*#__PURE__*/
|
|
3733
|
-
|
|
3734
|
-
alignItems: 'center',
|
|
3735
|
-
display: 'flex'
|
|
3736
|
-
},
|
|
3737
|
-
children: [/*#__PURE__*/jsx(MRT_SelectCheckbox, {
|
|
3738
|
-
table: table
|
|
3739
|
-
}), /*#__PURE__*/jsx(MRT_SelectAllMenu, {
|
|
3740
|
-
table: table
|
|
3741
|
-
})]
|
|
3629
|
+
}) => /*#__PURE__*/jsx(MRT_SelectCheckbox, {
|
|
3630
|
+
table: table
|
|
3742
3631
|
}) : undefined,
|
|
3743
3632
|
grow: false,
|
|
3744
3633
|
...defaultDisplayColumnProps({
|
|
3634
|
+
columnSpecificDefaults: {
|
|
3635
|
+
enableColumnActions: true,
|
|
3636
|
+
enablePinning: true
|
|
3637
|
+
},
|
|
3745
3638
|
header: 'select',
|
|
3746
3639
|
id: '__check__',
|
|
3747
|
-
size:
|
|
3748
|
-
// widened from 60 to accommodate both the checkbox and the menu button
|
|
3640
|
+
size: 56,
|
|
3749
3641
|
tableOptions
|
|
3750
3642
|
})
|
|
3751
3643
|
};
|
|
@@ -3818,6 +3710,7 @@ const MRT_Default_Icons = {
|
|
|
3818
3710
|
// ComponentType<SvgIconProps> is the correct type for all MUI SvgIcon components.
|
|
3819
3711
|
|
|
3820
3712
|
const MRT_Localization_EN = {
|
|
3713
|
+
retryLoading: 'Retry',
|
|
3821
3714
|
language: 'en',
|
|
3822
3715
|
actions: 'Actions',
|
|
3823
3716
|
and: 'and',
|
|
@@ -4484,6 +4377,8 @@ const useMRT_TableInstance = definedTableOptions => {
|
|
|
4484
4377
|
const tableRef = useRef(null);
|
|
4485
4378
|
const isResizingRef = useRef(false);
|
|
4486
4379
|
const resizeIndicatorRef = useRef(null);
|
|
4380
|
+
const autoSizeColumnIdsRef = useRef(new Set());
|
|
4381
|
+
const autoSizedColumnWidthsRef = useRef({});
|
|
4487
4382
|
|
|
4488
4383
|
//transform initial state with proper column order
|
|
4489
4384
|
const initialState = useMemo(() => {
|
|
@@ -4497,12 +4392,6 @@ const useMRT_TableInstance = definedTableOptions => {
|
|
|
4497
4392
|
}
|
|
4498
4393
|
};
|
|
4499
4394
|
initState.columnOrder = normalizeRowExpandColumnOrder(mergedOptionsSnapshot, initState.columnOrder ?? getDefaultColumnOrderIds(mergedOptionsSnapshot));
|
|
4500
|
-
|
|
4501
|
-
// Ensure the checkbox column is always the leftmost sticky column when
|
|
4502
|
-
// row selection is enabled, regardless of what the user pinned initially.
|
|
4503
|
-
// The checkbox is pinned for positioning only — visual styles are overridden
|
|
4504
|
-
// in style.utils.ts so it looks like a regular center column.
|
|
4505
|
-
initState.columnPinning = getDefaultColumnPinningState(mergedOptionsSnapshot, initState.columnPinning ?? {});
|
|
4506
4395
|
initState.showAdvancedFilters = initState.showAdvancedFilters ?? false;
|
|
4507
4396
|
// getInitialState() on a custom TanStack feature only receives the
|
|
4508
4397
|
// accumulated initialState object, not the full table options — so the
|
|
@@ -4548,23 +4437,12 @@ const useMRT_TableInstance = definedTableOptions => {
|
|
|
4548
4437
|
...definedTableOptions.state
|
|
4549
4438
|
};
|
|
4550
4439
|
|
|
4551
|
-
// Normalize controlled columnPinning state: if the user passes state.columnPinning
|
|
4552
|
-
// directly (controlled mode), we still need to ensure that the checkbox column
|
|
4553
|
-
// is always at the front of the start-pinned group, just like we do for initialState.
|
|
4554
|
-
const assembledColumnPinning = definedTableOptions.state.columnPinning;
|
|
4555
|
-
if (assembledColumnPinning && !!definedTableOptions.enableRowSelection) {
|
|
4556
|
-
definedTableOptions.state = {
|
|
4557
|
-
...definedTableOptions.state,
|
|
4558
|
-
columnPinning: getDefaultColumnPinningState(definedTableOptions, assembledColumnPinning)
|
|
4559
|
-
};
|
|
4560
|
-
}
|
|
4561
|
-
|
|
4562
4440
|
//The table options now include all state needed to help determine column visibility and order logic
|
|
4563
4441
|
const statefulTableOptions = definedTableOptions;
|
|
4564
4442
|
|
|
4565
4443
|
// Keep mrt-row-expand locked to its slot (right after the checkbox, or
|
|
4566
4444
|
// first if there's no checkbox) regardless of what columnOrder the
|
|
4567
|
-
// consumer passes in
|
|
4445
|
+
// consumer passes in.
|
|
4568
4446
|
statefulTableOptions.state = {
|
|
4569
4447
|
...statefulTableOptions.state,
|
|
4570
4448
|
columnOrder: normalizeRowExpandColumnOrder(statefulTableOptions, statefulTableOptions.state.columnOrder)
|
|
@@ -4576,6 +4454,12 @@ const useMRT_TableInstance = definedTableOptions => {
|
|
|
4576
4454
|
//recompute (and recreate every cell of every row) on unrelated renders
|
|
4577
4455
|
//like hover, menu open/close, or density toggle
|
|
4578
4456
|
const rawColumns = statefulTableOptions.columns;
|
|
4457
|
+
// Snapshot of "no explicit size" must be taken here, on the raw user-authored
|
|
4458
|
+
// columns — prepareColumns/constructColumn below backfill MRT_DefaultColumn.size
|
|
4459
|
+
// into columnDef.size for any column that didn't provide one, after which the
|
|
4460
|
+
// distinction MRT_AutoSizeColumnsEffect needs is gone. Memoized on rawColumns so
|
|
4461
|
+
// it's recomputed only when the column array itself actually changes.
|
|
4462
|
+
autoSizeColumnIdsRef.current = useMemo(() => getAutoSizeCandidateColumnIds(rawColumns), [rawColumns]);
|
|
4579
4463
|
const {
|
|
4580
4464
|
defaultDisplayColumn,
|
|
4581
4465
|
displayColumnDefOptions,
|
|
@@ -4673,6 +4557,8 @@ const useMRT_TableInstance = definedTableOptions => {
|
|
|
4673
4557
|
table.refs = {
|
|
4674
4558
|
actionCellRef,
|
|
4675
4559
|
allSelectableRowIdsRef,
|
|
4560
|
+
autoSizeColumnIdsRef,
|
|
4561
|
+
autoSizedColumnWidthsRef,
|
|
4676
4562
|
bottomToolbarRef,
|
|
4677
4563
|
editInputRefs,
|
|
4678
4564
|
isResizingRef,
|
|
@@ -4717,7 +4603,7 @@ const useMRT_TableInstance = definedTableOptions => {
|
|
|
4717
4603
|
// setRowsState updater in tableCrudFns.ts), not at memo-creation time — so
|
|
4718
4604
|
// this memo doesn't need pagination as a dependency at all, keeping it
|
|
4719
4605
|
// stable across pagination changes instead of rebuilding every page turn.
|
|
4720
|
-
const getPageSize = useCallback(() => table.store.state.pagination.pageSize, [table]);
|
|
4606
|
+
const getPageSize = useCallback(() => table.options.enablePagination ? table.store.state.pagination.pageSize : undefined, [table]);
|
|
4721
4607
|
const crudHandlers = useMemo(() => {
|
|
4722
4608
|
const context = {
|
|
4723
4609
|
getRowId: resolveRowId,
|
|
@@ -4861,6 +4747,41 @@ const useMRT_Rows = table => {
|
|
|
4861
4747
|
return rows;
|
|
4862
4748
|
};
|
|
4863
4749
|
|
|
4750
|
+
/** Shared by row rendering, virtualization, and initial server batch sizing. */
|
|
4751
|
+
const getDefaultRowHeight = density => density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
|
|
4752
|
+
const getViewportRowCount = ({
|
|
4753
|
+
containerHeight,
|
|
4754
|
+
headerHeight = 0,
|
|
4755
|
+
footerHeight = 0,
|
|
4756
|
+
density,
|
|
4757
|
+
estimatedRowHeight
|
|
4758
|
+
}) => {
|
|
4759
|
+
if (!Number.isFinite(containerHeight) || containerHeight <= 0) return undefined;
|
|
4760
|
+
const rowHeight = estimatedRowHeight && Number.isFinite(estimatedRowHeight) && estimatedRowHeight > 0 ? estimatedRowHeight : getDefaultRowHeight(density);
|
|
4761
|
+
return Math.max(1, Math.ceil(Math.max(0, containerHeight - headerHeight - footerHeight) / rowHeight));
|
|
4762
|
+
};
|
|
4763
|
+
|
|
4764
|
+
/** Ghost placeholders and detail panels must not stand in for real data rows. */
|
|
4765
|
+
const measureBodyRowHeight = tableElement => {
|
|
4766
|
+
let height = Infinity;
|
|
4767
|
+
tableElement?.querySelectorAll('tbody tr[data-testid^="body-row-"]').forEach(row => {
|
|
4768
|
+
const measured = row.getBoundingClientRect().height;
|
|
4769
|
+
if (Number.isFinite(measured) && measured > 0) height = Math.min(height, measured);
|
|
4770
|
+
});
|
|
4771
|
+
// With variable-height content the shortest rendered row is the safe estimate:
|
|
4772
|
+
// taller rows consume more space, so this still fetches enough for one view.
|
|
4773
|
+
return height === Infinity ? undefined : height;
|
|
4774
|
+
};
|
|
4775
|
+
|
|
4776
|
+
/** Identical density spacing for the real table and its loading skeleton. */
|
|
4777
|
+
const getDensityStyles = density => ({
|
|
4778
|
+
'--mrt-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '1rem' : '1.5rem',
|
|
4779
|
+
'--mrt-display-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '0.5rem 0.75rem' : '1rem 1.25rem',
|
|
4780
|
+
'--mrt-head-display-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '0.75rem' : '1rem 1.25rem',
|
|
4781
|
+
'--mrt-head-cell-pb': density === 'compact' ? '0.1rem' : '0.6rem',
|
|
4782
|
+
'--mrt-head-cell-pt': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '.75rem' : '1.25rem'
|
|
4783
|
+
});
|
|
4784
|
+
|
|
4864
4785
|
const useMRT_RowVirtualizer = (table, rows) => {
|
|
4865
4786
|
const {
|
|
4866
4787
|
getRowModel,
|
|
@@ -4898,7 +4819,7 @@ const useMRT_RowVirtualizer = (table, rows) => {
|
|
|
4898
4819
|
//matches the defaultRowHeight assumption in MRT_TableBodyRow so the
|
|
4899
4820
|
//initial estimate (before measureElement corrects it for dynamic content)
|
|
4900
4821
|
//doesn't cause scroll-position drift
|
|
4901
|
-
const normalRowHeight = density
|
|
4822
|
+
const normalRowHeight = getDefaultRowHeight(density);
|
|
4902
4823
|
const rangeExtractor = useCallback(range => extraIndexRangeExtractor(range, draggingRowIndex), [draggingRowIndex]);
|
|
4903
4824
|
|
|
4904
4825
|
// enableRowVirtualization can't change after mount (frozen in
|
|
@@ -5202,7 +5123,7 @@ const MRT_ActiveFilterItemContainer = t0 => {
|
|
|
5202
5123
|
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
5203
5124
|
t6 = {
|
|
5204
5125
|
alignItems: "center",
|
|
5205
|
-
border: _temp$
|
|
5126
|
+
border: _temp$v,
|
|
5206
5127
|
borderRadius: 1,
|
|
5207
5128
|
display: "flex",
|
|
5208
5129
|
gap: 0.5
|
|
@@ -5327,7 +5248,7 @@ const MRT_ActiveFilterItemContainer = t0 => {
|
|
|
5327
5248
|
return t17;
|
|
5328
5249
|
};
|
|
5329
5250
|
var MRT_ActiveFilterItemContainer$1 = MRT_ActiveFilterItemContainer;
|
|
5330
|
-
function _temp$
|
|
5251
|
+
function _temp$v(theme) {
|
|
5331
5252
|
return `1px dashed ${theme.palette.divider}`;
|
|
5332
5253
|
}
|
|
5333
5254
|
|
|
@@ -5390,7 +5311,7 @@ const MRT_FreeMultiValueEditor = t0 => {
|
|
|
5390
5311
|
value: displayValues,
|
|
5391
5312
|
onChange: handleChange,
|
|
5392
5313
|
size: "small",
|
|
5393
|
-
renderTags: _temp$
|
|
5314
|
+
renderTags: _temp$u,
|
|
5394
5315
|
renderInput: _temp2$a
|
|
5395
5316
|
});
|
|
5396
5317
|
$[6] = displayValues;
|
|
@@ -5401,7 +5322,7 @@ const MRT_FreeMultiValueEditor = t0 => {
|
|
|
5401
5322
|
}
|
|
5402
5323
|
return t4;
|
|
5403
5324
|
};
|
|
5404
|
-
function _temp$
|
|
5325
|
+
function _temp$u(value, getTagProps) {
|
|
5405
5326
|
return value.map((option, index) => {
|
|
5406
5327
|
const {
|
|
5407
5328
|
key,
|
|
@@ -5482,7 +5403,7 @@ const MRT_MultiValueEditor = t0 => {
|
|
|
5482
5403
|
}
|
|
5483
5404
|
let t5;
|
|
5484
5405
|
if ($[8] !== options) {
|
|
5485
|
-
t5 = options.map(_temp$
|
|
5406
|
+
t5 = options.map(_temp$t);
|
|
5486
5407
|
$[8] = options;
|
|
5487
5408
|
$[9] = t5;
|
|
5488
5409
|
} else {
|
|
@@ -5512,7 +5433,7 @@ const MRT_MultiValueEditor = t0 => {
|
|
|
5512
5433
|
}
|
|
5513
5434
|
return t6;
|
|
5514
5435
|
};
|
|
5515
|
-
function _temp$
|
|
5436
|
+
function _temp$t(option) {
|
|
5516
5437
|
const {
|
|
5517
5438
|
label,
|
|
5518
5439
|
value
|
|
@@ -5879,7 +5800,7 @@ const MRT_SingleValueEditor = t0 => {
|
|
|
5879
5800
|
const t6 = options?.length ? undefined : inputType;
|
|
5880
5801
|
let t7;
|
|
5881
5802
|
if ($[9] !== options) {
|
|
5882
|
-
t7 = options?.map(_temp$
|
|
5803
|
+
t7 = options?.map(_temp$s);
|
|
5883
5804
|
$[9] = options;
|
|
5884
5805
|
$[10] = t7;
|
|
5885
5806
|
} else {
|
|
@@ -5913,7 +5834,7 @@ const MRT_SingleValueEditor = t0 => {
|
|
|
5913
5834
|
}
|
|
5914
5835
|
return t8;
|
|
5915
5836
|
};
|
|
5916
|
-
function _temp$
|
|
5837
|
+
function _temp$s(option) {
|
|
5917
5838
|
const {
|
|
5918
5839
|
label,
|
|
5919
5840
|
value
|
|
@@ -6147,7 +6068,7 @@ const MRT_FilterRuleNumberEditor = props => {
|
|
|
6147
6068
|
t0 = /*#__PURE__*/jsx(MRT_SingleValueEditor, {
|
|
6148
6069
|
...props,
|
|
6149
6070
|
inputType: "number",
|
|
6150
|
-
transformValue: _temp$
|
|
6071
|
+
transformValue: _temp$r,
|
|
6151
6072
|
valueFormatter: _temp2$9
|
|
6152
6073
|
});
|
|
6153
6074
|
$[0] = props;
|
|
@@ -6197,8 +6118,8 @@ const MRT_FilterRuleBooleanEditor = props => {
|
|
|
6197
6118
|
t3 = /*#__PURE__*/jsx(MRT_SingleValueEditor, {
|
|
6198
6119
|
...props,
|
|
6199
6120
|
options: t2,
|
|
6200
|
-
transformValue: _temp3$
|
|
6201
|
-
valueFormatter: _temp4$
|
|
6121
|
+
transformValue: _temp3$4,
|
|
6122
|
+
valueFormatter: _temp4$1
|
|
6202
6123
|
});
|
|
6203
6124
|
$[7] = props;
|
|
6204
6125
|
$[8] = t2;
|
|
@@ -6390,16 +6311,16 @@ const MRT_FilterRuleMultiNumberEditor = props => {
|
|
|
6390
6311
|
}
|
|
6391
6312
|
return t0;
|
|
6392
6313
|
};
|
|
6393
|
-
function _temp$
|
|
6314
|
+
function _temp$r(value) {
|
|
6394
6315
|
return value === "" ? "" : Number(value);
|
|
6395
6316
|
}
|
|
6396
6317
|
function _temp2$9(value_0) {
|
|
6397
6318
|
return value_0 === undefined || value_0 === null || value_0 === "" ? "" : String(value_0);
|
|
6398
6319
|
}
|
|
6399
|
-
function _temp3$
|
|
6320
|
+
function _temp3$4(value) {
|
|
6400
6321
|
return value === "true" ? true : value === "false" ? false : "";
|
|
6401
6322
|
}
|
|
6402
|
-
function _temp4$
|
|
6323
|
+
function _temp4$1(value_0) {
|
|
6403
6324
|
return value_0 === true ? "true" : value_0 === false ? "false" : "";
|
|
6404
6325
|
}
|
|
6405
6326
|
function _temp5$1(n) {
|
|
@@ -7227,7 +7148,7 @@ const MRT_FormEnumInput = t0 => {
|
|
|
7227
7148
|
onChange: e => handleChange(e.target.value),
|
|
7228
7149
|
renderValue: renderSelectedValue,
|
|
7229
7150
|
value: currentValue,
|
|
7230
|
-
children: enumOptions.map(_temp$
|
|
7151
|
+
children: enumOptions.map(_temp$q)
|
|
7231
7152
|
}), (fieldState.error?.message || fieldConfig?.helperText) && /*#__PURE__*/jsx(FormHelperText, {
|
|
7232
7153
|
children: fieldState.error?.message ?? fieldConfig?.helperText
|
|
7233
7154
|
})]
|
|
@@ -7259,7 +7180,7 @@ const MRT_FormEnumInput = t0 => {
|
|
|
7259
7180
|
}
|
|
7260
7181
|
return t4;
|
|
7261
7182
|
};
|
|
7262
|
-
function _temp$
|
|
7183
|
+
function _temp$q(option_0) {
|
|
7263
7184
|
return /*#__PURE__*/jsx(MenuItem, {
|
|
7264
7185
|
value: option_0.value,
|
|
7265
7186
|
children: option_0.label
|
|
@@ -9495,7 +9416,7 @@ const useMRT_AdvancedFiltersDraft = table => {
|
|
|
9495
9416
|
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
9496
9417
|
t7 = () => {
|
|
9497
9418
|
isDraftDirty.current = false;
|
|
9498
|
-
setDraftFilters(_temp$
|
|
9419
|
+
setDraftFilters(_temp$p);
|
|
9499
9420
|
};
|
|
9500
9421
|
$[13] = t7;
|
|
9501
9422
|
} else {
|
|
@@ -9683,7 +9604,7 @@ const useMRT_AdvancedFiltersDraft = table => {
|
|
|
9683
9604
|
}
|
|
9684
9605
|
return t17;
|
|
9685
9606
|
};
|
|
9686
|
-
function _temp$
|
|
9607
|
+
function _temp$p(current_0) {
|
|
9687
9608
|
return {
|
|
9688
9609
|
...getDefaultFiltersState(),
|
|
9689
9610
|
pinnedFilters: current_0.pinnedFilters
|
|
@@ -9744,7 +9665,7 @@ const MRT_AdvancedFiltersContent = t0 => {
|
|
|
9744
9665
|
if ($[2] !== clearRules || $[3] !== handleClose || $[4] !== setFilters) {
|
|
9745
9666
|
t4 = () => {
|
|
9746
9667
|
clearRules();
|
|
9747
|
-
setFilters(_temp$
|
|
9668
|
+
setFilters(_temp$o);
|
|
9748
9669
|
handleClose();
|
|
9749
9670
|
};
|
|
9750
9671
|
$[2] = clearRules;
|
|
@@ -9954,7 +9875,7 @@ const MRT_AdvancedFiltersContent = t0 => {
|
|
|
9954
9875
|
display: "flex",
|
|
9955
9876
|
justifyContent: "center",
|
|
9956
9877
|
sx: {
|
|
9957
|
-
border: _temp3$
|
|
9878
|
+
border: _temp3$3,
|
|
9958
9879
|
borderRadius: 2,
|
|
9959
9880
|
flex: 1,
|
|
9960
9881
|
minHeight: 140,
|
|
@@ -10152,7 +10073,7 @@ const MRT_AdvancedFilters = t0 => {
|
|
|
10152
10073
|
}
|
|
10153
10074
|
return t1;
|
|
10154
10075
|
};
|
|
10155
|
-
function _temp$
|
|
10076
|
+
function _temp$o(current) {
|
|
10156
10077
|
return {
|
|
10157
10078
|
...getDefaultFiltersState(),
|
|
10158
10079
|
pinnedFilters: current.pinnedFilters
|
|
@@ -10161,11 +10082,12 @@ function _temp$n(current) {
|
|
|
10161
10082
|
function _temp2$8(theme) {
|
|
10162
10083
|
return theme.zIndex.drawer + 1;
|
|
10163
10084
|
}
|
|
10164
|
-
function _temp3$
|
|
10085
|
+
function _temp3$3(theme_0) {
|
|
10165
10086
|
return `1px dashed ${theme_0.palette.divider}`;
|
|
10166
10087
|
}
|
|
10167
10088
|
|
|
10168
10089
|
const MRT_Localization_HR = {
|
|
10090
|
+
retryLoading: 'Pokušaj ponovo',
|
|
10169
10091
|
language: 'hr',
|
|
10170
10092
|
actions: 'Radnje',
|
|
10171
10093
|
and: 'i',
|
|
@@ -10364,7 +10286,7 @@ const MaterialReactServerTableError = t0 => {
|
|
|
10364
10286
|
let t3;
|
|
10365
10287
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10366
10288
|
t3 = /*#__PURE__*/jsx(Box, {
|
|
10367
|
-
sx: _temp$
|
|
10289
|
+
sx: _temp$n,
|
|
10368
10290
|
children: /*#__PURE__*/jsx(ErrorOutlineRoundedIcon, {
|
|
10369
10291
|
sx: {
|
|
10370
10292
|
fontSize: "2.25rem"
|
|
@@ -10440,7 +10362,7 @@ const MaterialReactServerTableError = t0 => {
|
|
|
10440
10362
|
}
|
|
10441
10363
|
return t10;
|
|
10442
10364
|
};
|
|
10443
|
-
function _temp$
|
|
10365
|
+
function _temp$n(theme) {
|
|
10444
10366
|
return {
|
|
10445
10367
|
alignItems: "center",
|
|
10446
10368
|
backgroundColor: theme.palette.error.main + "14",
|
|
@@ -10453,39 +10375,227 @@ function _temp$m(theme) {
|
|
|
10453
10375
|
};
|
|
10454
10376
|
}
|
|
10455
10377
|
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10378
|
+
const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
|
|
10379
|
+
|
|
10380
|
+
/** Choose the smallest offered page size that covers the viewport. */
|
|
10381
|
+
const getInfinitePageSize = (visibleRowCount, options = defaultRowsPerPage, fallback = 10) => {
|
|
10382
|
+
if (visibleRowCount === undefined) return fallback;
|
|
10383
|
+
const sizes = [...new Set(options.map(option => typeof option === 'number' ? option : option.value))].filter(size => Number.isInteger(size) && size > 0).sort((a, b) => a - b);
|
|
10384
|
+
return sizes.find(size => size >= visibleRowCount) ?? sizes.at(-1) ?? fallback;
|
|
10385
|
+
};
|
|
10386
|
+
|
|
10387
|
+
/** Owns request sequencing; the table remains the sole owner of loaded rows. */
|
|
10388
|
+
const useMRT_ServerDataLoader = ({
|
|
10389
|
+
table,
|
|
10390
|
+
loadData,
|
|
10391
|
+
paginationMode,
|
|
10392
|
+
fetchTrigger,
|
|
10393
|
+
onResult,
|
|
10394
|
+
onLoadingChange,
|
|
10395
|
+
onLoaded
|
|
10396
|
+
}) => {
|
|
10397
|
+
const measuredRowHeights = useRef({});
|
|
10398
|
+
const [error, setError] = useState(false);
|
|
10399
|
+
const [revision, setRevision] = useState(0);
|
|
10400
|
+
const latest = useRef({
|
|
10401
|
+
table,
|
|
10402
|
+
loadData,
|
|
10403
|
+
onResult,
|
|
10404
|
+
onLoadingChange,
|
|
10405
|
+
onLoaded
|
|
10406
|
+
});
|
|
10407
|
+
latest.current = {
|
|
10408
|
+
table,
|
|
10409
|
+
loadData,
|
|
10410
|
+
onResult,
|
|
10411
|
+
onLoadingChange,
|
|
10412
|
+
onLoaded
|
|
10413
|
+
};
|
|
10414
|
+
const request = useRef({
|
|
10415
|
+
generation: 0,
|
|
10416
|
+
pending: false,
|
|
10417
|
+
nextPage: 0,
|
|
10418
|
+
ready: false,
|
|
10419
|
+
hasMore: true,
|
|
10420
|
+
failed: false
|
|
10421
|
+
});
|
|
10422
|
+
const infinite = paginationMode === 'infinite';
|
|
10423
|
+
const {
|
|
10424
|
+
pageIndex,
|
|
10425
|
+
pageSize
|
|
10426
|
+
} = fetchTrigger.pagination;
|
|
10427
|
+
const fetchPage = useCallback(async () => {
|
|
10428
|
+
const current = request.current;
|
|
10429
|
+
if (!current.ready || current.pending || !current.hasMore) return;
|
|
10430
|
+
current.pending = true;
|
|
10431
|
+
current.failed = false;
|
|
10432
|
+
setError(false);
|
|
10433
|
+
latest.current.onLoadingChange(true);
|
|
10434
|
+
const generation = current.generation;
|
|
10435
|
+
const page = current.nextPage;
|
|
10436
|
+
const snapshot = latest.current.table.getState();
|
|
10437
|
+
try {
|
|
10438
|
+
const result = await latest.current.loadData({
|
|
10439
|
+
...snapshot,
|
|
10440
|
+
pagination: {
|
|
10441
|
+
pageIndex: page,
|
|
10442
|
+
pageSize: snapshot.pagination.pageSize
|
|
10443
|
+
}
|
|
10444
|
+
});
|
|
10445
|
+
if (request.current.generation !== generation) return;
|
|
10446
|
+
const target = latest.current.table;
|
|
10447
|
+
const previous = infinite && page > 0 ? target.options.data ?? [] : [];
|
|
10448
|
+
// Keep order stable while replacing duplicate IDs with the latest data.
|
|
10449
|
+
const rows = new Map(previous.map(row => [row.id, row]));
|
|
10450
|
+
result.data.forEach(row_0 => rows.set(row_0.id, row_0));
|
|
10451
|
+
target.setRows(infinite ? Array.from(rows.values()) : result.data);
|
|
10452
|
+
current.nextPage = page + 1;
|
|
10453
|
+
current.hasMore = infinite && result.data.length > 0 && (page === 0 || rows.size > previous.length) && (result.hasNextPage ?? rows.size < result.rowCount);
|
|
10454
|
+
latest.current.onResult(result);
|
|
10455
|
+
latest.current.onLoaded();
|
|
10456
|
+
} catch {
|
|
10457
|
+
if (request.current.generation !== generation) return;
|
|
10458
|
+
current.failed = true;
|
|
10459
|
+
setError(true);
|
|
10460
|
+
} finally {
|
|
10461
|
+
if (request.current.generation === generation) {
|
|
10462
|
+
current.pending = false;
|
|
10463
|
+
latest.current.onLoadingChange(false);
|
|
10464
|
+
setRevision(value => value + 1);
|
|
10465
|
+
}
|
|
10466
|
+
}
|
|
10467
|
+
}, [infinite]);
|
|
10468
|
+
|
|
10469
|
+
// A different viewport/density can choose a different offered size. Restart
|
|
10470
|
+
// at page zero in that case so pageIndex * pageSize stays valid.
|
|
10471
|
+
const syncPageSize = useCallback(() => {
|
|
10472
|
+
if (!infinite) return false;
|
|
10473
|
+
const target_0 = latest.current.table;
|
|
10474
|
+
const currentSize = target_0.getState().pagination.pageSize;
|
|
10475
|
+
const density = target_0.getState().density;
|
|
10476
|
+
const measuredHeight = target_0.getState().showSkeletons !== true && target_0.options.data?.length ? measureBodyRowHeight(target_0.refs.tableRef.current) : undefined;
|
|
10477
|
+
if (measuredHeight !== undefined) measuredRowHeights.current[density] = measuredHeight;
|
|
10478
|
+
const virtualizerOptions = parseFromValuesOrFunc(target_0.options.rowVirtualizerOptions, {
|
|
10479
|
+
table: target_0
|
|
10480
|
+
});
|
|
10481
|
+
const paginationProps = parseFromValuesOrFunc(target_0.options.muiPaginationProps, {
|
|
10482
|
+
table: target_0
|
|
10483
|
+
});
|
|
10484
|
+
const size = getInfinitePageSize(getViewportRowCount({
|
|
10485
|
+
containerHeight: target_0.refs.tableContainerRef.current?.clientHeight ?? 0,
|
|
10486
|
+
headerHeight: target_0.refs.tableHeadRef.current?.offsetHeight ?? 0,
|
|
10487
|
+
footerHeight: target_0.refs.tableFooterRef.current?.offsetHeight ?? 0,
|
|
10488
|
+
density,
|
|
10489
|
+
estimatedRowHeight: measuredRowHeights.current[density] ?? virtualizerOptions?.estimateSize?.(0)
|
|
10490
|
+
}), paginationProps?.rowsPerPageOptions, currentSize);
|
|
10491
|
+
if (size === currentSize) return false;
|
|
10492
|
+
request.current.ready = false;
|
|
10493
|
+
request.current.generation += 1;
|
|
10494
|
+
target_0.setPagination({
|
|
10495
|
+
pageIndex: 0,
|
|
10496
|
+
pageSize: size
|
|
10497
|
+
});
|
|
10498
|
+
return true;
|
|
10499
|
+
}, [infinite]);
|
|
10500
|
+
const density_0 = table.getState().density;
|
|
10501
|
+
useEffect(() => {
|
|
10502
|
+
syncPageSize();
|
|
10503
|
+
}, [density_0, syncPageSize]);
|
|
10504
|
+
|
|
10505
|
+
// Query changes invalidate all older requests, including their finally blocks.
|
|
10506
|
+
const visiblePage = infinite ? 0 : pageIndex;
|
|
10507
|
+
useEffect(() => {
|
|
10508
|
+
const target_1 = latest.current.table;
|
|
10509
|
+
if (syncPageSize()) return;
|
|
10510
|
+
request.current = {
|
|
10511
|
+
generation: request.current.generation + 1,
|
|
10512
|
+
pending: false,
|
|
10513
|
+
nextPage: visiblePage,
|
|
10514
|
+
ready: true,
|
|
10515
|
+
hasMore: true,
|
|
10516
|
+
failed: false
|
|
10517
|
+
};
|
|
10518
|
+
if (infinite) {
|
|
10519
|
+
target_1.setRows([]);
|
|
10520
|
+
if (target_1.getState().pagination.pageIndex !== 0) target_1.setPageIndex(0);
|
|
10521
|
+
const node = target_1.refs.tableContainerRef.current;
|
|
10522
|
+
if (node) node.scrollTop = 0;
|
|
10523
|
+
target_1.options.rowVirtualizerInstanceRef?.current?.scrollToIndex(0);
|
|
10524
|
+
}
|
|
10525
|
+
void fetchPage();
|
|
10526
|
+
return () => {
|
|
10527
|
+
request.current.generation += 1;
|
|
10528
|
+
};
|
|
10529
|
+
}, [fetchPage, syncPageSize, loadData, infinite, visiblePage, pageSize, fetchTrigger.filterRules, fetchTrigger.sorting, fetchTrigger.columnVisibilityShowTrigger, fetchTrigger.refetchIndex]);
|
|
10530
|
+
const loadMore = useCallback(() => {
|
|
10531
|
+
if (infinite && !request.current.failed) void fetchPage();
|
|
10532
|
+
}, [fetchPage, infinite]);
|
|
10533
|
+
const checkScroll = useCallback(node_0 => {
|
|
10534
|
+
if (node_0 && node_0.clientHeight > 0 && node_0.scrollHeight - node_0.scrollTop - node_0.clientHeight < 200) loadMore();
|
|
10535
|
+
}, [loadMore]);
|
|
10536
|
+
useEffect(() => {
|
|
10537
|
+
if (!infinite) return;
|
|
10538
|
+
const node_1 = latest.current.table.refs.tableContainerRef.current;
|
|
10539
|
+
const observer = new ResizeObserver(() => {
|
|
10540
|
+
if (!syncPageSize() && node_1 && node_1.scrollHeight <= node_1.clientHeight) checkScroll(node_1);
|
|
10541
|
+
});
|
|
10542
|
+
if (node_1) observer.observe(node_1);
|
|
10543
|
+
const target_2 = latest.current.table;
|
|
10544
|
+
// The same observer also catches content/font/density changes without
|
|
10545
|
+
// adding an observer per row. A new body is attached after each data update.
|
|
10546
|
+
const body = target_2.refs.tableRef.current?.querySelector('tbody');
|
|
10547
|
+
if (body) observer.observe(body);
|
|
10548
|
+
if (target_2.refs.tableHeadRef.current) observer.observe(target_2.refs.tableHeadRef.current);
|
|
10549
|
+
if (target_2.refs.tableFooterRef.current) observer.observe(target_2.refs.tableFooterRef.current);
|
|
10550
|
+
return () => observer.disconnect();
|
|
10551
|
+
}, [checkScroll, infinite, syncPageSize, revision]);
|
|
10552
|
+
useEffect(() => {
|
|
10553
|
+
if (!infinite) return;
|
|
10554
|
+
const node_2 = latest.current.table.refs.tableContainerRef.current;
|
|
10555
|
+
// Correct the density estimate once real row heights become measurable.
|
|
10556
|
+
// Cached heights survive setRows([]), preventing estimate/measurement loops.
|
|
10557
|
+
if (!syncPageSize() && node_2 && node_2.scrollHeight <= node_2.clientHeight) checkScroll(node_2);
|
|
10558
|
+
}, [checkScroll, infinite, syncPageSize, revision]);
|
|
10559
|
+
return {
|
|
10560
|
+
error,
|
|
10561
|
+
checkScroll,
|
|
10562
|
+
retry: fetchPage
|
|
10563
|
+
};
|
|
10564
|
+
};
|
|
10565
|
+
|
|
10566
|
+
function RowActionsCell(t0) {
|
|
10567
|
+
const $ = c(6);
|
|
10568
|
+
const {
|
|
10569
|
+
row,
|
|
10570
|
+
table
|
|
10571
|
+
} = t0;
|
|
10572
|
+
const {
|
|
10573
|
+
actions
|
|
10574
|
+
} = table.options;
|
|
10575
|
+
let t1;
|
|
10576
|
+
if ($[0] !== actions || $[1] !== row || $[2] !== table) {
|
|
10577
|
+
t1 = actions?.map(action => /*#__PURE__*/jsx(Fragment$1, {
|
|
10578
|
+
children: action.renderRow?.({
|
|
10579
|
+
row,
|
|
10580
|
+
table
|
|
10581
|
+
})
|
|
10582
|
+
}, action.name));
|
|
10583
|
+
$[0] = actions;
|
|
10584
|
+
$[1] = row;
|
|
10585
|
+
$[2] = table;
|
|
10586
|
+
$[3] = t1;
|
|
10587
|
+
} else {
|
|
10588
|
+
t1 = $[3];
|
|
10589
|
+
}
|
|
10590
|
+
let t2;
|
|
10591
|
+
if ($[4] !== t1) {
|
|
10592
|
+
t2 = /*#__PURE__*/jsx(Box, {
|
|
10593
|
+
children: t1
|
|
10594
|
+
});
|
|
10595
|
+
$[4] = t1;
|
|
10596
|
+
$[5] = t2;
|
|
10597
|
+
} else {
|
|
10598
|
+
t2 = $[5];
|
|
10489
10599
|
}
|
|
10490
10600
|
return t2;
|
|
10491
10601
|
}
|
|
@@ -10638,7 +10748,7 @@ const MRT_ActiveFilters = t0 => {
|
|
|
10638
10748
|
let t3;
|
|
10639
10749
|
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
10640
10750
|
t3 = {
|
|
10641
|
-
borderBottom: _temp$
|
|
10751
|
+
borderBottom: _temp$m
|
|
10642
10752
|
};
|
|
10643
10753
|
$[4] = t3;
|
|
10644
10754
|
} else {
|
|
@@ -10677,7 +10787,7 @@ const MRT_ActiveFilters = t0 => {
|
|
|
10677
10787
|
}
|
|
10678
10788
|
return t1;
|
|
10679
10789
|
};
|
|
10680
|
-
function _temp$
|
|
10790
|
+
function _temp$m(theme) {
|
|
10681
10791
|
return `1px solid ${theme.palette.divider}`;
|
|
10682
10792
|
}
|
|
10683
10793
|
|
|
@@ -10719,7 +10829,7 @@ const MRT_LinearProgressBar = t0 => {
|
|
|
10719
10829
|
const {
|
|
10720
10830
|
isSaving
|
|
10721
10831
|
} = t2;
|
|
10722
|
-
const showProgressBars = useSelector(table.store, _temp$
|
|
10832
|
+
const showProgressBars = useSelector(table.store, _temp$l);
|
|
10723
10833
|
let t3;
|
|
10724
10834
|
if ($[6] !== isTopToolbar || $[7] !== muiLinearProgressProps || $[8] !== table) {
|
|
10725
10835
|
t3 = parseFromValuesOrFunc(muiLinearProgressProps, {
|
|
@@ -10803,7 +10913,7 @@ const MRT_LinearProgressBar = t0 => {
|
|
|
10803
10913
|
}
|
|
10804
10914
|
return t11;
|
|
10805
10915
|
};
|
|
10806
|
-
function _temp$
|
|
10916
|
+
function _temp$l(state) {
|
|
10807
10917
|
return state.showProgressBars;
|
|
10808
10918
|
}
|
|
10809
10919
|
|
|
@@ -10856,7 +10966,7 @@ const MRT_SelectionCountBadge = t0 => {
|
|
|
10856
10966
|
let t3;
|
|
10857
10967
|
if ($[2] !== t2 || $[3] !== table.atoms.rowSelection) {
|
|
10858
10968
|
t3 = /*#__PURE__*/jsx(Subscribe, {
|
|
10859
|
-
selector: _temp$
|
|
10969
|
+
selector: _temp$k,
|
|
10860
10970
|
source: table.atoms.rowSelection,
|
|
10861
10971
|
children: t2
|
|
10862
10972
|
});
|
|
@@ -10868,11 +10978,10 @@ const MRT_SelectionCountBadge = t0 => {
|
|
|
10868
10978
|
}
|
|
10869
10979
|
return t3;
|
|
10870
10980
|
};
|
|
10871
|
-
function _temp$
|
|
10981
|
+
function _temp$k(rowSelection) {
|
|
10872
10982
|
return Object.values(rowSelection).filter(Boolean).length;
|
|
10873
10983
|
}
|
|
10874
10984
|
|
|
10875
|
-
const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
|
|
10876
10985
|
const isPaginationItemColor = color => color === 'primary' || color === 'secondary' || color === 'standard';
|
|
10877
10986
|
const MRT_TablePagination = ({
|
|
10878
10987
|
position = 'bottom',
|
|
@@ -11154,7 +11263,7 @@ const MRT_ToolbarDropZone = t0 => {
|
|
|
11154
11263
|
showToolbarDropZone,
|
|
11155
11264
|
draggingColumn,
|
|
11156
11265
|
hoveredColumn
|
|
11157
|
-
} = useSelector(table.store, _temp$
|
|
11266
|
+
} = useSelector(table.store, _temp$j);
|
|
11158
11267
|
let t3;
|
|
11159
11268
|
if ($[5] !== setHoveredColumn) {
|
|
11160
11269
|
t3 = _event => {
|
|
@@ -11270,7 +11379,7 @@ const MRT_ToolbarDropZone = t0 => {
|
|
|
11270
11379
|
}
|
|
11271
11380
|
return t10;
|
|
11272
11381
|
};
|
|
11273
|
-
function _temp$
|
|
11382
|
+
function _temp$j(state) {
|
|
11274
11383
|
return {
|
|
11275
11384
|
showToolbarDropZone: state.showToolbarDropZone,
|
|
11276
11385
|
draggingColumn: state.draggingColumn,
|
|
@@ -11690,7 +11799,7 @@ const MRT_QuickFilterItem = t0 => {
|
|
|
11690
11799
|
onClick: handleUnpin,
|
|
11691
11800
|
size: "small",
|
|
11692
11801
|
sx: {
|
|
11693
|
-
backgroundColor: _temp$
|
|
11802
|
+
backgroundColor: _temp$i,
|
|
11694
11803
|
color: _temp2$6,
|
|
11695
11804
|
width: 18,
|
|
11696
11805
|
height: 18,
|
|
@@ -11699,7 +11808,7 @@ const MRT_QuickFilterItem = t0 => {
|
|
|
11699
11808
|
top: 8,
|
|
11700
11809
|
zIndex: 1,
|
|
11701
11810
|
"&:hover": {
|
|
11702
|
-
backgroundColor: _temp3$
|
|
11811
|
+
backgroundColor: _temp3$2
|
|
11703
11812
|
}
|
|
11704
11813
|
},
|
|
11705
11814
|
children: /*#__PURE__*/jsx(CloseIcon, {
|
|
@@ -11840,13 +11949,13 @@ const MRT_QuickFiltersBar = t0 => {
|
|
|
11840
11949
|
}
|
|
11841
11950
|
return t1;
|
|
11842
11951
|
};
|
|
11843
|
-
function _temp$
|
|
11952
|
+
function _temp$i(theme) {
|
|
11844
11953
|
return theme.palette.error.main;
|
|
11845
11954
|
}
|
|
11846
11955
|
function _temp2$6(theme_0) {
|
|
11847
11956
|
return theme_0.palette.background.paper;
|
|
11848
11957
|
}
|
|
11849
|
-
function _temp3$
|
|
11958
|
+
function _temp3$2(theme_1) {
|
|
11850
11959
|
return theme_1.palette.error.dark;
|
|
11851
11960
|
}
|
|
11852
11961
|
|
|
@@ -12036,7 +12145,7 @@ function MRT_TableOptionsMenu(t0) {
|
|
|
12036
12145
|
anchorEl: anchorEl,
|
|
12037
12146
|
anchorOrigin: t3,
|
|
12038
12147
|
disableScrollLock: true,
|
|
12039
|
-
onClick: _temp$
|
|
12148
|
+
onClick: _temp$h,
|
|
12040
12149
|
onClose: onClose,
|
|
12041
12150
|
open: open,
|
|
12042
12151
|
transformOrigin: t4,
|
|
@@ -12054,7 +12163,7 @@ function MRT_TableOptionsMenu(t0) {
|
|
|
12054
12163
|
}
|
|
12055
12164
|
return t8;
|
|
12056
12165
|
}
|
|
12057
|
-
function _temp$
|
|
12166
|
+
function _temp$h(event) {
|
|
12058
12167
|
return event.stopPropagation();
|
|
12059
12168
|
}
|
|
12060
12169
|
|
|
@@ -12445,7 +12554,7 @@ const MRT_NewEntryButton = t0 => {
|
|
|
12445
12554
|
};
|
|
12446
12555
|
|
|
12447
12556
|
const MRT_ShowHideColumnsMenuItems = t0 => {
|
|
12448
|
-
const $ = c(
|
|
12557
|
+
const $ = c(47);
|
|
12449
12558
|
let allColumns;
|
|
12450
12559
|
let column;
|
|
12451
12560
|
let hoveredColumn;
|
|
@@ -12518,8 +12627,24 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
|
|
|
12518
12627
|
return null;
|
|
12519
12628
|
}
|
|
12520
12629
|
let t4;
|
|
12521
|
-
if ($[10] !== column
|
|
12522
|
-
t4 =
|
|
12630
|
+
if ($[10] !== column || $[11] !== enableHiding || $[12] !== handleToggleColumnHidden || $[13] !== rest) {
|
|
12631
|
+
t4 = event => {
|
|
12632
|
+
rest?.onClick?.(event);
|
|
12633
|
+
if (enableHiding && column.getCanHide()) {
|
|
12634
|
+
handleToggleColumnHidden(column, column.getIsVisible());
|
|
12635
|
+
}
|
|
12636
|
+
};
|
|
12637
|
+
$[10] = column;
|
|
12638
|
+
$[11] = enableHiding;
|
|
12639
|
+
$[12] = handleToggleColumnHidden;
|
|
12640
|
+
$[13] = rest;
|
|
12641
|
+
$[14] = t4;
|
|
12642
|
+
} else {
|
|
12643
|
+
t4 = $[14];
|
|
12644
|
+
}
|
|
12645
|
+
let t5;
|
|
12646
|
+
if ($[15] !== column.depth || $[16] !== column.id || $[17] !== draggingBorderColor || $[18] !== hoveredColumn?.id || $[19] !== rest?.sx) {
|
|
12647
|
+
t5 = theme => ({
|
|
12523
12648
|
alignItems: "center",
|
|
12524
12649
|
justifyContent: "flex-start",
|
|
12525
12650
|
my: 0,
|
|
@@ -12529,30 +12654,31 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
|
|
|
12529
12654
|
py: "6px",
|
|
12530
12655
|
...parseFromValuesOrFunc(rest?.sx, theme)
|
|
12531
12656
|
});
|
|
12532
|
-
$[
|
|
12533
|
-
$[
|
|
12534
|
-
$[
|
|
12535
|
-
$[
|
|
12536
|
-
$[
|
|
12537
|
-
$[
|
|
12657
|
+
$[15] = column.depth;
|
|
12658
|
+
$[16] = column.id;
|
|
12659
|
+
$[17] = draggingBorderColor;
|
|
12660
|
+
$[18] = hoveredColumn?.id;
|
|
12661
|
+
$[19] = rest?.sx;
|
|
12662
|
+
$[20] = t5;
|
|
12538
12663
|
} else {
|
|
12539
|
-
|
|
12664
|
+
t5 = $[20];
|
|
12540
12665
|
}
|
|
12541
|
-
const
|
|
12542
|
-
let
|
|
12543
|
-
if ($[
|
|
12544
|
-
|
|
12666
|
+
const t6 = `column-show-hide-row-${column.id}`;
|
|
12667
|
+
let t7;
|
|
12668
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
12669
|
+
t7 = {
|
|
12545
12670
|
display: "flex",
|
|
12546
12671
|
flexWrap: "nowrap",
|
|
12547
|
-
gap: "8px"
|
|
12672
|
+
gap: "8px",
|
|
12673
|
+
width: "100%"
|
|
12548
12674
|
};
|
|
12549
|
-
$[
|
|
12675
|
+
$[21] = t7;
|
|
12550
12676
|
} else {
|
|
12551
|
-
|
|
12677
|
+
t7 = $[21];
|
|
12552
12678
|
}
|
|
12553
|
-
let
|
|
12554
|
-
if ($[
|
|
12555
|
-
|
|
12679
|
+
let t8;
|
|
12680
|
+
if ($[22] !== column || $[23] !== columnDef.header || $[24] !== columnDefType || $[25] !== enableHiding || $[26] !== localization || $[27] !== table.atoms) {
|
|
12681
|
+
t8 = enableHiding ? /*#__PURE__*/jsx(Subscribe, {
|
|
12556
12682
|
source: table.atoms.columnVisibility,
|
|
12557
12683
|
children: () => {
|
|
12558
12684
|
const switchChecked = column.getIsVisible();
|
|
@@ -12575,7 +12701,7 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
|
|
|
12575
12701
|
}),
|
|
12576
12702
|
disabled: !column.getCanHide(),
|
|
12577
12703
|
label: columnDef.header,
|
|
12578
|
-
onChange:
|
|
12704
|
+
onChange: _temp$g
|
|
12579
12705
|
});
|
|
12580
12706
|
}
|
|
12581
12707
|
}) : /*#__PURE__*/jsx(Typography, {
|
|
@@ -12584,48 +12710,49 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
|
|
|
12584
12710
|
},
|
|
12585
12711
|
children: columnDef.header
|
|
12586
12712
|
});
|
|
12587
|
-
$[
|
|
12588
|
-
$[
|
|
12589
|
-
$[
|
|
12590
|
-
$[
|
|
12591
|
-
$[
|
|
12592
|
-
$[
|
|
12593
|
-
$[
|
|
12594
|
-
$[24] = t7;
|
|
12595
|
-
} else {
|
|
12596
|
-
t7 = $[24];
|
|
12597
|
-
}
|
|
12598
|
-
let t8;
|
|
12599
|
-
if ($[25] !== t5 || $[26] !== t7) {
|
|
12600
|
-
t8 = /*#__PURE__*/jsx(Box, {
|
|
12601
|
-
"data-testid": t5,
|
|
12602
|
-
sx: t6,
|
|
12603
|
-
children: t7
|
|
12604
|
-
});
|
|
12605
|
-
$[25] = t5;
|
|
12606
|
-
$[26] = t7;
|
|
12607
|
-
$[27] = t8;
|
|
12713
|
+
$[22] = column;
|
|
12714
|
+
$[23] = columnDef.header;
|
|
12715
|
+
$[24] = columnDefType;
|
|
12716
|
+
$[25] = enableHiding;
|
|
12717
|
+
$[26] = localization;
|
|
12718
|
+
$[27] = table.atoms;
|
|
12719
|
+
$[28] = t8;
|
|
12608
12720
|
} else {
|
|
12609
|
-
t8 = $[
|
|
12721
|
+
t8 = $[28];
|
|
12610
12722
|
}
|
|
12611
12723
|
let t9;
|
|
12612
|
-
if ($[
|
|
12613
|
-
t9 = /*#__PURE__*/jsx(
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
sx: t4,
|
|
12724
|
+
if ($[29] !== t6 || $[30] !== t8) {
|
|
12725
|
+
t9 = /*#__PURE__*/jsx(Box, {
|
|
12726
|
+
"data-testid": t6,
|
|
12727
|
+
sx: t7,
|
|
12617
12728
|
children: t8
|
|
12618
12729
|
});
|
|
12619
|
-
$[
|
|
12620
|
-
$[29] = t4;
|
|
12730
|
+
$[29] = t6;
|
|
12621
12731
|
$[30] = t8;
|
|
12622
12732
|
$[31] = t9;
|
|
12623
12733
|
} else {
|
|
12624
12734
|
t9 = $[31];
|
|
12625
12735
|
}
|
|
12626
12736
|
let t10;
|
|
12627
|
-
if ($[32] !==
|
|
12628
|
-
t10 =
|
|
12737
|
+
if ($[32] !== rest || $[33] !== t4 || $[34] !== t5 || $[35] !== t9) {
|
|
12738
|
+
t10 = /*#__PURE__*/jsx(MenuItem, {
|
|
12739
|
+
disableRipple: true,
|
|
12740
|
+
...rest,
|
|
12741
|
+
onClick: t4,
|
|
12742
|
+
sx: t5,
|
|
12743
|
+
children: t9
|
|
12744
|
+
});
|
|
12745
|
+
$[32] = rest;
|
|
12746
|
+
$[33] = t4;
|
|
12747
|
+
$[34] = t5;
|
|
12748
|
+
$[35] = t9;
|
|
12749
|
+
$[36] = t10;
|
|
12750
|
+
} else {
|
|
12751
|
+
t10 = $[36];
|
|
12752
|
+
}
|
|
12753
|
+
let t11;
|
|
12754
|
+
if ($[37] !== allColumns || $[38] !== column.columns || $[39] !== hoveredColumn || $[40] !== isNestedColumns || $[41] !== setHoveredColumn || $[42] !== table) {
|
|
12755
|
+
t11 = column.columns?.map((c, i) => /*#__PURE__*/jsx(MRT_ShowHideColumnsMenuItems, {
|
|
12629
12756
|
allColumns: allColumns,
|
|
12630
12757
|
column: c,
|
|
12631
12758
|
hoveredColumn: hoveredColumn,
|
|
@@ -12633,30 +12760,41 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
|
|
|
12633
12760
|
setHoveredColumn: setHoveredColumn,
|
|
12634
12761
|
table: table
|
|
12635
12762
|
}, `${i}-${c.id}`));
|
|
12636
|
-
$[
|
|
12637
|
-
$[
|
|
12638
|
-
$[
|
|
12639
|
-
$[
|
|
12640
|
-
$[
|
|
12641
|
-
$[
|
|
12642
|
-
$[
|
|
12763
|
+
$[37] = allColumns;
|
|
12764
|
+
$[38] = column.columns;
|
|
12765
|
+
$[39] = hoveredColumn;
|
|
12766
|
+
$[40] = isNestedColumns;
|
|
12767
|
+
$[41] = setHoveredColumn;
|
|
12768
|
+
$[42] = table;
|
|
12769
|
+
$[43] = t11;
|
|
12643
12770
|
} else {
|
|
12644
|
-
|
|
12771
|
+
t11 = $[43];
|
|
12645
12772
|
}
|
|
12646
|
-
let
|
|
12647
|
-
if ($[
|
|
12648
|
-
|
|
12649
|
-
children: [
|
|
12773
|
+
let t12;
|
|
12774
|
+
if ($[44] !== t10 || $[45] !== t11) {
|
|
12775
|
+
t12 = /*#__PURE__*/jsxs(Fragment, {
|
|
12776
|
+
children: [t10, t11]
|
|
12650
12777
|
});
|
|
12651
|
-
$[
|
|
12652
|
-
$[
|
|
12653
|
-
$[
|
|
12778
|
+
$[44] = t10;
|
|
12779
|
+
$[45] = t11;
|
|
12780
|
+
$[46] = t12;
|
|
12654
12781
|
} else {
|
|
12655
|
-
|
|
12782
|
+
t12 = $[46];
|
|
12656
12783
|
}
|
|
12657
|
-
return
|
|
12784
|
+
return t12;
|
|
12785
|
+
};
|
|
12786
|
+
function _temp$g() {}
|
|
12787
|
+
|
|
12788
|
+
// Matches a column if its own header text contains the search term, or any of
|
|
12789
|
+
// its nested (grouped) columns do — a matching group keeps all of its
|
|
12790
|
+
// children rather than filtering within the group, so the tree stays intact.
|
|
12791
|
+
const columnMatchesSearch = (column, term) => {
|
|
12792
|
+
const header = column.columnDef.header;
|
|
12793
|
+
if (typeof header === 'string' && header.toLowerCase().includes(term)) {
|
|
12794
|
+
return true;
|
|
12795
|
+
}
|
|
12796
|
+
return !!column.columns?.some(child => columnMatchesSearch(child, term));
|
|
12658
12797
|
};
|
|
12659
|
-
|
|
12660
12798
|
const MRT_ShowHideColumnsMenu = ({
|
|
12661
12799
|
anchorEl,
|
|
12662
12800
|
setAnchorEl,
|
|
@@ -12674,6 +12812,10 @@ const MRT_ShowHideColumnsMenu = ({
|
|
|
12674
12812
|
getState,
|
|
12675
12813
|
options: {
|
|
12676
12814
|
enableHiding,
|
|
12815
|
+
icons: {
|
|
12816
|
+
CloseIcon,
|
|
12817
|
+
SearchIcon
|
|
12818
|
+
},
|
|
12677
12819
|
localization,
|
|
12678
12820
|
mrtTheme: {
|
|
12679
12821
|
menuBackgroundColor
|
|
@@ -12685,6 +12827,7 @@ const MRT_ShowHideColumnsMenu = ({
|
|
|
12685
12827
|
columnPinning
|
|
12686
12828
|
} = getState();
|
|
12687
12829
|
const density = useSelector(table.store, state => state.density);
|
|
12830
|
+
const [searchText, setSearchText] = useState('');
|
|
12688
12831
|
const handleToggleAllColumns = value => {
|
|
12689
12832
|
const updates = getAllLeafColumns().filter(column => column.columnDef.enableHiding !== false).reduce((acc, column_0) => {
|
|
12690
12833
|
acc[column_0.id] = value ?? !column_0.getIsVisible();
|
|
@@ -12704,19 +12847,87 @@ const MRT_ShowHideColumnsMenu = ({
|
|
|
12704
12847
|
}, [columnOrder, columnPinning, getAllColumns(), getCenterLeafColumns(), getStartLeafColumns(), getEndLeafColumns()]);
|
|
12705
12848
|
const isNestedColumns = allColumns.some(col_1 => col_1.columnDef.columnDefType === 'group');
|
|
12706
12849
|
const [hoveredColumn, setHoveredColumn] = useState(null);
|
|
12850
|
+
const trimmedSearchText = searchText.trim().toLowerCase();
|
|
12851
|
+
const filteredColumns = useMemo(() => {
|
|
12852
|
+
if (!trimmedSearchText) return allColumns;
|
|
12853
|
+
return allColumns.filter(column_1 => columnMatchesSearch(column_1, trimmedSearchText));
|
|
12854
|
+
}, [allColumns, trimmedSearchText]);
|
|
12855
|
+
const handleSearchChange = event => {
|
|
12856
|
+
setSearchText(event.target.value);
|
|
12857
|
+
};
|
|
12707
12858
|
return /*#__PURE__*/jsxs(Menu, {
|
|
12708
12859
|
MenuListProps: {
|
|
12709
12860
|
dense: density === 'compact',
|
|
12710
12861
|
sx: {
|
|
12711
12862
|
backgroundColor: menuBackgroundColor
|
|
12712
12863
|
}
|
|
12864
|
+
}
|
|
12865
|
+
// Default anchor/transform origins both resolve to the anchor's own
|
|
12866
|
+
// top-left corner, so the menu opened directly on top of the "Columns"
|
|
12867
|
+
// button instead of below it — anchoring from the button's bottom edge
|
|
12868
|
+
// keeps the button visible once the menu is open.
|
|
12869
|
+
,
|
|
12870
|
+
anchorOrigin: {
|
|
12871
|
+
horizontal: 'left',
|
|
12872
|
+
vertical: 'bottom'
|
|
12873
|
+
},
|
|
12874
|
+
transformOrigin: {
|
|
12875
|
+
horizontal: 'left',
|
|
12876
|
+
vertical: 'top'
|
|
12713
12877
|
},
|
|
12714
12878
|
anchorEl: anchorEl,
|
|
12879
|
+
autoFocus: false,
|
|
12715
12880
|
disableScrollLock: true,
|
|
12716
|
-
onClose: () =>
|
|
12881
|
+
onClose: () => {
|
|
12882
|
+
setAnchorEl(null);
|
|
12883
|
+
setSearchText('');
|
|
12884
|
+
},
|
|
12717
12885
|
open: !!anchorEl,
|
|
12718
12886
|
...rest,
|
|
12719
|
-
children: [/*#__PURE__*/
|
|
12887
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
12888
|
+
sx: {
|
|
12889
|
+
px: '0.5rem',
|
|
12890
|
+
pb: '0.25rem'
|
|
12891
|
+
},
|
|
12892
|
+
children: /*#__PURE__*/jsx(TextField, {
|
|
12893
|
+
autoFocus: true,
|
|
12894
|
+
fullWidth: true,
|
|
12895
|
+
onChange: handleSearchChange,
|
|
12896
|
+
onKeyDown: event_0 => {
|
|
12897
|
+
// Stop MUI's menu type-ahead/arrow-key handling from treating
|
|
12898
|
+
// keystrokes typed here as list navigation.
|
|
12899
|
+
event_0.stopPropagation();
|
|
12900
|
+
if (event_0.key === 'Escape') {
|
|
12901
|
+
setAnchorEl(null);
|
|
12902
|
+
setSearchText('');
|
|
12903
|
+
}
|
|
12904
|
+
},
|
|
12905
|
+
placeholder: localization.search,
|
|
12906
|
+
size: "small",
|
|
12907
|
+
slotProps: {
|
|
12908
|
+
input: {
|
|
12909
|
+
startAdornment: /*#__PURE__*/jsx(InputAdornment, {
|
|
12910
|
+
position: "start",
|
|
12911
|
+
children: /*#__PURE__*/jsx(SearchIcon, {
|
|
12912
|
+
fontSize: "small"
|
|
12913
|
+
})
|
|
12914
|
+
}),
|
|
12915
|
+
endAdornment: searchText && /*#__PURE__*/jsx(InputAdornment, {
|
|
12916
|
+
position: "end",
|
|
12917
|
+
children: /*#__PURE__*/jsx(IconButton, {
|
|
12918
|
+
"aria-label": localization.clearSearch,
|
|
12919
|
+
onClick: () => setSearchText(''),
|
|
12920
|
+
size: "small",
|
|
12921
|
+
children: /*#__PURE__*/jsx(CloseIcon, {
|
|
12922
|
+
fontSize: "small"
|
|
12923
|
+
})
|
|
12924
|
+
})
|
|
12925
|
+
})
|
|
12926
|
+
}
|
|
12927
|
+
},
|
|
12928
|
+
value: searchText
|
|
12929
|
+
})
|
|
12930
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
12720
12931
|
sx: {
|
|
12721
12932
|
display: 'flex',
|
|
12722
12933
|
justifyContent: 'space-between',
|
|
@@ -12738,14 +12949,21 @@ const MRT_ShowHideColumnsMenu = ({
|
|
|
12738
12949
|
children: localization.showAll
|
|
12739
12950
|
})
|
|
12740
12951
|
})]
|
|
12741
|
-
}), /*#__PURE__*/jsx(Divider, {}),
|
|
12952
|
+
}), /*#__PURE__*/jsx(Divider, {}), filteredColumns.length === 0 ? /*#__PURE__*/jsx(Typography, {
|
|
12953
|
+
sx: {
|
|
12954
|
+
p: '0.75rem',
|
|
12955
|
+
textAlign: 'center'
|
|
12956
|
+
},
|
|
12957
|
+
variant: "body2",
|
|
12958
|
+
children: localization.noResultsFound
|
|
12959
|
+
}) : filteredColumns.map((column_2, index) => /*#__PURE__*/jsx(MRT_ShowHideColumnsMenuItems, {
|
|
12742
12960
|
allColumns: allColumns,
|
|
12743
|
-
column:
|
|
12961
|
+
column: column_2,
|
|
12744
12962
|
hoveredColumn: hoveredColumn,
|
|
12745
12963
|
isNestedColumns: isNestedColumns,
|
|
12746
12964
|
setHoveredColumn: setHoveredColumn,
|
|
12747
12965
|
table: table
|
|
12748
|
-
}, `${index}-${
|
|
12966
|
+
}, `${index}-${column_2.id}`))]
|
|
12749
12967
|
});
|
|
12750
12968
|
};
|
|
12751
12969
|
|
|
@@ -13566,6 +13784,123 @@ const MRT_TopToolbar = ({
|
|
|
13566
13784
|
});
|
|
13567
13785
|
};
|
|
13568
13786
|
|
|
13787
|
+
const BODY_CELL_SELECTOR = '[data-column-id]';
|
|
13788
|
+
|
|
13789
|
+
/**
|
|
13790
|
+
* Headless (renders nothing) — commits a body-content-based width for every
|
|
13791
|
+
* column the consumer didn't give an explicit `size`/`width`, using the same
|
|
13792
|
+
* measurement the resize handle's double-click autosize uses
|
|
13793
|
+
* (computeAutoSizedColumnWidth). The header title is never measured.
|
|
13794
|
+
*
|
|
13795
|
+
* Body content only exists once real rows are rendered, so this waits until
|
|
13796
|
+
* the table is neither loading nor showing skeletons and at least one body
|
|
13797
|
+
* cell is in the DOM. Until then such columns keep their default width and
|
|
13798
|
+
* share free space through growth. Measuring happens in a layout effect, so
|
|
13799
|
+
* the final width is applied before the first paint of the loaded rows.
|
|
13800
|
+
*
|
|
13801
|
+
* Each column is settled once: measured when its cells are rendered, or left
|
|
13802
|
+
* at its default width when it's visible but has no rendered cells (column
|
|
13803
|
+
* virtualization) — later pages, batches or horizontal scrolling never change
|
|
13804
|
+
* it again. A hidden column stays pending and is measured when first shown.
|
|
13805
|
+
* Only the currently rendered rows are measured (row virtualization); a wider
|
|
13806
|
+
* value further down needs a double-click on the resize handle.
|
|
13807
|
+
*
|
|
13808
|
+
* Rendered after <MRT_Table> in the container so the table ref is attached
|
|
13809
|
+
* when its layout effect runs. Runs on every render (no dependency array):
|
|
13810
|
+
* rows arriving via setRows or isLoading/showSkeletons toggling re-render
|
|
13811
|
+
* the container. Once every candidate is settled it is an early return.
|
|
13812
|
+
*/
|
|
13813
|
+
const MRT_AutoSizeColumnsEffect = t0 => {
|
|
13814
|
+
const $ = c(9);
|
|
13815
|
+
const {
|
|
13816
|
+
table
|
|
13817
|
+
} = t0;
|
|
13818
|
+
const {
|
|
13819
|
+
getColumn,
|
|
13820
|
+
getRowModel,
|
|
13821
|
+
getState,
|
|
13822
|
+
refs: t1,
|
|
13823
|
+
setColumnSizing
|
|
13824
|
+
} = table;
|
|
13825
|
+
const {
|
|
13826
|
+
autoSizeColumnIdsRef,
|
|
13827
|
+
autoSizedColumnWidthsRef,
|
|
13828
|
+
tableRef
|
|
13829
|
+
} = t1;
|
|
13830
|
+
let t2;
|
|
13831
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
13832
|
+
t2 = new Set();
|
|
13833
|
+
$[0] = t2;
|
|
13834
|
+
} else {
|
|
13835
|
+
t2 = $[0];
|
|
13836
|
+
}
|
|
13837
|
+
const settledIdsRef = useRef(t2);
|
|
13838
|
+
let t3;
|
|
13839
|
+
if ($[1] !== autoSizeColumnIdsRef || $[2] !== autoSizedColumnWidthsRef || $[3] !== getColumn || $[4] !== getRowModel || $[5] !== getState || $[6] !== setColumnSizing || $[7] !== tableRef) {
|
|
13840
|
+
t3 = () => {
|
|
13841
|
+
const candidateIds = autoSizeColumnIdsRef.current;
|
|
13842
|
+
const settledIds = settledIdsRef.current;
|
|
13843
|
+
if ([...candidateIds].every(id => settledIds.has(id))) {
|
|
13844
|
+
return;
|
|
13845
|
+
}
|
|
13846
|
+
const {
|
|
13847
|
+
columnSizing,
|
|
13848
|
+
isLoading,
|
|
13849
|
+
showSkeletons
|
|
13850
|
+
} = getState();
|
|
13851
|
+
const tableEl = tableRef.current;
|
|
13852
|
+
if (isLoading || showSkeletons || !tableEl || !getRowModel().rows.length || !tableEl.querySelector(BODY_CELL_SELECTOR)) {
|
|
13853
|
+
return;
|
|
13854
|
+
}
|
|
13855
|
+
const updates = {};
|
|
13856
|
+
candidateIds.forEach(columnId => {
|
|
13857
|
+
if (settledIds.has(columnId)) {
|
|
13858
|
+
return;
|
|
13859
|
+
}
|
|
13860
|
+
const column = getColumn(columnId);
|
|
13861
|
+
if (!column) {
|
|
13862
|
+
return;
|
|
13863
|
+
}
|
|
13864
|
+
if (columnSizing[columnId] !== undefined) {
|
|
13865
|
+
settledIds.add(columnId);
|
|
13866
|
+
return;
|
|
13867
|
+
}
|
|
13868
|
+
if (!column.getIsVisible()) {
|
|
13869
|
+
return;
|
|
13870
|
+
}
|
|
13871
|
+
settledIds.add(columnId);
|
|
13872
|
+
const bodyCellEls = tableEl.querySelectorAll(`[data-column-id="${CSS.escape(columnId)}"]`);
|
|
13873
|
+
if (!bodyCellEls.length) {
|
|
13874
|
+
return;
|
|
13875
|
+
}
|
|
13876
|
+
updates[columnId] = computeAutoSizedColumnWidth({
|
|
13877
|
+
bodyCellEls,
|
|
13878
|
+
...getColumnSizeBounds(column.columnDef)
|
|
13879
|
+
});
|
|
13880
|
+
});
|
|
13881
|
+
if (Object.keys(updates).length) {
|
|
13882
|
+
Object.assign(autoSizedColumnWidthsRef.current, updates);
|
|
13883
|
+
setColumnSizing(old => ({
|
|
13884
|
+
...old,
|
|
13885
|
+
...updates
|
|
13886
|
+
}));
|
|
13887
|
+
}
|
|
13888
|
+
};
|
|
13889
|
+
$[1] = autoSizeColumnIdsRef;
|
|
13890
|
+
$[2] = autoSizedColumnWidthsRef;
|
|
13891
|
+
$[3] = getColumn;
|
|
13892
|
+
$[4] = getRowModel;
|
|
13893
|
+
$[5] = getState;
|
|
13894
|
+
$[6] = setColumnSizing;
|
|
13895
|
+
$[7] = tableRef;
|
|
13896
|
+
$[8] = t3;
|
|
13897
|
+
} else {
|
|
13898
|
+
t3 = $[8];
|
|
13899
|
+
}
|
|
13900
|
+
useLayoutEffect(t3);
|
|
13901
|
+
return null;
|
|
13902
|
+
};
|
|
13903
|
+
|
|
13569
13904
|
/**
|
|
13570
13905
|
* Headless (renders nothing) — owns its own reactive subscription so this
|
|
13571
13906
|
* correction runs independently of whatever the root `useTable()` selector
|
|
@@ -14022,6 +14357,9 @@ const MRT_TableBodyCell = ({
|
|
|
14022
14357
|
hoveredRow
|
|
14023
14358
|
} = useSelector(table.store, state => ({
|
|
14024
14359
|
actionCell: state.actionCell,
|
|
14360
|
+
// Pinned-group edges can change without this cell's identity changing.
|
|
14361
|
+
columnPinning: state.columnPinning,
|
|
14362
|
+
columnVisibility: state.columnVisibility,
|
|
14025
14363
|
columnResizing: state.columnResizing,
|
|
14026
14364
|
density: state.density,
|
|
14027
14365
|
draggingColumn: state.draggingColumn,
|
|
@@ -14495,7 +14833,7 @@ const MRT_TableBodyRow = ({
|
|
|
14495
14833
|
const tableHeadHeight = enableStickyHeader && tableHeadRef.current?.clientHeight || 0;
|
|
14496
14834
|
const tableFooterHeight = enableStickyFooter && tableFooterRef.current?.clientHeight || 0;
|
|
14497
14835
|
const sx = parseFromValuesOrFunc(tableRowProps?.sx, theme);
|
|
14498
|
-
const defaultRowHeight = density
|
|
14836
|
+
const defaultRowHeight = getDefaultRowHeight(density);
|
|
14499
14837
|
const customRowHeight =
|
|
14500
14838
|
// @ts-expect-error
|
|
14501
14839
|
parseInt(tableRowProps?.style?.height ?? sx?.height, 10) || undefined;
|
|
@@ -15217,34 +15555,167 @@ const MRT_TableFooter = ({
|
|
|
15217
15555
|
});
|
|
15218
15556
|
};
|
|
15219
15557
|
|
|
15220
|
-
const
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
|
|
15228
|
-
|
|
15229
|
-
|
|
15230
|
-
|
|
15231
|
-
|
|
15232
|
-
|
|
15233
|
-
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15558
|
+
const MRT_SelectAllMenuItems = ({
|
|
15559
|
+
table,
|
|
15560
|
+
closeMenu: handleClose
|
|
15561
|
+
}) => {
|
|
15562
|
+
const [isSelectingAllPages, setIsSelectingAllPages] = useState(false);
|
|
15563
|
+
const {
|
|
15564
|
+
getState,
|
|
15565
|
+
options: {
|
|
15566
|
+
enableRowPinning,
|
|
15567
|
+
getAllSelectableRowIds,
|
|
15568
|
+
localization,
|
|
15569
|
+
rowPinningDisplayMode
|
|
15570
|
+
},
|
|
15571
|
+
refs: {
|
|
15572
|
+
allSelectableRowIdsRef
|
|
15573
|
+
}
|
|
15574
|
+
} = table;
|
|
15575
|
+
const {
|
|
15576
|
+
isLoading,
|
|
15577
|
+
showProgressBars
|
|
15578
|
+
} = getState();
|
|
15579
|
+
|
|
15580
|
+
// Clears row pinning on every bulk selection/deselection
|
|
15581
|
+
const clearPinning = () => {
|
|
15582
|
+
if (enableRowPinning && rowPinningDisplayMode?.includes('select')) {
|
|
15583
|
+
table.setRowPinning({
|
|
15584
|
+
bottom: [],
|
|
15585
|
+
top: []
|
|
15586
|
+
});
|
|
15587
|
+
}
|
|
15588
|
+
};
|
|
15589
|
+
|
|
15590
|
+
// ── Current-page actions ────────────────────────────────────────────────────
|
|
15591
|
+
|
|
15592
|
+
const handleSelectCurrentPage = () => {
|
|
15593
|
+
table.toggleAllPageRowsSelected(true);
|
|
15594
|
+
clearPinning();
|
|
15595
|
+
handleClose();
|
|
15596
|
+
};
|
|
15597
|
+
const handleDeselectCurrentPage = () => {
|
|
15598
|
+
if (allSelectableRowIdsRef.current.length > 0) {
|
|
15599
|
+
// When all pages are selected, deselecting the current page must clear the entire selection — otherwise rows on other pages remain "ghost-selected" but the user can't see them.
|
|
15600
|
+
table.setRowSelection({});
|
|
15601
|
+
allSelectableRowIdsRef.current = [];
|
|
15602
|
+
} else {
|
|
15603
|
+
table.toggleAllPageRowsSelected(false);
|
|
15604
|
+
}
|
|
15605
|
+
clearPinning();
|
|
15606
|
+
handleClose();
|
|
15607
|
+
};
|
|
15608
|
+
|
|
15609
|
+
// ── All-pages actions ───────────────────────────────────────────────────────
|
|
15610
|
+
|
|
15611
|
+
const handleSelectAllPages = async () => {
|
|
15612
|
+
handleClose();
|
|
15613
|
+
if (getAllSelectableRowIds) {
|
|
15614
|
+
// Server-side: IDs are not available locally, fetch them from the API
|
|
15615
|
+
setIsSelectingAllPages(true);
|
|
15616
|
+
table.setShowProgressBars(true);
|
|
15617
|
+
try {
|
|
15618
|
+
const ids = await getAllSelectableRowIds({
|
|
15619
|
+
table
|
|
15620
|
+
});
|
|
15621
|
+
allSelectableRowIdsRef.current = ids;
|
|
15622
|
+
const newSelection = {};
|
|
15623
|
+
ids.forEach(id => {
|
|
15624
|
+
newSelection[id] = true;
|
|
15625
|
+
});
|
|
15626
|
+
table.setRowSelection(newSelection);
|
|
15627
|
+
clearPinning();
|
|
15628
|
+
} finally {
|
|
15629
|
+
setIsSelectingAllPages(false);
|
|
15630
|
+
table.setShowProgressBars(false);
|
|
15631
|
+
}
|
|
15632
|
+
} else {
|
|
15633
|
+
// Client-side: all data is available locally
|
|
15634
|
+
table.toggleAllRowsSelected(true);
|
|
15635
|
+
clearPinning();
|
|
15636
|
+
}
|
|
15637
|
+
};
|
|
15638
|
+
const handleDeselectAllPages = () => {
|
|
15639
|
+
if (getAllSelectableRowIds) {
|
|
15640
|
+
table.setRowSelection({});
|
|
15641
|
+
} else {
|
|
15642
|
+
table.toggleAllRowsSelected(false);
|
|
15643
|
+
}
|
|
15644
|
+
allSelectableRowIdsRef.current = [];
|
|
15645
|
+
clearPinning();
|
|
15646
|
+
handleClose();
|
|
15647
|
+
};
|
|
15648
|
+
const isDisabled = isLoading || showProgressBars || isSelectingAllPages;
|
|
15649
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
15650
|
+
children: /*#__PURE__*/jsx(Subscribe, {
|
|
15651
|
+
selector: state => ({
|
|
15652
|
+
pagination: state.pagination,
|
|
15653
|
+
rowSelection: state.rowSelection
|
|
15654
|
+
}),
|
|
15655
|
+
source: table.store,
|
|
15656
|
+
children: ({
|
|
15657
|
+
rowSelection
|
|
15658
|
+
}) => {
|
|
15659
|
+
const isAllCurrentPageSelected = table.getIsAllPageRowsSelected();
|
|
15660
|
+
const isAllPagesActive = getIsAllPagesSelectionActive(table, rowSelection);
|
|
15661
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
15662
|
+
children: [isAllCurrentPageSelected ? /*#__PURE__*/jsx(MenuItem, {
|
|
15663
|
+
disabled: isDisabled,
|
|
15664
|
+
onClick: handleDeselectCurrentPage,
|
|
15665
|
+
children: localization.deselectAllOnCurrentPage
|
|
15666
|
+
}) : /*#__PURE__*/jsx(MenuItem, {
|
|
15667
|
+
disabled: isDisabled,
|
|
15668
|
+
onClick: handleSelectCurrentPage,
|
|
15669
|
+
children: localization.selectAllOnCurrentPage
|
|
15670
|
+
}), isAllPagesActive ? /*#__PURE__*/jsx(MenuItem, {
|
|
15671
|
+
disabled: isDisabled,
|
|
15672
|
+
onClick: handleDeselectAllPages,
|
|
15673
|
+
children: localization.deselectAllOnAllPages
|
|
15674
|
+
}) : /*#__PURE__*/jsxs(MenuItem, {
|
|
15675
|
+
disabled: isDisabled,
|
|
15676
|
+
onClick: handleSelectAllPages,
|
|
15677
|
+
children: [isSelectingAllPages && /*#__PURE__*/jsx(CircularProgress, {
|
|
15678
|
+
"aria-label": "Loading",
|
|
15679
|
+
size: 14,
|
|
15680
|
+
sx: {
|
|
15681
|
+
mr: 1
|
|
15682
|
+
}
|
|
15683
|
+
}), localization.selectAllOnAllPages]
|
|
15684
|
+
})]
|
|
15685
|
+
});
|
|
15686
|
+
}
|
|
15687
|
+
})
|
|
15688
|
+
});
|
|
15689
|
+
};
|
|
15690
|
+
|
|
15691
|
+
const MRT_ActionMenuItem = t0 => {
|
|
15692
|
+
const $ = c(20);
|
|
15693
|
+
let icon;
|
|
15694
|
+
let label;
|
|
15695
|
+
let onOpenSubMenu;
|
|
15696
|
+
let rest;
|
|
15697
|
+
let table;
|
|
15698
|
+
if ($[0] !== t0) {
|
|
15699
|
+
({
|
|
15700
|
+
icon,
|
|
15701
|
+
label,
|
|
15702
|
+
onOpenSubMenu,
|
|
15703
|
+
table,
|
|
15704
|
+
...rest
|
|
15705
|
+
} = t0);
|
|
15706
|
+
$[0] = t0;
|
|
15707
|
+
$[1] = icon;
|
|
15708
|
+
$[2] = label;
|
|
15709
|
+
$[3] = onOpenSubMenu;
|
|
15710
|
+
$[4] = rest;
|
|
15711
|
+
$[5] = table;
|
|
15712
|
+
} else {
|
|
15713
|
+
icon = $[1];
|
|
15714
|
+
label = $[2];
|
|
15715
|
+
onOpenSubMenu = $[3];
|
|
15716
|
+
rest = $[4];
|
|
15717
|
+
table = $[5];
|
|
15718
|
+
}
|
|
15248
15719
|
const {
|
|
15249
15720
|
options: t1
|
|
15250
15721
|
} = table;
|
|
@@ -15335,7 +15806,7 @@ const MRT_ActionMenuItem = t0 => {
|
|
|
15335
15806
|
};
|
|
15336
15807
|
|
|
15337
15808
|
const MRT_ColumnActionMenu = t0 => {
|
|
15338
|
-
const $ = c(
|
|
15809
|
+
const $ = c(81);
|
|
15339
15810
|
let anchorEl;
|
|
15340
15811
|
let header;
|
|
15341
15812
|
let rest;
|
|
@@ -15371,6 +15842,8 @@ const MRT_ColumnActionMenu = t0 => {
|
|
|
15371
15842
|
const {
|
|
15372
15843
|
enableColumnPinning,
|
|
15373
15844
|
enableColumnResizing,
|
|
15845
|
+
enableMultiRowSelection,
|
|
15846
|
+
enableSelectAll,
|
|
15374
15847
|
enableGrouping,
|
|
15375
15848
|
enableHiding,
|
|
15376
15849
|
enableSorting,
|
|
@@ -15445,7 +15918,7 @@ const MRT_ColumnActionMenu = t0 => {
|
|
|
15445
15918
|
let t7;
|
|
15446
15919
|
if ($[15] !== column || $[16] !== setAnchorEl || $[17] !== setColumnResizing) {
|
|
15447
15920
|
t7 = () => {
|
|
15448
|
-
setColumnResizing(_temp3$
|
|
15921
|
+
setColumnResizing(_temp3$1);
|
|
15449
15922
|
column.resetSize();
|
|
15450
15923
|
setAnchorEl(null);
|
|
15451
15924
|
};
|
|
@@ -15487,7 +15960,7 @@ const MRT_ColumnActionMenu = t0 => {
|
|
|
15487
15960
|
if ($[25] !== column || $[26] !== setAnchorEl || $[27] !== setColumnOrder) {
|
|
15488
15961
|
t10 = () => {
|
|
15489
15962
|
column.toggleGrouping();
|
|
15490
|
-
setColumnOrder(_temp4
|
|
15963
|
+
setColumnOrder(_temp4);
|
|
15491
15964
|
setAnchorEl(null);
|
|
15492
15965
|
};
|
|
15493
15966
|
$[25] = column;
|
|
@@ -15512,7 +15985,7 @@ const MRT_ColumnActionMenu = t0 => {
|
|
|
15512
15985
|
}
|
|
15513
15986
|
const handleShowAllColumns = t11;
|
|
15514
15987
|
let t12;
|
|
15515
|
-
if ($[32] !== ClearAllIcon || $[33] !== DynamicFeedIcon || $[34] !== PushPinIcon || $[35] !== RestartAltIcon || $[36] !== SortIcon || $[37] !== ViewColumnIcon || $[38] !== VisibilityOffIcon || $[39] !== anchorEl || $[40] !== column || $[41] !== columnDef || $[42] !== columnSizing || $[43] !== columnVisibility || $[44] !== density || $[45] !== enableColumnPinning || $[46] !== enableColumnResizing || $[47] !== enableGrouping || $[48] !== enableHiding || $[49] !==
|
|
15988
|
+
if ($[32] !== ClearAllIcon || $[33] !== DynamicFeedIcon || $[34] !== PushPinIcon || $[35] !== RestartAltIcon || $[36] !== SortIcon || $[37] !== ViewColumnIcon || $[38] !== VisibilityOffIcon || $[39] !== anchorEl || $[40] !== column || $[41] !== columnDef || $[42] !== columnSizing || $[43] !== columnVisibility || $[44] !== density || $[45] !== enableColumnPinning || $[46] !== enableColumnResizing || $[47] !== enableGrouping || $[48] !== enableHiding || $[49] !== enableMultiRowSelection || $[50] !== enableSelectAll || $[51] !== enableSorting || $[52] !== enableSortingRemoval || $[53] !== handleClearSort || $[54] !== handleGroupByColumn || $[55] !== handleHideColumn || $[56] !== handlePinColumn || $[57] !== handleResetColumnSize || $[58] !== handleShowAllColumns || $[59] !== handleSortAsc || $[60] !== handleSortDesc || $[61] !== localization || $[62] !== menuBackgroundColor || $[63] !== renderColumnActionsMenuItems || $[64] !== rest || $[65] !== setAnchorEl || $[66] !== table) {
|
|
15516
15989
|
const internalColumnMenuItems = [...(enableSorting && column.getCanSort() ? [enableSortingRemoval !== false && /*#__PURE__*/jsx(MRT_ActionMenuItem, {
|
|
15517
15990
|
disabled: column.getIsSorted() === false,
|
|
15518
15991
|
icon: /*#__PURE__*/jsx(ClearAllIcon, {}),
|
|
@@ -15590,43 +16063,58 @@ const MRT_ColumnActionMenu = t0 => {
|
|
|
15590
16063
|
}, 12)] : [])].filter(Boolean);
|
|
15591
16064
|
const t13 = density === "compact";
|
|
15592
16065
|
let t14;
|
|
15593
|
-
if ($[
|
|
16066
|
+
if ($[68] !== menuBackgroundColor) {
|
|
15594
16067
|
t14 = {
|
|
15595
16068
|
backgroundColor: menuBackgroundColor
|
|
15596
16069
|
};
|
|
15597
|
-
$[
|
|
15598
|
-
$[
|
|
16070
|
+
$[68] = menuBackgroundColor;
|
|
16071
|
+
$[69] = t14;
|
|
15599
16072
|
} else {
|
|
15600
|
-
t14 = $[
|
|
16073
|
+
t14 = $[69];
|
|
15601
16074
|
}
|
|
15602
16075
|
let t15;
|
|
15603
|
-
if ($[
|
|
16076
|
+
if ($[70] !== t13 || $[71] !== t14) {
|
|
15604
16077
|
t15 = {
|
|
15605
16078
|
dense: t13,
|
|
15606
16079
|
sx: t14
|
|
15607
16080
|
};
|
|
15608
|
-
$[
|
|
15609
|
-
$[
|
|
15610
|
-
$[
|
|
16081
|
+
$[70] = t13;
|
|
16082
|
+
$[71] = t14;
|
|
16083
|
+
$[72] = t15;
|
|
15611
16084
|
} else {
|
|
15612
|
-
t15 = $[
|
|
16085
|
+
t15 = $[72];
|
|
15613
16086
|
}
|
|
15614
16087
|
let t16;
|
|
15615
|
-
if ($[
|
|
16088
|
+
if ($[73] !== setAnchorEl) {
|
|
15616
16089
|
t16 = () => setAnchorEl(null);
|
|
15617
|
-
$[
|
|
15618
|
-
$[
|
|
16090
|
+
$[73] = setAnchorEl;
|
|
16091
|
+
$[74] = t16;
|
|
15619
16092
|
} else {
|
|
15620
|
-
t16 = $[
|
|
16093
|
+
t16 = $[74];
|
|
15621
16094
|
}
|
|
15622
|
-
|
|
16095
|
+
let t17;
|
|
16096
|
+
if ($[75] !== column.id || $[76] !== enableMultiRowSelection || $[77] !== enableSelectAll || $[78] !== setAnchorEl || $[79] !== table) {
|
|
16097
|
+
t17 = column.id === CHECKBOX_DISPLAY_COLUMN_ID && enableSelectAll && enableMultiRowSelection && /*#__PURE__*/jsx(MRT_SelectAllMenuItems, {
|
|
16098
|
+
closeMenu: () => setAnchorEl(null),
|
|
16099
|
+
table: table
|
|
16100
|
+
});
|
|
16101
|
+
$[75] = column.id;
|
|
16102
|
+
$[76] = enableMultiRowSelection;
|
|
16103
|
+
$[77] = enableSelectAll;
|
|
16104
|
+
$[78] = setAnchorEl;
|
|
16105
|
+
$[79] = table;
|
|
16106
|
+
$[80] = t17;
|
|
16107
|
+
} else {
|
|
16108
|
+
t17 = $[80];
|
|
16109
|
+
}
|
|
16110
|
+
t12 = /*#__PURE__*/jsxs(Menu, {
|
|
15623
16111
|
MenuListProps: t15,
|
|
15624
16112
|
anchorEl: anchorEl,
|
|
15625
16113
|
disableScrollLock: true,
|
|
15626
16114
|
onClose: t16,
|
|
15627
16115
|
open: !!anchorEl,
|
|
15628
16116
|
...rest,
|
|
15629
|
-
children: columnDef.renderColumnActionsMenuItems?.({
|
|
16117
|
+
children: [t17, column.id === CHECKBOX_DISPLAY_COLUMN_ID && enableSelectAll && enableMultiRowSelection && internalColumnMenuItems.length > 0 && /*#__PURE__*/jsx(Divider, {}), columnDef.renderColumnActionsMenuItems?.({
|
|
15630
16118
|
closeMenu: () => setAnchorEl(null),
|
|
15631
16119
|
column,
|
|
15632
16120
|
internalColumnMenuItems,
|
|
@@ -15636,7 +16124,7 @@ const MRT_ColumnActionMenu = t0 => {
|
|
|
15636
16124
|
column,
|
|
15637
16125
|
internalColumnMenuItems,
|
|
15638
16126
|
table
|
|
15639
|
-
}) ?? internalColumnMenuItems
|
|
16127
|
+
}) ?? internalColumnMenuItems]
|
|
15640
16128
|
});
|
|
15641
16129
|
$[32] = ClearAllIcon;
|
|
15642
16130
|
$[33] = DynamicFeedIcon;
|
|
@@ -15655,25 +16143,27 @@ const MRT_ColumnActionMenu = t0 => {
|
|
|
15655
16143
|
$[46] = enableColumnResizing;
|
|
15656
16144
|
$[47] = enableGrouping;
|
|
15657
16145
|
$[48] = enableHiding;
|
|
15658
|
-
$[49] =
|
|
15659
|
-
$[50] =
|
|
15660
|
-
$[51] =
|
|
15661
|
-
$[52] =
|
|
15662
|
-
$[53] =
|
|
15663
|
-
$[54] =
|
|
15664
|
-
$[55] =
|
|
15665
|
-
$[56] =
|
|
15666
|
-
$[57] =
|
|
15667
|
-
$[58] =
|
|
15668
|
-
$[59] =
|
|
15669
|
-
$[60] =
|
|
15670
|
-
$[61] =
|
|
15671
|
-
$[62] =
|
|
15672
|
-
$[63] =
|
|
15673
|
-
$[64] =
|
|
15674
|
-
$[65] =
|
|
15675
|
-
|
|
15676
|
-
|
|
16146
|
+
$[49] = enableMultiRowSelection;
|
|
16147
|
+
$[50] = enableSelectAll;
|
|
16148
|
+
$[51] = enableSorting;
|
|
16149
|
+
$[52] = enableSortingRemoval;
|
|
16150
|
+
$[53] = handleClearSort;
|
|
16151
|
+
$[54] = handleGroupByColumn;
|
|
16152
|
+
$[55] = handleHideColumn;
|
|
16153
|
+
$[56] = handlePinColumn;
|
|
16154
|
+
$[57] = handleResetColumnSize;
|
|
16155
|
+
$[58] = handleShowAllColumns;
|
|
16156
|
+
$[59] = handleSortAsc;
|
|
16157
|
+
$[60] = handleSortDesc;
|
|
16158
|
+
$[61] = localization;
|
|
16159
|
+
$[62] = menuBackgroundColor;
|
|
16160
|
+
$[63] = renderColumnActionsMenuItems;
|
|
16161
|
+
$[64] = rest;
|
|
16162
|
+
$[65] = setAnchorEl;
|
|
16163
|
+
$[66] = table;
|
|
16164
|
+
$[67] = t12;
|
|
16165
|
+
} else {
|
|
16166
|
+
t12 = $[67];
|
|
15677
16167
|
}
|
|
15678
16168
|
return t12;
|
|
15679
16169
|
};
|
|
@@ -15688,13 +16178,13 @@ function _temp$8(state) {
|
|
|
15688
16178
|
function _temp2$5(state_0) {
|
|
15689
16179
|
return state_0.density;
|
|
15690
16180
|
}
|
|
15691
|
-
function _temp3$
|
|
16181
|
+
function _temp3$1(old) {
|
|
15692
16182
|
return {
|
|
15693
16183
|
...old,
|
|
15694
16184
|
isResizingColumn: false
|
|
15695
16185
|
};
|
|
15696
16186
|
}
|
|
15697
|
-
function _temp4
|
|
16187
|
+
function _temp4(old_0) {
|
|
15698
16188
|
return ["mrt-row-expand", ...old_0];
|
|
15699
16189
|
}
|
|
15700
16190
|
function _temp5(col) {
|
|
@@ -16193,34 +16683,6 @@ const MRT_TableHeadCellGrabHandle = t0 => {
|
|
|
16193
16683
|
return t8;
|
|
16194
16684
|
};
|
|
16195
16685
|
|
|
16196
|
-
// `el` normally has an explicit width/min-width/flex-basis (driven by the
|
|
16197
|
-
// column's size CSS var), so nothing overflows and `scrollWidth` just reports
|
|
16198
|
-
// that forced size back — and `min-width` alone would otherwise stop it from
|
|
16199
|
-
// ever shrinking below the current (large) column size. Temporarily switching
|
|
16200
|
-
// to `max-content` with min-width/grow/shrink zeroed out lets the browser lay
|
|
16201
|
-
// it out at its natural content size instead — then the inline style is
|
|
16202
|
-
// restored before this task yields, so there's no visible flash.
|
|
16203
|
-
const measureIntrinsicWidth = el => {
|
|
16204
|
-
const {
|
|
16205
|
-
width,
|
|
16206
|
-
minWidth,
|
|
16207
|
-
flexBasis,
|
|
16208
|
-
flexGrow,
|
|
16209
|
-
flexShrink
|
|
16210
|
-
} = el.style;
|
|
16211
|
-
el.style.width = 'max-content';
|
|
16212
|
-
el.style.minWidth = '0';
|
|
16213
|
-
el.style.flexBasis = 'auto';
|
|
16214
|
-
el.style.flexGrow = '0';
|
|
16215
|
-
el.style.flexShrink = '0';
|
|
16216
|
-
const measured = Math.ceil(el.getBoundingClientRect().width);
|
|
16217
|
-
el.style.width = width;
|
|
16218
|
-
el.style.minWidth = minWidth;
|
|
16219
|
-
el.style.flexBasis = flexBasis;
|
|
16220
|
-
el.style.flexGrow = flexGrow;
|
|
16221
|
-
el.style.flexShrink = flexShrink;
|
|
16222
|
-
return measured;
|
|
16223
|
-
};
|
|
16224
16686
|
const MRT_TableHeadCellResizeHandle = ({
|
|
16225
16687
|
header,
|
|
16226
16688
|
table,
|
|
@@ -16231,6 +16693,7 @@ const MRT_TableHeadCellResizeHandle = ({
|
|
|
16231
16693
|
columnResizeDirection
|
|
16232
16694
|
},
|
|
16233
16695
|
refs: {
|
|
16696
|
+
autoSizedColumnWidthsRef,
|
|
16234
16697
|
isResizingRef,
|
|
16235
16698
|
resizeIndicatorRef,
|
|
16236
16699
|
tableContainerRef,
|
|
@@ -16253,10 +16716,17 @@ const MRT_TableHeadCellResizeHandle = ({
|
|
|
16253
16716
|
const tableEl = tableRef.current;
|
|
16254
16717
|
const containerEl = tableContainerRef.current;
|
|
16255
16718
|
const indicatorEl = resizeIndicatorRef.current;
|
|
16256
|
-
const startSize = column.getSize();
|
|
16719
|
+
const startSize = tableHeadCellRefs.current?.[column.id]?.getBoundingClientRect().width || column.getSize();
|
|
16720
|
+
// Freeze flex growth while CSS variables drive the drag without renders.
|
|
16721
|
+
const growVar = `--col-${parseCSSVarId(column.id)}-grow`;
|
|
16722
|
+
tableEl?.style.setProperty(growVar, '0');
|
|
16723
|
+
tableEl?.style.setProperty(`--header-${parseCSSVarId(header.id)}-size`, `${startSize}`);
|
|
16724
|
+
tableEl?.style.setProperty(`--col-${parseCSSVarId(column.id)}-size`, `${startSize}`);
|
|
16257
16725
|
const dir = columnResizeDirection === 'rtl' ? -1 : 1;
|
|
16258
|
-
const
|
|
16259
|
-
|
|
16726
|
+
const {
|
|
16727
|
+
minSize,
|
|
16728
|
+
maxSize
|
|
16729
|
+
} = getColumnSizeBounds(column.columnDef);
|
|
16260
16730
|
let size = startSize;
|
|
16261
16731
|
// The "effective" cursor position used to compute size. Normally this just
|
|
16262
16732
|
// mirrors the real cursor 1:1, but while pinned at the window edge (see
|
|
@@ -16367,6 +16837,7 @@ const MRT_TableHeadCellResizeHandle = ({
|
|
|
16367
16837
|
document.body.style.cursor = '';
|
|
16368
16838
|
document.body.style.userSelect = '';
|
|
16369
16839
|
if (indicatorEl) indicatorEl.style.display = 'none';
|
|
16840
|
+
delete autoSizedColumnWidthsRef.current[column.id];
|
|
16370
16841
|
setColumnSizing(old => ({
|
|
16371
16842
|
...old,
|
|
16372
16843
|
[column.id]: size
|
|
@@ -16378,7 +16849,7 @@ const MRT_TableHeadCellResizeHandle = ({
|
|
|
16378
16849
|
passive: false
|
|
16379
16850
|
});
|
|
16380
16851
|
document.addEventListener('touchend', handleEnd);
|
|
16381
|
-
}, [column, columnResizeDirection, header.id, isResizingRef, resizeIndicatorRef, setColumnSizing, tableContainerRef, tableHeadCellRefs, tableRef]);
|
|
16852
|
+
}, [autoSizedColumnWidthsRef, column, columnResizeDirection, header.id, isResizingRef, resizeIndicatorRef, setColumnSizing, tableContainerRef, tableHeadCellRefs, tableRef]);
|
|
16382
16853
|
return /*#__PURE__*/jsx(Box, {
|
|
16383
16854
|
className: "Mui-TableHeadCell-ResizeHandle-Wrapper",
|
|
16384
16855
|
onDoubleClick: () => {
|
|
@@ -16386,18 +16857,18 @@ const MRT_TableHeadCellResizeHandle = ({
|
|
|
16386
16857
|
...old_0,
|
|
16387
16858
|
isResizingColumn: false
|
|
16388
16859
|
}));
|
|
16389
|
-
const
|
|
16390
|
-
|
|
16391
|
-
//
|
|
16392
|
-
|
|
16393
|
-
//
|
|
16394
|
-
|
|
16395
|
-
|
|
16396
|
-
const
|
|
16397
|
-
|
|
16398
|
-
|
|
16860
|
+
const bodyCellEls = tableRef.current?.querySelectorAll(`[data-column-id="${CSS.escape(column.id)}"]`);
|
|
16861
|
+
// Content-only, like the initial autosize: with no rendered body
|
|
16862
|
+
// cells there is nothing to fit, so the current width is kept.
|
|
16863
|
+
if (!bodyCellEls?.length) return;
|
|
16864
|
+
// Same measurement MRT_AutoSizeColumnsEffect uses for the initial
|
|
16865
|
+
// auto-size — double-click always re-runs it fresh, regardless of
|
|
16866
|
+
// whether this column has an explicit `size` or was already resized.
|
|
16867
|
+
const newSize = computeAutoSizedColumnWidth({
|
|
16868
|
+
bodyCellEls,
|
|
16869
|
+
...getColumnSizeBounds(column.columnDef)
|
|
16399
16870
|
});
|
|
16400
|
-
|
|
16871
|
+
delete autoSizedColumnWidthsRef.current[column.id];
|
|
16401
16872
|
setColumnSizing(old_1 => ({
|
|
16402
16873
|
...old_1,
|
|
16403
16874
|
[column.id]: newSize
|
|
@@ -16606,6 +17077,7 @@ const MRT_TableHeadCell = ({
|
|
|
16606
17077
|
const {
|
|
16607
17078
|
columnDefType
|
|
16608
17079
|
} = columnDef;
|
|
17080
|
+
const isCheckboxColumn = column.id === CHECKBOX_DISPLAY_COLUMN_ID;
|
|
16609
17081
|
const {
|
|
16610
17082
|
columnResizing,
|
|
16611
17083
|
draggingColumn,
|
|
@@ -16769,8 +17241,12 @@ const MRT_TableHeadCell = ({
|
|
|
16769
17241
|
header: header,
|
|
16770
17242
|
table: table,
|
|
16771
17243
|
sx: {
|
|
16772
|
-
// Show sort label when the cell is hovered or the column is actively sorted
|
|
16773
|
-
|
|
17244
|
+
// Show sort label when the cell is hovered or the column is actively sorted.
|
|
17245
|
+
// The label's own `flex: '0 0'`/`width: '3ch'` defaults would otherwise
|
|
17246
|
+
// permanently reserve that space even while hidden — collapsing width to 0
|
|
17247
|
+
// here gives the header text that room while the icon isn't shown.
|
|
17248
|
+
visibility: isColumnCellHovered || column.getIsSorted() ? 'visible' : 'hidden',
|
|
17249
|
+
width: isColumnCellHovered || column.getIsSorted() ? '3ch' : 0
|
|
16774
17250
|
}
|
|
16775
17251
|
})]
|
|
16776
17252
|
}), columnDefType !== 'group' && /*#__PURE__*/jsxs(Box, {
|
|
@@ -16781,9 +17257,11 @@ const MRT_TableHeadCell = ({
|
|
|
16781
17257
|
flexDirection: 'row',
|
|
16782
17258
|
alignItems: 'center',
|
|
16783
17259
|
gap: '0.5rem',
|
|
16784
|
-
|
|
17260
|
+
// Keep the checkbox menu in one position when hover ends.
|
|
17261
|
+
width: isCheckboxColumn || isColumnCellHovered ? 'auto' : 0,
|
|
17262
|
+
flexShrink: isCheckboxColumn ? 0 : undefined,
|
|
16785
17263
|
visibility: isColumnCellHovered ? 'visible' : 'hidden',
|
|
16786
|
-
px: isColumnCellHovered ? '0.2rem' : 0
|
|
17264
|
+
px: isCheckboxColumn || isColumnCellHovered ? '0.2rem' : 0
|
|
16787
17265
|
},
|
|
16788
17266
|
children: [showColumnActions && /*#__PURE__*/jsx(MRT_TableHeadCellColumnActionsButton, {
|
|
16789
17267
|
header: header,
|
|
@@ -17060,7 +17538,7 @@ const MRT_Table = ({
|
|
|
17060
17538
|
// changes — this is the reactive boundary that makes that happen instead of
|
|
17061
17539
|
// relying on a root cascade re-render.
|
|
17062
17540
|
useSelector(table.atoms.columnOrder);
|
|
17063
|
-
useSelector(table.atoms.columnPinning);
|
|
17541
|
+
const columnPinning = useSelector(table.atoms.columnPinning);
|
|
17064
17542
|
const density = useSelector(table.store, state => state.density);
|
|
17065
17543
|
const tableProps = {
|
|
17066
17544
|
...parseFromValuesOrFunc(muiTableProps, {
|
|
@@ -17082,38 +17560,36 @@ const MRT_Table = ({
|
|
|
17082
17560
|
for (let i = 0; i < headers.length; i++) {
|
|
17083
17561
|
const header = headers[i];
|
|
17084
17562
|
const colSize = header.getSize();
|
|
17563
|
+
colSizes[`--col-${parseCSSVarId(header.column.id)}-grow`] = getColumnGrowWeight(header.column, table);
|
|
17085
17564
|
colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
|
|
17086
17565
|
colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
|
|
17087
17566
|
}
|
|
17088
17567
|
return colSizes;
|
|
17089
|
-
}, [columns, columnVisibility]);
|
|
17568
|
+
}, [columns, columnVisibility, columnPinning]);
|
|
17090
17569
|
|
|
17091
17570
|
// Keeps the CSS size vars in sync with columnSizing after mount, without
|
|
17092
17571
|
// subscribing this component to it (see comment above columnVisibility).
|
|
17093
17572
|
useEffect(() => {
|
|
17094
|
-
const
|
|
17573
|
+
const syncColumnSizing = () => {
|
|
17095
17574
|
const node = tableRef.current;
|
|
17096
17575
|
if (!node) return;
|
|
17097
17576
|
const headers_0 = getFlatHeaders();
|
|
17098
17577
|
for (let i_0 = 0; i_0 < headers_0.length; i_0++) {
|
|
17099
17578
|
const header_0 = headers_0[i_0];
|
|
17100
17579
|
const colSize_0 = header_0.getSize();
|
|
17580
|
+
node.style.setProperty(`--col-${parseCSSVarId(header_0.column.id)}-grow`, `${getColumnGrowWeight(header_0.column, table)}`);
|
|
17101
17581
|
node.style.setProperty(`--header-${parseCSSVarId(header_0.id)}-size`, `${colSize_0}`);
|
|
17102
17582
|
node.style.setProperty(`--col-${parseCSSVarId(header_0.column.id)}-size`, `${colSize_0}`);
|
|
17103
17583
|
}
|
|
17104
|
-
}
|
|
17584
|
+
};
|
|
17585
|
+
syncColumnSizing();
|
|
17586
|
+
const subscription = table.atoms.columnSizing.subscribe(syncColumnSizing);
|
|
17105
17587
|
return () => subscription.unsubscribe();
|
|
17106
|
-
}, [table]);
|
|
17588
|
+
}, [table, columns, columnVisibility, columnPinning]);
|
|
17107
17589
|
|
|
17108
17590
|
// Padding values keyed off density, read by cell/header/footer sx so density toggles
|
|
17109
17591
|
// reuse existing emotion classes instead of generating new ones per cell.
|
|
17110
|
-
const densityVars = useMemo(() => (
|
|
17111
|
-
'--mrt-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '1rem' : '1.5rem',
|
|
17112
|
-
'--mrt-display-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '0.5rem 0.75rem' : '1rem 1.25rem',
|
|
17113
|
-
'--mrt-head-display-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '0.75rem' : '1rem 1.25rem',
|
|
17114
|
-
'--mrt-head-cell-pb': density === 'compact' ? '0.1rem' : '0.6rem',
|
|
17115
|
-
'--mrt-head-cell-pt': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '.75rem' : '1.25rem'
|
|
17116
|
-
}), [density]);
|
|
17592
|
+
const densityVars = useMemo(() => getDensityStyles(density), [density]);
|
|
17117
17593
|
const columnVirtualizer = useMRT_ColumnVirtualizer(table);
|
|
17118
17594
|
const commonTableGroupProps = {
|
|
17119
17595
|
columnVirtualizer,
|
|
@@ -17488,6 +17964,8 @@ const MRT_TableContainer = ({
|
|
|
17488
17964
|
table: table
|
|
17489
17965
|
}), /*#__PURE__*/jsx(MRT_Table, {
|
|
17490
17966
|
table: table
|
|
17967
|
+
}), /*#__PURE__*/jsx(MRT_AutoSizeColumnsEffect, {
|
|
17968
|
+
table: table
|
|
17491
17969
|
}), newEntryModal.open && /*#__PURE__*/jsx(Suspense, {
|
|
17492
17970
|
fallback: null,
|
|
17493
17971
|
children: /*#__PURE__*/jsx(MRT_NewEntryModal$2, {
|
|
@@ -18150,6 +18628,7 @@ const buildInitialExportState = (availableExports, savedActiveExports) => {
|
|
|
18150
18628
|
|
|
18151
18629
|
const MaterialReactServerTableInstanceComponent = ({
|
|
18152
18630
|
config,
|
|
18631
|
+
paginationMode = 'pages',
|
|
18153
18632
|
loadData,
|
|
18154
18633
|
saveState,
|
|
18155
18634
|
getAllSelectableRowIds,
|
|
@@ -18171,11 +18650,9 @@ const MaterialReactServerTableInstanceComponent = ({
|
|
|
18171
18650
|
}, ref) => {
|
|
18172
18651
|
const [pageCount, setPageCount] = useState(undefined);
|
|
18173
18652
|
const [rowCount, setRowCount] = useState(0);
|
|
18174
|
-
const [isLoading, setIsLoading] = useState(
|
|
18175
|
-
// Skeletons only until the first data arrives. On later refetches (filter, sort, paging)
|
|
18176
|
-
// the current rows stay visible with a progress bar - swapping every cell to a Skeleton
|
|
18177
|
-
// and back remounts the whole table body twice per refetch.
|
|
18653
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
18178
18654
|
const [hasLoadedOnce, setHasLoadedOnce] = useState(false);
|
|
18655
|
+
const infinite = paginationMode === 'infinite';
|
|
18179
18656
|
|
|
18180
18657
|
// Filter availableExports by exportPermissions if provided.
|
|
18181
18658
|
// exportPermissions maps export key → required permission strings.
|
|
@@ -18202,6 +18679,11 @@ const MaterialReactServerTableInstanceComponent = ({
|
|
|
18202
18679
|
} = useServerTableState({
|
|
18203
18680
|
initialState: {
|
|
18204
18681
|
...config.initialState,
|
|
18682
|
+
density: tableOptionsOverrides.initialState?.density ?? config.initialState?.density ?? 'compact',
|
|
18683
|
+
pagination: {
|
|
18684
|
+
pageIndex: infinite ? 0 : config.initialState?.pagination?.pageIndex ?? 0,
|
|
18685
|
+
pageSize: config.initialState?.pagination?.pageSize ?? 10
|
|
18686
|
+
},
|
|
18205
18687
|
activeExports: buildInitialExportState(allowedExports, config.initialState?.activeExports)
|
|
18206
18688
|
},
|
|
18207
18689
|
saveState
|
|
@@ -18222,6 +18704,7 @@ const MaterialReactServerTableInstanceComponent = ({
|
|
|
18222
18704
|
manualFiltering: true,
|
|
18223
18705
|
manualPagination: true,
|
|
18224
18706
|
manualSorting: true,
|
|
18707
|
+
enableRowVirtualization: infinite,
|
|
18225
18708
|
enableRowPinning: false,
|
|
18226
18709
|
getRowId: originalRow => originalRow.id,
|
|
18227
18710
|
state: {
|
|
@@ -18249,7 +18732,9 @@ const MaterialReactServerTableInstanceComponent = ({
|
|
|
18249
18732
|
rowsPerPageOptions: config.rowsPerPageOptions
|
|
18250
18733
|
},
|
|
18251
18734
|
...tableOptionsOverrides,
|
|
18252
|
-
...handlers
|
|
18735
|
+
...handlers,
|
|
18736
|
+
enablePagination: infinite ? false : tableOptionsOverrides.enablePagination ?? true,
|
|
18737
|
+
positionProgressBars: tableOptionsOverrides.positionProgressBars ?? (infinite ? 'bottom' : 'header')
|
|
18253
18738
|
});
|
|
18254
18739
|
|
|
18255
18740
|
// Lets any code that already has `table` (row actions, deleteRowsFn/editRowFn,
|
|
@@ -18287,41 +18772,40 @@ const MaterialReactServerTableInstanceComponent = ({
|
|
|
18287
18772
|
setRowCount(prev_0 => prev_0 + insertedCount);
|
|
18288
18773
|
}
|
|
18289
18774
|
};
|
|
18290
|
-
const
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
if (hasNextPage) {
|
|
18301
|
-
setPageCount(-1);
|
|
18302
|
-
setRowCount(0);
|
|
18303
|
-
} else {
|
|
18304
|
-
setPageCount(undefined);
|
|
18305
|
-
setRowCount(newRowCount);
|
|
18306
|
-
}
|
|
18307
|
-
} finally {
|
|
18308
|
-
setIsLoading(false);
|
|
18775
|
+
const loader = useMRT_ServerDataLoader({
|
|
18776
|
+
table,
|
|
18777
|
+
loadData,
|
|
18778
|
+
paginationMode,
|
|
18779
|
+
fetchTrigger,
|
|
18780
|
+
onLoadingChange: setIsLoading,
|
|
18781
|
+
onLoaded: () => setHasLoadedOnce(true),
|
|
18782
|
+
onResult: result => {
|
|
18783
|
+
setPageCount(result.hasNextPage ? -1 : undefined);
|
|
18784
|
+
setRowCount(result.hasNextPage && !result.rowCount ? 0 : result.rowCount);
|
|
18309
18785
|
}
|
|
18310
|
-
}
|
|
18311
|
-
|
|
18312
|
-
|
|
18313
|
-
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18786
|
+
});
|
|
18787
|
+
const userContainerProps = tableOptionsOverrides.muiTableContainerProps;
|
|
18788
|
+
table.options.muiTableContainerProps = props_0 => {
|
|
18789
|
+
const userProps = parseFromValuesOrFunc(userContainerProps, props_0);
|
|
18790
|
+
return {
|
|
18791
|
+
...userProps,
|
|
18792
|
+
onScroll: event => {
|
|
18793
|
+
userProps?.onScroll?.(event);
|
|
18794
|
+
if (infinite) loader.checkScroll(event.currentTarget);
|
|
18795
|
+
}
|
|
18796
|
+
};
|
|
18797
|
+
};
|
|
18798
|
+
const customBottomActions = tableOptionsOverrides.renderBottomToolbarCustomActions;
|
|
18799
|
+
table.options.renderBottomToolbarCustomActions = props_1 => /*#__PURE__*/jsxs(Fragment, {
|
|
18800
|
+
children: [customBottomActions?.(props_1), loader.error && /*#__PURE__*/jsx(Alert, {
|
|
18801
|
+
severity: "error",
|
|
18802
|
+
action: /*#__PURE__*/jsx(Button, {
|
|
18803
|
+
onClick: () => void loader.retry(),
|
|
18804
|
+
children: table.options.localization.retryLoading ?? 'Retry'
|
|
18805
|
+
}),
|
|
18806
|
+
children: table.options.localization.errorMessage
|
|
18807
|
+
})]
|
|
18808
|
+
});
|
|
18325
18809
|
useImperativeHandle(ref, () => ({
|
|
18326
18810
|
refetch,
|
|
18327
18811
|
table
|
|
@@ -18338,11 +18822,15 @@ const GHOST_COLUMNS = Array.from({
|
|
|
18338
18822
|
id: `${i}`
|
|
18339
18823
|
}));
|
|
18340
18824
|
const HEADER_BAR_WIDTHS = [55, 40, 65, 45, 60, 35];
|
|
18341
|
-
const MaterialReactServerTableSkeleton =
|
|
18342
|
-
const $ = c(
|
|
18343
|
-
|
|
18825
|
+
const MaterialReactServerTableSkeleton = t0 => {
|
|
18826
|
+
const $ = c(21);
|
|
18827
|
+
const {
|
|
18828
|
+
density: t1
|
|
18829
|
+
} = t0;
|
|
18830
|
+
const density = t1 === undefined ? "compact" : t1;
|
|
18831
|
+
let t2;
|
|
18344
18832
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18345
|
-
|
|
18833
|
+
t2 = {
|
|
18346
18834
|
display: "flex",
|
|
18347
18835
|
flexDirection: "column",
|
|
18348
18836
|
height: "100%",
|
|
@@ -18350,13 +18838,13 @@ const MaterialReactServerTableSkeleton = () => {
|
|
|
18350
18838
|
animation: mrtDelayedFadeIn
|
|
18351
18839
|
}
|
|
18352
18840
|
};
|
|
18353
|
-
$[0] =
|
|
18841
|
+
$[0] = t2;
|
|
18354
18842
|
} else {
|
|
18355
|
-
|
|
18843
|
+
t2 = $[0];
|
|
18356
18844
|
}
|
|
18357
|
-
let
|
|
18845
|
+
let t3;
|
|
18358
18846
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18359
|
-
|
|
18847
|
+
t3 = /*#__PURE__*/jsxs(Box, {
|
|
18360
18848
|
sx: {
|
|
18361
18849
|
alignItems: "center",
|
|
18362
18850
|
display: "flex",
|
|
@@ -18384,15 +18872,15 @@ const MaterialReactServerTableSkeleton = () => {
|
|
|
18384
18872
|
width: 135
|
|
18385
18873
|
})]
|
|
18386
18874
|
});
|
|
18387
|
-
$[1] =
|
|
18875
|
+
$[1] = t3;
|
|
18388
18876
|
} else {
|
|
18389
|
-
|
|
18877
|
+
t3 = $[1];
|
|
18390
18878
|
}
|
|
18391
|
-
let
|
|
18879
|
+
let t4;
|
|
18392
18880
|
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18393
|
-
|
|
18881
|
+
t4 = /*#__PURE__*/jsxs(Box, {
|
|
18394
18882
|
sx: _temp$6,
|
|
18395
|
-
children: [
|
|
18883
|
+
children: [t3, /*#__PURE__*/jsx(Box, {
|
|
18396
18884
|
sx: {
|
|
18397
18885
|
alignItems: "center",
|
|
18398
18886
|
display: "flex",
|
|
@@ -18406,91 +18894,179 @@ const MaterialReactServerTableSkeleton = () => {
|
|
|
18406
18894
|
})
|
|
18407
18895
|
})]
|
|
18408
18896
|
});
|
|
18409
|
-
$[2] =
|
|
18897
|
+
$[2] = t4;
|
|
18410
18898
|
} else {
|
|
18411
|
-
|
|
18899
|
+
t4 = $[2];
|
|
18412
18900
|
}
|
|
18413
|
-
let
|
|
18901
|
+
let t5;
|
|
18414
18902
|
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18415
|
-
|
|
18903
|
+
t5 = {
|
|
18416
18904
|
flex: 1,
|
|
18417
18905
|
overflow: "hidden"
|
|
18418
18906
|
};
|
|
18419
|
-
$[3] =
|
|
18907
|
+
$[3] = t5;
|
|
18420
18908
|
} else {
|
|
18421
|
-
|
|
18909
|
+
t5 = $[3];
|
|
18422
18910
|
}
|
|
18423
|
-
let
|
|
18424
|
-
if ($[4]
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18911
|
+
let t6;
|
|
18912
|
+
if ($[4] !== density) {
|
|
18913
|
+
t6 = theme_0 => ({
|
|
18914
|
+
...getDensityStyles(density),
|
|
18915
|
+
borderCollapse: "collapse",
|
|
18916
|
+
tableLayout: "fixed",
|
|
18917
|
+
width: "100%",
|
|
18918
|
+
"& th": {
|
|
18919
|
+
borderBottom: `1px solid ${theme_0.palette.divider}`,
|
|
18920
|
+
fontSize: 14,
|
|
18921
|
+
p: "var(--mrt-cell-p)",
|
|
18922
|
+
pt: "var(--mrt-head-cell-pt)",
|
|
18923
|
+
pb: "var(--mrt-head-cell-pb)",
|
|
18924
|
+
textAlign: "left"
|
|
18925
|
+
},
|
|
18926
|
+
"& th span": {
|
|
18927
|
+
backgroundColor: alpha(theme_0.palette.text.primary, 0.16),
|
|
18928
|
+
borderRadius: 999,
|
|
18929
|
+
display: "block",
|
|
18930
|
+
height: 12
|
|
18931
|
+
}
|
|
18442
18932
|
});
|
|
18443
|
-
$[4] =
|
|
18933
|
+
$[4] = density;
|
|
18934
|
+
$[5] = t6;
|
|
18444
18935
|
} else {
|
|
18445
|
-
|
|
18936
|
+
t6 = $[5];
|
|
18446
18937
|
}
|
|
18447
|
-
let
|
|
18448
|
-
if ($[
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
|
|
18453
|
-
|
|
18454
|
-
children: /*#__PURE__*/
|
|
18938
|
+
let t7;
|
|
18939
|
+
if ($[6] !== density) {
|
|
18940
|
+
t7 = GHOST_COLUMNS.map((t8, i) => {
|
|
18941
|
+
const {
|
|
18942
|
+
id
|
|
18943
|
+
} = t8;
|
|
18944
|
+
return /*#__PURE__*/jsx("th", {
|
|
18945
|
+
children: /*#__PURE__*/jsx(Box, {
|
|
18455
18946
|
sx: {
|
|
18456
18947
|
alignItems: "center",
|
|
18457
18948
|
display: "flex",
|
|
18458
|
-
|
|
18949
|
+
height: density === "compact" ? "1.75rem" : "1.5em"
|
|
18459
18950
|
},
|
|
18460
|
-
children:
|
|
18461
|
-
|
|
18462
|
-
|
|
18463
|
-
|
|
18464
|
-
|
|
18465
|
-
}), /*#__PURE__*/jsx(Skeleton, {
|
|
18466
|
-
animation: "pulse",
|
|
18467
|
-
height: 31,
|
|
18468
|
-
variant: "text",
|
|
18469
|
-
width: 176
|
|
18470
|
-
}), /*#__PURE__*/jsx(Skeleton, {
|
|
18471
|
-
animation: "pulse",
|
|
18472
|
-
height: 22,
|
|
18473
|
-
variant: "text",
|
|
18474
|
-
width: 70
|
|
18475
|
-
}), /*#__PURE__*/jsx(Skeleton, {
|
|
18476
|
-
animation: "pulse",
|
|
18477
|
-
height: 24,
|
|
18478
|
-
variant: "circular",
|
|
18479
|
-
width: 24
|
|
18480
|
-
}), /*#__PURE__*/jsx(Skeleton, {
|
|
18481
|
-
animation: "pulse",
|
|
18482
|
-
height: 24,
|
|
18483
|
-
variant: "circular",
|
|
18484
|
-
width: 24
|
|
18485
|
-
})]
|
|
18951
|
+
children: /*#__PURE__*/jsx("span", {
|
|
18952
|
+
style: {
|
|
18953
|
+
width: `${HEADER_BAR_WIDTHS[i]}%`
|
|
18954
|
+
}
|
|
18955
|
+
})
|
|
18486
18956
|
})
|
|
18487
|
-
})
|
|
18957
|
+
}, id);
|
|
18488
18958
|
});
|
|
18489
|
-
$[
|
|
18959
|
+
$[6] = density;
|
|
18960
|
+
$[7] = t7;
|
|
18490
18961
|
} else {
|
|
18491
|
-
|
|
18962
|
+
t7 = $[7];
|
|
18492
18963
|
}
|
|
18493
|
-
|
|
18964
|
+
let t8;
|
|
18965
|
+
if ($[8] !== t7) {
|
|
18966
|
+
t8 = /*#__PURE__*/jsx("thead", {
|
|
18967
|
+
"aria-hidden": true,
|
|
18968
|
+
children: /*#__PURE__*/jsx("tr", {
|
|
18969
|
+
children: t7
|
|
18970
|
+
})
|
|
18971
|
+
});
|
|
18972
|
+
$[8] = t7;
|
|
18973
|
+
$[9] = t8;
|
|
18974
|
+
} else {
|
|
18975
|
+
t8 = $[9];
|
|
18976
|
+
}
|
|
18977
|
+
let t9;
|
|
18978
|
+
if ($[10] !== density) {
|
|
18979
|
+
t9 = getDefaultRowHeight(density);
|
|
18980
|
+
$[10] = density;
|
|
18981
|
+
$[11] = t9;
|
|
18982
|
+
} else {
|
|
18983
|
+
t9 = $[11];
|
|
18984
|
+
}
|
|
18985
|
+
let t10;
|
|
18986
|
+
if ($[12] !== t9) {
|
|
18987
|
+
t10 = /*#__PURE__*/jsx("tbody", {
|
|
18988
|
+
children: /*#__PURE__*/jsx(MRT_GhostRows, {
|
|
18989
|
+
cells: GHOST_COLUMNS,
|
|
18990
|
+
rowHeight: t9
|
|
18991
|
+
})
|
|
18992
|
+
});
|
|
18993
|
+
$[12] = t9;
|
|
18994
|
+
$[13] = t10;
|
|
18995
|
+
} else {
|
|
18996
|
+
t10 = $[13];
|
|
18997
|
+
}
|
|
18998
|
+
let t11;
|
|
18999
|
+
if ($[14] !== t10 || $[15] !== t6 || $[16] !== t8) {
|
|
19000
|
+
t11 = /*#__PURE__*/jsx(Box, {
|
|
19001
|
+
sx: t5,
|
|
19002
|
+
children: /*#__PURE__*/jsxs(Box, {
|
|
19003
|
+
component: "table",
|
|
19004
|
+
sx: t6,
|
|
19005
|
+
children: [t8, t10]
|
|
19006
|
+
})
|
|
19007
|
+
});
|
|
19008
|
+
$[14] = t10;
|
|
19009
|
+
$[15] = t6;
|
|
19010
|
+
$[16] = t8;
|
|
19011
|
+
$[17] = t11;
|
|
19012
|
+
} else {
|
|
19013
|
+
t11 = $[17];
|
|
19014
|
+
}
|
|
19015
|
+
let t12;
|
|
19016
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
19017
|
+
t12 = /*#__PURE__*/jsx(Box, {
|
|
19018
|
+
sx: _temp2$3,
|
|
19019
|
+
children: /*#__PURE__*/jsxs(Box, {
|
|
19020
|
+
sx: {
|
|
19021
|
+
alignItems: "center",
|
|
19022
|
+
display: "flex",
|
|
19023
|
+
gap: "1rem"
|
|
19024
|
+
},
|
|
19025
|
+
children: [/*#__PURE__*/jsx(Skeleton, {
|
|
19026
|
+
animation: "pulse",
|
|
19027
|
+
height: 36,
|
|
19028
|
+
variant: "rounded",
|
|
19029
|
+
width: 136
|
|
19030
|
+
}), /*#__PURE__*/jsx(Skeleton, {
|
|
19031
|
+
animation: "pulse",
|
|
19032
|
+
height: 31,
|
|
19033
|
+
variant: "text",
|
|
19034
|
+
width: 176
|
|
19035
|
+
}), /*#__PURE__*/jsx(Skeleton, {
|
|
19036
|
+
animation: "pulse",
|
|
19037
|
+
height: 22,
|
|
19038
|
+
variant: "text",
|
|
19039
|
+
width: 70
|
|
19040
|
+
}), /*#__PURE__*/jsx(Skeleton, {
|
|
19041
|
+
animation: "pulse",
|
|
19042
|
+
height: 24,
|
|
19043
|
+
variant: "circular",
|
|
19044
|
+
width: 24
|
|
19045
|
+
}), /*#__PURE__*/jsx(Skeleton, {
|
|
19046
|
+
animation: "pulse",
|
|
19047
|
+
height: 24,
|
|
19048
|
+
variant: "circular",
|
|
19049
|
+
width: 24
|
|
19050
|
+
})]
|
|
19051
|
+
})
|
|
19052
|
+
});
|
|
19053
|
+
$[18] = t12;
|
|
19054
|
+
} else {
|
|
19055
|
+
t12 = $[18];
|
|
19056
|
+
}
|
|
19057
|
+
let t13;
|
|
19058
|
+
if ($[19] !== t11) {
|
|
19059
|
+
t13 = /*#__PURE__*/jsxs(Paper, {
|
|
19060
|
+
"data-testid": "server-table-skeleton",
|
|
19061
|
+
sx: t2,
|
|
19062
|
+
children: [t4, t11, t12]
|
|
19063
|
+
});
|
|
19064
|
+
$[19] = t11;
|
|
19065
|
+
$[20] = t13;
|
|
19066
|
+
} else {
|
|
19067
|
+
t13 = $[20];
|
|
19068
|
+
}
|
|
19069
|
+
return t13;
|
|
18494
19070
|
};
|
|
18495
19071
|
function _temp$6(theme) {
|
|
18496
19072
|
return {
|
|
@@ -18503,38 +19079,7 @@ function _temp$6(theme) {
|
|
|
18503
19079
|
paddingRight: "0.3rem"
|
|
18504
19080
|
};
|
|
18505
19081
|
}
|
|
18506
|
-
function _temp2$3(
|
|
18507
|
-
return {
|
|
18508
|
-
borderCollapse: "collapse",
|
|
18509
|
-
tableLayout: "fixed",
|
|
18510
|
-
width: "100%",
|
|
18511
|
-
"& th": {
|
|
18512
|
-
borderBottom: `1px solid ${theme_0.palette.divider}`,
|
|
18513
|
-
height: 48,
|
|
18514
|
-
p: "0.5rem",
|
|
18515
|
-
textAlign: "left"
|
|
18516
|
-
},
|
|
18517
|
-
"& th > span": {
|
|
18518
|
-
backgroundColor: alpha(theme_0.palette.text.primary, 0.16),
|
|
18519
|
-
borderRadius: 999,
|
|
18520
|
-
display: "block",
|
|
18521
|
-
height: 12
|
|
18522
|
-
}
|
|
18523
|
-
};
|
|
18524
|
-
}
|
|
18525
|
-
function _temp3$1(t0, i) {
|
|
18526
|
-
const {
|
|
18527
|
-
id
|
|
18528
|
-
} = t0;
|
|
18529
|
-
return /*#__PURE__*/jsx("th", {
|
|
18530
|
-
children: /*#__PURE__*/jsx("span", {
|
|
18531
|
-
style: {
|
|
18532
|
-
width: `${HEADER_BAR_WIDTHS[i]}%`
|
|
18533
|
-
}
|
|
18534
|
-
})
|
|
18535
|
-
}, id);
|
|
18536
|
-
}
|
|
18537
|
-
function _temp4(theme_1) {
|
|
19082
|
+
function _temp2$3(theme_1) {
|
|
18538
19083
|
return {
|
|
18539
19084
|
alignItems: "center",
|
|
18540
19085
|
borderTop: `1px solid ${theme_1.palette.divider}`,
|
|
@@ -18579,7 +19124,9 @@ const MaterialReactServerTableComponent = ({
|
|
|
18579
19124
|
};
|
|
18580
19125
|
}, [loadConfig]);
|
|
18581
19126
|
if (configLoading) {
|
|
18582
|
-
return /*#__PURE__*/jsx(MaterialReactServerTableSkeleton, {
|
|
19127
|
+
return /*#__PURE__*/jsx(MaterialReactServerTableSkeleton, {
|
|
19128
|
+
density: instanceProps.state?.density ?? instanceProps.initialState?.density ?? 'compact'
|
|
19129
|
+
});
|
|
18583
19130
|
}
|
|
18584
19131
|
if (!config) {
|
|
18585
19132
|
return /*#__PURE__*/jsx(MaterialReactServerTableError, {
|
|
@@ -20297,5 +20844,5 @@ function _temp2(state_0) {
|
|
|
20297
20844
|
};
|
|
20298
20845
|
}
|
|
20299
20846
|
|
|
20300
|
-
export { CHECKBOX_DISPLAY_COLUMN_ID, MRT_ActionMenuItem, MRT_AdvancedFilters, MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_ExpandAllButton, MRT_ExpandButton, MRT_ExportsToolbar, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_NewEntryForm, MRT_NewEntryFormActions, MRT_NewEntryFormActionsContext, MRT_NewEntryFormProvider, MRT_NewEntryModal, MRT_PaginationBoundsEffect, MRT_RowActionMenu, MRT_RowPinButton,
|
|
20847
|
+
export { CHECKBOX_DISPLAY_COLUMN_ID, MRT_ActionMenuItem, MRT_AdvancedFilters, MRT_AggregationFns, MRT_BottomToolbar, MRT_ColumnActionMenu, MRT_ColumnPinningButtons, MRT_DefaultColumn, MRT_DefaultDisplayColumn, MRT_ExpandAllButton, MRT_ExpandButton, MRT_ExportsToolbar, MRT_GrabHandleButton, MRT_LinearProgressBar, MRT_NewEntryForm, MRT_NewEntryFormActions, MRT_NewEntryFormActionsContext, MRT_NewEntryFormProvider, MRT_NewEntryModal, MRT_PaginationBoundsEffect, MRT_RowActionMenu, MRT_RowPinButton, MRT_SelectAllMenuItems, MRT_SelectCheckbox, MRT_SelectionCountBadge, MRT_ShowHideColumnsButton, MRT_ShowHideColumnsMenu, MRT_ShowHideColumnsMenuItems, MRT_SortingFns, MRT_Table, MRT_TableBody, MRT_TableBodyCell, MRT_TableBodyCellValue, MRT_TableBodyRow, MRT_TableBodyRowPinButton, MRT_TableContainer, MRT_TableDetailPanel, MRT_TableFooter, MRT_TableFooterCell, MRT_TableFooterRow, MRT_TableHead, MRT_TableHeadCell, MRT_TableHeadCellColumnActionsButton, MRT_TableHeadCellGrabHandle, MRT_TableHeadCellResizeHandle, MRT_TableHeadCellSortLabel, MRT_TableHeadRow, MRT_TableLoadingOverlay, MRT_TablePagination, MRT_TablePaper, MRT_ToggleDensePaddingButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MaterialReactServerTable, MaterialReactTable, Memo_MRT_TableBody, Memo_MRT_TableBodyCell, Memo_MRT_TableBodyRow, RHF_FormProvider, buildDefaultValues, createDeleteAction, createEditAction, createExportAction, createMRTColumnHelper, createRow, defaultDisplayColumnProps, flexRender, getAllLeafColumnDefs, getAutoSizeCandidateColumnIds, getColumnId, getDefaultColumnOrderIds, getIsAllPagesSelectionActive, getIsRowSelected, getLeadingDisplayColumnIds, getMRT_RowSelectionHandler, getMRT_Rows, getMRT_SelectAllHandler, getTrailingDisplayColumnIds, groupFieldsBySection, normalizeRowExpandColumnOrder, prepareColumns, reorderColumn, resolveFormFields, showRowActionsColumn, showRowExpandColumn, showRowNumbersColumn, showRowPinningColumn, showRowSelectionColumn, showRowSpacerColumn, sortByOrder, toAdditionalRenderEntries, toColumnRenderEntries, useMRT_ColumnVirtualizer, useMRT_NewEntryFormActions, useMRT_RowVirtualizer, useMRT_Rows, useMRT_TableInstance, useMRT_TableOptions, useMaterialReactTable };
|
|
20301
20848
|
//# sourceMappingURL=index.esm.js.map
|