@progress/kendo-react-conversational-ui 6.1.1 → 7.0.0-develop.2
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.
- package/{dist/npm/ChatPropsAndState.d.ts → ChatPropsAndState.d.ts} +5 -2
- package/{dist/npm/Events.d.ts → Events.d.ts} +5 -1
- package/LICENSE.md +1 -1
- package/{dist/es/ViewItem.d.ts → ViewItem.d.ts} +6 -2
- package/{dist/npm/api → api}/action.interface.d.ts +5 -1
- package/{dist/es/api → api}/attachment.interface.d.ts +5 -1
- package/{dist/npm/api → api}/message.interface.d.ts +4 -0
- package/{dist/es/api → api}/user.interface.d.ts +4 -0
- package/{dist/npm/components → components}/Action.d.ts +6 -3
- package/{dist/npm/components → components}/ActionGroup.d.ts +5 -2
- package/{dist/npm/components → components}/Attachment.d.ts +6 -3
- package/{dist/npm/components → components}/AttachmentGroup.d.ts +5 -2
- package/{dist/es/components → components}/Chat.d.ts +6 -2
- package/{dist/npm/components → components}/ChatMessage.d.ts +5 -1
- package/components/DateMarker.d.ts +18 -0
- package/{dist/npm/components → components}/MessageGroup.d.ts +6 -2
- package/{dist/npm/components → components}/NewMessage.d.ts +6 -2
- package/components/Toolbar.d.ts +13 -0
- package/{dist/npm/components → components}/base/FocusableUponSelection.d.ts +4 -0
- package/{dist/es/components → components}/base/SelectableItemsContainer.d.ts +4 -0
- package/{dist/npm/components → components}/templates/HeroCard.d.ts +6 -2
- package/dist/cdn/js/kendo-react-conversational-ui.js +5 -1
- package/index.d.ts +15 -0
- package/index.js +5 -0
- package/index.mjs +671 -0
- package/{dist/npm/messages → messages}/index.d.ts +4 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +29 -39
- package/utils.d.ts +9 -0
- package/about.md +0 -3
- package/dist/es/ChatPropsAndState.d.ts +0 -92
- package/dist/es/ChatPropsAndState.js +0 -1
- package/dist/es/Events.d.ts +0 -38
- package/dist/es/Events.js +0 -1
- package/dist/es/ViewItem.js +0 -90
- package/dist/es/api/action.interface.d.ts +0 -31
- package/dist/es/api/action.interface.js +0 -1
- package/dist/es/api/attachment.interface.js +0 -1
- package/dist/es/api/message.interface.d.ts +0 -56
- package/dist/es/api/message.interface.js +0 -1
- package/dist/es/api/user.interface.js +0 -1
- package/dist/es/components/Action.d.ts +0 -20
- package/dist/es/components/Action.js +0 -43
- package/dist/es/components/ActionGroup.d.ts +0 -24
- package/dist/es/components/ActionGroup.js +0 -40
- package/dist/es/components/Attachment.d.ts +0 -25
- package/dist/es/components/Attachment.js +0 -68
- package/dist/es/components/AttachmentGroup.d.ts +0 -24
- package/dist/es/components/AttachmentGroup.js +0 -92
- package/dist/es/components/Chat.js +0 -210
- package/dist/es/components/ChatMessage.d.ts +0 -68
- package/dist/es/components/ChatMessage.js +0 -83
- package/dist/es/components/DateMarker.d.ts +0 -14
- package/dist/es/components/DateMarker.js +0 -33
- package/dist/es/components/MessageGroup.d.ts +0 -25
- package/dist/es/components/MessageGroup.js +0 -61
- package/dist/es/components/NewMessage.d.ts +0 -34
- package/dist/es/components/NewMessage.js +0 -81
- package/dist/es/components/Toolbar.d.ts +0 -9
- package/dist/es/components/Toolbar.js +0 -31
- package/dist/es/components/base/FocusableUponSelection.d.ts +0 -20
- package/dist/es/components/base/FocusableUponSelection.js +0 -35
- package/dist/es/components/base/SelectableItemsContainer.js +0 -113
- package/dist/es/components/templates/HeroCard.d.ts +0 -41
- package/dist/es/components/templates/HeroCard.js +0 -64
- package/dist/es/main.d.ts +0 -11
- package/dist/es/main.js +0 -10
- package/dist/es/messages/index.d.ts +0 -30
- package/dist/es/messages/index.js +0 -31
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/utils.d.ts +0 -5
- package/dist/es/utils.js +0 -6
- package/dist/npm/ChatPropsAndState.js +0 -2
- package/dist/npm/Events.js +0 -2
- package/dist/npm/ViewItem.d.ts +0 -57
- package/dist/npm/ViewItem.js +0 -94
- package/dist/npm/api/action.interface.js +0 -2
- package/dist/npm/api/attachment.interface.d.ts +0 -32
- package/dist/npm/api/attachment.interface.js +0 -2
- package/dist/npm/api/message.interface.js +0 -2
- package/dist/npm/api/user.interface.d.ts +0 -23
- package/dist/npm/api/user.interface.js +0 -2
- package/dist/npm/components/Action.js +0 -45
- package/dist/npm/components/ActionGroup.js +0 -42
- package/dist/npm/components/Attachment.js +0 -70
- package/dist/npm/components/AttachmentGroup.js +0 -94
- package/dist/npm/components/Chat.d.ts +0 -72
- package/dist/npm/components/Chat.js +0 -213
- package/dist/npm/components/ChatMessage.js +0 -86
- package/dist/npm/components/DateMarker.d.ts +0 -14
- package/dist/npm/components/DateMarker.js +0 -35
- package/dist/npm/components/MessageGroup.js +0 -63
- package/dist/npm/components/NewMessage.js +0 -83
- package/dist/npm/components/Toolbar.d.ts +0 -9
- package/dist/npm/components/Toolbar.js +0 -33
- package/dist/npm/components/base/FocusableUponSelection.js +0 -38
- package/dist/npm/components/base/SelectableItemsContainer.d.ts +0 -33
- package/dist/npm/components/base/SelectableItemsContainer.js +0 -116
- package/dist/npm/components/templates/HeroCard.js +0 -67
- package/dist/npm/main.d.ts +0 -11
- package/dist/npm/main.js +0 -27
- package/dist/npm/messages/index.js +0 -34
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/utils.d.ts +0 -5
- package/dist/npm/utils.js +0 -10
- package/dist/systemjs/kendo-react-conversational-ui.js +0 -1
- package/e2e-next/conversationalui.basic.tests.ts +0 -24
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.Chat = void 0;
|
|
19
|
-
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
20
|
-
var PropTypes = require("prop-types");
|
|
21
|
-
var React = require("react");
|
|
22
|
-
var ViewItem_1 = require("./../ViewItem");
|
|
23
|
-
var ActionGroup_1 = require("./ActionGroup");
|
|
24
|
-
var AttachmentGroup_1 = require("./AttachmentGroup");
|
|
25
|
-
var DateMarker_1 = require("./DateMarker");
|
|
26
|
-
var MessageGroup_1 = require("./MessageGroup");
|
|
27
|
-
var NewMessage_1 = require("./NewMessage");
|
|
28
|
-
var ChatMessage_1 = require("./ChatMessage");
|
|
29
|
-
var kendo_react_common_2 = require("@progress/kendo-react-common");
|
|
30
|
-
var package_metadata_1 = require("../package-metadata");
|
|
31
|
-
var messages_1 = require("../messages");
|
|
32
|
-
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
33
|
-
/**
|
|
34
|
-
* Represents the [KendoReact Chat component]({% slug overview_convui %}).
|
|
35
|
-
*/
|
|
36
|
-
var Chat = /** @class */ (function (_super) {
|
|
37
|
-
__extends(Chat, _super);
|
|
38
|
-
function Chat(props) {
|
|
39
|
-
var _this = _super.call(this, props) || this;
|
|
40
|
-
_this.viewItems = [];
|
|
41
|
-
_this.isDirectionRightToLeft = false;
|
|
42
|
-
_this.scrollToBottomOnLoadingData = true;
|
|
43
|
-
_this.onFocus = function () {
|
|
44
|
-
clearTimeout(_this.timeoutIdForChatLosingFocus);
|
|
45
|
-
};
|
|
46
|
-
_this.onBlur = function () {
|
|
47
|
-
// This is a hacky solution to clear the selection when the focus is lost
|
|
48
|
-
// in favor of an element outside the Chat.
|
|
49
|
-
// https://medium.com/@jessebeach/dealing-with-focus-and-blur-in-a-composite-widget-in-react-90d3c3b49a9b
|
|
50
|
-
_this.timeoutIdForChatLosingFocus = window.setTimeout(function () { _this.setState({ selectedItemIndex: null }); }, 0);
|
|
51
|
-
};
|
|
52
|
-
_this.onSelectionRequested = function (clickedItemIndex) {
|
|
53
|
-
_this.setState({ selectedItemIndex: clickedItemIndex });
|
|
54
|
-
};
|
|
55
|
-
_this.onKeyDown = function (event) {
|
|
56
|
-
var newSelectedItemIndex = null;
|
|
57
|
-
var currentSelectedItemIndex = _this.state.selectedItemIndex !== null ?
|
|
58
|
-
_this.state.selectedItemIndex :
|
|
59
|
-
_this.viewItems.lastSelectionIndex;
|
|
60
|
-
if (event.keyCode === kendo_react_common_1.Keys.up) {
|
|
61
|
-
if (currentSelectedItemIndex === null) {
|
|
62
|
-
newSelectedItemIndex = 0;
|
|
63
|
-
}
|
|
64
|
-
else if (currentSelectedItemIndex > 0) {
|
|
65
|
-
newSelectedItemIndex = currentSelectedItemIndex - 1;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else if (event.keyCode === kendo_react_common_1.Keys.down) {
|
|
69
|
-
if (currentSelectedItemIndex === null) {
|
|
70
|
-
newSelectedItemIndex = 0;
|
|
71
|
-
}
|
|
72
|
-
else if (currentSelectedItemIndex < _this.viewItems.lastSelectionIndex) {
|
|
73
|
-
newSelectedItemIndex = currentSelectedItemIndex + 1;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (newSelectedItemIndex !== null) {
|
|
77
|
-
_this.setState({ selectedItemIndex: newSelectedItemIndex });
|
|
78
|
-
// Prevent the default behavior of moving of the scrollbar
|
|
79
|
-
// because scrolling is achieved through item focusing.
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
_this.onMessageSend = function (message, event) {
|
|
84
|
-
(0, kendo_react_common_1.dispatchEvent)(_this.props.onMessageSend, event, _this, { message: message });
|
|
85
|
-
};
|
|
86
|
-
_this.onActionExecute = function (action, event) {
|
|
87
|
-
(0, kendo_react_common_1.dispatchEvent)(_this.props.onActionExecute, event, _this, { action: action });
|
|
88
|
-
if (!event.isDefaultPrevented()) {
|
|
89
|
-
switch (action.type) {
|
|
90
|
-
case 'reply':
|
|
91
|
-
_this.onMessageSend({
|
|
92
|
-
author: _this.props.user,
|
|
93
|
-
text: action.value,
|
|
94
|
-
timestamp: new Date()
|
|
95
|
-
}, event);
|
|
96
|
-
break;
|
|
97
|
-
case 'call':
|
|
98
|
-
window.open('tel:' + action.value);
|
|
99
|
-
break;
|
|
100
|
-
case 'openUrl':
|
|
101
|
-
window.open(action.value);
|
|
102
|
-
break;
|
|
103
|
-
default:
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
_this.newMsgComp.focusInput();
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
(0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
|
|
110
|
-
_this.state = { selectedItemIndex: null, isFirstRender: true };
|
|
111
|
-
return _this;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @hidden
|
|
115
|
-
*/
|
|
116
|
-
Chat.prototype.render = function () {
|
|
117
|
-
var _this = this;
|
|
118
|
-
this.viewItems = this.getViewItemsFromMsgs(this.props.messages);
|
|
119
|
-
this.isDirectionRightToLeft = this.checkIsDirectionRightToLeft(this.props);
|
|
120
|
-
var localizationService = (0, kendo_react_intl_1.provideLocalizationService)(this);
|
|
121
|
-
return (React.createElement("div", { style: { width: this.props.width }, onKeyDown: this.onKeyDown, className: this.getClassNames(), ref: function (el) { return _this.chatWrapperEl = el; } },
|
|
122
|
-
React.createElement("div", { className: "k-message-list k-avatars", onBlur: this.onBlur, onFocus: this.onFocus, role: "log", "aria-label": localizationService.toLanguageString(messages_1.ariaLabelMessageList, messages_1.messages[messages_1.ariaLabelMessageList]), "aria-live": "polite", onScroll: function (e) {
|
|
123
|
-
_this.scrollToBottomOnLoadingData =
|
|
124
|
-
(e.currentTarget.scrollTop === e.currentTarget.scrollHeight - e.currentTarget.clientHeight);
|
|
125
|
-
}, ref: function (el) { return _this.viewItemsWrapperEl = el; } },
|
|
126
|
-
React.createElement("div", { className: "k-message-list-content" }, this.renderViewItems())),
|
|
127
|
-
React.createElement(NewMessage_1.default, { user: this.props.user, onMessageSend: this.onMessageSend, isDirectionRightToLeft: this.isDirectionRightToLeft, ref: function (comp) { return _this.newMsgComp = comp; }, placeholder: this.props.placeholder, MessageBox: this.props.messageBox, toolbar: this.props.toolbar, onToolbarActionButtonClick: this.props.onToolbarActionExecute, showToolbar: this.props.showToolbar })));
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* @hidden
|
|
131
|
-
*/
|
|
132
|
-
Chat.prototype.componentDidMount = function () {
|
|
133
|
-
var _this = this;
|
|
134
|
-
this.setState({ isFirstRender: false }, function () {
|
|
135
|
-
// W/o window.setTimeout the scrolling does not manage to go to the bottom, some offset is left.
|
|
136
|
-
_this.nextTickId = window.setTimeout(function () { return _this.scrollViewItemsToBottom(); }, 250);
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* @hidden
|
|
141
|
-
*/
|
|
142
|
-
Chat.prototype.componentWillUnmount = function () {
|
|
143
|
-
clearTimeout(this.nextTickId);
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* @hidden
|
|
147
|
-
*/
|
|
148
|
-
Chat.prototype.componentDidUpdate = function (prevProps) {
|
|
149
|
-
if (prevProps.messages.length !== this.props.messages.length && this.scrollToBottomOnLoadingData) {
|
|
150
|
-
this.scrollViewItemsToBottom();
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
Chat.prototype.getClassNames = function () {
|
|
154
|
-
return (0, kendo_react_common_1.classNames)('k-chat', this.props.className, { 'k-rtl': this.isDirectionRightToLeft });
|
|
155
|
-
};
|
|
156
|
-
Chat.prototype.checkIsDirectionRightToLeft = function (props) {
|
|
157
|
-
var result = props.dir !== undefined ? props.dir === 'rtl' :
|
|
158
|
-
this.chatWrapperEl && getComputedStyle(this.chatWrapperEl).direction === 'rtl';
|
|
159
|
-
return Boolean(result);
|
|
160
|
-
};
|
|
161
|
-
Chat.prototype.renderViewItems = function () {
|
|
162
|
-
var _this = this;
|
|
163
|
-
var lastViewItemIndex = this.viewItems.length - 1;
|
|
164
|
-
return this.viewItems
|
|
165
|
-
.map(function (viewItem, index) {
|
|
166
|
-
if (viewItem.type === 'date-marker') {
|
|
167
|
-
return React.createElement(DateMarker_1.default, { item: viewItem, key: index });
|
|
168
|
-
}
|
|
169
|
-
else if (viewItem.type === 'message-group') {
|
|
170
|
-
return (React.createElement(MessageGroup_1.default, { group: viewItem, itemTemplate: _this.props.messageTemplate, attachmentTemplate: _this.props.attachmentTemplate, user: _this.props.user, selectedItemIndex: _this.state.selectedItemIndex, onRequestSelection: _this.onSelectionRequested, isLastGroup: index === lastViewItemIndex, key: index, message: _this.props.message || Chat.defaultProps.message }));
|
|
171
|
-
}
|
|
172
|
-
else if (viewItem.type === 'attachment-group') {
|
|
173
|
-
return (React.createElement(AttachmentGroup_1.default, { group: viewItem, itemTemplate: _this.props.attachmentTemplate, onRequestSelection: _this.onSelectionRequested, selected: viewItem.selectionIndex === _this.state.selectedItemIndex, isLastGroup: index === lastViewItemIndex, key: index }));
|
|
174
|
-
}
|
|
175
|
-
else if (viewItem.type === 'action-group') {
|
|
176
|
-
return (React.createElement(ActionGroup_1.default, { group: viewItem, onActionExecute: _this.onActionExecute, onRequestSelection: _this.onSelectionRequested, selected: viewItem.selectionIndex === _this.state.selectedItemIndex, isLastGroup: index === lastViewItemIndex, key: index }));
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
Chat.prototype.scrollViewItemsToBottom = function () {
|
|
181
|
-
if (this.viewItemsWrapperEl) {
|
|
182
|
-
this.viewItemsWrapperEl.scrollTop =
|
|
183
|
-
this.viewItemsWrapperEl.scrollHeight - this.viewItemsWrapperEl.clientHeight;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
Chat.prototype.getViewItemsFromMsgs = function (msgs) {
|
|
187
|
-
return msgs.length > 0 ? (0, ViewItem_1.convertMsgsToViewItems)(msgs) : [];
|
|
188
|
-
};
|
|
189
|
-
/**
|
|
190
|
-
* @hidden
|
|
191
|
-
*/
|
|
192
|
-
Chat.propTypes = {
|
|
193
|
-
messages: PropTypes.arrayOf(PropTypes.object),
|
|
194
|
-
user: PropTypes.object,
|
|
195
|
-
messageTemplate: PropTypes.any,
|
|
196
|
-
attachmentTemplate: PropTypes.any,
|
|
197
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
198
|
-
onMessageSend: PropTypes.func,
|
|
199
|
-
onActionExecute: PropTypes.func,
|
|
200
|
-
dir: PropTypes.string,
|
|
201
|
-
messageBox: PropTypes.any
|
|
202
|
-
};
|
|
203
|
-
/**
|
|
204
|
-
* @hidden
|
|
205
|
-
*/
|
|
206
|
-
Chat.defaultProps = {
|
|
207
|
-
messages: [],
|
|
208
|
-
dateFormat: 'g',
|
|
209
|
-
message: ChatMessage_1.ChatMessage
|
|
210
|
-
};
|
|
211
|
-
return Chat;
|
|
212
|
-
}(React.Component));
|
|
213
|
-
exports.Chat = Chat;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.ChatMessage = void 0;
|
|
19
|
-
var React = require("react");
|
|
20
|
-
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
21
|
-
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
22
|
-
var FocusableUponSelection_1 = require("./base/FocusableUponSelection");
|
|
23
|
-
/**
|
|
24
|
-
* Represents the ChatMessage component.
|
|
25
|
-
*/
|
|
26
|
-
var ChatMessage = /** @class */ (function (_super) {
|
|
27
|
-
__extends(ChatMessage, _super);
|
|
28
|
-
function ChatMessage() {
|
|
29
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @hidden
|
|
33
|
-
*/
|
|
34
|
-
ChatMessage.prototype.render = function () {
|
|
35
|
-
var _this = this;
|
|
36
|
-
return (React.createElement("div", { className: this.getClassNames(), tabIndex: this.props.tabIndex, onClick: function () { return _this.props.onRequestSelection(_this.props.item.selectionIndex); }, onFocus: function () { return _this.props.onRequestSelection(_this.props.item.selectionIndex); }, ref: function (el) { return _this.elementToFocus = el; } },
|
|
37
|
-
this.getTimestampView(),
|
|
38
|
-
this.getMainView(),
|
|
39
|
-
this.getStatusView()));
|
|
40
|
-
};
|
|
41
|
-
ChatMessage.prototype.getMainView = function () {
|
|
42
|
-
if (this.props.item.typing) {
|
|
43
|
-
return (React.createElement("div", { className: "k-chat-bubble" },
|
|
44
|
-
React.createElement("div", { className: "k-typing-indicator" },
|
|
45
|
-
React.createElement("span", null),
|
|
46
|
-
React.createElement("span", null),
|
|
47
|
-
React.createElement("span", null))));
|
|
48
|
-
}
|
|
49
|
-
else if (this.props.template) {
|
|
50
|
-
return React.createElement(this.props.template, { item: this.props.item });
|
|
51
|
-
}
|
|
52
|
-
else if (this.props.item.text) {
|
|
53
|
-
return (React.createElement("div", { className: "k-chat-bubble" }, this.props.item.text));
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
ChatMessage.prototype.getTimestampView = function () {
|
|
60
|
-
var result = null;
|
|
61
|
-
if (this.props.item.timestamp) {
|
|
62
|
-
result = (React.createElement("time", { className: "k-message-time", "aria-hidden": !this.props.selected }, (0, kendo_react_intl_1.provideIntlService)(this).formatDate(this.props.item.timestamp, this.props.dateFormat)));
|
|
63
|
-
}
|
|
64
|
-
return result;
|
|
65
|
-
};
|
|
66
|
-
ChatMessage.prototype.getStatusView = function () {
|
|
67
|
-
var result = null;
|
|
68
|
-
if (this.props.item.status) {
|
|
69
|
-
result = (React.createElement("span", { className: "k-message-status" }, this.props.item.status));
|
|
70
|
-
}
|
|
71
|
-
return result;
|
|
72
|
-
};
|
|
73
|
-
ChatMessage.prototype.getClassNames = function () {
|
|
74
|
-
return (0, kendo_react_common_1.classNames)({ 'k-only': this.props.isOnlyItemInGroup }, { 'k-first': this.props.isFirstItemInGroup && !this.props.isOnlyItemInGroup }, { 'k-last': this.props.isLastItemInGroup && !this.props.isOnlyItemInGroup }, { 'k-selected': this.props.selected }, { 'k-focus': this.props.selected }, 'k-message');
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* @hidden
|
|
78
|
-
*/
|
|
79
|
-
ChatMessage.defaultProps = {
|
|
80
|
-
dateFormat: 'g',
|
|
81
|
-
tabIndex: -1
|
|
82
|
-
};
|
|
83
|
-
return ChatMessage;
|
|
84
|
-
}(FocusableUponSelection_1.FocusableUponSelection));
|
|
85
|
-
exports.ChatMessage = ChatMessage;
|
|
86
|
-
(0, kendo_react_intl_1.registerForIntl)(ChatMessage);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DateMarker as DateMarkerModel } from './../ViewItem';
|
|
3
|
-
/**
|
|
4
|
-
* @hidden
|
|
5
|
-
*/
|
|
6
|
-
export interface DateMarkerProps {
|
|
7
|
-
item: DateMarkerModel;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
export default class DateMarker extends React.Component<DateMarkerProps, {}> {
|
|
13
|
-
render(): JSX.Element;
|
|
14
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var React = require("react");
|
|
19
|
-
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*/
|
|
23
|
-
var DateMarker = /** @class */ (function (_super) {
|
|
24
|
-
__extends(DateMarker, _super);
|
|
25
|
-
function DateMarker() {
|
|
26
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
-
}
|
|
28
|
-
DateMarker.prototype.render = function () {
|
|
29
|
-
var item = this.props.item;
|
|
30
|
-
return React.createElement("div", { className: "k-timestamp" }, (0, kendo_react_intl_1.provideIntlService)(this).formatDate(item.timestamp, 'D'));
|
|
31
|
-
};
|
|
32
|
-
return DateMarker;
|
|
33
|
-
}(React.Component));
|
|
34
|
-
exports.default = DateMarker;
|
|
35
|
-
(0, kendo_react_intl_1.registerForIntl)(DateMarker);
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var React = require("react");
|
|
19
|
-
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
20
|
-
var kendo_react_layout_1 = require("@progress/kendo-react-layout");
|
|
21
|
-
var Attachment_1 = require("./Attachment");
|
|
22
|
-
var utils_1 = require("./../utils");
|
|
23
|
-
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
24
|
-
var messages_1 = require("../messages");
|
|
25
|
-
/**
|
|
26
|
-
* @hidden
|
|
27
|
-
*/
|
|
28
|
-
var MessageGroup = /** @class */ (function (_super) {
|
|
29
|
-
__extends(MessageGroup, _super);
|
|
30
|
-
function MessageGroup() {
|
|
31
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
32
|
-
}
|
|
33
|
-
MessageGroup.prototype.render = function () {
|
|
34
|
-
var _a = this.props.group.author, avatarUrl = _a.avatarUrl, avatarAltText = _a.avatarAltText, name = _a.name;
|
|
35
|
-
var localizationService = (0, kendo_react_intl_1.provideLocalizationService)(this);
|
|
36
|
-
return (React.createElement("div", { className: this.getMsgGroupClassNames() },
|
|
37
|
-
name && (React.createElement("p", { className: "k-author" }, name)),
|
|
38
|
-
avatarUrl && (React.createElement(kendo_react_layout_1.Avatar, { type: 'image' },
|
|
39
|
-
React.createElement("img", { src: avatarUrl, alt: avatarAltText !== undefined
|
|
40
|
-
? avatarAltText
|
|
41
|
-
: localizationService.toLanguageString(messages_1.avatarAlt, messages_1.messages[messages_1.avatarAlt]) }))),
|
|
42
|
-
this.getGroupMessagesView()));
|
|
43
|
-
};
|
|
44
|
-
MessageGroup.prototype.getMsgGroupClassNames = function () {
|
|
45
|
-
return (0, kendo_react_common_1.classNames)('k-message-group', {
|
|
46
|
-
'k-no-avatar': !this.props.group.author.avatarUrl,
|
|
47
|
-
'k-alt': (0, utils_1.isAuthor)(this.props.user, this.props.group.messages[0])
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
MessageGroup.prototype.getGroupMessagesView = function () {
|
|
51
|
-
var _this = this;
|
|
52
|
-
var lastItemIndex = this.props.group.messages.length - 1;
|
|
53
|
-
return this.props.group.messages.map(function (msg, index) {
|
|
54
|
-
var result = [(React.createElement(_this.props.message, { item: msg, template: _this.props.itemTemplate, selected: msg.selectionIndex === _this.props.selectedItemIndex, onRequestSelection: _this.props.onRequestSelection, tabIndex: index === lastItemIndex && _this.props.isLastGroup ? 0 : -1, isFirstItemInGroup: index === 0, isLastItemInGroup: index === lastItemIndex, isOnlyItemInGroup: lastItemIndex === 0, key: index }))];
|
|
55
|
-
if (msg.attachments && msg.attachments.length === 1) {
|
|
56
|
-
result.push(React.createElement(Attachment_1.default, { item: msg.attachments[0], template: _this.props.attachmentTemplate, selected: false, key: "att-".concat(index) }));
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
return MessageGroup;
|
|
62
|
-
}(React.Component));
|
|
63
|
-
exports.default = MessageGroup;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
19
|
-
var React = require("react");
|
|
20
|
-
var Toolbar_1 = require("./Toolbar");
|
|
21
|
-
var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
22
|
-
var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
23
|
-
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
24
|
-
var messages_1 = require("../messages");
|
|
25
|
-
/**
|
|
26
|
-
* @hidden
|
|
27
|
-
*/
|
|
28
|
-
var NewMessage = /** @class */ (function (_super) {
|
|
29
|
-
__extends(NewMessage, _super);
|
|
30
|
-
function NewMessage() {
|
|
31
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
32
|
-
_this.state = { focused: false };
|
|
33
|
-
_this.inputEl = null;
|
|
34
|
-
_this.onInputKeyDown = function (event) {
|
|
35
|
-
if (event.keyCode === kendo_react_common_1.Keys.enter) {
|
|
36
|
-
_this.sendMessage(event);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
_this.sendMessage = function (event) {
|
|
40
|
-
if (_this.props.onMessageSend && _this.inputEl !== null) {
|
|
41
|
-
var messageText = _this.inputEl.value;
|
|
42
|
-
if (messageText) {
|
|
43
|
-
var message = {
|
|
44
|
-
author: _this.props.user,
|
|
45
|
-
text: messageText,
|
|
46
|
-
timestamp: new Date()
|
|
47
|
-
};
|
|
48
|
-
_this.props.onMessageSend(message, event);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (_this.inputEl !== null) {
|
|
52
|
-
_this.inputEl.value = null;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
return _this;
|
|
56
|
-
}
|
|
57
|
-
NewMessage.prototype.render = function () {
|
|
58
|
-
var _this = this;
|
|
59
|
-
var localizationService = (0, kendo_react_intl_1.provideLocalizationService)(this);
|
|
60
|
-
var messageInput = (React.createElement("input", { type: "text", className: this.getClassNames(), placeholder: this.props.placeholder, onKeyDown: this.onInputKeyDown, onFocus: function () { return _this.setState({ focused: true }); }, onBlur: function () { return _this.setState({ focused: false }); }, ref: function (el) { return _this.inputEl = el; }, "aria-label": localizationService.toLanguageString(messages_1.newMessageMessageInput, messages_1.messages[messages_1.newMessageMessageInput]) }));
|
|
61
|
-
var sendButton = (React.createElement(kendo_react_buttons_1.Button, { fillMode: "flat", themeColor: "base", className: "k-chat-send", icon: "paper-plane", svgIcon: kendo_svg_icons_1.paperPlaneIcon, onClick: this.sendMessage, "aria-label": localizationService.toLanguageString(messages_1.newMessageSendButton, messages_1.messages[messages_1.newMessageSendButton]), dir: this.props.isDirectionRightToLeft ? 'rtl' : undefined }));
|
|
62
|
-
var toolbarButton = (React.createElement(kendo_react_buttons_1.Button, { fillMode: "flat", themeColor: "base", rounded: null, className: "k-button-toggle", icon: 'more-horizontal', svgIcon: kendo_svg_icons_1.moreHorizontalIcon, onClick: function (event) { return _this.props.onToolbarActionButtonClick(!_this.props.showToolbar, event); }, "aria-label": localizationService.toLanguageString(messages_1.newMessageOptionsButton, messages_1.messages[messages_1.newMessageOptionsButton]) }));
|
|
63
|
-
return (React.createElement(React.Fragment, null,
|
|
64
|
-
React.createElement("span", { className: "k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid" }, this.props.MessageBox ?
|
|
65
|
-
React.createElement(this.props.MessageBox, { messageInput: messageInput, sendButton: sendButton, toolbarButton: toolbarButton }) :
|
|
66
|
-
React.createElement(React.Fragment, null,
|
|
67
|
-
messageInput,
|
|
68
|
-
React.createElement("span", { className: "k-input-suffix" },
|
|
69
|
-
this.props.toolbar && toolbarButton,
|
|
70
|
-
sendButton))),
|
|
71
|
-
this.props.showToolbar && React.createElement(Toolbar_1.default, null, this.props.toolbar)));
|
|
72
|
-
};
|
|
73
|
-
NewMessage.prototype.focusInput = function () {
|
|
74
|
-
if (this.inputEl !== null) {
|
|
75
|
-
this.inputEl.focus();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
NewMessage.prototype.getClassNames = function () {
|
|
79
|
-
return (0, kendo_react_common_1.classNames)('k-input-inner', { 'k-focus': this.state.focused });
|
|
80
|
-
};
|
|
81
|
-
return NewMessage;
|
|
82
|
-
}(React.Component));
|
|
83
|
-
exports.default = NewMessage;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var React = require("react");
|
|
19
|
-
/**
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
|
-
var Toolbar = /** @class */ (function (_super) {
|
|
23
|
-
__extends(Toolbar, _super);
|
|
24
|
-
function Toolbar() {
|
|
25
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
-
}
|
|
27
|
-
Toolbar.prototype.render = function () {
|
|
28
|
-
return (React.createElement("div", { className: "k-toolbar-box" },
|
|
29
|
-
React.createElement("div", { className: "k-button-list" }, this.props.children)));
|
|
30
|
-
};
|
|
31
|
-
return Toolbar;
|
|
32
|
-
}(React.Component));
|
|
33
|
-
exports.default = Toolbar;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.FocusableUponSelection = void 0;
|
|
19
|
-
var React = require("react");
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*/
|
|
23
|
-
var FocusableUponSelection = /** @class */ (function (_super) {
|
|
24
|
-
__extends(FocusableUponSelection, _super);
|
|
25
|
-
function FocusableUponSelection() {
|
|
26
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @hidden
|
|
30
|
-
*/
|
|
31
|
-
FocusableUponSelection.prototype.componentDidUpdate = function (prevProps) {
|
|
32
|
-
if (!prevProps.selected && this.props.selected) {
|
|
33
|
-
this.elementToFocus.focus();
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
return FocusableUponSelection;
|
|
37
|
-
}(React.Component));
|
|
38
|
-
exports.FocusableUponSelection = FocusableUponSelection;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ActionGroup, AttachmentGroup } from './../../ViewItem';
|
|
3
|
-
/**
|
|
4
|
-
* @hidden
|
|
5
|
-
*/
|
|
6
|
-
export interface SelectableItemsContainerProps {
|
|
7
|
-
selected: boolean;
|
|
8
|
-
isLastGroup: boolean;
|
|
9
|
-
group: ActionGroup | AttachmentGroup;
|
|
10
|
-
onRequestSelection: any;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
export interface SelectableItemsContainerState {
|
|
16
|
-
selectedItemIndex: number | null;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @hidden
|
|
20
|
-
*/
|
|
21
|
-
export declare abstract class SelectableItemsContainer<P extends SelectableItemsContainerProps, S extends SelectableItemsContainerState> extends React.Component<P, S> {
|
|
22
|
-
readonly state: any;
|
|
23
|
-
static getDerivedStateFromProps(props: SelectableItemsContainerProps, state: SelectableItemsContainerState): {
|
|
24
|
-
selectedItemIndex: null;
|
|
25
|
-
} | {
|
|
26
|
-
selectedItemIndex: number;
|
|
27
|
-
} | null;
|
|
28
|
-
protected onRequestContainerSelection: () => any;
|
|
29
|
-
protected onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
30
|
-
protected navigate(incrementSelection: boolean, newSelectedItemIndexUponFirstIncrement?: number): number | null;
|
|
31
|
-
protected get isKeyboardNavigationLeftRight(): boolean;
|
|
32
|
-
private getLastSelectionIndex;
|
|
33
|
-
}
|