From a7ef9f0570a6ca23c45acff4447a2c3f2abd61ea Mon Sep 17 00:00:00 2001 From: Deyan Kamburov Date: Wed, 28 Nov 2018 18:31:08 +0200 Subject: [PATCH 1/3] fix(igxCell): Use value instead of ngModel (#2958) --- projects/igniteui-angular/src/lib/grids/cell.component.html | 4 ++-- .../src/lib/grids/tree-grid/tree-cell.component.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/igniteui-angular/src/lib/grids/cell.component.html b/projects/igniteui-angular/src/lib/grids/cell.component.html index 0e2b0585b9d..334d4de5208 100644 --- a/projects/igniteui-angular/src/lib/grids/cell.component.html +++ b/projects/igniteui-angular/src/lib/grids/cell.component.html @@ -19,10 +19,10 @@ - + - + diff --git a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-cell.component.html b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-cell.component.html index 0181a7e3687..41c0110894a 100644 --- a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-cell.component.html +++ b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-cell.component.html @@ -19,10 +19,10 @@ - + - + From 124660a25b43640c2e42ee406f9ca66b7d02fc22 Mon Sep 17 00:00:00 2001 From: Deyan Kamburov Date: Thu, 29 Nov 2018 13:56:18 +0200 Subject: [PATCH 2/3] fix(igxCell): Expose and use getter and setter for editValue (#2958) --- .../src/lib/grids/cell.component.html | 8 ++--- .../src/lib/grids/cell.component.ts | 35 +++++++++++++++---- .../grids/tree-grid/tree-cell.component.html | 8 ++--- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/projects/igniteui-angular/src/lib/grids/cell.component.html b/projects/igniteui-angular/src/lib/grids/cell.component.html index 334d4de5208..6e7ed682f65 100644 --- a/projects/igniteui-angular/src/lib/grids/cell.component.html +++ b/projects/igniteui-angular/src/lib/grids/cell.component.html @@ -10,19 +10,19 @@ - + - + - + - + diff --git a/projects/igniteui-angular/src/lib/grids/cell.component.ts b/projects/igniteui-angular/src/lib/grids/cell.component.ts index ae23c7e66e1..647f444ba73 100644 --- a/projects/igniteui-angular/src/lib/grids/cell.component.ts +++ b/projects/igniteui-angular/src/lib/grids/cell.component.ts @@ -288,11 +288,11 @@ export class IgxGridCellComponent implements OnInit, AfterViewInit { return; } if (this.column.editable && value) { - this.editValue = this.value; this.gridAPI.set_cell_inEditMode(this.gridID, this); if (this.highlight && this.grid.lastSearchInfo.searchText) { this.highlight.observe(); } + this.editValue = this.value; } else { this.gridAPI.escape_editMode(this.gridID, this.cellID); } @@ -482,9 +482,30 @@ export class IgxGridCellComponent implements OnInit, AfterViewInit { private highlight: IgxTextHighlightDirective; /** - * @hidden + * Sets the current edit value while a cell is in edit mode. + * Only for cell editing mode. + * ```typescript + * let isLastPinned = this.cell.isLastPinned; + * ``` + * @memberof IgxGridCellComponent */ - public editValue; + public set editValue(value) { + if (this.gridAPI.get_cell_inEditMode(this.gridID)) { + this.gridAPI.get_cell_inEditMode(this.gridID).cell.editValue = value; + } + } + + /** + * Gets the current edit value while a cell is in edit mode. + * Only for cell editing mode. + * ```typescript + * let editValue = this.cell.editValue; + * ``` + * @memberof IgxGridCellComponent + */ + public get editValue() { + return this.gridAPI.get_cell_inEditMode(this.gridID).cell.editValue; + } public focused = false; protected isSelected = false; private cellSelectionID: string; @@ -704,7 +725,7 @@ export class IgxGridCellComponent implements OnInit, AfterViewInit { const column = this.gridAPI.get(this.gridID).columns[editCell.cellID.columnID]; if (column.inlineEditorTemplate === undefined && ( - (column.dataType === DataType.Boolean && (key !== KEYS.SPACE && key !== KEYS.SPACE_IE)) + (column.dataType === DataType.Boolean && (key !== KEYS.SPACE && key !== KEYS.SPACE_IE)) || column.dataType === DataType.Date)) { event.preventDefault(); } @@ -727,11 +748,11 @@ export class IgxGridCellComponent implements OnInit, AfterViewInit { (this.gridAPI as any).trigger_row_expansion_toggle( this.gridID, this.row.treeRow, !this.row.expanded, event, this.visibleColumnIndex); } - return; + return; } } - const args = {cell: this, groupRow: null, event: event, cancel: false }; + const args = { cell: this, groupRow: null, event: event, cancel: false }; this.grid.onFocusChange.emit(args); if (args.cancel) { return; @@ -904,7 +925,7 @@ export class IgxGridCellComponent implements OnInit, AfterViewInit { */ public calculateSizeToFit(range: any): number { return Math.max(...Array.from(this.nativeElement.children) - .map((child) => getNodeSizeViaRange(range, child))); + .map((child) => getNodeSizeViaRange(range, child))); } private isToggleKey(key) { diff --git a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-cell.component.html b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-cell.component.html index 41c0110894a..77dc101da33 100644 --- a/projects/igniteui-angular/src/lib/grids/tree-grid/tree-cell.component.html +++ b/projects/igniteui-angular/src/lib/grids/tree-grid/tree-cell.component.html @@ -10,19 +10,19 @@ - + - + - + - + From a9b72a31657e179c87c7793474337a2835f58271 Mon Sep 17 00:00:00 2001 From: Deyan Kamburov Date: Thu, 29 Nov 2018 14:22:43 +0200 Subject: [PATCH 3/3] chore(igxCell): Fix failing test --- projects/igniteui-angular/src/lib/grids/cell.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/igniteui-angular/src/lib/grids/cell.component.html b/projects/igniteui-angular/src/lib/grids/cell.component.html index 6e7ed682f65..b24af170912 100644 --- a/projects/igniteui-angular/src/lib/grids/cell.component.html +++ b/projects/igniteui-angular/src/lib/grids/cell.component.html @@ -19,7 +19,7 @@ - +