add default draw field prop

This commit is contained in:
Pete Matsyburka
2024-02-20 22:15:21 +02:00
parent 4eb4e8c1f8
commit 7b2cadcb91
2 changed files with 13 additions and 3 deletions
+9 -1
View File
@@ -321,6 +321,7 @@ export default {
backgroundColor: this.backgroundColor,
withPhone: this.withPhone,
withPayment: this.withPayment,
defaultDrawFieldType: this.defaultDrawFieldType,
selectedAreaRef: computed(() => this.selectedAreaRef)
}
},
@@ -364,6 +365,11 @@ export default {
required: false,
default: () => []
},
defaultDrawFieldType: {
type: String,
required: false,
default: 'text'
},
currencies: {
type: Array,
required: false,
@@ -755,7 +761,9 @@ export default {
let type = (pageMask.clientWidth * area.w) < 35 ? 'checkbox' : 'text'
if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes(type)) {
if (this.defaultDrawFieldType && this.defaultDrawFieldType !== 'text') {
type = this.defaultDrawFieldType
} else if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes(type)) {
type = this.fieldTypes[0]
}
+4 -2
View File
@@ -61,7 +61,7 @@ export default {
components: {
FieldArea
},
inject: ['fieldTypes'],
inject: ['fieldTypes', 'defaultDrawFieldType'],
props: {
image: {
type: Object,
@@ -123,7 +123,9 @@ export default {
},
computed: {
defaultFieldType () {
if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes('text')) {
if (this.defaultDrawFieldType && this.defaultDrawFieldType !== 'text') {
return this.defaultDrawFieldType
} else if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes('text')) {
return this.fieldTypes[0]
} else {
return 'text'