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
|
2022-09-29 05:25:21 +00:00
|
|
|
:title="t('folder.edit')"
|
2021-08-08 07:12:29 +00:00
|
|
|
@close="$emit('hide-modal')"
|
|
|
|
|
>
|
2021-06-30 08:46:02 +00:00
|
|
|
<template #body>
|
2022-09-29 05:25:21 +00:00
|
|
|
<div class="flex flex-col">
|
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">
|
2022-09-29 05:25:21 +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>
|
2022-09-29 05:25:21 +00:00
|
|
|
<span class="flex">
|
2022-04-20 18:18:25 +00:00
|
|
|
<ButtonPrimary
|
2022-09-29 05:25:21 +00:00
|
|
|
:label="t('action.save')"
|
2022-04-20 18:18:25 +00:00
|
|
|
:loading="loadingState"
|
2022-09-29 05:25:21 +00:00
|
|
|
@click="editFolder"
|
2021-08-18 18:40:57 +00:00
|
|
|
/>
|
2022-09-29 05:25:21 +00:00
|
|
|
<ButtonSecondary :label="t('action.cancel')" @click="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>
|
|
|
|
|
|
2022-09-29 05:25:21 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { defineComponent } from "vue"
|
|
|
|
|
import { useI18n } from "@composables/i18n"
|
|
|
|
|
import { useToast } from "@composables/toast"
|
2021-08-24 03:44:46 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
},
|
2022-09-29 05:25:21 +00:00
|
|
|
emits: ["submit", "hide-modal"],
|
|
|
|
|
setup() {
|
|
|
|
|
return {
|
|
|
|
|
t: useI18n(),
|
|
|
|
|
toast: useToast(),
|
|
|
|
|
}
|
|
|
|
|
},
|
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) {
|
2022-09-29 05:25:21 +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>
|