Skip to content

Commit 8df366b

Browse files
authored
Merge branch '9.0.x' into nrobakova/refactor-treeGrid-KyeboardNav-tests-90
2 parents 71db353 + 6d37c90 commit 8df366b

File tree

5 files changed

+52
-12
lines changed

5 files changed

+52
-12
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,14 +2799,15 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
27992799
const extractForOfs = pipe(map((collection: any[]) => collection.filter(elementFilter).map(item => item.virtDirRow)));
28002800
const rowListObserver = extractForOfs(this._dataRowList.changes);
28012801
const summaryRowObserver = extractForOfs(this._summaryRowList.changes);
2802-
2803-
combineLatest([rowListObserver, summaryRowObserver]).pipe(takeUntil(this.destroy$))
2804-
.subscribe(([row, summary]) => this._horizontalForOfs = [...row, ...summary]);
2805-
2806-
this._horizontalForOfs = [
2807-
...this._dataRowList.filter(elementFilter).map(item => item.virtDirRow),
2808-
...this._summaryRowList.filter(elementFilter).map(item => item.virtDirRow)
2809-
];
2802+
const resetHorizontalForOfs = () => {
2803+
this._horizontalForOfs = [
2804+
...this._dataRowList.filter(elementFilter).map(item => item.virtDirRow),
2805+
...this._summaryRowList.filter(elementFilter).map(item => item.virtDirRow)
2806+
];
2807+
};
2808+
rowListObserver.pipe(takeUntil(this.destroy$)).subscribe(resetHorizontalForOfs);
2809+
summaryRowObserver.pipe(takeUntil(this.destroy$)).subscribe(resetHorizontalForOfs);
2810+
resetHorizontalForOfs();
28102811
}
28112812

28122813
/**
@@ -5293,10 +5294,10 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
52935294

52945295
private isValidPosition(rowIndex, colIndex): boolean {
52955296
const rows = this.summariesRowList.filter(s => s.index !== 0).concat(this.rowList.toArray()).length;
5296-
const cols = this.columnList.filter(col => !col.columnGroup && col.visibleIndex >= 0).length;
5297+
const cols = this.columnList.filter(col => !col.columnGroup && col.visibleIndex >= 0 && !col.hidden).length;
52975298
if (rows < 1 || cols < 1) { return false; }
52985299
if (rowIndex > -1 && rowIndex < this.dataView.length &&
5299-
colIndex > - 1 && colIndex <= this.unpinnedColumns[this.unpinnedColumns.length - 1].visibleIndex) {
5300+
colIndex > - 1 && colIndex < cols) {
53005301
return true;
53015302
}
53025303
return false;

projects/igniteui-angular/src/lib/grids/grid/grid.multi-row-layout.spec.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { wait } from '../../test-utils/ui-interactions.spec';
1111
import { DefaultSortingStrategy } from '../../data-operations/sorting-strategy';
1212
import { configureTestSuite } from '../../test-utils/configure-suite';
1313
import { verifyLayoutHeadersAreAligned, verifyDOMMatchesLayoutSettings } from '../../test-utils/helper-utils.spec';
14+
import { ICellPosition } from '../common/events';
1415

1516

1617
const GRID_COL_THEAD_TITLE_CLASS = 'igx-grid__th-title';
@@ -1174,6 +1175,33 @@ describe('IgxGrid - multi-row-layout #grid', () => {
11741175
expect(col.hidden).toBe(false);
11751176
expect(col.parent.hidden).toBe(false);
11761177
});
1178+
1179+
it('should get the correct next and previous cell when in MRL scenario', () => {
1180+
const fixture = TestBed.createComponent(ColumnLayoutTestComponent);
1181+
fixture.componentInstance.colGroups = [{
1182+
group: 'group1',
1183+
columns: [
1184+
{ field: 'CompanyName', rowStart: 1, rowEnd: 2, colStart: 3, colEnd: 4, dataType: 'number', editable: true },
1185+
{ field: 'ID', rowStart: 1, rowEnd: 2, colStart: 1, colEnd: 2, dataType: 'number', editable: false },
1186+
{ field: 'ContactName', rowStart: 1, rowEnd: 2, colStart: 2, colEnd: 3, dataType: 'string', editable: false },
1187+
]
1188+
}];
1189+
const grid = fixture.componentInstance.grid;
1190+
fixture.detectChanges();
1191+
let pos: ICellPosition;
1192+
pos = grid.getNextCell(0, 1, col => col.editable === true);
1193+
expect(pos.rowIndex).toEqual(0);
1194+
expect(pos.visibleColumnIndex).toEqual(2);
1195+
pos = grid.getNextCell(0, 2, col => col.editable === true);
1196+
expect(pos.rowIndex).toEqual(1);
1197+
expect(pos.visibleColumnIndex).toEqual(2);
1198+
pos = grid.getPreviousCell(1, 2);
1199+
expect(pos.rowIndex).toEqual(1);
1200+
expect(pos.visibleColumnIndex).toEqual(1);
1201+
pos = grid.getPreviousCell(1, 2, col => col.editable === true);
1202+
expect(pos.rowIndex).toEqual(0);
1203+
expect(pos.visibleColumnIndex).toEqual(2);
1204+
});
11771205
});
11781206

11791207
@Component({
@@ -1182,7 +1210,7 @@ describe('IgxGrid - multi-row-layout #grid', () => {
11821210
<igx-column-layout *ngFor='let group of colGroups'>
11831211
<igx-column *ngFor='let col of group.columns'
11841212
[rowStart]="col.rowStart" [colStart]="col.colStart" [width]='col.width'
1185-
[colEnd]="col.colEnd" [rowEnd]="col.rowEnd" [field]='col.field'></igx-column>
1213+
[colEnd]="col.colEnd" [rowEnd]="col.rowEnd" [field]='col.field' [editable]='col.editable'></igx-column>
11861214
</igx-column-layout>
11871215
</igx-grid>
11881216
`

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ describe('IgxHierarchicalGrid Basic Navigation #hGrid', () => {
211211
}));
212212

213213
it('should include summary rows in tab sequence.', (async () => {
214-
pending('Related to the issue #6701');
215214
const childGrid = hierarchicalGrid.hgridAPI.getChildGrids(false)[0];
216215
childGrid.getColumnByName('ID').hasSummary = true;
217216
fixture.detectChanges();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ <h4 class="sample-title">Sample One</h4>
7070

7171
<h4 class="sample-title">Sample two</h4>
7272
<div class="sample-actions">
73+
<button igxButton="raised" (click)="enableSummary()">Enable Summaries</button>
7374
<button igxButton="raised" (click)='setterBindingChange()'>Set rowSelectable via binding</button>
7475
<button igxButton="raised" (click)='setterChange()'>Set rowSelectable via setter on 1st layout</button>
7576
<button igxButton="raised" (click)='testApis()'>Test APis</button>

src/app/hierarchical-grid/hierarchical-grid.sample.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export class HierarchicalGridSampleComponent {
3333
@ViewChild('hGrid', { static: true })
3434
hGrid: IgxHierarchicalGridComponent;
3535

36+
@ViewChild('hGrid2', { static: true })
37+
hGrid2: IgxHierarchicalGridComponent;
38+
3639
constructor(private cdr: ChangeDetectorRef) {
3740
// this.localData.push({ ID: -1, Name: ''});
3841
// for (let i = 0; i < 10000; i++) {
@@ -60,6 +63,14 @@ export class HierarchicalGridSampleComponent {
6063
this.localData[2].childData[1].hasChild = false;
6164
}
6265

66+
public enableSummary() {
67+
const childGrid = this.hGrid2.hgridAPI.getChildGrids(false)[0];
68+
this.hGrid2.getColumnByName('ID').hasSummary = true;
69+
if (childGrid) {
70+
childGrid.getColumnByName('ID').hasSummary = true;
71+
}
72+
}
73+
6374
ngAfterViewInit() {
6475
this.cdr.detectChanges();
6576
}

0 commit comments

Comments
 (0)