wj-elements
Version:
WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.
10 lines (9 loc) • 747 B
TypeScript
/**
* Paginates items based on the total number of items, current page, page size, and maximum number of pages to display.
* @param {number} totalItems The total number of items to paginate.
* @param {number} [currentPage] The current page number (default is 1).
* @param {number} [pageSize] The number of items per page (default is 10).
* @param {number} [maxPages] The maximum number of pages to display in the pagination control (default is 5).
* @returns {object} An object containing pagination details including total items, current page, page size, total pages, start/end page, start/end index, and the pages array.
*/
export function paginate(totalItems: number, currentPage?: number, pageSize?: number, maxPages?: number): object;