@elderbyte/ngx-starter 22.7.0 → 22.7.1

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.
@@ -28340,6 +28340,7 @@ class ElderSearchContextDirective {
28340
28340
  **************************************************************************/
28341
28341
  this.log = LoggerFactory.getLogger(this.constructor.name);
28342
28342
  this.initialFilters = [];
28343
+ this._forcedFilters$ = new BehaviorSubject([]);
28343
28344
  this._searchInputs$ = new BehaviorSubject([]);
28344
28345
  this._searchStates$ = new BehaviorSubject([]);
28345
28346
  this._filterContext$ = new BehaviorSubject(null);
@@ -28355,12 +28356,12 @@ class ElderSearchContextDirective {
28355
28356
  * *
28356
28357
  **************************************************************************/
28357
28358
  ngOnInit() {
28358
- this.applyDefaultFiltersToSearchContext();
28359
+ this.bindForcedFiltersToSearchContext();
28360
+ this.applyDefaultFiltersToSearchContext(this.searchContext);
28359
28361
  this.syncSearchContextToBoundFilterContext();
28360
28362
  }
28361
28363
  ngAfterViewInit() {
28362
- const searchContext = this.searchContext;
28363
- this.applySearchContextToInputs(searchContext);
28364
+ this.applySearchContextToInputs(this.searchContext);
28364
28365
  this.syncSearchInputsToSearchContext();
28365
28366
  }
28366
28367
  /***************************************************************************
@@ -28409,10 +28410,10 @@ class ElderSearchContextDirective {
28409
28410
  * to also keep the users intent (by merging) them.
28410
28411
  */
28411
28412
  set forcedFilters(filters) {
28412
- this.searchContext.replaceForcedFilters(filters);
28413
+ this._forcedFilters$.next(filters);
28413
28414
  }
28414
28415
  get forcedFilters() {
28415
- return this.searchContext.forcedFilters;
28416
+ return this._forcedFilters$.getValue();
28416
28417
  }
28417
28418
  get attributes() {
28418
28419
  return this._searchInputs$.asObservable();
@@ -28462,9 +28463,8 @@ class ElderSearchContextDirective {
28462
28463
  searchInputs() {
28463
28464
  return this._searchInputs$.getValue();
28464
28465
  }
28465
- applyDefaultFiltersToSearchContext() {
28466
+ applyDefaultFiltersToSearchContext(searchContext) {
28466
28467
  const dcFilters = this.filterContext;
28467
- const searchContext = this.searchContext;
28468
28468
  if (searchContext.userFilters.length === 0) {
28469
28469
  this.applyAsDefaultsUntilUserAction(searchContext, dcFilters);
28470
28470
  }
@@ -28490,6 +28490,15 @@ class ElderSearchContextDirective {
28490
28490
  searchContext.updateUserFilters(inputFilters);
28491
28491
  });
28492
28492
  }
28493
+ bindForcedFiltersToSearchContext() {
28494
+ this._searchContext$
28495
+ .pipe(takeUntilDestroyed(this.destroyRef), filter((context) => !!context), combineLatestWith(this._forcedFilters$))
28496
+ .subscribe({
28497
+ next: ([context, forced]) => {
28498
+ context.replaceForcedFilters(forced);
28499
+ },
28500
+ });
28501
+ }
28493
28502
  syncSearchContextToBoundFilterContext() {
28494
28503
  this._searchContext$
28495
28504
  .pipe(takeUntilDestroyed(this.destroyRef), switchMap$1((context) => context.allFiltersChanged))