import { units } from '@dynatrace-sdk/units'; /** * @public */ export declare const formatterOptions: readonly ["bit", "byte", "duration", "percent", "number", "rate", "date", "customUnit"]; /** * @public */ export type FormatterType = (typeof formatterOptions)[number]; /** * @public */ export interface FormatByTypeNumericOptions { type: 'number'; precision?: number; abbreviate?: boolean; } /** * @public */ export interface FormatByTypeBitOptions { type: 'bit'; bitOutputUnit?: keyof typeof units.data; precision?: number; } /** * @public */ export interface FormatByTypeByteOptions { type: 'byte'; byteOutputUnit?: keyof typeof units.data; precision?: number; } /** * @public */ export interface FormatByTypeDurationOptions { type: 'duration'; precision?: number; /** Mode of type DurationMode (number) */ formatMode?: number; /** Unit of type the duration is in */ inputUnit?: keyof typeof units.time; /** Unit of type the output shall transform to. */ outputUnit?: keyof typeof units.time; } /** * @public */ export interface FormatByTypePercentOptions { type: 'percent'; precision?: number; } /** * @public */ export interface FormatByTypeRateOptions { type: 'rate'; /** Denominator unit. */ denominatorUnit?: string; /** Numerator unit. */ numeratorUnit?: string; /** Precision used to adjust the fraction digits of the passed number. */ precision?: number; } /** * @public */ export interface FormatByTypeRateAlternativeOptions { type: 'rate'; /** Denominator unit. */ denominatorUnit?: string; /** Precision used to adjust the fraction digits of the passed number. */ precision?: number; } /** * @public */ export interface FormatByTypeDateOptions { type: 'date'; /** * If true then the format will be optimized for better readability in table * columns or lists (textual month names and alignment): *
* Aug 04, 2020, 07:30 AM
* Jul 24, 2020, 03:30 PM
*
* In this case also the year is omitted if the given date is in the current one.
*
* Example (current year is 2021):
* Aug 04, 07:30 AM (2021-08-04T07:30:55.000Z)
* Jul 19, 02:34 PM (2021-07-19T14:34:06.000Z)
* Nov 10, 2020, 11:55 AM (2020-11-10T11:55:18.000Z)
*
*/
listFormat?: boolean;
}
/**
* @public
*/
export interface FormatByCustomUnitOptions {
type: 'customUnit';
/** Custom unit name. */
unit?: string;
/** Precision used to adjust the fraction digits of the passed number. */
precision?: number;
}
/**
* @public
*/
export type FormatByTypeRateFullOptions = FormatByTypeRateOptions & FormatByTypeRateAlternativeOptions;
/**
* @public
*/
export type FormatterOptions = FormatByTypeNumericOptions | FormatByTypeBitOptions | FormatByTypeByteOptions | FormatByTypeDurationOptions | FormatByTypePercentOptions | FormatByTypeRateFullOptions | FormatByTypeDateOptions | FormatByCustomUnitOptions;
/**
* Format the value based on the type the data should be shown in
* @deprecated please use the new formatters SDK instead
* TODO?: Can't be removed yet because its still used by some chart components without any substitution in the units SDK.
* @public
*/
export declare function formatByType(value: number, options?: FormatterOptions): string;