Releases: parttio/textfieldformatter
Releases · parttio/textfieldformatter
v2.1
v2.0
No changes since beta1. Here are the changes from 1.6
- API and code cleanup
- Added AttributeExtension to add any attribute to a component. Fixes #9
AttributeExtension attributes = new AttributeExtension();
attributes.addAttribute("autocomplete", "cc-exp");
TextField myTextField = new TextField();
attributes.extend(myTextField);
- CreditCardFieldFormatter adds now autocomplete="cc-number" to the text field. Fixes #8
Known limitations
- Removing an attribute from AttributeExtension does not remove the attribute from the component
- Turning off autocomplete with CreditCardFieldFormatter not supported
v2.0.beta1
New since 2.0.alpha1
- Added AttributeExtension to add any attribute to a component. Fixes #9
AttributeExtension attributes = new AttributeExtension();
attributes.addAttribute("autocomplete", "cc-exp");
TextField myTextField = new TextField();
attributes.extend(myTextField);
- CreditCardFieldFormatter adds now autocomplete="cc-number" to the text field. Fixes #8
Known limitations
- Removing an attribute from AttributeExtension does not remove the attribute from the component
- Turning off autocomplete with CreditCardFieldFormatter not supported
Demo
v2.0.alpha1
- API and code cleanup as a preparation for 2.0 features
v1.6
- Added prefix option to CustomStringBlockFormatter.
- Updated Cleave.js to 1.1.0
The prefix needs to be set in the block lengths. e.g. If you want achieve formatting PREFIX: 123-456
you should set the first block length as 7 (the length of word prefix and the following : character. The first delimiter is
and the following one is -
. In Java:
Options options = new Options();
options.setBlocks(7, 3, 3);
options.setDelimiters(" ", "-");
options.setNumericOnly(true);
options.setPrefix("PREFIX:");
new CustomStringBlockFormatter(options);
There is now also a convenience API to help setting the prefix. Notice, you don't need to calculate the prefix length.
Builder builder = new CustomStringBlockFormatter.Builder();
builder.blocks(3, 3).delimiters("-").numeric().prefix("PREFIX:", " ");
CustomStringBlockFormatter formatter = builder.build();
v1.5
- You can now create a new instance of formatter and replace the previous one in the same text field
myFormatter.remove();
myFormatter = new CustomStringBlockFormatter(myTextField,
new int[] { 1, 2, 3 }, new String[] { "-", "-" }, ForceCase.UPPER);
- There is now Option data class for storing formatting options for reusing
Options formatA = new Options(new int[] { 1, 2, 3 },
new String[] { "-", "-" }, ForceCase.UPPER);
Options formatB = new Options(formatA);
formatB.setDelimiters("*");
myFormatter = new CustomStringBlockFormatter(myTextField, formatB);
v1.4
- Added numericOnly option to CustomStringBlockFormatter
v1.3
- Update to cleave.js 1.0.1
- Added NumeralFieldFormatter for numeral fields allowing customizing of:
- Integer group delimiter
- Decimal marker
- Number of decimals
- You can limit to positive numbers only
v1.2
- Added support for phone number formatting based on country code
- Uses cleave-phone.i18n.js, which is quite large. Future version will make it possible to skip the script loading if you don't use the phone number feature
v1.1
- Fixed delimiters in CustomStringBlockFormatter
- Force upper case in IBANFormatter