bolt-table 0.1.10 → 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 +28 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -951,6 +951,11 @@ var Cell = React3.memo(
|
|
|
951
951
|
if (prev.column.key === "__expand__") {
|
|
952
952
|
return prev.isExpanded === next.isExpanded;
|
|
953
953
|
}
|
|
954
|
+
if (prev.column.render) {
|
|
955
|
+
if (prev.recordFingerprint !== next.recordFingerprint) return false;
|
|
956
|
+
if (prev.rowIndex !== next.rowIndex) return false;
|
|
957
|
+
return prev.column.render === next.column.render;
|
|
958
|
+
}
|
|
954
959
|
return prev.value === next.value && prev.rowIndex === next.rowIndex && prev.column.key === next.column.key;
|
|
955
960
|
}
|
|
956
961
|
);
|
|
@@ -1032,6 +1037,7 @@ var TableBody = ({
|
|
|
1032
1037
|
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1033
1038
|
columnStyles.map((colStyle, colIndex) => {
|
|
1034
1039
|
const col = orderedColumns[colIndex];
|
|
1040
|
+
const hasRender = !!col.render;
|
|
1035
1041
|
return /* @__PURE__ */ jsx4(
|
|
1036
1042
|
"div",
|
|
1037
1043
|
{
|
|
@@ -1043,6 +1049,7 @@ var TableBody = ({
|
|
|
1043
1049
|
const isExpanded = resolvedExpandedKeys?.has(rowKey) ?? false;
|
|
1044
1050
|
const cellValue = row[col.dataIndex];
|
|
1045
1051
|
const isRowShimmer = isLoading || rowKey.startsWith("__shimmer_");
|
|
1052
|
+
const recordFingerprint = hasRender && !isRowShimmer ? JSON.stringify(row) : void 0;
|
|
1046
1053
|
return (
|
|
1047
1054
|
/*
|
|
1048
1055
|
* Row wrapper div:
|
|
@@ -1090,7 +1097,8 @@ var TableBody = ({
|
|
|
1090
1097
|
allData: data,
|
|
1091
1098
|
getRowKey,
|
|
1092
1099
|
accentColor,
|
|
1093
|
-
isLoading: isRowShimmer
|
|
1100
|
+
isLoading: isRowShimmer,
|
|
1101
|
+
recordFingerprint
|
|
1094
1102
|
}
|
|
1095
1103
|
)
|
|
1096
1104
|
}
|
|
@@ -1597,6 +1605,23 @@ function BoltTable({
|
|
|
1597
1605
|
() => [...leftPinned, ...unpinned, ...rightPinned],
|
|
1598
1606
|
[leftPinned, unpinned, rightPinned]
|
|
1599
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]);
|
|
1600
1625
|
const totalTableWidth = useMemo2(
|
|
1601
1626
|
() => orderedColumns.slice(0, -1).reduce((sum, col) => sum + (col.width ?? 150), 0) + (orderedColumns.at(-1)?.width ?? 150),
|
|
1602
1627
|
[orderedColumns]
|
|
@@ -2253,7 +2278,7 @@ function BoltTable({
|
|
|
2253
2278
|
TableBody_default,
|
|
2254
2279
|
{
|
|
2255
2280
|
data: displayData,
|
|
2256
|
-
orderedColumns,
|
|
2281
|
+
orderedColumns: freshOrderedColumns,
|
|
2257
2282
|
rowVirtualizer,
|
|
2258
2283
|
columnOffsets,
|
|
2259
2284
|
styles,
|
|
@@ -2519,6 +2544,7 @@ function BoltTable({
|
|
|
2519
2544
|
position: "fixed",
|
|
2520
2545
|
zIndex: 99999,
|
|
2521
2546
|
height: 36,
|
|
2547
|
+
fontSize: 12,
|
|
2522
2548
|
alignItems: "center",
|
|
2523
2549
|
overflow: "hidden",
|
|
2524
2550
|
textOverflow: "ellipsis",
|