Download Selected button, Various small improvements

This commit is contained in:
Geomitron
2020-02-11 23:52:22 -05:00
parent db083d573a
commit 7d4d339018
17 changed files with 192 additions and 58 deletions

View File

@@ -1,26 +1,24 @@
import { Component, AfterViewInit, Input, Output, EventEmitter, ViewChildren, QueryList } from '@angular/core'
import { Component, Input, Output, EventEmitter, ViewChildren, QueryList, ViewChild } from '@angular/core'
import { SongResult } from '../../../../electron/shared/interfaces/search.interface'
import { ResultTableRowComponent } from './result-table-row/result-table-row.component'
import { CheckboxDirective } from 'src/app/core/directives/checkbox.directive'
@Component({
selector: 'app-result-table',
templateUrl: './result-table.component.html',
styleUrls: ['./result-table.component.scss']
})
export class ResultTableComponent implements AfterViewInit {
export class ResultTableComponent {
@Input() results: SongResult[]
@Output() rowClicked = new EventEmitter<SongResult>()
@Output() songChecked = new EventEmitter<SongResult>()
@Output() songUnchecked = new EventEmitter<SongResult>()
@ViewChild(CheckboxDirective, { static: true }) checkboxColumn: CheckboxDirective
@ViewChildren('tableRow') tableRows: QueryList<ResultTableRowComponent>
constructor() { }
ngAfterViewInit() {
$('.ui.checkbox').checkbox()
}
onRowClicked(result: SongResult) {
this.rowClicked.emit(result)
@@ -37,4 +35,12 @@ export class ResultTableComponent implements AfterViewInit {
checkAll(isChecked: boolean) {
this.tableRows.forEach(row => row.check(isChecked))
}
onSongsDeselected(songs: SongResult['id'][]) {
this.tableRows.forEach(row => row.check(!songs.includes(row.songID)))
}
onNewSearch() {
this.checkboxColumn.check(false)
}
}