@colijnit/catalog 12.1.29 → 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.29";
34
- this.publishDate = "22-4-2023 12:13:18";
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*/];