@mapomodule/uikit 2.0.0-beta.8 → 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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/module.d.mts +1 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +10 -0
- package/dist/runtime/assets/main.css +1 -1
- package/dist/runtime/components/MapoConfirmDialog.vue +18 -1
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoDetail.vue +263 -33
- 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 +21 -25
- 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.d.ts +1 -1
- package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -1
- 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 +12 -5
- 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/MapoListQuickEdit.vue +1 -1
- package/dist/runtime/components/MapoListTable.vue +99 -33
- 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/MapoMediaEditor.vue +10 -4
- 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 +1 -1
- package/dist/runtime/components/MapoMediaManager.vue +1 -1
- package/dist/runtime/components/MapoMediaManagerDialog.vue +1 -1
- package/dist/runtime/components/MapoMediaPreview.vue +1 -1
- package/dist/runtime/components/MapoMediaUploader.vue +21 -21
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMenuManager.vue +23 -3
- package/dist/runtime/components/MapoMenuManager.vue.d.ts +2 -2
- package/dist/runtime/components/MapoMenuManager.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts +1 -1
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts +2 -2
- package/dist/runtime/components/MapoSnackBar.vue +11 -0
- package/dist/runtime/components/MapoSnackBar.vue.d.ts.map +1 -1
- 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/stores/media.d.ts +8 -2
- package/dist/runtime/stores/media.d.ts.map +1 -1
- package/dist/runtime/stores/media.js +16 -0
- 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/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 +7 -8
- 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 +8 -0
- package/src/module.ts +12 -0
- package/src/runtime/assets/main.css +13 -0
- package/src/runtime/components/MapoConfirmDialog.vue +28 -1
- package/src/runtime/components/MapoDetail.vue +481 -53
- package/src/runtime/components/MapoDetailExtensions.vue +39 -0
- package/src/runtime/components/MapoDetailLangSwitch.vue +26 -27
- package/src/runtime/components/MapoList.vue +20 -5
- package/src/runtime/components/MapoListActions.vue +16 -4
- package/src/runtime/components/MapoListTable.vue +128 -41
- package/src/runtime/components/MapoMediaEditor.vue +17 -4
- package/src/runtime/components/MapoMediaUploader.vue +25 -21
- package/src/runtime/components/MapoMenuManager.vue +38 -3
- package/src/runtime/components/MapoSnackBar.vue +12 -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/stores/media.ts +32 -0
- package/src/runtime/types/detail.ts +178 -0
- package/src/runtime/types/list.ts +10 -2
- 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,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, watch, computed } from "vue";
|
|
2
|
+
import { ref, watch, computed, onMounted } from "vue";
|
|
3
3
|
import { useI18n } from "vue-i18n";
|
|
4
4
|
import { useRuntimeConfig } from "#app";
|
|
5
5
|
import {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "@mapomodule/utils";
|
|
11
11
|
import { usePermissions } from "@mapomodule/store/runtime/composables/usePermissions";
|
|
12
12
|
import { useMediaStore } from "../stores/media.js";
|
|
13
|
-
defineProps({
|
|
13
|
+
const props = defineProps({
|
|
14
14
|
languages: { type: Array, required: false },
|
|
15
15
|
defaultLang: { type: String, required: false }
|
|
16
16
|
});
|
|
@@ -26,6 +26,12 @@ const saving = ref(false);
|
|
|
26
26
|
const newFile = ref(null);
|
|
27
27
|
const maintainUrl = ref(false);
|
|
28
28
|
const currentLang = ref("");
|
|
29
|
+
const activeLangs = computed(
|
|
30
|
+
() => props.languages?.length ? props.languages : store.languages
|
|
31
|
+
);
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
store.deriveLanguages();
|
|
34
|
+
});
|
|
29
35
|
let editSnapshot = null;
|
|
30
36
|
const media = computed(() => store.editMedia);
|
|
31
37
|
watch(
|
|
@@ -224,7 +230,7 @@ function formatDate(dateStr) {
|
|
|
224
230
|
<!-- Edit form (shown when editing) -->
|
|
225
231
|
<div v-if="editing" class="space-y-4 px-4 py-3">
|
|
226
232
|
<!-- Lang switch -->
|
|
227
|
-
<UFieldGroup v-if="
|
|
233
|
+
<UFieldGroup v-if="activeLangs.length > 1" size="xs">
|
|
228
234
|
<UButton
|
|
229
235
|
:variant="currentLang === '' ? 'solid' : 'outline'"
|
|
230
236
|
color="neutral"
|
|
@@ -233,7 +239,7 @@ function formatDate(dateStr) {
|
|
|
233
239
|
{{ t("mapo.mediaEditor.defaultLang") }}
|
|
234
240
|
</UButton>
|
|
235
241
|
<UButton
|
|
236
|
-
v-for="lang in
|
|
242
|
+
v-for="lang in activeLangs"
|
|
237
243
|
:key="lang"
|
|
238
244
|
:variant="currentLang === lang ? 'solid' : 'outline'"
|
|
239
245
|
color="neutral"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoMediaEditor.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMediaEditor.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoMediaEditor.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMediaEditor.vue"],"names":[],"mappings":"AA2XA,KAAK,WAAW,GAAG;IACjB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AA2xBF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -4,7 +4,7 @@ import { useI18n } from "vue-i18n";
|
|
|
4
4
|
import { humanFileSize } from "@mapomodule/utils";
|
|
5
5
|
const { t } = useI18n();
|
|
6
6
|
const props = defineProps({
|
|
7
|
-
media: { type:
|
|
7
|
+
media: { type: Object, required: true },
|
|
8
8
|
accept: { type: String, required: false }
|
|
9
9
|
});
|
|
10
10
|
const emit = defineEmits(["update:file", "update:maintainUrl"]);
|
|
@@ -9,7 +9,7 @@ const props = defineProps({
|
|
|
9
9
|
noFolders: { type: Boolean, required: false, default: false },
|
|
10
10
|
languages: { type: Array, required: false, default: void 0 },
|
|
11
11
|
defaultLang: { type: String, required: false, default: void 0 },
|
|
12
|
-
initialSelection: { type: null, required: false, default: null }
|
|
12
|
+
initialSelection: { type: [Object, Array, null], required: false, default: null }
|
|
13
13
|
});
|
|
14
14
|
const emit = defineEmits(["update:selection"]);
|
|
15
15
|
const { t } = useI18n();
|
|
@@ -9,7 +9,7 @@ const props = defineProps({
|
|
|
9
9
|
noFolders: { type: Boolean, required: false, default: false },
|
|
10
10
|
languages: { type: Array, required: false, default: void 0 },
|
|
11
11
|
defaultLang: { type: String, required: false, default: void 0 },
|
|
12
|
-
selected: { type: null, required: false, default: null }
|
|
12
|
+
selected: { type: [Object, Array, null], required: false, default: null }
|
|
13
13
|
});
|
|
14
14
|
const emit = defineEmits(["update:modelValue", "confirm"]);
|
|
15
15
|
const { t } = useI18n();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
const props = defineProps({
|
|
4
|
-
media: { type:
|
|
4
|
+
media: { type: Object, required: true },
|
|
5
5
|
size: { type: String, required: false, default: "md" },
|
|
6
6
|
contain: { type: Boolean, required: false, default: false },
|
|
7
7
|
showFilename: { type: Boolean, required: false, default: false },
|
|
@@ -23,6 +23,11 @@ const canUpload = computed(
|
|
|
23
23
|
const pendingCount = computed(
|
|
24
24
|
() => entries.value.filter((e) => e.status === "pending").length
|
|
25
25
|
);
|
|
26
|
+
const textFields = computed(() => [
|
|
27
|
+
{ key: "title", label: t("mapo.title") },
|
|
28
|
+
{ key: "alt_text", label: t("mapo.altTag") },
|
|
29
|
+
{ key: "description", label: t("mapo.description") }
|
|
30
|
+
]);
|
|
26
31
|
const folderOptions = computed(() => [
|
|
27
32
|
{
|
|
28
33
|
label: store.parentFolder?.path ?? "/",
|
|
@@ -201,32 +206,27 @@ onUnmounted(clearAll);
|
|
|
201
206
|
</span>
|
|
202
207
|
</div>
|
|
203
208
|
|
|
204
|
-
<!-- Metadata inputs (only for pending)
|
|
209
|
+
<!-- Metadata inputs (only for pending). The inputs take their
|
|
210
|
+
size from UFormField. -->
|
|
205
211
|
<div
|
|
206
212
|
v-if="entry.status === 'pending'"
|
|
207
213
|
class="grid grid-cols-2 gap-1.5"
|
|
208
214
|
>
|
|
209
|
-
<
|
|
210
|
-
v-
|
|
211
|
-
|
|
212
|
-
:
|
|
213
|
-
/>
|
|
214
|
-
<UInput
|
|
215
|
-
v-model="entry.alt_text"
|
|
216
|
-
size="xs"
|
|
217
|
-
:placeholder="t('mapo.altTag')"
|
|
218
|
-
/>
|
|
219
|
-
<UInput
|
|
220
|
-
v-model="entry.description"
|
|
221
|
-
size="xs"
|
|
222
|
-
:placeholder="t('mapo.description')"
|
|
223
|
-
/>
|
|
224
|
-
<USelect
|
|
225
|
-
v-model="entry.folder"
|
|
226
|
-
:items="folderOptions"
|
|
215
|
+
<UFormField
|
|
216
|
+
v-for="field in textFields"
|
|
217
|
+
:key="field.key"
|
|
218
|
+
:label="field.label"
|
|
227
219
|
size="xs"
|
|
228
|
-
|
|
229
|
-
|
|
220
|
+
>
|
|
221
|
+
<UInput v-model="entry[field.key]" class="w-full" />
|
|
222
|
+
</UFormField>
|
|
223
|
+
<UFormField :label="t('mapo.folder')" size="xs">
|
|
224
|
+
<USelect
|
|
225
|
+
v-model="entry.folder"
|
|
226
|
+
:items="folderOptions"
|
|
227
|
+
class="w-full"
|
|
228
|
+
/>
|
|
229
|
+
</UFormField>
|
|
230
230
|
</div>
|
|
231
231
|
|
|
232
232
|
<!-- Progress bar -->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoMediaUploader.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMediaUploader.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoMediaUploader.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMediaUploader.vue"],"names":[],"mappings":"AAqiCA,QAAA,MAAM,YAAY;;;;iFAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "@mapomodule/core/runtime/utils/fetchError";
|
|
10
10
|
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
11
11
|
import { usePermissions } from "@mapomodule/store/runtime/composables/usePermissions";
|
|
12
|
+
import { languagesFromMetadata } from "../utils/langInfo";
|
|
12
13
|
import { deepClone, objectDiff } from "@mapomodule/utils";
|
|
13
14
|
import {
|
|
14
15
|
findMenuNode
|
|
@@ -40,12 +41,16 @@ const model = ref(
|
|
|
40
41
|
);
|
|
41
42
|
let backup = deepClone(model.value);
|
|
42
43
|
const selected = ref(null);
|
|
44
|
+
const derivedLangs = ref([]);
|
|
45
|
+
const activeLangs = computed(
|
|
46
|
+
() => props.languages.length ? props.languages : derivedLangs.value
|
|
47
|
+
);
|
|
43
48
|
const currentLang = ref(props.lang ?? props.languages[0] ?? "");
|
|
44
49
|
const isLoading = ref(String(props.identifier) !== "new");
|
|
45
50
|
const isSaving = ref(false);
|
|
46
51
|
const isNew = computed(() => String(props.identifier) === "new");
|
|
47
52
|
const translationsActive = computed(
|
|
48
|
-
() => props.translatable &&
|
|
53
|
+
() => props.translatable && activeLangs.value.length > 0
|
|
49
54
|
);
|
|
50
55
|
const { canAdd, canChange } = usePermissions();
|
|
51
56
|
const effectiveReadonly = computed(() => {
|
|
@@ -53,10 +58,17 @@ const effectiveReadonly = computed(() => {
|
|
|
53
58
|
if (!props.permissionModel) return false;
|
|
54
59
|
return isNew.value ? !canAdd(props.permissionModel) : !canChange(props.permissionModel);
|
|
55
60
|
});
|
|
61
|
+
watch(
|
|
62
|
+
activeLangs,
|
|
63
|
+
(langs) => {
|
|
64
|
+
if (!currentLang.value && langs.length) currentLang.value = langs[0];
|
|
65
|
+
},
|
|
66
|
+
{ immediate: true }
|
|
67
|
+
);
|
|
56
68
|
watch(
|
|
57
69
|
() => props.lang,
|
|
58
70
|
(val) => {
|
|
59
|
-
if (val &&
|
|
71
|
+
if (val && activeLangs.value.includes(val)) currentLang.value = val;
|
|
60
72
|
}
|
|
61
73
|
);
|
|
62
74
|
watch(currentLang, (val) => {
|
|
@@ -89,7 +101,15 @@ watch(
|
|
|
89
101
|
}
|
|
90
102
|
);
|
|
91
103
|
watch(model, (val) => emit("update:modelValue", val));
|
|
104
|
+
async function deriveLanguages() {
|
|
105
|
+
if (props.languages.length) return;
|
|
106
|
+
try {
|
|
107
|
+
derivedLangs.value = languagesFromMetadata(await crud.options());
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
110
|
+
}
|
|
92
111
|
onMounted(async () => {
|
|
112
|
+
deriveLanguages();
|
|
93
113
|
if (isNew.value) return;
|
|
94
114
|
isLoading.value = true;
|
|
95
115
|
try {
|
|
@@ -202,7 +222,7 @@ const treeview = ref(null);
|
|
|
202
222
|
<div class="border-b border-default px-2 pt-2">
|
|
203
223
|
<MapoDetailLangSwitch
|
|
204
224
|
v-model="currentLang"
|
|
205
|
-
:langs="
|
|
225
|
+
:langs="activeLangs"
|
|
206
226
|
:errors="langErrors"
|
|
207
227
|
no-route-change
|
|
208
228
|
/>
|
|
@@ -68,9 +68,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
68
68
|
"onUpdate:modelValue"?: ((menu: MapoMenu) => any) | undefined;
|
|
69
69
|
"onUpdate:lang"?: ((lang: string) => any) | undefined;
|
|
70
70
|
}>, {
|
|
71
|
+
translatable: boolean;
|
|
72
|
+
readonly: boolean;
|
|
71
73
|
languages: string[];
|
|
72
74
|
usePatch: boolean;
|
|
73
|
-
readonly: boolean;
|
|
74
75
|
permissionModel: string;
|
|
75
76
|
modelValue: MapoMenu | null;
|
|
76
77
|
lang: string;
|
|
@@ -79,7 +80,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
79
80
|
additionalFields: AnyFieldDescriptor[];
|
|
80
81
|
availableClasses: Record<string, string>;
|
|
81
82
|
identifier: string | number;
|
|
82
|
-
translatable: boolean;
|
|
83
83
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
84
84
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
85
85
|
declare const _default: typeof __VLS_export;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoMenuManager.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMenuManager.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoMenuManager.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMenuManager.vue"],"names":[],"mappings":"AAocA,OAAO,KAAK,EAAE,kBAAkB,EA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AAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CAC/D,CAAC;AA2iBF,QAAA,MAAM,UAAU;;;;;;;;;kBArmBG,OAAO;cAeX,OAAO;eAXN,MAAM,EAAE;cAET,OAAO;qBAOA,MAAM;gBAfX,QAAQ,GAAG,IAAI;UAIrB,MAAM;cAMF,MAAM;gBASJ,kBAAkB,EAAE,GAAG,IAAI;sBAErB,kBAAkB,EAAE;sBAEpB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;gBAzB5B,MAAM,GAAG,MAAM;6EA6mB9B,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -41,8 +41,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
41
41
|
"onUpdate:nodes"?: ((nodes: MenuTreeNode[]) => any) | undefined;
|
|
42
42
|
}>, {
|
|
43
43
|
title: string;
|
|
44
|
-
loading: boolean;
|
|
45
44
|
readonly: boolean;
|
|
45
|
+
loading: boolean;
|
|
46
46
|
modelValue: MenuTreeNode | null;
|
|
47
47
|
maxDepth: number;
|
|
48
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoMenuTreeview.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMenuTreeview.vue"],"names":[],"mappings":"AAiRA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAI1B;;;;;;GAMG;AACH,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,yCAAyC;IACzC,UAA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ER,OAAO;gBANJ,YAAY,GAAG,IAAI;cAGrB,MAAM;6EA+anB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -9,16 +9,16 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
9
9
|
}, {
|
|
10
10
|
openIfChild: (child: MenuTreeNode) => void;
|
|
11
11
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
-
delete: (node: MenuTreeNode) => any;
|
|
13
12
|
select: (node: MenuTreeNode) => any;
|
|
13
|
+
delete: (node: MenuTreeNode) => any;
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<{
|
|
15
15
|
node: MenuTreeNode;
|
|
16
16
|
depth?: number;
|
|
17
17
|
selectedId?: string | number | null;
|
|
18
18
|
readonly?: boolean;
|
|
19
19
|
}> & Readonly<{
|
|
20
|
-
onDelete?: ((node: MenuTreeNode) => any) | undefined;
|
|
21
20
|
onSelect?: ((node: MenuTreeNode) => any) | undefined;
|
|
21
|
+
onDelete?: ((node: MenuTreeNode) => any) | undefined;
|
|
22
22
|
}>, {
|
|
23
23
|
readonly: boolean;
|
|
24
24
|
depth: number;
|
|
@@ -5,6 +5,16 @@ import { useToast } from "@nuxt/ui/composables/useToast";
|
|
|
5
5
|
const snack = useSnackStore();
|
|
6
6
|
const toast = useToast();
|
|
7
7
|
const _shown = /* @__PURE__ */ new Set();
|
|
8
|
+
function dismissEvictedMessages() {
|
|
9
|
+
const activeToastIds = new Set(
|
|
10
|
+
toast.toasts.value.map(({ id }) => String(id))
|
|
11
|
+
);
|
|
12
|
+
for (const id of _shown) {
|
|
13
|
+
if (activeToastIds.has(String(id))) continue;
|
|
14
|
+
_shown.delete(id);
|
|
15
|
+
snack.dismiss(id);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
8
18
|
watch(
|
|
9
19
|
() => snack.messages,
|
|
10
20
|
(msgs) => {
|
|
@@ -27,6 +37,7 @@ watch(
|
|
|
27
37
|
if (!open) snack.dismiss(msg.id);
|
|
28
38
|
}
|
|
29
39
|
});
|
|
40
|
+
dismissEvictedMessages();
|
|
30
41
|
}
|
|
31
42
|
},
|
|
32
43
|
{ deep: true }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoSnackBar.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoSnackBar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoSnackBar.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoSnackBar.vue"],"names":[],"mappings":"AAiHA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DetailExtension } from "../types/detail.js";
|
|
2
|
+
/**
|
|
3
|
+
* The extensions registered in the app, created on first use. `MapoDetail`
|
|
4
|
+
* renders them through `MapoDetailExtensions`. @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare function detailExtensions(nuxtApp?: object): DetailExtension[];
|
|
7
|
+
/**
|
|
8
|
+
* Adds a component to every `MapoDetail` of the app: an action in the sidebar
|
|
9
|
+
* card above Save (`placement: "actions"`), or content above the body form
|
|
10
|
+
* (`"body-top"`). The component reads the detail with `useMapoDetail()`.
|
|
11
|
+
*
|
|
12
|
+
* Call it from a plugin, so it applies to every page. Registering a key again
|
|
13
|
+
* replaces the extension; a page shows only some extensions, or none, with the
|
|
14
|
+
* `extensions` prop of `MapoDetail`.
|
|
15
|
+
*
|
|
16
|
+
* @param extension Its key, placement, component and, optionally, `visible`
|
|
17
|
+
* and `order`.
|
|
18
|
+
* @returns A function that removes the extension.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // app/plugins/detail-actions.ts
|
|
22
|
+
* export default defineNuxtPlugin(() => {
|
|
23
|
+
* defineDetailExtension({
|
|
24
|
+
* key: "duplicate",
|
|
25
|
+
* placement: "actions",
|
|
26
|
+
* component: () => import("~/components/DuplicateButton.vue"),
|
|
27
|
+
* visible: (detail) => !detail.isNew.value,
|
|
28
|
+
* });
|
|
29
|
+
* });
|
|
30
|
+
*/
|
|
31
|
+
export declare function defineDetailExtension(extension: DetailExtension): () => void;
|
|
32
|
+
//# sourceMappingURL=defineDetailExtension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineDetailExtension.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/defineDetailExtension.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAK5B;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,MAAqB,GAC7B,eAAe,EAAE,CAOnB;AAgBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,IAAI,CAa5E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineAsyncComponent, shallowReactive } from "vue";
|
|
2
|
+
import { useNuxtApp } from "#app";
|
|
3
|
+
const registries = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
export function detailExtensions(nuxtApp = useNuxtApp()) {
|
|
5
|
+
let list = registries.get(nuxtApp);
|
|
6
|
+
if (!list) {
|
|
7
|
+
list = shallowReactive([]);
|
|
8
|
+
registries.set(nuxtApp, list);
|
|
9
|
+
}
|
|
10
|
+
return list;
|
|
11
|
+
}
|
|
12
|
+
function toComponent(entry) {
|
|
13
|
+
if (typeof entry !== "function") return entry;
|
|
14
|
+
const load = entry;
|
|
15
|
+
return defineAsyncComponent(async () => {
|
|
16
|
+
const loaded = await load();
|
|
17
|
+
const isModule = typeof loaded === "object" && "default" in loaded;
|
|
18
|
+
return isModule ? loaded.default : loaded;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function defineDetailExtension(extension) {
|
|
22
|
+
const list = detailExtensions();
|
|
23
|
+
const entry = {
|
|
24
|
+
...extension,
|
|
25
|
+
component: toComponent(extension.component)
|
|
26
|
+
};
|
|
27
|
+
const index = list.findIndex((item) => item.key === extension.key);
|
|
28
|
+
if (index >= 0) list.splice(index, 1, entry);
|
|
29
|
+
else list.push(entry);
|
|
30
|
+
return () => {
|
|
31
|
+
const at = list.indexOf(entry);
|
|
32
|
+
if (at >= 0) list.splice(at, 1);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InjectionKey } from "vue";
|
|
2
|
+
import type { MapoDetailContext } from "../types/detail.js";
|
|
3
|
+
/** The key `MapoDetail` provides its context under. @internal */
|
|
4
|
+
export declare const DETAIL_KEY: InjectionKey<MapoDetailContext>;
|
|
5
|
+
/**
|
|
6
|
+
* The context of the `MapoDetail` around the calling component: record, fields,
|
|
7
|
+
* languages, state, `save()`, the annotations channel and the shared `OPTIONS`
|
|
8
|
+
* response. Use it in a slot, a field or an extension, instead of passing the
|
|
9
|
+
* same values down again.
|
|
10
|
+
*
|
|
11
|
+
* @returns The context, or `undefined` outside a `MapoDetail`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const detail = useMapoDetail<Article>();
|
|
15
|
+
* if (detail) detail.model.value.title = "Chi siamo";
|
|
16
|
+
*/
|
|
17
|
+
export declare function useMapoDetail<T extends object = Record<string, unknown>>(): MapoDetailContext<T> | undefined;
|
|
18
|
+
//# sourceMappingURL=useMapoDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMapoDetail.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/useMapoDetail.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,iEAAiE;AACjE,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,iBAAiB,CAAwB,CAAC;AAEhF;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACpE,iBAAiB,CAAC,CAAC,CAAC,GACpB,SAAS,CAEZ"}
|
|
@@ -10,6 +10,8 @@ declare module "#app" {
|
|
|
10
10
|
parent?: string;
|
|
11
11
|
/** Pin this page to the sidebar footer instead of the main navigation list. */
|
|
12
12
|
sidebarFooter?: boolean;
|
|
13
|
+
/** Sort this page among siblings in the sidebar; lower values appear first. */
|
|
14
|
+
sidebarOrder?: number;
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -29,6 +31,8 @@ declare module "vue-router" {
|
|
|
29
31
|
parent?: string;
|
|
30
32
|
/** Pin this page to the sidebar footer instead of the main navigation list. */
|
|
31
33
|
sidebarFooter?: boolean;
|
|
34
|
+
/** Sort this page among siblings in the sidebar; lower values appear first. */
|
|
35
|
+
sidebarOrder?: number;
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -120,6 +120,7 @@ export declare const useMediaStore: import("pinia").StoreDefinition<"mapo-media"
|
|
|
120
120
|
selection: import("vue").ShallowRef<MediaItem | MediaItem[] | null, MediaItem | MediaItem[] | null>;
|
|
121
121
|
editList: import("vue").Ref<number[], number[]>;
|
|
122
122
|
selectMode: import("vue").Ref<SelectMode, SelectMode>;
|
|
123
|
+
languages: import("vue").Ref<string[], string[]>;
|
|
123
124
|
parentFolder: import("vue").ComputedRef<{
|
|
124
125
|
id: number;
|
|
125
126
|
name: string;
|
|
@@ -133,6 +134,7 @@ export declare const useMediaStore: import("pinia").StoreDefinition<"mapo-media"
|
|
|
133
134
|
outside: boolean;
|
|
134
135
|
}>;
|
|
135
136
|
getRoot: (params?: MediaGetRootParams) => Promise<void>;
|
|
137
|
+
deriveLanguages: () => Promise<void>;
|
|
136
138
|
navigateToFolder: (folder: MediaFolder | null) => Promise<void>;
|
|
137
139
|
openEditor: (media: MediaItem) => Promise<void>;
|
|
138
140
|
closeEditor: () => void;
|
|
@@ -152,7 +154,7 @@ export declare const useMediaStore: import("pinia").StoreDefinition<"mapo-media"
|
|
|
152
154
|
setMimeType: (mime: string | null) => void;
|
|
153
155
|
lockMimeType: (mime: string | null) => void;
|
|
154
156
|
reset: () => void;
|
|
155
|
-
}, "pages" | "page" | "
|
|
157
|
+
}, "pages" | "page" | "languages" | "loading" | "selection" | "medias" | "folders" | "parentFolders" | "mimeType" | "lockedMime" | "editMedia" | "editList" | "selectMode">, Pick<{
|
|
156
158
|
medias: import("vue").Ref<{
|
|
157
159
|
id: number;
|
|
158
160
|
file: string;
|
|
@@ -273,6 +275,7 @@ export declare const useMediaStore: import("pinia").StoreDefinition<"mapo-media"
|
|
|
273
275
|
selection: import("vue").ShallowRef<MediaItem | MediaItem[] | null, MediaItem | MediaItem[] | null>;
|
|
274
276
|
editList: import("vue").Ref<number[], number[]>;
|
|
275
277
|
selectMode: import("vue").Ref<SelectMode, SelectMode>;
|
|
278
|
+
languages: import("vue").Ref<string[], string[]>;
|
|
276
279
|
parentFolder: import("vue").ComputedRef<{
|
|
277
280
|
id: number;
|
|
278
281
|
name: string;
|
|
@@ -286,6 +289,7 @@ export declare const useMediaStore: import("pinia").StoreDefinition<"mapo-media"
|
|
|
286
289
|
outside: boolean;
|
|
287
290
|
}>;
|
|
288
291
|
getRoot: (params?: MediaGetRootParams) => Promise<void>;
|
|
292
|
+
deriveLanguages: () => Promise<void>;
|
|
289
293
|
navigateToFolder: (folder: MediaFolder | null) => Promise<void>;
|
|
290
294
|
openEditor: (media: MediaItem) => Promise<void>;
|
|
291
295
|
closeEditor: () => void;
|
|
@@ -426,6 +430,7 @@ export declare const useMediaStore: import("pinia").StoreDefinition<"mapo-media"
|
|
|
426
430
|
selection: import("vue").ShallowRef<MediaItem | MediaItem[] | null, MediaItem | MediaItem[] | null>;
|
|
427
431
|
editList: import("vue").Ref<number[], number[]>;
|
|
428
432
|
selectMode: import("vue").Ref<SelectMode, SelectMode>;
|
|
433
|
+
languages: import("vue").Ref<string[], string[]>;
|
|
429
434
|
parentFolder: import("vue").ComputedRef<{
|
|
430
435
|
id: number;
|
|
431
436
|
name: string;
|
|
@@ -439,6 +444,7 @@ export declare const useMediaStore: import("pinia").StoreDefinition<"mapo-media"
|
|
|
439
444
|
outside: boolean;
|
|
440
445
|
}>;
|
|
441
446
|
getRoot: (params?: MediaGetRootParams) => Promise<void>;
|
|
447
|
+
deriveLanguages: () => Promise<void>;
|
|
442
448
|
navigateToFolder: (folder: MediaFolder | null) => Promise<void>;
|
|
443
449
|
openEditor: (media: MediaItem) => Promise<void>;
|
|
444
450
|
closeEditor: () => void;
|
|
@@ -458,5 +464,5 @@ export declare const useMediaStore: import("pinia").StoreDefinition<"mapo-media"
|
|
|
458
464
|
setMimeType: (mime: string | null) => void;
|
|
459
465
|
lockMimeType: (mime: string | null) => void;
|
|
460
466
|
reset: () => void;
|
|
461
|
-
}, "getRoot" | "navigateToFolder" | "openEditor" | "closeEditor" | "setLang" | "updateMedia" | "replaceFile" | "updateOrCreateFolder" | "deleteFolder" | "deleteMedia" | "
|
|
467
|
+
}, "select" | "reset" | "getRoot" | "deriveLanguages" | "navigateToFolder" | "openEditor" | "closeEditor" | "setLang" | "updateMedia" | "replaceFile" | "updateOrCreateFolder" | "deleteFolder" | "deleteMedia" | "setSelectionMode" | "setSelection" | "editSelect" | "editSelectAll" | "deleteSelected" | "uploadMedia" | "setMimeType" | "lockMimeType">>;
|
|
462
468
|
//# sourceMappingURL=media.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/runtime/stores/media.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/runtime/stores/media.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EAEX,kBAAkB,EAClB,kBAAkB,EAGlB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;iBAET,CAAC;oBAChB,CAAD;uBAA6B,CAAC;;;;;;;;;;;;;;;;;;;;iBADd,CAAC;oBAChB,CAAD;uBAA6B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBADd,CAAC;oBAChB,CAAD;uBAA6B,CAAC;;;;;;;;;;;;;;;;;;;;iBADd,CAAC;oBAChB,CAAD;uBAA6B,CAAC;;;;;;;;;;;;;;;eA+EpB,OAAO;uBACC,OAAO;iBACb,OAAO;;uBAuEa,kBAAkB,KAAQ,OAAO,CAAC,IAAI,CAAC;2BAtCpC,OAAO,CAAC,IAAI,CAAC;+BA6EP,WAAW,GAAG,IAAI,KAAG,OAAO,CAAC,IAAI,CAAC;wBAOzC,SAAS,KAAG,OAAO,CAAC,IAAI,CAAC;uBAalC,IAAI;oBAIL,MAAM,GAAG,SAAS,KAAG,IAAI;yBAId,SAAS,KAAG,OAAO,CAAC,SAAS,CAAC;2BAcrD,MAAM,QACT,IAAI,4BAET,OAAO,CAAC,SAAS,CAAC;mCAgBX,OAAO,CAAC,WAAW,CAAC,KAC3B,OAAO,CAAC,IAAI,CAAC;2BAYoB,WAAW,KAAG,OAAO,CAAC,IAAI,CAAC;yBAa7B,SAAS,KAAG,OAAO,CAAC,IAAI,CAAC;oBAgBpC,SAAS,KAAG,IAAI;6BAkBP,UAAU,KAAG,IAAI;0BAKpB,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI,KAAG,IAAI;qBAI1C,MAAM,GAAG,MAAM,EAAE,KAAG,I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2BAqBnC,kBAAkB,eACd,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,KACrC,OAAO,CAAC,SAAS,CAAC;wBA6CM,MAAM,GAAG,IAAI,KAAG,IAAI;yBAKnB,MAAM,GAAG,IAAI,KAAG,IAAI;iBAK9B,IAAI;4VA4DtB,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { useMapoT } from "@mapomodule/i18n/runtime/composables/useMapoT";
|
|
|
8
8
|
import { applyMultipartPolicy } from "@mapomodule/core/runtime/api/multipart";
|
|
9
9
|
import { useNuxtApp, useRuntimeConfig } from "#app";
|
|
10
10
|
import { defaultMediaAdapter } from "../adapters/defaultMediaAdapter.js";
|
|
11
|
+
import { languagesFromMetadata } from "../utils/langInfo.js";
|
|
11
12
|
export const useMediaStore = defineStore("mapo-media", () => {
|
|
12
13
|
const runtimeConfig = useRuntimeConfig();
|
|
13
14
|
const mediaConfig = runtimeConfig.public.mapoMedia ?? {};
|
|
@@ -40,6 +41,8 @@ export const useMediaStore = defineStore("mapo-media", () => {
|
|
|
40
41
|
const _currentSearch = ref("");
|
|
41
42
|
const _currentAll = ref(false);
|
|
42
43
|
const _currentLang = ref(void 0);
|
|
44
|
+
const languages = ref([]);
|
|
45
|
+
let languagesPromise = null;
|
|
43
46
|
const parentFolder = computed(
|
|
44
47
|
() => parentFolders.value[parentFolders.value.length - 1] ?? null
|
|
45
48
|
);
|
|
@@ -65,6 +68,17 @@ export const useMediaStore = defineStore("mapo-media", () => {
|
|
|
65
68
|
function folderCrud() {
|
|
66
69
|
return useCrud(endpoints.folders);
|
|
67
70
|
}
|
|
71
|
+
async function deriveLanguages() {
|
|
72
|
+
if (languagesPromise) return languagesPromise;
|
|
73
|
+
languagesPromise = (async () => {
|
|
74
|
+
try {
|
|
75
|
+
languages.value = languagesFromMetadata(await mediaCrud().options());
|
|
76
|
+
} catch {
|
|
77
|
+
languagesPromise = null;
|
|
78
|
+
}
|
|
79
|
+
})();
|
|
80
|
+
return languagesPromise;
|
|
81
|
+
}
|
|
68
82
|
function applyParentFolder(pf) {
|
|
69
83
|
if (!pf) {
|
|
70
84
|
parentFolders.value = [];
|
|
@@ -315,12 +329,14 @@ export const useMediaStore = defineStore("mapo-media", () => {
|
|
|
315
329
|
selection,
|
|
316
330
|
editList,
|
|
317
331
|
selectMode,
|
|
332
|
+
languages,
|
|
318
333
|
// getters
|
|
319
334
|
parentFolder,
|
|
320
335
|
editListSet,
|
|
321
336
|
editListState,
|
|
322
337
|
// actions
|
|
323
338
|
getRoot,
|
|
339
|
+
deriveLanguages,
|
|
324
340
|
navigateToFolder,
|
|
325
341
|
openEditor,
|
|
326
342
|
closeEditor,
|