@lenne.tech/ng-base 14.13.1 → 14.13.3

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.
@@ -2025,14 +2025,22 @@ class FormsService {
2025
2025
  });
2026
2026
  }
2027
2027
  findInvalidControls(formGroup) {
2028
- const invalid = [];
2028
+ return this.getInvalidControl(formGroup);
2029
+ }
2030
+ getInvalidControl(formGroup, invalid) {
2031
+ let result = invalid ? [...invalid] : [];
2029
2032
  const controls = formGroup.controls;
2030
2033
  Object.keys(formGroup.controls).forEach((name) => {
2031
2034
  if (controls[name].invalid) {
2032
- invalid.push(name);
2035
+ if (controls[name]?.controls) {
2036
+ result = this.getInvalidControl(controls[name], result);
2037
+ }
2038
+ else {
2039
+ result.push(name);
2040
+ }
2033
2041
  }
2034
2042
  });
2035
- return invalid;
2043
+ return result;
2036
2044
  }
2037
2045
  scrollToInvalidControl(form) {
2038
2046
  const invalidForm = this.findInvalidControls(form)[0];