@mapomodule/uikit 2.0.0-beta.2 → 2.0.0-beta.20
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 +46 -142
- 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__/MapoList.component.test.d.ts +2 -0
- package/dist/__tests__/MapoList.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__/MapoMediaEditor.component.test.d.ts +2 -0
- package/dist/__tests__/MapoMediaEditor.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoMediaFolderPicker.component.test.d.ts +2 -0
- package/dist/__tests__/MapoMediaFolderPicker.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoMediaFolders.component.test.d.ts +2 -0
- package/dist/__tests__/MapoMediaFolders.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoMediaGallery.component.test.d.ts +2 -0
- package/dist/__tests__/MapoMediaGallery.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoMediaUploadHandover.component.test.d.ts +2 -0
- package/dist/__tests__/MapoMediaUploadHandover.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoMenuManager.component.test.d.ts +2 -0
- package/dist/__tests__/MapoMenuManager.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__/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__/mediaDrag.test.d.ts +2 -0
- package/dist/__tests__/mediaDrag.test.d.ts.map +1 -0
- package/dist/__tests__/mediaFolders.test.d.ts +2 -0
- package/dist/__tests__/mediaFolders.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__/mediaMetadata.test.d.ts +2 -0
- package/dist/__tests__/mediaMetadata.test.d.ts.map +1 -0
- package/dist/__tests__/mediaStore.test.d.ts +2 -0
- package/dist/__tests__/mediaStore.test.d.ts.map +1 -0
- package/dist/__tests__/mediaUrl.test.d.ts +2 -0
- package/dist/__tests__/mediaUrl.test.d.ts.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/module.d.mts +48 -1
- package/dist/module.d.ts +44 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +71 -2
- package/dist/runtime/adapters/defaultMediaAdapter.d.ts +15 -0
- package/dist/runtime/adapters/defaultMediaAdapter.d.ts.map +1 -0
- package/dist/runtime/adapters/defaultMediaAdapter.js +35 -0
- 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 +127 -55
- package/dist/runtime/components/MapoDetail.vue.d.ts +102 -5
- package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -1
- 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 +110 -0
- package/dist/runtime/components/MapoDropArea.vue.d.ts +33 -0
- package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoLangSwitcher.vue +39 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts +18 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoList.vue +45 -31
- package/dist/runtime/components/MapoList.vue.d.ts +18 -5
- 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 +20 -10
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListTable.vue +125 -49
- package/dist/runtime/components/MapoListTable.vue.d.ts +13 -5
- 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 +47 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaEditor.vue +382 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts +13 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue +112 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts +15 -0
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaFolderPicker.vue +129 -0
- package/dist/runtime/components/MapoMediaFolderPicker.vue.d.ts +33 -0
- package/dist/runtime/components/MapoMediaFolderPicker.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaFolders.vue +402 -0
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts +4 -0
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaGallery.vue +304 -0
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts +8 -0
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaManager.vue +144 -0
- package/dist/runtime/components/MapoMediaManager.vue.d.ts +44 -0
- package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue +116 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts +41 -0
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaPreview.vue +94 -0
- package/dist/runtime/components/MapoMediaPreview.vue.d.ts +19 -0
- package/dist/runtime/components/MapoMediaPreview.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMediaUploader.vue +294 -0
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts +8 -0
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuManager.vue +301 -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/page-meta.nuxt.d.ts +4 -0
- package/dist/runtime/pages/index.vue +4 -3
- package/dist/runtime/pages/index.vue.d.ts.map +1 -1
- package/dist/runtime/pages/login.vue +0 -4
- package/dist/runtime/pages/login.vue.d.ts.map +1 -1
- package/dist/runtime/plugins/media-adapter.d.ts +18 -0
- package/dist/runtime/plugins/media-adapter.d.ts.map +1 -0
- package/dist/runtime/plugins/media-adapter.js +8 -0
- package/dist/runtime/stores/media.d.ts +505 -0
- package/dist/runtime/stores/media.d.ts.map +1 -0
- package/dist/runtime/stores/media.js +545 -0
- package/dist/runtime/types/list.d.ts +10 -2
- package/dist/runtime/types/list.d.ts.map +1 -1
- package/dist/runtime/types/media.d.ts +131 -0
- package/dist/runtime/types/media.d.ts.map +1 -0
- package/dist/runtime/types/media.js +0 -0
- package/dist/runtime/types/menu.d.ts +66 -0
- package/dist/runtime/types/menu.d.ts.map +1 -0
- package/dist/runtime/types/menu.js +30 -0
- package/dist/runtime/utils/contentLanguages.d.ts +9 -0
- package/dist/runtime/utils/contentLanguages.d.ts.map +1 -0
- package/dist/runtime/utils/contentLanguages.js +8 -0
- package/dist/runtime/utils/langInfo.d.ts +43 -0
- package/dist/runtime/utils/langInfo.d.ts.map +1 -0
- package/dist/runtime/utils/langInfo.js +17 -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/dist/runtime/utils/mediaDrag.d.ts +21 -0
- package/dist/runtime/utils/mediaDrag.d.ts.map +1 -0
- package/dist/runtime/utils/mediaDrag.js +11 -0
- package/dist/runtime/utils/mediaFolders.d.ts +65 -0
- package/dist/runtime/utils/mediaFolders.d.ts.map +1 -0
- package/dist/runtime/utils/mediaFolders.js +97 -0
- package/dist/runtime/utils/mediaMetadata.d.ts +39 -0
- package/dist/runtime/utils/mediaMetadata.d.ts.map +1 -0
- package/dist/runtime/utils/mediaMetadata.js +97 -0
- package/dist/runtime/utils/mediaUrl.d.ts +16 -0
- package/dist/runtime/utils/mediaUrl.d.ts.map +1 -0
- package/dist/runtime/utils/mediaUrl.js +12 -0
- package/dist/types.d.mts +1 -1
- package/package.json +15 -11
- package/src/__tests__/MapoConfirmDialog.component.test.ts +165 -0
- package/src/__tests__/MapoDetail.component.test.ts +393 -0
- package/src/__tests__/MapoDetailLangSwitch.component.test.ts +145 -0
- package/src/__tests__/MapoList.component.test.ts +166 -0
- package/src/__tests__/MapoListActions.component.test.ts +175 -0
- package/src/__tests__/MapoListTable.component.test.ts +545 -0
- package/src/__tests__/MapoMediaEditor.component.test.ts +447 -0
- package/src/__tests__/MapoMediaFolderPicker.component.test.ts +220 -0
- package/src/__tests__/MapoMediaFolders.component.test.ts +519 -0
- package/src/__tests__/MapoMediaGallery.component.test.ts +211 -0
- package/src/__tests__/MapoMediaUploadHandover.component.test.ts +241 -0
- package/src/__tests__/MapoMenuManager.component.test.ts +175 -0
- package/src/__tests__/MapoSnackBar.component.test.ts +79 -0
- package/src/__tests__/__mocks__/nuxt-app.ts +8 -0
- package/src/__tests__/langInfo.test.ts +85 -0
- package/src/__tests__/listTable.test.ts +82 -0
- package/src/__tests__/mediaDrag.test.ts +42 -0
- package/src/__tests__/mediaFolders.test.ts +204 -0
- package/src/__tests__/mediaLanguages.test.ts +66 -0
- package/src/__tests__/mediaMetadata.test.ts +169 -0
- package/src/__tests__/mediaStore.test.ts +569 -0
- package/src/__tests__/mediaUrl.test.ts +44 -0
- package/src/index.ts +21 -0
- package/src/module.ts +155 -0
- package/src/runtime/adapters/defaultMediaAdapter.ts +67 -0
- package/src/runtime/assets/main.css +9 -0
- package/src/runtime/components/MapoConfirmDialog.vue +33 -4
- package/src/runtime/components/MapoDetail.vue +229 -73
- package/src/runtime/components/MapoDetailLangSwitch.vue +27 -28
- package/src/runtime/components/MapoDropArea.vue +145 -0
- package/src/runtime/components/MapoLangSwitcher.vue +74 -0
- package/src/runtime/components/MapoList.vue +65 -34
- package/src/runtime/components/MapoListActions.vue +32 -14
- package/src/runtime/components/MapoListFilters.vue +5 -2
- package/src/runtime/components/MapoListQuickEdit.vue +22 -10
- package/src/runtime/components/MapoListTable.vue +159 -59
- package/src/runtime/components/MapoLogin.vue +13 -10
- package/src/runtime/components/MapoLogoutButton.vue +4 -2
- package/src/runtime/components/MapoMediaBreadcrumbs.vue +53 -0
- package/src/runtime/components/MapoMediaEditor.vue +447 -0
- package/src/runtime/components/MapoMediaFileChanger.vue +136 -0
- package/src/runtime/components/MapoMediaFolderPicker.vue +176 -0
- package/src/runtime/components/MapoMediaFolders.vue +478 -0
- package/src/runtime/components/MapoMediaGallery.vue +350 -0
- package/src/runtime/components/MapoMediaManager.vue +194 -0
- package/src/runtime/components/MapoMediaManagerDialog.vue +148 -0
- package/src/runtime/components/MapoMediaPreview.vue +116 -0
- package/src/runtime/components/MapoMediaUploader.vue +362 -0
- package/src/runtime/components/MapoMenuManager.vue +454 -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/page-meta.nuxt.d.ts +4 -0
- package/src/runtime/pages/index.vue +4 -3
- package/src/runtime/pages/login.vue +0 -4
- package/src/runtime/plugins/media-adapter.ts +33 -0
- package/src/runtime/stores/media.ts +820 -0
- package/src/runtime/types/list.ts +10 -2
- package/src/runtime/types/media.ts +144 -0
- package/src/runtime/types/menu.ts +105 -0
- package/src/runtime/utils/contentLanguages.ts +18 -0
- package/src/runtime/utils/langInfo.ts +63 -0
- package/src/runtime/utils/listTable.ts +54 -0
- package/src/runtime/utils/mediaDrag.ts +29 -0
- package/src/runtime/utils/mediaFolders.ts +182 -0
- package/src/runtime/utils/mediaMetadata.ts +165 -0
- package/src/runtime/utils/mediaUrl.ts +30 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, provide } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
import { VueDraggable } from "vue-draggable-plus";
|
|
5
|
+
import { deepClone } from "@mapomodule/utils";
|
|
6
|
+
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
7
|
+
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
8
|
+
import {
|
|
9
|
+
createMenuNode,
|
|
10
|
+
menuTreeDepth,
|
|
11
|
+
removeMenuNode
|
|
12
|
+
} from "../types/menu.js";
|
|
13
|
+
import { MENU_DND_CTX } from "./menuDndContext.js";
|
|
14
|
+
import MapoMenuTreeviewNode from "./MapoMenuTreeviewNode.vue";
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
nodes: { type: Array, required: true },
|
|
17
|
+
modelValue: { type: [Object, null], required: false, default: null },
|
|
18
|
+
title: { type: String, required: false, default: "" },
|
|
19
|
+
maxDepth: { type: Number, required: false, default: -1 },
|
|
20
|
+
readonly: { type: Boolean, required: false, default: false },
|
|
21
|
+
loading: { type: Boolean, required: false, default: false }
|
|
22
|
+
});
|
|
23
|
+
const emit = defineEmits(["update:modelValue", "update:nodes"]);
|
|
24
|
+
defineSlots();
|
|
25
|
+
const { t } = useI18n();
|
|
26
|
+
const confirm = useConfirmStore();
|
|
27
|
+
const snack = useSnackStore();
|
|
28
|
+
const tree = computed({
|
|
29
|
+
get: () => props.nodes,
|
|
30
|
+
set: (value) => emit("update:nodes", value)
|
|
31
|
+
});
|
|
32
|
+
function select(node) {
|
|
33
|
+
emit("update:modelValue", node);
|
|
34
|
+
}
|
|
35
|
+
const dragging = ref(false);
|
|
36
|
+
let snapshot = null;
|
|
37
|
+
const dndCtx = {
|
|
38
|
+
dragging,
|
|
39
|
+
onStart() {
|
|
40
|
+
dragging.value = true;
|
|
41
|
+
snapshot = deepClone(tree.value);
|
|
42
|
+
},
|
|
43
|
+
onEnd() {
|
|
44
|
+
dragging.value = false;
|
|
45
|
+
if (props.maxDepth > 0 && snapshot && menuTreeDepth(tree.value) > props.maxDepth) {
|
|
46
|
+
tree.value.splice(0, tree.value.length, ...snapshot);
|
|
47
|
+
snack.show(
|
|
48
|
+
t("mapo.menuTreeview.maxDepthReached", { max: props.maxDepth }),
|
|
49
|
+
"warning"
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
snapshot = null;
|
|
53
|
+
emit("update:nodes", tree.value);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
provide(MENU_DND_CTX, dndCtx);
|
|
57
|
+
const nodeRefs = ref([]);
|
|
58
|
+
function setNodeRef(index, el) {
|
|
59
|
+
nodeRefs.value[index] = el ?? null;
|
|
60
|
+
}
|
|
61
|
+
function newNode() {
|
|
62
|
+
if (props.readonly) return;
|
|
63
|
+
const node = createMenuNode();
|
|
64
|
+
const target = props.modelValue;
|
|
65
|
+
if (target) {
|
|
66
|
+
const targetDepth = depthOf(target);
|
|
67
|
+
if (props.maxDepth > 0 && targetDepth + 1 > props.maxDepth) {
|
|
68
|
+
tree.value.push(node);
|
|
69
|
+
} else {
|
|
70
|
+
target.nodes.push(node);
|
|
71
|
+
nodeRefs.value.forEach((r) => r?.openIfChild(node));
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
tree.value.push(node);
|
|
75
|
+
}
|
|
76
|
+
select(node);
|
|
77
|
+
emit("update:nodes", tree.value);
|
|
78
|
+
}
|
|
79
|
+
function depthOf(node, nodes = tree.value, depth = 1) {
|
|
80
|
+
for (const n of nodes) {
|
|
81
|
+
if (String(n.id) === String(node.id)) return depth;
|
|
82
|
+
const found = depthOf(node, n.nodes ?? [], depth + 1);
|
|
83
|
+
if (found > 0) return found;
|
|
84
|
+
}
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
async function deleteNode(node) {
|
|
88
|
+
if (props.readonly) return;
|
|
89
|
+
const ok = await confirm.ask({
|
|
90
|
+
title: t("mapo.menuTreeview.deleteTitle"),
|
|
91
|
+
message: t("mapo.menuTreeview.areYouSureDelete"),
|
|
92
|
+
confirmText: t("mapo.delete"),
|
|
93
|
+
dangerous: true
|
|
94
|
+
});
|
|
95
|
+
if (!ok) return;
|
|
96
|
+
silentDeleteNode(node);
|
|
97
|
+
}
|
|
98
|
+
function silentDeleteNode(node) {
|
|
99
|
+
removeMenuNode(tree.value, node.id);
|
|
100
|
+
if (String(props.modelValue?.id) === String(node.id)) select(null);
|
|
101
|
+
emit("update:nodes", tree.value);
|
|
102
|
+
}
|
|
103
|
+
function deleteSelectedNode() {
|
|
104
|
+
if (props.modelValue) deleteNode(props.modelValue);
|
|
105
|
+
}
|
|
106
|
+
defineExpose({ deleteSelectedNode, newNode });
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<template>
|
|
110
|
+
<div class="mapo-menu-treeview flex h-full flex-col">
|
|
111
|
+
<slot name="top" />
|
|
112
|
+
|
|
113
|
+
<!-- Toolbar -->
|
|
114
|
+
<div
|
|
115
|
+
class="flex items-center justify-between border-b border-default px-3 py-2"
|
|
116
|
+
>
|
|
117
|
+
<p class="truncate text-sm font-semibold text-highlighted">
|
|
118
|
+
{{ title }}
|
|
119
|
+
</p>
|
|
120
|
+
<UButton
|
|
121
|
+
v-if="!readonly"
|
|
122
|
+
icon="i-lucide-list-plus"
|
|
123
|
+
size="xs"
|
|
124
|
+
variant="ghost"
|
|
125
|
+
color="neutral"
|
|
126
|
+
:title="t('mapo.menuTreeview.newNode')"
|
|
127
|
+
@click="newNode"
|
|
128
|
+
/>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<!-- Tree -->
|
|
132
|
+
<div class="flex-1 overflow-y-auto p-2" @click.self="select(null)">
|
|
133
|
+
<VueDraggable
|
|
134
|
+
v-model="tree"
|
|
135
|
+
group="mapo-menu-nodes"
|
|
136
|
+
handle=".mapo-menu-drag-handle"
|
|
137
|
+
:animation="150"
|
|
138
|
+
:disabled="readonly"
|
|
139
|
+
ghost-class="mapo-menu-ghost"
|
|
140
|
+
class="min-h-8 space-y-0.5"
|
|
141
|
+
@start="dndCtx.onStart()"
|
|
142
|
+
@end="dndCtx.onEnd()"
|
|
143
|
+
>
|
|
144
|
+
<MapoMenuTreeviewNode
|
|
145
|
+
v-for="(node, i) in nodes"
|
|
146
|
+
:key="node.id"
|
|
147
|
+
:ref="(el) => setNodeRef(i, el)"
|
|
148
|
+
:node="node"
|
|
149
|
+
:depth="1"
|
|
150
|
+
:selected-id="modelValue?.id ?? null"
|
|
151
|
+
:readonly="readonly"
|
|
152
|
+
@select="select($event)"
|
|
153
|
+
@delete="deleteNode($event)"
|
|
154
|
+
/>
|
|
155
|
+
</VueDraggable>
|
|
156
|
+
|
|
157
|
+
<!-- Loading skeleton — shown instead of the empty state so a menu that
|
|
158
|
+
is still being fetched never reads as "no nodes". -->
|
|
159
|
+
<div v-if="loading && nodes.length === 0" class="space-y-1.5 p-1">
|
|
160
|
+
<USkeleton v-for="n in 4" :key="n" class="h-6 w-full" />
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<!-- Empty state -->
|
|
164
|
+
<button
|
|
165
|
+
v-else-if="nodes.length === 0 && !readonly"
|
|
166
|
+
type="button"
|
|
167
|
+
class="flex w-full flex-col items-center gap-2 rounded-lg border border-dashed border-default py-8 text-dimmed transition-colors hover:border-accented hover:text-muted"
|
|
168
|
+
@click="newNode"
|
|
169
|
+
>
|
|
170
|
+
<UIcon name="i-lucide-list-plus" class="size-8" />
|
|
171
|
+
<span class="text-xs">{{ t("mapo.menuTreeview.noRootNodes") }}</span>
|
|
172
|
+
</button>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<slot name="bottom" />
|
|
176
|
+
</div>
|
|
177
|
+
</template>
|
|
178
|
+
|
|
179
|
+
<style scoped>
|
|
180
|
+
.mapo-menu-ghost{opacity:.4}
|
|
181
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type MenuTreeNode } from "../types/menu.js";
|
|
2
|
+
/**
|
|
3
|
+
* Drag & drop tree of menu nodes (left pane of `MapoMenuManager`).
|
|
4
|
+
*
|
|
5
|
+
* The node arrays are mutated in place by the nested draggables; the tree is
|
|
6
|
+
* owned by the parent through the `nodes` prop. `update:nodes` is emitted on
|
|
7
|
+
* every structural change so a parent can also `v-model:nodes`.
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
nodes: MenuTreeNode[];
|
|
11
|
+
/** Currently selected node (v-model). */
|
|
12
|
+
modelValue?: MenuTreeNode | null;
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Max nesting depth; `-1` = unlimited. */
|
|
15
|
+
maxDepth?: number;
|
|
16
|
+
readonly?: boolean;
|
|
17
|
+
/** Show a skeleton instead of the empty state while the tree is being fetched. */
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_Slots = {
|
|
21
|
+
/** Content above the tree (e.g. a language switch). */
|
|
22
|
+
top(): unknown;
|
|
23
|
+
/** Content below the tree (e.g. a save button). */
|
|
24
|
+
bottom(): unknown;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Create a node. Appended to the selected node's children when possible
|
|
28
|
+
* (respecting maxDepth), to the root otherwise. The new node is selected
|
|
29
|
+
* right away so the editor opens on it (v1 opened an inline rename instead).
|
|
30
|
+
*/
|
|
31
|
+
declare function newNode(): void;
|
|
32
|
+
declare function deleteSelectedNode(): void;
|
|
33
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
34
|
+
deleteSelectedNode: typeof deleteSelectedNode;
|
|
35
|
+
newNode: typeof newNode;
|
|
36
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
|
+
"update:modelValue": (node: MenuTreeNode | null) => any;
|
|
38
|
+
"update:nodes": (nodes: MenuTreeNode[]) => any;
|
|
39
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
40
|
+
"onUpdate:modelValue"?: ((node: MenuTreeNode | null) => any) | undefined;
|
|
41
|
+
"onUpdate:nodes"?: ((nodes: MenuTreeNode[]) => any) | undefined;
|
|
42
|
+
}>, {
|
|
43
|
+
title: string;
|
|
44
|
+
readonly: boolean;
|
|
45
|
+
loading: boolean;
|
|
46
|
+
modelValue: MenuTreeNode | null;
|
|
47
|
+
maxDepth: number;
|
|
48
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
49
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
51
|
+
export default _default;
|
|
52
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
53
|
+
new (): {
|
|
54
|
+
$slots: S;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=MapoMenuTreeview.vue.d.ts.map
|
|
@@ -0,0 +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,UAAU,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAkBJ,KAAK,WAAW,GAAG;IACjB,uDAAuD;IACvD,GAAG,IAAI,OAAO,CAAC;IACf,mDAAmD;IACnD,MAAM,IAAI,OAAO,CAAC;CACnB,CAAC;AAyEF;;;;GAIG;AACH,iBAAS,OAAO,SAiBf;AAkCD,iBAAS,kBAAkB,SAE1B;AA4QD,QAAA,MAAM,UAAU;;;;;;;;;;WA5aJ,MAAM;cAGH,OAAO;aAER,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"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, inject, watch } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
4
|
+
import { VueDraggable } from "vue-draggable-plus";
|
|
5
|
+
import { MENU_DND_CTX } from "./menuDndContext.js";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
node: { type: Object, required: true },
|
|
8
|
+
depth: { type: Number, required: false, default: 1 },
|
|
9
|
+
selectedId: { type: [String, Number, null], required: false, default: null },
|
|
10
|
+
readonly: { type: Boolean, required: false, default: false }
|
|
11
|
+
});
|
|
12
|
+
const emit = defineEmits(["select", "delete"]);
|
|
13
|
+
const { t } = useI18n();
|
|
14
|
+
const dnd = inject(MENU_DND_CTX, null);
|
|
15
|
+
const node = computed(() => props.node);
|
|
16
|
+
const open = ref(true);
|
|
17
|
+
const isSelected = computed(
|
|
18
|
+
() => String(props.node.id) === String(props.selectedId ?? "")
|
|
19
|
+
);
|
|
20
|
+
const hasErrors = computed(
|
|
21
|
+
() => !!props.node.errors && Object.keys(props.node.errors).length > 0
|
|
22
|
+
);
|
|
23
|
+
const editingTitle = ref(false);
|
|
24
|
+
const draftTitle = ref(props.node.title);
|
|
25
|
+
watch(
|
|
26
|
+
() => props.node.title,
|
|
27
|
+
(val) => {
|
|
28
|
+
draftTitle.value = val;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
function startRename() {
|
|
32
|
+
if (props.readonly) return;
|
|
33
|
+
draftTitle.value = props.node.title;
|
|
34
|
+
editingTitle.value = true;
|
|
35
|
+
}
|
|
36
|
+
function commitRename() {
|
|
37
|
+
if (!editingTitle.value) return;
|
|
38
|
+
node.value.title = draftTitle.value.trim();
|
|
39
|
+
editingTitle.value = false;
|
|
40
|
+
}
|
|
41
|
+
function onRowKeydown(event) {
|
|
42
|
+
if (event.key === "Delete") emit("delete", props.node);
|
|
43
|
+
}
|
|
44
|
+
function onRenameKeydown(event) {
|
|
45
|
+
if (event.key === "Enter") {
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
commitRename();
|
|
49
|
+
} else if (event.key === "Escape") {
|
|
50
|
+
event.stopPropagation();
|
|
51
|
+
editingTitle.value = false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function openIfChild(child) {
|
|
55
|
+
if (node.value.nodes.some((n) => String(n.id) === String(child.id))) {
|
|
56
|
+
open.value = true;
|
|
57
|
+
}
|
|
58
|
+
childRefs.value.forEach((r) => r?.openIfChild(child));
|
|
59
|
+
}
|
|
60
|
+
const childRefs = ref([]);
|
|
61
|
+
function setChildRef(index, el) {
|
|
62
|
+
childRefs.value[index] = el ?? null;
|
|
63
|
+
}
|
|
64
|
+
defineExpose({ openIfChild });
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
export default { name: "MapoMenuTreeviewNode" };
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<div class="mapo-menu-node">
|
|
73
|
+
<!-- Node row -->
|
|
74
|
+
<div
|
|
75
|
+
class="group/nodo flex items-center gap-1 rounded px-1 py-0.5 transition-colors"
|
|
76
|
+
:class="
|
|
77
|
+
isSelected ? 'bg-primary/10 text-primary' : 'hover:bg-elevated text-default'
|
|
78
|
+
"
|
|
79
|
+
>
|
|
80
|
+
<!-- Expand toggle -->
|
|
81
|
+
<UButton
|
|
82
|
+
:icon="open ? 'i-lucide-chevron-down' : 'i-lucide-chevron-right'"
|
|
83
|
+
size="xs"
|
|
84
|
+
variant="ghost"
|
|
85
|
+
color="neutral"
|
|
86
|
+
:class="{ invisible: node.nodes.length === 0 }"
|
|
87
|
+
tabindex="-1"
|
|
88
|
+
@click.stop="open = !open"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<!-- Drag handle -->
|
|
92
|
+
<UIcon
|
|
93
|
+
v-if="!readonly"
|
|
94
|
+
name="i-lucide-grip-vertical"
|
|
95
|
+
class="mapo-menu-drag-handle size-3.5 shrink-0 cursor-grab text-dimmed opacity-0 transition-opacity group-hover/nodo:opacity-100"
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<!-- Title (inline editable on double-click) -->
|
|
99
|
+
<UInput
|
|
100
|
+
v-if="editingTitle"
|
|
101
|
+
v-model="draftTitle"
|
|
102
|
+
size="xs"
|
|
103
|
+
autofocus
|
|
104
|
+
class="flex-1"
|
|
105
|
+
@blur="commitRename"
|
|
106
|
+
@keydown="onRenameKeydown"
|
|
107
|
+
@click.stop
|
|
108
|
+
/>
|
|
109
|
+
<button
|
|
110
|
+
v-else
|
|
111
|
+
type="button"
|
|
112
|
+
class="min-w-0 flex-1 truncate py-0.5 text-left text-sm"
|
|
113
|
+
:class="{ 'italic text-dimmed': !node.title }"
|
|
114
|
+
@click.stop="emit('select', node)"
|
|
115
|
+
@dblclick.stop="startRename"
|
|
116
|
+
@keydown="onRowKeydown"
|
|
117
|
+
>
|
|
118
|
+
{{ node.title || "\u2026" }}
|
|
119
|
+
</button>
|
|
120
|
+
|
|
121
|
+
<!-- Error dot -->
|
|
122
|
+
<span
|
|
123
|
+
v-if="hasErrors"
|
|
124
|
+
class="size-2 shrink-0 rounded-full bg-error"
|
|
125
|
+
:title="t('mapo.menuNodeEditor.nodeErrors')"
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
<!-- Row actions -->
|
|
129
|
+
<div
|
|
130
|
+
v-if="!readonly"
|
|
131
|
+
class="hidden items-center gap-0.5 group-hover/nodo:flex"
|
|
132
|
+
>
|
|
133
|
+
<UButton
|
|
134
|
+
icon="i-lucide-trash-2"
|
|
135
|
+
size="xs"
|
|
136
|
+
variant="ghost"
|
|
137
|
+
color="error"
|
|
138
|
+
tabindex="-1"
|
|
139
|
+
@click.stop="emit('delete', node)"
|
|
140
|
+
/>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<!-- Children (nested draggable, same group ⇒ cross-parent moves) -->
|
|
145
|
+
<div v-show="open || dnd?.dragging.value" class="ml-5">
|
|
146
|
+
<VueDraggable
|
|
147
|
+
v-model="node.nodes"
|
|
148
|
+
group="mapo-menu-nodes"
|
|
149
|
+
handle=".mapo-menu-drag-handle"
|
|
150
|
+
:animation="150"
|
|
151
|
+
:disabled="readonly"
|
|
152
|
+
ghost-class="mapo-menu-ghost"
|
|
153
|
+
class="min-h-1.5 space-y-0.5"
|
|
154
|
+
@start="dnd?.onStart()"
|
|
155
|
+
@end="dnd?.onEnd()"
|
|
156
|
+
>
|
|
157
|
+
<MapoMenuTreeviewNode
|
|
158
|
+
v-for="(child, i) in node.nodes"
|
|
159
|
+
:key="child.id"
|
|
160
|
+
:ref="(el) => setChildRef(i, el)"
|
|
161
|
+
:node="child"
|
|
162
|
+
:depth="depth + 1"
|
|
163
|
+
:selected-id="selectedId"
|
|
164
|
+
:readonly="readonly"
|
|
165
|
+
@select="emit('select', $event)"
|
|
166
|
+
@delete="emit('delete', $event)"
|
|
167
|
+
/>
|
|
168
|
+
</VueDraggable>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</template>
|
|
172
|
+
|
|
173
|
+
<style scoped>
|
|
174
|
+
.mapo-menu-ghost{opacity:.4}
|
|
175
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { MenuTreeNode } from "../types/menu.js";
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<{
|
|
5
|
+
node: MenuTreeNode;
|
|
6
|
+
depth?: number;
|
|
7
|
+
selectedId?: string | number | null;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
}, {
|
|
10
|
+
openIfChild: (child: MenuTreeNode) => void;
|
|
11
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
select: (node: MenuTreeNode) => any;
|
|
13
|
+
delete: (node: MenuTreeNode) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
15
|
+
node: MenuTreeNode;
|
|
16
|
+
depth?: number;
|
|
17
|
+
selectedId?: string | number | null;
|
|
18
|
+
readonly?: boolean;
|
|
19
|
+
}> & Readonly<{
|
|
20
|
+
onSelect?: ((node: MenuTreeNode) => any) | undefined;
|
|
21
|
+
onDelete?: ((node: MenuTreeNode) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
readonly: boolean;
|
|
24
|
+
depth: number;
|
|
25
|
+
selectedId: string | number | null;
|
|
26
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
//# sourceMappingURL=MapoMenuTreeviewNode.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapoMenuTreeviewNode.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMenuTreeviewNode.vue"],"names":[],"mappings":"AAgPA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;wBAIhC,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;UAUR,YAAY;YACV,MAAM;iBACD,MAAM,GAAG,MAAM,GAAG,IAAI;eACxB,OAAO;;yBAoFM,YAAY;;;;;UAvF9B,YAAY;YACV,MAAM;iBACD,MAAM,GAAG,MAAM,GAAG,IAAI;eACxB,OAAO;;;;;cAAP,OAAO;WAFV,MAAM;gBACD,MAAM,GAAG,MAAM,GAAG,IAAI;6EAobnC,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { useSidebarStore } from "@mapomodule/store/runtime/stores/sidebar";
|
|
4
5
|
defineSlots();
|
|
6
|
+
const { t } = useI18n();
|
|
5
7
|
const sidebar = useSidebarStore();
|
|
6
8
|
const sidebarWidth = computed(() => sidebar.mini ? "w-[60px]" : "w-60");
|
|
7
9
|
</script>
|
|
@@ -20,7 +22,7 @@ const sidebarWidth = computed(() => sidebar.mini ? "w-[60px]" : "w-60");
|
|
|
20
22
|
:class="sidebar.mini ? 'justify-center' : 'justify-between gap-2'"
|
|
21
23
|
>
|
|
22
24
|
<template v-if="sidebar.mini">
|
|
23
|
-
<UTooltip text="
|
|
25
|
+
<UTooltip :text="t('mapo.expand')" :side="'right'">
|
|
24
26
|
<UButton
|
|
25
27
|
variant="ghost"
|
|
26
28
|
color="neutral"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoSidebar.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoSidebar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoSidebar.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoSidebar.vue"],"names":[],"mappings":"AAyHA,KAAK,WAAW,GAAG;IACjB,6CAA6C;IAC7C,IAAI,IAAI,OAAO,CAAC;IAChB,oDAAoD;IACpD,SAAS,IAAI,OAAO,CAAC;IACrB,oDAAoD;IACpD,YAAY,IAAI,OAAO,CAAC;IACxB,8EAA8E;IAC9E,cAAc,IAAI,OAAO,CAAC;IAC1B,uEAAuE;IACvE,MAAM,IAAI,OAAO,CAAC;CACnB,CAAC;AAkRF,QAAA,MAAM,UAAU,+QACd,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
-
import { useRouter } from "
|
|
3
|
+
import { useRouter } from "#app";
|
|
4
4
|
import { buildRouteTree } from "@mapomodule/utils";
|
|
5
5
|
const { footer = false, mini = false } = defineProps({
|
|
6
6
|
footer: { type: Boolean, required: false },
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useI18n } from "vue-i18n";
|
|
2
3
|
import { useAuthStore } from "@mapomodule/store/runtime/stores/auth";
|
|
3
4
|
import { useMapoAuth } from "@mapomodule/core/runtime/auth/useMapoAuth";
|
|
4
5
|
defineProps({
|
|
5
6
|
mini: { type: Boolean, required: false, default: false }
|
|
6
7
|
});
|
|
8
|
+
const { t } = useI18n();
|
|
7
9
|
const auth = useAuthStore();
|
|
8
10
|
const { logout } = useMapoAuth();
|
|
9
11
|
</script>
|
|
@@ -32,7 +34,7 @@ const { logout } = useMapoAuth();
|
|
|
32
34
|
color="neutral"
|
|
33
35
|
icon="i-lucide-log-out"
|
|
34
36
|
size="xs"
|
|
35
|
-
aria-label="
|
|
37
|
+
:aria-label="t('mapo.logout')"
|
|
36
38
|
@click="logout()"
|
|
37
39
|
/>
|
|
38
40
|
</template>
|
|
@@ -45,7 +47,9 @@ const { logout } = useMapoAuth();
|
|
|
45
47
|
:class="{ 'justify-center': mini }"
|
|
46
48
|
>
|
|
47
49
|
<UIcon name="i-lucide-log-in" class="size-4 shrink-0" />
|
|
48
|
-
<span v-if="!mini" class="text-xs font-medium">
|
|
50
|
+
<span v-if="!mini" class="text-xs font-medium">{{
|
|
51
|
+
t("mapo.signIn")
|
|
52
|
+
}}</span>
|
|
49
53
|
</NuxtLink>
|
|
50
54
|
</template>
|
|
51
55
|
</template>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoSidebarProfile.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoSidebarProfile.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoSidebarProfile.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoSidebarProfile.vue"],"names":[],"mappings":"AAoEA,KAAK,WAAW,GAAG;IACf,4EAA4E;IAC5E,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAwNJ,QAAA,MAAM,YAAY;UAzNP,OAAO;6EA4NhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -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"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { useColorMode } from "#imports";
|
|
5
|
+
const { t } = useI18n();
|
|
4
6
|
const colorMode = useColorMode();
|
|
5
7
|
const isDark = computed(() => colorMode.value === "dark");
|
|
6
8
|
function toggle() {
|
|
@@ -13,7 +15,9 @@ function toggle() {
|
|
|
13
15
|
:icon="isDark ? 'i-lucide-sun' : 'i-lucide-moon'"
|
|
14
16
|
variant="ghost"
|
|
15
17
|
color="neutral"
|
|
16
|
-
:aria-label="
|
|
18
|
+
:aria-label="
|
|
19
|
+
isDark ? t('mapo.themeToggle.light') : t('mapo.themeToggle.dark')
|
|
20
|
+
"
|
|
17
21
|
@click="toggle"
|
|
18
22
|
/>
|
|
19
23
|
</template>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoThemeToggle.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoThemeToggle.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoThemeToggle.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoThemeToggle.vue"],"names":[],"mappings":"AA8FA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { InjectionKey, Ref } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* Drag context shared between `MapoMenuTreeview` (provider) and every nested
|
|
4
|
+
* `MapoMenuTreeviewNode` draggable list.
|
|
5
|
+
*
|
|
6
|
+
* SortableJS nested lists mutate `node.nodes` arrays in place, so max-depth
|
|
7
|
+
* enforcement is centralised in the root: it snapshots the tree on drag start
|
|
8
|
+
* and reverts the whole tree if the drop produced an invalid nesting.
|
|
9
|
+
*/
|
|
10
|
+
export interface MenuDndContext {
|
|
11
|
+
/** True while any node in the tree is being dragged. */
|
|
12
|
+
dragging: Ref<boolean>;
|
|
13
|
+
/** Called by any nested draggable when a drag starts. */
|
|
14
|
+
onStart: () => void;
|
|
15
|
+
/** Called by any nested draggable when a drag ends (validate + maybe revert). */
|
|
16
|
+
onEnd: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const MENU_DND_CTX: InjectionKey<MenuDndContext>;
|
|
19
|
+
//# sourceMappingURL=menuDndContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menuDndContext.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/menuDndContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,yDAAyD;IACzD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iFAAiF;IACjF,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,cAAc,CAErD,CAAC"}
|
|
@@ -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
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useI18n } from "vue-i18n";
|
|
2
3
|
import { version } from "../../../package.json";
|
|
3
|
-
|
|
4
|
+
const { t } = useI18n();
|
|
4
5
|
</script>
|
|
5
6
|
|
|
6
7
|
<template>
|
|
7
8
|
<div class="flex h-full items-center justify-center p-8">
|
|
8
9
|
<div class="space-y-4 rounded-lg border bg-white p-8 text-center shadow">
|
|
9
|
-
<h1 class="text-2xl font-bold">
|
|
10
|
-
<p class="text-gray-600">
|
|
10
|
+
<h1 class="text-2xl font-bold">{{ t("mapo.index.welcomeMessage") }}</h1>
|
|
11
|
+
<p class="text-gray-600">Mapo UI Kit — {{ version }}</p>
|
|
11
12
|
</div>
|
|
12
13
|
</div>
|
|
13
14
|
</template>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/pages/index.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/pages/index.vue"],"names":[],"mappings":"AAuEA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/pages/login.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/pages/login.vue"],"names":[],"mappings":"AA0BA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|