@alfresco/adf-content-services 8.4.0-18834844131 → 8.4.0-18836034786

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.
@@ -4672,6 +4672,10 @@ class SearchHeaderQueryBuilderService extends BaseQueryBuilderService {
4672
4672
  }
4673
4673
  return foundCategory;
4674
4674
  }
4675
+ getOperatorForFilterId(id) {
4676
+ const foundCategory = this.categories?.find((category) => category.id === id);
4677
+ return foundCategory?.component?.settings?.operator;
4678
+ }
4675
4679
  setCurrentRootFolderId(currentFolderId) {
4676
4680
  const alreadyAddedFilter = this.filterQueries.find((filterQueries) => filterQueries.query.includes(currentFolderId));
4677
4681
  if (alreadyAddedFilter !== undefined) {
@@ -4767,6 +4771,8 @@ class SearchTextComponent {
4767
4771
  }
4768
4772
  reset(updateContext = true) {
4769
4773
  this.value = '';
4774
+ this.context.filterRawParams[this.id] = undefined;
4775
+ this.context.queryFragments[this.id] = '';
4770
4776
  this.updateQuery(null, updateContext);
4771
4777
  }
4772
4778
  onChangedHandler(event) {
@@ -4777,7 +4783,9 @@ class SearchTextComponent {
4777
4783
  }
4778
4784
  }
4779
4785
  updateQuery(value, updateContext = true) {
4780
- this.context.filterRawParams[this.id] = value;
4786
+ if (value !== null) {
4787
+ this.context.filterRawParams[this.id] = value;
4788
+ }
4781
4789
  this.displayValue$.next(value);
4782
4790
  if (this.context && this.settings && this.settings.field) {
4783
4791
  this.context.queryFragments[this.id] = value ? `${this.settings.field}:'${this.getSearchPrefix()}${value}${this.getSearchSuffix()}'` : '';
@@ -5405,8 +5413,7 @@ class SearchCheckListComponent {
5405
5413
  }
5406
5414
  }
5407
5415
  this.context.populateFilters
5408
- .asObservable()
5409
- .pipe(map((filtersQueries) => filtersQueries[this.id]), takeUntilDestroyed(this.destroyRef))
5416
+ .pipe(map((filtersQueries) => filtersQueries[this.id]), filter((filterQuery) => filterQuery !== undefined), takeUntilDestroyed(this.destroyRef))
5410
5417
  .subscribe((filterQuery) => {
5411
5418
  if (filterQuery) {
5412
5419
  filterQuery.forEach((value) => {
@@ -5473,8 +5480,8 @@ class SearchCheckListComponent {
5473
5480
  return this.getCheckedValues();
5474
5481
  }
5475
5482
  setValue(value) {
5476
- this.options.items.filter((item) => value.includes(item.value)).map((item) => (item.checked = true));
5477
- this.submitValues();
5483
+ this.options.items.forEach((item) => (item.checked = value.includes(item.value)));
5484
+ this.isActive = true;
5478
5485
  }
5479
5486
  getCheckedValues() {
5480
5487
  return this.options.items.filter((option) => option.checked).map((option) => option.value);
@@ -8063,7 +8070,7 @@ class SearchFilterContainerComponent {
8063
8070
  }
8064
8071
  ngOnInit() {
8065
8072
  this.category = this.searchFilterQueryBuilder.getCategoryForColumn(this.col.key);
8066
- this.initialValue = this.value?.[this.col.key] ? this.value[this.col.key] : undefined;
8073
+ this.initialValue = this.value?.[this.category?.id];
8067
8074
  }
8068
8075
  onKeyPressed(event, menuTrigger) {
8069
8076
  if (event.key === 'Enter' && this.widgetContainer.selector !== 'check-list') {
@@ -8073,7 +8080,7 @@ class SearchFilterContainerComponent {
8073
8080
  }
8074
8081
  onApply() {
8075
8082
  if (this.widgetContainer.hasValueSelected()) {
8076
- this.searchFilterQueryBuilder.setActiveFilter(this.category.columnKey, this.widgetContainer.getCurrentValue());
8083
+ this.searchFilterQueryBuilder.setActiveFilter(this.category.id, this.widgetContainer.getCurrentValue());
8077
8084
  this.filterChange.emit();
8078
8085
  this.widgetContainer.applyInnerWidget();
8079
8086
  }
@@ -8087,7 +8094,7 @@ class SearchFilterContainerComponent {
8087
8094
  }
8088
8095
  resetSearchFilter() {
8089
8096
  this.widgetContainer.resetInnerWidget();
8090
- this.searchFilterQueryBuilder.removeActiveFilter(this.category.columnKey);
8097
+ this.searchFilterQueryBuilder.removeActiveFilter(this.category.id);
8091
8098
  this.filterChange.emit();
8092
8099
  }
8093
8100
  getTooltipTranslation(columnTitle) {
@@ -8097,7 +8104,7 @@ class SearchFilterContainerComponent {
8097
8104
  return this.translationService.instant('SEARCH.SEARCH_HEADER.FILTER_BY', { category: this.translationService.instant(columnTitle) });
8098
8105
  }
8099
8106
  isActive() {
8100
- return this.searchFilterQueryBuilder.getActiveFilters().findIndex((f) => f.key === this.category.columnKey) > -1;
8107
+ return this.searchFilterQueryBuilder.getActiveFilters().findIndex((f) => f.key === this.category.id) > -1;
8101
8108
  }
8102
8109
  onMenuOpen() {
8103
8110
  if (this.filterContainer && !this.focusTrap) {
@@ -8211,12 +8218,17 @@ class FilterHeaderComponent {
8211
8218
  }
8212
8219
  }
8213
8220
  initSearchHeader(currentFolderId) {
8214
- this.searchFilterQueryBuilder.setCurrentRootFolderId(currentFolderId);
8215
8221
  if (this.value) {
8216
- Object.keys(this.value).forEach((columnKey) => {
8217
- this.searchFilterQueryBuilder.setActiveFilter(columnKey, this.value[columnKey]);
8222
+ Object.keys(this.value).forEach((key) => {
8223
+ this.searchFilterQueryBuilder.setActiveFilter(key, this.value[key]);
8224
+ const operator = this.searchFilterQueryBuilder.getOperatorForFilterId(key) || 'OR';
8225
+ this.searchFilterQueryBuilder.filterRawParams[key] = this.value[key];
8226
+ this.searchFilterQueryBuilder.queryFragments[key] = Array.isArray(this.value[key])
8227
+ ? this.value[key].join(` ${operator} `)
8228
+ : this.value[key];
8218
8229
  });
8219
8230
  }
8231
+ this.searchFilterQueryBuilder.setCurrentRootFolderId(currentFolderId);
8220
8232
  }
8221
8233
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FilterHeaderComponent, deps: [{ token: ADF_DOCUMENT_PARENT_COMPONENT }, { token: SearchHeaderQueryBuilderService }], target: i0.ɵɵFactoryTarget.Component }); }
8222
8234
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.6", type: FilterHeaderComponent, isStandalone: true, selector: "adf-filter-header", inputs: { value: "value", currentFolderId: "currentFolderId" }, outputs: { filterSelection: "filterSelection" }, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"isFilterServiceActive\">\n <adf-header-filter-template>\n <ng-template let-col>\n <adf-search-filter-container [col]=\"col\"\n [value]=\"value\"\n (filterChange)=\"onFilterSelectionChange()\" />\n </ng-template>\n </adf-header-filter-template>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: HeaderFilterTemplateDirective, selector: "adf-header-filter-template" }, { kind: "component", type: SearchFilterContainerComponent, selector: "adf-search-filter-container", inputs: ["col", "value"], outputs: ["filterChange"] }] }); }
@@ -8555,7 +8567,7 @@ class DocumentListComponent extends DataTableSchema {
8555
8567
  }
8556
8568
  }
8557
8569
  if (this.currentFolderId && changes['currentFolderId']?.currentValue !== changes['currentFolderId']?.previousValue) {
8558
- this.loadFolder();
8570
+ !this.filterValue && this.loadFolder();
8559
8571
  }
8560
8572
  if (this.data) {
8561
8573
  if (changes.node?.currentValue) {
@@ -8743,7 +8755,6 @@ class DocumentListComponent extends DataTableSchema {
8743
8755
  this.preserveExistingSelection();
8744
8756
  }
8745
8757
  this.onPreselectNodes();
8746
- this.setLoadingState(false);
8747
8758
  this.onDataReady(nodePaging);
8748
8759
  }
8749
8760
  }
@@ -8918,6 +8929,7 @@ class DocumentListComponent extends DataTableSchema {
8918
8929
  onDataReady(nodePaging) {
8919
8930
  this.ready.emit(nodePaging);
8920
8931
  this.pagination.next(nodePaging.list.pagination);
8932
+ this.setLoadingState(false);
8921
8933
  }
8922
8934
  updatePagination(requestPaginationModel) {
8923
8935
  this._pagination.maxItems = requestPaginationModel.maxItems;