@sumaris-net/ngx-components 2.4.2 → 2.4.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.
@@ -4641,7 +4641,7 @@ class AppFormArray extends UntypedFormArray {
4641
4641
  */
4642
4642
  setValue(values, options) {
4643
4643
  if (values === undefined)
4644
- throw new Error('\'undefined\' value not allowed in AppFormArray.setValue()');
4644
+ throw new Error('\'undefined\' value not allowed in AppFormArray.setValue(). Use \'null\' or \'[]\' to clear the array');
4645
4645
  if (this.options.allowReuseControls === false) {
4646
4646
  const disabled = this.disabled;
4647
4647
  // Clean all
@@ -4664,14 +4664,14 @@ class AppFormArray extends UntypedFormArray {
4664
4664
  }
4665
4665
  }
4666
4666
  patchValue(values, options) {
4667
- // /!\ From the official Angular 'FormGroup.patchValue()' :
4668
- // "Even though the `value` argument type doesn't allow `null` and `undefined` values, the
4669
- // `patchValue` can be called recursively and inner data structures might have these values, so
4670
- // we just ignore such cases when a field containing FormGroup instance receives `null` or
4671
- // `undefined` as a value."
4672
- // BUT in AppFormArray, we only ignore the `undefined` value, so `null` value will reset the array (zero length).
4673
- if (values === undefined)
4674
- return;
4667
+ // --- /!\ From official Angular doc of 'FormGroup.patchValue()' :
4668
+ // Even though the `value` argument type doesn't allow `null` and `undefined` values, the
4669
+ // `patchValue` can be called recursively and inner data structures might have these values, so
4670
+ // we just ignore such cases when a field containing FormGroup instance receives `null` or
4671
+ // `undefined` as a value.
4672
+ // ---
4673
+ if (values == null)
4674
+ return; // Ignore
4675
4675
  if (this.options.allowReuseControls === false) {
4676
4676
  const disabled = this.disabled;
4677
4677
  // Clean all