@sumaris-net/ngx-components 2.2.1-rc13 → 2.2.1-rc14
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 +14 -10
- package/esm2020/src/app/social/user-event/user-event.service.mjs +3 -3
- package/fesm2015/sumaris-net.ngx-components.mjs +10 -12
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +14 -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 +3 -4
|
@@ -4617,11 +4617,15 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4617
4617
|
this.createControl = createControl;
|
|
4618
4618
|
this.equals = equals;
|
|
4619
4619
|
this.isEmpty = isEmpty;
|
|
4620
|
-
this.options =
|
|
4621
|
-
|
|
4620
|
+
this.options = {
|
|
4621
|
+
allowEmptyArray: true,
|
|
4622
|
+
allowReuseControls: true,
|
|
4623
|
+
...options
|
|
4624
|
+
};
|
|
4625
|
+
this.setAllowEmptyArray(this.options.allowEmptyArray);
|
|
4622
4626
|
}
|
|
4623
4627
|
get allowEmptyArray() {
|
|
4624
|
-
return this.
|
|
4628
|
+
return this.options.allowEmptyArray;
|
|
4625
4629
|
}
|
|
4626
4630
|
set allowEmptyArray(value) {
|
|
4627
4631
|
this.setAllowEmptyArray(value);
|
|
@@ -4632,7 +4636,7 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4632
4636
|
* @param options
|
|
4633
4637
|
*/
|
|
4634
4638
|
setValue(values, options) {
|
|
4635
|
-
if (this.options
|
|
4639
|
+
if (this.options.allowReuseControls === false) {
|
|
4636
4640
|
const disabled = this.disabled;
|
|
4637
4641
|
// Clean all
|
|
4638
4642
|
this.resize(0, { emitEvent: options?.emitEvent });
|
|
@@ -4654,7 +4658,7 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4654
4658
|
}
|
|
4655
4659
|
}
|
|
4656
4660
|
patchValue(values, options) {
|
|
4657
|
-
if (this.options
|
|
4661
|
+
if (this.options.allowReuseControls === false) {
|
|
4658
4662
|
const disabled = this.disabled;
|
|
4659
4663
|
// Clean all
|
|
4660
4664
|
this.resize(0, { emitEvent: options?.emitEvent });
|
|
@@ -4720,7 +4724,7 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4720
4724
|
}
|
|
4721
4725
|
removeAt(index, options) {
|
|
4722
4726
|
// Do not remove if last criterion
|
|
4723
|
-
if (
|
|
4727
|
+
if (this.options.allowEmptyArray === false && this.length === 1) {
|
|
4724
4728
|
this.clearAt(index, options);
|
|
4725
4729
|
}
|
|
4726
4730
|
else {
|
|
@@ -4754,11 +4758,11 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4754
4758
|
}
|
|
4755
4759
|
/* -- internal -- */
|
|
4756
4760
|
setAllowEmptyArray(value) {
|
|
4757
|
-
if (this.
|
|
4761
|
+
if (this.options.allowEmptyArray === value)
|
|
4758
4762
|
return; // Skip if same
|
|
4759
|
-
this.
|
|
4763
|
+
this.options.allowEmptyArray = value;
|
|
4760
4764
|
// Set required (or reste) min length validator
|
|
4761
|
-
if (this.
|
|
4765
|
+
if (this.options.allowEmptyArray) {
|
|
4762
4766
|
this.setValidators(this.options.validators || null);
|
|
4763
4767
|
}
|
|
4764
4768
|
else {
|
|
@@ -28805,7 +28809,7 @@ class AbstractUserEventService extends BaseGraphqlService {
|
|
|
28805
28809
|
}
|
|
28806
28810
|
async ngOnStart() {
|
|
28807
28811
|
// Update component when refresh is need (=login events)
|
|
28808
|
-
this._subscriptions.add(merge(this.accountService.onLogin, this.accountService.onLogout,
|
|
28812
|
+
this._subscriptions.add(merge(this.accountService.onLogin, this.accountService.onLogout, timer(500) // Starts with - first attempt if account is ready
|
|
28809
28813
|
)
|
|
28810
28814
|
.pipe(
|
|
28811
28815
|
// Wait account service ready (can be restarted)
|