@dooherceg/material-react-table 4.1.4 → 4.1.5

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
@@ -574,13 +574,20 @@ const getCommonMRTCellStyles = ({
574
574
  } = columnDef;
575
575
  const isColumnPinned = columnDef.columnDefType !== 'group' && column.getIsPinned();
576
576
  const widthStyles = {
577
+ maxWidth: `${columnDef.maxSize ?? 1000}px`,
577
578
  minWidth: `max(calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size) * 1px), ${columnDef.minSize ?? 30}px)`,
578
579
  width: `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size) * 1px)`
579
580
  };
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`;
581
+ if (layoutMode === 'grid' || layoutMode === 'grid-no-grow') {
582
+ // `grow: false`/`0` opts a column out of the fit entirely (fixed width, e.g. for
583
+ // pinned columns so their sticky offsets don't shift); an explicit positive number
584
+ // is used as a custom weight; otherwise (the common case — no `grow` set) every
585
+ // other column shares leftover/deficit row width weighted by its own size, so a
586
+ // handful of columns fill a wide viewport evenly, and widening one via resize
587
+ // shrinks the others to keep the row's total width pinned to the container — all
588
+ // through native flexbox, no JS redistribution needed.
589
+ const weight = isColumnPinned ? 0 : [0, false].includes(columnDef.grow) ? 0 : typeof columnDef.grow === 'number' ? columnDef.grow : `var(--${header ? 'header' : 'col'}-${parseCSSVarId(header?.id ?? column.id)}-size)`;
590
+ widthStyles.flex = `${weight} ${weight} auto`;
584
591
  }
585
592
 
586
593
  // The checkbox column is technically pinned (for sticky positioning) but
@@ -2144,6 +2151,14 @@ const getMRT_RowActionsColumnDef = tableOptions => {
2144
2151
  staticRowIndex: staticRowIndex,
2145
2152
  table: table
2146
2153
  }),
2154
+ ...(tableOptions.positionActionsColumn === 'last' && {
2155
+ grow: true,
2156
+ muiTableBodyCellProps: {
2157
+ sx: {
2158
+ minWidth: 'max-content'
2159
+ }
2160
+ }
2161
+ }),
2147
2162
  ...defaultDisplayColumnProps({
2148
2163
  header: 'actions',
2149
2164
  id: 'mrt-row-actions',
@@ -4205,7 +4220,7 @@ const getMRT_RowSpacerColumnDef = tableOptions => {
4205
4220
  size: 0,
4206
4221
  tableOptions
4207
4222
  }),
4208
- grow: true,
4223
+ grow: !(tableOptions.positionActionsColumn === 'last' && showRowActionsColumn(tableOptions)),
4209
4224
  ...MRT_DefaultDisplayColumn,
4210
4225
  muiTableBodyCellProps: blankColProps,
4211
4226
  muiTableFooterCellProps: blankColProps,
@@ -5329,8 +5344,8 @@ const BooleanActiveFilterItem = (table, rule) => {
5329
5344
  var BooleanActiveFilterItem$1 = BooleanActiveFilterItem;
5330
5345
 
5331
5346
  // 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.
5347
+ // Used for 'isAnyOf' on string and number columns.
5348
+ // Enter and blur both add the typed entry; the result is stored as an array.
5334
5349
  const MRT_FreeMultiValueEditor = t0 => {
5335
5350
  const $ = compilerRuntime.c(9);
5336
5351
  const {
@@ -5370,6 +5385,7 @@ const MRT_FreeMultiValueEditor = t0 => {
5370
5385
  let t4;
5371
5386
  if ($[6] !== displayValues || $[7] !== handleChange) {
5372
5387
  t4 = /*#__PURE__*/jsxRuntime.jsx(Autocomplete, {
5388
+ autoSelect: true,
5373
5389
  freeSolo: true,
5374
5390
  multiple: true,
5375
5391
  options: t3,
@@ -8376,7 +8392,8 @@ const NumberColumnResolver = {
8376
8392
  id: 'isAnyOf',
8377
8393
  isValueEmpty: value => !Array.isArray(value) || value.length === 0,
8378
8394
  label: 'Is Any Of',
8379
- triggerMode: 'commit',
8395
+ // The editor reports changes when a chip is added or removed.
8396
+ triggerMode: 'change',
8380
8397
  valueShape: 'multi'
8381
8398
  }],
8382
8399
  getFormFieldRenderer: (column, _table) => {
@@ -8560,7 +8577,8 @@ const StringColumnResolver = {
8560
8577
  id: 'isAnyOf',
8561
8578
  isValueEmpty: value => !Array.isArray(value) || value.length === 0,
8562
8579
  label: 'Is Any Of',
8563
- triggerMode: 'commit',
8580
+ // The editor reports changes when a chip is added or removed.
8581
+ triggerMode: 'change',
8564
8582
  valueShape: 'multi'
8565
8583
  }],
8566
8584
  getFormFieldRenderer: (column, _table) => {
@@ -11417,7 +11435,7 @@ const MRT_BottomToolbar = ({
11417
11435
 
11418
11436
  // Renders a single pinned quick filter: label strip with unpin button + the operator's editor.
11419
11437
  const MRT_QuickFilterItem = t0 => {
11420
- const $ = compilerRuntime.c(52);
11438
+ const $ = compilerRuntime.c(60);
11421
11439
  const {
11422
11440
  column,
11423
11441
  operator,
@@ -11541,105 +11559,134 @@ const MRT_QuickFilterItem = t0 => {
11541
11559
  }
11542
11560
  const handleUnpin = t9;
11543
11561
  const columnLabel = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
11544
- const T0 = Box;
11545
11562
  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;
11563
+ if ($[19] !== commitValue || $[20] !== localValue || $[21] !== operator || $[22] !== rule?.value) {
11564
+ t10 = () => {
11565
+ const committedValue_0 = rule?.value ?? operator.getInitialValue();
11566
+ if (!Object.is(localValue, committedValue_0)) {
11567
+ commitValue(localValue);
11568
+ }
11569
+ };
11570
+ $[19] = commitValue;
11571
+ $[20] = localValue;
11572
+ $[21] = operator;
11573
+ $[22] = rule?.value;
11574
+ $[23] = t10;
11552
11575
  } else {
11553
- t10 = $[19];
11554
- t11 = $[20];
11576
+ t10 = $[23];
11555
11577
  }
11578
+ const commitLocalValue = t10;
11579
+ const T0 = Box;
11580
+ let t11;
11556
11581
  let t12;
11557
- if ($[21] !== commitValue || $[22] !== isTriggerModeCommit || $[23] !== localValue) {
11558
- t12 = isTriggerModeCommit ? event => {
11582
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
11583
+ t11 = () => setIsHovered(true);
11584
+ t12 = () => setIsHovered(false);
11585
+ $[24] = t11;
11586
+ $[25] = t12;
11587
+ } else {
11588
+ t11 = $[24];
11589
+ t12 = $[25];
11590
+ }
11591
+ let t13;
11592
+ if ($[26] !== commitLocalValue || $[27] !== isTriggerModeCommit) {
11593
+ t13 = isTriggerModeCommit ? event => {
11559
11594
  if (event.key === "Enter") {
11560
- commitValue(localValue);
11595
+ commitLocalValue();
11561
11596
  }
11562
11597
  } : undefined;
11563
- $[21] = commitValue;
11564
- $[22] = isTriggerModeCommit;
11565
- $[23] = localValue;
11566
- $[24] = t12;
11598
+ $[26] = commitLocalValue;
11599
+ $[27] = isTriggerModeCommit;
11600
+ $[28] = t13;
11567
11601
  } else {
11568
- t12 = $[24];
11602
+ t13 = $[28];
11569
11603
  }
11570
- let t13;
11571
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
11572
- t13 = {
11604
+ let t14;
11605
+ if ($[29] !== commitLocalValue || $[30] !== isTriggerModeCommit) {
11606
+ t14 = isTriggerModeCommit ? event_0 => {
11607
+ if (!event_0.currentTarget.contains(event_0.relatedTarget)) {
11608
+ commitLocalValue();
11609
+ }
11610
+ } : undefined;
11611
+ $[29] = commitLocalValue;
11612
+ $[30] = isTriggerModeCommit;
11613
+ $[31] = t14;
11614
+ } else {
11615
+ t14 = $[31];
11616
+ }
11617
+ let t15;
11618
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
11619
+ t15 = {
11573
11620
  display: "flex",
11574
11621
  flexDirection: "column",
11575
11622
  gap: 0.5,
11576
11623
  position: "relative"
11577
11624
  };
11578
- $[25] = t13;
11625
+ $[32] = t15;
11579
11626
  } else {
11580
- t13 = $[25];
11627
+ t15 = $[32];
11581
11628
  }
11582
- let t14;
11583
- if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
11584
- t14 = {
11629
+ let t16;
11630
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
11631
+ t16 = {
11585
11632
  alignItems: "center",
11586
11633
  display: "flex"
11587
11634
  };
11588
- $[26] = t14;
11635
+ $[33] = t16;
11589
11636
  } else {
11590
- t14 = $[26];
11637
+ t16 = $[33];
11591
11638
  }
11592
- let t15;
11593
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
11594
- t15 = {
11639
+ let t17;
11640
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
11641
+ t17 = {
11595
11642
  color: "text.secondary",
11596
11643
  fontSize: 11,
11597
11644
  fontWeight: 500,
11598
11645
  lineHeight: 1
11599
11646
  };
11600
- $[27] = t15;
11647
+ $[34] = t17;
11601
11648
  } else {
11602
- t15 = $[27];
11649
+ t17 = $[34];
11603
11650
  }
11604
- let t16;
11605
- if ($[28] !== columnLabel) {
11606
- t16 = /*#__PURE__*/jsxRuntime.jsx(Box, {
11651
+ let t18;
11652
+ if ($[35] !== columnLabel) {
11653
+ t18 = /*#__PURE__*/jsxRuntime.jsx(Box, {
11607
11654
  component: "span",
11608
- sx: t15,
11655
+ sx: t17,
11609
11656
  children: columnLabel
11610
11657
  });
11611
- $[28] = columnLabel;
11612
- $[29] = t16;
11658
+ $[35] = columnLabel;
11659
+ $[36] = t18;
11613
11660
  } else {
11614
- t16 = $[29];
11661
+ t18 = $[36];
11615
11662
  }
11616
- let t17;
11617
- if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
11618
- t17 = {
11663
+ let t19;
11664
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
11665
+ t19 = {
11619
11666
  color: "text.disabled",
11620
11667
  fontSize: 11,
11621
11668
  lineHeight: 1
11622
11669
  };
11623
- $[30] = t17;
11670
+ $[37] = t19;
11624
11671
  } else {
11625
- t17 = $[30];
11672
+ t19 = $[37];
11626
11673
  }
11627
- const t18 = `${operatorLabel.toLowerCase()}`;
11628
- let t19;
11629
- if ($[31] !== t18) {
11630
- t19 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
11674
+ const t20 = `${operatorLabel.toLowerCase()}`;
11675
+ let t21;
11676
+ if ($[38] !== t20) {
11677
+ t21 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
11631
11678
  component: "span",
11632
- sx: t17,
11633
- children: ["\xA0", t18]
11679
+ sx: t19,
11680
+ children: ["\xA0", t20]
11634
11681
  });
11635
- $[31] = t18;
11636
- $[32] = t19;
11682
+ $[38] = t20;
11683
+ $[39] = t21;
11637
11684
  } else {
11638
- t19 = $[32];
11685
+ t21 = $[39];
11639
11686
  }
11640
- let t20;
11641
- if ($[33] !== CloseIcon || $[34] !== handleUnpin || $[35] !== isHovered) {
11642
- t20 = isHovered && /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
11687
+ let t22;
11688
+ if ($[40] !== CloseIcon || $[41] !== handleUnpin || $[42] !== isHovered) {
11689
+ t22 = isHovered && /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
11643
11690
  title: "Unpin filter",
11644
11691
  children: /*#__PURE__*/jsxRuntime.jsx(IconButton, {
11645
11692
  onClick: handleUnpin,
@@ -11664,66 +11711,68 @@ const MRT_QuickFilterItem = t0 => {
11664
11711
  })
11665
11712
  })
11666
11713
  });
11667
- $[33] = CloseIcon;
11668
- $[34] = handleUnpin;
11669
- $[35] = isHovered;
11670
- $[36] = t20;
11714
+ $[40] = CloseIcon;
11715
+ $[41] = handleUnpin;
11716
+ $[42] = isHovered;
11717
+ $[43] = t22;
11671
11718
  } else {
11672
- t20 = $[36];
11719
+ t22 = $[43];
11673
11720
  }
11674
- let t21;
11675
- if ($[37] !== t16 || $[38] !== t19 || $[39] !== t20) {
11676
- t21 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
11721
+ let t23;
11722
+ if ($[44] !== t18 || $[45] !== t21 || $[46] !== t22) {
11723
+ t23 = /*#__PURE__*/jsxRuntime.jsxs(Box, {
11677
11724
  "data-testid": "quick-filter",
11678
- sx: t14,
11679
- children: [t16, t19, t20]
11725
+ sx: t16,
11726
+ children: [t18, t21, t22]
11680
11727
  });
11681
- $[37] = t16;
11682
- $[38] = t19;
11683
- $[39] = t20;
11684
- $[40] = t21;
11728
+ $[44] = t18;
11729
+ $[45] = t21;
11730
+ $[46] = t22;
11731
+ $[47] = t23;
11685
11732
  } else {
11686
- t21 = $[40];
11733
+ t23 = $[47];
11687
11734
  }
11688
11735
  const T1 = Box;
11689
- const t22 = operator.editComponent({
11736
+ const t24 = operator.editComponent({
11690
11737
  column: column,
11691
11738
  onChange: handleEditorChange,
11692
11739
  rule: editorRule,
11693
11740
  table
11694
11741
  });
11695
- let t23;
11696
- if ($[41] !== T1 || $[42] !== t22) {
11697
- t23 = /*#__PURE__*/jsxRuntime.jsx(T1, {
11698
- children: t22
11742
+ let t25;
11743
+ if ($[48] !== T1 || $[49] !== t24) {
11744
+ t25 = /*#__PURE__*/jsxRuntime.jsx(T1, {
11745
+ children: t24
11699
11746
  });
11700
- $[41] = T1;
11701
- $[42] = t22;
11702
- $[43] = t23;
11747
+ $[48] = T1;
11748
+ $[49] = t24;
11749
+ $[50] = t25;
11703
11750
  } else {
11704
- t23 = $[43];
11751
+ t25 = $[50];
11705
11752
  }
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;
11753
+ let t26;
11754
+ if ($[51] !== T0 || $[52] !== t11 || $[53] !== t12 || $[54] !== t13 || $[55] !== t14 || $[56] !== t15 || $[57] !== t23 || $[58] !== t25) {
11755
+ t26 = /*#__PURE__*/jsxRuntime.jsxs(T0, {
11756
+ onMouseEnter: t11,
11757
+ onMouseLeave: t12,
11758
+ onKeyDown: t13,
11759
+ onBlur: t14,
11760
+ sx: t15,
11761
+ children: [t23, t25]
11762
+ });
11763
+ $[51] = T0;
11764
+ $[52] = t11;
11765
+ $[53] = t12;
11766
+ $[54] = t13;
11767
+ $[55] = t14;
11768
+ $[56] = t15;
11769
+ $[57] = t23;
11770
+ $[58] = t25;
11771
+ $[59] = t26;
11723
11772
  } else {
11724
- t24 = $[51];
11773
+ t26 = $[59];
11725
11774
  }
11726
- return t24;
11775
+ return t26;
11727
11776
  };
11728
11777
  // Renders a strip of pinned quick filter inputs directly above the table body.
11729
11778
  // Visible only when at least one filter rule is pinned.
@@ -14069,6 +14118,7 @@ const MRT_TableBodyCell = ({
14069
14118
  };
14070
14119
  return /*#__PURE__*/jsxRuntime.jsx(TableCell, {
14071
14120
  align: theme.direction === 'rtl' ? 'right' : 'left',
14121
+ "data-column-id": column.id,
14072
14122
  "data-index": staticColumnIndex,
14073
14123
  "data-pinned": !!isColumnPinned || undefined,
14074
14124
  "data-testid": `body-cell-${cell.id}`,
@@ -16145,6 +16195,34 @@ const MRT_TableHeadCellGrabHandle = t0 => {
16145
16195
  return t8;
16146
16196
  };
16147
16197
 
16198
+ // `el` normally has an explicit width/min-width/flex-basis (driven by the
16199
+ // column's size CSS var), so nothing overflows and `scrollWidth` just reports
16200
+ // that forced size back — and `min-width` alone would otherwise stop it from
16201
+ // ever shrinking below the current (large) column size. Temporarily switching
16202
+ // to `max-content` with min-width/grow/shrink zeroed out lets the browser lay
16203
+ // it out at its natural content size instead — then the inline style is
16204
+ // restored before this task yields, so there's no visible flash.
16205
+ const measureIntrinsicWidth = el => {
16206
+ const {
16207
+ width,
16208
+ minWidth,
16209
+ flexBasis,
16210
+ flexGrow,
16211
+ flexShrink
16212
+ } = el.style;
16213
+ el.style.width = 'max-content';
16214
+ el.style.minWidth = '0';
16215
+ el.style.flexBasis = 'auto';
16216
+ el.style.flexGrow = '0';
16217
+ el.style.flexShrink = '0';
16218
+ const measured = Math.ceil(el.getBoundingClientRect().width);
16219
+ el.style.width = width;
16220
+ el.style.minWidth = minWidth;
16221
+ el.style.flexBasis = flexBasis;
16222
+ el.style.flexGrow = flexGrow;
16223
+ el.style.flexShrink = flexShrink;
16224
+ return measured;
16225
+ };
16148
16226
  const MRT_TableHeadCellResizeHandle = ({
16149
16227
  header,
16150
16228
  table,
@@ -16168,7 +16246,7 @@ const MRT_TableHeadCellResizeHandle = ({
16168
16246
  const {
16169
16247
  column
16170
16248
  } = header;
16171
- const mx = density === 'compact' ? '-8px' : density === 'comfortable' ? '-16px' : '-24px';
16249
+ const mx = density === 'compact' ? '-2px' : density === 'comfortable' ? '-16px' : '-24px';
16172
16250
  const lr = column.columnDef.columnDefType === 'display' ? '4px' : '0';
16173
16251
 
16174
16252
  // Drives the resize purely through refs/DOM writes (CSS vars + the indicator line) so
@@ -16182,7 +16260,14 @@ const MRT_TableHeadCellResizeHandle = ({
16182
16260
  const minSize = column.columnDef.minSize ?? 40;
16183
16261
  const maxSize = column.columnDef.maxSize ?? 1000;
16184
16262
  let size = startSize;
16185
- let latestClientX = startX;
16263
+ // The "effective" cursor position used to compute size. Normally this just
16264
+ // mirrors the real cursor 1:1, but while pinned at the window edge (see
16265
+ // below) it keeps advancing past the real position — and because every
16266
+ // update here is an incremental `+=` off whatever it already was, moving
16267
+ // the real cursor back inward afterwards shrinks it smoothly from wherever
16268
+ // it ended up, instead of snapping back to a value derived from the
16269
+ // original startX.
16270
+ let virtualX = startX;
16186
16271
  let rafId = null;
16187
16272
 
16188
16273
  // Read the header cell's own rendered edge (rather than deriving a position from
@@ -16216,31 +16301,63 @@ const MRT_TableHeadCellResizeHandle = ({
16216
16301
  // batching keeps the handler from falling behind the pointer.
16217
16302
  const applyMove = () => {
16218
16303
  rafId = null;
16219
- size = Math.min(Math.max(startSize + dir * (latestClientX - startX), minSize), maxSize);
16304
+ size = Math.min(Math.max(startSize + dir * (virtualX - startX), minSize), maxSize);
16220
16305
  if (tableEl) {
16221
16306
  tableEl.style.setProperty(`--header-${parseCSSVarId(header.id)}-size`, `${size}`);
16222
16307
  tableEl.style.setProperty(`--col-${parseCSSVarId(column.id)}-size`, `${size}`);
16223
16308
  }
16224
16309
  updateIndicator();
16225
16310
  };
16226
- const scheduleMove = clientX => {
16227
- latestClientX = clientX;
16311
+ const scheduleMove = () => {
16228
16312
  if (rafId == null) {
16229
16313
  rafId = requestAnimationFrame(applyMove);
16230
16314
  }
16231
16315
  };
16232
- const handleMouseMove = e => scheduleMove(e.clientX);
16316
+
16317
+ // The OS clamps the real cursor position at the browser window's edge, so once
16318
+ // it gets there (common when growing the last/rightmost column) no further
16319
+ // mousemove events fire even though the user is still pushing the mouse against
16320
+ // the edge wanting to keep resizing. While pinned, a small rAF loop keeps
16321
+ // advancing virtualX past the real edge at a steady rate, so the resize keeps
16322
+ // going until the drag ends or the cursor is pulled back inward.
16323
+ const EDGE_THRESHOLD = 24;
16324
+ const EDGE_STEP = 12;
16325
+ let lastRealClientX = startX;
16326
+ let edgeRafId = null;
16327
+ const isNearWindowEdge = x_0 => x_0 <= EDGE_THRESHOLD || x_0 >= window.innerWidth - EDGE_THRESHOLD;
16328
+ const stepEdgeDrift = () => {
16329
+ edgeRafId = null;
16330
+ if (!isNearWindowEdge(lastRealClientX)) return;
16331
+ virtualX += lastRealClientX <= EDGE_THRESHOLD ? -EDGE_STEP : EDGE_STEP;
16332
+ scheduleMove();
16333
+ edgeRafId = requestAnimationFrame(stepEdgeDrift);
16334
+ };
16335
+ const trackPointer = clientX => {
16336
+ // Always an incremental delta off the real cursor's last known position —
16337
+ // never a jump to an absolute value — so this composes cleanly with
16338
+ // whatever virtualX already drifted to while pinned at the edge.
16339
+ virtualX += clientX - lastRealClientX;
16340
+ lastRealClientX = clientX;
16341
+ scheduleMove();
16342
+ if (isNearWindowEdge(clientX) && edgeRafId == null) {
16343
+ edgeRafId = requestAnimationFrame(stepEdgeDrift);
16344
+ }
16345
+ };
16346
+ const handleMouseMove = e => trackPointer(e.clientX);
16233
16347
  const handleTouchMove = e_0 => {
16234
16348
  const touchX = e_0.touches[0]?.clientX;
16235
16349
  if (touchX == null) return;
16236
16350
  e_0.preventDefault();
16237
- scheduleMove(touchX);
16351
+ trackPointer(touchX);
16238
16352
  };
16239
16353
  const handleEnd = () => {
16240
16354
  document.removeEventListener('mousemove', handleMouseMove);
16241
16355
  document.removeEventListener('mouseup', handleEnd);
16242
16356
  document.removeEventListener('touchmove', handleTouchMove);
16243
16357
  document.removeEventListener('touchend', handleEnd);
16358
+ if (edgeRafId != null) {
16359
+ cancelAnimationFrame(edgeRafId);
16360
+ }
16244
16361
  // Flush a still-pending frame synchronously so the committed size reflects the
16245
16362
  // true last pointer position instead of lagging up to one frame behind it.
16246
16363
  if (rafId != null) {
@@ -16271,7 +16388,22 @@ const MRT_TableHeadCellResizeHandle = ({
16271
16388
  ...old_0,
16272
16389
  isResizingColumn: false
16273
16390
  }));
16274
- column.resetSize();
16391
+ const minSize_0 = column.columnDef.minSize ?? 40;
16392
+ const maxSize_0 = column.columnDef.maxSize ?? 1000;
16393
+ // Only the currently rendered (visible, due to row virtualization) body
16394
+ // cells are measured — a full-dataset autosize would require rendering
16395
+ // every row off-screen, which defeats the point of virtualization.
16396
+ const headCellEl = tableHeadCellRefs.current?.[column.id];
16397
+ let contentWidth = headCellEl ? measureIntrinsicWidth(headCellEl) : 0;
16398
+ const bodyCells = tableRef.current?.querySelectorAll(`[data-column-id="${CSS.escape(column.id)}"]`);
16399
+ bodyCells?.forEach(cellEl_0 => {
16400
+ contentWidth = Math.max(contentWidth, measureIntrinsicWidth(cellEl_0));
16401
+ });
16402
+ const newSize = Math.min(Math.max(contentWidth, minSize_0), maxSize_0);
16403
+ setColumnSizing(old_1 => ({
16404
+ ...old_1,
16405
+ [column.id]: newSize
16406
+ }));
16275
16407
  },
16276
16408
  onMouseDown: e_1 => {
16277
16409
  e_1.preventDefault();
@@ -16586,6 +16718,7 @@ const MRT_TableHeadCell = ({
16586
16718
  userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
16587
16719
  verticalAlign: 'top',
16588
16720
  borderBottom: 'none',
16721
+ borderInlineEnd: column.getCanResize() ? `1px solid ${theme_0.palette.divider}` : undefined,
16589
16722
  paddingBottom: 'none',
16590
16723
  ...getCommonMRTCellStyles({
16591
16724
  column,
@@ -16977,11 +17110,11 @@ const MRT_Table = ({
16977
17110
  // Padding values keyed off density, read by cell/header/footer sx so density toggles
16978
17111
  // reuse existing emotion classes instead of generating new ones per cell.
16979
17112
  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'
17113
+ '--mrt-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '1rem' : '1.5rem',
17114
+ '--mrt-display-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '0.5rem 0.75rem' : '1rem 1.25rem',
17115
+ '--mrt-head-display-cell-p': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '0.75rem' : '1rem 1.25rem',
17116
+ '--mrt-head-cell-pb': density === 'compact' ? '0.1rem' : '0.6rem',
17117
+ '--mrt-head-cell-pt': density === 'compact' ? '0.1rem' : density === 'comfortable' ? '.75rem' : '1.25rem'
16985
17118
  }), [density]);
16986
17119
  const columnVirtualizer = useMRT_ColumnVirtualizer(table);
16987
17120
  const commonTableGroupProps = {