Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin/component-base

Package Overview
Dependencies
Maintainers
12
Versions
407
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/component-base - npm Package Compare versions

Comparing version 24.4.0-alpha17 to 24.4.0-alpha18

4

package.json
{
"name": "@vaadin/component-base",
"version": "24.4.0-alpha17",
"version": "24.4.0-alpha18",
"publishConfig": {

@@ -45,3 +45,3 @@ "access": "public"

},
"gitHead": "eb6b4dac66be1c0ddc77757bed5f84a6d355e5cf"
"gitHead": "7d675c61eaa32ef50c07de7b2fea19ff437b6b90"
}

@@ -12,3 +12,3 @@ /**

get() {
return '24.4.0-alpha17';
return '24.4.0-alpha18';
},

@@ -15,0 +15,0 @@ });

@@ -92,2 +92,6 @@ /**

get _maxVirtualIndexOffset() {
return this.size - this._virtualCount;
}
__hasPlaceholders() {

@@ -117,3 +121,3 @@ return this.__getVisibleElements().some((el) => el.__virtualizerPlaceholder);

targetVirtualIndex = this._virtualCount - (this.size - index);
this._vidxOffset = this.size - this._virtualCount;
this._vidxOffset = this._maxVirtualIndexOffset;
} else if (targetVirtualIndex < visibleElementCount) {

@@ -305,20 +309,37 @@ if (index < OFFSET_ADJUST_MIN_THRESHOLD) {

// Prevent element update while the scroll position is being restored
this.__preventElementUpdates = true;
// Record the scroll position before changing the size
let fvi; // First visible index
let fviOffsetBefore; // Scroll offset of the first visible index
if (size > 0) {
fvi = this.adjustedFirstVisibleIndex;
fviOffsetBefore = this.__getIndexScrollOffset(fvi);
}
// Change the size
this.__size = size;
if (!this._physicalItems) {
// Not initialized yet
this._itemsChanged({
path: 'items',
});
this.__preventElementUpdates = true;
flush();
this.__preventElementUpdates = false;
} else {
// Already initialized, just update _virtualCount
this._updateScrollerSize();
this._virtualCount = this.items.length;
this._render();
this._itemsChanged({
path: 'items',
});
flush();
// Try to restore the scroll position if the new size is larger than 0
if (size > 0) {
fvi = Math.min(fvi, size - 1);
// Note, calling scrollToIndex also updates the virtual index offset,
// causing the virtualizer to add more items when size is increased,
// and remove exceeding items when size is decreased.
this.scrollToIndex(fvi);
const fviOffsetAfter = this.__getIndexScrollOffset(fvi);
if (fviOffsetBefore !== undefined && fviOffsetAfter !== undefined) {
this._scrollTop += fviOffsetBefore - fviOffsetAfter;
}
}
this.__preventElementUpdates = false;
// When reducing size while invisible, iron-list does not update items, so

@@ -335,4 +356,3 @@ // their hidden state is not updated and their __lastUpdatedIndex is not

// Schedule and flush a resize handler. This will cause a
// re-render for the elements.
// Schedule and flush a resize handler
this._resizeHandler();

@@ -776,2 +796,4 @@ flush();

_adjustVirtualIndexOffset(delta) {
const maxOffset = this._maxVirtualIndexOffset;
if (this._virtualCount >= this.size) {

@@ -784,4 +806,3 @@ this._vidxOffset = 0;

const scale = this._scrollTop / (this.scrollTarget.scrollHeight - this.scrollTarget.offsetHeight);
const offset = scale * this.size;
this._vidxOffset = Math.round(offset - scale * this._virtualCount);
this._vidxOffset = Math.round(scale * maxOffset);
} else {

@@ -805,3 +826,2 @@ // Make sure user can always swipe/wheel scroll to the start and end

// Near end
const maxOffset = this.size - this._virtualCount;
if (this._scrollTop >= this._maxScrollTop && this._maxScrollTop > 0) {

@@ -808,0 +828,0 @@ this._vidxOffset = maxOffset;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc