Commits
Kristof De Langhe authored 480a1b482ac Merge
1 1 | import { |
2 - | combineLatest as observableCombineLatest, |
3 - | of as observableOf, |
4 2 | BehaviorSubject, |
3 + | combineLatest as observableCombineLatest, |
5 4 | Observable, |
5 + | of as observableOf, |
6 6 | Subject, |
7 7 | Subscription |
8 8 | } from 'rxjs'; |
9 - | import { switchMap, distinctUntilChanged, map, take, flatMap, tap } from 'rxjs/operators'; |
9 + | import { distinctUntilChanged, map, switchMap, take, tap } from 'rxjs/operators'; |
10 10 | import { animate, state, style, transition, trigger } from '@angular/animations'; |
11 11 | import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; |
12 12 | import { Router } from '@angular/router'; |
13 13 | import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service'; |
14 14 | import { PaginatedList } from '../../../../core/data/paginated-list'; |
15 15 | import { RemoteData } from '../../../../core/data/remote-data'; |
16 16 | import { hasNoValue, hasValue, isNotEmpty } from '../../../../shared/empty.util'; |
17 17 | import { EmphasizePipe } from '../../../../shared/utils/emphasize.pipe'; |
18 18 | import { FacetValue } from '../../../search-service/facet-value.model'; |
19 19 | import { SearchFilterConfig } from '../../../search-service/search-filter-config.model'; |
130 130 | filterValues = []; |
131 131 | } |
132 132 | |
133 133 | filterValues = [filterValues, newValues$]; |
134 134 | |
135 135 | this.subs.push(this.rdbs.aggregate(filterValues).pipe( |
136 136 | tap((rd: RemoteData<Array<PaginatedList<FacetValue>>>) => { |
137 137 | this.selectedValues$ = this.filterService.getSelectedValuesForFilter(this.filterConfig).pipe( |
138 138 | map((selectedValues) => { |
139 139 | return selectedValues.map((value: string) => { |
140 - | const fValue = [].concat(rd.payload.map((page) => page.page)).find((facetValue: FacetValue) => facetValue.value === value); |
140 + | const fValue = [].concat(rd.payload.map((page) => page.page)).find((facetValue: FacetValue) => this.getFacetValue(facetValue) === value); |
141 141 | if (hasValue(fValue)) { |
142 142 | return fValue; |
143 143 | } |
144 144 | return Object.assign(new FacetValue(), { label: value, value: value }); |
145 145 | }); |
146 146 | }) |
147 147 | ); |
148 148 | }) |
149 149 | ).subscribe((rd: RemoteData<Array<PaginatedList<FacetValue>>>) => { |
150 150 | this.animationState = 'ready'; |