ui/locations/infoj

The infoj module exports a default method to process the infoj entries of a location.

Requires

Methods

(inner) entryDefault(entry)

The entryDefault method will assign the entry.default property value as entry.newValue on editable entries.

The valChange event of the entry.location.view HTMLElement will be called to indicate that the default value must be updated on the location.

Parameters:
NameTypeDescription
entryinfoj-entry

An infoj-entry typedef object.

Properties
NameTypeAttributesDescription
entry.editObject<optional>

The info-entry must have an edit config.

entry.defaultany

Any JSON value to be assigned as default newValue.

entry.locationlocation

The location to which the entry belongs.

location.viewHTMLElement

The location view to which the entry.listview / entry.node will be appended.

(inner) entryGroup(entry)

The entryGroup(entry) method will create a new group for each unique entry.group string.

Entry elements in the same group will be added to a group element drawer added to the entry[location].listview.

The group layout will be expanded by adding the expanded class to the group elements classList if the entry.expanded property is true.

Parameters:
NameTypeDescription
entryinfoj-entry
Properties
NameTypeAttributesDescription
entry.groupstring

The group key.

entry.groupClassListstring<optional>

Group element classlist.

entry.expandedboolean<optional>

The 'expanded' class will be concatenated with group element classList.

entry.listviewHTMLElement

The listview element will be returned from the infoj method and appended to the location.view.

(inner) entryJSONB(entry)

The entryJSONB(entry) method assign an entry.value from a jsonb object contained in the entry.value assigned by the location.get method.

The entry must have an JSON object value which is not null.

The entry.jsonb_field and entry.jsonb_key must be configured and found in the entry.value object.

Parameters:
NameTypeDescription
entryinfoj-entry
Properties
NameTypeDescription
entry.jsonb_fieldstring

Lookup of field in jsonb value object.

entry.jsonb_keystring

Lookup of key value in jsonb.field valye object.

(inner) entryNode(entry)

The method assigns a

element with no children as entry.node and appends the HTMLElement to the entry.listview.

This allows entry methods to render into the entry.node after the infoj iteration has completed.

A classList is assigned to the

element to represnt custom classes and layout (eg. inline).

Parameters:
NameTypeDescription
entryinfoj-entry
Properties
NameTypeAttributesDescription
entry.typestring

Concatenate with entry.node classList.

entry.classstring<optional>

Concatenate with entry.node classList.

entry.inlineboolean<optional>

Add 'inline' to entry.node classList.

entry.listviewHTMLElement

The listview element will be returned from the infoj method and appended to the location.view.

(inner) entryNullValue(entry)

The entryNullValue method will assigns the nullValue property value as entry.value for non editable entries only.

Parameters:
NameTypeDescription
entryinfoj-entry
Properties
NameTypeDescription
entry.nullValueany

Any JSON value; Must not be undefined.

entry.editObject

Must be falsy.

entry.valueany

(inner) entryObject(entry)

The entryObject(entry) method can be used to lookup another entry and assign or merge the found entry object value.

A entry.json_key in combination with entry.json_field can be configured to assign a specific JSON key value to the entry.

Parameters:
NameTypeDescription
entryinfoj-entry
Properties
NameTypeDescription
entry.objectAssignFromFieldstring

Lookup for json value entry for object assign.

entry.objectMergeFromFieldstring

Lookup for json value entry for object merge.

entry.json_fieldstring

Lookup for json value entry.

entry.json_keystring

Required for json_field assignment.

(inner) entryQuery(entry)

The entryQuery() method checks whether a query should be executed to populate the entry.value.

mapp.utils.paramString() will be used to create a parameter string for the query request from the entry.queryparams.

A query flagged with entry.run or entry.queryCheck will be executed immediately.

The infoj iteration will continue if the entryQuery method returns true.

The entry can be skipped depending on the response value.

The entry method will be called with the response value once the xhr utility promise has been resolved.

Parameters:
NameTypeDescription
entryinfoj-entry
Properties
NameTypeDescription
entry.querystring

The query template.

entry.queryparamsstring

Parameter for the query.

entry.queryCheckboolean

Query should be immediate.

entry.runboolean

Query should be immediate.

entry.hasRanboolean

Flag whether query has been executed.

entry.hoststring

The host for the XHR request.

(inner) entrySkip(entry)

The entrySkip(entry) methods checks whether a entry should be skipped from being processed in the iteration of infoj entries.

Skipping may be conditional on the entry.value.

Entries with falsy, null, or undefined values may be skipped if the entry is not editable.

A layer.infoj_skip[] array can be configured to define which infoj entries should be skipped.

Parameters:
NameTypeDescription
entryinfoj-entry
Properties
NameTypeDescription
entry.valueObject
entry.skipEntryObject

Entry will always be skipped.

entry.skipFalsyValueObject

Entry with falsy value will be skipped.

entry.skipUndefinedValueObject

Entry with undefined value will be skipped.

entry.skipNullValueObject

Entry with null value will be skipped.

(inner) entryTitle(entry)

The entryTitle methods will append a title element returned from mapp.ui.locations.entries.title(entry) to the entry.node if the entry.title is not falsy.

Parameters:
NameTypeDescription
entryinfoj-entry
Properties
NameTypeDescription
entry.titleObject

The title value.

entry.nodeHTMLElement

The entry HTMLElement to be appended to the location.view element grid.

(inner) infoj(location, infoj_order) → {HTMLElement}

The infoj methods iterates through the location's infoj [entries] array.

mapp.ui.locations.entries{} methods matching the entry type keyvalue are called with the entry as argument.

The HTMLelements returned from a location entry method are appended to entry.listview which is appended to the location.view.

The infoj_order array argument provides an option to extend the location infoj_array with entries not stored in the location.layer.infoj array.

The infoj_order array may contain string entries which allow to order entries before processing. Ordered infoj_order string values are used to map infoj entries with matching key, field, or query values. Infoj entries which are not matched by infoj_order string values will be excluded from being processed for the creation of the location view.

Parameters:
NameTypeDescription
locationObject

A decorated location object.

infoj_orderarray

Optional array to order and expand the infoj array.

Properties
NameTypeDescription
location.layerObject

A decorated layer object to which the location belongs.

location.infojArray

Array of infoj-entry objects with values.

location.viewHTMLElement

Location view HTMLElement.

Returns:

listview grid element with entry elements.

Type: 
HTMLElement

(inner) infoj_orderMap(_entry) → {infoj-entry}

The infoj_order argument allows to order and filter the location.layer.infoj array.

The map function attempts to find and return an infoj-entry whose key, field, or query property values match the _entry string.

If typeof object the _entry itself will be returned. This allows for additional infoj-entry objects to be spliced into the infoj array.

Parameters:
NameTypeDescription
_entrystring | object
Returns:

Either the _entry object itself, a lookup entry from the location.layer.infoj array, or undefined.

Type: 
infoj-entry