@nova-ui/dashboards 11.11.0-3115 → 11.12.0-3165

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.
@@ -11170,6 +11170,12 @@
11170
11170
  cols.controls = columns.map(function (c) {
11171
11171
  var fc = new forms.FormControl(c);
11172
11172
  fc.setParent(cols);
11173
+ // Nova's markAsTouched function gets attached to formControl during init of TableColumnConfigurationComponent,
11174
+ // must be pass to newly created formControl here otherwise gets lost and column validation doesn't get triggered.
11175
+ var colControl = cols.controls.find(function (cControl) { return cControl.value.id === c.id; });
11176
+ if (colControl) {
11177
+ fc.markAsTouched = colControl.markAsTouched;
11178
+ }
11173
11179
  return fc;
11174
11180
  });
11175
11181
  cols.updateValueAndValidity({ emitEvent: emitEvent });
@@ -13352,15 +13358,21 @@
13352
13358
  var templateObject_1$e;
13353
13359
 
13354
13360
  /**
13355
- * Checks whether given form has a field that should be visually marked as invalid
13361
+ * Checks whether given form has a field that should be visually marked as invalid.
13362
+ * Form is not in an error state if it's untouched even if it's invalid at that moment,
13363
+ * a user must first interact with the form before it can be considered as invalid.
13364
+ * 'invalid' form property should not be used for the purpose of this function,
13365
+ * it can be affected by its children form statuses, which can be considered as valid (untouched).
13356
13366
  *
13357
13367
  * @param parent
13358
13368
  */
13359
13369
  function hasControlInErrorState(parent) {
13360
13370
  var e_1, _a;
13371
+ // FormGroup/FormArray/FormControl is not in an error state if it's either valid or untouched
13361
13372
  if (parent.valid || parent.untouched) {
13362
13373
  return false;
13363
13374
  }
13375
+ // FormGroup is considred valid if every child form is either valid or untouched
13364
13376
  if (parent instanceof forms.FormGroup) {
13365
13377
  try {
13366
13378
  for (var _b = __values(Object.keys(parent.controls)), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -13379,6 +13391,7 @@
13379
13391
  finally { if (e_1) throw e_1.error; }
13380
13392
  }
13381
13393
  }
13394
+ // FormArray is considred valid if every child form is either valid or untouched
13382
13395
  if (parent instanceof forms.FormArray) {
13383
13396
  for (var i = 0; i < parent.length; i++) {
13384
13397
  var control = parent.at(i);
@@ -13387,7 +13400,8 @@
13387
13400
  }
13388
13401
  }
13389
13402
  }
13390
- return ((parent.touched || parent.dirty) && parent.invalid);
13403
+ // Errors property contains only errors related to the currecnt form and it's not affected by any child forms
13404
+ return ((parent.touched || parent.dirty) && !!parent.errors);
13391
13405
  }
13392
13406
 
13393
13407
  var WidgetEditorAccordionFormStatePipe = /** @class */ (function () {