Pathfinder 1e for Foundry VTT
    Preparing search index...

    A basic filter class containing common functionality for all filters.

    Inheriting classes should define the following static properties: label, indexField. Inheriting classes may define the following static properties: type.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    choices: null | Collection<FilterChoice, Methods<FilterChoice>> = null

    A Collection of FilterChoices for this filter.

    compendiumBrowser: null | CompendiumBrowser

    A reference to the CompendiumBrowser this filter is used in.

    id: string

    The ID of this filter used to identify it in its browser's filters.

    indexField: string = ""

    The field this filter checks against its choices. Will also be added to the compendiumIndexFields of the document's CONFIG object.

    label: string = ""

    The label for this filter visible to the user.

    localizeChoices: boolean = false

    Auto-localize choices.

    Defaults to false due to pre-translation.

    localizeLabel: boolean = true

    Auto-localize filter label

    localizePrefix: string = ""

    Prefix to add to choices before localization.

    TEMPLATE: string = ""

    The handlebars template used to render this filter.

    type: string = ""

    A convenience property to define a single type this filter applies to.

    types: string[] = []

    The types of document this filter applies to.

    Accessors

    • get active(): boolean

      Whether this filter has any active choices.

      Returns boolean

    • get activeChoiceCount(): number

      The number of active choices.

      Returns number

    • get handledTypes(): Set<string>

      The authoritative Set of types this filter applies to.

      Returns Set<string>

    Methods

    • Activate event listeners for this filter.

      Parameters

      • html: HTMLElement

        The rendered HTML element for this filter only

      Returns void

    • Check whether an entry matches this filter. If the filter is not active, this will always return true.

      Parameters

      • entry: object

        The entry to check against this filter

      Returns boolean

      • Whether the entry matches this filter
    • Provide data necessary to render this filter. The data object generated by BaseFilter#getData contains the minimum data not only required by the filter itself, but also by the rendering CompendiumBrowser.

      Returns object

      } The data object for this filter

    • Returns whether this filter has more than the given number of choices. Defaults to 1, as a single choice allows for no real filtering.

      Parameters

      • Optionalnumber: number = 1

        The number of choices to check for

      Returns boolean

      • Whether this filter has more than the given number of choices
    • Prepare the choices for this filter. This is called after the compendium browser has gathered its entries. By default, this will generate a list of choices from the index field of all entries in the compendium.

      Returns void

    • Adds the index fields checked by this filter to the document's CONFIG object, so that CompendiumCollection#getIndex will include them.

      Returns void

    • Reset all choices and controls to their default state (inactive)

      Returns void

    • Prepare the filter for use. This step expects the compendium browser to have gathered its entries.

      Returns Promise<void>