2019-10-24 02:15:55 +00:00
|
|
|
<template>
|
2021-08-08 07:12:29 +00:00
|
|
|
<SmartModal
|
|
|
|
|
v-if="show"
|
2022-03-24 00:24:56 +00:00
|
|
|
dialog
|
2021-08-08 07:12:29 +00:00
|
|
|
:title="$t('folder.edit')"
|
|
|
|
|
@close="$emit('hide-modal')"
|
|
|
|
|
>
|
2021-06-30 08:46:02 +00:00
|
|
|
<template #body>
|
2021-07-17 17:40:28 +00:00
|
|
|
<div class="flex flex-col px-2">
|
2021-07-09 17:19:45 +00:00
|
|
|
<input
|
|
|
|
|
id="selectLabelEditFolder"
|
|
|
|
|
v-model="name"
|
2021-08-08 17:14:05 +00:00
|
|
|
v-focus
|
2021-08-07 09:21:13 +00:00
|
|
|
class="input floating-input"
|
|
|
|
|
placeholder=" "
|
2021-07-09 17:19:45 +00:00
|
|
|
type="text"
|
2021-08-29 11:14:18 +00:00
|
|
|
autocomplete="off"
|
2021-07-09 17:19:45 +00:00
|
|
|
@keyup.enter="editFolder"
|
|
|
|
|
/>
|
2021-08-07 09:21:13 +00:00
|
|
|
<label for="selectLabelEditFolder">
|
2021-08-18 16:47:31 +00:00
|
|
|
{{ $t("action.label") }}
|
2021-08-07 09:21:13 +00:00
|
|
|
</label>
|
2021-07-09 17:19:45 +00:00
|
|
|
</div>
|
2021-06-30 08:46:02 +00:00
|
|
|
</template>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<span>
|
2022-04-20 18:18:25 +00:00
|
|
|
<ButtonPrimary
|
|
|
|
|
:label="$t('action.save')"
|
|
|
|
|
:loading="loadingState"
|
|
|
|
|
@click.native="editFolder"
|
|
|
|
|
/>
|
2021-08-18 18:40:57 +00:00
|
|
|
<ButtonSecondary
|
|
|
|
|
:label="$t('action.cancel')"
|
|
|
|
|
@click.native="hideModal"
|
|
|
|
|
/>
|
2021-06-30 08:46:02 +00:00
|
|
|
</span>
|
|
|
|
|
</template>
|
2021-03-01 03:58:14 +00:00
|
|
|
</SmartModal>
|
2019-10-24 02:15:55 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-08-24 03:44:46 +00:00
|
|
|
import { defineComponent } from "@nuxtjs/composition-api"
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
2019-11-02 05:32:21 +00:00
|
|
|
props: {
|
|
|
|
|
show: Boolean,
|
2021-12-10 05:25:49 +00:00
|
|
|
editingFolderName: { type: String, default: null },
|
2022-04-20 18:18:25 +00:00
|
|
|
loadingState: Boolean,
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2021-05-20 08:54:14 +00:00
|
|
|
name: null,
|
2020-02-24 18:44:50 +00:00
|
|
|
}
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
2021-12-10 05:25:49 +00:00
|
|
|
watch: {
|
|
|
|
|
editingFolderName(val) {
|
|
|
|
|
this.name = val
|
|
|
|
|
},
|
|
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
methods: {
|
|
|
|
|
editFolder() {
|
2021-08-08 06:31:36 +00:00
|
|
|
if (!this.name) {
|
2021-11-19 15:43:58 +00:00
|
|
|
this.$toast.error(this.$t("folder.invalid_name"))
|
2021-08-08 06:31:36 +00:00
|
|
|
return
|
|
|
|
|
}
|
2021-05-07 00:46:29 +00:00
|
|
|
this.$emit("submit", this.name)
|
2019-10-24 02:15:55 +00:00
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
hideModal() {
|
2021-05-20 08:54:14 +00:00
|
|
|
this.name = null
|
2020-02-25 02:06:23 +00:00
|
|
|
this.$emit("hide-modal")
|
2020-02-24 18:44:50 +00:00
|
|
|
},
|
|
|
|
|
},
|
2021-08-24 03:44:46 +00:00
|
|
|
})
|
2019-10-24 02:15:55 +00:00
|
|
|
</script>
|