SheetXL - v1.0.2
    Preparing search index...

    Interface ISelector<T, I>

    Used for defining condition selectors.

    A selector is how a condition reads a value: a partial function from cell values to its type (getSelectType). It gates, answering NotApplicable for a value that is not this kind (text under Whole, a fraction under Whole, a boolean under any number selector), and it projects, reading a value it accepts as something else (Text length reads abc as 3). Most built-in selectors only gate: Whole, Number, Date and Time read a number as itself, and differ in which operands they take.

    The operator never sees a value the selector did not read, and a host reads a gate failure as a fail. No selector is "any value": a condition with none reads every value as itself.

    interface ISelector<T extends Scalar = Scalar, I extends Scalar = T> {
        createTransformer(ctx: IContext): MaybePromise<Transformer<T, I> | null>;
        getDefaultCondition?(
            context?: DefaultConditionContext,
        ): DefaultCondition<any> | null;
        getDescription?(): string;
        getInputType(): InteropScalarType | null;
        getName(): string;
        getSelectType(): InteropScalarType | null;
        getTitle?(): string;
    }

    Type Parameters

    • T extends Scalar = Scalar
    • I extends Scalar = T
    Index
    • Called once per evaluation to build the selector's reading of a value.

      Parameters

      Returns MaybePromise<Transformer<T, I> | 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.
      • An example of where we would want to batch is 'address or 'in list'.
      • Return null for identity selectors (no transformation needed — value passes through as-is).
      • The transformer answers NotApplicable for a value outside the selector's domain.
    • The condition a user starts from on choosing this selector.

      Parameters

      Returns DefaultCondition<any> | null

      The operator and, only where one value is plainly the right one, its param. null for a selector with no natural operator.

      An authoring UI asks for this when a user picks the selector, so the choice shows an operator at once rather than an empty condition. An omitted param is filled by the operator's own ICondition.IOperator.createDefaultParam; supply one only when it is the value the user would have chosen, since an invented value that is saved unnoticed is a rule nobody wrote.

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

    • Returns a human-readable description of the selector.

      Returns string

    • The type of raw value this selector reads, when it is one type.

      Returns InteropScalarType | null

      • A fast path for the gate: a value of another type is NotApplicable without the transformer being asked. null when the selector reads more than one type (Text length reads numbers and booleans as their text), in which case the transformer gates alone.
      • A stored date is a number, so Date here admits a number.
      • Value is stable and should not change between calls for the same selector instance.
    • The name of the selector.

      Returns string

    • Return type of scalar this selector returns.

      Returns InteropScalarType | null

      • If not specified or null is returns all types will be passed.
      • Value is stable and should not change between calls for the same selector instance.
    • Returns a human-readable title of the selector.

      Returns string