improve radio checkboxes form
This commit is contained in:
@@ -81,7 +81,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="field.type === 'checkbox'"
|
v-else-if="field.type === 'checkbox'"
|
||||||
class="w-full p-[0.2vw] flex items-center justify-center"
|
class="w-full p-[1px] flex items-center justify-center"
|
||||||
|
@click="$event.target.querySelector('input')?.click()"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
v-if="submittable"
|
v-if="submittable"
|
||||||
@@ -100,14 +101,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="field.type === 'radio' && area.option_uuid"
|
v-else-if="field.type === 'radio' && area.option_uuid"
|
||||||
class="w-full p-[0.2vw] flex items-center justify-center"
|
class="w-full p-[1px] flex items-center justify-center"
|
||||||
|
@click="$event.target.querySelector('input')?.click()"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
v-if="submittable"
|
v-if="submittable"
|
||||||
type="radio"
|
type="radio"
|
||||||
:value="false"
|
:value="false"
|
||||||
class="aspect-square base-radio"
|
class="aspect-square checked:checkbox checked:checkbox-xs"
|
||||||
:class="{ '!w-auto !h-full': area.w > area.h, '!w-full !h-auto': area.w <= area.h }"
|
:class="{ 'base-radio': !modelValue || modelValue !== optionValue(option), '!w-auto !h-full': area.w > area.h, '!w-full !h-auto': area.w <= area.h }"
|
||||||
:checked="!!modelValue && modelValue === optionValue(option)"
|
:checked="!!modelValue && modelValue === optionValue(option)"
|
||||||
@click="$emit('update:model-value', optionValue(option))"
|
@click="$emit('update:model-value', optionValue(option))"
|
||||||
>
|
>
|
||||||
@@ -119,7 +121,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="field.type === 'multiple' && area.option_uuid"
|
v-else-if="field.type === 'multiple' && area.option_uuid"
|
||||||
class="w-full p-[0.2vw] flex items-center justify-center"
|
class="w-full p-[1px] flex items-center justify-center"
|
||||||
|
@click="$event.target.querySelector('input')?.click()"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
v-if="submittable"
|
v-if="submittable"
|
||||||
|
|||||||
@@ -124,7 +124,20 @@
|
|||||||
<template v-if="!currentField.required">({{ t('optional') }})</template>
|
<template v-if="!currentField.required">({{ t('optional') }})</template>
|
||||||
</label>
|
</label>
|
||||||
<div class="flex w-full">
|
<div class="flex w-full">
|
||||||
<div class="space-y-3.5 mx-auto">
|
<div
|
||||||
|
v-if="currentField.options.length > 5"
|
||||||
|
class="text-xl text-center w-full"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
@click="scrollIntoField(currentField)"
|
||||||
|
>
|
||||||
|
{{ t('complete_hightlighted_checkboxes_and_click') }} <span class="font-semibold">{{ stepFields.length === currentStep + 1 ? t('submit') : t('next') }}</span>.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="space-y-3.5 mx-auto"
|
||||||
|
:class="{ hidden: currentField.options.length > 5 }"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
v-for="(option, index) in currentField.options"
|
v-for="(option, index) in currentField.options"
|
||||||
:key="option.uuid"
|
:key="option.uuid"
|
||||||
@@ -154,6 +167,7 @@
|
|||||||
v-else-if="currentField.type === 'multiple'"
|
v-else-if="currentField.type === 'multiple'"
|
||||||
:key="currentField.uuid"
|
:key="currentField.uuid"
|
||||||
v-model="values[currentField.uuid]"
|
v-model="values[currentField.uuid]"
|
||||||
|
:is-last-step="stepFields.length === currentStep + 1"
|
||||||
:field="currentField"
|
:field="currentField"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
@@ -401,6 +415,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
baseUrl: this.baseUrl,
|
baseUrl: this.baseUrl,
|
||||||
scrollIntoArea: this.scrollIntoArea,
|
scrollIntoArea: this.scrollIntoArea,
|
||||||
|
scrollIntoField: this.scrollIntoField,
|
||||||
t: this.t
|
t: this.t
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,7 +13,18 @@
|
|||||||
:value="''"
|
:value="''"
|
||||||
class="hidden"
|
class="hidden"
|
||||||
>
|
>
|
||||||
<div class="space-y-3.5 mx-auto">
|
<div
|
||||||
|
v-if="field.options.length > 5"
|
||||||
|
class="text-xl text-center w-full"
|
||||||
|
>
|
||||||
|
<span @click="scrollIntoField(field)">
|
||||||
|
{{ t('complete_hightlighted_checkboxes_and_click') }} <span class="font-semibold">{{ isLastStep ? t('submit') : t('next') }}</span>.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="space-y-3.5 mx-auto"
|
||||||
|
:class="{ hidden: field.options.length > 5 }"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
v-for="(option, index) in field.options"
|
v-for="(option, index) in field.options"
|
||||||
:key="option.uuid"
|
:key="option.uuid"
|
||||||
@@ -44,12 +55,17 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'MultiSelectStep',
|
name: 'MultiSelectStep',
|
||||||
inject: ['t'],
|
inject: ['t', 'scrollIntoField'],
|
||||||
props: {
|
props: {
|
||||||
field: {
|
field: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
isLastStep: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: false,
|
required: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user