Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

feat(virtual-scroll): Add dynamic fixed size virtual scroll strategy

Aperta
#33,045 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
angular, typescript
Ambito
frontend

Direzione di ricerca

Inizia esaminando l'attuale strategia di scorrimento virtuale a dimensione fissa e la strategia sperimentale cdk autoSize, quindi esegui gli esempi StackBlitz collegati. Il lavoro è completo quando una strategia accetta una funzione che associa un indice a una dimensione in pixel e supporta dimensioni degli elementi fisse, variabili, con spaziatura, con padding ed espandibili o comprimibili.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: cdk/scrolling feature gemini-triaged P3
Feature Description

Currently the provided virtual scroll strategy is only for fixed size. This is very restrictive.
In cdk experimental there is an autoSize strategy that determines the size of an item automatically but it is experimental and decides the size by itself.
I propose a new strategy for fixed, known but dynamic size.
For example if I have a list of items with some items being with 50px height and some with 80px height I can't use any default strategy for it but I also don't need autoSize. I know item 3 is 80px but item 6 is 50px which makes it easier to implement.
Using the new strategy I can express the dynamic (but known) size.
An example API for it is passing a function: (index: number) => number that returns a pixel size based on given item index.
One of the benefits is that fixed size is a specific case of the new strategy with the function returning the same size always (with a bit of worse performance) - so no need to create two default strategies as fixed (the current one) can be derived from the new strategy.
I created a stackblitz with such strategy and some use cases:
https://stackblitz.com/edit/stackblitz-starters-eey1ve9m

Use Case
  1. Can be used for fixed size like now
  2. Can be used to add gap between items
  3. Can be used to add padding (top/bottom) - although there are other ways to do it currently
  4. Can be used to express varying sizes (80px and 50px mixed for example)
  5. Can be used to allow expand/collapse items for details - initial size for index X is 50px. On click increase size to 80px and refresh strategy. Same for collapse but the other way around.
  6. Can be a mix of all the above

To summarize it gives a lot of control for many use cases including the fixed size that exists today.

Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 1h
PR unite (30g)
84

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di angular/components

Tutte le issue di angular/components

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.