From 02cc18a93f421bc86dade3deeaf8e4f63b5b1df4 Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Tue, 2 Apr 2019 15:38:46 -0400 Subject: [PATCH] Add emiter to all input fields --- js/components/checkbox_input.js | 1 + js/components/date_selector.js | 6 +++++- js/components/multi_checkbox_input.js | 1 + js/components/options_input.js | 1 + js/components/text_input.js | 1 + js/mixins/form.js | 4 +++- 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/js/components/checkbox_input.js b/js/components/checkbox_input.js index bfea50ad..d4dc3397 100644 --- a/js/components/checkbox_input.js +++ b/js/components/checkbox_input.js @@ -10,6 +10,7 @@ export default { this.$root.$emit('field-change', { value: e.target.checked, name: this.name, + parent_uid: this.$parent._uid, }) }, }, diff --git a/js/components/date_selector.js b/js/components/date_selector.js index be6a8c89..d3d6ff56 100644 --- a/js/components/date_selector.js +++ b/js/components/date_selector.js @@ -135,7 +135,11 @@ export default { methods: { _emitChange: function(name, value, valid) { - this.$root.$emit('field-change', { value, valid, name }) + this.$root.$emit('field-change', { + value, + name, + parent_uid: this.$parent && this.$parent._uid, + }) }, }, diff --git a/js/components/multi_checkbox_input.js b/js/components/multi_checkbox_input.js index cf008326..2bf03e07 100644 --- a/js/components/multi_checkbox_input.js +++ b/js/components/multi_checkbox_input.js @@ -43,6 +43,7 @@ export default { this.$root.$emit('field-change', { value: e.target.value, name: this.name, + parent_uid: this.$parent._uid, }) this.showError = false this.showValid = true diff --git a/js/components/options_input.js b/js/components/options_input.js index 0a291b02..6f60d529 100644 --- a/js/components/options_input.js +++ b/js/components/options_input.js @@ -24,6 +24,7 @@ export default { this.$root.$emit('field-change', { value: e.target.value, name: this.name, + parent_uid: this.$parent._uid, }) this.showError = false this.showValid = true diff --git a/js/components/text_input.js b/js/components/text_input.js index cb838025..93609841 100644 --- a/js/components/text_input.js +++ b/js/components/text_input.js @@ -128,6 +128,7 @@ export default { value: this._rawValue(value), valid, name: this.name, + parent_uid: this.$parent._uid, }) }, diff --git a/js/mixins/form.js b/js/mixins/form.js index 2bdf9fea..0839a1b9 100644 --- a/js/mixins/form.js +++ b/js/mixins/form.js @@ -10,7 +10,9 @@ export default { const { value, name } = event if (typeof this[name] !== undefined) { this[name] = value - this.disabled = false + if (event['parent_uid'] === this._uid) { + this.disabled = false + } } }, },