@progress/kendo-angular-conversational-ui 4.0.2-dev.202203091004 → 5.0.0-next.202203171033

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 +4 -4
  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 +225 -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 +1575 -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,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 };
@@ -1,165 +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, EventEmitter, HostBinding, HostListener, Input, Output, QueryList, ViewChildren } from '@angular/core';
7
- import { ExecuteActionEvent } from '../api/execute-action-event';
8
- import { closest } from '../common/utils';
9
- import { ChatItem } from './chat-item';
10
- import { chatView, isAuthor } from './chat-view';
11
- import { AttachmentTemplateDirective } from './chat.directives';
12
- import { MessageTemplateDirective } from './message-template.directive';
13
- import { IntlService } from '@progress/kendo-angular-intl';
14
- /**
15
- * @hidden
16
- */
17
- var MessageListComponent = /** @class */ (function () {
18
- function MessageListComponent(element, intl) {
19
- var _this = this;
20
- var _a;
21
- this.element = element;
22
- this.intl = intl;
23
- this.executeAction = new EventEmitter();
24
- this.navigate = new EventEmitter();
25
- this.resize = new EventEmitter();
26
- this.cssClass = true;
27
- this.view = [];
28
- this.keyActions = (_a = {},
29
- _a[38 /* up */] = function (e) { return _this.navigateTo(e, -1); },
30
- _a[40 /* down */] = function (e) { return _this.navigateTo(e, 1); },
31
- _a);
32
- }
33
- Object.defineProperty(MessageListComponent.prototype, "messages", {
34
- get: function () {
35
- return this._messages;
36
- },
37
- set: function (value) {
38
- var data = value || [];
39
- this.view = chatView(data);
40
- this._messages = data;
41
- },
42
- enumerable: true,
43
- configurable: true
44
- });
45
- MessageListComponent.prototype.ngAfterViewInit = function () {
46
- this.selectedItem = this.items.last;
47
- };
48
- MessageListComponent.prototype.onResize = function () {
49
- this.resize.emit();
50
- };
51
- MessageListComponent.prototype.formatTimeStamp = function (date) {
52
- return this.intl.formatDate(date, { date: 'full' });
53
- };
54
- MessageListComponent.prototype.onKeydown = function (e) {
55
- var action = this.keyActions[e.keyCode];
56
- if (action) {
57
- action(e);
58
- }
59
- };
60
- MessageListComponent.prototype.onBlur = function (args) {
61
- var _this = this;
62
- var next = args.relatedTarget || document.activeElement;
63
- var outside = !closest(next, function (node) { return node === _this.element.nativeElement; });
64
- if (outside) {
65
- this.select(null);
66
- }
67
- };
68
- MessageListComponent.prototype.isOwnMessage = function (msg) {
69
- return isAuthor(this.user, msg);
70
- };
71
- MessageListComponent.prototype.dispatchAction = function (action, message) {
72
- var args = new ExecuteActionEvent(action, message);
73
- this.executeAction.emit(args);
74
- };
75
- MessageListComponent.prototype.trackGroup = function (_index, item) {
76
- return item.trackBy;
77
- };
78
- MessageListComponent.prototype.select = function (item) {
79
- var prevItem = this.selectedItem;
80
- if (prevItem) {
81
- prevItem.selected = false;
82
- }
83
- if (item) {
84
- item.selected = true;
85
- this.selectedItem = item;
86
- }
87
- };
88
- MessageListComponent.prototype.last = function (items) {
89
- if (!items || items.length === 0) {
90
- return;
91
- }
92
- return items[items.length - 1];
93
- };
94
- MessageListComponent.prototype.navigateTo = function (e, offset) {
95
- var items = this.items.toArray();
96
- var prevItem = this.selectedItem;
97
- var prevIndex = items.indexOf(prevItem);
98
- var nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
99
- var nextItem = items[nextIndex];
100
- if (nextItem !== prevItem) {
101
- this.select(nextItem);
102
- nextItem.focus();
103
- this.navigate.emit();
104
- e.preventDefault();
105
- }
106
- };
107
- tslib_1.__decorate([
108
- Input(),
109
- tslib_1.__metadata("design:type", Array),
110
- tslib_1.__metadata("design:paramtypes", [Array])
111
- ], MessageListComponent.prototype, "messages", null);
112
- tslib_1.__decorate([
113
- Input(),
114
- tslib_1.__metadata("design:type", AttachmentTemplateDirective)
115
- ], MessageListComponent.prototype, "attachmentTemplate", void 0);
116
- tslib_1.__decorate([
117
- Input(),
118
- tslib_1.__metadata("design:type", MessageTemplateDirective)
119
- ], MessageListComponent.prototype, "messageTemplate", void 0);
120
- tslib_1.__decorate([
121
- Input(),
122
- tslib_1.__metadata("design:type", Object)
123
- ], MessageListComponent.prototype, "user", void 0);
124
- tslib_1.__decorate([
125
- Output(),
126
- tslib_1.__metadata("design:type", EventEmitter)
127
- ], MessageListComponent.prototype, "executeAction", void 0);
128
- tslib_1.__decorate([
129
- Output(),
130
- tslib_1.__metadata("design:type", EventEmitter)
131
- ], MessageListComponent.prototype, "navigate", void 0);
132
- tslib_1.__decorate([
133
- Output(),
134
- tslib_1.__metadata("design:type", EventEmitter)
135
- ], MessageListComponent.prototype, "resize", void 0);
136
- tslib_1.__decorate([
137
- ViewChildren(ChatItem),
138
- tslib_1.__metadata("design:type", QueryList)
139
- ], MessageListComponent.prototype, "items", void 0);
140
- tslib_1.__decorate([
141
- HostBinding('class.k-message-list-content'),
142
- tslib_1.__metadata("design:type", Boolean)
143
- ], MessageListComponent.prototype, "cssClass", void 0);
144
- tslib_1.__decorate([
145
- HostListener('keydown', ['$event']),
146
- tslib_1.__metadata("design:type", Function),
147
- tslib_1.__metadata("design:paramtypes", [Object]),
148
- tslib_1.__metadata("design:returntype", void 0)
149
- ], MessageListComponent.prototype, "onKeydown", null);
150
- tslib_1.__decorate([
151
- HostListener('focusout', ['$event']),
152
- tslib_1.__metadata("design:type", Function),
153
- tslib_1.__metadata("design:paramtypes", [FocusEvent]),
154
- tslib_1.__metadata("design:returntype", void 0)
155
- ], MessageListComponent.prototype, "onBlur", null);
156
- MessageListComponent = tslib_1.__decorate([
157
- Component({
158
- selector: 'kendo-chat-message-list',
159
- template: "\n <ng-container *ngFor=\"let group of view; last as lastGroup; trackBy: trackGroup\">\n <ng-container [ngSwitch]=\"group.type\">\n <div\n *ngSwitchCase=\"'date-marker'\"\n class=\"k-timestamp\"\n >\n {{ formatTimeStamp(group.timestamp) }}\n </div>\n <div\n *ngSwitchCase=\"'message-group'\"\n class=\"k-message-group\"\n [class.k-alt]=\"isOwnMessage(group.messages[0])\"\n [class.k-no-avatar]=\"!group.author.avatarUrl\"\n >\n <img\n *ngIf=\"group.author.avatarUrl\"\n [attr.src]=\"group.author.avatarUrl\"\n class=\"k-avatar\"\n />\n <p *ngIf=\"group.author.name\" class=\"k-author\">{{ group.author.name }}</p>\n <ng-container\n *ngFor=\"let msg of group.messages; first as firstMessage; last as lastMessage\"\n >\n <img *ngIf=\"msg.user?.avatarUrl\" [src]=\"msg.user?.avatarUrl\" class=\"k-avatar\">\n <kendo-chat-message #message\n [message]=\"msg\"\n [tabbable]=\"lastGroup && lastMessage\"\n [template]=\"messageTemplate\"\n (click)=\"select(message)\"\n (focus)=\"select(message)\"\n [class.k-only]=\"group.messages.length === 1\"\n [class.k-first]=\"group.messages.length > 1 && firstMessage\"\n [class.k-last]=\"group.messages.length > 1 && lastMessage\"\n >\n </kendo-chat-message>\n\n <kendo-chat-attachment\n *ngIf=\"msg.attachments && msg.attachments.length === 1\"\n [attachment]=\"msg.attachments[0]\"\n [template]=\"attachmentTemplate\"\n >\n </kendo-chat-attachment>\n </ng-container>\n </div>\n\n <kendo-chat-message-attachments #attachments\n *ngSwitchCase=\"'attachment-group'\"\n [attachments]=\"group.attachments\"\n [layout]=\"group.attachmentLayout\"\n [tabbable]=\"lastGroup\"\n [template]=\"attachmentTemplate\"\n (click)=\"select(attachments)\"\n (focus)=\"select(attachments)\"\n >\n </kendo-chat-message-attachments>\n\n <kendo-chat-suggested-actions #actions\n *ngSwitchCase=\"'action-group'\"\n [actions]=\"group.actions\"\n [tabbable]=\"lastGroup\"\n (dispatch)=\"dispatchAction($event, last(group.messages))\"\n (click)=\"select(actions)\"\n (focus)=\"select(actions)\"\n >\n </kendo-chat-suggested-actions>\n </ng-container>\n </ng-container>\n <kendo-resize-sensor (resize)=\"onResize()\">\n </kendo-resize-sensor>\n "
160
- }),
161
- tslib_1.__metadata("design:paramtypes", [ElementRef, IntlService])
162
- ], MessageListComponent);
163
- return MessageListComponent;
164
- }());
165
- export { MessageListComponent };
@@ -1,32 +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, Optional, TemplateRef } from "@angular/core";
7
- /**
8
- * Defines a template that will be used for displaying Chat messages. To define an attachment
9
- * template, nest an `<ng-template>` tag with the `kendoChatMessageTemplate` attribute inside the
10
- * `<kendo-chat>` component. The template context is set to the message instance. For more information,
11
- * refer to the article on [message templates]({% slug message_templates_chat %}).
12
- *
13
- * {% meta height:700 %}
14
- * {% embed_file messages/templates/app.component.ts preview %}
15
- * {% embed_file shared/app.module.ts preview %}
16
- * {% embed_file shared/main.ts hidden %}
17
- * {% endmeta %}
18
- */
19
- var MessageTemplateDirective = /** @class */ (function () {
20
- function MessageTemplateDirective(templateRef) {
21
- this.templateRef = templateRef;
22
- }
23
- MessageTemplateDirective = tslib_1.__decorate([
24
- Directive({
25
- selector: '[kendoChatMessageTemplate]'
26
- }),
27
- tslib_1.__param(0, Optional()),
28
- tslib_1.__metadata("design:paramtypes", [TemplateRef])
29
- ], MessageTemplateDirective);
30
- return MessageTemplateDirective;
31
- }());
32
- export { MessageTemplateDirective };
@@ -1,77 +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 } from '@angular/core';
7
- import { ChatItem } from './chat-item';
8
- import { MessageTemplateDirective } from './message-template.directive';
9
- import { IntlService } from '@progress/kendo-angular-intl';
10
- // tslint:disable:no-forward-ref
11
- /**
12
- * @hidden
13
- */
14
- var MessageComponent = /** @class */ (function (_super) {
15
- tslib_1.__extends(MessageComponent, _super);
16
- function MessageComponent(element, intl) {
17
- var _this = _super.call(this) || this;
18
- _this.element = element;
19
- _this.intl = intl;
20
- _this.cssClass = true;
21
- return _this;
22
- }
23
- MessageComponent_1 = MessageComponent;
24
- Object.defineProperty(MessageComponent.prototype, "tabIndex", {
25
- get: function () {
26
- return this.tabbable ? '0' : '-1';
27
- },
28
- enumerable: true,
29
- configurable: true
30
- });
31
- MessageComponent.prototype.formatTimeStamp = function (date) {
32
- return this.intl.formatDate(date, { datetime: 'short' });
33
- };
34
- MessageComponent.prototype.focus = function () {
35
- this.element.nativeElement.focus();
36
- };
37
- var MessageComponent_1;
38
- tslib_1.__decorate([
39
- Input(),
40
- tslib_1.__metadata("design:type", Object)
41
- ], MessageComponent.prototype, "message", void 0);
42
- tslib_1.__decorate([
43
- Input(),
44
- tslib_1.__metadata("design:type", Boolean)
45
- ], MessageComponent.prototype, "tabbable", void 0);
46
- tslib_1.__decorate([
47
- Input(),
48
- tslib_1.__metadata("design:type", MessageTemplateDirective)
49
- ], MessageComponent.prototype, "template", void 0);
50
- tslib_1.__decorate([
51
- HostBinding('class.k-message'),
52
- tslib_1.__metadata("design:type", Boolean)
53
- ], MessageComponent.prototype, "cssClass", void 0);
54
- tslib_1.__decorate([
55
- HostBinding('class.k-state-selected'),
56
- HostBinding('class.k-state-focused'),
57
- tslib_1.__metadata("design:type", Boolean)
58
- ], MessageComponent.prototype, "selected", void 0);
59
- tslib_1.__decorate([
60
- HostBinding('attr.tabIndex'),
61
- tslib_1.__metadata("design:type", String),
62
- tslib_1.__metadata("design:paramtypes", [])
63
- ], MessageComponent.prototype, "tabIndex", null);
64
- MessageComponent = MessageComponent_1 = tslib_1.__decorate([
65
- Component({
66
- selector: 'kendo-chat-message',
67
- providers: [{
68
- provide: ChatItem,
69
- useExisting: forwardRef(function () { return MessageComponent_1; })
70
- }],
71
- template: "\n <time\n [attr.aria-hidden]=\"!selected\"\n class=\"k-message-time\"\n *ngIf=\"message.timestamp\"\n >\n {{ formatTimeStamp(message.timestamp) }}\n </time>\n\n <ng-container *ngIf=\"!message.typing; else typing\">\n <div class=\"k-bubble\" *ngIf=\"template\">\n <ng-container\n *ngTemplateOutlet=\"template.templateRef; context: { $implicit: message };\"\n >\n </ng-container>\n </div>\n\n <div class=\"k-bubble\" *ngIf=\"!template && message.text\">\n {{message.text}}\n </div>\n </ng-container>\n\n <span\n class=\"k-message-status\"\n *ngIf=\"message.status\"\n >\n {{ message.status }}\n </span>\n\n <ng-template #typing>\n <div class=\"k-bubble\">\n <div class=\"k-typing-indicator\">\n <span></span>\n <span></span>\n <span></span>\n </div>\n </div>\n </ng-template>\n "
72
- }),
73
- tslib_1.__metadata("design:paramtypes", [ElementRef, IntlService])
74
- ], MessageComponent);
75
- return MessageComponent;
76
- }(ChatItem));
77
- export { MessageComponent };
@@ -1,91 +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, EventEmitter, forwardRef, HostBinding, Input, Output, QueryList, ViewChildren } from '@angular/core';
7
- import { ChatItem } from './chat-item';
8
- // tslint:disable:no-forward-ref
9
- /**
10
- * @hidden
11
- */
12
- var SuggestedActionsComponent = /** @class */ (function (_super) {
13
- tslib_1.__extends(SuggestedActionsComponent, _super);
14
- function SuggestedActionsComponent() {
15
- var _a;
16
- var _this = _super !== null && _super.apply(this, arguments) || this;
17
- _this.dispatch = new EventEmitter();
18
- _this.defaultClass = true;
19
- _this.selectedIndex = 0;
20
- _this.keyHandlers = (_a = {},
21
- _a[37 /* left */] = function (e) { return _this.navigateTo(e, -1); },
22
- _a[39 /* right */] = function (e) { return _this.navigateTo(e, 1); },
23
- _a[13 /* enter */] = function (_, action) { return _this.actionClick(action); },
24
- _a);
25
- return _this;
26
- }
27
- SuggestedActionsComponent_1 = SuggestedActionsComponent;
28
- SuggestedActionsComponent.prototype.isSelected = function (index) {
29
- return this.selected && this.selectedIndex === index;
30
- };
31
- SuggestedActionsComponent.prototype.actionClick = function (action) {
32
- this.dispatch.next(action);
33
- };
34
- SuggestedActionsComponent.prototype.actionKeydown = function (e, action) {
35
- var handler = this.keyHandlers[e.keyCode];
36
- if (handler) {
37
- handler(e, action);
38
- }
39
- };
40
- SuggestedActionsComponent.prototype.focus = function () {
41
- this.select(this.selectedIndex);
42
- };
43
- SuggestedActionsComponent.prototype.select = function (index) {
44
- this.selectedIndex = index;
45
- var item = this.items.toArray()[index];
46
- if (item) {
47
- item.nativeElement.focus();
48
- }
49
- };
50
- SuggestedActionsComponent.prototype.navigateTo = function (e, offset) {
51
- var prevIndex = this.selectedIndex;
52
- var nextIndex = Math.max(0, Math.min(prevIndex + offset, this.items.length - 1));
53
- if (nextIndex !== prevIndex) {
54
- this.select(nextIndex);
55
- e.preventDefault();
56
- }
57
- };
58
- var SuggestedActionsComponent_1;
59
- tslib_1.__decorate([
60
- Input(),
61
- tslib_1.__metadata("design:type", Array)
62
- ], SuggestedActionsComponent.prototype, "actions", void 0);
63
- tslib_1.__decorate([
64
- Input(),
65
- tslib_1.__metadata("design:type", Boolean)
66
- ], SuggestedActionsComponent.prototype, "tabbable", void 0);
67
- tslib_1.__decorate([
68
- Output(),
69
- tslib_1.__metadata("design:type", EventEmitter)
70
- ], SuggestedActionsComponent.prototype, "dispatch", void 0);
71
- tslib_1.__decorate([
72
- HostBinding('class.k-quick-replies'),
73
- tslib_1.__metadata("design:type", Boolean)
74
- ], SuggestedActionsComponent.prototype, "defaultClass", void 0);
75
- tslib_1.__decorate([
76
- ViewChildren('item'),
77
- tslib_1.__metadata("design:type", QueryList)
78
- ], SuggestedActionsComponent.prototype, "items", void 0);
79
- SuggestedActionsComponent = SuggestedActionsComponent_1 = tslib_1.__decorate([
80
- Component({
81
- selector: 'kendo-chat-suggested-actions',
82
- providers: [{
83
- provide: ChatItem,
84
- useExisting: forwardRef(function () { return SuggestedActionsComponent_1; })
85
- }],
86
- template: "\n <span #item\n *ngFor=\"let action of actions; index as index; first as first; last as last\"\n class=\"k-quick-reply\"\n [class.k-state-selected]=\"isSelected(index)\"\n [class.k-state-focused]=\"isSelected(index)\"\n [class.k-first]=\"first\"\n [class.k-last]=\"last\"\n [attr.tabindex]=\"tabbable && selectedIndex === index ? '0' : '-1'\"\n (click)=\"actionClick(action)\"\n (keydown)=\"actionKeydown($event, action)\"\n >\n {{ action.title || action.value }}\n </span>\n "
87
- })
88
- ], SuggestedActionsComponent);
89
- return SuggestedActionsComponent;
90
- }(ChatItem));
91
- export { SuggestedActionsComponent };
@@ -1,43 +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, HostListener, HostBinding } from '@angular/core';
7
- /**
8
- * @hidden
9
- */
10
- var FocusedStateDirective = /** @class */ (function () {
11
- function FocusedStateDirective() {
12
- this.focused = false;
13
- }
14
- FocusedStateDirective.prototype.onFocus = function () {
15
- this.focused = true;
16
- };
17
- FocusedStateDirective.prototype.onBlur = function () {
18
- this.focused = false;
19
- };
20
- tslib_1.__decorate([
21
- HostBinding('class.k-state-focused'),
22
- tslib_1.__metadata("design:type", Boolean)
23
- ], FocusedStateDirective.prototype, "focused", void 0);
24
- tslib_1.__decorate([
25
- HostListener('focusin'),
26
- tslib_1.__metadata("design:type", Function),
27
- tslib_1.__metadata("design:paramtypes", []),
28
- tslib_1.__metadata("design:returntype", void 0)
29
- ], FocusedStateDirective.prototype, "onFocus", null);
30
- tslib_1.__decorate([
31
- HostListener('focusout'),
32
- tslib_1.__metadata("design:type", Function),
33
- tslib_1.__metadata("design:paramtypes", []),
34
- tslib_1.__metadata("design:returntype", void 0)
35
- ], FocusedStateDirective.prototype, "onBlur", null);
36
- FocusedStateDirective = tslib_1.__decorate([
37
- Directive({
38
- selector: '[kendoChatFocusedState]'
39
- })
40
- ], FocusedStateDirective);
41
- return FocusedStateDirective;
42
- }());
43
- export { FocusedStateDirective };
@@ -1,4 +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
- *-------------------------------------------------------------------------------------------*/
@@ -1,87 +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, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, Renderer2 } from '@angular/core';
7
- // Consider scroll to be at the bottom when within this number of pixels from the container height.
8
- var maxDelta = 2;
9
- /**
10
- * @hidden
11
- */
12
- var ScrollAnchorDirective = /** @class */ (function () {
13
- function ScrollAnchorDirective(element, zone, renderer) {
14
- this.element = element;
15
- this.zone = zone;
16
- this.renderer = renderer;
17
- this.autoScroll = true;
18
- this.autoScrollChange = new EventEmitter();
19
- this.overflowAnchor = 'none';
20
- this.scrolling = false;
21
- }
22
- ScrollAnchorDirective.prototype.ngOnInit = function () {
23
- var _this = this;
24
- this.zone.runOutsideAngular(function () {
25
- _this.unsubscribe = _this.renderer.listen(_this.element.nativeElement, 'scroll', function () { return _this.onScroll(); });
26
- });
27
- };
28
- ScrollAnchorDirective.prototype.ngAfterViewInit = function () {
29
- this.scrollToBottom();
30
- };
31
- ScrollAnchorDirective.prototype.ngOnDestroy = function () {
32
- if (this.unsubscribe) {
33
- this.unsubscribe();
34
- }
35
- };
36
- ScrollAnchorDirective.prototype.onScroll = function () {
37
- var _this = this;
38
- if (this.scrolling) {
39
- return;
40
- }
41
- var el = this.element.nativeElement;
42
- var bottom = el.scrollTop + el.offsetHeight;
43
- var height = el.scrollHeight;
44
- var atBottom = height - bottom < maxDelta;
45
- if (this.autoScroll !== atBottom) {
46
- this.zone.run(function () {
47
- _this.autoScroll = atBottom;
48
- _this.autoScrollChange.emit(_this.autoScroll);
49
- });
50
- }
51
- };
52
- ScrollAnchorDirective.prototype.scrollToBottom = function () {
53
- var _this = this;
54
- if (!this.autoScroll) {
55
- return;
56
- }
57
- var el = this.element.nativeElement;
58
- el.scrollTop = el.scrollHeight - el.clientHeight;
59
- this.scrolling = true;
60
- this.zone.runOutsideAngular(function () {
61
- return setTimeout(function () { return _this.scrolling = false; }, 1000);
62
- });
63
- };
64
- tslib_1.__decorate([
65
- Input(),
66
- tslib_1.__metadata("design:type", Boolean)
67
- ], ScrollAnchorDirective.prototype, "autoScroll", void 0);
68
- tslib_1.__decorate([
69
- Output(),
70
- tslib_1.__metadata("design:type", EventEmitter)
71
- ], ScrollAnchorDirective.prototype, "autoScrollChange", void 0);
72
- tslib_1.__decorate([
73
- HostBinding('style.overflow-anchor'),
74
- tslib_1.__metadata("design:type", String)
75
- ], ScrollAnchorDirective.prototype, "overflowAnchor", void 0);
76
- ScrollAnchorDirective = tslib_1.__decorate([
77
- Directive({
78
- selector: '[kendoChatScrollAnchor]',
79
- exportAs: 'scrollAnchor'
80
- }),
81
- tslib_1.__metadata("design:paramtypes", [ElementRef,
82
- NgZone,
83
- Renderer2])
84
- ], ScrollAnchorDirective);
85
- return ScrollAnchorDirective;
86
- }());
87
- export { ScrollAnchorDirective };