@mapomodule/uikit 2.0.0-beta.1 → 2.0.0-beta.11

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.
Files changed (200) hide show
  1. package/README.md +33 -1
  2. package/dist/__tests__/langInfo.test.d.ts +2 -0
  3. package/dist/__tests__/langInfo.test.d.ts.map +1 -0
  4. package/dist/index.d.mts +5 -2
  5. package/dist/index.d.ts +6 -2
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.mjs +1 -18
  8. package/dist/module.d.mts +60 -2
  9. package/dist/module.d.ts +55 -2
  10. package/dist/module.d.ts.map +1 -0
  11. package/dist/module.json +1 -1
  12. package/dist/module.mjs +174 -13
  13. package/dist/runtime/adapters/defaultMediaAdapter.d.ts +14 -0
  14. package/dist/runtime/adapters/defaultMediaAdapter.d.ts.map +1 -0
  15. package/dist/runtime/adapters/defaultMediaAdapter.js +30 -0
  16. package/dist/runtime/assets/main.css +1 -0
  17. package/dist/runtime/components/MapoConfirmDialog.vue +35 -0
  18. package/dist/runtime/components/MapoConfirmDialog.vue.d.ts +4 -0
  19. package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -0
  20. package/dist/runtime/components/MapoDetail.vue +632 -0
  21. package/dist/runtime/components/MapoDetail.vue.d.ts +422 -0
  22. package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -0
  23. package/dist/runtime/components/MapoDetailLangSwitch.vue +126 -0
  24. package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts +23 -0
  25. package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts.map +1 -0
  26. package/dist/runtime/components/MapoDropArea.vue +99 -0
  27. package/dist/runtime/components/MapoDropArea.vue.d.ts +33 -0
  28. package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -0
  29. package/dist/runtime/components/MapoLangSwitcher.vue +39 -0
  30. package/dist/runtime/components/MapoLangSwitcher.vue.d.ts +18 -0
  31. package/dist/runtime/components/MapoLangSwitcher.vue.d.ts.map +1 -0
  32. package/dist/runtime/components/MapoList.vue +191 -0
  33. package/dist/runtime/components/MapoList.vue.d.ts +111 -0
  34. package/dist/runtime/components/MapoList.vue.d.ts.map +1 -0
  35. package/dist/runtime/components/MapoListActions.vue +119 -0
  36. package/dist/runtime/components/MapoListActions.vue.d.ts +33 -0
  37. package/dist/runtime/components/MapoListActions.vue.d.ts.map +1 -0
  38. package/dist/runtime/components/MapoListFilters.vue +246 -0
  39. package/dist/runtime/components/MapoListFilters.vue.d.ts +38 -0
  40. package/dist/runtime/components/MapoListFilters.vue.d.ts.map +1 -0
  41. package/dist/runtime/components/MapoListHead.vue +9 -0
  42. package/dist/runtime/components/MapoListHead.vue.d.ts +14 -0
  43. package/dist/runtime/components/MapoListHead.vue.d.ts.map +1 -0
  44. package/dist/runtime/components/MapoListQuickEdit.vue +123 -0
  45. package/dist/runtime/components/MapoListQuickEdit.vue.d.ts +47 -0
  46. package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -0
  47. package/dist/runtime/components/MapoListTable.vue +665 -0
  48. package/dist/runtime/components/MapoListTable.vue.d.ts +105 -0
  49. package/dist/runtime/components/MapoListTable.vue.d.ts.map +1 -0
  50. package/dist/runtime/components/MapoListTabs.vue +38 -0
  51. package/dist/runtime/components/MapoListTabs.vue.d.ts +26 -0
  52. package/dist/runtime/components/MapoListTabs.vue.d.ts.map +1 -0
  53. package/dist/runtime/components/MapoLogin.vue +196 -0
  54. package/dist/runtime/components/MapoLogin.vue.d.ts +22 -0
  55. package/dist/runtime/components/MapoLogin.vue.d.ts.map +1 -0
  56. package/dist/runtime/components/MapoLogoutButton.vue +27 -0
  57. package/dist/runtime/components/MapoLogoutButton.vue.d.ts +29 -0
  58. package/dist/runtime/components/MapoLogoutButton.vue.d.ts.map +1 -0
  59. package/dist/runtime/components/MapoMediaBreadcrumbs.vue +47 -0
  60. package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts +4 -0
  61. package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -0
  62. package/dist/runtime/components/MapoMediaEditor.vue +320 -0
  63. package/dist/runtime/components/MapoMediaEditor.vue.d.ts +8 -0
  64. package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -0
  65. package/dist/runtime/components/MapoMediaFileChanger.vue +112 -0
  66. package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts +15 -0
  67. package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -0
  68. package/dist/runtime/components/MapoMediaFolders.vue +220 -0
  69. package/dist/runtime/components/MapoMediaFolders.vue.d.ts +4 -0
  70. package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -0
  71. package/dist/runtime/components/MapoMediaGallery.vue +219 -0
  72. package/dist/runtime/components/MapoMediaGallery.vue.d.ts +4 -0
  73. package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -0
  74. package/dist/runtime/components/MapoMediaManager.vue +140 -0
  75. package/dist/runtime/components/MapoMediaManager.vue.d.ts +35 -0
  76. package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -0
  77. package/dist/runtime/components/MapoMediaManagerDialog.vue +116 -0
  78. package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts +41 -0
  79. package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -0
  80. package/dist/runtime/components/MapoMediaPreview.vue +92 -0
  81. package/dist/runtime/components/MapoMediaPreview.vue.d.ts +19 -0
  82. package/dist/runtime/components/MapoMediaPreview.vue.d.ts.map +1 -0
  83. package/dist/runtime/components/MapoMediaUploader.vue +290 -0
  84. package/dist/runtime/components/MapoMediaUploader.vue.d.ts +8 -0
  85. package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -0
  86. package/dist/runtime/components/MapoMenuManager.vue +293 -0
  87. package/dist/runtime/components/MapoMenuManager.vue.d.ts +92 -0
  88. package/dist/runtime/components/MapoMenuManager.vue.d.ts.map +1 -0
  89. package/dist/runtime/components/MapoMenuNodeEditor.vue +201 -0
  90. package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts +61 -0
  91. package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts.map +1 -0
  92. package/dist/runtime/components/MapoMenuTreeview.vue +181 -0
  93. package/dist/runtime/components/MapoMenuTreeview.vue.d.ts +57 -0
  94. package/dist/runtime/components/MapoMenuTreeview.vue.d.ts.map +1 -0
  95. package/dist/runtime/components/MapoMenuTreeviewNode.vue +175 -0
  96. package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts +27 -0
  97. package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts.map +1 -0
  98. package/dist/runtime/components/MapoRootComponents.vue +9 -0
  99. package/dist/runtime/components/MapoRootComponents.vue.d.ts +4 -0
  100. package/dist/runtime/components/MapoRootComponents.vue.d.ts.map +1 -0
  101. package/dist/runtime/components/MapoSidebar.vue +89 -0
  102. package/dist/runtime/components/MapoSidebar.vue.d.ts +22 -0
  103. package/dist/runtime/components/MapoSidebar.vue.d.ts.map +1 -0
  104. package/dist/runtime/components/MapoSidebarList.vue +27 -0
  105. package/dist/runtime/components/MapoSidebarList.vue.d.ts +8 -0
  106. package/dist/runtime/components/MapoSidebarList.vue.d.ts.map +1 -0
  107. package/dist/runtime/components/MapoSidebarListItem.vue +74 -0
  108. package/dist/runtime/components/MapoSidebarListItem.vue.d.ts +9 -0
  109. package/dist/runtime/components/MapoSidebarListItem.vue.d.ts.map +1 -0
  110. package/dist/runtime/components/MapoSidebarProfile.vue +55 -0
  111. package/dist/runtime/components/MapoSidebarProfile.vue.d.ts +10 -0
  112. package/dist/runtime/components/MapoSidebarProfile.vue.d.ts.map +1 -0
  113. package/dist/runtime/components/MapoSnackBar.vue +38 -0
  114. package/dist/runtime/components/MapoSnackBar.vue.d.ts +4 -0
  115. package/dist/runtime/components/MapoSnackBar.vue.d.ts.map +1 -0
  116. package/dist/runtime/components/MapoThemeToggle.vue +23 -0
  117. package/dist/runtime/components/MapoThemeToggle.vue.d.ts +4 -0
  118. package/dist/runtime/components/MapoThemeToggle.vue.d.ts.map +1 -0
  119. package/dist/runtime/components/MapoTopbar.vue +30 -0
  120. package/dist/runtime/components/MapoTopbar.vue.d.ts +15 -0
  121. package/dist/runtime/components/MapoTopbar.vue.d.ts.map +1 -0
  122. package/dist/runtime/components/menuDndContext.d.ts +19 -0
  123. package/dist/runtime/components/menuDndContext.d.ts.map +1 -0
  124. package/dist/runtime/components/menuDndContext.js +3 -0
  125. package/dist/runtime/layouts/default.vue +43 -0
  126. package/dist/runtime/layouts/default.vue.d.ts +20 -0
  127. package/dist/runtime/layouts/default.vue.d.ts.map +1 -0
  128. package/dist/runtime/layouts/empty.vue +9 -0
  129. package/dist/runtime/layouts/empty.vue.d.ts +14 -0
  130. package/dist/runtime/layouts/empty.vue.d.ts.map +1 -0
  131. package/dist/runtime/page-meta.nuxt.d.ts +45 -0
  132. package/dist/runtime/pages/index.vue +14 -0
  133. package/dist/runtime/pages/index.vue.d.ts +4 -0
  134. package/dist/runtime/pages/index.vue.d.ts.map +1 -0
  135. package/dist/runtime/pages/login.vue +3 -0
  136. package/dist/runtime/pages/login.vue.d.ts +4 -0
  137. package/dist/runtime/pages/login.vue.d.ts.map +1 -0
  138. package/dist/runtime/plugins/media-adapter.d.ts +18 -0
  139. package/dist/runtime/plugins/media-adapter.d.ts.map +1 -0
  140. package/dist/runtime/plugins/media-adapter.js +8 -0
  141. package/dist/runtime/stores/media.d.ts +462 -0
  142. package/dist/runtime/stores/media.d.ts.map +1 -0
  143. package/dist/runtime/stores/media.js +344 -0
  144. package/dist/runtime/types/list.d.ts +59 -0
  145. package/dist/runtime/types/list.d.ts.map +1 -0
  146. package/dist/runtime/types/list.js +0 -0
  147. package/dist/runtime/types/media.d.ts +116 -0
  148. package/dist/runtime/types/media.d.ts.map +1 -0
  149. package/dist/runtime/types/media.js +0 -0
  150. package/dist/runtime/types/menu.d.ts +66 -0
  151. package/dist/runtime/types/menu.d.ts.map +1 -0
  152. package/dist/runtime/types/menu.js +30 -0
  153. package/dist/runtime/utils/langInfo.d.ts +30 -0
  154. package/dist/runtime/utils/langInfo.d.ts.map +1 -0
  155. package/dist/runtime/utils/langInfo.js +8 -0
  156. package/dist/types.d.mts +6 -10
  157. package/package.json +15 -11
  158. package/src/__tests__/langInfo.test.ts +48 -0
  159. package/src/index.ts +20 -0
  160. package/src/module.ts +130 -0
  161. package/src/runtime/adapters/defaultMediaAdapter.ts +57 -0
  162. package/src/runtime/components/MapoConfirmDialog.vue +5 -3
  163. package/src/runtime/components/MapoDetail.vue +130 -55
  164. package/src/runtime/components/MapoDetailLangSwitch.vue +1 -1
  165. package/src/runtime/components/MapoDropArea.vue +127 -0
  166. package/src/runtime/components/MapoLangSwitcher.vue +74 -0
  167. package/src/runtime/components/MapoList.vue +1 -1
  168. package/src/runtime/components/MapoListActions.vue +16 -10
  169. package/src/runtime/components/MapoListFilters.vue +5 -2
  170. package/src/runtime/components/MapoListQuickEdit.vue +12 -9
  171. package/src/runtime/components/MapoListTable.vue +26 -21
  172. package/src/runtime/components/MapoLogin.vue +13 -10
  173. package/src/runtime/components/MapoLogoutButton.vue +4 -2
  174. package/src/runtime/components/MapoMediaBreadcrumbs.vue +53 -0
  175. package/src/runtime/components/MapoMediaEditor.vue +350 -0
  176. package/src/runtime/components/MapoMediaFileChanger.vue +136 -0
  177. package/src/runtime/components/MapoMediaFolders.vue +239 -0
  178. package/src/runtime/components/MapoMediaGallery.vue +239 -0
  179. package/src/runtime/components/MapoMediaManager.vue +180 -0
  180. package/src/runtime/components/MapoMediaManagerDialog.vue +148 -0
  181. package/src/runtime/components/MapoMediaPreview.vue +111 -0
  182. package/src/runtime/components/MapoMediaUploader.vue +351 -0
  183. package/src/runtime/components/MapoMenuManager.vue +437 -0
  184. package/src/runtime/components/MapoMenuNodeEditor.vue +282 -0
  185. package/src/runtime/components/MapoMenuTreeview.vue +264 -0
  186. package/src/runtime/components/MapoMenuTreeviewNode.vue +234 -0
  187. package/src/runtime/components/MapoSidebar.vue +3 -1
  188. package/src/runtime/components/MapoSidebarList.vue +1 -1
  189. package/src/runtime/components/MapoSidebarProfile.vue +6 -2
  190. package/src/runtime/components/MapoThemeToggle.vue +5 -1
  191. package/src/runtime/components/menuDndContext.ts +22 -0
  192. package/src/runtime/pages/index.vue +4 -3
  193. package/src/runtime/pages/login.vue +0 -4
  194. package/src/runtime/plugins/media-adapter.ts +33 -0
  195. package/src/runtime/stores/media.ts +474 -0
  196. package/src/runtime/types/media.ts +126 -0
  197. package/src/runtime/types/menu.ts +105 -0
  198. package/src/runtime/utils/langInfo.ts +38 -0
  199. package/dist/index.d.cts +0 -2
  200. package/dist/module.d.cts +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapoMenuManager.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMenuManager.vue"],"names":[],"mappings":"AAocA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,kBAAkB,CAAC;AAI1B;;;;;;;;;;;;;;;;;GAiBG;AACH,KAAK,WAAW,GAAG;IACf,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,sFAAsF;IACtF,UAAU,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC7B,8DAA8D;IAC9D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,UAAU,CAAC,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;IACzC,6DAA6D;IAC7D,gBAAgB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACxC,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C,CAAC;AA2BJ,KAAK,WAAW,GAAG;IACjB,kEAAkE;IAClE,KAAK,IAAI,OAAO,CAAC;IACjB,0CAA0C;IAC1C,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IAC3D,qCAAqC;IACrC,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IACvD,0CAA0C;IAC1C,oBAAoB,CAAC,KAAK,EAAE,MAAM,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"}
@@ -0,0 +1,201 @@
1
+ <script setup>
2
+ import { ref, computed, watch, resolveComponent } from "vue";
3
+ import { useI18n } from "vue-i18n";
4
+ import { useCrud } from "@mapomodule/core/runtime/api/crud";
5
+ import { findMenuNode } from "../types/menu.js";
6
+ const props = defineProps({
7
+ modelValue: { type: Object, required: true },
8
+ nodes: { type: Array, required: false, default: () => [] },
9
+ menuEndpoint: { type: String, required: false, default: "" },
10
+ coreFields: { type: [Array, null], required: false, default: null },
11
+ additionalFields: { type: Array, required: false, default: () => [] },
12
+ availableClasses: { type: Object, required: false, default: () => ({}) },
13
+ readonly: { type: Boolean, required: false, default: false }
14
+ });
15
+ const emit = defineEmits(["update:modelValue", "delete"]);
16
+ defineSlots();
17
+ const { t } = useI18n();
18
+ const pageTypesEndpoint = computed(
19
+ () => `${props.menuEndpoint.replace(/\/$/, "")}/page_types`
20
+ );
21
+ const availablePages = ref([]);
22
+ async function loadPages() {
23
+ const contentType = props.modelValue?.link?.content_type;
24
+ if (!contentType || !props.menuEndpoint) {
25
+ availablePages.value = [];
26
+ return;
27
+ }
28
+ try {
29
+ const crud = useCrud(pageTypesEndpoint.value);
30
+ const id = typeof contentType === "object" ? contentType.id ?? "" : contentType;
31
+ availablePages.value = await crud.detail(
32
+ id
33
+ );
34
+ } catch {
35
+ availablePages.value = [];
36
+ }
37
+ }
38
+ watch(() => props.modelValue?.id, loadPages, { immediate: true });
39
+ const defaultCoreFields = computed(() => [
40
+ {
41
+ key: "title",
42
+ label: t("mapo.menuNodeEditor.title"),
43
+ type: "text",
44
+ required: true
45
+ },
46
+ {
47
+ key: "link.link_type",
48
+ label: t("mapo.menuNodeEditor.linkTypeLabel"),
49
+ type: "select",
50
+ cols: { md: 4 },
51
+ attrs: {
52
+ items: [
53
+ { label: t("mapo.menuNodeEditor.relational"), value: "RE" },
54
+ { label: t("mapo.menuNodeEditor.static"), value: "ST" }
55
+ ]
56
+ }
57
+ },
58
+ ...Object.keys(props.availableClasses).length ? [
59
+ {
60
+ key: "meta.style",
61
+ label: t("mapo.menuNodeEditor.styleLabel"),
62
+ type: "select",
63
+ cols: { md: 4 },
64
+ attrs: {
65
+ items: Object.entries(props.availableClasses).map(
66
+ ([label, value]) => ({ label, value })
67
+ )
68
+ }
69
+ }
70
+ ] : [],
71
+ {
72
+ // `target_bank` keeps the v1/Camomilla meta key for data compatibility.
73
+ key: "meta.target_bank",
74
+ label: t("mapo.menuNodeEditor.openInNewTabLabel"),
75
+ type: "switch",
76
+ cols: { md: 4 }
77
+ },
78
+ {
79
+ key: "link.content_type",
80
+ label: t("mapo.menuNodeEditor.relContentTypeLabel"),
81
+ type: "fks",
82
+ cols: { md: 6 },
83
+ show: ({ model }) => model.link?.link_type === "RE",
84
+ onChange: () => loadPages(),
85
+ attrs: {
86
+ endpoint: pageTypesEndpoint.value,
87
+ itemText: "verbose_name_plural",
88
+ itemValue: "id",
89
+ returnObject: false,
90
+ multiple: false
91
+ }
92
+ },
93
+ {
94
+ key: "link.url_node",
95
+ label: t("mapo.menuNodeEditor.relPageIdLabel"),
96
+ type: "select",
97
+ cols: { md: 6 },
98
+ show: ({ model }) => model.link?.link_type === "RE",
99
+ attrs: {
100
+ items: availablePages.value.map((p) => ({
101
+ label: p.name,
102
+ value: p.url_node_id
103
+ }))
104
+ }
105
+ },
106
+ {
107
+ key: "link.static",
108
+ label: t("mapo.menuNodeEditor.staticLabel"),
109
+ type: "text",
110
+ show: ({ model }) => model.link?.link_type === "ST"
111
+ }
112
+ ]);
113
+ const fields = computed(() => [
114
+ ...props.coreFields ?? defaultCoreFields.value,
115
+ ...props.additionalFields
116
+ ]);
117
+ const breadcrumbs = computed(() => {
118
+ const found = findMenuNode(props.nodes, props.modelValue.id);
119
+ return found ? [...found.parents, found.node] : [props.modelValue];
120
+ });
121
+ const errors = computed(() => {
122
+ const flat = {};
123
+ const walk = (obj, prefix) => {
124
+ if (Array.isArray(obj)) {
125
+ flat[prefix] = obj.map(String);
126
+ } else if (obj && typeof obj === "object") {
127
+ for (const [k, v] of Object.entries(obj)) {
128
+ walk(v, prefix ? `${prefix}.${k}` : k);
129
+ }
130
+ }
131
+ };
132
+ walk(props.modelValue?.errors ?? {}, "");
133
+ return flat;
134
+ });
135
+ const slotBindings = computed(() => ({
136
+ model: props.modelValue,
137
+ fields: fields.value,
138
+ errors: errors.value,
139
+ readonly: props.readonly
140
+ }));
141
+ const MapoForm = resolveComponent("MapoForm");
142
+ </script>
143
+
144
+ <template>
145
+ <div class="mapo-menu-node-editor flex h-full min-w-0 flex-1 flex-col">
146
+ <!-- Top bar: breadcrumbs + delete -->
147
+ <div
148
+ class="flex items-center justify-between gap-2 border-b border-default px-4 py-2"
149
+ >
150
+ <p class="flex min-w-0 items-center gap-1 truncate text-sm">
151
+ <span class="shrink-0 text-dimmed"
152
+ >{{ t("mapo.menuNodeEditor.editNode") }}:</span
153
+ >
154
+ <template v-for="(node, i) in breadcrumbs" :key="node.id">
155
+ <button
156
+ type="button"
157
+ class="max-w-40 truncate hover:underline"
158
+ :class="
159
+ i === breadcrumbs.length - 1 ? 'font-medium text-highlighted' : 'text-muted'
160
+ "
161
+ @click="emit('update:modelValue', node)"
162
+ >
163
+ {{ node.title || "\u2026" }}
164
+ </button>
165
+ <UIcon
166
+ v-if="i !== breadcrumbs.length - 1"
167
+ name="i-lucide-chevron-right"
168
+ class="size-3 shrink-0 text-dimmed"
169
+ />
170
+ </template>
171
+ </p>
172
+ <UButton
173
+ v-if="!readonly"
174
+ icon="i-lucide-trash-2"
175
+ size="xs"
176
+ color="error"
177
+ variant="soft"
178
+ @click="emit('delete')"
179
+ >
180
+ {{ t("mapo.delete") }}
181
+ </UButton>
182
+ </div>
183
+
184
+ <!-- Form -->
185
+ <div class="flex-1 overflow-y-auto p-4">
186
+ <slot name="form-top" v-bind="slotBindings" />
187
+ <slot name="form" v-bind="slotBindings">
188
+ <component
189
+ :is="MapoForm"
190
+ :model-value="modelValue"
191
+ :fields="fields"
192
+ :errors="errors"
193
+ :readonly="readonly"
194
+ immediate
195
+ @update:model-value="emit('update:modelValue', $event)"
196
+ />
197
+ </slot>
198
+ <slot name="form-bottom" v-bind="slotBindings" />
199
+ </div>
200
+ </div>
201
+ </template>
@@ -0,0 +1,61 @@
1
+ import type { AnyFieldDescriptor } from "@mapomodule/form/types";
2
+ import { type MenuTreeNode } from "../types/menu.js";
3
+ /**
4
+ * Right pane of `MapoMenuManager`: edits the selected node with a `MapoForm`.
5
+ *
6
+ * The default field set matches v1/Camomilla (title, link type, style,
7
+ * new-tab flag, relational page picker, static URL). Consumers can replace it
8
+ * entirely (`core-fields`) or append their own (`additional-fields`).
9
+ */
10
+ type __VLS_Props = {
11
+ /** Selected node (v-model). Mutated in place — the tree owns the data. */
12
+ modelValue: MenuTreeNode;
13
+ /** Full node tree, used to compute the breadcrumb trail. */
14
+ nodes?: MenuTreeNode[];
15
+ /** Menu CRUD endpoint; `<endpoint>/page_types` feeds the relational picker. */
16
+ menuEndpoint?: string;
17
+ /** Replaces the default core field set entirely. */
18
+ coreFields?: AnyFieldDescriptor[] | null;
19
+ /** Extra fields appended after the core ones. */
20
+ additionalFields?: AnyFieldDescriptor[];
21
+ /** CSS classes offered by the `style` select, as `{ label: cssClass }`. */
22
+ availableClasses?: Record<string, string>;
23
+ readonly?: boolean;
24
+ };
25
+ type __VLS_Slots = {
26
+ /** Content above the form. Receives the slot bindings. */
27
+ "form-top"(props: SlotBindings): unknown;
28
+ /** Replaces the whole form. Receives the slot bindings. */
29
+ form(props: SlotBindings): unknown;
30
+ /** Content below the form. Receives the slot bindings. */
31
+ "form-bottom"(props: SlotBindings): unknown;
32
+ };
33
+ interface SlotBindings {
34
+ model: MenuTreeNode;
35
+ fields: AnyFieldDescriptor[];
36
+ errors: Record<string, string[]>;
37
+ readonly: boolean;
38
+ }
39
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
40
+ delete: () => any;
41
+ "update:modelValue": (node: MenuTreeNode) => any;
42
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
43
+ onDelete?: (() => any) | undefined;
44
+ "onUpdate:modelValue"?: ((node: MenuTreeNode) => any) | undefined;
45
+ }>, {
46
+ nodes: MenuTreeNode[];
47
+ readonly: boolean;
48
+ menuEndpoint: string;
49
+ coreFields: AnyFieldDescriptor[] | null;
50
+ additionalFields: AnyFieldDescriptor[];
51
+ availableClasses: Record<string, string>;
52
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
53
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
54
+ declare const _default: typeof __VLS_export;
55
+ export default _default;
56
+ type __VLS_WithSlots<T, S> = T & {
57
+ new (): {
58
+ $slots: S;
59
+ };
60
+ };
61
+ //# sourceMappingURL=MapoMenuNodeEditor.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapoMenuNodeEditor.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMenuNodeEditor.vue"],"names":[],"mappings":"AAgSA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEnE;;;;;;GAMG;AACH,KAAK,WAAW,GAAG;IACf,0EAA0E;IAC1E,UAAU,EAAE,YAAY,CAAC;IACzB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,UAAU,CAAC,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;IACzC,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACxC,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAoBJ,KAAK,WAAW,GAAG;IACjB,0DAA0D;IAC1D,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;IACzC,2DAA2D;IAC3D,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;IACnC,0DAA0D;IAC1D,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;CAC7C,CAAC;AAGF,UAAU,YAAY;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAmWD,QAAA,MAAM,UAAU;;;;;;;WAhZJ,YAAY,EAAE;cASX,OAAO;kBAPH,MAAM;gBAER,kBAAkB,EAAE,GAAG,IAAI;sBAErB,kBAAkB,EAAE;sBAEpB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;6EA4Y3C,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,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
+ loading: boolean;
45
+ readonly: 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;aAKJ,OAAO;cAFN,OAAO;gBAJL,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>