From 8c74ce3572a55ffcb5256f45285313eda49bb52e Mon Sep 17 00:00:00 2001 From: kebin Date: Fri, 29 Nov 2024 17:19:52 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=E3=82=BD=E3=83=BC=E3=83=88=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=E3=80=81UI=E5=A4=89=E6=9B=B4WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dialog/DictionaryManageDialog.vue | 84 +++++++++++++++++-- 1 file changed, 77 insertions(+), 7 deletions(-) diff --git a/src/components/Dialog/DictionaryManageDialog.vue b/src/components/Dialog/DictionaryManageDialog.vue index 8ac6d412c1..e38a330951 100644 --- a/src/components/Dialog/DictionaryManageDialog.vue +++ b/src/components/Dialog/DictionaryManageDialog.vue @@ -39,28 +39,45 @@ -
+ + +
-
-
- 単語一覧 +
+
+ 単語一覧 + 追加 +
+
{{ value.surface }} - {{ value.yomi }} + [{{ value.priority }}] {{ value.yomi }} (undefined); const loadingDictState = ref("loading"); const userDict = ref>({}); +// 検索結果でフィルタリングされたユーザ辞書 +const filteredUserDict = computed(() => { + return Object.fromEntries( + Object.entries(userDict.value) + .sort((a, b) => { + console.log(sortType.value.value); + switch (sortType.value.value) { + case "yomi": + console.log("YOMI: " + a[1].yomi + ", " + b[1].yomi); + return a[1].yomi.localeCompare(b[1].yomi); + case "priority": + console.log("YOMI: " + a[1].priority + ", " + b[1].primary); + return b[1].priority - a[1].priority; + default: + console.log("DEFAULT: " + a[1].priority + ", " + b[1].primary); + + return 0; + } + }) + .filter(([, value]) => { + // 半角から全角に変換 + let searchWord = convertHankakuToZenkaku(wordFilter.value); + // ひらがなからカタカナに変換 + searchWord = convertHiraToKana(searchWord); + // 長音を適切な音に変換 + const searchWordLongVowel = convertLongVowel(searchWord); + return ( + value.surface.includes(searchWord) || + value.yomi.includes(searchWord) || + value.surface.includes(searchWordLongVowel) || + value.yomi.includes(searchWordLongVowel) + ); + }), + ); +}); + +// 表示順 +const sortTypes = [ + { + label: "読み順", + value: "yomi", + }, + { + label: "優先度順", + value: "priority", + }, +]; +const sortType = ref(sortTypes[0]); + const createUILockAction = function (action: Promise) { uiLocked.value = true; return action.finally(() => { @@ -368,6 +436,8 @@ watch(dictionaryManageDialogOpenedComputed, async (newValue) => { } }); +const wordFilter = ref(""); + const wordEditing = ref(false); const surfaceInput = ref(); From e4cb39c8a6e3f44d655fa58e457aa0d3a6b2490b Mon Sep 17 00:00:00 2001 From: kebin Date: Wed, 4 Dec 2024 15:57:37 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=E8=BE=9E=E6=9B=B8=E5=84=AA=E5=85=88?= =?UTF-8?q?=E5=BA=A6=E8=A1=A8=E7=A4=BA=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=80=81=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E6=95=B4=E7=90=86WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dialog/DictionaryManageDialog.vue | 63 +++++++++++++++---- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/src/components/Dialog/DictionaryManageDialog.vue b/src/components/Dialog/DictionaryManageDialog.vue index e38a330951..b603c0e5f4 100644 --- a/src/components/Dialog/DictionaryManageDialog.vue +++ b/src/components/Dialog/DictionaryManageDialog.vue @@ -41,7 +41,7 @@
-
+
追加 - + + + + + 優先度をリストに表示する + + + + + +
+
+ +
@@ -94,7 +122,9 @@ value.surface }} [{{ value.priority }}] {{ value.yomi }}{{ value.yomi }} @@ -349,19 +379,20 @@ const filteredUserDict = computed(() => { return Object.fromEntries( Object.entries(userDict.value) .sort((a, b) => { - console.log(sortType.value.value); + let order; switch (sortType.value.value) { case "yomi": console.log("YOMI: " + a[1].yomi + ", " + b[1].yomi); - return a[1].yomi.localeCompare(b[1].yomi); + order = a[1].yomi.localeCompare(b[1].yomi); + break; case "priority": - console.log("YOMI: " + a[1].priority + ", " + b[1].primary); - return b[1].priority - a[1].priority; + order = b[1].priority - a[1].priority; + break; default: - console.log("DEFAULT: " + a[1].priority + ", " + b[1].primary); - - return 0; + order = 0; + break; } + return order * (isDesc.value ? -1 : 1); }) .filter(([, value]) => { // 半角から全角に変換 @@ -393,6 +424,12 @@ const sortTypes = [ ]; const sortType = ref(sortTypes[0]); +// 降順か? +const isDesc = ref(false); + +// 優先度表示はするか? +const isPriorityVisible = ref(false); + const createUILockAction = function (action: Promise) { uiLocked.value = true; return action.finally(() => { From f1d2a2fdbb67a32f76449d0c8795abdc718d71ac Mon Sep 17 00:00:00 2001 From: kebin Date: Mon, 9 Dec 2024 16:09:55 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=E9=AB=98=E3=81=95=E8=AA=BF=E6=95=B4?= =?UTF-8?q?=E3=80=81=E6=A7=8B=E6=96=87=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E5=9B=9E=E9=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dialog/DictionaryManageDialog.vue | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/components/Dialog/DictionaryManageDialog.vue b/src/components/Dialog/DictionaryManageDialog.vue index b603c0e5f4..379115d8a4 100644 --- a/src/components/Dialog/DictionaryManageDialog.vue +++ b/src/components/Dialog/DictionaryManageDialog.vue @@ -70,7 +70,7 @@ - 優先度をリストに表示する @@ -85,15 +85,15 @@ >