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 full)

Constructors

Properties

_debouncedFilterChoices: ((...args: [event: Event, html: HTMLElement]) => void)
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> = null

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.

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.

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.

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

The handlebars template used to render this filter.

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

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

    • Optionaloptions: {
          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