import type { GridOptions } from 'ag-grid-enterprise'; import type { AgWidgetFieldReference } from '../agFieldDefinition'; import type { AgWidgetData, AgWidgetDataFormat } from './shared/agWidget'; /** * Border style configuration for grid lines. */ export interface AgGridBorderStyle { /** * Border color as a CSS color value. * @example '#e0e0e0', 'rgb(224, 224, 224)', 'lightgray' */ color?: string; /** * Border width in pixels. */ width?: number; } /** * Grid theme configuration for visual styling. */ export interface AgGridTheme { /** * Height of each row in pixels. */ rowHeight?: number; /** * Column border styling configuration. */ columnBorder?: AgGridBorderStyle; /** * Row border styling configuration. */ rowBorder?: AgGridBorderStyle; } /** * Style configuration for the grid widget. */ export interface AgGridWidgetStyle { /** * Default column width in pixels. * Applied to all columns unless overridden. */ columnWidth?: number; /** * Whether columns should auto-size to fit their content. */ columnAutoSize?: boolean; /** * Grid theme configuration. */ theme?: AgGridTheme; /** * Header row styling configuration. */ headerRow?: AgGridWidgetHeaderRow; /** * Whether to show a grand total row at the bottom. */ grandTotalRow?: AgGridWidgetGrandTotalRow; } export interface AgGridWidgetHeaderRow { /** * Border width for the header row. */ borderWidth?: number; /** * Border color for the header row. */ borderColor?: string; } export interface AgGridWidgetGrandTotalRow { /** * Whether to show a grand total row at the bottom. */ enabled?: boolean; /** * Border width for the grand total row. */ borderWidth?: number; /** * Border color for the grand total row. */ borderColor?: string; } /** * Format configuration for the grid widget. * Controls the visual presentation of the grid. */ export type AgGridWidgetFormat = AgWidgetDataFormat; /** * Data mapping configuration for the grid widget. * Specifies which fields to display as columns. */ export interface AgGridWidgetDataMapping { /** * Fields to display as columns in the grid. * Each field becomes a column with optional aggregation. */ cols: AgWidgetFieldReference[]; } /** * Complete configuration for a Grid widget. * Displays tabular data with configurable columns and styling. * * @example * const gridWidget: AgGridWidget = { * format: { * title: { text: 'Sales Data', enabled: true }, * style: { columnAutoSize: true } * }, * dataMapping: { * cols: [ * { id: 'product' }, * { id: 'revenue', aggregation: 'sum' }, * { id: 'quantity', aggregation: 'count' } * ] * } * }; */ export interface AgGridWidget extends AgWidgetData { /** * Widget type identifier. */ type: 'grid'; } export type AgGridWidgetOptions = Pick;