@sumaris-net/ngx-components 1.20.14 → 1.20.15

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.
@@ -3477,8 +3477,10 @@
3477
3477
  var errorCode = msg ? 'msg' : 'dateRange';
3478
3478
  var error = msg ? { msg: msg } : { dateRange: true };
3479
3479
  return function (control) {
3480
- var _a;
3481
- var startControl = (_a = control.parent) === null || _a === void 0 ? void 0 : _a.get(startDateFieldName);
3480
+ // Form group not created yet: skip
3481
+ if (!control.parent)
3482
+ return null;
3483
+ var startControl = control.parent.get(startDateFieldName);
3482
3484
  if (!startControl) {
3483
3485
  console.warn("Cannot find brother control '" + startDateFieldName + "' in the parent form");
3484
3486
  return null;
@@ -3498,8 +3500,10 @@
3498
3500
  var errorCode = msg ? 'msg' : 'dateRange';
3499
3501
  var error = msg ? { msg: msg } : { dateRange: true };
3500
3502
  return function (control) {
3501
- var _a;
3502
- var endDateControl = (_a = control.parent) === null || _a === void 0 ? void 0 : _a.get(endDateFieldName);
3503
+ // Form group not created yet: skip
3504
+ if (!control.parent)
3505
+ return null;
3506
+ var endDateControl = control.parent.get(endDateFieldName);
3503
3507
  if (!endDateControl) {
3504
3508
  console.warn("Cannot find control '" + endDateFieldName + "' in the parent form");
3505
3509
  return null;
@@ -3520,7 +3524,13 @@
3520
3524
  // Skip if control already has some errors
3521
3525
  if (control.errors)
3522
3526
  return null;
3523
- var errors = control.parent && control.parent.errors;
3527
+ // Skip if parent form group not created yet
3528
+ if (!control.parent)
3529
+ return null;
3530
+ // Form group not created yet
3531
+ if (!control.parent)
3532
+ return null;
3533
+ var errors = control.parent.errors;
3524
3534
  // No errors, or copy all errors
3525
3535
  if (!errors || isEmptyArray(errorNames))
3526
3536
  return errors;
@@ -3725,13 +3735,13 @@
3725
3735
  */
3726
3736
  SharedFormArrayValidators.uniqueEntity = function (controlName) {
3727
3737
  return function (array) {
3728
- var e_1, _b;
3738
+ var e_1, _a;
3729
3739
  var controls = [];
3730
3740
  if (array.length) {
3731
3741
  try {
3732
3742
  // gather controls in array with valid entity
3733
- for (var _c = __values(array.controls), _d = _c.next(); !_d.done; _d = _c.next()) {
3734
- var control = _d.value;
3743
+ for (var _b = __values(array.controls), _c = _b.next(); !_c.done; _c = _b.next()) {
3744
+ var control = _c.value;
3735
3745
  var fromGroup = control;
3736
3746
  if (fromGroup.controls[controlName]) {
3737
3747
  var value = fromGroup.controls[controlName].value;
@@ -3743,7 +3753,7 @@
3743
3753
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
3744
3754
  finally {
3745
3755
  try {
3746
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
3756
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3747
3757
  }
3748
3758
  finally { if (e_1) throw e_1.error; }
3749
3759
  }
@@ -3788,12 +3798,12 @@
3788
3798
  */
3789
3799
  SharedFormArrayValidators.validSumMaxValue = function (controlName, max) {
3790
3800
  return function (array) {
3791
- var e_2, _b;
3801
+ var e_2, _a;
3792
3802
  var controls = [];
3793
3803
  if (array.length) {
3794
3804
  try {
3795
- for (var _c = __values(array.controls), _d = _c.next(); !_d.done; _d = _c.next()) {
3796
- var control = _d.value;
3805
+ for (var _b = __values(array.controls), _c = _b.next(); !_c.done; _c = _b.next()) {
3806
+ var control = _c.value;
3797
3807
  var fromGroup = control;
3798
3808
  if (fromGroup.controls[controlName] && isNotNilOrNaN(fromGroup.controls[controlName].value)) {
3799
3809
  controls.push(fromGroup.controls[controlName]);
@@ -3803,7 +3813,7 @@
3803
3813
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
3804
3814
  finally {
3805
3815
  try {
3806
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
3816
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3807
3817
  }
3808
3818
  finally { if (e_2) throw e_2.error; }
3809
3819
  }