@plcmp/pl-virtual-scroll 0.1.12 → 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 +10 -9
package/package.json
CHANGED
package/pl-virtual-scroll.js
CHANGED
|
@@ -74,19 +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
|
}
|
|
84
90
|
|
|
85
|
-
// Временный решение, занулям физический пулл в случаях когда значения массива приходят внутри объектов
|
|
86
|
-
// Исправить в будущем на более умную замену значений
|
|
87
|
-
if(Array.isArray(mutation.value) && Array.isArray(mutation.oldValue) && mutation.oldValue.length != mutation.value.length) {
|
|
88
|
-
this.phyPool = [];
|
|
89
|
-
}
|
|
90
91
|
if (index !== undefined && +index >= 0) {
|
|
91
92
|
let el = this.phyPool.find(i => i.index === +index);
|
|
92
93
|
if (el && rest.length > 0) {
|