feat (client): sort "select a widget" dropdown (closes #10973)

This commit is contained in:
naskya 2024-07-22 04:20:27 +09:00
parent caab676984
commit 888e472157
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -9,7 +9,7 @@
>
<template #label>{{ i18n.ts.selectWidget }}</template>
<option
v-for="widget in widgetDefs"
v-for="widget in sortedWidgets"
:key="widget"
:value="widget"
>
@ -101,6 +101,12 @@ const emit = defineEmits<{
(ev: "exit"): void;
}>();
const sortedWidgets = computed(() =>
widgetDefs.sort((a, b) =>
i18n.t(`_widgets.${a}`).localeCompare(i18n.t(`_widgets.${b}`)),
),
);
const widgetRefs = {};
const configWidget = (id: string) => {
widgetRefs[id].configure();