Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing Decimal Not Added When mask="separator.1" and leadZero="true" #1358

Closed
nathanielbuck opened this issue Apr 26, 2024 · 0 comments
Closed

Comments

@nathanielbuck
Copy link
Contributor

nathanielbuck commented Apr 26, 2024

🐞 bug report

Description

I'm not sure if this is a bug or a design decision, but I'd like to have single-decimal auto-completion when no decimal was entered and an input loses focus.

I'm using mask="separator.1" and [leadZero]="true". So, if I type "1" in the input and click/tab out, nothing happens currently. My goal is to have the input value changed to "1.0" in this scenario. (Auto-completion works with mask="separator.2", mask="separator.3", etc.)

This is my first time looking through the source, but it seems like this might be an intentional design decision (if this is indeed is the right spot) as you're checking to see if Number(separatorPrecision) > 1:

https://github.com/JsDaddy/ngx-mask/blob/develop/projects/ngx-mask-lib/src/lib/ngx-mask.service.ts#L714C13-L716C62

🔬 Minimal Reproduction

<input mask="separator.1" [leadZero]="true" />

https://stackblitz.com/edit/angular-pft6dj?file=src%2Fmain.ts

🌍 Your Environment

Angular Version:
16.2.12

ngx-mask Version:
16.4.2

Angular CLI: 16.2.13
Node: 18.12.1
Package Manager: npm 9.6.7
OS: darwin x64

Angular: 16.2.12
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1602.13
@angular-devkit/build-angular   16.2.13
@angular-devkit/core            16.2.13
@angular-devkit/schematics      16.2.13
@angular/cli                    16.2.13
@schematics/angular             16.2.13
rxjs                            6.6.7
typescript                      4.9.5
zone.js                         0.13.3
@nathanielbuck nathanielbuck changed the title Trailing Decimal Not Added When separator.1 and leadZero="true" Trailing Decimal Not Added When mask="separator.1" and leadZero="true" Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants