@alfresco/adf-content-services 8.4.0-17806466306 → 8.4.0-17829814673

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.
package/README.md CHANGED
@@ -9,7 +9,6 @@ Contains a variety of components, directives and services used throughout ADF
9
9
  - [Documentation](#documentation)
10
10
  - [Prerequisites](#prerequisites)
11
11
  - [Install](#install)
12
- - [Storybook](#storybook)
13
12
  - [License](#license)
14
13
 
15
14
  <!-- tocstop -->
@@ -34,21 +33,6 @@ necessary configuration, see this [page](https://github.com/Alfresco/alfresco-ng
34
33
  npm install @alfresco/adf-content-services
35
34
  ```
36
35
 
37
- ## Storybook
38
-
39
- In case you would like to aggregate all the stories from content services library use
40
-
41
- ```
42
- nx run content-services:storybook
43
- ```
44
- And navigate to `http://localhost:4400/`.
45
-
46
- To create a Storybook content services library build use
47
-
48
- ```
49
- nx run content-services:build-storybook
50
- ```
51
-
52
36
  ## License
53
37
 
54
38
  [Apache Version 2.0](https://github.com/Alfresco/alfresco-ng2-components/blob/master/LICENSE)
@@ -24,7 +24,6 @@ import * as i4 from '@angular/material/button';
24
24
  import { MatButtonModule } from '@angular/material/button';
25
25
  import * as i5 from '@angular/material/progress-bar';
26
26
  import { MatProgressBarModule } from '@angular/material/progress-bar';
27
- import { Buffer } from 'buffer';
28
27
  import { Router, ActivatedRoute } from '@angular/router';
29
28
  import * as i1$5 from '@angular/cdk/a11y';
30
29
  import { A11yModule } from '@angular/cdk/a11y';
@@ -4541,7 +4540,13 @@ class BaseQueryBuilderService {
4541
4540
  * Encodes filter configuration stored in filterRawParams object.
4542
4541
  */
4543
4542
  encodeQuery() {
4544
- this.encodedQuery = Buffer.from(JSON.stringify(this.filterRawParams)).toString('base64');
4543
+ try {
4544
+ this.encodedQuery = btoa(JSON.stringify(this.filterRawParams));
4545
+ }
4546
+ catch (error) {
4547
+ console.error('Failed to encode query parameters:', error);
4548
+ this.encodedQuery = '';
4549
+ }
4545
4550
  }
4546
4551
  /**
4547
4552
  * Encodes existing filters configuration and updates search query param value.
@@ -6181,6 +6186,7 @@ var AutocompleteField;
6181
6186
  (function (AutocompleteField) {
6182
6187
  AutocompleteField["TAG"] = "TAG";
6183
6188
  AutocompleteField["CATEGORIES"] = "cm:categories";
6189
+ AutocompleteField["LOCATION"] = "SITE";
6184
6190
  })(AutocompleteField || (AutocompleteField = {}));
6185
6191
 
6186
6192
  /*!
@@ -6366,9 +6372,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
6366
6372
  * limitations under the License.
6367
6373
  */
6368
6374
  class SearchFilterAutocompleteChipsComponent {
6369
- constructor(tagService, categoryService) {
6375
+ constructor(tagService, categoryService, sitesService) {
6370
6376
  this.tagService = tagService;
6371
6377
  this.categoryService = categoryService;
6378
+ this.sitesService = sitesService;
6372
6379
  this.startValue = [];
6373
6380
  this.displayValue$ = new ReplaySubject(1);
6374
6381
  this.selectedOptions = [];
@@ -6429,8 +6436,13 @@ class SearchFilterAutocompleteChipsComponent {
6429
6436
  this.submitValues();
6430
6437
  }
6431
6438
  onInputChange(value) {
6432
- if (this.settings.field === AutocompleteField.CATEGORIES && value) {
6433
- this.searchForExistingCategories(value);
6439
+ if (value) {
6440
+ if (this.settings.field === AutocompleteField.CATEGORIES) {
6441
+ this.searchForExistingCategories(value);
6442
+ }
6443
+ else if (this.settings.field === AutocompleteField.LOCATION) {
6444
+ this.populateSitesOptions();
6445
+ }
6434
6446
  }
6435
6447
  }
6436
6448
  optionComparator(option1, option2) {
@@ -6441,11 +6453,16 @@ class SearchFilterAutocompleteChipsComponent {
6441
6453
  this.displayValue$.next(this.selectedOptions.map((option) => option.value).join(', '));
6442
6454
  if (this.context && this.settings && this.settings.field) {
6443
6455
  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}"`);
6456
+ switch (this.settings.field) {
6457
+ case AutocompleteField.CATEGORIES:
6458
+ queryFragments = this.selectedOptions.map((val) => `${this.settings.field}:"workspace://SpacesStore/${val.id}"`);
6459
+ break;
6460
+ case AutocompleteField.LOCATION:
6461
+ queryFragments = this.selectedOptions.map((val) => val.query ?? `${this.settings.field}:"${val.id}"`);
6462
+ break;
6463
+ default:
6464
+ queryFragments = this.selectedOptions.map((val) => val.query ?? `${this.settings.field}:"${val.value}"`);
6465
+ break;
6449
6466
  }
6450
6467
  this.context.queryFragments[this.id] = queryFragments.join(' OR ');
6451
6468
  if (updateContext) {
@@ -6465,6 +6482,9 @@ class SearchFilterAutocompleteChipsComponent {
6465
6482
  case AutocompleteField.CATEGORIES:
6466
6483
  this.autocompleteOptionsSubject$.next([]);
6467
6484
  break;
6485
+ case AutocompleteField.LOCATION:
6486
+ this.autocompleteOptionsSubject$.next([]);
6487
+ break;
6468
6488
  default:
6469
6489
  this.autocompleteOptionsSubject$.next(this.settings.autocompleteOptions);
6470
6490
  }
@@ -6478,13 +6498,26 @@ class SearchFilterAutocompleteChipsComponent {
6478
6498
  }));
6479
6499
  });
6480
6500
  }
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 }); }
6501
+ populateSitesOptions() {
6502
+ this.sitesService
6503
+ .getSites()
6504
+ .pipe(map((sites) => {
6505
+ const predefinedOptions = this.settings?.autocompleteOptions || [];
6506
+ const sitesOptions = sites.list.entries.map((siteEntry) => ({
6507
+ id: siteEntry.entry.id,
6508
+ value: siteEntry.entry.title
6509
+ }));
6510
+ return [...sitesOptions, ...predefinedOptions];
6511
+ }))
6512
+ .subscribe((options) => this.autocompleteOptionsSubject$.next(options));
6513
+ }
6514
+ 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
6515
  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
6516
  }
6484
6517
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SearchFilterAutocompleteChipsComponent, decorators: [{
6485
6518
  type: Component,
6486
6519
  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 }] });
6520
+ }], ctorParameters: () => [{ type: TagService }, { type: CategoryService }, { type: SitesService }] });
6488
6521
 
6489
6522
  /*!
6490
6523
  * @license