Skip to content
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

Hot to create a mask for numbers and Uppercase letters #109

Open
ferulisses opened this issue May 22, 2019 · 2 comments
Open

Hot to create a mask for numbers and Uppercase letters #109

ferulisses opened this issue May 22, 2019 · 2 comments

Comments

@ferulisses
Copy link

In the examples, we can choose between "AAA" and that will accept typing in upper or lowercase and convert to uppercase.

But there is no such functionality if we are using "XXX", it will accept upper and lowercase characters.

As a suggestion, you could create "YYY" and "yyy" that will accept numbers and the respective uppercase or lowercase characters and have the same functionality as "AAA" and "aaa"

@ferulisses
Copy link
Author

Examples of data are the new Mercosul car plates:
ABC-1234
ABC-1A34
ABC-12A4

I could figure out a way to support these using array:
['AAA-XXXX','AAA-XAXX','AAA-XXAX']

But for another application, I will need to support combinations of letters and numbers to type a serial code, examples:
ABCD-1234-WXYZ-5678
2345-BCDE-8765-ZYXW
A1B2-C3D4-E5F6-G7H8

The array for these combinations will be too big.

@zacharytyhacz
Copy link

zacharytyhacz commented Jun 5, 2019

You can define your own regular expression
<the-mask mask="FFFFFF" :tokens="hexTokens" />
then in your script somewhere:

hexTokens: {
  F: {
    pattern: /[0-9A-Z]/,
    transform: v => v.toLocaleUpperCase()
  }
}

the regular expression A-Z will capture all capital letters and 0-9 wil capture all integers.
the
transform: v => v.toLocaleUpperCase() line will automatically convert input to capitalize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants