Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ All notable changes for each version of this project will be documented in this
- `IgxButtonDirective`
- An `aria-label` set on the button, statically or through a binding, is no longer removed. The button changes `aria-label` only through `igxLabel`, and clearing `igxLabel` removes only the value it set (#18009).
- Buttons that use `igxLabel` no longer receive the label styles of `IgxLabelDirective`, such as its text color (#18009).
- `IgxPivotGridComponent`
- In the horizontal row layout, a key press that scrolls to another row dimension header, such as `Home` or `End`, now highlights that header. Previously the header that was active before the key press stayed highlighted (#17932).

## 22.3.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ export class IgxPivotGridNavigationService extends IgxGridNavigationService {
}

this.setActiveNode(newActiveNode);
if (!this.grid.hasHorizontalLayout && verticalContainer.isIndexOutsideView(newActiveNode.row)) {
if (this.grid.hasHorizontalLayout) {
this.grid.notifyChanges();
} else if (verticalContainer.isIndexOutsideView(newActiveNode.row)) {
verticalContainer.scrollTo(newActiveNode.row);
}
} else {
Expand Down Expand Up @@ -385,13 +387,11 @@ export class IgxPivotGridNavigationService extends IgxGridNavigationService {
if (verticalContainer.isIndexOutsideView(nextDataViewIndex)) {
verticalContainer.scrollTo(nextDataViewIndex);
await new Promise((resolve) => {
this.grid.gridScroll.pipe(take(1), timeout({ first: 10000 })).subscribe({
verticalContainer.chunkLoad.pipe(take(1), timeout({ first: 10000 })).subscribe({
next: (value) => resolve(value),
error: (err) => resolve(err)
});
});
// Large scroll jumps only reassign the row contexts, so update the row dimension rows before looking them up.
this.grid.cdr.detectChanges();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { SimpleChange } from '@angular/core';
import { provideZonelessChangeDetection, SimpleChange } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { firstValueFrom } from 'rxjs';
import {
ColumnPinningPosition,
FilteringExpressionsTree,
Expand Down Expand Up @@ -4583,6 +4584,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
});

it("should scroll to the row dimension cells outside of the view.", async () => {
fixture.autoDetectChanges();
pivotGrid.data = Array.from({ length: 30 }, (_, i) => ({
ProductCategory: 'Clothing', UnitPrice: 10, SellerName: `Seller ${i}`,
Country: 'Bulgaria', City: `City ${i}`, Date: '01/01/2012', UnitsSold: i
Expand Down Expand Up @@ -4621,6 +4623,7 @@ describe('IgxPivotGrid #pivotGrid', () => {
});

it("should jump to the first and last row dimension cells outside of the view.", async () => {
fixture.autoDetectChanges();
pivotGrid.data = Array.from({ length: 30 }, (_, i) => ({
ProductCategory: 'Clothing', UnitPrice: 10, SellerName: `Seller ${i}`,
Country: 'Bulgaria', City: `City ${i}`, Date: '01/01/2012', UnitsSold: i
Expand Down Expand Up @@ -4664,6 +4667,50 @@ describe('IgxPivotGrid #pivotGrid', () => {
});
});

describe('IgxPivotGrid Horizontal Layout zoneless #pivotGrid', () => {
beforeEach(() => {
TestBed.configureTestingModule({ providers: [provideZonelessChangeDetection()] });
});

it('should highlight the row dimension header that End and Home scroll to.', async () => {
const fixture = TestBed.createComponent(IgxPivotGridTestComplexHierarchyComponent);
fixture.detectChanges();
const pivotGrid = fixture.componentInstance.pivotGrid;
pivotGrid.pivotUI = { showRowHeaders: true, rowLayout: PivotRowLayoutType.Horizontal };
pivotGrid.data = Array.from({ length: 40 }, (_, i) => ({
ProductCategory: i % 2 ? 'Bikes' : 'Clothing', City: `City ${i}`, Country: 'Bulgaria', Date: '01/01/2012', UnitsSold: i
}));
pivotGrid.pivotConfiguration.rows = [{
memberName: 'AllProducts', memberFunction: () => 'All Products', enabled: true, horizontalSummary: true,
childLevel: { memberName: 'ProductCategory', enabled: true, horizontalSummary: true, childLevel: { memberName: 'City', enabled: true } }
}];
pivotGrid.pipeTrigger++;
fixture.detectChanges();
await fixture.whenStable();

const headers = () => fixture.debugElement.queryAll(By.directive(IgxPivotRowDimensionHeaderComponent));
const activeHeaders = () => headers()
.filter(x => x.parent.nativeElement.classList.contains('igx-grid-th--active'))
.map(x => x.componentInstance.column.header);
const container = fixture.debugElement.query(By.css('.igx-grid__tbody-pivot-mrl-dimension')).nativeElement;
const pressKey = async (key: string) => {
const activeNodeChanged = firstValueFrom(pivotGrid.activeNodeChange);
UIInteractions.triggerKeyDownEvtUponElem(key, container);
await activeNodeChanged;
await fixture.whenStable();
};

UIInteractions.simulateClickAndSelectEvent(headers().find(x => x.componentInstance.column.header === 'All Products'));
await fixture.whenStable();

await pressKey('End');
expect(activeHeaders()).toEqual(['All Products Total']);

await pressKey('Home');
expect(activeHeaders()).toEqual(['All Products']);
});
});

describe('Template directives #pivotGrid', () => {
let fixture: ComponentFixture<IgxPivotGridTemplateDirectivesComponent>;

Expand Down
Loading