Skip to content

Commit 3f6df70

Browse files
committed
Fix code style and indenting
1 parent a1c4a21 commit 3f6df70

File tree

1 file changed

+63
-61
lines changed

1 file changed

+63
-61
lines changed

src/components/QuestionTypes/MatrixType.vue

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -86,82 +86,84 @@
8686
</template>
8787

8888
<script>
89-
/*
90-
Copyright (c) 2020 - present, DITDOT Ltd. - MIT Licence
91-
https://github.com/ditdot-dev/vue-flow-form
92-
https://www.ditdot.hr/en
93-
*/
89+
/*
90+
Copyright (c) 2020 - present, DITDOT Ltd. - MIT Licence
91+
https://github.com/ditdot-dev/vue-flow-form
92+
https://www.ditdot.hr/en
93+
*/
9494
95-
import BaseType from './BaseType.vue'
96-
import { QuestionType } from '../../models/QuestionModel'
95+
import BaseType from './BaseType.vue'
96+
import { QuestionType } from '../../models/QuestionModel'
9797
98-
export default {
99-
extends: BaseType,
100-
name: QuestionType.Matrix,
98+
export default {
99+
extends: BaseType,
100+
101+
name: QuestionType.Matrix,
101102
102-
data() {
103-
return {
104-
selected: {},
105-
inputList: []
106-
}
107-
},
103+
data() {
104+
return {
105+
selected: {},
106+
inputList: []
107+
}
108+
},
108109
109-
beforeMount() {
110-
// Pre-fill the form if there is a predefined answer
111-
if (this.question.multiple) {
112-
for (let row of this.question.rows) {
113-
this.selected[row.id] = this.question.answer && this.question.answer[row.id] ? [...this.question.answer[row.id]] : []
110+
beforeMount() {
111+
// Pre-fill the form if there is a predefined answer
112+
if (this.question.multiple) {
113+
for (let row of this.question.rows) {
114+
this.selected[row.id] = this.question.answer && this.question.answer[row.id] ? [...this.question.answer[row.id]] : []
115+
}
116+
} else if (this.question.answer) {
117+
this.selected = {...this.question.answer}
114118
}
115-
} else if (this.question.answer) {
116-
this.selected = {...this.question.answer}
117-
}
118-
},
119+
},
119120
120-
beforeUpdate() {
121-
this.inputList = []
122-
},
121+
beforeUpdate() {
122+
this.inputList = []
123+
},
123124
124-
methods: {
125-
onChange($event) {
126-
this.dirty = true
127-
this.dataValue = this.selected
128-
this.onKeyDown()
129-
this.setAnswer(this.dataValue)
130-
},
125+
methods: {
126+
onChange($event) {
127+
this.dirty = true
128+
this.dataValue = this.selected
129+
this.onKeyDown()
130+
this.setAnswer(this.dataValue)
131+
},
131132
132-
validate() {
133-
if (!this.question.required) {
134-
return true
135-
}
133+
validate() {
134+
if (!this.question.required) {
135+
return true
136+
}
136137
137-
const checked = inputs => inputs.some(input => input.checked)
138+
const checked = inputs => inputs.some(input => input.checked)
138139
139-
if (!Object.values(this.inputGroups).every(value => checked(value))) {
140-
return false
141-
}
140+
if (!Object.values(this.inputGroups).every(value => checked(value))) {
141+
return false
142+
}
143+
144+
return true
145+
},
142146
143-
return true
147+
getElement() {
148+
return this.inputList[0]
149+
},
144150
},
145151
146-
getElement() {
147-
return this.inputList[0]
148-
},
149-
},
152+
computed: {
153+
inputGroups() {
154+
const inputGroups = {}
150155
151-
computed: {
152-
inputGroups() {
153-
let inputGroups = {}
154-
// Setting input list for validation
155-
for (let row of this.question.rows) {
156-
inputGroups[row.id] = []
157-
}
158-
159-
this.inputList.forEach(input => {
160-
inputGroups[input.dataset.id].push(input)
161-
})
156+
// Setting input list for validation
157+
for (let row of this.question.rows) {
158+
inputGroups[row.id] = []
159+
}
160+
161+
this.inputList.forEach(input => {
162+
inputGroups[input.dataset.id].push(input)
163+
})
162164
163-
return inputGroups
165+
return inputGroups
166+
}
164167
}
165168
}
166-
}
167169
</script>

0 commit comments

Comments
 (0)