angular / angular/components

feat(cdk/scrolling): ScrollToIndexIfNeeded function

オープン
#21,522 コメント 3 件 リアクション 3 件 担当者 0 名 GitHub で見る
area: cdk/scrolling feature P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

#### Feature Description

We have `scrollToIndex` function on `CdkVirtualScrollViewport`. But we cannot determine whenever an index is or is not withing **visible** viewport.

```ts
const viewPort: CdkVirtualScrollViewport;

scrollToIndex(index: number): void {
const range = viewPort.getRenderedRange();

if (range.start > index || range.end < index) {
// Scroll is 100% needed.
viewPort.scrollToIndex(index, 'auto');
} else {
// The index is within range, but not necessarily within visible viewport!
// From my testing I have +-8 items above and bellow at the time
}
}
```

#### Use Case

It would enable scrolling to an item if only needed.

#### Note

If there was `CdkVirtualScrollViewport.getVisibleRange`, we could even scroll our desired element to the middle of the viewport!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

CdkVirtualScrollViewport から始め、特に既存のエントリポイントである scrollToIndex と getRenderedRange を確認します。要求されているビューポート中央のユースケースを含め、不要なスクロールを避けるために、表示範囲をどのように公開または利用できるかを判断します。ビューポートが、インデックスが表示ビューポートの外側にある場合にのみそのインデックスへスクロールできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。