Output SV Type Reference

Table of contents


Introduction

Output SV types inherit from the Model SV type (type:'modelValue', class:ModelValueSv). The class is OutputSv. Input SV types inherit from OutputSv. The OutputSv class is intended to be the superclass for user outputs. It is not intended for direct use and has no published type string.

Instances of Output SV types will have the isOutput property set to true.

Constructor

Parameters

Instance methods

Note: the default component() method will return a component that uses the state variable's render() method as its render() method.


Inherited methods


fmtVal()

Syntax

fmtVal()

Return a formatted value. The format information varies with subclass.

Return value

A string representing a formatted version of the value.


component()

Syntax

component()

Returns a new Component class (a subclass of IoSvComponent) whose render() method calls the state variable's render() method with the component props. Override this method in a subclass, or supply info.component, to use a different Component.

Return value

A subclass of Component.


render()

Syntax

render(props)

Returns the content to display for the state variable (a Template, string, number, DOM node, Component, or an array of these). Called by the default component(). The base implementation asserts false, so subclasses that use the default component() must override it.


setDflt()

Syntax

setDflt()

Resets className to info.className (or '') and then sets the value to dflt.


Instance properties

Inherited properties

Notes:


className

A CSS class string set on all representations of this state variable in the View. Uses the className childSv. Assigning it also calls ctl.sync(). Its initial value is info.className or ''.

Value

A CSS class string.


Component

IoSvComponent should be superClass for all Components for input or output state variables. The IoSvComponent will setup an SvMonitor for the state variable passed in the sVar attribute and synchronizes the DOM value when it changes using the setValue() method. If the sVar is an input, it will set an SvMonitor for sVar.childSv.isDisabled and synchronize the DOM node's disabled attribute using the setDisabled() method.

Component attributes

Inherited attributes


sVar

The state variable (the instance, not just the ID) that is associated with this component. This attribute is automatically set by the {{...}} syntax.


Component methods

setValue()

Syntax

setValue(value)

The default setValue() method first checks whether there are any child components. If so, it calls the first child component's setvalue() method. Otherwise, it sets the value property of the first component DOM node to value.

Subclasses should override this method if their implementation requires a different technique to set the value.


sync()

Syntax

sync()

The sync() method synchronizes the Dom value using the setValue() method. It also synchronizes the DOM node's disabled attribute using the setDisabled() method. Lastly, it calls super.sync() to synchronize child components.


Component properties

sVar

The state variable associated with this component.


_mon.sVar

This Componennt's SvMonitor for sVar.


Standard DOM element properties

By convention, the subclasses of IoSvComponent should create create DOM elements that share some common properties.

Subclasses are not required to obey these conventions.