[20 전달 탭 사용자 선택 통일성 없음] 이슈처리.

이벤트 꼬이는 문제 수정 및 대화방 리스트 클릭시 체크박스 토글되도록 수정.
This commit is contained in:
leejinho 2019-11-27 14:39:43 +09:00
parent 0bc6968e98
commit 187efa67ab
4 changed files with 21 additions and 14 deletions

View File

@ -82,7 +82,7 @@
[selectedUserList]="selectedUserList" [selectedUserList]="selectedUserList"
[isChecked]="getCheckedUser(userInfo)" [isChecked]="getCheckedUser(userInfo)"
[checkable]="true" [checkable]="true"
[inTree]="true" (checkUser)="onCheckUser($event)"
(click)="onToggleUser(userInfo)" (click)="onToggleUser(userInfo)"
class="list-item-frame" class="list-item-frame"
> >
@ -155,6 +155,7 @@
[isChecked]="getCheckedRoom(room)" [isChecked]="getCheckedRoom(room)"
[multiCheckable]="false" [multiCheckable]="false"
(checkRoom)="onCheckRoom($event)" (checkRoom)="onCheckRoom($event)"
(click)="onToggleRoom(room)"
> >
</ucap-room-list-item> </ucap-room-list-item>
</div> </div>

View File

@ -4,7 +4,8 @@ import {
OnInit, OnInit,
OnDestroy, OnDestroy,
Inject, Inject,
EventEmitter EventEmitter,
ChangeDetectorRef
} from '@angular/core'; } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { import {
@ -103,7 +104,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
private queryProtocolService: QueryProtocolService, private queryProtocolService: QueryProtocolService,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private logger: NGXLogger, private logger: NGXLogger,
private dialogService: DialogService private dialogService: DialogService,
private changeDetectorRef: ChangeDetectorRef
) { ) {
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>( this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
KEY_VER_INFO KEY_VER_INFO
@ -380,6 +382,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
.length === 0 .length === 0
); );
} }
this.changeDetectorRef.detectChanges();
} }
/** 조직도 > 부서원 전체 선택 */ /** 조직도 > 부서원 전체 선택 */
@ -421,7 +424,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
item => item.seq !== params.userInfo.seq item => item.seq !== params.userInfo.seq
); );
} }
console.log(this.selectedUserList); this.changeDetectorRef.detectChanges();
} }
onToggleUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { onToggleUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
if ( if (
@ -436,7 +439,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
} }
} }
/** 대화방 > 대화방 선택 :: 해당 팝업에서는 대화방을 중복 선택하지 않는다 */ /** 대화방 > 대화방 선택 */
onCheckRoom(params: { isChecked: boolean; roomInfo: RoomInfo }) { onCheckRoom(params: { isChecked: boolean; roomInfo: RoomInfo }) {
if (params.isChecked) { if (params.isChecked) {
this.selectedRoom = params.roomInfo; this.selectedRoom = params.roomInfo;
@ -444,6 +447,17 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
this.selectedRoom = null; this.selectedRoom = null;
} }
} }
onToggleRoom(roomInfo: RoomInfo) {
if (!!this.selectedRoom) {
if (this.selectedRoom.roomSeq === roomInfo.roomSeq) {
this.selectedRoom = null;
} else {
this.selectedRoom = roomInfo;
}
} else {
this.selectedRoom = roomInfo;
}
}
/** 그룹>부서원 리스트의 ischecked 를 판단. */ /** 그룹>부서원 리스트의 ischecked 를 판단. */
getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {

View File

@ -37,7 +37,7 @@
#checkbox #checkbox
[checked]="isChecked" [checked]="isChecked"
(change)="onChangeCheck(checkbox.checked, userInfo)" (change)="onChangeCheck(checkbox.checked, userInfo)"
(click)="onClickCheck($event)" (click)="$event.stopPropagation()"
> >
</mat-checkbox> </mat-checkbox>
</div> </div>

View File

@ -43,9 +43,6 @@ export class UserListItemComponent implements OnInit {
@Input() @Input()
/** 선택된 사용자의 리스트 */ /** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Input()
/** event bubbling fixed in custom tree */
inTree = false;
@Output() @Output()
checkUser = new EventEmitter<{ checkUser = new EventEmitter<{
@ -105,11 +102,6 @@ export class UserListItemComponent implements OnInit {
userInfo userInfo
}); });
} }
onClickCheck(event: MouseEvent) {
if (!this.inTree) {
event.stopPropagation();
}
}
onClickOpenProfile( onClickOpenProfile(
event: MouseEvent, event: MouseEvent,