@vaadin/virtual-list
Advanced tools
Comparing version 24.5.1 to 24.5.2
{ | ||
"name": "@vaadin/virtual-list", | ||
"version": "24.5.1", | ||
"version": "24.5.2", | ||
"publishConfig": { | ||
@@ -44,11 +44,11 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/component-base": "~24.5.1", | ||
"@vaadin/lit-renderer": "~24.5.1", | ||
"@vaadin/vaadin-lumo-styles": "~24.5.1", | ||
"@vaadin/vaadin-material-styles": "~24.5.1", | ||
"@vaadin/vaadin-themable-mixin": "~24.5.1", | ||
"@vaadin/component-base": "~24.5.2", | ||
"@vaadin/lit-renderer": "~24.5.2", | ||
"@vaadin/vaadin-lumo-styles": "~24.5.2", | ||
"@vaadin/vaadin-material-styles": "~24.5.2", | ||
"@vaadin/vaadin-themable-mixin": "~24.5.2", | ||
"lit": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@vaadin/chai-plugins": "~24.5.1", | ||
"@vaadin/chai-plugins": "~24.5.2", | ||
"@vaadin/testing-helpers": "^1.0.0", | ||
@@ -61,3 +61,3 @@ "sinon": "^18.0.0" | ||
], | ||
"gitHead": "0cf89edf4f22ee6f71925b86ea38d22f118638c3" | ||
"gitHead": "3e07e97ed0bf355373d1ef0216a3954113e4a40f" | ||
} |
@@ -66,2 +66,7 @@ /** | ||
constructor() { | ||
super(); | ||
this.__onDragStart = this.__onDragStart.bind(this); | ||
} | ||
/** @protected */ | ||
@@ -79,3 +84,2 @@ ready() { | ||
}); | ||
this.__overflowController = new OverflowController(this); | ||
@@ -87,2 +91,18 @@ this.addController(this.__overflowController); | ||
/** @protected */ | ||
connectedCallback() { | ||
super.connectedCallback(); | ||
// Chromium based browsers cannot properly generate drag images for elements | ||
// that have children with massive heights. This workaround prevents crashes | ||
// and performance issues by excluding the items from the drag image. | ||
// https://github.com/vaadin/web-components/issues/7985 | ||
document.addEventListener('dragstart', this.__onDragStart, { capture: true }); | ||
} | ||
/** @protected */ | ||
disconnectedCallback() { | ||
super.disconnectedCallback(); | ||
document.removeEventListener('dragstart', this.__onDragStart, { capture: true }); | ||
} | ||
/** | ||
@@ -139,2 +159,25 @@ * Scroll to a specific index in the virtual list. | ||
/** @private */ | ||
__onDragStart(e) { | ||
// The dragged element can be the element itself or a parent of the element | ||
if (!e.target.contains(this)) { | ||
return; | ||
} | ||
// The threshold value 20000 provides a buffer to both | ||
// - avoid the crash and the performance issues | ||
// - unnecessarily avoid excluding items from the drag image | ||
if (this.$.items.offsetHeight > 20000) { | ||
const initialItemsMaxHeight = this.$.items.style.maxHeight; | ||
const initialVirtualListOverflow = this.style.overflow; | ||
// Momentarily hides the items until the browser starts generating the | ||
// drag image. | ||
this.$.items.style.maxHeight = '0'; | ||
this.style.overflow = 'hidden'; | ||
requestAnimationFrame(() => { | ||
this.$.items.style.maxHeight = initialItemsMaxHeight; | ||
this.style.overflow = initialVirtualListOverflow; | ||
}); | ||
} | ||
} | ||
/** | ||
@@ -141,0 +184,0 @@ * Requests an update for the content of the rows. |
{ | ||
"$schema": "https://json.schemastore.org/web-types", | ||
"name": "@vaadin/virtual-list", | ||
"version": "24.5.1", | ||
"version": "24.5.2", | ||
"description-markup": "markdown", | ||
@@ -6,0 +6,0 @@ "contributions": { |
{ | ||
"$schema": "https://json.schemastore.org/web-types", | ||
"name": "@vaadin/virtual-list", | ||
"version": "24.5.1", | ||
"version": "24.5.2", | ||
"description-markup": "markdown", | ||
@@ -6,0 +6,0 @@ "framework": "lit", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36516
583