@sumaris-net/ngx-components 2.0.0-rc36 → 2.0.0-rc38
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/services/model/entity.decorators.mjs +3 -3
- package/esm2020/src/app/core/table/entities-table-datasource.class.mjs +9 -5
- package/fesm2015/sumaris-net.ngx-components.mjs +9 -5
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +9 -5
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -11180,8 +11180,8 @@ function EntityClass(opts) {
|
|
|
11180
11180
|
throw new Error(`Class ${constructor.name} must extends <<Entity>> to be able to use @FromObject!`);
|
|
11181
11181
|
}
|
|
11182
11182
|
}
|
|
11183
|
-
const typename = opts
|
|
11184
|
-
if (opts
|
|
11183
|
+
const typename = opts?.typename || `${constructor.name}VO`;
|
|
11184
|
+
if (opts?.fromObjectReuseStrategy === 'clone') {
|
|
11185
11185
|
const decoratedClass = (_a = class extends constructor {
|
|
11186
11186
|
static fromObject(source, opts) {
|
|
11187
11187
|
if (!source)
|
|
@@ -24984,6 +24984,8 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
24984
24984
|
return;
|
|
24985
24985
|
}
|
|
24986
24986
|
this.markAsLoading();
|
|
24987
|
+
const superDelete = super.delete;
|
|
24988
|
+
const self = this;
|
|
24987
24989
|
this.dataService.deleteAll([row.currentData], this.serviceOptions)
|
|
24988
24990
|
.catch(err => this.handleServiceError(err))
|
|
24989
24991
|
.then(() => {
|
|
@@ -24991,7 +24993,7 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
24991
24993
|
// make sure row has been deleted (because GrapQHl cache remove can failed)
|
|
24992
24994
|
const present = this.getRow(id) === row;
|
|
24993
24995
|
if (present)
|
|
24994
|
-
|
|
24996
|
+
superDelete.call(self, id);
|
|
24995
24997
|
this.markAsLoaded();
|
|
24996
24998
|
}, 300);
|
|
24997
24999
|
});
|
|
@@ -25002,17 +25004,19 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
25002
25004
|
try {
|
|
25003
25005
|
// Call service deletion
|
|
25004
25006
|
await this.dataService.deleteAll(data, this.serviceOptions);
|
|
25007
|
+
await sleep(300); // Wait propagation (e.g. update cache, then received update from dataService.watchAll())
|
|
25005
25008
|
// Workaround, to be sure all rows have been deleted
|
|
25006
25009
|
// Sometime, the service miss deletion, or GraphQl cache remove failed.
|
|
25007
25010
|
// In this case, apply missing deletion using the super.delete() function
|
|
25008
25011
|
const rowNotDeleted = this.getRows().filter(row => rows.includes(row));
|
|
25009
|
-
const superDelete = super.delete;
|
|
25010
25012
|
if (isNotEmptyArray(rowNotDeleted)) {
|
|
25013
|
+
const superDelete = super.delete;
|
|
25014
|
+
const self = this;
|
|
25011
25015
|
console.warn(`[entities-table-datasource] Force deletion of ${rowNotDeleted.length} rows! Please check that data service update the cache, after deletion`);
|
|
25012
25016
|
rowNotDeleted
|
|
25013
25017
|
// Start at the end
|
|
25014
25018
|
.sort((a, b) => a.id > b.id ? -1 : 1)
|
|
25015
|
-
.forEach(r => superDelete(r.id));
|
|
25019
|
+
.forEach(r => superDelete.call(self, r.id));
|
|
25016
25020
|
}
|
|
25017
25021
|
}
|
|
25018
25022
|
catch (err) {
|