diff --git a/src/lib/caching/cache-api.service.ts b/src/lib/caching/cache-api.service.ts index 3e858eb..2fdcfe9 100644 --- a/src/lib/caching/cache-api.service.ts +++ b/src/lib/caching/cache-api.service.ts @@ -24,7 +24,7 @@ export class CacheApiService { for (const dynCache of this._dynamicCaches) { for (const cacheUrl of dynCache.urls) { if (url.indexOf(cacheUrl) >= 0) { - console.log('[CACHE-API] open cache: ', dynCache.name); + // console.log('[CACHE-API] open cache: ', dynCache.name); return caches.open(dynCache.name).then(cache => this._handleFetchResponse(httpResponse, dynCache, cache, url)); } } @@ -34,7 +34,7 @@ export class CacheApiService { } async wipeCaches(logoutDependant = false) { - console.log('[CACHE-API] delete app level cache '); + // console.log('[CACHE-API] delete app level cache '); await caches.delete(APP_LEVEL_CACHE); for (const cache of this._dynamicCaches) { @@ -51,7 +51,7 @@ export class CacheApiService { getCachedRequest(request: HttpRequest): Observable> { const url = this._buildUrl(request); - console.log('[CACHE-API] get cached request: ', url); + // console.log('[CACHE-API] get cached request: ', url); return from(caches.match(url)).pipe( mergeMap(response => { if (response) { @@ -78,7 +78,7 @@ export class CacheApiService { return Promise.resolve(); } - console.log('[CACHE-API] cache value: ', name); + // console.log('[CACHE-API] cache value: ', name); const cache = await caches.open(APP_LEVEL_CACHE); const string = JSON.stringify(valueReference); const expires = new Date().getTime() + ttl * 1000; @@ -97,7 +97,7 @@ export class CacheApiService { return Promise.resolve(undefined); } - console.log('[CACHE-API] get cached value: ', name); + // console.log('[CACHE-API] get cached value: ', name); const cache = await caches.open(APP_LEVEL_CACHE); const result = await cache.match(name); if (!result) { @@ -233,7 +233,7 @@ export class CacheApiService { } private async _handleCacheExpiration(dynCache: DynamicCache, now: number) { - console.log('[CACHE-API] checking cache expiration'); + // console.log('[CACHE-API] checking cache expiration'); const cache = await caches.open(dynCache.name); let keys = await cache.keys(); // removed expired; diff --git a/src/lib/listing/services/listing.service.ts b/src/lib/listing/services/listing.service.ts index 66d6316..a8e70d3 100644 --- a/src/lib/listing/services/listing.service.ts +++ b/src/lib/listing/services/listing.service.ts @@ -30,8 +30,8 @@ export class ListingService, PrimaryKey exte this.displayedLength$ = this.displayed$.pipe(getLength, shareDistinctLast()); this.selected$ = this._selected$.asObservable().pipe(shareDistinctLast()); - this.selectedEntities$ = this._selected$.asObservable().pipe( - map(() => this.selected), + this.selectedEntities$ = combineLatest([this._selected$.asObservable(), this._entitiesService.all$]).pipe( + map(([selectedIds, all]) => all.filter(a => selectedIds.includes(a.id))), shareLast(), ); this.selectedLength$ = this._selected$.pipe(getLength, shareDistinctLast()); diff --git a/src/lib/listing/workflow/workflow.component.ts b/src/lib/listing/workflow/workflow.component.ts index c0287e9..7f076e0 100644 --- a/src/lib/listing/workflow/workflow.component.ts +++ b/src/lib/listing/workflow/workflow.component.ts @@ -101,10 +101,18 @@ export class WorkflowComponent extends Co draggingEntities: this.draggingEntities$, updateConfigItems: updateConfigItems$, setupResizeObserver: setupResizeObserver$, + updateDragging: this.listingService.displayed$.pipe( + tap((entities: T[]) => { + const entitiesIds = entities.map(e => e.id); + const initialDraggingIds = this.draggingEntities$.value.map(entity => entity.id); + const updatedDraggingIds = initialDraggingIds.filter(id => entitiesIds.includes(id)); + this.draggingEntities$.next(entities.filter(entity => updatedDraggingIds.includes(entity.id))); + }), + ), }); } - canMoveTo(column: WorkflowColumn): () => boolean { + canMoveTo(column: WorkflowColumn) { return () => column.enterPredicate(this.draggingEntities$.value); } @@ -163,15 +171,10 @@ export class WorkflowComponent extends Co } private _updateConfigItems(entities: T[]) { - // Disable updating while dragging - if (this.dragging) { - return; - } - // Remove deleted entities - const updatedIds = entities.map(entity => entity.id); + const entitiesIds = entities.map(entity => entity.id); for (const id of Object.keys(this.all)) { - if (!updatedIds.includes(id)) { + if (!entitiesIds.includes(id)) { this._removeEntity(this.all[id].entity); } }