Lurch web app user interface

Class

CategorySettingMetadata

A subclass of SettingMetadata for categorical values

(Not to be confused with SettingsCategoryMetadata, which groups a list of settings into a category of settings. This is a single setting that lets the user choose one value from a finite list of options, a "categorical" data type.)

Constructor

new CategorySettingMetadata(name, label, options, defaultValue)

Passes the parameters to the superclass for initialization, then marks this setting as one that should be represented in the UI using a drop-down list with the given array of values as its options.

Parameters

  • name String

    passed to superclass constructor

  • label String

    passed to superclass constructor

  • options Array.<String>

    array of valid values in this categorical data type, in the order they should be presented to the user when editing a setting with this metadata

  • defaultValue String

    passed to superclass constructor; should be on the list of options

Source

Classes

CategorySettingMetadata

Methods

convert(data) → {String}

Ensures that the value given is on the list of valid values. If it is not, it replaces it with the first value on the list of valid values.

Parameters

  • data any

    the data to convert to an item in this category

Returns

  • String

    the same data, if it is a valid element in this category, or the first valid element in this category otherwise

Source