@colijnit/catalog 12.1.12 → 12.1.14

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.
@@ -24,12 +24,15 @@ export declare class CatalogFilterComponent implements OnInit, OnDestroy {
24
24
  constructor(catalog: CatalogService, filterService: FilterService, iconCache: IconCacheService, optionsService: OptionsService, changeDetector: ChangeDetectorRef);
25
25
  ngOnInit(): void;
26
26
  ngOnDestroy(): void;
27
+ initializePriceFilterMinMax(): void;
27
28
  resetFilters(event: MouseEvent): void;
28
29
  onHandleClick(event: MouseEvent): void;
29
30
  updatePriceInputs(range: NumericalRange): void;
30
31
  updateSliderRange(): void;
31
- updatePriceFrom(value: string): void;
32
- updatePriceTo(value: string): void;
32
+ updatePriceFrom(): void;
33
+ updatePriceTo(): void;
34
+ setPriceMinToDefault(): void;
35
+ setPriceMaxToDefault(): void;
33
36
  filterOnPrice(): void;
34
37
  handleCollectionChange(collection: FilterItemViewmodel[]): void;
35
38
  filterOnItem(item: FilterItemViewmodel): void;
@@ -2133,6 +2133,7 @@
2133
2133
  if (window.innerWidth <= 950) {
2134
2134
  this.collapsed = true;
2135
2135
  }
2136
+ this.initializePriceFilterMinMax();
2136
2137
  this.detectChanges();
2137
2138
  };
2138
2139
  CatalogFilterComponent.prototype.ngOnDestroy = function () {
@@ -2141,6 +2142,10 @@
2141
2142
  x.unsubscribe();
2142
2143
  });
2143
2144
  };
2145
+ CatalogFilterComponent.prototype.initializePriceFilterMinMax = function () {
2146
+ this._min = this.filterService.priceMinFilter;
2147
+ this._max = this.filterService.priceMaxFilter;
2148
+ };
2144
2149
  CatalogFilterComponent.prototype.resetFilters = function (event) {
2145
2150
  this.catalog.resetFilters();
2146
2151
  };
@@ -2157,15 +2162,21 @@
2157
2162
  this.priceSlider.setUpperBound(this.filterService.priceMaxFilter, false);
2158
2163
  }
2159
2164
  };
2160
- CatalogFilterComponent.prototype.updatePriceFrom = function (value) {
2161
- this.filterService.priceMinFilter = value ? parseInt(value, 0) : this._min;
2165
+ CatalogFilterComponent.prototype.updatePriceFrom = function () {
2162
2166
  this.updateSliderRange();
2163
2167
  };
2164
- CatalogFilterComponent.prototype.updatePriceTo = function (value) {
2165
- this.filterService.priceMaxFilter = value ? parseInt(value, 0) : this._max;
2168
+ CatalogFilterComponent.prototype.updatePriceTo = function () {
2166
2169
  this.updateSliderRange();
2167
2170
  };
2171
+ CatalogFilterComponent.prototype.setPriceMinToDefault = function () {
2172
+ this.filterService.priceMinFilter = this._min;
2173
+ };
2174
+ CatalogFilterComponent.prototype.setPriceMaxToDefault = function () {
2175
+ this.filterService.priceMaxFilter = this._max;
2176
+ };
2168
2177
  CatalogFilterComponent.prototype.filterOnPrice = function () {
2178
+ this.filterService.priceMinFilter = !!this.filterService.priceMinFilter ? this.filterService.priceMinFilter : this._min;
2179
+ this.filterService.priceMaxFilter = !!this.filterService.priceMaxFilter ? this.filterService.priceMaxFilter : this._max;
2169
2180
  // some user error protection
2170
2181
  var trueLowerBound = Math.min(this.filterService.priceMinFilter, this.filterService.priceMaxFilter);
2171
2182
  var trueUpperBound = Math.max(this.filterService.priceMinFilter, this.filterService.priceMaxFilter);
@@ -2206,7 +2217,7 @@
2206
2217
  CatalogFilterComponent.decorators = [
2207
2218
  { type: i0.Component, args: [{
2208
2219
  selector: 'app-catalog-filter',
2209
- template: "<div class=\"narrow-scrollbar hide-on-collapse\">\r\n <div *ngIf=\"!collapsed\" class=\"filter-title title-bottom-border block-center-align\">\r\n\r\n <h3 [textContent]=\"'FILTER' | localize\"></h3>\r\n <div class=\"handle-wrapper\">\r\n <co-icon class=\"filter-reset-icon\" [iconData]=\"iconCache.getIcon(icons.SyncAlt)\"></co-icon>\r\n <div class=\"filter-reset\" [textContent]=\"'RESET_FILTER' | localize\" (click)=\"resetFilters($event)\"></div>\r\n <app-icon-handle [icon]=\"icons.ArrowScrollLeft\" (onHandleClick)=\"onHandleClick($event)\"></app-icon-handle>\r\n </div>\r\n </div>\r\n\r\n <div class=\"catalog-filter-price-input-wrapper\">\r\n <label class=\"temp\">Price</label>\r\n <div class=\"price-inputs\">\r\n <co-input-text\r\n class=\"price-from\"\r\n [type]=\"'number'\"\r\n [label]=\"'BASELINE_PRICE' | localize\"\r\n [(model)]=\"filterService.priceMinFilter\"\r\n (modelChange)=\"updatePriceFrom($event)\"\r\n customWidth\r\n ></co-input-text>\r\n <co-input-text\r\n class=\"price-to\"\r\n [type]=\"'number'\"\r\n [label]=\"'PRICE_TO' | localize\"\r\n [(model)]=\"filterService.priceMaxFilter\"\r\n (modelChange)=\"updatePriceTo($event)\"\r\n customWidth\r\n ></co-input-text>\r\n <co-icon [iconData]=\"iconCache.getIcon(icons.Check)\" (click)=\"filterOnPrice()\"></co-icon>\r\n </div>\r\n </div>\r\n <div class=\"catalog-filter-wrapper\">\r\n <co-filter-item\r\n [expanded]=true\r\n [customContent]=\"true\"\r\n class=\"no-header\"\r\n >\r\n <label class=\"temp\">Modified date</label>\r\n <co-input-date\r\n [(model)]=\"catalog.articleSearchFilters.dateModified\"\r\n (modelChange)=\"catalog.searchArticles()\"\r\n ></co-input-date>\r\n </co-filter-item>\r\n <div class=\"catalog-filter-item\" *ngFor=\"let filter of filterService.filters\">\r\n <co-filter-item\r\n [placeholder]=\"filter.filterName\"\r\n [collection]=\"filter.filterItems\"\r\n [showLessLabel]=\"'Bekijk minder...'\"\r\n [showMoreLabel]=\"'Bekijk meer...'\"\r\n [searchPlaceholder]=\"'Zoeken...'\"\r\n [expanded]=true\r\n [initialLimit]=5\r\n (collectionChange)=\"handleCollectionChange($event)\"\r\n ></co-filter-item>\r\n </div>\r\n </div>\r\n</div>\r\n",
2220
+ template: "<div class=\"narrow-scrollbar hide-on-collapse\">\r\n <div *ngIf=\"!collapsed\" class=\"filter-title title-bottom-border block-center-align\">\r\n\r\n <h3 [textContent]=\"'FILTER' | localize\"></h3>\r\n <div class=\"handle-wrapper\">\r\n <co-icon class=\"filter-reset-icon\" [iconData]=\"iconCache.getIcon(icons.SyncAlt)\"></co-icon>\r\n <div class=\"filter-reset\" [textContent]=\"'RESET_FILTER' | localize\" (click)=\"resetFilters($event)\"></div>\r\n <app-icon-handle [icon]=\"icons.ArrowScrollLeft\" (onHandleClick)=\"onHandleClick($event)\"></app-icon-handle>\r\n </div>\r\n </div>\r\n\r\n <div class=\"catalog-filter-price-input-wrapper\">\r\n <label class=\"temp\">Price</label>\r\n <div class=\"price-inputs\">\r\n <co-input-text\r\n class=\"price-from\"\r\n [type]=\"'number'\"\r\n [label]=\"'BASELINE_PRICE' | localize\"\r\n [(model)]=\"filterService.priceMinFilter\"\r\n (clearIconClick)=\"setPriceMinToDefault()\"\r\n (modelChange)=\"updatePriceFrom()\"\r\n customWidth\r\n ></co-input-text>\r\n <co-input-text\r\n class=\"price-to\"\r\n [type]=\"'number'\"\r\n [label]=\"'PRICE_TO' | localize\"\r\n [(model)]=\"filterService.priceMaxFilter\"\r\n (clearIconClick)=\"setPriceMaxToDefault()\"\r\n (modelChange)=\"updatePriceTo()\"\r\n customWidth\r\n ></co-input-text>\r\n <co-icon [iconData]=\"iconCache.getIcon(icons.Check)\" (click)=\"filterOnPrice()\"></co-icon>\r\n </div>\r\n </div>\r\n <div class=\"catalog-filter-wrapper\">\r\n <co-filter-item\r\n [expanded]=true\r\n [customContent]=\"true\"\r\n class=\"no-header\"\r\n >\r\n <label class=\"temp\">Modified date</label>\r\n <co-input-date\r\n [(model)]=\"catalog.articleSearchFilters.dateModified\"\r\n (modelChange)=\"catalog.searchArticles()\"\r\n ></co-input-date>\r\n </co-filter-item>\r\n <div class=\"catalog-filter-item\" *ngFor=\"let filter of filterService.filters\">\r\n <co-filter-item\r\n [placeholder]=\"filter.filterName\"\r\n [collection]=\"filter.filterItems\"\r\n [showLessLabel]=\"'Bekijk minder...'\"\r\n [showMoreLabel]=\"'Bekijk meer...'\"\r\n [searchPlaceholder]=\"'Zoeken...'\"\r\n [expanded]=true\r\n [initialLimit]=5\r\n (collectionChange)=\"handleCollectionChange($event)\"\r\n ></co-filter-item>\r\n </div>\r\n </div>\r\n</div>\r\n",
2210
2221
  animations: [
2211
2222
  animations.trigger('showFilterItem', [
2212
2223
  animations.state('closed', animations.style({ height: '80px' })),