@firestitch/filter 9.9.7 → 9.10.0

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.
@@ -4,6 +4,7 @@ import { MatInput } from '@angular/material/input';
4
4
  import { Observable } from 'rxjs';
5
5
  import { FsFilterConfig } from '../../models/filter-config';
6
6
  import { FsFilterOverlayService } from '../../services/filter-overlay.service';
7
+ import { IFilterConfigItem } from '../../interfaces/config.interface';
7
8
  import { BaseItem } from '../../models/items/base-item';
8
9
  import { FsFilterItemsStore } from '../../services/items-store.service';
9
10
  import { ExternalParamsController } from '../../services/external-params-controller.service';
@@ -43,8 +44,8 @@ export declare class FilterComponent implements OnInit, AfterViewInit, OnDestroy
43
44
  get config(): FsFilterConfig;
44
45
  get filterParams(): Record<string, unknown>;
45
46
  get filterParamsQuery(): Record<string, unknown>;
46
- get items(): BaseItem<import("../../interfaces/config.interface").IFilterConfigItem>[];
47
- get visibleItems(): BaseItem<import("../../interfaces/config.interface").IFilterConfigItem>[];
47
+ get items(): BaseItem<IFilterConfigItem>[];
48
+ get visibleItems(): BaseItem<IFilterConfigItem>[];
48
49
  get itemsReady$(): Observable<boolean>;
49
50
  get hasFilterChips$(): Observable<boolean>;
50
51
  get hasVisibleItemOrSorting(): boolean;
@@ -170,6 +171,7 @@ export declare class FilterComponent implements OnInit, AfterViewInit, OnDestroy
170
171
  * Go through actions and check disabled() callback and update disabled state
171
172
  */
172
173
  updateDisabledState(): void;
174
+ setItems(items: IFilterConfigItem[]): void;
173
175
  private _initFilterWithConfig;
174
176
  private _destroyFilterDrawer;
175
177
  private _updateWindowWidth;
@@ -177,6 +179,7 @@ export declare class FilterComponent implements OnInit, AfterViewInit, OnDestroy
177
179
  private _listenInputKeyEvents;
178
180
  private _listenWindowResize;
179
181
  private _listenInputChanges;
182
+ private _syncSearchInputWithKeyword;
180
183
  private _listenKeywordItemClear;
181
184
  private _listenInternalItemsChange;
182
185
  private _initOverlay;
@@ -28,6 +28,7 @@ export declare class ExternalParamsController implements OnDestroy {
28
28
  setConfig(config: any): void;
29
29
  setActiveSavedFilter(savedFilter: IFilterSavedFilter): void;
30
30
  reloadFiltersWithValues(params: IFilterExternalParams, shouldResetSavedFilters?: boolean): void;
31
+ initItems(): void;
31
32
  _initItemsValues(): void;
32
33
  private _initPersistance;
33
34
  private _initQueryParams;
@@ -2640,11 +2640,27 @@
2640
2640
  this._destroy$.complete();
2641
2641
  };
2642
2642
  ExternalParamsController.prototype.setConfig = function (config) {
2643
- var _this = this;
2644
2643
  this._config = config;
2645
2644
  this._initPersistance();
2646
2645
  this._initQueryParams();
2647
2646
  this._initSavedFilters();
2647
+ this.initItems();
2648
+ };
2649
+ ExternalParamsController.prototype.setActiveSavedFilter = function (savedFilter) {
2650
+ this.savedFiltersController.setActiveFilter(savedFilter);
2651
+ if (savedFilter) {
2652
+ this.reloadFiltersWithValues(savedFilter.filters, false);
2653
+ }
2654
+ };
2655
+ ExternalParamsController.prototype.reloadFiltersWithValues = function (params, shouldResetSavedFilters) {
2656
+ if (shouldResetSavedFilters === void 0) { shouldResetSavedFilters = true; }
2657
+ this._shouldResetSavedFilters = shouldResetSavedFilters;
2658
+ this._itemsStore.updateItemsWithValues(params);
2659
+ this._saveQueryParams();
2660
+ this._savePersistedParams();
2661
+ };
2662
+ ExternalParamsController.prototype.initItems = function () {
2663
+ var _this = this;
2648
2664
  this._pending$.next(true);
2649
2665
  if (this._savedFilters.enabled) {
2650
2666
  this._savedFilters
@@ -2663,19 +2679,6 @@
2663
2679
  }
2664
2680
  this._listenItemsChange();
2665
2681
  };
2666
- ExternalParamsController.prototype.setActiveSavedFilter = function (savedFilter) {
2667
- this.savedFiltersController.setActiveFilter(savedFilter);
2668
- if (savedFilter) {
2669
- this.reloadFiltersWithValues(savedFilter.filters, false);
2670
- }
2671
- };
2672
- ExternalParamsController.prototype.reloadFiltersWithValues = function (params, shouldResetSavedFilters) {
2673
- if (shouldResetSavedFilters === void 0) { shouldResetSavedFilters = true; }
2674
- this._shouldResetSavedFilters = shouldResetSavedFilters;
2675
- this._itemsStore.updateItemsWithValues(params);
2676
- this._saveQueryParams();
2677
- this._savePersistedParams();
2678
- };
2679
2682
  ExternalParamsController.prototype._initItemsValues = function () {
2680
2683
  this._itemsStore.initItemValues(this.params);
2681
2684
  this._saveQueryParams();
@@ -3868,6 +3871,14 @@
3868
3871
  FilterComponent.prototype.updateDisabledState = function () {
3869
3872
  this._actions.updateDisabledState();
3870
3873
  };
3874
+ FilterComponent.prototype.setItems = function (items) {
3875
+ this._filterItems.destroyItems();
3876
+ this.config.items = items;
3877
+ this._filterItems.setConfig(this._config);
3878
+ this._externalParams.initItems();
3879
+ this._syncSearchInputWithKeyword();
3880
+ this._listenKeywordItemClear();
3881
+ };
3871
3882
  FilterComponent.prototype._initFilterWithConfig = function (config) {
3872
3883
  if (this.config) {
3873
3884
  this._filterItems.destroyItems();
@@ -3877,11 +3888,7 @@
3877
3888
  this._actions.initActions(this._config.actions);
3878
3889
  this._filterItems.setConfig(this._config);
3879
3890
  this._externalParams.setConfig(this._config);
3880
- var keywordItem = this._filterItems.keywordItem;
3881
- if (keywordItem) {
3882
- this.searchText.setValue(keywordItem.model);
3883
- this.searchPlaceholder = keywordItem.label || 'Search';
3884
- }
3891
+ this._syncSearchInputWithKeyword();
3885
3892
  if (!!this.config.reloadWhenConfigChanged) {
3886
3893
  this.change();
3887
3894
  }
@@ -3955,6 +3962,13 @@
3955
3962
  });
3956
3963
  });
3957
3964
  };
3965
+ FilterComponent.prototype._syncSearchInputWithKeyword = function () {
3966
+ var keywordItem = this._filterItems.keywordItem;
3967
+ if (keywordItem) {
3968
+ this.searchText.setValue(keywordItem.model);
3969
+ this.searchPlaceholder = keywordItem.label || 'Search';
3970
+ }
3971
+ };
3958
3972
  FilterComponent.prototype._listenKeywordItemClear = function () {
3959
3973
  var _this = this;
3960
3974
  var _a;