Skip to content

Commit

Permalink
fix effect searching
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Aug 15, 2024
1 parent 567fd45 commit 261f9d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="relative">
<ng-select class="form-control" [items]="values()" [(ngModel)]="effect" placeholder="Select effect..."
(change)="change.emit($event?.value)">
(change)="change.emit($event?.value)" [compareWith]="itemCompare" [searchFn]="search">

<ng-template ng-option-tmp let-item="item">
<div class="relative">
Expand All @@ -14,4 +14,4 @@
</ng-select>

<app-input-floating-label>{{ label() }}</app-input-floating-label>
</div>
</div>
11 changes: 11 additions & 0 deletions src/app/shared/components/input-effect/input-effect.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,15 @@ export class InputEffectComponent {
constructor() {
this.electronService.requestJSON('effect-data');
}

public itemCompare(
itemA: { value: string; desc: string },
itemB: { value: string; desc: string }
): boolean {
return itemA.value === itemB.value;
}

public search(term: string, item: { value: string }) {
return item.value.toLowerCase().includes(term.toLowerCase());
}
}

0 comments on commit 261f9d4

Please sign in to comment.