@shival99/z-ui 1.7.14 → 1.7.16

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.
@@ -3166,7 +3166,6 @@ class ZTableComponent {
3166
3166
  overscan: virtual.overscan ?? Z_DEFAULT_VIRTUAL_OVERSCAN,
3167
3167
  groupSize: virtual.groupSize ?? Z_DEFAULT_GROUP_SIZE,
3168
3168
  dynamicSize: virtual.dynamicSize ?? false,
3169
- // TanStack Virtual options
3170
3169
  initialOffset: virtual.initialOffset,
3171
3170
  scrollMargin: virtual.scrollMargin,
3172
3171
  gap: virtual.gap,
@@ -3555,9 +3554,7 @@ class ZTableComponent {
3555
3554
  const totalRows = untracked(() => this.table.getRowModel().rows.length);
3556
3555
  return Math.ceil(totalRows / this.groupSize());
3557
3556
  }, ...(ngDevMode ? [{ debugName: "_virtualGroupCount" }] : []));
3558
- _virtualResetVersion = signal(0, ...(ngDevMode ? [{ debugName: "_virtualResetVersion" }] : []));
3559
3557
  virtualizer = injectVirtualizer(() => {
3560
- this._virtualResetVersion();
3561
3558
  const groups = this.dynamicGroups();
3562
3559
  const rowHeight = this.virtualRowHeight();
3563
3560
  const groupSize = this.groupSize();
@@ -3713,7 +3710,6 @@ class ZTableComponent {
3713
3710
  });
3714
3711
  explicitEffect([this.columnFilters, this.globalFilter, this.pagination, this.sorting, this._data], () => {
3715
3712
  if (this.isVirtual()) {
3716
- // Reset scroll position synchronously
3717
3713
  const wrapperEl = this.tbodyWrapper()?.nativeElement;
3718
3714
  if (wrapperEl) {
3719
3715
  wrapperEl.scrollTop = 0;
@@ -3722,12 +3718,8 @@ class ZTableComponent {
3722
3718
  if (scrollbar) {
3723
3719
  void scrollbar.scrollTo({ top: 0, duration: 0 });
3724
3720
  }
3725
- // Reset virtualizer to offset 0
3726
3721
  this.virtualizer.scrollToOffset(0);
3727
- // Force recalculate dynamic groups immediately
3728
3722
  this._dynamicGroupsVersion.update(v => v + 1);
3729
- // Force virtualizer to reset with initialOffset: 0
3730
- this._virtualResetVersion.update(v => v + 1);
3731
3723
  }
3732
3724
  queueMicrotask(() => {
3733
3725
  this._checkVerticalScroll();
@@ -3749,21 +3741,27 @@ class ZTableComponent {
3749
3741
  const wrapperEl = this.tbodyWrapper()?.nativeElement;
3750
3742
  if (wrapperEl) {
3751
3743
  this._savedScrollLeft.set(wrapperEl.scrollLeft);
3744
+ wrapperEl.scrollTop = 0;
3745
+ }
3746
+ const scrollbar = this.tbodyScrollbar();
3747
+ if (scrollbar) {
3748
+ void scrollbar.scrollTo({ top: 0, duration: 0 });
3752
3749
  }
3753
3750
  return;
3754
3751
  }
3755
- // Loading finished - reset scroll positions
3756
3752
  queueMicrotask(() => {
3757
3753
  const wrapperEl = this.tbodyWrapper()?.nativeElement;
3758
3754
  if (wrapperEl) {
3759
3755
  wrapperEl.scrollTop = 0;
3760
3756
  wrapperEl.scrollLeft = this._savedScrollLeft();
3761
3757
  }
3762
- // Critical: Reset virtualizer when loading finishes in server mode
3763
3758
  if (this.isVirtual()) {
3759
+ const scrollbar = this.tbodyScrollbar();
3760
+ if (scrollbar) {
3761
+ void scrollbar.scrollTo({ top: 0, duration: 0 });
3762
+ }
3764
3763
  this.virtualizer.scrollToOffset(0);
3765
3764
  this._dynamicGroupsVersion.update(v => v + 1);
3766
- this._virtualResetVersion.update(v => v + 1);
3767
3765
  }
3768
3766
  this._checkScrollState();
3769
3767
  });