@mapomodule/uikit 2.0.0-beta.1 → 2.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -1
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +1 -18
- package/dist/module.d.mts +60 -2
- package/dist/module.d.ts +55 -2
- package/dist/module.d.ts.map +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +174 -13
- package/dist/runtime/adapters/defaultMediaAdapter.d.ts +14 -0
- package/dist/runtime/adapters/defaultMediaAdapter.d.ts.map +1 -0
- package/dist/runtime/adapters/defaultMediaAdapter.js +30 -0
- package/dist/runtime/assets/main.css +1 -0
- package/dist/runtime/components/MapoConfirmDialog.vue +35 -0
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts +4 -0
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDetail.vue +606 -0
- package/dist/runtime/components/MapoDetail.vue.d.ts +401 -0
- package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue +126 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts +23 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDropArea.vue +99 -0
- package/dist/runtime/components/MapoDropArea.vue.d.ts +33 -0
- package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLangSwitcher.vue +39 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts +18 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoList.vue +191 -0
- package/dist/runtime/components/MapoList.vue.d.ts +111 -0
- package/dist/runtime/components/MapoList.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListActions.vue +119 -0
- package/dist/runtime/components/MapoListActions.vue.d.ts +33 -0
- package/dist/runtime/components/MapoListActions.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListFilters.vue +246 -0
- package/dist/runtime/components/MapoListFilters.vue.d.ts +38 -0
- package/dist/runtime/components/MapoListFilters.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListHead.vue +9 -0
- package/dist/runtime/components/MapoListHead.vue.d.ts +14 -0
- package/dist/runtime/components/MapoListHead.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListQuickEdit.vue +123 -0
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts +47 -0
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListTable.vue +665 -0
- package/dist/runtime/components/MapoListTable.vue.d.ts +105 -0
- package/dist/runtime/components/MapoListTable.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoListTabs.vue +38 -0
- package/dist/runtime/components/MapoListTabs.vue.d.ts +26 -0
- package/dist/runtime/components/MapoListTabs.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLogin.vue +196 -0
- package/dist/runtime/components/MapoLogin.vue.d.ts +22 -0
- package/dist/runtime/components/MapoLogin.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLogoutButton.vue +27 -0
- package/dist/runtime/components/MapoLogoutButton.vue.d.ts +29 -0
- package/dist/runtime/components/MapoLogoutButton.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue +47 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaEditor.vue +320 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts +8 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue +112 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts +15 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaFolders.vue +220 -0
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaGallery.vue +219 -0
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaManager.vue +140 -0
- package/dist/runtime/components/MapoMediaManager.vue.d.ts +35 -0
- package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue +116 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts +41 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaPreview.vue +92 -0
- package/dist/runtime/components/MapoMediaPreview.vue.d.ts +19 -0
- package/dist/runtime/components/MapoMediaPreview.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaUploader.vue +290 -0
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts +8 -0
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuManager.vue +273 -0
- package/dist/runtime/components/MapoMenuManager.vue.d.ts +92 -0
- package/dist/runtime/components/MapoMenuManager.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue +201 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts +61 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuTreeview.vue +181 -0
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts +57 -0
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue +175 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts +27 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoRootComponents.vue +9 -0
- package/dist/runtime/components/MapoRootComponents.vue.d.ts +4 -0
- package/dist/runtime/components/MapoRootComponents.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebar.vue +89 -0
- package/dist/runtime/components/MapoSidebar.vue.d.ts +22 -0
- package/dist/runtime/components/MapoSidebar.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebarList.vue +27 -0
- package/dist/runtime/components/MapoSidebarList.vue.d.ts +8 -0
- package/dist/runtime/components/MapoSidebarList.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebarListItem.vue +74 -0
- package/dist/runtime/components/MapoSidebarListItem.vue.d.ts +9 -0
- package/dist/runtime/components/MapoSidebarListItem.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebarProfile.vue +55 -0
- package/dist/runtime/components/MapoSidebarProfile.vue.d.ts +10 -0
- package/dist/runtime/components/MapoSidebarProfile.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSnackBar.vue +38 -0
- package/dist/runtime/components/MapoSnackBar.vue.d.ts +4 -0
- package/dist/runtime/components/MapoSnackBar.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoThemeToggle.vue +23 -0
- package/dist/runtime/components/MapoThemeToggle.vue.d.ts +4 -0
- package/dist/runtime/components/MapoThemeToggle.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoTopbar.vue +30 -0
- package/dist/runtime/components/MapoTopbar.vue.d.ts +15 -0
- package/dist/runtime/components/MapoTopbar.vue.d.ts.map +1 -0
- package/dist/runtime/components/menuDndContext.d.ts +19 -0
- package/dist/runtime/components/menuDndContext.d.ts.map +1 -0
- package/dist/runtime/components/menuDndContext.js +3 -0
- package/dist/runtime/layouts/default.vue +43 -0
- package/dist/runtime/layouts/default.vue.d.ts +20 -0
- package/dist/runtime/layouts/default.vue.d.ts.map +1 -0
- package/dist/runtime/layouts/empty.vue +9 -0
- package/dist/runtime/layouts/empty.vue.d.ts +14 -0
- package/dist/runtime/layouts/empty.vue.d.ts.map +1 -0
- package/dist/runtime/page-meta.nuxt.d.ts +45 -0
- package/dist/runtime/pages/index.vue +14 -0
- package/dist/runtime/pages/index.vue.d.ts +4 -0
- package/dist/runtime/pages/index.vue.d.ts.map +1 -0
- package/dist/runtime/pages/login.vue +3 -0
- package/dist/runtime/pages/login.vue.d.ts +4 -0
- package/dist/runtime/pages/login.vue.d.ts.map +1 -0
- package/dist/runtime/plugins/media-adapter.d.ts +18 -0
- package/dist/runtime/plugins/media-adapter.d.ts.map +1 -0
- package/dist/runtime/plugins/media-adapter.js +8 -0
- package/dist/runtime/stores/media.d.ts +462 -0
- package/dist/runtime/stores/media.d.ts.map +1 -0
- package/dist/runtime/stores/media.js +344 -0
- package/dist/runtime/types/list.d.ts +59 -0
- package/dist/runtime/types/list.d.ts.map +1 -0
- package/dist/runtime/types/list.js +0 -0
- package/dist/runtime/types/media.d.ts +116 -0
- package/dist/runtime/types/media.d.ts.map +1 -0
- package/dist/runtime/types/media.js +0 -0
- package/dist/runtime/types/menu.d.ts +66 -0
- package/dist/runtime/types/menu.d.ts.map +1 -0
- package/dist/runtime/types/menu.js +30 -0
- package/dist/types.d.mts +6 -10
- package/package.json +15 -11
- package/src/index.ts +20 -0
- package/src/module.ts +130 -0
- package/src/runtime/adapters/defaultMediaAdapter.ts +57 -0
- package/src/runtime/components/MapoConfirmDialog.vue +5 -3
- package/src/runtime/components/MapoDetail.vue +39 -36
- package/src/runtime/components/MapoDetailLangSwitch.vue +1 -1
- package/src/runtime/components/MapoDropArea.vue +127 -0
- package/src/runtime/components/MapoLangSwitcher.vue +74 -0
- package/src/runtime/components/MapoList.vue +1 -1
- package/src/runtime/components/MapoListActions.vue +16 -10
- package/src/runtime/components/MapoListFilters.vue +5 -2
- package/src/runtime/components/MapoListQuickEdit.vue +12 -9
- package/src/runtime/components/MapoListTable.vue +26 -21
- package/src/runtime/components/MapoLogin.vue +13 -10
- package/src/runtime/components/MapoLogoutButton.vue +4 -2
- package/src/runtime/components/MapoMediaBreadcrumbs.vue +53 -0
- package/src/runtime/components/MapoMediaEditor.vue +350 -0
- package/src/runtime/components/MapoMediaFileChanger.vue +136 -0
- package/src/runtime/components/MapoMediaFolders.vue +239 -0
- package/src/runtime/components/MapoMediaGallery.vue +239 -0
- package/src/runtime/components/MapoMediaManager.vue +180 -0
- package/src/runtime/components/MapoMediaManagerDialog.vue +148 -0
- package/src/runtime/components/MapoMediaPreview.vue +111 -0
- package/src/runtime/components/MapoMediaUploader.vue +351 -0
- package/src/runtime/components/MapoMenuManager.vue +402 -0
- package/src/runtime/components/MapoMenuNodeEditor.vue +282 -0
- package/src/runtime/components/MapoMenuTreeview.vue +264 -0
- package/src/runtime/components/MapoMenuTreeviewNode.vue +234 -0
- package/src/runtime/components/MapoSidebar.vue +3 -1
- package/src/runtime/components/MapoSidebarList.vue +1 -1
- package/src/runtime/components/MapoSidebarProfile.vue +6 -2
- package/src/runtime/components/MapoThemeToggle.vue +5 -1
- package/src/runtime/components/menuDndContext.ts +22 -0
- package/src/runtime/pages/index.vue +4 -3
- package/src/runtime/pages/login.vue +0 -4
- package/src/runtime/plugins/media-adapter.ts +33 -0
- package/src/runtime/stores/media.ts +474 -0
- package/src/runtime/types/media.ts +126 -0
- package/src/runtime/types/menu.ts +105 -0
- package/dist/index.d.cts +0 -2
- package/dist/module.d.cts +0 -2
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
|
|
5
|
+
const { t } = useI18n();
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
accept?: string;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
accept: "*/*",
|
|
15
|
+
multiple: true,
|
|
16
|
+
disabled: false,
|
|
17
|
+
},
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const emit = defineEmits<{
|
|
21
|
+
files: [files: File[]];
|
|
22
|
+
}>();
|
|
23
|
+
|
|
24
|
+
const isDragging = ref(false);
|
|
25
|
+
const fileInput = ref<HTMLInputElement | null>(null);
|
|
26
|
+
let dragCounter = 0;
|
|
27
|
+
|
|
28
|
+
function onDragEnter(e: DragEvent) {
|
|
29
|
+
if (props.disabled) return;
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
dragCounter++;
|
|
32
|
+
isDragging.value = true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function onDragLeave() {
|
|
36
|
+
dragCounter--;
|
|
37
|
+
if (dragCounter <= 0) {
|
|
38
|
+
dragCounter = 0;
|
|
39
|
+
isDragging.value = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function onDrop(e: DragEvent) {
|
|
44
|
+
if (props.disabled) return;
|
|
45
|
+
isDragging.value = false;
|
|
46
|
+
dragCounter = 0;
|
|
47
|
+
const files = filterFiles(Array.from(e.dataTransfer?.files ?? []));
|
|
48
|
+
if (files.length) emit("files", files);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function onFileInput(e: Event) {
|
|
52
|
+
const input = e.target as HTMLInputElement;
|
|
53
|
+
const files = filterFiles(Array.from(input.files ?? []));
|
|
54
|
+
if (files.length) emit("files", files);
|
|
55
|
+
input.value = "";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function triggerPick() {
|
|
59
|
+
if (!props.disabled) fileInput.value?.click();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function filterFiles(files: File[]): File[] {
|
|
63
|
+
if (!props.accept || props.accept === "*/*") return files;
|
|
64
|
+
return files.filter((f) => matchesMime(f.type, props.accept));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function matchesMime(mime: string, accept: string): boolean {
|
|
68
|
+
return accept.split(",").some((pattern) => {
|
|
69
|
+
const p = pattern.trim();
|
|
70
|
+
if (p === "*/*") return true;
|
|
71
|
+
if (p.endsWith("/*")) return mime.startsWith(p.replace("/*", "/"));
|
|
72
|
+
return mime === p;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
defineExpose({ triggerPick });
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<template>
|
|
80
|
+
<div
|
|
81
|
+
class="mapo-drop-area relative"
|
|
82
|
+
:class="{
|
|
83
|
+
'mapo-drop-area--dragging': isDragging,
|
|
84
|
+
'opacity-50 pointer-events-none': disabled,
|
|
85
|
+
}"
|
|
86
|
+
@dragenter.prevent="onDragEnter"
|
|
87
|
+
@dragover.prevent
|
|
88
|
+
@dragleave="onDragLeave"
|
|
89
|
+
@drop.prevent="onDrop"
|
|
90
|
+
>
|
|
91
|
+
<input
|
|
92
|
+
ref="fileInput"
|
|
93
|
+
type="file"
|
|
94
|
+
class="sr-only"
|
|
95
|
+
:accept="accept"
|
|
96
|
+
:multiple="multiple"
|
|
97
|
+
@change="onFileInput"
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
<slot :trigger-pick="triggerPick" :is-dragging="isDragging" />
|
|
101
|
+
|
|
102
|
+
<Transition name="drop-overlay">
|
|
103
|
+
<div
|
|
104
|
+
v-if="isDragging"
|
|
105
|
+
class="pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-lg border-2 border-dashed border-primary bg-default/80"
|
|
106
|
+
>
|
|
107
|
+
<div class="flex flex-col items-center gap-2 text-primary">
|
|
108
|
+
<UIcon name="i-lucide-upload-cloud" class="size-10" />
|
|
109
|
+
<span class="text-sm font-medium">{{
|
|
110
|
+
t("mapo.dropArea.dropHere")
|
|
111
|
+
}}</span>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</Transition>
|
|
115
|
+
</div>
|
|
116
|
+
</template>
|
|
117
|
+
|
|
118
|
+
<style scoped>
|
|
119
|
+
.drop-overlay-enter-active,
|
|
120
|
+
.drop-overlay-leave-active {
|
|
121
|
+
transition: opacity 0.15s ease;
|
|
122
|
+
}
|
|
123
|
+
.drop-overlay-enter-from,
|
|
124
|
+
.drop-overlay-leave-to {
|
|
125
|
+
opacity: 0;
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import type { Ref } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* UI locale switcher — lists the locales configured in `@nuxtjs/i18n`
|
|
8
|
+
* (via `@mapomodule/i18n`) and switches the interface language with
|
|
9
|
+
* cookie persistence. Port of the v1 `LangSwitcher`.
|
|
10
|
+
*/
|
|
11
|
+
const props = withDefaults(
|
|
12
|
+
defineProps<{
|
|
13
|
+
/** Show the flag emoji derived from the locale `language` tag. */
|
|
14
|
+
flags?: boolean;
|
|
15
|
+
/** Nuxt UI USelectMenu `size` prop. */
|
|
16
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
17
|
+
}>(),
|
|
18
|
+
{ flags: true, size: "sm" },
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
interface SwitcherLocale {
|
|
22
|
+
code: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
language?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// `locales` and `setLocale` are @nuxtjs/i18n Composer extensions; the uikit
|
|
28
|
+
// package only depends on vue-i18n types, so they are typed structurally.
|
|
29
|
+
const { locale, locales, setLocale } = useI18n() as unknown as {
|
|
30
|
+
locale: Ref<string>;
|
|
31
|
+
locales: Ref<SwitcherLocale[]>;
|
|
32
|
+
setLocale: (code: string) => Promise<void>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Regional-indicator flag emoji from a BCP-47 tag (e.g. `en-US` → 🇺🇸). */
|
|
36
|
+
function getFlag(language?: string): string {
|
|
37
|
+
const region = language?.split("-").at(-1);
|
|
38
|
+
if (!region || region.length !== 2 || !/^[A-Za-z]+$/.test(region)) return "";
|
|
39
|
+
const codePoints = region
|
|
40
|
+
.toUpperCase()
|
|
41
|
+
.split("")
|
|
42
|
+
.map((char) => 127397 + char.charCodeAt(0));
|
|
43
|
+
return String.fromCodePoint(...codePoints);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const items = computed(() =>
|
|
47
|
+
locales.value.map((l) => ({
|
|
48
|
+
label:
|
|
49
|
+
props.flags && getFlag(l.language)
|
|
50
|
+
? `${getFlag(l.language)} ${l.name ?? l.code.toUpperCase()}`
|
|
51
|
+
: (l.name ?? l.code.toUpperCase()),
|
|
52
|
+
value: l.code,
|
|
53
|
+
})),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const current = computed({
|
|
57
|
+
get: () => locale.value,
|
|
58
|
+
set: (code: string) => {
|
|
59
|
+
if (code && code !== locale.value) setLocale(code);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<USelectMenu
|
|
66
|
+
v-model="current"
|
|
67
|
+
:items="items"
|
|
68
|
+
value-key="value"
|
|
69
|
+
label-key="label"
|
|
70
|
+
:size="size"
|
|
71
|
+
:search-input="false"
|
|
72
|
+
class="w-40"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
} from "../types/list.js";
|
|
12
12
|
import type { AnyFieldDescriptor, FieldRegistry } from "@mapomodule/form/types";
|
|
13
13
|
import { debounce } from "@mapomodule/utils";
|
|
14
|
-
import { useRoute, useRouter } from "
|
|
14
|
+
import { useRoute, useRouter } from "#app";
|
|
15
15
|
|
|
16
16
|
const props = withDefaults(
|
|
17
17
|
defineProps<{
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends object">
|
|
2
2
|
import { ref, computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import type { ActionDescriptor } from "../types/list.js";
|
|
4
5
|
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
5
6
|
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
6
7
|
import { usePermissions } from "@mapomodule/store/runtime/composables/usePermissions";
|
|
7
8
|
import { useCrud } from "@mapomodule/core/runtime/api/crud";
|
|
9
|
+
import { getErrorDetail } from "@mapomodule/core/runtime/utils/fetchError";
|
|
8
10
|
|
|
9
11
|
const props = withDefaults(
|
|
10
12
|
defineProps<{
|
|
@@ -29,6 +31,7 @@ defineSlots<{
|
|
|
29
31
|
append(): any;
|
|
30
32
|
}>();
|
|
31
33
|
|
|
34
|
+
const { t } = useI18n();
|
|
32
35
|
const snack = useSnackStore();
|
|
33
36
|
const confirm = useConfirmStore();
|
|
34
37
|
const crud = useCrud<T>(props.endpoint);
|
|
@@ -37,7 +40,7 @@ const isRunning = ref(false);
|
|
|
37
40
|
|
|
38
41
|
const defaultActions = computed<ActionDescriptor<T>[]>(() => [
|
|
39
42
|
{
|
|
40
|
-
label: "
|
|
43
|
+
label: t("mapo.listActions.permanentDelete"),
|
|
41
44
|
handler: async ({ selection }) => {
|
|
42
45
|
if (!selection) return;
|
|
43
46
|
await Promise.all(
|
|
@@ -95,9 +98,11 @@ async function runAction() {
|
|
|
95
98
|
title: action.label,
|
|
96
99
|
message:
|
|
97
100
|
props.selection === "all"
|
|
98
|
-
? "
|
|
99
|
-
:
|
|
100
|
-
|
|
101
|
+
? t("mapo.listActions.confirmBulk")
|
|
102
|
+
: t("mapo.listActions.confirmBulkCount", {
|
|
103
|
+
count: (props.selection as T[]).length,
|
|
104
|
+
}),
|
|
105
|
+
confirmText: t("mapo.confirm"),
|
|
101
106
|
dangerous: !!action.dangerous,
|
|
102
107
|
});
|
|
103
108
|
if (!ok) return;
|
|
@@ -109,13 +114,14 @@ async function runAction() {
|
|
|
109
114
|
selectionQuery: props.selectionQuery,
|
|
110
115
|
lookup: props.lookup,
|
|
111
116
|
});
|
|
112
|
-
snack.show("
|
|
117
|
+
snack.show(t("mapo.listActions.actionCompleted"), "success");
|
|
113
118
|
emit("actionCompleted");
|
|
114
119
|
selectedLabel.value = undefined;
|
|
115
120
|
} catch (err: unknown) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
snack.show(
|
|
122
|
+
getErrorDetail(err) ?? t("mapo.listActions.actionFailed"),
|
|
123
|
+
"error",
|
|
124
|
+
);
|
|
119
125
|
} finally {
|
|
120
126
|
isRunning.value = false;
|
|
121
127
|
}
|
|
@@ -134,7 +140,7 @@ const isActive = computed(
|
|
|
134
140
|
:items="visibleActions"
|
|
135
141
|
value-key="label"
|
|
136
142
|
label-key="label"
|
|
137
|
-
placeholder="
|
|
143
|
+
:placeholder="t('mapo.listActions.bulkActions')"
|
|
138
144
|
size="sm"
|
|
139
145
|
class="min-w-48"
|
|
140
146
|
/>
|
|
@@ -145,7 +151,7 @@ const isActive = computed(
|
|
|
145
151
|
:disabled="!selectedAction || !canRun(selectedAction)"
|
|
146
152
|
@click="runAction"
|
|
147
153
|
>
|
|
148
|
-
|
|
154
|
+
{{ t("mapo.apply") }}
|
|
149
155
|
</UButton>
|
|
150
156
|
<slot name="append" />
|
|
151
157
|
</div>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, computed, watch } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import type {
|
|
4
5
|
FilterDescriptor,
|
|
5
6
|
ActiveFilter,
|
|
6
7
|
FilterChoice,
|
|
7
8
|
} from "../types/list.js";
|
|
8
9
|
|
|
10
|
+
const { t } = useI18n();
|
|
11
|
+
|
|
9
12
|
const props = defineProps<{
|
|
10
13
|
filters: FilterDescriptor[];
|
|
11
14
|
modelValue: ActiveFilter[];
|
|
@@ -188,7 +191,7 @@ const isOpen = ref(false);
|
|
|
188
191
|
color="neutral"
|
|
189
192
|
@click="removeAll"
|
|
190
193
|
>
|
|
191
|
-
|
|
194
|
+
{{ t("mapo.listFilters.clearAll") }}
|
|
192
195
|
</UButton>
|
|
193
196
|
|
|
194
197
|
<!-- Filter dropdown button -->
|
|
@@ -201,7 +204,7 @@ const isOpen = ref(false);
|
|
|
201
204
|
:disabled="disabled"
|
|
202
205
|
trailing-icon=""
|
|
203
206
|
>
|
|
204
|
-
|
|
207
|
+
{{ t("mapo.listFilters.filters") }}
|
|
205
208
|
</UButton>
|
|
206
209
|
|
|
207
210
|
<template #content>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends object">
|
|
2
2
|
import { ref, computed, watch } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import type { Ref } from "vue";
|
|
4
5
|
import type { AnyFieldDescriptor, FieldRegistry } from "@mapomodule/form/types";
|
|
5
6
|
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
6
7
|
import { useCrud } from "@mapomodule/core/runtime/api/crud";
|
|
8
|
+
import { getErrorDetail } from "@mapomodule/core/runtime/utils/fetchError";
|
|
7
9
|
|
|
8
10
|
const props = withDefaults(
|
|
9
11
|
defineProps<{
|
|
@@ -45,6 +47,7 @@ defineSlots<{
|
|
|
45
47
|
extra(props: { model: T }): any;
|
|
46
48
|
}>();
|
|
47
49
|
|
|
50
|
+
const { t } = useI18n();
|
|
48
51
|
const snack = useSnackStore();
|
|
49
52
|
const crud = useCrud<T>(props.endpoint);
|
|
50
53
|
|
|
@@ -77,7 +80,7 @@ watch(
|
|
|
77
80
|
try {
|
|
78
81
|
model.value = await crud.detail(id as string | number);
|
|
79
82
|
} catch {
|
|
80
|
-
snack.show("
|
|
83
|
+
snack.show(t("mapo.loadItemError"), "error");
|
|
81
84
|
isOpen.value = false;
|
|
82
85
|
} finally {
|
|
83
86
|
loading.value = false;
|
|
@@ -91,7 +94,7 @@ async function save() {
|
|
|
91
94
|
// Offline: no backend roundtrip — emit the locally edited model and let
|
|
92
95
|
// the parent splice it back into the source array.
|
|
93
96
|
if (props.offline) {
|
|
94
|
-
snack.show("
|
|
97
|
+
snack.show(t("mapo.saveSuccess"), "success");
|
|
95
98
|
emit("saved", { ...model.value } as T);
|
|
96
99
|
isOpen.value = false;
|
|
97
100
|
return;
|
|
@@ -100,13 +103,11 @@ async function save() {
|
|
|
100
103
|
props.itemId != null
|
|
101
104
|
? await crud.partialUpdate(props.itemId as string | number, model.value)
|
|
102
105
|
: await crud.create(model.value);
|
|
103
|
-
snack.show("
|
|
106
|
+
snack.show(t("mapo.saveSuccess"), "success");
|
|
104
107
|
emit("saved", result);
|
|
105
108
|
isOpen.value = false;
|
|
106
109
|
} catch (err: unknown) {
|
|
107
|
-
|
|
108
|
-
?.response?.data?.detail;
|
|
109
|
-
snack.show(detail ?? "Failed to save", "error");
|
|
110
|
+
snack.show(getErrorDetail(err) ?? t("mapo.saveError"), "error");
|
|
110
111
|
} finally {
|
|
111
112
|
saving.value = false;
|
|
112
113
|
}
|
|
@@ -119,7 +120,9 @@ async function save() {
|
|
|
119
120
|
<div class="p-6 space-y-4">
|
|
120
121
|
<div class="flex items-center justify-between">
|
|
121
122
|
<h3 class="text-base font-semibold text-highlighted">
|
|
122
|
-
{{
|
|
123
|
+
{{
|
|
124
|
+
itemId != null ? t("mapo.edit") : t("mapo.listQuickEdit.newItem")
|
|
125
|
+
}}
|
|
123
126
|
</h3>
|
|
124
127
|
<UButton
|
|
125
128
|
size="xs"
|
|
@@ -150,10 +153,10 @@ async function save() {
|
|
|
150
153
|
|
|
151
154
|
<div class="flex justify-end gap-2 pt-2">
|
|
152
155
|
<UButton variant="ghost" color="neutral" @click="isOpen = false">
|
|
153
|
-
|
|
156
|
+
{{ t("mapo.cancel") }}
|
|
154
157
|
</UButton>
|
|
155
158
|
<UButton color="primary" :loading="saving" @click="save">
|
|
156
|
-
|
|
159
|
+
{{ t("mapo.save") }}
|
|
157
160
|
</UButton>
|
|
158
161
|
</div>
|
|
159
162
|
</template>
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
useSlots,
|
|
10
10
|
} from "vue";
|
|
11
11
|
import type { Ref } from "vue";
|
|
12
|
+
import { useI18n } from "vue-i18n";
|
|
12
13
|
import type { TableColumn } from "@nuxt/ui";
|
|
13
14
|
import type { SortingState, PaginationState } from "@tanstack/vue-table";
|
|
14
15
|
import type { ListColumn } from "../types/list.js";
|
|
@@ -18,7 +19,7 @@ import { usePermissions } from "@mapomodule/store/runtime/composables/usePermiss
|
|
|
18
19
|
import { useCrud } from "@mapomodule/core/runtime/api/crud";
|
|
19
20
|
import type { AnyFieldDescriptor, FieldRegistry } from "@mapomodule/form/types";
|
|
20
21
|
import { debounce, splitEndpointParams } from "@mapomodule/utils";
|
|
21
|
-
import { useRoute, useRouter } from "
|
|
22
|
+
import { useRoute, useRouter } from "#app";
|
|
22
23
|
|
|
23
24
|
const props = withDefaults(
|
|
24
25
|
defineProps<{
|
|
@@ -139,6 +140,7 @@ const slots = useSlots();
|
|
|
139
140
|
// which is both accurate and avoids any implicit-any errors at the call sites.
|
|
140
141
|
const atKey = (item: T, key: string): T[keyof T] => item[key as keyof T];
|
|
141
142
|
|
|
143
|
+
const { t } = useI18n();
|
|
142
144
|
const snack = useSnackStore();
|
|
143
145
|
const confirm = useConfirmStore();
|
|
144
146
|
|
|
@@ -328,9 +330,9 @@ const quickEditLocalItem = computed<T | null>(() => {
|
|
|
328
330
|
// --- Delete ---
|
|
329
331
|
async function deleteRow(item: T) {
|
|
330
332
|
const ok = await confirm.ask({
|
|
331
|
-
title: "
|
|
332
|
-
message: "
|
|
333
|
-
confirmText: "
|
|
333
|
+
title: t("mapo.listTable.deleteItemTitle"),
|
|
334
|
+
message: t("mapo.confirmDelete"),
|
|
335
|
+
confirmText: t("mapo.delete"),
|
|
334
336
|
dangerous: true,
|
|
335
337
|
});
|
|
336
338
|
if (!ok) return;
|
|
@@ -340,16 +342,16 @@ async function deleteRow(item: T) {
|
|
|
340
342
|
String(atKey(r, props.lookup)) !== String(atKey(item, props.lookup)),
|
|
341
343
|
);
|
|
342
344
|
emit("update:items", next);
|
|
343
|
-
snack.show("
|
|
345
|
+
snack.show(t("mapo.listTable.itemDeleted"), "success");
|
|
344
346
|
return;
|
|
345
347
|
}
|
|
346
348
|
try {
|
|
347
349
|
await crud.delete(atKey(item, props.lookup) as string | number);
|
|
348
|
-
snack.show("
|
|
350
|
+
snack.show(t("mapo.listTable.itemDeleted"), "success");
|
|
349
351
|
if (hybridMode.value) hybridLoaded.value = false;
|
|
350
352
|
refresh();
|
|
351
353
|
} catch {
|
|
352
|
-
snack.show("
|
|
354
|
+
snack.show(t("mapo.listTable.deleteItemError"), "error");
|
|
353
355
|
}
|
|
354
356
|
}
|
|
355
357
|
|
|
@@ -454,13 +456,13 @@ async function onDrop(fromIdx: number, toIdx: number) {
|
|
|
454
456
|
atKey(moved, props.lookup) as string | number,
|
|
455
457
|
atKey(target, props.lookup) as string | number,
|
|
456
458
|
);
|
|
457
|
-
snack.show("
|
|
459
|
+
snack.show(t("mapo.listTable.orderSaved"), "success");
|
|
458
460
|
if (hybridMode.value) {
|
|
459
461
|
hybridLoaded.value = false;
|
|
460
462
|
refresh();
|
|
461
463
|
}
|
|
462
464
|
} catch {
|
|
463
|
-
snack.show("
|
|
465
|
+
snack.show(t("mapo.listTable.orderError"), "error");
|
|
464
466
|
refresh();
|
|
465
467
|
}
|
|
466
468
|
}
|
|
@@ -554,7 +556,7 @@ async function fetchAll() {
|
|
|
554
556
|
fullDataset.value = nextItems;
|
|
555
557
|
hybridLoaded.value = true;
|
|
556
558
|
} catch {
|
|
557
|
-
snack.show("
|
|
559
|
+
snack.show(t("mapo.loadError"), "error");
|
|
558
560
|
} finally {
|
|
559
561
|
loading.value = false;
|
|
560
562
|
}
|
|
@@ -626,7 +628,7 @@ async function refresh() {
|
|
|
626
628
|
rows.value = nextItems;
|
|
627
629
|
total.value = nextTotal;
|
|
628
630
|
} catch {
|
|
629
|
-
snack.show("
|
|
631
|
+
snack.show(t("mapo.loadError"), "error");
|
|
630
632
|
} finally {
|
|
631
633
|
loading.value = false;
|
|
632
634
|
}
|
|
@@ -682,14 +684,14 @@ const tableColumns = computed<TableColumn<T>[]>(() => {
|
|
|
682
684
|
modelValue: isAllSelected.value,
|
|
683
685
|
indeterminate: isIndeterminate.value,
|
|
684
686
|
"onUpdate:modelValue": toggleAll,
|
|
685
|
-
ariaLabel: "
|
|
687
|
+
ariaLabel: t("mapo.listTable.selectAllRows"),
|
|
686
688
|
}),
|
|
687
689
|
cell: ({ row }: { row: { original: T } }) => {
|
|
688
690
|
const k = pkOf(row.original);
|
|
689
691
|
return h(UCheckbox, {
|
|
690
692
|
modelValue: !!rowSelection.value[k],
|
|
691
693
|
"onUpdate:modelValue": () => toggleRowByKey(k),
|
|
692
|
-
ariaLabel: "
|
|
694
|
+
ariaLabel: t("mapo.listTable.selectRow"),
|
|
693
695
|
});
|
|
694
696
|
},
|
|
695
697
|
meta: { class: { th: "w-10", td: "w-10" } },
|
|
@@ -709,8 +711,8 @@ const tableColumns = computed<TableColumn<T>[]>(() => {
|
|
|
709
711
|
: "cursor-not-allowed text-muted opacity-30",
|
|
710
712
|
draggable: canReorder.value,
|
|
711
713
|
title: canReorder.value
|
|
712
|
-
? "
|
|
713
|
-
: "
|
|
714
|
+
? t("mapo.listTable.dragToReorder")
|
|
715
|
+
: t("mapo.listTable.clearToReorder"),
|
|
714
716
|
onDragstart: (e: DragEvent) => {
|
|
715
717
|
e.dataTransfer?.setData("text/plain", "");
|
|
716
718
|
onDragStart(row.index);
|
|
@@ -815,7 +817,7 @@ const sortingOptions = computed(() => ({
|
|
|
815
817
|
<div v-if="searchable" class="flex items-center gap-2">
|
|
816
818
|
<UInput
|
|
817
819
|
:model-value="search"
|
|
818
|
-
placeholder="
|
|
820
|
+
:placeholder="t('mapo.search')"
|
|
819
821
|
icon="i-lucide-search"
|
|
820
822
|
size="sm"
|
|
821
823
|
class="max-w-xs"
|
|
@@ -839,7 +841,7 @@ const sortingOptions = computed(() => ({
|
|
|
839
841
|
:pagination-options="paginationOptions"
|
|
840
842
|
:sorting="sorting"
|
|
841
843
|
:sorting-options="sortingOptions"
|
|
842
|
-
empty="
|
|
844
|
+
:empty="t('mapo.listTable.noItems')"
|
|
843
845
|
@update:pagination="pagination = $event ?? pagination"
|
|
844
846
|
@update:sorting="sorting = $event ?? sorting"
|
|
845
847
|
>
|
|
@@ -847,7 +849,7 @@ const sortingOptions = computed(() => ({
|
|
|
847
849
|
<slot name="dtable.empty">
|
|
848
850
|
<div class="flex flex-col items-center gap-2 py-8 text-muted">
|
|
849
851
|
<UIcon name="i-lucide-inbox" class="h-8 w-8" />
|
|
850
|
-
<span class="text-sm">
|
|
852
|
+
<span class="text-sm">{{ t("mapo.listTable.noItems") }}</span>
|
|
851
853
|
</div>
|
|
852
854
|
</slot>
|
|
853
855
|
</template>
|
|
@@ -867,11 +869,11 @@ const sortingOptions = computed(() => ({
|
|
|
867
869
|
|
|
868
870
|
<!-- Pagination controls -->
|
|
869
871
|
<div class="flex items-center justify-between text-sm text-muted">
|
|
870
|
-
<span>{{ total }}
|
|
872
|
+
<span>{{ t("mapo.listTable.totalItems", { total }) }}</span>
|
|
871
873
|
<UPagination
|
|
872
874
|
:model-value="pagination.pageIndex + 1"
|
|
873
875
|
:total="total"
|
|
874
|
-
:page
|
|
876
|
+
:items-per-page="pagination.pageSize"
|
|
875
877
|
size="sm"
|
|
876
878
|
@update:model-value="
|
|
877
879
|
pagination = { ...pagination, pageIndex: $event - 1 }
|
|
@@ -880,7 +882,10 @@ const sortingOptions = computed(() => ({
|
|
|
880
882
|
<USelect
|
|
881
883
|
:model-value="pagination.pageSize"
|
|
882
884
|
:items="
|
|
883
|
-
pageSizeOptions.map((n) => ({
|
|
885
|
+
pageSizeOptions.map((n) => ({
|
|
886
|
+
label: t('mapo.listTable.perPage', { n }),
|
|
887
|
+
value: n,
|
|
888
|
+
}))
|
|
884
889
|
"
|
|
885
890
|
size="xs"
|
|
886
891
|
class="w-28"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { reactive, ref } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { useMapoAuth } from "@mapomodule/core/runtime/auth/useMapoAuth";
|
|
4
|
-
import { useRoute } from "
|
|
5
|
-
import { navigateTo } from "#app";
|
|
5
|
+
import { useRoute, navigateTo } from "#app";
|
|
6
6
|
|
|
7
7
|
defineSlots<{
|
|
8
8
|
/** Left decorative panel (shown lg+). Replace with your own branding. */
|
|
@@ -17,6 +17,7 @@ defineSlots<{
|
|
|
17
17
|
footer(): unknown;
|
|
18
18
|
}>();
|
|
19
19
|
|
|
20
|
+
const { t } = useI18n();
|
|
20
21
|
const { login } = useMapoAuth();
|
|
21
22
|
const route = useRoute();
|
|
22
23
|
|
|
@@ -41,7 +42,7 @@ async function submit() {
|
|
|
41
42
|
if (data.username?.length) fieldErrors.username = data.username[0];
|
|
42
43
|
if (data.password?.length) fieldErrors.password = data.password[0];
|
|
43
44
|
} else {
|
|
44
|
-
error.value = "
|
|
45
|
+
error.value = t("mapo.login.invalidCredentials");
|
|
45
46
|
}
|
|
46
47
|
} finally {
|
|
47
48
|
loading.value = false;
|
|
@@ -77,9 +78,11 @@ async function submit() {
|
|
|
77
78
|
<UIcon name="i-lucide-layers" class="size-10 text-white" />
|
|
78
79
|
</div>
|
|
79
80
|
<div class="space-y-2">
|
|
80
|
-
<h2 class="text-3xl font-bold tracking-tight">
|
|
81
|
+
<h2 class="text-3xl font-bold tracking-tight">
|
|
82
|
+
{{ t("mapo.login.welcome") }}
|
|
83
|
+
</h2>
|
|
81
84
|
<p class="text-white/70 text-sm leading-relaxed max-w-xs">
|
|
82
|
-
|
|
85
|
+
{{ t("mapo.login.tagline") }}
|
|
83
86
|
</p>
|
|
84
87
|
</div>
|
|
85
88
|
<div class="flex gap-2 flex-wrap justify-center">
|
|
@@ -125,10 +128,10 @@ async function submit() {
|
|
|
125
128
|
</div>
|
|
126
129
|
<div>
|
|
127
130
|
<h1 class="text-2xl font-bold text-highlighted tracking-tight">
|
|
128
|
-
|
|
131
|
+
{{ t("mapo.signIn") }}
|
|
129
132
|
</h1>
|
|
130
133
|
<p class="text-sm text-muted mt-1">
|
|
131
|
-
|
|
134
|
+
{{ t("mapo.login.subtitle") }}
|
|
132
135
|
</p>
|
|
133
136
|
</div>
|
|
134
137
|
</div>
|
|
@@ -139,7 +142,7 @@ async function submit() {
|
|
|
139
142
|
<UCard class="shadow-xl ring-1 ring-default/60">
|
|
140
143
|
<form class="space-y-5" @submit.prevent="submit">
|
|
141
144
|
<UFormField
|
|
142
|
-
label="
|
|
145
|
+
:label="t('mapo.username')"
|
|
143
146
|
name="username"
|
|
144
147
|
:error="fieldErrors.username"
|
|
145
148
|
>
|
|
@@ -156,7 +159,7 @@ async function submit() {
|
|
|
156
159
|
</UFormField>
|
|
157
160
|
|
|
158
161
|
<UFormField
|
|
159
|
-
label="
|
|
162
|
+
:label="t('mapo.password')"
|
|
160
163
|
name="password"
|
|
161
164
|
:error="fieldErrors.password"
|
|
162
165
|
>
|
|
@@ -195,7 +198,7 @@ async function submit() {
|
|
|
195
198
|
:disabled="!form.username || !form.password"
|
|
196
199
|
block
|
|
197
200
|
>
|
|
198
|
-
|
|
201
|
+
{{ t("mapo.signIn") }}
|
|
199
202
|
</UButton>
|
|
200
203
|
</form>
|
|
201
204
|
</UCard>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useI18n } from "vue-i18n";
|
|
2
3
|
import { useMapoAuth } from "@mapomodule/core/runtime/auth/useMapoAuth";
|
|
3
4
|
|
|
4
5
|
withDefaults(
|
|
@@ -27,6 +28,7 @@ withDefaults(
|
|
|
27
28
|
},
|
|
28
29
|
);
|
|
29
30
|
|
|
31
|
+
const { t } = useI18n();
|
|
30
32
|
const { logout } = useMapoAuth();
|
|
31
33
|
</script>
|
|
32
34
|
|
|
@@ -36,11 +38,11 @@ const { logout } = useMapoAuth();
|
|
|
36
38
|
:color="color"
|
|
37
39
|
:size="size"
|
|
38
40
|
icon="i-lucide-log-out"
|
|
39
|
-
:aria-label="iconOnly ? '
|
|
41
|
+
:aria-label="iconOnly ? t('mapo.logout') : undefined"
|
|
40
42
|
@click="logout()"
|
|
41
43
|
>
|
|
42
44
|
<span v-if="!iconOnly">
|
|
43
|
-
<slot>
|
|
45
|
+
<slot>{{ t("mapo.logout") }}</slot>
|
|
44
46
|
</span>
|
|
45
47
|
</UButton>
|
|
46
48
|
</template>
|