group menu is added

This commit is contained in:
병준 박 2019-10-07 17:02:14 +09:00
parent 33d8e733d1
commit 2ee7dd2526
4 changed files with 76 additions and 3 deletions

View File

@ -5,9 +5,39 @@
[companyCode]="companyCode" [companyCode]="companyCode"
(keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)" (keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)"
></ucap-organization-tenant-search> ></ucap-organization-tenant-search>
<button
mat-icon-button
[matMenuTriggerFor]="groupMenu"
aria-label="group menu"
>
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #groupMenu="matMenu" xPosition="after" yPosition="below">
<button mat-menu-item (click)="onClickGroupMenu('GROUP_NEW')">
<mat-icon>group_add</mat-icon>
<span>새 그룹 추가</span>
</button>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_EXPAND_MORE')">
<mat-icon>expand_more</mat-icon>
<span>그룹 전체 열기</span>
</button>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_EXPAND_LESS')">
<mat-icon>expand_less</mat-icon>
<span>그룹 전체 닫기</span>
</button>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_SAVE')">
<mat-icon>save</mat-icon>
<span>그룹 저장하기</span>
</button>
<button mat-menu-item (click)="onClickGroupMenu('GROUP_RESTORE')">
<mat-icon>restore</mat-icon>
<span>그룹 가져오기</span>
</button>
</mat-menu>
</div> </div>
<div> <div>
<ucap-group-expansion-panel <ucap-group-expansion-panel
#groupExpansionPanel
[groupBuddyList]="groupBuddyList$ | async" [groupBuddyList]="groupBuddyList$ | async"
(selectBuddy)="onSelectBuddy($event)" (selectBuddy)="onSelectBuddy($event)"
> >

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { Observable, combineLatest } from 'rxjs'; import { Observable, combineLatest } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
@ -14,6 +14,7 @@ import { NGXLogger } from 'ngx-logger';
import { Company } from '@ucap-webmessenger/api-external'; import { Company } from '@ucap-webmessenger/api-external';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-group', selector: 'app-layout-chat-left-sidenav-group',
@ -22,6 +23,9 @@ import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
animations: ucapAnimations animations: ucapAnimations
}) })
export class GroupComponent implements OnInit { export class GroupComponent implements OnInit {
@ViewChild('groupExpansionPanel', { static: true })
groupExpansionPanel: GroupExpansionPanelComponent;
groupBuddyList$: Observable< groupBuddyList$: Observable<
{ group: GroupDetailData; buddyList: UserInfo[] }[] { group: GroupDetailData; buddyList: UserInfo[] }[]
>; >;
@ -91,6 +95,27 @@ export class GroupComponent implements OnInit {
); );
} }
onClickGroupMenu(menuType: string) {
this.logger.debug('menuType', menuType);
switch (menuType) {
case 'GROUP_NEW':
break;
case 'GROUP_EXPAND_MORE':
this.groupExpansionPanel.expandMore();
break;
case 'GROUP_EXPAND_LESS':
this.groupExpansionPanel.expandLess();
break;
case 'GROUP_SAVE':
break;
case 'GROUP_RESTORE':
break;
default:
break;
}
}
onSelectBuddy(buddy: UserInfo) { onSelectBuddy(buddy: UserInfo) {
this.store.dispatch(ChatStore.selectedRoom({ roomSeq: buddy.seq })); this.store.dispatch(ChatStore.selectedRoom({ roomSeq: buddy.seq }));
} }

View File

@ -1,4 +1,4 @@
<mat-accordion> <mat-accordion #groupAccordion="matAccordion" [multi]="true">
<mat-expansion-panel *ngFor="let groupBuddy of groupBuddyList"> <mat-expansion-panel *ngFor="let groupBuddy of groupBuddyList">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> {{ groupBuddy.group.name }} </mat-panel-title> <mat-panel-title> {{ groupBuddy.group.name }} </mat-panel-title>

View File

@ -1,8 +1,16 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import {
Component,
OnInit,
Input,
Output,
EventEmitter,
ViewChild
} from '@angular/core';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations } from '@ucap-webmessenger/ui';
import { GroupDetailData, UserInfo } from '@ucap-webmessenger/protocol-sync'; import { GroupDetailData, UserInfo } from '@ucap-webmessenger/protocol-sync';
import { MatAccordion } from '@angular/material';
@Component({ @Component({
selector: 'ucap-group-expansion-panel', selector: 'ucap-group-expansion-panel',
@ -17,6 +25,8 @@ export class ExpansionPanelComponent implements OnInit {
@Output() @Output()
selectBuddy = new EventEmitter<UserInfo>(); selectBuddy = new EventEmitter<UserInfo>();
@ViewChild('groupAccordion', { static: true }) groupAccordion: MatAccordion;
constructor() {} constructor() {}
ngOnInit() {} ngOnInit() {}
@ -24,4 +34,12 @@ export class ExpansionPanelComponent implements OnInit {
onClickBuddy(buddy: UserInfo) { onClickBuddy(buddy: UserInfo) {
this.selectBuddy.emit(buddy); this.selectBuddy.emit(buddy);
} }
expandMore() {
this.groupAccordion.openAll();
}
expandLess() {
this.groupAccordion.closeAll();
}
} }