UNPKG

moh-common-lib

Version:

A library of Angular components, services, and styles for B.C. Government Ministry of Health (MoH).

66 lines (65 loc) 2.7 kB
import { OnInit, ChangeDetectorRef, EventEmitter } from '@angular/core'; import { Observable } from 'rxjs'; import { TypeaheadMatch } from 'ngx-bootstrap/typeahead'; import { Base } from '../../models/base'; import { GeocoderService, GeoAddressResult } from '../../services/geocoder.service'; import { Address } from '../../models/address.model'; import { NgControl, ControlValueAccessor } from '@angular/forms'; /** * @deprecated Please use `address-validator` component instead. * * For TemplateForms, pass in an Address and recieve an Address * @example * <common-geocoder-input * label='Physical Address' * [(ngModel)]="myAddress"> * </common-geocoder-input> * * @note * For ReactiveForms, pass in a string and recieve a string. If you need the * Address object you can use (select) in addition. * * @example * <common-geocoder-input * label='Physical Address' * formControlName="address" * (select)="getAddressObject($event)"> * </common-geocoder-input> */ export declare class GeocoderInputComponent extends Base implements OnInit, ControlValueAccessor { controlDir: NgControl; private geocoderService; private cd; label: string; address: string; addressChange: EventEmitter<string>; select: EventEmitter<Address>; maxlength: string; /** The string in the box the user has typed */ search: string; /** Is the Geocoder API request still in progress? */ isTypeaheadLoading: boolean; /** Geocoder API has returned and has no results, an empty array. */ hasNoResults: boolean; hasError: boolean; /** Similar to this.address, but we can null it when user is searching for new addresses */ selectedAddress: boolean; /** The list of results, from API, that is passed to the typeahead list */ typeaheadList$: Observable<GeoAddressResult[]>; /** The subject that triggers on user text input and gets typeaheadList$ to update. */ private searchText$; _onChange: (_: any) => void; _onTouched: (_?: any) => void; constructor(controlDir: NgControl, geocoderService: GeocoderService, cd: ChangeDetectorRef); ngOnInit(): void; onError(err: any): Observable<GeoAddressResult[]>; onLoading(val: boolean): void; onNoResults(val: boolean): void; onSelect(event: TypeaheadMatch): void; onKeyUp(event: KeyboardEvent): void; onBlur(event: any): void; writeValue(value: any): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; private stripStringToMaxLength; }