ui/utilities/VirtualScroll.yaml

30 lines
904 B
YAML
Raw Permalink Normal View History

name: VirtualScroll
purpose: Variable-height virtual scrolling utility used by List and DataGrid.
factory:
signature: VirtualScroll(options)
options:
itemHeight: Optional fixed initial item height.
methods:
reset: Initialize a new list and return its first render window.
init: Measure initial data and invoke refresh callback.
update: Measure one rendered item.
calc: Return paddings, renderedList, and listStartIndex for current scroll position.
rules:
- Treat this as an internal UI utility unless implementing a virtualized component.
- Call update after each rendered row can be measured.
examples:
basic: |
const virtual = VirtualScroll({ itemHeight: 40 })
virtual.reset(rows, container)
virtual.init(rows, () => refresh())
const view = virtual.calc(container, rows)
tests:
- ../components/base/List.test.html
- ../components/data/DataGrid.test.html