You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/10/05 19:47:29 UTC
[airavata-django-portal] 18/24: AIRAVATA-3477 Wrapped
TextareaInputEditor as web component
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 139a596dbd3ea1015471ff7fedb169656eb85781
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Sep 15 12:00:33 2021 -0400
AIRAVATA-3477 Wrapped TextareaInputEditor as web component
---
.../input-editors/TextareaInputEditor.vue | 14 ++++---
.../input-editors/TextareaInputEditor.vue | 45 ++++++++++++++++++++++
2 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/TextareaInputEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/TextareaInputEditor.vue
index dbb64a7..8056840 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/TextareaInputEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/TextareaInputEditor.vue
@@ -1,11 +1,14 @@
<template>
+ <!-- stop propagation of native input events so that they don't conflict with
+ native input events generated by web component wrappers -->
<b-form-textarea
:id="id"
v-model="data"
- :rows="rows"
+ :rows="editorRows"
:disabled="readOnly"
:state="componentValidState"
@input="valueChanged"
+ @input.native.stop
/>
</template>
@@ -21,12 +24,13 @@ export default {
value: {
type: String,
},
+ rows: {
+ type: Number,
+ },
},
computed: {
- rows: function () {
- return "rows" in this.editorConfig
- ? this.editorConfig["rows"]
- : DEFAULT_ROWS;
+ editorRows: function () {
+ return this.rows || this.editorConfig.rows || DEFAULT_ROWS;
},
},
};
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/input-editors/TextareaInputEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/input-editors/TextareaInputEditor.vue
new file mode 100644
index 0000000..6cf96e4
--- /dev/null
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/web-components/input-editors/TextareaInputEditor.vue
@@ -0,0 +1,45 @@
+<template>
+ <!-- NOTE: experimentInput is late bound, don't create component until it is available -->
+ <!-- Important that input editor is wrapped in div. Input editor stops
+ propagation on native input events, but we need for this component's input
+ events to propagate. So the input editor should not be the root component. -->
+ <div>
+ <textarea-input-editor
+ v-if="experimentInput"
+ :id="id"
+ :value="data"
+ :experiment-input="experimentInput"
+ :read-only="readOnly"
+ :rows="rows"
+ @input="valueChanged"
+ />
+ </div>
+</template>
+
+<script>
+import TextareaInputEditor from "../../components/experiment/input-editors/TextareaInputEditor.vue";
+import WebComponentInputEditorMixin from "./WebComponentInputEditorMixin.js";
+
+export default {
+ mixins: [WebComponentInputEditorMixin],
+ props: {
+ // Explicit copy props from mixin, workaround for bug, see
+ // https://github.com/vuejs/vue-web-component-wrapper/issues/30#issuecomment-427350734
+ // for more details
+ ...WebComponentInputEditorMixin.props,
+ rows: {
+ type: Number,
+ },
+ },
+ components: {
+ TextareaInputEditor,
+ },
+};
+</script>
+
+<style lang="scss">
+@import "../styles";
+:host {
+ display: block;
+}
+</style>