Mixin: CompositeMixin

CompositeMixin

CompositeMixin offer a common interface to manipulate recursive data.

Methods


<static> _load(resource)

template method Groups Composite (recursive) logic.

Parameters:
Name Type Description
resource Object

(optional) A Resource object

Returns:

this

Type
apy.components.CompositeMixin

<static> cleanedData()

Common method which is charge to clean the component inner data. All data-related inner components are collected into an Object instance.

Returns:

collected data-related inner components

Type
Object

<static> createField(type, name, schema, value, endpoint, append)

Common Method for composite container components (Resource, List)

Parameters:
Name Type Description
type string

The Component type

name string

The Component name

schema Object

The Component (data-)schema

value *

(optional) The component value

endpoint string

The Application global endpoint

append boolean

If true, the created component instance is appended to this

Returns:

A component instance

Type
*

<static> hasUpdated()

Common method which tells whether the component state is UPDATED or not In other words, whether one of its inner component is UPDATED or not

Returns:

true if UPDATED state

Type
boolean

<static> isEmpty(obj)

Allow to evaluate whether or not an Object instance is empty. Trick here is to use JS native mechanism to iterate over the object. If it cannot iterate, the Object is empty, otherwise not.

Parameters:
Name Type Description
obj Object

Object instance to be evaluated

Returns:

Whether the Object is empty or not

Type
boolean

<static> load(resource)

Exposed (public) template method

Groups Composite (recursive) logic.

Parameters:
Name Type Description
resource Object

(optional) A Resource object

Returns:

this

Type
apy.components.CompositeMixin

<static> reset()

Common Method for components reset feature Allow the component to restore its initial state (based on its $memo attribute)

Returns:

this

Type
apy.components.CompositeMixin

<static> selfCommit()

Common method to definitely set the updated components' values, after a successful Request to the backend has been acknowledged. $memo attribute is overridden by the current $value

Returns:

this

Type
apy.components.CompositeMixin

<static> selfUpdate(update, commit)

Common Method to allow one component to update itself.

Parameters:
Name Type Description
update Object

The update payload

commit boolean

If true, selfCommit method is invoked

Returns:

this

Type
apy.components.CompositeMixin

<static> toString()

Composite Component String representation

Returns:

Composite Component string representation

Type
string