@progress/kendo-angular-listview 3.0.2 → 4.0.0-next.202204010900

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 (152) hide show
  1. package/bundles/kendo-angular-listview.umd.js +5 -0
  2. package/{dist/es2015/data-binding → data-binding}/data-binding.directive.d.ts +5 -1
  3. package/{dist/es2015/editing → editing}/commands/add-command.directive.d.ts +3 -0
  4. package/{dist/es2015/editing → editing}/commands/cancel-command.directive.d.ts +3 -0
  5. package/{dist/es2015/editing → editing}/commands/edit-command.directive.d.ts +3 -0
  6. package/{dist/es2015/editing → editing}/commands/remove-command.directive.d.ts +3 -0
  7. package/{dist/es2015/editing → editing}/commands/save-command.directive.d.ts +3 -0
  8. package/{dist/es2015/editing → editing}/edit-template.directive.d.ts +3 -0
  9. package/{dist/es2015/editing → editing}/edit.service.d.ts +6 -3
  10. package/{dist/es2015/editing → editing}/events/add-event-args.interface.d.ts +0 -0
  11. package/{dist/es2015/editing → editing}/events/cancel-event-args.interface.d.ts +0 -0
  12. package/{dist/es2015/editing → editing}/events/edit-event-args.interface.d.ts +0 -0
  13. package/{dist/es2015/editing → editing}/events/remove-event-args.interface.d.ts +0 -0
  14. package/{dist/es2015/editing → editing}/events/save-event-args.interface.d.ts +0 -0
  15. package/{dist/es2015 → esm2015}/data-binding/data-binding.directive.js +15 -16
  16. package/esm2015/editing/commands/add-command.directive.js +49 -0
  17. package/{dist/es2015 → esm2015}/editing/commands/cancel-command.directive.js +17 -23
  18. package/{dist/es2015 → esm2015}/editing/commands/edit-command.directive.js +17 -23
  19. package/{dist/es2015 → esm2015}/editing/commands/remove-command.directive.js +17 -23
  20. package/{dist/es2015 → esm2015}/editing/commands/save-command.directive.js +17 -23
  21. package/{dist/es2015 → esm2015}/editing/edit-template.directive.js +14 -12
  22. package/{dist/es2015 → esm2015}/editing/edit.service.js +9 -13
  23. package/{dist/es → esm2015}/editing/events/add-event-args.interface.js +1 -0
  24. package/{dist/es2015 → esm2015}/editing/events/cancel-event-args.interface.js +1 -0
  25. package/{dist/es2015 → esm2015}/editing/events/edit-event-args.interface.js +1 -0
  26. package/{dist/es2015 → esm2015}/editing/events/remove-event-args.interface.js +1 -0
  27. package/{dist/es → esm2015}/editing/events/save-event-args.interface.js +1 -0
  28. package/{dist/es/editing/events/remove-event-args.interface.js → esm2015/kendo-angular-listview.js} +4 -0
  29. package/{dist/es2015 → esm2015}/listview.component.js +242 -155
  30. package/{dist/es2015 → esm2015}/listview.module.js +56 -26
  31. package/{dist/es → esm2015}/main.js +5 -0
  32. package/{dist/es → esm2015}/models/listview-data-result.js +1 -0
  33. package/{dist/es → esm2015}/models/page-change-event.js +1 -0
  34. package/{dist/es2015 → esm2015}/models/page-size-change-event.js +0 -0
  35. package/{dist/es → esm2015}/models/page-size-item.js +1 -0
  36. package/{dist/es → esm2015}/models/pager-position.js +1 -0
  37. package/{dist/es → esm2015}/models/pager-settings.js +1 -0
  38. package/{dist/es → esm2015}/models/pager-type.js +1 -0
  39. package/{dist/es → esm2015}/models/scroll-bottom-event.js +1 -0
  40. package/{dist/es2015 → esm2015}/navigation/listview-navigable-item.directive.js +15 -18
  41. package/{dist/es2015 → esm2015}/navigation/navigation.service.js +8 -13
  42. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  43. package/esm2015/templates/footer-template.directive.js +24 -0
  44. package/esm2015/templates/header-template.directive.js +24 -0
  45. package/{dist/es2015 → esm2015}/templates/item-template.directive.js +12 -11
  46. package/esm2015/templates/loader-template.directive.js +24 -0
  47. package/esm2015/templates/template-context.directive.js +33 -0
  48. package/{dist/es2015 → esm2015}/utils.js +0 -0
  49. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-listview.js} +521 -417
  50. package/{dist/es/editing/events/cancel-event-args.interface.js → kendo-angular-listview.d.ts} +5 -0
  51. package/{dist/es2015/listview.component.d.ts → listview.component.d.ts} +13 -7
  52. package/listview.module.d.ts +39 -0
  53. package/{dist/es2015/main.d.ts → main.d.ts} +5 -0
  54. package/{dist/es2015/models → models}/listview-data-result.d.ts +0 -0
  55. package/{dist/es2015/models → models}/page-change-event.d.ts +0 -0
  56. package/{dist/es2015/models → models}/page-size-change-event.d.ts +0 -0
  57. package/{dist/es2015/models → models}/page-size-item.d.ts +0 -0
  58. package/{dist/es2015/models → models}/pager-position.d.ts +0 -0
  59. package/{dist/es2015/models → models}/pager-settings.d.ts +0 -0
  60. package/{dist/es2015/models → models}/pager-type.d.ts +0 -0
  61. package/{dist/es2015/models → models}/scroll-bottom-event.d.ts +0 -0
  62. package/{dist/es2015/navigation → navigation}/listview-navigable-item.directive.d.ts +3 -0
  63. package/{dist/es2015/navigation → navigation}/navigation.service.d.ts +5 -1
  64. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  65. package/package.json +36 -108
  66. package/schematics/ngAdd/index.js +5 -2
  67. package/schematics/ngAdd/index.js.map +1 -1
  68. package/{dist/es2015/templates → templates}/footer-template.directive.d.ts +3 -0
  69. package/{dist/es2015/templates → templates}/header-template.directive.d.ts +3 -0
  70. package/{dist/es2015/templates → templates}/item-template.directive.d.ts +3 -0
  71. package/{dist/es2015/templates → templates}/loader-template.directive.d.ts +3 -0
  72. package/{dist/es2015/templates → templates}/template-context.directive.d.ts +4 -1
  73. package/{dist/es2015/utils.d.ts → utils.d.ts} +0 -0
  74. package/dist/cdn/js/kendo-angular-listview.js +0 -20
  75. package/dist/cdn/main.js +0 -5
  76. package/dist/es/data-binding/data-binding.directive.js +0 -69
  77. package/dist/es/editing/commands/add-command.directive.js +0 -58
  78. package/dist/es/editing/commands/cancel-command.directive.js +0 -74
  79. package/dist/es/editing/commands/edit-command.directive.js +0 -62
  80. package/dist/es/editing/commands/remove-command.directive.js +0 -61
  81. package/dist/es/editing/commands/save-command.directive.js +0 -74
  82. package/dist/es/editing/edit-template.directive.js +0 -32
  83. package/dist/es/editing/edit.service.js +0 -136
  84. package/dist/es/editing/events/edit-event-args.interface.js +0 -4
  85. package/dist/es/index.js +0 -17
  86. package/dist/es/listview.component.js +0 -534
  87. package/dist/es/listview.module.js +0 -83
  88. package/dist/es/models/page-size-change-event.js +0 -18
  89. package/dist/es/navigation/listview-navigable-item.directive.js +0 -70
  90. package/dist/es/navigation/navigation.service.js +0 -162
  91. package/dist/es/package-metadata.js +0 -15
  92. package/dist/es/templates/footer-template.directive.js +0 -24
  93. package/dist/es/templates/header-template.directive.js +0 -24
  94. package/dist/es/templates/item-template.directive.js +0 -30
  95. package/dist/es/templates/loader-template.directive.js +0 -24
  96. package/dist/es/templates/template-context.directive.js +0 -40
  97. package/dist/es/utils.js +0 -103
  98. package/dist/es2015/editing/commands/add-command.directive.js +0 -55
  99. package/dist/es2015/editing/events/add-event-args.interface.js +0 -4
  100. package/dist/es2015/editing/events/save-event-args.interface.js +0 -4
  101. package/dist/es2015/index.d.ts +0 -17
  102. package/dist/es2015/index.js +0 -17
  103. package/dist/es2015/index.metadata.json +0 -1
  104. package/dist/es2015/listview.module.d.ts +0 -18
  105. package/dist/es2015/main.js +0 -13
  106. package/dist/es2015/models/listview-data-result.js +0 -4
  107. package/dist/es2015/models/page-change-event.js +0 -4
  108. package/dist/es2015/models/page-size-item.js +0 -4
  109. package/dist/es2015/models/pager-position.js +0 -4
  110. package/dist/es2015/models/pager-settings.js +0 -4
  111. package/dist/es2015/models/pager-type.js +0 -4
  112. package/dist/es2015/models/scroll-bottom-event.js +0 -4
  113. package/dist/es2015/templates/footer-template.directive.js +0 -23
  114. package/dist/es2015/templates/header-template.directive.js +0 -23
  115. package/dist/es2015/templates/loader-template.directive.js +0 -23
  116. package/dist/es2015/templates/template-context.directive.js +0 -35
  117. package/dist/fesm5/index.js +0 -1528
  118. package/dist/npm/data-binding/data-binding.directive.js +0 -71
  119. package/dist/npm/editing/commands/add-command.directive.js +0 -60
  120. package/dist/npm/editing/commands/cancel-command.directive.js +0 -76
  121. package/dist/npm/editing/commands/edit-command.directive.js +0 -64
  122. package/dist/npm/editing/commands/remove-command.directive.js +0 -63
  123. package/dist/npm/editing/commands/save-command.directive.js +0 -76
  124. package/dist/npm/editing/edit-template.directive.js +0 -34
  125. package/dist/npm/editing/edit.service.js +0 -140
  126. package/dist/npm/editing/events/add-event-args.interface.js +0 -6
  127. package/dist/npm/editing/events/cancel-event-args.interface.js +0 -6
  128. package/dist/npm/editing/events/edit-event-args.interface.js +0 -6
  129. package/dist/npm/editing/events/remove-event-args.interface.js +0 -6
  130. package/dist/npm/editing/events/save-event-args.interface.js +0 -6
  131. package/dist/npm/index.js +0 -29
  132. package/dist/npm/listview.component.js +0 -536
  133. package/dist/npm/listview.module.js +0 -85
  134. package/dist/npm/main.js +0 -24
  135. package/dist/npm/models/listview-data-result.js +0 -6
  136. package/dist/npm/models/page-change-event.js +0 -6
  137. package/dist/npm/models/page-size-change-event.js +0 -20
  138. package/dist/npm/models/page-size-item.js +0 -6
  139. package/dist/npm/models/pager-position.js +0 -6
  140. package/dist/npm/models/pager-settings.js +0 -6
  141. package/dist/npm/models/pager-type.js +0 -6
  142. package/dist/npm/models/scroll-bottom-event.js +0 -6
  143. package/dist/npm/navigation/listview-navigable-item.directive.js +0 -72
  144. package/dist/npm/navigation/navigation.service.js +0 -164
  145. package/dist/npm/package-metadata.js +0 -17
  146. package/dist/npm/templates/footer-template.directive.js +0 -26
  147. package/dist/npm/templates/header-template.directive.js +0 -26
  148. package/dist/npm/templates/item-template.directive.js +0 -32
  149. package/dist/npm/templates/loader-template.directive.js +0 -26
  150. package/dist/npm/templates/template-context.directive.js +0 -42
  151. package/dist/npm/utils.js +0 -105
  152. package/dist/systemjs/kendo-angular-listview.js +0 -5
@@ -1,534 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 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 tslib_1 from "tslib";
6
- import { Component, HostBinding, Input, Output, ContentChild, ChangeDetectionStrategy, EventEmitter, NgZone, Renderer2, ElementRef, ViewChild, ViewChildren, QueryList } from '@angular/core';
7
- import { hasObservers, isChanged } from '@progress/kendo-angular-common';
8
- import { validatePackage } from '@progress/kendo-licensing';
9
- import { packageMetadata } from './package-metadata';
10
- import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
11
- import { NavigationService } from './navigation/navigation.service';
12
- import { ListViewNavigableItemDirective } from './navigation/listview-navigable-item.directive';
13
- import { ItemTemplateDirective } from './templates/item-template.directive';
14
- import { HeaderTemplateDirective } from './templates/header-template.directive';
15
- import { FooterTemplateDirective } from './templates/footer-template.directive';
16
- import { LoaderTemplateDirective } from './templates/loader-template.directive';
17
- import { EditTemplateDirective } from './editing/edit-template.directive';
18
- import { EditService } from './editing/edit.service';
19
- import { isPresent } from './utils';
20
- import { FormGroup, FormControl } from '@angular/forms';
21
- var DEFAULT_PAGER_SETTINGS = {
22
- position: 'bottom',
23
- buttonCount: 5,
24
- info: true,
25
- previousNext: true,
26
- type: 'numeric',
27
- pageSizeValues: [5, 10, 20]
28
- };
29
- var createControl = function (source) { return function (acc, key) {
30
- acc[key] = new FormControl(source[key]);
31
- return acc;
32
- }; };
33
- var ɵ0 = createControl;
34
- /**
35
- * Represents the Kendo UI ListView component for Angular.
36
- */
37
- var ListViewComponent = /** @class */ (function () {
38
- function ListViewComponent(ngZone, element, renderer, editService, navigationService) {
39
- this.ngZone = ngZone;
40
- this.element = element;
41
- this.renderer = renderer;
42
- this.editService = editService;
43
- this.navigationService = navigationService;
44
- /**
45
- * @hidden
46
- */
47
- this.className = true;
48
- /**
49
- * Specifies if the loading indicator of the ListView will be displayed
50
- * ([see example]({% slug paging_listview %}#toc-remote-binding)).
51
- */
52
- this.loading = false;
53
- /**
54
- * Specifies the content container `role` attribute
55
- * ([more details]({% slug accessibility_listview %}#toc-wai-aria-support)).
56
- * By default, the container `role` is set to `listbox`.
57
- */
58
- this.containerRole = 'listbox';
59
- /**
60
- * Specifies the list item `role` attribute
61
- * ([more details]({% slug accessibility_listview %}#toc-wai-aria-support)).
62
- * By default, the list item `role` is set to `option`.
63
- */
64
- this.listItemRole = 'option';
65
- /**
66
- * Fires when the user scrolls to the last record on the page
67
- * ([see endless scrolling example]({% slug scrollmodes_listview %}#toc-endless-scrolling)).
68
- */
69
- this.scrollBottom = new EventEmitter();
70
- /**
71
- * Fires when the page or the page size of the ListView is changed
72
- * ([see example]({% slug paging_listview %}#toc-remote-binding)).
73
- * You have to handle the event yourself and page the data.
74
- */
75
- this.pageChange = new EventEmitter();
76
- /**
77
- * Fires when the page size of the ListView is changed. This event can be prevented (`$event.preventDefault()`).
78
- * If not prevented, the `pageChange` event will be fired subsequently.
79
- */
80
- this.pageSizeChange = new EventEmitter();
81
- /**
82
- * Fires when the user clicks the **Edit** command button to edit an item
83
- * ([see example]({% slug editing_template_forms_listview %}#toc-editing-records)).
84
- */
85
- this.edit = new EventEmitter();
86
- /**
87
- * Fires when the user clicks the **Cancel** command button to close an item
88
- * ([see example]({% slug editing_template_forms_listview %}#toc-cancelling-editing)).
89
- */
90
- this.cancel = new EventEmitter();
91
- /**
92
- * Fires when the user clicks the **Save** command button to save changes in an item
93
- * ([see example]({% slug editing_template_forms_listview %}#toc-saving-records)).
94
- */
95
- this.save = new EventEmitter();
96
- /**
97
- * Fires when the user clicks the **Remove** command button to remove an item
98
- * ([see example]({% slug editing_template_forms_listview %}#toc-removing-records)).
99
- */
100
- this.remove = new EventEmitter();
101
- /**
102
- * Fires when the user clicks the **Add** command button to add a new item
103
- * ([see example]({% slug editing_template_forms_listview %}#toc-adding-records)).
104
- */
105
- this.add = new EventEmitter();
106
- this._skip = 0;
107
- this._navigable = false;
108
- validatePackage(packageMetadata);
109
- this.attachEditHandlers();
110
- }
111
- Object.defineProperty(ListViewComponent.prototype, "navigable", {
112
- get: function () {
113
- return this._navigable;
114
- },
115
- /**
116
- * Specifies whether the keyboard navigation is enabled
117
- * ([see example]({% slug keyboard_navigation_listview %})).
118
- * By default, the navigation is disabled.
119
- */
120
- set: function (navigable) {
121
- if (!navigable && isPresent(this.removeNavigationListeners)) {
122
- this.removeNavigationListeners();
123
- this.removeNavigationListeners = null;
124
- this.navigationService.isEnabled = false;
125
- }
126
- else if (navigable && !isPresent(this.removeNavigationListeners)) {
127
- this.addNavigationListeners();
128
- this.navigationService.isEnabled = true;
129
- }
130
- this._navigable = navigable;
131
- },
132
- enumerable: true,
133
- configurable: true
134
- });
135
- Object.defineProperty(ListViewComponent.prototype, "skip", {
136
- get: function () {
137
- return this._skip;
138
- },
139
- /**
140
- * Defines the number of records to be skipped by the pager
141
- * ([more details]({% slug paging_listview %})).
142
- */
143
- set: function (skip) {
144
- var parsed = parseInt(skip, 10);
145
- var defaultSkipValue = 0;
146
- this._skip = !isNaN(parsed) ? parsed : defaultSkipValue;
147
- },
148
- enumerable: true,
149
- configurable: true
150
- });
151
- Object.defineProperty(ListViewComponent.prototype, "pageable", {
152
- get: function () {
153
- return this._pageable;
154
- },
155
- /**
156
- * Configures whether the ListView will render a pager
157
- * ([more details]({% slug paging_listview %})).
158
- * Providing a boolean value will render a pager with the default settings.
159
- */
160
- set: function (pageable) {
161
- this._pageable = pageable;
162
- this.pagerSettings = pageable ? Object.assign({}, DEFAULT_PAGER_SETTINGS, pageable) : null;
163
- },
164
- enumerable: true,
165
- configurable: true
166
- });
167
- Object.defineProperty(ListViewComponent.prototype, "items", {
168
- /**
169
- * @hidden
170
- *
171
- * Gets the data items passed to the ListView.
172
- * If a ListViewDataResult is passed, the data value is used. If an array is passed - it's directly used.
173
- */
174
- get: function () {
175
- if (!isPresent(this.data)) {
176
- return [];
177
- }
178
- return Array.isArray(this.data) ? this.data : this.data.data;
179
- },
180
- enumerable: true,
181
- configurable: true
182
- });
183
- Object.defineProperty(ListViewComponent.prototype, "total", {
184
- /**
185
- * @hidden
186
- *
187
- * Gets the total number of records passed to the ListView.
188
- * If a ListViewDataResult is passed, the total value is used. If an array is passed - its length is used.
189
- */
190
- get: function () {
191
- if (!isPresent(this.data)) {
192
- return 0;
193
- }
194
- return Array.isArray(this.data) ? this.data.length : this.data.total;
195
- },
196
- enumerable: true,
197
- configurable: true
198
- });
199
- Object.defineProperty(ListViewComponent.prototype, "containerTabindex", {
200
- /**
201
- * @hidden
202
- */
203
- get: function () {
204
- // workaround for FF, where a scrollable container is focusable even without a tabindex and creates an unwanted tab stop
205
- // https://bugzilla.mozilla.org/show_bug.cgi?id=616594
206
- return this.navigable ? -1 : null;
207
- },
208
- enumerable: true,
209
- configurable: true
210
- });
211
- Object.defineProperty(ListViewComponent.prototype, "activeIndex", {
212
- /**
213
- * Gets the current active item index
214
- * ([see example]({% slug keyboard_navigation_listview %}#toc-controlling-the-focus)).
215
- * Returns `null` when the keyboard navigation is disabled.
216
- */
217
- get: function () {
218
- return this.navigationService.activeIndex;
219
- },
220
- enumerable: true,
221
- configurable: true
222
- });
223
- ListViewComponent.prototype.ngOnChanges = function (changes) {
224
- if (isChanged('height', changes, false)) {
225
- this.renderer.setStyle(this.element.nativeElement, 'height', this.height + "px");
226
- }
227
- };
228
- ListViewComponent.prototype.ngOnDestroy = function () {
229
- if (isPresent(this.editServiceSubscription)) {
230
- this.editServiceSubscription.unsubscribe();
231
- }
232
- };
233
- /**
234
- * @hidden
235
- */
236
- ListViewComponent.prototype.templateContext = function (index) {
237
- return {
238
- "$implicit": this.items[index],
239
- "isLast": index === this.items.length - 1,
240
- "isFirst": index === 0,
241
- "dataItem": this.items[index],
242
- "index": index
243
- };
244
- };
245
- /**
246
- * @hidden
247
- */
248
- ListViewComponent.prototype.editTemplateContext = function (index) {
249
- var isNew = index === -1;
250
- var group = isNew ? this.editService.newItemGroup : this.editService.editGroup(index);
251
- return {
252
- "$implicit": group,
253
- "formGroup": group,
254
- "dataItem": isNew ? this.editService.newDataItem : this.items[index],
255
- "isNew": isNew,
256
- "index": index
257
- };
258
- };
259
- /**
260
- * Focuses the item at the specified index ([see example]({% slug keyboard_navigation_listview %}#toc-controlling-the-focus)):
261
- * - If no index is specified, the current active index will be focused.
262
- * - If the passed value is below `0`, the first item receives focus.
263
- * - If the passed value is above the last available index, the last item receives focus.
264
- *
265
- * > The index param is based on the logical structure of the ListView and does not correspond to the data item index -
266
- * > i.e. the index `0` corresponds to the first rendered list item. Paging is not taken into account.
267
- * > Also, for the focusing to work, the `navigable` prop must first be set to `true`.
268
- */
269
- ListViewComponent.prototype.focus = function (index) {
270
- var totalRenderedItems = this.listViewItems.length;
271
- this.navigationService.focusIndex(index, totalRenderedItems);
272
- };
273
- /**
274
- * Creates a new item editor ([see example]({% slug editing_template_forms_listview %}#toc-adding-records)).
275
- *
276
- * @param {FormGroup} group - The [`FormGroup`]({{ site.data.urls.angular['formgroupapi'] }}) that describes
277
- * the edit form. If called with a data item, it will build the `FormGroup` from the data item fields.
278
- */
279
- ListViewComponent.prototype.addItem = function (group) {
280
- var isFormGroup = group instanceof FormGroup;
281
- if (!isFormGroup) {
282
- var fields = Object.keys(group).reduce(createControl(group), {});
283
- group = new FormGroup(fields);
284
- }
285
- this.editService.addItem(group);
286
- };
287
- /**
288
- * Switches the specified item to edit mode ([see example]({% slug editing_template_forms_listview %}#toc-editing-records)).
289
- *
290
- * @param index - The item index that will be switched to edit mode.
291
- * @param group - The [`FormGroup`]({{ site.data.urls.angular['formgroupapi'] }})
292
- * that describes the edit form.
293
- */
294
- ListViewComponent.prototype.editItem = function (index, group) {
295
- this.editService.editItem(index, group);
296
- };
297
- /**
298
- * Closes the editor for a given item ([see example]({% slug editing_template_forms_grid %}#toc-cancelling-editing)).
299
- *
300
- * @param {number} index - The item index that will be switched out of the edit mode. If no index is provided, it is assumed
301
- * that the new item editor will be closed.
302
- */
303
- ListViewComponent.prototype.closeItem = function (index) {
304
- this.editService.close(index);
305
- };
306
- /**
307
- * @hidden
308
- */
309
- ListViewComponent.prototype.isEdited = function (index) {
310
- return this.editService.isEdited(index);
311
- };
312
- /**
313
- * @hidden
314
- */
315
- ListViewComponent.prototype.handlePageChange = function (event) {
316
- this.scrollToContainerTop();
317
- var firstIndex = 0;
318
- this.navigationService.setActiveIndex(firstIndex);
319
- this.pageChange.emit(event);
320
- };
321
- /**
322
- * @hidden
323
- */
324
- ListViewComponent.prototype.handleContentScroll = function () {
325
- var _this = this;
326
- if (!hasObservers(this.scrollBottom)) {
327
- return;
328
- }
329
- var THRESHOLD = 2;
330
- var _a = this.contentContainer.nativeElement, scrollHeight = _a.scrollHeight, scrollTop = _a.scrollTop, clientHeight = _a.clientHeight;
331
- var atBottom = scrollHeight - clientHeight - scrollTop <= THRESHOLD;
332
- if (atBottom) {
333
- this.ngZone.run(function () {
334
- var event = { sender: _this };
335
- _this.scrollBottom.emit(event);
336
- });
337
- }
338
- };
339
- /**
340
- * @hidden
341
- */
342
- ListViewComponent.prototype.itemPosInSet = function (index) {
343
- // adds 1 as the aria-posinset is not zero-based and the counting starts from 1
344
- return this.skip + index + 1;
345
- };
346
- ListViewComponent.prototype.scrollToContainerTop = function () {
347
- var container = this.contentContainer.nativeElement;
348
- container.scrollTop = 0;
349
- container.scrollLeft = 0;
350
- };
351
- ListViewComponent.prototype.addNavigationListeners = function () {
352
- var _this = this;
353
- this.ngZone.runOutsideAngular(function () {
354
- var removeKeydownListener = _this.renderer.listen(_this.contentContainer.nativeElement, 'keydown', function (event) { return _this.navigationService.handleKeyDown(event, _this.listViewItems.length); });
355
- var removeFocusInListener = _this.renderer.listen(_this.contentContainer.nativeElement, 'focusin', function (event) { return _this.navigationService.handleFocusIn(event); });
356
- var removeFocusOutListener = _this.renderer.listen(_this.contentContainer.nativeElement, 'focusout', function (event) { return _this.navigationService.handleFocusOut(event); });
357
- _this.removeNavigationListeners = function () {
358
- removeKeydownListener();
359
- removeFocusInListener();
360
- removeFocusOutListener();
361
- };
362
- });
363
- };
364
- ListViewComponent.prototype.attachEditHandlers = function () {
365
- if (!isPresent(this.editService)) {
366
- return;
367
- }
368
- this.editServiceSubscription = this.editService
369
- .changes.subscribe(this.emitCRUDEvent.bind(this));
370
- };
371
- ListViewComponent.prototype.emitCRUDEvent = function (args) {
372
- var action = args.action, itemIndex = args.itemIndex, formGroup = args.formGroup;
373
- var dataItem = this.items[itemIndex];
374
- if (action !== 'add' && formGroup) {
375
- dataItem = formGroup.value;
376
- }
377
- Object.assign(args, {
378
- dataItem: dataItem,
379
- sender: this
380
- });
381
- this[action].emit(args);
382
- };
383
- tslib_1.__decorate([
384
- HostBinding('class.k-widget'),
385
- HostBinding('class.k-listview'),
386
- HostBinding('class.k-listview-bordered'),
387
- HostBinding('class.k-d-flex'),
388
- tslib_1.__metadata("design:type", Boolean)
389
- ], ListViewComponent.prototype, "className", void 0);
390
- tslib_1.__decorate([
391
- ContentChild(ItemTemplateDirective, { static: false }),
392
- tslib_1.__metadata("design:type", ItemTemplateDirective)
393
- ], ListViewComponent.prototype, "itemTemplate", void 0);
394
- tslib_1.__decorate([
395
- ContentChild(HeaderTemplateDirective, { static: false }),
396
- tslib_1.__metadata("design:type", HeaderTemplateDirective)
397
- ], ListViewComponent.prototype, "headerTemplate", void 0);
398
- tslib_1.__decorate([
399
- ContentChild(FooterTemplateDirective, { static: false }),
400
- tslib_1.__metadata("design:type", FooterTemplateDirective)
401
- ], ListViewComponent.prototype, "footerTemplate", void 0);
402
- tslib_1.__decorate([
403
- ContentChild(LoaderTemplateDirective, { static: false }),
404
- tslib_1.__metadata("design:type", LoaderTemplateDirective)
405
- ], ListViewComponent.prototype, "loaderTemplate", void 0);
406
- tslib_1.__decorate([
407
- ViewChild('contentContainer', { static: true }),
408
- tslib_1.__metadata("design:type", ElementRef)
409
- ], ListViewComponent.prototype, "contentContainer", void 0);
410
- tslib_1.__decorate([
411
- ContentChild(EditTemplateDirective, { static: false }),
412
- tslib_1.__metadata("design:type", EditTemplateDirective)
413
- ], ListViewComponent.prototype, "editTemplate", void 0);
414
- tslib_1.__decorate([
415
- ViewChildren(ListViewNavigableItemDirective),
416
- tslib_1.__metadata("design:type", QueryList)
417
- ], ListViewComponent.prototype, "listViewItems", void 0);
418
- tslib_1.__decorate([
419
- Input(),
420
- tslib_1.__metadata("design:type", Object)
421
- ], ListViewComponent.prototype, "data", void 0);
422
- tslib_1.__decorate([
423
- Input(),
424
- tslib_1.__metadata("design:type", Boolean)
425
- ], ListViewComponent.prototype, "loading", void 0);
426
- tslib_1.__decorate([
427
- Input(),
428
- tslib_1.__metadata("design:type", Object)
429
- ], ListViewComponent.prototype, "containerStyle", void 0);
430
- tslib_1.__decorate([
431
- Input(),
432
- tslib_1.__metadata("design:type", Object)
433
- ], ListViewComponent.prototype, "itemStyle", void 0);
434
- tslib_1.__decorate([
435
- Input(),
436
- tslib_1.__metadata("design:type", Object)
437
- ], ListViewComponent.prototype, "containerClass", void 0);
438
- tslib_1.__decorate([
439
- Input(),
440
- tslib_1.__metadata("design:type", Object)
441
- ], ListViewComponent.prototype, "itemClass", void 0);
442
- tslib_1.__decorate([
443
- Input(),
444
- tslib_1.__metadata("design:type", String)
445
- ], ListViewComponent.prototype, "containerLabel", void 0);
446
- tslib_1.__decorate([
447
- Input(),
448
- tslib_1.__metadata("design:type", String)
449
- ], ListViewComponent.prototype, "containerRole", void 0);
450
- tslib_1.__decorate([
451
- Input(),
452
- tslib_1.__metadata("design:type", String)
453
- ], ListViewComponent.prototype, "listItemRole", void 0);
454
- tslib_1.__decorate([
455
- Input(),
456
- tslib_1.__metadata("design:type", Boolean),
457
- tslib_1.__metadata("design:paramtypes", [Boolean])
458
- ], ListViewComponent.prototype, "navigable", null);
459
- tslib_1.__decorate([
460
- Input(),
461
- tslib_1.__metadata("design:type", Number)
462
- ], ListViewComponent.prototype, "pageSize", void 0);
463
- tslib_1.__decorate([
464
- Input(),
465
- tslib_1.__metadata("design:type", Number),
466
- tslib_1.__metadata("design:paramtypes", [Number])
467
- ], ListViewComponent.prototype, "skip", null);
468
- tslib_1.__decorate([
469
- Input(),
470
- tslib_1.__metadata("design:type", Object),
471
- tslib_1.__metadata("design:paramtypes", [Object])
472
- ], ListViewComponent.prototype, "pageable", null);
473
- tslib_1.__decorate([
474
- Input(),
475
- tslib_1.__metadata("design:type", Number)
476
- ], ListViewComponent.prototype, "height", void 0);
477
- tslib_1.__decorate([
478
- Output(),
479
- tslib_1.__metadata("design:type", EventEmitter)
480
- ], ListViewComponent.prototype, "scrollBottom", void 0);
481
- tslib_1.__decorate([
482
- Output(),
483
- tslib_1.__metadata("design:type", EventEmitter)
484
- ], ListViewComponent.prototype, "pageChange", void 0);
485
- tslib_1.__decorate([
486
- Output(),
487
- tslib_1.__metadata("design:type", EventEmitter)
488
- ], ListViewComponent.prototype, "pageSizeChange", void 0);
489
- tslib_1.__decorate([
490
- Output(),
491
- tslib_1.__metadata("design:type", EventEmitter)
492
- ], ListViewComponent.prototype, "edit", void 0);
493
- tslib_1.__decorate([
494
- Output(),
495
- tslib_1.__metadata("design:type", EventEmitter)
496
- ], ListViewComponent.prototype, "cancel", void 0);
497
- tslib_1.__decorate([
498
- Output(),
499
- tslib_1.__metadata("design:type", EventEmitter)
500
- ], ListViewComponent.prototype, "save", void 0);
501
- tslib_1.__decorate([
502
- Output(),
503
- tslib_1.__metadata("design:type", EventEmitter)
504
- ], ListViewComponent.prototype, "remove", void 0);
505
- tslib_1.__decorate([
506
- Output(),
507
- tslib_1.__metadata("design:type", EventEmitter)
508
- ], ListViewComponent.prototype, "add", void 0);
509
- ListViewComponent = tslib_1.__decorate([
510
- Component({
511
- changeDetection: ChangeDetectionStrategy.OnPush,
512
- exportAs: 'kendoListView',
513
- selector: 'kendo-listview',
514
- providers: [
515
- EditService,
516
- NavigationService,
517
- LocalizationService,
518
- {
519
- provide: L10N_PREFIX,
520
- useValue: 'kendo.listview'
521
- }
522
- ],
523
- template: "\n <!-- top pager -->\n <ng-template\n *ngIf=\"pagerSettings?.position !== 'bottom'\"\n [ngTemplateOutlet]=\"pagerTemplate\"\n [ngTemplateOutletContext]=\"{ pagerClass: 'k-listview-pager k-listview-pager-top' }\"\n >\n </ng-template>\n\n <!-- header -->\n <div\n *ngIf=\"headerTemplate\"\n class=\"k-listview-header\"\n >\n <ng-template\n [ngTemplateOutlet]=\"headerTemplate?.templateRef\"\n >\n </ng-template>\n </div>\n\n <!-- content -->\n <div\n #contentContainer\n [attr.tabindex]=\"containerTabindex\"\n class=\"k-listview-content\"\n [ngClass]=\"containerClass\"\n [ngStyle]=\"containerStyle\"\n [kendoEventsOutsideAngular]=\"{\n scroll: handleContentScroll\n }\"\n [scope]=\"this\"\n [attr.role]=\"containerRole\"\n [attr.aria-label]=\"containerLabel\"\n >\n <!-- new item edit template -->\n <div\n *ngIf=\"editService.hasNewItem\"\n class=\"k-listview-item\"\n [attr.role]=\"listItemRole\"\n kendoListViewNavigableItem\n [index]=\"-1\"\n [attr.data-kendo-listview-item-index]=\"-1\"\n [ngClass]=\"itemClass\"\n [ngStyle]=\"itemStyle\"\n >\n <ng-template\n *ngIf=\"editTemplate\"\n [ngTemplateOutlet]=\"editTemplate?.templateRef\"\n [ngTemplateOutletContext]=\"editTemplateContext(-1)\"\n >\n </ng-template>\n </div>\n\n <!-- items -->\n <div\n *ngFor=\"let dataItem of items; let index = index; let first = first; let last = last;\"\n class=\"k-listview-item\"\n [attr.role]=\"listItemRole\"\n [attr.aria-posinset]=\"itemPosInSet(index)\"\n [attr.aria-setsize]=\"total\"\n kendoListViewNavigableItem\n [index]=\"index\"\n [attr.data-kendo-listview-item-index]=\"index\"\n [ngClass]=\"itemClass\"\n [ngStyle]=\"itemStyle\"\n >\n <ng-template\n [ngTemplateOutlet]=\"isEdited(index) ? editTemplate?.templateRef : itemTemplate?.templateRef\"\n [ngTemplateOutletContext]=\"isEdited(index) ? editTemplateContext(index) : templateContext(index)\"\n >\n </ng-template>\n </div>\n\n <!-- loading indicator -->\n <div\n *ngIf=\"loading && !loaderTemplate\"\n class=\"k-loading-mask\"\n >\n <!-- TODO: the k-loading-text is hidden with css but read by readers - review when implementing accessibility + possible localization case -->\n <span class=\"k-loading-text\">Loading</span>\n <div class=\"k-loading-image\"></div>\n <div class=\"k-loading-color\"></div>\n </div>\n <ng-template\n *ngIf=\"loading && loaderTemplate\"\n [ngTemplateOutlet]=\"loaderTemplate.templateRef\"\n >\n </ng-template>\n </div>\n\n <!-- footer -->\n <div\n *ngIf=\"footerTemplate\"\n class=\"k-listview-footer\"\n >\n <ng-template\n [ngTemplateOutlet]=\"footerTemplate?.templateRef\"\n >\n </ng-template>\n </div>\n\n <!-- bottom pager -->\n <ng-template\n *ngIf=\"pagerSettings?.position !== 'top'\"\n [ngTemplateOutlet]=\"pagerTemplate\"\n [ngTemplateOutletContext]=\"{ pagerClass: 'k-listview-pager' }\"\n >\n </ng-template>\n\n <!-- pager template -->\n <ng-template #pagerTemplate let-pagerClass=\"pagerClass\">\n <kendo-datapager\n *ngIf=\"pageable\"\n [class]=\"pagerClass\"\n [total]=\"total\"\n [pageSize]=\"pageSize\"\n [skip]=\"skip\"\n [buttonCount]=\"pagerSettings.buttonCount\"\n [info]=\"pagerSettings.info\"\n [previousNext]=\"pagerSettings.previousNext\"\n [type]=\"pagerSettings.type\"\n [pageSizeValues]=\"pagerSettings.pageSizeValues\"\n (pageChange)=\"handlePageChange($event)\"\n (pageSizeChange)=\"pageSizeChange.emit($event)\"\n >\n </kendo-datapager>\n </ng-template>\n "
524
- }),
525
- tslib_1.__metadata("design:paramtypes", [NgZone,
526
- ElementRef,
527
- Renderer2,
528
- EditService,
529
- NavigationService])
530
- ], ListViewComponent);
531
- return ListViewComponent;
532
- }());
533
- export { ListViewComponent };
534
- export { ɵ0 };
@@ -1,83 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 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 tslib_1 from "tslib";
6
- import { NgModule } from '@angular/core';
7
- import { CommonModule } from '@angular/common';
8
- import { PagerModule } from '@progress/kendo-angular-pager';
9
- import { EventsModule } from '@progress/kendo-angular-common';
10
- import { ListViewComponent } from './listview.component';
11
- import { ListViewNavigableItemDirective } from './navigation/listview-navigable-item.directive';
12
- import { ItemTemplateDirective } from './templates/item-template.directive';
13
- import { HeaderTemplateDirective } from './templates/header-template.directive';
14
- import { FooterTemplateDirective } from './templates/footer-template.directive';
15
- import { TemplateContextDirective } from './templates/template-context.directive';
16
- import { LoaderTemplateDirective } from './templates/loader-template.directive';
17
- import { DataBindingDirective } from './data-binding/data-binding.directive';
18
- import { EditTemplateDirective } from './editing/edit-template.directive';
19
- import { EditCommandDirective } from './editing/commands/edit-command.directive';
20
- import { CancelCommandDirective } from './editing/commands/cancel-command.directive';
21
- import { SaveCommandDirective } from './editing/commands/save-command.directive';
22
- import { RemoveCommandDirective } from './editing/commands/remove-command.directive';
23
- import { AddCommandDirective } from './editing/commands/add-command.directive';
24
- var TEMPLATE_DIRECTIVES = [
25
- ItemTemplateDirective,
26
- HeaderTemplateDirective,
27
- FooterTemplateDirective,
28
- LoaderTemplateDirective
29
- ];
30
- var BINDING_DIRECTIVES = [
31
- DataBindingDirective
32
- ];
33
- var EDITING_DIRECTIVES = [
34
- EditTemplateDirective,
35
- EditCommandDirective,
36
- CancelCommandDirective,
37
- SaveCommandDirective,
38
- RemoveCommandDirective,
39
- AddCommandDirective
40
- ];
41
- /**
42
- * The exported package module.
43
- *
44
- * The package exports:
45
- * - [`ListViewComponent`]({% slug api_listview_listviewcomponent %})&mdash;The ListView component class.
46
- * - [`ItemTemplateDirective`]({% slug api_listview_itemtemplatedirective %})&mdash;The item template directive.
47
- * - [`HeaderTemplateDirective`]({% slug api_listview_headertemplatedirective %})&mdash;The header template directive.
48
- * - [`FooterTemplateDirective`]({% slug api_listview_footertemplatedirective %})&mdash;The footer template directive.
49
- * - [`LoaderTemplateDirective`]({% slug api_listview_loadertemplatedirective %})&mdash;The loeader template directive.
50
- * - [`DataBindingDirective`]({% slug api_listview_databindingdirective %})&mdash;The data binding directive.
51
- * - [`EditTemplateDirective`]({% slug api_listview_editingdirective %}&mdash;The editing template directive.
52
- */
53
- var ListViewModule = /** @class */ (function () {
54
- function ListViewModule() {
55
- }
56
- ListViewModule = tslib_1.__decorate([
57
- NgModule({
58
- declarations: [
59
- TEMPLATE_DIRECTIVES,
60
- BINDING_DIRECTIVES,
61
- EDITING_DIRECTIVES,
62
- ListViewComponent,
63
- TemplateContextDirective,
64
- ListViewNavigableItemDirective
65
- ],
66
- exports: [
67
- TEMPLATE_DIRECTIVES,
68
- BINDING_DIRECTIVES,
69
- EDITING_DIRECTIVES,
70
- ListViewComponent,
71
- CommonModule,
72
- EventsModule
73
- ],
74
- imports: [
75
- CommonModule,
76
- PagerModule,
77
- EventsModule
78
- ]
79
- })
80
- ], ListViewModule);
81
- return ListViewModule;
82
- }());
83
- export { ListViewModule };
@@ -1,18 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 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 tslib_1 from "tslib";
6
- import { PageSizeChangeEvent as PagerPageSizeChangeEvent } from "@progress/kendo-angular-pager";
7
- /**
8
- * The arguments of the [`pageSizeChange`]({% slug api_listview_listviewcomponent %}#toc-pagesizechange) event of the ListView
9
- * ([more details]({% slug paging_listview %}).
10
- */
11
- var PageSizeChangeEvent = /** @class */ (function (_super) {
12
- tslib_1.__extends(PageSizeChangeEvent, _super);
13
- function PageSizeChangeEvent() {
14
- return _super !== null && _super.apply(this, arguments) || this;
15
- }
16
- return PageSizeChangeEvent;
17
- }(PagerPageSizeChangeEvent));
18
- export { PageSizeChangeEvent };