From d7b81739e7868f8c73db7e892879ca244b512f68 Mon Sep 17 00:00:00 2001 From: csantosm <4a.santos@gmail.com> Date: Wed, 6 Apr 2022 12:00:42 +0200 Subject: [PATCH] openvidu-components: Allowed external panels - Allowed injecting external panels and exported the panel service for toggling panels and subscribe to the panel status - Renamed menu to panel - Updated docs --- .../panel/chat-panel/chat-panel.component.ts | 10 +- .../lib/components/panel/panel.component.html | 5 + .../lib/components/panel/panel.component.ts | 35 +++++-- .../participants-panel.component.html | 5 +- .../participants-panel.component.ts | 22 ++++- .../components/session/session.component.css | 4 + .../components/session/session.component.ts | 15 +-- .../components/toolbar/toolbar.component.html | 8 +- .../components/toolbar/toolbar.component.ts | 38 ++++++-- .../videoconference.component.html | 8 ++ .../videoconference.component.ts | 53 ++++++++--- .../openvidu-angular.directive.module.ts | 8 +- .../template/openvidu-angular.directive.ts | 24 +++++ .../models/{menu.model.ts => panel.model.ts} | 5 +- .../src/lib/services/chat/chat.service.ts | 4 +- .../src/lib/services/panel/panel.service.ts | 93 ++++++++++--------- 16 files changed, 236 insertions(+), 101 deletions(-) rename openvidu-components-angular/projects/openvidu-angular/src/lib/models/{menu.model.ts => panel.model.ts} (51%) diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/chat-panel/chat-panel.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/chat-panel/chat-panel.component.ts index be67b1c2..60bdbc88 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/chat-panel/chat-panel.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/chat-panel/chat-panel.component.ts @@ -10,7 +10,7 @@ import { } from '@angular/core'; import { Subscription } from 'rxjs'; import { ChatMessage } from '../../../models/chat.model'; -import { MenuType } from '../../../models/menu.model'; +import { PanelType } from '../../../models/panel.model'; import { ChatService } from '../../../services/chat/chat.service'; import { PanelService } from '../../../services/panel/panel.service'; @@ -65,14 +65,14 @@ export class ChatPanelComponent implements OnInit, AfterViewInit { /** * @ignore */ - constructor(private chatService: ChatService, private PanelService: PanelService, private cd: ChangeDetectorRef) {} + constructor(private chatService: ChatService, private panelService: PanelService, private cd: ChangeDetectorRef) {} /** * @ignore */ @HostListener('document:keydown.escape', ['$event']) onKeydownHandler(event: KeyboardEvent) { - if (this.PanelService.isPanelOpened()) { + if (this.panelService.isPanelOpened()) { this.close(); } } @@ -119,13 +119,13 @@ export class ChatPanelComponent implements OnInit, AfterViewInit { } close() { - this.PanelService.togglePanel(MenuType.CHAT); + this.panelService.togglePanel(PanelType.CHAT); } private subscribeToMessages() { this.chatMessageSubscription = this.chatService.messagesObs.subscribe((messages: ChatMessage[]) => { this.messageList = messages; - if (this.PanelService.isPanelOpened()) { + if (this.panelService.isPanelOpened()) { this.scrollToBottom(); this.cd.markForCheck(); } diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.html b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.html index 74eb725a..0a897199 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.html +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.html @@ -9,4 +9,9 @@ + + + + + diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.ts index 7032b348..3097a100 100644 --- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.ts +++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/panel/panel.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, OnInit, TemplateRef } from '@angular/core'; import { skip, Subscription } from 'rxjs'; -import { ChatPanelDirective, ParticipantsPanelDirective } from '../../directives/template/openvidu-angular.directive'; -import { MenuType } from '../../models/menu.model'; +import { ChatPanelDirective, AdditionalPanelsDirective, ParticipantsPanelDirective } from '../../directives/template/openvidu-angular.directive'; +import { PanelType } from '../../models/panel.model'; import { PanelService } from '../../services/panel/panel.service'; /** @@ -32,6 +32,7 @@ import { PanelService } from '../../services/panel/panel.service'; * |:----------------------------------:|:---------------------------------------------:| * | ***ovChatPanel** | {@link ChatPanelDirective} | * | ***ovParticipantsPanel** | {@link ParticipantsPanelDirective} | + * | ***ovAdditionalPanels** | {@link AdditionalPanelsDirective} | * *