@danielgindi/virtual-list-helper 1.0.11 → 1.0.13
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/dist/virtual-list-helper.cjs.js +13 -10
- package/dist/virtual-list-helper.cjs.js.map +1 -1
- package/dist/virtual-list-helper.cjs.min.js +2 -2
- package/dist/virtual-list-helper.cjs.min.js.map +1 -1
- package/dist/virtual-list-helper.es6.js +5 -2
- package/dist/virtual-list-helper.es6.js.map +1 -1
- package/dist/virtual-list-helper.es6.min.js +2 -2
- package/dist/virtual-list-helper.es6.min.js.map +1 -1
- package/dist/virtual-list-helper.umd.js +15 -12
- package/dist/virtual-list-helper.umd.js.map +1 -1
- package/dist/virtual-list-helper.umd.min.js +2 -2
- package/dist/virtual-list-helper.umd.min.js.map +1 -1
- package/eslint.config.mjs +132 -0
- package/lib/index.js +4 -1
- package/package.json +53 -52
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/virtual-list-helper 1.0.
|
|
2
|
+
* @danielgindi/virtual-list-helper 1.0.13
|
|
3
3
|
* git://github.com/danielgindi/virtual-list-helper.git
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var Css_js = require('@danielgindi/dom-utils/lib/Css.js');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @typedef {function(index: number):(number|undefined)} VirtualListHelper~ItemHeightEstimatorFunction
|
|
@@ -455,6 +455,9 @@ class VirtualListHelper {
|
|
|
455
455
|
this._destroyElements();
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
+
for (let el of p.existingEls)
|
|
459
|
+
delete el[ItemIndexSymbol];
|
|
460
|
+
|
|
458
461
|
return this;
|
|
459
462
|
}
|
|
460
463
|
|
|
@@ -864,7 +867,7 @@ class VirtualListHelper {
|
|
|
864
867
|
return undefined;
|
|
865
868
|
|
|
866
869
|
const list = p.list;
|
|
867
|
-
return
|
|
870
|
+
return Css_js.getElementOffset(itemEl).top - Css_js.getElementOffset(list).top + list.scrollTop;
|
|
868
871
|
}
|
|
869
872
|
}
|
|
870
873
|
|
|
@@ -1216,10 +1219,10 @@ class VirtualListHelper {
|
|
|
1216
1219
|
itemEl = p.itemElementCreatorFn();
|
|
1217
1220
|
|
|
1218
1221
|
if (virtualWrapper && insertBefore !== false) {
|
|
1219
|
-
(
|
|
1220
|
-
(
|
|
1221
|
-
(
|
|
1222
|
-
(
|
|
1222
|
+
(/**@type ElementCSSInlineStyle*/itemEl).style.position = 'absolute';
|
|
1223
|
+
(/**@type ElementCSSInlineStyle*/itemEl).style.top = '0';
|
|
1224
|
+
(/**@type ElementCSSInlineStyle*/itemEl).style.left = '0';
|
|
1225
|
+
(/**@type ElementCSSInlineStyle*/itemEl).style.right = '0';
|
|
1223
1226
|
}
|
|
1224
1227
|
}
|
|
1225
1228
|
|
|
@@ -1244,7 +1247,7 @@ class VirtualListHelper {
|
|
|
1244
1247
|
}
|
|
1245
1248
|
|
|
1246
1249
|
// Insert into existing list
|
|
1247
|
-
let beforeIndex = insertBefore ? existingEls.indexOf(
|
|
1250
|
+
let beforeIndex = insertBefore ? existingEls.indexOf(/**@type Element*/insertBefore) : -1;
|
|
1248
1251
|
if (beforeIndex === -1) {
|
|
1249
1252
|
existingEls.push(itemEl);
|
|
1250
1253
|
} else {
|
|
@@ -1305,9 +1308,9 @@ class VirtualListHelper {
|
|
|
1305
1308
|
const supportedTransform = getSupportedTransform();
|
|
1306
1309
|
|
|
1307
1310
|
if (supportedTransform === false) {
|
|
1308
|
-
(
|
|
1311
|
+
(/**@type ElementCSSInlineStyle*/itemEl).style.top = `${pos}px`;
|
|
1309
1312
|
} else {
|
|
1310
|
-
(
|
|
1313
|
+
(/**@type ElementCSSInlineStyle*/itemEl).style[supportedTransform] = `translateY(${pos}px)`;
|
|
1311
1314
|
}
|
|
1312
1315
|
}
|
|
1313
1316
|
}
|