-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdata-source.d-cd31f292.d.ts
executable file
·43 lines (40 loc) · 1.73 KB
/
data-source.d-cd31f292.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Observable } from 'rxjs';
/** Represents a range of numbers with a specified start and end. */
type ListRange = {
start: number;
end: number;
};
/**
* Interface for any component that provides a view of some data collection and wants to provide
* information regarding the view and any changes made.
*/
interface CollectionViewer {
/**
* A stream that emits whenever the `CollectionViewer` starts looking at a new portion of the
* data. The `start` index is inclusive, while the `end` is exclusive.
*/
viewChange: Observable<ListRange>;
}
declare abstract class DataSource<T> {
/**
* Connects a collection viewer (such as a data-table) to this data source. Note that
* the stream provided will be accessed during change detection and should not directly change
* values that are bound in template views.
* @param collectionViewer The component that exposes a view over the data provided by this
* data source.
* @returns Observable that emits a new value when the data changes.
*/
abstract connect(collectionViewer: CollectionViewer): Observable<readonly T[]>;
/**
* Disconnects a collection viewer (such as a data-table) from this data source. Can be used
* to perform any clean-up or tear-down operations when a view is being destroyed.
*
* @param collectionViewer The component that exposes a view over the data provided by this
* data source.
*/
abstract disconnect(collectionViewer: CollectionViewer): void;
}
/** Checks whether an object is a data source. */
declare function isDataSource(value: any): value is DataSource<any>;
export { DataSource as D, isDataSource as i };
export type { CollectionViewer as C, ListRange as L };