bi-sdk-react 0.0.9 → 0.0.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/dist/es/js/bi-sdk.es.js +11 -7
- package/dist/types/components/plugins/@antd/item-props/HtmlProps.d.ts +1 -0
- package/dist/types/components/plugins/@antd/items/HtmlRender.d.ts +1 -0
- package/dist/umd/js/bi-sdk.umd.min.js +11 -7
- package/package.json +1 -1
- package/src/components/PageDesigner.tsx +1 -1
- package/src/components/panel/AiPanel.tsx +24 -18
- package/src/components/plugins/@antd/item-props/HtmlProps.tsx +13 -5
- package/src/components/plugins/@antd/items/HtmlRender.tsx +3 -1
package/dist/es/js/bi-sdk.es.js
CHANGED
|
@@ -492,8 +492,6 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
492
492
|
background: var(--ant-color-bg-container);
|
|
493
493
|
|
|
494
494
|
.user-message {
|
|
495
|
-
background: var(--ant-color-primary-bg);
|
|
496
|
-
padding: 8px 10px;
|
|
497
495
|
max-width: 90%;
|
|
498
496
|
margin: 10px 0 10px auto;
|
|
499
497
|
position: relative;
|
|
@@ -512,7 +510,13 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
512
510
|
.msg-header {
|
|
513
511
|
justify-content: flex-end;
|
|
514
512
|
color: var(--ant-color-text-tertiary);
|
|
515
|
-
padding: 4px
|
|
513
|
+
padding: 4px 10px 8px 10px;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.msg-section {
|
|
517
|
+
background: var(--ant-color-primary-bg);
|
|
518
|
+
padding: 8px 10px;
|
|
519
|
+
border-radius: var(--ant-border-radius);
|
|
516
520
|
}
|
|
517
521
|
}
|
|
518
522
|
.assistant-message {
|
|
@@ -596,7 +600,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
596
600
|
}
|
|
597
601
|
}
|
|
598
602
|
}
|
|
599
|
-
`,tU=(0,eO.forwardRef)((e,t)=>{let{list:l,onDeleteMessage:n}=e,r=(0,eO.useRef)(null),a=()=>{setTimeout(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},100)};return(0,eO.useImperativeHandle)(t,()=>({scrollToBottom:a})),(0,eN.jsx)(tK,{className:"message-list",ref:r,children:l.map(e=>{var t,l,r,a,i,o,s,d,u;return(0,eN.jsxs)("div",{className:"msg",children:[(0,eN.jsxs)("div",{className:"user-message",children:[(0,eN.jsx)(en,{size:4,orientation:"vertical",className:"msg-tools",children:(0,eN.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>n(e.id),children:(0,eN.jsx)(es,{title:"删除",children:(0,eN.jsx)(M,{type:"link",size:"small",icon:(0,eN.jsx)(c,{})})})})}),(0,eN.jsx)("div",{className:"msg-header",children:(0,eN.jsx)("span",{children:tN(e.createdAt)})}),(0,eN.jsx)("div",{className:"msg-content",children:e.question}),(null==(t=e.files)?void 0:t.length)||(null==(l=e.agents)?void 0:l.length)?(0,eN.jsxs)("div",{className:"msg-meta",children:[null==(r=e.files)?void 0:r.map(e=>(0,eN.jsxs)(ei,{color:"processing",children:[(0,eN.jsx)(tS,{type:"icon-paper-clip"})," ",e.name]},e.id)),null==(a=e.agents)?void 0:a.map(e=>(0,eN.jsxs)(ei,{color:"blue",children:[(0,eN.jsx)(tS,{type:"icon-at"})," ",e.name]},e.id))]}):null]}),(0,eN.jsxs)("div",{className:"assistant-message",children:[(0,eN.jsx)("div",{className:"msg-header",children:(0,eN.jsxs)("span",{className:"msg-title",children:[(0,eN.jsx)(k,{})," 智能助理"]})}),(0,eN.jsx)("div",{className:"msg-section",children:e.sending?(0,eN.jsx)(el,{active:!0}):(0,eN.jsxs)(eN.Fragment,{children:[(0,eN.jsx)("div",{className:"msg-content",children:(null==(i=e.answer)?void 0:i.answer)||""}),!!(null==(s=e.answer)||null==(o=s.plans)?void 0:o.length)&&(0,eN.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,eN.jsx)("summary",{className:"msg-ai-meta-title",children:"PLANS:"}),(0,eN.jsx)("div",{className:"msg-ai-meta-list",children:e.answer.plans.map((e,t)=>(0,eN.jsx)(es,{title:e.description,children:(0,eN.jsx)(ei,{color:"blue",children:e.name})},t))})]}),!!(null==(u=e.answer)||null==(d=u.extra)?void 0:d.length)&&(0,eN.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,eN.jsx)("summary",{className:"msg-ai-meta-title",children:"ACTIONS:"}),(0,eN.jsx)("div",{className:"msg-ai-meta-list vertical",children:e.answer.extra.map((e,t)=>(0,eN.jsxs)("div",{className:"msg-ai-meta-list-item",children:[(0,eN.jsx)(ei,{color:"gold",children:e.element}),(0,eN.jsx)("span",{children:e.action})]},t))})]})]})})]})]},e.id)})})}),tJ=t.div`
|
|
603
|
+
`,tU=(0,eO.forwardRef)((e,t)=>{let{list:l,onDeleteMessage:n}=e,r=(0,eO.useRef)(null),a=()=>{setTimeout(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},100)};return(0,eO.useImperativeHandle)(t,()=>({scrollToBottom:a})),(0,eN.jsx)(tK,{className:"message-list",ref:r,children:l.map(e=>{var t,l,r,a,i,o,s,d,u;return(0,eN.jsxs)("div",{className:"msg",children:[(0,eN.jsxs)("div",{className:"user-message",children:[(0,eN.jsx)(en,{size:4,orientation:"vertical",className:"msg-tools",children:(0,eN.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>n(e.id),children:(0,eN.jsx)(es,{title:"删除",children:(0,eN.jsx)(M,{type:"link",size:"small",icon:(0,eN.jsx)(c,{})})})})}),(0,eN.jsx)("div",{className:"msg-header",children:(0,eN.jsx)("span",{children:tN(e.createdAt)})}),(0,eN.jsxs)("div",{className:"msg-section",children:[(0,eN.jsx)("div",{className:"msg-content",children:e.question}),(null==(t=e.files)?void 0:t.length)||(null==(l=e.agents)?void 0:l.length)?(0,eN.jsxs)("div",{className:"msg-meta",children:[null==(r=e.files)?void 0:r.map(e=>(0,eN.jsxs)(ei,{color:"processing",children:[(0,eN.jsx)(tS,{type:"icon-paper-clip"})," ",e.name]},e.id)),null==(a=e.agents)?void 0:a.map(e=>(0,eN.jsxs)(ei,{color:"blue",children:[(0,eN.jsx)(tS,{type:"icon-at"})," ",e.name]},e.id))]}):null]})]}),(0,eN.jsxs)("div",{className:"assistant-message",children:[(0,eN.jsx)("div",{className:"msg-header",children:(0,eN.jsxs)("span",{className:"msg-title",children:[(0,eN.jsx)(k,{})," 智能助理"]})}),(0,eN.jsx)("div",{className:"msg-section",children:e.sending?(0,eN.jsx)(el,{active:!0}):(0,eN.jsxs)(eN.Fragment,{children:[(0,eN.jsx)("div",{className:"msg-content",children:(null==(i=e.answer)?void 0:i.answer)||""}),!!(null==(s=e.answer)||null==(o=s.plans)?void 0:o.length)&&(0,eN.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,eN.jsx)("summary",{className:"msg-ai-meta-title",children:"PLANS:"}),(0,eN.jsx)("div",{className:"msg-ai-meta-list",children:e.answer.plans.map((e,t)=>(0,eN.jsx)(es,{title:e.description,children:(0,eN.jsx)(ei,{color:"blue",children:e.name})},t))})]}),!!(null==(u=e.answer)||null==(d=u.extra)?void 0:d.length)&&(0,eN.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,eN.jsx)("summary",{className:"msg-ai-meta-title",children:"ACTIONS:"}),(0,eN.jsx)("div",{className:"msg-ai-meta-list vertical",children:e.answer.extra.map((e,t)=>(0,eN.jsxs)("div",{className:"msg-ai-meta-list-item",children:[(0,eN.jsx)(ei,{color:"gold",children:e.element}),(0,eN.jsx)("span",{children:e.action})]},t))})]})]})})]})]},e.id)})})}),tJ=t.div`
|
|
600
604
|
display: flex;
|
|
601
605
|
flex-direction: column;
|
|
602
606
|
height: 100%;
|
|
@@ -896,7 +900,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
896
900
|
flex-direction: column;
|
|
897
901
|
gap: 12px;
|
|
898
902
|
padding: 12px;
|
|
899
|
-
height: calc(100% -
|
|
903
|
+
height: calc(100% - 49px);
|
|
900
904
|
}
|
|
901
905
|
.left-pane-tabs > label,
|
|
902
906
|
.right-pane-tabs > label {
|
|
@@ -1020,7 +1024,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
1020
1024
|
const module = undefined;
|
|
1021
1025
|
const exports = undefined;
|
|
1022
1026
|
${e.customRender}
|
|
1023
|
-
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),h=()=>{console.log("callback table",tz(u,l))};return(0,eO.useEffect)(()=>{p({id:l.id,callback:h})},[]),(0,eN.jsx)(ea,{id:t,dataSource:n,columns:m,pagination:x,bordered:i,size:o,showHeader:"boolean"!=typeof s||s,rowKey:(e,t)=>String(t),style:{padding:1,...d},className:c})},formComponent:e=>{let{model:t,onChange:l}=e,i=(e,n)=>l&&l({...t,[e]:n}),o=(e,l)=>{let n=[...t.columns||[]];n[e]={...n[e],...l},i("columns",n)},[s,d]=(0,eO.useState)(!1),[u,x]=(0,eO.useState)(null),m=null!=u&&t.columns[u]?t.columns[u]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1},h=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex"},{title:"操作",width:80,align:"center",render:(e,l,n)=>(0,eN.jsxs)(en,{children:[(0,eN.jsx)("a",{onClick:()=>{x(n),d(!0)},children:(0,eN.jsx)(p,{})}),(0,eN.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(n,1),i("columns",e)},children:(0,eN.jsx)(c,{})})]})}];return(0,eN.jsxs)("div",{children:[(0,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>i("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"边框",children:(0,eN.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>i("bordered",e)})}),(0,eN.jsx)(K.Item,{label:"显示表头",children:(0,eN.jsx)(er,{size:"small",checked:!!t.showHeader,onChange:e=>i("showHeader",e)})}),(0,eN.jsx)(K.Item,{label:"分页大小",children:(0,eN.jsx)(J,{size:"small",value:t.pageSize,onChange:e=>i("pageSize",e)})})]}),(0,eN.jsx)(H,{children:"表格列设置"}),(0,eN.jsx)(ea,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:h,pagination:!1,bordered:!0}),(0,eN.jsx)(M,{size:"small",onClick:()=>{i("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,eN.jsx)(q,{title:"编辑列",open:s,footer:null,width:400,onCancel:()=>d(!1),children:(0,eN.jsx)(K,{layout:"vertical",children:(0,eN.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,eN.jsx)(K.Item,{label:"列名",children:(0,eN.jsx)(U,{value:m.title,onChange:e=>o(u,{title:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"数据索引",children:(0,eN.jsx)(U,{value:m.dataIndex,onChange:e=>o(u,{dataIndex:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"宽度",children:(0,eN.jsx)(U,{value:m.width,onChange:e=>o(u,{width:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"对齐",children:(0,eN.jsxs)(Z.Group,{value:m.align,onChange:e=>o(u,{align:e.target.value}),children:[(0,eN.jsx)(Z.Button,{value:"left",children:(0,eN.jsx)(r,{})}),(0,eN.jsx)(Z.Button,{value:"center",children:(0,eN.jsx)(n,{})}),(0,eN.jsx)(Z.Button,{value:"right",children:(0,eN.jsx)(a,{})})]})}),(0,eN.jsx)(K.Item,{label:"省略",children:(0,eN.jsx)(er,{checked:!!m.ellipsis,onChange:e=>o(u,{ellipsis:e})})})]})})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:null},props:{size:"default",bordered:!0,showHeader:!0,pageSize:10,dataSource:[{name:"苹果",count:12},{name:"华为",count:803},{name:"OPPO",count:654},{name:"vivo",count:719}],columns:[{title:"品牌",dataIndex:"name"},{title:"日销量(件)",dataIndex:"count"}]}}},{group:"基础组件",key:"b-list",label:"列表",icon:"icon-unordered-list",component:e=>{let{id:t,pageSize:l=10,bordered:n=!0,size:r="default",itemLayout:a="horizontal",item:i,split:o=!0,style:s={},className:d}=e,{env:c,initCallback:u}=(0,eO.useContext)(tv),p=lx(t,i.datasource)||[],x=(0,eO.useMemo)(()=>!!l&&!(l<=p.length)&&{total:p.length,pageSize:l,size:"default"===r?void 0:r,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,pageSizeOptions:["10","20","30","40"],showTotal:(e,t)=>`共 ${e} 条记录,显示第 ${t[0]}-${t[1]} 条`},[l,p.length,r]),m=["p-list",a?`p-list--${a}`:void 0,r?`p-list--${r}`:void 0,o?"p-list--split":void 0,n?"p-list--bordered":void 0,d],h=()=>{console.log("callback list",tz(c,i))};return(0,eO.useEffect)(()=>{u({id:i.id,callback:h})},[]),(0,eN.jsxs)("div",{id:t,style:{display:"flex",flexDirection:"column",...s},className:m.filter(Boolean).join(" "),children:[(0,eN.jsx)(lw,{list:p,split:o,bordered:n,size:r,itemLayout:a}),x&&(0,eN.jsx)(X,{...x})]})},formComponent:e=>{let{model:t,onChange:l}=e,[n]=K.useForm();return(0,eO.useEffect)(()=>{n.setFieldsValue({size:t.size||"default",itemLayout:t.itemLayout||"horizontal",bordered:t.bordered??!1,split:t.split??!0,pageSize:t.pageSize||10})},[t,n]),(0,eN.jsxs)(K,{form:n,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==l||l({...t,...e})},children:[(0,eN.jsx)(K.Item,{label:"大小",name:"size",children:(0,eN.jsxs)(Z.Group,{size:"small",buttonStyle:"solid",children:[(0,eN.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eN.jsx)(Z.Button,{value:"small",children:"小"})]})}),(0,eN.jsx)(K.Item,{label:"布局",name:"itemLayout",children:(0,eN.jsxs)(Z.Group,{size:"small",buttonStyle:"solid",children:[(0,eN.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eN.jsx)(Z.Button,{value:"vertical",children:"垂直"})]})}),(0,eN.jsx)(K.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,eN.jsx)(er,{size:"small"})}),(0,eN.jsx)(K.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,eN.jsx)(er,{size:"small"})}),(0,eN.jsx)(K.Item,{label:"分页大小",name:"pageSize",children:(0,eN.jsx)(J,{size:"small"})})]})},defaultOptions:{datasource:{source:"custom",custom:"[]"},props:{size:"default",itemLayout:"horizontal",bordered:!0,split:!0,pageSize:10}}},{group:"基础组件",key:"b-html",label:"HTML",icon:"icon-html",component:e=>{let{id:t,template:l="",item:n,style:r,className:a}=e,{env:
|
|
1027
|
+
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),h=()=>{console.log("callback table",tz(u,l))};return(0,eO.useEffect)(()=>{p({id:l.id,callback:h})},[]),(0,eN.jsx)(ea,{id:t,dataSource:n,columns:m,pagination:x,bordered:i,size:o,showHeader:"boolean"!=typeof s||s,rowKey:(e,t)=>String(t),style:{padding:1,...d},className:c})},formComponent:e=>{let{model:t,onChange:l}=e,i=(e,n)=>l&&l({...t,[e]:n}),o=(e,l)=>{let n=[...t.columns||[]];n[e]={...n[e],...l},i("columns",n)},[s,d]=(0,eO.useState)(!1),[u,x]=(0,eO.useState)(null),m=null!=u&&t.columns[u]?t.columns[u]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1},h=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex"},{title:"操作",width:80,align:"center",render:(e,l,n)=>(0,eN.jsxs)(en,{children:[(0,eN.jsx)("a",{onClick:()=>{x(n),d(!0)},children:(0,eN.jsx)(p,{})}),(0,eN.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(n,1),i("columns",e)},children:(0,eN.jsx)(c,{})})]})}];return(0,eN.jsxs)("div",{children:[(0,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>i("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"边框",children:(0,eN.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>i("bordered",e)})}),(0,eN.jsx)(K.Item,{label:"显示表头",children:(0,eN.jsx)(er,{size:"small",checked:!!t.showHeader,onChange:e=>i("showHeader",e)})}),(0,eN.jsx)(K.Item,{label:"分页大小",children:(0,eN.jsx)(J,{size:"small",value:t.pageSize,onChange:e=>i("pageSize",e)})})]}),(0,eN.jsx)(H,{children:"表格列设置"}),(0,eN.jsx)(ea,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:h,pagination:!1,bordered:!0}),(0,eN.jsx)(M,{size:"small",onClick:()=>{i("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,eN.jsx)(q,{title:"编辑列",open:s,footer:null,width:400,onCancel:()=>d(!1),children:(0,eN.jsx)(K,{layout:"vertical",children:(0,eN.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,eN.jsx)(K.Item,{label:"列名",children:(0,eN.jsx)(U,{value:m.title,onChange:e=>o(u,{title:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"数据索引",children:(0,eN.jsx)(U,{value:m.dataIndex,onChange:e=>o(u,{dataIndex:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"宽度",children:(0,eN.jsx)(U,{value:m.width,onChange:e=>o(u,{width:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"对齐",children:(0,eN.jsxs)(Z.Group,{value:m.align,onChange:e=>o(u,{align:e.target.value}),children:[(0,eN.jsx)(Z.Button,{value:"left",children:(0,eN.jsx)(r,{})}),(0,eN.jsx)(Z.Button,{value:"center",children:(0,eN.jsx)(n,{})}),(0,eN.jsx)(Z.Button,{value:"right",children:(0,eN.jsx)(a,{})})]})}),(0,eN.jsx)(K.Item,{label:"省略",children:(0,eN.jsx)(er,{checked:!!m.ellipsis,onChange:e=>o(u,{ellipsis:e})})})]})})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:null},props:{size:"default",bordered:!0,showHeader:!0,pageSize:10,dataSource:[{name:"苹果",count:12},{name:"华为",count:803},{name:"OPPO",count:654},{name:"vivo",count:719}],columns:[{title:"品牌",dataIndex:"name"},{title:"日销量(件)",dataIndex:"count"}]}}},{group:"基础组件",key:"b-list",label:"列表",icon:"icon-unordered-list",component:e=>{let{id:t,pageSize:l=10,bordered:n=!0,size:r="default",itemLayout:a="horizontal",item:i,split:o=!0,style:s={},className:d}=e,{env:c,initCallback:u}=(0,eO.useContext)(tv),p=lx(t,i.datasource)||[],x=(0,eO.useMemo)(()=>!!l&&!(l<=p.length)&&{total:p.length,pageSize:l,size:"default"===r?void 0:r,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,pageSizeOptions:["10","20","30","40"],showTotal:(e,t)=>`共 ${e} 条记录,显示第 ${t[0]}-${t[1]} 条`},[l,p.length,r]),m=["p-list",a?`p-list--${a}`:void 0,r?`p-list--${r}`:void 0,o?"p-list--split":void 0,n?"p-list--bordered":void 0,d],h=()=>{console.log("callback list",tz(c,i))};return(0,eO.useEffect)(()=>{u({id:i.id,callback:h})},[]),(0,eN.jsxs)("div",{id:t,style:{display:"flex",flexDirection:"column",...s},className:m.filter(Boolean).join(" "),children:[(0,eN.jsx)(lw,{list:p,split:o,bordered:n,size:r,itemLayout:a}),x&&(0,eN.jsx)(X,{...x})]})},formComponent:e=>{let{model:t,onChange:l}=e,[n]=K.useForm();return(0,eO.useEffect)(()=>{n.setFieldsValue({size:t.size||"default",itemLayout:t.itemLayout||"horizontal",bordered:t.bordered??!1,split:t.split??!0,pageSize:t.pageSize||10})},[t,n]),(0,eN.jsxs)(K,{form:n,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==l||l({...t,...e})},children:[(0,eN.jsx)(K.Item,{label:"大小",name:"size",children:(0,eN.jsxs)(Z.Group,{size:"small",buttonStyle:"solid",children:[(0,eN.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eN.jsx)(Z.Button,{value:"small",children:"小"})]})}),(0,eN.jsx)(K.Item,{label:"布局",name:"itemLayout",children:(0,eN.jsxs)(Z.Group,{size:"small",buttonStyle:"solid",children:[(0,eN.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eN.jsx)(Z.Button,{value:"vertical",children:"垂直"})]})}),(0,eN.jsx)(K.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,eN.jsx)(er,{size:"small"})}),(0,eN.jsx)(K.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,eN.jsx)(er,{size:"small"})}),(0,eN.jsx)(K.Item,{label:"分页大小",name:"pageSize",children:(0,eN.jsx)(J,{size:"small"})})]})},defaultOptions:{datasource:{source:"custom",custom:"[]"},props:{size:"default",itemLayout:"horizontal",bordered:!0,split:!0,pageSize:10}}},{group:"基础组件",key:"b-html",label:"HTML",icon:"icon-html",component:e=>{let{id:t,template:l="",item:n,style:r,className:a,classNames:i=[]}=e,{env:o,initCallback:s}=(0,eO.useContext)(tv),d=lx(t,n.datasource),c=(0,eO.useMemo)(()=>Object.keys(d||{}),[d]),u=(0,eO.useMemo)(()=>c.map(e=>null==d?void 0:d[e]),[c,d]),p=(0,eO.useMemo)(()=>(l||"").replace(/{{\s*([^}]+)\s*}}/g,(e,t)=>{try{return Function(...c,`
|
|
1024
1028
|
"use strict";
|
|
1025
1029
|
const window = undefined;
|
|
1026
1030
|
const document = undefined;
|
|
@@ -1030,7 +1034,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
1030
1034
|
const module = undefined;
|
|
1031
1035
|
const exports = undefined;
|
|
1032
1036
|
return ${t};
|
|
1033
|
-
`)(...
|
|
1037
|
+
`)(...u)}catch{return""}}),[l,u]),x=()=>{console.log("callback html",tz(o,n))};return(0,eO.useEffect)(()=>{s({id:n.id,callback:x})},[]),(0,eN.jsx)("div",{id:t,style:r,className:(i||[]).join(" ")+" "+a,dangerouslySetInnerHTML:{__html:p}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,eO.useRef)(null),r=(e,n)=>l&&l({...t,[e]:n});return(0,eN.jsx)("div",{children:(0,eN.jsxs)(K,{layout:"vertical",children:[(0,eN.jsx)(K.Item,{label:"类名",children:(0,eN.jsx)(et,{size:"small",value:t.classNames,mode:"tags",onChange:e=>r("classNames",e)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["模板",(0,eN.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=n.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,eN.jsx)(tS,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,eN.jsx)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:(0,eN.jsx)(em,{onMount:e=>{n.current={editor:e}},height:"300px",defaultLanguage:"html",value:t.template,onChange:e=>r("template",e||""),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'{"name": "Confucius"}'},props:{template:"<div>{{name}}, welcome to the world of programming.</div>"}}},{group:"基础组件",key:"b-echarts",label:"图表",icon:"icon-echarts",component:e=>{let{id:t,script:l="",item:n,height:r=400,style:a,className:i}=e,{initCallback:o,env:s}=(0,eO.useContext)(tv),d=(0,eO.useRef)(null),[c,u]=(0,eO.useState)(null),p=lx(t,n.datasource),x=()=>{console.log("callback echarts",tz(s,n))};return(0,eO.useEffect)(()=>{if(!d.current)return;let e=eg.init(d.current);u(e);let t=()=>e.resize();return window.addEventListener("resize",t),o({id:n.id,callback:x}),()=>{window.removeEventListener("resize",t),e.dispose()}},[]),(0,eO.useEffect)(()=>{let e=(e=>{try{return JSON.parse(e)}catch(t){try{return Function("echarts","console","Math","Date","Array","Object","String","Number","Boolean","data",`
|
|
1034
1038
|
"use strict";
|
|
1035
1039
|
const window = undefined;
|
|
1036
1040
|
const document = undefined;
|
|
@@ -492,8 +492,6 @@
|
|
|
492
492
|
background: var(--ant-color-bg-container);
|
|
493
493
|
|
|
494
494
|
.user-message {
|
|
495
|
-
background: var(--ant-color-primary-bg);
|
|
496
|
-
padding: 8px 10px;
|
|
497
495
|
max-width: 90%;
|
|
498
496
|
margin: 10px 0 10px auto;
|
|
499
497
|
position: relative;
|
|
@@ -512,7 +510,13 @@
|
|
|
512
510
|
.msg-header {
|
|
513
511
|
justify-content: flex-end;
|
|
514
512
|
color: var(--ant-color-text-tertiary);
|
|
515
|
-
padding: 4px
|
|
513
|
+
padding: 4px 10px 8px 10px;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.msg-section {
|
|
517
|
+
background: var(--ant-color-primary-bg);
|
|
518
|
+
padding: 8px 10px;
|
|
519
|
+
border-radius: var(--ant-border-radius);
|
|
516
520
|
}
|
|
517
521
|
}
|
|
518
522
|
.assistant-message {
|
|
@@ -596,7 +600,7 @@
|
|
|
596
600
|
}
|
|
597
601
|
}
|
|
598
602
|
}
|
|
599
|
-
`,eK=(0,p.forwardRef)((e,t)=>{let{list:l,onDeleteMessage:n}=e,r=(0,p.useRef)(null),a=()=>{setTimeout(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},100)};return(0,p.useImperativeHandle)(t,()=>({scrollToBottom:a})),(0,d.jsx)(e_,{className:"message-list",ref:r,children:l.map(e=>{var t,l,r,a,i,o,s,c,u;return(0,d.jsxs)("div",{className:"msg",children:[(0,d.jsxs)("div",{className:"user-message",children:[(0,d.jsx)(ey.Space,{size:4,orientation:"vertical",className:"msg-tools",children:(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>n(e.id),children:(0,d.jsx)(ey.Tooltip,{title:"删除",children:(0,d.jsx)(ey.Button,{type:"link",size:"small",icon:(0,d.jsx)(ej.DeleteOutlined,{})})})})}),(0,d.jsx)("div",{className:"msg-header",children:(0,d.jsx)("span",{children:eO(e.createdAt)})}),(0,d.jsx)("div",{className:"msg-content",children:e.question}),(null==(t=e.files)?void 0:t.length)||(null==(l=e.agents)?void 0:l.length)?(0,d.jsxs)("div",{className:"msg-meta",children:[null==(r=e.files)?void 0:r.map(e=>(0,d.jsxs)(ey.Tag,{color:"processing",children:[(0,d.jsx)(ew,{type:"icon-paper-clip"})," ",e.name]},e.id)),null==(a=e.agents)?void 0:a.map(e=>(0,d.jsxs)(ey.Tag,{color:"blue",children:[(0,d.jsx)(ew,{type:"icon-at"})," ",e.name]},e.id))]}):null]}),(0,d.jsxs)("div",{className:"assistant-message",children:[(0,d.jsx)("div",{className:"msg-header",children:(0,d.jsxs)("span",{className:"msg-title",children:[(0,d.jsx)(ej.RobotOutlined,{})," 智能助理"]})}),(0,d.jsx)("div",{className:"msg-section",children:e.sending?(0,d.jsx)(ey.Skeleton,{active:!0}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"msg-content",children:(null==(i=e.answer)?void 0:i.answer)||""}),!!(null==(s=e.answer)||null==(o=s.plans)?void 0:o.length)&&(0,d.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,d.jsx)("summary",{className:"msg-ai-meta-title",children:"PLANS:"}),(0,d.jsx)("div",{className:"msg-ai-meta-list",children:e.answer.plans.map((e,t)=>(0,d.jsx)(ey.Tooltip,{title:e.description,children:(0,d.jsx)(ey.Tag,{color:"blue",children:e.name})},t))})]}),!!(null==(u=e.answer)||null==(c=u.extra)?void 0:c.length)&&(0,d.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,d.jsx)("summary",{className:"msg-ai-meta-title",children:"ACTIONS:"}),(0,d.jsx)("div",{className:"msg-ai-meta-list vertical",children:e.answer.extra.map((e,t)=>(0,d.jsxs)("div",{className:"msg-ai-meta-list-item",children:[(0,d.jsx)(ey.Tag,{color:"gold",children:e.element}),(0,d.jsx)("span",{children:e.action})]},t))})]})]})})]})]},e.id)})})}),eW=h().div`
|
|
603
|
+
`,eK=(0,p.forwardRef)((e,t)=>{let{list:l,onDeleteMessage:n}=e,r=(0,p.useRef)(null),a=()=>{setTimeout(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},100)};return(0,p.useImperativeHandle)(t,()=>({scrollToBottom:a})),(0,d.jsx)(e_,{className:"message-list",ref:r,children:l.map(e=>{var t,l,r,a,i,o,s,c,u;return(0,d.jsxs)("div",{className:"msg",children:[(0,d.jsxs)("div",{className:"user-message",children:[(0,d.jsx)(ey.Space,{size:4,orientation:"vertical",className:"msg-tools",children:(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>n(e.id),children:(0,d.jsx)(ey.Tooltip,{title:"删除",children:(0,d.jsx)(ey.Button,{type:"link",size:"small",icon:(0,d.jsx)(ej.DeleteOutlined,{})})})})}),(0,d.jsx)("div",{className:"msg-header",children:(0,d.jsx)("span",{children:eO(e.createdAt)})}),(0,d.jsxs)("div",{className:"msg-section",children:[(0,d.jsx)("div",{className:"msg-content",children:e.question}),(null==(t=e.files)?void 0:t.length)||(null==(l=e.agents)?void 0:l.length)?(0,d.jsxs)("div",{className:"msg-meta",children:[null==(r=e.files)?void 0:r.map(e=>(0,d.jsxs)(ey.Tag,{color:"processing",children:[(0,d.jsx)(ew,{type:"icon-paper-clip"})," ",e.name]},e.id)),null==(a=e.agents)?void 0:a.map(e=>(0,d.jsxs)(ey.Tag,{color:"blue",children:[(0,d.jsx)(ew,{type:"icon-at"})," ",e.name]},e.id))]}):null]})]}),(0,d.jsxs)("div",{className:"assistant-message",children:[(0,d.jsx)("div",{className:"msg-header",children:(0,d.jsxs)("span",{className:"msg-title",children:[(0,d.jsx)(ej.RobotOutlined,{})," 智能助理"]})}),(0,d.jsx)("div",{className:"msg-section",children:e.sending?(0,d.jsx)(ey.Skeleton,{active:!0}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"msg-content",children:(null==(i=e.answer)?void 0:i.answer)||""}),!!(null==(s=e.answer)||null==(o=s.plans)?void 0:o.length)&&(0,d.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,d.jsx)("summary",{className:"msg-ai-meta-title",children:"PLANS:"}),(0,d.jsx)("div",{className:"msg-ai-meta-list",children:e.answer.plans.map((e,t)=>(0,d.jsx)(ey.Tooltip,{title:e.description,children:(0,d.jsx)(ey.Tag,{color:"blue",children:e.name})},t))})]}),!!(null==(u=e.answer)||null==(c=u.extra)?void 0:c.length)&&(0,d.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,d.jsx)("summary",{className:"msg-ai-meta-title",children:"ACTIONS:"}),(0,d.jsx)("div",{className:"msg-ai-meta-list vertical",children:e.answer.extra.map((e,t)=>(0,d.jsxs)("div",{className:"msg-ai-meta-list-item",children:[(0,d.jsx)(ey.Tag,{color:"gold",children:e.element}),(0,d.jsx)("span",{children:e.action})]},t))})]})]})})]})]},e.id)})})}),eW=h().div`
|
|
600
604
|
display: flex;
|
|
601
605
|
flex-direction: column;
|
|
602
606
|
height: 100%;
|
|
@@ -896,7 +900,7 @@
|
|
|
896
900
|
flex-direction: column;
|
|
897
901
|
gap: 12px;
|
|
898
902
|
padding: 12px;
|
|
899
|
-
height: calc(100% -
|
|
903
|
+
height: calc(100% - 49px);
|
|
900
904
|
}
|
|
901
905
|
.left-pane-tabs > label,
|
|
902
906
|
.right-pane-tabs > label {
|
|
@@ -1020,7 +1024,7 @@
|
|
|
1020
1024
|
const module = undefined;
|
|
1021
1025
|
const exports = undefined;
|
|
1022
1026
|
${e.customRender}
|
|
1023
|
-
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),g=()=>{console.log("callback table",eS(m,l))};return(0,p.useEffect)(()=>{x({id:l.id,callback:g})},[]),(0,d.jsx)(ey.Table,{id:t,dataSource:n,columns:f,pagination:h,bordered:i,size:o,showHeader:"boolean"!=typeof s||s,rowKey:(e,t)=>String(t),style:{padding:1,...c},className:u})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l)=>{let r=[...t.columns||[]];r[e]={...r[e],...l},n("columns",r)},[a,i]=(0,p.useState)(!1),[o,s]=(0,p.useState)(null),c=null!=o&&t.columns[o]?t.columns[o]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1},u=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex"},{title:"操作",width:80,align:"center",render:(e,l,r)=>(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{s(r),i(!0)},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(r,1),n("columns",e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})]})}];return(0,d.jsxs)("div",{children:[(0,d.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ey.Form.Item,{label:"大小",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ey.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ey.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ey.Form.Item,{label:"边框",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,d.jsx)(ey.Form.Item,{label:"显示表头",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.showHeader,onChange:e=>n("showHeader",e)})}),(0,d.jsx)(ey.Form.Item,{label:"分页大小",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.pageSize,onChange:e=>n("pageSize",e)})})]}),(0,d.jsx)(ey.Divider,{children:"表格列设置"}),(0,d.jsx)(ey.Table,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:u,pagination:!1,bordered:!0}),(0,d.jsx)(ey.Button,{size:"small",onClick:()=>{n("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,d.jsx)(ey.Modal,{title:"编辑列",open:a,footer:null,width:400,onCancel:()=>i(!1),children:(0,d.jsx)(ey.Form,{layout:"vertical",children:(0,d.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,d.jsx)(ey.Form.Item,{label:"列名",children:(0,d.jsx)(ey.Input,{value:c.title,onChange:e=>r(o,{title:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"数据索引",children:(0,d.jsx)(ey.Input,{value:c.dataIndex,onChange:e=>r(o,{dataIndex:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"宽度",children:(0,d.jsx)(ey.Input,{value:c.width,onChange:e=>r(o,{width:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"对齐",children:(0,d.jsxs)(ey.Radio.Group,{value:c.align,onChange:e=>r(o,{align:e.target.value}),children:[(0,d.jsx)(ey.Radio.Button,{value:"left",children:(0,d.jsx)(ej.AlignLeftOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"center",children:(0,d.jsx)(ej.AlignCenterOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"right",children:(0,d.jsx)(ej.AlignRightOutlined,{})})]})}),(0,d.jsx)(ey.Form.Item,{label:"省略",children:(0,d.jsx)(ey.Switch,{checked:!!c.ellipsis,onChange:e=>r(o,{ellipsis:e})})})]})})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:null},props:{size:"default",bordered:!0,showHeader:!0,pageSize:10,dataSource:[{name:"苹果",count:12},{name:"华为",count:803},{name:"OPPO",count:654},{name:"vivo",count:719}],columns:[{title:"品牌",dataIndex:"name"},{title:"日销量(件)",dataIndex:"count"}]}}},{group:"基础组件",key:"b-list",label:"列表",icon:"icon-unordered-list",component:e=>{let{id:t,pageSize:l=10,bordered:n=!0,size:r="default",itemLayout:a="horizontal",item:i,split:o=!0,style:s={},className:c}=e,{env:u,initCallback:m}=(0,p.useContext)(ex),x=th(t,i.datasource)||[],h=(0,p.useMemo)(()=>!!l&&!(l<=x.length)&&{total:x.length,pageSize:l,size:"default"===r?void 0:r,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,pageSizeOptions:["10","20","30","40"],showTotal:(e,t)=>`共 ${e} 条记录,显示第 ${t[0]}-${t[1]} 条`},[l,x.length,r]),f=["p-list",a?`p-list--${a}`:void 0,r?`p-list--${r}`:void 0,o?"p-list--split":void 0,n?"p-list--bordered":void 0,c],g=()=>{console.log("callback list",eS(u,i))};return(0,p.useEffect)(()=>{m({id:i.id,callback:g})},[]),(0,d.jsxs)("div",{id:t,style:{display:"flex",flexDirection:"column",...s},className:f.filter(Boolean).join(" "),children:[(0,d.jsx)(tS,{list:x,split:o,bordered:n,size:r,itemLayout:a}),h&&(0,d.jsx)(ey.Pagination,{...h})]})},formComponent:e=>{let{model:t,onChange:l}=e,[n]=ey.Form.useForm();return(0,p.useEffect)(()=>{n.setFieldsValue({size:t.size||"default",itemLayout:t.itemLayout||"horizontal",bordered:t.bordered??!1,split:t.split??!0,pageSize:t.pageSize||10})},[t,n]),(0,d.jsxs)(ey.Form,{form:n,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==l||l({...t,...e})},children:[(0,d.jsx)(ey.Form.Item,{label:"大小",name:"size",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ey.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ey.Radio.Button,{value:"small",children:"小"})]})}),(0,d.jsx)(ey.Form.Item,{label:"布局",name:"itemLayout",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ey.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ey.Radio.Button,{value:"vertical",children:"垂直"})]})}),(0,d.jsx)(ey.Form.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,d.jsx)(ey.Switch,{size:"small"})}),(0,d.jsx)(ey.Form.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,d.jsx)(ey.Switch,{size:"small"})}),(0,d.jsx)(ey.Form.Item,{label:"分页大小",name:"pageSize",children:(0,d.jsx)(ey.InputNumber,{size:"small"})})]})},defaultOptions:{datasource:{source:"custom",custom:"[]"},props:{size:"default",itemLayout:"horizontal",bordered:!0,split:!0,pageSize:10}}},{group:"基础组件",key:"b-html",label:"HTML",icon:"icon-html",component:e=>{let{id:t,template:l="",item:n,style:r,className:a}=e,{env:
|
|
1027
|
+
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),g=()=>{console.log("callback table",eS(m,l))};return(0,p.useEffect)(()=>{x({id:l.id,callback:g})},[]),(0,d.jsx)(ey.Table,{id:t,dataSource:n,columns:f,pagination:h,bordered:i,size:o,showHeader:"boolean"!=typeof s||s,rowKey:(e,t)=>String(t),style:{padding:1,...c},className:u})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l)=>{let r=[...t.columns||[]];r[e]={...r[e],...l},n("columns",r)},[a,i]=(0,p.useState)(!1),[o,s]=(0,p.useState)(null),c=null!=o&&t.columns[o]?t.columns[o]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1},u=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex"},{title:"操作",width:80,align:"center",render:(e,l,r)=>(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{s(r),i(!0)},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(r,1),n("columns",e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})]})}];return(0,d.jsxs)("div",{children:[(0,d.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ey.Form.Item,{label:"大小",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ey.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ey.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ey.Form.Item,{label:"边框",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,d.jsx)(ey.Form.Item,{label:"显示表头",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.showHeader,onChange:e=>n("showHeader",e)})}),(0,d.jsx)(ey.Form.Item,{label:"分页大小",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.pageSize,onChange:e=>n("pageSize",e)})})]}),(0,d.jsx)(ey.Divider,{children:"表格列设置"}),(0,d.jsx)(ey.Table,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:u,pagination:!1,bordered:!0}),(0,d.jsx)(ey.Button,{size:"small",onClick:()=>{n("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,d.jsx)(ey.Modal,{title:"编辑列",open:a,footer:null,width:400,onCancel:()=>i(!1),children:(0,d.jsx)(ey.Form,{layout:"vertical",children:(0,d.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,d.jsx)(ey.Form.Item,{label:"列名",children:(0,d.jsx)(ey.Input,{value:c.title,onChange:e=>r(o,{title:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"数据索引",children:(0,d.jsx)(ey.Input,{value:c.dataIndex,onChange:e=>r(o,{dataIndex:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"宽度",children:(0,d.jsx)(ey.Input,{value:c.width,onChange:e=>r(o,{width:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"对齐",children:(0,d.jsxs)(ey.Radio.Group,{value:c.align,onChange:e=>r(o,{align:e.target.value}),children:[(0,d.jsx)(ey.Radio.Button,{value:"left",children:(0,d.jsx)(ej.AlignLeftOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"center",children:(0,d.jsx)(ej.AlignCenterOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"right",children:(0,d.jsx)(ej.AlignRightOutlined,{})})]})}),(0,d.jsx)(ey.Form.Item,{label:"省略",children:(0,d.jsx)(ey.Switch,{checked:!!c.ellipsis,onChange:e=>r(o,{ellipsis:e})})})]})})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:null},props:{size:"default",bordered:!0,showHeader:!0,pageSize:10,dataSource:[{name:"苹果",count:12},{name:"华为",count:803},{name:"OPPO",count:654},{name:"vivo",count:719}],columns:[{title:"品牌",dataIndex:"name"},{title:"日销量(件)",dataIndex:"count"}]}}},{group:"基础组件",key:"b-list",label:"列表",icon:"icon-unordered-list",component:e=>{let{id:t,pageSize:l=10,bordered:n=!0,size:r="default",itemLayout:a="horizontal",item:i,split:o=!0,style:s={},className:c}=e,{env:u,initCallback:m}=(0,p.useContext)(ex),x=th(t,i.datasource)||[],h=(0,p.useMemo)(()=>!!l&&!(l<=x.length)&&{total:x.length,pageSize:l,size:"default"===r?void 0:r,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,pageSizeOptions:["10","20","30","40"],showTotal:(e,t)=>`共 ${e} 条记录,显示第 ${t[0]}-${t[1]} 条`},[l,x.length,r]),f=["p-list",a?`p-list--${a}`:void 0,r?`p-list--${r}`:void 0,o?"p-list--split":void 0,n?"p-list--bordered":void 0,c],g=()=>{console.log("callback list",eS(u,i))};return(0,p.useEffect)(()=>{m({id:i.id,callback:g})},[]),(0,d.jsxs)("div",{id:t,style:{display:"flex",flexDirection:"column",...s},className:f.filter(Boolean).join(" "),children:[(0,d.jsx)(tS,{list:x,split:o,bordered:n,size:r,itemLayout:a}),h&&(0,d.jsx)(ey.Pagination,{...h})]})},formComponent:e=>{let{model:t,onChange:l}=e,[n]=ey.Form.useForm();return(0,p.useEffect)(()=>{n.setFieldsValue({size:t.size||"default",itemLayout:t.itemLayout||"horizontal",bordered:t.bordered??!1,split:t.split??!0,pageSize:t.pageSize||10})},[t,n]),(0,d.jsxs)(ey.Form,{form:n,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==l||l({...t,...e})},children:[(0,d.jsx)(ey.Form.Item,{label:"大小",name:"size",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ey.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ey.Radio.Button,{value:"small",children:"小"})]})}),(0,d.jsx)(ey.Form.Item,{label:"布局",name:"itemLayout",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ey.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ey.Radio.Button,{value:"vertical",children:"垂直"})]})}),(0,d.jsx)(ey.Form.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,d.jsx)(ey.Switch,{size:"small"})}),(0,d.jsx)(ey.Form.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,d.jsx)(ey.Switch,{size:"small"})}),(0,d.jsx)(ey.Form.Item,{label:"分页大小",name:"pageSize",children:(0,d.jsx)(ey.InputNumber,{size:"small"})})]})},defaultOptions:{datasource:{source:"custom",custom:"[]"},props:{size:"default",itemLayout:"horizontal",bordered:!0,split:!0,pageSize:10}}},{group:"基础组件",key:"b-html",label:"HTML",icon:"icon-html",component:e=>{let{id:t,template:l="",item:n,style:r,className:a,classNames:i=[]}=e,{env:o,initCallback:s}=(0,p.useContext)(ex),c=th(t,n.datasource),u=(0,p.useMemo)(()=>Object.keys(c||{}),[c]),m=(0,p.useMemo)(()=>u.map(e=>null==c?void 0:c[e]),[u,c]),x=(0,p.useMemo)(()=>(l||"").replace(/{{\s*([^}]+)\s*}}/g,(e,t)=>{try{return Function(...u,`
|
|
1024
1028
|
"use strict";
|
|
1025
1029
|
const window = undefined;
|
|
1026
1030
|
const document = undefined;
|
|
@@ -1030,7 +1034,7 @@
|
|
|
1030
1034
|
const module = undefined;
|
|
1031
1035
|
const exports = undefined;
|
|
1032
1036
|
return ${t};
|
|
1033
|
-
`)(...
|
|
1037
|
+
`)(...m)}catch{return""}}),[l,m]),h=()=>{console.log("callback html",eS(o,n))};return(0,p.useEffect)(()=>{s({id:n.id,callback:h})},[]),(0,d.jsx)("div",{id:t,style:r,className:(i||[]).join(" ")+" "+a,dangerouslySetInnerHTML:{__html:x}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,p.useRef)(null),r=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsx)("div",{children:(0,d.jsxs)(ey.Form,{layout:"vertical",children:[(0,d.jsx)(ey.Form.Item,{label:"类名",children:(0,d.jsx)(ey.Select,{size:"small",value:t.classNames,mode:"tags",onChange:e=>r("classNames",e)})}),(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["模板",(0,d.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=n.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,d.jsx)(ew,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,d.jsx)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:(0,d.jsx)(eV(),{onMount:e=>{n.current={editor:e}},height:"300px",defaultLanguage:"html",value:t.template,onChange:e=>r("template",e||""),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'{"name": "Confucius"}'},props:{template:"<div>{{name}}, welcome to the world of programming.</div>"}}},{group:"基础组件",key:"b-echarts",label:"图表",icon:"icon-echarts",component:e=>{let{id:t,script:l="",item:n,height:r=400,style:a,className:i}=e,{initCallback:o,env:s}=(0,p.useContext)(ex),c=(0,p.useRef)(null),[u,m]=(0,p.useState)(null),x=th(t,n.datasource),h=()=>{console.log("callback echarts",eS(s,n))};return(0,p.useEffect)(()=>{if(!c.current)return;let e=tI.init(c.current);m(e);let t=()=>e.resize();return window.addEventListener("resize",t),o({id:n.id,callback:h}),()=>{window.removeEventListener("resize",t),e.dispose()}},[]),(0,p.useEffect)(()=>{let e=(e=>{try{return JSON.parse(e)}catch(t){try{return Function("echarts","console","Math","Date","Array","Object","String","Number","Boolean","data",`
|
|
1034
1038
|
"use strict";
|
|
1035
1039
|
const window = undefined;
|
|
1036
1040
|
const document = undefined;
|
package/package.json
CHANGED
|
@@ -503,8 +503,6 @@ const MessageRoot = styled.div`
|
|
|
503
503
|
background: var(--ant-color-bg-container);
|
|
504
504
|
|
|
505
505
|
.user-message {
|
|
506
|
-
background: var(--ant-color-primary-bg);
|
|
507
|
-
padding: 8px 10px;
|
|
508
506
|
max-width: 90%;
|
|
509
507
|
margin: 10px 0 10px auto;
|
|
510
508
|
position: relative;
|
|
@@ -523,7 +521,13 @@ const MessageRoot = styled.div`
|
|
|
523
521
|
.msg-header {
|
|
524
522
|
justify-content: flex-end;
|
|
525
523
|
color: var(--ant-color-text-tertiary);
|
|
526
|
-
padding: 4px
|
|
524
|
+
padding: 4px 10px 8px 10px;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.msg-section {
|
|
528
|
+
background: var(--ant-color-primary-bg);
|
|
529
|
+
padding: 8px 10px;
|
|
530
|
+
border-radius: var(--ant-border-radius);
|
|
527
531
|
}
|
|
528
532
|
}
|
|
529
533
|
.assistant-message {
|
|
@@ -655,21 +659,23 @@ const MessageList = forwardRef<
|
|
|
655
659
|
{/* <span className="msg-title">用户</span> */}
|
|
656
660
|
<span>{formatTime(msg.createdAt)}</span>
|
|
657
661
|
</div>
|
|
658
|
-
<div className="msg-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
<
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
<
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
662
|
+
<div className="msg-section">
|
|
663
|
+
<div className="msg-content">{msg.question}</div>
|
|
664
|
+
{msg.files?.length || msg.agents?.length ? (
|
|
665
|
+
<div className="msg-meta">
|
|
666
|
+
{msg.files?.map((f) => (
|
|
667
|
+
<Tag key={f.id} color="processing">
|
|
668
|
+
<IconFont type="icon-paper-clip" /> {f.name}
|
|
669
|
+
</Tag>
|
|
670
|
+
))}
|
|
671
|
+
{msg.agents?.map((a) => (
|
|
672
|
+
<Tag key={a.id} color="blue">
|
|
673
|
+
<IconFont type="icon-at" /> {a.name}
|
|
674
|
+
</Tag>
|
|
675
|
+
))}
|
|
676
|
+
</div>
|
|
677
|
+
) : null}
|
|
678
|
+
</div>
|
|
673
679
|
</div>
|
|
674
680
|
{/* <div
|
|
675
681
|
style={{
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
|
-
import { Form } from "antd";
|
|
2
|
+
import { Form, Select } from "antd";
|
|
3
3
|
import Editor from "@monaco-editor/react";
|
|
4
4
|
import type { PropEditorProps } from "./types";
|
|
5
5
|
import { IconFont } from "../../../icon/IconFont";
|
|
6
6
|
|
|
7
|
-
export type HtmlModel = { template: string };
|
|
7
|
+
export type HtmlModel = { template: string; classNames?: string[] };
|
|
8
8
|
|
|
9
9
|
export const HtmlProps: React.FC<PropEditorProps<HtmlModel>> = ({
|
|
10
10
|
model,
|
|
11
11
|
onChange,
|
|
12
12
|
}) => {
|
|
13
13
|
const ref = useRef<any>(null);
|
|
14
|
-
const
|
|
15
|
-
onChange && onChange({ ...model,
|
|
14
|
+
const triggerModel = (key: keyof HtmlModel, value: any) =>
|
|
15
|
+
onChange && onChange({ ...model, [key]: value });
|
|
16
16
|
const format = () => {
|
|
17
17
|
const editor = (ref.current as any)?.editor;
|
|
18
18
|
editor?.getAction("editor.action.formatDocument")?.run();
|
|
@@ -20,6 +20,14 @@ export const HtmlProps: React.FC<PropEditorProps<HtmlModel>> = ({
|
|
|
20
20
|
return (
|
|
21
21
|
<div>
|
|
22
22
|
<Form layout="vertical">
|
|
23
|
+
<Form.Item label="类名">
|
|
24
|
+
<Select
|
|
25
|
+
size="small"
|
|
26
|
+
value={model.classNames}
|
|
27
|
+
mode="tags"
|
|
28
|
+
onChange={(value) => triggerModel("classNames", value)}
|
|
29
|
+
/>
|
|
30
|
+
</Form.Item>
|
|
23
31
|
<Form.Item
|
|
24
32
|
label={
|
|
25
33
|
<>
|
|
@@ -45,7 +53,7 @@ export const HtmlProps: React.FC<PropEditorProps<HtmlModel>> = ({
|
|
|
45
53
|
height="300px"
|
|
46
54
|
defaultLanguage="html"
|
|
47
55
|
value={model.template}
|
|
48
|
-
onChange={(v) =>
|
|
56
|
+
onChange={(v) => triggerModel("template", v || "")}
|
|
49
57
|
options={{
|
|
50
58
|
minimap: { enabled: false },
|
|
51
59
|
scrollBeyondLastLine: false,
|
|
@@ -9,6 +9,7 @@ export type HtmlRenderProps = {
|
|
|
9
9
|
template?: string;
|
|
10
10
|
style?: React.CSSProperties;
|
|
11
11
|
item: any;
|
|
12
|
+
classNames?: string[];
|
|
12
13
|
} & HtmlBaseProps;
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -28,6 +29,7 @@ export const HtmlRender: React.FC<HtmlRenderProps> = ({
|
|
|
28
29
|
item,
|
|
29
30
|
style,
|
|
30
31
|
className,
|
|
32
|
+
classNames = [],
|
|
31
33
|
}) => {
|
|
32
34
|
const { env, initCallback } = useContext(EnvContext);
|
|
33
35
|
const datasource = useDatasource(id, item.datasource);
|
|
@@ -79,7 +81,7 @@ export const HtmlRender: React.FC<HtmlRenderProps> = ({
|
|
|
79
81
|
<div
|
|
80
82
|
id={id}
|
|
81
83
|
style={style}
|
|
82
|
-
className={className}
|
|
84
|
+
className={(classNames || []).join(" ") + (" " + className || "")}
|
|
83
85
|
dangerouslySetInnerHTML={{ __html: html }}
|
|
84
86
|
/>
|
|
85
87
|
);
|