@progress/kendo-angular-pager 21.4.1-develop.1 → 22.0.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/fesm2022/progress-kendo-angular-pager.mjs +49 -49
  2. package/package.json +12 -20
  3. package/pager/localization/messages.d.ts +1 -1
  4. package/pager/pager-element.component.d.ts +1 -1
  5. package/schematics/ngAdd/index.js +6 -6
  6. package/esm2022/directives.mjs +0 -45
  7. package/esm2022/index.mjs +0 -21
  8. package/esm2022/package-metadata.mjs +0 -16
  9. package/esm2022/pager/change-event-args.interface.mjs +0 -5
  10. package/esm2022/pager/common/pager-classes.mjs +0 -5
  11. package/esm2022/pager/common/pager-size.mjs +0 -5
  12. package/esm2022/pager/common/pager-type.mjs +0 -5
  13. package/esm2022/pager/common/responsive-element.mjs +0 -5
  14. package/esm2022/pager/focusable.directive.mjs +0 -68
  15. package/esm2022/pager/localization/custom-messages.component.mjs +0 -55
  16. package/esm2022/pager/localization/localized-messages.directive.mjs +0 -39
  17. package/esm2022/pager/localization/messages.mjs +0 -100
  18. package/esm2022/pager/navigation.service.mjs +0 -39
  19. package/esm2022/pager/pager-context.service.mjs +0 -46
  20. package/esm2022/pager/pager-element.component.mjs +0 -113
  21. package/esm2022/pager/pager-info.component.mjs +0 -79
  22. package/esm2022/pager/pager-input.component.mjs +0 -177
  23. package/esm2022/pager/pager-next-buttons.component.mjs +0 -136
  24. package/esm2022/pager/pager-numeric-buttons.component.mjs +0 -257
  25. package/esm2022/pager/pager-page-sizes.component.mjs +0 -197
  26. package/esm2022/pager/pager-prev-buttons.component.mjs +0 -140
  27. package/esm2022/pager/pager-template.directive.mjs +0 -45
  28. package/esm2022/pager/pager.component.mjs +0 -1104
  29. package/esm2022/pager/pager.module.mjs +0 -65
  30. package/esm2022/pager/pagesize-item.interface.mjs +0 -5
  31. package/esm2022/pager/pagesizechange-event.mjs +0 -24
  32. package/esm2022/pager/preventable-event.mjs +0 -25
  33. package/esm2022/pager/spacer.component.mjs +0 -70
  34. package/esm2022/progress-kendo-angular-pager.mjs +0 -8
  35. package/esm2022/util.mjs +0 -124
@@ -1,55 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Component, forwardRef } from '@angular/core';
6
- import { LocalizationService } from '@progress/kendo-angular-l10n';
7
- import { Messages } from './messages';
8
- import * as i0 from "@angular/core";
9
- import * as i1 from "@progress/kendo-angular-l10n";
10
- /**
11
- * Represents the Kendo UI Pager custom messages component for Angular. Use this component to override default component messages
12
- * ([see example]({% slug pager_globalization %}#toc-messages)).
13
- *
14
- * @example
15
- * ```html
16
- * <kendo-pager [skip]="skip" [pageSize]="pageSize" [total]="total">
17
- * <kendo-pager-messages
18
- * previousNext="Previous/Next"
19
- * page="Page"
20
- * of="of">
21
- * </kendo-pager-messages>
22
- * </kendo-pager>
23
- * ```
24
- */
25
- export class CustomMessagesComponent extends Messages {
26
- service;
27
- constructor(service) {
28
- super();
29
- this.service = service;
30
- }
31
- get override() {
32
- return true;
33
- }
34
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
35
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: CustomMessagesComponent, isStandalone: true, selector: "kendo-datapager-messages, kendo-pager-messages", providers: [
36
- {
37
- provide: Messages,
38
- useExisting: forwardRef(() => CustomMessagesComponent)
39
- }
40
- ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
41
- }
42
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CustomMessagesComponent, decorators: [{
43
- type: Component,
44
- args: [{
45
- providers: [
46
- {
47
- provide: Messages,
48
- useExisting: forwardRef(() => CustomMessagesComponent)
49
- }
50
- ],
51
- selector: 'kendo-datapager-messages, kendo-pager-messages',
52
- template: ``,
53
- standalone: true
54
- }]
55
- }], ctorParameters: () => [{ type: i1.LocalizationService }] });
@@ -1,39 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Directive, forwardRef } from '@angular/core';
6
- import { LocalizationService } from '@progress/kendo-angular-l10n';
7
- import { Messages } from './messages';
8
- import * as i0 from "@angular/core";
9
- import * as i1 from "@progress/kendo-angular-l10n";
10
- /**
11
- * @hidden
12
- */
13
- export class LocalizedMessagesDirective extends Messages {
14
- service;
15
- constructor(service) {
16
- super();
17
- this.service = service;
18
- }
19
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
20
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoPagerLocalizedMessages]", providers: [
21
- {
22
- provide: Messages,
23
- useExisting: forwardRef(() => LocalizedMessagesDirective)
24
- }
25
- ], usesInheritance: true, ngImport: i0 });
26
- }
27
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
28
- type: Directive,
29
- args: [{
30
- providers: [
31
- {
32
- provide: Messages,
33
- useExisting: forwardRef(() => LocalizedMessagesDirective)
34
- }
35
- ],
36
- selector: '[kendoPagerLocalizedMessages]',
37
- standalone: true
38
- }]
39
- }], ctorParameters: () => [{ type: i1.LocalizationService }] });
@@ -1,100 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Directive, Input } from '@angular/core';
6
- import { ComponentMessages } from '@progress/kendo-angular-l10n';
7
- import * as i0 from "@angular/core";
8
- /**
9
- * @hidden
10
- */
11
- export class Messages extends ComponentMessages {
12
- /**
13
- * The label of the pager. Follows the pattern **Page navigation, page {currentPage} of {totalPages}** by default.
14
- * Тhe default label text when the current page is 1, and the total number of pages is 10 will be
15
- * **Page navigation, page 1 of 10**.
16
- *
17
- * The message consists of several parts - the current page number, the total number of pages, and a localizable string.
18
- * To allow for reordering its parts, the `ariaLabel` input accepts a string with placeholders for the current page
19
- * and total number of pages. The `{currentPage}` and `{totalPages}` placeholders will be replaced
20
- * internally with the respective actual values.
21
- */
22
- ariaLabel;
23
- /**
24
- * The label for the **First page** button.
25
- */
26
- firstPage;
27
- /**
28
- * The label for the **Last page** button.
29
- */
30
- lastPage;
31
- /**
32
- * The label for the **Previous page** button.
33
- */
34
- previousPage;
35
- /**
36
- * The label for the **Next page** button.
37
- */
38
- nextPage;
39
- /**
40
- * The label displayed before the pager input.
41
- */
42
- page;
43
- /**
44
- * The title attribute of the page number input element.
45
- */
46
- pageNumberInputTitle;
47
- /**
48
- * The label displayed after the page-size selector.
49
- */
50
- itemsPerPage;
51
- /**
52
- * The label before the total-page number.
53
- */
54
- of;
55
- /**
56
- * The label after the total-page number.
57
- */
58
- items;
59
- /**
60
- * The text of the title and aria-label attributes applied to the page chooser.
61
- */
62
- selectPage;
63
- /**
64
- * The text of the aria-label attribute applied to the input element for entering the page number."
65
- */
66
- inputLabel;
67
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
68
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: Messages, selector: "kendoPagerMessages", inputs: { ariaLabel: "ariaLabel", firstPage: "firstPage", lastPage: "lastPage", previousPage: "previousPage", nextPage: "nextPage", page: "page", pageNumberInputTitle: "pageNumberInputTitle", itemsPerPage: "itemsPerPage", of: "of", items: "items", selectPage: "selectPage", inputLabel: "inputLabel" }, usesInheritance: true, ngImport: i0 });
69
- }
70
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: Messages, decorators: [{
71
- type: Directive,
72
- args: [{
73
- // eslint-disable-next-line @angular-eslint/directive-selector
74
- selector: 'kendoPagerMessages'
75
- }]
76
- }], propDecorators: { ariaLabel: [{
77
- type: Input
78
- }], firstPage: [{
79
- type: Input
80
- }], lastPage: [{
81
- type: Input
82
- }], previousPage: [{
83
- type: Input
84
- }], nextPage: [{
85
- type: Input
86
- }], page: [{
87
- type: Input
88
- }], pageNumberInputTitle: [{
89
- type: Input
90
- }], itemsPerPage: [{
91
- type: Input
92
- }], of: [{
93
- type: Input
94
- }], items: [{
95
- type: Input
96
- }], selectPage: [{
97
- type: Input
98
- }], inputLabel: [{
99
- type: Input
100
- }] } });
@@ -1,39 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Subject } from "rxjs";
6
- import { focusableSelector, getAllFocusableChildren } from "../util";
7
- import { isFocusable } from "@progress/kendo-angular-common";
8
- /**
9
- * @hidden
10
- */
11
- export class PagerNavigationService {
12
- isNavigable = true;
13
- innerNavigationChange = new Subject();
14
- toggleInnerNavigation(value) {
15
- this.innerNavigationChange.next(value);
16
- }
17
- keepFocusWithinComponent(wrapper, target, event) {
18
- const [firstFocusable, lastFocusable] = this.getFirstAndLastFocusable(wrapper);
19
- const tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
20
- const shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
21
- if (tabAfterLastFocusable) {
22
- event.preventDefault();
23
- firstFocusable.focus();
24
- }
25
- if (shiftTabAfterFirstFocusable) {
26
- event.preventDefault();
27
- lastFocusable.focus();
28
- }
29
- }
30
- getFirstAndLastFocusable(wrapper) {
31
- const all = getAllFocusableChildren(wrapper);
32
- const firstFocusable = all.length > 0 ? all[0] : wrapper;
33
- const lastFocusable = all.length > 0 ? all[all.length - 1] : wrapper;
34
- return [
35
- isFocusable(firstFocusable) ? firstFocusable : firstFocusable.querySelector(focusableSelector),
36
- isFocusable(lastFocusable) ? lastFocusable : lastFocusable.querySelector(focusableSelector)
37
- ];
38
- }
39
- }
@@ -1,46 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Subject } from "rxjs";
6
- /**
7
- * @hidden
8
- */
9
- export class PagerContextService {
10
- total;
11
- skip;
12
- pageSize;
13
- isAllSelected = false;
14
- localization;
15
- changes = new Subject();
16
- pageChange = new Subject();
17
- pageSizeChange = new Subject();
18
- get currentPage() {
19
- return this.skip / this.pageSize;
20
- }
21
- notifyChanges(changes) {
22
- this.total = changes.total;
23
- this.skip = changes.skip;
24
- this.pageSize = changes.pageSize;
25
- this.isAllSelected = changes.isAllSelected || false;
26
- this.changes.next(changes);
27
- }
28
- changePage(page) {
29
- this.pageChange.next({ skip: page * this.pageSize, take: this.pageSize });
30
- }
31
- changePageSize(event) {
32
- this.pageSizeChange.next(event);
33
- }
34
- nextPage() {
35
- const nextPage = this.currentPage + 1;
36
- if (nextPage * this.pageSize < this.total) {
37
- this.changePage(nextPage);
38
- }
39
- }
40
- prevPage() {
41
- const prevPage = this.currentPage - 1;
42
- if (prevPage * this.pageSize >= 0) {
43
- this.changePage(prevPage);
44
- }
45
- }
46
- }
@@ -1,113 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Component, ChangeDetectorRef } from '@angular/core';
6
- import { PagerContextService } from "./pager-context.service";
7
- import { LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { caretAltLeftIcon, caretAltRightIcon, caretAltToLeftIcon, caretAltToRightIcon } from '@progress/kendo-svg-icons';
9
- import * as i0 from "@angular/core";
10
- import * as i1 from "@progress/kendo-angular-l10n";
11
- import * as i2 from "./pager-context.service";
12
- /**
13
- * @hidden
14
- */
15
- export class PagerElementComponent {
16
- localization;
17
- pagerContext;
18
- cd;
19
- total;
20
- skip;
21
- pageSize;
22
- caretAltLeftIcon = caretAltLeftIcon;
23
- caretAltToLeftIcon = caretAltToLeftIcon;
24
- caretAltRightIcon = caretAltRightIcon;
25
- caretAltToRightIcon = caretAltToRightIcon;
26
- /**
27
- * @hidden
28
- *
29
- * @readonly
30
- * @type {number}
31
- * @memberOf PagerElementComponent
32
- */
33
- get currentPage() {
34
- return Math.floor((this.skip || 0) / this.pageSize) + 1;
35
- }
36
- /**
37
- * @hidden
38
- *
39
- * @readonly
40
- * @type {number}
41
- * @memberOf PagerElementComponent
42
- */
43
- get totalPages() {
44
- return Math.ceil((this.total || 0) / this.pageSize);
45
- }
46
- subscriptions;
47
- constructor(localization, pagerContext, cd) {
48
- this.localization = localization;
49
- this.pagerContext = pagerContext;
50
- this.cd = cd;
51
- this.total = pagerContext.total;
52
- this.skip = pagerContext.skip;
53
- this.pageSize = pagerContext.pageSize;
54
- }
55
- /**
56
- * @hidden
57
- *
58
- * @param {string} key
59
- * @returns {string}
60
- *
61
- * @memberOf PagerElementComponent
62
- */
63
- textFor(key) {
64
- const isPagerLocalization = this.localization.prefix === 'kendo.pager';
65
- return this.localization.get(isPagerLocalization ? key : `pager${key[0].toLocaleUpperCase()}${key.slice(1)}`);
66
- }
67
- /**
68
- * @hidden
69
- *
70
- * @param {number} page
71
- *
72
- * @memberOf PagerElementComponent
73
- */
74
- changePage(page) {
75
- this.pagerContext.changePage(page);
76
- return false;
77
- }
78
- /**
79
- * @hidden
80
- *
81
- * @memberOf PagerElementComponent
82
- */
83
- ngOnInit() {
84
- this.subscriptions = this.pagerContext.changes.subscribe(this.onChanges.bind(this));
85
- this.subscriptions.add(this.localization.changes.subscribe(() => this.cd.markForCheck()));
86
- }
87
- ngOnDestroy() {
88
- if (this.subscriptions) {
89
- this.subscriptions.unsubscribe();
90
- }
91
- }
92
- get prevArrowIcons() {
93
- return !this.localization.rtl ? ['caret-alt-to-left', 'caret-alt-left'] : ['caret-alt-to-right', 'caret-alt-right'];
94
- }
95
- get prevArrowSVGIcons() {
96
- return !this.localization.rtl ? [this.caretAltToLeftIcon, this.caretAltLeftIcon] : [this.caretAltToRightIcon, this.caretAltRightIcon];
97
- }
98
- get nextArrowIcons() {
99
- return !this.localization.rtl ? ['caret-alt-right', 'caret-alt-to-right'] : ['caret-alt-left', 'caret-alt-to-left'];
100
- }
101
- get nextArrowSVGIcons() {
102
- return !this.localization.rtl ? [this.caretAltRightIcon, this.caretAltToRightIcon] : [this.caretAltLeftIcon, this.caretAltToLeftIcon];
103
- }
104
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PagerElementComponent, deps: [{ token: i1.LocalizationService }, { token: i2.PagerContextService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
105
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: PagerElementComponent, selector: "kendo-pager-element", ngImport: i0, template: ``, isInline: true });
106
- }
107
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PagerElementComponent, decorators: [{
108
- type: Component,
109
- args: [{
110
- selector: 'kendo-pager-element',
111
- template: ``
112
- }]
113
- }], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i2.PagerContextService }, { type: i0.ChangeDetectorRef }] });
@@ -1,79 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- // eslint-disable no-access-missing-member
6
- import { Component, ChangeDetectorRef, ChangeDetectionStrategy, HostBinding } from '@angular/core';
7
- import { PagerElementComponent } from './pager-element.component';
8
- import { LocalizationService } from '@progress/kendo-angular-l10n';
9
- import { PagerContextService } from "./pager-context.service";
10
- import * as i0 from "@angular/core";
11
- import * as i1 from "@progress/kendo-angular-l10n";
12
- import * as i2 from "./pager-context.service";
13
- /**
14
- * Represents the Kendo UI Pager Info component for Angular. Displays information about the current page and the total number of records ([see example]({% slug pager_settings %})).
15
- *
16
- * @example
17
- * ```html
18
- * <kendo-pager [skip]="skip" [pageSize]="pageSize" [total]="total">
19
- * <ng-template kendoPagerTemplate>
20
- * <kendo-pager-info></kendo-pager-info>
21
- * </ng-template>
22
- * </kendo-pager>
23
- * ```
24
- */
25
- export class PagerInfoComponent extends PagerElementComponent {
26
- /**
27
- * @hidden
28
- *
29
- * @readonly
30
- * @type {number}
31
- * @memberOf PagerInfoComponent
32
- */
33
- get maxItems() {
34
- return Math.min(this.currentPage * this.pageSize, this.total);
35
- }
36
- /**
37
- * @hidden
38
- *
39
- * @readonly
40
- * @type {number}
41
- * @memberOf PagerInfoComponent
42
- */
43
- get currentPageText() {
44
- return this.total ?
45
- (this.currentPage - 1) * this.pageSize + 1 :
46
- 0;
47
- }
48
- /**
49
- * @hidden
50
- *
51
- * @readonly
52
- * @type {boolean}
53
- * @memberOf PagerInfoComponent
54
- */
55
- hostClass = true;
56
- constructor(localization, cd, pagerContext) {
57
- super(localization, pagerContext, cd);
58
- }
59
- onChanges({ total, skip, pageSize }) {
60
- this.total = total;
61
- this.skip = skip;
62
- this.pageSize = pageSize;
63
- this.cd.markForCheck();
64
- }
65
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PagerInfoComponent, deps: [{ token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i2.PagerContextService }], target: i0.ɵɵFactoryTarget.Component });
66
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: PagerInfoComponent, isStandalone: true, selector: "kendo-datapager-info, kendo-pager-info", host: { properties: { "class.k-pager-info": "this.hostClass" } }, usesInheritance: true, ngImport: i0, template: `{{currentPageText}} - {{maxItems}} {{textFor('of')}} {{total}} {{textFor('items')}}`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
67
- }
68
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PagerInfoComponent, decorators: [{
69
- type: Component,
70
- args: [{
71
- changeDetection: ChangeDetectionStrategy.OnPush,
72
- selector: 'kendo-datapager-info, kendo-pager-info',
73
- template: `{{currentPageText}} - {{maxItems}} {{textFor('of')}} {{total}} {{textFor('items')}}`,
74
- standalone: true
75
- }]
76
- }], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i2.PagerContextService }], propDecorators: { hostClass: [{
77
- type: HostBinding,
78
- args: ['class.k-pager-info']
79
- }] } });
@@ -1,177 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { NumericTextBoxComponent } from '@progress/kendo-angular-inputs';
6
- // eslint-disable no-access-missing-member
7
- import { Component, ChangeDetectorRef, ViewChild, NgZone, Renderer2, Input } from '@angular/core';
8
- import { PagerElementComponent } from './pager-element.component';
9
- import { LocalizationService } from "@progress/kendo-angular-l10n";
10
- import { PagerContextService } from "./pager-context.service";
11
- import { Keys, EventsOutsideAngularDirective } from '@progress/kendo-angular-common';
12
- import { DEFAULT_SIZE } from '../util';
13
- import { PagerFocusableDirective } from './focusable.directive';
14
- import * as i0 from "@angular/core";
15
- import * as i1 from "@progress/kendo-angular-l10n";
16
- import * as i2 from "./pager-context.service";
17
- /**
18
- * Represents the Kendo UI Pager Input component for Angular. Displays an input element which allows you to type and render page numbers.
19
- *
20
- * @example
21
- * ```html
22
- * <kendo-pager [skip]="skip" [pageSize]="pageSize" [total]="total">
23
- * <ng-template kendoPagerTemplate>
24
- * <kendo-pager-input></kendo-pager-input>
25
- * </ng-template>
26
- * </kendo-pager>
27
- * ```
28
- */
29
- export class PagerInputComponent extends PagerElementComponent {
30
- pagerContext;
31
- zone;
32
- renderer;
33
- numericInput;
34
- /**
35
- * Controls the visibility of the page text label.
36
- * @hidden
37
- */
38
- showPageText = true;
39
- /**
40
- * Specifies the padding of the internal `NumericTextBox` component.
41
- *
42
- * @default 'medium'
43
- */
44
- size = DEFAULT_SIZE;
45
- constructor(localization, pagerContext, zone, cd, renderer) {
46
- super(localization, pagerContext, cd);
47
- this.pagerContext = pagerContext;
48
- this.zone = zone;
49
- this.renderer = renderer;
50
- }
51
- onChanges({ total, skip, pageSize }) {
52
- this.total = total;
53
- this.skip = skip;
54
- this.pageSize = pageSize;
55
- this.cd.markForCheck();
56
- }
57
- /**
58
- * @hidden
59
- *
60
- * @param {string} value
61
- *
62
- * @memberOf PagerInputComponent
63
- */
64
- handleKeyDown = (event) => {
65
- const incomingValue = this.numericInput.value || this.current;
66
- // eslint-disable import/no-deprecated
67
- if (event.code === Keys.Enter || event.code === Keys.NumpadEnter) {
68
- event.preventDefault();
69
- if (incomingValue !== this.current) {
70
- this.zone.run(() => {
71
- this.changePage(incomingValue - 1);
72
- });
73
- }
74
- }
75
- };
76
- /**
77
- * @hidden
78
- *
79
- * @param {string} value
80
- *
81
- * @memberOf PagerInputComponent
82
- */
83
- handleBlur = () => {
84
- const inputValue = this.numericInput.value;
85
- if (!inputValue) {
86
- this.numericInput.writeValue(this.current);
87
- return;
88
- }
89
- if (inputValue !== this.current) {
90
- this.zone.run(() => {
91
- this.changePage(inputValue - 1);
92
- });
93
- }
94
- };
95
- /**
96
- * @hidden
97
- */
98
- get current() {
99
- return this.hasPages ? this.currentPage : 0;
100
- }
101
- /**
102
- * @hidden
103
- */
104
- get hasPages() {
105
- return this.totalPages !== 0;
106
- }
107
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PagerInputComponent, deps: [{ token: i1.LocalizationService }, { token: i2.PagerContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
108
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: PagerInputComponent, isStandalone: true, selector: "kendo-datapager-input, kendo-pager-input", inputs: { showPageText: "showPageText", size: "size" }, viewQueries: [{ propertyName: "numericInput", first: true, predicate: NumericTextBoxComponent, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
109
- <span class="k-pager-input">
110
- @if (showPageText) {
111
- {{textFor('page')}}
112
- }
113
- <kendo-numerictextbox kendoPagerFocusable
114
- [spinners]="false"
115
- [decimals]="0"
116
- format="n0"
117
- [size]="size"
118
- [disabled]="!hasPages"
119
- [value]="current"
120
- [min]="hasPages ? 1 : 0"
121
- [max]="totalPages"
122
- [autoCorrect]="true"
123
- [inputAttributes]="{
124
- 'aria-label': textFor('inputLabel')
125
- }"
126
- [title]="textFor('pageNumberInputTitle')"
127
- [kendoEventsOutsideAngular]="{
128
- keydown: handleKeyDown,
129
- focusout: handleBlur
130
- }">
131
- </kendo-numerictextbox>
132
- {{textFor('of')}} {{totalPages}}
133
- </span>
134
- `, isInline: true, dependencies: [{ kind: "component", type: NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode", "inputAttributes"], outputs: ["valueChange", "focus", "blur", "inputFocus", "inputBlur"], exportAs: ["kendoNumericTextBox"] }, { kind: "directive", type: PagerFocusableDirective, selector: "[kendoPagerFocusable]", exportAs: ["kendoPagerFocusable"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }] });
135
- }
136
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PagerInputComponent, decorators: [{
137
- type: Component,
138
- args: [{
139
- selector: 'kendo-datapager-input, kendo-pager-input',
140
- template: `
141
- <span class="k-pager-input">
142
- @if (showPageText) {
143
- {{textFor('page')}}
144
- }
145
- <kendo-numerictextbox kendoPagerFocusable
146
- [spinners]="false"
147
- [decimals]="0"
148
- format="n0"
149
- [size]="size"
150
- [disabled]="!hasPages"
151
- [value]="current"
152
- [min]="hasPages ? 1 : 0"
153
- [max]="totalPages"
154
- [autoCorrect]="true"
155
- [inputAttributes]="{
156
- 'aria-label': textFor('inputLabel')
157
- }"
158
- [title]="textFor('pageNumberInputTitle')"
159
- [kendoEventsOutsideAngular]="{
160
- keydown: handleKeyDown,
161
- focusout: handleBlur
162
- }">
163
- </kendo-numerictextbox>
164
- {{textFor('of')}} {{totalPages}}
165
- </span>
166
- `,
167
- standalone: true,
168
- imports: [NumericTextBoxComponent, PagerFocusableDirective, EventsOutsideAngularDirective]
169
- }]
170
- }], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i2.PagerContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }], propDecorators: { numericInput: [{
171
- type: ViewChild,
172
- args: [NumericTextBoxComponent, { static: true }]
173
- }], showPageText: [{
174
- type: Input
175
- }], size: [{
176
- type: Input
177
- }] } });