UNPKG

3.52 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Akveo. All Rights Reserved.
4 * Licensed under the MIT License. See License.txt in the project root for license information.
5 */
6import { ChangeDetectorRef, EventEmitter } from '@angular/core';
7import { DomSanitizer } from '@angular/platform-browser';
8import { NbComponentOrCustomStatus } from '../component-status';
9import * as i0 from "@angular/core";
10/**
11 * Chat form component.
12 *
13 * Show a message form with a send message button.
14 *
15 * ```ts
16 * <nb-chat-form showButton="true" buttonIcon="nb-send">
17 * </nb-chat-form>
18 * ```
19 *
20 * When `[dropFiles]="true"` handles files drag&drop with a file preview.
21 *
22 * Drag & drop available for files and images:
23 * @stacked-example(Drag & Drop Chat, chat/chat-drop.component)
24 *
25 * New message could be tracked outside by using `(send)` output.
26 *
27 * ```ts
28 * <nb-chat-form (send)="onNewMessage($event)">
29 * </nb-chat-form>
30 *
31 * // ...
32 *
33 * onNewMessage({ message: string, files: any[] }) {
34 * this.service.sendToServer(message, files);
35 * }
36 * ```
37 */
38export declare class NbChatFormComponent {
39 protected cd: ChangeDetectorRef;
40 protected domSanitizer: DomSanitizer;
41 status: NbComponentOrCustomStatus;
42 inputFocus: boolean;
43 inputHover: boolean;
44 droppedFiles: any[];
45 imgDropTypes: string[];
46 /**
47 * Predefined message text
48 * @type {string}
49 */
50 message: string;
51 /**
52 * Message placeholder text
53 * @type {string}
54 */
55 messagePlaceholder: string;
56 /**
57 * Send button title
58 * @type {string}
59 */
60 buttonTitle: string;
61 /**
62 * Send button icon, shown if `buttonTitle` is empty
63 * @type {string}
64 */
65 buttonIcon: string;
66 /**
67 * Show send button
68 * @type {boolean}
69 */
70 showButton: boolean;
71 /**
72 * Show send button
73 * @type {boolean}
74 */
75 dropFiles: boolean;
76 /**
77 * File drop placeholder text
78 * @type {string}
79 */
80 dropFilePlaceholder: string;
81 /**
82 *
83 * @type {EventEmitter<{ message: string, files: File[] }>}
84 */
85 send: EventEmitter<{
86 message: string;
87 files: File[];
88 }>;
89 /**
90 * Emits when message input value has been changed
91 * @type {EventEmitter<string>}
92 */
93 onInputChange: EventEmitter<string>;
94 fileOver: boolean;
95 constructor(cd: ChangeDetectorRef, domSanitizer: DomSanitizer);
96 onDrop(event: any): void;
97 removeFile(file: any): void;
98 onDragOver(event: DragEvent): void;
99 onDragLeave(event: DragEvent): void;
100 sendMessage(): void;
101 setStatus(status: NbComponentOrCustomStatus): void;
102 getInputStatus(): NbComponentOrCustomStatus;
103 getButtonStatus(): NbComponentOrCustomStatus;
104 protected getHighlightStatus(): NbComponentOrCustomStatus;
105 onModelChange(value: string): void;
106 static ɵfac: i0.ɵɵFactoryDeclaration<NbChatFormComponent, never>;
107 static ɵcmp: i0.ɵɵComponentDeclaration<NbChatFormComponent, "nb-chat-form", never, { "message": { "alias": "message"; "required": false; }; "messagePlaceholder": { "alias": "messagePlaceholder"; "required": false; }; "buttonTitle": { "alias": "buttonTitle"; "required": false; }; "buttonIcon": { "alias": "buttonIcon"; "required": false; }; "showButton": { "alias": "showButton"; "required": false; }; "dropFiles": { "alias": "dropFiles"; "required": false; }; "dropFilePlaceholder": { "alias": "dropFilePlaceholder"; "required": false; }; }, { "send": "send"; "onInputChange": "onInputChange"; }, never, never, false, never>;
108}