@progress/kendo-angular-conversational-ui 4.0.2-dev.202203091004 → 4.1.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/dist/cdn/js/kendo-angular-conversational-ui.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/cards/hero-card.component.js +1 -1
- package/dist/es/chat/attachment.component.js +1 -1
- package/dist/es/chat/chat.component.js +35 -38
- package/dist/es/chat/chat.directives.js +1 -0
- package/dist/es/chat/chat.module.js +6 -2
- package/dist/es/chat/message-attachments.component.js +1 -1
- package/dist/es/chat/message-box.component.js +124 -0
- package/dist/es/chat/message-box.directive.js +24 -0
- package/dist/es/chat/message-list.component.js +1 -1
- package/dist/es/chat/message.component.js +1 -1
- package/dist/es/chat/suggested-actions.component.js +1 -1
- package/dist/es/common/focused-state.directive.js +1 -1
- package/dist/es/common/models/message-box-options.js +4 -0
- package/dist/es/index.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es2015/cards/hero-card.component.js +22 -21
- package/dist/es2015/chat/attachment.component.js +19 -19
- package/dist/es2015/chat/chat.component.d.ts +13 -10
- package/dist/es2015/chat/chat.component.js +67 -83
- package/dist/es2015/chat/chat.directives.d.ts +1 -0
- package/dist/es2015/chat/chat.directives.js +1 -0
- package/dist/es2015/chat/chat.module.js +6 -2
- package/dist/es2015/chat/message-attachments.component.js +31 -31
- package/dist/es2015/chat/message-box.component.d.ts +39 -0
- package/dist/es2015/chat/message-box.component.js +157 -0
- package/dist/es2015/chat/message-box.directive.d.ts +14 -0
- package/dist/es2015/chat/message-box.directive.js +23 -0
- package/dist/es2015/chat/message-list.component.js +66 -66
- package/dist/es2015/chat/message.component.js +33 -33
- package/dist/es2015/chat/suggested-actions.component.js +15 -14
- package/dist/es2015/common/focused-state.directive.js +1 -1
- package/dist/es2015/common/models/message-box-options.d.ts +8 -0
- package/dist/es2015/common/models/message-box-options.js +4 -0
- package/dist/es2015/index.d.ts +1 -0
- package/dist/es2015/index.js +1 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/main.d.ts +1 -0
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/fesm2015/index.js +422 -271
- package/dist/fesm5/index.js +178 -48
- package/dist/npm/cards/hero-card.component.js +1 -1
- package/dist/npm/chat/attachment.component.js +1 -1
- package/dist/npm/chat/chat.component.js +35 -38
- package/dist/npm/chat/chat.directives.js +2 -0
- package/dist/npm/chat/chat.module.js +6 -2
- package/dist/npm/chat/message-attachments.component.js +1 -1
- package/dist/npm/chat/message-box.component.js +126 -0
- package/dist/npm/chat/message-box.directive.js +26 -0
- package/dist/npm/chat/message-list.component.js +1 -1
- package/dist/npm/chat/message.component.js +1 -1
- package/dist/npm/chat/suggested-actions.component.js +1 -1
- package/dist/npm/common/focused-state.directive.js +1 -1
- package/dist/npm/common/models/message-box-options.js +6 -0
- package/dist/npm/index.js +2 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-angular-conversational-ui.js +1 -1
- package/package.json +8 -6
|
@@ -8,11 +8,10 @@ import { AttachmentTemplateDirective } from './attachment-template.directive';
|
|
|
8
8
|
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
9
9
|
import { makeHandler } from './builtin-actions';
|
|
10
10
|
import { MessageTemplateDirective } from './message-template.directive';
|
|
11
|
-
import { SendMessageEvent } from '../api/post-message-event';
|
|
12
11
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
13
12
|
import { packageMetadata } from '../package-metadata';
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import { ChatMessageBoxTemplateDirective } from './message-box.directive';
|
|
14
|
+
import { MessageBoxComponent } from './message-box.component';
|
|
16
15
|
/**
|
|
17
16
|
* Represents the Kendo UI Chat component for Angular.
|
|
18
17
|
*
|
|
@@ -28,6 +27,12 @@ var ChatComponent = /** @class */ (function () {
|
|
|
28
27
|
var _this = this;
|
|
29
28
|
this.localization = localization;
|
|
30
29
|
this.zone = zone;
|
|
30
|
+
/**
|
|
31
|
+
* Used to switch between a one-liner input or a textarea.
|
|
32
|
+
* ([see example]({% slug message_box %})#toc-message-box-types).
|
|
33
|
+
* @default input
|
|
34
|
+
*/
|
|
35
|
+
this.messageBoxType = 'textbox';
|
|
31
36
|
/**
|
|
32
37
|
* Fires when the user types a message and clicks the **Send** button or presses **Enter**.
|
|
33
38
|
* Emits the [`SendMessageEvent`]({% slug api_conversational-ui_sendmessageevent %}).
|
|
@@ -56,7 +61,7 @@ var ChatComponent = /** @class */ (function () {
|
|
|
56
61
|
}
|
|
57
62
|
Object.defineProperty(ChatComponent.prototype, "className", {
|
|
58
63
|
get: function () {
|
|
59
|
-
return 'k-
|
|
64
|
+
return 'k-chat';
|
|
60
65
|
},
|
|
61
66
|
enumerable: true,
|
|
62
67
|
configurable: true
|
|
@@ -68,6 +73,16 @@ var ChatComponent = /** @class */ (function () {
|
|
|
68
73
|
enumerable: true,
|
|
69
74
|
configurable: true
|
|
70
75
|
});
|
|
76
|
+
Object.defineProperty(ChatComponent.prototype, "localizationText", {
|
|
77
|
+
/**
|
|
78
|
+
* @hidden
|
|
79
|
+
*/
|
|
80
|
+
get: function () {
|
|
81
|
+
return this.localization;
|
|
82
|
+
},
|
|
83
|
+
enumerable: true,
|
|
84
|
+
configurable: true
|
|
85
|
+
});
|
|
71
86
|
ChatComponent.prototype.ngOnChanges = function () {
|
|
72
87
|
var _this = this;
|
|
73
88
|
this.zone.runOutsideAngular(function () { return setTimeout(function () {
|
|
@@ -87,33 +102,6 @@ var ChatComponent = /** @class */ (function () {
|
|
|
87
102
|
this.localizationChangeSubscription.unsubscribe();
|
|
88
103
|
}
|
|
89
104
|
};
|
|
90
|
-
/**
|
|
91
|
-
* @hidden
|
|
92
|
-
*/
|
|
93
|
-
ChatComponent.prototype.sendClick = function () {
|
|
94
|
-
var input = this.messageInput.nativeElement;
|
|
95
|
-
var value = input.value;
|
|
96
|
-
if (!value) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
var message = {
|
|
100
|
-
author: this.user,
|
|
101
|
-
text: value,
|
|
102
|
-
timestamp: new Date()
|
|
103
|
-
};
|
|
104
|
-
this.sendMessage.emit(new SendMessageEvent(message));
|
|
105
|
-
input.value = null;
|
|
106
|
-
input.focus();
|
|
107
|
-
this.autoScroll = true;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* @hidden
|
|
111
|
-
*/
|
|
112
|
-
ChatComponent.prototype.inputKeydown = function (e) {
|
|
113
|
-
if (e.keyCode === 13 /* enter */) {
|
|
114
|
-
this.sendClick();
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
105
|
/**
|
|
118
106
|
* @hidden
|
|
119
107
|
*/
|
|
@@ -122,7 +110,9 @@ var ChatComponent = /** @class */ (function () {
|
|
|
122
110
|
if (!e.isDefaultPrevented()) {
|
|
123
111
|
var handler = makeHandler(e.action);
|
|
124
112
|
handler(e.action, this);
|
|
125
|
-
this.
|
|
113
|
+
if (!this.messageBoxTemplate) {
|
|
114
|
+
this.messageBox.messageBoxInput.nativeElement.focus();
|
|
115
|
+
}
|
|
126
116
|
}
|
|
127
117
|
};
|
|
128
118
|
/**
|
|
@@ -139,6 +129,10 @@ var ChatComponent = /** @class */ (function () {
|
|
|
139
129
|
Input(),
|
|
140
130
|
tslib_1.__metadata("design:type", Object)
|
|
141
131
|
], ChatComponent.prototype, "user", void 0);
|
|
132
|
+
tslib_1.__decorate([
|
|
133
|
+
Input(),
|
|
134
|
+
tslib_1.__metadata("design:type", String)
|
|
135
|
+
], ChatComponent.prototype, "messageBoxType", void 0);
|
|
142
136
|
tslib_1.__decorate([
|
|
143
137
|
Output(),
|
|
144
138
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
@@ -166,9 +160,13 @@ var ChatComponent = /** @class */ (function () {
|
|
|
166
160
|
tslib_1.__metadata("design:type", MessageTemplateDirective)
|
|
167
161
|
], ChatComponent.prototype, "messageTemplate", void 0);
|
|
168
162
|
tslib_1.__decorate([
|
|
169
|
-
|
|
170
|
-
tslib_1.__metadata("design:type",
|
|
171
|
-
], ChatComponent.prototype, "
|
|
163
|
+
ContentChild(ChatMessageBoxTemplateDirective, { static: false }),
|
|
164
|
+
tslib_1.__metadata("design:type", ChatMessageBoxTemplateDirective)
|
|
165
|
+
], ChatComponent.prototype, "messageBoxTemplate", void 0);
|
|
166
|
+
tslib_1.__decorate([
|
|
167
|
+
ViewChild('messageBox', { static: false }),
|
|
168
|
+
tslib_1.__metadata("design:type", MessageBoxComponent)
|
|
169
|
+
], ChatComponent.prototype, "messageBox", void 0);
|
|
172
170
|
tslib_1.__decorate([
|
|
173
171
|
ViewChild('messageList', { static: true }),
|
|
174
172
|
tslib_1.__metadata("design:type", ElementRef)
|
|
@@ -183,10 +181,9 @@ var ChatComponent = /** @class */ (function () {
|
|
|
183
181
|
}
|
|
184
182
|
],
|
|
185
183
|
selector: 'kendo-chat',
|
|
186
|
-
template: "\n
|
|
184
|
+
template: "\n <ng-container\n kendoChatLocalizedMessages\n i18n-messagePlaceholder=\"kendo.chat.messagePlaceholder|The placholder text of the message text input\"\n messagePlaceholder=\"Type a message...\"\n\n i18n-send=\"kendo.chat.send|The text for the Send button\"\n send=\"Send...\"\n >\n </ng-container>\n\n <div\n #messageList\n class=\"k-message-list k-avatars\"\n aria-live=\"polite\" role=\"log\"\n kendoChatScrollAnchor\n #anchor=\"scrollAnchor\"\n [(autoScroll)]=\"autoScroll\"\n >\n <kendo-chat-message-list\n [messages]=\"messages\"\n [messageTemplate]=\"messageTemplate\"\n [attachmentTemplate]=\"attachmentTemplate\"\n [user]=\"user\"\n (executeAction)=\"dispatchAction($event)\"\n (resize)=\"anchor.scrollToBottom()\"\n (navigate)=\"this.autoScroll = false\"\n >\n </kendo-chat-message-list>\n </div>\n <kendo-message-box\n #messageBox\n [messageBoxTemplate]=\"messageBoxTemplate\"\n [type]=\"messageBoxType\"\n [user]=\"user\"\n [autoScroll]=\"autoScroll\"\n [localization]=\"localizationText\"\n (sendMessage)=\"sendMessage.emit($event)\"\n >\n </kendo-message-box>\n "
|
|
187
185
|
}),
|
|
188
|
-
tslib_1.__metadata("design:paramtypes", [LocalizationService,
|
|
189
|
-
NgZone])
|
|
186
|
+
tslib_1.__metadata("design:paramtypes", [LocalizationService, NgZone])
|
|
190
187
|
], ChatComponent);
|
|
191
188
|
return ChatComponent;
|
|
192
189
|
}());
|
|
@@ -5,3 +5,4 @@
|
|
|
5
5
|
export { ChatComponent } from './chat.component';
|
|
6
6
|
export { AttachmentTemplateDirective } from './attachment-template.directive';
|
|
7
7
|
export { MessageTemplateDirective } from './message-template.directive';
|
|
8
|
+
export { ChatMessageBoxTemplateDirective } from './message-box.directive';
|
|
@@ -18,12 +18,15 @@ import { MessageListComponent } from './message-list.component';
|
|
|
18
18
|
import { NgModule } from '@angular/core';
|
|
19
19
|
import { ScrollAnchorDirective } from '../common/scroll-anchor.directive';
|
|
20
20
|
import { SuggestedActionsComponent } from './suggested-actions.component';
|
|
21
|
+
import { MessageBoxComponent } from './message-box.component';
|
|
22
|
+
import { ChatMessageBoxTemplateDirective } from './message-box.directive';
|
|
21
23
|
var PUBLIC_DIRECTIVES = [
|
|
22
24
|
ChatComponent,
|
|
23
25
|
CustomMessagesComponent,
|
|
24
26
|
AttachmentTemplateDirective,
|
|
25
27
|
MessageTemplateDirective,
|
|
26
|
-
HeroCardComponent
|
|
28
|
+
HeroCardComponent,
|
|
29
|
+
ChatMessageBoxTemplateDirective
|
|
27
30
|
];
|
|
28
31
|
var PRIVATE_DIRECTIVES = [
|
|
29
32
|
AttachmentComponent,
|
|
@@ -34,7 +37,8 @@ var PRIVATE_DIRECTIVES = [
|
|
|
34
37
|
MessageListComponent,
|
|
35
38
|
MessageTemplateDirective,
|
|
36
39
|
ScrollAnchorDirective,
|
|
37
|
-
SuggestedActionsComponent
|
|
40
|
+
SuggestedActionsComponent,
|
|
41
|
+
MessageBoxComponent
|
|
38
42
|
];
|
|
39
43
|
/**
|
|
40
44
|
* The [NgModule]({{ site.data.urls.angular['ngmodules'] }}) for the Chat component.
|
|
@@ -139,7 +139,7 @@ var MessageAttachmentsComponent = /** @class */ (function (_super) {
|
|
|
139
139
|
useExisting: forwardRef(function () { return MessageAttachmentsComponent_1; })
|
|
140
140
|
}],
|
|
141
141
|
selector: 'kendo-chat-message-attachments',
|
|
142
|
-
template: "\n
|
|
142
|
+
template: "\n <button\n *ngIf=\"carousel && scrollPosition > 0\"\n (click)=\"scrollTo(-1)\"\n class=\"k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base\"\n tabindex=\"-1\">\n <span class=\"k-icon k-button-icon k-i-arrow-chevron-left\"></span>\n </button>\n <div #deck [class.k-card-deck]=\"carousel\">\n <kendo-chat-attachment #item\n *ngFor=\"let att of attachments; index as index; first as first; last as last\"\n [attachment]=\"att\"\n [template]=\"template\"\n [class.k-state-selected]=\"isSelected(index)\"\n [class.k-state-focused]=\"isSelected(index)\"\n [class.k-card-wrap]=\"true\"\n [class.k-first]=\"first\"\n [class.k-last]=\"last\"\n [attr.tabindex]=\"tabbable && isSelected(index) ? '0' : '-1'\"\n (click)=\"itemClick(index)\"\n (keydown)=\"itemKeydown($event, att)\"\n >\n </kendo-chat-attachment>\n </div>\n <button\n *ngIf=\"carousel && scrollPosition < 1\"\n (click)=\"scrollTo(1)\"\n class=\"k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base\"\n tabindex=\"-1\">\n <span class=\"k-icon k-button-icon k-i-arrow-chevron-right\"></span>\n </button>\n "
|
|
143
143
|
}),
|
|
144
144
|
tslib_1.__metadata("design:paramtypes", [NgZone])
|
|
145
145
|
], MessageAttachmentsComponent);
|
|
@@ -0,0 +1,124 @@
|
|
|
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 * as tslib_1 from "tslib";
|
|
6
|
+
import { Component, ElementRef, EventEmitter, HostBinding, Input, Output, ViewChild } from '@angular/core';
|
|
7
|
+
import { SendMessageEvent } from '../api/post-message-event';
|
|
8
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
9
|
+
import { Keys } from '@progress/kendo-angular-common';
|
|
10
|
+
import { ChatMessageBoxTemplateDirective } from './message-box.directive';
|
|
11
|
+
// tslint:disable-next-line:max-line-length
|
|
12
|
+
var 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>';
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
var MessageBoxComponent = /** @class */ (function () {
|
|
17
|
+
function MessageBoxComponent() {
|
|
18
|
+
this.hostClasses = 'k-message-box k-input k-input-md k-rounded-md k-input-solid';
|
|
19
|
+
this.sendMessage = new EventEmitter();
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(MessageBoxComponent.prototype, "messageBoxValue", {
|
|
22
|
+
get: function () {
|
|
23
|
+
return this.type === 'textarea';
|
|
24
|
+
},
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
MessageBoxComponent.prototype.sendClick = function () {
|
|
32
|
+
var input = this.messageBoxInput.nativeElement;
|
|
33
|
+
var value = input.value;
|
|
34
|
+
if (!value) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
var message = {
|
|
38
|
+
author: this.user,
|
|
39
|
+
text: value,
|
|
40
|
+
timestamp: new Date()
|
|
41
|
+
};
|
|
42
|
+
this.sendMessage.emit(new SendMessageEvent(message));
|
|
43
|
+
input.value = null;
|
|
44
|
+
input.focus();
|
|
45
|
+
this.autoScroll = true;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
50
|
+
MessageBoxComponent.prototype.inputKeydown = function (e) {
|
|
51
|
+
if (e.keyCode === Keys.Enter) {
|
|
52
|
+
this.sendClick();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* @hidden
|
|
57
|
+
*/
|
|
58
|
+
MessageBoxComponent.prototype.textAreaKeydown = function (e) {
|
|
59
|
+
var isEnter = e.keyCode === Keys.Enter;
|
|
60
|
+
if (!isEnter) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
var newLine = (e.metaKey || e.ctrlKey);
|
|
64
|
+
var enterOnly = !(e.shiftKey || e.metaKey || e.ctrlKey);
|
|
65
|
+
if (enterOnly) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
this.sendClick();
|
|
68
|
+
}
|
|
69
|
+
if (newLine) {
|
|
70
|
+
this.messageBoxInput.nativeElement.value += "\r\n";
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* @hidden
|
|
75
|
+
*/
|
|
76
|
+
MessageBoxComponent.prototype.textFor = function (key) {
|
|
77
|
+
return this.localization.get(key);
|
|
78
|
+
};
|
|
79
|
+
tslib_1.__decorate([
|
|
80
|
+
HostBinding('class'),
|
|
81
|
+
tslib_1.__metadata("design:type", String)
|
|
82
|
+
], MessageBoxComponent.prototype, "hostClasses", void 0);
|
|
83
|
+
tslib_1.__decorate([
|
|
84
|
+
HostBinding('class.\!k-align-items-end'),
|
|
85
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
86
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
87
|
+
], MessageBoxComponent.prototype, "messageBoxValue", null);
|
|
88
|
+
tslib_1.__decorate([
|
|
89
|
+
ViewChild('messageBoxInput', { static: false }),
|
|
90
|
+
tslib_1.__metadata("design:type", ElementRef)
|
|
91
|
+
], MessageBoxComponent.prototype, "messageBoxInput", void 0);
|
|
92
|
+
tslib_1.__decorate([
|
|
93
|
+
Input(),
|
|
94
|
+
tslib_1.__metadata("design:type", Object)
|
|
95
|
+
], MessageBoxComponent.prototype, "user", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
Input(),
|
|
98
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
99
|
+
], MessageBoxComponent.prototype, "autoScroll", void 0);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
Input(),
|
|
102
|
+
tslib_1.__metadata("design:type", String)
|
|
103
|
+
], MessageBoxComponent.prototype, "type", void 0);
|
|
104
|
+
tslib_1.__decorate([
|
|
105
|
+
Input(),
|
|
106
|
+
tslib_1.__metadata("design:type", LocalizationService)
|
|
107
|
+
], MessageBoxComponent.prototype, "localization", void 0);
|
|
108
|
+
tslib_1.__decorate([
|
|
109
|
+
Input(),
|
|
110
|
+
tslib_1.__metadata("design:type", ChatMessageBoxTemplateDirective)
|
|
111
|
+
], MessageBoxComponent.prototype, "messageBoxTemplate", void 0);
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
Output(),
|
|
114
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
115
|
+
], MessageBoxComponent.prototype, "sendMessage", void 0);
|
|
116
|
+
MessageBoxComponent = tslib_1.__decorate([
|
|
117
|
+
Component({
|
|
118
|
+
selector: 'kendo-message-box',
|
|
119
|
+
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 " + sendIcon + "\n </button>\n </ng-container>\n\n <ng-template *ngIf=\"messageBoxTemplate\" [ngTemplateOutlet]=\"messageBoxTemplate?.templateRef\"></ng-template>\n"
|
|
120
|
+
})
|
|
121
|
+
], MessageBoxComponent);
|
|
122
|
+
return MessageBoxComponent;
|
|
123
|
+
}());
|
|
124
|
+
export { MessageBoxComponent };
|
|
@@ -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 * as tslib_1 from "tslib";
|
|
6
|
+
import { Directive, TemplateRef } 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
|
+
var ChatMessageBoxTemplateDirective = /** @class */ (function () {
|
|
13
|
+
function ChatMessageBoxTemplateDirective(templateRef) {
|
|
14
|
+
this.templateRef = templateRef;
|
|
15
|
+
}
|
|
16
|
+
ChatMessageBoxTemplateDirective = tslib_1.__decorate([
|
|
17
|
+
Directive({
|
|
18
|
+
selector: '[kendoChatMessageBoxTemplate]'
|
|
19
|
+
}),
|
|
20
|
+
tslib_1.__metadata("design:paramtypes", [TemplateRef])
|
|
21
|
+
], ChatMessageBoxTemplateDirective);
|
|
22
|
+
return ChatMessageBoxTemplateDirective;
|
|
23
|
+
}());
|
|
24
|
+
export { ChatMessageBoxTemplateDirective };
|
|
@@ -156,7 +156,7 @@ var MessageListComponent = /** @class */ (function () {
|
|
|
156
156
|
MessageListComponent = tslib_1.__decorate([
|
|
157
157
|
Component({
|
|
158
158
|
selector: 'kendo-chat-message-list',
|
|
159
|
-
template: "\n
|
|
159
|
+
template: "\n <ng-container *ngFor=\"let group of view; last as lastGroup; trackBy: trackGroup\">\n <ng-container [ngSwitch]=\"group.type\">\n <div\n *ngSwitchCase=\"'date-marker'\"\n class=\"k-timestamp\"\n >\n {{ formatTimeStamp(group.timestamp) }}\n </div>\n <div\n *ngSwitchCase=\"'message-group'\"\n class=\"k-message-group\"\n [class.k-alt]=\"isOwnMessage(group.messages[0])\"\n [class.k-no-avatar]=\"!group.author.avatarUrl\"\n >\n <img\n *ngIf=\"group.author.avatarUrl\"\n [attr.src]=\"group.author.avatarUrl\"\n class=\"k-avatar\"\n />\n <p *ngIf=\"group.author.name\" class=\"k-author\">{{ group.author.name }}</p>\n <ng-container\n *ngFor=\"let msg of group.messages; first as firstMessage; last as lastMessage\"\n >\n <img *ngIf=\"msg.user?.avatarUrl\" [src]=\"msg.user?.avatarUrl\" class=\"k-avatar\">\n <kendo-chat-message #message\n [message]=\"msg\"\n [tabbable]=\"lastGroup && lastMessage\"\n [template]=\"messageTemplate\"\n (click)=\"select(message)\"\n (focus)=\"select(message)\"\n [class.k-only]=\"group.messages.length === 1\"\n [class.k-first]=\"group.messages.length > 1 && firstMessage\"\n [class.k-last]=\"group.messages.length > 1 && lastMessage\"\n >\n </kendo-chat-message>\n\n <kendo-chat-attachment\n *ngIf=\"msg.attachments && msg.attachments.length === 1\"\n [attachment]=\"msg.attachments[0]\"\n [template]=\"attachmentTemplate\"\n >\n </kendo-chat-attachment>\n </ng-container>\n </div>\n\n <kendo-chat-message-attachments #attachments\n *ngSwitchCase=\"'attachment-group'\"\n [attachments]=\"group.attachments\"\n [layout]=\"group.attachmentLayout\"\n [tabbable]=\"lastGroup\"\n [template]=\"attachmentTemplate\"\n (click)=\"select(attachments)\"\n (focus)=\"select(attachments)\"\n >\n </kendo-chat-message-attachments>\n\n <kendo-chat-suggested-actions #actions\n *ngSwitchCase=\"'action-group'\"\n [actions]=\"group.actions\"\n [tabbable]=\"lastGroup\"\n (dispatch)=\"dispatchAction($event, last(group.messages))\"\n (click)=\"select(actions)\"\n (focus)=\"select(actions)\"\n >\n </kendo-chat-suggested-actions>\n </ng-container>\n </ng-container>\n <kendo-resize-sensor (resize)=\"onResize()\">\n </kendo-resize-sensor>\n "
|
|
160
160
|
}),
|
|
161
161
|
tslib_1.__metadata("design:paramtypes", [ElementRef, IntlService])
|
|
162
162
|
], MessageListComponent);
|
|
@@ -68,7 +68,7 @@ var MessageComponent = /** @class */ (function (_super) {
|
|
|
68
68
|
provide: ChatItem,
|
|
69
69
|
useExisting: forwardRef(function () { return MessageComponent_1; })
|
|
70
70
|
}],
|
|
71
|
-
template: "\n
|
|
71
|
+
template: "\n <time\n [attr.aria-hidden]=\"!selected\"\n class=\"k-message-time\"\n *ngIf=\"message.timestamp\"\n >\n {{ formatTimeStamp(message.timestamp) }}\n </time>\n\n <ng-container *ngIf=\"!message.typing; else typing\">\n <div class=\"k-bubble\" *ngIf=\"template\">\n <ng-container\n *ngTemplateOutlet=\"template.templateRef; context: { $implicit: message };\"\n >\n </ng-container>\n </div>\n\n <div class=\"k-bubble\" *ngIf=\"!template && message.text\">\n {{message.text}}\n </div>\n </ng-container>\n\n <span\n class=\"k-message-status\"\n *ngIf=\"message.status\"\n >\n {{ message.status }}\n </span>\n\n <ng-template #typing>\n <div class=\"k-bubble\">\n <div class=\"k-typing-indicator\">\n <span></span>\n <span></span>\n <span></span>\n </div>\n </div>\n </ng-template>\n "
|
|
72
72
|
}),
|
|
73
73
|
tslib_1.__metadata("design:paramtypes", [ElementRef, IntlService])
|
|
74
74
|
], MessageComponent);
|
|
@@ -83,7 +83,7 @@ var SuggestedActionsComponent = /** @class */ (function (_super) {
|
|
|
83
83
|
provide: ChatItem,
|
|
84
84
|
useExisting: forwardRef(function () { return SuggestedActionsComponent_1; })
|
|
85
85
|
}],
|
|
86
|
-
template: "\n
|
|
86
|
+
template: "\n <span\n #item\n *ngFor=\"let action of actions; index as index; first as first; last as last\"\n class=\"k-quick-reply\"\n [class.k-state-selected]=\"isSelected(index)\"\n [class.k-state-focused]=\"isSelected(index)\"\n [class.k-first]=\"first\"\n [class.k-last]=\"last\"\n [attr.tabindex]=\"tabbable && selectedIndex === index ? '0' : '-1'\"\n (click)=\"actionClick(action)\"\n (keydown)=\"actionKeydown($event, action)\"\n >\n {{ action.title || action.value }}\n </span>\n "
|
|
87
87
|
})
|
|
88
88
|
], SuggestedActionsComponent);
|
|
89
89
|
return SuggestedActionsComponent;
|
|
@@ -18,7 +18,7 @@ var FocusedStateDirective = /** @class */ (function () {
|
|
|
18
18
|
this.focused = false;
|
|
19
19
|
};
|
|
20
20
|
tslib_1.__decorate([
|
|
21
|
-
HostBinding('class.k-
|
|
21
|
+
HostBinding('class.k-focus'),
|
|
22
22
|
tslib_1.__metadata("design:type", Boolean)
|
|
23
23
|
], FocusedStateDirective.prototype, "focused", void 0);
|
|
24
24
|
tslib_1.__decorate([
|
|
@@ -0,0 +1,4 @@
|
|
|
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
|
+
*-------------------------------------------------------------------------------------------*/
|
package/dist/es/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { CustomMessagesComponent } from './chat/l10n/custom-messages.component';
|
|
|
14
14
|
export { LocalizedMessagesDirective } from './chat/l10n/localized-messages.directive';
|
|
15
15
|
export { Messages } from './chat/l10n/messages';
|
|
16
16
|
export { MessageAttachmentsComponent } from './chat/message-attachments.component';
|
|
17
|
+
export { MessageBoxComponent } from './chat/message-box.component';
|
|
17
18
|
export { MessageListComponent } from './chat/message-list.component';
|
|
18
19
|
export { MessageComponent } from './chat/message.component';
|
|
19
20
|
export { SuggestedActionsComponent } from './chat/suggested-actions.component';
|
|
@@ -9,7 +9,7 @@ export var packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-conversational-ui',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1649323827,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
|
@@ -52,27 +52,28 @@ HeroCardComponent = tslib_1.__decorate([
|
|
|
52
52
|
Component({
|
|
53
53
|
selector: 'kendo-chat-hero-card',
|
|
54
54
|
template: `
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
55
|
+
<img class="k-card-image" [src]="imageUrl" *ngIf="imageUrl" />
|
|
56
|
+
<div class="k-card-body">
|
|
57
|
+
<h5 class="k-card-title" *ngIf="title">
|
|
58
|
+
{{ title }}
|
|
59
|
+
</h5>
|
|
60
|
+
<h6 class="k-card-subtitle" *ngIf="subtitle">
|
|
61
|
+
{{ subtitle }}
|
|
62
|
+
</h6>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="k-card-actions k-card-actions-vertical">
|
|
65
|
+
<span class="k-card-action"
|
|
66
|
+
*ngFor="let act of actions"
|
|
67
|
+
>
|
|
68
|
+
<button
|
|
69
|
+
kendoButton fillMode="flat"
|
|
70
|
+
(click)="onClick(act)"
|
|
71
|
+
>
|
|
72
|
+
{{ act.title }}
|
|
73
|
+
</button>
|
|
74
|
+
</span>
|
|
75
|
+
</div>
|
|
76
|
+
`
|
|
76
77
|
})
|
|
77
78
|
], HeroCardComponent);
|
|
78
79
|
export { HeroCardComponent };
|
|
@@ -41,26 +41,26 @@ AttachmentComponent = tslib_1.__decorate([
|
|
|
41
41
|
Component({
|
|
42
42
|
selector: 'kendo-chat-attachment',
|
|
43
43
|
template: `
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
</ng-container>
|
|
48
|
-
|
|
49
|
-
<div *ngIf="!template" class="k-card">
|
|
50
|
-
<div class="k-card-body">
|
|
51
|
-
<h5 class="k-card-title" *ngIf="attachment.title">
|
|
52
|
-
{{ attachment.title }}
|
|
53
|
-
</h5>
|
|
54
|
-
<h6 class="k-card-subtitle" *ngIf="attachment.subtitle">
|
|
55
|
-
{{ attachment.subtitle }}
|
|
56
|
-
</h6>
|
|
57
|
-
<img *ngIf="image" [attr.src]="attachment.content" />
|
|
58
|
-
<ng-container *ngIf="unknown">
|
|
59
|
-
{{ attachment.content }}
|
|
44
|
+
<ng-container *ngIf="template">
|
|
45
|
+
<ng-container *ngTemplateOutlet="template.templateRef; context: context;">
|
|
46
|
+
</ng-container>
|
|
60
47
|
</ng-container>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
|
|
49
|
+
<div *ngIf="!template" class="k-card">
|
|
50
|
+
<div class="k-card-body">
|
|
51
|
+
<h5 class="k-card-title" *ngIf="attachment.title">
|
|
52
|
+
{{ attachment.title }}
|
|
53
|
+
</h5>
|
|
54
|
+
<h6 class="k-card-subtitle" *ngIf="attachment.subtitle">
|
|
55
|
+
{{ attachment.subtitle }}
|
|
56
|
+
</h6>
|
|
57
|
+
<img *ngIf="image" [attr.src]="attachment.content" />
|
|
58
|
+
<ng-container *ngIf="unknown">
|
|
59
|
+
{{ attachment.content }}
|
|
60
|
+
</ng-container>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
`
|
|
64
64
|
})
|
|
65
65
|
], AttachmentComponent);
|
|
66
66
|
export { AttachmentComponent };
|
|
@@ -10,6 +10,9 @@ import { Message } from '../api/message.interface';
|
|
|
10
10
|
import { MessageTemplateDirective } from './message-template.directive';
|
|
11
11
|
import { SendMessageEvent } from '../api/post-message-event';
|
|
12
12
|
import { User } from '../api/user.interface';
|
|
13
|
+
import { MessageBoxType } from '../common/models/message-box-options';
|
|
14
|
+
import { ChatMessageBoxTemplateDirective } from './message-box.directive';
|
|
15
|
+
import { MessageBoxComponent } from './message-box.component';
|
|
13
16
|
/**
|
|
14
17
|
* Represents the Kendo UI Chat component for Angular.
|
|
15
18
|
*
|
|
@@ -34,6 +37,12 @@ export declare class ChatComponent implements AfterViewInit, OnDestroy {
|
|
|
34
37
|
* The User ID identifies messages that are authored by the local user.
|
|
35
38
|
*/
|
|
36
39
|
user: User;
|
|
40
|
+
/**
|
|
41
|
+
* Used to switch between a one-liner input or a textarea.
|
|
42
|
+
* ([see example]({% slug message_box %})#toc-message-box-types).
|
|
43
|
+
* @default input
|
|
44
|
+
*/
|
|
45
|
+
messageBoxType: MessageBoxType;
|
|
37
46
|
/**
|
|
38
47
|
* Fires when the user types a message and clicks the **Send** button or presses **Enter**.
|
|
39
48
|
* Emits the [`SendMessageEvent`]({% slug api_conversational-ui_sendmessageevent %}).
|
|
@@ -53,14 +62,16 @@ export declare class ChatComponent implements AfterViewInit, OnDestroy {
|
|
|
53
62
|
readonly dirAttr: string;
|
|
54
63
|
attachmentTemplate: AttachmentTemplateDirective;
|
|
55
64
|
messageTemplate: MessageTemplateDirective;
|
|
65
|
+
messageBoxTemplate: ChatMessageBoxTemplateDirective;
|
|
66
|
+
messageBox: MessageBoxComponent;
|
|
56
67
|
/**
|
|
57
68
|
* @hidden
|
|
58
69
|
*/
|
|
59
|
-
|
|
70
|
+
messageList: ElementRef;
|
|
60
71
|
/**
|
|
61
72
|
* @hidden
|
|
62
73
|
*/
|
|
63
|
-
|
|
74
|
+
readonly localizationText: LocalizationService;
|
|
64
75
|
/**
|
|
65
76
|
* @hidden
|
|
66
77
|
*/
|
|
@@ -71,14 +82,6 @@ export declare class ChatComponent implements AfterViewInit, OnDestroy {
|
|
|
71
82
|
ngOnChanges(): void;
|
|
72
83
|
ngAfterViewInit(): void;
|
|
73
84
|
ngOnDestroy(): void;
|
|
74
|
-
/**
|
|
75
|
-
* @hidden
|
|
76
|
-
*/
|
|
77
|
-
sendClick(): void;
|
|
78
|
-
/**
|
|
79
|
-
* @hidden
|
|
80
|
-
*/
|
|
81
|
-
inputKeydown(e: any): void;
|
|
82
85
|
/**
|
|
83
86
|
* @hidden
|
|
84
87
|
*/
|