vaadin-miki/super-fields

Alternative symbols for grouping and decimal separators

Closed this issue ยท 4 comments

Taking into account the format of my country, where points are used as a separator for thousands and commas for decimals. It is possible to use the point of the numeric keyboard as a decimal separator, but when formatting it, convert it to a comma?
So, the user enters 1000.50 on the keyboard and the result is 1,000.50.
I think here #383 had the same query.
An example of this functionality is provided by primefaces and its description is as follows: "Allow to declare an alternative decimal separator which is automatically replaced by decimalCharacter when typed."

hello @edgardopino - apologies for taking it so long to answer

this is a neat feature to have, I will try to get it implemented :) no promises on the exact date, though...

turns out something similar already has been done behind the scenes to allow (space) instead of non-breaking space used as a grouping separator; will continue with the idea next week, but it looks doable and should be included in the next release

basic implementation done in branch 472-decimal_separator_alternative - it supports alternatives, but does not allow overriding characters that are already used (so not possible yet to replace the meaning of . with , - but that is going to be the next step)

then again, it might be somewhat difficult, as it may be difficult to figure out when a character is entered as a e.g. decimal separator and when as a grouping separator

ok, that seems to be somewhat doable by removing regular format characters in allowedCharPattern, but allowing them still in the regular expression - meaning it is impossible to type them, but they do appear in the formatted text
need to think about the best api for that, but for sure such a feature would be disabled by default ;)