UNPKG

@grafana/ui

Version:
35 lines (34 loc) 2.43 kB
import { type HeaderGroup, type Row } from 'react-table'; import { type DataFrame, type Field, type FieldConfigSource, type GrafanaTheme2, type SelectableValue } from '@grafana/data'; import { type FooterItem, type GrafanaTableColumn, type TableFooterCalc } from './types'; export declare const EXPANDER_WIDTH = 50; export declare function getColumns(data: DataFrame, availableWidth: number, columnMinWidth: number, expander: boolean, footerValues?: FooterItem[], isCountRowsSet?: boolean): GrafanaTableColumn[]; export declare function filterByValue(field?: Field): (rows: Row[], id: string, filterValues?: SelectableValue[]) => Row<{}>[]; export declare function calculateUniqueFieldValues(rows: any[], field?: Field): Record<string, string>; export declare function rowToFieldValue(row: any, field?: Field): string; export declare function valuesToOptions(unique: Record<string, unknown>): SelectableValue[]; export declare function sortOptions(a: SelectableValue, b: SelectableValue): number; export declare function getFilteredOptions(options: SelectableValue[], filterValues?: SelectableValue[]): SelectableValue[]; export declare function sortCaseInsensitive(a: Row, b: Row, id: string): number; export declare function sortNumber(rowA: Row, rowB: Row, id: string): 1 | -1 | 0; export declare function getFooterItems(filterFields: Array<{ id: string; field?: Field; } | undefined>, values: any[number], options: TableFooterCalc, theme2: GrafanaTheme2): FooterItem[]; export declare function createFooterCalculationValues(rows: Row[]): any[number]; export declare function isPointTimeValAroundTableTimeVal(pointTime: number, rowTime: number, threshold: number): boolean; export declare function calculateAroundPointThreshold(timeField: Field): number; /** * Calculate an estimated bounding box for a block * of text using an offscreen canvas. */ export declare function guessTextBoundingBox(text: string, headerGroup: HeaderGroup, osContext: OffscreenCanvasRenderingContext2D | null, lineHeight: number, defaultRowHeight: number, padding?: number): { width: number; height: number; }; /** * A function to guess at which field has the longest text. * To do this we either select a single record if there aren't many records * or we select records at random and sample their size. */ export declare function guessLongestField(fieldConfig: FieldConfigSource, data: DataFrame): Field<any> | undefined;