@provoly/dashboard 0.24.2 → 0.24.4

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.
@@ -4108,7 +4108,9 @@ const SearchActions = {
4108
4108
  // result Search
4109
4109
  searchSuccess: createAction('[Search Api] (bus) Search Success', props()),
4110
4110
  searchFailure: createAction('[Search Api] (bus) Search Failure', props()),
4111
- setSearchLoading: createAction('[Search Api] (bus) set Search loading datasource status', props())
4111
+ setSearchLoading: createAction('[Search Api] (bus) set Search loading datasource status', props()),
4112
+ getPossibleFilterValues: createAction('[Dashboard] (bus) get possible filter values', props()),
4113
+ setPossibleFilterValues: createAction('[Dashboard] (bus) set possible filter values', props())
4112
4114
  };
4113
4115
 
4114
4116
  class SearchService {
@@ -4193,7 +4195,7 @@ class SearchService {
4193
4195
  this.transformations.forEach((func) => (transformed = func(id, transformed)));
4194
4196
  return transformed;
4195
4197
  }
4196
- autocomplete(attributes, search = '', limit = 10) {
4198
+ autocomplete(attributes, search = '', limit) {
4197
4199
  return this.store.select(ConfigSelectors.dataUrl).pipe(switchMap((url) => this.httpClient.post(encodeURI(`${url}/data-sources/values`), {
4198
4200
  attributes: (attributes ?? []).map((attr) => ({ datasource: attr.datasource, attribute: attr.id })),
4199
4201
  value: search,
@@ -4899,6 +4901,9 @@ class SearchEffects {
4899
4901
  resultSet: action.resultSet,
4900
4902
  params: action.params
4901
4903
  }))));
4904
+ this.getPossibleFilterValues$ = createEffect(() => this.actions$.pipe(ofType(SearchActions.getPossibleFilterValues), mergeMap((action) => this.searchService
4905
+ .autocomplete(action.attributes, '')
4906
+ .pipe(map((values) => SearchActions.setPossibleFilterValues({ filterId: action.filterId, values }))))));
4902
4907
  }
4903
4908
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: SearchEffects, deps: [{ token: i1$3.Actions }, { token: SearchService }, { token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
4904
4909
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: SearchEffects }); }
@@ -4911,7 +4916,8 @@ const searchFeatureKey = '@pry/search';
4911
4916
  const initialSearchState = {
4912
4917
  searchLoading: [],
4913
4918
  payload: undefined,
4914
- id: undefined
4919
+ id: undefined,
4920
+ possibleFilterValues: {}
4915
4921
  };
4916
4922
  const searchReducer = createReducer(initialSearchState, on(SearchActions.search, (state, action) => ({
4917
4923
  ...state,
@@ -4932,6 +4938,12 @@ const searchReducer = createReducer(initialSearchState, on(SearchActions.search,
4932
4938
  searchLoading: action.start
4933
4939
  ? [...new Set([...state.searchLoading, ...action.datasources])]
4934
4940
  : [...state.searchLoading.filter((id) => !action.datasources.includes(id))]
4941
+ })), on(SearchActions.setPossibleFilterValues, (state, { filterId, values }) => ({
4942
+ ...state,
4943
+ possibleFilterValues: {
4944
+ ...state.possibleFilterValues,
4945
+ [filterId]: values
4946
+ }
4935
4947
  })));
4936
4948
 
4937
4949
  class AccordionComponent {
@@ -5356,9 +5368,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
5356
5368
 
5357
5369
  const feature$2 = createFeatureSelector(searchFeatureKey);
5358
5370
  const searchLoading = createSelector(feature$2, (state) => state.searchLoading);
5371
+ const possibleFilterValues = (filterId) => createSelector(feature$2, (state) => (filterId ? state.possibleFilterValues[filterId] : []));
5359
5372
  const SearchSelectors = {
5360
5373
  feature: feature$2,
5361
- searchLoading
5374
+ searchLoading,
5375
+ possibleFilterValues
5362
5376
  };
5363
5377
 
5364
5378
  const latLonToGeographicFieldTransformation = (latAttrName, lonAttrName, locAttrName, datasetIds = []) => (id, result) => {