@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.
- package/fesm2022/progress-kendo-angular-pager.mjs +49 -49
- package/package.json +12 -20
- package/pager/localization/messages.d.ts +1 -1
- package/pager/pager-element.component.d.ts +1 -1
- package/schematics/ngAdd/index.js +6 -6
- package/esm2022/directives.mjs +0 -45
- package/esm2022/index.mjs +0 -21
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/pager/change-event-args.interface.mjs +0 -5
- package/esm2022/pager/common/pager-classes.mjs +0 -5
- package/esm2022/pager/common/pager-size.mjs +0 -5
- package/esm2022/pager/common/pager-type.mjs +0 -5
- package/esm2022/pager/common/responsive-element.mjs +0 -5
- package/esm2022/pager/focusable.directive.mjs +0 -68
- package/esm2022/pager/localization/custom-messages.component.mjs +0 -55
- package/esm2022/pager/localization/localized-messages.directive.mjs +0 -39
- package/esm2022/pager/localization/messages.mjs +0 -100
- package/esm2022/pager/navigation.service.mjs +0 -39
- package/esm2022/pager/pager-context.service.mjs +0 -46
- package/esm2022/pager/pager-element.component.mjs +0 -113
- package/esm2022/pager/pager-info.component.mjs +0 -79
- package/esm2022/pager/pager-input.component.mjs +0 -177
- package/esm2022/pager/pager-next-buttons.component.mjs +0 -136
- package/esm2022/pager/pager-numeric-buttons.component.mjs +0 -257
- package/esm2022/pager/pager-page-sizes.component.mjs +0 -197
- package/esm2022/pager/pager-prev-buttons.component.mjs +0 -140
- package/esm2022/pager/pager-template.directive.mjs +0 -45
- package/esm2022/pager/pager.component.mjs +0 -1104
- package/esm2022/pager/pager.module.mjs +0 -65
- package/esm2022/pager/pagesize-item.interface.mjs +0 -5
- package/esm2022/pager/pagesizechange-event.mjs +0 -24
- package/esm2022/pager/preventable-event.mjs +0 -25
- package/esm2022/pager/spacer.component.mjs +0 -70
- package/esm2022/progress-kendo-angular-pager.mjs +0 -8
- package/esm2022/util.mjs +0 -124
|
@@ -1,1104 +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, Input, EventEmitter, Output, HostBinding, ElementRef, Renderer2, NgZone, HostListener, ContentChildren, QueryList, Optional, SkipSelf, inject, ViewChild, ChangeDetectorRef } from '@angular/core';
|
|
6
|
-
import { PagerTemplateDirective } from "./pager-template.directive";
|
|
7
|
-
import { anyChanged, isChanged, isDocumentAvailable, Keys, normalizeKeys, replaceMessagePlaceholder, ResizeSensorComponent } from "@progress/kendo-angular-common";
|
|
8
|
-
import { PagerContextService } from "./pager-context.service";
|
|
9
|
-
import { Subscription } from "rxjs";
|
|
10
|
-
import { DEFAULT_PAGE_SIZE_VALUES, getStylingClasses, DEFAULT_SIZE, calculatePadding, calculateGap, createMeasurementSpan, copyComputedStyles, positionOffScreen, getAllFocusableChildren } from '../util';
|
|
11
|
-
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
12
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
13
|
-
import { packageMetadata } from '../package-metadata';
|
|
14
|
-
import { PagerNavigationService } from './navigation.service';
|
|
15
|
-
import { PagerNumericButtonsComponent } from './pager-numeric-buttons.component';
|
|
16
|
-
import { PagerInfoComponent } from './pager-info.component';
|
|
17
|
-
import { PagerPageSizesComponent } from './pager-page-sizes.component';
|
|
18
|
-
import { PagerNextButtonsComponent } from './pager-next-buttons.component';
|
|
19
|
-
import { PagerInputComponent } from './pager-input.component';
|
|
20
|
-
import { PagerPrevButtonsComponent } from './pager-prev-buttons.component';
|
|
21
|
-
import { NgStyle, NgTemplateOutlet } from '@angular/common';
|
|
22
|
-
import { LocalizedMessagesDirective } from './localization/localized-messages.directive';
|
|
23
|
-
import { take } from 'rxjs/operators';
|
|
24
|
-
import * as i0 from "@angular/core";
|
|
25
|
-
import * as i1 from "./pager-context.service";
|
|
26
|
-
import * as i2 from "@progress/kendo-angular-l10n";
|
|
27
|
-
import * as i3 from "./navigation.service";
|
|
28
|
-
/**
|
|
29
|
-
* Represents the Kendo UI Pager component for Angular.
|
|
30
|
-
* Enables you to split a set of data into pages, providing a flexible and intuitive UI.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* @Component({
|
|
35
|
-
* selector: 'my-app',
|
|
36
|
-
* template: `
|
|
37
|
-
* <kendo-pager
|
|
38
|
-
* [total]="total"
|
|
39
|
-
* [skip]="skip"
|
|
40
|
-
* [pageSize]="pageSize"
|
|
41
|
-
* (pageChange)="onPageChange($event)">
|
|
42
|
-
* </kendo-pager>
|
|
43
|
-
* `
|
|
44
|
-
* })
|
|
45
|
-
* export class AppComponent {
|
|
46
|
-
* public total = 200;
|
|
47
|
-
* public skip = 0;
|
|
48
|
-
* public pageSize = 10;
|
|
49
|
-
*
|
|
50
|
-
* public onPageChange(event: PageChangeEvent) {
|
|
51
|
-
* this.skip = event.skip;
|
|
52
|
-
* }
|
|
53
|
-
* }
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* @remarks
|
|
57
|
-
* Supported children components are:
|
|
58
|
-
* {@link PagerNumericButtonsComponent},
|
|
59
|
-
* {@link PagerInputComponent},
|
|
60
|
-
* {@link PagerPageSizesComponent},
|
|
61
|
-
* {@link PagerSpacerComponent},
|
|
62
|
-
* {@link PagerPrevButtonsComponent},
|
|
63
|
-
* {@link PagerNextButtonsComponent},
|
|
64
|
-
* {@link PagerInfoComponent},
|
|
65
|
-
* {@link CustomMessagesComponent}
|
|
66
|
-
*/
|
|
67
|
-
export class PagerComponent {
|
|
68
|
-
pagerContext;
|
|
69
|
-
element;
|
|
70
|
-
localization;
|
|
71
|
-
renderer;
|
|
72
|
-
ngZone;
|
|
73
|
-
cdr;
|
|
74
|
-
navigationService;
|
|
75
|
-
/**
|
|
76
|
-
* Represents the collection of pager template directives.
|
|
77
|
-
*/
|
|
78
|
-
template;
|
|
79
|
-
set numericButtons(buttons) {
|
|
80
|
-
const newWidth = buttons ? buttons.nativeElement?.offsetWidth : 0;
|
|
81
|
-
if (buttons && newWidth !== this.pagerDimensions.numericButtonsWidth) {
|
|
82
|
-
this.pagerDimensions.numericButtonsWidth = newWidth;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
set pagerInput(input) {
|
|
86
|
-
const newWidth = input ? input.nativeElement?.offsetWidth : 0;
|
|
87
|
-
if (input && newWidth !== this.pagerDimensions.inputWidth) {
|
|
88
|
-
this.pagerDimensions.inputWidth = newWidth;
|
|
89
|
-
}
|
|
90
|
-
if (input?.nativeElement && !this.pagerDimensions.gapPageText) {
|
|
91
|
-
const innerStyledElement = input.nativeElement.querySelector('.k-pager-input');
|
|
92
|
-
this.pagerDimensions.gapPageText = calculateGap(innerStyledElement);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
pagerInputComponent;
|
|
96
|
-
set pageSizes(sizes) {
|
|
97
|
-
const newWidth = sizes ? sizes.nativeElement?.offsetWidth : 0;
|
|
98
|
-
if (sizes && newWidth !== this.pagerDimensions.pageSizesWidth) {
|
|
99
|
-
this.pagerDimensions.pageSizesWidth = newWidth;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
pageSizesComponent;
|
|
103
|
-
/**
|
|
104
|
-
* @hidden
|
|
105
|
-
*/
|
|
106
|
-
externalTemplate;
|
|
107
|
-
/**
|
|
108
|
-
* Specifies the total number of data items in the collection.
|
|
109
|
-
*
|
|
110
|
-
* @default 0
|
|
111
|
-
*/
|
|
112
|
-
total = 0;
|
|
113
|
-
/**
|
|
114
|
-
* Specifies the number of data items to skip.
|
|
115
|
-
*
|
|
116
|
-
* @default 0
|
|
117
|
-
*/
|
|
118
|
-
skip = 0;
|
|
119
|
-
/**
|
|
120
|
-
* Specifies the number of data items per page.
|
|
121
|
-
*/
|
|
122
|
-
pageSize;
|
|
123
|
-
/**
|
|
124
|
-
* Specifies the maximum number of numeric buttons before the buttons are collapsed.
|
|
125
|
-
*
|
|
126
|
-
* @default 10
|
|
127
|
-
*/
|
|
128
|
-
buttonCount = 10;
|
|
129
|
-
/**
|
|
130
|
-
* Determines whether to display information about the current page and the total number of records.
|
|
131
|
-
*
|
|
132
|
-
* @default true
|
|
133
|
-
*/
|
|
134
|
-
info = true;
|
|
135
|
-
/**
|
|
136
|
-
* Specifies the type of the Pager.
|
|
137
|
-
*
|
|
138
|
-
* @default 'numeric'
|
|
139
|
-
*/
|
|
140
|
-
type = 'numeric';
|
|
141
|
-
/**
|
|
142
|
-
* Displays a dropdown for selecting the page size.
|
|
143
|
-
* When set to `true`, the dropdown contains the default list of options - 5, 10, 20.
|
|
144
|
-
* To customize the list of options, set `pageSizeValues` to an array of the desired values.
|
|
145
|
-
* The array can contain numbers and [PageSizeItem]({% slug api_pager_pagesizeitem %}) objects.
|
|
146
|
-
*/
|
|
147
|
-
set pageSizeValues(value) {
|
|
148
|
-
if (typeof value === 'boolean') {
|
|
149
|
-
this._pageSizeValues = value ? DEFAULT_PAGE_SIZE_VALUES : [];
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
this._pageSizeValues = value;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
get pageSizeValues() {
|
|
156
|
-
return this._pageSizeValues;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Determines whether to display the **Previous** and **Next** buttons.
|
|
160
|
-
*
|
|
161
|
-
* @default true
|
|
162
|
-
*/
|
|
163
|
-
previousNext = true;
|
|
164
|
-
/**
|
|
165
|
-
* Determines whether users can use dedicated shortcuts to interact with the Pager ([see example]({% slug keyboard_navigation_pager %})).
|
|
166
|
-
* By default, navigation is enabled. To disable it and make the Pager content accessible in the normal tab sequence, set the property to `false`.
|
|
167
|
-
* @default true
|
|
168
|
-
*/
|
|
169
|
-
set navigable(value) {
|
|
170
|
-
this._navigable = value;
|
|
171
|
-
this.navigationService.isNavigable = value;
|
|
172
|
-
}
|
|
173
|
-
get navigable() {
|
|
174
|
-
return this._navigable;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Specifies the padding of all Pager elements.
|
|
178
|
-
*
|
|
179
|
-
* @default 'medium'
|
|
180
|
-
*/
|
|
181
|
-
set size(size) {
|
|
182
|
-
const newSize = size ? size : DEFAULT_SIZE;
|
|
183
|
-
this.handleClasses(newSize, 'size');
|
|
184
|
-
this._size = newSize;
|
|
185
|
-
}
|
|
186
|
-
get size() {
|
|
187
|
-
return this._size;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Determines whether the Pager responsive functionality is enabled ([see example](slug:responsive_pager)).
|
|
191
|
-
*
|
|
192
|
-
* @default true
|
|
193
|
-
*/
|
|
194
|
-
responsive = true;
|
|
195
|
-
/**
|
|
196
|
-
* Determines whether the Pager adaptiveness functionality is enabled ([see example](slug:adaptive_mode_pager)).
|
|
197
|
-
*
|
|
198
|
-
* @default 'none'
|
|
199
|
-
*/
|
|
200
|
-
adaptiveMode = 'none';
|
|
201
|
-
/**
|
|
202
|
-
* Fires when the current page of the Pager changes ([see example](slug:overview_pager)).
|
|
203
|
-
* You have to handle the event and page the data.
|
|
204
|
-
*/
|
|
205
|
-
pageChange = new EventEmitter();
|
|
206
|
-
/**
|
|
207
|
-
* Fires when the page size of the Pager changes.
|
|
208
|
-
* You have to handle the event and page the data.
|
|
209
|
-
* If the event is prevented, the page size remains unchanged ([see example]({% slug pager_events %})).
|
|
210
|
-
*/
|
|
211
|
-
pageSizeChange = new EventEmitter();
|
|
212
|
-
/**
|
|
213
|
-
* @hidden
|
|
214
|
-
*/
|
|
215
|
-
pagerInputVisibilityChange = new EventEmitter();
|
|
216
|
-
/**
|
|
217
|
-
* @hidden
|
|
218
|
-
*/
|
|
219
|
-
pageTextVisibilityChange = new EventEmitter();
|
|
220
|
-
/**
|
|
221
|
-
* @hidden
|
|
222
|
-
*/
|
|
223
|
-
itemsTextVisibilityChange = new EventEmitter();
|
|
224
|
-
pagerClass = true;
|
|
225
|
-
get responsiveClass() {
|
|
226
|
-
return this.responsive;
|
|
227
|
-
}
|
|
228
|
-
widgetRole = 'application';
|
|
229
|
-
roleDescription = 'pager';
|
|
230
|
-
keyShortcuts = 'Enter ArrowRight ArrowLeft';
|
|
231
|
-
get hostTabindex() {
|
|
232
|
-
return this.navigable ? '0' : '-1';
|
|
233
|
-
}
|
|
234
|
-
get dir() {
|
|
235
|
-
return this.direction;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* @hidden
|
|
239
|
-
*/
|
|
240
|
-
focusHandler(ev) {
|
|
241
|
-
const isInnerNavigationEnabled = ev.target !== this.element.nativeElement;
|
|
242
|
-
this.navigationService.toggleInnerNavigation(isInnerNavigationEnabled);
|
|
243
|
-
}
|
|
244
|
-
get totalPages() {
|
|
245
|
-
return Math.ceil((this.total || 0) / this.pageSize);
|
|
246
|
-
}
|
|
247
|
-
get currentPage() {
|
|
248
|
-
return Math.floor((this.skip || 0) / this.pageSize) + 1;
|
|
249
|
-
}
|
|
250
|
-
get templateContext() {
|
|
251
|
-
const context = this._templateContext;
|
|
252
|
-
context.totalPages = this.totalPages;
|
|
253
|
-
context.total = this.total;
|
|
254
|
-
context.skip = this.skip;
|
|
255
|
-
context.pageSize = this.pageSize;
|
|
256
|
-
context.currentPage = this.currentPage;
|
|
257
|
-
return context;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* @hidden
|
|
261
|
-
*/
|
|
262
|
-
get showPageText() {
|
|
263
|
-
return this._showPageText;
|
|
264
|
-
}
|
|
265
|
-
set showPageText(value) {
|
|
266
|
-
this._showPageText = value;
|
|
267
|
-
if (this.pagerInputComponent) {
|
|
268
|
-
this.pagerInputComponent.showPageText = value;
|
|
269
|
-
}
|
|
270
|
-
this.pageTextVisibilityChange.emit(value);
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* @hidden
|
|
274
|
-
*/
|
|
275
|
-
get showItemsText() {
|
|
276
|
-
return this._showItemsText;
|
|
277
|
-
}
|
|
278
|
-
set showItemsText(value) {
|
|
279
|
-
this._showItemsText = value;
|
|
280
|
-
if (this.pageSizesComponent) {
|
|
281
|
-
this.pageSizesComponent.showItemsText = value;
|
|
282
|
-
}
|
|
283
|
-
this.itemsTextVisibilityChange.emit(value);
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* @hidden
|
|
287
|
-
*/
|
|
288
|
-
get showInput() {
|
|
289
|
-
return this._showInput;
|
|
290
|
-
}
|
|
291
|
-
set showInput(value) {
|
|
292
|
-
this._showInput = value;
|
|
293
|
-
this.pagerInputVisibilityChange.emit(value);
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* @hidden
|
|
297
|
-
*/
|
|
298
|
-
initialized = false;
|
|
299
|
-
subscriptions = new Subscription();
|
|
300
|
-
_templateContext = {};
|
|
301
|
-
_pageSizeValues = DEFAULT_PAGE_SIZE_VALUES;
|
|
302
|
-
direction;
|
|
303
|
-
isInnerNavigationEnabled = false;
|
|
304
|
-
_navigable = true;
|
|
305
|
-
_size = DEFAULT_SIZE;
|
|
306
|
-
_showInput = true;
|
|
307
|
-
_showPageText = true;
|
|
308
|
-
_showItemsText = true;
|
|
309
|
-
_isAllSelected = false;
|
|
310
|
-
/**
|
|
311
|
-
* Stores the measurements of various Pager elements.
|
|
312
|
-
* These dimensions are used for responsive layout calculations.
|
|
313
|
-
* @hidden
|
|
314
|
-
*/
|
|
315
|
-
pagerDimensions = {
|
|
316
|
-
padding: 0,
|
|
317
|
-
numericButtonsWidth: 0,
|
|
318
|
-
inputWidth: 0,
|
|
319
|
-
pageSizesWidth: 0,
|
|
320
|
-
sizesTextWidth: 0,
|
|
321
|
-
pageTextWidth: 0,
|
|
322
|
-
infoTextWidth: 0,
|
|
323
|
-
gapNumbersSizes: 0,
|
|
324
|
-
gapSizesInfo: 0,
|
|
325
|
-
gapPageText: 0,
|
|
326
|
-
width: 0
|
|
327
|
-
};
|
|
328
|
-
constructor(pagerContext, element, localization, renderer, ngZone, cdr, navigationService) {
|
|
329
|
-
this.pagerContext = pagerContext;
|
|
330
|
-
this.element = element;
|
|
331
|
-
this.localization = localization;
|
|
332
|
-
this.renderer = renderer;
|
|
333
|
-
this.ngZone = ngZone;
|
|
334
|
-
this.cdr = cdr;
|
|
335
|
-
this.navigationService = navigationService;
|
|
336
|
-
validatePackage(packageMetadata);
|
|
337
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
338
|
-
if (!navigationService) {
|
|
339
|
-
this.navigationService = inject(PagerNavigationService);
|
|
340
|
-
}
|
|
341
|
-
if (!pagerContext) {
|
|
342
|
-
this.pagerContext = inject(PagerContextService);
|
|
343
|
-
}
|
|
344
|
-
this.pagerContext.localization = localization;
|
|
345
|
-
}
|
|
346
|
-
ngOnInit() {
|
|
347
|
-
this.subscriptions.add(this.pagerContext.pageChange.subscribe(this.changePage.bind(this)));
|
|
348
|
-
this.subscriptions.add(this.pagerContext.pageSizeChange.subscribe(this.changePageSize.bind(this)));
|
|
349
|
-
this.subscriptions.add(this.localization.changes.subscribe(({ rtl }) => {
|
|
350
|
-
this.direction = rtl ? 'rtl' : 'ltr';
|
|
351
|
-
this.measureAllTextWidths();
|
|
352
|
-
if (this.responsive) {
|
|
353
|
-
this.resizeHandler();
|
|
354
|
-
}
|
|
355
|
-
}));
|
|
356
|
-
this.subscriptions.add(this.navigationService.innerNavigationChange.subscribe(this.innerNavigationChange.bind(this)));
|
|
357
|
-
if (this.navigable) {
|
|
358
|
-
const wrapper = this.element.nativeElement;
|
|
359
|
-
this.ngZone.runOutsideAngular(() => {
|
|
360
|
-
this.subscriptions.add(this.renderer.listen(wrapper, 'keydown', this.keyDownHandler.bind(this)));
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Gets the maximum number of items displayed on the current page.
|
|
366
|
-
*/
|
|
367
|
-
get maxItems() {
|
|
368
|
-
return Math.min(this.currentPage * this.pageSize, this.total);
|
|
369
|
-
}
|
|
370
|
-
ngAfterViewInit() {
|
|
371
|
-
this.renderer.setAttribute(this.element.nativeElement, 'aria-label', this.ariaLabel);
|
|
372
|
-
this.subscriptions.add(this.template.changes.subscribe(() => {
|
|
373
|
-
this.measureAllTextWidths();
|
|
374
|
-
if (this.responsive) {
|
|
375
|
-
this.resizeHandler(false);
|
|
376
|
-
}
|
|
377
|
-
}));
|
|
378
|
-
this.handleClasses(this.size, 'size');
|
|
379
|
-
this.setPagerDimensions();
|
|
380
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
381
|
-
if (this.type !== 'input') {
|
|
382
|
-
this.showInput = false;
|
|
383
|
-
}
|
|
384
|
-
this.responsive && this.resizeHandler();
|
|
385
|
-
});
|
|
386
|
-
if (!isDocumentAvailable()) {
|
|
387
|
-
this.initialized = true;
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
this.ngZone.runOutsideAngular(() => {
|
|
391
|
-
setTimeout(() => {
|
|
392
|
-
this.initialized = true;
|
|
393
|
-
this.cdr.markForCheck();
|
|
394
|
-
}, 0);
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
ngOnChanges(changes) {
|
|
398
|
-
if (anyChanged(["pageSize", "skip", "total"], changes, false)) {
|
|
399
|
-
const previousTotal = changes['total']?.previousValue;
|
|
400
|
-
const currentTotal = this.total;
|
|
401
|
-
let pageSizeAdjusted = false;
|
|
402
|
-
if (this._isAllSelected && previousTotal && currentTotal !== previousTotal && this.pageSize === previousTotal) {
|
|
403
|
-
this.pageSize = currentTotal;
|
|
404
|
-
pageSizeAdjusted = true;
|
|
405
|
-
}
|
|
406
|
-
const previousButtonCount = Math.min(this.buttonCount, (changes['total']?.previousValue || this.total) / (changes['pageSize']?.previousValue || this.pageSize));
|
|
407
|
-
this.pagerContext.notifyChanges({
|
|
408
|
-
pageSize: this.pageSize,
|
|
409
|
-
skip: this.skip,
|
|
410
|
-
total: this.total,
|
|
411
|
-
isAllSelected: this._isAllSelected
|
|
412
|
-
});
|
|
413
|
-
this.pagerDimensions.numericButtonsWidth = (this.pagerDimensions.numericButtonsWidth * Math.min(this.buttonCount, this.total / this.pageSize)) / previousButtonCount;
|
|
414
|
-
this.renderer.setAttribute(this.element.nativeElement, 'aria-label', this.ariaLabel);
|
|
415
|
-
if (this.responsive) {
|
|
416
|
-
this.resizeHandler(false);
|
|
417
|
-
}
|
|
418
|
-
if (pageSizeAdjusted) {
|
|
419
|
-
Promise.resolve().then(() => {
|
|
420
|
-
this.pageChange.emit({ skip: this.skip, take: currentTotal });
|
|
421
|
-
this.cdr.detectChanges();
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
if (anyChanged(["pageSizeValues", "previousNext", "buttonCount"], changes, true)) {
|
|
426
|
-
if (this.responsive) {
|
|
427
|
-
this.resizeHandler(false);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
if (isChanged('responsive', changes, true)) {
|
|
431
|
-
if (changes['responsive'].currentValue && !changes['responsive'].previousValue) {
|
|
432
|
-
this.measureAllTextWidths();
|
|
433
|
-
this.resizeHandler(false);
|
|
434
|
-
}
|
|
435
|
-
if (!this.responsive) {
|
|
436
|
-
this.showInput = this.type === 'input';
|
|
437
|
-
this.showElements(this.element.nativeElement.offsetWidth, this.pagerDimensions.width);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
if (isChanged('type', changes, true)) {
|
|
441
|
-
this.showNumericButtonsResponsive();
|
|
442
|
-
if (this.responsive) {
|
|
443
|
-
this.resizeHandler(false);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
ngOnDestroy() {
|
|
448
|
-
this.subscriptions.unsubscribe();
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* @hidden
|
|
452
|
-
*/
|
|
453
|
-
changePage(event) {
|
|
454
|
-
this.pageChange.emit(event);
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* @hidden
|
|
458
|
-
*/
|
|
459
|
-
changePageSize(event) {
|
|
460
|
-
this.pageSizeChange.emit(event);
|
|
461
|
-
if (!event.isDefaultPrevented()) {
|
|
462
|
-
if (event.newPageSize === 'all') {
|
|
463
|
-
this._isAllSelected = true;
|
|
464
|
-
this.pageChange.emit({ skip: 0, take: this.total });
|
|
465
|
-
}
|
|
466
|
-
else {
|
|
467
|
-
this._isAllSelected = false;
|
|
468
|
-
this.pageChange.emit({ skip: 0, take: event.newPageSize });
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* @hidden
|
|
474
|
-
*/
|
|
475
|
-
onPageSizeChange(event) {
|
|
476
|
-
this.pageSizeChange.emit(event);
|
|
477
|
-
if (!event.isDefaultPrevented()) {
|
|
478
|
-
this.pageChange.emit({ skip: this.skip, take: event.newPageSize });
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* @hidden
|
|
483
|
-
*/
|
|
484
|
-
resizeHandler = (compareWidth = true) => {
|
|
485
|
-
if (this.template?.first && !this.responsive) {
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
if (!isDocumentAvailable() || !this.element?.nativeElement) {
|
|
489
|
-
this.initialized = true;
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
let pagerWidth = this.element.nativeElement.offsetWidth;
|
|
493
|
-
if (pagerWidth <= 0) {
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
if (compareWidth && pagerWidth === this.pagerDimensions.width) {
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
this.pagerDimensions.width = pagerWidth;
|
|
501
|
-
}
|
|
502
|
-
this.ngZone.runOutsideAngular(() => {
|
|
503
|
-
setTimeout(() => {
|
|
504
|
-
if (this.template?.first && !this.responsive) {
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
|
-
const numericButtonsWrapperElement = this.element.nativeElement.querySelector('.k-pager-numbers-wrap');
|
|
508
|
-
const pagerInfoElement = this.pagerInfoElement();
|
|
509
|
-
const pagerPageSizes = this.sizesDropDownElement();
|
|
510
|
-
let elementsWidths = numericButtonsWrapperElement?.offsetWidth + (pagerPageSizes?.offsetWidth || 0) + (pagerInfoElement?.offsetWidth > 0 ? Math.min(this.pagerDimensions.infoTextWidth) : 0);
|
|
511
|
-
if (this.isElementVisible(pagerInfoElement)) {
|
|
512
|
-
elementsWidths += this.pagerDimensions.gapSizesInfo;
|
|
513
|
-
}
|
|
514
|
-
pagerWidth -= this.pagerDimensions.padding;
|
|
515
|
-
if (this.isElementVisible(pagerPageSizes)) {
|
|
516
|
-
pagerWidth -= this.pagerDimensions.gapNumbersSizes;
|
|
517
|
-
}
|
|
518
|
-
if (pagerWidth < 0) {
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
this.showElements(pagerWidth, elementsWidths);
|
|
522
|
-
if (!this.initialized) {
|
|
523
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => this.initialized = true);
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
});
|
|
527
|
-
};
|
|
528
|
-
// use selectors to get the element even when used in a template
|
|
529
|
-
sizesDropDownElement = () => this.element.nativeElement.querySelector('.k-pager-sizes');
|
|
530
|
-
pagerInputElement = () => this.element.nativeElement.querySelector('.k-pager-input');
|
|
531
|
-
pagerInfoElement = () => this.element.nativeElement.querySelector('.k-pager-info');
|
|
532
|
-
numericButtonsElement = () => this.element.nativeElement.querySelector('kendo-datapager-numeric-buttons, kendo-pager-numeric-buttons');
|
|
533
|
-
responsiveDropDownElement = {
|
|
534
|
-
name: 'sizeDropDown',
|
|
535
|
-
isEnabled: () => this.showPageSizes,
|
|
536
|
-
isVisible: () => this.isElementVisible(this.sizesDropDownElement()),
|
|
537
|
-
width: () => this.pagerDimensions.pageSizesWidth + this.pagerDimensions.gapNumbersSizes - this.pagerDimensions.sizesTextWidth,
|
|
538
|
-
show: () => {
|
|
539
|
-
this.ngZone.run(() => this.showItemsText = false);
|
|
540
|
-
this.showElement(this.sizesDropDownElement());
|
|
541
|
-
},
|
|
542
|
-
hide: () => {
|
|
543
|
-
this.hideElement(this.sizesDropDownElement());
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
responsiveDropDownTextElement = {
|
|
547
|
-
name: 'itemsDropDownText',
|
|
548
|
-
isEnabled: () => this.showPageSizes,
|
|
549
|
-
isVisible: () => this.isElementVisible(this.sizesDropDownElement()) && this.showItemsText,
|
|
550
|
-
width: () => this.pagerDimensions.sizesTextWidth + this.pagerDimensions.gapPageText,
|
|
551
|
-
show: () => this.ngZone.run(() => this.showItemsText = true),
|
|
552
|
-
hide: () => this.ngZone.run(() => this.showItemsText = false)
|
|
553
|
-
};
|
|
554
|
-
responsivePageTextElement = {
|
|
555
|
-
name: 'pageText',
|
|
556
|
-
isEnabled: () => this.isElementVisible(this.pagerInputElement()),
|
|
557
|
-
isVisible: () => this.showPageText,
|
|
558
|
-
width: () => this.pagerDimensions.pageTextWidth + this.pagerDimensions.gapPageText,
|
|
559
|
-
show: () => this.ngZone.run(() => this.showPageText = true),
|
|
560
|
-
hide: () => this.ngZone.run(() => this.showPageText = false)
|
|
561
|
-
};
|
|
562
|
-
responsiveInfoTextElement = {
|
|
563
|
-
name: 'infoText',
|
|
564
|
-
isEnabled: () => this.info,
|
|
565
|
-
isVisible: () => this.isElementVisible(this.pagerInfoElement()),
|
|
566
|
-
width: () => this.pagerDimensions.infoTextWidth + this.pagerDimensions.gapSizesInfo,
|
|
567
|
-
show: () => {
|
|
568
|
-
this.ngZone.run(() => {
|
|
569
|
-
this.showElement(this.pagerInfoElement());
|
|
570
|
-
});
|
|
571
|
-
},
|
|
572
|
-
hide: () => {
|
|
573
|
-
this.ngZone.run(() => {
|
|
574
|
-
this.hideElement(this.pagerInfoElement());
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
responsiveNumericButtonsElement = {
|
|
579
|
-
name: 'numericButtons',
|
|
580
|
-
isEnabled: () => this.type === 'numeric',
|
|
581
|
-
isVisible: () => this.isElementVisible(this.numericButtonsElement()),
|
|
582
|
-
width: () => this.pagerDimensions.numericButtonsWidth - this.pagerDimensions.inputWidth,
|
|
583
|
-
show: () => {
|
|
584
|
-
this.showElement(this.numericButtonsElement());
|
|
585
|
-
this.ngZone.run(() => {
|
|
586
|
-
this.showInput = false;
|
|
587
|
-
this.cdr.markForCheck();
|
|
588
|
-
});
|
|
589
|
-
},
|
|
590
|
-
hide: () => {
|
|
591
|
-
this.hideElement(this.numericButtonsElement());
|
|
592
|
-
this.ngZone.run(() => {
|
|
593
|
-
this.showInput = true;
|
|
594
|
-
this.showPageText = true;
|
|
595
|
-
this.cdr.markForCheck();
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
/**
|
|
600
|
-
* Contains all elements that are subject to responsive toggling.
|
|
601
|
-
* These elements will be shown or hidden based on the available space.
|
|
602
|
-
* The order of elements in the array defines the priority of visibility.
|
|
603
|
-
* This array allows us to work with the elements without performing element-specific logic in other methods.
|
|
604
|
-
*/
|
|
605
|
-
responsiveElements = [
|
|
606
|
-
this.responsiveDropDownElement,
|
|
607
|
-
this.responsiveDropDownTextElement,
|
|
608
|
-
this.responsivePageTextElement,
|
|
609
|
-
this.responsiveInfoTextElement,
|
|
610
|
-
this.responsiveNumericButtonsElement
|
|
611
|
-
];
|
|
612
|
-
get ariaLabel() {
|
|
613
|
-
const localizationMsg = this.localization.get('ariaLabel') || '';
|
|
614
|
-
return replaceMessagePlaceholder(replaceMessagePlaceholder(localizationMsg, 'currentPage', this.currentPage.toString()), 'totalPages', this.totalPages.toString());
|
|
615
|
-
}
|
|
616
|
-
keyDownHandler(e) {
|
|
617
|
-
const target = e.target;
|
|
618
|
-
const wrapper = this.element.nativeElement;
|
|
619
|
-
// on some keyboards arrow keys, PageUp/Down, and Home/End are mapped to Numpad keys
|
|
620
|
-
const code = normalizeKeys(e);
|
|
621
|
-
const isArrowLeftOrPageUp = code === Keys.ArrowLeft || code === Keys.PageUp;
|
|
622
|
-
const isArrowRightOrPageDown = code === Keys.ArrowRight || code === Keys.PageDown;
|
|
623
|
-
const isEnter = code === Keys.Enter || code === Keys.NumpadEnter;
|
|
624
|
-
const isHome = code === Keys.Home;
|
|
625
|
-
const isEnd = code === Keys.End;
|
|
626
|
-
const isEsc = code === Keys.Escape;
|
|
627
|
-
const isTab = code === Keys.Tab;
|
|
628
|
-
const isFirstPage = this.currentPage === 1;
|
|
629
|
-
const isLastPage = this.currentPage === this.totalPages;
|
|
630
|
-
this.ngZone.run(() => {
|
|
631
|
-
if (isHome) {
|
|
632
|
-
if (e.target !== wrapper) {
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
e.preventDefault();
|
|
636
|
-
if (!isFirstPage) {
|
|
637
|
-
this.pagerContext.changePage(0);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
else if (isEnd) {
|
|
641
|
-
e.preventDefault();
|
|
642
|
-
if (e.target !== wrapper) {
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
if (!isLastPage) {
|
|
646
|
-
this.pagerContext.changePage(this.totalPages - 1);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
else if (this.isInnerNavigationEnabled) {
|
|
650
|
-
if (isEsc) {
|
|
651
|
-
this.navigationService.toggleInnerNavigation(false);
|
|
652
|
-
wrapper.focus();
|
|
653
|
-
}
|
|
654
|
-
else if (isTab) {
|
|
655
|
-
this.navigationService.keepFocusWithinComponent(wrapper, target, e);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
else {
|
|
659
|
-
if (e.target !== wrapper) {
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
if (isArrowLeftOrPageUp) {
|
|
663
|
-
e.preventDefault();
|
|
664
|
-
if (!isFirstPage) {
|
|
665
|
-
this.pagerContext.prevPage();
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
else if (isArrowRightOrPageDown) {
|
|
669
|
-
e.preventDefault();
|
|
670
|
-
if (!isLastPage) {
|
|
671
|
-
this.pagerContext.nextPage();
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
else if (isEnter) {
|
|
675
|
-
e.preventDefault();
|
|
676
|
-
let [firstFocusable] = this.navigationService.getFirstAndLastFocusable(wrapper);
|
|
677
|
-
if (firstFocusable.getAttribute('aria-disabled') === 'true') {
|
|
678
|
-
firstFocusable = Array.from(getAllFocusableChildren(wrapper)).find((el) => !el.getAttribute('aria-disabled'));
|
|
679
|
-
const input = firstFocusable.querySelector('input');
|
|
680
|
-
if (input) {
|
|
681
|
-
firstFocusable = input;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
this.navigationService.toggleInnerNavigation(true);
|
|
685
|
-
firstFocusable?.focus();
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
innerNavigationChange(value) {
|
|
691
|
-
this.isInnerNavigationEnabled = value;
|
|
692
|
-
}
|
|
693
|
-
handleClasses(value, input) {
|
|
694
|
-
const elem = this.element.nativeElement;
|
|
695
|
-
const classes = getStylingClasses('pager', input, this[input], value);
|
|
696
|
-
if (classes.toRemove) {
|
|
697
|
-
this.renderer.removeClass(elem, classes.toRemove);
|
|
698
|
-
}
|
|
699
|
-
if (classes.toAdd) {
|
|
700
|
-
this.renderer.addClass(elem, classes.toAdd);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
showElements(availableWidth, currentWidth) {
|
|
704
|
-
let index = 0;
|
|
705
|
-
while (index < this.responsiveElements.length) {
|
|
706
|
-
const element = this.responsiveElements[index];
|
|
707
|
-
if (!element.isEnabled() || element.isVisible()) {
|
|
708
|
-
index++;
|
|
709
|
-
continue;
|
|
710
|
-
}
|
|
711
|
-
const elementWidth = element.width();
|
|
712
|
-
// If not responsive, show all elements regardless of available width. If responsive, check if the current element fits
|
|
713
|
-
if (this.responsive && (currentWidth + elementWidth) > availableWidth) {
|
|
714
|
-
index++;
|
|
715
|
-
break;
|
|
716
|
-
}
|
|
717
|
-
element.show();
|
|
718
|
-
currentWidth += elementWidth;
|
|
719
|
-
index++;
|
|
720
|
-
}
|
|
721
|
-
// Do not hide elements if not responsive. If all elements fit, do not hide any.
|
|
722
|
-
if (!this.responsive || currentWidth <= availableWidth) {
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
let hideIndex = Math.min(index - 1, this.responsiveElements.length - 1);
|
|
726
|
-
while (hideIndex >= 0 && currentWidth > availableWidth) {
|
|
727
|
-
const element = this.responsiveElements[hideIndex];
|
|
728
|
-
if (!element.isEnabled() || !element.isVisible()) {
|
|
729
|
-
hideIndex--;
|
|
730
|
-
continue;
|
|
731
|
-
}
|
|
732
|
-
const elementWidth = element.width();
|
|
733
|
-
element.hide();
|
|
734
|
-
currentWidth -= elementWidth;
|
|
735
|
-
hideIndex--;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
isElementVisible(element) {
|
|
739
|
-
return element && !element?.classList.contains('k-hidden');
|
|
740
|
-
}
|
|
741
|
-
hideElement(element) {
|
|
742
|
-
if (element) {
|
|
743
|
-
this.renderer.addClass(element, 'k-hidden');
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
showElement(element) {
|
|
747
|
-
if (element) {
|
|
748
|
-
this.renderer.removeClass(element, 'k-hidden');
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
measureAllTextWidths() {
|
|
752
|
-
if (!isDocumentAvailable()) {
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
const existingInfo = this.pagerInfoElement();
|
|
756
|
-
const existingInput = this.pagerInputElement();
|
|
757
|
-
const existingSizes = this.sizesDropDownElement();
|
|
758
|
-
// create a single measurement container
|
|
759
|
-
const measureContainer = this.renderer.createElement('div');
|
|
760
|
-
positionOffScreen(this.renderer, measureContainer);
|
|
761
|
-
this.renderer.appendChild(this.element.nativeElement, measureContainer);
|
|
762
|
-
const infoSpan = createMeasurementSpan(this.renderer, measureContainer, 'k-pager-info');
|
|
763
|
-
const pageSpan = createMeasurementSpan(this.renderer, measureContainer, 'k-pager-input');
|
|
764
|
-
const sizesSpan = createMeasurementSpan(this.renderer, measureContainer, 'k-pager-sizes');
|
|
765
|
-
const infoText = `${this.currentPage} - ${this.maxItems} ${this.localization.get('of')} ${this.total} ${this.localization.get('items')}`;
|
|
766
|
-
this.renderer.setProperty(infoSpan, 'textContent', infoText);
|
|
767
|
-
this.renderer.setProperty(pageSpan, 'textContent', this.localization.get('page'));
|
|
768
|
-
this.renderer.setProperty(sizesSpan, 'textContent', this.localization.get('itemsPerPage'));
|
|
769
|
-
// copy computed styles if available
|
|
770
|
-
if (existingInfo)
|
|
771
|
-
copyComputedStyles(this.renderer, existingInfo, infoSpan);
|
|
772
|
-
if (existingInput)
|
|
773
|
-
copyComputedStyles(this.renderer, existingInput, pageSpan);
|
|
774
|
-
if (existingSizes)
|
|
775
|
-
copyComputedStyles(this.renderer, existingSizes, sizesSpan);
|
|
776
|
-
// force a reflow to ensure measurements are accurate
|
|
777
|
-
measureContainer.getBoundingClientRect();
|
|
778
|
-
this.pagerDimensions.infoTextWidth = infoSpan?.offsetWidth;
|
|
779
|
-
if (this.pagerDimensions.inputWidth && this.pagerDimensions.pageTextWidth) {
|
|
780
|
-
this.pagerDimensions.inputWidth = this.pagerDimensions.inputWidth - this.pagerDimensions.pageTextWidth + pageSpan.offsetWidth;
|
|
781
|
-
}
|
|
782
|
-
this.pagerDimensions.pageTextWidth = pageSpan?.offsetWidth;
|
|
783
|
-
if (this.pagerDimensions.pageSizesWidth && this.pagerDimensions.sizesTextWidth) {
|
|
784
|
-
this.pagerDimensions.pageSizesWidth = this.pagerDimensions.pageSizesWidth - this.pagerDimensions.sizesTextWidth + sizesSpan.offsetWidth;
|
|
785
|
-
}
|
|
786
|
-
this.pagerDimensions.sizesTextWidth = sizesSpan?.offsetWidth;
|
|
787
|
-
this.renderer.removeChild(this.element.nativeElement, measureContainer);
|
|
788
|
-
}
|
|
789
|
-
showNumericButtonsResponsive() {
|
|
790
|
-
if (!isDocumentAvailable() || !this.element?.nativeElement) {
|
|
791
|
-
return;
|
|
792
|
-
}
|
|
793
|
-
const numericButtonsElement = this.numericButtonsElement();
|
|
794
|
-
const hasNumericButtons = this.numericButtons || numericButtonsElement;
|
|
795
|
-
const hasInput = this.pagerInput || this.pagerInputElement();
|
|
796
|
-
if (!this.responsive || (!hasNumericButtons && !hasInput)) {
|
|
797
|
-
this.showInput = this.type === 'input';
|
|
798
|
-
return;
|
|
799
|
-
}
|
|
800
|
-
const pagerInfoElement = this.pagerInfoElement();
|
|
801
|
-
if (this.type === 'input' || !this.isElementVisible(pagerInfoElement)) {
|
|
802
|
-
this.showInput = true;
|
|
803
|
-
return;
|
|
804
|
-
}
|
|
805
|
-
if (this.isElementVisible(numericButtonsElement)) {
|
|
806
|
-
this.showInput = false;
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
const pagerWidth = this.element.nativeElement?.offsetWidth;
|
|
810
|
-
const numericButtonsWrapperElement = this.element.nativeElement.querySelector('.k-pager-numbers-wrap');
|
|
811
|
-
const elementsWidths = numericButtonsWrapperElement?.offsetWidth + this.pagerDimensions.pageSizesWidth + this.pagerDimensions.infoTextWidth + this.pagerDimensions.gapSizesInfo;
|
|
812
|
-
const hasAvailableWidth = pagerWidth > elementsWidths - this.pagerDimensions.inputWidth + this.pagerDimensions.numericButtonsWidth;
|
|
813
|
-
this.showInput = !hasAvailableWidth;
|
|
814
|
-
}
|
|
815
|
-
get showPageSizes() {
|
|
816
|
-
if (typeof this.pageSizeValues === 'boolean') {
|
|
817
|
-
return this.pageSizeValues;
|
|
818
|
-
}
|
|
819
|
-
return this.pageSizeValues?.length > 0;
|
|
820
|
-
}
|
|
821
|
-
setPagerDimensions() {
|
|
822
|
-
this.measureAllTextWidths();
|
|
823
|
-
!this.numericButtons && (this.pagerDimensions.numericButtonsWidth = this.element.nativeElement.querySelector('.k-pager-numbers')?.offsetWidth ?? 0);
|
|
824
|
-
!this.pagerInput && (this.pagerDimensions.inputWidth = this.element.nativeElement.querySelector('kendo-pager-input')?.offsetWidth ?? 0);
|
|
825
|
-
!this.pageSizes && (this.pagerDimensions.pageSizesWidth = this.sizesDropDownElement()?.offsetWidth ?? 0);
|
|
826
|
-
const padding = calculatePadding(this.element.nativeElement);
|
|
827
|
-
this.pagerDimensions.padding = padding.padding;
|
|
828
|
-
this.pagerDimensions.gapNumbersSizes = padding.gapNumbersSizes;
|
|
829
|
-
this.pagerDimensions.gapSizesInfo = padding.gapSizesInfo;
|
|
830
|
-
const innerStyledElement = this.pagerInputElement();
|
|
831
|
-
!this.pagerDimensions.gapPageText && (this.pagerDimensions.gapPageText = calculateGap(innerStyledElement));
|
|
832
|
-
}
|
|
833
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PagerComponent, deps: [{ token: i1.PagerContextService, optional: true, skipSelf: true }, { token: i0.ElementRef }, { token: i2.LocalizationService }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i3.PagerNavigationService, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
834
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: PagerComponent, isStandalone: true, selector: "kendo-datapager, kendo-pager", inputs: { externalTemplate: "externalTemplate", total: "total", skip: "skip", pageSize: "pageSize", buttonCount: "buttonCount", info: "info", type: "type", pageSizeValues: "pageSizeValues", previousNext: "previousNext", navigable: "navigable", size: "size", responsive: "responsive", adaptiveMode: "adaptiveMode" }, outputs: { pageChange: "pageChange", pageSizeChange: "pageSizeChange", pagerInputVisibilityChange: "pagerInputVisibilityChange", pageTextVisibilityChange: "pageTextVisibilityChange", itemsTextVisibilityChange: "itemsTextVisibilityChange" }, host: { listeners: { "focusin": "focusHandler($event)" }, properties: { "class.k-pager": "this.pagerClass", "class.k-pager-responsive": "this.responsiveClass", "attr.role": "this.widgetRole", "attr.aria-roledescription": "this.roleDescription", "attr.aria-keyshortcuts": "this.keyShortcuts", "attr.tabindex": "this.hostTabindex", "attr.dir": "this.dir" } }, providers: [
|
|
835
|
-
LocalizationService,
|
|
836
|
-
PagerContextService,
|
|
837
|
-
PagerNavigationService,
|
|
838
|
-
{
|
|
839
|
-
provide: L10N_PREFIX,
|
|
840
|
-
useValue: 'kendo.pager'
|
|
841
|
-
}
|
|
842
|
-
], queries: [{ propertyName: "template", predicate: PagerTemplateDirective }], viewQueries: [{ propertyName: "numericButtons", first: true, predicate: PagerNumericButtonsComponent, descendants: true, read: ElementRef }, { propertyName: "pagerInput", first: true, predicate: PagerInputComponent, descendants: true, read: ElementRef }, { propertyName: "pagerInputComponent", first: true, predicate: PagerInputComponent, descendants: true }, { propertyName: "pageSizes", first: true, predicate: PagerPageSizesComponent, descendants: true, read: ElementRef }, { propertyName: "pageSizesComponent", first: true, predicate: PagerPageSizesComponent, descendants: true }], exportAs: ["kendoDataPager", "kendoPager"], usesOnChanges: true, ngImport: i0, template: `
|
|
843
|
-
<ng-container kendoPagerLocalizedMessages
|
|
844
|
-
i18n-ariaLabel="kendo.pager.ariaLabel|The value of the aria-label attribute of the Pager"
|
|
845
|
-
ariaLabel="{{ 'Page navigation, page {currentPage} of {totalPages}' }}"
|
|
846
|
-
|
|
847
|
-
i18n-firstPage="kendo.pager.firstPage|The label for the first page button in the Pager"
|
|
848
|
-
firstPage="Go to the first page"
|
|
849
|
-
|
|
850
|
-
i18n-previousPage="kendo.pager.previousPage|The label for the previous page button in the Pager"
|
|
851
|
-
previousPage="Go to the previous page"
|
|
852
|
-
|
|
853
|
-
i18n-nextPage="kendo.pager.nextPage|The label for the next page button in the Pager"
|
|
854
|
-
nextPage="Go to the next page"
|
|
855
|
-
|
|
856
|
-
i18n-lastPage="kendo.pager.lastPage|The label for the last page button in the Pager"
|
|
857
|
-
lastPage="Go to the last page"
|
|
858
|
-
|
|
859
|
-
i18n-page="kendo.pager.page|The label before the current page number in the Pager"
|
|
860
|
-
page="Page"
|
|
861
|
-
|
|
862
|
-
i18n-of="kendo.pager.of|The label before the total pages number in the Pager"
|
|
863
|
-
of="of"
|
|
864
|
-
|
|
865
|
-
i18n-pageNumberInputTitle="kendo.pager.pageNumberInputTitle|The label for the pager input in the Pager"
|
|
866
|
-
pageNumberInputTitle="Page Number"
|
|
867
|
-
|
|
868
|
-
i18n-items="kendo.pager.items|The label after the total pages number in the Pager"
|
|
869
|
-
items="items"
|
|
870
|
-
|
|
871
|
-
i18n-itemsPerPage="kendo.pager.itemsPerPage|The label for the page size chooser in the Pager"
|
|
872
|
-
itemsPerPage="items per page"
|
|
873
|
-
|
|
874
|
-
i18n-selectPage="kendo.pager.selectPage|The text of the title and aria-label attributes applied to the page chooser in the Pager"
|
|
875
|
-
selectPage="Select page"
|
|
876
|
-
|
|
877
|
-
i18n-inputLabel="kendo.pager.inputLabel|The text of the aria-label attribute applied to the input element for entering the page number."
|
|
878
|
-
inputLabel="Type a page number"
|
|
879
|
-
>
|
|
880
|
-
</ng-container>
|
|
881
|
-
@if (template.first?.templateRef) {
|
|
882
|
-
<ng-container
|
|
883
|
-
[ngTemplateOutlet]="template.first?.templateRef"
|
|
884
|
-
[ngTemplateOutletContext]="templateContext">
|
|
885
|
-
</ng-container>
|
|
886
|
-
} @else {
|
|
887
|
-
<div class="k-pager-numbers-wrap" [ngStyle]="{opacity: initialized ? null : '0'}">
|
|
888
|
-
@if (previousNext) {
|
|
889
|
-
<kendo-pager-prev-buttons [size]="size"></kendo-pager-prev-buttons>
|
|
890
|
-
}
|
|
891
|
-
@if (type === 'numeric' && buttonCount > 0) {
|
|
892
|
-
<kendo-pager-numeric-buttons
|
|
893
|
-
[size]="size"
|
|
894
|
-
[buttonCount]="buttonCount">
|
|
895
|
-
</kendo-pager-numeric-buttons>
|
|
896
|
-
}
|
|
897
|
-
@if (showInput) {
|
|
898
|
-
<kendo-pager-input [size]="size"></kendo-pager-input>
|
|
899
|
-
}
|
|
900
|
-
@if (previousNext) {
|
|
901
|
-
<kendo-pager-next-buttons [size]="size"></kendo-pager-next-buttons>
|
|
902
|
-
}
|
|
903
|
-
</div>
|
|
904
|
-
@if (_pageSizeValues.length) {
|
|
905
|
-
<kendo-pager-page-sizes
|
|
906
|
-
[ngStyle]="{opacity: initialized ? null : '0'}"
|
|
907
|
-
[size]="size"
|
|
908
|
-
[pageSizes]="_pageSizeValues"
|
|
909
|
-
[adaptiveMode]="adaptiveMode">
|
|
910
|
-
</kendo-pager-page-sizes>
|
|
911
|
-
}
|
|
912
|
-
@if (info) {
|
|
913
|
-
<kendo-pager-info [ngStyle]="{opacity: initialized ? null : '0'}">
|
|
914
|
-
</kendo-pager-info>
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
@if (responsive) {
|
|
918
|
-
<kendo-resize-sensor (resize)="resizeHandler()"></kendo-resize-sensor>
|
|
919
|
-
}
|
|
920
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoPagerLocalizedMessages]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PagerPrevButtonsComponent, selector: "kendo-datapager-prev-buttons, kendo-pager-prev-buttons", inputs: ["size"] }, { kind: "component", type: PagerNumericButtonsComponent, selector: "kendo-datapager-numeric-buttons, kendo-pager-numeric-buttons", inputs: ["buttonCount", "size"] }, { kind: "component", type: PagerInputComponent, selector: "kendo-datapager-input, kendo-pager-input", inputs: ["showPageText", "size"] }, { kind: "component", type: PagerNextButtonsComponent, selector: "kendo-datapager-next-buttons, kendo-pager-next-buttons", inputs: ["size"] }, { kind: "component", type: PagerPageSizesComponent, selector: "kendo-datapager-page-sizes, kendo-pager-page-sizes", inputs: ["showItemsText", "pageSizes", "size", "adaptiveMode"] }, { kind: "component", type: PagerInfoComponent, selector: "kendo-datapager-info, kendo-pager-info" }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
921
|
-
}
|
|
922
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PagerComponent, decorators: [{
|
|
923
|
-
type: Component,
|
|
924
|
-
args: [{
|
|
925
|
-
selector: 'kendo-datapager, kendo-pager',
|
|
926
|
-
exportAs: 'kendoDataPager, kendoPager',
|
|
927
|
-
providers: [
|
|
928
|
-
LocalizationService,
|
|
929
|
-
PagerContextService,
|
|
930
|
-
PagerNavigationService,
|
|
931
|
-
{
|
|
932
|
-
provide: L10N_PREFIX,
|
|
933
|
-
useValue: 'kendo.pager'
|
|
934
|
-
}
|
|
935
|
-
],
|
|
936
|
-
template: `
|
|
937
|
-
<ng-container kendoPagerLocalizedMessages
|
|
938
|
-
i18n-ariaLabel="kendo.pager.ariaLabel|The value of the aria-label attribute of the Pager"
|
|
939
|
-
ariaLabel="{{ 'Page navigation, page {currentPage} of {totalPages}' }}"
|
|
940
|
-
|
|
941
|
-
i18n-firstPage="kendo.pager.firstPage|The label for the first page button in the Pager"
|
|
942
|
-
firstPage="Go to the first page"
|
|
943
|
-
|
|
944
|
-
i18n-previousPage="kendo.pager.previousPage|The label for the previous page button in the Pager"
|
|
945
|
-
previousPage="Go to the previous page"
|
|
946
|
-
|
|
947
|
-
i18n-nextPage="kendo.pager.nextPage|The label for the next page button in the Pager"
|
|
948
|
-
nextPage="Go to the next page"
|
|
949
|
-
|
|
950
|
-
i18n-lastPage="kendo.pager.lastPage|The label for the last page button in the Pager"
|
|
951
|
-
lastPage="Go to the last page"
|
|
952
|
-
|
|
953
|
-
i18n-page="kendo.pager.page|The label before the current page number in the Pager"
|
|
954
|
-
page="Page"
|
|
955
|
-
|
|
956
|
-
i18n-of="kendo.pager.of|The label before the total pages number in the Pager"
|
|
957
|
-
of="of"
|
|
958
|
-
|
|
959
|
-
i18n-pageNumberInputTitle="kendo.pager.pageNumberInputTitle|The label for the pager input in the Pager"
|
|
960
|
-
pageNumberInputTitle="Page Number"
|
|
961
|
-
|
|
962
|
-
i18n-items="kendo.pager.items|The label after the total pages number in the Pager"
|
|
963
|
-
items="items"
|
|
964
|
-
|
|
965
|
-
i18n-itemsPerPage="kendo.pager.itemsPerPage|The label for the page size chooser in the Pager"
|
|
966
|
-
itemsPerPage="items per page"
|
|
967
|
-
|
|
968
|
-
i18n-selectPage="kendo.pager.selectPage|The text of the title and aria-label attributes applied to the page chooser in the Pager"
|
|
969
|
-
selectPage="Select page"
|
|
970
|
-
|
|
971
|
-
i18n-inputLabel="kendo.pager.inputLabel|The text of the aria-label attribute applied to the input element for entering the page number."
|
|
972
|
-
inputLabel="Type a page number"
|
|
973
|
-
>
|
|
974
|
-
</ng-container>
|
|
975
|
-
@if (template.first?.templateRef) {
|
|
976
|
-
<ng-container
|
|
977
|
-
[ngTemplateOutlet]="template.first?.templateRef"
|
|
978
|
-
[ngTemplateOutletContext]="templateContext">
|
|
979
|
-
</ng-container>
|
|
980
|
-
} @else {
|
|
981
|
-
<div class="k-pager-numbers-wrap" [ngStyle]="{opacity: initialized ? null : '0'}">
|
|
982
|
-
@if (previousNext) {
|
|
983
|
-
<kendo-pager-prev-buttons [size]="size"></kendo-pager-prev-buttons>
|
|
984
|
-
}
|
|
985
|
-
@if (type === 'numeric' && buttonCount > 0) {
|
|
986
|
-
<kendo-pager-numeric-buttons
|
|
987
|
-
[size]="size"
|
|
988
|
-
[buttonCount]="buttonCount">
|
|
989
|
-
</kendo-pager-numeric-buttons>
|
|
990
|
-
}
|
|
991
|
-
@if (showInput) {
|
|
992
|
-
<kendo-pager-input [size]="size"></kendo-pager-input>
|
|
993
|
-
}
|
|
994
|
-
@if (previousNext) {
|
|
995
|
-
<kendo-pager-next-buttons [size]="size"></kendo-pager-next-buttons>
|
|
996
|
-
}
|
|
997
|
-
</div>
|
|
998
|
-
@if (_pageSizeValues.length) {
|
|
999
|
-
<kendo-pager-page-sizes
|
|
1000
|
-
[ngStyle]="{opacity: initialized ? null : '0'}"
|
|
1001
|
-
[size]="size"
|
|
1002
|
-
[pageSizes]="_pageSizeValues"
|
|
1003
|
-
[adaptiveMode]="adaptiveMode">
|
|
1004
|
-
</kendo-pager-page-sizes>
|
|
1005
|
-
}
|
|
1006
|
-
@if (info) {
|
|
1007
|
-
<kendo-pager-info [ngStyle]="{opacity: initialized ? null : '0'}">
|
|
1008
|
-
</kendo-pager-info>
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
@if (responsive) {
|
|
1012
|
-
<kendo-resize-sensor (resize)="resizeHandler()"></kendo-resize-sensor>
|
|
1013
|
-
}
|
|
1014
|
-
`,
|
|
1015
|
-
standalone: true,
|
|
1016
|
-
imports: [LocalizedMessagesDirective, NgTemplateOutlet, PagerPrevButtonsComponent, PagerNumericButtonsComponent, PagerInputComponent, PagerNextButtonsComponent, PagerPageSizesComponent, PagerInfoComponent, ResizeSensorComponent, NgStyle]
|
|
1017
|
-
}]
|
|
1018
|
-
}], ctorParameters: () => [{ type: i1.PagerContextService, decorators: [{
|
|
1019
|
-
type: Optional
|
|
1020
|
-
}, {
|
|
1021
|
-
type: SkipSelf
|
|
1022
|
-
}] }, { type: i0.ElementRef }, { type: i2.LocalizationService }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i3.PagerNavigationService, decorators: [{
|
|
1023
|
-
type: Optional
|
|
1024
|
-
}, {
|
|
1025
|
-
type: SkipSelf
|
|
1026
|
-
}] }], propDecorators: { template: [{
|
|
1027
|
-
type: ContentChildren,
|
|
1028
|
-
args: [PagerTemplateDirective]
|
|
1029
|
-
}], numericButtons: [{
|
|
1030
|
-
type: ViewChild,
|
|
1031
|
-
args: [PagerNumericButtonsComponent, { read: ElementRef }]
|
|
1032
|
-
}], pagerInput: [{
|
|
1033
|
-
type: ViewChild,
|
|
1034
|
-
args: [PagerInputComponent, { read: ElementRef }]
|
|
1035
|
-
}], pagerInputComponent: [{
|
|
1036
|
-
type: ViewChild,
|
|
1037
|
-
args: [PagerInputComponent]
|
|
1038
|
-
}], pageSizes: [{
|
|
1039
|
-
type: ViewChild,
|
|
1040
|
-
args: [PagerPageSizesComponent, { read: ElementRef }]
|
|
1041
|
-
}], pageSizesComponent: [{
|
|
1042
|
-
type: ViewChild,
|
|
1043
|
-
args: [PagerPageSizesComponent]
|
|
1044
|
-
}], externalTemplate: [{
|
|
1045
|
-
type: Input
|
|
1046
|
-
}], total: [{
|
|
1047
|
-
type: Input
|
|
1048
|
-
}], skip: [{
|
|
1049
|
-
type: Input
|
|
1050
|
-
}], pageSize: [{
|
|
1051
|
-
type: Input
|
|
1052
|
-
}], buttonCount: [{
|
|
1053
|
-
type: Input
|
|
1054
|
-
}], info: [{
|
|
1055
|
-
type: Input
|
|
1056
|
-
}], type: [{
|
|
1057
|
-
type: Input
|
|
1058
|
-
}], pageSizeValues: [{
|
|
1059
|
-
type: Input
|
|
1060
|
-
}], previousNext: [{
|
|
1061
|
-
type: Input
|
|
1062
|
-
}], navigable: [{
|
|
1063
|
-
type: Input
|
|
1064
|
-
}], size: [{
|
|
1065
|
-
type: Input
|
|
1066
|
-
}], responsive: [{
|
|
1067
|
-
type: Input
|
|
1068
|
-
}], adaptiveMode: [{
|
|
1069
|
-
type: Input
|
|
1070
|
-
}], pageChange: [{
|
|
1071
|
-
type: Output
|
|
1072
|
-
}], pageSizeChange: [{
|
|
1073
|
-
type: Output
|
|
1074
|
-
}], pagerInputVisibilityChange: [{
|
|
1075
|
-
type: Output
|
|
1076
|
-
}], pageTextVisibilityChange: [{
|
|
1077
|
-
type: Output
|
|
1078
|
-
}], itemsTextVisibilityChange: [{
|
|
1079
|
-
type: Output
|
|
1080
|
-
}], pagerClass: [{
|
|
1081
|
-
type: HostBinding,
|
|
1082
|
-
args: ['class.k-pager']
|
|
1083
|
-
}], responsiveClass: [{
|
|
1084
|
-
type: HostBinding,
|
|
1085
|
-
args: ['class.k-pager-responsive']
|
|
1086
|
-
}], widgetRole: [{
|
|
1087
|
-
type: HostBinding,
|
|
1088
|
-
args: ['attr.role']
|
|
1089
|
-
}], roleDescription: [{
|
|
1090
|
-
type: HostBinding,
|
|
1091
|
-
args: ['attr.aria-roledescription']
|
|
1092
|
-
}], keyShortcuts: [{
|
|
1093
|
-
type: HostBinding,
|
|
1094
|
-
args: ['attr.aria-keyshortcuts']
|
|
1095
|
-
}], hostTabindex: [{
|
|
1096
|
-
type: HostBinding,
|
|
1097
|
-
args: ['attr.tabindex']
|
|
1098
|
-
}], dir: [{
|
|
1099
|
-
type: HostBinding,
|
|
1100
|
-
args: ['attr.dir']
|
|
1101
|
-
}], focusHandler: [{
|
|
1102
|
-
type: HostListener,
|
|
1103
|
-
args: ['focusin', ['$event']]
|
|
1104
|
-
}] } });
|