fix checkboxes

pull/105/head
Alex Turchyn 2 years ago
parent f94ef3afdc
commit a2cf8fc5b5

@ -25,10 +25,10 @@
class="absolute -top-7 rounded bg-base-content text-base-100 px-2 text-sm whitespace-nowrap"
>
{{ field.name || fieldNames[field.type] }}
<template v-if="field.type === 'checkbox'">
<template v-if="field.type === 'checkbox' && !field.name">
{{ fieldIndex + 1 }}
</template>
<template v-else-if="!field.required">
<template v-else-if="!field.required && field.type !== 'checkbox'">
(optional)
</template>
</div>

@ -213,7 +213,7 @@
@click="[$refs.areas.scrollIntoField(field), values[field.uuid] = !values[field.uuid]]"
>
<span class="text-xl">
{{ currentField.name || currentField.type + ' ' + (index + 1) }}
{{ field.name || field.type + ' ' + (index + 1) }}
</span>
</label>
</div>

@ -65,7 +65,7 @@
@blur="onNameBlur"
>{{ field.name || defaultName }}</span>
<div
v-if="isNameFocus"
v-if="isNameFocus && field.type !== 'checkbox'"
class="flex items-center ml-1.5"
>
<input

@ -314,7 +314,7 @@ export default {
const field = {
name: '',
uuid: v4(),
required: true,
required: type !== 'checkbox',
type,
submitter_uuid: this.selectedSubmitter.uuid,
areas: [area]
@ -333,7 +333,7 @@ export default {
type: this.dragFieldType,
uuid: v4(),
submitter_uuid: this.selectedSubmitter.uuid,
required: true
required: this.dragFieldType !== 'checkbox'
}
if (['select', 'multiple', 'radio'].includes(this.dragFieldType)) {

@ -31,19 +31,21 @@
v-if="isNameFocus"
class="flex items-center relative"
>
<input
:id="`required-checkbox-${field.uuid}`"
v-model="field.required"
type="checkbox"
class="checkbox checkbox-xs no-animation rounded"
@mousedown.prevent
>
<label
:for="`required-checkbox-${field.uuid}`"
class="label text-xs"
@click.prevent="field.required = !field.required"
@mousedown.prevent
>Required</label>
<template v-if="field.type !== 'checkbox'">
<input
:id="`required-checkbox-${field.uuid}`"
v-model="field.required"
type="checkbox"
class="checkbox checkbox-xs no-animation rounded"
@mousedown.prevent
>
<label
:for="`required-checkbox-${field.uuid}`"
class="label text-xs"
@click.prevent="field.required = !field.required"
@mousedown.prevent
>Required</label>
</template>
</div>
<div
v-else

@ -171,7 +171,7 @@ export default {
const field = {
name: '',
uuid: v4(),
required: true,
required: type !== 'checkbox',
submitter_uuid: this.selectedSubmitter.uuid,
type
}

Loading…
Cancel
Save