fixed type of placeholders: should be the keys of numberType

This commit is contained in:
Márton Molnár
2018-11-06 14:34:55 +01:00
parent 749614f8af
commit 96f1baab5b
2 changed files with 21 additions and 7 deletions
+17 -3
View File
@@ -100,7 +100,7 @@ declare namespace IntlTelInput {
* Set the type of the placeholder number
* @param type Placeholder number type to be set
*/
setPlaceholderNumberType(type: intlTelInputUtils.numberType): void;
setPlaceholderNumberType(type: intlTelInputUtils.placeholderNumberType): void;
}
interface JQueryPlugin {
@@ -186,7 +186,7 @@ declare namespace IntlTelInput {
* Set the type of the placeholder number
* @param type Placeholder number type to be set
*/
(method: 'setPlaceholderNumberType', type: intlTelInputUtils.numberType): void;
(method: 'setPlaceholderNumberType', type: intlTelInputUtils.placeholderNumberType): void;
}
interface Options {
@@ -302,7 +302,7 @@ declare namespace IntlTelInput {
* e.g. "FIXED_LINE" to set the number type to use for the placeholder.
* Default = MOBILE
*/
placeholderNumberType?: intlTelInputUtils.numberType;
placeholderNumberType?: intlTelInputUtils.placeholderNumberType;
/**
* Specify the countries to appear at the top of the list.
@@ -370,6 +370,20 @@ declare namespace intlTelInputUtils {
TOO_LONG = 3,
NOT_A_NUMBER = 4
}
type placeholderNumberType =
| "FIXED_LINE_OR_MOBILE"
| "FIXED_LINE"
| "MOBILE"
| "PAGER"
| "PERSONAL_NUMBER"
| "PREMIUM_RATE"
| "SHARED_COST"
| "TOLL_FREE"
| "UAN"
| "UNKNOWN"
| "VOICEMAIL"
| "VOIP";
}
interface Window {
+4 -4
View File
@@ -12,7 +12,7 @@ window.intlTelInput(input, {
});
window.intlTelInput(input, {
placeholderNumberType: intlTelInputUtils.numberType.MOBILE,
placeholderNumberType: "MOBILE",
});
window.intlTelInput(input, {
@@ -43,7 +43,7 @@ window.intlTelInput(input).setCountry('gb');
window.intlTelInput(input).setNumber('+447733123456');
window.intlTelInput(input).setPlaceholderNumberType(intlTelInputUtils.numberType.FIXED_LINE);
window.intlTelInput(input).setPlaceholderNumberType("FIXED_LINE");
const countryData = window.intlTelInputGlobals.getCountryData();
const country = countryData[0];
@@ -100,7 +100,7 @@ $('#phone').intlTelInput({
});
$('#phone').intlTelInput({
placeholderNumberType: intlTelInputUtils.numberType.MOBILE,
placeholderNumberType: "MOBILE",
});
$('#phone').intlTelInput({
@@ -131,7 +131,7 @@ $('#phone').intlTelInput('setCountry', 'gb');
$('#phone').intlTelInput('setNumber', '+447733123456');
$('#phone').intlTelInput('setPlaceholderNumberType', intlTelInputUtils.numberType.FIXED_LINE);
$('#phone').intlTelInput('setPlaceholderNumberType', "FIXED_LINE");
$('#phone').intlTelInput({
utilsScript: '../../build/js/utils.js'