@vaadin/virtual-list
Advanced tools
Comparing version 24.6.0 to 24.6.1
{ | ||
"name": "@vaadin/virtual-list", | ||
"version": "24.6.0", | ||
"version": "24.6.1", | ||
"publishConfig": { | ||
@@ -42,12 +42,12 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/component-base": "~24.6.0", | ||
"@vaadin/lit-renderer": "~24.6.0", | ||
"@vaadin/vaadin-lumo-styles": "~24.6.0", | ||
"@vaadin/vaadin-material-styles": "~24.6.0", | ||
"@vaadin/vaadin-themable-mixin": "~24.6.0", | ||
"@vaadin/component-base": "~24.6.1", | ||
"@vaadin/lit-renderer": "~24.6.1", | ||
"@vaadin/vaadin-lumo-styles": "~24.6.1", | ||
"@vaadin/vaadin-material-styles": "~24.6.1", | ||
"@vaadin/vaadin-themable-mixin": "~24.6.1", | ||
"lit": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@vaadin/chai-plugins": "~24.6.0", | ||
"@vaadin/testing-helpers": "^1.0.0", | ||
"@vaadin/chai-plugins": "~24.6.1", | ||
"@vaadin/testing-helpers": "^1.1.0", | ||
"sinon": "^18.0.0" | ||
@@ -59,3 +59,3 @@ }, | ||
], | ||
"gitHead": "c0b38aa981494d04fac64da35aa3890ad72551ea" | ||
"gitHead": "858d4220653a0603ce9c36da054889eb42ceb327" | ||
} |
@@ -68,3 +68,3 @@ /** | ||
super(); | ||
this.__onDragStart = this.__onDragStart.bind(this); | ||
this.__onDocumentDragStart = this.__onDocumentDragStart.bind(this); | ||
} | ||
@@ -93,7 +93,3 @@ | ||
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 }); | ||
document.addEventListener('dragstart', this.__onDocumentDragStart, { capture: true }); | ||
} | ||
@@ -104,3 +100,3 @@ | ||
super.disconnectedCallback(); | ||
document.removeEventListener('dragstart', this.__onDragStart, { capture: true }); | ||
document.removeEventListener('dragstart', this.__onDocumentDragStart, { capture: true }); | ||
} | ||
@@ -159,21 +155,20 @@ | ||
/** @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'; | ||
/** | ||
* Webkit-based browsers have issues with generating drag images | ||
* for elements that have children with massive heights. Chromium | ||
* browsers crash, while Safari experiences significant performance | ||
* issues. To mitigate these issues, we hide the items container | ||
* when drag starts to remove it from the drag image. | ||
* | ||
* Related issues: | ||
* - https://github.com/vaadin/web-components/issues/7985 | ||
* - https://issues.chromium.org/issues/383356871 | ||
* | ||
* @private | ||
*/ | ||
__onDocumentDragStart(e) { | ||
if (e.target.contains(this) && this.scrollHeight > 20000) { | ||
this.$.items.style.display = 'none'; | ||
requestAnimationFrame(() => { | ||
this.$.items.style.maxHeight = initialItemsMaxHeight; | ||
this.style.overflow = initialVirtualListOverflow; | ||
this.$.items.style.display = ''; | ||
}); | ||
@@ -180,0 +175,0 @@ } |
{ | ||
"$schema": "https://json.schemastore.org/web-types", | ||
"name": "@vaadin/virtual-list", | ||
"version": "24.6.0", | ||
"version": "24.6.1", | ||
"description-markup": "markdown", | ||
@@ -6,0 +6,0 @@ "contributions": { |
{ | ||
"$schema": "https://json.schemastore.org/web-types", | ||
"name": "@vaadin/virtual-list", | ||
"version": "24.6.0", | ||
"version": "24.6.1", | ||
"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
38000
630