@progress/kendo-angular-listview 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 (37) hide show
  1. package/fesm2022/progress-kendo-angular-listview.mjs +52 -52
  2. package/package.json +13 -21
  3. package/schematics/ngAdd/index.js +6 -6
  4. package/esm2022/data-binding/data-binding.directive.mjs +0 -86
  5. package/esm2022/directives.mjs +0 -33
  6. package/esm2022/editing/commands/add-command.directive.mjs +0 -90
  7. package/esm2022/editing/commands/cancel-command.directive.mjs +0 -107
  8. package/esm2022/editing/commands/edit-command.directive.mjs +0 -94
  9. package/esm2022/editing/commands/remove-command.directive.mjs +0 -94
  10. package/esm2022/editing/commands/save-command.directive.mjs +0 -107
  11. package/esm2022/editing/edit-template.directive.mjs +0 -53
  12. package/esm2022/editing/edit.service.mjs +0 -119
  13. package/esm2022/editing/events/add-event-args.interface.mjs +0 -5
  14. package/esm2022/editing/events/cancel-event-args.interface.mjs +0 -5
  15. package/esm2022/editing/events/edit-event-args.interface.mjs +0 -5
  16. package/esm2022/editing/events/remove-event-args.interface.mjs +0 -5
  17. package/esm2022/editing/events/save-event-args.interface.mjs +0 -5
  18. package/esm2022/index.mjs +0 -19
  19. package/esm2022/listview.component.mjs +0 -880
  20. package/esm2022/listview.module.mjs +0 -64
  21. package/esm2022/models/listview-data-result.mjs +0 -5
  22. package/esm2022/models/page-change-event.mjs +0 -5
  23. package/esm2022/models/page-size-change-event.mjs +0 -11
  24. package/esm2022/models/page-size-item.mjs +0 -5
  25. package/esm2022/models/pager-position.mjs +0 -5
  26. package/esm2022/models/pager-settings.mjs +0 -5
  27. package/esm2022/models/pager-type.mjs +0 -5
  28. package/esm2022/models/scroll-bottom-event.mjs +0 -5
  29. package/esm2022/navigation/listview-navigable-item.directive.mjs +0 -76
  30. package/esm2022/navigation/navigation.service.mjs +0 -159
  31. package/esm2022/package-metadata.mjs +0 -16
  32. package/esm2022/progress-kendo-angular-listview.mjs +0 -8
  33. package/esm2022/templates/footer-template.directive.mjs +0 -42
  34. package/esm2022/templates/header-template.directive.mjs +0 -43
  35. package/esm2022/templates/item-template.directive.mjs +0 -49
  36. package/esm2022/templates/loader-template.directive.mjs +0 -43
  37. package/esm2022/utils.mjs +0 -103
@@ -1,880 +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, HostBinding, Input, Output, ContentChild, ChangeDetectionStrategy, EventEmitter, NgZone, Renderer2, ElementRef, ViewChild, ViewChildren, QueryList, ChangeDetectorRef } from '@angular/core';
6
- import { EventsOutsideAngularDirective, hasObservers, isChanged } from '@progress/kendo-angular-common';
7
- import { validatePackage } from '@progress/kendo-licensing';
8
- import { packageMetadata } from './package-metadata';
9
- import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
10
- import { NavigationService } from './navigation/navigation.service';
11
- import { ListViewNavigableItemDirective } from './navigation/listview-navigable-item.directive';
12
- import { ItemTemplateDirective } from './templates/item-template.directive';
13
- import { HeaderTemplateDirective } from './templates/header-template.directive';
14
- import { FooterTemplateDirective } from './templates/footer-template.directive';
15
- import { LoaderTemplateDirective } from './templates/loader-template.directive';
16
- import { EditTemplateDirective } from './editing/edit-template.directive';
17
- import { EditService } from './editing/edit.service';
18
- import { isPresent } from './utils';
19
- import { FormGroup, FormControl } from '@angular/forms';
20
- import { NgTemplateOutlet, NgClass, NgStyle } from '@angular/common';
21
- import { PagerComponent } from '@progress/kendo-angular-pager';
22
- import * as i0 from "@angular/core";
23
- import * as i1 from "./editing/edit.service";
24
- import * as i2 from "./navigation/navigation.service";
25
- const DEFAULT_PAGER_SETTINGS = {
26
- position: 'bottom',
27
- buttonCount: 5,
28
- info: true,
29
- previousNext: true,
30
- type: 'numeric',
31
- pageSizeValues: [5, 10, 20]
32
- };
33
- const createControl = (source) => (acc, key) => {
34
- acc[key] = new FormControl(source[key]);
35
- return acc;
36
- };
37
- /**
38
- * Represents the Kendo UI ListView component for Angular.
39
- * Displays a list of data items and supports paging, editing, and custom templates
40
- * ([see overview]({% slug overview_listview %})).
41
- *
42
- * @example
43
- * ```typescript
44
- * @Component({
45
- * selector: 'my-app',
46
- * template: `
47
- * <kendo-listview
48
- * [data]="items"
49
- * [pageable]="true"
50
- * [pageSize]="5">
51
- * <ng-template kendoListViewItemTemplate let-dataItem>
52
- * <div class="item">
53
- * <h3>{{ dataItem.name }}</h3>
54
- * <p>{{ dataItem.description }}</p>
55
- * </div>
56
- * </ng-template>
57
- * </kendo-listview>
58
- * `
59
- * })
60
- * export class AppComponent {
61
- * items = [
62
- * { name: 'Item 1', description: 'First item' },
63
- * { name: 'Item 2', description: 'Second item' }
64
- * ];
65
- * }
66
- * ```
67
- */
68
- export class ListViewComponent {
69
- ngZone;
70
- element;
71
- renderer;
72
- changeDetectorRef;
73
- editService;
74
- navigationService;
75
- /**
76
- * @hidden
77
- */
78
- className = true;
79
- /**
80
- * @hidden
81
- */
82
- itemTemplate;
83
- /**
84
- * @hidden
85
- */
86
- headerTemplate;
87
- /**
88
- * @hidden
89
- */
90
- footerTemplate;
91
- /**
92
- * @hidden
93
- */
94
- loaderTemplate;
95
- /**
96
- * @hidden
97
- */
98
- contentContainer;
99
- /**
100
- * @hidden
101
- */
102
- editTemplate;
103
- /**
104
- * @hidden
105
- */
106
- listViewItems;
107
- /**
108
- * Specifies if a border should be rendered around the listview element.
109
- *
110
- * @default false
111
- */
112
- bordered = false;
113
- /**
114
- * Specifies the data collection that populates the ListView
115
- * ([see data binding examples]({% slug paging_listview %})).
116
- */
117
- set data(value) {
118
- this.lastScrollTop = this.contentContainer?.nativeElement.scrollTop ?? 0;
119
- this._data = value;
120
- }
121
- get data() {
122
- return this._data;
123
- }
124
- /**
125
- * Specifies whether the loading indicator of the ListView displays
126
- * ([see example]({% slug paging_listview %}#toc-remote-binding)).
127
- *
128
- * @default false
129
- */
130
- loading = false;
131
- /**
132
- * Specifies the CSS styles that render on the content container element of the ListView.
133
- * Supports the type of values that [`ngStyle`](link:site.data.urls.angular['ngstyleapi']) supports.
134
- */
135
- containerStyle;
136
- /**
137
- * Specifies the CSS styles that render on each item element wrapper of the ListView.
138
- * Supports the type of values that [`ngStyle`](link:site.data.urls.angular['ngstyleapi']) supports.
139
- */
140
- itemStyle;
141
- /**
142
- * Specifies the CSS class that renders on the content container element of the ListView.
143
- * Supports the type of values that [`ngClass`](link:site.data.urls.angular['ngclassapi']) supports.
144
- */
145
- containerClass;
146
- /**
147
- * Specifies the CSS class that renders on each item element wrapper of the ListView.
148
- * Supports the type of values that [`ngClass`](link:site.data.urls.angular['ngclassapi']) supports.
149
- */
150
- itemClass;
151
- /**
152
- * Specifies the content container `aria-label` attribute
153
- * ([see example]({% slug accessibility_listview %}#toc-accessible-names)).
154
- */
155
- containerLabel;
156
- /**
157
- * Specifies the content container `role` attribute
158
- * ([more details]({% slug accessibility_listview %}#toc-wai-aria-support)).
159
- *
160
- * @default 'list'
161
- */
162
- containerRole = 'list';
163
- /**
164
- * Specifies the list item `role` attribute
165
- * ([more details]({% slug accessibility_listview %}#toc-wai-aria-support)).
166
- *
167
- * @default 'listitem'
168
- */
169
- listItemRole = 'listitem';
170
- /**
171
- * Specifies whether keyboard navigation is enabled
172
- * ([see example]({% slug keyboard_navigation_listview %})).
173
- *
174
- * @default true
175
- */
176
- set navigable(navigable) {
177
- if (!navigable && isPresent(this.removeNavigationListeners)) {
178
- this.removeNavigationListeners();
179
- this.removeNavigationListeners = null;
180
- this.navigationService.isEnabled = false;
181
- }
182
- else if (navigable && !isPresent(this.removeNavigationListeners)) {
183
- this.addNavigationListeners();
184
- this.navigationService.isEnabled = true;
185
- }
186
- this._navigable = navigable;
187
- }
188
- get navigable() {
189
- return this._navigable;
190
- }
191
- /**
192
- * Specifies the page size used by the ListView pager
193
- * ([more details]({% slug paging_listview %})).
194
- */
195
- pageSize;
196
- /**
197
- * Defines the number of records to be skipped by the pager
198
- * ([more details]({% slug paging_listview %})).
199
- */
200
- set skip(skip) {
201
- const parsed = parseInt(skip, 10);
202
- const defaultSkipValue = 0;
203
- this._skip = !isNaN(parsed) ? parsed : defaultSkipValue;
204
- }
205
- get skip() {
206
- return this._skip;
207
- }
208
- /**
209
- * Configures whether the ListView renders a pager
210
- * ([more details]({% slug paging_listview %})).
211
- * When you provide a boolean value, it renders a pager with the default settings.
212
- */
213
- set pageable(pageable) {
214
- this._pageable = pageable;
215
- this.pagerSettings = pageable ? Object.assign({}, DEFAULT_PAGER_SETTINGS, pageable) : null;
216
- }
217
- get pageable() {
218
- return this._pageable;
219
- }
220
- /**
221
- * Specifies the height (in pixels) of the ListView component.
222
- * When the content height exceeds the component height, a vertical scrollbar renders.
223
- *
224
- * To set the height of the ListView, you can also use `style.height`. The `style.height`
225
- * option supports units such as `px`, `%`, `em`, `rem`, and others.
226
- */
227
- height;
228
- /**
229
- * Fires when you scroll to the last record on the page
230
- * ([see endless scrolling example]({% slug scrollmodes_listview %}#toc-endless-scrolling)).
231
- */
232
- scrollBottom = new EventEmitter();
233
- /**
234
- * Fires when you change the page or the page size of the ListView
235
- * ([see example]({% slug paging_listview %}#toc-remote-binding)).
236
- * You have to handle the event yourself and page the data.
237
- */
238
- pageChange = new EventEmitter();
239
- /**
240
- * Fires when you change the page size of the ListView. You can prevent this event (`$event.preventDefault()`).
241
- * When not prevented, the `pageChange` event fires subsequently.
242
- */
243
- pageSizeChange = new EventEmitter();
244
- /**
245
- * Fires when you click the **Edit** command button to edit an item
246
- * ([see example]({% slug editing_template_forms_listview %}#toc-editing-records)).
247
- */
248
- edit = new EventEmitter();
249
- /**
250
- * Fires when you click the **Cancel** command button to close an item
251
- * ([see example]({% slug editing_template_forms_listview %}#toc-cancelling-editing)).
252
- */
253
- cancel = new EventEmitter();
254
- /**
255
- * Fires when you click the **Save** command button to save changes in an item
256
- * ([see example]({% slug editing_template_forms_listview %}#toc-saving-records)).
257
- */
258
- save = new EventEmitter();
259
- /**
260
- * Fires when you click the **Remove** command button to remove an item
261
- * ([see example]({% slug editing_template_forms_listview %}#toc-removing-records)).
262
- */
263
- remove = new EventEmitter();
264
- /**
265
- * Fires when you click the **Add** command button to add a new item
266
- * ([see example]({% slug editing_template_forms_listview %}#toc-adding-records)).
267
- */
268
- add = new EventEmitter();
269
- /**
270
- * @hidden
271
- */
272
- pagerSettings;
273
- /**
274
- * @hidden
275
- *
276
- * Gets the data items passed to the ListView.
277
- * If a `ListViewDataResult` is passed, the data value is used. If an array is passed - it's directly used.
278
- */
279
- get items() {
280
- if (!isPresent(this.data)) {
281
- return [];
282
- }
283
- return Array.isArray(this.data) ? this.data : this.data.data;
284
- }
285
- /**
286
- * @hidden
287
- *
288
- * Gets the total number of records passed to the ListView.
289
- * If a `ListViewDataResult` is passed, the total value is used. If an array is passed - its length is used.
290
- */
291
- get total() {
292
- if (!this.pageable) {
293
- return;
294
- }
295
- if (!isPresent(this.data)) {
296
- return 0;
297
- }
298
- return Array.isArray(this.data) ? this.data.length : this.data.total;
299
- }
300
- /**
301
- * @hidden
302
- */
303
- get containerTabindex() {
304
- // workaround for FF, where a scrollable container is focusable even without a tabindex and creates an unwanted tab stop
305
- // https://bugzilla.mozilla.org/show_bug.cgi?id=616594
306
- return this.navigable ? -1 : null;
307
- }
308
- /**
309
- * Gets the current active item index
310
- * ([see example]({% slug keyboard_navigation_listview %}#toc-controlling-the-focus)).
311
- * Returns `null` when keyboard navigation is disabled.
312
- */
313
- get activeIndex() {
314
- return this.navigationService.activeIndex;
315
- }
316
- removeNavigationListeners;
317
- _skip = 0;
318
- _navigable = true;
319
- _pageable;
320
- lastScrollTop;
321
- _data;
322
- editServiceSubscription;
323
- constructor(ngZone, element, renderer, changeDetectorRef, editService, navigationService) {
324
- this.ngZone = ngZone;
325
- this.element = element;
326
- this.renderer = renderer;
327
- this.changeDetectorRef = changeDetectorRef;
328
- this.editService = editService;
329
- this.navigationService = navigationService;
330
- validatePackage(packageMetadata);
331
- this.attachEditHandlers();
332
- }
333
- ngAfterViewInit() {
334
- this.lastScrollTop = this.contentContainer?.nativeElement.scrollTop;
335
- }
336
- ngOnChanges(changes) {
337
- if (isChanged('height', changes, false)) {
338
- this.renderer.setStyle(this.element.nativeElement, 'height', `${this.height}px`);
339
- }
340
- }
341
- ngOnDestroy() {
342
- if (isPresent(this.editServiceSubscription)) {
343
- this.editServiceSubscription.unsubscribe();
344
- }
345
- }
346
- /**
347
- * @hidden
348
- */
349
- templateContext(index) {
350
- return {
351
- "$implicit": this.items[index],
352
- "isLast": index === this.items.length - 1,
353
- "isFirst": index === 0,
354
- "dataItem": this.items[index],
355
- "index": index
356
- };
357
- }
358
- /**
359
- * @hidden
360
- */
361
- editTemplateContext(index) {
362
- const isNew = index === -1;
363
- const group = isNew ? this.editService.newItemGroup : this.editService.editGroup(index);
364
- return {
365
- "$implicit": group,
366
- "formGroup": group,
367
- "dataItem": isNew ? this.editService.newDataItem : this.items[index],
368
- "isNew": isNew,
369
- "index": index
370
- };
371
- }
372
- /**
373
- * Focuses the item at the specified index ([see example]({% slug keyboard_navigation_listview %}#toc-controlling-the-focus)):
374
- * - When you specify no index, the current active index receives focus.
375
- * - When the passed value is below `0`, the first item receives focus.
376
- * - When the passed value is above the last available index, the last item receives focus.
377
- *
378
- * > The `index` parameter is based on the logical structure of the ListView and does not correspond to the data item index&mdash
379
- * > the index `0` corresponds to the first rendered list item. Paging is not taken into account.
380
- * > Also, the `navigable` property must first be set to `true` for the method to work as expected.
381
- */
382
- focus(index) {
383
- const totalRenderedItems = this.listViewItems.length;
384
- this.navigationService.focusIndex(index, totalRenderedItems);
385
- }
386
- /**
387
- * Creates a new item editor ([see example]({% slug editing_template_forms_listview %}#toc-adding-records)).
388
- *
389
- * @param {FormGroup} group - The [`FormGroup`](link:site.data.urls.angular['formgroupapi']) that describes
390
- * the edit form. When called with a data item, it builds the `FormGroup` from the data item fields.
391
- */
392
- addItem(group) {
393
- const isFormGroup = group instanceof FormGroup;
394
- if (!isFormGroup) {
395
- const fields = Object.keys(group).reduce(createControl(group), {});
396
- group = new FormGroup(fields);
397
- }
398
- this.editService.addItem(group);
399
- }
400
- /**
401
- * Switches the specified item to edit mode ([see example]({% slug editing_template_forms_listview %}#toc-editing-records)).
402
- *
403
- * @param index - The item index that switches to edit mode.
404
- * @param group - The [`FormGroup`](link:site.data.urls.angular['formgroupapi'])
405
- * that describes the edit form.
406
- */
407
- editItem(index, group) {
408
- this.editService.editItem(index, group);
409
- this.changeDetectorRef.markForCheck();
410
- }
411
- /**
412
- * Closes the editor for a given item ([see example]({% slug editing_template_forms_listview %}#toc-cancelling-editing)).
413
- *
414
- * @param {number} index - The item index that switches out of the edit mode. When you provide no index, the editor of the new item will close.
415
- */
416
- closeItem(index) {
417
- this.editService.close(index);
418
- this.changeDetectorRef.markForCheck();
419
- }
420
- /**
421
- * @hidden
422
- */
423
- isEdited(index) {
424
- return this.editService.isEdited(index);
425
- }
426
- /**
427
- * @hidden
428
- */
429
- handlePageChange(event) {
430
- this.scrollToContainerTop();
431
- const firstIndex = 0;
432
- this.navigationService.setActiveIndex(firstIndex);
433
- this.pageChange.emit(event);
434
- }
435
- /**
436
- * @hidden
437
- */
438
- handleContentScroll = () => {
439
- if (!hasObservers(this.scrollBottom)) {
440
- return;
441
- }
442
- const THRESHOLD = 2;
443
- const { scrollHeight, scrollTop, clientHeight } = this.contentContainer.nativeElement;
444
- const isScrollUp = this.lastScrollTop > scrollTop;
445
- this.lastScrollTop = scrollTop;
446
- if (isScrollUp) {
447
- return;
448
- }
449
- const atBottom = scrollHeight - clientHeight - scrollTop <= THRESHOLD;
450
- if (atBottom) {
451
- this.ngZone.run(() => {
452
- const event = { sender: this };
453
- this.scrollBottom.emit(event);
454
- });
455
- }
456
- };
457
- /**
458
- * @hidden
459
- */
460
- itemPosInSet(index) {
461
- if (!this.pageable) {
462
- return;
463
- }
464
- // adds 1 as the aria-posinset is not zero-based and the counting starts from 1
465
- return this.skip + index + 1;
466
- }
467
- scrollToContainerTop() {
468
- const container = this.contentContainer.nativeElement;
469
- container.scrollTop = 0;
470
- container.scrollLeft = 0;
471
- }
472
- addNavigationListeners() {
473
- this.ngZone.runOutsideAngular(() => {
474
- const removeKeydownListener = this.renderer.listen(this.contentContainer.nativeElement, 'keydown', event => this.navigationService.handleKeyDown(event, this.listViewItems.length));
475
- const removeFocusInListener = this.renderer.listen(this.contentContainer.nativeElement, 'focusin', event => this.navigationService.handleFocusIn(event));
476
- const removeFocusOutListener = this.renderer.listen(this.contentContainer.nativeElement, 'focusout', event => this.navigationService.handleFocusOut(event));
477
- this.removeNavigationListeners = () => {
478
- removeKeydownListener();
479
- removeFocusInListener();
480
- removeFocusOutListener();
481
- };
482
- });
483
- }
484
- attachEditHandlers() {
485
- if (!isPresent(this.editService)) {
486
- return;
487
- }
488
- this.editServiceSubscription = this.editService
489
- .changes.subscribe(this.emitCRUDEvent.bind(this));
490
- }
491
- emitCRUDEvent(args) {
492
- const { action, itemIndex, formGroup } = args;
493
- let dataItem = this.items[itemIndex];
494
- if (action !== 'add' && formGroup) {
495
- dataItem = formGroup.value;
496
- }
497
- Object.assign(args, {
498
- dataItem: dataItem,
499
- sender: this
500
- });
501
- this[action].emit(args);
502
- }
503
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListViewComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.EditService }, { token: i2.NavigationService }], target: i0.ɵɵFactoryTarget.Component });
504
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: ListViewComponent, isStandalone: true, selector: "kendo-listview", inputs: { bordered: "bordered", data: "data", loading: "loading", containerStyle: "containerStyle", itemStyle: "itemStyle", containerClass: "containerClass", itemClass: "itemClass", containerLabel: "containerLabel", containerRole: "containerRole", listItemRole: "listItemRole", navigable: "navigable", pageSize: "pageSize", skip: "skip", pageable: "pageable", height: "height" }, outputs: { scrollBottom: "scrollBottom", pageChange: "pageChange", pageSizeChange: "pageSizeChange", edit: "edit", cancel: "cancel", save: "save", remove: "remove", add: "add" }, host: { properties: { "class.k-listview": "this.className", "class.k-listview-bordered": "this.bordered" } }, providers: [
505
- EditService,
506
- NavigationService,
507
- LocalizationService,
508
- {
509
- provide: L10N_PREFIX,
510
- useValue: 'kendo.listview'
511
- }
512
- ], queries: [{ propertyName: "itemTemplate", first: true, predicate: ItemTemplateDirective, descendants: true }, { propertyName: "headerTemplate", first: true, predicate: HeaderTemplateDirective, descendants: true }, { propertyName: "footerTemplate", first: true, predicate: FooterTemplateDirective, descendants: true }, { propertyName: "loaderTemplate", first: true, predicate: LoaderTemplateDirective, descendants: true }, { propertyName: "editTemplate", first: true, predicate: EditTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "contentContainer", first: true, predicate: ["contentContainer"], descendants: true, static: true }, { propertyName: "listViewItems", predicate: ListViewNavigableItemDirective, descendants: true }], exportAs: ["kendoListView"], usesOnChanges: true, ngImport: i0, template: `
513
- <!-- top pager -->
514
- @if (pagerSettings?.position !== 'bottom') {
515
- <ng-template
516
- [ngTemplateOutlet]="pagerTemplate"
517
- [ngTemplateOutletContext]="{ pagerClass: 'k-listview-pager k-listview-pager-top' }"
518
- >
519
- </ng-template>
520
- }
521
-
522
- <!-- header -->
523
- @if (headerTemplate) {
524
- <div
525
- class="k-listview-header"
526
- >
527
- <ng-template
528
- [ngTemplateOutlet]="headerTemplate?.templateRef"
529
- >
530
- </ng-template>
531
- </div>
532
- }
533
-
534
- <!-- content -->
535
- <div
536
- #contentContainer
537
- [attr.tabindex]="containerTabindex"
538
- class="k-listview-content"
539
- [ngClass]="containerClass"
540
- [ngStyle]="containerStyle"
541
- [kendoEventsOutsideAngular]="{
542
- scroll: handleContentScroll
543
- }"
544
- [scope]="this"
545
- [attr.role]="containerRole"
546
- [attr.aria-label]="containerLabel"
547
- >
548
- <!-- new item edit template -->
549
- @if (editService.hasNewItem) {
550
- <div
551
- class="k-listview-item"
552
- [attr.role]="listItemRole"
553
- kendoListViewNavigableItem
554
- [index]="-1"
555
- [attr.data-kendo-listview-item-index]="-1"
556
- [ngClass]="itemClass"
557
- [ngStyle]="itemStyle"
558
- >
559
- @if (editTemplate) {
560
- <ng-template
561
- [ngTemplateOutlet]="editTemplate?.templateRef"
562
- [ngTemplateOutletContext]="editTemplateContext(-1)"
563
- >
564
- </ng-template>
565
- }
566
- </div>
567
- }
568
-
569
- <!-- items -->
570
- @for (dataItem of items; track dataItem; let index = $index; let first = $first; let last = $last) {
571
- <div
572
- class="k-listview-item"
573
- [attr.role]="listItemRole"
574
- [attr.aria-posinset]="itemPosInSet(index)"
575
- [attr.aria-setsize]="total"
576
- kendoListViewNavigableItem
577
- [index]="index"
578
- [attr.data-kendo-listview-item-index]="index"
579
- [ngClass]="itemClass"
580
- [ngStyle]="itemStyle"
581
- >
582
- <ng-template
583
- [ngTemplateOutlet]="isEdited(index) ? editTemplate?.templateRef : itemTemplate?.templateRef"
584
- [ngTemplateOutletContext]="isEdited(index) ? editTemplateContext(index) : templateContext(index)"
585
- >
586
- </ng-template>
587
- </div>
588
- }
589
- </div>
590
-
591
- <!-- loading indicator -->
592
- @if (loading && !loaderTemplate) {
593
- <div
594
- class="k-loading-mask"
595
- >
596
- <!-- TODO: the k-loading-text is hidden with css but read by readers - review when implementing accessibility + possible localization case -->
597
- <span class="k-loading-text">Loading</span>
598
- <div class="k-loading-image"></div>
599
- <div class="k-loading-color"></div>
600
- </div>
601
- }
602
- @if (loading && loaderTemplate) {
603
- <ng-template
604
- [ngTemplateOutlet]="loaderTemplate.templateRef"
605
- >
606
- </ng-template>
607
- }
608
-
609
- <!-- footer -->
610
- @if (footerTemplate) {
611
- <div
612
- class="k-listview-footer"
613
- >
614
- <ng-template
615
- [ngTemplateOutlet]="footerTemplate?.templateRef"
616
- >
617
- </ng-template>
618
- </div>
619
- }
620
-
621
- <!-- bottom pager -->
622
- @if (pagerSettings?.position !== 'top') {
623
- <ng-template
624
- [ngTemplateOutlet]="pagerTemplate"
625
- [ngTemplateOutletContext]="{ pagerClass: 'k-listview-pager' }"
626
- >
627
- </ng-template>
628
- }
629
-
630
- <!-- pager template -->
631
- <ng-template #pagerTemplate let-pagerClass="pagerClass">
632
- @if (pageable) {
633
- <kendo-datapager
634
- [class]="pagerClass"
635
- [total]="total"
636
- [pageSize]="pageSize"
637
- [skip]="skip"
638
- [buttonCount]="pagerSettings.buttonCount"
639
- [info]="pagerSettings.info"
640
- [previousNext]="pagerSettings.previousNext"
641
- [type]="pagerSettings.type"
642
- [pageSizeValues]="pagerSettings.pageSizeValues"
643
- (pageChange)="handlePageChange($event)"
644
- (pageSizeChange)="pageSizeChange.emit($event)"
645
- >
646
- </kendo-datapager>
647
- }
648
- </ng-template>
649
- `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { kind: "directive", type: ListViewNavigableItemDirective, selector: "[kendoListViewNavigableItem]", inputs: ["index"] }, { kind: "component", type: PagerComponent, selector: "kendo-datapager, kendo-pager", inputs: ["externalTemplate", "total", "skip", "pageSize", "buttonCount", "info", "type", "pageSizeValues", "previousNext", "navigable", "size", "responsive", "adaptiveMode"], outputs: ["pageChange", "pageSizeChange", "pagerInputVisibilityChange", "pageTextVisibilityChange", "itemsTextVisibilityChange"], exportAs: ["kendoDataPager", "kendoPager"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
650
- }
651
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListViewComponent, decorators: [{
652
- type: Component,
653
- args: [{
654
- changeDetection: ChangeDetectionStrategy.OnPush,
655
- exportAs: 'kendoListView',
656
- selector: 'kendo-listview',
657
- providers: [
658
- EditService,
659
- NavigationService,
660
- LocalizationService,
661
- {
662
- provide: L10N_PREFIX,
663
- useValue: 'kendo.listview'
664
- }
665
- ],
666
- template: `
667
- <!-- top pager -->
668
- @if (pagerSettings?.position !== 'bottom') {
669
- <ng-template
670
- [ngTemplateOutlet]="pagerTemplate"
671
- [ngTemplateOutletContext]="{ pagerClass: 'k-listview-pager k-listview-pager-top' }"
672
- >
673
- </ng-template>
674
- }
675
-
676
- <!-- header -->
677
- @if (headerTemplate) {
678
- <div
679
- class="k-listview-header"
680
- >
681
- <ng-template
682
- [ngTemplateOutlet]="headerTemplate?.templateRef"
683
- >
684
- </ng-template>
685
- </div>
686
- }
687
-
688
- <!-- content -->
689
- <div
690
- #contentContainer
691
- [attr.tabindex]="containerTabindex"
692
- class="k-listview-content"
693
- [ngClass]="containerClass"
694
- [ngStyle]="containerStyle"
695
- [kendoEventsOutsideAngular]="{
696
- scroll: handleContentScroll
697
- }"
698
- [scope]="this"
699
- [attr.role]="containerRole"
700
- [attr.aria-label]="containerLabel"
701
- >
702
- <!-- new item edit template -->
703
- @if (editService.hasNewItem) {
704
- <div
705
- class="k-listview-item"
706
- [attr.role]="listItemRole"
707
- kendoListViewNavigableItem
708
- [index]="-1"
709
- [attr.data-kendo-listview-item-index]="-1"
710
- [ngClass]="itemClass"
711
- [ngStyle]="itemStyle"
712
- >
713
- @if (editTemplate) {
714
- <ng-template
715
- [ngTemplateOutlet]="editTemplate?.templateRef"
716
- [ngTemplateOutletContext]="editTemplateContext(-1)"
717
- >
718
- </ng-template>
719
- }
720
- </div>
721
- }
722
-
723
- <!-- items -->
724
- @for (dataItem of items; track dataItem; let index = $index; let first = $first; let last = $last) {
725
- <div
726
- class="k-listview-item"
727
- [attr.role]="listItemRole"
728
- [attr.aria-posinset]="itemPosInSet(index)"
729
- [attr.aria-setsize]="total"
730
- kendoListViewNavigableItem
731
- [index]="index"
732
- [attr.data-kendo-listview-item-index]="index"
733
- [ngClass]="itemClass"
734
- [ngStyle]="itemStyle"
735
- >
736
- <ng-template
737
- [ngTemplateOutlet]="isEdited(index) ? editTemplate?.templateRef : itemTemplate?.templateRef"
738
- [ngTemplateOutletContext]="isEdited(index) ? editTemplateContext(index) : templateContext(index)"
739
- >
740
- </ng-template>
741
- </div>
742
- }
743
- </div>
744
-
745
- <!-- loading indicator -->
746
- @if (loading && !loaderTemplate) {
747
- <div
748
- class="k-loading-mask"
749
- >
750
- <!-- TODO: the k-loading-text is hidden with css but read by readers - review when implementing accessibility + possible localization case -->
751
- <span class="k-loading-text">Loading</span>
752
- <div class="k-loading-image"></div>
753
- <div class="k-loading-color"></div>
754
- </div>
755
- }
756
- @if (loading && loaderTemplate) {
757
- <ng-template
758
- [ngTemplateOutlet]="loaderTemplate.templateRef"
759
- >
760
- </ng-template>
761
- }
762
-
763
- <!-- footer -->
764
- @if (footerTemplate) {
765
- <div
766
- class="k-listview-footer"
767
- >
768
- <ng-template
769
- [ngTemplateOutlet]="footerTemplate?.templateRef"
770
- >
771
- </ng-template>
772
- </div>
773
- }
774
-
775
- <!-- bottom pager -->
776
- @if (pagerSettings?.position !== 'top') {
777
- <ng-template
778
- [ngTemplateOutlet]="pagerTemplate"
779
- [ngTemplateOutletContext]="{ pagerClass: 'k-listview-pager' }"
780
- >
781
- </ng-template>
782
- }
783
-
784
- <!-- pager template -->
785
- <ng-template #pagerTemplate let-pagerClass="pagerClass">
786
- @if (pageable) {
787
- <kendo-datapager
788
- [class]="pagerClass"
789
- [total]="total"
790
- [pageSize]="pageSize"
791
- [skip]="skip"
792
- [buttonCount]="pagerSettings.buttonCount"
793
- [info]="pagerSettings.info"
794
- [previousNext]="pagerSettings.previousNext"
795
- [type]="pagerSettings.type"
796
- [pageSizeValues]="pagerSettings.pageSizeValues"
797
- (pageChange)="handlePageChange($event)"
798
- (pageSizeChange)="pageSizeChange.emit($event)"
799
- >
800
- </kendo-datapager>
801
- }
802
- </ng-template>
803
- `,
804
- standalone: true,
805
- imports: [NgTemplateOutlet, NgClass, NgStyle, EventsOutsideAngularDirective, ListViewNavigableItemDirective, PagerComponent]
806
- }]
807
- }], ctorParameters: () => [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.EditService }, { type: i2.NavigationService }], propDecorators: { className: [{
808
- type: HostBinding,
809
- args: ['class.k-listview']
810
- }], itemTemplate: [{
811
- type: ContentChild,
812
- args: [ItemTemplateDirective, { static: false }]
813
- }], headerTemplate: [{
814
- type: ContentChild,
815
- args: [HeaderTemplateDirective, { static: false }]
816
- }], footerTemplate: [{
817
- type: ContentChild,
818
- args: [FooterTemplateDirective, { static: false }]
819
- }], loaderTemplate: [{
820
- type: ContentChild,
821
- args: [LoaderTemplateDirective, { static: false }]
822
- }], contentContainer: [{
823
- type: ViewChild,
824
- args: ['contentContainer', { static: true }]
825
- }], editTemplate: [{
826
- type: ContentChild,
827
- args: [EditTemplateDirective, { static: false }]
828
- }], listViewItems: [{
829
- type: ViewChildren,
830
- args: [ListViewNavigableItemDirective]
831
- }], bordered: [{
832
- type: Input
833
- }, {
834
- type: HostBinding,
835
- args: ['class.k-listview-bordered']
836
- }], data: [{
837
- type: Input
838
- }], loading: [{
839
- type: Input
840
- }], containerStyle: [{
841
- type: Input
842
- }], itemStyle: [{
843
- type: Input
844
- }], containerClass: [{
845
- type: Input
846
- }], itemClass: [{
847
- type: Input
848
- }], containerLabel: [{
849
- type: Input
850
- }], containerRole: [{
851
- type: Input
852
- }], listItemRole: [{
853
- type: Input
854
- }], navigable: [{
855
- type: Input
856
- }], pageSize: [{
857
- type: Input
858
- }], skip: [{
859
- type: Input
860
- }], pageable: [{
861
- type: Input
862
- }], height: [{
863
- type: Input
864
- }], scrollBottom: [{
865
- type: Output
866
- }], pageChange: [{
867
- type: Output
868
- }], pageSizeChange: [{
869
- type: Output
870
- }], edit: [{
871
- type: Output
872
- }], cancel: [{
873
- type: Output
874
- }], save: [{
875
- type: Output
876
- }], remove: [{
877
- type: Output
878
- }], add: [{
879
- type: Output
880
- }] } });