diff --git a/src/lib/filtering/popup-filter/popup-filter.component.html b/src/lib/filtering/popup-filter/popup-filter.component.html
index 614d8e6..62d2199 100644
--- a/src/lib/filtering/popup-filter/popup-filter.component.html
+++ b/src/lib/filtering/popup-filter/popup-filter.component.html
@@ -33,9 +33,9 @@
-
+
- {{ filter.label }}
-
+
+
+ {{ filter.label }}
+
+
diff --git a/src/lib/listing/listing-component.directive.ts b/src/lib/listing/listing-component.directive.ts
index 915e076..ed6b0a5 100644
--- a/src/lib/listing/listing-component.directive.ts
+++ b/src/lib/listing/listing-component.directive.ts
@@ -1,6 +1,6 @@
import { Directive, Injector, OnDestroy, TemplateRef, ViewChild } from '@angular/core';
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
-import { distinctUntilChanged, map, switchMap } from 'rxjs/operators';
+import { distinctUntilChanged, map, shareReplay, switchMap } from 'rxjs/operators';
import { FilterService } from '../filtering';
import { SortingService } from '../sorting';
import { AutoUnsubscribe } from '../utils';
@@ -54,6 +54,7 @@ export abstract class ListingComponent
extends AutoUnsubscr
private get _noMatch$(): Observable {
return combineLatest([this.entitiesService.allLength$, this.listingService.displayedLength$]).pipe(
map(([hasEntities, hasDisplayedEntities]) => !!hasEntities && !hasDisplayedEntities),
+ shareReplay(),
distinctUntilChanged(),
);
}
@@ -61,6 +62,7 @@ export abstract class ListingComponent extends AutoUnsubscr
private get _noContent$(): Observable {
return combineLatest([this._noMatch$, this.entitiesService.noData$]).pipe(
map(([noMatch, noData]) => noMatch || noData),
+ shareReplay(),
distinctUntilChanged(),
);
}
diff --git a/src/lib/listing/services/entities.service.ts b/src/lib/listing/services/entities.service.ts
index d78a47e..6a01e56 100644
--- a/src/lib/listing/services/entities.service.ts
+++ b/src/lib/listing/services/entities.service.ts
@@ -1,6 +1,6 @@
import { Inject, Injectable, InjectionToken, Injector, Optional } from '@angular/core';
import { BehaviorSubject, Observable, Subject } from 'rxjs';
-import { distinctUntilChanged, map, tap } from 'rxjs/operators';
+import { distinctUntilChanged, map, shareReplay, tap } from 'rxjs/operators';
import { IListable } from '../models';
import { GenericService } from '../../services';
import { getLength } from '../../utils';
@@ -30,8 +30,8 @@ export class EntitiesService extends GenericService<
@Optional() @Inject(ENTITY_PATH) protected readonly _defaultModelPath = '',
) {
super(_injector, _defaultModelPath);
- this.all$ = this._all$.asObservable();
- this.allLength$ = this._all$.pipe(getLength);
+ this.all$ = this._all$.asObservable().pipe(distinctUntilChanged(), shareReplay(1));
+ this.allLength$ = this._all$.pipe(getLength, distinctUntilChanged(), shareReplay(1));
this.noData$ = this._noData$;
}
@@ -43,6 +43,7 @@ export class EntitiesService extends GenericService<
return this.allLength$.pipe(
map(length => length === 0),
distinctUntilChanged(),
+ shareReplay(1),
);
}
diff --git a/src/lib/listing/services/listing.service.ts b/src/lib/listing/services/listing.service.ts
index afd6c83..3bd4854 100644
--- a/src/lib/listing/services/listing.service.ts
+++ b/src/lib/listing/services/listing.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
-import { distinctUntilChanged, map, tap } from 'rxjs/operators';
+import { distinctUntilChanged, map, shareReplay, tap } from 'rxjs/operators';
import { FilterService, getFilteredEntities } from '../../filtering';
import { SearchService } from '../../search';
import { IListable } from '../models';
@@ -25,12 +25,15 @@ export class ListingService {
private readonly _searchService: SearchService,
private readonly _entitiesService: EntitiesService,
) {
- this.displayed$ = this._getDisplayed$;
- this.displayedLength$ = this.displayed$.pipe(getLength);
+ this.displayed$ = this._getDisplayed$.pipe(shareReplay(1));
+ this.displayedLength$ = this.displayed$.pipe(getLength, distinctUntilChanged(), shareReplay(1));
- this.selected$ = this._selected$.asObservable();
- this.selectedEntities$ = this._selected$.asObservable().pipe(map(() => this.selected));
- this.selectedLength$ = this._selected$.pipe(getLength);
+ this.selected$ = this._selected$.asObservable().pipe(shareReplay(1));
+ this.selectedEntities$ = this._selected$.asObservable().pipe(
+ map(() => this.selected),
+ shareReplay(1),
+ );
+ this.selectedLength$ = this._selected$.pipe(getLength, distinctUntilChanged(), shareReplay(1));
this.areAllSelected$ = this._areAllSelected$;
this.areSomeSelected$ = this._areSomeSelected$;
@@ -59,6 +62,7 @@ export class ListingService {
return combineLatest([this.displayedLength$, this.selectedLength$]).pipe(
map(([displayedLength, selectedLength]) => !!displayedLength && displayedLength === selectedLength),
distinctUntilChanged(),
+ shareReplay(),
);
}
@@ -66,6 +70,7 @@ export class ListingService {
return this.selectedLength$.pipe(
map(length => !!length),
distinctUntilChanged(),
+ shareReplay(),
);
}
@@ -73,6 +78,7 @@ export class ListingService {
return combineLatest([this.areAllSelected$, this.areSomeSelected$]).pipe(
map(([allAreSelected, someAreSelected]) => !allAreSelected && someAreSelected),
distinctUntilChanged(),
+ shareReplay(),
);
}
diff --git a/src/lib/listing/table/table.component.html b/src/lib/listing/table/table.component.html
index 013506d..28752cb 100644
--- a/src/lib/listing/table/table.component.html
+++ b/src/lib/listing/table/table.component.html
@@ -23,21 +23,23 @@
-