@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.js CHANGED
@@ -97,6 +97,7 @@ var CheckIcon = require('@mui/icons-material/Check');
97
97
  var ClickAwayListener = require('@mui/material/ClickAwayListener');
98
98
  var ErrorOutlineRoundedIcon = require('@mui/icons-material/ErrorOutlineRounded');
99
99
  var Paper = require('@mui/material/Paper');
100
+ var Alert = require('@mui/material/Alert');
100
101
  var Collapse = require('@mui/material/Collapse');
101
102
  var LinearProgress = require('@mui/material/LinearProgress');
102
103
  var Pagination = require('@mui/material/Pagination');
@@ -108,6 +109,7 @@ var ListItemIcon = require('@mui/material/ListItemIcon');
108
109
  var ListItemText = require('@mui/material/ListItemText');
109
110
  var BookmarkIcon = require('@mui/icons-material/Bookmark');
110
111
  var DeleteForeverIcon = require('@mui/icons-material/DeleteForever');
112
+ var InputAdornment = require('@mui/material/InputAdornment');
111
113
  var Switch = require('@mui/material/Switch');
112
114
  var Badge = require('@mui/material/Badge');
113
115
  var TableContainer = require('@mui/material/TableContainer');
@@ -124,7 +126,6 @@ var Accordion = require('@mui/material/Accordion');
124
126
  var AccordionDetails = require('@mui/material/AccordionDetails');
125
127
  var AccordionSummary = require('@mui/material/AccordionSummary');
126
128
  var Modal = require('@mui/material/Modal');
127
- var Alert = require('@mui/material/Alert');
128
129
  var AlertTitle = require('@mui/material/AlertTitle');
129
130
 
130
131
  const MRT_SortingFns = {
@@ -146,6 +147,15 @@ const getAllLeafColumnDefs = columns => {
146
147
  getLeafColumns(columns);
147
148
  return allLeafColumnDefs;
148
149
  };
150
+
151
+ // Must run on the raw, user-authored column array — by the time TanStack
152
+ // resolves column.columnDef.size (via constructColumn's `{...defaultColumn,
153
+ // ...columnDef}` merge), a column the consumer never gave a size backfills
154
+ // MRT_DefaultColumn.size (180) directly into columnDef.size, indistinguishable
155
+ // from a column that explicitly asked for 180. Checking `size === undefined`
156
+ // here, before that merge happens, is the only point where the distinction
157
+ // still exists.
158
+ const getAutoSizeCandidateColumnIds = columnDefs => new Set(getAllLeafColumnDefs(columnDefs).filter(columnDef => columnDef.size === undefined).map(columnDef => getColumnId(columnDef)));
149
159
  const prepareColumns = ({
150
160
  columnDefs,
151
161
  tableOptions
@@ -196,6 +206,7 @@ const reorderColumn = (draggedColumn, targetColumn, columnOrder) => {
196
206
  };
197
207
 
198
208
  function defaultDisplayColumnProps({
209
+ columnSpecificDefaults,
199
210
  header,
200
211
  id,
201
212
  size,
@@ -210,6 +221,7 @@ function defaultDisplayColumnProps({
210
221
  ...defaultDisplayColumn,
211
222
  header: header ? localization[header] : '',
212
223
  size,
224
+ ...columnSpecificDefaults,
213
225
  ...displayColumnDefOptions?.[id],
214
226
  id
215
227
  };
@@ -248,42 +260,10 @@ const getTrailingDisplayColumnIds = tableOptions => [tableOptions.positionAction
248
260
  /** The internal ID used by TanStack Table for the row-selection checkbox column */
249
261
  const CHECKBOX_DISPLAY_COLUMN_ID = '__check__';
250
262
 
251
- /**
252
- * Builds the default columnPinning state so that the checkbox column
253
- * is always the first start-pinned column when row selection is enabled.
254
- * The checkbox is pinned for sticky positioning only — its visual styles are
255
- * intentionally overridden in style.utils.ts to match center column appearance.
256
- * Any user-supplied start-pinned column IDs are kept, but appended after the
257
- * checkbox so they never appear before it.
258
- */
259
- const getDefaultColumnPinningState = (tableOptions, existingColumnPinning = {}) => {
260
- const existingStart = existingColumnPinning.start ?? [];
261
- const existingEnd = existingColumnPinning.end ?? [];
262
-
263
- // Only pin the checkbox automatically when the column is actually rendered
264
- if (!tableOptions.enableRowSelection) {
265
- return {
266
- start: existingStart,
267
- end: existingEnd
268
- };
269
- }
270
-
271
- // Remove checkbox from wherever it is to check remaining pinned columns
272
- const startWithoutCheckbox = existingStart.filter(colId => colId !== CHECKBOX_DISPLAY_COLUMN_ID);
273
-
274
- // Only force checkbox to the front when start or end pinned columns exist
275
- const updatedStart = existingStart.length > 0 ? [CHECKBOX_DISPLAY_COLUMN_ID, ...startWithoutCheckbox] : existingStart;
276
- return {
277
- start: updatedStart,
278
- end: existingEnd
279
- };
280
- };
281
-
282
263
  /**
283
264
  * Forces mrt-row-expand to a fixed slot in columnOrder: right after the
284
265
  * checkbox column when row selection is enabled, otherwise the very first
285
- * column. Not configurable — mirrors how getDefaultColumnPinningState
286
- * forces the checkbox column itself to the front of columnPinning.start.
266
+ * column. This slot is independent of column pinning.
287
267
  */
288
268
  const normalizeRowExpandColumnOrder = (tableOptions, columnOrder) => {
289
269
  if (!showRowExpandColumn(tableOptions)) {
@@ -505,6 +485,89 @@ const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parent
505
485
  [getColumnId(col)]: ''
506
486
  }))), rowIndex, depth, subRows, parentId);
507
487
 
488
+ /** Resolved column limits shared by measurement, resizing, and cell layout. */
489
+ const getColumnSizeBounds = ({
490
+ minSize = 40,
491
+ maxSize = 1000
492
+ }) => {
493
+ const min = Number.isFinite(minSize) ? Math.max(0, minSize) : 40;
494
+ const max = Number.isNaN(maxSize) ? 1000 : Math.max(min, maxSize);
495
+ return {
496
+ minSize: min,
497
+ maxSize: max
498
+ };
499
+ };
500
+
501
+ // `el` normally has an explicit width/min-width/flex-basis (driven by the
502
+ // column's size CSS var), so nothing overflows and `getBoundingClientRect`
503
+ // just reports that forced size back — and `min-width` alone would otherwise
504
+ // stop it from ever shrinking below the current (large) column size.
505
+ // Temporarily switching to `max-content` with min-width/grow/shrink zeroed
506
+ // out lets the browser lay it out at its natural content size instead — then
507
+ // the inline style is restored before this task yields, so there's no
508
+ // visible flash.
509
+ const measureIntrinsicWidth = el => {
510
+ const {
511
+ width,
512
+ minWidth,
513
+ maxWidth,
514
+ flexBasis,
515
+ flexGrow,
516
+ flexShrink
517
+ } = el.style;
518
+ el.style.width = 'max-content';
519
+ el.style.minWidth = '0';
520
+ el.style.maxWidth = 'none';
521
+ el.style.flexBasis = 'auto';
522
+ el.style.flexGrow = '0';
523
+ el.style.flexShrink = '0';
524
+ const measured = Math.ceil(el.getBoundingClientRect().width);
525
+ el.style.width = width;
526
+ el.style.minWidth = minWidth;
527
+ el.style.maxWidth = maxWidth;
528
+ el.style.flexBasis = flexBasis;
529
+ el.style.flexGrow = flexGrow;
530
+ el.style.flexShrink = flexShrink;
531
+ return measured;
532
+ };
533
+
534
+ /**
535
+ * The single measurement this library uses anywhere it decides "what's the
536
+ * right width for this column's current content" — shared by the resize
537
+ * handle's double-click autosize and the initial autosize effect
538
+ * (MRT_AutoSizeColumnsEffect), so both agree on the exact same answer.
539
+ *
540
+ * Driven purely by body cell content: the header title never contributes,
541
+ * so a long header simply ellipsizes when its values are narrower.
542
+ *
543
+ * Only the currently rendered (visible, due to row virtualization) body
544
+ * cells can be measured — a full-dataset autosize would require rendering
545
+ * every row off-screen, which defeats the point of virtualization.
546
+ */
547
+ // Absorbs the sub-pixel rounding gap between measurement time (forced
548
+ // `max-content`, read via `Math.ceil`) and final render time (the actual
549
+ // `calc(var(--col-x-size) * 1px)` width) — without it, a column can land
550
+ // exactly 1px short of its own measured content and still clip/ellipsize.
551
+ const MEASUREMENT_SAFETY_MARGIN_PX = 2;
552
+ const computeAutoSizedColumnWidth = ({
553
+ bodyCellEls,
554
+ maxSize,
555
+ minSize
556
+ }) => {
557
+ let contentWidth = 0;
558
+ for (const cellEl of bodyCellEls ?? []) {
559
+ contentWidth = Math.max(contentWidth, measureIntrinsicWidth(cellEl));
560
+ }
561
+ if (contentWidth > 0) {
562
+ contentWidth = Math.ceil(contentWidth) + MEASUREMENT_SAFETY_MARGIN_PX;
563
+ }
564
+ const bounds = getColumnSizeBounds({
565
+ minSize,
566
+ maxSize
567
+ });
568
+ return Math.min(Math.max(contentWidth, bounds.minSize), bounds.maxSize);
569
+ };
570
+
508
571
  // Loading indicators fade in after a short delay
509
572
  // (`animation: ${mrtDelayedFadeIn}`), so fast responses don't flash them.
510
573
  const mrtDelayedFadeIn = `${styles.keyframes`
@@ -536,6 +599,7 @@ const commonCellBeforeAfterStyles = {
536
599
  zIndex: -1
537
600
  };
538
601
  const getCommonPinnedCellStyles = ({
602
+ column,
539
603
  table,
540
604
  theme
541
605
  }) => {
@@ -545,12 +609,30 @@ const getCommonPinnedCellStyles = ({
545
609
  return {
546
610
  '&[data-pinned="true"]': {
547
611
  '&:before': {
548
- backgroundColor: styles.alpha(styles.darken(baseBackgroundColor, theme.palette.mode === 'dark' ? 0.05 : 0.01), 0.97),
612
+ backgroundColor: baseBackgroundColor,
613
+ // Draw only the edge facing the center region, including when other
614
+ // pinned columns are hidden. Logical borders also handle RTL layouts.
615
+ borderInlineEnd: column?.getIsPinned() === 'start' && column.getIsLastColumn('start') ? `1px solid ${theme.palette.divider}` : undefined,
616
+ borderInlineStart: column?.getIsPinned() === 'end' && column.getIsFirstColumn('end') ? `1px solid ${theme.palette.divider}` : undefined,
617
+ boxSizing: 'border-box',
549
618
  ...commonCellBeforeAfterStyles
550
619
  }
551
620
  }
552
621
  };
553
622
  };
623
+
624
+ // Shared by cell styles and the imperative sizing subscription: resizing must
625
+ // update growth even when memoized cells do not render again.
626
+ const getColumnGrowWeight = (column, table) => {
627
+ const {
628
+ columnDef
629
+ } = column;
630
+ const sizing = table.getState().columnSizing[column.id];
631
+ const hasUserSize = sizing !== undefined && sizing !== table.refs.autoSizedColumnWidthsRef.current[column.id];
632
+ if (column.getIsPinned() || !table.refs.autoSizeColumnIdsRef.current.has(column.id) || hasUserSize) return 0;
633
+ if (typeof columnDef.grow === 'number') return Math.max(0, columnDef.grow);
634
+ return columnDef.grow === false ? 0 : 1;
635
+ };
554
636
  const getCommonMRTCellStyles = ({
555
637
  column,
556
638
  header,
@@ -573,60 +655,33 @@ const getCommonMRTCellStyles = ({
573
655
  columnDefType
574
656
  } = columnDef;
575
657
  const isColumnPinned = columnDef.columnDefType !== 'group' && column.getIsPinned();
658
+ const {
659
+ minSize,
660
+ maxSize
661
+ } = getColumnSizeBounds(columnDef);
662
+ const sizeVar = `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size) * 1px)`;
663
+ const boundedSize = Number.isFinite(maxSize) ? `clamp(${minSize}px, ${sizeVar}, ${maxSize}px)` : `max(${minSize}px, ${sizeVar})`;
576
664
  const widthStyles = {
577
- minWidth: `max(calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size) * 1px), ${columnDef.minSize ?? 30}px)`,
578
- width: `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size) * 1px)`
665
+ // Group headers span already-bounded child columns; the default leaf
666
+ // maximum must not truncate the sum of their widths.
667
+ maxWidth: columnDefType === 'group' ? sizeVar : Number.isFinite(maxSize) ? `${maxSize}px` : 'none',
668
+ minWidth: columnDefType === 'group' ? sizeVar : boundedSize,
669
+ width: columnDefType === 'group' ? sizeVar : boundedSize
579
670
  };
580
- if (layoutMode === 'grid') {
581
- widthStyles.flex = `${[0, false].includes(columnDef.grow) ? 0 : `var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size)`} 0 auto`;
582
- } else if (layoutMode === 'grid-no-grow') {
583
- widthStyles.flex = `${+(columnDef.grow || 0)} 0 auto`;
671
+ if (layoutMode === 'grid' || layoutMode === 'grid-no-grow') {
672
+ const weight = getColumnGrowWeight(column, table);
673
+ const growVar = `var(--col-${parseCSSVarId(column.id)}-grow, ${weight})`;
674
+ widthStyles.flex = `${growVar} 0 auto`;
584
675
  }
585
-
586
- // The checkbox column is technically pinned (for sticky positioning) but
587
- // should look like a regular center column — no background overlay or shadow.
588
- const isCheckboxColumn = column.id === CHECKBOX_DISPLAY_COLUMN_ID;
589
-
590
- // Count all currently pinned column IDs across both sides.
591
- // Checkbox is always pinned (counts as 1), so > 1 means the user has
592
- // explicitly pinned at least one additional column.
593
- // Avoid spreading into a new array on this per-cell hot path — a length sum
594
- // is enough, we never need the combined array itself.
595
- const {
596
- columnPinning
597
- } = table.getState();
598
- const totalPinnedColumnCount = (columnPinning.start?.length ?? 0) + (columnPinning.end?.length ?? 0);
599
- const hasNoPinnedColumns = totalPinnedColumnCount === 0;
600
676
  const pinnedStyles = isColumnPinned ? {
601
- // For checkbox: suppress pinned background/shadow only when other
602
- // columns are also pinned (> 1 total). When it is the sole pinned column
603
- // no override is needed. For all other columns apply standard pinned styles.
604
- ...(isCheckboxColumn ? hasNoPinnedColumns ? {
605
- // Use doubled class selector (&&) to beat the row-level
606
- // td[data-pinned="true"]:before specificity from MRT_TableBodyRow.
607
- '&&[data-pinned="true"]': {
608
- '&:before': {
609
- backgroundColor: 'transparent',
610
- boxShadow: 'none'
611
- }
612
- }
613
- } :
614
- // Other columns are also pinned — apply standard pinned background
615
- // so the checkbox header matches the pinned row cells below it.
616
- getCommonPinnedCellStyles({
677
+ ...getCommonPinnedCellStyles({
617
678
  column,
618
679
  table,
619
680
  theme
620
- }) : getCommonPinnedCellStyles({
621
- column,
622
- table,
623
- theme
624
- })),
681
+ }),
625
682
  // Logical CSS insets (not left/right) so pinning stays correct in RTL
626
683
  // without branching on theme.direction here.
627
684
  insetInlineStart: isColumnPinned === 'start' ? `${column.getStart('start')}px` : undefined,
628
- // Skip opacity reduction for checkbox — keep it fully opaque like center columns
629
- opacity: isCheckboxColumn ? undefined : 0.97,
630
685
  position: 'sticky',
631
686
  insetInlineEnd: isColumnPinned === 'end' ? `${column.getAfter('end')}px` : undefined
632
687
  } : {};
@@ -2079,7 +2134,7 @@ const MRT_ToggleRowActionMenuButton = t0 => {
2079
2134
  staticRowIndex,
2080
2135
  table
2081
2136
  }) : renderRowActionMenuItems?.({
2082
- closeMenu: _temp$A,
2137
+ closeMenu: _temp$B,
2083
2138
  row,
2084
2139
  staticRowIndex,
2085
2140
  table
@@ -2129,7 +2184,7 @@ const MRT_ToggleRowActionMenuButton = t0 => {
2129
2184
  }
2130
2185
  return t5;
2131
2186
  };
2132
- function _temp$A() {}
2187
+ function _temp$B() {}
2133
2188
 
2134
2189
  const getMRT_RowActionsColumnDef = tableOptions => {
2135
2190
  return {
@@ -2144,7 +2199,18 @@ const getMRT_RowActionsColumnDef = tableOptions => {
2144
2199
  staticRowIndex: staticRowIndex,
2145
2200
  table: table
2146
2201
  }),
2202
+ ...(tableOptions.positionActionsColumn === 'last' && {
2203
+ grow: true
2204
+ }),
2147
2205
  ...defaultDisplayColumnProps({
2206
+ // Unlike other display columns, the actions column is draggable,
2207
+ // orderable, and resizable by default — it behaves like a user column
2208
+ // for layout purposes, just without filtering/sorting/hiding.
2209
+ columnSpecificDefaults: {
2210
+ enableColumnDragging: true,
2211
+ enableColumnOrdering: true,
2212
+ enableResizing: true
2213
+ },
2148
2214
  header: 'actions',
2149
2215
  id: 'mrt-row-actions',
2150
2216
  size: 70,
@@ -2197,7 +2263,7 @@ const MRT_ExpandAllButton = t0 => {
2197
2263
  const {
2198
2264
  isLoading
2199
2265
  } = t3;
2200
- const density = reactStore.useSelector(table.store, _temp$z);
2266
+ const density = reactStore.useSelector(table.store, _temp$A);
2201
2267
  let t4;
2202
2268
  if ($[5] !== muiExpandAllButtonProps || $[6] !== table) {
2203
2269
  t4 = parseFromValuesOrFunc(muiExpandAllButtonProps, {
@@ -2286,7 +2352,7 @@ const MRT_ExpandAllButton = t0 => {
2286
2352
  }
2287
2353
  return t7;
2288
2354
  };
2289
- function _temp$z(state) {
2355
+ function _temp$A(state) {
2290
2356
  return state.density;
2291
2357
  }
2292
2358
 
@@ -2369,10 +2435,12 @@ const MRT_ExpandButton = ({
2369
2435
  "aria-label": localization.expand,
2370
2436
  disabled: !canExpand && !detailPanel,
2371
2437
  ...iconButtonProps,
2438
+ disableRipple: true,
2372
2439
  onClick: handleToggleExpand,
2373
2440
  sx: theme_0 => ({
2374
2441
  opacity: !canExpand && !detailPanel ? 0.3 : 1,
2375
2442
  [theme_0.direction === 'rtl' || positionExpandColumn === 'last' ? 'mr' : 'ml']: `${row.depth * 16}px`,
2443
+ height: density === 'compact' ? '1.75rem' : '2.25rem',
2376
2444
  width: density === 'compact' ? '1.75rem' : '2.25rem',
2377
2445
  ...parseFromValuesOrFunc(iconButtonProps?.sx, theme_0)
2378
2446
  }),
@@ -2499,13 +2567,16 @@ const MRT_ReorderRowCheckbox = t0 => {
2499
2567
  onChange,
2500
2568
  isSelected
2501
2569
  } = t0;
2502
- const handleClick = _temp$y;
2570
+ const handleClick = _temp$z;
2503
2571
  let t1;
2504
2572
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2505
2573
  t1 = {
2506
2574
  color: _temp2$d,
2575
+ height: "1.75rem",
2576
+ m: "-0.4rem",
2577
+ width: "1.75rem",
2507
2578
  "&.Mui-checked": {
2508
- color: _temp3$6
2579
+ color: _temp3$5
2509
2580
  }
2510
2581
  };
2511
2582
  $[0] = t1;
@@ -2520,6 +2591,7 @@ const MRT_ReorderRowCheckbox = t0 => {
2520
2591
  disableRipple: true,
2521
2592
  onChange: onChange,
2522
2593
  onClick: handleClick,
2594
+ size: "small",
2523
2595
  sx: t1
2524
2596
  });
2525
2597
  $[1] = isSelected;
@@ -2530,13 +2602,13 @@ const MRT_ReorderRowCheckbox = t0 => {
2530
2602
  }
2531
2603
  return t2;
2532
2604
  };
2533
- function _temp$y(event) {
2605
+ function _temp$z(event) {
2534
2606
  event.stopPropagation();
2535
2607
  }
2536
2608
  function _temp2$d(theme) {
2537
2609
  return theme.palette.warning.main;
2538
2610
  }
2539
- function _temp3$6(theme_0) {
2611
+ function _temp3$5(theme_0) {
2540
2612
  return theme_0.palette.warning.main;
2541
2613
  }
2542
2614
 
@@ -2855,7 +2927,7 @@ const useTreeRowReorderingHeader = t0 => {
2855
2927
  enableRowReordering,
2856
2928
  onTreeRowReorder
2857
2929
  } = t0;
2858
- const rowReorderingSelection = reactStore.useSelector(table.store, _temp$x);
2930
+ const rowReorderingSelection = reactStore.useSelector(table.store, _temp$y);
2859
2931
  let selectedReorderRowIds;
2860
2932
  let selectedRowsForReorder;
2861
2933
  let t1;
@@ -2918,7 +2990,7 @@ const useTreeRowReorderingHeader = t0 => {
2918
2990
  }
2919
2991
  return t3;
2920
2992
  };
2921
- function _temp$x(state) {
2993
+ function _temp$y(state) {
2922
2994
  return state.rowReorderingSelection;
2923
2995
  }
2924
2996
  function _temp2$c(selectedRow) {
@@ -3261,7 +3333,7 @@ const MRT_TableBodyRowPinButton = t0 => {
3261
3333
  enableRowPinning,
3262
3334
  rowPinningDisplayMode
3263
3335
  } = t1;
3264
- const density = reactStore.useSelector(table.store, _temp$w);
3336
+ const density = reactStore.useSelector(table.store, _temp$x);
3265
3337
  const canPin = parseFromValuesOrFunc(enableRowPinning, row);
3266
3338
  if (!canPin) {
3267
3339
  return null;
@@ -3342,7 +3414,7 @@ const MRT_TableBodyRowPinButton = t0 => {
3342
3414
  }
3343
3415
  return t4;
3344
3416
  };
3345
- function _temp$w(state) {
3417
+ function _temp$x(state) {
3346
3418
  return state.density;
3347
3419
  }
3348
3420
 
@@ -3365,166 +3437,6 @@ const getMRT_RowPinningColumnDef = tableOptions => {
3365
3437
  };
3366
3438
  };
3367
3439
 
3368
- const MRT_SelectAllMenu = ({
3369
- table
3370
- }) => {
3371
- const [anchorEl, setAnchorEl] = react.useState(null);
3372
- const [isSelectingAllPages, setIsSelectingAllPages] = react.useState(false);
3373
- const {
3374
- getState,
3375
- options: {
3376
- enableRowPinning,
3377
- getAllSelectableRowIds,
3378
- localization,
3379
- rowPinningDisplayMode
3380
- },
3381
- refs: {
3382
- allSelectableRowIdsRef
3383
- }
3384
- } = table;
3385
- const {
3386
- isLoading
3387
- } = getState();
3388
- const handleOpen = event => {
3389
- setAnchorEl(event.currentTarget);
3390
- };
3391
- const handleClose = () => {
3392
- setAnchorEl(null);
3393
- };
3394
-
3395
- // Clears row pinning on every bulk selection/deselection
3396
- const clearPinning = () => {
3397
- if (enableRowPinning && rowPinningDisplayMode?.includes('select')) {
3398
- table.setRowPinning({
3399
- bottom: [],
3400
- top: []
3401
- });
3402
- }
3403
- };
3404
-
3405
- // ── Current-page actions ────────────────────────────────────────────────────
3406
-
3407
- const handleSelectCurrentPage = () => {
3408
- table.toggleAllPageRowsSelected(true);
3409
- clearPinning();
3410
- handleClose();
3411
- };
3412
- const handleDeselectCurrentPage = () => {
3413
- if (allSelectableRowIdsRef.current.length > 0) {
3414
- // 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.
3415
- table.setRowSelection({});
3416
- allSelectableRowIdsRef.current = [];
3417
- } else {
3418
- table.toggleAllPageRowsSelected(false);
3419
- }
3420
- clearPinning();
3421
- handleClose();
3422
- };
3423
-
3424
- // ── All-pages actions ───────────────────────────────────────────────────────
3425
-
3426
- const handleSelectAllPages = async () => {
3427
- handleClose();
3428
- if (getAllSelectableRowIds) {
3429
- // Server-side: IDs are not available locally, fetch them from the API
3430
- setIsSelectingAllPages(true);
3431
- table.setShowProgressBars(true);
3432
- try {
3433
- const ids = await getAllSelectableRowIds({
3434
- table
3435
- });
3436
- allSelectableRowIdsRef.current = ids;
3437
- const newSelection = {};
3438
- ids.forEach(id => {
3439
- newSelection[id] = true;
3440
- });
3441
- table.setRowSelection(newSelection);
3442
- clearPinning();
3443
- } finally {
3444
- setIsSelectingAllPages(false);
3445
- table.setShowProgressBars(false);
3446
- }
3447
- } else {
3448
- // Client-side: all data is available locally
3449
- table.toggleAllRowsSelected(true);
3450
- clearPinning();
3451
- }
3452
- };
3453
- const handleDeselectAllPages = () => {
3454
- if (getAllSelectableRowIds) {
3455
- table.setRowSelection({});
3456
- } else {
3457
- table.toggleAllRowsSelected(false);
3458
- }
3459
- allSelectableRowIdsRef.current = [];
3460
- clearPinning();
3461
- handleClose();
3462
- };
3463
- const isDisabled = isLoading || isSelectingAllPages;
3464
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
3465
- children: [/*#__PURE__*/jsxRuntime.jsx(Tooltip, {
3466
- ...getCommonTooltipProps(),
3467
- title: localization.toggleSelectAll,
3468
- children: /*#__PURE__*/jsxRuntime.jsx("span", {
3469
- children: /*#__PURE__*/jsxRuntime.jsx(IconButton, {
3470
- "aria-label": localization.toggleSelectAll,
3471
- disabled: isDisabled,
3472
- onClick: handleOpen,
3473
- size: "small",
3474
- sx: {
3475
- height: '1.5rem',
3476
- width: '1.5rem'
3477
- },
3478
- children: /*#__PURE__*/jsxRuntime.jsx(table.options.icons.MoreVertIcon, {
3479
- style: {
3480
- transform: 'scale(0.85)'
3481
- }
3482
- })
3483
- })
3484
- })
3485
- }), /*#__PURE__*/jsxRuntime.jsx(Menu, {
3486
- anchorEl: anchorEl,
3487
- onClose: handleClose,
3488
- open: Boolean(anchorEl),
3489
- children: /*#__PURE__*/jsxRuntime.jsx(reactTable.Subscribe, {
3490
- selector: state => ({
3491
- pagination: state.pagination,
3492
- rowSelection: state.rowSelection
3493
- }),
3494
- source: table.store,
3495
- children: ({
3496
- rowSelection
3497
- }) => {
3498
- const isAllCurrentPageSelected = table.getIsAllPageRowsSelected();
3499
- const isAllPagesActive = getIsAllPagesSelectionActive(table, rowSelection);
3500
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
3501
- children: [isAllCurrentPageSelected ? /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
3502
- onClick: handleDeselectCurrentPage,
3503
- children: localization.deselectAllOnCurrentPage
3504
- }) : /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
3505
- onClick: handleSelectCurrentPage,
3506
- children: localization.selectAllOnCurrentPage
3507
- }), isAllPagesActive ? /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
3508
- onClick: handleDeselectAllPages,
3509
- children: localization.deselectAllOnAllPages
3510
- }) : /*#__PURE__*/jsxRuntime.jsxs(MenuItem, {
3511
- disabled: isSelectingAllPages,
3512
- onClick: handleSelectAllPages,
3513
- children: [isSelectingAllPages && /*#__PURE__*/jsxRuntime.jsx(CircularProgress, {
3514
- "aria-label": "Loading",
3515
- size: 14,
3516
- sx: {
3517
- mr: 1
3518
- }
3519
- }), localization.selectAllOnAllPages]
3520
- })]
3521
- });
3522
- }
3523
- })
3524
- })]
3525
- });
3526
- };
3527
-
3528
3440
  const MRT_SelectCheckbox = t0 => {
3529
3441
  const $ = compilerRuntime.c(32);
3530
3442
  let rest;
@@ -3571,7 +3483,7 @@ const MRT_SelectCheckbox = t0 => {
3571
3483
  const {
3572
3484
  isLoading
3573
3485
  } = t2;
3574
- const density = reactStore.useSelector(table.store, _temp$v);
3486
+ const density = reactStore.useSelector(table.store, _temp$w);
3575
3487
  const selectAll = !row;
3576
3488
  let t3;
3577
3489
  if ($[7] !== row || $[8] !== staticRowIndex || $[9] !== table) {
@@ -3689,7 +3601,7 @@ const MRT_SelectCheckbox = t0 => {
3689
3601
  }
3690
3602
  return t6;
3691
3603
  };
3692
- function _temp$v(state) {
3604
+ function _temp$w(state) {
3693
3605
  return state.density;
3694
3606
  }
3695
3607
  function _temp2$b(state_0) {
@@ -3716,23 +3628,18 @@ const getMRT_RowSelectColumnDef = tableOptions => {
3716
3628
  }),
3717
3629
  Header: enableSelectAll && enableMultiRowSelection ? ({
3718
3630
  table
3719
- }) => /*#__PURE__*/jsxRuntime.jsxs(Box, {
3720
- sx: {
3721
- alignItems: 'center',
3722
- display: 'flex'
3723
- },
3724
- children: [/*#__PURE__*/jsxRuntime.jsx(MRT_SelectCheckbox, {
3725
- table: table
3726
- }), /*#__PURE__*/jsxRuntime.jsx(MRT_SelectAllMenu, {
3727
- table: table
3728
- })]
3631
+ }) => /*#__PURE__*/jsxRuntime.jsx(MRT_SelectCheckbox, {
3632
+ table: table
3729
3633
  }) : undefined,
3730
3634
  grow: false,
3731
3635
  ...defaultDisplayColumnProps({
3636
+ columnSpecificDefaults: {
3637
+ enableColumnActions: true,
3638
+ enablePinning: true
3639
+ },
3732
3640
  header: 'select',
3733
3641
  id: '__check__',
3734
- size: enableSelectAll ? 90 : 70,
3735
- // widened from 60 to accommodate both the checkbox and the menu button
3642
+ size: 56,
3736
3643
  tableOptions
3737
3644
  })
3738
3645
  };
@@ -3805,6 +3712,7 @@ const MRT_Default_Icons = {
3805
3712
  // ComponentType<SvgIconProps> is the correct type for all MUI SvgIcon components.
3806
3713
 
3807
3714
  const MRT_Localization_EN = {
3715
+ retryLoading: 'Retry',
3808
3716
  language: 'en',
3809
3717
  actions: 'Actions',
3810
3718
  and: 'and',
@@ -4205,7 +4113,7 @@ const getMRT_RowSpacerColumnDef = tableOptions => {
4205
4113
  size: 0,
4206
4114
  tableOptions
4207
4115
  }),
4208
- grow: true,
4116
+ grow: !(tableOptions.positionActionsColumn === 'last' && showRowActionsColumn(tableOptions)),
4209
4117
  ...MRT_DefaultDisplayColumn,
4210
4118
  muiTableBodyCellProps: blankColProps,
4211
4119
  muiTableFooterCellProps: blankColProps,
@@ -4471,6 +4379,8 @@ const useMRT_TableInstance = definedTableOptions => {
4471
4379
  const tableRef = react.useRef(null);
4472
4380
  const isResizingRef = react.useRef(false);
4473
4381
  const resizeIndicatorRef = react.useRef(null);
4382
+ const autoSizeColumnIdsRef = react.useRef(new Set());
4383
+ const autoSizedColumnWidthsRef = react.useRef({});
4474
4384
 
4475
4385
  //transform initial state with proper column order
4476
4386
  const initialState = react.useMemo(() => {
@@ -4484,12 +4394,6 @@ const useMRT_TableInstance = definedTableOptions => {
4484
4394
  }
4485
4395
  };
4486
4396
  initState.columnOrder = normalizeRowExpandColumnOrder(mergedOptionsSnapshot, initState.columnOrder ?? getDefaultColumnOrderIds(mergedOptionsSnapshot));
4487
-
4488
- // Ensure the checkbox column is always the leftmost sticky column when
4489
- // row selection is enabled, regardless of what the user pinned initially.
4490
- // The checkbox is pinned for positioning only — visual styles are overridden
4491
- // in style.utils.ts so it looks like a regular center column.
4492
- initState.columnPinning = getDefaultColumnPinningState(mergedOptionsSnapshot, initState.columnPinning ?? {});
4493
4397
  initState.showAdvancedFilters = initState.showAdvancedFilters ?? false;
4494
4398
  // getInitialState() on a custom TanStack feature only receives the
4495
4399
  // accumulated initialState object, not the full table options — so the
@@ -4535,23 +4439,12 @@ const useMRT_TableInstance = definedTableOptions => {
4535
4439
  ...definedTableOptions.state
4536
4440
  };
4537
4441
 
4538
- // Normalize controlled columnPinning state: if the user passes state.columnPinning
4539
- // directly (controlled mode), we still need to ensure that the checkbox column
4540
- // is always at the front of the start-pinned group, just like we do for initialState.
4541
- const assembledColumnPinning = definedTableOptions.state.columnPinning;
4542
- if (assembledColumnPinning && !!definedTableOptions.enableRowSelection) {
4543
- definedTableOptions.state = {
4544
- ...definedTableOptions.state,
4545
- columnPinning: getDefaultColumnPinningState(definedTableOptions, assembledColumnPinning)
4546
- };
4547
- }
4548
-
4549
4442
  //The table options now include all state needed to help determine column visibility and order logic
4550
4443
  const statefulTableOptions = definedTableOptions;
4551
4444
 
4552
4445
  // Keep mrt-row-expand locked to its slot (right after the checkbox, or
4553
4446
  // first if there's no checkbox) regardless of what columnOrder the
4554
- // consumer passes in — same enforcement model as columnPinning above.
4447
+ // consumer passes in.
4555
4448
  statefulTableOptions.state = {
4556
4449
  ...statefulTableOptions.state,
4557
4450
  columnOrder: normalizeRowExpandColumnOrder(statefulTableOptions, statefulTableOptions.state.columnOrder)
@@ -4563,6 +4456,12 @@ const useMRT_TableInstance = definedTableOptions => {
4563
4456
  //recompute (and recreate every cell of every row) on unrelated renders
4564
4457
  //like hover, menu open/close, or density toggle
4565
4458
  const rawColumns = statefulTableOptions.columns;
4459
+ // Snapshot of "no explicit size" must be taken here, on the raw user-authored
4460
+ // columns — prepareColumns/constructColumn below backfill MRT_DefaultColumn.size
4461
+ // into columnDef.size for any column that didn't provide one, after which the
4462
+ // distinction MRT_AutoSizeColumnsEffect needs is gone. Memoized on rawColumns so
4463
+ // it's recomputed only when the column array itself actually changes.
4464
+ autoSizeColumnIdsRef.current = react.useMemo(() => getAutoSizeCandidateColumnIds(rawColumns), [rawColumns]);
4566
4465
  const {
4567
4466
  defaultDisplayColumn,
4568
4467
  displayColumnDefOptions,
@@ -4660,6 +4559,8 @@ const useMRT_TableInstance = definedTableOptions => {
4660
4559
  table.refs = {
4661
4560
  actionCellRef,
4662
4561
  allSelectableRowIdsRef,
4562
+ autoSizeColumnIdsRef,
4563
+ autoSizedColumnWidthsRef,
4663
4564
  bottomToolbarRef,
4664
4565
  editInputRefs,
4665
4566
  isResizingRef,
@@ -4704,7 +4605,7 @@ const useMRT_TableInstance = definedTableOptions => {
4704
4605
  // setRowsState updater in tableCrudFns.ts), not at memo-creation time — so
4705
4606
  // this memo doesn't need pagination as a dependency at all, keeping it
4706
4607
  // stable across pagination changes instead of rebuilding every page turn.
4707
- const getPageSize = react.useCallback(() => table.store.state.pagination.pageSize, [table]);
4608
+ const getPageSize = react.useCallback(() => table.options.enablePagination ? table.store.state.pagination.pageSize : undefined, [table]);
4708
4609
  const crudHandlers = react.useMemo(() => {
4709
4610
  const context = {
4710
4611
  getRowId: resolveRowId,
@@ -4848,6 +4749,41 @@ const useMRT_Rows = table => {
4848
4749
  return rows;
4849
4750
  };
4850
4751
 
4752
+ /** Shared by row rendering, virtualization, and initial server batch sizing. */
4753
+ const getDefaultRowHeight = density => density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
4754
+ const getViewportRowCount = ({
4755
+ containerHeight,
4756
+ headerHeight = 0,
4757
+ footerHeight = 0,
4758
+ density,
4759
+ estimatedRowHeight
4760
+ }) => {
4761
+ if (!Number.isFinite(containerHeight) || containerHeight <= 0) return undefined;
4762
+ const rowHeight = estimatedRowHeight && Number.isFinite(estimatedRowHeight) && estimatedRowHeight > 0 ? estimatedRowHeight : getDefaultRowHeight(density);
4763
+ return Math.max(1, Math.ceil(Math.max(0, containerHeight - headerHeight - footerHeight) / rowHeight));
4764
+ };
4765
+
4766
+ /** Ghost placeholders and detail panels must not stand in for real data rows. */
4767
+ const measureBodyRowHeight = tableElement => {
4768
+ let height = Infinity;
4769
+ tableElement?.querySelectorAll('tbody tr[data-testid^="body-row-"]').forEach(row => {
4770
+ const measured = row.getBoundingClientRect().height;
4771
+ if (Number.isFinite(measured) && measured > 0) height = Math.min(height, measured);
4772
+ });
4773
+ // With variable-height content the shortest rendered row is the safe estimate:
4774
+ // taller rows consume more space, so this still fetches enough for one view.
4775
+ return height === Infinity ? undefined : height;
4776
+ };
4777
+
4778
+ /** Identical density spacing for the real table and its loading skeleton. */
4779
+ const getDensityStyles = density => ({
4780
+ '--mrt-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '1rem' : '1.5rem',
4781
+ '--mrt-display-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '0.5rem 0.75rem' : '1rem 1.25rem',
4782
+ '--mrt-head-display-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '0.75rem' : '1rem 1.25rem',
4783
+ '--mrt-head-cell-pb': density === 'compact' ? '0.1rem' : '0.6rem',
4784
+ '--mrt-head-cell-pt': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '.75rem' : '1.25rem'
4785
+ });
4786
+
4851
4787
  const useMRT_RowVirtualizer = (table, rows) => {
4852
4788
  const {
4853
4789
  getRowModel,
@@ -4885,7 +4821,7 @@ const useMRT_RowVirtualizer = (table, rows) => {
4885
4821
  //matches the defaultRowHeight assumption in MRT_TableBodyRow so the
4886
4822
  //initial estimate (before measureElement corrects it for dynamic content)
4887
4823
  //doesn't cause scroll-position drift
4888
- const normalRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
4824
+ const normalRowHeight = getDefaultRowHeight(density);
4889
4825
  const rangeExtractor = react.useCallback(range => extraIndexRangeExtractor(range, draggingRowIndex), [draggingRowIndex]);
4890
4826
 
4891
4827
  // enableRowVirtualization can't change after mount (frozen in
@@ -5189,7 +5125,7 @@ const MRT_ActiveFilterItemContainer = t0 => {
5189
5125
  if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
5190
5126
  t6 = {
5191
5127
  alignItems: "center",
5192
- border: _temp$u,
5128
+ border: _temp$v,
5193
5129
  borderRadius: 1,
5194
5130
  display: "flex",
5195
5131
  gap: 0.5
@@ -5314,7 +5250,7 @@ const MRT_ActiveFilterItemContainer = t0 => {
5314
5250
  return t17;
5315
5251
  };
5316
5252
  var MRT_ActiveFilterItemContainer$1 = MRT_ActiveFilterItemContainer;
5317
- function _temp$u(theme) {
5253
+ function _temp$v(theme) {
5318
5254
  return `1px dashed ${theme.palette.divider}`;
5319
5255
  }
5320
5256
 
@@ -5329,8 +5265,8 @@ const BooleanActiveFilterItem = (table, rule) => {
5329
5265
  var BooleanActiveFilterItem$1 = BooleanActiveFilterItem;
5330
5266
 
5331
5267
  // Free-text multi-value editor — lets the user type and tag arbitrary values.
5332
- // Used for 'inArray' on string and number columns, mirroring MUI's isAnyOf behaviour.
5333
- // The user presses Enter or comma to add each entry; the result is stored as an array.
5268
+ // Used for 'isAnyOf' on string and number columns.
5269
+ // Enter and blur both add the typed entry; the result is stored as an array.
5334
5270
  const MRT_FreeMultiValueEditor = t0 => {
5335
5271
  const $ = compilerRuntime.c(9);
5336
5272
  const {
@@ -5370,13 +5306,14 @@ const MRT_FreeMultiValueEditor = t0 => {
5370
5306
  let t4;
5371
5307
  if ($[6] !== displayValues || $[7] !== handleChange) {
5372
5308
  t4 = /*#__PURE__*/jsxRuntime.jsx(Autocomplete, {
5309
+ autoSelect: true,
5373
5310
  freeSolo: true,
5374
5311
  multiple: true,
5375
5312
  options: t3,
5376
5313
  value: displayValues,
5377
5314
  onChange: handleChange,
5378
5315
  size: "small",
5379
- renderTags: _temp$t,
5316
+ renderTags: _temp$u,
5380
5317
  renderInput: _temp2$a
5381
5318
  });
5382
5319
  $[6] = displayValues;
@@ -5387,7 +5324,7 @@ const MRT_FreeMultiValueEditor = t0 => {
5387
5324
  }
5388
5325
  return t4;
5389
5326
  };
5390
- function _temp$t(value, getTagProps) {
5327
+ function _temp$u(value, getTagProps) {
5391
5328
  return value.map((option, index) => {
5392
5329
  const {
5393
5330
  key,
@@ -5468,7 +5405,7 @@ const MRT_MultiValueEditor = t0 => {
5468
5405
  }
5469
5406
  let t5;
5470
5407
  if ($[8] !== options) {
5471
- t5 = options.map(_temp$s);
5408
+ t5 = options.map(_temp$t);
5472
5409
  $[8] = options;
5473
5410
  $[9] = t5;
5474
5411
  } else {
@@ -5498,7 +5435,7 @@ const MRT_MultiValueEditor = t0 => {
5498
5435
  }
5499
5436
  return t6;
5500
5437
  };
5501
- function _temp$s(option) {
5438
+ function _temp$t(option) {
5502
5439
  const {
5503
5440
  label,
5504
5441
  value
@@ -5865,7 +5802,7 @@ const MRT_SingleValueEditor = t0 => {
5865
5802
  const t6 = options?.length ? undefined : inputType;
5866
5803
  let t7;
5867
5804
  if ($[9] !== options) {
5868
- t7 = options?.map(_temp$r);
5805
+ t7 = options?.map(_temp$s);
5869
5806
  $[9] = options;
5870
5807
  $[10] = t7;
5871
5808
  } else {
@@ -5899,7 +5836,7 @@ const MRT_SingleValueEditor = t0 => {
5899
5836
  }
5900
5837
  return t8;
5901
5838
  };
5902
- function _temp$r(option) {
5839
+ function _temp$s(option) {
5903
5840
  const {
5904
5841
  label,
5905
5842
  value
@@ -6133,7 +6070,7 @@ const MRT_FilterRuleNumberEditor = props => {
6133
6070
  t0 = /*#__PURE__*/jsxRuntime.jsx(MRT_SingleValueEditor, {
6134
6071
  ...props,
6135
6072
  inputType: "number",
6136
- transformValue: _temp$q,
6073
+ transformValue: _temp$r,
6137
6074
  valueFormatter: _temp2$9
6138
6075
  });
6139
6076
  $[0] = props;
@@ -6183,8 +6120,8 @@ const MRT_FilterRuleBooleanEditor = props => {
6183
6120
  t3 = /*#__PURE__*/jsxRuntime.jsx(MRT_SingleValueEditor, {
6184
6121
  ...props,
6185
6122
  options: t2,
6186
- transformValue: _temp3$5,
6187
- valueFormatter: _temp4$2
6123
+ transformValue: _temp3$4,
6124
+ valueFormatter: _temp4$1
6188
6125
  });
6189
6126
  $[7] = props;
6190
6127
  $[8] = t2;
@@ -6376,16 +6313,16 @@ const MRT_FilterRuleMultiNumberEditor = props => {
6376
6313
  }
6377
6314
  return t0;
6378
6315
  };
6379
- function _temp$q(value) {
6316
+ function _temp$r(value) {
6380
6317
  return value === "" ? "" : Number(value);
6381
6318
  }
6382
6319
  function _temp2$9(value_0) {
6383
6320
  return value_0 === undefined || value_0 === null || value_0 === "" ? "" : String(value_0);
6384
6321
  }
6385
- function _temp3$5(value) {
6322
+ function _temp3$4(value) {
6386
6323
  return value === "true" ? true : value === "false" ? false : "";
6387
6324
  }
6388
- function _temp4$2(value_0) {
6325
+ function _temp4$1(value_0) {
6389
6326
  return value_0 === true ? "true" : value_0 === false ? "false" : "";
6390
6327
  }
6391
6328
  function _temp5$1(n) {
@@ -7213,7 +7150,7 @@ const MRT_FormEnumInput = t0 => {
7213
7150
  onChange: e => handleChange(e.target.value),
7214
7151
  renderValue: renderSelectedValue,
7215
7152
  value: currentValue,
7216
- children: enumOptions.map(_temp$p)
7153
+ children: enumOptions.map(_temp$q)
7217
7154
  }), (fieldState.error?.message || fieldConfig?.helperText) && /*#__PURE__*/jsxRuntime.jsx(FormHelperText, {
7218
7155
  children: fieldState.error?.message ?? fieldConfig?.helperText
7219
7156
  })]
@@ -7245,7 +7182,7 @@ const MRT_FormEnumInput = t0 => {
7245
7182
  }
7246
7183
  return t4;
7247
7184
  };
7248
- function _temp$p(option_0) {
7185
+ function _temp$q(option_0) {
7249
7186
  return /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
7250
7187
  value: option_0.value,
7251
7188
  children: option_0.label
@@ -8376,7 +8313,8 @@ const NumberColumnResolver = {
8376
8313
  id: 'isAnyOf',
8377
8314
  isValueEmpty: value => !Array.isArray(value) || value.length === 0,
8378
8315
  label: 'Is Any Of',
8379
- triggerMode: 'commit',
8316
+ // The editor reports changes when a chip is added or removed.
8317
+ triggerMode: 'change',
8380
8318
  valueShape: 'multi'
8381
8319
  }],
8382
8320
  getFormFieldRenderer: (column, _table) => {
@@ -8560,7 +8498,8 @@ const StringColumnResolver = {
8560
8498
  id: 'isAnyOf',
8561
8499
  isValueEmpty: value => !Array.isArray(value) || value.length === 0,
8562
8500
  label: 'Is Any Of',
8563
- triggerMode: 'commit',
8501
+ // The editor reports changes when a chip is added or removed.
8502
+ triggerMode: 'change',
8564
8503
  valueShape: 'multi'
8565
8504
  }],
8566
8505
  getFormFieldRenderer: (column, _table) => {
@@ -9479,7 +9418,7 @@ const useMRT_AdvancedFiltersDraft = table => {
9479
9418
  if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
9480
9419
  t7 = () => {
9481
9420
  isDraftDirty.current = false;
9482
- setDraftFilters(_temp$o);
9421
+ setDraftFilters(_temp$p);
9483
9422
  };
9484
9423
  $[13] = t7;
9485
9424
  } else {
@@ -9667,7 +9606,7 @@ const useMRT_AdvancedFiltersDraft = table => {
9667
9606
  }
9668
9607
  return t17;
9669
9608
  };
9670
- function _temp$o(current_0) {
9609
+ function _temp$p(current_0) {
9671
9610
  return {
9672
9611
  ...getDefaultFiltersState(),
9673
9612
  pinnedFilters: current_0.pinnedFilters
@@ -9728,7 +9667,7 @@ const MRT_AdvancedFiltersContent = t0 => {
9728
9667
  if ($[2] !== clearRules || $[3] !== handleClose || $[4] !== setFilters) {
9729
9668
  t4 = () => {
9730
9669
  clearRules();
9731
- setFilters(_temp$n);
9670
+ setFilters(_temp$o);
9732
9671
  handleClose();
9733
9672
  };
9734
9673
  $[2] = clearRules;
@@ -9938,7 +9877,7 @@ const MRT_AdvancedFiltersContent = t0 => {
9938
9877
  display: "flex",
9939
9878
  justifyContent: "center",
9940
9879
  sx: {
9941
- border: _temp3$4,
9880
+ border: _temp3$3,
9942
9881
  borderRadius: 2,
9943
9882
  flex: 1,
9944
9883
  minHeight: 140,
@@ -10136,7 +10075,7 @@ const MRT_AdvancedFilters = t0 => {
10136
10075
  }
10137
10076
  return t1;
10138
10077
  };
10139
- function _temp$n(current) {
10078
+ function _temp$o(current) {
10140
10079
  return {
10141
10080
  ...getDefaultFiltersState(),
10142
10081
  pinnedFilters: current.pinnedFilters
@@ -10145,11 +10084,12 @@ function _temp$n(current) {
10145
10084
  function _temp2$8(theme) {
10146
10085
  return theme.zIndex.drawer + 1;
10147
10086
  }
10148
- function _temp3$4(theme_0) {
10087
+ function _temp3$3(theme_0) {
10149
10088
  return `1px dashed ${theme_0.palette.divider}`;
10150
10089
  }
10151
10090
 
10152
10091
  const MRT_Localization_HR = {
10092
+ retryLoading: 'Pokušaj ponovo',
10153
10093
  language: 'hr',
10154
10094
  actions: 'Radnje',
10155
10095
  and: 'i',
@@ -10348,7 +10288,7 @@ const MaterialReactServerTableError = t0 => {
10348
10288
  let t3;
10349
10289
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
10350
10290
  t3 = /*#__PURE__*/jsxRuntime.jsx(Box, {
10351
- sx: _temp$m,
10291
+ sx: _temp$n,
10352
10292
  children: /*#__PURE__*/jsxRuntime.jsx(ErrorOutlineRoundedIcon, {
10353
10293
  sx: {
10354
10294
  fontSize: "2.25rem"
@@ -10424,7 +10364,7 @@ const MaterialReactServerTableError = t0 => {
10424
10364
  }
10425
10365
  return t10;
10426
10366
  };
10427
- function _temp$m(theme) {
10367
+ function _temp$n(theme) {
10428
10368
  return {
10429
10369
  alignItems: "center",
10430
10370
  backgroundColor: theme.palette.error.main + "14",
@@ -10437,6 +10377,194 @@ function _temp$m(theme) {
10437
10377
  };
10438
10378
  }
10439
10379
 
10380
+ const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
10381
+
10382
+ /** Choose the smallest offered page size that covers the viewport. */
10383
+ const getInfinitePageSize = (visibleRowCount, options = defaultRowsPerPage, fallback = 10) => {
10384
+ if (visibleRowCount === undefined) return fallback;
10385
+ 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);
10386
+ return sizes.find(size => size >= visibleRowCount) ?? sizes.at(-1) ?? fallback;
10387
+ };
10388
+
10389
+ /** Owns request sequencing; the table remains the sole owner of loaded rows. */
10390
+ const useMRT_ServerDataLoader = ({
10391
+ table,
10392
+ loadData,
10393
+ paginationMode,
10394
+ fetchTrigger,
10395
+ onResult,
10396
+ onLoadingChange,
10397
+ onLoaded
10398
+ }) => {
10399
+ const measuredRowHeights = react.useRef({});
10400
+ const [error, setError] = react.useState(false);
10401
+ const [revision, setRevision] = react.useState(0);
10402
+ const latest = react.useRef({
10403
+ table,
10404
+ loadData,
10405
+ onResult,
10406
+ onLoadingChange,
10407
+ onLoaded
10408
+ });
10409
+ latest.current = {
10410
+ table,
10411
+ loadData,
10412
+ onResult,
10413
+ onLoadingChange,
10414
+ onLoaded
10415
+ };
10416
+ const request = react.useRef({
10417
+ generation: 0,
10418
+ pending: false,
10419
+ nextPage: 0,
10420
+ ready: false,
10421
+ hasMore: true,
10422
+ failed: false
10423
+ });
10424
+ const infinite = paginationMode === 'infinite';
10425
+ const {
10426
+ pageIndex,
10427
+ pageSize
10428
+ } = fetchTrigger.pagination;
10429
+ const fetchPage = react.useCallback(async () => {
10430
+ const current = request.current;
10431
+ if (!current.ready || current.pending || !current.hasMore) return;
10432
+ current.pending = true;
10433
+ current.failed = false;
10434
+ setError(false);
10435
+ latest.current.onLoadingChange(true);
10436
+ const generation = current.generation;
10437
+ const page = current.nextPage;
10438
+ const snapshot = latest.current.table.getState();
10439
+ try {
10440
+ const result = await latest.current.loadData({
10441
+ ...snapshot,
10442
+ pagination: {
10443
+ pageIndex: page,
10444
+ pageSize: snapshot.pagination.pageSize
10445
+ }
10446
+ });
10447
+ if (request.current.generation !== generation) return;
10448
+ const target = latest.current.table;
10449
+ const previous = infinite && page > 0 ? target.options.data ?? [] : [];
10450
+ // Keep order stable while replacing duplicate IDs with the latest data.
10451
+ const rows = new Map(previous.map(row => [row.id, row]));
10452
+ result.data.forEach(row_0 => rows.set(row_0.id, row_0));
10453
+ target.setRows(infinite ? Array.from(rows.values()) : result.data);
10454
+ current.nextPage = page + 1;
10455
+ current.hasMore = infinite && result.data.length > 0 && (page === 0 || rows.size > previous.length) && (result.hasNextPage ?? rows.size < result.rowCount);
10456
+ latest.current.onResult(result);
10457
+ latest.current.onLoaded();
10458
+ } catch {
10459
+ if (request.current.generation !== generation) return;
10460
+ current.failed = true;
10461
+ setError(true);
10462
+ } finally {
10463
+ if (request.current.generation === generation) {
10464
+ current.pending = false;
10465
+ latest.current.onLoadingChange(false);
10466
+ setRevision(value => value + 1);
10467
+ }
10468
+ }
10469
+ }, [infinite]);
10470
+
10471
+ // A different viewport/density can choose a different offered size. Restart
10472
+ // at page zero in that case so pageIndex * pageSize stays valid.
10473
+ const syncPageSize = react.useCallback(() => {
10474
+ if (!infinite) return false;
10475
+ const target_0 = latest.current.table;
10476
+ const currentSize = target_0.getState().pagination.pageSize;
10477
+ const density = target_0.getState().density;
10478
+ const measuredHeight = target_0.getState().showSkeletons !== true && target_0.options.data?.length ? measureBodyRowHeight(target_0.refs.tableRef.current) : undefined;
10479
+ if (measuredHeight !== undefined) measuredRowHeights.current[density] = measuredHeight;
10480
+ const virtualizerOptions = parseFromValuesOrFunc(target_0.options.rowVirtualizerOptions, {
10481
+ table: target_0
10482
+ });
10483
+ const paginationProps = parseFromValuesOrFunc(target_0.options.muiPaginationProps, {
10484
+ table: target_0
10485
+ });
10486
+ const size = getInfinitePageSize(getViewportRowCount({
10487
+ containerHeight: target_0.refs.tableContainerRef.current?.clientHeight ?? 0,
10488
+ headerHeight: target_0.refs.tableHeadRef.current?.offsetHeight ?? 0,
10489
+ footerHeight: target_0.refs.tableFooterRef.current?.offsetHeight ?? 0,
10490
+ density,
10491
+ estimatedRowHeight: measuredRowHeights.current[density] ?? virtualizerOptions?.estimateSize?.(0)
10492
+ }), paginationProps?.rowsPerPageOptions, currentSize);
10493
+ if (size === currentSize) return false;
10494
+ request.current.ready = false;
10495
+ request.current.generation += 1;
10496
+ target_0.setPagination({
10497
+ pageIndex: 0,
10498
+ pageSize: size
10499
+ });
10500
+ return true;
10501
+ }, [infinite]);
10502
+ const density_0 = table.getState().density;
10503
+ react.useEffect(() => {
10504
+ syncPageSize();
10505
+ }, [density_0, syncPageSize]);
10506
+
10507
+ // Query changes invalidate all older requests, including their finally blocks.
10508
+ const visiblePage = infinite ? 0 : pageIndex;
10509
+ react.useEffect(() => {
10510
+ const target_1 = latest.current.table;
10511
+ if (syncPageSize()) return;
10512
+ request.current = {
10513
+ generation: request.current.generation + 1,
10514
+ pending: false,
10515
+ nextPage: visiblePage,
10516
+ ready: true,
10517
+ hasMore: true,
10518
+ failed: false
10519
+ };
10520
+ if (infinite) {
10521
+ target_1.setRows([]);
10522
+ if (target_1.getState().pagination.pageIndex !== 0) target_1.setPageIndex(0);
10523
+ const node = target_1.refs.tableContainerRef.current;
10524
+ if (node) node.scrollTop = 0;
10525
+ target_1.options.rowVirtualizerInstanceRef?.current?.scrollToIndex(0);
10526
+ }
10527
+ void fetchPage();
10528
+ return () => {
10529
+ request.current.generation += 1;
10530
+ };
10531
+ }, [fetchPage, syncPageSize, loadData, infinite, visiblePage, pageSize, fetchTrigger.filterRules, fetchTrigger.sorting, fetchTrigger.columnVisibilityShowTrigger, fetchTrigger.refetchIndex]);
10532
+ const loadMore = react.useCallback(() => {
10533
+ if (infinite && !request.current.failed) void fetchPage();
10534
+ }, [fetchPage, infinite]);
10535
+ const checkScroll = react.useCallback(node_0 => {
10536
+ if (node_0 && node_0.clientHeight > 0 && node_0.scrollHeight - node_0.scrollTop - node_0.clientHeight < 200) loadMore();
10537
+ }, [loadMore]);
10538
+ react.useEffect(() => {
10539
+ if (!infinite) return;
10540
+ const node_1 = latest.current.table.refs.tableContainerRef.current;
10541
+ const observer = new ResizeObserver(() => {
10542
+ if (!syncPageSize() && node_1 && node_1.scrollHeight <= node_1.clientHeight) checkScroll(node_1);
10543
+ });
10544
+ if (node_1) observer.observe(node_1);
10545
+ const target_2 = latest.current.table;
10546
+ // The same observer also catches content/font/density changes without
10547
+ // adding an observer per row. A new body is attached after each data update.
10548
+ const body = target_2.refs.tableRef.current?.querySelector('tbody');
10549
+ if (body) observer.observe(body);
10550
+ if (target_2.refs.tableHeadRef.current) observer.observe(target_2.refs.tableHeadRef.current);
10551
+ if (target_2.refs.tableFooterRef.current) observer.observe(target_2.refs.tableFooterRef.current);
10552
+ return () => observer.disconnect();
10553
+ }, [checkScroll, infinite, syncPageSize, revision]);
10554
+ react.useEffect(() => {
10555
+ if (!infinite) return;
10556
+ const node_2 = latest.current.table.refs.tableContainerRef.current;
10557
+ // Correct the density estimate once real row heights become measurable.
10558
+ // Cached heights survive setRows([]), preventing estimate/measurement loops.
10559
+ if (!syncPageSize() && node_2 && node_2.scrollHeight <= node_2.clientHeight) checkScroll(node_2);
10560
+ }, [checkScroll, infinite, syncPageSize, revision]);
10561
+ return {
10562
+ error,
10563
+ checkScroll,
10564
+ retry: fetchPage
10565
+ };
10566
+ };
10567
+
10440
10568
  function RowActionsCell(t0) {
10441
10569
  const $ = compilerRuntime.c(6);
10442
10570
  const {
@@ -10622,7 +10750,7 @@ const MRT_ActiveFilters = t0 => {
10622
10750
  let t3;
10623
10751
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
10624
10752
  t3 = {
10625
- borderBottom: _temp$l
10753
+ borderBottom: _temp$m
10626
10754
  };
10627
10755
  $[4] = t3;
10628
10756
  } else {
@@ -10661,7 +10789,7 @@ const MRT_ActiveFilters = t0 => {
10661
10789
  }
10662
10790
  return t1;
10663
10791
  };
10664
- function _temp$l(theme) {
10792
+ function _temp$m(theme) {
10665
10793
  return `1px solid ${theme.palette.divider}`;
10666
10794
  }
10667
10795
 
@@ -10703,7 +10831,7 @@ const MRT_LinearProgressBar = t0 => {
10703
10831
  const {
10704
10832
  isSaving
10705
10833
  } = t2;
10706
- const showProgressBars = reactStore.useSelector(table.store, _temp$k);
10834
+ const showProgressBars = reactStore.useSelector(table.store, _temp$l);
10707
10835
  let t3;
10708
10836
  if ($[6] !== isTopToolbar || $[7] !== muiLinearProgressProps || $[8] !== table) {
10709
10837
  t3 = parseFromValuesOrFunc(muiLinearProgressProps, {
@@ -10787,7 +10915,7 @@ const MRT_LinearProgressBar = t0 => {
10787
10915
  }
10788
10916
  return t11;
10789
10917
  };
10790
- function _temp$k(state) {
10918
+ function _temp$l(state) {
10791
10919
  return state.showProgressBars;
10792
10920
  }
10793
10921
 
@@ -10840,7 +10968,7 @@ const MRT_SelectionCountBadge = t0 => {
10840
10968
  let t3;
10841
10969
  if ($[2] !== t2 || $[3] !== table.atoms.rowSelection) {
10842
10970
  t3 = /*#__PURE__*/jsxRuntime.jsx(reactTable.Subscribe, {
10843
- selector: _temp$j,
10971
+ selector: _temp$k,
10844
10972
  source: table.atoms.rowSelection,
10845
10973
  children: t2
10846
10974
  });
@@ -10852,11 +10980,10 @@ const MRT_SelectionCountBadge = t0 => {
10852
10980
  }
10853
10981
  return t3;
10854
10982
  };
10855
- function _temp$j(rowSelection) {
10983
+ function _temp$k(rowSelection) {
10856
10984
  return Object.values(rowSelection).filter(Boolean).length;
10857
10985
  }
10858
10986
 
10859
- const defaultRowsPerPage = [5, 10, 15, 20, 25, 30, 50, 100];
10860
10987
  const isPaginationItemColor = color => color === 'primary' || color === 'secondary' || color === 'standard';
10861
10988
  const MRT_TablePagination = ({
10862
10989
  position = 'bottom',
@@ -11138,7 +11265,7 @@ const MRT_ToolbarDropZone = t0 => {
11138
11265
  showToolbarDropZone,
11139
11266
  draggingColumn,
11140
11267
  hoveredColumn
11141
- } = reactStore.useSelector(table.store, _temp$i);
11268
+ } = reactStore.useSelector(table.store, _temp$j);
11142
11269
  let t3;
11143
11270
  if ($[5] !== setHoveredColumn) {
11144
11271
  t3 = _event => {
@@ -11254,7 +11381,7 @@ const MRT_ToolbarDropZone = t0 => {
11254
11381
  }
11255
11382
  return t10;
11256
11383
  };
11257
- function _temp$i(state) {
11384
+ function _temp$j(state) {
11258
11385
  return {
11259
11386
  showToolbarDropZone: state.showToolbarDropZone,
11260
11387
  draggingColumn: state.draggingColumn,
@@ -11417,7 +11544,7 @@ const MRT_BottomToolbar = ({
11417
11544
 
11418
11545
  // Renders a single pinned quick filter: label strip with unpin button + the operator's editor.
11419
11546
  const MRT_QuickFilterItem = t0 => {
11420
- const $ = compilerRuntime.c(52);
11547
+ const $ = compilerRuntime.c(60);
11421
11548
  const {
11422
11549
  column,
11423
11550
  operator,
@@ -11541,111 +11668,140 @@ const MRT_QuickFilterItem = t0 => {
11541
11668
  }
11542
11669
  const handleUnpin = t9;
11543
11670
  const columnLabel = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
11544
- const T0 = Box;
11545
11671
  let t10;
11546
- let t11;
11547
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
11548
- t10 = () => setIsHovered(true);
11549
- t11 = () => setIsHovered(false);
11550
- $[19] = t10;
11551
- $[20] = t11;
11552
- } else {
11553
- t10 = $[19];
11554
- t11 = $[20];
11555
- }
11556
- let t12;
11557
- if ($[21] !== commitValue || $[22] !== isTriggerModeCommit || $[23] !== localValue) {
11558
- t12 = isTriggerModeCommit ? event => {
11559
- if (event.key === "Enter") {
11672
+ if ($[19] !== commitValue || $[20] !== localValue || $[21] !== operator || $[22] !== rule?.value) {
11673
+ t10 = () => {
11674
+ const committedValue_0 = rule?.value ?? operator.getInitialValue();
11675
+ if (!Object.is(localValue, committedValue_0)) {
11560
11676
  commitValue(localValue);
11561
11677
  }
11562
- } : undefined;
11563
- $[21] = commitValue;
11564
- $[22] = isTriggerModeCommit;
11565
- $[23] = localValue;
11566
- $[24] = t12;
11678
+ };
11679
+ $[19] = commitValue;
11680
+ $[20] = localValue;
11681
+ $[21] = operator;
11682
+ $[22] = rule?.value;
11683
+ $[23] = t10;
11567
11684
  } else {
11568
- t12 = $[24];
11685
+ t10 = $[23];
11569
11686
  }
11570
- let t13;
11571
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
11572
- t13 = {
11687
+ const commitLocalValue = t10;
11688
+ const T0 = Box;
11689
+ let t11;
11690
+ let t12;
11691
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
11692
+ t11 = () => setIsHovered(true);
11693
+ t12 = () => setIsHovered(false);
11694
+ $[24] = t11;
11695
+ $[25] = t12;
11696
+ } else {
11697
+ t11 = $[24];
11698
+ t12 = $[25];
11699
+ }
11700
+ let t13;
11701
+ if ($[26] !== commitLocalValue || $[27] !== isTriggerModeCommit) {
11702
+ t13 = isTriggerModeCommit ? event => {
11703
+ if (event.key === "Enter") {
11704
+ commitLocalValue();
11705
+ }
11706
+ } : undefined;
11707
+ $[26] = commitLocalValue;
11708
+ $[27] = isTriggerModeCommit;
11709
+ $[28] = t13;
11710
+ } else {
11711
+ t13 = $[28];
11712
+ }
11713
+ let t14;
11714
+ if ($[29] !== commitLocalValue || $[30] !== isTriggerModeCommit) {
11715
+ t14 = isTriggerModeCommit ? event_0 => {
11716
+ if (!event_0.currentTarget.contains(event_0.relatedTarget)) {
11717
+ commitLocalValue();
11718
+ }
11719
+ } : undefined;
11720
+ $[29] = commitLocalValue;
11721
+ $[30] = isTriggerModeCommit;
11722
+ $[31] = t14;
11723
+ } else {
11724
+ t14 = $[31];
11725
+ }
11726
+ let t15;
11727
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
11728
+ t15 = {
11573
11729
  display: "flex",
11574
11730
  flexDirection: "column",
11575
11731
  gap: 0.5,
11576
11732
  position: "relative"
11577
11733
  };
11578
- $[25] = t13;
11734
+ $[32] = t15;
11579
11735
  } else {
11580
- t13 = $[25];
11736
+ t15 = $[32];
11581
11737
  }
11582
- let t14;
11583
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
11584
- t14 = {
11738
+ let t16;
11739
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
11740
+ t16 = {
11585
11741
  alignItems: "center",
11586
11742
  display: "flex"
11587
11743
  };
11588
- $[26] = t14;
11744
+ $[33] = t16;
11589
11745
  } else {
11590
- t14 = $[26];
11746
+ t16 = $[33];
11591
11747
  }
11592
- let t15;
11593
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
11594
- t15 = {
11748
+ let t17;
11749
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
11750
+ t17 = {
11595
11751
  color: "text.secondary",
11596
11752
  fontSize: 11,
11597
11753
  fontWeight: 500,
11598
11754
  lineHeight: 1
11599
11755
  };
11600
- $[27] = t15;
11756
+ $[34] = t17;
11601
11757
  } else {
11602
- t15 = $[27];
11758
+ t17 = $[34];
11603
11759
  }
11604
- let t16;
11605
- if ($[28] !== columnLabel) {
11606
- t16 = /*#__PURE__*/jsxRuntime.jsx(Box, {
11760
+ let t18;
11761
+ if ($[35] !== columnLabel) {
11762
+ t18 = /*#__PURE__*/jsxRuntime.jsx(Box, {
11607
11763
  component: "span",
11608
- sx: t15,
11764
+ sx: t17,
11609
11765
  children: columnLabel
11610
11766
  });
11611
- $[28] = columnLabel;
11612
- $[29] = t16;
11767
+ $[35] = columnLabel;
11768
+ $[36] = t18;
11613
11769
  } else {
11614
- t16 = $[29];
11770
+ t18 = $[36];
11615
11771
  }
11616
- let t17;
11617
- if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
11618
- t17 = {
11772
+ let t19;
11773
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
11774
+ t19 = {
11619
11775
  color: "text.disabled",
11620
11776
  fontSize: 11,
11621
11777
  lineHeight: 1
11622
11778
  };
11623
- $[30] = t17;
11779
+ $[37] = t19;
11624
11780
  } else {
11625
- t17 = $[30];
11781
+ t19 = $[37];
11626
11782
  }
11627
- const t18 = `${operatorLabel.toLowerCase()}`;
11628
- let t19;
11629
- if ($[31] !== t18) {
11630
- t19 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
11783
+ const t20 = `${operatorLabel.toLowerCase()}`;
11784
+ let t21;
11785
+ if ($[38] !== t20) {
11786
+ t21 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
11631
11787
  component: "span",
11632
- sx: t17,
11633
- children: ["\xA0", t18]
11788
+ sx: t19,
11789
+ children: ["\xA0", t20]
11634
11790
  });
11635
- $[31] = t18;
11636
- $[32] = t19;
11791
+ $[38] = t20;
11792
+ $[39] = t21;
11637
11793
  } else {
11638
- t19 = $[32];
11794
+ t21 = $[39];
11639
11795
  }
11640
- let t20;
11641
- if ($[33] !== CloseIcon || $[34] !== handleUnpin || $[35] !== isHovered) {
11642
- t20 = isHovered && /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
11796
+ let t22;
11797
+ if ($[40] !== CloseIcon || $[41] !== handleUnpin || $[42] !== isHovered) {
11798
+ t22 = isHovered && /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
11643
11799
  title: "Unpin filter",
11644
11800
  children: /*#__PURE__*/jsxRuntime.jsx(IconButton, {
11645
11801
  onClick: handleUnpin,
11646
11802
  size: "small",
11647
11803
  sx: {
11648
- backgroundColor: _temp$h,
11804
+ backgroundColor: _temp$i,
11649
11805
  color: _temp2$6,
11650
11806
  width: 18,
11651
11807
  height: 18,
@@ -11654,7 +11810,7 @@ const MRT_QuickFilterItem = t0 => {
11654
11810
  top: 8,
11655
11811
  zIndex: 1,
11656
11812
  "&:hover": {
11657
- backgroundColor: _temp3$3
11813
+ backgroundColor: _temp3$2
11658
11814
  }
11659
11815
  },
11660
11816
  children: /*#__PURE__*/jsxRuntime.jsx(CloseIcon, {
@@ -11664,66 +11820,68 @@ const MRT_QuickFilterItem = t0 => {
11664
11820
  })
11665
11821
  })
11666
11822
  });
11667
- $[33] = CloseIcon;
11668
- $[34] = handleUnpin;
11669
- $[35] = isHovered;
11670
- $[36] = t20;
11823
+ $[40] = CloseIcon;
11824
+ $[41] = handleUnpin;
11825
+ $[42] = isHovered;
11826
+ $[43] = t22;
11671
11827
  } else {
11672
- t20 = $[36];
11828
+ t22 = $[43];
11673
11829
  }
11674
- let t21;
11675
- if ($[37] !== t16 || $[38] !== t19 || $[39] !== t20) {
11676
- t21 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
11830
+ let t23;
11831
+ if ($[44] !== t18 || $[45] !== t21 || $[46] !== t22) {
11832
+ t23 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
11677
11833
  "data-testid": "quick-filter",
11678
- sx: t14,
11679
- children: [t16, t19, t20]
11834
+ sx: t16,
11835
+ children: [t18, t21, t22]
11680
11836
  });
11681
- $[37] = t16;
11682
- $[38] = t19;
11683
- $[39] = t20;
11684
- $[40] = t21;
11837
+ $[44] = t18;
11838
+ $[45] = t21;
11839
+ $[46] = t22;
11840
+ $[47] = t23;
11685
11841
  } else {
11686
- t21 = $[40];
11842
+ t23 = $[47];
11687
11843
  }
11688
11844
  const T1 = Box;
11689
- const t22 = operator.editComponent({
11845
+ const t24 = operator.editComponent({
11690
11846
  column: column,
11691
11847
  onChange: handleEditorChange,
11692
11848
  rule: editorRule,
11693
11849
  table
11694
11850
  });
11695
- let t23;
11696
- if ($[41] !== T1 || $[42] !== t22) {
11697
- t23 = /*#__PURE__*/jsxRuntime.jsx(T1, {
11698
- children: t22
11851
+ let t25;
11852
+ if ($[48] !== T1 || $[49] !== t24) {
11853
+ t25 = /*#__PURE__*/jsxRuntime.jsx(T1, {
11854
+ children: t24
11699
11855
  });
11700
- $[41] = T1;
11701
- $[42] = t22;
11702
- $[43] = t23;
11856
+ $[48] = T1;
11857
+ $[49] = t24;
11858
+ $[50] = t25;
11703
11859
  } else {
11704
- t23 = $[43];
11860
+ t25 = $[50];
11705
11861
  }
11706
- let t24;
11707
- if ($[44] !== T0 || $[45] !== t10 || $[46] !== t11 || $[47] !== t12 || $[48] !== t13 || $[49] !== t21 || $[50] !== t23) {
11708
- t24 = /*#__PURE__*/jsxRuntime.jsxs(T0, {
11709
- onMouseEnter: t10,
11710
- onMouseLeave: t11,
11711
- onKeyDown: t12,
11712
- sx: t13,
11713
- children: [t21, t23]
11714
- });
11715
- $[44] = T0;
11716
- $[45] = t10;
11717
- $[46] = t11;
11718
- $[47] = t12;
11719
- $[48] = t13;
11720
- $[49] = t21;
11721
- $[50] = t23;
11722
- $[51] = t24;
11862
+ let t26;
11863
+ if ($[51] !== T0 || $[52] !== t11 || $[53] !== t12 || $[54] !== t13 || $[55] !== t14 || $[56] !== t15 || $[57] !== t23 || $[58] !== t25) {
11864
+ t26 = /*#__PURE__*/jsxRuntime.jsxs(T0, {
11865
+ onMouseEnter: t11,
11866
+ onMouseLeave: t12,
11867
+ onKeyDown: t13,
11868
+ onBlur: t14,
11869
+ sx: t15,
11870
+ children: [t23, t25]
11871
+ });
11872
+ $[51] = T0;
11873
+ $[52] = t11;
11874
+ $[53] = t12;
11875
+ $[54] = t13;
11876
+ $[55] = t14;
11877
+ $[56] = t15;
11878
+ $[57] = t23;
11879
+ $[58] = t25;
11880
+ $[59] = t26;
11723
11881
  } else {
11724
- t24 = $[51];
11882
+ t26 = $[59];
11725
11883
  }
11726
- return t24;
11884
+ return t26;
11727
11885
  };
11728
11886
  // Renders a strip of pinned quick filter inputs directly above the table body.
11729
11887
  // Visible only when at least one filter rule is pinned.
@@ -11793,13 +11951,13 @@ const MRT_QuickFiltersBar = t0 => {
11793
11951
  }
11794
11952
  return t1;
11795
11953
  };
11796
- function _temp$h(theme) {
11954
+ function _temp$i(theme) {
11797
11955
  return theme.palette.error.main;
11798
11956
  }
11799
11957
  function _temp2$6(theme_0) {
11800
11958
  return theme_0.palette.background.paper;
11801
11959
  }
11802
- function _temp3$3(theme_1) {
11960
+ function _temp3$2(theme_1) {
11803
11961
  return theme_1.palette.error.dark;
11804
11962
  }
11805
11963
 
@@ -11989,7 +12147,7 @@ function MRT_TableOptionsMenu(t0) {
11989
12147
  anchorEl: anchorEl,
11990
12148
  anchorOrigin: t3,
11991
12149
  disableScrollLock: true,
11992
- onClick: _temp$g,
12150
+ onClick: _temp$h,
11993
12151
  onClose: onClose,
11994
12152
  open: open,
11995
12153
  transformOrigin: t4,
@@ -12007,7 +12165,7 @@ function MRT_TableOptionsMenu(t0) {
12007
12165
  }
12008
12166
  return t8;
12009
12167
  }
12010
- function _temp$g(event) {
12168
+ function _temp$h(event) {
12011
12169
  return event.stopPropagation();
12012
12170
  }
12013
12171
 
@@ -12398,7 +12556,7 @@ const MRT_NewEntryButton = t0 => {
12398
12556
  };
12399
12557
 
12400
12558
  const MRT_ShowHideColumnsMenuItems = t0 => {
12401
- const $ = compilerRuntime.c(42);
12559
+ const $ = compilerRuntime.c(47);
12402
12560
  let allColumns;
12403
12561
  let column;
12404
12562
  let hoveredColumn;
@@ -12471,8 +12629,24 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12471
12629
  return null;
12472
12630
  }
12473
12631
  let t4;
12474
- if ($[10] !== column.depth || $[11] !== column.id || $[12] !== draggingBorderColor || $[13] !== hoveredColumn?.id || $[14] !== rest?.sx) {
12475
- t4 = theme => ({
12632
+ if ($[10] !== column || $[11] !== enableHiding || $[12] !== handleToggleColumnHidden || $[13] !== rest) {
12633
+ t4 = event => {
12634
+ rest?.onClick?.(event);
12635
+ if (enableHiding && column.getCanHide()) {
12636
+ handleToggleColumnHidden(column, column.getIsVisible());
12637
+ }
12638
+ };
12639
+ $[10] = column;
12640
+ $[11] = enableHiding;
12641
+ $[12] = handleToggleColumnHidden;
12642
+ $[13] = rest;
12643
+ $[14] = t4;
12644
+ } else {
12645
+ t4 = $[14];
12646
+ }
12647
+ let t5;
12648
+ if ($[15] !== column.depth || $[16] !== column.id || $[17] !== draggingBorderColor || $[18] !== hoveredColumn?.id || $[19] !== rest?.sx) {
12649
+ t5 = theme => ({
12476
12650
  alignItems: "center",
12477
12651
  justifyContent: "flex-start",
12478
12652
  my: 0,
@@ -12482,30 +12656,31 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12482
12656
  py: "6px",
12483
12657
  ...parseFromValuesOrFunc(rest?.sx, theme)
12484
12658
  });
12485
- $[10] = column.depth;
12486
- $[11] = column.id;
12487
- $[12] = draggingBorderColor;
12488
- $[13] = hoveredColumn?.id;
12489
- $[14] = rest?.sx;
12490
- $[15] = t4;
12659
+ $[15] = column.depth;
12660
+ $[16] = column.id;
12661
+ $[17] = draggingBorderColor;
12662
+ $[18] = hoveredColumn?.id;
12663
+ $[19] = rest?.sx;
12664
+ $[20] = t5;
12491
12665
  } else {
12492
- t4 = $[15];
12666
+ t5 = $[20];
12493
12667
  }
12494
- const t5 = `column-show-hide-row-${column.id}`;
12495
- let t6;
12496
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
12497
- t6 = {
12668
+ const t6 = `column-show-hide-row-${column.id}`;
12669
+ let t7;
12670
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
12671
+ t7 = {
12498
12672
  display: "flex",
12499
12673
  flexWrap: "nowrap",
12500
- gap: "8px"
12674
+ gap: "8px",
12675
+ width: "100%"
12501
12676
  };
12502
- $[16] = t6;
12677
+ $[21] = t7;
12503
12678
  } else {
12504
- t6 = $[16];
12679
+ t7 = $[21];
12505
12680
  }
12506
- let t7;
12507
- if ($[17] !== column || $[18] !== columnDef.header || $[19] !== columnDefType || $[20] !== enableHiding || $[21] !== handleToggleColumnHidden || $[22] !== localization || $[23] !== table.atoms) {
12508
- t7 = enableHiding ? /*#__PURE__*/jsxRuntime.jsx(reactTable.Subscribe, {
12681
+ let t8;
12682
+ if ($[22] !== column || $[23] !== columnDef.header || $[24] !== columnDefType || $[25] !== enableHiding || $[26] !== localization || $[27] !== table.atoms) {
12683
+ t8 = enableHiding ? /*#__PURE__*/jsxRuntime.jsx(reactTable.Subscribe, {
12509
12684
  source: table.atoms.columnVisibility,
12510
12685
  children: () => {
12511
12686
  const switchChecked = column.getIsVisible();
@@ -12528,7 +12703,7 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12528
12703
  }),
12529
12704
  disabled: !column.getCanHide(),
12530
12705
  label: columnDef.header,
12531
- onChange: () => handleToggleColumnHidden(column, switchChecked)
12706
+ onChange: _temp$g
12532
12707
  });
12533
12708
  }
12534
12709
  }) : /*#__PURE__*/jsxRuntime.jsx(Typography, {
@@ -12537,48 +12712,49 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12537
12712
  },
12538
12713
  children: columnDef.header
12539
12714
  });
12540
- $[17] = column;
12541
- $[18] = columnDef.header;
12542
- $[19] = columnDefType;
12543
- $[20] = enableHiding;
12544
- $[21] = handleToggleColumnHidden;
12545
- $[22] = localization;
12546
- $[23] = table.atoms;
12547
- $[24] = t7;
12548
- } else {
12549
- t7 = $[24];
12550
- }
12551
- let t8;
12552
- if ($[25] !== t5 || $[26] !== t7) {
12553
- t8 = /*#__PURE__*/jsxRuntime.jsx(Box, {
12554
- "data-testid": t5,
12555
- sx: t6,
12556
- children: t7
12557
- });
12558
- $[25] = t5;
12559
- $[26] = t7;
12560
- $[27] = t8;
12715
+ $[22] = column;
12716
+ $[23] = columnDef.header;
12717
+ $[24] = columnDefType;
12718
+ $[25] = enableHiding;
12719
+ $[26] = localization;
12720
+ $[27] = table.atoms;
12721
+ $[28] = t8;
12561
12722
  } else {
12562
- t8 = $[27];
12723
+ t8 = $[28];
12563
12724
  }
12564
12725
  let t9;
12565
- if ($[28] !== rest || $[29] !== t4 || $[30] !== t8) {
12566
- t9 = /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
12567
- disableRipple: true,
12568
- ...rest,
12569
- sx: t4,
12726
+ if ($[29] !== t6 || $[30] !== t8) {
12727
+ t9 = /*#__PURE__*/jsxRuntime.jsx(Box, {
12728
+ "data-testid": t6,
12729
+ sx: t7,
12570
12730
  children: t8
12571
12731
  });
12572
- $[28] = rest;
12573
- $[29] = t4;
12732
+ $[29] = t6;
12574
12733
  $[30] = t8;
12575
12734
  $[31] = t9;
12576
12735
  } else {
12577
12736
  t9 = $[31];
12578
12737
  }
12579
12738
  let t10;
12580
- if ($[32] !== allColumns || $[33] !== column.columns || $[34] !== hoveredColumn || $[35] !== isNestedColumns || $[36] !== setHoveredColumn || $[37] !== table) {
12581
- t10 = column.columns?.map((c, i) => /*#__PURE__*/jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, {
12739
+ if ($[32] !== rest || $[33] !== t4 || $[34] !== t5 || $[35] !== t9) {
12740
+ t10 = /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
12741
+ disableRipple: true,
12742
+ ...rest,
12743
+ onClick: t4,
12744
+ sx: t5,
12745
+ children: t9
12746
+ });
12747
+ $[32] = rest;
12748
+ $[33] = t4;
12749
+ $[34] = t5;
12750
+ $[35] = t9;
12751
+ $[36] = t10;
12752
+ } else {
12753
+ t10 = $[36];
12754
+ }
12755
+ let t11;
12756
+ if ($[37] !== allColumns || $[38] !== column.columns || $[39] !== hoveredColumn || $[40] !== isNestedColumns || $[41] !== setHoveredColumn || $[42] !== table) {
12757
+ t11 = column.columns?.map((c, i) => /*#__PURE__*/jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, {
12582
12758
  allColumns: allColumns,
12583
12759
  column: c,
12584
12760
  hoveredColumn: hoveredColumn,
@@ -12586,30 +12762,41 @@ const MRT_ShowHideColumnsMenuItems = t0 => {
12586
12762
  setHoveredColumn: setHoveredColumn,
12587
12763
  table: table
12588
12764
  }, `${i}-${c.id}`));
12589
- $[32] = allColumns;
12590
- $[33] = column.columns;
12591
- $[34] = hoveredColumn;
12592
- $[35] = isNestedColumns;
12593
- $[36] = setHoveredColumn;
12594
- $[37] = table;
12595
- $[38] = t10;
12765
+ $[37] = allColumns;
12766
+ $[38] = column.columns;
12767
+ $[39] = hoveredColumn;
12768
+ $[40] = isNestedColumns;
12769
+ $[41] = setHoveredColumn;
12770
+ $[42] = table;
12771
+ $[43] = t11;
12596
12772
  } else {
12597
- t10 = $[38];
12773
+ t11 = $[43];
12598
12774
  }
12599
- let t11;
12600
- if ($[39] !== t10 || $[40] !== t9) {
12601
- t11 = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
12602
- children: [t9, t10]
12775
+ let t12;
12776
+ if ($[44] !== t10 || $[45] !== t11) {
12777
+ t12 = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
12778
+ children: [t10, t11]
12603
12779
  });
12604
- $[39] = t10;
12605
- $[40] = t9;
12606
- $[41] = t11;
12780
+ $[44] = t10;
12781
+ $[45] = t11;
12782
+ $[46] = t12;
12607
12783
  } else {
12608
- t11 = $[41];
12784
+ t12 = $[46];
12609
12785
  }
12610
- return t11;
12786
+ return t12;
12787
+ };
12788
+ function _temp$g() {}
12789
+
12790
+ // Matches a column if its own header text contains the search term, or any of
12791
+ // its nested (grouped) columns do — a matching group keeps all of its
12792
+ // children rather than filtering within the group, so the tree stays intact.
12793
+ const columnMatchesSearch = (column, term) => {
12794
+ const header = column.columnDef.header;
12795
+ if (typeof header === 'string' && header.toLowerCase().includes(term)) {
12796
+ return true;
12797
+ }
12798
+ return !!column.columns?.some(child => columnMatchesSearch(child, term));
12611
12799
  };
12612
-
12613
12800
  const MRT_ShowHideColumnsMenu = ({
12614
12801
  anchorEl,
12615
12802
  setAnchorEl,
@@ -12627,6 +12814,10 @@ const MRT_ShowHideColumnsMenu = ({
12627
12814
  getState,
12628
12815
  options: {
12629
12816
  enableHiding,
12817
+ icons: {
12818
+ CloseIcon,
12819
+ SearchIcon
12820
+ },
12630
12821
  localization,
12631
12822
  mrtTheme: {
12632
12823
  menuBackgroundColor
@@ -12638,6 +12829,7 @@ const MRT_ShowHideColumnsMenu = ({
12638
12829
  columnPinning
12639
12830
  } = getState();
12640
12831
  const density = reactStore.useSelector(table.store, state => state.density);
12832
+ const [searchText, setSearchText] = react.useState('');
12641
12833
  const handleToggleAllColumns = value => {
12642
12834
  const updates = getAllLeafColumns().filter(column => column.columnDef.enableHiding !== false).reduce((acc, column_0) => {
12643
12835
  acc[column_0.id] = value ?? !column_0.getIsVisible();
@@ -12657,19 +12849,87 @@ const MRT_ShowHideColumnsMenu = ({
12657
12849
  }, [columnOrder, columnPinning, getAllColumns(), getCenterLeafColumns(), getStartLeafColumns(), getEndLeafColumns()]);
12658
12850
  const isNestedColumns = allColumns.some(col_1 => col_1.columnDef.columnDefType === 'group');
12659
12851
  const [hoveredColumn, setHoveredColumn] = react.useState(null);
12852
+ const trimmedSearchText = searchText.trim().toLowerCase();
12853
+ const filteredColumns = react.useMemo(() => {
12854
+ if (!trimmedSearchText) return allColumns;
12855
+ return allColumns.filter(column_1 => columnMatchesSearch(column_1, trimmedSearchText));
12856
+ }, [allColumns, trimmedSearchText]);
12857
+ const handleSearchChange = event => {
12858
+ setSearchText(event.target.value);
12859
+ };
12660
12860
  return /*#__PURE__*/jsxRuntime.jsxs(Menu, {
12661
12861
  MenuListProps: {
12662
12862
  dense: density === 'compact',
12663
12863
  sx: {
12664
12864
  backgroundColor: menuBackgroundColor
12665
12865
  }
12866
+ }
12867
+ // Default anchor/transform origins both resolve to the anchor's own
12868
+ // top-left corner, so the menu opened directly on top of the "Columns"
12869
+ // button instead of below it — anchoring from the button's bottom edge
12870
+ // keeps the button visible once the menu is open.
12871
+ ,
12872
+ anchorOrigin: {
12873
+ horizontal: 'left',
12874
+ vertical: 'bottom'
12875
+ },
12876
+ transformOrigin: {
12877
+ horizontal: 'left',
12878
+ vertical: 'top'
12666
12879
  },
12667
12880
  anchorEl: anchorEl,
12881
+ autoFocus: false,
12668
12882
  disableScrollLock: true,
12669
- onClose: () => setAnchorEl(null),
12883
+ onClose: () => {
12884
+ setAnchorEl(null);
12885
+ setSearchText('');
12886
+ },
12670
12887
  open: !!anchorEl,
12671
12888
  ...rest,
12672
- children: [/*#__PURE__*/jsxRuntime.jsxs(Box, {
12889
+ children: [/*#__PURE__*/jsxRuntime.jsx(Box, {
12890
+ sx: {
12891
+ px: '0.5rem',
12892
+ pb: '0.25rem'
12893
+ },
12894
+ children: /*#__PURE__*/jsxRuntime.jsx(TextField, {
12895
+ autoFocus: true,
12896
+ fullWidth: true,
12897
+ onChange: handleSearchChange,
12898
+ onKeyDown: event_0 => {
12899
+ // Stop MUI's menu type-ahead/arrow-key handling from treating
12900
+ // keystrokes typed here as list navigation.
12901
+ event_0.stopPropagation();
12902
+ if (event_0.key === 'Escape') {
12903
+ setAnchorEl(null);
12904
+ setSearchText('');
12905
+ }
12906
+ },
12907
+ placeholder: localization.search,
12908
+ size: "small",
12909
+ slotProps: {
12910
+ input: {
12911
+ startAdornment: /*#__PURE__*/jsxRuntime.jsx(InputAdornment, {
12912
+ position: "start",
12913
+ children: /*#__PURE__*/jsxRuntime.jsx(SearchIcon, {
12914
+ fontSize: "small"
12915
+ })
12916
+ }),
12917
+ endAdornment: searchText && /*#__PURE__*/jsxRuntime.jsx(InputAdornment, {
12918
+ position: "end",
12919
+ children: /*#__PURE__*/jsxRuntime.jsx(IconButton, {
12920
+ "aria-label": localization.clearSearch,
12921
+ onClick: () => setSearchText(''),
12922
+ size: "small",
12923
+ children: /*#__PURE__*/jsxRuntime.jsx(CloseIcon, {
12924
+ fontSize: "small"
12925
+ })
12926
+ })
12927
+ })
12928
+ }
12929
+ },
12930
+ value: searchText
12931
+ })
12932
+ }), /*#__PURE__*/jsxRuntime.jsxs(Box, {
12673
12933
  sx: {
12674
12934
  display: 'flex',
12675
12935
  justifyContent: 'space-between',
@@ -12691,14 +12951,21 @@ const MRT_ShowHideColumnsMenu = ({
12691
12951
  children: localization.showAll
12692
12952
  })
12693
12953
  })]
12694
- }), /*#__PURE__*/jsxRuntime.jsx(Divider, {}), allColumns.map((column_1, index) => /*#__PURE__*/jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, {
12954
+ }), /*#__PURE__*/jsxRuntime.jsx(Divider, {}), filteredColumns.length === 0 ? /*#__PURE__*/jsxRuntime.jsx(Typography, {
12955
+ sx: {
12956
+ p: '0.75rem',
12957
+ textAlign: 'center'
12958
+ },
12959
+ variant: "body2",
12960
+ children: localization.noResultsFound
12961
+ }) : filteredColumns.map((column_2, index) => /*#__PURE__*/jsxRuntime.jsx(MRT_ShowHideColumnsMenuItems, {
12695
12962
  allColumns: allColumns,
12696
- column: column_1,
12963
+ column: column_2,
12697
12964
  hoveredColumn: hoveredColumn,
12698
12965
  isNestedColumns: isNestedColumns,
12699
12966
  setHoveredColumn: setHoveredColumn,
12700
12967
  table: table
12701
- }, `${index}-${column_1.id}`))]
12968
+ }, `${index}-${column_2.id}`))]
12702
12969
  });
12703
12970
  };
12704
12971
 
@@ -13519,6 +13786,123 @@ const MRT_TopToolbar = ({
13519
13786
  });
13520
13787
  };
13521
13788
 
13789
+ const BODY_CELL_SELECTOR = '[data-column-id]';
13790
+
13791
+ /**
13792
+ * Headless (renders nothing) — commits a body-content-based width for every
13793
+ * column the consumer didn't give an explicit `size`/`width`, using the same
13794
+ * measurement the resize handle's double-click autosize uses
13795
+ * (computeAutoSizedColumnWidth). The header title is never measured.
13796
+ *
13797
+ * Body content only exists once real rows are rendered, so this waits until
13798
+ * the table is neither loading nor showing skeletons and at least one body
13799
+ * cell is in the DOM. Until then such columns keep their default width and
13800
+ * share free space through growth. Measuring happens in a layout effect, so
13801
+ * the final width is applied before the first paint of the loaded rows.
13802
+ *
13803
+ * Each column is settled once: measured when its cells are rendered, or left
13804
+ * at its default width when it's visible but has no rendered cells (column
13805
+ * virtualization) — later pages, batches or horizontal scrolling never change
13806
+ * it again. A hidden column stays pending and is measured when first shown.
13807
+ * Only the currently rendered rows are measured (row virtualization); a wider
13808
+ * value further down needs a double-click on the resize handle.
13809
+ *
13810
+ * Rendered after <MRT_Table> in the container so the table ref is attached
13811
+ * when its layout effect runs. Runs on every render (no dependency array):
13812
+ * rows arriving via setRows or isLoading/showSkeletons toggling re-render
13813
+ * the container. Once every candidate is settled it is an early return.
13814
+ */
13815
+ const MRT_AutoSizeColumnsEffect = t0 => {
13816
+ const $ = compilerRuntime.c(9);
13817
+ const {
13818
+ table
13819
+ } = t0;
13820
+ const {
13821
+ getColumn,
13822
+ getRowModel,
13823
+ getState,
13824
+ refs: t1,
13825
+ setColumnSizing
13826
+ } = table;
13827
+ const {
13828
+ autoSizeColumnIdsRef,
13829
+ autoSizedColumnWidthsRef,
13830
+ tableRef
13831
+ } = t1;
13832
+ let t2;
13833
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
13834
+ t2 = new Set();
13835
+ $[0] = t2;
13836
+ } else {
13837
+ t2 = $[0];
13838
+ }
13839
+ const settledIdsRef = react.useRef(t2);
13840
+ let t3;
13841
+ if ($[1] !== autoSizeColumnIdsRef || $[2] !== autoSizedColumnWidthsRef || $[3] !== getColumn || $[4] !== getRowModel || $[5] !== getState || $[6] !== setColumnSizing || $[7] !== tableRef) {
13842
+ t3 = () => {
13843
+ const candidateIds = autoSizeColumnIdsRef.current;
13844
+ const settledIds = settledIdsRef.current;
13845
+ if ([...candidateIds].every(id => settledIds.has(id))) {
13846
+ return;
13847
+ }
13848
+ const {
13849
+ columnSizing,
13850
+ isLoading,
13851
+ showSkeletons
13852
+ } = getState();
13853
+ const tableEl = tableRef.current;
13854
+ if (isLoading || showSkeletons || !tableEl || !getRowModel().rows.length || !tableEl.querySelector(BODY_CELL_SELECTOR)) {
13855
+ return;
13856
+ }
13857
+ const updates = {};
13858
+ candidateIds.forEach(columnId => {
13859
+ if (settledIds.has(columnId)) {
13860
+ return;
13861
+ }
13862
+ const column = getColumn(columnId);
13863
+ if (!column) {
13864
+ return;
13865
+ }
13866
+ if (columnSizing[columnId] !== undefined) {
13867
+ settledIds.add(columnId);
13868
+ return;
13869
+ }
13870
+ if (!column.getIsVisible()) {
13871
+ return;
13872
+ }
13873
+ settledIds.add(columnId);
13874
+ const bodyCellEls = tableEl.querySelectorAll(`[data-column-id="${CSS.escape(columnId)}"]`);
13875
+ if (!bodyCellEls.length) {
13876
+ return;
13877
+ }
13878
+ updates[columnId] = computeAutoSizedColumnWidth({
13879
+ bodyCellEls,
13880
+ ...getColumnSizeBounds(column.columnDef)
13881
+ });
13882
+ });
13883
+ if (Object.keys(updates).length) {
13884
+ Object.assign(autoSizedColumnWidthsRef.current, updates);
13885
+ setColumnSizing(old => ({
13886
+ ...old,
13887
+ ...updates
13888
+ }));
13889
+ }
13890
+ };
13891
+ $[1] = autoSizeColumnIdsRef;
13892
+ $[2] = autoSizedColumnWidthsRef;
13893
+ $[3] = getColumn;
13894
+ $[4] = getRowModel;
13895
+ $[5] = getState;
13896
+ $[6] = setColumnSizing;
13897
+ $[7] = tableRef;
13898
+ $[8] = t3;
13899
+ } else {
13900
+ t3 = $[8];
13901
+ }
13902
+ react.useLayoutEffect(t3);
13903
+ return null;
13904
+ };
13905
+
13522
13906
  /**
13523
13907
  * Headless (renders nothing) — owns its own reactive subscription so this
13524
13908
  * correction runs independently of whatever the root `useTable()` selector
@@ -13975,6 +14359,9 @@ const MRT_TableBodyCell = ({
13975
14359
  hoveredRow
13976
14360
  } = reactStore.useSelector(table.store, state => ({
13977
14361
  actionCell: state.actionCell,
14362
+ // Pinned-group edges can change without this cell's identity changing.
14363
+ columnPinning: state.columnPinning,
14364
+ columnVisibility: state.columnVisibility,
13978
14365
  columnResizing: state.columnResizing,
13979
14366
  density: state.density,
13980
14367
  draggingColumn: state.draggingColumn,
@@ -14069,6 +14456,7 @@ const MRT_TableBodyCell = ({
14069
14456
  };
14070
14457
  return /*#__PURE__*/jsxRuntime.jsx(TableCell, {
14071
14458
  align: theme.direction === 'rtl' ? 'right' : 'left',
14459
+ "data-column-id": column.id,
14072
14460
  "data-index": staticColumnIndex,
14073
14461
  "data-pinned": !!isColumnPinned || undefined,
14074
14462
  "data-testid": `body-cell-${cell.id}`,
@@ -14447,7 +14835,7 @@ const MRT_TableBodyRow = ({
14447
14835
  const tableHeadHeight = enableStickyHeader && tableHeadRef.current?.clientHeight || 0;
14448
14836
  const tableFooterHeight = enableStickyFooter && tableFooterRef.current?.clientHeight || 0;
14449
14837
  const sx = parseFromValuesOrFunc(tableRowProps?.sx, theme);
14450
- const defaultRowHeight = density === 'compact' ? 37 : density === 'comfortable' ? 53 : 69;
14838
+ const defaultRowHeight = getDefaultRowHeight(density);
14451
14839
  const customRowHeight =
14452
14840
  // @ts-expect-error
14453
14841
  parseInt(tableRowProps?.style?.height ?? sx?.height, 10) || undefined;
@@ -15169,6 +15557,139 @@ const MRT_TableFooter = ({
15169
15557
  });
15170
15558
  };
15171
15559
 
15560
+ const MRT_SelectAllMenuItems = ({
15561
+ table,
15562
+ closeMenu: handleClose
15563
+ }) => {
15564
+ const [isSelectingAllPages, setIsSelectingAllPages] = react.useState(false);
15565
+ const {
15566
+ getState,
15567
+ options: {
15568
+ enableRowPinning,
15569
+ getAllSelectableRowIds,
15570
+ localization,
15571
+ rowPinningDisplayMode
15572
+ },
15573
+ refs: {
15574
+ allSelectableRowIdsRef
15575
+ }
15576
+ } = table;
15577
+ const {
15578
+ isLoading,
15579
+ showProgressBars
15580
+ } = getState();
15581
+
15582
+ // Clears row pinning on every bulk selection/deselection
15583
+ const clearPinning = () => {
15584
+ if (enableRowPinning && rowPinningDisplayMode?.includes('select')) {
15585
+ table.setRowPinning({
15586
+ bottom: [],
15587
+ top: []
15588
+ });
15589
+ }
15590
+ };
15591
+
15592
+ // ── Current-page actions ────────────────────────────────────────────────────
15593
+
15594
+ const handleSelectCurrentPage = () => {
15595
+ table.toggleAllPageRowsSelected(true);
15596
+ clearPinning();
15597
+ handleClose();
15598
+ };
15599
+ const handleDeselectCurrentPage = () => {
15600
+ if (allSelectableRowIdsRef.current.length > 0) {
15601
+ // 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.
15602
+ table.setRowSelection({});
15603
+ allSelectableRowIdsRef.current = [];
15604
+ } else {
15605
+ table.toggleAllPageRowsSelected(false);
15606
+ }
15607
+ clearPinning();
15608
+ handleClose();
15609
+ };
15610
+
15611
+ // ── All-pages actions ───────────────────────────────────────────────────────
15612
+
15613
+ const handleSelectAllPages = async () => {
15614
+ handleClose();
15615
+ if (getAllSelectableRowIds) {
15616
+ // Server-side: IDs are not available locally, fetch them from the API
15617
+ setIsSelectingAllPages(true);
15618
+ table.setShowProgressBars(true);
15619
+ try {
15620
+ const ids = await getAllSelectableRowIds({
15621
+ table
15622
+ });
15623
+ allSelectableRowIdsRef.current = ids;
15624
+ const newSelection = {};
15625
+ ids.forEach(id => {
15626
+ newSelection[id] = true;
15627
+ });
15628
+ table.setRowSelection(newSelection);
15629
+ clearPinning();
15630
+ } finally {
15631
+ setIsSelectingAllPages(false);
15632
+ table.setShowProgressBars(false);
15633
+ }
15634
+ } else {
15635
+ // Client-side: all data is available locally
15636
+ table.toggleAllRowsSelected(true);
15637
+ clearPinning();
15638
+ }
15639
+ };
15640
+ const handleDeselectAllPages = () => {
15641
+ if (getAllSelectableRowIds) {
15642
+ table.setRowSelection({});
15643
+ } else {
15644
+ table.toggleAllRowsSelected(false);
15645
+ }
15646
+ allSelectableRowIdsRef.current = [];
15647
+ clearPinning();
15648
+ handleClose();
15649
+ };
15650
+ const isDisabled = isLoading || showProgressBars || isSelectingAllPages;
15651
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
15652
+ children: /*#__PURE__*/jsxRuntime.jsx(reactTable.Subscribe, {
15653
+ selector: state => ({
15654
+ pagination: state.pagination,
15655
+ rowSelection: state.rowSelection
15656
+ }),
15657
+ source: table.store,
15658
+ children: ({
15659
+ rowSelection
15660
+ }) => {
15661
+ const isAllCurrentPageSelected = table.getIsAllPageRowsSelected();
15662
+ const isAllPagesActive = getIsAllPagesSelectionActive(table, rowSelection);
15663
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
15664
+ children: [isAllCurrentPageSelected ? /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
15665
+ disabled: isDisabled,
15666
+ onClick: handleDeselectCurrentPage,
15667
+ children: localization.deselectAllOnCurrentPage
15668
+ }) : /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
15669
+ disabled: isDisabled,
15670
+ onClick: handleSelectCurrentPage,
15671
+ children: localization.selectAllOnCurrentPage
15672
+ }), isAllPagesActive ? /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
15673
+ disabled: isDisabled,
15674
+ onClick: handleDeselectAllPages,
15675
+ children: localization.deselectAllOnAllPages
15676
+ }) : /*#__PURE__*/jsxRuntime.jsxs(MenuItem, {
15677
+ disabled: isDisabled,
15678
+ onClick: handleSelectAllPages,
15679
+ children: [isSelectingAllPages && /*#__PURE__*/jsxRuntime.jsx(CircularProgress, {
15680
+ "aria-label": "Loading",
15681
+ size: 14,
15682
+ sx: {
15683
+ mr: 1
15684
+ }
15685
+ }), localization.selectAllOnAllPages]
15686
+ })]
15687
+ });
15688
+ }
15689
+ })
15690
+ });
15691
+ };
15692
+
15172
15693
  const MRT_ActionMenuItem = t0 => {
15173
15694
  const $ = compilerRuntime.c(20);
15174
15695
  let icon;
@@ -15287,7 +15808,7 @@ const MRT_ActionMenuItem = t0 => {
15287
15808
  };
15288
15809
 
15289
15810
  const MRT_ColumnActionMenu = t0 => {
15290
- const $ = compilerRuntime.c(73);
15811
+ const $ = compilerRuntime.c(81);
15291
15812
  let anchorEl;
15292
15813
  let header;
15293
15814
  let rest;
@@ -15323,6 +15844,8 @@ const MRT_ColumnActionMenu = t0 => {
15323
15844
  const {
15324
15845
  enableColumnPinning,
15325
15846
  enableColumnResizing,
15847
+ enableMultiRowSelection,
15848
+ enableSelectAll,
15326
15849
  enableGrouping,
15327
15850
  enableHiding,
15328
15851
  enableSorting,
@@ -15397,7 +15920,7 @@ const MRT_ColumnActionMenu = t0 => {
15397
15920
  let t7;
15398
15921
  if ($[15] !== column || $[16] !== setAnchorEl || $[17] !== setColumnResizing) {
15399
15922
  t7 = () => {
15400
- setColumnResizing(_temp3$2);
15923
+ setColumnResizing(_temp3$1);
15401
15924
  column.resetSize();
15402
15925
  setAnchorEl(null);
15403
15926
  };
@@ -15439,7 +15962,7 @@ const MRT_ColumnActionMenu = t0 => {
15439
15962
  if ($[25] !== column || $[26] !== setAnchorEl || $[27] !== setColumnOrder) {
15440
15963
  t10 = () => {
15441
15964
  column.toggleGrouping();
15442
- setColumnOrder(_temp4$1);
15965
+ setColumnOrder(_temp4);
15443
15966
  setAnchorEl(null);
15444
15967
  };
15445
15968
  $[25] = column;
@@ -15464,7 +15987,7 @@ const MRT_ColumnActionMenu = t0 => {
15464
15987
  }
15465
15988
  const handleShowAllColumns = t11;
15466
15989
  let t12;
15467
- 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) {
15990
+ 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) {
15468
15991
  const internalColumnMenuItems = [...(enableSorting && column.getCanSort() ? [enableSortingRemoval !== false && /*#__PURE__*/jsxRuntime.jsx(MRT_ActionMenuItem, {
15469
15992
  disabled: column.getIsSorted() === false,
15470
15993
  icon: /*#__PURE__*/jsxRuntime.jsx(ClearAllIcon, {}),
@@ -15542,43 +16065,58 @@ const MRT_ColumnActionMenu = t0 => {
15542
16065
  }, 12)] : [])].filter(Boolean);
15543
16066
  const t13 = density === "compact";
15544
16067
  let t14;
15545
- if ($[66] !== menuBackgroundColor) {
16068
+ if ($[68] !== menuBackgroundColor) {
15546
16069
  t14 = {
15547
16070
  backgroundColor: menuBackgroundColor
15548
16071
  };
15549
- $[66] = menuBackgroundColor;
15550
- $[67] = t14;
16072
+ $[68] = menuBackgroundColor;
16073
+ $[69] = t14;
15551
16074
  } else {
15552
- t14 = $[67];
16075
+ t14 = $[69];
15553
16076
  }
15554
16077
  let t15;
15555
- if ($[68] !== t13 || $[69] !== t14) {
16078
+ if ($[70] !== t13 || $[71] !== t14) {
15556
16079
  t15 = {
15557
16080
  dense: t13,
15558
16081
  sx: t14
15559
16082
  };
15560
- $[68] = t13;
15561
- $[69] = t14;
15562
- $[70] = t15;
16083
+ $[70] = t13;
16084
+ $[71] = t14;
16085
+ $[72] = t15;
15563
16086
  } else {
15564
- t15 = $[70];
16087
+ t15 = $[72];
15565
16088
  }
15566
16089
  let t16;
15567
- if ($[71] !== setAnchorEl) {
16090
+ if ($[73] !== setAnchorEl) {
15568
16091
  t16 = () => setAnchorEl(null);
15569
- $[71] = setAnchorEl;
15570
- $[72] = t16;
16092
+ $[73] = setAnchorEl;
16093
+ $[74] = t16;
16094
+ } else {
16095
+ t16 = $[74];
16096
+ }
16097
+ let t17;
16098
+ if ($[75] !== column.id || $[76] !== enableMultiRowSelection || $[77] !== enableSelectAll || $[78] !== setAnchorEl || $[79] !== table) {
16099
+ t17 = column.id === CHECKBOX_DISPLAY_COLUMN_ID && enableSelectAll && enableMultiRowSelection && /*#__PURE__*/jsxRuntime.jsx(MRT_SelectAllMenuItems, {
16100
+ closeMenu: () => setAnchorEl(null),
16101
+ table: table
16102
+ });
16103
+ $[75] = column.id;
16104
+ $[76] = enableMultiRowSelection;
16105
+ $[77] = enableSelectAll;
16106
+ $[78] = setAnchorEl;
16107
+ $[79] = table;
16108
+ $[80] = t17;
15571
16109
  } else {
15572
- t16 = $[72];
16110
+ t17 = $[80];
15573
16111
  }
15574
- t12 = /*#__PURE__*/jsxRuntime.jsx(Menu, {
16112
+ t12 = /*#__PURE__*/jsxRuntime.jsxs(Menu, {
15575
16113
  MenuListProps: t15,
15576
16114
  anchorEl: anchorEl,
15577
16115
  disableScrollLock: true,
15578
16116
  onClose: t16,
15579
16117
  open: !!anchorEl,
15580
16118
  ...rest,
15581
- children: columnDef.renderColumnActionsMenuItems?.({
16119
+ children: [t17, column.id === CHECKBOX_DISPLAY_COLUMN_ID && enableSelectAll && enableMultiRowSelection && internalColumnMenuItems.length > 0 && /*#__PURE__*/jsxRuntime.jsx(Divider, {}), columnDef.renderColumnActionsMenuItems?.({
15582
16120
  closeMenu: () => setAnchorEl(null),
15583
16121
  column,
15584
16122
  internalColumnMenuItems,
@@ -15588,7 +16126,7 @@ const MRT_ColumnActionMenu = t0 => {
15588
16126
  column,
15589
16127
  internalColumnMenuItems,
15590
16128
  table
15591
- }) ?? internalColumnMenuItems
16129
+ }) ?? internalColumnMenuItems]
15592
16130
  });
15593
16131
  $[32] = ClearAllIcon;
15594
16132
  $[33] = DynamicFeedIcon;
@@ -15607,25 +16145,27 @@ const MRT_ColumnActionMenu = t0 => {
15607
16145
  $[46] = enableColumnResizing;
15608
16146
  $[47] = enableGrouping;
15609
16147
  $[48] = enableHiding;
15610
- $[49] = enableSorting;
15611
- $[50] = enableSortingRemoval;
15612
- $[51] = handleClearSort;
15613
- $[52] = handleGroupByColumn;
15614
- $[53] = handleHideColumn;
15615
- $[54] = handlePinColumn;
15616
- $[55] = handleResetColumnSize;
15617
- $[56] = handleShowAllColumns;
15618
- $[57] = handleSortAsc;
15619
- $[58] = handleSortDesc;
15620
- $[59] = localization;
15621
- $[60] = menuBackgroundColor;
15622
- $[61] = renderColumnActionsMenuItems;
15623
- $[62] = rest;
15624
- $[63] = setAnchorEl;
15625
- $[64] = table;
15626
- $[65] = t12;
15627
- } else {
15628
- t12 = $[65];
16148
+ $[49] = enableMultiRowSelection;
16149
+ $[50] = enableSelectAll;
16150
+ $[51] = enableSorting;
16151
+ $[52] = enableSortingRemoval;
16152
+ $[53] = handleClearSort;
16153
+ $[54] = handleGroupByColumn;
16154
+ $[55] = handleHideColumn;
16155
+ $[56] = handlePinColumn;
16156
+ $[57] = handleResetColumnSize;
16157
+ $[58] = handleShowAllColumns;
16158
+ $[59] = handleSortAsc;
16159
+ $[60] = handleSortDesc;
16160
+ $[61] = localization;
16161
+ $[62] = menuBackgroundColor;
16162
+ $[63] = renderColumnActionsMenuItems;
16163
+ $[64] = rest;
16164
+ $[65] = setAnchorEl;
16165
+ $[66] = table;
16166
+ $[67] = t12;
16167
+ } else {
16168
+ t12 = $[67];
15629
16169
  }
15630
16170
  return t12;
15631
16171
  };
@@ -15640,13 +16180,13 @@ function _temp$8(state) {
15640
16180
  function _temp2$5(state_0) {
15641
16181
  return state_0.density;
15642
16182
  }
15643
- function _temp3$2(old) {
16183
+ function _temp3$1(old) {
15644
16184
  return {
15645
16185
  ...old,
15646
16186
  isResizingColumn: false
15647
16187
  };
15648
16188
  }
15649
- function _temp4$1(old_0) {
16189
+ function _temp4(old_0) {
15650
16190
  return ["mrt-row-expand", ...old_0];
15651
16191
  }
15652
16192
  function _temp5(col) {
@@ -16155,6 +16695,7 @@ const MRT_TableHeadCellResizeHandle = ({
16155
16695
  columnResizeDirection
16156
16696
  },
16157
16697
  refs: {
16698
+ autoSizedColumnWidthsRef,
16158
16699
  isResizingRef,
16159
16700
  resizeIndicatorRef,
16160
16701
  tableContainerRef,
@@ -16168,7 +16709,7 @@ const MRT_TableHeadCellResizeHandle = ({
16168
16709
  const {
16169
16710
  column
16170
16711
  } = header;
16171
- const mx = density === 'compact' ? '-8px' : density === 'comfortable' ? '-16px' : '-24px';
16712
+ const mx = density === 'compact' ? '-2px' : density === 'comfortable' ? '-16px' : '-24px';
16172
16713
  const lr = column.columnDef.columnDefType === 'display' ? '4px' : '0';
16173
16714
 
16174
16715
  // Drives the resize purely through refs/DOM writes (CSS vars + the indicator line) so
@@ -16177,12 +16718,26 @@ const MRT_TableHeadCellResizeHandle = ({
16177
16718
  const tableEl = tableRef.current;
16178
16719
  const containerEl = tableContainerRef.current;
16179
16720
  const indicatorEl = resizeIndicatorRef.current;
16180
- const startSize = column.getSize();
16721
+ const startSize = tableHeadCellRefs.current?.[column.id]?.getBoundingClientRect().width || column.getSize();
16722
+ // Freeze flex growth while CSS variables drive the drag without renders.
16723
+ const growVar = `--col-${parseCSSVarId(column.id)}-grow`;
16724
+ tableEl?.style.setProperty(growVar, '0');
16725
+ tableEl?.style.setProperty(`--header-${parseCSSVarId(header.id)}-size`, `${startSize}`);
16726
+ tableEl?.style.setProperty(`--col-${parseCSSVarId(column.id)}-size`, `${startSize}`);
16181
16727
  const dir = columnResizeDirection === 'rtl' ? -1 : 1;
16182
- const minSize = column.columnDef.minSize ?? 40;
16183
- const maxSize = column.columnDef.maxSize ?? 1000;
16728
+ const {
16729
+ minSize,
16730
+ maxSize
16731
+ } = getColumnSizeBounds(column.columnDef);
16184
16732
  let size = startSize;
16185
- let latestClientX = startX;
16733
+ // The "effective" cursor position used to compute size. Normally this just
16734
+ // mirrors the real cursor 1:1, but while pinned at the window edge (see
16735
+ // below) it keeps advancing past the real position — and because every
16736
+ // update here is an incremental `+=` off whatever it already was, moving
16737
+ // the real cursor back inward afterwards shrinks it smoothly from wherever
16738
+ // it ended up, instead of snapping back to a value derived from the
16739
+ // original startX.
16740
+ let virtualX = startX;
16186
16741
  let rafId = null;
16187
16742
 
16188
16743
  // Read the header cell's own rendered edge (rather than deriving a position from
@@ -16216,31 +16771,63 @@ const MRT_TableHeadCellResizeHandle = ({
16216
16771
  // batching keeps the handler from falling behind the pointer.
16217
16772
  const applyMove = () => {
16218
16773
  rafId = null;
16219
- size = Math.min(Math.max(startSize + dir * (latestClientX - startX), minSize), maxSize);
16774
+ size = Math.min(Math.max(startSize + dir * (virtualX - startX), minSize), maxSize);
16220
16775
  if (tableEl) {
16221
16776
  tableEl.style.setProperty(`--header-${parseCSSVarId(header.id)}-size`, `${size}`);
16222
16777
  tableEl.style.setProperty(`--col-${parseCSSVarId(column.id)}-size`, `${size}`);
16223
16778
  }
16224
16779
  updateIndicator();
16225
16780
  };
16226
- const scheduleMove = clientX => {
16227
- latestClientX = clientX;
16781
+ const scheduleMove = () => {
16228
16782
  if (rafId == null) {
16229
16783
  rafId = requestAnimationFrame(applyMove);
16230
16784
  }
16231
16785
  };
16232
- const handleMouseMove = e => scheduleMove(e.clientX);
16786
+
16787
+ // The OS clamps the real cursor position at the browser window's edge, so once
16788
+ // it gets there (common when growing the last/rightmost column) no further
16789
+ // mousemove events fire even though the user is still pushing the mouse against
16790
+ // the edge wanting to keep resizing. While pinned, a small rAF loop keeps
16791
+ // advancing virtualX past the real edge at a steady rate, so the resize keeps
16792
+ // going until the drag ends or the cursor is pulled back inward.
16793
+ const EDGE_THRESHOLD = 24;
16794
+ const EDGE_STEP = 12;
16795
+ let lastRealClientX = startX;
16796
+ let edgeRafId = null;
16797
+ const isNearWindowEdge = x_0 => x_0 <= EDGE_THRESHOLD || x_0 >= window.innerWidth - EDGE_THRESHOLD;
16798
+ const stepEdgeDrift = () => {
16799
+ edgeRafId = null;
16800
+ if (!isNearWindowEdge(lastRealClientX)) return;
16801
+ virtualX += lastRealClientX <= EDGE_THRESHOLD ? -EDGE_STEP : EDGE_STEP;
16802
+ scheduleMove();
16803
+ edgeRafId = requestAnimationFrame(stepEdgeDrift);
16804
+ };
16805
+ const trackPointer = clientX => {
16806
+ // Always an incremental delta off the real cursor's last known position —
16807
+ // never a jump to an absolute value — so this composes cleanly with
16808
+ // whatever virtualX already drifted to while pinned at the edge.
16809
+ virtualX += clientX - lastRealClientX;
16810
+ lastRealClientX = clientX;
16811
+ scheduleMove();
16812
+ if (isNearWindowEdge(clientX) && edgeRafId == null) {
16813
+ edgeRafId = requestAnimationFrame(stepEdgeDrift);
16814
+ }
16815
+ };
16816
+ const handleMouseMove = e => trackPointer(e.clientX);
16233
16817
  const handleTouchMove = e_0 => {
16234
16818
  const touchX = e_0.touches[0]?.clientX;
16235
16819
  if (touchX == null) return;
16236
16820
  e_0.preventDefault();
16237
- scheduleMove(touchX);
16821
+ trackPointer(touchX);
16238
16822
  };
16239
16823
  const handleEnd = () => {
16240
16824
  document.removeEventListener('mousemove', handleMouseMove);
16241
16825
  document.removeEventListener('mouseup', handleEnd);
16242
16826
  document.removeEventListener('touchmove', handleTouchMove);
16243
16827
  document.removeEventListener('touchend', handleEnd);
16828
+ if (edgeRafId != null) {
16829
+ cancelAnimationFrame(edgeRafId);
16830
+ }
16244
16831
  // Flush a still-pending frame synchronously so the committed size reflects the
16245
16832
  // true last pointer position instead of lagging up to one frame behind it.
16246
16833
  if (rafId != null) {
@@ -16252,6 +16839,7 @@ const MRT_TableHeadCellResizeHandle = ({
16252
16839
  document.body.style.cursor = '';
16253
16840
  document.body.style.userSelect = '';
16254
16841
  if (indicatorEl) indicatorEl.style.display = 'none';
16842
+ delete autoSizedColumnWidthsRef.current[column.id];
16255
16843
  setColumnSizing(old => ({
16256
16844
  ...old,
16257
16845
  [column.id]: size
@@ -16263,7 +16851,7 @@ const MRT_TableHeadCellResizeHandle = ({
16263
16851
  passive: false
16264
16852
  });
16265
16853
  document.addEventListener('touchend', handleEnd);
16266
- }, [column, columnResizeDirection, header.id, isResizingRef, resizeIndicatorRef, setColumnSizing, tableContainerRef, tableHeadCellRefs, tableRef]);
16854
+ }, [autoSizedColumnWidthsRef, column, columnResizeDirection, header.id, isResizingRef, resizeIndicatorRef, setColumnSizing, tableContainerRef, tableHeadCellRefs, tableRef]);
16267
16855
  return /*#__PURE__*/jsxRuntime.jsx(Box, {
16268
16856
  className: "Mui-TableHeadCell-ResizeHandle-Wrapper",
16269
16857
  onDoubleClick: () => {
@@ -16271,7 +16859,22 @@ const MRT_TableHeadCellResizeHandle = ({
16271
16859
  ...old_0,
16272
16860
  isResizingColumn: false
16273
16861
  }));
16274
- column.resetSize();
16862
+ const bodyCellEls = tableRef.current?.querySelectorAll(`[data-column-id="${CSS.escape(column.id)}"]`);
16863
+ // Content-only, like the initial autosize: with no rendered body
16864
+ // cells there is nothing to fit, so the current width is kept.
16865
+ if (!bodyCellEls?.length) return;
16866
+ // Same measurement MRT_AutoSizeColumnsEffect uses for the initial
16867
+ // auto-size — double-click always re-runs it fresh, regardless of
16868
+ // whether this column has an explicit `size` or was already resized.
16869
+ const newSize = computeAutoSizedColumnWidth({
16870
+ bodyCellEls,
16871
+ ...getColumnSizeBounds(column.columnDef)
16872
+ });
16873
+ delete autoSizedColumnWidthsRef.current[column.id];
16874
+ setColumnSizing(old_1 => ({
16875
+ ...old_1,
16876
+ [column.id]: newSize
16877
+ }));
16275
16878
  },
16276
16879
  onMouseDown: e_1 => {
16277
16880
  e_1.preventDefault();
@@ -16476,6 +17079,7 @@ const MRT_TableHeadCell = ({
16476
17079
  const {
16477
17080
  columnDefType
16478
17081
  } = columnDef;
17082
+ const isCheckboxColumn = column.id === CHECKBOX_DISPLAY_COLUMN_ID;
16479
17083
  const {
16480
17084
  columnResizing,
16481
17085
  draggingColumn,
@@ -16586,6 +17190,7 @@ const MRT_TableHeadCell = ({
16586
17190
  userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
16587
17191
  verticalAlign: 'top',
16588
17192
  borderBottom: 'none',
17193
+ borderInlineEnd: column.getCanResize() ? `1px solid ${theme_0.palette.divider}` : undefined,
16589
17194
  paddingBottom: 'none',
16590
17195
  ...getCommonMRTCellStyles({
16591
17196
  column,
@@ -16638,8 +17243,12 @@ const MRT_TableHeadCell = ({
16638
17243
  header: header,
16639
17244
  table: table,
16640
17245
  sx: {
16641
- // Show sort label when the cell is hovered or the column is actively sorted
16642
- visibility: isColumnCellHovered || column.getIsSorted() ? 'visible' : 'hidden'
17246
+ // Show sort label when the cell is hovered or the column is actively sorted.
17247
+ // The label's own `flex: '0 0'`/`width: '3ch'` defaults would otherwise
17248
+ // permanently reserve that space even while hidden — collapsing width to 0
17249
+ // here gives the header text that room while the icon isn't shown.
17250
+ visibility: isColumnCellHovered || column.getIsSorted() ? 'visible' : 'hidden',
17251
+ width: isColumnCellHovered || column.getIsSorted() ? '3ch' : 0
16643
17252
  }
16644
17253
  })]
16645
17254
  }), columnDefType !== 'group' && /*#__PURE__*/jsxRuntime.jsxs(Box, {
@@ -16650,9 +17259,11 @@ const MRT_TableHeadCell = ({
16650
17259
  flexDirection: 'row',
16651
17260
  alignItems: 'center',
16652
17261
  gap: '0.5rem',
16653
- width: isColumnCellHovered ? 'auto' : 0,
17262
+ // Keep the checkbox menu in one position when hover ends.
17263
+ width: isCheckboxColumn || isColumnCellHovered ? 'auto' : 0,
17264
+ flexShrink: isCheckboxColumn ? 0 : undefined,
16654
17265
  visibility: isColumnCellHovered ? 'visible' : 'hidden',
16655
- px: isColumnCellHovered ? '0.2rem' : 0
17266
+ px: isCheckboxColumn || isColumnCellHovered ? '0.2rem' : 0
16656
17267
  },
16657
17268
  children: [showColumnActions && /*#__PURE__*/jsxRuntime.jsx(MRT_TableHeadCellColumnActionsButton, {
16658
17269
  header: header,
@@ -16929,7 +17540,7 @@ const MRT_Table = ({
16929
17540
  // changes — this is the reactive boundary that makes that happen instead of
16930
17541
  // relying on a root cascade re-render.
16931
17542
  reactStore.useSelector(table.atoms.columnOrder);
16932
- reactStore.useSelector(table.atoms.columnPinning);
17543
+ const columnPinning = reactStore.useSelector(table.atoms.columnPinning);
16933
17544
  const density = reactStore.useSelector(table.store, state => state.density);
16934
17545
  const tableProps = {
16935
17546
  ...parseFromValuesOrFunc(muiTableProps, {
@@ -16951,38 +17562,36 @@ const MRT_Table = ({
16951
17562
  for (let i = 0; i < headers.length; i++) {
16952
17563
  const header = headers[i];
16953
17564
  const colSize = header.getSize();
17565
+ colSizes[`--col-${parseCSSVarId(header.column.id)}-grow`] = getColumnGrowWeight(header.column, table);
16954
17566
  colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
16955
17567
  colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
16956
17568
  }
16957
17569
  return colSizes;
16958
- }, [columns, columnVisibility]);
17570
+ }, [columns, columnVisibility, columnPinning]);
16959
17571
 
16960
17572
  // Keeps the CSS size vars in sync with columnSizing after mount, without
16961
17573
  // subscribing this component to it (see comment above columnVisibility).
16962
17574
  react.useEffect(() => {
16963
- const subscription = table.atoms.columnSizing.subscribe(() => {
17575
+ const syncColumnSizing = () => {
16964
17576
  const node = tableRef.current;
16965
17577
  if (!node) return;
16966
17578
  const headers_0 = getFlatHeaders();
16967
17579
  for (let i_0 = 0; i_0 < headers_0.length; i_0++) {
16968
17580
  const header_0 = headers_0[i_0];
16969
17581
  const colSize_0 = header_0.getSize();
17582
+ node.style.setProperty(`--col-${parseCSSVarId(header_0.column.id)}-grow`, `${getColumnGrowWeight(header_0.column, table)}`);
16970
17583
  node.style.setProperty(`--header-${parseCSSVarId(header_0.id)}-size`, `${colSize_0}`);
16971
17584
  node.style.setProperty(`--col-${parseCSSVarId(header_0.column.id)}-size`, `${colSize_0}`);
16972
17585
  }
16973
- });
17586
+ };
17587
+ syncColumnSizing();
17588
+ const subscription = table.atoms.columnSizing.subscribe(syncColumnSizing);
16974
17589
  return () => subscription.unsubscribe();
16975
- }, [table]);
17590
+ }, [table, columns, columnVisibility, columnPinning]);
16976
17591
 
16977
17592
  // Padding values keyed off density, read by cell/header/footer sx so density toggles
16978
17593
  // reuse existing emotion classes instead of generating new ones per cell.
16979
- const densityVars = react.useMemo(() => ({
16980
- '--mrt-cell-p': density === 'compact' ? '0.5rem' : density === 'comfortable' ? '1rem' : '1.5rem',
16981
- '--mrt-display-cell-p': density === 'compact' ? '0 0.5rem' : density === 'comfortable' ? '0.5rem 0.75rem' : '1rem 1.25rem',
16982
- '--mrt-head-display-cell-p': density === 'compact' ? '0.5rem' : density === 'comfortable' ? '0.75rem' : '1rem 1.25rem',
16983
- '--mrt-head-cell-pb': density === 'compact' ? '0.4rem' : '0.6rem',
16984
- '--mrt-head-cell-pt': density === 'compact' ? '0.25rem' : density === 'comfortable' ? '.75rem' : '1.25rem'
16985
- }), [density]);
17594
+ const densityVars = react.useMemo(() => getDensityStyles(density), [density]);
16986
17595
  const columnVirtualizer = useMRT_ColumnVirtualizer(table);
16987
17596
  const commonTableGroupProps = {
16988
17597
  columnVirtualizer,
@@ -17357,6 +17966,8 @@ const MRT_TableContainer = ({
17357
17966
  table: table
17358
17967
  }), /*#__PURE__*/jsxRuntime.jsx(MRT_Table, {
17359
17968
  table: table
17969
+ }), /*#__PURE__*/jsxRuntime.jsx(MRT_AutoSizeColumnsEffect, {
17970
+ table: table
17360
17971
  }), newEntryModal.open && /*#__PURE__*/jsxRuntime.jsx(react.Suspense, {
17361
17972
  fallback: null,
17362
17973
  children: /*#__PURE__*/jsxRuntime.jsx(MRT_NewEntryModal$2, {
@@ -18019,6 +18630,7 @@ const buildInitialExportState = (availableExports, savedActiveExports) => {
18019
18630
 
18020
18631
  const MaterialReactServerTableInstanceComponent = ({
18021
18632
  config,
18633
+ paginationMode = 'pages',
18022
18634
  loadData,
18023
18635
  saveState,
18024
18636
  getAllSelectableRowIds,
@@ -18040,11 +18652,9 @@ const MaterialReactServerTableInstanceComponent = ({
18040
18652
  }, ref) => {
18041
18653
  const [pageCount, setPageCount] = react.useState(undefined);
18042
18654
  const [rowCount, setRowCount] = react.useState(0);
18043
- const [isLoading, setIsLoading] = react.useState(false);
18044
- // Skeletons only until the first data arrives. On later refetches (filter, sort, paging)
18045
- // the current rows stay visible with a progress bar - swapping every cell to a Skeleton
18046
- // and back remounts the whole table body twice per refetch.
18655
+ const [isLoading, setIsLoading] = react.useState(true);
18047
18656
  const [hasLoadedOnce, setHasLoadedOnce] = react.useState(false);
18657
+ const infinite = paginationMode === 'infinite';
18048
18658
 
18049
18659
  // Filter availableExports by exportPermissions if provided.
18050
18660
  // exportPermissions maps export key → required permission strings.
@@ -18071,6 +18681,11 @@ const MaterialReactServerTableInstanceComponent = ({
18071
18681
  } = useServerTableState({
18072
18682
  initialState: {
18073
18683
  ...config.initialState,
18684
+ density: tableOptionsOverrides.initialState?.density ?? config.initialState?.density ?? 'compact',
18685
+ pagination: {
18686
+ pageIndex: infinite ? 0 : config.initialState?.pagination?.pageIndex ?? 0,
18687
+ pageSize: config.initialState?.pagination?.pageSize ?? 10
18688
+ },
18074
18689
  activeExports: buildInitialExportState(allowedExports, config.initialState?.activeExports)
18075
18690
  },
18076
18691
  saveState
@@ -18091,6 +18706,7 @@ const MaterialReactServerTableInstanceComponent = ({
18091
18706
  manualFiltering: true,
18092
18707
  manualPagination: true,
18093
18708
  manualSorting: true,
18709
+ enableRowVirtualization: infinite,
18094
18710
  enableRowPinning: false,
18095
18711
  getRowId: originalRow => originalRow.id,
18096
18712
  state: {
@@ -18118,7 +18734,9 @@ const MaterialReactServerTableInstanceComponent = ({
18118
18734
  rowsPerPageOptions: config.rowsPerPageOptions
18119
18735
  },
18120
18736
  ...tableOptionsOverrides,
18121
- ...handlers
18737
+ ...handlers,
18738
+ enablePagination: infinite ? false : tableOptionsOverrides.enablePagination ?? true,
18739
+ positionProgressBars: tableOptionsOverrides.positionProgressBars ?? (infinite ? 'bottom' : 'header')
18122
18740
  });
18123
18741
 
18124
18742
  // Lets any code that already has `table` (row actions, deleteRowsFn/editRowFn,
@@ -18156,41 +18774,40 @@ const MaterialReactServerTableInstanceComponent = ({
18156
18774
  setRowCount(prev_0 => prev_0 + insertedCount);
18157
18775
  }
18158
18776
  };
18159
- const fetchData = react.useCallback(async tableInstance => {
18160
- setIsLoading(true);
18161
- try {
18162
- const {
18163
- data: newData,
18164
- rowCount: newRowCount,
18165
- hasNextPage
18166
- } = await loadData(tableInstance.getState());
18167
- tableInstance.setRows(newData);
18168
- setHasLoadedOnce(true);
18169
- if (hasNextPage) {
18170
- setPageCount(-1);
18171
- setRowCount(0);
18172
- } else {
18173
- setPageCount(undefined);
18174
- setRowCount(newRowCount);
18175
- }
18176
- } finally {
18177
- setIsLoading(false);
18777
+ const loader = useMRT_ServerDataLoader({
18778
+ table,
18779
+ loadData,
18780
+ paginationMode,
18781
+ fetchTrigger,
18782
+ onLoadingChange: setIsLoading,
18783
+ onLoaded: () => setHasLoadedOnce(true),
18784
+ onResult: result => {
18785
+ setPageCount(result.hasNextPage ? -1 : undefined);
18786
+ setRowCount(result.hasNextPage && !result.rowCount ? 0 : result.rowCount);
18178
18787
  }
18179
- }, [loadData]);
18180
- react.useEffect(() => {
18181
- void fetchData(table);
18182
- // `table` is deliberately excluded from these deps. v9's useTable()
18183
- // memoizes its returned wrapper on the options object identity
18184
- // (see @tanstack/react-table's useTable.ts), and useMRT_TableInstance
18185
- // builds a fresh options object every render — so `table` is a new
18186
- // reference on every render regardless of whether anything relevant
18187
- // changed. Including it here would re-fire this data-fetching effect on
18188
- // every render (any unrelated state change anywhere in the tree),
18189
- // which triggers setRows/setIsLoading, causing another render, another
18190
- // new `table`, and an infinite fetch loop. The effect body always closes
18191
- // over the current render's `table`, so omitting it from deps only
18192
- // changes *when* the effect reruns, not what it reads when it does.
18193
- }, [fetchData, fetchTrigger.filterRules, fetchTrigger.pagination, fetchTrigger.sorting, fetchTrigger.columnVisibilityShowTrigger, fetchTrigger.refetchIndex]);
18788
+ });
18789
+ const userContainerProps = tableOptionsOverrides.muiTableContainerProps;
18790
+ table.options.muiTableContainerProps = props_0 => {
18791
+ const userProps = parseFromValuesOrFunc(userContainerProps, props_0);
18792
+ return {
18793
+ ...userProps,
18794
+ onScroll: event => {
18795
+ userProps?.onScroll?.(event);
18796
+ if (infinite) loader.checkScroll(event.currentTarget);
18797
+ }
18798
+ };
18799
+ };
18800
+ const customBottomActions = tableOptionsOverrides.renderBottomToolbarCustomActions;
18801
+ table.options.renderBottomToolbarCustomActions = props_1 => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
18802
+ children: [customBottomActions?.(props_1), loader.error && /*#__PURE__*/jsxRuntime.jsx(Alert, {
18803
+ severity: "error",
18804
+ action: /*#__PURE__*/jsxRuntime.jsx(Button, {
18805
+ onClick: () => void loader.retry(),
18806
+ children: table.options.localization.retryLoading ?? 'Retry'
18807
+ }),
18808
+ children: table.options.localization.errorMessage
18809
+ })]
18810
+ });
18194
18811
  react.useImperativeHandle(ref, () => ({
18195
18812
  refetch,
18196
18813
  table
@@ -18207,11 +18824,15 @@ const GHOST_COLUMNS = Array.from({
18207
18824
  id: `${i}`
18208
18825
  }));
18209
18826
  const HEADER_BAR_WIDTHS = [55, 40, 65, 45, 60, 35];
18210
- const MaterialReactServerTableSkeleton = () => {
18211
- const $ = compilerRuntime.c(6);
18212
- let t0;
18827
+ const MaterialReactServerTableSkeleton = t0 => {
18828
+ const $ = compilerRuntime.c(21);
18829
+ const {
18830
+ density: t1
18831
+ } = t0;
18832
+ const density = t1 === undefined ? "compact" : t1;
18833
+ let t2;
18213
18834
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
18214
- t0 = {
18835
+ t2 = {
18215
18836
  display: "flex",
18216
18837
  flexDirection: "column",
18217
18838
  height: "100%",
@@ -18219,13 +18840,13 @@ const MaterialReactServerTableSkeleton = () => {
18219
18840
  animation: mrtDelayedFadeIn
18220
18841
  }
18221
18842
  };
18222
- $[0] = t0;
18843
+ $[0] = t2;
18223
18844
  } else {
18224
- t0 = $[0];
18845
+ t2 = $[0];
18225
18846
  }
18226
- let t1;
18847
+ let t3;
18227
18848
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
18228
- t1 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
18849
+ t3 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
18229
18850
  sx: {
18230
18851
  alignItems: "center",
18231
18852
  display: "flex",
@@ -18253,15 +18874,15 @@ const MaterialReactServerTableSkeleton = () => {
18253
18874
  width: 135
18254
18875
  })]
18255
18876
  });
18256
- $[1] = t1;
18877
+ $[1] = t3;
18257
18878
  } else {
18258
- t1 = $[1];
18879
+ t3 = $[1];
18259
18880
  }
18260
- let t2;
18881
+ let t4;
18261
18882
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
18262
- t2 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
18883
+ t4 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
18263
18884
  sx: _temp$6,
18264
- children: [t1, /*#__PURE__*/jsxRuntime.jsx(Box, {
18885
+ children: [t3, /*#__PURE__*/jsxRuntime.jsx(Box, {
18265
18886
  sx: {
18266
18887
  alignItems: "center",
18267
18888
  display: "flex",
@@ -18275,91 +18896,179 @@ const MaterialReactServerTableSkeleton = () => {
18275
18896
  })
18276
18897
  })]
18277
18898
  });
18278
- $[2] = t2;
18899
+ $[2] = t4;
18279
18900
  } else {
18280
- t2 = $[2];
18901
+ t4 = $[2];
18281
18902
  }
18282
- let t3;
18903
+ let t5;
18283
18904
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
18284
- t3 = {
18905
+ t5 = {
18285
18906
  flex: 1,
18286
18907
  overflow: "hidden"
18287
18908
  };
18288
- $[3] = t3;
18909
+ $[3] = t5;
18289
18910
  } else {
18290
- t3 = $[3];
18911
+ t5 = $[3];
18291
18912
  }
18292
- let t4;
18293
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
18294
- t4 = /*#__PURE__*/jsxRuntime.jsx(Box, {
18295
- sx: t3,
18296
- children: /*#__PURE__*/jsxRuntime.jsxs(Box, {
18297
- component: "table",
18298
- sx: _temp2$3,
18299
- children: [/*#__PURE__*/jsxRuntime.jsx("thead", {
18300
- "aria-hidden": true,
18301
- children: /*#__PURE__*/jsxRuntime.jsx("tr", {
18302
- children: GHOST_COLUMNS.map(_temp3$1)
18303
- })
18304
- }), /*#__PURE__*/jsxRuntime.jsx("tbody", {
18305
- children: /*#__PURE__*/jsxRuntime.jsx(MRT_GhostRows, {
18306
- cells: GHOST_COLUMNS,
18307
- rowHeight: 37
18308
- })
18309
- })]
18310
- })
18913
+ let t6;
18914
+ if ($[4] !== density) {
18915
+ t6 = theme_0 => ({
18916
+ ...getDensityStyles(density),
18917
+ borderCollapse: "collapse",
18918
+ tableLayout: "fixed",
18919
+ width: "100%",
18920
+ "& th": {
18921
+ borderBottom: `1px solid ${theme_0.palette.divider}`,
18922
+ fontSize: 14,
18923
+ p: "var(--mrt-cell-p)",
18924
+ pt: "var(--mrt-head-cell-pt)",
18925
+ pb: "var(--mrt-head-cell-pb)",
18926
+ textAlign: "left"
18927
+ },
18928
+ "& th span": {
18929
+ backgroundColor: styles.alpha(theme_0.palette.text.primary, 0.16),
18930
+ borderRadius: 999,
18931
+ display: "block",
18932
+ height: 12
18933
+ }
18311
18934
  });
18312
- $[4] = t4;
18935
+ $[4] = density;
18936
+ $[5] = t6;
18313
18937
  } else {
18314
- t4 = $[4];
18938
+ t6 = $[5];
18315
18939
  }
18316
- let t5;
18317
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
18318
- t5 = /*#__PURE__*/jsxRuntime.jsxs(Paper, {
18319
- "data-testid": "server-table-skeleton",
18320
- sx: t0,
18321
- children: [t2, t4, /*#__PURE__*/jsxRuntime.jsx(Box, {
18322
- sx: _temp4,
18323
- children: /*#__PURE__*/jsxRuntime.jsxs(Box, {
18940
+ let t7;
18941
+ if ($[6] !== density) {
18942
+ t7 = GHOST_COLUMNS.map((t8, i) => {
18943
+ const {
18944
+ id
18945
+ } = t8;
18946
+ return /*#__PURE__*/jsxRuntime.jsx("th", {
18947
+ children: /*#__PURE__*/jsxRuntime.jsx(Box, {
18324
18948
  sx: {
18325
18949
  alignItems: "center",
18326
18950
  display: "flex",
18327
- gap: "1rem"
18951
+ height: density === "compact" ? "1.75rem" : "1.5em"
18328
18952
  },
18329
- children: [/*#__PURE__*/jsxRuntime.jsx(Skeleton, {
18330
- animation: "pulse",
18331
- height: 36,
18332
- variant: "rounded",
18333
- width: 136
18334
- }), /*#__PURE__*/jsxRuntime.jsx(Skeleton, {
18335
- animation: "pulse",
18336
- height: 31,
18337
- variant: "text",
18338
- width: 176
18339
- }), /*#__PURE__*/jsxRuntime.jsx(Skeleton, {
18340
- animation: "pulse",
18341
- height: 22,
18342
- variant: "text",
18343
- width: 70
18344
- }), /*#__PURE__*/jsxRuntime.jsx(Skeleton, {
18345
- animation: "pulse",
18346
- height: 24,
18347
- variant: "circular",
18348
- width: 24
18349
- }), /*#__PURE__*/jsxRuntime.jsx(Skeleton, {
18350
- animation: "pulse",
18351
- height: 24,
18352
- variant: "circular",
18353
- width: 24
18354
- })]
18953
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
18954
+ style: {
18955
+ width: `${HEADER_BAR_WIDTHS[i]}%`
18956
+ }
18957
+ })
18355
18958
  })
18356
- })]
18959
+ }, id);
18357
18960
  });
18358
- $[5] = t5;
18961
+ $[6] = density;
18962
+ $[7] = t7;
18359
18963
  } else {
18360
- t5 = $[5];
18964
+ t7 = $[7];
18361
18965
  }
18362
- return t5;
18966
+ let t8;
18967
+ if ($[8] !== t7) {
18968
+ t8 = /*#__PURE__*/jsxRuntime.jsx("thead", {
18969
+ "aria-hidden": true,
18970
+ children: /*#__PURE__*/jsxRuntime.jsx("tr", {
18971
+ children: t7
18972
+ })
18973
+ });
18974
+ $[8] = t7;
18975
+ $[9] = t8;
18976
+ } else {
18977
+ t8 = $[9];
18978
+ }
18979
+ let t9;
18980
+ if ($[10] !== density) {
18981
+ t9 = getDefaultRowHeight(density);
18982
+ $[10] = density;
18983
+ $[11] = t9;
18984
+ } else {
18985
+ t9 = $[11];
18986
+ }
18987
+ let t10;
18988
+ if ($[12] !== t9) {
18989
+ t10 = /*#__PURE__*/jsxRuntime.jsx("tbody", {
18990
+ children: /*#__PURE__*/jsxRuntime.jsx(MRT_GhostRows, {
18991
+ cells: GHOST_COLUMNS,
18992
+ rowHeight: t9
18993
+ })
18994
+ });
18995
+ $[12] = t9;
18996
+ $[13] = t10;
18997
+ } else {
18998
+ t10 = $[13];
18999
+ }
19000
+ let t11;
19001
+ if ($[14] !== t10 || $[15] !== t6 || $[16] !== t8) {
19002
+ t11 = /*#__PURE__*/jsxRuntime.jsx(Box, {
19003
+ sx: t5,
19004
+ children: /*#__PURE__*/jsxRuntime.jsxs(Box, {
19005
+ component: "table",
19006
+ sx: t6,
19007
+ children: [t8, t10]
19008
+ })
19009
+ });
19010
+ $[14] = t10;
19011
+ $[15] = t6;
19012
+ $[16] = t8;
19013
+ $[17] = t11;
19014
+ } else {
19015
+ t11 = $[17];
19016
+ }
19017
+ let t12;
19018
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
19019
+ t12 = /*#__PURE__*/jsxRuntime.jsx(Box, {
19020
+ sx: _temp2$3,
19021
+ children: /*#__PURE__*/jsxRuntime.jsxs(Box, {
19022
+ sx: {
19023
+ alignItems: "center",
19024
+ display: "flex",
19025
+ gap: "1rem"
19026
+ },
19027
+ children: [/*#__PURE__*/jsxRuntime.jsx(Skeleton, {
19028
+ animation: "pulse",
19029
+ height: 36,
19030
+ variant: "rounded",
19031
+ width: 136
19032
+ }), /*#__PURE__*/jsxRuntime.jsx(Skeleton, {
19033
+ animation: "pulse",
19034
+ height: 31,
19035
+ variant: "text",
19036
+ width: 176
19037
+ }), /*#__PURE__*/jsxRuntime.jsx(Skeleton, {
19038
+ animation: "pulse",
19039
+ height: 22,
19040
+ variant: "text",
19041
+ width: 70
19042
+ }), /*#__PURE__*/jsxRuntime.jsx(Skeleton, {
19043
+ animation: "pulse",
19044
+ height: 24,
19045
+ variant: "circular",
19046
+ width: 24
19047
+ }), /*#__PURE__*/jsxRuntime.jsx(Skeleton, {
19048
+ animation: "pulse",
19049
+ height: 24,
19050
+ variant: "circular",
19051
+ width: 24
19052
+ })]
19053
+ })
19054
+ });
19055
+ $[18] = t12;
19056
+ } else {
19057
+ t12 = $[18];
19058
+ }
19059
+ let t13;
19060
+ if ($[19] !== t11) {
19061
+ t13 = /*#__PURE__*/jsxRuntime.jsxs(Paper, {
19062
+ "data-testid": "server-table-skeleton",
19063
+ sx: t2,
19064
+ children: [t4, t11, t12]
19065
+ });
19066
+ $[19] = t11;
19067
+ $[20] = t13;
19068
+ } else {
19069
+ t13 = $[20];
19070
+ }
19071
+ return t13;
18363
19072
  };
18364
19073
  function _temp$6(theme) {
18365
19074
  return {
@@ -18372,38 +19081,7 @@ function _temp$6(theme) {
18372
19081
  paddingRight: "0.3rem"
18373
19082
  };
18374
19083
  }
18375
- function _temp2$3(theme_0) {
18376
- return {
18377
- borderCollapse: "collapse",
18378
- tableLayout: "fixed",
18379
- width: "100%",
18380
- "& th": {
18381
- borderBottom: `1px solid ${theme_0.palette.divider}`,
18382
- height: 48,
18383
- p: "0.5rem",
18384
- textAlign: "left"
18385
- },
18386
- "& th > span": {
18387
- backgroundColor: styles.alpha(theme_0.palette.text.primary, 0.16),
18388
- borderRadius: 999,
18389
- display: "block",
18390
- height: 12
18391
- }
18392
- };
18393
- }
18394
- function _temp3$1(t0, i) {
18395
- const {
18396
- id
18397
- } = t0;
18398
- return /*#__PURE__*/jsxRuntime.jsx("th", {
18399
- children: /*#__PURE__*/jsxRuntime.jsx("span", {
18400
- style: {
18401
- width: `${HEADER_BAR_WIDTHS[i]}%`
18402
- }
18403
- })
18404
- }, id);
18405
- }
18406
- function _temp4(theme_1) {
19084
+ function _temp2$3(theme_1) {
18407
19085
  return {
18408
19086
  alignItems: "center",
18409
19087
  borderTop: `1px solid ${theme_1.palette.divider}`,
@@ -18448,7 +19126,9 @@ const MaterialReactServerTableComponent = ({
18448
19126
  };
18449
19127
  }, [loadConfig]);
18450
19128
  if (configLoading) {
18451
- return /*#__PURE__*/jsxRuntime.jsx(MaterialReactServerTableSkeleton, {});
19129
+ return /*#__PURE__*/jsxRuntime.jsx(MaterialReactServerTableSkeleton, {
19130
+ density: instanceProps.state?.density ?? instanceProps.initialState?.density ?? 'compact'
19131
+ });
18452
19132
  }
18453
19133
  if (!config) {
18454
19134
  return /*#__PURE__*/jsxRuntime.jsx(MaterialReactServerTableError, {
@@ -20188,7 +20868,7 @@ exports.MRT_NewEntryModal = MRT_NewEntryModal;
20188
20868
  exports.MRT_PaginationBoundsEffect = MRT_PaginationBoundsEffect;
20189
20869
  exports.MRT_RowActionMenu = MRT_RowActionMenu;
20190
20870
  exports.MRT_RowPinButton = MRT_RowPinButton;
20191
- exports.MRT_SelectAllMenu = MRT_SelectAllMenu;
20871
+ exports.MRT_SelectAllMenuItems = MRT_SelectAllMenuItems;
20192
20872
  exports.MRT_SelectCheckbox = MRT_SelectCheckbox;
20193
20873
  exports.MRT_SelectionCountBadge = MRT_SelectionCountBadge;
20194
20874
  exports.MRT_ShowHideColumnsButton = MRT_ShowHideColumnsButton;
@@ -20237,9 +20917,9 @@ exports.createRow = createRow;
20237
20917
  exports.defaultDisplayColumnProps = defaultDisplayColumnProps;
20238
20918
  exports.flexRender = flexRender;
20239
20919
  exports.getAllLeafColumnDefs = getAllLeafColumnDefs;
20920
+ exports.getAutoSizeCandidateColumnIds = getAutoSizeCandidateColumnIds;
20240
20921
  exports.getColumnId = getColumnId;
20241
20922
  exports.getDefaultColumnOrderIds = getDefaultColumnOrderIds;
20242
- exports.getDefaultColumnPinningState = getDefaultColumnPinningState;
20243
20923
  exports.getIsAllPagesSelectionActive = getIsAllPagesSelectionActive;
20244
20924
  exports.getIsRowSelected = getIsRowSelected;
20245
20925
  exports.getLeadingDisplayColumnIds = getLeadingDisplayColumnIds;