@lensui/lens-table 0.1.44 → 0.1.46

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,18 +3892,21 @@ 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
- const placement = anchorX + 328 > viewport.width ? "left" : "right";
3897
+ const isActionTooltip = action === "drag" || action === "sort" || action === "filter";
3898
+ const horizontalPlacement = anchorX + 328 > viewport.width ? "left" : "right";
3899
+ const placement = isActionTooltip ? "above" : horizontalPlacement;
3893
3900
  return {
3894
3901
  key: `${action}:${cell ? `cell:${cell.key}:${cell.level}` : `column:${column.key}`}:${Math.round(anchorX)}:${Math.round(rowTop)}`,
3895
3902
  columnIndex,
3896
3903
  action,
3897
- left: placement === "right" ? anchorX + 8 : Math.max(8, anchorLeft - 8),
3898
- top: rowTop + rowHeight2 / 2,
3904
+ left: placement === "above" ? anchorX : placement === "right" ? anchorX + 8 : Math.max(8, anchorLeft - 8),
3905
+ top: placement === "above" ? anchorY - 8 : anchorY,
3899
3906
  label,
3900
3907
  placement
3901
3908
  };
3902
- }, [baseHeaderHeight, columnDraggable, columns, filterValues, fixedHeader, getDisplayedColumnLeft, getHeaderCellLeft, getHeaderCellWidth, headerActionSlotWidth, headerDepth, headerRowHeights, headerRowOffsets, labels, measureHeaderTitleWidth, metrics, scrollPosition.top, sortState, viewport.width]);
3909
+ }, [baseHeaderHeight, columnDraggable, columns, filterValues, fixedHeader, getDisplayedColumnLeft, getHeaderCellLeft, getHeaderCellWidth, headerActionSize, headerActionSlotWidth, headerDepth, headerLeafHeight, headerLeafTop, headerRowHeights, headerRowOffsets, labels, measureHeaderTitleWidth, metrics, scrollPosition.top, sortState, viewport.width]);
3903
3910
  const isPointerOnHeaderTitle = (0, import_react5.useCallback)((clientX, clientY, cell) => {
3904
3911
  const canvas = canvasRef.current;
3905
3912
  if (!canvas) return false;
package/dist/index.css CHANGED
@@ -954,6 +954,18 @@
954
954
  right: -4px;
955
955
  border-left: 5px solid var(--rvg-color-tooltip-bg);
956
956
  }
957
+ .rvg-header-tooltip.is-above {
958
+ transform: translate(-50%, -100%);
959
+ }
960
+ .rvg-header-tooltip.is-above::after {
961
+ bottom: -4px;
962
+ left: 50%;
963
+ transform: translateX(-50%);
964
+ border-right: 5px solid transparent;
965
+ border-top: 5px solid var(--rvg-color-tooltip-bg);
966
+ border-bottom: 0;
967
+ border-left: 5px solid transparent;
968
+ }
957
969
  .rvg-header-tooltip.is-below,
958
970
  .rvg-cell-tooltip.is-below {
959
971
  transform: none;
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,18 +3862,21 @@ 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
- const placement = anchorX + 328 > viewport.width ? "left" : "right";
3867
+ const isActionTooltip = action === "drag" || action === "sort" || action === "filter";
3868
+ const horizontalPlacement = anchorX + 328 > viewport.width ? "left" : "right";
3869
+ const placement = isActionTooltip ? "above" : horizontalPlacement;
3863
3870
  return {
3864
3871
  key: `${action}:${cell ? `cell:${cell.key}:${cell.level}` : `column:${column.key}`}:${Math.round(anchorX)}:${Math.round(rowTop)}`,
3865
3872
  columnIndex,
3866
3873
  action,
3867
- left: placement === "right" ? anchorX + 8 : Math.max(8, anchorLeft - 8),
3868
- top: rowTop + rowHeight2 / 2,
3874
+ left: placement === "above" ? anchorX : placement === "right" ? anchorX + 8 : Math.max(8, anchorLeft - 8),
3875
+ top: placement === "above" ? anchorY - 8 : anchorY,
3869
3876
  label,
3870
3877
  placement
3871
3878
  };
3872
- }, [baseHeaderHeight, columnDraggable, columns, filterValues, fixedHeader, getDisplayedColumnLeft, getHeaderCellLeft, getHeaderCellWidth, headerActionSlotWidth, headerDepth, headerRowHeights, headerRowOffsets, labels, measureHeaderTitleWidth, metrics, scrollPosition.top, sortState, viewport.width]);
3879
+ }, [baseHeaderHeight, columnDraggable, columns, filterValues, fixedHeader, getDisplayedColumnLeft, getHeaderCellLeft, getHeaderCellWidth, headerActionSize, headerActionSlotWidth, headerDepth, headerLeafHeight, headerLeafTop, headerRowHeights, headerRowOffsets, labels, measureHeaderTitleWidth, metrics, scrollPosition.top, sortState, viewport.width]);
3873
3880
  const isPointerOnHeaderTitle = useCallback2((clientX, clientY, cell) => {
3874
3881
  const canvas = canvasRef.current;
3875
3882
  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.46",
4
4
  "description": "A lightweight, canvas-rendered React table component for LensUI.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",