UNPKG

vue-devui

Version:

DevUI components based on Vite and Vue3

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