import { CellIcon } from '../core/document-model/index.js'; import { ConditionalFormat, DefinedName, WorksheetCell, XlsxBorder, XlsxStyles } from '../core/spreadsheet-model/index.js'; /** * A resolved per-cell override the print model layers over a cell's base format: a * solid highlight fill, font tweaks, an in-cell data bar (fraction of the cell * width 0..1 + colour), and/or a leading icon. */ export interface CfOverride { readonly fillHex?: string; /** * §18.8.9 — the edges the rule's dxf declares. A rule may format with nothing * else, and dropping them made such a rule invisible. */ readonly border?: XlsxBorder; /** §18.8.9 — the format the rule renders the cell's value in. */ readonly numberFormat?: string; readonly fontColorHex?: string; readonly bold?: boolean; readonly italic?: boolean; /** §18.8.37 — the rule strikes the cell's text through. */ readonly strike?: boolean; /** An in-cell data bar: its fraction of the cell width, colour, and optional left offset. */ readonly dataBar?: { readonly fraction: number; readonly colorHex: string; readonly startFraction?: number; readonly negative?: boolean; }; readonly icon?: CellIcon; /** * §18.3.1.28 `` — the cell shows its BAR and not its * number. Excel's "Show Bar Only": the figure would otherwise sit on top of * its own gauge. */ readonly hideValue?: boolean; } /** * A per-cell lookup returning the {@link CfOverride} for the cell at `(row, col)`, * or undefined when no rule applies. `numericValue` is the cell's comparable number * (undefined for non-numeric cells); `text` is its resolved string — needed by the * text tests and to key duplicate / unique comparisons for non-numeric cells * (empty/undefined for a blank cell). */ export type CellConditionalFormatter = (row: number, col: number, numericValue: number | undefined, text: string | undefined, /** * The cell holds nothing. It still COMPARES as zero — Excel and Calc both * colour an empty cell for a rule written `cellIs equal 0`, which is how * 48539.xlsx paints its whole Pass/Fail column red — but it is not a value * that can repeat, so duplicate/uniqueValues must pass it over. */ blank?: boolean) => CfOverride | undefined; /** * Compile a sheet's `` rules + the workbook's `` into * a per-cell {@link CellConditionalFormatter}. Returns undefined when the sheet has * no conditional formats (the common case) so callers skip the work entirely and * stay byte-identical. * * @param conditionalFormats The sheet's rules; undefined/empty ⇒ no formatter. * @param styles The workbook style table (its `dxfs` supply the highlights). * @param cells The range values the extent rules need * (min/max/percentile/mean/frequency); `cellIs` and the * text tests ignore it. * @param resolveText Resolves a cell's string value (shared strings / number * format) for the duplicate/unique frequency map — numeric * cells key by value without it, so it is only needed for * text cells. * @param date1904 The workbook date epoch (feeds the W9 formula engine). * @param now An injected reference date — never the wall clock — * driving `TODAY()`/`NOW()` and the `timePeriod` windows; * absent ⇒ those constructs no-op (deterministic output). * @param sheetGrids The whole workbook, for an `expression` rule that reaches * another sheet (`Sheet2!A1`) or a defined name; absent ⇒ * same-sheet references only. * @param currentSheet The rule sheet's name, for resolving sheet-local names. * @param definedNames The workbook defined names visible to `expression` rules. */ export declare function buildConditionalFormatter(conditionalFormats: ReadonlyArray | undefined, styles: XlsxStyles, cells: ReadonlyArray, resolveText?: (cell: WorksheetCell) => string, date1904?: boolean, now?: Date, sheetGrids?: ReadonlyMap; }>, currentSheet?: string, definedNames?: ReadonlyArray): CellConditionalFormatter | undefined;