add initials field

This commit is contained in:
Alex Turchyn
2023-09-20 00:13:14 +03:00
parent dc02964d9b
commit ee350324e5
14 changed files with 426 additions and 29 deletions
@@ -3,7 +3,7 @@
<div class="flex justify-between items-center w-full mb-2">
<label
class="label text-2xl"
>{{ field.name || 'Signature' }}</label>
>{{ field.name || t('signature') }}</label>
<div class="space-x-2 flex">
<span
class="tooltip"
@@ -40,7 +40,7 @@
@click.prevent="remove"
>
<IconReload :width="16" />
Redraw
{{ t('redraw') }}
</button>
<button
v-else
@@ -48,7 +48,7 @@
@click.prevent="clear"
>
<IconReload :width="16" />
Clear
{{ t('clear') }}
</button>
<button
title="Minimize"
@@ -83,7 +83,7 @@
ref="textInput"
class="base-input !text-2xl w-full mt-6"
:required="field.required"
:placeholder="`Type signature here...`"
:placeholder="`${t('type_signature_here')}...`"
type="text"
@input="updateWrittenSignature"
>
@@ -101,7 +101,7 @@ export default {
IconTextSize,
IconArrowsDiagonalMinimize2
},
inject: ['baseUrl'],
inject: ['baseUrl', 't'],
props: {
field: {
type: Object,
@@ -136,8 +136,10 @@ export default {
},
async mounted () {
this.$nextTick(() => {
this.$refs.canvas.width = this.$refs.canvas.parentNode.clientWidth
this.$refs.canvas.height = this.$refs.canvas.parentNode.clientWidth / 3
if (this.$refs.canvas) {
this.$refs.canvas.width = this.$refs.canvas.parentNode.clientWidth
this.$refs.canvas.height = this.$refs.canvas.parentNode.clientWidth / 3
}
})
if (this.isDirectUpload) {
@@ -146,13 +148,15 @@ export default {
const { default: SignaturePad } = await import('signature_pad')
this.pad = new SignaturePad(this.$refs.canvas)
if (this.$refs.canvas) {
this.pad = new SignaturePad(this.$refs.canvas)
this.pad.addEventListener('beginStroke', () => {
this.isSignatureStarted = true
this.pad.addEventListener('beginStroke', () => {
this.isSignatureStarted = true
this.$emit('start')
})
this.$emit('start')
})
}
},
methods: {
remove () {