@sumaris-net/ngx-components 2.6.30 → 2.6.32
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/entity/editor.class.mjs +6 -6
- package/esm2020/src/app/core/form/form.class.mjs +9 -9
- package/esm2020/src/app/core/form/form.utils.mjs +8 -4
- package/esm2020/src/app/core/table/table.class.mjs +14 -12
- package/esm2020/src/app/shared/events.mjs +1 -1
- package/esm2020/src/app/shared/image/gallery/image-gallery.component.mjs +1 -1
- package/fesm2015/sumaris-net.ngx-components.mjs +28 -22
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +29 -23
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.utils.d.ts +1 -1
- package/src/app/shared/events.d.ts +1 -1
- package/src/assets/manifest.json +1 -1
|
@@ -4930,7 +4930,8 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4930
4930
|
const disabled = this.disabled; // Save enabled here, because update can occur from resizeArray()
|
|
4931
4931
|
// Reduce
|
|
4932
4932
|
while (this.length > length) {
|
|
4933
|
-
|
|
4933
|
+
// WARN: We use super.removeAt() and NOT this.removeAt(), to avoid infinite loop, when calling resize(0) AND options.allowEmptyArray=false
|
|
4934
|
+
super.removeAt(this.length - 1, { emitEvent: options?.emitEvent });
|
|
4934
4935
|
}
|
|
4935
4936
|
// Or increase size
|
|
4936
4937
|
while (this.length < length) {
|
|
@@ -4971,10 +4972,13 @@ class AppFormArray extends UntypedFormArray {
|
|
|
4971
4972
|
// Do not remove if last criterion
|
|
4972
4973
|
if (this.options.allowEmptyArray === false && this.length === 1) {
|
|
4973
4974
|
this.clearAt(index, options);
|
|
4975
|
+
return false;
|
|
4974
4976
|
}
|
|
4975
|
-
else {
|
|
4977
|
+
else if (index < this.length) {
|
|
4976
4978
|
super.removeAt(index, options);
|
|
4979
|
+
return true;
|
|
4977
4980
|
}
|
|
4981
|
+
return false;
|
|
4978
4982
|
}
|
|
4979
4983
|
clearAt(index, options) {
|
|
4980
4984
|
const control = this.at(index);
|
|
@@ -11327,7 +11331,7 @@ class AppForm {
|
|
|
11327
11331
|
this.settings = injector.get(LocalSettingsService);
|
|
11328
11332
|
this.errorTranslator = injector.get(FormErrorTranslator);
|
|
11329
11333
|
this.autocompleteHelper = new MatAutocompleteConfigHolder(this.settings && {
|
|
11330
|
-
getUserAttributes: (a, b) => this.settings.getFieldDisplayAttributes(a, b)
|
|
11334
|
+
getUserAttributes: (a, b) => this.settings.getFieldDisplayAttributes(a, b),
|
|
11331
11335
|
});
|
|
11332
11336
|
this.autocompleteFields = this.autocompleteHelper.fields;
|
|
11333
11337
|
}
|
|
@@ -11431,7 +11435,7 @@ class AppForm {
|
|
|
11431
11435
|
else
|
|
11432
11436
|
this.disable();
|
|
11433
11437
|
this.errorTranslatorOptions = this.errorTranslatorOptions || {
|
|
11434
|
-
controlPathTranslator: this
|
|
11438
|
+
controlPathTranslator: this,
|
|
11435
11439
|
};
|
|
11436
11440
|
}
|
|
11437
11441
|
ngOnDestroy() {
|
|
@@ -11475,7 +11479,7 @@ class AppForm {
|
|
|
11475
11479
|
setForm(form) {
|
|
11476
11480
|
if (this._form !== form) {
|
|
11477
11481
|
this._form = form;
|
|
11478
|
-
this._subscription.add(this._form.statusChanges.subscribe(_ => this.markForCheck()));
|
|
11482
|
+
this._subscription.add(this._form.statusChanges.subscribe((_) => this.markForCheck()));
|
|
11479
11483
|
}
|
|
11480
11484
|
}
|
|
11481
11485
|
setValue(data, opts) {
|
|
@@ -11544,7 +11548,7 @@ class AppForm {
|
|
|
11544
11548
|
this.setLoading(false, opts);
|
|
11545
11549
|
}
|
|
11546
11550
|
markAsReady(opts) {
|
|
11547
|
-
if (this.readySubject.value !== true) {
|
|
11551
|
+
if (!this.readySubject.closed && this.readySubject.value !== true) {
|
|
11548
11552
|
this.readySubject.next(true);
|
|
11549
11553
|
// If subclasses implements OnReady
|
|
11550
11554
|
if (typeof this['ngOnReady'] === 'function') {
|
|
@@ -11560,7 +11564,7 @@ class AppForm {
|
|
|
11560
11564
|
ready(opts) {
|
|
11561
11565
|
if (this.readySubject.value)
|
|
11562
11566
|
return Promise.resolve();
|
|
11563
|
-
return waitForTrue(this.readySubject, opts);
|
|
11567
|
+
return waitForTrue(this.readySubject, { stop: this.destroySubject, ...opts });
|
|
11564
11568
|
}
|
|
11565
11569
|
/**
|
|
11566
11570
|
* Wait form is not busy (=loaded)
|
|
@@ -11570,7 +11574,7 @@ class AppForm {
|
|
|
11570
11574
|
waitIdle(opts) {
|
|
11571
11575
|
if (!this.loadingSubject.value)
|
|
11572
11576
|
return Promise.resolve();
|
|
11573
|
-
return waitForFalse(this.loadingSubject, opts);
|
|
11577
|
+
return waitForFalse(this.loadingSubject, { stop: this.destroySubject, ...opts });
|
|
11574
11578
|
}
|
|
11575
11579
|
updateValueAndValidity(opts) {
|
|
11576
11580
|
AppFormUtils.updateValueAndValidity(this.form, opts);
|
|
@@ -11587,7 +11591,7 @@ class AppForm {
|
|
|
11587
11591
|
return undefined;
|
|
11588
11592
|
return this.errorTranslator.translateFormErrors(this.form, {
|
|
11589
11593
|
controlPathTranslator: this,
|
|
11590
|
-
...opts
|
|
11594
|
+
...opts,
|
|
11591
11595
|
});
|
|
11592
11596
|
}
|
|
11593
11597
|
getI18nFieldName(path) {
|
|
@@ -28011,7 +28015,7 @@ class AppTable {
|
|
|
28011
28015
|
return !this._enabled;
|
|
28012
28016
|
}
|
|
28013
28017
|
markAsDirty(opts) {
|
|
28014
|
-
if (this.dirtySubject.value !== true) {
|
|
28018
|
+
if (!this.dirtySubject.closed && this.dirtySubject.value !== true) {
|
|
28015
28019
|
this.dirtySubject.next(true);
|
|
28016
28020
|
if (!opts || opts.emitEvent !== false) {
|
|
28017
28021
|
this.markForCheck();
|
|
@@ -28019,7 +28023,7 @@ class AppTable {
|
|
|
28019
28023
|
}
|
|
28020
28024
|
}
|
|
28021
28025
|
markAsPristine(opts) {
|
|
28022
|
-
if (this.dirtySubject.value !== false) {
|
|
28026
|
+
if (!this.dirtySubject.closed && this.dirtySubject.value !== false) {
|
|
28023
28027
|
this.dirtySubject.next(false);
|
|
28024
28028
|
if (!opts || opts.emitEvent !== false) {
|
|
28025
28029
|
this.markForCheck();
|
|
@@ -28060,7 +28064,7 @@ class AppTable {
|
|
|
28060
28064
|
}
|
|
28061
28065
|
}
|
|
28062
28066
|
markAllAsTouched(opts) {
|
|
28063
|
-
if (this.touchedSubject.value !== true) {
|
|
28067
|
+
if (!this.touchedSubject.closed && this.touchedSubject.value !== true) {
|
|
28064
28068
|
this.touchedSubject.next(true);
|
|
28065
28069
|
if (!opts || opts.emitEvent !== false)
|
|
28066
28070
|
this.markForCheck();
|
|
@@ -28070,7 +28074,7 @@ class AppTable {
|
|
|
28070
28074
|
}
|
|
28071
28075
|
}
|
|
28072
28076
|
markAsSaving(opts) {
|
|
28073
|
-
if (this.savingSubject.value !== true) {
|
|
28077
|
+
if (!this.savingSubject.closed && this.savingSubject.value !== true) {
|
|
28074
28078
|
this.focusColumn = undefined; // unselect focus column
|
|
28075
28079
|
this.savingSubject.next(true);
|
|
28076
28080
|
if (!opts || opts.emitEvent !== false)
|
|
@@ -28078,7 +28082,7 @@ class AppTable {
|
|
|
28078
28082
|
}
|
|
28079
28083
|
}
|
|
28080
28084
|
markAsSaved(opts) {
|
|
28081
|
-
if (this.savingSubject.value !== false) {
|
|
28085
|
+
if (!this.savingSubject.closed && this.savingSubject.value !== false) {
|
|
28082
28086
|
this.savingSubject.next(false);
|
|
28083
28087
|
if (!opts || opts.emitEvent !== false)
|
|
28084
28088
|
this.markForCheck();
|
|
@@ -28091,7 +28095,7 @@ class AppTable {
|
|
|
28091
28095
|
this.setLoading(false, opts);
|
|
28092
28096
|
}
|
|
28093
28097
|
markAsReady(opts) {
|
|
28094
|
-
if (this.readySubject.value !== true) {
|
|
28098
|
+
if (!this.readySubject.closed && this.readySubject.value !== true) {
|
|
28095
28099
|
this.readySubject.next(true);
|
|
28096
28100
|
// If subclasses implements OnReady
|
|
28097
28101
|
if (typeof this['ngOnReady'] === 'function') {
|
|
@@ -28723,10 +28727,12 @@ class AppTable {
|
|
|
28723
28727
|
this.dataSource.move(id, direction);
|
|
28724
28728
|
}
|
|
28725
28729
|
ready(opts) {
|
|
28726
|
-
return waitForTrue(this.readySubject, opts);
|
|
28730
|
+
return waitForTrue(this.readySubject, { stop: this.destroySubject, ...opts });
|
|
28727
28731
|
}
|
|
28728
28732
|
waitIdle(opts) {
|
|
28729
|
-
|
|
28733
|
+
if (!this.loadingSubject.value)
|
|
28734
|
+
return Promise.resolve();
|
|
28735
|
+
return waitForFalse(this.loadingSubject, { stop: this.destroySubject, ...opts });
|
|
28730
28736
|
}
|
|
28731
28737
|
async openSelectColumnsModal(_) {
|
|
28732
28738
|
// Copy current columns (deep copy)
|
|
@@ -29320,7 +29326,7 @@ class AppTable {
|
|
|
29320
29326
|
}
|
|
29321
29327
|
}
|
|
29322
29328
|
setLoading(value, opts) {
|
|
29323
|
-
if (this.loadingSubject.value !== value) {
|
|
29329
|
+
if (!this.loadingSubject.closed && this.loadingSubject.value !== value) {
|
|
29324
29330
|
this.loadingSubject.next(value);
|
|
29325
29331
|
if (!opts || opts.emitEvent !== false) {
|
|
29326
29332
|
this.markForCheck();
|
|
@@ -30652,7 +30658,7 @@ class AppEditor {
|
|
|
30652
30658
|
}
|
|
30653
30659
|
}
|
|
30654
30660
|
markAsLoaded(opts) {
|
|
30655
|
-
if (this.loadingSubject.value) {
|
|
30661
|
+
if (!this.loadingSubject.closed && this.loadingSubject.value) {
|
|
30656
30662
|
this.loadingSubject.next(false);
|
|
30657
30663
|
if (!opts || opts.onlySelf !== true) {
|
|
30658
30664
|
// Emit to children forms and editors
|
|
@@ -30667,18 +30673,18 @@ class AppEditor {
|
|
|
30667
30673
|
}
|
|
30668
30674
|
markAsReady(opts) {
|
|
30669
30675
|
this._children?.forEach(c => c.markAsReady(opts));
|
|
30670
|
-
if (!this.readySubject.value)
|
|
30676
|
+
if (!this.readySubject.closed && !this.readySubject.value)
|
|
30671
30677
|
this.readySubject.next(true);
|
|
30672
30678
|
}
|
|
30673
30679
|
ready(opts) {
|
|
30674
30680
|
if (this.readySubject.value)
|
|
30675
30681
|
return Promise.resolve();
|
|
30676
|
-
return waitForTrue(this.readySubject, opts);
|
|
30682
|
+
return waitForTrue(this.readySubject, { stop: this.destroySubject, ...opts });
|
|
30677
30683
|
}
|
|
30678
30684
|
waitIdle(opts) {
|
|
30679
30685
|
if (!this.loadingSubject.value)
|
|
30680
30686
|
return Promise.resolve();
|
|
30681
|
-
return waitForFalse(this.loadingSubject, opts);
|
|
30687
|
+
return waitForFalse(this.loadingSubject, { stop: this.destroySubject, ...opts });
|
|
30682
30688
|
}
|
|
30683
30689
|
markAsSaving(opts) {
|
|
30684
30690
|
if (this.savingSubject.value !== true) {
|
|
@@ -30688,7 +30694,7 @@ class AppEditor {
|
|
|
30688
30694
|
}
|
|
30689
30695
|
}
|
|
30690
30696
|
markAsSaved(opts) {
|
|
30691
|
-
if (this.savingSubject.value !== false) {
|
|
30697
|
+
if (!this.savingSubject.closed && this.savingSubject.value !== false) {
|
|
30692
30698
|
this.savingSubject.next(false);
|
|
30693
30699
|
if (!opts || opts.emitEvent !== false)
|
|
30694
30700
|
this.markForCheck();
|