moh-common-lib
Version:
A library of Angular components, services, and styles for B.C. Government Ministry of Health (MoH).
111 lines (110 loc) • 3.52 kB
TypeScript
import { EventEmitter, OnChanges, OnInit } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { Base } from '../../models/base';
import { GeoAddressResult } from '../../services/geocoder.service';
import { Address } from '../../models/address.model';
import { CountryList } from '../country/country.component';
import { ProvinceList } from '../province/province.component';
export interface AddrLabelList {
address1?: string;
address2?: string;
address3?: string;
city?: string;
province?: string;
country?: string;
postalCode?: string;
}
export interface Maxlengths {
address?: string;
city?: string;
province?: string;
country?: string;
postalCode?: string;
}
export interface ReadOnlyFields {
address?: boolean;
city?: boolean;
province?: boolean;
country?: boolean;
postalCode?: boolean;
}
/**
*
* Note - This component REQUIRES that `HttpClientModule` is registered in your NgModule.
*/
export declare class AddressComponent extends Base implements OnInit, OnChanges, ControlValueAccessor {
disabled: boolean | ReadOnlyFields;
isRequired: boolean;
countryList: CountryList[];
defaultCountry: string;
provinceList: ProvinceList[];
defaultProvince: string;
disableGeocoder: boolean;
labels: AddrLabelList;
maxlengths: Maxlengths;
bcOnly: boolean;
addressServiceUrl: string;
private _cityComponent;
address: Address;
addressChange: EventEmitter<Address>;
/**
* If true, adds a plus icon next to street and enables users to add a second
* address line. This value binds to `address.addressLine2`
*/
allowExtralines: boolean;
addr: Address;
provList: ProvinceList[];
showLine2: boolean;
showLine3: boolean;
addrLabels: AddrLabelList;
fieldMaxLengths: Maxlengths;
readOnlyFields: ReadOnlyFields;
_onChange: (_: any) => void;
_onTouched: (_: any) => void;
constructor();
ngOnInit(): void;
/**
* Set country province blank
* @param value
*/
setCountry(value: string): void;
setProvince(value: string): void;
setStreetAddress(value: string): void;
setCity(value: string): void;
/**
* Sets string after converted upper case
* @param text
*/
setPostalCode(value: string): void;
isCanada(): boolean;
ngOnChanges(changes: any): void;
addLine(line?: 2 | 3): void;
removeLine(line: 2 | 3): void;
/**
* Updates the provList variable. Values must be stored in a variable and not
* accessed via function invocation for performance.
*/
private updateProvList;
/**
* Sets the default province option value
*/
private setDefaultProvinceAsOption;
private findProvinceDescription;
/**
* Set country to default
* Search uses country code or country name to find item is list.
*/
private setDefaultCountryAsOption;
private findCountryCode;
readonly useAddressValidator: boolean;
setAddress(data: GeoAddressResult): void;
selectSuggestedAddress(address: Address): void;
writeValue(value: Address): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
setDisabledState(isDisabled: boolean): void;
private setLabels;
private setMaxlengths;
private setReadOnlyFields;
private truncateAddressLines;
}