UNPKG

@pascalhonegger/ng-datatable

Version:
93 lines (86 loc) 4.25 kB
import * as i0 from '@angular/core'; import { OnChanges, DoCheck, EventEmitter, SimpleChanges, OnInit } from '@angular/core'; import { ReplaySubject } from 'rxjs'; type SortOrder = "asc" | "desc"; type SortByFunction<T = any> = (data: T) => any; type SortBy<T = any> = string | SortByFunction<T> | (string | SortByFunction<T>)[]; interface SortEvent { sortBy: SortBy; sortOrder: string; } interface PageEvent { activePage: number; rowsOnPage: number; dataLength: number; } interface DataEvent { length: number; } declare class DataTable<T = any> implements OnChanges, DoCheck { private diff; inputData: T[]; sortBy: SortBy<T>; sortOrder: SortOrder; sortByChange: EventEmitter<SortBy<T>>; sortOrderChange: EventEmitter<SortOrder>; rowsOnPage: number; activePage: number; private mustRecalculateData; data: T[]; onSortChange: ReplaySubject<SortEvent>; onPageChange: EventEmitter<PageEvent>; constructor(); getSort(): SortEvent; setSort(sortBy: SortBy<T>, sortOrder: SortOrder): void; getPage(): PageEvent; setPage(activePage: number, rowsOnPage: number): void; private calculateNewActivePage; private recalculatePage; ngOnChanges(changes: SimpleChanges): any; ngDoCheck(): any; private fillData; private caseInsensitiveIteratee; private compare; private sorter; static ɵfac: i0.ɵɵFactoryDeclaration<DataTable<any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<DataTable<any>, "table[mfData]", ["mfDataTable"], { "inputData": { "alias": "mfData"; "required": false; }; "sortBy": { "alias": "mfSortBy"; "required": false; }; "sortOrder": { "alias": "mfSortOrder"; "required": false; }; "rowsOnPage": { "alias": "mfRowsOnPage"; "required": false; }; "activePage": { "alias": "mfActivePage"; "required": false; }; }, { "sortByChange": "mfSortByChange"; "sortOrderChange": "mfSortOrderChange"; }, never, never, true, never>; } declare class BootstrapPaginator { rowsOnPageSet: i0.InputSignal<number[]>; mfTable: i0.InputSignal<DataTable<any> | undefined>; minRowsOnPage: i0.Signal<number>; static ɵfac: i0.ɵɵFactoryDeclaration<BootstrapPaginator, never>; static ɵcmp: i0.ɵɵComponentDeclaration<BootstrapPaginator, "mfBootstrapPaginator", never, { "rowsOnPageSet": { "alias": "rowsOnPageSet"; "required": false; "isSignal": true; }; "mfTable": { "alias": "mfTable"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } declare class Paginator implements OnChanges { private injectMfTable; readonly inputMfTable: i0.InputSignal<DataTable<any> | undefined>; private mfTable; activePage: number; rowsOnPage: number; dataLength: number; lastPage: number; ngOnChanges(): any; setPage(pageNumber: number): void; setRowsOnPage(rowsOnPage: number): void; private onPageChangeSubscriber; static ɵfac: i0.ɵɵFactoryDeclaration<Paginator, never>; static ɵcmp: i0.ɵɵComponentDeclaration<Paginator, "mfPaginator", never, { "inputMfTable": { "alias": "mfTable"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>; } declare class DefaultSorter<T = any> implements OnInit { private mfTable; readonly sortBy: i0.InputSignal<SortBy<T>>; isSortedByMeAsc: boolean; isSortedByMeDesc: boolean; ngOnInit(): void; sort(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<DefaultSorter<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<DefaultSorter<any>, "mfDefaultSorter", never, { "sortBy": { "alias": "by"; "required": true; "isSignal": true; }; }, {}, never, ["*"], true, never>; } declare class DataTableModule { static ɵfac: i0.ɵɵFactoryDeclaration<DataTableModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<DataTableModule, never, [typeof DataTable, typeof DefaultSorter, typeof Paginator, typeof BootstrapPaginator], [typeof DataTable, typeof DefaultSorter, typeof Paginator, typeof BootstrapPaginator]>; static ɵinj: i0.ɵɵInjectorDeclaration<DataTableModule>; } export { BootstrapPaginator, DataTable, DataTableModule, DefaultSorter, Paginator }; export type { DataEvent, PageEvent, SortBy, SortByFunction, SortEvent, SortOrder };