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 CHANGED
@@ -985,6 +985,11 @@ var Cell = import_react3.default.memo(
985
985
  if (prev.column.key === "__expand__") {
986
986
  return prev.isExpanded === next.isExpanded;
987
987
  }
988
+ if (prev.column.render) {
989
+ if (prev.recordFingerprint !== next.recordFingerprint) return false;
990
+ if (prev.rowIndex !== next.rowIndex) return false;
991
+ return prev.column.render === next.column.render;
992
+ }
988
993
  return prev.value === next.value && prev.rowIndex === next.rowIndex && prev.column.key === next.column.key;
989
994
  }
990
995
  );
@@ -1066,6 +1071,7 @@ var TableBody = ({
1066
1071
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1067
1072
  columnStyles.map((colStyle, colIndex) => {
1068
1073
  const col = orderedColumns[colIndex];
1074
+ const hasRender = !!col.render;
1069
1075
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1070
1076
  "div",
1071
1077
  {
@@ -1077,6 +1083,7 @@ var TableBody = ({
1077
1083
  const isExpanded = resolvedExpandedKeys?.has(rowKey) ?? false;
1078
1084
  const cellValue = row[col.dataIndex];
1079
1085
  const isRowShimmer = isLoading || rowKey.startsWith("__shimmer_");
1086
+ const recordFingerprint = hasRender && !isRowShimmer ? JSON.stringify(row) : void 0;
1080
1087
  return (
1081
1088
  /*
1082
1089
  * Row wrapper div:
@@ -1124,7 +1131,8 @@ var TableBody = ({
1124
1131
  allData: data,
1125
1132
  getRowKey,
1126
1133
  accentColor,
1127
- isLoading: isRowShimmer
1134
+ isLoading: isRowShimmer,
1135
+ recordFingerprint
1128
1136
  }
1129
1137
  )
1130
1138
  }
@@ -1631,6 +1639,23 @@ function BoltTable({
1631
1639
  () => [...leftPinned, ...unpinned, ...rightPinned],
1632
1640
  [leftPinned, unpinned, rightPinned]
1633
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]);
1634
1659
  const totalTableWidth = (0, import_react4.useMemo)(
1635
1660
  () => orderedColumns.slice(0, -1).reduce((sum, col) => sum + (col.width ?? 150), 0) + (orderedColumns.at(-1)?.width ?? 150),
1636
1661
  [orderedColumns]
@@ -2287,7 +2312,7 @@ function BoltTable({
2287
2312
  TableBody_default,
2288
2313
  {
2289
2314
  data: displayData,
2290
- orderedColumns,
2315
+ orderedColumns: freshOrderedColumns,
2291
2316
  rowVirtualizer,
2292
2317
  columnOffsets,
2293
2318
  styles,
@@ -2553,6 +2578,7 @@ function BoltTable({
2553
2578
  position: "fixed",
2554
2579
  zIndex: 99999,
2555
2580
  height: 36,
2581
+ fontSize: 12,
2556
2582
  alignItems: "center",
2557
2583
  overflow: "hidden",
2558
2584
  textOverflow: "ellipsis",