@firestitch/form 12.4.5 → 12.4.6
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.
|
@@ -1435,6 +1435,14 @@
|
|
|
1435
1435
|
var renderer = this.renderer2;
|
|
1436
1436
|
var wrapper = this.getWrapperElement();
|
|
1437
1437
|
var error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
|
|
1438
|
+
var shouldErrorBeRendered = this.ngControl.invalid
|
|
1439
|
+
&& (this.ngControl.dirty || ((_a = this.formDirective.ngForm) === null || _a === void 0 ? void 0 : _a.submitted));
|
|
1440
|
+
if (shouldErrorBeRendered && error) {
|
|
1441
|
+
wrapper.classList.add('ng-invalid', 'ng-dirty');
|
|
1442
|
+
}
|
|
1443
|
+
else {
|
|
1444
|
+
wrapper.classList.remove('ng-invalid');
|
|
1445
|
+
}
|
|
1438
1446
|
if (!this.getMessageSelector()) {
|
|
1439
1447
|
return;
|
|
1440
1448
|
}
|
|
@@ -1466,13 +1474,9 @@
|
|
|
1466
1474
|
if (errorWrapper) {
|
|
1467
1475
|
errorWrapper.remove();
|
|
1468
1476
|
}
|
|
1469
|
-
wrapper.classList.remove('ng-invalid');
|
|
1470
|
-
var shouldErrorBeRendered = this.ngControl.invalid
|
|
1471
|
-
&& (this.ngControl.dirty || ((_a = this.formDirective.ngForm) === null || _a === void 0 ? void 0 : _a.submitted));
|
|
1472
1477
|
if (!shouldErrorBeRendered || !error) {
|
|
1473
1478
|
return;
|
|
1474
1479
|
}
|
|
1475
|
-
wrapper.classList.add('ng-invalid', 'ng-dirty');
|
|
1476
1480
|
errorWrapper = renderer.createElement('div');
|
|
1477
1481
|
renderer.addClass(errorWrapper, 'fs-form-error-target');
|
|
1478
1482
|
renderer.addClass(errorWrapper, this.appendErrorClass);
|