|
|
|
@ -9,14 +9,15 @@
|
|
|
|
class="tooltip"
|
|
|
|
class="tooltip"
|
|
|
|
data-tip="Type text"
|
|
|
|
data-tip="Type text"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<button
|
|
|
|
<a
|
|
|
|
id="type_text_button"
|
|
|
|
id="type_text_button"
|
|
|
|
|
|
|
|
href="#"
|
|
|
|
class="btn btn-sm btn-circle"
|
|
|
|
class="btn btn-sm btn-circle"
|
|
|
|
:class="{ 'btn-neutral': isTextSignature, 'btn-outline': !isTextSignature }"
|
|
|
|
:class="{ 'btn-neutral': isTextSignature, 'btn-outline': !isTextSignature }"
|
|
|
|
@click.prevent="toggleTextInput"
|
|
|
|
@click.prevent="toggleTextInput"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<IconTextSize :width="16" />
|
|
|
|
<IconTextSize :width="16" />
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<span
|
|
|
|
<span
|
|
|
|
class="tooltip"
|
|
|
|
class="tooltip"
|
|
|
|
@ -34,23 +35,26 @@
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</label>
|
|
|
|
</label>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<button
|
|
|
|
<a
|
|
|
|
v-if="modelValue"
|
|
|
|
v-if="modelValue || computedPreviousValue"
|
|
|
|
|
|
|
|
href="#"
|
|
|
|
class="btn btn-outline btn-sm"
|
|
|
|
class="btn btn-outline btn-sm"
|
|
|
|
@click.prevent="remove"
|
|
|
|
@click.prevent="remove"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<IconReload :width="16" />
|
|
|
|
<IconReload :width="16" />
|
|
|
|
{{ t('redraw') }}
|
|
|
|
{{ t('redraw') }}
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
<button
|
|
|
|
<a
|
|
|
|
v-else
|
|
|
|
v-else
|
|
|
|
|
|
|
|
href="#"
|
|
|
|
class="btn btn-outline btn-sm"
|
|
|
|
class="btn btn-outline btn-sm"
|
|
|
|
@click.prevent="clear"
|
|
|
|
@click.prevent="clear"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<IconReload :width="16" />
|
|
|
|
<IconReload :width="16" />
|
|
|
|
{{ t('clear') }}
|
|
|
|
{{ t('clear') }}
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
<button
|
|
|
|
<a
|
|
|
|
|
|
|
|
href="#"
|
|
|
|
title="Minimize"
|
|
|
|
title="Minimize"
|
|
|
|
class="py-1.5 inline md:hidden"
|
|
|
|
class="py-1.5 inline md:hidden"
|
|
|
|
@click.prevent="$emit('minimize')"
|
|
|
|
@click.prevent="$emit('minimize')"
|
|
|
|
@ -59,21 +63,21 @@
|
|
|
|
:width="20"
|
|
|
|
:width="20"
|
|
|
|
:height="20"
|
|
|
|
:height="20"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<input
|
|
|
|
<input
|
|
|
|
:value="modelValue"
|
|
|
|
:value="modelValue || computedPreviousValue"
|
|
|
|
type="hidden"
|
|
|
|
type="hidden"
|
|
|
|
:name="`values[${field.uuid}]`"
|
|
|
|
:name="`values[${field.uuid}]`"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<img
|
|
|
|
<img
|
|
|
|
v-if="modelValue"
|
|
|
|
v-if="modelValue || computedPreviousValue"
|
|
|
|
:src="attachmentsIndex[modelValue].url"
|
|
|
|
:src="attachmentsIndex[modelValue || computedPreviousValue].url"
|
|
|
|
class="mx-auto bg-white border border-base-300 rounded max-h-72"
|
|
|
|
class="mx-auto bg-white border border-base-300 rounded max-h-72"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<canvas
|
|
|
|
<canvas
|
|
|
|
v-show="!modelValue"
|
|
|
|
v-show="!modelValue && !computedPreviousValue"
|
|
|
|
ref="canvas"
|
|
|
|
ref="canvas"
|
|
|
|
class="bg-white border border-base-300 rounded"
|
|
|
|
class="bg-white border border-base-300 rounded"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
@ -123,6 +127,11 @@ export default {
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
default: () => ({})
|
|
|
|
default: () => ({})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
previousValue: {
|
|
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
|
|
required: false,
|
|
|
|
|
|
|
|
default: ''
|
|
|
|
|
|
|
|
},
|
|
|
|
modelValue: {
|
|
|
|
modelValue: {
|
|
|
|
type: String,
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
required: false,
|
|
|
|
@ -132,10 +141,20 @@ export default {
|
|
|
|
emits: ['attached', 'update:model-value', 'start', 'minimize'],
|
|
|
|
emits: ['attached', 'update:model-value', 'start', 'minimize'],
|
|
|
|
data () {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
isSignatureStarted: false,
|
|
|
|
isSignatureStarted: !!this.previousValue,
|
|
|
|
|
|
|
|
isUsePreviousValue: true,
|
|
|
|
isTextSignature: false
|
|
|
|
isTextSignature: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
|
|
computedPreviousValue () {
|
|
|
|
|
|
|
|
if (this.isUsePreviousValue) {
|
|
|
|
|
|
|
|
return this.previousValue
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return null
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
async mounted () {
|
|
|
|
async mounted () {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
if (this.$refs.canvas) {
|
|
|
|
if (this.$refs.canvas) {
|
|
|
|
@ -161,6 +180,9 @@ export default {
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
remove () {
|
|
|
|
remove () {
|
|
|
|
this.$emit('update:model-value', '')
|
|
|
|
this.$emit('update:model-value', '')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.isUsePreviousValue = false
|
|
|
|
|
|
|
|
this.isSignatureStarted = false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
clear () {
|
|
|
|
clear () {
|
|
|
|
this.pad.clear()
|
|
|
|
this.pad.clear()
|
|
|
|
@ -249,7 +271,11 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async submit () {
|
|
|
|
async submit () {
|
|
|
|
if (this.modelValue) {
|
|
|
|
if (this.modelValue || this.computedPreviousValue) {
|
|
|
|
|
|
|
|
if (this.computedPreviousValue) {
|
|
|
|
|
|
|
|
this.$emit('update:model-value', this.computedPreviousValue)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Promise.resolve({})
|
|
|
|
return Promise.resolve({})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|