Skip to content

Commit

Permalink
[ENH] Implemented custom filtering function (#831)
Browse files Browse the repository at this point in the history
* Removed `FromInt` transformation

* Updated relevant component test

* Made requirement of age annotation more prominent

* Implemented `filterOptions` function

* Implemented `filterOptions` function

* Set view port dimensions for component tests

* Addressed suggested changes

* Fixed a booboo

* This should fix it
  • Loading branch information
rmanaem authored Dec 13, 2024
1 parent b578fd7 commit 37f6c89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions components/annot-categorical.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,25 @@
"updateAnnotationCount"
]),
filterOptions(option, label, search) {
// Match the first character of the label with the first character of the search string
if (!label || search[0].toLowerCase() !== label[0].toLowerCase()) {
return false;
}
let labelIndex = 1;
let labelIndex = 0;
for (let searchIndex = 1; searchIndex < search.length; searchIndex++) {
const searchChar = search[searchIndex].toLowerCase();
let matchFound = false;
while (labelIndex < label.length) {
while (labelIndex < label.length-1) {
labelIndex++;
if (label[labelIndex].toLowerCase() === searchChar) {
matchFound = true;
labelIndex++;
break;
}
labelIndex++;
}
if (!matchFound) {
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions components/category-toolgroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,22 @@
"alterColumnToToolMapping"
]),
filterOptions(option, label, search) {
// Match the first character of the label with the first character of the search string
if (!label || search[0].toLowerCase() !== label[0].toLowerCase()) {
return false;
}
let labelIndex = 1;
let labelIndex = 0;
for (let searchIndex = 1; searchIndex < search.length; searchIndex++) {
const searchChar = search[searchIndex].toLowerCase();
let matchFound = false;
while (labelIndex < label.length) {
while (labelIndex < label.length-1) {
labelIndex++;
if (label[labelIndex].toLowerCase() === searchChar) {
matchFound = true;
labelIndex++;
break;
}
labelIndex++;
}
if (!matchFound) {
Expand Down
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = defineConfig({
component: {
viewportHeight: 1080,
viewportWidth: 1920,

devServer: {

bundler: "webpack",
Expand Down

0 comments on commit 37f6c89

Please sign in to comment.