유저선택 팝업에 ignoreUserList 정책 적용.

:: 대화상대추가 시 제거할 수 없는 기존 인원이 존재하여, 이를 checkable && disabled 처리 하도록 수정.
This commit is contained in:
leejinho 2019-12-05 14:37:09 +09:00
parent b3ab8fa9b2
commit ae0a5776a1
8 changed files with 168 additions and 28 deletions

View File

@ -59,9 +59,10 @@
<ucap-profile-user-list-item <ucap-profile-user-list-item
*cdkVirtualFor="let userInfo of selectedDepartmentUserInfoList" *cdkVirtualFor="let userInfo of selectedDepartmentUserInfoList"
[userInfo]="userInfo" [userInfo]="userInfo"
[checkable]="true"
[sessionVerinfo]="sessionVerinfo" [sessionVerinfo]="sessionVerinfo"
[selectedUserList]="selectedUserList" [selectedUserList]="selectedUserList"
[checkable]="true"
[checkDisabled]="!getCheckableUser(userInfo)"
[isChecked]="getCheckedUser(userInfo)" [isChecked]="getCheckedUser(userInfo)"
(checkUser)="onCheckUser($event)" (checkUser)="onCheckUser($event)"
(openProfile)="onClickOpenProfile($event)" (openProfile)="onClickOpenProfile($event)"

View File

@ -6,8 +6,6 @@ import {
EventEmitter, EventEmitter,
Input, Input,
ViewChild, ViewChild,
AfterViewInit,
AfterContentChecked,
AfterViewChecked AfterViewChecked
} from '@angular/core'; } from '@angular/core';
import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui'; import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui';
@ -65,6 +63,9 @@ export class OrganizationComponent
/** 선택된 사용자의 리스트 */ /** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Input() @Input()
/** 선택할 수 없는 사용자 리스트 */
ignoreUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Input()
isVisible = true; isVisible = true;
@Output() @Output()
@ -339,6 +340,17 @@ export class OrganizationComponent
return true; return true;
} }
} }
/** ignoreUserList(선택 무시할 인원) 이 있을 경우 판단하여 checkable 판단. */
getCheckableUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
if (
!!this.ignoreUserList &&
this.ignoreUserList.filter(user => user.seq === userInfo.seq).length > 0
) {
return false;
}
return true;
}
/** 리스트 checkable 할 경우 checkbox 의 isChecked 를 관장하며 리스트의 전체선택 여부를 판단한다. */ /** 리스트 checkable 할 경우 checkbox 의 isChecked 를 관장하며 리스트의 전체선택 여부를 판단한다. */
getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
if (!!this.selectedUserList && this.selectedUserList.length > 0) { if (!!this.selectedUserList && this.selectedUserList.length > 0) {

View File

@ -73,6 +73,7 @@
#groupExpansionPanel #groupExpansionPanel
[groupBuddyList]="groupBuddyList$ | async" [groupBuddyList]="groupBuddyList$ | async"
[selectedUserList]="selectedUserList" [selectedUserList]="selectedUserList"
[ignoreUserList]="data.curRoomUser"
[checkable]="true" [checkable]="true"
(checkGroup)="onCheckGroup($event)" (checkGroup)="onCheckGroup($event)"
class="group-expansion" class="group-expansion"
@ -84,6 +85,7 @@
[selectedUserList]="selectedUserList" [selectedUserList]="selectedUserList"
[isChecked]="getCheckedUser(userInfo)" [isChecked]="getCheckedUser(userInfo)"
[checkable]="true" [checkable]="true"
[checkDisabled]="!getCheckableUser(userInfo)"
(checkUser)="onCheckUser($event)" (checkUser)="onCheckUser($event)"
(click)="onToggleUser(userInfo)" (click)="onToggleUser(userInfo)"
class="list-item-frame" class="list-item-frame"
@ -117,6 +119,7 @@
[selectedUserList]="selectedUserList" [selectedUserList]="selectedUserList"
[isChecked]="getCheckedUser(userInfo)" [isChecked]="getCheckedUser(userInfo)"
[checkable]="true" [checkable]="true"
[checkDisabled]="!getCheckableUser(userInfo)"
(checkUser)="onCheckUser($event)" (checkUser)="onCheckUser($event)"
(click)="onToggleUser(userInfo)" (click)="onToggleUser(userInfo)"
> >
@ -134,6 +137,7 @@
<app-layout-chat-left-sidenav-organization <app-layout-chat-left-sidenav-organization
[showTitle]="false" [showTitle]="false"
[selectedUserList]="selectedUserList" [selectedUserList]="selectedUserList"
[ignoreUserList]="data.curRoomUser"
[isUserSelect]="true" [isUserSelect]="true"
[isVisible]="currentTabIndex === 1" [isVisible]="currentTabIndex === 1"
(checkAllUser)="onCheckAllUser($event)" (checkAllUser)="onCheckAllUser($event)"

View File

@ -63,7 +63,7 @@ export interface CreateChatDialogData {
group?: GroupDetailData; group?: GroupDetailData;
/** CASE :: EventForward */ /** CASE :: EventForward */
ignoreRoom?: RoomInfo[]; ignoreRoom?: RoomInfo[];
/** CASE :: EditCharMember */ /** CASE :: EditChatMember */
curRoomUser?: ( curRoomUser?: (
| UserInfo | UserInfo
| UserInfoSS | UserInfoSS
@ -367,20 +367,47 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }; groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] };
}) { }) {
if (params.isChecked) { if (params.isChecked) {
params.groupBuddyList.buddyList.forEach(item => { if (this.data.type === UserSelectDialogType.EditChatMember) {
if ( params.groupBuddyList.buddyList.forEach(item => {
this.selectedUserList.filter(user => user.seq === item.seq).length === if (
0 this.selectedUserList.filter(user => user.seq === item.seq)
) { .length === 0 &&
this.selectedUserList = [...this.selectedUserList, item]; this.data.curRoomUser.filter(curUser => curUser.seq === item.seq)
} .length === 0
}); ) {
this.selectedUserList = [...this.selectedUserList, item];
}
});
} else {
params.groupBuddyList.buddyList.forEach(item => {
if (
this.selectedUserList.filter(user => user.seq === item.seq)
.length === 0
) {
this.selectedUserList = [...this.selectedUserList, item];
}
});
}
} else { } else {
this.selectedUserList = this.selectedUserList.filter( if (this.data.type === UserSelectDialogType.EditChatMember) {
item => this.selectedUserList = this.selectedUserList.filter(
params.groupBuddyList.buddyList.filter(del => del.seq === item.seq) item =>
.length === 0 params.groupBuddyList.buddyList
); .filter(
del =>
this.data.curRoomUser.filter(
curUser => curUser.seq === del.seq
).length === 0
)
.filter(del => del.seq === item.seq).length === 0
);
} else {
this.selectedUserList = this.selectedUserList.filter(
item =>
params.groupBuddyList.buddyList.filter(del => del.seq === item.seq)
.length === 0
);
}
} }
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
} }
@ -390,20 +417,51 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
isChecked: boolean; isChecked: boolean;
userInfos: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[]; userInfos: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[];
}) { }) {
params.userInfos.forEach(userInfo => { // params.userInfos.forEach(userInfo => {
if (params.isChecked) { if (params.isChecked) {
if ( if (this.data.type === UserSelectDialogType.EditChatMember) {
this.selectedUserList.filter(user => user.seq === userInfo.seq) params.userInfos.forEach(item => {
.length === 0 if (
) { this.selectedUserList.filter(user => user.seq === item.seq)
this.selectedUserList = [...this.selectedUserList, userInfo]; .length === 0 &&
} this.data.curRoomUser.filter(curUser => curUser.seq === item.seq)
.length === 0
) {
this.selectedUserList = [...this.selectedUserList, item];
}
});
} else {
params.userInfos.forEach(item => {
if (
this.selectedUserList.filter(user => user.seq === item.seq)
.length === 0
) {
this.selectedUserList = [...this.selectedUserList, item];
}
});
}
} else {
if (this.data.type === UserSelectDialogType.EditChatMember) {
this.selectedUserList = this.selectedUserList.filter(
item =>
params.userInfos
.filter(
del =>
this.data.curRoomUser.filter(
curUser => curUser.seq === del.seq
).length === 0
)
.filter(del => del.seq === item.seq).length === 0
);
} else { } else {
this.selectedUserList = this.selectedUserList.filter( this.selectedUserList = this.selectedUserList.filter(
user => user.seq !== userInfo.seq item =>
params.userInfos.filter(userInfo => userInfo.seq === item.seq)
.length === 0
); );
} }
}); }
// });
} }
/** 동료그룹>부서원, 조직도>부서원 :: 리스트의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */ /** 동료그룹>부서원, 조직도>부서원 :: 리스트의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */
@ -412,6 +470,15 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
}) { }) {
if (params.isChecked) { if (params.isChecked) {
if (this.data.type === UserSelectDialogType.EditChatMember) {
if (
this.data.curRoomUser.filter(user => user.seq === params.userInfo.seq)
.length > 0
) {
return;
}
}
if ( if (
this.selectedUserList.filter(user => user.seq === params.userInfo.seq) this.selectedUserList.filter(user => user.seq === params.userInfo.seq)
.length === 0 && .length === 0 &&
@ -420,6 +487,15 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
this.selectedUserList = [...this.selectedUserList, params.userInfo]; this.selectedUserList = [...this.selectedUserList, params.userInfo];
} }
} else { } else {
if (this.data.type === UserSelectDialogType.EditChatMember) {
if (
this.data.curRoomUser.filter(user => user.seq === params.userInfo.seq)
.length > 0
) {
return;
}
}
this.selectedUserList = this.selectedUserList.filter( this.selectedUserList = this.selectedUserList.filter(
item => item.seq !== params.userInfo.seq item => item.seq !== params.userInfo.seq
); );
@ -427,6 +503,15 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
} }
onToggleUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { onToggleUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
if (this.data.type === UserSelectDialogType.EditChatMember) {
if (
this.data.curRoomUser.filter(user => user.seq === userInfo.seq).length >
0
) {
return;
}
}
if ( if (
this.selectedUserList.filter(user => user.seq === userInfo.seq).length === this.selectedUserList.filter(user => user.seq === userInfo.seq).length ===
0 0
@ -459,6 +544,20 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
} }
} }
/** 그룹>부서원의 체크 가능여부 판단. */
getCheckableUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
if (this.data.type === UserSelectDialogType.EditChatMember) {
if (
this.data.curRoomUser.filter(user => user.seq === userInfo.seq).length >
0
) {
return false;
}
}
return true;
}
/** 그룹>부서원 리스트의 ischecked 를 판단. */ /** 그룹>부서원 리스트의 ischecked 를 판단. */
getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
if (!!this.selectedUserList && this.selectedUserList.length > 0) { if (!!this.selectedUserList && this.selectedUserList.length > 0) {

View File

@ -76,6 +76,7 @@
*ngIf="checkable" *ngIf="checkable"
#checkbox #checkbox
[checked]="getCheckedGroup(node.groupDetail)" [checked]="getCheckedGroup(node.groupDetail)"
[disabled]="!getCheckableGroup(node.groupDetail)"
(change)="onChangeCheck(checkbox.checked, node.groupDetail)" (change)="onChangeCheck(checkbox.checked, node.groupDetail)"
(click)="$event.stopPropagation()" (click)="$event.stopPropagation()"
class="group-check" class="group-check"

View File

@ -135,10 +135,12 @@ export class ExpansionPanelComponent
@Input() @Input()
checkable = false; checkable = false;
@Input() @Input()
/** 선택된 사용자의 리스트 */ /** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Input()
/** 선택할 수 없는 사용자 리스트 */
ignoreUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Output() @Output()
more = new EventEmitter<{ more = new EventEmitter<{
@ -270,6 +272,24 @@ export class ExpansionPanelComponent
} }
} }
getCheckableGroup(group: GroupDetailData) {
if (!!this.ignoreUserList && this.ignoreUserList.length > 0) {
let allExist = true;
group.userSeqs.some(seq => {
if (this.ignoreUserList.filter(item => item.seq === seq).length === 0) {
allExist = false;
return true;
}
});
if (allExist) {
return false;
}
}
return true;
}
/** 그룹리스트가 checkable 할 경우 checkbox 의 isChecked 를 관장하며, 하위 부서원들의 전체선택여부를 판단한다. */ /** 그룹리스트가 checkable 할 경우 checkbox 의 isChecked 를 관장하며, 하위 부서원들의 전체선택여부를 판단한다. */
getCheckedGroup(group: GroupDetailData) { getCheckedGroup(group: GroupDetailData) {
if (!group || group === undefined) { if (!group || group === undefined) {

View File

@ -36,6 +36,7 @@
*ngIf="checkable" *ngIf="checkable"
#checkbox #checkbox
[checked]="isChecked" [checked]="isChecked"
[disabled]="checkDisabled"
(change)="onChangeCheck(checkbox.checked, userInfo)" (change)="onChangeCheck(checkbox.checked, userInfo)"
(click)="$event.stopPropagation()" (click)="$event.stopPropagation()"
> >

View File

@ -35,6 +35,8 @@ export class UserListItemComponent implements OnInit {
@Input() @Input()
checkable = false; checkable = false;
@Input() @Input()
checkDisabled = false;
@Input()
isChecked = false; isChecked = false;
@Input() @Input()
compactable = false; compactable = false;