source: trip-planner-front/node_modules/@angular/material/bundles/material-paginator.umd.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 37.7 KB
Line 
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/material/core'), require('@angular/material/button'), require('@angular/material/select'), require('@angular/material/tooltip'), require('@angular/cdk/coercion'), require('rxjs')) :
3 typeof define === 'function' && define.amd ? define('@angular/material/paginator', ['exports', '@angular/common', '@angular/core', '@angular/material/core', '@angular/material/button', '@angular/material/select', '@angular/material/tooltip', '@angular/cdk/coercion', 'rxjs'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.paginator = {}), global.ng.common, global.ng.core, global.ng.material.core, global.ng.material.button, global.ng.material.select, global.ng.material.tooltip, global.ng.cdk.coercion, global.rxjs));
5}(this, (function (exports, common, i0, core, button, select, tooltip, coercion, rxjs) { 'use strict';
6
7 function _interopNamespace(e) {
8 if (e && e.__esModule) return e;
9 var n = Object.create(null);
10 if (e) {
11 Object.keys(e).forEach(function (k) {
12 if (k !== 'default') {
13 var d = Object.getOwnPropertyDescriptor(e, k);
14 Object.defineProperty(n, k, d.get ? d : {
15 enumerable: true,
16 get: function () {
17 return e[k];
18 }
19 });
20 }
21 });
22 }
23 n['default'] = e;
24 return Object.freeze(n);
25 }
26
27 var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
29 /*! *****************************************************************************
30 Copyright (c) Microsoft Corporation.
31
32 Permission to use, copy, modify, and/or distribute this software for any
33 purpose with or without fee is hereby granted.
34
35 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
36 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41 PERFORMANCE OF THIS SOFTWARE.
42 ***************************************************************************** */
43 /* global Reflect, Promise */
44 var extendStatics = function (d, b) {
45 extendStatics = Object.setPrototypeOf ||
46 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
47 function (d, b) { for (var p in b)
48 if (Object.prototype.hasOwnProperty.call(b, p))
49 d[p] = b[p]; };
50 return extendStatics(d, b);
51 };
52 function __extends(d, b) {
53 if (typeof b !== "function" && b !== null)
54 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
55 extendStatics(d, b);
56 function __() { this.constructor = d; }
57 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
58 }
59 var __assign = function () {
60 __assign = Object.assign || function __assign(t) {
61 for (var s, i = 1, n = arguments.length; i < n; i++) {
62 s = arguments[i];
63 for (var p in s)
64 if (Object.prototype.hasOwnProperty.call(s, p))
65 t[p] = s[p];
66 }
67 return t;
68 };
69 return __assign.apply(this, arguments);
70 };
71 function __rest(s, e) {
72 var t = {};
73 for (var p in s)
74 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
75 t[p] = s[p];
76 if (s != null && typeof Object.getOwnPropertySymbols === "function")
77 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
78 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
79 t[p[i]] = s[p[i]];
80 }
81 return t;
82 }
83 function __decorate(decorators, target, key, desc) {
84 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
85 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
86 r = Reflect.decorate(decorators, target, key, desc);
87 else
88 for (var i = decorators.length - 1; i >= 0; i--)
89 if (d = decorators[i])
90 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
91 return c > 3 && r && Object.defineProperty(target, key, r), r;
92 }
93 function __param(paramIndex, decorator) {
94 return function (target, key) { decorator(target, key, paramIndex); };
95 }
96 function __metadata(metadataKey, metadataValue) {
97 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
98 return Reflect.metadata(metadataKey, metadataValue);
99 }
100 function __awaiter(thisArg, _arguments, P, generator) {
101 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
102 return new (P || (P = Promise))(function (resolve, reject) {
103 function fulfilled(value) { try {
104 step(generator.next(value));
105 }
106 catch (e) {
107 reject(e);
108 } }
109 function rejected(value) { try {
110 step(generator["throw"](value));
111 }
112 catch (e) {
113 reject(e);
114 } }
115 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
116 step((generator = generator.apply(thisArg, _arguments || [])).next());
117 });
118 }
119 function __generator(thisArg, body) {
120 var _ = { label: 0, sent: function () { if (t[0] & 1)
121 throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
122 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
123 function verb(n) { return function (v) { return step([n, v]); }; }
124 function step(op) {
125 if (f)
126 throw new TypeError("Generator is already executing.");
127 while (_)
128 try {
129 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
130 return t;
131 if (y = 0, t)
132 op = [op[0] & 2, t.value];
133 switch (op[0]) {
134 case 0:
135 case 1:
136 t = op;
137 break;
138 case 4:
139 _.label++;
140 return { value: op[1], done: false };
141 case 5:
142 _.label++;
143 y = op[1];
144 op = [0];
145 continue;
146 case 7:
147 op = _.ops.pop();
148 _.trys.pop();
149 continue;
150 default:
151 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
152 _ = 0;
153 continue;
154 }
155 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
156 _.label = op[1];
157 break;
158 }
159 if (op[0] === 6 && _.label < t[1]) {
160 _.label = t[1];
161 t = op;
162 break;
163 }
164 if (t && _.label < t[2]) {
165 _.label = t[2];
166 _.ops.push(op);
167 break;
168 }
169 if (t[2])
170 _.ops.pop();
171 _.trys.pop();
172 continue;
173 }
174 op = body.call(thisArg, _);
175 }
176 catch (e) {
177 op = [6, e];
178 y = 0;
179 }
180 finally {
181 f = t = 0;
182 }
183 if (op[0] & 5)
184 throw op[1];
185 return { value: op[0] ? op[1] : void 0, done: true };
186 }
187 }
188 var __createBinding = Object.create ? (function (o, m, k, k2) {
189 if (k2 === undefined)
190 k2 = k;
191 Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
192 }) : (function (o, m, k, k2) {
193 if (k2 === undefined)
194 k2 = k;
195 o[k2] = m[k];
196 });
197 function __exportStar(m, o) {
198 for (var p in m)
199 if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
200 __createBinding(o, m, p);
201 }
202 function __values(o) {
203 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
204 if (m)
205 return m.call(o);
206 if (o && typeof o.length === "number")
207 return {
208 next: function () {
209 if (o && i >= o.length)
210 o = void 0;
211 return { value: o && o[i++], done: !o };
212 }
213 };
214 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
215 }
216 function __read(o, n) {
217 var m = typeof Symbol === "function" && o[Symbol.iterator];
218 if (!m)
219 return o;
220 var i = m.call(o), r, ar = [], e;
221 try {
222 while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
223 ar.push(r.value);
224 }
225 catch (error) {
226 e = { error: error };
227 }
228 finally {
229 try {
230 if (r && !r.done && (m = i["return"]))
231 m.call(i);
232 }
233 finally {
234 if (e)
235 throw e.error;
236 }
237 }
238 return ar;
239 }
240 /** @deprecated */
241 function __spread() {
242 for (var ar = [], i = 0; i < arguments.length; i++)
243 ar = ar.concat(__read(arguments[i]));
244 return ar;
245 }
246 /** @deprecated */
247 function __spreadArrays() {
248 for (var s = 0, i = 0, il = arguments.length; i < il; i++)
249 s += arguments[i].length;
250 for (var r = Array(s), k = 0, i = 0; i < il; i++)
251 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
252 r[k] = a[j];
253 return r;
254 }
255 function __spreadArray(to, from, pack) {
256 if (pack || arguments.length === 2)
257 for (var i = 0, l = from.length, ar; i < l; i++) {
258 if (ar || !(i in from)) {
259 if (!ar)
260 ar = Array.prototype.slice.call(from, 0, i);
261 ar[i] = from[i];
262 }
263 }
264 return to.concat(ar || from);
265 }
266 function __await(v) {
267 return this instanceof __await ? (this.v = v, this) : new __await(v);
268 }
269 function __asyncGenerator(thisArg, _arguments, generator) {
270 if (!Symbol.asyncIterator)
271 throw new TypeError("Symbol.asyncIterator is not defined.");
272 var g = generator.apply(thisArg, _arguments || []), i, q = [];
273 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
274 function verb(n) { if (g[n])
275 i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
276 function resume(n, v) { try {
277 step(g[n](v));
278 }
279 catch (e) {
280 settle(q[0][3], e);
281 } }
282 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
283 function fulfill(value) { resume("next", value); }
284 function reject(value) { resume("throw", value); }
285 function settle(f, v) { if (f(v), q.shift(), q.length)
286 resume(q[0][0], q[0][1]); }
287 }
288 function __asyncDelegator(o) {
289 var i, p;
290 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
291 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
292 }
293 function __asyncValues(o) {
294 if (!Symbol.asyncIterator)
295 throw new TypeError("Symbol.asyncIterator is not defined.");
296 var m = o[Symbol.asyncIterator], i;
297 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
298 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
299 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
300 }
301 function __makeTemplateObject(cooked, raw) {
302 if (Object.defineProperty) {
303 Object.defineProperty(cooked, "raw", { value: raw });
304 }
305 else {
306 cooked.raw = raw;
307 }
308 return cooked;
309 }
310 ;
311 var __setModuleDefault = Object.create ? (function (o, v) {
312 Object.defineProperty(o, "default", { enumerable: true, value: v });
313 }) : function (o, v) {
314 o["default"] = v;
315 };
316 function __importStar(mod) {
317 if (mod && mod.__esModule)
318 return mod;
319 var result = {};
320 if (mod != null)
321 for (var k in mod)
322 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
323 __createBinding(result, mod, k);
324 __setModuleDefault(result, mod);
325 return result;
326 }
327 function __importDefault(mod) {
328 return (mod && mod.__esModule) ? mod : { default: mod };
329 }
330 function __classPrivateFieldGet(receiver, state, kind, f) {
331 if (kind === "a" && !f)
332 throw new TypeError("Private accessor was defined without a getter");
333 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
334 throw new TypeError("Cannot read private member from an object whose class did not declare it");
335 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
336 }
337 function __classPrivateFieldSet(receiver, state, value, kind, f) {
338 if (kind === "m")
339 throw new TypeError("Private method is not writable");
340 if (kind === "a" && !f)
341 throw new TypeError("Private accessor was defined without a setter");
342 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
343 throw new TypeError("Cannot write private member to an object whose class did not declare it");
344 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
345 }
346
347 /**
348 * @license
349 * Copyright Google LLC All Rights Reserved.
350 *
351 * Use of this source code is governed by an MIT-style license that can be
352 * found in the LICENSE file at https://angular.io/license
353 */
354 /**
355 * To modify the labels and text displayed, create a new instance of MatPaginatorIntl and
356 * include it in a custom provider
357 */
358 var MatPaginatorIntl = /** @class */ (function () {
359 function MatPaginatorIntl() {
360 /**
361 * Stream to emit from when labels are changed. Use this to notify components when the labels have
362 * changed after initialization.
363 */
364 this.changes = new rxjs.Subject();
365 /** A label for the page size selector. */
366 this.itemsPerPageLabel = 'Items per page:';
367 /** A label for the button that increments the current page. */
368 this.nextPageLabel = 'Next page';
369 /** A label for the button that decrements the current page. */
370 this.previousPageLabel = 'Previous page';
371 /** A label for the button that moves to the first page. */
372 this.firstPageLabel = 'First page';
373 /** A label for the button that moves to the last page. */
374 this.lastPageLabel = 'Last page';
375 /** A label for the range of items within the current page and the length of the whole list. */
376 this.getRangeLabel = function (page, pageSize, length) {
377 if (length == 0 || pageSize == 0) {
378 return "0 of " + length;
379 }
380 length = Math.max(length, 0);
381 var startIndex = page * pageSize;
382 // If the start index exceeds the list length, do not try and fix the end index to the end.
383 var endIndex = startIndex < length ?
384 Math.min(startIndex + pageSize, length) :
385 startIndex + pageSize;
386 return startIndex + 1 + " \u2013 " + endIndex + " of " + length;
387 };
388 }
389 return MatPaginatorIntl;
390 }());
391 MatPaginatorIntl.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function MatPaginatorIntl_Factory() { return new MatPaginatorIntl(); }, token: MatPaginatorIntl, providedIn: "root" });
392 MatPaginatorIntl.decorators = [
393 { type: i0.Injectable, args: [{ providedIn: 'root' },] }
394 ];
395 /** @docs-private */
396 function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(parentIntl) {
397 return parentIntl || new MatPaginatorIntl();
398 }
399 /** @docs-private */
400 var MAT_PAGINATOR_INTL_PROVIDER = {
401 // If there is already an MatPaginatorIntl available, use that. Otherwise, provide a new one.
402 provide: MatPaginatorIntl,
403 deps: [[new i0.Optional(), new i0.SkipSelf(), MatPaginatorIntl]],
404 useFactory: MAT_PAGINATOR_INTL_PROVIDER_FACTORY
405 };
406
407 /** The default page size if there is no page size and there are no provided page size options. */
408 var DEFAULT_PAGE_SIZE = 50;
409 /**
410 * Change event object that is emitted when the user selects a
411 * different page size or navigates to another page.
412 */
413 var PageEvent = /** @class */ (function () {
414 function PageEvent() {
415 }
416 return PageEvent;
417 }());
418 /** Injection token that can be used to provide the default options for the paginator module. */
419 var MAT_PAGINATOR_DEFAULT_OPTIONS = new i0.InjectionToken('MAT_PAGINATOR_DEFAULT_OPTIONS');
420 // Boilerplate for applying mixins to _MatPaginatorBase.
421 /** @docs-private */
422 var _MatPaginatorMixinBase = core.mixinDisabled(core.mixinInitialized(/** @class */ (function () {
423 function class_1() {
424 }
425 return class_1;
426 }())));
427 /**
428 * Base class with all of the `MatPaginator` functionality.
429 * @docs-private
430 */
431 var _MatPaginatorBase = /** @class */ (function (_super) {
432 __extends(_MatPaginatorBase, _super);
433 function _MatPaginatorBase(_intl, _changeDetectorRef, defaults) {
434 var _this = _super.call(this) || this;
435 _this._intl = _intl;
436 _this._changeDetectorRef = _changeDetectorRef;
437 _this._pageIndex = 0;
438 _this._length = 0;
439 _this._pageSizeOptions = [];
440 _this._hidePageSize = false;
441 _this._showFirstLastButtons = false;
442 /** Event emitted when the paginator changes the page size or page index. */
443 _this.page = new i0.EventEmitter();
444 _this._intlChanges = _intl.changes.subscribe(function () { return _this._changeDetectorRef.markForCheck(); });
445 if (defaults) {
446 var pageSize = defaults.pageSize, pageSizeOptions = defaults.pageSizeOptions, hidePageSize = defaults.hidePageSize, showFirstLastButtons = defaults.showFirstLastButtons;
447 if (pageSize != null) {
448 _this._pageSize = pageSize;
449 }
450 if (pageSizeOptions != null) {
451 _this._pageSizeOptions = pageSizeOptions;
452 }
453 if (hidePageSize != null) {
454 _this._hidePageSize = hidePageSize;
455 }
456 if (showFirstLastButtons != null) {
457 _this._showFirstLastButtons = showFirstLastButtons;
458 }
459 }
460 return _this;
461 }
462 Object.defineProperty(_MatPaginatorBase.prototype, "pageIndex", {
463 /** The zero-based page index of the displayed list of items. Defaulted to 0. */
464 get: function () { return this._pageIndex; },
465 set: function (value) {
466 this._pageIndex = Math.max(coercion.coerceNumberProperty(value), 0);
467 this._changeDetectorRef.markForCheck();
468 },
469 enumerable: false,
470 configurable: true
471 });
472 Object.defineProperty(_MatPaginatorBase.prototype, "length", {
473 /** The length of the total number of items that are being paginated. Defaulted to 0. */
474 get: function () { return this._length; },
475 set: function (value) {
476 this._length = coercion.coerceNumberProperty(value);
477 this._changeDetectorRef.markForCheck();
478 },
479 enumerable: false,
480 configurable: true
481 });
482 Object.defineProperty(_MatPaginatorBase.prototype, "pageSize", {
483 /** Number of items to display on a page. By default set to 50. */
484 get: function () { return this._pageSize; },
485 set: function (value) {
486 this._pageSize = Math.max(coercion.coerceNumberProperty(value), 0);
487 this._updateDisplayedPageSizeOptions();
488 },
489 enumerable: false,
490 configurable: true
491 });
492 Object.defineProperty(_MatPaginatorBase.prototype, "pageSizeOptions", {
493 /** The set of provided page size options to display to the user. */
494 get: function () { return this._pageSizeOptions; },
495 set: function (value) {
496 this._pageSizeOptions = (value || []).map(function (p) { return coercion.coerceNumberProperty(p); });
497 this._updateDisplayedPageSizeOptions();
498 },
499 enumerable: false,
500 configurable: true
501 });
502 Object.defineProperty(_MatPaginatorBase.prototype, "hidePageSize", {
503 /** Whether to hide the page size selection UI from the user. */
504 get: function () { return this._hidePageSize; },
505 set: function (value) {
506 this._hidePageSize = coercion.coerceBooleanProperty(value);
507 },
508 enumerable: false,
509 configurable: true
510 });
511 Object.defineProperty(_MatPaginatorBase.prototype, "showFirstLastButtons", {
512 /** Whether to show the first/last buttons UI to the user. */
513 get: function () { return this._showFirstLastButtons; },
514 set: function (value) {
515 this._showFirstLastButtons = coercion.coerceBooleanProperty(value);
516 },
517 enumerable: false,
518 configurable: true
519 });
520 _MatPaginatorBase.prototype.ngOnInit = function () {
521 this._initialized = true;
522 this._updateDisplayedPageSizeOptions();
523 this._markInitialized();
524 };
525 _MatPaginatorBase.prototype.ngOnDestroy = function () {
526 this._intlChanges.unsubscribe();
527 };
528 /** Advances to the next page if it exists. */
529 _MatPaginatorBase.prototype.nextPage = function () {
530 if (!this.hasNextPage()) {
531 return;
532 }
533 var previousPageIndex = this.pageIndex;
534 this.pageIndex++;
535 this._emitPageEvent(previousPageIndex);
536 };
537 /** Move back to the previous page if it exists. */
538 _MatPaginatorBase.prototype.previousPage = function () {
539 if (!this.hasPreviousPage()) {
540 return;
541 }
542 var previousPageIndex = this.pageIndex;
543 this.pageIndex--;
544 this._emitPageEvent(previousPageIndex);
545 };
546 /** Move to the first page if not already there. */
547 _MatPaginatorBase.prototype.firstPage = function () {
548 // hasPreviousPage being false implies at the start
549 if (!this.hasPreviousPage()) {
550 return;
551 }
552 var previousPageIndex = this.pageIndex;
553 this.pageIndex = 0;
554 this._emitPageEvent(previousPageIndex);
555 };
556 /** Move to the last page if not already there. */
557 _MatPaginatorBase.prototype.lastPage = function () {
558 // hasNextPage being false implies at the end
559 if (!this.hasNextPage()) {
560 return;
561 }
562 var previousPageIndex = this.pageIndex;
563 this.pageIndex = this.getNumberOfPages() - 1;
564 this._emitPageEvent(previousPageIndex);
565 };
566 /** Whether there is a previous page. */
567 _MatPaginatorBase.prototype.hasPreviousPage = function () {
568 return this.pageIndex >= 1 && this.pageSize != 0;
569 };
570 /** Whether there is a next page. */
571 _MatPaginatorBase.prototype.hasNextPage = function () {
572 var maxPageIndex = this.getNumberOfPages() - 1;
573 return this.pageIndex < maxPageIndex && this.pageSize != 0;
574 };
575 /** Calculate the number of pages */
576 _MatPaginatorBase.prototype.getNumberOfPages = function () {
577 if (!this.pageSize) {
578 return 0;
579 }
580 return Math.ceil(this.length / this.pageSize);
581 };
582 /**
583 * Changes the page size so that the first item displayed on the page will still be
584 * displayed using the new page size.
585 *
586 * For example, if the page size is 10 and on the second page (items indexed 10-19) then
587 * switching so that the page size is 5 will set the third page as the current page so
588 * that the 10th item will still be displayed.
589 */
590 _MatPaginatorBase.prototype._changePageSize = function (pageSize) {
591 // Current page needs to be updated to reflect the new page size. Navigate to the page
592 // containing the previous page's first item.
593 var startIndex = this.pageIndex * this.pageSize;
594 var previousPageIndex = this.pageIndex;
595 this.pageIndex = Math.floor(startIndex / pageSize) || 0;
596 this.pageSize = pageSize;
597 this._emitPageEvent(previousPageIndex);
598 };
599 /** Checks whether the buttons for going forwards should be disabled. */
600 _MatPaginatorBase.prototype._nextButtonsDisabled = function () {
601 return this.disabled || !this.hasNextPage();
602 };
603 /** Checks whether the buttons for going backwards should be disabled. */
604 _MatPaginatorBase.prototype._previousButtonsDisabled = function () {
605 return this.disabled || !this.hasPreviousPage();
606 };
607 /**
608 * Updates the list of page size options to display to the user. Includes making sure that
609 * the page size is an option and that the list is sorted.
610 */
611 _MatPaginatorBase.prototype._updateDisplayedPageSizeOptions = function () {
612 if (!this._initialized) {
613 return;
614 }
615 // If no page size is provided, use the first page size option or the default page size.
616 if (!this.pageSize) {
617 this._pageSize = this.pageSizeOptions.length != 0 ?
618 this.pageSizeOptions[0] :
619 DEFAULT_PAGE_SIZE;
620 }
621 this._displayedPageSizeOptions = this.pageSizeOptions.slice();
622 if (this._displayedPageSizeOptions.indexOf(this.pageSize) === -1) {
623 this._displayedPageSizeOptions.push(this.pageSize);
624 }
625 // Sort the numbers using a number-specific sort function.
626 this._displayedPageSizeOptions.sort(function (a, b) { return a - b; });
627 this._changeDetectorRef.markForCheck();
628 };
629 /** Emits an event notifying that a change of the paginator's properties has been triggered. */
630 _MatPaginatorBase.prototype._emitPageEvent = function (previousPageIndex) {
631 this.page.emit({
632 previousPageIndex: previousPageIndex,
633 pageIndex: this.pageIndex,
634 pageSize: this.pageSize,
635 length: this.length
636 });
637 };
638 return _MatPaginatorBase;
639 }(_MatPaginatorMixinBase));
640 _MatPaginatorBase.decorators = [
641 { type: i0.Directive }
642 ];
643 _MatPaginatorBase.ctorParameters = function () { return [
644 { type: MatPaginatorIntl },
645 { type: i0.ChangeDetectorRef },
646 { type: undefined }
647 ]; };
648 _MatPaginatorBase.propDecorators = {
649 color: [{ type: i0.Input }],
650 pageIndex: [{ type: i0.Input }],
651 length: [{ type: i0.Input }],
652 pageSize: [{ type: i0.Input }],
653 pageSizeOptions: [{ type: i0.Input }],
654 hidePageSize: [{ type: i0.Input }],
655 showFirstLastButtons: [{ type: i0.Input }],
656 page: [{ type: i0.Output }]
657 };
658 /**
659 * Component to provide navigation between paged information. Displays the size of the current
660 * page, user-selectable options to change that size, what items are being shown, and
661 * navigational button to go to the previous or next page.
662 */
663 var MatPaginator = /** @class */ (function (_super) {
664 __extends(MatPaginator, _super);
665 function MatPaginator(intl, changeDetectorRef, defaults) {
666 var _this = _super.call(this, intl, changeDetectorRef, defaults) || this;
667 if (defaults && defaults.formFieldAppearance != null) {
668 _this._formFieldAppearance = defaults.formFieldAppearance;
669 }
670 return _this;
671 }
672 return MatPaginator;
673 }(_MatPaginatorBase));
674 MatPaginator.decorators = [
675 { type: i0.Component, args: [{
676 selector: 'mat-paginator',
677 exportAs: 'matPaginator',
678 template: "<div class=\"mat-paginator-outer-container\">\n <div class=\"mat-paginator-container\">\n <div class=\"mat-paginator-page-size\" *ngIf=\"!hidePageSize\">\n <div class=\"mat-paginator-page-size-label\">\n {{_intl.itemsPerPageLabel}}\n </div>\n\n <mat-form-field\n *ngIf=\"_displayedPageSizeOptions.length > 1\"\n [appearance]=\"_formFieldAppearance!\"\n [color]=\"color\"\n class=\"mat-paginator-page-size-select\">\n <mat-select\n [value]=\"pageSize\"\n [disabled]=\"disabled\"\n [aria-label]=\"_intl.itemsPerPageLabel\"\n (selectionChange)=\"_changePageSize($event.value)\">\n <mat-option *ngFor=\"let pageSizeOption of _displayedPageSizeOptions\" [value]=\"pageSizeOption\">\n {{pageSizeOption}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <div\n class=\"mat-paginator-page-size-value\"\n *ngIf=\"_displayedPageSizeOptions.length <= 1\">{{pageSize}}</div>\n </div>\n\n <div class=\"mat-paginator-range-actions\">\n <div class=\"mat-paginator-range-label\">\n {{_intl.getRangeLabel(pageIndex, pageSize, length)}}\n </div>\n\n <button mat-icon-button type=\"button\"\n class=\"mat-paginator-navigation-first\"\n (click)=\"firstPage()\"\n [attr.aria-label]=\"_intl.firstPageLabel\"\n [matTooltip]=\"_intl.firstPageLabel\"\n [matTooltipDisabled]=\"_previousButtonsDisabled()\"\n [matTooltipPosition]=\"'above'\"\n [disabled]=\"_previousButtonsDisabled()\"\n *ngIf=\"showFirstLastButtons\">\n <svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z\"/>\n </svg>\n </button>\n <button mat-icon-button type=\"button\"\n class=\"mat-paginator-navigation-previous\"\n (click)=\"previousPage()\"\n [attr.aria-label]=\"_intl.previousPageLabel\"\n [matTooltip]=\"_intl.previousPageLabel\"\n [matTooltipDisabled]=\"_previousButtonsDisabled()\"\n [matTooltipPosition]=\"'above'\"\n [disabled]=\"_previousButtonsDisabled()\">\n <svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"/>\n </svg>\n </button>\n <button mat-icon-button type=\"button\"\n class=\"mat-paginator-navigation-next\"\n (click)=\"nextPage()\"\n [attr.aria-label]=\"_intl.nextPageLabel\"\n [matTooltip]=\"_intl.nextPageLabel\"\n [matTooltipDisabled]=\"_nextButtonsDisabled()\"\n [matTooltipPosition]=\"'above'\"\n [disabled]=\"_nextButtonsDisabled()\">\n <svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"/>\n </svg>\n </button>\n <button mat-icon-button type=\"button\"\n class=\"mat-paginator-navigation-last\"\n (click)=\"lastPage()\"\n [attr.aria-label]=\"_intl.lastPageLabel\"\n [matTooltip]=\"_intl.lastPageLabel\"\n [matTooltipDisabled]=\"_nextButtonsDisabled()\"\n [matTooltipPosition]=\"'above'\"\n [disabled]=\"_nextButtonsDisabled()\"\n *ngIf=\"showFirstLastButtons\">\n <svg class=\"mat-paginator-icon\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z\"/>\n </svg>\n </button>\n </div>\n </div>\n</div>\n",
679 inputs: ['disabled'],
680 host: {
681 'class': 'mat-paginator',
682 'role': 'group',
683 },
684 changeDetection: i0.ChangeDetectionStrategy.OnPush,
685 encapsulation: i0.ViewEncapsulation.None,
686 styles: [".mat-paginator{display:block}.mat-paginator-outer-container{display:flex}.mat-paginator-container{display:flex;align-items:center;justify-content:flex-end;padding:0 8px;flex-wrap:wrap-reverse;width:100%}.mat-paginator-page-size{display:flex;align-items:baseline;margin-right:8px}[dir=rtl] .mat-paginator-page-size{margin-right:0;margin-left:8px}.mat-paginator-page-size-label{margin:0 4px}.mat-paginator-page-size-select{margin:6px 4px 0 4px;width:56px}.mat-paginator-page-size-select.mat-form-field-appearance-outline{width:64px}.mat-paginator-page-size-select.mat-form-field-appearance-fill{width:64px}.mat-paginator-range-label{margin:0 32px 0 24px}.mat-paginator-range-actions{display:flex;align-items:center}.mat-paginator-icon{width:28px;fill:currentColor}[dir=rtl] .mat-paginator-icon{transform:rotate(180deg)}.cdk-high-contrast-active .mat-paginator-icon{fill:CanvasText}\n"]
687 },] }
688 ];
689 MatPaginator.ctorParameters = function () { return [
690 { type: MatPaginatorIntl },
691 { type: i0.ChangeDetectorRef },
692 { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [MAT_PAGINATOR_DEFAULT_OPTIONS,] }] }
693 ]; };
694
695 /**
696 * @license
697 * Copyright Google LLC All Rights Reserved.
698 *
699 * Use of this source code is governed by an MIT-style license that can be
700 * found in the LICENSE file at https://angular.io/license
701 */
702 var MatPaginatorModule = /** @class */ (function () {
703 function MatPaginatorModule() {
704 }
705 return MatPaginatorModule;
706 }());
707 MatPaginatorModule.decorators = [
708 { type: i0.NgModule, args: [{
709 imports: [
710 common.CommonModule,
711 button.MatButtonModule,
712 select.MatSelectModule,
713 tooltip.MatTooltipModule,
714 core.MatCommonModule,
715 ],
716 exports: [MatPaginator],
717 declarations: [MatPaginator],
718 providers: [MAT_PAGINATOR_INTL_PROVIDER],
719 },] }
720 ];
721
722 /**
723 * @license
724 * Copyright Google LLC All Rights Reserved.
725 *
726 * Use of this source code is governed by an MIT-style license that can be
727 * found in the LICENSE file at https://angular.io/license
728 */
729
730 /**
731 * Generated bundle index. Do not edit.
732 */
733
734 exports.MAT_PAGINATOR_DEFAULT_OPTIONS = MAT_PAGINATOR_DEFAULT_OPTIONS;
735 exports.MAT_PAGINATOR_INTL_PROVIDER = MAT_PAGINATOR_INTL_PROVIDER;
736 exports.MAT_PAGINATOR_INTL_PROVIDER_FACTORY = MAT_PAGINATOR_INTL_PROVIDER_FACTORY;
737 exports.MatPaginator = MatPaginator;
738 exports.MatPaginatorIntl = MatPaginatorIntl;
739 exports.MatPaginatorModule = MatPaginatorModule;
740 exports.PageEvent = PageEvent;
741 exports._MatPaginatorBase = _MatPaginatorBase;
742
743 Object.defineProperty(exports, '__esModule', { value: true });
744
745})));
746//# sourceMappingURL=material-paginator.umd.js.map
Note: See TracBrowser for help on using the repository browser.