intl-tel-input 25.12.2 → 25.12.4
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 +5 -5
- package/angular/README.md +75 -22
- package/angular/build/IntlTelInput.js +83 -19
- package/angular/build/IntlTelInputWithUtils.js +83 -19
- package/angular/build/types/intl-tel-input/angular.d.ts +22 -3
- package/angular/build/types/intl-tel-input/angularWithUtils.d.ts +22 -3
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.js +15 -7
- package/build/js/intlTelInput.min.js +3 -3
- package/build/js/intlTelInputWithUtils.js +15 -7
- package/build/js/intlTelInputWithUtils.min.js +3 -3
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +14 -6
- package/react/build/IntlTelInput.js +14 -6
- package/react/build/IntlTelInputWithUtils.cjs +14 -6
- package/react/build/IntlTelInputWithUtils.js +14 -6
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +34 -37
- package/vue/build/IntlTelInputWithUtils.mjs +15 -18
package/README.md
CHANGED
|
@@ -81,16 +81,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
81
81
|
## Getting Started (Using a CDN)
|
|
82
82
|
1. Add the CSS
|
|
83
83
|
```html
|
|
84
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
84
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.4/build/css/intlTelInput.css">
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
2. Add the plugin script and initialise it on your input element
|
|
88
88
|
```html
|
|
89
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
89
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.4/build/js/intlTelInput.min.js"></script>
|
|
90
90
|
<script>
|
|
91
91
|
const input = document.querySelector("#phone");
|
|
92
92
|
window.intlTelInput(input, {
|
|
93
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
93
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.4/build/js/utils.js"),
|
|
94
94
|
});
|
|
95
95
|
</script>
|
|
96
96
|
```
|
|
@@ -333,7 +333,7 @@ The `loadUtils` option takes a function which returns a Promise which resolves t
|
|
|
333
333
|
```js
|
|
334
334
|
// (A) import utils module from a CDN
|
|
335
335
|
intlTelInput(htmlInputElement, {
|
|
336
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
336
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.4/build/js/utils.js"),
|
|
337
337
|
});
|
|
338
338
|
|
|
339
339
|
// (B) import utils module from your own hosted version of utils.js
|
|
@@ -617,7 +617,7 @@ The `loadUtils` option takes a function that returns a Promise resolving to the
|
|
|
617
617
|
```js
|
|
618
618
|
// (A) import utils module from a CDN
|
|
619
619
|
intlTelInput(htmlInputElement, {
|
|
620
|
-
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
620
|
+
loadUtils: () => import("https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.4/build/js/utils.js"),
|
|
621
621
|
});
|
|
622
622
|
|
|
623
623
|
// (B) import utils module from your own hosted version of utils.js
|
package/angular/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# IntlTelInput Angular Component
|
|
2
|
+
|
|
2
3
|
An Angular component wrapper for the [intl-tel-input](https://github.com/jackocnr/intl-tel-input) JavaScript plugin. View the [source code](https://github.com/jackocnr/intl-tel-input/blob/master/angular/src/intl-tel-input/angular.ts).
|
|
3
4
|
|
|
4
5
|
## Table of Contents
|
|
6
|
+
|
|
5
7
|
- [Demo](#demo)
|
|
6
8
|
- [Getting Started](#getting-started)
|
|
7
9
|
- [Props](#props)
|
|
@@ -10,9 +12,11 @@ An Angular component wrapper for the [intl-tel-input](https://github.com/jackocn
|
|
|
10
12
|
- [Accessing Static Methods](#accessing-static-methods)
|
|
11
13
|
|
|
12
14
|
## Demo
|
|
15
|
+
|
|
13
16
|
Try it for yourself by downloading the project and opening /angular/demo/validation/index.html (etc) in a browser.
|
|
14
17
|
|
|
15
18
|
## Getting Started
|
|
19
|
+
|
|
16
20
|
```html
|
|
17
21
|
import { IntlTelInputComponent } from "intl-tel-input/angularWithUtils";
|
|
18
22
|
import "intl-tel-input/styles";
|
|
@@ -29,58 +33,107 @@ import "intl-tel-input/styles";
|
|
|
29
33
|
|
|
30
34
|
See the [validation demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/validation/validation.component.ts) for a more fleshed-out example of how to handle validation, or check out the [form demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/form/form.component.ts) for an alternative approach using `ReactiveFormsModule`.
|
|
31
35
|
|
|
32
|
-
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just `import { IntlTelInputComponent } from "intl-tel-input/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.
|
|
36
|
+
A note on the utils script (~260KB): if you're lazy loading the IntlTelInput chunk (and so less worried about filesize) then you can just `import { IntlTelInputComponent } from "intl-tel-input/angularWithUtils"`, to include the utils script. Alternatively, if you use the main `"intl-tel-input/angular"` import, then you should couple this with the `loadUtils` initialisation option - you will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `loadUtils` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@25.12.4/build/js/utils.js"`.
|
|
33
37
|
|
|
34
38
|
## Props
|
|
39
|
+
|
|
35
40
|
Here's a list of all of the current props you can pass to the IntlTelInput Angular component.
|
|
36
41
|
|
|
37
|
-
**disabled
|
|
38
|
-
Type: `Boolean`, Default: `false
|
|
42
|
+
**disabled**\
|
|
43
|
+
Type: `Boolean`, Default: `false`\
|
|
39
44
|
Sets the disabled attribute of both the telephone input and selected country button. _Note: we recommend using this instead of `inputProps.disabled`._
|
|
40
45
|
|
|
41
|
-
**initialValue
|
|
42
|
-
Type: `String
|
|
46
|
+
**initialValue**\
|
|
47
|
+
Type: `String`\
|
|
43
48
|
The initial value to put in the input. This will get auto-formatted on init (according to `formatOnDisplay` initialisation option). IntlTelInput is an uncontrolled input, and so will ignore any changes to this value.
|
|
44
49
|
|
|
45
|
-
**initOptions
|
|
46
|
-
Type: `Object
|
|
50
|
+
**initOptions**\
|
|
51
|
+
Type: `Object`\
|
|
47
52
|
An object containing the [initialisation options](https://github.com/jackocnr/intl-tel-input?tab=readme-ov-file#initialisation-options) to pass to the plugin. You can use these exactly the same way as with the main JavaScript plugin.
|
|
48
53
|
|
|
49
|
-
**inputProps
|
|
50
|
-
Type: `Object
|
|
54
|
+
**inputProps**\
|
|
55
|
+
Type: `Object`\
|
|
51
56
|
The props to pass to the input element e.g. `class`, `placeholder`, `required` etc. _Note: we recommend using the separate `disabled` prop instead of `inputProps.disabled`._
|
|
52
57
|
|
|
53
|
-
**usePreciseValidation
|
|
54
|
-
Type: `Boolean`, Default: `false
|
|
58
|
+
**usePreciseValidation**\
|
|
59
|
+
Type: `Boolean`, Default: `false`\
|
|
55
60
|
By default we use `isValidNumber` for validation, but if you'd rather use `isValidNumberPrecise` you can set this to `true`.
|
|
56
61
|
|
|
57
62
|
## Events
|
|
63
|
+
|
|
58
64
|
Here's a list of all of the current events you can listen to on the IntlTelInput angular component.
|
|
59
65
|
|
|
60
|
-
**countryChange
|
|
61
|
-
Type: `Function
|
|
66
|
+
**countryChange**\
|
|
67
|
+
Type: `Function`\
|
|
62
68
|
A handler to be called when the selected country changes. It will be passed the new country iso2 code e.g. "gb" for UK.
|
|
63
69
|
|
|
64
|
-
**errorCodeChange
|
|
65
|
-
Type: `Function
|
|
70
|
+
**errorCodeChange**\
|
|
71
|
+
Type: `Function`\
|
|
66
72
|
A handler to be called when the number validation error changes. It will be passed the new error code (or `null`).
|
|
67
73
|
|
|
68
|
-
**numberChange
|
|
69
|
-
Type: `Function
|
|
74
|
+
**numberChange**\
|
|
75
|
+
Type: `Function`\
|
|
70
76
|
A handler to be called when the number changes. It will be passed the new number.
|
|
71
77
|
|
|
72
|
-
**validityChange
|
|
73
|
-
Type: `Function
|
|
78
|
+
**validityChange**\
|
|
79
|
+
Type: `Function`\
|
|
74
80
|
A handler to be called when the number validity changes e.g. to true/false. It will be passed the new isValid boolean.
|
|
75
81
|
|
|
76
82
|
### Native Input Events
|
|
77
83
|
|
|
78
|
-
|
|
84
|
+
The component exposes several commonly used native DOM events that you can bind to using Angular's standard event binding syntax `(eventName)="handlerMethod($event)"`. For other native events not listed below, you can access the input element directly (see [Other Native Events](#other-native-events) section).
|
|
85
|
+
|
|
86
|
+
#### Supported Events
|
|
87
|
+
|
|
88
|
+
The following native input events are directly supported:
|
|
89
|
+
- `blur` - Fired when the input loses focus (receives `FocusEvent`)
|
|
90
|
+
- `focus` - Fired when the input receives focus (receives `FocusEvent`)
|
|
91
|
+
- `keydown` - Fired when a key is pressed down (receives `KeyboardEvent`)
|
|
92
|
+
- `keyup` - Fired when a key is released (receives `KeyboardEvent`)
|
|
93
|
+
- `paste` - Fired when content is pasted (receives `ClipboardEvent`)
|
|
94
|
+
- `click` - Fired when the input is clicked (receives `MouseEvent`)
|
|
95
|
+
|
|
96
|
+
Example usage:
|
|
97
|
+
```html
|
|
98
|
+
<intl-tel-input
|
|
99
|
+
(blur)="handleBlur($event)"
|
|
100
|
+
(focus)="handleFocus($event)"
|
|
101
|
+
(keydown)="handleKeyDown($event)"
|
|
102
|
+
(paste)="handlePaste($event)"
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Other Native Events
|
|
107
|
+
|
|
108
|
+
For any other native DOM events not listed above, you can access the input element directly using a `ViewChild` reference and add event listeners manually:
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
export class MyComponent implements AfterViewInit, OnDestroy {
|
|
112
|
+
@ViewChild('telInput') telInput!: IntlTelInputComponent;
|
|
113
|
+
|
|
114
|
+
ngAfterViewInit() {
|
|
115
|
+
const input = this.telInput.getInput();
|
|
116
|
+
input?.addEventListener('mouseenter', this.handleMouseEnter);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
ngOnDestroy() {
|
|
120
|
+
const input = this.telInput.getInput();
|
|
121
|
+
input?.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
handleMouseEnter = (event: MouseEvent) => {
|
|
125
|
+
console.log('Mouse entered input:', event);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
79
129
|
|
|
80
130
|
## Accessing Instance Methods
|
|
81
131
|
|
|
82
|
-
You can access all of the plugin's [instance methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#instance-methods) (`setNumber`, `setCountry`, `setPlaceholderNumberType` etc) by using a ViewChild reference into the IntlTelInput component (using the `#ref` prop), and then calling `this.
|
|
132
|
+
You can access all of the plugin's [instance methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#instance-methods) (`setNumber`, `setCountry`, `setPlaceholderNumberType` etc) by using a ViewChild reference into the IntlTelInput component (using the `#ref` prop), and then calling `this.ref.getInstance()` e.g. `this.ref.getInstance().setNumber(...);`. See the [Set Number demo](https://github.com/jackocnr/intl-tel-input/blob/master/angular/demo/set-number/set-number.component.ts) for a full example. You can also access the input DOM element in a similar way: `this.ref.getInput()`.
|
|
133
|
+
|
|
134
|
+
> [!IMPORTANT]
|
|
135
|
+
> You must use `ngAfterViewInit` (not `ngOnInit` or `constructor`) to access instance or input methods, as the component needs to be fully initialized first.
|
|
83
136
|
|
|
84
137
|
## Accessing Static Methods
|
|
85
138
|
|
|
86
|
-
You can access all of the plugin's [static methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#static-methods) by importing `intlTelInput` from the same file as the angular component e.g. `import {
|
|
139
|
+
You can access all of the plugin's [static methods](https://github.com/jackocnr/intl-tel-input/blob/master/README.md#static-methods) by importing `intlTelInput` from the same file as the angular component e.g. `import { intlTelInput } from "intl-tel-input/angular"` (note the lower case "i" in "intlTelInput"). You can then use this as you would with the main plugin e.g. `intlTelInput.getCountryData()` or `intlTelInput.utils.numberType` etc.
|
|
@@ -3400,6 +3400,10 @@ var Iti = class _Iti {
|
|
|
3400
3400
|
return iso2Codes[0];
|
|
3401
3401
|
}
|
|
3402
3402
|
} else if (number.startsWith("+") && numeric.length) {
|
|
3403
|
+
const currentDial = this.selectedCountryData.dialCode || "";
|
|
3404
|
+
if (currentDial && currentDial.startsWith(numeric)) {
|
|
3405
|
+
return null;
|
|
3406
|
+
}
|
|
3403
3407
|
return "";
|
|
3404
3408
|
} else if ((!number || number === "+") && !selectedIso2) {
|
|
3405
3409
|
return this.defaultCountry;
|
|
@@ -3534,19 +3538,23 @@ var Iti = class _Iti {
|
|
|
3534
3538
|
let dialCode = "";
|
|
3535
3539
|
if (number.startsWith("+")) {
|
|
3536
3540
|
let numericChars = "";
|
|
3541
|
+
let foundBaseDialCode = false;
|
|
3537
3542
|
for (let i = 0; i < number.length; i++) {
|
|
3538
3543
|
const c = number.charAt(i);
|
|
3539
3544
|
if (/[0-9]/.test(c)) {
|
|
3540
3545
|
numericChars += c;
|
|
3541
|
-
const
|
|
3542
|
-
if (!
|
|
3546
|
+
const hasMapEntry = Boolean(this.dialCodeToIso2Map[numericChars]);
|
|
3547
|
+
if (!hasMapEntry) {
|
|
3543
3548
|
break;
|
|
3544
3549
|
}
|
|
3545
|
-
if (
|
|
3550
|
+
if (this.dialCodes.has(numericChars)) {
|
|
3546
3551
|
dialCode = number.substring(0, i + 1);
|
|
3547
|
-
|
|
3552
|
+
foundBaseDialCode = true;
|
|
3553
|
+
if (!includeAreaCode) {
|
|
3554
|
+
break;
|
|
3555
|
+
}
|
|
3556
|
+
} else if (includeAreaCode && foundBaseDialCode) {
|
|
3548
3557
|
dialCode = number.substring(0, i + 1);
|
|
3549
|
-
break;
|
|
3550
3558
|
}
|
|
3551
3559
|
if (numericChars.length === this.dialCodeMaxLen) {
|
|
3552
3560
|
break;
|
|
@@ -3799,7 +3807,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3799
3807
|
attachUtils,
|
|
3800
3808
|
startedLoadingUtilsScript: false,
|
|
3801
3809
|
startedLoadingAutoCountry: false,
|
|
3802
|
-
version: "25.12.
|
|
3810
|
+
version: "25.12.4"
|
|
3803
3811
|
});
|
|
3804
3812
|
var intl_tel_input_default = intlTelInput;
|
|
3805
3813
|
|
|
@@ -3820,12 +3828,17 @@ var IntlTelInputComponent = class {
|
|
|
3820
3828
|
this.initialValue = "";
|
|
3821
3829
|
this.usePreciseValidation = false;
|
|
3822
3830
|
this.inputProps = {};
|
|
3823
|
-
this.disabled = void 0;
|
|
3824
3831
|
this.initOptions = {};
|
|
3825
3832
|
this.numberChange = new EventEmitter();
|
|
3826
3833
|
this.countryChange = new EventEmitter();
|
|
3827
3834
|
this.validityChange = new EventEmitter();
|
|
3828
3835
|
this.errorCodeChange = new EventEmitter();
|
|
3836
|
+
this.blur = new EventEmitter();
|
|
3837
|
+
this.focus = new EventEmitter();
|
|
3838
|
+
this.keydown = new EventEmitter();
|
|
3839
|
+
this.keyup = new EventEmitter();
|
|
3840
|
+
this.paste = new EventEmitter();
|
|
3841
|
+
this.click = new EventEmitter();
|
|
3829
3842
|
this.iti = null;
|
|
3830
3843
|
this.countryChangeHandler = () => this.handleInput();
|
|
3831
3844
|
this.onChange = () => {
|
|
@@ -3841,11 +3854,6 @@ var IntlTelInputComponent = class {
|
|
|
3841
3854
|
}
|
|
3842
3855
|
this.inputRef.nativeElement.addEventListener("countrychange", this.countryChangeHandler);
|
|
3843
3856
|
this.applyInputProps();
|
|
3844
|
-
for (const key in this.inputProps) {
|
|
3845
|
-
if (this.inputProps.hasOwnProperty(key)) {
|
|
3846
|
-
this.inputRef.nativeElement.setAttribute(key, this.inputProps[key]);
|
|
3847
|
-
}
|
|
3848
|
-
}
|
|
3849
3857
|
}
|
|
3850
3858
|
ngAfterViewInit() {
|
|
3851
3859
|
var _a, _b;
|
|
@@ -3880,12 +3888,36 @@ var IntlTelInputComponent = class {
|
|
|
3880
3888
|
this.onChange(num);
|
|
3881
3889
|
this.onValidatorChange();
|
|
3882
3890
|
}
|
|
3883
|
-
handleBlur() {
|
|
3891
|
+
handleBlur(event) {
|
|
3884
3892
|
this.onTouched();
|
|
3893
|
+
this.blur.emit(event);
|
|
3894
|
+
}
|
|
3895
|
+
handleFocus(event) {
|
|
3896
|
+
this.focus.emit(event);
|
|
3897
|
+
}
|
|
3898
|
+
handleKeyDown(event) {
|
|
3899
|
+
this.keydown.emit(event);
|
|
3900
|
+
}
|
|
3901
|
+
handleKeyUp(event) {
|
|
3902
|
+
this.keyup.emit(event);
|
|
3903
|
+
}
|
|
3904
|
+
handlePaste(event) {
|
|
3905
|
+
this.paste.emit(event);
|
|
3906
|
+
}
|
|
3907
|
+
handleClick(event) {
|
|
3908
|
+
this.click.emit(event);
|
|
3885
3909
|
}
|
|
3910
|
+
/**
|
|
3911
|
+
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
|
|
3912
|
+
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
|
|
3913
|
+
*/
|
|
3886
3914
|
getInstance() {
|
|
3887
3915
|
return this.iti;
|
|
3888
3916
|
}
|
|
3917
|
+
/**
|
|
3918
|
+
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
|
|
3919
|
+
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
|
|
3920
|
+
*/
|
|
3889
3921
|
getInput() {
|
|
3890
3922
|
return this.inputRef.nativeElement;
|
|
3891
3923
|
}
|
|
@@ -3949,7 +3981,7 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3949
3981
|
let _t;
|
|
3950
3982
|
i0.\u0275\u0275queryRefresh(_t = i0.\u0275\u0275loadQuery()) && (ctx.inputRef = _t.first);
|
|
3951
3983
|
}
|
|
3952
|
-
}, inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputProps: "inputProps", disabled: "disabled", initOptions: "initOptions" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange" }, features: [i0.\u0275\u0275ProvidersFeature([
|
|
3984
|
+
}, inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputProps: "inputProps", disabled: "disabled", initOptions: "initOptions" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange", blur: "blur", focus: "focus", keydown: "keydown", keyup: "keyup", paste: "paste", click: "click" }, features: [i0.\u0275\u0275ProvidersFeature([
|
|
3953
3985
|
{
|
|
3954
3986
|
provide: NG_VALUE_ACCESSOR,
|
|
3955
3987
|
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
@@ -3960,16 +3992,31 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3960
3992
|
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
3961
3993
|
multi: true
|
|
3962
3994
|
}
|
|
3963
|
-
]), i0.\u0275\u0275NgOnChangesFeature], decls: 2, vars: 0, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
3995
|
+
]), i0.\u0275\u0275NgOnChangesFeature], decls: 2, vars: 0, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur", "focus", "keydown", "keyup", "paste", "click"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
3964
3996
|
if (rf & 1) {
|
|
3965
3997
|
const _r1 = i0.\u0275\u0275getCurrentView();
|
|
3966
3998
|
i0.\u0275\u0275elementStart(0, "input", 1, 0);
|
|
3967
3999
|
i0.\u0275\u0275listener("input", function IntlTelInputComponent_Template_input_input_0_listener() {
|
|
3968
4000
|
i0.\u0275\u0275restoreView(_r1);
|
|
3969
4001
|
return i0.\u0275\u0275resetView(ctx.handleInput());
|
|
3970
|
-
})("blur", function IntlTelInputComponent_Template_input_blur_0_listener() {
|
|
4002
|
+
})("blur", function IntlTelInputComponent_Template_input_blur_0_listener($event) {
|
|
3971
4003
|
i0.\u0275\u0275restoreView(_r1);
|
|
3972
|
-
return i0.\u0275\u0275resetView(ctx.handleBlur());
|
|
4004
|
+
return i0.\u0275\u0275resetView(ctx.handleBlur($event));
|
|
4005
|
+
})("focus", function IntlTelInputComponent_Template_input_focus_0_listener($event) {
|
|
4006
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4007
|
+
return i0.\u0275\u0275resetView(ctx.handleFocus($event));
|
|
4008
|
+
})("keydown", function IntlTelInputComponent_Template_input_keydown_0_listener($event) {
|
|
4009
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4010
|
+
return i0.\u0275\u0275resetView(ctx.handleKeyDown($event));
|
|
4011
|
+
})("keyup", function IntlTelInputComponent_Template_input_keyup_0_listener($event) {
|
|
4012
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4013
|
+
return i0.\u0275\u0275resetView(ctx.handleKeyUp($event));
|
|
4014
|
+
})("paste", function IntlTelInputComponent_Template_input_paste_0_listener($event) {
|
|
4015
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4016
|
+
return i0.\u0275\u0275resetView(ctx.handlePaste($event));
|
|
4017
|
+
})("click", function IntlTelInputComponent_Template_input_click_0_listener($event) {
|
|
4018
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
4019
|
+
return i0.\u0275\u0275resetView(ctx.handleClick($event));
|
|
3973
4020
|
});
|
|
3974
4021
|
i0.\u0275\u0275elementEnd();
|
|
3975
4022
|
}
|
|
@@ -3985,7 +4032,12 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
3985
4032
|
type="tel"
|
|
3986
4033
|
#inputRef
|
|
3987
4034
|
(input)="handleInput()"
|
|
3988
|
-
(blur)="handleBlur()"
|
|
4035
|
+
(blur)="handleBlur($event)"
|
|
4036
|
+
(focus)="handleFocus($event)"
|
|
4037
|
+
(keydown)="handleKeyDown($event)"
|
|
4038
|
+
(keyup)="handleKeyUp($event)"
|
|
4039
|
+
(paste)="handlePaste($event)"
|
|
4040
|
+
(click)="handleClick($event)"
|
|
3989
4041
|
/>
|
|
3990
4042
|
`,
|
|
3991
4043
|
providers: [
|
|
@@ -4022,10 +4074,22 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
4022
4074
|
type: Output
|
|
4023
4075
|
}], errorCodeChange: [{
|
|
4024
4076
|
type: Output
|
|
4077
|
+
}], blur: [{
|
|
4078
|
+
type: Output
|
|
4079
|
+
}], focus: [{
|
|
4080
|
+
type: Output
|
|
4081
|
+
}], keydown: [{
|
|
4082
|
+
type: Output
|
|
4083
|
+
}], keyup: [{
|
|
4084
|
+
type: Output
|
|
4085
|
+
}], paste: [{
|
|
4086
|
+
type: Output
|
|
4087
|
+
}], click: [{
|
|
4088
|
+
type: Output
|
|
4025
4089
|
}] });
|
|
4026
4090
|
})();
|
|
4027
4091
|
(() => {
|
|
4028
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angular.ts", lineNumber:
|
|
4092
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angular.ts", lineNumber: 67 });
|
|
4029
4093
|
})();
|
|
4030
4094
|
export {
|
|
4031
4095
|
IntlTelInputComponent,
|
|
@@ -3400,6 +3400,10 @@ var Iti = class _Iti {
|
|
|
3400
3400
|
return iso2Codes[0];
|
|
3401
3401
|
}
|
|
3402
3402
|
} else if (number.startsWith("+") && numeric.length) {
|
|
3403
|
+
const currentDial = this.selectedCountryData.dialCode || "";
|
|
3404
|
+
if (currentDial && currentDial.startsWith(numeric)) {
|
|
3405
|
+
return null;
|
|
3406
|
+
}
|
|
3403
3407
|
return "";
|
|
3404
3408
|
} else if ((!number || number === "+") && !selectedIso2) {
|
|
3405
3409
|
return this.defaultCountry;
|
|
@@ -3534,19 +3538,23 @@ var Iti = class _Iti {
|
|
|
3534
3538
|
let dialCode = "";
|
|
3535
3539
|
if (number.startsWith("+")) {
|
|
3536
3540
|
let numericChars = "";
|
|
3541
|
+
let foundBaseDialCode = false;
|
|
3537
3542
|
for (let i = 0; i < number.length; i++) {
|
|
3538
3543
|
const c = number.charAt(i);
|
|
3539
3544
|
if (/[0-9]/.test(c)) {
|
|
3540
3545
|
numericChars += c;
|
|
3541
|
-
const
|
|
3542
|
-
if (!
|
|
3546
|
+
const hasMapEntry = Boolean(this.dialCodeToIso2Map[numericChars]);
|
|
3547
|
+
if (!hasMapEntry) {
|
|
3543
3548
|
break;
|
|
3544
3549
|
}
|
|
3545
|
-
if (
|
|
3550
|
+
if (this.dialCodes.has(numericChars)) {
|
|
3546
3551
|
dialCode = number.substring(0, i + 1);
|
|
3547
|
-
|
|
3552
|
+
foundBaseDialCode = true;
|
|
3553
|
+
if (!includeAreaCode) {
|
|
3554
|
+
break;
|
|
3555
|
+
}
|
|
3556
|
+
} else if (includeAreaCode && foundBaseDialCode) {
|
|
3548
3557
|
dialCode = number.substring(0, i + 1);
|
|
3549
|
-
break;
|
|
3550
3558
|
}
|
|
3551
3559
|
if (numericChars.length === this.dialCodeMaxLen) {
|
|
3552
3560
|
break;
|
|
@@ -3799,7 +3807,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
3799
3807
|
attachUtils,
|
|
3800
3808
|
startedLoadingUtilsScript: false,
|
|
3801
3809
|
startedLoadingAutoCountry: false,
|
|
3802
|
-
version: "25.12.
|
|
3810
|
+
version: "25.12.4"
|
|
3803
3811
|
});
|
|
3804
3812
|
var intl_tel_input_default = intlTelInput;
|
|
3805
3813
|
|
|
@@ -10300,12 +10308,17 @@ var IntlTelInputComponent = class {
|
|
|
10300
10308
|
this.initialValue = "";
|
|
10301
10309
|
this.usePreciseValidation = false;
|
|
10302
10310
|
this.inputProps = {};
|
|
10303
|
-
this.disabled = void 0;
|
|
10304
10311
|
this.initOptions = {};
|
|
10305
10312
|
this.numberChange = new EventEmitter();
|
|
10306
10313
|
this.countryChange = new EventEmitter();
|
|
10307
10314
|
this.validityChange = new EventEmitter();
|
|
10308
10315
|
this.errorCodeChange = new EventEmitter();
|
|
10316
|
+
this.blur = new EventEmitter();
|
|
10317
|
+
this.focus = new EventEmitter();
|
|
10318
|
+
this.keydown = new EventEmitter();
|
|
10319
|
+
this.keyup = new EventEmitter();
|
|
10320
|
+
this.paste = new EventEmitter();
|
|
10321
|
+
this.click = new EventEmitter();
|
|
10309
10322
|
this.iti = null;
|
|
10310
10323
|
this.countryChangeHandler = () => this.handleInput();
|
|
10311
10324
|
this.onChange = () => {
|
|
@@ -10321,11 +10334,6 @@ var IntlTelInputComponent = class {
|
|
|
10321
10334
|
}
|
|
10322
10335
|
this.inputRef.nativeElement.addEventListener("countrychange", this.countryChangeHandler);
|
|
10323
10336
|
this.applyInputProps();
|
|
10324
|
-
for (const key in this.inputProps) {
|
|
10325
|
-
if (this.inputProps.hasOwnProperty(key)) {
|
|
10326
|
-
this.inputRef.nativeElement.setAttribute(key, this.inputProps[key]);
|
|
10327
|
-
}
|
|
10328
|
-
}
|
|
10329
10337
|
}
|
|
10330
10338
|
ngAfterViewInit() {
|
|
10331
10339
|
var _a, _b;
|
|
@@ -10360,12 +10368,36 @@ var IntlTelInputComponent = class {
|
|
|
10360
10368
|
this.onChange(num);
|
|
10361
10369
|
this.onValidatorChange();
|
|
10362
10370
|
}
|
|
10363
|
-
handleBlur() {
|
|
10371
|
+
handleBlur(event) {
|
|
10364
10372
|
this.onTouched();
|
|
10373
|
+
this.blur.emit(event);
|
|
10374
|
+
}
|
|
10375
|
+
handleFocus(event) {
|
|
10376
|
+
this.focus.emit(event);
|
|
10377
|
+
}
|
|
10378
|
+
handleKeyDown(event) {
|
|
10379
|
+
this.keydown.emit(event);
|
|
10380
|
+
}
|
|
10381
|
+
handleKeyUp(event) {
|
|
10382
|
+
this.keyup.emit(event);
|
|
10383
|
+
}
|
|
10384
|
+
handlePaste(event) {
|
|
10385
|
+
this.paste.emit(event);
|
|
10386
|
+
}
|
|
10387
|
+
handleClick(event) {
|
|
10388
|
+
this.click.emit(event);
|
|
10365
10389
|
}
|
|
10390
|
+
/**
|
|
10391
|
+
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
|
|
10392
|
+
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
|
|
10393
|
+
*/
|
|
10366
10394
|
getInstance() {
|
|
10367
10395
|
return this.iti;
|
|
10368
10396
|
}
|
|
10397
|
+
/**
|
|
10398
|
+
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
|
|
10399
|
+
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
|
|
10400
|
+
*/
|
|
10369
10401
|
getInput() {
|
|
10370
10402
|
return this.inputRef.nativeElement;
|
|
10371
10403
|
}
|
|
@@ -10429,7 +10461,7 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
10429
10461
|
let _t;
|
|
10430
10462
|
i0.\u0275\u0275queryRefresh(_t = i0.\u0275\u0275loadQuery()) && (ctx.inputRef = _t.first);
|
|
10431
10463
|
}
|
|
10432
|
-
}, inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputProps: "inputProps", disabled: "disabled", initOptions: "initOptions" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange" }, features: [i0.\u0275\u0275ProvidersFeature([
|
|
10464
|
+
}, inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputProps: "inputProps", disabled: "disabled", initOptions: "initOptions" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange", blur: "blur", focus: "focus", keydown: "keydown", keyup: "keyup", paste: "paste", click: "click" }, features: [i0.\u0275\u0275ProvidersFeature([
|
|
10433
10465
|
{
|
|
10434
10466
|
provide: NG_VALUE_ACCESSOR,
|
|
10435
10467
|
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
@@ -10440,16 +10472,31 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
10440
10472
|
useExisting: forwardRef(() => IntlTelInputComponent),
|
|
10441
10473
|
multi: true
|
|
10442
10474
|
}
|
|
10443
|
-
]), i0.\u0275\u0275NgOnChangesFeature], decls: 2, vars: 0, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
10475
|
+
]), i0.\u0275\u0275NgOnChangesFeature], decls: 2, vars: 0, consts: [["inputRef", ""], ["type", "tel", 3, "input", "blur", "focus", "keydown", "keyup", "paste", "click"]], template: function IntlTelInputComponent_Template(rf, ctx) {
|
|
10444
10476
|
if (rf & 1) {
|
|
10445
10477
|
const _r1 = i0.\u0275\u0275getCurrentView();
|
|
10446
10478
|
i0.\u0275\u0275elementStart(0, "input", 1, 0);
|
|
10447
10479
|
i0.\u0275\u0275listener("input", function IntlTelInputComponent_Template_input_input_0_listener() {
|
|
10448
10480
|
i0.\u0275\u0275restoreView(_r1);
|
|
10449
10481
|
return i0.\u0275\u0275resetView(ctx.handleInput());
|
|
10450
|
-
})("blur", function IntlTelInputComponent_Template_input_blur_0_listener() {
|
|
10482
|
+
})("blur", function IntlTelInputComponent_Template_input_blur_0_listener($event) {
|
|
10451
10483
|
i0.\u0275\u0275restoreView(_r1);
|
|
10452
|
-
return i0.\u0275\u0275resetView(ctx.handleBlur());
|
|
10484
|
+
return i0.\u0275\u0275resetView(ctx.handleBlur($event));
|
|
10485
|
+
})("focus", function IntlTelInputComponent_Template_input_focus_0_listener($event) {
|
|
10486
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
10487
|
+
return i0.\u0275\u0275resetView(ctx.handleFocus($event));
|
|
10488
|
+
})("keydown", function IntlTelInputComponent_Template_input_keydown_0_listener($event) {
|
|
10489
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
10490
|
+
return i0.\u0275\u0275resetView(ctx.handleKeyDown($event));
|
|
10491
|
+
})("keyup", function IntlTelInputComponent_Template_input_keyup_0_listener($event) {
|
|
10492
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
10493
|
+
return i0.\u0275\u0275resetView(ctx.handleKeyUp($event));
|
|
10494
|
+
})("paste", function IntlTelInputComponent_Template_input_paste_0_listener($event) {
|
|
10495
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
10496
|
+
return i0.\u0275\u0275resetView(ctx.handlePaste($event));
|
|
10497
|
+
})("click", function IntlTelInputComponent_Template_input_click_0_listener($event) {
|
|
10498
|
+
i0.\u0275\u0275restoreView(_r1);
|
|
10499
|
+
return i0.\u0275\u0275resetView(ctx.handleClick($event));
|
|
10453
10500
|
});
|
|
10454
10501
|
i0.\u0275\u0275elementEnd();
|
|
10455
10502
|
}
|
|
@@ -10465,7 +10512,12 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
10465
10512
|
type="tel"
|
|
10466
10513
|
#inputRef
|
|
10467
10514
|
(input)="handleInput()"
|
|
10468
|
-
(blur)="handleBlur()"
|
|
10515
|
+
(blur)="handleBlur($event)"
|
|
10516
|
+
(focus)="handleFocus($event)"
|
|
10517
|
+
(keydown)="handleKeyDown($event)"
|
|
10518
|
+
(keyup)="handleKeyUp($event)"
|
|
10519
|
+
(paste)="handlePaste($event)"
|
|
10520
|
+
(click)="handleClick($event)"
|
|
10469
10521
|
/>
|
|
10470
10522
|
`,
|
|
10471
10523
|
providers: [
|
|
@@ -10502,10 +10554,22 @@ IntlTelInputComponent.\u0275cmp = /* @__PURE__ */ i0.\u0275\u0275defineComponent
|
|
|
10502
10554
|
type: Output
|
|
10503
10555
|
}], errorCodeChange: [{
|
|
10504
10556
|
type: Output
|
|
10557
|
+
}], blur: [{
|
|
10558
|
+
type: Output
|
|
10559
|
+
}], focus: [{
|
|
10560
|
+
type: Output
|
|
10561
|
+
}], keydown: [{
|
|
10562
|
+
type: Output
|
|
10563
|
+
}], keyup: [{
|
|
10564
|
+
type: Output
|
|
10565
|
+
}], paste: [{
|
|
10566
|
+
type: Output
|
|
10567
|
+
}], click: [{
|
|
10568
|
+
type: Output
|
|
10505
10569
|
}] });
|
|
10506
10570
|
})();
|
|
10507
10571
|
(() => {
|
|
10508
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angularwithutils.ts", lineNumber:
|
|
10572
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.\u0275setClassDebugInfo(IntlTelInputComponent, { className: "IntlTelInputComponent", filePath: "intl-tel-input/angularwithutils.ts", lineNumber: 68 });
|
|
10509
10573
|
})();
|
|
10510
10574
|
export {
|
|
10511
10575
|
IntlTelInputComponent,
|
|
@@ -11,12 +11,18 @@ export declare class IntlTelInputComponent implements OnInit, AfterViewInit, OnD
|
|
|
11
11
|
initialValue: string;
|
|
12
12
|
usePreciseValidation: boolean;
|
|
13
13
|
inputProps: object;
|
|
14
|
-
disabled
|
|
14
|
+
disabled?: boolean;
|
|
15
15
|
initOptions: SomeOptions;
|
|
16
16
|
numberChange: EventEmitter<string>;
|
|
17
17
|
countryChange: EventEmitter<string>;
|
|
18
18
|
validityChange: EventEmitter<boolean>;
|
|
19
19
|
errorCodeChange: EventEmitter<number>;
|
|
20
|
+
blur: EventEmitter<FocusEvent>;
|
|
21
|
+
focus: EventEmitter<FocusEvent>;
|
|
22
|
+
keydown: EventEmitter<KeyboardEvent>;
|
|
23
|
+
keyup: EventEmitter<KeyboardEvent>;
|
|
24
|
+
paste: EventEmitter<ClipboardEvent>;
|
|
25
|
+
click: EventEmitter<MouseEvent>;
|
|
20
26
|
private iti;
|
|
21
27
|
private countryChangeHandler;
|
|
22
28
|
private onChange;
|
|
@@ -26,8 +32,21 @@ export declare class IntlTelInputComponent implements OnInit, AfterViewInit, OnD
|
|
|
26
32
|
ngAfterViewInit(): void;
|
|
27
33
|
ngOnChanges(changes: SimpleChanges): void;
|
|
28
34
|
handleInput(): void;
|
|
29
|
-
handleBlur(): void;
|
|
35
|
+
handleBlur(event: FocusEvent): void;
|
|
36
|
+
handleFocus(event: FocusEvent): void;
|
|
37
|
+
handleKeyDown(event: KeyboardEvent): void;
|
|
38
|
+
handleKeyUp(event: KeyboardEvent): void;
|
|
39
|
+
handlePaste(event: ClipboardEvent): void;
|
|
40
|
+
handleClick(event: MouseEvent): void;
|
|
41
|
+
/**
|
|
42
|
+
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
|
|
43
|
+
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
|
|
44
|
+
*/
|
|
30
45
|
getInstance(): Iti | null;
|
|
46
|
+
/**
|
|
47
|
+
* This method must be called in `ngAfterViewInit` or later lifecycle hooks,
|
|
48
|
+
* not in `ngOnInit` or the `constructor`, as the component needs to be fully initialized.
|
|
49
|
+
*/
|
|
31
50
|
getInput(): HTMLInputElement | null;
|
|
32
51
|
ngOnDestroy(): void;
|
|
33
52
|
private applyInputProps;
|
|
@@ -38,5 +57,5 @@ export declare class IntlTelInputComponent implements OnInit, AfterViewInit, OnD
|
|
|
38
57
|
validate(control: AbstractControl): ValidationErrors | null;
|
|
39
58
|
registerOnValidatorChange(fn: () => void): void;
|
|
40
59
|
static ɵfac: i0.ɵɵFactoryDeclaration<IntlTelInputComponent, never>;
|
|
41
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<IntlTelInputComponent, "intl-tel-input", never, { "initialValue": { "alias": "initialValue"; "required": false; }; "usePreciseValidation": { "alias": "usePreciseValidation"; "required": false; }; "inputProps": { "alias": "inputProps"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "initOptions": { "alias": "initOptions"; "required": false; }; }, { "numberChange": "numberChange"; "countryChange": "countryChange"; "validityChange": "validityChange"; "errorCodeChange": "errorCodeChange"; }, never, never, true, never>;
|
|
60
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<IntlTelInputComponent, "intl-tel-input", never, { "initialValue": { "alias": "initialValue"; "required": false; }; "usePreciseValidation": { "alias": "usePreciseValidation"; "required": false; }; "inputProps": { "alias": "inputProps"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "initOptions": { "alias": "initOptions"; "required": false; }; }, { "numberChange": "numberChange"; "countryChange": "countryChange"; "validityChange": "validityChange"; "errorCodeChange": "errorCodeChange"; "blur": "blur"; "focus": "focus"; "keydown": "keydown"; "keyup": "keyup"; "paste": "paste"; "click": "click"; }, never, never, true, never>;
|
|
42
61
|
}
|