ui/locations/infoj
The infoj module exports a default method to process the infoj entries of a location.
- Source
Requires
- module:/ui/locations/entries
- module:/utils/queryParams
- module:/utils/paramString
- module:/utils/xhr
- module:/utils/merge
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.
Name | Type | Description |
---|---|---|
entry | infoj-entry | An infoj-entry typedef object. |
Name | Type | Attributes | Description |
---|---|---|---|
entry.edit | Object | <optional> | The info-entry must have an edit config. |
entry.default | any | Any JSON value to be assigned as default newValue. | |
entry.location | location | The location to which the entry belongs. | |
location.view | HTMLElement | The location view to which the entry.listview / entry.node will be appended. |
- Source
(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.
Name | Type | Description |
---|---|---|
entry | infoj-entry |
Name | Type | Attributes | Description |
---|---|---|---|
entry.group | string | The group key. | |
entry.groupClassList | string | <optional> | Group element classlist. |
entry.expanded | boolean | <optional> | The 'expanded' class will be concatenated with group element classList. |
entry.listview | HTMLElement | The listview element will be returned from the infoj method and appended to the location.view. |
- Source
(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.
Name | Type | Description |
---|---|---|
entry | infoj-entry |
Name | Type | Description |
---|---|---|
entry.jsonb_field | string | Lookup of field in jsonb value object. |
entry.jsonb_key | string | Lookup of key value in jsonb.field valye object. |
- Source
(inner) entryNode(entry)
The method assigns a
This allows entry methods to render into the entry.node after the infoj iteration has completed.
A classList is assigned to the
Name | Type | Description |
---|---|---|
entry | infoj-entry |
Name | Type | Attributes | Description |
---|---|---|---|
entry.type | string | Concatenate with entry.node classList. | |
entry.class | string | <optional> | Concatenate with entry.node classList. |
entry.inline | boolean | <optional> | Add 'inline' to entry.node classList. |
entry.listview | HTMLElement | The listview element will be returned from the infoj method and appended to the location.view. |
- Source
(inner) entryNullValue(entry)
The entryNullValue method will assigns the nullValue property value as entry.value for non editable entries only.
Name | Type | Description |
---|---|---|
entry | infoj-entry |
Name | Type | Description |
---|---|---|
entry.nullValue | any | Any JSON value; Must not be undefined. |
entry.edit | Object | Must be falsy. |
entry.value | any |
- Source
(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.
Name | Type | Description |
---|---|---|
entry | infoj-entry |
Name | Type | Description |
---|---|---|
entry.objectAssignFromField | string | Lookup for json value entry for object assign. |
entry.objectMergeFromField | string | Lookup for json value entry for object merge. |
entry.json_field | string | Lookup for json value entry. |
entry.json_key | string | Required for json_field assignment. |
- Source
(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.
Name | Type | Description |
---|---|---|
entry | infoj-entry |
Name | Type | Description |
---|---|---|
entry.query | string | The query template. |
entry.queryparams | string | Parameter for the query. |
entry.queryCheck | boolean | Query should be immediate. |
entry.run | boolean | Query should be immediate. |
entry.hasRan | boolean | Flag whether query has been executed. |
entry.host | string | The host for the XHR request. |
- Source
(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.
Name | Type | Description |
---|---|---|
entry | infoj-entry |
Name | Type | Description |
---|---|---|
entry.value | Object | |
entry.skipEntry | Object | Entry will always be skipped. |
entry.skipFalsyValue | Object | Entry with falsy value will be skipped. |
entry.skipUndefinedValue | Object | Entry with undefined value will be skipped. |
entry.skipNullValue | Object | Entry with null value will be skipped. |
- Source
(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.
Name | Type | Description |
---|---|---|
entry | infoj-entry |
Name | Type | Description |
---|---|---|
entry.title | Object | The title value. |
entry.node | HTMLElement | The entry HTMLElement to be appended to the location.view element grid. |
- Source
(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.
Name | Type | Description |
---|---|---|
location | Object | A decorated location object. |
infoj_order | array | Optional array to order and expand the infoj array. |
Name | Type | Description |
---|---|---|
location.layer | Object | A decorated layer object to which the location belongs. |
location.infoj | Array | Array of infoj-entry objects with values. |
location.view | HTMLElement | Location view HTMLElement. |
- Source
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.
Name | Type | Description |
---|---|---|
_entry | string | |
- Source
Either the _entry object itself, a lookup entry from the location.layer.infoj array, or undefined.
- Type:
- infoj-entry