@sumaris-net/ngx-components 2.1.5 → 2.1.7
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.
- package/esm2020/src/app/core/form/form.utils.mjs +9 -8
- package/esm2020/src/app/core/services/validator/base.validator.class.mjs +1 -1
- package/esm2020/src/app/shared/forms.mjs +4 -4
- package/fesm2015/sumaris-net.ngx-components.mjs +11 -10
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +11 -10
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.utils.d.ts +6 -2
- package/src/app/shared/forms.d.ts +3 -1
|
@@ -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,14 +4628,15 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4628
4628
|
super.patchValue(values, options);
|
|
4629
4629
|
}
|
|
4630
4630
|
}
|
|
4631
|
-
resize(length) {
|
|
4632
|
-
const
|
|
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, { emitEvent: false, ...options });
|
|
4633
4634
|
if (changes) {
|
|
4634
|
-
if (
|
|
4635
|
-
this.
|
|
4635
|
+
if (enabled) {
|
|
4636
|
+
this.enable(options);
|
|
4636
4637
|
}
|
|
4637
4638
|
else {
|
|
4638
|
-
this.
|
|
4639
|
+
this.disable(options);
|
|
4639
4640
|
}
|
|
4640
4641
|
}
|
|
4641
4642
|
}
|