@sumaris-net/ngx-components 2.1.4 → 2.1.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.
@@ -4228,18 +4228,18 @@ function initArrayControlsFromValues(formArray, createControl, defaultValues, op
4228
4228
  });
4229
4229
  return hasChanged;
4230
4230
  }
4231
- function resizeArray(arrayControl, createControl, length) {
4231
+ function resizeArray(arrayControl, createControl, length, options) {
4232
4232
  const hasChanged = arrayControl.length !== length;
4233
4233
  // Increase size
4234
4234
  if (arrayControl.length < length) {
4235
4235
  while (arrayControl.length < length) {
4236
- arrayControl.push(createControl());
4236
+ arrayControl.push(createControl(), options);
4237
4237
  }
4238
4238
  }
4239
4239
  // Or reduce
4240
4240
  else if (arrayControl.length > length) {
4241
4241
  while (arrayControl.length > length) {
4242
- arrayControl.removeAt(arrayControl.length - 1);
4242
+ arrayControl.removeAt(arrayControl.length - 1, options);
4243
4243
  }
4244
4244
  }
4245
4245
  return hasChanged;
@@ -4522,8 +4522,8 @@ class FormArrayHelper {
4522
4522
  return removeValueInArray(this._formArray, this.isEmpty, index);
4523
4523
  }
4524
4524
  }
4525
- resize(length) {
4526
- return resizeArray(this._formArray, this.createControl, length);
4525
+ resize(length, options) {
4526
+ return resizeArray(this._formArray, this.createControl, length, options);
4527
4527
  }
4528
4528
  clearAt(index) {
4529
4529
  return clearValueInArray(this._formArray, this.isEmpty, index);
@@ -4628,23 +4628,24 @@ class AppFormArray extends UntypedFormArray {
4628
4628
  super.patchValue(values, options);
4629
4629
  }
4630
4630
  }
4631
- resize(length) {
4632
- const changes = resizeArray(this, this.createControl, length);
4631
+ resize(length, options) {
4632
+ const enabled = this.enabled; // Save enabled here, because update can occur from resizeArray()
4633
+ const changes = resizeArray(this, this.createControl, length, options);
4633
4634
  if (changes) {
4634
- if (this.enabled) {
4635
- this.controls.filter(c => c.disabled).forEach(c => c.enable());
4635
+ if (enabled) {
4636
+ this.enable(options);
4636
4637
  }
4637
4638
  else {
4638
- this.controls.filter(c => c.enabled).forEach(c => c.disable());
4639
+ this.disable(options);
4639
4640
  }
4640
4641
  }
4641
4642
  }
4642
4643
  disable(opts) {
4643
- this.disable(opts);
4644
+ super.disable(opts);
4644
4645
  this.controls.forEach(c => c.disable(opts));
4645
4646
  }
4646
4647
  enable(opts) {
4647
- this.enable(opts);
4648
+ super.enable(opts);
4648
4649
  this.controls.forEach(c => c.enable(opts));
4649
4650
  }
4650
4651
  forEach(ite) {