@maplander/components 0.21.0 → 0.21.1

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.
@@ -1,4 +1,4 @@
1
- import { Pipe, NgModule, Directive, ElementRef, Input, Component, Inject, Injectable, InjectionToken, Optional, Renderer2, ViewChild, EventEmitter, Output, ContentChild, TemplateRef, ChangeDetectorRef, forwardRef, Injector } from '@angular/core';
1
+ import { Pipe, NgModule, Directive, ElementRef, Input, Component, Inject, Injectable, InjectionToken, Optional, EventEmitter, Renderer2, Output, ViewChild, ContentChild, TemplateRef, ChangeDetectorRef, forwardRef, Injector } from '@angular/core';
2
2
  import { CommonModule, CurrencyPipe } from '@angular/common';
3
3
  import { LandUseEnum, PFileTypeEnum, PropertyTypeEnum, OfferingTypeEnum, StatusTypeEnum, Currency, PFile, DialogResponseType, LeadInfo, NewCompleteProperty, NewProperty, PropertyInfo, AreaUnitEnum, Features, Address, Amenities, Owner, NewPropertyLite } from '@maplander/types';
4
4
  import { Validators, FormBuilder, ReactiveFormsModule, FormsModule, NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
@@ -2446,6 +2446,7 @@ class FiltersComponent {
2446
2446
  this._formBuilder = _formBuilder;
2447
2447
  this._converter = _converter;
2448
2448
  this.METERS_TO_SQ = 10.76391042;
2449
+ this.changeFilter = new EventEmitter();
2449
2450
  this.isOPI = this._config || false;
2450
2451
  this._subscription = new Subscription();
2451
2452
  /** @type {?} */
@@ -2455,12 +2456,17 @@ class FiltersComponent {
2455
2456
  * @return {?}
2456
2457
  */
2457
2458
  (item) => {
2458
- if ((this.hideRoom && item.value !== PropertyTypeEnum.ROOM) ||
2459
- (this.hideResidential && item.value !== PropertyTypeEnum.RESIDENTIAL)) {
2460
- items.push(item);
2459
+ if (this.newFilters) {
2460
+ if (item.value !== PropertyTypeEnum.ROOM && item.value !== PropertyTypeEnum.RESIDENTIAL) {
2461
+ items.push(item);
2462
+ }
2461
2463
  }
2462
2464
  }));
2463
- this.propertyTypeList = items;
2465
+ this.propertyTypeList = items.map((/**
2466
+ * @param {?} item
2467
+ * @return {?}
2468
+ */
2469
+ item => (Object.assign({}, item))));
2464
2470
  this.bedroomsList = Object.assign([], ConstantsComponents.BedroomList);
2465
2471
  this.bathroomsList = Object.assign([], ConstantsComponents.BathroomList);
2466
2472
  this.parkingPlacesList = Object.assign([], ConstantsComponents.ParkingSpacesList);
@@ -2532,6 +2538,7 @@ class FiltersComponent {
2532
2538
  this.filtersForm.controls['offering'].setValue(OfferingTypeEnum.SALE);
2533
2539
  break;
2534
2540
  }
2541
+ this.changeFilter.emit({ type: 'propertyType', payload: { filter: this.filter, value: this.filtersForm.value } });
2535
2542
  }
2536
2543
  /**
2537
2544
  * @param {?} ev
@@ -2539,6 +2546,7 @@ class FiltersComponent {
2539
2546
  */
2540
2547
  changeOffering(ev) {
2541
2548
  this.filter.offering = (/** @type {?} */ (ev));
2549
+ this.changeFilter.emit({ type: 'filter', payload: { filter: this.filter, value: this.filtersForm.value } });
2542
2550
  }
2543
2551
  /**
2544
2552
  * @param {?} ev
@@ -2546,6 +2554,7 @@ class FiltersComponent {
2546
2554
  */
2547
2555
  changeCurrency(ev) {
2548
2556
  this.filter.currency = ev;
2557
+ this.changeFilter.emit({ type: 'filter', payload: { filter: this.filter, value: this.filtersForm.value } });
2549
2558
  }
2550
2559
  /**
2551
2560
  * @param {?} amenity
@@ -2563,6 +2572,7 @@ class FiltersComponent {
2563
2572
  this.filter.extras.push(amenity.value);
2564
2573
  }
2565
2574
  amenity.checked = !amenity.checked;
2575
+ this.changeFilter.emit({ type: 'filter', payload: { filter: this.filter, value: this.filtersForm.value } });
2566
2576
  }
2567
2577
  /**
2568
2578
  * @return {?}
@@ -2601,6 +2611,7 @@ class FiltersComponent {
2601
2611
  this.filter = propertyTypeItemIndex ? Utils.getFilterByPropertyType(this.filter) : Utils.getInitialFilter(this.isOPI, this.filter);
2602
2612
  this.updateFormByFilters();
2603
2613
  this.setPrices();
2614
+ this.changeFilter.emit({ type: 'filter', payload: { filter: this.filter, value: this.filtersForm.value } });
2604
2615
  }
2605
2616
  /**
2606
2617
  * @private
@@ -2608,6 +2619,7 @@ class FiltersComponent {
2608
2619
  */
2609
2620
  buildForm() {
2610
2621
  this.filtersForm = this._formBuilder.group({
2622
+ state: [],
2611
2623
  offering: [],
2612
2624
  currency: [],
2613
2625
  minPrice: ['', [Validators.required, Validators.pattern(new RegExp('(^[0-9]+)'))]],
@@ -2621,6 +2633,12 @@ class FiltersComponent {
2621
2633
  }, {
2622
2634
  validator: CurrencyFilterValidator('minPrice', 'maxPrice')
2623
2635
  });
2636
+ this.filtersForm.valueChanges.subscribe((/**
2637
+ * @return {?}
2638
+ */
2639
+ () => {
2640
+ this.changeFilter.emit({ type: 'filter', payload: { filter: this.filter, value: this.filtersForm.value } });
2641
+ }));
2624
2642
  }
2625
2643
  /**
2626
2644
  * @private
@@ -2628,6 +2646,7 @@ class FiltersComponent {
2628
2646
  */
2629
2647
  updateFormByFilters() {
2630
2648
  this.filtersForm.patchValue({
2649
+ state: null,
2631
2650
  offering: this.filter.offering,
2632
2651
  currency: this.filter.currency,
2633
2652
  minPrice: this.filter.downLimitPrice,
@@ -2647,6 +2666,7 @@ class FiltersComponent {
2647
2666
  getFilterByForm() {
2648
2667
  /** @type {?} */
2649
2668
  const data = this.filtersForm.value;
2669
+ this.filter.state = data.state;
2650
2670
  this.filter.offering = data.offering;
2651
2671
  this.filter.currency = data.currency;
2652
2672
  this.filter.downLimitPrice = Number(data.minPrice);
@@ -2888,8 +2908,10 @@ FiltersComponent.ctorParameters = () => [
2888
2908
  ];
2889
2909
  FiltersComponent.propDecorators = {
2890
2910
  utils: [{ type: Input }],
2891
- hideRoom: [{ type: Input }],
2892
- hideResidential: [{ type: Input }]
2911
+ newFilters: [{ type: Input }],
2912
+ stateOptions: [{ type: Input }],
2913
+ propertyTotal: [{ type: Input }],
2914
+ changeFilter: [{ type: Output }]
2893
2915
  };
2894
2916
 
2895
2917
  /**