@progress/kendo-angular-conversational-ui 5.0.0-next.202204010856 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/action.interface.d.ts +4 -4
- package/bundles/kendo-angular-conversational-ui.umd.js +1 -1
- package/chat/chat.component.d.ts +14 -11
- package/chat/chat.directives.d.ts +1 -0
- package/chat/chat.module.d.ts +14 -12
- package/chat/message-box.component.d.ts +42 -0
- package/chat/message-box.directive.d.ts +17 -0
- package/chat/message-list.component.d.ts +1 -1
- package/common/models/message-box-options.d.ts +8 -0
- package/esm2015/cards/hero-card.component.js +44 -42
- package/esm2015/chat/attachment.component.js +38 -38
- package/esm2015/chat/chat.component.js +106 -86
- package/esm2015/chat/chat.directives.js +1 -0
- package/esm2015/chat/chat.module.js +12 -5
- package/esm2015/chat/l10n/messages.js +1 -0
- package/esm2015/chat/message-attachments.component.js +62 -62
- package/esm2015/chat/message-box.component.js +141 -0
- package/esm2015/chat/message-box.directive.js +24 -0
- package/esm2015/chat/message-list.component.js +132 -132
- package/esm2015/chat/message.component.js +66 -66
- package/esm2015/chat/suggested-actions.component.js +30 -28
- package/esm2015/common/focused-state.directive.js +2 -2
- package/esm2015/common/models/message-box-options.js +5 -0
- package/esm2015/main.js +1 -0
- package/esm2015/package-metadata.js +1 -1
- package/fesm2015/kendo-angular-conversational-ui.js +682 -501
- package/main.d.ts +2 -0
- package/package.json +12 -14
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Component, EventEmitter, HostBinding, Input, Output, ViewChild } from '@angular/core';
|
|
6
|
+
import { SendMessageEvent } from '../api/post-message-event';
|
|
7
|
+
import { Keys } from '@progress/kendo-angular-common';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
import * as i1 from "@angular/common";
|
|
10
|
+
import * as i2 from "../common/focused-state.directive";
|
|
11
|
+
import * as i3 from "@progress/kendo-angular-buttons";
|
|
12
|
+
// tslint:disable-next-line:max-line-length
|
|
13
|
+
const sendIcon = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 16 16"><path d="M0,14.3c-0.1,0.6,0.3,0.8,0.8,0.6l14.8-6.5c0.5-0.2,0.5-0.6,0-0.8L0.8,1.1C0.3,0.9-0.1,1.1,0,1.7l0.7,4.2C0.8,6.5,1.4,7,1.9,7.1l8.8,0.8c0.6,0.1,0.6,0.1,0,0.2L1.9,8.9C1.4,9,0.8,9.5,0.7,10.1L0,14.3z"/></svg>';
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export class MessageBoxComponent {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.hostClasses = 'k-message-box k-input k-input-md k-rounded-md k-input-solid';
|
|
20
|
+
this.sendMessage = new EventEmitter();
|
|
21
|
+
}
|
|
22
|
+
get messageBoxValue() {
|
|
23
|
+
return this.type === 'textarea';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
sendClick() {
|
|
29
|
+
const input = this.messageBoxInput.nativeElement;
|
|
30
|
+
const value = input.value;
|
|
31
|
+
if (!value) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const message = {
|
|
35
|
+
author: this.user,
|
|
36
|
+
text: value,
|
|
37
|
+
timestamp: new Date()
|
|
38
|
+
};
|
|
39
|
+
this.sendMessage.emit(new SendMessageEvent(message));
|
|
40
|
+
input.value = null;
|
|
41
|
+
input.focus();
|
|
42
|
+
this.autoScroll = true;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
47
|
+
inputKeydown(e) {
|
|
48
|
+
if (e.keyCode === Keys.Enter) {
|
|
49
|
+
this.sendClick();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
55
|
+
textAreaKeydown(e) {
|
|
56
|
+
const isEnter = e.keyCode === Keys.Enter;
|
|
57
|
+
if (!isEnter) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const newLine = (e.metaKey || e.ctrlKey);
|
|
61
|
+
const enterOnly = !(e.shiftKey || e.metaKey || e.ctrlKey);
|
|
62
|
+
if (enterOnly) {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
this.sendClick();
|
|
65
|
+
}
|
|
66
|
+
if (newLine) {
|
|
67
|
+
this.messageBoxInput.nativeElement.value += `\r\n`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @hidden
|
|
72
|
+
*/
|
|
73
|
+
textFor(key) {
|
|
74
|
+
return this.localization.get(key);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
MessageBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
78
|
+
MessageBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MessageBoxComponent, selector: "kendo-message-box", inputs: { user: "user", autoScroll: "autoScroll", type: "type", localization: "localization", messageBoxTemplate: "messageBoxTemplate" }, outputs: { sendMessage: "sendMessage" }, host: { properties: { "class": "this.hostClasses", "class.!k-align-items-end": "this.messageBoxValue" } }, viewQueries: [{ propertyName: "messageBoxInput", first: true, predicate: ["messageBoxInput"], descendants: true }], ngImport: i0, template: "\n <ng-container *ngIf=\"!messageBoxTemplate\">\n <input\n *ngIf=\"type === 'textbox'\"\n #messageBoxInput\n kendoChatFocusedState\n type=\"text\"\n class=\"k-textbox k-input k-input-md k-input-solid\"\n [placeholder]=\"textFor('messagePlaceholder')\"\n (keydown)=\"inputKeydown($event)\"\n />\n\n <textarea\n *ngIf=\"type === 'textarea'\"\n #messageBoxInput\n kendoChatFocusedState\n [rows]=\"3\"\n class=\"k-textarea k-input k-input-md k-input-solid !k-overflow-y-auto k-resize-none\"\n [placeholder]=\"textFor('messagePlaceholder')\"\n (keydown)=\"textAreaKeydown($event)\"\n ></textarea>\n\n <button\n kendoButton\n fillMode=\"flat\"\n class=\"k-button-send\"\n [tabindex]=\"0\"\n [attr.title]=\"textFor('send')\"\n (click)=\"sendClick()\"\n >\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"0 0 16 16\"><path d=\"M0,14.3c-0.1,0.6,0.3,0.8,0.8,0.6l14.8-6.5c0.5-0.2,0.5-0.6,0-0.8L0.8,1.1C0.3,0.9-0.1,1.1,0,1.7l0.7,4.2C0.8,6.5,1.4,7,1.9,7.1l8.8,0.8c0.6,0.1,0.6,0.1,0,0.2L1.9,8.9C1.4,9,0.8,9.5,0.7,10.1L0,14.3z\"/></svg>\n </button>\n </ng-container>\n\n <ng-template *ngIf=\"messageBoxTemplate\" [ngTemplateOutlet]=\"messageBoxTemplate?.templateRef\"></ng-template>\n", isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.FocusedStateDirective, selector: "[kendoChatFocusedState]" }, { type: i3.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageBoxComponent, decorators: [{
|
|
80
|
+
type: Component,
|
|
81
|
+
args: [{
|
|
82
|
+
selector: 'kendo-message-box',
|
|
83
|
+
template: `
|
|
84
|
+
<ng-container *ngIf="!messageBoxTemplate">
|
|
85
|
+
<input
|
|
86
|
+
*ngIf="type === 'textbox'"
|
|
87
|
+
#messageBoxInput
|
|
88
|
+
kendoChatFocusedState
|
|
89
|
+
type="text"
|
|
90
|
+
class="k-textbox k-input k-input-md k-input-solid"
|
|
91
|
+
[placeholder]="textFor('messagePlaceholder')"
|
|
92
|
+
(keydown)="inputKeydown($event)"
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<textarea
|
|
96
|
+
*ngIf="type === 'textarea'"
|
|
97
|
+
#messageBoxInput
|
|
98
|
+
kendoChatFocusedState
|
|
99
|
+
[rows]="3"
|
|
100
|
+
class="k-textarea k-input k-input-md k-input-solid !k-overflow-y-auto k-resize-none"
|
|
101
|
+
[placeholder]="textFor('messagePlaceholder')"
|
|
102
|
+
(keydown)="textAreaKeydown($event)"
|
|
103
|
+
></textarea>
|
|
104
|
+
|
|
105
|
+
<button
|
|
106
|
+
kendoButton
|
|
107
|
+
fillMode="flat"
|
|
108
|
+
class="k-button-send"
|
|
109
|
+
[tabindex]="0"
|
|
110
|
+
[attr.title]="textFor('send')"
|
|
111
|
+
(click)="sendClick()"
|
|
112
|
+
>
|
|
113
|
+
${sendIcon}
|
|
114
|
+
</button>
|
|
115
|
+
</ng-container>
|
|
116
|
+
|
|
117
|
+
<ng-template *ngIf="messageBoxTemplate" [ngTemplateOutlet]="messageBoxTemplate?.templateRef"></ng-template>
|
|
118
|
+
`
|
|
119
|
+
}]
|
|
120
|
+
}], propDecorators: { hostClasses: [{
|
|
121
|
+
type: HostBinding,
|
|
122
|
+
args: ['class']
|
|
123
|
+
}], messageBoxValue: [{
|
|
124
|
+
type: HostBinding,
|
|
125
|
+
args: ['class.\!k-align-items-end']
|
|
126
|
+
}], messageBoxInput: [{
|
|
127
|
+
type: ViewChild,
|
|
128
|
+
args: ['messageBoxInput', { static: false }]
|
|
129
|
+
}], user: [{
|
|
130
|
+
type: Input
|
|
131
|
+
}], autoScroll: [{
|
|
132
|
+
type: Input
|
|
133
|
+
}], type: [{
|
|
134
|
+
type: Input
|
|
135
|
+
}], localization: [{
|
|
136
|
+
type: Input
|
|
137
|
+
}], messageBoxTemplate: [{
|
|
138
|
+
type: Input
|
|
139
|
+
}], sendMessage: [{
|
|
140
|
+
type: Output
|
|
141
|
+
}] } });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Directive } from '@angular/core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Creates a message box area that overrides the default message box of the Conversational UI Component.
|
|
9
|
+
* To define a message-box template, nest an `<ng-template>` tag with the `kendoChatMessageBoxTemplate` directive inside the `<kendo-chat>` tag
|
|
10
|
+
* [see example]({% slug message_box %}#toc-message-box-template).
|
|
11
|
+
*/
|
|
12
|
+
export class ChatMessageBoxTemplateDirective {
|
|
13
|
+
constructor(templateRef) {
|
|
14
|
+
this.templateRef = templateRef;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
ChatMessageBoxTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatMessageBoxTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
18
|
+
ChatMessageBoxTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ChatMessageBoxTemplateDirective, selector: "[kendoChatMessageBoxTemplate]", ngImport: i0 });
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatMessageBoxTemplateDirective, decorators: [{
|
|
20
|
+
type: Directive,
|
|
21
|
+
args: [{
|
|
22
|
+
selector: '[kendoChatMessageBoxTemplate]'
|
|
23
|
+
}]
|
|
24
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
@@ -104,151 +104,151 @@ export class MessageListComponent {
|
|
|
104
104
|
}
|
|
105
105
|
MessageListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageListComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }], target: i0.ɵɵFactoryTarget.Component });
|
|
106
106
|
MessageListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MessageListComponent, selector: "kendo-chat-message-list", inputs: { messages: "messages", attachmentTemplate: "attachmentTemplate", messageTemplate: "messageTemplate", user: "user" }, outputs: { executeAction: "executeAction", navigate: "navigate", resize: "resize" }, host: { listeners: { "keydown": "onKeydown($event)", "focusout": "onBlur($event)" }, properties: { "class.k-message-list-content": "this.cssClass" } }, viewQueries: [{ propertyName: "items", predicate: ChatItem, descendants: true }], ngImport: i0, template: `
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
>
|
|
113
|
-
{{ formatTimeStamp(group.timestamp) }}
|
|
114
|
-
</div>
|
|
115
|
-
<div
|
|
116
|
-
*ngSwitchCase="'message-group'"
|
|
117
|
-
class="k-message-group"
|
|
118
|
-
[class.k-alt]="isOwnMessage(group.messages[0])"
|
|
119
|
-
[class.k-no-avatar]="!group.author.avatarUrl"
|
|
120
|
-
>
|
|
121
|
-
<img
|
|
122
|
-
*ngIf="group.author.avatarUrl"
|
|
123
|
-
[attr.src]="group.author.avatarUrl"
|
|
124
|
-
class="k-avatar"
|
|
125
|
-
/>
|
|
126
|
-
<p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
|
|
127
|
-
<ng-container
|
|
128
|
-
*ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
|
|
129
|
-
>
|
|
130
|
-
<img *ngIf="msg.user?.avatarUrl" [src]="msg.user?.avatarUrl" class="k-avatar">
|
|
131
|
-
<kendo-chat-message #message
|
|
132
|
-
[message]="msg"
|
|
133
|
-
[tabbable]="lastGroup && lastMessage"
|
|
134
|
-
[template]="messageTemplate"
|
|
135
|
-
(click)="select(message)"
|
|
136
|
-
(focus)="select(message)"
|
|
137
|
-
[class.k-only]="group.messages.length === 1"
|
|
138
|
-
[class.k-first]="group.messages.length > 1 && firstMessage"
|
|
139
|
-
[class.k-last]="group.messages.length > 1 && lastMessage"
|
|
107
|
+
<ng-container *ngFor="let group of view; last as lastGroup; trackBy: trackGroup">
|
|
108
|
+
<ng-container [ngSwitch]="group.type">
|
|
109
|
+
<div
|
|
110
|
+
*ngSwitchCase="'date-marker'"
|
|
111
|
+
class="k-timestamp"
|
|
140
112
|
>
|
|
141
|
-
|
|
113
|
+
{{ formatTimeStamp(group.timestamp) }}
|
|
114
|
+
</div>
|
|
115
|
+
<div
|
|
116
|
+
*ngSwitchCase="'message-group'"
|
|
117
|
+
class="k-message-group"
|
|
118
|
+
[class.k-alt]="isOwnMessage(group.messages[0])"
|
|
119
|
+
[class.k-no-avatar]="!group.author.avatarUrl"
|
|
120
|
+
>
|
|
121
|
+
<img
|
|
122
|
+
*ngIf="group.author.avatarUrl"
|
|
123
|
+
[attr.src]="group.author.avatarUrl"
|
|
124
|
+
class="k-avatar"
|
|
125
|
+
/>
|
|
126
|
+
<p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
|
|
127
|
+
<ng-container
|
|
128
|
+
*ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
|
|
129
|
+
>
|
|
130
|
+
<img *ngIf="msg.user?.avatarUrl" [src]="msg.user?.avatarUrl" class="k-avatar">
|
|
131
|
+
<kendo-chat-message #message
|
|
132
|
+
[message]="msg"
|
|
133
|
+
[tabbable]="lastGroup && lastMessage"
|
|
134
|
+
[template]="messageTemplate"
|
|
135
|
+
(click)="select(message)"
|
|
136
|
+
(focus)="select(message)"
|
|
137
|
+
[class.k-only]="group.messages.length === 1"
|
|
138
|
+
[class.k-first]="group.messages.length > 1 && firstMessage"
|
|
139
|
+
[class.k-last]="group.messages.length > 1 && lastMessage"
|
|
140
|
+
>
|
|
141
|
+
</kendo-chat-message>
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
<kendo-chat-attachment
|
|
144
|
+
*ngIf="msg.attachments && msg.attachments.length === 1"
|
|
145
|
+
[attachment]="msg.attachments[0]"
|
|
146
|
+
[template]="attachmentTemplate"
|
|
147
|
+
>
|
|
148
|
+
</kendo-chat-attachment>
|
|
149
|
+
</ng-container>
|
|
150
|
+
</div>
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
152
|
+
<kendo-chat-message-attachments #attachments
|
|
153
|
+
*ngSwitchCase="'attachment-group'"
|
|
154
|
+
[attachments]="group.attachments"
|
|
155
|
+
[layout]="group.attachmentLayout"
|
|
156
|
+
[tabbable]="lastGroup"
|
|
157
|
+
[template]="attachmentTemplate"
|
|
158
|
+
(click)="select(attachments)"
|
|
159
|
+
(focus)="select(attachments)"
|
|
160
|
+
>
|
|
161
|
+
</kendo-chat-message-attachments>
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
163
|
+
<kendo-chat-suggested-actions #actions
|
|
164
|
+
*ngSwitchCase="'action-group'"
|
|
165
|
+
[actions]="group.actions"
|
|
166
|
+
[tabbable]="lastGroup"
|
|
167
|
+
(dispatch)="dispatchAction($event, last(group.messages))"
|
|
168
|
+
(click)="select(actions)"
|
|
169
|
+
(focus)="select(actions)"
|
|
170
|
+
>
|
|
171
|
+
</kendo-chat-suggested-actions>
|
|
172
|
+
</ng-container>
|
|
173
|
+
</ng-container>
|
|
174
|
+
<kendo-resize-sensor (resize)="onResize()">
|
|
175
|
+
</kendo-resize-sensor>
|
|
176
|
+
`, isInline: true, components: [{ type: i2.MessageComponent, selector: "kendo-chat-message", inputs: ["message", "tabbable", "template"] }, { type: i3.AttachmentComponent, selector: "kendo-chat-attachment", inputs: ["attachment", "template"] }, { type: i4.MessageAttachmentsComponent, selector: "kendo-chat-message-attachments", inputs: ["attachments", "layout", "tabbable", "template"] }, { type: i5.SuggestedActionsComponent, selector: "kendo-chat-suggested-actions", inputs: ["actions", "tabbable"], outputs: ["dispatch"] }, { type: i6.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], directives: [{ type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
177
177
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageListComponent, decorators: [{
|
|
178
178
|
type: Component,
|
|
179
179
|
args: [{
|
|
180
180
|
selector: 'kendo-chat-message-list',
|
|
181
181
|
template: `
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
>
|
|
188
|
-
{{ formatTimeStamp(group.timestamp) }}
|
|
189
|
-
</div>
|
|
190
|
-
<div
|
|
191
|
-
*ngSwitchCase="'message-group'"
|
|
192
|
-
class="k-message-group"
|
|
193
|
-
[class.k-alt]="isOwnMessage(group.messages[0])"
|
|
194
|
-
[class.k-no-avatar]="!group.author.avatarUrl"
|
|
195
|
-
>
|
|
196
|
-
<img
|
|
197
|
-
*ngIf="group.author.avatarUrl"
|
|
198
|
-
[attr.src]="group.author.avatarUrl"
|
|
199
|
-
class="k-avatar"
|
|
200
|
-
/>
|
|
201
|
-
<p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
|
|
202
|
-
<ng-container
|
|
203
|
-
*ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
|
|
204
|
-
>
|
|
205
|
-
<img *ngIf="msg.user?.avatarUrl" [src]="msg.user?.avatarUrl" class="k-avatar">
|
|
206
|
-
<kendo-chat-message #message
|
|
207
|
-
[message]="msg"
|
|
208
|
-
[tabbable]="lastGroup && lastMessage"
|
|
209
|
-
[template]="messageTemplate"
|
|
210
|
-
(click)="select(message)"
|
|
211
|
-
(focus)="select(message)"
|
|
212
|
-
[class.k-only]="group.messages.length === 1"
|
|
213
|
-
[class.k-first]="group.messages.length > 1 && firstMessage"
|
|
214
|
-
[class.k-last]="group.messages.length > 1 && lastMessage"
|
|
182
|
+
<ng-container *ngFor="let group of view; last as lastGroup; trackBy: trackGroup">
|
|
183
|
+
<ng-container [ngSwitch]="group.type">
|
|
184
|
+
<div
|
|
185
|
+
*ngSwitchCase="'date-marker'"
|
|
186
|
+
class="k-timestamp"
|
|
215
187
|
>
|
|
216
|
-
|
|
188
|
+
{{ formatTimeStamp(group.timestamp) }}
|
|
189
|
+
</div>
|
|
190
|
+
<div
|
|
191
|
+
*ngSwitchCase="'message-group'"
|
|
192
|
+
class="k-message-group"
|
|
193
|
+
[class.k-alt]="isOwnMessage(group.messages[0])"
|
|
194
|
+
[class.k-no-avatar]="!group.author.avatarUrl"
|
|
195
|
+
>
|
|
196
|
+
<img
|
|
197
|
+
*ngIf="group.author.avatarUrl"
|
|
198
|
+
[attr.src]="group.author.avatarUrl"
|
|
199
|
+
class="k-avatar"
|
|
200
|
+
/>
|
|
201
|
+
<p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
|
|
202
|
+
<ng-container
|
|
203
|
+
*ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
|
|
204
|
+
>
|
|
205
|
+
<img *ngIf="msg.user?.avatarUrl" [src]="msg.user?.avatarUrl" class="k-avatar">
|
|
206
|
+
<kendo-chat-message #message
|
|
207
|
+
[message]="msg"
|
|
208
|
+
[tabbable]="lastGroup && lastMessage"
|
|
209
|
+
[template]="messageTemplate"
|
|
210
|
+
(click)="select(message)"
|
|
211
|
+
(focus)="select(message)"
|
|
212
|
+
[class.k-only]="group.messages.length === 1"
|
|
213
|
+
[class.k-first]="group.messages.length > 1 && firstMessage"
|
|
214
|
+
[class.k-last]="group.messages.length > 1 && lastMessage"
|
|
215
|
+
>
|
|
216
|
+
</kendo-chat-message>
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
218
|
+
<kendo-chat-attachment
|
|
219
|
+
*ngIf="msg.attachments && msg.attachments.length === 1"
|
|
220
|
+
[attachment]="msg.attachments[0]"
|
|
221
|
+
[template]="attachmentTemplate"
|
|
222
|
+
>
|
|
223
|
+
</kendo-chat-attachment>
|
|
224
|
+
</ng-container>
|
|
225
|
+
</div>
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
227
|
+
<kendo-chat-message-attachments #attachments
|
|
228
|
+
*ngSwitchCase="'attachment-group'"
|
|
229
|
+
[attachments]="group.attachments"
|
|
230
|
+
[layout]="group.attachmentLayout"
|
|
231
|
+
[tabbable]="lastGroup"
|
|
232
|
+
[template]="attachmentTemplate"
|
|
233
|
+
(click)="select(attachments)"
|
|
234
|
+
(focus)="select(attachments)"
|
|
235
|
+
>
|
|
236
|
+
</kendo-chat-message-attachments>
|
|
237
237
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
238
|
+
<kendo-chat-suggested-actions #actions
|
|
239
|
+
*ngSwitchCase="'action-group'"
|
|
240
|
+
[actions]="group.actions"
|
|
241
|
+
[tabbable]="lastGroup"
|
|
242
|
+
(dispatch)="dispatchAction($event, last(group.messages))"
|
|
243
|
+
(click)="select(actions)"
|
|
244
|
+
(focus)="select(actions)"
|
|
245
|
+
>
|
|
246
|
+
</kendo-chat-suggested-actions>
|
|
247
|
+
</ng-container>
|
|
248
|
+
</ng-container>
|
|
249
|
+
<kendo-resize-sensor (resize)="onResize()">
|
|
250
|
+
</kendo-resize-sensor>
|
|
251
|
+
`
|
|
252
252
|
}]
|
|
253
253
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }]; }, propDecorators: { messages: [{
|
|
254
254
|
type: Input
|
|
@@ -33,44 +33,44 @@ MessageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
|
|
|
33
33
|
provide: ChatItem,
|
|
34
34
|
useExisting: forwardRef(() => MessageComponent)
|
|
35
35
|
}], usesInheritance: true, ngImport: i0, template: `
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>
|
|
41
|
-
{{ formatTimeStamp(message.timestamp) }}
|
|
42
|
-
</time>
|
|
43
|
-
|
|
44
|
-
<ng-container *ngIf="!message.typing; else typing">
|
|
45
|
-
<div class="k-bubble" *ngIf="template">
|
|
46
|
-
<ng-container
|
|
47
|
-
*ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
|
|
36
|
+
<time
|
|
37
|
+
[attr.aria-hidden]="!selected"
|
|
38
|
+
class="k-message-time"
|
|
39
|
+
*ngIf="message.timestamp"
|
|
48
40
|
>
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
{{ formatTimeStamp(message.timestamp) }}
|
|
42
|
+
</time>
|
|
51
43
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
<ng-container *ngIf="!message.typing; else typing">
|
|
45
|
+
<div class="k-bubble" *ngIf="template">
|
|
46
|
+
<ng-container
|
|
47
|
+
*ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
|
|
48
|
+
>
|
|
49
|
+
</ng-container>
|
|
50
|
+
</div>
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
<div class="k-bubble" *ngIf="!template && message.text">
|
|
53
|
+
{{message.text}}
|
|
54
|
+
</div>
|
|
55
|
+
</ng-container>
|
|
56
|
+
|
|
57
|
+
<span
|
|
58
|
+
class="k-message-status"
|
|
59
|
+
*ngIf="message.status"
|
|
60
|
+
>
|
|
61
|
+
{{ message.status }}
|
|
62
|
+
</span>
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
<ng-template #typing>
|
|
65
|
+
<div class="k-bubble">
|
|
66
|
+
<div class="k-typing-indicator">
|
|
67
|
+
<span></span>
|
|
68
|
+
<span></span>
|
|
69
|
+
<span></span>
|
|
70
|
+
</div>
|
|
70
71
|
</div>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
`, isInline: true, directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
72
|
+
</ng-template>
|
|
73
|
+
`, isInline: true, directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
74
74
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageComponent, decorators: [{
|
|
75
75
|
type: Component,
|
|
76
76
|
args: [{
|
|
@@ -80,44 +80,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
80
80
|
useExisting: forwardRef(() => MessageComponent)
|
|
81
81
|
}],
|
|
82
82
|
template: `
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
>
|
|
88
|
-
{{ formatTimeStamp(message.timestamp) }}
|
|
89
|
-
</time>
|
|
90
|
-
|
|
91
|
-
<ng-container *ngIf="!message.typing; else typing">
|
|
92
|
-
<div class="k-bubble" *ngIf="template">
|
|
93
|
-
<ng-container
|
|
94
|
-
*ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
|
|
83
|
+
<time
|
|
84
|
+
[attr.aria-hidden]="!selected"
|
|
85
|
+
class="k-message-time"
|
|
86
|
+
*ngIf="message.timestamp"
|
|
95
87
|
>
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
{{ formatTimeStamp(message.timestamp) }}
|
|
89
|
+
</time>
|
|
98
90
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
<ng-container *ngIf="!message.typing; else typing">
|
|
92
|
+
<div class="k-bubble" *ngIf="template">
|
|
93
|
+
<ng-container
|
|
94
|
+
*ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
|
|
95
|
+
>
|
|
96
|
+
</ng-container>
|
|
97
|
+
</div>
|
|
103
98
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
99
|
+
<div class="k-bubble" *ngIf="!template && message.text">
|
|
100
|
+
{{message.text}}
|
|
101
|
+
</div>
|
|
102
|
+
</ng-container>
|
|
103
|
+
|
|
104
|
+
<span
|
|
105
|
+
class="k-message-status"
|
|
106
|
+
*ngIf="message.status"
|
|
107
|
+
>
|
|
108
|
+
{{ message.status }}
|
|
109
|
+
</span>
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
<ng-template #typing>
|
|
112
|
+
<div class="k-bubble">
|
|
113
|
+
<div class="k-typing-indicator">
|
|
114
|
+
<span></span>
|
|
115
|
+
<span></span>
|
|
116
|
+
<span></span>
|
|
117
|
+
</div>
|
|
117
118
|
</div>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
`
|
|
119
|
+
</ng-template>
|
|
120
|
+
`
|
|
121
121
|
}]
|
|
122
122
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }]; }, propDecorators: { message: [{
|
|
123
123
|
type: Input
|