-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump to support intl tel input 21 #54
base: master
Are you sure you want to change the base?
Conversation
i'll take a look at this change, thanks for pointing it to me.
That's not how I understand the doc
I suppose we should had a new |
Yeah you are right i will come back to you with a proposition. I see that with the last version intl-tel-input is bundled with types so i took the liberty to replace your types by the type of intl-tel-input project. |
So as said before i replace your types by the types from intl-tel-input. I add a new Input variable isMobileOnly default true (like i understand from the doc) |
@Input() required!: boolean; | ||
@Input() isMobileOnly: boolean = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go in a dedicated commit, and tests should be added.Also, I think that it should be false
by default to be the least breaking as possible
import intlTelInput from 'intl-tel-input'; | ||
import { IntlTelInputOptions } from '../model/intl-tel-input-options'; | ||
import { IntlTelInput } from "../model/intl-tel-input"; | ||
import intlTelInput, {Iti, SomeOptions} from 'intl-tel-input'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With v21.0.6, tsconfig.json needs to be changed, like this
"paths": {
"intl-tel-input": [
"node_modules/intl-tel-input/build/js/intlTelInput"
]
},
and old path must be removed
"paths": {
"intl-tel-input": [
"src/lib/@types/intl-tel-input"
]
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an error from upstream, will open a PR for discussion. We shouldn't need that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
21.0.8+ fixes this, so not needed (old path must still be cleaned up). You may npm update
anyway, and see how it goes.
@@ -43,6 +43,7 @@ describe('IntlTelInputComponent', () => { | |||
|
|||
it('should convert phone number to E164 format', () => { | |||
component.options = { | |||
initialCountry: 'ch', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we can't do better, uh
@@ -60,6 +61,7 @@ See the [intl-tel-input repository](https://github.com/jackocnr/intl-tel-input) | |||
i18n: { ch: 'Suisse' }, | |||
onlyCountries: ['fr', 'ch'] | |||
}" | |||
[isMobileOnly]=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please reindent and set to true
as we'll switch to false
by default
@tlebreton also please run |
Hi :)
This pr allow us to use intl-tel-input 21 Changelog 20 Changelog 21
I don't think verison 21 is a big problem for your package (maybe i am wrong :D )
I needed to update test unit because of this :
Remove defaultToFirstCountry option as that behaviour was jackocnr/intl-tel-input#1525 (comment) and so is not recommended (you can always use initialCountry to set the initial country if you wish to)
I decide to add initialCountry: "ch" because it solve test but don't know if it's correct or not.
Another thinks that changes is the way validNumber works :
By default, calling isValidNumber will now default to mobile-only mode (it will only return true for valid mobile numbers), which means it will be jackocnr/intl-tel-input#1535 - if you don't want this, you can pass false as an argument e.g. isValidNumber(false)
It can be solved with another options 'isMobileVerification' with default to true(like intl-tel-input)
What is your opinion on this subject ?