@sixbell-telco/sdk
Version:
A collection of reusable components designed for use in Sixbell Telco Angular projects
41 lines (40 loc) • 1.33 kB
TypeScript
import { PipeTransform } from '@angular/core';
import * as i0 from "@angular/core";
export type Pagination = {
currentPage: number;
itemsPerPage: number;
};
/**
* A pipe to manually paginate an array of items.
*
* @remarks
* This pipe takes an array and a pagination configuration object (currentPage, itemsPerPage)
* and returns a sliced version of the array, representing the items for the current page.
*
* @example
* ```html
* @for (item of items | pagination: { currentPage: 2, itemsPerPage: 10 }; track item.id) {
* <li>{{ item.name }}</li>
* }
* ```
*/
export declare class PaginationPipe implements PipeTransform {
transform<T>(items: T[], pagination: {
currentPage: number;
itemsPerPage: number;
}): T[];
transform<T>(items: T[] | null, pagination: {
currentPage: number;
itemsPerPage: number;
}): T[] | null;
transform<T>(items: T[] | undefined, pagination: {
currentPage: number;
itemsPerPage: number;
}): T[] | undefined;
transform<T>(items: T[] | null | undefined, pagination: {
currentPage: number;
itemsPerPage: number;
}): T[] | null | undefined;
static ɵfac: i0.ɵɵFactoryDeclaration<PaginationPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<PaginationPipe, "paginate", true>;
}