Skip to content

Commit b8ca431

Browse files
authored
Merge pull request #5011 from IgniteUI/mrl-nav-ng-8-update
Mrl nav ng 8 update
2 parents c76fb63 + a91d377 commit b8ca431

27 files changed

+4231
-157
lines changed

projects/igniteui-angular/src/lib/core/grid-selection.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ export interface GridSelectionRange {
1212
export interface ISelectionNode {
1313
row: number;
1414
column: number;
15+
layout?: IMultiRowLayoutNode;
16+
isSummaryRow?: boolean;
17+
}
18+
19+
export interface IMultiRowLayoutNode {
20+
rowStart: number;
21+
colStart: number;
22+
rowEnd: number;
23+
colEnd: number;
24+
columnVisibleIndex: number;
1525
}
1626

1727
interface ISelectionKeyboardState {

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { DeprecateProperty } from '../core/deprecateDecorators';
4343
templateUrl: './cell.component.html'
4444
})
4545
export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
46+
private _vIndex = -1;
4647

4748
/**
4849
* Gets the column of the cell.
@@ -233,7 +234,13 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
233234
*/
234235
@HostBinding('attr.data-visibleIndex')
235236
@Input()
236-
visibleColumnIndex = -1;
237+
get visibleColumnIndex() {
238+
return this.column.columnLayoutChild ? this.column.visibleIndex : this._vIndex;
239+
}
240+
241+
set visibleColumnIndex(val) {
242+
this._vIndex = val;
243+
}
237244

238245
/**
239246
* Gets the ID of the cell.
@@ -497,7 +504,17 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
497504
}
498505

499506
protected get selectionNode(): ISelectionNode {
500-
return { row: this.rowIndex, column: this.visibleColumnIndex };
507+
return {
508+
row: this.rowIndex,
509+
column: this.column.columnLayoutChild ? this.column.parent.visibleIndex : this.visibleColumnIndex,
510+
layout: this.column.columnLayoutChild ? {
511+
rowStart: this.column.rowStart,
512+
colStart: this.column.colStart,
513+
rowEnd: this.column.rowEnd,
514+
colEnd: this.column.colEnd,
515+
columnVisibleIndex: this.visibleColumnIndex
516+
} : null
517+
};
501518
}
502519

503520
protected isInCompositionMode = false;
@@ -689,6 +706,9 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
689706
* @internal
690707
*/
691708
pointerup = () => {
709+
if (this.grid.hasColumnLayouts) {
710+
this.grid.navigation.setStartNavigationCell(this.colStart, this.rowStart, null);
711+
}
692712
if (this.selectionService.pointerUp(this.selectionNode, this.grid.onRangeSelection)) {
693713
this.grid.cdr.detectChanges();
694714
}
@@ -743,7 +763,8 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
743763
this.focused = true;
744764
this.row.focused = true;
745765
this._updateCellSelectionStatus();
746-
if (!this.selectionService.isActiveNode(this.selectionNode)) {
766+
if (!this.selectionService.isActiveNode(this.selectionNode) ||
767+
this.grid.hasColumnLayouts) {
747768
this.grid.onSelection.emit({ cell: this, event });
748769
}
749770
this.selectionService.activeElement = this.selectionNode;
@@ -773,25 +794,25 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
773794

774795
protected handleTab(shift: boolean) {
775796
if (shift) {
776-
this.grid.navigation.performShiftTabKey(this.row.nativeElement, this.rowIndex, this.visibleColumnIndex);
797+
this.grid.navigation.performShiftTabKey(this.row.nativeElement, this.selectionNode);
777798
} else {
778-
this.grid.navigation.performTab(this.row.nativeElement, this.rowIndex, this.visibleColumnIndex);
799+
this.grid.navigation.performTab(this.row.nativeElement, this.selectionNode);
779800
}
780801
}
781802

782803
protected handleEnd(ctrl: boolean) {
783804
if (ctrl) {
784805
this.grid.navigation.goToLastCell();
785806
} else {
786-
this.grid.navigation.onKeydownEnd(this.rowIndex);
807+
this.grid.navigation.onKeydownEnd(this.rowIndex, false, this.rowStart);
787808
}
788809
}
789810

790811
protected handleHome(ctrl: boolean) {
791812
if (ctrl) {
792813
this.grid.navigation.goToFirstCell();
793814
} else {
794-
this.grid.navigation.onKeydownHome(this.rowIndex);
815+
this.grid.navigation.onKeydownHome(this.rowIndex, false, this.rowStart);
795816
}
796817
}
797818

@@ -865,34 +886,34 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
865886
case 'arrowleft':
866887
case 'left':
867888
if (ctrl) {
868-
this.grid.navigation.onKeydownHome(node.row);
889+
this.grid.navigation.onKeydownHome(node.row, false, this.rowStart);
869890
break;
870891
}
871-
this.grid.navigation.onKeydownArrowLeft(this.nativeElement, node.row, node.column);
892+
this.grid.navigation.onKeydownArrowLeft(this.nativeElement, this.selectionNode);
872893
break;
873894
case 'arrowright':
874895
case 'right':
875896
if (ctrl) {
876-
this.grid.navigation.onKeydownEnd(node.row);
897+
this.grid.navigation.onKeydownEnd(node.row, false, this.rowStart);
877898
break;
878899
}
879-
this.grid.navigation.onKeydownArrowRight(this.nativeElement, node.row, node.column);
900+
this.grid.navigation.onKeydownArrowRight(this.nativeElement, this.selectionNode);
880901
break;
881902
case 'arrowup':
882903
case 'up':
883904
if (ctrl) {
884-
this.grid.navigation.navigateTop(node.column);
905+
this.grid.navigation.navigateTop(this.visibleColumnIndex);
885906
break;
886907
}
887-
this.grid.navigation.navigateUp(this.row.nativeElement, node.row, node.column);
908+
this.grid.navigation.navigateUp(this.row.nativeElement, this.selectionNode);
888909
break;
889910
case 'arrowdown':
890911
case 'down':
891912
if (ctrl) {
892-
this.grid.navigation.navigateBottom(node.column);
913+
this.grid.navigation.navigateBottom(this.visibleColumnIndex);
893914
break;
894915
}
895-
this.grid.navigation.navigateDown(this.row.nativeElement, node.row, node.column);
916+
this.grid.navigation.navigateDown(this.row.nativeElement, this.selectionNode);
896917
break;
897918
case 'enter':
898919
case 'f2':

0 commit comments

Comments
 (0)