@alfresco/adf-content-services 8.4.0-20032496569 → 8.4.0-20057628612

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.
@@ -4209,6 +4209,13 @@ class BaseQueryBuilderService {
4209
4209
  this._searchApi = this._searchApi ?? new SearchApi(this.alfrescoApiService.getInstance());
4210
4210
  return this._searchApi;
4211
4211
  }
4212
+ get queryFragments() {
4213
+ return this._queryFragments;
4214
+ }
4215
+ set queryFragments(value) {
4216
+ this._queryFragments = this.createQueryFragmentsProxy(value);
4217
+ this.queryFragmentsUpdate.next(this._queryFragments);
4218
+ }
4212
4219
  get userQuery() {
4213
4220
  return this._userQuery;
4214
4221
  }
@@ -4237,14 +4244,25 @@ class BaseQueryBuilderService {
4237
4244
  this.filterQueryUpdate = new Subject();
4238
4245
  /* Stream that emits the initial value for some or all search filters */
4239
4246
  this.populateFilters = new BehaviorSubject({});
4247
+ /* Stream that emits every time queryFragments change */
4248
+ this.queryFragmentsUpdate = new BehaviorSubject({});
4249
+ /* Stream that emits every time userFacetBuckets change */
4250
+ this.userFacetBucketsUpdate = new BehaviorSubject({});
4240
4251
  this.categories = [];
4241
- this.queryFragments = {};
4242
4252
  this.filterQueries = [];
4243
4253
  this.filterRawParams = {};
4244
4254
  this.paging = null;
4245
4255
  this.sorting = [];
4246
4256
  this.sortingOptions = [];
4247
4257
  this._userQuery = '';
4258
+ this._queryFragments = {};
4259
+ this.queryFragmentsHandler = {
4260
+ set: (target, property, value) => {
4261
+ target[property] = value;
4262
+ this.queryFragmentsUpdate.next(this._queryFragments);
4263
+ return true;
4264
+ }
4265
+ };
4248
4266
  this.userFacetBuckets = {};
4249
4267
  this.config = {
4250
4268
  categories: []
@@ -4252,6 +4270,7 @@ class BaseQueryBuilderService {
4252
4270
  // TODO: to be supported in future iterations
4253
4271
  this.ranges = {};
4254
4272
  this.resetToDefaults();
4273
+ this._queryFragments = this.createQueryFragmentsProxy({});
4255
4274
  }
4256
4275
  resetToDefaults(withNavigate = false) {
4257
4276
  if (withNavigate) {
@@ -4281,10 +4300,10 @@ class BaseQueryBuilderService {
4281
4300
  const currentConfig = this.loadConfiguration();
4282
4301
  if (Array.isArray(currentConfig) && currentConfig[index] !== undefined) {
4283
4302
  this.selectedConfiguration = index;
4284
- this.configUpdated.next(currentConfig[index]);
4285
4303
  this.searchForms.next(this.getSearchFormDetails());
4286
4304
  this.resetSearchOptions();
4287
4305
  this.setUpSearchConfiguration(currentConfig[index]);
4306
+ this.configUpdated.next(currentConfig[index]);
4288
4307
  this.update();
4289
4308
  }
4290
4309
  }
@@ -4348,6 +4367,7 @@ class BaseQueryBuilderService {
4348
4367
  buckets.push(bucket);
4349
4368
  }
4350
4369
  this.userFacetBuckets[field] = buckets;
4370
+ this.userFacetBucketsUpdate.next(this.userFacetBuckets);
4351
4371
  }
4352
4372
  }
4353
4373
  /**
@@ -4369,6 +4389,7 @@ class BaseQueryBuilderService {
4369
4389
  if (field && bucket) {
4370
4390
  const buckets = this.userFacetBuckets[field] || [];
4371
4391
  this.userFacetBuckets[field] = buckets.filter((facetBucket) => facetBucket.label !== bucket.label);
4392
+ this.userFacetBucketsUpdate.next(this.userFacetBuckets);
4372
4393
  }
4373
4394
  }
4374
4395
  /**
@@ -4696,6 +4717,9 @@ class BaseQueryBuilderService {
4696
4717
  queryParamsHandling: 'merge'
4697
4718
  });
4698
4719
  }
4720
+ createQueryFragmentsProxy(target) {
4721
+ return new Proxy(target, this.queryFragmentsHandler);
4722
+ }
4699
4723
  }
4700
4724
 
4701
4725
  /*!