@firestitch/filter 18.2.2 → 18.2.4

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.
@@ -1537,6 +1537,7 @@ class ItemStore {
1537
1537
  this._itemsValuesLoaded = false;
1538
1538
  if (Array.isArray(items)) {
1539
1539
  this._createItems(items);
1540
+ this._setKeywordItem();
1540
1541
  }
1541
1542
  }
1542
1543
  queryParams() {
@@ -1776,7 +1777,6 @@ class ItemStore {
1776
1777
  .pipe(filter$1((state) => state), takeUntil(this._destroy$))
1777
1778
  .subscribe(() => {
1778
1779
  this.updateItemsVisiblity();
1779
- this._setKeywordItem();
1780
1780
  });
1781
1781
  }
1782
1782
  _initSortingItems(p) {
@@ -1916,7 +1916,7 @@ class SavedFilterController {
1916
1916
  }));
1917
1917
  }
1918
1918
  save(savedFilter) {
1919
- const exists = !!savedFilter.id;
1919
+ const exists = !!this.activeFilter.id;
1920
1920
  savedFilter = {
1921
1921
  ...this.activeFilter,
1922
1922
  ...savedFilter,
@@ -1955,6 +1955,9 @@ class SavedFilterController {
1955
1955
  .pipe(tap(() => {
1956
1956
  this.savedFilters = this.savedFilters
1957
1957
  .filter((f) => f.id !== savedFilter.id);
1958
+ if (this.activeFilter?.id === savedFilter.id) {
1959
+ this.setActiveFilter(null);
1960
+ }
1958
1961
  }));
1959
1962
  }
1960
1963
  setActiveFilter(savedFilter) {
@@ -4270,7 +4273,7 @@ class FilterComponent {
4270
4273
  _config = null;
4271
4274
  _sort;
4272
4275
  _filtersBtnVisible$ = new BehaviorSubject(true);
4273
- _keywordVisible$ = new BehaviorSubject(true);
4276
+ _keywordVisible$ = new BehaviorSubject(false);
4274
4277
  _hasFilterChips$ = new BehaviorSubject(false);
4275
4278
  _keyword$ = new Subject();
4276
4279
  _destroy$ = new Subject();
@@ -4342,7 +4345,7 @@ class FilterComponent {
4342
4345
  activeFilter: of(this.savedFiltersController.enabled),
4343
4346
  })
4344
4347
  .pipe(map(({ keywordVisible, activeFilter }) => {
4345
- return !(keywordVisible && this._itemStore.hasKeyword) && !activeFilter;
4348
+ return !keywordVisible && !activeFilter;
4346
4349
  }));
4347
4350
  }
4348
4351
  get notInlineToolbar$() {
@@ -4350,10 +4353,7 @@ class FilterComponent {
4350
4353
  .pipe(map((inline) => !inline));
4351
4354
  }
4352
4355
  get keywordVisible$() {
4353
- return this._keywordVisible$.asObservable()
4354
- .pipe(map((visible) => {
4355
- return visible && this._itemStore.hasKeyword;
4356
- }));
4356
+ return this._keywordVisible$.asObservable();
4357
4357
  }
4358
4358
  get actionsVisible$() {
4359
4359
  return this._actions.visible$;
@@ -4377,12 +4377,7 @@ class FilterComponent {
4377
4377
  return this._savedFilterController;
4378
4378
  }
4379
4379
  ngOnInit() {
4380
- // Avoid ngChanges error
4381
- setTimeout(() => {
4382
- if (this.config.autofocus) {
4383
- this.focus();
4384
- }
4385
- });
4380
+ this._initAutoFocus();
4386
4381
  this._initAutoReload();
4387
4382
  this._listenInputChanges();
4388
4383
  this._listenInternalItemsChange();
@@ -4746,6 +4741,14 @@ class FilterComponent {
4746
4741
  _initKeywordVisibility() {
4747
4742
  this._keywordVisible$.next(!!this.keywordItem && !this.keywordItem?.hide);
4748
4743
  }
4744
+ _initAutoFocus() {
4745
+ // Avoid ngChanges error
4746
+ setTimeout(() => {
4747
+ if (this.config.autofocus) {
4748
+ this.focus();
4749
+ }
4750
+ });
4751
+ }
4749
4752
  _listenInternalItemsChange() {
4750
4753
  this._itemStore
4751
4754
  .itemsChange$