@plcmp/pl-virtual-scroll 0.1.2 → 0.1.3

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.2",
3
+ "version": "0.1.3",
4
4
  "description": "Component for lazy list render.",
5
5
  "main": "pl-virtual-scroll.js",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  }
24
24
  ],
25
25
  "dependencies": {
26
- "polylib": "^1.1.0",
26
+ "polylib": "^1.1.2",
27
27
  "@plcmp/utils": "^0.1.0"
28
28
  }
29
29
  }
@@ -56,8 +56,9 @@ class PlVirtualScroll extends PlElement {
56
56
 
57
57
  this.canvas = this.canvas ?? this.$.vsCanvas;
58
58
  this.canvas.parentNode.addEventListener('scroll', e => this.onScroll(e) );
59
-
60
- this.sTpl = [...this.childNodes].find( n => n.nodeType === document.COMMENT_NODE && n.textContent.startsWith('tpl:'))?._tpl;
59
+ let tplEl = [...this.childNodes].find( n => n.nodeType === document.COMMENT_NODE && n.textContent.startsWith('tpl:'));
60
+ this.sTpl = tplEl?._tpl;
61
+ this._hctx = tplEl?._hctx;
61
62
 
62
63
  /* let ti = new TemplateInstance(PlVirtualScroll.repTpl);
63
64
  ti.attach(canvas, this, this);
@@ -219,7 +220,7 @@ class PlVirtualScroll extends PlElement {
219
220
 
220
221
  let ctx = new RepeatItem(v, this.as, (ctx, m) => this.onItemChanged(ctx, m) );
221
222
  ctx._ti = inst
222
- inst.attach(this.canvas, undefined, [ctx, ...this.sTpl._hctx ]);
223
+ inst.attach(this.canvas, undefined, [ctx, ...this._hctx ]);
223
224
  let h = this.elementHeight ?? calcNodesRect(inst._nodes).height;
224
225
 
225
226
  return { ctx, h };