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.

Abstract

Hierarchy

Constructors

Properties

_debouncedFilterChoices: ((...args) => void)

Type declaration

    • (...args): void
    • Wrap a callback in a debounced timeout. Delay execution of the callback function until the function has not been called for delay milliseconds

      Parameters

      • Rest ...args: [event: Event, html: HTMLElement]

      Returns void

      A wrapped function which can be called to debounce execution

booleanOperator: BooleanOperator = BOOLEAN_OPERATOR.NONE

The boolean operator used to combine choices of this filter. If "OR", an entry will be included if at least one active choice matches. If "AND", an entry will only be included if all active choices match.

choices: null | Collection<FilterChoice>

A Collection of FilterChoices for this filter.

compendiumBrowser: null | CompendiumBrowser = null

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.

MIN_SEARCH_CHOICES: number | boolean = 10

The minimum number of choices that must be present before the filter will show a search box. Booleans can be used to override this check.

TEMPLATE: string = "systems/pf1/templates/apps/compendium-browser/checkbox-filter.hbs"

The handlebars template used to render this filter.

localizeChoices: boolean = false

Auto-localize choices.

Defaults to false due to pre-translation.

localizeLabel: boolean = false

Auto-localize filter label

localizePrefix: string = ""

Prefix to add to choices before localization.

savingThrow: string = "ref"
type: string = "class"

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

types: string[] = []

The types of document this filter applies to.

Accessors

  • get indexField(): string
  • The field this filter checks against its choices. Will also be added to the compendiumIndexFields of the document's CONFIG object.

    Returns string

    Abstract

Methods

  • Generate a Collection of FilterChoices from a CONFIG object.

    Parameters

    • configObject: Record<string, string> | Record<string, Record<string, string>>

      The object to generate choices from; can be a Record<string, string> or

    • Optional options: {
          innerSet: undefined | boolean;
          labelKey: undefined | string;
      } = {}

      Options determining how the choices are generated.

      • innerSet: undefined | boolean

        Whether choices should be generated from direct properties of the configObject, or from the properties of the inner objects.

      • labelKey: undefined | string

        The key to use to determine the label if the configObject is a Record<string, object>; will be ignored if the configObject is a Record<string, string>.

    Returns Collection<FilterChoice>

    • A Collection of FilterChoices

Generated using TypeDoc