mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[project-filter] fixed search
This commit is contained in:
1 parent
da63ed5ed2
commit
15711cb790
1 file changed
+10
-1
@@ -70,7 +70,16 @@ export default {
|
||||
projectsOptions() {
|
||||
// Added to "paginate" projects, because v-autocomplete was unable to handle so many projects at once
|
||||
|
||||
const projects = this.projects.filter(project => project.code.includes(this.projectCodeSearch))
|
||||
const pattern = /[^a-zA-Z0-9 ]/g
|
||||
|
||||
const normalizedInput = this.projectCodeSearch
|
||||
? this.projectCodeSearch.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(pattern, '')
|
||||
: ''
|
||||
|
||||
const projects = this.projects.filter(project => {
|
||||
const normalizedProjectCode = project.code.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(pattern, '')
|
||||
return normalizedProjectCode.toLowerCase().includes(normalizedInput.toLowerCase())
|
||||
})
|
||||
return projects?.length ? projects.slice(0, 10) : this.projects.slice(0, 10)
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user