@plcmp/pl-virtual-scroll 1.0.4 → 1.0.5
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 +23 -25
package/package.json
CHANGED
package/pl-virtual-scroll.js
CHANGED
|
@@ -103,34 +103,32 @@ class PlVirtualScroll extends PlElement {
|
|
|
103
103
|
|
|
104
104
|
case 'splice': {
|
|
105
105
|
let { index: spliceIndex } = mutation;
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.
|
|
113
|
-
if (
|
|
114
|
-
if (this.items[i.index] instanceof PlaceHolder) this.items.load?.(this.items[i.index]);
|
|
115
|
-
|
|
116
|
-
i.ctx.replace(this.items[i.index]);
|
|
117
|
-
i.ctx.applyEffects(undefined);
|
|
118
|
-
i.ctx._ti.applyBinds();
|
|
119
|
-
} else if (i.index >= this.items.length) {
|
|
120
|
-
i.index = null;
|
|
121
|
-
i.offset = -10000;
|
|
122
|
-
fixOffset(i);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// TODO: add more Heuristic to scroll list if visible elements that not changed? like insert rows before
|
|
128
|
-
// visible area
|
|
106
|
+
// if mutation is not root try to apply effects to children (need when pushing to array inside array)
|
|
107
|
+
if (rest.length > 0) {
|
|
108
|
+
let path = [this.as, ...rest].join('.');
|
|
109
|
+
this.phyPool[index].ctx.applyEffects({...mutation, path});
|
|
110
|
+
} else {
|
|
111
|
+
this.phyPool.forEach((i) => {
|
|
112
|
+
if (i.index !== null && i.index >= spliceIndex && i.index < this.items.length) {
|
|
113
|
+
if (this.items[i.index] instanceof PlaceHolder) this.items.load?.(this.items[i.index]);
|
|
129
114
|
|
|
130
|
-
|
|
131
|
-
|
|
115
|
+
i.ctx.replace(this.items[i.index]);
|
|
116
|
+
i.ctx.applyEffects(undefined);
|
|
117
|
+
i.ctx._ti.applyBinds();
|
|
118
|
+
} else if (i.index >= this.items.length) {
|
|
119
|
+
i.index = null;
|
|
120
|
+
i.offset = -10000;
|
|
121
|
+
fixOffset(i);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
132
124
|
}
|
|
133
125
|
|
|
126
|
+
// TODO: add more Heuristic to scroll list if visible elements that not changed? like insert rows before
|
|
127
|
+
// visible area
|
|
128
|
+
|
|
129
|
+
// refresh all PHY if they can be affected
|
|
130
|
+
setTimeout(() => this.render(), 0);
|
|
131
|
+
|
|
134
132
|
break;
|
|
135
133
|
}
|
|
136
134
|
}
|