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.
@@ -23656,16 +23656,33 @@ class IgxAddRow extends IgxEditRow {
23656
23656
  }
23657
23657
  }
23658
23658
  class IgxCell {
23659
- constructor(id, rowIndex, column, value, editValue, rowData, grid) {
23659
+ constructor(id, rowIndex, column, value, _editValue, rowData, grid) {
23660
23660
  this.id = id;
23661
23661
  this.rowIndex = rowIndex;
23662
23662
  this.column = column;
23663
23663
  this.value = value;
23664
- this.editValue = editValue;
23664
+ this._editValue = _editValue;
23665
23665
  this.rowData = rowData;
23666
23666
  this.grid = grid;
23667
23667
  this.grid.validation.create(id.rowID, rowData);
23668
23668
  }
23669
+ get editValue() {
23670
+ const formControl = this.grid.validation.getFormControl(this.id.rowID, this.column.field);
23671
+ if (formControl) {
23672
+ return formControl.value;
23673
+ }
23674
+ }
23675
+ set editValue(value) {
23676
+ const formControl = this.grid.validation.getFormControl(this.id.rowID, this.column.field);
23677
+ if (this.grid.validationTrigger === 'change') {
23678
+ // in case trigger is change, mark as touched.
23679
+ formControl.setValue(value);
23680
+ formControl.markAsTouched();
23681
+ }
23682
+ else {
23683
+ this.pendingValue = value;
23684
+ }
23685
+ }
23669
23686
  castToNumber(value) {
23670
23687
  if (this.column.dataType === 'number' && !this.column.inlineEditorTemplate) {
23671
23688
  const v = parseFloat(value);
@@ -23750,6 +23767,12 @@ class IgxCellCrudState {
23750
23767
  if (!this.cell) {
23751
23768
  return;
23752
23769
  }
23770
+ const formControl = this.grid.validation.getFormControl(this.cell.id.rowID, this.cell.column.field);
23771
+ if (this.grid.validationTrigger === 'blur' && this.cell.pendingValue !== undefined) {
23772
+ // in case trigger is blur, update value if there's a pending one and mark as touched.
23773
+ formControl.setValue(this.cell.pendingValue);
23774
+ formControl.markAsTouched();
23775
+ }
23753
23776
  if (this.grid.validationTrigger === 'blur') {
23754
23777
  this.grid.tbody.nativeElement.focus({ preventScroll: true });
23755
23778
  }
@@ -24141,11 +24164,11 @@ class IgxGridCRUDService extends IgxRowAddCrudState {
24141
24164
  }
24142
24165
  }
24143
24166
  else {
24167
+ this.exitCellEdit(event);
24144
24168
  if (!this.grid.rowEditable && this.cell) {
24145
24169
  const value = this.grid.transactions.getAggregatedValue(this.cell.id.rowID, true) || this.cell.rowData;
24146
24170
  this.grid.validation.update(this.cell.id.rowID, value);
24147
24171
  }
24148
- this.exitCellEdit(event);
24149
24172
  }
24150
24173
  args = this.updateRow(commit, event);
24151
24174
  this.rowEditingBlocked = args.cancel;
@@ -59331,6 +59354,7 @@ class IgxGridValidationService {
59331
59354
  const value = resolveNestedPath(data || {}, col.field);
59332
59355
  const field = this.getFieldKey(col.field);
59333
59356
  const control = new FormControl(value, { updateOn: this.grid.validationTrigger });
59357
+ control.setValue(value);
59334
59358
  control.addValidators(col.validators);
59335
59359
  formGroup.addControl(field, control);
59336
59360
  }
@@ -63902,6 +63926,8 @@ class IgxGridBaseDirective extends DisplayDensityBase {
63902
63926
  rowIndex: index
63903
63927
  };
63904
63928
  const cell = new IgxCell(id, index, col, rowData[col.field], value, rowData, this);
63929
+ const formControl = this.validation.getFormControl(cell.id.rowID, cell.column.field);
63930
+ formControl.setValue(value);
63905
63931
  this.gridAPI.update_cell(cell);
63906
63932
  this.cdr.detectChanges();
63907
63933
  }
@@ -68678,11 +68704,11 @@ class IgxGridCellComponent {
68678
68704
  */
68679
68705
  ngOnChanges(changes) {
68680
68706
  if (changes.editMode && changes.editMode.currentValue && this.formControl) {
68681
- // while in edit mode subscribe to value changes on the current form control and set to editValue
68707
+ // ensure when values change, form control is forced to be marked as touche.
68682
68708
  this.formControl.valueChanges.pipe(takeWhile(x => this.editMode)).subscribe(value => {
68683
- this.editValue = value;
68684
68709
  this.formControl.markAsTouched();
68685
68710
  });
68711
+ // while in edit mode subscribe to value changes on the current form control and set to editValue
68686
68712
  this.formControl.statusChanges.pipe(takeWhile(x => this.editMode)).subscribe(status => {
68687
68713
  if (status === 'INVALID' && this.errorTooltip.length > 0) {
68688
68714
  this.cdr.detectChanges();
@@ -68751,7 +68777,6 @@ class IgxGridCellComponent {
68751
68777
  cell = this.grid.crudService.createCell(this);
68752
68778
  }
68753
68779
  cell.editValue = val;
68754
- this.formControl.setValue(val);
68755
68780
  this.grid.gridAPI.update_cell(cell);
68756
68781
  this.grid.crudService.endCellEdit();
68757
68782
  this.cdr.markForCheck();
@@ -68793,6 +68818,7 @@ class IgxGridCellComponent {
68793
68818
  this.grid.navigation.setActiveNode({ row: this.rowIndex, column: this.visibleColumnIndex });
68794
68819
  const isTargetErrorIcon = event && event.target && event.target === ((_a = this.errorIcon) === null || _a === void 0 ? void 0 : _a.el.nativeElement);
68795
68820
  if (this.isInvalid && !isTargetErrorIcon) {
68821
+ this.cdr.detectChanges();
68796
68822
  this.openErrorTooltip();
68797
68823
  this.grid.activeNodeChange.pipe(first$1()).subscribe(() => {
68798
68824
  this.closeErrorTooltip();