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

View File

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