Module: selectors

Dropdown buttons organized in toolbars, acting as selectors for the alternative materializations of a JSON Schema (thus following the tree representation of schemas, module:inPlaceApplicators~IPASchema).

❗️ This module relies on Bootstrap; if not available, the HTML result will not be properly displayed.

Source:
See:

Classes

Selector
SelectorsContainer
SelectorsToolbar

Methods

(inner) createSelectors(formElementId, ipaSchema, callback, disabledopt) → {module:selectors~SelectorsContainer}

Creates a module:selectors~SelectorsContainer which handles the selectors representing the given module:inPlaceApplicators~IPASchema tree.

Parameters:
Name Type Attributes Default Description
formElementId string

The id of the form element.

ipaSchema module:inPlaceApplicators~IPASchema

The root element of the module:inPlaceApplicators~IPASchema tree that the selectors should represent.

callback function

The callback function to be called on click events from the created selectors.

disabled boolean <optional>
false

Flag indicating whether the button should be disabled at initialization.

Source:
Returns:
Type
module:selectors~SelectorsContainer

(inner) forkRecursiveSelectorGenerator(formElementId, ipaSchema, callback, disabled) → {Array.<Array>}

Forks the execution of module:selectors~recursiveSelectorGenerator to produce multiple selectors toolbars.

Parameters:
Name Type Description
formElementId string

The id of the form element.

ipaSchema module:inPlaceApplicators~IPASchema

The node of the module:inPlaceApplicators~IPASchema tree to be represented.

callback function

The callback function to be called on click events from the created selectors.

disabled boolean

Flag indicating whether the selectors should be disabled at initialization.

Source:
Returns:

A matrix whose rows are 2-length arrays, each of them representing a selectors toolbar to be appended as result of the update:

Type
Array.<Array>

(inner) generateSelectors(formElementId, ipaSchema, callback, disabled) → {Array.<Array>}

Generates a matrix containing the selectors representing the given module:inPlaceApplicators~IPASchema tree.

Parameters:
Name Type Description
formElementId string

The id of the form element.

ipaSchema module:inPlaceApplicators~IPASchema

The root element of the module:inPlaceApplicators~IPASchema tree that the selectors should represent.

callback function

The callback function to be called on click events from the created selectors.

disabled boolean

Flag indicating whether the selectors should be disabled at initialization.

Source:
Returns:

A matrix whose rows are 2-length arrays, each of them representing a selectors toolbar:

Type
Array.<Array>

(inner) generateUpdatedSelectors(formElementId, ipaSchema, updatedToolbarPointer, triggererSelectorIndex, callback, disabledopt) → {Array.<Array>}

Generates the update data which includes the new selectors to be added to a module:selector~SelectorContainer, with respect to the given module:inPlaceApplicators~IPASchema tree.

Parameters:
Name Type Attributes Default Description
formElementId string

The id of the form element.

ipaSchema module:inPlaceApplicators~IPASchema

The root element of the module:inPlaceApplicators~IPASchema tree that the selectors should represent.

updatedToolbarPointer string

The JSON Pointer to the in-place applicator represented by the first selector of the toolbar which triggered the update.

triggererSelectorIndex number

The index in the toolbar of the selector which triggered the update.

callback function

The callback function to be called on click events from the created selectors.

disabled boolean <optional>
false

Flag indicating whether the button should be disabled at initialization.

Source:
Returns:

A 2-length array with the following structure:

  • The first element is an array of module:selectors~Selector components to append to the toolbar which triggered the update.

  • The second element is a matrix whose rows are 2-length arrays, each of them representing a selectors toolbar to be appended as result of the update:

Type
Array.<Array>

(inner) recursiveSelectorGenerator(formElementId, applicator, matrixKeyPointer, callback, disabled, currentSelectorIndexopt) → {Array.<Array>}

Recursive execution of the selector generation.

Parameters:
Name Type Attributes Default Description
formElementId string

The id of the form element.

applicator module:inPlaceApplicators~InPlaceApplicator

The in-place applicator to be represented by the selector being currently built.

matrixKeyPointer string

A JSON Pointer string that points to the in-place applicator represented by the first selector of the toolbar being built.

callback function

The callback function to be called on click events from the created selectors.

disabled boolean

Flag indicating whether the selectors should be disabled at initialization.

currentSelectorIndex number <optional>
0

The index in the toolbar of the selector being currently built.

Source:
Returns:

A matrix whose rows are 2-length arrays, each of them representing a selectors toolbar to be appended as result of the update:

Type
Array.<Array>