Skip to content

Commit 002bfc7

Browse files
committed
virtual-scroll: rename Range to ListRange to avoid confusion with native Range (#10220)
1 parent 9b742c3 commit 002bfc7

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/cdk-experimental/scrolling/virtual-for-of.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ArrayDataSource, CollectionViewer, DataSource, Range} from '@angular/cdk/collections';
9+
import {ArrayDataSource, CollectionViewer, DataSource, ListRange} from '@angular/cdk/collections';
1010
import {
1111
Directive,
1212
DoCheck,
@@ -54,7 +54,7 @@ export type CdkVirtualForOfContext<T> = {
5454
})
5555
export class CdkVirtualForOf<T> implements CollectionViewer, DoCheck, OnDestroy {
5656
/** Emits when the rendered view of the data changes. */
57-
viewChange = new Subject<Range>();
57+
viewChange = new Subject<ListRange>();
5858

5959
/** Subject that emits when a new DataSource instance is given. */
6060
private _dataSourceChanges = new Subject<DataSource<T>>();
@@ -124,7 +124,7 @@ export class CdkVirtualForOf<T> implements CollectionViewer, DoCheck, OnDestroy
124124
private _renderedItems: T[];
125125

126126
/** The currently rendered range of indices. */
127-
private _renderedRange: Range;
127+
private _renderedRange: ListRange;
128128

129129
/**
130130
* The template cache used to hold on ot template instancess that have been stamped out, but don't
@@ -221,7 +221,7 @@ export class CdkVirtualForOf<T> implements CollectionViewer, DoCheck, OnDestroy
221221
}
222222

223223
/** React to scroll state changes in the viewport. */
224-
private _onRenderedRangeChange(renderedRange: Range) {
224+
private _onRenderedRangeChange(renderedRange: ListRange) {
225225
this._renderedRange = renderedRange;
226226
this.viewChange.next(this._renderedRange);
227227
this._renderedItems = this._data.slice(this._renderedRange.start, this._renderedRange.end);

src/cdk-experimental/scrolling/virtual-scroll-fixed-size.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Range} from '@angular/cdk/collections';
9+
import {ListRange} from '@angular/cdk/collections';
1010
import {Directive, forwardRef, Input, OnChanges} from '@angular/core';
1111
import {VIRTUAL_SCROLL_STRATEGY, VirtualScrollStrategy} from './virtual-scroll-strategy';
1212
import {CdkVirtualScrollViewport} from './virtual-scroll-viewport';
@@ -102,7 +102,7 @@ export class VirtualScrollFixedSizeStrategy implements VirtualScrollStrategy {
102102
* @param expandEnd The number of items to expand the end of the range by.
103103
* @return The expanded range.
104104
*/
105-
private _expandRange(range: Range, expandStart: number, expandEnd: number): Range {
105+
private _expandRange(range: ListRange, expandStart: number, expandEnd: number): ListRange {
106106
if (!this._viewport) {
107107
return {...range};
108108
}

src/cdk-experimental/scrolling/virtual-scroll-viewport.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Range} from '@angular/cdk/collections';
9+
import {ListRange} from '@angular/cdk/collections';
1010
import {
1111
ChangeDetectionStrategy,
1212
ChangeDetectorRef,
@@ -31,7 +31,7 @@ import {VIRTUAL_SCROLL_STRATEGY, VirtualScrollStrategy} from './virtual-scroll-s
3131

3232

3333
/** Checks if the given ranges are equal. */
34-
function rangesEqual(r1: Range, r2: Range): boolean {
34+
function rangesEqual(r1: ListRange, r2: ListRange): boolean {
3535
return r1.start == r2.start && r1.end == r2.end;
3636
}
3737

@@ -54,7 +54,7 @@ export class CdkVirtualScrollViewport implements OnInit, OnDestroy {
5454
private _detachedSubject = new Subject<void>();
5555

5656
/** Emits when the rendered range changes. */
57-
private _renderedRangeSubject = new Subject<Range>();
57+
private _renderedRangeSubject = new Subject<ListRange>();
5858

5959
/** The direction the viewport scrolls. */
6060
@Input() orientation: 'horizontal' | 'vertical' = 'vertical';
@@ -63,7 +63,7 @@ export class CdkVirtualScrollViewport implements OnInit, OnDestroy {
6363
@ViewChild('contentWrapper') _contentWrapper: ElementRef;
6464

6565
/** A stream that emits whenever the rendered range changes. */
66-
renderedRangeStream: Observable<Range> = this._renderedRangeSubject.asObservable();
66+
renderedRangeStream: Observable<ListRange> = this._renderedRangeSubject.asObservable();
6767

6868
/**
6969
* The total size of all content (in pixels), including content that is not currently rendered.
@@ -74,7 +74,7 @@ export class CdkVirtualScrollViewport implements OnInit, OnDestroy {
7474
_renderedContentTransform: string;
7575

7676
/** The currently rendered range of indices. */
77-
private _renderedRange: Range = {start: 0, end: 0};
77+
private _renderedRange: ListRange = {start: 0, end: 0};
7878

7979
/** The length of the data bound to this viewport (in number of items). */
8080
private _dataLength = 0;
@@ -116,7 +116,7 @@ export class CdkVirtualScrollViewport implements OnInit, OnDestroy {
116116
}
117117

118118
/** Sets the currently rendered range of indices. */
119-
setRenderedRange(range: Range) {
119+
setRenderedRange(range: ListRange) {
120120
if (!rangesEqual(this._renderedRange, range)) {
121121
// Re-enter the Angular zone so we can mark for change detection.
122122
this._ngZone.run(() => {

src/cdk/collections/collection-viewer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {Observable} from 'rxjs/Observable';
1010

1111

1212
/** Represents a range of numbers with a specified start and end. */
13-
export type Range = {start: number, end: number};
13+
export type ListRange = {start: number, end: number};
1414

1515

1616
/**
@@ -22,5 +22,5 @@ export interface CollectionViewer {
2222
* A stream that emits whenever the `CollectionViewer` starts looking at a new portion of the
2323
* data. The `start` index is inclusive, while the `end` is exclusive.
2424
*/
25-
viewChange: Observable<Range>;
25+
viewChange: Observable<ListRange>;
2626
}

0 commit comments

Comments
 (0)