From 2ee7dd2526dd85bb75f61ecb49b933851d51444f Mon Sep 17 00:00:00 2001 From: Richard Park Date: Mon, 7 Oct 2019 17:02:14 +0900 Subject: [PATCH] group menu is added --- .../left-sidenav/group.component.html | 30 +++++++++++++++++++ .../left-sidenav/group.component.ts | 27 ++++++++++++++++- .../components/expansion-panel.component.html | 2 +- .../components/expansion-panel.component.ts | 20 ++++++++++++- 4 files changed, 76 insertions(+), 3 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 cf8249bf..70372913 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 @@ -5,9 +5,39 @@ [companyCode]="companyCode" (keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)" > + + + + + + + +
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 d7edeb03..8d034931 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,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { Observable, combineLatest } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -14,6 +14,7 @@ import { NGXLogger } from 'ngx-logger'; import { Company } from '@ucap-webmessenger/api-external'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; +import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group'; @Component({ selector: 'app-layout-chat-left-sidenav-group', @@ -22,6 +23,9 @@ import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; animations: ucapAnimations }) export class GroupComponent implements OnInit { + @ViewChild('groupExpansionPanel', { static: true }) + groupExpansionPanel: GroupExpansionPanelComponent; + groupBuddyList$: Observable< { 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) { this.store.dispatch(ChatStore.selectedRoom({ roomSeq: buddy.seq })); } diff --git a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html index 72a85441..08c94fba 100644 --- a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html +++ b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html @@ -1,4 +1,4 @@ - + {{ groupBuddy.group.name }} diff --git a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts index cb6f9b2a..d1914eac 100644 --- a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts +++ b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts @@ -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 { GroupDetailData, UserInfo } from '@ucap-webmessenger/protocol-sync'; +import { MatAccordion } from '@angular/material'; @Component({ selector: 'ucap-group-expansion-panel', @@ -17,6 +25,8 @@ export class ExpansionPanelComponent implements OnInit { @Output() selectBuddy = new EventEmitter(); + @ViewChild('groupAccordion', { static: true }) groupAccordion: MatAccordion; + constructor() {} ngOnInit() {} @@ -24,4 +34,12 @@ export class ExpansionPanelComponent implements OnInit { onClickBuddy(buddy: UserInfo) { this.selectBuddy.emit(buddy); } + + expandMore() { + this.groupAccordion.openAll(); + } + + expandLess() { + this.groupAccordion.closeAll(); + } }