@progress/kendo-react-conversational-ui 12.3.0-develop.1 → 12.3.0-develop.3
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/chat/components/ActionGroup.js +1 -1
- package/chat/components/ActionGroup.mjs +55 -34
- package/chat/components/Attachment.js +1 -1
- package/chat/components/Attachment.mjs +16 -9
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +359 -278
- package/chat/components/ChatMessage.js +1 -1
- package/chat/components/ChatMessage.mjs +159 -147
- package/chat/components/Header.js +1 -1
- package/chat/components/Header.mjs +1 -1
- package/chat/components/MessageGroup.js +1 -1
- package/chat/components/MessageGroup.mjs +82 -61
- package/chat/components/NewMessage.js +1 -1
- package/chat/components/NewMessage.mjs +63 -59
- package/chat/components/ScrollButtonsWrapper.js +8 -0
- package/chat/components/ScrollButtonsWrapper.mjs +58 -0
- package/chat/components/SuggestionsGroup.js +1 -1
- package/chat/components/SuggestionsGroup.mjs +58 -18
- package/chat/components/elements/FileBox.js +1 -1
- package/chat/components/elements/FileBox.mjs +31 -37
- package/chat/components/elements/PinnedMessage.js +1 -1
- package/chat/components/elements/PinnedMessage.mjs +5 -4
- package/chat/hooks/useScrollWithButtons.js +8 -0
- package/chat/hooks/useScrollWithButtons.mjs +46 -0
- package/chat/utils/fieldMapping.js +1 -1
- package/chat/utils/fieldMapping.mjs +1 -1
- package/chat/utils/messageSettings.js +8 -0
- package/chat/utils/messageSettings.mjs +31 -0
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/index.d.mts +199 -5
- package/index.d.ts +199 -5
- package/messages/index.js +1 -1
- package/messages/index.mjs +26 -22
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -11
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("react"),g=require("@progress/kendo-react-common"),$=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons"),B=require("@progress/kendo-react-intl"),ee=require("@progress/kendo-react-layout"),r=require("../utils.js"),fe=require("./ChatContext.js"),pe=require("./elements/FileBox.js"),l=require("../../messages/index.js");function ge(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const n in c)if(n!=="default"){const d=Object.getOwnPropertyDescriptor(c,n);Object.defineProperty(i,n,d.get?d:{enumerable:!0,get:()=>c[n]})}}return i.default=c,Object.freeze(i)}const t=ge(me),j=t.forwardRef((c,i)=>{const{item:n,template:d,contentTemplate:D,onRequestSelection:b,tabIndex:te=-1,dateFormat:z="g",selected:o,allowMessageCollapse:k,messageToolbarActions:C,messageContextMenuActions:y,fileActions:K,isSender:x}=c,{setReplyToMessage:h,messages:W,user:p,internalScrollContainerRef:E,onToolbarAction:N,onContextMenuAction:S,onFileAction:_,onDownload:m,setShowCopyNotification:I,statusTemplate:A,timestampVisibility:R="onFocus"}=fe.useChatContext(),[H,F]=t.useState(!1),[U,q]=t.useState(!1),[w,ne]=t.useState(!0),[se,X]=t.useState(!1),u=B.useLocalization(),Y=t.useRef({left:0,top:0}),M=t.useCallback(()=>{n!=null&&n.text&&r.copyToClipboard(n.text),I&&(I(!0),setTimeout(()=>{I(!1)},3e3))},[n,I]),L=t.useCallback(e=>{e.stopPropagation(),ne(s=>!s)},[]),ae=t.useCallback(()=>{X(!1)},[]),le=t.useCallback(e=>{(e.key==="Tab"||e.key==="Enter"||e.key===" "||e.key==="ArrowUp"||e.key==="ArrowDown")&&X(!0)},[]),V=t.useRef(null);t.useEffect(()=>{o&&V.current&&V.current.focus()},[o]);const O=t.useCallback(e=>{Y.current={left:e.pageX,top:e.pageY},e.preventDefault(),q(!0),F(!0)},[]),G=t.useCallback(()=>{q(!1),F(!1)},[]),v=t.useCallback((e,s)=>e.isDeleted?r.getDeletedMessageText(s,u):e.text?e.text:"",[u]),J=t.useCallback(e=>{var s;(s=e.item)!=null&&s.text&&(e.item.data.id==="copy"&&!n.isDeleted?M():e.item.data.id==="reply"&&h(n),S&&S(e.item.data,e,n)),q(!1),F(!1)},[n,S,h,M]),Q=t.useCallback(()=>{if(n.replyToId){const e=r.getMessageById(W,n.replyToId);if(e){const s=a=>{a.preventDefault(),a.stopPropagation();const T=E==null?void 0:E.current;r.scrollToMessageById(e.id,T)};return t.createElement("div",{className:g.classNames("k-message-reference",r.isAuthor(p,e)?"k-message-reference-sender":"k-message-reference-receiver"),onClick:s},t.createElement("div",{className:"k-message-reference-content"},r.convertTextToLinkedContent(v(e,r.isAuthor(p,e)))))}}return null},[n.replyToId,W,p,v,E]),P=t.useCallback(()=>{const e=[{id:"reply",label:"Reply",svgIcon:f.undoIcon},{id:"copy",label:"Copy",svgIcon:f.copyIcon}],s=y?[...e.map(a=>y.find(de=>de.id===a.id)||a),...y.filter(a=>!e.some(T=>T.id===a.id))]:e;return t.createElement(ee.ContextMenu,{onSelect:J,onClose:G,vertical:!0,show:H,offset:Y.current},s.map(a=>a.id==="delete"&&!x?null:t.createElement(ee.MenuItem,{key:a.id,text:a.label,icon:a.icon,svgIcon:a.svgIcon,data:a})))},[y,J,G,H,x]),Z=t.useCallback(()=>n.files&&n.files.length>1?t.createElement("div",{className:"k-chat-download-button-wrapper"},t.createElement($.Button,{className:"k-chat-download-button",fillMode:"flat",themeColor:"base",svgIcon:f.downloadIcon,onClick:e=>{e.stopPropagation(),m&&m(n.files,n)},"aria-label":u.toLanguageString(l.downloadAllFiles,l.messages[l.downloadAllFiles])},t.createElement("span",{className:"k-button-text"},u.toLanguageString(l.downloadAll,l.messages[l.downloadAll])))):null,[n,m,u]),oe=t.useCallback(()=>{if(n.typing)return t.createElement("div",{className:"k-chat-bubble k-bubble"},t.createElement("div",{className:"k-bubble-content"},t.createElement("div",{className:"k-typing-indicator"},t.createElement("span",null),t.createElement("span",null),t.createElement("span",null))));if(d){const e=d;return t.createElement(t.Fragment,null,t.createElement(e,{item:n}),P())}else if(n.text||n.files&&n.files.length>0)return t.createElement(t.Fragment,null,t.createElement("div",{className:g.classNames("k-chat-bubble","k-bubble",{"k-bubble-expandable":k,"k-expanded":k&&w,"k-selected":o,"k-active":U}),onClick:()=>b(o?void 0:n.selectionIndex),onContextMenu:O},t.createElement("div",{className:"k-bubble-content"},D?t.createElement(D,{item:n}):t.createElement(t.Fragment,null,(n.text||n.isDeleted||n.replyToId)&&t.createElement("span",{className:"k-chat-bubble-text"},!n.isDeleted&&Q(),r.convertTextToLinkedContent(v(n,r.isAuthor(p,n)))),n.files&&n.files.length>0&&t.createElement(pe,{files:n.files,message:n,onFileAction:_,onDownload:e=>m==null?void 0:m(e,n),renderInTextarea:!1,fileActions:K}),Z())),k&&t.createElement("span",{className:"k-bubble-expandable-indicator",onClick:L,role:"button","aria-label":w?u.toLanguageString(l.collapseMessage,l.messages[l.collapseMessage]):u.toLanguageString(l.expandMessage,l.messages[l.expandMessage]),tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),L(e))}},t.createElement(g.IconWrap,{icon:w?f.chevronUpIcon:f.chevronDownIcon,size:"medium"}))),P());return null},[n,d,D,k,w,o,U,b,O,Q,v,p,_,K,Z,L,u,P,m]),ce=t.useCallback(()=>{let e=null;if(n.timestamp){const s=R==="onFocus"&&o;R==="hidden"||(e=t.createElement("time",{className:"k-message-time","aria-hidden":!s},B.provideIntlService({props:c}).formatDate(n.timestamp,z)))}return e},[n.timestamp,o,z,c,R]),re=t.useCallback(()=>{let e=null;return n.status&&o&&(A?e=t.createElement(A,{item:n}):e=t.createElement("span",{className:"k-message-status"},t.createElement(g.IconWrap,{icon:f.checkCircleIcon,size:"xsmall"}),n.status)),e},[n,o,A]),ie=t.useCallback(()=>g.classNames({"k-focus":o,"k-message-removed":n.isDeleted},"k-message"),[o,n.isDeleted]),ue=t.useCallback(()=>C&&C.length>0&&t.createElement("div",{className:"k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat"},C.map(e=>e.id==="delete"&&!x?null:t.createElement($.Button,{key:e.id,fillMode:"flat",className:"k-toolbar-button",themeColor:"base",icon:e.icon,svgIcon:e.svgIcon,onClick:s=>{s.stopPropagation(),e.id==="copy"&&!n.isDeleted?M():e.id==="reply"&&h(n),N&&N(e,s,n)},onMouseDown:s=>s.preventDefault()}))),[M,x,n,C,N,h]);return t.createElement("div",{"data-message-id":n.id,className:ie(),tabIndex:te,onMouseDown:ae,onKeyDown:le,onFocus:e=>{se&&b(n.selectionIndex)},ref:e=>{V.current=e,typeof i=="function"?i(e):i&&(i.current=e)},onContextMenu:d?O:void 0},ce(),oe(),re(),ue())});j.displayName="ChatMessage";class be extends t.Component{render(){return t.createElement(j,{...this.props})}}B.registerForIntl(be);exports.ChatMessage=j;
|
|
@@ -6,227 +6,238 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import { classNames as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { downloadIcon as
|
|
12
|
-
import { useLocalization as
|
|
13
|
-
import { ContextMenu as
|
|
14
|
-
import { copyToClipboard as
|
|
15
|
-
import { useChatContext as
|
|
16
|
-
import
|
|
17
|
-
import { downloadAllFiles as
|
|
18
|
-
const
|
|
9
|
+
import { classNames as K, IconWrap as J } from "@progress/kendo-react-common";
|
|
10
|
+
import { Button as Q } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { downloadIcon as be, chevronUpIcon as ge, chevronDownIcon as ke, checkCircleIcon as Ce, undoIcon as ye, copyIcon as Ee } from "@progress/kendo-svg-icons";
|
|
12
|
+
import { useLocalization as xe, provideIntlService as he, registerForIntl as Ie } from "@progress/kendo-react-intl";
|
|
13
|
+
import { ContextMenu as we, MenuItem as ve } from "@progress/kendo-react-layout";
|
|
14
|
+
import { copyToClipboard as Me, getDeletedMessageText as Te, getMessageById as De, isAuthor as z, convertTextToLinkedContent as Z, scrollToMessageById as Ne } from "../utils.mjs";
|
|
15
|
+
import { useChatContext as Se } from "./ChatContext.mjs";
|
|
16
|
+
import Ae from "./elements/FileBox.mjs";
|
|
17
|
+
import { downloadAllFiles as _, messages as w, downloadAll as ee, collapseMessage as te, expandMessage as ae } from "../../messages/index.mjs";
|
|
18
|
+
const ne = t.forwardRef(
|
|
19
19
|
(i, u) => {
|
|
20
20
|
const {
|
|
21
21
|
item: a,
|
|
22
|
-
template:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
template: m,
|
|
23
|
+
contentTemplate: v,
|
|
24
|
+
onRequestSelection: d,
|
|
25
|
+
tabIndex: se = -1,
|
|
26
|
+
dateFormat: B = "g",
|
|
26
27
|
selected: l,
|
|
27
|
-
allowMessageCollapse:
|
|
28
|
-
messageToolbarActions:
|
|
29
|
-
messageContextMenuActions:
|
|
30
|
-
|
|
28
|
+
allowMessageCollapse: p,
|
|
29
|
+
messageToolbarActions: f,
|
|
30
|
+
messageContextMenuActions: b,
|
|
31
|
+
fileActions: P,
|
|
32
|
+
isSender: g
|
|
31
33
|
} = i, {
|
|
32
|
-
setReplyToMessage:
|
|
33
|
-
messages:
|
|
34
|
+
setReplyToMessage: k,
|
|
35
|
+
messages: W,
|
|
34
36
|
user: c,
|
|
35
|
-
internalScrollContainerRef:
|
|
37
|
+
internalScrollContainerRef: C,
|
|
36
38
|
onToolbarAction: M,
|
|
37
|
-
onContextMenuAction:
|
|
38
|
-
onFileAction:
|
|
39
|
+
onContextMenuAction: T,
|
|
40
|
+
onFileAction: H,
|
|
39
41
|
onDownload: r,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} =
|
|
44
|
-
a != null && a.text &&
|
|
45
|
-
|
|
42
|
+
setShowCopyNotification: y,
|
|
43
|
+
statusTemplate: D,
|
|
44
|
+
timestampVisibility: N = "onFocus"
|
|
45
|
+
} = Se(), [O, S] = t.useState(!1), [U, A] = t.useState(!1), [E, le] = t.useState(!0), [oe, q] = t.useState(!1), o = xe(), X = t.useRef({ left: 0, top: 0 }), x = t.useCallback(() => {
|
|
46
|
+
a != null && a.text && Me(a.text), y && (y(!0), setTimeout(() => {
|
|
47
|
+
y(!1);
|
|
46
48
|
}, 3e3));
|
|
47
|
-
}, [a,
|
|
48
|
-
e.stopPropagation(),
|
|
49
|
-
}, []),
|
|
50
|
-
|
|
51
|
-
}, []),
|
|
52
|
-
(e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") &&
|
|
53
|
-
}, []),
|
|
49
|
+
}, [a, y]), F = t.useCallback((e) => {
|
|
50
|
+
e.stopPropagation(), le((n) => !n);
|
|
51
|
+
}, []), re = t.useCallback(() => {
|
|
52
|
+
q(!1);
|
|
53
|
+
}, []), ce = t.useCallback((e) => {
|
|
54
|
+
(e.key === "Tab" || e.key === "Enter" || e.key === " " || e.key === "ArrowUp" || e.key === "ArrowDown") && q(!0);
|
|
55
|
+
}, []), R = t.useRef(null);
|
|
54
56
|
t.useEffect(() => {
|
|
55
|
-
l &&
|
|
57
|
+
l && R.current && R.current.focus();
|
|
56
58
|
}, [l]);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
}, []),
|
|
60
|
-
|
|
61
|
-
}, []),
|
|
62
|
-
(e,
|
|
59
|
+
const V = t.useCallback((e) => {
|
|
60
|
+
X.current = { left: e.pageX, top: e.pageY }, e.preventDefault(), A(!0), S(!0);
|
|
61
|
+
}, []), Y = t.useCallback(() => {
|
|
62
|
+
A(!1), S(!1);
|
|
63
|
+
}, []), h = t.useCallback(
|
|
64
|
+
(e, n) => e.isDeleted ? Te(n, o) : e.text ? e.text : "",
|
|
63
65
|
[o]
|
|
64
|
-
),
|
|
66
|
+
), $ = t.useCallback(
|
|
65
67
|
(e) => {
|
|
66
|
-
var
|
|
67
|
-
(
|
|
68
|
+
var n;
|
|
69
|
+
(n = e.item) != null && n.text && (e.item.data.id === "copy" && !a.isDeleted ? x() : e.item.data.id === "reply" && k(a), T && T(e.item.data, e, a)), A(!1), S(!1);
|
|
68
70
|
},
|
|
69
|
-
[a,
|
|
70
|
-
),
|
|
71
|
+
[a, T, k, x]
|
|
72
|
+
), j = t.useCallback(() => {
|
|
71
73
|
if (a.replyToId) {
|
|
72
|
-
const e =
|
|
74
|
+
const e = De(W, a.replyToId);
|
|
73
75
|
if (e) {
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
76
|
+
const n = (s) => {
|
|
77
|
+
s.preventDefault(), s.stopPropagation();
|
|
78
|
+
const I = C == null ? void 0 : C.current;
|
|
79
|
+
Ne(e.id, I);
|
|
78
80
|
};
|
|
79
81
|
return /* @__PURE__ */ t.createElement(
|
|
80
82
|
"div",
|
|
81
83
|
{
|
|
82
|
-
className:
|
|
84
|
+
className: K(
|
|
83
85
|
"k-message-reference",
|
|
84
|
-
|
|
86
|
+
z(c, e) ? "k-message-reference-sender" : "k-message-reference-receiver"
|
|
85
87
|
),
|
|
86
|
-
onClick:
|
|
88
|
+
onClick: n
|
|
87
89
|
},
|
|
88
|
-
/* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" },
|
|
89
|
-
|
|
90
|
+
/* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, Z(
|
|
91
|
+
h(e, z(c, e))
|
|
90
92
|
))
|
|
91
93
|
);
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
return null;
|
|
95
|
-
}, [a.replyToId,
|
|
97
|
+
}, [a.replyToId, W, c, h, C]), L = t.useCallback(() => {
|
|
96
98
|
const e = [
|
|
97
99
|
{
|
|
98
100
|
id: "reply",
|
|
99
101
|
label: "Reply",
|
|
100
|
-
svgIcon:
|
|
102
|
+
svgIcon: ye
|
|
101
103
|
},
|
|
102
104
|
{
|
|
103
105
|
id: "copy",
|
|
104
106
|
label: "Copy",
|
|
105
|
-
svgIcon:
|
|
107
|
+
svgIcon: Ee
|
|
106
108
|
}
|
|
107
|
-
],
|
|
108
|
-
...e.map((
|
|
109
|
-
(
|
|
110
|
-
) ||
|
|
111
|
-
...
|
|
112
|
-
(
|
|
109
|
+
], n = b ? [
|
|
110
|
+
...e.map((s) => b.find(
|
|
111
|
+
(fe) => fe.id === s.id
|
|
112
|
+
) || s),
|
|
113
|
+
...b.filter(
|
|
114
|
+
(s) => !e.some((I) => I.id === s.id)
|
|
113
115
|
)
|
|
114
116
|
] : e;
|
|
115
117
|
return /* @__PURE__ */ t.createElement(
|
|
116
|
-
|
|
118
|
+
we,
|
|
117
119
|
{
|
|
118
|
-
onSelect:
|
|
119
|
-
onClose:
|
|
120
|
+
onSelect: $,
|
|
121
|
+
onClose: Y,
|
|
120
122
|
vertical: !0,
|
|
121
|
-
show:
|
|
122
|
-
offset:
|
|
123
|
+
show: O,
|
|
124
|
+
offset: X.current
|
|
123
125
|
},
|
|
124
|
-
|
|
125
|
-
(
|
|
126
|
-
|
|
126
|
+
n.map(
|
|
127
|
+
(s) => s.id === "delete" && !g ? null : /* @__PURE__ */ t.createElement(
|
|
128
|
+
ve,
|
|
127
129
|
{
|
|
128
|
-
key:
|
|
129
|
-
text:
|
|
130
|
-
icon:
|
|
131
|
-
svgIcon:
|
|
132
|
-
data:
|
|
130
|
+
key: s.id,
|
|
131
|
+
text: s.label,
|
|
132
|
+
icon: s.icon,
|
|
133
|
+
svgIcon: s.svgIcon,
|
|
134
|
+
data: s
|
|
133
135
|
}
|
|
134
136
|
)
|
|
135
137
|
)
|
|
136
138
|
);
|
|
137
|
-
}, [
|
|
138
|
-
|
|
139
|
+
}, [b, $, Y, O, g]), G = t.useCallback(() => a.files && a.files.length > 1 ? /* @__PURE__ */ t.createElement("div", { className: "k-chat-download-button-wrapper" }, /* @__PURE__ */ t.createElement(
|
|
140
|
+
Q,
|
|
139
141
|
{
|
|
140
142
|
className: "k-chat-download-button",
|
|
141
143
|
fillMode: "flat",
|
|
142
144
|
themeColor: "base",
|
|
143
|
-
svgIcon:
|
|
145
|
+
svgIcon: be,
|
|
144
146
|
onClick: (e) => {
|
|
145
147
|
e.stopPropagation(), r && r(a.files, a);
|
|
146
148
|
},
|
|
147
149
|
"aria-label": o.toLanguageString(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
_,
|
|
151
|
+
w[_]
|
|
150
152
|
)
|
|
151
153
|
},
|
|
152
|
-
/* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, o.toLanguageString(
|
|
153
|
-
)) : null, [a, r, o]),
|
|
154
|
+
/* @__PURE__ */ t.createElement("span", { className: "k-button-text" }, o.toLanguageString(ee, w[ee]))
|
|
155
|
+
)) : null, [a, r, o]), ie = t.useCallback(() => {
|
|
154
156
|
if (a.typing)
|
|
155
|
-
return /* @__PURE__ */ t.createElement("div", { className: "k-bubble k-
|
|
156
|
-
if (
|
|
157
|
-
const e =
|
|
158
|
-
return /* @__PURE__ */ t.createElement(e, { item: a });
|
|
157
|
+
return /* @__PURE__ */ t.createElement("div", { className: "k-chat-bubble k-bubble" }, /* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, /* @__PURE__ */ t.createElement("div", { className: "k-typing-indicator" }, /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null), /* @__PURE__ */ t.createElement("span", null))));
|
|
158
|
+
if (m) {
|
|
159
|
+
const e = m;
|
|
160
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(e, { item: a }), L());
|
|
159
161
|
} else if (a.text || a.files && a.files.length > 0)
|
|
160
162
|
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
161
163
|
"div",
|
|
162
164
|
{
|
|
163
|
-
className:
|
|
164
|
-
"k-bubble-expandable":
|
|
165
|
-
"k-expanded":
|
|
165
|
+
className: K("k-chat-bubble", "k-bubble", {
|
|
166
|
+
"k-bubble-expandable": p,
|
|
167
|
+
"k-expanded": p && E,
|
|
166
168
|
"k-selected": l,
|
|
167
|
-
"k-active":
|
|
169
|
+
"k-active": U
|
|
168
170
|
}),
|
|
169
|
-
onClick: () =>
|
|
170
|
-
onContextMenu:
|
|
171
|
+
onClick: () => d(l ? void 0 : a.selectionIndex),
|
|
172
|
+
onContextMenu: V
|
|
171
173
|
},
|
|
172
|
-
/* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, /* @__PURE__ */ t.createElement(
|
|
173
|
-
|
|
174
|
+
/* @__PURE__ */ t.createElement("div", { className: "k-bubble-content" }, v ? /* @__PURE__ */ t.createElement(v, { item: a }) : /* @__PURE__ */ t.createElement(t.Fragment, null, (a.text || a.isDeleted || a.replyToId) && /* @__PURE__ */ t.createElement("span", { className: "k-chat-bubble-text" }, !a.isDeleted && j(), Z(
|
|
175
|
+
h(a, z(c, a))
|
|
176
|
+
)), a.files && a.files.length > 0 && /* @__PURE__ */ t.createElement(
|
|
177
|
+
Ae,
|
|
174
178
|
{
|
|
175
179
|
files: a.files,
|
|
176
180
|
message: a,
|
|
177
|
-
onFileAction:
|
|
181
|
+
onFileAction: H,
|
|
178
182
|
onDownload: (e) => r == null ? void 0 : r(e, a),
|
|
179
183
|
renderInTextarea: !1,
|
|
180
|
-
fileActions:
|
|
184
|
+
fileActions: P
|
|
181
185
|
}
|
|
182
|
-
),
|
|
183
|
-
|
|
186
|
+
), G())),
|
|
187
|
+
p && /* @__PURE__ */ t.createElement(
|
|
184
188
|
"span",
|
|
185
189
|
{
|
|
186
190
|
className: "k-bubble-expandable-indicator",
|
|
187
|
-
onClick:
|
|
191
|
+
onClick: F,
|
|
188
192
|
role: "button",
|
|
189
|
-
"aria-label":
|
|
190
|
-
|
|
191
|
-
|
|
193
|
+
"aria-label": E ? o.toLanguageString(
|
|
194
|
+
te,
|
|
195
|
+
w[te]
|
|
192
196
|
) : o.toLanguageString(
|
|
193
|
-
|
|
194
|
-
|
|
197
|
+
ae,
|
|
198
|
+
w[ae]
|
|
195
199
|
),
|
|
196
200
|
tabIndex: 0,
|
|
197
201
|
onKeyDown: (e) => {
|
|
198
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
202
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), F(e));
|
|
199
203
|
}
|
|
200
204
|
},
|
|
201
|
-
/* @__PURE__ */ t.createElement(
|
|
205
|
+
/* @__PURE__ */ t.createElement(J, { icon: E ? ge : ke, size: "medium" })
|
|
202
206
|
)
|
|
203
|
-
),
|
|
207
|
+
), L());
|
|
204
208
|
return null;
|
|
205
209
|
}, [
|
|
206
210
|
a,
|
|
207
|
-
I,
|
|
208
211
|
m,
|
|
209
|
-
|
|
212
|
+
v,
|
|
213
|
+
p,
|
|
214
|
+
E,
|
|
210
215
|
l,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
x,
|
|
214
|
-
c,
|
|
216
|
+
U,
|
|
217
|
+
d,
|
|
215
218
|
V,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
+
j,
|
|
220
|
+
h,
|
|
221
|
+
c,
|
|
222
|
+
H,
|
|
223
|
+
P,
|
|
224
|
+
G,
|
|
225
|
+
F,
|
|
219
226
|
o,
|
|
220
|
-
|
|
227
|
+
L,
|
|
221
228
|
r
|
|
222
|
-
]),
|
|
229
|
+
]), ue = t.useCallback(() => {
|
|
223
230
|
let e = null;
|
|
224
|
-
|
|
225
|
-
|
|
231
|
+
if (a.timestamp) {
|
|
232
|
+
const n = N === "onFocus" && l;
|
|
233
|
+
N === "hidden" || (e = /* @__PURE__ */ t.createElement("time", { className: "k-message-time", "aria-hidden": !n }, he({ props: i }).formatDate(a.timestamp, B)));
|
|
234
|
+
}
|
|
235
|
+
return e;
|
|
236
|
+
}, [a.timestamp, l, B, i, N]), me = t.useCallback(() => {
|
|
226
237
|
let e = null;
|
|
227
|
-
return a.status && l && (
|
|
228
|
-
}, [a, l,
|
|
229
|
-
|
|
238
|
+
return a.status && l && (D ? e = t.createElement(D, { item: a }) : e = /* @__PURE__ */ t.createElement("span", { className: "k-message-status" }, /* @__PURE__ */ t.createElement(J, { icon: Ce, size: "xsmall" }), a.status)), e;
|
|
239
|
+
}, [a, l, D]), de = t.useCallback(() => K({ "k-focus": l, "k-message-removed": a.isDeleted }, "k-message"), [l, a.isDeleted]), pe = t.useCallback(() => f && f.length > 0 && /* @__PURE__ */ t.createElement("div", { className: "k-chat-message-toolbar k-toolbar k-toolbar-md k-toolbar-flat" }, f.map((e) => e.id === "delete" && !g ? null : /* @__PURE__ */ t.createElement(
|
|
240
|
+
Q,
|
|
230
241
|
{
|
|
231
242
|
key: e.id,
|
|
232
243
|
fillMode: "flat",
|
|
@@ -234,41 +245,42 @@ const ee = t.forwardRef(
|
|
|
234
245
|
themeColor: "base",
|
|
235
246
|
icon: e.icon,
|
|
236
247
|
svgIcon: e.svgIcon,
|
|
237
|
-
onClick: (
|
|
238
|
-
|
|
248
|
+
onClick: (n) => {
|
|
249
|
+
n.stopPropagation(), e.id === "copy" && !a.isDeleted ? x() : e.id === "reply" && k(a), M && M(e, n, a);
|
|
239
250
|
},
|
|
240
|
-
onMouseDown: (
|
|
251
|
+
onMouseDown: (n) => n.preventDefault()
|
|
241
252
|
}
|
|
242
|
-
))), [
|
|
253
|
+
))), [x, g, a, f, M, k]);
|
|
243
254
|
return /* @__PURE__ */ t.createElement(
|
|
244
255
|
"div",
|
|
245
256
|
{
|
|
246
257
|
"data-message-id": a.id,
|
|
247
|
-
className:
|
|
248
|
-
tabIndex:
|
|
249
|
-
onMouseDown:
|
|
250
|
-
onKeyDown:
|
|
258
|
+
className: de(),
|
|
259
|
+
tabIndex: se,
|
|
260
|
+
onMouseDown: re,
|
|
261
|
+
onKeyDown: ce,
|
|
251
262
|
onFocus: (e) => {
|
|
252
|
-
|
|
263
|
+
oe && d(a.selectionIndex);
|
|
253
264
|
},
|
|
254
265
|
ref: (e) => {
|
|
255
|
-
|
|
256
|
-
}
|
|
266
|
+
R.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
|
|
267
|
+
},
|
|
268
|
+
onContextMenu: m ? V : void 0
|
|
257
269
|
},
|
|
258
|
-
|
|
259
|
-
re(),
|
|
270
|
+
ue(),
|
|
260
271
|
ie(),
|
|
261
|
-
me()
|
|
272
|
+
me(),
|
|
273
|
+
pe()
|
|
262
274
|
);
|
|
263
275
|
}
|
|
264
276
|
);
|
|
265
|
-
|
|
266
|
-
class
|
|
277
|
+
ne.displayName = "ChatMessage";
|
|
278
|
+
class Fe extends t.Component {
|
|
267
279
|
render() {
|
|
268
|
-
return /* @__PURE__ */ t.createElement(
|
|
280
|
+
return /* @__PURE__ */ t.createElement(ne, { ...this.props });
|
|
269
281
|
}
|
|
270
282
|
}
|
|
271
|
-
|
|
283
|
+
Ie(Fe);
|
|
272
284
|
export {
|
|
273
|
-
|
|
285
|
+
ne as ChatMessage
|
|
274
286
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";const n=require("@progress/kendo-react-layout"),o=require("react");function a(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const
|
|
8
|
+
"use strict";const n=require("@progress/kendo-react-layout"),o=require("react");function a(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=a(o),s=e=>i.createElement(n.AppBar,{className:"k-chat-header",positionMode:"sticky",themeColor:"inherit"},e.children);module.exports=s;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { AppBar as t } from "@progress/kendo-react-layout";
|
|
9
9
|
import * as r from "react";
|
|
10
|
-
const o = (e) => /* @__PURE__ */ r.createElement(t, { className: "k-chat-header", positionMode: "sticky", themeColor: "
|
|
10
|
+
const o = (e) => /* @__PURE__ */ r.createElement(t, { className: "k-chat-header", positionMode: "sticky", themeColor: "inherit" }, e.children);
|
|
11
11
|
export {
|
|
12
12
|
o as default
|
|
13
13
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";const
|
|
8
|
+
"use strict";const j=require("react"),G=require("@progress/kendo-react-common"),L=require("@progress/kendo-react-layout"),z=require("./Attachment.js"),q=require("../utils.js"),U=require("./ChatContext.js"),_=require("@progress/kendo-react-intl"),u=require("../../messages/index.js");function D(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const s in n)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:()=>n[s]})}}return e.default=n,Object.freeze(e)}const a=D(j),P=n=>{const{group:e,user:s,itemTemplate:r,contentTemplate:i,attachmentTemplate:g,onRequestSelection:d,selectedItemIndex:p,isLastGroup:h,message:v,allowMessageCollapse:f,messageToolbarActions:k,messageContextMenuActions:A,fileActions:E,messageWidthMode:x="standard",showAvatar:l=!0,showUsername:C=!0}=n,{userStatusTemplate:I}=U.useChatContext(),b=_.useLocalization(),m=e.messages.length>0&&q.isAuthor(s,e.messages[0]),{avatarUrl:o,avatarAltText:M,name:N}=e.author,T=a.useMemo(()=>G.classNames("k-message-group",{"k-message-group-sender":m,"k-message-group-receiver":!m,"k-message-group-full-width":x==="full","k-no-avatar":!l||!o}),[m,x,l,o]),w=()=>{if(!l||!o)return;const c=a.createElement(L.Avatar,{type:"image"},a.createElement("img",{src:o,alt:R}));if(I){const t=e.messages[e.messages.length-1];return a.createElement("div",{className:"k-chat-user-status-wrapper"},c,a.createElement("div",{className:"k-chat-user-status"},a.createElement(I,{message:"dataItem"in t?t.dataItem:t})))}return c},y=a.useMemo(()=>{const c=e.messages.length-1;return e.messages.map((t,O)=>{const S=[a.createElement(v,{item:t,template:r,contentTemplate:i,selected:t.selectionIndex===p,onRequestSelection:d,tabIndex:O===c&&h?0:-1,key:t.id,allowMessageCollapse:f,messageToolbarActions:k,messageContextMenuActions:A,fileActions:E,isSender:q.isAuthor(s,t)})];return t.attachments&&t.attachments.length===1&&S.push(a.createElement(z,{item:t.attachments[0],template:g,selected:!1,key:`att-${t.attachments[0].content}`})),S})},[e.messages,v,r,i,p,d,h,f,k,A,E,s,g]),R=M!==void 0?M:b.toLanguageString(u.avatarAlt,u.messages[u.avatarAlt]);return a.createElement("div",{className:T},w(),a.createElement("div",{className:"k-message-group-content"},C&&a.createElement("span",{className:"k-message-author"},N),y))};module.exports=P;
|