@lensui/lens-table 0.1.40 → 0.1.42
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 +2 -15
- package/dist/index.css +3 -2
- package/dist/index.js +2 -15
- package/package.json +1 -1
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
|
|
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
|
-
}, [
|
|
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;
|
package/dist/index.css
CHANGED
|
@@ -1536,12 +1536,12 @@
|
|
|
1536
1536
|
border-bottom: 1px solid var(--rvg-color-grid);
|
|
1537
1537
|
color: var(--rvg-color-text);
|
|
1538
1538
|
font:
|
|
1539
|
-
|
|
1539
|
+
var(--rvg-font-size-body) Inter,
|
|
1540
1540
|
ui-sans-serif,
|
|
1541
1541
|
system-ui,
|
|
1542
1542
|
sans-serif;
|
|
1543
1543
|
white-space: nowrap;
|
|
1544
|
-
text-overflow:
|
|
1544
|
+
text-overflow: clip;
|
|
1545
1545
|
box-sizing: border-box;
|
|
1546
1546
|
}
|
|
1547
1547
|
.rvg-column-drag-preview-header {
|
|
@@ -1556,6 +1556,7 @@
|
|
|
1556
1556
|
background: var(--rvg-color-axis-selection-fill);
|
|
1557
1557
|
}
|
|
1558
1558
|
.rvg-column-drag-preview.is-axis-selected .rvg-column-drag-preview-cell {
|
|
1559
|
+
border-bottom-color: color-mix(in srgb, var(--rvg-color-axis-selection-text) 34%, transparent);
|
|
1559
1560
|
background: var(--rvg-color-axis-selection-fill);
|
|
1560
1561
|
}
|
|
1561
1562
|
.rvg-column-drag-preview-header .rvg-preview-header-icon {
|
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
|
|
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
|
-
}, [
|
|
3627
|
+
}, [metrics, viewport.width]);
|
|
3641
3628
|
const activateColumnOrderPointerDrag = useCallback2((canvas, clientX) => {
|
|
3642
3629
|
const drag = columnOrderDragRef.current;
|
|
3643
3630
|
if (!drag || drag.active) return;
|