mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-06 03:57:49 +08:00
2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
import{t as he,c as me}from"./lodash-es@4.17.21-b7de4195.js";import{s as be}from"./pinia@2.1.4_typescript@5.0.2_vue@3.3.4-ab93b4ec.js";import{e as pe,j as B,o as ye,k as fe,l as O}from"./index-3c6900b5.js";import{u as p,r as ge,i as Se,a as Ce,b as we,c as xe,d as Ae,e as Fe,f as Ee,g as ke,h as ve,j as Be,k as Oe,l as De,m as Te,n as Le,o as Re,p as We,q as $e,s as ze}from"./echarts@5.4.0-fb0c89c7.js";import{k as R,A as D,m as C,v as je,f as Ve,n as _e,t as Pe,b as t,p as i}from"./@vue_runtime-core@3.3.4-073fad6e.js";import{k as y,h as Ue,v as Me}from"./@vue_reactivity@3.3.4-2b3a1c4e.js";import{_ as c,Y as Ne,e as T}from"./naive-ui@2.34.4_vue@3.3.4-eb250861.js";import"./vue-demi@0.14.5_vue@3.3.4-71ba0ef2.js";import"./vue-router@4.2.4_vue@3.3.4-e93fe26b.js";import"./vue-i18n@9.2.2_vue@3.3.4-a7a92bd0.js";import"./@intlify_shared@9.2.2-e4047ebf.js";import"./@intlify_core-base@9.2.2-a0a8715c.js";import"./@intlify_message-compiler@9.2.2-8a818441.js";import"./@intlify_devtools-if@9.2.2-c61c979f.js";import"./dayjs@1.11.7-6cbb96c2.js";import"./@babel_runtime@7.22.6-960cbc2f.js";import"./screenfull@6.0.2-b3e6dc1f.js";import"./@vue_runtime-dom@3.3.4-d86573ec.js";import"./@vue_shared@3.3.4-896c5ecf.js";import"./@vueuse_core@9.1.0_vue@3.3.4-f4b6b7e2.js";import"./@vueuse_shared@9.1.0_vue@3.3.4-e5bccb39.js";import"./pinia-plugin-persistedstate@3.1.0_pinia@2.1.4-4f3b1591.js";import"./clipboard@2.0.11-6193b289.js";import"./date-fns@2.30.0-0bf1b710.js";import"./vueuc@0.4.51_vue@3.3.4-6588b5bd.js";import"./evtd@0.2.4-b614532e.js";import"./seemly@0.3.6-dc6f1e91.js";import"./@css-render_vue3-ssr@0.15.12_vue@3.3.4-24369cc5.js";import"./vooks@0.2.12_vue@3.3.4-59877c34.js";import"./vdirs@0.1.8_vue@3.3.4-4519c5fd.js";import"./@juggle_resize-observer@3.4.0-41516555.js";import"./css-render@0.15.12-57b1a53f.js";import"./@emotion_hash@0.8.0-8a8e73f6.js";import"./treemate@0.3.11-25c27bff.js";import"./date-fns-tz@1.3.8_date-fns@2.30.0-7cff6900.js";import"./async-validator@4.2.5-dee29e8b.js";import"./@css-render_plugin-bem@0.15.12_css-render@0.15.12-9dde7ffe.js";import"./zrender@5.4.0-1cedba25.js";import"./tslib@2.3.0-54e39b60.js";const W=["#2ec7c9","#b6a2de","#5ab1ef","#ffb980","#d87a80","#8d98b3","#e5cf0d","#97b552","#95706d","#dc69aa","#07a2a4","#9a7fd1","#588dd5","#f5994e","#c05050","#59678c","#c9ab00","#7eb00a","#6f5553","#c14089"],$="rgba(0,0,0,0)",z={},j={textStyle:{color:"#008acd"},subtextStyle:{color:"#aaaaaa"}},V={itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:3,symbol:"emptyCircle",smooth:!0},_={itemStyle:{borderWidth:1},lineStyle:{width:2},symbolSize:3,symbol:"emptyCircle",smooth:!0},P={itemStyle:{barBorderWidth:0,barBorderColor:"#ccc"}},U={itemStyle:{borderWidth:0,borderColor:"#ccc"}},M={itemStyle:{borderWidth:0,borderColor:"#ccc"}},N={itemStyle:{borderWidth:0,borderColor:"#ccc"}},Z={itemStyle:{borderWidth:0,borderColor:"#ccc"}},q={itemStyle:{borderWidth:0,borderColor:"#ccc"}},G={itemStyle:{borderWidth:0,borderColor:"#ccc"}},H={itemStyle:{borderWidth:0,borderColor:"#ccc"}},X={itemStyle:{color:"#d87a80",color0:"#2ec7c9",borderColor:"#d87a80",borderColor0:"#2ec7c9",borderWidth:1}},Y={itemStyle:{borderWidth:0,borderColor:"#ccc"},lineStyle:{width:1,color:"#aaa"},symbolSize:3,symbol:"emptyCircle",smooth:!0,color:["#2ec7c9","#b6a2de","#5ab1ef","#ffb980","#d87a80","#8d98b3","#e5cf0d","#97b552","#95706d","#dc69aa","#07a2a4","#9a7fd1","#588dd5","#f5994e","#c05050","#59678c","#c9ab00","#7eb00a","#6f5553","#c14089"],label:{color:"#eee"}},J={itemStyle:{areaColor:"#dddddd",borderColor:"#eeeeee",borderWidth:.5},label:{color:"#d87a80"},emphasis:{itemStyle:{areaColor:"rgba(254,153,78,1)",borderColor:"#444",borderWidth:1},label:{color:"rgb(100,0,0)"}}},K={itemStyle:{areaColor:"#dddddd",borderColor:"#eeeeee",borderWidth:.5},label:{color:"#d87a80"},emphasis:{itemStyle:{areaColor:"rgba(254,153,78,1)",borderColor:"#444",borderWidth:1},label:{color:"rgb(100,0,0)"}}},Q={axisLine:{show:!0,lineStyle:{color:"#008acd"}},axisTick:{show:!0,lineStyle:{color:"#333"}},axisLabel:{show:!0,color:"#333"},splitLine:{show:!1,lineStyle:{color:["#eee"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},I={axisLine:{show:!0,lineStyle:{color:"#008acd"}},axisTick:{show:!0,lineStyle:{color:"#333"}},axisLabel:{show:!0,color:"#333"},splitLine:{show:!0,lineStyle:{color:["#eee"]}},splitArea:{show:!0,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},ee={axisLine:{show:!0,lineStyle:{color:"#008acd"}},axisTick:{show:!0,lineStyle:{color:"#333"}},axisLabel:{show:!0,color:"#333"},splitLine:{show:!0,lineStyle:{color:["#eee"]}},splitArea:{show:!0,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},te={axisLine:{show:!0,lineStyle:{color:"#008acd"}},axisTick:{show:!0,lineStyle:{color:"#333"}},axisLabel:{show:!0,color:"#333"},splitLine:{show:!0,lineStyle:{color:["#eee"]}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},oe={iconStyle:{borderColor:"#2ec7c9"},emphasis:{iconStyle:{borderColor:"#18a4a6"}}},ae={textStyle:{color:"#333333"}},re={axisPointer:{lineStyle:{color:"#008acd",width:"1"},crossStyle:{color:"#008acd",width:"1"}}},le={lineStyle:{color:"#008acd",width:1},itemStyle:{color:"#008acd",borderWidth:1},controlStyle:{color:"#008acd",borderColor:"#008acd",borderWidth:.5},checkpointStyle:{color:"#2ec7c9",borderColor:"#2ec7c9"},label:{color:"#008acd"},emphasis:{itemStyle:{color:"#a9334c"},controlStyle:{color:"#008acd",borderColor:"#008acd",borderWidth:.5},label:{color:"#008acd"}}},ie={color:["#5ab1ef","#e0ffff"]},se={backgroundColor:"rgba(47,69,84,0)",dataBackgroundColor:"#efefff",fillerColor:"rgba(182,162,222,0.2)",handleColor:"#008acd",handleSize:"100%",textStyle:{color:"#333333"}},ne={label:{color:"#eee"},emphasis:{label:{color:"#eee"}}},Ze={color:W,backgroundColor:$,textStyle:z,title:j,line:V,radar:_,bar:P,pie:U,scatter:M,boxplot:N,parallel:Z,sankey:q,funnel:G,gauge:H,candlestick:X,graph:Y,map:J,geo:K,categoryAxis:Q,valueAxis:I,logAxis:ee,timeAxis:te,toolbox:oe,legend:ae,tooltip:re,timeline:le,visualMap:ie,dataZoom:se,markPoint:ne},qe=Object.freeze(Object.defineProperty({__proto__:null,backgroundColor:$,bar:P,boxplot:N,candlestick:X,categoryAxis:Q,color:W,dataZoom:se,default:Ze,funnel:G,gauge:H,geo:K,graph:Y,legend:ae,line:V,logAxis:ee,map:J,markPoint:ne,parallel:Z,pie:U,radar:_,sankey:q,scatter:M,textStyle:z,timeAxis:te,timeline:le,title:j,toolbox:oe,tooltip:re,valueAxis:I,visualMap:ie},Symbol.toStringTag,{value:"Module"})),Ge=()=>{const e=Object.assign({"/src/components/RayChart/theme/macarons.json":qe}),h=/\/([^/]+)\.json$/;return Object.keys(e).reduce((r,u)=>{var o;const s=(o=u.match(h))==null?void 0:o[1];if(s)return r.push({name:s,theme:e[u].default}),r;throw new Error("theme name is not found")},[])},L=e=>Object.assign({},{text:"loading",color:"#c23531",textColor:"#000",maskColor:"rgba(255, 255, 255, 0.9)",zlevel:0,fontSize:12,showSpinner:!0,spinnerRadius:10,lineWidth:5,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif"},e),d=R({name:"RayChart",props:{width:{type:String,default:"100%"},height:{type:String,default:"100%"},autoResize:{type:[Boolean,Object],default:!0},canvasRender:{type:Boolean,default:!0},showAria:{type:Boolean,default:!1},options:{type:Object,default:()=>({})},success:{type:[Function,Array],default:null},error:{type:[Function,Array],default:null},theme:{type:[String,Object],default:""},autoChangeTheme:{type:Boolean,default:!1},use:{type:Array,default:()=>[]},watchOptions:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},loadingOptions:{type:Object,default:()=>L()}},setup(e,{expose:h}){const m=pe(),{themeValue:r}=be(m),u=y(),s=y();let o,b;const x=D(()=>({"--ray-chart-width":B(e.width),"--ray-chart-height":B(e.height)})),A=D(()=>L(e.loadingOptions)),n=async()=>{p([Ce,we,xe,Ae,Fe,Ee,ke,ve]),p([Be,Oe,De,Te,Le,Re]),p([We,$e]),p([ze]);try{p(e.use)}catch{console.error("Error: wrong property and method passed in extend attribute")}},F=()=>{let a=me(e.options);const f=g=>Object.assign({},a,g);return e.showAria&&(a=f({aria:{enabled:!0,decal:{show:!0}}})),a},l=(a="macarons")=>{const f=u.value,g=F(),{height:ue,width:de}=f.getBoundingClientRect(),{success:k,error:v}=e;try{Ge().forEach(S=>{ge(S.name,S.theme)}),o=Se(f,a,{width:de===0?200:void 0,height:ue===0?200:void 0}),s.value=o,g&&o.setOption(g),k&&O(k,o)}catch(S){v&&O(v),console.error("RayChart render error: ",S)}},E=a=>{if(e.autoChangeTheme){a?l("dark"):l();return}e.theme||l()},w=()=>{o&&(o.clear(),o.dispose())},ce=()=>{o&&o.resize()};return C(()=>[r.value],([a])=>{e.autoChangeTheme&&(w(),E(a))}),C(()=>e.showAria,()=>{w(),(e.autoChangeTheme||e.theme)&&r.value?l("dark"):l()}),C(()=>e.loading,a=>{a?o==null||o.showLoading(A.value):o==null||o.hideLoading()}),e.watchOptions&&C(()=>e.watchOptions,()=>{const a=F();o==null||o.setOption(a)}),je(async()=>{await n()}),Ve(()=>{_e(()=>{e.autoChangeTheme?E(r.value):e.theme?l("dark"):l(),e.autoResize&&(b=he(ce,1e3),ye(window,"resize",b))})}),Pe(()=>{w(),fe(window,"resize",b),b.cancel()}),h({echart:s}),{rayChartRef:u,cssVarsRef:x,echartInstance:s}},render(){return t("div",{class:"ray-chart",style:[this.cssVarsRef],ref:"rayChartRef"},null)}}),Lt=R({name:"REchart",setup(){const e=y(),h=y(!1),m=y(!1),r=Ue({loading:!1});return{baseOptions:{legend:{},tooltip:{},xAxis:{type:"category",data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]},yAxis:{type:"value"},series:[{name:"日期",data:[120,200,150,80,70,110,130],type:"bar",showBackground:!0,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"}},{name:"数量",data:[12,220,250,180,20,10,190],type:"bar",showBackground:!0,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"}}]},baseChartRef:e,chartLoading:h,handleLoadingShow:n=>{r.loading=n},chartAria:m,handleAriaShow:n=>{m.value=n},handleChartRenderSuccess:n=>{window.$notification.info({title:"可视化图渲染成功回调函数",content:"可视化图渲染成功, 并且返回了当前可视化图实例",duration:5*1e3}),e.value},basePieOptions:{title:{text:"Referer of a Website",subtext:"Fake Data",left:"center"},tooltip:{trigger:"item"},legend:{orient:"vertical",left:"left"},series:[{name:"Access From",type:"pie",radius:"50%",data:[{value:1048,name:"Search Engine"},{value:735,name:"Direct"},{value:580,name:"Email"},{value:484,name:"Union Ads"},{value:300,name:"Video Ads"}],emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]},baseLineOptions:{title:{text:"Stacked Area Chart"},tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},legend:{data:["Email","Union Ads","Video Ads","Direct","Search Engine"]},toolbox:{feature:{saveAsImage:{}}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:[{type:"category",boundaryGap:!1,data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}],yAxis:[{type:"value"}],series:[{name:"Email",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[120,132,101,134,90,230,210]},{name:"Union Ads",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[220,182,191,234,290,330,310]},{name:"Video Ads",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[150,232,201,154,190,330,410]},{name:"Direct",type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:[320,332,301,334,390,330,320]},{name:"Search Engine",type:"line",stack:"Total",label:{show:!0,position:"top"},areaStyle:{},emphasis:{focus:"series"},data:[820,932,901,934,1290,1330,1320]}]},...Me(r)}},render(){return t("div",{class:"echart"},[t(c,null,{default:()=>[i("RayChart 组件使用")]}),t(Ne,null,{default:()=>[i("该组件会默认以 200*200 宽高进行填充。预设了常用的图、方法组件,如果不满足需求,需要用 use 方法进行手动拓展。该组件实现了自动跟随模板主题切换功能,但是动态切换损耗较大,所以默认不启用")]}),t(c,null,{default:()=>[i("基础使用")]}),t("div",{class:"chart--container"},[t(d,{options:this.baseOptions},null)]),t(c,null,{default:()=>[i("渲染成功后运行回调函数")]}),t("div",{class:"chart--container"},[t(d,{ref:"baseChartRef",options:this.basePieOptions,success:this.handleChartRenderSuccess.bind(this)},null)]),t(c,null,{default:()=>[i("能跟随主题切换的可视化图")]}),t("div",{class:"chart--container"},[t(d,{autoChangeTheme:!0,options:this.baseLineOptions,showAria:this.chartAria},null)]),t(c,null,{default:()=>[i("不跟随主题切换的暗色主题可视化图")]}),t("div",{class:"chart--container"},[t(d,{theme:"dark",options:this.baseOptions},null)]),t(c,null,{default:()=>[i("加载动画")]}),t(T,{value:this.chartLoading,"onUpdate:value":e=>this.chartLoading=e,onUpdateValue:this.handleLoadingShow.bind(this),style:["padding: 18px 0"]},{checked:()=>"隐藏加载动画",unchecked:()=>"显示加载动画"}),t("div",{class:"chart--container"},[t(d,{loading:this.loading,options:this.baseOptions},null)]),t(c,null,{default:()=>[i("贴画可视化图")]}),t(T,{value:this.chartAria,"onUpdate:value":e=>this.chartAria=e,onUpdateValue:this.handleAriaShow.bind(this),style:["padding: 18px 0"]},{checked:()=>"隐藏贴花",unchecked:()=>"显示贴花"}),t("div",{class:"chart--container"},[t(d,{options:this.baseOptions,showAria:this.chartAria},null)])])}});export{Lt as default};
|