igniteui-angular 14.2.3 → 14.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/grids/cell.component.mjs +4 -4
- package/esm2020/lib/grids/common/crud.service.mjs +27 -4
- package/esm2020/lib/grids/grid/grid-validation.service.mjs +2 -1
- package/esm2020/lib/grids/grid-base.directive.mjs +3 -1
- package/fesm2015/igniteui-angular.mjs +32 -6
- package/fesm2015/igniteui-angular.mjs.map +1 -1
- package/fesm2020/igniteui-angular.mjs +32 -6
- package/fesm2020/igniteui-angular.mjs.map +1 -1
- package/lib/grids/common/crud.service.d.ts +5 -2
- package/package.json +1 -1
|
@@ -24091,16 +24091,33 @@ class IgxAddRow extends IgxEditRow {
|
|
|
24091
24091
|
}
|
|
24092
24092
|
}
|
|
24093
24093
|
class IgxCell {
|
|
24094
|
-
constructor(id, rowIndex, column, value,
|
|
24094
|
+
constructor(id, rowIndex, column, value, _editValue, rowData, grid) {
|
|
24095
24095
|
this.id = id;
|
|
24096
24096
|
this.rowIndex = rowIndex;
|
|
24097
24097
|
this.column = column;
|
|
24098
24098
|
this.value = value;
|
|
24099
|
-
this.
|
|
24099
|
+
this._editValue = _editValue;
|
|
24100
24100
|
this.rowData = rowData;
|
|
24101
24101
|
this.grid = grid;
|
|
24102
24102
|
this.grid.validation.create(id.rowID, rowData);
|
|
24103
24103
|
}
|
|
24104
|
+
get editValue() {
|
|
24105
|
+
const formControl = this.grid.validation.getFormControl(this.id.rowID, this.column.field);
|
|
24106
|
+
if (formControl) {
|
|
24107
|
+
return formControl.value;
|
|
24108
|
+
}
|
|
24109
|
+
}
|
|
24110
|
+
set editValue(value) {
|
|
24111
|
+
const formControl = this.grid.validation.getFormControl(this.id.rowID, this.column.field);
|
|
24112
|
+
if (this.grid.validationTrigger === 'change') {
|
|
24113
|
+
// in case trigger is change, mark as touched.
|
|
24114
|
+
formControl.setValue(value);
|
|
24115
|
+
formControl.markAsTouched();
|
|
24116
|
+
}
|
|
24117
|
+
else {
|
|
24118
|
+
this.pendingValue = value;
|
|
24119
|
+
}
|
|
24120
|
+
}
|
|
24104
24121
|
castToNumber(value) {
|
|
24105
24122
|
if (this.column.dataType === 'number' && !this.column.inlineEditorTemplate) {
|
|
24106
24123
|
const v = parseFloat(value);
|
|
@@ -24185,6 +24202,12 @@ class IgxCellCrudState {
|
|
|
24185
24202
|
if (!this.cell) {
|
|
24186
24203
|
return;
|
|
24187
24204
|
}
|
|
24205
|
+
const formControl = this.grid.validation.getFormControl(this.cell.id.rowID, this.cell.column.field);
|
|
24206
|
+
if (this.grid.validationTrigger === 'blur' && this.cell.pendingValue !== undefined) {
|
|
24207
|
+
// in case trigger is blur, update value if there's a pending one and mark as touched.
|
|
24208
|
+
formControl.setValue(this.cell.pendingValue);
|
|
24209
|
+
formControl.markAsTouched();
|
|
24210
|
+
}
|
|
24188
24211
|
if (this.grid.validationTrigger === 'blur') {
|
|
24189
24212
|
this.grid.tbody.nativeElement.focus({ preventScroll: true });
|
|
24190
24213
|
}
|
|
@@ -24572,11 +24595,11 @@ class IgxGridCRUDService extends IgxRowAddCrudState {
|
|
|
24572
24595
|
}
|
|
24573
24596
|
}
|
|
24574
24597
|
else {
|
|
24598
|
+
this.exitCellEdit(event);
|
|
24575
24599
|
if (!this.grid.rowEditable && this.cell) {
|
|
24576
24600
|
const value = this.grid.transactions.getAggregatedValue(this.cell.id.rowID, true) || this.cell.rowData;
|
|
24577
24601
|
this.grid.validation.update(this.cell.id.rowID, value);
|
|
24578
24602
|
}
|
|
24579
|
-
this.exitCellEdit(event);
|
|
24580
24603
|
}
|
|
24581
24604
|
args = this.updateRow(commit, event);
|
|
24582
24605
|
this.rowEditingBlocked = args.cancel;
|
|
@@ -59583,6 +59606,7 @@ class IgxGridValidationService {
|
|
|
59583
59606
|
const value = resolveNestedPath(data || {}, col.field);
|
|
59584
59607
|
const field = this.getFieldKey(col.field);
|
|
59585
59608
|
const control = new FormControl(value, { updateOn: this.grid.validationTrigger });
|
|
59609
|
+
control.setValue(value);
|
|
59586
59610
|
control.addValidators(col.validators);
|
|
59587
59611
|
formGroup.addControl(field, control);
|
|
59588
59612
|
}
|
|
@@ -64123,6 +64147,8 @@ class IgxGridBaseDirective extends DisplayDensityBase {
|
|
|
64123
64147
|
rowIndex: index
|
|
64124
64148
|
};
|
|
64125
64149
|
const cell = new IgxCell(id, index, col, rowData[col.field], value, rowData, this);
|
|
64150
|
+
const formControl = this.validation.getFormControl(cell.id.rowID, cell.column.field);
|
|
64151
|
+
formControl.setValue(value);
|
|
64126
64152
|
this.gridAPI.update_cell(cell);
|
|
64127
64153
|
this.cdr.detectChanges();
|
|
64128
64154
|
}
|
|
@@ -68885,11 +68911,11 @@ class IgxGridCellComponent {
|
|
|
68885
68911
|
*/
|
|
68886
68912
|
ngOnChanges(changes) {
|
|
68887
68913
|
if (changes.editMode && changes.editMode.currentValue && this.formControl) {
|
|
68888
|
-
//
|
|
68914
|
+
// ensure when values change, form control is forced to be marked as touche.
|
|
68889
68915
|
this.formControl.valueChanges.pipe(takeWhile(x => this.editMode)).subscribe(value => {
|
|
68890
|
-
this.editValue = value;
|
|
68891
68916
|
this.formControl.markAsTouched();
|
|
68892
68917
|
});
|
|
68918
|
+
// while in edit mode subscribe to value changes on the current form control and set to editValue
|
|
68893
68919
|
this.formControl.statusChanges.pipe(takeWhile(x => this.editMode)).subscribe(status => {
|
|
68894
68920
|
if (status === 'INVALID' && this.errorTooltip.length > 0) {
|
|
68895
68921
|
this.cdr.detectChanges();
|
|
@@ -68958,7 +68984,6 @@ class IgxGridCellComponent {
|
|
|
68958
68984
|
cell = this.grid.crudService.createCell(this);
|
|
68959
68985
|
}
|
|
68960
68986
|
cell.editValue = val;
|
|
68961
|
-
this.formControl.setValue(val);
|
|
68962
68987
|
this.grid.gridAPI.update_cell(cell);
|
|
68963
68988
|
this.grid.crudService.endCellEdit();
|
|
68964
68989
|
this.cdr.markForCheck();
|
|
@@ -68999,6 +69024,7 @@ class IgxGridCellComponent {
|
|
|
68999
69024
|
this.grid.navigation.setActiveNode({ row: this.rowIndex, column: this.visibleColumnIndex });
|
|
69000
69025
|
const isTargetErrorIcon = event && event.target && event.target === this.errorIcon?.el.nativeElement;
|
|
69001
69026
|
if (this.isInvalid && !isTargetErrorIcon) {
|
|
69027
|
+
this.cdr.detectChanges();
|
|
69002
69028
|
this.openErrorTooltip();
|
|
69003
69029
|
this.grid.activeNodeChange.pipe(first$1()).subscribe(() => {
|
|
69004
69030
|
this.closeErrorTooltip();
|