primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.35k stars 4.58k forks source link

InputNumber: Display fraction digits only when these are present #16217

Open dumitru-tabara-dev opened 2 months ago

dumitru-tabara-dev commented 2 months ago

Describe the bug

Can you display the fraction digits only when these have been specified by the user? Otherwise, hide the fraction digits.

image

For example, in this screenshot, I typed 45 and it displays 45.00. I set the [minFractionDigits]="2" because I also want to introduce fraction digits. But I don't want to see the fraction digits all the time: If I type 45, it should display 45. If I type 45.2 it should display 45.2 or 45.20(because I set the minFractionDigits = 2). Can you fix this or add a new property to control this?

This is the code used for the above result: <p-inputNumber id="input-{{formIndex}}" class="w-full" formControlName="input" inputId="locale-user" [style]="{width:'100%'}" [minFractionDigits]="2" variant="filled"></p-inputNumber>

Environment

Angular 17.3.8. PrimeNG 17.18.7.

Reproducer

No response

Angular version

17.3.8

PrimeNG version

17.18.7

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.16.0

Browser(s)

Chrome 127.0

Steps to reproduce the behavior

No response

Expected behavior

No response

dumitru-tabara-dev commented 2 weeks ago

@cetincakiroglu , can you help me with this one please? Or at least let me know what I should expect.