Support Menu

Class ComponentOptions

Class ComponentOptions

This static class is used to initialize component options.

Typically, each Component that exposes a set of options will contains a static options property,

This property will "build" the options based on their type.

Index

Methods

Static buildBooleanOption

Static buildColorOption

  • Build a color option.

    Normally, this only means that it will build a string that matches a CSS color.

    In the markup, this has no advantage over a plain string. This is mostly useful for the interface editor.

    data-foo="coveo-sprites-user" or data-foo="coveo-sprites-database".

    Parameters

    Returns string

Static buildFieldOption

Static buildFieldsOption

Static buildHelperOption

  • Build a helper option.

    Normally, this only means that it will build a string that matches the name of a template helper.

    In the markup, this has no advantage over a plain string. This is mostly useful for the interface editor.

    data-foo="date" or data-foo="dateTime".

    Parameters

    Returns string

Static buildIconOption

  • Build an icon option.

    This takes an SVG icon name, validates it and returns the name of the icon.

    data-foo="search"

    data-foo="facet-expand"

    data-foo="coveo-sprites-user" or data-foo="coveo-sprites-database".

    Parameters

    Returns string

Static buildJsonOption

  • Build a JSON option.

    Normally, this only means that it will build a stringified JSON.

    In the markup, this has no advantage over a plain string. This is mostly useful for the interface editor.

    data-foo='{"bar" : "baz"}'.

    Parameters

    Returns string

Static buildListOption

Static buildLocalizedStringOption

  • Build a localized string option.

    A localized string option can be any arbitrary string.

    The framework, when parsing the value, will try to load the localization for that word if it is available.

    If it is not available, it will return the non-localized option.

    This should be used for options that will be rendered directly to the end users.

    data-foo="bar".

    Parameters

    Returns string

Static buildNumberOption

Static buildSelectorOption

  • Build an option that allow to select an HTMLElement.

    The option accept a CSS selector that will allow to find the required HTMLElement.

    It can be a class selector or an ID selector.

    data-foo-selector=".bar" or data-foo-selector="#bar".

    Parameters

    Returns HTMLElement

Static buildStringOption

Static initComponentOptions

  • initComponentOptions(element: HTMLElement, component: any, values?: any): any
  • The main function that will load and parse the options for the current given element.

    Every component will call this function in their constructor.

    Parameters

    • element: HTMLElement

      The element on which the options should be parsed

    • component: any

      The component class for which the options should be parsed. For example : Searchbox, Facet, etc.

    • Optional values: any

      The optional options which should be merged with the options set in the markup.

    Returns any

Hierarchy

  • ComponentOptions