import type { AgWidgetFieldReference } from '../agFieldDefinition'; import type { AgTextAlign } from './shared/agTitle'; import type { AgTypography } from './shared/agTypography'; import type { AgWidgetData, AgWidgetDataFormat } from './shared/agWidget'; export interface AgValueWidgetTextScaling { /** * Whether to enable automatic text scaling to fit the widget size. */ enabled?: boolean; } /** * Style configuration for the value widget display. */ export interface AgValueWidgetStyle { /** * Typography settings for the displayed value. */ typography?: AgTypography; /** * Text color for the value as a CSS color value. * @example '#000000', 'rgb(0, 0, 0)', 'black' */ color?: string; /** * Vertical alignment of the value within the widget. * Defaults to 'center' if not specified. */ verticalAlign?: 'top' | 'center' | 'bottom'; /** * Horizontal text alignment for the value. * Defaults to 'left' if not specified. */ textAlign?: AgTextAlign; /** * Optional text scaling configuration to automatically adjust font size to fit the widget. */ textScaling?: AgValueWidgetTextScaling; } /** * Format configuration for the value widget. * Controls the visual presentation of the widget. */ export type AgValueWidgetFormat = AgWidgetDataFormat; /** * Data mapping configuration for the value widget. * Specifies which field provides the widget's value. */ export interface AgValueWidgetDataMapping { /** * The field to display as the value. * Should contain exactly one field reference with optional aggregation. */ value: AgWidgetFieldReference[]; } /** * Complete configuration for a Value widget. * Displays a single aggregated value prominently, typically used for KPIs. * * @example * const valueWidget: AgValueWidget = { * format: { * title: { text: 'Total Revenue', enabled: true }, * style: { typography: { fontSize: 32, fontWeight: 'bold' } } * }, * dataMapping: { * value: [{ id: 'revenue', aggregation: 'sum' }] * } * }; */ export interface AgValueWidget extends AgWidgetData { /** * Widget type identifier. */ type: 'value'; }