{"version":3,"file":"paginator.es5.js","sources":["../../packages/material/esm5/paginator/paginator-intl.js","../../packages/material/esm5/paginator/paginator.js","../../packages/material/esm5/paginator/paginator-module.js","../../packages/material/esm5/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 */\nvar MatPaginatorIntl = (function () {\n function MatPaginatorIntl() {\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 = function (page, pageSize, length) {\n if (length == 0 || pageSize == 0) {\n return \"0 of \" + length;\n }\n length = Math.max(length, 0);\n var startIndex = page * pageSize;\n // If the start index exceeds the list length, do not try and fix the end index to the end.\n var endIndex = startIndex < length ?\n Math.min(startIndex + pageSize, length) :\n startIndex + pageSize;\n return startIndex + 1 + \" - \" + endIndex + \" of \" + length;\n };\n }\n MatPaginatorIntl.decorators = [\n { type: Injectable },\n ];\n /**\n * @nocollapse\n */\n MatPaginatorIntl.ctorParameters = function () { return []; };\n return MatPaginatorIntl;\n}());\nexport { MatPaginatorIntl };\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 */\nvar 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 */\nvar PageEvent = (function () {\n function PageEvent() {\n }\n return PageEvent;\n}());\nexport { PageEvent };\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 */\nvar MatPaginator = (function () {\n /**\n * @param {?} _intl\n * @param {?} _changeDetectorRef\n */\n function MatPaginator(_intl, _changeDetectorRef) {\n var _this = this;\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(function () { return _this._changeDetectorRef.markForCheck(); });\n }\n Object.defineProperty(MatPaginator.prototype, \"pageIndex\", {\n /**\n * The zero-based page index of the displayed list of items. Defaulted to 0.\n * @return {?}\n */\n get: function () { return this._pageIndex; },\n /**\n * @param {?} pageIndex\n * @return {?}\n */\n set: function (pageIndex) {\n this._pageIndex = pageIndex;\n this._changeDetectorRef.markForCheck();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MatPaginator.prototype, \"length\", {\n /**\n * The length of the total number of items that are being paginated. Defaulted to 0.\n * @return {?}\n */\n get: function () { return this._length; },\n /**\n * @param {?} length\n * @return {?}\n */\n set: function (length) {\n this._length = length;\n this._changeDetectorRef.markForCheck();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MatPaginator.prototype, \"pageSize\", {\n /**\n * Number of items to display on a page. By default set to 50.\n * @return {?}\n */\n get: function () { return this._pageSize; },\n /**\n * @param {?} pageSize\n * @return {?}\n */\n set: function (pageSize) {\n this._pageSize = pageSize;\n this._updateDisplayedPageSizeOptions();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MatPaginator.prototype, \"pageSizeOptions\", {\n /**\n * The set of provided page size options to display to the user.\n * @return {?}\n */\n get: function () { return this._pageSizeOptions; },\n /**\n * @param {?} pageSizeOptions\n * @return {?}\n */\n set: function (pageSizeOptions) {\n this._pageSizeOptions = pageSizeOptions;\n this._updateDisplayedPageSizeOptions();\n },\n enumerable: true,\n configurable: true\n });\n /**\n * @return {?}\n */\n MatPaginator.prototype.ngOnInit = function () {\n this._initialized = true;\n this._updateDisplayedPageSizeOptions();\n };\n /**\n * @return {?}\n */\n MatPaginator.prototype.ngOnDestroy = function () {\n this._intlChanges.unsubscribe();\n };\n /**\n * Advances to the next page if it exists.\n * @return {?}\n */\n MatPaginator.prototype.nextPage = function () {\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 MatPaginator.prototype.previousPage = function () {\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 MatPaginator.prototype.hasPreviousPage = function () {\n return this.pageIndex >= 1 && this.pageSize != 0;\n };\n /**\n * Whether there is a next page.\n * @return {?}\n */\n MatPaginator.prototype.hasNextPage = function () {\n var /** @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 MatPaginator.prototype._changePageSize = function (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 var /** @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 MatPaginator.prototype._updateDisplayedPageSizeOptions = function () {\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(function (a, b) { return 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 MatPaginator.prototype._emitPageEvent = function () {\n this.page.next({\n pageIndex: this.pageIndex,\n pageSize: this.pageSize,\n length: this.length\n });\n };\n MatPaginator.decorators = [\n { type: Component, args: [{selector: 'mat-paginator',\n exportAs: 'matPaginator',\n template: \"