UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

136 lines (135 loc) 3.49 kB
/** * Object containing formatting information for Numeric and Date Columns */ export type AdaptableFormat = { Formatter: 'NumberFormatter'; Options: NumberFormatterOptions; } | { Formatter: 'DateFormatter'; Options: DateFormatterOptions; } | { Formatter: 'StringFormatter'; Options: StringFormatterOptions; }; export interface BaseFormatterOptions { CustomDisplayFormats?: string[]; } /** * Formatter Options for Numeric Columns */ export interface NumberFormatterOptions extends BaseFormatterOptions { /** * Number of digits to show in Fractions (up to 20) */ FractionDigits?: number; /** * Separator to use in fractions */ FractionSeparator?: string; /** * Number of digits to show for Integers (up to 20) */ IntegerDigits?: number; /** * Separator to use in Integers */ IntegerSeparator?: string; /** * Prefix to use before cell value */ Prefix?: string; /** * Suffix to use after cell value */ Suffix?: string; /** * Replaces cell value with supplied value (that can contain Template Literals) */ Content?: string | number; /** * Multiplier to use on cell value */ Multiplier?: number; /** * When the numeric value is zero (after multiplier and rounding): * - omitted / undefined, or `'0'` — use normal formatting (e.g. `0`, `0.00`) * - `''` — show a blank cell (user cleared the default `0` in the wizard) * - any other string — show that text (e.g. `-`, `—`) */ ZeroDisplay?: string; /** * Shows negative numbers in parentheses */ Parentheses?: boolean; /** * Truncates cell value */ Truncate?: boolean; /** * Returns absolute value of cell value */ Abs?: boolean; /** * Returns smallest integer greater than cell value */ Ceiling?: boolean; /** * Returns largest integer cell value */ Floor?: boolean; /** * Rounds cell value */ Round?: boolean; /** * Show nothing in cell (but underlying value remains) */ Empty?: boolean; /** * Numeric notation to use when rendering the value. * * - `'standard'` (default) — renders the number normally. * - `'scientific'` — renders the number in scientific notation * (e.g. `1.23e+5`). When set, `IntegerSeparator` is ignored * and `FractionDigits` controls the number of mantissa digits. */ Notation?: 'standard' | 'scientific'; } /** * Formatter Options for Date Columns - contains a single `Pattern` property */ export interface DateFormatterOptions extends BaseFormatterOptions { /** * Pattern to use for Date Format */ Pattern?: string; } /** * Formatter Options for String Columns */ export interface StringFormatterOptions extends BaseFormatterOptions { /** * Sets text to Upper, Lower or Sentence case */ Case?: 'Upper' | 'Lower' | 'Sentence'; /** * Trims text (both start and end) */ Trim?: boolean; /** * Prefix to use before the cell text */ Prefix?: string; /** * Suffix to use after the cell text */ Suffix?: string; /** * Replaces cell value; useful when using Condition (e.g. replace null with 'N/A') */ Content?: string; /** * Show nothing in cell (but underlying value remains) */ Empty?: boolean; }