import NumberFormatting from '../number-formatting'; import type { NumberOptions } from '../number-formatting'; import type { FormatFlags } from './format'; import type { PriceFormatOption } from './format-options'; import type { Scenarios } from './types'; /** * Constructs a new PriceFormatting instance that can be used to format and parse prices. * @param numberOptions - (optional) See {@link Numbers} for possible number options. * @example * ```ts * const priceFormatting = new PriceFormatting({decimalSeparator: ','}); * const formattedPrice = priceFormatting.format(1.23, 2); * ``` */ declare class PriceFormatting { numberFormatting: NumberFormatting; constructor(numberOptions?: Partial); /** * Formats a number as a price string. * @param value - Number to format. * @param decimals - The number of decimal places to display. * @param formatOptions - (optional) The format flags to use when formatting * If the flag is not recognized, it will be treated as if it is "Normal" * @param numeratorDecimals - (optional) The number of decimal places of the numerator in the case of fractions and modern fractions. Default = 0 * @returns The formatting string. */ format(value: number | undefined | null | string, decimals: number, formatOptions?: PriceFormatOption | PriceFormatOption[] | FormatFlags | null, numeratorDecimals?: number): string; /** * Formats a number as price parts. * @param value - Number to format. * @param decimals - The number of decimal places to display. * @param formatOptions - The format flags to use when formatting - see {@link PriceFormatOption}. * @param numeratorDecimals - (optional) The number of decimal places of the numerator in the case of fractions and modern fractions. Default = 0 * @returns formatted price parts. */ formatPriceParts(value: number | undefined | null | string, decimals: number, formatOptions?: PriceFormatOption | PriceFormatOption[] | FormatFlags, numeratorDecimals?: number): import("./format").PriceParts; /** * Formats a number using a template. * @param value - Number to format. * @param decimals - The number of decimal places to display. * @param formatOptions - (optional) The format flags to use when formatting. * @param numeratorDecimals - (optional) The number of decimal places of the numerator in the case of fractions and modern fractions. * @param templateStr - (optional) The template string to use. Default = `{Pre}{First}{Pips}{DeciPips}{Post}` * @returns A formatted string. */ formatTemplated(value: number, decimals: number, formatOptions?: PriceFormatOption, numeratorDecimals?: number, templateStr?: string): string; /** * Parses a string into a number. * @param str - The number to parse. * @param decimals - The number of decimals. * @param formatFlags - The format flags to use when parsing - see {@link PriceFormatOption}. * */ parse(str: string, decimals: number | null | undefined, formatFlags?: PriceFormatOption | PriceFormatOption[] | FormatFlags | null): number; /** * Returns characters valid for entering prices. * @param includeScenarios - The scenarios to get prices for. * */ getValidPriceCharacters(includeScenarios: Partial): string; /** * Returns regex for validating characters for entering prices. * @param includeScenarios - The scenarios to get prices for. * */ getValidPriceRegex(includeScenarios: Partial): RegExp; /** * Returns the character that should be used as the modern fractions seperator * */ getModernFractionsSeparator(): string; } export default PriceFormatting;