source: trip-planner-front/node_modules/@angular/material/table/table-data-source.d.ts@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 8.1 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { DataSource } from '@angular/cdk/table';
9import { MatPaginator } from '@angular/material/paginator';
10import { MatSort } from '@angular/material/sort';
11import { BehaviorSubject, Observable, Subject, Subscription } from 'rxjs';
12/**
13 * Interface that matches the required API parts for the MatPaginator's PageEvent.
14 * Decoupled so that users can depend on either the legacy or MDC-based paginator.
15 */
16export interface MatTableDataSourcePageEvent {
17 pageIndex: number;
18 pageSize: number;
19 length: number;
20}
21/**
22 * Interface that matches the required API parts of the MatPaginator.
23 * Decoupled so that users can depend on either the legacy or MDC-based paginator.
24 */
25export interface MatTableDataSourcePaginator {
26 page: Subject<MatTableDataSourcePageEvent>;
27 pageIndex: number;
28 initialized: Observable<void>;
29 pageSize: number;
30 length: number;
31}
32/** Shared base class with MDC-based implementation. */
33export declare class _MatTableDataSource<T, P extends MatTableDataSourcePaginator = MatTableDataSourcePaginator> extends DataSource<T> {
34 /** Stream that emits when a new data array is set on the data source. */
35 private readonly _data;
36 /** Stream emitting render data to the table (depends on ordered data changes). */
37 private readonly _renderData;
38 /** Stream that emits when a new filter string is set on the data source. */
39 private readonly _filter;
40 /** Used to react to internal changes of the paginator that are made by the data source itself. */
41 private readonly _internalPageChanges;
42 /**
43 * Subscription to the changes that should trigger an update to the table's rendered rows, such
44 * as filtering, sorting, pagination, or base data changes.
45 */
46 _renderChangesSubscription: Subscription | null;
47 /**
48 * The filtered set of data that has been matched by the filter string, or all the data if there
49 * is no filter. Useful for knowing the set of data the table represents.
50 * For example, a 'selectAll()' function would likely want to select the set of filtered data
51 * shown to the user rather than all the data.
52 */
53 filteredData: T[];
54 /** Array of data that should be rendered by the table, where each object represents one row. */
55 get data(): T[];
56 set data(data: T[]);
57 /**
58 * Filter term that should be used to filter out objects from the data array. To override how
59 * data objects match to this filter string, provide a custom function for filterPredicate.
60 */
61 get filter(): string;
62 set filter(filter: string);
63 /**
64 * Instance of the MatSort directive used by the table to control its sorting. Sort changes
65 * emitted by the MatSort will trigger an update to the table's rendered data.
66 */
67 get sort(): MatSort | null;
68 set sort(sort: MatSort | null);
69 private _sort;
70 /**
71 * Instance of the MatPaginator component used by the table to control what page of the data is
72 * displayed. Page changes emitted by the MatPaginator will trigger an update to the
73 * table's rendered data.
74 *
75 * Note that the data source uses the paginator's properties to calculate which page of data
76 * should be displayed. If the paginator receives its properties as template inputs,
77 * e.g. `[pageLength]=100` or `[pageIndex]=1`, then be sure that the paginator's view has been
78 * initialized before assigning it to this data source.
79 */
80 get paginator(): P | null;
81 set paginator(paginator: P | null);
82 private _paginator;
83 /**
84 * Data accessor function that is used for accessing data properties for sorting through
85 * the default sortData function.
86 * This default function assumes that the sort header IDs (which defaults to the column name)
87 * matches the data's properties (e.g. column Xyz represents data['Xyz']).
88 * May be set to a custom function for different behavior.
89 * @param data Data object that is being accessed.
90 * @param sortHeaderId The name of the column that represents the data.
91 */
92 sortingDataAccessor: ((data: T, sortHeaderId: string) => string | number);
93 /**
94 * Gets a sorted copy of the data array based on the state of the MatSort. Called
95 * after changes are made to the filtered data or when sort changes are emitted from MatSort.
96 * By default, the function retrieves the active sort and its direction and compares data
97 * by retrieving data using the sortingDataAccessor. May be overridden for a custom implementation
98 * of data ordering.
99 * @param data The array of data that should be sorted.
100 * @param sort The connected MatSort that holds the current sort state.
101 */
102 sortData: ((data: T[], sort: MatSort) => T[]);
103 /**
104 * Checks if a data object matches the data source's filter string. By default, each data object
105 * is converted to a string of its properties and returns true if the filter has
106 * at least one occurrence in that string. By default, the filter string has its whitespace
107 * trimmed and the match is case-insensitive. May be overridden for a custom implementation of
108 * filter matching.
109 * @param data Data object used to check against the filter.
110 * @param filter Filter string that has been set on the data source.
111 * @returns Whether the filter matches against the data
112 */
113 filterPredicate: ((data: T, filter: string) => boolean);
114 constructor(initialData?: T[]);
115 /**
116 * Subscribe to changes that should trigger an update to the table's rendered rows. When the
117 * changes occur, process the current state of the filter, sort, and pagination along with
118 * the provided base data and send it to the table for rendering.
119 */
120 _updateChangeSubscription(): void;
121 /**
122 * Returns a filtered data array where each filter object contains the filter string within
123 * the result of the filterTermAccessor function. If no filter is set, returns the data array
124 * as provided.
125 */
126 _filterData(data: T[]): T[];
127 /**
128 * Returns a sorted copy of the data if MatSort has a sort applied, otherwise just returns the
129 * data array as provided. Uses the default data accessor for data lookup, unless a
130 * sortDataAccessor function is defined.
131 */
132 _orderData(data: T[]): T[];
133 /**
134 * Returns a paged slice of the provided data array according to the provided MatPaginator's page
135 * index and length. If there is no paginator provided, returns the data array as provided.
136 */
137 _pageData(data: T[]): T[];
138 /**
139 * Updates the paginator to reflect the length of the filtered data, and makes sure that the page
140 * index does not exceed the paginator's last page. Values are changed in a resolved promise to
141 * guard against making property changes within a round of change detection.
142 */
143 _updatePaginator(filteredDataLength: number): void;
144 /**
145 * Used by the MatTable. Called when it connects to the data source.
146 * @docs-private
147 */
148 connect(): BehaviorSubject<T[]>;
149 /**
150 * Used by the MatTable. Called when it disconnects from the data source.
151 * @docs-private
152 */
153 disconnect(): void;
154}
155/**
156 * Data source that accepts a client-side data array and includes native support of filtering,
157 * sorting (using MatSort), and pagination (using MatPaginator).
158 *
159 * Allows for sort customization by overriding sortingDataAccessor, which defines how data
160 * properties are accessed. Also allows for filter customization by overriding filterTermAccessor,
161 * which defines how row data is converted to a string for filter matching.
162 *
163 * **Note:** This class is meant to be a simple data source to help you get started. As such
164 * it isn't equipped to handle some more advanced cases like robust i18n support or server-side
165 * interactions. If your app needs to support more advanced use cases, consider implementing your
166 * own `DataSource`.
167 */
168export declare class MatTableDataSource<T> extends _MatTableDataSource<T, MatPaginator> {
169}
Note: See TracBrowser for help on using the repository browser.