@rxap/forms 12.7.0 → 12.7.1

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.
@@ -1806,10 +1806,58 @@
1806
1806
  this.submit();
1807
1807
  }
1808
1808
  else {
1809
+ function reduceErrors(control, errors) {
1810
+ var e_1, _c, e_2, _d;
1811
+ if (errors === void 0) { errors = {}; }
1812
+ if (control.invalid) {
1813
+ if (control.controls) {
1814
+ if (Array.isArray(control.controls)) {
1815
+ var errorList = [];
1816
+ try {
1817
+ for (var _e = __values(control.controls), _f = _e.next(); !_f.done; _f = _e.next()) {
1818
+ var item = _f.value;
1819
+ errorList.push(reduceErrors(item));
1820
+ }
1821
+ }
1822
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1823
+ finally {
1824
+ try {
1825
+ if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
1826
+ }
1827
+ finally { if (e_1) throw e_1.error; }
1828
+ }
1829
+ errors[control.controlId] = errorList;
1830
+ }
1831
+ else {
1832
+ var innerErrors = {};
1833
+ try {
1834
+ for (var _g = __values(Object.values(control.controls)), _h = _g.next(); !_h.done; _h = _g.next()) {
1835
+ var child = _h.value;
1836
+ reduceErrors(child, innerErrors);
1837
+ }
1838
+ }
1839
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1840
+ finally {
1841
+ try {
1842
+ if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
1843
+ }
1844
+ finally { if (e_2) throw e_2.error; }
1845
+ }
1846
+ errors[control.controlId] = innerErrors;
1847
+ }
1848
+ }
1849
+ else {
1850
+ if (control.errors) {
1851
+ errors[control.controlId] = control.errors;
1852
+ }
1853
+ }
1854
+ }
1855
+ return errors;
1856
+ }
1809
1857
  if (i0.isDevMode()) {
1810
1858
  console.log('Form submit is not valid for: ' + this.form.controlId, this.form.errors);
1811
1859
  function printErrorControls(control) {
1812
- var e_1, _c, e_2, _d;
1860
+ var e_3, _c, e_4, _d;
1813
1861
  if (!control.valid) {
1814
1862
  console.group(control.controlId);
1815
1863
  if (control.controls) {
@@ -1830,12 +1878,12 @@
1830
1878
  printErrorControls(child);
1831
1879
  }
1832
1880
  }
1833
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1881
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1834
1882
  finally {
1835
1883
  try {
1836
1884
  if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
1837
1885
  }
1838
- finally { if (e_1) throw e_1.error; }
1886
+ finally { if (e_3) throw e_3.error; }
1839
1887
  }
1840
1888
  }
1841
1889
  }
@@ -1849,12 +1897,12 @@
1849
1897
  console.groupEnd();
1850
1898
  }
1851
1899
  }
1852
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1900
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1853
1901
  finally {
1854
1902
  try {
1855
1903
  if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
1856
1904
  }
1857
- finally { if (e_2) throw e_2.error; }
1905
+ finally { if (e_4) throw e_4.error; }
1858
1906
  }
1859
1907
  }
1860
1908
  console.log('value: ', control.value);
@@ -1864,7 +1912,7 @@
1864
1912
  }
1865
1913
  printErrorControls(this.form);
1866
1914
  }
1867
- this.invalidSubmit.emit();
1915
+ this.invalidSubmit.emit(reduceErrors(this.form));
1868
1916
  }
1869
1917
  return false;
1870
1918
  };