@easyv/biz-components 0.0.2 → 0.0.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/dist/_virtual/index.es2.js +2 -2
- package/dist/_virtual/index.es3.js +2 -2
- package/dist/_virtual/index.es4.js +2 -2
- package/dist/_virtual/index.es5.js +2 -2
- package/dist/components/AiMessageRender/AiMessageRender.d.ts +3 -0
- package/dist/components/AiMessageRender/AiMessageRender.es.js +24 -19
- package/dist/components/AiMessageRender/AiMessageRender.es.js.map +1 -1
- package/dist/node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.es.js +1 -1
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.es.js +1 -1
- package/dist/node_modules/.pnpm/style-to-js@1.1.16/node_modules/style-to-js/cjs/index.es.js +1 -1
- package/dist/node_modules/.pnpm/style-to-object@1.0.8/node_modules/style-to-object/cjs/index.es.js +1 -1
- package/package.json +1 -1
|
@@ -4,5 +4,8 @@ export interface AiMessageRenderProps {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
contents: (string | DashboardContext)[];
|
|
6
6
|
renderDashboardContent?: (msg: DashboardContext) => React.ReactNode;
|
|
7
|
+
showFooterButtons?: boolean;
|
|
8
|
+
onCopy?: () => void;
|
|
9
|
+
onRedo?: () => void;
|
|
7
10
|
}
|
|
8
11
|
export declare const AiMessageRender: (props: AiMessageRenderProps) => JSX.Element;
|
|
@@ -1,49 +1,54 @@
|
|
|
1
1
|
import { j as e } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
-
import { CopyCircleOutlined as p, RedoOutlined as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { ShadowDom as
|
|
6
|
-
import { Markdown as
|
|
7
|
-
const
|
|
8
|
-
const {
|
|
9
|
-
|
|
2
|
+
import { CopyCircleOutlined as p, RedoOutlined as u } from "../../node_modules/.pnpm/@easyv_react-icons@6.3.0/node_modules/@easyv/react-icons/dist/index.esm.es.js";
|
|
3
|
+
import j from "../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
|
|
4
|
+
import v from "./index.css.es.js";
|
|
5
|
+
import { ShadowDom as N } from "../ShadowDom/ShadowDom.es.js";
|
|
6
|
+
import { Markdown as w } from "../../node_modules/.pnpm/react-markdown@10.1.0_@types_react@18.2.0_react@18.2.0/node_modules/react-markdown/lib/index.es.js";
|
|
7
|
+
const R = (d) => {
|
|
8
|
+
const {
|
|
9
|
+
className: a = "",
|
|
10
|
+
renderDashboardContent: s,
|
|
11
|
+
showFooterButtons: l = !1,
|
|
12
|
+
contents: c
|
|
13
|
+
} = d, m = (t) => /* @__PURE__ */ e.jsx(N, { style: v, children: /* @__PURE__ */ e.jsx(w, { children: t }) }), x = (t) => {
|
|
14
|
+
const { data: r, filterCode: n, plotModuleName: h, plotVersion: f } = t;
|
|
10
15
|
if (s)
|
|
11
|
-
return s(
|
|
12
|
-
let
|
|
13
|
-
return n && (
|
|
16
|
+
return s(t);
|
|
17
|
+
let o = r;
|
|
18
|
+
return n && (o = new Function("data", n)(r)), /* @__PURE__ */ e.jsxs("div", { children: [
|
|
14
19
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
15
20
|
"组件名称:",
|
|
16
|
-
|
|
21
|
+
h
|
|
17
22
|
] }),
|
|
18
23
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
19
24
|
"组件版本:",
|
|
20
|
-
|
|
25
|
+
f
|
|
21
26
|
] }),
|
|
22
27
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
23
28
|
"组件数据:",
|
|
24
|
-
|
|
29
|
+
o.slice(0, 5).map((i) => JSON.stringify(i))
|
|
25
30
|
] })
|
|
26
31
|
] });
|
|
27
32
|
};
|
|
28
33
|
return /* @__PURE__ */ e.jsxs(
|
|
29
34
|
"div",
|
|
30
35
|
{
|
|
31
|
-
className:
|
|
36
|
+
className: j(
|
|
32
37
|
"px-4 py-3 flex flex-col gap-3 rounded-lg max-w-[516px]",
|
|
33
38
|
"bg-[#FFFFFF14] select-auto",
|
|
34
39
|
a
|
|
35
40
|
),
|
|
36
41
|
children: [
|
|
37
|
-
c.map((
|
|
38
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
|
|
42
|
+
c.map((t, r) => typeof t == "string" ? /* @__PURE__ */ e.jsx("div", { className: "contents", children: m(t) }, r) : /* @__PURE__ */ e.jsx("div", { className: "contents", children: x(t) }, r)),
|
|
43
|
+
l && /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
|
|
39
44
|
/* @__PURE__ */ e.jsx("div", { className: "w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer", children: /* @__PURE__ */ e.jsx(p, { className: "w-3.5 h-3.5 text-text-2" }) }),
|
|
40
|
-
/* @__PURE__ */ e.jsx("div", { className: "w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer", children: /* @__PURE__ */ e.jsx(
|
|
45
|
+
/* @__PURE__ */ e.jsx("div", { className: "w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer", children: /* @__PURE__ */ e.jsx(u, { className: "w-3.5 h-3.5 text-text-2" }) })
|
|
41
46
|
] })
|
|
42
47
|
]
|
|
43
48
|
}
|
|
44
49
|
);
|
|
45
50
|
};
|
|
46
51
|
export {
|
|
47
|
-
|
|
52
|
+
R as AiMessageRender
|
|
48
53
|
};
|
|
49
54
|
//# sourceMappingURL=AiMessageRender.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiMessageRender.es.js","sources":["../../../src/components/AiMessageRender/AiMessageRender.tsx"],"sourcesContent":["import { CopyCircleOutlined, RedoOutlined } from '@easyv/react-icons';\nimport classNames from 'classnames';\nimport Markdown from 'react-markdown';\nimport { ShadowDom } from '../ShadowDom';\n// @ts-expect-error\nimport messageRenderCss from './index.css?raw';\nimport { DashboardContext } from './types';\n\nexport interface AiMessageRenderProps {\n className?: string;\n contents: (string | DashboardContext)[];\n renderDashboardContent?: (msg: DashboardContext) => React.ReactNode;\n}\n\nexport const AiMessageRender = (props: AiMessageRenderProps) => {\n const {
|
|
1
|
+
{"version":3,"file":"AiMessageRender.es.js","sources":["../../../src/components/AiMessageRender/AiMessageRender.tsx"],"sourcesContent":["import { CopyCircleOutlined, RedoOutlined } from '@easyv/react-icons';\nimport classNames from 'classnames';\nimport Markdown from 'react-markdown';\nimport { ShadowDom } from '../ShadowDom';\n// @ts-expect-error\nimport messageRenderCss from './index.css?raw';\nimport { DashboardContext } from './types';\n\nexport interface AiMessageRenderProps {\n className?: string;\n contents: (string | DashboardContext)[];\n renderDashboardContent?: (msg: DashboardContext) => React.ReactNode;\n showFooterButtons?: boolean;\n onCopy?: () => void;\n onRedo?: () => void;\n}\n\nexport const AiMessageRender = (props: AiMessageRenderProps) => {\n const {\n className = '',\n renderDashboardContent: propsRenderDashboardContent,\n showFooterButtons = false,\n contents,\n } = props;\n\n const renderStringContent = (msg: string) => {\n return (\n <ShadowDom style={messageRenderCss}>\n <Markdown>{msg}</Markdown>\n </ShadowDom>\n );\n };\n const renderDashboardContent = (msg: DashboardContext) => {\n const { data, filterCode, plotModuleName, plotVersion } = msg;\n if (propsRenderDashboardContent) {\n return propsRenderDashboardContent(msg);\n }\n let finalData = data;\n if (filterCode) {\n const filterFunc = new Function('data', filterCode);\n finalData = filterFunc(data) as unknown[];\n }\n return (\n <div>\n <div>组件名称:{plotModuleName}</div>\n <div>组件版本:{plotVersion}</div>\n <div>组件数据:{finalData.slice(0, 5).map((i: unknown) => JSON.stringify(i))}</div>\n </div>\n );\n };\n\n return (\n <div\n className={classNames(\n 'px-4 py-3 flex flex-col gap-3 rounded-lg max-w-[516px]',\n 'bg-[#FFFFFF14] select-auto',\n className\n )}\n >\n {contents.map((msg, index) => {\n if (typeof msg === 'string') {\n return (\n <div key={index} className='contents'>\n {renderStringContent(msg)}\n </div>\n );\n } else {\n return (\n <div key={index} className='contents'>\n {renderDashboardContent(msg)}\n </div>\n );\n }\n })}\n {showFooterButtons && (\n <div className='flex gap-1'>\n <div className='w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer'>\n <CopyCircleOutlined className='w-3.5 h-3.5 text-text-2' />\n </div>\n <div className='w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer'>\n <RedoOutlined className='w-3.5 h-3.5 text-text-2' />\n </div>\n </div>\n )}\n </div>\n );\n};\n"],"names":["AiMessageRender","props","className","propsRenderDashboardContent","showFooterButtons","contents","renderStringContent","msg","ShadowDom","messageRenderCss","jsx","Markdown","renderDashboardContent","data","filterCode","plotModuleName","plotVersion","finalData","jsxs","classNames","index","CopyCircleOutlined","RedoOutlined"],"mappings":";;;;;;AAiBa,MAAAA,IAAkB,CAACC,MAAgC;AACxD,QAAA;AAAA,IACJ,WAAAC,IAAY;AAAA,IACZ,wBAAwBC;AAAA,IACxB,mBAAAC,IAAoB;AAAA,IACpB,UAAAC;AAAA,EAAA,IACEJ,GAEEK,IAAsB,CAACC,4BAExBC,GAAU,EAAA,OAAOC,GAChB,UAACC,gBAAAA,EAAA,IAAAC,GAAA,EAAU,aAAI,EACjB,CAAA,GAGEC,IAAyB,CAACL,MAA0B;AACxD,UAAM,EAAE,MAAAM,GAAM,YAAAC,GAAY,gBAAAC,GAAgB,aAAAC,EAAgB,IAAAT;AAC1D,QAAIJ;AACF,aAAOA,EAA4BI,CAAG;AAExC,QAAIU,IAAYJ;AAChB,WAAIC,MAEFG,IADmB,IAAI,SAAS,QAAQH,CAAU,EAC3BD,CAAI,2BAG1B,OACC,EAAA,UAAA;AAAA,MAAAK,gBAAAA,OAAC,OAAI,EAAA,UAAA;AAAA,QAAA;AAAA,QAAMH;AAAA,MAAA,GAAe;AAAA,6BACzB,OAAI,EAAA,UAAA;AAAA,QAAA;AAAA,QAAMC;AAAA,MAAA,GAAY;AAAA,6BACtB,OAAI,EAAA,UAAA;AAAA,QAAA;AAAA,QAAMC,EAAU,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,MAAe,KAAK,UAAU,CAAC,CAAC;AAAA,MAAA,EAAE,CAAA;AAAA,IAAA,GAC1E;AAAA,EAEJ;AAGE,SAAAC,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACA;AAAA,QACAjB;AAAA,MACF;AAAA,MAEC,UAAA;AAAA,QAASG,EAAA,IAAI,CAACE,GAAKa,MACd,OAAOb,KAAQ,iCAEd,OAAgB,EAAA,WAAU,YACxB,UAAoBD,EAAAC,CAAG,KADhBa,CAEV,0BAIC,OAAgB,EAAA,WAAU,YACxB,UAAuBR,EAAAL,CAAG,KADnBa,CAEV,CAGL;AAAA,QACAhB,KACCc,gBAAAA,EAAA,KAAC,OAAI,EAAA,WAAU,cACb,UAAA;AAAA,UAAAR,gBAAAA,EAAAA,IAAC,SAAI,WAAU,wFACb,gCAACW,GAAmB,EAAA,WAAU,2BAA0B,EAC1D,CAAA;AAAA,UACAX,gBAAAA,EAAAA,IAAC,SAAI,WAAU,wFACb,gCAACY,GAAa,EAAA,WAAU,0BAA0B,CAAA,EACpD,CAAA;AAAA,QAAA,EACF,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ;AAEJ;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs as u } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as f } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as f } from "../../../../../_virtual/index.es4.js";
|
|
3
3
|
/*!
|
|
4
4
|
Copyright (c) 2018 Jed Watson.
|
|
5
5
|
Licensed under the MIT License (MIT), see
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs as e } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as r } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as r } from "../../../../../_virtual/index.es3.js";
|
|
3
3
|
import { __require as o } from "../../../react-is@16.13.1/node_modules/react-is/index.es.js";
|
|
4
4
|
import { __require as t } from "./factoryWithTypeCheckers.es.js";
|
|
5
5
|
import { __require as p } from "./factoryWithThrowingShims.es.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as e } from "../../../../../_virtual/index.
|
|
1
|
+
import { __module as e } from "../../../../../_virtual/index.es5.js";
|
|
2
2
|
import { __require as o } from "./cjs/react-is.production.min.es.js";
|
|
3
3
|
import { __require as t } from "./cjs/react-is.development.es.js";
|
|
4
4
|
var r;
|
|
@@ -2,7 +2,7 @@ import { getDefaultExportFromCjs as f, commonjsGlobal as a } from "../../../../.
|
|
|
2
2
|
import "../../../../style-to-object@1.0.8/node_modules/style-to-object/cjs/index.es.js";
|
|
3
3
|
import "./utilities.es.js";
|
|
4
4
|
import { __exports as s } from "../../../../../../_virtual/utilities.es.js";
|
|
5
|
-
import { __exports as _ } from "../../../../../../_virtual/index.
|
|
5
|
+
import { __exports as _ } from "../../../../../../_virtual/index.es2.js";
|
|
6
6
|
var l = a && a.__importDefault || function(t) {
|
|
7
7
|
return t && t.__esModule ? t : { default: t };
|
|
8
8
|
}, n = l(_), m = s;
|
package/dist/node_modules/.pnpm/style-to-object@1.0.8/node_modules/style-to-object/cjs/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { commonjsGlobal as a } from "../../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __exports as n } from "../../../../../../_virtual/index.
|
|
2
|
+
import { __exports as n } from "../../../../../../_virtual/index.es2.js";
|
|
3
3
|
import { i as p } from "../../../../inline-style-parser@0.2.4/node_modules/inline-style-parser/index.es.js";
|
|
4
4
|
var s = a && a.__importDefault || function(e) {
|
|
5
5
|
return e && e.__esModule ? e : { default: e };
|