/ui/locations/view
The module exports a default method to create a location view to be added to a locations listview.
Dictionary entries:
- location_zoom
- location_save
- location_delete
- location_remove
- location_close_without_save
- location_save_changes
- Source
Requires
Methods
(async, inner) location_remove()
The method checks whether a location.infoj has some unsaved changes. A confirm dialog will be shown to confirm the location.remove() without saving changes.
- Source
(async, inner) onClickEditToggle(e)
The method awaits the location.confirmUpdate() method and will toggle the edit button if the response is not undefined.
The location edits are either removed or restored depending on the toggle of the button.
The location view must be rendered after the infoj entry edits are modified.
Name | Type | Description |
---|---|---|
e | Event | The location.editToggle onclick event. |
- Source
(inner) renderLocationView()
The renderLocationView method will remove all location.viewEntries and the .disabled
class from the location.view before recreating the location.viewEntries and appending these to the location.view element.
- Source
(inner) toggleLocationViewEdits(location) → {Boolean}
The toggleLocationViewEdits checks whether the location.layer has the toggleLocationViewEdits flag.
At least one entry of the location must be editable.
New locations must always be editable.
The location.editToggle button element for the location view header is created.
Name | Type | Description |
---|---|---|
location | location | Mapp Location typedef |
- Source
Returns true if toggleLocationViewEdits should be possible.
- Type:
- Boolean
(inner) valChange(e)
The valChange method is assigned to the valChange custom event listener of the location.view element.
An infoj-entry must be provided as detail when the valChange custom event is dispatched.
The valChange method will check whether an entry has a newValue which is different from the current value and assign a class to show the change on the input element.
The valChange event controls the display of the location.update button (.btn-save).
The update button will not be displayed if no entry has a newValue or if some entry is invalid.
Name | Type | Description |
---|---|---|
e | Event | A custom event from the location.view eventlistener. |
Name | Type | Description |
---|---|---|
e.detail | infoj-entry | The detail passed to the valChange event must be an info-entry typedef. |
- Source
(inner) view(location) → {HTMLElement}
The view method creates a location view element group.
Name | Type | Description |
---|---|---|
location | location | A mapp location object. |
Name | Type | Attributes | Description |
---|---|---|---|
location.record | Object | A location is stored in a record object in the mapview.locations object. | |
location.removeCallbacks | Array | <optional> | An array of methods which will be executed when a location is removed. |
- Source
The location.view element.
- Type:
- HTMLElement