@mapomodule/uikit 2.0.0-beta.7 → 2.0.0-experimental.1
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 +47 -174
- package/dist/__tests__/MapoConfirmDialog.component.test.d.ts +2 -0
- package/dist/__tests__/MapoConfirmDialog.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoDetail.component.test.d.ts +2 -0
- package/dist/__tests__/MapoDetail.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoDetailLangSwitch.component.test.d.ts +2 -0
- package/dist/__tests__/MapoDetailLangSwitch.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoListActions.component.test.d.ts +2 -0
- package/dist/__tests__/MapoListActions.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoListTable.component.test.d.ts +2 -0
- package/dist/__tests__/MapoListTable.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoSnackBar.component.test.d.ts +2 -0
- package/dist/__tests__/MapoSnackBar.component.test.d.ts.map +1 -0
- package/dist/__tests__/__mocks__/nuxt-app.d.ts +9 -0
- package/dist/__tests__/__mocks__/nuxt-app.d.ts.map +1 -0
- package/dist/__tests__/formValues.test.d.ts +2 -0
- package/dist/__tests__/formValues.test.d.ts.map +1 -0
- package/dist/__tests__/langInfo.test.d.ts +2 -0
- package/dist/__tests__/langInfo.test.d.ts.map +1 -0
- package/dist/__tests__/listTable.test.d.ts +2 -0
- package/dist/__tests__/listTable.test.d.ts.map +1 -0
- package/dist/__tests__/mediaLanguages.test.d.ts +2 -0
- package/dist/__tests__/mediaLanguages.test.d.ts.map +1 -0
- package/dist/__tests__/runtimePages.test.d.ts +2 -0
- package/dist/__tests__/runtimePages.test.d.ts.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/module.d.mts +2 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +23 -2
- package/dist/runtime/assets/main.css +1 -1
- package/dist/runtime/components/MapoConfirmDialog.vue +23 -4
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoDetail.vue +301 -63
- package/dist/runtime/components/MapoDetail.vue.d.ts +191 -9
- package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoDetailExtensions.vue +24 -0
- package/dist/runtime/components/MapoDetailExtensions.vue.d.ts +15 -0
- package/dist/runtime/components/MapoDetailExtensions.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue +22 -26
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts +4 -3
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoDropArea.vue +5 -1
- package/dist/runtime/components/MapoDropArea.vue.d.ts +1 -1
- package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -1
- 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 +7 -3
- package/dist/runtime/components/MapoList.vue.d.ts +14 -4
- package/dist/runtime/components/MapoList.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListActions.vue +27 -13
- package/dist/runtime/components/MapoListActions.vue.d.ts +4 -0
- package/dist/runtime/components/MapoListActions.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListFilters.vue +4 -2
- package/dist/runtime/components/MapoListFilters.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListQuickEdit.vue +12 -8
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListTable.vue +116 -45
- package/dist/runtime/components/MapoListTable.vue.d.ts +11 -6
- package/dist/runtime/components/MapoListTable.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoLogin.vue +13 -10
- package/dist/runtime/components/MapoLogin.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoLogoutButton.vue +4 -2
- package/dist/runtime/components/MapoLogoutButton.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue +3 -1
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaEditor.vue +36 -20
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts +1 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaFileChanger.vue +7 -3
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaFolders.vue +36 -14
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaGallery.vue +15 -5
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaManager.vue +17 -7
- package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaManagerDialog.vue +8 -4
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaUploader.vue +53 -29
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMenuManager.vue +293 -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/MapoSidebar.vue +3 -1
- package/dist/runtime/components/MapoSidebar.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoSidebarList.vue +1 -1
- package/dist/runtime/components/MapoSidebarProfile.vue +6 -2
- package/dist/runtime/components/MapoSidebarProfile.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoSnackBar.vue +11 -0
- package/dist/runtime/components/MapoSnackBar.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoThemeToggle.vue +5 -1
- package/dist/runtime/components/MapoThemeToggle.vue.d.ts.map +1 -1
- 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/composables/defineDetailExtension.d.ts +32 -0
- package/dist/runtime/composables/defineDetailExtension.d.ts.map +1 -0
- package/dist/runtime/composables/defineDetailExtension.js +34 -0
- package/dist/runtime/composables/useMapoDetail.d.ts +18 -0
- package/dist/runtime/composables/useMapoDetail.d.ts.map +1 -0
- package/dist/runtime/composables/useMapoDetail.js +5 -0
- package/dist/runtime/page-meta.nuxt.d.ts +4 -0
- package/dist/runtime/pages/index.vue +4 -2
- package/dist/runtime/pages/index.vue.d.ts.map +1 -1
- package/dist/runtime/plugins/media-adapter.d.ts.map +1 -1
- package/dist/runtime/plugins/media-adapter.js +2 -1
- package/dist/runtime/stores/media.d.ts +8 -2
- package/dist/runtime/stores/media.d.ts.map +1 -1
- package/dist/runtime/stores/media.js +45 -13
- package/dist/runtime/types/detail.d.ts +167 -0
- package/dist/runtime/types/detail.d.ts.map +1 -0
- package/dist/runtime/types/detail.js +0 -0
- package/dist/runtime/types/list.d.ts +10 -2
- package/dist/runtime/types/list.d.ts.map +1 -1
- 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/runtime/utils/formValues.d.ts +8 -0
- package/dist/runtime/utils/formValues.d.ts.map +1 -0
- package/dist/runtime/utils/formValues.js +19 -0
- package/dist/runtime/utils/langInfo.d.ts +30 -0
- package/dist/runtime/utils/langInfo.d.ts.map +1 -0
- package/dist/runtime/utils/langInfo.js +8 -0
- package/dist/runtime/utils/listTable.d.ts +29 -0
- package/dist/runtime/utils/listTable.d.ts.map +1 -0
- package/dist/runtime/utils/listTable.js +21 -0
- package/package.json +12 -10
- package/src/__tests__/MapoConfirmDialog.component.test.ts +165 -0
- package/src/__tests__/MapoDetail.component.test.ts +1107 -0
- package/src/__tests__/MapoDetailLangSwitch.component.test.ts +145 -0
- package/src/__tests__/MapoListActions.component.test.ts +175 -0
- package/src/__tests__/MapoListTable.component.test.ts +504 -0
- package/src/__tests__/MapoSnackBar.component.test.ts +79 -0
- package/src/__tests__/__mocks__/nuxt-app.ts +8 -0
- package/src/__tests__/formValues.test.ts +31 -0
- package/src/__tests__/langInfo.test.ts +48 -0
- package/src/__tests__/listTable.test.ts +82 -0
- package/src/__tests__/mediaLanguages.test.ts +66 -0
- package/src/__tests__/runtimePages.test.ts +17 -0
- package/src/index.ts +20 -0
- package/src/module.ts +29 -0
- package/src/runtime/assets/main.css +13 -0
- package/src/runtime/components/MapoConfirmDialog.vue +33 -4
- package/src/runtime/components/MapoDetail.vue +520 -89
- package/src/runtime/components/MapoDetailExtensions.vue +39 -0
- package/src/runtime/components/MapoDetailLangSwitch.vue +27 -28
- package/src/runtime/components/MapoDropArea.vue +6 -1
- package/src/runtime/components/MapoLangSwitcher.vue +74 -0
- package/src/runtime/components/MapoList.vue +21 -6
- package/src/runtime/components/MapoListActions.vue +32 -14
- package/src/runtime/components/MapoListFilters.vue +5 -2
- package/src/runtime/components/MapoListQuickEdit.vue +12 -9
- package/src/runtime/components/MapoListTable.vue +147 -55
- package/src/runtime/components/MapoLogin.vue +13 -10
- package/src/runtime/components/MapoLogoutButton.vue +4 -2
- package/src/runtime/components/MapoMediaBreadcrumbs.vue +3 -1
- package/src/runtime/components/MapoMediaEditor.vue +43 -20
- package/src/runtime/components/MapoMediaFileChanger.vue +8 -3
- package/src/runtime/components/MapoMediaFolders.vue +37 -15
- package/src/runtime/components/MapoMediaGallery.vue +17 -5
- package/src/runtime/components/MapoMediaManager.vue +17 -7
- package/src/runtime/components/MapoMediaManagerDialog.vue +10 -4
- package/src/runtime/components/MapoMediaUploader.vue +60 -29
- package/src/runtime/components/MapoMenuManager.vue +437 -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/MapoSnackBar.vue +12 -0
- package/src/runtime/components/MapoThemeToggle.vue +5 -1
- package/src/runtime/components/menuDndContext.ts +22 -0
- package/src/runtime/composables/defineDetailExtension.ts +78 -0
- package/src/runtime/composables/useMapoDetail.ts +24 -0
- package/src/runtime/page-meta.nuxt.d.ts +4 -0
- package/src/runtime/pages/index.vue +5 -2
- package/src/runtime/plugins/media-adapter.ts +9 -5
- package/src/runtime/stores/media.ts +61 -13
- package/src/runtime/types/detail.ts +178 -0
- package/src/runtime/types/list.ts +10 -2
- package/src/runtime/types/menu.ts +105 -0
- package/src/runtime/utils/formValues.ts +28 -0
- package/src/runtime/utils/langInfo.ts +38 -0
- package/src/runtime/utils/listTable.ts +54 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, watch, computed } from "vue";
|
|
2
|
+
import { ref, watch, computed, onMounted } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { useRuntimeConfig } from "#app";
|
|
4
5
|
import {
|
|
5
6
|
humanFileSize,
|
|
@@ -11,11 +12,13 @@ import { usePermissions } from "@mapomodule/store/runtime/composables/usePermiss
|
|
|
11
12
|
import { useMediaStore } from "../stores/media.js";
|
|
12
13
|
import type { MediaItem } from "../types/media.js";
|
|
13
14
|
|
|
14
|
-
defineProps<{
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
/** Overrides the languages read from the endpoint. Rarely needed. */
|
|
15
17
|
languages?: string[];
|
|
16
18
|
defaultLang?: string;
|
|
17
19
|
}>();
|
|
18
20
|
|
|
21
|
+
const { t } = useI18n();
|
|
19
22
|
const store = useMediaStore();
|
|
20
23
|
|
|
21
24
|
// Model-permission gating (legacy parity): edit/delete only with the
|
|
@@ -33,6 +36,18 @@ const saving = ref(false);
|
|
|
33
36
|
const newFile = ref<File | null>(null);
|
|
34
37
|
const maintainUrl = ref(false);
|
|
35
38
|
const currentLang = ref("");
|
|
39
|
+
|
|
40
|
+
// The languages actually offered. An explicit prop wins; otherwise they come
|
|
41
|
+
// from the media endpoint's own OPTIONS metadata, so a host page never has to
|
|
42
|
+
// restate what the backend already knows — and a media model nobody registered
|
|
43
|
+
// for translation shows no switcher rather than tabs whose values it discards.
|
|
44
|
+
const activeLangs = computed(() =>
|
|
45
|
+
props.languages?.length ? props.languages : store.languages,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
store.deriveLanguages();
|
|
50
|
+
});
|
|
36
51
|
// Pristine copy taken when entering edit mode, restored on Cancel — the form
|
|
37
52
|
// mutates store.editMedia directly, so without this Cancel would leave the
|
|
38
53
|
// unsaved edits visible in the info panel (legacy used deepClone the same way).
|
|
@@ -59,15 +74,19 @@ const metaRows = computed(() => {
|
|
|
59
74
|
if (!media.value) return [];
|
|
60
75
|
const m = media.value;
|
|
61
76
|
return [
|
|
62
|
-
{ label: "File", value: m.file?.split("/").pop() ?? "", isUrl: false },
|
|
63
|
-
{ label: "MIME", value: m.mime_type, isUrl: false },
|
|
64
77
|
{
|
|
65
|
-
label: "
|
|
78
|
+
label: t("mapo.file"),
|
|
79
|
+
value: m.file?.split("/").pop() ?? "",
|
|
80
|
+
isUrl: false,
|
|
81
|
+
},
|
|
82
|
+
{ label: t("mapo.mime"), value: m.mime_type, isUrl: false },
|
|
83
|
+
{
|
|
84
|
+
label: t("mapo.size"),
|
|
66
85
|
value: m.size ? humanFileSize(m.size) : "—",
|
|
67
86
|
isUrl: false,
|
|
68
87
|
},
|
|
69
|
-
{ label: "
|
|
70
|
-
{ label: "
|
|
88
|
+
{ label: t("mapo.created"), value: formatDate(m.created), isUrl: false },
|
|
89
|
+
{ label: t("mapo.url"), value: m.file, isUrl: true },
|
|
71
90
|
];
|
|
72
91
|
});
|
|
73
92
|
|
|
@@ -75,9 +94,13 @@ const editFields = computed(() => {
|
|
|
75
94
|
const lang = currentLang.value;
|
|
76
95
|
const prefix = lang ? `translations.${lang}.` : "";
|
|
77
96
|
return [
|
|
78
|
-
{ path: `${prefix}title`, label: "
|
|
79
|
-
{ path: `${prefix}alt_text`, label: "
|
|
80
|
-
{
|
|
97
|
+
{ path: `${prefix}title`, label: t("mapo.title"), type: "text" },
|
|
98
|
+
{ path: `${prefix}alt_text`, label: t("mapo.altTag"), type: "text" },
|
|
99
|
+
{
|
|
100
|
+
path: `${prefix}description`,
|
|
101
|
+
label: t("mapo.description"),
|
|
102
|
+
type: "textarea",
|
|
103
|
+
},
|
|
81
104
|
];
|
|
82
105
|
});
|
|
83
106
|
|
|
@@ -174,7 +197,7 @@ function formatDate(dateStr: string): string {
|
|
|
174
197
|
color="neutral"
|
|
175
198
|
@click="startEditing"
|
|
176
199
|
>
|
|
177
|
-
|
|
200
|
+
{{ t("mapo.edit") }}
|
|
178
201
|
</UButton>
|
|
179
202
|
<UButton
|
|
180
203
|
icon="i-lucide-external-link"
|
|
@@ -183,7 +206,7 @@ function formatDate(dateStr: string): string {
|
|
|
183
206
|
color="neutral"
|
|
184
207
|
:href="media.file"
|
|
185
208
|
target="_blank"
|
|
186
|
-
title="
|
|
209
|
+
:title="t('mapo.mediaEditor.openInNewTab')"
|
|
187
210
|
/>
|
|
188
211
|
</div>
|
|
189
212
|
|
|
@@ -198,7 +221,7 @@ function formatDate(dateStr: string): string {
|
|
|
198
221
|
<p
|
|
199
222
|
class="mb-2 text-xs font-semibold uppercase tracking-wide text-dimmed"
|
|
200
223
|
>
|
|
201
|
-
|
|
224
|
+
{{ t("mapo.mediaEditor.details") }}
|
|
202
225
|
</p>
|
|
203
226
|
<dl class="space-y-1">
|
|
204
227
|
<div
|
|
@@ -228,7 +251,7 @@ function formatDate(dateStr: string): string {
|
|
|
228
251
|
<p
|
|
229
252
|
class="mb-1 text-xs font-semibold uppercase tracking-wide text-dimmed"
|
|
230
253
|
>
|
|
231
|
-
|
|
254
|
+
{{ t("mapo.linkedModels") }}
|
|
232
255
|
</p>
|
|
233
256
|
<ul class="space-y-0.5 text-xs text-muted">
|
|
234
257
|
<li
|
|
@@ -244,16 +267,16 @@ function formatDate(dateStr: string): string {
|
|
|
244
267
|
<!-- Edit form (shown when editing) -->
|
|
245
268
|
<div v-if="editing" class="space-y-4 px-4 py-3">
|
|
246
269
|
<!-- Lang switch -->
|
|
247
|
-
<UFieldGroup v-if="
|
|
270
|
+
<UFieldGroup v-if="activeLangs.length > 1" size="xs">
|
|
248
271
|
<UButton
|
|
249
272
|
:variant="currentLang === '' ? 'solid' : 'outline'"
|
|
250
273
|
color="neutral"
|
|
251
274
|
@click="currentLang = ''"
|
|
252
275
|
>
|
|
253
|
-
|
|
276
|
+
{{ t("mapo.mediaEditor.defaultLang") }}
|
|
254
277
|
</UButton>
|
|
255
278
|
<UButton
|
|
256
|
-
v-for="lang in
|
|
279
|
+
v-for="lang in activeLangs"
|
|
257
280
|
:key="lang"
|
|
258
281
|
:variant="currentLang === lang ? 'solid' : 'outline'"
|
|
259
282
|
color="neutral"
|
|
@@ -308,7 +331,7 @@ function formatDate(dateStr: string): string {
|
|
|
308
331
|
color="error"
|
|
309
332
|
@click="store.deleteMedia(media)"
|
|
310
333
|
>
|
|
311
|
-
|
|
334
|
+
{{ t("mapo.delete") }}
|
|
312
335
|
</UButton>
|
|
313
336
|
<span v-else />
|
|
314
337
|
|
|
@@ -320,7 +343,7 @@ function formatDate(dateStr: string): string {
|
|
|
320
343
|
color="neutral"
|
|
321
344
|
@click="cancelEditing"
|
|
322
345
|
>
|
|
323
|
-
|
|
346
|
+
{{ t("mapo.cancel") }}
|
|
324
347
|
</UButton>
|
|
325
348
|
<UButton
|
|
326
349
|
v-if="editing"
|
|
@@ -330,7 +353,7 @@ function formatDate(dateStr: string): string {
|
|
|
330
353
|
icon="i-lucide-save"
|
|
331
354
|
@click="save"
|
|
332
355
|
>
|
|
333
|
-
|
|
356
|
+
{{ t("mapo.save") }}
|
|
334
357
|
</UButton>
|
|
335
358
|
</div>
|
|
336
359
|
</div>
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, computed, onUnmounted } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { humanFileSize } from "@mapomodule/utils";
|
|
4
5
|
import type { MediaItem } from "../types/media.js";
|
|
5
6
|
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
|
|
6
9
|
const props = defineProps<{
|
|
7
10
|
media: MediaItem;
|
|
8
11
|
accept?: string;
|
|
@@ -66,7 +69,9 @@ function onMaintainUrlChange(v: boolean | "indeterminate") {
|
|
|
66
69
|
|
|
67
70
|
<template>
|
|
68
71
|
<div class="mapo-media-file-changer space-y-2">
|
|
69
|
-
<p class="text-xs font-medium text-muted">
|
|
72
|
+
<p class="text-xs font-medium text-muted">
|
|
73
|
+
{{ t("mapo.mediaFileChanger.replaceFile") }}
|
|
74
|
+
</p>
|
|
70
75
|
|
|
71
76
|
<MapoDropArea
|
|
72
77
|
:accept="acceptTypes"
|
|
@@ -115,7 +120,7 @@ function onMaintainUrlChange(v: boolean | "indeterminate") {
|
|
|
115
120
|
class="flex flex-1 items-center gap-2 text-sm text-dimmed"
|
|
116
121
|
>
|
|
117
122
|
<UIcon name="i-lucide-upload" class="size-5" />
|
|
118
|
-
<span>
|
|
123
|
+
<span>{{ t("mapo.mediaFileChanger.dragOrClick") }}</span>
|
|
119
124
|
</div>
|
|
120
125
|
</div>
|
|
121
126
|
</template>
|
|
@@ -124,7 +129,7 @@ function onMaintainUrlChange(v: boolean | "indeterminate") {
|
|
|
124
129
|
<UCheckbox
|
|
125
130
|
v-if="newFile"
|
|
126
131
|
:model-value="maintainUrl"
|
|
127
|
-
label="
|
|
132
|
+
:label="t('mapo.mediaFileChanger.keepUrl')"
|
|
128
133
|
@update:model-value="onMaintainUrlChange"
|
|
129
134
|
/>
|
|
130
135
|
</div>
|
|
@@ -1,29 +1,51 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { useMediaStore } from "../stores/media.js";
|
|
4
5
|
import type { MediaFolder } from "../types/media.js";
|
|
5
6
|
|
|
7
|
+
const { t } = useI18n();
|
|
6
8
|
const store = useMediaStore();
|
|
7
9
|
|
|
8
10
|
const editingFolder = ref<Partial<MediaFolder> | null>(null);
|
|
9
11
|
const folderName = ref("");
|
|
10
12
|
const saving = ref(false);
|
|
11
13
|
|
|
12
|
-
const ALL_MIME_FILTERS = [
|
|
13
|
-
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const ALL_MIME_FILTERS = computed(() => [
|
|
15
|
+
{
|
|
16
|
+
label: t("mapo.mediaFolders.allFolder"),
|
|
17
|
+
icon: "i-lucide-layers",
|
|
18
|
+
mime: null as string | null,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: t("mapo.mediaFolders.imageFolder"),
|
|
22
|
+
icon: "i-lucide-image",
|
|
23
|
+
mime: "image/*",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: t("mapo.mediaFolders.videoFolder"),
|
|
27
|
+
icon: "i-lucide-film",
|
|
28
|
+
mime: "video/*",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: t("mapo.mediaFolders.audioFolder"),
|
|
32
|
+
icon: "i-lucide-music",
|
|
33
|
+
mime: "audio/*",
|
|
34
|
+
},
|
|
17
35
|
// Family filter (legacy parity): pdf, zip, office docs — not just pdf.
|
|
18
|
-
{
|
|
19
|
-
|
|
36
|
+
{
|
|
37
|
+
label: t("mapo.mediaFolders.docFolder"),
|
|
38
|
+
icon: "i-lucide-file-text",
|
|
39
|
+
mime: "application/*",
|
|
40
|
+
},
|
|
41
|
+
]);
|
|
20
42
|
|
|
21
43
|
// When the host locks a mime (picker fields), only the matching filter is
|
|
22
44
|
// offered — "All" would let the user select media of the wrong type.
|
|
23
45
|
const mimeFilters = computed(() =>
|
|
24
46
|
store.lockedMime
|
|
25
|
-
? ALL_MIME_FILTERS.filter((f) => f.mime === store.lockedMime)
|
|
26
|
-
: ALL_MIME_FILTERS,
|
|
47
|
+
? ALL_MIME_FILTERS.value.filter((f) => f.mime === store.lockedMime)
|
|
48
|
+
: ALL_MIME_FILTERS.value,
|
|
27
49
|
);
|
|
28
50
|
|
|
29
51
|
function startCreate() {
|
|
@@ -77,7 +99,7 @@ function onNameKeyup(event: KeyboardEvent) {
|
|
|
77
99
|
<p
|
|
78
100
|
class="mb-1 px-1 text-xs font-semibold uppercase tracking-wide text-dimmed"
|
|
79
101
|
>
|
|
80
|
-
|
|
102
|
+
{{ t("mapo.mime") }}
|
|
81
103
|
</p>
|
|
82
104
|
<UButton
|
|
83
105
|
v-for="f in mimeFilters"
|
|
@@ -100,14 +122,14 @@ function onNameKeyup(event: KeyboardEvent) {
|
|
|
100
122
|
<!-- Folders header -->
|
|
101
123
|
<div class="flex items-center justify-between px-3">
|
|
102
124
|
<p class="text-xs font-semibold uppercase tracking-wide text-dimmed">
|
|
103
|
-
|
|
125
|
+
{{ t("mapo.mediaFolders.folders") }}
|
|
104
126
|
</p>
|
|
105
127
|
<UButton
|
|
106
128
|
icon="i-lucide-folder-plus"
|
|
107
129
|
size="xs"
|
|
108
130
|
variant="ghost"
|
|
109
131
|
color="neutral"
|
|
110
|
-
title="
|
|
132
|
+
:title="t('mapo.mediaFolders.newFolder')"
|
|
111
133
|
@click="startCreate"
|
|
112
134
|
/>
|
|
113
135
|
</div>
|
|
@@ -117,7 +139,7 @@ function onNameKeyup(event: KeyboardEvent) {
|
|
|
117
139
|
<UInput
|
|
118
140
|
v-model="folderName"
|
|
119
141
|
size="xs"
|
|
120
|
-
placeholder="
|
|
142
|
+
:placeholder="t('mapo.mediaFolders.folderName')"
|
|
121
143
|
autofocus
|
|
122
144
|
@keyup="onNameKeyup"
|
|
123
145
|
>
|
|
@@ -195,7 +217,7 @@ function onNameKeyup(event: KeyboardEvent) {
|
|
|
195
217
|
v-if="store.folders.length === 0"
|
|
196
218
|
class="px-2 py-3 text-xs text-dimmed italic"
|
|
197
219
|
>
|
|
198
|
-
|
|
220
|
+
{{ t("mapo.mediaFolders.noFolders") }}
|
|
199
221
|
</p>
|
|
200
222
|
</div>
|
|
201
223
|
|
|
@@ -210,7 +232,7 @@ function onNameKeyup(event: KeyboardEvent) {
|
|
|
210
232
|
class="justify-start"
|
|
211
233
|
@click="store.navigateToFolder(null)"
|
|
212
234
|
>
|
|
213
|
-
|
|
235
|
+
{{ t("mapo.mediaFolders.goBack") }}
|
|
214
236
|
</UButton>
|
|
215
237
|
</div>
|
|
216
238
|
</div>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { humanFileSize } from "@mapomodule/utils";
|
|
4
5
|
import { useMediaStore } from "../stores/media.js";
|
|
5
6
|
import type { MediaItem } from "../types/media.js";
|
|
6
7
|
|
|
8
|
+
const { t } = useI18n();
|
|
7
9
|
const store = useMediaStore();
|
|
8
10
|
|
|
9
11
|
const isPickerMode = computed(
|
|
@@ -85,7 +87,9 @@ function onDragEnd() {
|
|
|
85
87
|
</div>
|
|
86
88
|
</div>
|
|
87
89
|
<span class="ml-auto shrink-0 pl-2 text-xs text-muted">
|
|
88
|
-
{{
|
|
90
|
+
{{
|
|
91
|
+
t("mapo.mediaGallery.nSelected", { number: multiSelection.length })
|
|
92
|
+
}}
|
|
89
93
|
</span>
|
|
90
94
|
</div>
|
|
91
95
|
|
|
@@ -100,11 +104,17 @@ function onDragEnd() {
|
|
|
100
104
|
? 'indeterminate'
|
|
101
105
|
: store.editListState.value
|
|
102
106
|
"
|
|
103
|
-
:label="
|
|
107
|
+
:label="
|
|
108
|
+
store.editListState.value
|
|
109
|
+
? t('mapo.mediaGallery.deselectAll')
|
|
110
|
+
: t('mapo.mediaGallery.selectAll')
|
|
111
|
+
"
|
|
104
112
|
@update:model-value="store.editSelectAll()"
|
|
105
113
|
/>
|
|
106
114
|
<span class="text-sm text-muted">
|
|
107
|
-
{{
|
|
115
|
+
{{
|
|
116
|
+
t("mapo.mediaGallery.nSelected", { number: store.editList.length })
|
|
117
|
+
}}
|
|
108
118
|
</span>
|
|
109
119
|
<div class="flex-1" />
|
|
110
120
|
<UButton
|
|
@@ -114,7 +124,7 @@ function onDragEnd() {
|
|
|
114
124
|
variant="soft"
|
|
115
125
|
@click="store.deleteSelected()"
|
|
116
126
|
>
|
|
117
|
-
|
|
127
|
+
{{ t("mapo.mediaGallery.deleteSelectedLabel") }}
|
|
118
128
|
</UButton>
|
|
119
129
|
<UButton
|
|
120
130
|
icon="i-lucide-x"
|
|
@@ -139,7 +149,9 @@ function onDragEnd() {
|
|
|
139
149
|
class="flex flex-col items-center gap-3 py-16 text-center"
|
|
140
150
|
>
|
|
141
151
|
<UIcon name="i-lucide-image-off" class="size-12 text-dimmed" />
|
|
142
|
-
<p class="text-sm text-muted">
|
|
152
|
+
<p class="text-sm text-muted">
|
|
153
|
+
{{ t("mapo.mediaGallery.noMediaFound") }}
|
|
154
|
+
</p>
|
|
143
155
|
</div>
|
|
144
156
|
|
|
145
157
|
<!-- Grid -->
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, onMounted, onUnmounted, watch } from "vue";
|
|
2
|
+
import { ref, computed, onMounted, onUnmounted, watch } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { debounce } from "@mapomodule/utils";
|
|
4
5
|
import { useMediaStore } from "../stores/media.js";
|
|
5
6
|
import type { SelectMode } from "../types/media.js";
|
|
@@ -37,13 +38,22 @@ const emit = defineEmits<{
|
|
|
37
38
|
];
|
|
38
39
|
}>();
|
|
39
40
|
|
|
41
|
+
const { t } = useI18n();
|
|
40
42
|
const store = useMediaStore();
|
|
41
43
|
// string (not a union) because UTabs' v-model emits string | number
|
|
42
44
|
const activeTab = ref<string>("gallery");
|
|
43
|
-
const tabItems = [
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const tabItems = computed(() => [
|
|
46
|
+
{
|
|
47
|
+
label: t("mapo.mediaManager.gallery"),
|
|
48
|
+
icon: "i-lucide-images",
|
|
49
|
+
value: "gallery",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: t("mapo.mediaManager.uploader"),
|
|
53
|
+
icon: "i-lucide-upload-cloud",
|
|
54
|
+
value: "upload",
|
|
55
|
+
},
|
|
56
|
+
]);
|
|
47
57
|
const searchValue = ref("");
|
|
48
58
|
const showFolders = ref(!props.noFolders);
|
|
49
59
|
|
|
@@ -119,7 +129,7 @@ onUnmounted(() => {
|
|
|
119
129
|
<UInput
|
|
120
130
|
v-model="searchValue"
|
|
121
131
|
size="xs"
|
|
122
|
-
placeholder="
|
|
132
|
+
:placeholder="t('mapo.search')"
|
|
123
133
|
icon="i-lucide-search"
|
|
124
134
|
:loading="store.loading"
|
|
125
135
|
/>
|
|
@@ -131,7 +141,7 @@ onUnmounted(() => {
|
|
|
131
141
|
size="xs"
|
|
132
142
|
variant="ghost"
|
|
133
143
|
color="neutral"
|
|
134
|
-
title="
|
|
144
|
+
:title="t('mapo.refresh')"
|
|
135
145
|
@click="store.getRoot()"
|
|
136
146
|
/>
|
|
137
147
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, watch, computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { useMediaStore } from "../stores/media.js";
|
|
4
5
|
import type { MediaItem, SelectMode } from "../types/media.js";
|
|
5
6
|
|
|
@@ -31,6 +32,7 @@ const emit = defineEmits<{
|
|
|
31
32
|
confirm: [value: MediaItem | MediaItem[]];
|
|
32
33
|
}>();
|
|
33
34
|
|
|
35
|
+
const { t } = useI18n();
|
|
34
36
|
const store = useMediaStore();
|
|
35
37
|
const open = ref(props.modelValue);
|
|
36
38
|
|
|
@@ -89,7 +91,11 @@ watch(
|
|
|
89
91
|
<div class="flex items-center gap-2 border-b border-default px-4 py-3">
|
|
90
92
|
<UIcon name="i-lucide-image" class="size-4 text-dimmed" />
|
|
91
93
|
<span class="flex-1 font-semibold text-highlighted">
|
|
92
|
-
{{
|
|
94
|
+
{{
|
|
95
|
+
selectionMode === "multi"
|
|
96
|
+
? t("mapo.mediaManager.selectMedia")
|
|
97
|
+
: t("mapo.mediaManager.selectAMedia")
|
|
98
|
+
}}
|
|
93
99
|
</span>
|
|
94
100
|
<UButton
|
|
95
101
|
icon="i-lucide-x"
|
|
@@ -120,11 +126,11 @@ watch(
|
|
|
120
126
|
v-if="selectionMode === 'multi' && selectionCount > 0"
|
|
121
127
|
class="text-sm text-muted"
|
|
122
128
|
>
|
|
123
|
-
{{ selectionCount }}
|
|
129
|
+
{{ t("mapo.mediaGallery.nSelected", { number: selectionCount }) }}
|
|
124
130
|
</p>
|
|
125
131
|
<div class="ml-auto flex gap-2">
|
|
126
132
|
<UButton variant="ghost" color="neutral" @click="cancel">
|
|
127
|
-
|
|
133
|
+
{{ t("mapo.cancel") }}
|
|
128
134
|
</UButton>
|
|
129
135
|
<UButton
|
|
130
136
|
color="primary"
|
|
@@ -132,7 +138,7 @@ watch(
|
|
|
132
138
|
icon="i-lucide-check"
|
|
133
139
|
@click="confirm"
|
|
134
140
|
>
|
|
135
|
-
|
|
141
|
+
{{ t("mapo.confirm") }}
|
|
136
142
|
</UButton>
|
|
137
143
|
</div>
|
|
138
144
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, computed, onUnmounted } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { humanFileSize } from "@mapomodule/utils";
|
|
4
5
|
import { useMediaStore } from "../stores/media.js";
|
|
5
6
|
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
@@ -26,6 +27,7 @@ const emit = defineEmits<{
|
|
|
26
27
|
uploaded: [];
|
|
27
28
|
}>();
|
|
28
29
|
|
|
30
|
+
const { t } = useI18n();
|
|
29
31
|
const store = useMediaStore();
|
|
30
32
|
const snack = useSnackStore();
|
|
31
33
|
|
|
@@ -53,6 +55,15 @@ const pendingCount = computed(
|
|
|
53
55
|
() => entries.value.filter((e) => e.status === "pending").length,
|
|
54
56
|
);
|
|
55
57
|
|
|
58
|
+
// The text metadata of a pending file, labelled like MapoMediaEditor's fields.
|
|
59
|
+
// Labels, not placeholders: title and alt text start from the file name, so a
|
|
60
|
+
// placeholder would never show what they are.
|
|
61
|
+
const textFields = computed(() => [
|
|
62
|
+
{ key: "title" as const, label: t("mapo.title") },
|
|
63
|
+
{ key: "alt_text" as const, label: t("mapo.altTag") },
|
|
64
|
+
{ key: "description" as const, label: t("mapo.description") },
|
|
65
|
+
]);
|
|
66
|
+
|
|
56
67
|
// Destination options: the current folder plus its subfolders (legacy parity).
|
|
57
68
|
const folderOptions = computed(() => [
|
|
58
69
|
{
|
|
@@ -72,7 +83,10 @@ function onFiles(files: File[]) {
|
|
|
72
83
|
|
|
73
84
|
if (file.size > limit) {
|
|
74
85
|
snack.show(
|
|
75
|
-
|
|
86
|
+
t("mapo.mediaUploader.fileTooLarge", {
|
|
87
|
+
name: file.name,
|
|
88
|
+
max: (limit / (1024 * 1024)).toFixed(0),
|
|
89
|
+
}),
|
|
76
90
|
"error",
|
|
77
91
|
);
|
|
78
92
|
continue;
|
|
@@ -128,7 +142,10 @@ async function upload() {
|
|
|
128
142
|
successCount++;
|
|
129
143
|
} catch (err) {
|
|
130
144
|
entry.status = "error";
|
|
131
|
-
entry.error =
|
|
145
|
+
entry.error =
|
|
146
|
+
err instanceof Error
|
|
147
|
+
? err.message
|
|
148
|
+
: t("mapo.mediaUploader.uploadFailed");
|
|
132
149
|
}
|
|
133
150
|
}
|
|
134
151
|
|
|
@@ -136,7 +153,7 @@ async function upload() {
|
|
|
136
153
|
|
|
137
154
|
if (successCount > 0) {
|
|
138
155
|
snack.show(
|
|
139
|
-
|
|
156
|
+
t("mapo.mediaUploader.success", { numberFiles: successCount }),
|
|
140
157
|
"success",
|
|
141
158
|
);
|
|
142
159
|
await store.getRoot({ page: 1 });
|
|
@@ -173,12 +190,18 @@ onUnmounted(clearAll);
|
|
|
173
190
|
<UIcon name="i-lucide-upload-cloud" class="size-10 text-dimmed" />
|
|
174
191
|
<div class="text-center">
|
|
175
192
|
<p class="text-sm font-medium text-muted">
|
|
176
|
-
|
|
177
|
-
<span class="text-primary">
|
|
193
|
+
{{ t("mapo.mediaUploader.dragHere") }}
|
|
194
|
+
<span class="text-primary">{{
|
|
195
|
+
t("mapo.mediaUploader.browse")
|
|
196
|
+
}}</span>
|
|
178
197
|
</p>
|
|
179
198
|
<p class="mt-0.5 text-xs text-dimmed">
|
|
180
|
-
|
|
181
|
-
|
|
199
|
+
{{
|
|
200
|
+
t("mapo.mediaUploader.limits", {
|
|
201
|
+
img: (MAX_IMAGE / (1024 * 1024)).toFixed(0),
|
|
202
|
+
vid: (MAX_VIDEO / (1024 * 1024)).toFixed(0),
|
|
203
|
+
})
|
|
204
|
+
}}
|
|
182
205
|
</p>
|
|
183
206
|
</div>
|
|
184
207
|
</div>
|
|
@@ -189,8 +212,13 @@ onUnmounted(clearAll);
|
|
|
189
212
|
<div v-if="entries.length > 0" class="space-y-2">
|
|
190
213
|
<div class="flex items-center justify-between">
|
|
191
214
|
<p class="text-xs font-medium text-muted">
|
|
192
|
-
{{
|
|
193
|
-
|
|
215
|
+
{{
|
|
216
|
+
t(
|
|
217
|
+
"mapo.mediaUploader.nSelected",
|
|
218
|
+
{ n: entries.length },
|
|
219
|
+
entries.length,
|
|
220
|
+
)
|
|
221
|
+
}}
|
|
194
222
|
</p>
|
|
195
223
|
<UButton
|
|
196
224
|
v-if="!uploading"
|
|
@@ -200,7 +228,7 @@ onUnmounted(clearAll);
|
|
|
200
228
|
icon="i-lucide-x"
|
|
201
229
|
@click="clearAll"
|
|
202
230
|
>
|
|
203
|
-
|
|
231
|
+
{{ t("mapo.clear") }}
|
|
204
232
|
</UButton>
|
|
205
233
|
</div>
|
|
206
234
|
|
|
@@ -241,28 +269,27 @@ onUnmounted(clearAll);
|
|
|
241
269
|
</span>
|
|
242
270
|
</div>
|
|
243
271
|
|
|
244
|
-
<!-- Metadata inputs (only for pending)
|
|
272
|
+
<!-- Metadata inputs (only for pending). The inputs take their
|
|
273
|
+
size from UFormField. -->
|
|
245
274
|
<div
|
|
246
275
|
v-if="entry.status === 'pending'"
|
|
247
276
|
class="grid grid-cols-2 gap-1.5"
|
|
248
277
|
>
|
|
249
|
-
<
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
placeholder="Alt text"
|
|
254
|
-
/>
|
|
255
|
-
<UInput
|
|
256
|
-
v-model="entry.description"
|
|
257
|
-
size="xs"
|
|
258
|
-
placeholder="Description"
|
|
259
|
-
/>
|
|
260
|
-
<USelect
|
|
261
|
-
v-model="entry.folder"
|
|
262
|
-
:items="folderOptions"
|
|
278
|
+
<UFormField
|
|
279
|
+
v-for="field in textFields"
|
|
280
|
+
:key="field.key"
|
|
281
|
+
:label="field.label"
|
|
263
282
|
size="xs"
|
|
264
|
-
|
|
265
|
-
|
|
283
|
+
>
|
|
284
|
+
<UInput v-model="entry[field.key]" class="w-full" />
|
|
285
|
+
</UFormField>
|
|
286
|
+
<UFormField :label="t('mapo.folder')" size="xs">
|
|
287
|
+
<USelect
|
|
288
|
+
v-model="entry.folder"
|
|
289
|
+
:items="folderOptions"
|
|
290
|
+
class="w-full"
|
|
291
|
+
/>
|
|
292
|
+
</UFormField>
|
|
266
293
|
</div>
|
|
267
294
|
|
|
268
295
|
<!-- Progress bar -->
|
|
@@ -279,7 +306,9 @@ onUnmounted(clearAll);
|
|
|
279
306
|
class="flex items-center gap-1 text-success"
|
|
280
307
|
>
|
|
281
308
|
<UIcon name="i-lucide-check-circle" class="size-3.5" />
|
|
282
|
-
<span class="text-xs">
|
|
309
|
+
<span class="text-xs">{{
|
|
310
|
+
t("mapo.mediaUploader.uploaded")
|
|
311
|
+
}}</span>
|
|
283
312
|
</div>
|
|
284
313
|
<div
|
|
285
314
|
v-if="entry.status === 'error'"
|
|
@@ -316,7 +345,9 @@ onUnmounted(clearAll);
|
|
|
316
345
|
color="primary"
|
|
317
346
|
@click="upload"
|
|
318
347
|
>
|
|
319
|
-
|
|
348
|
+
{{
|
|
349
|
+
t("mapo.mediaUploader.uploadCta", { n: pendingCount }, pendingCount)
|
|
350
|
+
}}
|
|
320
351
|
</UButton>
|
|
321
352
|
</div>
|
|
322
353
|
</div>
|