group form checkboxes into single step

This commit is contained in:
Alex Turchyn
2023-06-16 00:04:05 +03:00
parent 7978b3ebe8
commit bfbf3d7ddb
11 changed files with 245 additions and 141 deletions
+5 -3
View File
@@ -182,7 +182,9 @@ export default {
defaultName () {
const typeIndex = this.template.fields.filter((f) => f.type === this.field.type).indexOf(this.field)
return `${this.$t(this.field.type)} Field ${typeIndex + 1}`
const suffix = { multiple: 'Select', radio: 'Group' }[this.field.type] || 'Field'
return `${this.$t(this.field.type)} ${suffix} ${typeIndex + 1}`
},
areas () {
return this.field.areas || []
@@ -203,11 +205,11 @@ export default {
document.activeElement.blur()
},
maybeUpdateOptions () {
if (!['radio', 'checkbox', 'select'].includes(this.field.type)) {
if (!['radio', 'multiple', 'select'].includes(this.field.type)) {
delete this.field.options
}
if (this.field.type === 'select') {
if (['radio', 'multiple', 'select'].includes(this.field.type)) {
this.field.options ||= ['']
}
},