add field types prop

This commit is contained in:
Pete Matsyburka
2024-01-10 23:18:30 +02:00
parent b6f43c9b23
commit f74ad050b4
5 changed files with 37 additions and 7 deletions
+13 -1
View File
@@ -199,6 +199,7 @@
v-if="sortedDocuments.length && !drawField && editable"
:fields="template.fields"
:default-fields="defaultFields"
:field-types="fieldTypes"
:selected-submitter="selectedSubmitter"
@select="startFieldDraw($event)"
/>
@@ -244,6 +245,7 @@
:with-help="withHelp"
:default-submitters="defaultSubmitters"
:default-fields="defaultFields"
:field-types="fieldTypes"
:with-sticky-submitters="withStickySubmitters"
:only-defined-fields="onlyDefinedFields"
:editable="editable"
@@ -299,6 +301,7 @@ export default {
save: this.save,
t: this.t,
baseFetch: this.baseFetch,
fieldTypes: this.fieldTypes,
backgroundColor: this.backgroundColor,
withPhone: this.withPhone,
withPayment: this.withPayment,
@@ -345,6 +348,11 @@ export default {
required: false,
default: () => []
},
fieldTypes: {
type: Array,
required: false,
default: () => []
},
defaultSubmitters: {
type: Array,
required: false,
@@ -724,7 +732,11 @@ export default {
const documentRef = this.documentRefs.find((e) => e.document.uuid === area.attachment_uuid)
const pageMask = documentRef.pageRefs[area.page].$refs.mask
const type = (pageMask.clientWidth * area.w) < 35 ? 'checkbox' : 'text'
let type = (pageMask.clientWidth * area.w) < 35 ? 'checkbox' : 'text'
if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes(type)) {
type = this.fieldTypes[0]
}
if (type === 'checkbox') {
const previousField = [...this.template.fields].reverse().find((f) => f.type === type)