intl-input-phone
Version:
Angular library to provide the international phone number feature by country dropdown and input fields with lots of customization and features like input masking, change the country, require valiation and many more.
119 lines (118 loc) • 4.99 kB
TypeScript
import { OnInit, AfterViewInit, EventEmitter, SimpleChange } from "@angular/core";
import { ControlValueAccessor } from "@angular/forms";
import { IntlInputPhoneService } from "./intl-input-phone.service";
import { CountryModel, CustomCountryModel, NumberResult } from "./model/CountryModel";
import { ConfigurationOptions } from "./model/Configuration";
import * as i0 from "@angular/core";
export declare class IntlInputPhoneComponent implements OnInit, AfterViewInit, ControlValueAccessor {
private _service;
/**
* Input property to set the Custom Country List.
*/
CountryList: CustomCountryModel[];
/**
* Input property to provide the configuration of module and its feature.
*/
ConfigurationOption: ConfigurationOptions;
/**
* Input property to set the prefilled number value.
*/
NumberTextValue: string;
/**
* Input property to set the selected country isocode not able to get correctly from number text value.
*/
SelectedCountryISOCode: string;
/**
* Output event : It is fire when Is Required flag is change.
*/
OnIsRequiredChange: EventEmitter<boolean>;
/**
* Output event : It is fire when Number is filled completly according to input masking.
* return number or number with country code.
*/
OnNumberChange: EventEmitter<NumberResult>;
/**
* Output event : It is fire when Number is filled completly according to input masking.
* return number or number with country code.
*/
OnCountryDrpdwnChange: EventEmitter<CountryModel>;
onChange: any;
onTouched: any;
/**
*
* @param obj In this InputCountryModel : In "Number" we expect mobile number without country code and "ISOCode" we expect ISO code
* for setting the country flag.
*/
writeValue(obj: NumberResult): void;
/**
* Register On Change Event
*/
registerOnChange(fn: any): void;
/**
* Register on touched events.
*/
registerOnTouched(fn: any): void;
get value(): NumberResult;
set value(obj: NumberResult);
/**
* Method to set the enable/disable state of the control using reactive form.
*/
setDisabledState?(isDisabled: boolean): void;
IsInputComplete: boolean;
allCountryList: CountryModel[];
filteredCountryList: CountryModel[];
selectedCountry: CountryModel;
outputResult: NumberResult;
constructor(_service: IntlInputPhoneService);
ngOnInit(): void;
ngAfterViewInit(): void;
ngOnChanges(changes: SimpleChange): void;
/**
* Method to initialize the country Dropdown.
*/
initializeCountryDrpDwn(): void;
/**
* Method to prepare the html and render the option html based on configuration.
* Set the option html based on configuration provided
*/
prepareHtmlOptionToRender: (country: CountryModel) => any;
/**
* Return the Country falg and country code.
* Change the input masking for the input.
*/
prepareHtmlOptionSelected: (selectedItem: any) => any;
/**
* Method for apply the searching for the select 2.
* Searching is apply based on country name, country ISO Code and Country phone Code.
*/
searchCountryData: (params: any, data: CountryModel) => CountryModel;
/**
* Method return the country option from the customcountry option.
* Check if user given country is not available our list then add in the country.
* Check if user given country is available in our list then replace those value which is not given by user.
*/
getCountryOptionFromCustomCountry: (customCountry: CustomCountryModel) => CountryModel;
/**
* Event to handle the completed event for input masking.
*/
maskingOnCompleteEvent: (e: any) => void;
/**
* Event to handle incomplete event for input masking.
*/
maskingOnInCompleteEvent: (e: any) => void;
/**
* Event to handle cleared event for input masking.
*/
maskingOnClearedEvent: (e: any) => void;
/**
* Emit is Input completed event to outer component.
*/
emitIsRequiredEvent(): void;
/**
* Emit when input is change and completed the masking.
* Return the output value based on configuration that whether we need to return number only or number with country code.
*/
emitOnNumberChange(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlInputPhoneComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<IntlInputPhoneComponent, "intl-input-phone", never, { "CountryList": "CountryList"; "ConfigurationOption": "ConfigurationOption"; "NumberTextValue": "NumberTextValue"; "SelectedCountryISOCode": "SelectedCountryISOCode"; }, { "OnIsRequiredChange": "OnIsRequiredChange"; "OnNumberChange": "OnNumberChange"; "OnCountryDrpdwnChange": "OnCountryDrpdwnChange"; }, never, never>;
}