contextMenu of profile is added

This commit is contained in:
병준 박 2019-10-15 11:07:26 +09:00
parent 142631428a
commit 19dea1bca8
4 changed files with 95 additions and 10 deletions

View File

@ -12,7 +12,12 @@
> >
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>
<mat-menu #groupMenu="matMenu" xPosition="after" yPosition="below"> <mat-menu
#groupMenu="matMenu"
xPosition="after"
yPosition="below"
[overlapTrigger]="false"
>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_NEW')"> <button mat-menu-item (click)="onClickGroupMenu('GROUP_NEW')">
<mat-icon>group_add</mat-icon> <mat-icon>group_add</mat-icon>
<span>새 그룹 추가</span> <span>새 그룹 추가</span>
@ -46,8 +51,22 @@
[userInfo]="userInfo" [userInfo]="userInfo"
[presence]="getStatusBulkInfo(userInfo) | async" [presence]="getStatusBulkInfo(userInfo) | async"
(click)="onSelectBuddy(userInfo)" (click)="onSelectBuddy(userInfo)"
(contextMenu)="onContextMenuProfile($event)"
> >
</ucap-profile-user-list-item> </ucap-profile-user-list-item>
</ucap-group-expansion-panel> </ucap-group-expansion-panel>
</div> </div>
</div> </div>
<div
style="visibility: hidden; position: fixed"
[style.left]="profileContextMenuPosition.x"
[style.top]="profileContextMenuPosition.y"
[matMenuTriggerFor]="profileContextMenu"
></div>
<mat-menu #profileContextMenu="matMenu" [overlapTrigger]="false">
<ng-template matMenuContent let-item="userInfo">
<button mat-menu-item>Action 1</button>
<button mat-menu-item>Action 2</button>
</ng-template>
</mat-menu>

View File

@ -1,4 +1,10 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import {
Component,
OnInit,
ViewChild,
ViewChildren,
QueryList
} from '@angular/core';
import { Observable, combineLatest, Subscription } from 'rxjs'; import { Observable, combineLatest, Subscription } from 'rxjs';
import { map, tap } from 'rxjs/operators'; import { map, tap } from 'rxjs/operators';
@ -22,7 +28,13 @@ import {
CreateGroupDialogResult CreateGroupDialogResult
} from '@app/layouts/messenger/dialogs/create-group.dialog.component'; } from '@app/layouts/messenger/dialogs/create-group.dialog.component';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { DeptSearchType } from '@ucap-webmessenger/protocol-query'; import {
DeptSearchType,
UserInfoSS,
UserInfoF,
UserInfoDN
} from '@ucap-webmessenger/protocol-query';
import { MatMenuTrigger, MatMenu } from '@angular/material';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-group', selector: 'app-layout-chat-left-sidenav-group',
@ -34,6 +46,13 @@ export class GroupComponent implements OnInit {
@ViewChild('groupExpansionPanel', { static: true }) @ViewChild('groupExpansionPanel', { static: true })
groupExpansionPanel: GroupExpansionPanelComponent; groupExpansionPanel: GroupExpansionPanelComponent;
@ViewChildren(MatMenuTrigger) menuTriggerList: QueryList<MatMenuTrigger>;
@ViewChild('profileContextMenu', { static: true })
profileContextMenu: MatMenu;
profileContextMenuPosition = { x: '0px', y: '0px' };
groupBuddyList$: Observable< groupBuddyList$: Observable<
{ group: GroupDetailData; buddyList: UserInfo[] }[] { group: GroupDetailData; buddyList: UserInfo[] }[]
>; >;
@ -174,4 +193,18 @@ export class GroupComponent implements OnInit {
}) })
); );
} }
onContextMenuProfile(event: {
event: MouseEvent;
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
}) {
this.logger.debug('onContextMenuProfile', event);
event.event.preventDefault();
this.profileContextMenuPosition.x = event.event.clientX + 'px';
this.profileContextMenuPosition.y = event.event.clientY + 'px';
const profileContextMenuTrigger = this.menuTriggerList.toArray()[1];
profileContextMenuTrigger.menu = this.profileContextMenu;
profileContextMenuTrigger.menuData = { userInfo: event.userInfo };
profileContextMenuTrigger.openMenu();
}
} }

View File

@ -1,13 +1,23 @@
<!--체크박스 보여줄때는 <div class="list-item checkbox" matRipple> 클래스에 checkbox만 추가--> <!--체크박스 보여줄때는 <div class="list-item checkbox" matRipple> 클래스에 checkbox만 추가-->
<div class="list-item" matRipple> <div
class="list-item"
matRipple
(contextmenu)="onContextMenu($event, userInfo)"
>
<!--pcOn , pcOut pcOff , pcOther--> <!--pcOn , pcOut pcOff , pcOther-->
<span class="presence" [ngClass]="getPresence(PresenceType.PC)" <span
*ngIf="userPresence && userPresence.pcStatus">{{ userPresence.pcStatus }} class="presence"
[ngClass]="getPresence(PresenceType.PC)"
*ngIf="userPresence && userPresence.pcStatus"
>{{ userPresence.pcStatus }}
</span> </span>
<dl class="item-default"> <dl class="item-default">
<dt> <dt>
<img class="thumbnail" [src]="profileImageRoot + userInfo.profileImageFile" <img
onerror="this.src='assets/images/img_nophoto_50.png'" /> class="thumbnail"
[src]="profileImageRoot + userInfo.profileImageFile"
onerror="this.src='assets/images/img_nophoto_50.png'"
/>
</dt> </dt>
<dd class="info"> <dd class="info">
<div class="detail"> <div class="detail">
@ -19,7 +29,10 @@
{{ userInfo.deptName }} {{ userInfo.deptName }}
</span> </span>
</div> </div>
<div class="msg-status" *ngIf="!checkable && userInfo.intro.trim() && !compactable"> <div
class="msg-status"
*ngIf="!checkable && userInfo.intro.trim() && !compactable"
>
{{ userInfo.intro }} {{ userInfo.intro }}
</div> </div>
</dd> </dd>

View File

@ -1,4 +1,11 @@
import { Component, OnInit, Input, OnDestroy } from '@angular/core'; import {
Component,
OnInit,
Input,
OnDestroy,
Output,
EventEmitter
} from '@angular/core';
import { UserInfo } from '@ucap-webmessenger/protocol-sync'; import { UserInfo } from '@ucap-webmessenger/protocol-sync';
import { import {
UserInfoSS, UserInfoSS,
@ -35,6 +42,12 @@ export class UserListItemComponent implements OnInit, OnDestroy {
@Input() @Input()
compactable = false; compactable = false;
@Output()
contextMenu = new EventEmitter<{
event: MouseEvent;
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
}>();
userPresence: StatusBulkInfo | StatusInfo; userPresence: StatusBulkInfo | StatusInfo;
PresenceType = PresenceType; PresenceType = PresenceType;
@ -95,6 +108,13 @@ export class UserListItemComponent implements OnInit, OnDestroy {
return rtnClass; return rtnClass;
} }
onContextMenu(
event: MouseEvent,
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN
) {
this.contextMenu.emit({ event, userInfo });
}
} }
export enum PresenceType { export enum PresenceType {