@colijnit/catalog 12.1.28 → 12.1.30

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.
@@ -30,8 +30,8 @@
30
30
  function Version() {
31
31
  this.name = "@colijnit/catalog";
32
32
  this.description = "iOne Catalog module based on Angular 12";
33
- this.symVer = "12.1.28";
34
- this.publishDate = "21-4-2023 16:40:30";
33
+ this.symVer = "12.1.30";
34
+ this.publishDate = "29-4-2023 10:53:53";
35
35
  }
36
36
  return Version;
37
37
  }());
@@ -2163,43 +2163,43 @@
2163
2163
  var filterProms = [];
2164
2164
  filterProms.push(this._iOneController.getCatalogFilter(filters).then(function (filter) {
2165
2165
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2166
- newFilters.push(new FilterViewmodel(filter));
2166
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Catalog'));
2167
2167
  }
2168
2168
  }), this._iOneController.getArticleGroupsFilter(filters).then(function (filter) {
2169
2169
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2170
- newFilters.push(new FilterViewmodel(filter));
2170
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Product group'));
2171
2171
  }
2172
2172
  }), this._iOneController.getAtmosphereFilter(filters).then(function (filter) {
2173
2173
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2174
- newFilters.push(new FilterViewmodel(filter));
2174
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Atmosphere'));
2175
2175
  }
2176
2176
  }), this._iOneController.getColorFilter(filters).then(function (filter) {
2177
2177
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2178
- newFilters.push(new FilterViewmodel(filter));
2178
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Colour'));
2179
2179
  }
2180
2180
  }), this._iOneController.getConceptFilter(filters).then(function (filter) {
2181
2181
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2182
- newFilters.push(new FilterViewmodel(filter));
2182
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Concept'));
2183
2183
  }
2184
2184
  }), this._iOneController.getDesignFilter(filters).then(function (filter) {
2185
2185
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2186
- newFilters.push(new FilterViewmodel(filter));
2186
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Design'));
2187
2187
  }
2188
2188
  }), this._iOneController.getMainArticleFilter(filters).then(function (filter) {
2189
2189
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2190
- newFilters.push(new FilterViewmodel(filter));
2190
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Main article'));
2191
2191
  }
2192
2192
  }), this._iOneController.getMaterialFilter(filters).then(function (filter) {
2193
2193
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2194
- newFilters.push(new FilterViewmodel(filter));
2194
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Material'));
2195
2195
  }
2196
2196
  }), this._iOneController.getTagsFilter(filters).then(function (filter) {
2197
2197
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2198
- newFilters.push(new FilterViewmodel(filter));
2198
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Tag'));
2199
2199
  }
2200
2200
  }), this._iOneController.getTurnoverGroupFilter(filters).then(function (filter) {
2201
2201
  if (filter.selectionDTOS && filter.selectionDTOS.length > 0) {
2202
- newFilters.push(new FilterViewmodel(filter));
2202
+ newFilters.push(_this.createNewFiltersAndCopySelections(filter, 'Turnover group'));
2203
2203
  }
2204
2204
  }));
2205
2205
  Promise.all(filterProms).then(function () {
@@ -2207,6 +2207,33 @@
2207
2207
  _this.filters = newFilters;
2208
2208
  });
2209
2209
  };
2210
+ CatalogFilterService.prototype.createNewFiltersAndCopySelections = function (filter, key) {
2211
+ var e_1, _a;
2212
+ var newModel = new FilterViewmodel(filter);
2213
+ var oldModel = this.filters.find(function (element) { return element.filterName === key; });
2214
+ if (oldModel) {
2215
+ var _loop_1 = function (oldFilter) {
2216
+ var newFilter = newModel.filterItems.find(function (element) { return element.code === oldFilter.code; });
2217
+ if (newFilter) {
2218
+ newFilter.checked = oldFilter.checked;
2219
+ }
2220
+ };
2221
+ try {
2222
+ for (var _b = __values(oldModel.filterItems), _c = _b.next(); !_c.done; _c = _b.next()) {
2223
+ var oldFilter = _c.value;
2224
+ _loop_1(oldFilter);
2225
+ }
2226
+ }
2227
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2228
+ finally {
2229
+ try {
2230
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2231
+ }
2232
+ finally { if (e_1) throw e_1.error; }
2233
+ }
2234
+ }
2235
+ return newModel;
2236
+ };
2210
2237
  CatalogFilterService.prototype.getFilterItemMap = function (key) {
2211
2238
  return this.filterItemMap.get(key);
2212
2239
  };
@@ -2430,9 +2457,9 @@
2430
2457
  this._controllerInitialized = true;
2431
2458
  // this.ensureDataListsLoaded();
2432
2459
  this.articlesPerPage = this._settingsService.settings.options.maxItemsPerPage;
2433
- if (this._settingsService.settings.options.searchOnStart) {
2434
- this._catalogSearchService.searchArticles();
2435
- }
2460
+ // if (this._settingsService.settings.options.searchOnStart) {
2461
+ // this._catalogSearchService.searchArticles();
2462
+ // }
2436
2463
  }
2437
2464
  return [2 /*return*/];
2438
2465
  });
@@ -2522,14 +2549,15 @@
2522
2549
  CatalogService.prototype.ngOnDestroy = function () {
2523
2550
  this._subs.forEach(function (s) { return s.unsubscribe(); });
2524
2551
  };
2525
- CatalogService.prototype.init = function (settings) {
2552
+ CatalogService.prototype.init = function (settings, forceReload) {
2553
+ if (forceReload === void 0) { forceReload = false; }
2526
2554
  return __awaiter(this, void 0, void 0, function () {
2527
2555
  return __generator(this, function (_a) {
2528
2556
  switch (_a.label) {
2529
2557
  case 0: return [4 /*yield*/, this.settingsService.initializeSettings(settings)];
2530
2558
  case 1:
2531
2559
  _a.sent();
2532
- return [4 /*yield*/, this.connector.initConnector(this.settingsService.settings)];
2560
+ return [4 /*yield*/, this.connector.initConnector(this.settingsService.settings, forceReload)];
2533
2561
  case 2:
2534
2562
  _a.sent();
2535
2563
  return [2 /*return*/];
@@ -3306,8 +3334,9 @@
3306
3334
  this._catalogSearchService = _catalogSearchService;
3307
3335
  this._catalogEventService = _catalogEventService;
3308
3336
  this.showNavigation = false;
3337
+ this.showLandingPage = false;
3309
3338
  this.showFilter = false;
3310
- this.showViewModes = true;
3339
+ this.showViewModes = false;
3311
3340
  this.onLookAtArticleButtonClick = new i0.EventEmitter();
3312
3341
  this.onArButtonClick = new i0.EventEmitter();
3313
3342
  this.onAddArticleButtonClick = new i0.EventEmitter();
@@ -3348,7 +3377,7 @@
3348
3377
  CatalogSearchComponent.decorators = [
3349
3378
  { type: i0.Component, args: [{
3350
3379
  selector: 'co-catalog-search',
3351
- template: "\n <div class=\"catalog-search-wrapper\">\n <ng-container *ngIf=\"showFilter\">\n <div class=\"filter-content\">\n <co-catalog-filter [showResetFilter]=\"true\"></co-catalog-filter>\n </div>\n </ng-container>\n <div class=\"search-content-wrapper\">\n <div class=\"search-header\">\n<!--\n <co-catalog-external-sources></co-catalog-external-sources>\n-->\n <co-catalog-search-header [placeholder]=\"'Zoeken naar artikelen'\"></co-catalog-search-header>\n </div>\n <ng-container *ngIf=\"showViewModes\">\n <button (click)=\"mode = 'tile'\">tile</button>\n <button (click)=\"mode = 'list'\">list</button>\n <button (click)=\"mode = 'grid'\">grid</button>\n </ng-container>\n <co-catalog-navigation *ngIf=\"showNavigation\" (categoryClick)=\"handleCategoryClick($event)\" (turnoverGroupClick)=\"handleTurnoverGroupClick($event)\"></co-catalog-navigation>\n <co-catalog-categories (categoryClick)=\"handleCategoryClick($event)\" (turnoverGroupClick)=\"handleTurnoverGroupClick($event)\"></co-catalog-categories>\n <div class=\"search-content\">\n <ng-container *ngIf=\"mode === 'tile'\">\n <co-catalog-search-result-tile></co-catalog-search-result-tile>\n </ng-container>\n <ng-container *ngIf=\"mode === 'list'\">\n <co-catalog-search-result-list></co-catalog-search-result-list>\n </ng-container>\n <ng-container *ngIf=\"mode === 'grid'\">\n <!--\n <co-catalog-search-result></co-catalog-search-result>\n -->\n </ng-container>\n </div>\n </div>\n </div>\n ",
3380
+ template: "\n <div class=\"catalog-search-wrapper\">\n <ng-container *ngIf=\"showFilter\">\n <div class=\"filter-content\">\n <co-catalog-filter [showResetFilter]=\"true\"></co-catalog-filter>\n </div>\n </ng-container>\n <div class=\"search-content-wrapper\">\n <div class=\"search-header\">\n<!--\n <co-catalog-external-sources></co-catalog-external-sources>\n-->\n <co-catalog-search-header [placeholder]=\"'Zoeken naar artikelen'\"></co-catalog-search-header>\n </div>\n <ng-container *ngIf=\"showViewModes\">\n <button (click)=\"mode = 'tile'\">tile</button>\n <button (click)=\"mode = 'list'\">list</button>\n <button (click)=\"mode = 'grid'\">grid</button>\n </ng-container>\n <co-catalog-navigation *ngIf=\"showNavigation\" (categoryClick)=\"handleCategoryClick($event)\" (turnoverGroupClick)=\"handleTurnoverGroupClick($event)\"></co-catalog-navigation>\n <co-catalog-categories *ngIf=\"showLandingPage\" (categoryClick)=\"handleCategoryClick($event)\" (turnoverGroupClick)=\"handleTurnoverGroupClick($event)\"></co-catalog-categories>\n <div class=\"search-content\">\n <ng-container *ngIf=\"mode === 'tile'\">\n <co-catalog-search-result-tile></co-catalog-search-result-tile>\n </ng-container>\n <ng-container *ngIf=\"mode === 'list'\">\n <co-catalog-search-result-list></co-catalog-search-result-list>\n </ng-container>\n <ng-container *ngIf=\"mode === 'grid'\">\n <!--\n <co-catalog-search-result></co-catalog-search-result>\n -->\n </ng-container>\n </div>\n </div>\n </div>\n ",
3352
3381
  encapsulation: i0.ViewEncapsulation.None
3353
3382
  },] }
3354
3383
  ];
@@ -3358,6 +3387,7 @@
3358
3387
  ]; };
3359
3388
  CatalogSearchComponent.propDecorators = {
3360
3389
  showNavigation: [{ type: i0.Input }],
3390
+ showLandingPage: [{ type: i0.Input }],
3361
3391
  showFilter: [{ type: i0.Input }],
3362
3392
  showViewModes: [{ type: i0.Input }],
3363
3393
  onLookAtArticleButtonClick: [{ type: i0.Output }],
@@ -3563,6 +3593,9 @@
3563
3593
  this.onArButtonClick.emit(this.article);
3564
3594
  };
3565
3595
  ArticleBaseComponent.prototype.removeHtmlTags = function (desc) {
3596
+ if (!desc) {
3597
+ return "";
3598
+ }
3566
3599
  desc = desc.replace(/\r?\n|\r/, '');
3567
3600
  return desc;
3568
3601
  };
@@ -3570,7 +3603,11 @@
3570
3603
  return __awaiter(this, void 0, void 0, function () {
3571
3604
  return __generator(this, function (_a) {
3572
3605
  switch (_a.label) {
3573
- case 0: return [4 /*yield*/, this._iOne.getJsonArticleFlatTree(article.goodId, article.goodType, 1)];
3606
+ case 0:
3607
+ if (!article) {
3608
+ return [2 /*return*/, ""];
3609
+ }
3610
+ return [4 /*yield*/, this._iOne.getJsonArticleFlatTree(article.goodId, article.goodType, 1)];
3574
3611
  case 1: return [2 /*return*/, _a.sent()];
3575
3612
  }
3576
3613
  });
@@ -4028,6 +4065,7 @@
4028
4065
  exports.CatalogArticleListModule = CatalogArticleListModule;
4029
4066
  exports.CatalogArticleTileModule = CatalogArticleTileModule;
4030
4067
  exports.CatalogCategoriesModule = CatalogCategoriesModule;
4068
+ exports.CatalogEventService = CatalogEventService;
4031
4069
  exports.CatalogExternalSourceModule = CatalogExternalSourceModule;
4032
4070
  exports.CatalogExternalSourcesModule = CatalogExternalSourcesModule;
4033
4071
  exports.CatalogFilterModule = CatalogFilterModule;
@@ -4041,14 +4079,13 @@
4041
4079
  exports.Version = Version;
4042
4080
  exports["ɵa"] = CatalogFilterComponent;
4043
4081
  exports["ɵb"] = CatalogFilterService;
4044
- exports["ɵba"] = VisibilityObserverMasterDirective;
4045
- exports["ɵbb"] = VisibilityObserverDirective;
4046
- exports["ɵbc"] = CatalogSearchResultTileComponent;
4047
- exports["ɵbd"] = CatalogSearchBaseComponent;
4048
- exports["ɵbe"] = CatalogArticleListComponent;
4049
- exports["ɵbf"] = CatalogSearchResultListComponent;
4050
- exports["ɵbg"] = CatalogSearchComponent;
4051
- exports["ɵbh"] = CatalogExternalSourceComponent;
4082
+ exports["ɵba"] = VisibilityObserverDirective;
4083
+ exports["ɵbb"] = CatalogSearchResultTileComponent;
4084
+ exports["ɵbc"] = CatalogSearchBaseComponent;
4085
+ exports["ɵbd"] = CatalogArticleListComponent;
4086
+ exports["ɵbe"] = CatalogSearchResultListComponent;
4087
+ exports["ɵbf"] = CatalogSearchComponent;
4088
+ exports["ɵbg"] = CatalogExternalSourceComponent;
4052
4089
  exports["ɵc"] = CatalogConnectorService;
4053
4090
  exports["ɵd"] = CatalogConnectorAdapterService;
4054
4091
  exports["ɵe"] = SelectSingleCacheService;
@@ -4068,11 +4105,11 @@
4068
4105
  exports["ɵs"] = CatalogImageService;
4069
4106
  exports["ɵt"] = CatalogExternalSourcesComponent;
4070
4107
  exports["ɵu"] = CatalogNavigationComponent;
4071
- exports["ɵv"] = CatalogEventService;
4072
- exports["ɵw"] = CatalogSearchHeaderComponent;
4073
- exports["ɵx"] = CatalogArticleTileComponent;
4074
- exports["ɵy"] = ArticleBaseComponent;
4075
- exports["ɵz"] = VisibilityObserverModule;
4108
+ exports["ɵv"] = CatalogSearchHeaderComponent;
4109
+ exports["ɵw"] = CatalogArticleTileComponent;
4110
+ exports["ɵx"] = ArticleBaseComponent;
4111
+ exports["ɵy"] = VisibilityObserverModule;
4112
+ exports["ɵz"] = VisibilityObserverMasterDirective;
4076
4113
 
4077
4114
  Object.defineProperty(exports, '__esModule', { value: true });
4078
4115