A controller class for managing a text input widget that filters the contents of some other UI element.

Constructors

Properties

_input: null | HTMLElement = null

A reference to the HTML navigation element the tab controller is bound to

callback: null | SearchFilterCallback

A callback function to trigger when the tab is changed

query: string

The value of the current query string

rgx: RegExp

The regular expression corresponding to the query that should be matched against

OPERATORS: Readonly<
    {
        BETWEEN: "between";
        CONTAINS: "contains";
        ENDS_WITH: "ends_with";
        EQUALS: "equals";
        GREATER_THAN: "gt";
        GREATER_THAN_EQUAL: "gte";
        IS_EMPTY: "is_empty";
        LESS_THAN: "lt";
        LESS_THAN_EQUAL: "lte";
        STARTS_WITH: "starts_with";
    },
> = ...

The allowed Filter Operators which can be used to define a search filter

Methods

  • Bind the SearchFilter controller to an HTML application

    Parameters

    • html: HTMLElement

    Returns void

  • Perform a filtering of the content by invoking the callback function

    Parameters

    • event: null | KeyboardEvent

      The triggering keyboard event

    • query: string

      The input search string

    Returns void

  • Release all bound HTML elements and reset the query.

    Returns void

  • Test whether a given object matches a provided filter

    Parameters

    • obj: object

      An object to test against

    • filter: FieldFilter

      The filter to test

    Returns boolean

    Whether the object matches the filter

  • A helper method to test a value against a precomposed regex pattern.

    Parameters

    • rgx: RegExp

      The regular expression to test

    • value: string

      The value to test against

    Returns boolean

    Does the query match?