UNPKG

vue-devui

Version:

DevUI components based on Vite and Vue3

2 lines (1 loc) 4.35 kB
(function(t,r){typeof exports=="object"&&typeof module!="undefined"?r(exports,require("vue"),require("echarts"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","echarts","@vueuse/core"],r):(t=typeof globalThis!="undefined"?globalThis:t||self,r(t.index={},t.Vue,t.echarts,t.core))})(this,function(t,r,O,_){"use strict";function v(e){if(e&&e.__esModule)return e;var c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return e&&Object.keys(e).forEach(function(a){if(a!=="default"){var n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(c,a,n.get?n:{enumerable:!0,get:function(){return e[a]}})}}),c.default=e,Object.freeze(c)}var m=v(O);const A={option:{type:Object,default:{}}},d="#4E5057",w="#CED1DB",u="#696C75",L="#868A99",x="#4E5057",h="#D7D8DA",F="#252B3A",s="#9B9FA8",g="#71757F",p="#D7D8DA",y=["#5C8DFF","#BC94FF","#54D2EB","#A6DD82","#FCDA6B","#CA7ED6","#7298F1","#73CEA6","#EDD249","#CAABFF","#85CAFF","#93D99A","#96ADFA","#F4AF8F","#A282E9","#FFBB6B","#69DBB9","#76DBEF","#B1CE4F","#5DA4DC"];function i(e){return e==="dark"?{axisLine:{lineStyle:{color:x}},axisTick:{lineStyle:{color:x}},axisLabel:{textStyle:{color:u}},splitLine:{lineStyle:{type:[3,3],color:d}}}:{axisLine:{lineStyle:{color:p}},axisTick:{lineStyle:{color:p}},axisLabel:{textStyle:{color:s}},splitLine:{lineStyle:{type:[3,3],color:h}}}}const C={defaultColorPalette:y,defaultDarkTheme:{color:y,tooltip:{axisPointer:{label:{show:!1},lineStyle:{color:d,width:2,type:[2,3]},crossStyle:{color:d,width:2,type:[2,3]}},backgroundColor:"rgba(36,37,38,0.96)",extraCssText:"border-radius: 8px;box-shadow: 0 1px 4px 0 rgba(37,43,58,0.1)",borderWidth:0,padding:[8,8],textStyle:{color:L,fontSize:12}},virtualMap:{textStyle:{color:u}},legend:{height:"80%",width:"80%",textStyle:{color:L}},textStyle:{color:u},title:{textStyle:{color:w}},toolbox:{iconStyle:{borderColor:d}},dataZoom:{textStyle:{color:u}},timeline:{lineStyle:{color:d},label:{textStyle:{color:u}}},timeAxis:i("dark"),logAxis:i("dark"),valueAxis:{...i("dark"),axisLine:{show:!1,lineStyle:{color:x}},axisTick:{show:!1}},categoryAxis:{...i("dark"),axisLine:{show:!0,lineStyle:{color:x}},axisTick:{show:!1}},line:{symbol:"circle"},graph:{color:y},geo:{itemStyle:{borderColor:"#fff",areaColor:"#37383A"}}},defaultLightTheme:{color:y,tooltip:{axisPointer:{label:{show:!1},lineStyle:{color:h,width:2,type:[2,3]},crossStyle:{color:h,width:2,type:[2,3]}},backgroundColor:"rgba(255,255,255,0.96)",extraCssText:"border-radius: 8px;box-shadow: 0 1px 4px 0 rgba(37,43,58,0.1)",borderWidth:0,padding:[8,8],textStyle:{color:g,fontSize:12}},virtualMap:{textStyle:{color:s}},legend:{height:"80%",width:"80%",align:"left",textStyle:{color:g}},textStyle:{color:s},title:{textStyle:{color:F}},toolbox:{iconStyle:{borderColor:h}},dataZoom:{textStyle:{color:s}},timeline:{lineStyle:{color:h},label:{textStyle:{color:s}}},timeAxis:i("light"),logAxis:i("light"),valueAxis:{...i("light"),axisLine:{show:!1,lineStyle:{color:p}},axisTick:{show:!1}},categoryAxis:{...i("light"),axisLine:{show:!0,lineStyle:{color:p}},axisTick:{show:!1}},line:{symbol:"emptyCircle",markPoint:{label:{show:!0,color:s}}},graph:{color:y},geo:{itemStyle:{borderColor:"#fff",areaColor:"#eaebed"}}}};var S=r.defineComponent({name:"DChart",props:A,emits:["chartReady"],setup(e,{emit:c}){const{option:a}=_.toRefs(e);let n,l,D=!1,o,b;const T=r.ref(),E=()=>{var f;D=!!((f=l==null?void 0:l.currentTheme)!=null&&f.isDark),n=D?C.defaultDarkTheme:C.defaultLightTheme,o.dispose(),o=m.init(T.value,n),o.setOption(a.value,!0),console.log(a.value),c("chartReady",o)},k=()=>{clearTimeout(b),b=setTimeout(()=>{o.resize()},100)};return r.onMounted(()=>{var f;l=window.devuiThemeService,D=!!((f=l==null?void 0:l.currentTheme)!=null&&f.isDark),n=D?C.defaultDarkTheme:C.defaultLightTheme,o=m.init(T.value,n),l&&l.eventBus.add("themeChanged",E),o.setOption(a.value,!0),c("chartReady",o),window.addEventListener("resize",k)}),r.onUnmounted(()=>{o==null||o.dispatchAction({type:"hideTip"}),l.eventBus.remove("themeChanged",E)}),()=>r.createVNode("div",{ref:T,class:"devui-charts"},null)}}),R={title:"Echarts \u56FE\u8868",category:"\u6F14\u8FDB\u4E2D",status:"100%",install(e){e.component(S.name,S)}};t.DChart=S,t.default=R,t.devuiChartProps=A,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});