@sumaris-net/ngx-components 2.4.0-rc2 → 2.4.0-rc4
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/storage/entities-storage.service.mjs +21 -19
- package/esm2020/src/app/core/table/entities-async-table-datasource.class.mjs +1 -1
- package/esm2020/src/app/core/table/entities-table-datasource.class.mjs +1 -1
- package/esm2020/src/app/core/table/table.model.mjs +1 -1
- package/esm2020/src/app/shared/shared.module.mjs +3 -3
- package/fesm2015/sumaris-net.ngx-components.mjs +31 -19
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +21 -19
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/storage/entities-storage.service.d.ts +1 -1
- package/src/app/core/table/entities-async-table-datasource.class.d.ts +2 -1
- package/src/app/core/table/entities-table-datasource.class.d.ts +2 -1
- package/src/app/core/table/table.model.d.ts +3 -0
|
@@ -12832,11 +12832,11 @@ class EntitiesStorage extends StartableService {
|
|
|
12832
12832
|
return defer(() => this.ready())
|
|
12833
12833
|
.pipe(switchMap(() => this.watchAll(entityName, variables, opts))); // Loop
|
|
12834
12834
|
}
|
|
12835
|
-
this.progressBarService
|
|
12835
|
+
this.progressBarService?.increase();
|
|
12836
12836
|
const storeName = variables && variables.trash ? (EntitiesStorage.TRASH_PREFIX + entityName) : entityName;
|
|
12837
12837
|
const result = this.getEntityStore(storeName, { create: true })
|
|
12838
12838
|
.watchAll(variables, opts);
|
|
12839
|
-
result.pipe(first()).subscribe(() => this.progressBarService
|
|
12839
|
+
result.pipe(first()).subscribe(() => this.progressBarService?.decrease());
|
|
12840
12840
|
return result;
|
|
12841
12841
|
}
|
|
12842
12842
|
async loadAll(entityName, variables, opts) {
|
|
@@ -12844,7 +12844,7 @@ class EntitiesStorage extends StartableService {
|
|
|
12844
12844
|
if (!this.started)
|
|
12845
12845
|
await this.ready();
|
|
12846
12846
|
try {
|
|
12847
|
-
this.progressBarService
|
|
12847
|
+
this.progressBarService?.increase();
|
|
12848
12848
|
if (this._debug)
|
|
12849
12849
|
console.debug(`[entities-storage] Loading ${entityName}...`);
|
|
12850
12850
|
const entityStore = this.getEntityStore(entityName, { create: false });
|
|
@@ -12853,20 +12853,20 @@ class EntitiesStorage extends StartableService {
|
|
|
12853
12853
|
return entityStore.loadAll(variables, opts);
|
|
12854
12854
|
}
|
|
12855
12855
|
finally {
|
|
12856
|
-
this.progressBarService
|
|
12856
|
+
this.progressBarService?.decrease();
|
|
12857
12857
|
}
|
|
12858
12858
|
}
|
|
12859
12859
|
async load(id, entityName, opts) {
|
|
12860
12860
|
await this.ready();
|
|
12861
12861
|
try {
|
|
12862
|
-
this.progressBarService
|
|
12862
|
+
this.progressBarService?.increase();
|
|
12863
12863
|
const entityStore = this.getEntityStore(entityName, { create: false });
|
|
12864
12864
|
if (!entityStore)
|
|
12865
12865
|
return undefined;
|
|
12866
12866
|
return await entityStore.load(id, opts);
|
|
12867
12867
|
}
|
|
12868
12868
|
finally {
|
|
12869
|
-
this.progressBarService
|
|
12869
|
+
this.progressBarService?.decrease();
|
|
12870
12870
|
}
|
|
12871
12871
|
}
|
|
12872
12872
|
async nextValue(entityOrName) {
|
|
@@ -12897,7 +12897,7 @@ class EntitiesStorage extends StartableService {
|
|
|
12897
12897
|
if (!this.started)
|
|
12898
12898
|
await this.ready();
|
|
12899
12899
|
try {
|
|
12900
|
-
this.progressBarService
|
|
12900
|
+
this.progressBarService?.increase();
|
|
12901
12901
|
this._dirty = true;
|
|
12902
12902
|
const storeName = opts && opts.entityName || this.detectEntityName(entity);
|
|
12903
12903
|
this.getEntityStore(storeName)
|
|
@@ -12907,7 +12907,7 @@ class EntitiesStorage extends StartableService {
|
|
|
12907
12907
|
return entity;
|
|
12908
12908
|
}
|
|
12909
12909
|
finally {
|
|
12910
|
-
this.progressBarService
|
|
12910
|
+
this.progressBarService?.decrease();
|
|
12911
12911
|
}
|
|
12912
12912
|
}
|
|
12913
12913
|
async saveAll(entities, opts) {
|
|
@@ -12916,13 +12916,13 @@ class EntitiesStorage extends StartableService {
|
|
|
12916
12916
|
if (!this.started)
|
|
12917
12917
|
await this.ready();
|
|
12918
12918
|
try {
|
|
12919
|
-
this.progressBarService
|
|
12919
|
+
this.progressBarService?.increase();
|
|
12920
12920
|
this._dirty = true;
|
|
12921
12921
|
const entityName = opts && opts.entityName || this.detectEntityName(entities[0]);
|
|
12922
12922
|
return this.getEntityStore(entityName).saveAll(entities, opts);
|
|
12923
12923
|
}
|
|
12924
12924
|
finally {
|
|
12925
|
-
this.progressBarService
|
|
12925
|
+
this.progressBarService?.decrease();
|
|
12926
12926
|
}
|
|
12927
12927
|
}
|
|
12928
12928
|
async delete(entity, opts) {
|
|
@@ -12942,7 +12942,7 @@ class EntitiesStorage extends StartableService {
|
|
|
12942
12942
|
throw new Error('Missing argument \'opts\' or \'entityName\'');
|
|
12943
12943
|
//if (id >= 0) throw new Error('Invalid id a local entity (not a negative number): ' + id);
|
|
12944
12944
|
try {
|
|
12945
|
-
this.progressBarService
|
|
12945
|
+
this.progressBarService?.increase();
|
|
12946
12946
|
const entityStore = this.getEntityStore(opts.entityName, { create: false });
|
|
12947
12947
|
if (!entityStore)
|
|
12948
12948
|
return undefined;
|
|
@@ -12957,7 +12957,7 @@ class EntitiesStorage extends StartableService {
|
|
|
12957
12957
|
return deletedEntity;
|
|
12958
12958
|
}
|
|
12959
12959
|
finally {
|
|
12960
|
-
this.progressBarService
|
|
12960
|
+
this.progressBarService?.decrease();
|
|
12961
12961
|
}
|
|
12962
12962
|
}
|
|
12963
12963
|
async deleteMany(ids, opts) {
|
|
@@ -12966,7 +12966,7 @@ class EntitiesStorage extends StartableService {
|
|
|
12966
12966
|
if (!opts || isNilOrBlank(opts.entityName))
|
|
12967
12967
|
throw new Error('Missing argument \'opts\' or \'opts.entityName\'');
|
|
12968
12968
|
try {
|
|
12969
|
-
this.progressBarService
|
|
12969
|
+
this.progressBarService?.increase();
|
|
12970
12970
|
const entityStore = this.getEntityStore(opts.entityName, { create: false });
|
|
12971
12971
|
if (!entityStore)
|
|
12972
12972
|
return undefined;
|
|
@@ -12982,7 +12982,7 @@ class EntitiesStorage extends StartableService {
|
|
|
12982
12982
|
return deletedEntities;
|
|
12983
12983
|
}
|
|
12984
12984
|
finally {
|
|
12985
|
-
this.progressBarService
|
|
12985
|
+
this.progressBarService?.decrease();
|
|
12986
12986
|
}
|
|
12987
12987
|
}
|
|
12988
12988
|
async deleteFromTrash(entity, opts) {
|
|
@@ -13118,7 +13118,7 @@ class EntitiesStorage extends StartableService {
|
|
|
13118
13118
|
}
|
|
13119
13119
|
this._saving = true;
|
|
13120
13120
|
this._dirty = false;
|
|
13121
|
-
this.progressBarService
|
|
13121
|
+
this.progressBarService?.increase();
|
|
13122
13122
|
const entityNames = this._data && Object.keys(this._data) || [];
|
|
13123
13123
|
const now = Date.now();
|
|
13124
13124
|
if (this._debug)
|
|
@@ -13155,11 +13155,11 @@ class EntitiesStorage extends StartableService {
|
|
|
13155
13155
|
if (this._debug)
|
|
13156
13156
|
console.debug(`[entities-storage] Persisting [OK] ${entityNames.length} stores saved in ${Date.now() - now}ms...`);
|
|
13157
13157
|
this._saving = false;
|
|
13158
|
-
this.progressBarService
|
|
13158
|
+
this.progressBarService?.decrease();
|
|
13159
13159
|
})
|
|
13160
13160
|
.catch(err => {
|
|
13161
13161
|
this._saving = false;
|
|
13162
|
-
this.progressBarService
|
|
13162
|
+
this.progressBarService?.decrease();
|
|
13163
13163
|
if (currentEntityName) {
|
|
13164
13164
|
console.error(`[entities-storage] Error while persisting ${currentEntityName}`, err);
|
|
13165
13165
|
}
|
|
@@ -13172,12 +13172,14 @@ class EntitiesStorage extends StartableService {
|
|
|
13172
13172
|
}
|
|
13173
13173
|
EntitiesStorage.TRASH_PREFIX = 'Trash#';
|
|
13174
13174
|
EntitiesStorage.REMOTE_PREFIX = 'Remote#';
|
|
13175
|
-
EntitiesStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EntitiesStorage, deps: [{ token: i2.Platform }, { token: APP_PROGRESS_BAR_SERVICE }, { token: APP_STORAGE }, { token: ENVIRONMENT }, { token: APP_LOCAL_STORAGE_TYPE_POLICIES, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
13175
|
+
EntitiesStorage.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EntitiesStorage, deps: [{ token: i2.Platform }, { token: APP_PROGRESS_BAR_SERVICE, optional: true }, { token: APP_STORAGE }, { token: ENVIRONMENT }, { token: APP_LOCAL_STORAGE_TYPE_POLICIES, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
13176
13176
|
EntitiesStorage.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EntitiesStorage, providedIn: 'root' });
|
|
13177
13177
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EntitiesStorage, decorators: [{
|
|
13178
13178
|
type: Injectable,
|
|
13179
13179
|
args: [{ providedIn: 'root' }]
|
|
13180
13180
|
}], ctorParameters: function () { return [{ type: i2.Platform }, { type: undefined, decorators: [{
|
|
13181
|
+
type: Optional
|
|
13182
|
+
}, {
|
|
13181
13183
|
type: Inject,
|
|
13182
13184
|
args: [APP_PROGRESS_BAR_SERVICE]
|
|
13183
13185
|
}] }, { type: undefined, decorators: [{
|
|
@@ -19059,7 +19061,7 @@ class SharedModule {
|
|
|
19059
19061
|
{ provide: ENVIRONMENT, useValue: environment },
|
|
19060
19062
|
// { provide: StorageService, useClass: StorageService, deps: [ENVIRONMENT]},
|
|
19061
19063
|
{ provide: APP_STORAGE, useExisting: StorageService },
|
|
19062
|
-
{ provide: APP_PROGRESS_BAR_SERVICE, useClass: ProgressBarService },
|
|
19064
|
+
// { provide: APP_PROGRESS_BAR_SERVICE, useClass: ProgressBarService },
|
|
19063
19065
|
StorageService,
|
|
19064
19066
|
AudioProvider,
|
|
19065
19067
|
FileService,
|