UNPKG

@adaptabletools/adaptable

Version:

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

69 lines (68 loc) 3.53 kB
import { AdaptableStyle } from '../../types'; import { CellBoxStyle, CellFontStyle } from '../../AdaptableState/Common/AdaptableStyle'; /** * Keys belonging to the "Font" slice (text rendering + alignment). * See {@link CellFontStyle}. */ export declare const CELL_FONT_STYLE_KEYS: ReadonlyArray<keyof CellFontStyle>; /** * Keys belonging to the "Cell" slice (cell chrome — background and border). * See {@link CellBoxStyle}. */ export declare const CELL_BOX_STYLE_KEYS: ReadonlyArray<keyof CellBoxStyle>; /** * Returns true when the given style has any property in the Font slice set. */ export declare const hasCellFontStyle: (style: Partial<CellFontStyle> | undefined) => boolean; /** * Returns true when the given style has any property in the Cell (box) slice set. */ export declare const hasCellBoxStyle: (style: Partial<CellBoxStyle> | undefined) => boolean; /** * Returns a copy of `style` containing only Font-slice keys. */ export declare const pickCellFontStyle: (style: Partial<AdaptableStyle> | undefined) => CellFontStyle; /** * Returns a copy of `style` containing only Cell-slice (box) keys. */ export declare const pickCellBoxStyle: (style: Partial<AdaptableStyle> | undefined) => CellBoxStyle; /** * Returns a copy of `style` with all Font-slice keys removed. */ export declare const omitCellFontStyle: (style: AdaptableStyle | undefined) => AdaptableStyle; /** * Returns a copy of `style` with all Cell-slice (box) keys removed. */ export declare const omitCellBoxStyle: (style: AdaptableStyle | undefined) => AdaptableStyle; export declare const AgGridCellStyleProperties: readonly ["backgroundColor", "color", "fontWeight", "fontStyle", "fontSize", "borderColor", "--ab-dynamic-background-color", "--ab-dynamic-color", "--ab-dynamic-font-weight", "--ab-dynamic-font-style", "--ab-dynamic-font-size", "--ab-dynamic-text-decoration", "--ab-dynamic-border-radius", "--ab-dynamic-border-color"]; export declare const normalizeStyleForAgGrid: (style: Record<string, any>) => { [x: string]: any; }; export declare const sanitizeStyle: (style: Record<string, any>) => Record<string, any>; export declare const convertAdaptableStyleToCSS: (style: AdaptableStyle) => { [cssProperty: string]: string; }; export declare const convertCSSAbsoluteFontSizeToPt: (fontSize: "x-large" | "large" | "medium" | "small" | "x-small") => number; export declare const toStyle: (style?: AdaptableStyle) => { borderWidth: number; borderStyle: string; }; export declare const getVariableColor: (variable: string) => string; /** * Default surface colour assumed to sit *behind* a semi-transparent cell tint * when computing auto-contrast text. Gradient cells paint a base colour at a * value-driven alpha, so the colour the user actually perceives is that tint * composited over the grid cell background (white in the default light theme). */ export declare const DEFAULT_CELL_SURFACE_COLOR = "#ffffff"; /** * Picks a readable text colour (near-black or white) for a cell whose * background is `baseColor` painted at `alpha` over `surfaceColor`. * * The tint must be composited over the surface *before* measuring luminance: * `tinycolor.getLuminance()` ignores the alpha channel, so measuring the raw * base colour would yield the same result for a faint cell and a fully-opaque * one — making auto-contrast text identical on every row instead of adapting * per cell. */ export declare const getAutoContrastTextColor: (baseColor: string, alpha: number, surfaceColor?: string) => string;