@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.
@@ -1344,7 +1344,12 @@ const getGroupRowArgs = (groupItem) => {
1344
1344
  return { group: groupItem.data, groupIndex: groupItem.index, parentGroup: getGroupRowArgs(groupItem.parentGroup) };
1345
1345
  };
1346
1346
 
1347
- const isChildIndex = (targetIndex, parentIndex) => parentIndex !== targetIndex && targetIndex.startsWith(parentIndex);
1347
+ const isChildIndex = (targetIndex, parentIndex) => {
1348
+ const sameIndex = parentIndex === targetIndex;
1349
+ const lastSeparatorIndex = targetIndex.lastIndexOf('_');
1350
+ const sameSubGroupIndex = targetIndex.substring(0, lastSeparatorIndex) === parentIndex;
1351
+ return !sameIndex && sameSubGroupIndex;
1352
+ };
1348
1353
  /**
1349
1354
  * @hidden
1350
1355
  */
@@ -1377,10 +1382,10 @@ class GroupsService {
1377
1382
  }
1378
1383
  return expanded;
1379
1384
  }
1380
- toggleRow(groupItem) {
1385
+ toggleRow(groupItem, emit = true) {
1381
1386
  const parentGroup = getGroupRowArgs(groupItem.parentGroup);
1382
1387
  const expand = !this.isExpanded({ group: groupItem.data, groupIndex: groupItem.index, parentGroup });
1383
- this.changes.next({ group: groupItem.data, expand, groupIndex: groupItem.index, parentGroup });
1388
+ this.changes.next({ group: groupItem.data, expand, groupIndex: groupItem.index, parentGroup, emit });
1384
1389
  // if usercallback is given, the rowState should be ignored
1385
1390
  if (this.userCallback) {
1386
1391
  return;
@@ -1515,8 +1520,11 @@ class ScrollRequestService {
1515
1520
  constructor() {
1516
1521
  this.requests = new Subject();
1517
1522
  }
1518
- scrollTo(request) {
1519
- this.requests.next(request);
1523
+ scrollTo(request, adjustIndex = true) {
1524
+ this.requests.next({ request, adjustIndex });
1525
+ }
1526
+ scrollToItem(request) {
1527
+ this.requests.next({ request });
1520
1528
  }
1521
1529
  }
1522
1530
  ScrollRequestService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ScrollRequestService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1648,8 +1656,7 @@ class NavigationService {
1648
1656
  this.zone.onStable.pipe(take(1), map(() => args), ...operators);
1649
1657
  const onStable = onStableSubscriber();
1650
1658
  this.subs = new Subscription();
1651
- this.subs.add(this.cursor.changes
1652
- .subscribe(args => this.onCursorChanges(args)));
1659
+ this.subs.add(this.cursor.changes.subscribe(args => this.onCursorChanges(args)));
1653
1660
  this.subs.add(this.domEvents.focus.pipe(switchMap(onStable))
1654
1661
  .subscribe((args) => this.navigateTo(args.target)));
1655
1662
  this.subs.add(this.domEvents.focusOut.pipe(filter(() => this.mode !== 0 /* Standby */), switchMap(onStableSubscriber(takeUntil(this.domEvents.focus))))
@@ -2255,16 +2262,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
2255
2262
  * @hidden
2256
2263
  */
2257
2264
  const ColumnMenuErrorMessages = {
2258
- autoSizeColumn: 'The auto size column does not work with enabled virtual columns',
2259
- autoSizeAllColumns: 'The auto size all columns does not work with enabled virtual columns',
2260
- serviceInput: 'The service input of the predefined column menu components is mandatory.'
2265
+ autoSizeColumn: `The auto size column does not work with enabled virtual columns.
2266
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/column-menu/#toc-autosize-column-item.`,
2267
+ autoSizeAllColumns: `The auto size all columns does not work with enabled virtual columns.
2268
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/column-menu/#toc-autosize-all-columns-item.`,
2269
+ serviceInput: `The service input of the predefined column menu components is mandatory.
2270
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/column-menu/#toc-customizing-the-content.`
2261
2271
  };
2262
2272
  /**
2263
2273
  * @hidden
2264
2274
  */
2265
2275
  const ClipboardErrorMessages = {
2266
- activeCellNavigable: 'Grid must be navigable to use "activeCell" as clipboard target type.',
2267
- selectionSelectable: 'Grid must be selectable to use "selection" as clipboard target type.'
2276
+ activeCellNavigable: `Grid must be navigable to use "activeCell" as clipboard target type.
2277
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/clipboard/#toc-active-cell.`,
2278
+ selectionSelectable: `Grid must be selectable to use "selection" as clipboard target type.
2279
+ See https://www.telerik.com/kendo-angular-ui/components/grid/accessories/clipboard/#toc-current-selection.`
2268
2280
  };
2269
2281
  /**
2270
2282
  * @hidden
@@ -2275,8 +2287,10 @@ const ColumnConfigurationErrorMessages = {
2275
2287
  Please use only valid identifier names to ensure error-free operation.`,
2276
2288
  width: (value, parsedValue) => `Expected numeric value for column width, but got a string "${value}". Treating as ${parsedValue}px.`,
2277
2289
  invalidColumn: (column) => `Invalid column ${column}.`,
2278
- requiredWidth: (columnType) => `${columnType} columns feature requires all columns to have set width.`,
2279
- requiredScroll: (columnType) => `${columnType} columns are only supported when scrolling is enabled.`,
2290
+ requiredWidth: (columnType) => `${columnType} columns feature requires all columns to have set width.
2291
+ See https://www.telerik.com/kendo-angular-ui/components/grid/columns/${columnType.toLowerCase()}.`,
2292
+ requiredScroll: (columnType) => `${columnType} columns are only supported when scrolling is enabled.
2293
+ See https://www.telerik.com/kendo-angular-ui/components/grid/columns/${columnType.toLowerCase()}/`,
2280
2294
  groupColumnContent: 'ColumnGroupComponent should contain ColumnComponent or CommandColumnComponent.',
2281
2295
  lockedParent: 'Locked child columns require their parent columns to be locked.',
2282
2296
  columnNested: 'Columns can be nested only inside ColumnGroupComponent',
@@ -2288,14 +2302,16 @@ const ColumnConfigurationErrorMessages = {
2288
2302
  const GridConfigurationErrorMessages = {
2289
2303
  functionType: (propName, fn) => `${propName} must be a function, but received ${JSON.stringify(fn)}.`,
2290
2304
  incompatibleFeatures: (feat1Name, feat2Name) => `'Having both ${feat1Name} and ${feat2Name} is not supported.'`,
2291
- nonLockedColumnPresent: 'There should be at least one non-locked column',
2292
- rowHeightVirtual: 'Row height and detail row height settings require virtual scrolling mode to be enabled.',
2293
- focusNavigable: 'The Grid should be configured as navigable to control focus',
2305
+ 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',
2306
+ rowHeightVirtual: `The virtual scrolling functionality requires setting the rowHeight (and detailRowHeight when there are detail rows).
2307
+ Row height and detail row height settings should be set only when virtual scrolling mode is enabled.
2308
+ See https://www.telerik.com/kendo-angular-ui/components/grid/scroll-modes/virtual/#toc-getting-started.`,
2309
+ focusNavigable: 'The Grid should be configured as navigable to control focus. See https://www.telerik.com/kendo-angular-ui/components/grid/keyboard-navigation/.',
2294
2310
  expandCollapseMethods: (expandMethodName, collapseMethodName, directiveName, callbackName) => `The ${expandMethodName} and ${collapseMethodName} methods should not be called
2295
2311
  when using the ${directiveName} directive or the ${callbackName} callback.
2296
2312
  These methods are provided only for backwards compatibility with legacy versions.`,
2297
2313
  requiredEditService: `The default edit service of the editing directives works only when binding to plain array.
2298
- Please provide an editService.`,
2314
+ Please provide an editService. See https://www.telerik.com/kendo-angular-ui/components/grid/editing/editing-directives/#toc-custom-editing-service.`,
2299
2315
  requiredModule: (exportedType, moduleName, componentSelector) => `Creating ${exportedType} requires including the ${moduleName} and adding the ${componentSelector} component.`,
2300
2316
  groupBindingDirectives: `Using the "kendoGridGroupBinding" directive in combination with the "kendoGridExpandGroupBy" directive
2301
2317
  or the "isGroupExpanded" callback is not supported. To use grouping with the "kendoGridGroupBinding" directive,
@@ -4518,8 +4534,8 @@ const packageMetadata = {
4518
4534
  name: '@progress/kendo-angular-grid',
4519
4535
  productName: 'Kendo UI for Angular',
4520
4536
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
4521
- publishDate: 1710342300,
4522
- version: '15.2.0',
4537
+ publishDate: 1710360642,
4538
+ version: '15.3.0-develop.3',
4523
4539
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
4524
4540
  };
4525
4541
 
@@ -16697,7 +16713,26 @@ class RowHeightService {
16697
16713
  }, undefined);
16698
16714
  return result === undefined ? this.total - 1 : result;
16699
16715
  }
16700
- offset(rowIndex) {
16716
+ offset(rowIndex, adjustIndex = false) {
16717
+ if (adjustIndex) {
16718
+ let targetOffset = 0;
16719
+ let targetIndex = 0;
16720
+ for (let i = 0; i < rowIndex; i++) {
16721
+ targetOffset += this.rowHeight;
16722
+ targetIndex++;
16723
+ if (targetIndex === rowIndex) {
16724
+ return targetOffset;
16725
+ }
16726
+ if (this.isExpanded(i)) {
16727
+ targetOffset += this.detailRowHeight;
16728
+ targetIndex++;
16729
+ if (targetIndex === rowIndex) {
16730
+ return targetOffset;
16731
+ }
16732
+ }
16733
+ }
16734
+ return targetOffset;
16735
+ }
16701
16736
  return this.offsets[rowIndex];
16702
16737
  }
16703
16738
  totalHeight() {
@@ -18007,7 +18042,6 @@ TableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
18007
18042
  </ng-container>
18008
18043
  </td>
18009
18044
  </tr>
18010
-
18011
18045
  <ng-container *ngFor="let item of data; trackBy: trackByWrapper; let rowIndex = index;">
18012
18046
  <tr *ngIf="isGroup(item) && isParentGroupExpanded($any(item)) && showGroupHeader(item)"
18013
18047
  kendoGridGroupHeader
@@ -18237,7 +18271,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
18237
18271
  </ng-container>
18238
18272
  </td>
18239
18273
  </tr>
18240
-
18241
18274
  <ng-container *ngFor="let item of data; trackBy: trackByWrapper; let rowIndex = index;">
18242
18275
  <tr *ngIf="isGroup(item) && isParentGroupExpanded($any(item)) && showGroupHeader(item)"
18243
18276
  kendoGridGroupHeader
@@ -18695,7 +18728,7 @@ const elementAt = (index, elements, elementOffset) => {
18695
18728
  elementIdx += offset;
18696
18729
  }
18697
18730
  };
18698
- const rowAt = (index, rows) => elementAt(index, rows, row => row.hasAttribute('data-kendo-grid-item-index') ? 1 : 0);
18731
+ const rowAt = (index, rows) => elementAt(index, rows, () => 1);
18699
18732
  const cellAt = (index, cells) => elementAt(index, cells, cell => !hasClasses(cell, NON_DATA_CELL_CLASSES) ? parseInt(cell.getAttribute('colSpan'), 10) || 1 : 0);
18700
18733
  const EMPTY_OBJECT = {};
18701
18734
  /**
@@ -18772,7 +18805,7 @@ class ListComponent {
18772
18805
  this.rtl = false;
18773
18806
  this.scroller = scrollerFactory(this.dispatcher);
18774
18807
  this.subscriptions = detailsService.changes.subscribe(x => this.detailExpand(x));
18775
- this.subscriptions.add(scrollRequestService.requests.subscribe(x => this.scrollTo(x)));
18808
+ this.subscriptions.add(scrollRequestService.requests.subscribe(req => isPresent(req.adjustIndex) ? this.scrollTo(req.request, req.adjustIndex) : this.scrollToItem(req.request)));
18776
18809
  }
18777
18810
  get showFooter() {
18778
18811
  return this.groupable && this.groupable.showFooter;
@@ -19015,21 +19048,21 @@ class ListComponent {
19015
19048
  }
19016
19049
  });
19017
19050
  }
19018
- scrollToVirtualRow(itemIndex) {
19051
+ scrollToVirtualRow(itemIndex, adjustIndexForDetailTemplate = true) {
19019
19052
  if (!isDocumentAvailable()) {
19020
19053
  return;
19021
19054
  }
19022
- if (isPresent(this.detailTemplate)) {
19055
+ if (isPresent(this.detailTemplate) && adjustIndexForDetailTemplate) {
19023
19056
  itemIndex = Math.floor(itemIndex / 2);
19024
19057
  }
19025
- const offset = this.rowHeightService.offset(itemIndex);
19058
+ const offset = this.rowHeightService.offset(itemIndex, !adjustIndexForDetailTemplate);
19026
19059
  this.container.nativeElement.scrollTop = offset;
19027
19060
  this.resetNavigationViewport();
19028
19061
  }
19029
- scrollTo({ row, column }) {
19062
+ scrollTo({ row, column }, adjustIndex = false) {
19030
19063
  if (isNumber(row)) {
19031
19064
  if (this.isVirtual) {
19032
- this.scrollToVirtualRow(row);
19065
+ this.scrollToVirtualRow(row, adjustIndex);
19033
19066
  }
19034
19067
  else {
19035
19068
  const element = rowAt(row, this.table.nativeElement.rows);
@@ -19063,6 +19096,23 @@ class ListComponent {
19063
19096
  }
19064
19097
  }
19065
19098
  }
19099
+ scrollToItem(item) {
19100
+ if (!isDocumentAvailable()) {
19101
+ return;
19102
+ }
19103
+ const data = this.ctx.grid.data;
19104
+ const gridData = Array.isArray(data) ? data : data.data;
19105
+ const gridDataItems = gridData.flatMap(recursiveFlatMap);
19106
+ const dataItemIndex = gridDataItems.findIndex(dataItem => dataItem[item.idField] === item.id);
19107
+ if (dataItemIndex !== -1) {
19108
+ const row = Array.from(this.table.nativeElement.rows).find((r) => {
19109
+ const dataAttribute = r.getAttribute('data-kendo-grid-item-index');
19110
+ return dataAttribute && +dataAttribute === this.ctx.grid.skip + dataItemIndex;
19111
+ });
19112
+ row && row.scrollIntoView();
19113
+ this.isVirtual && this.resetNavigationViewport();
19114
+ }
19115
+ }
19066
19116
  resetNavigationViewport() {
19067
19117
  if (!isDocumentAvailable) {
19068
19118
  return;
@@ -19996,7 +20046,7 @@ const validateColumnsField = (columns) => expandColumns(columns.toArray())
19996
20046
  .filter(isColumnComponent)
19997
20047
  .filter(({ field }) => !isValidFieldName(field))
19998
20048
  .forEach(({ field }) => console.warn(ColumnConfigurationErrorMessages.fieldName(field)));
19999
- const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group }) => isPresent(group)))
20049
+ const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group, emit }) => emit && isPresent(group)))
20000
20050
  .subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
20001
20051
  const handleExpandCollapseDetailsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ dataItem }) => isPresent(dataItem)))
20002
20052
  .subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
@@ -20830,8 +20880,6 @@ class GridComponent {
20830
20880
  * This method is provided only for backwards-compatibility with legacy versions.
20831
20881
  * These versions tracked the expanded group state internally using the hierarchical group index.
20832
20882
  *
20833
- * The `expandGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
20834
- *
20835
20883
  * When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
20836
20884
  *
20837
20885
  * @param {string} index - The underscore separated hierarchical index of the group.
@@ -20846,8 +20894,6 @@ class GridComponent {
20846
20894
  * This method is provided only for backwards-compatibility with legacy versions.
20847
20895
  * These versions tracked the expanded group state internally using the hierarchical group index.
20848
20896
  *
20849
- * The `collapseGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
20850
- *
20851
20897
  * When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
20852
20898
  *
20853
20899
  * @param {string} index - The underscore separated hierarchical index of the group.
@@ -20861,12 +20907,6 @@ class GridComponent {
20861
20907
  resetGroupsState() {
20862
20908
  this.groupsService.reset();
20863
20909
  }
20864
- /**
20865
- * @hidden
20866
- */
20867
- expandGroupChildren(groupIndex) {
20868
- this.groupsService.expandChildren(groupIndex);
20869
- }
20870
20910
  /**
20871
20911
  * @hidden
20872
20912
  */
@@ -20935,7 +20975,6 @@ class GridComponent {
20935
20975
  this.attachElementEventHandlers();
20936
20976
  this.updateNavigationMetadata();
20937
20977
  this.applyAutoSize();
20938
- // this.sizingService.changes.next(this.size);
20939
20978
  }
20940
20979
  ngAfterContentChecked() {
20941
20980
  this.columnsContainer.refresh();
@@ -21291,7 +21330,13 @@ class GridComponent {
21291
21330
  * Scrolls to the specified row and column ([see example]({% slug scrollmmodes_grid %}#toc-scrolling-to-a-specific-row-and-column-index)).
21292
21331
  */
21293
21332
  scrollTo(request) {
21294
- this.scrollRequestService.scrollTo(request);
21333
+ this.scrollRequestService.scrollTo(request, false);
21334
+ }
21335
+ /**
21336
+ * Scrolls to the specified data item and column ([see example]({% slug scrollmmodes_grid %}#toc-scrolling-to-a-specific-row-and-column-index)).
21337
+ */
21338
+ scrollToItem(request) {
21339
+ this.scrollRequestService.scrollToItem(request);
21295
21340
  }
21296
21341
  /**
21297
21342
  * Changes the position of the specified column.
@@ -21520,16 +21565,19 @@ class GridComponent {
21520
21565
  throw new Error(GridConfigurationErrorMessages.incompatibleFeatures('detail template', 'sticky columns'));
21521
21566
  }
21522
21567
  if (this.lockedLeafColumns.length && !this.nonLockedLeafColumns.length) {
21523
- throw new Error(GridConfigurationErrorMessages.nonLockedColumnPresent);
21568
+ console.warn(GridConfigurationErrorMessages.nonLockedColumnPresent);
21524
21569
  }
21525
21570
  if ((locked || this.virtualColumns) && expandColumns(this.columnList.toArray()).filter(column => !column.width && !isColumnGroupComponent(column)).length) {
21526
- throw new Error(ColumnConfigurationErrorMessages.requiredWidth(locked ? 'Locked' : 'Virtual'));
21571
+ console.warn(ColumnConfigurationErrorMessages.requiredWidth(locked ? 'Locked' : 'Virtual'));
21527
21572
  }
21528
21573
  if (locked && !this.isScrollable) {
21529
- throw new Error(ColumnConfigurationErrorMessages.requiredScroll('Locked'));
21574
+ console.warn(ColumnConfigurationErrorMessages.requiredScroll('Locked'));
21530
21575
  }
21531
21576
  if (stickyColumns && !this.isScrollable) {
21532
- throw new Error(ColumnConfigurationErrorMessages.requiredScroll('Sticky'));
21577
+ console.warn(ColumnConfigurationErrorMessages.requiredScroll('Sticky'));
21578
+ }
21579
+ if (this.virtualColumns && !this.isScrollable) {
21580
+ console.warn(ColumnConfigurationErrorMessages.requiredScroll('Virtual'));
21533
21581
  }
21534
21582
  if (this.columnList.filter(isColumnGroupComponent).filter((x) => !x.hasChildren).length) {
21535
21583
  throw new Error(ColumnConfigurationErrorMessages.groupColumnContent);
@@ -21538,10 +21586,16 @@ class GridComponent {
21538
21586
  throw new Error(ColumnConfigurationErrorMessages.lockedParent);
21539
21587
  }
21540
21588
  if ((this.rowHeight || this.detailRowHeight) && !this.isVirtual) {
21541
- throw new Error(GridConfigurationErrorMessages.rowHeightVirtual);
21589
+ console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
21590
+ }
21591
+ if (!this.rowHeight && this.isVirtual) {
21592
+ console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
21593
+ }
21594
+ if (!this.detailRowHeight && this.isVirtual && this.detailTemplate) {
21595
+ console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
21542
21596
  }
21543
21597
  if (stickyColumns && expandColumns(this.columnList.toArray()).filter(column => !column.width && !isColumnGroupComponent(column)).length) {
21544
- throw new Error(ColumnConfigurationErrorMessages.requiredWidth('Sticky'));
21598
+ console.warn(ColumnConfigurationErrorMessages.requiredWidth('Sticky'));
21545
21599
  }
21546
21600
  if (stickyColumns && this.virtualColumns) {
21547
21601
  throw new Error(GridConfigurationErrorMessages.incompatibleFeatures('sticky columns', 'column virtualization'));
@@ -21839,7 +21893,10 @@ class GridComponent {
21839
21893
  return;
21840
21894
  }
21841
21895
  if (this.groupsService.isExpanded({ groupIndex: index }) !== expand) {
21842
- this.groupsService.toggleRow({ index });
21896
+ this.groupsService.toggleRow({ index }, false);
21897
+ if (this.ctx.groupBindingDirective) {
21898
+ this.ctx.groupBindingDirective[`group${expand ? 'Expand' : 'Collapse'}`]({ groupIndex: index });
21899
+ }
21843
21900
  }
21844
21901
  }
21845
21902
  shouldResetSelection(selectableChanges) {
@@ -26361,6 +26418,10 @@ const count = (groups, includeFooters = false) => (groups.reduce((acc, group) =>
26361
26418
  }
26362
26419
  return acc;
26363
26420
  }, 0));
26421
+ /**
26422
+ * @hidden
26423
+ */
26424
+ const noDescriptors = (descriptors) => !isPresent(descriptors) || !descriptors.length;
26364
26425
  /**
26365
26426
  * @hidden
26366
26427
  */
@@ -26436,8 +26497,11 @@ const skippedHeaders = (groupItem) => {
26436
26497
  * A directive which encapsulates the in-memory handling of grouping with virtual scrolling.
26437
26498
  */
26438
26499
  class GroupBindingDirective extends DataBindingDirective {
26439
- constructor(grid, changeDetector, localDataChangesService) {
26440
- super(grid, changeDetector, localDataChangesService);
26500
+ constructor(changeDetector, localDataChangesService, ctxService, groupsService) {
26501
+ super(ctxService.grid, changeDetector, localDataChangesService);
26502
+ this.groupsService = groupsService;
26503
+ this.gridSubs = new Subscription();
26504
+ ctxService.groupBindingDirective = this;
26441
26505
  }
26442
26506
  /**
26443
26507
  * The array of data which will be used to populate the Grid.
@@ -26458,7 +26522,9 @@ class GroupBindingDirective extends DataBindingDirective {
26458
26522
  * Defines the descriptors by which the data will be sorted.
26459
26523
  */
26460
26524
  set sort(value) {
26461
- const clear = this.state.sort !== value;
26525
+ const noCurrentDescriptors = noDescriptors(this.state.sort);
26526
+ const noIncomingDescriptors = noDescriptors(value);
26527
+ const clear = this.state.sort !== value && !(noCurrentDescriptors && noIncomingDescriptors);
26462
26528
  this.grid.sort = this.state.sort = value;
26463
26529
  if (clear) {
26464
26530
  this.groups = null;
@@ -26491,22 +26557,65 @@ class GroupBindingDirective extends DataBindingDirective {
26491
26557
  this.skip = 0;
26492
26558
  }
26493
26559
  }
26494
- /**
26495
- * @hidden
26496
- */
26497
26560
  ngOnInit() {
26498
26561
  super.ngOnInit();
26499
- this.grid.groupExpand.subscribe(this.groupExpand.bind(this));
26500
- this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this));
26562
+ this.gridSubs.add(this.grid.groupExpand.subscribe(this.groupExpand.bind(this)));
26563
+ this.gridSubs.add(this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this)));
26501
26564
  }
26502
26565
  ngAfterContentInit() {
26503
26566
  if (isDevMode() && this.grid.isGroupExpanded) {
26504
26567
  throw new Error(GridConfigurationErrorMessages.groupBindingDirectives);
26505
26568
  }
26506
26569
  }
26570
+ ngOnDestroy() {
26571
+ this.gridSubs.unsubscribe();
26572
+ }
26573
+ /**
26574
+ * @hidden
26575
+ */
26576
+ toggleAll(expand) {
26577
+ this.skip = 0;
26578
+ this.grid.scrollTo({ row: 0, column: 0 });
26579
+ this.groups.forEach((gr, idx) => {
26580
+ const expanded = this.groupsService.isExpanded({
26581
+ group: gr,
26582
+ groupIndex: idx.toString(),
26583
+ parentGroup: undefined
26584
+ });
26585
+ const performToggle = (expand && !expanded) || (!expand && expanded);
26586
+ if (performToggle) {
26587
+ this.grid.groupsService.toggleRow({
26588
+ type: 'group',
26589
+ data: gr,
26590
+ index: idx.toString(),
26591
+ level: 0,
26592
+ parentGroup: undefined
26593
+ });
26594
+ this[expand ? 'groupExpand' : 'groupCollapse']({ groupIndex: idx.toString() });
26595
+ }
26596
+ });
26597
+ }
26598
+ /**
26599
+ * Collapses all expanded root level groups.
26600
+ */
26601
+ collapseAll() {
26602
+ this.toggleAll(false);
26603
+ }
26604
+ /**
26605
+ * Expands all expanded root level groups.
26606
+ */
26607
+ expandAll() {
26608
+ this.toggleAll(true);
26609
+ }
26610
+ /**
26611
+ * @hidden
26612
+ */
26507
26613
  groupExpand({ groupIndex }) {
26508
- this.grid.expandGroupChildren(groupIndex);
26509
26614
  const { group, parents } = findGroup(groupIndex, this.groups);
26615
+ if (!group) {
26616
+ return;
26617
+ }
26618
+ this.groupsService.expandChildren(groupIndex);
26510
26619
  if (!group.items.length) {
26511
26620
  const descriptors = this.state.group.filter(removeParentDescriptors(parents, group));
26512
26621
  const children = findChildren(this.originalData, parents.concat(group));
@@ -26518,11 +26627,17 @@ class GroupBindingDirective extends DataBindingDirective {
26518
26627
  }
26519
26628
  this.grid.data = this.dataResult(this.state.skip, this.state.take);
26520
26629
  }
26630
+ /**
26631
+ * @hidden
26632
+ */
26521
26633
  groupCollapse({ groupIndex }) {
26522
26634
  const { group } = findGroup(groupIndex, this.groups);
26523
26635
  if (group) {
26524
26636
  group.items = [];
26525
26637
  }
26638
+ else {
26639
+ return;
26640
+ }
26526
26641
  this.grid.data = this.dataResult(this.state.skip, this.state.take);
26527
26642
  }
26528
26643
  process(state) {
@@ -26562,12 +26677,15 @@ class GroupBindingDirective extends DataBindingDirective {
26562
26677
  this.filter = filter;
26563
26678
  }
26564
26679
  }
26565
- 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 });
26566
- 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 });
26680
+ 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 });
26681
+ 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 });
26567
26682
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GroupBindingDirective, decorators: [{
26568
26683
  type: Directive,
26569
- args: [{ selector: '[kendoGridGroupBinding]' }]
26570
- }], ctorParameters: function () { return [{ type: GridComponent }, { type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }]; }, propDecorators: { kendoGridGroupBinding: [{
26684
+ args: [{
26685
+ selector: '[kendoGridGroupBinding]',
26686
+ exportAs: 'kendoGridGroupBinding'
26687
+ }]
26688
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }, { type: ContextService }, { type: GroupsService }]; }, propDecorators: { kendoGridGroupBinding: [{
26571
26689
  type: Input,
26572
26690
  args: ["kendoGridGroupBinding"]
26573
26691
  }], sort: [{
@@ -57,7 +57,7 @@ import { NavigationService } from './navigation/navigation.service';
57
57
  import { NavigationCell } from './navigation/navigation-cell.interface';
58
58
  import { NavigationRow } from './navigation/navigation-row.interface';
59
59
  import { ColumnInfoService } from "./common/column-info.service";
60
- import { ScrollRequestService, ScrollRequest } from './scrolling/scroll-request.service';
60
+ import { ScrollRequestService, ScrollRequest, ScrollToItemRequest } from './scrolling/scroll-request.service';
61
61
  import { SortService } from './common/sort.service';
62
62
  import { ColumnMenuTemplateDirective } from './column-menu/column-menu-template.directive';
63
63
  import { ColumnMenuSettings } from './column-menu/column-menu-settings.interface';
@@ -95,7 +95,7 @@ export declare class GridComponent implements AfterContentInit, AfterViewInit, O
95
95
  private cellSelectionService;
96
96
  wrapper: ElementRef;
97
97
  private groupInfoService;
98
- private groupsService;
98
+ groupsService: GroupsService;
99
99
  private changeNotification;
100
100
  private detailsService;
101
101
  private editService;
@@ -659,8 +659,6 @@ export declare class GridComponent implements AfterContentInit, AfterViewInit, O
659
659
  * This method is provided only for backwards-compatibility with legacy versions.
660
660
  * These versions tracked the expanded group state internally using the hierarchical group index.
661
661
  *
662
- * The `expandGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
663
- *
664
662
  * When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
665
663
  *
666
664
  * @param {string} index - The underscore separated hierarchical index of the group.
@@ -673,8 +671,6 @@ export declare class GridComponent implements AfterContentInit, AfterViewInit, O
673
671
  * This method is provided only for backwards-compatibility with legacy versions.
674
672
  * These versions tracked the expanded group state internally using the hierarchical group index.
675
673
  *
676
- * The `collapseGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
677
- *
678
674
  * When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
679
675
  *
680
676
  * @param {string} index - The underscore separated hierarchical index of the group.
@@ -684,10 +680,6 @@ export declare class GridComponent implements AfterContentInit, AfterViewInit, O
684
680
  * @hidden
685
681
  */
686
682
  resetGroupsState(): void;
687
- /**
688
- * @hidden
689
- */
690
- expandGroupChildren(groupIndex: string): void;
691
683
  /**
692
684
  * @hidden
693
685
  */
@@ -853,6 +845,10 @@ export declare class GridComponent implements AfterContentInit, AfterViewInit, O
853
845
  * Scrolls to the specified row and column ([see example]({% slug scrollmmodes_grid %}#toc-scrolling-to-a-specific-row-and-column-index)).
854
846
  */
855
847
  scrollTo(request: ScrollRequest): void;
848
+ /**
849
+ * Scrolls to the specified data item and column ([see example]({% slug scrollmmodes_grid %}#toc-scrolling-to-a-specific-row-and-column-index)).
850
+ */
851
+ scrollToItem(request: ScrollToItemRequest): void;
856
852
  /**
857
853
  * Changes the position of the specified column.
858
854
  * The reordering of columns operates only on the level
@@ -8,12 +8,12 @@ import { GroupResult } from "@progress/kendo-data-query";
8
8
  */
9
9
  export interface GroupRowArgs {
10
10
  /**
11
- * The hierarchical row group index.
12
- * For example, "4_0" would be the 1st sub-group in the 5th group.
11
+ * The GroupResult object associated with the group row.
13
12
  */
14
13
  group?: GroupResult;
15
14
  /**
16
- * The parent of the current group row, if any.
15
+ * The hierarchical row group index.
16
+ * For example, "4_0" would be the 1st sub-group in the 5th group.
17
17
  */
18
18
  groupIndex: string;
19
19
  /**
@@ -4,16 +4,21 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { ChangeDetectorRef, AfterContentInit } from '@angular/core';
6
6
  import { DataBindingDirective } from "../databinding.directive";
7
- import { GridComponent } from "../grid.component";
8
7
  import { CompositeFilterDescriptor, GroupDescriptor, SortDescriptor, State } from "@progress/kendo-data-query";
9
8
  import { GridDataResult } from "../data/data.collection";
10
9
  import { VirtualGroupResult } from "./virtual-group-result.interface";
11
10
  import { LocalDataChangesService } from "../editing/local-data-changes.service";
11
+ import { ContextService } from '../common/provider.service';
12
+ import { GroupsService } from './groups.service';
12
13
  import * as i0 from "@angular/core";
13
14
  /**
14
15
  * @hidden
15
16
  */
16
17
  export declare const count: (groups: any[], includeFooters?: boolean) => any;
18
+ /**
19
+ * @hidden
20
+ */
21
+ export declare const noDescriptors: (descriptors?: any[]) => boolean;
17
22
  /**
18
23
  * @hidden
19
24
  */
@@ -22,6 +27,7 @@ export declare const slice: (groups: any[], skip: number, take: number, includeF
22
27
  * A directive which encapsulates the in-memory handling of grouping with virtual scrolling.
23
28
  */
24
29
  export declare class GroupBindingDirective extends DataBindingDirective implements AfterContentInit {
30
+ private groupsService;
25
31
  /**
26
32
  * The array of data which will be used to populate the Grid.
27
33
  */
@@ -43,18 +49,35 @@ export declare class GroupBindingDirective extends DataBindingDirective implemen
43
49
  */
44
50
  set group(value: GroupDescriptor[]);
45
51
  private groups;
46
- constructor(grid: GridComponent, changeDetector: ChangeDetectorRef, localDataChangesService: LocalDataChangesService);
52
+ private gridSubs;
53
+ constructor(changeDetector: ChangeDetectorRef, localDataChangesService: LocalDataChangesService, ctxService: ContextService, groupsService: GroupsService);
54
+ ngOnInit(): void;
55
+ ngAfterContentInit(): void;
56
+ ngOnDestroy(): void;
47
57
  /**
48
58
  * @hidden
49
59
  */
50
- ngOnInit(): void;
51
- ngAfterContentInit(): void;
52
- protected groupExpand({ groupIndex }: any): void;
53
- protected groupCollapse({ groupIndex }: any): void;
60
+ toggleAll(expand: boolean): void;
61
+ /**
62
+ * Collapses all expanded root level groups.
63
+ */
64
+ collapseAll(): void;
65
+ /**
66
+ * Expands all expanded root level groups.
67
+ */
68
+ expandAll(): void;
69
+ /**
70
+ * @hidden
71
+ */
72
+ groupExpand({ groupIndex }: any): void;
73
+ /**
74
+ * @hidden
75
+ */
76
+ groupCollapse({ groupIndex }: any): void;
54
77
  protected process(state: State): GridDataResult;
55
78
  protected processGroups(state: State): GridDataResult;
56
79
  protected dataResult(skip: number, take: number): GridDataResult;
57
80
  protected applyState({ skip, take, sort, group, filter }: State): void;
58
81
  static ɵfac: i0.ɵɵFactoryDeclaration<GroupBindingDirective, never>;
59
- static ɵdir: i0.ɵɵDirectiveDeclaration<GroupBindingDirective, "[kendoGridGroupBinding]", never, { "kendoGridGroupBinding": "kendoGridGroupBinding"; "sort": "sort"; "filter": "filter"; "group": "group"; }, {}, never>;
82
+ static ɵdir: i0.ɵɵDirectiveDeclaration<GroupBindingDirective, "[kendoGridGroupBinding]", ["kendoGridGroupBinding"], { "kendoGridGroupBinding": "kendoGridGroupBinding"; "sort": "sort"; "filter": "filter"; "group": "group"; }, {}, never>;
60
83
  }