SUPPORT-8717: fix for review (2)
This commit is contained in:
parent
3c0e82d16a
commit
513aea3e30
4 changed files with 21 additions and 19 deletions
|
|
@ -1,13 +0,0 @@
|
|||
import {
|
||||
ChartLabelModel
|
||||
} from "../../../../../generated/ervu_business_metrics/model/chart/round/label/ChartLabelModel";
|
||||
import {NumberToLocalStringFormatter} from "../../../../formatter/NumberToLocalStringFormatter";
|
||||
import {ChartLabelFormatter} from "./ChartLabelFormatter";
|
||||
|
||||
export class LabelNumberToLocalStringFormatter implements ChartLabelFormatter {
|
||||
private static readonly format = NumberToLocalStringFormatter.prototype.format;
|
||||
|
||||
format(label: ChartLabelModel, labels?: ChartLabelModel[], index?: number): void {
|
||||
label.text = LabelNumberToLocalStringFormatter.format(label.text);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import {
|
||||
ChartLabelModel
|
||||
} from "../../../../../generated/ervu_business_metrics/model/chart/round/label/ChartLabelModel";
|
||||
import {FormatterUtils} from "../../../../formatter/FormatterUtils";
|
||||
import {ChartLabelFormatter} from "./ChartLabelFormatter";
|
||||
|
||||
export class NumberToLocalStringLabelFormatter implements ChartLabelFormatter {
|
||||
format(label: ChartLabelModel, labels?: ChartLabelModel[], index?: number): void {
|
||||
label.text = FormatterUtils.toLocalString(label.text);
|
||||
}
|
||||
}
|
||||
|
|
@ -60,4 +60,11 @@ export class FormatterUtils {
|
|||
return formattedValue;
|
||||
}
|
||||
|
||||
}
|
||||
public static toLocalString(value: string): string {
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
const numberValue = Number(value);
|
||||
return numberValue ? numberValue.toLocaleString() : value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
import {TextFormatter} from "@webbpm/base-package";
|
||||
import {FormatterUtils} from "./FormatterUtils";
|
||||
|
||||
export class NumberToLocalStringFormatter implements TextFormatter {
|
||||
format(value: string): string {
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
const numberValue = Number(value);
|
||||
return numberValue ? numberValue.toLocaleString() : value;
|
||||
return FormatterUtils.toLocalString(value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue