Show decimal transactionCount
and singular for 1 transaction (#327)
* Show decimal `transactionCount` and singular for 1 transaction * Update changelog Co-authored-by: Thomas <4159106+dtslvr@users.noreply.github.com>
This commit is contained in:
parent
6a0cfb8f77
commit
01feead017
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed the value formatting for integers (transactions count)
|
||||
|
||||
## 1.44.0 - 30.08.2021
|
||||
|
||||
### Changed
|
||||
|
@ -102,9 +102,10 @@
|
||||
</div>
|
||||
<div class="col-6 mb-3">
|
||||
<gf-value
|
||||
label="Transactions"
|
||||
size="medium"
|
||||
[isCurrency]="true"
|
||||
[isCurrency]="false"
|
||||
[isInteger]="true"
|
||||
[label]="transactionCount === 1 ? 'Transaction' : 'Transactions'"
|
||||
[locale]="data.locale"
|
||||
[value]="transactionCount"
|
||||
></gf-value>
|
||||
|
@ -19,6 +19,7 @@ export class ValueComponent implements OnChanges, OnInit {
|
||||
@Input() colorizeSign: boolean;
|
||||
@Input() currency: string;
|
||||
@Input() isCurrency: boolean;
|
||||
@Input() isInteger: boolean;
|
||||
@Input() isPercent: boolean;
|
||||
@Input() label: string;
|
||||
@Input() locale: string;
|
||||
@ -84,6 +85,13 @@ export class ValueComponent implements OnChanges, OnInit {
|
||||
minimumFractionDigits: 2
|
||||
});
|
||||
} catch {}
|
||||
} else if (this.isInteger) {
|
||||
try {
|
||||
this.formattedValue = this.value?.toLocaleString(this.locale, {
|
||||
maximumFractionDigits: 0,
|
||||
minimumFractionDigits: 0
|
||||
});
|
||||
} catch {}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user