@progress/kendo-angular-conversational-ui 4.0.0-dev.202201131630 → 5.0.0-next.202202241517

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 (148) 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 +6 -6
  17. package/{dist/es2015/chat → chat}/chat.directives.d.ts +0 -0
  18. package/chat/chat.module.d.ts +47 -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-list.component.d.ts +8 -7
  24. package/{dist/es2015/chat → chat}/message-template.directive.d.ts +3 -0
  25. package/{dist/es2015/chat → chat}/message.component.d.ts +4 -1
  26. package/{dist/es2015/chat → chat}/suggested-actions.component.d.ts +4 -1
  27. package/common/focused-state.directive.d.ts +15 -0
  28. package/{dist/es2015/common → common}/keys.enum.d.ts +0 -0
  29. package/{dist/es2015/common → common}/scroll-anchor.directive.d.ts +3 -0
  30. package/{dist/es2015/common → common}/utils.d.ts +0 -0
  31. package/{dist/es2015 → esm2015}/api/action.interface.js +2 -1
  32. package/{dist/es2015 → esm2015}/api/attachment.interface.js +1 -0
  33. package/{dist/es2015 → esm2015}/api/execute-action-event.js +0 -0
  34. package/{dist/es/api/attachment.interface.js → esm2015/api/index.js} +6 -0
  35. package/{dist/es → esm2015}/api/message.interface.js +1 -0
  36. package/{dist/es2015 → esm2015}/api/post-message-event.js +0 -0
  37. package/{dist/es2015 → esm2015}/api/preventable-event.js +0 -0
  38. package/{dist/es2015 → esm2015}/api/user.interface.js +1 -0
  39. package/esm2015/cards/hero-card.component.js +88 -0
  40. package/{dist/es2015 → esm2015}/chat/attachment-template.directive.js +14 -12
  41. package/esm2015/chat/attachment.component.js +83 -0
  42. package/{dist/es2015 → esm2015}/chat/builtin-actions.js +13 -16
  43. package/{dist/es2015 → esm2015}/chat/chat-item.js +0 -0
  44. package/{dist/es2015 → esm2015}/chat/chat-view.js +0 -6
  45. package/esm2015/chat/chat.component.js +226 -0
  46. package/{dist/es → esm2015}/chat/chat.directives.js +0 -0
  47. package/{dist/es2015 → esm2015}/chat/chat.module.js +40 -15
  48. package/esm2015/chat/l10n/custom-messages.component.js +42 -0
  49. package/esm2015/chat/l10n/localized-messages.directive.js +37 -0
  50. package/esm2015/chat/l10n/messages.js +24 -0
  51. package/{dist/es2015 → esm2015}/chat/message-attachments.component.js +71 -48
  52. package/esm2015/chat/message-list.component.js +279 -0
  53. package/{dist/es2015 → esm2015}/chat/message-template.directive.js +14 -12
  54. package/esm2015/chat/message.component.js +140 -0
  55. package/esm2015/chat/suggested-actions.component.js +111 -0
  56. package/esm2015/common/focused-state.directive.js +37 -0
  57. package/{dist/es2015 → esm2015}/common/keys.enum.js +1 -0
  58. package/{dist/es2015 → esm2015}/common/scroll-anchor.directive.js +20 -26
  59. package/{dist/es2015 → esm2015}/common/utils.js +0 -0
  60. package/{dist/es/api/action.interface.js → esm2015/kendo-angular-conversational-ui.js} +4 -1
  61. package/{dist/npm/chat/chat-item.js → esm2015/main.js} +5 -11
  62. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  63. package/fesm2015/kendo-angular-conversational-ui.js +1576 -0
  64. package/{dist/es2015/common/focused-state.directive.d.ts → kendo-angular-conversational-ui.d.ts} +3 -6
  65. package/main.d.ts +9 -0
  66. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  67. package/package.json +35 -102
  68. package/schematics/ngAdd/index.js +5 -2
  69. package/schematics/ngAdd/index.js.map +1 -1
  70. package/dist/cdn/js/kendo-angular-conversational-ui.js +0 -20
  71. package/dist/cdn/main.js +0 -5
  72. package/dist/es/api/execute-action-event.js +0 -24
  73. package/dist/es/api/post-message-event.js +0 -18
  74. package/dist/es/api/preventable-event.js +0 -32
  75. package/dist/es/cards/hero-card.component.js +0 -54
  76. package/dist/es/chat/attachment-template.directive.js +0 -32
  77. package/dist/es/chat/attachment.component.js +0 -65
  78. package/dist/es/chat/builtin-actions.js +0 -28
  79. package/dist/es/chat/chat-item.js +0 -13
  80. package/dist/es/chat/chat-view.js +0 -92
  81. package/dist/es/chat/chat.component.js +0 -193
  82. package/dist/es/chat/chat.module.js +0 -76
  83. package/dist/es/chat/l10n/custom-messages.component.js +0 -45
  84. package/dist/es/chat/l10n/localized-messages.directive.js +0 -36
  85. package/dist/es/chat/l10n/messages.js +0 -26
  86. package/dist/es/chat/message-attachments.component.js +0 -148
  87. package/dist/es/chat/message-list.component.js +0 -165
  88. package/dist/es/chat/message-template.directive.js +0 -32
  89. package/dist/es/chat/message.component.js +0 -77
  90. package/dist/es/chat/suggested-actions.component.js +0 -91
  91. package/dist/es/common/focused-state.directive.js +0 -43
  92. package/dist/es/common/keys.enum.js +0 -4
  93. package/dist/es/common/scroll-anchor.directive.js +0 -87
  94. package/dist/es/common/utils.js +0 -13
  95. package/dist/es/index.js +0 -21
  96. package/dist/es/main.js +0 -8
  97. package/dist/es/package-metadata.js +0 -15
  98. package/dist/es2015/api/message.interface.js +0 -4
  99. package/dist/es2015/cards/hero-card.component.js +0 -78
  100. package/dist/es2015/chat/attachment.component.js +0 -66
  101. package/dist/es2015/chat/chat.component.js +0 -230
  102. package/dist/es2015/chat/chat.directives.js +0 -7
  103. package/dist/es2015/chat/chat.module.d.ts +0 -27
  104. package/dist/es2015/chat/l10n/custom-messages.component.js +0 -37
  105. package/dist/es2015/chat/l10n/localized-messages.directive.js +0 -32
  106. package/dist/es2015/chat/l10n/messages.js +0 -20
  107. package/dist/es2015/chat/message-list.component.js +0 -227
  108. package/dist/es2015/chat/message.component.js +0 -107
  109. package/dist/es2015/chat/suggested-actions.component.js +0 -104
  110. package/dist/es2015/common/focused-state.directive.js +0 -45
  111. package/dist/es2015/index.d.ts +0 -21
  112. package/dist/es2015/index.js +0 -21
  113. package/dist/es2015/index.metadata.json +0 -1
  114. package/dist/es2015/main.d.ts +0 -12
  115. package/dist/es2015/main.js +0 -8
  116. package/dist/fesm2015/index.js +0 -1403
  117. package/dist/fesm5/index.js +0 -1253
  118. package/dist/npm/api/action.interface.js +0 -7
  119. package/dist/npm/api/attachment.interface.js +0 -6
  120. package/dist/npm/api/execute-action-event.js +0 -26
  121. package/dist/npm/api/message.interface.js +0 -6
  122. package/dist/npm/api/post-message-event.js +0 -20
  123. package/dist/npm/api/preventable-event.js +0 -34
  124. package/dist/npm/api/user.interface.js +0 -6
  125. package/dist/npm/cards/hero-card.component.js +0 -56
  126. package/dist/npm/chat/attachment-template.directive.js +0 -34
  127. package/dist/npm/chat/attachment.component.js +0 -67
  128. package/dist/npm/chat/builtin-actions.js +0 -33
  129. package/dist/npm/chat/chat-view.js +0 -98
  130. package/dist/npm/chat/chat.component.js +0 -195
  131. package/dist/npm/chat/chat.directives.js +0 -12
  132. package/dist/npm/chat/chat.module.js +0 -78
  133. package/dist/npm/chat/l10n/custom-messages.component.js +0 -47
  134. package/dist/npm/chat/l10n/localized-messages.directive.js +0 -38
  135. package/dist/npm/chat/l10n/messages.js +0 -28
  136. package/dist/npm/chat/message-attachments.component.js +0 -150
  137. package/dist/npm/chat/message-list.component.js +0 -167
  138. package/dist/npm/chat/message-template.directive.js +0 -34
  139. package/dist/npm/chat/message.component.js +0 -79
  140. package/dist/npm/chat/suggested-actions.component.js +0 -93
  141. package/dist/npm/common/focused-state.directive.js +0 -45
  142. package/dist/npm/common/keys.enum.js +0 -6
  143. package/dist/npm/common/scroll-anchor.directive.js +0 -89
  144. package/dist/npm/common/utils.js +0 -15
  145. package/dist/npm/index.js +0 -37
  146. package/dist/npm/main.js +0 -11
  147. package/dist/npm/package-metadata.js +0 -17
  148. package/dist/systemjs/kendo-angular-conversational-ui.js +0 -5
@@ -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, forwardRef } from '@angular/core';
6
+ import { Messages } from './messages';
7
+ import * as i0 from "@angular/core";
8
+ import * as i1 from "@progress/kendo-angular-l10n";
9
+ // eslint-disable no-forward-ref
10
+ /**
11
+ * @hidden
12
+ */
13
+ export class LocalizedMessagesDirective extends Messages {
14
+ constructor(service) {
15
+ super();
16
+ this.service = service;
17
+ }
18
+ }
19
+ LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
20
+ LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: LocalizedMessagesDirective, selector: "[kendoChatLocalizedMessages]", providers: [
21
+ {
22
+ provide: Messages,
23
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
24
+ }
25
+ ], usesInheritance: true, ngImport: i0 });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
27
+ type: Directive,
28
+ args: [{
29
+ providers: [
30
+ {
31
+ provide: Messages,
32
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
33
+ }
34
+ ],
35
+ selector: '[kendoChatLocalizedMessages]'
36
+ }]
37
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });
@@ -0,0 +1,24 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, Input } from '@angular/core';
6
+ import { ComponentMessages } from '@progress/kendo-angular-l10n';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * @hidden
10
+ */
11
+ export class Messages extends ComponentMessages {
12
+ }
13
+ Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
14
+ Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: Messages, selector: "kendoConversationalUIMessages", inputs: { messagePlaceholder: "messagePlaceholder", send: "send" }, usesInheritance: true, ngImport: i0 });
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, decorators: [{
16
+ type: Directive,
17
+ args: [{
18
+ selector: 'kendoConversationalUIMessages'
19
+ }]
20
+ }], propDecorators: { messagePlaceholder: [{
21
+ type: Input
22
+ }], send: [{
23
+ type: Input
24
+ }] } });
@@ -2,18 +2,18 @@
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
- var MessageAttachmentsComponent_1;
7
- import { Component, ElementRef, forwardRef, HostBinding, Input, NgZone, QueryList, ViewChild, ViewChildren } from '@angular/core';
5
+ import { Component, ElementRef, forwardRef, HostBinding, Input, ViewChild, ViewChildren } from '@angular/core';
8
6
  import { fromEvent } from 'rxjs';
9
7
  import { debounceTime } from 'rxjs/operators';
10
8
  import { ChatItem } from './chat-item';
11
- import { AttachmentTemplateDirective } from './chat.directives';
12
- // tslint:disable:no-forward-ref
9
+ import * as i0 from "@angular/core";
10
+ import * as i1 from "./attachment.component";
11
+ import * as i2 from "@angular/common";
12
+ // eslint-disable no-forward-ref
13
13
  /**
14
14
  * @hidden
15
15
  */
16
- let MessageAttachmentsComponent = MessageAttachmentsComponent_1 = class MessageAttachmentsComponent extends ChatItem {
16
+ export class MessageAttachmentsComponent extends ChatItem {
17
17
  constructor(zone) {
18
18
  super();
19
19
  this.zone = zone;
@@ -93,44 +93,52 @@ let MessageAttachmentsComponent = MessageAttachmentsComponent_1 = class MessageA
93
93
  });
94
94
  }
95
95
  }
96
- };
97
- tslib_1.__decorate([
98
- Input(),
99
- tslib_1.__metadata("design:type", Array)
100
- ], MessageAttachmentsComponent.prototype, "attachments", void 0);
101
- tslib_1.__decorate([
102
- Input(),
103
- tslib_1.__metadata("design:type", String)
104
- ], MessageAttachmentsComponent.prototype, "layout", void 0);
105
- tslib_1.__decorate([
106
- Input(),
107
- tslib_1.__metadata("design:type", Boolean)
108
- ], MessageAttachmentsComponent.prototype, "tabbable", void 0);
109
- tslib_1.__decorate([
110
- Input(),
111
- tslib_1.__metadata("design:type", AttachmentTemplateDirective)
112
- ], MessageAttachmentsComponent.prototype, "template", void 0);
113
- tslib_1.__decorate([
114
- HostBinding('class.k-card-deck-scrollwrap'),
115
- tslib_1.__metadata("design:type", Boolean),
116
- tslib_1.__metadata("design:paramtypes", [])
117
- ], MessageAttachmentsComponent.prototype, "carousel", null);
118
- tslib_1.__decorate([
119
- ViewChild('deck', { read: ElementRef, static: true }),
120
- tslib_1.__metadata("design:type", ElementRef)
121
- ], MessageAttachmentsComponent.prototype, "deck", void 0);
122
- tslib_1.__decorate([
123
- ViewChildren('item', { read: ElementRef }),
124
- tslib_1.__metadata("design:type", QueryList)
125
- ], MessageAttachmentsComponent.prototype, "items", void 0);
126
- MessageAttachmentsComponent = MessageAttachmentsComponent_1 = tslib_1.__decorate([
127
- Component({
128
- providers: [{
129
- provide: ChatItem,
130
- useExisting: forwardRef(() => MessageAttachmentsComponent_1)
131
- }],
132
- selector: 'kendo-chat-message-attachments',
133
- template: `
96
+ }
97
+ MessageAttachmentsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageAttachmentsComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
98
+ MessageAttachmentsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: MessageAttachmentsComponent, selector: "kendo-chat-message-attachments", inputs: { attachments: "attachments", layout: "layout", tabbable: "tabbable", template: "template" }, host: { properties: { "class.k-card-deck-scrollwrap": "this.carousel" } }, providers: [{
99
+ provide: ChatItem,
100
+ useExisting: forwardRef(() => MessageAttachmentsComponent)
101
+ }], viewQueries: [{ propertyName: "deck", first: true, predicate: ["deck"], descendants: true, read: ElementRef, static: true }, { propertyName: "items", predicate: ["item"], descendants: true, read: ElementRef }], usesInheritance: true, ngImport: i0, template: `
102
+ <button
103
+ *ngIf="carousel && scrollPosition > 0"
104
+ (click)="scrollTo(-1)"
105
+ class="k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
106
+ tabindex="-1">
107
+ <span class="k-icon k-button-icon k-i-arrow-chevron-left"></span>
108
+ </button>
109
+ <div #deck [class.k-card-deck]="carousel">
110
+ <kendo-chat-attachment #item
111
+ *ngFor="let att of attachments; index as index; first as first; last as last"
112
+ [attachment]="att"
113
+ [template]="template"
114
+ [class.k-state-selected]="isSelected(index)"
115
+ [class.k-state-focused]="isSelected(index)"
116
+ [class.k-card-wrap]="true"
117
+ [class.k-first]="first"
118
+ [class.k-last]="last"
119
+ [attr.tabindex]="tabbable && isSelected(index) ? '0' : '-1'"
120
+ (click)="itemClick(index)"
121
+ (keydown)="itemKeydown($event, att)"
122
+ >
123
+ </kendo-chat-attachment>
124
+ </div>
125
+ <button
126
+ *ngIf="carousel && scrollPosition < 1"
127
+ (click)="scrollTo(1)"
128
+ class="k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
129
+ tabindex="-1">
130
+ <span class="k-icon k-button-icon k-i-arrow-chevron-right"></span>
131
+ </button>
132
+ `, isInline: true, components: [{ type: i1.AttachmentComponent, selector: "kendo-chat-attachment", inputs: ["attachment", "template"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MessageAttachmentsComponent, decorators: [{
134
+ type: Component,
135
+ args: [{
136
+ providers: [{
137
+ provide: ChatItem,
138
+ useExisting: forwardRef(() => MessageAttachmentsComponent)
139
+ }],
140
+ selector: 'kendo-chat-message-attachments',
141
+ template: `
134
142
  <button
135
143
  *ngIf="carousel && scrollPosition > 0"
136
144
  (click)="scrollTo(-1)"
@@ -162,7 +170,22 @@ MessageAttachmentsComponent = MessageAttachmentsComponent_1 = tslib_1.__decorate
162
170
  <span class="k-icon k-button-icon k-i-arrow-chevron-right"></span>
163
171
  </button>
164
172
  `
165
- }),
166
- tslib_1.__metadata("design:paramtypes", [NgZone])
167
- ], MessageAttachmentsComponent);
168
- export { MessageAttachmentsComponent };
173
+ }]
174
+ }], ctorParameters: function () { return [{ type: i0.NgZone }]; }, propDecorators: { attachments: [{
175
+ type: Input
176
+ }], layout: [{
177
+ type: Input
178
+ }], tabbable: [{
179
+ type: Input
180
+ }], template: [{
181
+ type: Input
182
+ }], carousel: [{
183
+ type: HostBinding,
184
+ args: ['class.k-card-deck-scrollwrap']
185
+ }], deck: [{
186
+ type: ViewChild,
187
+ args: ['deck', { read: ElementRef, static: true }]
188
+ }], items: [{
189
+ type: ViewChildren,
190
+ args: ['item', { read: ElementRef }]
191
+ }] } });
@@ -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
+ }] }]; } });