This commit is contained in:
leejh 2019-10-16 10:22:46 +09:00
commit 73eea5e240
2 changed files with 16 additions and 19 deletions

View File

@ -64,6 +64,7 @@
style="visibility: hidden; position: fixed" style="visibility: hidden; position: fixed"
[style.left]="profileContextMenuPosition.x" [style.left]="profileContextMenuPosition.x"
[style.top]="profileContextMenuPosition.y" [style.top]="profileContextMenuPosition.y"
#profileContextMenuTrigger="matMenuTrigger"
[matMenuTriggerFor]="profileContextMenu" [matMenuTriggerFor]="profileContextMenu"
></div> ></div>
<mat-menu #profileContextMenu="matMenu" [overlapTrigger]="false"> <mat-menu #profileContextMenu="matMenu" [overlapTrigger]="false">
@ -120,6 +121,7 @@
style="visibility: hidden; position: fixed" style="visibility: hidden; position: fixed"
[style.left]="groupContextMenuPosition.x" [style.left]="groupContextMenuPosition.x"
[style.top]="groupContextMenuPosition.y" [style.top]="groupContextMenuPosition.y"
#groupContextMenuTrigger="matMenuTrigger"
[matMenuTriggerFor]="groupContextMenu" [matMenuTriggerFor]="groupContextMenu"
></div> ></div>
<mat-menu #groupContextMenu="matMenu" [overlapTrigger]="false"> <mat-menu #groupContextMenu="matMenu" [overlapTrigger]="false">

View File

@ -1,14 +1,7 @@
import { import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core';
Component,
OnInit,
ViewChild,
ViewChildren,
QueryList,
OnDestroy
} from '@angular/core';
import { Observable, combineLatest, Subscription } from 'rxjs'; import { Observable, combineLatest, Subscription } from 'rxjs';
import { map, tap, take } from 'rxjs/operators'; import { map, tap } from 'rxjs/operators';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
@ -35,7 +28,7 @@ import {
UserInfoF, UserInfoF,
UserInfoDN UserInfoDN
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { MatMenuTrigger, MatMenu } from '@angular/material'; import { MatMenuTrigger } from '@angular/material';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { KEY_VER_INFO } from '@app/types/ver-info.type'; import { KEY_VER_INFO } from '@app/types/ver-info.type';
@ -49,7 +42,11 @@ export class GroupComponent implements OnInit, OnDestroy {
@ViewChild('groupExpansionPanel', { static: true }) @ViewChild('groupExpansionPanel', { static: true })
groupExpansionPanel: GroupExpansionPanelComponent; groupExpansionPanel: GroupExpansionPanelComponent;
@ViewChildren(MatMenuTrigger) menuTriggerList: QueryList<MatMenuTrigger>; @ViewChild('profileContextMenuTrigger', { static: true })
profileContextMenuTrigger: MatMenuTrigger;
@ViewChild('groupContextMenuTrigger', { static: true })
groupContextMenuTrigger: MatMenuTrigger;
profileContextMenuPosition = { x: '0px', y: '0px' }; profileContextMenuPosition = { x: '0px', y: '0px' };
groupContextMenuPosition = { x: '0px', y: '0px' }; groupContextMenuPosition = { x: '0px', y: '0px' };
@ -228,10 +225,9 @@ export class GroupComponent implements OnInit, OnDestroy {
this.profileContextMenuPosition.x = event.clientX + 'px'; this.profileContextMenuPosition.x = event.clientX + 'px';
this.profileContextMenuPosition.y = event.clientY + 'px'; this.profileContextMenuPosition.y = event.clientY + 'px';
const contextMenuTrigger = this.menuTriggerList.toArray()[1]; this.profileContextMenuTrigger.menu.focusFirstItem('mouse');
contextMenuTrigger.menu.focusFirstItem('mouse'); this.profileContextMenuTrigger.menuData = { userInfo };
contextMenuTrigger.menuData = { userInfo }; this.profileContextMenuTrigger.openMenu();
contextMenuTrigger.openMenu();
} }
onClickGroupContextMenu(menuType: string, group: GroupDetailData) { onClickGroupContextMenu(menuType: string, group: GroupDetailData) {
@ -250,9 +246,8 @@ export class GroupComponent implements OnInit, OnDestroy {
this.groupContextMenuPosition.x = params.event.clientX + 'px'; this.groupContextMenuPosition.x = params.event.clientX + 'px';
this.groupContextMenuPosition.y = params.event.clientY + 'px'; this.groupContextMenuPosition.y = params.event.clientY + 'px';
const contextMenuTrigger = this.menuTriggerList.toArray()[2]; this.groupContextMenuTrigger.menu.focusFirstItem('mouse');
contextMenuTrigger.menu.focusFirstItem('mouse'); this.groupContextMenuTrigger.menuData = { group: params.group };
contextMenuTrigger.menuData = { group: params.group }; this.groupContextMenuTrigger.openMenu();
contextMenuTrigger.openMenu();
} }
} }