bi-sdk-react 0.0.70 → 0.0.72

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.
@@ -0,0 +1,1443 @@
1
+ (()=>{"use strict";var e,l,t,a,n,i,s={433(e,l,t){var a=t(4848),n=t(6540),i=t(5338),s=t(6385),r=t(8623),o=t(5100),d=t(8237),c=t(7152),u=t(6370),p=t(6380),x=t(7201),m=t(400),h=t(2790),g=t(1500),f=t(2152);let j=e=>{var l;let{datasetId:t,var:i,dependencies:s}=e,{schema:r,getGlobalEnv:o,fetch:d,env:c,updateGlobalVar:u}=(0,n.useContext)(v),p=null==r||null==(l=r.datasets)?void 0:l.find(e=>e.id===t);if(!p||!(null==d?void 0:d.dataset))return(0,a.jsx)(a.Fragment,{});let x=(0,n.useMemo)(()=>s.reduce((e,l)=>[...e,c.global[l]],[]),[s,c.global]),m=async()=>{var e;for(let e=0;e<s.length;e++)if(!Object.keys(c.global).includes(s[e]))return;let l=s.reduce((e,l)=>{let t=o(l);return{...e,[l]:t}},{}),{code:a,data:n}=await (null==d||null==(e=d.dataset)?void 0:e.call(d,t,l,p.aiPrompt));"OK"===a&&u(i,n)};return(0,n.useEffect)(()=>{m()},[t,d,...x]),(0,a.jsx)(a.Fragment,{})},v=(0,n.createContext)({pageId:"",designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,atItems:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{},onAddAtItem:()=>{},onRemoveAtItem:()=>{},clearAtItems:()=>{},datasetSelector:void 0,datasetAdd:void 0,fetch:void 0,deviceWidth:0,setDeviceWidth:()=>{},initCallback:()=>{},handleCallback:()=>{},initMethod:()=>{},handleMethod:()=>{},getVars:()=>({}),setVar:()=>{},env:{global:{},local:{}},getGlobalEnv:()=>void 0,setGlobalEnv:()=>{},setItemData:()=>{},globalVars:{},updateGlobalVar:()=>{}}),b=e=>{var l;let{pageId:t,designable:i,plugins:s,schema:r,selectedItem:o,setSchema:d,setSelectedItem:c,datasetSelector:u,datasetAdd:p,fetch:x,children:m,setItemData:h}=e,[g,f]=(0,n.useState)(0),[b,y]=(0,n.useState)({}),[A,C]=(0,n.useState)([]),[w,k]=(0,n.useState)({global:{},local:{}}),[z,S]=(0,n.useState)({}),[I,N]=(0,n.useState)({}),T=e=>({...w.global,...w.local[e||""]||{}});return(0,n.useEffect)(()=>{let e={};(r.variables||[]).forEach(l=>{e[l.name]=l.value}),k(l=>({...l,global:e}))},[r.variables]),(0,a.jsxs)(v.Provider,{value:{pageId:t,designable:!!i,plugins:s||[],schema:r,selectedItem:o,atItems:A,setSchema:d||(()=>{}),setSelectedItem:c||(()=>{}),updateSelectedItem:e=>{null==c||c(Object.assign(o,e||{})),null==d||d({...r})},datasetSelector:u,datasetAdd:p,fetch:x,forceUpdate:()=>{null==d||d({...r})},onAddAtItem:e=>{null!=A&&A.includes(e)||C([...A,e])},onRemoveAtItem:e=>{C(A.filter(l=>l!==e))},clearAtItems:()=>{C([])},deviceWidth:g,setDeviceWidth:f||(()=>{}),initCallback:e=>{let{id:l,callback:t}=e;S(e=>({...e,[l]:t}))},handleCallback:(e,l,t)=>{(e.cascadeIds||[]).forEach(e=>{let a=z[e];if("function"==typeof a){let n=a(l,T(e));if(n){let{target:e,data:l}=n;null==t||t(e,l)}}})},initMethod:e=>{let{id:l,method:t}=e;N(e=>({...e,[l]:t}))},handleMethod:(e,l,t,a)=>{let n=I[l][t];return"function"==typeof n?n({sourceId:e.id,arg:a}):null},getVars:T,setVar:(e,l,t)=>{let a={...w};(e.cascadeIds||[]).forEach(e=>{a.local[e]=a.local[e]||{},a.local[e][l]=t})},env:w,getGlobalEnv:e=>w.global[e],setGlobalEnv:(e,l)=>{k(t=>({...t,global:{...t.global,[e]:l}}))},setItemData:h,globalVars:b,updateGlobalVar:(e,l)=>{y(t=>({...t,[e]:l}))}},children:[m,null==(l=r.datasets)?void 0:l.map((e,l)=>(0,a.jsx)(j,{datasetId:e.id,var:e.key,dependencies:e.dependencies||[]},l))]})};var y=t(889);let A=(0,t(8607).A)({scriptUrl:"https://at.alicdn.com/t/c/font_5072483_qyp3hlby2nr.js"}),C=e=>{let{type:l,className:t="",style:n={}}=e;return(0,a.jsx)(A,{type:l,className:t,style:n})};var w=t(4022),k=t(6029),z=t(4301),S=t(9814),I=t(4778),N=t(3423),T=t(2443),O=t(961),E=t(4518);let B=f.Ay.div`
2
+ display: flex;
3
+ flex-direction: row;
4
+ align-items: flex-end;
5
+
6
+ > * {
7
+ background-color: rgb(24, 144, 255);
8
+ color: #fff;
9
+ font-size: 12px;
10
+ border-bottom-left-radius: 0;
11
+ border-bottom-right-radius: 0;
12
+ padding: 2px 8px;
13
+ cursor: pointer;
14
+ user-select: none;
15
+ height: 22px;
16
+ box-sizing: border-box;
17
+
18
+ &:first-child {
19
+ border-top-left-radius: 4px;
20
+ border-top-right-radius: 2px;
21
+ margin-right: 1px;
22
+
23
+ & + a {
24
+ border-top-left-radius: 1px;
25
+ }
26
+ }
27
+
28
+ &:last-child {
29
+ border-top-right-radius: 4px;
30
+ }
31
+ }
32
+
33
+ > a {
34
+ background-color: rgb(24, 144, 255, 0.6);
35
+ font-size: 10px;
36
+ height: 20px;
37
+
38
+ &:hover {
39
+ background-color: rgb(24, 144, 255, 1);
40
+ }
41
+ }
42
+ `,L=f.Ay.div`
43
+ user-select: none;
44
+ font-size: 12px;
45
+ text-align: center;
46
+ color: var(--ant-color-text-placeholder);
47
+ background: var(--ant-color-bg-layout);
48
+ border: dotted 1px #ccc;
49
+
50
+ &:before {
51
+ content: "组件已隐藏";
52
+ }
53
+ `,$=e=>{let{item:l,ancestors:t,onAddAt:i,onDelete:s,onCopy:r,onUpdate:o,onSelect:d}=e,[c,u]=(0,n.useState)(JSON.stringify(l||{},null,2)),[p,x]=(0,n.useState)(!1),h=(0,n.useRef)(null),g=(0,a.jsx)(z.A.Text,{children:l.name||l.type+`(${l.id})`});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.A,{title:`源码编辑(${l.name||l.type+`(${l.id})`})`,open:p,width:700,onCancel:()=>{x(!1),h.current=null},styles:{body:{margin:"0 -24px"}},footer:(0,a.jsxs)(I.A,{children:[(0,a.jsx)(m.Ay,{onClick:()=>{x(!1),h.current=null},children:"取消"}),(0,a.jsx)(m.Ay,{onClick:()=>{u(JSON.stringify(l||{},null,2))},children:"重置"}),(0,a.jsx)(m.Ay,{onClick:()=>{var e,l;let t=null==(e=h.current)?void 0:e.editor;null==t||null==(l=t.getAction("editor.action.formatDocument"))||l.run()},children:"格式化"}),(0,a.jsx)(m.Ay,{type:"primary",onClick:()=>{x(!1),Object.assign(l,JSON.parse(c)),o&&o()},children:"保存"})]}),children:(0,a.jsx)(E.KE,{height:"400px",defaultLanguage:"json",value:c,onChange:e=>u(e||""),options:{minimap:{enabled:!1}},onMount:e=>{h.current={editor:e}}})}),(0,a.jsxs)(B,{children:[(null==t?void 0:t.length)?(0,a.jsx)(N.A,{placement:"topLeft",menu:{style:{borderRadius:0,padding:0,background:"none",boxShadow:"none"},items:t.map(e=>({label:(null==e?void 0:e.name)||(null==e?void 0:e.type)+`(${null==e?void 0:e.id})`,key:null==e?void 0:e.id,onClick:()=>{null==d||d(e)}}))},styles:{item:{borderRadius:2,background:"rgba(24, 144, 255, 0.8)",padding:"2px 8px",color:"#fff",fontSize:12,marginTop:2}},children:g}):g,i&&(0,a.jsx)(T.A,{title:"添加到对话",children:(0,a.jsx)("a",{onClick:i,children:(0,a.jsx)(C,{type:"icon-number"})})}),(0,a.jsx)(T.A,{title:"源码编辑",children:(0,a.jsx)("a",{onClick:e=>{e.stopPropagation(),x(!0)},children:(0,a.jsx)(C,{type:"icon-json"})})}),(0,a.jsx)(T.A,{title:"复制",children:(0,a.jsx)("a",{onClick:r,children:(0,a.jsx)(w.A,{})})}),(0,a.jsx)(T.A,{title:"删除",children:(0,a.jsx)("a",{onClick:s,children:(0,a.jsx)(k.A,{})})})]})]})},D=e=>{var l,t,i;let{item:s,onCopy:r,onDelete:o,ancestors:d,parentList:c,onListChange:u,index:p}=e,{designable:x,selectedItem:m,setSelectedItem:h,plugins:g,onAddAtItem:f,onRemoveAtItem:j,forceUpdate:b,fetch:A,globalVars:C,env:w}=(0,n.useContext)(v),[k,z]=(0,n.useState)(!1),[I,N]=(0,n.useState)(null),T=e=>{e.stopPropagation(),S.A.confirm({title:"确认删除吗?",okText:"确认",cancelText:"取消",okType:"danger",onOk:()=>{o&&o(),j&&j(s)}})},E=e=>{e.stopPropagation(),r&&r(s)},B=e=>{e.stopPropagation(),f&&f(s)},D=null==(l=g.find(e=>e.key===s.type))?void 0:l.component,M=(0,n.useMemo)(()=>{let e=s.hideExpression;if(!(null==e?void 0:e.length))return!1;try{return Function("$g","$e",`
54
+ "use strict";
55
+ const window = undefined;
56
+ const document = undefined;
57
+ const global = undefined;
58
+ const process = undefined;
59
+ const require = undefined;
60
+ const module = undefined;
61
+ const exports = undefined;
62
+ return ${e} === true;
63
+ `)(C,w.global)}catch(e){return!1}},[s.hideExpression,C,w]);return((0,n.useEffect)(()=>{let e=()=>{if(!l.current)return;let e=document.getElementById(`page-item-${s.id}`);if(!e)return void t();let a=e.getBoundingClientRect();if(0===a.width&&0===a.height){l.current.style.display="none";return}l.current.style.display="flex";let n=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,i=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;l.current.style.top=`${a.top+n-22}px`,l.current.style.left=`${a.left+i-1}px`},l={current:null},t=()=>{l.current&&(document.body.contains(l.current)&&document.body.removeChild(l.current),l.current=null,N(null),window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e))};if(m&&m===s&&x){let a=document.createElement("div");return a.setAttribute("id","page-item-toolbar"),a.style.position="absolute",a.style.zIndex="1000",a.style.display="flex",a.style.gap="4px",document.body.appendChild(a),l.current=a,N(a),e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>t()}},[m,x,s]),(0,n.useEffect)(()=>{let e=document.getElementById(`page-item-${s.id}`);if(!e||!x)return;let l=(0,y.kZ)({element:e,getInitialData:()=>({id:s.id,index:p,list:c,onListChange:u,data:s}),canDrag:()=>!!x,onDragStart:()=>{z(!0)},onDrop:()=>{z(!1)}}),t=e=>{e.stopPropagation(),h&&h(s)};return x&&e.addEventListener("click",t),()=>{l(),x&&e.removeEventListener("click",t)}},[x,s,p,c]),D)?M?x?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{id:`page-item-${s.id}`,"data-item-id":s.id,className:`page-item-component ${x?"designable":""} ${m===s?"selected":""}`}),I&&O.createPortal((0,a.jsx)($,{item:s,ancestors:d,onAddAt:(null==A||null==(i=A.ai)?void 0:i.chat)?B:void 0,onCopy:E,onDelete:T,onUpdate:b,onSelect:h}),I)]}):null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(D,{id:`page-item-${s.id}`,"data-item-id":s.id,...s.props||{},item:s,className:`page-item-component ${x?"designable":""} ${m===s?"selected":""}`,ancestors:d,style:{...s.style||{},opacity:k?.5:1}}),I&&O.createPortal((0,a.jsx)($,{item:s,ancestors:d,onAddAt:(null==A||null==(t=A.ai)?void 0:t.chat)?B:void 0,onCopy:E,onDelete:T,onUpdate:b,onSelect:h}),I)]}):null};var M=t(6266);let R=()=>(0,M.A)(),F=e=>{if(!e)return"";let l=new Date(e),t=new Date,a=t.getTime()-l.getTime();if(a<6e4)return"刚刚";if(a<36e5)return`${Math.floor(a/6e4)}分钟前`;let n=e=>e.toString().padStart(2,"0"),i=n(l.getHours()),s=n(l.getMinutes());if(l.getDate()===t.getDate()&&l.getMonth()===t.getMonth()&&l.getFullYear()===t.getFullYear())return`${i}:${s}`;let r=n(l.getMonth()+1),o=n(l.getDate());if(l.getFullYear()===t.getFullYear())return`${r}-${o} ${i}:${s}`;let d=l.getFullYear();return`${d}-${r}-${o} ${i}:${s}`},P=f.Ay.div`
64
+ position: absolute;
65
+ background: #1890ff;
66
+ pointer-events: none;
67
+ opacity: ${e=>+!!e.$visible};
68
+ transition: all 0.1s ease-out;
69
+
70
+ /* Horizontal bar (Vertical list) */
71
+ ${e=>!e.$vertical&&`
72
+ left: 8px;
73
+ right: 8px;
74
+ height: 2px;
75
+ top: ${e.$offset}px;
76
+ `}
77
+
78
+ /* Vertical bar (Horizontal list) */
79
+ ${e=>e.$vertical&&`
80
+ top: 8px;
81
+ bottom: 8px;
82
+ width: 2px;
83
+ left: ${e.$offset}px;
84
+ `}
85
+
86
+ &::before,
87
+ &::after {
88
+ content: "";
89
+ position: absolute;
90
+ width: 8px;
91
+ height: 8px;
92
+ background: #1890ff;
93
+ border-radius: 50%;
94
+ }
95
+
96
+ ${e=>!e.$vertical&&`
97
+ &::before { top: -3px; left: -4px; }
98
+ &::after { top: -3px; right: -4px; }
99
+ `}
100
+
101
+ ${e=>e.$vertical&&`
102
+ &::before { left: -3px; top: -4px; }
103
+ &::after { left: -3px; bottom: -4px; }
104
+ `}
105
+ `,G=(e,l,t,a)=>{let n=e.getBoundingClientRect(),i=Array.from(e.children).filter(e=>!e.classList.contains("drop-indicator")&&e.getBoundingClientRect().width>0),s=(e=>{let l=Array.from(e.children).filter(e=>!e.classList.contains("drop-indicator")&&e.getBoundingClientRect().width>0);if(0===l.length){let l=window.getComputedStyle(e),{display:t,flexDirection:a}=l;return"flex"===t||"inline-flex"===t?!a.includes("column"):"grid"===t&&!l.gridAutoFlow.includes("column")}if(1===l.length){let t=window.getComputedStyle(l[0]),a=window.getComputedStyle(e);return"flex"===a.display||"inline-flex"===a.display?!a.flexDirection.includes("column"):!!["inline","inline-block","inline-flex"].includes(t.display)||"none"!==t.float}let t=0,a=0,n=l.map(e=>{let l=e.getBoundingClientRect(),n=l.left+l.width/2,i=l.top+l.height/2;return t+=n,a+=i,{cx:n,cy:i}}),i=t/l.length,s=a/l.length,r=0,o=0;return n.forEach(e=>{r+=(e.cx-i)**2,o+=(e.cy-s)**2}),r>=o})(e),r=e.scrollLeft,o=e.scrollTop;if(0===i.length)return{index:0,indicatorOffset:15,isHorizontal:s};let d=(e,l)=>s?(l?e.left:e.right)-n.left+r+(l?-4:4):(l?e.top:e.bottom)-n.top+o+(l?-4:4),c=e=>{let l=e.getAttribute("data-item-id");if(l){let e=a.findIndex(e=>e.id===l);if(-1!==e)return e}return i.indexOf(e)};for(let e=0;e<i.length;e++){let a=i[e].getBoundingClientRect();if(l>=a.left-5&&l<=a.right+5&&t>=a.top-5&&t<=a.bottom+5){let n=s?l<a.left+a.width/2:t<a.top+a.height/2,r=c(i[e]);return{index:n?r:r+1,indicatorOffset:d(a,n),isHorizontal:s}}}let u=1/0,p=!1,x=null,m=null;for(let e=0;e<i.length;e++){let a=i[e].getBoundingClientRect(),n=a.left+a.width/2,r=a.top+a.height/2,o=(l-n)**2+(t-r)**2;o<u&&(u=o,x=a,m=i[e],p=s?l<n:t<r)}if(m&&x){let e=c(m);return{index:p?e:e+1,indicatorOffset:d(x,p),isHorizontal:s}}let h=i[i.length-1].getBoundingClientRect();return{index:a.length,indicatorOffset:d(h,!1),isHorizontal:s}},H=e=>{let{rootComponent:l="div",rootData:t={},list:i=[],ancestors:s=[],item:r,onListChange:o,className:d}=e,{designable:c,selectedItem:u,setSelectedItem:p,forceUpdate:x}=(0,n.useContext)(v),m=(0,n.useRef)(null),[h,g]=(0,n.useState)(!1),[f,j]=(0,n.useState)(0),[b,A]=(0,n.useState)(!1),[C,w]=(0,n.useState)(!1),k=(0,n.useRef)(i),z=(0,n.useRef)(o);(0,n.useEffect)(()=>{k.current=i,z.current=o},[i,o]);let S=(0,n.useMemo)(()=>i||[],[i]);(0,n.useEffect)(()=>{let e=m.current;if(!e)return;let l=(0,y.tO)({element:e,canDrop:e=>{let{source:l,element:t}=e;if(!c)return!1;let{data:a}=l.data||{};return(!t.classList.contains("ant-row")||(null==a?void 0:a.type)==="b-col")&&(!!t.classList.contains("ant-row")||(null==a?void 0:a.type)!=="b-col")},getData:()=>({localList:k.current}),onDragEnter:l=>{if(!c)return!1;let[t]=l.location.current.dropTargets;if((null==t?void 0:t.element)!==e)return;g(!0),w(!0);let a=l.location.current.input.clientY,{indicatorOffset:n,isHorizontal:i}=G(e,l.location.current.input.clientX,a,k.current||[]);j(n),A(i)},onDrag:l=>{if(!c)return!1;let[t]=l.location.current.dropTargets;if((null==t?void 0:t.element)!==e){g(!1),w(!1);return}g(!0),w(!0);let a=l.location.current.input.clientY,{indicatorOffset:n,isHorizontal:i}=G(e,l.location.current.input.clientX,a,k.current||[]);j(n),A(i)},onDragLeave:()=>{if(!c)return!1;g(!1),w(!1)},onDrop(l){if(!c)return!1;let[t]=l.location.current.dropTargets;if((null==t?void 0:t.element)!==e)return;g(!1),w(!1);let{data:a,list:n,onListChange:i,index:s}=l.source.data;null==p||p(a);let r=k.current||[],o=z.current,d=n===r||r.some(e=>e.id===a.id),u=l.location.current.input.clientY,{index:x}=G(e,l.location.current.input.clientX,u,r);if(n)if(d){let e=[...r],l=e.findIndex(e=>e.id===a.id);if(-1!==l){let[t]=e.splice(l,1);e.splice(x>l?x-1:x,0,t),null==o||o(e)}else e.splice(x,0,a),null==o||o(e)}else{i&&n&&i(n.filter(e=>e.id!==a.id));let e=[...r];e.some(e=>e.id===a.id)||(e.splice(x,0,a),null==o||o(e))}else{let e=[...r];e.splice(x,0,a),null==o||o(e)}}});return()=>l()},[]);let I=e=>{let l=e=>{let t={...e,id:R()};if(e.children)if(Array.isArray(e.children))t.children=e.children.map(l);else{let a={};Object.keys(e.children).forEach(t=>{a[t]=e.children[t].map(l)}),t.children=a}return t},t=l(e),a=i.findIndex(l=>l.id===e.id);if(-1!==a){let e=[...i];e.splice(a+1,0,t),null==o||o(e)}},N=[d,"drag-container","page-item-component",!i.length?"empty-container":"",u===r?"selected":"",c?"designable":""].filter(Boolean).join(" ");return(0,a.jsxs)(l,{...t||{},ref:m,className:N,style:{...null==t?void 0:t.style,position:"relative",minHeight:c?24:void 0,outline:h?"1px dashed #1890ff":void 0},children:[c&&(0,a.jsx)(P,{className:"drop-indicator",$offset:f,$vertical:b,$visible:C}),(Array.isArray(S)?S:[]).filter(Boolean).map((e,l)=>(0,a.jsx)(D,{item:e,ancestors:s,parentList:S,onListChange:o,index:l,onCopy:I,onDelete:()=>null==o?void 0:o(S.filter(l=>l.id!==e.id))},e.id||l))]})},_=f.Ay.div`
106
+ .empty-container.designable {
107
+ min-width: 10px;
108
+ min-height: 30px;
109
+ background-color: #f5f5f5;
110
+ border: 1px dashed #d9d9d9;
111
+ }
112
+ .page-canvas {
113
+ // display: flex;
114
+ // flex-direction: column;
115
+ // gap: 16px;
116
+ min-width: 0;
117
+ max-width: 100%;
118
+ overflow-x: hidden;
119
+ user-select: none;
120
+ background: #ffffff;
121
+
122
+ &.designable {
123
+ padding: 12px;
124
+ padding-bottom: 24px;
125
+ }
126
+
127
+ .page-item-component.designable {
128
+ position: relative;
129
+ }
130
+ .page-item-component.designable:hover {
131
+ outline: 1px dashed #1890ff;
132
+ cursor: move;
133
+ z-index: 2;
134
+ }
135
+ .page-item-component.designable.selected {
136
+ position: relative;
137
+ outline: 1px solid #1890ff;
138
+ z-index: 2;
139
+ }
140
+ }
141
+ `,Y=n.forwardRef((e,l)=>{let{device:t="desktop"}=e,{schema:i,forceUpdate:s,setDeviceWidth:r}=(0,n.useContext)(v),o=(0,n.useRef)(null),d=(0,n.useMemo)(()=>i.items||[],[i.items]),[c,u]=(0,n.useState)(d);(0,n.useEffect)(()=>{u(i.items||[])},[i.items]);let p=()=>{var e;let l=null==(e=o.current)?void 0:e.parentElement,t=null==l?void 0:l.getBoundingClientRect(),a=(null==t?void 0:t.width)||0;a<=100?setTimeout(p,10):r(a?a-36:0)};return(0,n.useEffect)(()=>{p()},[t]),(0,n.useEffect)(()=>{let e=()=>p();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,n.useImperativeHandle)(l,()=>({handleResize(){p()},get dom(){return o.current}})),(0,a.jsx)(_,{ref:o,children:(0,a.jsx)(H,{ancestors:[],list:c,onListChange:e=>{let l=[...e];i.items=l,u(l),null==s||s()},className:"page-canvas"})})});var J=t(156),q=t(5745),K=t(9203),W=t(7770),V=t(2796),U=t(4042),X=t(4811),Q=t(6639),Z=t(7532),ee=t(5889),el=t(2892),et=t(606),ea=t(2930),en=t(4442),ei=t(5303),es=t(6845),er=t(5466),eo=t(6283),ed=t(9284),ec=t(1751),eu=t(5021),ep=t(2441),ex=t(8727),em=t(4289),eh=t(705),eg=t(2961),ef=t(1081),ej=t(6033);let ev=f.Ay.div`
142
+ max-height: 400px;
143
+ overflow: auto;
144
+ background: #fff;
145
+
146
+ ul.agent-list {
147
+ margin: 0;
148
+ padding: 0;
149
+ list-style: none;
150
+ display: flex;
151
+ flex-direction: column;
152
+ gap: 4px;
153
+ }
154
+ ul.agent-list li {
155
+ padding: 4px 8px;
156
+ cursor: pointer;
157
+ font-size: 14px;
158
+ }
159
+ ul.agent-list li:hover {
160
+ background: var(--link-bg-color);
161
+ border-radius: 2px;
162
+ }
163
+ ul.agent-list li a {
164
+ color: var(--ant-color-text-secondary);
165
+ flex: auto;
166
+ overflow: hidden;
167
+ text-overflow: ellipsis;
168
+ white-space: nowrap;
169
+ }
170
+ `,eb=f.Ay.div`
171
+ .chat-input {
172
+ display: flex;
173
+ flex-direction: column;
174
+ width: 100%;
175
+ position: relative;
176
+ }
177
+ .input-stack {
178
+ display: flex;
179
+ flex-direction: column;
180
+ gap: 0;
181
+ }
182
+ .attachment-bar {
183
+ display: flex;
184
+ flex-wrap: wrap;
185
+ gap: 8px;
186
+ width: 100%;
187
+ max-height: 150px;
188
+ overflow: auto;
189
+ box-sizing: border-box;
190
+ padding: 8px;
191
+ border: 1px solid #ddd;
192
+ border-radius: 6px 6px 0 0;
193
+ border-bottom: none;
194
+ background-color: #eff1f9;
195
+ }
196
+ .attachment-card {
197
+ max-height: 171px;
198
+ overflow: auto;
199
+ display: inline-flex;
200
+ align-items: center;
201
+ flex-direction: column;
202
+ gap: 4px;
203
+ padding: 6px;
204
+ border: 1px solid #eaeaea;
205
+ border-radius: 6px;
206
+ background-color: #fafafa;
207
+ font-size: 12px;
208
+ position: relative;
209
+
210
+ .anticon {
211
+ font-size: 26px;
212
+ color: var(--ant-green-8);
213
+ }
214
+ }
215
+ .attachment-card .name {
216
+ max-width: 55px;
217
+ overflow: hidden;
218
+ text-overflow: ellipsis;
219
+ white-space: nowrap;
220
+ color: var(--ant-color-text-label);
221
+ font-size: 12px;
222
+ }
223
+ .attachment-card .remove {
224
+ color: #999;
225
+ cursor: pointer;
226
+ transition: color 0.2s ease;
227
+ position: absolute;
228
+ top: 4px;
229
+ right: 2px;
230
+
231
+ .anticon {
232
+ font-size: 12px;
233
+ color: var(--ant-color-text-tertiary);
234
+ }
235
+ }
236
+ .attachment-card .remove:hover {
237
+ color: #666;
238
+
239
+ .anticon {
240
+ font-size: 12px;
241
+ color: var(--ant-color-text-secondary);
242
+ }
243
+ }
244
+ .agent-info {
245
+ box-sizing: border-box;
246
+ padding: 4px 8px;
247
+ border: 1px solid #ddd;
248
+ border-radius: 6px 6px 0 0;
249
+ border-bottom: none;
250
+ background-color: #eff1f9;
251
+ font-size: 14px;
252
+ color: var(--ant-color-text-label);
253
+ display: flex;
254
+ align-items: center;
255
+ flex-wrap: wrap;
256
+ user-select: none;
257
+ gap: 8px;
258
+
259
+ a {
260
+ color: var(--ant-color-text-disabled);
261
+ margin-left: 4px;
262
+ }
263
+ }
264
+ .attachment-bar + .agent-info {
265
+ border-radius: 0;
266
+ }
267
+ .agent-info + .agent-info,
268
+ .agent-info + .title-input,
269
+ .agent-info + .textarea-stacked {
270
+ border-radius: 0;
271
+ }
272
+ .title-input {
273
+ width: 100%;
274
+ box-sizing: border-box;
275
+ padding: 8px;
276
+ border: 1px solid #ddd;
277
+ border-radius: 6px 6px 0 0;
278
+ border-bottom: none;
279
+ font-size: 14px;
280
+ }
281
+ .attachment-bar + .title-input {
282
+ border-top-left-radius: 0;
283
+ border-top-right-radius: 0;
284
+ }
285
+ .input {
286
+ width: 100%;
287
+ box-sizing: border-box;
288
+ padding: 8px;
289
+ border: 1px solid #ddd;
290
+ border-radius: 6px;
291
+ resize: vertical;
292
+ font-size: 14px;
293
+ }
294
+ .textarea-stacked {
295
+ border-top-left-radius: 5px;
296
+ border-top-right-radius: 5px;
297
+ border-bottom-left-radius: 0;
298
+ border-bottom-right-radius: 0;
299
+ outline: none;
300
+ resize: none;
301
+ }
302
+ .title-input + .textarea-stacked,
303
+ .attachment-bar + .textarea-stacked {
304
+ border-top-left-radius: 0;
305
+ border-top-right-radius: 0;
306
+ }
307
+ .footer {
308
+ display: flex;
309
+ justify-content: space-between;
310
+ align-items: center;
311
+ gap: 8px;
312
+ bottom: 0;
313
+ left: 0;
314
+ right: 0;
315
+ padding: 8px;
316
+ border: solid 1px #dddddd;
317
+ border-top: none;
318
+ border-bottom-left-radius: 5px;
319
+ border-bottom-right-radius: 5px;
320
+ background-color: #eff1f9;
321
+ }
322
+ .footer .left {
323
+ display: flex;
324
+ align-items: center;
325
+ gap: 8px;
326
+ }
327
+ .agent-trigger {
328
+ display: inline-flex;
329
+ align-items: center;
330
+ justify-content: center;
331
+ gap: 4px;
332
+ width: auto;
333
+ height: 26px;
334
+ color: var(--chat-blue);
335
+ background-color: #ffffff;
336
+ cursor: pointer;
337
+ transition: all 0.2s ease;
338
+ font-size: 12px;
339
+ border: solid 1px #dcdcdc;
340
+ border-radius: 5px;
341
+ padding: 0 4px;
342
+ }
343
+ .agent-trigger:hover {
344
+ background-color: #f7f7f7;
345
+ }
346
+ .attach-upload {
347
+ display: inline-flex;
348
+ align-items: center;
349
+ gap: 6px;
350
+ color: var(--chat-blue);
351
+ background-color: #ffffff;
352
+ border: solid 1px #dcdcdc;
353
+ border-radius: 5px;
354
+ padding: 0 4px;
355
+ height: 26px;
356
+ font-size: 12px;
357
+ cursor: pointer;
358
+ }
359
+ .ant-btn .anticon {
360
+ color: var(--ant-color-text-label);
361
+ }
362
+ .tips {
363
+ color: #999;
364
+ font-size: 12px;
365
+ user-select: none;
366
+ padding: 4px;
367
+ border-radius: 4px;
368
+ }
369
+ .send-btn {
370
+ display: flex;
371
+ align-items: center;
372
+ justify-content: center;
373
+ width: 50px;
374
+ height: 26px;
375
+ color: #fff;
376
+ font-size: 14px;
377
+ background-color: rgb(184, 184, 191);
378
+ border: unset;
379
+ border-radius: 14px;
380
+ transition: background-color 0.3s ease 0s;
381
+ cursor: pointer;
382
+ }
383
+ .send-btn.send-btn-active {
384
+ background-color: var(--ant-color-primary);
385
+ }
386
+ `,ey=[],eA=[],eC=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","audio/wav","image/png","image/jpeg","application/pdf"],ew=[".xlsx",".wav",".png",".jpg",".jpeg",".pdf"],ek=e=>{let{open:l,onCancel:t,onOk:i,allowedExtensions:s,allowedMimeTypes:r}=e,[o,d]=(0,n.useState)([]);(0,n.useEffect)(()=>{l&&d([])},[l]);let c=[...ew,...eC].join(",");return(0,a.jsxs)(S.A,{title:"上传文件",open:l,okText:"上传",cancelText:"取消",onOk:()=>{i(o),t()},onCancel:t,width:600,children:[(0,a.jsx)("div",{style:{marginBottom:16},children:(0,a.jsxs)(z.A.Text,{type:"secondary",children:["支持的文件类型:",s.join(", "),(0,a.jsx)("br",{}),"单次支持上传多个文件,请确保文件内容合规。",(0,a.jsx)("br",{}),"Excel 不支持加密文件。",(0,a.jsx)("br",{}),"不支持 xls 电子表格,请自行转换为 xlsx 格式。",(0,a.jsx)("br",{}),"Excel 仅支持第一行为表头、第二行开始为数据,不支持合并单元格。"]})}),(0,a.jsxs)(ej.A.Dragger,{...{name:"file",multiple:!0,accept:c,fileList:[],beforeUpload:e=>{let l=r.includes(e.type)||!e.type,t=(e.name||"").substring(e.name.lastIndexOf(".")).toLowerCase(),a=s.includes(t);return l||a?(d(l=>[...l,e]),!1):(ef.Ay.error(`不支持的文件类型: ${e.name}`),ej.A.LIST_IGNORE)}},children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(ex.A,{})}),(0,a.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此处上传"}),(0,a.jsx)("p",{className:"ant-upload-hint",children:"支持上传Excel表格数据或音频文件进行分析"})]}),o.length>0&&(0,a.jsxs)("div",{style:{marginTop:16},children:[(0,a.jsxs)(z.A.Title,{level:5,style:{fontSize:14,marginBottom:8},children:["已选文件 (",o.length,")"]}),(0,a.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,maxHeight:200,overflowY:"auto"},children:o.map((e,l)=>(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:"#f5f5f5",borderRadius:4},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,overflow:"hidden"},children:[e.name.endsWith(".xlsx")?(0,a.jsx)(em.A,{style:{color:"#52c41a"}}):(0,a.jsx)(eh.A,{style:{color:"#1890ff"}}),(0,a.jsx)(z.A.Text,{ellipsis:!0,style:{maxWidth:300},children:e.name}),(0,a.jsxs)(z.A.Text,{type:"secondary",style:{fontSize:12},children:["(",(e.size/1024).toFixed(1)," KB)"]})]}),(0,a.jsx)(m.Ay,{type:"text",size:"small",icon:(0,a.jsx)(k.A,{}),onClick:()=>{d(e=>e.filter((e,t)=>t!==l))},danger:!0})]},`${e.name}-${l}`))})]})]})},ez=n.forwardRef((e,l)=>{let{value:t="",placeholder:i="请输入需求,例如:分析 2025 年人口结构并生成可视化报告",disabled:s=!1,sending:r=!1,rows:o=6,agentList:d=ey,agentId:c=null,attachments:u=eA,atItems:p=null,onInput:h,onSubmit:g,onUpdateAgentId:f,onUpdateAttachments:j,onUploading:v,onRemoveAtItem:b,style:y={}}=e,A=(0,n.useRef)(null),[w,S]=(0,n.useState)([]),[I,O]=(0,n.useState)(t||""),[E,B]=(0,n.useState)(0),[L,$]=(0,n.useState)(Array.isArray(u)?u:[]),[D,M]=(0,n.useState)(!1),R=(0,n.useMemo)(()=>!1,[]);(0,n.useImperativeHandle)(l,()=>({focus(){var e;null==(e=A.current)||e.focus()}})),(0,n.useEffect)(()=>O(t||""),[t]),(0,n.useEffect)(()=>{h&&h(I)},[I]),(0,n.useEffect)(()=>$(Array.isArray(u)?u:[]),[u]);let F=!!(I&&I.trim()),P=async e=>{if(M(!1),!v||!e.length)return;let l=[];for(let t of e)try{let e=await v(t);e&&l.push({id:e.id,name:t.name,size:t.size})}catch(e){console.error(e)}$([...L,...l]),j&&j([...L,...l])},G=()=>{if(!F||r)return;let e=Date.now();if(e-E<400)return;B(e);let l=(I||"").trim();if(!l)return;let t={message:l,agents:w.map(e=>({id:e.id,name:e.name})),files:L.map(e=>({id:e.id,name:e.name,extension:e.name.substring(e.name.lastIndexOf("."))}))};g&&g(t),O(""),$([])},H=(0,a.jsx)(ev,{children:(0,a.jsx)("ul",{className:"agent-list",children:d.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)("a",{onClick:()=>{let l;return l=e.id||null,void(f&&f(l),S(l=>[...l,e]))},children:e.name})},String(e.id)))})});return(0,a.jsx)(eb,{style:y,children:(0,a.jsxs)("div",{className:"chat-input",children:[(0,a.jsxs)("div",{className:"input-stack",children:[L.length>0&&(0,a.jsx)("div",{className:"attachment-bar beautified_scrollbar",children:L.map(e=>{var l;return(0,a.jsxs)("div",{className:"attachment-card",children:[(l=e.name).endsWith(".xlsx")?(0,a.jsx)(C,{type:"icon-excel"}):l.endsWith(".wav")?(0,a.jsx)(C,{type:"icon-audio"}):(0,a.jsx)(C,{type:"icon-image"}),(0,a.jsx)(z.A.Text,{className:"name",ellipsis:{tooltip:e.name},children:e.name}),(0,a.jsx)("a",{className:"remove",onClick:()=>{var l;let t;return l=e.id,void($(t=L.filter(e=>e.id!==l)),j&&j(t))},children:(0,a.jsx)(k.A,{})})]},e.id)})}),w.length>0&&(0,a.jsx)("div",{className:"agent-info",children:w.map((e,l)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"name",children:[(0,a.jsx)(C,{type:"icon-at"}),e.name]}),(0,a.jsx)("a",{className:"remove",onClick:()=>{f&&f(null),S(e=>e.filter((e,t)=>t!==l))},children:"\xd7"})]},String(e.id)))}),!!(null==p?void 0:p.length)&&(0,a.jsx)("div",{className:"agent-info",children:p.map((e,l)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"name",children:[(0,a.jsx)(C,{type:"icon-number"}),e.name||e.id]}),(0,a.jsx)("a",{className:"remove",onClick:()=>null==b?void 0:b(e,l),children:"\xd7"})]},String(e.id)))}),(0,a.jsx)(x.A.TextArea,{ref:A,className:"input textarea-stacked",placeholder:i,disabled:s||r,autoSize:{minRows:o,maxRows:o},value:I,onPressEnter:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),G()))},onChange:e=>O(e.target.value)})]}),(0,a.jsxs)("div",{className:"footer",children:[(0,a.jsxs)("div",{className:"left",children:[!!(null==d?void 0:d.length)&&(0,a.jsx)(N.A,{trigger:["click"],popupRender:()=>H,placement:"topLeft",styles:{root:{boxShadow:"var(--ant-box-shadow-card)"}},children:(0,a.jsx)(T.A,{title:"选择助理",children:(0,a.jsx)(m.Ay,{className:"agent-trigger",onClick:e=>e.preventDefault(),children:(0,a.jsx)(C,{type:"icon-at"})})})}),v&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.A,{title:"上传文件",children:(0,a.jsx)(m.Ay,{className:"attach-upload",onClick:()=>M(!0),disabled:s||r,children:(0,a.jsx)(C,{type:"icon-paper-clip"})})}),(0,a.jsx)(ek,{open:D,onCancel:()=>M(!1),onOk:P,allowedExtensions:ew,allowedMimeTypes:eC})]})]}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[!R&&(0,a.jsx)("div",{className:"tips",children:"按 Enter 发送,Shift+Enter 换行"}),(0,a.jsx)("a",{className:`send-btn ${!r&&(null==I?void 0:I.length)>0?"send-btn-active":""}`,onClick:G,children:(0,a.jsx)(eg.A,{})})]})]})]})})}),eS=f.Ay.div`
387
+ width: 100%;
388
+ padding: 0 12px;
389
+ border-bottom: solid 1px #e8e8e8;
390
+ background: #ffffff;
391
+ height: 40px;
392
+ display: flex;
393
+ align-items: center;
394
+ justify-content: space-between;
395
+ .title {
396
+ font-size: 14px;
397
+ line-height: 40px;
398
+ }
399
+ .extra {
400
+ line-height: 32px;
401
+ }
402
+ `,eI=e=>{let{title:l="",extra:t,style:n={}}=e;return(0,a.jsxs)(eS,{className:"pane-header",style:n,children:[(0,a.jsx)("span",{className:"title",children:l}),(0,a.jsx)("div",{className:"extra",children:t})]})},eN=f.Ay.div`
403
+ display: flex;
404
+ flex-direction: column;
405
+ height: 100%;
406
+ .body {
407
+ flex: 1 1 auto;
408
+ display: flex;
409
+ flex-direction: column;
410
+ gap: 12px;
411
+ padding: 0 !important;
412
+ }
413
+ .conversation-list {
414
+ margin: 0;
415
+ padding: 0;
416
+ list-style: none;
417
+ display: flex;
418
+ flex-direction: column;
419
+ gap: 4px;
420
+ }
421
+ .conversation-list li {
422
+ margin: 0;
423
+ display: flex;
424
+ align-items: center;
425
+ gap: 6px;
426
+ justify-content: space-between;
427
+ padding: 4px 8px;
428
+ background: var(--link-bg-color);
429
+ border-radius: 2px;
430
+ cursor: pointer;
431
+ font-size: 14px;
432
+ }
433
+ .conversation-list li a {
434
+ color: var(--ant-color-text-secondary);
435
+ flex: auto;
436
+ overflow: hidden;
437
+ text-overflow: ellipsis;
438
+ white-space: nowrap;
439
+ }
440
+ .conversation-list li small {
441
+ white-space: nowrap;
442
+ }
443
+ `,eT=[],eO="bi-design",eE=e=>{let l,t,i,s,r,o,d,{agentList:c=eT,headExtra:u,style:p={},onEffect:x}=e,{pageId:m,schema:h,fetch:g,atItems:f,onRemoveAtItem:j,clearAtItems:b}=(0,n.useContext)(v);if(!g)return null;let[y,A]=(0,n.useState)(null),[w,z]=(0,n.useState)([]),[O,E]=(0,n.useState)([]),B=n.useRef(null),L=()=>{setTimeout(()=>{B.current&&B.current.scrollToBottom()},100)},$=()=>{A(null),E([])},D=async e=>{S.A.confirm({title:"确认删除该对话吗?",okText:"确认",cancelText:"取消",onOk:async()=>{var l;await (null==(l=g.ai)?void 0:l.removeConversation(e)),z(l=>l.filter(l=>l.id!==e)),E(l=>l.filter(l=>l.conversationId!==e)),y===e&&$()}})},M=async e=>{var l,t,a;A(e),z(l=>l.map(l=>({...l,isActived:l.id===e}))),await (null==(t=g.ai)||null==(l=t.activateConversation)?void 0:l.call(t,e)),E(await (null==(a=g.ai)?void 0:a.messageList(e))||[]),L()},P=async e=>{var l,t,a;let n={id:R(),question:e.message,createdAt:new Date().toISOString(),files:e.files||[],agents:e.agents||[],atItems:JSON.stringify(f),sending:!0};E(e=>[...e,n]),L();let i=!y;b();try{let{id:t,answer:a,createdAt:s,conversation:r}=await (null==(l=g.ai)?void 0:l.chat(eO,m,y,{...e,page:h,pageItems:f||[]}));A((null==r?void 0:r.id)||""),z(e=>[i?r||{}:null,...e].filter(e=>null!==e)),Object.assign(n,{id:t,answer:a,createdAt:s,conversationId:(null==r?void 0:r.id)||"",sending:!1}),a.effect&&(null==x||x(a.effect))}catch(l){let e=(null==l||null==(a=l.response)||null==(t=a.data)?void 0:t.message)||l.message||"未知错误";console.error(e),Object.assign(n,{sending:!1,error:e})}E(e=>[...e]),L()},G=async e=>{var l;await (null==(l=g.ai)?void 0:l.removeMessage(e)),E(l=>l.filter(l=>l.id!==e))},H=(l=new Date,t=(e,l)=>e.getFullYear()===l.getFullYear()&&e.getMonth()===l.getMonth()&&e.getDate()===l.getDate(),(i=new Date(l)).setDate(l.getDate()-1),s=[],r=[],o=[],d=[],w.forEach(e=>{let a=new Date(e.createdAt);if(t(a,l))s.push(e);else if(t(a,i))r.push(e);else a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()?o.push(e):d.push(e)}),[{title:"今天",items:s},{title:"昨天",items:r},{title:"本月内",items:o},{title:"很久以前",items:d}].filter(e=>e.items.length>0)),_=async()=>{try{var e,l;let t=await (null==(e=g.ai)?void 0:e.conversationList(eO,m));z(t||[]);let a=null==t?void 0:t.find(e=>e.isActived);if(a){A(a.id);let e=await (null==(l=g.ai)?void 0:l.messageList(a.id));E(e||[]),L()}}catch(e){console.error(e)}};return(0,n.useEffect)(()=>{_()},[g]),(0,n.useEffect)(()=>{L()},[]),(0,a.jsxs)(eN,{style:p,children:[(0,a.jsx)(eI,{title:"智能助理",extra:(0,a.jsxs)(I.A,{children:[(0,a.jsx)(T.A,{title:"新对话",placement:"topRight",children:(0,a.jsx)("a",{onClick:$,children:(0,a.jsx)(C,{type:"icon-chat-plus"})})}),(0,a.jsx)(N.A,{trigger:["click"],styles:{root:{boxShadow:"var(--ant-box-shadow-drawer-up)",backgroundColor:"#ffffff",borderRadius:"var(--ant-border-radius)"}},popupRender:()=>(0,a.jsx)(e$,{children:H.map(e=>(0,a.jsxs)("div",{className:"group",children:[(0,a.jsx)("div",{className:"group-title",children:e.title}),(0,a.jsx)("ul",{className:"group-list",children:e.items.map(e=>(0,a.jsxs)("li",{className:e.isActived?"actived":"",children:[(0,a.jsx)("a",{onClick:()=>M(e.id),children:e.name}),(0,a.jsx)("small",{children:(0,a.jsx)("a",{onClick:()=>D(e.id),children:(0,a.jsx)(k.A,{})})})]},e.id))})]},e.title))}),placement:"topRight",children:(0,a.jsx)("a",{children:(0,a.jsx)(er.A,{})})}),u]}),style:{width:"initial"}}),(0,a.jsxs)("div",{className:"body",children:[(0,a.jsx)("div",{style:{flex:"1 1 auto",overflowY:"auto"},children:O.length?(0,a.jsx)(eM,{ref:B,list:O,onDeleteMessage:G}):(0,a.jsx)(eL,{})}),0===O.length&&w.length>0&&(0,a.jsx)(ec.A,{title:"历史记录",size:"small",variant:"borderless",styles:{header:{padding:0,border:"none"},body:{padding:0}},style:{padding:"12px 12px 0 12px"},children:(0,a.jsx)("ul",{className:"conversation-list",children:w.slice(0,3).map(e=>(0,a.jsxs)("li",{children:[(0,a.jsxs)("a",{children:[(0,a.jsx)(eo.A,{}),e.name]}),(0,a.jsx)("small",{children:F(e.createdAt)})]},e.id))})}),(0,a.jsx)(ez,{agentList:c,style:{padding:12},atItems:f,onUploading:null==g?void 0:g.upload,onSubmit:P,onRemoveAtItem:j})]})]})},eB=f.Ay.div`
444
+ flex: 1 1 auto;
445
+ display: flex;
446
+ align-items: center;
447
+ justify-content: center;
448
+ height: 100%;
449
+ padding: 12px;
450
+
451
+ .content {
452
+ display: flex;
453
+ flex-direction: column;
454
+ align-items: center;
455
+ gap: 12px;
456
+ text-align: center;
457
+ }
458
+
459
+ .logo {
460
+ width: 64px;
461
+ height: 64px;
462
+ border-radius: 8px;
463
+ display: flex;
464
+ align-items: center;
465
+ justify-content: center;
466
+ // background: var(--link-bg-color);
467
+ // border: 1px solid var(--ant-color-border);
468
+ color: var(--ant-color-info-text-active);
469
+ }
470
+
471
+ .title {
472
+ font-size: 18px;
473
+ font-weight: 600;
474
+ color: var(--ant-color-text);
475
+ }
476
+
477
+ .desc {
478
+ font-size: 14px;
479
+ color: var(--ant-color-text-secondary);
480
+ }
481
+ `,eL=()=>(0,a.jsx)(eB,{children:(0,a.jsxs)("div",{className:"content",children:[(0,a.jsx)("div",{className:"logo",children:(0,a.jsx)(C,{type:"icon-ai-compute",style:{fontSize:60}})}),(0,a.jsx)("div",{className:"title",children:"与 智能助理 协作"}),(0,a.jsx)("div",{className:"desc",children:"自动化执行常规开发任务,端到端高效完成,提高交付效率"})]})}),e$=f.Ay.div`
482
+ width: 260px;
483
+ padding: 8px;
484
+ .group {
485
+ display: flex;
486
+ flex-direction: column;
487
+ gap: 6px;
488
+ margin-bottom: 6px;
489
+ }
490
+ .group-title {
491
+ color: var(--ant-color-text-secondary);
492
+ font-size: 12px;
493
+ }
494
+ .group-list {
495
+ margin: 0;
496
+ padding: 0;
497
+ list-style: none;
498
+ display: flex;
499
+ flex-direction: column;
500
+ gap: 6px;
501
+ }
502
+ .group-list li {
503
+ display: flex;
504
+ align-items: center;
505
+ justify-content: space-between;
506
+ gap: 6px;
507
+ padding: 6px 8px;
508
+ border-radius: 6px;
509
+ background: var(--link-bg-color);
510
+ cursor: pointer;
511
+ font-size: 13px;
512
+ }
513
+ .group-list li.actived {
514
+ background: var(--ant-color-primary-bg);
515
+ }
516
+ .group-list li a {
517
+ color: var(--ant-color-text);
518
+ flex: auto;
519
+ overflow: hidden;
520
+ text-overflow: ellipsis;
521
+ white-space: nowrap;
522
+ }
523
+ .group-list li small a {
524
+ color: var(--ant-color-error);
525
+ }
526
+ `,eD=f.Ay.div`
527
+ height: 100%;
528
+ display: flex;
529
+ flex-direction: column;
530
+ gap: 12px;
531
+ padding-right: 8px;
532
+
533
+ .msg {
534
+ display: flex;
535
+ flex-direction: column;
536
+ gap: 8px;
537
+ border-radius: var(--ant-border-radius);
538
+ // border: 1px solid var(--ant-color-border);
539
+ padding: 8px 10px;
540
+ background: var(--ant-color-bg-container);
541
+
542
+ .user-message {
543
+ max-width: 90%;
544
+ margin: 10px 0 10px auto;
545
+ position: relative;
546
+
547
+ .msg-tools {
548
+ position: absolute;
549
+ right: 0;
550
+ bottom: -20px;
551
+ display: none;
552
+ }
553
+
554
+ &:hover .msg-tools {
555
+ display: flex;
556
+ flex-direction: row;
557
+ align-items: center;
558
+
559
+ .anticon {
560
+ color: var(--ant-color-text-tertiary);
561
+ }
562
+ }
563
+
564
+ .msg-header {
565
+ justify-content: flex-end;
566
+ color: var(--ant-color-text-tertiary);
567
+ padding: 4px 10px 8px 10px;
568
+ }
569
+
570
+ .msg-section {
571
+ background: var(--ant-color-primary-bg);
572
+ padding: 8px 10px;
573
+ border-radius: var(--ant-border-radius);
574
+ position: relative;
575
+ }
576
+ }
577
+ .assistant-message {
578
+ .msg-header .msg-title {
579
+ color: var(--ant-color-primary);
580
+ padding: 8px 0;
581
+ }
582
+ }
583
+ }
584
+ .msg-header {
585
+ display: flex;
586
+ align-items: center;
587
+ justify-content: space-between;
588
+ color: var(--ant-color-text-secondary);
589
+ font-size: 12px;
590
+ }
591
+ .msg-title {
592
+ font-weight: 600;
593
+ color: var(--ant-color-text);
594
+ }
595
+ .msg-content {
596
+ color: var(--ant-color-text);
597
+ font-size: 13px;
598
+ line-height: 1.6;
599
+ white-space: pre-wrap;
600
+
601
+ &.error {
602
+ color: var(--ant-color-error-text);
603
+ padding: 10px 0;
604
+ }
605
+ }
606
+ .msg-meta {
607
+ display: flex;
608
+ align-items: center;
609
+ gap: 0 8px;
610
+ flex-wrap: wrap;
611
+
612
+ .ant-tag {
613
+ padding-inline: 0;
614
+ }
615
+ }
616
+ .msg-section {
617
+ display: flex;
618
+ flex-direction: column;
619
+ gap: 6px;
620
+ }
621
+ .msg-ai-meta {
622
+ &-title {
623
+ padding: 8px 4px;
624
+ font-size: 12px;
625
+ color: var(--ant-color-text-tertiary);
626
+ }
627
+ &-list {
628
+ // max-height: 200px;
629
+ // overflow: auto;
630
+ display: flex;
631
+ flex-wrap: wrap;
632
+ flex-direction: row;
633
+ gap: 4px;
634
+
635
+ .ant-tag {
636
+ max-width: 155px;
637
+ overflow: hidden;
638
+ text-overflow: ellipsis;
639
+ white-space: nowrap;
640
+ }
641
+
642
+ &.vertical {
643
+ flex-direction: column;
644
+ }
645
+
646
+ &-item {
647
+ font-size: 12px;
648
+ color: var(--ant-color-text-label);
649
+ margin-bottom: 4px;
650
+
651
+ &:last-child {
652
+ margin-bottom: 0;
653
+ }
654
+
655
+ .ant-tag {
656
+ display: inline;
657
+ max-width: unset;
658
+ margin-right: 6px;
659
+ }
660
+ }
661
+ }
662
+ }
663
+ `,eM=(0,n.forwardRef)((e,l)=>{let{list:t,onDeleteMessage:i}=e,s=(0,n.useRef)(null),r=()=>{setTimeout(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},100)};return(0,n.useImperativeHandle)(l,()=>({scrollToBottom:r})),(0,a.jsx)(eD,{className:"message-list beautified_scrollbar",ref:s,children:t.map(e=>{var l,t,n,s,r,o,d,c,u,p;return(0,a.jsxs)("div",{className:"msg",children:[(0,a.jsxs)("div",{className:"user-message",children:[(0,a.jsx)("div",{className:"msg-header",children:(0,a.jsx)("span",{children:F(e.createdAt)})}),(0,a.jsxs)("div",{className:"msg-section",children:[(0,a.jsxs)(I.A,{size:4,orientation:"vertical",className:"msg-tools",children:[(0,a.jsx)(z.A.Text,{copyable:{text:e.question,tooltips:"复制"}}),(0,a.jsx)(eu.A,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>i(e.id),children:(0,a.jsx)(T.A,{title:"删除",children:(0,a.jsx)(m.Ay,{type:"link",size:"small",icon:(0,a.jsx)(k.A,{})})})})]}),(0,a.jsx)("div",{className:"msg-content",children:e.question}),(null==(l=e.files)?void 0:l.length)||(null==(t=e.agents)?void 0:t.length)||(null==(n=e.atItems)?void 0:n.length)?(0,a.jsxs)("div",{className:"msg-meta",children:[null==(s=e.files)?void 0:s.map(e=>(0,a.jsxs)(es.A,{color:"processing",children:[(0,a.jsx)(C,{type:"icon-paper-clip"})," ",e.name]},e.id)),null==(r=e.agents)?void 0:r.map(e=>(0,a.jsxs)(es.A,{color:"blue",children:[(0,a.jsx)(C,{type:"icon-at"})," ",e.name]},e.id)),(e=>{try{if(e){if("object"==typeof e)return e;else if("string"==typeof e)return JSON.parse(e||"[]")}return[]}catch(e){return[]}})(e.atItems).map(e=>(0,a.jsxs)(es.A,{color:"blue",children:[(0,a.jsx)(C,{type:"icon-number"})," ",e.name]},e.id))]}):null]})]}),(0,a.jsxs)("div",{className:"assistant-message",children:[(0,a.jsx)("div",{className:"msg-header",children:(0,a.jsxs)("span",{className:"msg-title",children:[(0,a.jsx)(ed.A,{})," 智能助理"]})}),(0,a.jsx)("div",{className:"msg-section",children:e.sending?(0,a.jsx)(ep.A,{active:!0}):(0,a.jsxs)(a.Fragment,{children:[e.error?(0,a.jsxs)("div",{className:"msg-content error",children:["执行失败:",e.error]}):(0,a.jsx)("div",{className:"msg-content",children:(null==(o=e.answer)?void 0:o.answer)||""}),!!(null==(c=e.answer)||null==(d=c.plans)?void 0:d.length)&&(0,a.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,a.jsx)("summary",{className:"msg-ai-meta-title",children:"PLANS:"}),(0,a.jsx)("div",{className:"msg-ai-meta-list",children:e.answer.plans.map((e,l)=>(0,a.jsx)(T.A,{title:e.description,children:(0,a.jsx)(es.A,{color:"blue",children:e.name})},l))})]}),!!(null==(p=e.answer)||null==(u=p.extra)?void 0:u.length)&&(0,a.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,a.jsx)("summary",{className:"msg-ai-meta-title",children:"ACTIONS:"}),(0,a.jsx)("div",{className:"msg-ai-meta-list vertical",children:e.answer.extra.map((e,l)=>(0,a.jsxs)("div",{className:"msg-ai-meta-list-item",children:[(0,a.jsx)(es.A,{color:"gold",children:e.element}),(0,a.jsx)("span",{children:e.action})]},l))})]})]})})]})]},e.id)})})});var eR=t(2960);let eF=f.Ay.div`
664
+ display: flex;
665
+ flex-direction: column;
666
+ height: 100%;
667
+ .body {
668
+ flex: 1 1 auto;
669
+ display: flex;
670
+ flex-direction: column;
671
+ gap: 12px;
672
+ padding: 12px;
673
+ overflow-y: auto;
674
+ overflow-x: hidden;
675
+ }
676
+ ul,
677
+ li {
678
+ list-style: none;
679
+ padding: 0;
680
+ margin: 0;
681
+ }
682
+ li {
683
+ display: flex;
684
+ align-items: center;
685
+ justify-content: space-between;
686
+ padding: 8px;
687
+ border-bottom: 1px dotted #d9d9d9;
688
+ }
689
+ li > div:first-child {
690
+ flex: 1 1 auto;
691
+ white-space: nowrap;
692
+ overflow: hidden;
693
+ text-overflow: ellipsis;
694
+ }
695
+ li:last-child {
696
+ border-bottom: none;
697
+ }
698
+ a.toolbar {
699
+ font-size: 16px;
700
+ color: var(--ant-color-text-secondary);
701
+ }
702
+ `,eP=e=>{let{}=e,{schema:l,selectedItem:t,setSelectedItem:i,plugins:s,forceUpdate:o}=(0,n.useContext)(v),d=(0,n.useMemo)(()=>(s||[]).reduce((e,l)=>(e[l.key]=l,e),{}),[s]),c=(0,n.useMemo)(()=>{let e=[],t=l=>{Array.isArray(l)&&l.forEach(l=>{e.push(l),Array.isArray(l.children)?t(l.children):"object"==typeof l.children&&l.children&&Object.keys(l.children).forEach(e=>t(l.children[e]))})};return t((null==l?void 0:l.items)||[]),e},[l]),u=(0,n.useMemo)(()=>c.reduce((e,l)=>(l.id&&(e[l.id]=l),e),{}),[c]),p=e=>{t&&(i(Object.assign(t,{cascadeIds:e})),o())};return(0,a.jsxs)(eF,{className:"cascade-panel",children:[(0,a.jsx)(eI,{title:"联动",extra:(null==t?void 0:t.cascadeIds)?(0,a.jsx)(I.A,{children:(0,a.jsx)(N.A,{menu:{onClick:e=>{let{key:l}=e,a=[...(null==t?void 0:t.cascadeIds)||[]];a.push(String(l)),p&&p(a)},items:c.map(e=>{var l,t;return{key:e.id,label:(0,a.jsxs)("a",{children:[(0,a.jsx)(C,{type:null==(l=d[e.type])?void 0:l.icon})," ",e.name||(null==(t=d[e.type])?void 0:t.label)," (",e.id,")"]})}})},placement:"bottomLeft",trigger:["click"],children:(0,a.jsxs)("a",{className:"toolbar",children:[(0,a.jsx)(r.A,{}),(0,a.jsx)(eR.A,{style:{fontSize:8,verticalAlign:"sub"}})]})})}):null}),(0,a.jsx)("div",{className:"body beautified_scrollbar",children:(null==t?void 0:t.cascadeIds)&&(0,a.jsx)("ul",{children:(t.cascadeIds||[]).map((e,l)=>{var n,i,s,r,o;return(0,a.jsxs)("li",{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(C,{type:null==(n=d[null==(i=u[e])?void 0:i.type])?void 0:n.icon})," ",(null==(s=u[e])?void 0:s.name)||(null==(r=d[null==(o=u[e])?void 0:o.type])?void 0:r.label)," (",e,")"]}),(0,a.jsx)(eu.A,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...t.cascadeIds||[]];e.splice(l,1),p&&p(e)},children:(0,a.jsx)("a",{children:(0,a.jsx)(k.A,{})})})]},e)})})})]})};var eG=t(7965),eH=t.n(eG);let e_=()=>{let{schema:e}=(0,n.useContext)(v),l=(0,n.useMemo)(()=>JSON.stringify(e||{},null,2),[e]);return(0,a.jsxs)("div",{className:"code-panel",style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,a.jsx)(eI,{title:"代码",extra:(0,a.jsx)(I.A,{children:(0,a.jsx)(T.A,{title:"复制到剪切板",children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>{eH()(l||"")&&ef.Ay.success("复制成功")},children:(0,a.jsx)(w.A,{})})})})}),(0,a.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex"},children:(0,a.jsx)(E.Ay,{height:"100%",defaultLanguage:"json",value:l,options:{lineNumbers:"off",readOnly:!0,minimap:{enabled:!1}}})})]})},eY=f.Ay.div`
703
+ display: flex;
704
+ flex-direction: column;
705
+ height: 100%;
706
+ .body {
707
+ flex: 1 1 auto;
708
+ display: flex;
709
+ flex-direction: column;
710
+ gap: 12px;
711
+ padding: 12px;
712
+ }
713
+ .group-title {
714
+ font-size: 12px;
715
+ color: #ababab;
716
+ padding: 4px 12px;
717
+ }
718
+ .plugin-list {
719
+ display: flex;
720
+ flex-wrap: wrap;
721
+ gap: 20px 12px;
722
+ padding: 12px;
723
+ }
724
+ .plugin {
725
+ display: flex;
726
+ flex-direction: column;
727
+ align-items: center;
728
+ gap: 6px;
729
+ font-size: 14px;
730
+ width: calc(50% - 6px);
731
+ cursor: pointer;
732
+ user-select: none;
733
+ }
734
+ .plugin .icon {
735
+ font-size: 24px;
736
+ color: #191b35;
737
+ }
738
+ .plugin .label {
739
+ text-overflow: ellipsis;
740
+ white-space: nowrap;
741
+ overflow: hidden;
742
+ font-size: 12px;
743
+ }
744
+ `,eJ=e=>{let{plugin:l}=e,t=(0,n.useRef)(null);return(0,n.useEffect)(()=>{let e=t.current;if(!e)return;let a=(0,y.kZ)({element:e,getInitialData:()=>{let e={id:R(),type:l.key,name:l.label,...JSON.parse(JSON.stringify(l.defaultOptions||{}))};return{id:e.id,data:e}},canDrag:()=>!0,onDragStart:()=>{},onDrop:()=>{}});return()=>a()},[]),(0,a.jsxs)("div",{className:"plugin drag-move",ref:t,children:[(0,a.jsx)(C,{className:"icon",type:l.icon}),(0,a.jsx)("div",{className:"label",children:l.label})]})},eq=()=>{let{plugins:e}=(0,n.useContext)(v),l=(0,n.useMemo)(()=>{let l=[];return e.forEach(e=>{let t=l.find(l=>l.group===e.group);t?t.items.push(e):l.push({group:e.group,items:[e]})}),l},[e]);return(0,a.jsxs)(eY,{className:"component-panel",children:[(0,a.jsx)(eI,{title:"组件库"}),(0,a.jsx)("div",{className:"body beautified_scrollbar",children:l.map(e=>(0,a.jsxs)("div",{className:"plugin-group",children:[(0,a.jsx)("div",{className:"group-title",children:e.group}),(0,a.jsx)("div",{className:"plugin-list",children:e.items.map(e=>(0,a.jsx)(eJ,{plugin:e},e.key))})]},e.group))})]})},eK=f.Ay.div`
745
+ display: flex;
746
+ flex-direction: column;
747
+ height: 100%;
748
+ .body {
749
+ flex: 1 1 auto;
750
+ display: flex;
751
+ flex-direction: column;
752
+ gap: 12px;
753
+ padding: 12px;
754
+ overflow: auto;
755
+ }
756
+ ul,
757
+ li {
758
+ list-style: none;
759
+ padding: 0;
760
+ margin: 0;
761
+ }
762
+ li {
763
+ display: flex;
764
+ align-items: center;
765
+ justify-content: space-between;
766
+ padding: 8px;
767
+ border-bottom: 1px dotted #d9d9d9;
768
+ }
769
+ li > div:first-child {
770
+ flex: 1 1 auto;
771
+ white-space: nowrap;
772
+ overflow: hidden;
773
+ text-overflow: ellipsis;
774
+ }
775
+ li:last-child {
776
+ border-bottom: none;
777
+ }
778
+ .margin-bottom-0 {
779
+ margin-bottom: 0;
780
+ }
781
+ `,eW=()=>{let{schema:e,setSchema:l}=(0,n.useContext)(v),[t,i]=(0,n.useState)(!1),[o,d]=(0,n.useState)(!1),[c,u]=(0,n.useState)(-1),[g,f]=(0,n.useState)({id:R(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),[j,b]=(0,n.useState)({id:R(),type:"sql",name:"",query:""}),y=(0,n.useMemo)(()=>e.datasources,[e.datasources]),A=t=>{l({...e,datasources:t})},w=[{title:"键",dataIndex:"name",render:(e,l,t)=>(0,a.jsx)(x.A,{size:"small",value:l.name,onChange:e=>{let l=[...g.headers];l[t]={...l[t],name:e.target.value},f({...g,headers:l})}})},{title:"值",dataIndex:"value",render:(e,l,t)=>(0,a.jsx)(x.A,{size:"small",value:l.value,onChange:e=>{let l=[...g.headers];l[t]={...l[t],value:e.target.value},f({...g,headers:l})}})},{title:"操作",width:50,align:"center",render:(e,l,t)=>(0,a.jsx)(I.A,{children:(0,a.jsx)("a",{onClick:()=>{let e=[...g.headers];e.splice(t,1),f({...g,headers:e})},children:(0,a.jsx)(k.A,{})})})}];return(0,a.jsxs)(eK,{className:"datasource-panel",children:[(0,a.jsx)(eI,{title:"数据源",extra:(0,a.jsx)(I.A,{children:(0,a.jsx)(N.A,{menu:{onClick:e=>{let{key:l}=e;"api"===l?(u(-1),f({id:R(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),i(!0)):(u(-1),b({id:R(),type:"sql",name:"",query:""}),d(!0))},items:[{key:"api",label:(0,a.jsx)("a",{children:"API接口"})},{key:"sql",label:(0,a.jsx)("a",{children:"SQL查询"})}]},placement:"bottom",children:(0,a.jsxs)("a",{className:"toolbar",children:[(0,a.jsx)(r.A,{}),(0,a.jsx)(eR.A,{style:{fontSize:8,verticalAlign:"sub"}})]})})})}),(0,a.jsx)("div",{className:"body beautified_scrollbar",children:(0,a.jsx)("ul",{children:y.map((e,l)=>(0,a.jsxs)("li",{children:[(0,a.jsxs)("div",{title:e.name,children:[(0,a.jsx)(C,{type:"icon-drag"})," ",e.name]}),(0,a.jsxs)(I.A,{children:[(0,a.jsx)("a",{onClick:()=>{u(l),"api"===e.type?(f({...e}),i(!0)):(b({...e}),d(!0))},children:(0,a.jsx)(s.A,{})}),(0,a.jsx)(eu.A,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e;(e=[...y]).splice(l,1),A&&A(e)},children:(0,a.jsx)("a",{children:(0,a.jsx)(k.A,{})})})]})]},e.id))})}),(0,a.jsx)(S.A,{title:"添加API接口",open:t,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>i(!1),footer:(0,a.jsxs)(I.A,{children:[(0,a.jsx)(m.Ay,{type:"primary",onClick:()=>{if(!g.name||!g.url)return;let e=[...y];-1===c?e.push(g):e[c]=g,A&&A(e),i(!1)},children:"确定"}),(0,a.jsx)(m.Ay,{onClick:()=>i(!1),children:"取消"})]}),children:(0,a.jsxs)(p.A,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,a.jsx)(p.A.Item,{label:"接口名称",required:!0,children:(0,a.jsx)(x.A,{value:g.name,onChange:e=>f({...g,name:e.target.value})})}),(0,a.jsx)(p.A.Item,{label:"接口URL",required:!0,children:(0,a.jsx)(x.A,{value:g.url,onChange:e=>f({...g,url:e.target.value})})}),(0,a.jsx)(p.A.Item,{label:"请求方法",children:(0,a.jsxs)(en.A.Group,{value:g.method,onChange:e=>f({...g,method:e.target.value}),children:[(0,a.jsx)(en.A.Button,{value:"GET",children:"GET"}),(0,a.jsx)(en.A.Button,{value:"POST",children:"POST"}),(0,a.jsx)(en.A.Button,{value:"PUT",children:"PUT"}),(0,a.jsx)(en.A.Button,{value:"DELETE",children:"DELETE"})]})}),(0,a.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"请求头"}),(0,a.jsx)(h.A,{columns:w,dataSource:g.headers,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,l)=>String(l)}),(0,a.jsx)(m.Ay,{size:"small",block:!0,onClick:()=>f({...g,headers:[...g.headers,{name:"",value:""}]}),children:"添加"}),(0,a.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"表单数据"}),(0,a.jsx)(h.A,{columns:w,dataSource:g.formData,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,l)=>`f-${l}`}),(0,a.jsx)(m.Ay,{size:"small",block:!0,onClick:()=>f({...g,formData:[...g.formData,{name:"",value:""}]}),children:"添加"}),(0,a.jsx)(p.A.Item,{label:"请求体",children:(0,a.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,a.jsx)(E.Ay,{height:"300px",defaultLanguage:"json",value:g.body,onChange:e=>f({...g,body:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})}),(0,a.jsx)(S.A,{title:"添加SQL查询",open:o,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>d(!1),footer:(0,a.jsxs)(I.A,{children:[(0,a.jsx)(m.Ay,{type:"primary",onClick:()=>{if(!j.name||!j.query)return;let e=[...y];-1===c?e.push(j):e[c]=j,A&&A(e),d(!1)},children:"确定"}),(0,a.jsx)(m.Ay,{onClick:()=>d(!1),children:"取消"})]}),children:(0,a.jsxs)(p.A,{layout:"vertical",children:[(0,a.jsx)(p.A.Item,{label:"查询名称",required:!0,children:(0,a.jsx)(x.A,{value:j.name,onChange:e=>b({...j,name:e.target.value})})}),(0,a.jsx)(p.A.Item,{label:"查询语句",required:!0,children:(0,a.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,a.jsx)(E.Ay,{height:"300px",defaultLanguage:"sql",value:j.query,onChange:e=>b({...j,query:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})]})};var eV=t(5690),eU=t(6114),eX=t(7631);let eQ=f.Ay.div`
782
+ display: flex;
783
+ flex-direction: column;
784
+ height: 100%;
785
+ .body {
786
+ flex: 1 1 auto;
787
+ display: flex;
788
+ flex-direction: column;
789
+ gap: 12px;
790
+ padding: 12px;
791
+ overflow: auto;
792
+ }
793
+ `,eZ=(0,f.Ay)(eX.A)`
794
+ .ant-tree-draggable-icon {
795
+ display: none;
796
+ }
797
+
798
+ .ant-tree-title {
799
+ white-space: nowrap;
800
+ overflow: hidden;
801
+ text-overflow: ellipsis;
802
+ }
803
+ `,e0=()=>{let{schema:e,setSchema:l,selectedItem:t,setSelectedItem:i,plugins:s}=(0,n.useContext)(v),[r,o]=(0,n.useState)([]),d=(0,n.useMemo)(()=>t?[t.id]:[],[t]),c=(0,n.useMemo)(()=>{let l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>{let t,{id:a,type:n,children:i}=e;return Array.isArray(i)?t=l(i):"object"==typeof i&&i&&(t=[],Object.keys(i).forEach(e=>{Array.isArray(i[e])&&t.push({key:R(),type:"slot",title:"插槽-"+e,slot:e,origin:i,children:l(i[e])})})),{key:a,title:e.name,item:e,type:n,children:t}})};return l(e.items)},[e]),u=(0,n.useMemo)(()=>{let e=function(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return l.map(l=>{var t,n,i;return{key:l.key,title:(0,a.jsx)(a.Fragment,{children:(null==l?void 0:l.title)||(t=l.type,n=l.slot,"slot"===t?"插槽-"+n:(null==(i=s.find(e=>e.key===t))?void 0:i.label)||t)}),children:l.children?e(l.children):void 0,dataRef:l}})};return e(c)},[c]);return(0,a.jsxs)(eQ,{className:"layer-panel",children:[(0,a.jsx)(eI,{title:"图层",extra:(0,a.jsxs)(I.A,{children:[(0,a.jsx)(T.A,{title:"全部展开",children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>{let l=[],t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{var a;l.push(e.id),(null==(a=e.children)?void 0:a.length)&&t(e.children)})};t(e.items),o(l)},children:(0,a.jsx)(eV.A,{})})}),(0,a.jsx)(T.A,{title:"全部收起",children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>o([]),children:(0,a.jsx)(eU.A,{})})})]})}),(0,a.jsx)("div",{className:"body beautified_scrollbar",children:(0,a.jsx)(eZ,{draggable:{icon:!1,nodeDraggable:e=>"slot"!==e.dataRef.type},showIcon:!1,showLine:{showLeafIcon:!1},treeData:u,selectedKeys:d,expandedKeys:r,onSelect:(e,l)=>{var t;"slot"!==l.node.dataRef.type&&(i&&i(l.node.dataRef.item),null==(t=document.getElementById(`page-item-${l.node.dataRef.item.id}`))||t.scrollIntoView({behavior:"smooth"}))},onDrop:t=>{let a;if(!(e=>{let l=e.node,t=e.dragNode;if("slot"===t.dataRef.type||!e.dropToGap&&!["b-row","b-col","b-card","slot"].includes(l.dataRef.type))return!1;if("b-col"===t.dataRef.type)if(!e.dropToGap)return"b-row"===l.dataRef.type;else return"b-col"===l.dataRef.type;return("b-col"!==l.dataRef.type||!e.dropToGap)&&("b-row"!==l.dataRef.type||!!e.dropToGap)||"b-col"===t.dataRef.type})(t))return;let n=t.node.key,i=t.dragNode.key,s=t.node.pos.split("-"),r=t.dropPosition-Number(s[s.length-1]),o=(e,l,t)=>{e.forEach((e,a,n)=>{if(e.id===l)return(e.children=e.children||[],"slot"===e.type)?t(e,a,n,e.children[e.slot]):t(e,a,n,e.children);if(Array.isArray(e.children))return o(e.children,l,t);if("object"==typeof e.children)for(let a in e.children)Array.isArray(e.children[a])&&o(e.children[a],l,t)})},d=e.items;if(o(d,i,(e,l,t)=>{t.splice(l,1),a=e}),t.dropToGap)if((t.node.children||[]).length>0&&t.node.expanded&&1===r)o(d,n,(e,l,t)=>{e.children=e.children||[],e.children.unshift(a)});else{let e=[],l=0;o(d,n,(t,a,n)=>{e=n,l=a}),-1===r?e.splice(l,0,a):e.splice(l+1,0,a)}else if("slot"===t.node.dataRef.type){let{slot:e,origin:l}=t.node.dataRef;l[e]=l[e]||[],l[e].push(a)}else o(d,n,e=>{e.children=e.children||[],e.children.push(a)});l&&l({...e,items:d})},onExpand:e=>o(e)})})]})};var e1=t(1986),e2=t(8073),e4=t(8440);let e3=f.Ay.div`
804
+ display: flex;
805
+ flex-direction: column;
806
+ height: 100%;
807
+ .body {
808
+ flex: 1 1 auto;
809
+ display: flex;
810
+ flex-direction: column;
811
+ gap: 12px;
812
+ padding: 12px;
813
+ overflow: auto;
814
+
815
+ .ant-form-item {
816
+ margin-bottom: 8px;
817
+ }
818
+
819
+ .ant-form-item-label {
820
+ text-align: left;
821
+ }
822
+
823
+ .ant-form-item-control-input,
824
+ .ant-form-item-control-input-content {
825
+ text-align: end;
826
+ justify-content: flex-end;
827
+ }
828
+
829
+ .ant-divider {
830
+ margin: 0;
831
+ }
832
+ }
833
+ `,e8=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],l=[],t=e=>{Array.isArray(e)&&e.forEach(e=>{l.push(e),Array.isArray(e.children)?t(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(l=>t(e.children[l]))})};return t(e||[]),l},e6=e=>{var l,t,i,s,c,u,h;let{datasourceEnable:f=!0}=e,{plugins:j,selectedItem:b,updateSelectedItem:y,schema:A,setSchema:w,datasetSelector:z,datasetAdd:S}=(0,n.useContext)(v),N=(0,n.useRef)(null),[T,O]=(0,n.useState)("1"),B=(0,n.useMemo)(()=>e8((null==A?void 0:A.items)||[]),[A]),L=(0,n.useMemo)(()=>b&&B.find(e=>e.id===b.id),[B,b]),$=L?T:"1",D=(0,n.useMemo)(()=>j.find(e=>e.key===(null==b?void 0:b.type)),[j,b]),M=null==D?void 0:D.formComponent,R=(null==b?void 0:b.props)||{},F=(null==b?void 0:b.style)||{},[P,G]=(0,n.useState)((null==A?void 0:A.info)||{}),[H,_]=(0,n.useState)((null==b?void 0:b.datasource)||{}),[Y,J]=(0,n.useState)(!1),[q,K]=(0,n.useState)(!1),W=e=>{w({...A,info:e})},V={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return n.useEffect(()=>{O(b?"2":"1"),_((null==b?void 0:b.datasource)||{})},[b]),(0,a.jsxs)(e3,{className:"properties-panel",children:[(0,a.jsx)(eI,{title:"属性",extra:(0,a.jsxs)(en.A.Group,{value:$,size:"small",buttonStyle:"outline",onChange:e=>O(e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"1",children:"页面"}),L&&(0,a.jsx)(en.A.Button,{value:"2",children:"组件"})]})}),(0,a.jsxs)("div",{className:"body beautified_scrollbar always",children:["1"===$&&(0,a.jsxs)(p.A,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,a.jsx)(p.A.Item,{label:"页面名称",children:(0,a.jsx)(x.A,{size:"small",value:null==P?void 0:P.name,placeholder:"请输入页面名称",onChange:e=>{let l={...P,name:e.target.value};G(l),W&&W(l)}})}),(0,a.jsx)(p.A.Item,{label:"页面描述",children:(0,a.jsx)(x.A.TextArea,{size:"small",value:null==P?void 0:P.description,placeholder:"请输入页面描述",onChange:e=>{let l={...P,description:e.target.value};G(l),W&&W(l)}})}),(0,a.jsxs)(p.A.Item,{label:"封面",children:[(0,a.jsxs)(ej.A.Dragger,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:V,action:"/api/datareport/upload",showUploadList:!1,beforeUpload:e=>e.type.startsWith("image/"),onChange:e=>{if("done"===e.file.status){var l;let t={url:null==(l=e.file.response)?void 0:l.data,name:e.file.name},a={...P,cover:t};G(a),W&&W(a)}},children:[(0,a.jsx)("p",{className:"ant-upload-drag-icon",children:(0,a.jsx)(ex.A,{})}),(0,a.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此区域进行上传"}),(0,a.jsx)("p",{className:"ant-upload-hint",children:"严禁上传公司数据或其他被禁止的文件。"})]}),(null==P||null==(l=P.cover)?void 0:l.url)&&(0,a.jsxs)("div",{style:{marginTop:10,textAlign:"left"},children:[(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,a.jsx)("label",{children:"封面预览"}),(0,a.jsx)("a",{onClick:()=>{let e={...P,cover:null};G(e),W&&W(e)},children:(0,a.jsx)(k.A,{})})]}),(0,a.jsx)("img",{src:P.cover.url,style:{width:"100%",maxHeight:200}})]})]})]}),"2"===$&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{children:"基础属性"}),(0,a.jsxs)(p.A,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,a.jsx)(p.A.Item,{label:"组件标识",labelCol:{span:5},wrapperCol:{span:19},children:(null==b?void 0:b.id)||""}),(0,a.jsx)(p.A.Item,{label:"组件名称",children:(0,a.jsx)(x.A,{size:"small",value:null==b?void 0:b.name,onChange:e=>y&&y({...b,name:e.target.value})})}),(0,a.jsx)(p.A.Item,{label:"组件描述",children:(0,a.jsx)(x.A.TextArea,{size:"small",value:null==b?void 0:b.description,onChange:e=>y&&y({...b,description:e.target.value})})}),(0,a.jsx)(p.A.Item,{label:"隐藏组件",tooltip:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{children:"当下方表达式(JS)不为空且为true时组件隐藏。"}),(0,a.jsx)("div",{children:(0,a.jsx)("small",{children:"1.环境变量:$e.变量名。"})}),(0,a.jsx)("div",{children:(0,a.jsx)("small",{children:"2.全局变量:$g.变量名。"})}),(0,a.jsx)("div",{children:(0,a.jsx)("small",{children:"示例:$e.a === '1'。"})})]}),children:(0,a.jsx)(x.A.TextArea,{size:"small",value:null==b?void 0:b.hideExpression,onChange:e=>y&&y({...b,hideExpression:e.target.value})})})]}),(null==b?void 0:b.datasource)&&(0,a.jsx)(g.A,{children:"数据源"}),(null==b?void 0:b.datasource)&&(0,a.jsxs)(p.A,{className:"ant-form-compact",children:[(0,a.jsx)(p.A.Item,{label:(0,a.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:"数据来源"}),labelCol:{span:5},wrapperCol:{span:19},colon:!1,children:(0,a.jsxs)(en.A.Group,{size:"small",value:null==H?void 0:H.source,onChange:e=>{let l={...H||{},source:e.target.value};_(l),y&&y({...b,datasource:l})},children:[!!z&&(0,a.jsx)(en.A.Button,{value:"dataset",children:"数据集"}),f&&(0,a.jsx)(en.A.Button,{value:"define",children:"数据源"}),(0,a.jsx)(en.A.Button,{value:"custom",children:"自定义"})]})}),(null==H?void 0:H.source)==="dataset"&&z&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(p.A.Item,{label:"数据集",labelCol:{span:5},wrapperCol:{span:19},children:(0,a.jsxs)(I.A.Compact,{children:[(0,a.jsx)(x.A,{size:"small",readOnly:!0,value:(null==H||null==(t=H.dataset)?void 0:t.name)||"",style:{width:90}}),!!(null==H||null==(s=H.dataset)||null==(i=s.id)?void 0:i.length)&&(null==H||null==(c=H.dataset)?void 0:c.output)&&(0,a.jsx)(e2.A,{title:"输出类型",placement:"left",content:(0,a.jsx)("div",{style:{padding:"0 12px",maxWidth:500,maxHeight:500,overflow:"auto"},children:(0,a.jsx)(e5,{output:H.dataset.output})}),children:(0,a.jsx)(m.Ay,{size:"small",style:{color:"var(--ant-color-text-tertiary)"},title:"查看输出类型",children:(0,a.jsx)(C,{type:"icon-json"})})}),!!(null==H||null==(h=H.dataset)||null==(u=h.id)?void 0:u.length)&&(0,a.jsx)(m.Ay,{size:"small",icon:(0,a.jsx)(o.A,{}),onClick:()=>{let e={...H||{},dataset:{id:"",name:"",output:{fields:[]}}};_(e),y&&y({...b,datasource:e})},title:"删除数据集",style:{color:"var(--ant-color-text-tertiary)"}}),S&&(0,a.jsx)(m.Ay,{size:"small",icon:(0,a.jsx)(r.A,{}),title:"新建数据集",onClick:()=>K(!0)}),(0,a.jsx)(m.Ay,{size:"small",icon:(0,a.jsx)(e1.A,{}),title:"选择数据集",onClick:()=>J(!0)})]})})}),(null==H?void 0:H.source)==="define"&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.A.Item,{label:"数据源",layout:"vertical",children:(0,a.jsx)(e4.A,{size:"small",value:null==H?void 0:H.datasourceId,onChange:e=>{let l={...H||{},datasourceId:e};_(l),y&&y({...b,datasource:l})},children:((null==A?void 0:A.datasources)||[]).map(e=>(0,a.jsx)(e4.A.Option,{value:e.id,children:e.name},e.id))})}),(0,a.jsx)(p.A.Item,{label:"数据处理脚本",labelCol:{span:24},wrapperCol:{span:24},children:(0,a.jsx)(e4.A,{size:"small",value:null==H?void 0:H.scriptId,onChange:e=>{let l={...H||{},scriptId:e};_(l),y&&y({...b,datasource:l})},children:((null==A?void 0:A.scripts)||[]).map(e=>(0,a.jsx)(e4.A.Option,{value:e.id,children:e.name},e.id))})})]}),(null==H?void 0:H.source)==="custom"&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["自定义",(0,a.jsxs)("a",{onClick:()=>{var e,l;let t=null==(e=N.current)?void 0:e.editor;null==t||null==(l=t.getAction("editor.action.formatDocument"))||l.run()},children:[(0,a.jsx)(C,{type:"icon-formate"})," 格式化"]})]}),labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-item-label-space",children:(0,a.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,a.jsx)(E.Ay,{height:"200px",onMount:e=>{N.current={editor:e}},defaultLanguage:"json",value:(null==H?void 0:H.custom)||"",onChange:e=>{let l={...H||{},custom:e||""};_(l),y&&y({...b,datasource:l})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})})]}),M&&(0,a.jsx)(g.A,{children:"特有属性"}),M&&(0,a.jsx)(M,{model:R,customStyle:F,onChange:e=>{b&&y&&y({...b,props:e})}})]})]}),!!z&&b&&(0,a.jsx)(d.A,{title:"选择数据集",size:800,open:Y,onClose:()=>{J(!1)},children:z(e=>{H.dataset=e,y({...b,datasource:{...b.datasource,dataset:e}}),J(!1)})}),!!S&&b&&q&&S(b,e=>{H.dataset=e,y({...b,datasource:{...b.datasource,dataset:e}}),K(!1)},()=>{K(!1)})]})},e5=e=>{let{output:l}=e,t=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e&&0!==e.length?(0,a.jsxs)(a.Fragment,{children:["{",e.map((n,i)=>(0,a.jsxs)("div",{style:{paddingLeft:"1em"},children:[(0,a.jsx)("span",{style:{color:"var(--ant-color-primary)"},children:n.key}),":"," ","ARRAY"===n.type?(0,a.jsxs)(a.Fragment,{children:["Array","<",n.schema?t(n.schema.fields,l+1):(0,a.jsx)("span",{children:"any"}),">"]}):"OBJECT"===n.type?n.schema?t(n.schema.fields,l+1):(0,a.jsx)("span",{children:"{}"}):(0,a.jsx)("span",{style:{color:"var(--ant-color-success)"},children:(n.type||"string").toLowerCase()}),i<e.length-1?",":""]},n.key||i)),"}"]}):(0,a.jsx)("span",{children:"{}"})};return(0,a.jsx)("pre",{style:{margin:"8px 0",padding:"8px",background:"var(--ant-color-fill-alter)",borderRadius:"var(--ant-border-radius-sm)",fontSize:"12px",fontFamily:"monospace",overflowX:"auto",border:"1px solid var(--ant-color-border-secondary)"},children:t(l.fields)})},e9=f.Ay.div`
834
+ display: flex;
835
+ flex-direction: column;
836
+ height: 100%;
837
+ .body {
838
+ flex: 1 1 auto;
839
+ display: flex;
840
+ flex-direction: column;
841
+ gap: 12px;
842
+ padding: 12px;
843
+ overflow: auto;
844
+ }
845
+ ul,
846
+ li {
847
+ list-style: none;
848
+ padding: 0;
849
+ margin: 0;
850
+ }
851
+ li {
852
+ display: flex;
853
+ align-items: center;
854
+ justify-content: space-between;
855
+ padding: 8px;
856
+ border-bottom: 1px dotted #d9d9d9;
857
+ }
858
+ li > div:first-child {
859
+ flex: 1 1 auto;
860
+ white-space: nowrap;
861
+ overflow: hidden;
862
+ text-overflow: ellipsis;
863
+ }
864
+ li:last-child {
865
+ border-bottom: none;
866
+ }
867
+ .function-wrapper {
868
+ color: #0000ff;
869
+ font-size: 14px;
870
+ padding: 0 50px;
871
+ }
872
+ `,e7=()=>{let{schema:e,setSchema:l}=(0,n.useContext)(v),[t,i]=n.useState(!1),[r,o]=n.useState(-1),[d]=p.A.useForm(),c=(0,n.useMemo)(()=>e.scripts||[],[e]),u=t=>{l({...e,scripts:t})},h=async()=>{let e=await d.validateFields().catch(()=>null);if(!e)return;let l=[...c];-1===r?l.push({id:Math.random().toString(36).slice(2,10),...e}):l[r]={...l[r],...e},u&&u(l),i(!1),o(-1),d.resetFields()};return(0,a.jsxs)(e9,{className:"script-panel",children:[(0,a.jsx)(eI,{title:"脚本",extra:(0,a.jsx)(I.A,{children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>{o(-1),d.setFieldsValue({name:"",script:"return {};"}),i(!0)},children:"+"})})}),(0,a.jsx)("div",{className:"body beautified_scrollbar",children:(0,a.jsx)("ul",{children:c.map((e,l)=>(0,a.jsxs)("li",{children:[(0,a.jsxs)("div",{title:e.name,children:[(0,a.jsx)(C,{type:"icon-drag"})," ",e.name]}),(0,a.jsxs)(I.A,{children:[(0,a.jsx)("a",{onClick:()=>{o(l),d.setFieldsValue({name:e.name,script:e.script}),i(!0)},children:(0,a.jsx)(s.A,{})}),(0,a.jsx)("a",{onClick:()=>{let e=[...c];e.splice(l,1),u&&u(e)},children:(0,a.jsx)(k.A,{})})]})]},e.id||l))})}),(0,a.jsx)(S.A,{title:"添加脚本",open:t,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>i(!1),footer:(0,a.jsxs)(I.A,{children:[(0,a.jsx)(m.Ay,{type:"primary",onClick:h,children:"确定"}),(0,a.jsx)(m.Ay,{onClick:()=>i(!1),children:"取消"})]}),children:(0,a.jsxs)(p.A,{form:d,layout:"vertical",children:[(0,a.jsx)(p.A.Item,{label:"脚本名称",name:"name",rules:[{required:!0,message:"请输入脚本名称"}],children:(0,a.jsx)(x.A,{})}),(0,a.jsx)(p.A.Item,{label:"脚本语句",name:"script",rules:[{required:!0,message:"请输入脚本语句"}],children:(0,a.jsxs)("div",{style:{border:"1px solid #d9d9d9"},children:[(0,a.jsxs)("div",{className:"function-wrapper",children:["function fixed(data) ","{"]}),(0,a.jsx)(E.Ay,{height:"200px",defaultLanguage:"javascript",value:d.getFieldValue("script"),onChange:e=>d.setFieldsValue({script:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}}),(0,a.jsx)("div",{className:"function-wrapper",children:"}"})]})})]})})]})},le=f.Ay.div`
873
+ display: flex;
874
+ flex-direction: column;
875
+ height: 100%;
876
+ .body {
877
+ flex: 1 1 auto;
878
+ display: flex;
879
+ flex-direction: column;
880
+ gap: 12px;
881
+ padding: 12px;
882
+ }
883
+ `,ll=()=>{let{schema:e,setSchema:l,setGlobalEnv:t}=(0,n.useContext)(v),[i,r]=n.useState(!1),[o,d]=n.useState(-1),[c]=p.A.useForm(),u=(0,n.useMemo)(()=>e.variables||[],[e.variables]),g=a=>{l({...e,variables:a}),a.forEach(e=>{t(e.name,e.value)})},f=[{title:"名称",dataIndex:"name",render:(e,l)=>(0,a.jsxs)("div",{title:e,children:[(0,a.jsx)(C,{type:"icon-drag"})," ",e]})},{title:"值",dataIndex:"value"},{title:"操作",width:60,align:"center",render:(e,l,t)=>(0,a.jsxs)(I.A,{children:[(0,a.jsx)("a",{onClick:()=>{d(t),c.setFieldsValue({name:l.name,value:l.value}),r(!0)},children:(0,a.jsx)(s.A,{})}),(0,a.jsx)(eu.A,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...u];e.splice(t,1),g&&g(e)},children:(0,a.jsx)("a",{children:(0,a.jsx)(k.A,{})})})]})}],j=async()=>{let e=await c.validateFields().catch(()=>null);if(!e)return;let l=[...u];-1===o?l.push({...e}):l[o]={...l[o],...e},g&&g(l),r(!1),d(-1),c.resetFields()};return(0,a.jsxs)(le,{children:[(0,a.jsx)(eI,{title:"环境变量",extra:(0,a.jsx)(I.A,{children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>{d(-1),c.resetFields(),r(!0)},children:"+"})})}),(0,a.jsx)("div",{className:"body beautified_scrollbar",children:(0,a.jsx)(h.A,{rowKey:e=>e.id||e.name,dataSource:u,columns:f,pagination:!1,size:"small",locale:{emptyText:"暂无环境变量"}})}),(0,a.jsx)(S.A,{title:"添加环境变量",open:i,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>r(!1),footer:(0,a.jsxs)(I.A,{children:[(0,a.jsx)(m.Ay,{type:"primary",onClick:j,children:"确定"}),(0,a.jsx)(m.Ay,{onClick:()=>r(!1),children:"取消"})]}),children:(0,a.jsxs)(p.A,{form:c,layout:"vertical",children:[(0,a.jsx)(p.A.Item,{label:"环境变量名称",name:"name",rules:[{required:!0,message:"请输入环境变量名称"}],children:(0,a.jsx)(x.A,{})}),(0,a.jsx)(p.A.Item,{label:"环境变量值",name:"value",rules:[{required:!0,message:"请输入环境变量值"}],children:(0,a.jsx)(x.A,{})})]})})]})},lt=f.Ay.div`
884
+ display: flex;
885
+ flex-direction: column;
886
+ height: 100%;
887
+ .body {
888
+ flex: 1 1 auto;
889
+ display: flex;
890
+ flex-direction: column;
891
+ gap: 12px;
892
+ padding: 12px;
893
+ overflow: auto;
894
+ }
895
+ `,la=n.forwardRef((e,l)=>{let{renderNode:t}=e,i=(0,n.useRef)(null);(0,n.useImperativeHandle)(l,()=>({reload:s}));let s=()=>{var e;null==(e=i.current)||e.reload()};return(0,a.jsxs)(lt,{className:"dataset-panel",children:[(0,a.jsx)(eI,{title:"数据集",extra:(0,a.jsx)(I.A,{children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>{var e;null==(e=i.current)||e.handleAdd()},children:"+"})})}),(0,a.jsx)("div",{className:"body beautified_scrollbar",children:(0,a.jsx)(t,{ref:i})})]})}),ln=f.Ay.div`
896
+ display: flex;
897
+ flex-direction: column;
898
+ height: 100%;
899
+ .body {
900
+ flex: 1 1 auto;
901
+ display: flex;
902
+ flex-direction: column;
903
+ gap: 12px;
904
+ padding: 12px;
905
+ overflow-y: auto;
906
+ overflow-x: hidden;
907
+
908
+ .ant-divider {
909
+ margin: 0;
910
+ }
911
+ }
912
+ ul {
913
+ list-style: none;
914
+ padding: 0;
915
+ margin: 0;
916
+
917
+ li {
918
+ list-style: none;
919
+ padding: 0;
920
+ margin: 0;
921
+ display: flex;
922
+ flex-direction: column;
923
+ border-bottom: 1px dotted #d9d9d9;
924
+ padding-bottom: 8px;
925
+
926
+ & > div:first-child {
927
+ font-size: 14px;
928
+ color: var(--ant-color-text-label);
929
+ padding: 6px 0;
930
+ }
931
+
932
+ &:last-child {
933
+ border-bottom: none;
934
+ }
935
+ }
936
+ }
937
+ ul.tips {
938
+ padding-left: 20px;
939
+ li {
940
+ display: list-item;
941
+ list-style: disc;
942
+ border-bottom: none;
943
+ color: var(--ant-color-text-secondary);
944
+ }
945
+ }
946
+ a.toolbar {
947
+ font-size: 16px;
948
+ color: var(--ant-color-text-secondary);
949
+ }
950
+ `,li=e=>{var l;let{}=e,{selectedItem:t,setSelectedItem:i,plugins:s,forceUpdate:o}=(0,n.useContext)(v),d=(0,n.useMemo)(()=>(s||[]).find(e=>e.key===(null==t?void 0:t.type)),[s,null==t?void 0:t.type]),c=(null==d?void 0:d.events)||[],u=c.reduce((e,l)=>(e[l.handler]=l.name,e),{}),p=e=>{t&&(i(Object.assign(t,{events:e})),o())};return(0,a.jsxs)(ln,{className:"cascade-panel",children:[(0,a.jsx)(eI,{title:"事件",extra:(null==d?void 0:d.events)?(0,a.jsx)(I.A,{children:(0,a.jsx)(N.A,{menu:{onClick:e=>{let{key:l}=e,a=[...(null==t?void 0:t.events)||[]];a.push({name:l,script:""}),p&&p(a)},items:c.filter(e=>{var l;return!(null==(l=(null==t?void 0:t.events)||[])?void 0:l.some(l=>l.name===e.handler))}).map(e=>({key:e.handler,label:`${e.name}(${e.handler})`}))},placement:"bottomRight",trigger:["click"],children:(0,a.jsxs)("a",{className:"toolbar",children:[(0,a.jsx)(r.A,{}),(0,a.jsx)(eR.A,{style:{fontSize:8,verticalAlign:"sub"}})]})})}):null}),(0,a.jsxs)("div",{className:"body beautified_scrollbar",children:[(0,a.jsx)(g.A,{children:"事件列表"}),(null==t||null==(l=t.events)?void 0:l.length)?(0,a.jsx)("ul",{children:(t.events||[]).map((e,l)=>{let{name:n,script:i}=e;return(0,a.jsxs)("li",{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(C,{type:"icon-thunderbolt"})," ",u[n],"(",n,")"]}),(0,a.jsx)("div",{style:{border:"solid 1px var(--ant-color-border)",borderRadius:"var(--ant-border-radius-sm)"},children:(0,a.jsx)(E.KE,{height:"200px",defaultLanguage:"javascript",value:i||"",onChange:e=>{let a=[...(null==t?void 0:t.events)||[]];a[l].script=e||"",p&&p(a)},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})]},n)})}):(0,a.jsx)(ei.A,{description:"暂无事件",image:ei.A.PRESENTED_IMAGE_SIMPLE}),(0,a.jsx)(g.A,{children:"脚本说明"}),(0,a.jsx)("div",{children:(0,a.jsxs)("ul",{className:"tips",children:[(0,a.jsxs)("li",{children:["内置参数:param(类型:Object)",(0,a.jsxs)("ul",{style:{margin:"8px 0 0 20px"},children:[(0,a.jsx)("li",{children:"param.item: 当前事件触发的组件。"}),(0,a.jsx)("li",{children:"param.sourceId: 当前事件触发的组件ID。"}),(0,a.jsx)("li",{children:"param.arg: 事件触发时传递的参数。"})]})]}),(0,a.jsx)("li",{children:"脚本禁止使用以下 API:window, document, global, process, require, module, exports, cookie, localStorage, sessionStorage。"}),(0,a.jsx)("li",{children:"组件方法调用:callMethod(targetId, methodName, arg)。"}),(0,a.jsx)("li",{children:"环境变量设置:updateEnv(key, value)。"})]})})]})]})},ls=f.Ay.div`
951
+ display: flex;
952
+ flex-direction: column;
953
+ height: 100%;
954
+ .body {
955
+ flex: 1 1 auto;
956
+ display: flex;
957
+ flex-direction: column;
958
+ gap: 12px;
959
+ padding: 12px;
960
+ }
961
+ `,lr=()=>{let[e,l]=(0,n.useState)(!1),[t]=p.A.useForm(),{schema:i,datasetSelector:s,setSchema:r}=(0,n.useContext)(v),o=(0,n.useMemo)(()=>(null==i?void 0:i.datasets)||[],[i]),c=(0,n.useMemo)(()=>i.variables||[],[i.variables]);return(0,a.jsxs)(ls,{children:[(0,a.jsx)(eI,{title:"全局数据集",extra:(0,a.jsx)(I.A,{children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>{t.resetFields(),l(!0)},children:"+"})})}),(0,a.jsx)("div",{className:"body beautified_scrollbar",children:o.map((e,l)=>(0,a.jsx)(ec.A,{title:e.name,size:"small",variant:"outlined",extra:(0,a.jsx)(eu.A,{title:"确认删除吗?",onConfirm:()=>{r(l=>({...l,datasets:o.filter(l=>l.id!==e.id)}))},children:(0,a.jsx)("a",{className:"toolbar",children:(0,a.jsx)(k.A,{})})}),styles:{header:{minHeight:0}},children:(0,a.jsxs)(p.A,{layout:"vertical",size:"small",styles:{label:{fontSize:12,color:"var(--ant-color-text-label)"}},children:[(0,a.jsx)(p.A.Item,{label:"变量名",style:{marginBottom:10},children:(0,a.jsx)(x.A,{name:"key",size:"small",value:e.key,placeholder:"请输入变量名",onChange:e=>{o[l].key=e.target.value,r(e=>({...e,datasets:[...o]}))},style:{width:"100%"}})}),(0,a.jsx)(p.A.Item,{label:"依赖环境变量",style:{marginBottom:10},children:(0,a.jsx)(e4.A,{size:"small",mode:"multiple",options:c.map(e=>({label:e.name,value:e.name})),placeholder:"请选择依赖环境变量",style:{width:"100%"},value:e.dependencies,notFoundContent:"暂无依赖环境变量",onChange:e=>{o[l].dependencies=e,r(e=>({...e,datasets:[...o]}))}})}),(0,a.jsx)(p.A.Item,{label:"AI解读提示词",tooltip:"用于AI解读数据集,为空时不进行解读",style:{marginBottom:0},children:(0,a.jsx)(x.A.TextArea,{size:"small",value:e.aiPrompt,onChange:e=>{o[l].aiPrompt=e.target.value,r(e=>({...e,datasets:[...o]}))},rows:4})})]})},l))}),!!s&&(0,a.jsx)(d.A,{title:"选择数据集",size:800,open:e,onClose:()=>{l(!1)},children:s(e=>{l(!1),r(l=>({...l,datasets:[...o,{id:e.id,name:e.name,key:e.id,output:e.output,dependencies:[]}]}))})})]})},lo=f.Ay.div`
962
+ height: 100%;
963
+ display: grid;
964
+ background: #ffffff;
965
+ * {
966
+ box-sizing: border-box;
967
+ }
968
+ & > div {
969
+ height: calc(100vh - 49px);
970
+ display: flex;
971
+ flex-direction: column;
972
+ }
973
+ & > .center {
974
+ background: #ebe7e7;
975
+ align-items: center;
976
+ min-width: 0;
977
+
978
+ .body {
979
+ flex: 1 1 auto;
980
+ overflow: auto;
981
+ position: relative;
982
+ background: #f3f3f3;
983
+ box-sizing: border-box;
984
+ max-width: 100%;
985
+ }
986
+ .body.desktop {
987
+ width: 100%;
988
+ }
989
+ .body.mobile,
990
+ .body.tablet {
991
+ padding: 0;
992
+ margin-top: 20px;
993
+ margin-bottom: 20px;
994
+ border-radius: 8px;
995
+ }
996
+ .body.tablet {
997
+ width: 1024px;
998
+ }
999
+ .body.mobile {
1000
+ width: 430px;
1001
+ }
1002
+ }
1003
+
1004
+ & > .left,
1005
+ & > .right {
1006
+ transition: all 0.25s ease-in-out;
1007
+ overflow: hidden;
1008
+ }
1009
+ & > .left {
1010
+ border-right: 1px solid #e8e8e8;
1011
+ display: flex;
1012
+ flex-direction: row;
1013
+ }
1014
+ & > .left .body {
1015
+ flex: 1 1 auto;
1016
+ overflow: auto;
1017
+ }
1018
+ & > .right {
1019
+ display: flex;
1020
+ flex-direction: row;
1021
+ border-left: 1px solid #e8e8e8;
1022
+ }
1023
+ & > .right .body {
1024
+ flex: 1 1 auto;
1025
+ display: flex;
1026
+ flex-direction: column;
1027
+ gap: 12px;
1028
+ padding: 12px;
1029
+ height: calc(100% - 49px);
1030
+ }
1031
+ .left-pane-tabs > label,
1032
+ .right-pane-tabs > label {
1033
+ border: none;
1034
+ height: 32px;
1035
+ padding: 7px;
1036
+ font-size: 20px;
1037
+ padding: 0 12px;
1038
+ border-radius: 0;
1039
+
1040
+ &:not(:first-child)::before {
1041
+ content: none;
1042
+ }
1043
+ }
1044
+ .left-pane-tabs > label.ant-radio-button-wrapper-checked {
1045
+ border-left: solid 2px #1890ff;
1046
+ background: linear-gradient(to right, #1890ff1a, #ffffff);
1047
+ }
1048
+ .right-pane-tabs > label.ant-radio-button-wrapper-checked {
1049
+ border-right: solid 2px #1890ff;
1050
+ background: linear-gradient(to left, #1890ff1a, #ffffff);
1051
+ }
1052
+
1053
+ .beautified_scrollbar {
1054
+ overflow: auto;
1055
+ scrollbar-width: none;
1056
+
1057
+ &.always {
1058
+ overflow-y: scroll;
1059
+ scrollbar-width: thin;
1060
+ }
1061
+ &::-webkit-scrollbar {
1062
+ width: 0;
1063
+ height: 0;
1064
+ position: absolute;
1065
+ }
1066
+ &:hover {
1067
+ scrollbar-width: thin;
1068
+ }
1069
+ &:hover::-webkit-scrollbar {
1070
+ width: 8px;
1071
+ height: 8px;
1072
+ }
1073
+ &:hover::-webkit-scrollbar-thumb {
1074
+ background: var(--ant-color-border);
1075
+ border-radius: 4px;
1076
+ }
1077
+ &:hover::-webkit-scrollbar-track {
1078
+ background: transparent;
1079
+ }
1080
+ }
1081
+ `,ld=(0,f.Ay)(ea.A)`
1082
+ color: var(--ant-color-text-label);
1083
+ background: var(--ant-color-bg-text-hover);
1084
+ border: var(--ant-color-border) solid 1px;
1085
+ padding: 0 20px 0 8px;
1086
+ border-radius: var(--ant-border-radius);
1087
+ height: 24px;
1088
+ font-size: 12px;
1089
+ cursor: pointer;
1090
+ user-select: none;
1091
+
1092
+ &:hover {
1093
+ background: var(--ant-color-bg-text-active);
1094
+ }
1095
+ `,lc=f.Ay.ul`
1096
+ padding: 0;
1097
+ margin: 0;
1098
+ list-style: none;
1099
+ li {
1100
+ padding: 10px;
1101
+ border-bottom: dotted 1px var(--ant-color-border);
1102
+ cursor: pointer;
1103
+
1104
+ &:last-child {
1105
+ border-bottom: none;
1106
+ }
1107
+
1108
+ &:hover {
1109
+ background: var(--ant-color-primary-bg);
1110
+ }
1111
+
1112
+ h5 {
1113
+ margin: 0;
1114
+ color: var(--ant-color-text-label);
1115
+ font-size: 14px;
1116
+
1117
+ small {
1118
+ color: var(--ant-color-text-description);
1119
+
1120
+ &:before {
1121
+ content: "(ID: ";
1122
+ }
1123
+ &:after {
1124
+ content: ")";
1125
+ }
1126
+ }
1127
+ }
1128
+
1129
+ div {
1130
+ margin: 8px 0 0 0;
1131
+ color: var(--ant-color-text-description);
1132
+ }
1133
+ }
1134
+ `,lu=e=>{let{open:l,onCancel:t,onOk:i}=e,[s,r]=(0,n.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,a.jsx)(S.A,{title:"导入页面",open:l,width:800,onCancel:t,onOk:()=>null==i?void 0:i(JSON.parse(s)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,a.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,a.jsx)(E.KE,{height:"100%",defaultLanguage:"json",value:s,options:{minimap:{enabled:!1}},onChange:e=>r(e||"")})})})},lp=n.forwardRef((e,l)=>{var t,i;let s,{pageId:r,agentList:c=[],plugins:u=[],headerExtra:p,datasourceEnable:h=!0,scriptEnable:f=!0,datasetPanel:j,datasetSelector:v,datasetAdd:y,fetch:A,onSave:w,loading:k=!1}=e,N=(0,n.useRef)(null),O=(0,n.useRef)(null),[E,B]=(0,n.useState)(1),[L,$]=(0,n.useState)([]),[D,M]=(0,n.useState)([]),[F,P]=(0,n.useState)(!1),[G,H]=(0,n.useState)("desktop"),[_,ea]=(0,n.useState)("component"),[er,eo]=(0,n.useState)((null==A?void 0:A.ai)?"ai":"props"),[ed,ec]=(0,n.useState)(!0),[eu,ep]=(0,n.useState)(!0),[ex,em]=(0,n.useState)(null),[eh,eg]=(0,n.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[ef,ej]=(0,n.useState)(!0),[ev,eb]=(0,n.useState)(!1),[ey,eA]=(0,n.useState)(!1),[eC,ew]=(0,n.useState)(""),[ek,ez]=(0,n.useState)(!1),eS=(0,n.useMemo)(()=>{let e=ed?"250px":"",l=eu?"400px":"";return{gridTemplateColumns:`${e} 1fr ${l}`}},[ed,eu]),eN=(0,n.useMemo)(()=>({display:ed?"flex":"none"}),[ed]),eT=(0,n.useMemo)(()=>({display:eu?"flex":"none"}),[eu]);i=[eh],(s=(0,n.useRef)()).current===JSON.stringify(i)&&s.current||(s.current=JSON.stringify(i),(()=>{F||($(e=>e.length?[...e,JSON.parse(JSON.stringify(eh))].slice(-50):[JSON.parse(JSON.stringify(eh))]),M([]))})()),(0,n.useImperativeHandle)(l,()=>({handleOpen(e){P(!0),eO(e.items),eg(e),$([JSON.parse(JSON.stringify(e))]),M([]),setTimeout(()=>P(!1),0)}}));let eO=(e,l)=>{e&&e.forEach(e=>{e.id||(e.id=l||R()),Array.isArray(e.children)?eO(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(l=>{Array.isArray(e.children[l])&&eO(e.children[l],R())})})},eB=e=>{var l,t,a;if((null==(l=e.datasets)?void 0:l.length)&&(null==O||null==(t=O.current)?void 0:t.reload)&&O.current.reload(),e.schema){let l=JSON.parse(JSON.stringify(e.schema));eO(l.items),eg(l)}else if(null==(a=e.pageItems)?void 0:a.length){let l=new Map;e.pageItems.forEach(e=>{l.has(e.targetId)||l.set(e.targetId,[]),l.get(e.targetId).push(e)});let t=JSON.parse(JSON.stringify(eh)),a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((t,n)=>{l.has(t.id)&&l.get(t.id).forEach(l=>{let{position:a,insertSlot:i,pageItem:s}=l;switch(a){case"before":e.splice(n,0,s);break;case"after":e.splice(n+1,0,s);break;case"replace":Object.keys(t).forEach(e=>{"id"!==e&&delete t[e]}),Object.assign(t,s);break;case"insert":var r,o,d;let c=u.find(e=>e.key===t.type);Array.isArray(null==c||null==(r=c.defaultOptions)?void 0:r.children)?t.children=[...t.children||[],s]:"object"==typeof(null==c||null==(o=c.defaultOptions)?void 0:o.children)&&i&&(t.children={...t.children||{},[i]:[...(null==(d=t.children)?void 0:d[i])||[],s]})}}),Array.isArray(t.children)?a(t.children):"object"==typeof t.children&&t.children&&Object.keys(t.children).forEach(e=>{Array.isArray(t.children[e])&&a(t.children[e])})})};a(t.items),eg(t)}},eL=(0,n.useMemo)(()=>"cascade"!==er||(null==ex?void 0:ex.cascadeIds)?er:"props",[ex,er]),e$=(0,n.useMemo)(()=>(u||[]).find(e=>e.key===(null==ex?void 0:ex.type)),[u,null==ex?void 0:ex.type]),eD=(0,n.useMemo)(()=>{var e;if(!(null==eC||null==(e=eC.trim())?void 0:e.length))return[];let l=[],t=e=>{Array.isArray(e)&&e.forEach(e=>{JSON.stringify(e).includes(eC)&&l.push(e),Array.isArray(e.children)?t(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(l=>t(e.children[l]))})};return t((null==eh?void 0:eh.items)||[]),l},[null==eh?void 0:eh.items,eC]);return(0,a.jsxs)(b,{pageId:r,designable:ef,plugins:u,schema:eh,selectedItem:ex,setSchema:eg,setSelectedItem:em,datasetSelector:v,datasetAdd:y,fetch:A,children:[(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,a.jsxs)(I.A,{children:[(0,a.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,a.jsx)(g.A,{orientation:"vertical"}),(0,a.jsx)(T.A,{title:"保存",children:(0,a.jsx)(m.Ay,{type:"link",className:"toolbar",onClick:()=>{null==w||w(eh)},loading:k,children:(0,a.jsx)(J.A,{})})}),(0,a.jsx)(g.A,{orientation:"vertical"}),(0,a.jsx)(T.A,{title:"撤销",children:(0,a.jsx)("a",{className:`toolbar ${L.length>1?"active":""}`,onClick:()=>{$(e=>{if(e.length<=1)return e;P(!0);let l=e[e.length-2];return M(e=>[...e,JSON.parse(JSON.stringify(eh))]),eg(l),em(null),setTimeout(()=>P(!1),0),e.slice(0,-1)})},children:(0,a.jsx)(q.A,{})})}),(0,a.jsx)(T.A,{title:"重做",children:(0,a.jsx)("a",{className:`toolbar ${D.length>0?"active":""}`,onClick:()=>{M(e=>e.length?(P(!0),$(e=>[...e,JSON.parse(JSON.stringify(eh))]),eg(e[e.length-1]),em(null),setTimeout(()=>P(!1),0),e.slice(0,-1)):e)},children:(0,a.jsx)(K.A,{})})}),(0,a.jsx)(g.A,{orientation:"vertical"}),(0,a.jsx)(T.A,{title:"导入JSON",children:(0,a.jsx)("a",{className:`toolbar ${D.length>0?"active":""}`,onClick:()=>{eb(!0)},children:(0,a.jsx)(W.A,{})})})]}),(0,a.jsxs)(I.A,{children:[(0,a.jsx)(T.A,{title:"缩小",children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>B(parseFloat(Math.max(E-.1,.5).toFixed(1))),children:(0,a.jsx)(V.A,{})})}),(0,a.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*E).toFixed(0),"%"]}),(0,a.jsx)(T.A,{title:"放大",children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>B(parseFloat(Math.min(E+.1,2).toFixed(1))),children:(0,a.jsx)(U.A,{})})}),(0,a.jsx)(T.A,{title:"重置缩放",children:(0,a.jsx)("a",{className:"toolbar",onClick:()=>B(1),children:(0,a.jsx)(C,{type:"icon-zoom-reset"})})}),(0,a.jsx)(g.A,{orientation:"vertical"}),(0,a.jsx)(T.A,{title:"切换左侧栏",children:(0,a.jsx)("a",{className:`toolbar ${ed?"active":""}`,onClick:()=>{ec(e=>!e),setTimeout(()=>{var e,l;return null==(l=N.current)||null==(e=l.handleResize)?void 0:e.call(l)},0)},children:(0,a.jsx)(C,{type:"icon-sider-l"})})}),(0,a.jsx)(T.A,{title:"切换右侧栏",children:(0,a.jsx)("a",{className:`toolbar ${eu?"active":""}`,onClick:()=>{ep(e=>!e),setTimeout(()=>{var e,l;return null==(l=N.current)||null==(e=l.handleResize)?void 0:e.call(l)},0)},children:(0,a.jsx)(C,{type:"icon-sider-r"})})}),p]})]}),(0,a.jsxs)(lo,{style:eS,children:[(0,a.jsxs)("div",{className:"left",style:eN,children:[(0,a.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,a.jsxs)(en.A.Group,{value:_,onChange:e=>ea(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,a.jsx)(T.A,{title:"组件",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"component",children:(0,a.jsx)(C,{type:"icon-puzzle"})})}),(0,a.jsx)(T.A,{title:"图层",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"layer",children:(0,a.jsx)(C,{type:"icon-outline"})})}),!!j&&(0,a.jsx)(T.A,{title:"数据集",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"dataset",children:(0,a.jsx)(C,{type:"icon-dataset"})})}),h&&(0,a.jsx)(T.A,{title:"数据源",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"datasource",title:"数据源",children:(0,a.jsx)(C,{type:"icon-datasource"})})}),f&&(0,a.jsx)(T.A,{title:"脚本",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"script",children:(0,a.jsx)(C,{type:"icon-js"})})}),(0,a.jsx)(T.A,{title:"环境变量",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"env",children:(0,a.jsx)(C,{type:"icon-variable"})})}),(0,a.jsx)(T.A,{title:"全局数据集",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"global-dataset",children:(0,a.jsx)(C,{type:"icon-datasource-g"})})}),(0,a.jsx)(T.A,{title:"源码",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"code",children:(0,a.jsx)(C,{type:"icon-json"})})})]})}),(0,a.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===_&&(0,a.jsx)(eq,{}),"layer"===_&&(0,a.jsx)(e0,{}),h&&"datasource"===_&&(0,a.jsx)(eW,{}),f&&"script"===_&&(0,a.jsx)(e7,{}),"env"===_&&(0,a.jsx)(ll,{}),"code"===_&&(0,a.jsx)(e_,{}),!!j&&"dataset"===_&&(0,a.jsx)(la,{ref:O,renderNode:j}),"global-dataset"===_&&(0,a.jsx)(lr,{})]})]}),(0,a.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,a.jsx)(eI,{title:"页面",extra:(0,a.jsxs)(I.A,{children:[(0,a.jsxs)(ld,{align:"center",gap:8,onClick:()=>ez(!0),children:[(0,a.jsx)(X.A,{}),(0,a.jsx)(z.A.Text,{style:{fontSize:12,color:"var(--ant-color-text-label)"},children:"Quick search..."})]}),(0,a.jsx)(m.Ay,{size:"small",type:ef?"default":"primary",icon:ef?(0,a.jsx)(Q.A,{}):(0,a.jsx)(Z.A,{}),onClick:()=>ej(!ef)}),(0,a.jsxs)(en.A.Group,{value:G,onChange:e=>H(e.target.value),size:"small",buttonStyle:"outline",children:[(0,a.jsx)(en.A.Button,{value:"desktop",title:"桌面",children:(0,a.jsx)(ee.A,{})}),(0,a.jsx)(en.A.Button,{value:"mobile",title:"移动设备",children:(0,a.jsx)(el.A,{})}),(0,a.jsx)(en.A.Button,{value:"tablet",title:"平板设备",children:(0,a.jsx)(et.A,{})})]})]})}),(0,a.jsx)("div",{id:"page-canvas-wrapper",className:["body beautified_scrollbar always",G].join(" "),children:(0,a.jsx)("div",{style:{transform:`scale(${E})`,transformOrigin:"top center"},children:(0,a.jsx)(Y,{ref:N,device:G})})})]}),(0,a.jsxs)("div",{className:"right",style:eT,children:[(0,a.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,a.jsx)(eE,{agentList:c,onEffect:eB,style:{display:"ai"===eL&&(null==A?void 0:A.ai)?void 0:"none"}}),"props"===eL&&(0,a.jsx)(e6,{datasourceEnable:h}),"cascade"===eL&&(null==ex?void 0:ex.cascadeIds)&&(0,a.jsx)(eP,{}),"events"===eL&&(null==e$?void 0:e$.events)&&(0,a.jsx)(li,{})]}),(0,a.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,a.jsxs)(en.A.Group,{value:eL,onChange:e=>eo(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==A?void 0:A.ai)&&(0,a.jsx)(T.A,{title:"智能助理",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"ai",children:(0,a.jsx)(C,{type:"icon-assistant"})})}),(0,a.jsx)(T.A,{title:"属性",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"props",children:(0,a.jsx)(C,{type:"icon-info"})})}),(null==ex?void 0:ex.cascadeIds)&&(0,a.jsx)(T.A,{title:"联动",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"cascade",children:(0,a.jsx)(C,{type:"icon-cascade"})})}),(null==e$?void 0:e$.events)&&(0,a.jsx)(T.A,{title:"事件",placement:"right",children:(0,a.jsx)(en.A.Button,{value:"events",children:(0,a.jsx)(C,{type:"icon-thunderbolt"})})})]})})]})]})]}),(0,a.jsx)(lu,{open:ev,onOk:e=>{eb(!1),eg(e)},onCancel:()=>eb(!1)}),(0,a.jsx)(d.A,{open:ey,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>eA(!1),children:(0,a.jsx)(eE,{agentList:c,headExtra:(0,a.jsx)(m.Ay,{type:"link",icon:(0,a.jsx)(o.A,{}),onClick:()=>eA(!1)}),onEffect:eB})}),(0,a.jsx)(S.A,{open:ek,title:(0,a.jsx)(x.A,{placeholder:"搜索页面元素 ...",variant:"borderless",prefix:(0,a.jsx)(X.A,{style:{color:"var(--ant-color-text-label)"}}),value:eC,onChange:e=>ew(e.target.value)}),closeIcon:(0,a.jsx)(z.A.Link,{unselectable:"on",style:{color:"var(--ant-color-text-quaternary)"},children:"ESC"}),footer:null,onCancel:()=>ez(!1),styles:{container:{padding:0},header:{padding:"16px 12px",borderBottom:"solid 1px var(--ant-color-border)"},body:{padding:"0 12px 12px 12px",overflow:"auto",maxHeight:500}},children:(0,a.jsx)(lc,{children:0===eD.length?(0,a.jsx)(ei.A,{image:ei.A.PRESENTED_IMAGE_SIMPLE,description:(null==eC||null==(t=eC.trim())?void 0:t.length)?"未找到页面元素":"请输入关键字进行搜索..."}):eD.map(e=>(0,a.jsxs)("li",{onClick:()=>{var l;em(e),null==(l=document.getElementById(`page-item-${e.id}`))||l.scrollIntoView({behavior:"smooth"}),ez(!1)},children:[(0,a.jsxs)(z.A.Title,{level:5,style:{margin:0},children:[(0,a.jsx)(es.A,{variant:"filled",color:"#108ee9",style:{marginRight:8},children:"页面元素"}),e.name,(0,a.jsx)("small",{children:e.id})]}),(0,a.jsx)(z.A.Paragraph,{children:e.description||"无描述内容"})]},e.id))})})]})});var lx=t(3535),lm=t(6398),lh=t(6488),lg=t(8866),lf=t(618),lj=t(7047),lv=t(7051),lb=t(345),ly=t(2347),lA=t(6223);let lC=(0,f.Ay)(lg.A)`
1135
+ vertical-align: middle;
1136
+ margin-left: 2px;
1137
+ color: var(--ant-color-text-description);
1138
+ `,lw=(0,f.Ay)(lg.A)`
1139
+ vertical-align: middle;
1140
+ margin-left: 2px;
1141
+ color: var(--ant-color-text-description);
1142
+ `,lk=(0,f.Ay)(lg.A)`
1143
+ vertical-align: middle;
1144
+ margin-left: 2px;
1145
+ color: var(--ant-color-text-description);
1146
+ `;var lz=t(1520);let lS=f.Ay.div`
1147
+ width: 100%;
1148
+ padding: 0 12px;
1149
+ border-bottom: solid 1px #e8e8e8;
1150
+ background: #ffffff;
1151
+ height: 40px;
1152
+ display: flex;
1153
+ align-items: center;
1154
+ justify-content: space-between;
1155
+ .title {
1156
+ display: flex;
1157
+ flex-direction: column;
1158
+ }
1159
+ .title .main {
1160
+ font-size: 14px;
1161
+ }
1162
+ .title .sub {
1163
+ color: #999;
1164
+ font-size: 12px;
1165
+ }
1166
+ `,lI=e=>{let{item:l,signal:t,query:a}=e,{fetch:i,getVars:s,setItemData:r}=(0,n.useContext)(v),[o,d]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!(null==l?void 0:l.datasource))return void d(null);switch((null==l?void 0:l.datasource.source)||"custom"){case"custom":try{var e;let t=JSON.parse((null==l||null==(e=l.datasource)?void 0:e.custom)||"[]");d(t),null==r||r(l.id||"",t)}catch(e){d(null),null==r||r(l.id||"",null)}break;case"dataset":if(!(null==l?void 0:l.datasource.dataset)||!(null==i?void 0:i.dataset)){console.warn("dataset source detected but config or fetcher is missing",{datasetConfig:null==l?void 0:l.datasource.dataset,hasFetchDataset:!!(null==i?void 0:i.dataset)}),d(null),null==r||r(l.id||"",null);return}let t=s(l.id||"");i.dataset(null==l?void 0:l.datasource.dataset.id,{...t,...a}).then(e=>{d(e||null),null==r||r(l.id||"",e||null)}).catch(e=>{console.error("dataset fetch error",e),d(null),null==r||r(l.id||"",null)});break;default:d(null),null==r||r(l.id||"",null)}},[null==l?void 0:l.datasource,t,a]),o},lN=e=>{let l=(e.events||[]).reduce((e,l)=>(e[l.name]=l.script,e),{}),{callMethod:t,updateEnv:a}=(e=>{let{handleMethod:l,setGlobalEnv:t}=(0,n.useContext)(v);return{callMethod:(t,a,n)=>l(e,t,a,n),updateEnv:t}})(e);return{handleEvent:(n,i)=>{let s=l[n];if(s)try{return Function("console","Math","Date","Array","Object","String","Number","Boolean","callMethod","updateEnv","param",`
1167
+ "use strict";
1168
+ const window = undefined;
1169
+ const document = undefined;
1170
+ const global = undefined;
1171
+ const process = undefined;
1172
+ const require = undefined;
1173
+ const module = undefined;
1174
+ const exports = undefined;
1175
+ const cookie = undefined;
1176
+ const localStorage = undefined;
1177
+ const sessionStorage = undefined;
1178
+ ${s}
1179
+ `)(console,Math,Date,Array,Object,String,Number,Boolean,t,a,{item:e,sourceId:e.id,arg:i})}catch(e){return console.error("点击事件脚本执行失败:",e),null}}}};var lT=t(8101),lO=t(1181);let lE=f.Ay.div`
1180
+ box-sizing: border-box;
1181
+ margin: 0;
1182
+ padding: 0;
1183
+ color: rgba(0, 0, 0, 0.85);
1184
+ font-size: 14px;
1185
+ line-height: 1.5715;
1186
+ list-style: none;
1187
+ display: flex;
1188
+ flex-direction: column;
1189
+
1190
+ ${e=>e.$bordered&&(0,f.AH)`
1191
+ border: 1px solid #d9d9d9;
1192
+ border-radius: 2px;
1193
+ `}
1194
+
1195
+ ${e=>"vertical"===e.$itemLayout&&(0,f.AH)`
1196
+ flex-direction: column;
1197
+ `}
1198
+ `,lB=f.Ay.div`
1199
+ display: flex;
1200
+ align-items: center;
1201
+ justify-content: space-between;
1202
+ padding: ${e=>e.$padding||"12px 0"};
1203
+ color: rgba(0, 0, 0, 0.85);
1204
+
1205
+ ${e=>e.$split&&(0,f.AH)`
1206
+ border-bottom: 1px solid #f0f0f0;
1207
+ &:last-child {
1208
+ border-bottom: none;
1209
+ }
1210
+ `}
1211
+ `,lL=f.Ay.div`
1212
+ display: flex;
1213
+ flex: 1;
1214
+ align-items: flex-start;
1215
+ max-width: 100%;
1216
+ `,l$=f.Ay.div`
1217
+ margin-right: 16px;
1218
+ `,lD=f.Ay.div`
1219
+ flex: 1 0;
1220
+ width: 0;
1221
+ color: rgba(0, 0, 0, 0.85);
1222
+ `,lM=f.Ay.h4`
1223
+ margin-bottom: 4px;
1224
+ color: rgba(0, 0, 0, 0.85);
1225
+ font-size: 14px;
1226
+ line-height: 1.5715;
1227
+ margin-top: 0;
1228
+
1229
+ > a {
1230
+ color: rgba(0, 0, 0, 0.85);
1231
+ transition: all 0.3s;
1232
+ text-decoration: none;
1233
+ cursor: pointer;
1234
+ &:hover {
1235
+ color: #1890ff;
1236
+ }
1237
+ }
1238
+ `,lR=f.Ay.div`
1239
+ color: rgba(0, 0, 0, 0.45);
1240
+ font-size: 14px;
1241
+ line-height: 1.5715;
1242
+ `;f.Ay.div`
1243
+ margin-top: 16px;
1244
+ text-align: right;
1245
+ padding: ${e=>e.$bordered?"0 24px 24px":"0"};
1246
+ `;let lF=e=>{let{item:l,split:t,padding:n}=e;return(0,a.jsx)(lB,{$split:t,$padding:n,children:(0,a.jsxs)(lL,{children:[l.avatar&&(0,a.jsx)(l$,{children:(0,a.jsx)(lT.A,{src:l.avatar})}),(0,a.jsxs)(lD,{children:[l.title&&(0,a.jsx)(lM,{children:l.href?(0,a.jsx)("a",{href:l.href,children:l.title}):l.title}),l.description&&(0,a.jsx)(lR,{children:l.description})]})]})})},lP=e=>{let{list:l=[],split:t,bordered:i,size:s,itemLayout:r,style:o,className:d}=e,c=(0,n.useMemo)(()=>"small"===s?"8px 16px":i?"12px 24px":"12px 0",[s,i]);return(0,a.jsx)(lE,{$bordered:i,$split:t,$size:s,style:o,$itemLayout:r,className:d,children:l.map((e,l)=>(0,a.jsx)(lF,{item:e,split:t,padding:c},String(l)))})};var lG=t(507);t(3984),t(4969);var lH=t(264);lG.registerMap("china",lH);var l_=t(518),lY=t(5622),lJ=t(6679),lq=t(4353),lK=t.n(lq);let lW=f.Ay.div`
1247
+ text-align: center;
1248
+ color: #a7a7a7;
1249
+ background: #f5f5f5;
1250
+ border: dotted 1px #ccc;
1251
+ user-select: none;
1252
+ cursor: pointer;
1253
+ font-size: 12px;
1254
+ `,lV=f.Ay.div`
1255
+ text-align: center;
1256
+ color: #a7a7a7;
1257
+ background: #f5f5f5;
1258
+ border: dotted 1px #ccc;
1259
+ user-select: none;
1260
+ cursor: pointer;
1261
+ font-size: 12px;
1262
+ `;var lU=t(8997);let lX=[{group:"基础组件",key:"b-text",label:"文本",icon:"icon-text",component:e=>{let{id:l,text:t,tag:i="span",item:s,style:r={},customStyle:o={},className:d,classNames:c=[]}=e,{handleEvent:u}=lN(s),p=(0,n.useMemo)(()=>({...(null==s?void 0:s.style)||{},...o||{},...r||{}}),[s,o,r]);return(0,a.jsx)(i||"span",{id:l,style:p,className:(c||[]).join(" ")+" "+d,onClick:()=>{u("click")},children:t})},formComponent:e=>{var l,t,n,i,s,r;let{model:o,onChange:d}=e,c=(e,l)=>d&&d({...o,[e]:l}),u=(e,l)=>{let t={...o.customStyle||{},[e]:l};d&&d({...o,customStyle:t})};return(0,a.jsxs)(p.A,{layout:"vertical",children:[(0,a.jsx)(p.A.Item,{label:"文本内容",children:(0,a.jsx)(x.A.TextArea,{size:"small",value:o.text,onChange:e=>c("text",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"HTML标签",children:(0,a.jsx)(e4.A,{size:"small",value:o.tag,onChange:e=>c("tag",e),options:[{value:"span",label:"span"},{value:"a",label:"a"}]})}),(0,a.jsx)(p.A.Item,{label:"类名",children:(0,a.jsx)(e4.A,{size:"small",value:o.classNames,mode:"tags",onChange:e=>c("classNames",e)})}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,a.jsxs)(I.A.Compact,{children:[(0,a.jsxs)(e4.A,{size:"small",value:null==(l=o.customStyle)?void 0:l.fontFamily,style:{width:90},onChange:e=>u("fontFamily",e),children:[(0,a.jsx)(e4.A.Option,{value:"'黑体', 'SimHei', sans-serif",children:"黑体"}),(0,a.jsx)(e4.A.Option,{value:"'宋体', 'SimSun', serif",children:"宋体"}),(0,a.jsx)(e4.A.Option,{value:"'仿宋', 'FangSong', serif",children:"仿宋"}),(0,a.jsx)(e4.A.Option,{value:"'楷体', 'KaiTi', serif",children:"楷体"}),(0,a.jsx)(e4.A.Option,{value:"Arial, sans-serif",children:"Arial"})]}),(0,a.jsx)(e4.A,{size:"small",value:null==(t=o.customStyle)?void 0:t.fontSize,style:{width:90},onChange:e=>u("fontSize",e),children:["12px","14px","16px","20px","22px","24px","32px","48px"].map(e=>(0,a.jsx)(e4.A.Option,{value:e,children:e},e))}),(0,a.jsx)(lh.A,{size:"small",value:null==(n=o.customStyle)?void 0:n.color,onChange:e=>u("color",e.toHexString()),allowClear:!0})]}),(0,a.jsxs)(I.A.Compact,{children:[(0,a.jsx)(m.Ay,{type:(null==(i=o.customStyle)?void 0:i.fontWeight)==="bold"?"primary":void 0,size:"small",onClick:()=>{var e;return u("fontWeight",(null==(e=o.customStyle)?void 0:e.fontWeight)==="bold"?"normal":"bold")},children:"B"}),(0,a.jsx)(m.Ay,{type:(null==(s=o.customStyle)?void 0:s.fontStyle)==="italic"?"primary":void 0,size:"small",onClick:()=>{var e;return u("fontStyle",(null==(e=o.customStyle)?void 0:e.fontStyle)==="italic"?"normal":"italic")},children:"I"}),(0,a.jsx)(m.Ay,{type:(null==(r=o.customStyle)?void 0:r.textDecoration)==="underline"?"primary":void 0,size:"small",onClick:()=>{var e;return u("textDecoration",(null==(e=o.customStyle)?void 0:e.textDecoration)==="underline"?"none":"underline")},children:"U"})]})]})]})},defaultOptions:{style:{},props:{text:"文本内容",classNames:[],customStyle:{fontSize:14,color:"#444444",fontFamily:"'宋体', 'SimSun', serif",fontWeight:"normal",fontStyle:"normal",textDecoration:"none"}}},events:[{name:"点击",handler:"click"}]},{group:"基础组件",key:"b-image",label:"图片",icon:"icon-image",component:e=>{let{id:l,src:t,alt:n,width:i,height:s,href:r,className:o}=e,d=(0,a.jsx)("img",{id:l,src:t,alt:n,style:{width:i,height:s},className:o});return r&&r.length?(0,a.jsx)("a",{href:r,target:"_blank",rel:"noreferrer",children:d}):(0,a.jsx)("div",{children:d})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a}),i={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return(0,a.jsxs)(p.A,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:["图片URL",(0,a.jsx)(ej.A,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:i,action:"/api/datareport/upload",showUploadList:!1,beforeUpload:e=>{let l=e.type.startsWith("image/");return l||ef.Ay.error("上传封面只能是图片文件"),l},onChange:e=>{if("done"===e.file.status){var l;n("src",null==(l=e.file.response)?void 0:l.data),ef.Ay.success("上传成功")}else"error"===e.file.status&&ef.Ay.error("上传失败")},children:(0,a.jsx)(m.Ay,{size:"small",type:"link",icon:(0,a.jsx)(lf.A,{})})})]}),children:(0,a.jsx)(x.A,{size:"small",value:l.src,onChange:e=>n("src",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"图片替代文本",children:(0,a.jsx)(x.A,{size:"small",value:l.alt,onChange:e=>n("alt",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"图片链接",children:(0,a.jsx)(x.A,{size:"small",value:l.href,onChange:e=>n("href",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"图片宽度",children:(0,a.jsx)(x.A,{size:"small",value:l.width,onChange:e=>n("width",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"图片高度",children:(0,a.jsx)(x.A,{size:"small",value:l.height,onChange:e=>n("height",e.target.value)})})]})},defaultOptions:{props:{src:"https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png",alt:"",href:"",width:"100%",height:"auto"}}},{group:"基础组件",key:"b-button",label:"按钮",icon:"icon-button",component:e=>{let{id:l,text:t="按钮",type:i="middle",icon:s,size:r,block:o=!1,shape:d="default",ghost:c=!1,item:u,style:p,className:x}=e,{handleCallback:h}=(0,n.useContext)(v),{handleEvent:g}=lN(u),f="danger"===i,j="string"==typeof s?s?(0,a.jsx)(C,{type:s}):void 0:s;return(0,a.jsx)(m.Ay,{id:l,type:f?"default":i,icon:j,size:r,block:o,shape:["round","circle"].includes(d)?d:void 0,ghost:c,danger:f,onClick:()=>{h(u,!1,(e,l)=>{console.log("点击回调:",{target:e,data:l})}),g("click")},style:p,className:x,children:t})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,a.jsx)(p.A.Item,{label:"文本",children:(0,a.jsx)(x.A,{size:"small",value:l.text,onChange:e=>n("text",e.target.value),placeholder:"请输入按钮文本"})}),(0,a.jsx)(p.A.Item,{label:"图标",children:(0,a.jsx)(x.A,{size:"small",value:l.icon,onChange:e=>n("icon",e.target.value),placeholder:"请输入按钮图标(antdv 1.7.8)"})}),(0,a.jsx)(p.A.Item,{label:"类型",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.type,onChange:e=>n("type",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"default",children:"默认"}),(0,a.jsx)(en.A.Button,{value:"primary",children:"主要"}),(0,a.jsx)(en.A.Button,{value:"link",children:"链接"}),(0,a.jsx)(en.A.Button,{value:"dashed",children:"虚线"}),(0,a.jsx)(en.A.Button,{value:"text",children:"文本"})]})}),(0,a.jsx)(p.A.Item,{label:"大小",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.size,onChange:e=>n("size",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"small",children:"小"}),(0,a.jsx)(en.A.Button,{value:"middle",children:"中"}),(0,a.jsx)(en.A.Button,{value:"large",children:"大"})]})}),(0,a.jsx)(p.A.Item,{label:"形状",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.shape,onChange:e=>n("shape",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"default",children:"默认"}),(0,a.jsx)(en.A.Button,{value:"round",children:"圆角"}),(0,a.jsx)(en.A.Button,{value:"circle",children:"圆形"})]})}),(0,a.jsx)(p.A.Item,{label:"块级",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.block,onChange:e=>n("block",e)})}),(0,a.jsx)(p.A.Item,{label:"幽灵",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.ghost,onChange:e=>n("ghost",e)})})]})},defaultOptions:{props:{type:"primary",size:"default",shape:"default",block:!1,ghost:!1,text:"按钮文本",icon:""},cascadeIds:[],events:[]},events:[{name:"点击",handler:"click"}]},{group:"基础组件",key:"b-page-header",label:"页面标题",icon:"icon-page-header",component:e=>{let{id:l,title:t,subTitle:i,item:s,ancestors:r,style:o={},className:d}=e,c=(0,n.useMemo)(()=>!s.children||Array.isArray(s.children)||"object"!=typeof s.children?null:s.children.extra||[],[s]),[u,p]=(0,n.useState)(c||[]);return(0,n.useEffect)(()=>{p(c||[])},[c]),(0,a.jsxs)(lS,{id:l,style:{...o},className:d,children:[(0,a.jsxs)("div",{className:"title",children:[(0,a.jsx)("span",{className:"main",children:t}),i&&(0,a.jsx)("span",{className:"sub",children:i})]}),(0,a.jsx)("div",{children:(0,a.jsx)(H,{list:u,ancestors:[...r,s],onListChange:e=>{let l=[...e];s.children.extra=l,p(l)}})})]})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{layout:"vertical",children:[(0,a.jsx)(p.A.Item,{label:"标题",children:(0,a.jsx)(x.A,{size:"small",value:l.title,onChange:e=>n("title",e.target.value),placeholder:"请输入标题"})}),(0,a.jsx)(p.A.Item,{label:"副标题",children:(0,a.jsx)(x.A,{size:"small",value:l.subTitle,onChange:e=>n("subTitle",e.target.value),placeholder:"请输入副标题"})})]})},defaultOptions:{props:{title:"标题",subTitle:"副标题"},children:{extra:[]}}},{group:"基础组件",key:"b-table",label:"数据表格",icon:"icon-table",component:e=>{let{id:l,item:t,columns:i=[],dataKey:s="",pageSize:r=10,bordered:o=!0,size:d,showHeader:c=!0,showSizeChanger:u=!0,showQuickJumper:p=!0,hideOnSinglePage:x=!0,showTotal:m=!0,style:g={},className:f,headerCellClassNames:j=[],bodyCellClassNames:b=[],paginationRootClassNames:y=[],paginationItemClassNames:A=[]}=e,{initCallback:C,globalVars:w,env:k}=(0,n.useContext)(v),{handleEvent:z}=lN(t),[S,I]=(0,n.useState)({current:1,pageSize:r}),N=e=>Function("console","Math","Date","Array","Object","String","Number","Boolean","$g","$e","text","record","index",`
1263
+ "use strict";
1264
+ const window = undefined;
1265
+ const document = undefined;
1266
+ const global = undefined;
1267
+ const process = undefined;
1268
+ const require = undefined;
1269
+ const module = undefined;
1270
+ const exports = undefined;
1271
+ return ${e};
1272
+ `),T=lI({item:t,query:S}),O=i.map(e=>({...e,render:(l,t,n)=>{if(!e.customRender||"string"==typeof e.customRender&&""===e.customRender.trim()){var i;return(null==(i=e.dataIndex)?void 0:i.length)?(0,a.jsx)("div",{onClick:()=>z("columnClick",{column:e,rowData:t}),children:l}):(0,a.jsx)(a.Fragment,{})}let s=(e.customRender||"").replace(/{\s*{\s*([^}]+)\s*}\s*}/g,(e,a)=>{try{return N(a)(console,Math,Date,Array,Object,String,Number,Boolean,w,k.global,l,t,n)}catch{return""}});return(0,a.jsx)("div",{dangerouslySetInnerHTML:{__html:s},onClick:()=>z("columnClick",{column:e,rowData:t})})}})),E=(0,n.useMemo)(()=>{let e;if(s&&""!==s.trim())if(s.startsWith("$g."))try{e=N(s)(console,Math,Date,Array,Object,String,Number,Boolean,w,k.global,null,null,null)}catch{e=[]}else{let l=s.split("."),t=T||[];for(let e of l)if(t[e])t=t[e];else{t=[];break}e=t||[]}else e=T||[];return Array.isArray(e)?{total:e.length,records:e}:"object"==typeof e?e:{total:0,records:[]}},[s,T,w]),B=(0,n.useMemo)(()=>!!r&&{total:E.total,current:S.current,pageSize:S.pageSize,size:d,showSizeChanger:u,showQuickJumper:p,hideOnSinglePage:x,pageSizeOptions:["10","20","30","40"],showTotal:m?(e,l)=>`共 ${e} 条记录,显示第 ${l[0]}-${l[1]} 条`:void 0,locale:{items_per_page:"/ 页",jump_to:"跳转至第",page:"页"},onChange:(e,l)=>{I({current:e,pageSize:l}),z("onPageChange",{current:e,size:l})},onShowSizeChange:(e,l)=>{I({current:e,pageSize:l}),z("onPageChange",{current:e,size:l})}},[E,S,r,d,u,p,x,m]),L=()=>{console.log("callback table")};return(0,n.useEffect)(()=>{I({current:1,pageSize:r})},[r]),(0,n.useEffect)(()=>{C({id:t.id,callback:L})},[]),(0,a.jsx)(h.A,{id:l,dataSource:E.records||[],columns:O,pagination:B,bordered:o,size:d,showHeader:"boolean"!=typeof c||c,rowKey:(e,l)=>String(l),style:{padding:1,...g},className:f,classNames:{header:{cell:(j||[]).join(" ")},body:{cell:(b||[]).join(" ")},pagination:{root:(y||[]).join(" "),item:(A||[]).join(" ")}}})},formComponent:e=>{let{model:l,onChange:t}=e,i=(e,a)=>t&&t({...l,[e]:a}),r=(e,t)=>{let a=[...l.columns||[]];a[e]={...a[e],...t},i("columns",a)},[o,d]=(0,n.useState)(!1),[c,u]=(0,n.useState)(null),f=null!=c&&l.columns[c]?l.columns[c]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1,customRender:"",className:""},j=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex",render:e=>"string"==typeof e?e:e.join(".")},{title:"操作",width:80,align:"center",render:(e,t,n)=>(0,a.jsxs)(I.A,{children:[(0,a.jsx)("a",{onClick:()=>{u(n),d(!0)},children:(0,a.jsx)(s.A,{})}),(0,a.jsx)("a",{onClick:()=>{let e;(e=[...l.columns||[]]).splice(n,1),i("columns",e)},children:(0,a.jsx)(k.A,{})})]})}];return(0,a.jsxs)("div",{children:[(0,a.jsxs)(p.A,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,a.jsx)(p.A.Item,{label:"数据键",tooltip:"数据键用于指定数据来源中的数据项,例如:'data.items'",children:(0,a.jsx)(x.A,{size:"small",value:l.dataKey,onChange:e=>i("dataKey",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"大小",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.size,onChange:e=>i("size",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"small",children:"小"}),(0,a.jsx)(en.A.Button,{value:"middle",children:"中"}),(0,a.jsx)(en.A.Button,{value:"large",children:"大"})]})}),(0,a.jsx)(p.A.Item,{label:"边框",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.bordered,onChange:e=>i("bordered",e)})}),(0,a.jsx)(p.A.Item,{label:"显示表头",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.showHeader,onChange:e=>i("showHeader",e)})}),(0,a.jsx)(p.A.Item,{label:"显示分页大小选择器",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.showSizeChanger,onChange:e=>i("showSizeChanger",e)})}),(0,a.jsx)(p.A.Item,{label:"显示快速跳转",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.showQuickJumper,onChange:e=>i("showQuickJumper",e)})}),(0,a.jsx)(p.A.Item,{label:"隐藏单页分页",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.hideOnSinglePage,onChange:e=>i("hideOnSinglePage",e)})}),(0,a.jsx)(p.A.Item,{label:"显示分页总数",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.showTotal,onChange:e=>i("showTotal",e)})}),(0,a.jsx)(p.A.Item,{label:"分页大小",children:(0,a.jsx)(lm.A,{size:"small",value:l.pageSize,onChange:e=>i("pageSize",e)})})]}),(0,a.jsx)(g.A,{children:"表格列设置"}),(0,a.jsx)(h.A,{size:"small",dataSource:l.columns,rowKey:(e,l)=>String(l),columns:j,pagination:!1,bordered:!0}),(0,a.jsx)(m.Ay,{size:"small",onClick:()=>{i("columns",[...l.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,a.jsx)(g.A,{style:{marginTop:10},children:"样式设置"}),(0,a.jsx)(p.A.Item,{label:"表头单元格类名",layout:"vertical",children:(0,a.jsx)(e4.A,{mode:"tags",size:"small",value:l.headerCellClassNames||[],onChange:e=>i("headerCellClassNames",e)})}),(0,a.jsx)(p.A.Item,{label:"表格单元格类名",layout:"vertical",children:(0,a.jsx)(e4.A,{mode:"tags",size:"small",value:l.bodyCellClassNames||[],onChange:e=>i("bodyCellClassNames",e)})}),(0,a.jsx)(p.A.Item,{label:"分页根类名",layout:"vertical",children:(0,a.jsx)(e4.A,{mode:"tags",size:"small",value:l.paginationRootClassNames||[],onChange:e=>i("paginationRootClassNames",e)})}),(0,a.jsx)(p.A.Item,{label:"分页项类名",layout:"vertical",children:(0,a.jsx)(e4.A,{mode:"tags",size:"small",value:l.paginationItemClassNames||[],onChange:e=>i("paginationItemClassNames",e)})}),(0,a.jsx)(g.A,{children:"组件事件"}),(0,a.jsx)(lA.A,{size:"small",layout:"vertical",column:1,colon:!1,items:[{key:"onPageChange",label:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(lj.A,{})," onPageChange:分页切换/分页大小变化"]}),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{children:"事件参数取值:"}),(0,a.jsxs)("div",{children:["const ","{sourceId, item, arg}"," = param;"]}),(0,a.jsxs)("div",{children:["const ","{current, size}"," = arg;"]})]})},{key:"columnClick",label:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(lj.A,{})," columnClick:点击单元格"]}),children:(0,a.jsxs)("div",{children:["事件参数取值:",(0,a.jsxs)("div",{children:["const ","{sourceId, item, arg}"," = param;"]}),(0,a.jsxs)("div",{children:["const ","{column, rowData}"," = arg;"]})]})}],styles:{label:{color:"var(--ant-color-text)",alignItems:"center"},content:{color:"var(--ant-color-text-label)"}}}),(0,a.jsx)(S.A,{title:"编辑列",open:o,footer:null,width:400,onCancel:()=>d(!1),children:(0,a.jsx)(p.A,{layout:"vertical",size:"small",children:(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,a.jsx)(p.A.Item,{label:"列名",style:{marginBottom:10},children:(0,a.jsx)(x.A,{value:f.title,onChange:e=>r(c,{title:e.target.value})})}),(0,a.jsx)(p.A.Item,{label:"数据索引",style:{marginBottom:10},children:(0,a.jsx)(e4.A,{mode:"tags",value:"string"==typeof f.dataIndex?[f.dataIndex]:f.dataIndex,onChange:e=>r(c,{dataIndex:e})})}),(0,a.jsx)(p.A.Item,{label:"宽度",style:{marginBottom:10},children:(0,a.jsx)(x.A,{value:f.width,onChange:e=>r(c,{width:e.target.value})})}),(0,a.jsx)(p.A.Item,{label:"对齐",style:{marginBottom:10},children:(0,a.jsxs)(en.A.Group,{value:f.align,onChange:e=>r(c,{align:e.target.value}),children:[(0,a.jsx)(en.A.Button,{value:"left",children:(0,a.jsx)(lv.A,{})}),(0,a.jsx)(en.A.Button,{value:"center",children:(0,a.jsx)(lb.A,{})}),(0,a.jsx)(en.A.Button,{value:"right",children:(0,a.jsx)(ly.A,{})})]})}),(0,a.jsx)(p.A.Item,{label:"省略",style:{marginBottom:10},children:(0,a.jsx)(lx.A,{checked:!!f.ellipsis,onChange:e=>r(c,{ellipsis:e})})}),(0,a.jsx)(p.A.Item,{label:"自定义渲染",tooltip:"支持自定义渲染,使用{{}}包裹表达式,例如:{{text}},{{record.变量名}},{{index}},{{$g.变量名}},{{$e.变量名}}",style:{gridColumn:"span 2 / span 2",marginBottom:10},children:(0,a.jsx)(x.A.TextArea,{value:f.customRender,onChange:e=>r(c,{customRender:e.target.value})})}),(0,a.jsx)(p.A.Item,{label:"类名",style:{gridColumn:"span 2 / span 2",marginBottom:10},children:(0,a.jsx)(x.A,{value:f.className,onChange:e=>r(c,{className:e.target.value})})})]})})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'[{"name":"苹果","count":12},{"name":"华为","count":803},{"name":"OPPO","count":654},{"name":"vivo","count":719}]'},props:{size:"default",bordered:!0,showHeader:!0,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,showTotal:!0,pageSize:10,columns:[{title:"品牌",dataIndex:"name"},{title:"日销量(件)",dataIndex:"count"}]}},events:[{name:"分页切换/分页大小变化",handler:"onPageChange"},{name:"点击单元格",handler:"columnClick"}]},{group:"基础组件",key:"b-list",label:"列表",icon:"icon-unordered-list",component:e=>{let{id:l,pageSize:t=10,bordered:i=!0,size:s="default",itemLayout:r="horizontal",item:o,split:d=!0,style:c={},className:u}=e,{initCallback:p}=(0,n.useContext)(v),[x,m]=(0,n.useState)(0),h=lI({item:o,signal:x}),g=(0,n.useMemo)(()=>h||[],[h]),f=(0,n.useMemo)(()=>!!t&&!(t<=g.length)&&{total:g.length,pageSize:t,size:"default"===s?void 0:s,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,pageSizeOptions:["10","20","30","40"],showTotal:(e,l)=>`共 ${e} 条记录,显示第 ${l[0]}-${l[1]} 条`},[t,g.length,s]),j=["p-list",r?`p-list--${r}`:void 0,s?`p-list--${s}`:void 0,d?"p-list--split":void 0,i?"p-list--bordered":void 0,u],b=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e&&m(e=>e+1),{target:o,data:h}};return(0,n.useEffect)(()=>{p({id:o.id,callback:b})},[]),(0,a.jsxs)("div",{id:l,style:{display:"flex",flexDirection:"column",...c},className:j.filter(Boolean).join(" "),children:[(0,a.jsx)(lP,{list:g,split:d,bordered:i,size:s,itemLayout:r}),f&&(0,a.jsx)(lO.A,{...f})]})},formComponent:e=>{let{model:l,onChange:t}=e,[i]=p.A.useForm();return(0,n.useEffect)(()=>{i.setFieldsValue({size:l.size||"default",itemLayout:l.itemLayout||"horizontal",bordered:l.bordered??!1,split:l.split??!0,pageSize:l.pageSize||10})},[l,i]),(0,a.jsxs)(p.A,{form:i,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==t||t({...l,...e})},children:[(0,a.jsx)(p.A.Item,{label:"大小",name:"size",children:(0,a.jsxs)(en.A.Group,{size:"small",buttonStyle:"solid",children:[(0,a.jsx)(en.A.Button,{value:"default",children:"默认"}),(0,a.jsx)(en.A.Button,{value:"small",children:"小"})]})}),(0,a.jsx)(p.A.Item,{label:"布局",name:"itemLayout",children:(0,a.jsxs)(en.A.Group,{size:"small",buttonStyle:"solid",children:[(0,a.jsx)(en.A.Button,{value:"horizontal",children:"水平"}),(0,a.jsx)(en.A.Button,{value:"vertical",children:"垂直"})]})}),(0,a.jsx)(p.A.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,a.jsx)(lx.A,{size:"small"})}),(0,a.jsx)(p.A.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,a.jsx)(lx.A,{size:"small"})}),(0,a.jsx)(p.A.Item,{label:"分页大小",name:"pageSize",children:(0,a.jsx)(lm.A,{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:l,template:t="",item:i,style:s,className:r,classNames:o=[]}=e,{initCallback:d,globalVars:c,env:u}=(0,n.useContext)(v),{handleEvent:p}=lN(i),[x,m]=(0,n.useState)(0),h=lI({item:i,signal:x}),g=(0,n.useMemo)(()=>Array.isArray(h)?[]:Object.keys(h||{}),[h]),f=(0,n.useMemo)(()=>g.map(e=>null==h?void 0:h[e]),[g,h]),j=(0,n.useMemo)(()=>(t||"").replace(/{\s*{\s*([^}]+)\s*}\s*}/g,(e,l)=>{try{return Function("$g","$e",...g,`
1273
+ "use strict";
1274
+ const window = undefined;
1275
+ const document = undefined;
1276
+ const global = undefined;
1277
+ const process = undefined;
1278
+ const require = undefined;
1279
+ const module = undefined;
1280
+ const exports = undefined;
1281
+ return ${l};
1282
+ `)(c,u.global,...f)}catch{return""}}),[t,f,c,u]),b=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e&&m(e=>e+1),{target:i,data:h}};return(0,n.useEffect)(()=>{d({id:i.id,callback:b})},[]),(0,a.jsx)("div",{id:l,style:s,className:(o||[]).join(" ")+" "+r,dangerouslySetInnerHTML:{__html:j},onClick:()=>{p("click")}})},formComponent:e=>{let{model:l,onChange:t}=e,i=(0,n.useRef)(null),s=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsx)("div",{children:(0,a.jsxs)(p.A,{layout:"vertical",children:[(0,a.jsx)(p.A.Item,{label:"类名",children:(0,a.jsx)(e4.A,{size:"small",value:l.classNames,mode:"tags",onChange:e=>s("classNames",e)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(I.A,{children:["模板",(0,a.jsx)(T.A,{title:(0,a.jsxs)(a.Fragment,{children:["模板语法参考",(0,a.jsxs)("ul",{style:{padding:0,listStyle:"none"},children:[(0,a.jsxs)("li",{children:["变量调用:",`{{变量名}}`]}),(0,a.jsxs)("li",{children:["环境变量:",`{{$e.变量名}}`]}),(0,a.jsxs)("li",{children:["全局变量:",`{{$g.变量名}}`]})]})]}),children:(0,a.jsx)(lg.A,{})})]}),(0,a.jsxs)("a",{onClick:()=>{var e,l;let t=null==(e=i.current)?void 0:e.editor;null==t||null==(l=t.getAction("editor.action.formatDocument"))||l.run()},children:[(0,a.jsx)(C,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,a.jsx)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:(0,a.jsx)(E.Ay,{onMount:e=>{i.current={editor:e}},height:"300px",defaultLanguage:"html",value:l.template,onChange:e=>s("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>"}},events:[{name:"点击",handler:"click"}]},{group:"基础组件",key:"b-echarts",label:"图表",icon:"icon-echarts",component:e=>{let{id:l,script:t="",item:i,height:s=400,style:r,className:o}=e,{initCallback:d,globalVars:c,env:u}=(0,n.useContext)(v),p=(0,n.useRef)(null),[x,m]=(0,n.useState)(null),[h,g]=(0,n.useState)(0),f=lI({item:i,signal:h}),{handleEvent:j}=lN(i),b=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return arguments.length>1&&arguments[1],e&&g(e=>e+1),{target:i,data:f}};return(0,n.useEffect)(()=>{let e=(e=>{try{return JSON.parse(e)}catch(l){try{return Function("echarts","console","Math","Date","Array","Object","String","Number","Boolean","$g","$e","data",`
1283
+ "use strict";
1284
+ const window = undefined;
1285
+ const document = undefined;
1286
+ const global = undefined;
1287
+ const process = undefined;
1288
+ const require = undefined;
1289
+ const module = undefined;
1290
+ const exports = undefined;
1291
+ ${e}
1292
+ `)(lG,console,Math,Date,Array,Object,String,Number,Boolean,c,u.global,f)}catch(e){return null}}})(t);if(x&&e){try{x.setOption(e)}catch(e){console.error("ECharts 设置配置失败:",e)}setTimeout(()=>x.resize(),50)}},[x,t,f,c,u]),(0,n.useEffect)(()=>{x&&(()=>{if(!x)return;let e=(i.events||[]).reduce((e,l)=>(e[l.name]=l.script,e),{});["click","dblclick","selectchanged"].forEach(l=>{var t;x.off(l),(null==(t=e[l])?void 0:t.length)&&x.on(l,e=>{j(l,e)})})})()},[x,i.events]),(0,n.useEffect)(()=>{if(!p.current)return;let e=lG.init(p.current);m(e);let l=()=>e.resize();return window.addEventListener("resize",l),d({id:i.id,callback:b}),()=>{window.removeEventListener("resize",l),e.dispose()}},[]),(0,a.jsx)("div",{id:l,style:{width:"100%",height:s,...r},className:o,children:(0,a.jsx)("div",{ref:p,style:{width:"100%",height:s,...r}})})},formComponent:e=>{let{model:l,onChange:t}=e,i=(0,n.useRef)(null);return(0,a.jsxs)(p.A,{children:[(0,a.jsx)(p.A.Item,{label:"高度",labelCol:{span:6},wrapperCol:{span:18},children:(0,a.jsx)(lm.A,{value:l.height,size:"small",min:10,max:1e3,suffix:"px",onChange:e=>t&&t({...l,height:e})})}),(0,a.jsx)(p.A.Item,{layout:"vertical",label:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(I.A,{children:["Echarts 渲染脚本"," ",(0,a.jsx)(T.A,{title:(0,a.jsxs)(a.Fragment,{children:["模板语法参考",(0,a.jsxs)("ul",{style:{padding:0,listStyle:"none"},children:[(0,a.jsxs)("li",{children:["变量调用:",`{{变量名}}`]}),(0,a.jsxs)("li",{children:["环境变量:",`{{$e.变量名}}`]}),(0,a.jsxs)("li",{children:["全局变量:",`{{$g.变量名}}`]}),(0,a.jsxs)("li",{children:["函数参数:","{{data}}"]})]})]}),children:(0,a.jsx)(lg.A,{})})]}),(0,a.jsxs)("a",{onClick:()=>{var e,l;let t=null==(e=i.current)?void 0:e.editor;null==t||null==(l=t.getAction("editor.action.formatDocument"))||l.run()},children:[(0,a.jsx)(C,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,a.jsxs)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:[(0,a.jsxs)("div",{style:{color:"#0000ff",fontSize:14,padding:"0 50px"},children:["function getOptions(data) ","{"," "]}),(0,a.jsx)(E.Ay,{onMount:e=>{i.current={editor:e}},height:"400px",defaultLanguage:"javascript",value:l.script,onChange:e=>{let a;return a=e||"",t&&t({...l,script:a||""})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}}),(0,a.jsx)("div",{style:{color:"#0000ff",fontSize:14,padding:"0 50px"},children:"}"})]})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'[{"name":"Mon","value":150},{"name":"Tue","value":230},{"name":"Wed","value":224},{"name":"Thu","value":218},{"name":"Fri","value":135},{"name":"Sat","value":147},{"name":"Sun","value":260}]'},props:{script:`
1293
+ return {
1294
+ xAxis: { type: 'category', data: data.map(i => i.name) },
1295
+ yAxis: { type: 'value' },
1296
+ series: [{ data: data.map(i => i.value), type: 'line' }]
1297
+ }
1298
+ `},events:[]},events:[{name:"点击",handler:"click"},{name:"双击点击",handler:"dblclick"},{name:"选中变化",handler:"selectchanged"}]},{group:"基础组件",key:"b-anchor",label:"锚点",icon:"icon-anchor",component:e=>{let{id:l,items:t=[],style:i,linePosition:s=0,lineColor:r="rgba(5, 5, 5, 0.06)",lineWidth:o=2,gap:d=30,offsetTop:c=100,itemClassNames:u=[],itemTitleClassNames:p=[],indicatorClassNames:x=[],className:m,classNames:h=[]}=e,{designable:g}=(0,n.useContext)(v),j=(0,n.useMemo)(()=>t.map((e,l)=>({...e,key:e.key||l,title:(0,a.jsx)("div",{dangerouslySetInnerHTML:{__html:e.title}}),href:`#page-item-${e.href}`})),[t]),b=(0,f.Ay)(lU.A)`
1299
+ .ant-anchor:before {
1300
+ inset-inline-start: ${s||0}px !important;
1301
+ border-inline-start-color: ${r||"rgba(5, 5, 5, 0.06)"} !important;
1302
+ border-inline-start-width: ${o||2}px !important;
1303
+ }
1304
+ .ant-anchor .ant-anchor-ink.ant-anchor-ink-visible {
1305
+ left: ${s||0}px !important;
1306
+ width: ${o||2}px !important;
1307
+ }
1308
+ div.ant-anchor-link + div.ant-anchor-link {
1309
+ margin-top: ${d||30}px;
1310
+ }
1311
+ `;return(0,a.jsx)("div",{id:l,className:(h||[]).join(" ")+" "+m,children:(0,a.jsx)(b,{style:i,items:j,offsetTop:c,getContainer:()=>g?document.querySelector(".center > .body.beautified_scrollbar.always"):window,classNames:{item:(u||[]).join(" "),itemTitle:(p||[]).join(" "),indicator:(x||[]).join(" ")},styles:{item:{paddingTop:0,paddingBottom:0},itemTitle:{},indicator:{left:`${s||0}px !important`,width:`${o||2}px !important`}}})})},formComponent:e=>{var l;let{model:t,onChange:i}=e,{schema:r}=(0,n.useContext)(v),o=(e,l)=>i&&i({...t,[e]:l}),d=(e,l)=>{let a=[...t.items||[]];a[e]={...a[e],...l},o("items",a)},[c,u]=(0,n.useState)(!1),[f,j]=(0,n.useState)(null),b=null!=f&&(null==(l=t.items)?void 0:l[f])?t.items[f]:{title:"",href:"",key:""},y=[{title:"标题",dataIndex:"title",render:e=>(0,a.jsx)("div",{dangerouslySetInnerHTML:{__html:e}})},{title:"操作",width:80,align:"center",render:(e,l,n)=>(0,a.jsxs)(I.A,{children:[(0,a.jsx)("a",{onClick:()=>{j(n),u(!0)},children:(0,a.jsx)(s.A,{})}),(0,a.jsx)("a",{onClick:()=>{let e;(e=[...t.items||[]]).splice(n,1),o("items",e)},children:(0,a.jsx)(k.A,{})})]})}],A=(0,n.useMemo)(()=>{let e=[],l=t=>{Array.isArray(t)&&t.forEach(t=>{e.push(t),Array.isArray(t.children)?l(t.children):"object"==typeof t.children&&t.children&&Object.keys(t.children).forEach(e=>l(t.children[e]))})};return l((null==r?void 0:r.items)||[]),e},[r]);return(0,a.jsxs)("div",{children:[(0,a.jsxs)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,a.jsx)(p.A.Item,{label:"线位置(left)",children:(0,a.jsx)(lm.A,{size:"small",style:{width:"100px"},value:t.linePosition,suffix:"px",onChange:e=>o("linePosition",e)})}),(0,a.jsx)(p.A.Item,{label:"线颜色",children:(0,a.jsx)(lh.A,{size:"small",value:t.lineColor,onChange:e=>o("lineColor",e.toHexString()),allowClear:!0})}),(0,a.jsx)(p.A.Item,{label:"线宽度",children:(0,a.jsx)(lm.A,{size:"small",style:{width:"100px"},value:t.lineWidth,suffix:"px",onChange:e=>o("lineWidth",e)})}),(0,a.jsx)(p.A.Item,{label:"间距",children:(0,a.jsx)(lm.A,{size:"small",style:{width:"100px"},value:t.gap,suffix:"px",onChange:e=>o("gap",e)})}),(0,a.jsx)(p.A.Item,{label:"顶部偏移量",children:(0,a.jsx)(lm.A,{size:"small",style:{width:"100px"},value:t.offsetTop,suffix:"px",onChange:e=>o("offsetTop",e)})}),(0,a.jsx)(g.A,{style:{marginTop:10},children:"样式设置"}),(0,a.jsx)(p.A.Item,{label:"根类名",layout:"vertical",labelCol:{span:24},wrapperCol:{span:24},children:(0,a.jsx)(e4.A,{size:"small",value:t.classNames,mode:"tags",onChange:e=>o("classNames",e)})}),(0,a.jsx)(p.A.Item,{label:"链接项类名",layout:"vertical",labelCol:{span:24},wrapperCol:{span:24},children:(0,a.jsx)(e4.A,{mode:"tags",size:"small",value:t.itemClassNames||[],onChange:e=>o("itemClassNames",e)})}),(0,a.jsx)(p.A.Item,{label:"标题文字类名",layout:"vertical",labelCol:{span:24},wrapperCol:{span:24},children:(0,a.jsx)(e4.A,{mode:"tags",size:"small",value:t.itemTitleClassNames||[],onChange:e=>o("itemTitleClassNames",e)})}),(0,a.jsx)(p.A.Item,{label:"指示器类名",layout:"vertical",labelCol:{span:24},wrapperCol:{span:24},children:(0,a.jsx)(e4.A,{mode:"tags",size:"small",value:t.indicatorClassNames||[],onChange:e=>o("indicatorClassNames",e)})})]}),(0,a.jsx)(g.A,{children:"锚点项设置"}),(0,a.jsx)(h.A,{size:"small",dataSource:t.items,rowKey:(e,l)=>String(l),columns:y,pagination:!1,bordered:!0}),(0,a.jsx)(m.Ay,{size:"small",onClick:()=>{o("items",[...t.items||[],{title:"",href:"",key:""}])},block:!0,children:"添加列"}),(0,a.jsx)(S.A,{title:"编辑列",open:c,footer:null,width:400,onCancel:()=>u(!1),children:(0,a.jsxs)(p.A,{layout:"vertical",size:"small",children:[(0,a.jsx)(p.A.Item,{label:"锚点内容",tooltip:"支持HTML标签",style:{marginBottom:10},children:(0,a.jsx)(x.A.TextArea,{value:b.title,onChange:e=>d(f,{title:e.target.value})})}),(0,a.jsx)(p.A.Item,{label:"锚点链接",style:{marginBottom:10},children:(0,a.jsx)(lz.A,{value:b.href,onChange:e=>d(f,{href:e}),options:A.map(e=>({value:e.id,label:e.name}))})})]})})]})},defaultOptions:{props:{items:[{href:"#item1",title:"<i class='icon-dict'></i>项目1"},{href:"#item2",title:"<i class='icon-dict'></i>项目2"},{href:"#item3",title:"<i class='icon-dict'></i>项目3"}],linePosition:10,lineColor:"rgba(5, 5, 5, 0.06)",lineWidth:2,gap:30,itemClassNames:[],itemTitleClassNames:[],indicatorClassNames:[]}}},{group:"表单组件",key:"b-input",label:"输入框",icon:"icon-form-input",component:e=>{let{id:l,var:t="",placeholder:i="",prefix:s,suffix:r,size:o,allowClear:d=!1,search:c=!1,item:u,value:p,onChange:m,onSearch:h,style:g={},className:f}=e,{handleCallback:j,setVar:b}=(0,n.useContext)(v),y=e=>{m&&m(e),u&&t&&b(u,t,e)};return c?(0,a.jsx)(x.A.Search,{id:l,value:p,size:o,allowClear:d,placeholder:i,onChange:e=>y(e.target.value),onSearch:()=>{h&&h(p||""),j(u)},style:{...g},className:f}):(0,a.jsx)(x.A,{id:l,value:p,size:o,allowClear:d,placeholder:i,prefix:"string"==typeof s?void 0:s,suffix:"string"==typeof r?void 0:r,onChange:e=>y(e.target.value),style:{...g},className:f})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,a.jsx)(p.A.Item,{label:"搜索框",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.search,onChange:e=>n("search",e)})}),(0,a.jsx)(p.A.Item,{label:"变量名",children:(0,a.jsx)(x.A,{size:"small",value:l.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,a.jsx)(p.A.Item,{label:"占位符",children:(0,a.jsx)(x.A,{size:"small",value:l.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),!l.search&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.A.Item,{label:"前缀",children:(0,a.jsx)(x.A,{size:"small",value:l.prefix,onChange:e=>n("prefix",e.target.value),placeholder:"请输入前缀"})}),(0,a.jsx)(p.A.Item,{label:"后缀",children:(0,a.jsx)(x.A,{size:"small",value:l.suffix,onChange:e=>n("suffix",e.target.value),placeholder:"请输入后缀"})})]}),(0,a.jsx)(p.A.Item,{label:"大小",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.size,onChange:e=>n("size",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"small",children:"小"}),(0,a.jsx)(en.A.Button,{value:"middle",children:"中"}),(0,a.jsx)(en.A.Button,{value:"large",children:"大"})]})}),(0,a.jsx)(p.A.Item,{label:"清除图标",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.allowClear,onChange:e=>n("allowClear",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,search:!1,prefix:"",suffix:"",placeholder:"请输入"},cascadeIds:[]}},{group:"表单组件",key:"b-input-number",label:"数字输入框",icon:"icon-form-input-number",component:e=>{let{id:l,var:t="",value:i,size:s,placeholder:r="请输入",min:o=0,max:d=Number.MAX_SAFE_INTEGER,step:c=1,precision:u=0,item:p,onChange:x,style:m={},className:h}=e,{handleCallback:g,setVar:f}=(0,n.useContext)(v);return(0,a.jsx)(lm.A,{id:l,value:i,placeholder:r,size:s,min:o,max:d,step:c,precision:u,onChange:e=>{var l;return l=e??void 0,void(x&&x(l),p&&t&&f(p,t,l),g(p))},style:{width:"100%",...m},className:h})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,a.jsx)(p.A.Item,{label:"变量名",children:(0,a.jsx)(x.A,{size:"small",value:l.var,onChange:e=>n("var",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"最小值",children:(0,a.jsx)(lm.A,{size:"small",value:l.min,onChange:e=>n("min",e)})}),(0,a.jsx)(p.A.Item,{label:"最大值",children:(0,a.jsx)(lm.A,{size:"small",value:l.max,onChange:e=>n("max",e)})}),(0,a.jsx)(p.A.Item,{label:"步长",children:(0,a.jsx)(lm.A,{size:"small",value:l.step,onChange:e=>n("step",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,prefix:"",suffix:"",placeholder:"请输入",step:1,min:0,max:100,precision:0},cascadeIds:[]}},{group:"表单组件",key:"b-select",label:"选择框",icon:"icon-form-select",component:e=>{let{id:l,var:t="",size:i,placeholder:s="请选择",allowClear:r=!1,multiple:o=!1,options:d=[],item:c,value:u,onChange:p,style:x={},className:m}=e,{handleCallback:h,setVar:g}=(0,n.useContext)(v);return(0,a.jsx)(e4.A,{id:l,value:u,size:i,placeholder:s,allowClear:r,mode:o?"multiple":void 0,options:d,onChange:e=>{p&&p(e),c&&t&&g(c,t,e),h(c)},style:{width:"100%",...x},className:m})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a}),i=(e,t,a)=>{let i=[...l.options||[]];i[e]={...i[e],[t]:a},n("options",i)},s=[{title:"选项标签",dataIndex:"label",render:(e,l,t)=>(0,a.jsx)(x.A,{size:"small",value:l.label,onChange:e=>i(t,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,l,t)=>(0,a.jsx)(x.A,{size:"small",value:l.value,onChange:e=>i(t,"value",e.target.value)})},{title:"操作",render:(e,t,i)=>(0,a.jsx)(I.A,{children:(0,a.jsx)(m.Ay,{danger:!0,size:"small",onClick:()=>{let e;(e=[...l.options||[]]).splice(i,1),n("options",e)},children:(0,a.jsx)(k.A,{})})})}];return(0,a.jsxs)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,a.jsx)(p.A.Item,{label:"变量名",children:(0,a.jsx)(x.A,{size:"small",value:l.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,a.jsx)(p.A.Item,{label:"占位符",children:(0,a.jsx)(x.A,{size:"small",value:l.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),(0,a.jsx)(p.A.Item,{label:"大小",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.size,onChange:e=>n("size",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"small",children:"小"}),(0,a.jsx)(en.A.Button,{value:"middle",children:"中"}),(0,a.jsx)(en.A.Button,{value:"large",children:"大"})]})}),(0,a.jsx)(p.A.Item,{label:"清除图标",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.allowClear,onChange:e=>n("allowClear",e)})}),(0,a.jsx)(p.A.Item,{label:"多选",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.multiple,onChange:e=>n("multiple",e)})}),(0,a.jsxs)(p.A.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,a.jsx)(h.A,{size:"small",dataSource:l.options,columns:s,pagination:!1,rowKey:(e,l)=>String(l),bordered:!0}),(0,a.jsx)(m.Ay,{size:"small",block:!0,onClick:()=>{n("options",[...l.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-capsule",label:"胶囊选择器",icon:"icon-form-capsule",component:e=>{let{id:l,var:t="",size:i="middle",options:s=[],item:r,onChange:o,style:d,className:c}=e,{handleCallback:u,setVar:p}=(0,n.useContext)(v);return(0,a.jsx)("span",{id:l,children:(0,a.jsx)(en.A.Group,{id:l,size:i,buttonStyle:"solid",onChange:e=>{var l;return l=e.target.value,void(o&&o(l),r&&t&&p(r,t,l),u(r))},style:d,className:c,children:s.map(e=>(0,a.jsx)(en.A.Button,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a}),i=(e,t,a)=>{let i=[...l.options||[]];i[e]={...i[e],[t]:a},n("options",i)},s=[{title:"选项标签",dataIndex:"label",render:(e,l,t)=>(0,a.jsx)(x.A,{size:"small",value:l.label,onChange:e=>i(t,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,l,t)=>(0,a.jsx)(x.A,{size:"small",value:l.value,onChange:e=>i(t,"value",e.target.value)})},{title:"操作",render:(e,t,i)=>(0,a.jsx)(I.A,{children:(0,a.jsx)(m.Ay,{danger:!0,size:"small",onClick:()=>{let e;(e=[...l.options||[]]).splice(i,1),n("options",e)},children:(0,a.jsx)(k.A,{})})})}];return(0,a.jsxs)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,a.jsx)(p.A.Item,{label:"变量名",children:(0,a.jsx)(x.A,{size:"small",value:l.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,a.jsx)(p.A.Item,{label:"大小",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.size,onChange:e=>n("size",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"small",children:"小"}),(0,a.jsx)(en.A.Button,{value:"middle",children:"中"}),(0,a.jsx)(en.A.Button,{value:"large",children:"大"})]})}),(0,a.jsxs)(p.A.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,a.jsx)(h.A,{size:"small",dataSource:l.options,columns:s,pagination:!1,rowKey:(e,l)=>String(l),bordered:!0}),(0,a.jsx)(m.Ay,{size:"small",block:!0,onClick:()=>{n("options",[...l.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-checkbox",label:"复选框",icon:"icon-form-checkbox",component:e=>{let{id:l,var:t="",layout:i="horizontal",lineNumber:s=3,options:r=[],item:o,onChange:d,style:c,className:u}=e,{handleCallback:p,setVar:x}=(0,n.useContext)(v),m={...c,display:"grid"===i?"grid":"flex",gap:"grid"===i?void 0:"8px",flexDirection:"vertical"===i?"column":"row",gridTemplateColumns:"grid"===i?`repeat(${s}, 1fr)`:void 0};return(0,a.jsx)("span",{id:l,children:(0,a.jsx)(l_.A.Group,{onChange:e=>{d&&d(e),o&&t&&x(o,t,e),p(o)},style:m,className:u,children:r.map(e=>(0,a.jsx)(l_.A,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a}),i=(e,t,a)=>{let i=[...l.options||[]];i[e]={...i[e],[t]:a},n("options",i)},s=[{title:"选项标签",dataIndex:"label",render:(e,l,t)=>(0,a.jsx)(x.A,{size:"small",value:l.label,onChange:e=>i(t,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,l,t)=>(0,a.jsx)(x.A,{size:"small",value:l.value,onChange:e=>i(t,"value",e.target.value)})},{title:"操作",render:(e,t,i)=>(0,a.jsx)(I.A,{children:(0,a.jsx)(m.Ay,{danger:!0,size:"small",onClick:()=>{let e;(e=[...l.options||[]]).splice(i,1),n("options",e)},children:(0,a.jsx)(k.A,{})})})}];return(0,a.jsxs)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,a.jsx)(p.A.Item,{label:"变量名",children:(0,a.jsx)(x.A,{size:"small",value:l.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,a.jsx)(p.A.Item,{label:"布局",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.layout,onChange:e=>n("layout",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"horizontal",children:"水平"}),(0,a.jsx)(en.A.Button,{value:"vertical",children:"垂直"}),(0,a.jsx)(en.A.Button,{value:"grid",children:"网格"})]})}),"grid"===l.layout&&(0,a.jsx)(p.A.Item,{label:"网格行数",children:(0,a.jsx)(lm.A,{size:"small",value:l.lineNumber,onChange:e=>n("lineNumber",e),min:1,max:10})}),(0,a.jsxs)(p.A.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,a.jsx)(h.A,{size:"small",dataSource:l.options,columns:s,pagination:!1,rowKey:(e,l)=>String(l),bordered:!0}),(0,a.jsx)(m.Ay,{size:"small",block:!0,onClick:()=>{n("options",[...l.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",layout:"horizontal",lineNumber:3,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-date-picker",label:"日期选择器",icon:"icon-form-date-picker",component:e=>{let{id:l,var:t="",size:i,allowClear:s=!1,type:r="date",showTime:o=!1,value:d,item:c,onChange:u,style:p={},className:x}=e,{handleCallback:m,setVar:h}=(0,n.useContext)(v),g=e=>{u&&u(e),c&&t&&h(c,t,e),m(c)};if("time"===r){let e="string"==typeof d&&d?lK()(d,"HH:mm"):void 0;return(0,a.jsx)(lY.A,{id:l,value:e,format:"HH:mm",placeholder:"请选择时间",size:i,allowClear:s,onChange:e=>g(e?e.format("HH:mm"):void 0),style:{...(null==c?void 0:c.style)||{},...p},className:x})}if("month"===r||"year"===r){let e="month"===r?"YYYY-MM":"YYYY",t="string"==typeof d&&d?lK()(d,e):void 0;return(0,a.jsx)(lJ.A,{id:l,picker:r,value:t,format:e,placeholder:"month"===r?"请选择月份":"请选择年份",size:i,allowClear:s,onChange:l=>g(l?l.format(e):void 0),onPanelChange:l=>g(l?l.format(e):void 0),style:{...(null==c?void 0:c.style)||{},...p},className:x})}if("range"===r){let e=o?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",t=Array.isArray(d)&&d[0]?lK()(d[0],e):void 0,n=Array.isArray(d)&&d[1]?lK()(d[1],e):void 0;return(0,a.jsx)(lJ.A.RangePicker,{id:l,value:[t,n],format:e,placeholder:["开始日期","结束日期"],size:i,allowClear:s,showTime:o,onChange:l=>g(l&&l[0]&&l[1]?[l[0].format(e),l[1].format(e)]:void 0),style:{...(null==c?void 0:c.style)||{},...p},className:x})}let f=o?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",j="string"==typeof d&&d?lK()(d,f):void 0;return(0,a.jsx)(lJ.A,{id:l,value:j,format:f,placeholder:"请选择日期",size:i,allowClear:s,showTime:o,style:{...(null==c?void 0:c.style)||{},...p},className:x,onChange:e=>g(e?e.format(f):void 0)})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,a.jsx)(p.A.Item,{label:"变量名",children:(0,a.jsx)(x.A,{size:"small",value:l.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,a.jsx)(p.A.Item,{label:"类型",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.type,onChange:e=>n("type",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"date",children:"日期"}),(0,a.jsx)(en.A.Button,{value:"time",children:"时间"}),(0,a.jsx)(en.A.Button,{value:"month",children:"月份"}),(0,a.jsx)(en.A.Button,{value:"year",children:"年份"}),(0,a.jsx)(en.A.Button,{value:"range",children:"日期范围"})]})}),(0,a.jsx)(p.A.Item,{label:"大小",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.size,onChange:e=>n("size",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"small",children:"小"}),(0,a.jsx)(en.A.Button,{value:"middle",children:"中"}),(0,a.jsx)(en.A.Button,{value:"large",children:"大"})]})}),(0,a.jsx)(p.A.Item,{label:"清除图标",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.allowClear,onChange:e=>n("allowClear",e)})}),(0,a.jsx)(p.A.Item,{label:"显示时间",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.showTime,onChange:e=>n("showTime",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,showTime:!1,type:"date"},cascadeIds:[]}},{group:"表单组件",key:"b-switch",label:"开关",icon:"icon-form-switch",component:e=>{let{id:l,var:t="",checked:i,disabled:s,size:r="default",checkedChildren:o,unCheckedChildren:d,item:c,onChange:u,style:p={},className:x}=e,{handleCallback:m,setVar:h}=(0,n.useContext)(v);return(0,a.jsx)("span",{children:(0,a.jsx)(lx.A,{id:l,checked:i,disabled:s,size:"small"===r?"small":void 0,checkedChildren:o,unCheckedChildren:d,onChange:e=>{u&&u(e),c&&t&&h(c,t,e),m(c)},style:p,className:x})})},formComponent:e=>{let{model:l,onChange:t}=e;return(0,a.jsx)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:(0,a.jsx)(p.A.Item,{label:"变量名",children:(0,a.jsx)(x.A,{size:"small",value:l.var,onChange:e=>{let a;return a=e.target.value,t&&t({...l,var:a})},placeholder:"请输入变量名"})})})},defaultOptions:{props:{var:"",size:"default",checkedChildren:"开",unCheckedChildren:"关"},cascadeIds:[]}},{group:"容器组件",key:"b-space",label:"容器",icon:"icon-space",component:e=>{let{id:l,align:t="start",size:i="small",direction:s="horizontal",item:r,ancestors:o,style:d={},className:c}=e,[u,p]=(0,n.useState)(r.children||[]),x=(0,n.useMemo)(()=>({...d,...r.style||{},alignItems:t,flexDirection:s,gap:i}),[r,t,i,s]);return(0,n.useEffect)(()=>{p(r.children||[])},[r.children]),(0,a.jsx)(H,{rootComponent:I.A,rootData:{id:l,style:x,className:c},item:r,ancestors:[...o,r],list:u,onListChange:e=>{r.children=e,p(e)}})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,a.jsx)(p.A.Item,{label:"方向",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.direction,onChange:e=>n("direction",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"horizontal",children:"水平"}),(0,a.jsx)(en.A.Button,{value:"vertical",children:"垂直"})]})}),(0,a.jsx)(p.A.Item,{label:"大小",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.size,onChange:e=>n("size",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"small",children:"小"}),(0,a.jsx)(en.A.Button,{value:"middle",children:"中"}),(0,a.jsx)(en.A.Button,{value:"large",children:"大"})]})}),(0,a.jsx)(p.A.Item,{label:"对齐",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.align,onChange:e=>n("align",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"start",children:"开始"}),(0,a.jsx)(en.A.Button,{value:"end",children:"结束"}),(0,a.jsx)(en.A.Button,{value:"center",children:"居中"}),(0,a.jsx)(en.A.Button,{value:"baseline",children:"基线"})]})})]})},defaultOptions:{props:{align:"flex-start",direction:"row",size:"8px"},children:[]}},{group:"容器组件",key:"b-card",label:"卡片",icon:"icon-card",component:e=>{let{id:l,bordered:t=!1,size:i="default",title:s,hoverable:r=!1,shadow:o=!0,item:d,ancestors:c,style:u,className:p}=e,x=(0,n.useMemo)(()=>!d.children||Array.isArray(d.children)||"object"!=typeof d.children?null:d.children.title||[],[d]),[m,h]=(0,n.useState)(x||[]),g=(0,n.useMemo)(()=>!d.children||Array.isArray(d.children)||"object"!=typeof d.children?null:d.children.extra||[],[d]),[f,j]=(0,n.useState)(g||[]),v=(0,n.useMemo)(()=>d.children?Array.isArray(d.children)?d.children:"object"!=typeof d.children?null:d.children.body||[]:null,[d]),[b,y]=(0,n.useState)(v||[]),A=(0,n.useMemo)(()=>!d.children||Array.isArray(d.children)||"object"!=typeof d.children?null:d.children.actions||[],[d]),[C,w]=(0,n.useState)(A||[]);return(0,n.useEffect)(()=>{h(x||[])},[x]),(0,n.useEffect)(()=>{j(g||[])},[g]),(0,n.useEffect)(()=>{y(v||[])},[v]),(0,n.useEffect)(()=>{w(A||[])},[A]),(0,a.jsx)(ec.A,{id:l,variant:t?"outlined":"borderless",size:i,hoverable:r,className:[o?"ant-card-shadow":void 0,p].filter(Boolean).join(" "),title:(null==s?void 0:s.length)&&!(null==x?void 0:x.length)?s:x?(0,a.jsx)(H,{ancestors:[...c,d],list:m,onListChange:e=>{d.children.title=e,h(e)}}):s,extra:g&&(0,a.jsx)(H,{ancestors:[...c,d],list:f,onListChange:e=>{d.children.extra=e,j(e)}}),actions:A&&[(0,a.jsx)(H,{ancestors:[...c,d],list:C,onListChange:e=>{d.children.actions=e,w(e)}})],styles:{header:{borderBottom:"none"}},style:u,children:v&&(0,a.jsx)(H,{ancestors:[...c,d],list:b,onListChange:e=>{Array.isArray(d.children)?d.children=e:d.children.body=e,y(e)}})})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,a.jsx)(p.A.Item,{label:"标题",children:(0,a.jsx)(x.A,{size:"small",value:l.title,onChange:e=>n("title",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"边框",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.bordered,onChange:e=>n("bordered",e)})}),(0,a.jsx)(p.A.Item,{label:"悬停效果",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.hoverable,onChange:e=>n("hoverable",e)})}),(0,a.jsx)(p.A.Item,{label:"阴影",children:(0,a.jsx)(lx.A,{size:"small",checked:!!l.shadow,onChange:e=>n("shadow",e)})}),(0,a.jsx)(p.A.Item,{label:"大小",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.size,onChange:e=>n("size",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"default",children:"默认"}),(0,a.jsx)(en.A.Button,{value:"small",children:"小"})]})})]})},defaultOptions:{props:{title:"标题",bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:{title:[],extra:[],body:[],actions:[]}}},{group:"容器组件",key:"b-row",label:"栅格行",icon:"icon-grid-row",component:e=>{let{id:l,gutter:t,item:i,ancestors:s,style:r,className:o}=e,[d,u]=(0,n.useState)(i.children||[]);return(0,n.useEffect)(()=>{u(i.children||[])},[i.children]),(0,a.jsx)(H,{rootComponent:c.A,rootData:{id:l,gutter:t,style:i.style||r,className:i.className||o},item:i,ancestors:[...s,i],list:d,onListChange:e=>{i.children=e,u(e)}})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a}),i=l.gutter||[0,0];return(0,a.jsxs)(p.A,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,a.jsx)(p.A.Item,{label:"列间距",children:(0,a.jsx)(lm.A,{size:"small",value:i[0],min:0,step:4,onChange:e=>n("gutter",[e||0,i[1]])})}),(0,a.jsx)(p.A.Item,{label:"行间距",children:(0,a.jsx)(lm.A,{size:"small",value:i[1],min:0,step:4,onChange:e=>n("gutter",[i[0],e||0])})})]})},defaultOptions:{props:{gutter:[12,12]},children:[]}},{group:"容器组件",key:"b-col",label:"栅格列",icon:"icon-grid-columns",component:e=>{let{id:l,span:t=24,xs:i,sm:s,md:r,lg:o,xl:d,xxl:c,item:p,ancestors:x,style:m={},className:h}=e,{deviceWidth:g}=(0,n.useContext)(v),[f,j]=(0,n.useState)(p.children||[]),b=(0,n.useMemo)(()=>{let e=g||1600,l=null;return e<576&&i&&(l=i),e>=576&&s&&(l=s),e>=768&&r&&(l=r),e>=992&&o&&(l=o),e>=1200&&d&&(l=d),e>=1600&&c&&(l=c),l||t},[i,s,r,o,d,c,t,g]);return(0,n.useEffect)(()=>{j(p.children||[])},[p.children]),(0,a.jsx)(H,{rootComponent:u.A,rootData:{id:l||p.id,span:b,style:{...p.style||{},...m},className:h},item:p,ancestors:[...x,p],list:f,onListChange:e=>{p.children=e,j(e)}})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,a.jsx)(p.A.Item,{label:"默认列数",children:(0,a.jsx)(lm.A,{size:"small",value:l.span,min:0,max:24,step:4,onChange:e=>n("span",e||0)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["xs"," ",(0,a.jsx)(T.A,{title:"<576px 响应式栅格",children:(0,a.jsx)(lC,{})})]}),children:(0,a.jsx)(lm.A,{size:"small",value:l.xs,min:0,max:24,step:4,onChange:e=>n("xs",e||0)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["sm"," ",(0,a.jsx)(T.A,{title:"≥576px 响应式栅格",children:(0,a.jsx)(lC,{})})]}),children:(0,a.jsx)(lm.A,{size:"small",value:l.sm,min:0,max:24,step:4,onChange:e=>n("sm",e||0)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["md"," ",(0,a.jsx)(T.A,{title:"≥768px 响应式栅格",children:(0,a.jsx)(lC,{})})]}),children:(0,a.jsx)(lm.A,{size:"small",value:l.md,min:0,max:24,step:4,onChange:e=>n("md",e||0)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["lg"," ",(0,a.jsx)(T.A,{title:"≥992px 响应式栅格",children:(0,a.jsx)(lC,{})})]}),children:(0,a.jsx)(lm.A,{size:"small",value:l.lg,min:0,max:24,step:4,onChange:e=>n("lg",e||0)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["xl"," ",(0,a.jsx)(T.A,{title:"≥1200px 响应式栅格",children:(0,a.jsx)(lC,{})})]}),children:(0,a.jsx)(lm.A,{size:"small",value:l.xl,min:0,max:24,step:4,onChange:e=>n("xl",e||0)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["xxl"," ",(0,a.jsx)(T.A,{title:"≥1600px 响应式栅格",children:(0,a.jsx)(lC,{})})]}),children:(0,a.jsx)(lm.A,{size:"small",value:l.xxl,min:0,max:24,step:4,onChange:e=>n("xxl",e||0)})})]})},defaultOptions:{props:{xs:24,sm:12,md:12,lg:6,xl:6,xxl:6,span:8},children:[]}},{group:"容器组件",key:"b-modal",label:"弹窗",icon:"icon-modal",component:e=>{let{id:l,item:t,ancestors:i,style:s={},className:r,footer:o=!0,...d}=e,{designable:c,selectedItem:u,setSelectedItem:p,initCallback:x,initMethod:m}=(0,n.useContext)(v),[h,g]=(0,n.useState)(!1),[f,j]=(0,n.useState)(t.children||[]),{handleEvent:b}=lN(t),y=()=>{g(!0)};(0,n.useEffect)(()=>{j(t.children||[])},[t.children]),(0,n.useEffect)(()=>{setTimeout(()=>{(()=>{let e=document.getElementById("page-item-toolbar");if(!e)return;let l=document.getElementById(`page-item-${t.id}`);if(!l)return;let a=l.getBoundingClientRect();if(0===a.width&&0===a.height){e.style.display="none";return}e.style.display="flex";let n=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,i=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;e.style.top=`${a.top+n-22}px`,e.style.left=`${a.left+i-1}px`})()},0)},[h]),(0,n.useEffect)(()=>{x({id:t.id,callback:y}),m({id:t.id,method:{open:()=>g(!0),close:()=>g(!1)}})},[]);let A=[r,"drag-container","page-item-component",u===t?"selected":"",c?"designable":""].filter(Boolean).join(" ");return(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsxs)(lW,{id:h?void 0:l||t.id,onDoubleClick:()=>g(!0),className:A,children:["弹窗:",t.name,"(",t.id,")"]}),(0,a.jsx)(S.A,{...d,open:h,onCancel:()=>g(!1),afterOpenChange:e=>{b(e?"open":"close")},getContainer:()=>c?document.querySelector(".page-canvas"):document.body,style:{...t.style||{},...s,paddingBottom:0},className:r,modalRender:e=>(0,a.jsx)("div",{id:h?l||t.id:void 0,onClick:()=>p(t),children:e}),footer:o?void 0:null,children:(0,a.jsx)(H,{ancestors:[...i,t],list:f,onListChange:e=>{t.children=e,j(e)}})})]})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{labelCol:{span:8},wrapperCol:{span:16},children:[(0,a.jsx)(p.A.Item,{label:"标题",children:(0,a.jsx)(x.A,{size:"small",value:l.title,onChange:e=>n("title",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"宽度",children:(0,a.jsx)(lm.A,{size:"small",style:{width:"100px"},value:l.width,suffix:"px",onChange:e=>n("width",e)})}),(0,a.jsx)(p.A.Item,{label:"确认按钮文字",children:(0,a.jsx)(x.A,{size:"small",style:{width:"100px"},value:l.okText,onChange:e=>n("okText",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"取消按钮文字",children:(0,a.jsx)(x.A,{size:"small",style:{width:"100px"},value:l.cancelText,onChange:e=>n("cancelText",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"确认按钮类型",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.okType,onChange:e=>n("okType",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"default",children:"默认"}),(0,a.jsx)(en.A.Button,{value:"primary",children:"主要"}),(0,a.jsx)(en.A.Button,{value:"dashed",children:"虚线"})]})}),(0,a.jsx)(p.A.Item,{label:"关闭按钮",children:(0,a.jsx)(lx.A,{size:"small",checked:l.closable,onChange:e=>n("closable",e)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["ESC关闭"," ",(0,a.jsx)(T.A,{title:"是否支持键盘 esc 关闭",children:(0,a.jsx)(lw,{})})]}),children:(0,a.jsx)(lx.A,{size:"small",checked:l.keyboard,onChange:e=>n("keyboard",e)})}),(0,a.jsx)(p.A.Item,{label:"显示遮罩",children:(0,a.jsx)(lx.A,{size:"small",checked:l.mask,onChange:e=>n("mask",e)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["遮罩关闭"," ",(0,a.jsx)(T.A,{title:"点击遮罩层是否允许关闭",children:(0,a.jsx)(lw,{})})]}),children:(0,a.jsx)(lx.A,{size:"small",checked:l.maskClosable,onChange:e=>n("maskClosable",e)})}),(0,a.jsx)(g.A,{children:"组件方法"}),(0,a.jsx)(lA.A,{size:"small",column:1,items:[{key:"open",label:"open",children:"打开模态框"},{key:"close",label:"close",children:"关闭模态框"}]})]})},defaultOptions:{props:{title:"标题",width:400,okType:"primary",okText:"确定",cancelText:"取消",maskClosable:!0,mask:!0,closable:!0,keyboard:!0,footer:!1},children:[]},events:[{name:"打开",handler:"open"},{name:"关闭",handler:"close"}]},{group:"容器组件",key:"b-drawer",label:"抽屉",icon:"icon-drawer",component:e=>{let{id:l,item:t,ancestors:i,style:s={},className:r,footer:o=!0,okType:c="primary",okText:u="确定",cancelText:p="取消",resizable:x=!0,...h}=e,{designable:g,selectedItem:f,setSelectedItem:j,initCallback:b,initMethod:y}=(0,n.useContext)(v),[A,C]=(0,n.useState)(!1),[w,k]=(0,n.useState)(t.children||[]),[z,S]=(0,n.useState)(h.size||400),{handleEvent:N}=lN(t),T=()=>{C(!0)};(0,n.useEffect)(()=>{S(h.size||400)},[h.size]),(0,n.useEffect)(()=>{k(t.children||[])},[t.children]),(0,n.useEffect)(()=>{setTimeout(()=>{(()=>{let e=document.getElementById("page-item-toolbar");if(!e)return;let l=document.getElementById(`page-item-${t.id}`);if(!l)return;let a=l.getBoundingClientRect();if(0===a.width&&0===a.height){e.style.display="none";return}e.style.display="flex";let n=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,i=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;e.style.top=`${a.top+n-22}px`,e.style.left=`${a.left+i-1}px`})()},0)},[A]),(0,n.useEffect)(()=>{b({id:t.id,callback:T}),y({id:t.id,method:{open:()=>C(!0),close:()=>C(!1)}})},[]);let O=[r,"drag-container","page-item-component",f===t?"selected":"",g?"designable":""].filter(Boolean).join(" ");return(0,a.jsxs)(a.Fragment,{children:[g&&(0,a.jsxs)(lV,{id:A?void 0:l||t.id,onDoubleClick:()=>C(!0),className:O,children:["抽屉:",t.name,"(",t.id,")"]}),(0,a.jsx)(d.A,{...h,id:l||t.id,open:A,size:z,onClose:()=>C(!1),afterOpenChange:e=>{N(e?"open":"close")},getContainer:()=>g?document.querySelector(".page-canvas"):document.body,push:{distance:0},style:{...t.style||{},...s,paddingBottom:0},className:r,onClick:()=>j(t),footer:o?(0,a.jsxs)(I.A,{children:[(0,a.jsx)(m.Ay,{onClick:()=>C(!1),children:p}),(0,a.jsx)(m.Ay,{type:c,children:u})]}):null,resizable:{onResize:S},children:(0,a.jsx)(H,{ancestors:[...i,t],list:w,onListChange:e=>{t.children=e,k(e)}})})]})},formComponent:e=>{let{model:l,onChange:t}=e,n=(e,a)=>t&&t({...l,[e]:a});return(0,a.jsxs)(p.A,{labelCol:{span:8},wrapperCol:{span:16},children:[(0,a.jsx)(p.A.Item,{label:"标题",children:(0,a.jsx)(x.A,{size:"small",value:l.title,onChange:e=>n("title",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"宽度",children:(0,a.jsx)(lm.A,{size:"small",style:{width:"100px"},value:l.size,suffix:"px",onChange:e=>n("size",e)})}),(0,a.jsx)(p.A.Item,{label:"抽屉位置",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.placement,onChange:e=>n("placement",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"top",children:"顶部"}),(0,a.jsx)(en.A.Button,{value:"bottom",children:"底部"}),(0,a.jsx)(en.A.Button,{value:"left",children:"左侧"}),(0,a.jsx)(en.A.Button,{value:"right",children:"右侧"})]})}),(0,a.jsx)(p.A.Item,{label:"确认按钮文字",children:(0,a.jsx)(x.A,{size:"small",style:{width:"100px"},value:l.okText,onChange:e=>n("okText",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"取消按钮文字",children:(0,a.jsx)(x.A,{size:"small",style:{width:"100px"},value:l.cancelText,onChange:e=>n("cancelText",e.target.value)})}),(0,a.jsx)(p.A.Item,{label:"确认按钮类型",children:(0,a.jsxs)(en.A.Group,{size:"small",value:l.okType,onChange:e=>n("okType",e.target.value),children:[(0,a.jsx)(en.A.Button,{value:"default",children:"默认"}),(0,a.jsx)(en.A.Button,{value:"primary",children:"主要"}),(0,a.jsx)(en.A.Button,{value:"dashed",children:"虚线"})]})}),(0,a.jsx)(p.A.Item,{label:"关闭按钮",children:(0,a.jsx)(lx.A,{size:"small",checked:l.closable,onChange:e=>n("closable",e)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["ESC关闭"," ",(0,a.jsx)(T.A,{title:"是否支持键盘 esc 关闭",children:(0,a.jsx)(lk,{})})]}),children:(0,a.jsx)(lx.A,{size:"small",checked:l.keyboard,onChange:e=>n("keyboard",e)})}),(0,a.jsx)(p.A.Item,{label:"显示遮罩",children:(0,a.jsx)(lx.A,{size:"small",checked:l.mask,onChange:e=>n("mask",e)})}),(0,a.jsx)(p.A.Item,{label:(0,a.jsxs)(a.Fragment,{children:["遮罩关闭"," ",(0,a.jsx)(T.A,{title:"点击遮罩层是否允许关闭",children:(0,a.jsx)(lk,{})})]}),children:(0,a.jsx)(lx.A,{size:"small",checked:l.maskClosable,onChange:e=>n("maskClosable",e)})}),(0,a.jsx)(p.A.Item,{label:"可调整大小",children:(0,a.jsx)(lx.A,{size:"small",checked:l.resizable,onChange:e=>n("resizable",e)})}),(0,a.jsx)(g.A,{children:"组件方法"}),(0,a.jsx)(lA.A,{size:"small",column:1,items:[{key:"open",label:"open",children:"打开抽屉"},{key:"close",label:"close",children:"关闭抽屉"}]})]})},defaultOptions:{props:{title:"标题",size:400,placement:"right",okType:"primary",okText:"确定",cancelText:"取消",closable:!0,keyboard:!0,maskClosable:!0,mask:!0,resizable:!0,footer:!1},children:[]},events:[{name:"打开",handler:"open"},{name:"关闭",handler:"close"}]}],lQ=`<div>{{title}}</div>
1312
+ <div>{{displayValue}}</div>
1313
+ <div>
1314
+ {{desc || ""}}
1315
+ </div>`,lZ={info:{name:"人事基本情况总览",description:"实时监控和分析教师人事关键指标"},datasources:[],scripts:[],variables:[],items:[{type:"b-page-header",name:"页面标题",props:{title:"人事基本情况总览",subTitle:"实时监控和分析教师人事关键指标"},children:{extra:[]}},{type:"b-card",name:"容器组件",props:{bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:{title:[{type:"b-text",name:"文本",props:{text:"人事基本情况总览"},style:{fontSize:14,color:"#444444",fontFamily:"'宋体', 'SimSun', serif",fontWeight:"normal",fontStyle:"normal",textDecoration:"none"}}],extra:[],body:[{type:"b-list",name:"列表",datasource:{source:"custom",custom:'[{"title":"Confucius","avatar":"https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png","href":"https://www.antdv.com/","description":"The man who moves a mountain begins by carrying away small stones."},{"title":"Socrates","description":"I think, therefore I am."}]'},props:{size:"default",itemLayout:"horizontal",bordered:!0,split:!0,pageSize:10}}],actions:[]}},{type:"b-row",name:"栅格行",props:{gutter:[12,12]},children:[{type:"b-col",name:"栅格列",props:{xs:24,sm:12,md:12,lg:6,xl:6},children:[{type:"b-card",name:"容器组件",props:{bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:[{type:"b-html",name:"HTML",datasource:{source:"custom",custom:'{"title":"教职工总人数","value":1284,"displayValue":"1284","desc":""}'},props:{template:lQ}}]}]},{type:"b-col",name:"栅格列",props:{xs:24,sm:12,md:12,lg:6,xl:6},children:[{type:"b-card",name:"容器组件",props:{bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:[{type:"b-html",name:"HTML",datasource:{source:"custom",custom:'{"title":"男性","value":756,"displayValue":"756","desc":""}'},props:{template:lQ}}]}]},{type:"b-col",name:"栅格列",props:{xs:24,sm:12,md:12,lg:6,xl:6},children:[{type:"b-card",name:"容器组件",props:{bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:[{type:"b-html",name:"HTML",datasource:{source:"custom",custom:'{"title":"女性","value":528,"displayValue":"528","desc":""}'},props:{template:lQ}}]}]},{type:"b-col",name:"栅格列",props:{xs:24,sm:12,md:12,lg:6,xl:6},children:[{type:"b-card",name:"容器组件",props:{bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:[{type:"b-html",name:"HTML",datasource:{source:"custom",custom:'{"title":"当前在岗","value":1156,"displayValue":"1156","desc":""}'},props:{template:lQ}}]}]}]},{type:"b-row",name:"栅格行",props:{gutter:[12,12]},style:{marginLeft:0,marginRight:0},children:[{type:"b-col",name:"栅格列",props:{xs:24,sm:12,md:12,lg:6,xl:6},children:[{type:"b-card",name:"容器组件",props:{title:"单位人员分布",bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:[{type:"b-echarts",name:"图表",datasource:{source:"custom",custom:"[]"},props:{title:"单位人员分布",script:`
1316
+ return {
1317
+ tooltip: {
1318
+ trigger: "axis",
1319
+ axisPointer: { type: "shadow" },
1320
+ formatter: "{b}: {c} 人",
1321
+ },
1322
+ grid: { left: "3%", right: "4%", bottom: "3%", containLabel: true },
1323
+ xAxis: {
1324
+ type: "category",
1325
+ data: ["行政部门", "教学单位", "教辅单位", "后勤单位"],
1326
+ axisLabel: { fontSize: 12 },
1327
+ },
1328
+ yAxis: { type: "value", name: "人数", nameTextStyle: { fontSize: 12 } },
1329
+ series: [
1330
+ {
1331
+ data: [215, 856, 132, 81],
1332
+ type: "bar",
1333
+ itemStyle: {
1334
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
1335
+ { offset: 0, color: "#165DFF" },
1336
+ { offset: 1, color: "#0E42D2" },
1337
+ ]),
1338
+ },
1339
+ },
1340
+ ],
1341
+ }
1342
+ `}}]}]},{type:"b-col",name:"栅格列",props:{xs:24,sm:12,md:12,lg:6,xl:6},children:[{type:"b-card",name:"容器组件",props:{title:"性别比例",bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:[{type:"b-echarts",name:"图表",datasource:{source:"custom",custom:"[]"},props:{title:"性别比例",script:`
1343
+ return {
1344
+ tooltip: { trigger: "item", formatter: "{b}: {c} 人 ({d}%)" },
1345
+ legend: {
1346
+ orient: "vertical",
1347
+ left: "left",
1348
+ textStyle: { fontSize: 12 },
1349
+ },
1350
+ series: [
1351
+ {
1352
+ name: "性别比例",
1353
+ type: "pie",
1354
+ radius: ["40%", "70%"],
1355
+ avoidLabelOverlap: false,
1356
+ itemStyle: { borderRadius: 8, borderColor: "#fff", borderWidth: 2 },
1357
+ label: { show: false, position: "center" },
1358
+ emphasis: {
1359
+ label: { show: true, fontSize: 16, fontWeight: "bold" },
1360
+ },
1361
+ labelLine: { show: false },
1362
+ data: [
1363
+ { value: 756, name: "男性", itemStyle: { color: "#165DFF" } },
1364
+ { value: 528, name: "女性", itemStyle: { color: "#722ED1" } },
1365
+ ],
1366
+ },
1367
+ ],
1368
+ }
1369
+ `}}]}]}]},{type:"b-row",name:"栅格行",props:{gutter:[12,12]},style:{marginLeft:0,marginRight:0},children:[{type:"b-col",name:"栅格列",props:{xs:24,sm:12,md:12,lg:6,xl:6},children:[{type:"b-card",name:"容器组件",props:{title:"民族分布",bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:[{type:"b-echarts",name:"图表",datasource:{source:"custom",custom:"[]"},props:{title:"民族分布",script:`
1370
+ return {
1371
+ tooltip: {
1372
+ trigger: "axis",
1373
+ axisPointer: { type: "shadow" },
1374
+ formatter: "{b}: {c} 人",
1375
+ },
1376
+ grid: { left: "3%", right: "4%", bottom: "3%", containLabel: true },
1377
+ xAxis: {
1378
+ type: "category",
1379
+ data: ["汉族", "少数民族"],
1380
+ axisLabel: { fontSize: 12 },
1381
+ },
1382
+ yAxis: { type: "value", name: "人数", nameTextStyle: { fontSize: 12 } },
1383
+ series: [
1384
+ {
1385
+ data: [1204, 80],
1386
+ type: "bar",
1387
+ itemStyle: {
1388
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
1389
+ { offset: 0, color: "#165DFF" },
1390
+ { offset: 1, color: "#0FC6C2" },
1391
+ ]),
1392
+ },
1393
+ },
1394
+ ],
1395
+ }
1396
+ `}}]}]},{type:"b-col",name:"栅格列",props:{xs:24,sm:12,md:12,lg:6,xl:6},children:[{type:"b-card",name:"容器组件",props:{title:"最高学历分布",bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:[{type:"b-echarts",name:"图表",datasource:{source:"custom",custom:"[]"},props:{title:"最高学历分布",script:`
1397
+ return {
1398
+ tooltip: {
1399
+ trigger: "axis",
1400
+ axisPointer: { type: "shadow" },
1401
+ formatter: "{b}: {c} 人",
1402
+ },
1403
+ grid: { left: "3%", right: "4%", bottom: "3%", containLabel: true },
1404
+ xAxis: {
1405
+ type: "category",
1406
+ data: ["本科", "硕士", "博士"],
1407
+ axisLabel: { fontSize: 12 },
1408
+ },
1409
+ yAxis: { type: "value", name: "人数", nameTextStyle: { fontSize: 12 } },
1410
+ series: [
1411
+ {
1412
+ data: [412, 628, 244],
1413
+ type: "bar",
1414
+ itemStyle: {
1415
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
1416
+ { offset: 0, color: "#722ED1" },
1417
+ { offset: 1, color: "#531DAB" },
1418
+ ]),
1419
+ },
1420
+ },
1421
+ ],
1422
+ }
1423
+ `}}]}]}]},{type:"b-row",name:"栅格行",props:{gutter:[12,12]},style:{marginLeft:0,marginRight:0},children:[{type:"b-col",name:"栅格列",props:{span:24},children:[{type:"b-card",name:"容器组件",props:{title:"民族分布",size:"small",bordered:!1,hoverable:!0,shadow:!0},children:[{type:"b-table",name:"数据表格",datasource:{source:"custom",custom:'[\r\n {\r\n "name": "汉族",\r\n "count": 1204\r\n },\r\n {\r\n "name": "少数民族",\r\n "count": 80\r\n }\r\n]'},props:{title:"民族分布",size:"small",bordered:!0,showHeader:!0,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,showTotal:!0,pageSize:10,columns:[{title:"民族",dataIndex:"name"},{title:"人数",dataIndex:"count"}]}}]}]}]}]},l0=(0,f.Ay)(d.A)`
1424
+ width: 80%;
1425
+
1426
+ .ant-drawer-content-wrapper {
1427
+ width: 100%;
1428
+ transform: none !important;
1429
+
1430
+ .ant-drawer-section {
1431
+ width: 100%;
1432
+
1433
+ .ant-drawer-header {
1434
+ padding: 8px 24px;
1435
+ }
1436
+ .ant-drawer-body {
1437
+ padding: 0;
1438
+ height: "calc(100vh - 41px)";
1439
+ overflow: "hidden";
1440
+ }
1441
+ }
1442
+ }
1443
+ `,l1=(0,n.forwardRef)((e,l)=>{let{}=e;return(0,n.useImperativeHandle)(l,()=>({handleAdd:()=>{console.log("handleAdd")}})),(0,a.jsx)(a.Fragment,{children:"dataset panel"})}),l2={id:"1",name:"数据集1",output:{fields:[{key:"name",name:"名称",type:"STRING"},{key:"age",name:"年龄",type:"NUMBER"},{key:"gender",name:"性别",type:"STRING"},{key:"project",name:"项目",type:"ARRAY",schema:{fields:[{key:"name",name:"项目名称",type:"STRING"},{key:"startDate",name:"开始日期",type:"STRING"},{key:"endDate",name:"结束日期",type:"STRING"}]}},{key:"deptInfo",name:"单位信息",type:"OBJECT",schema:{fields:[{key:"name",name:"单位名称",type:"STRING"},{key:"code",name:"单位编码",type:"STRING"}]}}]}},l4=new Date().toISOString(),l3=new Date;l3.setDate(l3.getDate()-1);let l8=l3.toISOString(),l6=new Date;l6.setDate(3);let l5=l6.toISOString(),l9=new Date;l9.setFullYear(l9.getFullYear()-1);let l7=l9.toISOString(),te={conversationList:[{id:"c1",name:"学业表现概览(本学期)",createdAt:l4,isActived:!0},{id:"c2",name:"出勤与纪律(本周)",createdAt:l8,isActived:!1},{id:"c3",name:"课程满意度(本月)",createdAt:l5,isActived:!1},{id:"c4",name:"教师教学概览(上学期)",createdAt:l7,isActived:!1}],messageList:[{id:"m1",conversationId:"c1",question:"制作学业表现看板:顶部选择学期与年级;左侧展示各科平均分与分数段;右侧显示班级排名TOP5与优秀率趋势。整体风格简洁,重点信息强化。",atItems:JSON.stringify([{id:"average-score-container",name:"平均成绩总体水平容器",type:"b-container",props:{htmlTag:"div",classNames:["bg-white","rounded-xl","shadow-card","p-4","card-transition","hover:shadow-card-hover"]},style:null,children:[{id:"average-score-title",name:"平均成绩总体水平标题",type:"b-text",props:{text:"平均成绩总体水平",classNames:["text-lg","font-semibold","text-gray-700","mb-4"]},style:null,children:null,cascadeIds:null,datasource:null,description:"平均成绩总体水平标题"},{id:"average-score-value",name:"平均成绩数值",type:"b-html",props:{template:"{{score}} 分",classNames:["text-3xl","font-bold","text-green-600","text-center"]},style:null,children:null,cascadeIds:null,datasource:{custom:'{"score": 82.5}',source:"custom",scriptId:null,datasourceId:null},description:"平均成绩数值"}],cascadeIds:null,datasource:null,description:"指标:全体学生平均成绩均值,突出整体学业表现"}]),answer:{answer:"已生成草稿:包含学期与年级筛选、科目均分柱状、分数段分布、班级TOP5榜单及优秀率折线,主色清爽,关键数字加粗。",plans:[{name:"计划1",description:"计划1描述"},{name:"计划2",description:"计划2描述"}],extra:[{id:"e1",element:"科目均分",action:"新增",area:"左侧"},{id:"e2",element:"分数段分布",action:"新增",area:"左侧"},{id:"e3",element:"班级排名TOP5",action:"新增",area:"右侧"},{id:"e4",element:"优秀率趋势",action:"新增",area:"右侧"}]},files:[{id:"f-excel-c1-1",name:"本学期成绩汇总.xlsx",extension:"xlsx"},{id:"f-audio-c1-1",name:"教学反馈录音.m4a",extension:"m4a"}],agents:[{id:"a-performance",name:"学业表现助理"},{id:"a-analytics",name:"数据分析助理"}],createdAt:l4},{id:"m2",conversationId:"c1",question:"补充信息区:在看板顶部显示学生总人数与及格率;底部增加异常波动提醒区,突出近一周变化。",answer:{answer:"已更新草稿:加入人数与及格率标签,底部提醒区高亮近一周波动,便于快速关注。",plans:[{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"},{name:"计划3计划3计划3计划3计划3计划3",description:"计划3描述"}],extra:[{id:"e5",element:"学生总人数标签",action:"新增",area:"顶部"},{id:"e6",element:"及格率标签",action:"新增",area:"顶部"},{id:"e7",element:"异常波动提醒区",action:"新增",area:"底部"}]},files:[{id:"f-excel-c1-2",name:"年级学生清单.xlsx",extension:"xlsx"},{id:"f-audio-c1-2",name:"家长会语音纪要.mp3",extension:"mp3"}],agents:[{id:"a-performance",name:"学业表现助理"},{id:"a-alert",name:"预警提醒助理"}],createdAt:l4},{id:"m3",conversationId:"c2",question:"制作出勤与纪律页:上方日期范围;中间左侧出勤率每日走势;右侧迟到与请假占比;下方列出异常班级与提醒。",answer:{answer:"已生成草稿:曲线展示出勤率,环形占比呈现迟到与请假,卡片列出异常班级与提醒事项。",plans:[{name:"计划4",description:"计划4描述"}],extra:[{id:"e8",element:"出勤率走势",action:"新增",area:"中间左侧"},{id:"e9",element:"迟到与请假占比",action:"新增",area:"中间右侧"},{id:"e10",element:"异常班级卡片",action:"新增",area:"底部"}]},files:[{id:"f-excel-c2-1",name:"本周出勤记录.xlsx",extension:"xlsx"},{id:"f-audio-c2-1",name:"晨会纪律通报.wav",extension:"wav"}],agents:[{id:"a-attendance",name:"出勤助理"},{id:"a-discipline",name:"纪律管理助理"}],createdAt:l8},{id:"m4",conversationId:"c3",question:"制作课程满意度页:顶部选择课程与授课教师;中间评分分布与意见词语聚合;右侧列出改善建议清单。",answer:{answer:"已生成草稿:评分分布清晰,热门意见词语聚合展示,建议清单分组呈现,便于教学改进。",plans:[{name:"计划5",description:"计划5描述"}],extra:[{id:"e11",element:"评分分布",action:"新增",area:"中间"},{id:"e12",element:"意见词语聚合",action:"新增",area:"中间"},{id:"e13",element:"改善建议清单",action:"新增",area:"右侧"}]},files:[{id:"f-excel-c3-1",name:"课程评价问卷.xlsx",extension:"xlsx"},{id:"f-audio-c3-1",name:"学生访谈片段.m4a",extension:"m4a"}],agents:[{id:"a-satisfaction",name:"满意度分析助理"},{id:"a-teacher",name:"教学改进助理"}],createdAt:l5},{id:"m5",conversationId:"c4",question:"制作教师教学概览:左侧本学期授课时长与班级覆盖;右侧课后作业批改及时率与反馈质量,并在顶部展示总览卡片。",answer:{answer:"已生成草稿:时长条形展示、覆盖范围统计、及时率仪表与反馈质量等级卡片,顶部总览卡片汇总核心信息。",plans:[{name:"计划6",description:"计划6描述"}],extra:[{id:"e14",element:"授课时长",action:"新增",area:"左侧"},{id:"e15",element:"班级覆盖",action:"新增",area:"左侧"},{id:"e16",element:"批改及时率",action:"新增",area:"右侧"},{id:"e17",element:"反馈质量",action:"新增",area:"右侧"},{id:"e18",element:"总览卡片",action:"新增",area:"顶部"}]},files:[{id:"f-excel-c4-1",name:"教师授课统计.xlsx",extension:"xlsx"},{id:"f-audio-c4-1",name:"教研组会议录音.mp3",extension:"mp3"}],agents:[{id:"a-teacher",name:"教师教学助理"},{id:"a-analytics",name:"数据分析助理"}],createdAt:l7}],chatResponse:{id:"1",answer:{answer:"已更新草稿:加入人数与及格率标签,底部提醒区高亮近一周波动,便于快速关注。",plans:[{name:"计划3",description:"计划3描述"}],extra:[{id:"e1",element:"学生总人数标签",action:"新增",area:"顶部"},{id:"e2",element:"及格率标签",action:"新增",area:"顶部"},{id:"e3",element:"异常波动提醒区",action:"新增",area:"底部"}]},createdAt:l4}},tl=document.getElementById("root");tl&&i.createRoot(tl).render((0,a.jsx)(n.StrictMode,{children:(0,a.jsx)(()=>{let e=(0,n.useRef)(null),[l,t]=(0,n.useState)(!1),[i,f]=(0,n.useState)([{id:1,name:"教师数据集"},{id:2,name:"学生数据集"},{id:3,name:"教学数据集"}]),[j,v]=(0,n.useState)({name:""}),b=[{title:"名称",dataIndex:"name",key:"name"},{title:"操作",dataIndex:"operation",key:"operation",render:(e,l)=>(0,a.jsx)("a",{onClick:()=>y(l),children:(0,a.jsx)(s.A,{})})}],y=l=>{t(!0),setTimeout(()=>{var l;null==(l=e.current)||l.handleOpen(JSON.parse(JSON.stringify(lZ)))},0)};return(0,a.jsxs)("div",{style:{padding:20},children:[(0,a.jsxs)(c.A,{justify:"space-around",children:[(0,a.jsx)(u.A,{flex:"auto",children:(0,a.jsxs)(p.A,{layout:"inline",children:[(0,a.jsx)(p.A.Item,{label:"名称",children:(0,a.jsx)(x.A,{value:j.name,onChange:e=>v({name:e.target.value}),placeholder:"请输入数据报表名称"})}),(0,a.jsx)(p.A.Item,{children:(0,a.jsx)(m.Ay,{children:"查询"})})]})}),(0,a.jsx)(u.A,{flex:"100px",children:(0,a.jsx)(m.Ay,{type:"primary",onClick:()=>{t(!0),setTimeout(()=>{var l;null==(l=e.current)||l.handleOpen(JSON.parse(JSON.stringify(lZ)))},0)},icon:(0,a.jsx)(r.A,{}),children:"创建数据报表"})})]}),(0,a.jsx)(h.A,{size:"small",columns:b,dataSource:[{name:"数据报表1"},{name:"数据报表2"}],bordered:!0,style:{marginTop:20},rowKey:(e,l)=>String(l)}),l&&(0,a.jsx)(l0,{open:l,onClose:()=>t(!1),styles:{wrapper:{width:"100%",transform:"none !important"},header:{display:"none"},body:{padding:0,height:"calc(100vh - 41px)",overflow:"hidden"}},children:(0,a.jsx)(lp,{pageId:"1",ref:e,agentList:i,plugins:lX,headerExtra:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.A,{orientation:"vertical"}),(0,a.jsx)("a",{className:"toolbar",onClick:()=>t(!1),children:(0,a.jsx)(o.A,{})})]}),datasourceEnable:!1,datasetPanel:l1,datasetSelector:e=>(0,a.jsx)("a",{onClick:()=>e(l2),children:"数据集1"}),datasetAdd:(e,l,t)=>(0,a.jsx)(d.A,{title:"选择数据集",size:800,open:!0,onClose:()=>{t()},children:(0,a.jsx)(m.Ay,{onClick:()=>l({...l2,id:R()}),children:"添加数据集"})}),fetch:{ai:{chat:async(e,l,t,a)=>new Promise(e=>{setTimeout(()=>{e({...te.chatResponse,answer:{...te.chatResponse.answer,effect:{schema:{info:{name:"数据报表",description:"数据报表"},datasources:[],scripts:[],variables:[],items:[{id:"1",type:"b-text",name:"数据报表名称",props:{text:"text: "+R()}}]}}},id:R()})},5e3)}),conversationList:async(e,l)=>Promise.resolve(te.conversationList),messageList:async(e,l)=>Promise.resolve(te.messageList.filter(l=>l.conversationId===e)),removeConversation:async e=>Promise.resolve(!0),removeMessage:async e=>Promise.resolve(!0)},dataset:async(e,l,t)=>(console.log("dataset",e,l,t),Promise.resolve({code:"OK",data:{...l}})),upload:async e=>Promise.resolve({id:R(),name:e.name})}})})]})},{})}))}},r={};function o(e){var l=r[e];if(void 0!==l)return l.exports;var t=r[e]={exports:{}};return s[e].call(t.exports,t,t.exports,o),t.exports}o.m=s,o.n=e=>{var l=e&&e.__esModule?()=>e.default:()=>e;return o.d(l,{a:l}),l},l=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(t,a){if(1&a&&(t=this(t)),8&a||"object"==typeof t&&t&&(4&a&&t.__esModule||16&a&&"function"==typeof t.then))return t;var n=Object.create(null);o.r(n);var i={};e=e||[null,l({}),l([]),l(l)];for(var s=2&a&&t;("object"==typeof s||"function"==typeof s)&&!~e.indexOf(s);s=l(s))Object.getOwnPropertyNames(s).forEach(e=>{i[e]=()=>t[e]});return i.default=()=>t,o.d(n,i),n},o.d=(e,l)=>{for(var t in l)o.o(l,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:l[t]})},o.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nc=void 0,t=[],o.O=(e,l,a,n)=>{if(l){n=n||0;for(var i=t.length;i>0&&t[i-1][2]>n;i--)t[i]=t[i-1];t[i]=[l,a,n];return}for(var s=1/0,i=0;i<t.length;i++){for(var[l,a,n]=t[i],r=!0,d=0;d<l.length;d++)(!1&n||s>=n)&&Object.keys(o.O).every(e=>o.O[e](l[d]))?l.splice(d--,1):(r=!1,n<s&&(s=n));if(r){t.splice(i--,1);var c=a();void 0!==c&&(e=c)}}return e},a={410:0},o.O.j=e=>0===a[e],n=(e,l)=>{var t,n,[i,s,r]=l,d=0;if(i.some(e=>0!==a[e])){for(t in s)o.o(s,t)&&(o.m[t]=s[t]);if(r)var c=r(o)}for(e&&e(l);d<i.length;d++)n=i[d],o.o(a,n)&&a[n]&&a[n][0](),a[n]=0;return o.O(c)},(i=self.webpackChunkbi_sdk_react=self.webpackChunkbi_sdk_react||[]).forEach(n.bind(null,0)),i.push=n.bind(null,i.push.bind(i));var d=o.O(void 0,["474"],()=>o(433));d=o.O(d)})();