@vaadin/virtual-list
Advanced tools
Comparing version 24.6.0-alpha4 to 24.6.0-alpha5
{ | ||
"name": "@vaadin/virtual-list", | ||
"version": "24.6.0-alpha4", | ||
"version": "24.6.0-alpha5", | ||
"publishConfig": { | ||
@@ -44,11 +44,11 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/component-base": "24.6.0-alpha4", | ||
"@vaadin/lit-renderer": "24.6.0-alpha4", | ||
"@vaadin/vaadin-lumo-styles": "24.6.0-alpha4", | ||
"@vaadin/vaadin-material-styles": "24.6.0-alpha4", | ||
"@vaadin/vaadin-themable-mixin": "24.6.0-alpha4", | ||
"@vaadin/component-base": "24.6.0-alpha5", | ||
"@vaadin/lit-renderer": "24.6.0-alpha5", | ||
"@vaadin/vaadin-lumo-styles": "24.6.0-alpha5", | ||
"@vaadin/vaadin-material-styles": "24.6.0-alpha5", | ||
"@vaadin/vaadin-themable-mixin": "24.6.0-alpha5", | ||
"lit": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@vaadin/chai-plugins": "24.6.0-alpha4", | ||
"@vaadin/chai-plugins": "24.6.0-alpha5", | ||
"@vaadin/testing-helpers": "^1.0.0", | ||
@@ -61,3 +61,3 @@ "sinon": "^18.0.0" | ||
], | ||
"gitHead": "78967d4f3bb46f58f43c2cc621802554acb2efaf" | ||
"gitHead": "cbfa46fe276f254dcaa99a622710d56df7f0a539" | ||
} |
@@ -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.6.0-alpha4", | ||
"version": "24.6.0-alpha5", | ||
"description-markup": "markdown", | ||
@@ -6,0 +6,0 @@ "contributions": { |
{ | ||
"$schema": "https://json.schemastore.org/web-types", | ||
"name": "@vaadin/virtual-list", | ||
"version": "24.6.0-alpha4", | ||
"version": "24.6.0-alpha5", | ||
"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
36641
584
+ Added@vaadin/component-base@24.6.0-alpha5(transitive)
+ Added@vaadin/icon@24.6.0-alpha5(transitive)
+ Added@vaadin/lit-renderer@24.6.0-alpha5(transitive)
+ Added@vaadin/vaadin-lumo-styles@24.6.0-alpha5(transitive)
+ Added@vaadin/vaadin-material-styles@24.6.0-alpha5(transitive)
+ Added@vaadin/vaadin-themable-mixin@24.6.0-alpha5(transitive)
- Removed@vaadin/component-base@24.6.0-alpha4(transitive)
- Removed@vaadin/icon@24.6.0-alpha4(transitive)
- Removed@vaadin/lit-renderer@24.6.0-alpha4(transitive)
- Removed@vaadin/vaadin-lumo-styles@24.6.0-alpha4(transitive)
- Removed@vaadin/vaadin-material-styles@24.6.0-alpha4(transitive)
- Removed@vaadin/vaadin-themable-mixin@24.6.0-alpha4(transitive)