@progress/kendo-angular-grid 15.2.0 → 15.3.0-develop.3

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.
@@ -455,16 +455,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
455
455
  * @hidden
456
456
  */
457
457
  const ColumnMenuErrorMessages = {
458
- autoSizeColumn: 'The auto size column does not work with enabled virtual columns',
459
- autoSizeAllColumns: 'The auto size all columns does not work with enabled virtual columns',
460
- serviceInput: 'The service input of the predefined column menu components is mandatory.'
458
+ autoSizeColumn: `The auto size column does not work with enabled virtual columns.
459
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/column-menu/#toc-autosize-column-item.`,
460
+ autoSizeAllColumns: `The auto size all columns does not work with enabled virtual columns.
461
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/column-menu/#toc-autosize-all-columns-item.`,
462
+ serviceInput: `The service input of the predefined column menu components is mandatory.
463
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/column-menu/#toc-customizing-the-content.`
461
464
  };
462
465
  /**
463
466
  * @hidden
464
467
  */
465
468
  const ClipboardErrorMessages = {
466
- activeCellNavigable: 'Grid must be navigable to use "activeCell" as clipboard target type.',
467
- selectionSelectable: 'Grid must be selectable to use "selection" as clipboard target type.'
469
+ activeCellNavigable: `Grid must be navigable to use "activeCell" as clipboard target type.
470
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/clipboard/#toc-active-cell.`,
471
+ selectionSelectable: `Grid must be selectable to use "selection" as clipboard target type.
472
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/clipboard/#toc-current-selection.`
468
473
  };
469
474
  /**
470
475
  * @hidden
@@ -475,8 +480,10 @@ const ColumnConfigurationErrorMessages = {
475
480
  Please use only valid identifier names to ensure error-free operation.`,
476
481
  width: (value, parsedValue) => `Expected numeric value for column width, but got a string "${value}". Treating as ${parsedValue}px.`,
477
482
  invalidColumn: (column) => `Invalid column ${column}.`,
478
- requiredWidth: (columnType) => `${columnType} columns feature requires all columns to have set width.`,
479
- requiredScroll: (columnType) => `${columnType} columns are only supported when scrolling is enabled.`,
483
+ requiredWidth: (columnType) => `${columnType} columns feature requires all columns to have set width.
484
+ See https://www.telerik.com/kendo-angular-ui/components/grid/columns/${columnType.toLowerCase()}.`,
485
+ requiredScroll: (columnType) => `${columnType} columns are only supported when scrolling is enabled.
486
+ See https://www.telerik.com/kendo-angular-ui/components/grid/columns/${columnType.toLowerCase()}/`,
480
487
  groupColumnContent: 'ColumnGroupComponent should contain ColumnComponent or CommandColumnComponent.',
481
488
  lockedParent: 'Locked child columns require their parent columns to be locked.',
482
489
  columnNested: 'Columns can be nested only inside ColumnGroupComponent',
@@ -488,14 +495,16 @@ const ColumnConfigurationErrorMessages = {
488
495
  const GridConfigurationErrorMessages = {
489
496
  functionType: (propName, fn) => `${propName} must be a function, but received ${JSON.stringify(fn)}.`,
490
497
  incompatibleFeatures: (feat1Name, feat2Name) => `'Having both ${feat1Name} and ${feat2Name} is not supported.'`,
491
- nonLockedColumnPresent: 'There should be at least one non-locked column',
492
- rowHeightVirtual: 'Row height and detail row height settings require virtual scrolling mode to be enabled.',
493
- focusNavigable: 'The Grid should be configured as navigable to control focus',
498
+ nonLockedColumnPresent: 'There should be at least one non-locked column. See https://www.telerik.com/kendo-angular-ui/components/grid/columns/locked/#toc-known-limitations',
499
+ rowHeightVirtual: `The virtual scrolling functionality requires setting the rowHeight (and detailRowHeight when there are detail rows).
500
+ Row height and detail row height settings should be set only when virtual scrolling mode is enabled.
501
+ See https://www.telerik.com/kendo-angular-ui/components/grid/scroll-modes/virtual/#toc-getting-started.`,
502
+ focusNavigable: 'The Grid should be configured as navigable to control focus. See https://www.telerik.com/kendo-angular-ui/components/grid/keyboard-navigation/.',
494
503
  expandCollapseMethods: (expandMethodName, collapseMethodName, directiveName, callbackName) => `The ${expandMethodName} and ${collapseMethodName} methods should not be called
495
504
  when using the ${directiveName} directive or the ${callbackName} callback.
496
505
  These methods are provided only for backwards compatibility with legacy versions.`,
497
506
  requiredEditService: `The default edit service of the editing directives works only when binding to plain array.
498
- Please provide an editService.`,
507
+ Please provide an editService. See https://www.telerik.com/kendo-angular-ui/components/grid/editing/editing-directives/#toc-custom-editing-service.`,
499
508
  requiredModule: (exportedType, moduleName, componentSelector) => `Creating ${exportedType} requires including the ${moduleName} and adding the ${componentSelector} component.`,
500
509
  groupBindingDirectives: `Using the "kendoGridGroupBinding" directive in combination with the "kendoGridExpandGroupBy" directive
501
510
  or the "isGroupExpanded" callback is not supported. To use grouping with the "kendoGridGroupBinding" directive,
@@ -2517,8 +2526,11 @@ class ScrollRequestService {
2517
2526
  constructor() {
2518
2527
  this.requests = new Subject();
2519
2528
  }
2520
- scrollTo(request) {
2521
- this.requests.next(request);
2529
+ scrollTo(request, adjustIndex = true) {
2530
+ this.requests.next({ request, adjustIndex });
2531
+ }
2532
+ scrollToItem(request) {
2533
+ this.requests.next({ request });
2522
2534
  }
2523
2535
  }
2524
2536
  ScrollRequestService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ScrollRequestService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -2537,7 +2549,12 @@ const getGroupRowArgs = (groupItem) => {
2537
2549
  return { group: groupItem.data, groupIndex: groupItem.index, parentGroup: getGroupRowArgs(groupItem.parentGroup) };
2538
2550
  };
2539
2551
 
2540
- const isChildIndex = (targetIndex, parentIndex) => parentIndex !== targetIndex && targetIndex.startsWith(parentIndex);
2552
+ const isChildIndex = (targetIndex, parentIndex) => {
2553
+ const sameIndex = parentIndex === targetIndex;
2554
+ const lastSeparatorIndex = targetIndex.lastIndexOf('_');
2555
+ const sameSubGroupIndex = targetIndex.substring(0, lastSeparatorIndex) === parentIndex;
2556
+ return !sameIndex && sameSubGroupIndex;
2557
+ };
2541
2558
  /**
2542
2559
  * @hidden
2543
2560
  */
@@ -2570,10 +2587,10 @@ class GroupsService {
2570
2587
  }
2571
2588
  return expanded;
2572
2589
  }
2573
- toggleRow(groupItem) {
2590
+ toggleRow(groupItem, emit = true) {
2574
2591
  const parentGroup = getGroupRowArgs(groupItem.parentGroup);
2575
2592
  const expand = !this.isExpanded({ group: groupItem.data, groupIndex: groupItem.index, parentGroup });
2576
- this.changes.next({ group: groupItem.data, expand, groupIndex: groupItem.index, parentGroup });
2593
+ this.changes.next({ group: groupItem.data, expand, groupIndex: groupItem.index, parentGroup, emit });
2577
2594
  // if usercallback is given, the rowState should be ignored
2578
2595
  if (this.userCallback) {
2579
2596
  return;
@@ -3224,8 +3241,7 @@ class NavigationService {
3224
3241
  this.zone.onStable.pipe(take(1), map(() => args), ...operators);
3225
3242
  const onStable = onStableSubscriber();
3226
3243
  this.subs = new Subscription();
3227
- this.subs.add(this.cursor.changes
3228
- .subscribe(args => this.onCursorChanges(args)));
3244
+ this.subs.add(this.cursor.changes.subscribe(args => this.onCursorChanges(args)));
3229
3245
  this.subs.add(this.domEvents.focus.pipe(switchMap(onStable))
3230
3246
  .subscribe((args) => this.navigateTo(args.target)));
3231
3247
  this.subs.add(this.domEvents.focusOut.pipe(filter(() => this.mode !== 0 /* Standby */), switchMap(onStableSubscriber(takeUntil(this.domEvents.focus))))
@@ -4550,8 +4566,8 @@ const packageMetadata = {
4550
4566
  name: '@progress/kendo-angular-grid',
4551
4567
  productName: 'Kendo UI for Angular',
4552
4568
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
4553
- publishDate: 1710342300,
4554
- version: '15.2.0',
4569
+ publishDate: 1710360642,
4570
+ version: '15.3.0-develop.3',
4555
4571
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
4556
4572
  };
4557
4573
 
@@ -16777,7 +16793,26 @@ class RowHeightService {
16777
16793
  }, undefined);
16778
16794
  return result === undefined ? this.total - 1 : result;
16779
16795
  }
16780
- offset(rowIndex) {
16796
+ offset(rowIndex, adjustIndex = false) {
16797
+ if (adjustIndex) {
16798
+ let targetOffset = 0;
16799
+ let targetIndex = 0;
16800
+ for (let i = 0; i < rowIndex; i++) {
16801
+ targetOffset += this.rowHeight;
16802
+ targetIndex++;
16803
+ if (targetIndex === rowIndex) {
16804
+ return targetOffset;
16805
+ }
16806
+ if (this.isExpanded(i)) {
16807
+ targetOffset += this.detailRowHeight;
16808
+ targetIndex++;
16809
+ if (targetIndex === rowIndex) {
16810
+ return targetOffset;
16811
+ }
16812
+ }
16813
+ }
16814
+ return targetOffset;
16815
+ }
16781
16816
  return this.offsets[rowIndex];
16782
16817
  }
16783
16818
  totalHeight() {
@@ -18091,7 +18126,6 @@ TableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
18091
18126
  </ng-container>
18092
18127
  </td>
18093
18128
  </tr>
18094
-
18095
18129
  <ng-container *ngFor="let item of data; trackBy: trackByWrapper; let rowIndex = index;">
18096
18130
  <tr *ngIf="isGroup(item) && isParentGroupExpanded($any(item)) && showGroupHeader(item)"
18097
18131
  kendoGridGroupHeader
@@ -18321,7 +18355,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
18321
18355
  </ng-container>
18322
18356
  </td>
18323
18357
  </tr>
18324
-
18325
18358
  <ng-container *ngFor="let item of data; trackBy: trackByWrapper; let rowIndex = index;">
18326
18359
  <tr *ngIf="isGroup(item) && isParentGroupExpanded($any(item)) && showGroupHeader(item)"
18327
18360
  kendoGridGroupHeader
@@ -18779,7 +18812,7 @@ const elementAt = (index, elements, elementOffset) => {
18779
18812
  elementIdx += offset;
18780
18813
  }
18781
18814
  };
18782
- const rowAt = (index, rows) => elementAt(index, rows, row => row.hasAttribute('data-kendo-grid-item-index') ? 1 : 0);
18815
+ const rowAt = (index, rows) => elementAt(index, rows, () => 1);
18783
18816
  const cellAt = (index, cells) => elementAt(index, cells, cell => !hasClasses(cell, NON_DATA_CELL_CLASSES) ? parseInt(cell.getAttribute('colSpan'), 10) || 1 : 0);
18784
18817
  const EMPTY_OBJECT = {};
18785
18818
  /**
@@ -18856,7 +18889,7 @@ class ListComponent {
18856
18889
  this.rtl = false;
18857
18890
  this.scroller = scrollerFactory(this.dispatcher);
18858
18891
  this.subscriptions = detailsService.changes.subscribe(x => this.detailExpand(x));
18859
- this.subscriptions.add(scrollRequestService.requests.subscribe(x => this.scrollTo(x)));
18892
+ this.subscriptions.add(scrollRequestService.requests.subscribe(req => isPresent(req.adjustIndex) ? this.scrollTo(req.request, req.adjustIndex) : this.scrollToItem(req.request)));
18860
18893
  }
18861
18894
  get showFooter() {
18862
18895
  return this.groupable && this.groupable.showFooter;
@@ -19099,21 +19132,21 @@ class ListComponent {
19099
19132
  }
19100
19133
  });
19101
19134
  }
19102
- scrollToVirtualRow(itemIndex) {
19135
+ scrollToVirtualRow(itemIndex, adjustIndexForDetailTemplate = true) {
19103
19136
  if (!isDocumentAvailable()) {
19104
19137
  return;
19105
19138
  }
19106
- if (isPresent(this.detailTemplate)) {
19139
+ if (isPresent(this.detailTemplate) && adjustIndexForDetailTemplate) {
19107
19140
  itemIndex = Math.floor(itemIndex / 2);
19108
19141
  }
19109
- const offset = this.rowHeightService.offset(itemIndex);
19142
+ const offset = this.rowHeightService.offset(itemIndex, !adjustIndexForDetailTemplate);
19110
19143
  this.container.nativeElement.scrollTop = offset;
19111
19144
  this.resetNavigationViewport();
19112
19145
  }
19113
- scrollTo({ row, column }) {
19146
+ scrollTo({ row, column }, adjustIndex = false) {
19114
19147
  if (isNumber(row)) {
19115
19148
  if (this.isVirtual) {
19116
- this.scrollToVirtualRow(row);
19149
+ this.scrollToVirtualRow(row, adjustIndex);
19117
19150
  }
19118
19151
  else {
19119
19152
  const element = rowAt(row, this.table.nativeElement.rows);
@@ -19147,6 +19180,23 @@ class ListComponent {
19147
19180
  }
19148
19181
  }
19149
19182
  }
19183
+ scrollToItem(item) {
19184
+ if (!isDocumentAvailable()) {
19185
+ return;
19186
+ }
19187
+ const data = this.ctx.grid.data;
19188
+ const gridData = Array.isArray(data) ? data : data.data;
19189
+ const gridDataItems = gridData.flatMap(recursiveFlatMap);
19190
+ const dataItemIndex = gridDataItems.findIndex(dataItem => dataItem[item.idField] === item.id);
19191
+ if (dataItemIndex !== -1) {
19192
+ const row = Array.from(this.table.nativeElement.rows).find((r) => {
19193
+ const dataAttribute = r.getAttribute('data-kendo-grid-item-index');
19194
+ return dataAttribute && +dataAttribute === this.ctx.grid.skip + dataItemIndex;
19195
+ });
19196
+ row && row.scrollIntoView();
19197
+ this.isVirtual && this.resetNavigationViewport();
19198
+ }
19199
+ }
19150
19200
  resetNavigationViewport() {
19151
19201
  if (!isDocumentAvailable) {
19152
19202
  return;
@@ -20082,7 +20132,7 @@ const validateColumnsField = (columns) => expandColumns(columns.toArray())
20082
20132
  .filter(isColumnComponent)
20083
20133
  .filter(({ field }) => !isValidFieldName(field))
20084
20134
  .forEach(({ field }) => console.warn(ColumnConfigurationErrorMessages.fieldName(field)));
20085
- const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group }) => isPresent(group)))
20135
+ const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group, emit }) => emit && isPresent(group)))
20086
20136
  .subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
20087
20137
  const handleExpandCollapseDetailsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ dataItem }) => isPresent(dataItem)))
20088
20138
  .subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
@@ -20917,8 +20967,6 @@ class GridComponent {
20917
20967
  * This method is provided only for backwards-compatibility with legacy versions.
20918
20968
  * These versions tracked the expanded group state internally using the hierarchical group index.
20919
20969
  *
20920
- * The `expandGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
20921
- *
20922
20970
  * When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
20923
20971
  *
20924
20972
  * @param {string} index - The underscore separated hierarchical index of the group.
@@ -20933,8 +20981,6 @@ class GridComponent {
20933
20981
  * This method is provided only for backwards-compatibility with legacy versions.
20934
20982
  * These versions tracked the expanded group state internally using the hierarchical group index.
20935
20983
  *
20936
- * The `collapseGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
20937
- *
20938
20984
  * When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
20939
20985
  *
20940
20986
  * @param {string} index - The underscore separated hierarchical index of the group.
@@ -20948,12 +20994,6 @@ class GridComponent {
20948
20994
  resetGroupsState() {
20949
20995
  this.groupsService.reset();
20950
20996
  }
20951
- /**
20952
- * @hidden
20953
- */
20954
- expandGroupChildren(groupIndex) {
20955
- this.groupsService.expandChildren(groupIndex);
20956
- }
20957
20997
  /**
20958
20998
  * @hidden
20959
20999
  */
@@ -21022,7 +21062,6 @@ class GridComponent {
21022
21062
  this.attachElementEventHandlers();
21023
21063
  this.updateNavigationMetadata();
21024
21064
  this.applyAutoSize();
21025
- // this.sizingService.changes.next(this.size);
21026
21065
  }
21027
21066
  ngAfterContentChecked() {
21028
21067
  this.columnsContainer.refresh();
@@ -21379,7 +21418,13 @@ class GridComponent {
21379
21418
  * Scrolls to the specified row and column ([see example]({% slug scrollmmodes_grid %}#toc-scrolling-to-a-specific-row-and-column-index)).
21380
21419
  */
21381
21420
  scrollTo(request) {
21382
- this.scrollRequestService.scrollTo(request);
21421
+ this.scrollRequestService.scrollTo(request, false);
21422
+ }
21423
+ /**
21424
+ * Scrolls to the specified data item and column ([see example]({% slug scrollmmodes_grid %}#toc-scrolling-to-a-specific-row-and-column-index)).
21425
+ */
21426
+ scrollToItem(request) {
21427
+ this.scrollRequestService.scrollToItem(request);
21383
21428
  }
21384
21429
  /**
21385
21430
  * Changes the position of the specified column.
@@ -21608,16 +21653,19 @@ class GridComponent {
21608
21653
  throw new Error(GridConfigurationErrorMessages.incompatibleFeatures('detail template', 'sticky columns'));
21609
21654
  }
21610
21655
  if (this.lockedLeafColumns.length && !this.nonLockedLeafColumns.length) {
21611
- throw new Error(GridConfigurationErrorMessages.nonLockedColumnPresent);
21656
+ console.warn(GridConfigurationErrorMessages.nonLockedColumnPresent);
21612
21657
  }
21613
21658
  if ((locked || this.virtualColumns) && expandColumns(this.columnList.toArray()).filter(column => !column.width && !isColumnGroupComponent(column)).length) {
21614
- throw new Error(ColumnConfigurationErrorMessages.requiredWidth(locked ? 'Locked' : 'Virtual'));
21659
+ console.warn(ColumnConfigurationErrorMessages.requiredWidth(locked ? 'Locked' : 'Virtual'));
21615
21660
  }
21616
21661
  if (locked && !this.isScrollable) {
21617
- throw new Error(ColumnConfigurationErrorMessages.requiredScroll('Locked'));
21662
+ console.warn(ColumnConfigurationErrorMessages.requiredScroll('Locked'));
21618
21663
  }
21619
21664
  if (stickyColumns && !this.isScrollable) {
21620
- throw new Error(ColumnConfigurationErrorMessages.requiredScroll('Sticky'));
21665
+ console.warn(ColumnConfigurationErrorMessages.requiredScroll('Sticky'));
21666
+ }
21667
+ if (this.virtualColumns && !this.isScrollable) {
21668
+ console.warn(ColumnConfigurationErrorMessages.requiredScroll('Virtual'));
21621
21669
  }
21622
21670
  if (this.columnList.filter(isColumnGroupComponent).filter((x) => !x.hasChildren).length) {
21623
21671
  throw new Error(ColumnConfigurationErrorMessages.groupColumnContent);
@@ -21626,10 +21674,16 @@ class GridComponent {
21626
21674
  throw new Error(ColumnConfigurationErrorMessages.lockedParent);
21627
21675
  }
21628
21676
  if ((this.rowHeight || this.detailRowHeight) && !this.isVirtual) {
21629
- throw new Error(GridConfigurationErrorMessages.rowHeightVirtual);
21677
+ console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
21678
+ }
21679
+ if (!this.rowHeight && this.isVirtual) {
21680
+ console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
21681
+ }
21682
+ if (!this.detailRowHeight && this.isVirtual && this.detailTemplate) {
21683
+ console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
21630
21684
  }
21631
21685
  if (stickyColumns && expandColumns(this.columnList.toArray()).filter(column => !column.width && !isColumnGroupComponent(column)).length) {
21632
- throw new Error(ColumnConfigurationErrorMessages.requiredWidth('Sticky'));
21686
+ console.warn(ColumnConfigurationErrorMessages.requiredWidth('Sticky'));
21633
21687
  }
21634
21688
  if (stickyColumns && this.virtualColumns) {
21635
21689
  throw new Error(GridConfigurationErrorMessages.incompatibleFeatures('sticky columns', 'column virtualization'));
@@ -21927,7 +21981,10 @@ class GridComponent {
21927
21981
  return;
21928
21982
  }
21929
21983
  if (this.groupsService.isExpanded({ groupIndex: index }) !== expand) {
21930
- this.groupsService.toggleRow({ index });
21984
+ this.groupsService.toggleRow({ index }, false);
21985
+ if (this.ctx.groupBindingDirective) {
21986
+ this.ctx.groupBindingDirective[`group${expand ? 'Expand' : 'Collapse'}`]({ groupIndex: index });
21987
+ }
21931
21988
  }
21932
21989
  }
21933
21990
  shouldResetSelection(selectableChanges) {
@@ -26464,6 +26521,10 @@ const count = (groups, includeFooters = false) => (groups.reduce((acc, group) =>
26464
26521
  }
26465
26522
  return acc;
26466
26523
  }, 0));
26524
+ /**
26525
+ * @hidden
26526
+ */
26527
+ const noDescriptors = (descriptors) => !isPresent(descriptors) || !descriptors.length;
26467
26528
  /**
26468
26529
  * @hidden
26469
26530
  */
@@ -26539,8 +26600,11 @@ const skippedHeaders = (groupItem) => {
26539
26600
  * A directive which encapsulates the in-memory handling of grouping with virtual scrolling.
26540
26601
  */
26541
26602
  class GroupBindingDirective extends DataBindingDirective {
26542
- constructor(grid, changeDetector, localDataChangesService) {
26543
- super(grid, changeDetector, localDataChangesService);
26603
+ constructor(changeDetector, localDataChangesService, ctxService, groupsService) {
26604
+ super(ctxService.grid, changeDetector, localDataChangesService);
26605
+ this.groupsService = groupsService;
26606
+ this.gridSubs = new Subscription();
26607
+ ctxService.groupBindingDirective = this;
26544
26608
  }
26545
26609
  /**
26546
26610
  * The array of data which will be used to populate the Grid.
@@ -26561,7 +26625,9 @@ class GroupBindingDirective extends DataBindingDirective {
26561
26625
  * Defines the descriptors by which the data will be sorted.
26562
26626
  */
26563
26627
  set sort(value) {
26564
- const clear = this.state.sort !== value;
26628
+ const noCurrentDescriptors = noDescriptors(this.state.sort);
26629
+ const noIncomingDescriptors = noDescriptors(value);
26630
+ const clear = this.state.sort !== value && !(noCurrentDescriptors && noIncomingDescriptors);
26565
26631
  this.grid.sort = this.state.sort = value;
26566
26632
  if (clear) {
26567
26633
  this.groups = null;
@@ -26594,22 +26660,65 @@ class GroupBindingDirective extends DataBindingDirective {
26594
26660
  this.skip = 0;
26595
26661
  }
26596
26662
  }
26597
- /**
26598
- * @hidden
26599
- */
26600
26663
  ngOnInit() {
26601
26664
  super.ngOnInit();
26602
- this.grid.groupExpand.subscribe(this.groupExpand.bind(this));
26603
- this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this));
26665
+ this.gridSubs.add(this.grid.groupExpand.subscribe(this.groupExpand.bind(this)));
26666
+ this.gridSubs.add(this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this)));
26604
26667
  }
26605
26668
  ngAfterContentInit() {
26606
26669
  if (isDevMode() && this.grid.isGroupExpanded) {
26607
26670
  throw new Error(GridConfigurationErrorMessages.groupBindingDirectives);
26608
26671
  }
26609
26672
  }
26673
+ ngOnDestroy() {
26674
+ this.gridSubs.unsubscribe();
26675
+ }
26676
+ /**
26677
+ * @hidden
26678
+ */
26679
+ toggleAll(expand) {
26680
+ this.skip = 0;
26681
+ this.grid.scrollTo({ row: 0, column: 0 });
26682
+ this.groups.forEach((gr, idx) => {
26683
+ const expanded = this.groupsService.isExpanded({
26684
+ group: gr,
26685
+ groupIndex: idx.toString(),
26686
+ parentGroup: undefined
26687
+ });
26688
+ const performToggle = (expand && !expanded) || (!expand && expanded);
26689
+ if (performToggle) {
26690
+ this.grid.groupsService.toggleRow({
26691
+ type: 'group',
26692
+ data: gr,
26693
+ index: idx.toString(),
26694
+ level: 0,
26695
+ parentGroup: undefined
26696
+ });
26697
+ this[expand ? 'groupExpand' : 'groupCollapse']({ groupIndex: idx.toString() });
26698
+ }
26699
+ });
26700
+ }
26701
+ /**
26702
+ * Collapses all expanded root level groups.
26703
+ */
26704
+ collapseAll() {
26705
+ this.toggleAll(false);
26706
+ }
26707
+ /**
26708
+ * Expands all expanded root level groups.
26709
+ */
26710
+ expandAll() {
26711
+ this.toggleAll(true);
26712
+ }
26713
+ /**
26714
+ * @hidden
26715
+ */
26610
26716
  groupExpand({ groupIndex }) {
26611
- this.grid.expandGroupChildren(groupIndex);
26612
26717
  const { group, parents } = findGroup(groupIndex, this.groups);
26718
+ if (!group) {
26719
+ return;
26720
+ }
26721
+ this.groupsService.expandChildren(groupIndex);
26613
26722
  if (!group.items.length) {
26614
26723
  const descriptors = this.state.group.filter(removeParentDescriptors(parents, group));
26615
26724
  const children = findChildren(this.originalData, parents.concat(group));
@@ -26621,11 +26730,17 @@ class GroupBindingDirective extends DataBindingDirective {
26621
26730
  }
26622
26731
  this.grid.data = this.dataResult(this.state.skip, this.state.take);
26623
26732
  }
26733
+ /**
26734
+ * @hidden
26735
+ */
26624
26736
  groupCollapse({ groupIndex }) {
26625
26737
  const { group } = findGroup(groupIndex, this.groups);
26626
26738
  if (group) {
26627
26739
  group.items = [];
26628
26740
  }
26741
+ else {
26742
+ return;
26743
+ }
26629
26744
  this.grid.data = this.dataResult(this.state.skip, this.state.take);
26630
26745
  }
26631
26746
  process(state) {
@@ -26665,12 +26780,15 @@ class GroupBindingDirective extends DataBindingDirective {
26665
26780
  this.filter = filter;
26666
26781
  }
26667
26782
  }
26668
- GroupBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GroupBindingDirective, deps: [{ token: GridComponent }, { token: i0.ChangeDetectorRef }, { token: LocalDataChangesService }], target: i0.ɵɵFactoryTarget.Directive });
26669
- GroupBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GroupBindingDirective, selector: "[kendoGridGroupBinding]", inputs: { kendoGridGroupBinding: "kendoGridGroupBinding", sort: "sort", filter: "filter", group: "group" }, usesInheritance: true, ngImport: i0 });
26783
+ GroupBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GroupBindingDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: LocalDataChangesService }, { token: ContextService }, { token: GroupsService }], target: i0.ɵɵFactoryTarget.Directive });
26784
+ GroupBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GroupBindingDirective, selector: "[kendoGridGroupBinding]", inputs: { kendoGridGroupBinding: "kendoGridGroupBinding", sort: "sort", filter: "filter", group: "group" }, exportAs: ["kendoGridGroupBinding"], usesInheritance: true, ngImport: i0 });
26670
26785
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GroupBindingDirective, decorators: [{
26671
26786
  type: Directive,
26672
- args: [{ selector: '[kendoGridGroupBinding]' }]
26673
- }], ctorParameters: function () { return [{ type: GridComponent }, { type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }]; }, propDecorators: { kendoGridGroupBinding: [{
26787
+ args: [{
26788
+ selector: '[kendoGridGroupBinding]',
26789
+ exportAs: 'kendoGridGroupBinding'
26790
+ }]
26791
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }, { type: ContextService }, { type: GroupsService }]; }, propDecorators: { kendoGridGroupBinding: [{
26674
26792
  type: Input,
26675
26793
  args: ["kendoGridGroupBinding"]
26676
26794
  }], sort: [{