UNPKG

@justin-s/ngx-intl-tel-input

Version:

[![Build Status](https://github.com/webcat12345/ngx-intl-tel-input/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/webcat12345/ngx-intl-tel-input/actions/workflows/ci.yml) [![GitHub Pages](https://img.shields.io/badge/Demo-blue?logo=

406 lines (395 loc) 12.3 kB
import * as i0 from '@angular/core'; import { OnInit, OnChanges, EventEmitter, ElementRef, SimpleChanges, ModuleWithProviders } from '@angular/core'; import * as i4 from '@angular/forms'; import { NgControl } from '@angular/forms'; import * as i5 from 'ngx-bootstrap/dropdown'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import * as i3 from '@angular/common'; declare class CountryCode { allCountries: ((string | number | string[])[] | (string | number | number[])[])[]; static ɵfac: i0.ɵɵFactoryDeclaration<CountryCode, never>; static ɵprov: i0.ɵɵInjectableDeclaration<CountryCode>; } declare enum CountryISO { Afghanistan = "af", Albania = "al", Algeria = "dz", AmericanSamoa = "as", Andorra = "ad", Angola = "ao", Anguilla = "ai", AntiguaAndBarbuda = "ag", Argentina = "ar", Armenia = "am", Aruba = "aw", Australia = "au", Austria = "at", Azerbaijan = "az", Bahamas = "bs", Bahrain = "bh", Bangladesh = "bd", Barbados = "bb", Belarus = "by", Belgium = "be", Belize = "bz", Benin = "bj", Bermuda = "bm", Bhutan = "bt", Bolivia = "bo", BosniaAndHerzegovina = "ba", Botswana = "bw", Brazil = "br", BritishIndianOceanTerritory = "io", BritishVirginIslands = "vg", Brunei = "bn", Bulgaria = "bg", BurkinaFaso = "bf", Burundi = "bi", Cambodia = "kh", Cameroon = "cm", Canada = "ca", CapeVerde = "cv", CaribbeanNetherlands = "bq", CaymanIslands = "ky", CentralAfricanRepublic = "cf", Chad = "td", Chile = "cl", China = "cn", ChristmasIsland = "cx", Cocos = "cc", Colombia = "co", Comoros = "km", CongoDRCJamhuriYaKidemokrasiaYaKongo = "cd", CongoRepublicCongoBrazzaville = "cg", CookIslands = "ck", CostaRica = "cr", CôteDIvoire = "ci", Croatia = "hr", Cuba = "cu", Curaçao = "cw", Cyprus = "cy", CzechRepublic = "cz", Denmark = "dk", Djibouti = "dj", Dominica = "dm", DominicanRepublic = "do", Ecuador = "ec", Egypt = "eg", ElSalvador = "sv", EquatorialGuinea = "gq", Eritrea = "er", Estonia = "ee", Ethiopia = "et", FalklandIslands = "fk", FaroeIslands = "fo", Fiji = "fj", Finland = "fi", France = "fr", FrenchGuiana = "gf", FrenchPolynesia = "pf", Gabon = "ga", Gambia = "gm", Georgia = "ge", Germany = "de", Ghana = "gh", Gibraltar = "gi", Greece = "gr", Greenland = "gl", Grenada = "gd", Guadeloupe = "gp", Guam = "gu", Guatemala = "gt", Guernsey = "gg", Guinea = "gn", GuineaBissau = "gw", Guyana = "gy", Haiti = "ht", Honduras = "hn", HongKong = "hk", Hungary = "hu", Iceland = "is", India = "in", Indonesia = "id", Iran = "ir", Iraq = "iq", Ireland = "ie", IsleOfMan = "im", Israel = "il", Italy = "it", Jamaica = "jm", Japan = "jp", Jersey = "je", Jordan = "jo", Kazakhstan = "kz", Kenya = "ke", Kiribati = "ki", Kosovo = "xk", Kuwait = "kw", Kyrgyzstan = "kg", Laos = "la", Latvia = "lv", Lebanon = "lb", Lesotho = "ls", Liberia = "lr", Libya = "ly", Liechtenstein = "li", Lithuania = "lt", Luxembourg = "lu", Macau = "mo", Macedonia = "mk", Madagascar = "mg", Malawi = "mw", Malaysia = "my", Maldives = "mv", Mali = "ml", Malta = "mt", MarshallIslands = "mh", Martinique = "mq", Mauritania = "mr", Mauritius = "mu", Mayotte = "yt", Mexico = "mx", Micronesia = "fm", Moldova = "md", Monaco = "mc", Mongolia = "mn", Montenegro = "me", Montserrat = "ms", Morocco = "ma", Mozambique = "mz", Myanmar = "mm", Namibia = "na", Nauru = "nr", Nepal = "np", Netherlands = "nl", NewCaledonia = "nc", NewZealand = "nz", Nicaragua = "ni", Niger = "ne", Nigeria = "ng", Niue = "nu", NorfolkIsland = "nf", NorthKorea = "kp", NorthernMarianaIslands = "mp", Norway = "no", Oman = "om", Pakistan = "pk", Palau = "pw", Palestine = "ps", Panama = "pa", PapuaNewGuinea = "pg", Paraguay = "py", Peru = "pe", Philippines = "ph", Poland = "pl", Portugal = "pt", PuertoRico = "pr", Qatar = "qa", Réunion = "re", Romania = "ro", Russia = "ru", Rwanda = "rw", SaintBarthélemy = "bl", SaintHelena = "sh", SaintKittsAndNevis = "kn", SaintLucia = "lc", SaintMartin = "mf", SaintPierreAndMiquelon = "pm", SaintVincentAndTheGrenadines = "vc", Samoa = "ws", SanMarino = "sm", SãoToméAndPríncipe = "st", SaudiArabia = "sa", Senegal = "sn", Serbia = "rs", Seychelles = "sc", SierraLeone = "sl", Singapore = "sg", SintMaarten = "sx", Slovakia = "sk", Slovenia = "si", SolomonIslands = "sb", Somalia = "so", SouthAfrica = "za", SouthKorea = "kr", SouthSudan = "ss", Spain = "es", SriLanka = "lk", Sudan = "sd", Suriname = "sr", SvalbardAndJanMayen = "sj", Swaziland = "sz", Sweden = "se", Switzerland = "ch", Syria = "sy", Taiwan = "tw", Tajikistan = "tj", Tanzania = "tz", Thailand = "th", TimorLeste = "tl", Togo = "tg", Tokelau = "tk", Tonga = "to", TrinidadAndTobago = "tt", Tunisia = "tn", Turkey = "tr", Turkmenistan = "tm", TurksAndCaicosIslands = "tc", Tuvalu = "tv", USVirginIslands = "vi", Uganda = "ug", Ukraine = "ua", UnitedArabEmirates = "ae", UnitedKingdom = "gb", UnitedStates = "us", Uruguay = "uy", Uzbekistan = "uz", Vanuatu = "vu", VaticanCity = "va", Venezuela = "ve", Vietnam = "vn", WallisAndFutuna = "wf", WesternSahara = "eh", Yemen = "ye", Zambia = "zm", Zimbabwe = "zw", ÅlandIslands = "ax" } declare enum SearchCountryField { DialCode = "dialCode", Iso2 = "iso2", Name = "name", All = "all" } interface ChangeData { number?: string; internationalNumber?: string; nationalNumber?: string; e164Number?: string; countryCode?: string; dialCode?: string; } interface Country { name: string; iso2: string; dialCode: string; priority: number; areaCodes?: string[]; htmlId: string; flagClass: string; placeHolder: string; } declare enum PhoneNumberFormat { International = "INTERNATIONAL", National = "NATIONAL" } declare class NgxIntlTelInputComponent implements OnInit, OnChanges { private countryCodeData; value: string | undefined; preferredCountries: Array<string>; enablePlaceholder: boolean; customPlaceholder: string; numberFormat: PhoneNumberFormat; cssClass: string; onlyCountries: Array<string>; enableAutoCountrySelect: boolean; searchCountryFlag: boolean; searchCountryField: SearchCountryField[]; searchCountryPlaceholder: string; maxLength: number; selectFirstCountry: boolean; selectedCountryISO: CountryISO; phoneValidation: boolean; inputId: string; separateDialCode: boolean; separateDialCodeClass: string; readonly countryChange: EventEmitter<Country>; selectedCountry: Country; phoneNumber: string | undefined; allCountries: Array<Country>; preferredCountriesInDropDown: Array<Country>; phoneUtil: any; disabled: boolean; errors: Array<any>; countrySearchText: string; countryList: ElementRef; onTouched: () => void; propagateChange: (_: ChangeData) => void; constructor(countryCodeData: CountryCode); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; init(): void; setSelectedCountry(country: Country): void; /** * Search country based on country name, iso2, dialCode or all of them. */ searchCountry(): void; onPhoneNumberChange(): void; onCountrySelect(country: Country, el: { focus: () => void; }): void; onInputKeyPress(event: KeyboardEvent): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; writeValue(obj: any): void; resolvePlaceholder(): string; /** * Returns parse PhoneNumber object. * @param phoneNumber string * @param countryCode string */ private getParsedNumber; /** * Adjusts input alignment based on the dial code presentation style. */ private checkSeparateDialCodeStyle; /** * Cleans dialcode from phone number string. * @param phoneNumber string */ private removeDialCode; /** * Sifts through all countries and returns iso code of the primary country * based on the number provided. * @param countryCode country code in number format * @param number PhoneNumber object */ private getCountryIsoCode; /** * Gets formatted example phone number from phoneUtil. * @param countryCode string */ protected getPhoneNumberPlaceHolder(countryCode: string): string; /** * Clearing the list to avoid duplicates (https://github.com/webcat12345/ngx-intl-tel-input/issues/248) */ protected fetchCountryData(): void; /** * Populates preferredCountriesInDropDown with prefferred countries. */ private updatePreferredCountries; /** * Updates selectedCountry. */ private updateSelectedCountry; static ɵfac: i0.ɵɵFactoryDeclaration<NgxIntlTelInputComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NgxIntlTelInputComponent, "ngx-intl-tel-input", never, { "value": { "alias": "value"; "required": false; }; "preferredCountries": { "alias": "preferredCountries"; "required": false; }; "enablePlaceholder": { "alias": "enablePlaceholder"; "required": false; }; "customPlaceholder": { "alias": "customPlaceholder"; "required": false; }; "numberFormat": { "alias": "numberFormat"; "required": false; }; "cssClass": { "alias": "cssClass"; "required": false; }; "onlyCountries": { "alias": "onlyCountries"; "required": false; }; "enableAutoCountrySelect": { "alias": "enableAutoCountrySelect"; "required": false; }; "searchCountryFlag": { "alias": "searchCountryFlag"; "required": false; }; "searchCountryField": { "alias": "searchCountryField"; "required": false; }; "searchCountryPlaceholder": { "alias": "searchCountryPlaceholder"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; "selectFirstCountry": { "alias": "selectFirstCountry"; "required": false; }; "selectedCountryISO": { "alias": "selectedCountryISO"; "required": false; }; "phoneValidation": { "alias": "phoneValidation"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "separateDialCode": { "alias": "separateDialCode"; "required": false; }; }, { "countryChange": "countryChange"; }, never, never, false, never>; } declare class NativeElementInjectorDirective implements OnInit { private controlDir; private host; constructor(controlDir: NgControl, host: ElementRef<HTMLFormElement>); ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration<NativeElementInjectorDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NativeElementInjectorDirective, "[ngModel], [formControl], [formControlName]", never, {}, {}, never, never, false, never>; } declare const dropdownModuleForRoot: ModuleWithProviders<BsDropdownModule>; declare class NgxIntlTelInputModule { static ɵfac: i0.ɵɵFactoryDeclaration<NgxIntlTelInputModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<NgxIntlTelInputModule, [typeof NgxIntlTelInputComponent, typeof NativeElementInjectorDirective], [typeof i3.CommonModule, typeof i4.FormsModule, typeof i4.ReactiveFormsModule, typeof i5.BsDropdownModule], [typeof NgxIntlTelInputComponent, typeof NativeElementInjectorDirective]>; static ɵinj: i0.ɵɵInjectorDeclaration<NgxIntlTelInputModule>; } export { CountryISO, NativeElementInjectorDirective, NgxIntlTelInputComponent, NgxIntlTelInputModule, PhoneNumberFormat, SearchCountryField, dropdownModuleForRoot }; export type { ChangeData }; //# sourceMappingURL=index.d.ts.map