Class: Formula

Formula(parent, optionsopt)

Formula class

Constructor

new Formula(parent, optionsopt)

Creates an instance of Formula
Parameters:
Name Type Attributes Description
parent Element | String The intended wrapper
options Object <optional>
Optional additional parameters
Properties
Name Type Attributes Description
separators Array.<String> <optional>
Characters that will process the inputted String into a new tag
closers String <optional>
A chain of characters that will always trigger a new separate tag
lang Object.<String, String> <optional>
Dictionary holder (The attribute 'field' is the only one needed right now)
customFields Object.<String, Field> <optional>
Custom Fields to display
onFieldExpand function <optional>
Callback REQUIRED if you use the 'children: true' Field property. Expects a Field-like object to be returned
onUpdate function <optional>
Callback triggered whenever the Formula gets updated. It's first parameter is the String representation of the Formula
Source:

Methods

(static) destroy(selector)

Removes any Formula mutation from the DOM
Parameters:
Name Type Description
selector String The selector for the Formula parent
Source:

add(formulaString) → {Formula}

Add to the Formula manually
Parameters:
Name Type Description
formulaString String The Formula String
Source:
Returns:
The current Formula
Type
Formula

addField(fieldPath) → {Formula}

Add a custom field to the Formula manually
Parameters:
Name Type Description
fieldPath String The field path
Source:
Returns:
The current Formula
Type
Formula

clear() → {Formula}

Clear the Formula manually
Source:
Returns:
The current Formula
Type
Formula

destroy()

Removes any Formula mutation from the DOM
Source:

get() → {String}

Get the String value of the Formula
Source:
Returns:
The String representation of the Formula
Type
String

set(formulaString) → {Formula}

Set the Formula manually
Parameters:
Name Type Description
formulaString String The Formula String
Source:
Returns:
The current Formula
Type
Formula

Type Definitions

Field

Field object
Properties:
Name Type Description
name String The field's pretty name
children Object.<String, Field> | Boolean Either another level of Fields or a boolean (to use in combination of the 'onFieldExpand' callback)
customData Object Custom data for the field (Will be the 'onFieldExpand' callback second argument)
Source:
Example
{
  name: 'Pretty name',
  children: {
    firstChild: {
      name: 'Child name'
    },
    secondChild: {
      name: 'Second child name',
      children: true
    }
  }
}