Skip to content

Commit dc7ed67

Browse files
committed
Merges target and resolvers merge conflicts
2 parents 9439571 + 5344c3c commit dc7ed67

32 files changed

+429
-398
lines changed

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class IgxGridEditingActionsComponent extends IgxGridActionsBaseDirective
149149
console.warn('The grid must use row edit mode to perform row adding! Please set rowEditable to true.');
150150
return;
151151
}
152-
grid.beginAddRowByIndex(context.rowID, context.index, asChild, event);
152+
grid.gridAPI.crudService.enterAddRowMode(context, asChild, event);
153153
this.strip.hide();
154154
}
155155

projects/igniteui-angular/src/lib/directives/input/input.directive.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,16 @@ describe('IgxInput', () => {
521521
fixture.detectChanges();
522522
const igxInput = fixture.componentInstance.strIgxInput;
523523

524+
expect(igxInput.disabled).toBe(false);
525+
expect(igxInput.inputGroup.disabled).toBe(false);
526+
524527
fixture.componentInstance.form.disable();
525528
expect(igxInput.disabled).toBe(true);
529+
expect(igxInput.inputGroup.disabled).toBe(true);
526530

527531
fixture.componentInstance.form.get('str').enable();
528532
expect(igxInput.disabled).toBe(false);
533+
expect(igxInput.inputGroup.disabled).toBe(false);
529534
}));
530535

531536
it('should style input when required is toggled dynamically.', () => {

projects/igniteui-angular/src/lib/directives/input/input.directive.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ export class IgxInputDirective implements AfterViewInit, OnDestroy {
174174
* ```
175175
*/
176176
public get disabled() {
177-
if (this.ngControl && this.ngControl.disabled !== null) {
178-
return this.ngControl.disabled;
179-
}
180177
return this._disabled;
181178
}
182179

@@ -268,6 +265,10 @@ export class IgxInputDirective implements AfterViewInit, OnDestroy {
268265
this.inputGroup.hasPlaceholder = this.nativeElement.hasAttribute(
269266
'placeholder'
270267
);
268+
269+
if (this.ngControl && this.ngControl.disabled !== null) {
270+
this.disabled = this.ngControl.disabled;
271+
}
271272
this.inputGroup.disabled =
272273
this.inputGroup.disabled ||
273274
this.nativeElement.hasAttribute('disabled');
@@ -352,8 +353,8 @@ export class IgxInputDirective implements AfterViewInit, OnDestroy {
352353
if (!this.disabled && (this.ngControl.control.touched || this.ngControl.control.dirty)) {
353354
// the control is not disabled and is touched or dirty
354355
this._valid = this.ngControl.invalid ?
355-
IgxInputState.INVALID : this.focused ? IgxInputState.VALID :
356-
IgxInputState.INITIAL;
356+
IgxInputState.INVALID : this.focused ? IgxInputState.VALID :
357+
IgxInputState.INITIAL;
357358
} else {
358359
// if control is untouched, pristine, or disabled its state is initial. This is when user did not interact
359360
// with the input or when form/control is reset
@@ -459,8 +460,8 @@ export class IgxInputDirective implements AfterViewInit, OnDestroy {
459460
private checkNativeValidity() {
460461
if (!this.disabled && this._hasValidators()) {
461462
this._valid = this.nativeElement.checkValidity() ?
462-
this.focused ? IgxInputState.VALID : IgxInputState.INITIAL :
463-
IgxInputState.INVALID;
463+
this.focused ? IgxInputState.VALID : IgxInputState.INITIAL :
464+
IgxInputState.INVALID;
464465
}
465466
}
466467

projects/igniteui-angular/src/lib/grids/api.service.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { IgxGridBaseDirective } from './grid-base.directive';
88
import { IgxRowDirective } from './row.directive';
99
import { IFilteringExpressionsTree } from '../data-operations/filtering-expressions-tree';
1010
import { Transaction, TransactionType, State } from '../services/transaction/transaction';
11-
import { IgxCell, IgxGridCRUDService, IgxRow } from './common/crud.service';
11+
import { IgxCell, IgxGridCRUDService, IgxEditRow } from './common/crud.service';
1212
import { GridType } from './common/grid.interface';
1313
import { ColumnType } from './common/column.interface';
1414
import { IGridEditEventArgs, IRowToggleEventArgs } from './common/events';
@@ -122,23 +122,6 @@ export class GridBaseAPIService<T extends IgxGridBaseDirective & GridType> {
122122
}
123123
}
124124

125-
public update_add_cell(cell: IgxCell): IGridEditEventArgs {
126-
if (!cell) {
127-
return;
128-
}
129-
130-
const args = cell.createEditEventArgs(true);
131-
132-
const data = cell.rowData;
133-
if (cell.column.hasNestedPath) {
134-
mergeObjects(data, reverseMapper(cell.column.field, args.newValue));
135-
} else {
136-
data[cell.column.field] = args.newValue;
137-
}
138-
mergeObjects(this.crudService.row.data, data);
139-
return args;
140-
}
141-
142125
public update_cell(cell: IgxCell): IGridEditEventArgs {
143126
if (!cell) {
144127
return;
@@ -167,7 +150,7 @@ export class GridBaseAPIService<T extends IgxGridBaseDirective & GridType> {
167150
}
168151

169152
// TODO: CRUD refactor to not emit editing evts.
170-
public update_row(row: IgxRow, value: any, event?: Event) {
153+
public update_row(row: IgxEditRow, value: any, event?: Event) {
171154
const grid = this.grid;
172155
const selected = grid.selectionService.isRowSelected(row.id);
173156
const rowInEditMode = this.crudService.row;
@@ -270,10 +253,11 @@ export class GridBaseAPIService<T extends IgxGridBaseDirective & GridType> {
270253
return this.grid.filteredData;
271254
}
272255

273-
public addRowToData(rowData: any, _parentRowID?) {
256+
public addRowToData(rowData: any, parentID?) {
274257
// Add row goes to transactions and if rowEditable is properly implemented, added rows will go to pending transactions
275258
// If there is a row in edit - > commit and close
276259
const grid = this.grid;
260+
277261
if (grid.transactions.enabled) {
278262
const transactionId = grid.primaryKey ? rowData[grid.primaryKey] : rowData;
279263
const transaction: Transaction = { id: transactionId, type: TransactionType.ADD, newValue: rowData };

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

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
5858
*/
5959
@HostBinding('class.igx-grid__td--new')
6060
public get isEmptyAddRowCell() {
61-
return this.intRow.addRow && (this.value === undefined || this.value === null);
61+
return this.intRow.addRowUI && (this.value === undefined || this.value === null);
6262
}
6363

6464
/**
@@ -195,7 +195,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
195195
if (this.cellTemplate) {
196196
return this.cellTemplate;
197197
}
198-
if (this.grid.rowEditable && this.intRow.addRow) {
198+
if (this.grid.rowEditable && this.intRow.addRowUI) {
199199
return this.addRowCellTemplate;
200200
}
201201
return this.defaultCellTemplate;
@@ -984,11 +984,8 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
984984

985985
if (this.editable && editMode && !this.intRow.deleted) {
986986
if (editableCell) {
987-
if (this.intRow.addRow) {
988-
editableArgs = this.grid.crudService.updateAddCell(false, event);
989-
} else {
990-
editableArgs = this.grid.crudService.updateCell(false, event);
991-
}
987+
editableArgs = this.grid.crudService.updateCell(false, event);
988+
992989
/* This check is related with the following issue #6517:
993990
* when edit cell that belongs to a column which is sorted and press tab,
994991
* the next cell in edit mode is with wrong value /its context is not updated/;
@@ -1013,16 +1010,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
10131010
}
10141011

10151012
if (editableCell && crud.sameRow(this.cellID.rowID)) {
1016-
if (this.intRow.addRow) {
1017-
const args = this.grid.crudService.updateAddCell(false, event);
1018-
if (args.cancel) {
1019-
this.grid.crudService.endAddRow();
1020-
} else {
1021-
this.grid.crudService.exitCellEdit(event);
1022-
}
1023-
} else {
1024-
this.grid.crudService.updateCell(true, event);
1025-
}
1013+
this.grid.crudService.updateCell(true, event);
10261014
} else if (editMode && !crud.sameRow(this.cellID.rowID)) {
10271015
this.grid.crudService.endEdit(true, event);
10281016
}

0 commit comments

Comments
 (0)