@lensui/lens-table 0.1.44 → 0.1.45

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.cjs CHANGED
@@ -3847,6 +3847,7 @@ function TableInner({
3847
3847
  const rowTop = (fixedHeader ? 0 : -scrollPosition.top) + (headerRowOffsets[level] ?? 0);
3848
3848
  const rowHeight2 = headerRowHeights[level] ?? baseHeaderHeight;
3849
3849
  let anchorX = cellLeft + cellWidth / 2;
3850
+ let anchorY = rowTop + rowHeight2 / 2;
3850
3851
  let anchorLeft = cellLeft;
3851
3852
  let label = column.title;
3852
3853
  if (action === "title") {
@@ -3870,8 +3871,10 @@ function TableInner({
3870
3871
  anchorX = anchorLeft + textWidth;
3871
3872
  }
3872
3873
  } else if (action === "drag") {
3873
- anchorX = cellLeft + cellWidth;
3874
+ const right = cellLeft + cellWidth - headerActionSlotWidth;
3875
+ anchorX = right - headerActionSlotWidth / 2;
3874
3876
  anchorLeft = anchorX;
3877
+ anchorY = rowTop + headerLeafTop + (column.renderHeader ? 8 + Math.max(0, (16 - headerActionSize) / 2) : (headerLeafHeight - headerActionSize) / 2) + headerActionSize / 2;
3875
3878
  label = labels.dragColumn;
3876
3879
  } else if (action === "sort") {
3877
3880
  const direction = sortState?.columnKey === column.key ? sortState.direction : null;
@@ -3880,6 +3883,7 @@ function TableInner({
3880
3883
  const right = cellLeft + cellWidth - (visibleActions.drag ? headerActionSlotWidth : 2);
3881
3884
  anchorX = right - headerActionSlotWidth / 2;
3882
3885
  anchorLeft = anchorX;
3886
+ anchorY = rowTop + headerLeafTop + (column.renderHeader ? 8 + Math.max(0, (16 - headerActionSize) / 2) : (headerLeafHeight - headerActionSize) / 2) + headerActionSize / 2;
3883
3887
  } else if (action === "filter") {
3884
3888
  const value = filterValues[column.key];
3885
3889
  label = value ? labels.filterWithValue(value) : labels.filter;
@@ -3888,6 +3892,7 @@ function TableInner({
3888
3892
  if (visibleActions.sort) right -= headerActionSlotWidth;
3889
3893
  anchorX = right - headerActionSlotWidth / 2;
3890
3894
  anchorLeft = anchorX;
3895
+ anchorY = rowTop + headerLeafTop + (column.renderHeader ? 8 + Math.max(0, (16 - headerActionSize) / 2) : (headerLeafHeight - headerActionSize) / 2) + headerActionSize / 2 + 1;
3891
3896
  }
3892
3897
  const placement = anchorX + 328 > viewport.width ? "left" : "right";
3893
3898
  return {
@@ -3895,11 +3900,11 @@ function TableInner({
3895
3900
  columnIndex,
3896
3901
  action,
3897
3902
  left: placement === "right" ? anchorX + 8 : Math.max(8, anchorLeft - 8),
3898
- top: rowTop + rowHeight2 / 2,
3903
+ top: anchorY,
3899
3904
  label,
3900
3905
  placement
3901
3906
  };
3902
- }, [baseHeaderHeight, columnDraggable, columns, filterValues, fixedHeader, getDisplayedColumnLeft, getHeaderCellLeft, getHeaderCellWidth, headerActionSlotWidth, headerDepth, headerRowHeights, headerRowOffsets, labels, measureHeaderTitleWidth, metrics, scrollPosition.top, sortState, viewport.width]);
3907
+ }, [baseHeaderHeight, columnDraggable, columns, filterValues, fixedHeader, getDisplayedColumnLeft, getHeaderCellLeft, getHeaderCellWidth, headerActionSize, headerActionSlotWidth, headerDepth, headerLeafHeight, headerLeafTop, headerRowHeights, headerRowOffsets, labels, measureHeaderTitleWidth, metrics, scrollPosition.top, sortState, viewport.width]);
3903
3908
  const isPointerOnHeaderTitle = (0, import_react5.useCallback)((clientX, clientY, cell) => {
3904
3909
  const canvas = canvasRef.current;
3905
3910
  if (!canvas) return false;
package/dist/index.js CHANGED
@@ -3817,6 +3817,7 @@ function TableInner({
3817
3817
  const rowTop = (fixedHeader ? 0 : -scrollPosition.top) + (headerRowOffsets[level] ?? 0);
3818
3818
  const rowHeight2 = headerRowHeights[level] ?? baseHeaderHeight;
3819
3819
  let anchorX = cellLeft + cellWidth / 2;
3820
+ let anchorY = rowTop + rowHeight2 / 2;
3820
3821
  let anchorLeft = cellLeft;
3821
3822
  let label = column.title;
3822
3823
  if (action === "title") {
@@ -3840,8 +3841,10 @@ function TableInner({
3840
3841
  anchorX = anchorLeft + textWidth;
3841
3842
  }
3842
3843
  } else if (action === "drag") {
3843
- anchorX = cellLeft + cellWidth;
3844
+ const right = cellLeft + cellWidth - headerActionSlotWidth;
3845
+ anchorX = right - headerActionSlotWidth / 2;
3844
3846
  anchorLeft = anchorX;
3847
+ anchorY = rowTop + headerLeafTop + (column.renderHeader ? 8 + Math.max(0, (16 - headerActionSize) / 2) : (headerLeafHeight - headerActionSize) / 2) + headerActionSize / 2;
3845
3848
  label = labels.dragColumn;
3846
3849
  } else if (action === "sort") {
3847
3850
  const direction = sortState?.columnKey === column.key ? sortState.direction : null;
@@ -3850,6 +3853,7 @@ function TableInner({
3850
3853
  const right = cellLeft + cellWidth - (visibleActions.drag ? headerActionSlotWidth : 2);
3851
3854
  anchorX = right - headerActionSlotWidth / 2;
3852
3855
  anchorLeft = anchorX;
3856
+ anchorY = rowTop + headerLeafTop + (column.renderHeader ? 8 + Math.max(0, (16 - headerActionSize) / 2) : (headerLeafHeight - headerActionSize) / 2) + headerActionSize / 2;
3853
3857
  } else if (action === "filter") {
3854
3858
  const value = filterValues[column.key];
3855
3859
  label = value ? labels.filterWithValue(value) : labels.filter;
@@ -3858,6 +3862,7 @@ function TableInner({
3858
3862
  if (visibleActions.sort) right -= headerActionSlotWidth;
3859
3863
  anchorX = right - headerActionSlotWidth / 2;
3860
3864
  anchorLeft = anchorX;
3865
+ anchorY = rowTop + headerLeafTop + (column.renderHeader ? 8 + Math.max(0, (16 - headerActionSize) / 2) : (headerLeafHeight - headerActionSize) / 2) + headerActionSize / 2 + 1;
3861
3866
  }
3862
3867
  const placement = anchorX + 328 > viewport.width ? "left" : "right";
3863
3868
  return {
@@ -3865,11 +3870,11 @@ function TableInner({
3865
3870
  columnIndex,
3866
3871
  action,
3867
3872
  left: placement === "right" ? anchorX + 8 : Math.max(8, anchorLeft - 8),
3868
- top: rowTop + rowHeight2 / 2,
3873
+ top: anchorY,
3869
3874
  label,
3870
3875
  placement
3871
3876
  };
3872
- }, [baseHeaderHeight, columnDraggable, columns, filterValues, fixedHeader, getDisplayedColumnLeft, getHeaderCellLeft, getHeaderCellWidth, headerActionSlotWidth, headerDepth, headerRowHeights, headerRowOffsets, labels, measureHeaderTitleWidth, metrics, scrollPosition.top, sortState, viewport.width]);
3877
+ }, [baseHeaderHeight, columnDraggable, columns, filterValues, fixedHeader, getDisplayedColumnLeft, getHeaderCellLeft, getHeaderCellWidth, headerActionSize, headerActionSlotWidth, headerDepth, headerLeafHeight, headerLeafTop, headerRowHeights, headerRowOffsets, labels, measureHeaderTitleWidth, metrics, scrollPosition.top, sortState, viewport.width]);
3873
3878
  const isPointerOnHeaderTitle = useCallback2((clientX, clientY, cell) => {
3874
3879
  const canvas = canvasRef.current;
3875
3880
  if (!canvas) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensui/lens-table",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "description": "A lightweight, canvas-rendered React table component for LensUI.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",