@progress/kendo-angular-conversational-ui 21.4.1-develop.1 → 22.0.0-develop.1
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/localization/messages.d.ts +1 -1
- package/ai-prompt/views/base-view.d.ts +1 -1
- package/chat/l10n/messages.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-conversational-ui.mjs +182 -182
- package/inline-ai-prompt/localization/messages.d.ts +1 -1
- package/package.json +17 -25
- package/esm2022/ai-prompt/aiprompt.component.mjs +0 -556
- package/esm2022/ai-prompt/aiprompt.module.mjs +0 -53
- package/esm2022/ai-prompt/common/aiprompt.service.mjs +0 -75
- package/esm2022/ai-prompt/common/output-card.component.mjs +0 -230
- package/esm2022/ai-prompt/common/toolbar-focusable.directive.mjs +0 -72
- package/esm2022/ai-prompt/common/toolbar-navigation.service.mjs +0 -56
- package/esm2022/ai-prompt/localization/custom-messages.component.mjs +0 -54
- package/esm2022/ai-prompt/localization/localized-messages.directive.mjs +0 -39
- package/esm2022/ai-prompt/localization/messages.mjs +0 -77
- package/esm2022/ai-prompt/models/ai-prompt-settings.mjs +0 -5
- package/esm2022/ai-prompt/models/command-execute-event.mjs +0 -5
- package/esm2022/ai-prompt/models/command.interface.mjs +0 -5
- package/esm2022/ai-prompt/models/index.mjs +0 -5
- package/esm2022/ai-prompt/models/output-rating-change-event.mjs +0 -5
- package/esm2022/ai-prompt/models/prompt-output.interface.mjs +0 -5
- package/esm2022/ai-prompt/models/prompt-request-event.mjs +0 -5
- package/esm2022/ai-prompt/models/view-type.mjs +0 -5
- package/esm2022/ai-prompt/templates/aiprompt-output-body-template.directive.mjs +0 -33
- package/esm2022/ai-prompt/templates/aiprompt-output-template.directive.mjs +0 -33
- package/esm2022/ai-prompt/templates/toolbar-actions.template.mjs +0 -39
- package/esm2022/ai-prompt/utils.mjs +0 -26
- package/esm2022/ai-prompt/views/base-view.mjs +0 -98
- package/esm2022/ai-prompt/views/command-view.component.mjs +0 -100
- package/esm2022/ai-prompt/views/custom-view.component.mjs +0 -50
- package/esm2022/ai-prompt/views/index.mjs +0 -8
- package/esm2022/ai-prompt/views/output-view.component.mjs +0 -90
- package/esm2022/ai-prompt/views/prompt-view.component.mjs +0 -288
- package/esm2022/chat/api/action.interface.mjs +0 -5
- package/esm2022/chat/api/attachment.interface.mjs +0 -5
- package/esm2022/chat/api/chat-file-interface.mjs +0 -5
- package/esm2022/chat/api/chat-suggestion.interface.mjs +0 -5
- package/esm2022/chat/api/execute-action-event.mjs +0 -29
- package/esm2022/chat/api/file-action.mjs +0 -5
- package/esm2022/chat/api/file-download-event.interface.mjs +0 -5
- package/esm2022/chat/api/files-layout.mjs +0 -5
- package/esm2022/chat/api/index.mjs +0 -21
- package/esm2022/chat/api/message-action.mjs +0 -5
- package/esm2022/chat/api/message-settings.interface.mjs +0 -5
- package/esm2022/chat/api/message-width-mode.mjs +0 -5
- package/esm2022/chat/api/message.interface.mjs +0 -5
- package/esm2022/chat/api/post-message-event.mjs +0 -21
- package/esm2022/chat/api/preventable-event.mjs +0 -28
- package/esm2022/chat/api/send-button-settings.mjs +0 -5
- package/esm2022/chat/api/suggestions-layout.mjs +0 -5
- package/esm2022/chat/api/timestamp-visibility.mjs +0 -5
- package/esm2022/chat/api/user.interface.mjs +0 -5
- package/esm2022/chat/attachment.component.mjs +0 -105
- package/esm2022/chat/builtin-actions.mjs +0 -27
- package/esm2022/chat/cards/hero-card.component.mjs +0 -131
- package/esm2022/chat/chat-file.component.mjs +0 -144
- package/esm2022/chat/chat-item.mjs +0 -10
- package/esm2022/chat/chat-view.mjs +0 -80
- package/esm2022/chat/chat.component.mjs +0 -1015
- package/esm2022/chat/chat.directives.mjs +0 -18
- package/esm2022/chat/chat.module.mjs +0 -61
- package/esm2022/chat/common/chat.service.mjs +0 -179
- package/esm2022/chat/common/models/default-model-fields.mjs +0 -25
- package/esm2022/chat/common/models/formatted-text-parts.mjs +0 -5
- package/esm2022/chat/common/models/message-box-options.mjs +0 -5
- package/esm2022/chat/common/models/model-fields.mjs +0 -5
- package/esm2022/chat/common/scroll-anchor.directive.mjs +0 -80
- package/esm2022/chat/common/scroll-button.component.mjs +0 -81
- package/esm2022/chat/common/scroll.service.mjs +0 -110
- package/esm2022/chat/common/utils.mjs +0 -159
- package/esm2022/chat/l10n/custom-messages.component.mjs +0 -55
- package/esm2022/chat/l10n/localized-messages.directive.mjs +0 -40
- package/esm2022/chat/l10n/messages.mjs +0 -130
- package/esm2022/chat/message-attachments.component.mjs +0 -258
- package/esm2022/chat/message-box.component.mjs +0 -501
- package/esm2022/chat/message-list.component.mjs +0 -617
- package/esm2022/chat/message-reference-content.component.mjs +0 -86
- package/esm2022/chat/message.component.mjs +0 -740
- package/esm2022/chat/suggested-actions.component.mjs +0 -443
- package/esm2022/chat/templates/attachment-template.directive.mjs +0 -43
- package/esm2022/chat/templates/author-message-content-template.directive.mjs +0 -39
- package/esm2022/chat/templates/author-message-template.directive.mjs +0 -39
- package/esm2022/chat/templates/header-template.directive.mjs +0 -33
- package/esm2022/chat/templates/message-box.directive.mjs +0 -36
- package/esm2022/chat/templates/message-content-template.directive.mjs +0 -39
- package/esm2022/chat/templates/message-template.directive.mjs +0 -39
- package/esm2022/chat/templates/no-data-template.directive.mjs +0 -38
- package/esm2022/chat/templates/receiver-message-content-template.directive.mjs +0 -39
- package/esm2022/chat/templates/receiver-message-template.directive.mjs +0 -39
- package/esm2022/chat/templates/status-template.directive.mjs +0 -33
- package/esm2022/chat/templates/suggestion-template.directive.mjs +0 -36
- package/esm2022/chat/templates/timestamp-template.directive.mjs +0 -42
- package/esm2022/chat/templates/user-status-template.directive.mjs +0 -38
- package/esm2022/conversational-ui.module.mjs +0 -73
- package/esm2022/directives.mjs +0 -145
- package/esm2022/index.mjs +0 -40
- package/esm2022/inline-ai-prompt/inlineaiprompt-content.component.mjs +0 -548
- package/esm2022/inline-ai-prompt/inlineaiprompt.component.mjs +0 -351
- package/esm2022/inline-ai-prompt/inlineaiprompt.module.mjs +0 -46
- package/esm2022/inline-ai-prompt/inlineaiprompt.service.mjs +0 -92
- package/esm2022/inline-ai-prompt/localization/custom-messages.component.mjs +0 -51
- package/esm2022/inline-ai-prompt/localization/localized-messages.directive.mjs +0 -39
- package/esm2022/inline-ai-prompt/localization/messages.mjs +0 -35
- package/esm2022/inline-ai-prompt/models/command.interface.mjs +0 -5
- package/esm2022/inline-ai-prompt/models/index.mjs +0 -5
- package/esm2022/inline-ai-prompt/models/inlineaiprompt-popupsettings.mjs +0 -5
- package/esm2022/inline-ai-prompt/models/inlineaiprompt-settings.mjs +0 -59
- package/esm2022/inline-ai-prompt/models/messages.mjs +0 -8
- package/esm2022/inline-ai-prompt/models/output-action-click-event.mjs +0 -5
- package/esm2022/inline-ai-prompt/models/output-action.interface.mjs +0 -5
- package/esm2022/inline-ai-prompt/models/prompt-output.interface.mjs +0 -5
- package/esm2022/inline-ai-prompt/models/prompt-request-event.mjs +0 -5
- package/esm2022/inline-ai-prompt/output-template.directive.mjs +0 -38
- package/esm2022/inline-ai-prompt/utils.mjs +0 -57
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-conversational-ui.mjs +0 -8
|
@@ -1,617 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
-
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, Input, Output, QueryList, Renderer2, ViewChildren } from '@angular/core';
|
|
8
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
9
|
-
import { ExecuteActionEvent } from './api';
|
|
10
|
-
import { isPresent, Keys, normalizeKeys, ResizeSensorComponent } from '@progress/kendo-angular-common';
|
|
11
|
-
import { IntlService } from '@progress/kendo-angular-intl';
|
|
12
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
13
|
-
import { closest, DOWNLOAD_ALL_SELECTOR, FILE_ACTION_BTN_SELECTOR } from './common/utils';
|
|
14
|
-
import { ChatItem } from './chat-item';
|
|
15
|
-
import { chatView, isAuthor } from './chat-view';
|
|
16
|
-
import { AttachmentTemplateDirective } from './templates/attachment-template.directive';
|
|
17
|
-
import { MessageContentTemplateDirective } from './templates/message-content-template.directive';
|
|
18
|
-
import { ChatTimestampTemplateDirective } from './templates/timestamp-template.directive';
|
|
19
|
-
import { Subscription } from 'rxjs';
|
|
20
|
-
import { SuggestedActionsComponent } from './suggested-actions.component';
|
|
21
|
-
import { MessageComponent } from './message.component';
|
|
22
|
-
import { MessageAttachmentsComponent } from './message-attachments.component';
|
|
23
|
-
import { AttachmentComponent } from './attachment.component';
|
|
24
|
-
import { ChatService } from './common/chat.service';
|
|
25
|
-
import { ChatStatusTemplateDirective } from './templates/status-template.directive';
|
|
26
|
-
import { ChatUserStatusTemplateDirective } from './templates/user-status-template.directive';
|
|
27
|
-
import { MessageTemplateDirective } from './templates/message-template.directive';
|
|
28
|
-
import { AuthorMessageContentTemplateDirective } from './templates/author-message-content-template.directive';
|
|
29
|
-
import { ReceiverMessageContentTemplateDirective } from './templates/receiver-message-content-template.directive';
|
|
30
|
-
import { AuthorMessageTemplateDirective } from './templates/author-message-template.directive';
|
|
31
|
-
import { ReceiverMessageTemplateDirective } from './templates/receiver-message-template.directive';
|
|
32
|
-
import * as i0 from "@angular/core";
|
|
33
|
-
import * as i1 from "@progress/kendo-angular-intl";
|
|
34
|
-
import * as i2 from "./common/chat.service";
|
|
35
|
-
/**
|
|
36
|
-
* @hidden
|
|
37
|
-
*/
|
|
38
|
-
export class MessageListComponent {
|
|
39
|
-
element;
|
|
40
|
-
intl;
|
|
41
|
-
renderer;
|
|
42
|
-
chatService;
|
|
43
|
-
cdr;
|
|
44
|
-
set messages(value) {
|
|
45
|
-
const data = value || [];
|
|
46
|
-
this.view = chatView(data);
|
|
47
|
-
this._messages = data;
|
|
48
|
-
}
|
|
49
|
-
get messages() {
|
|
50
|
-
return this._messages;
|
|
51
|
-
}
|
|
52
|
-
attachmentTemplate;
|
|
53
|
-
authorMessageContentTemplate;
|
|
54
|
-
receiverMessageContentTemplate;
|
|
55
|
-
messageContentTemplate;
|
|
56
|
-
authorMessageTemplate;
|
|
57
|
-
receiverMessageTemplate;
|
|
58
|
-
messageTemplate;
|
|
59
|
-
timestampTemplate;
|
|
60
|
-
statusTemplate;
|
|
61
|
-
userStatusTemplate;
|
|
62
|
-
localization;
|
|
63
|
-
authorId;
|
|
64
|
-
executeAction = new EventEmitter();
|
|
65
|
-
navigate = new EventEmitter();
|
|
66
|
-
resize = new EventEmitter();
|
|
67
|
-
items;
|
|
68
|
-
cssClass = true;
|
|
69
|
-
view = [];
|
|
70
|
-
_messages;
|
|
71
|
-
subs = new Subscription();
|
|
72
|
-
selectedItem;
|
|
73
|
-
keyActions = {
|
|
74
|
-
[Keys.Home]: (_) => this.onHomeOrEndKeyDown('home'),
|
|
75
|
-
[Keys.End]: (_) => this.onHomeOrEndKeyDown('end'),
|
|
76
|
-
[Keys.ArrowUp]: (e) => this.navigateTo(e, -1),
|
|
77
|
-
[Keys.ArrowDown]: (e) => this.navigateTo(e, 1),
|
|
78
|
-
[Keys.Tab]: (e) => this.onTabKeyDown(e),
|
|
79
|
-
[Keys.F10]: (e) => e.shiftKey && this.openContextMenu(e),
|
|
80
|
-
};
|
|
81
|
-
constructor(element, intl, renderer, chatService, cdr) {
|
|
82
|
-
this.element = element;
|
|
83
|
-
this.intl = intl;
|
|
84
|
-
this.renderer = renderer;
|
|
85
|
-
this.chatService = chatService;
|
|
86
|
-
this.cdr = cdr;
|
|
87
|
-
}
|
|
88
|
-
ngOnInit() {
|
|
89
|
-
const elRef = this.element.nativeElement;
|
|
90
|
-
this.subs.add(this.renderer.listen(elRef, 'keydown', event => this.onKeydown(event)));
|
|
91
|
-
this.subs.add(this.renderer.listen(elRef, 'focusout', event => this.onBlur(event)));
|
|
92
|
-
this.subs.add(this.renderer.listen(elRef, 'click', event => {
|
|
93
|
-
const messageComponent = this.findMessageComponentFromEvent(event);
|
|
94
|
-
if (messageComponent) {
|
|
95
|
-
this.select(messageComponent, event);
|
|
96
|
-
}
|
|
97
|
-
}));
|
|
98
|
-
this.subs.add(this.renderer.listen(elRef, 'contextmenu', event => {
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
const messageComponent = this.findMessageComponentFromEvent(event);
|
|
101
|
-
if (messageComponent) {
|
|
102
|
-
this.onContextMenuClick(messageComponent.message, event, messageComponent);
|
|
103
|
-
}
|
|
104
|
-
}));
|
|
105
|
-
this.subs.add(this.chatService.replyReferenceClick$.subscribe((messageId) => {
|
|
106
|
-
this.scrollToAndSelectMessage(messageId);
|
|
107
|
-
}));
|
|
108
|
-
this.subs.add(this.chatService.contextMenuVisibilityChange$.subscribe((isVisible) => {
|
|
109
|
-
this.handleMenuClose(isVisible);
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
112
|
-
ngAfterViewInit() {
|
|
113
|
-
this.selectedItem = this.items.last;
|
|
114
|
-
}
|
|
115
|
-
ngOnDestroy() {
|
|
116
|
-
this.subs.unsubscribe();
|
|
117
|
-
}
|
|
118
|
-
onResize() {
|
|
119
|
-
this.resize.emit();
|
|
120
|
-
}
|
|
121
|
-
onClick(message, event) {
|
|
122
|
-
this.select(message, event);
|
|
123
|
-
}
|
|
124
|
-
onContextMenuClick(message, event, messageElement) {
|
|
125
|
-
this.chatService.calculateContextMenuActions(this.isOwnMessage(message));
|
|
126
|
-
if (this.chatService.calculatedContextMenuActions.length > 0) {
|
|
127
|
-
this.chatService.messagesContextMenu.show({
|
|
128
|
-
left: event.pageX,
|
|
129
|
-
top: event.pageY,
|
|
130
|
-
});
|
|
131
|
-
this.chatService.activeMessageElement = messageElement;
|
|
132
|
-
this.chatService.activeMessage = message;
|
|
133
|
-
this.chatService.active = true;
|
|
134
|
-
this.chatService.selectOnMenuClose = this.chatService.activeMessageElement?.selected;
|
|
135
|
-
this.chatService.emit('contextMenuVisibilityChange', true);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
formatTimeStamp(date) {
|
|
139
|
-
return this.intl.formatDate(date, { date: 'full' });
|
|
140
|
-
}
|
|
141
|
-
calculateMessageWidthMode(message) {
|
|
142
|
-
const isOwn = this.isOwnMessage(message);
|
|
143
|
-
const messageSettings = isOwn ? this.chatService.authorMessageSettings : this.chatService.receiverMessageSettings;
|
|
144
|
-
if (messageSettings?.messageWidthMode) {
|
|
145
|
-
return messageSettings.messageWidthMode === 'full';
|
|
146
|
-
}
|
|
147
|
-
return this.chatService.messageWidthMode === 'full';
|
|
148
|
-
}
|
|
149
|
-
onKeydown(e) {
|
|
150
|
-
// On some keyboards Numpad keys are used for Home/End/PageUp/PageDown.
|
|
151
|
-
const code = normalizeKeys(e);
|
|
152
|
-
const action = this.keyActions[code];
|
|
153
|
-
if (action) {
|
|
154
|
-
action(e);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
onBlur(args) {
|
|
158
|
-
const next = args.relatedTarget || document.activeElement;
|
|
159
|
-
const outside = !closest(next, (node) => node === this.element.nativeElement);
|
|
160
|
-
const isActionClick = closest(next, (node) => node?.classList?.contains('k-context-menu-popup')) || closest(next, (node) => node?.classList?.contains('k-menu-popup'));
|
|
161
|
-
if (outside && !isActionClick) {
|
|
162
|
-
this.select(null);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
isOwnMessage(msg) {
|
|
166
|
-
return isAuthor(this.authorId, msg);
|
|
167
|
-
}
|
|
168
|
-
showGroupAuthor(group) {
|
|
169
|
-
const messageSettings = this.isOwnMessage(group.messages[0]) ?
|
|
170
|
-
this.chatService.authorMessageSettings : this.chatService.receiverMessageSettings;
|
|
171
|
-
if (isPresent(messageSettings?.showUsername)) {
|
|
172
|
-
return messageSettings.showUsername && group.author.name;
|
|
173
|
-
}
|
|
174
|
-
return this.chatService.showUsername && group.author.name;
|
|
175
|
-
}
|
|
176
|
-
showGroupAvatar(group) {
|
|
177
|
-
const messageSettings = this.isOwnMessage(group.messages[0]) ?
|
|
178
|
-
this.chatService.authorMessageSettings : this.chatService.receiverMessageSettings;
|
|
179
|
-
if (isPresent(messageSettings?.showAvatar)) {
|
|
180
|
-
return messageSettings.showAvatar && group.author.avatarUrl;
|
|
181
|
-
}
|
|
182
|
-
return this.chatService.showAvatar && group.author.avatarUrl;
|
|
183
|
-
}
|
|
184
|
-
dispatchAction(action, message) {
|
|
185
|
-
const args = new ExecuteActionEvent(action, message);
|
|
186
|
-
this.executeAction.emit(args);
|
|
187
|
-
}
|
|
188
|
-
trackGroup(_index, item) {
|
|
189
|
-
return item.trackBy;
|
|
190
|
-
}
|
|
191
|
-
select(item, event) {
|
|
192
|
-
if (event) {
|
|
193
|
-
const target = event.target;
|
|
194
|
-
if (target.classList.contains('k-suggestion') || target.closest(DOWNLOAD_ALL_SELECTOR) || target.closest(FILE_ACTION_BTN_SELECTOR)) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
if (!this.chatService.toggleMessageState) {
|
|
199
|
-
const prevItem = this.selectedItem;
|
|
200
|
-
if (prevItem) {
|
|
201
|
-
prevItem.selected = false;
|
|
202
|
-
}
|
|
203
|
-
if (item) {
|
|
204
|
-
item.selected = true;
|
|
205
|
-
this.selectedItem = item;
|
|
206
|
-
}
|
|
207
|
-
this.cdr.detectChanges();
|
|
208
|
-
}
|
|
209
|
-
this.chatService.toggleMessageState = false;
|
|
210
|
-
}
|
|
211
|
-
last(items) {
|
|
212
|
-
if (!items || items.length === 0) {
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
const messageGroups = items.filter((item) => item.type === 'message-group');
|
|
216
|
-
const lastMessageGroup = messageGroups[messageGroups.length - 1].messages;
|
|
217
|
-
return lastMessageGroup[lastMessageGroup.length - 1];
|
|
218
|
-
}
|
|
219
|
-
handleMenuClose(state) {
|
|
220
|
-
if (!state) {
|
|
221
|
-
this.select(null);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
textFor(key) {
|
|
225
|
-
return this.localization.get(key);
|
|
226
|
-
}
|
|
227
|
-
onHomeOrEndKeyDown(key) {
|
|
228
|
-
const items = this.items.toArray();
|
|
229
|
-
if (key === 'home') {
|
|
230
|
-
items[0].focus();
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
items[items.length - 1].focus();
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
onTabKeyDown(event) {
|
|
237
|
-
const item = this.items.toArray()[this.items.length - 1];
|
|
238
|
-
const isLastItemQuickReply = item instanceof SuggestedActionsComponent;
|
|
239
|
-
const isLastItemMessage = item instanceof MessageComponent;
|
|
240
|
-
event.target.blur();
|
|
241
|
-
if (isLastItemQuickReply || isLastItemMessage) {
|
|
242
|
-
this.select(item);
|
|
243
|
-
item.focus();
|
|
244
|
-
this.navigate.emit();
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
navigateTo(e, offset) {
|
|
248
|
-
const items = this.items.toArray();
|
|
249
|
-
const prevItem = this.selectedItem;
|
|
250
|
-
const prevIndex = items.indexOf(prevItem);
|
|
251
|
-
const nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
|
|
252
|
-
const nextItem = items[nextIndex];
|
|
253
|
-
const isNextItemQuickReply = nextItem instanceof SuggestedActionsComponent;
|
|
254
|
-
if (nextItem !== prevItem) {
|
|
255
|
-
if (isNextItemQuickReply) {
|
|
256
|
-
nextItem.items.toArray()[0]?.nativeElement.focus();
|
|
257
|
-
}
|
|
258
|
-
this.select(nextItem);
|
|
259
|
-
nextItem.focus();
|
|
260
|
-
this.navigate.emit();
|
|
261
|
-
e.preventDefault();
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
scrollToAndSelectMessage(messageId) {
|
|
265
|
-
this.chatService.scrollToMessage(messageId);
|
|
266
|
-
const message = this.chatService.getMessageById(messageId);
|
|
267
|
-
const chatItem = this.items.find(item => item instanceof MessageComponent &&
|
|
268
|
-
item.message === message);
|
|
269
|
-
if (chatItem) {
|
|
270
|
-
this.select(chatItem);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
openContextMenu(event) {
|
|
274
|
-
event.preventDefault();
|
|
275
|
-
const messageComponent = this.findMessageComponentFromActiveElement();
|
|
276
|
-
if (messageComponent) {
|
|
277
|
-
const messageContentElement = messageComponent.element.nativeElement.querySelector('.k-chat-bubble');
|
|
278
|
-
if (messageContentElement) {
|
|
279
|
-
const rect = messageContentElement?.getBoundingClientRect();
|
|
280
|
-
this.onContextMenuClick(messageComponent.message, {
|
|
281
|
-
pageX: rect.left + (rect.width / 2) + window.scrollX,
|
|
282
|
-
pageY: rect.top + (rect.height / 2) + window.scrollY
|
|
283
|
-
}, messageComponent);
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
const messageElement = messageComponent.element.nativeElement;
|
|
287
|
-
const rect = messageElement?.getBoundingClientRect();
|
|
288
|
-
this.onContextMenuClick(messageComponent.message, {
|
|
289
|
-
pageX: rect.left + (rect.width / 2) + window.scrollX,
|
|
290
|
-
pageY: rect.top + (rect.height / 2) + window.scrollY
|
|
291
|
-
}, messageComponent);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
findMessageComponentFromActiveElement() {
|
|
296
|
-
const activeElement = document.activeElement;
|
|
297
|
-
const messageComponents = this.items.filter(item => item instanceof MessageComponent);
|
|
298
|
-
return messageComponents.find(component => {
|
|
299
|
-
const componentElement = component.element?.nativeElement;
|
|
300
|
-
return componentElement && (componentElement === activeElement || componentElement.contains(activeElement));
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
findMessageComponentFromEvent(event) {
|
|
304
|
-
const target = event.target;
|
|
305
|
-
const clickedElement = target?.closest('.k-message');
|
|
306
|
-
if (!clickedElement)
|
|
307
|
-
return undefined;
|
|
308
|
-
const messageComponents = this.items.filter(item => item instanceof MessageComponent);
|
|
309
|
-
return messageComponents.find(component => {
|
|
310
|
-
const componentElement = component.element?.nativeElement;
|
|
311
|
-
return componentElement && (componentElement === clickedElement || componentElement.contains(clickedElement));
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MessageListComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }, { token: i0.Renderer2 }, { token: i2.ChatService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
315
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: MessageListComponent, isStandalone: true, selector: "kendo-chat-message-list", inputs: { messages: "messages", attachmentTemplate: "attachmentTemplate", authorMessageContentTemplate: "authorMessageContentTemplate", receiverMessageContentTemplate: "receiverMessageContentTemplate", messageContentTemplate: "messageContentTemplate", authorMessageTemplate: "authorMessageTemplate", receiverMessageTemplate: "receiverMessageTemplate", messageTemplate: "messageTemplate", timestampTemplate: "timestampTemplate", statusTemplate: "statusTemplate", userStatusTemplate: "userStatusTemplate", localization: "localization", authorId: "authorId" }, 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: `
|
|
316
|
-
@for (group of view; track trackGroup($index, group); let lastGroup = $last) {
|
|
317
|
-
@switch (group.type) {
|
|
318
|
-
@case ('date-marker') {
|
|
319
|
-
<div
|
|
320
|
-
class="k-timestamp"
|
|
321
|
-
>
|
|
322
|
-
@if (timestampTemplate?.templateRef) {
|
|
323
|
-
<ng-container
|
|
324
|
-
[ngTemplateOutlet]="timestampTemplate.templateRef"
|
|
325
|
-
[ngTemplateOutletContext]="{ $implicit: group.timestamp }"
|
|
326
|
-
>
|
|
327
|
-
</ng-container>
|
|
328
|
-
}
|
|
329
|
-
@if (!timestampTemplate?.templateRef) {
|
|
330
|
-
{{ formatTimeStamp(group.timestamp) }}
|
|
331
|
-
}
|
|
332
|
-
</div>
|
|
333
|
-
}
|
|
334
|
-
@case ('message-group') {
|
|
335
|
-
<div
|
|
336
|
-
class="k-message-group"
|
|
337
|
-
[class.k-message-group-sender]="isOwnMessage(group.messages[0])"
|
|
338
|
-
[class.k-message-group-receiver]="!isOwnMessage(group.messages[0])"
|
|
339
|
-
[class.k-no-avatar]="!showGroupAvatar(group)"
|
|
340
|
-
[class.k-message-group-full-width]="calculateMessageWidthMode(group.messages[0])"
|
|
341
|
-
>
|
|
342
|
-
@if (!userStatusTemplate?.templateRef && showGroupAvatar(group)) {
|
|
343
|
-
<div
|
|
344
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
345
|
-
>
|
|
346
|
-
<span class="k-avatar-image">
|
|
347
|
-
<img
|
|
348
|
-
[attr.src]="group.author.avatarUrl"
|
|
349
|
-
[alt]="group.author.avatarAltText"
|
|
350
|
-
/>
|
|
351
|
-
</span>
|
|
352
|
-
</div>
|
|
353
|
-
}
|
|
354
|
-
@if (showGroupAvatar(group) && userStatusTemplate?.templateRef) {
|
|
355
|
-
<div class="k-chat-user-status-wrapper">
|
|
356
|
-
<div
|
|
357
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
358
|
-
>
|
|
359
|
-
<span class="k-avatar-image">
|
|
360
|
-
<img
|
|
361
|
-
[attr.src]="group.author.avatarUrl"
|
|
362
|
-
[alt]="group.author.avatarAltText"
|
|
363
|
-
/>
|
|
364
|
-
</span>
|
|
365
|
-
</div>
|
|
366
|
-
@if (userStatusTemplate?.templateRef) {
|
|
367
|
-
<div class="k-chat-user-status">
|
|
368
|
-
<ng-template
|
|
369
|
-
[ngTemplateOutlet]="userStatusTemplate.templateRef"
|
|
370
|
-
[ngTemplateOutletContext]="{ $implicit: group.messages.at(-1) }"
|
|
371
|
-
>
|
|
372
|
-
</ng-template>
|
|
373
|
-
</div>
|
|
374
|
-
}
|
|
375
|
-
</div>
|
|
376
|
-
}
|
|
377
|
-
<div class="k-message-group-content">
|
|
378
|
-
@if (showGroupAuthor(group)) {
|
|
379
|
-
<p class="k-message-author">{{ group.author.name }}</p>
|
|
380
|
-
}
|
|
381
|
-
@for (msg of group.messages; track msg; let firstMessage = $first; let lastMessage = $last) {
|
|
382
|
-
@if (msg.user?.avatarUrl) {
|
|
383
|
-
<div
|
|
384
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
385
|
-
>
|
|
386
|
-
<span class="k-avatar-image">
|
|
387
|
-
<img [src]="msg.user?.avatarUrl">
|
|
388
|
-
</span>
|
|
389
|
-
</div>
|
|
390
|
-
}
|
|
391
|
-
<kendo-chat-message #message
|
|
392
|
-
[message]="msg"
|
|
393
|
-
[tabbable]="lastGroup && lastMessage"
|
|
394
|
-
[authorMessageContentTemplate]="authorMessageContentTemplate"
|
|
395
|
-
[receiverMessageContentTemplate]="receiverMessageContentTemplate"
|
|
396
|
-
[messageContentTemplate]="messageContentTemplate"
|
|
397
|
-
[authorMessageTemplate]="authorMessageTemplate"
|
|
398
|
-
[receiverMessageTemplate]="receiverMessageTemplate"
|
|
399
|
-
[messageTemplate]="messageTemplate"
|
|
400
|
-
[statusTemplate]="statusTemplate"
|
|
401
|
-
[authorId]="authorId"
|
|
402
|
-
>
|
|
403
|
-
</kendo-chat-message>
|
|
404
|
-
@if (msg.attachments && msg.attachments.length === 1) {
|
|
405
|
-
<kendo-chat-attachment
|
|
406
|
-
[attachment]="msg.attachments[0]"
|
|
407
|
-
[template]="attachmentTemplate"
|
|
408
|
-
>
|
|
409
|
-
</kendo-chat-attachment>
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
</div>
|
|
413
|
-
</div>
|
|
414
|
-
}
|
|
415
|
-
@case ('attachment-group') {
|
|
416
|
-
<kendo-chat-message-attachments #attachments
|
|
417
|
-
[attachments]="group.attachments"
|
|
418
|
-
[layout]="group.attachmentLayout"
|
|
419
|
-
[localization]="localization"
|
|
420
|
-
[tabbable]="lastGroup"
|
|
421
|
-
[template]="attachmentTemplate"
|
|
422
|
-
(click)="select(attachments)"
|
|
423
|
-
(focus)="select(attachments)"
|
|
424
|
-
>
|
|
425
|
-
</kendo-chat-message-attachments>
|
|
426
|
-
}
|
|
427
|
-
@case ('action-group') {
|
|
428
|
-
<kendo-chat-suggested-actions #actions
|
|
429
|
-
[actions]="group.actions"
|
|
430
|
-
type="action"
|
|
431
|
-
[tabbable]="lastGroup"
|
|
432
|
-
(dispatchAction)="dispatchAction($event, last(view))"
|
|
433
|
-
(click)="select(actions, $event)"
|
|
434
|
-
(focus)="select(actions, $event)"
|
|
435
|
-
>
|
|
436
|
-
</kendo-chat-suggested-actions>
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
<kendo-resize-sensor (resize)="onResize()">
|
|
441
|
-
</kendo-resize-sensor>
|
|
442
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MessageComponent, selector: "kendo-chat-message", inputs: ["message", "tabbable", "authorMessageContentTemplate", "receiverMessageContentTemplate", "messageContentTemplate", "authorMessageTemplate", "receiverMessageTemplate", "messageTemplate", "statusTemplate", "showMessageTime", "authorId"] }, { 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", "suggestions", "tabbable", "type", "suggestionTemplate"], outputs: ["dispatchAction", "dispatchSuggestion"] }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }] });
|
|
443
|
-
}
|
|
444
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MessageListComponent, decorators: [{
|
|
445
|
-
type: Component,
|
|
446
|
-
args: [{
|
|
447
|
-
selector: 'kendo-chat-message-list',
|
|
448
|
-
template: `
|
|
449
|
-
@for (group of view; track trackGroup($index, group); let lastGroup = $last) {
|
|
450
|
-
@switch (group.type) {
|
|
451
|
-
@case ('date-marker') {
|
|
452
|
-
<div
|
|
453
|
-
class="k-timestamp"
|
|
454
|
-
>
|
|
455
|
-
@if (timestampTemplate?.templateRef) {
|
|
456
|
-
<ng-container
|
|
457
|
-
[ngTemplateOutlet]="timestampTemplate.templateRef"
|
|
458
|
-
[ngTemplateOutletContext]="{ $implicit: group.timestamp }"
|
|
459
|
-
>
|
|
460
|
-
</ng-container>
|
|
461
|
-
}
|
|
462
|
-
@if (!timestampTemplate?.templateRef) {
|
|
463
|
-
{{ formatTimeStamp(group.timestamp) }}
|
|
464
|
-
}
|
|
465
|
-
</div>
|
|
466
|
-
}
|
|
467
|
-
@case ('message-group') {
|
|
468
|
-
<div
|
|
469
|
-
class="k-message-group"
|
|
470
|
-
[class.k-message-group-sender]="isOwnMessage(group.messages[0])"
|
|
471
|
-
[class.k-message-group-receiver]="!isOwnMessage(group.messages[0])"
|
|
472
|
-
[class.k-no-avatar]="!showGroupAvatar(group)"
|
|
473
|
-
[class.k-message-group-full-width]="calculateMessageWidthMode(group.messages[0])"
|
|
474
|
-
>
|
|
475
|
-
@if (!userStatusTemplate?.templateRef && showGroupAvatar(group)) {
|
|
476
|
-
<div
|
|
477
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
478
|
-
>
|
|
479
|
-
<span class="k-avatar-image">
|
|
480
|
-
<img
|
|
481
|
-
[attr.src]="group.author.avatarUrl"
|
|
482
|
-
[alt]="group.author.avatarAltText"
|
|
483
|
-
/>
|
|
484
|
-
</span>
|
|
485
|
-
</div>
|
|
486
|
-
}
|
|
487
|
-
@if (showGroupAvatar(group) && userStatusTemplate?.templateRef) {
|
|
488
|
-
<div class="k-chat-user-status-wrapper">
|
|
489
|
-
<div
|
|
490
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
491
|
-
>
|
|
492
|
-
<span class="k-avatar-image">
|
|
493
|
-
<img
|
|
494
|
-
[attr.src]="group.author.avatarUrl"
|
|
495
|
-
[alt]="group.author.avatarAltText"
|
|
496
|
-
/>
|
|
497
|
-
</span>
|
|
498
|
-
</div>
|
|
499
|
-
@if (userStatusTemplate?.templateRef) {
|
|
500
|
-
<div class="k-chat-user-status">
|
|
501
|
-
<ng-template
|
|
502
|
-
[ngTemplateOutlet]="userStatusTemplate.templateRef"
|
|
503
|
-
[ngTemplateOutletContext]="{ $implicit: group.messages.at(-1) }"
|
|
504
|
-
>
|
|
505
|
-
</ng-template>
|
|
506
|
-
</div>
|
|
507
|
-
}
|
|
508
|
-
</div>
|
|
509
|
-
}
|
|
510
|
-
<div class="k-message-group-content">
|
|
511
|
-
@if (showGroupAuthor(group)) {
|
|
512
|
-
<p class="k-message-author">{{ group.author.name }}</p>
|
|
513
|
-
}
|
|
514
|
-
@for (msg of group.messages; track msg; let firstMessage = $first; let lastMessage = $last) {
|
|
515
|
-
@if (msg.user?.avatarUrl) {
|
|
516
|
-
<div
|
|
517
|
-
class="k-avatar k-avatar-md k-avatar-solid k-avatar-solid-primary k-rounded-full"
|
|
518
|
-
>
|
|
519
|
-
<span class="k-avatar-image">
|
|
520
|
-
<img [src]="msg.user?.avatarUrl">
|
|
521
|
-
</span>
|
|
522
|
-
</div>
|
|
523
|
-
}
|
|
524
|
-
<kendo-chat-message #message
|
|
525
|
-
[message]="msg"
|
|
526
|
-
[tabbable]="lastGroup && lastMessage"
|
|
527
|
-
[authorMessageContentTemplate]="authorMessageContentTemplate"
|
|
528
|
-
[receiverMessageContentTemplate]="receiverMessageContentTemplate"
|
|
529
|
-
[messageContentTemplate]="messageContentTemplate"
|
|
530
|
-
[authorMessageTemplate]="authorMessageTemplate"
|
|
531
|
-
[receiverMessageTemplate]="receiverMessageTemplate"
|
|
532
|
-
[messageTemplate]="messageTemplate"
|
|
533
|
-
[statusTemplate]="statusTemplate"
|
|
534
|
-
[authorId]="authorId"
|
|
535
|
-
>
|
|
536
|
-
</kendo-chat-message>
|
|
537
|
-
@if (msg.attachments && msg.attachments.length === 1) {
|
|
538
|
-
<kendo-chat-attachment
|
|
539
|
-
[attachment]="msg.attachments[0]"
|
|
540
|
-
[template]="attachmentTemplate"
|
|
541
|
-
>
|
|
542
|
-
</kendo-chat-attachment>
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
</div>
|
|
546
|
-
</div>
|
|
547
|
-
}
|
|
548
|
-
@case ('attachment-group') {
|
|
549
|
-
<kendo-chat-message-attachments #attachments
|
|
550
|
-
[attachments]="group.attachments"
|
|
551
|
-
[layout]="group.attachmentLayout"
|
|
552
|
-
[localization]="localization"
|
|
553
|
-
[tabbable]="lastGroup"
|
|
554
|
-
[template]="attachmentTemplate"
|
|
555
|
-
(click)="select(attachments)"
|
|
556
|
-
(focus)="select(attachments)"
|
|
557
|
-
>
|
|
558
|
-
</kendo-chat-message-attachments>
|
|
559
|
-
}
|
|
560
|
-
@case ('action-group') {
|
|
561
|
-
<kendo-chat-suggested-actions #actions
|
|
562
|
-
[actions]="group.actions"
|
|
563
|
-
type="action"
|
|
564
|
-
[tabbable]="lastGroup"
|
|
565
|
-
(dispatchAction)="dispatchAction($event, last(view))"
|
|
566
|
-
(click)="select(actions, $event)"
|
|
567
|
-
(focus)="select(actions, $event)"
|
|
568
|
-
>
|
|
569
|
-
</kendo-chat-suggested-actions>
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
<kendo-resize-sensor (resize)="onResize()">
|
|
574
|
-
</kendo-resize-sensor>
|
|
575
|
-
`,
|
|
576
|
-
standalone: true,
|
|
577
|
-
imports: [NgTemplateOutlet, MessageComponent, AttachmentComponent, MessageAttachmentsComponent, SuggestedActionsComponent, ResizeSensorComponent]
|
|
578
|
-
}]
|
|
579
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.IntlService }, { type: i0.Renderer2 }, { type: i2.ChatService }, { type: i0.ChangeDetectorRef }], propDecorators: { messages: [{
|
|
580
|
-
type: Input
|
|
581
|
-
}], attachmentTemplate: [{
|
|
582
|
-
type: Input
|
|
583
|
-
}], authorMessageContentTemplate: [{
|
|
584
|
-
type: Input
|
|
585
|
-
}], receiverMessageContentTemplate: [{
|
|
586
|
-
type: Input
|
|
587
|
-
}], messageContentTemplate: [{
|
|
588
|
-
type: Input
|
|
589
|
-
}], authorMessageTemplate: [{
|
|
590
|
-
type: Input
|
|
591
|
-
}], receiverMessageTemplate: [{
|
|
592
|
-
type: Input
|
|
593
|
-
}], messageTemplate: [{
|
|
594
|
-
type: Input
|
|
595
|
-
}], timestampTemplate: [{
|
|
596
|
-
type: Input
|
|
597
|
-
}], statusTemplate: [{
|
|
598
|
-
type: Input
|
|
599
|
-
}], userStatusTemplate: [{
|
|
600
|
-
type: Input
|
|
601
|
-
}], localization: [{
|
|
602
|
-
type: Input
|
|
603
|
-
}], authorId: [{
|
|
604
|
-
type: Input
|
|
605
|
-
}], executeAction: [{
|
|
606
|
-
type: Output
|
|
607
|
-
}], navigate: [{
|
|
608
|
-
type: Output
|
|
609
|
-
}], resize: [{
|
|
610
|
-
type: Output
|
|
611
|
-
}], items: [{
|
|
612
|
-
type: ViewChildren,
|
|
613
|
-
args: [ChatItem]
|
|
614
|
-
}], cssClass: [{
|
|
615
|
-
type: HostBinding,
|
|
616
|
-
args: ['class.k-message-list-content']
|
|
617
|
-
}] } });
|