@vaadin/component-base 24.0.0-beta1 → 24.0.0-beta2
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.0.0-
|
|
3
|
+
"version": "24.0.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@vaadin/testing-helpers": "^0.4.0",
|
|
43
43
|
"sinon": "^13.0.2"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "00086f1f6d487f042f189c9b9ecd7ba736960888"
|
|
46
46
|
}
|
package/src/element-mixin.js
CHANGED
package/src/iron-list-core.js
CHANGED
|
@@ -23,6 +23,7 @@ const DEFAULT_PHYSICAL_COUNT = 3;
|
|
|
23
23
|
* If something in the scrolling engine needs to be changed
|
|
24
24
|
* for the virtualizer's purposes, override a function
|
|
25
25
|
* in virtualizer-iron-list-adapter.js instead of changing it here.
|
|
26
|
+
* If a function on this file is no longer needed, the code can be safely deleted.
|
|
26
27
|
*
|
|
27
28
|
* This will allow us to keep the iron-list code here as close to
|
|
28
29
|
* the original as possible.
|
|
@@ -563,39 +564,6 @@ export const ironList = {
|
|
|
563
564
|
return this._virtualStart + (this._physicalCount - this._physicalStart) + pidx;
|
|
564
565
|
},
|
|
565
566
|
|
|
566
|
-
/**
|
|
567
|
-
* Updates the height for a given set of items.
|
|
568
|
-
*
|
|
569
|
-
* @param {!Array<number>=} itemSet
|
|
570
|
-
*/
|
|
571
|
-
_updateMetrics(itemSet) {
|
|
572
|
-
// Make sure we distributed all the physical items
|
|
573
|
-
// so we can measure them.
|
|
574
|
-
flush();
|
|
575
|
-
|
|
576
|
-
let newPhysicalSize = 0;
|
|
577
|
-
let oldPhysicalSize = 0;
|
|
578
|
-
const prevAvgCount = this._physicalAverageCount;
|
|
579
|
-
const prevPhysicalAvg = this._physicalAverage;
|
|
580
|
-
|
|
581
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
582
|
-
this._iterateItems((pidx, vidx) => {
|
|
583
|
-
oldPhysicalSize += this._physicalSizes[pidx];
|
|
584
|
-
this._physicalSizes[pidx] = this._physicalItems[pidx].offsetHeight;
|
|
585
|
-
newPhysicalSize += this._physicalSizes[pidx];
|
|
586
|
-
this._physicalAverageCount += this._physicalSizes[pidx] ? 1 : 0;
|
|
587
|
-
}, itemSet);
|
|
588
|
-
|
|
589
|
-
this._physicalSize = this._physicalSize + newPhysicalSize - oldPhysicalSize;
|
|
590
|
-
|
|
591
|
-
// Update the average if it measured something.
|
|
592
|
-
if (this._physicalAverageCount !== prevAvgCount) {
|
|
593
|
-
this._physicalAverage = Math.round(
|
|
594
|
-
(prevPhysicalAvg * prevAvgCount + newPhysicalSize) / this._physicalAverageCount,
|
|
595
|
-
);
|
|
596
|
-
}
|
|
597
|
-
},
|
|
598
|
-
|
|
599
567
|
/**
|
|
600
568
|
* Updates the position of the physical items.
|
|
601
569
|
*/
|
|
@@ -143,6 +143,56 @@ export class IronListAdapter {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Updates the height for a given set of items.
|
|
148
|
+
*
|
|
149
|
+
* @param {!Array<number>=} itemSet
|
|
150
|
+
*/
|
|
151
|
+
_updateMetrics(itemSet) {
|
|
152
|
+
// Make sure we distributed all the physical items
|
|
153
|
+
// so we can measure them.
|
|
154
|
+
flush();
|
|
155
|
+
|
|
156
|
+
let newPhysicalSize = 0;
|
|
157
|
+
let oldPhysicalSize = 0;
|
|
158
|
+
const prevAvgCount = this._physicalAverageCount;
|
|
159
|
+
const prevPhysicalAvg = this._physicalAverage;
|
|
160
|
+
|
|
161
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
162
|
+
this._iterateItems((pidx, vidx) => {
|
|
163
|
+
oldPhysicalSize += this._physicalSizes[pidx];
|
|
164
|
+
this._physicalSizes[pidx] = Math.ceil(this.__getBorderBoxHeight(this._physicalItems[pidx]));
|
|
165
|
+
newPhysicalSize += this._physicalSizes[pidx];
|
|
166
|
+
this._physicalAverageCount += this._physicalSizes[pidx] ? 1 : 0;
|
|
167
|
+
}, itemSet);
|
|
168
|
+
|
|
169
|
+
this._physicalSize = this._physicalSize + newPhysicalSize - oldPhysicalSize;
|
|
170
|
+
|
|
171
|
+
// Update the average if it measured something.
|
|
172
|
+
if (this._physicalAverageCount !== prevAvgCount) {
|
|
173
|
+
this._physicalAverage = Math.round(
|
|
174
|
+
(prevPhysicalAvg * prevAvgCount + newPhysicalSize) / this._physicalAverageCount,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
__getBorderBoxHeight(el) {
|
|
180
|
+
const style = getComputedStyle(el);
|
|
181
|
+
|
|
182
|
+
const itemHeight = parseFloat(style.height) || 0;
|
|
183
|
+
|
|
184
|
+
if (style.boxSizing === 'border-box') {
|
|
185
|
+
return itemHeight;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
189
|
+
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
190
|
+
const borderBottomWidth = parseFloat(style.borderBottomWidth) || 0;
|
|
191
|
+
const borderTopWidth = parseFloat(style.borderTopWidth) || 0;
|
|
192
|
+
|
|
193
|
+
return itemHeight + paddingBottom + paddingTop + borderBottomWidth + borderTopWidth;
|
|
194
|
+
}
|
|
195
|
+
|
|
146
196
|
__updateElement(el, index, forceSameIndexUpdates) {
|
|
147
197
|
// Clean up temporary placeholder sizing
|
|
148
198
|
if (el.style.paddingTop) {
|