Module: components

Definitions of classes and functions that build the components required to generate JSON Schema forms.

Source:

Classes

AddButton
BooleanInput
GeneratorIcon
InputTitle
InstanceViewPanel
LabelTitle
NumericInput
PillsInstancePanel
RemoveButton
RequiredIcon
RootIcon
Select
SelectInstancePanel
TextInput
Toggler

Interfaces

Component
InputComponent

Methods

(inner) buildBooleanInstance(instance, booleanTranslateFunctionopt) → {Text}

Builds the DOM representation of a boolean JSON instance.

Parameters:
Name Type Attributes Default Description
instance boolean

The boolean JSON instance to present.

booleanTranslateFunction function <optional>
(b) => b

A function that maps boolean values into strings.

Source:
Returns:

An HTML text node containing the instance representation.

Type
Text

(inner) buildNullInstance() → {Text}

Builds the DOM representation of a null JSON instance.

Source:
Returns:

An HTML text node containing the instance representation.

Type
Text

(inner) buildNumberInstance(instance) → {Text}

Builds the DOM representation of a number JSON instance.

Parameters:
Name Type Description
instance number

The number JSON instance to present.

Source:
Returns:

An HTML text node containing the instance representation.

Type
Text

(inner) buildStringInstance(instance) → {Text}

Builds the DOM representation of a string JSON instance.

Parameters:
Name Type Description
instance number

The string JSON instance to present.

Source:
Returns:

An HTML text node containing the instance representation.

Type
Text

(inner) createInstanceView(instance, booleanTranslateFunction, optionsopt) → {HTMLElement}

Creates an HTML element containing a representation of a given JSON instance.

Parameters:
Name Type Attributes Default Description
instance any

The JSON instance to be displayed.

booleanTranslateFunction function

A function that maps boolean values into strings.

options object <optional>
{}

Parameters considered to generate the component.

Properties
Name Type Attributes Description
bootstrap string <optional>

If given, it indicates the Bootstrap version which the component should be built for.

Source:
Returns:

An element containing the HTML structure of the instance representation.

Type
HTMLElement

(inner) instanceAsTitle(instance, arraySubstitute, objectSubstitute, booleanTranslateFunction) → {string}

Generates a string from a given instance to be used as title.

Parameters:
Name Type Description
instance any

The JSON instance from which to extract a title.

arraySubstitute string

A string to be shown as title of an instance corresponding to a JSON Schema array type.

objectSubstitute string

A string to be shown as title of an instance corresponding to a JSON Schema object type.

booleanTranslateFunction function

A function that maps boolean values into strings.

Source:
Returns:

The generated title.

Type
string

(inner) isJsonPrimitiveType(instance) → {boolean}

Evaluates if a given JSON instance is of a primitive type (boolean, null, number or string).

Parameters:
Name Type Description
instance any

The JSON instance to be evaluated.

Source:
Returns:

A boolean set to true if the function evaluates positive, false otherwise.

Type
boolean