@dooherceg/material-react-table 4.1.4 → 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/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. Not configurable — mirrors how getDefaultColumnPinningState
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: alpha(darken(baseBackgroundColor, theme.palette.mode === 'dark' ? 0.05 : 0.01), 0.97),
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,60 +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
- minWidth: `max(calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size) * 1px), ${columnDef.minSize ?? 30}px)`,
576
- width: `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size) * 1px)`
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
577
668
  };
578
- if (layoutMode === 'grid') {
579
- widthStyles.flex = `${[0, false].includes(columnDef.grow) ? 0 : `var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size)`} 0 auto`;
580
- } else if (layoutMode === 'grid-no-grow') {
581
- widthStyles.flex = `${+(columnDef.grow || 0)} 0 auto`;
669
+ if (layoutMode === 'grid' || layoutMode === 'grid-no-grow') {
670
+ const weight = getColumnGrowWeight(column, table);
671
+ const growVar = `var(--col-${parseCSSVarId(column.id)}-grow, ${weight})`;
672
+ widthStyles.flex = `${growVar} 0 auto`;
582
673
  }
583
-
584
- // The checkbox column is technically pinned (for sticky positioning) but
585
- // should look like a regular center column — no background overlay or shadow.
586
- const isCheckboxColumn = column.id === CHECKBOX_DISPLAY_COLUMN_ID;
587
-
588
- // Count all currently pinned column IDs across both sides.
589
- // Checkbox is always pinned (counts as 1), so > 1 means the user has
590
- // explicitly pinned at least one additional column.
591
- // Avoid spreading into a new array on this per-cell hot path — a length sum
592
- // is enough, we never need the combined array itself.
593
- const {
594
- columnPinning
595
- } = table.getState();
596
- const totalPinnedColumnCount = (columnPinning.start?.length ?? 0) + (columnPinning.end?.length ?? 0);
597
- const hasNoPinnedColumns = totalPinnedColumnCount === 0;
598
674
  const pinnedStyles = isColumnPinned ? {
599
- // For checkbox: suppress pinned background/shadow only when other
600
- // columns are also pinned (> 1 total). When it is the sole pinned column
601
- // no override is needed. For all other columns apply standard pinned styles.
602
- ...(isCheckboxColumn ? hasNoPinnedColumns ? {
603
- // Use doubled class selector (&&) to beat the row-level
604
- // td[data-pinned="true"]:before specificity from MRT_TableBodyRow.
605
- '&&[data-pinned="true"]': {
606
- '&:before': {
607
- backgroundColor: 'transparent',
608
- boxShadow: 'none'
609
- }
610
- }
611
- } :
612
- // Other columns are also pinned — apply standard pinned background
613
- // so the checkbox header matches the pinned row cells below it.
614
- getCommonPinnedCellStyles({
675
+ ...getCommonPinnedCellStyles({
615
676
  column,
616
677
  table,
617
678
  theme
618
- }) : getCommonPinnedCellStyles({
619
- column,
620
- table,
621
- theme
622
- })),
679
+ }),
623
680
  // Logical CSS insets (not left/right) so pinning stays correct in RTL
624
681
  // without branching on theme.direction here.
625
682
  insetInlineStart: isColumnPinned === 'start' ? `${column.getStart('start')}px` : undefined,
626
- // Skip opacity reduction for checkbox — keep it fully opaque like center columns
627
- opacity: isCheckboxColumn ? undefined : 0.97,
628
683
  position: 'sticky',
629
684
  insetInlineEnd: isColumnPinned === 'end' ? `${column.getAfter('end')}px` : undefined
630
685
  } : {};
@@ -2077,7 +2132,7 @@ const MRT_ToggleRowActionMenuButton = t0 => {
2077
2132
  staticRowIndex,
2078
2133
  table
2079
2134
  }) : renderRowActionMenuItems?.({
2080
- closeMenu: _temp$A,
2135
+ closeMenu: _temp$B,
2081
2136
  row,
2082
2137
  staticRowIndex,
2083
2138
  table
@@ -2127,7 +2182,7 @@ const MRT_ToggleRowActionMenuButton = t0 => {
2127
2182
  }
2128
2183
  return t5;
2129
2184
  };
2130
- function _temp$A() {}
2185
+ function _temp$B() {}
2131
2186
 
2132
2187
  const getMRT_RowActionsColumnDef = tableOptions => {
2133
2188
  return {
@@ -2142,7 +2197,18 @@ const getMRT_RowActionsColumnDef = tableOptions => {
2142
2197
  staticRowIndex: staticRowIndex,
2143
2198
  table: table
2144
2199
  }),
2200
+ ...(tableOptions.positionActionsColumn === 'last' && {
2201
+ grow: true
2202
+ }),
2145
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
+ },
2146
2212
  header: 'actions',
2147
2213
  id: 'mrt-row-actions',
2148
2214
  size: 70,
@@ -2195,7 +2261,7 @@ const MRT_ExpandAllButton = t0 => {
2195
2261
  const {
2196
2262
  isLoading
2197
2263
  } = t3;
2198
- const density = useSelector(table.store, _temp$z);
2264
+ const density = useSelector(table.store, _temp$A);
2199
2265
  let t4;
2200
2266
  if ($[5] !== muiExpandAllButtonProps || $[6] !== table) {
2201
2267
  t4 = parseFromValuesOrFunc(muiExpandAllButtonProps, {
@@ -2284,7 +2350,7 @@ const MRT_ExpandAllButton = t0 => {
2284
2350
  }
2285
2351
  return t7;
2286
2352
  };
2287
- function _temp$z(state) {
2353
+ function _temp$A(state) {
2288
2354
  return state.density;
2289
2355
  }
2290
2356
 
@@ -2367,10 +2433,12 @@ const MRT_ExpandButton = ({
2367
2433
  "aria-label": localization.expand,
2368
2434
  disabled: !canExpand && !detailPanel,
2369
2435
  ...iconButtonProps,
2436
+ disableRipple: true,
2370
2437
  onClick: handleToggleExpand,
2371
2438
  sx: theme_0 => ({
2372
2439
  opacity: !canExpand && !detailPanel ? 0.3 : 1,
2373
2440
  [theme_0.direction === 'rtl' || positionExpandColumn === 'last' ? 'mr' : 'ml']: `${row.depth * 16}px`,
2441
+ height: density === 'compact' ? '1.75rem' : '2.25rem',
2374
2442
  width: density === 'compact' ? '1.75rem' : '2.25rem',
2375
2443
  ...parseFromValuesOrFunc(iconButtonProps?.sx, theme_0)
2376
2444
  }),
@@ -2497,13 +2565,16 @@ const MRT_ReorderRowCheckbox = t0 => {
2497
2565
  onChange,
2498
2566
  isSelected
2499
2567
  } = t0;
2500
- const handleClick = _temp$y;
2568
+ const handleClick = _temp$z;
2501
2569
  let t1;
2502
2570
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2503
2571
  t1 = {
2504
2572
  color: _temp2$d,
2573
+ height: "1.75rem",
2574
+ m: "-0.4rem",
2575
+ width: "1.75rem",
2505
2576
  "&.Mui-checked": {
2506
- color: _temp3$6
2577
+ color: _temp3$5
2507
2578
  }
2508
2579
  };
2509
2580
  $[0] = t1;
@@ -2518,6 +2589,7 @@ const MRT_ReorderRowCheckbox = t0 => {
2518
2589
  disableRipple: true,
2519
2590
  onChange: onChange,
2520
2591
  onClick: handleClick,
2592
+ size: "small",
2521
2593
  sx: t1
2522
2594
  });
2523
2595
  $[1] = isSelected;
@@ -2528,13 +2600,13 @@ const MRT_ReorderRowCheckbox = t0 => {
2528
2600
  }
2529
2601
  return t2;
2530
2602
  };
2531
- function _temp$y(event) {
2603
+ function _temp$z(event) {
2532
2604
  event.stopPropagation();
2533
2605
  }
2534
2606
  function _temp2$d(theme) {
2535
2607
  return theme.palette.warning.main;
2536
2608
  }
2537
- function _temp3$6(theme_0) {
2609
+ function _temp3$5(theme_0) {
2538
2610
  return theme_0.palette.warning.main;
2539
2611
  }
2540
2612
 
@@ -2853,7 +2925,7 @@ const useTreeRowReorderingHeader = t0 => {
2853
2925
  enableRowReordering,
2854
2926
  onTreeRowReorder
2855
2927
  } = t0;
2856
- const rowReorderingSelection = useSelector(table.store, _temp$x);
2928
+ const rowReorderingSelection = useSelector(table.store, _temp$y);
2857
2929
  let selectedReorderRowIds;
2858
2930
  let selectedRowsForReorder;
2859
2931
  let t1;
@@ -2916,7 +2988,7 @@ const useTreeRowReorderingHeader = t0 => {
2916
2988
  }
2917
2989
  return t3;
2918
2990
  };
2919
- function _temp$x(state) {
2991
+ function _temp$y(state) {
2920
2992
  return state.rowReorderingSelection;
2921
2993
  }
2922
2994
  function _temp2$c(selectedRow) {
@@ -3259,7 +3331,7 @@ const MRT_TableBodyRowPinButton = t0 => {
3259
3331
  enableRowPinning,
3260
3332
  rowPinningDisplayMode
3261
3333
  } = t1;
3262
- const density = useSelector(table.store, _temp$w);
3334
+ const density = useSelector(table.store, _temp$x);
3263
3335
  const canPin = parseFromValuesOrFunc(enableRowPinning, row);
3264
3336
  if (!canPin) {
3265
3337
  return null;
@@ -3340,7 +3412,7 @@ const MRT_TableBodyRowPinButton = t0 => {
3340
3412
  }
3341
3413
  return t4;
3342
3414
  };
3343
- function _temp$w(state) {
3415
+ function _temp$x(state) {
3344
3416
  return state.density;
3345
3417
  }
3346
3418
 
@@ -3363,166 +3435,6 @@ const getMRT_RowPinningColumnDef = tableOptions => {
3363
3435
  };
3364
3436
  };
3365
3437
 
3366
- const MRT_SelectAllMenu = ({
3367
- table
3368
- }) => {
3369
- const [anchorEl, setAnchorEl] = useState(null);
3370
- const [isSelectingAllPages, setIsSelectingAllPages] = useState(false);
3371
- const {
3372
- getState,
3373
- options: {
3374
- enableRowPinning,
3375
- getAllSelectableRowIds,
3376
- localization,
3377
- rowPinningDisplayMode
3378
- },
3379
- refs: {
3380
- allSelectableRowIdsRef
3381
- }
3382
- } = table;
3383
- const {
3384
- isLoading
3385
- } = getState();
3386
- const handleOpen = event => {
3387
- setAnchorEl(event.currentTarget);
3388
- };
3389
- const handleClose = () => {
3390
- setAnchorEl(null);
3391
- };
3392
-
3393
- // Clears row pinning on every bulk selection/deselection
3394
- const clearPinning = () => {
3395
- if (enableRowPinning && rowPinningDisplayMode?.includes('select')) {
3396
- table.setRowPinning({
3397
- bottom: [],
3398
- top: []
3399
- });
3400
- }
3401
- };
3402
-
3403
- // ── Current-page actions ────────────────────────────────────────────────────
3404
-
3405
- const handleSelectCurrentPage = () => {
3406
- table.toggleAllPageRowsSelected(true);
3407
- clearPinning();
3408
- handleClose();
3409
- };
3410
- const handleDeselectCurrentPage = () => {
3411
- if (allSelectableRowIdsRef.current.length > 0) {
3412
- // 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.
3413
- table.setRowSelection({});
3414
- allSelectableRowIdsRef.current = [];
3415
- } else {
3416
- table.toggleAllPageRowsSelected(false);
3417
- }
3418
- clearPinning();
3419
- handleClose();
3420
- };
3421
-
3422
- // ── All-pages actions ───────────────────────────────────────────────────────
3423
-
3424
- const handleSelectAllPages = async () => {
3425
- handleClose();
3426
- if (getAllSelectableRowIds) {
3427
- // Server-side: IDs are not available locally, fetch them from the API
3428
- setIsSelectingAllPages(true);
3429
- table.setShowProgressBars(true);
3430
- try {
3431
- const ids = await getAllSelectableRowIds({
3432
- table
3433
- });
3434
- allSelectableRowIdsRef.current = ids;
3435
- const newSelection = {};
3436
- ids.forEach(id => {
3437
- newSelection[id] = true;
3438
- });
3439
- table.setRowSelection(newSelection);
3440
- clearPinning();
3441
- } finally {
3442
- setIsSelectingAllPages(false);
3443
- table.setShowProgressBars(false);
3444
- }
3445
- } else {
3446
- // Client-side: all data is available locally
3447
- table.toggleAllRowsSelected(true);
3448
- clearPinning();
3449
- }
3450
- };
3451
- const handleDeselectAllPages = () => {
3452
- if (getAllSelectableRowIds) {
3453
- table.setRowSelection({});
3454
- } else {
3455
- table.toggleAllRowsSelected(false);
3456
- }
3457
- allSelectableRowIdsRef.current = [];
3458
- clearPinning();
3459
- handleClose();
3460
- };
3461
- const isDisabled = isLoading || isSelectingAllPages;
3462
- return /*#__PURE__*/jsxs(Fragment, {
3463
- children: [/*#__PURE__*/jsx(Tooltip, {
3464
- ...getCommonTooltipProps(),
3465
- title: localization.toggleSelectAll,
3466
- children: /*#__PURE__*/jsx("span", {
3467
- children: /*#__PURE__*/jsx(IconButton, {
3468
- "aria-label": localization.toggleSelectAll,
3469
- disabled: isDisabled,
3470
- onClick: handleOpen,
3471
- size: "small",
3472
- sx: {
3473
- height: '1.5rem',
3474
- width: '1.5rem'
3475
- },
3476
- children: /*#__PURE__*/jsx(table.options.icons.MoreVertIcon, {
3477
- style: {
3478
- transform: 'scale(0.85)'
3479
- }
3480
- })
3481
- })
3482
- })
3483
- }), /*#__PURE__*/jsx(Menu, {
3484
- anchorEl: anchorEl,
3485
- onClose: handleClose,
3486
- open: Boolean(anchorEl),
3487
- children: /*#__PURE__*/jsx(Subscribe, {
3488
- selector: state => ({
3489
- pagination: state.pagination,
3490
- rowSelection: state.rowSelection
3491
- }),
3492
- source: table.store,
3493
- children: ({
3494
- rowSelection
3495
- }) => {
3496
- const isAllCurrentPageSelected = table.getIsAllPageRowsSelected();
3497
- const isAllPagesActive = getIsAllPagesSelectionActive(table, rowSelection);
3498
- return /*#__PURE__*/jsxs(Fragment, {
3499
- children: [isAllCurrentPageSelected ? /*#__PURE__*/jsx(MenuItem, {
3500
- onClick: handleDeselectCurrentPage,
3501
- children: localization.deselectAllOnCurrentPage
3502
- }) : /*#__PURE__*/jsx(MenuItem, {
3503
- onClick: handleSelectCurrentPage,
3504
- children: localization.selectAllOnCurrentPage
3505
- }), isAllPagesActive ? /*#__PURE__*/jsx(MenuItem, {
3506
- onClick: handleDeselectAllPages,
3507
- children: localization.deselectAllOnAllPages
3508
- }) : /*#__PURE__*/jsxs(MenuItem, {
3509
- disabled: isSelectingAllPages,
3510
- onClick: handleSelectAllPages,
3511
- children: [isSelectingAllPages && /*#__PURE__*/jsx(CircularProgress, {
3512
- "aria-label": "Loading",
3513
- size: 14,
3514
- sx: {
3515
- mr: 1
3516
- }
3517
- }), localization.selectAllOnAllPages]
3518
- })]
3519
- });
3520
- }
3521
- })
3522
- })]
3523
- });
3524
- };
3525
-
3526
3438
  const MRT_SelectCheckbox = t0 => {
3527
3439
  const $ = c(32);
3528
3440
  let rest;
@@ -3569,7 +3481,7 @@ const MRT_SelectCheckbox = t0 => {
3569
3481
  const {
3570
3482
  isLoading
3571
3483
  } = t2;
3572
- const density = useSelector(table.store, _temp$v);
3484
+ const density = useSelector(table.store, _temp$w);
3573
3485
  const selectAll = !row;
3574
3486
  let t3;
3575
3487
  if ($[7] !== row || $[8] !== staticRowIndex || $[9] !== table) {
@@ -3687,7 +3599,7 @@ const MRT_SelectCheckbox = t0 => {
3687
3599
  }
3688
3600
  return t6;
3689
3601
  };
3690
- function _temp$v(state) {
3602
+ function _temp$w(state) {
3691
3603
  return state.density;
3692
3604
  }
3693
3605
  function _temp2$b(state_0) {
@@ -3714,23 +3626,18 @@ const getMRT_RowSelectColumnDef = tableOptions => {
3714
3626
  }),
3715
3627
  Header: enableSelectAll && enableMultiRowSelection ? ({
3716
3628
  table
3717
- }) => /*#__PURE__*/jsxs(Box, {
3718
- sx: {
3719
- alignItems: 'center',
3720
- display: 'flex'
3721
- },
3722
- children: [/*#__PURE__*/jsx(MRT_SelectCheckbox, {
3723
- table: table
3724
- }), /*#__PURE__*/jsx(MRT_SelectAllMenu, {
3725
- table: table
3726
- })]
3629
+ }) => /*#__PURE__*/jsx(MRT_SelectCheckbox, {
3630
+ table: table
3727
3631
  }) : undefined,
3728
3632
  grow: false,
3729
3633
  ...defaultDisplayColumnProps({
3634
+ columnSpecificDefaults: {
3635
+ enableColumnActions: true,
3636
+ enablePinning: true
3637
+ },
3730
3638
  header: 'select',
3731
3639
  id: '__check__',
3732
- size: enableSelectAll ? 90 : 70,
3733
- // widened from 60 to accommodate both the checkbox and the menu button
3640
+ size: 56,
3734
3641
  tableOptions
3735
3642
  })
3736
3643
  };
@@ -3803,6 +3710,7 @@ const MRT_Default_Icons = {
3803
3710
  // ComponentType<SvgIconProps> is the correct type for all MUI SvgIcon components.
3804
3711
 
3805
3712
  const MRT_Localization_EN = {
3713
+ retryLoading: 'Retry',
3806
3714
  language: 'en',
3807
3715
  actions: 'Actions',
3808
3716
  and: 'and',
@@ -4203,7 +4111,7 @@ const getMRT_RowSpacerColumnDef = tableOptions => {
4203
4111
  size: 0,
4204
4112
  tableOptions
4205
4113
  }),
4206
- grow: true,
4114
+ grow: !(tableOptions.positionActionsColumn === 'last' && showRowActionsColumn(tableOptions)),
4207
4115
  ...MRT_DefaultDisplayColumn,
4208
4116
  muiTableBodyCellProps: blankColProps,
4209
4117
  muiTableFooterCellProps: blankColProps,
@@ -4469,6 +4377,8 @@ const useMRT_TableInstance = definedTableOptions => {
4469
4377
  const tableRef = useRef(null);
4470
4378
  const isResizingRef = useRef(false);
4471
4379
  const resizeIndicatorRef = useRef(null);
4380
+ const autoSizeColumnIdsRef = useRef(new Set());
4381
+ const autoSizedColumnWidthsRef = useRef({});
4472
4382
 
4473
4383
  //transform initial state with proper column order
4474
4384
  const initialState = useMemo(() => {
@@ -4482,12 +4392,6 @@ const useMRT_TableInstance = definedTableOptions => {
4482
4392
  }
4483
4393
  };
4484
4394
  initState.columnOrder = normalizeRowExpandColumnOrder(mergedOptionsSnapshot, initState.columnOrder ?? getDefaultColumnOrderIds(mergedOptionsSnapshot));
4485
-
4486
- // Ensure the checkbox column is always the leftmost sticky column when
4487
- // row selection is enabled, regardless of what the user pinned initially.
4488
- // The checkbox is pinned for positioning only — visual styles are overridden
4489
- // in style.utils.ts so it looks like a regular center column.
4490
- initState.columnPinning = getDefaultColumnPinningState(mergedOptionsSnapshot, initState.columnPinning ?? {});
4491
4395
  initState.showAdvancedFilters = initState.showAdvancedFilters ?? false;
4492
4396
  // getInitialState() on a custom TanStack feature only receives the
4493
4397
  // accumulated initialState object, not the full table options — so the
@@ -4533,23 +4437,12 @@ const useMRT_TableInstance = definedTableOptions => {
4533
4437
  ...definedTableOptions.state
4534
4438
  };
4535
4439
 
4536
- // Normalize controlled columnPinning state: if the user passes state.columnPinning
4537
- // directly (controlled mode), we still need to ensure that the checkbox column
4538
- // is always at the front of the start-pinned group, just like we do for initialState.
4539
- const assembledColumnPinning = definedTableOptions.state.columnPinning;
4540
- if (assembledColumnPinning && !!definedTableOptions.enableRowSelection) {
4541
- definedTableOptions.state = {
4542
- ...definedTableOptions.state,
4543
- columnPinning: getDefaultColumnPinningState(definedTableOptions, assembledColumnPinning)
4544
- };
4545
- }
4546
-
4547
4440
  //The table options now include all state needed to help determine column visibility and order logic
4548
4441
  const statefulTableOptions = definedTableOptions;
4549
4442
 
4550
4443
  // Keep mrt-row-expand locked to its slot (right after the checkbox, or
4551
4444
  // first if there's no checkbox) regardless of what columnOrder the
4552
- // consumer passes in — same enforcement model as columnPinning above.
4445
+ // consumer passes in.
4553
4446
  statefulTableOptions.state = {
4554
4447
  ...statefulTableOptions.state,
4555
4448
  columnOrder: normalizeRowExpandColumnOrder(statefulTableOptions, statefulTableOptions.state.columnOrder)
@@ -4561,6 +4454,12 @@ const useMRT_TableInstance = definedTableOptions => {
4561
4454
  //recompute (and recreate every cell of every row) on unrelated renders
4562
4455
  //like hover, menu open/close, or density toggle
4563
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]);
4564
4463
  const {
4565
4464
  defaultDisplayColumn,
4566
4465
  displayColumnDefOptions,
@@ -4658,6 +4557,8 @@ const useMRT_TableInstance = definedTableOptions => {
4658
4557
  table.refs = {
4659
4558
  actionCellRef,
4660
4559
  allSelectableRowIdsRef,
4560
+ autoSizeColumnIdsRef,
4561
+ autoSizedColumnWidthsRef,
4661
4562
  bottomToolbarRef,
4662
4563
  editInputRefs,
4663
4564
  isResizingRef,
@@ -4702,7 +4603,7 @@ const useMRT_TableInstance = definedTableOptions => {
4702
4603
  // setRowsState updater in tableCrudFns.ts), not at memo-creation time — so
4703
4604
  // this memo doesn't need pagination as a dependency at all, keeping it
4704
4605
  // stable across pagination changes instead of rebuilding every page turn.
4705
- const getPageSize = useCallback(() => table.store.state.pagination.pageSize, [table]);
4606
+ const getPageSize = useCallback(() => table.options.enablePagination ? table.store.state.pagination.pageSize : undefined, [table]);
4706
4607
  const crudHandlers = useMemo(() => {
4707
4608
  const context = {
4708
4609
  getRowId: resolveRowId,
@@ -4846,6 +4747,41 @@ const useMRT_Rows = table => {
4846
4747
  return rows;
4847
4748
  };
4848
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
+
4849
4785
  const useMRT_RowVirtualizer = (table, rows) => {
4850
4786
  const {
4851
4787
  getRowModel,
@@ -4883,7 +4819,7 @@ const useMRT_RowVirtualizer = (table, rows) => {
4883
4819
  //matches the defaultRowHeight assumption in MRT_TableBodyRow so the
4884
4820
  //initial estimate (before measureElement corrects it for dynamic content)
4885
4821
  //doesn't cause scroll-position drift
4886
- const normalRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
4822
+ const normalRowHeight = getDefaultRowHeight(density);
4887
4823
  const rangeExtractor = useCallback(range => extraIndexRangeExtractor(range, draggingRowIndex), [draggingRowIndex]);
4888
4824
 
4889
4825
  // enableRowVirtualization can't change after mount (frozen in
@@ -5187,7 +5123,7 @@ const MRT_ActiveFilterItemContainer = t0 => {
5187
5123
  if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
5188
5124
  t6 = {
5189
5125
  alignItems: "center",
5190
- border: _temp$u,
5126
+ border: _temp$v,
5191
5127
  borderRadius: 1,
5192
5128
  display: "flex",
5193
5129
  gap: 0.5
@@ -5312,7 +5248,7 @@ const MRT_ActiveFilterItemContainer = t0 => {
5312
5248
  return t17;
5313
5249
  };
5314
5250
  var MRT_ActiveFilterItemContainer$1 = MRT_ActiveFilterItemContainer;
5315
- function _temp$u(theme) {
5251
+ function _temp$v(theme) {
5316
5252
  return `1px dashed ${theme.palette.divider}`;
5317
5253
  }
5318
5254
 
@@ -5327,8 +5263,8 @@ const BooleanActiveFilterItem = (table, rule) => {
5327
5263
  var BooleanActiveFilterItem$1 = BooleanActiveFilterItem;
5328
5264
 
5329
5265
  // Free-text multi-value editor — lets the user type and tag arbitrary values.
5330
- // Used for 'inArray' on string and number columns, mirroring MUI's isAnyOf behaviour.
5331
- // The user presses Enter or comma to add each entry; the result is stored as an array.
5266
+ // Used for 'isAnyOf' on string and number columns.
5267
+ // Enter and blur both add the typed entry; the result is stored as an array.
5332
5268
  const MRT_FreeMultiValueEditor = t0 => {
5333
5269
  const $ = c(9);
5334
5270
  const {
@@ -5368,13 +5304,14 @@ const MRT_FreeMultiValueEditor = t0 => {
5368
5304
  let t4;
5369
5305
  if ($[6] !== displayValues || $[7] !== handleChange) {
5370
5306
  t4 = /*#__PURE__*/jsx(Autocomplete, {
5307
+ autoSelect: true,
5371
5308
  freeSolo: true,
5372
5309
  multiple: true,
5373
5310
  options: t3,
5374
5311
  value: displayValues,
5375
5312
  onChange: handleChange,
5376
5313
  size: "small",
5377
- renderTags: _temp$t,
5314
+ renderTags: _temp$u,
5378
5315
  renderInput: _temp2$a
5379
5316
  });
5380
5317
  $[6] = displayValues;
@@ -5385,7 +5322,7 @@ const MRT_FreeMultiValueEditor = t0 => {
5385
5322
  }
5386
5323
  return t4;
5387
5324
  };
5388
- function _temp$t(value, getTagProps) {
5325
+ function _temp$u(value, getTagProps) {
5389
5326
  return value.map((option, index) => {
5390
5327
  const {
5391
5328
  key,
@@ -5466,7 +5403,7 @@ const MRT_MultiValueEditor = t0 => {
5466
5403
  }
5467
5404
  let t5;
5468
5405
  if ($[8] !== options) {
5469
- t5 = options.map(_temp$s);
5406
+ t5 = options.map(_temp$t);
5470
5407
  $[8] = options;
5471
5408
  $[9] = t5;
5472
5409
  } else {
@@ -5496,7 +5433,7 @@ const MRT_MultiValueEditor = t0 => {
5496
5433
  }
5497
5434
  return t6;
5498
5435
  };
5499
- function _temp$s(option) {
5436
+ function _temp$t(option) {
5500
5437
  const {
5501
5438
  label,
5502
5439
  value
@@ -5863,7 +5800,7 @@ const MRT_SingleValueEditor = t0 => {
5863
5800
  const t6 = options?.length ? undefined : inputType;
5864
5801
  let t7;
5865
5802
  if ($[9] !== options) {
5866
- t7 = options?.map(_temp$r);
5803
+ t7 = options?.map(_temp$s);
5867
5804
  $[9] = options;
5868
5805
  $[10] = t7;
5869
5806
  } else {
@@ -5897,7 +5834,7 @@ const MRT_SingleValueEditor = t0 => {
5897
5834
  }
5898
5835
  return t8;
5899
5836
  };
5900
- function _temp$r(option) {
5837
+ function _temp$s(option) {
5901
5838
  const {
5902
5839
  label,
5903
5840
  value
@@ -6131,7 +6068,7 @@ const MRT_FilterRuleNumberEditor = props => {
6131
6068
  t0 = /*#__PURE__*/jsx(MRT_SingleValueEditor, {
6132
6069
  ...props,
6133
6070
  inputType: "number",
6134
- transformValue: _temp$q,
6071
+ transformValue: _temp$r,
6135
6072
  valueFormatter: _temp2$9
6136
6073
  });
6137
6074
  $[0] = props;
@@ -6181,8 +6118,8 @@ const MRT_FilterRuleBooleanEditor = props => {
6181
6118
  t3 = /*#__PURE__*/jsx(MRT_SingleValueEditor, {
6182
6119
  ...props,
6183
6120
  options: t2,
6184
- transformValue: _temp3$5,
6185
- valueFormatter: _temp4$2
6121
+ transformValue: _temp3$4,
6122
+ valueFormatter: _temp4$1
6186
6123
  });
6187
6124
  $[7] = props;
6188
6125
  $[8] = t2;
@@ -6374,16 +6311,16 @@ const MRT_FilterRuleMultiNumberEditor = props => {
6374
6311
  }
6375
6312
  return t0;
6376
6313
  };
6377
- function _temp$q(value) {
6314
+ function _temp$r(value) {
6378
6315
  return value === "" ? "" : Number(value);
6379
6316
  }
6380
6317
  function _temp2$9(value_0) {
6381
6318
  return value_0 === undefined || value_0 === null || value_0 === "" ? "" : String(value_0);
6382
6319
  }
6383
- function _temp3$5(value) {
6320
+ function _temp3$4(value) {
6384
6321
  return value === "true" ? true : value === "false" ? false : "";
6385
6322
  }
6386
- function _temp4$2(value_0) {
6323
+ function _temp4$1(value_0) {
6387
6324
  return value_0 === true ? "true" : value_0 === false ? "false" : "";
6388
6325
  }
6389
6326
  function _temp5$1(n) {
@@ -7211,7 +7148,7 @@ const MRT_FormEnumInput = t0 => {
7211
7148
  onChange: e => handleChange(e.target.value),
7212
7149
  renderValue: renderSelectedValue,
7213
7150
  value: currentValue,
7214
- children: enumOptions.map(_temp$p)
7151
+ children: enumOptions.map(_temp$q)
7215
7152
  }), (fieldState.error?.message || fieldConfig?.helperText) && /*#__PURE__*/jsx(FormHelperText, {
7216
7153
  children: fieldState.error?.message ?? fieldConfig?.helperText
7217
7154
  })]
@@ -7243,7 +7180,7 @@ const MRT_FormEnumInput = t0 => {
7243
7180
  }
7244
7181
  return t4;
7245
7182
  };
7246
- function _temp$p(option_0) {
7183
+ function _temp$q(option_0) {
7247
7184
  return /*#__PURE__*/jsx(MenuItem, {
7248
7185
  value: option_0.value,
7249
7186
  children: option_0.label
@@ -8374,7 +8311,8 @@ const NumberColumnResolver = {
8374
8311
  id: 'isAnyOf',
8375
8312
  isValueEmpty: value => !Array.isArray(value) || value.length === 0,
8376
8313
  label: 'Is Any Of',
8377
- triggerMode: 'commit',
8314
+ // The editor reports changes when a chip is added or removed.
8315
+ triggerMode: 'change',
8378
8316
  valueShape: 'multi'
8379
8317
  }],
8380
8318
  getFormFieldRenderer: (column, _table) => {
@@ -8558,7 +8496,8 @@ const StringColumnResolver = {
8558
8496
  id: 'isAnyOf',
8559
8497
  isValueEmpty: value => !Array.isArray(value) || value.length === 0,
8560
8498
  label: 'Is Any Of',
8561
- triggerMode: 'commit',
8499
+ // The editor reports changes when a chip is added or removed.
8500
+ triggerMode: 'change',
8562
8501
  valueShape: 'multi'
8563
8502
  }],
8564
8503
  getFormFieldRenderer: (column, _table) => {
@@ -9477,7 +9416,7 @@ const useMRT_AdvancedFiltersDraft = table => {
9477
9416
  if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
9478
9417
  t7 = () => {
9479
9418
  isDraftDirty.current = false;
9480
- setDraftFilters(_temp$o);
9419
+ setDraftFilters(_temp$p);
9481
9420
  };
9482
9421
  $[13] = t7;
9483
9422
  } else {
@@ -9665,7 +9604,7 @@ const useMRT_AdvancedFiltersDraft = table => {
9665
9604
  }
9666
9605
  return t17;
9667
9606
  };
9668
- function _temp$o(current_0) {
9607
+ function _temp$p(current_0) {
9669
9608
  return {
9670
9609
  ...getDefaultFiltersState(),
9671
9610
  pinnedFilters: current_0.pinnedFilters
@@ -9726,7 +9665,7 @@ const MRT_AdvancedFiltersContent = t0 => {
9726
9665
  if ($[2] !== clearRules || $[3] !== handleClose || $[4] !== setFilters) {
9727
9666
  t4 = () => {
9728
9667
  clearRules();
9729
- setFilters(_temp$n);
9668
+ setFilters(_temp$o);
9730
9669
  handleClose();
9731
9670
  };
9732
9671
  $[2] = clearRules;
@@ -9936,7 +9875,7 @@ const MRT_AdvancedFiltersContent = t0 => {
9936
9875
  display: "flex",
9937
9876
  justifyContent: "center",
9938
9877
  sx: {
9939
- border: _temp3$4,
9878
+ border: _temp3$3,
9940
9879
  borderRadius: 2,
9941
9880
  flex: 1,
9942
9881
  minHeight: 140,
@@ -10134,7 +10073,7 @@ const MRT_AdvancedFilters = t0 => {
10134
10073
  }
10135
10074
  return t1;
10136
10075
  };
10137
- function _temp$n(current) {
10076
+ function _temp$o(current) {
10138
10077
  return {
10139
10078
  ...getDefaultFiltersState(),
10140
10079
  pinnedFilters: current.pinnedFilters
@@ -10143,11 +10082,12 @@ function _temp$n(current) {
10143
10082
  function _temp2$8(theme) {
10144
10083
  return theme.zIndex.drawer + 1;
10145
10084
  }
10146
- function _temp3$4(theme_0) {
10085
+ function _temp3$3(theme_0) {
10147
10086
  return `1px dashed ${theme_0.palette.divider}`;
10148
10087
  }
10149
10088
 
10150
10089
  const MRT_Localization_HR = {
10090
+ retryLoading: 'Pokušaj ponovo',
10151
10091
  language: 'hr',
10152
10092
  actions: 'Radnje',
10153
10093
  and: 'i',
@@ -10346,7 +10286,7 @@ const MaterialReactServerTableError = t0 => {
10346
10286
  let t3;
10347
10287
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
10348
10288
  t3 = /*#__PURE__*/jsx(Box, {
10349
- sx: _temp$m,
10289
+ sx: _temp$n,
10350
10290
  children: /*#__PURE__*/jsx(ErrorOutlineRoundedIcon, {
10351
10291
  sx: {
10352
10292
  fontSize: "2.25rem"
@@ -10422,7 +10362,7 @@ const MaterialReactServerTableError = t0 => {
10422
10362
  }
10423
10363
  return t10;
10424
10364
  };
10425
- function _temp$m(theme) {
10365
+ function _temp$n(theme) {
10426
10366
  return {
10427
10367
  alignItems: "center",
10428
10368
  backgroundColor: theme.palette.error.main + "14",
@@ -10435,6 +10375,194 @@ function _temp$m(theme) {
10435
10375
  };
10436
10376
  }
10437
10377
 
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
+
10438
10566
  function RowActionsCell(t0) {
10439
10567
  const $ = c(6);
10440
10568
  const {
@@ -10620,7 +10748,7 @@ const MRT_ActiveFilters = t0 => {
10620
10748
  let t3;
10621
10749
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
10622
10750
  t3 = {
10623
- borderBottom: _temp$l
10751
+ borderBottom: _temp$m
10624
10752
  };
10625
10753
  $[4] = t3;
10626
10754
  } else {
@@ -10659,7 +10787,7 @@ const MRT_ActiveFilters = t0 => {
10659
10787
  }
10660
10788
  return t1;
10661
10789
  };
10662
- function _temp$l(theme) {
10790
+ function _temp$m(theme) {
10663
10791
  return `1px solid ${theme.palette.divider}`;
10664
10792
  }
10665
10793
 
@@ -10701,7 +10829,7 @@ const MRT_LinearProgressBar = t0 => {
10701
10829
  const {
10702
10830
  isSaving
10703
10831
  } = t2;
10704
- const showProgressBars = useSelector(table.store, _temp$k);
10832
+ const showProgressBars = useSelector(table.store, _temp$l);
10705
10833
  let t3;
10706
10834
  if ($[6] !== isTopToolbar || $[7] !== muiLinearProgressProps || $[8] !== table) {
10707
10835
  t3 = parseFromValuesOrFunc(muiLinearProgressProps, {
@@ -10785,7 +10913,7 @@ const MRT_LinearProgressBar = t0 => {
10785
10913
  }
10786
10914
  return t11;
10787
10915
  };
10788
- function _temp$k(state) {
10916
+ function _temp$l(state) {
10789
10917
  return state.showProgressBars;
10790
10918
  }
10791
10919
 
@@ -10838,7 +10966,7 @@ const MRT_SelectionCountBadge = t0 => {
10838
10966
  let t3;
10839
10967
  if ($[2] !== t2 || $[3] !== table.atoms.rowSelection) {
10840
10968
  t3 = /*#__PURE__*/jsx(Subscribe, {
10841
- selector: _temp$j,
10969
+ selector: _temp$k,
10842
10970
  source: table.atoms.rowSelection,
10843
10971
  children: t2
10844
10972
  });
@@ -10850,11 +10978,10 @@ const MRT_SelectionCountBadge = t0 => {
10850
10978
  }
10851
10979
  return t3;
10852
10980
  };
10853
- function _temp$j(rowSelection) {
10981
+ function _temp$k(rowSelection) {
10854
10982
  return Object.values(rowSelection).filter(Boolean).length;
10855
10983
  }
10856
10984
 
10857
- const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
10858
10985
  const isPaginationItemColor = color => color === 'primary' || color === 'secondary' || color === 'standard';
10859
10986
  const MRT_TablePagination = ({
10860
10987
  position = 'bottom',
@@ -11136,7 +11263,7 @@ const MRT_ToolbarDropZone = t0 => {
11136
11263
  showToolbarDropZone,
11137
11264
  draggingColumn,
11138
11265
  hoveredColumn
11139
- } = useSelector(table.store, _temp$i);
11266
+ } = useSelector(table.store, _temp$j);
11140
11267
  let t3;
11141
11268
  if ($[5] !== setHoveredColumn) {
11142
11269
  t3 = _event => {
@@ -11252,7 +11379,7 @@ const MRT_ToolbarDropZone = t0 => {
11252
11379
  }
11253
11380
  return t10;
11254
11381
  };
11255
- function _temp$i(state) {
11382
+ function _temp$j(state) {
11256
11383
  return {
11257
11384
  showToolbarDropZone: state.showToolbarDropZone,
11258
11385
  draggingColumn: state.draggingColumn,
@@ -11415,7 +11542,7 @@ const MRT_BottomToolbar = ({
11415
11542
 
11416
11543
  // Renders a single pinned quick filter: label strip with unpin button + the operator's editor.
11417
11544
  const MRT_QuickFilterItem = t0 => {
11418
- const $ = c(52);
11545
+ const $ = c(60);
11419
11546
  const {
11420
11547
  column,
11421
11548
  operator,
@@ -11539,111 +11666,140 @@ const MRT_QuickFilterItem = t0 => {
11539
11666
  }
11540
11667
  const handleUnpin = t9;
11541
11668
  const columnLabel = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
11542
- const T0 = Box;
11543
11669
  let t10;
11544
- let t11;
11545
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
11546
- t10 = () => setIsHovered(true);
11547
- t11 = () => setIsHovered(false);
11548
- $[19] = t10;
11549
- $[20] = t11;
11550
- } else {
11551
- t10 = $[19];
11552
- t11 = $[20];
11553
- }
11554
- let t12;
11555
- if ($[21] !== commitValue || $[22] !== isTriggerModeCommit || $[23] !== localValue) {
11556
- t12 = isTriggerModeCommit ? event => {
11557
- if (event.key === "Enter") {
11670
+ if ($[19] !== commitValue || $[20] !== localValue || $[21] !== operator || $[22] !== rule?.value) {
11671
+ t10 = () => {
11672
+ const committedValue_0 = rule?.value ?? operator.getInitialValue();
11673
+ if (!Object.is(localValue, committedValue_0)) {
11558
11674
  commitValue(localValue);
11559
11675
  }
11560
- } : undefined;
11561
- $[21] = commitValue;
11562
- $[22] = isTriggerModeCommit;
11563
- $[23] = localValue;
11564
- $[24] = t12;
11676
+ };
11677
+ $[19] = commitValue;
11678
+ $[20] = localValue;
11679
+ $[21] = operator;
11680
+ $[22] = rule?.value;
11681
+ $[23] = t10;
11565
11682
  } else {
11566
- t12 = $[24];
11683
+ t10 = $[23];
11567
11684
  }
11568
- let t13;
11569
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
11570
- t13 = {
11685
+ const commitLocalValue = t10;
11686
+ const T0 = Box;
11687
+ let t11;
11688
+ let t12;
11689
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
11690
+ t11 = () => setIsHovered(true);
11691
+ t12 = () => setIsHovered(false);
11692
+ $[24] = t11;
11693
+ $[25] = t12;
11694
+ } else {
11695
+ t11 = $[24];
11696
+ t12 = $[25];
11697
+ }
11698
+ let t13;
11699
+ if ($[26] !== commitLocalValue || $[27] !== isTriggerModeCommit) {
11700
+ t13 = isTriggerModeCommit ? event => {
11701
+ if (event.key === "Enter") {
11702
+ commitLocalValue();
11703
+ }
11704
+ } : undefined;
11705
+ $[26] = commitLocalValue;
11706
+ $[27] = isTriggerModeCommit;
11707
+ $[28] = t13;
11708
+ } else {
11709
+ t13 = $[28];
11710
+ }
11711
+ let t14;
11712
+ if ($[29] !== commitLocalValue || $[30] !== isTriggerModeCommit) {
11713
+ t14 = isTriggerModeCommit ? event_0 => {
11714
+ if (!event_0.currentTarget.contains(event_0.relatedTarget)) {
11715
+ commitLocalValue();
11716
+ }
11717
+ } : undefined;
11718
+ $[29] = commitLocalValue;
11719
+ $[30] = isTriggerModeCommit;
11720
+ $[31] = t14;
11721
+ } else {
11722
+ t14 = $[31];
11723
+ }
11724
+ let t15;
11725
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
11726
+ t15 = {
11571
11727
  display: "flex",
11572
11728
  flexDirection: "column",
11573
11729
  gap: 0.5,
11574
11730
  position: "relative"
11575
11731
  };
11576
- $[25] = t13;
11732
+ $[32] = t15;
11577
11733
  } else {
11578
- t13 = $[25];
11734
+ t15 = $[32];
11579
11735
  }
11580
- let t14;
11581
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
11582
- t14 = {
11736
+ let t16;
11737
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
11738
+ t16 = {
11583
11739
  alignItems: "center",
11584
11740
  display: "flex"
11585
11741
  };
11586
- $[26] = t14;
11742
+ $[33] = t16;
11587
11743
  } else {
11588
- t14 = $[26];
11744
+ t16 = $[33];
11589
11745
  }
11590
- let t15;
11591
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
11592
- t15 = {
11746
+ let t17;
11747
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
11748
+ t17 = {
11593
11749
  color: "text.secondary",
11594
11750
  fontSize: 11,
11595
11751
  fontWeight: 500,
11596
11752
  lineHeight: 1
11597
11753
  };
11598
- $[27] = t15;
11754
+ $[34] = t17;
11599
11755
  } else {
11600
- t15 = $[27];
11756
+ t17 = $[34];
11601
11757
  }
11602
- let t16;
11603
- if ($[28] !== columnLabel) {
11604
- t16 = /*#__PURE__*/jsx(Box, {
11758
+ let t18;
11759
+ if ($[35] !== columnLabel) {
11760
+ t18 = /*#__PURE__*/jsx(Box, {
11605
11761
  component: "span",
11606
- sx: t15,
11762
+ sx: t17,
11607
11763
  children: columnLabel
11608
11764
  });
11609
- $[28] = columnLabel;
11610
- $[29] = t16;
11765
+ $[35] = columnLabel;
11766
+ $[36] = t18;
11611
11767
  } else {
11612
- t16 = $[29];
11768
+ t18 = $[36];
11613
11769
  }
11614
- let t17;
11615
- if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
11616
- t17 = {
11770
+ let t19;
11771
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
11772
+ t19 = {
11617
11773
  color: "text.disabled",
11618
11774
  fontSize: 11,
11619
11775
  lineHeight: 1
11620
11776
  };
11621
- $[30] = t17;
11777
+ $[37] = t19;
11622
11778
  } else {
11623
- t17 = $[30];
11779
+ t19 = $[37];
11624
11780
  }
11625
- const t18 = `${operatorLabel.toLowerCase()}`;
11626
- let t19;
11627
- if ($[31] !== t18) {
11628
- t19 = /*#__PURE__*/jsxs(Box, {
11781
+ const t20 = `${operatorLabel.toLowerCase()}`;
11782
+ let t21;
11783
+ if ($[38] !== t20) {
11784
+ t21 = /*#__PURE__*/jsxs(Box, {
11629
11785
  component: "span",
11630
- sx: t17,
11631
- children: ["\xA0", t18]
11786
+ sx: t19,
11787
+ children: ["\xA0", t20]
11632
11788
  });
11633
- $[31] = t18;
11634
- $[32] = t19;
11789
+ $[38] = t20;
11790
+ $[39] = t21;
11635
11791
  } else {
11636
- t19 = $[32];
11792
+ t21 = $[39];
11637
11793
  }
11638
- let t20;
11639
- if ($[33] !== CloseIcon || $[34] !== handleUnpin || $[35] !== isHovered) {
11640
- t20 = isHovered && /*#__PURE__*/jsx(Tooltip, {
11794
+ let t22;
11795
+ if ($[40] !== CloseIcon || $[41] !== handleUnpin || $[42] !== isHovered) {
11796
+ t22 = isHovered && /*#__PURE__*/jsx(Tooltip, {
11641
11797
  title: "Unpin filter",
11642
11798
  children: /*#__PURE__*/jsx(IconButton, {
11643
11799
  onClick: handleUnpin,
11644
11800
  size: "small",
11645
11801
  sx: {
11646
- backgroundColor: _temp$h,
11802
+ backgroundColor: _temp$i,
11647
11803
  color: _temp2$6,
11648
11804
  width: 18,
11649
11805
  height: 18,
@@ -11652,7 +11808,7 @@ const MRT_QuickFilterItem = t0 => {
11652
11808
  top: 8,
11653
11809
  zIndex: 1,
11654
11810
  "&:hover": {
11655
- backgroundColor: _temp3$3
11811
+ backgroundColor: _temp3$2
11656
11812
  }
11657
11813
  },
11658
11814
  children: /*#__PURE__*/jsx(CloseIcon, {
@@ -11662,66 +11818,68 @@ const MRT_QuickFilterItem = t0 => {
11662
11818
  })
11663
11819
  })
11664
11820
  });
11665
- $[33] = CloseIcon;
11666
- $[34] = handleUnpin;
11667
- $[35] = isHovered;
11668
- $[36] = t20;
11821
+ $[40] = CloseIcon;
11822
+ $[41] = handleUnpin;
11823
+ $[42] = isHovered;
11824
+ $[43] = t22;
11669
11825
  } else {
11670
- t20 = $[36];
11826
+ t22 = $[43];
11671
11827
  }
11672
- let t21;
11673
- if ($[37] !== t16 || $[38] !== t19 || $[39] !== t20) {
11674
- t21 = /*#__PURE__*/jsxs(Box, {
11828
+ let t23;
11829
+ if ($[44] !== t18 || $[45] !== t21 || $[46] !== t22) {
11830
+ t23 = /*#__PURE__*/jsxs(Box, {
11675
11831
  "data-testid": "quick-filter",
11676
- sx: t14,
11677
- children: [t16, t19, t20]
11832
+ sx: t16,
11833
+ children: [t18, t21, t22]
11678
11834
  });
11679
- $[37] = t16;
11680
- $[38] = t19;
11681
- $[39] = t20;
11682
- $[40] = t21;
11835
+ $[44] = t18;
11836
+ $[45] = t21;
11837
+ $[46] = t22;
11838
+ $[47] = t23;
11683
11839
  } else {
11684
- t21 = $[40];
11840
+ t23 = $[47];
11685
11841
  }
11686
11842
  const T1 = Box;
11687
- const t22 = operator.editComponent({
11843
+ const t24 = operator.editComponent({
11688
11844
  column: column,
11689
11845
  onChange: handleEditorChange,
11690
11846
  rule: editorRule,
11691
11847
  table
11692
11848
  });
11693
- let t23;
11694
- if ($[41] !== T1 || $[42] !== t22) {
11695
- t23 = /*#__PURE__*/jsx(T1, {
11696
- children: t22
11849
+ let t25;
11850
+ if ($[48] !== T1 || $[49] !== t24) {
11851
+ t25 = /*#__PURE__*/jsx(T1, {
11852
+ children: t24
11697
11853
  });
11698
- $[41] = T1;
11699
- $[42] = t22;
11700
- $[43] = t23;
11854
+ $[48] = T1;
11855
+ $[49] = t24;
11856
+ $[50] = t25;
11701
11857
  } else {
11702
- t23 = $[43];
11858
+ t25 = $[50];
11703
11859
  }
11704
- let t24;
11705
- if ($[44] !== T0 || $[45] !== t10 || $[46] !== t11 || $[47] !== t12 || $[48] !== t13 || $[49] !== t21 || $[50] !== t23) {
11706
- t24 = /*#__PURE__*/jsxs(T0, {
11707
- onMouseEnter: t10,
11708
- onMouseLeave: t11,
11709
- onKeyDown: t12,
11710
- sx: t13,
11711
- children: [t21, t23]
11712
- });
11713
- $[44] = T0;
11714
- $[45] = t10;
11715
- $[46] = t11;
11716
- $[47] = t12;
11717
- $[48] = t13;
11718
- $[49] = t21;
11719
- $[50] = t23;
11720
- $[51] = t24;
11860
+ let t26;
11861
+ if ($[51] !== T0 || $[52] !== t11 || $[53] !== t12 || $[54] !== t13 || $[55] !== t14 || $[56] !== t15 || $[57] !== t23 || $[58] !== t25) {
11862
+ t26 = /*#__PURE__*/jsxs(T0, {
11863
+ onMouseEnter: t11,
11864
+ onMouseLeave: t12,
11865
+ onKeyDown: t13,
11866
+ onBlur: t14,
11867
+ sx: t15,
11868
+ children: [t23, t25]
11869
+ });
11870
+ $[51] = T0;
11871
+ $[52] = t11;
11872
+ $[53] = t12;
11873
+ $[54] = t13;
11874
+ $[55] = t14;
11875
+ $[56] = t15;
11876
+ $[57] = t23;
11877
+ $[58] = t25;
11878
+ $[59] = t26;
11721
11879
  } else {
11722
- t24 = $[51];
11880
+ t26 = $[59];
11723
11881
  }
11724
- return t24;
11882
+ return t26;
11725
11883
  };
11726
11884
  // Renders a strip of pinned quick filter inputs directly above the table body.
11727
11885
  // Visible only when at least one filter rule is pinned.
@@ -11791,13 +11949,13 @@ const MRT_QuickFiltersBar = t0 => {
11791
11949
  }
11792
11950
  return t1;
11793
11951
  };
11794
- function _temp$h(theme) {
11952
+ function _temp$i(theme) {
11795
11953
  return theme.palette.error.main;
11796
11954
  }
11797
11955
  function _temp2$6(theme_0) {
11798
11956
  return theme_0.palette.background.paper;
11799
11957
  }
11800
- function _temp3$3(theme_1) {
11958
+ function _temp3$2(theme_1) {
11801
11959
  return theme_1.palette.error.dark;
11802
11960
  }
11803
11961
 
@@ -11987,7 +12145,7 @@ function MRT_TableOptionsMenu(t0) {
11987
12145
  anchorEl: anchorEl,
11988
12146
  anchorOrigin: t3,
11989
12147
  disableScrollLock: true,
11990
- onClick: _temp$g,
12148
+ onClick: _temp$h,
11991
12149
  onClose: onClose,
11992
12150
  open: open,
11993
12151
  transformOrigin: t4,
@@ -12005,7 +12163,7 @@ function MRT_TableOptionsMenu(t0) {
12005
12163
  }
12006
12164
  return t8;
12007
12165
  }
12008
- function _temp$g(event) {
12166
+ function _temp$h(event) {
12009
12167
  return event.stopPropagation();
12010
12168
  }
12011
12169
 
@@ -12396,7 +12554,7 @@ const MRT_NewEntryButton = t0 => {
12396
12554
  };
12397
12555
 
12398
12556
  const MRT_ShowHideColumnsMenuItems = t0 => {
12399
- const $ = c(42);
12557
+ const $ = c(47);
12400
12558
  let allColumns;
12401
12559
  let column;
12402
12560
  let hoveredColumn;
@@ -12469,8 +12627,24 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12469
12627
  return null;
12470
12628
  }
12471
12629
  let t4;
12472
- if ($[10] !== column.depth || $[11] !== column.id || $[12] !== draggingBorderColor || $[13] !== hoveredColumn?.id || $[14] !== rest?.sx) {
12473
- t4 = theme => ({
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 => ({
12474
12648
  alignItems: "center",
12475
12649
  justifyContent: "flex-start",
12476
12650
  my: 0,
@@ -12480,30 +12654,31 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12480
12654
  py: "6px",
12481
12655
  ...parseFromValuesOrFunc(rest?.sx, theme)
12482
12656
  });
12483
- $[10] = column.depth;
12484
- $[11] = column.id;
12485
- $[12] = draggingBorderColor;
12486
- $[13] = hoveredColumn?.id;
12487
- $[14] = rest?.sx;
12488
- $[15] = t4;
12657
+ $[15] = column.depth;
12658
+ $[16] = column.id;
12659
+ $[17] = draggingBorderColor;
12660
+ $[18] = hoveredColumn?.id;
12661
+ $[19] = rest?.sx;
12662
+ $[20] = t5;
12489
12663
  } else {
12490
- t4 = $[15];
12664
+ t5 = $[20];
12491
12665
  }
12492
- const t5 = `column-show-hide-row-${column.id}`;
12493
- let t6;
12494
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
12495
- t6 = {
12666
+ const t6 = `column-show-hide-row-${column.id}`;
12667
+ let t7;
12668
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
12669
+ t7 = {
12496
12670
  display: "flex",
12497
12671
  flexWrap: "nowrap",
12498
- gap: "8px"
12672
+ gap: "8px",
12673
+ width: "100%"
12499
12674
  };
12500
- $[16] = t6;
12675
+ $[21] = t7;
12501
12676
  } else {
12502
- t6 = $[16];
12677
+ t7 = $[21];
12503
12678
  }
12504
- let t7;
12505
- if ($[17] !== column || $[18] !== columnDef.header || $[19] !== columnDefType || $[20] !== enableHiding || $[21] !== handleToggleColumnHidden || $[22] !== localization || $[23] !== table.atoms) {
12506
- t7 = enableHiding ? /*#__PURE__*/jsx(Subscribe, {
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, {
12507
12682
  source: table.atoms.columnVisibility,
12508
12683
  children: () => {
12509
12684
  const switchChecked = column.getIsVisible();
@@ -12526,7 +12701,7 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12526
12701
  }),
12527
12702
  disabled: !column.getCanHide(),
12528
12703
  label: columnDef.header,
12529
- onChange: () => handleToggleColumnHidden(column, switchChecked)
12704
+ onChange: _temp$g
12530
12705
  });
12531
12706
  }
12532
12707
  }) : /*#__PURE__*/jsx(Typography, {
@@ -12535,48 +12710,49 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12535
12710
  },
12536
12711
  children: columnDef.header
12537
12712
  });
12538
- $[17] = column;
12539
- $[18] = columnDef.header;
12540
- $[19] = columnDefType;
12541
- $[20] = enableHiding;
12542
- $[21] = handleToggleColumnHidden;
12543
- $[22] = localization;
12544
- $[23] = table.atoms;
12545
- $[24] = t7;
12546
- } else {
12547
- t7 = $[24];
12548
- }
12549
- let t8;
12550
- if ($[25] !== t5 || $[26] !== t7) {
12551
- t8 = /*#__PURE__*/jsx(Box, {
12552
- "data-testid": t5,
12553
- sx: t6,
12554
- children: t7
12555
- });
12556
- $[25] = t5;
12557
- $[26] = t7;
12558
- $[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;
12559
12720
  } else {
12560
- t8 = $[27];
12721
+ t8 = $[28];
12561
12722
  }
12562
12723
  let t9;
12563
- if ($[28] !== rest || $[29] !== t4 || $[30] !== t8) {
12564
- t9 = /*#__PURE__*/jsx(MenuItem, {
12565
- disableRipple: true,
12566
- ...rest,
12567
- sx: t4,
12724
+ if ($[29] !== t6 || $[30] !== t8) {
12725
+ t9 = /*#__PURE__*/jsx(Box, {
12726
+ "data-testid": t6,
12727
+ sx: t7,
12568
12728
  children: t8
12569
12729
  });
12570
- $[28] = rest;
12571
- $[29] = t4;
12730
+ $[29] = t6;
12572
12731
  $[30] = t8;
12573
12732
  $[31] = t9;
12574
12733
  } else {
12575
12734
  t9 = $[31];
12576
12735
  }
12577
12736
  let t10;
12578
- if ($[32] !== allColumns || $[33] !== column.columns || $[34] !== hoveredColumn || $[35] !== isNestedColumns || $[36] !== setHoveredColumn || $[37] !== table) {
12579
- t10 = column.columns?.map((c, i) => /*#__PURE__*/jsx(MRT_ShowHideColumnsMenuItems, {
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, {
12580
12756
  allColumns: allColumns,
12581
12757
  column: c,
12582
12758
  hoveredColumn: hoveredColumn,
@@ -12584,30 +12760,41 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12584
12760
  setHoveredColumn: setHoveredColumn,
12585
12761
  table: table
12586
12762
  }, `${i}-${c.id}`));
12587
- $[32] = allColumns;
12588
- $[33] = column.columns;
12589
- $[34] = hoveredColumn;
12590
- $[35] = isNestedColumns;
12591
- $[36] = setHoveredColumn;
12592
- $[37] = table;
12593
- $[38] = t10;
12763
+ $[37] = allColumns;
12764
+ $[38] = column.columns;
12765
+ $[39] = hoveredColumn;
12766
+ $[40] = isNestedColumns;
12767
+ $[41] = setHoveredColumn;
12768
+ $[42] = table;
12769
+ $[43] = t11;
12594
12770
  } else {
12595
- t10 = $[38];
12771
+ t11 = $[43];
12596
12772
  }
12597
- let t11;
12598
- if ($[39] !== t10 || $[40] !== t9) {
12599
- t11 = /*#__PURE__*/jsxs(Fragment, {
12600
- children: [t9, t10]
12773
+ let t12;
12774
+ if ($[44] !== t10 || $[45] !== t11) {
12775
+ t12 = /*#__PURE__*/jsxs(Fragment, {
12776
+ children: [t10, t11]
12601
12777
  });
12602
- $[39] = t10;
12603
- $[40] = t9;
12604
- $[41] = t11;
12778
+ $[44] = t10;
12779
+ $[45] = t11;
12780
+ $[46] = t12;
12605
12781
  } else {
12606
- t11 = $[41];
12782
+ t12 = $[46];
12607
12783
  }
12608
- return t11;
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));
12609
12797
  };
12610
-
12611
12798
  const MRT_ShowHideColumnsMenu = ({
12612
12799
  anchorEl,
12613
12800
  setAnchorEl,
@@ -12625,6 +12812,10 @@ const MRT_ShowHideColumnsMenu = ({
12625
12812
  getState,
12626
12813
  options: {
12627
12814
  enableHiding,
12815
+ icons: {
12816
+ CloseIcon,
12817
+ SearchIcon
12818
+ },
12628
12819
  localization,
12629
12820
  mrtTheme: {
12630
12821
  menuBackgroundColor
@@ -12636,6 +12827,7 @@ const MRT_ShowHideColumnsMenu = ({
12636
12827
  columnPinning
12637
12828
  } = getState();
12638
12829
  const density = useSelector(table.store, state => state.density);
12830
+ const [searchText, setSearchText] = useState('');
12639
12831
  const handleToggleAllColumns = value => {
12640
12832
  const updates = getAllLeafColumns().filter(column => column.columnDef.enableHiding !== false).reduce((acc, column_0) => {
12641
12833
  acc[column_0.id] = value ?? !column_0.getIsVisible();
@@ -12655,19 +12847,87 @@ const MRT_ShowHideColumnsMenu = ({
12655
12847
  }, [columnOrder, columnPinning, getAllColumns(), getCenterLeafColumns(), getStartLeafColumns(), getEndLeafColumns()]);
12656
12848
  const isNestedColumns = allColumns.some(col_1 => col_1.columnDef.columnDefType === 'group');
12657
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
+ };
12658
12858
  return /*#__PURE__*/jsxs(Menu, {
12659
12859
  MenuListProps: {
12660
12860
  dense: density === 'compact',
12661
12861
  sx: {
12662
12862
  backgroundColor: menuBackgroundColor
12663
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'
12664
12877
  },
12665
12878
  anchorEl: anchorEl,
12879
+ autoFocus: false,
12666
12880
  disableScrollLock: true,
12667
- onClose: () => setAnchorEl(null),
12881
+ onClose: () => {
12882
+ setAnchorEl(null);
12883
+ setSearchText('');
12884
+ },
12668
12885
  open: !!anchorEl,
12669
12886
  ...rest,
12670
- children: [/*#__PURE__*/jsxs(Box, {
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, {
12671
12931
  sx: {
12672
12932
  display: 'flex',
12673
12933
  justifyContent: 'space-between',
@@ -12689,14 +12949,21 @@ const MRT_ShowHideColumnsMenu = ({
12689
12949
  children: localization.showAll
12690
12950
  })
12691
12951
  })]
12692
- }), /*#__PURE__*/jsx(Divider, {}), allColumns.map((column_1, index) => /*#__PURE__*/jsx(MRT_ShowHideColumnsMenuItems, {
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, {
12693
12960
  allColumns: allColumns,
12694
- column: column_1,
12961
+ column: column_2,
12695
12962
  hoveredColumn: hoveredColumn,
12696
12963
  isNestedColumns: isNestedColumns,
12697
12964
  setHoveredColumn: setHoveredColumn,
12698
12965
  table: table
12699
- }, `${index}-${column_1.id}`))]
12966
+ }, `${index}-${column_2.id}`))]
12700
12967
  });
12701
12968
  };
12702
12969
 
@@ -13517,6 +13784,123 @@ const MRT_TopToolbar = ({
13517
13784
  });
13518
13785
  };
13519
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
+
13520
13904
  /**
13521
13905
  * Headless (renders nothing) — owns its own reactive subscription so this
13522
13906
  * correction runs independently of whatever the root `useTable()` selector
@@ -13973,6 +14357,9 @@ const MRT_TableBodyCell = ({
13973
14357
  hoveredRow
13974
14358
  } = useSelector(table.store, state => ({
13975
14359
  actionCell: state.actionCell,
14360
+ // Pinned-group edges can change without this cell's identity changing.
14361
+ columnPinning: state.columnPinning,
14362
+ columnVisibility: state.columnVisibility,
13976
14363
  columnResizing: state.columnResizing,
13977
14364
  density: state.density,
13978
14365
  draggingColumn: state.draggingColumn,
@@ -14067,6 +14454,7 @@ const MRT_TableBodyCell = ({
14067
14454
  };
14068
14455
  return /*#__PURE__*/jsx(TableCell, {
14069
14456
  align: theme.direction === 'rtl' ? 'right' : 'left',
14457
+ "data-column-id": column.id,
14070
14458
  "data-index": staticColumnIndex,
14071
14459
  "data-pinned": !!isColumnPinned || undefined,
14072
14460
  "data-testid": `body-cell-${cell.id}`,
@@ -14445,7 +14833,7 @@ const MRT_TableBodyRow = ({
14445
14833
  const tableHeadHeight = enableStickyHeader && tableHeadRef.current?.clientHeight || 0;
14446
14834
  const tableFooterHeight = enableStickyFooter && tableFooterRef.current?.clientHeight || 0;
14447
14835
  const sx = parseFromValuesOrFunc(tableRowProps?.sx, theme);
14448
- const defaultRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
14836
+ const defaultRowHeight = getDefaultRowHeight(density);
14449
14837
  const customRowHeight =
14450
14838
  // @ts-expect-error
14451
14839
  parseInt(tableRowProps?.style?.height ?? sx?.height, 10) || undefined;
@@ -15167,6 +15555,139 @@ const MRT_TableFooter = ({
15167
15555
  });
15168
15556
  };
15169
15557
 
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
+
15170
15691
  const MRT_ActionMenuItem = t0 => {
15171
15692
  const $ = c(20);
15172
15693
  let icon;
@@ -15285,7 +15806,7 @@ const MRT_ActionMenuItem = t0 => {
15285
15806
  };
15286
15807
 
15287
15808
  const MRT_ColumnActionMenu = t0 => {
15288
- const $ = c(73);
15809
+ const $ = c(81);
15289
15810
  let anchorEl;
15290
15811
  let header;
15291
15812
  let rest;
@@ -15321,6 +15842,8 @@ const MRT_ColumnActionMenu = t0 => {
15321
15842
  const {
15322
15843
  enableColumnPinning,
15323
15844
  enableColumnResizing,
15845
+ enableMultiRowSelection,
15846
+ enableSelectAll,
15324
15847
  enableGrouping,
15325
15848
  enableHiding,
15326
15849
  enableSorting,
@@ -15395,7 +15918,7 @@ const MRT_ColumnActionMenu = t0 => {
15395
15918
  let t7;
15396
15919
  if ($[15] !== column || $[16] !== setAnchorEl || $[17] !== setColumnResizing) {
15397
15920
  t7 = () => {
15398
- setColumnResizing(_temp3$2);
15921
+ setColumnResizing(_temp3$1);
15399
15922
  column.resetSize();
15400
15923
  setAnchorEl(null);
15401
15924
  };
@@ -15437,7 +15960,7 @@ const MRT_ColumnActionMenu = t0 => {
15437
15960
  if ($[25] !== column || $[26] !== setAnchorEl || $[27] !== setColumnOrder) {
15438
15961
  t10 = () => {
15439
15962
  column.toggleGrouping();
15440
- setColumnOrder(_temp4$1);
15963
+ setColumnOrder(_temp4);
15441
15964
  setAnchorEl(null);
15442
15965
  };
15443
15966
  $[25] = column;
@@ -15462,7 +15985,7 @@ const MRT_ColumnActionMenu = t0 => {
15462
15985
  }
15463
15986
  const handleShowAllColumns = t11;
15464
15987
  let t12;
15465
- 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] !== enableSorting || $[50] !== enableSortingRemoval || $[51] !== handleClearSort || $[52] !== handleGroupByColumn || $[53] !== handleHideColumn || $[54] !== handlePinColumn || $[55] !== handleResetColumnSize || $[56] !== handleShowAllColumns || $[57] !== handleSortAsc || $[58] !== handleSortDesc || $[59] !== localization || $[60] !== menuBackgroundColor || $[61] !== renderColumnActionsMenuItems || $[62] !== rest || $[63] !== setAnchorEl || $[64] !== table) {
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) {
15466
15989
  const internalColumnMenuItems = [...(enableSorting && column.getCanSort() ? [enableSortingRemoval !== false && /*#__PURE__*/jsx(MRT_ActionMenuItem, {
15467
15990
  disabled: column.getIsSorted() === false,
15468
15991
  icon: /*#__PURE__*/jsx(ClearAllIcon, {}),
@@ -15540,43 +16063,58 @@ const MRT_ColumnActionMenu = t0 => {
15540
16063
  }, 12)] : [])].filter(Boolean);
15541
16064
  const t13 = density === "compact";
15542
16065
  let t14;
15543
- if ($[66] !== menuBackgroundColor) {
16066
+ if ($[68] !== menuBackgroundColor) {
15544
16067
  t14 = {
15545
16068
  backgroundColor: menuBackgroundColor
15546
16069
  };
15547
- $[66] = menuBackgroundColor;
15548
- $[67] = t14;
16070
+ $[68] = menuBackgroundColor;
16071
+ $[69] = t14;
15549
16072
  } else {
15550
- t14 = $[67];
16073
+ t14 = $[69];
15551
16074
  }
15552
16075
  let t15;
15553
- if ($[68] !== t13 || $[69] !== t14) {
16076
+ if ($[70] !== t13 || $[71] !== t14) {
15554
16077
  t15 = {
15555
16078
  dense: t13,
15556
16079
  sx: t14
15557
16080
  };
15558
- $[68] = t13;
15559
- $[69] = t14;
15560
- $[70] = t15;
16081
+ $[70] = t13;
16082
+ $[71] = t14;
16083
+ $[72] = t15;
15561
16084
  } else {
15562
- t15 = $[70];
16085
+ t15 = $[72];
15563
16086
  }
15564
16087
  let t16;
15565
- if ($[71] !== setAnchorEl) {
16088
+ if ($[73] !== setAnchorEl) {
15566
16089
  t16 = () => setAnchorEl(null);
15567
- $[71] = setAnchorEl;
15568
- $[72] = t16;
16090
+ $[73] = setAnchorEl;
16091
+ $[74] = t16;
16092
+ } else {
16093
+ t16 = $[74];
16094
+ }
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;
15569
16107
  } else {
15570
- t16 = $[72];
16108
+ t17 = $[80];
15571
16109
  }
15572
- t12 = /*#__PURE__*/jsx(Menu, {
16110
+ t12 = /*#__PURE__*/jsxs(Menu, {
15573
16111
  MenuListProps: t15,
15574
16112
  anchorEl: anchorEl,
15575
16113
  disableScrollLock: true,
15576
16114
  onClose: t16,
15577
16115
  open: !!anchorEl,
15578
16116
  ...rest,
15579
- children: columnDef.renderColumnActionsMenuItems?.({
16117
+ children: [t17, column.id === CHECKBOX_DISPLAY_COLUMN_ID && enableSelectAll && enableMultiRowSelection && internalColumnMenuItems.length > 0 && /*#__PURE__*/jsx(Divider, {}), columnDef.renderColumnActionsMenuItems?.({
15580
16118
  closeMenu: () => setAnchorEl(null),
15581
16119
  column,
15582
16120
  internalColumnMenuItems,
@@ -15586,7 +16124,7 @@ const MRT_ColumnActionMenu = t0 => {
15586
16124
  column,
15587
16125
  internalColumnMenuItems,
15588
16126
  table
15589
- }) ?? internalColumnMenuItems
16127
+ }) ?? internalColumnMenuItems]
15590
16128
  });
15591
16129
  $[32] = ClearAllIcon;
15592
16130
  $[33] = DynamicFeedIcon;
@@ -15605,25 +16143,27 @@ const MRT_ColumnActionMenu = t0 => {
15605
16143
  $[46] = enableColumnResizing;
15606
16144
  $[47] = enableGrouping;
15607
16145
  $[48] = enableHiding;
15608
- $[49] = enableSorting;
15609
- $[50] = enableSortingRemoval;
15610
- $[51] = handleClearSort;
15611
- $[52] = handleGroupByColumn;
15612
- $[53] = handleHideColumn;
15613
- $[54] = handlePinColumn;
15614
- $[55] = handleResetColumnSize;
15615
- $[56] = handleShowAllColumns;
15616
- $[57] = handleSortAsc;
15617
- $[58] = handleSortDesc;
15618
- $[59] = localization;
15619
- $[60] = menuBackgroundColor;
15620
- $[61] = renderColumnActionsMenuItems;
15621
- $[62] = rest;
15622
- $[63] = setAnchorEl;
15623
- $[64] = table;
15624
- $[65] = t12;
15625
- } else {
15626
- t12 = $[65];
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];
15627
16167
  }
15628
16168
  return t12;
15629
16169
  };
@@ -15638,13 +16178,13 @@ function _temp$8(state) {
15638
16178
  function _temp2$5(state_0) {
15639
16179
  return state_0.density;
15640
16180
  }
15641
- function _temp3$2(old) {
16181
+ function _temp3$1(old) {
15642
16182
  return {
15643
16183
  ...old,
15644
16184
  isResizingColumn: false
15645
16185
  };
15646
16186
  }
15647
- function _temp4$1(old_0) {
16187
+ function _temp4(old_0) {
15648
16188
  return ["mrt-row-expand", ...old_0];
15649
16189
  }
15650
16190
  function _temp5(col) {
@@ -16153,6 +16693,7 @@ const MRT_TableHeadCellResizeHandle = ({
16153
16693
  columnResizeDirection
16154
16694
  },
16155
16695
  refs: {
16696
+ autoSizedColumnWidthsRef,
16156
16697
  isResizingRef,
16157
16698
  resizeIndicatorRef,
16158
16699
  tableContainerRef,
@@ -16166,7 +16707,7 @@ const MRT_TableHeadCellResizeHandle = ({
16166
16707
  const {
16167
16708
  column
16168
16709
  } = header;
16169
- const mx = density === 'compact' ? '-8px' : density === 'comfortable' ? '-16px' : '-24px';
16710
+ const mx = density === 'compact' ? '-2px' : density === 'comfortable' ? '-16px' : '-24px';
16170
16711
  const lr = column.columnDef.columnDefType === 'display' ? '4px' : '0';
16171
16712
 
16172
16713
  // Drives the resize purely through refs/DOM writes (CSS vars + the indicator line) so
@@ -16175,12 +16716,26 @@ const MRT_TableHeadCellResizeHandle = ({
16175
16716
  const tableEl = tableRef.current;
16176
16717
  const containerEl = tableContainerRef.current;
16177
16718
  const indicatorEl = resizeIndicatorRef.current;
16178
- 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}`);
16179
16725
  const dir = columnResizeDirection === 'rtl' ? -1 : 1;
16180
- const minSize = column.columnDef.minSize ?? 40;
16181
- const maxSize = column.columnDef.maxSize ?? 1000;
16726
+ const {
16727
+ minSize,
16728
+ maxSize
16729
+ } = getColumnSizeBounds(column.columnDef);
16182
16730
  let size = startSize;
16183
- let latestClientX = startX;
16731
+ // The "effective" cursor position used to compute size. Normally this just
16732
+ // mirrors the real cursor 1:1, but while pinned at the window edge (see
16733
+ // below) it keeps advancing past the real position — and because every
16734
+ // update here is an incremental `+=` off whatever it already was, moving
16735
+ // the real cursor back inward afterwards shrinks it smoothly from wherever
16736
+ // it ended up, instead of snapping back to a value derived from the
16737
+ // original startX.
16738
+ let virtualX = startX;
16184
16739
  let rafId = null;
16185
16740
 
16186
16741
  // Read the header cell's own rendered edge (rather than deriving a position from
@@ -16214,31 +16769,63 @@ const MRT_TableHeadCellResizeHandle = ({
16214
16769
  // batching keeps the handler from falling behind the pointer.
16215
16770
  const applyMove = () => {
16216
16771
  rafId = null;
16217
- size = Math.min(Math.max(startSize + dir * (latestClientX - startX), minSize), maxSize);
16772
+ size = Math.min(Math.max(startSize + dir * (virtualX - startX), minSize), maxSize);
16218
16773
  if (tableEl) {
16219
16774
  tableEl.style.setProperty(`--header-${parseCSSVarId(header.id)}-size`, `${size}`);
16220
16775
  tableEl.style.setProperty(`--col-${parseCSSVarId(column.id)}-size`, `${size}`);
16221
16776
  }
16222
16777
  updateIndicator();
16223
16778
  };
16224
- const scheduleMove = clientX => {
16225
- latestClientX = clientX;
16779
+ const scheduleMove = () => {
16226
16780
  if (rafId == null) {
16227
16781
  rafId = requestAnimationFrame(applyMove);
16228
16782
  }
16229
16783
  };
16230
- const handleMouseMove = e => scheduleMove(e.clientX);
16784
+
16785
+ // The OS clamps the real cursor position at the browser window's edge, so once
16786
+ // it gets there (common when growing the last/rightmost column) no further
16787
+ // mousemove events fire even though the user is still pushing the mouse against
16788
+ // the edge wanting to keep resizing. While pinned, a small rAF loop keeps
16789
+ // advancing virtualX past the real edge at a steady rate, so the resize keeps
16790
+ // going until the drag ends or the cursor is pulled back inward.
16791
+ const EDGE_THRESHOLD = 24;
16792
+ const EDGE_STEP = 12;
16793
+ let lastRealClientX = startX;
16794
+ let edgeRafId = null;
16795
+ const isNearWindowEdge = x_0 => x_0 <= EDGE_THRESHOLD || x_0 >= window.innerWidth - EDGE_THRESHOLD;
16796
+ const stepEdgeDrift = () => {
16797
+ edgeRafId = null;
16798
+ if (!isNearWindowEdge(lastRealClientX)) return;
16799
+ virtualX += lastRealClientX <= EDGE_THRESHOLD ? -EDGE_STEP : EDGE_STEP;
16800
+ scheduleMove();
16801
+ edgeRafId = requestAnimationFrame(stepEdgeDrift);
16802
+ };
16803
+ const trackPointer = clientX => {
16804
+ // Always an incremental delta off the real cursor's last known position —
16805
+ // never a jump to an absolute value — so this composes cleanly with
16806
+ // whatever virtualX already drifted to while pinned at the edge.
16807
+ virtualX += clientX - lastRealClientX;
16808
+ lastRealClientX = clientX;
16809
+ scheduleMove();
16810
+ if (isNearWindowEdge(clientX) && edgeRafId == null) {
16811
+ edgeRafId = requestAnimationFrame(stepEdgeDrift);
16812
+ }
16813
+ };
16814
+ const handleMouseMove = e => trackPointer(e.clientX);
16231
16815
  const handleTouchMove = e_0 => {
16232
16816
  const touchX = e_0.touches[0]?.clientX;
16233
16817
  if (touchX == null) return;
16234
16818
  e_0.preventDefault();
16235
- scheduleMove(touchX);
16819
+ trackPointer(touchX);
16236
16820
  };
16237
16821
  const handleEnd = () => {
16238
16822
  document.removeEventListener('mousemove', handleMouseMove);
16239
16823
  document.removeEventListener('mouseup', handleEnd);
16240
16824
  document.removeEventListener('touchmove', handleTouchMove);
16241
16825
  document.removeEventListener('touchend', handleEnd);
16826
+ if (edgeRafId != null) {
16827
+ cancelAnimationFrame(edgeRafId);
16828
+ }
16242
16829
  // Flush a still-pending frame synchronously so the committed size reflects the
16243
16830
  // true last pointer position instead of lagging up to one frame behind it.
16244
16831
  if (rafId != null) {
@@ -16250,6 +16837,7 @@ const MRT_TableHeadCellResizeHandle = ({
16250
16837
  document.body.style.cursor = '';
16251
16838
  document.body.style.userSelect = '';
16252
16839
  if (indicatorEl) indicatorEl.style.display = 'none';
16840
+ delete autoSizedColumnWidthsRef.current[column.id];
16253
16841
  setColumnSizing(old => ({
16254
16842
  ...old,
16255
16843
  [column.id]: size
@@ -16261,7 +16849,7 @@ const MRT_TableHeadCellResizeHandle = ({
16261
16849
  passive: false
16262
16850
  });
16263
16851
  document.addEventListener('touchend', handleEnd);
16264
- }, [column, columnResizeDirection, header.id, isResizingRef, resizeIndicatorRef, setColumnSizing, tableContainerRef, tableHeadCellRefs, tableRef]);
16852
+ }, [autoSizedColumnWidthsRef, column, columnResizeDirection, header.id, isResizingRef, resizeIndicatorRef, setColumnSizing, tableContainerRef, tableHeadCellRefs, tableRef]);
16265
16853
  return /*#__PURE__*/jsx(Box, {
16266
16854
  className: "Mui-TableHeadCell-ResizeHandle-Wrapper",
16267
16855
  onDoubleClick: () => {
@@ -16269,7 +16857,22 @@ const MRT_TableHeadCellResizeHandle = ({
16269
16857
  ...old_0,
16270
16858
  isResizingColumn: false
16271
16859
  }));
16272
- column.resetSize();
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)
16870
+ });
16871
+ delete autoSizedColumnWidthsRef.current[column.id];
16872
+ setColumnSizing(old_1 => ({
16873
+ ...old_1,
16874
+ [column.id]: newSize
16875
+ }));
16273
16876
  },
16274
16877
  onMouseDown: e_1 => {
16275
16878
  e_1.preventDefault();
@@ -16474,6 +17077,7 @@ const MRT_TableHeadCell = ({
16474
17077
  const {
16475
17078
  columnDefType
16476
17079
  } = columnDef;
17080
+ const isCheckboxColumn = column.id === CHECKBOX_DISPLAY_COLUMN_ID;
16477
17081
  const {
16478
17082
  columnResizing,
16479
17083
  draggingColumn,
@@ -16584,6 +17188,7 @@ const MRT_TableHeadCell = ({
16584
17188
  userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
16585
17189
  verticalAlign: 'top',
16586
17190
  borderBottom: 'none',
17191
+ borderInlineEnd: column.getCanResize() ? `1px solid ${theme_0.palette.divider}` : undefined,
16587
17192
  paddingBottom: 'none',
16588
17193
  ...getCommonMRTCellStyles({
16589
17194
  column,
@@ -16636,8 +17241,12 @@ const MRT_TableHeadCell = ({
16636
17241
  header: header,
16637
17242
  table: table,
16638
17243
  sx: {
16639
- // Show sort label when the cell is hovered or the column is actively sorted
16640
- visibility: isColumnCellHovered || column.getIsSorted() ? 'visible' : 'hidden'
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
16641
17250
  }
16642
17251
  })]
16643
17252
  }), columnDefType !== 'group' && /*#__PURE__*/jsxs(Box, {
@@ -16648,9 +17257,11 @@ const MRT_TableHeadCell = ({
16648
17257
  flexDirection: 'row',
16649
17258
  alignItems: 'center',
16650
17259
  gap: '0.5rem',
16651
- width: isColumnCellHovered ? 'auto' : 0,
17260
+ // Keep the checkbox menu in one position when hover ends.
17261
+ width: isCheckboxColumn || isColumnCellHovered ? 'auto' : 0,
17262
+ flexShrink: isCheckboxColumn ? 0 : undefined,
16652
17263
  visibility: isColumnCellHovered ? 'visible' : 'hidden',
16653
- px: isColumnCellHovered ? '0.2rem' : 0
17264
+ px: isCheckboxColumn || isColumnCellHovered ? '0.2rem' : 0
16654
17265
  },
16655
17266
  children: [showColumnActions && /*#__PURE__*/jsx(MRT_TableHeadCellColumnActionsButton, {
16656
17267
  header: header,
@@ -16927,7 +17538,7 @@ const MRT_Table = ({
16927
17538
  // changes — this is the reactive boundary that makes that happen instead of
16928
17539
  // relying on a root cascade re-render.
16929
17540
  useSelector(table.atoms.columnOrder);
16930
- useSelector(table.atoms.columnPinning);
17541
+ const columnPinning = useSelector(table.atoms.columnPinning);
16931
17542
  const density = useSelector(table.store, state => state.density);
16932
17543
  const tableProps = {
16933
17544
  ...parseFromValuesOrFunc(muiTableProps, {
@@ -16949,38 +17560,36 @@ const MRT_Table = ({
16949
17560
  for (let i = 0; i < headers.length; i++) {
16950
17561
  const header = headers[i];
16951
17562
  const colSize = header.getSize();
17563
+ colSizes[`--col-${parseCSSVarId(header.column.id)}-grow`] = getColumnGrowWeight(header.column, table);
16952
17564
  colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
16953
17565
  colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
16954
17566
  }
16955
17567
  return colSizes;
16956
- }, [columns, columnVisibility]);
17568
+ }, [columns, columnVisibility, columnPinning]);
16957
17569
 
16958
17570
  // Keeps the CSS size vars in sync with columnSizing after mount, without
16959
17571
  // subscribing this component to it (see comment above columnVisibility).
16960
17572
  useEffect(() => {
16961
- const subscription = table.atoms.columnSizing.subscribe(() => {
17573
+ const syncColumnSizing = () => {
16962
17574
  const node = tableRef.current;
16963
17575
  if (!node) return;
16964
17576
  const headers_0 = getFlatHeaders();
16965
17577
  for (let i_0 = 0; i_0 < headers_0.length; i_0++) {
16966
17578
  const header_0 = headers_0[i_0];
16967
17579
  const colSize_0 = header_0.getSize();
17580
+ node.style.setProperty(`--col-${parseCSSVarId(header_0.column.id)}-grow`, `${getColumnGrowWeight(header_0.column, table)}`);
16968
17581
  node.style.setProperty(`--header-${parseCSSVarId(header_0.id)}-size`, `${colSize_0}`);
16969
17582
  node.style.setProperty(`--col-${parseCSSVarId(header_0.column.id)}-size`, `${colSize_0}`);
16970
17583
  }
16971
- });
17584
+ };
17585
+ syncColumnSizing();
17586
+ const subscription = table.atoms.columnSizing.subscribe(syncColumnSizing);
16972
17587
  return () => subscription.unsubscribe();
16973
- }, [table]);
17588
+ }, [table, columns, columnVisibility, columnPinning]);
16974
17589
 
16975
17590
  // Padding values keyed off density, read by cell/header/footer sx so density toggles
16976
17591
  // reuse existing emotion classes instead of generating new ones per cell.
16977
- const densityVars = useMemo(() => ({
16978
- '--mrt-cell-p': density === 'compact' ? '0.5rem' : density === 'comfortable' ? '1rem' : '1.5rem',
16979
- '--mrt-display-cell-p': density === 'compact' ? '0 0.5rem' : density === 'comfortable' ? '0.5rem 0.75rem' : '1rem 1.25rem',
16980
- '--mrt-head-display-cell-p': density === 'compact' ? '0.5rem' : density === 'comfortable' ? '0.75rem' : '1rem 1.25rem',
16981
- '--mrt-head-cell-pb': density === 'compact' ? '0.4rem' : '0.6rem',
16982
- '--mrt-head-cell-pt': density === 'compact' ? '0.25rem' : density === 'comfortable' ? '.75rem' : '1.25rem'
16983
- }), [density]);
17592
+ const densityVars = useMemo(() => getDensityStyles(density), [density]);
16984
17593
  const columnVirtualizer = useMRT_ColumnVirtualizer(table);
16985
17594
  const commonTableGroupProps = {
16986
17595
  columnVirtualizer,
@@ -17355,6 +17964,8 @@ const MRT_TableContainer = ({
17355
17964
  table: table
17356
17965
  }), /*#__PURE__*/jsx(MRT_Table, {
17357
17966
  table: table
17967
+ }), /*#__PURE__*/jsx(MRT_AutoSizeColumnsEffect, {
17968
+ table: table
17358
17969
  }), newEntryModal.open && /*#__PURE__*/jsx(Suspense, {
17359
17970
  fallback: null,
17360
17971
  children: /*#__PURE__*/jsx(MRT_NewEntryModal$2, {
@@ -18017,6 +18628,7 @@ const buildInitialExportState = (availableExports, savedActiveExports) => {
18017
18628
 
18018
18629
  const MaterialReactServerTableInstanceComponent = ({
18019
18630
  config,
18631
+ paginationMode = 'pages',
18020
18632
  loadData,
18021
18633
  saveState,
18022
18634
  getAllSelectableRowIds,
@@ -18038,11 +18650,9 @@ const MaterialReactServerTableInstanceComponent = ({
18038
18650
  }, ref) => {
18039
18651
  const [pageCount, setPageCount] = useState(undefined);
18040
18652
  const [rowCount, setRowCount] = useState(0);
18041
- const [isLoading, setIsLoading] = useState(false);
18042
- // Skeletons only until the first data arrives. On later refetches (filter, sort, paging)
18043
- // the current rows stay visible with a progress bar - swapping every cell to a Skeleton
18044
- // and back remounts the whole table body twice per refetch.
18653
+ const [isLoading, setIsLoading] = useState(true);
18045
18654
  const [hasLoadedOnce, setHasLoadedOnce] = useState(false);
18655
+ const infinite = paginationMode === 'infinite';
18046
18656
 
18047
18657
  // Filter availableExports by exportPermissions if provided.
18048
18658
  // exportPermissions maps export key → required permission strings.
@@ -18069,6 +18679,11 @@ const MaterialReactServerTableInstanceComponent = ({
18069
18679
  } = useServerTableState({
18070
18680
  initialState: {
18071
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
+ },
18072
18687
  activeExports: buildInitialExportState(allowedExports, config.initialState?.activeExports)
18073
18688
  },
18074
18689
  saveState
@@ -18089,6 +18704,7 @@ const MaterialReactServerTableInstanceComponent = ({
18089
18704
  manualFiltering: true,
18090
18705
  manualPagination: true,
18091
18706
  manualSorting: true,
18707
+ enableRowVirtualization: infinite,
18092
18708
  enableRowPinning: false,
18093
18709
  getRowId: originalRow => originalRow.id,
18094
18710
  state: {
@@ -18116,7 +18732,9 @@ const MaterialReactServerTableInstanceComponent = ({
18116
18732
  rowsPerPageOptions: config.rowsPerPageOptions
18117
18733
  },
18118
18734
  ...tableOptionsOverrides,
18119
- ...handlers
18735
+ ...handlers,
18736
+ enablePagination: infinite ? false : tableOptionsOverrides.enablePagination ?? true,
18737
+ positionProgressBars: tableOptionsOverrides.positionProgressBars ?? (infinite ? 'bottom' : 'header')
18120
18738
  });
18121
18739
 
18122
18740
  // Lets any code that already has `table` (row actions, deleteRowsFn/editRowFn,
@@ -18154,41 +18772,40 @@ const MaterialReactServerTableInstanceComponent = ({
18154
18772
  setRowCount(prev_0 => prev_0 + insertedCount);
18155
18773
  }
18156
18774
  };
18157
- const fetchData = useCallback(async tableInstance => {
18158
- setIsLoading(true);
18159
- try {
18160
- const {
18161
- data: newData,
18162
- rowCount: newRowCount,
18163
- hasNextPage
18164
- } = await loadData(tableInstance.getState());
18165
- tableInstance.setRows(newData);
18166
- setHasLoadedOnce(true);
18167
- if (hasNextPage) {
18168
- setPageCount(-1);
18169
- setRowCount(0);
18170
- } else {
18171
- setPageCount(undefined);
18172
- setRowCount(newRowCount);
18173
- }
18174
- } finally {
18175
- 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);
18176
18785
  }
18177
- }, [loadData]);
18178
- useEffect(() => {
18179
- void fetchData(table);
18180
- // `table` is deliberately excluded from these deps. v9's useTable()
18181
- // memoizes its returned wrapper on the options object identity
18182
- // (see @tanstack/react-table's useTable.ts), and useMRT_TableInstance
18183
- // builds a fresh options object every render — so `table` is a new
18184
- // reference on every render regardless of whether anything relevant
18185
- // changed. Including it here would re-fire this data-fetching effect on
18186
- // every render (any unrelated state change anywhere in the tree),
18187
- // which triggers setRows/setIsLoading, causing another render, another
18188
- // new `table`, and an infinite fetch loop. The effect body always closes
18189
- // over the current render's `table`, so omitting it from deps only
18190
- // changes *when* the effect reruns, not what it reads when it does.
18191
- }, [fetchData, fetchTrigger.filterRules, fetchTrigger.pagination, fetchTrigger.sorting, fetchTrigger.columnVisibilityShowTrigger, fetchTrigger.refetchIndex]);
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
+ });
18192
18809
  useImperativeHandle(ref, () => ({
18193
18810
  refetch,
18194
18811
  table
@@ -18205,11 +18822,15 @@ const GHOST_COLUMNS = Array.from({
18205
18822
  id: `${i}`
18206
18823
  }));
18207
18824
  const HEADER_BAR_WIDTHS = [55, 40, 65, 45, 60, 35];
18208
- const MaterialReactServerTableSkeleton = () => {
18209
- const $ = c(6);
18210
- let t0;
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;
18211
18832
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
18212
- t0 = {
18833
+ t2 = {
18213
18834
  display: "flex",
18214
18835
  flexDirection: "column",
18215
18836
  height: "100%",
@@ -18217,13 +18838,13 @@ const MaterialReactServerTableSkeleton = () => {
18217
18838
  animation: mrtDelayedFadeIn
18218
18839
  }
18219
18840
  };
18220
- $[0] = t0;
18841
+ $[0] = t2;
18221
18842
  } else {
18222
- t0 = $[0];
18843
+ t2 = $[0];
18223
18844
  }
18224
- let t1;
18845
+ let t3;
18225
18846
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
18226
- t1 = /*#__PURE__*/jsxs(Box, {
18847
+ t3 = /*#__PURE__*/jsxs(Box, {
18227
18848
  sx: {
18228
18849
  alignItems: "center",
18229
18850
  display: "flex",
@@ -18251,15 +18872,15 @@ const MaterialReactServerTableSkeleton = () => {
18251
18872
  width: 135
18252
18873
  })]
18253
18874
  });
18254
- $[1] = t1;
18875
+ $[1] = t3;
18255
18876
  } else {
18256
- t1 = $[1];
18877
+ t3 = $[1];
18257
18878
  }
18258
- let t2;
18879
+ let t4;
18259
18880
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
18260
- t2 = /*#__PURE__*/jsxs(Box, {
18881
+ t4 = /*#__PURE__*/jsxs(Box, {
18261
18882
  sx: _temp$6,
18262
- children: [t1, /*#__PURE__*/jsx(Box, {
18883
+ children: [t3, /*#__PURE__*/jsx(Box, {
18263
18884
  sx: {
18264
18885
  alignItems: "center",
18265
18886
  display: "flex",
@@ -18273,91 +18894,179 @@ const MaterialReactServerTableSkeleton = () => {
18273
18894
  })
18274
18895
  })]
18275
18896
  });
18276
- $[2] = t2;
18897
+ $[2] = t4;
18277
18898
  } else {
18278
- t2 = $[2];
18899
+ t4 = $[2];
18279
18900
  }
18280
- let t3;
18901
+ let t5;
18281
18902
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
18282
- t3 = {
18903
+ t5 = {
18283
18904
  flex: 1,
18284
18905
  overflow: "hidden"
18285
18906
  };
18286
- $[3] = t3;
18907
+ $[3] = t5;
18287
18908
  } else {
18288
- t3 = $[3];
18909
+ t5 = $[3];
18289
18910
  }
18290
- let t4;
18291
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
18292
- t4 = /*#__PURE__*/jsx(Box, {
18293
- sx: t3,
18294
- children: /*#__PURE__*/jsxs(Box, {
18295
- component: "table",
18296
- sx: _temp2$3,
18297
- children: [/*#__PURE__*/jsx("thead", {
18298
- "aria-hidden": true,
18299
- children: /*#__PURE__*/jsx("tr", {
18300
- children: GHOST_COLUMNS.map(_temp3$1)
18301
- })
18302
- }), /*#__PURE__*/jsx("tbody", {
18303
- children: /*#__PURE__*/jsx(MRT_GhostRows, {
18304
- cells: GHOST_COLUMNS,
18305
- rowHeight: 37
18306
- })
18307
- })]
18308
- })
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
+ }
18309
18932
  });
18310
- $[4] = t4;
18933
+ $[4] = density;
18934
+ $[5] = t6;
18311
18935
  } else {
18312
- t4 = $[4];
18936
+ t6 = $[5];
18313
18937
  }
18314
- let t5;
18315
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
18316
- t5 = /*#__PURE__*/jsxs(Paper, {
18317
- "data-testid": "server-table-skeleton",
18318
- sx: t0,
18319
- children: [t2, t4, /*#__PURE__*/jsx(Box, {
18320
- sx: _temp4,
18321
- children: /*#__PURE__*/jsxs(Box, {
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, {
18322
18946
  sx: {
18323
18947
  alignItems: "center",
18324
18948
  display: "flex",
18325
- gap: "1rem"
18949
+ height: density === "compact" ? "1.75rem" : "1.5em"
18326
18950
  },
18327
- children: [/*#__PURE__*/jsx(Skeleton, {
18328
- animation: "pulse",
18329
- height: 36,
18330
- variant: "rounded",
18331
- width: 136
18332
- }), /*#__PURE__*/jsx(Skeleton, {
18333
- animation: "pulse",
18334
- height: 31,
18335
- variant: "text",
18336
- width: 176
18337
- }), /*#__PURE__*/jsx(Skeleton, {
18338
- animation: "pulse",
18339
- height: 22,
18340
- variant: "text",
18341
- width: 70
18342
- }), /*#__PURE__*/jsx(Skeleton, {
18343
- animation: "pulse",
18344
- height: 24,
18345
- variant: "circular",
18346
- width: 24
18347
- }), /*#__PURE__*/jsx(Skeleton, {
18348
- animation: "pulse",
18349
- height: 24,
18350
- variant: "circular",
18351
- width: 24
18352
- })]
18951
+ children: /*#__PURE__*/jsx("span", {
18952
+ style: {
18953
+ width: `${HEADER_BAR_WIDTHS[i]}%`
18954
+ }
18955
+ })
18353
18956
  })
18354
- })]
18957
+ }, id);
18355
18958
  });
18356
- $[5] = t5;
18959
+ $[6] = density;
18960
+ $[7] = t7;
18357
18961
  } else {
18358
- t5 = $[5];
18962
+ t7 = $[7];
18359
18963
  }
18360
- return t5;
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;
18361
19070
  };
18362
19071
  function _temp$6(theme) {
18363
19072
  return {
@@ -18370,38 +19079,7 @@ function _temp$6(theme) {
18370
19079
  paddingRight: "0.3rem"
18371
19080
  };
18372
19081
  }
18373
- function _temp2$3(theme_0) {
18374
- return {
18375
- borderCollapse: "collapse",
18376
- tableLayout: "fixed",
18377
- width: "100%",
18378
- "& th": {
18379
- borderBottom: `1px solid ${theme_0.palette.divider}`,
18380
- height: 48,
18381
- p: "0.5rem",
18382
- textAlign: "left"
18383
- },
18384
- "& th > span": {
18385
- backgroundColor: alpha(theme_0.palette.text.primary, 0.16),
18386
- borderRadius: 999,
18387
- display: "block",
18388
- height: 12
18389
- }
18390
- };
18391
- }
18392
- function _temp3$1(t0, i) {
18393
- const {
18394
- id
18395
- } = t0;
18396
- return /*#__PURE__*/jsx("th", {
18397
- children: /*#__PURE__*/jsx("span", {
18398
- style: {
18399
- width: `${HEADER_BAR_WIDTHS[i]}%`
18400
- }
18401
- })
18402
- }, id);
18403
- }
18404
- function _temp4(theme_1) {
19082
+ function _temp2$3(theme_1) {
18405
19083
  return {
18406
19084
  alignItems: "center",
18407
19085
  borderTop: `1px solid ${theme_1.palette.divider}`,
@@ -18446,7 +19124,9 @@ const MaterialReactServerTableComponent = ({
18446
19124
  };
18447
19125
  }, [loadConfig]);
18448
19126
  if (configLoading) {
18449
- return /*#__PURE__*/jsx(MaterialReactServerTableSkeleton, {});
19127
+ return /*#__PURE__*/jsx(MaterialReactServerTableSkeleton, {
19128
+ density: instanceProps.state?.density ?? instanceProps.initialState?.density ?? 'compact'
19129
+ });
18450
19130
  }
18451
19131
  if (!config) {
18452
19132
  return /*#__PURE__*/jsx(MaterialReactServerTableError, {
@@ -20164,5 +20844,5 @@ function _temp2(state_0) {
20164
20844
  };
20165
20845
  }
20166
20846
 
20167
- 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_SelectAllMenu, 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, getColumnId, getDefaultColumnOrderIds, getDefaultColumnPinningState, 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 };
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 };
20168
20848
  //# sourceMappingURL=index.esm.js.map