@progress/kendo-angular-conversational-ui 11.2.0 → 11.3.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/chat/l10n/messages.d.ts +10 -1
- package/chat/message-list.component.d.ts +9 -3
- package/chat/suggested-actions.component.d.ts +1 -2
- package/esm2020/chat/chat.component.mjs +44 -28
- package/esm2020/chat/l10n/messages.mjs +5 -1
- package/esm2020/chat/message-attachments.component.mjs +5 -4
- package/esm2020/chat/message-box.component.mjs +12 -8
- package/esm2020/chat/message-list.component.mjs +50 -13
- package/esm2020/chat/suggested-actions.component.mjs +14 -22
- package/esm2020/package-metadata.mjs +2 -2
- package/fesm2015/progress-kendo-angular-conversational-ui.mjs +212 -166
- package/fesm2020/progress-kendo-angular-conversational-ui.mjs +209 -163
- package/package.json +7 -7
- package/common/keys.enum.d.ts +0 -14
- package/esm2020/common/keys.enum.mjs +0 -5
package/chat/l10n/messages.d.ts
CHANGED
|
@@ -16,6 +16,15 @@ export declare class Messages extends ComponentMessages {
|
|
|
16
16
|
* Sets the text for the **Send** button.
|
|
17
17
|
*/
|
|
18
18
|
send: string;
|
|
19
|
+
/**
|
|
20
|
+
* The label for the Message list.
|
|
21
|
+
*/
|
|
22
|
+
messageListLabel: string;
|
|
23
|
+
/**
|
|
24
|
+
* The label for the Message input box.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
messageBoxInputLabel: string;
|
|
19
28
|
static ɵfac: i0.ɵɵFactoryDeclaration<Messages, never>;
|
|
20
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<Messages, "kendoConversationalUIMessages", never, { "messagePlaceholder": "messagePlaceholder"; "send": "send"; }, {}, never>;
|
|
29
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<Messages, "kendoConversationalUIMessages", never, { "messagePlaceholder": "messagePlaceholder"; "send": "send"; "messageListLabel": "messageListLabel"; "messageBoxInputLabel": "messageBoxInputLabel"; }, {}, never>;
|
|
21
30
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { AfterViewInit, ElementRef, EventEmitter, QueryList } from '@angular/core';
|
|
5
|
+
import { AfterViewInit, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList, Renderer2 } from '@angular/core';
|
|
6
6
|
import { Action, ExecuteActionEvent, Message, User } from '../api';
|
|
7
7
|
import { ChatItem } from './chat-item';
|
|
8
8
|
import { ViewItem } from './chat-view';
|
|
@@ -13,9 +13,10 @@ import * as i0 from "@angular/core";
|
|
|
13
13
|
/**
|
|
14
14
|
* @hidden
|
|
15
15
|
*/
|
|
16
|
-
export declare class MessageListComponent implements AfterViewInit {
|
|
16
|
+
export declare class MessageListComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
17
17
|
private element;
|
|
18
18
|
private intl;
|
|
19
|
+
private renderer;
|
|
19
20
|
set messages(value: Message[]);
|
|
20
21
|
get messages(): Message[];
|
|
21
22
|
attachmentTemplate: AttachmentTemplateDirective;
|
|
@@ -28,10 +29,13 @@ export declare class MessageListComponent implements AfterViewInit {
|
|
|
28
29
|
cssClass: boolean;
|
|
29
30
|
view: ViewItem[] | any[];
|
|
30
31
|
private _messages;
|
|
32
|
+
private subs;
|
|
31
33
|
private selectedItem;
|
|
32
34
|
private keyActions;
|
|
33
|
-
constructor(element: ElementRef, intl: IntlService);
|
|
35
|
+
constructor(element: ElementRef, intl: IntlService, renderer: Renderer2);
|
|
36
|
+
ngOnInit(): void;
|
|
34
37
|
ngAfterViewInit(): void;
|
|
38
|
+
ngOnDestroy(): void;
|
|
35
39
|
onResize(): void;
|
|
36
40
|
formatTimeStamp(date: any): string;
|
|
37
41
|
onKeydown(e: any): void;
|
|
@@ -41,6 +45,8 @@ export declare class MessageListComponent implements AfterViewInit {
|
|
|
41
45
|
trackGroup(_index: number, item: ViewItem): any;
|
|
42
46
|
select(item: ChatItem): void;
|
|
43
47
|
last(items: any): any;
|
|
48
|
+
private onHomeOrEndKeyDown;
|
|
49
|
+
private onTabKeyDown;
|
|
44
50
|
private navigateTo;
|
|
45
51
|
static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
|
|
46
52
|
static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "kendo-chat-message-list", never, { "messages": "messages"; "attachmentTemplate": "attachmentTemplate"; "messageTemplate": "messageTemplate"; "user": "user"; }, { "executeAction": "executeAction"; "navigate": "navigate"; "resize": "resize"; }, never, never>;
|
|
@@ -22,8 +22,7 @@ export declare class SuggestedActionsComponent extends ChatItem {
|
|
|
22
22
|
actionClick(action: Action): void;
|
|
23
23
|
actionKeydown(e: any, action: Action): void;
|
|
24
24
|
focus(): void;
|
|
25
|
-
private
|
|
26
|
-
private navigateTo;
|
|
25
|
+
private changeSelectedIndex;
|
|
27
26
|
static ɵfac: i0.ɵɵFactoryDeclaration<SuggestedActionsComponent, never>;
|
|
28
27
|
static ɵcmp: i0.ɵɵComponentDeclaration<SuggestedActionsComponent, "kendo-chat-suggested-actions", never, { "actions": "actions"; "tabbable": "tabbable"; }, { "dispatch": "dispatch"; }, never, never>;
|
|
29
28
|
}
|
|
@@ -127,27 +127,35 @@ ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version:
|
|
|
127
127
|
|
|
128
128
|
i18n-send="kendo.chat.send|The text for the Send button"
|
|
129
129
|
send="Send..."
|
|
130
|
+
|
|
131
|
+
i18n-messageListLabel="kendo.chat.messageListLabel|The label text for the Message list"
|
|
132
|
+
messageListLabel="Message list"
|
|
133
|
+
|
|
134
|
+
i18n-messageBoxInputLabel="kendo.chat.messageBoxInputLabel|The label text for the Message input box"
|
|
135
|
+
messageBoxInputLabel="Message"
|
|
130
136
|
>
|
|
131
137
|
</ng-container>
|
|
132
138
|
|
|
133
139
|
<div
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
140
|
+
#messageList
|
|
141
|
+
class="k-message-list k-avatars"
|
|
142
|
+
aria-live="polite"
|
|
143
|
+
role="log"
|
|
144
|
+
kendoChatScrollAnchor
|
|
145
|
+
[attr.aria-label]="textFor('messageListLabel')"
|
|
138
146
|
#anchor="scrollAnchor"
|
|
139
147
|
[(autoScroll)]="autoScroll"
|
|
140
148
|
>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
<kendo-chat-message-list
|
|
150
|
+
[messages]="messages"
|
|
151
|
+
[messageTemplate]="messageTemplate"
|
|
152
|
+
[attachmentTemplate]="attachmentTemplate"
|
|
153
|
+
[user]="user"
|
|
154
|
+
(executeAction)="dispatchAction($event)"
|
|
155
|
+
(resize)="anchor.scrollToBottom()"
|
|
156
|
+
(navigate)="this.autoScroll = false"
|
|
157
|
+
>
|
|
158
|
+
</kendo-chat-message-list>
|
|
151
159
|
</div>
|
|
152
160
|
<kendo-message-box
|
|
153
161
|
#messageBox
|
|
@@ -179,27 +187,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
179
187
|
|
|
180
188
|
i18n-send="kendo.chat.send|The text for the Send button"
|
|
181
189
|
send="Send..."
|
|
190
|
+
|
|
191
|
+
i18n-messageListLabel="kendo.chat.messageListLabel|The label text for the Message list"
|
|
192
|
+
messageListLabel="Message list"
|
|
193
|
+
|
|
194
|
+
i18n-messageBoxInputLabel="kendo.chat.messageBoxInputLabel|The label text for the Message input box"
|
|
195
|
+
messageBoxInputLabel="Message"
|
|
182
196
|
>
|
|
183
197
|
</ng-container>
|
|
184
198
|
|
|
185
199
|
<div
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
200
|
+
#messageList
|
|
201
|
+
class="k-message-list k-avatars"
|
|
202
|
+
aria-live="polite"
|
|
203
|
+
role="log"
|
|
204
|
+
kendoChatScrollAnchor
|
|
205
|
+
[attr.aria-label]="textFor('messageListLabel')"
|
|
190
206
|
#anchor="scrollAnchor"
|
|
191
207
|
[(autoScroll)]="autoScroll"
|
|
192
208
|
>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
209
|
+
<kendo-chat-message-list
|
|
210
|
+
[messages]="messages"
|
|
211
|
+
[messageTemplate]="messageTemplate"
|
|
212
|
+
[attachmentTemplate]="attachmentTemplate"
|
|
213
|
+
[user]="user"
|
|
214
|
+
(executeAction)="dispatchAction($event)"
|
|
215
|
+
(resize)="anchor.scrollToBottom()"
|
|
216
|
+
(navigate)="this.autoScroll = false"
|
|
217
|
+
>
|
|
218
|
+
</kendo-chat-message-list>
|
|
203
219
|
</div>
|
|
204
220
|
<kendo-message-box
|
|
205
221
|
#messageBox
|
|
@@ -11,7 +11,7 @@ import * as i0 from "@angular/core";
|
|
|
11
11
|
export class Messages extends ComponentMessages {
|
|
12
12
|
}
|
|
13
13
|
Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
14
|
-
Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, selector: "kendoConversationalUIMessages", inputs: { messagePlaceholder: "messagePlaceholder", send: "send" }, usesInheritance: true, ngImport: i0 });
|
|
14
|
+
Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: Messages, selector: "kendoConversationalUIMessages", inputs: { messagePlaceholder: "messagePlaceholder", send: "send", messageListLabel: "messageListLabel", messageBoxInputLabel: "messageBoxInputLabel" }, usesInheritance: true, ngImport: i0 });
|
|
15
15
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: Messages, decorators: [{
|
|
16
16
|
type: Directive,
|
|
17
17
|
args: [{
|
|
@@ -22,4 +22,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
22
22
|
type: Input
|
|
23
23
|
}], send: [{
|
|
24
24
|
type: Input
|
|
25
|
+
}], messageListLabel: [{
|
|
26
|
+
type: Input
|
|
27
|
+
}], messageBoxInputLabel: [{
|
|
28
|
+
type: Input
|
|
25
29
|
}] } });
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { Component, ElementRef, forwardRef, HostBinding, Input, NgZone, QueryList, ViewChild, ViewChildren } from '@angular/core';
|
|
6
6
|
import { fromEvent } from 'rxjs';
|
|
7
7
|
import { debounceTime } from 'rxjs/operators';
|
|
8
|
+
import { Keys } from '@progress/kendo-angular-common';
|
|
8
9
|
import { ChatItem } from './chat-item';
|
|
9
10
|
import { AttachmentTemplateDirective } from './attachment-template.directive';
|
|
10
11
|
import { chevronLeftIcon, chevronRightIcon } from '@progress/kendo-svg-icons';
|
|
@@ -31,12 +32,12 @@ export class MessageAttachmentsComponent extends ChatItem {
|
|
|
31
32
|
this.scrollPosition = 0;
|
|
32
33
|
this.selectedIndex = 0;
|
|
33
34
|
this.carouselKeyHandlers = {
|
|
34
|
-
[
|
|
35
|
-
[
|
|
35
|
+
[Keys.ArrowLeft]: (e) => this.navigateTo(e, -1),
|
|
36
|
+
[Keys.ArrowRight]: (e) => this.navigateTo(e, 1)
|
|
36
37
|
};
|
|
37
38
|
this.listKeyHandlers = {
|
|
38
|
-
[
|
|
39
|
-
[
|
|
39
|
+
[Keys.ArrowUp]: (e) => this.navigateTo(e, -1),
|
|
40
|
+
[Keys.ArrowDown]: (e) => this.navigateTo(e, 1)
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
get carousel() {
|
|
@@ -77,7 +77,7 @@ export class MessageBoxComponent {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
MessageBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
80
|
-
MessageBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: MessageBoxComponent, selector: "kendo-message-box", inputs: { user: "user", autoScroll: "autoScroll", type: "type", localization: "localization", messageBoxTemplate: "messageBoxTemplate" }, outputs: { sendMessage: "sendMessage" }, host: { properties: { "class": "this.hostClasses", "class.!k-align-items-end": "this.messageBoxValue" } }, viewQueries: [{ propertyName: "messageBoxInput", first: true, predicate: ["messageBoxInput"], descendants: true }], ngImport: i0, template: "\n <ng-container *ngIf=\"!messageBoxTemplate\">\n <input\n *ngIf=\"type === 'textbox'\"\n #messageBoxInput\n kendoChatFocusedState\n type=\"text\"\n class=\"k-textbox k-input k-input-md k-input-solid\"\n [placeholder]=\"textFor('messagePlaceholder')\"\n (keydown)=\"inputKeydown($event)\"\n />\n\n <textarea\n
|
|
80
|
+
MessageBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: MessageBoxComponent, selector: "kendo-message-box", inputs: { user: "user", autoScroll: "autoScroll", type: "type", localization: "localization", messageBoxTemplate: "messageBoxTemplate" }, outputs: { sendMessage: "sendMessage" }, host: { properties: { "class": "this.hostClasses", "class.!k-align-items-end": "this.messageBoxValue" } }, viewQueries: [{ propertyName: "messageBoxInput", first: true, predicate: ["messageBoxInput"], descendants: true }], ngImport: i0, template: "\n <ng-container *ngIf=\"!messageBoxTemplate\">\n <input\n *ngIf=\"type === 'textbox'\"\n #messageBoxInput\n [attr.role]=\"'textbox'\"\n kendoChatFocusedState\n type=\"text\"\n class=\"k-textbox k-input k-input-md k-input-solid\"\n [attr.aria-label]=\"textFor('messageBoxInputLabel')\"\n [placeholder]=\"textFor('messagePlaceholder')\"\n (keydown)=\"inputKeydown($event)\"\n />\n\n <textarea\n *ngIf=\"type === 'textarea'\"\n #messageBoxInput\n [attr.role]=\"'textbox'\"\n kendoChatFocusedState\n [rows]=\"3\"\n class=\"k-textarea k-input k-input-md k-input-solid !k-overflow-y-auto k-resize-none\"\n [attr.aria-label]=\"textFor('messageBoxInputLabel')\"\n [placeholder]=\"textFor('messagePlaceholder')\"\n (keydown)=\"textAreaKeydown($event)\"\n ></textarea>\n\n <button\n kendoButton\n fillMode=\"flat\"\n class=\"k-button-send\"\n [tabindex]=\"0\"\n [attr.title]=\"textFor('send')\"\n (click)=\"sendClick()\"\n >\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0px\" y=\"0px\" viewBox=\"0 0 16 16\"><path d=\"M0,14.3c-0.1,0.6,0.3,0.8,0.8,0.6l14.8-6.5c0.5-0.2,0.5-0.6,0-0.8L0.8,1.1C0.3,0.9-0.1,1.1,0,1.7l0.7,4.2C0.8,6.5,1.4,7,1.9,7.1l8.8,0.8c0.6,0.1,0.6,0.1,0,0.2L1.9,8.9C1.4,9,0.8,9.5,0.7,10.1L0,14.3z\"/></svg>\n </button>\n </ng-container>\n\n <ng-template *ngIf=\"messageBoxTemplate\" [ngTemplateOutlet]=\"messageBoxTemplate?.templateRef\"></ng-template>\n", isInline: true, components: [{ type: i1.Button, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.FocusedStateDirective, selector: "[kendoChatFocusedState]" }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
81
81
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageBoxComponent, decorators: [{
|
|
82
82
|
type: Component,
|
|
83
83
|
args: [{
|
|
@@ -87,21 +87,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
87
87
|
<input
|
|
88
88
|
*ngIf="type === 'textbox'"
|
|
89
89
|
#messageBoxInput
|
|
90
|
+
[attr.role]="'textbox'"
|
|
90
91
|
kendoChatFocusedState
|
|
91
92
|
type="text"
|
|
92
93
|
class="k-textbox k-input k-input-md k-input-solid"
|
|
94
|
+
[attr.aria-label]="textFor('messageBoxInputLabel')"
|
|
93
95
|
[placeholder]="textFor('messagePlaceholder')"
|
|
94
96
|
(keydown)="inputKeydown($event)"
|
|
95
97
|
/>
|
|
96
98
|
|
|
97
99
|
<textarea
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
*ngIf="type === 'textarea'"
|
|
101
|
+
#messageBoxInput
|
|
102
|
+
[attr.role]="'textbox'"
|
|
103
|
+
kendoChatFocusedState
|
|
104
|
+
[rows]="3"
|
|
105
|
+
class="k-textarea k-input k-input-md k-input-solid !k-overflow-y-auto k-resize-none"
|
|
106
|
+
[attr.aria-label]="textFor('messageBoxInputLabel')"
|
|
107
|
+
[placeholder]="textFor('messagePlaceholder')"
|
|
108
|
+
(keydown)="textAreaKeydown($event)"
|
|
105
109
|
></textarea>
|
|
106
110
|
|
|
107
111
|
<button
|
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
+
import { Component, ElementRef, EventEmitter, HostBinding, Input, Output, QueryList, Renderer2, ViewChildren } from '@angular/core';
|
|
6
8
|
import { ExecuteActionEvent } from '../api';
|
|
9
|
+
import { Keys } from '@progress/kendo-angular-common';
|
|
7
10
|
import { closest } from '../common/utils';
|
|
8
11
|
import { ChatItem } from './chat-item';
|
|
9
12
|
import { chatView, isAuthor } from './chat-view';
|
|
10
13
|
import { AttachmentTemplateDirective } from './attachment-template.directive';
|
|
11
14
|
import { MessageTemplateDirective } from './message-template.directive';
|
|
12
15
|
import { IntlService } from '@progress/kendo-angular-intl';
|
|
16
|
+
import { Subscription } from 'rxjs';
|
|
17
|
+
import { SuggestedActionsComponent } from './suggested-actions.component';
|
|
18
|
+
import { MessageComponent } from './message.component';
|
|
13
19
|
import * as i0 from "@angular/core";
|
|
14
20
|
import * as i1 from "@progress/kendo-angular-intl";
|
|
15
21
|
import * as i2 from "./message.component";
|
|
@@ -22,17 +28,22 @@ import * as i7 from "@angular/common";
|
|
|
22
28
|
* @hidden
|
|
23
29
|
*/
|
|
24
30
|
export class MessageListComponent {
|
|
25
|
-
constructor(element, intl) {
|
|
31
|
+
constructor(element, intl, renderer) {
|
|
26
32
|
this.element = element;
|
|
27
33
|
this.intl = intl;
|
|
34
|
+
this.renderer = renderer;
|
|
28
35
|
this.executeAction = new EventEmitter();
|
|
29
36
|
this.navigate = new EventEmitter();
|
|
30
37
|
this.resize = new EventEmitter();
|
|
31
38
|
this.cssClass = true;
|
|
32
39
|
this.view = [];
|
|
40
|
+
this.subs = new Subscription();
|
|
33
41
|
this.keyActions = {
|
|
34
|
-
[
|
|
35
|
-
[
|
|
42
|
+
[Keys.Home]: (_) => this.onHomeOrEndKeyDown('home'),
|
|
43
|
+
[Keys.End]: (_) => this.onHomeOrEndKeyDown('end'),
|
|
44
|
+
[Keys.ArrowUp]: (e) => this.navigateTo(e, -1),
|
|
45
|
+
[Keys.ArrowDown]: (e) => this.navigateTo(e, 1),
|
|
46
|
+
[Keys.Tab]: (e) => this.onTabKeyDown(e),
|
|
36
47
|
};
|
|
37
48
|
}
|
|
38
49
|
set messages(value) {
|
|
@@ -43,9 +54,17 @@ export class MessageListComponent {
|
|
|
43
54
|
get messages() {
|
|
44
55
|
return this._messages;
|
|
45
56
|
}
|
|
57
|
+
ngOnInit() {
|
|
58
|
+
const elRef = this.element.nativeElement;
|
|
59
|
+
this.subs.add(this.renderer.listen(elRef, 'keydown', event => this.onKeydown(event)));
|
|
60
|
+
this.subs.add(this.renderer.listen(elRef, 'focusout', event => this.onBlur(event)));
|
|
61
|
+
}
|
|
46
62
|
ngAfterViewInit() {
|
|
47
63
|
this.selectedItem = this.items.last;
|
|
48
64
|
}
|
|
65
|
+
ngOnDestroy() {
|
|
66
|
+
this.subs.unsubscribe();
|
|
67
|
+
}
|
|
49
68
|
onResize() {
|
|
50
69
|
this.resize.emit();
|
|
51
70
|
}
|
|
@@ -91,13 +110,37 @@ export class MessageListComponent {
|
|
|
91
110
|
}
|
|
92
111
|
return items[items.length - 1];
|
|
93
112
|
}
|
|
113
|
+
onHomeOrEndKeyDown(key) {
|
|
114
|
+
const items = this.items.toArray();
|
|
115
|
+
if (key === 'home') {
|
|
116
|
+
items[0].focus();
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
items[items.length - 1].focus();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
onTabKeyDown(event) {
|
|
123
|
+
const item = this.items.toArray()[this.items.length - 1];
|
|
124
|
+
const isLastItemQuickReply = item instanceof SuggestedActionsComponent;
|
|
125
|
+
const isLastItemMessage = item instanceof MessageComponent;
|
|
126
|
+
event.target.blur();
|
|
127
|
+
if (isLastItemQuickReply || isLastItemMessage) {
|
|
128
|
+
this.select(item);
|
|
129
|
+
item.focus();
|
|
130
|
+
this.navigate.emit();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
94
133
|
navigateTo(e, offset) {
|
|
95
134
|
const items = this.items.toArray();
|
|
96
135
|
const prevItem = this.selectedItem;
|
|
97
136
|
const prevIndex = items.indexOf(prevItem);
|
|
98
137
|
const nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
|
|
99
138
|
const nextItem = items[nextIndex];
|
|
139
|
+
const isNextItemQuickReply = nextItem instanceof SuggestedActionsComponent;
|
|
100
140
|
if (nextItem !== prevItem) {
|
|
141
|
+
if (isNextItemQuickReply) {
|
|
142
|
+
nextItem.items.toArray()[0].nativeElement.focus();
|
|
143
|
+
}
|
|
101
144
|
this.select(nextItem);
|
|
102
145
|
nextItem.focus();
|
|
103
146
|
this.navigate.emit();
|
|
@@ -105,8 +148,8 @@ export class MessageListComponent {
|
|
|
105
148
|
}
|
|
106
149
|
}
|
|
107
150
|
}
|
|
108
|
-
MessageListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageListComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }], target: i0.ɵɵFactoryTarget.Component });
|
|
109
|
-
MessageListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: MessageListComponent, selector: "kendo-chat-message-list", inputs: { messages: "messages", attachmentTemplate: "attachmentTemplate", messageTemplate: "messageTemplate", user: "user" }, outputs: { executeAction: "executeAction", navigate: "navigate", resize: "resize" }, host: {
|
|
151
|
+
MessageListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageListComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
152
|
+
MessageListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: MessageListComponent, selector: "kendo-chat-message-list", inputs: { messages: "messages", attachmentTemplate: "attachmentTemplate", messageTemplate: "messageTemplate", 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: `
|
|
110
153
|
<ng-container *ngFor="let group of view; last as lastGroup; trackBy: trackGroup">
|
|
111
154
|
<ng-container [ngSwitch]="group.type">
|
|
112
155
|
<div
|
|
@@ -253,7 +296,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
253
296
|
</kendo-resize-sensor>
|
|
254
297
|
`
|
|
255
298
|
}]
|
|
256
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }]; }, propDecorators: { messages: [{
|
|
299
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }, { type: i0.Renderer2 }]; }, propDecorators: { messages: [{
|
|
257
300
|
type: Input
|
|
258
301
|
}], attachmentTemplate: [{
|
|
259
302
|
type: Input
|
|
@@ -273,10 +316,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
273
316
|
}], cssClass: [{
|
|
274
317
|
type: HostBinding,
|
|
275
318
|
args: ['class.k-message-list-content']
|
|
276
|
-
}], onKeydown: [{
|
|
277
|
-
type: HostListener,
|
|
278
|
-
args: ['keydown', ['$event']]
|
|
279
|
-
}], onBlur: [{
|
|
280
|
-
type: HostListener,
|
|
281
|
-
args: ['focusout', ['$event']]
|
|
282
319
|
}] } });
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
5
7
|
import { Component, EventEmitter, forwardRef, HostBinding, Input, Output, QueryList, ViewChildren } from '@angular/core';
|
|
8
|
+
import { Keys } from '@progress/kendo-angular-common';
|
|
6
9
|
import { ChatItem } from './chat-item';
|
|
7
10
|
import * as i0 from "@angular/core";
|
|
8
11
|
import * as i1 from "@angular/common";
|
|
9
|
-
// eslint-disable no-forward-ref
|
|
10
12
|
/**
|
|
11
13
|
* @hidden
|
|
12
14
|
*/
|
|
@@ -17,9 +19,9 @@ export class SuggestedActionsComponent extends ChatItem {
|
|
|
17
19
|
this.defaultClass = true;
|
|
18
20
|
this.selectedIndex = 0;
|
|
19
21
|
this.keyHandlers = {
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
22
|
+
[Keys.Tab]: (e) => this.changeSelectedIndex(e),
|
|
23
|
+
[Keys.Enter]: (_, action) => this.actionClick(action),
|
|
24
|
+
[Keys.Space]: (_, action) => this.actionClick(action),
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
isSelected(index) {
|
|
@@ -34,23 +36,11 @@ export class SuggestedActionsComponent extends ChatItem {
|
|
|
34
36
|
handler(e, action);
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
|
-
focus() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
select(index) {
|
|
41
|
-
this.selectedIndex = index;
|
|
42
|
-
const item = this.items.toArray()[index];
|
|
43
|
-
if (item) {
|
|
44
|
-
item.nativeElement.focus();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
navigateTo(e, offset) {
|
|
39
|
+
focus() { }
|
|
40
|
+
changeSelectedIndex(e) {
|
|
41
|
+
const offset = e.shiftKey ? -1 : 1;
|
|
48
42
|
const prevIndex = this.selectedIndex;
|
|
49
|
-
|
|
50
|
-
if (nextIndex !== prevIndex) {
|
|
51
|
-
this.select(nextIndex);
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
}
|
|
43
|
+
this.selectedIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
|
|
54
44
|
}
|
|
55
45
|
}
|
|
56
46
|
SuggestedActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SuggestedActionsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -62,11 +52,12 @@ SuggestedActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
62
52
|
#item
|
|
63
53
|
*ngFor="let action of actions; index as index; first as first; last as last"
|
|
64
54
|
class="k-quick-reply"
|
|
55
|
+
role="button"
|
|
65
56
|
[class.k-selected]="isSelected(index)"
|
|
66
57
|
[class.k-focus]="isSelected(index)"
|
|
67
58
|
[class.k-first]="first"
|
|
68
59
|
[class.k-last]="last"
|
|
69
|
-
[attr.tabindex]="
|
|
60
|
+
[attr.tabindex]="0"
|
|
70
61
|
(click)="actionClick(action)"
|
|
71
62
|
(keydown)="actionKeydown($event, action)"
|
|
72
63
|
>
|
|
@@ -86,11 +77,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
86
77
|
#item
|
|
87
78
|
*ngFor="let action of actions; index as index; first as first; last as last"
|
|
88
79
|
class="k-quick-reply"
|
|
80
|
+
role="button"
|
|
89
81
|
[class.k-selected]="isSelected(index)"
|
|
90
82
|
[class.k-focus]="isSelected(index)"
|
|
91
83
|
[class.k-first]="first"
|
|
92
84
|
[class.k-last]="last"
|
|
93
|
-
[attr.tabindex]="
|
|
85
|
+
[attr.tabindex]="0"
|
|
94
86
|
(click)="actionClick(action)"
|
|
95
87
|
(keydown)="actionKeydown($event, action)"
|
|
96
88
|
>
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-conversational-ui',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
13
|
-
version: '11.
|
|
12
|
+
publishDate: 1676463622,
|
|
13
|
+
version: '11.3.0-develop.1',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
15
15
|
};
|