@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
32 lines (31 loc) • 1.64 kB
TypeScript
import { AdaptableFormat, NumberFormatterOptions } from './AdaptableFormat';
/**
* Named preset for a numeric Display Format.
*
* When a Format Column's `DisplayFormat` is set to one of these values,
* AdapTable resolves it at render time to the corresponding concrete
* `AdaptableFormat` (a `NumberFormatter` with the appropriate options).
*/
export type AdaptableNumericFormatPreset = 'Percentage' | 'Thousand' | 'Million' | 'Billion' | 'BasisPoints' | 'Dollar' | 'Sterling' | 'Euro' | 'Yen' | 'Bitcoin' | 'Integer' | 'Decimal' | 'Accounting' | 'FXRate' | 'Scientific';
/**
* The full set of values a Format Column's `DisplayFormat` may hold:
* either a concrete `AdaptableFormat` object or the name of a numeric
* preset (e.g. `'Dollar'`).
*/
export type DisplayFormat = AdaptableFormat | AdaptableNumericFormatPreset;
/**
* Concrete options associated with each numeric preset. The wizard and
* runtime resolver both pull from this single source of truth.
*/
export declare const NUMERIC_FORMAT_PRESETS: Record<AdaptableNumericFormatPreset, NumberFormatterOptions>;
/**
* Type guard: `true` if the value is a known numeric preset name.
*/
export declare const isAdaptableNumericFormatPreset: (value: unknown) => value is AdaptableNumericFormatPreset;
/**
* Resolve a `DisplayFormat` (preset name or concrete object) into a
* concrete `AdaptableFormat`. Returns `undefined` if the input is
* `undefined`. A bare preset name is expanded into a `NumberFormatter`
* with the corresponding options.
*/
export declare const resolveDisplayFormat: (displayFormat: DisplayFormat | undefined) => AdaptableFormat | undefined;