Skip to content

Commit

Permalink
feat: use locale-includes in datatable filtering function #172
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab authored and frodrigo committed Mar 13, 2024
1 parent a4b3186 commit 152c0f9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/PoisList/PoisTable.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { localeIncludes } from 'locale-includes'
import { PropertyTranslationsContextEnum } from '~/plugins/property-translations'
import type { ApiPoi, FieldsListItem } from '~/lib/apiPois'
import type { ApiMenuCategory } from '~/lib/apiMenu'
Expand Down Expand Up @@ -141,7 +142,12 @@ function customSort(a: string, b: string) {
}
function customFilter(value: any, query: string): boolean {
return query !== null && value !== null && typeof value === 'string' && value.toLowerCase().includes(query.toLowerCase())
value = valueToString(value)
if (!value)
return false
return localeIncludes(value, query, { locales: locale.value, sensitivity: 'base' })
}
function getContext(key: string) {
Expand Down

0 comments on commit 152c0f9

Please sign in to comment.