import type { ConvertibleUnit, FormatDateOptions, FormatOptions, Unit } from '@dynatrace-sdk/units'; import type { ColorPalette, CustomColorPalette } from '../../../../charts/core/types/color-palette.js'; import type { Formatter } from '../../../../charts/core/types/formatter.js'; import type { GanttChartConfig } from '../../../../charts/gantt-chart/types/gantt-chart.js'; import type { Components } from '../../../../core/types/markdown/react-markdown.js'; import type { DataTableDatetimeDisplayMode, FormatterCurrencyOptions } from '../CellFormatter/cell-formatter-types.js'; /** * Available column types for the DataTable. * @public */ export type DataTableColumnType = 'text' | 'date' | 'datetime' | 'bit' | 'number' | 'long' | 'currency' | 'sparkline' | 'meterbar' | 'gantt' | 'markdown' | 'log-content'; /** * The x-axis boundaries props used in the sparkline column. * @public */ export interface DataTableSparklineXAxisProps { /** * The min value configuration to display in the x-axis * @defaultValue 'auto' */ min?: 'auto' | 'data-min' | number | Date; /** * The max value configuration to display in the x-axis * @defaultValue 'auto' */ max?: 'auto' | 'data-max' | number | Date; } /** * The y-axis boundaries and scale props used in the sparkline column. * @public */ export interface DataTableSparklineYAxisProps { /** * The min value configuration to display in the y-axis * @defaultValue 'data-min' */ min?: number | 'data-min'; /** * The max value configuration to display in the y-axis * @defaultValue 'data-max' */ max?: number | 'data-max'; /** * The scale of the y-axis values. Is only applied to the bar variant. * @defaultValue 'linear' */ scale?: 'linear' | 'log'; } /** * Defined config options used in sparkline column. * @public */ export type DataTableSparklineColumnConfig = { /** * Sparkline color. * @defaultValue Colors.Charts.Categorical.Color01.Default */ color?: string; /** * Sparkline variant (line, area, bar). * @defaultValue 'line' */ variant?: 'line' | 'area' | 'bar'; /** * Defines how gaps in the data are visualized. * @defaultValue 'connect' */ gapPolicy?: 'connect' | 'gap'; /** * Curve shape of the series. * @defaultValue 'linear' */ curve?: 'linear' | 'smooth'; /** * Whether Sparkline shows min/max labels. * @defaultValue false */ showContextValues?: boolean; /** * Optional x-axis boundary configuration for the sparkline. * * Use this to override the default domain derived from the data. * The `min` and `max` values can be set to `Date`, numeric timestamps, * or automatic data-based boundaries (`'data-min'` / `'data-max'`). * @defaultValue undefined */ xAxis?: DataTableSparklineXAxisProps; /** * Optional y-axis boundary and scale configuration for the sparkline. * * Use this to override the default value domain or scale. * @defaultValue undefined */ yAxis?: DataTableSparklineYAxisProps; }; /** * Defined configuration options used in meterbar column. * @public */ export type DataTableMeterbarColumnConfig = { /** * Color of the meter bar segment. * @defaultValue 'Categorical.Color11' */ color?: string; /** * Min value for the meter bar chart scale. * @defaultValue 0 */ min?: number; /** * Max value for the meter bar chart scale. * @defaultValue 100 */ max?: number | 'data-max'; /** * The color palette to use for multi-segment meter bars. */ colorPalette?: ColorPalette | CustomColorPalette; /** * When set to true, shows a tooltip on hover. * @defaultValue false */ showTooltip?: boolean; /** * Formats the value displayed in the tooltip. */ formatter?: Formatter | FormatOptions; /** * Array of threshold configurations to display on the meter bar. */ thresholds?: { /** * The value of the threshold. */ value: number; /** * The color of the threshold. * @defaultValue 'Categorical.Color11' */ color: string; /** * Name of the threshold. */ name: string; /** * When set to true, the threshold indicator is shown. * @defaultValue false */ showIndicator?: boolean; }[]; }; /** * Defined configuration options used in gantt column. * @public */ export type DataTableGanttColumnConfig = GanttChartConfig; /** * Defined config options used in Markdown column. * @public */ export type DataTableMarkdownColumnConfig = { /** * A mapping of HTML tags (e.g., 'a', 'h1') to functions that provide custom implementations, * allowing for the override of default rendering. * @defaultValue undefined * @example * ```jsx * const customMappings = { * h2: ({ children }) => (

{children}

) * } * ``` */ customComponentMappings?: Components; }; /** * Defined config options used in log content column. * @public */ export type DataTableLogContentColumnConfig = { /** * Defines the character limit for truncating log lines. Defaults to 1000 characters. * Set to `false` to disable truncation and always display the entire log line. * * @defaultValue 1000 * @remarks **Warning:** Increasing or disabling this limit may negatively impact table performance! */ truncationLimit?: number | false; }; /** * Defined config options used in text column. * @public */ export type DataTableTextColumnConfig = { /** Specifies whether URLs in the text should be automatically detected and rendered as external links. */ detectLinks?: boolean; }; /** * Combined ruleset of column types and their matching configurations. * @public */ export type DataTableColumnTypesColumnDef = { columnType: Extract; config?: DataTableMeterbarColumnConfig; } | { columnType: Extract; config?: DataTableSparklineColumnConfig; } | { columnType: Extract; formatter?: FormatDateOptions | DataTableDatetimeDisplayMode; config?: never; } | { columnType: Extract; formatter?: FormatDateOptions; config?: never; } | { columnType: Extract; formatter?: FormatterCurrencyOptions; config?: never; } | { columnType?: Extract; formatter?: FormatOptions; config?: never; } | { columnType: Extract; formatter?: Pick, 'locale' | 'maximumFractionDigits' | 'maximumSignificantDigits' | 'minimumFractionDigits' | 'minimumSignificantDigits' | 'useGrouping'>; config?: never; } | { columnType: Extract; config?: DataTableGanttColumnConfig; } | { columnType?: Extract; formatter?: never; config?: DataTableMarkdownColumnConfig; } | { columnType: Extract; formatter?: never; config?: DataTableLogContentColumnConfig; } | { columnType: Extract; formatter?: FormatOptions; config?: DataTableTextColumnConfig; }; /** * Available chart column types. * @internal */ declare const CHART_COLUMN_TYPES: readonly ["sparkline", "meterbar", "gantt"]; export type ChartColumnTypes = (typeof CHART_COLUMN_TYPES)[number]; /** * Checks whether column type is a chart type. * @internal */ export declare function isChartColumnType(columnType: DataTableColumnType | undefined): columnType is ChartColumnTypes; export {};