Skip to content

feat: add grid virtualization continer - #2382

Draft
rkaraivanov wants to merge 4 commits into
masterfrom
rkaraivanov/virtual-grid
Draft

rkaraivanov wants to merge 4 commits into
masterfrom
rkaraivanov/virtual-grid

Conversation

@rkaraivanov

Copy link
Copy Markdown
Member

Description

Add a row-major 2-D virtualizer on top of the shared virtual scroll engine.
Two axis engines sit behind a VirtualGridEngine facade; each rendered row
is a CSS grid driven by a --igc-grid-cols track on the content wrapper,
with the first window cell placed at a named [window-start] line so
pinned tracks can be prepended later. Rows are fixed height by default
with auto-row-height opt-in; column widths come from columnWidth as a
number or a per-column function. Host defaults to role="grid" and a
focusable tabindex, with aria-rowindex/aria-colindex on cells.

Type of Change

  • New feature (non-breaking change that adds functionality)

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally
  • I have updated documentation if needed

…red virtualization internals

- Add `SizeIndex` with an O(1) `UniformSizes` implementation, `engine.fixed`
  and `engine.setSizes()`; `fixed-item-size` skips per-item measurement
- Move timing, scroll settle, layout settle and indexed resize helpers to
  `#internals` for reuse by the upcoming `igc-virtual-grid`
- Add `FixedItemSize` story with 1M rows and changelog entry
…tion component

Add a row-major 2-D virtualizer on top of the shared virtual scroll engine.
Two axis engines sit behind a `VirtualGridEngine` facade; each rendered row
is a CSS grid driven by a `--igc-grid-cols` track on the content wrapper,
with the first window cell placed at a named `[window-start]` line so
pinned tracks can be prepended later. Rows are fixed height by default
with `auto-row-height` opt-in; column widths come from `columnWidth` as a
number or a per-column function. Host defaults to `role="grid"` and a
focusable tabindex, with `aria-rowindex`/`aria-colindex` on cells.

Extract the scroll-to correction loop into `ScrollCorrectionController`
and light-DOM style adoption into `LightDomStylesController`, both now
shared with `igc-virtual-scroll`. The engine gains `getRangeOffset`,
`sizeAt`, `resolveScrollOffset` and range/normalization helpers.
…t` and `getCellElement`

`headerTemplate` renders a sticky row of `columnheader` cells before the
track that shares the column tracks of the rows. Its measured height is
reserved from the vertical axis and taken off the row viewport.
`pinned-columns-start` and `pinned-columns-end` keep that many leading and
trailing columns in view as sticky cells, each with its own inset, placed
through the named `window-start` and `pinned-end` grid lines. The
`VirtualGridEngine` facade owns the split between pinned and scrollable
columns and the viewport narrowing, so column indexes at its boundary are
plain indexes into `columns`.

`igcDataRequest` asks for more rows near the end of `data` through a
`DataRequestTracker` shared with `igc-virtual-scroll`, and
`getCellElement` returns the rendered wrapper of a cell for focus
management.

Shared changes: `reservedSize` on the virtual scroll engine so a track
plus its siblings stays within the browser limit under compression;
`ResizeObserverController.sync` to follow one element; the layout settle
controller now yields one task after the frame so a ResizeObserver-driven
render is covered by a single `layoutComplete`.
…choring

`rowTemplate` renders a row as one `full-width-cell` part; a `null` result
falls back to the cell template. `autoSizeColumn` measures the rendered
cells at `max-content` and stores the width in the grid engine facade,
which now owns the widths array (`setColumns`, `setPinned`,
`setColumnWidth`). The shared `VirtualScrollEngine` gains `anchorOffset`
and `takeMeasureShift()` so the grid keeps the row under the scroll
position stable when `auto-row-height` measurements change.
let notifications = 0;
engine.onSizeChange = () => notifications++;

engine.fixed = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant