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

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,
@@ -2537,7 +2546,12 @@ const getGroupRowArgs = (groupItem) => {
2537
2546
  return { group: groupItem.data, groupIndex: groupItem.index, parentGroup: getGroupRowArgs(groupItem.parentGroup) };
2538
2547
  };
2539
2548
 
2540
- const isChildIndex = (targetIndex, parentIndex) => parentIndex !== targetIndex && targetIndex.startsWith(parentIndex);
2549
+ const isChildIndex = (targetIndex, parentIndex) => {
2550
+ const sameIndex = parentIndex === targetIndex;
2551
+ const lastSeparatorIndex = targetIndex.lastIndexOf('_');
2552
+ const sameSubGroupIndex = targetIndex.substring(0, lastSeparatorIndex) === parentIndex;
2553
+ return !sameIndex && sameSubGroupIndex;
2554
+ };
2541
2555
  /**
2542
2556
  * @hidden
2543
2557
  */
@@ -2570,10 +2584,10 @@ class GroupsService {
2570
2584
  }
2571
2585
  return expanded;
2572
2586
  }
2573
- toggleRow(groupItem) {
2587
+ toggleRow(groupItem, emit = true) {
2574
2588
  const parentGroup = getGroupRowArgs(groupItem.parentGroup);
2575
2589
  const expand = !this.isExpanded({ group: groupItem.data, groupIndex: groupItem.index, parentGroup });
2576
- this.changes.next({ group: groupItem.data, expand, groupIndex: groupItem.index, parentGroup });
2590
+ this.changes.next({ group: groupItem.data, expand, groupIndex: groupItem.index, parentGroup, emit });
2577
2591
  // if usercallback is given, the rowState should be ignored
2578
2592
  if (this.userCallback) {
2579
2593
  return;
@@ -4550,8 +4564,8 @@ const packageMetadata = {
4550
4564
  name: '@progress/kendo-angular-grid',
4551
4565
  productName: 'Kendo UI for Angular',
4552
4566
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
4553
- publishDate: 1710342300,
4554
- version: '15.2.0',
4567
+ publishDate: 1710359369,
4568
+ version: '15.3.0-develop.2',
4555
4569
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
4556
4570
  };
4557
4571
 
@@ -18091,7 +18105,6 @@ TableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
18091
18105
  </ng-container>
18092
18106
  </td>
18093
18107
  </tr>
18094
-
18095
18108
  <ng-container *ngFor="let item of data; trackBy: trackByWrapper; let rowIndex = index;">
18096
18109
  <tr *ngIf="isGroup(item) && isParentGroupExpanded($any(item)) && showGroupHeader(item)"
18097
18110
  kendoGridGroupHeader
@@ -18321,7 +18334,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
18321
18334
  </ng-container>
18322
18335
  </td>
18323
18336
  </tr>
18324
-
18325
18337
  <ng-container *ngFor="let item of data; trackBy: trackByWrapper; let rowIndex = index;">
18326
18338
  <tr *ngIf="isGroup(item) && isParentGroupExpanded($any(item)) && showGroupHeader(item)"
18327
18339
  kendoGridGroupHeader
@@ -20082,7 +20094,7 @@ const validateColumnsField = (columns) => expandColumns(columns.toArray())
20082
20094
  .filter(isColumnComponent)
20083
20095
  .filter(({ field }) => !isValidFieldName(field))
20084
20096
  .forEach(({ field }) => console.warn(ColumnConfigurationErrorMessages.fieldName(field)));
20085
- const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group }) => isPresent(group)))
20097
+ const handleExpandCollapseGroupsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ group, emit }) => emit && isPresent(group)))
20086
20098
  .subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
20087
20099
  const handleExpandCollapseDetailsService = (service, expandEmitter, collapseEmitter, map) => (service.changes.pipe(filter(({ dataItem }) => isPresent(dataItem)))
20088
20100
  .subscribe((x) => x.expand ? expandEmitter.emit(map(x)) : collapseEmitter.emit(map(x))));
@@ -20917,8 +20929,6 @@ class GridComponent {
20917
20929
  * This method is provided only for backwards-compatibility with legacy versions.
20918
20930
  * These versions tracked the expanded group state internally using the hierarchical group index.
20919
20931
  *
20920
- * The `expandGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
20921
- *
20922
20932
  * When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
20923
20933
  *
20924
20934
  * @param {string} index - The underscore separated hierarchical index of the group.
@@ -20933,8 +20943,6 @@ class GridComponent {
20933
20943
  * This method is provided only for backwards-compatibility with legacy versions.
20934
20944
  * These versions tracked the expanded group state internally using the hierarchical group index.
20935
20945
  *
20936
- * The `collapseGroup` method is not supported when you use the [kendoGridGroupBinding]({% slug api_grid_groupbindingdirective %}) directive.
20937
- *
20938
20946
  * When a Grid is pageable, the indexes of the groups are offset by the current Grid [skip]({% slug api_grid_gridcomponent %}#toc-skip).
20939
20947
  *
20940
20948
  * @param {string} index - The underscore separated hierarchical index of the group.
@@ -20948,12 +20956,6 @@ class GridComponent {
20948
20956
  resetGroupsState() {
20949
20957
  this.groupsService.reset();
20950
20958
  }
20951
- /**
20952
- * @hidden
20953
- */
20954
- expandGroupChildren(groupIndex) {
20955
- this.groupsService.expandChildren(groupIndex);
20956
- }
20957
20959
  /**
20958
20960
  * @hidden
20959
20961
  */
@@ -21022,7 +21024,6 @@ class GridComponent {
21022
21024
  this.attachElementEventHandlers();
21023
21025
  this.updateNavigationMetadata();
21024
21026
  this.applyAutoSize();
21025
- // this.sizingService.changes.next(this.size);
21026
21027
  }
21027
21028
  ngAfterContentChecked() {
21028
21029
  this.columnsContainer.refresh();
@@ -21608,16 +21609,19 @@ class GridComponent {
21608
21609
  throw new Error(GridConfigurationErrorMessages.incompatibleFeatures('detail template', 'sticky columns'));
21609
21610
  }
21610
21611
  if (this.lockedLeafColumns.length && !this.nonLockedLeafColumns.length) {
21611
- throw new Error(GridConfigurationErrorMessages.nonLockedColumnPresent);
21612
+ console.warn(GridConfigurationErrorMessages.nonLockedColumnPresent);
21612
21613
  }
21613
21614
  if ((locked || this.virtualColumns) && expandColumns(this.columnList.toArray()).filter(column => !column.width && !isColumnGroupComponent(column)).length) {
21614
- throw new Error(ColumnConfigurationErrorMessages.requiredWidth(locked ? 'Locked' : 'Virtual'));
21615
+ console.warn(ColumnConfigurationErrorMessages.requiredWidth(locked ? 'Locked' : 'Virtual'));
21615
21616
  }
21616
21617
  if (locked && !this.isScrollable) {
21617
- throw new Error(ColumnConfigurationErrorMessages.requiredScroll('Locked'));
21618
+ console.warn(ColumnConfigurationErrorMessages.requiredScroll('Locked'));
21618
21619
  }
21619
21620
  if (stickyColumns && !this.isScrollable) {
21620
- throw new Error(ColumnConfigurationErrorMessages.requiredScroll('Sticky'));
21621
+ console.warn(ColumnConfigurationErrorMessages.requiredScroll('Sticky'));
21622
+ }
21623
+ if (this.virtualColumns && !this.isScrollable) {
21624
+ console.warn(ColumnConfigurationErrorMessages.requiredScroll('Virtual'));
21621
21625
  }
21622
21626
  if (this.columnList.filter(isColumnGroupComponent).filter((x) => !x.hasChildren).length) {
21623
21627
  throw new Error(ColumnConfigurationErrorMessages.groupColumnContent);
@@ -21626,10 +21630,16 @@ class GridComponent {
21626
21630
  throw new Error(ColumnConfigurationErrorMessages.lockedParent);
21627
21631
  }
21628
21632
  if ((this.rowHeight || this.detailRowHeight) && !this.isVirtual) {
21629
- throw new Error(GridConfigurationErrorMessages.rowHeightVirtual);
21633
+ console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
21634
+ }
21635
+ if (!this.rowHeight && this.isVirtual) {
21636
+ console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
21637
+ }
21638
+ if (!this.detailRowHeight && this.isVirtual && this.detailTemplate) {
21639
+ console.warn(GridConfigurationErrorMessages.rowHeightVirtual);
21630
21640
  }
21631
21641
  if (stickyColumns && expandColumns(this.columnList.toArray()).filter(column => !column.width && !isColumnGroupComponent(column)).length) {
21632
- throw new Error(ColumnConfigurationErrorMessages.requiredWidth('Sticky'));
21642
+ console.warn(ColumnConfigurationErrorMessages.requiredWidth('Sticky'));
21633
21643
  }
21634
21644
  if (stickyColumns && this.virtualColumns) {
21635
21645
  throw new Error(GridConfigurationErrorMessages.incompatibleFeatures('sticky columns', 'column virtualization'));
@@ -21927,7 +21937,10 @@ class GridComponent {
21927
21937
  return;
21928
21938
  }
21929
21939
  if (this.groupsService.isExpanded({ groupIndex: index }) !== expand) {
21930
- this.groupsService.toggleRow({ index });
21940
+ this.groupsService.toggleRow({ index }, false);
21941
+ if (this.ctx.groupBindingDirective) {
21942
+ this.ctx.groupBindingDirective[`group${expand ? 'Expand' : 'Collapse'}`]({ groupIndex: index });
21943
+ }
21931
21944
  }
21932
21945
  }
21933
21946
  shouldResetSelection(selectableChanges) {
@@ -26464,6 +26477,10 @@ const count = (groups, includeFooters = false) => (groups.reduce((acc, group) =>
26464
26477
  }
26465
26478
  return acc;
26466
26479
  }, 0));
26480
+ /**
26481
+ * @hidden
26482
+ */
26483
+ const noDescriptors = (descriptors) => !isPresent(descriptors) || !descriptors.length;
26467
26484
  /**
26468
26485
  * @hidden
26469
26486
  */
@@ -26539,8 +26556,11 @@ const skippedHeaders = (groupItem) => {
26539
26556
  * A directive which encapsulates the in-memory handling of grouping with virtual scrolling.
26540
26557
  */
26541
26558
  class GroupBindingDirective extends DataBindingDirective {
26542
- constructor(grid, changeDetector, localDataChangesService) {
26543
- super(grid, changeDetector, localDataChangesService);
26559
+ constructor(changeDetector, localDataChangesService, ctxService, groupsService) {
26560
+ super(ctxService.grid, changeDetector, localDataChangesService);
26561
+ this.groupsService = groupsService;
26562
+ this.gridSubs = new Subscription();
26563
+ ctxService.groupBindingDirective = this;
26544
26564
  }
26545
26565
  /**
26546
26566
  * The array of data which will be used to populate the Grid.
@@ -26561,7 +26581,9 @@ class GroupBindingDirective extends DataBindingDirective {
26561
26581
  * Defines the descriptors by which the data will be sorted.
26562
26582
  */
26563
26583
  set sort(value) {
26564
- const clear = this.state.sort !== value;
26584
+ const noCurrentDescriptors = noDescriptors(this.state.sort);
26585
+ const noIncomingDescriptors = noDescriptors(value);
26586
+ const clear = this.state.sort !== value && !(noCurrentDescriptors && noIncomingDescriptors);
26565
26587
  this.grid.sort = this.state.sort = value;
26566
26588
  if (clear) {
26567
26589
  this.groups = null;
@@ -26594,22 +26616,65 @@ class GroupBindingDirective extends DataBindingDirective {
26594
26616
  this.skip = 0;
26595
26617
  }
26596
26618
  }
26597
- /**
26598
- * @hidden
26599
- */
26600
26619
  ngOnInit() {
26601
26620
  super.ngOnInit();
26602
- this.grid.groupExpand.subscribe(this.groupExpand.bind(this));
26603
- this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this));
26621
+ this.gridSubs.add(this.grid.groupExpand.subscribe(this.groupExpand.bind(this)));
26622
+ this.gridSubs.add(this.grid.groupCollapse.subscribe(this.groupCollapse.bind(this)));
26604
26623
  }
26605
26624
  ngAfterContentInit() {
26606
26625
  if (isDevMode() && this.grid.isGroupExpanded) {
26607
26626
  throw new Error(GridConfigurationErrorMessages.groupBindingDirectives);
26608
26627
  }
26609
26628
  }
26629
+ ngOnDestroy() {
26630
+ this.gridSubs.unsubscribe();
26631
+ }
26632
+ /**
26633
+ * @hidden
26634
+ */
26635
+ toggleAll(expand) {
26636
+ this.skip = 0;
26637
+ this.grid.scrollTo({ row: 0, column: 0 });
26638
+ this.groups.forEach((gr, idx) => {
26639
+ const expanded = this.groupsService.isExpanded({
26640
+ group: gr,
26641
+ groupIndex: idx.toString(),
26642
+ parentGroup: undefined
26643
+ });
26644
+ const performToggle = (expand && !expanded) || (!expand && expanded);
26645
+ if (performToggle) {
26646
+ this.grid.groupsService.toggleRow({
26647
+ type: 'group',
26648
+ data: gr,
26649
+ index: idx.toString(),
26650
+ level: 0,
26651
+ parentGroup: undefined
26652
+ });
26653
+ this[expand ? 'groupExpand' : 'groupCollapse']({ groupIndex: idx.toString() });
26654
+ }
26655
+ });
26656
+ }
26657
+ /**
26658
+ * Collapses all expanded root level groups.
26659
+ */
26660
+ collapseAll() {
26661
+ this.toggleAll(false);
26662
+ }
26663
+ /**
26664
+ * Expands all expanded root level groups.
26665
+ */
26666
+ expandAll() {
26667
+ this.toggleAll(true);
26668
+ }
26669
+ /**
26670
+ * @hidden
26671
+ */
26610
26672
  groupExpand({ groupIndex }) {
26611
- this.grid.expandGroupChildren(groupIndex);
26612
26673
  const { group, parents } = findGroup(groupIndex, this.groups);
26674
+ if (!group) {
26675
+ return;
26676
+ }
26677
+ this.groupsService.expandChildren(groupIndex);
26613
26678
  if (!group.items.length) {
26614
26679
  const descriptors = this.state.group.filter(removeParentDescriptors(parents, group));
26615
26680
  const children = findChildren(this.originalData, parents.concat(group));
@@ -26621,11 +26686,17 @@ class GroupBindingDirective extends DataBindingDirective {
26621
26686
  }
26622
26687
  this.grid.data = this.dataResult(this.state.skip, this.state.take);
26623
26688
  }
26689
+ /**
26690
+ * @hidden
26691
+ */
26624
26692
  groupCollapse({ groupIndex }) {
26625
26693
  const { group } = findGroup(groupIndex, this.groups);
26626
26694
  if (group) {
26627
26695
  group.items = [];
26628
26696
  }
26697
+ else {
26698
+ return;
26699
+ }
26629
26700
  this.grid.data = this.dataResult(this.state.skip, this.state.take);
26630
26701
  }
26631
26702
  process(state) {
@@ -26665,12 +26736,15 @@ class GroupBindingDirective extends DataBindingDirective {
26665
26736
  this.filter = filter;
26666
26737
  }
26667
26738
  }
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 });
26739
+ 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 });
26740
+ 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
26741
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GroupBindingDirective, decorators: [{
26671
26742
  type: Directive,
26672
- args: [{ selector: '[kendoGridGroupBinding]' }]
26673
- }], ctorParameters: function () { return [{ type: GridComponent }, { type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }]; }, propDecorators: { kendoGridGroupBinding: [{
26743
+ args: [{
26744
+ selector: '[kendoGridGroupBinding]',
26745
+ exportAs: 'kendoGridGroupBinding'
26746
+ }]
26747
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: LocalDataChangesService }, { type: ContextService }, { type: GroupsService }]; }, propDecorators: { kendoGridGroupBinding: [{
26674
26748
  type: Input,
26675
26749
  args: ["kendoGridGroupBinding"]
26676
26750
  }], sort: [{