@plcmp/pl-virtual-scroll 0.1.0 → 0.1.1

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.0",
3
+ "version": "0.1.1",
4
4
  "description": "Component for lazy list render.",
5
5
  "main": "pl-virtual-scroll.js",
6
6
  "repository": {
@@ -72,6 +72,7 @@ class PlVirtualScroll extends PlElement {
72
72
  if (el && rest.length > 0) {
73
73
  let path = [this.as, ...rest].join('.');
74
74
  el.ti.applyEffects({ ...mutation, path });
75
+ if (this.items[el.index] instanceof PlaceHolder) this.items.load?.(this.items[el.index])
75
76
  }
76
77
  } else {
77
78
  setTimeout(() => this.render(), 0);
@@ -86,6 +87,7 @@ class PlVirtualScroll extends PlElement {
86
87
  //refresh all PHY if they can be affected
87
88
  this.phyPool.forEach(i => {
88
89
  if (i.index !== null && i.index >= spliceIndex && i.index < this.items.length) {
90
+ if (this.items[i.index] instanceof PlaceHolder) this.items.load?.(this.items[i.index]);
89
91
  i.ctx.replace(this.items[i.index]);
90
92
  i.ti.ctx = i.ctx;
91
93
  i.ti.applyEffects();
@@ -221,8 +223,7 @@ class PlVirtualScroll extends PlElement {
221
223
  ti._hti = this._hti;
222
224
  ctx._ti = ti;
223
225
  ti.attach({ ...ctx, root: this.canvas ?? this.$.vsCanvas }, undefined, this._pti);
224
- let rect = calcNodesRect(ti._nodes);
225
- let h = rect.height;
226
+ let h = this.elementHeight ?? calcNodesRect(ti._nodes).height;
226
227
 
227
228
  return { ctx, ti, h };
228
229
  }