@lensui/lens-table 0.1.73 → 0.1.75

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
@@ -1997,6 +1997,7 @@ function TableInner({
1997
1997
  const rootRef = (0, import_react8.useRef)(null);
1998
1998
  const frameRef = (0, import_react8.useRef)(null);
1999
1999
  const textFrameRef = (0, import_react8.useRef)(null);
2000
+ const textLayoutScrollTopRef = (0, import_react8.useRef)(0);
2000
2001
  const toastTimerRef = (0, import_react8.useRef)(null);
2001
2002
  const headerTooltipTimerRef = (0, import_react8.useRef)(null);
2002
2003
  const cellTooltipTimerRef = (0, import_react8.useRef)(null);
@@ -3034,6 +3035,13 @@ function TableInner({
3034
3035
  horizontalScrollbarDragRef.current = null;
3035
3036
  showCustomScrollbar("horizontal");
3036
3037
  }, [showCustomScrollbar]);
3038
+ (0, import_react8.useLayoutEffect)(() => {
3039
+ textLayoutScrollTopRef.current = scrollPosition.top;
3040
+ const clips = rootRef.current?.querySelectorAll(".rvg-body-text-clip");
3041
+ clips?.forEach((clip) => {
3042
+ clip.style.transform = "";
3043
+ });
3044
+ }, [scrollPosition.top]);
3037
3045
  const handleScroll = (0, import_react8.useCallback)(() => {
3038
3046
  const element = scrollerRef.current;
3039
3047
  if (!element) return;
@@ -3041,6 +3049,13 @@ function TableInner({
3041
3049
  const scrollDeltaX = element.scrollLeft - previousScroll.left;
3042
3050
  const scrollDeltaY = element.scrollTop - previousScroll.top;
3043
3051
  scrollRef.current = { left: element.scrollLeft, top: element.scrollTop };
3052
+ const textDeltaY = element.scrollTop - textLayoutScrollTopRef.current;
3053
+ if (textDeltaY !== 0) {
3054
+ const clips = rootRef.current?.querySelectorAll(".rvg-body-text-clip");
3055
+ clips?.forEach((clip) => {
3056
+ clip.style.transform = `translate3d(0, ${-textDeltaY}px, 0)`;
3057
+ });
3058
+ }
3044
3059
  syncSelectionEdgeTarget(element.scrollLeft, element.scrollTop);
3045
3060
  const focus = selectionFocusRef.current;
3046
3061
  if (focus && selection && !selectionRange) {
@@ -5303,7 +5318,6 @@ function TableInner({
5303
5318
  },
5304
5319
  onClick: (event) => {
5305
5320
  event.stopPropagation();
5306
- scrollerRef.current?.focus({ preventScroll: true });
5307
5321
  revealCell(selection);
5308
5322
  },
5309
5323
  children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "rvg-selection-edge-halo", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M 0 100 L 0 0 L 100 0" }) }) })
package/dist/index.css CHANGED
@@ -183,6 +183,7 @@
183
183
  bottom: 0;
184
184
  overflow: hidden;
185
185
  pointer-events: none;
186
+ will-change: transform;
186
187
  }
187
188
  .rvg-text-scroll-clip {
188
189
  position: absolute;
package/dist/index.js CHANGED
@@ -1967,6 +1967,7 @@ function TableInner({
1967
1967
  const rootRef = useRef4(null);
1968
1968
  const frameRef = useRef4(null);
1969
1969
  const textFrameRef = useRef4(null);
1970
+ const textLayoutScrollTopRef = useRef4(0);
1970
1971
  const toastTimerRef = useRef4(null);
1971
1972
  const headerTooltipTimerRef = useRef4(null);
1972
1973
  const cellTooltipTimerRef = useRef4(null);
@@ -3004,6 +3005,13 @@ function TableInner({
3004
3005
  horizontalScrollbarDragRef.current = null;
3005
3006
  showCustomScrollbar("horizontal");
3006
3007
  }, [showCustomScrollbar]);
3008
+ useLayoutEffect3(() => {
3009
+ textLayoutScrollTopRef.current = scrollPosition.top;
3010
+ const clips = rootRef.current?.querySelectorAll(".rvg-body-text-clip");
3011
+ clips?.forEach((clip) => {
3012
+ clip.style.transform = "";
3013
+ });
3014
+ }, [scrollPosition.top]);
3007
3015
  const handleScroll = useCallback2(() => {
3008
3016
  const element = scrollerRef.current;
3009
3017
  if (!element) return;
@@ -3011,6 +3019,13 @@ function TableInner({
3011
3019
  const scrollDeltaX = element.scrollLeft - previousScroll.left;
3012
3020
  const scrollDeltaY = element.scrollTop - previousScroll.top;
3013
3021
  scrollRef.current = { left: element.scrollLeft, top: element.scrollTop };
3022
+ const textDeltaY = element.scrollTop - textLayoutScrollTopRef.current;
3023
+ if (textDeltaY !== 0) {
3024
+ const clips = rootRef.current?.querySelectorAll(".rvg-body-text-clip");
3025
+ clips?.forEach((clip) => {
3026
+ clip.style.transform = `translate3d(0, ${-textDeltaY}px, 0)`;
3027
+ });
3028
+ }
3014
3029
  syncSelectionEdgeTarget(element.scrollLeft, element.scrollTop);
3015
3030
  const focus = selectionFocusRef.current;
3016
3031
  if (focus && selection && !selectionRange) {
@@ -5273,7 +5288,6 @@ function TableInner({
5273
5288
  },
5274
5289
  onClick: (event) => {
5275
5290
  event.stopPropagation();
5276
- scrollerRef.current?.focus({ preventScroll: true });
5277
5291
  revealCell(selection);
5278
5292
  },
5279
5293
  children: /* @__PURE__ */ jsx8("span", { className: "rvg-selection-edge-halo", "aria-hidden": "true", children: /* @__PURE__ */ jsx8("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", children: /* @__PURE__ */ jsx8("path", { d: "M 0 100 L 0 0 L 100 0" }) }) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensui/lens-table",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "description": "A lightweight, canvas-rendered React table component for LensUI.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",