From 24ad2b612fa1aa59f3b0c8016bf5841d2b412c61 Mon Sep 17 00:00:00 2001 From: paultirk Date: Fri, 28 Jun 2024 20:27:55 +0000 Subject: [PATCH] ignore umlauts/diacritics during account filtering --- CHANGELOG.md | 4 ++++ src/components/AccountSelect.vue | 16 +++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dc5b7e..f11fc6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - Implement audit logging - Save collapsed state of book navigation items +### Changed + +- Improve account filtering + ## [0.26.6] - 2024-06-10 ### Changed diff --git a/src/components/AccountSelect.vue b/src/components/AccountSelect.vue index 30a9942..cee689a 100644 --- a/src/components/AccountSelect.vue +++ b/src/components/AccountSelect.vue @@ -7,12 +7,11 @@ :disabled="!editable" :append-to-body="true" :filter-by=" - (option, label, search) => { + (option, label, search: string) => { return ( - [label, option.description] - .join(' ') - .toLocaleLowerCase() - .indexOf(search.toLocaleLowerCase()) >= 0 + normalizeSearchString([label, option.description].join(' ')).indexOf( + normalizeSearchString(search) + ) >= 0 ); } " @@ -165,4 +164,11 @@ return a1.type - a2.type; }); }); + + function normalizeSearchString(str: string): string { + return str + .toLocaleLowerCase() + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, ''); + }