@progress/kendo-react-conversational-ui 12.2.1-develop.1 → 12.3.0-develop.10
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,47 +5,87 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { classNames as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import { classNames as m } from "@progress/kendo-react-common";
|
|
10
|
+
import { ScrollButtonsWrapper as R } from "./ScrollButtonsWrapper.mjs";
|
|
11
|
+
import { useScrollWithButtons as E } from "../hooks/useScrollWithButtons.mjs";
|
|
12
|
+
const w = (b) => {
|
|
13
|
+
const {
|
|
14
|
+
suggestions: r,
|
|
15
|
+
onSuggestionClick: l,
|
|
16
|
+
suggestionsView: o,
|
|
17
|
+
suggestionTemplate: s,
|
|
18
|
+
suggestionsLayout: a,
|
|
19
|
+
dir: n
|
|
20
|
+
} = b, i = t.useRef(null), { canScrollLeft: u, canScrollRight: f, scrollLeft: k, scrollRight: y } = E(i, {
|
|
21
|
+
enabled: a === "scrollbuttons",
|
|
22
|
+
dir: n,
|
|
23
|
+
itemsDependency: r
|
|
24
|
+
}), d = t.useCallback(
|
|
25
|
+
(e, c) => {
|
|
26
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), l == null || l(c));
|
|
14
27
|
},
|
|
15
|
-
[
|
|
16
|
-
), p =
|
|
28
|
+
[l]
|
|
29
|
+
), p = t.useCallback(
|
|
17
30
|
() => r.map(
|
|
18
|
-
(e) =>
|
|
19
|
-
|
|
31
|
+
(e) => s ? /* @__PURE__ */ t.createElement(
|
|
32
|
+
s,
|
|
20
33
|
{
|
|
21
34
|
key: e.id,
|
|
22
35
|
suggestion: e,
|
|
23
36
|
onClick: () => {
|
|
24
|
-
|
|
37
|
+
l == null || l(e);
|
|
25
38
|
}
|
|
26
39
|
}
|
|
27
|
-
) : /* @__PURE__ */
|
|
40
|
+
) : /* @__PURE__ */ t.createElement(
|
|
28
41
|
"span",
|
|
29
42
|
{
|
|
30
43
|
role: "button",
|
|
31
44
|
tabIndex: e.disabled ? -1 : 0,
|
|
32
45
|
"aria-label": e.description,
|
|
33
46
|
"aria-disabled": e.disabled,
|
|
34
|
-
onClick: () => !e.disabled && (
|
|
35
|
-
onKeyDown: (
|
|
47
|
+
onClick: () => !e.disabled && (l == null ? void 0 : l(e)),
|
|
48
|
+
onKeyDown: (c) => !e.disabled && d(c, e),
|
|
36
49
|
key: e.id,
|
|
37
50
|
title: e.description,
|
|
38
|
-
className:
|
|
51
|
+
className: m(o === "classic" ? "k-prompt-suggestion" : "k-suggestion", {
|
|
39
52
|
"k-disabled": e.disabled
|
|
40
53
|
})
|
|
41
54
|
},
|
|
42
55
|
e.text
|
|
43
56
|
)
|
|
44
57
|
),
|
|
45
|
-
[r,
|
|
58
|
+
[r, s, l, o, d]
|
|
59
|
+
);
|
|
60
|
+
if (!r || r.length === 0)
|
|
61
|
+
return null;
|
|
62
|
+
if (o === "classic")
|
|
63
|
+
return p();
|
|
64
|
+
const h = /* @__PURE__ */ t.createElement(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
role: "group",
|
|
68
|
+
className: m("k-suggestion-group", {
|
|
69
|
+
// Apply scrollable class when layout is 'scroll' (default for Chat component)
|
|
70
|
+
"k-suggestion-group-scrollable": a === "scroll"
|
|
71
|
+
}),
|
|
72
|
+
ref: a === "scrollbuttons" ? i : void 0
|
|
73
|
+
},
|
|
74
|
+
p()
|
|
75
|
+
);
|
|
76
|
+
return /* @__PURE__ */ t.createElement(
|
|
77
|
+
R,
|
|
78
|
+
{
|
|
79
|
+
visible: a === "scrollbuttons",
|
|
80
|
+
dir: n,
|
|
81
|
+
canScrollLeft: u,
|
|
82
|
+
canScrollRight: f,
|
|
83
|
+
onScrollLeft: k,
|
|
84
|
+
onScrollRight: y
|
|
85
|
+
},
|
|
86
|
+
h
|
|
46
87
|
);
|
|
47
|
-
return !r || r.length === 0 ? null : d === "classic" ? p() : /* @__PURE__ */ l.createElement("div", { role: "group", className: "k-suggestion-group" }, p());
|
|
48
88
|
};
|
|
49
89
|
export {
|
|
50
|
-
|
|
90
|
+
w as SuggestionGroup
|
|
51
91
|
};
|
|
@@ -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 b=require("react"),g=require("@progress/kendo-react-common"),h=require("@progress/kendo-react-buttons"),d=require("@progress/kendo-svg-icons"),w=require("@progress/kendo-react-intl"),r=require("../../../messages/index.js"),F=require("../ChatContext.js");function M(a){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(i,o,s.get?s:{enumerable:!0,get:()=>a[o]})}}return i.default=a,Object.freeze(i)}const n=M(b),N=a=>{const{files:i,onFileRemove:o,onFileAction:s,onDownload:m,fileActions:k,renderInTextarea:I=!1}=a,{messageFilesLayout:u="vertical"}=F.useChatContext(),p=w.useLocalization(),C=[{id:"download",label:"Download",svgIcon:d.downloadIcon}],f=k||C,x=e=>{if(e==null)return"";if(e===0)return"0 B";const t=1024,c=["B","KB","MB","GB","TB"],l=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,l)).toFixed(2))} ${c[l]}`},E=e=>"."+e.split(".").pop()||"",v=(e,t)=>{var c,l;(l=(c=e.syntheticEvent)==null?void 0:c.stopPropagation)==null||l.call(c),e.item.id==="download"&&(m==null||m([t])),s==null||s(e.item,e,t)},B=e=>I?n.createElement(h.Button,{fillMode:"flat",themeColor:"base",svgIcon:d.xIcon,onClick:t=>{t.stopPropagation(),o==null||o(e.name)},"aria-label":`${p.toLanguageString(r.removeFile,r.messages[r.removeFile])} ${e.name}`}):f.length>0&&n.createElement(h.DropDownButton,{fillMode:"flat",themeColor:"base",svgIcon:d.moreVerticalIcon,onClick:t=>{t.syntheticEvent.stopPropagation()},onItemClick:t=>v(t,e),items:f.map(t=>({id:t.id,icon:t.icon,text:t.label,svgIcon:t.svgIcon})),"aria-label":`${p.toLanguageString(r.fileActions,r.messages[r.fileActions])} ${e.name}`}),z=n.useCallback(()=>g.classNames("k-chat-file-wrapper",{"k-chat-files-wrap":u==="wrap","k-chat-files-horizontal":u==="horizontal"}),[u]);return n.createElement("ul",{className:z()},i.map(e=>n.createElement("li",{key:e.name,className:"k-chat-file"},n.createElement(g.IconWrap,{size:"xlarge",...g.getFileExtensionIcon(E(e.name))}),n.createElement("div",{className:"k-chat-file-info"},n.createElement("span",{className:"k-chat-file-name"},e.name),n.createElement("span",{className:"k-chat-file-size"},x(e.size))),B(e))))};module.exports=N;
|
|
@@ -5,68 +5,62 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { IconWrap as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { xIcon as
|
|
12
|
-
import { useLocalization as
|
|
13
|
-
import { removeFile as
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
import * as o from "react";
|
|
9
|
+
import { classNames as z, IconWrap as v, getFileExtensionIcon as w } from "@progress/kendo-react-common";
|
|
10
|
+
import { Button as F, DropDownButton as M } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { xIcon as N, moreVerticalIcon as $, downloadIcon as A } from "@progress/kendo-svg-icons";
|
|
12
|
+
import { useLocalization as L } from "@progress/kendo-react-intl";
|
|
13
|
+
import { removeFile as p, messages as f, fileActions as g } from "../../../messages/index.mjs";
|
|
14
|
+
import { useChatContext as S } from "../ChatContext.mjs";
|
|
15
|
+
const V = (u) => {
|
|
16
|
+
const { files: d, onFileRemove: s, onFileAction: l, onDownload: i, fileActions: h, renderInTextarea: k = !1 } = u, { messageFilesLayout: r = "vertical" } = S(), c = L(), m = h || [{ id: "download", label: "Download", svgIcon: A }], I = (e) => {
|
|
16
17
|
if (e == null)
|
|
17
18
|
return "";
|
|
18
19
|
if (e === 0)
|
|
19
20
|
return "0 B";
|
|
20
|
-
const
|
|
21
|
-
return `${parseFloat((e / Math.pow(
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const t = 1024, a = ["B", "KB", "MB", "GB", "TB"], n = Math.floor(Math.log(e) / Math.log(t));
|
|
22
|
+
return `${parseFloat((e / Math.pow(t, n)).toFixed(2))} ${a[n]}`;
|
|
23
|
+
}, E = (e) => "." + e.split(".").pop() || "", x = (e, t) => {
|
|
24
|
+
var a, n;
|
|
25
|
+
(n = (a = e.syntheticEvent) == null ? void 0 : a.stopPropagation) == null || n.call(a), e.item.id === "download" && (i == null || i([t])), l == null || l(e.item, e, t);
|
|
26
|
+
}, B = (e) => k ? /* @__PURE__ */ o.createElement(
|
|
27
|
+
F,
|
|
26
28
|
{
|
|
27
29
|
fillMode: "flat",
|
|
28
30
|
themeColor: "base",
|
|
29
|
-
svgIcon:
|
|
31
|
+
svgIcon: N,
|
|
30
32
|
onClick: (t) => {
|
|
31
|
-
t.stopPropagation(),
|
|
33
|
+
t.stopPropagation(), s == null || s(e.name);
|
|
32
34
|
},
|
|
33
|
-
"aria-label": `${
|
|
35
|
+
"aria-label": `${c.toLanguageString(p, f[p])} ${e.name}`
|
|
34
36
|
}
|
|
35
|
-
) :
|
|
37
|
+
) : m.length > 0 && /* @__PURE__ */ o.createElement(
|
|
36
38
|
M,
|
|
37
39
|
{
|
|
38
40
|
fillMode: "flat",
|
|
39
41
|
themeColor: "base",
|
|
40
|
-
svgIcon:
|
|
42
|
+
svgIcon: $,
|
|
41
43
|
onClick: (t) => {
|
|
42
44
|
t.syntheticEvent.stopPropagation();
|
|
43
45
|
},
|
|
44
|
-
onItemClick: (t) =>
|
|
46
|
+
onItemClick: (t) => x(t, e),
|
|
45
47
|
items: m.map((t) => ({
|
|
46
48
|
id: t.id,
|
|
47
49
|
icon: t.icon,
|
|
48
50
|
text: t.label,
|
|
49
51
|
svgIcon: t.svgIcon
|
|
50
52
|
})),
|
|
51
|
-
"aria-label": `${
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
"aria-label": `${c.toLanguageString(
|
|
54
|
+
g,
|
|
55
|
+
f[g]
|
|
54
56
|
)} ${e.name}`
|
|
55
57
|
}
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
svgIcon: d,
|
|
62
|
-
onClick: (t) => {
|
|
63
|
-
t.stopPropagation(), o == null || o(e.name);
|
|
64
|
-
},
|
|
65
|
-
"aria-label": `${s.toLanguageString(i, c[i])} ${e.name}`
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
return /* @__PURE__ */ a.createElement("ul", { className: "k-chat-file-wrapper" }, h.map((e) => /* @__PURE__ */ a.createElement("li", { key: e.name, className: "k-chat-file" }, /* @__PURE__ */ a.createElement($, { size: "xxlarge", ...F(x(e.name)) }), /* @__PURE__ */ a.createElement("div", { className: "k-chat-file-info" }, /* @__PURE__ */ a.createElement("span", { className: "k-chat-file-name" }, e.name), /* @__PURE__ */ a.createElement("span", { className: "k-chat-file-size" }, E(e.size))), C(e))));
|
|
58
|
+
), C = o.useCallback(() => z("k-chat-file-wrapper", {
|
|
59
|
+
"k-chat-files-wrap": r === "wrap",
|
|
60
|
+
"k-chat-files-horizontal": r === "horizontal"
|
|
61
|
+
}), [r]);
|
|
62
|
+
return /* @__PURE__ */ o.createElement("ul", { className: C() }, d.map((e) => /* @__PURE__ */ o.createElement("li", { key: e.name, className: "k-chat-file" }, /* @__PURE__ */ o.createElement(v, { size: "xlarge", ...w(E(e.name)) }), /* @__PURE__ */ o.createElement("div", { className: "k-chat-file-info" }, /* @__PURE__ */ o.createElement("span", { className: "k-chat-file-name" }, e.name), /* @__PURE__ */ o.createElement("span", { className: "k-chat-file-size" }, I(e.size))), B(e))));
|
|
69
63
|
};
|
|
70
64
|
export {
|
|
71
|
-
|
|
65
|
+
V as default
|
|
72
66
|
};
|
|
@@ -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 g=require("react"),p=require("@progress/kendo-react-common"),m=require("@progress/kendo-react-buttons"),i=require("@progress/kendo-svg-icons"),
|
|
8
|
+
"use strict";const g=require("react"),p=require("@progress/kendo-react-common"),m=require("@progress/kendo-react-buttons"),i=require("@progress/kendo-svg-icons"),f=require("@progress/kendo-react-intl"),a=require("../../utils.js"),k=require("../ChatContext.js");function C(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const c=C(g),v=n=>{const{message:e,onUnpin:t,user:o}=n,l=f.useLocalization(),{internalScrollContainerRef:r}=k.useChatContext(),u=c.useCallback(s=>{s.preventDefault(),s.stopPropagation();const d=r==null?void 0:r.current;a.scrollToMessageById(e.id,d)},[e.id,r]);return c.createElement("div",{className:"k-message-reference k-message-reference-receiver k-message-pinned",onClick:u},c.createElement(p.IconWrap,{size:"xlarge",icon:i.pinIcon}),c.createElement("div",{className:"k-message-reference-content"},e!=null&&e.isDeleted?o&&a.getDeletedMessageText(a.isAuthor(o,e),l):e==null?void 0:e.text),c.createElement("span",{className:"k-spacer"}),c.createElement(m.Button,{fillMode:"flat",svgIcon:i.xIcon,onClick:s=>{s.stopPropagation(),t==null||t(e)}}))};module.exports=v;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import { IconWrap as
|
|
9
|
+
import { IconWrap as m } from "@progress/kendo-react-common";
|
|
10
10
|
import { Button as p } from "@progress/kendo-react-buttons";
|
|
11
11
|
import { pinIcon as d, xIcon as f } from "@progress/kendo-svg-icons";
|
|
12
12
|
import { useLocalization as g } from "@progress/kendo-react-intl";
|
|
@@ -16,8 +16,8 @@ const z = (n) => {
|
|
|
16
16
|
const { message: e, onUnpin: a, user: s } = n, c = g(), { internalScrollContainerRef: o } = x(), i = t.useCallback(
|
|
17
17
|
(r) => {
|
|
18
18
|
r.preventDefault(), r.stopPropagation();
|
|
19
|
-
const
|
|
20
|
-
u(e.id,
|
|
19
|
+
const l = o == null ? void 0 : o.current;
|
|
20
|
+
u(e.id, l);
|
|
21
21
|
},
|
|
22
22
|
[e.id, o]
|
|
23
23
|
);
|
|
@@ -27,12 +27,13 @@ const z = (n) => {
|
|
|
27
27
|
className: "k-message-reference k-message-reference-receiver k-message-pinned",
|
|
28
28
|
onClick: i
|
|
29
29
|
},
|
|
30
|
-
/* @__PURE__ */ t.createElement(
|
|
30
|
+
/* @__PURE__ */ t.createElement(m, { size: "xlarge", icon: d }),
|
|
31
31
|
/* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, e != null && e.isDeleted ? s && k(v(s, e), c) : e == null ? void 0 : e.text),
|
|
32
32
|
/* @__PURE__ */ t.createElement("span", { className: "k-spacer" }),
|
|
33
33
|
/* @__PURE__ */ t.createElement(
|
|
34
34
|
p,
|
|
35
35
|
{
|
|
36
|
+
fillMode: "flat",
|
|
36
37
|
svgIcon: f,
|
|
37
38
|
onClick: (r) => {
|
|
38
39
|
r.stopPropagation(), a == null || a(e);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react");function p(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const c=p(m),y=100,a=1,E=(e,o)=>{const{enabled:t,dir:r,itemsDependency:f=[],scrollSpeed:s=y}=o,[S,b]=c.useState(!1),[d,L]=c.useState(!1),n=c.useCallback(()=>{if(e.current&&t){const{scrollLeft:l,scrollWidth:u,clientWidth:i}=e.current,O=l===0,g=r!=="rtl"?l+i>=u-a:i-l>=u-a;b(!O),L(!g)}},[t,r]),h=c.useCallback(()=>{e.current&&t&&e.current.scrollBy({left:r!=="rtl"?-s:s,behavior:"smooth"})},[t,r,s]),v=c.useCallback(()=>{e.current&&t&&e.current.scrollBy({left:r!=="rtl"?s:-s,behavior:"smooth"})},[t,r,s]);return c.useEffect(()=>{const l=e.current;if(l&&t){n(),l.addEventListener("scroll",n);const u=new ResizeObserver(n);return u.observe(l),()=>{l.removeEventListener("scroll",n),u.disconnect()}}},[t,r]),c.useLayoutEffect(()=>{t&&n()},[t,r,f]),{canScrollLeft:S,canScrollRight:d,scrollLeft:h,scrollRight:v}};exports.useScrollWithButtons=E;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as r from "react";
|
|
9
|
+
const m = 100, i = 1, p = (l, a) => {
|
|
10
|
+
const { enabled: t, dir: e, itemsDependency: S = [], scrollSpeed: c = m } = a, [f, L] = r.useState(!1), [d, b] = r.useState(!1), o = r.useCallback(() => {
|
|
11
|
+
if (l.current && t) {
|
|
12
|
+
const { scrollLeft: s, scrollWidth: n, clientWidth: u } = l.current, E = s === 0, C = e !== "rtl" ? s + u >= n - i : u - s >= n - i;
|
|
13
|
+
L(!E), b(!C);
|
|
14
|
+
}
|
|
15
|
+
}, [t, e]), h = r.useCallback(() => {
|
|
16
|
+
l.current && t && l.current.scrollBy({
|
|
17
|
+
left: e !== "rtl" ? -c : c,
|
|
18
|
+
behavior: "smooth"
|
|
19
|
+
});
|
|
20
|
+
}, [t, e, c]), v = r.useCallback(() => {
|
|
21
|
+
l.current && t && l.current.scrollBy({
|
|
22
|
+
left: e !== "rtl" ? c : -c,
|
|
23
|
+
behavior: "smooth"
|
|
24
|
+
});
|
|
25
|
+
}, [t, e, c]);
|
|
26
|
+
return r.useEffect(() => {
|
|
27
|
+
const s = l.current;
|
|
28
|
+
if (s && t) {
|
|
29
|
+
o(), s.addEventListener("scroll", o);
|
|
30
|
+
const n = new ResizeObserver(o);
|
|
31
|
+
return n.observe(s), () => {
|
|
32
|
+
s.removeEventListener("scroll", o), n.disconnect();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}, [t, e]), r.useLayoutEffect(() => {
|
|
36
|
+
t && o();
|
|
37
|
+
}, [t, e, S]), {
|
|
38
|
+
canScrollLeft: f,
|
|
39
|
+
canScrollRight: d,
|
|
40
|
+
scrollLeft: h,
|
|
41
|
+
scrollRight: v
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
p as useScrollWithButtons
|
|
46
|
+
};
|
|
@@ -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 n={textField:"text",statusField:"status",authorIdField:"authorId",authorNameField:"authorName",authorImageUrlField:"authorImageUrl",authorImageAltTextField:"authorImageAltText",idField:"id",timestampField:"timestamp",filesField:"files",attachmentsField:"attachments",replyToIdField:"replyToId",isDeletedField:"isDeleted",isPinnedField:"isPinned",typingField:"typing",suggestedActionsField:"suggestedActions"},r=(i,d={})=>{const t={...n,...d};let e;i.author&&typeof i.author=="object"?e={id:i.author.id||i.author[t.authorIdField]||i[t.authorIdField]||"",name:i.author.name||i.author[t.authorNameField]||i[t.authorNameField],avatarUrl:i.author.avatarUrl||i.author[t.authorImageUrlField]||i[t.authorImageUrlField],avatarAltText:i.author.avatarAltText||i.author[t.authorImageAltTextField]||i[t.authorImageAltTextField]}:e={id:i[t.authorIdField]||i.authorId||"",name:i[t.authorNameField]||i.authorName,avatarUrl:i[t.authorImageUrlField]||i.authorImageUrl,avatarAltText:i[t.authorImageAltTextField]||i.authorImageAltText};let o;i.timestamp?o=new Date(i.timestamp):i[t.timestampField]?o=new Date(i[t.timestampField]):o=new Date;const l={id:i.id!==void 0?i.id:i[t.idField],text:i.text!==void 0?i.text:i[t.textField]||"",author:e,timestamp:o,status:i.status!==void 0?i.status:i[t.statusField],attachments:i.attachments!==void 0?i.attachments:i[t.attachmentsField],attachmentLayout:i.attachmentLayout||"list",suggestedActions:i.suggestedActions!==void 0?i.suggestedActions:i[t.suggestedActionsField],isPinned:i.isPinned!==void 0?i.isPinned:i[t.isPinnedField]||!1,typing:i.typing!==void 0?i.typing:i[t.typingField],files:i.files!==void 0?i.files:i[t.filesField]||[]};return i.pinnedAt&&(l.pinnedAt=new Date(i.pinnedAt)),i.pinnedBy&&(l.pinnedBy=i.pinnedBy),i.replyToId!==void 0?l.replyToId=i.replyToId:i[t.replyToIdField]!==void 0&&(l.replyToId=i[t.replyToIdField]),i.isDeleted!==void 0?l.isDeleted=i.isDeleted:i[t.isDeletedField]!==void 0&&(l.isDeleted=i[t.isDeletedField]),l},u=(i,d={})=>Array.isArray(i)?i.map(t=>r(t,d)):[],F=i=>i&&typeof i.id!="undefined"&&typeof i.text=="string"&&i.author&&typeof i.author=="object"&&typeof i.author.id!="undefined"&&(i.timestamp instanceof Date||typeof i.timestamp=="string"||typeof i.timestamp=="number"),h=i=>({textField:i.textField,statusField:i.statusField,authorIdField:i.authorIdField,authorNameField:i.authorNameField,authorImageUrlField:i.authorImageUrlField,authorImageAltTextField:i.authorImageAltTextField,idField:i.idField,timestampField:i.timestampField,filesField:i.filesField,attachmentsField:i.attachmentsField,replyToIdField:i.replyToIdField,isDeletedField:i.isDeletedField,isPinnedField:i.isPinnedField,typingField:i.typingField,suggestedActionsField:i.suggestedActionsField}),a=(i,d={})=>{const t={...n,...d},e={};return i.id!==void 0&&(e[t.idField]=i.id),i.text!==void 0&&(e[t.textField]=i.text),i.status!==void 0&&(e[t.statusField]=i.status),i.timestamp!==void 0&&(e[t.timestampField]=i.timestamp),i.attachments!==void 0&&(e[t.attachmentsField]=i.attachments),i.files!==void 0&&(e[t.filesField]=i.files),i.suggestedActions!==void 0&&(e[t.suggestedActionsField]=i.suggestedActions),i.replyToId!==void 0&&(e[t.replyToIdField]=i.replyToId),i.isDeleted!==void 0&&(e[t.isDeletedField]=i.isDeleted),i.isPinned!==void 0&&(e[t.isPinnedField]=i.isPinned),i.typing!==void 0&&(e[t.typingField]=i.typing),i.author&&(i.author.id!==void 0&&(e[t.authorIdField]=i.author.id),i.author.name!==void 0&&(e[t.authorNameField]=i.author.name),i.author.avatarUrl!==void 0&&(e[t.authorImageUrlField]=i.author.avatarUrl),i.author.avatarAltText!==void 0&&(e[t.authorImageAltTextField]=i.author.avatarAltText)),i.pinnedAt!==void 0&&(e.pinnedAt=i.pinnedAt),i.pinnedBy!==void 0&&(e.pinnedBy=i.pinnedBy),i.attachmentLayout!==void 0&&(e.attachmentLayout=i.attachmentLayout),e};exports.DEFAULT_FIELD_MAPPING=n;exports.extractFieldMappingFromProps=h;exports.isStandardMessageFormat=F;exports.mapDataArrayToMessages=u;exports.mapDataToMessage=r;exports.mapMessageToCustomFormat=a;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={textField:"text",statusField:"status",authorIdField:"authorId",authorNameField:"authorName",authorImageUrlField:"authorImageUrl",authorImageAltTextField:"authorImageAltText",idField:"id",timestampField:"timestamp",filesField:"files",attachmentsField:"attachments",replyToIdField:"replyToId",isDeletedField:"isDeleted",isPinnedField:"isPinned",typingField:"typing",suggestedActionsField:"suggestedActions"},r=(i,d={})=>{const t={...n,...d};let e;i.author&&typeof i.author=="object"?e={id:i.author.id||i.author[t.authorIdField]||i[t.authorIdField]||"",name:i.author.name||i.author[t.authorNameField]||i[t.authorNameField],avatarUrl:i.author.avatarUrl||i.author[t.authorImageUrlField]||i[t.authorImageUrlField],avatarAltText:i.author.avatarAltText||i.author[t.authorImageAltTextField]||i[t.authorImageAltTextField]}:e={id:i[t.authorIdField]||i.authorId||"",name:i[t.authorNameField]||i.authorName,avatarUrl:i[t.authorImageUrlField]||i.authorImageUrl,avatarAltText:i[t.authorImageAltTextField]||i.authorImageAltText};let o;i.timestamp?o=new Date(i.timestamp):i[t.timestampField]?o=new Date(i[t.timestampField]):o=new Date;const l={id:i.id!==void 0?i.id:i[t.idField],text:i.text!==void 0?i.text:i[t.textField]||"",author:e,timestamp:o,status:i.status!==void 0?i.status:i[t.statusField],attachments:i.attachments!==void 0?i.attachments:i[t.attachmentsField],attachmentLayout:i.attachmentLayout||"list",suggestedActions:i.suggestedActions!==void 0?i.suggestedActions:i[t.suggestedActionsField],isPinned:i.isPinned!==void 0?i.isPinned:i[t.isPinnedField]||!1,typing:i.typing!==void 0?i.typing:i[t.typingField],files:i.files!==void 0?i.files:i[t.filesField]||[]};return i.pinnedAt&&(l.pinnedAt=new Date(i.pinnedAt)),i.pinnedBy&&(l.pinnedBy=i.pinnedBy),i.replyToId!==void 0?l.replyToId=i.replyToId:i[t.replyToIdField]!==void 0&&(l.replyToId=i[t.replyToIdField]),i.isDeleted!==void 0?l.isDeleted=i.isDeleted:i[t.isDeletedField]!==void 0&&(l.isDeleted=i[t.isDeletedField]),{...l,dataItem:i}},u=(i,d={})=>Array.isArray(i)?i.map(t=>r(t,d)):[],F=i=>i&&typeof i.id!="undefined"&&typeof i.text=="string"&&i.author&&typeof i.author=="object"&&typeof i.author.id!="undefined"&&(i.timestamp instanceof Date||typeof i.timestamp=="string"||typeof i.timestamp=="number"),h=i=>({textField:i.textField,statusField:i.statusField,authorIdField:i.authorIdField,authorNameField:i.authorNameField,authorImageUrlField:i.authorImageUrlField,authorImageAltTextField:i.authorImageAltTextField,idField:i.idField,timestampField:i.timestampField,filesField:i.filesField,attachmentsField:i.attachmentsField,replyToIdField:i.replyToIdField,isDeletedField:i.isDeletedField,isPinnedField:i.isPinnedField,typingField:i.typingField,suggestedActionsField:i.suggestedActionsField}),a=(i,d={})=>{const t={...n,...d},e={};return i.id!==void 0&&(e[t.idField]=i.id),i.text!==void 0&&(e[t.textField]=i.text),i.status!==void 0&&(e[t.statusField]=i.status),i.timestamp!==void 0&&(e[t.timestampField]=i.timestamp),i.attachments!==void 0&&(e[t.attachmentsField]=i.attachments),i.files!==void 0&&(e[t.filesField]=i.files),i.suggestedActions!==void 0&&(e[t.suggestedActionsField]=i.suggestedActions),i.replyToId!==void 0&&(e[t.replyToIdField]=i.replyToId),i.isDeleted!==void 0&&(e[t.isDeletedField]=i.isDeleted),i.isPinned!==void 0&&(e[t.isPinnedField]=i.isPinned),i.typing!==void 0&&(e[t.typingField]=i.typing),i.author&&(i.author.id!==void 0&&(e[t.authorIdField]=i.author.id),i.author.name!==void 0&&(e[t.authorNameField]=i.author.name),i.author.avatarUrl!==void 0&&(e[t.authorImageUrlField]=i.author.avatarUrl),i.author.avatarAltText!==void 0&&(e[t.authorImageAltTextField]=i.author.avatarAltText)),i.pinnedAt!==void 0&&(e.pinnedAt=i.pinnedAt),i.pinnedBy!==void 0&&(e.pinnedBy=i.pinnedBy),i.attachmentLayout!==void 0&&(e.attachmentLayout=i.attachmentLayout),e};exports.DEFAULT_FIELD_MAPPING=n;exports.extractFieldMappingFromProps=h;exports.isStandardMessageFormat=F;exports.mapDataArrayToMessages=u;exports.mapDataToMessage=r;exports.mapMessageToCustomFormat=a;
|
|
@@ -50,7 +50,7 @@ const n = {
|
|
|
50
50
|
typing: i.typing !== void 0 ? i.typing : i[t.typingField],
|
|
51
51
|
files: i.files !== void 0 ? i.files : i[t.filesField] || []
|
|
52
52
|
};
|
|
53
|
-
return i.pinnedAt && (l.pinnedAt = new Date(i.pinnedAt)), i.pinnedBy && (l.pinnedBy = i.pinnedBy), i.replyToId !== void 0 ? l.replyToId = i.replyToId : i[t.replyToIdField] !== void 0 && (l.replyToId = i[t.replyToIdField]), i.isDeleted !== void 0 ? l.isDeleted = i.isDeleted : i[t.isDeletedField] !== void 0 && (l.isDeleted = i[t.isDeletedField]), l;
|
|
53
|
+
return i.pinnedAt && (l.pinnedAt = new Date(i.pinnedAt)), i.pinnedBy && (l.pinnedBy = i.pinnedBy), i.replyToId !== void 0 ? l.replyToId = i.replyToId : i[t.replyToIdField] !== void 0 && (l.replyToId = i[t.replyToIdField]), i.isDeleted !== void 0 ? l.isDeleted = i.isDeleted : i[t.isDeletedField] !== void 0 && (l.isDeleted = i[t.isDeletedField]), { ...l, dataItem: i };
|
|
54
54
|
}, u = (i, d = {}) => Array.isArray(i) ? i.map((t) => r(t, d)) : [], F = (i) => i && typeof i.id != "undefined" && typeof i.text == "string" && i.author && typeof i.author == "object" && typeof i.author.id != "undefined" && (i.timestamp instanceof Date || typeof i.timestamp == "string" || typeof i.timestamp == "number"), h = (i) => ({
|
|
55
55
|
textField: i.textField,
|
|
56
56
|
statusField: i.statusField,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=["allowMessageCollapse","messageWidthMode","showAvatar","showUsername","messageTemplate","messageContentTemplate","messageToolbarActions","messageContextMenuActions","fileActions"],v=(e,t)=>{var o,m;return((o=e==null?void 0:e.author)==null?void 0:o.id)===t||((m=e==null?void 0:e.author)==null?void 0:m.id)===String(t)};function T(e,t,o,m,l){const c=v(e,t)?m:l,n={};return h.forEach(a=>{var d;n[a]=(d=c==null?void 0:c[a])!=null?d:o==null?void 0:o[a]}),n}exports.resolveMessageSettings=T;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
const C = [
|
|
9
|
+
"allowMessageCollapse",
|
|
10
|
+
"messageWidthMode",
|
|
11
|
+
"showAvatar",
|
|
12
|
+
"showUsername",
|
|
13
|
+
"messageTemplate",
|
|
14
|
+
"messageContentTemplate",
|
|
15
|
+
"messageToolbarActions",
|
|
16
|
+
"messageContextMenuActions",
|
|
17
|
+
"fileActions"
|
|
18
|
+
], T = (e, o) => {
|
|
19
|
+
var m, c;
|
|
20
|
+
return ((m = e == null ? void 0 : e.author) == null ? void 0 : m.id) === o || ((c = e == null ? void 0 : e.author) == null ? void 0 : c.id) === String(o);
|
|
21
|
+
};
|
|
22
|
+
function t(e, o, m, c, A) {
|
|
23
|
+
const h = T(e, o) ? c : A, d = {};
|
|
24
|
+
return C.forEach((a) => {
|
|
25
|
+
var n;
|
|
26
|
+
d[a] = (n = h == null ? void 0 : h[a]) != null ? n : m == null ? void 0 : m[a];
|
|
27
|
+
}), d;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
t as resolveMessageSettings
|
|
31
|
+
};
|