유저선택 팝업에 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
*cdkVirtualFor="let userInfo of selectedDepartmentUserInfoList"
[userInfo]="userInfo"
[checkable]="true"
[sessionVerinfo]="sessionVerinfo"
[selectedUserList]="selectedUserList"
[checkable]="true"
[checkDisabled]="!getCheckableUser(userInfo)"
[isChecked]="getCheckedUser(userInfo)"
(checkUser)="onCheckUser($event)"
(openProfile)="onClickOpenProfile($event)"

View File

@ -6,8 +6,6 @@ import {
EventEmitter,
Input,
ViewChild,
AfterViewInit,
AfterContentChecked,
AfterViewChecked
} from '@angular/core';
import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui';
@ -65,6 +63,9 @@ export class OrganizationComponent
/** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Input()
/** 선택할 수 없는 사용자 리스트 */
ignoreUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Input()
isVisible = true;
@Output()
@ -339,6 +340,17 @@ export class OrganizationComponent
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 를 관장하며 리스트의 전체선택 여부를 판단한다. */
getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
if (!!this.selectedUserList && this.selectedUserList.length > 0) {

View File

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

View File

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

View File

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

View File

@ -135,10 +135,12 @@ export class ExpansionPanelComponent
@Input()
checkable = false;
@Input()
/** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Input()
/** 선택할 수 없는 사용자 리스트 */
ignoreUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Output()
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 를 관장하며, 하위 부서원들의 전체선택여부를 판단한다. */
getCheckedGroup(group: GroupDetailData) {
if (!group || group === undefined) {

View File

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

View File

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