UNPKG

vue-data-ui

Version:

A user-empowering data visualization Vue 3 components library for eloquent data storytelling

2 lines (1 loc) 1.76 kB
"use strict";const e=require("vue"),d=require("./index-CBRI5uwl.cjs"),u=require("./Shape-BF6K6die.cjs"),s=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),f=["id"],g=["onClick","height","width"],k={__name:"Legend",props:{legendSet:{type:Array,default(){return[]}},config:{type:Object,default(){return{}}},id:{type:String,default:""},clickable:{type:Boolean,default:!0}},emits:["clickMarker"],setup(t,{emit:c}){const r=c;function a(i,l){r("clickMarker",{legend:i,i:l})}return(i,l)=>(e.openBlock(),e.createElementBlock("div",{id:t.id,class:"vue-data-ui-legend",style:e.normalizeStyle(`background:${t.config.backgroundColor};font-size:${t.config.fontSize}px;color:${t.config.color};padding-bottom:${t.config.paddingBottom}px;padding-top:${t.config.paddingTop||12}px;font-weight:${t.config.fontWeight}`)},[e.renderSlot(i.$slots,"legendTitle",{titleSet:t.legendSet},void 0,!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.legendSet,(n,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"vue-data-ui-legend-item":!0,active:t.clickable})},[n.shape?(e.openBlock(),e.createElementBlock("svg",{key:0,onClick:h=>a(n,o),height:t.config.fontSize,width:t.config.fontSize,viewBox:"0 0 60 60",style:e.normalizeStyle(`overflow: visible;opacity:${n.opacity}`)},[e.createVNode(u._sfc_main,{shape:n.shape,radius:30,stroke:"none",plot:{x:30,y:30},fill:n.color},null,8,["shape","fill"]),e.renderSlot(i.$slots,"legend-pattern",e.mergeProps({ref_for:!0},{legend:n,index:e.unref(d.isValidUserValue)(n.absoluteIndex)?n.absoluteIndex:o}),void 0,!0)],12,g)):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"item",{legend:n,index:o},void 0,!0)],2))),256))],12,f))}},m=s._export_sfc(k,[["__scopeId","data-v-f1db6c9f"]]);exports.Legend=m;