diff --git a/demo-shell/src/app.config.json b/demo-shell/src/app.config.json index 9ebacd3b7e..736f366a3f 100644 --- a/demo-shell/src/app.config.json +++ b/demo-shell/src/app.config.json @@ -189,7 +189,7 @@ "expanded": true, "intervals": [ { - "label": "The Created", + "label": "Created", "field": "cm:created", "sets": [ { @@ -212,7 +212,7 @@ ] }, { - "label": "TheModified", + "label": "Modified", "field": "cm:modified", "sets": [ { @@ -459,7 +459,7 @@ { "field": "creator", "mincount": 1, - "label": "Field created", + "label": "Folder created", "settings": { "allowUpdateOnChange": false, "hideDefaultAction": true diff --git a/demo-shell/src/app/components/search/search-filter-chips.component.ts b/demo-shell/src/app/components/search/search-filter-chips.component.ts index 2cb883fb84..f0a752cfd0 100644 --- a/demo-shell/src/app/components/search/search-filter-chips.component.ts +++ b/demo-shell/src/app/components/search/search-filter-chips.component.ts @@ -18,7 +18,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { Pagination, ResultSetPaging } from '@alfresco/js-api'; -import { SearchForm, SearchQueryBuilderService } from '@alfresco/adf-content-services'; +import { SearchConfiguration, SearchForm, SearchQueryBuilderService } from '@alfresco/adf-content-services'; import { SearchService, ShowHeaderMode, UserPreferencesService } from '@alfresco/adf-core'; import { combineLatest, Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -50,6 +50,7 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy { combineLatest([this.route.params, this.queryBuilder.configUpdated]) .pipe(takeUntil(this.onDestroy$)) .subscribe(([params, searchConfig]) => { + this.updateSearchSetting(searchConfig); this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null; const query = this.formatSearchQuery(this.searchedWord, searchConfig['app:fields']); if (query) { @@ -140,4 +141,28 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy { return ['name', 'asc']; } + + private updateSearchSetting(config: SearchConfiguration): void { + if (config.facetQueries) { + this.updateSetting(config.facetQueries); + } + + if (config.facetFields?.fields?.length) { + config.facetFields.fields.forEach((field) => this.updateSetting(field)); + } + + if (config.facetIntervals?.intervals?.length) { + config.facetIntervals.intervals.forEach((field) => this.updateSetting(field)); + } + + if (config.categories.length) { + config.categories.forEach((field) => this.updateSetting(field.component)); + } + } + + private updateSetting(field) { + field.settings = field.settings ?? {}; + field.settings.allowUpdateOnChange = false; + field.settings.hideDefaultAction = true; + } }