@progress/kendo-angular-grid 19.0.0-develop.9 → 19.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 (133) hide show
  1. package/adaptiveness/adaptive-mode.d.ts +12 -0
  2. package/adaptiveness/adaptive-renderer.component.d.ts +89 -0
  3. package/codemods/template-transformer/index.js +94 -0
  4. package/codemods/utils.js +553 -0
  5. package/codemods/v19/grid-kendogridgroupbinding.js +51 -0
  6. package/column-menu/column-chooser.component.d.ts +4 -0
  7. package/column-menu/column-list.component.d.ts +10 -3
  8. package/column-menu/column-menu-item.component.d.ts +48 -3
  9. package/column-menu/column-menu-item.directive.d.ts +5 -2
  10. package/column-menu/column-menu.component.d.ts +4 -2
  11. package/columns/column-base.d.ts +5 -0
  12. package/columns/span-column.component.d.ts +2 -2
  13. package/common/adaptiveness.service.d.ts +50 -0
  14. package/common/single-popup.service.d.ts +3 -1
  15. package/common/toolbar-tool-base.directive.d.ts +26 -0
  16. package/directives.d.ts +13 -5
  17. package/editing/add-command-tool.directive.d.ts +7 -6
  18. package/editing/cancel-command-tool.directive.d.ts +38 -0
  19. package/editing/edit-command-tool.directive.d.ts +38 -0
  20. package/editing/edit.service.d.ts +1 -1
  21. package/editing/remove-command-tool.directive.d.ts +39 -0
  22. package/editing/save-command-tool.directive.d.ts +38 -0
  23. package/editing/toolbar-editing-tool-base.directive.d.ts +29 -0
  24. package/editing-directives/editing-directive-base.d.ts +4 -1
  25. package/editing-directives/external-editing.directive.d.ts +3 -1
  26. package/esm2022/adaptiveness/adaptive-mode.mjs +5 -0
  27. package/esm2022/adaptiveness/adaptive-renderer.component.mjs +1197 -0
  28. package/esm2022/column-menu/column-chooser.component.mjs +13 -11
  29. package/esm2022/column-menu/column-list.component.mjs +51 -8
  30. package/esm2022/column-menu/column-menu-autosize-all.component.mjs +1 -1
  31. package/esm2022/column-menu/column-menu-autosize.component.mjs +1 -1
  32. package/esm2022/column-menu/column-menu-chooser.component.mjs +1 -1
  33. package/esm2022/column-menu/column-menu-container.component.mjs +1 -1
  34. package/esm2022/column-menu/column-menu-filter.component.mjs +1 -1
  35. package/esm2022/column-menu/column-menu-item.component.mjs +123 -12
  36. package/esm2022/column-menu/column-menu-item.directive.mjs +14 -5
  37. package/esm2022/column-menu/column-menu-lock.component.mjs +1 -1
  38. package/esm2022/column-menu/column-menu-position.component.mjs +1 -1
  39. package/esm2022/column-menu/column-menu-sort.component.mjs +1 -1
  40. package/esm2022/column-menu/column-menu-stick.component.mjs +1 -1
  41. package/esm2022/column-menu/column-menu.component.mjs +68 -44
  42. package/esm2022/column-resizing/column-handle.directive.mjs +2 -2
  43. package/esm2022/columns/column-base.mjs +9 -0
  44. package/esm2022/columns/columns-container.mjs +1 -1
  45. package/esm2022/columns/span-column.component.mjs +9 -9
  46. package/esm2022/common/adaptiveness.service.mjs +72 -0
  47. package/esm2022/common/single-popup.service.mjs +9 -3
  48. package/esm2022/common/toolbar-tool-base.directive.mjs +81 -0
  49. package/esm2022/directives.mjs +21 -4
  50. package/esm2022/editing/add-command-tool.directive.mjs +12 -15
  51. package/esm2022/editing/cancel-command-tool.directive.mjs +64 -0
  52. package/esm2022/editing/edit-command-tool.directive.mjs +59 -0
  53. package/esm2022/editing/remove-command-tool.directive.mjs +60 -0
  54. package/esm2022/editing/remove-command.directive.mjs +1 -0
  55. package/esm2022/editing/save-command-tool.directive.mjs +64 -0
  56. package/esm2022/editing/toolbar-editing-tool-base.directive.mjs +94 -0
  57. package/esm2022/editing-directives/editing-directive-base.mjs +5 -2
  58. package/esm2022/editing-directives/external-editing.directive.mjs +28 -14
  59. package/esm2022/excel/excel-command-tool.directive.mjs +12 -17
  60. package/esm2022/filtering/filter-input.directive.mjs +14 -2
  61. package/esm2022/filtering/menu/boolean-filter-menu.component.mjs +4 -2
  62. package/esm2022/filtering/menu/date-filter-menu-input.component.mjs +4 -0
  63. package/esm2022/filtering/menu/date-filter-menu.component.mjs +6 -0
  64. package/esm2022/filtering/menu/filter-menu-container.component.mjs +24 -10
  65. package/esm2022/filtering/menu/filter-menu-input-wrapper.component.mjs +26 -4
  66. package/esm2022/filtering/menu/filter-menu.component.mjs +44 -29
  67. package/esm2022/filtering/menu/numeric-filter-menu-input.component.mjs +2 -0
  68. package/esm2022/filtering/menu/numeric-filter-menu.component.mjs +6 -0
  69. package/esm2022/filtering/menu/string-filter-menu-input.component.mjs +2 -0
  70. package/esm2022/filtering/menu/string-filter-menu.component.mjs +10 -1
  71. package/esm2022/grid.component.mjs +376 -82
  72. package/esm2022/grid.module.mjs +115 -101
  73. package/esm2022/index.mjs +11 -1
  74. package/esm2022/localization/messages.mjs +128 -2
  75. package/esm2022/navigation/toolbar-tool-name.mjs +17 -0
  76. package/esm2022/package-metadata.mjs +2 -2
  77. package/esm2022/pdf/pdf-command-tool.directive.mjs +12 -15
  78. package/esm2022/rendering/cell.component.mjs +3 -3
  79. package/esm2022/rendering/header/header.component.mjs +1 -1
  80. package/esm2022/rendering/list.component.mjs +1 -1
  81. package/esm2022/rendering/table-body.component.mjs +1 -1
  82. package/esm2022/rendering/toolbar/tools/column-chooser-tool.directive.mjs +210 -0
  83. package/esm2022/rendering/toolbar/tools/filter-command-tool.directive.mjs +69 -34
  84. package/esm2022/rendering/toolbar/tools/filter-tool-wrapper.component.mjs +29 -8
  85. package/esm2022/rendering/toolbar/tools/filter-toolbar-tool.component.mjs +78 -8
  86. package/esm2022/rendering/toolbar/tools/group-command-tool.directive.mjs +206 -0
  87. package/esm2022/rendering/toolbar/tools/group-toolbar-tool.component.mjs +425 -0
  88. package/esm2022/rendering/toolbar/tools/sort-command-tool.directive.mjs +54 -20
  89. package/esm2022/rendering/toolbar/tools/sort-toolbar-tool.component.mjs +24 -8
  90. package/esm2022/selection/selection.service.mjs +11 -0
  91. package/esm2022/state-management/grid-state.models.mjs +26 -0
  92. package/esm2022/state-management/redo-command-tool.mjs +66 -0
  93. package/esm2022/state-management/undo-command-tool.mjs +66 -0
  94. package/esm2022/state-management/undo-redo.directive.mjs +178 -0
  95. package/esm2022/state-management/undo-redo.service.mjs +22 -0
  96. package/esm2022/state-management/undo-redo.stack.mjs +232 -0
  97. package/esm2022/utils.mjs +13 -13
  98. package/excel/excel-command-tool.directive.d.ts +5 -5
  99. package/fesm2022/progress-kendo-angular-grid.mjs +7384 -3773
  100. package/filtering/filter-input.directive.d.ts +1 -0
  101. package/filtering/menu/date-filter-menu-input.component.d.ts +1 -1
  102. package/filtering/menu/filter-menu-container.component.d.ts +15 -4
  103. package/filtering/menu/filter-menu-input-wrapper.component.d.ts +8 -3
  104. package/filtering/menu/filter-menu.component.d.ts +6 -3
  105. package/filtering/menu/numeric-filter-menu-input.component.d.ts +1 -1
  106. package/filtering/menu/string-filter-menu-input.component.d.ts +1 -1
  107. package/filtering/menu/string-filter-menu.component.d.ts +1 -0
  108. package/grid.component.d.ts +86 -33
  109. package/grid.module.d.ts +108 -100
  110. package/index.d.ts +10 -1
  111. package/localization/messages.d.ts +86 -2
  112. package/navigation/toolbar-tool-name.d.ts +17 -0
  113. package/package.json +36 -20
  114. package/pdf/pdf-command-tool.directive.d.ts +6 -5
  115. package/rendering/cell.component.d.ts +1 -1
  116. package/{column-menu → rendering/toolbar/tools}/column-chooser-tool.directive.d.ts +18 -6
  117. package/rendering/toolbar/tools/filter-command-tool.directive.d.ts +10 -1
  118. package/rendering/toolbar/tools/filter-tool-wrapper.component.d.ts +6 -5
  119. package/rendering/toolbar/tools/filter-toolbar-tool.component.d.ts +11 -2
  120. package/rendering/toolbar/tools/group-command-tool.directive.d.ts +51 -0
  121. package/rendering/toolbar/tools/group-toolbar-tool.component.d.ts +61 -0
  122. package/rendering/toolbar/tools/sort-command-tool.directive.d.ts +10 -1
  123. package/rendering/toolbar/tools/sort-toolbar-tool.component.d.ts +5 -1
  124. package/schematics/ngAdd/index.js +4 -4
  125. package/selection/selection.service.d.ts +1 -0
  126. package/state-management/grid-state.models.d.ts +58 -0
  127. package/state-management/redo-command-tool.d.ts +38 -0
  128. package/state-management/undo-command-tool.d.ts +38 -0
  129. package/state-management/undo-redo.directive.d.ts +51 -0
  130. package/state-management/undo-redo.service.d.ts +19 -0
  131. package/state-management/undo-redo.stack.d.ts +104 -0
  132. package/utils.d.ts +11 -5
  133. package/esm2022/column-menu/column-chooser-tool.directive.mjs +0 -172
@@ -0,0 +1,425 @@
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 { Component, ElementRef, EventEmitter, HostBinding, Output, Input, HostListener, ViewChildren, QueryList, NgZone } from '@angular/core';
6
+ import { NgFor, NgIf } from '@angular/common';
7
+ import { IconWrapperComponent } from '@progress/kendo-angular-icons';
8
+ import { chevronUpIcon, chevronDownIcon, xCircleIcon, plusCircleIcon, xIcon } from '@progress/kendo-svg-icons';
9
+ import { KENDO_BUTTON } from '@progress/kendo-angular-buttons';
10
+ import { take } from 'rxjs/operators';
11
+ import { isPresent } from '@progress/kendo-angular-common';
12
+ import * as i0 from "@angular/core";
13
+ import * as i1 from "@progress/kendo-angular-buttons";
14
+ /**
15
+ * @hidden
16
+ */
17
+ export class GroupToolbarToolComponent {
18
+ element;
19
+ ngZone;
20
+ hostClass = true;
21
+ get lgClass() {
22
+ return this.adaptive;
23
+ }
24
+ get mdClass() {
25
+ return !this.adaptive;
26
+ }
27
+ onEscKeyDown(event) {
28
+ event.preventDefault();
29
+ this.hostButton?.focus(event);
30
+ this.close.emit();
31
+ }
32
+ set groupItems(items) {
33
+ this._groupItems = items;
34
+ if (items?.first && (!isPresent(this.currentFocusedItemIndex) || this.currentFocusedItemIndex >= items.length || this.currentFocusedItemIndex < 0)) {
35
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
36
+ this.currentFocusedItemIndex = 0;
37
+ this.groupItems.first.nativeElement.focus();
38
+ });
39
+ return;
40
+ }
41
+ if (items?.first) {
42
+ items.get(this.currentFocusedItemIndex).nativeElement.focus();
43
+ }
44
+ }
45
+ get groupItems() {
46
+ return this._groupItems;
47
+ }
48
+ _groupItems;
49
+ adaptive = false;
50
+ close = new EventEmitter();
51
+ groupClear = new EventEmitter();
52
+ currentFocusedItemIndex;
53
+ group = new Array();
54
+ columns = [];
55
+ iconSize = 'medium';
56
+ upIcon = chevronUpIcon;
57
+ downIcon = chevronDownIcon;
58
+ removeIcon = xCircleIcon;
59
+ addIcon = plusCircleIcon;
60
+ clearIcon = xIcon;
61
+ _ctx;
62
+ set ctx(ctx) {
63
+ if (!ctx || !ctx.grid) {
64
+ return;
65
+ }
66
+ this._ctx = ctx;
67
+ this.group = ctx.grid.group;
68
+ this.subscription = ctx.grid.groupChange.subscribe((group) => {
69
+ this.group = group;
70
+ this.updateGroupedColumns();
71
+ });
72
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
73
+ this.updateGroupedColumns();
74
+ });
75
+ }
76
+ get ctx() {
77
+ return this._ctx;
78
+ }
79
+ groupedColumns = [];
80
+ ungroupedColumns = [];
81
+ subscription;
82
+ hostButton;
83
+ constructor(element, ngZone) {
84
+ this.element = element;
85
+ this.ngZone = ngZone;
86
+ }
87
+ ngOnInit() {
88
+ this.iconSize = this.adaptive ? 'large' : 'medium';
89
+ }
90
+ ngOnDestroy() {
91
+ if (this.subscription) {
92
+ this.subscription.unsubscribe();
93
+ }
94
+ }
95
+ addGroup(column, ev) {
96
+ ev.stopImmediatePropagation();
97
+ const index = this.group.length;
98
+ const groups = this.group.filter(x => x.field !== column?.field);
99
+ if (groups.length || this.group.length === 0) {
100
+ this.group = [...groups.slice(0, index), { field: column?.field }, ...groups.slice(index)];
101
+ this.ctx.grid.groupChange.emit(this.group);
102
+ this.updateGroupedColumns();
103
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
104
+ const newIndex = this.groupedColumns.length - 1;
105
+ const newItem = this.groupItems.get(newIndex);
106
+ if (newItem) {
107
+ this.currentFocusedItemIndex = (this.groupedColumns?.length || 0) + newIndex;
108
+ newItem.nativeElement.focus();
109
+ }
110
+ });
111
+ }
112
+ }
113
+ removeGroup(column, ev) {
114
+ ev.stopImmediatePropagation();
115
+ this.group = this.group.filter(x => x.field !== column?.field);
116
+ this.ctx.grid.groupChange.emit(this.group);
117
+ this.updateGroupedColumns();
118
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
119
+ const newIndex = this.ungroupedColumns.findIndex(ungroupedColumn => ungroupedColumn?.field === column?.field);
120
+ const newItem = this.groupItems.get(newIndex + this.groupedColumns.length);
121
+ if (newItem) {
122
+ newItem.nativeElement.focus();
123
+ }
124
+ });
125
+ }
126
+ moveGroupUp(column, ev) {
127
+ ev.stopImmediatePropagation();
128
+ const index = this.group.findIndex(x => x.field === column?.field);
129
+ if (index > 0) {
130
+ const groupToMove = this.group[index];
131
+ this.group.splice(index, 1);
132
+ this.group.splice(index - 1, 0, groupToMove);
133
+ this.ctx.grid.groupChange.emit(this.group);
134
+ this.updateGroupedColumns();
135
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
136
+ const newItem = this.groupItems.get(index - 1);
137
+ if (newItem) {
138
+ newItem.nativeElement.focus();
139
+ this.currentFocusedItemIndex = index - 1;
140
+ }
141
+ });
142
+ }
143
+ }
144
+ moveGroupDown(column, ev) {
145
+ ev.stopImmediatePropagation();
146
+ const index = this.group.findIndex(x => x.field === column?.field);
147
+ if (index < this.group.length - 1) {
148
+ const groupToMove = this.group[index];
149
+ this.group.splice(index, 1);
150
+ this.group.splice(index + 1, 0, groupToMove);
151
+ this.ctx.grid.groupChange.emit(this.group);
152
+ this.updateGroupedColumns();
153
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
154
+ const newItem = this.groupItems.get(index + 1);
155
+ if (newItem) {
156
+ newItem.nativeElement.focus();
157
+ this.currentFocusedItemIndex = index + 1;
158
+ }
159
+ });
160
+ }
161
+ }
162
+ clear() {
163
+ this.group = [];
164
+ this.ctx.grid.groupChange.emit(this.group);
165
+ this.groupClear.emit(this.group);
166
+ }
167
+ getColumnComponent(column) {
168
+ return column;
169
+ }
170
+ onItemFocus(groupIndex, index) {
171
+ const currentIndex = (typeof groupIndex === 'number' ? groupIndex : this.groupedColumns?.length || 0) + index;
172
+ this.currentFocusedItemIndex = currentIndex;
173
+ }
174
+ handleGroupedKeydown(column, index, ev) {
175
+ if (ev.code === 'Enter' || ev.code === 'Backspace' || ev.code === 'Delete') {
176
+ this.removeGroup(column, ev);
177
+ }
178
+ else if (ev.code === 'ArrowUp' && ev.shiftKey) {
179
+ this.moveGroupUp(column, ev);
180
+ }
181
+ else if (ev.code === 'ArrowDown' && ev.shiftKey) {
182
+ this.moveGroupDown(column, ev);
183
+ }
184
+ else if (ev.code === 'ArrowUp') {
185
+ this.navigateToPreviousItem();
186
+ }
187
+ else if (ev.code === 'ArrowDown') {
188
+ this.navigateToNextItem();
189
+ }
190
+ }
191
+ handleUngroupedKeydown(column, index, ev) {
192
+ if (ev.code === 'Enter') {
193
+ this.addGroup(column, ev);
194
+ }
195
+ else if (ev.code === 'ArrowUp') {
196
+ this.navigateToPreviousItem();
197
+ }
198
+ else if (ev.code === 'ArrowDown') {
199
+ this.navigateToNextItem();
200
+ }
201
+ }
202
+ updateGroupedColumns() {
203
+ this.groupedColumns = this.group
204
+ .map(group => this.ctx.grid.columns.find(column => column?.field === group.field))
205
+ .filter(column => !!column);
206
+ this.ungroupedColumns = this.ctx.grid.columns.filter(column => column?.groupable &&
207
+ !this.groupedColumns.some(gc => gc?.field === column?.field));
208
+ }
209
+ navigateToNextItem() {
210
+ if (this.currentFocusedItemIndex < this.groupItems.length - 1) {
211
+ this.currentFocusedItemIndex++;
212
+ this.groupItems.get(this.currentFocusedItemIndex).nativeElement.focus();
213
+ }
214
+ else if (this.currentFocusedItemIndex === this.groupItems.length - 1) {
215
+ this.currentFocusedItemIndex = 0;
216
+ this.groupItems.get(this.currentFocusedItemIndex).nativeElement.focus();
217
+ }
218
+ }
219
+ navigateToPreviousItem() {
220
+ if (this.currentFocusedItemIndex > 0) {
221
+ this.currentFocusedItemIndex--;
222
+ this.groupItems.get(this.currentFocusedItemIndex).nativeElement.focus();
223
+ }
224
+ else if (this.currentFocusedItemIndex === 0) {
225
+ this.currentFocusedItemIndex = this.groupItems.length - 1;
226
+ this.groupItems.get(this.currentFocusedItemIndex).nativeElement.focus();
227
+ }
228
+ }
229
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupToolbarToolComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
230
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GroupToolbarToolComponent, isStandalone: true, selector: "kendo-group-toolbar-tool", inputs: { adaptive: "adaptive" }, outputs: { close: "close", groupClear: "groupClear" }, host: { listeners: { "keydown.escape": "onEscKeyDown($event)" }, properties: { "class.k-group-menu": "this.hostClass", "class.k-group-menu-lg": "this.lgClass", "class.k-group-menu-md": "this.mdClass" } }, viewQueries: [{ propertyName: "groupItems", predicate: ["groupItem"], descendants: true, read: ElementRef }], ngImport: i0, template: `
231
+ <div *ngIf="groupedColumns.length" class="k-group-menu-item-wrap">
232
+ <div *ngFor="let column of groupedColumns; let i = index"
233
+ #groupItem
234
+ role="button"
235
+ class="k-group-menu-item"
236
+ tabindex="0"
237
+ (keydown)="handleGroupedKeydown(column, i, $event)"
238
+ (focus)="onItemFocus(i, 0)"
239
+ >
240
+ <span class="k-group-menu-item-actions" *ngIf="groupedColumns.length > 1">
241
+ <span
242
+ class="k-group-menu-item-action k-group-menu-item-up-action"
243
+ (click)="moveGroupUp(column, $event)"
244
+ [attr.aria-disabled]="i === 0"
245
+ [class.k-disabled]="i === 0"
246
+ >
247
+ <kendo-icon-wrapper
248
+ name="arrow-chevron-up"
249
+ [svgIcon]="upIcon"
250
+ [size]="iconSize"
251
+ ></kendo-icon-wrapper>
252
+ </span>
253
+ <span
254
+ class="k-group-menu-item-action k-group-menu-item-down-action"
255
+ (click)="moveGroupDown(column, $event)"
256
+ [attr.aria-disabled]="i === groupedColumns.length - 1"
257
+ [class.k-disabled]="i === groupedColumns.length - 1"
258
+ >
259
+ <kendo-icon-wrapper
260
+ name="arrow-chevron-down"
261
+ [svgIcon]="downIcon"
262
+ [size]="iconSize"
263
+ ></kendo-icon-wrapper>
264
+ </span>
265
+ </span>
266
+ <span class="k-group-item-text">{{column.title || getColumnComponent(column).field}}</span>
267
+ <span class="k-spacer"></span>
268
+ <span class="k-group-menu-item-actions">
269
+ <span class="k-group-menu-item-action k-group-menu-item-remove-action" (click)="removeGroup(column, $event)">
270
+ <kendo-icon-wrapper
271
+ name="x-circle"
272
+ [svgIcon]="removeIcon"
273
+ [size]="iconSize"
274
+ ></kendo-icon-wrapper>
275
+ </span>
276
+ </span>
277
+ </div>
278
+ </div>
279
+
280
+ <div *ngIf="ungroupedColumns.length" class="k-group-menu-item-wrap">
281
+ <div *ngFor="let column of ungroupedColumns; let i = index"
282
+ #groupItem
283
+ role="button"
284
+ class="k-group-menu-item"
285
+ tabindex="0"
286
+ (keydown)="handleUngroupedKeydown(column, i, $event)"
287
+ (focus)="onItemFocus(null, i)"
288
+ >
289
+ <span class="k-group-item-text">{{column.title || getColumnComponent(column).field}}</span>
290
+ <span class="k-spacer"></span>
291
+ <span class="k-group-menu-item-actions">
292
+ <span class="k-group-menu-item-action k-group-menu-item-add-action" (click)="addGroup(column, $event)">
293
+ <kendo-icon-wrapper
294
+ name="plus-circle"
295
+ [svgIcon]="addIcon"
296
+ [size]="iconSize"
297
+ ></kendo-icon-wrapper>
298
+ </span>
299
+ </span>
300
+ </div>
301
+ </div>
302
+
303
+ <div *ngIf="!adaptive" class="k-actions k-actions-stretched k-actions-horizontal k-column-menu-footer">
304
+ <button kendoButton
305
+ [svgIcon]="clearIcon"
306
+ (click)="clear()"
307
+ icon="x"
308
+ >
309
+ {{ctx?.localization.get('groupClearButton')}}
310
+ </button>
311
+ </div>
312
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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: "component", type: i1.ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
313
+ }
314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupToolbarToolComponent, decorators: [{
315
+ type: Component,
316
+ args: [{
317
+ selector: 'kendo-group-toolbar-tool',
318
+ template: `
319
+ <div *ngIf="groupedColumns.length" class="k-group-menu-item-wrap">
320
+ <div *ngFor="let column of groupedColumns; let i = index"
321
+ #groupItem
322
+ role="button"
323
+ class="k-group-menu-item"
324
+ tabindex="0"
325
+ (keydown)="handleGroupedKeydown(column, i, $event)"
326
+ (focus)="onItemFocus(i, 0)"
327
+ >
328
+ <span class="k-group-menu-item-actions" *ngIf="groupedColumns.length > 1">
329
+ <span
330
+ class="k-group-menu-item-action k-group-menu-item-up-action"
331
+ (click)="moveGroupUp(column, $event)"
332
+ [attr.aria-disabled]="i === 0"
333
+ [class.k-disabled]="i === 0"
334
+ >
335
+ <kendo-icon-wrapper
336
+ name="arrow-chevron-up"
337
+ [svgIcon]="upIcon"
338
+ [size]="iconSize"
339
+ ></kendo-icon-wrapper>
340
+ </span>
341
+ <span
342
+ class="k-group-menu-item-action k-group-menu-item-down-action"
343
+ (click)="moveGroupDown(column, $event)"
344
+ [attr.aria-disabled]="i === groupedColumns.length - 1"
345
+ [class.k-disabled]="i === groupedColumns.length - 1"
346
+ >
347
+ <kendo-icon-wrapper
348
+ name="arrow-chevron-down"
349
+ [svgIcon]="downIcon"
350
+ [size]="iconSize"
351
+ ></kendo-icon-wrapper>
352
+ </span>
353
+ </span>
354
+ <span class="k-group-item-text">{{column.title || getColumnComponent(column).field}}</span>
355
+ <span class="k-spacer"></span>
356
+ <span class="k-group-menu-item-actions">
357
+ <span class="k-group-menu-item-action k-group-menu-item-remove-action" (click)="removeGroup(column, $event)">
358
+ <kendo-icon-wrapper
359
+ name="x-circle"
360
+ [svgIcon]="removeIcon"
361
+ [size]="iconSize"
362
+ ></kendo-icon-wrapper>
363
+ </span>
364
+ </span>
365
+ </div>
366
+ </div>
367
+
368
+ <div *ngIf="ungroupedColumns.length" class="k-group-menu-item-wrap">
369
+ <div *ngFor="let column of ungroupedColumns; let i = index"
370
+ #groupItem
371
+ role="button"
372
+ class="k-group-menu-item"
373
+ tabindex="0"
374
+ (keydown)="handleUngroupedKeydown(column, i, $event)"
375
+ (focus)="onItemFocus(null, i)"
376
+ >
377
+ <span class="k-group-item-text">{{column.title || getColumnComponent(column).field}}</span>
378
+ <span class="k-spacer"></span>
379
+ <span class="k-group-menu-item-actions">
380
+ <span class="k-group-menu-item-action k-group-menu-item-add-action" (click)="addGroup(column, $event)">
381
+ <kendo-icon-wrapper
382
+ name="plus-circle"
383
+ [svgIcon]="addIcon"
384
+ [size]="iconSize"
385
+ ></kendo-icon-wrapper>
386
+ </span>
387
+ </span>
388
+ </div>
389
+ </div>
390
+
391
+ <div *ngIf="!adaptive" class="k-actions k-actions-stretched k-actions-horizontal k-column-menu-footer">
392
+ <button kendoButton
393
+ [svgIcon]="clearIcon"
394
+ (click)="clear()"
395
+ icon="x"
396
+ >
397
+ {{ctx?.localization.get('groupClearButton')}}
398
+ </button>
399
+ </div>
400
+ `,
401
+ standalone: true,
402
+ imports: [NgFor, NgIf, IconWrapperComponent, KENDO_BUTTON]
403
+ }]
404
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { hostClass: [{
405
+ type: HostBinding,
406
+ args: ['class.k-group-menu']
407
+ }], lgClass: [{
408
+ type: HostBinding,
409
+ args: ['class.k-group-menu-lg']
410
+ }], mdClass: [{
411
+ type: HostBinding,
412
+ args: ['class.k-group-menu-md']
413
+ }], onEscKeyDown: [{
414
+ type: HostListener,
415
+ args: ['keydown.escape', ['$event']]
416
+ }], groupItems: [{
417
+ type: ViewChildren,
418
+ args: ['groupItem', { read: ElementRef }]
419
+ }], adaptive: [{
420
+ type: Input
421
+ }], close: [{
422
+ type: Output
423
+ }], groupClear: [{
424
+ type: Output
425
+ }] } });
@@ -13,12 +13,14 @@ import { SortService } from '../../../common/sort.service';
13
13
  import { closest, isDocumentAvailable, isPresent } from '@progress/kendo-angular-common';
14
14
  import { ColumnInfoService } from '../../../common/column-info.service';
15
15
  import { take } from 'rxjs/operators';
16
+ import { AdaptiveGridService } from '../../../common/adaptiveness.service';
16
17
  import * as i0 from "@angular/core";
17
18
  import * as i1 from "@progress/kendo-angular-toolbar";
18
19
  import * as i2 from "@progress/kendo-angular-popup";
19
20
  import * as i3 from "../../../common/provider.service";
20
21
  import * as i4 from "../../../common/sort.service";
21
22
  import * as i5 from "../../../common/column-info.service";
23
+ import * as i6 from "../../../common/adaptiveness.service";
22
24
  let incrementingId = 0;
23
25
  /**
24
26
  * Represents the toolbar tool for sorting columns of the Grid.
@@ -45,12 +47,20 @@ export class SortCommandToolbarDirective {
45
47
  columnInfoService;
46
48
  ngZone;
47
49
  renderer;
50
+ adaptiveGridService;
48
51
  popupRef;
49
52
  nextId = incrementingId++;
50
53
  toolSubs = new Subscription();
51
54
  popupSubs;
55
+ actionSheetCloseSub;
52
56
  removeClickListener;
53
- constructor(host, popupService, ctx, sortService, columnInfoService, ngZone, renderer) {
57
+ /**
58
+ * @hidden
59
+ */
60
+ isSortingApplied(sort) {
61
+ return isPresent(sort) && sort.length > 0 && sort.filter(item => item.dir !== undefined).length > 0;
62
+ }
63
+ constructor(host, popupService, ctx, sortService, columnInfoService, ngZone, renderer, adaptiveGridService) {
54
64
  this.host = host;
55
65
  this.popupService = popupService;
56
66
  this.ctx = ctx;
@@ -58,19 +68,21 @@ export class SortCommandToolbarDirective {
58
68
  this.columnInfoService = columnInfoService;
59
69
  this.ngZone = ngZone;
60
70
  this.renderer = renderer;
71
+ this.adaptiveGridService = adaptiveGridService;
61
72
  }
62
73
  ngOnInit() {
63
74
  this.toolSubs = this.host.click.subscribe(e => this.onClick(e));
64
75
  this.toolSubs.add(this.sortService.changes.subscribe(sort => {
65
- const isSortingApplied = isPresent(sort) && sort.length > 0 && sort.filter(item => item.dir !== undefined).length > 0;
66
- this.host.showBadge = isSortingApplied;
76
+ this.host.showBadge = this.isSortingApplied(sort);
67
77
  }));
78
+ this.host.hasBadgeContainer = true;
79
+ this.host.showBadge = this.isSortingApplied(this.ctx.grid.sort);
68
80
  const hasToolbarIcon = isPresent(this.host.toolbarOptions.icon) && this.host.toolbarOptions.icon !== '';
69
81
  const hasOverflowIcon = isPresent(this.host.overflowOptions.icon) && this.host.overflowOptions.icon !== '';
70
82
  const hasIcon = hasToolbarIcon && hasOverflowIcon;
71
83
  const hasSvgIcon = isPresent(this.host.toolbarOptions.svgIcon) && isPresent(this.host.overflowOptions.svgIcon);
72
84
  if (!hasIcon) {
73
- this.host.icon = 'k-i-arrows-swap';
85
+ this.host.icon = 'arrows-swap';
74
86
  }
75
87
  if (!hasSvgIcon) {
76
88
  this.host.svgIcon = arrowsSwapIcon;
@@ -82,9 +94,9 @@ export class SortCommandToolbarDirective {
82
94
  this.host.text = this.ctx.localization.get(`sortToolbarToolText`);
83
95
  });
84
96
  }
85
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-haspopup', 'dialog');
86
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-expanded', 'false');
87
- this.host.toolbarButtonElement.nativeElement.setAttribute('title', this.ctx.localization.get('sortable'));
97
+ this.buttonElement?.setAttribute('aria-haspopup', 'dialog');
98
+ this.buttonElement?.setAttribute('aria-expanded', 'false');
99
+ this.buttonElement?.setAttribute('title', this.ctx.localization.get('sortToolbarToolText'));
88
100
  }
89
101
  ngOnDestroy() {
90
102
  if (this.toolSubs) {
@@ -97,6 +109,10 @@ export class SortCommandToolbarDirective {
97
109
  this.popupRef.close();
98
110
  this.popupRef = null;
99
111
  }
112
+ if (this.actionSheetCloseSub) {
113
+ this.actionSheetCloseSub.unsubscribe();
114
+ this.actionSheetCloseSub = null;
115
+ }
100
116
  if (this.removeClickListener) {
101
117
  this.removeClickListener();
102
118
  this.removeClickListener = null;
@@ -104,30 +120,44 @@ export class SortCommandToolbarDirective {
104
120
  }
105
121
  onClick(e) {
106
122
  e.preventDefault();
107
- if (this.popupRef) {
108
- this.closePopup();
109
- return;
123
+ if (this.ctx.grid.adaptiveMode === 'auto' && this.adaptiveGridService.windowSize !== 'large') {
124
+ if (!this.ctx.grid.isActionSheetExpanded) {
125
+ this.adaptiveGridService.viewType = 'sortToolbarTool';
126
+ this.ctx.grid.adaptiveRenderer.actionSheet.toggle(true);
127
+ this.host.selected = true;
128
+ this.actionSheetCloseSub = this.ctx.grid.adaptiveRenderer.actionSheet.collapse.subscribe(() => this.host.selected = false);
129
+ }
130
+ }
131
+ else {
132
+ if (this.popupRef) {
133
+ this.closePopup();
134
+ return;
135
+ }
136
+ this.openPopup();
110
137
  }
111
- this.openPopup();
112
138
  }
113
139
  openPopup() {
114
140
  const direction = this.ctx.localization.rtl ? 'right' : 'left';
115
141
  this.popupRef = this.popupService.open({
116
- anchor: this.host.toolbarButtonElement.nativeElement,
142
+ anchor: this.buttonElement,
117
143
  content: SortToolbarToolComponent,
118
144
  popupClass: 'k-grid-columnmenu-popup',
119
145
  positionMode: 'absolute',
120
146
  anchorAlign: { vertical: 'bottom', horizontal: direction },
121
147
  popupAlign: { vertical: 'top', horizontal: direction }
122
148
  });
149
+ this.adaptiveGridService.popupRef = this.popupRef;
123
150
  this.setPopupAttributes();
151
+ this.host.selected = true;
124
152
  this.ngZone.runOutsideAngular(() => {
125
153
  if (!isDocumentAvailable()) {
126
154
  return;
127
155
  }
128
156
  this.removeClickListener = this.renderer.listen('document', 'click', (e) => {
129
- if (this.popupRef && !closest(e.target, node => node === this.popupRef.popupElement || node === this.host.toolbarButtonElement.nativeElement)) {
130
- this.closePopup();
157
+ if (this.popupRef && !closest(e.target, node => node === this.popupRef.popupElement || node === this.buttonElement)) {
158
+ this.ngZone.run(() => {
159
+ this.closePopup();
160
+ });
131
161
  }
132
162
  });
133
163
  });
@@ -145,8 +175,8 @@ export class SortCommandToolbarDirective {
145
175
  this.renderer.setAttribute(popupElement, 'dir', this.ctx.localization.rtl ? 'rtl' : 'ltr');
146
176
  this.renderer.setAttribute(popupAriaElement, 'id', popupId);
147
177
  this.renderer.setAttribute(popupAriaElement, 'role', 'dialog');
148
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-expanded', 'true');
149
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-controls', popupId);
178
+ this.buttonElement?.setAttribute('aria-expanded', 'true');
179
+ this.buttonElement?.setAttribute('aria-controls', popupId);
150
180
  }
151
181
  initPopupProperties() {
152
182
  this.popupRef.content.instance.columnInfoService = this.columnInfoService;
@@ -161,8 +191,9 @@ export class SortCommandToolbarDirective {
161
191
  }));
162
192
  }
163
193
  closePopup() {
164
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-expanded', 'false');
165
- this.host.toolbarButtonElement.nativeElement.removeAttribute('aria-controls');
194
+ this.buttonElement?.setAttribute('aria-expanded', 'false');
195
+ this.buttonElement?.removeAttribute('aria-controls');
196
+ this.host.selected = false;
166
197
  if (this.popupRef) {
167
198
  this.popupRef.close();
168
199
  this.popupRef = null;
@@ -176,7 +207,10 @@ export class SortCommandToolbarDirective {
176
207
  this.removeClickListener = null;
177
208
  }
178
209
  }
179
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SortCommandToolbarDirective, deps: [{ token: i1.ToolBarButtonComponent }, { token: i2.PopupService }, { token: i3.ContextService }, { token: i4.SortService }, { token: i5.ColumnInfoService }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
210
+ get buttonElement() {
211
+ return this.host.getButton();
212
+ }
213
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SortCommandToolbarDirective, deps: [{ token: i1.ToolBarButtonComponent }, { token: i2.PopupService }, { token: i3.ContextService }, { token: i4.SortService }, { token: i5.ColumnInfoService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i6.AdaptiveGridService }], target: i0.ɵɵFactoryTarget.Directive });
180
214
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: SortCommandToolbarDirective, isStandalone: true, selector: "[kendoGridSortTool]", ngImport: i0 });
181
215
  }
182
216
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SortCommandToolbarDirective, decorators: [{
@@ -185,4 +219,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
185
219
  selector: '[kendoGridSortTool]',
186
220
  standalone: true
187
221
  }]
188
- }], ctorParameters: function () { return [{ type: i1.ToolBarButtonComponent }, { type: i2.PopupService }, { type: i3.ContextService }, { type: i4.SortService }, { type: i5.ColumnInfoService }, { type: i0.NgZone }, { type: i0.Renderer2 }]; } });
222
+ }], ctorParameters: function () { return [{ type: i1.ToolBarButtonComponent }, { type: i2.PopupService }, { type: i3.ContextService }, { type: i4.SortService }, { type: i5.ColumnInfoService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i6.AdaptiveGridService }]; } });