import type { dh as DhType } from '@deephaven/jsapi-types'; import { type ColumnName } from '../../CommonTypes'; export type ModelColumn = { name: string; type: string; }; export type Condition = NumberCondition | StringCondition | DateCondition | BooleanCondition | CharCondition; export interface BaseFormatConfig { /** * The columns whose formatting is applied. When set, formatting is applied to * each column while the condition is evaluated against `leftHandValue`. When * absent, `leftHandValue` is used as both the condition column and the format * target. */ formattedColumns: ModelColumn[]; /** * The column whose value is evaluated as the left-hand side of the condition. */ leftHandValue: ModelColumn; condition: Condition; /** * The right-hand side of the condition. May be a literal string value or a * column reference (`ModelColumn`). */ rightHandValue?: string | ModelColumn; start?: string; end?: string; style: FormatStyleConfig; } export interface ConditionConfig { condition: Condition; rightHandValue?: string | ModelColumn; start?: string; end?: string; } export type ChangeCallback = (ruleConfig: BaseFormatConfig, isValid: boolean) => void; export declare enum FormatterType { CONDITIONAL = "conditional", ROWS = "rows" } export interface FormattingRule { type: FormatterType; config: BaseFormatConfig; } export declare enum NumberCondition { IS_EQUAL = "is-equal", IS_NOT_EQUAL = "is-not-equal", IS_BETWEEN = "is-between", GREATER_THAN = "greater-than", GREATER_THAN_OR_EQUAL = "greater-than-or-equal", LESS_THAN = "less-than", LESS_THAN_OR_EQUAL = "less-than-or-equal", IS_NULL = "is-null", IS_NOT_NULL = "is-not-null" } export declare enum StringCondition { IS_EXACTLY = "is-exactly", IS_NOT_EXACTLY = "is-not-exactly", CONTAINS = "contains", DOES_NOT_CONTAIN = "does-not-contain", STARTS_WITH = "starts-with", ENDS_WITH = "ends-with", IS_NULL = "is-null", IS_NOT_NULL = "is-not-null" } export declare enum DateCondition { IS_EXACTLY = "is-exactly", IS_NOT_EXACTLY = "is-not-exactly", IS_BEFORE = "is-before", IS_BEFORE_OR_EQUAL = "is-before-or-equal", IS_AFTER = "is-after", IS_AFTER_OR_EQUAL = "is-after-or-equal", IS_NULL = "is-null", IS_NOT_NULL = "is-not-null" } export declare enum BooleanCondition { IS_TRUE = "is-true", IS_FALSE = "is-false", IS_EQUAL = "is-equal", IS_NOT_EQUAL = "is-not-equal", IS_NULL = "is-null", IS_NOT_NULL = "is-not-null" } export declare enum CharCondition { IS_EQUAL = "is-equal", IS_NOT_EQUAL = "is-not-equal", IS_NULL = "is-null", IS_NOT_NULL = "is-not-null" } export declare enum FormatStyleType { NO_FORMATTING = "no-formatting", POSITIVE = "positive", NEGATIVE = "negative", WARN = "warn", NEUTRAL = "neutral", ACCENT_1 = "accent-1", ACCENT_2 = "accent-2", CUSTOM = "custom" } export interface FormatStyleConfig { type: FormatStyleType; customConfig?: { color: string; background: string; }; } export declare function getLabelForStyleType(option: FormatStyleType): string; export declare function getBackgroundForStyleConfig(config: FormatStyleConfig): string | undefined; export declare function getColorForStyleConfig(config: FormatStyleConfig): string | undefined; export declare function getStyleDBString(config: BaseFormatConfig): string | undefined; /** * Formats a rightHandValue for use in a condition expression. * - If a ModelColumn: returns the column name as a bare identifier (no quoting) * - If a string: wraps it in the given quote character * - If undefined: returns undefined */ export declare function formatRHV(value: string | ModelColumn | undefined, quote: string): string | undefined; export declare function getConditionDBString(dh: typeof DhType, config: BaseFormatConfig): string; export declare function getLabelForNumberCondition(condition: NumberCondition): string; export declare function getLabelForStringCondition(condition: StringCondition): string; export declare function getLabelForDateCondition(condition: DateCondition): string; export declare function getLabelForBooleanCondition(condition: BooleanCondition): string; export declare function getLabelForCharCondition(condition: CharCondition): string; export declare function getDefaultConditionForType(columnType: string): Condition; export declare function getDefaultValueForType(columnType: string): string | undefined; export declare function getConditionConfig(config: BaseFormatConfig): ConditionConfig; export declare function getDefaultConditionConfigForType(type: string): ConditionConfig; export declare function getDefaultStyleConfig(): FormatStyleConfig; export declare function getShortLabelForNumberCondition(condition: NumberCondition): string; export declare function getTextForNumberCondition(columnName: ColumnName, condition: NumberCondition, value: unknown, start: unknown, end: unknown): string; export declare function getTextForBooleanCondition(columnName: ColumnName, condition: BooleanCondition, rightHandValue?: string | ModelColumn): string; export declare function getShortLabelForConditionType(columnType: string, condition: Condition): string; /** * Get format columns array for the given columns and formatting rules * @param columns Available columns * @param rules Formatting rules to build the format columns from * @returns Array of format columns */ export declare function getFormatColumns(dh: typeof DhType, columns: readonly DhType.Column[], rules: readonly FormattingRule[]): DhType.CustomColumn[]; /** * Validate that a given date condition + value pair is valid. * @param condition * @param value */ export declare function isDateConditionValid(dh: typeof DhType, condition: DateCondition, value?: string): boolean; export declare function isSupportedColumn({ type }: ModelColumn): boolean; //# sourceMappingURL=ConditionalFormattingUtils.d.ts.map