import type { S2CellType } from './interaction'; import type { RawData } from './s2DataConfig'; import type { TextTheme } from './theme'; export interface ValueRange { minValue?: number; maxValue?: number; } export type ValueRanges = Record; export type TextConditionMappingResult = TextTheme; export type BackgroundConditionMappingResult = { fill: string; /** * @description only used in background condition, when the background color is too light, the font color will be white * @version 1.34.0 */ intelligentReverseTextColor?: boolean; }; export type IconConditionMappingResult = { fill: string; icon: string; }; export type IntervalConditionMappingResult = { fill?: string; isCompare?: boolean; /** * @description custom the interval condition's width * @version 1.38.0 */ fieldValue?: number | string; } & ValueRange; export type ConditionMappingResult = T | undefined | null; export type ConditionMapping = (fieldValue: number | string, data: RawData, cell: S2CellType) => ConditionMappingResult; /** * One field can hold a condition */ export interface Condition { field?: string | RegExp; mapping: ConditionMapping; } export type TextCondition = Condition; export type BackgroundCondition = Condition; export type IntervalCondition = Condition; export type IconPosition = 'left' | 'right'; export interface IconCondition extends Condition { position?: IconPosition; } export interface Conditions { text?: TextCondition[]; background?: BackgroundCondition[]; interval?: IntervalCondition[]; icon?: IconCondition[]; }