@shival99/z-ui 1.7.16 → 1.7.17

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.
@@ -825,6 +825,12 @@ const resolveConfigValue = (config, row, defaultValue) => {
825
825
  }
826
826
  return typeof config === 'function' ? config(row) : config;
827
827
  };
828
+ const pickDefined = (obj, keys) => keys.reduce((acc, key) => {
829
+ if (obj[key] !== undefined) {
830
+ acc[key] = obj[key];
831
+ }
832
+ return acc;
833
+ }, {});
828
834
 
829
835
  class ZTableEditCellComponent {
830
836
  _destroyRef = inject(DestroyRef);
@@ -3576,14 +3582,14 @@ class ZTableComponent {
3576
3582
  measureElement: (element) => element.getBoundingClientRect().height,
3577
3583
  overscan: virtualConfig.overscan ?? Z_DEFAULT_VIRTUAL_OVERSCAN,
3578
3584
  initialOffset: virtualConfig.initialOffset ?? 0,
3579
- ...(virtualConfig.scrollMargin !== undefined && { scrollMargin: virtualConfig.scrollMargin }),
3580
- ...(virtualConfig.gap !== undefined && { gap: virtualConfig.gap }),
3581
- ...(virtualConfig.isScrollingResetDelay !== undefined && {
3582
- isScrollingResetDelay: virtualConfig.isScrollingResetDelay,
3583
- }),
3584
- ...(virtualConfig.useScrollendEvent !== undefined && { useScrollendEvent: virtualConfig.useScrollendEvent }),
3585
- ...(virtualConfig.getItemKey !== undefined && { getItemKey: virtualConfig.getItemKey }),
3586
- ...(virtualConfig.rangeExtractor !== undefined && { rangeExtractor: virtualConfig.rangeExtractor }),
3585
+ ...pickDefined(virtualConfig, [
3586
+ 'scrollMargin',
3587
+ 'gap',
3588
+ 'isScrollingResetDelay',
3589
+ 'useScrollendEvent',
3590
+ 'getItemKey',
3591
+ 'rangeExtractor',
3592
+ ]),
3587
3593
  };
3588
3594
  });
3589
3595
  _measureVirtualItems = effect(() => {
@@ -3714,16 +3720,14 @@ class ZTableComponent {
3714
3720
  if (wrapperEl) {
3715
3721
  wrapperEl.scrollTop = 0;
3716
3722
  }
3717
- const scrollbar = this.tbodyScrollbar();
3718
- if (scrollbar) {
3719
- void scrollbar.scrollTo({ top: 0, duration: 0 });
3720
- }
3721
3723
  this.virtualizer.scrollToOffset(0);
3722
- this._dynamicGroupsVersion.update(v => v + 1);
3723
3724
  }
3724
3725
  queueMicrotask(() => {
3725
3726
  this._checkVerticalScroll();
3726
3727
  this._checkHorizontalScroll();
3728
+ if (this.isVirtual()) {
3729
+ this._dynamicGroupsVersion.update(v => v + 1);
3730
+ }
3727
3731
  });
3728
3732
  });
3729
3733
  explicitEffect([this.virtualizer.getVirtualItems], () => {
@@ -3745,7 +3749,7 @@ class ZTableComponent {
3745
3749
  }
3746
3750
  const scrollbar = this.tbodyScrollbar();
3747
3751
  if (scrollbar) {
3748
- void scrollbar.scrollTo({ top: 0, duration: 0 });
3752
+ void scrollbar.scrollTo({ top: 0, left: this._savedScrollLeft(), duration: 0 });
3749
3753
  }
3750
3754
  return;
3751
3755
  }
@@ -3758,7 +3762,7 @@ class ZTableComponent {
3758
3762
  if (this.isVirtual()) {
3759
3763
  const scrollbar = this.tbodyScrollbar();
3760
3764
  if (scrollbar) {
3761
- void scrollbar.scrollTo({ top: 0, duration: 0 });
3765
+ void scrollbar.scrollTo({ top: 0, left: this._savedScrollLeft(), duration: 0 });
3762
3766
  }
3763
3767
  this.virtualizer.scrollToOffset(0);
3764
3768
  this._dynamicGroupsVersion.update(v => v + 1);