@alfresco/adf-content-services 8.4.0-17764854696 → 8.4.0-17794388212

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.
@@ -6181,6 +6181,7 @@ var AutocompleteField;
6181
6181
  (function (AutocompleteField) {
6182
6182
  AutocompleteField["TAG"] = "TAG";
6183
6183
  AutocompleteField["CATEGORIES"] = "cm:categories";
6184
+ AutocompleteField["LOCATION"] = "SITE";
6184
6185
  })(AutocompleteField || (AutocompleteField = {}));
6185
6186
 
6186
6187
  /*!
@@ -6366,9 +6367,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
6366
6367
  * limitations under the License.
6367
6368
  */
6368
6369
  class SearchFilterAutocompleteChipsComponent {
6369
- constructor(tagService, categoryService) {
6370
+ constructor(tagService, categoryService, sitesService) {
6370
6371
  this.tagService = tagService;
6371
6372
  this.categoryService = categoryService;
6373
+ this.sitesService = sitesService;
6372
6374
  this.startValue = [];
6373
6375
  this.displayValue$ = new ReplaySubject(1);
6374
6376
  this.selectedOptions = [];
@@ -6429,8 +6431,13 @@ class SearchFilterAutocompleteChipsComponent {
6429
6431
  this.submitValues();
6430
6432
  }
6431
6433
  onInputChange(value) {
6432
- if (this.settings.field === AutocompleteField.CATEGORIES && value) {
6433
- this.searchForExistingCategories(value);
6434
+ if (value) {
6435
+ if (this.settings.field === AutocompleteField.CATEGORIES) {
6436
+ this.searchForExistingCategories(value);
6437
+ }
6438
+ else if (this.settings.field === AutocompleteField.LOCATION) {
6439
+ this.populateSitesOptions();
6440
+ }
6434
6441
  }
6435
6442
  }
6436
6443
  optionComparator(option1, option2) {
@@ -6441,11 +6448,16 @@ class SearchFilterAutocompleteChipsComponent {
6441
6448
  this.displayValue$.next(this.selectedOptions.map((option) => option.value).join(', '));
6442
6449
  if (this.context && this.settings && this.settings.field) {
6443
6450
  let queryFragments;
6444
- if (this.settings.field === AutocompleteField.CATEGORIES) {
6445
- queryFragments = this.selectedOptions.map((val) => `${this.settings.field}:"workspace://SpacesStore/${val.id}"`);
6446
- }
6447
- else {
6448
- queryFragments = this.selectedOptions.map((val) => val.query ?? `${this.settings.field}:"${val.value}"`);
6451
+ switch (this.settings.field) {
6452
+ case AutocompleteField.CATEGORIES:
6453
+ queryFragments = this.selectedOptions.map((val) => `${this.settings.field}:"workspace://SpacesStore/${val.id}"`);
6454
+ break;
6455
+ case AutocompleteField.LOCATION:
6456
+ queryFragments = this.selectedOptions.map((val) => val.query ?? `${this.settings.field}:"${val.id}"`);
6457
+ break;
6458
+ default:
6459
+ queryFragments = this.selectedOptions.map((val) => val.query ?? `${this.settings.field}:"${val.value}"`);
6460
+ break;
6449
6461
  }
6450
6462
  this.context.queryFragments[this.id] = queryFragments.join(' OR ');
6451
6463
  if (updateContext) {
@@ -6465,6 +6477,9 @@ class SearchFilterAutocompleteChipsComponent {
6465
6477
  case AutocompleteField.CATEGORIES:
6466
6478
  this.autocompleteOptionsSubject$.next([]);
6467
6479
  break;
6480
+ case AutocompleteField.LOCATION:
6481
+ this.autocompleteOptionsSubject$.next([]);
6482
+ break;
6468
6483
  default:
6469
6484
  this.autocompleteOptionsSubject$.next(this.settings.autocompleteOptions);
6470
6485
  }
@@ -6478,13 +6493,26 @@ class SearchFilterAutocompleteChipsComponent {
6478
6493
  }));
6479
6494
  });
6480
6495
  }
6481
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SearchFilterAutocompleteChipsComponent, deps: [{ token: TagService }, { token: CategoryService }], target: i0.ɵɵFactoryTarget.Component }); }
6496
+ populateSitesOptions() {
6497
+ this.sitesService
6498
+ .getSites()
6499
+ .pipe(map((sites) => {
6500
+ const predefinedOptions = this.settings?.autocompleteOptions || [];
6501
+ const sitesOptions = sites.list.entries.map((siteEntry) => ({
6502
+ id: siteEntry.entry.id,
6503
+ value: siteEntry.entry.title
6504
+ }));
6505
+ return [...sitesOptions, ...predefinedOptions];
6506
+ }))
6507
+ .subscribe((options) => this.autocompleteOptionsSubject$.next(options));
6508
+ }
6509
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SearchFilterAutocompleteChipsComponent, deps: [{ token: TagService }, { token: CategoryService }, { token: SitesService }], target: i0.ɵɵFactoryTarget.Component }); }
6482
6510
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.6", type: SearchFilterAutocompleteChipsComponent, isStandalone: true, selector: "adf-search-filter-autocomplete-chips", ngImport: i0, template: "<adf-search-chip-autocomplete-input\n [autocompleteOptions]=\"autocompleteOptions$ | async\"\n [preselectedOptions]=\"selectedOptions\"\n [onReset$]=\"reset$\"\n [allowOnlyPredefinedValues]=\"settings.allowOnlyPredefinedValues\"\n (inputChanged)=\"onInputChange($event)\"\n [compareOption]=\"optionComparator\"\n (optionsChanged)=\"onOptionsChange($event)\" />\n\n<div class=\"adf-facet-buttons\" *ngIf=\"!settings?.hideDefaultAction\">\n <button mat-button color=\"primary\" data-automation-id=\"adf-search-chip-autocomplete-btn-clear\" (click)=\"reset()\">\n {{ 'SEARCH.FILTER.ACTIONS.CLEAR' | translate }}\n </button>\n <button mat-button color=\"primary\" data-automation-id=\"adf-search-chip-autocomplete-btn-apply\" (click)=\"submitValues()\">\n {{ 'SEARCH.FILTER.ACTIONS.APPLY' | translate }}\n </button>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$2.AsyncPipe, name: "async" }, { kind: "component", type: SearchChipAutocompleteInputComponent, selector: "adf-search-chip-autocomplete-input", inputs: ["autocompleteOptions", "preselectedOptions", "onReset$", "allowOnlyPredefinedValues", "placeholder", "compareOption", "formatChipValue", "filter"], outputs: ["optionsChanged", "inputChanged"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }], encapsulation: i0.ViewEncapsulation.None }); }
6483
6511
  }
6484
6512
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SearchFilterAutocompleteChipsComponent, decorators: [{
6485
6513
  type: Component,
6486
6514
  args: [{ selector: 'adf-search-filter-autocomplete-chips', imports: [CommonModule, SearchChipAutocompleteInputComponent, TranslatePipe, MatButtonModule], encapsulation: ViewEncapsulation.None, template: "<adf-search-chip-autocomplete-input\n [autocompleteOptions]=\"autocompleteOptions$ | async\"\n [preselectedOptions]=\"selectedOptions\"\n [onReset$]=\"reset$\"\n [allowOnlyPredefinedValues]=\"settings.allowOnlyPredefinedValues\"\n (inputChanged)=\"onInputChange($event)\"\n [compareOption]=\"optionComparator\"\n (optionsChanged)=\"onOptionsChange($event)\" />\n\n<div class=\"adf-facet-buttons\" *ngIf=\"!settings?.hideDefaultAction\">\n <button mat-button color=\"primary\" data-automation-id=\"adf-search-chip-autocomplete-btn-clear\" (click)=\"reset()\">\n {{ 'SEARCH.FILTER.ACTIONS.CLEAR' | translate }}\n </button>\n <button mat-button color=\"primary\" data-automation-id=\"adf-search-chip-autocomplete-btn-apply\" (click)=\"submitValues()\">\n {{ 'SEARCH.FILTER.ACTIONS.APPLY' | translate }}\n </button>\n</div>\n" }]
6487
- }], ctorParameters: () => [{ type: TagService }, { type: CategoryService }] });
6515
+ }], ctorParameters: () => [{ type: TagService }, { type: CategoryService }, { type: SitesService }] });
6488
6516
 
6489
6517
  /*!
6490
6518
  * @license