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.mjs
CHANGED
|
@@ -952,7 +952,9 @@ var Cell = React3.memo(
|
|
|
952
952
|
return prev.isExpanded === next.isExpanded;
|
|
953
953
|
}
|
|
954
954
|
if (prev.column.render) {
|
|
955
|
-
|
|
955
|
+
if (prev.recordFingerprint !== next.recordFingerprint) return false;
|
|
956
|
+
if (prev.rowIndex !== next.rowIndex) return false;
|
|
957
|
+
return prev.column.render === next.column.render;
|
|
956
958
|
}
|
|
957
959
|
return prev.value === next.value && prev.rowIndex === next.rowIndex && prev.column.key === next.column.key;
|
|
958
960
|
}
|
|
@@ -1035,6 +1037,7 @@ var TableBody = ({
|
|
|
1035
1037
|
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1036
1038
|
columnStyles.map((colStyle, colIndex) => {
|
|
1037
1039
|
const col = orderedColumns[colIndex];
|
|
1040
|
+
const hasRender = !!col.render;
|
|
1038
1041
|
return /* @__PURE__ */ jsx4(
|
|
1039
1042
|
"div",
|
|
1040
1043
|
{
|
|
@@ -1046,6 +1049,7 @@ var TableBody = ({
|
|
|
1046
1049
|
const isExpanded = resolvedExpandedKeys?.has(rowKey) ?? false;
|
|
1047
1050
|
const cellValue = row[col.dataIndex];
|
|
1048
1051
|
const isRowShimmer = isLoading || rowKey.startsWith("__shimmer_");
|
|
1052
|
+
const recordFingerprint = hasRender && !isRowShimmer ? JSON.stringify(row) : void 0;
|
|
1049
1053
|
return (
|
|
1050
1054
|
/*
|
|
1051
1055
|
* Row wrapper div:
|
|
@@ -1093,7 +1097,8 @@ var TableBody = ({
|
|
|
1093
1097
|
allData: data,
|
|
1094
1098
|
getRowKey,
|
|
1095
1099
|
accentColor,
|
|
1096
|
-
isLoading: isRowShimmer
|
|
1100
|
+
isLoading: isRowShimmer,
|
|
1101
|
+
recordFingerprint
|
|
1097
1102
|
}
|
|
1098
1103
|
)
|
|
1099
1104
|
}
|
|
@@ -1600,6 +1605,23 @@ function BoltTable({
|
|
|
1600
1605
|
() => [...leftPinned, ...unpinned, ...rightPinned],
|
|
1601
1606
|
[leftPinned, unpinned, rightPinned]
|
|
1602
1607
|
);
|
|
1608
|
+
const freshOrderedColumns = useMemo2(() => {
|
|
1609
|
+
const latestMap = new Map(
|
|
1610
|
+
initialColumnsRef.current.map((c) => [c.key, c])
|
|
1611
|
+
);
|
|
1612
|
+
return orderedColumns.map((col) => {
|
|
1613
|
+
if (col.key === "__select__" || col.key === "__expand__") return col;
|
|
1614
|
+
const latest = latestMap.get(col.key);
|
|
1615
|
+
if (!latest) return col;
|
|
1616
|
+
if (col.render === latest.render && col.shimmerRender === latest.shimmerRender)
|
|
1617
|
+
return col;
|
|
1618
|
+
return {
|
|
1619
|
+
...col,
|
|
1620
|
+
render: latest.render,
|
|
1621
|
+
shimmerRender: latest.shimmerRender
|
|
1622
|
+
};
|
|
1623
|
+
});
|
|
1624
|
+
}, [orderedColumns, initialColumns]);
|
|
1603
1625
|
const totalTableWidth = useMemo2(
|
|
1604
1626
|
() => orderedColumns.slice(0, -1).reduce((sum, col) => sum + (col.width ?? 150), 0) + (orderedColumns.at(-1)?.width ?? 150),
|
|
1605
1627
|
[orderedColumns]
|
|
@@ -2256,7 +2278,7 @@ function BoltTable({
|
|
|
2256
2278
|
TableBody_default,
|
|
2257
2279
|
{
|
|
2258
2280
|
data: displayData,
|
|
2259
|
-
orderedColumns,
|
|
2281
|
+
orderedColumns: freshOrderedColumns,
|
|
2260
2282
|
rowVirtualizer,
|
|
2261
2283
|
columnOffsets,
|
|
2262
2284
|
styles,
|
|
@@ -2522,6 +2544,7 @@ function BoltTable({
|
|
|
2522
2544
|
position: "fixed",
|
|
2523
2545
|
zIndex: 99999,
|
|
2524
2546
|
height: 36,
|
|
2547
|
+
fontSize: 12,
|
|
2525
2548
|
alignItems: "center",
|
|
2526
2549
|
overflow: "hidden",
|
|
2527
2550
|
textOverflow: "ellipsis",
|