@plcmp/pl-virtual-scroll 0.1.11 → 0.1.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/package.json +1 -1
- package/pl-virtual-scroll.js +12 -4
package/package.json
CHANGED
package/pl-virtual-scroll.js
CHANGED
|
@@ -74,13 +74,20 @@ class PlVirtualScroll extends PlElement {
|
|
|
74
74
|
let [, index, ...rest] = normalizePath(mutation.path);
|
|
75
75
|
switch (mutation.action) {
|
|
76
76
|
case 'upd':
|
|
77
|
-
if(Array.isArray(mutation.value) && Array.isArray(mutation.oldValue)
|
|
77
|
+
if(mutation.path == 'items' && Array.isArray(mutation.value) && Array.isArray(mutation.oldValue)) {
|
|
78
78
|
this.phyPool.forEach(i => {
|
|
79
|
-
i.
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
if (i.index !== null && i.index < this.items.length) {
|
|
80
|
+
if (this.items[i.index] instanceof PlaceHolder) this.items.load?.(this.items[i.index]);
|
|
81
|
+
|
|
82
|
+
i.ctx.replace(this.items[i.index]);
|
|
83
|
+
i.ctx.applyEffects();
|
|
84
|
+
i.ctx._ti.applyBinds();
|
|
85
|
+
} else if (i.index >= this.items.length) {
|
|
86
|
+
i.index = null;
|
|
87
|
+
}
|
|
82
88
|
});
|
|
83
89
|
}
|
|
90
|
+
|
|
84
91
|
if (index !== undefined && +index >= 0) {
|
|
85
92
|
let el = this.phyPool.find(i => i.index === +index);
|
|
86
93
|
if (el && rest.length > 0) {
|
|
@@ -225,6 +232,7 @@ class PlVirtualScroll extends PlElement {
|
|
|
225
232
|
if (n.style) {
|
|
226
233
|
n.style.transform = `translateY(${target.offset}px)`;
|
|
227
234
|
n.style.position = 'absolute';
|
|
235
|
+
n.setAttribute('virtualOffser', target.offset);
|
|
228
236
|
}
|
|
229
237
|
});
|
|
230
238
|
return target;
|