Numeric editor mask and format
Is your feature request related to a problem? Please describe.
I use igxMask directive in order to limit the number of digits that end users can insert. However, as igxMask treats value as text. So that I cannot achieve the following requirements.
- Insert thousand separator automatically
- Limit the number of digits for both integer part and decimal part e.g. integer part accepts up to 6 digits, and decimal part accepts up to 2 digits
- Caret position e.g. When the existing value is cleared on the editor, it is expected that caret is just before decimal point so that end users are able to type integer part and decimal part smoothly. (On the other hand, with igxMask, caret comes to the first digits after the existing value is cleared. So we specifically need to move caret position to the largest digit that we are going to input, then we can start typing.)
Additional context
There is a component that meets the requirements. https://js.devexpress.com/Demos/WidgetsGallery/Demo/NumberBox/Formatting/Angular/Light/ --> "Fixed point format" fulfills requirements above.
Steps:
- Clear the value of "Fixed point format" sample
- Type 12.33 --> 12.33 is typed correctly.
@ymita IMO on 1 this is something to be determined with the locale, however it is possible to define a mask like this [igxMask]="'00,0000.00'" and achieve that for the case you describe in 2 and 3. The provided mask also solves your request for 2 I believe, thus only 3 is left, where I agree with you that once the masked input is focused it should be possible to enter numbers rather than having to move the caret before being able to type value in. However, I want to make sure that my understanding of your requirements for 1 and 2 is correct.
@StefanIvanov For 1, I agree with you that thousand separator is inserted based on locale. IgxMask directive meets 1 and 2 by using your configuration. However, igxMask does not achieve the 4th scenario that I just added. The 4th one is also a common behavior as a numeric editor.
@ymita where did you add a 4th scenario, I don't see 4. in the issue description
@StefanIvanov I am afraid that the 4th one was not correctly saved.. and I am not sure what I wrote on the 4th one. This is not directly related to the above 3 points but I believe it should have been something similar to restricting value like maximum/minimum value. For numeric editor, we would want to have maximum and minimum value restriction. With igxMask directive, we can restrict the number of digits but we cannot specify value.
Hi @ymita can we close this issue? If the min/max is a feature request we can create a new isssue for it.
@StefanIvanov You can close this issue and create a new one. Numeric editor will be a great addition to Ignite UI for Angular. For the numeric editor, I believe the requirement #3 will be covered.
Apparently min and max values can be set as well here is how I did it https://stackblitz.com/edit/angular-b5mfed
The only thing then is the caret/selection upon focus which is achievable through a directive that we have not exposed so all in all I think the best resolution would be to show all this functionality in the input group sample since it actually exists.
I created an issue for sample update to showcase all of this.
Hi, i know this issue is closed but couldn't be sure about the status of problem 3 @ymita described. we have the same requirement and after checking all the samples and documentation couldn't find a clear way to do it. Our requirement is more generic as we need the caret position always to be the first 'editable' index of the input value. I can see the methods @StefanIvanov mentioned about position manipulation but none of them is public so wondering if there is a recommended way of doing this?