@sumaris-net/ngx-components 2.1.4-rc2 → 2.1.4-rc3
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 +19 -10
- package/esm2020/src/app/shared/forms.mjs +1 -1
- package/fesm2015/sumaris-net.ngx-components.mjs +17 -8
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +17 -8
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.utils.d.ts +5 -4
|
@@ -4631,20 +4631,29 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4631
4631
|
add(value, options) {
|
|
4632
4632
|
return pushValueInArray(this, this.createControl, this.equals, this.isEmpty, value, options);
|
|
4633
4633
|
}
|
|
4634
|
-
|
|
4635
|
-
return pushValueInArray(this, () => this.createControl(value), this.equals, this.isEmpty, value, options);
|
|
4636
|
-
}
|
|
4637
|
-
removeAt(index) {
|
|
4634
|
+
removeAt(index, options) {
|
|
4638
4635
|
// Do not remove if last criterion
|
|
4639
4636
|
if (!this._allowEmptyArray && this.length === 1) {
|
|
4640
|
-
|
|
4637
|
+
this.clearAt(index, options);
|
|
4641
4638
|
}
|
|
4642
4639
|
else {
|
|
4643
|
-
|
|
4640
|
+
super.removeAt(index, options);
|
|
4644
4641
|
}
|
|
4645
4642
|
}
|
|
4646
|
-
clearAt(index) {
|
|
4647
|
-
|
|
4643
|
+
clearAt(index, options) {
|
|
4644
|
+
const control = this.at(index);
|
|
4645
|
+
if (this.isEmpty(control.value))
|
|
4646
|
+
return; // skip (not need to clear)
|
|
4647
|
+
if (control instanceof UntypedFormGroup) {
|
|
4648
|
+
copyEntity2Form({}, control, options);
|
|
4649
|
+
}
|
|
4650
|
+
else if (control instanceof UntypedFormArray) {
|
|
4651
|
+
control.setValue([], options);
|
|
4652
|
+
}
|
|
4653
|
+
else {
|
|
4654
|
+
control.setValue(null, options);
|
|
4655
|
+
}
|
|
4656
|
+
this.markAsDirty();
|
|
4648
4657
|
}
|
|
4649
4658
|
isLast(index) {
|
|
4650
4659
|
return (this.length - 1) === index;
|