@dooherceg/material-react-table 4.0.2 → 4.0.4
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 +66 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +66 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2296,7 +2296,39 @@ const MRT_ExpandButton = ({
|
|
|
2296
2296
|
const canExpand = row.getCanExpand() && (maxDepth === undefined || row.depth < maxDepth - 1);
|
|
2297
2297
|
const handleToggleExpand = event => {
|
|
2298
2298
|
event.stopPropagation();
|
|
2299
|
-
row.toggleExpanded()
|
|
2299
|
+
// row.toggleExpanded() is never called here. Its internal read of
|
|
2300
|
+
// row.table.atoms.expanded.get() can go stale relative to the live
|
|
2301
|
+
// table.getState() after repeated toggles on the same row (observed: a row's
|
|
2302
|
+
// second collapse silently no-ops - state and UI both stay exactly as they
|
|
2303
|
+
// were, with no error). table.getState()/table.setExpanded() stayed reliable
|
|
2304
|
+
// through the same repeated-toggle sequence, so the resulting map is always
|
|
2305
|
+
// built from those directly instead.
|
|
2306
|
+
const currentExpanded = table.getState().expanded;
|
|
2307
|
+
const isCurrentlyExpanded = currentExpanded === true || !!currentExpanded[row.id];
|
|
2308
|
+
if (isCurrentlyExpanded) {
|
|
2309
|
+
if (currentExpanded === true) {
|
|
2310
|
+
const next = {};
|
|
2311
|
+
Object.values(table.getRowModel().rowsById).forEach(otherRow => {
|
|
2312
|
+
if (otherRow.id !== row.id && otherRow.getCanExpand()) {
|
|
2313
|
+
next[otherRow.id] = true;
|
|
2314
|
+
}
|
|
2315
|
+
});
|
|
2316
|
+
table.setExpanded(next);
|
|
2317
|
+
} else {
|
|
2318
|
+
const next_0 = {
|
|
2319
|
+
...currentExpanded
|
|
2320
|
+
};
|
|
2321
|
+
delete next_0[row.id];
|
|
2322
|
+
table.setExpanded(next_0);
|
|
2323
|
+
}
|
|
2324
|
+
} else {
|
|
2325
|
+
// isCurrentlyExpanded is false, so currentExpanded can't be `true` here.
|
|
2326
|
+
const next_1 = {
|
|
2327
|
+
...currentExpanded
|
|
2328
|
+
};
|
|
2329
|
+
next_1[row.id] = true;
|
|
2330
|
+
table.setExpanded(next_1);
|
|
2331
|
+
}
|
|
2300
2332
|
iconButtonProps?.onClick?.(event);
|
|
2301
2333
|
};
|
|
2302
2334
|
const detailPanel = !!renderDetailPanel?.({
|
|
@@ -13621,7 +13653,7 @@ const MRT_CellActionMenu = ({
|
|
|
13621
13653
|
};
|
|
13622
13654
|
|
|
13623
13655
|
const MRT_DisplayColumnCellRenderer = t0 => {
|
|
13624
|
-
const $ = compilerRuntime.c(
|
|
13656
|
+
const $ = compilerRuntime.c(12);
|
|
13625
13657
|
const {
|
|
13626
13658
|
cell,
|
|
13627
13659
|
rowRef,
|
|
@@ -13636,41 +13668,45 @@ const MRT_DisplayColumnCellRenderer = t0 => {
|
|
|
13636
13668
|
const {
|
|
13637
13669
|
columnDef
|
|
13638
13670
|
} = column;
|
|
13671
|
+
const CellComponent = columnDef.Cell;
|
|
13672
|
+
if (!CellComponent) {
|
|
13673
|
+
return null;
|
|
13674
|
+
}
|
|
13639
13675
|
let t1;
|
|
13640
|
-
if ($[0] !== cell
|
|
13641
|
-
t1 =
|
|
13642
|
-
cell,
|
|
13643
|
-
column,
|
|
13644
|
-
renderedCellValue: cell.renderValue(),
|
|
13645
|
-
row,
|
|
13646
|
-
rowRef,
|
|
13647
|
-
staticColumnIndex,
|
|
13648
|
-
staticRowIndex,
|
|
13649
|
-
table
|
|
13650
|
-
}) ?? null;
|
|
13676
|
+
if ($[0] !== cell) {
|
|
13677
|
+
t1 = cell.renderValue();
|
|
13651
13678
|
$[0] = cell;
|
|
13652
|
-
$[1] =
|
|
13653
|
-
$[2] = columnDef;
|
|
13654
|
-
$[3] = row;
|
|
13655
|
-
$[4] = rowRef;
|
|
13656
|
-
$[5] = staticColumnIndex;
|
|
13657
|
-
$[6] = staticRowIndex;
|
|
13658
|
-
$[7] = table;
|
|
13659
|
-
$[8] = t1;
|
|
13679
|
+
$[1] = t1;
|
|
13660
13680
|
} else {
|
|
13661
|
-
t1 = $[
|
|
13681
|
+
t1 = $[1];
|
|
13662
13682
|
}
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13683
|
+
const t2 = t1;
|
|
13684
|
+
let t3;
|
|
13685
|
+
if ($[2] !== CellComponent || $[3] !== cell || $[4] !== column || $[5] !== row || $[6] !== rowRef || $[7] !== staticColumnIndex || $[8] !== staticRowIndex || $[9] !== t2 || $[10] !== table) {
|
|
13686
|
+
t3 = /*#__PURE__*/jsxRuntime.jsx(CellComponent, {
|
|
13687
|
+
cell: cell,
|
|
13688
|
+
column: column,
|
|
13689
|
+
renderedCellValue: t2,
|
|
13690
|
+
row: row,
|
|
13691
|
+
rowRef: rowRef,
|
|
13692
|
+
staticColumnIndex: staticColumnIndex,
|
|
13693
|
+
staticRowIndex: staticRowIndex,
|
|
13694
|
+
table: table
|
|
13667
13695
|
});
|
|
13668
|
-
$[
|
|
13669
|
-
$[
|
|
13696
|
+
$[2] = CellComponent;
|
|
13697
|
+
$[3] = cell;
|
|
13698
|
+
$[4] = column;
|
|
13699
|
+
$[5] = row;
|
|
13700
|
+
$[6] = rowRef;
|
|
13701
|
+
$[7] = staticColumnIndex;
|
|
13702
|
+
$[8] = staticRowIndex;
|
|
13703
|
+
$[9] = t2;
|
|
13704
|
+
$[10] = table;
|
|
13705
|
+
$[11] = t3;
|
|
13670
13706
|
} else {
|
|
13671
|
-
|
|
13707
|
+
t3 = $[11];
|
|
13672
13708
|
}
|
|
13673
|
-
return
|
|
13709
|
+
return t3;
|
|
13674
13710
|
};
|
|
13675
13711
|
|
|
13676
13712
|
const MRT_TableBodyCellValue = ({
|