@colijnit/catalog 12.1.49 → 12.1.50

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.
@@ -2,8 +2,9 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, EventEmitter, Component, ViewEncapsulation, Input, Output, HostBinding, ChangeDetectorRef, ViewChild, ElementRef, Pipe, NgModule, Host, Directive, HostListener } from '@angular/core';
3
3
  import { CommonModule } from '@angular/common';
4
4
  import { __awaiter } from 'tslib';
5
- import { Subject, BehaviorSubject } from 'rxjs';
5
+ import { Subject, BehaviorSubject, Observable } from 'rxjs';
6
6
  import { Options } from '@colijnit/ioneconnector/build/model/options';
7
+ import { ArticleExtendedRequest } from '@colijnit/articleapi/build/model/article-extended-request';
7
8
  import { StringUtils } from '@colijnit/ioneconnector/build/utils/string-utils';
8
9
  import { ArticleCategory } from '@colijnit/articleapi/build/model/article-category';
9
10
  import { CatalogDefinition } from '@colijnit/articleapi/build/model/catalog-definition.bo';
@@ -32,7 +33,6 @@ import { ExternalCatalogStartupInfo } from '@colijnit/articleapi/build/model/ext
32
33
  import { ObjectUtils } from '@colijnit/ioneconnector/build/utils/object-utils';
33
34
  import { FileUtils } from '@colijnit/ioneconnector/build/utils/file-utils';
34
35
  import { FilterViewmodel, FilterItemViewmodel, FilterItemModule, InputTextModule, ButtonModule, IconModule, FilterItemMode as FilterItemMode$1, InputDatePickerModule, IconCollapseHandleModule, CoDialogModule, ListOfValuesModule, CheckmarkOverlayModule, ImageModule, OverlayModule, OverlayService, InputSearchModule, PaginationBarModule } from '@colijnit/corecomponents_v12';
35
- import { ArticleExtendedRequest } from '@colijnit/articleapi/build/model/article-extended-request';
36
36
  import { PagingParameters } from '@colijnit/ioneconnector/build/model/paging-parameters';
37
37
  import { trigger, state, style, transition, animate } from '@angular/animations';
38
38
  import * as i1 from '@angular/platform-browser';
@@ -47,8 +47,8 @@ class Version {
47
47
  constructor() {
48
48
  this.name = "@colijnit/catalog";
49
49
  this.description = "iOne Catalog module based on Angular 12";
50
- this.symVer = "12.1.49";
51
- this.publishDate = "16-10-2023 12:30:16";
50
+ this.symVer = "12.1.50";
51
+ this.publishDate = "19-10-2023 12:13:28";
52
52
  }
53
53
  }
54
54
 
@@ -76,6 +76,7 @@ class CatalogSettings extends Options {
76
76
  super(...arguments);
77
77
  this.type = "V";
78
78
  this.createWebOrder = true;
79
+ this.catalogParameters = new ArticleExtendedRequest();
79
80
  this.options = new SettingsOptions();
80
81
  this.useLoginEncryption = true;
81
82
  }
@@ -1682,6 +1683,7 @@ class CatalogSearchService {
1682
1683
  this.showFilterSidebar = false;
1683
1684
  this.articles = [];
1684
1685
  this.articlesPerPage = 20;
1686
+ this._clearCacheObservable = new Observable();
1685
1687
  this._currentPage = 1;
1686
1688
  this._subs = [];
1687
1689
  this._subs.push(this._optionService.parametersSet.subscribe((isSet) => {
@@ -1698,6 +1700,17 @@ class CatalogSearchService {
1698
1700
  }
1699
1701
  }));
1700
1702
  }
1703
+ set clearCacheObservable(value) {
1704
+ if (this._clearCacheSubscription) {
1705
+ this._clearCacheSubscription.unsubscribe();
1706
+ }
1707
+ this._clearCacheObservable = value;
1708
+ this._clearCacheSubscription = this._clearCacheObservable.subscribe((shouldClear) => {
1709
+ if (shouldClear) {
1710
+ this._clearCache();
1711
+ }
1712
+ });
1713
+ }
1701
1714
  set turnoverGroup(value) {
1702
1715
  this._setRequestParametersAndProps(null, value, null);
1703
1716
  // this.turnoverGroupChanged.next(this.turnoverGroup);
@@ -1722,6 +1735,9 @@ class CatalogSearchService {
1722
1735
  this.searchArticles(false);
1723
1736
  }
1724
1737
  ngOnDestroy() {
1738
+ if (this._clearCacheSubscription) {
1739
+ this._clearCacheSubscription.unsubscribe();
1740
+ }
1725
1741
  this._subs.forEach(s => s.unsubscribe());
1726
1742
  }
1727
1743
  searchArticles(resetPaging = true) {
@@ -1735,9 +1751,8 @@ class CatalogSearchService {
1735
1751
  }
1736
1752
  this.searchRequest.paging = new PagingParameters(lowerBound, lowerBound + this.articlesPerPage - 1, this.articlesPerPage);
1737
1753
  this._catalogConnectorService.getArticlesForCatalog(this.searchRequest).then((result) => {
1738
- var _a, _b;
1739
- this.articles = (_a = result.articles) !== null && _a !== void 0 ? _a : [];
1740
- this.resultCount = (_b = result.count) !== null && _b !== void 0 ? _b : undefined;
1754
+ this.articles = result && result.articles ? result.articles : [];
1755
+ this.resultCount = result && result.count ? result.count : 0;
1741
1756
  this._filterService.getFilters(this.searchRequest);
1742
1757
  });
1743
1758
  }
@@ -1761,6 +1776,11 @@ class CatalogSearchService {
1761
1776
  this.showFilterSidebar = true;
1762
1777
  }, 10);
1763
1778
  }
1779
+ _clearCache() {
1780
+ this._resetRequest();
1781
+ this._settingsService.settings.catalogParameters = new ArticleExtendedRequest();
1782
+ this.articles.length = 0;
1783
+ }
1764
1784
  _resetRequest() {
1765
1785
  this.searchRequest = new ArticleExtendedRequest();
1766
1786
  }