@oliasoft-open-source/react-ui-library 4.20.3-beta-1 → 4.20.3-beta-2

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.js CHANGED
@@ -14484,12 +14484,20 @@ class Virtualizer {
14484
14484
  const size2 = this.getSize();
14485
14485
  const scrollOffset = this.getScrollOffset();
14486
14486
  if (align === "auto") {
14487
- if (toOffset >= scrollOffset + size2) {
14487
+ if (toOffset <= scrollOffset) {
14488
+ align = "start";
14489
+ } else if (toOffset >= scrollOffset + size2) {
14488
14490
  align = "end";
14491
+ } else {
14492
+ align = "start";
14489
14493
  }
14490
14494
  }
14491
- if (align === "end") {
14492
- toOffset -= size2;
14495
+ if (align === "start") {
14496
+ toOffset = toOffset;
14497
+ } else if (align === "end") {
14498
+ toOffset = toOffset - size2;
14499
+ } else if (align === "center") {
14500
+ toOffset = toOffset - size2 / 2;
14493
14501
  }
14494
14502
  const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
14495
14503
  const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
@@ -14513,27 +14521,8 @@ class Virtualizer {
14513
14521
  return [scrollOffset, align];
14514
14522
  }
14515
14523
  }
14516
- const centerOffset = item2.start - this.options.scrollPaddingStart + (item2.size - size2) / 2;
14517
- switch (align) {
14518
- case "center":
14519
- return [this.getOffsetForAlignment(centerOffset, align), align];
14520
- case "end":
14521
- return [
14522
- this.getOffsetForAlignment(
14523
- item2.end + this.options.scrollPaddingEnd,
14524
- align
14525
- ),
14526
- align
14527
- ];
14528
- default:
14529
- return [
14530
- this.getOffsetForAlignment(
14531
- item2.start - this.options.scrollPaddingStart,
14532
- align
14533
- ),
14534
- align
14535
- ];
14536
- }
14524
+ const toOffset = align === "end" ? item2.end + this.options.scrollPaddingEnd : item2.start - this.options.scrollPaddingStart;
14525
+ return [this.getOffsetForAlignment(toOffset, align), align];
14537
14526
  };
14538
14527
  this.isDynamicMode = () => this.elementsCache.size > 0;
14539
14528
  this.cancelScrollToIndex = () => {
@@ -14677,7 +14666,7 @@ function useVirtualizerBase(options) {
14677
14666
  () => new Virtualizer(resolvedOptions)
14678
14667
  );
14679
14668
  instance.setOptions(resolvedOptions);
14680
- useIsomorphicLayoutEffect$4(() => {
14669
+ React$4.useEffect(() => {
14681
14670
  return instance._didMount();
14682
14671
  }, []);
14683
14672
  useIsomorphicLayoutEffect$4(() => {