bajaux/model/UxModel

API Status: Development

Description:
  • API Status: Development

Source:

Methods

clone(params) → {Promise.<module:bajaux/model/UxModel>}

Description:
  • Creates a new, equivalent copy of this UxModel, including cloning all of its kids.

Source:
Since:
  • Niagara 4.15
Parameters:
Name Type Description
params module:bajaux/model/UxModel~UxModelParams

if specified, these parameters
will be applied to the clone (not including kids)

Returns:

to be resolved to a clone of this UxModel

Type
Promise.<module:bajaux/model/UxModel>

get(path) → {module:bajaux/model/UxModel|module:bajaux/model/binding/IBinding|undefined}

Source:
Parameters:
Name Type Description
path string | Array.<string>
Returns:

the UxModel
kid by the given name. If an array of names is given, this will follow the
path down through the UxModel structure.

Type
module:bajaux/model/UxModel | module:bajaux/model/binding/IBinding | undefined

getBindingList() → {module:bajaux/model/binding/BindingList}

Source:
Returns:
Type
module:bajaux/model/binding/BindingList

getDefaultProperties() → {object}

Source:
Since:
  • Niagara 4.15
Returns:

object literal describing this widget's default properties

Type
object

getFormFactor() → {string|undefined}

Source:
Since:
  • Niagara 4.14
Returns:

the form factor this widget should be constructed with, if known

Type
string | undefined

getKids() → {Array.<module:bajaux/model/UxModel>}

Source:
Returns:

UxModel
instances for this widget's children

Type
Array.<module:bajaux/model/UxModel>

getMetadata() → {object}

Description:
  • Returns any metadata provided to the constructor.

Source:
Since:
  • Niagara 4.15
Returns:
Type
object

getName() → {string}

Source:
Returns:
Type
string

getProperties() → {object}

Source:
Returns:

object literal describing this widget's properties. This includes any
default properties configured in the Widget's constructor.

Type
object

getType() → {function}

Source:
Returns:

constructor for the widget to create

Type
function

getValue() → {*|null}

Source:
Returns:

the value to be loaded into this widget

Type
* | null

isReadonly() → {boolean}

Source:
Since:
  • Niagara 4.14
Returns:

true if this widget should be readonly

Type
boolean

toSpandrel(params) → {object}

Description:
  • Produce a spandrel config object that represents this Ux element as
    rendered in the DOM. The value property will always be this, as the
    UxModel will be loaded into the spandrel widget as the value.

    Remember that the spandrel data will contain any bindings present in
    the model as well! Beware of simply passing back toSpandrel() results
    from the UxModel passed to your render function - you may get duplicate
    bindings. toSpandrel() is typically more appropriate for calling on
    kids.

Source:
Parameters:
Name Type Description
params object | string | function

parameters used for generating the
spandrel data; can also be dom passed directly as a string or
function

Properties
Name Type Attributes Description
dom string | function

the DOM element into which to render
this element. Can be a function that receives an object with
properties, which are the properties of this Ux element, to be used to
generate the DOM

kids Array.<object> | function <optional>

You can specify the kids
property of the spandrel config directly. Alternately, this can be a
function that receives each UxModel in getKids(), and returns
kid.toSpandrel() or a spandrel object of your choosing.

Returns:

an object fit to be passed as a spandrel argument

Type
object

toString() → {string}

Source:
Since:
  • Niagara 4.15
Returns:
Type
string

visit(func) → {Promise.<*>}

Description:
  • Visit this model and all their kid models, calling the passed in function
    along the way.

Source:
Since:
  • Niagara 4.15
Parameters:
Name Type Description
func function

called for every model and its kid models. The model
itself will be passed as the first parameter.
Visiting stops once the function returns false.

Returns:
Type
Promise.<*>

(static) make(obj) → {Promise.<module:bajaux/model/UxModel>}

Description:
  • Creates a new UxModel from a configuration object. If an existing UxModel is given, this
    creates a clone of that model.

Source:
Parameters:
Name Type Description
obj module:bajaux/model/UxModel~UxModelParams
Returns:

a newly configured UxModel instance, or a
clone

Type
Promise.<module:bajaux/model/UxModel>

Type Definitions

UxModelParams

Source:
Properties:
Name Type Attributes Description
name string <optional>

the name of the widget represented by this
UxModel. This will be automatically set on child nodes; a parent-less
root widget may have no name or a name arbitrarily chosen.

type function <optional>

the Type of the widget to create

properties object <optional>

an object literal of the widget's
properties

readonly boolean <optional>

true if the widget should be readonly

formFactor string <optional>

the form factor this widget should be constructed with, if known

kids Array.<(object|module:bajaux/model/UxModel)> <optional>

objects
describing the widget's children

bindings Array.<module:bajaux/model/binding/IBinding> <optional>

bindings
to propagate data updates to the widget (these will be assigned to a
BindingList)

value * <optional>

can be specified if loading a value

metadata object <optional>

(since Niagara 4.15) append any special-purpose metadata to this
UxModel. This data is for framework use and will not be applied to the actual Widget built by
this UxModel.

Type:
  • object