UNPKG

4.71 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 { TemplateRef } from '@angular/core';
7import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
8import { NbBooleanInput } from '../helpers';
9import { NbChatMessageFile } from './chat-message-file.component';
10import { NbChatCustomMessageService } from './chat-custom-message.service';
11import { NbChatCustomMessageDirective } from './chat-custom-message.directive';
12import * as i0 from "@angular/core";
13/**
14 * Chat message component.
15 *
16 * Multiple message types are available through a `type` property, such as
17 * - text - simple text message
18 * - file - could be a file preview or a file icon
19 * if multiple files are provided grouped files are shown
20 * - quote - quotes a message with specific quote styles
21 * - map - shows a google map picture by provided [latitude] and [longitude] properties
22 *
23 * @stacked-example(Available Types, chat/chat-message-types-showcase.component)
24 *
25 * Message with attached files:
26 * ```html
27 * <nb-chat-message
28 * type="file"
29 * [files]="[ { url: '...' } ]"
30 * message="Hello world!">
31 * </nb-chat-message>
32 * ```
33 *
34 * Map message:
35 * ```html
36 * <nb-chat-message
37 * type="map"
38 * [latitude]="53.914"
39 * [longitude]="27.59"
40 * message="Here I am">
41 * </nb-chat-message>
42 * ```
43 *
44 * @styles
45 *
46 * chat-message-background:
47 * chat-message-text-color:
48 * chat-message-reply-background-color:
49 * chat-message-reply-text-color:
50 * chat-message-avatar-background-color:
51 * chat-message-sender-text-color:
52 * chat-message-quote-background-color:
53 * chat-message-quote-text-color:
54 * chat-message-file-text-color:
55 * chat-message-file-background-color:
56 */
57export declare class NbChatMessageComponent {
58 protected domSanitizer: DomSanitizer;
59 protected customMessageService: NbChatCustomMessageService;
60 protected readonly builtInMessageTypes: string[];
61 avatarStyle: SafeStyle;
62 get _addReplyClass(): boolean;
63 get _addNotReplyClass(): boolean;
64 get _addNoSpaceClass(): boolean;
65 get flyInOut(): boolean;
66 get notReply(): boolean;
67 /**
68 * Determines if a message is a reply
69 */
70 get reply(): boolean;
71 set reply(value: boolean);
72 protected _reply: boolean;
73 static ngAcceptInputType_reply: NbBooleanInput;
74 /**
75 * Message sender
76 * @type {string}
77 */
78 message: string;
79 /**
80 * Message sender
81 * @type {string}
82 */
83 sender: string;
84 /**
85 * Message send date
86 * @type {Date}
87 */
88 date: Date;
89 /**
90 * Message send date format, default 'shortTime'
91 * @type {string}
92 */
93 dateFormat: string;
94 /**
95 * Array of files `{ url: 'file url', icon: 'file icon class' }`
96 */
97 files: NbChatMessageFile[];
98 /**
99 * Quoted message text
100 * @type {string}
101 */
102 quote: string;
103 /**
104 * Map latitude
105 * @type {number}
106 */
107 latitude: number;
108 /**
109 * Map longitude
110 * @type {number}
111 */
112 longitude: number;
113 /**
114 * Message send avatar
115 * @type {string}
116 */
117 set avatar(value: string);
118 /**
119 * Message type, available options `text|file|map|quote`
120 * @type {string}
121 */
122 type: string;
123 /**
124 * Data which will be set as custom message template context
125 * @type {any}
126 */
127 customMessageData: any;
128 constructor(domSanitizer: DomSanitizer, customMessageService: NbChatCustomMessageService);
129 getInitials(): string;
130 _isBuiltInMessageType(): boolean;
131 _getTemplate(): TemplateRef<any>;
132 _getTemplateContext(): {
133 $implicit: any;
134 isReply: boolean;
135 };
136 _areDefaultStylesEnabled(): boolean;
137 protected getCustomMessage(type: string): NbChatCustomMessageDirective;
138 static ɵfac: i0.ɵɵFactoryDeclaration<NbChatMessageComponent, never>;
139 static ɵcmp: i0.ɵɵComponentDeclaration<NbChatMessageComponent, "nb-chat-message", never, { "reply": { "alias": "reply"; "required": false; }; "message": { "alias": "message"; "required": false; }; "sender": { "alias": "sender"; "required": false; }; "date": { "alias": "date"; "required": false; }; "dateFormat": { "alias": "dateFormat"; "required": false; }; "files": { "alias": "files"; "required": false; }; "quote": { "alias": "quote"; "required": false; }; "latitude": { "alias": "latitude"; "required": false; }; "longitude": { "alias": "longitude"; "required": false; }; "avatar": { "alias": "avatar"; "required": false; }; "type": { "alias": "type"; "required": false; }; "customMessageData": { "alias": "customMessageData"; "required": false; }; }, {}, never, never, false, never>;
140}