[ADF-5438] Demoshell fixes (#7148)

[ADF-5438] 'Clear' and 'Apply' are showed for the new 'Content Size' bubble
[ADF-5437] Content size bubble filter shows a clear button

[ADF-5436] Check list filter shows 'Clear All' when there's already the remove button
This commit is contained in:
Dharan
2021-07-05 17:04:10 +05:30
committed by GitHub
parent 1afe1dd5c2
commit cc8a9f3ca0
2 changed files with 29 additions and 4 deletions

View File

@@ -189,7 +189,7 @@
"expanded": true, "expanded": true,
"intervals": [ "intervals": [
{ {
"label": "The Created", "label": "Created",
"field": "cm:created", "field": "cm:created",
"sets": [ "sets": [
{ {
@@ -212,7 +212,7 @@
] ]
}, },
{ {
"label": "TheModified", "label": "Modified",
"field": "cm:modified", "field": "cm:modified",
"sets": [ "sets": [
{ {
@@ -459,7 +459,7 @@
{ {
"field": "creator", "field": "creator",
"mincount": 1, "mincount": 1,
"label": "Field created", "label": "Folder created",
"settings": { "settings": {
"allowUpdateOnChange": false, "allowUpdateOnChange": false,
"hideDefaultAction": true "hideDefaultAction": true

View File

@@ -18,7 +18,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router'; import { ActivatedRoute, Params, Router } from '@angular/router';
import { Pagination, ResultSetPaging } from '@alfresco/js-api'; 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 { SearchService, ShowHeaderMode, UserPreferencesService } from '@alfresco/adf-core';
import { combineLatest, Subject } from 'rxjs'; import { combineLatest, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
@@ -50,6 +50,7 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy {
combineLatest([this.route.params, this.queryBuilder.configUpdated]) combineLatest([this.route.params, this.queryBuilder.configUpdated])
.pipe(takeUntil(this.onDestroy$)) .pipe(takeUntil(this.onDestroy$))
.subscribe(([params, searchConfig]) => { .subscribe(([params, searchConfig]) => {
this.updateSearchSetting(searchConfig);
this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null; this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null;
const query = this.formatSearchQuery(this.searchedWord, searchConfig['app:fields']); const query = this.formatSearchQuery(this.searchedWord, searchConfig['app:fields']);
if (query) { if (query) {
@@ -140,4 +141,28 @@ export class SearchFilterChipsComponent implements OnInit, OnDestroy {
return ['name', 'asc']; 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;
}
} }