@progress/kendo-angular-conversational-ui 17.0.0-develop.21 → 17.0.0-develop.23
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/ai-prompt/aiprompt.component.d.ts +1 -1
- package/ai-prompt/common/output-card.component.d.ts +1 -1
- package/ai-prompt/localization/messages.d.ts +1 -1
- package/ai-prompt/models/prompt-output.interface.d.ts +1 -1
- package/ai-prompt/models/view-type.d.ts +1 -1
- package/ai-prompt/views/base-view.d.ts +1 -1
- package/ai-prompt/views/custom-view.component.d.ts +1 -1
- package/chat/api/action.interface.d.ts +1 -1
- package/chat/api/attachment.interface.d.ts +1 -1
- package/chat/attachment.component.d.ts +1 -1
- package/chat/builtin-actions.d.ts +1 -1
- package/chat/cards/hero-card.component.d.ts +1 -1
- package/chat/chat-view.d.ts +1 -1
- package/chat/chat.component.d.ts +1 -1
- package/chat/common/models/message-box-options.d.ts +1 -1
- package/chat/common/scroll-anchor.directive.d.ts +1 -1
- package/chat/l10n/messages.d.ts +1 -1
- package/chat/message-attachments.component.d.ts +1 -1
- package/chat/message-box.component.d.ts +1 -1
- package/chat/message-list.component.d.ts +1 -1
- package/chat/message.component.d.ts +1 -1
- package/chat/suggested-actions.component.d.ts +1 -2
- package/{esm2020 → esm2022}/ai-prompt/aiprompt.component.mjs +61 -48
- package/{esm2020 → esm2022}/ai-prompt/aiprompt.module.mjs +4 -4
- package/{esm2020 → esm2022}/ai-prompt/common/aiprompt.service.mjs +13 -11
- package/{esm2020 → esm2022}/ai-prompt/common/output-card.component.mjs +19 -16
- package/{esm2020 → esm2022}/ai-prompt/common/toolbar-focusable.directive.mjs +28 -25
- package/{esm2020 → esm2022}/ai-prompt/common/toolbar-navigation.service.mjs +6 -5
- package/{esm2020 → esm2022}/ai-prompt/localization/custom-messages.component.mjs +9 -8
- package/{esm2020 → esm2022}/ai-prompt/localization/localized-messages.directive.mjs +9 -8
- package/esm2022/ai-prompt/localization/messages.mjs +71 -0
- package/{esm2020 → esm2022}/ai-prompt/templates/toolbar-actions.template.mjs +4 -3
- package/{esm2020 → esm2022}/ai-prompt/views/base-view.mjs +13 -4
- package/{esm2020 → esm2022}/ai-prompt/views/command-view.component.mjs +12 -11
- package/{esm2020 → esm2022}/ai-prompt/views/custom-view.component.mjs +10 -6
- package/{esm2020 → esm2022}/ai-prompt/views/output-view.component.mjs +8 -7
- package/{esm2020 → esm2022}/ai-prompt/views/prompt-view.component.mjs +18 -17
- package/{esm2020 → esm2022}/chat/api/execute-action-event.mjs +8 -0
- package/{esm2020 → esm2022}/chat/api/post-message-event.mjs +7 -0
- package/{esm2020 → esm2022}/chat/api/preventable-event.mjs +1 -3
- package/{esm2020 → esm2022}/chat/attachment-template.directive.mjs +4 -3
- package/{esm2020 → esm2022}/chat/attachment.component.mjs +7 -4
- package/{esm2020 → esm2022}/chat/cards/hero-card.component.mjs +25 -11
- package/{esm2020 → esm2022}/chat/chat-item.mjs +1 -0
- package/{esm2020 → esm2022}/chat/chat.component.mjs +67 -44
- package/{esm2020 → esm2022}/chat/chat.module.mjs +4 -4
- package/{esm2020 → esm2022}/chat/common/scroll-anchor.directive.mjs +11 -7
- package/{esm2020 → esm2022}/chat/l10n/custom-messages.component.mjs +9 -8
- package/{esm2020 → esm2022}/chat/l10n/localized-messages.directive.mjs +9 -8
- package/esm2022/chat/l10n/messages.mjs +64 -0
- package/{esm2020 → esm2022}/chat/message-attachments.component.mjs +42 -31
- package/{esm2020 → esm2022}/chat/message-box.component.mjs +16 -12
- package/{esm2020 → esm2022}/chat/message-box.directive.mjs +4 -3
- package/{esm2020 → esm2022}/chat/message-list.component.mjs +32 -22
- package/{esm2020 → esm2022}/chat/message-template.directive.mjs +4 -3
- package/{esm2020 → esm2022}/chat/message.component.mjs +17 -11
- package/{esm2020 → esm2022}/chat/suggested-actions.component.mjs +18 -18
- package/{esm2020 → esm2022}/conversational-ui.module.mjs +4 -4
- package/{esm2020 → esm2022}/package-metadata.mjs +2 -2
- package/{fesm2020 → fesm2022}/progress-kendo-angular-conversational-ui.mjs +578 -378
- package/package.json +18 -24
- package/esm2020/ai-prompt/localization/messages.mjs +0 -35
- package/esm2020/chat/l10n/messages.mjs +0 -35
- package/fesm2015/progress-kendo-angular-conversational-ui.mjs +0 -3242
- /package/{esm2020 → esm2022}/ai-prompt/models/command-execute-event.mjs +0 -0
- /package/{esm2020 → esm2022}/ai-prompt/models/command.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/ai-prompt/models/index.mjs +0 -0
- /package/{esm2020 → esm2022}/ai-prompt/models/output-rating-change-event.mjs +0 -0
- /package/{esm2020 → esm2022}/ai-prompt/models/prompt-output.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/ai-prompt/models/prompt-request-event.mjs +0 -0
- /package/{esm2020 → esm2022}/ai-prompt/models/view-type.mjs +0 -0
- /package/{esm2020 → esm2022}/ai-prompt/utils.mjs +0 -0
- /package/{esm2020 → esm2022}/ai-prompt/views/index.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/api/action.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/api/attachment.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/api/index.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/api/message.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/api/user.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/builtin-actions.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/chat-view.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/chat.directives.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/common/models/message-box-options.mjs +0 -0
- /package/{esm2020 → esm2022}/chat/common/utils.mjs +0 -0
- /package/{esm2020 → esm2022}/directives.mjs +0 -0
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/progress-kendo-angular-conversational-ui.mjs +0 -0
|
@@ -1,3242 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2024 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 i0 from '@angular/core';
|
|
6
|
-
import { Directive, Optional, EventEmitter, Component, HostBinding, ViewChild, Input, Output, isDevMode, forwardRef, ViewChildren, ElementRef, ContentChild, InjectionToken, Inject, Injectable, ContentChildren, NgModule } from '@angular/core';
|
|
7
|
-
import * as i1$1 from '@progress/kendo-angular-l10n';
|
|
8
|
-
import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
9
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
|
-
import { NgIf, NgTemplateOutlet, NgFor, NgSwitch, NgSwitchCase } from '@angular/common';
|
|
11
|
-
import { Keys, ResizeSensorComponent, isPresent, focusableSelector, guid, ResizeBatchService } from '@progress/kendo-angular-common';
|
|
12
|
-
import { paperPlaneIcon, chevronLeftIcon, chevronRightIcon, sparklesIcon, commentIcon, moreHorizontalIcon, copyIcon, arrowRotateCwIcon, thumbUpOutlineIcon, thumbDownOutlineIcon, thumbUpIcon, thumbDownIcon, chevronUpIcon, chevronDownIcon } from '@progress/kendo-svg-icons';
|
|
13
|
-
import { ButtonComponent } from '@progress/kendo-angular-buttons';
|
|
14
|
-
import { TextBoxComponent, TextAreaComponent, InputSeparatorComponent, TextBoxSuffixTemplateDirective, TextAreaSuffixComponent } from '@progress/kendo-angular-inputs';
|
|
15
|
-
import { fromEvent, Subscription, Subject } from 'rxjs';
|
|
16
|
-
import * as i1 from '@progress/kendo-angular-intl';
|
|
17
|
-
import { debounceTime } from 'rxjs/operators';
|
|
18
|
-
import { IconsService } from '@progress/kendo-angular-icons';
|
|
19
|
-
import { PopupService } from '@progress/kendo-angular-popup';
|
|
20
|
-
import { DialogContainerService, DialogService, WindowService, WindowContainerService } from '@progress/kendo-angular-dialog';
|
|
21
|
-
import { PanelBarComponent } from '@progress/kendo-angular-layout';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Defines a template that will be used for displaying message attachments. To define an attachment
|
|
25
|
-
* template, nest an `<ng-template>` tag with the `kendoChatAttachmentTemplate` attribute inside the
|
|
26
|
-
* `<kendo-chat>` component. The template context is set to the attachment instance. For more information,
|
|
27
|
-
* refer to the article on [message attachments]({% slug attachments_chat %}).
|
|
28
|
-
*
|
|
29
|
-
* {% meta height:700 %}
|
|
30
|
-
* {% embed_file chat/attachments/templates/app.component.ts preview %}
|
|
31
|
-
* {% embed_file shared/app.module.ts preview %}
|
|
32
|
-
* {% embed_file shared/main.ts hidden %}
|
|
33
|
-
* {% endmeta %}
|
|
34
|
-
*/
|
|
35
|
-
class AttachmentTemplateDirective {
|
|
36
|
-
constructor(templateRef) {
|
|
37
|
-
this.templateRef = templateRef;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
AttachmentTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AttachmentTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
41
|
-
AttachmentTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: AttachmentTemplateDirective, isStandalone: true, selector: "[kendoChatAttachmentTemplate]", ngImport: i0 });
|
|
42
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AttachmentTemplateDirective, decorators: [{
|
|
43
|
-
type: Directive,
|
|
44
|
-
args: [{
|
|
45
|
-
selector: '[kendoChatAttachmentTemplate]',
|
|
46
|
-
standalone: true
|
|
47
|
-
}]
|
|
48
|
-
}], ctorParameters: function () {
|
|
49
|
-
return [{ type: i0.TemplateRef, decorators: [{
|
|
50
|
-
type: Optional
|
|
51
|
-
}] }];
|
|
52
|
-
} });
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Arguments for the `SendMessage` event.
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
class SendMessageEvent {
|
|
59
|
-
/**
|
|
60
|
-
* @hidden
|
|
61
|
-
*/
|
|
62
|
-
constructor(message) {
|
|
63
|
-
this.message = message;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const noop = () => { };
|
|
68
|
-
const handlers = {
|
|
69
|
-
'reply': (action, sender) => {
|
|
70
|
-
sender.sendMessage.emit(new SendMessageEvent({
|
|
71
|
-
author: sender.user,
|
|
72
|
-
text: action.value,
|
|
73
|
-
timestamp: new Date()
|
|
74
|
-
}));
|
|
75
|
-
},
|
|
76
|
-
'call': (action) => {
|
|
77
|
-
window.open('tel:' + action.value);
|
|
78
|
-
},
|
|
79
|
-
'openUrl': (action) => {
|
|
80
|
-
window.open(action.value);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* @hidden
|
|
85
|
-
*/
|
|
86
|
-
const makeHandler = (action) => handlers[action.type] || noop;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Defines a template that will be used for displaying Chat messages. To define an attachment
|
|
90
|
-
* template, nest an `<ng-template>` tag with the `kendoChatMessageTemplate` attribute inside the
|
|
91
|
-
* `<kendo-chat>` component. The template context is set to the message instance. For more information,
|
|
92
|
-
* refer to the article on [message templates]({% slug message_templates_chat %}).
|
|
93
|
-
*
|
|
94
|
-
* {% meta height:700 %}
|
|
95
|
-
* {% embed_file chat/messages/templates/app.component.ts preview %}
|
|
96
|
-
* {% embed_file shared/app.module.ts preview %}
|
|
97
|
-
* {% embed_file shared/main.ts hidden %}
|
|
98
|
-
* {% endmeta %}
|
|
99
|
-
*/
|
|
100
|
-
class MessageTemplateDirective {
|
|
101
|
-
constructor(templateRef) {
|
|
102
|
-
this.templateRef = templateRef;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
MessageTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
106
|
-
MessageTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: MessageTemplateDirective, isStandalone: true, selector: "[kendoChatMessageTemplate]", ngImport: i0 });
|
|
107
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageTemplateDirective, decorators: [{
|
|
108
|
-
type: Directive,
|
|
109
|
-
args: [{
|
|
110
|
-
selector: '[kendoChatMessageTemplate]',
|
|
111
|
-
standalone: true
|
|
112
|
-
}]
|
|
113
|
-
}], ctorParameters: function () {
|
|
114
|
-
return [{ type: i0.TemplateRef, decorators: [{
|
|
115
|
-
type: Optional
|
|
116
|
-
}] }];
|
|
117
|
-
} });
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @hidden
|
|
121
|
-
*/
|
|
122
|
-
const packageMetadata = {
|
|
123
|
-
name: '@progress/kendo-angular-conversational-ui',
|
|
124
|
-
productName: 'Kendo UI for Angular',
|
|
125
|
-
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
126
|
-
publishDate: 1729874504,
|
|
127
|
-
version: '17.0.0-develop.21',
|
|
128
|
-
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Creates a message box area that overrides the default message box of the Conversational UI Component.
|
|
133
|
-
* To define a message-box template, nest an `<ng-template>` tag with the `kendoChatMessageBoxTemplate` directive inside the `<kendo-chat>` tag
|
|
134
|
-
* [see example]({% slug message_box %}#toc-message-box-template).
|
|
135
|
-
*/
|
|
136
|
-
class ChatMessageBoxTemplateDirective {
|
|
137
|
-
constructor(templateRef) {
|
|
138
|
-
this.templateRef = templateRef;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
ChatMessageBoxTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChatMessageBoxTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
142
|
-
ChatMessageBoxTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ChatMessageBoxTemplateDirective, isStandalone: true, selector: "[kendoChatMessageBoxTemplate]", ngImport: i0 });
|
|
143
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChatMessageBoxTemplateDirective, decorators: [{
|
|
144
|
-
type: Directive,
|
|
145
|
-
args: [{
|
|
146
|
-
selector: '[kendoChatMessageBoxTemplate]',
|
|
147
|
-
standalone: true
|
|
148
|
-
}]
|
|
149
|
-
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @hidden
|
|
153
|
-
*/
|
|
154
|
-
class MessageBoxComponent {
|
|
155
|
-
constructor() {
|
|
156
|
-
this.borderColor = 'inherit';
|
|
157
|
-
this.sendMessage = new EventEmitter();
|
|
158
|
-
/**
|
|
159
|
-
* @hidden
|
|
160
|
-
*/
|
|
161
|
-
this.sendIcon = paperPlaneIcon;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* @hidden
|
|
165
|
-
*/
|
|
166
|
-
sendClick() {
|
|
167
|
-
const input = this.messageBoxInput;
|
|
168
|
-
const value = input.value;
|
|
169
|
-
if (!value) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
const message = {
|
|
173
|
-
author: this.user,
|
|
174
|
-
text: value,
|
|
175
|
-
timestamp: new Date()
|
|
176
|
-
};
|
|
177
|
-
this.sendMessage.emit(new SendMessageEvent(message));
|
|
178
|
-
input.value = null;
|
|
179
|
-
input.focus();
|
|
180
|
-
this.autoScroll = true;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* @hidden
|
|
184
|
-
*/
|
|
185
|
-
inputKeydown(e) {
|
|
186
|
-
if (e.keyCode === Keys.Enter) {
|
|
187
|
-
this.sendClick();
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* @hidden
|
|
192
|
-
*/
|
|
193
|
-
textAreaKeydown(e) {
|
|
194
|
-
const isEnter = e.keyCode === Keys.Enter;
|
|
195
|
-
if (!isEnter) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
const newLine = (e.metaKey || e.ctrlKey);
|
|
199
|
-
const enterOnly = !(e.shiftKey || e.metaKey || e.ctrlKey);
|
|
200
|
-
if (enterOnly) {
|
|
201
|
-
e.preventDefault();
|
|
202
|
-
this.sendClick();
|
|
203
|
-
}
|
|
204
|
-
if (newLine) {
|
|
205
|
-
this.messageBoxInput.value += `\r\n`;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* @hidden
|
|
210
|
-
*/
|
|
211
|
-
textFor(key) {
|
|
212
|
-
return this.localization.get(key);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
MessageBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
216
|
-
MessageBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MessageBoxComponent, isStandalone: true, selector: "kendo-message-box", inputs: { user: "user", autoScroll: "autoScroll", type: "type", localization: "localization", messageBoxTemplate: "messageBoxTemplate" }, outputs: { sendMessage: "sendMessage" }, host: { properties: { "style.border-color": "this.borderColor" } }, viewQueries: [{ propertyName: "messageBoxInput", first: true, predicate: ["messageBoxInput"], descendants: true }], ngImport: i0, template: `
|
|
217
|
-
<ng-container *ngIf="!messageBoxTemplate">
|
|
218
|
-
<kendo-textbox
|
|
219
|
-
*ngIf="type === 'textbox'"
|
|
220
|
-
#messageBoxInput
|
|
221
|
-
class="k-message-box"
|
|
222
|
-
[inputAttributes]="{
|
|
223
|
-
'aria-label': textFor('messageBoxInputLabel')
|
|
224
|
-
}"
|
|
225
|
-
[placeholder]="textFor('messagePlaceholder')"
|
|
226
|
-
(keydown)="inputKeydown($event)"
|
|
227
|
-
>
|
|
228
|
-
<ng-template kendoTextBoxSuffixTemplate>
|
|
229
|
-
<kendo-textbox-separator></kendo-textbox-separator>
|
|
230
|
-
<button
|
|
231
|
-
kendoButton
|
|
232
|
-
fillMode="flat"
|
|
233
|
-
class="k-chat-send"
|
|
234
|
-
icon="paper-plane"
|
|
235
|
-
[svgIcon]="sendIcon"
|
|
236
|
-
[tabindex]="0"
|
|
237
|
-
[attr.title]="textFor('send')"
|
|
238
|
-
(click)="sendClick()"
|
|
239
|
-
>
|
|
240
|
-
</button>
|
|
241
|
-
</ng-template>
|
|
242
|
-
</kendo-textbox>
|
|
243
|
-
|
|
244
|
-
<kendo-textarea
|
|
245
|
-
*ngIf="type === 'textarea'"
|
|
246
|
-
#messageBoxInput
|
|
247
|
-
class="k-message-box !k-align-items-end"
|
|
248
|
-
resizable="none"
|
|
249
|
-
[rows]="3"
|
|
250
|
-
[inputAttributes]="{
|
|
251
|
-
'aria-label': textFor('messageBoxInputLabel')
|
|
252
|
-
}"
|
|
253
|
-
[placeholder]="textFor('messagePlaceholder')"
|
|
254
|
-
[showSuffixSeparator]="true"
|
|
255
|
-
(keydown)="textAreaKeydown($event)"
|
|
256
|
-
>
|
|
257
|
-
<kendo-textarea-suffix>
|
|
258
|
-
<button
|
|
259
|
-
kendoButton
|
|
260
|
-
fillMode="flat"
|
|
261
|
-
class="k-chat-send"
|
|
262
|
-
icon="paper-plane"
|
|
263
|
-
[svgIcon]="sendIcon"
|
|
264
|
-
[tabindex]="0"
|
|
265
|
-
[attr.title]="textFor('send')"
|
|
266
|
-
(click)="sendClick()"
|
|
267
|
-
>
|
|
268
|
-
</button>
|
|
269
|
-
</kendo-textarea-suffix>
|
|
270
|
-
</kendo-textarea>
|
|
271
|
-
</ng-container>
|
|
272
|
-
|
|
273
|
-
<ng-template *ngIf="messageBoxTemplate" [ngTemplateOutlet]="messageBoxTemplate?.templateRef"></ng-template>
|
|
274
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "component", type: InputSeparatorComponent, selector: "kendo-input-separator, kendo-textbox-separator", inputs: ["orientation"] }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "[kendoTextBoxSuffixTemplate]", inputs: ["showSeparator"] }, { kind: "component", type: TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }] });
|
|
275
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageBoxComponent, decorators: [{
|
|
276
|
-
type: Component,
|
|
277
|
-
args: [{
|
|
278
|
-
selector: 'kendo-message-box',
|
|
279
|
-
template: `
|
|
280
|
-
<ng-container *ngIf="!messageBoxTemplate">
|
|
281
|
-
<kendo-textbox
|
|
282
|
-
*ngIf="type === 'textbox'"
|
|
283
|
-
#messageBoxInput
|
|
284
|
-
class="k-message-box"
|
|
285
|
-
[inputAttributes]="{
|
|
286
|
-
'aria-label': textFor('messageBoxInputLabel')
|
|
287
|
-
}"
|
|
288
|
-
[placeholder]="textFor('messagePlaceholder')"
|
|
289
|
-
(keydown)="inputKeydown($event)"
|
|
290
|
-
>
|
|
291
|
-
<ng-template kendoTextBoxSuffixTemplate>
|
|
292
|
-
<kendo-textbox-separator></kendo-textbox-separator>
|
|
293
|
-
<button
|
|
294
|
-
kendoButton
|
|
295
|
-
fillMode="flat"
|
|
296
|
-
class="k-chat-send"
|
|
297
|
-
icon="paper-plane"
|
|
298
|
-
[svgIcon]="sendIcon"
|
|
299
|
-
[tabindex]="0"
|
|
300
|
-
[attr.title]="textFor('send')"
|
|
301
|
-
(click)="sendClick()"
|
|
302
|
-
>
|
|
303
|
-
</button>
|
|
304
|
-
</ng-template>
|
|
305
|
-
</kendo-textbox>
|
|
306
|
-
|
|
307
|
-
<kendo-textarea
|
|
308
|
-
*ngIf="type === 'textarea'"
|
|
309
|
-
#messageBoxInput
|
|
310
|
-
class="k-message-box !k-align-items-end"
|
|
311
|
-
resizable="none"
|
|
312
|
-
[rows]="3"
|
|
313
|
-
[inputAttributes]="{
|
|
314
|
-
'aria-label': textFor('messageBoxInputLabel')
|
|
315
|
-
}"
|
|
316
|
-
[placeholder]="textFor('messagePlaceholder')"
|
|
317
|
-
[showSuffixSeparator]="true"
|
|
318
|
-
(keydown)="textAreaKeydown($event)"
|
|
319
|
-
>
|
|
320
|
-
<kendo-textarea-suffix>
|
|
321
|
-
<button
|
|
322
|
-
kendoButton
|
|
323
|
-
fillMode="flat"
|
|
324
|
-
class="k-chat-send"
|
|
325
|
-
icon="paper-plane"
|
|
326
|
-
[svgIcon]="sendIcon"
|
|
327
|
-
[tabindex]="0"
|
|
328
|
-
[attr.title]="textFor('send')"
|
|
329
|
-
(click)="sendClick()"
|
|
330
|
-
>
|
|
331
|
-
</button>
|
|
332
|
-
</kendo-textarea-suffix>
|
|
333
|
-
</kendo-textarea>
|
|
334
|
-
</ng-container>
|
|
335
|
-
|
|
336
|
-
<ng-template *ngIf="messageBoxTemplate" [ngTemplateOutlet]="messageBoxTemplate?.templateRef"></ng-template>
|
|
337
|
-
`,
|
|
338
|
-
standalone: true,
|
|
339
|
-
imports: [NgIf, ButtonComponent, NgTemplateOutlet, TextBoxComponent, TextAreaComponent, InputSeparatorComponent, TextBoxSuffixTemplateDirective, TextAreaSuffixComponent]
|
|
340
|
-
}]
|
|
341
|
-
}], propDecorators: { borderColor: [{
|
|
342
|
-
type: HostBinding,
|
|
343
|
-
args: ['style.border-color']
|
|
344
|
-
}], messageBoxInput: [{
|
|
345
|
-
type: ViewChild,
|
|
346
|
-
args: ['messageBoxInput', { static: false }]
|
|
347
|
-
}], user: [{
|
|
348
|
-
type: Input
|
|
349
|
-
}], autoScroll: [{
|
|
350
|
-
type: Input
|
|
351
|
-
}], type: [{
|
|
352
|
-
type: Input
|
|
353
|
-
}], localization: [{
|
|
354
|
-
type: Input
|
|
355
|
-
}], messageBoxTemplate: [{
|
|
356
|
-
type: Input
|
|
357
|
-
}], sendMessage: [{
|
|
358
|
-
type: Output
|
|
359
|
-
}] } });
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* @hidden
|
|
363
|
-
*/
|
|
364
|
-
class PreventableEvent {
|
|
365
|
-
constructor() {
|
|
366
|
-
this.prevented = false;
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Prevents the default action for a specified event.
|
|
370
|
-
* In this way, the source component suppresses
|
|
371
|
-
* the built-in behavior that follows the event.
|
|
372
|
-
*/
|
|
373
|
-
preventDefault() {
|
|
374
|
-
this.prevented = true;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Returns `true` if the event was prevented
|
|
378
|
-
* by any of its subscribers.
|
|
379
|
-
*
|
|
380
|
-
* @returns `true` if the default action was prevented.
|
|
381
|
-
* Otherwise, returns `false`.
|
|
382
|
-
*/
|
|
383
|
-
isDefaultPrevented() {
|
|
384
|
-
return this.prevented;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Arguments for the `executeAction` event. The `executeAction` event fires when the user clicks
|
|
390
|
-
* a quick action button. Calling `preventDefault()` suppresses the built-in action handler.
|
|
391
|
-
*/
|
|
392
|
-
class ExecuteActionEvent extends PreventableEvent {
|
|
393
|
-
/**
|
|
394
|
-
* @hidden
|
|
395
|
-
*/
|
|
396
|
-
constructor(action, message) {
|
|
397
|
-
super();
|
|
398
|
-
this.action = action;
|
|
399
|
-
this.message = message;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* @hidden
|
|
405
|
-
*/
|
|
406
|
-
const closest = (node, predicate) => {
|
|
407
|
-
while (node && !predicate(node)) {
|
|
408
|
-
node = node.parentNode;
|
|
409
|
-
}
|
|
410
|
-
return node;
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* @hidden
|
|
415
|
-
*/
|
|
416
|
-
class ChatItem {
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* @hidden
|
|
421
|
-
*/
|
|
422
|
-
const isAuthor = (user, msg) => user && msg.author && user.id === msg.author.id;
|
|
423
|
-
const last = (arr) => arr[arr.length - 1];
|
|
424
|
-
const dateChanged = (curr, prev) => (curr && prev) && (prev.getDate() !== curr.getDate() ||
|
|
425
|
-
prev.getMonth() !== curr.getMonth() ||
|
|
426
|
-
prev.getFullYear() !== curr.getFullYear());
|
|
427
|
-
const addDateMarker = (acc, msg) => {
|
|
428
|
-
const timestamp = msg.timestamp;
|
|
429
|
-
const lastItem = last(acc);
|
|
430
|
-
if (!timestamp) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
if (!lastItem || dateChanged(timestamp, lastItem.timestamp)) {
|
|
434
|
-
const dateMarker = {
|
|
435
|
-
type: 'date-marker',
|
|
436
|
-
timestamp: timestamp,
|
|
437
|
-
trackBy: timestamp.getTime()
|
|
438
|
-
};
|
|
439
|
-
acc.push(dateMarker);
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
const groupMessages = (acc, msg, isLastMessage) => {
|
|
443
|
-
const lastItem = last(acc);
|
|
444
|
-
let messages;
|
|
445
|
-
if (isDevMode() && !msg.author) {
|
|
446
|
-
throw new Error('Author must be set for message: ' + JSON.stringify(msg));
|
|
447
|
-
}
|
|
448
|
-
if (msg.typing && !isLastMessage) {
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
if (lastItem && lastItem.type === 'message-group') {
|
|
452
|
-
messages = lastItem.messages;
|
|
453
|
-
}
|
|
454
|
-
if (messages && isAuthor(msg.author, last(messages))) {
|
|
455
|
-
messages.push(msg);
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
acc.push({
|
|
459
|
-
type: 'message-group',
|
|
460
|
-
messages: [msg],
|
|
461
|
-
author: msg.author,
|
|
462
|
-
timestamp: msg.timestamp,
|
|
463
|
-
trackBy: msg
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
const groupItems = (total) => (acc, msg, index) => {
|
|
468
|
-
const isLastMessage = index === total - 1;
|
|
469
|
-
addDateMarker(acc, msg);
|
|
470
|
-
groupMessages(acc, msg, isLastMessage);
|
|
471
|
-
if (msg.attachments && msg.attachments.length > 1) {
|
|
472
|
-
acc.push({
|
|
473
|
-
type: 'attachment-group',
|
|
474
|
-
attachments: msg.attachments,
|
|
475
|
-
attachmentLayout: msg.attachmentLayout,
|
|
476
|
-
timestamp: msg.timestamp,
|
|
477
|
-
trackBy: msg
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
if (msg.suggestedActions && isLastMessage) {
|
|
481
|
-
acc.push({
|
|
482
|
-
type: 'action-group',
|
|
483
|
-
actions: msg.suggestedActions,
|
|
484
|
-
timestamp: msg.timestamp,
|
|
485
|
-
trackBy: msg
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
return acc;
|
|
489
|
-
};
|
|
490
|
-
/**
|
|
491
|
-
* @hidden
|
|
492
|
-
*/
|
|
493
|
-
const chatView = (messages) => messages.reduce(groupItems(messages.length), []);
|
|
494
|
-
|
|
495
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
496
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
497
|
-
/**
|
|
498
|
-
* @hidden
|
|
499
|
-
*/
|
|
500
|
-
class SuggestedActionsComponent extends ChatItem {
|
|
501
|
-
constructor() {
|
|
502
|
-
super(...arguments);
|
|
503
|
-
this.dispatch = new EventEmitter();
|
|
504
|
-
this.defaultClass = true;
|
|
505
|
-
this.selectedIndex = 0;
|
|
506
|
-
this.keyHandlers = {
|
|
507
|
-
[Keys.Tab]: (e) => this.changeSelectedIndex(e),
|
|
508
|
-
[Keys.Enter]: (_, action) => this.actionClick(action),
|
|
509
|
-
[Keys.Space]: (_, action) => this.actionClick(action),
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
isSelected(index) {
|
|
513
|
-
return this.selected && this.selectedIndex === index;
|
|
514
|
-
}
|
|
515
|
-
actionClick(action) {
|
|
516
|
-
this.dispatch.next(action);
|
|
517
|
-
}
|
|
518
|
-
actionKeydown(e, action) {
|
|
519
|
-
const handler = this.keyHandlers[e.keyCode];
|
|
520
|
-
if (handler) {
|
|
521
|
-
handler(e, action);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
focus() { }
|
|
525
|
-
changeSelectedIndex(e) {
|
|
526
|
-
const offset = e.shiftKey ? -1 : 1;
|
|
527
|
-
const prevIndex = this.selectedIndex;
|
|
528
|
-
this.selectedIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
SuggestedActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SuggestedActionsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
532
|
-
SuggestedActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: SuggestedActionsComponent, isStandalone: true, selector: "kendo-chat-suggested-actions", inputs: { actions: "actions", tabbable: "tabbable" }, outputs: { dispatch: "dispatch" }, host: { properties: { "class.k-quick-replies": "this.defaultClass" } }, providers: [{
|
|
533
|
-
provide: ChatItem,
|
|
534
|
-
useExisting: forwardRef(() => SuggestedActionsComponent)
|
|
535
|
-
}], viewQueries: [{ propertyName: "items", predicate: ["item"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
|
536
|
-
<span
|
|
537
|
-
#item
|
|
538
|
-
*ngFor="let action of actions; index as index; first as first; last as last"
|
|
539
|
-
class="k-quick-reply"
|
|
540
|
-
role="button"
|
|
541
|
-
[class.k-selected]="isSelected(index)"
|
|
542
|
-
[class.k-focus]="isSelected(index)"
|
|
543
|
-
[class.k-first]="first"
|
|
544
|
-
[class.k-last]="last"
|
|
545
|
-
[attr.tabindex]="0"
|
|
546
|
-
(click)="actionClick(action)"
|
|
547
|
-
(keydown)="actionKeydown($event, action)"
|
|
548
|
-
>
|
|
549
|
-
{{ action.title || action.value }}
|
|
550
|
-
</span>
|
|
551
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
552
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: SuggestedActionsComponent, decorators: [{
|
|
553
|
-
type: Component,
|
|
554
|
-
args: [{
|
|
555
|
-
selector: 'kendo-chat-suggested-actions',
|
|
556
|
-
providers: [{
|
|
557
|
-
provide: ChatItem,
|
|
558
|
-
useExisting: forwardRef(() => SuggestedActionsComponent)
|
|
559
|
-
}],
|
|
560
|
-
template: `
|
|
561
|
-
<span
|
|
562
|
-
#item
|
|
563
|
-
*ngFor="let action of actions; index as index; first as first; last as last"
|
|
564
|
-
class="k-quick-reply"
|
|
565
|
-
role="button"
|
|
566
|
-
[class.k-selected]="isSelected(index)"
|
|
567
|
-
[class.k-focus]="isSelected(index)"
|
|
568
|
-
[class.k-first]="first"
|
|
569
|
-
[class.k-last]="last"
|
|
570
|
-
[attr.tabindex]="0"
|
|
571
|
-
(click)="actionClick(action)"
|
|
572
|
-
(keydown)="actionKeydown($event, action)"
|
|
573
|
-
>
|
|
574
|
-
{{ action.title || action.value }}
|
|
575
|
-
</span>
|
|
576
|
-
`,
|
|
577
|
-
standalone: true,
|
|
578
|
-
imports: [NgFor]
|
|
579
|
-
}]
|
|
580
|
-
}], propDecorators: { actions: [{
|
|
581
|
-
type: Input
|
|
582
|
-
}], tabbable: [{
|
|
583
|
-
type: Input
|
|
584
|
-
}], dispatch: [{
|
|
585
|
-
type: Output
|
|
586
|
-
}], defaultClass: [{
|
|
587
|
-
type: HostBinding,
|
|
588
|
-
args: ['class.k-quick-replies']
|
|
589
|
-
}], items: [{
|
|
590
|
-
type: ViewChildren,
|
|
591
|
-
args: ['item']
|
|
592
|
-
}] } });
|
|
593
|
-
|
|
594
|
-
// eslint-disable no-forward-ref
|
|
595
|
-
/**
|
|
596
|
-
* @hidden
|
|
597
|
-
*/
|
|
598
|
-
class MessageComponent extends ChatItem {
|
|
599
|
-
constructor(element, intl) {
|
|
600
|
-
super();
|
|
601
|
-
this.element = element;
|
|
602
|
-
this.intl = intl;
|
|
603
|
-
this.cssClass = true;
|
|
604
|
-
}
|
|
605
|
-
get tabIndex() {
|
|
606
|
-
return this.tabbable ? '0' : '-1';
|
|
607
|
-
}
|
|
608
|
-
formatTimeStamp(date) {
|
|
609
|
-
return this.intl.formatDate(date, { datetime: 'short' });
|
|
610
|
-
}
|
|
611
|
-
focus() {
|
|
612
|
-
this.element.nativeElement.focus();
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
MessageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }], target: i0.ɵɵFactoryTarget.Component });
|
|
616
|
-
MessageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MessageComponent, isStandalone: true, selector: "kendo-chat-message", inputs: { message: "message", tabbable: "tabbable", template: "template" }, host: { properties: { "class.k-message": "this.cssClass", "class.k-selected": "this.selected", "class.k-focus": "this.selected", "attr.tabIndex": "this.tabIndex" } }, providers: [{
|
|
617
|
-
provide: ChatItem,
|
|
618
|
-
useExisting: forwardRef(() => MessageComponent)
|
|
619
|
-
}], usesInheritance: true, ngImport: i0, template: `
|
|
620
|
-
<time
|
|
621
|
-
[attr.aria-hidden]="!selected"
|
|
622
|
-
class="k-message-time"
|
|
623
|
-
*ngIf="message.timestamp"
|
|
624
|
-
>
|
|
625
|
-
{{ formatTimeStamp(message.timestamp) }}
|
|
626
|
-
</time>
|
|
627
|
-
|
|
628
|
-
<ng-container *ngIf="!message.typing; else typing">
|
|
629
|
-
<div class="k-chat-bubble" *ngIf="template">
|
|
630
|
-
<ng-container
|
|
631
|
-
*ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
|
|
632
|
-
>
|
|
633
|
-
</ng-container>
|
|
634
|
-
</div>
|
|
635
|
-
|
|
636
|
-
<div class="k-chat-bubble" *ngIf="!template && message.text">
|
|
637
|
-
{{message.text}}
|
|
638
|
-
</div>
|
|
639
|
-
</ng-container>
|
|
640
|
-
|
|
641
|
-
<span
|
|
642
|
-
class="k-message-status"
|
|
643
|
-
*ngIf="message.status"
|
|
644
|
-
>
|
|
645
|
-
{{ message.status }}
|
|
646
|
-
</span>
|
|
647
|
-
|
|
648
|
-
<ng-template #typing>
|
|
649
|
-
<div class="k-chat-bubble">
|
|
650
|
-
<div class="k-typing-indicator">
|
|
651
|
-
<span></span>
|
|
652
|
-
<span></span>
|
|
653
|
-
<span></span>
|
|
654
|
-
</div>
|
|
655
|
-
</div>
|
|
656
|
-
</ng-template>
|
|
657
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
658
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageComponent, decorators: [{
|
|
659
|
-
type: Component,
|
|
660
|
-
args: [{
|
|
661
|
-
selector: 'kendo-chat-message',
|
|
662
|
-
providers: [{
|
|
663
|
-
provide: ChatItem,
|
|
664
|
-
useExisting: forwardRef(() => MessageComponent)
|
|
665
|
-
}],
|
|
666
|
-
template: `
|
|
667
|
-
<time
|
|
668
|
-
[attr.aria-hidden]="!selected"
|
|
669
|
-
class="k-message-time"
|
|
670
|
-
*ngIf="message.timestamp"
|
|
671
|
-
>
|
|
672
|
-
{{ formatTimeStamp(message.timestamp) }}
|
|
673
|
-
</time>
|
|
674
|
-
|
|
675
|
-
<ng-container *ngIf="!message.typing; else typing">
|
|
676
|
-
<div class="k-chat-bubble" *ngIf="template">
|
|
677
|
-
<ng-container
|
|
678
|
-
*ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
|
|
679
|
-
>
|
|
680
|
-
</ng-container>
|
|
681
|
-
</div>
|
|
682
|
-
|
|
683
|
-
<div class="k-chat-bubble" *ngIf="!template && message.text">
|
|
684
|
-
{{message.text}}
|
|
685
|
-
</div>
|
|
686
|
-
</ng-container>
|
|
687
|
-
|
|
688
|
-
<span
|
|
689
|
-
class="k-message-status"
|
|
690
|
-
*ngIf="message.status"
|
|
691
|
-
>
|
|
692
|
-
{{ message.status }}
|
|
693
|
-
</span>
|
|
694
|
-
|
|
695
|
-
<ng-template #typing>
|
|
696
|
-
<div class="k-chat-bubble">
|
|
697
|
-
<div class="k-typing-indicator">
|
|
698
|
-
<span></span>
|
|
699
|
-
<span></span>
|
|
700
|
-
<span></span>
|
|
701
|
-
</div>
|
|
702
|
-
</div>
|
|
703
|
-
</ng-template>
|
|
704
|
-
`,
|
|
705
|
-
standalone: true,
|
|
706
|
-
imports: [NgIf, NgTemplateOutlet]
|
|
707
|
-
}]
|
|
708
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }]; }, propDecorators: { message: [{
|
|
709
|
-
type: Input
|
|
710
|
-
}], tabbable: [{
|
|
711
|
-
type: Input
|
|
712
|
-
}], template: [{
|
|
713
|
-
type: Input
|
|
714
|
-
}], cssClass: [{
|
|
715
|
-
type: HostBinding,
|
|
716
|
-
args: ['class.k-message']
|
|
717
|
-
}], selected: [{
|
|
718
|
-
type: HostBinding,
|
|
719
|
-
args: ['class.k-selected']
|
|
720
|
-
}, {
|
|
721
|
-
type: HostBinding,
|
|
722
|
-
args: ['class.k-focus']
|
|
723
|
-
}], tabIndex: [{
|
|
724
|
-
type: HostBinding,
|
|
725
|
-
args: ['attr.tabIndex']
|
|
726
|
-
}] } });
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* @hidden
|
|
730
|
-
*/
|
|
731
|
-
class AttachmentComponent {
|
|
732
|
-
set attachment(value) {
|
|
733
|
-
this._attachment = value;
|
|
734
|
-
this.context = {
|
|
735
|
-
$implicit: this.attachment
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
|
-
get attachment() {
|
|
739
|
-
return this._attachment;
|
|
740
|
-
}
|
|
741
|
-
get image() {
|
|
742
|
-
return this.contentType.indexOf('image/') === 0;
|
|
743
|
-
}
|
|
744
|
-
get unknown() {
|
|
745
|
-
return !this.image;
|
|
746
|
-
}
|
|
747
|
-
get contentType() {
|
|
748
|
-
return this.attachment.contentType || '';
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
AttachmentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AttachmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
752
|
-
AttachmentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AttachmentComponent, isStandalone: true, selector: "kendo-chat-attachment", inputs: { attachment: "attachment", template: "template" }, ngImport: i0, template: `
|
|
753
|
-
<ng-container *ngIf="template">
|
|
754
|
-
<ng-container *ngTemplateOutlet="template.templateRef; context: context;">
|
|
755
|
-
</ng-container>
|
|
756
|
-
</ng-container>
|
|
757
|
-
|
|
758
|
-
<div *ngIf="!template" class="k-card">
|
|
759
|
-
<div class="k-card-body">
|
|
760
|
-
<h5 class="k-card-title" *ngIf="attachment.title">
|
|
761
|
-
{{ attachment.title }}
|
|
762
|
-
</h5>
|
|
763
|
-
<h6 class="k-card-subtitle" *ngIf="attachment.subtitle">
|
|
764
|
-
{{ attachment.subtitle }}
|
|
765
|
-
</h6>
|
|
766
|
-
<img *ngIf="image" [attr.src]="attachment.content" />
|
|
767
|
-
<ng-container *ngIf="unknown">
|
|
768
|
-
{{ attachment.content }}
|
|
769
|
-
</ng-container>
|
|
770
|
-
</div>
|
|
771
|
-
</div>
|
|
772
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
773
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AttachmentComponent, decorators: [{
|
|
774
|
-
type: Component,
|
|
775
|
-
args: [{
|
|
776
|
-
selector: 'kendo-chat-attachment',
|
|
777
|
-
template: `
|
|
778
|
-
<ng-container *ngIf="template">
|
|
779
|
-
<ng-container *ngTemplateOutlet="template.templateRef; context: context;">
|
|
780
|
-
</ng-container>
|
|
781
|
-
</ng-container>
|
|
782
|
-
|
|
783
|
-
<div *ngIf="!template" class="k-card">
|
|
784
|
-
<div class="k-card-body">
|
|
785
|
-
<h5 class="k-card-title" *ngIf="attachment.title">
|
|
786
|
-
{{ attachment.title }}
|
|
787
|
-
</h5>
|
|
788
|
-
<h6 class="k-card-subtitle" *ngIf="attachment.subtitle">
|
|
789
|
-
{{ attachment.subtitle }}
|
|
790
|
-
</h6>
|
|
791
|
-
<img *ngIf="image" [attr.src]="attachment.content" />
|
|
792
|
-
<ng-container *ngIf="unknown">
|
|
793
|
-
{{ attachment.content }}
|
|
794
|
-
</ng-container>
|
|
795
|
-
</div>
|
|
796
|
-
</div>
|
|
797
|
-
`,
|
|
798
|
-
standalone: true,
|
|
799
|
-
imports: [NgIf, NgTemplateOutlet]
|
|
800
|
-
}]
|
|
801
|
-
}], propDecorators: { attachment: [{
|
|
802
|
-
type: Input
|
|
803
|
-
}], template: [{
|
|
804
|
-
type: Input
|
|
805
|
-
}] } });
|
|
806
|
-
|
|
807
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
808
|
-
// eslint-disable no-forward-ref
|
|
809
|
-
/**
|
|
810
|
-
* @hidden
|
|
811
|
-
*/
|
|
812
|
-
class MessageAttachmentsComponent extends ChatItem {
|
|
813
|
-
constructor(zone, localizationService) {
|
|
814
|
-
super();
|
|
815
|
-
this.zone = zone;
|
|
816
|
-
this.localizationService = localizationService;
|
|
817
|
-
/**
|
|
818
|
-
* @hidden
|
|
819
|
-
*/
|
|
820
|
-
this.chevronLeftIcon = chevronLeftIcon;
|
|
821
|
-
/**
|
|
822
|
-
* @hidden
|
|
823
|
-
*/
|
|
824
|
-
this.chevronRightIcon = chevronRightIcon;
|
|
825
|
-
this.scrollPosition = 0;
|
|
826
|
-
this.selectedIndex = 0;
|
|
827
|
-
this.carouselKeyHandlers = {
|
|
828
|
-
[Keys.ArrowLeft]: (e) => this.navigateTo(e, this.direction === 'rtl' ? 1 : -1),
|
|
829
|
-
[Keys.ArrowRight]: (e) => this.navigateTo(e, this.direction === 'rtl' ? -1 : 1)
|
|
830
|
-
};
|
|
831
|
-
this.listKeyHandlers = {
|
|
832
|
-
[Keys.ArrowUp]: (e) => this.navigateTo(e, -1),
|
|
833
|
-
[Keys.ArrowDown]: (e) => this.navigateTo(e, 1)
|
|
834
|
-
};
|
|
835
|
-
this.direction = this.localizationService.rtl ? 'rtl' : 'ltr';
|
|
836
|
-
}
|
|
837
|
-
get carousel() {
|
|
838
|
-
return this.layout !== 'list';
|
|
839
|
-
}
|
|
840
|
-
get showLeftArrow() {
|
|
841
|
-
return this.carousel && this.direction === 'rtl' ? this.scrollPosition > -1 : this.scrollPosition > 0;
|
|
842
|
-
}
|
|
843
|
-
get showRightArrow() {
|
|
844
|
-
return this.carousel && this.direction === 'rtl' ? this.scrollPosition < 0 : this.scrollPosition < 1;
|
|
845
|
-
}
|
|
846
|
-
ngAfterViewInit() {
|
|
847
|
-
this.zone.runOutsideAngular(() => {
|
|
848
|
-
const scrollDebounceTime = 100;
|
|
849
|
-
this.scrollSubscription = fromEvent(this.deck.nativeElement, 'scroll')
|
|
850
|
-
.pipe(debounceTime(scrollDebounceTime))
|
|
851
|
-
.subscribe(() => this.onScroll());
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
ngOnDestroy() {
|
|
855
|
-
this.scrollSubscription.unsubscribe();
|
|
856
|
-
}
|
|
857
|
-
isSelected(index) {
|
|
858
|
-
return this.selectedIndex === index;
|
|
859
|
-
}
|
|
860
|
-
itemKeydown(e, attachment) {
|
|
861
|
-
const keyHandlers = this.layout === 'list' ?
|
|
862
|
-
this.listKeyHandlers : this.carouselKeyHandlers;
|
|
863
|
-
const handler = keyHandlers[e.keyCode];
|
|
864
|
-
if (handler) {
|
|
865
|
-
handler(e, attachment);
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
itemClick(index) {
|
|
869
|
-
this.select(index);
|
|
870
|
-
}
|
|
871
|
-
focus() {
|
|
872
|
-
this.select(this.selectedIndex);
|
|
873
|
-
}
|
|
874
|
-
scrollTo(dir) {
|
|
875
|
-
const el = this.deck.nativeElement;
|
|
876
|
-
const scrollStep = el.scrollWidth / this.items.length;
|
|
877
|
-
const max = el.scrollWidth - el.offsetWidth;
|
|
878
|
-
const pos = el.scrollLeft + scrollStep * dir;
|
|
879
|
-
el.scrollLeft = this.direction === 'rtl' ? Math.min(0, max, pos) : Math.max(0, Math.min(max, pos));
|
|
880
|
-
}
|
|
881
|
-
select(index) {
|
|
882
|
-
this.selectedIndex = index;
|
|
883
|
-
const item = this.items.toArray()[index];
|
|
884
|
-
if (item) {
|
|
885
|
-
item.nativeElement.focus();
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
navigateTo(e, offset) {
|
|
889
|
-
const prevIndex = this.selectedIndex;
|
|
890
|
-
const nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
|
|
891
|
-
if (nextIndex !== prevIndex) {
|
|
892
|
-
this.select(nextIndex);
|
|
893
|
-
e.preventDefault();
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
onScroll() {
|
|
897
|
-
const el = this.deck.nativeElement;
|
|
898
|
-
if (el.scrollWidth === 0) {
|
|
899
|
-
return;
|
|
900
|
-
}
|
|
901
|
-
const pos = el.scrollLeft / (el.scrollWidth - el.offsetWidth);
|
|
902
|
-
if (pos !== this.scrollPosition) {
|
|
903
|
-
this.zone.run(() => {
|
|
904
|
-
this.scrollPosition = pos;
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
/**
|
|
909
|
-
* @hidden
|
|
910
|
-
*/
|
|
911
|
-
textFor(key) {
|
|
912
|
-
return this.localization.get(key);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
MessageAttachmentsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageAttachmentsComponent, deps: [{ token: i0.NgZone }, { token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
916
|
-
MessageAttachmentsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MessageAttachmentsComponent, isStandalone: true, selector: "kendo-chat-message-attachments", inputs: { attachments: "attachments", layout: "layout", tabbable: "tabbable", template: "template", localization: "localization" }, host: { properties: { "class.k-card-deck-scrollwrap": "this.carousel" } }, providers: [{
|
|
917
|
-
provide: ChatItem,
|
|
918
|
-
useExisting: forwardRef(() => MessageAttachmentsComponent)
|
|
919
|
-
}], viewQueries: [{ propertyName: "deck", first: true, predicate: ["deck"], descendants: true, read: ElementRef, static: true }, { propertyName: "items", predicate: ["item"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: `
|
|
920
|
-
<button
|
|
921
|
-
*ngIf="showLeftArrow"
|
|
922
|
-
(click)="scrollTo(-1)"
|
|
923
|
-
kendoButton
|
|
924
|
-
tabindex="-1"
|
|
925
|
-
[attr.title]="textFor('messageAttachmentLeftArrow')"
|
|
926
|
-
[svgIcon]="chevronLeftIcon"
|
|
927
|
-
icon="chevron-left"
|
|
928
|
-
>
|
|
929
|
-
</button>
|
|
930
|
-
<div
|
|
931
|
-
#deck
|
|
932
|
-
[class.k-card-deck]="carousel"
|
|
933
|
-
[class.k-card-list]="!carousel"
|
|
934
|
-
>
|
|
935
|
-
<kendo-chat-attachment #item
|
|
936
|
-
*ngFor="let att of attachments; index as index; first as first; last as last"
|
|
937
|
-
[attachment]="att"
|
|
938
|
-
[template]="template"
|
|
939
|
-
[class.k-selected]="isSelected(index)"
|
|
940
|
-
[class.k-focus]="isSelected(index)"
|
|
941
|
-
[class.k-card-wrap]="true"
|
|
942
|
-
[class.k-first]="first"
|
|
943
|
-
[class.k-last]="last"
|
|
944
|
-
[attr.tabindex]="tabbable && isSelected(index) ? '0' : '-1'"
|
|
945
|
-
(click)="itemClick(index)"
|
|
946
|
-
(keydown)="itemKeydown($event, att)"
|
|
947
|
-
>
|
|
948
|
-
</kendo-chat-attachment>
|
|
949
|
-
</div>
|
|
950
|
-
<button
|
|
951
|
-
*ngIf="showRightArrow"
|
|
952
|
-
(click)="scrollTo(1)"
|
|
953
|
-
kendoButton
|
|
954
|
-
tabindex="-1"
|
|
955
|
-
[attr.title]="textFor('messageAttachmentRightArrow')"
|
|
956
|
-
[svgIcon]="chevronRightIcon"
|
|
957
|
-
icon="chevron-right"
|
|
958
|
-
>
|
|
959
|
-
</button>
|
|
960
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: AttachmentComponent, selector: "kendo-chat-attachment", inputs: ["attachment", "template"] }] });
|
|
961
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageAttachmentsComponent, decorators: [{
|
|
962
|
-
type: Component,
|
|
963
|
-
args: [{
|
|
964
|
-
providers: [{
|
|
965
|
-
provide: ChatItem,
|
|
966
|
-
useExisting: forwardRef(() => MessageAttachmentsComponent)
|
|
967
|
-
}],
|
|
968
|
-
selector: 'kendo-chat-message-attachments',
|
|
969
|
-
template: `
|
|
970
|
-
<button
|
|
971
|
-
*ngIf="showLeftArrow"
|
|
972
|
-
(click)="scrollTo(-1)"
|
|
973
|
-
kendoButton
|
|
974
|
-
tabindex="-1"
|
|
975
|
-
[attr.title]="textFor('messageAttachmentLeftArrow')"
|
|
976
|
-
[svgIcon]="chevronLeftIcon"
|
|
977
|
-
icon="chevron-left"
|
|
978
|
-
>
|
|
979
|
-
</button>
|
|
980
|
-
<div
|
|
981
|
-
#deck
|
|
982
|
-
[class.k-card-deck]="carousel"
|
|
983
|
-
[class.k-card-list]="!carousel"
|
|
984
|
-
>
|
|
985
|
-
<kendo-chat-attachment #item
|
|
986
|
-
*ngFor="let att of attachments; index as index; first as first; last as last"
|
|
987
|
-
[attachment]="att"
|
|
988
|
-
[template]="template"
|
|
989
|
-
[class.k-selected]="isSelected(index)"
|
|
990
|
-
[class.k-focus]="isSelected(index)"
|
|
991
|
-
[class.k-card-wrap]="true"
|
|
992
|
-
[class.k-first]="first"
|
|
993
|
-
[class.k-last]="last"
|
|
994
|
-
[attr.tabindex]="tabbable && isSelected(index) ? '0' : '-1'"
|
|
995
|
-
(click)="itemClick(index)"
|
|
996
|
-
(keydown)="itemKeydown($event, att)"
|
|
997
|
-
>
|
|
998
|
-
</kendo-chat-attachment>
|
|
999
|
-
</div>
|
|
1000
|
-
<button
|
|
1001
|
-
*ngIf="showRightArrow"
|
|
1002
|
-
(click)="scrollTo(1)"
|
|
1003
|
-
kendoButton
|
|
1004
|
-
tabindex="-1"
|
|
1005
|
-
[attr.title]="textFor('messageAttachmentRightArrow')"
|
|
1006
|
-
[svgIcon]="chevronRightIcon"
|
|
1007
|
-
icon="chevron-right"
|
|
1008
|
-
>
|
|
1009
|
-
</button>
|
|
1010
|
-
`,
|
|
1011
|
-
standalone: true,
|
|
1012
|
-
imports: [NgIf, ButtonComponent, NgFor, AttachmentComponent]
|
|
1013
|
-
}]
|
|
1014
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i1$1.LocalizationService }]; }, propDecorators: { attachments: [{
|
|
1015
|
-
type: Input
|
|
1016
|
-
}], layout: [{
|
|
1017
|
-
type: Input
|
|
1018
|
-
}], tabbable: [{
|
|
1019
|
-
type: Input
|
|
1020
|
-
}], template: [{
|
|
1021
|
-
type: Input
|
|
1022
|
-
}], localization: [{
|
|
1023
|
-
type: Input
|
|
1024
|
-
}], carousel: [{
|
|
1025
|
-
type: HostBinding,
|
|
1026
|
-
args: ['class.k-card-deck-scrollwrap']
|
|
1027
|
-
}], deck: [{
|
|
1028
|
-
type: ViewChild,
|
|
1029
|
-
args: ['deck', { read: ElementRef, static: true }]
|
|
1030
|
-
}], items: [{
|
|
1031
|
-
type: ViewChildren,
|
|
1032
|
-
args: ['item', { read: ElementRef }]
|
|
1033
|
-
}] } });
|
|
1034
|
-
|
|
1035
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1036
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1037
|
-
/**
|
|
1038
|
-
* @hidden
|
|
1039
|
-
*/
|
|
1040
|
-
class MessageListComponent {
|
|
1041
|
-
constructor(element, intl, renderer) {
|
|
1042
|
-
this.element = element;
|
|
1043
|
-
this.intl = intl;
|
|
1044
|
-
this.renderer = renderer;
|
|
1045
|
-
this.executeAction = new EventEmitter();
|
|
1046
|
-
this.navigate = new EventEmitter();
|
|
1047
|
-
this.resize = new EventEmitter();
|
|
1048
|
-
this.cssClass = true;
|
|
1049
|
-
this.view = [];
|
|
1050
|
-
this.subs = new Subscription();
|
|
1051
|
-
this.keyActions = {
|
|
1052
|
-
[Keys.Home]: (_) => this.onHomeOrEndKeyDown('home'),
|
|
1053
|
-
[Keys.End]: (_) => this.onHomeOrEndKeyDown('end'),
|
|
1054
|
-
[Keys.ArrowUp]: (e) => this.navigateTo(e, -1),
|
|
1055
|
-
[Keys.ArrowDown]: (e) => this.navigateTo(e, 1),
|
|
1056
|
-
[Keys.Tab]: (e) => this.onTabKeyDown(e),
|
|
1057
|
-
};
|
|
1058
|
-
}
|
|
1059
|
-
set messages(value) {
|
|
1060
|
-
const data = value || [];
|
|
1061
|
-
this.view = chatView(data);
|
|
1062
|
-
this._messages = data;
|
|
1063
|
-
}
|
|
1064
|
-
get messages() {
|
|
1065
|
-
return this._messages;
|
|
1066
|
-
}
|
|
1067
|
-
ngOnInit() {
|
|
1068
|
-
const elRef = this.element.nativeElement;
|
|
1069
|
-
this.subs.add(this.renderer.listen(elRef, 'keydown', event => this.onKeydown(event)));
|
|
1070
|
-
this.subs.add(this.renderer.listen(elRef, 'focusout', event => this.onBlur(event)));
|
|
1071
|
-
}
|
|
1072
|
-
ngAfterViewInit() {
|
|
1073
|
-
this.selectedItem = this.items.last;
|
|
1074
|
-
}
|
|
1075
|
-
ngOnDestroy() {
|
|
1076
|
-
this.subs.unsubscribe();
|
|
1077
|
-
}
|
|
1078
|
-
onResize() {
|
|
1079
|
-
this.resize.emit();
|
|
1080
|
-
}
|
|
1081
|
-
formatTimeStamp(date) {
|
|
1082
|
-
return this.intl.formatDate(date, { date: 'full' });
|
|
1083
|
-
}
|
|
1084
|
-
onKeydown(e) {
|
|
1085
|
-
const action = this.keyActions[e.keyCode];
|
|
1086
|
-
if (action) {
|
|
1087
|
-
action(e);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
onBlur(args) {
|
|
1091
|
-
const next = args.relatedTarget || document.activeElement;
|
|
1092
|
-
const outside = !closest(next, (node) => node === this.element.nativeElement);
|
|
1093
|
-
if (outside) {
|
|
1094
|
-
this.select(null);
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
isOwnMessage(msg) {
|
|
1098
|
-
return isAuthor(this.user, msg);
|
|
1099
|
-
}
|
|
1100
|
-
dispatchAction(action, message) {
|
|
1101
|
-
const args = new ExecuteActionEvent(action, message);
|
|
1102
|
-
this.executeAction.emit(args);
|
|
1103
|
-
}
|
|
1104
|
-
trackGroup(_index, item) {
|
|
1105
|
-
return item.trackBy;
|
|
1106
|
-
}
|
|
1107
|
-
select(item) {
|
|
1108
|
-
const prevItem = this.selectedItem;
|
|
1109
|
-
if (prevItem) {
|
|
1110
|
-
prevItem.selected = false;
|
|
1111
|
-
}
|
|
1112
|
-
if (item) {
|
|
1113
|
-
item.selected = true;
|
|
1114
|
-
this.selectedItem = item;
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
last(items) {
|
|
1118
|
-
if (!items || items.length === 0) {
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
|
-
return items[items.length - 1];
|
|
1122
|
-
}
|
|
1123
|
-
onHomeOrEndKeyDown(key) {
|
|
1124
|
-
const items = this.items.toArray();
|
|
1125
|
-
if (key === 'home') {
|
|
1126
|
-
items[0].focus();
|
|
1127
|
-
}
|
|
1128
|
-
else {
|
|
1129
|
-
items[items.length - 1].focus();
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
onTabKeyDown(event) {
|
|
1133
|
-
const item = this.items.toArray()[this.items.length - 1];
|
|
1134
|
-
const isLastItemQuickReply = item instanceof SuggestedActionsComponent;
|
|
1135
|
-
const isLastItemMessage = item instanceof MessageComponent;
|
|
1136
|
-
event.target.blur();
|
|
1137
|
-
if (isLastItemQuickReply || isLastItemMessage) {
|
|
1138
|
-
this.select(item);
|
|
1139
|
-
item.focus();
|
|
1140
|
-
this.navigate.emit();
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
navigateTo(e, offset) {
|
|
1144
|
-
var _a;
|
|
1145
|
-
const items = this.items.toArray();
|
|
1146
|
-
const prevItem = this.selectedItem;
|
|
1147
|
-
const prevIndex = items.indexOf(prevItem);
|
|
1148
|
-
const nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
|
|
1149
|
-
const nextItem = items[nextIndex];
|
|
1150
|
-
const isNextItemQuickReply = nextItem instanceof SuggestedActionsComponent;
|
|
1151
|
-
if (nextItem !== prevItem) {
|
|
1152
|
-
if (isNextItemQuickReply) {
|
|
1153
|
-
(_a = nextItem.items.toArray()[0]) === null || _a === void 0 ? void 0 : _a.nativeElement.focus();
|
|
1154
|
-
}
|
|
1155
|
-
this.select(nextItem);
|
|
1156
|
-
nextItem.focus();
|
|
1157
|
-
this.navigate.emit();
|
|
1158
|
-
e.preventDefault();
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* @hidden
|
|
1163
|
-
*/
|
|
1164
|
-
textFor(key) {
|
|
1165
|
-
return this.localization.get(key);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
MessageListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageListComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
1169
|
-
MessageListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MessageListComponent, isStandalone: true, selector: "kendo-chat-message-list", inputs: { messages: "messages", attachmentTemplate: "attachmentTemplate", messageTemplate: "messageTemplate", localization: "localization", user: "user" }, outputs: { executeAction: "executeAction", navigate: "navigate", resize: "resize" }, host: { properties: { "class.k-message-list-content": "this.cssClass" } }, viewQueries: [{ propertyName: "items", predicate: ChatItem, descendants: true }], ngImport: i0, template: `
|
|
1170
|
-
<ng-container *ngFor="let group of view; last as lastGroup; trackBy: trackGroup">
|
|
1171
|
-
<ng-container [ngSwitch]="group.type">
|
|
1172
|
-
<div
|
|
1173
|
-
*ngSwitchCase="'date-marker'"
|
|
1174
|
-
class="k-timestamp"
|
|
1175
|
-
>
|
|
1176
|
-
{{ formatTimeStamp(group.timestamp) }}
|
|
1177
|
-
</div>
|
|
1178
|
-
<div
|
|
1179
|
-
*ngSwitchCase="'message-group'"
|
|
1180
|
-
class="k-message-group"
|
|
1181
|
-
[class.k-alt]="isOwnMessage(group.messages[0])"
|
|
1182
|
-
[class.k-no-avatar]="!group.author.avatarUrl"
|
|
1183
|
-
>
|
|
1184
|
-
<p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
|
|
1185
|
-
<div
|
|
1186
|
-
*ngIf="group.author.avatarUrl"
|
|
1187
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
1188
|
-
>
|
|
1189
|
-
<span class="k-avatar-image">
|
|
1190
|
-
<img
|
|
1191
|
-
[attr.src]="group.author.avatarUrl"
|
|
1192
|
-
[alt]="textFor('messageAvatarAlt')"
|
|
1193
|
-
/>
|
|
1194
|
-
</span>
|
|
1195
|
-
</div>
|
|
1196
|
-
<ng-container
|
|
1197
|
-
*ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
|
|
1198
|
-
>
|
|
1199
|
-
<div
|
|
1200
|
-
*ngIf="msg.user?.avatarUrl"
|
|
1201
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
1202
|
-
>
|
|
1203
|
-
<span class="k-avatar-image">
|
|
1204
|
-
<img [src]="msg.user?.avatarUrl">
|
|
1205
|
-
</span>
|
|
1206
|
-
</div>
|
|
1207
|
-
<kendo-chat-message #message
|
|
1208
|
-
[message]="msg"
|
|
1209
|
-
[tabbable]="lastGroup && lastMessage"
|
|
1210
|
-
[template]="messageTemplate"
|
|
1211
|
-
(click)="select(message)"
|
|
1212
|
-
(focus)="select(message)"
|
|
1213
|
-
[class.k-only]="group.messages.length === 1"
|
|
1214
|
-
[class.k-first]="group.messages.length > 1 && firstMessage"
|
|
1215
|
-
[class.k-last]="group.messages.length > 1 && lastMessage"
|
|
1216
|
-
>
|
|
1217
|
-
</kendo-chat-message>
|
|
1218
|
-
|
|
1219
|
-
<kendo-chat-attachment
|
|
1220
|
-
*ngIf="msg.attachments && msg.attachments.length === 1"
|
|
1221
|
-
[attachment]="msg.attachments[0]"
|
|
1222
|
-
[template]="attachmentTemplate"
|
|
1223
|
-
>
|
|
1224
|
-
</kendo-chat-attachment>
|
|
1225
|
-
</ng-container>
|
|
1226
|
-
</div>
|
|
1227
|
-
|
|
1228
|
-
<kendo-chat-message-attachments #attachments
|
|
1229
|
-
*ngSwitchCase="'attachment-group'"
|
|
1230
|
-
[attachments]="group.attachments"
|
|
1231
|
-
[layout]="group.attachmentLayout"
|
|
1232
|
-
[localization]="localization"
|
|
1233
|
-
[tabbable]="lastGroup"
|
|
1234
|
-
[template]="attachmentTemplate"
|
|
1235
|
-
(click)="select(attachments)"
|
|
1236
|
-
(focus)="select(attachments)"
|
|
1237
|
-
>
|
|
1238
|
-
</kendo-chat-message-attachments>
|
|
1239
|
-
|
|
1240
|
-
<kendo-chat-suggested-actions #actions
|
|
1241
|
-
*ngSwitchCase="'action-group'"
|
|
1242
|
-
[actions]="group.actions"
|
|
1243
|
-
[tabbable]="lastGroup"
|
|
1244
|
-
(dispatch)="dispatchAction($event, last(group.messages))"
|
|
1245
|
-
(click)="select(actions)"
|
|
1246
|
-
(focus)="select(actions)"
|
|
1247
|
-
>
|
|
1248
|
-
</kendo-chat-suggested-actions>
|
|
1249
|
-
</ng-container>
|
|
1250
|
-
</ng-container>
|
|
1251
|
-
<kendo-resize-sensor (resize)="onResize()">
|
|
1252
|
-
</kendo-resize-sensor>
|
|
1253
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MessageComponent, selector: "kendo-chat-message", inputs: ["message", "tabbable", "template"] }, { kind: "component", type: AttachmentComponent, selector: "kendo-chat-attachment", inputs: ["attachment", "template"] }, { kind: "component", type: MessageAttachmentsComponent, selector: "kendo-chat-message-attachments", inputs: ["attachments", "layout", "tabbable", "template", "localization"] }, { kind: "component", type: SuggestedActionsComponent, selector: "kendo-chat-suggested-actions", inputs: ["actions", "tabbable"], outputs: ["dispatch"] }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }] });
|
|
1254
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageListComponent, decorators: [{
|
|
1255
|
-
type: Component,
|
|
1256
|
-
args: [{
|
|
1257
|
-
selector: 'kendo-chat-message-list',
|
|
1258
|
-
template: `
|
|
1259
|
-
<ng-container *ngFor="let group of view; last as lastGroup; trackBy: trackGroup">
|
|
1260
|
-
<ng-container [ngSwitch]="group.type">
|
|
1261
|
-
<div
|
|
1262
|
-
*ngSwitchCase="'date-marker'"
|
|
1263
|
-
class="k-timestamp"
|
|
1264
|
-
>
|
|
1265
|
-
{{ formatTimeStamp(group.timestamp) }}
|
|
1266
|
-
</div>
|
|
1267
|
-
<div
|
|
1268
|
-
*ngSwitchCase="'message-group'"
|
|
1269
|
-
class="k-message-group"
|
|
1270
|
-
[class.k-alt]="isOwnMessage(group.messages[0])"
|
|
1271
|
-
[class.k-no-avatar]="!group.author.avatarUrl"
|
|
1272
|
-
>
|
|
1273
|
-
<p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
|
|
1274
|
-
<div
|
|
1275
|
-
*ngIf="group.author.avatarUrl"
|
|
1276
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
1277
|
-
>
|
|
1278
|
-
<span class="k-avatar-image">
|
|
1279
|
-
<img
|
|
1280
|
-
[attr.src]="group.author.avatarUrl"
|
|
1281
|
-
[alt]="textFor('messageAvatarAlt')"
|
|
1282
|
-
/>
|
|
1283
|
-
</span>
|
|
1284
|
-
</div>
|
|
1285
|
-
<ng-container
|
|
1286
|
-
*ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
|
|
1287
|
-
>
|
|
1288
|
-
<div
|
|
1289
|
-
*ngIf="msg.user?.avatarUrl"
|
|
1290
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
1291
|
-
>
|
|
1292
|
-
<span class="k-avatar-image">
|
|
1293
|
-
<img [src]="msg.user?.avatarUrl">
|
|
1294
|
-
</span>
|
|
1295
|
-
</div>
|
|
1296
|
-
<kendo-chat-message #message
|
|
1297
|
-
[message]="msg"
|
|
1298
|
-
[tabbable]="lastGroup && lastMessage"
|
|
1299
|
-
[template]="messageTemplate"
|
|
1300
|
-
(click)="select(message)"
|
|
1301
|
-
(focus)="select(message)"
|
|
1302
|
-
[class.k-only]="group.messages.length === 1"
|
|
1303
|
-
[class.k-first]="group.messages.length > 1 && firstMessage"
|
|
1304
|
-
[class.k-last]="group.messages.length > 1 && lastMessage"
|
|
1305
|
-
>
|
|
1306
|
-
</kendo-chat-message>
|
|
1307
|
-
|
|
1308
|
-
<kendo-chat-attachment
|
|
1309
|
-
*ngIf="msg.attachments && msg.attachments.length === 1"
|
|
1310
|
-
[attachment]="msg.attachments[0]"
|
|
1311
|
-
[template]="attachmentTemplate"
|
|
1312
|
-
>
|
|
1313
|
-
</kendo-chat-attachment>
|
|
1314
|
-
</ng-container>
|
|
1315
|
-
</div>
|
|
1316
|
-
|
|
1317
|
-
<kendo-chat-message-attachments #attachments
|
|
1318
|
-
*ngSwitchCase="'attachment-group'"
|
|
1319
|
-
[attachments]="group.attachments"
|
|
1320
|
-
[layout]="group.attachmentLayout"
|
|
1321
|
-
[localization]="localization"
|
|
1322
|
-
[tabbable]="lastGroup"
|
|
1323
|
-
[template]="attachmentTemplate"
|
|
1324
|
-
(click)="select(attachments)"
|
|
1325
|
-
(focus)="select(attachments)"
|
|
1326
|
-
>
|
|
1327
|
-
</kendo-chat-message-attachments>
|
|
1328
|
-
|
|
1329
|
-
<kendo-chat-suggested-actions #actions
|
|
1330
|
-
*ngSwitchCase="'action-group'"
|
|
1331
|
-
[actions]="group.actions"
|
|
1332
|
-
[tabbable]="lastGroup"
|
|
1333
|
-
(dispatch)="dispatchAction($event, last(group.messages))"
|
|
1334
|
-
(click)="select(actions)"
|
|
1335
|
-
(focus)="select(actions)"
|
|
1336
|
-
>
|
|
1337
|
-
</kendo-chat-suggested-actions>
|
|
1338
|
-
</ng-container>
|
|
1339
|
-
</ng-container>
|
|
1340
|
-
<kendo-resize-sensor (resize)="onResize()">
|
|
1341
|
-
</kendo-resize-sensor>
|
|
1342
|
-
`,
|
|
1343
|
-
standalone: true,
|
|
1344
|
-
imports: [NgFor, NgSwitch, NgSwitchCase, NgIf, MessageComponent, AttachmentComponent, MessageAttachmentsComponent, SuggestedActionsComponent, ResizeSensorComponent]
|
|
1345
|
-
}]
|
|
1346
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }, { type: i0.Renderer2 }]; }, propDecorators: { messages: [{
|
|
1347
|
-
type: Input
|
|
1348
|
-
}], attachmentTemplate: [{
|
|
1349
|
-
type: Input
|
|
1350
|
-
}], messageTemplate: [{
|
|
1351
|
-
type: Input
|
|
1352
|
-
}], localization: [{
|
|
1353
|
-
type: Input
|
|
1354
|
-
}], user: [{
|
|
1355
|
-
type: Input
|
|
1356
|
-
}], executeAction: [{
|
|
1357
|
-
type: Output
|
|
1358
|
-
}], navigate: [{
|
|
1359
|
-
type: Output
|
|
1360
|
-
}], resize: [{
|
|
1361
|
-
type: Output
|
|
1362
|
-
}], items: [{
|
|
1363
|
-
type: ViewChildren,
|
|
1364
|
-
args: [ChatItem]
|
|
1365
|
-
}], cssClass: [{
|
|
1366
|
-
type: HostBinding,
|
|
1367
|
-
args: ['class.k-message-list-content']
|
|
1368
|
-
}] } });
|
|
1369
|
-
|
|
1370
|
-
// Consider scroll to be at the bottom when within this number of pixels from the container height.
|
|
1371
|
-
const maxDelta = 2;
|
|
1372
|
-
/**
|
|
1373
|
-
* @hidden
|
|
1374
|
-
*/
|
|
1375
|
-
class ScrollAnchorDirective {
|
|
1376
|
-
constructor(element, zone, renderer) {
|
|
1377
|
-
this.element = element;
|
|
1378
|
-
this.zone = zone;
|
|
1379
|
-
this.renderer = renderer;
|
|
1380
|
-
this.autoScroll = true;
|
|
1381
|
-
this.autoScrollChange = new EventEmitter();
|
|
1382
|
-
this.overflowAnchor = 'none';
|
|
1383
|
-
this.scrolling = false;
|
|
1384
|
-
}
|
|
1385
|
-
ngOnInit() {
|
|
1386
|
-
this.zone.runOutsideAngular(() => {
|
|
1387
|
-
this.unsubscribe = this.renderer.listen(this.element.nativeElement, 'scroll', () => this.onScroll());
|
|
1388
|
-
});
|
|
1389
|
-
}
|
|
1390
|
-
ngAfterViewInit() {
|
|
1391
|
-
this.scrollToBottom();
|
|
1392
|
-
}
|
|
1393
|
-
ngOnDestroy() {
|
|
1394
|
-
if (this.unsubscribe) {
|
|
1395
|
-
this.unsubscribe();
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
onScroll() {
|
|
1399
|
-
if (this.scrolling) {
|
|
1400
|
-
return;
|
|
1401
|
-
}
|
|
1402
|
-
const el = this.element.nativeElement;
|
|
1403
|
-
const bottom = el.scrollTop + el.offsetHeight;
|
|
1404
|
-
const height = el.scrollHeight;
|
|
1405
|
-
const atBottom = height - bottom < maxDelta;
|
|
1406
|
-
if (this.autoScroll !== atBottom) {
|
|
1407
|
-
this.zone.run(() => {
|
|
1408
|
-
this.autoScroll = atBottom;
|
|
1409
|
-
this.autoScrollChange.emit(this.autoScroll);
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
scrollToBottom() {
|
|
1414
|
-
if (!this.autoScroll) {
|
|
1415
|
-
return;
|
|
1416
|
-
}
|
|
1417
|
-
const el = this.element.nativeElement;
|
|
1418
|
-
el.scrollTop = el.scrollHeight - el.clientHeight;
|
|
1419
|
-
this.scrolling = true;
|
|
1420
|
-
this.zone.runOutsideAngular(() => setTimeout(() => this.scrolling = false, 1000));
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
ScrollAnchorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ScrollAnchorDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1424
|
-
ScrollAnchorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: ScrollAnchorDirective, isStandalone: true, selector: "[kendoChatScrollAnchor]", inputs: { autoScroll: "autoScroll" }, outputs: { autoScrollChange: "autoScrollChange" }, host: { properties: { "style.overflow-anchor": "this.overflowAnchor" } }, exportAs: ["scrollAnchor"], ngImport: i0 });
|
|
1425
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ScrollAnchorDirective, decorators: [{
|
|
1426
|
-
type: Directive,
|
|
1427
|
-
args: [{
|
|
1428
|
-
selector: '[kendoChatScrollAnchor]',
|
|
1429
|
-
exportAs: 'scrollAnchor',
|
|
1430
|
-
standalone: true
|
|
1431
|
-
}]
|
|
1432
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { autoScroll: [{
|
|
1433
|
-
type: Input
|
|
1434
|
-
}], autoScrollChange: [{
|
|
1435
|
-
type: Output
|
|
1436
|
-
}], overflowAnchor: [{
|
|
1437
|
-
type: HostBinding,
|
|
1438
|
-
args: ['style.overflow-anchor']
|
|
1439
|
-
}] } });
|
|
1440
|
-
|
|
1441
|
-
/**
|
|
1442
|
-
* @hidden
|
|
1443
|
-
*/
|
|
1444
|
-
let Messages$1 = class Messages extends ComponentMessages {
|
|
1445
|
-
};
|
|
1446
|
-
Messages$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: Messages$1, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1447
|
-
Messages$1.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: Messages$1, selector: "kendoConversationalUIMessages", inputs: { messagePlaceholder: "messagePlaceholder", send: "send", messageListLabel: "messageListLabel", messageBoxInputLabel: "messageBoxInputLabel", messageAttachmentLeftArrow: "messageAttachmentLeftArrow", messageAttachmentRightArrow: "messageAttachmentRightArrow", messageAvatarAlt: "messageAvatarAlt" }, usesInheritance: true, ngImport: i0 });
|
|
1448
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: Messages$1, decorators: [{
|
|
1449
|
-
type: Directive,
|
|
1450
|
-
args: [{
|
|
1451
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1452
|
-
selector: 'kendoConversationalUIMessages'
|
|
1453
|
-
}]
|
|
1454
|
-
}], propDecorators: { messagePlaceholder: [{
|
|
1455
|
-
type: Input
|
|
1456
|
-
}], send: [{
|
|
1457
|
-
type: Input
|
|
1458
|
-
}], messageListLabel: [{
|
|
1459
|
-
type: Input
|
|
1460
|
-
}], messageBoxInputLabel: [{
|
|
1461
|
-
type: Input
|
|
1462
|
-
}], messageAttachmentLeftArrow: [{
|
|
1463
|
-
type: Input
|
|
1464
|
-
}], messageAttachmentRightArrow: [{
|
|
1465
|
-
type: Input
|
|
1466
|
-
}], messageAvatarAlt: [{
|
|
1467
|
-
type: Input
|
|
1468
|
-
}] } });
|
|
1469
|
-
|
|
1470
|
-
// eslint-disable no-forward-ref
|
|
1471
|
-
/**
|
|
1472
|
-
* @hidden
|
|
1473
|
-
*/
|
|
1474
|
-
let LocalizedMessagesDirective$1 = class LocalizedMessagesDirective extends Messages$1 {
|
|
1475
|
-
constructor(service) {
|
|
1476
|
-
super();
|
|
1477
|
-
this.service = service;
|
|
1478
|
-
}
|
|
1479
|
-
};
|
|
1480
|
-
LocalizedMessagesDirective$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LocalizedMessagesDirective$1, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1481
|
-
LocalizedMessagesDirective$1.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LocalizedMessagesDirective$1, isStandalone: true, selector: "[kendoChatLocalizedMessages]", providers: [
|
|
1482
|
-
{
|
|
1483
|
-
provide: Messages$1,
|
|
1484
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective$1)
|
|
1485
|
-
}
|
|
1486
|
-
], usesInheritance: true, ngImport: i0 });
|
|
1487
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LocalizedMessagesDirective$1, decorators: [{
|
|
1488
|
-
type: Directive,
|
|
1489
|
-
args: [{
|
|
1490
|
-
providers: [
|
|
1491
|
-
{
|
|
1492
|
-
provide: Messages$1,
|
|
1493
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective$1)
|
|
1494
|
-
}
|
|
1495
|
-
],
|
|
1496
|
-
selector: '[kendoChatLocalizedMessages]',
|
|
1497
|
-
standalone: true
|
|
1498
|
-
}]
|
|
1499
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
|
1500
|
-
|
|
1501
|
-
/**
|
|
1502
|
-
* Represents the Kendo UI Chat component for Angular.
|
|
1503
|
-
*
|
|
1504
|
-
* {% meta height:700 %}
|
|
1505
|
-
* {% embed_file chat/echo/app.component.ts preview %}
|
|
1506
|
-
* {% embed_file shared/app.module.ts %}
|
|
1507
|
-
* {% embed_file shared/main.ts hidden %}
|
|
1508
|
-
* {% endmeta %}
|
|
1509
|
-
*
|
|
1510
|
-
*/
|
|
1511
|
-
class ChatComponent {
|
|
1512
|
-
constructor(localization, zone) {
|
|
1513
|
-
this.localization = localization;
|
|
1514
|
-
this.zone = zone;
|
|
1515
|
-
/**
|
|
1516
|
-
* Used to switch between a one-liner input or a textarea.
|
|
1517
|
-
* ([see example]({% slug message_box %})#toc-message-box-types).
|
|
1518
|
-
* @default input
|
|
1519
|
-
*/
|
|
1520
|
-
this.messageBoxType = 'textbox';
|
|
1521
|
-
/**
|
|
1522
|
-
* Fires when the user types a message and clicks the **Send** button or presses **Enter**.
|
|
1523
|
-
* Emits the [`SendMessageEvent`]({% slug api_conversational-ui_sendmessageevent %}).
|
|
1524
|
-
*
|
|
1525
|
-
* > The message is not automatically appended to the `messages` array.
|
|
1526
|
-
*/
|
|
1527
|
-
this.sendMessage = new EventEmitter();
|
|
1528
|
-
/**
|
|
1529
|
-
* Fires when the user clicks a quick action button.
|
|
1530
|
-
* The Chat internally handles the `reply`, `openUrl`, and `call` [known actions]({% slug api_conversational-ui_actiontype %}).
|
|
1531
|
-
*
|
|
1532
|
-
* Emits the [`ExecuteActionEvent`]({% slug api_conversational-ui_executeactionevent %}).
|
|
1533
|
-
* The event is preventable. If `preventDefault` is called, the built-in action will be suppressed.
|
|
1534
|
-
*/
|
|
1535
|
-
this.executeAction = new EventEmitter();
|
|
1536
|
-
/**
|
|
1537
|
-
* @hidden
|
|
1538
|
-
*/
|
|
1539
|
-
this.autoScroll = true;
|
|
1540
|
-
validatePackage(packageMetadata);
|
|
1541
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
1542
|
-
this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
|
|
1543
|
-
this.direction = rtl ? 'rtl' : 'ltr';
|
|
1544
|
-
});
|
|
1545
|
-
}
|
|
1546
|
-
get className() {
|
|
1547
|
-
return 'k-chat';
|
|
1548
|
-
}
|
|
1549
|
-
get dirAttr() {
|
|
1550
|
-
return this.direction;
|
|
1551
|
-
}
|
|
1552
|
-
/**
|
|
1553
|
-
* @hidden
|
|
1554
|
-
*/
|
|
1555
|
-
get localizationText() {
|
|
1556
|
-
return this.localization;
|
|
1557
|
-
}
|
|
1558
|
-
ngOnChanges() {
|
|
1559
|
-
this.zone.runOutsideAngular(() => setTimeout(() => {
|
|
1560
|
-
this.messageList.nativeElement.style.flex = '1 1 auto';
|
|
1561
|
-
}));
|
|
1562
|
-
}
|
|
1563
|
-
ngAfterViewInit() {
|
|
1564
|
-
if (!isDevMode()) {
|
|
1565
|
-
return;
|
|
1566
|
-
}
|
|
1567
|
-
if (!this.user) {
|
|
1568
|
-
throw new Error('User must be set and have a valid id.');
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
ngOnDestroy() {
|
|
1572
|
-
if (this.localizationChangeSubscription) {
|
|
1573
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
/**
|
|
1577
|
-
* @hidden
|
|
1578
|
-
*/
|
|
1579
|
-
dispatchAction(e) {
|
|
1580
|
-
this.executeAction.emit(e);
|
|
1581
|
-
if (!e.isDefaultPrevented()) {
|
|
1582
|
-
const handler = makeHandler(e.action);
|
|
1583
|
-
handler(e.action, this);
|
|
1584
|
-
if (!this.messageBoxTemplate) {
|
|
1585
|
-
this.messageBox.messageBoxInput.focus();
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
/**
|
|
1590
|
-
* @hidden
|
|
1591
|
-
*/
|
|
1592
|
-
textFor(key) {
|
|
1593
|
-
return this.localization.get(key);
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
ChatComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChatComponent, deps: [{ token: i1$1.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
1597
|
-
ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ChatComponent, isStandalone: true, selector: "kendo-chat", inputs: { messages: "messages", user: "user", messageBoxType: "messageBoxType" }, outputs: { sendMessage: "sendMessage", executeAction: "executeAction" }, host: { properties: { "class": "this.className", "attr.dir": "this.dirAttr" } }, providers: [
|
|
1598
|
-
LocalizationService,
|
|
1599
|
-
{
|
|
1600
|
-
provide: L10N_PREFIX,
|
|
1601
|
-
useValue: 'kendo.chat'
|
|
1602
|
-
}
|
|
1603
|
-
], queries: [{ propertyName: "attachmentTemplate", first: true, predicate: AttachmentTemplateDirective, descendants: true }, { propertyName: "messageTemplate", first: true, predicate: MessageTemplateDirective, descendants: true }, { propertyName: "messageBoxTemplate", first: true, predicate: ChatMessageBoxTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "messageBox", first: true, predicate: ["messageBox"], descendants: true }, { propertyName: "messageList", first: true, predicate: ["messageList"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
1604
|
-
<ng-container kendoChatLocalizedMessages
|
|
1605
|
-
i18n-messagePlaceholder="kendo.chat.messagePlaceholder|The placholder text of the message text input"
|
|
1606
|
-
messagePlaceholder="Type a message..."
|
|
1607
|
-
|
|
1608
|
-
i18n-send="kendo.chat.send|The text for the Send button"
|
|
1609
|
-
send="Send..."
|
|
1610
|
-
|
|
1611
|
-
i18n-messageListLabel="kendo.chat.messageListLabel|The label text for the Message list"
|
|
1612
|
-
messageListLabel="Message list"
|
|
1613
|
-
|
|
1614
|
-
i18n-messageBoxInputLabel="kendo.chat.messageBoxInputLabel|The label text for the Message input box"
|
|
1615
|
-
messageBoxInputLabel="Message"
|
|
1616
|
-
|
|
1617
|
-
i18n-messageAttachmentLeftArrow="kendo.chat.messageAttachmentLeftArrow|The text for the left arrow of the message attachments"
|
|
1618
|
-
messageAttachmentLeftArrow="Previous item"
|
|
1619
|
-
|
|
1620
|
-
i18n-messageAttachmentRightArrow="kendo.chat.messageAttachmentRightArrow|The text for the right arrow of the message attachments"
|
|
1621
|
-
messageAttachmentRightArrow="Next item"
|
|
1622
|
-
|
|
1623
|
-
i18n-messageAvatarAlt="kendo.chat.messageAvatarAlt|The alt attribute text for the avatar"
|
|
1624
|
-
messageAvatarAlt="Avatar"
|
|
1625
|
-
>
|
|
1626
|
-
</ng-container>
|
|
1627
|
-
|
|
1628
|
-
<div
|
|
1629
|
-
#messageList
|
|
1630
|
-
class="k-message-list k-avatars"
|
|
1631
|
-
aria-live="polite"
|
|
1632
|
-
role="log"
|
|
1633
|
-
kendoChatScrollAnchor
|
|
1634
|
-
[attr.aria-label]="textFor('messageListLabel')"
|
|
1635
|
-
#anchor="scrollAnchor"
|
|
1636
|
-
[(autoScroll)]="autoScroll"
|
|
1637
|
-
>
|
|
1638
|
-
<kendo-chat-message-list
|
|
1639
|
-
[messages]="messages"
|
|
1640
|
-
[messageTemplate]="messageTemplate"
|
|
1641
|
-
[localization]="localizationText"
|
|
1642
|
-
[attachmentTemplate]="attachmentTemplate"
|
|
1643
|
-
[user]="user"
|
|
1644
|
-
(executeAction)="dispatchAction($event)"
|
|
1645
|
-
(resize)="anchor.scrollToBottom()"
|
|
1646
|
-
(navigate)="this.autoScroll = false"
|
|
1647
|
-
>
|
|
1648
|
-
</kendo-chat-message-list>
|
|
1649
|
-
</div>
|
|
1650
|
-
<kendo-message-box
|
|
1651
|
-
#messageBox
|
|
1652
|
-
[messageBoxTemplate]="messageBoxTemplate"
|
|
1653
|
-
[type]="messageBoxType"
|
|
1654
|
-
[user]="user"
|
|
1655
|
-
[autoScroll]="autoScroll"
|
|
1656
|
-
[localization]="localizationText"
|
|
1657
|
-
(sendMessage)="sendMessage.emit($event)"
|
|
1658
|
-
>
|
|
1659
|
-
</kendo-message-box>
|
|
1660
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective$1, selector: "[kendoChatLocalizedMessages]" }, { kind: "directive", type: ScrollAnchorDirective, selector: "[kendoChatScrollAnchor]", inputs: ["autoScroll"], outputs: ["autoScrollChange"], exportAs: ["scrollAnchor"] }, { kind: "component", type: MessageListComponent, selector: "kendo-chat-message-list", inputs: ["messages", "attachmentTemplate", "messageTemplate", "localization", "user"], outputs: ["executeAction", "navigate", "resize"] }, { kind: "component", type: MessageBoxComponent, selector: "kendo-message-box", inputs: ["user", "autoScroll", "type", "localization", "messageBoxTemplate"], outputs: ["sendMessage"] }] });
|
|
1661
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChatComponent, decorators: [{
|
|
1662
|
-
type: Component,
|
|
1663
|
-
args: [{
|
|
1664
|
-
providers: [
|
|
1665
|
-
LocalizationService,
|
|
1666
|
-
{
|
|
1667
|
-
provide: L10N_PREFIX,
|
|
1668
|
-
useValue: 'kendo.chat'
|
|
1669
|
-
}
|
|
1670
|
-
],
|
|
1671
|
-
selector: 'kendo-chat',
|
|
1672
|
-
template: `
|
|
1673
|
-
<ng-container kendoChatLocalizedMessages
|
|
1674
|
-
i18n-messagePlaceholder="kendo.chat.messagePlaceholder|The placholder text of the message text input"
|
|
1675
|
-
messagePlaceholder="Type a message..."
|
|
1676
|
-
|
|
1677
|
-
i18n-send="kendo.chat.send|The text for the Send button"
|
|
1678
|
-
send="Send..."
|
|
1679
|
-
|
|
1680
|
-
i18n-messageListLabel="kendo.chat.messageListLabel|The label text for the Message list"
|
|
1681
|
-
messageListLabel="Message list"
|
|
1682
|
-
|
|
1683
|
-
i18n-messageBoxInputLabel="kendo.chat.messageBoxInputLabel|The label text for the Message input box"
|
|
1684
|
-
messageBoxInputLabel="Message"
|
|
1685
|
-
|
|
1686
|
-
i18n-messageAttachmentLeftArrow="kendo.chat.messageAttachmentLeftArrow|The text for the left arrow of the message attachments"
|
|
1687
|
-
messageAttachmentLeftArrow="Previous item"
|
|
1688
|
-
|
|
1689
|
-
i18n-messageAttachmentRightArrow="kendo.chat.messageAttachmentRightArrow|The text for the right arrow of the message attachments"
|
|
1690
|
-
messageAttachmentRightArrow="Next item"
|
|
1691
|
-
|
|
1692
|
-
i18n-messageAvatarAlt="kendo.chat.messageAvatarAlt|The alt attribute text for the avatar"
|
|
1693
|
-
messageAvatarAlt="Avatar"
|
|
1694
|
-
>
|
|
1695
|
-
</ng-container>
|
|
1696
|
-
|
|
1697
|
-
<div
|
|
1698
|
-
#messageList
|
|
1699
|
-
class="k-message-list k-avatars"
|
|
1700
|
-
aria-live="polite"
|
|
1701
|
-
role="log"
|
|
1702
|
-
kendoChatScrollAnchor
|
|
1703
|
-
[attr.aria-label]="textFor('messageListLabel')"
|
|
1704
|
-
#anchor="scrollAnchor"
|
|
1705
|
-
[(autoScroll)]="autoScroll"
|
|
1706
|
-
>
|
|
1707
|
-
<kendo-chat-message-list
|
|
1708
|
-
[messages]="messages"
|
|
1709
|
-
[messageTemplate]="messageTemplate"
|
|
1710
|
-
[localization]="localizationText"
|
|
1711
|
-
[attachmentTemplate]="attachmentTemplate"
|
|
1712
|
-
[user]="user"
|
|
1713
|
-
(executeAction)="dispatchAction($event)"
|
|
1714
|
-
(resize)="anchor.scrollToBottom()"
|
|
1715
|
-
(navigate)="this.autoScroll = false"
|
|
1716
|
-
>
|
|
1717
|
-
</kendo-chat-message-list>
|
|
1718
|
-
</div>
|
|
1719
|
-
<kendo-message-box
|
|
1720
|
-
#messageBox
|
|
1721
|
-
[messageBoxTemplate]="messageBoxTemplate"
|
|
1722
|
-
[type]="messageBoxType"
|
|
1723
|
-
[user]="user"
|
|
1724
|
-
[autoScroll]="autoScroll"
|
|
1725
|
-
[localization]="localizationText"
|
|
1726
|
-
(sendMessage)="sendMessage.emit($event)"
|
|
1727
|
-
>
|
|
1728
|
-
</kendo-message-box>
|
|
1729
|
-
`,
|
|
1730
|
-
standalone: true,
|
|
1731
|
-
imports: [LocalizedMessagesDirective$1, ScrollAnchorDirective, MessageListComponent, MessageBoxComponent]
|
|
1732
|
-
}]
|
|
1733
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { messages: [{
|
|
1734
|
-
type: Input
|
|
1735
|
-
}], user: [{
|
|
1736
|
-
type: Input
|
|
1737
|
-
}], messageBoxType: [{
|
|
1738
|
-
type: Input
|
|
1739
|
-
}], sendMessage: [{
|
|
1740
|
-
type: Output
|
|
1741
|
-
}], executeAction: [{
|
|
1742
|
-
type: Output
|
|
1743
|
-
}], className: [{
|
|
1744
|
-
type: HostBinding,
|
|
1745
|
-
args: ['class']
|
|
1746
|
-
}], dirAttr: [{
|
|
1747
|
-
type: HostBinding,
|
|
1748
|
-
args: ['attr.dir']
|
|
1749
|
-
}], attachmentTemplate: [{
|
|
1750
|
-
type: ContentChild,
|
|
1751
|
-
args: [AttachmentTemplateDirective, { static: false }]
|
|
1752
|
-
}], messageTemplate: [{
|
|
1753
|
-
type: ContentChild,
|
|
1754
|
-
args: [MessageTemplateDirective, { static: false }]
|
|
1755
|
-
}], messageBoxTemplate: [{
|
|
1756
|
-
type: ContentChild,
|
|
1757
|
-
args: [ChatMessageBoxTemplateDirective, { static: false }]
|
|
1758
|
-
}], messageBox: [{
|
|
1759
|
-
type: ViewChild,
|
|
1760
|
-
args: ['messageBox', { static: false }]
|
|
1761
|
-
}], messageList: [{
|
|
1762
|
-
type: ViewChild,
|
|
1763
|
-
args: ['messageList', { static: true }]
|
|
1764
|
-
}] } });
|
|
1765
|
-
|
|
1766
|
-
/**
|
|
1767
|
-
* @hidden
|
|
1768
|
-
*/
|
|
1769
|
-
const MY_TOKEN = new InjectionToken('COMMAND_TOKEN');
|
|
1770
|
-
/**
|
|
1771
|
-
* @hidden
|
|
1772
|
-
*/
|
|
1773
|
-
const DEFAULT_SVG_ICONS = {
|
|
1774
|
-
prompt: sparklesIcon,
|
|
1775
|
-
output: commentIcon,
|
|
1776
|
-
command: moreHorizontalIcon
|
|
1777
|
-
};
|
|
1778
|
-
/**
|
|
1779
|
-
* @hidden
|
|
1780
|
-
*/
|
|
1781
|
-
const DEFAULT_ICONS = {
|
|
1782
|
-
prompt: 'sparkles',
|
|
1783
|
-
output: 'comment',
|
|
1784
|
-
command: 'more-horizontal'
|
|
1785
|
-
};
|
|
1786
|
-
|
|
1787
|
-
/**
|
|
1788
|
-
* @hidden
|
|
1789
|
-
*/
|
|
1790
|
-
class BaseView {
|
|
1791
|
-
constructor(viewType, localization) {
|
|
1792
|
-
this.viewType = viewType;
|
|
1793
|
-
this.localization = localization;
|
|
1794
|
-
this.hostClasses = true;
|
|
1795
|
-
if (this.viewType !== 'custom') {
|
|
1796
|
-
this.icon = DEFAULT_ICONS[this.viewType];
|
|
1797
|
-
this.svgIcon = DEFAULT_SVG_ICONS[this.viewType];
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
/**
|
|
1801
|
-
* The text of the ToolBar button corresponding to the view.
|
|
1802
|
-
*/
|
|
1803
|
-
set buttonText(value) {
|
|
1804
|
-
this._buttonText = value;
|
|
1805
|
-
}
|
|
1806
|
-
get buttonText() {
|
|
1807
|
-
return isPresent(this._buttonText) ?
|
|
1808
|
-
this._buttonText :
|
|
1809
|
-
this.messageFor(`${this.viewType}View`);
|
|
1810
|
-
}
|
|
1811
|
-
/**
|
|
1812
|
-
* The font icon of the ToolBar button corresponding to the view.
|
|
1813
|
-
*/
|
|
1814
|
-
set icon(value) {
|
|
1815
|
-
if (isPresent(value)) {
|
|
1816
|
-
this._icon = value;
|
|
1817
|
-
}
|
|
1818
|
-
else {
|
|
1819
|
-
this.icon = DEFAULT_ICONS[this.viewType];
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
get icon() {
|
|
1823
|
-
return this._icon;
|
|
1824
|
-
}
|
|
1825
|
-
/**
|
|
1826
|
-
* The SVG icon of the ToolBar button corresponding to the view.
|
|
1827
|
-
*/
|
|
1828
|
-
set svgIcon(value) {
|
|
1829
|
-
if (isPresent(value)) {
|
|
1830
|
-
this._svgIcon = value;
|
|
1831
|
-
}
|
|
1832
|
-
else {
|
|
1833
|
-
this.svgIcon = DEFAULT_SVG_ICONS[this.viewType];
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
get svgIcon() {
|
|
1837
|
-
return this._svgIcon;
|
|
1838
|
-
}
|
|
1839
|
-
/**
|
|
1840
|
-
* @hidden
|
|
1841
|
-
*/
|
|
1842
|
-
messageFor(text) {
|
|
1843
|
-
return this.localization.get(text);
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
BaseView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BaseView, deps: [{ token: MY_TOKEN }, { token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1847
|
-
BaseView.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: BaseView, inputs: { buttonText: "buttonText", icon: "icon", svgIcon: "svgIcon" }, host: { properties: { "class.k-prompt-view": "this.hostClasses" } }, viewQueries: [{ propertyName: "template", first: true, predicate: ["content"], descendants: true, static: true }], ngImport: i0 });
|
|
1848
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BaseView, decorators: [{
|
|
1849
|
-
type: Directive
|
|
1850
|
-
}], ctorParameters: function () {
|
|
1851
|
-
return [{ type: undefined, decorators: [{
|
|
1852
|
-
type: Inject,
|
|
1853
|
-
args: [MY_TOKEN]
|
|
1854
|
-
}] }, { type: i1$1.LocalizationService }];
|
|
1855
|
-
}, propDecorators: { hostClasses: [{
|
|
1856
|
-
type: HostBinding,
|
|
1857
|
-
args: ['class.k-prompt-view']
|
|
1858
|
-
}], template: [{
|
|
1859
|
-
type: ViewChild,
|
|
1860
|
-
args: ['content', { static: true }]
|
|
1861
|
-
}], buttonText: [{
|
|
1862
|
-
type: Input
|
|
1863
|
-
}], icon: [{
|
|
1864
|
-
type: Input
|
|
1865
|
-
}], svgIcon: [{
|
|
1866
|
-
type: Input
|
|
1867
|
-
}] } });
|
|
1868
|
-
|
|
1869
|
-
/**
|
|
1870
|
-
* @hidden
|
|
1871
|
-
*/
|
|
1872
|
-
class AIPromptService {
|
|
1873
|
-
constructor() {
|
|
1874
|
-
this.promptValue = '';
|
|
1875
|
-
this.showOutputRating = false;
|
|
1876
|
-
this.requestEvent = new Subject();
|
|
1877
|
-
this.executeEvent = new Subject();
|
|
1878
|
-
this.outputCopyEvent = new Subject();
|
|
1879
|
-
this.outputRatingChangeEvent = new Subject();
|
|
1880
|
-
}
|
|
1881
|
-
getFlattenPromptCommands(commands = this.promptCommands) {
|
|
1882
|
-
let newArr = [];
|
|
1883
|
-
commands.forEach(c => {
|
|
1884
|
-
if (c.hasOwnProperty('children')) {
|
|
1885
|
-
const childrenArr = c.children;
|
|
1886
|
-
newArr = newArr.concat(childrenArr);
|
|
1887
|
-
if (childrenArr.length > 0) {
|
|
1888
|
-
this.getFlattenPromptCommands(childrenArr);
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
});
|
|
1892
|
-
return newArr.concat(this.promptCommands);
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
AIPromptService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1896
|
-
AIPromptService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptService });
|
|
1897
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptService, decorators: [{
|
|
1898
|
-
type: Injectable
|
|
1899
|
-
}] });
|
|
1900
|
-
|
|
1901
|
-
/**
|
|
1902
|
-
* Represents a template that allows you to define additional ToolBar actions.
|
|
1903
|
-
* The actions will be rendered right after all views' ToolBar buttons.
|
|
1904
|
-
* To define the template, nest an `<ng-template>` tag
|
|
1905
|
-
* with the `kendoAIPromptToolbarActionsTemplate` directive inside the `<kendo-aiprompt>` tag.
|
|
1906
|
-
*/
|
|
1907
|
-
class AIPromptToolbarActionsDirective {
|
|
1908
|
-
constructor(templateRef) {
|
|
1909
|
-
this.templateRef = templateRef;
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
AIPromptToolbarActionsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptToolbarActionsDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1913
|
-
AIPromptToolbarActionsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: AIPromptToolbarActionsDirective, isStandalone: true, selector: "[kendoAIPromptToolbarActionsTemplate]", ngImport: i0 });
|
|
1914
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptToolbarActionsDirective, decorators: [{
|
|
1915
|
-
type: Directive,
|
|
1916
|
-
args: [{
|
|
1917
|
-
selector: '[kendoAIPromptToolbarActionsTemplate]',
|
|
1918
|
-
standalone: true
|
|
1919
|
-
}]
|
|
1920
|
-
}], ctorParameters: function () {
|
|
1921
|
-
return [{ type: i0.TemplateRef, decorators: [{
|
|
1922
|
-
type: Optional
|
|
1923
|
-
}] }];
|
|
1924
|
-
} });
|
|
1925
|
-
|
|
1926
|
-
/**
|
|
1927
|
-
* @hidden
|
|
1928
|
-
*/
|
|
1929
|
-
class ToolbarNavigationService {
|
|
1930
|
-
constructor(localizationService) {
|
|
1931
|
-
this.localizationService = localizationService;
|
|
1932
|
-
this.focusableElements = [];
|
|
1933
|
-
this.currentFocusedIndex = 0;
|
|
1934
|
-
}
|
|
1935
|
-
register(tool) {
|
|
1936
|
-
if (!this.focusableElements.some(el => el === tool)) {
|
|
1937
|
-
this.focusableElements.push(tool);
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
unregister(tool) {
|
|
1941
|
-
this.currentFocusedIndex = 0;
|
|
1942
|
-
this.focusableElements = this.focusableElements.filter(el => el !== tool);
|
|
1943
|
-
}
|
|
1944
|
-
isActive(focusable) {
|
|
1945
|
-
return this.focusableElements[this.currentFocusedIndex] === focusable;
|
|
1946
|
-
}
|
|
1947
|
-
setActiveIndex(tool) {
|
|
1948
|
-
this.currentFocusedIndex = Math.max(this.focusableElements.indexOf(tool), 0);
|
|
1949
|
-
}
|
|
1950
|
-
move(direction) {
|
|
1951
|
-
let delta = direction === 'right' ? 1 : -1;
|
|
1952
|
-
if (this.localizationService.rtl) {
|
|
1953
|
-
delta = -delta;
|
|
1954
|
-
}
|
|
1955
|
-
this.currentFocusedIndex += delta;
|
|
1956
|
-
if (this.currentFocusedIndex < 0) {
|
|
1957
|
-
this.currentFocusedIndex = this.focusableElements.length - 1;
|
|
1958
|
-
}
|
|
1959
|
-
else if (this.currentFocusedIndex >= this.focusableElements.length) {
|
|
1960
|
-
this.currentFocusedIndex = 0;
|
|
1961
|
-
}
|
|
1962
|
-
this.focusableElements[this.currentFocusedIndex].activate();
|
|
1963
|
-
}
|
|
1964
|
-
focusFirst() {
|
|
1965
|
-
this.focusableElements[this.currentFocusedIndex].activate();
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
ToolbarNavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarNavigationService, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1969
|
-
ToolbarNavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarNavigationService });
|
|
1970
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ToolbarNavigationService, decorators: [{
|
|
1971
|
-
type: Injectable
|
|
1972
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
|
1973
|
-
|
|
1974
|
-
/**
|
|
1975
|
-
* @hidden
|
|
1976
|
-
*/
|
|
1977
|
-
class AIPromptToolbarFocusableDirective {
|
|
1978
|
-
constructor(host, navigationService, renderer) {
|
|
1979
|
-
this.host = host;
|
|
1980
|
-
this.navigationService = navigationService;
|
|
1981
|
-
this.renderer = renderer;
|
|
1982
|
-
this.keyDownHandler = (e) => {
|
|
1983
|
-
const targetsSelf = e.target === this.element;
|
|
1984
|
-
const isLeftArrow = e.keyCode === Keys.ArrowLeft;
|
|
1985
|
-
const isRightArrow = e.keyCode === Keys.ArrowRight;
|
|
1986
|
-
const isArrow = isLeftArrow || isRightArrow;
|
|
1987
|
-
if (!targetsSelf || !isArrow) {
|
|
1988
|
-
return;
|
|
1989
|
-
}
|
|
1990
|
-
this.renderer.setAttribute(this.element, 'tabindex', '-1');
|
|
1991
|
-
this.element.querySelectorAll(focusableSelector).forEach(el => {
|
|
1992
|
-
this.renderer.setAttribute(el, 'tabindex', '-1');
|
|
1993
|
-
});
|
|
1994
|
-
if (isRightArrow) {
|
|
1995
|
-
this.navigationService.move('right');
|
|
1996
|
-
}
|
|
1997
|
-
else if (isLeftArrow) {
|
|
1998
|
-
this.navigationService.move('left');
|
|
1999
|
-
}
|
|
2000
|
-
};
|
|
2001
|
-
this.clickHandler = () => {
|
|
2002
|
-
this.navigationService.setActiveIndex(this);
|
|
2003
|
-
};
|
|
2004
|
-
navigationService.register(this);
|
|
2005
|
-
}
|
|
2006
|
-
get element() {
|
|
2007
|
-
return this.host.nativeElement;
|
|
2008
|
-
}
|
|
2009
|
-
ngAfterViewInit() {
|
|
2010
|
-
this.renderer.setAttribute(this.element, 'tabindex', this.navigationService.isActive(this) ? '0' : '-1');
|
|
2011
|
-
this.element.addEventListener('keydown', this.keyDownHandler, { capture: true });
|
|
2012
|
-
this.element.addEventListener('click', this.clickHandler, { capture: true });
|
|
2013
|
-
}
|
|
2014
|
-
ngOnDestroy() {
|
|
2015
|
-
this.navigationService.unregister(this);
|
|
2016
|
-
this.element.removeEventListener('keydown', this.keyDownHandler, { capture: true });
|
|
2017
|
-
this.element.removeEventListener('click', this.clickHandler, { capture: true });
|
|
2018
|
-
}
|
|
2019
|
-
activate() {
|
|
2020
|
-
this.renderer.setAttribute(this.element, 'tabindex', '0');
|
|
2021
|
-
this.element.focus();
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
AIPromptToolbarFocusableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptToolbarFocusableDirective, deps: [{ token: i0.ElementRef }, { token: ToolbarNavigationService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2025
|
-
AIPromptToolbarFocusableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: AIPromptToolbarFocusableDirective, isStandalone: true, selector: "[kendoAIPromptToolbarFocusable]", ngImport: i0 });
|
|
2026
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptToolbarFocusableDirective, decorators: [{
|
|
2027
|
-
type: Directive,
|
|
2028
|
-
args: [{
|
|
2029
|
-
selector: '[kendoAIPromptToolbarFocusable]',
|
|
2030
|
-
standalone: true
|
|
2031
|
-
}]
|
|
2032
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ToolbarNavigationService }, { type: i0.Renderer2 }]; } });
|
|
2033
|
-
|
|
2034
|
-
/**
|
|
2035
|
-
* @hidden
|
|
2036
|
-
*/
|
|
2037
|
-
class Messages extends ComponentMessages {
|
|
2038
|
-
}
|
|
2039
|
-
Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2040
|
-
Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: Messages, inputs: { promptView: "promptView", outputView: "outputView", generateOutput: "generateOutput", promptPlaceholder: "promptPlaceholder", copyOutput: "copyOutput", retryGeneration: "retryGeneration", outputTitle: "outputTitle", outputRetryTitle: "outputRetryTitle", promptSuggestions: "promptSuggestions" }, usesInheritance: true, ngImport: i0 });
|
|
2041
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: Messages, decorators: [{
|
|
2042
|
-
type: Directive
|
|
2043
|
-
}], propDecorators: { promptView: [{
|
|
2044
|
-
type: Input
|
|
2045
|
-
}], outputView: [{
|
|
2046
|
-
type: Input
|
|
2047
|
-
}], generateOutput: [{
|
|
2048
|
-
type: Input
|
|
2049
|
-
}], promptPlaceholder: [{
|
|
2050
|
-
type: Input
|
|
2051
|
-
}], copyOutput: [{
|
|
2052
|
-
type: Input
|
|
2053
|
-
}], retryGeneration: [{
|
|
2054
|
-
type: Input
|
|
2055
|
-
}], outputTitle: [{
|
|
2056
|
-
type: Input
|
|
2057
|
-
}], outputRetryTitle: [{
|
|
2058
|
-
type: Input
|
|
2059
|
-
}], promptSuggestions: [{
|
|
2060
|
-
type: Input
|
|
2061
|
-
}] } });
|
|
2062
|
-
|
|
2063
|
-
/**
|
|
2064
|
-
* @hidden
|
|
2065
|
-
*/
|
|
2066
|
-
class LocalizedMessagesDirective extends Messages {
|
|
2067
|
-
constructor(service) {
|
|
2068
|
-
super();
|
|
2069
|
-
this.service = service;
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2072
|
-
LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2073
|
-
LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: LocalizedMessagesDirective, isStandalone: true, selector: "[kendoAIPromptLocalizedMessages]", providers: [
|
|
2074
|
-
{
|
|
2075
|
-
provide: Messages,
|
|
2076
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
|
2077
|
-
}
|
|
2078
|
-
], usesInheritance: true, ngImport: i0 });
|
|
2079
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
|
|
2080
|
-
type: Directive,
|
|
2081
|
-
args: [{
|
|
2082
|
-
providers: [
|
|
2083
|
-
{
|
|
2084
|
-
provide: Messages,
|
|
2085
|
-
useExisting: forwardRef(() => LocalizedMessagesDirective)
|
|
2086
|
-
}
|
|
2087
|
-
],
|
|
2088
|
-
selector: '[kendoAIPromptLocalizedMessages]',
|
|
2089
|
-
standalone: true
|
|
2090
|
-
}]
|
|
2091
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
|
2092
|
-
|
|
2093
|
-
/**
|
|
2094
|
-
* Represents the Kendo UI AIPrompt component for Angular.
|
|
2095
|
-
*/
|
|
2096
|
-
class AIPromptComponent {
|
|
2097
|
-
constructor(localization, service, navigationService, ngZone) {
|
|
2098
|
-
this.localization = localization;
|
|
2099
|
-
this.service = service;
|
|
2100
|
-
this.navigationService = navigationService;
|
|
2101
|
-
this.ngZone = ngZone;
|
|
2102
|
-
this.hostClasses = true;
|
|
2103
|
-
/**
|
|
2104
|
-
* Fires when the `activeView` property of the component is updated.
|
|
2105
|
-
* Used to provide a two-way binding for the `activeView` property.
|
|
2106
|
-
*/
|
|
2107
|
-
this.activeViewChange = new EventEmitter();
|
|
2108
|
-
/**
|
|
2109
|
-
* Fires each time the user clicks the Prompt view Generate button or the Output view Retry button.
|
|
2110
|
-
* To distinguish the source element, use the event's `isRetry` field.
|
|
2111
|
-
*/
|
|
2112
|
-
this.promptRequest = new EventEmitter();
|
|
2113
|
-
/**
|
|
2114
|
-
* Fires each time the user clicks a Command view command. Exposes the selected command as event data.
|
|
2115
|
-
*/
|
|
2116
|
-
this.commandExecute = new EventEmitter();
|
|
2117
|
-
/**
|
|
2118
|
-
* Fires each time the user clicks any Output view Copy button.
|
|
2119
|
-
*/
|
|
2120
|
-
this.outputCopy = new EventEmitter();
|
|
2121
|
-
/**
|
|
2122
|
-
* Fires each time the user clicks a rating button in any Output view card.
|
|
2123
|
-
*/
|
|
2124
|
-
this.outputRatingChange = new EventEmitter();
|
|
2125
|
-
this.subs = new Subscription();
|
|
2126
|
-
/**
|
|
2127
|
-
* @hidden
|
|
2128
|
-
*/
|
|
2129
|
-
this.sparklesIcon = sparklesIcon;
|
|
2130
|
-
/**
|
|
2131
|
-
* @hidden
|
|
2132
|
-
*/
|
|
2133
|
-
this.outputIcon = commentIcon;
|
|
2134
|
-
this._activeView = 0;
|
|
2135
|
-
validatePackage(packageMetadata);
|
|
2136
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
2137
|
-
this.subs.add(localization.changes.subscribe(({ rtl }) => {
|
|
2138
|
-
this.direction = rtl ? 'rtl' : 'ltr';
|
|
2139
|
-
}));
|
|
2140
|
-
}
|
|
2141
|
-
get dirAttr() {
|
|
2142
|
-
return this.direction;
|
|
2143
|
-
}
|
|
2144
|
-
/**
|
|
2145
|
-
* The active view index of the AIPrompt component.
|
|
2146
|
-
*/
|
|
2147
|
-
set activeView(idx) {
|
|
2148
|
-
if (this._activeView !== idx) {
|
|
2149
|
-
this._activeView = idx;
|
|
2150
|
-
this.service.promptValue && (this.service.promptValue = '');
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
get activeView() {
|
|
2154
|
-
return this._activeView;
|
|
2155
|
-
}
|
|
2156
|
-
/**
|
|
2157
|
-
* The collection of commands that will be rendered in the Command view.
|
|
2158
|
-
*/
|
|
2159
|
-
set promptCommands(value) {
|
|
2160
|
-
this.service.promptCommands = value;
|
|
2161
|
-
}
|
|
2162
|
-
/**
|
|
2163
|
-
* The collection of suggestions that will be rendered in the Prompt view.
|
|
2164
|
-
*/
|
|
2165
|
-
set promptSuggestions(value) {
|
|
2166
|
-
this.service.promptSuggestions = value;
|
|
2167
|
-
}
|
|
2168
|
-
/**
|
|
2169
|
-
* The collection of generated prompt outputs that will be rendered in the Output view.
|
|
2170
|
-
*/
|
|
2171
|
-
set promptOutputs(value) {
|
|
2172
|
-
this.service.promptOutputs = value;
|
|
2173
|
-
}
|
|
2174
|
-
/**
|
|
2175
|
-
* Specifies if the rating buttons in each Output view card will be rendered.
|
|
2176
|
-
* By default, rating buttons are not rendered.
|
|
2177
|
-
*
|
|
2178
|
-
* @default false
|
|
2179
|
-
*/
|
|
2180
|
-
set showOutputRating(value) {
|
|
2181
|
-
this.service.showOutputRating = value;
|
|
2182
|
-
}
|
|
2183
|
-
ngAfterViewInit() {
|
|
2184
|
-
this.ngZone.runOutsideAngular(() => {
|
|
2185
|
-
this.service.aiPrompt = this;
|
|
2186
|
-
this.subs.add(this.service.requestEvent.subscribe(ev => this.promptRequest.emit(ev)));
|
|
2187
|
-
this.subs.add(this.service.executeEvent.subscribe(ev => this.commandExecute.emit(ev)));
|
|
2188
|
-
this.subs.add(this.service.outputCopyEvent.subscribe(ev => this.outputCopy.emit(ev)));
|
|
2189
|
-
this.subs.add(this.service.outputRatingChangeEvent.subscribe(ev => this.outputRatingChange.emit(ev)));
|
|
2190
|
-
});
|
|
2191
|
-
}
|
|
2192
|
-
ngOnDestroy() {
|
|
2193
|
-
this.subs.unsubscribe();
|
|
2194
|
-
}
|
|
2195
|
-
/**
|
|
2196
|
-
* Focuses the first focusable element in the AIPrompt.
|
|
2197
|
-
*/
|
|
2198
|
-
focus() {
|
|
2199
|
-
this.navigationService.focusFirst();
|
|
2200
|
-
}
|
|
2201
|
-
/**
|
|
2202
|
-
* @hidden
|
|
2203
|
-
*/
|
|
2204
|
-
get selectedView() {
|
|
2205
|
-
return this.viewsArray[this.activeView];
|
|
2206
|
-
}
|
|
2207
|
-
/**
|
|
2208
|
-
* @hidden
|
|
2209
|
-
*/
|
|
2210
|
-
get viewsArray() {
|
|
2211
|
-
var _a;
|
|
2212
|
-
return (_a = this.views) === null || _a === void 0 ? void 0 : _a.toArray();
|
|
2213
|
-
}
|
|
2214
|
-
/**
|
|
2215
|
-
* @hidden
|
|
2216
|
-
*/
|
|
2217
|
-
viewChange(idx) {
|
|
2218
|
-
if (idx !== this.activeView) {
|
|
2219
|
-
this.activeView = idx;
|
|
2220
|
-
this.activeViewChange.emit(idx);
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
/**
|
|
2224
|
-
* @hidden
|
|
2225
|
-
*/
|
|
2226
|
-
messageFor(text) {
|
|
2227
|
-
return this.localization.get(text);
|
|
2228
|
-
}
|
|
2229
|
-
/**
|
|
2230
|
-
* @hidden
|
|
2231
|
-
*/
|
|
2232
|
-
get viewTemplate() {
|
|
2233
|
-
var _a, _b, _c;
|
|
2234
|
-
return ((_a = this.selectedView) === null || _a === void 0 ? void 0 : _a.viewType) === 'custom' ? (_b = this.selectedView) === null || _b === void 0 ? void 0 : _b.viewTemplate : (_c = this.selectedView) === null || _c === void 0 ? void 0 : _c.template;
|
|
2235
|
-
}
|
|
2236
|
-
/**
|
|
2237
|
-
* @hidden
|
|
2238
|
-
*/
|
|
2239
|
-
handleGenerateOutput() {
|
|
2240
|
-
const value = this.service.promptValue;
|
|
2241
|
-
const eventArgs = {
|
|
2242
|
-
prompt: value,
|
|
2243
|
-
sender: this,
|
|
2244
|
-
isRetry: false
|
|
2245
|
-
};
|
|
2246
|
-
this.promptRequest.emit(eventArgs);
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
AIPromptComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }, { token: ToolbarNavigationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
2250
|
-
AIPromptComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIPromptComponent, isStandalone: true, selector: "kendo-aiprompt", inputs: { activeView: "activeView", promptCommands: "promptCommands", promptSuggestions: "promptSuggestions", promptOutputs: "promptOutputs", showOutputRating: "showOutputRating" }, outputs: { activeViewChange: "activeViewChange", promptRequest: "promptRequest", commandExecute: "commandExecute", outputCopy: "outputCopy", outputRatingChange: "outputRatingChange" }, host: { properties: { "class.k-prompt": "this.hostClasses", "attr.dir": "this.dirAttr" } }, providers: [
|
|
2251
|
-
LocalizationService,
|
|
2252
|
-
AIPromptService,
|
|
2253
|
-
ToolbarNavigationService,
|
|
2254
|
-
{
|
|
2255
|
-
provide: L10N_PREFIX,
|
|
2256
|
-
useValue: 'kendo.aiprompt'
|
|
2257
|
-
}
|
|
2258
|
-
], queries: [{ propertyName: "toolbarActionsTemplate", first: true, predicate: AIPromptToolbarActionsDirective, descendants: true }, { propertyName: "views", predicate: BaseView }], exportAs: ["kendoAIPrompt"], ngImport: i0, template: `
|
|
2259
|
-
<ng-container kendoAIPromptLocalizedMessages
|
|
2260
|
-
i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
|
|
2261
|
-
promptView="Ask AI"
|
|
2262
|
-
i18n-outputView="kendo.aiprompt.outputView|The Toolbar button text for the Output view."
|
|
2263
|
-
outputView="Output"
|
|
2264
|
-
i18n-generateOutput="kendo.aiprompt.generateOutput|The text for the Generate button in the Prompt view."
|
|
2265
|
-
generateOutput="Generate"
|
|
2266
|
-
i18n-promptPlaceholder="kendo.aiprompt.promptPlaceholder|The placeholder text for the Prompt View text area."
|
|
2267
|
-
promptPlaceholder="Ask or generate content with AI"
|
|
2268
|
-
i18n-copyOutput="kendo.aiprompt.copyOutput|The Copy button text in each Output view card."
|
|
2269
|
-
copyOutput="Copy"
|
|
2270
|
-
i18n-retryGeneration="kendo.aiprompt.retryGeneration|The Retry button text in each Output view card."
|
|
2271
|
-
retryGeneration="Retry"
|
|
2272
|
-
i18n-outputTitle="kendo.aiprompt.outputTitle|The title of each Output view card."
|
|
2273
|
-
outputTitle="Generated with AI"
|
|
2274
|
-
i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
|
|
2275
|
-
outputRetryTitle="Generated with AI"
|
|
2276
|
-
i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
|
|
2277
|
-
promptSuggestions="Prompt suggestions">
|
|
2278
|
-
</ng-container>
|
|
2279
|
-
<div class="k-prompt-header">
|
|
2280
|
-
<div class="k-toolbar-flat k-toolbar k-toolbar-md"
|
|
2281
|
-
role="toolbar">
|
|
2282
|
-
<button *ngFor="let view of viewsArray; let idx = index"
|
|
2283
|
-
kendoButton
|
|
2284
|
-
kendoAIPromptToolbarFocusable
|
|
2285
|
-
type="button"
|
|
2286
|
-
fillMode="flat"
|
|
2287
|
-
rounded="full"
|
|
2288
|
-
themeColor="primary"
|
|
2289
|
-
[svgIcon]="view.svgIcon"
|
|
2290
|
-
[icon]="view.icon"
|
|
2291
|
-
[selected]="idx === activeView"
|
|
2292
|
-
(click)="viewChange(idx)">
|
|
2293
|
-
{{view.buttonText}}
|
|
2294
|
-
</button>
|
|
2295
|
-
|
|
2296
|
-
<ng-template *ngIf="toolbarActionsTemplate"
|
|
2297
|
-
[ngTemplateOutlet]="toolbarActionsTemplate?.templateRef">
|
|
2298
|
-
</ng-template>
|
|
2299
|
-
</div>
|
|
2300
|
-
</div>
|
|
2301
|
-
<div class="k-prompt-content">
|
|
2302
|
-
<div class="k-prompt-view">
|
|
2303
|
-
<ng-container *ngTemplateOutlet="viewTemplate">
|
|
2304
|
-
</ng-container>
|
|
2305
|
-
</div>
|
|
2306
|
-
</div>
|
|
2307
|
-
<div class="k-prompt-footer" *ngIf="selectedView?.viewType === 'prompt'">
|
|
2308
|
-
<div class="k-actions k-actions-start k-actions-horizontal k-prompt-actions">
|
|
2309
|
-
<button
|
|
2310
|
-
kendoButton
|
|
2311
|
-
type="button"
|
|
2312
|
-
themeColor="primary"
|
|
2313
|
-
rounded="full"
|
|
2314
|
-
[svgIcon]="sparklesIcon"
|
|
2315
|
-
icon="sparkles"
|
|
2316
|
-
(click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
|
|
2317
|
-
</div>
|
|
2318
|
-
</div>
|
|
2319
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoAIPromptLocalizedMessages]" }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: AIPromptToolbarFocusableDirective, selector: "[kendoAIPromptToolbarFocusable]" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
2320
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptComponent, decorators: [{
|
|
2321
|
-
type: Component,
|
|
2322
|
-
args: [{
|
|
2323
|
-
exportAs: 'kendoAIPrompt',
|
|
2324
|
-
selector: 'kendo-aiprompt',
|
|
2325
|
-
providers: [
|
|
2326
|
-
LocalizationService,
|
|
2327
|
-
AIPromptService,
|
|
2328
|
-
ToolbarNavigationService,
|
|
2329
|
-
{
|
|
2330
|
-
provide: L10N_PREFIX,
|
|
2331
|
-
useValue: 'kendo.aiprompt'
|
|
2332
|
-
}
|
|
2333
|
-
],
|
|
2334
|
-
template: `
|
|
2335
|
-
<ng-container kendoAIPromptLocalizedMessages
|
|
2336
|
-
i18n-promptView="kendo.aiprompt.promptView|The Toolbar button text for the Prompt view."
|
|
2337
|
-
promptView="Ask AI"
|
|
2338
|
-
i18n-outputView="kendo.aiprompt.outputView|The Toolbar button text for the Output view."
|
|
2339
|
-
outputView="Output"
|
|
2340
|
-
i18n-generateOutput="kendo.aiprompt.generateOutput|The text for the Generate button in the Prompt view."
|
|
2341
|
-
generateOutput="Generate"
|
|
2342
|
-
i18n-promptPlaceholder="kendo.aiprompt.promptPlaceholder|The placeholder text for the Prompt View text area."
|
|
2343
|
-
promptPlaceholder="Ask or generate content with AI"
|
|
2344
|
-
i18n-copyOutput="kendo.aiprompt.copyOutput|The Copy button text in each Output view card."
|
|
2345
|
-
copyOutput="Copy"
|
|
2346
|
-
i18n-retryGeneration="kendo.aiprompt.retryGeneration|The Retry button text in each Output view card."
|
|
2347
|
-
retryGeneration="Retry"
|
|
2348
|
-
i18n-outputTitle="kendo.aiprompt.outputTitle|The title of each Output view card."
|
|
2349
|
-
outputTitle="Generated with AI"
|
|
2350
|
-
i18n-outputRetryTitle="kendo.aiprompt.outputRetryTitle|The title of each Output view retry card."
|
|
2351
|
-
outputRetryTitle="Generated with AI"
|
|
2352
|
-
i18n-promptSuggestions="kendo.aiprompt.promptSuggestions|The title of the Prompt suggestions button."
|
|
2353
|
-
promptSuggestions="Prompt suggestions">
|
|
2354
|
-
</ng-container>
|
|
2355
|
-
<div class="k-prompt-header">
|
|
2356
|
-
<div class="k-toolbar-flat k-toolbar k-toolbar-md"
|
|
2357
|
-
role="toolbar">
|
|
2358
|
-
<button *ngFor="let view of viewsArray; let idx = index"
|
|
2359
|
-
kendoButton
|
|
2360
|
-
kendoAIPromptToolbarFocusable
|
|
2361
|
-
type="button"
|
|
2362
|
-
fillMode="flat"
|
|
2363
|
-
rounded="full"
|
|
2364
|
-
themeColor="primary"
|
|
2365
|
-
[svgIcon]="view.svgIcon"
|
|
2366
|
-
[icon]="view.icon"
|
|
2367
|
-
[selected]="idx === activeView"
|
|
2368
|
-
(click)="viewChange(idx)">
|
|
2369
|
-
{{view.buttonText}}
|
|
2370
|
-
</button>
|
|
2371
|
-
|
|
2372
|
-
<ng-template *ngIf="toolbarActionsTemplate"
|
|
2373
|
-
[ngTemplateOutlet]="toolbarActionsTemplate?.templateRef">
|
|
2374
|
-
</ng-template>
|
|
2375
|
-
</div>
|
|
2376
|
-
</div>
|
|
2377
|
-
<div class="k-prompt-content">
|
|
2378
|
-
<div class="k-prompt-view">
|
|
2379
|
-
<ng-container *ngTemplateOutlet="viewTemplate">
|
|
2380
|
-
</ng-container>
|
|
2381
|
-
</div>
|
|
2382
|
-
</div>
|
|
2383
|
-
<div class="k-prompt-footer" *ngIf="selectedView?.viewType === 'prompt'">
|
|
2384
|
-
<div class="k-actions k-actions-start k-actions-horizontal k-prompt-actions">
|
|
2385
|
-
<button
|
|
2386
|
-
kendoButton
|
|
2387
|
-
type="button"
|
|
2388
|
-
themeColor="primary"
|
|
2389
|
-
rounded="full"
|
|
2390
|
-
[svgIcon]="sparklesIcon"
|
|
2391
|
-
icon="sparkles"
|
|
2392
|
-
(click)="handleGenerateOutput()">{{messageFor('generateOutput')}}</button>
|
|
2393
|
-
</div>
|
|
2394
|
-
</div>
|
|
2395
|
-
`,
|
|
2396
|
-
standalone: true,
|
|
2397
|
-
imports: [LocalizedMessagesDirective, NgFor, ButtonComponent, AIPromptToolbarFocusableDirective, NgIf, NgTemplateOutlet]
|
|
2398
|
-
}]
|
|
2399
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }, { type: ToolbarNavigationService }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
|
|
2400
|
-
type: HostBinding,
|
|
2401
|
-
args: ['class.k-prompt']
|
|
2402
|
-
}], dirAttr: [{
|
|
2403
|
-
type: HostBinding,
|
|
2404
|
-
args: ['attr.dir']
|
|
2405
|
-
}], views: [{
|
|
2406
|
-
type: ContentChildren,
|
|
2407
|
-
args: [BaseView]
|
|
2408
|
-
}], toolbarActionsTemplate: [{
|
|
2409
|
-
type: ContentChild,
|
|
2410
|
-
args: [AIPromptToolbarActionsDirective]
|
|
2411
|
-
}], activeView: [{
|
|
2412
|
-
type: Input
|
|
2413
|
-
}], promptCommands: [{
|
|
2414
|
-
type: Input
|
|
2415
|
-
}], promptSuggestions: [{
|
|
2416
|
-
type: Input
|
|
2417
|
-
}], promptOutputs: [{
|
|
2418
|
-
type: Input
|
|
2419
|
-
}], showOutputRating: [{
|
|
2420
|
-
type: Input
|
|
2421
|
-
}], activeViewChange: [{
|
|
2422
|
-
type: Output
|
|
2423
|
-
}], promptRequest: [{
|
|
2424
|
-
type: Output
|
|
2425
|
-
}], commandExecute: [{
|
|
2426
|
-
type: Output
|
|
2427
|
-
}], outputCopy: [{
|
|
2428
|
-
type: Output
|
|
2429
|
-
}], outputRatingChange: [{
|
|
2430
|
-
type: Output
|
|
2431
|
-
}] } });
|
|
2432
|
-
|
|
2433
|
-
/**
|
|
2434
|
-
* The component for rendering the AIPrompt Command View.
|
|
2435
|
-
*/
|
|
2436
|
-
class CommandViewComponent extends BaseView {
|
|
2437
|
-
constructor(localization, service) {
|
|
2438
|
-
super('command', localization);
|
|
2439
|
-
this.service = service;
|
|
2440
|
-
/**
|
|
2441
|
-
* @hidden
|
|
2442
|
-
*/
|
|
2443
|
-
this.panelBarItems = [];
|
|
2444
|
-
}
|
|
2445
|
-
ngOnInit() {
|
|
2446
|
-
if (this.service.promptCommands) {
|
|
2447
|
-
this.panelBarItems = this.getPanelBarItems(this.service.promptCommands);
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
/**
|
|
2451
|
-
* @hidden
|
|
2452
|
-
*/
|
|
2453
|
-
itemClickHandler(ev) {
|
|
2454
|
-
if (ev.item.children) {
|
|
2455
|
-
return;
|
|
2456
|
-
}
|
|
2457
|
-
const selectedCommand = this.service.getFlattenPromptCommands().find(c => c.id == ev.item.id);
|
|
2458
|
-
if (selectedCommand) {
|
|
2459
|
-
const eventArgs = {
|
|
2460
|
-
command: selectedCommand,
|
|
2461
|
-
sender: this.service.aiPrompt,
|
|
2462
|
-
isRetry: false
|
|
2463
|
-
};
|
|
2464
|
-
this.service.executeEvent.next(eventArgs);
|
|
2465
|
-
}
|
|
2466
|
-
}
|
|
2467
|
-
getPanelBarItems(commands) {
|
|
2468
|
-
return commands.map(c => ({
|
|
2469
|
-
title: c.text,
|
|
2470
|
-
id: c.id,
|
|
2471
|
-
icon: c.icon,
|
|
2472
|
-
svgIcon: c.svgIcon,
|
|
2473
|
-
children: c.children ? this.getPanelBarItems(c.children) : null
|
|
2474
|
-
}));
|
|
2475
|
-
}
|
|
2476
|
-
}
|
|
2477
|
-
CommandViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommandViewComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2478
|
-
CommandViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CommandViewComponent, isStandalone: true, selector: "kendo-aiprompt-command-view", providers: [{
|
|
2479
|
-
provide: BaseView,
|
|
2480
|
-
useExisting: forwardRef(() => CommandViewComponent)
|
|
2481
|
-
}], usesInheritance: true, ngImport: i0, template: `
|
|
2482
|
-
<ng-template #content>
|
|
2483
|
-
<kendo-panelbar
|
|
2484
|
-
[items]="panelBarItems"
|
|
2485
|
-
[animate]="false"
|
|
2486
|
-
[selectable]="false"
|
|
2487
|
-
(itemClick)="itemClickHandler($event)"
|
|
2488
|
-
></kendo-panelbar>
|
|
2489
|
-
</ng-template>
|
|
2490
|
-
`, isInline: true, dependencies: [{ kind: "component", type: PanelBarComponent, selector: "kendo-panelbar", inputs: ["expandMode", "selectable", "animate", "height", "keepItemContent", "items"], outputs: ["stateChange", "select", "expand", "collapse", "itemClick"], exportAs: ["kendoPanelbar"] }] });
|
|
2491
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CommandViewComponent, decorators: [{
|
|
2492
|
-
type: Component,
|
|
2493
|
-
args: [{
|
|
2494
|
-
selector: 'kendo-aiprompt-command-view',
|
|
2495
|
-
providers: [{
|
|
2496
|
-
provide: BaseView,
|
|
2497
|
-
useExisting: forwardRef(() => CommandViewComponent)
|
|
2498
|
-
}],
|
|
2499
|
-
template: `
|
|
2500
|
-
<ng-template #content>
|
|
2501
|
-
<kendo-panelbar
|
|
2502
|
-
[items]="panelBarItems"
|
|
2503
|
-
[animate]="false"
|
|
2504
|
-
[selectable]="false"
|
|
2505
|
-
(itemClick)="itemClickHandler($event)"
|
|
2506
|
-
></kendo-panelbar>
|
|
2507
|
-
</ng-template>
|
|
2508
|
-
`,
|
|
2509
|
-
standalone: true,
|
|
2510
|
-
imports: [PanelBarComponent]
|
|
2511
|
-
}]
|
|
2512
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; } });
|
|
2513
|
-
|
|
2514
|
-
/**
|
|
2515
|
-
* Custom component messages override the default component messages.
|
|
2516
|
-
* ([see example]({% slug globalization_chat %}#toc-custom-messages)).
|
|
2517
|
-
*/
|
|
2518
|
-
class AIPromptCustomMessagesComponent extends Messages {
|
|
2519
|
-
constructor(service) {
|
|
2520
|
-
super();
|
|
2521
|
-
this.service = service;
|
|
2522
|
-
}
|
|
2523
|
-
get override() {
|
|
2524
|
-
return true;
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
AIPromptCustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptCustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2528
|
-
AIPromptCustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIPromptCustomMessagesComponent, isStandalone: true, selector: "kendo-aiprompt-messages", providers: [
|
|
2529
|
-
{
|
|
2530
|
-
provide: Messages,
|
|
2531
|
-
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
|
2532
|
-
}
|
|
2533
|
-
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
2534
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptCustomMessagesComponent, decorators: [{
|
|
2535
|
-
type: Component,
|
|
2536
|
-
args: [{
|
|
2537
|
-
providers: [
|
|
2538
|
-
{
|
|
2539
|
-
provide: Messages,
|
|
2540
|
-
useExisting: forwardRef(() => AIPromptCustomMessagesComponent)
|
|
2541
|
-
}
|
|
2542
|
-
],
|
|
2543
|
-
selector: 'kendo-aiprompt-messages',
|
|
2544
|
-
template: ``,
|
|
2545
|
-
standalone: true
|
|
2546
|
-
}]
|
|
2547
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
|
2548
|
-
|
|
2549
|
-
/**
|
|
2550
|
-
* The component for rendering an AIPrompt Custom View.
|
|
2551
|
-
*/
|
|
2552
|
-
class CustomViewComponent extends BaseView {
|
|
2553
|
-
constructor(localization) {
|
|
2554
|
-
super('custom', localization);
|
|
2555
|
-
}
|
|
2556
|
-
}
|
|
2557
|
-
CustomViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomViewComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2558
|
-
CustomViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CustomViewComponent, isStandalone: true, selector: "kendo-aiprompt-custom-view", inputs: { viewTemplate: "viewTemplate" }, providers: [{
|
|
2559
|
-
provide: BaseView,
|
|
2560
|
-
useExisting: forwardRef(() => CustomViewComponent)
|
|
2561
|
-
}], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
2562
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomViewComponent, decorators: [{
|
|
2563
|
-
type: Component,
|
|
2564
|
-
args: [{
|
|
2565
|
-
selector: 'kendo-aiprompt-custom-view',
|
|
2566
|
-
providers: [{
|
|
2567
|
-
provide: BaseView,
|
|
2568
|
-
useExisting: forwardRef(() => CustomViewComponent)
|
|
2569
|
-
}],
|
|
2570
|
-
template: ``,
|
|
2571
|
-
standalone: true
|
|
2572
|
-
}]
|
|
2573
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; }, propDecorators: { viewTemplate: [{
|
|
2574
|
-
type: Input
|
|
2575
|
-
}] } });
|
|
2576
|
-
|
|
2577
|
-
/**
|
|
2578
|
-
* @hidden
|
|
2579
|
-
*/
|
|
2580
|
-
class AIPromptOutputCardComponent {
|
|
2581
|
-
constructor(localization, service) {
|
|
2582
|
-
this.localization = localization;
|
|
2583
|
-
this.service = service;
|
|
2584
|
-
this.hostClass = true;
|
|
2585
|
-
this.listItemRole = 'listitem';
|
|
2586
|
-
this.tabIndex = 0;
|
|
2587
|
-
this.ariaKeyShortcuts = 'Enter';
|
|
2588
|
-
this.copyIcon = copyIcon;
|
|
2589
|
-
this.retryIcon = arrowRotateCwIcon;
|
|
2590
|
-
this.positiveRatingIcon = thumbUpOutlineIcon;
|
|
2591
|
-
this.negativeRatingIcon = thumbDownOutlineIcon;
|
|
2592
|
-
this.titleId = `k-output-card-${guid()}`;
|
|
2593
|
-
}
|
|
2594
|
-
get ariaDescribedBy() {
|
|
2595
|
-
return this.titleId;
|
|
2596
|
-
}
|
|
2597
|
-
ngOnInit() {
|
|
2598
|
-
var _a, _b;
|
|
2599
|
-
if (((_a = this.promptOutput) === null || _a === void 0 ? void 0 : _a.rating) === 'positive') {
|
|
2600
|
-
this.positiveRatingIcon = thumbUpIcon;
|
|
2601
|
-
this.negativeRatingIcon = thumbDownOutlineIcon;
|
|
2602
|
-
}
|
|
2603
|
-
else if (((_b = this.promptOutput) === null || _b === void 0 ? void 0 : _b.rating) === 'negative') {
|
|
2604
|
-
this.negativeRatingIcon = thumbDownIcon;
|
|
2605
|
-
this.positiveRatingIcon = thumbUpOutlineIcon;
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
messageFor(text) {
|
|
2609
|
-
return this.localization.get(text);
|
|
2610
|
-
}
|
|
2611
|
-
get showRating() {
|
|
2612
|
-
return this.service.showOutputRating;
|
|
2613
|
-
}
|
|
2614
|
-
get outputTitle() {
|
|
2615
|
-
if (isPresent(this.promptOutput.title)) {
|
|
2616
|
-
return this.promptOutput.title;
|
|
2617
|
-
}
|
|
2618
|
-
else {
|
|
2619
|
-
const titleMessage = this.promptOutput.isRetry ? 'outputRetryTitle' : 'outputTitle';
|
|
2620
|
-
return this.messageFor(titleMessage);
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
handleRetry() {
|
|
2624
|
-
if (this.promptOutput.commandId) {
|
|
2625
|
-
const eventArgs = {
|
|
2626
|
-
command: this.service.getFlattenPromptCommands().find(c => c.id === this.promptOutput.commandId),
|
|
2627
|
-
sender: this.service.aiPrompt,
|
|
2628
|
-
isRetry: true
|
|
2629
|
-
};
|
|
2630
|
-
this.service.executeEvent.next(eventArgs);
|
|
2631
|
-
}
|
|
2632
|
-
else {
|
|
2633
|
-
const eventArgs = {
|
|
2634
|
-
prompt: this.promptOutput.prompt,
|
|
2635
|
-
sender: this.service.aiPrompt,
|
|
2636
|
-
isRetry: true
|
|
2637
|
-
};
|
|
2638
|
-
this.service.requestEvent.next(eventArgs);
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
handleCopy() {
|
|
2642
|
-
navigator.clipboard.writeText(this.promptOutput.output);
|
|
2643
|
-
this.service.outputCopyEvent.next(this.promptOutput);
|
|
2644
|
-
}
|
|
2645
|
-
handleRating(ratingType) {
|
|
2646
|
-
const eventArgs = {
|
|
2647
|
-
promptOutput: this.promptOutput,
|
|
2648
|
-
rating: ratingType
|
|
2649
|
-
};
|
|
2650
|
-
this.service.outputRatingChangeEvent.next(eventArgs);
|
|
2651
|
-
if (ratingType === 'positive') {
|
|
2652
|
-
this.positiveRatingIcon = thumbUpIcon;
|
|
2653
|
-
this.negativeRatingIcon = thumbDownOutlineIcon;
|
|
2654
|
-
}
|
|
2655
|
-
else {
|
|
2656
|
-
this.negativeRatingIcon = thumbDownIcon;
|
|
2657
|
-
this.positiveRatingIcon = thumbUpOutlineIcon;
|
|
2658
|
-
}
|
|
2659
|
-
}
|
|
2660
|
-
}
|
|
2661
|
-
AIPromptOutputCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptOutputCardComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2662
|
-
AIPromptOutputCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIPromptOutputCardComponent, isStandalone: true, selector: "[kendoAIPromptOutputCard]", inputs: { promptOutput: "promptOutput" }, host: { properties: { "class.k-card": "this.hostClass", "attr.role": "this.listItemRole", "attr.tabindex": "this.tabIndex", "attr.aria-describedby": "this.ariaDescribedBy", "attr.aria-keyshortcuts": "this.ariaKeyShortcuts" } }, ngImport: i0, template: `
|
|
2663
|
-
<div class="k-card-header">
|
|
2664
|
-
<div
|
|
2665
|
-
class="k-card-title"
|
|
2666
|
-
[attr.id]="titleId">{{outputTitle}}
|
|
2667
|
-
</div>
|
|
2668
|
-
<div class="k-card-subtitle">{{promptOutput.prompt}}</div>
|
|
2669
|
-
</div>
|
|
2670
|
-
<div class="k-card-body">
|
|
2671
|
-
<p>{{promptOutput.output}}</p>
|
|
2672
|
-
</div>
|
|
2673
|
-
<div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
|
|
2674
|
-
<button kendoButton
|
|
2675
|
-
fillMode="flat"
|
|
2676
|
-
themeColor="primary"
|
|
2677
|
-
rounded="full"
|
|
2678
|
-
icon="copy"
|
|
2679
|
-
[svgIcon]="copyIcon"
|
|
2680
|
-
(click)="handleCopy()"
|
|
2681
|
-
>{{messageFor('copyOutput')}}</button>
|
|
2682
|
-
<button kendoButton
|
|
2683
|
-
fillMode="flat"
|
|
2684
|
-
rounded="full"
|
|
2685
|
-
icon="arrow-rotate-cw"
|
|
2686
|
-
[svgIcon]="retryIcon"
|
|
2687
|
-
(click)="handleRetry()"
|
|
2688
|
-
>{{messageFor('retryGeneration')}}</button>
|
|
2689
|
-
<ng-container *ngIf="showRating">
|
|
2690
|
-
<span class="k-spacer"></span>
|
|
2691
|
-
<button kendoButton
|
|
2692
|
-
fillMode="flat"
|
|
2693
|
-
icon="thumb-up-outline"
|
|
2694
|
-
[svgIcon]="positiveRatingIcon"
|
|
2695
|
-
(click)="handleRating('positive')">
|
|
2696
|
-
</button>
|
|
2697
|
-
<button kendoButton
|
|
2698
|
-
fillMode="flat"
|
|
2699
|
-
icon="thumb-down-outline"
|
|
2700
|
-
[svgIcon]="negativeRatingIcon"
|
|
2701
|
-
(click)="handleRating('negative')">
|
|
2702
|
-
</button>
|
|
2703
|
-
</ng-container>
|
|
2704
|
-
</div>
|
|
2705
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
2706
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptOutputCardComponent, decorators: [{
|
|
2707
|
-
type: Component,
|
|
2708
|
-
args: [{
|
|
2709
|
-
selector: '[kendoAIPromptOutputCard]',
|
|
2710
|
-
template: `
|
|
2711
|
-
<div class="k-card-header">
|
|
2712
|
-
<div
|
|
2713
|
-
class="k-card-title"
|
|
2714
|
-
[attr.id]="titleId">{{outputTitle}}
|
|
2715
|
-
</div>
|
|
2716
|
-
<div class="k-card-subtitle">{{promptOutput.prompt}}</div>
|
|
2717
|
-
</div>
|
|
2718
|
-
<div class="k-card-body">
|
|
2719
|
-
<p>{{promptOutput.output}}</p>
|
|
2720
|
-
</div>
|
|
2721
|
-
<div class="k-actions k-actions-start k-actions-horizontal k-card-actions">
|
|
2722
|
-
<button kendoButton
|
|
2723
|
-
fillMode="flat"
|
|
2724
|
-
themeColor="primary"
|
|
2725
|
-
rounded="full"
|
|
2726
|
-
icon="copy"
|
|
2727
|
-
[svgIcon]="copyIcon"
|
|
2728
|
-
(click)="handleCopy()"
|
|
2729
|
-
>{{messageFor('copyOutput')}}</button>
|
|
2730
|
-
<button kendoButton
|
|
2731
|
-
fillMode="flat"
|
|
2732
|
-
rounded="full"
|
|
2733
|
-
icon="arrow-rotate-cw"
|
|
2734
|
-
[svgIcon]="retryIcon"
|
|
2735
|
-
(click)="handleRetry()"
|
|
2736
|
-
>{{messageFor('retryGeneration')}}</button>
|
|
2737
|
-
<ng-container *ngIf="showRating">
|
|
2738
|
-
<span class="k-spacer"></span>
|
|
2739
|
-
<button kendoButton
|
|
2740
|
-
fillMode="flat"
|
|
2741
|
-
icon="thumb-up-outline"
|
|
2742
|
-
[svgIcon]="positiveRatingIcon"
|
|
2743
|
-
(click)="handleRating('positive')">
|
|
2744
|
-
</button>
|
|
2745
|
-
<button kendoButton
|
|
2746
|
-
fillMode="flat"
|
|
2747
|
-
icon="thumb-down-outline"
|
|
2748
|
-
[svgIcon]="negativeRatingIcon"
|
|
2749
|
-
(click)="handleRating('negative')">
|
|
2750
|
-
</button>
|
|
2751
|
-
</ng-container>
|
|
2752
|
-
</div>
|
|
2753
|
-
`,
|
|
2754
|
-
standalone: true,
|
|
2755
|
-
imports: [ButtonComponent, NgIf]
|
|
2756
|
-
}]
|
|
2757
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; }, propDecorators: { hostClass: [{
|
|
2758
|
-
type: HostBinding,
|
|
2759
|
-
args: ['class.k-card']
|
|
2760
|
-
}], listItemRole: [{
|
|
2761
|
-
type: HostBinding,
|
|
2762
|
-
args: ['attr.role']
|
|
2763
|
-
}], tabIndex: [{
|
|
2764
|
-
type: HostBinding,
|
|
2765
|
-
args: ['attr.tabindex']
|
|
2766
|
-
}], ariaDescribedBy: [{
|
|
2767
|
-
type: HostBinding,
|
|
2768
|
-
args: ['attr.aria-describedby']
|
|
2769
|
-
}], ariaKeyShortcuts: [{
|
|
2770
|
-
type: HostBinding,
|
|
2771
|
-
args: ['attr.aria-keyshortcuts']
|
|
2772
|
-
}], promptOutput: [{
|
|
2773
|
-
type: Input
|
|
2774
|
-
}] } });
|
|
2775
|
-
|
|
2776
|
-
/**
|
|
2777
|
-
* The component for rendering the AIPrompt Output View.
|
|
2778
|
-
*/
|
|
2779
|
-
class OutputViewComponent extends BaseView {
|
|
2780
|
-
constructor(localization, service) {
|
|
2781
|
-
super('output', localization);
|
|
2782
|
-
this.service = service;
|
|
2783
|
-
}
|
|
2784
|
-
/**
|
|
2785
|
-
* @hidden
|
|
2786
|
-
*/
|
|
2787
|
-
get promptOutputs() {
|
|
2788
|
-
return this.service.promptOutputs;
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
OutputViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OutputViewComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2792
|
-
OutputViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: OutputViewComponent, isStandalone: true, selector: "kendo-aiprompt-output-view", providers: [{
|
|
2793
|
-
provide: BaseView,
|
|
2794
|
-
useExisting: forwardRef(() => OutputViewComponent)
|
|
2795
|
-
}], usesInheritance: true, ngImport: i0, template: `
|
|
2796
|
-
<ng-template #content>
|
|
2797
|
-
<div
|
|
2798
|
-
class="k-card-list"
|
|
2799
|
-
role="list">
|
|
2800
|
-
<div *ngFor="let output of promptOutputs"
|
|
2801
|
-
kendoAIPromptOutputCard
|
|
2802
|
-
[promptOutput]="output">
|
|
2803
|
-
</div>
|
|
2804
|
-
</div>
|
|
2805
|
-
</ng-template>
|
|
2806
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: AIPromptOutputCardComponent, selector: "[kendoAIPromptOutputCard]", inputs: ["promptOutput"] }] });
|
|
2807
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OutputViewComponent, decorators: [{
|
|
2808
|
-
type: Component,
|
|
2809
|
-
args: [{
|
|
2810
|
-
selector: 'kendo-aiprompt-output-view',
|
|
2811
|
-
providers: [{
|
|
2812
|
-
provide: BaseView,
|
|
2813
|
-
useExisting: forwardRef(() => OutputViewComponent)
|
|
2814
|
-
}],
|
|
2815
|
-
template: `
|
|
2816
|
-
<ng-template #content>
|
|
2817
|
-
<div
|
|
2818
|
-
class="k-card-list"
|
|
2819
|
-
role="list">
|
|
2820
|
-
<div *ngFor="let output of promptOutputs"
|
|
2821
|
-
kendoAIPromptOutputCard
|
|
2822
|
-
[promptOutput]="output">
|
|
2823
|
-
</div>
|
|
2824
|
-
</div>
|
|
2825
|
-
</ng-template>
|
|
2826
|
-
`,
|
|
2827
|
-
standalone: true,
|
|
2828
|
-
imports: [NgFor, AIPromptOutputCardComponent]
|
|
2829
|
-
}]
|
|
2830
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; } });
|
|
2831
|
-
|
|
2832
|
-
/**
|
|
2833
|
-
* The component for rendering the AIPrompt Prompt View.
|
|
2834
|
-
*/
|
|
2835
|
-
class PromptViewComponent extends BaseView {
|
|
2836
|
-
constructor(localization, service) {
|
|
2837
|
-
super('prompt', localization);
|
|
2838
|
-
this.service = service;
|
|
2839
|
-
/**
|
|
2840
|
-
* @hidden
|
|
2841
|
-
*/
|
|
2842
|
-
this.showSuggestions = true;
|
|
2843
|
-
/**
|
|
2844
|
-
* @hidden
|
|
2845
|
-
*/
|
|
2846
|
-
this.contentId = `k-prompt-suggestions-${guid()}`;
|
|
2847
|
-
}
|
|
2848
|
-
/**
|
|
2849
|
-
* @hidden
|
|
2850
|
-
*/
|
|
2851
|
-
get suggestionsIcons() {
|
|
2852
|
-
return this.showSuggestions ?
|
|
2853
|
-
{ font: 'chevron-up', svg: chevronUpIcon } :
|
|
2854
|
-
{ font: 'chevron-down', svg: chevronDownIcon };
|
|
2855
|
-
}
|
|
2856
|
-
/**
|
|
2857
|
-
* @hidden
|
|
2858
|
-
*/
|
|
2859
|
-
get promptSuggestions() {
|
|
2860
|
-
return this.service.promptSuggestions;
|
|
2861
|
-
}
|
|
2862
|
-
/**
|
|
2863
|
-
*
|
|
2864
|
-
* @hidden
|
|
2865
|
-
*/
|
|
2866
|
-
set textAreaValue(value) {
|
|
2867
|
-
this.service.promptValue = value;
|
|
2868
|
-
}
|
|
2869
|
-
get textAreaValue() {
|
|
2870
|
-
return this.service.promptValue;
|
|
2871
|
-
}
|
|
2872
|
-
/**
|
|
2873
|
-
* @hidden
|
|
2874
|
-
*/
|
|
2875
|
-
suggestionClick(suggestion) {
|
|
2876
|
-
this.textAreaValue = this.service.promptValue = suggestion;
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
PromptViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PromptViewComponent, deps: [{ token: i1$1.LocalizationService }, { token: AIPromptService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2880
|
-
PromptViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PromptViewComponent, isStandalone: true, selector: "kendo-aiprompt-prompt-view", providers: [
|
|
2881
|
-
{
|
|
2882
|
-
provide: BaseView,
|
|
2883
|
-
useExisting: forwardRef(() => PromptViewComponent)
|
|
2884
|
-
}
|
|
2885
|
-
], usesInheritance: true, ngImport: i0, template: `
|
|
2886
|
-
<ng-template #content>
|
|
2887
|
-
<kendo-textarea
|
|
2888
|
-
[placeholder]="messageFor('promptPlaceholder')"
|
|
2889
|
-
[rows]="1"
|
|
2890
|
-
[(value)]="textAreaValue">
|
|
2891
|
-
</kendo-textarea>
|
|
2892
|
-
<div *ngIf="promptSuggestions"
|
|
2893
|
-
class="k-prompt-expander">
|
|
2894
|
-
<button kendoButton
|
|
2895
|
-
[attr.aria-controls]="contentId"
|
|
2896
|
-
[attr.aria-expanded]="showSuggestions"
|
|
2897
|
-
fillMode="flat"
|
|
2898
|
-
[icon]="suggestionsIcons.font"
|
|
2899
|
-
[svgIcon]="suggestionsIcons.svg"
|
|
2900
|
-
type="button"
|
|
2901
|
-
(click)="showSuggestions = !showSuggestions">
|
|
2902
|
-
{{messageFor('promptSuggestions')}}
|
|
2903
|
-
</button>
|
|
2904
|
-
<div *ngIf="showSuggestions"
|
|
2905
|
-
class="k-prompt-expander-content"
|
|
2906
|
-
role="list"
|
|
2907
|
-
[attr.id]="contentId">
|
|
2908
|
-
<div *ngFor="let suggestion of promptSuggestions"
|
|
2909
|
-
class="k-prompt-suggestion"
|
|
2910
|
-
role="listitem"
|
|
2911
|
-
(click)="suggestionClick(suggestion)">
|
|
2912
|
-
{{suggestion}}
|
|
2913
|
-
</div>
|
|
2914
|
-
</div>
|
|
2915
|
-
</div>
|
|
2916
|
-
</ng-template>
|
|
2917
|
-
`, isInline: true, dependencies: [{ kind: "component", type: TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
2918
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PromptViewComponent, decorators: [{
|
|
2919
|
-
type: Component,
|
|
2920
|
-
args: [{
|
|
2921
|
-
selector: 'kendo-aiprompt-prompt-view',
|
|
2922
|
-
providers: [
|
|
2923
|
-
{
|
|
2924
|
-
provide: BaseView,
|
|
2925
|
-
useExisting: forwardRef(() => PromptViewComponent)
|
|
2926
|
-
}
|
|
2927
|
-
],
|
|
2928
|
-
template: `
|
|
2929
|
-
<ng-template #content>
|
|
2930
|
-
<kendo-textarea
|
|
2931
|
-
[placeholder]="messageFor('promptPlaceholder')"
|
|
2932
|
-
[rows]="1"
|
|
2933
|
-
[(value)]="textAreaValue">
|
|
2934
|
-
</kendo-textarea>
|
|
2935
|
-
<div *ngIf="promptSuggestions"
|
|
2936
|
-
class="k-prompt-expander">
|
|
2937
|
-
<button kendoButton
|
|
2938
|
-
[attr.aria-controls]="contentId"
|
|
2939
|
-
[attr.aria-expanded]="showSuggestions"
|
|
2940
|
-
fillMode="flat"
|
|
2941
|
-
[icon]="suggestionsIcons.font"
|
|
2942
|
-
[svgIcon]="suggestionsIcons.svg"
|
|
2943
|
-
type="button"
|
|
2944
|
-
(click)="showSuggestions = !showSuggestions">
|
|
2945
|
-
{{messageFor('promptSuggestions')}}
|
|
2946
|
-
</button>
|
|
2947
|
-
<div *ngIf="showSuggestions"
|
|
2948
|
-
class="k-prompt-expander-content"
|
|
2949
|
-
role="list"
|
|
2950
|
-
[attr.id]="contentId">
|
|
2951
|
-
<div *ngFor="let suggestion of promptSuggestions"
|
|
2952
|
-
class="k-prompt-suggestion"
|
|
2953
|
-
role="listitem"
|
|
2954
|
-
(click)="suggestionClick(suggestion)">
|
|
2955
|
-
{{suggestion}}
|
|
2956
|
-
</div>
|
|
2957
|
-
</div>
|
|
2958
|
-
</div>
|
|
2959
|
-
</ng-template>
|
|
2960
|
-
`,
|
|
2961
|
-
standalone: true,
|
|
2962
|
-
imports: [TextAreaComponent, NgIf, ButtonComponent, NgFor]
|
|
2963
|
-
}]
|
|
2964
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: AIPromptService }]; } });
|
|
2965
|
-
|
|
2966
|
-
// eslint-disable no-forward-ref
|
|
2967
|
-
/**
|
|
2968
|
-
* Custom component messages override default component messages
|
|
2969
|
-
* ([see example]({% slug globalization_chat %}#toc-custom-messages)).
|
|
2970
|
-
*/
|
|
2971
|
-
class CustomMessagesComponent extends Messages$1 {
|
|
2972
|
-
constructor(service) {
|
|
2973
|
-
super();
|
|
2974
|
-
this.service = service;
|
|
2975
|
-
}
|
|
2976
|
-
get override() {
|
|
2977
|
-
return true;
|
|
2978
|
-
}
|
|
2979
|
-
}
|
|
2980
|
-
CustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2981
|
-
CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CustomMessagesComponent, isStandalone: true, selector: "kendo-chat-messages", providers: [
|
|
2982
|
-
{
|
|
2983
|
-
provide: Messages$1,
|
|
2984
|
-
useExisting: forwardRef(() => CustomMessagesComponent)
|
|
2985
|
-
}
|
|
2986
|
-
], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
2987
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CustomMessagesComponent, decorators: [{
|
|
2988
|
-
type: Component,
|
|
2989
|
-
args: [{
|
|
2990
|
-
providers: [
|
|
2991
|
-
{
|
|
2992
|
-
provide: Messages$1,
|
|
2993
|
-
useExisting: forwardRef(() => CustomMessagesComponent)
|
|
2994
|
-
}
|
|
2995
|
-
],
|
|
2996
|
-
selector: 'kendo-chat-messages',
|
|
2997
|
-
template: ``,
|
|
2998
|
-
standalone: true
|
|
2999
|
-
}]
|
|
3000
|
-
}], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
|
|
3001
|
-
|
|
3002
|
-
/**
|
|
3003
|
-
* Represents a Hero Card component ([see example]({% slug dialogflow_chat %})).
|
|
3004
|
-
* Hero cards host a single large image and action buttons with text content.
|
|
3005
|
-
*/
|
|
3006
|
-
class HeroCardComponent {
|
|
3007
|
-
constructor() {
|
|
3008
|
-
this.cssClass = true;
|
|
3009
|
-
/**
|
|
3010
|
-
* Fires when the user clicks a button.
|
|
3011
|
-
*/
|
|
3012
|
-
this.executeAction = new EventEmitter();
|
|
3013
|
-
}
|
|
3014
|
-
onClick(action) {
|
|
3015
|
-
this.executeAction.next(action);
|
|
3016
|
-
}
|
|
3017
|
-
}
|
|
3018
|
-
HeroCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HeroCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3019
|
-
HeroCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: HeroCardComponent, isStandalone: true, selector: "kendo-chat-hero-card", inputs: { imageUrl: "imageUrl", title: "title", subtitle: "subtitle", actions: "actions" }, outputs: { executeAction: "executeAction" }, host: { properties: { "class.k-card": "this.cssClass" } }, ngImport: i0, template: `
|
|
3020
|
-
<img class="k-card-image" [src]="imageUrl" *ngIf="imageUrl" />
|
|
3021
|
-
<div class="k-card-body">
|
|
3022
|
-
<h5 class="k-card-title" *ngIf="title">
|
|
3023
|
-
{{ title }}
|
|
3024
|
-
</h5>
|
|
3025
|
-
<h6 class="k-card-subtitle" *ngIf="subtitle">
|
|
3026
|
-
{{ subtitle }}
|
|
3027
|
-
</h6>
|
|
3028
|
-
</div>
|
|
3029
|
-
<div class="k-card-actions k-card-actions-vertical">
|
|
3030
|
-
<span class="k-card-action"
|
|
3031
|
-
*ngFor="let act of actions"
|
|
3032
|
-
>
|
|
3033
|
-
<button
|
|
3034
|
-
kendoButton fillMode="flat"
|
|
3035
|
-
(click)="onClick(act)"
|
|
3036
|
-
>
|
|
3037
|
-
{{ act.title }}
|
|
3038
|
-
</button>
|
|
3039
|
-
</span>
|
|
3040
|
-
</div>
|
|
3041
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
|
|
3042
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HeroCardComponent, decorators: [{
|
|
3043
|
-
type: Component,
|
|
3044
|
-
args: [{
|
|
3045
|
-
selector: 'kendo-chat-hero-card',
|
|
3046
|
-
template: `
|
|
3047
|
-
<img class="k-card-image" [src]="imageUrl" *ngIf="imageUrl" />
|
|
3048
|
-
<div class="k-card-body">
|
|
3049
|
-
<h5 class="k-card-title" *ngIf="title">
|
|
3050
|
-
{{ title }}
|
|
3051
|
-
</h5>
|
|
3052
|
-
<h6 class="k-card-subtitle" *ngIf="subtitle">
|
|
3053
|
-
{{ subtitle }}
|
|
3054
|
-
</h6>
|
|
3055
|
-
</div>
|
|
3056
|
-
<div class="k-card-actions k-card-actions-vertical">
|
|
3057
|
-
<span class="k-card-action"
|
|
3058
|
-
*ngFor="let act of actions"
|
|
3059
|
-
>
|
|
3060
|
-
<button
|
|
3061
|
-
kendoButton fillMode="flat"
|
|
3062
|
-
(click)="onClick(act)"
|
|
3063
|
-
>
|
|
3064
|
-
{{ act.title }}
|
|
3065
|
-
</button>
|
|
3066
|
-
</span>
|
|
3067
|
-
</div>
|
|
3068
|
-
`,
|
|
3069
|
-
standalone: true,
|
|
3070
|
-
imports: [NgIf, NgFor, ButtonComponent]
|
|
3071
|
-
}]
|
|
3072
|
-
}], propDecorators: { imageUrl: [{
|
|
3073
|
-
type: Input
|
|
3074
|
-
}], title: [{
|
|
3075
|
-
type: Input
|
|
3076
|
-
}], subtitle: [{
|
|
3077
|
-
type: Input
|
|
3078
|
-
}], actions: [{
|
|
3079
|
-
type: Input
|
|
3080
|
-
}], cssClass: [{
|
|
3081
|
-
type: HostBinding,
|
|
3082
|
-
args: ['class.k-card']
|
|
3083
|
-
}], executeAction: [{
|
|
3084
|
-
type: Output
|
|
3085
|
-
}] } });
|
|
3086
|
-
|
|
3087
|
-
/**
|
|
3088
|
-
* Utility array that contains all `AIPrompt` related components and directives
|
|
3089
|
-
*/
|
|
3090
|
-
const KENDO_AIPROMPT = [
|
|
3091
|
-
AIPromptComponent,
|
|
3092
|
-
PromptViewComponent,
|
|
3093
|
-
OutputViewComponent,
|
|
3094
|
-
CommandViewComponent,
|
|
3095
|
-
CustomViewComponent,
|
|
3096
|
-
AIPromptCustomMessagesComponent,
|
|
3097
|
-
AIPromptToolbarActionsDirective,
|
|
3098
|
-
AIPromptToolbarFocusableDirective
|
|
3099
|
-
];
|
|
3100
|
-
/**
|
|
3101
|
-
* Utility array that contains all `Chat` related components and directives
|
|
3102
|
-
*/
|
|
3103
|
-
const KENDO_CHAT = [
|
|
3104
|
-
ChatComponent,
|
|
3105
|
-
CustomMessagesComponent,
|
|
3106
|
-
AttachmentTemplateDirective,
|
|
3107
|
-
MessageTemplateDirective,
|
|
3108
|
-
HeroCardComponent,
|
|
3109
|
-
ChatMessageBoxTemplateDirective
|
|
3110
|
-
];
|
|
3111
|
-
/**
|
|
3112
|
-
* Utility array that contains all `@progress/kendo-angular-conversational-ui` related components and directives
|
|
3113
|
-
*/
|
|
3114
|
-
const KENDO_CONVERSATIONALUI = [
|
|
3115
|
-
...KENDO_AIPROMPT,
|
|
3116
|
-
...KENDO_CHAT
|
|
3117
|
-
];
|
|
3118
|
-
|
|
3119
|
-
// IMPORTANT: NgModule export kept for backwards compatibility
|
|
3120
|
-
/**
|
|
3121
|
-
* The [NgModule](link:site.data.urls.angular['ngmodules']) for the AIPrompt component.
|
|
3122
|
-
*
|
|
3123
|
-
* @example
|
|
3124
|
-
* ```ts-no-run
|
|
3125
|
-
* import { NgModule } from '@angular/core';
|
|
3126
|
-
* import { Component } from '@angular/core';
|
|
3127
|
-
* import { BrowserModule } from '@angular/platform-browser';
|
|
3128
|
-
*
|
|
3129
|
-
* import { AIPromptModule } from '@progress/kendo-angular-conversational-ui';
|
|
3130
|
-
* import { AppComponent } from './app.component';
|
|
3131
|
-
*
|
|
3132
|
-
* _@NgModule({
|
|
3133
|
-
* imports: [ BrowserModule, AIPromptModule ],
|
|
3134
|
-
* declarations: [ AppComponent ],
|
|
3135
|
-
* bootstrap: [ AppComponent ]
|
|
3136
|
-
* })
|
|
3137
|
-
*
|
|
3138
|
-
* export class AppModule { }
|
|
3139
|
-
* ```
|
|
3140
|
-
*/
|
|
3141
|
-
class AIPromptModule {
|
|
3142
|
-
}
|
|
3143
|
-
AIPromptModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3144
|
-
AIPromptModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: AIPromptModule, imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective], exports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective] });
|
|
3145
|
-
AIPromptModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptModule, providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService], imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent] });
|
|
3146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIPromptModule, decorators: [{
|
|
3147
|
-
type: NgModule,
|
|
3148
|
-
args: [{
|
|
3149
|
-
exports: [...KENDO_AIPROMPT],
|
|
3150
|
-
imports: [...KENDO_AIPROMPT],
|
|
3151
|
-
providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService]
|
|
3152
|
-
}]
|
|
3153
|
-
}] });
|
|
3154
|
-
|
|
3155
|
-
// IMPORTANT: NgModule export kept for backwards compatibility
|
|
3156
|
-
/**
|
|
3157
|
-
* The [NgModule](link:site.data.urls.angular['ngmodules']) for the Chat component.
|
|
3158
|
-
*
|
|
3159
|
-
* @example
|
|
3160
|
-
* ```ts-no-run
|
|
3161
|
-
* import { NgModule } from '@angular/core';
|
|
3162
|
-
* import { Component } from '@angular/core';
|
|
3163
|
-
* import { BrowserModule } from '@angular/platform-browser';
|
|
3164
|
-
*
|
|
3165
|
-
* import { ChatModule } from '@progress/kendo-angular-conversational-ui';
|
|
3166
|
-
* import { AppComponent } from './app.component';
|
|
3167
|
-
*
|
|
3168
|
-
* _@NgModule({
|
|
3169
|
-
* imports: [ BrowserModule, ChatModule ],
|
|
3170
|
-
* declarations: [ AppComponent ],
|
|
3171
|
-
* bootstrap: [ AppComponent ]
|
|
3172
|
-
* })
|
|
3173
|
-
*
|
|
3174
|
-
* export class AppModule { }
|
|
3175
|
-
* ```
|
|
3176
|
-
*/
|
|
3177
|
-
class ChatModule {
|
|
3178
|
-
}
|
|
3179
|
-
ChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3180
|
-
ChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: ChatModule, imports: [ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective], exports: [ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective] });
|
|
3181
|
-
ChatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChatModule, providers: [IconsService, ResizeBatchService], imports: [ChatComponent, CustomMessagesComponent, HeroCardComponent] });
|
|
3182
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ChatModule, decorators: [{
|
|
3183
|
-
type: NgModule,
|
|
3184
|
-
args: [{
|
|
3185
|
-
exports: [...KENDO_CHAT],
|
|
3186
|
-
imports: [...KENDO_CHAT],
|
|
3187
|
-
providers: [IconsService, ResizeBatchService]
|
|
3188
|
-
}]
|
|
3189
|
-
}] });
|
|
3190
|
-
|
|
3191
|
-
// IMPORTANT: NgModule export kept for backwards compatibility
|
|
3192
|
-
/**
|
|
3193
|
-
* Represents the [NgModule](link:site.data.urls.angular['ngmodules'])
|
|
3194
|
-
* definition for the Conversational UI components.
|
|
3195
|
-
*
|
|
3196
|
-
* @example
|
|
3197
|
-
*
|
|
3198
|
-
* ```ts-no-run
|
|
3199
|
-
* // Import the Conversational UI module
|
|
3200
|
-
* import { ConversationalUIModule } from '@progress/kendo-angular-conversational-ui';
|
|
3201
|
-
*
|
|
3202
|
-
* // The browser platform with a compiler
|
|
3203
|
-
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
3204
|
-
*
|
|
3205
|
-
* import { NgModule } from '@angular/core';
|
|
3206
|
-
*
|
|
3207
|
-
* // Import the app component
|
|
3208
|
-
* import { AppComponent } from './app.component';
|
|
3209
|
-
*
|
|
3210
|
-
* // Define the app module
|
|
3211
|
-
* _@NgModule({
|
|
3212
|
-
* declarations: [AppComponent], // declare app component
|
|
3213
|
-
* imports: [BrowserModule, ConversationalUIModule], // import Conversational UI module
|
|
3214
|
-
* bootstrap: [AppComponent]
|
|
3215
|
-
* })
|
|
3216
|
-
* export class AppModule {}
|
|
3217
|
-
*
|
|
3218
|
-
* // Compile and launch the module
|
|
3219
|
-
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
3220
|
-
*
|
|
3221
|
-
* ```
|
|
3222
|
-
*/
|
|
3223
|
-
class ConversationalUIModule {
|
|
3224
|
-
}
|
|
3225
|
-
ConversationalUIModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ConversationalUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3226
|
-
ConversationalUIModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: ConversationalUIModule, imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective], exports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, ChatComponent, CustomMessagesComponent, AttachmentTemplateDirective, MessageTemplateDirective, HeroCardComponent, ChatMessageBoxTemplateDirective] });
|
|
3227
|
-
ConversationalUIModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ConversationalUIModule, providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService], imports: [AIPromptComponent, PromptViewComponent, OutputViewComponent, CommandViewComponent, CustomViewComponent, AIPromptCustomMessagesComponent, ChatComponent, CustomMessagesComponent, HeroCardComponent] });
|
|
3228
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ConversationalUIModule, decorators: [{
|
|
3229
|
-
type: NgModule,
|
|
3230
|
-
args: [{
|
|
3231
|
-
exports: [...KENDO_CONVERSATIONALUI],
|
|
3232
|
-
imports: [...KENDO_CONVERSATIONALUI],
|
|
3233
|
-
providers: [IconsService, PopupService, ResizeBatchService, DialogContainerService, DialogService, WindowService, WindowContainerService]
|
|
3234
|
-
}]
|
|
3235
|
-
}] });
|
|
3236
|
-
|
|
3237
|
-
/**
|
|
3238
|
-
* Generated bundle index. Do not edit.
|
|
3239
|
-
*/
|
|
3240
|
-
|
|
3241
|
-
export { AIPromptComponent, AIPromptCustomMessagesComponent, AIPromptModule, AIPromptToolbarActionsDirective, AIPromptToolbarFocusableDirective, AttachmentTemplateDirective, ChatComponent, ChatMessageBoxTemplateDirective, ChatModule, CommandViewComponent, ConversationalUIModule, CustomMessagesComponent, CustomViewComponent, ExecuteActionEvent, HeroCardComponent, KENDO_AIPROMPT, KENDO_CHAT, KENDO_CONVERSATIONALUI, MessageTemplateDirective, OutputViewComponent, PromptViewComponent, SendMessageEvent };
|
|
3242
|
-
|