@progress/kendo-angular-grid 19.0.0-develop.8 → 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
@@ -2,14 +2,16 @@
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 { Directive } from '@angular/core';
5
+ import { ChangeDetectorRef, Directive, NgZone } from '@angular/core';
6
6
  import { PDFService } from './pdf.service';
7
7
  import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
8
- import { Subscription } from 'rxjs';
9
- import { filePdfIcon } from '@progress/kendo-svg-icons';
8
+ import { ContextService } from '../common/provider.service';
9
+ import { ToolbarToolBase } from '../common/toolbar-tool-base.directive';
10
+ import { ToolbarToolName } from '../navigation/toolbar-tool-name';
10
11
  import * as i0 from "@angular/core";
11
12
  import * as i1 from "./pdf.service";
12
13
  import * as i2 from "@progress/kendo-angular-toolbar";
14
+ import * as i3 from "../common/provider.service";
13
15
  /**
14
16
  * Represents the `export-to-PDF` toolbar tool of the Grid.
15
17
  * You can apply this directive to any `kendo-toolbar-button` element inside a
@@ -30,22 +32,17 @@ import * as i2 from "@progress/kendo-angular-toolbar";
30
32
  * </kendo-grid>
31
33
  * ```
32
34
  */
33
- export class PDFCommandToolbarDirective {
35
+ export class PDFCommandToolbarDirective extends ToolbarToolBase {
34
36
  pdfService;
35
37
  host;
36
- clickSub = new Subscription();
37
- constructor(pdfService, host) {
38
+ constructor(pdfService, host, ctx, zone, cdr) {
39
+ super(host, ToolbarToolName.pdfExport, ctx, zone, cdr);
38
40
  this.pdfService = pdfService;
39
41
  this.host = host;
40
42
  }
41
43
  ngOnInit() {
42
- this.clickSub = this.host.click.subscribe(e => this.onClick(e));
44
+ super.ngOnInit();
43
45
  this.host.className = 'k-grid-pdf';
44
- this.host.svgIcon = filePdfIcon;
45
- this.host.icon = 'file-pdf';
46
- }
47
- ngOnDestroy() {
48
- this.clickSub.unsubscribe();
49
46
  }
50
47
  /**
51
48
  * @hidden
@@ -54,8 +51,8 @@ export class PDFCommandToolbarDirective {
54
51
  e.preventDefault();
55
52
  this.pdfService.exportClick.emit();
56
53
  }
57
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFCommandToolbarDirective, deps: [{ token: i1.PDFService }, { token: i2.ToolBarButtonComponent }], target: i0.ɵɵFactoryTarget.Directive });
58
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: PDFCommandToolbarDirective, isStandalone: true, selector: "[kendoGridPDFTool]", ngImport: i0 });
54
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFCommandToolbarDirective, deps: [{ token: i1.PDFService }, { token: i2.ToolBarButtonComponent }, { token: i3.ContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
55
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: PDFCommandToolbarDirective, isStandalone: true, selector: "[kendoGridPDFTool]", usesInheritance: true, ngImport: i0 });
59
56
  }
60
57
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PDFCommandToolbarDirective, decorators: [{
61
58
  type: Directive,
@@ -63,4 +60,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
63
60
  selector: '[kendoGridPDFTool]',
64
61
  standalone: true
65
62
  }]
66
- }], ctorParameters: function () { return [{ type: i1.PDFService }, { type: i2.ToolBarButtonComponent }]; } });
63
+ }], ctorParameters: function () { return [{ type: i1.PDFService }, { type: i2.ToolBarButtonComponent }, { type: i3.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
@@ -110,7 +110,7 @@ export class CellComponent {
110
110
  get isSpanColumn() {
111
111
  return isSpanColumn(this.column) && !this.column.templateRef;
112
112
  }
113
- get childColumns() {
113
+ get children() {
114
114
  return columnsToRender([this.column]);
115
115
  }
116
116
  get isRowReorderColumn() {
@@ -183,7 +183,7 @@ export class CellComponent {
183
183
  [ngTemplateOutletContext]="templateContext">
184
184
  </ng-template>
185
185
  <ng-container *ngIf="isSpanColumn">
186
- <ng-container *ngFor="let childColumn of childColumns">
186
+ <ng-container *ngFor="let childColumn of children">
187
187
  {{ dataItem | valueOf: childColumn.field: childColumn.format}}
188
188
  </ng-container>
189
189
  </ng-container>
@@ -275,7 +275,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
275
275
  [ngTemplateOutletContext]="templateContext">
276
276
  </ng-template>
277
277
  <ng-container *ngIf="isSpanColumn">
278
- <ng-container *ngFor="let childColumn of childColumns">
278
+ <ng-container *ngFor="let childColumn of children">
279
279
  {{ dataItem | valueOf: childColumn.field: childColumn.format}}
280
280
  </ng-container>
281
281
  </ng-container>
@@ -433,7 +433,7 @@ export class HeaderComponent {
433
433
  const arr = this.dropTargets.toArray();
434
434
  const firstSpan = arr.find(t => t.context.column.parent === parent);
435
435
  const index = arr.indexOf(firstSpan);
436
- const adjust = e.before ? 0 : parent.childColumns.length - 1;
436
+ const adjust = e.before ? 0 : parent.children.length - 1;
437
437
  target = arr[index + adjust];
438
438
  }
439
439
  return mergeObjects(e, { target });
@@ -616,7 +616,7 @@ export class ListComponent {
616
616
  for (let idx = 0; idx < leafColumns.length; idx++) {
617
617
  const column = leafColumns[idx];
618
618
  if (column.isSpanColumn) {
619
- viewportEnd += column.childColumns.length;
619
+ viewportEnd += column.children.length;
620
620
  }
621
621
  }
622
622
  this.navigationService.setColumnViewport(viewportStart, viewportEnd);
@@ -348,7 +348,7 @@ export class TableBodyComponent {
348
348
  }
349
349
  get footerColumns() {
350
350
  const colsToRender = Array.from(this.columns).reduce((cols, col) => {
351
- const newCols = (col instanceof SpanColumnComponent) ? Array.from(col.childColumns) : [col];
351
+ const newCols = (col instanceof SpanColumnComponent) ? Array.from(col.children) : [col];
352
352
  return [...cols, ...newCols];
353
353
  }, []);
354
354
  return colsToRender;
@@ -0,0 +1,210 @@
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, NgZone, Input, Renderer2, ChangeDetectorRef } from '@angular/core';
6
+ import { PopupService } from '@progress/kendo-angular-popup';
7
+ import { RefreshService, ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
8
+ import { ColumnListComponent } from '../../../column-menu/column-list.component';
9
+ import { closest, isPresent } from '@progress/kendo-angular-common';
10
+ import { Subscription } from 'rxjs';
11
+ import { columnsIcon } from '@progress/kendo-svg-icons';
12
+ import { ContextService } from '../../../common/provider.service';
13
+ import { filter, take } from 'rxjs/operators';
14
+ import { AdaptiveGridService } from '../../../common/adaptiveness.service';
15
+ import { ColumnInfoService } from '../../../common/column-info.service';
16
+ import { ToolbarToolBase } from '../../../common/toolbar-tool-base.directive';
17
+ import { ToolbarToolName } from '../../../navigation/toolbar-tool-name';
18
+ import * as i0 from "@angular/core";
19
+ import * as i1 from "@progress/kendo-angular-popup";
20
+ import * as i2 from "@progress/kendo-angular-toolbar";
21
+ import * as i3 from "../../../common/provider.service";
22
+ import * as i4 from "../../../common/adaptiveness.service";
23
+ import * as i5 from "../../../common/column-info.service";
24
+ let incrementingId = 0;
25
+ /**
26
+ * Represents the `column-chooser` toolbar tool of the Grid.
27
+ * You can apply this directive to any `kendo-toolbar-button` element inside a
28
+ * ToolbarComponent used in the Grid.
29
+ *
30
+ * @example
31
+ * ```html-no-run
32
+ * <kendo-grid>
33
+ * <kendo-toolbar>
34
+ * <kendo-toolbar-button kendoGridColumnChooserTool></kendo-toolbar-button>
35
+ * </kendo-toolbar>
36
+ * </kendo-grid>
37
+ * ```
38
+ */
39
+ export class ColumnChooserToolbarDirective extends ToolbarToolBase {
40
+ renderer;
41
+ popupSerivce;
42
+ host;
43
+ ctx;
44
+ zone;
45
+ refresh;
46
+ adaptiveGridService;
47
+ columnInfoService;
48
+ /**
49
+ * Specifies if the changes in the visibility of the column will be immediately applied.
50
+ *
51
+ * @default false
52
+ */
53
+ autoSync = false;
54
+ /**
55
+ * Specifies if all columns can be hidden.
56
+ *
57
+ * @default true
58
+ */
59
+ allowHideAll = true;
60
+ /**
61
+ * @hidden
62
+ */
63
+ get columns() {
64
+ return this.columnInfoService.leafNamedColumns;
65
+ }
66
+ popupRef;
67
+ subs = new Subscription();
68
+ actionSheetCloseSub;
69
+ nextId = incrementingId++;
70
+ constructor(renderer, popupSerivce, host, ctx, zone, refresh, adaptiveGridService, columnInfoService, cdr) {
71
+ super(host, ToolbarToolName.columns, ctx, zone, cdr);
72
+ this.renderer = renderer;
73
+ this.popupSerivce = popupSerivce;
74
+ this.host = host;
75
+ this.ctx = ctx;
76
+ this.zone = zone;
77
+ this.refresh = refresh;
78
+ this.adaptiveGridService = adaptiveGridService;
79
+ this.columnInfoService = columnInfoService;
80
+ }
81
+ ngOnInit() {
82
+ this.subs.add(this.host.click.subscribe(e => this.onClick(e)));
83
+ const hasToolbarIcon = isPresent(this.host.toolbarOptions.icon) && this.host.toolbarOptions.icon !== '';
84
+ const hasOverflowIcon = isPresent(this.host.overflowOptions.icon) && this.host.overflowOptions.icon !== '';
85
+ const hasIcon = hasToolbarIcon && hasOverflowIcon;
86
+ const hasSvgIcon = isPresent(this.host.toolbarOptions.svgIcon) && isPresent(this.host.overflowOptions.svgIcon);
87
+ if (!hasIcon) {
88
+ this.host.icon = 'columns';
89
+ }
90
+ if (!hasSvgIcon) {
91
+ this.host.svgIcon = columnsIcon;
92
+ }
93
+ }
94
+ ngAfterViewInit() {
95
+ super.ngAfterViewInit();
96
+ this.zone.onStable.pipe(take(1)).subscribe(() => {
97
+ this.buttonElement?.setAttribute('aria-haspopup', 'dialog');
98
+ this.buttonElement?.setAttribute('aria-expanded', 'false');
99
+ this.buttonElement?.setAttribute('title', this.ctx.localization.get('columns'));
100
+ });
101
+ this.subs.add(this.refresh.onRefresh.pipe(filter((tool) => tool === this.host)).subscribe((tool) => {
102
+ if (tool.overflows && this.popupRef) {
103
+ this.popupRef.close();
104
+ }
105
+ }));
106
+ }
107
+ ngOnDestroy() {
108
+ super.ngOnDestroy();
109
+ this.subs.unsubscribe();
110
+ if (this.actionSheetCloseSub) {
111
+ this.actionSheetCloseSub.unsubscribe();
112
+ this.actionSheetCloseSub = null;
113
+ }
114
+ }
115
+ /**
116
+ * @hidden
117
+ */
118
+ onClick(e) {
119
+ e.preventDefault();
120
+ if (this.ctx.grid.adaptiveMode === 'auto' && this.adaptiveGridService.windowSize !== 'large') {
121
+ if (!this.ctx.grid.isActionSheetExpanded) {
122
+ this.adaptiveGridService.viewType = 'columnChooserToolbarTool';
123
+ this.adaptiveGridService.columns = this.columns;
124
+ this.ctx.grid.adaptiveRenderer.actionSheet.toggle(true);
125
+ this.host.selected = true;
126
+ this.actionSheetCloseSub = this.ctx.grid.adaptiveRenderer.actionSheet.collapse.subscribe(() => this.host.selected = false);
127
+ }
128
+ }
129
+ else {
130
+ this.togglePopup();
131
+ }
132
+ }
133
+ togglePopup() {
134
+ if (!this.popupRef) {
135
+ const direction = this.ctx.localization.rtl ? 'right' : 'left';
136
+ this.popupRef = this.popupSerivce.open({
137
+ anchor: this.buttonElement,
138
+ content: ColumnListComponent,
139
+ positionMode: 'absolute',
140
+ anchorAlign: { vertical: 'bottom', horizontal: direction },
141
+ popupAlign: { vertical: 'top', horizontal: direction }
142
+ });
143
+ this.adaptiveGridService.popupRef = this.popupRef;
144
+ const popupElement = this.popupRef.popupElement;
145
+ const popupId = `k-column-chooser-tool-${this.nextId}-popup`;
146
+ const popupAriaElement = popupElement.querySelector('.k-popup');
147
+ this.zone.runOutsideAngular(() => {
148
+ this.renderer.listen(popupAriaElement, 'keydown', (e) => {
149
+ if (e.key === 'Escape') {
150
+ this.closePopup(true);
151
+ }
152
+ });
153
+ });
154
+ this.renderer.setAttribute(popupElement, 'dir', this.ctx.localization.rtl ? 'rtl' : 'ltr');
155
+ this.renderer.setAttribute(popupAriaElement, 'id', popupId);
156
+ this.renderer.setAttribute(popupAriaElement, 'role', 'dialog');
157
+ this.buttonElement?.setAttribute('aria-expanded', 'true');
158
+ this.buttonElement?.setAttribute('aria-controls', popupId);
159
+ this.host.selected = true;
160
+ const columnList = this.popupRef.content.instance;
161
+ columnList.isLast = true;
162
+ columnList.autoSync = this.autoSync;
163
+ columnList.allowHideAll = this.allowHideAll;
164
+ columnList.applyText = this.ctx.localization.get('columnsApply');
165
+ columnList.resetText = this.ctx.localization.get('columnsReset');
166
+ columnList.columns = this.ctx.grid.columns;
167
+ columnList.ariaLabel = this.ctx.localization.get('columns');
168
+ this.subs.add(this.popupRef.popup.instance.anchorViewportLeave.subscribe(() => {
169
+ this.closePopup(true);
170
+ }));
171
+ this.subs.add(columnList.apply.subscribe(() => {
172
+ this.closePopup();
173
+ }));
174
+ this.zone.runOutsideAngular(() => this.renderer.listen('document', 'click', ({ target }) => {
175
+ if (this.popupRef && !closest(target, node => node === this.popupRef.popupElement || node === this.buttonElement)) {
176
+ this.zone.run(() => {
177
+ this.closePopup();
178
+ });
179
+ }
180
+ }));
181
+ }
182
+ else {
183
+ this.closePopup();
184
+ }
185
+ }
186
+ closePopup(focusAnchor = false) {
187
+ this.popupRef.close();
188
+ this.popupRef = null;
189
+ this.buttonElement?.setAttribute('aria-expanded', 'false');
190
+ this.buttonElement?.removeAttribute('aria-controls');
191
+ this.host.selected = false;
192
+ focusAnchor && this.buttonElement?.focus();
193
+ }
194
+ get buttonElement() {
195
+ return this.host.getButton();
196
+ }
197
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnChooserToolbarDirective, deps: [{ token: i0.Renderer2 }, { token: i1.PopupService }, { token: i2.ToolBarButtonComponent }, { token: i3.ContextService }, { token: i0.NgZone }, { token: i2.RefreshService }, { token: i4.AdaptiveGridService }, { token: i5.ColumnInfoService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
198
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ColumnChooserToolbarDirective, isStandalone: true, selector: "[kendoGridColumnChooserTool]", inputs: { autoSync: "autoSync", allowHideAll: "allowHideAll" }, usesInheritance: true, ngImport: i0 });
199
+ }
200
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnChooserToolbarDirective, decorators: [{
201
+ type: Directive,
202
+ args: [{
203
+ selector: '[kendoGridColumnChooserTool]',
204
+ standalone: true
205
+ }]
206
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i1.PopupService }, { type: i2.ToolBarButtonComponent }, { type: i3.ContextService }, { type: i0.NgZone }, { type: i2.RefreshService }, { type: i4.AdaptiveGridService }, { type: i5.ColumnInfoService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { autoSync: [{
207
+ type: Input
208
+ }], allowHideAll: [{
209
+ type: Input
210
+ }] } });
@@ -13,12 +13,14 @@ import { ColumnInfoService } from '../../../common/column-info.service';
13
13
  import { take } from 'rxjs/operators';
14
14
  import { FilterService } from '../../../filtering/filter.service';
15
15
  import { FilterToolWrapperComponent } from './filter-tool-wrapper.component';
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 "../../../filtering/filter.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 filtering columns of the Grid.
@@ -45,12 +47,20 @@ export class FilterCommandToolbarDirective {
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, filterService, columnInfoService, ngZone, renderer) {
57
+ /**
58
+ * @hidden
59
+ */
60
+ isFilterApplied(filter) {
61
+ return isPresent(filter) && filter.filters?.length > 0;
62
+ }
63
+ constructor(host, popupService, ctx, filterService, columnInfoService, ngZone, renderer, adaptiveGridService) {
54
64
  this.host = host;
55
65
  this.popupService = popupService;
56
66
  this.ctx = ctx;
@@ -58,18 +68,21 @@ export class FilterCommandToolbarDirective {
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.filterService.changes.subscribe(filter => {
65
- this.host.showBadge = isPresent(filter) && filter.filters.length > 0;
76
+ this.host.showBadge = this.isFilterApplied(filter);
66
77
  }));
78
+ this.host.hasBadgeContainer = true;
79
+ this.host.showBadge = this.isFilterApplied(this.ctx.grid.filter);
67
80
  const hasToolbarIcon = isPresent(this.host.toolbarOptions.icon) && this.host.toolbarOptions.icon !== '';
68
81
  const hasOverflowIcon = isPresent(this.host.overflowOptions.icon) && this.host.overflowOptions.icon !== '';
69
82
  const hasIcon = hasToolbarIcon && hasOverflowIcon;
70
83
  const hasSvgIcon = isPresent(this.host.toolbarOptions.svgIcon) && isPresent(this.host.overflowOptions.svgIcon);
71
84
  if (!hasIcon) {
72
- this.host.icon = 'k-i-filter';
85
+ this.host.icon = 'filter';
73
86
  }
74
87
  if (!hasSvgIcon) {
75
88
  this.host.svgIcon = filterIcon;
@@ -81,9 +94,9 @@ export class FilterCommandToolbarDirective {
81
94
  this.host.text = this.ctx.localization.get(`filterToolbarToolText`);
82
95
  });
83
96
  }
84
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-haspopup', 'dialog');
85
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-expanded', 'false');
86
- this.host.toolbarButtonElement.nativeElement.setAttribute('title', this.ctx.localization.get('filter'));
97
+ this.buttonElement?.setAttribute('aria-haspopup', 'dialog');
98
+ this.buttonElement?.setAttribute('aria-expanded', 'false');
99
+ this.buttonElement?.setAttribute('title', this.ctx.localization.get('filterToolbarToolText'));
87
100
  }
88
101
  ngOnDestroy() {
89
102
  if (this.toolSubs) {
@@ -96,6 +109,10 @@ export class FilterCommandToolbarDirective {
96
109
  this.popupRef.close();
97
110
  this.popupRef = null;
98
111
  }
112
+ if (this.actionSheetCloseSub) {
113
+ this.actionSheetCloseSub.unsubscribe();
114
+ this.actionSheetCloseSub = null;
115
+ }
99
116
  if (this.removeClickListener) {
100
117
  this.removeClickListener();
101
118
  this.removeClickListener = null;
@@ -111,31 +128,45 @@ export class FilterCommandToolbarDirective {
111
128
  }
112
129
  openPopup() {
113
130
  const direction = this.ctx.localization.rtl ? 'right' : 'left';
114
- this.popupRef = this.popupService.open({
115
- anchor: this.host.toolbarButtonElement.nativeElement,
116
- content: FilterToolWrapperComponent,
117
- popupClass: 'k-grid-columnmenu-popup',
118
- positionMode: 'absolute',
119
- anchorAlign: { vertical: 'bottom', horizontal: direction },
120
- popupAlign: { vertical: 'top', horizontal: direction }
121
- });
122
- this.setPopupAttributes();
123
- this.ngZone.runOutsideAngular(() => {
124
- if (!isDocumentAvailable()) {
125
- return;
131
+ if (this.ctx.grid.adaptiveMode === 'auto' && this.adaptiveGridService.windowSize !== 'large') {
132
+ if (!this.ctx.grid.isActionSheetExpanded) {
133
+ this.adaptiveGridService.viewType = 'filterToolbarTool';
134
+ this.ctx.grid.adaptiveRenderer.actionSheet.toggle(true);
135
+ this.host.selected = true;
136
+ this.actionSheetCloseSub = this.ctx.grid.adaptiveRenderer.actionSheet.collapse.subscribe(() => this.host.selected = false);
126
137
  }
127
- this.removeClickListener = this.renderer.listen('document', 'click', (e) => {
128
- if (this.popupRef && !closest(e.target, node => node === this.popupRef.popupElement || node === this.host.toolbarButtonElement.nativeElement)) {
129
- this.closePopup();
138
+ }
139
+ else {
140
+ this.popupRef = this.popupService.open({
141
+ anchor: this.buttonElement,
142
+ content: FilterToolWrapperComponent,
143
+ popupClass: 'k-grid-columnmenu-popup',
144
+ positionMode: 'absolute',
145
+ anchorAlign: { vertical: 'bottom', horizontal: direction },
146
+ popupAlign: { vertical: 'top', horizontal: direction }
147
+ });
148
+ this.adaptiveGridService.popupRef = this.popupRef;
149
+ this.setPopupAttributes();
150
+ this.host.selected = true;
151
+ this.ngZone.runOutsideAngular(() => {
152
+ if (!isDocumentAvailable()) {
153
+ return;
130
154
  }
155
+ this.removeClickListener = this.renderer.listen('document', 'click', (e) => {
156
+ if (this.popupRef && !closest(e.target, node => node === this.popupRef.popupElement || node === this.buttonElement)) {
157
+ this.ngZone.run(() => {
158
+ this.closePopup();
159
+ });
160
+ }
161
+ });
131
162
  });
132
- });
133
- this.popupSubs = this.popupRef.popup.instance.anchorViewportLeave.subscribe(() => {
134
- this.popupSubs?.unsubscribe();
135
- this.popupSubs = null;
136
- this.closePopup();
137
- });
138
- this.initPopupProperties();
163
+ this.popupSubs = this.popupRef.popup.instance.anchorViewportLeave.subscribe(() => {
164
+ this.popupSubs?.unsubscribe();
165
+ this.popupSubs = null;
166
+ this.closePopup();
167
+ });
168
+ this.initPopupProperties();
169
+ }
139
170
  }
140
171
  setPopupAttributes() {
141
172
  const popupElement = this.popupRef.popupElement;
@@ -144,8 +175,8 @@ export class FilterCommandToolbarDirective {
144
175
  this.renderer.setAttribute(popupElement, 'dir', this.ctx.localization.rtl ? 'rtl' : 'ltr');
145
176
  this.renderer.setAttribute(popupAriaElement, 'id', popupId);
146
177
  this.renderer.setAttribute(popupAriaElement, 'role', 'dialog');
147
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-expanded', 'true');
148
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-controls', popupId);
178
+ this.buttonElement?.setAttribute('aria-expanded', 'true');
179
+ this.buttonElement?.setAttribute('aria-controls', popupId);
149
180
  }
150
181
  initPopupProperties() {
151
182
  this.popupRef.content.instance.columnInfoService = this.columnInfoService;
@@ -157,8 +188,9 @@ export class FilterCommandToolbarDirective {
157
188
  }));
158
189
  }
159
190
  closePopup() {
160
- this.host.toolbarButtonElement.nativeElement.setAttribute('aria-expanded', 'false');
161
- this.host.toolbarButtonElement.nativeElement.removeAttribute('aria-controls');
191
+ this.buttonElement?.setAttribute('aria-expanded', 'false');
192
+ this.buttonElement?.removeAttribute('aria-controls');
193
+ this.host.selected = false;
162
194
  if (this.popupRef) {
163
195
  this.popupRef.close();
164
196
  this.popupRef = null;
@@ -172,7 +204,10 @@ export class FilterCommandToolbarDirective {
172
204
  this.removeClickListener = null;
173
205
  }
174
206
  }
175
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterCommandToolbarDirective, deps: [{ token: i1.ToolBarButtonComponent }, { token: i2.PopupService }, { token: i3.ContextService }, { token: i4.FilterService }, { token: i5.ColumnInfoService }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
207
+ get buttonElement() {
208
+ return this.host.getButton();
209
+ }
210
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterCommandToolbarDirective, deps: [{ token: i1.ToolBarButtonComponent }, { token: i2.PopupService }, { token: i3.ContextService }, { token: i4.FilterService }, { token: i5.ColumnInfoService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i6.AdaptiveGridService }], target: i0.ɵɵFactoryTarget.Directive });
176
211
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: FilterCommandToolbarDirective, isStandalone: true, selector: "[kendoGridFilterTool]", ngImport: i0 });
177
212
  }
178
213
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterCommandToolbarDirective, decorators: [{
@@ -181,4 +216,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
181
216
  selector: '[kendoGridFilterTool]',
182
217
  standalone: true
183
218
  }]
184
- }], ctorParameters: function () { return [{ type: i1.ToolBarButtonComponent }, { type: i2.PopupService }, { type: i3.ContextService }, { type: i4.FilterService }, { type: i5.ColumnInfoService }, { type: i0.NgZone }, { type: i0.Renderer2 }]; } });
219
+ }], ctorParameters: function () { return [{ type: i1.ToolBarButtonComponent }, { type: i2.PopupService }, { type: i3.ContextService }, { type: i4.FilterService }, { type: i5.ColumnInfoService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i6.AdaptiveGridService }]; } });
@@ -12,6 +12,7 @@ import { SinglePopupService } from '../../../common/single-popup.service';
12
12
  import { ScrollSyncService } from '../../../scrolling/scroll-sync.service';
13
13
  import { ColumnInfoService } from '../../../common/column-info.service';
14
14
  import { cloneFilters } from '../../../common/filter-descriptor-differ';
15
+ import { AdaptiveGridService } from '../../../common/adaptiveness.service';
15
16
  import * as i0 from "@angular/core";
16
17
  import * as i1 from "@progress/kendo-angular-buttons";
17
18
  /**
@@ -26,22 +27,23 @@ export class FilterToolWrapperComponent {
26
27
  this.close.emit();
27
28
  this.hostButton?.focus(event);
28
29
  }
30
+ onClick(event) {
31
+ if (this.hostButton.location !== 'toolbar') {
32
+ event.stopImmediatePropagation();
33
+ }
34
+ }
29
35
  close = new EventEmitter();
30
36
  hostButton;
31
37
  clearIcon = filterClearIcon;
32
38
  columnInfoService;
33
- popupRef;
34
- filter;
35
- subscriptions;
36
- _ctx;
37
39
  set ctx(ctx) {
38
40
  this._ctx = ctx;
41
+ this.filter = ctx.grid.filter;
39
42
  this.createPopup();
40
43
  }
41
44
  get ctx() {
42
45
  return this._ctx;
43
46
  }
44
- _filterService;
45
47
  set filterService(filterService) {
46
48
  this._filterService = filterService;
47
49
  this.subscriptions = this._filterService.changes.subscribe(filter => {
@@ -53,6 +55,11 @@ export class FilterToolWrapperComponent {
53
55
  return this._filterService;
54
56
  }
55
57
  columnMenuService;
58
+ popupRef;
59
+ filter;
60
+ subscriptions;
61
+ _ctx;
62
+ _filterService;
56
63
  constructor(injector) {
57
64
  this.injector = injector;
58
65
  }
@@ -81,6 +88,7 @@ export class FilterToolWrapperComponent {
81
88
  { provide: FilterService, useValue: this._filterService },
82
89
  { provide: ContextService, useValue: this._ctx },
83
90
  { provide: ColumnInfoService, useValue: this.columnInfoService },
91
+ AdaptiveGridService,
84
92
  SinglePopupService,
85
93
  ScrollSyncService
86
94
  ],
@@ -93,10 +101,15 @@ export class FilterToolWrapperComponent {
93
101
  }
94
102
  }
95
103
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilterToolWrapperComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
96
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FilterToolWrapperComponent, isStandalone: true, selector: "kendo-filter-tool-wrapper", outputs: { close: "close" }, host: { listeners: { "keydown.escape": "onEscKeyDown($event)" }, properties: { "class.k-column-menu": "this.wrapperClasses", "class.k-column-menu-md": "this.wrapperClasses" } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
104
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FilterToolWrapperComponent, isStandalone: true, selector: "kendo-filter-tool-wrapper", outputs: { close: "close" }, host: { listeners: { "keydown.escape": "onEscKeyDown($event)", "click": "onClick($event)" }, properties: { "class.k-column-menu": "this.wrapperClasses", "class.k-column-menu-md": "this.wrapperClasses" } }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
97
105
  <ng-container #container></ng-container>
98
106
  <div class="k-actions k-actions-stretched k-actions-horizontal k-column-menu-footer">
99
- <button kendoButton [svgIcon]="clearIcon" (click)="clear()">Clear all filters</button>
107
+ <button kendoButton
108
+ [svgIcon]="clearIcon"
109
+ icon="filter-clear"
110
+ (click)="clear()">
111
+ {{ctx?.localization.get('filterClearAllButton')}}
112
+ </button>
100
113
  </div>
101
114
  `, isInline: true, dependencies: [{ 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"] }] });
102
115
  }
@@ -107,7 +120,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
107
120
  template: `
108
121
  <ng-container #container></ng-container>
109
122
  <div class="k-actions k-actions-stretched k-actions-horizontal k-column-menu-footer">
110
- <button kendoButton [svgIcon]="clearIcon" (click)="clear()">Clear all filters</button>
123
+ <button kendoButton
124
+ [svgIcon]="clearIcon"
125
+ icon="filter-clear"
126
+ (click)="clear()">
127
+ {{ctx?.localization.get('filterClearAllButton')}}
128
+ </button>
111
129
  </div>
112
130
  `,
113
131
  standalone: true,
@@ -125,6 +143,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
125
143
  }], onEscKeyDown: [{
126
144
  type: HostListener,
127
145
  args: ['keydown.escape', ['$event']]
146
+ }], onClick: [{
147
+ type: HostListener,
148
+ args: ['click', ['$event']]
128
149
  }], close: [{
129
150
  type: Output
130
151
  }] } });