Home Reference Source
import LabelGroup from '~/template/Form/LabelGroup.js'
public class | source

LabelGroup

Extends:

js/template/template/Template.js~Template → LabelGroup

A label group is an input along with surrounding metadata. This means this manages validation, interaction, labels, and more. This also allows you to configure tooltips.

The label group can mount any item that implements the InputInterface interface.

Constructor Summary

Public Constructor
public

constructor(label: string, input: InputInterface, o: Object)

A group of label and the input.

Member Summary

Public Members
public
public
public get

value: any

Sets the value of the underlying input value if applicable.

public set

value(newValue: any)

Sets the value of the type.

public set

Sets the weight in a group

Method Summary

Public Methods
public

Foreign synchronizes

public

observeValidation(): Observable

Observe the validation status.

public

observeValue(): Observable

Returns observer for the value.

public

async setTooltip(tooltip: string)

Sets the tooltip text

public

Validates the LabelGroup for live labels

Public Constructors

public constructor(label: string, input: InputInterface, o: Object) source

A group of label and the input.

If you do supply a template. Ensure it has .input attribute which evaluates to the underling HTMLInputElement which can be observed for value updates. See InputInterface

Params:

NameTypeAttributeDescription
label string

The label (self-explantory)

input InputInterface

The input to mount

o Object

additional options.

o.tooltip string
  • nullable: true

Some info describing what this does. Do note if you select the horizontal style. This will appear as an inline description.

o.isHorizontalStyle boolean
  • optional
  • default: false

Uses 'horizontal' style. Places title and description on the side. used for things such as checkbox.

o.button ButtonTemplate
  • nullable: true

Pass if you want to keep a button within label group for alignment purposes

o.liveConstraint FormConstraint
  • optional
  • default: null

Contraints already setup to show

o.interactor ForeignInteractor
  • optional
  • default: null
  • nullable: true

Foreign interactor to link { foreignInteractor: ForeignInteractor, label: String }

o.hideLabel boolean
  • optional
  • default: false

If label should be hidden.

o.weight number
  • optional
  • default: null
  • nullable: true

If in group how much weight (default is one)

Public Members

public input: TextInputTemplate source

public validationDelegate: ActionControllerDelegate source

public get value: any source

Sets the value of the underlying input value if applicable. Gives no guarantee of the sync with UI.

public set value(newValue: any) source

Sets the value of the type. USE of this setter is NOT reccomended.

public set weight: number source

Sets the weight in a group

Public Methods

public foreignSynchronize(interactor: ForeignInteractor, key: string, time: number) source

Foreign synchronizes

Params:

NameTypeAttributeDescription
interactor ForeignInteractor
key string
time number

delay in the queue see repsective interactor fn

public observeValidation(): Observable source

Observe the validation status. This provides list of errors

Return:

Observable

public observeValue(): Observable source

Returns observer for the value.

Return:

Observable

public async setTooltip(tooltip: string) source

Sets the tooltip text

Params:

NameTypeAttributeDescription
tooltip string

public validate(errors: ValidationError[]) source

Validates the LabelGroup for live labels

Params:

NameTypeAttributeDescription
errors ValidationError[]