UNPKG

@adaptabletools/adaptable

Version:

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

116 lines (115 loc) 2.65 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; /** * 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; } /** * 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 or Lower 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; }