@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    Predicate builder — lets the user compose filter rules against typed fields, similar to the macOS Finder "Smart Folder" editor.

    <ui-filter [fields]="fields" [(value)]="descriptor" />
    

    The component exposes a model() signal named value. Use [(value)] for two-way binding or listen to (valueChange).

    By default all rules are combined with AND. Set [allowJunction]="true" to let the user switch between all (AND) and any (OR).

    Type Parameters

    • T = any
    Index

    Constructors

    • Type Parameters

      • T = any

      Returns UIFilter<T>

    Properties

    allowAdvanced: InputSignal<boolean> = ...

    Whether advanced mode is available. Defaults to true.

    Advanced mode renders the full multi-rule predicate builder.

    allowJunction: InputSignal<boolean> = ...

    When true the user can toggle between all (AND) and any (OR). Defaults to false (AND-only).

    allowSimple: InputSignal<boolean> = ...

    Whether simple mode is available. Defaults to true.

    Simple mode renders a single search textbox using "Any field contains" logic behind the scenes.

    currentJunction: Signal<FilterJunction> = ...
    data: InputSignal<readonly T[]> = ...

    Optional raw dataset used to derive distinct values per string field.

    When provided and the total row count is below 1 000, each string field's unique values are collected and forwarded to child rows so they can render a dropdown (≤ 5 distinct) or autocomplete (6–99) instead of a plain text input.

    disabled: InputSignal<boolean> = ...

    Whether the filter is disabled.

    expressionChange: OutputEmitterRef<FilterExpression<T>> = ...

    Emits a FilterExpression every time the filter rules change.

    • Emits an empty array when no valid rules remain (= show all rows).
    • Designed to be wired directly into FilterableArrayDatasource.filterBy().
    fields: InputSignal<FilterFieldDefinition<T>[]> = ...

    Filterable field definitions.

    junctionOptions: SelectOption[] = JUNCTION_OPTIONS
    mode: WritableSignal<FilterMode> = ...

    The current display mode of the filter.

    Determined automatically from allowSimple / allowAdvanced on init. Toggled by the user via the mode toggle button when both modes are enabled.

    modeLocked: InputSignal<boolean> = ...

    Whether the simple / advanced mode toggle is hidden.

    When true, the component stays permanently in whichever mode was resolved at init (from allowSimple / allowAdvanced). The user cannot switch modes.

    rules: Signal<FilterRule[]> = ...
    saveFilter: OutputEmitterRef<void> = ...

    Emitted when the user clicks the "Save Filter" button.

    Only fires when showSaveButton is true and the filter is in advanced mode.

    showSaveButton: InputSignal<boolean> = ...

    Whether to show a "Save Filter" button in the advanced mode header.

    When clicked, the saveFilter output emits.

    value: ModelSignal<FilterExpression<T>> = ...

    The complete filter state (two-way bindable).

    Methods

    • Adds a new empty rule defaulting to the "Any field" option.

      Returns void

    • Removes the rule at the given index.

      Parameters

      • index: number

      Returns void

    • Changes the junction mode.

      Parameters

      • junction: string

      Returns void

    • Toggles between simple and advanced mode.

      When switching to advanced, if there are no rules, one empty rule is added so the user sees a starting row. If the simple search had text, the "Any field contains" rule is preserved.

      When switching to simple, the current descriptor is replaced by the simple search term.

      Returns void

    • Replaces a single rule (called by child rows on edit).

      Parameters

      Returns void