Skip to content

Releases: parttio/textfieldformatter

v2.1

07 Sep 16:58
Compare
Choose a tag to compare

Updated Cleave.js to 1.4.4

Fixes #12

v2.0

28 May 11:26
Compare
Choose a tag to compare

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

24 Mar 09:52
Compare
Choose a tag to compare
v2.0.beta1 Pre-release
Pre-release

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

http://johku.app.fi/textfieldformatter/

v2.0.alpha1

26 Feb 07:52
Compare
Choose a tag to compare
v2.0.alpha1 Pre-release
Pre-release
  • API and code cleanup as a preparation for 2.0 features

v1.6

22 Feb 21:21
Compare
Choose a tag to compare
  • 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

16 Feb 19:57
Compare
Choose a tag to compare
  • 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

12 Feb 22:33
Compare
Choose a tag to compare
  • Added numericOnly option to CustomStringBlockFormatter

v1.3

28 Aug 15:09
Compare
Choose a tag to compare
  • 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

29 Mar 13:04
Compare
Choose a tag to compare
  • 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

25 Mar 19:15
Compare
Choose a tag to compare
  • Fixed delimiters in CustomStringBlockFormatter
  • Force upper case in IBANFormatter