@progress/kendo-angular-grid 19.3.1-develop.4 → 20.0.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/codemods/template-transformer/index.js +94 -0
  2. package/codemods/utils.js +553 -0
  3. package/codemods/v20/grid-kendogridgroupbinding.js +51 -0
  4. package/common/provider.service.d.ts +3 -2
  5. package/databinding.directive.d.ts +0 -3
  6. package/directives.d.ts +3 -4
  7. package/esm2022/common/error-messages.mjs +0 -6
  8. package/esm2022/common/provider.service.mjs +1 -0
  9. package/esm2022/data/data.iterators.mjs +0 -7
  10. package/esm2022/databinding.directive.mjs +4 -4
  11. package/esm2022/directives.mjs +0 -3
  12. package/esm2022/grid.component.mjs +63 -31
  13. package/esm2022/grid.module.mjs +15 -16
  14. package/esm2022/grouping/group-header.component.mjs +6 -3
  15. package/esm2022/index.mjs +0 -1
  16. package/esm2022/navigation/navigation-metadata.mjs +4 -2
  17. package/esm2022/navigation/navigation.service.mjs +4 -2
  18. package/esm2022/package-metadata.mjs +2 -2
  19. package/esm2022/pdf/pdf.component.mjs +16 -0
  20. package/esm2022/pdf/pdf.service.mjs +1 -0
  21. package/esm2022/rendering/list.component.mjs +188 -92
  22. package/esm2022/rendering/table-body.component.mjs +19 -5
  23. package/esm2022/scrolling/row-height.service.mjs +23 -65
  24. package/esm2022/scrolling/scroller.service.mjs +175 -35
  25. package/fesm2022/progress-kendo-angular-grid.mjs +508 -588
  26. package/grid.component.d.ts +6 -6
  27. package/grid.module.d.ts +14 -15
  28. package/grouping/group-header.component.d.ts +1 -1
  29. package/index.d.ts +0 -2
  30. package/navigation/navigation-metadata.d.ts +2 -1
  31. package/package.json +36 -21
  32. package/pdf/pdf.component.d.ts +1 -0
  33. package/pdf/pdf.service.d.ts +1 -0
  34. package/rendering/list.component.d.ts +11 -5
  35. package/rendering/table-body.component.d.ts +3 -2
  36. package/schematics/ngAdd/index.js +4 -4
  37. package/scrolling/row-height.service.d.ts +3 -8
  38. package/scrolling/scroller.service.d.ts +35 -9
  39. package/esm2022/grouping/group-scroll-binding.directive.mjs +0 -347
  40. package/esm2022/grouping/virtual-group-result.interface.mjs +0 -5
  41. package/grouping/group-scroll-binding.directive.d.ts +0 -85
  42. package/grouping/virtual-group-result.interface.d.ts +0 -18
@@ -1,347 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { Directive, Input, ChangeDetectorRef, isDevMode } from '@angular/core';
6
- import { DataBindingDirective } from "../databinding.directive";
7
- import { filterBy, process } from "@progress/kendo-data-query";
8
- import { isPresent, isArray } from "../utils";
9
- import { diffFilters, cloneFilters } from "../common/filter-descriptor-differ";
10
- import { LocalDataChangesService } from "../editing/local-data-changes.service";
11
- import { GridConfigurationErrorMessages } from '../common/error-messages';
12
- import { ContextService } from '../common/provider.service';
13
- import { GroupsService } from './groups.service';
14
- import { Subscription } from 'rxjs';
15
- import * as i0 from "@angular/core";
16
- import * as i1 from "../editing/local-data-changes.service";
17
- import * as i2 from "../common/provider.service";
18
- import * as i3 from "./groups.service";
19
- const hasGroups = (items) => items && items.length && items[0].field && items[0].items;
20
- const groupDescriptorsPresent = (descriptors) => isPresent(descriptors) && descriptors.length > 0;
21
- const processGroups = (data, state) => process(data, state).data;
22
- const removeParentDescriptors = (parents, owner) => g => g.field !== owner.field && !parents.some(y => y.field === g.field);
23
- const findGroup = (groupIndex, groups) => {
24
- const parents = [];
25
- return {
26
- group: groupIndex.split("_").reduce((acc, x) => {
27
- const idx = parseInt(x, 10);
28
- if (acc.items) {
29
- parents.push(acc);
30
- return acc.items[idx];
31
- }
32
- return isArray(acc) ? acc[idx] : acc;
33
- }, groups),
34
- parents
35
- };
36
- };
37
- const findChildren = (data, parents) => {
38
- const filters = parents.map(p => ({ field: p.field, operator: "eq", value: p.value }));
39
- return filterBy(data, {
40
- filters: filters,
41
- logic: "and"
42
- });
43
- };
44
- /**
45
- * @hidden
46
- */
47
- export const count = (groups, includeFooters = false) => (groups.reduce((acc, group) => {
48
- if (!group.skipHeader) {
49
- acc++;
50
- }
51
- if (group.items) {
52
- const children = count(group.items, includeFooters);
53
- if (includeFooters && children && !group.hideFooter) {
54
- acc++;
55
- }
56
- acc += children;
57
- }
58
- return acc;
59
- }, 0));
60
- /**
61
- * @hidden
62
- */
63
- export const noDescriptors = (descriptors) => !isPresent(descriptors) || !descriptors.length;
64
- /**
65
- * @hidden
66
- */
67
- export const slice = (groups, skip, take, includeFooters = false) => {
68
- if (!isPresent(take)) {
69
- return groups;
70
- }
71
- const result = [];
72
- for (let idx = 0, length = groups.length; idx < length; idx++) {
73
- if (take <= 0) {
74
- break;
75
- }
76
- const group = groups[idx];
77
- const groupItems = group.items;
78
- let itemCount = count(groupItems, includeFooters);
79
- if (includeFooters && groupItems.length) {
80
- itemCount++;
81
- }
82
- const skipHeader = skip > 0;
83
- if (skip) {
84
- skip--;
85
- if (itemCount && skip >= itemCount) {
86
- skip -= itemCount;
87
- continue;
88
- }
89
- }
90
- if (!skipHeader || itemCount) {
91
- const items = [];
92
- let hideFooter = true;
93
- if (!skipHeader) {
94
- take--;
95
- }
96
- if (take) {
97
- if (hasGroups(groupItems)) {
98
- const children = slice(groupItems, skip, take, includeFooters);
99
- items.push(...children);
100
- take -= count(children, includeFooters);
101
- }
102
- else {
103
- items.push(...groupItems.slice(skip, Math.min(skip + take, groupItems.length)));
104
- take -= items.length;
105
- }
106
- if (take && includeFooters) {
107
- hideFooter = false;
108
- take--;
109
- }
110
- skip = 0;
111
- }
112
- result.push({
113
- aggregates: group.aggregates,
114
- field: group.field,
115
- hideFooter,
116
- items,
117
- offset: idx,
118
- skipHeader,
119
- value: group.value
120
- });
121
- }
122
- }
123
- return result;
124
- };
125
- const skippedHeaders = (groupItem) => {
126
- let total = 0;
127
- while (groupItem) {
128
- if (groupItem.skipHeader) {
129
- total++;
130
- }
131
- groupItem = groupItem.items && groupItem.items[0] || null;
132
- }
133
- return total;
134
- };
135
- /**
136
- * A directive which encapsulates the in-memory handling of grouping with virtual scrolling.
137
- * @remarks
138
- * Applied to: {@link GridComponent}.
139
- */
140
- export class GroupBindingDirective extends DataBindingDirective {
141
- groupsService;
142
- /**
143
- * The array of data which will be used to populate the Grid.
144
- */
145
- set kendoGridGroupBinding(value) {
146
- this.groups = null;
147
- this.grid.resetGroupsState();
148
- this.data = value;
149
- }
150
- /**
151
- * @hidden
152
- */
153
- set data(value) {
154
- this.originalData = value || [];
155
- this.dataChanged = true;
156
- }
157
- /**
158
- * Defines the descriptors by which the data will be sorted.
159
- */
160
- set sort(value) {
161
- const noCurrentDescriptors = noDescriptors(this.state.sort);
162
- const noIncomingDescriptors = noDescriptors(value);
163
- const clear = this.state.sort !== value && !(noCurrentDescriptors && noIncomingDescriptors);
164
- this.grid.sort = this.state.sort = value;
165
- if (clear) {
166
- this.groups = null;
167
- this.grid.resetGroupsState();
168
- }
169
- }
170
- /**
171
- * Defines the descriptor by which the data will be filtered.
172
- */
173
- set filter(value) {
174
- const clear = diffFilters(this.state.filter, value);
175
- if (clear) {
176
- this.state.filter = value;
177
- this.grid.filter = cloneFilters(value);
178
- this.groups = null;
179
- this.grid.resetGroupsState();
180
- }
181
- }
182
- /**
183
- * Defines the descriptors by which the data will be grouped.
184
- */
185
- set group(value) {
186
- // don't clear if no groups are present in previous and current value
187
- const groupsPresent = groupDescriptorsPresent(this.state.group) || groupDescriptorsPresent(value);
188
- const clear = this.state.group !== value && groupsPresent;
189
- this.grid.group = this.state.group = value;
190
- if (clear) {
191
- this.groups = null;
192
- this.grid.resetGroupsState();
193
- this.skip = 0;
194
- }
195
- }
196
- groups;
197
- gridSubs = new Subscription();
198
- constructor(changeDetector, localDataChangesService, ctxService, groupsService) {
199
- super(ctxService.grid, changeDetector, localDataChangesService, null, ctxService);
200
- this.groupsService = groupsService;
201
- ctxService.dataBindingDirective = this;
202
- }
203
- ngOnInit() {
204
- super.ngOnInit();
205
- this.gridSubs.add(this.grid.groupExpand.subscribe(this.groupExpand.bind(this)));
206
- this.gridSubs.add(this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this)));
207
- }
208
- ngAfterContentInit() {
209
- if (isDevMode() && this.grid.isGroupExpanded) {
210
- throw new Error(GridConfigurationErrorMessages.groupBindingDirectives);
211
- }
212
- }
213
- ngOnDestroy() {
214
- this.gridSubs.unsubscribe();
215
- }
216
- /**
217
- * @hidden
218
- */
219
- toggleAll(expand) {
220
- this.skip = 0;
221
- this.grid.scrollTo({ row: 0, column: 0 });
222
- this.groups.forEach((gr, idx) => {
223
- const expanded = this.groupsService.isExpanded({
224
- group: gr,
225
- groupIndex: idx.toString(),
226
- parentGroup: undefined
227
- });
228
- const performToggle = (expand && !expanded) || (!expand && expanded);
229
- if (performToggle) {
230
- this.grid.groupsService.toggleRow({
231
- type: 'group',
232
- data: gr,
233
- index: idx.toString(),
234
- level: 0,
235
- parentGroup: undefined
236
- });
237
- this[expand ? 'groupExpand' : 'groupCollapse']({ groupIndex: idx.toString() });
238
- }
239
- });
240
- }
241
- /**
242
- * Collapses all expanded root level groups.
243
- */
244
- collapseAll() {
245
- this.toggleAll(false);
246
- }
247
- /**
248
- * Expands all expanded root level groups.
249
- */
250
- expandAll() {
251
- this.toggleAll(true);
252
- }
253
- /**
254
- * @hidden
255
- */
256
- groupExpand({ groupIndex }) {
257
- const { group, parents } = findGroup(groupIndex, this.groups);
258
- if (!group) {
259
- return;
260
- }
261
- this.groupsService.expandChildren(groupIndex);
262
- if (!group.items.length) {
263
- const descriptors = this.state.group.filter(removeParentDescriptors(parents, group));
264
- const children = findChildren(this.originalData, parents.concat(group));
265
- group.items = processGroups(children, {
266
- filter: this.state.filter,
267
- group: descriptors,
268
- sort: this.state.sort
269
- });
270
- }
271
- this.grid.data = this.dataResult(this.state.skip, this.state.take);
272
- }
273
- /**
274
- * @hidden
275
- */
276
- groupCollapse({ groupIndex }) {
277
- const { group } = findGroup(groupIndex, this.groups);
278
- if (group) {
279
- group.items = [];
280
- }
281
- else {
282
- return;
283
- }
284
- this.grid.data = this.dataResult(this.state.skip, this.state.take);
285
- }
286
- process(state) {
287
- if (this.grid.isVirtual && (!isPresent(state.take) || state.take === 0)) {
288
- return {
289
- data: [],
290
- total: this.originalData?.length || 0
291
- };
292
- }
293
- if (state.group && state.group.length) {
294
- const groups = this.processGroups(state);
295
- this.grid.skip -= skippedHeaders(groups.data[0]);
296
- return groups;
297
- }
298
- else {
299
- this.groups = null;
300
- }
301
- return super.process(state);
302
- }
303
- processGroups(state) {
304
- if (!this.groups || !this.groups.length) {
305
- this.groups = processGroups(this.originalData, {
306
- filter: state.filter,
307
- group: state.group,
308
- sort: state.sort
309
- });
310
- }
311
- return this.dataResult(state.skip, state.take);
312
- }
313
- dataResult(skip, take) {
314
- const includeFooters = this.grid.showGroupFooters;
315
- return {
316
- data: slice(this.groups, skip, take, includeFooters),
317
- total: count(this.groups, includeFooters)
318
- };
319
- }
320
- applyState({ skip, take, sort, group, filter }) {
321
- this.skip = skip;
322
- this.state.take = take;
323
- // this.pageSize = take; // do need to update take as the process with slice correctly
324
- this.sort = sort;
325
- this.group = group;
326
- this.filter = filter;
327
- }
328
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupBindingDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.LocalDataChangesService }, { token: i2.ContextService }, { token: i3.GroupsService }], target: i0.ɵɵFactoryTarget.Directive });
329
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: GroupBindingDirective, isStandalone: true, selector: "[kendoGridGroupBinding]", inputs: { kendoGridGroupBinding: "kendoGridGroupBinding", sort: "sort", filter: "filter", group: "group" }, exportAs: ["kendoGridGroupBinding"], usesInheritance: true, ngImport: i0 });
330
- }
331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupBindingDirective, decorators: [{
332
- type: Directive,
333
- args: [{
334
- selector: '[kendoGridGroupBinding]',
335
- exportAs: 'kendoGridGroupBinding',
336
- standalone: true
337
- }]
338
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.LocalDataChangesService }, { type: i2.ContextService }, { type: i3.GroupsService }]; }, propDecorators: { kendoGridGroupBinding: [{
339
- type: Input,
340
- args: ["kendoGridGroupBinding"]
341
- }], sort: [{
342
- type: Input
343
- }], filter: [{
344
- type: Input
345
- }], group: [{
346
- type: Input
347
- }] } });
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,85 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { ChangeDetectorRef, AfterContentInit } from '@angular/core';
6
- import { DataBindingDirective } from "../databinding.directive";
7
- import { CompositeFilterDescriptor, GroupDescriptor, SortDescriptor, State } from "@progress/kendo-data-query";
8
- import { GridDataResult } from "../data/data.collection";
9
- import { VirtualGroupResult } from "./virtual-group-result.interface";
10
- import { LocalDataChangesService } from "../editing/local-data-changes.service";
11
- import { ContextService } from '../common/provider.service';
12
- import { GroupsService } from './groups.service';
13
- import * as i0 from "@angular/core";
14
- /**
15
- * @hidden
16
- */
17
- export declare const count: (groups: any[], includeFooters?: boolean) => any;
18
- /**
19
- * @hidden
20
- */
21
- export declare const noDescriptors: (descriptors?: any[]) => boolean;
22
- /**
23
- * @hidden
24
- */
25
- export declare const slice: (groups: any[], skip: number, take: number, includeFooters?: boolean) => VirtualGroupResult[];
26
- /**
27
- * A directive which encapsulates the in-memory handling of grouping with virtual scrolling.
28
- * @remarks
29
- * Applied to: {@link GridComponent}.
30
- */
31
- export declare class GroupBindingDirective extends DataBindingDirective implements AfterContentInit {
32
- private groupsService;
33
- /**
34
- * The array of data which will be used to populate the Grid.
35
- */
36
- set kendoGridGroupBinding(value: any[]);
37
- /**
38
- * @hidden
39
- */
40
- set data(value: any[]);
41
- /**
42
- * Defines the descriptors by which the data will be sorted.
43
- */
44
- set sort(value: SortDescriptor[]);
45
- /**
46
- * Defines the descriptor by which the data will be filtered.
47
- */
48
- set filter(value: CompositeFilterDescriptor);
49
- /**
50
- * Defines the descriptors by which the data will be grouped.
51
- */
52
- set group(value: GroupDescriptor[]);
53
- private groups;
54
- private gridSubs;
55
- constructor(changeDetector: ChangeDetectorRef, localDataChangesService: LocalDataChangesService, ctxService: ContextService, groupsService: GroupsService);
56
- ngOnInit(): void;
57
- ngAfterContentInit(): void;
58
- ngOnDestroy(): void;
59
- /**
60
- * @hidden
61
- */
62
- toggleAll(expand: boolean): void;
63
- /**
64
- * Collapses all expanded root level groups.
65
- */
66
- collapseAll(): void;
67
- /**
68
- * Expands all expanded root level groups.
69
- */
70
- expandAll(): void;
71
- /**
72
- * @hidden
73
- */
74
- groupExpand({ groupIndex }: any): void;
75
- /**
76
- * @hidden
77
- */
78
- groupCollapse({ groupIndex }: any): void;
79
- protected process(state: State): GridDataResult;
80
- protected processGroups(state: State): GridDataResult;
81
- protected dataResult(skip: number, take: number): GridDataResult;
82
- protected applyState({ skip, take, sort, group, filter }: State): void;
83
- static ɵfac: i0.ɵɵFactoryDeclaration<GroupBindingDirective, never>;
84
- static ɵdir: i0.ɵɵDirectiveDeclaration<GroupBindingDirective, "[kendoGridGroupBinding]", ["kendoGridGroupBinding"], { "kendoGridGroupBinding": { "alias": "kendoGridGroupBinding"; "required": false; }; "sort": { "alias": "sort"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "group": { "alias": "group"; "required": false; }; }, {}, never, never, true, never>;
85
- }
@@ -1,18 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { GroupResult } from "@progress/kendo-data-query";
6
- /**
7
- * Describes the group result used for virtual scrolling.
8
- */
9
- export interface VirtualGroupResult extends GroupResult {
10
- /**
11
- * If `true`, skips rendering the group header.
12
- */
13
- skipHeader: boolean;
14
- /**
15
- * Specifies the absolute index of the current group.
16
- */
17
- offset: number;
18
- }