1 | import { PaginationService } from "./pagination.service";
|
2 | import * as i0 from "@angular/core";
|
3 | export declare type Collection<T> = T[] | ReadonlyArray<T>;
|
4 | export interface PaginatePipeArgs {
|
5 | id?: string;
|
6 | itemsPerPage?: string | number;
|
7 | currentPage?: string | number;
|
8 | totalItems?: string | number;
|
9 | }
|
10 | export interface PipeState {
|
11 | collection: ArrayLike<any>;
|
12 | size: number;
|
13 | start: number;
|
14 | end: number;
|
15 | slice: ArrayLike<any>;
|
16 | }
|
17 | export declare class PaginatePipe {
|
18 | private service;
|
19 | private state;
|
20 | constructor(service: PaginationService);
|
21 | transform<T, U extends Collection<T>>(collection: U, args: PaginatePipeArgs): U;
|
22 | /**
|
23 | * Create an PaginationInstance object, using defaults for any optional properties not supplied.
|
24 | */
|
25 | private createInstance;
|
26 | /**
|
27 | * Ensure the argument passed to the filter contains the required properties.
|
28 | */
|
29 | private checkConfig;
|
30 | /**
|
31 | * To avoid returning a brand new array each time the pipe is run, we store the state of the sliced
|
32 | * array for a given id. This means that the next time the pipe is run on this collection & id, we just
|
33 | * need to check that the collection, start and end points are all identical, and if so, return the
|
34 | * last sliced array.
|
35 | */
|
36 | private saveState;
|
37 | /**
|
38 | * For a given id, returns true if the collection, size, start and end values are identical.
|
39 | */
|
40 | private stateIsIdentical;
|
41 | static ɵfac: i0.ɵɵFactoryDeclaration<PaginatePipe, never>;
|
42 | static ɵpipe: i0.ɵɵPipeDeclaration<PaginatePipe, "paginate">;
|
43 | }
|