@moddi3/ngx-intl-tel-input 3.3.3 → 3.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/esm2020/lib/model/country.model.mjs +1 -1
- package/esm2020/lib/ngx-intl-tel-input.component.mjs +18 -10
- package/fesm2015/moddi3-ngx-intl-tel-input.mjs +17 -9
- package/fesm2015/moddi3-ngx-intl-tel-input.mjs.map +1 -1
- package/fesm2020/moddi3-ngx-intl-tel-input.mjs +17 -9
- package/fesm2020/moddi3-ngx-intl-tel-input.mjs.map +1 -1
- package/lib/model/country.model.d.ts +2 -1
- package/lib/model/country.model.d.ts.map +1 -1
- package/lib/ngx-intl-tel-input.component.d.ts +2 -1
- package/lib/ngx-intl-tel-input.component.d.ts.map +1 -1
- package/moddi3-ngx-intl-tel-input-3.3.5.tgz +0 -0
- package/package.json +4 -3
- package/moddi3-ngx-intl-tel-input-3.3.3.tgz +0 -0
|
@@ -1706,6 +1706,7 @@ class NgxIntlTelInputComponent {
|
|
|
1706
1706
|
this.phoneValidation = true;
|
|
1707
1707
|
this.inputId = 'phone';
|
|
1708
1708
|
this.separateDialCode = false;
|
|
1709
|
+
this.excludeCountries = [];
|
|
1709
1710
|
this.countryChange = new EventEmitter();
|
|
1710
1711
|
this.selectedCountry = {
|
|
1711
1712
|
areaCodes: undefined,
|
|
@@ -1752,6 +1753,9 @@ class NgxIntlTelInputComponent {
|
|
|
1752
1753
|
*/
|
|
1753
1754
|
init() {
|
|
1754
1755
|
this.fetchCountryData();
|
|
1756
|
+
if (this.excludeCountries.length) {
|
|
1757
|
+
this.allCountries = this.allCountries.filter((c) => !this.excludeCountries.includes(c.iso2));
|
|
1758
|
+
}
|
|
1755
1759
|
if (this.preferredCountries.length) {
|
|
1756
1760
|
this.updatePreferredCountries();
|
|
1757
1761
|
}
|
|
@@ -2013,6 +2017,9 @@ class NgxIntlTelInputComponent {
|
|
|
2013
2017
|
removeDialCode(phoneNumber) {
|
|
2014
2018
|
const number = this.getParsedNumber(phoneNumber, this.selectedCountry.iso2);
|
|
2015
2019
|
phoneNumber = this.phoneUtil.format(number, lpn.PhoneNumberFormat[this.numberFormat]);
|
|
2020
|
+
if (this.selectedCountry.iso2 === 'ua') {
|
|
2021
|
+
phoneNumber = '+380 31 123 4567';
|
|
2022
|
+
}
|
|
2016
2023
|
if (phoneNumber.startsWith('+') && this.separateDialCode) {
|
|
2017
2024
|
phoneNumber = phoneNumber.substr(phoneNumber.indexOf(' ') + 1);
|
|
2018
2025
|
}
|
|
@@ -2070,7 +2077,7 @@ class NgxIntlTelInputComponent {
|
|
|
2070
2077
|
this.countryCodeData.allCountries.forEach((c) => {
|
|
2071
2078
|
const country = {
|
|
2072
2079
|
name: c[0].toString(),
|
|
2073
|
-
iso2: c[1]
|
|
2080
|
+
iso2: c[1],
|
|
2074
2081
|
dialCode: c[2].toString(),
|
|
2075
2082
|
priority: +c[3] || 0,
|
|
2076
2083
|
areaCodes: c[4] || undefined,
|
|
@@ -2080,6 +2087,9 @@ class NgxIntlTelInputComponent {
|
|
|
2080
2087
|
};
|
|
2081
2088
|
if (this.enablePlaceholder) {
|
|
2082
2089
|
country.placeHolder = this.getPhoneNumberPlaceHolder(country.iso2.toUpperCase());
|
|
2090
|
+
if (country.iso2 === 'ua') {
|
|
2091
|
+
country.placeHolder = '+380 31 123 4567';
|
|
2092
|
+
}
|
|
2083
2093
|
}
|
|
2084
2094
|
this.allCountries.push(country);
|
|
2085
2095
|
});
|
|
@@ -2089,12 +2099,8 @@ class NgxIntlTelInputComponent {
|
|
|
2089
2099
|
*/
|
|
2090
2100
|
updatePreferredCountries() {
|
|
2091
2101
|
if (this.preferredCountries.length) {
|
|
2092
|
-
this.preferredCountriesInDropDown =
|
|
2093
|
-
|
|
2094
|
-
const preferredCountry = this.allCountries.filter((c) => {
|
|
2095
|
-
return c.iso2 === iso2;
|
|
2096
|
-
});
|
|
2097
|
-
this.preferredCountriesInDropDown.push(preferredCountry[0]);
|
|
2102
|
+
this.preferredCountriesInDropDown = this.allCountries.filter((c) => {
|
|
2103
|
+
return this.preferredCountries.includes(c.iso2) && !this.excludeCountries.includes(c.iso2);
|
|
2098
2104
|
});
|
|
2099
2105
|
}
|
|
2100
2106
|
}
|
|
@@ -2102,7 +2108,7 @@ class NgxIntlTelInputComponent {
|
|
|
2102
2108
|
* Updates selectedCountry.
|
|
2103
2109
|
*/
|
|
2104
2110
|
updateSelectedCountry() {
|
|
2105
|
-
if (this.selectedCountryISO) {
|
|
2111
|
+
if (this.selectedCountryISO && !this.excludeCountries.includes(this.selectedCountryISO)) {
|
|
2106
2112
|
// @ts-ignore
|
|
2107
2113
|
this.selectedCountry = this.allCountries.find((c) => {
|
|
2108
2114
|
return c.iso2.toLowerCase() === this.selectedCountryISO.toLowerCase();
|
|
@@ -2122,7 +2128,7 @@ class NgxIntlTelInputComponent {
|
|
|
2122
2128
|
}
|
|
2123
2129
|
}
|
|
2124
2130
|
NgxIntlTelInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxIntlTelInputComponent, deps: [{ token: CountryCode }], target: i0.ɵɵFactoryTarget.Component });
|
|
2125
|
-
NgxIntlTelInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NgxIntlTelInputComponent, selector: "ngx-intl-tel-input", inputs: { value: "value", preferredCountries: "preferredCountries", enablePlaceholder: "enablePlaceholder", customPlaceholder: "customPlaceholder", numberFormat: "numberFormat", cssClass: "cssClass", onlyCountries: "onlyCountries", enableAutoCountrySelect: "enableAutoCountrySelect", searchCountryFlag: "searchCountryFlag", searchCountryField: "searchCountryField", searchCountryPlaceholder: "searchCountryPlaceholder", maxLength: "maxLength", selectFirstCountry: "selectFirstCountry", selectedCountryISO: "selectedCountryISO", phoneValidation: "phoneValidation", inputId: "inputId", separateDialCode: "separateDialCode" }, outputs: { countryChange: "countryChange" }, providers: [
|
|
2131
|
+
NgxIntlTelInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NgxIntlTelInputComponent, selector: "ngx-intl-tel-input", inputs: { value: "value", preferredCountries: "preferredCountries", enablePlaceholder: "enablePlaceholder", customPlaceholder: "customPlaceholder", numberFormat: "numberFormat", cssClass: "cssClass", onlyCountries: "onlyCountries", enableAutoCountrySelect: "enableAutoCountrySelect", searchCountryFlag: "searchCountryFlag", searchCountryField: "searchCountryField", searchCountryPlaceholder: "searchCountryPlaceholder", maxLength: "maxLength", selectFirstCountry: "selectFirstCountry", selectedCountryISO: "selectedCountryISO", phoneValidation: "phoneValidation", inputId: "inputId", separateDialCode: "separateDialCode", excludeCountries: "excludeCountries" }, outputs: { countryChange: "countryChange" }, providers: [
|
|
2126
2132
|
CountryCode,
|
|
2127
2133
|
{
|
|
2128
2134
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -2186,6 +2192,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2186
2192
|
type: Input
|
|
2187
2193
|
}], separateDialCode: [{
|
|
2188
2194
|
type: Input
|
|
2195
|
+
}], excludeCountries: [{
|
|
2196
|
+
type: Input
|
|
2189
2197
|
}], countryChange: [{
|
|
2190
2198
|
type: Output
|
|
2191
2199
|
}], countryList: [{
|