@progress/kendo-angular-grid 18.0.1-develop.3 → 18.1.0-develop.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/columns/cell-rowspan.d.ts +10 -0
  2. package/columns/column-base.d.ts +8 -2
  3. package/editing-directives/local-row-edit.service.d.ts +1 -1
  4. package/esm2022/aggregates/selection-aggregate.service.mjs +1 -1
  5. package/esm2022/columns/cell-rowspan.mjs +5 -0
  6. package/esm2022/columns/column-base.mjs +13 -2
  7. package/esm2022/dragdrop/draggable-column.directive.mjs +2 -2
  8. package/esm2022/editing-directives/local-row-edit.service.mjs +1 -1
  9. package/esm2022/grid.component.mjs +6 -3
  10. package/esm2022/grouping/group-panel.component.mjs +1 -1
  11. package/esm2022/navigation/logical-cell.directive.mjs +7 -1
  12. package/esm2022/navigation/navigation.service.mjs +27 -35
  13. package/esm2022/package-metadata.mjs +2 -2
  14. package/esm2022/pdf/pdf.component.mjs +1 -1
  15. package/esm2022/rendering/cell.component.mjs +1 -1
  16. package/esm2022/rendering/common/col-group.component.mjs +1 -1
  17. package/esm2022/rendering/footer/footer.component.mjs +1 -1
  18. package/esm2022/rendering/header/header.component.mjs +2 -2
  19. package/esm2022/rendering/list.component.mjs +14 -5
  20. package/esm2022/rendering/rowspan.service.mjs +24 -0
  21. package/esm2022/rendering/table-body.component.mjs +106 -64
  22. package/esm2022/selection/selection-default.mjs +1 -1
  23. package/fesm2022/progress-kendo-angular-grid.mjs +202 -123
  24. package/index.d.ts +1 -0
  25. package/navigation/logical-cell.directive.d.ts +1 -0
  26. package/navigation/navigation.service.d.ts +2 -0
  27. package/package.json +19 -19
  28. package/pdf/pdf.component.d.ts +1 -1
  29. package/rendering/cell.component.d.ts +1 -1
  30. package/rendering/common/col-group.component.d.ts +1 -1
  31. package/rendering/footer/footer.component.d.ts +1 -1
  32. package/rendering/header/header.component.d.ts +1 -1
  33. package/rendering/list.component.d.ts +4 -1
  34. package/rendering/rowspan.service.d.ts +14 -0
  35. package/rendering/table-body.component.d.ts +9 -2
  36. package/schematics/ngAdd/index.js +4 -4
@@ -32,6 +32,7 @@ import { CellComponent } from './cell.component';
32
32
  import { LogicalCellDirective } from '../navigation/logical-cell.directive';
33
33
  import { LogicalRowDirective } from '../navigation/logical-row.directive';
34
34
  import { NgIf, NgFor, NgClass, NgStyle, NgTemplateOutlet } from '@angular/common';
35
+ import { RowspanService } from './rowspan.service';
35
36
  import * as i0 from "@angular/core";
36
37
  import * as i1 from "./details/details.service";
37
38
  import * as i2 from "../grouping/groups.service";
@@ -43,6 +44,7 @@ import * as i7 from "../selection/selection.service";
43
44
  import * as i8 from "../selection/cell-selection.service";
44
45
  import * as i9 from "../common/column-info.service";
45
46
  import * as i10 from "../navigation/navigation.service";
47
+ import * as i11 from "./rowspan.service";
46
48
  const columnCellIndex = (cell, cells) => {
47
49
  let cellIndex = 0;
48
50
  for (let idx = 0; idx < cells.length; idx++) {
@@ -71,6 +73,7 @@ export class TableBodyComponent {
71
73
  cellSelectionService;
72
74
  columnInfoService;
73
75
  navigationService;
76
+ rowspanService;
74
77
  columns = [];
75
78
  allColumns;
76
79
  groups = [];
@@ -93,6 +96,7 @@ export class TableBodyComponent {
93
96
  trackBy = defaultTrackBy;
94
97
  rowSticky;
95
98
  totalColumns;
99
+ rowClass = () => null;
96
100
  hostClass = true;
97
101
  groupHeaderSlaveCellsCount;
98
102
  groupHeaderColumns;
@@ -103,8 +107,9 @@ export class TableBodyComponent {
103
107
  clickTimeout;
104
108
  minusIcon = minusIcon;
105
109
  plusIcon = plusIcon;
106
- rowClass = () => null;
107
- constructor(detailsService, groupsService, changeNotification, editService, ctx, ngZone, renderer, element, domEvents, selectionService, cellSelectionService, columnInfoService, navigationService) {
110
+ dataArray;
111
+ rerender = false;
112
+ constructor(detailsService, groupsService, changeNotification, editService, ctx, ngZone, renderer, element, domEvents, selectionService, cellSelectionService, columnInfoService, navigationService, rowspanService) {
108
113
  this.detailsService = detailsService;
109
114
  this.groupsService = groupsService;
110
115
  this.changeNotification = changeNotification;
@@ -118,6 +123,7 @@ export class TableBodyComponent {
118
123
  this.cellSelectionService = cellSelectionService;
119
124
  this.columnInfoService = columnInfoService;
120
125
  this.navigationService = navigationService;
126
+ this.rowspanService = rowspanService;
121
127
  this.noRecordsText = this.ctx.localization.get('noRecords');
122
128
  this.cellKeydownSubscription = this.navigationService.cellKeydown.subscribe((args) => this.cellKeydownHandler(args));
123
129
  this.trackByWrapper = this.trackByWrapper.bind(this);
@@ -126,6 +132,12 @@ export class TableBodyComponent {
126
132
  get newDataItem() {
127
133
  return this.editService.newDataItem;
128
134
  }
135
+ get cachedDataArray() {
136
+ if (!this.dataArray) {
137
+ this.dataArray = this.data.map(item => item);
138
+ }
139
+ return this.dataArray;
140
+ }
129
141
  // Number of unlocked columns in the next table, if any
130
142
  unlockedColumnsCount(item) {
131
143
  const allColumns = this.allColumns || this.columns;
@@ -139,6 +151,24 @@ export class TableBodyComponent {
139
151
  const headerFooterColumnsCount = this.totalColumnsCount - this.lockedColumnsCount - (this.allColumns || this.columns).length;
140
152
  return item && this.isDataItem(item) ? contentColumnsCount : headerFooterColumnsCount;
141
153
  }
154
+ shouldSkipCell(rowIndex, colIndex) {
155
+ return this.rowspanService.shouldSkip(rowIndex, colIndex);
156
+ }
157
+ getRowspan(row, column, colIndex) {
158
+ if (this.rerender) {
159
+ this.dataArray = null;
160
+ this.rerender = false;
161
+ }
162
+ const rowspan = column.cellRowspan(row, column, this.cachedDataArray);
163
+ if (rowspan > 1) {
164
+ this.rowspanService.addCells(row.index, colIndex, rowspan);
165
+ }
166
+ this.ngZone.runOutsideAngular(() => setTimeout(() => {
167
+ this.rerender = true;
168
+ this.rowspanService.reset();
169
+ }));
170
+ return rowspan;
171
+ }
142
172
  isAriaSelected(item, column) {
143
173
  return this.cellSelectionService.isCellSelected(item, column) ||
144
174
  this.isRowSelected(item) ? 'true' : 'false';
@@ -442,7 +472,7 @@ export class TableBodyComponent {
442
472
  });
443
473
  }
444
474
  }
445
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableBodyComponent, deps: [{ token: i1.DetailsService }, { token: i2.GroupsService }, { token: i3.ChangeNotificationService }, { token: i4.EditService }, { token: i5.ContextService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i6.DomEventsService }, { token: i7.SelectionService }, { token: i8.CellSelectionService }, { token: i9.ColumnInfoService }, { token: i10.NavigationService }], target: i0.ɵɵFactoryTarget.Component });
475
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableBodyComponent, deps: [{ token: i1.DetailsService }, { token: i2.GroupsService }, { token: i3.ChangeNotificationService }, { token: i4.EditService }, { token: i5.ContextService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i6.DomEventsService }, { token: i7.SelectionService }, { token: i8.CellSelectionService }, { token: i9.ColumnInfoService }, { token: i10.NavigationService }, { token: i11.RowspanService }], target: i0.ɵɵFactoryTarget.Component });
446
476
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TableBodyComponent, isStandalone: true, selector: "[kendoGridTableBody]", inputs: { columns: "columns", allColumns: "allColumns", groups: "groups", detailTemplate: "detailTemplate", noRecordsTemplate: "noRecordsTemplate", data: "data", skip: "skip", selectable: "selectable", filterable: "filterable", noRecordsText: "noRecordsText", isLocked: "isLocked", isLoading: "isLoading", isVirtual: "isVirtual", cellLoadingTemplate: "cellLoadingTemplate", skipGroupDecoration: "skipGroupDecoration", showGroupFooters: "showGroupFooters", lockedColumnsCount: "lockedColumnsCount", totalColumnsCount: "totalColumnsCount", virtualColumns: "virtualColumns", trackBy: "trackBy", rowSticky: "rowSticky", totalColumns: "totalColumns", rowClass: "rowClass" }, host: { properties: { "class.k-table-tbody": "this.hostClass" } }, usesOnChanges: true, ngImport: i0, template: `
447
477
  <ng-container *ngIf="editService.hasNewItem">
448
478
  <tr class="k-grid-add-row k-grid-edit-row k-master-row"
@@ -558,35 +588,41 @@ export class TableBodyComponent {
558
588
  [svgIcon]="detailButtonSvgIcon(item)"></kendo-icon-wrapper>
559
589
  </a>
560
590
  </td>
561
- <td
562
- kendoGridCell
563
- [rowIndex]="$any(item).index"
564
- [columnIndex]="lockedColumnsCount + columnIndex"
565
- [attr.data-kendo-grid-column-index]="lockedColumnsCount + columnIndex"
566
- [column]="column"
567
- [dataItem]="item.data"
568
- [isLoading]="isLoading"
569
- [isVirtual]="isVirtual"
570
- [loadingTemplate]="cellLoadingTemplate"
571
- kendoGridLogicalCell
572
- [logicalRowIndex]="logicalRowIndex(rowIndex)"
573
- [logicalColIndex]="logicalColIndex(column)"
574
- [dataRowIndex]="$any(item).index"
575
- [dataItem]="item.data"
576
- [colIndex]="columnIndex"
577
- [colSpan]="column.colspan"
578
- [attr.role]="column.tableCellsRole"
579
- class="k-table-td"
580
- [attr.aria-selected]="lockedColumnsCount < 1 && isSelectable({ dataItem: item.data, index: $any(item).index }) ? isAriaSelected(item, column) : undefined"
581
- [class.k-grid-content-sticky]="column.sticky"
582
- [class.k-touch-action-none]="isSelectable({ dataItem: item.data, index: $any(item).index }) && $any(selectable).drag"
583
- [ngClass]="column.cssClass"
584
- [class.k-grid-edit-cell]="isEditingCell($any(item).index, column)"
585
- [ngStyle]="column.sticky ? addStickyColumnStyles(column) : column.style"
586
- [attr.colspan]="column.colspan"
587
- [class.k-selected]="isSelectable && cellSelectionService.isCellSelected(item, column)"
588
- *ngFor="let column of columns; let columnIndex = index; trackBy: trackByColumns;">
589
- </td>
591
+ <ng-container *ngFor="let column of columns; let columnIndex = index; trackBy: trackByColumns;">
592
+ <td *ngIf="column.cellRowspan ? !shouldSkipCell(rowIndex, lockedColumnsCount + columnIndex) : true"
593
+ kendoGridCell
594
+ [rowIndex]="$any(item).index"
595
+ [columnIndex]="lockedColumnsCount + columnIndex"
596
+ [attr.data-kendo-grid-column-index]="lockedColumnsCount + columnIndex"
597
+ [column]="column"
598
+ [dataItem]="item.data"
599
+ [isLoading]="isLoading"
600
+ [isVirtual]="isVirtual"
601
+ [loadingTemplate]="cellLoadingTemplate"
602
+ kendoGridLogicalCell
603
+ [logicalRowIndex]="logicalRowIndex(rowIndex)"
604
+ [logicalColIndex]="logicalColIndex(column)"
605
+ [dataRowIndex]="$any(item).index"
606
+ [dataItem]="item.data"
607
+ [colIndex]="columnIndex"
608
+ [colSpan]="column.colspan"
609
+ [rowSpan]="column.cellRowspan ? getRowspan({
610
+ index: rowIndex,
611
+ dataItem: item
612
+ }, column, lockedColumnsCount + columnIndex) : 1"
613
+ [attr.role]="column.tableCellsRole"
614
+ class="k-table-td"
615
+ [attr.aria-selected]="lockedColumnsCount < 1 && isSelectable({ dataItem: item.data, index: $any(item).index }) ? isAriaSelected(item, column) : undefined"
616
+ [class.k-grid-content-sticky]="column.sticky"
617
+ [class.k-touch-action-none]="isSelectable({ dataItem: item.data, index: $any(item).index }) && $any(selectable).drag"
618
+ [ngClass]="column.cssClass"
619
+ [class.k-grid-edit-cell]="isEditingCell($any(item).index, column)"
620
+ [ngStyle]="column.sticky ? addStickyColumnStyles(column) : column.style"
621
+ [attr.colspan]="column.colspan"
622
+ [class.k-selected]="isSelectable && cellSelectionService.isCellSelected(item, column)"
623
+ >
624
+ </td>
625
+ </ng-container>
590
626
  </tr>
591
627
  <tr *ngIf="isDataItem(item) &&
592
628
  (!$any(item).group || isDataItemInExpandedGroup($any(item))) &&
@@ -787,35 +823,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
787
823
  [svgIcon]="detailButtonSvgIcon(item)"></kendo-icon-wrapper>
788
824
  </a>
789
825
  </td>
790
- <td
791
- kendoGridCell
792
- [rowIndex]="$any(item).index"
793
- [columnIndex]="lockedColumnsCount + columnIndex"
794
- [attr.data-kendo-grid-column-index]="lockedColumnsCount + columnIndex"
795
- [column]="column"
796
- [dataItem]="item.data"
797
- [isLoading]="isLoading"
798
- [isVirtual]="isVirtual"
799
- [loadingTemplate]="cellLoadingTemplate"
800
- kendoGridLogicalCell
801
- [logicalRowIndex]="logicalRowIndex(rowIndex)"
802
- [logicalColIndex]="logicalColIndex(column)"
803
- [dataRowIndex]="$any(item).index"
804
- [dataItem]="item.data"
805
- [colIndex]="columnIndex"
806
- [colSpan]="column.colspan"
807
- [attr.role]="column.tableCellsRole"
808
- class="k-table-td"
809
- [attr.aria-selected]="lockedColumnsCount < 1 && isSelectable({ dataItem: item.data, index: $any(item).index }) ? isAriaSelected(item, column) : undefined"
810
- [class.k-grid-content-sticky]="column.sticky"
811
- [class.k-touch-action-none]="isSelectable({ dataItem: item.data, index: $any(item).index }) && $any(selectable).drag"
812
- [ngClass]="column.cssClass"
813
- [class.k-grid-edit-cell]="isEditingCell($any(item).index, column)"
814
- [ngStyle]="column.sticky ? addStickyColumnStyles(column) : column.style"
815
- [attr.colspan]="column.colspan"
816
- [class.k-selected]="isSelectable && cellSelectionService.isCellSelected(item, column)"
817
- *ngFor="let column of columns; let columnIndex = index; trackBy: trackByColumns;">
818
- </td>
826
+ <ng-container *ngFor="let column of columns; let columnIndex = index; trackBy: trackByColumns;">
827
+ <td *ngIf="column.cellRowspan ? !shouldSkipCell(rowIndex, lockedColumnsCount + columnIndex) : true"
828
+ kendoGridCell
829
+ [rowIndex]="$any(item).index"
830
+ [columnIndex]="lockedColumnsCount + columnIndex"
831
+ [attr.data-kendo-grid-column-index]="lockedColumnsCount + columnIndex"
832
+ [column]="column"
833
+ [dataItem]="item.data"
834
+ [isLoading]="isLoading"
835
+ [isVirtual]="isVirtual"
836
+ [loadingTemplate]="cellLoadingTemplate"
837
+ kendoGridLogicalCell
838
+ [logicalRowIndex]="logicalRowIndex(rowIndex)"
839
+ [logicalColIndex]="logicalColIndex(column)"
840
+ [dataRowIndex]="$any(item).index"
841
+ [dataItem]="item.data"
842
+ [colIndex]="columnIndex"
843
+ [colSpan]="column.colspan"
844
+ [rowSpan]="column.cellRowspan ? getRowspan({
845
+ index: rowIndex,
846
+ dataItem: item
847
+ }, column, lockedColumnsCount + columnIndex) : 1"
848
+ [attr.role]="column.tableCellsRole"
849
+ class="k-table-td"
850
+ [attr.aria-selected]="lockedColumnsCount < 1 && isSelectable({ dataItem: item.data, index: $any(item).index }) ? isAriaSelected(item, column) : undefined"
851
+ [class.k-grid-content-sticky]="column.sticky"
852
+ [class.k-touch-action-none]="isSelectable({ dataItem: item.data, index: $any(item).index }) && $any(selectable).drag"
853
+ [ngClass]="column.cssClass"
854
+ [class.k-grid-edit-cell]="isEditingCell($any(item).index, column)"
855
+ [ngStyle]="column.sticky ? addStickyColumnStyles(column) : column.style"
856
+ [attr.colspan]="column.colspan"
857
+ [class.k-selected]="isSelectable && cellSelectionService.isCellSelected(item, column)"
858
+ >
859
+ </td>
860
+ </ng-container>
819
861
  </tr>
820
862
  <tr *ngIf="isDataItem(item) &&
821
863
  (!$any(item).group || isDataItemInExpandedGroup($any(item))) &&
@@ -902,7 +944,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
902
944
  GroupHeaderComponent, IconWrapperComponent, NgTemplateOutlet, ResizeSensorComponent
903
945
  ]
904
946
  }]
905
- }], ctorParameters: function () { return [{ type: i1.DetailsService }, { type: i2.GroupsService }, { type: i3.ChangeNotificationService }, { type: i4.EditService }, { type: i5.ContextService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i6.DomEventsService }, { type: i7.SelectionService }, { type: i8.CellSelectionService }, { type: i9.ColumnInfoService }, { type: i10.NavigationService }]; }, propDecorators: { columns: [{
947
+ }], ctorParameters: function () { return [{ type: i1.DetailsService }, { type: i2.GroupsService }, { type: i3.ChangeNotificationService }, { type: i4.EditService }, { type: i5.ContextService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i6.DomEventsService }, { type: i7.SelectionService }, { type: i8.CellSelectionService }, { type: i9.ColumnInfoService }, { type: i10.NavigationService }, { type: i11.RowspanService }]; }, propDecorators: { columns: [{
906
948
  type: Input
907
949
  }], allColumns: [{
908
950
  type: Input
@@ -946,9 +988,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
946
988
  type: Input
947
989
  }], totalColumns: [{
948
990
  type: Input
991
+ }], rowClass: [{
992
+ type: Input
949
993
  }], hostClass: [{
950
994
  type: HostBinding,
951
995
  args: ['class.k-table-tbody']
952
- }], rowClass: [{
953
- type: Input
954
996
  }] } });
@@ -72,7 +72,7 @@ export class Selection {
72
72
  this.ctx.grid.rowSelected = (row) => this.rowSelectionState.has(this.getItemKey(row));
73
73
  }
74
74
  if (!isPresent(this.ctx.grid.isRowSelectable)) {
75
- this.ctx.grid.isRowSelectable = (_row) => Boolean(this.ctx.grid.selectable);
75
+ this.ctx.grid.isRowSelectable = () => Boolean(this.ctx.grid.selectable);
76
76
  }
77
77
  if (!isPresent(this.ctx.grid.cellSelected)) {
78
78
  this.ctx.grid.cellSelected = (row, column, colIndex) => {