Skip to content

Commit d99b71b

Browse files
authored
Merge pull request #14347 from IgniteUI/skrastev/pivot-horizontal-rows
feat(igxPivotGrid): Implement horizontal row layout for Pivot Grid.
2 parents 99c4ca7 + fd6fd2f commit d99b71b

27 files changed

+1697
-278
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes for each version of this project will be documented in this file.
44

5+
## 18.1.0
6+
### New Features
7+
- `IgxPivotGrid`
8+
- Added horizontal layout for row dimensions. Can be configured through the `pivotUI` `rowLayout` property.
9+
- Added `horizontalSummary` property for each IPivotDimension, enabling summary row when using horizontal layout.
10+
- Keyboard navigation now can move in to row headers back and forth from any row dimension headers or column headers.
11+
- Added keyboard interactions for row dimension collapse using `Alt + Arrows` and row headers sorting using `Ctrl + Arrow Up/Down`.
12+
513
## 18.0.0
614
### New Features
715
- `IgxCombo`, `IgxSimpleCombo`:

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,10 @@
589589
@extend %igx-grid__tr-pivot--columnMultiRowSpan !optional
590590
}
591591

592+
@include e(tbody-pivot-mrl-dimension) {
593+
@extend %igx-grid__tbody-pivot-mrl-dimension !optional
594+
}
595+
592596
@include e(tr-pivot-toggle-icons) {
593597
@extend %igx-grid__tr-pivot-toggle-icons !optional;
594598
}

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,6 +3265,7 @@
32653265
map.get($grid-header-padding-inline, 'cosy'),
32663266
map.get($grid-header-padding-inline, 'comfortable')
32673267
);
3268+
align-self: center;
32683269
}
32693270
}
32703271

@@ -3276,5 +3277,11 @@
32763277
}
32773278
}
32783279

3280+
%igx-grid__tbody-pivot-mrl-dimension {
3281+
.igx-grid-th {
3282+
border-bottom: none;
3283+
}
3284+
}
3285+
32793286
// Pivot grid END
32803287
}

projects/igniteui-angular/src/lib/data-operations/pivot-strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class PivotRowDimensionsStrategy implements IPivotDimensionStrategy {
3232
rows: IPivotDimension[],
3333
values: IPivotValue[],
3434
cloneStrategy: IDataCloneStrategy,
35-
pivotKeys: IPivotKeys = DEFAULT_PIVOT_KEYS,
35+
pivotKeys: IPivotKeys = DEFAULT_PIVOT_KEYS
3636
): IPivotGridRecord[] {
3737
let hierarchies;
3838
let data: IPivotGridRecord[];

projects/igniteui-angular/src/lib/grids/common/grid.interface.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,12 +1235,17 @@ export interface PivotGridType extends GridType {
12351235
rowDimensions: IPivotDimension[];
12361236
rowDimensionResizing: boolean;
12371237
/** @hidden @internal */
1238+
visibleRowDimensions: IPivotDimension[];
1239+
/** @hidden @internal */
1240+
hasHorizontalLayout: boolean;
1241+
/** @hidden @internal */
12381242
values: IPivotValue[];
12391243
/** @hidden @internal */
12401244
filterDimensions: IPivotDimension[];
12411245
/** @hidden @internal */
12421246
dimensionDataColumns: ColumnType[];
12431247
pivotRowWidths: number;
1248+
getRowDimensionByName(name: string): IPivotDimension;
12441249
/** Represents a method declaration for setting up the columns for the pivot grid based on the pivot configuration */
12451250
setupColumns(): void;
12461251
/** Represents a method declaration that allows toggle of expansion state of a row (taken as a parameter) in the pivot grid */

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7828,7 +7828,7 @@ export abstract class IgxGridBaseDirective implements GridType,
78287828
this._lastSearchInfo.matchCount = this._lastSearchInfo.matchInfoCache.length;
78297829
}
78307830

7831-
private updateDefaultRowHeight() {
7831+
protected updateDefaultRowHeight() {
78327832
if (this.dataRowList.length > 0 && this.dataRowList.first.cells && this.dataRowList.first.cells.length > 0) {
78337833
const height = parseFloat(this.document.defaultView.getComputedStyle(this.dataRowList.first.cells.first.nativeElement)?.getPropertyValue('height'));
78347834
if (height) {

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid-navigation.service.ts

Lines changed: 307 additions & 34 deletions
Large diffs are not rendered by default.

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</igx-pivot-header-row>
1919

2020
<div igxGridBody (keydown.control.c)="copyHandler($event)" (copy)="copyHandler($event)" class="igx-grid__tbody" role="rowgroup">
21-
<ng-container *ngTemplateOutlet="rowDimensions.length ? defaultRowDimensionsTemplate : emptyRowDimensionsTemplate; context: this"></ng-container>
21+
<ng-container *ngTemplateOutlet="rowDimensions.length ? (hasHorizontalLayout ? horizontalRowDimensionsTemplate : defaultRowDimensionsTemplate) : emptyRowDimensionsTemplate; context: this"></ng-container>
2222
<div class="igx-grid__tbody-content" tabindex="0" [attr.role]="dataView.length ? null : 'row'" (keydown)="navigation.handleNavigation($event)" (focus)="navigation.focusTbody($event)"
2323
(dragStop)="selectionService.dragMode = $event" (scroll)="preventContainerScroll($event)"
2424
(dragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"
@@ -148,6 +148,24 @@
148148
</ng-template>
149149
</div>
150150
</ng-template>
151+
152+
<ng-template #horizontalRowDimensionsTemplate>
153+
<div tabindex="0" class="igx-grid__tbody-pivot-mrl-dimension" #rowDimensionContainer [style.height.px]="totalHeight" (focus)="navigation.focusTbody($event)" (keydown)="navigation.handleNavigation($event)">
154+
<ng-container *ngIf="dataView | pivotGridHorizontalRowGrouping:pivotConfiguration:pipeTrigger:regroupTrigger as groupedData">
155+
<ng-template #verticalRowDimScrollContainer role="rowgroup" igxGridFor let-rowGroup let-rowIndex="index"
156+
[igxGridForOf]="groupedData"
157+
[igxForScrollOrientation]="'vertical'"
158+
[igxForScrollContainer]="verticalScroll"
159+
[igxForContainerSize]="calcHeight"
160+
[igxForItemSize]="renderedRowHeight"
161+
[igxForSizePropName]="'height'"
162+
>
163+
<igx-pivot-row-dimension-mrl-row [rowIndex]="rowIndex" [rowGroup]="rowGroup" [groupedData]="groupedData" [style.height.px]="renderedRowHeight * rowGroup.length"></igx-pivot-row-dimension-mrl-row>
164+
</ng-template>
165+
</ng-container>
166+
</div>
167+
</ng-template>
168+
151169
<ng-template #emptyRowDimensionsTemplate>
152170
<div tabindex="0" *ngIf="columnDimensions.length > 0 || values.length > 0" #rowDimensionContainer role="rowgroup" class="igx-grid__tbody-pivot-dimension" (focus)="navigation.focusTbody($event)" (keydown)="navigation.handleNavigation($event)">
153171
<igx-pivot-row-dimension-content role="row" class="igx-grid-thead" [grid]="this"

0 commit comments

Comments
 (0)