@mapomodule/uikit 2.0.0-beta.7 → 2.0.0-experimental.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -174
- package/dist/__tests__/MapoConfirmDialog.component.test.d.ts +2 -0
- package/dist/__tests__/MapoConfirmDialog.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoDetail.component.test.d.ts +2 -0
- package/dist/__tests__/MapoDetail.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoDetailLangSwitch.component.test.d.ts +2 -0
- package/dist/__tests__/MapoDetailLangSwitch.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoListActions.component.test.d.ts +2 -0
- package/dist/__tests__/MapoListActions.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoListTable.component.test.d.ts +2 -0
- package/dist/__tests__/MapoListTable.component.test.d.ts.map +1 -0
- package/dist/__tests__/MapoSnackBar.component.test.d.ts +2 -0
- package/dist/__tests__/MapoSnackBar.component.test.d.ts.map +1 -0
- package/dist/__tests__/__mocks__/nuxt-app.d.ts +9 -0
- package/dist/__tests__/__mocks__/nuxt-app.d.ts.map +1 -0
- package/dist/__tests__/formValues.test.d.ts +2 -0
- package/dist/__tests__/formValues.test.d.ts.map +1 -0
- package/dist/__tests__/langInfo.test.d.ts +2 -0
- package/dist/__tests__/langInfo.test.d.ts.map +1 -0
- package/dist/__tests__/listTable.test.d.ts +2 -0
- package/dist/__tests__/listTable.test.d.ts.map +1 -0
- package/dist/__tests__/mediaLanguages.test.d.ts +2 -0
- package/dist/__tests__/mediaLanguages.test.d.ts.map +1 -0
- package/dist/__tests__/runtimePages.test.d.ts +2 -0
- package/dist/__tests__/runtimePages.test.d.ts.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/module.d.mts +2 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +23 -2
- package/dist/runtime/assets/main.css +1 -1
- package/dist/runtime/components/MapoConfirmDialog.vue +23 -4
- package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoDetail.vue +301 -63
- package/dist/runtime/components/MapoDetail.vue.d.ts +191 -9
- package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoDetailExtensions.vue +24 -0
- package/dist/runtime/components/MapoDetailExtensions.vue.d.ts +15 -0
- package/dist/runtime/components/MapoDetailExtensions.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoDetailLangSwitch.vue +22 -26
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts +4 -3
- package/dist/runtime/components/MapoDetailLangSwitch.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoDropArea.vue +5 -1
- package/dist/runtime/components/MapoDropArea.vue.d.ts +1 -1
- package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoLangSwitcher.vue +39 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts +18 -0
- package/dist/runtime/components/MapoLangSwitcher.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoList.vue +7 -3
- package/dist/runtime/components/MapoList.vue.d.ts +14 -4
- package/dist/runtime/components/MapoList.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListActions.vue +27 -13
- package/dist/runtime/components/MapoListActions.vue.d.ts +4 -0
- package/dist/runtime/components/MapoListActions.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListFilters.vue +4 -2
- package/dist/runtime/components/MapoListFilters.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListQuickEdit.vue +12 -8
- package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoListTable.vue +116 -45
- package/dist/runtime/components/MapoListTable.vue.d.ts +11 -6
- package/dist/runtime/components/MapoListTable.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoLogin.vue +13 -10
- package/dist/runtime/components/MapoLogin.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoLogoutButton.vue +4 -2
- package/dist/runtime/components/MapoLogoutButton.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue +3 -1
- package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaEditor.vue +36 -20
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts +1 -0
- package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaFileChanger.vue +7 -3
- package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaFolders.vue +36 -14
- package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaGallery.vue +15 -5
- package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaManager.vue +17 -7
- package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaManagerDialog.vue +8 -4
- package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMediaUploader.vue +53 -29
- package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoMenuManager.vue +293 -0
- package/dist/runtime/components/MapoMenuManager.vue.d.ts +92 -0
- package/dist/runtime/components/MapoMenuManager.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue +201 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts +61 -0
- package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuTreeview.vue +181 -0
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts +57 -0
- package/dist/runtime/components/MapoMenuTreeview.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue +175 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts +27 -0
- package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts.map +1 -0
- package/dist/runtime/components/MapoSidebar.vue +3 -1
- package/dist/runtime/components/MapoSidebar.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoSidebarList.vue +1 -1
- package/dist/runtime/components/MapoSidebarProfile.vue +6 -2
- package/dist/runtime/components/MapoSidebarProfile.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoSnackBar.vue +11 -0
- package/dist/runtime/components/MapoSnackBar.vue.d.ts.map +1 -1
- package/dist/runtime/components/MapoThemeToggle.vue +5 -1
- package/dist/runtime/components/MapoThemeToggle.vue.d.ts.map +1 -1
- package/dist/runtime/components/menuDndContext.d.ts +19 -0
- package/dist/runtime/components/menuDndContext.d.ts.map +1 -0
- package/dist/runtime/components/menuDndContext.js +3 -0
- package/dist/runtime/composables/defineDetailExtension.d.ts +32 -0
- package/dist/runtime/composables/defineDetailExtension.d.ts.map +1 -0
- package/dist/runtime/composables/defineDetailExtension.js +34 -0
- package/dist/runtime/composables/useMapoDetail.d.ts +18 -0
- package/dist/runtime/composables/useMapoDetail.d.ts.map +1 -0
- package/dist/runtime/composables/useMapoDetail.js +5 -0
- package/dist/runtime/page-meta.nuxt.d.ts +4 -0
- package/dist/runtime/pages/index.vue +4 -2
- package/dist/runtime/pages/index.vue.d.ts.map +1 -1
- package/dist/runtime/plugins/media-adapter.d.ts.map +1 -1
- package/dist/runtime/plugins/media-adapter.js +2 -1
- package/dist/runtime/stores/media.d.ts +8 -2
- package/dist/runtime/stores/media.d.ts.map +1 -1
- package/dist/runtime/stores/media.js +45 -13
- package/dist/runtime/types/detail.d.ts +167 -0
- package/dist/runtime/types/detail.d.ts.map +1 -0
- package/dist/runtime/types/detail.js +0 -0
- package/dist/runtime/types/list.d.ts +10 -2
- package/dist/runtime/types/list.d.ts.map +1 -1
- package/dist/runtime/types/menu.d.ts +66 -0
- package/dist/runtime/types/menu.d.ts.map +1 -0
- package/dist/runtime/types/menu.js +30 -0
- package/dist/runtime/utils/formValues.d.ts +8 -0
- package/dist/runtime/utils/formValues.d.ts.map +1 -0
- package/dist/runtime/utils/formValues.js +19 -0
- package/dist/runtime/utils/langInfo.d.ts +30 -0
- package/dist/runtime/utils/langInfo.d.ts.map +1 -0
- package/dist/runtime/utils/langInfo.js +8 -0
- package/dist/runtime/utils/listTable.d.ts +29 -0
- package/dist/runtime/utils/listTable.d.ts.map +1 -0
- package/dist/runtime/utils/listTable.js +21 -0
- package/package.json +12 -10
- package/src/__tests__/MapoConfirmDialog.component.test.ts +165 -0
- package/src/__tests__/MapoDetail.component.test.ts +1107 -0
- package/src/__tests__/MapoDetailLangSwitch.component.test.ts +145 -0
- package/src/__tests__/MapoListActions.component.test.ts +175 -0
- package/src/__tests__/MapoListTable.component.test.ts +504 -0
- package/src/__tests__/MapoSnackBar.component.test.ts +79 -0
- package/src/__tests__/__mocks__/nuxt-app.ts +8 -0
- package/src/__tests__/formValues.test.ts +31 -0
- package/src/__tests__/langInfo.test.ts +48 -0
- package/src/__tests__/listTable.test.ts +82 -0
- package/src/__tests__/mediaLanguages.test.ts +66 -0
- package/src/__tests__/runtimePages.test.ts +17 -0
- package/src/index.ts +20 -0
- package/src/module.ts +29 -0
- package/src/runtime/assets/main.css +13 -0
- package/src/runtime/components/MapoConfirmDialog.vue +33 -4
- package/src/runtime/components/MapoDetail.vue +520 -89
- package/src/runtime/components/MapoDetailExtensions.vue +39 -0
- package/src/runtime/components/MapoDetailLangSwitch.vue +27 -28
- package/src/runtime/components/MapoDropArea.vue +6 -1
- package/src/runtime/components/MapoLangSwitcher.vue +74 -0
- package/src/runtime/components/MapoList.vue +21 -6
- package/src/runtime/components/MapoListActions.vue +32 -14
- package/src/runtime/components/MapoListFilters.vue +5 -2
- package/src/runtime/components/MapoListQuickEdit.vue +12 -9
- package/src/runtime/components/MapoListTable.vue +147 -55
- package/src/runtime/components/MapoLogin.vue +13 -10
- package/src/runtime/components/MapoLogoutButton.vue +4 -2
- package/src/runtime/components/MapoMediaBreadcrumbs.vue +3 -1
- package/src/runtime/components/MapoMediaEditor.vue +43 -20
- package/src/runtime/components/MapoMediaFileChanger.vue +8 -3
- package/src/runtime/components/MapoMediaFolders.vue +37 -15
- package/src/runtime/components/MapoMediaGallery.vue +17 -5
- package/src/runtime/components/MapoMediaManager.vue +17 -7
- package/src/runtime/components/MapoMediaManagerDialog.vue +10 -4
- package/src/runtime/components/MapoMediaUploader.vue +60 -29
- package/src/runtime/components/MapoMenuManager.vue +437 -0
- package/src/runtime/components/MapoMenuNodeEditor.vue +282 -0
- package/src/runtime/components/MapoMenuTreeview.vue +264 -0
- package/src/runtime/components/MapoMenuTreeviewNode.vue +234 -0
- package/src/runtime/components/MapoSidebar.vue +3 -1
- package/src/runtime/components/MapoSidebarList.vue +1 -1
- package/src/runtime/components/MapoSidebarProfile.vue +6 -2
- package/src/runtime/components/MapoSnackBar.vue +12 -0
- package/src/runtime/components/MapoThemeToggle.vue +5 -1
- package/src/runtime/components/menuDndContext.ts +22 -0
- package/src/runtime/composables/defineDetailExtension.ts +78 -0
- package/src/runtime/composables/useMapoDetail.ts +24 -0
- package/src/runtime/page-meta.nuxt.d.ts +4 -0
- package/src/runtime/pages/index.vue +5 -2
- package/src/runtime/plugins/media-adapter.ts +9 -5
- package/src/runtime/stores/media.ts +61 -13
- package/src/runtime/types/detail.ts +178 -0
- package/src/runtime/types/list.ts +10 -2
- package/src/runtime/types/menu.ts +105 -0
- package/src/runtime/utils/formValues.ts +28 -0
- package/src/runtime/utils/langInfo.ts +38 -0
- package/src/runtime/utils/listTable.ts +54 -0
|
@@ -6,20 +6,34 @@ import {
|
|
|
6
6
|
watch,
|
|
7
7
|
h,
|
|
8
8
|
resolveComponent,
|
|
9
|
-
useSlots
|
|
9
|
+
useSlots,
|
|
10
|
+
onBeforeUnmount
|
|
10
11
|
} from "vue";
|
|
12
|
+
import { useI18n } from "vue-i18n";
|
|
11
13
|
import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
|
|
12
14
|
import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
|
|
13
15
|
import { usePermissions } from "@mapomodule/store/runtime/composables/usePermissions";
|
|
14
16
|
import { useCrud } from "@mapomodule/core/runtime/api/crud";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
+
import {
|
|
18
|
+
debounce,
|
|
19
|
+
getNestedValue,
|
|
20
|
+
splitEndpointParams
|
|
21
|
+
} from "@mapomodule/utils";
|
|
22
|
+
import { useRoute, useRouter } from "#app";
|
|
23
|
+
import {
|
|
24
|
+
ALL_ROWS,
|
|
25
|
+
formatPageSize,
|
|
26
|
+
nextSorting,
|
|
27
|
+
orderingParam,
|
|
28
|
+
parsePageSize,
|
|
29
|
+
toPageSize
|
|
30
|
+
} from "../utils/listTable.js";
|
|
17
31
|
const props = defineProps({
|
|
18
32
|
endpoint: { type: String, required: false, default: "" },
|
|
19
33
|
items: { type: Array, required: false, default: void 0 },
|
|
20
34
|
crudEndpoint: { type: String, required: false },
|
|
21
35
|
filterParams: { type: Object, required: false },
|
|
22
|
-
defaultPageSize: { type: Number, required: false, default: 20 },
|
|
36
|
+
defaultPageSize: { type: [Number, String], required: false, default: 20 },
|
|
23
37
|
pageSizeOptions: { type: Array, required: false, default: () => [10, 20, 50, 100] },
|
|
24
38
|
responseAdapter: { type: Function, required: false },
|
|
25
39
|
paginationParams: { type: Function, required: false },
|
|
@@ -41,7 +55,8 @@ const emit = defineEmits(["update:selection", "update:selectionQuery", "update:i
|
|
|
41
55
|
defineExpose({ refresh });
|
|
42
56
|
defineSlots();
|
|
43
57
|
const slots = useSlots();
|
|
44
|
-
const atKey = (item, key) => item
|
|
58
|
+
const atKey = (item, key) => getNestedValue(item, key);
|
|
59
|
+
const { t } = useI18n();
|
|
45
60
|
const snack = useSnackStore();
|
|
46
61
|
const confirm = useConfirmStore();
|
|
47
62
|
const route = useRoute();
|
|
@@ -64,10 +79,17 @@ function toPositiveNumber(value, fallback) {
|
|
|
64
79
|
const n = Number(value);
|
|
65
80
|
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
66
81
|
}
|
|
82
|
+
const defaultPageSize = toPageSize(props.defaultPageSize);
|
|
67
83
|
const pagination = ref({
|
|
68
84
|
pageIndex: route.query.page ? Math.max(0, toPositiveNumber(route.query.page, 1) - 1) : 0,
|
|
69
|
-
pageSize: route.query.page_size ?
|
|
85
|
+
pageSize: route.query.page_size ? parsePageSize(route.query.page_size, defaultPageSize) : defaultPageSize
|
|
70
86
|
});
|
|
87
|
+
const showsAllRows = computed(() => pagination.value.pageSize === ALL_ROWS);
|
|
88
|
+
const pageSizeItems = computed(
|
|
89
|
+
() => props.pageSizeOptions.map(
|
|
90
|
+
(option) => option === "all" ? { label: t("mapo.listTable.allRows"), value: ALL_ROWS } : { label: t("mapo.listTable.perPage", { n: option }), value: option }
|
|
91
|
+
)
|
|
92
|
+
);
|
|
71
93
|
const sorting = ref(
|
|
72
94
|
route.query.ordering ? String(route.query.ordering).split(",").map((o) => ({
|
|
73
95
|
id: o.startsWith("-") ? o.slice(1) : o,
|
|
@@ -86,8 +108,8 @@ const writeUrlState = debounce(() => {
|
|
|
86
108
|
const page = pagination.value.pageIndex + 1;
|
|
87
109
|
if (page > 1) query.page = String(page);
|
|
88
110
|
else delete query.page;
|
|
89
|
-
if (pagination.value.pageSize !==
|
|
90
|
-
query.page_size =
|
|
111
|
+
if (pagination.value.pageSize !== defaultPageSize)
|
|
112
|
+
query.page_size = formatPageSize(pagination.value.pageSize);
|
|
91
113
|
else delete query.page_size;
|
|
92
114
|
if (search.value) query.search = search.value;
|
|
93
115
|
else delete query.search;
|
|
@@ -97,6 +119,10 @@ const writeUrlState = debounce(() => {
|
|
|
97
119
|
router.replace({ query });
|
|
98
120
|
}, 150);
|
|
99
121
|
watch([pagination, search, sorting], writeUrlState, { deep: true });
|
|
122
|
+
onBeforeUnmount(() => {
|
|
123
|
+
onSearchInput.cancel();
|
|
124
|
+
writeUrlState.cancel();
|
|
125
|
+
});
|
|
100
126
|
const rowSelection = ref({});
|
|
101
127
|
const pkOf = (row) => String(atKey(row, props.lookup));
|
|
102
128
|
const isAllSelected = computed(
|
|
@@ -115,11 +141,11 @@ watch(selectedRows, (rows2) => {
|
|
|
115
141
|
});
|
|
116
142
|
function buildSelectionQuery() {
|
|
117
143
|
const params = new URLSearchParams();
|
|
118
|
-
|
|
144
|
+
if (!showsAllRows.value)
|
|
145
|
+
params.set("page_size", String(pagination.value.pageSize));
|
|
119
146
|
if (search.value) params.set("search", search.value);
|
|
120
|
-
sorting.value.
|
|
121
|
-
|
|
122
|
-
);
|
|
147
|
+
if (sorting.value.length)
|
|
148
|
+
params.set("ordering", orderingParam(sorting.value));
|
|
123
149
|
return params;
|
|
124
150
|
}
|
|
125
151
|
function toggleAll() {
|
|
@@ -165,9 +191,9 @@ const quickEditLocalItem = computed(() => {
|
|
|
165
191
|
});
|
|
166
192
|
async function deleteRow(item) {
|
|
167
193
|
const ok = await confirm.ask({
|
|
168
|
-
title: "
|
|
169
|
-
message: "
|
|
170
|
-
confirmText: "
|
|
194
|
+
title: t("mapo.listTable.deleteItemTitle"),
|
|
195
|
+
message: t("mapo.confirmDelete"),
|
|
196
|
+
confirmText: t("mapo.delete"),
|
|
171
197
|
dangerous: true
|
|
172
198
|
});
|
|
173
199
|
if (!ok) return;
|
|
@@ -176,16 +202,16 @@ async function deleteRow(item) {
|
|
|
176
202
|
(r) => String(atKey(r, props.lookup)) !== String(atKey(item, props.lookup))
|
|
177
203
|
);
|
|
178
204
|
emit("update:items", next);
|
|
179
|
-
snack.show("
|
|
205
|
+
snack.show(t("mapo.listTable.itemDeleted"), "success");
|
|
180
206
|
return;
|
|
181
207
|
}
|
|
182
208
|
try {
|
|
183
209
|
await crud.delete(atKey(item, props.lookup));
|
|
184
|
-
snack.show("
|
|
210
|
+
snack.show(t("mapo.listTable.itemDeleted"), "success");
|
|
185
211
|
if (hybridMode.value) hybridLoaded.value = false;
|
|
186
212
|
refresh();
|
|
187
213
|
} catch {
|
|
188
|
-
snack.show("
|
|
214
|
+
snack.show(t("mapo.listTable.deleteItemError"), "error");
|
|
189
215
|
}
|
|
190
216
|
}
|
|
191
217
|
const canReorder = computed(
|
|
@@ -270,13 +296,13 @@ async function onDrop(fromIdx, toIdx) {
|
|
|
270
296
|
atKey(moved, props.lookup),
|
|
271
297
|
atKey(target, props.lookup)
|
|
272
298
|
);
|
|
273
|
-
snack.show("
|
|
299
|
+
snack.show(t("mapo.listTable.orderSaved"), "success");
|
|
274
300
|
if (hybridMode.value) {
|
|
275
301
|
hybridLoaded.value = false;
|
|
276
302
|
refresh();
|
|
277
303
|
}
|
|
278
304
|
} catch {
|
|
279
|
-
snack.show("
|
|
305
|
+
snack.show(t("mapo.listTable.orderError"), "error");
|
|
280
306
|
refresh();
|
|
281
307
|
}
|
|
282
308
|
}
|
|
@@ -286,7 +312,7 @@ function applyOffline(source) {
|
|
|
286
312
|
const q = search.value.toLowerCase();
|
|
287
313
|
arr = arr.filter(
|
|
288
314
|
(row) => props.columns.some(
|
|
289
|
-
(c) => String(row
|
|
315
|
+
(c) => String(atKey(row, c.key) ?? "").toLowerCase().includes(q)
|
|
290
316
|
)
|
|
291
317
|
);
|
|
292
318
|
}
|
|
@@ -349,7 +375,7 @@ async function fetchAll() {
|
|
|
349
375
|
fullDataset.value = nextItems;
|
|
350
376
|
hybridLoaded.value = true;
|
|
351
377
|
} catch {
|
|
352
|
-
snack.show("
|
|
378
|
+
snack.show(t("mapo.loadError"), "error");
|
|
353
379
|
} finally {
|
|
354
380
|
loading.value = false;
|
|
355
381
|
}
|
|
@@ -375,11 +401,11 @@ async function refresh() {
|
|
|
375
401
|
const params = {
|
|
376
402
|
...endpointParams,
|
|
377
403
|
...props.filterParams ?? {},
|
|
378
|
-
|
|
404
|
+
// "All rows" sends no pagination params: the backend returns the whole collection.
|
|
405
|
+
...showsAllRows.value ? {} : paginationP
|
|
379
406
|
};
|
|
380
407
|
if (search.value) params.search = search.value;
|
|
381
|
-
if (sorting.value.length)
|
|
382
|
-
params.ordering = sorting.value.map((s) => `${s.desc ? "-" : ""}${s.id}`).join(",");
|
|
408
|
+
if (sorting.value.length) params.ordering = orderingParam(sorting.value);
|
|
383
409
|
const res = await crud.list(params);
|
|
384
410
|
let nextItems = [];
|
|
385
411
|
let nextTotal = 0;
|
|
@@ -401,7 +427,7 @@ async function refresh() {
|
|
|
401
427
|
rows.value = nextItems;
|
|
402
428
|
total.value = nextTotal;
|
|
403
429
|
} catch {
|
|
404
|
-
snack.show("
|
|
430
|
+
snack.show(t("mapo.loadError"), "error");
|
|
405
431
|
} finally {
|
|
406
432
|
loading.value = false;
|
|
407
433
|
}
|
|
@@ -423,18 +449,51 @@ watch(
|
|
|
423
449
|
search
|
|
424
450
|
],
|
|
425
451
|
([newEndpoint, , newFilters], [oldEndpoint, , oldFilters]) => {
|
|
426
|
-
const
|
|
427
|
-
if (
|
|
428
|
-
pagination.value = { ...pagination.value, pageIndex: 0 };
|
|
429
|
-
} else {
|
|
452
|
+
const isFirstRun = oldFilters === void 0;
|
|
453
|
+
if (isFirstRun) {
|
|
430
454
|
refresh();
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
const endpointChanged = newEndpoint !== oldEndpoint;
|
|
458
|
+
const filtersChanged = newFilters !== oldFilters;
|
|
459
|
+
const contextChanged = endpointChanged || filtersChanged;
|
|
460
|
+
const isOnFirstPage = pagination.value.pageIndex === 0;
|
|
461
|
+
if (contextChanged && !isOnFirstPage) {
|
|
462
|
+
pagination.value = { ...pagination.value, pageIndex: 0 };
|
|
463
|
+
return;
|
|
431
464
|
}
|
|
465
|
+
refresh();
|
|
432
466
|
},
|
|
433
467
|
{ immediate: true, deep: true }
|
|
434
468
|
);
|
|
435
469
|
const UCheckbox = resolveComponent("UCheckbox");
|
|
436
470
|
const UButton = resolveComponent("UButton");
|
|
437
471
|
const UIcon = resolveComponent("UIcon");
|
|
472
|
+
const SORT_ICONS = {
|
|
473
|
+
none: "i-lucide-arrow-up-down",
|
|
474
|
+
asc: "i-lucide-arrow-up-narrow-wide",
|
|
475
|
+
desc: "i-lucide-arrow-down-wide-narrow"
|
|
476
|
+
};
|
|
477
|
+
const SORT_NEXT_ACTION = {
|
|
478
|
+
none: "mapo.listTable.sortAscending",
|
|
479
|
+
asc: "mapo.listTable.sortDescending",
|
|
480
|
+
desc: "mapo.listTable.clearSorting"
|
|
481
|
+
};
|
|
482
|
+
function sortHeader(col) {
|
|
483
|
+
const sort = sorting.value.find((s) => s.id === col.key);
|
|
484
|
+
const direction = !sort ? "none" : sort.desc ? "desc" : "asc";
|
|
485
|
+
return h(UButton, {
|
|
486
|
+
color: "neutral",
|
|
487
|
+
variant: "ghost",
|
|
488
|
+
label: col.label,
|
|
489
|
+
icon: SORT_ICONS[direction],
|
|
490
|
+
class: "-mx-2.5",
|
|
491
|
+
"aria-label": t(SORT_NEXT_ACTION[direction], { column: col.label }),
|
|
492
|
+
onClick: () => {
|
|
493
|
+
sorting.value = nextSorting(sorting.value, col.key);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}
|
|
438
497
|
const tableColumns = computed(() => {
|
|
439
498
|
const cols = [];
|
|
440
499
|
cols.push({
|
|
@@ -443,14 +502,14 @@ const tableColumns = computed(() => {
|
|
|
443
502
|
modelValue: isAllSelected.value,
|
|
444
503
|
indeterminate: isIndeterminate.value,
|
|
445
504
|
"onUpdate:modelValue": toggleAll,
|
|
446
|
-
ariaLabel: "
|
|
505
|
+
ariaLabel: t("mapo.listTable.selectAllRows")
|
|
447
506
|
}),
|
|
448
507
|
cell: ({ row }) => {
|
|
449
508
|
const k = pkOf(row.original);
|
|
450
509
|
return h(UCheckbox, {
|
|
451
510
|
modelValue: !!rowSelection.value[k],
|
|
452
511
|
"onUpdate:modelValue": () => toggleRowByKey(k),
|
|
453
|
-
ariaLabel: "
|
|
512
|
+
ariaLabel: t("mapo.listTable.selectRow")
|
|
454
513
|
});
|
|
455
514
|
},
|
|
456
515
|
meta: { class: { th: "w-10", td: "w-10" } }
|
|
@@ -464,7 +523,7 @@ const tableColumns = computed(() => {
|
|
|
464
523
|
{
|
|
465
524
|
class: canReorder.value ? "cursor-grab text-muted" : "cursor-not-allowed text-muted opacity-30",
|
|
466
525
|
draggable: canReorder.value,
|
|
467
|
-
title: canReorder.value ? "
|
|
526
|
+
title: canReorder.value ? t("mapo.listTable.dragToReorder") : t("mapo.listTable.clearToReorder"),
|
|
468
527
|
onDragstart: (e) => {
|
|
469
528
|
e.dataTransfer?.setData("text/plain", "");
|
|
470
529
|
onDragStart(row.index);
|
|
@@ -480,8 +539,11 @@ const tableColumns = computed(() => {
|
|
|
480
539
|
const col = props.columns[i];
|
|
481
540
|
const isFirst = i === 0 && !!props.detailBase;
|
|
482
541
|
cols.push({
|
|
542
|
+
// TanStack would turn a dotted key into `category_name`; the sorting
|
|
543
|
+
// state uses the column key, so the id must be the key itself.
|
|
544
|
+
id: col.key,
|
|
483
545
|
accessorKey: col.key,
|
|
484
|
-
header: col.label,
|
|
546
|
+
header: col.sortable ? () => sortHeader(col) : col.label,
|
|
485
547
|
cell: ({ row }) => {
|
|
486
548
|
const cellSlot = slots[`cell.${col.key}`];
|
|
487
549
|
if (cellSlot)
|
|
@@ -517,6 +579,7 @@ const tableColumns = computed(() => {
|
|
|
517
579
|
variant: "ghost",
|
|
518
580
|
color: "neutral",
|
|
519
581
|
icon: "i-lucide-pencil",
|
|
582
|
+
"aria-label": t("mapo.edit"),
|
|
520
583
|
onClick: () => openQuickEdit(
|
|
521
584
|
atKey(row.original, props.lookup)
|
|
522
585
|
)
|
|
@@ -530,6 +593,7 @@ const tableColumns = computed(() => {
|
|
|
530
593
|
variant: "ghost",
|
|
531
594
|
color: "error",
|
|
532
595
|
icon: "i-lucide-trash-2",
|
|
596
|
+
"aria-label": t("mapo.delete"),
|
|
533
597
|
onClick: () => deleteRow(row.original)
|
|
534
598
|
})
|
|
535
599
|
);
|
|
@@ -544,6 +608,15 @@ const tableColumns = computed(() => {
|
|
|
544
608
|
});
|
|
545
609
|
return cols;
|
|
546
610
|
});
|
|
611
|
+
const emptyText = computed(() => {
|
|
612
|
+
const isSearching = !!search.value;
|
|
613
|
+
const isFiltering = Object.values(props.filterParams ?? {}).some(
|
|
614
|
+
(value) => value != null && value !== ""
|
|
615
|
+
);
|
|
616
|
+
return t(
|
|
617
|
+
isSearching || isFiltering ? "mapo.listTable.noResults" : "mapo.listTable.noItems"
|
|
618
|
+
);
|
|
619
|
+
});
|
|
547
620
|
const paginationOptions = computed(() => ({
|
|
548
621
|
manualPagination: true,
|
|
549
622
|
rowCount: total.value
|
|
@@ -559,7 +632,7 @@ const sortingOptions = computed(() => ({
|
|
|
559
632
|
<div v-if="searchable" class="flex items-center gap-2">
|
|
560
633
|
<UInput
|
|
561
634
|
:model-value="search"
|
|
562
|
-
placeholder="
|
|
635
|
+
:placeholder="t('mapo.search')"
|
|
563
636
|
icon="i-lucide-search"
|
|
564
637
|
size="sm"
|
|
565
638
|
class="max-w-xs"
|
|
@@ -583,7 +656,7 @@ const sortingOptions = computed(() => ({
|
|
|
583
656
|
:pagination-options="paginationOptions"
|
|
584
657
|
:sorting="sorting"
|
|
585
658
|
:sorting-options="sortingOptions"
|
|
586
|
-
empty="
|
|
659
|
+
:empty="emptyText"
|
|
587
660
|
@update:pagination="pagination = $event ?? pagination"
|
|
588
661
|
@update:sorting="sorting = $event ?? sorting"
|
|
589
662
|
>
|
|
@@ -591,7 +664,7 @@ const sortingOptions = computed(() => ({
|
|
|
591
664
|
<slot name="dtable.empty">
|
|
592
665
|
<div class="flex flex-col items-center gap-2 py-8 text-muted">
|
|
593
666
|
<UIcon name="i-lucide-inbox" class="h-8 w-8" />
|
|
594
|
-
<span class="text-sm">
|
|
667
|
+
<span class="text-sm">{{ emptyText }}</span>
|
|
595
668
|
</div>
|
|
596
669
|
</slot>
|
|
597
670
|
</template>
|
|
@@ -611,21 +684,19 @@ const sortingOptions = computed(() => ({
|
|
|
611
684
|
|
|
612
685
|
<!-- Pagination controls -->
|
|
613
686
|
<div class="flex items-center justify-between text-sm text-muted">
|
|
614
|
-
<span>{{ total }}
|
|
687
|
+
<span>{{ t("mapo.listTable.totalItems", { total }) }}</span>
|
|
688
|
+
<!-- Nuxt UI 4's UPagination models `page`: with `modelValue` it runs uncontrolled. -->
|
|
615
689
|
<UPagination
|
|
616
|
-
|
|
690
|
+
v-if="!showsAllRows"
|
|
691
|
+
:page="pagination.pageIndex + 1"
|
|
617
692
|
:total="total"
|
|
618
693
|
:items-per-page="pagination.pageSize"
|
|
619
694
|
size="sm"
|
|
620
|
-
@update:
|
|
621
|
-
pagination = { ...pagination, pageIndex: $event - 1 }
|
|
622
|
-
"
|
|
695
|
+
@update:page="pagination = { ...pagination, pageIndex: $event - 1 }"
|
|
623
696
|
/>
|
|
624
697
|
<USelect
|
|
625
698
|
:model-value="pagination.pageSize"
|
|
626
|
-
:items="
|
|
627
|
-
pageSizeOptions.map((n) => ({ label: `${n} / page`, value: n }))
|
|
628
|
-
"
|
|
699
|
+
:items="pageSizeItems"
|
|
629
700
|
size="xs"
|
|
630
701
|
class="w-28"
|
|
631
702
|
@update:model-value="
|
|
@@ -23,10 +23,14 @@ declare const __VLS_export: <T extends object>(__VLS_props: NonNullable<Awaited<
|
|
|
23
23
|
* and tab params without baking them into the endpoint string.
|
|
24
24
|
*/
|
|
25
25
|
filterParams?: Record<string, unknown>;
|
|
26
|
-
/** Initial page size
|
|
27
|
-
defaultPageSize?: number;
|
|
28
|
-
/**
|
|
29
|
-
|
|
26
|
+
/** Initial page size: a number, or `"all"`. Default: 20. */
|
|
27
|
+
defaultPageSize?: number | "all";
|
|
28
|
+
/**
|
|
29
|
+
* Options of the per-page selector. `"all"` adds an option that requests
|
|
30
|
+
* the list without pagination params, like `clientSide` does: the backend
|
|
31
|
+
* has to return the whole collection then. Default: [10, 20, 50, 100].
|
|
32
|
+
*/
|
|
33
|
+
pageSizeOptions?: (number | "all")[];
|
|
30
34
|
/**
|
|
31
35
|
* Custom response parser. When provided it replaces the built-in DRF / flat-array
|
|
32
36
|
* detection. Return `{ items, total }` from any shape your backend returns.
|
|
@@ -52,6 +56,7 @@ declare const __VLS_export: <T extends object>(__VLS_props: NonNullable<Awaited<
|
|
|
52
56
|
* still hit the backend, then re-fetch. Ignored when `items` is provided.
|
|
53
57
|
*/
|
|
54
58
|
clientSide?: boolean;
|
|
59
|
+
/** Column definitions. A dotted `key` (`category.name`) reads a field of a related object. */
|
|
55
60
|
columns: ListColumn<T>[];
|
|
56
61
|
lookup?: string;
|
|
57
62
|
searchable?: boolean;
|
|
@@ -69,9 +74,9 @@ declare const __VLS_export: <T extends object>(__VLS_props: NonNullable<Awaited<
|
|
|
69
74
|
*/
|
|
70
75
|
permissionModel?: string;
|
|
71
76
|
} & {
|
|
72
|
-
"onUpdate:items"?: ((value: T[]) => any) | undefined;
|
|
73
77
|
"onUpdate:selection"?: ((value: "all" | T[]) => any) | undefined;
|
|
74
78
|
"onUpdate:selectionQuery"?: ((value: URLSearchParams) => any) | undefined;
|
|
79
|
+
"onUpdate:items"?: ((value: T[]) => any) | undefined;
|
|
75
80
|
}> & (typeof globalThis extends {
|
|
76
81
|
__VLS_PROPS_FALLBACK: infer P;
|
|
77
82
|
} ? P : {});
|
|
@@ -91,7 +96,7 @@ declare const __VLS_export: <T extends object>(__VLS_props: NonNullable<Awaited<
|
|
|
91
96
|
item: T;
|
|
92
97
|
value: T[K];
|
|
93
98
|
}) => any; };
|
|
94
|
-
emit: ((evt: "update:
|
|
99
|
+
emit: ((evt: "update:selection", value: "all" | T[]) => void) & ((evt: "update:selectionQuery", value: URLSearchParams) => void) & ((evt: "update:items", value: T[]) => void);
|
|
95
100
|
}>) => import("vue").VNode & {
|
|
96
101
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
97
102
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoListTable.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoListTable.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoListTable.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoListTable.vue"],"names":[],"mappings":"AA2gCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAgBhF,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;WA8sCO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;mBA5sCzC,MAAM;QACjB;;;;;WAKG;gBACK,CAAC,EAAE;QACX;;;;;WAKG;uBACY,MAAM;QACrB;;;;WAIG;uBACY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;QACtC,4DAA4D;0BAC1C,MAAM,GAAG,KAAK;QAChC;;;;WAIG;0BACe,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE;QACpC;;;;WAIG;0BACe,CAAC,GAAG,EAAE,OAAO,KAAK;YAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE;QACjE;;;;WAIG;2BACgB,CAAC,KAAK,EAAE;YACzB,IAAI,EAAE,MAAM,CAAC;YACb,QAAQ,EAAE,MAAM,CAAC;SAClB,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;QAC7B;;;;;WAKG;qBACU,OAAO;QACpB,8FAA8F;iBACrF,UAAU,CAAC,CAAC,CAAC,EAAE;iBACf,MAAM;qBACF,OAAO;oBACR,OAAO;wBACH,MAAM;qBACT,kBAAkB,CAAC,CAAC,CAAC,EAAE;oBACxB,MAAM,EAAE;mBACT,aAAa;QACxB,6GAA6G;qBAChG,MAAM;QACnB;;;;WAIG;0BACe,MAAM;;;;;KAyoC+D,CAAC,GAAG,CAAC,OAAO,UAAU,SAAS;QAAE,oBAAoB,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YAC5J,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,gBAAgB;;MAAsB,KAAK,IAAI;WACxE,GAAG;;+BApmCgB,GAAG,EAAE,KAAK,GAAG;QAPpC,wEAAwE;4BACpD,GAAG;QACvB,qEAAqE;0BACnD,GAAG;QACrB,+EAA+E;4BAC3D,GAAG;WAOtB,CAAC,8CAA8C;QAC9C,IAAI,EAAE,CAAC,CAAC;QACR,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;KACb,KAAK,GAAG;;EAgmCT,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,9 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { reactive, ref } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { useMapoAuth } from "@mapomodule/core/runtime/auth/useMapoAuth";
|
|
4
|
-
import { useRoute } from "
|
|
5
|
-
import { navigateTo } from "#app";
|
|
5
|
+
import { useRoute, navigateTo } from "#app";
|
|
6
6
|
defineSlots();
|
|
7
|
+
const { t } = useI18n();
|
|
7
8
|
const { login } = useMapoAuth();
|
|
8
9
|
const route = useRoute();
|
|
9
10
|
const form = reactive({ username: "", password: "" });
|
|
@@ -25,7 +26,7 @@ async function submit() {
|
|
|
25
26
|
if (data.username?.length) fieldErrors.username = data.username[0];
|
|
26
27
|
if (data.password?.length) fieldErrors.password = data.password[0];
|
|
27
28
|
} else {
|
|
28
|
-
error.value = "
|
|
29
|
+
error.value = t("mapo.login.invalidCredentials");
|
|
29
30
|
}
|
|
30
31
|
} finally {
|
|
31
32
|
loading.value = false;
|
|
@@ -61,9 +62,11 @@ async function submit() {
|
|
|
61
62
|
<UIcon name="i-lucide-layers" class="size-10 text-white" />
|
|
62
63
|
</div>
|
|
63
64
|
<div class="space-y-2">
|
|
64
|
-
<h2 class="text-3xl font-bold tracking-tight">
|
|
65
|
+
<h2 class="text-3xl font-bold tracking-tight">
|
|
66
|
+
{{ t("mapo.login.welcome") }}
|
|
67
|
+
</h2>
|
|
65
68
|
<p class="text-white/70 text-sm leading-relaxed max-w-xs">
|
|
66
|
-
|
|
69
|
+
{{ t("mapo.login.tagline") }}
|
|
67
70
|
</p>
|
|
68
71
|
</div>
|
|
69
72
|
<div class="flex gap-2 flex-wrap justify-center">
|
|
@@ -109,10 +112,10 @@ async function submit() {
|
|
|
109
112
|
</div>
|
|
110
113
|
<div>
|
|
111
114
|
<h1 class="text-2xl font-bold text-highlighted tracking-tight">
|
|
112
|
-
|
|
115
|
+
{{ t("mapo.signIn") }}
|
|
113
116
|
</h1>
|
|
114
117
|
<p class="text-sm text-muted mt-1">
|
|
115
|
-
|
|
118
|
+
{{ t("mapo.login.subtitle") }}
|
|
116
119
|
</p>
|
|
117
120
|
</div>
|
|
118
121
|
</div>
|
|
@@ -123,7 +126,7 @@ async function submit() {
|
|
|
123
126
|
<UCard class="shadow-xl ring-1 ring-default/60">
|
|
124
127
|
<form class="space-y-5" @submit.prevent="submit">
|
|
125
128
|
<UFormField
|
|
126
|
-
label="
|
|
129
|
+
:label="t('mapo.username')"
|
|
127
130
|
name="username"
|
|
128
131
|
:error="fieldErrors.username"
|
|
129
132
|
>
|
|
@@ -140,7 +143,7 @@ async function submit() {
|
|
|
140
143
|
</UFormField>
|
|
141
144
|
|
|
142
145
|
<UFormField
|
|
143
|
-
label="
|
|
146
|
+
:label="t('mapo.password')"
|
|
144
147
|
name="password"
|
|
145
148
|
:error="fieldErrors.password"
|
|
146
149
|
>
|
|
@@ -179,7 +182,7 @@ async function submit() {
|
|
|
179
182
|
:disabled="!form.username || !form.password"
|
|
180
183
|
block
|
|
181
184
|
>
|
|
182
|
-
|
|
185
|
+
{{ t("mapo.signIn") }}
|
|
183
186
|
</UButton>
|
|
184
187
|
</form>
|
|
185
188
|
</UCard>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoLogin.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoLogin.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoLogin.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoLogin.vue"],"names":[],"mappings":"AA4NA,KAAK,WAAW,GAAG;IACjB,yEAAyE;IACzE,KAAK,IAAI,OAAO,CAAC;IACjB,8CAA8C;IAC9C,KAAK,IAAI,OAAO,CAAC;IACjB,uEAAuE;IACvE,aAAa,IAAI,OAAO,CAAC;IACzB,wEAAwE;IACxE,YAAY,IAAI,OAAO,CAAC;IACxB,wDAAwD;IACxD,MAAM,IAAI,OAAO,CAAC;CACnB,CAAC;AAmeF,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,4 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useI18n } from "vue-i18n";
|
|
2
3
|
import { useMapoAuth } from "@mapomodule/core/runtime/auth/useMapoAuth";
|
|
3
4
|
defineProps({
|
|
4
5
|
variant: { type: String, required: false, default: "ghost" },
|
|
@@ -6,6 +7,7 @@ defineProps({
|
|
|
6
7
|
size: { type: String, required: false, default: "sm" },
|
|
7
8
|
iconOnly: { type: Boolean, required: false, default: false }
|
|
8
9
|
});
|
|
10
|
+
const { t } = useI18n();
|
|
9
11
|
const { logout } = useMapoAuth();
|
|
10
12
|
</script>
|
|
11
13
|
|
|
@@ -15,11 +17,11 @@ const { logout } = useMapoAuth();
|
|
|
15
17
|
:color="color"
|
|
16
18
|
:size="size"
|
|
17
19
|
icon="i-lucide-log-out"
|
|
18
|
-
:aria-label="iconOnly ? '
|
|
20
|
+
:aria-label="iconOnly ? t('mapo.logout') : void 0"
|
|
19
21
|
@click="logout()"
|
|
20
22
|
>
|
|
21
23
|
<span v-if="!iconOnly">
|
|
22
|
-
<slot>
|
|
24
|
+
<slot>{{ t("mapo.logout") }}</slot>
|
|
23
25
|
</span>
|
|
24
26
|
</UButton>
|
|
25
27
|
</template>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoLogoutButton.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoLogoutButton.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoLogoutButton.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoLogoutButton.vue"],"names":[],"mappings":"AAsDA,KAAK,WAAW,GAAG;IACf,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAC1D,oCAAoC;IACpC,KAAK,CAAC,EACF,SAAS,GACT,WAAW,GACX,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,GACT,OAAO,CAAC;IACZ,mCAAmC;IACnC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAiFJ,QAAA,IAAI,QAAQ,IAAW,CAAE;AACzB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAKhD,QAAA,MAAM,UAAU;UA3FL,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;WARnC,SAAS,GACT,WAAW,GACX,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,GACT,OAAO;aATD,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM;cAa9C,OAAO;6EA4FpB,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"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import { useMediaStore } from "../stores/media.js";
|
|
5
|
+
const { t } = useI18n();
|
|
4
6
|
const store = useMediaStore();
|
|
5
7
|
const items = computed(() => [
|
|
6
8
|
{
|
|
7
|
-
label: "
|
|
9
|
+
label: t("mapo.mediaManager.root"),
|
|
8
10
|
icon: "i-lucide-folder-open",
|
|
9
11
|
folder: null
|
|
10
12
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapoMediaBreadcrumbs.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMediaBreadcrumbs.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapoMediaBreadcrumbs.vue.d.ts","sourceRoot":"","sources":["../../../src/runtime/components/MapoMediaBreadcrumbs.vue"],"names":[],"mappings":"AAkLA,QAAA,MAAM,YAAY,+QAChB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|