@progress/kendo-angular-conversational-ui 4.0.0 → 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 +34 -101
  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,88 @@
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, Input, Output } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ import * as i1 from "@angular/common";
8
+ import * as i2 from "@progress/kendo-angular-buttons";
9
+ /**
10
+ * Represents a Hero Card component ([see example]({% slug dialogflow_chat %})).
11
+ * Hero cards host a single large image and action buttons with text content.
12
+ */
13
+ export class HeroCardComponent {
14
+ constructor() {
15
+ this.cssClass = true;
16
+ /**
17
+ * Fires when the user clicks a button.
18
+ */
19
+ this.executeAction = new EventEmitter();
20
+ }
21
+ onClick(action) {
22
+ this.executeAction.next(action);
23
+ }
24
+ }
25
+ HeroCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: HeroCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
26
+ HeroCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: HeroCardComponent, selector: "kendo-chat-hero-card", inputs: { imageUrl: "imageUrl", title: "title", subtitle: "subtitle", actions: "actions" }, outputs: { executeAction: "executeAction" }, host: { properties: { "class.k-card": "this.cssClass" } }, ngImport: i0, template: `
27
+ <img class="k-card-image" [src]="imageUrl" *ngIf="imageUrl" />
28
+ <div class="k-card-body">
29
+ <h5 class="k-card-title" *ngIf="title">
30
+ {{ title }}
31
+ </h5>
32
+ <h6 class="k-card-subtitle" *ngIf="subtitle">
33
+ {{ subtitle }}
34
+ </h6>
35
+ </div>
36
+ <div class="k-card-actions k-card-actions-vertical">
37
+ <span class="k-card-action"
38
+ *ngFor="let act of actions"
39
+ >
40
+ <button
41
+ kendoButton fillMode="flat"
42
+ (click)="onClick(act)">
43
+ {{ act.title }}
44
+ </button>
45
+ </span>
46
+ </div>
47
+ `, isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "shape", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
48
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: HeroCardComponent, decorators: [{
49
+ type: Component,
50
+ args: [{
51
+ selector: 'kendo-chat-hero-card',
52
+ template: `
53
+ <img class="k-card-image" [src]="imageUrl" *ngIf="imageUrl" />
54
+ <div class="k-card-body">
55
+ <h5 class="k-card-title" *ngIf="title">
56
+ {{ title }}
57
+ </h5>
58
+ <h6 class="k-card-subtitle" *ngIf="subtitle">
59
+ {{ subtitle }}
60
+ </h6>
61
+ </div>
62
+ <div class="k-card-actions k-card-actions-vertical">
63
+ <span class="k-card-action"
64
+ *ngFor="let act of actions"
65
+ >
66
+ <button
67
+ kendoButton fillMode="flat"
68
+ (click)="onClick(act)">
69
+ {{ act.title }}
70
+ </button>
71
+ </span>
72
+ </div>
73
+ `
74
+ }]
75
+ }], propDecorators: { imageUrl: [{
76
+ type: Input
77
+ }], title: [{
78
+ type: Input
79
+ }], subtitle: [{
80
+ type: Input
81
+ }], actions: [{
82
+ type: Input
83
+ }], cssClass: [{
84
+ type: HostBinding,
85
+ args: ['class.k-card']
86
+ }], executeAction: [{
87
+ type: Output
88
+ }] } });
@@ -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 message attachments. To define an attachment
9
9
  * template, nest an `<ng-template>` tag with the `kendoChatAttachmentTemplate` 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 AttachmentTemplateDirective = class AttachmentTemplateDirective {
19
+ export class AttachmentTemplateDirective {
20
20
  constructor(templateRef) {
21
21
  this.templateRef = templateRef;
22
22
  }
23
- };
24
- AttachmentTemplateDirective = tslib_1.__decorate([
25
- Directive({
26
- selector: '[kendoChatAttachmentTemplate]'
27
- }),
28
- tslib_1.__param(0, Optional()),
29
- tslib_1.__metadata("design:paramtypes", [TemplateRef])
30
- ], AttachmentTemplateDirective);
31
- export { AttachmentTemplateDirective };
23
+ }
24
+ AttachmentTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AttachmentTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
25
+ AttachmentTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: AttachmentTemplateDirective, selector: "[kendoChatAttachmentTemplate]", ngImport: i0 });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AttachmentTemplateDirective, decorators: [{
27
+ type: Directive,
28
+ args: [{
29
+ selector: '[kendoChatAttachmentTemplate]'
30
+ }]
31
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
32
+ type: Optional
33
+ }] }]; } });
@@ -0,0 +1,83 @@
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, Input } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ import * as i1 from "@angular/common";
8
+ /**
9
+ * @hidden
10
+ */
11
+ export class AttachmentComponent {
12
+ set attachment(value) {
13
+ this._attachment = value;
14
+ this.context = {
15
+ $implicit: this.attachment
16
+ };
17
+ }
18
+ get attachment() {
19
+ return this._attachment;
20
+ }
21
+ get image() {
22
+ return this.contentType.indexOf('image/') === 0;
23
+ }
24
+ get unknown() {
25
+ return !this.image;
26
+ }
27
+ get contentType() {
28
+ return this.attachment.contentType || '';
29
+ }
30
+ }
31
+ AttachmentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AttachmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
32
+ AttachmentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: AttachmentComponent, selector: "kendo-chat-attachment", inputs: { attachment: "attachment", template: "template" }, ngImport: i0, template: `
33
+ <ng-container *ngIf="template">
34
+ <ng-container *ngTemplateOutlet="template.templateRef; context: context;">
35
+ </ng-container>
36
+ </ng-container>
37
+
38
+ <div *ngIf="!template" class="k-card">
39
+ <div class="k-card-body">
40
+ <h5 class="k-card-title" *ngIf="attachment.title">
41
+ {{ attachment.title }}
42
+ </h5>
43
+ <h6 class="k-card-subtitle" *ngIf="attachment.subtitle">
44
+ {{ attachment.subtitle }}
45
+ </h6>
46
+ <img *ngIf="image" [attr.src]="attachment.content" />
47
+ <ng-container *ngIf="unknown">
48
+ {{ attachment.content }}
49
+ </ng-container>
50
+ </div>
51
+ </div>
52
+ `, isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: AttachmentComponent, decorators: [{
54
+ type: Component,
55
+ args: [{
56
+ selector: 'kendo-chat-attachment',
57
+ template: `
58
+ <ng-container *ngIf="template">
59
+ <ng-container *ngTemplateOutlet="template.templateRef; context: context;">
60
+ </ng-container>
61
+ </ng-container>
62
+
63
+ <div *ngIf="!template" class="k-card">
64
+ <div class="k-card-body">
65
+ <h5 class="k-card-title" *ngIf="attachment.title">
66
+ {{ attachment.title }}
67
+ </h5>
68
+ <h6 class="k-card-subtitle" *ngIf="attachment.subtitle">
69
+ {{ attachment.subtitle }}
70
+ </h6>
71
+ <img *ngIf="image" [attr.src]="attachment.content" />
72
+ <ng-container *ngIf="unknown">
73
+ {{ attachment.content }}
74
+ </ng-container>
75
+ </div>
76
+ </div>
77
+ `
78
+ }]
79
+ }], propDecorators: { attachment: [{
80
+ type: Input
81
+ }], template: [{
82
+ type: Input
83
+ }] } });
@@ -4,25 +4,22 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { SendMessageEvent } from '../api/post-message-event';
6
6
  const noop = () => { };
7
- const ɵ0 = noop;
8
- const ɵ1 = (action, sender) => {
9
- sender.sendMessage.emit(new SendMessageEvent({
10
- author: sender.user,
11
- text: action.value,
12
- timestamp: new Date()
13
- }));
14
- }, ɵ2 = (action) => {
15
- window.open('tel:' + action.value);
16
- }, ɵ3 = (action) => {
17
- window.open(action.value);
18
- };
19
7
  const handlers = {
20
- 'reply': ɵ1,
21
- 'call': ɵ2,
22
- 'openUrl': ɵ3
8
+ 'reply': (action, sender) => {
9
+ sender.sendMessage.emit(new SendMessageEvent({
10
+ author: sender.user,
11
+ text: action.value,
12
+ timestamp: new Date()
13
+ }));
14
+ },
15
+ 'call': (action) => {
16
+ window.open('tel:' + action.value);
17
+ },
18
+ 'openUrl': (action) => {
19
+ window.open(action.value);
20
+ }
23
21
  };
24
22
  /**
25
23
  * @hidden
26
24
  */
27
25
  export const makeHandler = (action) => handlers[action.type] || noop;
28
- export { ɵ0, ɵ1, ɵ2, ɵ3 };
File without changes
@@ -8,11 +8,9 @@ import { isDevMode } from '@angular/core';
8
8
  */
9
9
  export const isAuthor = (user, msg) => user && msg.author && user.id === msg.author.id;
10
10
  const last = (arr) => arr[arr.length - 1];
11
- const ɵ0 = last;
12
11
  const dateChanged = (curr, prev) => (curr && prev) && (prev.getDate() !== curr.getDate() ||
13
12
  prev.getMonth() !== curr.getMonth() ||
14
13
  prev.getFullYear() !== curr.getFullYear());
15
- const ɵ1 = dateChanged;
16
14
  const addDateMarker = (acc, msg) => {
17
15
  const timestamp = msg.timestamp;
18
16
  const lastItem = last(acc);
@@ -28,7 +26,6 @@ const addDateMarker = (acc, msg) => {
28
26
  acc.push(dateMarker);
29
27
  }
30
28
  };
31
- const ɵ2 = addDateMarker;
32
29
  const groupMessages = (acc, msg, isLastMessage) => {
33
30
  const lastItem = last(acc);
34
31
  let messages;
@@ -54,7 +51,6 @@ const groupMessages = (acc, msg, isLastMessage) => {
54
51
  });
55
52
  }
56
53
  };
57
- const ɵ3 = groupMessages;
58
54
  const groupItems = (total) => (acc, msg, index) => {
59
55
  const isLastMessage = index === total - 1;
60
56
  addDateMarker(acc, msg);
@@ -78,9 +74,7 @@ const groupItems = (total) => (acc, msg, index) => {
78
74
  }
79
75
  return acc;
80
76
  };
81
- const ɵ4 = groupItems;
82
77
  /**
83
78
  * @hidden
84
79
  */
85
80
  export const chatView = (messages) => messages.reduce(groupItems(messages.length), []);
86
- export { ɵ0, ɵ1, ɵ2, ɵ3, ɵ4 };
@@ -0,0 +1,226 @@
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, ContentChild, EventEmitter, HostBinding, Input, isDevMode, Output, ViewChild } from '@angular/core';
6
+ import { AttachmentTemplateDirective } from './attachment-template.directive';
7
+ import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
8
+ import { makeHandler } from './builtin-actions';
9
+ import { MessageTemplateDirective } from './message-template.directive';
10
+ import { SendMessageEvent } from '../api';
11
+ import { validatePackage } from '@progress/kendo-licensing';
12
+ import { packageMetadata } from '../package-metadata';
13
+ import * as i0 from "@angular/core";
14
+ import * as i1 from "@progress/kendo-angular-l10n";
15
+ import * as i2 from "./message-list.component";
16
+ import * as i3 from "./l10n/localized-messages.directive";
17
+ import * as i4 from "../common/scroll-anchor.directive";
18
+ import * as i5 from "../common/focused-state.directive";
19
+ import * as i6 from "@progress/kendo-angular-buttons";
20
+ // eslint-disable-next-line max-line-length
21
+ const sendIcon = '<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>';
22
+ /**
23
+ * Represents the Kendo UI Chat component for Angular.
24
+ *
25
+ * {% meta height:700 %}
26
+ * {% embed_file echo/app.component.ts preview %}
27
+ * {% embed_file shared/app.module.ts %}
28
+ * {% embed_file shared/main.ts hidden %}
29
+ * {% endmeta %}
30
+ *
31
+ */
32
+ export class ChatComponent {
33
+ constructor(localization, zone) {
34
+ this.localization = localization;
35
+ this.zone = zone;
36
+ /**
37
+ * Fires when the user types a message and clicks the **Send** button or presses **Enter**.
38
+ * Emits the [`SendMessageEvent`]({% slug api_conversational-ui_sendmessageevent %}).
39
+ *
40
+ * > The message is not automatically appended to the `messages` array.
41
+ */
42
+ this.sendMessage = new EventEmitter();
43
+ /**
44
+ * Fires when the user clicks a quick action button.
45
+ * The Chat internally handles the `reply`, `openUrl`, and `call` [known actions]({% slug api_conversational-ui_actiontype %}).
46
+ *
47
+ * Emits the [`ExecuteActionEvent`]({% slug api_conversational-ui_executeactionevent %}).
48
+ * The event is preventable. If `preventDefault` is called, the built-in action will be suppressed.
49
+ */
50
+ this.executeAction = new EventEmitter();
51
+ /**
52
+ * @hidden
53
+ */
54
+ this.autoScroll = true;
55
+ validatePackage(packageMetadata);
56
+ this.direction = localization.rtl ? 'rtl' : 'ltr';
57
+ this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
58
+ this.direction = rtl ? 'rtl' : 'ltr';
59
+ });
60
+ }
61
+ get className() {
62
+ return 'k-widget k-chat';
63
+ }
64
+ get dirAttr() {
65
+ return this.direction;
66
+ }
67
+ ngOnChanges() {
68
+ this.zone.runOutsideAngular(() => setTimeout(() => {
69
+ this.messageList.nativeElement.style.flex = '1 1 auto';
70
+ }));
71
+ }
72
+ ngAfterViewInit() {
73
+ if (!isDevMode()) {
74
+ return;
75
+ }
76
+ if (!this.user) {
77
+ throw new Error('User must be set and have a valid id.');
78
+ }
79
+ }
80
+ ngOnDestroy() {
81
+ if (this.localizationChangeSubscription) {
82
+ this.localizationChangeSubscription.unsubscribe();
83
+ }
84
+ }
85
+ /**
86
+ * @hidden
87
+ */
88
+ sendClick() {
89
+ const input = this.messageInput.nativeElement;
90
+ const value = input.value;
91
+ if (!value) {
92
+ return;
93
+ }
94
+ const message = {
95
+ author: this.user,
96
+ text: value,
97
+ timestamp: new Date()
98
+ };
99
+ this.sendMessage.emit(new SendMessageEvent(message));
100
+ input.value = null;
101
+ input.focus();
102
+ this.autoScroll = true;
103
+ }
104
+ /**
105
+ * @hidden
106
+ */
107
+ inputKeydown(e) {
108
+ if (e.keyCode === 13 /* enter */) {
109
+ this.sendClick();
110
+ }
111
+ }
112
+ /**
113
+ * @hidden
114
+ */
115
+ dispatchAction(e) {
116
+ this.executeAction.emit(e);
117
+ if (!e.isDefaultPrevented()) {
118
+ const handler = makeHandler(e.action);
119
+ handler(e.action, this);
120
+ this.messageInput.nativeElement.focus();
121
+ }
122
+ }
123
+ /**
124
+ * @hidden
125
+ */
126
+ textFor(key) {
127
+ return this.localization.get(key);
128
+ }
129
+ }
130
+ ChatComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatComponent, deps: [{ token: i1.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
131
+ ChatComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ChatComponent, selector: "kendo-chat", inputs: { messages: "messages", user: "user" }, outputs: { sendMessage: "sendMessage", executeAction: "executeAction" }, host: { properties: { "class": "this.className", "attr.dir": "this.dirAttr" } }, providers: [
132
+ LocalizationService,
133
+ {
134
+ provide: L10N_PREFIX,
135
+ useValue: 'kendo.chat'
136
+ }
137
+ ], queries: [{ propertyName: "attachmentTemplate", first: true, predicate: AttachmentTemplateDirective, descendants: true }, { propertyName: "messageTemplate", first: true, predicate: MessageTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "messageInput", first: true, predicate: ["messageInput"], descendants: true, static: true }, { propertyName: "messageList", first: true, predicate: ["messageList"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "\n <ng-container\n kendoChatLocalizedMessages\n i18n-messagePlaceholder=\"kendo.chat.messagePlaceholder|The placholder text of the message text input\"\n messagePlaceholder=\"Type a message...\"\n\n i18n-send=\"kendo.chat.send|The text for the Send button\"\n send=\"Send...\"\n >\n </ng-container>\n\n <div\n #messageList\n class=\"k-message-list k-avatars\"\n aria-live=\"polite\" role=\"log\"\n kendoChatScrollAnchor\n #anchor=\"scrollAnchor\"\n [(autoScroll)]=\"autoScroll\"\n >\n <kendo-chat-message-list\n [messages]=\"messages\"\n [messageTemplate]=\"messageTemplate\"\n [attachmentTemplate]=\"attachmentTemplate\"\n [user]=\"user\"\n (executeAction)=\"dispatchAction($event)\"\n (resize)=\"anchor.scrollToBottom()\"\n (navigate)=\"this.autoScroll = false\"\n >\n </kendo-chat-message-list>\n </div>\n\n <div class=\"k-message-box\">\n <input\n #messageInput\n kendoChatFocusedState\n type=\"text\"\n class=\"k-input\"\n [placeholder]=\"textFor('messagePlaceholder')\"\n (keydown)=\"inputKeydown($event)\"\n >\n <button\n kendoButton\n fillMode=\"flat\"\n class=\"k-button-send\"\n tabindex=\"-1\"\n [attr.title]=\"textFor('send')\"\n (click)=\"sendClick()\"\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></button>\n </div>\n ", isInline: true, components: [{ type: i2.MessageListComponent, selector: "kendo-chat-message-list", inputs: ["messages", "attachmentTemplate", "messageTemplate", "user"], outputs: ["executeAction", "navigate", "resize"] }], directives: [{ type: i3.LocalizedMessagesDirective, selector: "[kendoChatLocalizedMessages]" }, { type: i4.ScrollAnchorDirective, selector: "[kendoChatScrollAnchor]", inputs: ["autoScroll"], outputs: ["autoScrollChange"], exportAs: ["scrollAnchor"] }, { type: i5.FocusedStateDirective, selector: "[kendoChatFocusedState]" }, { type: i6.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "shape", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
138
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatComponent, decorators: [{
139
+ type: Component,
140
+ args: [{
141
+ providers: [
142
+ LocalizationService,
143
+ {
144
+ provide: L10N_PREFIX,
145
+ useValue: 'kendo.chat'
146
+ }
147
+ ],
148
+ selector: 'kendo-chat',
149
+ template: `
150
+ <ng-container
151
+ kendoChatLocalizedMessages
152
+ i18n-messagePlaceholder="kendo.chat.messagePlaceholder|The placholder text of the message text input"
153
+ messagePlaceholder="Type a message..."
154
+
155
+ i18n-send="kendo.chat.send|The text for the Send button"
156
+ send="Send..."
157
+ >
158
+ </ng-container>
159
+
160
+ <div
161
+ #messageList
162
+ class="k-message-list k-avatars"
163
+ aria-live="polite" role="log"
164
+ kendoChatScrollAnchor
165
+ #anchor="scrollAnchor"
166
+ [(autoScroll)]="autoScroll"
167
+ >
168
+ <kendo-chat-message-list
169
+ [messages]="messages"
170
+ [messageTemplate]="messageTemplate"
171
+ [attachmentTemplate]="attachmentTemplate"
172
+ [user]="user"
173
+ (executeAction)="dispatchAction($event)"
174
+ (resize)="anchor.scrollToBottom()"
175
+ (navigate)="this.autoScroll = false"
176
+ >
177
+ </kendo-chat-message-list>
178
+ </div>
179
+
180
+ <div class="k-message-box">
181
+ <input
182
+ #messageInput
183
+ kendoChatFocusedState
184
+ type="text"
185
+ class="k-input"
186
+ [placeholder]="textFor('messagePlaceholder')"
187
+ (keydown)="inputKeydown($event)"
188
+ >
189
+ <button
190
+ kendoButton
191
+ fillMode="flat"
192
+ class="k-button-send"
193
+ tabindex="-1"
194
+ [attr.title]="textFor('send')"
195
+ (click)="sendClick()"
196
+ >${sendIcon}</button>
197
+ </div>
198
+ `
199
+ }]
200
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { messages: [{
201
+ type: Input
202
+ }], user: [{
203
+ type: Input
204
+ }], sendMessage: [{
205
+ type: Output
206
+ }], executeAction: [{
207
+ type: Output
208
+ }], className: [{
209
+ type: HostBinding,
210
+ args: ['class']
211
+ }], dirAttr: [{
212
+ type: HostBinding,
213
+ args: ['attr.dir']
214
+ }], attachmentTemplate: [{
215
+ type: ContentChild,
216
+ args: [AttachmentTemplateDirective, { static: false }]
217
+ }], messageTemplate: [{
218
+ type: ContentChild,
219
+ args: [MessageTemplateDirective, { static: false }]
220
+ }], messageInput: [{
221
+ type: ViewChild,
222
+ args: ['messageInput', { static: true }]
223
+ }], messageList: [{
224
+ type: ViewChild,
225
+ args: ['messageList', { static: true }]
226
+ }] } });
File without changes
@@ -2,7 +2,6 @@
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
5
  import { AttachmentComponent } from './attachment.component';
7
6
  import { AttachmentTemplateDirective, ChatComponent, MessageTemplateDirective } from './chat.directives';
8
7
  import { ButtonModule } from '@progress/kendo-angular-buttons';
@@ -18,6 +17,7 @@ import { MessageListComponent } from './message-list.component';
18
17
  import { NgModule } from '@angular/core';
19
18
  import { ScrollAnchorDirective } from '../common/scroll-anchor.directive';
20
19
  import { SuggestedActionsComponent } from './suggested-actions.component';
20
+ import * as i0 from "@angular/core";
21
21
  const PUBLIC_DIRECTIVES = [
22
22
  ChatComponent,
23
23
  CustomMessagesComponent,
@@ -57,20 +57,45 @@ const PRIVATE_DIRECTIVES = [
57
57
  * export class AppModule { }
58
58
  * ```
59
59
  */
60
- let ChatModule = class ChatModule {
61
- };
62
- ChatModule = tslib_1.__decorate([
63
- NgModule({
64
- declarations: [
65
- ...PUBLIC_DIRECTIVES,
66
- ...PRIVATE_DIRECTIVES
67
- ],
68
- exports: [PUBLIC_DIRECTIVES],
69
- imports: [
60
+ export class ChatModule {
61
+ }
62
+ ChatModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
63
+ ChatModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatModule, declarations: [ChatComponent,
64
+ CustomMessagesComponent,
65
+ AttachmentTemplateDirective,
66
+ MessageTemplateDirective,
67
+ HeroCardComponent, AttachmentComponent,
68
+ FocusedStateDirective,
69
+ LocalizedMessagesDirective,
70
+ MessageAttachmentsComponent,
71
+ MessageComponent,
72
+ MessageListComponent,
73
+ MessageTemplateDirective,
74
+ ScrollAnchorDirective,
75
+ SuggestedActionsComponent], imports: [ButtonModule,
76
+ CommonModule,
77
+ ResizeSensorModule], exports: [ChatComponent,
78
+ CustomMessagesComponent,
79
+ AttachmentTemplateDirective,
80
+ MessageTemplateDirective,
81
+ HeroCardComponent] });
82
+ ChatModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatModule, imports: [[
70
83
  ButtonModule,
71
84
  CommonModule,
72
85
  ResizeSensorModule
73
- ]
74
- })
75
- ], ChatModule);
76
- export { ChatModule };
86
+ ]] });
87
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ChatModule, decorators: [{
88
+ type: NgModule,
89
+ args: [{
90
+ declarations: [
91
+ ...PUBLIC_DIRECTIVES,
92
+ ...PRIVATE_DIRECTIVES
93
+ ],
94
+ exports: [PUBLIC_DIRECTIVES],
95
+ imports: [
96
+ ButtonModule,
97
+ CommonModule,
98
+ ResizeSensorModule
99
+ ]
100
+ }]
101
+ }] });
@@ -0,0 +1,42 @@
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 } 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
+ * Custom component messages override default component messages
12
+ * ([see example]({% slug globalization_chat %}#toc-custom-messages)).
13
+ */
14
+ export class CustomMessagesComponent extends Messages {
15
+ constructor(service) {
16
+ super();
17
+ this.service = service;
18
+ }
19
+ get override() {
20
+ return true;
21
+ }
22
+ }
23
+ CustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
24
+ CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CustomMessagesComponent, selector: "kendo-chat-messages", providers: [
25
+ {
26
+ provide: Messages,
27
+ useExisting: forwardRef(() => CustomMessagesComponent)
28
+ }
29
+ ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
30
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, decorators: [{
31
+ type: Component,
32
+ args: [{
33
+ providers: [
34
+ {
35
+ provide: Messages,
36
+ useExisting: forwardRef(() => CustomMessagesComponent)
37
+ }
38
+ ],
39
+ selector: 'kendo-chat-messages',
40
+ template: ``
41
+ }]
42
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; } });