import { Sort, PageEvent } from '@angular/material'; import { Observable } from 'rxjs'; import { InputControl } from '../../forms/public-api'; import { Params } from '../utils/helpers'; /** * The data sort direction. */ export declare enum SortDirection { /** * Sorts the data in the ascending order. */ asc = "asc", /** * Sorts the data in the descending order. */ desc = "desc", /** * Sorts the data in the original order or does not sort them. */ orig = "" } /** * A collection of key/value elements, where the key is the filter name and the value is the control * that contains the filter value. * Both the `FilterControls` keys and `FilterValues` keys are the same. */ export declare type FilterControls = Params; /** * A collection of key/value elements, where the key is the filter name and the value is the filter value. * Both the `FilterControls` keys and `FilterValues` keys are the same. */ export declare type FilterValues = Params; /** * An interface that represents the input data that are used to make a page request. * It is the input of `BackendDataSourceFunction` function. */ export interface PageRequest { /** * The current filter state. */ filter?: FilterValues; /** * The current sort state. */ sort: Sort; /** * The current paginator state. */ paginator: PageEvent; } /** * An interface that represents the requested page. * It is the output of `BackendDataSourceFunction` function. * The generic parameter T always refers to the type of data that it is dealing with. */ export interface Page { /** * Returns the list of items. * By default, its value is `[]`. */ data: T[]; /** * Returns the total number of items being paged. * By default, its value is `0`. */ totalData: number; /** * Returns the zero-based page index of the displayed list of items. * By default, its value is `0`. */ pageIndex: number; /** * Returns the number of items to display on a page. * By default, its value is `50`. */ pageSize: number; } /** * An interface that represents the function that is used to get the data source from backend. * The generic parameter T always refers to the type of data that it is dealing with. */ export interface BackendDataSourceFunction { (pageRequest: PageRequest): Observable>; } /** * Checks if a data object matches the data source's filter string. By default, each data object * is converted to a string of its properties and returns true if the filter has * at least one occurrence in that string. By default, the filter string has its whitespace * trimmed and the match is case-insensitive. * May be overridden for a custom implementation of filter matching. * @param data Data object used to check against the filter. * @param filter Filter string that has been set on the data source. * @return Returns true whether the filter matches against the data; otherwise, false. */ export declare function filterPredicate(data: T, filter: string): boolean; /** * Data accessor function that is used for accessing data properties for sorting through * the default `sortData` function. * This default function assumes that the sort header IDs (which defaults to the column name) * matches the data's properties (e.g. column Xyz represents data['Xyz']). * May be overridden for a custom implementation of different behavior. * @param data Data object that is being accessed. * @param sortHeaderId The name of the column that represents the data. */ export declare function sortingDataAccessor(data: T, sortHeaderId: string): string | number; /** * Gets a sorted copy of the data array based on the state of the `MatSort`. Called * after changes are made to the filtered data or when sort changes are emitted from `MatSort`. * By default, the function retrieves the active sort and its direction and compares data * by retrieving data using the `sortingDataAccessor`. * May be overridden for a custom implementation of data ordering. * @param data The array of data that should be sorted. * @param sort The connected `MatSort` that holds the current sort state. */ export declare function sortData(data: T[], sort: Sort): T[];