Fix sizing issue with captcha
This commit is contained in:
parent
2f0f87267f
commit
7888990e84
|
|
@ -6,6 +6,7 @@
|
||||||
</div>
|
</div>
|
||||||
<form
|
<form
|
||||||
v-else-if="dataForm"
|
v-else-if="dataForm"
|
||||||
|
:style="computedStyle"
|
||||||
@submit.prevent=""
|
@submit.prevent=""
|
||||||
>
|
>
|
||||||
<template v-if="form.show_progress_bar">
|
<template v-if="form.show_progress_bar">
|
||||||
|
|
@ -77,6 +78,8 @@
|
||||||
ref="hcaptcha"
|
ref="hcaptcha"
|
||||||
:sitekey="hCaptchaSiteKey"
|
:sitekey="hCaptchaSiteKey"
|
||||||
:theme="darkMode?'dark':'light'"
|
:theme="darkMode?'dark':'light'"
|
||||||
|
@opened="setMinHeight(500)"
|
||||||
|
@closed="setMinHeight(0)"
|
||||||
/>
|
/>
|
||||||
<has-error
|
<has-error
|
||||||
:form="dataForm"
|
:form="dataForm"
|
||||||
|
|
@ -179,6 +182,7 @@ export default {
|
||||||
dataForm,
|
dataForm,
|
||||||
recordsStore,
|
recordsStore,
|
||||||
workingFormStore,
|
workingFormStore,
|
||||||
|
isIframe: useIsIframe(),
|
||||||
draggingNewBlock: computed(() => workingFormStore.draggingNewBlock),
|
draggingNewBlock: computed(() => workingFormStore.draggingNewBlock),
|
||||||
pendingSubmission: pendingSubmission(props.form)
|
pendingSubmission: pendingSubmission(props.form)
|
||||||
}
|
}
|
||||||
|
|
@ -191,6 +195,7 @@ export default {
|
||||||
* Used to force refresh components by changing their keys
|
* Used to force refresh components by changing their keys
|
||||||
*/
|
*/
|
||||||
isAutoSubmit: false,
|
isAutoSubmit: false,
|
||||||
|
minHeight: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -290,6 +295,11 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return data
|
return data
|
||||||
|
},
|
||||||
|
computedStyle() {
|
||||||
|
return {
|
||||||
|
...this.minHeight ? {minHeight: this.minHeight + 'px'} : {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -452,7 +462,7 @@ export default {
|
||||||
nextPage() {
|
nextPage() {
|
||||||
if (this.adminPreview || this.urlPrefillPreview) {
|
if (this.adminPreview || this.urlPrefillPreview) {
|
||||||
this.currentFieldGroupIndex += 1
|
this.currentFieldGroupIndex += 1
|
||||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
window.scrollTo({top: 0, behavior: 'smooth'})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const fieldsToValidate = this.currentFields.map(f => f.id)
|
const fieldsToValidate = this.currentFields.map(f => f.id)
|
||||||
|
|
@ -463,28 +473,28 @@ export default {
|
||||||
this.dataForm.busy = false
|
this.dataForm.busy = false
|
||||||
window.scrollTo({top: 0, behavior: 'smooth'})
|
window.scrollTo({top: 0, behavior: 'smooth'})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
if (error && error.data && error.data.message) {
|
if (error && error.data && error.data.message) {
|
||||||
useAlert().error(error.data.message)
|
useAlert().error(error.data.message)
|
||||||
}
|
}
|
||||||
this.dataForm.busy = false
|
this.dataForm.busy = false
|
||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
isFieldHidden(field) {
|
isFieldHidden(field) {
|
||||||
return (new FormLogicPropertyResolver(field, this.dataFormValue)).isHidden()
|
return (new FormLogicPropertyResolver(field, this.dataFormValue)).isHidden()
|
||||||
},
|
},
|
||||||
getTargetFieldIndex(currentFieldPageIndex){
|
getTargetFieldIndex(currentFieldPageIndex) {
|
||||||
let targetIndex = 0
|
let targetIndex = 0
|
||||||
if (this.currentFieldGroupIndex > 0) {
|
if (this.currentFieldGroupIndex > 0) {
|
||||||
for (let i = 0; i < this.currentFieldGroupIndex; i++) {
|
for (let i = 0; i < this.currentFieldGroupIndex; i++) {
|
||||||
targetIndex += this.fieldGroups[i].length
|
targetIndex += this.fieldGroups[i].length
|
||||||
}
|
|
||||||
targetIndex += currentFieldPageIndex
|
|
||||||
} else {
|
|
||||||
targetIndex = currentFieldPageIndex
|
|
||||||
}
|
}
|
||||||
return targetIndex
|
targetIndex += currentFieldPageIndex
|
||||||
|
} else {
|
||||||
|
targetIndex = currentFieldPageIndex
|
||||||
|
}
|
||||||
|
return targetIndex
|
||||||
},
|
},
|
||||||
handleDragDropped(data) {
|
handleDragDropped(data) {
|
||||||
if (data.added) {
|
if (data.added) {
|
||||||
|
|
@ -497,6 +507,18 @@ export default {
|
||||||
const newTargetIndex = this.getTargetFieldIndex(data.moved.newIndex)
|
const newTargetIndex = this.getTargetFieldIndex(data.moved.newIndex)
|
||||||
this.workingFormStore.moveField(oldTargetIndex, newTargetIndex)
|
this.workingFormStore.moveField(oldTargetIndex, newTargetIndex)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setMinHeight(minHeight) {
|
||||||
|
if (!this.isIframe) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.minHeight = minHeight
|
||||||
|
// Trigger window iframe resize
|
||||||
|
try {
|
||||||
|
window.parentIFrame.size()
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue