@progress/kendo-angular-listview 4.0.4 → 11.0.0-develop.80

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 (83) hide show
  1. package/NOTICE.txt +3 -3
  2. package/data-binding/data-binding.directive.d.ts +1 -1
  3. package/editing/commands/add-command.directive.d.ts +2 -2
  4. package/editing/commands/cancel-command.directive.d.ts +2 -2
  5. package/editing/commands/edit-command.directive.d.ts +2 -2
  6. package/editing/commands/remove-command.directive.d.ts +2 -2
  7. package/editing/commands/save-command.directive.d.ts +2 -2
  8. package/editing/edit-template.directive.d.ts +1 -1
  9. package/editing/edit.service.d.ts +1 -1
  10. package/editing/events/add-event-args.interface.d.ts +1 -1
  11. package/editing/events/cancel-event-args.interface.d.ts +2 -3
  12. package/editing/events/edit-event-args.interface.d.ts +1 -1
  13. package/editing/events/remove-event-args.interface.d.ts +1 -1
  14. package/editing/events/save-event-args.interface.d.ts +1 -1
  15. package/{esm2015/data-binding/data-binding.directive.js → esm2020/data-binding/data-binding.directive.mjs} +5 -4
  16. package/{esm2015/editing/commands/add-command.directive.js → esm2020/editing/commands/add-command.directive.mjs} +34 -7
  17. package/{esm2015/editing/commands/cancel-command.directive.js → esm2020/editing/commands/cancel-command.directive.mjs} +34 -7
  18. package/{esm2015/editing/commands/edit-command.directive.js → esm2020/editing/commands/edit-command.directive.mjs} +34 -7
  19. package/{esm2015/editing/commands/remove-command.directive.js → esm2020/editing/commands/remove-command.directive.mjs} +34 -7
  20. package/{esm2015/editing/commands/save-command.directive.js → esm2020/editing/commands/save-command.directive.mjs} +34 -7
  21. package/{esm2015/editing/edit-template.directive.js → esm2020/editing/edit-template.directive.mjs} +5 -5
  22. package/{esm2015/editing/edit.service.js → esm2020/editing/edit.service.mjs} +5 -5
  23. package/{esm2015/editing/events/add-event-args.interface.js → esm2020/editing/events/add-event-args.interface.mjs} +1 -1
  24. package/{esm2015/editing/events/cancel-event-args.interface.js → esm2020/editing/events/cancel-event-args.interface.mjs} +1 -1
  25. package/{esm2015/editing/events/edit-event-args.interface.js → esm2020/editing/events/edit-event-args.interface.mjs} +1 -1
  26. package/{esm2015/editing/events/remove-event-args.interface.js → esm2020/editing/events/remove-event-args.interface.mjs} +1 -1
  27. package/esm2020/editing/events/save-event-args.interface.mjs +5 -0
  28. package/{esm2015/main.js → esm2020/index.mjs} +1 -1
  29. package/{esm2015/listview.component.js → esm2020/listview.component.mjs} +6 -9
  30. package/{esm2015/listview.module.js → esm2020/listview.module.mjs} +12 -8
  31. package/esm2020/models/listview-data-result.mjs +5 -0
  32. package/esm2020/models/page-change-event.mjs +5 -0
  33. package/{esm2015/models/page-size-change-event.js → esm2020/models/page-size-change-event.mjs} +1 -1
  34. package/esm2020/models/page-size-item.mjs +5 -0
  35. package/esm2020/models/pager-position.mjs +5 -0
  36. package/esm2020/models/pager-settings.mjs +5 -0
  37. package/esm2020/models/pager-type.mjs +5 -0
  38. package/esm2020/models/scroll-bottom-event.mjs +5 -0
  39. package/{esm2015/navigation/listview-navigable-item.directive.js → esm2020/navigation/listview-navigable-item.directive.mjs} +6 -5
  40. package/{esm2015/navigation/navigation.service.js → esm2020/navigation/navigation.service.mjs} +8 -6
  41. package/{esm2015/package-metadata.js → esm2020/package-metadata.mjs} +3 -3
  42. package/{esm2015/kendo-angular-listview.js → esm2020/progress-kendo-angular-listview.mjs} +2 -2
  43. package/{esm2015/templates/footer-template.directive.js → esm2020/templates/footer-template.directive.mjs} +5 -5
  44. package/{esm2015/templates/header-template.directive.js → esm2020/templates/header-template.directive.mjs} +5 -5
  45. package/{esm2015/templates/item-template.directive.js → esm2020/templates/item-template.directive.mjs} +5 -5
  46. package/{esm2015/templates/loader-template.directive.js → esm2020/templates/loader-template.directive.mjs} +5 -5
  47. package/{esm2015/templates/template-context.directive.js → esm2020/templates/template-context.directive.mjs} +5 -5
  48. package/{esm2015/utils.js → esm2020/utils.mjs} +1 -1
  49. package/fesm2015/progress-kendo-angular-listview.mjs +1801 -0
  50. package/{fesm2015/kendo-angular-listview.js → fesm2020/progress-kendo-angular-listview.mjs} +193 -74
  51. package/{main.d.ts → index.d.ts} +1 -1
  52. package/listview.component.d.ts +1 -1
  53. package/listview.module.d.ts +3 -2
  54. package/models/listview-data-result.d.ts +1 -1
  55. package/models/page-change-event.d.ts +2 -3
  56. package/models/page-size-change-event.d.ts +1 -1
  57. package/models/page-size-item.d.ts +1 -1
  58. package/models/pager-position.d.ts +1 -1
  59. package/models/pager-settings.d.ts +1 -1
  60. package/models/pager-type.d.ts +1 -1
  61. package/models/scroll-bottom-event.d.ts +1 -1
  62. package/navigation/listview-navigable-item.directive.d.ts +1 -1
  63. package/navigation/navigation.service.d.ts +1 -1
  64. package/package-metadata.d.ts +1 -1
  65. package/package.json +33 -60
  66. package/{kendo-angular-listview.d.ts → progress-kendo-angular-listview.d.ts} +2 -2
  67. package/schematics/ngAdd/index.js +4 -6
  68. package/templates/footer-template.directive.d.ts +1 -1
  69. package/templates/header-template.directive.d.ts +1 -1
  70. package/templates/item-template.directive.d.ts +1 -1
  71. package/templates/loader-template.directive.d.ts +1 -1
  72. package/templates/template-context.directive.d.ts +1 -1
  73. package/utils.d.ts +1 -1
  74. package/bundles/kendo-angular-listview.umd.js +0 -5
  75. package/esm2015/editing/events/save-event-args.interface.js +0 -5
  76. package/esm2015/models/listview-data-result.js +0 -5
  77. package/esm2015/models/page-change-event.js +0 -5
  78. package/esm2015/models/page-size-item.js +0 -5
  79. package/esm2015/models/pager-position.js +0 -5
  80. package/esm2015/models/pager-settings.js +0 -5
  81. package/esm2015/models/pager-type.js +0 -5
  82. package/esm2015/models/scroll-bottom-event.js +0 -5
  83. package/schematics/ngAdd/index.js.map +0 -1
@@ -0,0 +1,1801 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2022 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import * as i0 from '@angular/core';
6
+ import { Injectable, Directive, Input, Optional, EventEmitter, Component, ChangeDetectionStrategy, HostBinding, ContentChild, ViewChild, ViewChildren, Output, HostListener, NgModule } from '@angular/core';
7
+ import * as i5 from '@progress/kendo-angular-common';
8
+ import { isDocumentAvailable, Keys, isChanged, hasObservers, EventsModule } from '@progress/kendo-angular-common';
9
+ import { validatePackage } from '@progress/kendo-licensing';
10
+ import * as i2 from '@progress/kendo-angular-l10n';
11
+ import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
12
+ import { Subject, Subscription } from 'rxjs';
13
+ import { FormGroup, FormControl } from '@angular/forms';
14
+ import { switchMap, take } from 'rxjs/operators';
15
+ import * as i3 from '@progress/kendo-angular-pager';
16
+ import { PageSizeChangeEvent as PageSizeChangeEvent$1, PagerModule } from '@progress/kendo-angular-pager';
17
+ import * as i4 from '@angular/common';
18
+ import { CommonModule } from '@angular/common';
19
+ import { Button } from '@progress/kendo-angular-buttons';
20
+ import * as i3$1 from '@progress/kendo-angular-icons';
21
+ import { IconsModule } from '@progress/kendo-angular-icons';
22
+
23
+ /**
24
+ * @hidden
25
+ */
26
+ const packageMetadata = {
27
+ name: '@progress/kendo-angular-listview',
28
+ productName: 'Kendo UI for Angular',
29
+ productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
30
+ publishDate: 1672394793,
31
+ version: '',
32
+ licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
33
+ };
34
+
35
+ const LISTVIEW_ITEM_SELECTOR = '.k-listview-item';
36
+ /**
37
+ * @hidden
38
+ */
39
+ const isPresent = (item) => item !== null && item !== undefined;
40
+ /**
41
+ * @hidden
42
+ */
43
+ const isObject = (item) => isPresent(item) && typeof item === 'object';
44
+ /**
45
+ * @hidden
46
+ *
47
+ * Polyfill for `Element.matches`.
48
+ * https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
49
+ */
50
+ const match = (element, selector) => {
51
+ const matcher = element.matches || element.msMatchesSelector || element.webkitMatchesSelector;
52
+ if (!isPresent(matcher)) {
53
+ return false;
54
+ }
55
+ return matcher.call(element, selector);
56
+ };
57
+ /**
58
+ * @hidden
59
+ *
60
+ * Checks if a target element has the `.k-listview-item` CSS class.
61
+ */
62
+ const isListViewItem = (element) => {
63
+ if (!isPresent(element)) {
64
+ return false;
65
+ }
66
+ return match(element, LISTVIEW_ITEM_SELECTOR);
67
+ };
68
+ /**
69
+ * @hidden
70
+ *
71
+ * Extracts and parses to a number the `data-kendo-listview-item-index` attribute value from the targeted element.
72
+ */
73
+ const getListItemIndex = (item) => {
74
+ if (!isPresent(item)) {
75
+ return null;
76
+ }
77
+ return Number(item.getAttribute('data-kendo-listview-item-index'));
78
+ };
79
+ /**
80
+ * @hidden
81
+ *
82
+ * Gets the new focus target from a blur event.
83
+ * Queries both event.relatedTarget and document.activeElement for compatibility with IE.
84
+ */
85
+ const relatedTarget = (event) => {
86
+ if (!isPresent(event.relatedTarget) || !isDocumentAvailable()) {
87
+ return null;
88
+ }
89
+ return event.relatedTarget || document.activeElement;
90
+ };
91
+ /**
92
+ * @hidden
93
+ *
94
+ * If the given contender number is not defined or lower than the specified min - returns min, if its above the specified max - returns max.
95
+ * If the number is in the given bounds, it is returned.
96
+ */
97
+ const fitIntoRange = (contender, min, max) => {
98
+ if (!isPresent(contender) || contender <= min) {
99
+ return min;
100
+ }
101
+ else if (contender >= max) {
102
+ return max;
103
+ }
104
+ else {
105
+ return contender;
106
+ }
107
+ };
108
+ /**
109
+ * @hidden
110
+ */
111
+ const closestWithMatch = (element, selector) => {
112
+ let parent = element;
113
+ while (parent !== null && parent.nodeType === 1) {
114
+ if (match(parent, selector)) {
115
+ return parent;
116
+ }
117
+ parent = parent.parentElement || parent.parentNode;
118
+ }
119
+ return null;
120
+ };
121
+ /**
122
+ * @hidden
123
+ *
124
+ * Extracts and parses to a number the `data-kendo-listview-item-index` attribute value from the targeted element.
125
+ */
126
+ const getClosestListItemIndex = (element) => {
127
+ if (!isPresent(element)) {
128
+ return null;
129
+ }
130
+ const closestListViewItem = closestWithMatch(element, LISTVIEW_ITEM_SELECTOR);
131
+ return getListItemIndex(closestListViewItem);
132
+ };
133
+
134
+ /**
135
+ * @hidden
136
+ *
137
+ * Provided per ListView instance. Keeps the availability, active index and focused state of the current ListView.
138
+ * Emits `changes` when any of the aforementioned states changes.
139
+ */
140
+ class NavigationService {
141
+ constructor() {
142
+ /**
143
+ * Emits every time a change in active index/focus/blur/navigation availability occurs.
144
+ */
145
+ this.changes = new Subject();
146
+ /**
147
+ * Specifies if a ListView item currently holds focus.
148
+ */
149
+ this.isFocused = false;
150
+ /**
151
+ * Keeps track of the index of the items that should be the current focus target (tabindex="0").
152
+ * When set to `null`/`undefined`, the navigation is disabled and the items should not render a tabindex.
153
+ */
154
+ this.activeIndex = null;
155
+ }
156
+ /**
157
+ * Sets or gets if the navigation is enabled.
158
+ * When no activeIndex is present, the navigation is inferred as disabled.
159
+ * Toggling the service availability clears the current active index or activates the first one.
160
+ */
161
+ get isEnabled() {
162
+ return isPresent(this.activeIndex);
163
+ }
164
+ set isEnabled(enabled) {
165
+ if (enabled) {
166
+ this.activeIndex = 0;
167
+ }
168
+ else {
169
+ this.activeIndex = null;
170
+ }
171
+ this.changes.next();
172
+ }
173
+ /**
174
+ * Shows if the checked index should be the current available focus target (tabindex="0").
175
+ */
176
+ isActive(index) {
177
+ return index === this.activeIndex;
178
+ }
179
+ handleKeyDown(event, totalItemsCount) {
180
+ const { keyCode } = event;
181
+ switch (keyCode) {
182
+ case Keys.ArrowLeft:
183
+ case Keys.ArrowUp:
184
+ this.navigateToPrevious();
185
+ break;
186
+ case Keys.ArrowRight:
187
+ case Keys.ArrowDown:
188
+ this.navigateToNext(totalItemsCount);
189
+ break;
190
+ case Keys.Home: {
191
+ const firstIndex = 0;
192
+ this.navigateTo(firstIndex);
193
+ break;
194
+ }
195
+ case Keys.End: {
196
+ const lastIndex = totalItemsCount - 1;
197
+ this.navigateTo(lastIndex);
198
+ break;
199
+ }
200
+ default: return;
201
+ }
202
+ // the following line is executed only if the pressed key matches one of the listview hotkeys -
203
+ // they `break`, while the `default` case `return`s
204
+ event.preventDefault();
205
+ }
206
+ handleFocusIn(event) {
207
+ const target = event.target;
208
+ if (!isListViewItem(target)) {
209
+ const listViewItemSelector = '.k-listview-item';
210
+ const closestListViewItem = closestWithMatch(target, listViewItemSelector);
211
+ const isListViewItemChild = isPresent(closestListViewItem);
212
+ if (isListViewItemChild) {
213
+ const itemIndex = getListItemIndex(closestListViewItem);
214
+ this.setActiveIndex(itemIndex);
215
+ }
216
+ return;
217
+ }
218
+ const targetIndex = getListItemIndex(target);
219
+ // don't emit if the no change in focused state has occurred and the targeted index is the same as the current activeIndex
220
+ if (this.isFocused && targetIndex === this.activeIndex) {
221
+ return;
222
+ }
223
+ this.activeIndex = targetIndex;
224
+ this.isFocused = true;
225
+ this.changes.next();
226
+ }
227
+ handleFocusOut(event) {
228
+ // don't emit if the blurred item is not a listview item or if the new focus target is another listview item
229
+ if (!isListViewItem(event.target) || isListViewItem(relatedTarget(event))) {
230
+ return;
231
+ }
232
+ this.isFocused = false;
233
+ this.changes.next();
234
+ }
235
+ /**
236
+ * Sets the `activeIndex` and triggers changes without focusing the corresponding ListView item.
237
+ */
238
+ setActiveIndex(index) {
239
+ if (!this.isEnabled) {
240
+ return;
241
+ }
242
+ if (index === this.activeIndex) {
243
+ return;
244
+ }
245
+ this.activeIndex = index;
246
+ this.changes.next();
247
+ }
248
+ /**
249
+ * Focuses item at the targeted index. If no index is passed, the current `activeIndex` is used.
250
+ * The passed target index is normalized to fit the min/max available indices bounds.
251
+ */
252
+ focusIndex(index, totalItemsCount) {
253
+ if (!this.isEnabled) {
254
+ return;
255
+ }
256
+ const parsed = parseInt(index, 10);
257
+ const firstIndex = 0;
258
+ const lastIndex = totalItemsCount - 1;
259
+ const targetIndex = isNaN(parsed) ? this.activeIndex : fitIntoRange(parsed, firstIndex, lastIndex);
260
+ this.navigateTo(targetIndex);
261
+ }
262
+ navigateTo(index) {
263
+ if (this.isFocused && this.activeIndex === index) {
264
+ return;
265
+ }
266
+ this.isFocused = true;
267
+ this.activeIndex = index;
268
+ this.changes.next();
269
+ }
270
+ navigateToPrevious() {
271
+ const previousIndex = Math.max(this.activeIndex - 1, 0);
272
+ this.navigateTo(previousIndex);
273
+ }
274
+ navigateToNext(totalItemsCount) {
275
+ const lastAvailableIndex = totalItemsCount - 1;
276
+ const nextIndex = Math.min(this.activeIndex + 1, lastAvailableIndex);
277
+ this.navigateTo(nextIndex);
278
+ }
279
+ }
280
+ NavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavigationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
281
+ NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavigationService });
282
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavigationService, decorators: [{
283
+ type: Injectable
284
+ }] });
285
+
286
+ /**
287
+ * @hidden
288
+ */
289
+ class ListViewNavigableItemDirective {
290
+ constructor(hostElement, renderer, navigationService) {
291
+ this.hostElement = hostElement;
292
+ this.renderer = renderer;
293
+ this.navigationService = navigationService;
294
+ }
295
+ ngOnChanges() {
296
+ this.updateNavigationState();
297
+ }
298
+ ngOnInit() {
299
+ this.navigationSubscription = this.navigationService.changes
300
+ .subscribe(this.updateNavigationState.bind(this));
301
+ }
302
+ ngOnDestroy() {
303
+ if (isPresent(this.navigationSubscription)) {
304
+ this.navigationSubscription.unsubscribe();
305
+ }
306
+ }
307
+ updateNavigationState() {
308
+ this.updateTabIndex();
309
+ this.updateFocusedState();
310
+ }
311
+ updateFocusedState() {
312
+ const shouldFocus = this.navigationService.isActive(this.index) && this.navigationService.isFocused;
313
+ const focusedCssClass = 'k-focus';
314
+ if (shouldFocus) {
315
+ this.renderer.addClass(this.hostElement.nativeElement, focusedCssClass);
316
+ this.hostElement.nativeElement.focus();
317
+ }
318
+ else {
319
+ this.renderer.removeClass(this.hostElement.nativeElement, focusedCssClass);
320
+ }
321
+ }
322
+ updateTabIndex() {
323
+ if (!this.navigationService.isEnabled) {
324
+ this.renderer.removeAttribute(this.hostElement.nativeElement, 'tabindex');
325
+ }
326
+ else if (this.navigationService.isActive(this.index)) {
327
+ this.renderer.setAttribute(this.hostElement.nativeElement, 'tabindex', '0');
328
+ }
329
+ else {
330
+ this.renderer.setAttribute(this.hostElement.nativeElement, 'tabindex', '-1');
331
+ }
332
+ }
333
+ }
334
+ ListViewNavigableItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ListViewNavigableItemDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Directive });
335
+ ListViewNavigableItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ListViewNavigableItemDirective, selector: "[kendoListViewNavigableItem]", inputs: { index: "index" }, usesOnChanges: true, ngImport: i0 });
336
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ListViewNavigableItemDirective, decorators: [{
337
+ type: Directive,
338
+ args: [{
339
+ selector: '[kendoListViewNavigableItem]'
340
+ }]
341
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: NavigationService }]; }, propDecorators: { index: [{
342
+ type: Input
343
+ }] } });
344
+
345
+ /**
346
+ * Renders the list item content. To define an item template, nest an `<ng-template>` tag
347
+ * with the `kendoListViewItemTemplate` directive inside the `<kendo-listview>` tag
348
+ * [see example]({% slug templates_listview %}#toc-item-template).
349
+ *
350
+ * The following values are available as context variables:
351
+ * - `let-dataItem="dataItem"` (`any`) - The current data item. Also available as implicit context variable.
352
+ * - `let-index="index"` (`number`) - The current item index.
353
+ * - `let-isFirst="isFirst"` (`boolean`) - Indicates whether the current data item will be rendered as the first item on the list.
354
+ * - `let-isLast="isLast"` (`boolean`)- Indicates whether the current data item will be rendered as the last item on the list.
355
+ */
356
+ class ItemTemplateDirective {
357
+ constructor(templateRef) {
358
+ this.templateRef = templateRef;
359
+ }
360
+ }
361
+ ItemTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ItemTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
362
+ ItemTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: ItemTemplateDirective, selector: "[kendoListViewItemTemplate]", ngImport: i0 });
363
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ItemTemplateDirective, decorators: [{
364
+ type: Directive,
365
+ args: [{
366
+ selector: '[kendoListViewItemTemplate]'
367
+ }]
368
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
369
+
370
+ /**
371
+ * Renders the header content of the ListView. To define a header template, nest an `<ng-template>` tag
372
+ * with the `kendoListViewHeaderTemplate` directive inside the `<kendo-listview>` tag
373
+ * [see example]({% slug templates_listview %}#toc-header-template).
374
+ */
375
+ class HeaderTemplateDirective {
376
+ constructor(templateRef) {
377
+ this.templateRef = templateRef;
378
+ }
379
+ }
380
+ HeaderTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: HeaderTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
381
+ HeaderTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: HeaderTemplateDirective, selector: "[kendoListViewHeaderTemplate]", ngImport: i0 });
382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: HeaderTemplateDirective, decorators: [{
383
+ type: Directive,
384
+ args: [{
385
+ selector: '[kendoListViewHeaderTemplate]'
386
+ }]
387
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
388
+
389
+ /**
390
+ * Renders the footer content of the ListView. To define a footer template, nest an `<ng-template>` tag
391
+ * with the `kendoListViewFooterTemplate` directive inside the `<kendo-listview>` tag
392
+ * [see example]({% slug templates_listview %}#toc-footer-template).
393
+ */
394
+ class FooterTemplateDirective {
395
+ constructor(templateRef) {
396
+ this.templateRef = templateRef;
397
+ }
398
+ }
399
+ FooterTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FooterTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
400
+ FooterTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: FooterTemplateDirective, selector: "[kendoListViewFooterTemplate]", ngImport: i0 });
401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FooterTemplateDirective, decorators: [{
402
+ type: Directive,
403
+ args: [{
404
+ selector: '[kendoListViewFooterTemplate]'
405
+ }]
406
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
407
+
408
+ /**
409
+ * Overrides the default loader content of the ListView. To define a loader template, nest an `<ng-template>` tag
410
+ * with the `kendoListViewLoaderTemplate` directive inside the `<kendo-listview>` tag
411
+ * [see example]({% slug templates_listview %}#toc-loader-template).
412
+ */
413
+ class LoaderTemplateDirective {
414
+ constructor(templateRef) {
415
+ this.templateRef = templateRef;
416
+ }
417
+ }
418
+ LoaderTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LoaderTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
419
+ LoaderTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: LoaderTemplateDirective, selector: "[kendoListViewLoaderTemplate]", ngImport: i0 });
420
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: LoaderTemplateDirective, decorators: [{
421
+ type: Directive,
422
+ args: [{
423
+ selector: '[kendoListViewLoaderTemplate]'
424
+ }]
425
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
426
+
427
+ /**
428
+ * Represents the edit template of the ListView ([see example]({% slug editing_template_forms_listview %})).
429
+ * Helps to customize the content of the edited items. To define the template, nest an `<ng-template>`
430
+ * tag with the `kendoListViewEditTemplate` directive inside a `<kendo-listview>` tag.
431
+ *
432
+ * The template context contains the following fields:
433
+ * - `formGroup`&mdash;The current [`FormGroup`](link:site.data.urls.angular['formgroupapi']).
434
+ * If you use the ListView inside [Template-Driven Forms](link:site.data.urls.angular['forms']), it will be `undefined`.
435
+ * - `itemIndex`&mdash;The current item index. If inside a new item, `itemIndex` is `-1`.
436
+ * - `dataItem`&mdash;The current data item.
437
+ * - `isNew`&mdash;The state of the current item.
438
+ */
439
+ class EditTemplateDirective {
440
+ constructor(templateRef) {
441
+ this.templateRef = templateRef;
442
+ }
443
+ }
444
+ EditTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EditTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
445
+ EditTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: EditTemplateDirective, selector: "[kendoListViewEditTemplate]", ngImport: i0 });
446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EditTemplateDirective, decorators: [{
447
+ type: Directive,
448
+ args: [{
449
+ selector: '[kendoListViewEditTemplate]'
450
+ }]
451
+ }], ctorParameters: function () {
452
+ return [{ type: i0.TemplateRef, decorators: [{
453
+ type: Optional
454
+ }] }];
455
+ } });
456
+
457
+ /**
458
+ * @hidden
459
+ */
460
+ const isEqual = (index) => (item) => item.index === index;
461
+ /**
462
+ * @hidden
463
+ */
464
+ const isNotEqual = (index) => (item) => item.index !== index;
465
+ /**
466
+ * @hidden
467
+ */
468
+ const isNewItem = (index) => index === -1 || index === undefined;
469
+ /**
470
+ * @hidden
471
+ */
472
+ class EditService {
473
+ constructor(ngZone) {
474
+ this.ngZone = ngZone;
475
+ this.changes = new EventEmitter();
476
+ this.editedIndices = [];
477
+ this.changedSource = new Subject();
478
+ this.changed = this.changedSource.asObservable().pipe(switchMap(() => this.ngZone.onStable.asObservable().pipe(take(1))));
479
+ }
480
+ editItem(index, group = undefined) {
481
+ this.editedIndices.push({ index, group });
482
+ this.onChanged();
483
+ }
484
+ addItem(group) {
485
+ this.newItem = { group };
486
+ this.onChanged();
487
+ }
488
+ isEditing() {
489
+ return this.editedIndices.length > 0;
490
+ }
491
+ get hasNewItem() {
492
+ return isPresent(this.newItem);
493
+ }
494
+ get newDataItem() {
495
+ if (this.hasNewItem) {
496
+ return this.newItem.group.value;
497
+ }
498
+ return {};
499
+ }
500
+ get newItemGroup() {
501
+ if (this.hasNewItem) {
502
+ return this.newItem.group;
503
+ }
504
+ return new FormGroup({});
505
+ }
506
+ editGroup(index) {
507
+ return this.context(index).group;
508
+ }
509
+ close(index) {
510
+ if (isNewItem(index)) {
511
+ this.newItem = undefined;
512
+ return;
513
+ }
514
+ this.editedIndices = this.editedIndices.filter(isNotEqual(index));
515
+ this.onChanged();
516
+ }
517
+ context(index) {
518
+ if (isNewItem(index)) {
519
+ return this.newItem;
520
+ }
521
+ return this.findByIndex(index);
522
+ }
523
+ isEdited(index) {
524
+ if (isNewItem(index) && isPresent(this.newItem)) {
525
+ return true;
526
+ }
527
+ return isPresent(this.findByIndex(index));
528
+ }
529
+ hasEdited(index) {
530
+ return isPresent(this.context(index));
531
+ }
532
+ beginEdit(itemIndex) {
533
+ this.changes.emit({ action: 'edit', itemIndex });
534
+ }
535
+ beginAdd() {
536
+ this.changes.emit({ action: 'add' });
537
+ }
538
+ endEdit(itemIndex) {
539
+ const { group: formGroup } = this.context(itemIndex);
540
+ this.changes.emit({ action: 'cancel', itemIndex, formGroup, isNew: isNewItem(itemIndex) });
541
+ }
542
+ save(itemIndex) {
543
+ const { group: formGroup } = this.context(itemIndex);
544
+ this.changes.emit({ action: 'save', itemIndex, formGroup, isNew: isNewItem(itemIndex) });
545
+ }
546
+ remove(itemIndex) {
547
+ this.changes.emit({ action: 'remove', itemIndex });
548
+ }
549
+ findByIndex(index) {
550
+ return this.editedIndices.find(isEqual(index));
551
+ }
552
+ onChanged() {
553
+ this.ngZone.runOutsideAngular(() => {
554
+ this.changedSource.next();
555
+ });
556
+ }
557
+ }
558
+ EditService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EditService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
559
+ EditService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EditService });
560
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EditService, decorators: [{
561
+ type: Injectable
562
+ }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
563
+
564
+ const DEFAULT_PAGER_SETTINGS = {
565
+ position: 'bottom',
566
+ buttonCount: 5,
567
+ info: true,
568
+ previousNext: true,
569
+ type: 'numeric',
570
+ pageSizeValues: [5, 10, 20]
571
+ };
572
+ const createControl = (source) => (acc, key) => {
573
+ acc[key] = new FormControl(source[key]);
574
+ return acc;
575
+ };
576
+ /**
577
+ * Represents the Kendo UI ListView component for Angular.
578
+ */
579
+ class ListViewComponent {
580
+ constructor(ngZone, element, renderer, editService, navigationService) {
581
+ this.ngZone = ngZone;
582
+ this.element = element;
583
+ this.renderer = renderer;
584
+ this.editService = editService;
585
+ this.navigationService = navigationService;
586
+ /**
587
+ * @hidden
588
+ */
589
+ this.className = true;
590
+ /**
591
+ * Specifies if the loading indicator of the ListView will be displayed
592
+ * ([see example]({% slug paging_listview %}#toc-remote-binding)).
593
+ */
594
+ this.loading = false;
595
+ /**
596
+ * Specifies the content container `role` attribute
597
+ * ([more details]({% slug accessibility_listview %}#toc-wai-aria-support)).
598
+ * By default, the container `role` is set to `list`.
599
+ */
600
+ this.containerRole = 'list';
601
+ /**
602
+ * Specifies the list item `role` attribute
603
+ * ([more details]({% slug accessibility_listview %}#toc-wai-aria-support)).
604
+ * By default, the list item `role` is set to `listitem`.
605
+ */
606
+ this.listItemRole = 'listitem';
607
+ /**
608
+ * Fires when the user scrolls to the last record on the page
609
+ * ([see endless scrolling example]({% slug scrollmodes_listview %}#toc-endless-scrolling)).
610
+ */
611
+ this.scrollBottom = new EventEmitter();
612
+ /**
613
+ * Fires when the page or the page size of the ListView is changed
614
+ * ([see example]({% slug paging_listview %}#toc-remote-binding)).
615
+ * You have to handle the event yourself and page the data.
616
+ */
617
+ this.pageChange = new EventEmitter();
618
+ /**
619
+ * Fires when the page size of the ListView is changed. This event can be prevented (`$event.preventDefault()`).
620
+ * If not prevented, the `pageChange` event will be fired subsequently.
621
+ */
622
+ this.pageSizeChange = new EventEmitter();
623
+ /**
624
+ * Fires when the user clicks the **Edit** command button to edit an item
625
+ * ([see example]({% slug editing_template_forms_listview %}#toc-editing-records)).
626
+ */
627
+ this.edit = new EventEmitter();
628
+ /**
629
+ * Fires when the user clicks the **Cancel** command button to close an item
630
+ * ([see example]({% slug editing_template_forms_listview %}#toc-cancelling-editing)).
631
+ */
632
+ this.cancel = new EventEmitter();
633
+ /**
634
+ * Fires when the user clicks the **Save** command button to save changes in an item
635
+ * ([see example]({% slug editing_template_forms_listview %}#toc-saving-records)).
636
+ */
637
+ this.save = new EventEmitter();
638
+ /**
639
+ * Fires when the user clicks the **Remove** command button to remove an item
640
+ * ([see example]({% slug editing_template_forms_listview %}#toc-removing-records)).
641
+ */
642
+ this.remove = new EventEmitter();
643
+ /**
644
+ * Fires when the user clicks the **Add** command button to add a new item
645
+ * ([see example]({% slug editing_template_forms_listview %}#toc-adding-records)).
646
+ */
647
+ this.add = new EventEmitter();
648
+ this._skip = 0;
649
+ this._navigable = false;
650
+ validatePackage(packageMetadata);
651
+ this.attachEditHandlers();
652
+ }
653
+ /**
654
+ * Specifies whether the keyboard navigation is enabled
655
+ * ([see example]({% slug keyboard_navigation_listview %})).
656
+ * By default, the navigation is disabled.
657
+ */
658
+ set navigable(navigable) {
659
+ if (!navigable && isPresent(this.removeNavigationListeners)) {
660
+ this.removeNavigationListeners();
661
+ this.removeNavigationListeners = null;
662
+ this.navigationService.isEnabled = false;
663
+ }
664
+ else if (navigable && !isPresent(this.removeNavigationListeners)) {
665
+ this.addNavigationListeners();
666
+ this.navigationService.isEnabled = true;
667
+ }
668
+ this._navigable = navigable;
669
+ }
670
+ get navigable() {
671
+ return this._navigable;
672
+ }
673
+ /**
674
+ * Defines the number of records to be skipped by the pager
675
+ * ([more details]({% slug paging_listview %})).
676
+ */
677
+ set skip(skip) {
678
+ const parsed = parseInt(skip, 10);
679
+ const defaultSkipValue = 0;
680
+ this._skip = !isNaN(parsed) ? parsed : defaultSkipValue;
681
+ }
682
+ get skip() {
683
+ return this._skip;
684
+ }
685
+ /**
686
+ * Configures whether the ListView will render a pager
687
+ * ([more details]({% slug paging_listview %})).
688
+ * Providing a boolean value will render a pager with the default settings.
689
+ */
690
+ set pageable(pageable) {
691
+ this._pageable = pageable;
692
+ this.pagerSettings = pageable ? Object.assign({}, DEFAULT_PAGER_SETTINGS, pageable) : null;
693
+ }
694
+ get pageable() {
695
+ return this._pageable;
696
+ }
697
+ /**
698
+ * @hidden
699
+ *
700
+ * Gets the data items passed to the ListView.
701
+ * If a ListViewDataResult is passed, the data value is used. If an array is passed - it's directly used.
702
+ */
703
+ get items() {
704
+ if (!isPresent(this.data)) {
705
+ return [];
706
+ }
707
+ return Array.isArray(this.data) ? this.data : this.data.data;
708
+ }
709
+ /**
710
+ * @hidden
711
+ *
712
+ * Gets the total number of records passed to the ListView.
713
+ * If a ListViewDataResult is passed, the total value is used. If an array is passed - its length is used.
714
+ */
715
+ get total() {
716
+ if (!this.pageable) {
717
+ return;
718
+ }
719
+ if (!isPresent(this.data)) {
720
+ return 0;
721
+ }
722
+ return Array.isArray(this.data) ? this.data.length : this.data.total;
723
+ }
724
+ /**
725
+ * @hidden
726
+ */
727
+ get containerTabindex() {
728
+ // workaround for FF, where a scrollable container is focusable even without a tabindex and creates an unwanted tab stop
729
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=616594
730
+ return this.navigable ? -1 : null;
731
+ }
732
+ /**
733
+ * Gets the current active item index
734
+ * ([see example]({% slug keyboard_navigation_listview %}#toc-controlling-the-focus)).
735
+ * Returns `null` when the keyboard navigation is disabled.
736
+ */
737
+ get activeIndex() {
738
+ return this.navigationService.activeIndex;
739
+ }
740
+ ngOnChanges(changes) {
741
+ if (isChanged('height', changes, false)) {
742
+ this.renderer.setStyle(this.element.nativeElement, 'height', `${this.height}px`);
743
+ }
744
+ }
745
+ ngOnDestroy() {
746
+ if (isPresent(this.editServiceSubscription)) {
747
+ this.editServiceSubscription.unsubscribe();
748
+ }
749
+ }
750
+ /**
751
+ * @hidden
752
+ */
753
+ templateContext(index) {
754
+ return {
755
+ "$implicit": this.items[index],
756
+ "isLast": index === this.items.length - 1,
757
+ "isFirst": index === 0,
758
+ "dataItem": this.items[index],
759
+ "index": index
760
+ };
761
+ }
762
+ /**
763
+ * @hidden
764
+ */
765
+ editTemplateContext(index) {
766
+ const isNew = index === -1;
767
+ const group = isNew ? this.editService.newItemGroup : this.editService.editGroup(index);
768
+ return {
769
+ "$implicit": group,
770
+ "formGroup": group,
771
+ "dataItem": isNew ? this.editService.newDataItem : this.items[index],
772
+ "isNew": isNew,
773
+ "index": index
774
+ };
775
+ }
776
+ /**
777
+ * Focuses the item at the specified index ([see example]({% slug keyboard_navigation_listview %}#toc-controlling-the-focus)):
778
+ * - If no index is specified, the current active index will be focused.
779
+ * - If the passed value is below `0`, the first item receives focus.
780
+ * - If the passed value is above the last available index, the last item receives focus.
781
+ *
782
+ * > The index param is based on the logical structure of the ListView and does not correspond to the data item index -
783
+ * > i.e. the index `0` corresponds to the first rendered list item. Paging is not taken into account.
784
+ * > Also, for the focusing to work, the `navigable` prop must first be set to `true`.
785
+ */
786
+ focus(index) {
787
+ const totalRenderedItems = this.listViewItems.length;
788
+ this.navigationService.focusIndex(index, totalRenderedItems);
789
+ }
790
+ /**
791
+ * Creates a new item editor ([see example]({% slug editing_template_forms_listview %}#toc-adding-records)).
792
+ *
793
+ * @param {FormGroup} group - The [`FormGroup`](link:site.data.urls.angular['formgroupapi']) that describes
794
+ * the edit form. If called with a data item, it will build the `FormGroup` from the data item fields.
795
+ */
796
+ addItem(group) {
797
+ const isFormGroup = group instanceof FormGroup;
798
+ if (!isFormGroup) {
799
+ const fields = Object.keys(group).reduce(createControl(group), {});
800
+ group = new FormGroup(fields);
801
+ }
802
+ this.editService.addItem(group);
803
+ }
804
+ /**
805
+ * Switches the specified item to edit mode ([see example]({% slug editing_template_forms_listview %}#toc-editing-records)).
806
+ *
807
+ * @param index - The item index that will be switched to edit mode.
808
+ * @param group - The [`FormGroup`](link:site.data.urls.angular['formgroupapi'])
809
+ * that describes the edit form.
810
+ */
811
+ editItem(index, group) {
812
+ this.editService.editItem(index, group);
813
+ }
814
+ /**
815
+ * Closes the editor for a given item ([see example]({% slug editing_template_forms_listview %}#toc-cancelling-editing)).
816
+ *
817
+ * @param {number} index - The item index that will be switched out of the edit mode. If no index is provided, it is assumed
818
+ * that the new item editor will be closed.
819
+ */
820
+ closeItem(index) {
821
+ this.editService.close(index);
822
+ }
823
+ /**
824
+ * @hidden
825
+ */
826
+ isEdited(index) {
827
+ return this.editService.isEdited(index);
828
+ }
829
+ /**
830
+ * @hidden
831
+ */
832
+ handlePageChange(event) {
833
+ this.scrollToContainerTop();
834
+ const firstIndex = 0;
835
+ this.navigationService.setActiveIndex(firstIndex);
836
+ this.pageChange.emit(event);
837
+ }
838
+ /**
839
+ * @hidden
840
+ */
841
+ handleContentScroll() {
842
+ if (!hasObservers(this.scrollBottom)) {
843
+ return;
844
+ }
845
+ const THRESHOLD = 2;
846
+ const { scrollHeight, scrollTop, clientHeight } = this.contentContainer.nativeElement;
847
+ const atBottom = scrollHeight - clientHeight - scrollTop <= THRESHOLD;
848
+ if (atBottom) {
849
+ this.ngZone.run(() => {
850
+ const event = { sender: this };
851
+ this.scrollBottom.emit(event);
852
+ });
853
+ }
854
+ }
855
+ /**
856
+ * @hidden
857
+ */
858
+ itemPosInSet(index) {
859
+ if (!this.pageable) {
860
+ return;
861
+ }
862
+ // adds 1 as the aria-posinset is not zero-based and the counting starts from 1
863
+ return this.skip + index + 1;
864
+ }
865
+ scrollToContainerTop() {
866
+ const container = this.contentContainer.nativeElement;
867
+ container.scrollTop = 0;
868
+ container.scrollLeft = 0;
869
+ }
870
+ addNavigationListeners() {
871
+ this.ngZone.runOutsideAngular(() => {
872
+ const removeKeydownListener = this.renderer.listen(this.contentContainer.nativeElement, 'keydown', event => this.navigationService.handleKeyDown(event, this.listViewItems.length));
873
+ const removeFocusInListener = this.renderer.listen(this.contentContainer.nativeElement, 'focusin', event => this.navigationService.handleFocusIn(event));
874
+ const removeFocusOutListener = this.renderer.listen(this.contentContainer.nativeElement, 'focusout', event => this.navigationService.handleFocusOut(event));
875
+ this.removeNavigationListeners = () => {
876
+ removeKeydownListener();
877
+ removeFocusInListener();
878
+ removeFocusOutListener();
879
+ };
880
+ });
881
+ }
882
+ attachEditHandlers() {
883
+ if (!isPresent(this.editService)) {
884
+ return;
885
+ }
886
+ this.editServiceSubscription = this.editService
887
+ .changes.subscribe(this.emitCRUDEvent.bind(this));
888
+ }
889
+ emitCRUDEvent(args) {
890
+ const { action, itemIndex, formGroup } = args;
891
+ let dataItem = this.items[itemIndex];
892
+ if (action !== 'add' && formGroup) {
893
+ dataItem = formGroup.value;
894
+ }
895
+ Object.assign(args, {
896
+ dataItem: dataItem,
897
+ sender: this
898
+ });
899
+ this[action].emit(args);
900
+ }
901
+ }
902
+ ListViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ListViewComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: EditService }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Component });
903
+ ListViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ListViewComponent, selector: "kendo-listview", inputs: { 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.className", "class.k-d-flex": "this.className" } }, providers: [
904
+ EditService,
905
+ NavigationService,
906
+ LocalizationService,
907
+ {
908
+ provide: L10N_PREFIX,
909
+ useValue: 'kendo.listview'
910
+ }
911
+ ], 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: `
912
+ <!-- top pager -->
913
+ <ng-template
914
+ *ngIf="pagerSettings?.position !== 'bottom'"
915
+ [ngTemplateOutlet]="pagerTemplate"
916
+ [ngTemplateOutletContext]="{ pagerClass: 'k-listview-pager k-listview-pager-top' }"
917
+ >
918
+ </ng-template>
919
+
920
+ <!-- header -->
921
+ <div
922
+ *ngIf="headerTemplate"
923
+ class="k-listview-header"
924
+ >
925
+ <ng-template
926
+ [ngTemplateOutlet]="headerTemplate?.templateRef"
927
+ >
928
+ </ng-template>
929
+ </div>
930
+
931
+ <!-- content -->
932
+ <div
933
+ #contentContainer
934
+ [attr.tabindex]="containerTabindex"
935
+ class="k-listview-content"
936
+ [ngClass]="containerClass"
937
+ [ngStyle]="containerStyle"
938
+ [kendoEventsOutsideAngular]="{
939
+ scroll: handleContentScroll
940
+ }"
941
+ [scope]="this"
942
+ [attr.role]="containerRole"
943
+ [attr.aria-label]="containerLabel"
944
+ >
945
+ <!-- new item edit template -->
946
+ <div
947
+ *ngIf="editService.hasNewItem"
948
+ class="k-listview-item"
949
+ [attr.role]="listItemRole"
950
+ kendoListViewNavigableItem
951
+ [index]="-1"
952
+ [attr.data-kendo-listview-item-index]="-1"
953
+ [ngClass]="itemClass"
954
+ [ngStyle]="itemStyle"
955
+ >
956
+ <ng-template
957
+ *ngIf="editTemplate"
958
+ [ngTemplateOutlet]="editTemplate?.templateRef"
959
+ [ngTemplateOutletContext]="editTemplateContext(-1)"
960
+ >
961
+ </ng-template>
962
+ </div>
963
+
964
+ <!-- items -->
965
+ <div
966
+ *ngFor="let dataItem of items; let index = index; let first = first; let last = last;"
967
+ class="k-listview-item"
968
+ [attr.role]="listItemRole"
969
+ [attr.aria-posinset]="itemPosInSet(index)"
970
+ [attr.aria-setsize]="total"
971
+ kendoListViewNavigableItem
972
+ [index]="index"
973
+ [attr.data-kendo-listview-item-index]="index"
974
+ [ngClass]="itemClass"
975
+ [ngStyle]="itemStyle"
976
+ >
977
+ <ng-template
978
+ [ngTemplateOutlet]="isEdited(index) ? editTemplate?.templateRef : itemTemplate?.templateRef"
979
+ [ngTemplateOutletContext]="isEdited(index) ? editTemplateContext(index) : templateContext(index)"
980
+ >
981
+ </ng-template>
982
+ </div>
983
+
984
+ <!-- loading indicator -->
985
+ <div
986
+ *ngIf="loading && !loaderTemplate"
987
+ class="k-loading-mask"
988
+ >
989
+ <!-- TODO: the k-loading-text is hidden with css but read by readers - review when implementing accessibility + possible localization case -->
990
+ <span class="k-loading-text">Loading</span>
991
+ <div class="k-loading-image"></div>
992
+ <div class="k-loading-color"></div>
993
+ </div>
994
+ <ng-template
995
+ *ngIf="loading && loaderTemplate"
996
+ [ngTemplateOutlet]="loaderTemplate.templateRef"
997
+ >
998
+ </ng-template>
999
+ </div>
1000
+
1001
+ <!-- footer -->
1002
+ <div
1003
+ *ngIf="footerTemplate"
1004
+ class="k-listview-footer"
1005
+ >
1006
+ <ng-template
1007
+ [ngTemplateOutlet]="footerTemplate?.templateRef"
1008
+ >
1009
+ </ng-template>
1010
+ </div>
1011
+
1012
+ <!-- bottom pager -->
1013
+ <ng-template
1014
+ *ngIf="pagerSettings?.position !== 'top'"
1015
+ [ngTemplateOutlet]="pagerTemplate"
1016
+ [ngTemplateOutletContext]="{ pagerClass: 'k-listview-pager' }"
1017
+ >
1018
+ </ng-template>
1019
+
1020
+ <!-- pager template -->
1021
+ <ng-template #pagerTemplate let-pagerClass="pagerClass">
1022
+ <kendo-datapager
1023
+ *ngIf="pageable"
1024
+ [class]="pagerClass"
1025
+ [total]="total"
1026
+ [pageSize]="pageSize"
1027
+ [skip]="skip"
1028
+ [buttonCount]="pagerSettings.buttonCount"
1029
+ [info]="pagerSettings.info"
1030
+ [previousNext]="pagerSettings.previousNext"
1031
+ [type]="pagerSettings.type"
1032
+ [pageSizeValues]="pagerSettings.pageSizeValues"
1033
+ (pageChange)="handlePageChange($event)"
1034
+ (pageSizeChange)="pageSizeChange.emit($event)"
1035
+ >
1036
+ </kendo-datapager>
1037
+ </ng-template>
1038
+ `, isInline: true, components: [{ type: i3.PagerComponent, selector: "kendo-datapager", inputs: ["total", "skip", "pageSize", "buttonCount", "info", "type", "pageSizeValues", "previousNext", "navigable", "size"], outputs: ["pageChange", "pageSizeChange"], exportAs: ["kendoDataPager"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i5.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { type: ListViewNavigableItemDirective, selector: "[kendoListViewNavigableItem]", inputs: ["index"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1039
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ListViewComponent, decorators: [{
1040
+ type: Component,
1041
+ args: [{
1042
+ changeDetection: ChangeDetectionStrategy.OnPush,
1043
+ exportAs: 'kendoListView',
1044
+ selector: 'kendo-listview',
1045
+ providers: [
1046
+ EditService,
1047
+ NavigationService,
1048
+ LocalizationService,
1049
+ {
1050
+ provide: L10N_PREFIX,
1051
+ useValue: 'kendo.listview'
1052
+ }
1053
+ ],
1054
+ template: `
1055
+ <!-- top pager -->
1056
+ <ng-template
1057
+ *ngIf="pagerSettings?.position !== 'bottom'"
1058
+ [ngTemplateOutlet]="pagerTemplate"
1059
+ [ngTemplateOutletContext]="{ pagerClass: 'k-listview-pager k-listview-pager-top' }"
1060
+ >
1061
+ </ng-template>
1062
+
1063
+ <!-- header -->
1064
+ <div
1065
+ *ngIf="headerTemplate"
1066
+ class="k-listview-header"
1067
+ >
1068
+ <ng-template
1069
+ [ngTemplateOutlet]="headerTemplate?.templateRef"
1070
+ >
1071
+ </ng-template>
1072
+ </div>
1073
+
1074
+ <!-- content -->
1075
+ <div
1076
+ #contentContainer
1077
+ [attr.tabindex]="containerTabindex"
1078
+ class="k-listview-content"
1079
+ [ngClass]="containerClass"
1080
+ [ngStyle]="containerStyle"
1081
+ [kendoEventsOutsideAngular]="{
1082
+ scroll: handleContentScroll
1083
+ }"
1084
+ [scope]="this"
1085
+ [attr.role]="containerRole"
1086
+ [attr.aria-label]="containerLabel"
1087
+ >
1088
+ <!-- new item edit template -->
1089
+ <div
1090
+ *ngIf="editService.hasNewItem"
1091
+ class="k-listview-item"
1092
+ [attr.role]="listItemRole"
1093
+ kendoListViewNavigableItem
1094
+ [index]="-1"
1095
+ [attr.data-kendo-listview-item-index]="-1"
1096
+ [ngClass]="itemClass"
1097
+ [ngStyle]="itemStyle"
1098
+ >
1099
+ <ng-template
1100
+ *ngIf="editTemplate"
1101
+ [ngTemplateOutlet]="editTemplate?.templateRef"
1102
+ [ngTemplateOutletContext]="editTemplateContext(-1)"
1103
+ >
1104
+ </ng-template>
1105
+ </div>
1106
+
1107
+ <!-- items -->
1108
+ <div
1109
+ *ngFor="let dataItem of items; let index = index; let first = first; let last = last;"
1110
+ class="k-listview-item"
1111
+ [attr.role]="listItemRole"
1112
+ [attr.aria-posinset]="itemPosInSet(index)"
1113
+ [attr.aria-setsize]="total"
1114
+ kendoListViewNavigableItem
1115
+ [index]="index"
1116
+ [attr.data-kendo-listview-item-index]="index"
1117
+ [ngClass]="itemClass"
1118
+ [ngStyle]="itemStyle"
1119
+ >
1120
+ <ng-template
1121
+ [ngTemplateOutlet]="isEdited(index) ? editTemplate?.templateRef : itemTemplate?.templateRef"
1122
+ [ngTemplateOutletContext]="isEdited(index) ? editTemplateContext(index) : templateContext(index)"
1123
+ >
1124
+ </ng-template>
1125
+ </div>
1126
+
1127
+ <!-- loading indicator -->
1128
+ <div
1129
+ *ngIf="loading && !loaderTemplate"
1130
+ class="k-loading-mask"
1131
+ >
1132
+ <!-- TODO: the k-loading-text is hidden with css but read by readers - review when implementing accessibility + possible localization case -->
1133
+ <span class="k-loading-text">Loading</span>
1134
+ <div class="k-loading-image"></div>
1135
+ <div class="k-loading-color"></div>
1136
+ </div>
1137
+ <ng-template
1138
+ *ngIf="loading && loaderTemplate"
1139
+ [ngTemplateOutlet]="loaderTemplate.templateRef"
1140
+ >
1141
+ </ng-template>
1142
+ </div>
1143
+
1144
+ <!-- footer -->
1145
+ <div
1146
+ *ngIf="footerTemplate"
1147
+ class="k-listview-footer"
1148
+ >
1149
+ <ng-template
1150
+ [ngTemplateOutlet]="footerTemplate?.templateRef"
1151
+ >
1152
+ </ng-template>
1153
+ </div>
1154
+
1155
+ <!-- bottom pager -->
1156
+ <ng-template
1157
+ *ngIf="pagerSettings?.position !== 'top'"
1158
+ [ngTemplateOutlet]="pagerTemplate"
1159
+ [ngTemplateOutletContext]="{ pagerClass: 'k-listview-pager' }"
1160
+ >
1161
+ </ng-template>
1162
+
1163
+ <!-- pager template -->
1164
+ <ng-template #pagerTemplate let-pagerClass="pagerClass">
1165
+ <kendo-datapager
1166
+ *ngIf="pageable"
1167
+ [class]="pagerClass"
1168
+ [total]="total"
1169
+ [pageSize]="pageSize"
1170
+ [skip]="skip"
1171
+ [buttonCount]="pagerSettings.buttonCount"
1172
+ [info]="pagerSettings.info"
1173
+ [previousNext]="pagerSettings.previousNext"
1174
+ [type]="pagerSettings.type"
1175
+ [pageSizeValues]="pagerSettings.pageSizeValues"
1176
+ (pageChange)="handlePageChange($event)"
1177
+ (pageSizeChange)="pageSizeChange.emit($event)"
1178
+ >
1179
+ </kendo-datapager>
1180
+ </ng-template>
1181
+ `
1182
+ }]
1183
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: EditService }, { type: NavigationService }]; }, propDecorators: { className: [{
1184
+ type: HostBinding,
1185
+ args: ['class.k-listview']
1186
+ }, {
1187
+ type: HostBinding,
1188
+ args: ['class.k-listview-bordered']
1189
+ }, {
1190
+ type: HostBinding,
1191
+ args: ['class.k-d-flex']
1192
+ }], itemTemplate: [{
1193
+ type: ContentChild,
1194
+ args: [ItemTemplateDirective, { static: false }]
1195
+ }], headerTemplate: [{
1196
+ type: ContentChild,
1197
+ args: [HeaderTemplateDirective, { static: false }]
1198
+ }], footerTemplate: [{
1199
+ type: ContentChild,
1200
+ args: [FooterTemplateDirective, { static: false }]
1201
+ }], loaderTemplate: [{
1202
+ type: ContentChild,
1203
+ args: [LoaderTemplateDirective, { static: false }]
1204
+ }], contentContainer: [{
1205
+ type: ViewChild,
1206
+ args: ['contentContainer', { static: true }]
1207
+ }], editTemplate: [{
1208
+ type: ContentChild,
1209
+ args: [EditTemplateDirective, { static: false }]
1210
+ }], listViewItems: [{
1211
+ type: ViewChildren,
1212
+ args: [ListViewNavigableItemDirective]
1213
+ }], data: [{
1214
+ type: Input
1215
+ }], loading: [{
1216
+ type: Input
1217
+ }], containerStyle: [{
1218
+ type: Input
1219
+ }], itemStyle: [{
1220
+ type: Input
1221
+ }], containerClass: [{
1222
+ type: Input
1223
+ }], itemClass: [{
1224
+ type: Input
1225
+ }], containerLabel: [{
1226
+ type: Input
1227
+ }], containerRole: [{
1228
+ type: Input
1229
+ }], listItemRole: [{
1230
+ type: Input
1231
+ }], navigable: [{
1232
+ type: Input
1233
+ }], pageSize: [{
1234
+ type: Input
1235
+ }], skip: [{
1236
+ type: Input
1237
+ }], pageable: [{
1238
+ type: Input
1239
+ }], height: [{
1240
+ type: Input
1241
+ }], scrollBottom: [{
1242
+ type: Output
1243
+ }], pageChange: [{
1244
+ type: Output
1245
+ }], pageSizeChange: [{
1246
+ type: Output
1247
+ }], edit: [{
1248
+ type: Output
1249
+ }], cancel: [{
1250
+ type: Output
1251
+ }], save: [{
1252
+ type: Output
1253
+ }], remove: [{
1254
+ type: Output
1255
+ }], add: [{
1256
+ type: Output
1257
+ }] } });
1258
+
1259
+ /**
1260
+ * A directive that encapsulates the in-memory handling of paging
1261
+ * ([see example]({% slug paging_listview %}#toc-binding-directive)).
1262
+ */
1263
+ class DataBindingDirective {
1264
+ constructor(listView) {
1265
+ this.listView = listView;
1266
+ this.subscriptions = new Subscription();
1267
+ }
1268
+ /**
1269
+ * The array of data which will be used to populate the ListView.
1270
+ */
1271
+ set data(data) {
1272
+ this._data = data || [];
1273
+ this.updateListViewData();
1274
+ }
1275
+ get data() {
1276
+ return this._data;
1277
+ }
1278
+ ngOnInit() {
1279
+ this.subscriptions.add(this.listView.pageChange.subscribe(this.handlePageChange.bind(this)));
1280
+ this.subscriptions.add(this.listView.pageSizeChange.subscribe(this.handlePageSizeChange.bind(this)));
1281
+ this.updateListViewData();
1282
+ }
1283
+ ngOnDestroy() {
1284
+ this.subscriptions.unsubscribe();
1285
+ }
1286
+ handlePageChange(event) {
1287
+ this.listView.skip = event.skip;
1288
+ this.listView.pageSize = event.take;
1289
+ this.updateListViewData();
1290
+ }
1291
+ handlePageSizeChange(event) {
1292
+ this.listView.pageSize = Number(event.newPageSize);
1293
+ }
1294
+ updateListViewData() {
1295
+ const from = this.listView.skip || 0;
1296
+ const to = from + (this.listView.pageSize || this.data.length);
1297
+ this.listView.data = {
1298
+ data: this.data.slice(from, to),
1299
+ total: this.data.length
1300
+ };
1301
+ }
1302
+ }
1303
+ DataBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: DataBindingDirective, deps: [{ token: ListViewComponent }], target: i0.ɵɵFactoryTarget.Directive });
1304
+ DataBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: DataBindingDirective, selector: "[kendoListViewBinding]", inputs: { data: ["kendoListViewBinding", "data"] }, ngImport: i0 });
1305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: DataBindingDirective, decorators: [{
1306
+ type: Directive,
1307
+ args: [{
1308
+ selector: '[kendoListViewBinding]'
1309
+ }]
1310
+ }], ctorParameters: function () { return [{ type: ListViewComponent }]; }, propDecorators: { data: [{
1311
+ type: Input,
1312
+ args: ['kendoListViewBinding']
1313
+ }] } });
1314
+
1315
+ /**
1316
+ * The arguments of the [`pageSizeChange`]({% slug api_listview_listviewcomponent %}#toc-pagesizechange) event of the ListView
1317
+ * ([more details]({% slug paging_listview %}).
1318
+ */
1319
+ class PageSizeChangeEvent extends PageSizeChangeEvent$1 {
1320
+ }
1321
+
1322
+ /**
1323
+ * Represents the `edit` command of the ListView. You can apply this directive to any `button`
1324
+ * element inside a [`EditTemplateDirective`]({% slug api_listview_edittemplatedirective %}) template.
1325
+ * When an associated button with the directive is clicked, the
1326
+ * [`edit`]({% slug api_listview_listviewcomponent %}#toc-edit) event
1327
+ * is triggered ([see example]({% slug editing_listview %})).
1328
+ *
1329
+ * @example
1330
+ * ```html-no-run
1331
+ * <kendo-listview>
1332
+ * <ng-template kendoListViewEditTemplate>
1333
+ * <button kendoListViewEditCommand class="k-primary">Edit</button>
1334
+ * </ng-template>
1335
+ * </kendo-listview>
1336
+ * ```
1337
+ *
1338
+ */
1339
+ class EditCommandDirective extends Button {
1340
+ constructor(editService, element, renderer, localization, ngZone) {
1341
+ super(element, renderer, null, localization, ngZone);
1342
+ this.editService = editService;
1343
+ this.elementRef = element;
1344
+ }
1345
+ /**
1346
+ * @hidden
1347
+ */
1348
+ clickHandler(e) {
1349
+ e.preventDefault();
1350
+ const index = getClosestListItemIndex(this.elementRef.nativeElement);
1351
+ this.editService.beginEdit(index);
1352
+ }
1353
+ }
1354
+ EditCommandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EditCommandDirective, deps: [{ token: EditService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1355
+ EditCommandDirective.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: EditCommandDirective, selector: "[kendoListViewEditCommand]", host: { listeners: { "click": "clickHandler($event)" } }, usesInheritance: true, ngImport: i0, template: `
1356
+ <kendo-icon-wrapper
1357
+ *ngIf="icon || svgIcon"
1358
+ innerCssClass="k-button-icon"
1359
+ [name]="icon"
1360
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1361
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1362
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1363
+ </span>
1364
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1365
+ <span class="k-button-text"><ng-content></ng-content></span>
1366
+ `, isInline: true, components: [{ type: i3$1.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: EditCommandDirective, decorators: [{
1368
+ type: Component,
1369
+ args: [{
1370
+ selector: '[kendoListViewEditCommand]',
1371
+ template: `
1372
+ <kendo-icon-wrapper
1373
+ *ngIf="icon || svgIcon"
1374
+ innerCssClass="k-button-icon"
1375
+ [name]="icon"
1376
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1377
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1378
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1379
+ </span>
1380
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1381
+ <span class="k-button-text"><ng-content></ng-content></span>
1382
+ `
1383
+ }]
1384
+ }], ctorParameters: function () { return [{ type: EditService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { clickHandler: [{
1385
+ type: HostListener,
1386
+ args: ['click', ['$event']]
1387
+ }] } });
1388
+
1389
+ /**
1390
+ * Represents the command for adding a new item to the ListView. You can apply this directive to any
1391
+ * `button` element inside a [`HeaderTemplate`]({% slug api_listview_headertemplatedirective %}).
1392
+ * When an associated button with the directive is clicked, the
1393
+ * [`add`]({% slug api_listview_listviewcomponent %}#toc-add) event is triggered
1394
+ * ([see example]({% slug editing_listview %})).
1395
+ *
1396
+ * @example
1397
+ * ```html-no-run
1398
+ * <kendo-listview>
1399
+ * <ng-template kendoListViewHeaderTemplate>
1400
+ * <button kendoListViewAddCommand>Add new</button>
1401
+ * </ng-template>
1402
+ * </kendo-listview>
1403
+ * ```
1404
+ */
1405
+ class AddCommandDirective extends Button {
1406
+ constructor(editService, element, renderer, localization, ngZone) {
1407
+ super(element, renderer, null, localization, ngZone);
1408
+ this.editService = editService;
1409
+ }
1410
+ /**
1411
+ * @hidden
1412
+ */
1413
+ clickHandler(e) {
1414
+ e.preventDefault();
1415
+ this.editService.beginAdd();
1416
+ }
1417
+ }
1418
+ AddCommandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AddCommandDirective, deps: [{ token: EditService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1419
+ AddCommandDirective.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AddCommandDirective, selector: "[kendoListViewAddCommand]", host: { listeners: { "click": "clickHandler($event)" } }, usesInheritance: true, ngImport: i0, template: `
1420
+ <kendo-icon-wrapper
1421
+ *ngIf="icon || svgIcon"
1422
+ innerCssClass="k-button-icon"
1423
+ [name]="icon"
1424
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1425
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1426
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1427
+ </span>
1428
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1429
+ <span class="k-button-text"><ng-content></ng-content></span>
1430
+ `, isInline: true, components: [{ type: i3$1.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AddCommandDirective, decorators: [{
1432
+ type: Component,
1433
+ args: [{
1434
+ selector: '[kendoListViewAddCommand]',
1435
+ template: `
1436
+ <kendo-icon-wrapper
1437
+ *ngIf="icon || svgIcon"
1438
+ innerCssClass="k-button-icon"
1439
+ [name]="icon"
1440
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1441
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1442
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1443
+ </span>
1444
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1445
+ <span class="k-button-text"><ng-content></ng-content></span>
1446
+ `
1447
+ }]
1448
+ }], ctorParameters: function () { return [{ type: EditService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { clickHandler: [{
1449
+ type: HostListener,
1450
+ args: ['click', ['$event']]
1451
+ }] } });
1452
+
1453
+ /**
1454
+ * Represents the `save` command of the ListView. You can apply this directive to any `button`
1455
+ * element inside a [`EditTemplateDirective`]({% slug api_listview_edittemplatedirective %}) template.
1456
+ * When an associated button with the directive is clicked, the
1457
+ * [`save`]({% slug api_listview_listviewcomponent %}#toc-save) event
1458
+ * is triggered ([see example]({% slug editing_listview %})).
1459
+ *
1460
+ * @example
1461
+ * ```html-no-run
1462
+ * <kendo-listview>
1463
+ * <ng-template kendoListViewEditTemplate>
1464
+ * <button kendoListViewSaveCommand>Save changes</button>
1465
+ * </ng-template>
1466
+ * </kendo-listview>
1467
+ * ```
1468
+ *
1469
+ * You can control the content of the button based on the state of the item.
1470
+ *
1471
+ * @example
1472
+ * ```html-no-run
1473
+ * <kendo-listview>
1474
+ * <ng-template kendoListViewEditTemplate let-isNew="isNew">
1475
+ * <button kendoListViewSaveCommand>{{isNew ? 'Add' : 'Update'}}</button>
1476
+ * </ng-template>
1477
+ * </kendo-listview>
1478
+ * ```
1479
+ */
1480
+ class SaveCommandDirective extends Button {
1481
+ constructor(editService, element, renderer, localization, ngZone) {
1482
+ super(element, renderer, null, localization, ngZone);
1483
+ this.editService = editService;
1484
+ this.elementRef = element;
1485
+ }
1486
+ /**
1487
+ * @hidden
1488
+ */
1489
+ clickHandler(e) {
1490
+ e.preventDefault();
1491
+ const index = getClosestListItemIndex(this.elementRef.nativeElement);
1492
+ if (this.editService.isEdited(index)) {
1493
+ this.editService.save(index);
1494
+ }
1495
+ }
1496
+ }
1497
+ SaveCommandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SaveCommandDirective, deps: [{ token: EditService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1498
+ SaveCommandDirective.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: SaveCommandDirective, selector: "[kendoListViewSaveCommand]", host: { listeners: { "click": "clickHandler($event)" } }, usesInheritance: true, ngImport: i0, template: `
1499
+ <kendo-icon-wrapper
1500
+ *ngIf="icon || svgIcon"
1501
+ innerCssClass="k-button-icon"
1502
+ [name]="icon"
1503
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1504
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1505
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1506
+ </span>
1507
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1508
+ <span class="k-button-text"><ng-content></ng-content></span>
1509
+ `, isInline: true, components: [{ type: i3$1.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1510
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: SaveCommandDirective, decorators: [{
1511
+ type: Component,
1512
+ args: [{
1513
+ selector: '[kendoListViewSaveCommand]',
1514
+ template: `
1515
+ <kendo-icon-wrapper
1516
+ *ngIf="icon || svgIcon"
1517
+ innerCssClass="k-button-icon"
1518
+ [name]="icon"
1519
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1520
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1521
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1522
+ </span>
1523
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1524
+ <span class="k-button-text"><ng-content></ng-content></span>
1525
+ `
1526
+ }]
1527
+ }], ctorParameters: function () { return [{ type: EditService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { clickHandler: [{
1528
+ type: HostListener,
1529
+ args: ['click', ['$event']]
1530
+ }] } });
1531
+
1532
+ /**
1533
+ * Represents the `cancel` command of the ListView. You can apply this directive to any `button`
1534
+ * element inside a [`EditTemplateDirective`]({% slug api_listview_edittemplatedirective %}) template.
1535
+ * When an associated button with the directive is clicked, the
1536
+ * [`cancel`]({% slug api_listview_listviewcomponent %}#toc-cancel) event
1537
+ * is triggered ([see example]({% slug editing_listview %})).
1538
+ *
1539
+ * @example
1540
+ * ```html-no-run
1541
+ * <kendo-listview>
1542
+ * <ng-template kendoListViewEditTemplate>
1543
+ * <button kendoListViewCancelCommand>Cancel changes</button>
1544
+ * </ng-template>
1545
+ * </kendo-listview>
1546
+ * ```
1547
+ *
1548
+ * You can control the content of the button based on the state of the item.
1549
+ *
1550
+ * @example
1551
+ * ```html-no-run
1552
+ * <kendo-listview>
1553
+ * <ng-template kendoListViewEditTemplate let-isNew="isNew">
1554
+ * <button kendoListViewCancelCommand>{{isNew ? 'Discard' : 'Cancel changes'}}</button>
1555
+ * </ng-template>
1556
+ * </kendo-listview>
1557
+ * ```
1558
+ */
1559
+ class CancelCommandDirective extends Button {
1560
+ constructor(editService, element, renderer, localization, ngZone) {
1561
+ super(element, renderer, null, localization, ngZone);
1562
+ this.editService = editService;
1563
+ this.elementRef = element;
1564
+ }
1565
+ /**
1566
+ * @hidden
1567
+ */
1568
+ clickHandler(e) {
1569
+ e.preventDefault();
1570
+ const index = getClosestListItemIndex(this.elementRef.nativeElement);
1571
+ if (this.editService.isEdited(index)) {
1572
+ this.editService.endEdit(index);
1573
+ }
1574
+ }
1575
+ }
1576
+ CancelCommandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CancelCommandDirective, deps: [{ token: EditService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1577
+ CancelCommandDirective.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: CancelCommandDirective, selector: "[kendoListViewCancelCommand]", host: { listeners: { "click": "clickHandler($event)" } }, usesInheritance: true, ngImport: i0, template: `
1578
+ <kendo-icon-wrapper
1579
+ *ngIf="icon || svgIcon"
1580
+ innerCssClass="k-button-icon"
1581
+ [name]="icon"
1582
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1583
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1584
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1585
+ </span>
1586
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1587
+ <span class="k-button-text"><ng-content></ng-content></span>
1588
+ `, isInline: true, components: [{ type: i3$1.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1589
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CancelCommandDirective, decorators: [{
1590
+ type: Component,
1591
+ args: [{
1592
+ selector: '[kendoListViewCancelCommand]',
1593
+ template: `
1594
+ <kendo-icon-wrapper
1595
+ *ngIf="icon || svgIcon"
1596
+ innerCssClass="k-button-icon"
1597
+ [name]="icon"
1598
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1599
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1600
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1601
+ </span>
1602
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1603
+ <span class="k-button-text"><ng-content></ng-content></span>
1604
+ `
1605
+ }]
1606
+ }], ctorParameters: function () { return [{ type: EditService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { clickHandler: [{
1607
+ type: HostListener,
1608
+ args: ['click', ['$event']]
1609
+ }] } });
1610
+
1611
+ /**
1612
+ * Represents the `remove` command of the ListView. You can apply this directive to any `button` element
1613
+ * inside a [`EditTemplateDirective`]({% slug api_listview_edittemplatedirective %}) template.
1614
+ * When an associated button with the directive is clicked, the
1615
+ * [`remove` event]({% slug api_listview_listviewcomponent %}#toc-remove)
1616
+ * is triggered ([see example]({% slug editing_listview %})).
1617
+ *
1618
+ * @example
1619
+ * ```html-no-run
1620
+ * <kendo-listview>
1621
+ * <ng-template kendoListViewEditTemplate>
1622
+ * <button kendoListViewRemoveCommand>Remove item</button>
1623
+ * </ng-template>
1624
+ * </kendo-listview>
1625
+ * ```
1626
+ */
1627
+ class RemoveCommandDirective extends Button {
1628
+ constructor(editService, element, renderer, localization, ngZone) {
1629
+ super(element, renderer, null, localization, ngZone);
1630
+ this.editService = editService;
1631
+ this.elementRef = element;
1632
+ }
1633
+ /**
1634
+ * @hidden
1635
+ */
1636
+ clickHandler(e) {
1637
+ e.preventDefault();
1638
+ const index = getClosestListItemIndex(this.elementRef.nativeElement);
1639
+ this.editService.remove(index);
1640
+ }
1641
+ }
1642
+ RemoveCommandDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: RemoveCommandDirective, deps: [{ token: EditService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1643
+ RemoveCommandDirective.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: RemoveCommandDirective, selector: "[kendoListViewRemoveCommand]", host: { listeners: { "click": "clickHandler($event)" } }, usesInheritance: true, ngImport: i0, template: `
1644
+ <kendo-icon-wrapper
1645
+ *ngIf="icon || svgIcon"
1646
+ innerCssClass="k-button-icon"
1647
+ [name]="icon"
1648
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1649
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1650
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1651
+ </span>
1652
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1653
+ <span class="k-button-text"><ng-content></ng-content></span>
1654
+ `, isInline: true, components: [{ type: i3$1.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1655
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: RemoveCommandDirective, decorators: [{
1656
+ type: Component,
1657
+ args: [{
1658
+ selector: '[kendoListViewRemoveCommand]',
1659
+ template: `
1660
+ <kendo-icon-wrapper
1661
+ *ngIf="icon || svgIcon"
1662
+ innerCssClass="k-button-icon"
1663
+ [name]="icon"
1664
+ [svgIcon]="svgIcon"></kendo-icon-wrapper>
1665
+ <span *ngIf="imageUrl" class="k-button-icon k-icon">
1666
+ <img [src]="imageUrl" class="k-image" role="presentation" />
1667
+ </span>
1668
+ <span *ngIf="iconClass" class="k-button-icon" [ngClass]="iconClass"></span>
1669
+ <span class="k-button-text"><ng-content></ng-content></span>
1670
+ `
1671
+ }]
1672
+ }], ctorParameters: function () { return [{ type: EditService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { clickHandler: [{
1673
+ type: HostListener,
1674
+ args: ['click', ['$event']]
1675
+ }] } });
1676
+
1677
+ /**
1678
+ * @hidden
1679
+ */
1680
+ class TemplateContextDirective {
1681
+ constructor(viewContainerRef) {
1682
+ this.viewContainerRef = viewContainerRef;
1683
+ }
1684
+ set templateContext(context) {
1685
+ if (this.insertedViewRef) {
1686
+ this.viewContainerRef.remove(this.viewContainerRef.indexOf(this.insertedViewRef));
1687
+ this.insertedViewRef = undefined;
1688
+ }
1689
+ if (context.templateRef) {
1690
+ this.insertedViewRef = this.viewContainerRef.createEmbeddedView(context.templateRef, context);
1691
+ }
1692
+ }
1693
+ }
1694
+ TemplateContextDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TemplateContextDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
1695
+ TemplateContextDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: TemplateContextDirective, selector: "[templateContext]", inputs: { templateContext: "templateContext" }, ngImport: i0 });
1696
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TemplateContextDirective, decorators: [{
1697
+ type: Directive,
1698
+ args: [{
1699
+ selector: '[templateContext]' // eslint-disable-line
1700
+ }]
1701
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { templateContext: [{
1702
+ type: Input
1703
+ }] } });
1704
+
1705
+ const TEMPLATE_DIRECTIVES = [
1706
+ ItemTemplateDirective,
1707
+ HeaderTemplateDirective,
1708
+ FooterTemplateDirective,
1709
+ LoaderTemplateDirective
1710
+ ];
1711
+ const BINDING_DIRECTIVES = [
1712
+ DataBindingDirective
1713
+ ];
1714
+ const EDITING_DIRECTIVES = [
1715
+ EditTemplateDirective,
1716
+ EditCommandDirective,
1717
+ CancelCommandDirective,
1718
+ SaveCommandDirective,
1719
+ RemoveCommandDirective,
1720
+ AddCommandDirective
1721
+ ];
1722
+ /**
1723
+ * The exported package module.
1724
+ *
1725
+ * The package exports:
1726
+ * - [`ListViewComponent`]({% slug api_listview_listviewcomponent %})&mdash;The ListView component class.
1727
+ * - [`ItemTemplateDirective`]({% slug api_listview_itemtemplatedirective %})&mdash;The item template directive.
1728
+ * - [`HeaderTemplateDirective`]({% slug api_listview_headertemplatedirective %})&mdash;The header template directive.
1729
+ * - [`FooterTemplateDirective`]({% slug api_listview_footertemplatedirective %})&mdash;The footer template directive.
1730
+ * - [`LoaderTemplateDirective`]({% slug api_listview_loadertemplatedirective %})&mdash;The loeader template directive.
1731
+ * - [`DataBindingDirective`]({% slug api_listview_databindingdirective %})&mdash;The data binding directive.
1732
+ * - [`EditTemplateDirective`]({% slug api_listview_editingdirective %}&mdash;The editing template directive.
1733
+ */
1734
+ class ListViewModule {
1735
+ }
1736
+ ListViewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ListViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1737
+ ListViewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ListViewModule, declarations: [ItemTemplateDirective,
1738
+ HeaderTemplateDirective,
1739
+ FooterTemplateDirective,
1740
+ LoaderTemplateDirective, DataBindingDirective, EditTemplateDirective,
1741
+ EditCommandDirective,
1742
+ CancelCommandDirective,
1743
+ SaveCommandDirective,
1744
+ RemoveCommandDirective,
1745
+ AddCommandDirective, ListViewComponent,
1746
+ TemplateContextDirective,
1747
+ ListViewNavigableItemDirective], imports: [CommonModule,
1748
+ PagerModule,
1749
+ EventsModule,
1750
+ IconsModule], exports: [ItemTemplateDirective,
1751
+ HeaderTemplateDirective,
1752
+ FooterTemplateDirective,
1753
+ LoaderTemplateDirective, DataBindingDirective, EditTemplateDirective,
1754
+ EditCommandDirective,
1755
+ CancelCommandDirective,
1756
+ SaveCommandDirective,
1757
+ RemoveCommandDirective,
1758
+ AddCommandDirective, ListViewComponent,
1759
+ CommonModule,
1760
+ EventsModule] });
1761
+ ListViewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ListViewModule, imports: [[
1762
+ CommonModule,
1763
+ PagerModule,
1764
+ EventsModule,
1765
+ IconsModule
1766
+ ], CommonModule,
1767
+ EventsModule] });
1768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ListViewModule, decorators: [{
1769
+ type: NgModule,
1770
+ args: [{
1771
+ declarations: [
1772
+ TEMPLATE_DIRECTIVES,
1773
+ BINDING_DIRECTIVES,
1774
+ EDITING_DIRECTIVES,
1775
+ ListViewComponent,
1776
+ TemplateContextDirective,
1777
+ ListViewNavigableItemDirective
1778
+ ],
1779
+ exports: [
1780
+ TEMPLATE_DIRECTIVES,
1781
+ BINDING_DIRECTIVES,
1782
+ EDITING_DIRECTIVES,
1783
+ ListViewComponent,
1784
+ CommonModule,
1785
+ EventsModule
1786
+ ],
1787
+ imports: [
1788
+ CommonModule,
1789
+ PagerModule,
1790
+ EventsModule,
1791
+ IconsModule
1792
+ ]
1793
+ }]
1794
+ }] });
1795
+
1796
+ /**
1797
+ * Generated bundle index. Do not edit.
1798
+ */
1799
+
1800
+ export { AddCommandDirective, CancelCommandDirective, DataBindingDirective, EditCommandDirective, EditTemplateDirective, FooterTemplateDirective, HeaderTemplateDirective, ItemTemplateDirective, ListViewComponent, ListViewModule, LoaderTemplateDirective, PageSizeChangeEvent, RemoveCommandDirective, SaveCommandDirective };
1801
+