UNPKG

@panoramax/web-viewer

Version:

Panoramax web viewer for geolocated pictures

88 lines (66 loc) 3.82 kB
<a name="Panoramax.components.ui.SemanticsEditor"></a> ## Panoramax.components.ui.SemanticsEditor ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code> **Kind**: static class of <code>Panoramax.components.ui</code> **Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code> **Emits**: [<code>change</code>](#Panoramax.components.ui.SemanticsEditor+event_change) **Element**: pnx-semantics-editor * [.SemanticsEditor](#Panoramax.components.ui.SemanticsEditor) ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code> * [new SemanticsEditor()](#new_Panoramax.components.ui.SemanticsEditor_new) * [.properties](#Panoramax.components.ui.SemanticsEditor+properties) : <code>Object</code> * [.getDiff()](#Panoramax.components.ui.SemanticsEditor+getDiff) ⇒ <code>Array.&lt;object&gt;</code> * [.checkValidity()](#Panoramax.components.ui.SemanticsEditor+checkValidity) ⇒ <code>boolean</code> * ["change"](#Panoramax.components.ui.SemanticsEditor+event_change) <a name="new_Panoramax.components.ui.SemanticsEditor_new"></a> ### new SemanticsEditor() Semantics Editor offer an easy-to-use input for adding or editing semantics tags. It manipulates list of `{key: "mypanokey", value: "myvalue"}` entries through `semantics` attribute. **Example** ```html <!-- Basic example --> <pnx-semantics-editor id="editor" semantics=${mypic.semantics} ._t=${viewer._t} onchange=${e => console.log(e.detail.semantics)} /> <!-- You can access editor and check its validity through native web browser functions --> <script> const editor = document.getElementById("editor"); console.log(editor.checkValidity()); // True if input is valid </script> <!-- You can change specifically style of textarea --> <style> pnx-semantics-editor::part(text) { color: blue; } </style> ``` <a name="Panoramax.components.ui.SemanticsEditor+properties"></a> ### semanticsEditor.properties : <code>Object</code> Component properties. **Kind**: instance property of [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor) **Properties** | Name | Type | Default | Description | | --- | --- | --- | --- | | [semantics] | <code>object</code> | | The `semantics` field of a picture or annotation feature. It is updated when field changes, but reflect the whole list of new tags (not delta needed by API). If you want delta, please use getDiff function. | | [rows] | <code>number</code> | <code>3</code> | The amount of rows shown for textarea | <a name="Panoramax.components.ui.SemanticsEditor+getDiff"></a> ### semanticsEditor.getDiff() ⇒ <code>Array.&lt;object&gt;</code> Get current delta between initial tags and user changes. **Kind**: instance method of [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor) **Returns**: <code>Array.&lt;object&gt;</code> - The list of tag changes (in API format) <a name="Panoramax.components.ui.SemanticsEditor+checkValidity"></a> ### semanticsEditor.checkValidity() ⇒ <code>boolean</code> Check if input is having a valid value. **Kind**: instance method of [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor) **Returns**: <code>boolean</code> - True if it's valid <a name="Panoramax.components.ui.SemanticsEditor+event_change"></a> ### "change" Event for value change. Note that this event is launched only on valid input. **Kind**: event emitted by [<code>SemanticsEditor</code>](#Panoramax.components.ui.SemanticsEditor) **Properties** | Name | Type | Description | | --- | --- | --- | | detail.semantics | <code>Array.&lt;object&gt;</code> | The new tags list (in API semantics property format) | | detail.delta | <code>Array.&lt;object&gt;</code> | The delta between old and current tags (expected by API) |