import { type MultiCellRange } from './cell-range'; export type ConditionalFormattingRuleType = 'expression' | 'cellIs' | 'colorScale' | 'dataBar' | 'iconSet' | 'top10' | 'aboveAverage' | 'uniqueValues' | 'duplicateValues' | 'containsText' | 'notContainsText' | 'beginsWith' | 'endsWith' | 'containsBlanks' | 'notContainsBlanks' | 'containsErrors' | 'notContainsErrors' | 'timePeriod'; export type CellIsOperator = 'lessThan' | 'lessThanOrEqual' | 'equal' | 'notEqual' | 'greaterThanOrEqual' | 'greaterThan' | 'between' | 'notBetween'; export type TextOperator = 'containsText' | 'notContains' | 'beginsWith' | 'endsWith'; export type TimePeriod = 'today' | 'yesterday' | 'tomorrow' | 'last7Days' | 'thisMonth' | 'lastMonth' | 'nextMonth' | 'thisWeek' | 'lastWeek' | 'nextWeek'; export interface ConditionalFormattingRule { /** Wire-level rule kind. */ type: ConditionalFormattingRuleType; /** 1-based priority — Excel evaluates lower priority first. */ priority: number; /** Index into Stylesheet.dxfs for the cell-format applied when the rule fires. */ dxfId?: number; /** Stop evaluating subsequent rules on the same cell when this rule matches. */ stopIfTrue?: boolean; /** cellIs operator. */ operator?: CellIsOperator | TextOperator | string; /** Comparison string for the contains-text family. */ text?: string; /** top10: rank percentage flag. */ percent?: boolean; /** top10: bottom-N flag (false = top-N, true = bottom-N). */ bottom?: boolean; /** top10: rank value (defaults to 10). */ rank?: number; /** aboveAverage: aboveAverage="0" → below average. */ aboveAverage?: boolean; /** aboveAverage: equalAverage flag. */ equalAverage?: boolean; /** aboveAverage: stdDev. */ stdDev?: number; /** timePeriod token. */ timePeriod?: TimePeriod; /** 0..3 formula strings — varies by rule type. */ formulas: string[]; /** * Raw inner XML for colorScale / dataBar / iconSet rules. Stage-1 stores the * verbatim child markup so saves round-trip without our needing to model cfvo * / colors / iconSets fully. */ innerXml?: string; } export interface ConditionalFormatting { sqref: MultiCellRange; rules: ConditionalFormattingRule[]; pivot?: boolean; } export declare function makeConditionalFormatting(opts: { sqref: MultiCellRange | string; rules?: ConditionalFormattingRule[]; pivot?: boolean; }): ConditionalFormatting; export declare function makeCfRule(opts: Partial & { type: ConditionalFormattingRuleType; priority: number; }): ConditionalFormattingRule; import type { Worksheet } from './worksheet'; /** * "If cell value [op] formula → apply dxf". Mirrors Excel's "Highlight Cell * Rules → ..." UI. */ export declare const addCellIsRule: (ws: Worksheet, sqref: MultiCellRange | string, opts: { operator: CellIsOperator; formula1: string; formula2?: string; dxfId?: number; stopIfTrue?: boolean; priority?: number; }) => ConditionalFormattingRule; /** Top-N or bottom-N rule. `bottom: true` → bottom-N. `percent: true` → percentile. */ export declare const addTopNRule: (ws: Worksheet, sqref: MultiCellRange | string, opts: { rank?: number; bottom?: boolean; percent?: boolean; dxfId?: number; priority?: number; }) => ConditionalFormattingRule; /** Above/below-average rule. `aboveAverage: false` → below-average; provide `stdDev` for ±N stddev. */ export declare const addAverageRule: (ws: Worksheet, sqref: MultiCellRange | string, opts: { aboveAverage?: boolean; equalAverage?: boolean; stdDev?: number; dxfId?: number; priority?: number; }) => ConditionalFormattingRule; /** Duplicate-values rule (each cell whose value appears more than once gets the dxf). */ export declare const addDuplicateValuesRule: (ws: Worksheet, sqref: MultiCellRange | string, opts?: { dxfId?: number; priority?: number; unique?: boolean; }) => ConditionalFormattingRule; /** Free-form formula rule — any `=ISNUMBER(A1)`-style boolean expression. */ export declare const addFormulaRule: (ws: Worksheet, sqref: MultiCellRange | string, opts: { formula: string; dxfId?: number; stopIfTrue?: boolean; priority?: number; }) => ConditionalFormattingRule; /** Text-based rule (containsText / notContains / beginsWith / endsWith). */ export declare const addTextRule: (ws: Worksheet, sqref: MultiCellRange | string, opts: { operator: TextOperator; text: string; dxfId?: number; priority?: number; }) => ConditionalFormattingRule; export type CfvoType = 'min' | 'max' | 'num' | 'percent' | 'percentile' | 'formula'; export interface Cfvo { type: CfvoType; /** Required for num / percent / percentile / formula; ignored for min / max. */ val?: string; } export type IconSetStyle = '3Arrows' | '3ArrowsGray' | '3Flags' | '3Signs' | '3Symbols' | '3Symbols2' | '3TrafficLights1' | '3TrafficLights2' | '4Arrows' | '4ArrowsGray' | '4Rating' | '4RedToBlack' | '4TrafficLights' | '5Arrows' | '5ArrowsGray' | '5Quarters' | '5Rating'; /** * Color-scale rule — gradient between 2 or 3 reference points. Each cfvo pairs * with one color. */ export declare const addColorScaleRule: (ws: Worksheet, sqref: MultiCellRange | string, opts: { cfvos: ReadonlyArray; /** Hex strings, e.g. `'FFFF0000'`; one per cfvo. */ colors: ReadonlyArray; priority?: number; stopIfTrue?: boolean; }) => ConditionalFormattingRule; /** * Data-bar rule — a gradient bar inside each cell sized to the value. Defaults * to `min`/`max` cfvos so the bar spans the visible range. */ export declare const addDataBarRule: (ws: Worksheet, sqref: MultiCellRange | string, opts: { color: string; minCfvo?: Cfvo; maxCfvo?: Cfvo; minLength?: number; maxLength?: number; showValue?: boolean; priority?: number; stopIfTrue?: boolean; }) => ConditionalFormattingRule; /** * Icon-set rule — visual icons (arrows / lights / flags) drawn next to each * cell value. The number of cfvos depends on the icon set (3 for `3Arrows`, 4 * for `4Arrows`, 5 for `5Arrows`, etc). */ export declare const addIconSetRule: (ws: Worksheet, sqref: MultiCellRange | string, opts: { iconSet: IconSetStyle | string; cfvos: ReadonlyArray; reverse?: boolean; showValue?: boolean; percent?: boolean; priority?: number; stopIfTrue?: boolean; }) => ConditionalFormattingRule;