import { Component, OnInit, ChangeDetectionStrategy, Input, OnDestroy, EventEmitter, Output, ChangeDetectorRef } from '@angular/core'; import { RoomInfo, RoomType } from '@ucap/protocol-room'; @Component({ selector: 'ucap-chat-room-list-item-02', templateUrl: './room-list-item-02.component.html', styleUrls: ['./room-list-item-02.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) export class RoomListItem02Component implements OnInit, OnDestroy { @Input() roomInfo: RoomInfo; @Input() profileImageRoot: string; @Input() defaultProfileImage: string; @Input() profileImage: string; @Input() roomName: string; @Input() checkable = false; @Input() checked = false; @Output() toggleItem = new EventEmitter<{ checked: boolean; roomInfo: RoomInfo; }>(); RoomType = RoomType; constructor(private changeDetectorRef: ChangeDetectorRef) {} ngOnInit(): void {} ngOnDestroy(): void {} onToggleItem(value: boolean): void { this.toggleItem.emit({ checked: value, roomInfo: this.roomInfo }); this.changeDetectorRef.detectChanges(); } }