carbon-components-angular
Version:
Next generation components
107 lines (103 loc) • 2.97 kB
TypeScript
/*!
*
* Neutrino v0.0.0 | pagination.component.d.ts
*
* Copyright 2014, 2018 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.module";
import { EventEmitter } from "@angular/core";
import { I18n } from "./../i18n/i18n.module";
/**
* Use pagination when you have multiple pages of data to handle.
*
* ```html
* <ibm-pagination [model]="model" (selectPage)="selectPage($event)"></ibm-pagination>
* ```
*
* In your `selectPage()` method set the `model.currentPage` to selected page, _after_
* you load the page.
*
* ```typescript
* selectPage(page) {
* // ... your code to laod the page goes here
*
* this.model.currentPage = page;
*
* // ... anything you want to do after page selection changes goes here
* }
* ```
*
* @export
* @class Pagination
*/
export declare class Pagination {
protected i18n: I18n;
static paginationCounter: number;
/**
* `PaginationModel` with the information about pages you're controlling.
*
* @type {Model}
* @memberof Pagination
*/
model: PaginationModel;
translations: any;
/**
* Emits the new page number.
*
* You should tie into this and update `model.currentPage` once the fresh
* data is finally loaded.
*
* @memberof Pagination
*/
selectPage: EventEmitter<number>;
itemsPerPage: number;
currentPage: number;
/**
* The last page number to display in the pagination view.
*
* @returns {number}
* @memberof Pagination
*/
readonly lastPage: number;
readonly startItemIndex: number;
readonly endItemIndex: number;
/**
* The previous page number to navigate to, from the current page.
*
* @returns {number}
* @memberof Pagination
*/
readonly previousPage: number;
/**
* The next page number to navigate to, from the current page.
*
* @returns {number}
* @memberof Pagination
*/
readonly nextPage: number;
itemsPerPageSelectId: string;
currentPageSelectId: string;
constructor(i18n: I18n);
/**
* Generates a list of numbers. (Python function)
* Used to display the correct pagination controls.
*
* @param {number} stop
* @param {number} [start=0]
* @param {number} [step=1]
* @returns {array}
* @memberof Pagination
*/
range(stop: number, start?: number, step?: number): number[];
}