vue-data-ui-hq
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
2 lines (1 loc) • 3.96 kB
JavaScript
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),L=require("./useNestedProp-C14rfl0j.cjs"),o=require("./index-ZfICPrrM.cjs"),g={key:0},m=["d","fill"],k=["d","fill"],h=["d","fill"],r=["d","fill"],C=["d","fill"],N=["d","fill"],b=["d","fill"],B={key:1},E=["cx","cy","fill"],q={__name:"Digit",props:{quanta:{type:String,default:null},backgroundColor:{type:String,default:"#e1e5e8"},color:{type:String,default:"#000000"},x:{type:Number,default:0},y:{type:Number,default:0}},setup(e){const $=e,u=t.ref({0:"1111110",1:"0110000",2:"1101101",3:"1111001",4:"0110011",5:"1011011",6:"1011111",7:"1110000",8:"1111111",9:"1111011","-":"0000001",X:"0000000"}),n=t.computed(()=>[void 0,null].includes($.quanta)?u.value.X:u.value[$.quanta]);return(d,x)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[[void 0,null,"."].includes(e.quanta)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("g",g,[t.createElementVNode("path",{d:`M ${e.x} ${e.y} L ${e.x+2} ${e.y-2} L ${e.x+24} ${e.y-2} L ${e.x+26} ${e.y} L ${e.x+24} ${e.y+2} L ${e.x+2} ${e.y+2}Z`,fill:t.unref(n)[0]==1?e.color:e.backgroundColor,stroke:"none"},null,8,m),t.createElementVNode("path",{d:`M ${e.x+26} ${e.y+26} L ${e.x+26} ${e.y+4} L ${e.x+28} ${e.y+2} L ${e.x+30} ${e.y+4} L ${e.x+30} ${e.y+26} L ${e.x+28} ${e.y+28} L ${e.x+26} ${e.y+26}`,fill:t.unref(n)[1]==1?e.color:e.backgroundColor,stroke:"none"},null,8,k),t.createElementVNode("path",{d:`M ${e.x+26} ${e.y+56} L ${e.x+26} ${e.y+34} L ${e.x+28} ${e.y+32} L ${e.x+30} ${e.y+34} L ${e.x+30} ${e.y+56} L ${e.x+28} ${e.y+58} L ${e.x+26} ${e.y+56}`,fill:t.unref(n)[2]==1?e.color:e.backgroundColor,stroke:"none"},null,8,h),t.createElementVNode("path",{d:`M ${e.x+2} ${e.y+58} L ${e.x} ${e.y+60} L ${e.x+2} ${e.y+62} L ${e.x+24} ${e.y+62} L ${e.x+26} ${e.y+60} L ${e.x+24} ${e.y+58} L ${e.x+2} ${e.y+58}`,fill:t.unref(n)[3]==1?e.color:e.backgroundColor,stroke:"none"},null,8,r),t.createElementVNode("path",{d:`M ${e.x} ${e.y+34} L ${e.x-2} ${e.y+32} L ${e.x-4} ${e.y+34} L ${e.x-4} ${e.y+56} L ${e.x-2} ${e.y+58} L ${e.x} ${e.y+56} L ${e.x} ${e.y+34}`,fill:t.unref(n)[4]==1?e.color:e.backgroundColor,stroke:"none"},null,8,C),t.createElementVNode("path",{d:`M ${e.x-2} ${e.y+2} L ${e.x} ${e.y+4} L ${e.x} ${e.y+26} L ${e.x-2} ${e.y+28} L ${e.x-4} ${e.y+26} L ${e.x-4} ${e.y+4} L ${e.x-2} ${e.y+2}`,fill:t.unref(n)[5]==1?e.color:e.backgroundColor,stroke:"none"},null,8,N),t.createElementVNode("path",{d:`M ${e.x+2} ${e.y+28} L ${e.x} ${e.y+30} L ${e.x+2} ${e.y+32} L ${e.x+24} ${e.y+32} L ${e.x+26} ${e.y+30} L ${e.x+24} ${e.y+28} L ${e.x+2} ${e.y+28}`,fill:t.unref(n)[6]==1?e.color:e.backgroundColor,stroke:"none"},null,8,b)])),e.quanta=="."?(t.openBlock(),t.createElementBlock("g",B,[t.createElementVNode("circle",{cx:e.x-8,cy:e.y+60,r:3,fill:e.color},null,8,E)])):t.createCommentVNode("",!0)],64))}},v=["xmlns","viewBox"],M={__name:"vue-ui-digits",props:{dataset:{type:Number,default:0},config:{type:Object,default(){return{}}}},setup(e){const{vue_ui_digits:$}=o.useConfig(),u=e,n=t.computed(()=>L.useNestedProp({userConfig:u.config,defaultConfig:$})),d=t.computed(()=>{const c=(u.dataset||0).toString().split(""),i=[],l={x:10,y:10};let a=0;for(let y=0;y<c.length;y+=1){const f=c[y];i.push({x:l.x+a,y:l.y,quanta:f}),f=="."?a+=2:a+=44}return i}),x=t.computed(()=>Math.max(...d.value.map(c=>c.x))+36);return(c,i)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:t.unref(o.XMLNS),viewBox:`0 0 ${t.unref(x)} 80`,style:t.normalizeStyle(`background:${t.unref(n).backgroundColor};${t.unref(n).height?`height:${t.unref(n).height};`:""}${t.unref(n).width?`width:${t.unref(n).width}`:""}`)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(d),l=>(t.openBlock(),t.createBlock(q,{x:l.x,y:l.y,quanta:l.quanta,color:t.unref(n).digits.color,backgroundColor:t.unref(n).digits.skeletonColor},null,8,["x","y","quanta","color","backgroundColor"]))),256))],12,v))}};exports.default=M;
;