This commit is contained in:
richard-loafle 2020-02-10 15:21:28 +09:00
commit c022c82ac4
3 changed files with 29 additions and 3 deletions

View File

@ -156,6 +156,7 @@
</div>
<div *ngIf="isShowSearchArea" class="chat-search">
<ucap-chat-search
#chatSearch
[totalCount]="searchTotalCount"
[curIndex]="searchCurrentIndex"
(searchText)="onSearchChat($event)"
@ -181,7 +182,9 @@
(fileDragLeave)="onFileDragLeave()"
>
<!-- CHAT MESSAGES -->
<button mat-stroked-button class=" icon-button text-accent-darkest"><i class="mid mdi-arrow-collapse-down"></i></button>
<button mat-stroked-button class=" icon-button text-accent-darkest">
<i class="mid mdi-arrow-collapse-down"></i>
</button>
<ucap-chat-messages
#chatMessages

View File

@ -72,7 +72,8 @@ import {
import { take, map, catchError } from 'rxjs/operators';
import {
FormComponent as UCapUiChatFormComponent,
MessagesComponent as UCapUiChatMessagesComponent
MessagesComponent as UCapUiChatMessagesComponent,
SearchComponent
} from '@ucap-webmessenger/ui-chat';
import { KEY_VER_INFO } from '@app/types';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
@ -145,6 +146,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
@Output()
closeRightDrawer = new EventEmitter();
@ViewChild('chatSearch', { static: false })
private chatSearch: SearchComponent;
@ViewChild('chatForm', { static: false })
private chatForm: UCapUiChatFormComponent;
@ -1704,6 +1708,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
}
onSelectedSticker(stickerInfo: StickerFilesInfo) {
this.selectedSticker = stickerInfo;
if (!!this.chatForm) {
this.chatForm.replyInput.nativeElement.focus();
}
}
setStickerHistory(sticker: StickerFilesInfo) {
const history = this.localStorageService.get<string[]>(KEY_STICKER_HISTORY);
@ -1737,6 +1744,12 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.searchedListSubject.next([]);
this.searchedFocusEvent = null;
this.searchText = '';
} else {
setTimeout(() => {
if (!!this.chatSearch) {
this.chatSearch.inputSearch.nativeElement.focus();
}
}, 500);
}
}
onCloseSearchArea() {

View File

@ -1,4 +1,12 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import {
Component,
OnInit,
Input,
Output,
EventEmitter,
ElementRef,
ViewChild
} from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
import { NGXLogger } from 'ngx-logger';
@ -24,6 +32,8 @@ export class SearchComponent implements OnInit {
@Output()
closeSearchArea = new EventEmitter();
@ViewChild('inputSearch', { static: false }) inputSearch: ElementRef;
fgSearch: FormGroup;
isSearch = false;