SheetXL - v1.0.2
    Preparing search index...

    Interface ICondition<P>

    Interface that captures the selector, operator, and param.

    interface ICondition<P = any> {
        get isICondition(): true;
        getOperator(): IOperator<any> | null;
        getParam(): P;
        getSelector(): ISelector<Scalar, Scalar> | null;
        isIncludeBlanks(): boolean;
        toJSON(): ICondition.JSON<P>;
        toString(): string;
        validate(): string | null;
    }

    Type Parameters

    • P = any

    Implemented by

    Index
    • get isICondition(): true

      For runtime introspection.

      Returns true

    • Returns the operator.

      Returns IOperator<any> | null

      The operator is responsible for evaluating the condition param against the transformed value from the selector. Return null if there is no operator and the condition is purely based on the selector transformation (e.g. "Is Blank" could be a selector that checks for blank values without needing an operator).

    • Returns the param for the condition.

      Returns P

      This is operator-specific and not all operators require a param.

    • Returns the selector.

      Returns ISelector<Scalar, Scalar> | null

      The selector is responsible for transforming the cell value before it is passed to the operator predicate. If null is returned then the raw cell value is used (identity selector). This allows operators to focus on their core logic and delegate any necessary value transformation to the selector. For example, a "Text Contains" operator might use a selector that converts values to lowercase strings, enabling case-insensitive matching.

    • Whether to include blank cells when applying the condition.

      Returns boolean

      Evaluation Behavior:

      • If false (default): Blank cells evaluate to FALSE (fail the condition test)
      • If true: Blank cells evaluate to TRUE (pass the condition test)

      Why This Matters:

      Different consumers interpret condition results differently:

      DataValidation (acts on FALSE = invalid):

      • includeBlanks: false → Blanks FAIL validation (are invalid/rejected)
      • includeBlanks: true → Blanks PASS validation (are valid/allowed)
      • Example: "Allow dates, ignore blanks" needs includeBlanks: true so blank cells are allowed

      ConditionalFormat & TableFilter (act on TRUE = show/format):

      • includeBlanks: false → Blanks are NOT formatted/shown (natural behavior)
      • includeBlanks: true → Blanks ARE formatted/shown (rarely needed)
      • Example: "Highlight dates" with includeBlanks: false correctly excludes blanks

      Ignore Blank:

      On, a blank is taken out of the population before anything is asked, so whatever the host does on failure never happens to it. Off, a blank is a value like any other, judged as Excel judges an empty cell: 0 under a number rule, "" under a text one (so "whole number not between 1 and 5" passes it), a member of a set by InSetOption.blank, and what BuiltInOperatorNames.Blank names. Read on the root condition only; an editor shows it as one checkbox, "Ignore Blank", under every host. Excel's allowBlank.

      What is blank:

      • Filters and ConditionalFormat: an empty cell, a "" result, or a string of only spaces (Excel's LEN(TRIM(x))=0). A tab, a non-breaking space, 0 and an error are values.
      • DataValidation: an empty cell only. A "" result is a value and is judged.
    • Returns a string representation of the selector, operator, and param.

      Returns string

    • Whether the condition can be authored as it is.

      Returns string | null

      A message key naming the first problem — an operand not yet given, bounds the wrong way around, a whole-number rule holding a fraction — or null when there is none.

      Advisory, and what an editor asks before it saves: the rules are the ones Excel's dialogs refuse on. A condition read from a file is kept and evaluated whatever this answers; a comparison missing an operand evaluates as inert rather than as wrong.