@lensui/lens-table 0.1.19 → 0.1.20
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 +10 -5
- package/dist/index.css +6 -0
- package/dist/index.js +10 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1911,6 +1911,7 @@ function TableInner({
|
|
|
1911
1911
|
const [toast, setToast] = (0, import_react5.useState)(null);
|
|
1912
1912
|
const [resizeGuideX, setResizeGuideX] = (0, import_react5.useState)(null);
|
|
1913
1913
|
const [resizeGuideTop, setResizeGuideTop] = (0, import_react5.useState)(0);
|
|
1914
|
+
const [hoveredHeaderColumnIndex, setHoveredHeaderColumnIndex] = (0, import_react5.useState)(null);
|
|
1914
1915
|
const [hoveredHeaderAction, setHoveredHeaderAction] = (0, import_react5.useState)(null);
|
|
1915
1916
|
const [visibleHeaderTooltip, setVisibleHeaderTooltip] = (0, import_react5.useState)(null);
|
|
1916
1917
|
const [hoveredCellTooltip, setHoveredCellTooltip] = (0, import_react5.useState)(null);
|
|
@@ -2816,7 +2817,7 @@ function TableInner({
|
|
|
2816
2817
|
const left = Math.round(Math.max(rawLeft - borderWidth, horizontalStart));
|
|
2817
2818
|
const right = Math.round(Math.min(rawRight + 1, horizontalEnd, viewport.width));
|
|
2818
2819
|
const top = Math.round(Math.max(rawTop - borderWidth, verticalStart));
|
|
2819
|
-
const bottom = Math.round(Math.min(rawBottom +
|
|
2820
|
+
const bottom = Math.round(Math.min(rawBottom + borderWidth, renderHeight));
|
|
2820
2821
|
focus.style.display = "block";
|
|
2821
2822
|
focus.style.left = `${left}px`;
|
|
2822
2823
|
focus.style.top = `${top}px`;
|
|
@@ -3824,6 +3825,7 @@ function TableInner({
|
|
|
3824
3825
|
if (column.rowSelection || column.rowDragHandle || column.rowNumber) return null;
|
|
3825
3826
|
const isAxisSelected = selectedColumnKeySet.has(column.key);
|
|
3826
3827
|
const selectedClassName = isAxisSelected ? " is-axis-selected" : "";
|
|
3828
|
+
const hoveredColumnClassName = hoveredHeaderColumnIndex === columnIndex ? " is-header-hovered" : "";
|
|
3827
3829
|
const top = headerLeafTop + (headerLeafHeight - headerActionSize) / 2;
|
|
3828
3830
|
const visibleActions = getVisibleHeaderActions(column, metrics[columnIndex].width, columnDraggable, measureHeaderTitleWidth(columnIndex), headerActionSlotWidth);
|
|
3829
3831
|
let right = left + metrics[columnIndex].width - (visibleActions.drag ? headerActionSlotWidth : 2);
|
|
@@ -3831,21 +3833,21 @@ function TableInner({
|
|
|
3831
3833
|
if (visibleActions.drag) {
|
|
3832
3834
|
const hovered = hoveredHeaderAction?.columnIndex === columnIndex && hoveredHeaderAction.action === "drag";
|
|
3833
3835
|
icons.push(
|
|
3834
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderDragIcon, { className: `rvg-header-icon rvg-header-drag-icon${selectedClassName}${hovered ? " is-hovered" : ""}`, style: { left: left + metrics[columnIndex].width - headerActionSlotWidth, top } }, "drag")
|
|
3836
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderDragIcon, { className: `rvg-header-icon rvg-header-drag-icon${selectedClassName}${hoveredColumnClassName}${hovered ? " is-hovered" : ""}`, style: { left: left + metrics[columnIndex].width - headerActionSlotWidth, top } }, "drag")
|
|
3835
3837
|
);
|
|
3836
3838
|
}
|
|
3837
3839
|
if (visibleActions.sort) {
|
|
3838
3840
|
const hovered = hoveredHeaderAction?.columnIndex === columnIndex && hoveredHeaderAction.action === "sort";
|
|
3839
3841
|
const direction = sortState?.columnKey === column.key ? sortState.direction : null;
|
|
3840
3842
|
icons.push(
|
|
3841
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderSortIcon, { className: `rvg-header-icon${selectedClassName}${hovered ? " is-hovered" : ""}`, style: { left: right - headerActionSlotWidth, top }, direction }, "sort")
|
|
3843
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderSortIcon, { className: `rvg-header-icon${selectedClassName}${hoveredColumnClassName}${direction ? " is-active" : ""}${hovered ? " is-hovered" : ""}`, style: { left: right - headerActionSlotWidth, top }, direction }, "sort")
|
|
3842
3844
|
);
|
|
3843
3845
|
right -= headerActionSlotWidth;
|
|
3844
3846
|
}
|
|
3845
3847
|
if (visibleActions.filter) {
|
|
3846
3848
|
const hovered = hoveredHeaderAction?.columnIndex === columnIndex && hoveredHeaderAction.action === "filter";
|
|
3847
3849
|
icons.push(
|
|
3848
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderSearchIcon, { className: `rvg-header-icon rvg-header-search-icon${selectedClassName}${hovered ? " is-hovered" : ""}${filterValues[column.key] ? " is-active" : ""}`, style: { left: right - headerActionSlotWidth, top: top + 1 } }, "filter")
|
|
3850
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HeaderSearchIcon, { className: `rvg-header-icon rvg-header-search-icon${selectedClassName}${hoveredColumnClassName}${hovered ? " is-hovered" : ""}${filterValues[column.key] ? " is-active" : ""}`, style: { left: right - headerActionSlotWidth, top: top + 1 } }, "filter")
|
|
3849
3851
|
);
|
|
3850
3852
|
}
|
|
3851
3853
|
return icons;
|
|
@@ -4383,7 +4385,7 @@ function TableInner({
|
|
|
4383
4385
|
const left = Math.round(Math.max(rawLeft - borderWidth, horizontalStart));
|
|
4384
4386
|
const right = Math.round(Math.min(rawRight + 1, horizontalEnd, viewport.width));
|
|
4385
4387
|
const top = Math.round(Math.max(rawTop - borderWidth, verticalStart));
|
|
4386
|
-
const bottom = Math.round(Math.min(rawBottom +
|
|
4388
|
+
const bottom = Math.round(Math.min(rawBottom + borderWidth, renderHeight));
|
|
4387
4389
|
return {
|
|
4388
4390
|
left,
|
|
4389
4391
|
top,
|
|
@@ -4635,6 +4637,8 @@ function TableInner({
|
|
|
4635
4637
|
const columnIndex = locateColumn(event.clientX);
|
|
4636
4638
|
const inHeader = localY >= headerY && localY < headerY + headerHeight;
|
|
4637
4639
|
const inLeafHeader = inHeader && localY >= headerY + headerLeafTop;
|
|
4640
|
+
const nextHoveredHeaderColumnIndex = inLeafHeader && columnIndex >= 0 ? columnIndex : null;
|
|
4641
|
+
setHoveredHeaderColumnIndex((current) => current === nextHoveredHeaderColumnIndex ? current : nextHoveredHeaderColumnIndex);
|
|
4638
4642
|
const hoveredHeaderCell = inHeader ? locateHeaderCell(event.clientX, event.clientY) : null;
|
|
4639
4643
|
const hoveredAction = inLeafHeader ? locateHeaderAction(event.clientX, columnIndex) : null;
|
|
4640
4644
|
const hoveredDragHandle = Boolean(hoveredHeaderCell && locateHeaderCellDragHandle(event.clientX, hoveredHeaderCell));
|
|
@@ -4720,6 +4724,7 @@ function TableInner({
|
|
|
4720
4724
|
},
|
|
4721
4725
|
onMouseLeave: (event) => {
|
|
4722
4726
|
event.currentTarget.style.cursor = "default";
|
|
4727
|
+
setHoveredHeaderColumnIndex(null);
|
|
4723
4728
|
showCellTooltip(null);
|
|
4724
4729
|
showHeaderTooltipAfterDelay(null);
|
|
4725
4730
|
if (hoveredHeaderActionRef.current) {
|
package/dist/index.css
CHANGED
|
@@ -853,7 +853,12 @@
|
|
|
853
853
|
width: var(--rvg-header-action-size, 14px);
|
|
854
854
|
height: var(--rvg-header-action-size, 14px);
|
|
855
855
|
overflow: visible;
|
|
856
|
+
opacity: 0;
|
|
856
857
|
color: var(--rvg-color-icon);
|
|
858
|
+
transition: opacity 120ms ease, color 120ms ease;
|
|
859
|
+
}
|
|
860
|
+
.rvg-header-icon.is-header-hovered {
|
|
861
|
+
opacity: 1;
|
|
857
862
|
}
|
|
858
863
|
.rvg-header-icon.is-hovered {
|
|
859
864
|
color: var(--rvg-color-muted);
|
|
@@ -864,6 +869,7 @@
|
|
|
864
869
|
color: var(--rvg-color-axis-selection-text);
|
|
865
870
|
}
|
|
866
871
|
.rvg-root.is-initial-loading .rvg-header-icon {
|
|
872
|
+
opacity: 1;
|
|
867
873
|
color: #d6dbe0;
|
|
868
874
|
animation: rvg-loading-icon-pulse 1.15s ease-in-out infinite alternate;
|
|
869
875
|
}
|
package/dist/index.js
CHANGED
|
@@ -1881,6 +1881,7 @@ function TableInner({
|
|
|
1881
1881
|
const [toast, setToast] = useState4(null);
|
|
1882
1882
|
const [resizeGuideX, setResizeGuideX] = useState4(null);
|
|
1883
1883
|
const [resizeGuideTop, setResizeGuideTop] = useState4(0);
|
|
1884
|
+
const [hoveredHeaderColumnIndex, setHoveredHeaderColumnIndex] = useState4(null);
|
|
1884
1885
|
const [hoveredHeaderAction, setHoveredHeaderAction] = useState4(null);
|
|
1885
1886
|
const [visibleHeaderTooltip, setVisibleHeaderTooltip] = useState4(null);
|
|
1886
1887
|
const [hoveredCellTooltip, setHoveredCellTooltip] = useState4(null);
|
|
@@ -2786,7 +2787,7 @@ function TableInner({
|
|
|
2786
2787
|
const left = Math.round(Math.max(rawLeft - borderWidth, horizontalStart));
|
|
2787
2788
|
const right = Math.round(Math.min(rawRight + 1, horizontalEnd, viewport.width));
|
|
2788
2789
|
const top = Math.round(Math.max(rawTop - borderWidth, verticalStart));
|
|
2789
|
-
const bottom = Math.round(Math.min(rawBottom +
|
|
2790
|
+
const bottom = Math.round(Math.min(rawBottom + borderWidth, renderHeight));
|
|
2790
2791
|
focus.style.display = "block";
|
|
2791
2792
|
focus.style.left = `${left}px`;
|
|
2792
2793
|
focus.style.top = `${top}px`;
|
|
@@ -3794,6 +3795,7 @@ function TableInner({
|
|
|
3794
3795
|
if (column.rowSelection || column.rowDragHandle || column.rowNumber) return null;
|
|
3795
3796
|
const isAxisSelected = selectedColumnKeySet.has(column.key);
|
|
3796
3797
|
const selectedClassName = isAxisSelected ? " is-axis-selected" : "";
|
|
3798
|
+
const hoveredColumnClassName = hoveredHeaderColumnIndex === columnIndex ? " is-header-hovered" : "";
|
|
3797
3799
|
const top = headerLeafTop + (headerLeafHeight - headerActionSize) / 2;
|
|
3798
3800
|
const visibleActions = getVisibleHeaderActions(column, metrics[columnIndex].width, columnDraggable, measureHeaderTitleWidth(columnIndex), headerActionSlotWidth);
|
|
3799
3801
|
let right = left + metrics[columnIndex].width - (visibleActions.drag ? headerActionSlotWidth : 2);
|
|
@@ -3801,21 +3803,21 @@ function TableInner({
|
|
|
3801
3803
|
if (visibleActions.drag) {
|
|
3802
3804
|
const hovered = hoveredHeaderAction?.columnIndex === columnIndex && hoveredHeaderAction.action === "drag";
|
|
3803
3805
|
icons.push(
|
|
3804
|
-
/* @__PURE__ */ jsx7(HeaderDragIcon, { className: `rvg-header-icon rvg-header-drag-icon${selectedClassName}${hovered ? " is-hovered" : ""}`, style: { left: left + metrics[columnIndex].width - headerActionSlotWidth, top } }, "drag")
|
|
3806
|
+
/* @__PURE__ */ jsx7(HeaderDragIcon, { className: `rvg-header-icon rvg-header-drag-icon${selectedClassName}${hoveredColumnClassName}${hovered ? " is-hovered" : ""}`, style: { left: left + metrics[columnIndex].width - headerActionSlotWidth, top } }, "drag")
|
|
3805
3807
|
);
|
|
3806
3808
|
}
|
|
3807
3809
|
if (visibleActions.sort) {
|
|
3808
3810
|
const hovered = hoveredHeaderAction?.columnIndex === columnIndex && hoveredHeaderAction.action === "sort";
|
|
3809
3811
|
const direction = sortState?.columnKey === column.key ? sortState.direction : null;
|
|
3810
3812
|
icons.push(
|
|
3811
|
-
/* @__PURE__ */ jsx7(HeaderSortIcon, { className: `rvg-header-icon${selectedClassName}${hovered ? " is-hovered" : ""}`, style: { left: right - headerActionSlotWidth, top }, direction }, "sort")
|
|
3813
|
+
/* @__PURE__ */ jsx7(HeaderSortIcon, { className: `rvg-header-icon${selectedClassName}${hoveredColumnClassName}${direction ? " is-active" : ""}${hovered ? " is-hovered" : ""}`, style: { left: right - headerActionSlotWidth, top }, direction }, "sort")
|
|
3812
3814
|
);
|
|
3813
3815
|
right -= headerActionSlotWidth;
|
|
3814
3816
|
}
|
|
3815
3817
|
if (visibleActions.filter) {
|
|
3816
3818
|
const hovered = hoveredHeaderAction?.columnIndex === columnIndex && hoveredHeaderAction.action === "filter";
|
|
3817
3819
|
icons.push(
|
|
3818
|
-
/* @__PURE__ */ jsx7(HeaderSearchIcon, { className: `rvg-header-icon rvg-header-search-icon${selectedClassName}${hovered ? " is-hovered" : ""}${filterValues[column.key] ? " is-active" : ""}`, style: { left: right - headerActionSlotWidth, top: top + 1 } }, "filter")
|
|
3820
|
+
/* @__PURE__ */ jsx7(HeaderSearchIcon, { className: `rvg-header-icon rvg-header-search-icon${selectedClassName}${hoveredColumnClassName}${hovered ? " is-hovered" : ""}${filterValues[column.key] ? " is-active" : ""}`, style: { left: right - headerActionSlotWidth, top: top + 1 } }, "filter")
|
|
3819
3821
|
);
|
|
3820
3822
|
}
|
|
3821
3823
|
return icons;
|
|
@@ -4353,7 +4355,7 @@ function TableInner({
|
|
|
4353
4355
|
const left = Math.round(Math.max(rawLeft - borderWidth, horizontalStart));
|
|
4354
4356
|
const right = Math.round(Math.min(rawRight + 1, horizontalEnd, viewport.width));
|
|
4355
4357
|
const top = Math.round(Math.max(rawTop - borderWidth, verticalStart));
|
|
4356
|
-
const bottom = Math.round(Math.min(rawBottom +
|
|
4358
|
+
const bottom = Math.round(Math.min(rawBottom + borderWidth, renderHeight));
|
|
4357
4359
|
return {
|
|
4358
4360
|
left,
|
|
4359
4361
|
top,
|
|
@@ -4605,6 +4607,8 @@ function TableInner({
|
|
|
4605
4607
|
const columnIndex = locateColumn(event.clientX);
|
|
4606
4608
|
const inHeader = localY >= headerY && localY < headerY + headerHeight;
|
|
4607
4609
|
const inLeafHeader = inHeader && localY >= headerY + headerLeafTop;
|
|
4610
|
+
const nextHoveredHeaderColumnIndex = inLeafHeader && columnIndex >= 0 ? columnIndex : null;
|
|
4611
|
+
setHoveredHeaderColumnIndex((current) => current === nextHoveredHeaderColumnIndex ? current : nextHoveredHeaderColumnIndex);
|
|
4608
4612
|
const hoveredHeaderCell = inHeader ? locateHeaderCell(event.clientX, event.clientY) : null;
|
|
4609
4613
|
const hoveredAction = inLeafHeader ? locateHeaderAction(event.clientX, columnIndex) : null;
|
|
4610
4614
|
const hoveredDragHandle = Boolean(hoveredHeaderCell && locateHeaderCellDragHandle(event.clientX, hoveredHeaderCell));
|
|
@@ -4690,6 +4694,7 @@ function TableInner({
|
|
|
4690
4694
|
},
|
|
4691
4695
|
onMouseLeave: (event) => {
|
|
4692
4696
|
event.currentTarget.style.cursor = "default";
|
|
4697
|
+
setHoveredHeaderColumnIndex(null);
|
|
4693
4698
|
showCellTooltip(null);
|
|
4694
4699
|
showHeaderTooltipAfterDelay(null);
|
|
4695
4700
|
if (hoveredHeaderActionRef.current) {
|