add default draw field prop

pull/217/head
Pete Matsyburka 2 years ago
parent 4eb4e8c1f8
commit 7b2cadcb91

@ -321,6 +321,7 @@ export default {
backgroundColor: this.backgroundColor, backgroundColor: this.backgroundColor,
withPhone: this.withPhone, withPhone: this.withPhone,
withPayment: this.withPayment, withPayment: this.withPayment,
defaultDrawFieldType: this.defaultDrawFieldType,
selectedAreaRef: computed(() => this.selectedAreaRef) selectedAreaRef: computed(() => this.selectedAreaRef)
} }
}, },
@ -364,6 +365,11 @@ export default {
required: false, required: false,
default: () => [] default: () => []
}, },
defaultDrawFieldType: {
type: String,
required: false,
default: 'text'
},
currencies: { currencies: {
type: Array, type: Array,
required: false, required: false,
@ -755,7 +761,9 @@ export default {
let 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)) { if (this.defaultDrawFieldType && this.defaultDrawFieldType !== 'text') {
type = this.defaultDrawFieldType
} else if (this.fieldTypes.length !== 0 && !this.fieldTypes.includes(type)) {
type = this.fieldTypes[0] type = this.fieldTypes[0]
} }

@ -61,7 +61,7 @@ export default {
components: { components: {
FieldArea FieldArea
}, },
inject: ['fieldTypes'], inject: ['fieldTypes', 'defaultDrawFieldType'],
props: { props: {
image: { image: {
type: Object, type: Object,
@ -123,7 +123,9 @@ export default {
}, },
computed: { computed: {
defaultFieldType () { 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] return this.fieldTypes[0]
} else { } else {
return 'text' return 'text'

Loading…
Cancel
Save