@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
80 lines (79 loc) • 2.7 kB
TypeScript
/**
* Behaviour for aligning Cell contents
*/
export type Alignment = 'Left' | 'Right' | 'Center' | 'Default';
/**
* The "text" half of an `AdaptableStyle`: everything that affects the
* rendering of text (and, by convention, the alignment of the cell's primary
* content block — for plain text that is `text-align`, for Badge it is the
* alignment of the badge row).
*
* Used as a `Font?` slot on Styled Columns whose renderer paints a non-text
* primary content (Gradient tint, Percent Bar, Bullet Chart) so the column
* can still control the cell's text styling without inheriting any other
* properties from a Format Column.
*/
export interface CellFontStyle {
/**
* Font colour in cell: hex, rgb(a) or name
*/
ForeColor?: string;
/**
* Weight of font: `Normal` or `Bold`
*/
FontWeight?: 'Normal' | 'Bold';
/**
* Style of font: `Normal` or `Italic`
*/
FontStyle?: 'Normal' | 'Italic';
/**
* Decoration of font: `None`, `Underline`, `Overline` or `LineThrough`
*/
TextDecoration?: 'None' | 'Underline' | 'Overline' | 'LineThrough';
/**
* Size of font: `XSmall`, `Small`, `Medium`, `Large` or `XLarge`
*/
FontSize?: 'XSmall' | 'Small' | 'Medium' | 'Large' | 'XLarge';
/**
* Align to `Left`, `Right` or `Center`
*/
Alignment?: Alignment;
}
/**
* The "box" half of an `AdaptableStyle`: everything that paints the cell box
* (background colour and the border that wraps the cell).
*
* Used as a `Cell?` slot on Styled Columns whose renderer paints into the
* cell content but leaves the cell chrome alone (Rating, Sparkline) so the
* column can opt-in to a tinted/bordered cell without inheriting other
* properties from a Format Column.
*/
export interface CellBoxStyle {
/**
* Colour background of cell: hex, rgb(a) or name
*/
BackColor?: string;
/**
* Colour of cell border: hex, rgb(a) or name
*/
BorderColor?: string;
/**
* Rounds corners of an element's outer border edge; equivalent of CSS border-radius
*/
BorderRadius?: number;
}
/**
* Style object used in numerous AdapTable Modules.
*
* Composed of two reusable slices — `CellFontStyle` (text) and `CellBoxStyle`
* (cell chrome) — plus a `ClassName` escape hatch. The shape is unchanged
* from previous releases; the slices exist so that Styled Columns can opt-in
* to a single slice (`Font` or `Cell`) without having to embed a full
* `AdaptableStyle`.
*/
export interface AdaptableStyle extends CellFontStyle, CellBoxStyle {
/**
* Existing CSS Class; use instead of setting other object properties
*/
ClassName?: string;
}