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