mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Linked checkboxes to "download selected" button
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Component, AfterViewInit, Input, Output, EventEmitter } from '@angular/core'
|
||||
import { Component, AfterViewInit, Input, Output, EventEmitter, ViewChildren, QueryList } from '@angular/core'
|
||||
import { SongResult } from '../../../../electron/shared/interfaces/search.interface'
|
||||
import { ResultTableRowComponent } from './result-table-row/result-table-row.component'
|
||||
|
||||
@Component({
|
||||
selector: 'app-result-table',
|
||||
@@ -10,6 +11,10 @@ export class ResultTableComponent implements AfterViewInit {
|
||||
@Input() results: SongResult[]
|
||||
|
||||
@Output() rowClicked = new EventEmitter<SongResult>()
|
||||
@Output() songChecked = new EventEmitter<SongResult>()
|
||||
@Output() songUnchecked = new EventEmitter<SongResult>()
|
||||
|
||||
@ViewChildren('tableRow') tableRows: QueryList<ResultTableRowComponent>
|
||||
|
||||
constructor() { }
|
||||
|
||||
@@ -20,4 +25,16 @@ export class ResultTableComponent implements AfterViewInit {
|
||||
onRowClicked(result: SongResult) {
|
||||
this.rowClicked.emit(result)
|
||||
}
|
||||
|
||||
onSongChecked(result: SongResult) {
|
||||
this.songChecked.emit(result)
|
||||
}
|
||||
|
||||
onSongUnchecked(result: SongResult) {
|
||||
this.songUnchecked.emit(result)
|
||||
}
|
||||
|
||||
checkAll(isChecked: boolean) {
|
||||
this.tableRows.forEach(row => row.check(isChecked))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user