FAB 기능 추가 :: 대 메뉴 선택에 따른 처리.

This commit is contained in:
leejh 2019-11-04 17:52:47 +09:00
parent bceade2261
commit 437209bf7f
6 changed files with 143 additions and 61 deletions

View File

@ -6,14 +6,22 @@
</button> </button>
</div>--> </div>-->
<!-- <div class="logo">로고</div> --> <!-- <div class="logo">로고</div> -->
<mat-tab-group mat-stretch-tabs animationDuration="0ms" class="global-menu"> <mat-tab-group
<mat-tab> mat-stretch-tabs
animationDuration="0ms"
(selectedTabChange)="onSelectedTabChange($event)"
class="global-menu"
>
<mat-tab [aria-label]="MainMenu.Group">
<ng-template mat-tab-label> <ng-template mat-tab-label>
<mat-icon>group</mat-icon> <mat-icon>group</mat-icon>
</ng-template> </ng-template>
<app-layout-chat-left-sidenav-group class="left-group-side"></app-layout-chat-left-sidenav-group> <app-layout-chat-left-sidenav-group
class="left-group-side"
(newGroupAndMember)="onClickNewGroupAndMember($event)"
></app-layout-chat-left-sidenav-group>
</mat-tab> </mat-tab>
<mat-tab> <mat-tab [aria-label]="MainMenu.Chat">
<ng-template mat-tab-label> <ng-template mat-tab-label>
<mat-icon <mat-icon
[matBadgeHidden]="(badgeChatUnReadCount$ | async) <= 0" [matBadgeHidden]="(badgeChatUnReadCount$ | async) <= 0"
@ -26,7 +34,7 @@
</ng-template> </ng-template>
<app-layout-chat-left-sidenav-chat></app-layout-chat-left-sidenav-chat> <app-layout-chat-left-sidenav-chat></app-layout-chat-left-sidenav-chat>
</mat-tab> </mat-tab>
<mat-tab> <mat-tab [aria-label]="MainMenu.Organization">
<ng-template mat-tab-label> <ng-template mat-tab-label>
<mat-icon>device_hub</mat-icon> <mat-icon>device_hub</mat-icon>
</ng-template> </ng-template>
@ -37,7 +45,7 @@
class="organization-side" class="organization-side"
></app-layout-chat-left-sidenav-organization> ></app-layout-chat-left-sidenav-organization>
</mat-tab> </mat-tab>
<mat-tab> <mat-tab [aria-label]="MainMenu.Call">
<ng-template mat-tab-label> <ng-template mat-tab-label>
<mat-icon>phone</mat-icon> <mat-icon>phone</mat-icon>
</ng-template> </ng-template>
@ -45,6 +53,7 @@
</mat-tab> </mat-tab>
</mat-tab-group> </mat-tab-group>
<ucap-ui-float-action-button <ucap-ui-float-action-button
*ngIf="fabButtonShow"
[fabButtons]="fabButtons" [fabButtons]="fabButtons"
(buttonClick)="onClickFab($event)" (buttonClick)="onClickFab($event)"
></ucap-ui-float-action-button> ></ucap-ui-float-action-button>

View File

@ -12,13 +12,22 @@ import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
import * as SyncStore from '@app/store/messenger/sync';
import { UserInfo } from '@ucap-webmessenger/protocol-sync'; import { UserInfo } from '@ucap-webmessenger/protocol-sync';
import { import {
UserInfoSS, UserInfoSS,
UserInfoF, UserInfoF,
UserInfoDN UserInfoDN
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { BuiltinType } from '@angular/compiler'; import { MatTabChangeEvent, MatTabGroup } from '@angular/material';
export enum MainMenu {
Group = 'GROUP',
Chat = 'CAHT',
Organization = 'ORGANIZATION',
Call = 'CALL',
Conversation = 'CONVERSATION'
}
@Component({ @Component({
selector: 'app-layout-messenger-left-side', selector: 'app-layout-messenger-left-side',
@ -33,8 +42,11 @@ export class LeftSideComponent implements OnInit {
selectedUserList: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; selectedUserList: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
/** FAB */ /** FAB */
fabButtonShow = true;
fabButtons: { icon: string; tooltip?: string; divisionType?: string }[]; fabButtons: { icon: string; tooltip?: string; divisionType?: string }[];
MainMenu = MainMenu;
constructor( constructor(
private store: Store<any>, private store: Store<any>,
private dialogService: DialogService, private dialogService: DialogService,
@ -45,18 +57,8 @@ export class LeftSideComponent implements OnInit {
this.badgeChatUnReadCount$ = this.store.pipe( this.badgeChatUnReadCount$ = this.store.pipe(
select(AppStore.MessengerSelector.SyncSelector.selectChatUnreadCount) select(AppStore.MessengerSelector.SyncSelector.selectChatUnreadCount)
); );
this.fabButtons = [
{ this.setFabInitial(MainMenu.Group);
icon: 'timer',
tooltip: 'New Timer Chat',
divisionType: 'NEW_TIMER_CHAT'
},
{
icon: 'chat',
tooltip: 'New Chat',
divisionType: 'NEW_CHAT'
}
];
} }
async onClickNewChat(type: string = 'NORMAL') { async onClickNewChat(type: string = 'NORMAL') {
@ -88,6 +90,89 @@ export class LeftSideComponent implements OnInit {
} }
} }
async onClickNewGroupAndMember() {
const result = await this.dialogService.open<
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.NewGroup,
title: 'New Group'
}
});
if (!!result && !!result.choice && result.choice) {
if (
!!result.selectedUserList &&
result.selectedUserList.length > 0 &&
result.groupName.trim().length > 0
) {
const userSeqs: number[] = [];
result.selectedUserList.map(user => userSeqs.push(user.seq));
this.store.dispatch(
SyncStore.createGroupAndBuddy({
groupName: result.groupName,
trgtUserSeq: userSeqs
})
);
}
}
}
onSelectedTabChange(event: MatTabChangeEvent) {
this.setFabInitial(event.tab.ariaLabel);
}
setFabInitial(type: string) {
switch (type) {
case MainMenu.Group:
{
this.fabButtonShow = true;
this.fabButtons = [
{
icon: 'add',
tooltip: 'New Group Add',
divisionType: 'GROUP_NEW_ADD'
}
];
}
break;
case MainMenu.Chat:
{
this.fabButtonShow = true;
this.fabButtons = [
{
icon: 'timer',
tooltip: 'New Timer Chat',
divisionType: 'CHAT_NEW_TIMER_ADD'
},
{
icon: 'chat',
tooltip: 'New Chat',
divisionType: 'CAHT_NEW_ADD'
}
];
}
break;
// case MainMenu.Organization:
// {
// }
// break;
// case MainMenu.Call:
// {
// }
// break;
default: {
this.fabButtonShow = false;
}
}
}
onCheckAllUser(params: { onCheckAllUser(params: {
isChecked: boolean; isChecked: boolean;
userInfos: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[]; userInfos: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[];
@ -137,12 +222,18 @@ export class LeftSideComponent implements OnInit {
}; };
switch (btn.divisionType) { switch (btn.divisionType) {
case 'NEW_CHAT': case 'GROUP_NEW_ADD':
{
this.onClickNewGroupAndMember();
}
break;
case 'CAHT_NEW_ADD':
{ {
this.onClickNewChat('NORMAL'); this.onClickNewChat('NORMAL');
} }
break; break;
case 'NEW_TIMER_CHAT': case 'CHAT_NEW_TIMER_ADD':
{ {
this.onClickNewChat('TIMER'); this.onClickNewChat('TIMER');
} }

View File

@ -1,7 +1,12 @@
import { StatusProtocolService } from './../../../../../../../ucap-webmessenger-protocol-status/src/lib/services/status-protocol.service';
import { UserSelectDialogType } from './../../../../types/userselect.dialog.type';
import { MatMenuTrigger } from '@angular/material'; import { MatMenuTrigger } from '@angular/material';
import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core'; import {
Component,
OnInit,
ViewChild,
OnDestroy,
EventEmitter,
Output
} from '@angular/core';
import { Observable, combineLatest, Subscription, of } from 'rxjs'; import { Observable, combineLatest, Subscription, of } from 'rxjs';
import { map, tap, catchError, exhaustMap } from 'rxjs/operators'; import { map, tap, catchError, exhaustMap } from 'rxjs/operators';
@ -9,7 +14,6 @@ import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
import * as QueryStore from '@app/store/messenger/query';
import * as SyncStore from '@app/store/messenger/sync'; import * as SyncStore from '@app/store/messenger/sync';
import * as StatusStore from '@app/store/messenger/status'; import * as StatusStore from '@app/store/messenger/status';
@ -17,12 +21,13 @@ 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 { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; import { LoginInfo, KEY_LOGIN_INFO, UserSelectDialogType } from '@app/types';
import { KEY_VER_INFO } from '@app/types/ver-info.type'; import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group'; import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync'; import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
import { StatusProtocolService } from '@ucap-webmessenger/protocol-status';
import { import {
DeptSearchType, DeptSearchType,
UserInfoSS, UserInfoSS,
@ -59,6 +64,9 @@ import {
animations: ucapAnimations animations: ucapAnimations
}) })
export class GroupComponent implements OnInit, OnDestroy { export class GroupComponent implements OnInit, OnDestroy {
@Output()
newGroupAndMember = new EventEmitter();
@ViewChild('groupExpansionPanel', { static: true }) @ViewChild('groupExpansionPanel', { static: true })
groupExpansionPanel: GroupExpansionPanelComponent; groupExpansionPanel: GroupExpansionPanelComponent;
@ -164,35 +172,7 @@ export class GroupComponent implements OnInit, OnDestroy {
switch (menuType) { switch (menuType) {
case 'GROUP_NEW': case 'GROUP_NEW':
{ {
const result = await this.dialogService.open< this.newGroupAndMember.emit();
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.NewGroup,
title: 'New Group'
}
});
if (!!result && !!result.choice && result.choice) {
if (
!!result.selectedUserList &&
result.selectedUserList.length > 0 &&
result.groupName.trim().length > 0
) {
const userSeqs: number[] = [];
result.selectedUserList.map(user => userSeqs.push(user.seq));
this.store.dispatch(
SyncStore.createGroupAndBuddy({
groupName: result.groupName,
trgtUserSeq: userSeqs
})
);
}
}
} }
break; break;
case 'GROUP_EXPAND_MORE': case 'GROUP_EXPAND_MORE':
@ -361,7 +341,6 @@ export class GroupComponent implements OnInit, OnDestroy {
EditGroupDialogData, EditGroupDialogData,
EditGroupDialogResult EditGroupDialogResult
>(EditGroupDialogComponent, { >(EditGroupDialogComponent, {
data: { data: {
title: 'Group Name Edit', title: 'Group Name Edit',
group group

View File

@ -250,7 +250,6 @@ export class OrganizationComponent implements OnInit, OnDestroy {
SelectGroupDialogResult SelectGroupDialogResult
>(SelectGroupDialogComponent, { >(SelectGroupDialogComponent, {
width: '600px', width: '600px',
height: '500px',
data: { data: {
title: 'Group Select' title: 'Group Select'
} }

View File

@ -1,4 +1,4 @@
<div class="list-item"> <div class="list-item" matRipple>
<dl class="item-default"> <dl class="item-default">
<dt> <dt>
<!-- <img class="thumbnail" /> --> <!-- <img class="thumbnail" /> -->
@ -10,7 +10,7 @@
[default]="defaultPath" [default]="defaultPath"
/> />
<span *ngIf="roomInfo.isTimeRoom" class="text-warn-color badge-timer"> <span *ngIf="roomInfo.isTimeRoom" class="text-warn-color badge-timer">
<mat-icon>timer</mat-icon> <mat-icon>timer</mat-icon>
</span> </span>
<!-- <ucap-ui-imaage <!-- <ucap-ui-imaage
[imageClass]="'thumbnail'" [imageClass]="'thumbnail'"
@ -23,7 +23,10 @@
<div class="detail"> <div class="detail">
<div class="room-name"> <div class="room-name">
<div class="name">{{ getRoomName(roomInfo) }}</div> <div class="name">{{ getRoomName(roomInfo) }}</div>
<div class="num text-accent-color" *ngIf="roomInfo.roomType === RoomType.Multi"> <div
class="num text-accent-color"
*ngIf="roomInfo.roomType === RoomType.Multi"
>
{{ roomInfo.joinUserCount }}명 {{ roomInfo.joinUserCount }}명
</div> </div>
<div *ngIf="!checkable && !roomInfo.receiveAlarm"> <div *ngIf="!checkable && !roomInfo.receiveAlarm">

View File

@ -8,7 +8,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input'; import { MatInputModule } from '@angular/material/input';
import { ListItemComponent } from './components/list-item.component'; import { ListItemComponent } from './components/list-item.component';
import { MatBadgeModule, MatCheckboxModule } from '@angular/material'; import { MatBadgeModule, MatCheckboxModule, MatRippleModule } from '@angular/material';
import { UCapUiModule } from '@ucap-webmessenger/ui'; import { UCapUiModule } from '@ucap-webmessenger/ui';
@ -25,6 +25,7 @@ const SERVICES = [];
MatFormFieldModule, MatFormFieldModule,
MatIconModule, MatIconModule,
MatInputModule, MatInputModule,
MatRippleModule,
MatBadgeModule, MatBadgeModule,
MatCheckboxModule, MatCheckboxModule,