2022-04-29 18:29:42 +08:00
|
|
|
<template>
|
|
|
|
<div class="step-checklist-container">
|
2022-05-05 18:56:31 +08:00
|
|
|
<div class="step-element-header" :class="{ 'editing-name': editingName }">
|
|
|
|
<div class="step-element-grip">
|
|
|
|
<i class="fas fa-grip-vertical"></i>
|
|
|
|
</div>
|
|
|
|
<div class="step-element-name">
|
|
|
|
<InlineEdit
|
|
|
|
:value="element.attributes.orderable.name"
|
|
|
|
:characterLimit="255"
|
|
|
|
:placeholder="''"
|
|
|
|
:allowBlank="false"
|
|
|
|
:autofocus="editingName"
|
|
|
|
:attributeName="`${i18n.t('Checklist')} ${i18n.t('name')}`"
|
|
|
|
@editingEnabled="enableNameEdit"
|
|
|
|
@editingDisabled="disableNameEdit"
|
|
|
|
@update="updateName"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="step-element-controls">
|
|
|
|
<button class="btn icon-btn btn-light" @click="enableNameEdit">
|
|
|
|
<i class="fas fa-pen"></i>
|
|
|
|
</button>
|
|
|
|
<button class="btn icon-btn btn-light" @click="showDeleteModal">
|
|
|
|
<i class="fas fa-trash"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-05-04 16:25:53 +08:00
|
|
|
<deleteComponentModal v-if="confirmingDelete" @confirm="deleteComponent" @cancel="closeDeleteModal"/>
|
2022-04-29 18:29:42 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-05-03 21:15:49 +08:00
|
|
|
import DeleteMixin from 'vue/protocol/mixins/components/delete.js'
|
2022-05-04 16:25:53 +08:00
|
|
|
import deleteComponentModal from 'vue/protocol/modals/delete_component.vue'
|
2022-05-05 18:56:31 +08:00
|
|
|
import InlineEdit from 'vue/shared/inline_edit.vue'
|
2022-05-04 16:25:53 +08:00
|
|
|
|
2022-04-29 18:29:42 +08:00
|
|
|
export default {
|
2022-05-03 21:15:49 +08:00
|
|
|
name: 'Checklist',
|
2022-05-05 18:56:31 +08:00
|
|
|
components: { deleteComponentModal, InlineEdit },
|
2022-05-03 21:15:49 +08:00
|
|
|
mixins: [DeleteMixin],
|
|
|
|
props: {
|
|
|
|
element: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
}
|
2022-05-05 18:56:31 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
editingName: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
enableNameEdit() {
|
|
|
|
this.editingName = true;
|
|
|
|
},
|
|
|
|
disableNameEdit() {
|
|
|
|
this.editingName = false;
|
|
|
|
},
|
|
|
|
updateName(name) {
|
|
|
|
this.element.attributes.orderable.name = name;
|
|
|
|
this.update();
|
|
|
|
},
|
|
|
|
update() {
|
|
|
|
this.$emit('update', this.element)
|
|
|
|
}
|
2022-05-03 21:15:49 +08:00
|
|
|
}
|
2022-04-29 18:29:42 +08:00
|
|
|
}
|
2022-05-03 19:42:43 +08:00
|
|
|
</script>
|