@lensui/lens-table 0.1.39 → 0.1.41

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
@@ -3648,26 +3648,13 @@ function TableInner({
3648
3648
  const updateColumnDragPreview = (0, import_react5.useCallback)((sourceCell, clientX, canvas) => {
3649
3649
  const rootRect = rootRef.current?.getBoundingClientRect() ?? canvas.getBoundingClientRect();
3650
3650
  const sourceWidth = metrics[sourceCell.startIndex]?.width ?? 100;
3651
- const sourceColumn = columns[sourceCell.startIndex];
3652
- const previewContext = canvas.getContext("2d");
3653
- const previewStyles = rootRef.current ? getComputedStyle(rootRef.current) : null;
3654
- const previewFontSize = previewStyles ? readThemePixel(previewStyles, "--rvg-font-size-body", 13) : 13;
3655
- if (previewContext) previewContext.font = `${previewFontSize}px Inter, ui-sans-serif, system-ui, sans-serif`;
3656
- const measurePreviewText = (value) => previewContext?.measureText(value).width ?? value.length * previewFontSize * 0.58;
3657
- const previewContentWidth = Math.max(
3658
- measurePreviewText(sourceColumn?.title ?? ""),
3659
- ...rows.slice(0, 100).map((_row, rowIndex) => measurePreviewText(getCellLabel(rowIndex, sourceCell.startIndex)))
3660
- ) + 24;
3661
- const previewWidth = Math.min(
3662
- Math.max(sourceWidth, Math.ceil(previewContentWidth)),
3663
- Math.max(60, Math.min(360, viewport.width - 16))
3664
- );
3651
+ const previewWidth = sourceWidth;
3665
3652
  setColumnDragPreview({
3666
3653
  sourceIndex: sourceCell.startIndex,
3667
3654
  left: Math.max(4, Math.min(viewport.width - previewWidth - 4, clientX - rootRect.left - previewWidth / 2)),
3668
3655
  width: previewWidth
3669
3656
  });
3670
- }, [columns, getCellLabel, metrics, rows, viewport.width]);
3657
+ }, [metrics, viewport.width]);
3671
3658
  const activateColumnOrderPointerDrag = (0, import_react5.useCallback)((canvas, clientX) => {
3672
3659
  const drag = columnOrderDragRef.current;
3673
3660
  if (!drag || drag.active) return;
@@ -5306,12 +5293,15 @@ function TableInner({
5306
5293
  height: renderHeight
5307
5294
  },
5308
5295
  children: [
5309
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5296
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5310
5297
  "div",
5311
5298
  {
5312
5299
  className: `rvg-column-drag-preview-header${selectedColumnKeySet.has(columns[columnDragPreview.sourceIndex]?.key) ? " is-axis-selected" : ""}`,
5313
5300
  style: { top: headerLeafTop, height: headerLeafHeight },
5314
- children: columns[columnDragPreview.sourceIndex]?.renderHeader?.(columns[columnDragPreview.sourceIndex]) ?? columns[columnDragPreview.sourceIndex]?.title
5301
+ children: [
5302
+ columns[columnDragPreview.sourceIndex]?.renderHeader?.(columns[columnDragPreview.sourceIndex]) ?? columns[columnDragPreview.sourceIndex]?.title,
5303
+ renderHeaderIcons(columnDragPreview.sourceIndex, 0)
5304
+ ]
5315
5305
  }
5316
5306
  ),
5317
5307
  rows.slice(domRange.rowStart, domRange.rowEnd).map((_row, visibleRowOffset) => {
package/dist/index.js CHANGED
@@ -3618,26 +3618,13 @@ function TableInner({
3618
3618
  const updateColumnDragPreview = useCallback2((sourceCell, clientX, canvas) => {
3619
3619
  const rootRect = rootRef.current?.getBoundingClientRect() ?? canvas.getBoundingClientRect();
3620
3620
  const sourceWidth = metrics[sourceCell.startIndex]?.width ?? 100;
3621
- const sourceColumn = columns[sourceCell.startIndex];
3622
- const previewContext = canvas.getContext("2d");
3623
- const previewStyles = rootRef.current ? getComputedStyle(rootRef.current) : null;
3624
- const previewFontSize = previewStyles ? readThemePixel(previewStyles, "--rvg-font-size-body", 13) : 13;
3625
- if (previewContext) previewContext.font = `${previewFontSize}px Inter, ui-sans-serif, system-ui, sans-serif`;
3626
- const measurePreviewText = (value) => previewContext?.measureText(value).width ?? value.length * previewFontSize * 0.58;
3627
- const previewContentWidth = Math.max(
3628
- measurePreviewText(sourceColumn?.title ?? ""),
3629
- ...rows.slice(0, 100).map((_row, rowIndex) => measurePreviewText(getCellLabel(rowIndex, sourceCell.startIndex)))
3630
- ) + 24;
3631
- const previewWidth = Math.min(
3632
- Math.max(sourceWidth, Math.ceil(previewContentWidth)),
3633
- Math.max(60, Math.min(360, viewport.width - 16))
3634
- );
3621
+ const previewWidth = sourceWidth;
3635
3622
  setColumnDragPreview({
3636
3623
  sourceIndex: sourceCell.startIndex,
3637
3624
  left: Math.max(4, Math.min(viewport.width - previewWidth - 4, clientX - rootRect.left - previewWidth / 2)),
3638
3625
  width: previewWidth
3639
3626
  });
3640
- }, [columns, getCellLabel, metrics, rows, viewport.width]);
3627
+ }, [metrics, viewport.width]);
3641
3628
  const activateColumnOrderPointerDrag = useCallback2((canvas, clientX) => {
3642
3629
  const drag = columnOrderDragRef.current;
3643
3630
  if (!drag || drag.active) return;
@@ -5276,12 +5263,15 @@ function TableInner({
5276
5263
  height: renderHeight
5277
5264
  },
5278
5265
  children: [
5279
- /* @__PURE__ */ jsx7(
5266
+ /* @__PURE__ */ jsxs7(
5280
5267
  "div",
5281
5268
  {
5282
5269
  className: `rvg-column-drag-preview-header${selectedColumnKeySet.has(columns[columnDragPreview.sourceIndex]?.key) ? " is-axis-selected" : ""}`,
5283
5270
  style: { top: headerLeafTop, height: headerLeafHeight },
5284
- children: columns[columnDragPreview.sourceIndex]?.renderHeader?.(columns[columnDragPreview.sourceIndex]) ?? columns[columnDragPreview.sourceIndex]?.title
5271
+ children: [
5272
+ columns[columnDragPreview.sourceIndex]?.renderHeader?.(columns[columnDragPreview.sourceIndex]) ?? columns[columnDragPreview.sourceIndex]?.title,
5273
+ renderHeaderIcons(columnDragPreview.sourceIndex, 0)
5274
+ ]
5285
5275
  }
5286
5276
  ),
5287
5277
  rows.slice(domRange.rowStart, domRange.rowEnd).map((_row, visibleRowOffset) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensui/lens-table",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "description": "A lightweight, canvas-rendered React table component for LensUI.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",