diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index 624f4185a..3300e4fe6 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -42,7 +42,7 @@ v-for="answer in answers" :key="answer.Name ? answer.Name : answer" > - + @@ -33,15 +54,15 @@ export default { sampleAnswers: [ { Text: "Part 1", - Value: "PART1", + Name: "PART1", }, { Text: "Part 2", - Value: "PART2", + Name: "PART2", }, { Text: "Part 3", - Value: "PART3", + Name: "PART3", }, ], selectedMultiselectValues: [], diff --git a/src/mixins/button-mixin.js b/src/mixins/button-mixin.js index 2281b3f2c..22ed53d5b 100644 --- a/src/mixins/button-mixin.js +++ b/src/mixins/button-mixin.js @@ -1,4 +1,5 @@ export default { + emits: ["change"], model: { prop: "modelValue", event: "change", @@ -32,22 +33,36 @@ export default { type: String, required: true, }, + validationRules: { + type: String, + required: true, + }, + classes: [String, Array, Object], }, - data() {}, methods: { handleSelectionChange(event) { + console.log(event); + console.log(this.value); + console.log(this.modelValue); let isChecked = event.target.checked; + console.log("BM value: ", this.value); + let valueToEmit; if (this.isMultiSelect && this.modelValue instanceof Array) { let newValue = [...this.modelValue]; - if (isChecked && !newValue.includes(this.value)) { + if (isChecked && !this.modelValue.includes(this.value)) { newValue.push(this.value); } else { newValue.splice(newValue.indexOf(this.value), 1); } - this.$emit("change", newValue); + + valueToEmit = newValue; } else { - this.$emit("change", isChecked); + valueToEmit = isChecked; } + + console.log("ButtonWrapper is emitting: ", valueToEmit); + this.$emit("change", valueToEmit); + // this.$emit("change", event); }, }, computed: { @@ -57,5 +72,11 @@ export default { } return this.modelValue === this.value; }, + inputType() { + return this.isMultiSelect ? "checkbox" : "radio"; + }, + buttonId() { + return JSON.stringify(this.value); + }, }, }; diff --git a/src/ux-components/list-button/list-button.vue b/src/ux-components/list-button/list-button.vue index e51d5cc77..e91c2380c 100644 --- a/src/ux-components/list-button/list-button.vue +++ b/src/ux-components/list-button/list-button.vue @@ -1,14 +1,8 @@