import { DataMap } from './DataMap'; import { DataMapEditor } from './DataMapEditor'; export type DataType = 'String' | 'Number' | 'Boolean' | 'Date'; export type CellAlign = 'left' | 'center' | 'right'; export type AggregateType = 'sum' | 'avg' | 'min' | 'max' | 'count'; /** An entry in a column's dataMap (combo box choices). */ export type DataMapEntry = string | { value: unknown; text: string; }; export interface CellTemplateContext> { value: unknown; item: T; row: number; column: Column; } /** Inline styles as a plain object, e.g. `{ color: 'red', backgroundColor: '#fee' }`. */ export type CellStyle = Partial & Record; /** Resolves a cell's CSS classes from its value/row. Return one or more class names. */ export type CellClassFn> = (ctx: CellTemplateContext) => string | string[] | null | undefined; /** Resolves a cell's inline styles from its value/row. */ export type CellStyleFn> = (ctx: CellTemplateContext) => CellStyle | null | undefined; /** Map of class name to a predicate; each class is applied when its predicate is true. */ export type CellClassRules> = Record) => boolean>; export interface ColumnDef> { /** Field to bind to. Optional for calculated columns that use `valueGetter`. */ binding?: string; header?: string; width?: number; editable?: boolean; dataType?: DataType; align?: CellAlign; /** Compute the value from the row. Makes the column calculated (read-only). */ valueGetter?: (item: T) => unknown; valueFormatter?: (value: unknown, item: T) => string; /** Choices for a combo-box cell. Accepts a simple list, value/text pairs, or a DataMap. */ dataMap?: DataMapEntry[] | DataMap; /** Which editor a data-mapped cell uses. Default DropDownList. */ dataMapEditor?: DataMapEditor; /** Aggregate shown for this column on group-header rows. */ aggregate?: AggregateType; /** Allow a filter dialog on this column. Overrides the grid's `allowFiltering`. */ filter?: boolean; /** Let this column merge adjacent equal-valued cells. Overrides the grid's `allowMerging`. */ allowMerging?: boolean; /** CSS class(es) for the cell. A function receives the cell context for conditional styling. */ cellClass?: string | string[] | CellClassFn; /** Inline styles for the cell. A function receives the cell context for conditional styling. */ cellStyle?: CellStyle | CellStyleFn; /** Class-name → predicate map; each class is applied when its predicate returns true. */ cellClassRules?: CellClassRules; /** Return custom cell HTML. Overrides the default text/checkbox rendering. */ cellTemplate?: (ctx: CellTemplateContext) => string; } export declare class Column> { readonly binding: string; readonly header: string; width: number; editable: boolean; readonly dataType: DataType; readonly align: CellAlign; readonly dataMapEditor: DataMapEditor; readonly aggregate?: AggregateType; /** Whether the header shows a filter button. Resolved from the grid + column options. */ filterable: boolean; /** Whether this column participates in cell merging. Resolved from the grid + column options. */ allowMerging: boolean; /** Excluded from layout/rendering/selection when true. Driven by collapsed column groups. */ hidden: boolean; readonly cellTemplate?: (ctx: CellTemplateContext) => string; private readonly valueGetter?; private readonly valueFormatter?; private readonly map?; private readonly cellClassDef?; private readonly cellStyleDef?; private readonly cellClassRules?; constructor(def: ColumnDef); /** A column driven by `valueGetter` has no writable field, so it can't be edited. */ get isCalculated(): boolean; get dataMap(): DataMap | undefined; getValue(item: T): unknown; setValue(item: T, value: unknown): void; /** Turn editor text into a typed value matching the column's dataType or dataMap. */ parse(text: string): unknown; format(item: T): string; /** Format a raw value the way this column formats cells. Also used for aggregates. */ formatValue(value: unknown, item?: T): string; /** The CSS classes for a cell, from `cellClass` plus any matching `cellClassRules`. */ cellClasses(item: T, row: number): string[]; /** The inline styles for a cell, or null when `cellStyle` is unset or returns nothing. */ cellInlineStyle(item: T, row: number): CellStyle | null; private cellContext; }