@vaadin/component-base 23.5.6 → 23.5.8

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": "23.5.6",
3
+ "version": "23.5.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,5 +42,5 @@
42
42
  "@vaadin/testing-helpers": "^0.3.2",
43
43
  "sinon": "^13.0.2"
44
44
  },
45
- "gitHead": "8017ec1c49880fcea0819ef306c4fa3c711b0087"
45
+ "gitHead": "084fe61b2028ef2989c82623bff0255b2d62be55"
46
46
  }
@@ -44,7 +44,7 @@ const registered = new Set();
44
44
  export const ElementMixin = (superClass) =>
45
45
  class VaadinElementMixin extends DirMixin(superClass) {
46
46
  static get version() {
47
- return '23.5.6';
47
+ return '23.5.8';
48
48
  }
49
49
 
50
50
  /** @protected */
@@ -563,6 +563,53 @@ export class IronListAdapter {
563
563
  );
564
564
  }
565
565
 
566
+ /**
567
+ * An optimal physical size such that we will have enough physical items
568
+ * to fill up the viewport and recycle when the user scrolls.
569
+ *
570
+ * This default value assumes that we will at least have the equivalent
571
+ * to a viewport of physical items above and below the user's viewport.
572
+ * @override
573
+ */
574
+ get _optPhysicalSize() {
575
+ const optPhysicalSize = super._optPhysicalSize;
576
+ // No need to adjust
577
+ if (optPhysicalSize <= 0) {
578
+ return optPhysicalSize;
579
+ }
580
+ // Item height buffer accounts for the cases where some items are much larger than the average.
581
+ // This can lead to some items not being rendered and leaving empty space in the viewport.
582
+ // https://github.com/vaadin/flow-components/issues/6651
583
+ return optPhysicalSize + this.__getItemHeightBuffer();
584
+ }
585
+
586
+ /**
587
+ * Extra item height buffer used when calculating optimal physical size.
588
+ *
589
+ * The iron list core uses the optimal physical size when determining whether to increase the item pool.
590
+ * For the cases where some items are much larger than the average, the iron list core might not increase item pool.
591
+ * This can lead to the large item not being rendered.
592
+ *
593
+ * @returns {Number} - Extra item height buffer
594
+ * @private
595
+ */
596
+ __getItemHeightBuffer() {
597
+ // No need for a buffer with no items
598
+ if (this._physicalCount === 0) {
599
+ return 0;
600
+ }
601
+ // The regular buffer zone height for either top or bottom
602
+ const bufferZoneHeight = Math.ceil((this._viewportHeight * (this._maxPages - 1)) / 2);
603
+ // The maximum height of the currently rendered items
604
+ const maxItemHeight = Math.max(...this._physicalSizes);
605
+ // Only add buffer if the item is larger that the other items
606
+ if (maxItemHeight > Math.min(...this._physicalSizes)) {
607
+ // Add a buffer height since the large item can still be in the viewport and out of the original buffer
608
+ return Math.max(0, maxItemHeight - bufferZoneHeight);
609
+ }
610
+ return 0;
611
+ }
612
+
566
613
  /**
567
614
  * @returns {Number|undefined} - The browser's default font-size in pixels
568
615
  * @private