diff --git a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html index 1847676f4..14cfb5ae5 100644 --- a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html +++ b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html @@ -80,7 +80,8 @@ diff --git a/libs/ui/src/lib/value/value.component.stories.ts b/libs/ui/src/lib/value/value.component.stories.ts index f11eb256e..91c5f8fb5 100644 --- a/libs/ui/src/lib/value/value.component.stories.ts +++ b/libs/ui/src/lib/value/value.component.stories.ts @@ -38,8 +38,14 @@ Integer.args = { export const Label = Template.bind({}); Label.args = { - isInteger: true, label: 'Label', locale: 'en-US', - value: 7 + value: 7.25 +}; + +export const Precision = Template.bind({}); +Precision.args = { + locale: 'en-US', + precision: 3, + value: 7.2534802394809285309 }; diff --git a/libs/ui/src/lib/value/value.component.ts b/libs/ui/src/lib/value/value.component.ts index 869392003..16db5c021 100644 --- a/libs/ui/src/lib/value/value.component.ts +++ b/libs/ui/src/lib/value/value.component.ts @@ -23,6 +23,7 @@ export class ValueComponent implements OnChanges { @Input() label = ''; @Input() locale = ''; @Input() position = ''; + @Input() precision = 0; @Input() size = ''; @Input() value: number | string = ''; @@ -89,6 +90,13 @@ export class ValueComponent implements OnChanges { minimumFractionDigits: 0 }); } catch {} + } else if (this.precision) { + this.formattedValue = this.value?.toLocaleString(this.locale, { + maximumFractionDigits: this.precision, + minimumFractionDigits: this.precision + }); + } else { + this.formattedValue = this.value.toString(); } } else { try {