import { type ReactElement, type ReactNode, type JSX } from 'react';
import { type ConvertibleUnit, type FormatDateOptions, type FormatOptions, type Unit } from '@dynatrace-sdk/units';
import type { ColorPalette, CustomColorPalette } from '../../../../charts/core/types/color-palette.js';
import type { MaxScaleBoundary, MinScaleBoundary } from '../../../../charts/core/types/min-max-config.js';
import type { GanttSegmentData } from '../../../../charts/gantt-chart-v2/types/gantt-chart.js';
import { type Components } from '../../../../core/types/markdown/react-markdown.js';
import type { ColumnDef, ColumnDefBase, ColumnMeta } from '../../hooks/useTable/types.js';
import type { DataTableV2DisplayColumnDef } from '../../public.api.js';
import type { DataTableV2CellFormatterColumnDef, FormatterCurrencyOptions } from '../CellFormatter.js';
import { type DataTableV2AlignmentColumnDef } from '../ColumnAlignment.js';
/**
* Available column types for the DataTableV2.
* @public
*/
export type DataTableV2ColumnType = 'text' | 'date' | 'bit' | 'number' | 'long' | 'currency' | 'sparkline' | 'meterbar' | 'gantt' | 'markdown' | 'log-content';
/**
* Defined config options used in sparkline column.
* @public
*/
export type DataTableV2SparklineColumnConfig = {
color?: string;
variant?: 'line' | 'area' | 'bar';
showContextValues?: boolean;
};
/**
* Defined configuration options used in meterbar column.
* @public
*/
export type DataTableV2MeterbarColumnConfig = {
color?: string;
min?: number;
max?: number | 'data-max';
colorPalette?: ColorPalette | CustomColorPalette;
showTooltip?: boolean;
thresholds?: {
value: number;
color: string;
name: string;
}[];
};
/**
* Defined configuration options used in gantt column.
* @public
*/
export type DataTableV2GanttColumnConfig = {
min?: MinScaleBoundary;
max?: MaxScaleBoundary;
xAxisType?: 'numerical' | 'time';
nameAccessor: string;
colorAccessor?: string;
colorPalette?: ColorPalette | CustomColorPalette;
showBackground?: boolean;
} & ({
tooltipActions?: never;
tooltip?: (segment: GanttSegmentData, row: GanttSegmentData[], parent?: GanttSegmentData[]) => ReactNode;
} | {
tooltipActions?: (segment: GanttSegmentData, row: GanttSegmentData[], parent?: GanttSegmentData[]) => () => ReactElement;
tooltip?: never;
}) & DataTableV2CellFormatterColumnDef;
/**
* Defined config options used in markdown column.
* @public
*/
export type DataTableV2MarkdownColumnConfig = {
/**
* 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 DataTableV2LogContentColumnConfig = {
/**
* 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 DataTableV2TextColumnConfig = {
/** 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 DataTableV2ColumnTypesColumnDef = {
columnType: Extract;
config?: DataTableV2MeterbarColumnConfig;
} | {
columnType: Extract;
config?: DataTableV2SparklineColumnConfig;
} | {
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?: DataTableV2GanttColumnConfig;
} | {
columnType?: Extract;
formatter?: never;
config?: DataTableV2MarkdownColumnConfig;
} | {
columnType: Extract;
formatter?: never;
config?: DataTableV2LogContentColumnConfig;
} | {
columnType: Extract;
formatter?: FormatOptions;
config?: DataTableV2TextColumnConfig;
};
/**
* Function that sets the column alignment and the custom cell renderer
* based on the column type from the column definition
* @param columnDef - column definition prop
*
* @returns the column alignment and the custom cell renderer based on the column type
* @internal
*/
export declare function applyColumnTypes(columnDef: DataTableV2DisplayColumnDef, composedDef: ColumnDef): {
alignment?: DataTableV2AlignmentColumnDef['alignment'];
cell?: ColumnDefBase['cell'];
enableSorting?: boolean;
header?: string | (() => JSX.Element);
enableUserActions?: boolean;
meta?: ColumnMeta;
};
/**
* Gets text alignment of a column based on its type.
* @internal
*/
export declare function getAlignmentBasedOnType(columnType?: DataTableV2ColumnType): DataTableV2AlignmentColumnDef['alignment'];
/**
* Typeguard function ensures that the defined config in the column definition contains certain properties.
* @internal
*/
export declare function isDatatableV2GanttColumnConfig(config: unknown): config is DataTableV2GanttColumnConfig;
/**
* Typeguard function ensures that the defined config in the column definition contains certain properties.
* @internal
*/
export declare function isDatatableV2LogContentColumnConfig(config: unknown): config is DataTableV2LogContentColumnConfig;
/**
* Returns matching cell renderer for each of the different column types so
* the values are displayed correctly.
* @internal
*/
export declare function getCellTypeRenderer(columnType: DataTableV2ColumnType): import("../../hooks/useTable/types.js").ColumnDefTemplate> | undefined;