@sumaris-net/ngx-components 2.4.25-rc1 → 2.4.25-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/doc/changelog.md +4 -0
- package/esm2020/src/app/core/form/entity/entity-editor.class.mjs +6 -7
- package/esm2020/src/app/core/services/model/entity.model.mjs +5 -3
- package/fesm2015/sumaris-net.ngx-components.mjs +9 -7
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +9 -7
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/entity/entity-editor.class.d.ts +1 -1
|
@@ -11163,9 +11163,11 @@ class Entity {
|
|
|
11163
11163
|
const target = Object.assign({}, this); //= {...this};
|
|
11164
11164
|
if (!opts || opts.keepTypename !== true)
|
|
11165
11165
|
delete target.__typename;
|
|
11166
|
-
if (target.id == null || (opts && opts.keepLocalId === false && target.id < 0))
|
|
11167
|
-
delete target.id;
|
|
11168
11166
|
target.updateDate = toDateISOString(this.updateDate);
|
|
11167
|
+
if (target.id == null || (opts && opts.keepLocalId === false && target.id < 0)) {
|
|
11168
|
+
delete target.id;
|
|
11169
|
+
delete target.updateDate; // Make to sens to keep updateDate of a local entity to save
|
|
11170
|
+
}
|
|
11169
11171
|
return target;
|
|
11170
11172
|
}
|
|
11171
11173
|
fromObject(source, opts) {
|
|
@@ -28238,8 +28240,8 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
28238
28240
|
// Skip if disable, or already listening
|
|
28239
28241
|
if (this._listenChangesSubscription || !this._enableListenChanges)
|
|
28240
28242
|
return;
|
|
28241
|
-
// Skip if new
|
|
28242
|
-
if (this.isNewData
|
|
28243
|
+
// Skip if new (nothing to listen)
|
|
28244
|
+
if (this.isNewData)
|
|
28243
28245
|
return;
|
|
28244
28246
|
// Listen for changes on server
|
|
28245
28247
|
const subscription = this.listenChanges(this.data.id, {
|
|
@@ -28249,7 +28251,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
28249
28251
|
? firstFalse(this.savingSubject).pipe(mapTo(data), debounceTime(500))
|
|
28250
28252
|
: of(data)))
|
|
28251
28253
|
.subscribe((data) => {
|
|
28252
|
-
const isNewer = isMoment(data.updateDate) && data.updateDate.isAfter(this.data.updateDate);
|
|
28254
|
+
const isNewer = isMoment(data.updateDate) && (!this.data.updateDate || data.updateDate.isAfter(this.data.updateDate));
|
|
28253
28255
|
if (!isNewer)
|
|
28254
28256
|
return; // Skip
|
|
28255
28257
|
// Editor has no changes: reload
|
|
@@ -28275,7 +28277,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
28275
28277
|
});
|
|
28276
28278
|
}
|
|
28277
28279
|
}
|
|
28278
|
-
|
|
28280
|
+
stopListenChanges() {
|
|
28279
28281
|
this._listenChangesSubscription?.unsubscribe();
|
|
28280
28282
|
}
|
|
28281
28283
|
async updateView(data, opts) {
|
|
@@ -28496,7 +28498,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
28496
28498
|
}
|
|
28497
28499
|
async unload(opts) {
|
|
28498
28500
|
await super.unload(opts);
|
|
28499
|
-
this.
|
|
28501
|
+
this.stopListenChanges();
|
|
28500
28502
|
this.form.reset();
|
|
28501
28503
|
this.registerForms();
|
|
28502
28504
|
this.data = null;
|