From 19dea1bca84859822d86492bf608db646d8f2f71 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Tue, 15 Oct 2019 11:07:26 +0900 Subject: [PATCH] contextMenu of profile is added --- .../left-sidenav/group.component.html | 21 ++++++++++- .../left-sidenav/group.component.ts | 37 ++++++++++++++++++- .../components/user-list-item.component.html | 25 ++++++++++--- .../components/user-list-item.component.ts | 22 ++++++++++- 4 files changed, 95 insertions(+), 10 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html index 5f643955..4ad695c3 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html @@ -12,7 +12,12 @@ > more_vert - + + + + diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts index dd139950..48a4da3c 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts @@ -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 { map, tap } from 'rxjs/operators'; @@ -22,7 +28,13 @@ import { CreateGroupDialogResult } from '@app/layouts/messenger/dialogs/create-group.dialog.component'; 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({ selector: 'app-layout-chat-left-sidenav-group', @@ -34,6 +46,13 @@ export class GroupComponent implements OnInit { @ViewChild('groupExpansionPanel', { static: true }) groupExpansionPanel: GroupExpansionPanelComponent; + @ViewChildren(MatMenuTrigger) menuTriggerList: QueryList; + + @ViewChild('profileContextMenu', { static: true }) + profileContextMenu: MatMenu; + + profileContextMenuPosition = { x: '0px', y: '0px' }; + groupBuddyList$: Observable< { 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(); + } } diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html index 313bc078..ebf9b3ba 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html +++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html @@ -1,13 +1,23 @@ -
+
- {{ userPresence.pcStatus }} + {{ userPresence.pcStatus }}
- +
@@ -19,7 +29,10 @@ {{ userInfo.deptName }}
-
+
{{ userInfo.intro }}
diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.ts b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.ts index 69bc0216..13dbe491 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.ts +++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.ts @@ -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 { UserInfoSS, @@ -35,6 +42,12 @@ export class UserListItemComponent implements OnInit, OnDestroy { @Input() compactable = false; + @Output() + contextMenu = new EventEmitter<{ + event: MouseEvent; + userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; + }>(); + userPresence: StatusBulkInfo | StatusInfo; PresenceType = PresenceType; @@ -95,6 +108,13 @@ export class UserListItemComponent implements OnInit, OnDestroy { return rtnClass; } + + onContextMenu( + event: MouseEvent, + userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN + ) { + this.contextMenu.emit({ event, userInfo }); + } } export enum PresenceType {