UNPKG

@grafana/ui

Version:
53 lines (52 loc) 2.58 kB
import { type Property } from 'csstype'; import { type ActionModel, type DisplayValue, type DisplayValueAlignmentFactors, type Field, type GrafanaTheme2, type LinkModel } from '@grafana/data'; import { TableCellDisplayMode } from '@grafana/schema'; import { type CellColors, type TableCellOptions } from './types'; export declare function getTextAlign(field?: Field): Property.JustifyContent; export declare function getCellOptions(field: Field): TableCellOptions; /** * 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; /** * 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; /** * Retrieve colors for a table cell (or table row). * * @param tableStyles * Styles for the table * @param cellOptions * Table cell configuration options * @param displayValue * The value that will be displayed * @returns CellColors */ export declare function getCellColors(theme: GrafanaTheme2, cellOptions: TableCellOptions, displayValue: DisplayValue): CellColors; export interface DataLinksActionsTooltipState { coords: DataLinksActionsTooltipCoords; links?: LinkModel[]; actions?: ActionModel[]; } export interface DataLinksActionsTooltipCoords { clientX: number; clientY: number; } export declare const getDataLinksActionsTooltipUtils: (links: LinkModel[], actions?: ActionModel[]) => { shouldShowLink: boolean; hasMultipleLinksOrActions: boolean; }; /** * Creates an onClick handler for table cells that only triggers tooltip when clicking directly on the cell * @param setTooltipCoords - function to set tooltip coordinates * @returns onClick handler */ export declare const tooltipOnClickHandler: (setTooltipCoords: (coords: DataLinksActionsTooltipCoords) => void) => (event: React.MouseEvent<HTMLElement>) => void;