Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

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

    Index

    Constructors

    Properties

    _input: HTMLElement | null = null

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

    callback: SearchFilterCallback | null

    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: KeyboardEvent | null

        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?