@progress/kendo-react-conversational-ui 6.1.1-dev.202311151536 → 7.0.0-develop.1
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
package/dist/npm/ViewItem.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertMsgsToViewItems = void 0;
|
|
4
|
-
var utils_1 = require("./utils");
|
|
5
|
-
var last = function (arr) { return arr[arr.length - 1]; };
|
|
6
|
-
var dateChanged = function (curr, prev) {
|
|
7
|
-
return (curr && prev) && (prev.getDate() !== curr.getDate() ||
|
|
8
|
-
prev.getMonth() !== curr.getMonth() ||
|
|
9
|
-
prev.getFullYear() !== curr.getFullYear());
|
|
10
|
-
};
|
|
11
|
-
var addDateMarker = function (acc, msg) {
|
|
12
|
-
var timestamp = msg.timestamp;
|
|
13
|
-
var lastItem = last(acc);
|
|
14
|
-
if (!timestamp) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (!lastItem || dateChanged(timestamp, lastItem.timestamp)) {
|
|
18
|
-
var dateMarker = {
|
|
19
|
-
type: 'date-marker',
|
|
20
|
-
timestamp: timestamp,
|
|
21
|
-
trackBy: timestamp.getTime()
|
|
22
|
-
};
|
|
23
|
-
acc.push(dateMarker);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var groupMessages = function (acc, msg, isLastMessage) {
|
|
27
|
-
var lastItem = last(acc);
|
|
28
|
-
var messages = undefined;
|
|
29
|
-
if (msg.typing && !isLastMessage) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (lastItem && lastItem.type === 'message-group') {
|
|
33
|
-
messages = lastItem.messages;
|
|
34
|
-
}
|
|
35
|
-
if (messages && (0, utils_1.isAuthor)(msg.author, last(messages))) {
|
|
36
|
-
messages.push(msg);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
acc.push({
|
|
40
|
-
type: 'message-group',
|
|
41
|
-
messages: [msg],
|
|
42
|
-
author: msg.author,
|
|
43
|
-
timestamp: msg.timestamp,
|
|
44
|
-
trackBy: msg
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var groupItems = function (total) { return function (acc, msg, index) {
|
|
49
|
-
var isLastMessage = index === total - 1;
|
|
50
|
-
addDateMarker(acc, msg);
|
|
51
|
-
groupMessages(acc, msg, isLastMessage);
|
|
52
|
-
if (msg.attachments && msg.attachments.length > 1) {
|
|
53
|
-
acc.push({
|
|
54
|
-
type: 'attachment-group',
|
|
55
|
-
attachments: msg.attachments,
|
|
56
|
-
attachmentLayout: msg.attachmentLayout,
|
|
57
|
-
timestamp: msg.timestamp,
|
|
58
|
-
trackBy: msg
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
if (msg.suggestedActions && isLastMessage) {
|
|
62
|
-
acc.push({
|
|
63
|
-
type: 'action-group',
|
|
64
|
-
actions: msg.suggestedActions,
|
|
65
|
-
timestamp: msg.timestamp,
|
|
66
|
-
trackBy: msg
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return acc;
|
|
70
|
-
}; };
|
|
71
|
-
function assignSelectionIndices(viewItems) {
|
|
72
|
-
var selectionCounter = 0;
|
|
73
|
-
viewItems.forEach(function (viewItem) {
|
|
74
|
-
if (viewItem.type === 'message-group') {
|
|
75
|
-
viewItem.messages.forEach(function (msg) {
|
|
76
|
-
msg.selectionIndex = selectionCounter++;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
else if (viewItem.type === 'attachment-group' || viewItem.type === 'action-group') {
|
|
80
|
-
viewItem.selectionIndex = selectionCounter++;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
viewItems.lastSelectionIndex = selectionCounter - 1;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @hidden
|
|
87
|
-
*/
|
|
88
|
-
var convertMsgsToViewItems = function (messages) {
|
|
89
|
-
var items = messages.slice();
|
|
90
|
-
var result = items.reduce(groupItems(messages.length), []);
|
|
91
|
-
assignSelectionIndices(result);
|
|
92
|
-
return result;
|
|
93
|
-
};
|
|
94
|
-
exports.convertMsgsToViewItems = convertMsgsToViewItems;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a message attachment
|
|
3
|
-
* ([see examples]({% slug attachments_chat %})).
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export interface Attachment {
|
|
7
|
-
/**
|
|
8
|
-
* The content type identifier for the attachment.
|
|
9
|
-
* Typically a MIME type. Can also be any string.
|
|
10
|
-
*/
|
|
11
|
-
contentType: string;
|
|
12
|
-
/**
|
|
13
|
-
* The content of the attachment.
|
|
14
|
-
*/
|
|
15
|
-
content: any;
|
|
16
|
-
/**
|
|
17
|
-
* (Optional) The title of the attachment.
|
|
18
|
-
*/
|
|
19
|
-
title?: string;
|
|
20
|
-
/**
|
|
21
|
-
* (Optional) The subtitle of the attachment.
|
|
22
|
-
*/
|
|
23
|
-
subtitle?: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Specifies the layout for the message attachments.
|
|
27
|
-
*
|
|
28
|
-
* The supported values are:
|
|
29
|
-
* * `"list"`—A vertical list.
|
|
30
|
-
* * `"carousel"`—A horizontal, scrollable list. Also called a card deck.
|
|
31
|
-
*/
|
|
32
|
-
export declare type AttachmentLayout = 'list' | 'carousel';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a participant in a Chat conversation.
|
|
3
|
-
*/
|
|
4
|
-
export interface User {
|
|
5
|
-
/**
|
|
6
|
-
* A unique ID for this user.
|
|
7
|
-
* Typically, the ID is a number.
|
|
8
|
-
* Can also be a string or an object.
|
|
9
|
-
*/
|
|
10
|
-
id: any;
|
|
11
|
-
/**
|
|
12
|
-
* (Optional) The displayed name for the user.
|
|
13
|
-
*/
|
|
14
|
-
name?: string;
|
|
15
|
-
/**
|
|
16
|
-
* (Optional) An avatar image for the user.
|
|
17
|
-
*/
|
|
18
|
-
avatarUrl?: string;
|
|
19
|
-
/**
|
|
20
|
-
* (Optional) An avatar image alt text for the user.
|
|
21
|
-
*/
|
|
22
|
-
avatarAltText?: string;
|
|
23
|
-
}
|
|
@@ -1,45 +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_common_2 = require("@progress/kendo-react-common");
|
|
21
|
-
var FocusableUponSelection_1 = require("./base/FocusableUponSelection");
|
|
22
|
-
/**
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
var Action = /** @class */ (function (_super) {
|
|
26
|
-
__extends(Action, _super);
|
|
27
|
-
function Action() {
|
|
28
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
-
_this.onKeyDown = function (event) {
|
|
30
|
-
if (event.keyCode === kendo_react_common_1.Keys.enter) {
|
|
31
|
-
_this.props.onActionExecute(_this.props.item, event);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
Action.prototype.render = function () {
|
|
37
|
-
var _this = this;
|
|
38
|
-
return (React.createElement("span", { role: 'button', className: this.getClassNames(), onClick: function (event) { return _this.props.onActionExecute(_this.props.item, event); }, ref: function (el) { return _this.elementToFocus = el; }, onKeyDown: this.onKeyDown, tabIndex: 0 }, this.props.item.title || this.props.item.value));
|
|
39
|
-
};
|
|
40
|
-
Action.prototype.getClassNames = function () {
|
|
41
|
-
return (0, kendo_react_common_2.classNames)('k-quick-reply', { 'k-first': this.props.isFirstItemInGroup }, { 'k-last': this.props.isLastItemInGroup }, { 'k-selected': this.props.selected }, { 'k-focus': this.props.selected });
|
|
42
|
-
};
|
|
43
|
-
return Action;
|
|
44
|
-
}(FocusableUponSelection_1.FocusableUponSelection));
|
|
45
|
-
exports.default = Action;
|
|
@@ -1,42 +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 Action_1 = require("./Action");
|
|
21
|
-
var SelectableItemsContainer_1 = require("./base/SelectableItemsContainer");
|
|
22
|
-
/**
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
var ActionGroup = /** @class */ (function (_super) {
|
|
26
|
-
__extends(ActionGroup, _super);
|
|
27
|
-
function ActionGroup(props) {
|
|
28
|
-
return _super.call(this, props) || this;
|
|
29
|
-
}
|
|
30
|
-
ActionGroup.prototype.render = function () {
|
|
31
|
-
var _this = this;
|
|
32
|
-
var lastItemIndex = this.props.group.actions ? this.props.group.actions.length - 1 : 0;
|
|
33
|
-
return (React.createElement("div", { className: this.getClassNames(), onClick: this.onRequestContainerSelection, onKeyDown: this.onKeyDown }, this.props.group.actions && this.props.group.actions.map(function (item, index) {
|
|
34
|
-
return (React.createElement(Action_1.default, { item: item, onActionExecute: _this.props.onActionExecute, selected: index === _this.state.selectedItemIndex, isFirstItemInGroup: index === 0, isLastItemInGroup: index === lastItemIndex, key: index }));
|
|
35
|
-
})));
|
|
36
|
-
};
|
|
37
|
-
ActionGroup.prototype.getClassNames = function () {
|
|
38
|
-
return (0, kendo_react_common_1.classNames)('k-quick-replies');
|
|
39
|
-
};
|
|
40
|
-
return ActionGroup;
|
|
41
|
-
}(SelectableItemsContainer_1.SelectableItemsContainer));
|
|
42
|
-
exports.default = ActionGroup;
|
|
@@ -1,70 +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 FocusableUponSelection_1 = require("./base/FocusableUponSelection");
|
|
21
|
-
/**
|
|
22
|
-
* @hidden
|
|
23
|
-
*/
|
|
24
|
-
var Attachment = /** @class */ (function (_super) {
|
|
25
|
-
__extends(Attachment, _super);
|
|
26
|
-
function Attachment() {
|
|
27
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
-
}
|
|
29
|
-
Attachment.prototype.render = function () {
|
|
30
|
-
var _this = this;
|
|
31
|
-
return (React.createElement("div", { className: this.getClassNames(), tabIndex: this.getTabIndexValue(), onClick: this.props.onClick, ref: function (el) { return _this.elementToFocus = el; } }, this.props.template ?
|
|
32
|
-
React.createElement(this.props.template, { item: this.props.item }) :
|
|
33
|
-
(React.createElement("div", { className: "k-card" },
|
|
34
|
-
React.createElement("div", { className: "k-card-body" },
|
|
35
|
-
this.getTitleView(),
|
|
36
|
-
this.getSubtitleView(),
|
|
37
|
-
this.getContentView())))));
|
|
38
|
-
};
|
|
39
|
-
Attachment.prototype.getTabIndexValue = function () {
|
|
40
|
-
if (this.props.tabbable === undefined) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
else if (this.props.tabbable) {
|
|
44
|
-
return 0;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
return -1;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
Attachment.prototype.getClassNames = function () {
|
|
51
|
-
return (0, kendo_react_common_1.classNames)({ 'k-selected': this.props.selected }, { 'k-focus': this.props.selected }, { 'k-first': this.props.isFirstItemInGroup }, { 'k-last': this.props.isLastItemInGroup });
|
|
52
|
-
};
|
|
53
|
-
Attachment.prototype.getTitleView = function () {
|
|
54
|
-
return this.props.item.title ?
|
|
55
|
-
React.createElement("h5", { className: "k-card-title" }, this.props.item.title) :
|
|
56
|
-
null;
|
|
57
|
-
};
|
|
58
|
-
Attachment.prototype.getSubtitleView = function () {
|
|
59
|
-
return this.props.item.subtitle ?
|
|
60
|
-
React.createElement("h6", { className: "k-card-subtitle" }, this.props.item.subtitle) :
|
|
61
|
-
null;
|
|
62
|
-
};
|
|
63
|
-
Attachment.prototype.getContentView = function () {
|
|
64
|
-
return this.props.item.contentType.indexOf('image/') === 0 ?
|
|
65
|
-
React.createElement("img", { src: this.props.item.content }) :
|
|
66
|
-
this.props.item.content;
|
|
67
|
-
};
|
|
68
|
-
return Attachment;
|
|
69
|
-
}(FocusableUponSelection_1.FocusableUponSelection));
|
|
70
|
-
exports.default = Attachment;
|
|
@@ -1,94 +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_svg_icons_1 = require("@progress/kendo-svg-icons");
|
|
21
|
-
var Attachment_1 = require("./Attachment");
|
|
22
|
-
var SelectableItemsContainer_1 = require("./base/SelectableItemsContainer");
|
|
23
|
-
var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
24
|
-
/**
|
|
25
|
-
* @hidden
|
|
26
|
-
*/
|
|
27
|
-
var AttachmentGroup = /** @class */ (function (_super) {
|
|
28
|
-
__extends(AttachmentGroup, _super);
|
|
29
|
-
function AttachmentGroup() {
|
|
30
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
31
|
-
}
|
|
32
|
-
AttachmentGroup.prototype.render = function () {
|
|
33
|
-
var _this = this;
|
|
34
|
-
var isCardDeckLayout = this.isCardDeckLayout(this.props);
|
|
35
|
-
var viewWithoutScrollButtons = (React.createElement("div", { className: this.getClassNames(), onKeyDown: isCardDeckLayout ? undefined : this.onKeyDown }, this.props.group.attachments.map(function (item, index) {
|
|
36
|
-
return (React.createElement(Attachment_1.default, { item: item, template: _this.props.itemTemplate, selected: index === _this.state.selectedItemIndex, tabbable: _this.props.isLastGroup && index === _this.state.selectedItemIndex, isFirstItemInGroup: index === 0, isLastItemInGroup: index === _this.getLastItemIndex(), onClick: function () { return _this.onAttachmentClick(index); }, key: index }));
|
|
37
|
-
})));
|
|
38
|
-
if (isCardDeckLayout) {
|
|
39
|
-
return (React.createElement("div", { className: "k-card-deck-scrollwrap", onKeyDown: this.onKeyDown },
|
|
40
|
-
this.getLeftScrollBtn(),
|
|
41
|
-
viewWithoutScrollButtons,
|
|
42
|
-
this.getRightScrollBtn()));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
return viewWithoutScrollButtons;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
Object.defineProperty(AttachmentGroup.prototype, "isKeyboardNavigationLeftRight", {
|
|
49
|
-
// Overriding the default navigation.
|
|
50
|
-
get: function () {
|
|
51
|
-
return this.isCardDeckLayout(this.props);
|
|
52
|
-
},
|
|
53
|
-
enumerable: false,
|
|
54
|
-
configurable: true
|
|
55
|
-
});
|
|
56
|
-
AttachmentGroup.prototype.getLastItemIndex = function () {
|
|
57
|
-
return this.props.group.attachments.length - 1;
|
|
58
|
-
};
|
|
59
|
-
AttachmentGroup.prototype.getLeftScrollBtn = function () {
|
|
60
|
-
var _this = this;
|
|
61
|
-
var result = null;
|
|
62
|
-
if (this.isCardDeckLayout(this.props) && this.state.selectedItemIndex) {
|
|
63
|
-
result = (React.createElement(kendo_react_buttons_1.Button, { icon: "chevron-left", onClick: function () { return _this.onNavigateBtnClick(false); }, svgIcon: kendo_svg_icons_1.chevronLeftIcon }));
|
|
64
|
-
}
|
|
65
|
-
return result;
|
|
66
|
-
};
|
|
67
|
-
AttachmentGroup.prototype.getRightScrollBtn = function () {
|
|
68
|
-
var _this = this;
|
|
69
|
-
var result = null;
|
|
70
|
-
if (this.isCardDeckLayout(this.props) && this.state.selectedItemIndex !== this.getLastItemIndex()) {
|
|
71
|
-
result = (React.createElement(kendo_react_buttons_1.Button, { icon: "chevron-right", onClick: function () { return _this.onNavigateBtnClick(true); }, svgIcon: kendo_svg_icons_1.chevronRightIcon }));
|
|
72
|
-
}
|
|
73
|
-
return result;
|
|
74
|
-
};
|
|
75
|
-
AttachmentGroup.prototype.onAttachmentClick = function (attachmentIndex) {
|
|
76
|
-
this.onRequestContainerSelection();
|
|
77
|
-
this.setState({ selectedItemIndex: attachmentIndex });
|
|
78
|
-
};
|
|
79
|
-
AttachmentGroup.prototype.onNavigateBtnClick = function (incrementSelection) {
|
|
80
|
-
this.onRequestContainerSelection();
|
|
81
|
-
this.navigate(incrementSelection, 1);
|
|
82
|
-
};
|
|
83
|
-
AttachmentGroup.prototype.isCardDeckLayout = function (props) {
|
|
84
|
-
return props.group.attachmentLayout !== 'list';
|
|
85
|
-
};
|
|
86
|
-
AttachmentGroup.prototype.getClassNames = function () {
|
|
87
|
-
return (0, kendo_react_common_1.classNames)({
|
|
88
|
-
'k-card-list': this.props.group.attachmentLayout,
|
|
89
|
-
'k-card-deck': this.isCardDeckLayout(this.props)
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
return AttachmentGroup;
|
|
93
|
-
}(SelectableItemsContainer_1.SelectableItemsContainer));
|
|
94
|
-
exports.default = AttachmentGroup;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import * as PropTypes from 'prop-types';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { ChatState } from './../ChatPropsAndState';
|
|
4
|
-
import { ChatProps } from './../main';
|
|
5
|
-
import { ChatMessage } from './ChatMessage';
|
|
6
|
-
/**
|
|
7
|
-
* Represents the [KendoReact Chat component]({% slug overview_convui %}).
|
|
8
|
-
*/
|
|
9
|
-
export declare class Chat extends React.Component<ChatProps, ChatState> {
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
static propTypes: {
|
|
14
|
-
messages: PropTypes.Requireable<(object | null | undefined)[]>;
|
|
15
|
-
user: PropTypes.Requireable<object>;
|
|
16
|
-
messageTemplate: PropTypes.Requireable<any>;
|
|
17
|
-
attachmentTemplate: PropTypes.Requireable<any>;
|
|
18
|
-
width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
19
|
-
onMessageSend: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
-
onActionExecute: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
|
-
dir: PropTypes.Requireable<string>;
|
|
22
|
-
messageBox: PropTypes.Requireable<any>;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* @hidden
|
|
26
|
-
*/
|
|
27
|
-
static defaultProps: {
|
|
28
|
-
messages: never[];
|
|
29
|
-
dateFormat: string;
|
|
30
|
-
message: typeof ChatMessage;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* @hidden
|
|
34
|
-
*/
|
|
35
|
-
readonly state: ChatState;
|
|
36
|
-
private chatWrapperEl;
|
|
37
|
-
private viewItemsWrapperEl;
|
|
38
|
-
private newMsgComp;
|
|
39
|
-
private timeoutIdForChatLosingFocus;
|
|
40
|
-
private nextTickId;
|
|
41
|
-
private viewItems;
|
|
42
|
-
private isDirectionRightToLeft;
|
|
43
|
-
private scrollToBottomOnLoadingData;
|
|
44
|
-
constructor(props: ChatProps);
|
|
45
|
-
/**
|
|
46
|
-
* @hidden
|
|
47
|
-
*/
|
|
48
|
-
render(): JSX.Element;
|
|
49
|
-
/**
|
|
50
|
-
* @hidden
|
|
51
|
-
*/
|
|
52
|
-
componentDidMount(): void;
|
|
53
|
-
/**
|
|
54
|
-
* @hidden
|
|
55
|
-
*/
|
|
56
|
-
componentWillUnmount(): void;
|
|
57
|
-
/**
|
|
58
|
-
* @hidden
|
|
59
|
-
*/
|
|
60
|
-
componentDidUpdate(prevProps: ChatProps): void;
|
|
61
|
-
private getClassNames;
|
|
62
|
-
private checkIsDirectionRightToLeft;
|
|
63
|
-
private onFocus;
|
|
64
|
-
private onBlur;
|
|
65
|
-
private onSelectionRequested;
|
|
66
|
-
private onKeyDown;
|
|
67
|
-
private renderViewItems;
|
|
68
|
-
private onMessageSend;
|
|
69
|
-
private onActionExecute;
|
|
70
|
-
private scrollViewItemsToBottom;
|
|
71
|
-
private getViewItemsFromMsgs;
|
|
72
|
-
}
|