Using InputMask from Constellation UI Gallery to format input fields on Pega Infinity
This article will teach how to download and use Contellation UI Gallery component to mask input fields in Pega Infinity
Requirements:
Pega Infinity
Case type created
Constellation UI Gallery downloaded:
https://github.com/pegasystems/constellation-ui-gallery/releases
P.S.: Attention to your Pega Infinity version. Each version uses a different UI Gallery release
- Pega '23: Use version 1.x and the release/1.x.x branch.
- Pega '24.1: Use version 2.x and the release/2.0 branch.
- Pega '24.2: Use version 3.x and the master branch.
Instructions
After we download Constellation UI Gallery from Pega's GitHub, we need to go into Dev Studio. In Dev Studio, we can go to Configure -> Application -> Distribution -> Import
Select your file location. In our case, we are using a local file downloaded from GitHub. Keep Local File selection, then click "Choose File" and select the .zip file you downloaded from GitHub. Click "Next".
Here you can advance to the next step
In this step, it's possible to select with rules from Constellation UI Gallery you want to import to your environment. To mask fields, MaskedInput is used. If you wish to uncheck any rules, you can do it here. When you're done, click "Next". Wait for the import to finish and click "Done"
After the setup, we can go to App Studio. In App Studio, go to your case type, select the assignment you want to introduce a masked input field, and click "Configure View".
On the "Configure View" window, on the right side of the screen, click "+ Add -> Fields -> Create new field"
Create a Text (single line) field. In this example, we are using CPF, which is a brazilian personal identification number formated as "000.000.000-00".
Back to Configure View window, click the gear icon next to your newly created field
Click "Display as" dropdown menu and select MaskedInput.
Fill out the "Mask" field with the mask you wish to apply to your input field (In this case, CPF is formatted as 000.000.000-00)
P.S.: You can lookup to UI Gallery's documentation to learn about other types of masks
Now the input field is ready to receive the masked value. Dots and dashes are inserted automatically as the user types the value, and the field won't allow more digits than the limit established by the Mask.
Useful links:
Constellation UI Gallery on GitHub for download
Constellation UI Gallery Documentation. InputMask section presents other mask settings