bolt-table 0.1.11 → 0.1.12
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 +26 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -986,7 +986,9 @@ var Cell = import_react3.default.memo(
|
|
|
986
986
|
return prev.isExpanded === next.isExpanded;
|
|
987
987
|
}
|
|
988
988
|
if (prev.column.render) {
|
|
989
|
-
|
|
989
|
+
if (prev.recordFingerprint !== next.recordFingerprint) return false;
|
|
990
|
+
if (prev.rowIndex !== next.rowIndex) return false;
|
|
991
|
+
return prev.column.render === next.column.render;
|
|
990
992
|
}
|
|
991
993
|
return prev.value === next.value && prev.rowIndex === next.rowIndex && prev.column.key === next.column.key;
|
|
992
994
|
}
|
|
@@ -1069,6 +1071,7 @@ var TableBody = ({
|
|
|
1069
1071
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1070
1072
|
columnStyles.map((colStyle, colIndex) => {
|
|
1071
1073
|
const col = orderedColumns[colIndex];
|
|
1074
|
+
const hasRender = !!col.render;
|
|
1072
1075
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1073
1076
|
"div",
|
|
1074
1077
|
{
|
|
@@ -1080,6 +1083,7 @@ var TableBody = ({
|
|
|
1080
1083
|
const isExpanded = resolvedExpandedKeys?.has(rowKey) ?? false;
|
|
1081
1084
|
const cellValue = row[col.dataIndex];
|
|
1082
1085
|
const isRowShimmer = isLoading || rowKey.startsWith("__shimmer_");
|
|
1086
|
+
const recordFingerprint = hasRender && !isRowShimmer ? JSON.stringify(row) : void 0;
|
|
1083
1087
|
return (
|
|
1084
1088
|
/*
|
|
1085
1089
|
* Row wrapper div:
|
|
@@ -1127,7 +1131,8 @@ var TableBody = ({
|
|
|
1127
1131
|
allData: data,
|
|
1128
1132
|
getRowKey,
|
|
1129
1133
|
accentColor,
|
|
1130
|
-
isLoading: isRowShimmer
|
|
1134
|
+
isLoading: isRowShimmer,
|
|
1135
|
+
recordFingerprint
|
|
1131
1136
|
}
|
|
1132
1137
|
)
|
|
1133
1138
|
}
|
|
@@ -1634,6 +1639,23 @@ function BoltTable({
|
|
|
1634
1639
|
() => [...leftPinned, ...unpinned, ...rightPinned],
|
|
1635
1640
|
[leftPinned, unpinned, rightPinned]
|
|
1636
1641
|
);
|
|
1642
|
+
const freshOrderedColumns = (0, import_react4.useMemo)(() => {
|
|
1643
|
+
const latestMap = new Map(
|
|
1644
|
+
initialColumnsRef.current.map((c) => [c.key, c])
|
|
1645
|
+
);
|
|
1646
|
+
return orderedColumns.map((col) => {
|
|
1647
|
+
if (col.key === "__select__" || col.key === "__expand__") return col;
|
|
1648
|
+
const latest = latestMap.get(col.key);
|
|
1649
|
+
if (!latest) return col;
|
|
1650
|
+
if (col.render === latest.render && col.shimmerRender === latest.shimmerRender)
|
|
1651
|
+
return col;
|
|
1652
|
+
return {
|
|
1653
|
+
...col,
|
|
1654
|
+
render: latest.render,
|
|
1655
|
+
shimmerRender: latest.shimmerRender
|
|
1656
|
+
};
|
|
1657
|
+
});
|
|
1658
|
+
}, [orderedColumns, initialColumns]);
|
|
1637
1659
|
const totalTableWidth = (0, import_react4.useMemo)(
|
|
1638
1660
|
() => orderedColumns.slice(0, -1).reduce((sum, col) => sum + (col.width ?? 150), 0) + (orderedColumns.at(-1)?.width ?? 150),
|
|
1639
1661
|
[orderedColumns]
|
|
@@ -2290,7 +2312,7 @@ function BoltTable({
|
|
|
2290
2312
|
TableBody_default,
|
|
2291
2313
|
{
|
|
2292
2314
|
data: displayData,
|
|
2293
|
-
orderedColumns,
|
|
2315
|
+
orderedColumns: freshOrderedColumns,
|
|
2294
2316
|
rowVirtualizer,
|
|
2295
2317
|
columnOffsets,
|
|
2296
2318
|
styles,
|
|
@@ -2556,6 +2578,7 @@ function BoltTable({
|
|
|
2556
2578
|
position: "fixed",
|
|
2557
2579
|
zIndex: 99999,
|
|
2558
2580
|
height: 36,
|
|
2581
|
+
fontSize: 12,
|
|
2559
2582
|
alignItems: "center",
|
|
2560
2583
|
overflow: "hidden",
|
|
2561
2584
|
textOverflow: "ellipsis",
|