carbon-components-angular
Version:
Next generation components
159 lines (155 loc) • 5.35 kB
TypeScript
/**
*
* carbon-angular v0.0.0 | pagination.component.d.ts
*
* Copyright 2014, 2024 IBM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PaginationModel } from "./pagination-model.class";
import { EventEmitter } from "@angular/core";
import { I18n, Overridable } from "carbon-components-angular/i18n";
import { ExperimentalService } from "carbon-components-angular/experimental";
import * as i0 from "@angular/core";
export interface PaginationTranslations {
ITEMS_PER_PAGE: string;
OPEN_LIST_OF_OPTIONS: string;
BACKWARD: string;
FORWARD: string;
TOTAL_ITEMS_UNKNOWN: string;
TOTAL_ITEMS: string;
TOTAL_ITEM: string;
OF_LAST_PAGES: string;
OF_LAST_PAGE: string;
}
/**
* Use pagination when you have multiple pages of data to handle. Get started with importing the module:
*
* ```typescript
* import { PaginationModule } from 'carbon-components-angular';
* ```
*
* ```html
* <cds-pagination [model]="model" (selectPage)="selectPage($event)"></cds-pagination>
* ```
*
* In your `selectPage()` method set the `model.currentPage` to selected page, _after_
* you load the page.
*
* ```typescript
* selectPage(page) {
* // ... your code to load the page goes here
*
* this.model.currentPage = page;
*
* // ... anything you want to do after page selection changes goes here
* }
* ```
*
* [See demo](../../?path=/story/components-pagination--basic)
*/
export declare class Pagination {
protected i18n: I18n;
protected experimental: ExperimentalService;
static paginationCounter: number;
/**
* Set to `true` for a loading pagination component.
*/
skeleton: boolean;
/**
* `PaginationModel` with the information about pages you're controlling.
*/
model: PaginationModel;
/**
* Set to `true` to disable the backward/forward buttons.
*/
disabled: boolean;
/**
* Set to `true` to disable the select box that changes the page.
*/
pageInputDisabled: boolean;
/**
* Controls wether or not to show the page selects
*/
showPageInput: boolean;
/**
* Set to `true` if the total number of items is unknown.
*/
pagesUnknown: boolean;
pageSelectThreshold: number;
/**
* Expects an object that contains some or all of:
* ```
* {
* "ITEMS_PER_PAGE": "Items per page:",
* "OPEN_LIST_OF_OPTIONS": "Open list of options",
* "BACKWARD": "Backward",
* "FORWARD": "Forward",
* "TOTAL_ITEMS_UNKNOWN": "{{start}}-{{end}} items",
* "TOTAL_ITEMS": "{{start}}-{{end}} of {{total}} items",
* "TOTAL_ITEM": "{{start}}-{{end}} of {{total}} item",
* "OF_LAST_PAGES": "of {{last}} pages",
* "OF_LAST_PAGE": "of {{last}} page"
* }
* ```
*/
set translations(value: PaginationTranslations);
/**
* Options for items per page select
*
* A default array of options will be defined: [10, 20, 30, 40, 50]
*/
itemsPerPageOptions: number[];
/**
* Emits the new page number.
*
* You should tie into this and update `model.currentPage` once the fresh
* data is finally loaded.
*/
selectPage: EventEmitter<number>;
get itemsPerPage(): number;
set itemsPerPage(value: number);
get currentPage(): number;
set currentPage(value: number);
get totalDataLength(): number;
/**
* The last page number to display in the pagination view.
*/
get lastPage(): number;
get startItemIndex(): number;
get endItemIndex(): number;
/**
* The previous page number to navigate to, from the current page.
*/
get previousPage(): number;
/**
* The next page number to navigate to, from the current page.
*/
get nextPage(): number;
get pageOptions(): any[];
itemsPerPageSelectId: string;
currentPageSelectId: string;
itemsPerPageText: Overridable;
optionsListText: Overridable;
backwardText: Overridable;
forwardText: Overridable;
totalItemsText: Overridable;
totalItemText: Overridable;
totalItemsUnknownText: Overridable;
pageText: Overridable;
ofLastPagesText: Overridable;
ofLastPageText: Overridable;
protected _pageOptions: any[];
constructor(i18n: I18n, experimental: ExperimentalService);
static ɵfac: i0.ɵɵFactoryDeclaration<Pagination, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<Pagination, "cds-pagination, ibm-pagination", never, { "skeleton": "skeleton"; "model": "model"; "disabled": "disabled"; "pageInputDisabled": "pageInputDisabled"; "showPageInput": "showPageInput"; "pagesUnknown": "pagesUnknown"; "pageSelectThreshold": "pageSelectThreshold"; "translations": "translations"; "itemsPerPageOptions": "itemsPerPageOptions"; }, { "selectPage": "selectPage"; }, never, never, false>;
}