implement signature preview

This commit is contained in:
Alex Turchyn
2023-05-24 01:22:17 +03:00
parent f1da37d1ec
commit b5b4f286cf
6 changed files with 73 additions and 19 deletions
+13 -5
View File
@@ -14,9 +14,13 @@ export default actionable(targetable(class extends HTMLElement {
]
passValueToArea (e) {
this.areasSetValue(e.target.id, e.target.value)
}
areasSetValue (fieldUuid, value) {
return (this.areas || []).forEach((area) => {
if (area.dataset.fieldUuid === e.target.id) {
area.setValue(e.target.value)
if (area.dataset.fieldUuid === fieldUuid) {
area.setValue(value)
}
})
}
@@ -42,6 +46,8 @@ export default actionable(targetable(class extends HTMLElement {
console.error('Error submitting form:', error)
}).finally(() => {
e.target.okButton.disabled = false
this.areasSetValue(e.target.closest('disable-hidden').dataset.fieldUuid, e.detail)
})
}
@@ -64,7 +70,7 @@ export default actionable(targetable(class extends HTMLElement {
}
moveStepBack (e) {
e.preventDefault()
e?.preventDefault()
const currentStepIndex = this.steps.findIndex((el) => !el.classList.contains('hidden'))
@@ -75,7 +81,9 @@ export default actionable(targetable(class extends HTMLElement {
}
}
moveNextStep () {
moveNextStep (e) {
e?.preventDefault()
const currentStepIndex = this.steps.findIndex((el) => !el.classList.contains('hidden'))
const nextStep = this.steps[currentStepIndex + 1]
@@ -89,7 +97,7 @@ export default actionable(targetable(class extends HTMLElement {
}
focusField ({ target }) {
this.setVisibleStep(target.dataset.fieldUuid)
this.setVisibleStep(target.closest('flow-area').dataset.fieldUuid)
}
focusArea ({ target }) {