@progress/kendo-angular-grid 16.10.0-develop.4 → 16.10.1-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.
@@ -24,11 +24,12 @@ export declare class CellSelectionAggregateService {
24
24
  private ctx;
25
25
  private dataChanges;
26
26
  private columnInfoService;
27
- data: any;
28
27
  selectedItems: Array<CellSelectionItem | RowArgs>;
29
28
  groupedAggregates: GroupedAggregates;
30
29
  aggregates: SelectionAggregates;
30
+ private sub;
31
31
  constructor(ctx: ContextService, dataChanges: LocalDataChangesService, columnInfoService: ColumnInfoService);
32
+ ngOnDestroy(): void;
32
33
  isAggregateIncluded(aggregate: SelectionAggregate): boolean;
33
34
  init(): void;
34
35
  onSelectionChange(selectionArgs: SelectionEvent): SelectionAggregates;
@@ -108,6 +108,7 @@ export declare class ColumnMenuComponent implements AfterViewInit, OnChanges, On
108
108
  moreVerticalIcon: SVGIcon;
109
109
  popupRef: any;
110
110
  private closeSubscription;
111
+ private popupSubs;
111
112
  constructor(navigationService: NavigationService, popupService: SinglePopupService, service: ColumnMenuService, ctx: ContextService, renderer: Renderer2, cdr: ChangeDetectorRef, columnInfoService: ColumnInfoService, idService: IdService);
112
113
  /**
113
114
  * @hidden
@@ -173,6 +174,7 @@ export declare class ColumnMenuComponent implements AfterViewInit, OnChanges, On
173
174
  */
174
175
  get columnMenuTitle(): string;
175
176
  private getExpandedState;
177
+ private updateAria;
176
178
  static ɵfac: i0.ɵɵFactoryDeclaration<ColumnMenuComponent, [null, null, null, null, null, null, null, { optional: true; }]>;
177
179
  static ɵcmp: i0.ɵɵComponentDeclaration<ColumnMenuComponent, "kendo-grid-column-menu", never, { "standalone": "standalone"; "column": "column"; "settings": "settings"; "sort": "sort"; "filter": "filter"; "sortable": "sortable"; "columnMenuTemplate": "columnMenuTemplate"; "tabIndex": "tabIndex"; }, {}, never, never, true, never>;
178
180
  }
@@ -6,6 +6,8 @@ import { Injectable } from '@angular/core';
6
6
  import { ContextService } from '../common/provider.service';
7
7
  import { ColumnInfoService } from '../common/column-info.service';
8
8
  import { LocalDataChangesService } from '../editing/local-data-changes.service';
9
+ import { recursiveFlatMap } from '../utils';
10
+ import { Subscription } from 'rxjs';
9
11
  import * as i0 from "@angular/core";
10
12
  import * as i1 from "../common/provider.service";
11
13
  import * as i2 from "../editing/local-data-changes.service";
@@ -31,6 +33,10 @@ export class CellSelectionAggregateService {
31
33
  earliest: null,
32
34
  latest: null
33
35
  };
36
+ this.sub = new Subscription();
37
+ }
38
+ ngOnDestroy() {
39
+ this.sub.unsubscribe();
34
40
  }
35
41
  isAggregateIncluded(aggregate) {
36
42
  const { cellAggregates } = this.ctx.grid.selectable;
@@ -40,8 +46,15 @@ export class CellSelectionAggregateService {
40
46
  return true;
41
47
  }
42
48
  init() {
49
+ this.sub.add(this.ctx.grid.dataStateChange.subscribe(_ => {
50
+ // nullifies aggregates and sets default count to avoid mismatching state -
51
+ // https://github.com/telerik/kendo-angular-private/issues/2964
52
+ this.nullifyAggregates();
53
+ if (this.isAggregateIncluded('count')) {
54
+ this.aggregates['count'] = 0;
55
+ }
56
+ }));
43
57
  if (this.ctx.grid.selectable.cellAggregates) {
44
- this.data = this.dataChanges.data ? this.dataChanges.data : this.ctx.grid.data;
45
58
  if (this.isAggregateIncluded('count')) {
46
59
  this.aggregates['count'] = 0;
47
60
  }
@@ -80,10 +93,12 @@ export class CellSelectionAggregateService {
80
93
  });
81
94
  }
82
95
  else if (!this.isRowSelection) {
83
- const itemKey = this.data[item.itemKey];
96
+ // Enables working with the current Grid data regardless of its form (array, GridDataResult, GroupedResult).
97
+ // Currently gets the item by index only - https://github.com/telerik/kendo-angular-private/issues/2964
98
+ const selectedItem = this.ctx.grid.flatData.flatMap(recursiveFlatMap)[item.itemKey];
84
99
  const field = fields[item.columnKey];
85
- if (itemKey && itemKey.hasOwnProperty(field)) {
86
- const cellValue = itemKey[fields[item.columnKey]];
100
+ if (selectedItem && selectedItem.hasOwnProperty(field)) {
101
+ const cellValue = selectedItem[fields[item.columnKey]];
87
102
  this.groupAggregates(cellValue);
88
103
  }
89
104
  }
@@ -16,7 +16,6 @@ import { moreVerticalIcon, columnsIcon, filterIcon, slidersIcon } from '@progres
16
16
  import { TabContentDirective, TabStripComponent, TabStripTabComponent, TabTitleDirective } from '@progress/kendo-angular-layout';
17
17
  import { ColumnInfoService } from '../common/column-info.service';
18
18
  import { IdService } from '../common/id.service';
19
- import { take } from 'rxjs/operators';
20
19
  import { ColumnListComponent } from './column-list.component';
21
20
  import { FilterMenuContainerComponent } from '../filtering/menu/filter-menu-container.component';
22
21
  import { ColumnMenuFilterComponent } from './column-menu-filter.component';
@@ -220,6 +219,8 @@ export class ColumnMenuComponent {
220
219
  ngOnDestroy() {
221
220
  this.close();
222
221
  this.closeSubscription.unsubscribe();
222
+ this.popupSubs?.unsubscribe();
223
+ this.closeSubscription = this.popupSubs = null;
223
224
  }
224
225
  /**
225
226
  * @hidden
@@ -227,7 +228,7 @@ export class ColumnMenuComponent {
227
228
  toggle(e, anchor, template) {
228
229
  if (e) {
229
230
  e.preventDefault();
230
- e.stopImmediatePropagation();
231
+ e instanceof KeyboardEvent && e.stopImmediatePropagation();
231
232
  }
232
233
  this.expandedFilter = this.getExpandedState(this.settings.filter);
233
234
  this.expandedColumns = this.getExpandedState(this.settings.columnChooser);
@@ -237,12 +238,18 @@ export class ColumnMenuComponent {
237
238
  // automatically when the Popup is closed by clicking outside the anchor
238
239
  const ariaRoot = this.isNavigable ? anchor.closest('.k-table-th') : anchor;
239
240
  if (this.popupRef) {
240
- this.popupRef.popup.instance.close.pipe(take(1)).subscribe(() => {
241
- this.popupRef = null;
242
- const ariaRoot = this.isNavigable ? anchor.closest('.k-table-th') : anchor;
243
- ariaRoot && this.renderer.removeAttribute(ariaRoot, 'aria-controls');
244
- ariaRoot && this.renderer.setAttribute(ariaRoot, 'aria-expanded', 'false');
241
+ this.popupSubs?.unsubscribe();
242
+ this.popupSubs = this.popupRef.popup.instance.anchorViewportLeave.subscribe(() => {
243
+ this.popupSubs?.unsubscribe();
244
+ this.popupSubs = null;
245
+ this.close(true);
246
+ this.updateAria(ariaRoot);
245
247
  });
248
+ this.popupSubs.add(this.popupRef.popup.instance.close.subscribe(() => {
249
+ this.popupSubs?.unsubscribe();
250
+ this.popupSubs = this.popupRef = null;
251
+ this.updateAria(ariaRoot);
252
+ }));
246
253
  const popupAriaElement = this.popupRef.popupElement.querySelector('.k-grid-columnmenu-popup');
247
254
  if (popupAriaElement) {
248
255
  const popupId = getId(this.idService?.gridId());
@@ -296,6 +303,10 @@ export class ColumnMenuComponent {
296
303
  getExpandedState(menuItemSettings) {
297
304
  return typeof (menuItemSettings) === 'object' ? menuItemSettings.expanded : false;
298
305
  }
306
+ updateAria(ariaRoot) {
307
+ ariaRoot && this.renderer.removeAttribute(ariaRoot, 'aria-controls');
308
+ ariaRoot && this.renderer.setAttribute(ariaRoot, 'aria-expanded', 'false');
309
+ }
299
310
  }
300
311
  ColumnMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnMenuComponent, deps: [{ token: i1.NavigationService }, { token: i2.SinglePopupService }, { token: i3.ColumnMenuService }, { token: i4.ContextService }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i5.ColumnInfoService }, { token: i6.IdService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
301
312
  ColumnMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ColumnMenuComponent, isStandalone: true, selector: "kendo-grid-column-menu", inputs: { standalone: "standalone", column: "column", settings: "settings", sort: "sort", filter: "filter", sortable: "sortable", columnMenuTemplate: "columnMenuTemplate", tabIndex: "tabIndex" }, host: { properties: { "class.k-grid-column-menu-standalone": "this.standalone" } }, providers: [
@@ -10,6 +10,7 @@ import { Subject, Subscription } from 'rxjs';
10
10
  import { ScrollSyncService } from '../scrolling/scroll-sync.service';
11
11
  import { isDocumentAvailable } from '@progress/kendo-angular-common';
12
12
  import { ContextService } from './provider.service';
13
+ import { skip } from 'rxjs/operators';
13
14
  import * as i0 from "@angular/core";
14
15
  import * as i1 from "@progress/kendo-angular-popup";
15
16
  import * as i2 from "../scrolling/scroll-sync.service";
@@ -52,7 +53,8 @@ export class SinglePopupService {
52
53
  */
53
54
  this.onClose = new Subject();
54
55
  this.pointerEventsSub = new Subscription();
55
- this.scrollSubscription = scrollSyncService.changes.subscribe(() => this.destroy());
56
+ this.canClosePopup = true;
57
+ this.scrollSubscription = scrollSyncService.changes.pipe(skip(1)).subscribe(() => this.destroy());
56
58
  }
57
59
  /**
58
60
  * @hidden
@@ -12,7 +12,6 @@ import { replaceMessagePlaceholder } from '../../utils';
12
12
  import { filterIcon } from '@progress/kendo-svg-icons';
13
13
  import { ContextService } from '../../common/provider.service';
14
14
  import { IdService } from '../../common/id.service';
15
- import { take } from 'rxjs/operators';
16
15
  import { FilterMenuContainerComponent } from './filter-menu-container.component';
17
16
  import { IconWrapperComponent } from '@progress/kendo-angular-icons';
18
17
  import * as i0 from "@angular/core";
@@ -38,6 +37,9 @@ export class FilterMenuComponent {
38
37
  this.filterIcon = filterIcon;
39
38
  this.tabIndex = '-1';
40
39
  }
40
+ ngOnDestroy() {
41
+ this.cleanUp();
42
+ }
41
43
  get hasFilters() {
42
44
  return filtersByField(this.filter, (this.column || {}).field).length > 0;
43
45
  }
@@ -61,12 +63,15 @@ export class FilterMenuComponent {
61
63
  // automatically when the Popup is closed by clicking outside the anchor
62
64
  const ariaRoot = this.isNavigable ? anchor.closest('.k-table-th') : anchor;
63
65
  if (this.popupRef) {
64
- this.popupRef.popup.instance.close.pipe(take(1)).subscribe(() => {
65
- this.popupRef = null;
66
- const ariaRoot = this.isNavigable ? anchor.closest('.k-table-th') : anchor;
67
- ariaRoot && this.renderer.removeAttribute(ariaRoot, 'aria-controls');
68
- ariaRoot && this.renderer.setAttribute(ariaRoot, 'aria-expanded', 'false');
66
+ this.popupSubs?.unsubscribe();
67
+ this.popupSubs = this.popupRef.popup.instance.anchorViewportLeave.subscribe(() => {
68
+ this.close();
69
+ this.updateAria(ariaRoot);
69
70
  });
71
+ this.popupSubs.add(this.popupRef.popup.instance.close.subscribe(() => {
72
+ this.popupRef = null;
73
+ this.updateAria(ariaRoot);
74
+ }));
70
75
  const popupAriaElement = this.popupRef.popupElement.querySelector('.k-grid-filter-popup');
71
76
  if (popupAriaElement) {
72
77
  const popupId = getId(this.idService?.gridId());
@@ -88,9 +93,7 @@ export class FilterMenuComponent {
88
93
  return false;
89
94
  }
90
95
  close() {
91
- this.popupService.destroy();
92
- this.popupRef = null;
93
- this.cdr.markForCheck();
96
+ this.cleanUp();
94
97
  if (this.navigationService.tableEnabled) {
95
98
  this.navigationService.focusCell(0, this.column.leafIndex);
96
99
  }
@@ -98,6 +101,17 @@ export class FilterMenuComponent {
98
101
  this.anchor.nativeElement.focus();
99
102
  }
100
103
  }
104
+ updateAria(ariaRoot) {
105
+ ariaRoot && this.renderer.removeAttribute(ariaRoot, 'aria-controls');
106
+ ariaRoot && this.renderer.setAttribute(ariaRoot, 'aria-expanded', 'false');
107
+ }
108
+ cleanUp() {
109
+ this.popupService.destroy();
110
+ this.popupRef = null;
111
+ this.popupSubs?.unsubscribe();
112
+ this.popupSubs = null;
113
+ this.cdr.markForCheck();
114
+ }
101
115
  }
102
116
  FilterMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FilterMenuComponent, deps: [{ token: i1.FilterService }, { token: i2.SinglePopupService }, { token: i3.ContextService }, { token: i4.NavigationService }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i5.IdService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
103
117
  FilterMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FilterMenuComponent, isStandalone: true, selector: "kendo-grid-filter-menu", inputs: { column: "column", filter: "filter", tabIndex: "tabIndex" }, viewQueries: [{ propertyName: "anchor", first: true, predicate: ["anchor"], descendants: true, static: true }, { propertyName: "template", first: true, predicate: ["template"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: `