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.
infoinfo object can contain the following properties, but subclasses of StateVar may have additional properties:info properties.info properties.classNameclassName property (default ''). setDflt() resets className to this value.Note: the default component() method will return a component that uses the state variable's render() method as its render() method.
fmtVal()
Return a formatted value. The format information varies with subclass.
A string representing a formatted version of the value.
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.
A subclass of Component.
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()
Resets className to info.className (or '') and then sets the value to dflt.
Notes:
isOutput property is only true for Output SV types.save property for Output SV types is 'none', if not specified at construction.classNameA 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 ''.
A CSS class string.
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.
sVarThe state variable (the instance, not just the ID) that is associated with this component. This attribute is automatically set by the {{...}} syntax.
setValue()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()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.
sVarThe state variable associated with this component.
_mon.sVarThis Componennt's SvMonitor for sVar.
By convention, the subclasses of IoSvComponent should create create DOM elements that share some common properties.
'svIo_<type>' and svId_<sVar ID> in addition to any component className attributes and classSv values.data-cid attribute set to the ID of the Component. This is useful to quickly find the state of the controlling component using view.getComponentById().Subclasses are not required to obey these conventions.