@plcmp/pl-virtual-scroll 0.1.4 → 0.1.6

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": "@plcmp/pl-virtual-scroll",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Component for lazy list render.",
5
5
  "main": "pl-virtual-scroll.js",
6
6
  "repository": {
@@ -74,6 +74,13 @@ class PlVirtualScroll extends PlElement {
74
74
  let [, index, ...rest] = normalizePath(mutation.path);
75
75
  switch (mutation.action) {
76
76
  case 'upd':
77
+ if(mutation.oldValue.length == mutation.value.length) {
78
+ this.phyPool.forEach(i => {
79
+ i.ctx.replace(this.items[i.index]);
80
+ i.ctx.applyEffects();
81
+ i.ctx._ti.applyBinds();
82
+ });
83
+ }
77
84
  if (index !== undefined && +index >= 0) {
78
85
  let el = this.phyPool.find(i => i.index === +index);
79
86
  if (el && rest.length > 0) {
@@ -102,7 +109,7 @@ class PlVirtualScroll extends PlElement {
102
109
  i.index = null;
103
110
  }
104
111
  });
105
- this.render();
112
+ setTimeout(() => this.render(), 0);
106
113
 
107
114
  break;
108
115
  }
@@ -174,9 +181,9 @@ class PlVirtualScroll extends PlElement {
174
181
 
175
182
 
176
183
  if (this.elementHeight && this.items.length)
177
- canvas.style.setProperty('height', this.elementHeight * this.items.length + 'px')
184
+ canvas.style.setProperty('max-height', this.elementHeight * this.items.length + 'px')
178
185
  else
179
- canvas.style.setProperty('height', 0)
186
+ canvas.style.setProperty('max-height', 0)
180
187
  }
181
188
 
182
189
  /**