Skip to content

Commit de84ebe

Browse files
committed
feat(pivot): Fix activating rows dimensions from value cells
1 parent 1bf13d3 commit de84ebe

File tree

7 files changed

+37
-15
lines changed

7 files changed

+37
-15
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export interface IActiveNode {
2828
level?: number;
2929
mchCache?: ColumnGroupsCache;
3030
layout?: IMultiRowLayoutNode;
31-
isRowDimensionHeader?: boolean;
3231
}
3332

3433
/** @hidden */

projects/igniteui-angular/src/lib/grids/headers/grid-header.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ export class IgxGridHeaderComponent implements DoCheck, OnDestroy {
213213
}
214214
}
215215
}
216-
this.grid.theadRow.nativeElement.focus();
216+
if (!this.grid.isPivot || !this.grid.navigation.isRowHeaderActive) {
217+
this.grid.theadRow.nativeElement.focus();
218+
}
217219
}
218220

219221
/**

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import { HEADER_KEYS } from '../../core/utils';
77
export class IgxPivotGridNavigationService extends IgxGridNavigationService {
88
public grid: IgxPivotGridComponent;
99

10+
public isRowHeaderActive: boolean;
11+
1012
public get lastRowDimensionsIndex() {
1113
return this.grid.rowDimensions.length - 1;
1214
}
1315

1416
public focusOutRowHeader() {
15-
this.activeNode.isRowDimensionHeader = false;
17+
this.isRowHeaderActive = false;
1618
}
1719

1820
public headerNavigation(event: KeyboardEvent) {
@@ -23,12 +25,11 @@ export class IgxPivotGridNavigationService extends IgxGridNavigationService {
2325
}
2426
event.preventDefault();
2527

26-
if (this.activeNode.isRowDimensionHeader) {
28+
if (this.isRowHeaderActive) {
2729
const newActiveNode = {
2830
row: this.activeNode.row, column: this.activeNode.column, level: null,
2931
mchCache: null,
30-
layout: null,
31-
isRowDimensionHeader: this.activeNode.isRowDimensionHeader
32+
layout: null
3233
}
3334

3435
if ((key.includes('left') || key === 'home') && this.activeNode.column > 0) {

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

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

2121
<div igxGridBody (keydown.control.c)="copyHandler($event)" (copy)="copyHandler($event)" class="igx-grid__tbody" role="rowgroup">
22-
<div class="igx-grid__tbody-content" tabindex="0" [attr.role]="dataView.length ? null : 'row'" (keydown)="navigation.handleNavigation($event)"
22+
<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"
2525
[style.height.px]='totalHeight' [style.width.px]='calcWidth || null' #tbody [attr.aria-activedescendant]="activeDescendant">

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-row-dimension-header-group.component.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,27 @@ export class IgxPivotRowDimensionHeaderGroupComponent extends IgxGridHeaderGroup
5252

5353
@HostBinding('class.igx-grid-th--active')
5454
public get active() {
55-
const node = this.grid.navigation.activeNode;
55+
const nav = this.grid.navigation;
56+
const node = nav.activeNode;
5657
return node && !this.column.columnGroup ?
57-
node.isRowDimensionHeader &&
58+
nav.isRowHeaderActive &&
5859
node.row === this.intRow.index &&
5960
node.column === this.visibleIndex :
6061
false;
6162
}
6263

6364
public get activeGroup() {
64-
const node = this.grid.navigation.activeNode;
65-
return node ? node.isRowDimensionHeader && node.row === this.intRow.index && node.column === this.visibleIndex : false;
65+
const nav = this.grid.navigation;
66+
const node = nav.activeNode;
67+
return node ? nav.isRowHeaderActive && node.row === this.intRow.index && node.column === this.visibleIndex : false;
6668
}
6769

6870
protected get activeNode() {
71+
this.grid.navigation.isRowHeaderActive = true;
6972
return {
7073
row: this.intRow.index, column: this.visibleIndex, level: null,
7174
mchCache: null,
72-
layout: null,
73-
isRowDimensionHeader: true
75+
layout: null
7476
};
7577
}
7678

@@ -89,4 +91,10 @@ export class IgxPivotRowDimensionHeaderGroupComponent extends IgxGridHeaderGroup
8991
});
9092
return result;
9193
}
94+
95+
96+
public activate() {
97+
this.grid.navigation.isRowHeader = true;
98+
this.grid.navigation.setActiveNode(this.activeNode);
99+
}
92100
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ export class IgxPivotRowComponent extends IgxRowDirective implements OnChanges {
138138
}
139139

140140
public isCellActive(visibleColumnIndex) {
141-
const node = this.grid.navigation.activeNode;
141+
const nav = this.grid.navigation
142+
const node = nav.activeNode;
142143
return node && Object.keys(node).length !== 0 ?
143-
!node.isRowDimensionHeader &&
144+
!nav.isRowHeaderActive &&
144145
super.isCellActive(visibleColumnIndex) :
145146
false;
146147
}

src/app/pivot-grid/pivot-grid.sample.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
<div class="sample-flex-row">
2+
<igx-combo #combo class="combo" [itemsMaxHeight]="250" (selectionChanging)="handleChange($event)"
3+
[data]="dimensions" [displayKey]="'memberName'" [(ngModel)]="selected"
4+
placeholder="Dimension(s)" searchPlaceholder="Search...">
5+
</igx-combo>
6+
<div class="density-chooser">
7+
<igx-buttongroup>
8+
<button igxButton [disabled]="grid1.displayDensity === comfortable" (click)="setDensity('comfortable')">Comfortable</button>
9+
<button igxButton [disabled]="grid1.displayDensity === cosy" (click)="setDensity('cosy')">Cosy</button>
10+
<button igxButton [disabled]="grid1.displayDensity === compact" (click)="setDensity('compact')">Compact</button>
11+
</igx-buttongroup>
12+
</div>
213
<igx-pivot-grid #grid1 [data]="origData" [width]="'100%'" [height]="'100%'" [defaultExpandState]='true'
314
[pivotConfiguration]="pivotConfigHierarchy" [rowSelection]="'single'" [columnSelection]="'single'"
415
(dimensionsChange)='dimensionChange($event)'

0 commit comments

Comments
 (0)