|
|
@@ -40,6 +40,7 @@ import {
|
|
|
export class CollectionContentsComponent implements OnInit, OnChanges, OnDestroy {
|
|
|
@Input() collectionId: string;
|
|
|
@Input() parentId: string;
|
|
|
+ @Input() inheritFilters: boolean;
|
|
|
@Input() updatedFilters: ConfigurableOperationInput[] | undefined;
|
|
|
@Input() previewUpdatedFilters = false;
|
|
|
@ContentChild(TemplateRef, { static: true }) headerTemplate: TemplateRef<any>;
|
|
|
@@ -53,6 +54,7 @@ export class CollectionContentsComponent implements OnInit, OnChanges, OnDestroy
|
|
|
private collectionIdChange$ = new BehaviorSubject<string>('');
|
|
|
private parentIdChange$ = new BehaviorSubject<string>('');
|
|
|
private filterChanges$ = new BehaviorSubject<ConfigurableOperationInput[]>([]);
|
|
|
+ private inheritFiltersChanges$ = new BehaviorSubject<boolean>(true);
|
|
|
private refresh$ = new BehaviorSubject<boolean>(true);
|
|
|
private destroy$ = new Subject<void>();
|
|
|
|
|
|
@@ -85,6 +87,13 @@ export class CollectionContentsComponent implements OnInit, OnChanges, OnDestroy
|
|
|
startWith([]),
|
|
|
);
|
|
|
|
|
|
+ const inheritFiltersChanges$ = this.inheritFiltersChanges$.asObservable().pipe(
|
|
|
+ filter(() => this.inheritFilters != null),
|
|
|
+ distinctUntilChanged(),
|
|
|
+ tap(() => this.setContentsPageNumber(1)),
|
|
|
+ startWith(true),
|
|
|
+ );
|
|
|
+
|
|
|
const fetchUpdate$ = combineLatest(
|
|
|
this.collectionIdChange$,
|
|
|
this.parentIdChange$,
|
|
|
@@ -92,6 +101,7 @@ export class CollectionContentsComponent implements OnInit, OnChanges, OnDestroy
|
|
|
this.contentsItemsPerPage$,
|
|
|
filterTerm$,
|
|
|
filterChanges$,
|
|
|
+ inheritFiltersChanges$,
|
|
|
this.refresh$,
|
|
|
);
|
|
|
|
|
|
@@ -99,7 +109,7 @@ export class CollectionContentsComponent implements OnInit, OnChanges, OnDestroy
|
|
|
takeUntil(this.destroy$),
|
|
|
tap(() => (this.isLoading = true)),
|
|
|
debounceTime(50),
|
|
|
- switchMap(([id, parentId, currentPage, itemsPerPage, filterTerm, filters]) => {
|
|
|
+ switchMap(([id, parentId, currentPage, itemsPerPage, filterTerm, filters, inheritFilters]) => {
|
|
|
const take = itemsPerPage;
|
|
|
const skip = (currentPage - 1) * itemsPerPage;
|
|
|
if (filters.length && this.previewUpdatedFilters) {
|
|
|
@@ -111,6 +121,7 @@ export class CollectionContentsComponent implements OnInit, OnChanges, OnDestroy
|
|
|
{
|
|
|
parentId,
|
|
|
filters,
|
|
|
+ inheritFilters,
|
|
|
},
|
|
|
{
|
|
|
take,
|
|
|
@@ -143,6 +154,9 @@ export class CollectionContentsComponent implements OnInit, OnChanges, OnDestroy
|
|
|
if ('parentId' in changes) {
|
|
|
this.parentIdChange$.next(changes.parentId.currentValue);
|
|
|
}
|
|
|
+ if ('inheritFilters' in changes) {
|
|
|
+ this.inheritFiltersChanges$.next(changes.inheritFilters.currentValue);
|
|
|
+ }
|
|
|
if ('updatedFilters' in changes) {
|
|
|
if (this.updatedFilters) {
|
|
|
this.filterChanges$.next(this.updatedFilters);
|