generated from maximegris/angular-electron
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/app/shared/components/input-gameevent/input-gameevent.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="relative"> | ||
<ng-select class="form-control" [items]="values()" [bindValue]="'value'" [(ngModel)]="gameEvent" | ||
placeholder="Select game event..." (change)="change.emit($event?.value)" [searchFn]="search"> | ||
|
||
<ng-template ng-label-tmp let-item="item"> | ||
<div class="text-white"> | ||
{{ item.value }} | ||
</div> | ||
</ng-template> | ||
|
||
<ng-template ng-option-tmp let-item="item"> | ||
<div class="relative"> | ||
<div class="text-white"> | ||
{{ item.value }} | ||
</div> | ||
|
||
<p class="text-white text-sm italic">{{ item.desc }}</p> | ||
</div> | ||
</ng-template> | ||
</ng-select> | ||
|
||
<app-input-floating-label>{{ label() }}</app-input-floating-label> | ||
</div> |
Empty file.
40 changes: 40 additions & 0 deletions
40
src/app/shared/components/input-gameevent/input-gameevent.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
Component, | ||
computed, | ||
inject, | ||
input, | ||
model, | ||
output, | ||
} from '@angular/core'; | ||
import { ModService } from '../../../services/mod.service'; | ||
|
||
@Component({ | ||
selector: 'app-input-gameevent', | ||
templateUrl: './input-gameevent.component.html', | ||
styleUrl: './input-gameevent.component.scss', | ||
}) | ||
export class InputGameeventComponent { | ||
private modService = inject(ModService); | ||
|
||
public gameEvent = model.required<string | undefined>(); | ||
public label = input<string>('In-Game Event'); | ||
public change = output<string>(); | ||
|
||
public values = computed(() => { | ||
const eventObj = this.modService | ||
.mod() | ||
.cores.find((c) => c.name === 'events')?.json as Record<string, any>; | ||
if (!eventObj) return []; | ||
|
||
return Object.keys(eventObj ?? {}) | ||
.sort() | ||
.map((t) => ({ | ||
value: t, | ||
desc: eventObj[t].description ?? 'No description', | ||
})); | ||
}); | ||
|
||
public search(term: string, item: { value: string }) { | ||
return item.value.toLowerCase().includes(term.toLowerCase()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters