SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface IOperator<P>

    Used for defining condition operators.

    interface IOperator<P = any> {
        createDefaultParam?(
            lhsSelector?: ISelector<Scalar, Scalar>,
            context?: DefaultConditionContext,
        ): P | null | undefined;
        createPredicate(param: P, ctx: IContext): MaybePromise<Predicate | null>;
        doBatch?(
            keys: Set<any>,
            param: P,
            ctx: IContext,
        ): MaybePromise<IRange<boolean> | null> | undefined;
        getAcceptsTypes?(): readonly (InteropScalarType | null)[] | null;
        getDescription?(): string | null;
        getName(): string;
        getParamType?(lhsSelector?: ISelector<Scalar, Scalar>): string | null;
        getTitle?(): string | undefined;
        isCombinator?(): boolean;
        toString?(
            param?: P,
            lhsSelector?: ISelector<Scalar, Scalar> | null,
        ): string | undefined;
        validateParam?(
            param: P,
            lhsSelector?: ISelector<Scalar, Scalar> | null,
        ): string | null;
    }

    Type Parameters

    • P = any
    Index
    • Creates the default param for this operator type.

      Parameters

      • OptionallhsSelector: ISelector<Scalar, Scalar>

        The condition's selector, when it has one.

      • Optionalcontext: DefaultConditionContext

        What the condition will apply to, when known. An operator may fit its default to it, as inSet starts from the distinct values already in the cells.

      Returns P | null | undefined

      Read context.ranges through getStats(), never by visiting its cells: a whole column may be selected.

    • Called once per evaluation to build the operator predicate.

      Parameters

      Returns MaybePromise<Predicate | null>

      • May be async: callers must await the result before evaluation.
      • ctx is scoped to the condition block (same one you’ll see inside the predicate), so you can safely use it for one-time initialization, stats, etc.
      • The createPredicate pattern is used to enable batching and async.
      • May return null to indicate no predicate (the condition always evaluates to true).
    • Optional hook that allows this operator to evaluate multiple values in a single batched operation instead of one-by-one predicate calls.

      Parameters

      • keys: Set<any>

        A set of batch keys previously passed to ICondition.IContext.deferBatch. The interpretation of each key is operator-specific:

        • Many operators use the value itself as the key (e.g. ticker symbol, email).
        • Some operators may use an accumulator object (e.g. a single SparseBuilder).
      • param: P

        The same param object originally passed to ICondition.IOperator.createPredicate.

      • ctx: IContext

        A shared ICondition.IContext instance that can be used to:

        • Inspect range statistics via ICondition.IContext.getRangeStats.
        • Coerce values via ICondition.IContext.toScalarType.
        • Access today’s date, the condition coordinates, current workbook calculation engine, etc.

      Returns MaybePromise<IRange<boolean> | null> | undefined

      An IRange<boolean> whose shape matches the condition range.

      Typical pattern:

      1. createPredicate constructs one or more accumulator objects (e.g., a range updater or a per-key bucket).
      2. Each predicate call:
        • records its input in the relevant accumulator,
        • calls ctx.deferBatch(accumulatorKey),
        • and returns a dummy boolean (ignored for batched cases).
      3. After all predicate calls complete for this condition, the engine calls doBatch once with the set of accumulator keys. The operator then:
        • finalizes its accumulators, and
        • produces an IRange<boolean> giving the final in/out result per cell.

      Rules that do not implement doBatch must not call ICondition.IContext.deferBatch. The engine will throw in that case.

    • Return types of scalars this operator supports.

      Returns readonly (InteropScalarType | null)[] | null

      • If not specified or null is returns all types will be passed.
      • A null entry indicates untyped/variant values.
      • Value is stable and should not change between calls for the same operator instance.
    • Returns a human-readable description of the operator.

      Returns string | null

    • The name of the operator.

      Returns string

    • Get selector type for param (RHS).

      Parameters

      • OptionallhsSelector: ISelector<Scalar, Scalar>

        The current LHS selector (for context)

      Returns string | null

      The selector type for the param.

      If null then this is a 'unary' operator (no param).

    • Returns a human-readable title of the operator.

      Returns string | undefined

    • Composes other conditions (param is ICondition or ICondition[])

      Returns boolean

    • Optional function to convert the param to a string representation.

      Parameters

      • Optionalparam: P
      • OptionallhsSelector: ISelector<Scalar, Scalar> | null

      Returns string | undefined

      A string representation of the param, or undefined if not implemented.

      This can be used for displaying the operator and param in a human-readable format.

    • Whether param is one this operator can be authored with under lhsSelector.

      Parameters

      • param: P
      • OptionallhsSelector: ISelector<Scalar, Scalar> | null

      Returns string | null

      A message key naming the first problem, or null when there is none. Omitted, any param is taken. See ICondition.validate.