@sumaris-net/ngx-components 1.9.2 → 1.9.3
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/bundles/sumaris-net.ngx-components.umd.js +125 -117
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +2 -1
- package/esm2015/src/app/core/form/entity-editor.class.js +16 -8
- package/esm2015/src/app/core/services/account.service.js +1 -1
- package/esm2015/src/app/core/table/table.class.js +4 -4
- package/fesm2015/sumaris-net.ngx-components.js +18 -10
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/entity-editor.class.d.ts +3 -2
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -21935,7 +21935,7 @@ class AppTable {
|
|
|
21935
21935
|
return true;
|
|
21936
21936
|
}
|
|
21937
21937
|
save(opts) {
|
|
21938
|
-
var _a, _b;
|
|
21938
|
+
var _a, _b, _c, _d;
|
|
21939
21939
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21940
21940
|
opts = Object.assign({ keepEditing: this.keepEditedRowOnSave }, opts);
|
|
21941
21941
|
if (this.readOnly) {
|
|
@@ -21943,8 +21943,8 @@ class AppTable {
|
|
|
21943
21943
|
}
|
|
21944
21944
|
this.resetError();
|
|
21945
21945
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
21946
|
-
this.previouslyEditedRowId = opts.keepEditing && ((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined;
|
|
21947
|
-
const previouslyEditedData = isNotNil(this.previouslyEditedRowId) && this.editedRow.currentData || ((
|
|
21946
|
+
this.previouslyEditedRowId = opts.keepEditing && ((((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined) || ((_b = this.singleSelectedRow) === null || _b === void 0 ? void 0 : _b.id));
|
|
21947
|
+
const previouslyEditedData = isNotNil(this.previouslyEditedRowId) && ((_c = this.editedRow) === null || _c === void 0 ? void 0 : _c.currentData) || ((_d = this.singleSelectedRow) === null || _d === void 0 ? void 0 : _d.currentData);
|
|
21948
21948
|
if (!this.confirmEditCreate()) {
|
|
21949
21949
|
throw { code: ErrorCodes$2.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
21950
21950
|
}
|
|
@@ -23447,7 +23447,6 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23447
23447
|
this.dataType = dataType;
|
|
23448
23448
|
this.dataService = dataService;
|
|
23449
23449
|
this.saving = false;
|
|
23450
|
-
this.hasRemoteListener = false;
|
|
23451
23450
|
this.$title = new Subject();
|
|
23452
23451
|
this.onUpdateView = new EventEmitter();
|
|
23453
23452
|
options = Object.assign({
|
|
@@ -23526,6 +23525,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23526
23525
|
}
|
|
23527
23526
|
ngOnDestroy() {
|
|
23528
23527
|
super.ngOnDestroy();
|
|
23528
|
+
this.listenRemoteSubscription = null; // already unsubscribe in the super function
|
|
23529
23529
|
this.$title.complete();
|
|
23530
23530
|
this.$title.unsubscribe();
|
|
23531
23531
|
this.onUpdateView.complete();
|
|
@@ -23604,11 +23604,10 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23604
23604
|
}
|
|
23605
23605
|
startListenRemoteChanges() {
|
|
23606
23606
|
// Skip if disable, or already listening
|
|
23607
|
-
if (this.
|
|
23607
|
+
if (this.listenRemoteSubscription || !this._enableListenChanges || this.isNewData)
|
|
23608
23608
|
return;
|
|
23609
23609
|
// Listen for changes on server
|
|
23610
|
-
this.
|
|
23611
|
-
this.registerSubscription(this.dataService.listenChanges(this.data.id)
|
|
23610
|
+
this.listenRemoteSubscription = this.dataService.listenChanges(this.data.id)
|
|
23612
23611
|
.pipe(filter(isNotNil))
|
|
23613
23612
|
.subscribe((data) => {
|
|
23614
23613
|
if (data.updateDate && data.updateDate.isAfter(this.data.updateDate)) {
|
|
@@ -23622,8 +23621,16 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23622
23621
|
console.debug(`[data-editor] Changes detected on server, at {${data.updateDate}}, but page is dirty: skip reloading.`);
|
|
23623
23622
|
}
|
|
23624
23623
|
}
|
|
23625
|
-
})
|
|
23626
|
-
|
|
23624
|
+
});
|
|
23625
|
+
this.listenRemoteSubscription.add(() => this.listenRemoteSubscription = null);
|
|
23626
|
+
this.registerSubscription(this.listenRemoteSubscription);
|
|
23627
|
+
}
|
|
23628
|
+
stopListenRemoteChanges() {
|
|
23629
|
+
if (this.listenRemoteSubscription) {
|
|
23630
|
+
this.unregisterSubscription(this.listenRemoteSubscription);
|
|
23631
|
+
this.listenRemoteSubscription.unsubscribe();
|
|
23632
|
+
this.listenRemoteSubscription = null;
|
|
23633
|
+
}
|
|
23627
23634
|
}
|
|
23628
23635
|
updateView(data, opts) {
|
|
23629
23636
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -23767,7 +23774,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23767
23774
|
// Update the view (e.g metadata)
|
|
23768
23775
|
yield this.updateView(updatedData, opts);
|
|
23769
23776
|
// Subscribe to remote changes
|
|
23770
|
-
if (!this.
|
|
23777
|
+
if (!this.listenRemoteSubscription)
|
|
23771
23778
|
this.startListenRemoteChanges();
|
|
23772
23779
|
this.submitted = false;
|
|
23773
23780
|
return true;
|
|
@@ -23922,6 +23929,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23922
23929
|
}
|
|
23923
23930
|
unload() {
|
|
23924
23931
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23932
|
+
this.stopListenRemoteChanges();
|
|
23925
23933
|
this.form.reset();
|
|
23926
23934
|
this.registerForms();
|
|
23927
23935
|
this._dirty = false;
|