Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#33,045 2 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
angular, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu bằng cách xem xét chiến lược cuộn ảo kích thước cố định hiện tại và chiến lược cdk autoSize thử nghiệm, sau đó chạy các ví dụ StackBlitz được liên kết. Công việc hoàn tất khi một chiến lược chấp nhận hàm ánh xạ chỉ mục tới kích thước pixel và hỗ trợ kích thước mục cố định, biến đổi, khoảng cách, padding và có thể mở rộng hoặc thu gọn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
84

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của angular/components

Tất cả issue của angular/components

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.