@oliasoft-open-source/react-ui-library 5.8.0-beta-4 → 5.8.0-beta-5

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3653,26 +3653,34 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
3653
3653
  })
3654
3654
  });
3655
3655
  };
3656
- var ScrollToActiveRow = ({ activeIndex: e, triggerScrollToActiveRow: t, isVirtualized: n, virtualizer: r }) => (useEffect(() => {
3657
- if (t && !(e == null || e < 0)) {
3656
+ var ScrollToActiveRow = ({ activeIndex: e, triggerScrollToActiveRow: t, isVirtualized: n, virtualizer: r }) => {
3657
+ let i = useRef(null), a = useMemo(() => debounce((e) => {
3658
3658
  if (n && r) r.scrollToIndex(e, {
3659
3659
  align: "center",
3660
3660
  behavior: "auto"
3661
3661
  });
3662
- else if (!n) {
3662
+ else {
3663
3663
  let t = document.querySelector(`tr[data-index="${e}"]`);
3664
3664
  t && t.scrollIntoView({
3665
3665
  behavior: "auto",
3666
3666
  block: "center"
3667
3667
  });
3668
3668
  }
3669
- }
3670
- }, [
3671
- e,
3672
- t,
3673
- n,
3674
- r
3675
- ]), null);
3669
+ i.current = e;
3670
+ }, 100, {
3671
+ leading: !1,
3672
+ trailing: !0
3673
+ }), [n, r]);
3674
+ return useEffect(() => {
3675
+ if (t && !(e == null || e < 0) && i.current !== e) return a(e), () => {
3676
+ a.cancel();
3677
+ };
3678
+ }, [
3679
+ e,
3680
+ t,
3681
+ a
3682
+ ]), null;
3683
+ };
3676
3684
  const TableScrollWrapper = ({ table: e, theadRef: t, children: n }) => {
3677
3685
  let { infiniteScroll: r = !1, triggerScrollToActiveRow: i = !1, rows: a } = e, o = useMemo(() => typeof e.activeRowIndex == "number" ? e.activeRowIndex : Array.isArray(a) && a.length ? a.findIndex((e) => e && e.active) : -1, [a, e.activeRowIndex]);
3678
3686
  return r ? /* @__PURE__ */ jsx(TableVirtualScrollWrapper, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.8.0-beta-4",
3
+ "version": "5.8.0-beta-5",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {