import { Property } from 'csstype';
import { CSSProperties } from 'react';
import { SortColumn } from 'react-data-grid';
import { Count } from 'uwrap';
import { FieldType, Field, GrafanaTheme2, DisplayValue, LinkModel, DisplayValueAlignmentFactors, DataFrame, DisplayProcessor, FieldSparkline } from '@grafana/data';
import { TableCellDisplayMode, TableCellHeight } from '@grafana/schema';
import { TableCellInspectorMode } from '../TableCellInspector';
import { TableCellOptions } from '../types';
import { TableRow, ColumnTypes, Comparator, TypographyCtx, MeasureCellHeight, MeasureCellHeightEntry } from './types';
export type CellNumLinesCalculator = (text: string, cellWidth: number) => number;
/**
 * @internal
 * Returns the default row height based on the theme and cell height setting.
 */
export declare function getDefaultRowHeight(theme: GrafanaTheme2, fields?: Field[], cellHeight?: TableCellHeight): NonNullable<CSSProperties['height']>;
/**
 * @internal
 * Returns true if cell inspection (hover to see full content) is enabled for the field.
 */
export declare function isCellInspectEnabled(field: Field): boolean;
/**
 * @internal
 * Returns true if text wrapping should be applied to the cell.
 */
export declare function shouldTextWrap(field: Field): boolean;
/**
 * @internal creates a typography context based on a font size and family. used to measure text
 * and estimate size of text in cells.
 */
export declare function createTypographyContext(fontSize: number, fontFamily: string, letterSpacing?: number): TypographyCtx;
/**
 * @internal wraps the uwrap count function to ensure that it is given a string.
 */
export declare function getTextHeightMeasurerFromUwrapCount(count: Count): MeasureCellHeight;
/**
 * @internal returns a measurer which guesstimates a number of lines in a text cell based on the typography context's avgCharWidth.
 */
export declare function getTextHeightEstimator(avgCharWidth: number): MeasureCellHeight;
/**
 * @internal
 */
export declare function getDataLinksHeightMeasurer(): MeasureCellHeight;
export declare function getPillCellHeightMeasurer(measureWidth: (value: string) => number): MeasureCellHeight;
/**
 * @internal return a text measurer for every field which has wrapHeaderText enabled.
 */
export declare function buildHeaderHeightMeasurers(fields: Field[], typographyCtx: TypographyCtx): MeasureCellHeightEntry[] | undefined;
/**
 * @internal return a text height measurer for every field which has wrapHeaderText enabled. we do this once as we're rendering
 * the table, and then getRowHeight uses the output of this to caluclate the height of each row.
 */
export declare function buildCellHeightMeasurers(fields: Field[], typographyCtx: TypographyCtx, maxHeight?: number): MeasureCellHeightEntry[] | undefined;
export declare const SINGLE_LINE_ESTIMATE_THRESHOLD = 18.5;
/**
 * @internal
 * loop through the fields and their values, determine which cell is going to determine the height of the row based
 * on its content and width, and return the height in pixels of that row, with vertial padding applied.
 */
export declare function getRowHeight(fields: Field[], rowIdx: number, columnWidths: number[], defaultHeight: number, measurers?: MeasureCellHeightEntry[], lineHeight?: number, verticalPadding?: number): number;
/**
 * @internal
 * Returns true if text overflow handling should be applied to the cell.
 */
export declare function shouldTextOverflow(field: Field): boolean;
export type TextAlign = 'left' | 'right' | 'center';
/**
 * @internal
 * Returns the text-align value for inline-displayed cells for a field based on its type and configuration.
 */
export declare function getAlignment(field: Field): TextAlign;
/**
 * @internal
 * Returns the justify-content value for flex-displayed cells for a field based on its type and configuration.
 */
export declare function getJustifyContent(textAlign: TextAlign): Property.JustifyContent;
/**
 * @internal
 * Returns the cell options for a field, migrating from legacy displayMode if necessary.
 * TODO: remove live migration in favor of doing it in dashboard or panel migrator
 */
export declare function getCellOptions(field: Field): TableCellOptions;
/**
 * @internal
 * Getting gauge or sparkline values to align is very tricky without looking at all values and passing them through display processor.
 * For very large tables that could pretty expensive. So this is kind of a compromise. We look at the first 1000 rows and cache the longest value.
 * If we have a cached value we just check if the current value is longer and update the alignmentFactor. This can obviously still lead to
 * unaligned gauges but it should a lot less common.
 **/
export declare function getAlignmentFactor(field: Field, displayValue: DisplayValue, rowIndex: number): DisplayValueAlignmentFactors;
/**
 * @internal
 * Returns the text and background colors for a table cell based on its options and display value.
 */
export declare function getCellColorInlineStylesFactory(theme: GrafanaTheme2): (cellOptions: TableCellOptions, displayValue: DisplayValue, hasApplyToRow: boolean) => CSSProperties;
/**
 * @internal
 * Extracts numeric pixel value from theme spacing
 */
export declare const extractPixelValue: (spacing: string | number) => number;
/**
 * @internal
 */
export declare const getCellLinks: (field: Field, rowIdx: number) => LinkModel<unknown>[] | undefined;
/**
 * @internal
 */
export declare function applySort(rows: TableRow[], fields: Field[], sortColumns: SortColumn[], columnTypes?: ColumnTypes, hasNestedFrames?: boolean): TableRow[];
/**
 * @internal
 */
export declare const frameToRecords: (frame: DataFrame) => TableRow[];
/**
 * @internal
 */
export declare function getComparator(sortColumnType: FieldType): Comparator;
/**
 * Migrates table cell display mode to new object format.
 *
 * @param displayMode The display mode of the cell
 * @returns TableCellOptions object in the correct format
 * relative to the old display mode.
 */
export declare function migrateTableDisplayModeToCellOptions(displayMode: TableCellDisplayMode): TableCellOptions;
/**
 * @internal
 * Returns true if the DataFrame contains nested frames
 */
export declare const getIsNestedTable: (fields: Field[]) => boolean;
/**
 * @internal
 * Processes nested table rows
 */
export declare const processNestedTableRows: (rows: TableRow[], processParents: (parents: TableRow[]) => TableRow[]) => TableRow[];
/**
 * @internal
 * Calculate the footer height based on the maximum reducer count
 */
export declare const calculateFooterHeight: (fields: Field[]) => number;
/**
 * @internal
 * returns the display name of a field
 * returns the display name of a field.
 * We intentionally do not want to use @grafana/data's getFieldDisplayName here,
 * instead we have a call to cacheFieldDisplayNames up in TablePanel to handle this
 * before we begin.
 */
export declare const getDisplayName: (field: Field) => string;
/**
 * @internal given a field name or display name, returns a predicate function that checks if a field matches that name.
 */
export declare const predicateByName: (name: string) => (f: Field) => boolean;
/**
 * @internal
 * returns only fields that are not nested tables and not explicitly hidden
 */
export declare function getVisibleFields(fields: Field[]): Field[];
/**
 * @internal
 * returns a map of column types by display name
 */
export declare function getColumnTypes(fields: Field[]): ColumnTypes;
/**
 * @internal
 * calculates the width of each field, with the following logic:
 * 1. manual sizing minWidth is hard-coded to 50px, we set this in RDG since it enforces the hard limit correctly
 * 2. if minWidth is configured in fieldConfig (or defaults to 150), it serves as the bottom of the auto-size clamp
 */
export declare function computeColWidths(fields: Field[], availWidth: number): number[];
/**
 * @internal
 * if applyToRow is true in any field, return a function that gets the row background color
 */
export declare function getApplyToRowBgFn(fields: Field[], getCellColorInlineStyles: ReturnType<typeof getCellColorInlineStylesFactory>): ((rowIndex: number) => CSSProperties) | void;
/** @internal */
export declare function canFieldBeColorized(cellType: TableCellDisplayMode, applyToRowBgFn?: (rowIndex: number) => CSSProperties): boolean;
export declare const displayJsonValue: (field: Field) => DisplayProcessor;
export declare function prepareSparklineValue(value: unknown, field: Field): FieldSparkline | undefined;
export declare function buildInspectValue(value: unknown, field: Field): [string, TableCellInspectorMode];
export declare function getSummaryCellTextAlign(textAlign: TextAlign, cellType: TableCellDisplayMode): TextAlign;
export declare function parseStyleJson(rawValue: unknown): CSSProperties | void;
export declare const IS_SAFARI_26: boolean | null;
