Files
docuseal/app/javascript/template_builder/controls.vue
T

106 lines
2.7 KiB
Vue
Raw Normal View History

2023-08-19 21:05:54 +03:00
<template>
<div class="flex space-x-2">
<Contenteditable
2025-03-18 17:34:11 +02:00
class="w-full block mr-6 document-preview-name"
2023-08-19 21:05:54 +03:00
:model-value="item.name"
:icon-width="16"
@update:model-value="onUpdateName"
/>
<ReplaceButton
2023-11-09 10:54:56 +02:00
v-if="withReplaceButton"
2023-08-19 21:05:54 +03:00
:template-id="template.id"
2024-04-06 21:55:46 +03:00
:accept-file-types="acceptFileTypes"
2026-06-04 00:35:04 +03:00
:authenticity-token="authenticityToken"
:with-google-drive="withGoogleDrive"
:google-drive-file-id="item.google_drive_file_id"
2023-08-19 21:05:54 +03:00
@click.stop
@success="$emit('replace', { replaceSchemaItem: item, ...$event })"
/>
<button
v-if="withArrows"
2025-03-18 17:34:11 +02:00
class="btn border-base-200 bg-white text-base-content btn-xs rounded hover:text-base-100 hover:bg-base-content hover:border-base-content w-full transition-colors document-control-button"
2023-08-19 21:05:54 +03:00
style="width: 24px; height: 24px"
@click.stop="$emit('up', item)"
>
&uarr;
</button>
<button
v-if="withArrows"
2025-03-18 17:34:11 +02:00
class="btn border-base-200 bg-white text-base-content btn-xs rounded hover:text-base-100 hover:bg-base-content hover:border-base-content w-full transition-colors document-control-button"
2023-08-19 21:05:54 +03:00
style="width: 24px; height: 24px"
@click.stop="$emit('down', item)"
>
&darr;
</button>
<button
2025-03-18 17:34:11 +02:00
class="btn border-base-200 bg-white text-base-content btn-xs rounded hover:text-base-100 hover:bg-base-content hover:border-base-content w-full transition-colors document-control-button"
2023-08-19 21:05:54 +03:00
style="width: 24px; height: 24px"
@click.stop="$emit('remove', item)"
>
&times;
</button>
</div>
</template>
<script>
import Contenteditable from './contenteditable'
import Upload from './upload'
import ReplaceButton from './replace'
export default {
name: 'DocumentControls',
components: {
Contenteditable,
ReplaceButton
},
props: {
item: {
type: Object,
required: true
},
template: {
type: Object,
required: true
},
document: {
type: Object,
required: true
},
2024-04-06 21:55:46 +03:00
acceptFileTypes: {
type: String,
required: false,
2026-03-04 12:20:52 +02:00
default: 'image/*, application/pdf, application/zip, application/json'
2024-04-06 21:55:46 +03:00
},
2023-11-09 10:54:56 +02:00
withReplaceButton: {
type: Boolean,
required: true,
default: true
},
2026-06-04 00:35:04 +03:00
withGoogleDrive: {
type: Boolean,
required: false,
default: false
},
authenticityToken: {
type: String,
required: false,
default: ''
},
2023-08-19 21:05:54 +03:00
withArrows: {
type: Boolean,
required: false,
default: true
}
},
emits: ['change', 'remove', 'up', 'down', 'replace'],
methods: {
upload: Upload.methods.upload,
onUpdateName (value) {
this.item.name = value
this.$emit('change')
}
}
}
</script>