UNPKG

@gooddata/react-components

Version:

GoodData.UI - A powerful JavaScript library for building analytical applications

32 lines (31 loc) 1.43 kB
import { Localization } from "@gooddata/typings"; import { IArithmeticMeasureTitleProps, IMeasureTitleProps } from "../interfaces/MeasureTitle"; /** * Factory that builds formatted localized titles of arithmetic measures. * The title is used during AFM execution and for bucket item titles. * * @internal */ export default class ArithmeticMeasureTitleFactory { private readonly locale; /** * Create a new instance of the class. * @param {Localization.ILocale} locale - The locale used for translation. */ constructor(locale: Localization.ILocale); /** * Returns formatted localized title string for arithmetic measure. * * @param {IArithmeticMeasureTitleProps} arithmeticMeasureProps - The properties of arithmetic measure for which * the title must be obtained. * @param {IMeasureTitleProps} measureTitleProps - The array of objects in which the title of master measures used * in arithmetic measure is looked up. * @returns {string} localized title of the arithmetic measure or null when arithmetic measure references invalid * master measures or invalid number of master measures. */ getTitle(arithmeticMeasureProps: IArithmeticMeasureTitleProps, measureTitleProps: IMeasureTitleProps[]): string; private getTitleLocalizationKey; private getMasterMeasureTitles; private findMeasureTitle; private translateKey; }