import { Component, Inject } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; @Component({ selector: 'app-events-dialog', template: `

{{target}} events

ALL
@for (event of eventArray | slice:0:(eventArray.length/2); track event) {
{{event}}
}
@for (event of eventArray | slice:(eventArray.length/2 + 1):(eventArray.length); track event) {
{{event}}
}
`, styles: [ 'mat-dialog-content { display: inline; }', 'mat-divider { margin-top: 5px; margin-bottom: 5px; }', '.col-50 {flex-basis: 50%; box-sizing: border-box; padding-left: 20px; }', '.toggle { }' ], standalone: false }) export class EventsDialogComponent { target = ''; checkAll = true; eventCollection: Map; eventArray: string[]; constructor(public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any) { this.target = data.target; this.eventCollection = data.eventCollection; this.eventArray = Array.from(this.eventCollection.keys()); } updateAll() { this.eventCollection.forEach((value: boolean, key: string) => { this.eventCollection.set(key, this.checkAll); }); } toggleEvent(event: any) { this.eventCollection.set(event.source.name, event.checked); } }