@rxap/data-source
Version:
Provides a set of classes and decorators for creating and managing data sources in Angular applications, including base classes, static data sources, observable data sources, and method data sources. It also includes a component for displaying data source
41 lines (40 loc) • 2.04 kB
TypeScript
import { BaseDataSource, BaseDataSourceMetadata } from '@rxap/data-source';
import { Constructor } from '@rxap/utilities';
import { Observable } from 'rxjs';
import * as i0 from "@angular/core";
export interface PageEvent {
/** The current page index. */
pageIndex: number;
/** The current page size */
pageSize: number;
/** The current total number of items being paged */
length?: number;
}
export interface PaginatorLike {
disabled?: boolean;
/** Event emitted when the paginator changes the page size or page index. */
page?: Observable<PageEvent>;
/** Number of items to display on a page. By default set to 50. */
pageSize: number;
/** The zero-based page index of the displayed list of items. Defaulted to 0. */
pageIndex: number;
/** The length of the total number of items that are being paginated. Defaulted to 0. */
length: number;
/** Resets the pagination to the first page **/
firstPage?(): void;
}
export type AbstractPaginationDataSourceMetadata = BaseDataSourceMetadata;
export declare abstract class AbstractPaginationDataSource<Data> extends BaseDataSource<Data[]> {
paginator?: PaginatorLike;
constructor(paginator?: PaginatorLike | null, metadata?: AbstractPaginationDataSourceMetadata | null);
get pageIndex(): number;
get pageSize(): number;
private _totalLength;
get totalLength(): number;
protected updateTotalLength(totalLength: number): void;
protected assertPaginator(): void;
protected applyPagination(data: ReadonlyArray<Data>, pageSize: number, pageIndex: number): Data[];
static ɵfac: i0.ɵɵFactoryDeclaration<AbstractPaginationDataSource<any>, [{ optional: true; }, { optional: true; }]>;
static ɵprov: i0.ɵɵInjectableDeclaration<AbstractPaginationDataSource<any>>;
}
export declare function RxapAbstractPaginationDataSource(metadataOrId: string | AbstractPaginationDataSourceMetadata, className?: string, packageName?: string): (target: Constructor<AbstractPaginationDataSource<any>>) => void;