Widget

Widget

A Widget class that can be extended to provide some of the basic widget functionality out of the box.

Constructor

new Widget(element, optionsopt)

Source:
Parameters:
Name Type Attributes Description
element Element

The DOM element the widget is applied on

options boolean | Object <optional>

Options passed to the widget during instantiation

Members

(static, readonly) list :boolean

Source:

Returns true if the widget is using a list of options.

Type:
  • boolean

(static, readonly) name :string

Source:

Returns its own name.

Type:
  • string

(readonly) downloadButtonHtml :Element

Source:

Returns a HTML document fragment for a download button.

Type:
  • Element

(readonly) originalInputValue :*

Source:

Obtains the value from the original form control the widget is instantiated on. This form control is often hidden by the widget.

Type:
  • *

originalInputValue :*

Source:

Updates the value in the original form control the widget is instantiated on. This form control is often hidden by the widget.

Type:
  • *

(readonly) props :object

Source:

Returns widget properties. May need to be extended.

Type:
  • object

(readonly) resetButtonHtml :Element

Source:

Returns a HTML document fragment for a reset button.

Type:
  • Element

(readonly) value :*

Source:

Obtains the value from the current widget state. Should be overridden.

Type:
  • *

value :*

Source:

Sets a value in the widget. Should be overridden.

Type:
  • *

Methods

(static) condition() → {boolean}

Source:

Tests whether widget needs to be instantiated (e.g. if not to be used for touchscreens). Note that the Element (used in the constructor) will be provided as parameter.

Returns:

to instantiate or not to instantiate, that is the question

Type
boolean

_getProps() → {object}

Source:

Not meant to be overridden, but could be. Recommend to extend get props() instead.

Returns:

props object

Type
object

_init()

Source:

Meant to be overridden, but automatically called.

disable()

Source:

Disallow user input into widget by making it readonly.

enable()

Source:

Performs opposite action of disable() function.

update()

Source:

Updates form-defined language strings,