@progress/kendo-angular-conversational-ui 4.1.0-dev.202204051239 → 5.0.0-dev.202204191039

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.
Files changed (163) hide show
  1. package/{dist/es2015/api → api}/action.interface.d.ts +0 -0
  2. package/{dist/es2015/api → api}/attachment.interface.d.ts +0 -0
  3. package/{dist/es2015/api → api}/execute-action-event.d.ts +1 -1
  4. package/{dist/es/api/user.interface.js → api/index.d.ts} +6 -0
  5. package/{dist/es2015/api → api}/message.interface.d.ts +0 -0
  6. package/{dist/es2015/api → api}/post-message-event.d.ts +0 -0
  7. package/{dist/es2015/api → api}/preventable-event.d.ts +0 -0
  8. package/{dist/es2015/api → api}/user.interface.d.ts +0 -0
  9. package/bundles/kendo-angular-conversational-ui.umd.js +5 -0
  10. package/{dist/es2015/cards → cards}/hero-card.component.d.ts +3 -0
  11. package/{dist/es2015/chat → chat}/attachment-template.directive.d.ts +3 -0
  12. package/{dist/es2015/chat → chat}/attachment.component.d.ts +9 -5
  13. package/{dist/es2015/chat → chat}/builtin-actions.d.ts +0 -0
  14. package/{dist/es2015/chat → chat}/chat-item.d.ts +0 -0
  15. package/{dist/es2015/chat → chat}/chat-view.d.ts +1 -1
  16. package/{dist/es2015/chat → chat}/chat.component.d.ts +7 -7
  17. package/{dist/es2015/chat → chat}/chat.directives.d.ts +0 -0
  18. package/chat/chat.module.d.ts +49 -0
  19. package/{dist/es2015/chat → chat}/l10n/custom-messages.component.d.ts +4 -1
  20. package/{dist/es2015/chat → chat}/l10n/localized-messages.directive.d.ts +3 -0
  21. package/{dist/es2015/chat → chat}/l10n/messages.d.ts +3 -0
  22. package/{dist/es2015/chat → chat}/message-attachments.component.d.ts +5 -2
  23. package/{dist/es2015/chat → chat}/message-box.component.d.ts +4 -1
  24. package/{dist/es2015/chat → chat}/message-box.directive.d.ts +3 -0
  25. package/{dist/es2015/chat → chat}/message-list.component.d.ts +9 -8
  26. package/{dist/es2015/chat → chat}/message-template.directive.d.ts +3 -0
  27. package/{dist/es2015/chat → chat}/message.component.d.ts +4 -1
  28. package/{dist/es2015/chat → chat}/suggested-actions.component.d.ts +4 -1
  29. package/common/focused-state.directive.d.ts +15 -0
  30. package/{dist/es2015/common → common}/keys.enum.d.ts +0 -0
  31. package/{dist/es2015/common → common}/models/message-box-options.d.ts +0 -0
  32. package/{dist/es2015/common → common}/scroll-anchor.directive.d.ts +3 -0
  33. package/{dist/es2015/common → common}/utils.d.ts +0 -0
  34. package/{dist/es2015 → esm2015}/api/action.interface.js +2 -1
  35. package/{dist/es2015 → esm2015}/api/attachment.interface.js +1 -0
  36. package/{dist/es2015 → esm2015}/api/execute-action-event.js +0 -0
  37. package/{dist/es/api/attachment.interface.js → esm2015/api/index.js} +6 -0
  38. package/{dist/es → esm2015}/api/message.interface.js +1 -0
  39. package/{dist/es2015 → esm2015}/api/post-message-event.js +0 -0
  40. package/{dist/es2015 → esm2015}/api/preventable-event.js +0 -0
  41. package/{dist/es2015 → esm2015}/api/user.interface.js +1 -0
  42. package/esm2015/cards/hero-card.component.js +90 -0
  43. package/{dist/es2015 → esm2015}/chat/attachment-template.directive.js +14 -12
  44. package/esm2015/chat/attachment.component.js +83 -0
  45. package/{dist/es2015 → esm2015}/chat/builtin-actions.js +13 -16
  46. package/{dist/es2015 → esm2015}/chat/chat-item.js +0 -0
  47. package/{dist/es2015 → esm2015}/chat/chat-view.js +0 -6
  48. package/esm2015/chat/chat.component.js +246 -0
  49. package/{dist/es → esm2015}/chat/chat.directives.js +0 -0
  50. package/{dist/es2015 → esm2015}/chat/chat.module.js +43 -15
  51. package/esm2015/chat/l10n/custom-messages.component.js +42 -0
  52. package/esm2015/chat/l10n/localized-messages.directive.js +37 -0
  53. package/esm2015/chat/l10n/messages.js +25 -0
  54. package/{dist/es2015 → esm2015}/chat/message-attachments.component.js +71 -48
  55. package/esm2015/chat/message-box.component.js +141 -0
  56. package/esm2015/chat/message-box.directive.js +24 -0
  57. package/esm2015/chat/message-list.component.js +279 -0
  58. package/{dist/es2015 → esm2015}/chat/message-template.directive.js +14 -12
  59. package/esm2015/chat/message.component.js +140 -0
  60. package/esm2015/chat/suggested-actions.component.js +113 -0
  61. package/esm2015/common/focused-state.directive.js +37 -0
  62. package/{dist/es2015 → esm2015}/common/keys.enum.js +1 -0
  63. package/{dist/es → esm2015}/common/models/message-box-options.js +1 -0
  64. package/{dist/es2015 → esm2015}/common/scroll-anchor.directive.js +20 -26
  65. package/{dist/es2015 → esm2015}/common/utils.js +0 -0
  66. package/{dist/es/api/action.interface.js → esm2015/kendo-angular-conversational-ui.js} +4 -1
  67. package/esm2015/main.js +10 -0
  68. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  69. package/fesm2015/kendo-angular-conversational-ui.js +1757 -0
  70. package/{dist/es2015/common/focused-state.directive.d.ts → kendo-angular-conversational-ui.d.ts} +3 -6
  71. package/main.d.ts +11 -0
  72. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  73. package/package.json +34 -105
  74. package/schematics/ngAdd/index.js +5 -2
  75. package/schematics/ngAdd/index.js.map +1 -1
  76. package/dist/cdn/js/kendo-angular-conversational-ui.js +0 -20
  77. package/dist/cdn/main.js +0 -5
  78. package/dist/es/api/execute-action-event.js +0 -24
  79. package/dist/es/api/post-message-event.js +0 -18
  80. package/dist/es/api/preventable-event.js +0 -32
  81. package/dist/es/cards/hero-card.component.js +0 -54
  82. package/dist/es/chat/attachment-template.directive.js +0 -32
  83. package/dist/es/chat/attachment.component.js +0 -65
  84. package/dist/es/chat/builtin-actions.js +0 -28
  85. package/dist/es/chat/chat-item.js +0 -13
  86. package/dist/es/chat/chat-view.js +0 -92
  87. package/dist/es/chat/chat.component.js +0 -190
  88. package/dist/es/chat/chat.module.js +0 -80
  89. package/dist/es/chat/l10n/custom-messages.component.js +0 -45
  90. package/dist/es/chat/l10n/localized-messages.directive.js +0 -36
  91. package/dist/es/chat/l10n/messages.js +0 -26
  92. package/dist/es/chat/message-attachments.component.js +0 -148
  93. package/dist/es/chat/message-box.component.js +0 -124
  94. package/dist/es/chat/message-box.directive.js +0 -24
  95. package/dist/es/chat/message-list.component.js +0 -165
  96. package/dist/es/chat/message-template.directive.js +0 -32
  97. package/dist/es/chat/message.component.js +0 -77
  98. package/dist/es/chat/suggested-actions.component.js +0 -91
  99. package/dist/es/common/focused-state.directive.js +0 -43
  100. package/dist/es/common/keys.enum.js +0 -4
  101. package/dist/es/common/scroll-anchor.directive.js +0 -87
  102. package/dist/es/common/utils.js +0 -13
  103. package/dist/es/index.js +0 -22
  104. package/dist/es/main.js +0 -8
  105. package/dist/es/package-metadata.js +0 -15
  106. package/dist/es2015/api/message.interface.js +0 -4
  107. package/dist/es2015/cards/hero-card.component.js +0 -79
  108. package/dist/es2015/chat/attachment.component.js +0 -66
  109. package/dist/es2015/chat/chat.component.js +0 -214
  110. package/dist/es2015/chat/chat.directives.js +0 -8
  111. package/dist/es2015/chat/chat.module.d.ts +0 -27
  112. package/dist/es2015/chat/l10n/custom-messages.component.js +0 -37
  113. package/dist/es2015/chat/l10n/localized-messages.directive.js +0 -32
  114. package/dist/es2015/chat/l10n/messages.js +0 -20
  115. package/dist/es2015/chat/message-box.component.js +0 -157
  116. package/dist/es2015/chat/message-box.directive.js +0 -23
  117. package/dist/es2015/chat/message-list.component.js +0 -227
  118. package/dist/es2015/chat/message.component.js +0 -107
  119. package/dist/es2015/chat/suggested-actions.component.js +0 -105
  120. package/dist/es2015/common/focused-state.directive.js +0 -45
  121. package/dist/es2015/common/models/message-box-options.js +0 -4
  122. package/dist/es2015/index.d.ts +0 -22
  123. package/dist/es2015/index.js +0 -22
  124. package/dist/es2015/index.metadata.json +0 -1
  125. package/dist/es2015/main.d.ts +0 -13
  126. package/dist/es2015/main.js +0 -8
  127. package/dist/fesm2015/index.js +0 -1554
  128. package/dist/fesm5/index.js +0 -1383
  129. package/dist/npm/api/action.interface.js +0 -7
  130. package/dist/npm/api/attachment.interface.js +0 -6
  131. package/dist/npm/api/execute-action-event.js +0 -26
  132. package/dist/npm/api/message.interface.js +0 -6
  133. package/dist/npm/api/post-message-event.js +0 -20
  134. package/dist/npm/api/preventable-event.js +0 -34
  135. package/dist/npm/api/user.interface.js +0 -6
  136. package/dist/npm/cards/hero-card.component.js +0 -56
  137. package/dist/npm/chat/attachment-template.directive.js +0 -34
  138. package/dist/npm/chat/attachment.component.js +0 -67
  139. package/dist/npm/chat/builtin-actions.js +0 -33
  140. package/dist/npm/chat/chat-item.js +0 -15
  141. package/dist/npm/chat/chat-view.js +0 -98
  142. package/dist/npm/chat/chat.component.js +0 -192
  143. package/dist/npm/chat/chat.directives.js +0 -14
  144. package/dist/npm/chat/chat.module.js +0 -82
  145. package/dist/npm/chat/l10n/custom-messages.component.js +0 -47
  146. package/dist/npm/chat/l10n/localized-messages.directive.js +0 -38
  147. package/dist/npm/chat/l10n/messages.js +0 -28
  148. package/dist/npm/chat/message-attachments.component.js +0 -150
  149. package/dist/npm/chat/message-box.component.js +0 -126
  150. package/dist/npm/chat/message-box.directive.js +0 -26
  151. package/dist/npm/chat/message-list.component.js +0 -167
  152. package/dist/npm/chat/message-template.directive.js +0 -34
  153. package/dist/npm/chat/message.component.js +0 -79
  154. package/dist/npm/chat/suggested-actions.component.js +0 -93
  155. package/dist/npm/common/focused-state.directive.js +0 -45
  156. package/dist/npm/common/keys.enum.js +0 -6
  157. package/dist/npm/common/models/message-box-options.js +0 -6
  158. package/dist/npm/common/scroll-anchor.directive.js +0 -89
  159. package/dist/npm/common/utils.js +0 -15
  160. package/dist/npm/index.js +0 -39
  161. package/dist/npm/main.js +0 -11
  162. package/dist/npm/package-metadata.js +0 -17
  163. package/dist/systemjs/kendo-angular-conversational-ui.js +0 -5
@@ -0,0 +1,279 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Component, EventEmitter, HostBinding, HostListener, Input, Output, ViewChildren } from '@angular/core';
6
+ import { ExecuteActionEvent } from '../api';
7
+ import { closest } from '../common/utils';
8
+ import { ChatItem } from './chat-item';
9
+ import { chatView, isAuthor } from './chat-view';
10
+ import * as i0 from "@angular/core";
11
+ import * as i1 from "@progress/kendo-angular-intl";
12
+ import * as i2 from "./message.component";
13
+ import * as i3 from "./attachment.component";
14
+ import * as i4 from "./message-attachments.component";
15
+ import * as i5 from "./suggested-actions.component";
16
+ import * as i6 from "@progress/kendo-angular-common";
17
+ import * as i7 from "@angular/common";
18
+ /**
19
+ * @hidden
20
+ */
21
+ export class MessageListComponent {
22
+ constructor(element, intl) {
23
+ this.element = element;
24
+ this.intl = intl;
25
+ this.executeAction = new EventEmitter();
26
+ this.navigate = new EventEmitter();
27
+ this.resize = new EventEmitter();
28
+ this.cssClass = true;
29
+ this.view = [];
30
+ this.keyActions = {
31
+ [38 /* up */]: (e) => this.navigateTo(e, -1),
32
+ [40 /* down */]: (e) => this.navigateTo(e, 1)
33
+ };
34
+ }
35
+ set messages(value) {
36
+ const data = value || [];
37
+ this.view = chatView(data);
38
+ this._messages = data;
39
+ }
40
+ get messages() {
41
+ return this._messages;
42
+ }
43
+ ngAfterViewInit() {
44
+ this.selectedItem = this.items.last;
45
+ }
46
+ onResize() {
47
+ this.resize.emit();
48
+ }
49
+ formatTimeStamp(date) {
50
+ return this.intl.formatDate(date, { date: 'full' });
51
+ }
52
+ onKeydown(e) {
53
+ const action = this.keyActions[e.keyCode];
54
+ if (action) {
55
+ action(e);
56
+ }
57
+ }
58
+ onBlur(args) {
59
+ const next = args.relatedTarget || document.activeElement;
60
+ const outside = !closest(next, (node) => node === this.element.nativeElement);
61
+ if (outside) {
62
+ this.select(null);
63
+ }
64
+ }
65
+ isOwnMessage(msg) {
66
+ return isAuthor(this.user, msg);
67
+ }
68
+ dispatchAction(action, message) {
69
+ const args = new ExecuteActionEvent(action, message);
70
+ this.executeAction.emit(args);
71
+ }
72
+ trackGroup(_index, item) {
73
+ return item.trackBy;
74
+ }
75
+ select(item) {
76
+ const prevItem = this.selectedItem;
77
+ if (prevItem) {
78
+ prevItem.selected = false;
79
+ }
80
+ if (item) {
81
+ item.selected = true;
82
+ this.selectedItem = item;
83
+ }
84
+ }
85
+ last(items) {
86
+ if (!items || items.length === 0) {
87
+ return;
88
+ }
89
+ return items[items.length - 1];
90
+ }
91
+ navigateTo(e, offset) {
92
+ const items = this.items.toArray();
93
+ const prevItem = this.selectedItem;
94
+ const prevIndex = items.indexOf(prevItem);
95
+ const nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
96
+ const nextItem = items[nextIndex];
97
+ if (nextItem !== prevItem) {
98
+ this.select(nextItem);
99
+ nextItem.focus();
100
+ this.navigate.emit();
101
+ e.preventDefault();
102
+ }
103
+ }
104
+ }
105
+ MessageListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageListComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }], target: i0.ɵɵFactoryTarget.Component });
106
+ MessageListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MessageListComponent, selector: "kendo-chat-message-list", inputs: { messages: "messages", attachmentTemplate: "attachmentTemplate", messageTemplate: "messageTemplate", user: "user" }, outputs: { executeAction: "executeAction", navigate: "navigate", resize: "resize" }, host: { listeners: { "keydown": "onKeydown($event)", "focusout": "onBlur($event)" }, properties: { "class.k-message-list-content": "this.cssClass" } }, viewQueries: [{ propertyName: "items", predicate: ChatItem, descendants: true }], ngImport: i0, template: `
107
+ <ng-container *ngFor="let group of view; last as lastGroup; trackBy: trackGroup">
108
+ <ng-container [ngSwitch]="group.type">
109
+ <div
110
+ *ngSwitchCase="'date-marker'"
111
+ class="k-timestamp"
112
+ >
113
+ {{ formatTimeStamp(group.timestamp) }}
114
+ </div>
115
+ <div
116
+ *ngSwitchCase="'message-group'"
117
+ class="k-message-group"
118
+ [class.k-alt]="isOwnMessage(group.messages[0])"
119
+ [class.k-no-avatar]="!group.author.avatarUrl"
120
+ >
121
+ <img
122
+ *ngIf="group.author.avatarUrl"
123
+ [attr.src]="group.author.avatarUrl"
124
+ class="k-avatar"
125
+ />
126
+ <p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
127
+ <ng-container
128
+ *ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
129
+ >
130
+ <img *ngIf="msg.user?.avatarUrl" [src]="msg.user?.avatarUrl" class="k-avatar">
131
+ <kendo-chat-message #message
132
+ [message]="msg"
133
+ [tabbable]="lastGroup && lastMessage"
134
+ [template]="messageTemplate"
135
+ (click)="select(message)"
136
+ (focus)="select(message)"
137
+ [class.k-only]="group.messages.length === 1"
138
+ [class.k-first]="group.messages.length > 1 && firstMessage"
139
+ [class.k-last]="group.messages.length > 1 && lastMessage"
140
+ >
141
+ </kendo-chat-message>
142
+
143
+ <kendo-chat-attachment
144
+ *ngIf="msg.attachments && msg.attachments.length === 1"
145
+ [attachment]="msg.attachments[0]"
146
+ [template]="attachmentTemplate"
147
+ >
148
+ </kendo-chat-attachment>
149
+ </ng-container>
150
+ </div>
151
+
152
+ <kendo-chat-message-attachments #attachments
153
+ *ngSwitchCase="'attachment-group'"
154
+ [attachments]="group.attachments"
155
+ [layout]="group.attachmentLayout"
156
+ [tabbable]="lastGroup"
157
+ [template]="attachmentTemplate"
158
+ (click)="select(attachments)"
159
+ (focus)="select(attachments)"
160
+ >
161
+ </kendo-chat-message-attachments>
162
+
163
+ <kendo-chat-suggested-actions #actions
164
+ *ngSwitchCase="'action-group'"
165
+ [actions]="group.actions"
166
+ [tabbable]="lastGroup"
167
+ (dispatch)="dispatchAction($event, last(group.messages))"
168
+ (click)="select(actions)"
169
+ (focus)="select(actions)"
170
+ >
171
+ </kendo-chat-suggested-actions>
172
+ </ng-container>
173
+ </ng-container>
174
+ <kendo-resize-sensor (resize)="onResize()">
175
+ </kendo-resize-sensor>
176
+ `, isInline: true, components: [{ type: i2.MessageComponent, selector: "kendo-chat-message", inputs: ["message", "tabbable", "template"] }, { type: i3.AttachmentComponent, selector: "kendo-chat-attachment", inputs: ["attachment", "template"] }, { type: i4.MessageAttachmentsComponent, selector: "kendo-chat-message-attachments", inputs: ["attachments", "layout", "tabbable", "template"] }, { type: i5.SuggestedActionsComponent, selector: "kendo-chat-suggested-actions", inputs: ["actions", "tabbable"], outputs: ["dispatch"] }, { type: i6.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], directives: [{ type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
177
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageListComponent, decorators: [{
178
+ type: Component,
179
+ args: [{
180
+ selector: 'kendo-chat-message-list',
181
+ template: `
182
+ <ng-container *ngFor="let group of view; last as lastGroup; trackBy: trackGroup">
183
+ <ng-container [ngSwitch]="group.type">
184
+ <div
185
+ *ngSwitchCase="'date-marker'"
186
+ class="k-timestamp"
187
+ >
188
+ {{ formatTimeStamp(group.timestamp) }}
189
+ </div>
190
+ <div
191
+ *ngSwitchCase="'message-group'"
192
+ class="k-message-group"
193
+ [class.k-alt]="isOwnMessage(group.messages[0])"
194
+ [class.k-no-avatar]="!group.author.avatarUrl"
195
+ >
196
+ <img
197
+ *ngIf="group.author.avatarUrl"
198
+ [attr.src]="group.author.avatarUrl"
199
+ class="k-avatar"
200
+ />
201
+ <p *ngIf="group.author.name" class="k-author">{{ group.author.name }}</p>
202
+ <ng-container
203
+ *ngFor="let msg of group.messages; first as firstMessage; last as lastMessage"
204
+ >
205
+ <img *ngIf="msg.user?.avatarUrl" [src]="msg.user?.avatarUrl" class="k-avatar">
206
+ <kendo-chat-message #message
207
+ [message]="msg"
208
+ [tabbable]="lastGroup && lastMessage"
209
+ [template]="messageTemplate"
210
+ (click)="select(message)"
211
+ (focus)="select(message)"
212
+ [class.k-only]="group.messages.length === 1"
213
+ [class.k-first]="group.messages.length > 1 && firstMessage"
214
+ [class.k-last]="group.messages.length > 1 && lastMessage"
215
+ >
216
+ </kendo-chat-message>
217
+
218
+ <kendo-chat-attachment
219
+ *ngIf="msg.attachments && msg.attachments.length === 1"
220
+ [attachment]="msg.attachments[0]"
221
+ [template]="attachmentTemplate"
222
+ >
223
+ </kendo-chat-attachment>
224
+ </ng-container>
225
+ </div>
226
+
227
+ <kendo-chat-message-attachments #attachments
228
+ *ngSwitchCase="'attachment-group'"
229
+ [attachments]="group.attachments"
230
+ [layout]="group.attachmentLayout"
231
+ [tabbable]="lastGroup"
232
+ [template]="attachmentTemplate"
233
+ (click)="select(attachments)"
234
+ (focus)="select(attachments)"
235
+ >
236
+ </kendo-chat-message-attachments>
237
+
238
+ <kendo-chat-suggested-actions #actions
239
+ *ngSwitchCase="'action-group'"
240
+ [actions]="group.actions"
241
+ [tabbable]="lastGroup"
242
+ (dispatch)="dispatchAction($event, last(group.messages))"
243
+ (click)="select(actions)"
244
+ (focus)="select(actions)"
245
+ >
246
+ </kendo-chat-suggested-actions>
247
+ </ng-container>
248
+ </ng-container>
249
+ <kendo-resize-sensor (resize)="onResize()">
250
+ </kendo-resize-sensor>
251
+ `
252
+ }]
253
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }]; }, propDecorators: { messages: [{
254
+ type: Input
255
+ }], attachmentTemplate: [{
256
+ type: Input
257
+ }], messageTemplate: [{
258
+ type: Input
259
+ }], user: [{
260
+ type: Input
261
+ }], executeAction: [{
262
+ type: Output
263
+ }], navigate: [{
264
+ type: Output
265
+ }], resize: [{
266
+ type: Output
267
+ }], items: [{
268
+ type: ViewChildren,
269
+ args: [ChatItem]
270
+ }], cssClass: [{
271
+ type: HostBinding,
272
+ args: ['class.k-message-list-content']
273
+ }], onKeydown: [{
274
+ type: HostListener,
275
+ args: ['keydown', ['$event']]
276
+ }], onBlur: [{
277
+ type: HostListener,
278
+ args: ['focusout', ['$event']]
279
+ }] } });
@@ -2,8 +2,8 @@
2
2
  * Copyright © 2021 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 * as tslib_1 from "tslib";
6
- import { Directive, Optional, TemplateRef } from "@angular/core";
5
+ import { Directive, Optional } from "@angular/core";
6
+ import * as i0 from "@angular/core";
7
7
  /**
8
8
  * Defines a template that will be used for displaying Chat messages. To define an attachment
9
9
  * template, nest an `<ng-template>` tag with the `kendoChatMessageTemplate` attribute inside the
@@ -16,16 +16,18 @@ import { Directive, Optional, TemplateRef } from "@angular/core";
16
16
  * {% embed_file shared/main.ts hidden %}
17
17
  * {% endmeta %}
18
18
  */
19
- let MessageTemplateDirective = class MessageTemplateDirective {
19
+ export class MessageTemplateDirective {
20
20
  constructor(templateRef) {
21
21
  this.templateRef = templateRef;
22
22
  }
23
- };
24
- MessageTemplateDirective = tslib_1.__decorate([
25
- Directive({
26
- selector: '[kendoChatMessageTemplate]'
27
- }),
28
- tslib_1.__param(0, Optional()),
29
- tslib_1.__metadata("design:paramtypes", [TemplateRef])
30
- ], MessageTemplateDirective);
31
- export { MessageTemplateDirective };
23
+ }
24
+ MessageTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
25
+ MessageTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: MessageTemplateDirective, selector: "[kendoChatMessageTemplate]", ngImport: i0 });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageTemplateDirective, decorators: [{
27
+ type: Directive,
28
+ args: [{
29
+ selector: '[kendoChatMessageTemplate]'
30
+ }]
31
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
32
+ type: Optional
33
+ }] }]; } });
@@ -0,0 +1,140 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Component, forwardRef, HostBinding, Input } from '@angular/core';
6
+ import { ChatItem } from './chat-item';
7
+ import * as i0 from "@angular/core";
8
+ import * as i1 from "@progress/kendo-angular-intl";
9
+ import * as i2 from "@angular/common";
10
+ // eslint-disable no-forward-ref
11
+ /**
12
+ * @hidden
13
+ */
14
+ export class MessageComponent extends ChatItem {
15
+ constructor(element, intl) {
16
+ super();
17
+ this.element = element;
18
+ this.intl = intl;
19
+ this.cssClass = true;
20
+ }
21
+ get tabIndex() {
22
+ return this.tabbable ? '0' : '-1';
23
+ }
24
+ formatTimeStamp(date) {
25
+ return this.intl.formatDate(date, { datetime: 'short' });
26
+ }
27
+ focus() {
28
+ this.element.nativeElement.focus();
29
+ }
30
+ }
31
+ MessageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageComponent, deps: [{ token: i0.ElementRef }, { token: i1.IntlService }], target: i0.ɵɵFactoryTarget.Component });
32
+ MessageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MessageComponent, selector: "kendo-chat-message", inputs: { message: "message", tabbable: "tabbable", template: "template" }, host: { properties: { "class.k-message": "this.cssClass", "class.k-state-selected": "this.selected", "class.k-state-focused": "this.selected", "attr.tabIndex": "this.tabIndex" } }, providers: [{
33
+ provide: ChatItem,
34
+ useExisting: forwardRef(() => MessageComponent)
35
+ }], usesInheritance: true, ngImport: i0, template: `
36
+ <time
37
+ [attr.aria-hidden]="!selected"
38
+ class="k-message-time"
39
+ *ngIf="message.timestamp"
40
+ >
41
+ {{ formatTimeStamp(message.timestamp) }}
42
+ </time>
43
+
44
+ <ng-container *ngIf="!message.typing; else typing">
45
+ <div class="k-bubble" *ngIf="template">
46
+ <ng-container
47
+ *ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
48
+ >
49
+ </ng-container>
50
+ </div>
51
+
52
+ <div class="k-bubble" *ngIf="!template && message.text">
53
+ {{message.text}}
54
+ </div>
55
+ </ng-container>
56
+
57
+ <span
58
+ class="k-message-status"
59
+ *ngIf="message.status"
60
+ >
61
+ {{ message.status }}
62
+ </span>
63
+
64
+ <ng-template #typing>
65
+ <div class="k-bubble">
66
+ <div class="k-typing-indicator">
67
+ <span></span>
68
+ <span></span>
69
+ <span></span>
70
+ </div>
71
+ </div>
72
+ </ng-template>
73
+ `, isInline: true, directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
74
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageComponent, decorators: [{
75
+ type: Component,
76
+ args: [{
77
+ selector: 'kendo-chat-message',
78
+ providers: [{
79
+ provide: ChatItem,
80
+ useExisting: forwardRef(() => MessageComponent)
81
+ }],
82
+ template: `
83
+ <time
84
+ [attr.aria-hidden]="!selected"
85
+ class="k-message-time"
86
+ *ngIf="message.timestamp"
87
+ >
88
+ {{ formatTimeStamp(message.timestamp) }}
89
+ </time>
90
+
91
+ <ng-container *ngIf="!message.typing; else typing">
92
+ <div class="k-bubble" *ngIf="template">
93
+ <ng-container
94
+ *ngTemplateOutlet="template.templateRef; context: { $implicit: message };"
95
+ >
96
+ </ng-container>
97
+ </div>
98
+
99
+ <div class="k-bubble" *ngIf="!template && message.text">
100
+ {{message.text}}
101
+ </div>
102
+ </ng-container>
103
+
104
+ <span
105
+ class="k-message-status"
106
+ *ngIf="message.status"
107
+ >
108
+ {{ message.status }}
109
+ </span>
110
+
111
+ <ng-template #typing>
112
+ <div class="k-bubble">
113
+ <div class="k-typing-indicator">
114
+ <span></span>
115
+ <span></span>
116
+ <span></span>
117
+ </div>
118
+ </div>
119
+ </ng-template>
120
+ `
121
+ }]
122
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.IntlService }]; }, propDecorators: { message: [{
123
+ type: Input
124
+ }], tabbable: [{
125
+ type: Input
126
+ }], template: [{
127
+ type: Input
128
+ }], cssClass: [{
129
+ type: HostBinding,
130
+ args: ['class.k-message']
131
+ }], selected: [{
132
+ type: HostBinding,
133
+ args: ['class.k-state-selected']
134
+ }, {
135
+ type: HostBinding,
136
+ args: ['class.k-state-focused']
137
+ }], tabIndex: [{
138
+ type: HostBinding,
139
+ args: ['attr.tabIndex']
140
+ }] } });
@@ -0,0 +1,113 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Component, EventEmitter, forwardRef, HostBinding, Input, Output, ViewChildren } from '@angular/core';
6
+ import { ChatItem } from './chat-item';
7
+ import * as i0 from "@angular/core";
8
+ import * as i1 from "@angular/common";
9
+ // eslint-disable no-forward-ref
10
+ /**
11
+ * @hidden
12
+ */
13
+ export class SuggestedActionsComponent extends ChatItem {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.dispatch = new EventEmitter();
17
+ this.defaultClass = true;
18
+ this.selectedIndex = 0;
19
+ this.keyHandlers = {
20
+ [37 /* left */]: (e) => this.navigateTo(e, -1),
21
+ [39 /* right */]: (e) => this.navigateTo(e, 1),
22
+ [13 /* enter */]: (_, action) => this.actionClick(action)
23
+ };
24
+ }
25
+ isSelected(index) {
26
+ return this.selected && this.selectedIndex === index;
27
+ }
28
+ actionClick(action) {
29
+ this.dispatch.next(action);
30
+ }
31
+ actionKeydown(e, action) {
32
+ const handler = this.keyHandlers[e.keyCode];
33
+ if (handler) {
34
+ handler(e, action);
35
+ }
36
+ }
37
+ focus() {
38
+ this.select(this.selectedIndex);
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) {
48
+ const prevIndex = this.selectedIndex;
49
+ const nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
50
+ if (nextIndex !== prevIndex) {
51
+ this.select(nextIndex);
52
+ e.preventDefault();
53
+ }
54
+ }
55
+ }
56
+ SuggestedActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SuggestedActionsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
57
+ SuggestedActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SuggestedActionsComponent, selector: "kendo-chat-suggested-actions", inputs: { actions: "actions", tabbable: "tabbable" }, outputs: { dispatch: "dispatch" }, host: { properties: { "class.k-quick-replies": "this.defaultClass" } }, providers: [{
58
+ provide: ChatItem,
59
+ useExisting: forwardRef(() => SuggestedActionsComponent)
60
+ }], viewQueries: [{ propertyName: "items", predicate: ["item"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
61
+ <span
62
+ #item
63
+ *ngFor="let action of actions; index as index; first as first; last as last"
64
+ class="k-quick-reply"
65
+ [class.k-state-selected]="isSelected(index)"
66
+ [class.k-state-focused]="isSelected(index)"
67
+ [class.k-first]="first"
68
+ [class.k-last]="last"
69
+ [attr.tabindex]="tabbable && selectedIndex === index ? '0' : '-1'"
70
+ (click)="actionClick(action)"
71
+ (keydown)="actionKeydown($event, action)"
72
+ >
73
+ {{ action.title || action.value }}
74
+ </span>
75
+ `, isInline: true, directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
76
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SuggestedActionsComponent, decorators: [{
77
+ type: Component,
78
+ args: [{
79
+ selector: 'kendo-chat-suggested-actions',
80
+ providers: [{
81
+ provide: ChatItem,
82
+ useExisting: forwardRef(() => SuggestedActionsComponent)
83
+ }],
84
+ template: `
85
+ <span
86
+ #item
87
+ *ngFor="let action of actions; index as index; first as first; last as last"
88
+ class="k-quick-reply"
89
+ [class.k-state-selected]="isSelected(index)"
90
+ [class.k-state-focused]="isSelected(index)"
91
+ [class.k-first]="first"
92
+ [class.k-last]="last"
93
+ [attr.tabindex]="tabbable && selectedIndex === index ? '0' : '-1'"
94
+ (click)="actionClick(action)"
95
+ (keydown)="actionKeydown($event, action)"
96
+ >
97
+ {{ action.title || action.value }}
98
+ </span>
99
+ `
100
+ }]
101
+ }], propDecorators: { actions: [{
102
+ type: Input
103
+ }], tabbable: [{
104
+ type: Input
105
+ }], dispatch: [{
106
+ type: Output
107
+ }], defaultClass: [{
108
+ type: HostBinding,
109
+ args: ['class.k-quick-replies']
110
+ }], items: [{
111
+ type: ViewChildren,
112
+ args: ['item']
113
+ }] } });
@@ -0,0 +1,37 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, HostListener, HostBinding } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * @hidden
9
+ */
10
+ export class FocusedStateDirective {
11
+ constructor() {
12
+ this.focused = false;
13
+ }
14
+ onFocus() {
15
+ this.focused = true;
16
+ }
17
+ onBlur() {
18
+ this.focused = false;
19
+ }
20
+ }
21
+ FocusedStateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FocusedStateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
22
+ FocusedStateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FocusedStateDirective, selector: "[kendoChatFocusedState]", host: { listeners: { "focusin": "onFocus()", "focusout": "onBlur()" }, properties: { "class.k-focus": "this.focused" } }, ngImport: i0 });
23
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FocusedStateDirective, decorators: [{
24
+ type: Directive,
25
+ args: [{
26
+ selector: '[kendoChatFocusedState]'
27
+ }]
28
+ }], propDecorators: { focused: [{
29
+ type: HostBinding,
30
+ args: ['class.k-focus']
31
+ }], onFocus: [{
32
+ type: HostListener,
33
+ args: ['focusin']
34
+ }], onBlur: [{
35
+ type: HostListener,
36
+ args: ['focusout']
37
+ }] } });
@@ -2,3 +2,4 @@
2
2
  * Copyright © 2021 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
+ export {};
@@ -2,3 +2,4 @@
2
2
  * Copyright © 2021 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
+ export {};