@sumaris-net/ngx-components 2.1.4-rc1 → 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 -13
- package/esm2020/src/app/shared/forms.mjs +1 -1
- package/fesm2015/sumaris-net.ngx-components.mjs +17 -11
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +17 -11
- 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 -7
|
@@ -4513,9 +4513,6 @@ class FormArrayHelper {
|
|
|
4513
4513
|
add(value, options) {
|
|
4514
4514
|
return pushValueInArray(this._formArray, this.createControl, this.equals, this.isEmpty, value, options);
|
|
4515
4515
|
}
|
|
4516
|
-
push(value, options) {
|
|
4517
|
-
return pushValueInArray(this._formArray, () => this.createControl(value), this.equals, this.isEmpty, value, options);
|
|
4518
|
-
}
|
|
4519
4516
|
removeAt(index) {
|
|
4520
4517
|
// Do not remove if last criterion
|
|
4521
4518
|
if (!this._allowEmptyArray && this._formArray.length === 1) {
|
|
@@ -4634,20 +4631,29 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4634
4631
|
add(value, options) {
|
|
4635
4632
|
return pushValueInArray(this, this.createControl, this.equals, this.isEmpty, value, options);
|
|
4636
4633
|
}
|
|
4637
|
-
|
|
4638
|
-
return pushValueInArray(this, () => this.createControl(value), this.equals, this.isEmpty, value, options);
|
|
4639
|
-
}
|
|
4640
|
-
removeAt(index) {
|
|
4634
|
+
removeAt(index, options) {
|
|
4641
4635
|
// Do not remove if last criterion
|
|
4642
4636
|
if (!this._allowEmptyArray && this.length === 1) {
|
|
4643
|
-
|
|
4637
|
+
this.clearAt(index, options);
|
|
4644
4638
|
}
|
|
4645
4639
|
else {
|
|
4646
|
-
|
|
4640
|
+
super.removeAt(index, options);
|
|
4647
4641
|
}
|
|
4648
4642
|
}
|
|
4649
|
-
clearAt(index) {
|
|
4650
|
-
|
|
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();
|
|
4651
4657
|
}
|
|
4652
4658
|
isLast(index) {
|
|
4653
4659
|
return (this.length - 1) === index;
|