@progress/kendo-angular-conversational-ui 4.0.1-dev.202202251354 → 5.0.0-next.202203021124

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
@@ -1,92 +0,0 @@
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 { isDevMode } from '@angular/core';
6
- /**
7
- * @hidden
8
- */
9
- export var isAuthor = function (user, msg) {
10
- return user && msg.author && user.id === msg.author.id;
11
- };
12
- var last = function (arr) { return arr[arr.length - 1]; };
13
- var ɵ0 = last;
14
- var dateChanged = function (curr, prev) {
15
- return (curr && prev) && (prev.getDate() !== curr.getDate() ||
16
- prev.getMonth() !== curr.getMonth() ||
17
- prev.getFullYear() !== curr.getFullYear());
18
- };
19
- var ɵ1 = dateChanged;
20
- var addDateMarker = function (acc, msg) {
21
- var timestamp = msg.timestamp;
22
- var lastItem = last(acc);
23
- if (!timestamp) {
24
- return;
25
- }
26
- if (!lastItem || dateChanged(timestamp, lastItem.timestamp)) {
27
- var dateMarker = {
28
- type: 'date-marker',
29
- timestamp: timestamp,
30
- trackBy: timestamp.getTime()
31
- };
32
- acc.push(dateMarker);
33
- }
34
- };
35
- var ɵ2 = addDateMarker;
36
- var groupMessages = function (acc, msg, isLastMessage) {
37
- var lastItem = last(acc);
38
- var messages;
39
- if (isDevMode() && !msg.author) {
40
- throw new Error('Author must be set for message: ' + JSON.stringify(msg));
41
- }
42
- if (msg.typing && !isLastMessage) {
43
- return;
44
- }
45
- if (lastItem && lastItem.type === 'message-group') {
46
- messages = lastItem.messages;
47
- }
48
- if (messages && isAuthor(msg.author, last(messages))) {
49
- messages.push(msg);
50
- }
51
- else {
52
- acc.push({
53
- type: 'message-group',
54
- messages: [msg],
55
- author: msg.author,
56
- timestamp: msg.timestamp,
57
- trackBy: msg
58
- });
59
- }
60
- };
61
- var ɵ3 = groupMessages;
62
- var groupItems = function (total) { return function (acc, msg, index) {
63
- var isLastMessage = index === total - 1;
64
- addDateMarker(acc, msg);
65
- groupMessages(acc, msg, isLastMessage);
66
- if (msg.attachments && msg.attachments.length > 1) {
67
- acc.push({
68
- type: 'attachment-group',
69
- attachments: msg.attachments,
70
- attachmentLayout: msg.attachmentLayout,
71
- timestamp: msg.timestamp,
72
- trackBy: msg
73
- });
74
- }
75
- if (msg.suggestedActions && isLastMessage) {
76
- acc.push({
77
- type: 'action-group',
78
- actions: msg.suggestedActions,
79
- timestamp: msg.timestamp,
80
- trackBy: msg
81
- });
82
- }
83
- return acc;
84
- }; };
85
- var ɵ4 = groupItems;
86
- /**
87
- * @hidden
88
- */
89
- export var chatView = function (messages) {
90
- return messages.reduce(groupItems(messages.length), []);
91
- };
92
- export { ɵ0, ɵ1, ɵ2, ɵ3, ɵ4 };
@@ -1,193 +0,0 @@
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 * as tslib_1 from "tslib";
6
- import { Component, ContentChild, ElementRef, EventEmitter, HostBinding, Input, isDevMode, Output, ViewChild, NgZone } from '@angular/core';
7
- import { AttachmentTemplateDirective } from './attachment-template.directive';
8
- import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
9
- import { makeHandler } from './builtin-actions';
10
- import { MessageTemplateDirective } from './message-template.directive';
11
- import { SendMessageEvent } from '../api/post-message-event';
12
- import { validatePackage } from '@progress/kendo-licensing';
13
- import { packageMetadata } from '../package-metadata';
14
- // tslint:disable-next-line:max-line-length
15
- var 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>';
16
- /**
17
- * Represents the Kendo UI Chat component for Angular.
18
- *
19
- * {% meta height:700 %}
20
- * {% embed_file echo/app.component.ts preview %}
21
- * {% embed_file shared/app.module.ts %}
22
- * {% embed_file shared/main.ts hidden %}
23
- * {% endmeta %}
24
- *
25
- */
26
- var ChatComponent = /** @class */ (function () {
27
- function ChatComponent(localization, zone) {
28
- var _this = this;
29
- this.localization = localization;
30
- this.zone = zone;
31
- /**
32
- * Fires when the user types a message and clicks the **Send** button or presses **Enter**.
33
- * Emits the [`SendMessageEvent`]({% slug api_conversational-ui_sendmessageevent %}).
34
- *
35
- * > The message is not automatically appended to the `messages` array.
36
- */
37
- this.sendMessage = new EventEmitter();
38
- /**
39
- * Fires when the user clicks a quick action button.
40
- * The Chat internally handles the `reply`, `openUrl`, and `call` [known actions]({% slug api_conversational-ui_actiontype %}).
41
- *
42
- * Emits the [`ExecuteActionEvent`]({% slug api_conversational-ui_executeactionevent %}).
43
- * The event is preventable. If `preventDefault` is called, the built-in action will be suppressed.
44
- */
45
- this.executeAction = new EventEmitter();
46
- /**
47
- * @hidden
48
- */
49
- this.autoScroll = true;
50
- validatePackage(packageMetadata);
51
- this.direction = localization.rtl ? 'rtl' : 'ltr';
52
- this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
53
- var rtl = _a.rtl;
54
- _this.direction = rtl ? 'rtl' : 'ltr';
55
- });
56
- }
57
- Object.defineProperty(ChatComponent.prototype, "className", {
58
- get: function () {
59
- return 'k-widget k-chat';
60
- },
61
- enumerable: true,
62
- configurable: true
63
- });
64
- Object.defineProperty(ChatComponent.prototype, "dirAttr", {
65
- get: function () {
66
- return this.direction;
67
- },
68
- enumerable: true,
69
- configurable: true
70
- });
71
- ChatComponent.prototype.ngOnChanges = function () {
72
- var _this = this;
73
- this.zone.runOutsideAngular(function () { return setTimeout(function () {
74
- _this.messageList.nativeElement.style.flex = '1 1 auto';
75
- }); });
76
- };
77
- ChatComponent.prototype.ngAfterViewInit = function () {
78
- if (!isDevMode()) {
79
- return;
80
- }
81
- if (!this.user) {
82
- throw new Error('User must be set and have a valid id.');
83
- }
84
- };
85
- ChatComponent.prototype.ngOnDestroy = function () {
86
- if (this.localizationChangeSubscription) {
87
- this.localizationChangeSubscription.unsubscribe();
88
- }
89
- };
90
- /**
91
- * @hidden
92
- */
93
- ChatComponent.prototype.sendClick = function () {
94
- var input = this.messageInput.nativeElement;
95
- var value = input.value;
96
- if (!value) {
97
- return;
98
- }
99
- var message = {
100
- author: this.user,
101
- text: value,
102
- timestamp: new Date()
103
- };
104
- this.sendMessage.emit(new SendMessageEvent(message));
105
- input.value = null;
106
- input.focus();
107
- this.autoScroll = true;
108
- };
109
- /**
110
- * @hidden
111
- */
112
- ChatComponent.prototype.inputKeydown = function (e) {
113
- if (e.keyCode === 13 /* enter */) {
114
- this.sendClick();
115
- }
116
- };
117
- /**
118
- * @hidden
119
- */
120
- ChatComponent.prototype.dispatchAction = function (e) {
121
- this.executeAction.emit(e);
122
- if (!e.isDefaultPrevented()) {
123
- var handler = makeHandler(e.action);
124
- handler(e.action, this);
125
- this.messageInput.nativeElement.focus();
126
- }
127
- };
128
- /**
129
- * @hidden
130
- */
131
- ChatComponent.prototype.textFor = function (key) {
132
- return this.localization.get(key);
133
- };
134
- tslib_1.__decorate([
135
- Input(),
136
- tslib_1.__metadata("design:type", Array)
137
- ], ChatComponent.prototype, "messages", void 0);
138
- tslib_1.__decorate([
139
- Input(),
140
- tslib_1.__metadata("design:type", Object)
141
- ], ChatComponent.prototype, "user", void 0);
142
- tslib_1.__decorate([
143
- Output(),
144
- tslib_1.__metadata("design:type", EventEmitter)
145
- ], ChatComponent.prototype, "sendMessage", void 0);
146
- tslib_1.__decorate([
147
- Output(),
148
- tslib_1.__metadata("design:type", EventEmitter)
149
- ], ChatComponent.prototype, "executeAction", void 0);
150
- tslib_1.__decorate([
151
- HostBinding('class'),
152
- tslib_1.__metadata("design:type", String),
153
- tslib_1.__metadata("design:paramtypes", [])
154
- ], ChatComponent.prototype, "className", null);
155
- tslib_1.__decorate([
156
- HostBinding('attr.dir'),
157
- tslib_1.__metadata("design:type", String),
158
- tslib_1.__metadata("design:paramtypes", [])
159
- ], ChatComponent.prototype, "dirAttr", null);
160
- tslib_1.__decorate([
161
- ContentChild(AttachmentTemplateDirective, { static: false }),
162
- tslib_1.__metadata("design:type", AttachmentTemplateDirective)
163
- ], ChatComponent.prototype, "attachmentTemplate", void 0);
164
- tslib_1.__decorate([
165
- ContentChild(MessageTemplateDirective, { static: false }),
166
- tslib_1.__metadata("design:type", MessageTemplateDirective)
167
- ], ChatComponent.prototype, "messageTemplate", void 0);
168
- tslib_1.__decorate([
169
- ViewChild('messageInput', { static: true }),
170
- tslib_1.__metadata("design:type", ElementRef)
171
- ], ChatComponent.prototype, "messageInput", void 0);
172
- tslib_1.__decorate([
173
- ViewChild('messageList', { static: true }),
174
- tslib_1.__metadata("design:type", ElementRef)
175
- ], ChatComponent.prototype, "messageList", void 0);
176
- ChatComponent = tslib_1.__decorate([
177
- Component({
178
- providers: [
179
- LocalizationService,
180
- {
181
- provide: L10N_PREFIX,
182
- useValue: 'kendo.chat'
183
- }
184
- ],
185
- selector: 'kendo-chat',
186
- 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 >" + sendIcon + "</button>\n </div>\n "
187
- }),
188
- tslib_1.__metadata("design:paramtypes", [LocalizationService,
189
- NgZone])
190
- ], ChatComponent);
191
- return ChatComponent;
192
- }());
193
- export { ChatComponent };
@@ -1,76 +0,0 @@
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 * as tslib_1 from "tslib";
6
- import { AttachmentComponent } from './attachment.component';
7
- import { AttachmentTemplateDirective, ChatComponent, MessageTemplateDirective } from './chat.directives';
8
- import { ButtonModule } from '@progress/kendo-angular-buttons';
9
- import { CommonModule } from '@angular/common';
10
- import { ResizeSensorModule } from '@progress/kendo-angular-common';
11
- import { CustomMessagesComponent } from './l10n/custom-messages.component';
12
- import { FocusedStateDirective } from '../common/focused-state.directive';
13
- import { HeroCardComponent } from '../cards/hero-card.component';
14
- import { LocalizedMessagesDirective } from './l10n/localized-messages.directive';
15
- import { MessageAttachmentsComponent } from './message-attachments.component';
16
- import { MessageComponent } from './message.component';
17
- import { MessageListComponent } from './message-list.component';
18
- import { NgModule } from '@angular/core';
19
- import { ScrollAnchorDirective } from '../common/scroll-anchor.directive';
20
- import { SuggestedActionsComponent } from './suggested-actions.component';
21
- var PUBLIC_DIRECTIVES = [
22
- ChatComponent,
23
- CustomMessagesComponent,
24
- AttachmentTemplateDirective,
25
- MessageTemplateDirective,
26
- HeroCardComponent
27
- ];
28
- var PRIVATE_DIRECTIVES = [
29
- AttachmentComponent,
30
- FocusedStateDirective,
31
- LocalizedMessagesDirective,
32
- MessageAttachmentsComponent,
33
- MessageComponent,
34
- MessageListComponent,
35
- MessageTemplateDirective,
36
- ScrollAnchorDirective,
37
- SuggestedActionsComponent
38
- ];
39
- /**
40
- * The [NgModule]({{ site.data.urls.angular['ngmodules'] }}) for the Chat component.
41
- *
42
- * @example
43
- * ```ts-no-run
44
- * import { NgModule } from '@angular/core';
45
- * import { Component } from '@angular/core';
46
- * import { BrowserModule } from '@angular/platform-browser';
47
- *
48
- * import { ChatModule } from '@progress/kendo-angular-conversational-ui';
49
- * import { AppComponent } from './app.component';
50
- *
51
- * _@NgModule({
52
- * imports: [ BrowserModule, ChatModule ],
53
- * declarations: [ AppComponent ],
54
- * bootstrap: [ AppComponent ]
55
- * })
56
- *
57
- * export class AppModule { }
58
- * ```
59
- */
60
- var ChatModule = /** @class */ (function () {
61
- function ChatModule() {
62
- }
63
- ChatModule = tslib_1.__decorate([
64
- NgModule({
65
- declarations: PUBLIC_DIRECTIVES.concat(PRIVATE_DIRECTIVES),
66
- exports: [PUBLIC_DIRECTIVES],
67
- imports: [
68
- ButtonModule,
69
- CommonModule,
70
- ResizeSensorModule
71
- ]
72
- })
73
- ], ChatModule);
74
- return ChatModule;
75
- }());
76
- export { ChatModule };
@@ -1,45 +0,0 @@
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 * as tslib_1 from "tslib";
6
- import { Component, forwardRef } from '@angular/core';
7
- import { LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { Messages } from './messages';
9
- // tslint:disable:no-forward-ref
10
- /**
11
- * Custom component messages override default component messages
12
- * ([see example]({% slug globalization_chat %}#toc-custom-messages)).
13
- */
14
- var CustomMessagesComponent = /** @class */ (function (_super) {
15
- tslib_1.__extends(CustomMessagesComponent, _super);
16
- function CustomMessagesComponent(service) {
17
- var _this = _super.call(this) || this;
18
- _this.service = service;
19
- return _this;
20
- }
21
- CustomMessagesComponent_1 = CustomMessagesComponent;
22
- Object.defineProperty(CustomMessagesComponent.prototype, "override", {
23
- get: function () {
24
- return true;
25
- },
26
- enumerable: true,
27
- configurable: true
28
- });
29
- var CustomMessagesComponent_1;
30
- CustomMessagesComponent = CustomMessagesComponent_1 = tslib_1.__decorate([
31
- Component({
32
- providers: [
33
- {
34
- provide: Messages,
35
- useExisting: forwardRef(function () { return CustomMessagesComponent_1; })
36
- }
37
- ],
38
- selector: 'kendo-chat-messages',
39
- template: ""
40
- }),
41
- tslib_1.__metadata("design:paramtypes", [LocalizationService])
42
- ], CustomMessagesComponent);
43
- return CustomMessagesComponent;
44
- }(Messages));
45
- export { CustomMessagesComponent };
@@ -1,36 +0,0 @@
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 * as tslib_1 from "tslib";
6
- import { Directive, forwardRef } from '@angular/core';
7
- import { LocalizationService } from '@progress/kendo-angular-l10n';
8
- import { Messages } from './messages';
9
- // tslint:disable:no-forward-ref
10
- /**
11
- * @hidden
12
- */
13
- var LocalizedMessagesDirective = /** @class */ (function (_super) {
14
- tslib_1.__extends(LocalizedMessagesDirective, _super);
15
- function LocalizedMessagesDirective(service) {
16
- var _this = _super.call(this) || this;
17
- _this.service = service;
18
- return _this;
19
- }
20
- LocalizedMessagesDirective_1 = LocalizedMessagesDirective;
21
- var LocalizedMessagesDirective_1;
22
- LocalizedMessagesDirective = LocalizedMessagesDirective_1 = tslib_1.__decorate([
23
- Directive({
24
- providers: [
25
- {
26
- provide: Messages,
27
- useExisting: forwardRef(function () { return LocalizedMessagesDirective_1; })
28
- }
29
- ],
30
- selector: '[kendoChatLocalizedMessages]'
31
- }),
32
- tslib_1.__metadata("design:paramtypes", [LocalizationService])
33
- ], LocalizedMessagesDirective);
34
- return LocalizedMessagesDirective;
35
- }(Messages));
36
- export { LocalizedMessagesDirective };
@@ -1,26 +0,0 @@
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 * as tslib_1 from "tslib";
6
- import { Input } from '@angular/core';
7
- import { ComponentMessages } from '@progress/kendo-angular-l10n';
8
- /**
9
- * @hidden
10
- */
11
- var Messages = /** @class */ (function (_super) {
12
- tslib_1.__extends(Messages, _super);
13
- function Messages() {
14
- return _super !== null && _super.apply(this, arguments) || this;
15
- }
16
- tslib_1.__decorate([
17
- Input(),
18
- tslib_1.__metadata("design:type", String)
19
- ], Messages.prototype, "messagePlaceholder", void 0);
20
- tslib_1.__decorate([
21
- Input(),
22
- tslib_1.__metadata("design:type", String)
23
- ], Messages.prototype, "send", void 0);
24
- return Messages;
25
- }(ComponentMessages));
26
- export { Messages };
@@ -1,148 +0,0 @@
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 * as tslib_1 from "tslib";
6
- import { Component, ElementRef, forwardRef, HostBinding, Input, NgZone, QueryList, ViewChild, ViewChildren } from '@angular/core';
7
- import { fromEvent } from 'rxjs';
8
- import { debounceTime } from 'rxjs/operators';
9
- import { ChatItem } from './chat-item';
10
- import { AttachmentTemplateDirective } from './chat.directives';
11
- // tslint:disable:no-forward-ref
12
- /**
13
- * @hidden
14
- */
15
- var MessageAttachmentsComponent = /** @class */ (function (_super) {
16
- tslib_1.__extends(MessageAttachmentsComponent, _super);
17
- function MessageAttachmentsComponent(zone) {
18
- var _a, _b;
19
- var _this = _super.call(this) || this;
20
- _this.zone = zone;
21
- _this.scrollPosition = 0;
22
- _this.selectedIndex = 0;
23
- _this.carouselKeyHandlers = (_a = {},
24
- _a[37 /* left */] = function (e) { return _this.navigateTo(e, -1); },
25
- _a[39 /* right */] = function (e) { return _this.navigateTo(e, 1); },
26
- _a);
27
- _this.listKeyHandlers = (_b = {},
28
- _b[38 /* up */] = function (e) { return _this.navigateTo(e, -1); },
29
- _b[40 /* down */] = function (e) { return _this.navigateTo(e, 1); },
30
- _b);
31
- return _this;
32
- }
33
- MessageAttachmentsComponent_1 = MessageAttachmentsComponent;
34
- Object.defineProperty(MessageAttachmentsComponent.prototype, "carousel", {
35
- get: function () {
36
- return this.layout !== 'list';
37
- },
38
- enumerable: true,
39
- configurable: true
40
- });
41
- MessageAttachmentsComponent.prototype.ngAfterViewInit = function () {
42
- var _this = this;
43
- this.zone.runOutsideAngular(function () {
44
- var scrollDebounceTime = 100;
45
- _this.scrollSubscription = fromEvent(_this.deck.nativeElement, 'scroll')
46
- .pipe(debounceTime(scrollDebounceTime))
47
- .subscribe(function () { return _this.onScroll(); });
48
- });
49
- };
50
- MessageAttachmentsComponent.prototype.ngOnDestroy = function () {
51
- this.scrollSubscription.unsubscribe();
52
- };
53
- MessageAttachmentsComponent.prototype.isSelected = function (index) {
54
- return this.selectedIndex === index;
55
- };
56
- MessageAttachmentsComponent.prototype.itemKeydown = function (e, attachment) {
57
- var keyHandlers = this.layout === 'list' ?
58
- this.listKeyHandlers : this.carouselKeyHandlers;
59
- var handler = keyHandlers[e.keyCode];
60
- if (handler) {
61
- handler(e, attachment);
62
- }
63
- };
64
- MessageAttachmentsComponent.prototype.itemClick = function (index) {
65
- this.select(index);
66
- };
67
- MessageAttachmentsComponent.prototype.focus = function () {
68
- this.select(this.selectedIndex);
69
- };
70
- MessageAttachmentsComponent.prototype.scrollTo = function (dir) {
71
- var el = this.deck.nativeElement;
72
- var scrollStep = el.scrollWidth / this.items.length;
73
- var max = el.scrollWidth - el.offsetWidth;
74
- var pos = el.scrollLeft + scrollStep * dir;
75
- el.scrollLeft = Math.max(0, Math.min(max, pos));
76
- };
77
- MessageAttachmentsComponent.prototype.select = function (index) {
78
- this.selectedIndex = index;
79
- var item = this.items.toArray()[index];
80
- if (item) {
81
- item.nativeElement.focus();
82
- }
83
- };
84
- MessageAttachmentsComponent.prototype.navigateTo = function (e, offset) {
85
- var prevIndex = this.selectedIndex;
86
- var nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
87
- if (nextIndex !== prevIndex) {
88
- this.select(nextIndex);
89
- e.preventDefault();
90
- }
91
- };
92
- MessageAttachmentsComponent.prototype.onScroll = function () {
93
- var _this = this;
94
- var el = this.deck.nativeElement;
95
- if (el.scrollWidth === 0) {
96
- return;
97
- }
98
- var pos = el.scrollLeft / (el.scrollWidth - el.offsetWidth);
99
- if (pos !== this.scrollPosition) {
100
- this.zone.run(function () {
101
- _this.scrollPosition = pos;
102
- });
103
- }
104
- };
105
- var MessageAttachmentsComponent_1;
106
- tslib_1.__decorate([
107
- Input(),
108
- tslib_1.__metadata("design:type", Array)
109
- ], MessageAttachmentsComponent.prototype, "attachments", void 0);
110
- tslib_1.__decorate([
111
- Input(),
112
- tslib_1.__metadata("design:type", String)
113
- ], MessageAttachmentsComponent.prototype, "layout", void 0);
114
- tslib_1.__decorate([
115
- Input(),
116
- tslib_1.__metadata("design:type", Boolean)
117
- ], MessageAttachmentsComponent.prototype, "tabbable", void 0);
118
- tslib_1.__decorate([
119
- Input(),
120
- tslib_1.__metadata("design:type", AttachmentTemplateDirective)
121
- ], MessageAttachmentsComponent.prototype, "template", void 0);
122
- tslib_1.__decorate([
123
- HostBinding('class.k-card-deck-scrollwrap'),
124
- tslib_1.__metadata("design:type", Boolean),
125
- tslib_1.__metadata("design:paramtypes", [])
126
- ], MessageAttachmentsComponent.prototype, "carousel", null);
127
- tslib_1.__decorate([
128
- ViewChild('deck', { read: ElementRef, static: true }),
129
- tslib_1.__metadata("design:type", ElementRef)
130
- ], MessageAttachmentsComponent.prototype, "deck", void 0);
131
- tslib_1.__decorate([
132
- ViewChildren('item', { read: ElementRef }),
133
- tslib_1.__metadata("design:type", QueryList)
134
- ], MessageAttachmentsComponent.prototype, "items", void 0);
135
- MessageAttachmentsComponent = MessageAttachmentsComponent_1 = tslib_1.__decorate([
136
- Component({
137
- providers: [{
138
- provide: ChatItem,
139
- useExisting: forwardRef(function () { return MessageAttachmentsComponent_1; })
140
- }],
141
- selector: 'kendo-chat-message-attachments',
142
- template: "\n <button\n *ngIf=\"carousel && scrollPosition > 0\"\n (click)=\"scrollTo(-1)\"\n class=\"k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base\"\n tabindex=\"-1\">\n <span class=\"k-icon k-button-icon k-i-arrow-chevron-left\"></span>\n </button>\n <div #deck [class.k-card-deck]=\"carousel\">\n <kendo-chat-attachment #item\n *ngFor=\"let att of attachments; index as index; first as first; last as last\"\n [attachment]=\"att\"\n [template]=\"template\"\n [class.k-state-selected]=\"isSelected(index)\"\n [class.k-state-focused]=\"isSelected(index)\"\n [class.k-card-wrap]=\"true\"\n [class.k-first]=\"first\"\n [class.k-last]=\"last\"\n [attr.tabindex]=\"tabbable && isSelected(index) ? '0' : '-1'\"\n (click)=\"itemClick(index)\"\n (keydown)=\"itemKeydown($event, att)\"\n >\n </kendo-chat-attachment>\n </div>\n <button\n *ngIf=\"carousel && scrollPosition < 1\"\n (click)=\"scrollTo(1)\"\n class=\"k-button k-icon-button k-button-md k-rounded-md k-button-solid k-button-solid-base\"\n tabindex=\"-1\">\n <span class=\"k-icon k-button-icon k-i-arrow-chevron-right\"></span>\n </button>\n "
143
- }),
144
- tslib_1.__metadata("design:paramtypes", [NgZone])
145
- ], MessageAttachmentsComponent);
146
- return MessageAttachmentsComponent;
147
- }(ChatItem));
148
- export { MessageAttachmentsComponent };