@vaadin/component-base 24.6.0-alpha2 → 24.6.0-alpha4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "24.6.0-
|
|
3
|
+
"version": "24.6.0-alpha4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"lit": "^3.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@vaadin/chai-plugins": "24.6.0-
|
|
41
|
+
"@vaadin/chai-plugins": "24.6.0-alpha4",
|
|
42
42
|
"@vaadin/testing-helpers": "^1.0.0",
|
|
43
43
|
"sinon": "^18.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "78967d4f3bb46f58f43c2cc621802554acb2efaf"
|
|
46
46
|
}
|
package/src/browser-utils.js
CHANGED
package/src/define.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export function defineCustomElement(CustomElement, version = '24.6.0-
|
|
7
|
+
export function defineCustomElement(CustomElement, version = '24.6.0-alpha4') {
|
|
8
8
|
Object.defineProperty(CustomElement, 'version', {
|
|
9
9
|
get() {
|
|
10
10
|
return version;
|
|
@@ -727,6 +727,53 @@ export class IronListAdapter {
|
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
+
/**
|
|
731
|
+
* An optimal physical size such that we will have enough physical items
|
|
732
|
+
* to fill up the viewport and recycle when the user scrolls.
|
|
733
|
+
*
|
|
734
|
+
* This default value assumes that we will at least have the equivalent
|
|
735
|
+
* to a viewport of physical items above and below the user's viewport.
|
|
736
|
+
* @override
|
|
737
|
+
*/
|
|
738
|
+
get _optPhysicalSize() {
|
|
739
|
+
const optPhysicalSize = super._optPhysicalSize;
|
|
740
|
+
// No need to adjust
|
|
741
|
+
if (optPhysicalSize <= 0 || this.__hasPlaceholders()) {
|
|
742
|
+
return optPhysicalSize;
|
|
743
|
+
}
|
|
744
|
+
// Item height buffer accounts for the cases where some items are much larger than the average.
|
|
745
|
+
// This can lead to some items not being rendered and leaving empty space in the viewport.
|
|
746
|
+
// https://github.com/vaadin/flow-components/issues/6651
|
|
747
|
+
return optPhysicalSize + this.__getItemHeightBuffer();
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Extra item height buffer used when calculating optimal physical size.
|
|
752
|
+
*
|
|
753
|
+
* The iron list core uses the optimal physical size when determining whether to increase the item pool.
|
|
754
|
+
* For the cases where some items are much larger than the average, the iron list core might not increase item pool.
|
|
755
|
+
* This can lead to the large item not being rendered.
|
|
756
|
+
*
|
|
757
|
+
* @returns {Number} - Extra item height buffer
|
|
758
|
+
* @private
|
|
759
|
+
*/
|
|
760
|
+
__getItemHeightBuffer() {
|
|
761
|
+
// No need for a buffer with no items
|
|
762
|
+
if (this._physicalCount === 0) {
|
|
763
|
+
return 0;
|
|
764
|
+
}
|
|
765
|
+
// The regular buffer zone height for either top or bottom
|
|
766
|
+
const bufferZoneHeight = Math.ceil((this._viewportHeight * (this._maxPages - 1)) / 2);
|
|
767
|
+
// The maximum height of the currently rendered items
|
|
768
|
+
const maxItemHeight = Math.max(...this._physicalSizes);
|
|
769
|
+
// Only add buffer if the item is larger that the other items
|
|
770
|
+
if (maxItemHeight > Math.min(...this._physicalSizes)) {
|
|
771
|
+
// Add a buffer height since the large item can still be in the viewport and out of the original buffer
|
|
772
|
+
return Math.max(0, maxItemHeight - bufferZoneHeight);
|
|
773
|
+
}
|
|
774
|
+
return 0;
|
|
775
|
+
}
|
|
776
|
+
|
|
730
777
|
/**
|
|
731
778
|
* @returns {Number|undefined} - The browser's default font-size in pixels
|
|
732
779
|
* @private
|