@progress/kendo-angular-grid 19.0.0-develop.24 → 19.0.0-develop.25

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 (25) hide show
  1. package/column-menu/column-menu-item.component.d.ts +16 -3
  2. package/esm2022/adaptiveness/adaptive-renderer.component.mjs +1 -1
  3. package/esm2022/column-menu/column-menu-autosize-all.component.mjs +1 -1
  4. package/esm2022/column-menu/column-menu-autosize.component.mjs +1 -1
  5. package/esm2022/column-menu/column-menu-chooser.component.mjs +1 -1
  6. package/esm2022/column-menu/column-menu-filter.component.mjs +1 -1
  7. package/esm2022/column-menu/column-menu-item.component.mjs +33 -11
  8. package/esm2022/column-menu/column-menu-lock.component.mjs +1 -1
  9. package/esm2022/column-menu/column-menu-position.component.mjs +1 -1
  10. package/esm2022/column-menu/column-menu-sort.component.mjs +1 -1
  11. package/esm2022/column-menu/column-menu-stick.component.mjs +1 -1
  12. package/esm2022/grid.component.mjs +65 -9
  13. package/esm2022/package-metadata.mjs +2 -2
  14. package/esm2022/rendering/toolbar/tools/column-chooser-tool.directive.mjs +2 -0
  15. package/esm2022/rendering/toolbar/tools/filter-command-tool.directive.mjs +14 -3
  16. package/esm2022/rendering/toolbar/tools/filter-tool-wrapper.component.mjs +1 -0
  17. package/esm2022/rendering/toolbar/tools/filter-toolbar-tool.component.mjs +56 -8
  18. package/esm2022/rendering/toolbar/tools/sort-command-tool.directive.mjs +14 -4
  19. package/fesm2022/progress-kendo-angular-grid.mjs +192 -44
  20. package/grid.component.d.ts +13 -0
  21. package/package.json +21 -21
  22. package/rendering/toolbar/tools/filter-command-tool.directive.d.ts +5 -0
  23. package/rendering/toolbar/tools/filter-toolbar-tool.component.d.ts +10 -2
  24. package/rendering/toolbar/tools/sort-command-tool.directive.d.ts +5 -0
  25. package/schematics/ngAdd/index.js +4 -4
@@ -2,7 +2,7 @@
2
2
  * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { Component, ElementRef, EventEmitter, Output, QueryList, ViewChildren } from '@angular/core';
5
+ import { Component, ElementRef, EventEmitter, NgZone, Output, QueryList, ViewChildren } from '@angular/core';
6
6
  import { ContextService } from '../../../common/provider.service';
7
7
  import { NgFor } from '@angular/common';
8
8
  import { KENDO_BUTTON } from '@progress/kendo-angular-buttons';
@@ -13,6 +13,8 @@ import { ColumnMenuItemContentTemplateDirective } from '../../../column-menu/col
13
13
  import { ColumnInfoService } from '../../../common/column-info.service';
14
14
  import { cloneFilters } from '../../../common/filter-descriptor-differ';
15
15
  import { AdaptiveGridService } from '../../../common/adaptiveness.service';
16
+ import { filterIcon } from '@progress/kendo-svg-icons';
17
+ import { take } from 'rxjs/operators';
16
18
  import * as i0 from "@angular/core";
17
19
  import * as i1 from "../../../filtering/filter.service";
18
20
  import * as i2 from "../../../common/provider.service";
@@ -26,6 +28,7 @@ export class FilterToolbarToolComponent {
26
28
  filterService;
27
29
  ctx;
28
30
  columnInfoService;
31
+ ngZone;
29
32
  adaptiveGridService;
30
33
  filterItems;
31
34
  menuItems;
@@ -41,12 +44,45 @@ export class FilterToolbarToolComponent {
41
44
  columnMenuService;
42
45
  columns;
43
46
  filter;
47
+ activeFilterSVGIcon = filterIcon;
48
+ activeFilterIcon = 'k-i-filter';
49
+ isFilterApplied(column) {
50
+ if (!this.filter?.filters) {
51
+ return false;
52
+ }
53
+ if (Array.isArray(this.filter.filters)) {
54
+ for (const filterGroup of this.filter.filters) {
55
+ if (filterGroup.filters && Array.isArray(filterGroup.filters)) {
56
+ for (const filter of filterGroup.filters) {
57
+ if (filter.field === column.field) {
58
+ return true;
59
+ }
60
+ }
61
+ }
62
+ else if (filterGroup.field === column.field) {
63
+ return true;
64
+ }
65
+ }
66
+ }
67
+ return false;
68
+ }
69
+ isItemFocused(filterItem) {
70
+ return this.currentFocusedItem === filterItem;
71
+ }
72
+ onItemFocus(item) {
73
+ this.currentFocusedItem = item;
74
+ }
75
+ onItemFocusOut() {
76
+ this.currentFocusedItem = null;
77
+ }
78
+ currentFocusedItem = null;
44
79
  subscriptions;
45
- constructor(element, filterService, ctx, columnInfoService, adaptiveGridService) {
80
+ constructor(element, filterService, ctx, columnInfoService, ngZone, adaptiveGridService) {
46
81
  this.element = element;
47
82
  this.filterService = filterService;
48
83
  this.ctx = ctx;
49
84
  this.columnInfoService = columnInfoService;
85
+ this.ngZone = ngZone;
50
86
  this.adaptiveGridService = adaptiveGridService;
51
87
  }
52
88
  ngOnInit() {
@@ -57,7 +93,9 @@ export class FilterToolbarToolComponent {
57
93
  });
58
94
  }
59
95
  ngAfterViewInit() {
60
- this.filterItems?.get(0)?.nativeElement.focus();
96
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
97
+ this.filterItems?.get(0)?.nativeElement.focus();
98
+ });
61
99
  }
62
100
  ngOnDestroy() {
63
101
  if (this.subscriptions) {
@@ -101,7 +139,7 @@ export class FilterToolbarToolComponent {
101
139
  menuItem.contentState = 'expanded';
102
140
  }
103
141
  }
104
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterToolbarToolComponent, deps: [{ token: i0.ElementRef }, { token: i1.FilterService }, { token: i2.ContextService }, { token: i3.ColumnInfoService }, { token: i4.AdaptiveGridService }], target: i0.ɵɵFactoryTarget.Component });
142
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterToolbarToolComponent, deps: [{ token: i0.ElementRef }, { token: i1.FilterService }, { token: i2.ContextService }, { token: i3.ColumnInfoService }, { token: i0.NgZone }, { token: i4.AdaptiveGridService }], target: i0.ɵɵFactoryTarget.Component });
105
143
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FilterToolbarToolComponent, isStandalone: true, selector: "kendo-filter-toolbar-tool", outputs: { close: "close" }, viewQueries: [{ propertyName: "filterItems", predicate: ["filterItem"], descendants: true, read: ElementRef }, { propertyName: "menuItems", predicate: ["filterItem"], descendants: true }, { propertyName: "filterContainers", predicate: ["filterContainer"], descendants: true }], ngImport: i0, template: `
106
144
  <div [style]="hostStyles">
107
145
  <kendo-grid-columnmenu-item *ngFor="let column of columns; let i = index"
@@ -110,9 +148,14 @@ export class FilterToolbarToolComponent {
110
148
  tabindex="0"
111
149
  [column]="getColumnComponent(column)"
112
150
  [text]="column.title || getColumnComponent(column).field"
151
+ (focus)="onItemFocus(filterItem)"
152
+ (focusout)="onItemFocusOut()"
113
153
  (keydown.enter)="toggleItem($event, i)"
154
+ [indicatorSVGIcon]="isFilterApplied(column) ? activeFilterSVGIcon : null"
155
+ [indicatorIcon]="isFilterApplied(column) ? activeFilterIcon : null"
114
156
  (itemClick)="navigateView(getColumnComponent(column))"
115
- [expanded]="false">
157
+ [expanded]="false"
158
+ [focused]="isItemFocused(filterItem)">
116
159
  <ng-template kendoGridColumnMenuItemContentTemplate>
117
160
  <kendo-grid-filter-menu-container
118
161
  #filterContainer
@@ -125,7 +168,7 @@ export class FilterToolbarToolComponent {
125
168
  </ng-template>
126
169
  </kendo-grid-columnmenu-item>
127
170
  </div>
128
- `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: FilterMenuContainerComponent, selector: "kendo-grid-filter-menu-container", inputs: ["column", "isLast", "isExpanded", "menuTabbingService", "filter", "actionsClass"], outputs: ["close"] }, { kind: "component", type: ColumnMenuItemComponent, selector: "kendo-grid-columnmenu-item", inputs: ["icon", "svgIcon", "text", "selected", "disabled", "expanded", "service", "column"], outputs: ["itemClick", "expand", "collapse"] }, { kind: "directive", type: ColumnMenuItemContentTemplateDirective, selector: "[kendoGridColumnMenuItemContentTemplate]" }] });
171
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: FilterMenuContainerComponent, selector: "kendo-grid-filter-menu-container", inputs: ["column", "isLast", "isExpanded", "menuTabbingService", "filter", "actionsClass"], outputs: ["close"] }, { kind: "component", type: ColumnMenuItemComponent, selector: "kendo-grid-columnmenu-item", inputs: ["icon", "svgIcon", "indicatorIcon", "indicatorSVGIcon", "text", "selected", "disabled", "expanded", "focused", "service", "column"], outputs: ["itemClick", "expand", "collapse"] }, { kind: "directive", type: ColumnMenuItemContentTemplateDirective, selector: "[kendoGridColumnMenuItemContentTemplate]" }] });
129
172
  }
130
173
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterToolbarToolComponent, decorators: [{
131
174
  type: Component,
@@ -139,9 +182,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
139
182
  tabindex="0"
140
183
  [column]="getColumnComponent(column)"
141
184
  [text]="column.title || getColumnComponent(column).field"
185
+ (focus)="onItemFocus(filterItem)"
186
+ (focusout)="onItemFocusOut()"
142
187
  (keydown.enter)="toggleItem($event, i)"
188
+ [indicatorSVGIcon]="isFilterApplied(column) ? activeFilterSVGIcon : null"
189
+ [indicatorIcon]="isFilterApplied(column) ? activeFilterIcon : null"
143
190
  (itemClick)="navigateView(getColumnComponent(column))"
144
- [expanded]="false">
191
+ [expanded]="false"
192
+ [focused]="isItemFocused(filterItem)">
145
193
  <ng-template kendoGridColumnMenuItemContentTemplate>
146
194
  <kendo-grid-filter-menu-container
147
195
  #filterContainer
@@ -158,7 +206,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
158
206
  standalone: true,
159
207
  imports: [NgFor, KENDO_BUTTON, FilterMenuContainerComponent, ColumnMenuItemComponent, ColumnMenuItemContentTemplateDirective]
160
208
  }]
161
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.FilterService }, { type: i2.ContextService }, { type: i3.ColumnInfoService }, { type: i4.AdaptiveGridService }]; }, propDecorators: { filterItems: [{
209
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.FilterService }, { type: i2.ContextService }, { type: i3.ColumnInfoService }, { type: i0.NgZone }, { type: i4.AdaptiveGridService }]; }, propDecorators: { filterItems: [{
162
210
  type: ViewChildren,
163
211
  args: ['filterItem', { read: ElementRef }]
164
212
  }], menuItems: [{
@@ -53,6 +53,12 @@ export class SortCommandToolbarDirective {
53
53
  toolSubs = new Subscription();
54
54
  popupSubs;
55
55
  removeClickListener;
56
+ /**
57
+ * @hidden
58
+ */
59
+ isSortingApplied(sort) {
60
+ return isPresent(sort) && sort.length > 0 && sort.filter(item => item.dir !== undefined).length > 0;
61
+ }
56
62
  constructor(host, popupService, ctx, sortService, columnInfoService, ngZone, renderer, adaptiveGridService) {
57
63
  this.host = host;
58
64
  this.popupService = popupService;
@@ -66,9 +72,9 @@ export class SortCommandToolbarDirective {
66
72
  ngOnInit() {
67
73
  this.toolSubs = this.host.click.subscribe(e => this.onClick(e));
68
74
  this.toolSubs.add(this.sortService.changes.subscribe(sort => {
69
- const isSortingApplied = isPresent(sort) && sort.length > 0 && sort.filter(item => item.dir !== undefined).length > 0;
70
- this.host.showBadge = isSortingApplied;
75
+ this.host.showBadge = this.isSortingApplied(sort);
71
76
  }));
77
+ this.host.showBadge = this.isSortingApplied(this.ctx.grid.sort);
72
78
  const hasToolbarIcon = isPresent(this.host.toolbarOptions.icon) && this.host.toolbarOptions.icon !== '';
73
79
  const hasOverflowIcon = isPresent(this.host.overflowOptions.icon) && this.host.overflowOptions.icon !== '';
74
80
  const hasIcon = hasToolbarIcon && hasOverflowIcon;
@@ -88,7 +94,7 @@ export class SortCommandToolbarDirective {
88
94
  }
89
95
  this.buttonElement?.setAttribute('aria-haspopup', 'dialog');
90
96
  this.buttonElement?.setAttribute('aria-expanded', 'false');
91
- this.buttonElement?.setAttribute('title', this.ctx.localization.get('sortable'));
97
+ this.buttonElement?.setAttribute('title', this.ctx.localization.get('sortToolbarToolText'));
92
98
  }
93
99
  ngOnDestroy() {
94
100
  if (this.toolSubs) {
@@ -134,13 +140,16 @@ export class SortCommandToolbarDirective {
134
140
  });
135
141
  this.adaptiveGridService.popupRef = this.popupRef;
136
142
  this.setPopupAttributes();
143
+ this.host.selected = true;
137
144
  this.ngZone.runOutsideAngular(() => {
138
145
  if (!isDocumentAvailable()) {
139
146
  return;
140
147
  }
141
148
  this.removeClickListener = this.renderer.listen('document', 'click', (e) => {
142
149
  if (this.popupRef && !closest(e.target, node => node === this.popupRef.popupElement || node === this.buttonElement)) {
143
- this.closePopup();
150
+ this.ngZone.run(() => {
151
+ this.closePopup();
152
+ });
144
153
  }
145
154
  });
146
155
  });
@@ -176,6 +185,7 @@ export class SortCommandToolbarDirective {
176
185
  closePopup() {
177
186
  this.buttonElement?.setAttribute('aria-expanded', 'false');
178
187
  this.buttonElement?.removeAttribute('aria-controls');
188
+ this.host.selected = false;
179
189
  if (this.popupRef) {
180
190
  this.popupRef.close();
181
191
  this.popupRef = null;