bi-sdk-react 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/js/bi-sdk.es.js
CHANGED
|
@@ -927,7 +927,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
927
927
|
background: transparent;
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
|
-
`,ls=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,eO.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,eN.jsx)(q,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,eN.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,eN.jsx)(eh,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},ld=eO.default.forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:d=!0,scriptEnable:c=!0,datasetPanel:p,datasetSelector:h,fetch:f,onSave:v,loading:j=!1}=e,y=(0,eO.useRef)(null),b=(0,eO.useRef)(null),[C,S]=(0,eO.useState)(1),[k,N]=(0,eO.useState)([]),[O,D]=(0,eO.useState)([]),[R,L]=(0,eO.useState)(!1),[M,P]=(0,eO.useState)("desktop"),[$,F]=(0,eO.useState)("component"),[Y,W]=(0,eO.useState)((null==f?void 0:f.ai)?"ai":"props"),[K,U]=(0,eO.useState)(!0),[J,q]=(0,eO.useState)(!0),[X,V]=(0,eO.useState)(null),[Q,ee]=(0,eO.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[et,el]=(0,eO.useState)(!0),[er,ea]=(0,eO.useState)(!1),[ei,eo]=(0,eO.useState)(!1),ed=(0,eO.useMemo)(()=>{let e=K?"250px":"",t=J?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[K,J]),ec=(0,eO.useMemo)(()=>({display:K?"flex":"none"}),[K]),eu=(0,eO.useMemo)(()=>({display:J?"flex":"none"}),[J]);l=[Q],(n=(0,eO.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{R||(N(e=>e.length?[...e,JSON.parse(JSON.stringify(Q))].slice(-50):[JSON.parse(JSON.stringify(Q))]),D([]))})()),(0,eO.useImperativeHandle)(t,()=>({handleOpen(e){L(!0),ep(e.items),ee(e),N([JSON.parse(JSON.stringify(e))]),D([]),setTimeout(()=>L(!1),0)}}));let ep=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||Math.random().toString(36).slice(2,10)),Array.isArray(e.children)?ep(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&ep(e.children[t],Math.random().toString(36).slice(2,10))})})},ex=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==b||null==(l=b.current)?void 0:l.reload)&&b.current.reload(),e.schema)ee(t=>({...e.schema}));else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.id,e])),l=JSON.parse(JSON.stringify(Q)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{t.has(e.id)&&(Object.keys(e).forEach(t=>{"id"!==t&&delete e[t]}),Object.assign(e,t.get(e.id))),Array.isArray(e.children)?n(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&n(e.children[t])})})};n(l.items),ee(l)}},em=(0,eO.useMemo)(()=>"cascade"!==Y||(null==X?void 0:X.cascadeIds)?Y:"props",[X,Y]);return(0,eN.jsxs)(tp,{pageId:r,designable:et,plugins:i,schema:Q,selectedItem:X,setSchema:ee,setSelectedItem:V,datasetSelector:h,fetch:f,children:[(0,eN.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,eN.jsxs)(en,{children:[(0,eN.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"保存",children:(0,eN.jsx)(_,{type:"link",className:"toolbar",onClick:()=>{null==v||v(Q)},loading:j,children:(0,eN.jsx)(I,{})})}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"撤销",children:(0,eN.jsx)("a",{className:`toolbar ${k.length>1?"active":""}`,onClick:()=>{N(e=>{if(e.length<=1)return e;L(!0);let t=e[e.length-2];return D(e=>[...e,JSON.parse(JSON.stringify(Q))]),ee(t),V(null),setTimeout(()=>L(!1),0),e.slice(0,-1)})},children:(0,eN.jsx)(E,{})})}),(0,eN.jsx)(es,{title:"重做",children:(0,eN.jsx)("a",{className:`toolbar ${O.length>0?"active":""}`,onClick:()=>{D(e=>e.length?(L(!0),N(e=>[...e,JSON.parse(JSON.stringify(Q))]),ee(e[e.length-1]),V(null),setTimeout(()=>L(!1),0),e.slice(0,-1)):e)},children:(0,eN.jsx)(z,{})})}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"导入JSON",children:(0,eN.jsx)("a",{className:`toolbar ${O.length>0?"active":""}`,onClick:()=>{ea(!0)},children:(0,eN.jsx)(g,{})})})]}),(0,eN.jsxs)(en,{children:[(0,eN.jsx)(es,{title:"缩小",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>S(parseFloat(Math.max(C-.1,.5).toFixed(1))),children:(0,eN.jsx)(B,{})})}),(0,eN.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*C).toFixed(0),"%"]}),(0,eN.jsx)(es,{title:"放大",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>S(parseFloat(Math.min(C+.1,2).toFixed(1))),children:(0,eN.jsx)(A,{})})}),(0,eN.jsx)(es,{title:"重置缩放",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>S(1),children:(0,eN.jsx)(tS,{type:"icon-zoom-reset"})})}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"切换左侧栏",children:(0,eN.jsx)("a",{className:`toolbar ${K?"active":""}`,onClick:()=>{U(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eN.jsx)(tS,{type:"icon-sider-l"})})}),(0,eN.jsx)(es,{title:"切换右侧栏",children:(0,eN.jsx)("a",{className:`toolbar ${J?"active":""}`,onClick:()=>{q(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eN.jsx)(tS,{type:"icon-sider-r"})})}),o]})]}),(0,eN.jsxs)(lo,{style:ed,children:[(0,eN.jsxs)("div",{className:"left",style:ec,children:[(0,eN.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,eN.jsxs)(Z.Group,{value:$,onChange:e=>F(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,eN.jsx)(Z.Button,{value:"component",children:(0,eN.jsx)(es,{title:"组件",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-puzzle"})})}),(0,eN.jsx)(Z.Button,{value:"layer",children:(0,eN.jsx)(es,{title:"图层",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-outline"})})}),!!p&&(0,eN.jsx)(Z.Button,{value:"dataset",children:(0,eN.jsx)(es,{title:"数据集",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-dataset"})})}),d&&(0,eN.jsx)(Z.Button,{value:"datasource",title:"数据源",children:(0,eN.jsx)(es,{title:"数据源",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-datasource"})})}),c&&(0,eN.jsx)(Z.Button,{value:"script",children:(0,eN.jsx)(es,{title:"脚本",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-js"})})}),(0,eN.jsx)(Z.Button,{value:"env",children:(0,eN.jsx)(es,{title:"环境变量",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-variable"})})}),(0,eN.jsx)(Z.Button,{value:"code",children:(0,eN.jsx)(es,{title:"源码",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-json"})})})]})}),(0,eN.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===$&&(0,eN.jsx)(t1,{}),"layer"===$&&(0,eN.jsx)(t9,{}),d&&"datasource"===$&&(0,eN.jsx)(t4,{}),c&&"script"===$&&(0,eN.jsx)(ll,{}),"env"===$&&(0,eN.jsx)(lr,{}),"code"===$&&(0,eN.jsx)(tQ,{}),!!p&&"dataset"===$&&(0,eN.jsx)(li,{ref:b,renderNode:p})]})]}),(0,eN.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,eN.jsx)(tM,{title:"页面",extra:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(_,{size:"small",type:et?"default":"primary",icon:et?(0,eN.jsx)(x,{}):(0,eN.jsx)(m,{}),onClick:()=>el(!et)}),(0,eN.jsxs)(Z.Group,{value:M,onChange:e=>P(e.target.value),size:"small",buttonStyle:"outline",children:[(0,eN.jsx)(Z.Button,{value:"desktop",title:"桌面",children:(0,eN.jsx)(u,{})}),(0,eN.jsx)(Z.Button,{value:"mobile",title:"移动设备",children:(0,eN.jsx)(w,{})}),(0,eN.jsx)(Z.Button,{value:"tablet",title:"平板设备",children:(0,eN.jsx)(T,{})})]})]})}),(0,eN.jsx)("div",{className:["body beautified_scrollbar",M].join(" "),children:(0,eN.jsx)("div",{style:{transform:`scale(${C})`,transformOrigin:"top center"},children:(0,eN.jsx)(tb,{ref:y,device:M,fetch:f})})})]}),(0,eN.jsxs)("div",{className:"right",style:eu,children:[(0,eN.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,eN.jsx)(tY,{agentList:a,onEffect:ex,style:{display:"ai"===em&&(null==f?void 0:f.ai)?void 0:"none"}}),"props"===em&&(0,eN.jsx)(t7,{datasourceEnable:d}),"cascade"===em&&(null==X?void 0:X.cascadeIds)&&(0,eN.jsx)(tq,{})]}),(0,eN.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,eN.jsxs)(Z.Group,{value:em,onChange:e=>W(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==f?void 0:f.ai)&&(0,eN.jsx)(Z.Button,{value:"ai",children:(0,eN.jsx)(es,{title:"智能助理",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-assistant"})})}),(0,eN.jsx)(Z.Button,{value:"props",children:(0,eN.jsx)(es,{title:"属性",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-info"})})}),(null==X?void 0:X.cascadeIds)&&(0,eN.jsx)(Z.Button,{value:"cascade",children:(0,eN.jsx)(es,{title:"联动",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-cascade"})})})]})})]})]})]}),(0,eN.jsx)(ls,{open:er,onOk:e=>{ea(!1),ee(e)},onCancel:()=>ea(!1)}),(0,eN.jsx)(G,{open:ei,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>eo(!1),children:(0,eN.jsx)(tY,{agentList:a,headExtra:(0,eN.jsx)(_,{type:"link",icon:(0,eN.jsx)(s,{}),onClick:()=>eo(!1)}),onEffect:ex})})]})});var lc=((ez={}).STRING="STRING",ez.NUMBER="NUMBER",ez.BOOLEAN="BOOLEAN",ez.OBJECT="OBJECT",ez.ARRAY="ARRAY",ez);let lu=t(j)`
|
|
930
|
+
`,ls=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,eO.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,eN.jsx)(q,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,eN.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,eN.jsx)(eh,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},ld=eO.default.forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:d=!0,scriptEnable:c=!0,datasetPanel:p,datasetSelector:h,fetch:f,onSave:v,loading:j=!1}=e,y=(0,eO.useRef)(null),b=(0,eO.useRef)(null),[C,S]=(0,eO.useState)(1),[k,N]=(0,eO.useState)([]),[O,D]=(0,eO.useState)([]),[R,L]=(0,eO.useState)(!1),[M,P]=(0,eO.useState)("desktop"),[$,F]=(0,eO.useState)("component"),[Y,W]=(0,eO.useState)((null==f?void 0:f.ai)?"ai":"props"),[K,U]=(0,eO.useState)(!0),[J,q]=(0,eO.useState)(!0),[X,V]=(0,eO.useState)(null),[Q,ee]=(0,eO.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[et,el]=(0,eO.useState)(!0),[er,ea]=(0,eO.useState)(!1),[ei,eo]=(0,eO.useState)(!1),ed=(0,eO.useMemo)(()=>{let e=K?"250px":"",t=J?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[K,J]),ec=(0,eO.useMemo)(()=>({display:K?"flex":"none"}),[K]),eu=(0,eO.useMemo)(()=>({display:J?"flex":"none"}),[J]);l=[Q],(n=(0,eO.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{R||(N(e=>e.length?[...e,JSON.parse(JSON.stringify(Q))].slice(-50):[JSON.parse(JSON.stringify(Q))]),D([]))})()),(0,eO.useImperativeHandle)(t,()=>({handleOpen(e){L(!0),ep(e.items),ee(e),N([JSON.parse(JSON.stringify(e))]),D([]),setTimeout(()=>L(!1),0)}}));let ep=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||Math.random().toString(36).slice(2,10)),Array.isArray(e.children)?ep(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&ep(e.children[t],Math.random().toString(36).slice(2,10))})})},ex=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==b||null==(l=b.current)?void 0:l.reload)&&b.current.reload(),e.schema)console.log("effect.schema",e.schema),ee(t=>({...e.schema}));else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.id,e])),l=JSON.parse(JSON.stringify(Q)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{t.has(e.id)&&(Object.keys(e).forEach(t=>{"id"!==t&&delete e[t]}),Object.assign(e,t.get(e.id))),Array.isArray(e.children)?n(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&n(e.children[t])})})};n(l.items),ee(l)}},em=(0,eO.useMemo)(()=>"cascade"!==Y||(null==X?void 0:X.cascadeIds)?Y:"props",[X,Y]);return(0,eN.jsxs)(tp,{pageId:r,designable:et,plugins:i,schema:Q,selectedItem:X,setSchema:ee,setSelectedItem:V,datasetSelector:h,fetch:f,children:[(0,eN.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,eN.jsxs)(en,{children:[(0,eN.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"保存",children:(0,eN.jsx)(_,{type:"link",className:"toolbar",onClick:()=>{null==v||v(Q)},loading:j,children:(0,eN.jsx)(I,{})})}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"撤销",children:(0,eN.jsx)("a",{className:`toolbar ${k.length>1?"active":""}`,onClick:()=>{N(e=>{if(e.length<=1)return e;L(!0);let t=e[e.length-2];return D(e=>[...e,JSON.parse(JSON.stringify(Q))]),ee(t),V(null),setTimeout(()=>L(!1),0),e.slice(0,-1)})},children:(0,eN.jsx)(E,{})})}),(0,eN.jsx)(es,{title:"重做",children:(0,eN.jsx)("a",{className:`toolbar ${O.length>0?"active":""}`,onClick:()=>{D(e=>e.length?(L(!0),N(e=>[...e,JSON.parse(JSON.stringify(Q))]),ee(e[e.length-1]),V(null),setTimeout(()=>L(!1),0),e.slice(0,-1)):e)},children:(0,eN.jsx)(z,{})})}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"导入JSON",children:(0,eN.jsx)("a",{className:`toolbar ${O.length>0?"active":""}`,onClick:()=>{ea(!0)},children:(0,eN.jsx)(g,{})})})]}),(0,eN.jsxs)(en,{children:[(0,eN.jsx)(es,{title:"缩小",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>S(parseFloat(Math.max(C-.1,.5).toFixed(1))),children:(0,eN.jsx)(B,{})})}),(0,eN.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*C).toFixed(0),"%"]}),(0,eN.jsx)(es,{title:"放大",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>S(parseFloat(Math.min(C+.1,2).toFixed(1))),children:(0,eN.jsx)(A,{})})}),(0,eN.jsx)(es,{title:"重置缩放",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>S(1),children:(0,eN.jsx)(tS,{type:"icon-zoom-reset"})})}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"切换左侧栏",children:(0,eN.jsx)("a",{className:`toolbar ${K?"active":""}`,onClick:()=>{U(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eN.jsx)(tS,{type:"icon-sider-l"})})}),(0,eN.jsx)(es,{title:"切换右侧栏",children:(0,eN.jsx)("a",{className:`toolbar ${J?"active":""}`,onClick:()=>{q(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eN.jsx)(tS,{type:"icon-sider-r"})})}),o]})]}),(0,eN.jsxs)(lo,{style:ed,children:[(0,eN.jsxs)("div",{className:"left",style:ec,children:[(0,eN.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,eN.jsxs)(Z.Group,{value:$,onChange:e=>F(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,eN.jsx)(Z.Button,{value:"component",children:(0,eN.jsx)(es,{title:"组件",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-puzzle"})})}),(0,eN.jsx)(Z.Button,{value:"layer",children:(0,eN.jsx)(es,{title:"图层",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-outline"})})}),!!p&&(0,eN.jsx)(Z.Button,{value:"dataset",children:(0,eN.jsx)(es,{title:"数据集",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-dataset"})})}),d&&(0,eN.jsx)(Z.Button,{value:"datasource",title:"数据源",children:(0,eN.jsx)(es,{title:"数据源",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-datasource"})})}),c&&(0,eN.jsx)(Z.Button,{value:"script",children:(0,eN.jsx)(es,{title:"脚本",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-js"})})}),(0,eN.jsx)(Z.Button,{value:"env",children:(0,eN.jsx)(es,{title:"环境变量",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-variable"})})}),(0,eN.jsx)(Z.Button,{value:"code",children:(0,eN.jsx)(es,{title:"源码",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-json"})})})]})}),(0,eN.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===$&&(0,eN.jsx)(t1,{}),"layer"===$&&(0,eN.jsx)(t9,{}),d&&"datasource"===$&&(0,eN.jsx)(t4,{}),c&&"script"===$&&(0,eN.jsx)(ll,{}),"env"===$&&(0,eN.jsx)(lr,{}),"code"===$&&(0,eN.jsx)(tQ,{}),!!p&&"dataset"===$&&(0,eN.jsx)(li,{ref:b,renderNode:p})]})]}),(0,eN.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,eN.jsx)(tM,{title:"页面",extra:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(_,{size:"small",type:et?"default":"primary",icon:et?(0,eN.jsx)(x,{}):(0,eN.jsx)(m,{}),onClick:()=>el(!et)}),(0,eN.jsxs)(Z.Group,{value:M,onChange:e=>P(e.target.value),size:"small",buttonStyle:"outline",children:[(0,eN.jsx)(Z.Button,{value:"desktop",title:"桌面",children:(0,eN.jsx)(u,{})}),(0,eN.jsx)(Z.Button,{value:"mobile",title:"移动设备",children:(0,eN.jsx)(w,{})}),(0,eN.jsx)(Z.Button,{value:"tablet",title:"平板设备",children:(0,eN.jsx)(T,{})})]})]})}),(0,eN.jsx)("div",{className:["body beautified_scrollbar",M].join(" "),children:(0,eN.jsx)("div",{style:{transform:`scale(${C})`,transformOrigin:"top center"},children:(0,eN.jsx)(tb,{ref:y,device:M,fetch:f})})})]}),(0,eN.jsxs)("div",{className:"right",style:eu,children:[(0,eN.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,eN.jsx)(tY,{agentList:a,onEffect:ex,style:{display:"ai"===em&&(null==f?void 0:f.ai)?void 0:"none"}}),"props"===em&&(0,eN.jsx)(t7,{datasourceEnable:d}),"cascade"===em&&(null==X?void 0:X.cascadeIds)&&(0,eN.jsx)(tq,{})]}),(0,eN.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,eN.jsxs)(Z.Group,{value:em,onChange:e=>W(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==f?void 0:f.ai)&&(0,eN.jsx)(Z.Button,{value:"ai",children:(0,eN.jsx)(es,{title:"智能助理",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-assistant"})})}),(0,eN.jsx)(Z.Button,{value:"props",children:(0,eN.jsx)(es,{title:"属性",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-info"})})}),(null==X?void 0:X.cascadeIds)&&(0,eN.jsx)(Z.Button,{value:"cascade",children:(0,eN.jsx)(es,{title:"联动",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-cascade"})})})]})})]})]})]}),(0,eN.jsx)(ls,{open:er,onOk:e=>{ea(!1),ee(e)},onCancel:()=>ea(!1)}),(0,eN.jsx)(G,{open:ei,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>eo(!1),children:(0,eN.jsx)(tY,{agentList:a,headExtra:(0,eN.jsx)(_,{type:"link",icon:(0,eN.jsx)(s,{}),onClick:()=>eo(!1)}),onEffect:ex})})]})});var lc=((ez={}).STRING="STRING",ez.NUMBER="NUMBER",ez.BOOLEAN="BOOLEAN",ez.OBJECT="OBJECT",ez.ARRAY="ARRAY",ez);let lu=t(j)`
|
|
931
931
|
vertical-align: middle;
|
|
932
932
|
margin-left: 2px;
|
|
933
933
|
color: var(--ant-color-text-description);
|
|
@@ -927,7 +927,7 @@
|
|
|
927
927
|
background: transparent;
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
|
-
`,tc=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,p.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,d.jsx)(ey.Modal,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,d.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,d.jsx)(eX.Editor,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},tu=m().forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:s=!0,scriptEnable:c=!0,datasetPanel:u,datasetSelector:m,fetch:x,onSave:h,loading:f=!1}=e,g=(0,p.useRef)(null),v=(0,p.useRef)(null),[j,y]=(0,p.useState)(1),[b,w]=(0,p.useState)([]),[C,S]=(0,p.useState)([]),[I,z]=(0,p.useState)(!1),[k,O]=(0,p.useState)("desktop"),[N,T]=(0,p.useState)("component"),[R,F]=(0,p.useState)((null==x?void 0:x.ai)?"ai":"props"),[D,E]=(0,p.useState)(!0),[A,B]=(0,p.useState)(!0),[M,L]=(0,p.useState)(null),[P,$]=(0,p.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[Y,H]=(0,p.useState)(!0),[_,q]=(0,p.useState)(!1),[G,U]=(0,p.useState)(!1),K=(0,p.useMemo)(()=>{let e=D?"250px":"",t=A?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[D,A]),W=(0,p.useMemo)(()=>({display:D?"flex":"none"}),[D]),J=(0,p.useMemo)(()=>({display:A?"flex":"none"}),[A]);l=[P],(n=(0,p.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{I||(w(e=>e.length?[...e,JSON.parse(JSON.stringify(P))].slice(-50):[JSON.parse(JSON.stringify(P))]),S([]))})()),(0,p.useImperativeHandle)(t,()=>({handleOpen(e){z(!0),X(e.items),$(e),w([JSON.parse(JSON.stringify(e))]),S([]),setTimeout(()=>z(!1),0)}}));let X=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||Math.random().toString(36).slice(2,10)),Array.isArray(e.children)?X(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&X(e.children[t],Math.random().toString(36).slice(2,10))})})},V=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==v||null==(l=v.current)?void 0:l.reload)&&v.current.reload(),e.schema)$(t=>({...e.schema}));else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.id,e])),l=JSON.parse(JSON.stringify(P)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{t.has(e.id)&&(Object.keys(e).forEach(t=>{"id"!==t&&delete e[t]}),Object.assign(e,t.get(e.id))),Array.isArray(e.children)?n(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&n(e.children[t])})})};n(l.items),$(l)}},Q=(0,p.useMemo)(()=>"cascade"!==R||(null==M?void 0:M.cascadeIds)?R:"props",[M,R]);return(0,d.jsxs)(es,{pageId:r,designable:Y,plugins:i,schema:P,selectedItem:M,setSchema:$,setSelectedItem:L,datasetSelector:m,fetch:x,children:[(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"保存",children:(0,d.jsx)(ey.Button,{type:"link",className:"toolbar",onClick:()=>{null==h||h(P)},loading:f,children:(0,d.jsx)(ej.SaveOutlined,{})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"撤销",children:(0,d.jsx)("a",{className:`toolbar ${b.length>1?"active":""}`,onClick:()=>{w(e=>{if(e.length<=1)return e;z(!0);let t=e[e.length-2];return S(e=>[...e,JSON.parse(JSON.stringify(P))]),$(t),L(null),setTimeout(()=>z(!1),0),e.slice(0,-1)})},children:(0,d.jsx)(ej.UndoOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"重做",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{S(e=>e.length?(z(!0),w(e=>[...e,JSON.parse(JSON.stringify(P))]),$(e[e.length-1]),L(null),setTimeout(()=>z(!1),0),e.slice(0,-1)):e)},children:(0,d.jsx)(ej.RedoOutlined,{})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"导入JSON",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{q(!0)},children:(0,d.jsx)(ej.ImportOutlined,{})})})]}),(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Tooltip,{title:"缩小",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(parseFloat(Math.max(j-.1,.5).toFixed(1))),children:(0,d.jsx)(ej.ZoomOutOutlined,{})})}),(0,d.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*j).toFixed(0),"%"]}),(0,d.jsx)(ey.Tooltip,{title:"放大",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(parseFloat(Math.min(j+.1,2).toFixed(1))),children:(0,d.jsx)(ej.ZoomInOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"重置缩放",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(1),children:(0,d.jsx)(ew,{type:"icon-zoom-reset"})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"切换左侧栏",children:(0,d.jsx)("a",{className:`toolbar ${D?"active":""}`,onClick:()=>{E(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-l"})})}),(0,d.jsx)(ey.Tooltip,{title:"切换右侧栏",children:(0,d.jsx)("a",{className:`toolbar ${A?"active":""}`,onClick:()=>{B(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-r"})})}),o]})]}),(0,d.jsxs)(td,{style:K,children:[(0,d.jsxs)("div",{className:"left",style:W,children:[(0,d.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,d.jsxs)(ey.Radio.Group,{value:N,onChange:e=>T(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,d.jsx)(ey.Radio.Button,{value:"component",children:(0,d.jsx)(ey.Tooltip,{title:"组件",placement:"right",children:(0,d.jsx)(ew,{type:"icon-puzzle"})})}),(0,d.jsx)(ey.Radio.Button,{value:"layer",children:(0,d.jsx)(ey.Tooltip,{title:"图层",placement:"right",children:(0,d.jsx)(ew,{type:"icon-outline"})})}),!!u&&(0,d.jsx)(ey.Radio.Button,{value:"dataset",children:(0,d.jsx)(ey.Tooltip,{title:"数据集",placement:"right",children:(0,d.jsx)(ew,{type:"icon-dataset"})})}),s&&(0,d.jsx)(ey.Radio.Button,{value:"datasource",title:"数据源",children:(0,d.jsx)(ey.Tooltip,{title:"数据源",placement:"right",children:(0,d.jsx)(ew,{type:"icon-datasource"})})}),c&&(0,d.jsx)(ey.Radio.Button,{value:"script",children:(0,d.jsx)(ey.Tooltip,{title:"脚本",placement:"right",children:(0,d.jsx)(ew,{type:"icon-js"})})}),(0,d.jsx)(ey.Radio.Button,{value:"env",children:(0,d.jsx)(ey.Tooltip,{title:"环境变量",placement:"right",children:(0,d.jsx)(ew,{type:"icon-variable"})})}),(0,d.jsx)(ey.Radio.Button,{value:"code",children:(0,d.jsx)(ey.Tooltip,{title:"源码",placement:"right",children:(0,d.jsx)(ew,{type:"icon-json"})})})]})}),(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===N&&(0,d.jsx)(e4,{}),"layer"===N&&(0,d.jsx)(e3,{}),s&&"datasource"===N&&(0,d.jsx)(e5,{}),c&&"script"===N&&(0,d.jsx)(tr,{}),"env"===N&&(0,d.jsx)(ti,{}),"code"===N&&(0,d.jsx)(e0,{}),!!u&&"dataset"===N&&(0,d.jsx)(ts,{ref:v,renderNode:u})]})]}),(0,d.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,d.jsx)(eL,{title:"页面",extra:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{size:"small",type:Y?"default":"primary",icon:Y?(0,d.jsx)(ej.EyeInvisibleOutlined,{}):(0,d.jsx)(ej.EyeOutlined,{}),onClick:()=>H(!Y)}),(0,d.jsxs)(ey.Radio.Group,{value:k,onChange:e=>O(e.target.value),size:"small",buttonStyle:"outline",children:[(0,d.jsx)(ey.Radio.Button,{value:"desktop",title:"桌面",children:(0,d.jsx)(ej.DesktopOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"mobile",title:"移动设备",children:(0,d.jsx)(ej.MobileOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"tablet",title:"平板设备",children:(0,d.jsx)(ej.TabletOutlined,{})})]})]})}),(0,d.jsx)("div",{className:["body beautified_scrollbar",k].join(" "),children:(0,d.jsx)("div",{style:{transform:`scale(${j})`,transformOrigin:"top center"},children:(0,d.jsx)(eg,{ref:g,device:k,fetch:x})})})]}),(0,d.jsxs)("div",{className:"right",style:J,children:[(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,d.jsx)(eH,{agentList:a,onEffect:V,style:{display:"ai"===Q&&(null==x?void 0:x.ai)?void 0:"none"}}),"props"===Q&&(0,d.jsx)(tt,{datasourceEnable:s}),"cascade"===Q&&(null==M?void 0:M.cascadeIds)&&(0,d.jsx)(eJ,{})]}),(0,d.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,d.jsxs)(ey.Radio.Group,{value:Q,onChange:e=>F(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==x?void 0:x.ai)&&(0,d.jsx)(ey.Radio.Button,{value:"ai",children:(0,d.jsx)(ey.Tooltip,{title:"智能助理",placement:"right",children:(0,d.jsx)(ew,{type:"icon-assistant"})})}),(0,d.jsx)(ey.Radio.Button,{value:"props",children:(0,d.jsx)(ey.Tooltip,{title:"属性",placement:"right",children:(0,d.jsx)(ew,{type:"icon-info"})})}),(null==M?void 0:M.cascadeIds)&&(0,d.jsx)(ey.Radio.Button,{value:"cascade",children:(0,d.jsx)(ey.Tooltip,{title:"联动",placement:"right",children:(0,d.jsx)(ew,{type:"icon-cascade"})})})]})})]})]})]}),(0,d.jsx)(tc,{open:_,onOk:e=>{q(!1),$(e)},onCancel:()=>q(!1)}),(0,d.jsx)(ey.Drawer,{open:G,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>U(!1),children:(0,d.jsx)(eH,{agentList:a,headExtra:(0,d.jsx)(ey.Button,{type:"link",icon:(0,d.jsx)(ej.CloseOutlined,{}),onClick:()=>U(!1)}),onEffect:V})})]})});var tp=((i={}).STRING="STRING",i.NUMBER="NUMBER",i.BOOLEAN="BOOLEAN",i.OBJECT="OBJECT",i.ARRAY="ARRAY",i);let tm=h()(ej.InfoCircleOutlined)`
|
|
930
|
+
`,tc=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,p.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,d.jsx)(ey.Modal,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,d.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,d.jsx)(eX.Editor,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},tu=m().forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:s=!0,scriptEnable:c=!0,datasetPanel:u,datasetSelector:m,fetch:x,onSave:h,loading:f=!1}=e,g=(0,p.useRef)(null),v=(0,p.useRef)(null),[j,y]=(0,p.useState)(1),[b,w]=(0,p.useState)([]),[C,S]=(0,p.useState)([]),[I,z]=(0,p.useState)(!1),[k,O]=(0,p.useState)("desktop"),[N,T]=(0,p.useState)("component"),[R,F]=(0,p.useState)((null==x?void 0:x.ai)?"ai":"props"),[D,E]=(0,p.useState)(!0),[A,B]=(0,p.useState)(!0),[M,L]=(0,p.useState)(null),[P,$]=(0,p.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[Y,H]=(0,p.useState)(!0),[_,q]=(0,p.useState)(!1),[G,U]=(0,p.useState)(!1),K=(0,p.useMemo)(()=>{let e=D?"250px":"",t=A?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[D,A]),W=(0,p.useMemo)(()=>({display:D?"flex":"none"}),[D]),J=(0,p.useMemo)(()=>({display:A?"flex":"none"}),[A]);l=[P],(n=(0,p.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{I||(w(e=>e.length?[...e,JSON.parse(JSON.stringify(P))].slice(-50):[JSON.parse(JSON.stringify(P))]),S([]))})()),(0,p.useImperativeHandle)(t,()=>({handleOpen(e){z(!0),X(e.items),$(e),w([JSON.parse(JSON.stringify(e))]),S([]),setTimeout(()=>z(!1),0)}}));let X=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||Math.random().toString(36).slice(2,10)),Array.isArray(e.children)?X(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&X(e.children[t],Math.random().toString(36).slice(2,10))})})},V=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==v||null==(l=v.current)?void 0:l.reload)&&v.current.reload(),e.schema)console.log("effect.schema",e.schema),$(t=>({...e.schema}));else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.id,e])),l=JSON.parse(JSON.stringify(P)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{t.has(e.id)&&(Object.keys(e).forEach(t=>{"id"!==t&&delete e[t]}),Object.assign(e,t.get(e.id))),Array.isArray(e.children)?n(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&n(e.children[t])})})};n(l.items),$(l)}},Q=(0,p.useMemo)(()=>"cascade"!==R||(null==M?void 0:M.cascadeIds)?R:"props",[M,R]);return(0,d.jsxs)(es,{pageId:r,designable:Y,plugins:i,schema:P,selectedItem:M,setSchema:$,setSelectedItem:L,datasetSelector:m,fetch:x,children:[(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"保存",children:(0,d.jsx)(ey.Button,{type:"link",className:"toolbar",onClick:()=>{null==h||h(P)},loading:f,children:(0,d.jsx)(ej.SaveOutlined,{})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"撤销",children:(0,d.jsx)("a",{className:`toolbar ${b.length>1?"active":""}`,onClick:()=>{w(e=>{if(e.length<=1)return e;z(!0);let t=e[e.length-2];return S(e=>[...e,JSON.parse(JSON.stringify(P))]),$(t),L(null),setTimeout(()=>z(!1),0),e.slice(0,-1)})},children:(0,d.jsx)(ej.UndoOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"重做",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{S(e=>e.length?(z(!0),w(e=>[...e,JSON.parse(JSON.stringify(P))]),$(e[e.length-1]),L(null),setTimeout(()=>z(!1),0),e.slice(0,-1)):e)},children:(0,d.jsx)(ej.RedoOutlined,{})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"导入JSON",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{q(!0)},children:(0,d.jsx)(ej.ImportOutlined,{})})})]}),(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Tooltip,{title:"缩小",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(parseFloat(Math.max(j-.1,.5).toFixed(1))),children:(0,d.jsx)(ej.ZoomOutOutlined,{})})}),(0,d.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*j).toFixed(0),"%"]}),(0,d.jsx)(ey.Tooltip,{title:"放大",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(parseFloat(Math.min(j+.1,2).toFixed(1))),children:(0,d.jsx)(ej.ZoomInOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"重置缩放",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(1),children:(0,d.jsx)(ew,{type:"icon-zoom-reset"})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"切换左侧栏",children:(0,d.jsx)("a",{className:`toolbar ${D?"active":""}`,onClick:()=>{E(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-l"})})}),(0,d.jsx)(ey.Tooltip,{title:"切换右侧栏",children:(0,d.jsx)("a",{className:`toolbar ${A?"active":""}`,onClick:()=>{B(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-r"})})}),o]})]}),(0,d.jsxs)(td,{style:K,children:[(0,d.jsxs)("div",{className:"left",style:W,children:[(0,d.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,d.jsxs)(ey.Radio.Group,{value:N,onChange:e=>T(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,d.jsx)(ey.Radio.Button,{value:"component",children:(0,d.jsx)(ey.Tooltip,{title:"组件",placement:"right",children:(0,d.jsx)(ew,{type:"icon-puzzle"})})}),(0,d.jsx)(ey.Radio.Button,{value:"layer",children:(0,d.jsx)(ey.Tooltip,{title:"图层",placement:"right",children:(0,d.jsx)(ew,{type:"icon-outline"})})}),!!u&&(0,d.jsx)(ey.Radio.Button,{value:"dataset",children:(0,d.jsx)(ey.Tooltip,{title:"数据集",placement:"right",children:(0,d.jsx)(ew,{type:"icon-dataset"})})}),s&&(0,d.jsx)(ey.Radio.Button,{value:"datasource",title:"数据源",children:(0,d.jsx)(ey.Tooltip,{title:"数据源",placement:"right",children:(0,d.jsx)(ew,{type:"icon-datasource"})})}),c&&(0,d.jsx)(ey.Radio.Button,{value:"script",children:(0,d.jsx)(ey.Tooltip,{title:"脚本",placement:"right",children:(0,d.jsx)(ew,{type:"icon-js"})})}),(0,d.jsx)(ey.Radio.Button,{value:"env",children:(0,d.jsx)(ey.Tooltip,{title:"环境变量",placement:"right",children:(0,d.jsx)(ew,{type:"icon-variable"})})}),(0,d.jsx)(ey.Radio.Button,{value:"code",children:(0,d.jsx)(ey.Tooltip,{title:"源码",placement:"right",children:(0,d.jsx)(ew,{type:"icon-json"})})})]})}),(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===N&&(0,d.jsx)(e4,{}),"layer"===N&&(0,d.jsx)(e3,{}),s&&"datasource"===N&&(0,d.jsx)(e5,{}),c&&"script"===N&&(0,d.jsx)(tr,{}),"env"===N&&(0,d.jsx)(ti,{}),"code"===N&&(0,d.jsx)(e0,{}),!!u&&"dataset"===N&&(0,d.jsx)(ts,{ref:v,renderNode:u})]})]}),(0,d.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,d.jsx)(eL,{title:"页面",extra:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{size:"small",type:Y?"default":"primary",icon:Y?(0,d.jsx)(ej.EyeInvisibleOutlined,{}):(0,d.jsx)(ej.EyeOutlined,{}),onClick:()=>H(!Y)}),(0,d.jsxs)(ey.Radio.Group,{value:k,onChange:e=>O(e.target.value),size:"small",buttonStyle:"outline",children:[(0,d.jsx)(ey.Radio.Button,{value:"desktop",title:"桌面",children:(0,d.jsx)(ej.DesktopOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"mobile",title:"移动设备",children:(0,d.jsx)(ej.MobileOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"tablet",title:"平板设备",children:(0,d.jsx)(ej.TabletOutlined,{})})]})]})}),(0,d.jsx)("div",{className:["body beautified_scrollbar",k].join(" "),children:(0,d.jsx)("div",{style:{transform:`scale(${j})`,transformOrigin:"top center"},children:(0,d.jsx)(eg,{ref:g,device:k,fetch:x})})})]}),(0,d.jsxs)("div",{className:"right",style:J,children:[(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,d.jsx)(eH,{agentList:a,onEffect:V,style:{display:"ai"===Q&&(null==x?void 0:x.ai)?void 0:"none"}}),"props"===Q&&(0,d.jsx)(tt,{datasourceEnable:s}),"cascade"===Q&&(null==M?void 0:M.cascadeIds)&&(0,d.jsx)(eJ,{})]}),(0,d.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,d.jsxs)(ey.Radio.Group,{value:Q,onChange:e=>F(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==x?void 0:x.ai)&&(0,d.jsx)(ey.Radio.Button,{value:"ai",children:(0,d.jsx)(ey.Tooltip,{title:"智能助理",placement:"right",children:(0,d.jsx)(ew,{type:"icon-assistant"})})}),(0,d.jsx)(ey.Radio.Button,{value:"props",children:(0,d.jsx)(ey.Tooltip,{title:"属性",placement:"right",children:(0,d.jsx)(ew,{type:"icon-info"})})}),(null==M?void 0:M.cascadeIds)&&(0,d.jsx)(ey.Radio.Button,{value:"cascade",children:(0,d.jsx)(ey.Tooltip,{title:"联动",placement:"right",children:(0,d.jsx)(ew,{type:"icon-cascade"})})})]})})]})]})]}),(0,d.jsx)(tc,{open:_,onOk:e=>{q(!1),$(e)},onCancel:()=>q(!1)}),(0,d.jsx)(ey.Drawer,{open:G,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>U(!1),children:(0,d.jsx)(eH,{agentList:a,headExtra:(0,d.jsx)(ey.Button,{type:"link",icon:(0,d.jsx)(ej.CloseOutlined,{}),onClick:()=>U(!1)}),onEffect:V})})]})});var tp=((i={}).STRING="STRING",i.NUMBER="NUMBER",i.BOOLEAN="BOOLEAN",i.OBJECT="OBJECT",i.ARRAY="ARRAY",i);let tm=h()(ej.InfoCircleOutlined)`
|
|
931
931
|
vertical-align: middle;
|
|
932
932
|
margin-left: 2px;
|
|
933
933
|
color: var(--ant-color-text-description);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bi-sdk-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/umd/js/bi-sdk.umd.min.js",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"serve": "rsbuild dev",
|
|
12
12
|
"dev": "rsbuild dev",
|
|
13
13
|
"build": "rsbuild build",
|
|
14
|
+
"build:all": "npm run build:types && npm run build:lib",
|
|
14
15
|
"build:types": "tsc --emitDeclarationOnly",
|
|
15
16
|
"build:lib": "npm run build:lib:umd && npm run build:lib:es",
|
|
16
17
|
"build:lib:umd": "cross-env NODE_ENV=production BUILD_TARGET=lib rsbuild build --config rsbuild.lib.config.ts",
|
|
@@ -395,6 +395,7 @@ export const PageDesigner = React.forwardRef<any, PageDesignerProps>(
|
|
|
395
395
|
datasetPanelRef.current.reload();
|
|
396
396
|
}
|
|
397
397
|
if (effect.schema) {
|
|
398
|
+
console.log("effect.schema", effect.schema);
|
|
398
399
|
setSchema(prev => ({ ...effect.schema } as PageSchema));
|
|
399
400
|
} else if (effect.pageItems?.length) {
|
|
400
401
|
const effectItemMap = new Map(
|