{"version":3,"file":"paginator.js","sources":["../../packages/material/paginator/paginator-intl.js","../../packages/material/paginator/paginator.js","../../packages/material/paginator/paginator-module.js","../../packages/material/paginator/index.js"],"sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs/Subject';\n/**\n * To modify the labels and text displayed, create a new instance of MatPaginatorIntl and\n * include it in a custom provider\n */\nexport class MatPaginatorIntl {\n constructor() {\n /**\n * Stream that emits whenever the labels here are changed. Use this to notify\n * components if the labels have changed after initialization.\n */\n this.changes = new Subject();\n /**\n * A label for the page size selector.\n */\n this.itemsPerPageLabel = 'Items per page:';\n /**\n * A label for the button that increments the current page.\n */\n this.nextPageLabel = 'Next page';\n /**\n * A label for the button that decrements the current page.\n */\n this.previousPageLabel = 'Previous page';\n /**\n * A label for the range of items within the current page and the length of the whole list.\n */\n this.getRangeLabel = (page, pageSize, length) => {\n if (length == 0 || pageSize == 0) {\n return `0 of ${length}`;\n }\n length = Math.max(length, 0);\n const startIndex = page * pageSize;\n // If the start index exceeds the list length, do not try and fix the end index to the end.\n const endIndex = startIndex < length ?\n Math.min(startIndex + pageSize, length) :\n startIndex + pageSize;\n return `${startIndex + 1} - ${endIndex} of ${length}`;\n };\n }\n}\nMatPaginatorIntl.decorators = [\n { type: Injectable },\n];\n/**\n * @nocollapse\n */\nMatPaginatorIntl.ctorParameters = () => [];\nfunction MatPaginatorIntl_tsickle_Closure_declarations() {\n /** @type {?} */\n MatPaginatorIntl.decorators;\n /**\n * @nocollapse\n * @type {?}\n */\n MatPaginatorIntl.ctorParameters;\n /**\n * Stream that emits whenever the labels here are changed. Use this to notify\n * components if the labels have changed after initialization.\n * @type {?}\n */\n MatPaginatorIntl.prototype.changes;\n /**\n * A label for the page size selector.\n * @type {?}\n */\n MatPaginatorIntl.prototype.itemsPerPageLabel;\n /**\n * A label for the button that increments the current page.\n * @type {?}\n */\n MatPaginatorIntl.prototype.nextPageLabel;\n /**\n * A label for the button that decrements the current page.\n * @type {?}\n */\n MatPaginatorIntl.prototype.previousPageLabel;\n /**\n * A label for the range of items within the current page and the length of the whole list.\n * @type {?}\n */\n MatPaginatorIntl.prototype.getRangeLabel;\n}\n//# sourceMappingURL=paginator-intl.js.map","/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewEncapsulation, } from '@angular/core';\nimport { MatPaginatorIntl } from './paginator-intl';\n/**\n * The default page size if there is no page size and there are no provided page size options.\n */\nconst DEFAULT_PAGE_SIZE = 50;\n/**\n * Change event object that is emitted when the user selects a\n * different page size or navigates to another page.\n */\nexport class PageEvent {\n}\nfunction PageEvent_tsickle_Closure_declarations() {\n /**\n * The current page index.\n * @type {?}\n */\n PageEvent.prototype.pageIndex;\n /**\n * The current page size\n * @type {?}\n */\n PageEvent.prototype.pageSize;\n /**\n * The current total number of items being paged\n * @type {?}\n */\n PageEvent.prototype.length;\n}\n/**\n * Component to provide navigation between paged information. Displays the size of the current\n * page, user-selectable options to change that size, what items are being shown, and\n * navigational button to go to the previous or next page.\n */\nexport class MatPaginator {\n /**\n * @param {?} _intl\n * @param {?} _changeDetectorRef\n */\n constructor(_intl, _changeDetectorRef) {\n this._intl = _intl;\n this._changeDetectorRef = _changeDetectorRef;\n this._pageIndex = 0;\n this._length = 0;\n this._pageSizeOptions = [];\n /**\n * Event emitted when the paginator changes the page size or page index.\n */\n this.page = new EventEmitter();\n this._intlChanges = _intl.changes.subscribe(() => this._changeDetectorRef.markForCheck());\n }\n /**\n * The zero-based page index of the displayed list of items. Defaulted to 0.\n * @return {?}\n */\n get pageIndex() { return this._pageIndex; }\n /**\n * @param {?} pageIndex\n * @return {?}\n */\n set pageIndex(pageIndex) {\n this._pageIndex = pageIndex;\n this._changeDetectorRef.markForCheck();\n }\n /**\n * The length of the total number of items that are being paginated. Defaulted to 0.\n * @return {?}\n */\n get length() { return this._length; }\n /**\n * @param {?} length\n * @return {?}\n */\n set length(length) {\n this._length = length;\n this._changeDetectorRef.markForCheck();\n }\n /**\n * Number of items to display on a page. By default set to 50.\n * @return {?}\n */\n get pageSize() { return this._pageSize; }\n /**\n * @param {?} pageSize\n * @return {?}\n */\n set pageSize(pageSize) {\n this._pageSize = pageSize;\n this._updateDisplayedPageSizeOptions();\n }\n /**\n * The set of provided page size options to display to the user.\n * @return {?}\n */\n get pageSizeOptions() { return this._pageSizeOptions; }\n /**\n * @param {?} pageSizeOptions\n * @return {?}\n */\n set pageSizeOptions(pageSizeOptions) {\n this._pageSizeOptions = pageSizeOptions;\n this._updateDisplayedPageSizeOptions();\n }\n /**\n * @return {?}\n */\n ngOnInit() {\n this._initialized = true;\n this._updateDisplayedPageSizeOptions();\n }\n /**\n * @return {?}\n */\n ngOnDestroy() {\n this._intlChanges.unsubscribe();\n }\n /**\n * Advances to the next page if it exists.\n * @return {?}\n */\n nextPage() {\n if (!this.hasNextPage()) {\n return;\n }\n this.pageIndex++;\n this._emitPageEvent();\n }\n /**\n * Move back to the previous page if it exists.\n * @return {?}\n */\n previousPage() {\n if (!this.hasPreviousPage()) {\n return;\n }\n this.pageIndex--;\n this._emitPageEvent();\n }\n /**\n * Whether there is a previous page.\n * @return {?}\n */\n hasPreviousPage() {\n return this.pageIndex >= 1 && this.pageSize != 0;\n }\n /**\n * Whether there is a next page.\n * @return {?}\n */\n hasNextPage() {\n const /** @type {?} */ numberOfPages = Math.ceil(this.length / this.pageSize) - 1;\n return this.pageIndex < numberOfPages && this.pageSize != 0;\n }\n /**\n * Changes the page size so that the first item displayed on the page will still be\n * displayed using the new page size.\n *\n * For example, if the page size is 10 and on the second page (items indexed 10-19) then\n * switching so that the page size is 5 will set the third page as the current page so\n * that the 10th item will still be displayed.\n * @param {?} pageSize\n * @return {?}\n */\n _changePageSize(pageSize) {\n // Current page needs to be updated to reflect the new page size. Navigate to the page\n // containing the previous page's first item.\n const /** @type {?} */ startIndex = this.pageIndex * this.pageSize;\n this.pageIndex = Math.floor(startIndex / pageSize) || 0;\n this.pageSize = pageSize;\n this._emitPageEvent();\n }\n /**\n * Updates the list of page size options to display to the user. Includes making sure that\n * the page size is an option and that the list is sorted.\n * @return {?}\n */\n _updateDisplayedPageSizeOptions() {\n if (!this._initialized) {\n return;\n }\n // If no page size is provided, use the first page size option or the default page size.\n if (!this.pageSize) {\n this._pageSize = this.pageSizeOptions.length != 0 ?\n this.pageSizeOptions[0] :\n DEFAULT_PAGE_SIZE;\n }\n this._displayedPageSizeOptions = this.pageSizeOptions.slice();\n if (this._displayedPageSizeOptions.indexOf(this.pageSize) == -1) {\n this._displayedPageSizeOptions.push(this.pageSize);\n }\n // Sort the numbers using a number-specific sort function.\n this._displayedPageSizeOptions.sort((a, b) => a - b);\n this._changeDetectorRef.markForCheck();\n }\n /**\n * Emits an event notifying that a change of the paginator's properties has been triggered.\n * @return {?}\n */\n _emitPageEvent() {\n this.page.next({\n pageIndex: this.pageIndex,\n pageSize: this.pageSize,\n length: this.length\n });\n }\n}\nMatPaginator.decorators = [\n { type: Component, args: [{selector: 'mat-paginator',\n exportAs: 'matPaginator',\n template: \"