add show field names prop

pull/217/head
Pete Matsyburka 2 years ago
parent 5d598e8268
commit e84be523c6

@ -4,7 +4,7 @@
<label <label
:for="field.uuid" :for="field.uuid"
class="label text-2xl" class="label text-2xl"
>{{ field.name || t('date') }} >{{ field.name && showFieldNames ? field.name : t('date') }}
<template v-if="!field.required">({{ t('optional') }})</template> <template v-if="!field.required">({{ t('optional') }})</template>
</label> </label>
<button <button
@ -46,6 +46,11 @@ export default {
type: Object, type: Object,
required: true required: true
}, },
showFieldNames: {
type: Boolean,
required: false,
default: true
},
modelValue: { modelValue: {
type: String, type: String,
required: false, required: false,

@ -4,7 +4,7 @@
:steps="stepFields" :steps="stepFields"
:values="values" :values="values"
:attachments-index="attachmentsIndex" :attachments-index="attachmentsIndex"
:with-label="!isAnonymousChecboxes" :with-label="!isAnonymousChecboxes && showFieldNames"
:current-step="currentStepFields" :current-step="currentStepFields"
@focus-step="[saveStep(), goToStep($event, false, true), currentField.type !== 'checkbox' ? isFormVisible = true : '']" @focus-step="[saveStep(), goToStep($event, false, true), currentField.type !== 'checkbox' ? isFormVisible = true : '']"
/> />
@ -64,6 +64,7 @@
<TextStep <TextStep
:key="currentField.uuid" :key="currentField.uuid"
v-model="values[currentField.uuid]" v-model="values[currentField.uuid]"
:show-field-names="showFieldNames"
:field="currentField" :field="currentField"
@focus="scrollIntoField(currentField)" @focus="scrollIntoField(currentField)"
/> />
@ -72,12 +73,13 @@
v-else-if="currentField.type === 'date'" v-else-if="currentField.type === 'date'"
:key="currentField.uuid" :key="currentField.uuid"
v-model="values[currentField.uuid]" v-model="values[currentField.uuid]"
:show-field-names="showFieldNames"
:field="currentField" :field="currentField"
@focus="scrollIntoField(currentField)" @focus="scrollIntoField(currentField)"
/> />
<div v-else-if="currentField.type === 'select'"> <div v-else-if="currentField.type === 'select'">
<label <label
v-if="currentField.name" v-if="showFieldNames && currentField.name"
:for="currentField.uuid" :for="currentField.uuid"
dir="auto" dir="auto"
class="label text-2xl mb-2" class="label text-2xl mb-2"
@ -116,17 +118,17 @@
</div> </div>
<div v-else-if="currentField.type === 'radio'"> <div v-else-if="currentField.type === 'radio'">
<label <label
v-if="currentField.name" v-if="showFieldNames && currentField.name"
:for="currentField.uuid" :for="currentField.uuid"
dir="auto" dir="auto"
class="label text-2xl mb-2" class="label text-2xl mb-2"
>{{ currentField.name }} >{{ currentField.name }}
<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 max-h-44 overflow-y-auto">
<div <div
v-if="currentField.options.length > 5" v-if="!showFieldNames || (currentField.options.every((e) => !e.value) && currentField.options.length > 4)"
class="text-xl text-center w-full" class="text-xl px-1"
> >
<span <span
@click="scrollIntoField(currentField)" @click="scrollIntoField(currentField)"
@ -136,7 +138,7 @@
</div> </div>
<div <div
class="space-y-3.5 mx-auto" class="space-y-3.5 mx-auto"
:class="{ hidden: currentField.options.length > 5 }" :class="{ hidden: !showFieldNames || (currentField.options.every((e) => !e.value) && currentField.options.length > 4) }"
> >
<div <div
v-for="(option, index) in currentField.options" v-for="(option, index) in currentField.options"
@ -167,6 +169,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]"
:show-field-names="showFieldNames"
:is-last-step="stepFields.length === currentStep + 1" :is-last-step="stepFields.length === currentStep + 1"
:field="currentField" :field="currentField"
/> />
@ -182,7 +185,7 @@
<div <div
class="space-y-3.5 mx-auto" class="space-y-3.5 mx-auto"
> >
<template v-if="isAnonymousChecboxes"> <template v-if="isAnonymousChecboxes || !showFieldNames">
<span class="text-xl"> <span class="text-xl">
{{ t('complete_hightlighted_checkboxes_and_click') }} <span class="font-semibold">{{ stepFields.length === currentStep + 1 ? t('submit') : t('next') }}</span>. {{ t('complete_hightlighted_checkboxes_and_click') }} <span class="font-semibold">{{ stepFields.length === currentStep + 1 ? t('submit') : t('next') }}</span>.
</span> </span>
@ -242,6 +245,7 @@
:is-direct-upload="isDirectUpload" :is-direct-upload="isDirectUpload"
:attachments-index="attachmentsIndex" :attachments-index="attachmentsIndex"
:submitter-slug="submitterSlug" :submitter-slug="submitterSlug"
:show-field-names="showFieldNames"
@attached="[attachments.push($event), scrollIntoField(currentField)]" @attached="[attachments.push($event), scrollIntoField(currentField)]"
/> />
<SignatureStep <SignatureStep
@ -255,6 +259,7 @@
:with-typed-signature="withTypedSignature" :with-typed-signature="withTypedSignature"
:attachments-index="attachmentsIndex" :attachments-index="attachmentsIndex"
:submitter-slug="submitterSlug" :submitter-slug="submitterSlug"
:show-field-names="showFieldNames"
@attached="attachments.push($event)" @attached="attachments.push($event)"
@start="scrollIntoField(currentField)" @start="scrollIntoField(currentField)"
@minimize="isFormVisible = false" @minimize="isFormVisible = false"
@ -268,6 +273,7 @@
:previous-value="previousInitialsValue" :previous-value="previousInitialsValue"
:is-direct-upload="isDirectUpload" :is-direct-upload="isDirectUpload"
:attachments-index="attachmentsIndex" :attachments-index="attachmentsIndex"
:show-field-names="showFieldNames"
:submitter-slug="submitterSlug" :submitter-slug="submitterSlug"
@attached="attachments.push($event)" @attached="attachments.push($event)"
@start="scrollIntoField(currentField)" @start="scrollIntoField(currentField)"
@ -290,6 +296,7 @@
:key="currentField.uuid" :key="currentField.uuid"
v-model="values[currentField.uuid]" v-model="values[currentField.uuid]"
:field="currentField" :field="currentField"
:show-field-names="showFieldNames"
:default-value="submitter.phone" :default-value="submitter.phone"
:submitter-slug="submitterSlug" :submitter-slug="submitterSlug"
@focus="scrollIntoField(currentField)" @focus="scrollIntoField(currentField)"
@ -446,6 +453,11 @@ export default {
required: false, required: false,
default: false default: false
}, },
showFieldNames: {
type: Boolean,
required: false,
default: true
},
withTypedSignature: { withTypedSignature: {
type: Boolean, type: Boolean,
required: false, required: false,

@ -17,6 +17,7 @@ const en = {
initials: 'Initials', initials: 'Initials',
clear: 'Clear', clear: 'Clear',
redraw: 'Redraw', redraw: 'Redraw',
image: 'Image',
draw_initials: 'Draw initials', draw_initials: 'Draw initials',
type_signature_here: 'Type signature here', type_signature_here: 'Type signature here',
type_initial_here: 'Type initials here', type_initial_here: 'Type initials here',
@ -64,6 +65,7 @@ const es = {
initials: 'Iniciales', initials: 'Iniciales',
clear: 'Borrar', clear: 'Borrar',
redraw: 'Redibujar', redraw: 'Redibujar',
image: 'Imagen',
draw_initials: 'Dibujar iniciales', draw_initials: 'Dibujar iniciales',
type_signature_here: 'Escribe la firma aquí', type_signature_here: 'Escribe la firma aquí',
type_initial_here: 'Escribe las iniciales aquí', type_initial_here: 'Escribe las iniciales aquí',
@ -111,6 +113,7 @@ const it = {
initials: 'Iniziali', initials: 'Iniziali',
clear: 'Cancella', clear: 'Cancella',
redraw: 'Ridisegna', redraw: 'Ridisegna',
image: 'Immagine',
draw_initials: 'Disegna iniziali', draw_initials: 'Disegna iniziali',
type_signature_here: 'Scrivi la firma qui', type_signature_here: 'Scrivi la firma qui',
type_initial_here: 'Scrivi le iniziali qui', type_initial_here: 'Scrivi le iniziali qui',
@ -158,6 +161,7 @@ const de = {
initials: 'Initialen', initials: 'Initialen',
clear: 'Löschen', clear: 'Löschen',
redraw: 'Neu zeichnen', redraw: 'Neu zeichnen',
image: 'Bild',
draw_initials: 'Initialen zeichnen', draw_initials: 'Initialen zeichnen',
type_signature_here: 'Unterschrift hier eingeben', type_signature_here: 'Unterschrift hier eingeben',
type_initial_here: 'Initialen hier eingeben', type_initial_here: 'Initialen hier eingeben',
@ -205,6 +209,7 @@ const fr = {
initials: 'Initiales', initials: 'Initiales',
clear: 'Effacer', clear: 'Effacer',
redraw: 'Redessiner', redraw: 'Redessiner',
image: 'Image',
draw_initials: 'Dessiner les initiales', draw_initials: 'Dessiner les initiales',
type_signature_here: 'Tapez la signature ici', type_signature_here: 'Tapez la signature ici',
type_initial_here: 'Tapez les initiales ici', type_initial_here: 'Tapez les initiales ici',
@ -252,6 +257,7 @@ const pl = {
initials: 'Inicjały', initials: 'Inicjały',
clear: 'Wyczyść', clear: 'Wyczyść',
redraw: 'Przerysuj', redraw: 'Przerysuj',
image: 'Obraz',
draw_initials: 'Narysuj inicjały', draw_initials: 'Narysuj inicjały',
type_signature_here: 'Wpisz podpis tutaj', type_signature_here: 'Wpisz podpis tutaj',
type_initial_here: 'Wpisz inicjały tutaj', type_initial_here: 'Wpisz inicjały tutaj',
@ -299,6 +305,7 @@ const uk = {
initials: 'Ініціали', initials: 'Ініціали',
clear: 'Очистити', clear: 'Очистити',
redraw: 'Перемалювати', redraw: 'Перемалювати',
image: 'Зображення',
draw_initials: 'Намалювати ініціали', draw_initials: 'Намалювати ініціали',
type_signature_here: 'Введіть підпис тут', type_signature_here: 'Введіть підпис тут',
type_initial_here: 'Введіть ініціали тут', type_initial_here: 'Введіть ініціали тут',
@ -346,6 +353,7 @@ const cs = {
initials: 'Iniciály', initials: 'Iniciály',
clear: 'Smazat', clear: 'Smazat',
redraw: 'Překreslit', redraw: 'Překreslit',
image: 'Obrázek',
draw_initials: 'Nakreslit iniciály', draw_initials: 'Nakreslit iniciály',
type_signature_here: 'Sem zadejte podpis', type_signature_here: 'Sem zadejte podpis',
type_initial_here: 'Sem zadejte iniciály', type_initial_here: 'Sem zadejte iniciály',
@ -393,6 +401,7 @@ const pt = {
initials: 'Iniciais', initials: 'Iniciais',
clear: 'Limpar', clear: 'Limpar',
redraw: 'Redesenhar', redraw: 'Redesenhar',
image: 'Imagem',
draw_initials: 'Desenhar iniciais', draw_initials: 'Desenhar iniciais',
type_signature_here: 'Digite a assinatura aqui', type_signature_here: 'Digite a assinatura aqui',
type_initial_here: 'Digite as iniciais aqui', type_initial_here: 'Digite as iniciais aqui',
@ -441,6 +450,7 @@ const he = {
initials: 'ציוני ראשי תיבות', initials: 'ציוני ראשי תיבות',
clear: 'נקה', clear: 'נקה',
redraw: 'צייר מחדש', redraw: 'צייר מחדש',
image: 'תמונה',
draw_initials: 'צייר ציוני ראשי תיבות', draw_initials: 'צייר ציוני ראשי תיבות',
type_signature_here: 'הקלד חתימה כאן', type_signature_here: 'הקלד חתימה כאן',
type_initial_here: 'הקלד ציוני ראשי תיבות כאן', type_initial_here: 'הקלד ציוני ראשי תיבות כאן',

@ -3,7 +3,7 @@
<div class="flex justify-between items-center w-full mb-2"> <div class="flex justify-between items-center w-full mb-2">
<label <label
class="label text-2xl" class="label text-2xl"
>{{ field.name || 'Image' }}</label> >{{ showFieldNames && field.name ? field.name : t('image') }}</label>
<button <button
class="btn btn-outline btn-sm" class="btn btn-outline btn-sm"
@click.prevent="remove" @click.prevent="remove"
@ -46,6 +46,7 @@ export default {
FileDropzone, FileDropzone,
IconReload IconReload
}, },
inject: ['t'],
props: { props: {
field: { field: {
type: Object, type: Object,
@ -56,6 +57,11 @@ export default {
required: true, required: true,
default: false default: false
}, },
showFieldNames: {
type: Boolean,
required: false,
default: true
},
submitterSlug: { submitterSlug: {
type: String, type: String,
required: true required: true

@ -3,7 +3,7 @@
<div class="flex justify-between items-center w-full mb-2"> <div class="flex justify-between items-center w-full mb-2">
<label <label
class="label text-2xl" class="label text-2xl"
>{{ field.name || t('initials') }}</label> >{{ showFieldNames && field.name ? field.name : t('initials') }}</label>
<div class="space-x-2 flex"> <div class="space-x-2 flex">
<span <span
v-if="isDrawInitials" v-if="isDrawInitials"
@ -125,6 +125,11 @@ export default {
type: String, type: String,
required: true required: true
}, },
showFieldNames: {
type: Boolean,
required: false,
default: true
},
isDirectUpload: { isDirectUpload: {
type: Boolean, type: Boolean,
required: true, required: true,

@ -1,11 +1,11 @@
<template> <template>
<label <label
v-if="field.name" v-if="showFieldNames && field.name"
:for="field.uuid" :for="field.uuid"
dir="auto" dir="auto"
class="label text-2xl mb-2" class="label text-2xl mb-2"
>{{ field.name }}</label> >{{ field.name }}</label>
<div class="flex w-full"> <div class="flex w-full max-h-44 overflow-y-auto">
<input <input
v-if="modelValue.length === 0" v-if="modelValue.length === 0"
type="text" type="text"
@ -14,8 +14,8 @@
class="hidden" class="hidden"
> >
<div <div
v-if="field.options.length > 5" v-if="!showOptions"
class="text-xl text-center w-full" class="text-xl px-1"
> >
<span @click="scrollIntoField(field)"> <span @click="scrollIntoField(field)">
{{ t('complete_hightlighted_checkboxes_and_click') }} <span class="font-semibold">{{ isLastStep ? t('submit') : t('next') }}</span>. {{ t('complete_hightlighted_checkboxes_and_click') }} <span class="font-semibold">{{ isLastStep ? t('submit') : t('next') }}</span>.
@ -23,7 +23,7 @@
</div> </div>
<div <div
class="space-y-3.5 mx-auto" class="space-y-3.5 mx-auto"
:class="{ hidden: field.options.length > 5 }" :class="{ hidden: !showOptions }"
> >
<div <div
v-for="(option, index) in field.options" v-for="(option, index) in field.options"
@ -66,6 +66,11 @@ export default {
required: true, required: true,
default: false default: false
}, },
showFieldNames: {
type: Boolean,
required: false,
default: true
},
modelValue: { modelValue: {
type: Array, type: Array,
required: false, required: false,
@ -78,6 +83,11 @@ export default {
inputRefs: [] inputRefs: []
} }
}, },
computed: {
showOptions () {
return this.showFieldNames && (this.field.options.some((e) => e.value) || this.field.options.length < 5)
}
},
beforeUpdate () { beforeUpdate () {
this.inputRefs = [] this.inputRefs = []
}, },

@ -3,7 +3,7 @@
<label <label
:for="isCodeSent ? 'one_time_code' : field.uuid" :for="isCodeSent ? 'one_time_code' : field.uuid"
class="label text-2xl mb-2" class="label text-2xl mb-2"
>{{ field.name || t('verified_phone_number') }} >{{ showFieldNames && field.name ? field.name : t('verified_phone_number') }}
<template v-if="!field.required">({{ t('optional') }})</template> <template v-if="!field.required">({{ t('optional') }})</template>
</label> </label>
<div> <div>
@ -93,6 +93,11 @@ export default {
type: String, type: String,
required: true required: true
}, },
showFieldNames: {
type: Boolean,
required: false,
default: true
},
modelValue: { modelValue: {
type: String, type: String,
required: false, required: false,

@ -3,7 +3,7 @@
<div class="flex justify-between items-center w-full mb-2"> <div class="flex justify-between items-center w-full mb-2">
<label <label
class="label text-2xl" class="label text-2xl"
>{{ field.name || t('signature') }}</label> >{{ showFieldNames && field.name ? field.name : t('signature') }}</label>
<div class="space-x-2 flex"> <div class="space-x-2 flex">
<span <span
v-if="isTextSignature" v-if="isTextSignature"
@ -147,6 +147,11 @@ export default {
type: String, type: String,
required: true required: true
}, },
showFieldNames: {
type: Boolean,
required: false,
default: true
},
isDirectUpload: { isDirectUpload: {
type: Boolean, type: Boolean,
required: true, required: true,

@ -1,6 +1,6 @@
<template> <template>
<label <label
v-if="field.name" v-if="showFieldNames && field.name"
:for="field.uuid" :for="field.uuid"
dir="auto" dir="auto"
class="label text-2xl" class="label text-2xl"
@ -81,6 +81,11 @@ export default {
type: Object, type: Object,
required: true required: true
}, },
showFieldNames: {
type: Boolean,
required: false,
default: true
},
modelValue: { modelValue: {
type: String, type: String,
required: false, required: false,

Loading…
Cancel
Save