1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { Injectable, Optional, SkipSelf } from '@angular/core';
|
---|
9 | import { Subject } from 'rxjs';
|
---|
10 | import * as i0 from "@angular/core";
|
---|
11 | /**
|
---|
12 | * To modify the labels and text displayed, create a new instance of MatPaginatorIntl and
|
---|
13 | * include it in a custom provider
|
---|
14 | */
|
---|
15 | export class MatPaginatorIntl {
|
---|
16 | constructor() {
|
---|
17 | /**
|
---|
18 | * Stream to emit from when labels are changed. Use this to notify components when the labels have
|
---|
19 | * changed after initialization.
|
---|
20 | */
|
---|
21 | this.changes = new Subject();
|
---|
22 | /** A label for the page size selector. */
|
---|
23 | this.itemsPerPageLabel = 'Items per page:';
|
---|
24 | /** A label for the button that increments the current page. */
|
---|
25 | this.nextPageLabel = 'Next page';
|
---|
26 | /** A label for the button that decrements the current page. */
|
---|
27 | this.previousPageLabel = 'Previous page';
|
---|
28 | /** A label for the button that moves to the first page. */
|
---|
29 | this.firstPageLabel = 'First page';
|
---|
30 | /** A label for the button that moves to the last page. */
|
---|
31 | this.lastPageLabel = 'Last page';
|
---|
32 | /** A label for the range of items within the current page and the length of the whole list. */
|
---|
33 | this.getRangeLabel = (page, pageSize, length) => {
|
---|
34 | if (length == 0 || pageSize == 0) {
|
---|
35 | return `0 of ${length}`;
|
---|
36 | }
|
---|
37 | length = Math.max(length, 0);
|
---|
38 | const startIndex = page * pageSize;
|
---|
39 | // If the start index exceeds the list length, do not try and fix the end index to the end.
|
---|
40 | const endIndex = startIndex < length ?
|
---|
41 | Math.min(startIndex + pageSize, length) :
|
---|
42 | startIndex + pageSize;
|
---|
43 | return `${startIndex + 1} – ${endIndex} of ${length}`;
|
---|
44 | };
|
---|
45 | }
|
---|
46 | }
|
---|
47 | MatPaginatorIntl.ɵprov = i0.ɵɵdefineInjectable({ factory: function MatPaginatorIntl_Factory() { return new MatPaginatorIntl(); }, token: MatPaginatorIntl, providedIn: "root" });
|
---|
48 | MatPaginatorIntl.decorators = [
|
---|
49 | { type: Injectable, args: [{ providedIn: 'root' },] }
|
---|
50 | ];
|
---|
51 | /** @docs-private */
|
---|
52 | export function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(parentIntl) {
|
---|
53 | return parentIntl || new MatPaginatorIntl();
|
---|
54 | }
|
---|
55 | /** @docs-private */
|
---|
56 | export const MAT_PAGINATOR_INTL_PROVIDER = {
|
---|
57 | // If there is already an MatPaginatorIntl available, use that. Otherwise, provide a new one.
|
---|
58 | provide: MatPaginatorIntl,
|
---|
59 | deps: [[new Optional(), new SkipSelf(), MatPaginatorIntl]],
|
---|
60 | useFactory: MAT_PAGINATOR_INTL_PROVIDER_FACTORY
|
---|
61 | };
|
---|
62 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFnaW5hdG9yLWludGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvcGFnaW5hdG9yL3BhZ2luYXRvci1pbnRsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBQyxVQUFVLEVBQUUsUUFBUSxFQUFFLFFBQVEsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUM3RCxPQUFPLEVBQUMsT0FBTyxFQUFDLE1BQU0sTUFBTSxDQUFDOztBQUc3Qjs7O0dBR0c7QUFFSCxNQUFNLE9BQU8sZ0JBQWdCO0lBRDdCO1FBRUU7OztXQUdHO1FBQ00sWUFBTyxHQUFrQixJQUFJLE9BQU8sRUFBUSxDQUFDO1FBRXRELDBDQUEwQztRQUMxQyxzQkFBaUIsR0FBVyxpQkFBaUIsQ0FBQztRQUU5QywrREFBK0Q7UUFDL0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