Skip to content

Commit 2140b1a

Browse files
committed
fix(pivot): Fix issues from review and testing
1 parent de84ebe commit 2140b1a

File tree

5 files changed

+35
-26
lines changed

5 files changed

+35
-26
lines changed

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid-keyboard-nav.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
4444
let activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
4545
expect(activeCells.length).toBe(1);
4646

47-
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', pivotGrid.theadRow.nativeElement);
47+
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', firstCell.nativeElement);
4848
fixture.detectChanges();
4949
GridFunctions.verifyHeaderIsFocused(secondCell.parent);
5050
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
@@ -57,7 +57,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
5757
UIInteractions.simulateClickAndSelectEvent(firstCell);
5858
fixture.detectChanges();
5959

60-
UIInteractions.triggerKeyDownEvtUponElem('ArrowLeft', pivotGrid.theadRow.nativeElement);
60+
UIInteractions.triggerKeyDownEvtUponElem('ArrowLeft', firstCell.nativeElement);
6161
fixture.detectChanges();
6262

6363
GridFunctions.verifyHeaderIsFocused(firstCell.parent);
@@ -67,7 +67,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
6767
UIInteractions.simulateClickAndSelectEvent(thirdCell);
6868
fixture.detectChanges();
6969

70-
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', pivotGrid.theadRow.nativeElement);
70+
UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', thirdCell.nativeElement);
7171
fixture.detectChanges();
7272

7373
GridFunctions.verifyHeaderIsFocused(thirdCell.parent);
@@ -81,13 +81,13 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
8181
UIInteractions.simulateClickAndSelectEvent(firstCell);
8282
fixture.detectChanges();
8383

84-
UIInteractions.triggerKeyDownEvtUponElem('End', pivotGrid.theadRow.nativeElement);
84+
UIInteractions.triggerKeyDownEvtUponElem('End', firstCell.nativeElement);
8585
fixture.detectChanges();
8686
GridFunctions.verifyHeaderIsFocused(thirdCell.parent);
8787
let activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
8888
expect(activeCells.length).toBe(1);
8989

90-
UIInteractions.triggerKeyDownEvtUponElem('Home', pivotGrid.theadRow.nativeElement);
90+
UIInteractions.triggerKeyDownEvtUponElem('Home', thirdCell.nativeElement);
9191
fixture.detectChanges();
9292
GridFunctions.verifyHeaderIsFocused(firstCell.parent);
9393
activeCells = fixture.debugElement.queryAll(By.css(`${ACTIVE_CELL_CSS_CLASS}`));
@@ -100,7 +100,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => {
100100
UIInteractions.simulateClickAndSelectEvent(thirdCell);
101101
fixture.detectChanges();
102102

103-
UIInteractions.triggerKeyDownEvtUponElem('ArrowDown', pivotGrid.theadRow.nativeElement, true, false, false, true);
103+
UIInteractions.triggerKeyDownEvtUponElem('ArrowDown', thirdCell.nativeElement, true, false, false, true);
104104
fixture.detectChanges();
105105

106106
const allCells = fixture.debugElement.queryAll(

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ export class IgxPivotGridNavigationService extends IgxGridNavigationService {
1717
this.isRowHeaderActive = false;
1818
}
1919

20-
public headerNavigation(event: KeyboardEvent) {
21-
const key = event.key.toLowerCase();
22-
const ctrl = event.ctrlKey;
23-
if (!HEADER_KEYS.has(key)) {
24-
return;
25-
}
26-
event.preventDefault();
27-
20+
public handleNavigation(event: KeyboardEvent) {
2821
if (this.isRowHeaderActive) {
22+
const key = event.key.toLowerCase();
23+
const ctrl = event.ctrlKey;
24+
if (!HEADER_KEYS.has(key)) {
25+
return;
26+
}
27+
event.preventDefault();
28+
2929
const newActiveNode = {
3030
row: this.activeNode.row, column: this.activeNode.column, level: null,
3131
mchCache: null,
@@ -47,7 +47,7 @@ export class IgxPivotGridNavigationService extends IgxGridNavigationService {
4747
this.setActiveNode(newActiveNode);
4848
this.grid.navigateTo(newActiveNode.row);
4949
} else {
50-
super.headerNavigation(event);
50+
super.handleNavigation(event);
5151
}
5252
}
5353
}

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { IPivotDimension } from './pivot-grid.interface';
1111
/**
1212
* @hidden
1313
*/
14-
@Component({
14+
@Component({
1515
changeDetection: ChangeDetectionStrategy.OnPush,
1616
selector: 'igx-pivot-row-dimension-header-group',
1717
templateUrl: '../headers/grid-header-group.component.html'
@@ -24,8 +24,8 @@ export class IgxPivotRowDimensionHeaderGroupComponent extends IgxGridHeaderGroup
2424
public colResizingService: IgxColumnResizingService,
2525
public filteringService: IgxFilteringService,
2626
protected platform: PlatformUtil) {
27-
super(cdRef, grid, elementRef, colResizingService, filteringService, platform);
28-
}
27+
super(cdRef, grid, elementRef, colResizingService, filteringService, platform);
28+
}
2929

3030
/**
3131
* @hidden
@@ -87,7 +87,7 @@ export class IgxPivotRowDimensionHeaderGroupComponent extends IgxGridHeaderGroup
8787
result = row;
8888
}
8989
tempRow = tempRow.childLevel;
90-
} while(tempRow)
90+
} while (tempRow)
9191
});
9292
return result;
9393
}
@@ -97,4 +97,18 @@ export class IgxPivotRowDimensionHeaderGroupComponent extends IgxGridHeaderGroup
9797
this.grid.navigation.isRowHeader = true;
9898
this.grid.navigation.setActiveNode(this.activeNode);
9999
}
100+
101+
/**
102+
* @hidden @internal
103+
*/
104+
public pointerdown(_event: PointerEvent): void {
105+
this.activate();
106+
}
107+
108+
/**
109+
* @hidden @internal
110+
*/
111+
public onMouseDown(_event: MouseEvent): void {
112+
this.activate();
113+
}
100114
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
</igx-buttongroup>
1212
</div>
1313
<igx-pivot-grid #grid1 [data]="origData" [width]="'100%'" [height]="'100%'" [defaultExpandState]='true'
14-
[pivotConfiguration]="pivotConfigHierarchy" [rowSelection]="'single'" [columnSelection]="'single'"
15-
(dimensionsChange)='dimensionChange($event)'
16-
[cellSelection]="'single'">
14+
[pivotConfiguration]="pivotConfigHierarchy" (dimensionsChange)='dimensionChange($event)'>
1715
</igx-pivot-grid>
1816
</div>
1917

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ igx-pivot-grid {
1717
display: flex;
1818
gap: 16px;
1919
margin-bottom: 16px;
20-
21-
> * {
22-
flex: 1;
23-
}
20+
flex-direction: column;
2421
}
2522

2623
:host ::ng-deep {

0 commit comments

Comments
 (0)