@progress/kendo-angular-listview 17.0.0-develop.8 → 17.0.0

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