@mapomodule/uikit 2.0.0-beta.6 → 2.0.0-beta.8
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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +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 +13 -2
- package/dist/runtime/components/MapoConfirmDialog.vue +5 -3
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoDetail.vue +40 -32
- package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoDetailLangSwitch.vue +1 -1
- package/dist/runtime/components/MapoDropArea.vue +5 -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 +2 -2
- package/dist/runtime/components/MapoListActions.vue +15 -8
- 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 +13 -9
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListTable.vue +26 -21
- 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 +26 -16
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaFileChanger.vue +8 -4
- 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 +18 -8
- package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaManagerDialog.vue +9 -5
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaPreview.vue +1 -1
- package/dist/runtime/components/MapoMediaUploader.vue +40 -16
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -1
- 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/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/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/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.map +1 -1
- package/dist/runtime/stores/media.js +36 -14
- 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/package.json +11 -8
- package/src/index.ts +12 -0
- package/src/module.ts +17 -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 +6 -1
- 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 +3 -1
- package/src/runtime/components/MapoMediaEditor.vue +26 -16
- 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 +43 -16
- 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 +5 -2
- package/src/runtime/plugins/media-adapter.ts +9 -5
- package/src/runtime/stores/media.ts +51 -15
- package/src/runtime/types/menu.ts +105 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { MapoUikitOptions } from './module.mjs';
|
|
2
2
|
export { ActionContext, ActionDescriptor, ActiveFilter, FilterChoice, FilterDescriptor, ListColumn, ListTabItem } from '../dist/runtime/types/list.js';
|
|
3
3
|
export { MediaApiResponse, MediaFolder, MediaGetRootParams, MediaItem, MediaUploadPayload, SelectMode } from '../dist/runtime/types/media.js';
|
|
4
|
+
export { MapoMenu, MenuNodeLink, MenuTranslation, MenuTreeNode, createMenuNode, findMenuNode, menuTreeDepth, removeMenuNode } from '../dist/runtime/types/menu.js';
|
|
4
5
|
import '@nuxt/schema';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export type { MapoUikitOptions } from "./module";
|
|
2
2
|
export type { ListColumn, FilterChoice, FilterDescriptor, ActiveFilter, ActionContext, ActionDescriptor, ListTabItem, } from "./runtime/types/list.js";
|
|
3
3
|
export type { MediaItem, MediaFolder, MediaApiResponse, MediaGetRootParams, MediaUploadPayload, SelectMode, } from "./runtime/types/media.js";
|
|
4
|
+
export type { MapoMenu, MenuTreeNode, MenuNodeLink, MenuTranslation, } from "./runtime/types/menu.js";
|
|
5
|
+
export { createMenuNode, menuTreeDepth, findMenuNode, removeMenuNode, } from "./runtime/types/menu.js";
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,GACX,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,GACZ,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,GACX,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,yBAAyB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { createMenuNode, findMenuNode, menuTreeDepth, removeMenuNode } from '../dist/runtime/types/menu.js';
|
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE7B;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE;QACV,gFAAgF;QAChF,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,8DAA8D;QAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;;AAaD,wBAoO0C"}
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync, existsSync } from 'node:fs';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { defineNuxtModule, createResolver, addTypeTemplate, addComponent, addLayout, addPlugin, addImports, extendPages } from '@nuxt/kit';
|
|
3
|
+
import { defineNuxtModule, createResolver, hasNuxtModule, installModule, addTypeTemplate, addComponent, addLayout, addPlugin, addImports, extendPages } from '@nuxt/kit';
|
|
4
4
|
|
|
5
5
|
const MAPO_MEDIA_DEFAULTS = {
|
|
6
6
|
endpoints: {
|
|
@@ -33,6 +33,9 @@ const module$1 = defineNuxtModule({
|
|
|
33
33
|
(nuxt.options.imports.transform.include ??= []).push(
|
|
34
34
|
/@mapomodule[\\/]uikit[\\/]/
|
|
35
35
|
);
|
|
36
|
+
if (!hasNuxtModule("@mapomodule/i18n")) {
|
|
37
|
+
await installModule(await resolver.resolvePath("@mapomodule/i18n"));
|
|
38
|
+
}
|
|
36
39
|
addTypeTemplate({
|
|
37
40
|
filename: "types/mapo-uikit-page-meta.d.ts",
|
|
38
41
|
getContents: () => readFileSync(
|
|
@@ -74,6 +77,8 @@ const module$1 = defineNuxtModule({
|
|
|
74
77
|
"MapoLogoutButton",
|
|
75
78
|
"MapoSidebarProfile",
|
|
76
79
|
"MapoTopbar",
|
|
80
|
+
"MapoLangSwitcher",
|
|
81
|
+
"MapoThemeToggle",
|
|
77
82
|
// ─── CRUD / Detail / List ─────────────────────────────────────────────
|
|
78
83
|
"MapoDetail",
|
|
79
84
|
"MapoDetailLangSwitch",
|
|
@@ -92,7 +97,13 @@ const module$1 = defineNuxtModule({
|
|
|
92
97
|
"MapoMediaFileChanger",
|
|
93
98
|
"MapoMediaEditor",
|
|
94
99
|
"MapoMediaUploader",
|
|
95
|
-
"MapoMediaManager"
|
|
100
|
+
"MapoMediaManager",
|
|
101
|
+
"MapoMediaManagerDialog",
|
|
102
|
+
// ─── Menu Manager ─────────────────────────────────────────────────────
|
|
103
|
+
"MapoMenuTreeviewNode",
|
|
104
|
+
"MapoMenuTreeview",
|
|
105
|
+
"MapoMenuNodeEditor",
|
|
106
|
+
"MapoMenuManager"
|
|
96
107
|
];
|
|
97
108
|
for (const name of components) {
|
|
98
109
|
addComponent({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useI18n } from "vue-i18n";
|
|
2
3
|
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
4
|
+
const { t } = useI18n();
|
|
3
5
|
const store = useConfirmStore();
|
|
4
6
|
</script>
|
|
5
7
|
|
|
@@ -9,7 +11,7 @@ const store = useConfirmStore();
|
|
|
9
11
|
<div class="p-6 space-y-4">
|
|
10
12
|
<div class="space-y-1">
|
|
11
13
|
<h3 class="text-base font-semibold text-highlighted">
|
|
12
|
-
{{ store.options?.title ?? "
|
|
14
|
+
{{ store.options?.title ?? t("mapo.confirm") }}
|
|
13
15
|
</h3>
|
|
14
16
|
<p class="text-sm text-muted">
|
|
15
17
|
{{ store.options?.message }}
|
|
@@ -18,13 +20,13 @@ const store = useConfirmStore();
|
|
|
18
20
|
|
|
19
21
|
<div class="flex justify-end gap-3">
|
|
20
22
|
<UButton variant="ghost" color="neutral" @click="store.cancel()">
|
|
21
|
-
{{ store.options?.cancelText ?? "
|
|
23
|
+
{{ store.options?.cancelText ?? t("mapo.cancel") }}
|
|
22
24
|
</UButton>
|
|
23
25
|
<UButton
|
|
24
26
|
:color="store.options?.dangerous ? 'error' : 'primary'"
|
|
25
27
|
@click="store.confirm()"
|
|
26
28
|
>
|
|
27
|
-
{{ store.options?.confirmText ?? "
|
|
29
|
+
{{ store.options?.confirmText ?? t("mapo.confirm") }}
|
|
28
30
|
</UButton>
|
|
29
31
|
</div>
|
|
30
32
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoConfirmDialog.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoConfirmDialog.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoConfirmDialog.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoConfirmDialog.vue"],"names":[],"mappings":"AA0KA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -9,10 +9,15 @@ import {
|
|
|
9
9
|
onBeforeUnmount,
|
|
10
10
|
provide
|
|
11
11
|
} from "vue";
|
|
12
|
-
import { useRouter, onBeforeRouteLeave } from "
|
|
13
|
-
import {
|
|
12
|
+
import { useRouter, onBeforeRouteLeave, useNuxtApp } from "#app";
|
|
13
|
+
import { useI18n } from "vue-i18n";
|
|
14
14
|
import { objectDiff, debounce, deepClone } from "@mapomodule/utils";
|
|
15
15
|
import { useCrud } from "@mapomodule/core/runtime/api/crud";
|
|
16
|
+
import {
|
|
17
|
+
getErrorData,
|
|
18
|
+
getErrorDetail,
|
|
19
|
+
getErrorStatus
|
|
20
|
+
} from "@mapomodule/core/runtime/utils/fetchError";
|
|
16
21
|
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
17
22
|
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
18
23
|
import { usePermissions } from "@mapomodule/store/runtime/composables/usePermissions";
|
|
@@ -27,7 +32,7 @@ const props = defineProps({
|
|
|
27
32
|
sticky: { type: Boolean, required: false, default: true },
|
|
28
33
|
usePatch: { type: Boolean, required: false, default: true },
|
|
29
34
|
readonly: { type: Boolean, required: false, default: false },
|
|
30
|
-
registry: { type:
|
|
35
|
+
registry: { type: null, required: false, default: null },
|
|
31
36
|
draft: { type: Boolean, required: false, default: false },
|
|
32
37
|
draftKey: { type: String, required: false, default: void 0 },
|
|
33
38
|
multipart: { type: null, required: false, default: "auto" },
|
|
@@ -38,6 +43,7 @@ const props = defineProps({
|
|
|
38
43
|
const emit = defineEmits(["saved", "deleted", "draft-found"]);
|
|
39
44
|
const { $mapoFormRegistry } = useNuxtApp();
|
|
40
45
|
const registry = computed(() => props.registry ?? $mapoFormRegistry);
|
|
46
|
+
const { t } = useI18n();
|
|
41
47
|
const router = useRouter();
|
|
42
48
|
const snack = useSnackStore();
|
|
43
49
|
const confirm = useConfirmStore();
|
|
@@ -189,10 +195,8 @@ async function fetchModel() {
|
|
|
189
195
|
}
|
|
190
196
|
checkDraft();
|
|
191
197
|
} catch (err) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
snack.show(detail ?? "Failed to load item", "error");
|
|
195
|
-
if (status === 404) router.back();
|
|
198
|
+
snack.show(getErrorDetail(err) ?? t("mapo.loadItemError"), "error");
|
|
199
|
+
if (getErrorStatus(err) === 404) router.back();
|
|
196
200
|
} finally {
|
|
197
201
|
isLoading.value = false;
|
|
198
202
|
}
|
|
@@ -204,7 +208,7 @@ async function save(andBack = false) {
|
|
|
204
208
|
const fieldErrors = validationResults.flatMap(
|
|
205
209
|
(r) => Object.entries(r.errors)
|
|
206
210
|
);
|
|
207
|
-
const message = fieldErrors.length ? fieldErrors.map(([field, msg]) => `${field}: ${msg}`).join("\n") : "
|
|
211
|
+
const message = fieldErrors.length ? fieldErrors.map(([field, msg]) => `${field}: ${msg}`).join("\n") : t("mapo.fixErrors");
|
|
208
212
|
snack.show(message, "error");
|
|
209
213
|
return;
|
|
210
214
|
}
|
|
@@ -235,7 +239,7 @@ async function save(andBack = false) {
|
|
|
235
239
|
backup.value = deepClone(model.value);
|
|
236
240
|
clearDraft();
|
|
237
241
|
snack.show(
|
|
238
|
-
isNew.value ? "
|
|
242
|
+
isNew.value ? t("mapo.createSuccess") : t("mapo.saveSuccess"),
|
|
239
243
|
"success"
|
|
240
244
|
);
|
|
241
245
|
emit("saved", model.value);
|
|
@@ -247,15 +251,14 @@ async function save(andBack = false) {
|
|
|
247
251
|
}
|
|
248
252
|
if (andBack) back();
|
|
249
253
|
} catch (err) {
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
if (response?.status === 400 && data && typeof data === "object") {
|
|
254
|
+
const data = getErrorData(err);
|
|
255
|
+
if (getErrorStatus(err) === 400 && data && typeof data === "object") {
|
|
253
256
|
errors.value = data;
|
|
254
257
|
const detail = data.detail;
|
|
255
258
|
if (detail) snack.show(detail, "error");
|
|
256
259
|
} else {
|
|
257
260
|
const detail = data?.detail;
|
|
258
|
-
snack.show(detail ?? "
|
|
261
|
+
snack.show(detail ?? t("mapo.saveError"), "error");
|
|
259
262
|
}
|
|
260
263
|
} finally {
|
|
261
264
|
isSaving.value = false;
|
|
@@ -267,9 +270,9 @@ function getPatch() {
|
|
|
267
270
|
}
|
|
268
271
|
async function deleteItem() {
|
|
269
272
|
const ok = await confirm.ask({
|
|
270
|
-
title: "
|
|
271
|
-
message: "
|
|
272
|
-
confirmText: "
|
|
273
|
+
title: t("mapo.delete"),
|
|
274
|
+
message: t("mapo.detail.deleteQuestion"),
|
|
275
|
+
confirmText: t("mapo.delete"),
|
|
273
276
|
dangerous: true
|
|
274
277
|
});
|
|
275
278
|
if (!ok) return;
|
|
@@ -277,12 +280,11 @@ async function deleteItem() {
|
|
|
277
280
|
try {
|
|
278
281
|
await crud.delete(recordId());
|
|
279
282
|
backup.value = deepClone(model.value);
|
|
280
|
-
snack.show("
|
|
283
|
+
snack.show(t("mapo.deleteSuccess"), "success");
|
|
281
284
|
emit("deleted");
|
|
282
285
|
back();
|
|
283
286
|
} catch (err) {
|
|
284
|
-
|
|
285
|
-
snack.show(detail ?? "Failed to delete", "error");
|
|
287
|
+
snack.show(getErrorDetail(err) ?? t("mapo.deleteError"), "error");
|
|
286
288
|
} finally {
|
|
287
289
|
isDeleting.value = false;
|
|
288
290
|
}
|
|
@@ -293,9 +295,9 @@ function back() {
|
|
|
293
295
|
async function guardUnsaved() {
|
|
294
296
|
if (!isDirty.value) return true;
|
|
295
297
|
return confirm.ask({
|
|
296
|
-
title: "
|
|
297
|
-
message: "
|
|
298
|
-
confirmText: "
|
|
298
|
+
title: t("mapo.unsavedData"),
|
|
299
|
+
message: t("mapo.confirmLeaveChanges"),
|
|
300
|
+
confirmText: t("mapo.leave"),
|
|
299
301
|
dangerous: true
|
|
300
302
|
});
|
|
301
303
|
}
|
|
@@ -373,12 +375,16 @@ defineSlots();
|
|
|
373
375
|
color="warning"
|
|
374
376
|
variant="subtle"
|
|
375
377
|
class="mb-3"
|
|
376
|
-
:title="
|
|
377
|
-
|
|
378
|
+
:title="
|
|
379
|
+
t('mapo.detail.draftSavedAt', {
|
|
380
|
+
date: draftBanner.savedAt.toLocaleString()
|
|
381
|
+
})
|
|
382
|
+
"
|
|
383
|
+
:description="t('mapo.detail.draftFound')"
|
|
378
384
|
>
|
|
379
385
|
<template #actions>
|
|
380
386
|
<UButton size="xs" color="warning" @click="draftBanner?.restore()">
|
|
381
|
-
|
|
387
|
+
{{ t("mapo.restore") }}
|
|
382
388
|
</UButton>
|
|
383
389
|
<UButton
|
|
384
390
|
size="xs"
|
|
@@ -386,7 +392,7 @@ defineSlots();
|
|
|
386
392
|
variant="ghost"
|
|
387
393
|
@click="draftBanner?.discard()"
|
|
388
394
|
>
|
|
389
|
-
|
|
395
|
+
{{ t("mapo.discard") }}
|
|
390
396
|
</UButton>
|
|
391
397
|
</template>
|
|
392
398
|
</UAlert>
|
|
@@ -396,7 +402,7 @@ defineSlots();
|
|
|
396
402
|
<!-- Title -->
|
|
397
403
|
<slot name="title" v-bind="slotBindings">
|
|
398
404
|
<h1 class="text-2xl font-bold text-gray-900 dark:text-white mb-6">
|
|
399
|
-
{{ isNew ? "
|
|
405
|
+
{{ isNew ? t("mapo.new") : t("mapo.edit") }}
|
|
400
406
|
<span v-if="modelName"> {{ modelName }}</span>
|
|
401
407
|
</h1>
|
|
402
408
|
</slot>
|
|
@@ -455,7 +461,7 @@ defineSlots();
|
|
|
455
461
|
icon="i-lucide-save"
|
|
456
462
|
@click="save(true)"
|
|
457
463
|
>
|
|
458
|
-
{{ isNew ? "
|
|
464
|
+
{{ isNew ? t("mapo.create") : t("mapo.save") }}
|
|
459
465
|
</UButton>
|
|
460
466
|
</slot>
|
|
461
467
|
|
|
@@ -468,7 +474,9 @@ defineSlots();
|
|
|
468
474
|
icon="i-lucide-save"
|
|
469
475
|
@click="save(false)"
|
|
470
476
|
>
|
|
471
|
-
{{
|
|
477
|
+
{{
|
|
478
|
+
isNew ? t("mapo.createContinue") : t("mapo.saveContinue")
|
|
479
|
+
}}
|
|
472
480
|
</UButton>
|
|
473
481
|
</slot>
|
|
474
482
|
|
|
@@ -479,7 +487,7 @@ defineSlots();
|
|
|
479
487
|
icon="i-lucide-arrow-left"
|
|
480
488
|
@click="back"
|
|
481
489
|
>
|
|
482
|
-
|
|
490
|
+
{{ t("mapo.back") }}
|
|
483
491
|
</UButton>
|
|
484
492
|
</slot>
|
|
485
493
|
</div>
|
|
@@ -542,7 +550,7 @@ defineSlots();
|
|
|
542
550
|
icon="i-lucide-eye"
|
|
543
551
|
@click="previewOpen = true"
|
|
544
552
|
>
|
|
545
|
-
|
|
553
|
+
{{ t("mapo.preview") }}
|
|
546
554
|
</UButton>
|
|
547
555
|
|
|
548
556
|
<!-- Danger zone: delete action, visually separated from save actions -->
|
|
@@ -557,7 +565,7 @@ defineSlots();
|
|
|
557
565
|
icon="i-lucide-trash-2"
|
|
558
566
|
@click="deleteItem"
|
|
559
567
|
>
|
|
560
|
-
|
|
568
|
+
{{ t("mapo.delete") }}
|
|
561
569
|
</UButton>
|
|
562
570
|
</slot>
|
|
563
571
|
</UCard>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoDetail.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoDetail.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoDetail.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoDetail.vue"],"names":[],"mappings":"AAm2BA,OAAO,EAUL,KAAK,KAAK,EACX,MAAM,KAAK,CAAC;AAYb,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,QAAA,MAAM,YAAY,GAAK,CAAC,SAAS,MAAM,EACtC,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAA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,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;yBACnB,MAAM;mBACZ,OAAO;uBACH,OAAO;sBACR,OAAO;wBACL,OAAO;qBACV,OAAO;;yBAbP,IAAI;yBACJ,MAAM,IAAI;yBACV,MAAM,IAAI;;sBAaT,OAAO;uBACN,OAAO;kBACZ,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC;wBAC9B,MAAM,OAAO,CAAC,IAAI,CAAC;kBACzB,MAAM,IAAI;YAsCoB,KAAK,EAAE;;;YA1evC,OAAO,SAAS,CAAC,GAAG,IAAI;YACxB,SAAS,GAAG,IAAI;YAMf,aAAa,SACT,CAAC,WACC,IAAI,WACJ,MAAM,IAAI,WACV,MAAM,IAAI,GAClB,IAAI;;EAosCL,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAI,CAAC;wBACvD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, computed, watch, onMounted, nextTick } from "vue";
|
|
3
|
-
import { useRoute, useRouter } from "
|
|
3
|
+
import { useRoute, useRouter } from "#app";
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
modelValue: { type: String, required: true },
|
|
6
6
|
langs: { type: Array, required: true },
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
const { t } = useI18n();
|
|
3
5
|
const props = defineProps({
|
|
4
6
|
accept: { type: String, required: false, default: "*/*" },
|
|
5
7
|
multiple: { type: Boolean, required: false, default: true },
|
|
@@ -83,7 +85,9 @@ defineExpose({ triggerPick });
|
|
|
83
85
|
>
|
|
84
86
|
<div class="flex flex-col items-center gap-2 text-primary">
|
|
85
87
|
<UIcon name="i-lucide-upload-cloud" class="size-10" />
|
|
86
|
-
<span class="text-sm font-medium">
|
|
88
|
+
<span class="text-sm font-medium">{{
|
|
89
|
+
t("mapo.dropArea.dropHere")
|
|
90
|
+
}}</span>
|
|
87
91
|
</div>
|
|
88
92
|
</div>
|
|
89
93
|
</Transition>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoDropArea.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoDropArea.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoDropArea.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoDropArea.vue"],"names":[],"mappings":"AAuIA,KAAK,WAAW,GAAG;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAiDJ,iBAAS,WAAW,SAEnB;AAgJD,QAAA,IAAI,OAAO;;;CAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAO/C,QAAA,MAAM,UAAU;;;;;;;YA/MH,MAAM;cACJ,OAAO;cACP,OAAO;6EAkNpB,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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
flags: { type: Boolean, required: false, default: true },
|
|
6
|
+
size: { type: String, required: false, default: "sm" }
|
|
7
|
+
});
|
|
8
|
+
const { locale, locales, setLocale } = useI18n();
|
|
9
|
+
function getFlag(language) {
|
|
10
|
+
const region = language?.split("-").at(-1);
|
|
11
|
+
if (!region || region.length !== 2 || !/^[A-Za-z]+$/.test(region)) return "";
|
|
12
|
+
const codePoints = region.toUpperCase().split("").map((char) => 127397 + char.charCodeAt(0));
|
|
13
|
+
return String.fromCodePoint(...codePoints);
|
|
14
|
+
}
|
|
15
|
+
const items = computed(
|
|
16
|
+
() => locales.value.map((l) => ({
|
|
17
|
+
label: props.flags && getFlag(l.language) ? `${getFlag(l.language)} ${l.name ?? l.code.toUpperCase()}` : l.name ?? l.code.toUpperCase(),
|
|
18
|
+
value: l.code
|
|
19
|
+
}))
|
|
20
|
+
);
|
|
21
|
+
const current = computed({
|
|
22
|
+
get: () => locale.value,
|
|
23
|
+
set: (code) => {
|
|
24
|
+
if (code && code !== locale.value) setLocale(code);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<USelectMenu
|
|
31
|
+
v-model="current"
|
|
32
|
+
:items="items"
|
|
33
|
+
value-key="value"
|
|
34
|
+
label-key="label"
|
|
35
|
+
:size="size"
|
|
36
|
+
:search-input="false"
|
|
37
|
+
class="w-40"
|
|
38
|
+
/>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI locale switcher — lists the locales configured in `@nuxtjs/i18n`
|
|
3
|
+
* (via `@mapomodule/i18n`) and switches the interface language with
|
|
4
|
+
* cookie persistence. Port of the v1 `LangSwitcher`.
|
|
5
|
+
*/
|
|
6
|
+
type __VLS_Props = {
|
|
7
|
+
/** Show the flag emoji derived from the locale `language` tag. */
|
|
8
|
+
flags?: boolean;
|
|
9
|
+
/** Nuxt UI USelectMenu `size` prop. */
|
|
10
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
13
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
14
|
+
flags: boolean;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=MapoLangSwitcher.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapoLangSwitcher.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoLangSwitcher.vue"],"names":[],"mappings":"AAiFA;;;;GAIG;AACH,KAAK,WAAW,GAAG;IACf,kEAAkE;IAClE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACzC,CAAC;AAgGJ,QAAA,MAAM,YAAY;UAjGP,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;WAF/B,OAAO;6EAsGjB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, computed, watch, useSlots } from "vue";
|
|
3
3
|
import { debounce } from "@mapomodule/utils";
|
|
4
|
-
import { useRoute, useRouter } from "
|
|
4
|
+
import { useRoute, useRouter } from "#app";
|
|
5
5
|
const props = defineProps({
|
|
6
6
|
endpoint: { type: String, required: false, default: "" },
|
|
7
7
|
items: { type: Array, required: false, default: void 0 },
|
|
@@ -18,7 +18,7 @@ const props = defineProps({
|
|
|
18
18
|
positionField: { type: String, required: false, default: "position" },
|
|
19
19
|
editFields: { type: Array, required: false, default: () => [] },
|
|
20
20
|
languages: { type: Array, required: false },
|
|
21
|
-
registry: { type:
|
|
21
|
+
registry: { type: null, required: false },
|
|
22
22
|
detailBase: { type: String, required: false },
|
|
23
23
|
permissionModel: { type: String, required: false },
|
|
24
24
|
defaultPageSize: { type: Number, required: false, default: 20 },
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
4
5
|
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
5
6
|
import { usePermissions } from "@mapomodule/store/runtime/composables/usePermissions";
|
|
6
7
|
import { useCrud } from "@mapomodule/core/runtime/api/crud";
|
|
8
|
+
import { getErrorDetail } from "@mapomodule/core/runtime/utils/fetchError";
|
|
7
9
|
const props = defineProps({
|
|
8
10
|
actions: { type: Array, required: false, default: () => [] },
|
|
9
11
|
selection: { type: [Array, String], required: true },
|
|
@@ -13,13 +15,14 @@ const props = defineProps({
|
|
|
13
15
|
});
|
|
14
16
|
const emit = defineEmits(["actionCompleted"]);
|
|
15
17
|
defineSlots();
|
|
18
|
+
const { t } = useI18n();
|
|
16
19
|
const snack = useSnackStore();
|
|
17
20
|
const confirm = useConfirmStore();
|
|
18
21
|
const crud = useCrud(props.endpoint);
|
|
19
22
|
const isRunning = ref(false);
|
|
20
23
|
const defaultActions = computed(() => [
|
|
21
24
|
{
|
|
22
|
-
label: "
|
|
25
|
+
label: t("mapo.listActions.permanentDelete"),
|
|
23
26
|
handler: async ({ selection }) => {
|
|
24
27
|
if (!selection) return;
|
|
25
28
|
await Promise.all(
|
|
@@ -59,8 +62,10 @@ async function runAction() {
|
|
|
59
62
|
const action = selectedAction.value;
|
|
60
63
|
const ok = await confirm.ask({
|
|
61
64
|
title: action.label,
|
|
62
|
-
message: props.selection === "all" ? "
|
|
63
|
-
|
|
65
|
+
message: props.selection === "all" ? t("mapo.listActions.confirmBulk") : t("mapo.listActions.confirmBulkCount", {
|
|
66
|
+
count: props.selection.length
|
|
67
|
+
}),
|
|
68
|
+
confirmText: t("mapo.confirm"),
|
|
64
69
|
dangerous: !!action.dangerous
|
|
65
70
|
});
|
|
66
71
|
if (!ok) return;
|
|
@@ -71,12 +76,14 @@ async function runAction() {
|
|
|
71
76
|
selectionQuery: props.selectionQuery,
|
|
72
77
|
lookup: props.lookup
|
|
73
78
|
});
|
|
74
|
-
snack.show("
|
|
79
|
+
snack.show(t("mapo.listActions.actionCompleted"), "success");
|
|
75
80
|
emit("actionCompleted");
|
|
76
81
|
selectedLabel.value = void 0;
|
|
77
82
|
} catch (err) {
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
snack.show(
|
|
84
|
+
getErrorDetail(err) ?? t("mapo.listActions.actionFailed"),
|
|
85
|
+
"error"
|
|
86
|
+
);
|
|
80
87
|
} finally {
|
|
81
88
|
isRunning.value = false;
|
|
82
89
|
}
|
|
@@ -94,7 +101,7 @@ const isActive = computed(
|
|
|
94
101
|
:items="visibleActions"
|
|
95
102
|
value-key="label"
|
|
96
103
|
label-key="label"
|
|
97
|
-
placeholder="
|
|
104
|
+
:placeholder="t('mapo.listActions.bulkActions')"
|
|
98
105
|
size="sm"
|
|
99
106
|
class="min-w-48"
|
|
100
107
|
/>
|
|
@@ -105,7 +112,7 @@ const isActive = computed(
|
|
|
105
112
|
:disabled="!selectedAction || !canRun(selectedAction)"
|
|
106
113
|
@click="runAction"
|
|
107
114
|
>
|
|
108
|
-
|
|
115
|
+
{{ t("mapo.apply") }}
|
|
109
116
|
</UButton>
|
|
110
117
|
<slot name="append" />
|
|
111
118
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoListActions.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoListActions.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoListActions.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoListActions.vue"],"names":[],"mappings":"AAmKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOzD,QAAA,MAAM,YAAY,GAAK,CAAC,SAAS,MAAM,EACtC,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,gBAAgB,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAClE;WAoOO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;kBAlO1C,gBAAgB,CAAC,CAAC,CAAC,EAAE;mBACpB,CAAC,EAAE,GAAG,KAAK;wBACN,eAAe;kBACrB,MAAM;iBACP,MAAM;;;KA8NwE,CAAC,GAAG,CAAC,OAAO,UAAU,SAAS;QAAE,oBAAoB,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YAC5J,CAAC,OAAO,EAAE,EAAE,KAAK,IAAI;WACtB,GAAG;;QAlNT,qFAAqF;mBAC1E,GAAG;QACd,qDAAqD;kBAC3C,GAAG;;;EAmNX,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAI,CAAC;wBACvD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, computed, watch } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
const { t } = useI18n();
|
|
3
5
|
const props = defineProps({
|
|
4
6
|
filters: { type: Array, required: true },
|
|
5
7
|
modelValue: { type: Array, required: true },
|
|
@@ -145,7 +147,7 @@ const isOpen = ref(false);
|
|
|
145
147
|
color="neutral"
|
|
146
148
|
@click="removeAll"
|
|
147
149
|
>
|
|
148
|
-
|
|
150
|
+
{{ t("mapo.listFilters.clearAll") }}
|
|
149
151
|
</UButton>
|
|
150
152
|
|
|
151
153
|
<!-- Filter dropdown button -->
|
|
@@ -158,7 +160,7 @@ const isOpen = ref(false);
|
|
|
158
160
|
:disabled="disabled"
|
|
159
161
|
trailing-icon=""
|
|
160
162
|
>
|
|
161
|
-
|
|
163
|
+
{{ t("mapo.listFilters.filters") }}
|
|
162
164
|
</UButton>
|
|
163
165
|
|
|
164
166
|
<template #content>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoListFilters.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoListFilters.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoListFilters.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoListFilters.vue"],"names":[],"mappings":"AAySA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACb,MAAM,kBAAkB,CAAC;AAI1B,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAMF,KAAK,WAAW,GAAG;IACjB;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,UAAU,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE;QAC/B,MAAM,EAAE,gBAAgB,GAAG;YAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;QAChD,MAAM,CAAC,EAAE,YAAY,CAAC;QACtB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;QACxE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;QAClD,cAAc,CAAC,EAAE,CACf,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,YAAY,KACjB,OAAO,CAAC;KACd,KAAK,GAAG,CAAC;CACX,CAAC;AAwdF,QAAA,MAAM,UAAU;;;;kFAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|