Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "src/fieldState"

Index

Type aliases

field

field: object

The data for a field

NOT all of its state, enough to do magic tags

Type declaration

  • ID: fieldId
  • label: string
  • Optional options?: fieldOptions
  • slug: string
  • tag: string
  • type: string

fieldId

fieldId: string

The type for the field's id

fieldOption

fieldOption: object

One option of a field

Type declaration

  • Optional calcValue?: number
  • label: string
  • Optional value?: string | number

fieldOptions

fieldOptions: Array<fieldOption>

A collection of field options

fieldStateEvents

fieldStateEvents: "addField" | "removeField" | "updateField"

Names of events emitted by this factory's event emitter

fields

fields: Array<field>

A collection of fields

Functions

default

  • default(initialFields?: fields): object
  • A factory for field state in Caldera Forms editor

    Parameters

    • Optional initialFields: fields

    Returns object

    • feildEvents: EventEmitter<object>

      Event emitter

      Each event name is a part of the union type fieldStateEvents

      feildEvents.on( 'addField', (fieldId) => console.log( Added field ${fieldId} ); feildEvents.on( 'removeField', (field) => console.log( Removed field ${field.id} ); feildEvents.on( 'updateField', ({fieldId,beforeUpdate}) => console.log( Updated field ${fieldId} );

    • addField: function
      • addField(field: field): boolean
      • Add a field to the collection

        Parameters

        Returns boolean

    • getAllFields: function
      • Get all fields in collection

        Returns fields

    • getField: function
      • Get a field from collection by id

        Parameters

        Returns field | undefined

    • removeField: function
      • removeField(fieldId: fieldId): boolean
      • Remove a field from the collection

        Parameters

        Returns boolean

    • updateField: function
      • updateField(field: field): boolean
      • Update field in collection

        Parameters

        Returns boolean

Generated using TypeDoc