AW-6046 Angular improvement
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChanges, ViewChild } from '@angular/core';
|
||||
import { Observable , of,merge,forkJoin } from 'rxjs';
|
||||
import { debounceTime,distinctUntilChanged,tap,switchMap,catchError,map} from 'rxjs/operators';
|
||||
import { TypeaheadService, TimespanService } from '@farmmaps/common';
|
||||
import { IQueryState } from '@farmmaps/common';
|
||||
import { IPeriodState } from '../../models/period.state';
|
||||
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
||||
import { IQueryState, TimespanService, TypeaheadService } from '@farmmaps/common';
|
||||
import { Observable, forkJoin, of } from 'rxjs';
|
||||
import { catchError, debounceTime, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators';
|
||||
import { tassign } from 'tassign';
|
||||
import { IPeriodState } from '../../models/period.state';
|
||||
|
||||
@Component({
|
||||
selector: 'fm-map-map-search',
|
||||
@@ -54,7 +53,6 @@ export class MapSearchComponent {
|
||||
public searchMinifiedLocal = false;
|
||||
public periodLocal: IPeriodState = { startDate:new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1), endDate:new Date(Date.now())};
|
||||
public filterOptionsLocal: IQueryState;
|
||||
private extent: number[];
|
||||
public searchTextLocal: any;
|
||||
public searchTextLocalOutput: string;
|
||||
public dateFilter = true;
|
||||
@@ -81,12 +79,12 @@ export class MapSearchComponent {
|
||||
catchError(() => {
|
||||
this.searchFailed = true;
|
||||
return of([]);
|
||||
}),map( (sa:string[]) => sa.map((s,i) => ({"name":s,"type":"tag"})))),
|
||||
}),map( (sa:string[]) => sa.map((s) => ({"name":s,"type":"tag"})))),
|
||||
this.typeaheadService.getCityTypeaheadItems(term).pipe(
|
||||
catchError(() => {
|
||||
this.searchFailed = true;
|
||||
return of([]);
|
||||
}),map( (sa:string[]) => sa.map((s,i) => ({"name":s,"type":"city"})))),
|
||||
}),map( (sa:string[]) => sa.map((s) => ({"name":s,"type":"city"})))),
|
||||
).pipe(map(([a1,a2]) => [...a1, ...a2] ),map(a => a.sort((a, b) => (a.name.toUpperCase() > b.name.toUpperCase()) ? 1 : -1)))
|
||||
),
|
||||
tap(() => this.searching = false),
|
||||
@@ -94,7 +92,7 @@ export class MapSearchComponent {
|
||||
|
||||
formatter = (x: { name: string }) => x.name;
|
||||
|
||||
handleSearch(event) {
|
||||
handleSearch() {
|
||||
this.filterOptionsLocal.tags = null;
|
||||
this.filterOptionsLocal.itemType = null;
|
||||
this.filterOptionsLocal.itemCode = null;
|
||||
@@ -168,11 +166,11 @@ export class MapSearchComponent {
|
||||
}
|
||||
|
||||
|
||||
handleToggleMenu(event) {
|
||||
handleToggleMenu() {
|
||||
this.onToggleMenu.emit({});
|
||||
}
|
||||
|
||||
handleFocus(event) {
|
||||
handleFocus() {
|
||||
this.onSearchExpand.emit({});
|
||||
}
|
||||
|
||||
@@ -187,7 +185,7 @@ export class MapSearchComponent {
|
||||
this.disabled = true;
|
||||
}
|
||||
|
||||
handleClearClick(event) {
|
||||
handleClearClick() {
|
||||
this.onClear.emit({});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user