UNPKG

ngx-material-intl-tel-input

Version:
53 lines (52 loc) 3.11 kB
import { Country } from '../../types/country.model'; import { PhoneNumberFormat, PhoneNumberUtil } from 'google-libphonenumber'; import { CountryCode } from '../../data/country-code'; import { CountryISO } from '../../enums/country-iso.enum'; import * as i0 from "@angular/core"; export declare class CountryDataService { phoneNumberUtil: PhoneNumberUtil; /** * Retrieves a Country object based on the provided country data and placeholder flag. * * @param {CountryData} countryData - the country data used to create the Country object * @param {boolean} enablePlaceholder - a flag indicating whether to include a placeholder value * @return {Country} the generated Country object */ private getCountryObject; /** * Sorts the array of countries based on the preferred countries list. * * @param {Country[]} allCountries - the array of all countries to be sorted * @param {string[]} preferredCountries - the list of preferred countries * @return {Country[]} the sorted array of countries */ private sortCountries; /** * Retrieves the placeholder for a phone number based on the provided country code. * * @param {string} countryCode - The country code for the phone number. * @return {string} The formatted phone number placeholder. */ protected getPhoneNumberPlaceholder(countryCode: string, includeDialCode: boolean, outputNumberFormat: PhoneNumberFormat): string; /** * Process the list of countries based on the provided data and parameters. * * @param {CountryCode} countryCodeData - the data containing country codes * @param {boolean} enablePlaceholder - flag to enable placeholder * @param {(CountryISO | string)[]} [visibleCountries] - optional array of visible country ISO codes or country names * @param {(CountryISO | string)[]} [preferredCountries] - optional array of preferred country ISO codes or country names * @param {(CountryISO | string)[]} [excludedCountries] - optional array of excluded country ISO codes or country names * @return {Country[]} the processed and sorted list of countries */ processCountries(countryCodeData: CountryCode, enablePlaceholder: boolean, includeDialCode: boolean, visibleCountries?: (CountryISO | string)[], preferredCountries?: (CountryISO | string)[], excludedCountries?: (CountryISO | string)[], useMask?: boolean, forceSelectedCountryCode?: boolean, showMaskPlaceholder?: boolean, outputNumberFormat?: PhoneNumberFormat): Country[]; /** * Formats a phone number by masking its digits while optionally masking the prefix. * * @param {string} phoneNumber - The phone number to be formatted. * @param {boolean} maskPrefix - Flag indicating whether to mask the prefix digits. * @return {string} The formatted phone number with masked digits and optionally masked prefix. */ private formatPhoneNumberWithPrefix; static ɵfac: i0.ɵɵFactoryDeclaration<CountryDataService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<CountryDataService>; }