vue-data-ui 2.3.3 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -15
- package/dist/Arrow-BSOdhAJO.cjs +1 -0
- package/dist/Arrow-BjDVSrfA.js +101 -0
- package/dist/BaseIcon-BoKtpbrI.cjs +1 -0
- package/dist/BaseIcon-vmmfWlyR.js +174 -0
- package/dist/DataTable-CaB7GIwQ.js +127 -0
- package/dist/DataTable-ssrNbONo.cjs +1 -0
- package/dist/Legend-DHpoRTAE.js +62 -0
- package/dist/Legend-Dl5IYoxK.cjs +1 -0
- package/dist/Shape-CQT4S7N-.js +107 -0
- package/dist/Shape-CaF4pvOn.cjs +1 -0
- package/dist/Slicer-Bdb1BlrC.js +156 -0
- package/dist/Slicer-QC8nTm24.cjs +1 -0
- package/dist/Title-BNPZwnkp.js +46 -0
- package/dist/Title-Cj_xubjI.cjs +1 -0
- package/dist/Tooltip-CdJ5hegk.cjs +1 -0
- package/dist/Tooltip-ZnJAz6dl.js +94 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/documentation/installation.md +14 -13
- package/dist/html2canvas.esm-BA_v9SIU.cjs +22 -0
- package/dist/html2canvas.esm-d2sM-0Wm.js +4870 -0
- package/dist/index-BMCvLyab.js +10369 -0
- package/dist/index-BkomIE9L.cjs +4 -0
- package/dist/{index.es-ypwniJN8.js → index.es-YufTdp0y.js} +1 -1
- package/dist/{index.es-Dnua3tHc.cjs → index.es-uyeSCnWE.cjs} +1 -1
- package/dist/jspdf.es.min-C660YX78.js +8038 -0
- package/dist/jspdf.es.min-DLYY9DTT.cjs +243 -0
- package/dist/pdf-97UbtKC2.js +44 -0
- package/dist/pdf-Cz3729tZ.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/types/vue-data-ui.d.cts +105 -5
- package/dist/types/vue-data-ui.d.ts +105 -5
- package/dist/useNestedProp-BMxXyPbW.cjs +1 -0
- package/dist/useNestedProp-CkP8xhG_.js +13 -0
- package/dist/usePrinter-BuuBz5JR.js +513 -0
- package/dist/usePrinter-r6uHYEcR.cjs +1 -0
- package/dist/useResponsive-B3TrDDIG.cjs +1 -0
- package/dist/useResponsive-NZB-WLRF.js +187 -0
- package/dist/vue-data-ui-Bc5U1cOP.cjs +9 -0
- package/dist/vue-data-ui-DxeO0iaC.js +254 -0
- package/dist/vue-data-ui.cjs +1 -1
- package/dist/vue-data-ui.js +61 -59
- package/dist/vue-ui-3d-bar-32wM0tiX.js +1085 -0
- package/dist/vue-ui-3d-bar-CgB0fLQT.cjs +19 -0
- package/dist/vue-ui-accordion-CLlVxx3Q.js +77 -0
- package/dist/vue-ui-accordion-SXsobrUt.cjs +1 -0
- package/dist/vue-ui-age-pyramid-D_CY99xF.js +596 -0
- package/dist/vue-ui-age-pyramid-DqiwcOIr.cjs +1 -0
- package/dist/vue-ui-annotator-DvP-IxDm.js +2177 -0
- package/dist/vue-ui-annotator-mntqd3q_.cjs +371 -0
- package/dist/vue-ui-candlestick-C-5u3i-1.js +657 -0
- package/dist/vue-ui-candlestick-C_TvUQvH.cjs +2 -0
- package/dist/vue-ui-carousel-table-BCePqkuz.cjs +1 -0
- package/dist/vue-ui-carousel-table-CAqhsLVx.js +304 -0
- package/dist/vue-ui-chestnut-DhWlw2MD.cjs +6 -0
- package/dist/vue-ui-chestnut-DylSfYMB.js +1051 -0
- package/dist/vue-ui-cursor-B04HJQVl.cjs +1 -0
- package/dist/vue-ui-cursor-DTYEMgbU.js +229 -0
- package/dist/vue-ui-dashboard-Bd0-cmSZ.js +232 -0
- package/dist/vue-ui-dashboard-DFIYwP1s.cjs +1 -0
- package/dist/vue-ui-digits-CW5qNMIk.js +153 -0
- package/dist/vue-ui-digits-Ced5mBJZ.cjs +1 -0
- package/dist/vue-ui-donut-DIhhgvWp.cjs +1 -0
- package/dist/vue-ui-donut-EeVmrVJs.js +743 -0
- package/dist/vue-ui-donut-evolution-BN08Y2hy.js +799 -0
- package/dist/vue-ui-donut-evolution-Ct6KAzs-.cjs +1 -0
- package/dist/vue-ui-dumbbell-BMlxS1Nq.js +624 -0
- package/dist/vue-ui-dumbbell-pextarqH.cjs +9 -0
- package/dist/vue-ui-flow-BXVsbmyb.cjs +1 -0
- package/dist/vue-ui-flow-CHmkgfyb.js +454 -0
- package/dist/vue-ui-galaxy-D4xyd-J1.cjs +1 -0
- package/dist/vue-ui-galaxy-kiVOZOBz.js +485 -0
- package/dist/vue-ui-gauge-BcO-z97J.js +466 -0
- package/dist/vue-ui-gauge-DPFBsbFj.cjs +1 -0
- package/dist/vue-ui-heatmap-DBOKYaJz.cjs +1 -0
- package/dist/vue-ui-heatmap-DD-Bzddj.js +598 -0
- package/dist/vue-ui-kpi-BEgf5yDv.cjs +1 -0
- package/dist/vue-ui-kpi-BS0o7zb9.js +54 -0
- package/dist/vue-ui-mini-loader-Bm5EJxtG.cjs +1 -0
- package/dist/vue-ui-mini-loader-DJEvG6ju.js +131 -0
- package/dist/vue-ui-molecule-DdwnFEBJ.js +750 -0
- package/dist/vue-ui-molecule-DzUqcaxd.cjs +1 -0
- package/dist/vue-ui-mood-radar-B9Gczs_Z.js +548 -0
- package/dist/vue-ui-mood-radar-DbB7m4Ku.cjs +1 -0
- package/dist/vue-ui-nested-donuts-BSINf8hd.cjs +16 -0
- package/dist/vue-ui-nested-donuts-CVQ1CaXo.js +771 -0
- package/dist/vue-ui-onion-D3-6Tv4u.cjs +1 -0
- package/dist/vue-ui-onion-Ut75t7hB.js +554 -0
- package/dist/vue-ui-parallel-coordinate-plot-Bjo09ZTX.js +651 -0
- package/dist/vue-ui-parallel-coordinate-plot-CJGkoIgN.cjs +8 -0
- package/dist/vue-ui-quadrant-CzCvejGn.cjs +1 -0
- package/dist/vue-ui-quadrant-Du9PKvlO.js +1178 -0
- package/dist/vue-ui-quick-chart-BsxsPbjz.cjs +13 -0
- package/dist/vue-ui-quick-chart-u0cPmD3q.js +1310 -0
- package/dist/vue-ui-radar-CBrpuE5r.js +614 -0
- package/dist/vue-ui-radar-DIpCrj1h.cjs +1 -0
- package/dist/vue-ui-rating-CaeGGlCw.js +271 -0
- package/dist/vue-ui-rating-D8fJC8Yt.cjs +1 -0
- package/dist/vue-ui-relation-circle-5DNf880s.js +304 -0
- package/dist/vue-ui-relation-circle-Ky3nPk6S.cjs +1 -0
- package/dist/vue-ui-rings-CffZ4T2S.cjs +1 -0
- package/dist/vue-ui-rings-IE3IdNRF.js +510 -0
- package/dist/vue-ui-scatter-C4GCZm0V.js +874 -0
- package/dist/vue-ui-scatter-TsX5dW9l.cjs +1 -0
- package/dist/vue-ui-screenshot-Bl3oooKI.js +160 -0
- package/dist/vue-ui-screenshot-Bzpg6yof.cjs +3 -0
- package/dist/vue-ui-skeleton-BisWX1sO.js +2064 -0
- package/dist/vue-ui-skeleton-JmGp11-u.cjs +41 -0
- package/dist/vue-ui-smiley-BhSrt9f-.cjs +2 -0
- package/dist/vue-ui-smiley-Sth2pqG1.js +763 -0
- package/dist/vue-ui-spark-trend-C8NSz4l8.cjs +1 -0
- package/dist/vue-ui-spark-trend-DAqO0TW2.js +246 -0
- package/dist/vue-ui-sparkbar-B0zX7NU7.js +242 -0
- package/dist/vue-ui-sparkbar-hL1Q6ObK.cjs +1 -0
- package/dist/vue-ui-sparkgauge-CWR8zJnU.js +157 -0
- package/dist/vue-ui-sparkgauge-tbVqaLCK.cjs +1 -0
- package/dist/vue-ui-sparkhistogram-Dv-lml4g.cjs +1 -0
- package/dist/vue-ui-sparkhistogram-DxqCtDpw.js +244 -0
- package/dist/vue-ui-sparkline-B6pvaBY_.cjs +1 -0
- package/dist/vue-ui-sparkline-BpL1jn7F.js +333 -0
- package/dist/vue-ui-sparkstackbar-BzbuBNIV.js +244 -0
- package/dist/vue-ui-sparkstackbar-CQ2TEi4p.cjs +1 -0
- package/dist/vue-ui-strip-plot-DCC6F4VM.cjs +1 -0
- package/dist/vue-ui-strip-plot-DCcbD6UE.js +618 -0
- package/dist/vue-ui-table-CFqIWfxl.js +1430 -0
- package/dist/vue-ui-table-CseaFWgX.cjs +14 -0
- package/dist/vue-ui-table-heatmap-Bwut-V1D.cjs +1 -0
- package/dist/vue-ui-table-heatmap-Bz8KYDxr.js +237 -0
- package/dist/vue-ui-table-sparkline-CJBU3y8-.cjs +1 -0
- package/dist/vue-ui-table-sparkline-z29ND2lq.js +420 -0
- package/dist/vue-ui-thermometer-BNAITzJa.js +385 -0
- package/dist/vue-ui-thermometer-DM2IKhqN.cjs +1 -0
- package/dist/vue-ui-timer-DLfXuW8T.cjs +64 -0
- package/dist/vue-ui-timer-DV6lQVHU.js +453 -0
- package/dist/vue-ui-tiremarks-B1bd1jPf.cjs +1 -0
- package/dist/vue-ui-tiremarks-WyQPg7yo.js +249 -0
- package/dist/vue-ui-treemap-BZGmoDHb.cjs +1 -0
- package/dist/vue-ui-treemap-DKmBhzV-.js +722 -0
- package/dist/vue-ui-vertical-bar-Bi-0rRN3.cjs +4 -0
- package/dist/vue-ui-vertical-bar-C-ySfrhJ.js +737 -0
- package/dist/vue-ui-waffle-CGRWu-da.js +638 -0
- package/dist/vue-ui-waffle-VLYkR-YZ.cjs +1 -0
- package/dist/vue-ui-wheel-D2q5vy5V.cjs +1 -0
- package/dist/vue-ui-wheel-Pj9OPk9f.js +227 -0
- package/dist/vue-ui-word-cloud-8Vr-jo1p.js +346 -0
- package/dist/vue-ui-word-cloud-Ba4BjatU.cjs +1 -0
- package/dist/vue-ui-xy-C4QW5Lfl.cjs +3 -0
- package/dist/vue-ui-xy-canvas-Be-Da_0x.cjs +9 -0
- package/dist/vue-ui-xy-canvas-DnLWrf0e.js +1006 -0
- package/dist/vue-ui-xy-qToggEfh.js +2064 -0
- package/package.json +1 -1
- package/dist/index-BcMihqI4.cjs +0 -843
- package/dist/index-C7FeCQ7K.js +0 -57303
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-BkomIE9L.cjs"),L=require("./useNestedProp-BMxXyPbW.cjs"),x=require("./BaseIcon-BoKtpbrI.cjs"),M=require("./vue-ui-skeleton-JmGp11-u.cjs"),F=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),j=["id"],q=["xmlns","viewBox"],A=["id"],I=["stop-color"],P=["stop-color"],D={key:0},G=["d","fill"],O=["d","fill"],U=["d","stroke","stroke-width","stroke-linecap","stroke-linejoin"],W=["d","stroke","stroke-width","stroke-linecap","stroke-linejoin"],Z=["height","width","x"],H={style:{width:"100%"}},R=["x","y","fill","font-size","font-weight"],X=["stroke","cx","cy","fill"],J=["x","y","font-size","fill","font-weight"],K={__name:"vue-ui-spark-trend",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},setup(N){const r=N,{vue_ui_spark_trend:$}=u.useConfig(),E=e.computed(()=>!!r.dataset&&r.dataset.length),y=e.ref(u.createUid()),t=e.computed(()=>{const l=L.useNestedProp({userConfig:r.config,defaultConfig:$});return l.theme?{...L.useNestedProp({userConfig:u.themes.vue_ui_spark_trend[l.theme]||r.config,defaultConfig:l})}:l});function k(l){return l.map(n=>[void 0].includes(n)?null:n)}const h=e.ref(r.dataset.map(l=>t.value.style.animation.show||[void 0].includes(l)?null:l)),v=e.ref(!1),g=e.ref(null);e.onMounted(()=>{u.objectIsEmpty(r.dataset)&&u.error({componentName:"VueUiTrendPill",type:"dataset"});let n=1e3/t.value.style.animation.animationFrames,i=performance.now();if(t.value.style.animation.show&&t.value.style.animation.animationFrames&&r.dataset.length>1){let b=function(){v.value=!0;let w=performance.now(),B=w-i;B>n?(i=w-B%n,c<r.dataset.length?(h.value.push(r.dataset[c]),c+=1,g.value=requestAnimationFrame(b)):(cancelAnimationFrame(g.value),h.value=k(r.dataset),v.value=!1)):g.value=requestAnimationFrame(b)};h.value=[];let c=0;b()}});const o=e.ref({height:80,width:300}),d=e.computed(()=>({top:t.value.style.padding.top,left:t.value.style.padding.left,right:o.value.width-t.value.style.padding.right,bottom:o.value.height-t.value.style.padding.bottom,height:o.value.height-(t.value.style.padding.top+t.value.style.padding.bottom)-(t.value.style.dataLabel.show?t.value.style.dataLabel.fontSize:0),width:o.value.width-(t.value.style.padding.left+t.value.style.padding.right)})),_=e.computed(()=>{const l=k(r.dataset);return{max:Math.max(...l),min:Math.min(...l)}}),p=e.computed(()=>{const l=_.value.min>=0?0:_.value.min;return Math.abs(l)}),V=e.computed(()=>_.value.max+p.value);function C(l){return l/V.value}const T=e.computed(()=>r.dataset.length),a=e.computed(()=>h.value.map((l,n)=>{const i=isNaN(l)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l)?0:l||0;return{value:l,absoluteValue:i,plotValue:i+p.value,toMax:C(i+p.value),x:d.value.left+n*(d.value.width/(T.value-1))-t.value.style.padding.right,y:d.value.bottom-d.value.height*C(i+p.value)}})),m=e.computed(()=>{const l=k(r.dataset);return t.value.style.trendLabel.trendType==="global"?u.calcTrend(l):t.value.style.trendLabel.trendType==="n-1"&&l.length>1?(l.at(-1)/l.at(-2)-1)*100:t.value.style.trendLabel.trendType==="lastToFirst"?(l.at(-1)/l[0]-1)*100:0}),f=e.computed(()=>v.value||m.value===0?"neutral":m.value>0?"positive":"negative"),s=e.computed(()=>t.value.style.arrow.colors[f.value]),z=e.computed(()=>{const l={x:a.value[0].x,y:o.value.height-6},n={x:a.value[a.value.length-1].x,y:o.value.height-6},i=[];return a.value.forEach(c=>{i.push(`${c.x},${c.y} `)}),[l.x,l.y,...i,n.x,n.y].toString()}),S=e.computed(()=>{let l=[];return a.value.forEach(n=>{l.push(`${n.x},${n.y} `)}),`M ${l.toString()}`});return(l,n)=>(e.openBlock(),e.createElementBlock("div",{class:"vue-ui-spark-trend",id:y.value,style:e.normalizeStyle(`width:100%;font-family:${t.value.style.fontFamily};backgroundColor:${t.value.style.backgroundColor}`)},[E.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(u.XMLNS),viewBox:`0 0 ${o.value.width} ${o.value.height}`,style:e.normalizeStyle(`width:100%;background:${t.value.style.backgroundColor};overflow:visible`)},[e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{x1:"0%",y1:"0%",x2:"0%",y2:"100%",id:`pill_gradient_${y.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":(t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke)+e.unref(u.opacity)[t.value.style.area.opacity]},null,8,I),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.backgroundColor},null,8,P)],8,A)]),t.value.style.area.show&&a.value[0]?(e.openBlock(),e.createElementBlock("g",D,[t.value.style.line.smooth?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${a.value[0].x},${d.value.bottom} ${e.unref(u.createSmoothPath)(a.value)} L ${a.value.at(-1).x},${d.value.bottom} Z`,fill:t.value.style.area.useGradient?`url(#pill_gradient_${y.value})`:`${t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke}${e.unref(u.opacity)[t.value.style.area.opacity]}`,stroke:"none"},null,8,G)):(e.openBlock(),e.createElementBlock("path",{key:1,d:`M${z.value}Z`,fill:t.value.style.area.useGradient?`url(#pill_gradient_${y.value})`:`${t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke}${e.unref(u.opacity)[t.value.style.area.opacity]}`,stroke:"none"},null,8,O))])):e.createCommentVNode("",!0),t.value.style.line.smooth&&a.value.length?(e.openBlock(),e.createElementBlock("path",{key:1,d:`M ${e.unref(u.createSmoothPath)(a.value)}`,stroke:t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke,fill:"none","stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":t.value.style.line.strokeLinecap,"stroke-linejoin":t.value.style.line.strokeLinejoin},null,8,U)):e.createCommentVNode("",!0),!t.value.style.line.smooth&&a.value.length?(e.openBlock(),e.createElementBlock("path",{key:2,d:S.value,stroke:t.value.style.line.useColorTrend?s.value:t.value.style.line.stroke,fill:"none","stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":t.value.style.line.strokeLinecap,"stroke-linejoin":t.value.style.line.strokeLinejoin},null,8,W)):e.createCommentVNode("",!0),v.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("foreignObject",{key:3,height:o.value.height/2,width:o.value.height/2,x:o.value.height/5,y:8},[e.createElementVNode("div",H,[f.value==="positive"?(e.openBlock(),e.createBlock(x.default,{key:0,stroke:s.value,name:"arrowTop",size:o.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0),f.value==="negative"?(e.openBlock(),e.createBlock(x.default,{key:1,stroke:s.value,name:"arrowBottom",size:o.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0),f.value==="neutral"?(e.openBlock(),e.createBlock(x.default,{key:2,stroke:s.value,name:"arrowRight",size:o.value.height/2},null,8,["stroke","size"])):e.createCommentVNode("",!0)])],8,Z)),v.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("text",{key:4,x:o.value.height/2-o.value.height/20,y:d.value.bottom,"text-anchor":"middle",fill:t.value.style.trendLabel.useColorTrend?s.value:t.value.style.trendLabel.color,"font-size":t.value.style.trendLabel.fontSize,"font-weight":t.value.style.trendLabel.bold?"bold":"normal"},e.toDisplayString(e.unref(u.dataLabel)({p:m.value>0?"+":"",v:m.value,s:"%",r:t.value.style.trendLabel.rounding})),9,R)),a.value.length&&a.value.at(-1).x!==void 0?(e.openBlock(),e.createElementBlock("circle",{key:5,stroke:t.value.style.backgroundColor,"stroke-width":2,cx:a.value.at(-1).x,cy:a.value.at(-1).y,r:4,fill:s.value},null,8,X)):e.createCommentVNode("",!0),a.value.length&&a.value.at(-1).x!==void 0&&t.value.style.dataLabel.show?(e.openBlock(),e.createElementBlock("text",{key:6,"text-anchor":"middle",x:a.value.at(-1).x,y:a.value.at(-1).y-t.value.style.dataLabel.fontSize/1.5,"font-size":t.value.style.dataLabel.fontSize,fill:t.value.style.dataLabel.useColorTrend?s.value:t.value.style.dataLabel.color,"font-weight":t.value.style.dataLabel.bold?"bold":"normal"},e.toDisplayString(e.unref(u.dataLabel)({p:t.value.style.dataLabel.prefix,v:a.value.at(-1).value,s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.rounding})),9,J)):e.createCommentVNode("",!0)],12,q)):(e.openBlock(),e.createBlock(M.default,{key:0,config:{type:"sparkline",style:{backgroundColor:t.value.style.backgroundColor,sparkline:{color:"#CCCCCC"}}}},null,8,["config"]))],12,j))}},Q=F._export_sfc(K,[["__scopeId","data-v-456001fa"]]);exports.default=Q;
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { computed as u, ref as p, onMounted as W, openBlock as n, createElementBlock as i, normalizeStyle as j, createBlock as w, unref as c, createElementVNode as g, createCommentVNode as v, toDisplayString as A } from "vue";
|
|
2
|
+
import { u as X, c as Z, t as R, o as H, e as J, P as K, X as Q, r as z, L as I, f as B } from "./index-BMCvLyab.js";
|
|
3
|
+
import { u as E } from "./useNestedProp-CkP8xhG_.js";
|
|
4
|
+
import N from "./BaseIcon-vmmfWlyR.js";
|
|
5
|
+
import Y from "./vue-ui-skeleton-BisWX1sO.js";
|
|
6
|
+
import { _ as ee } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
+
const te = ["id"], le = ["xmlns", "viewBox"], ae = ["id"], ne = ["stop-color"], oe = ["stop-color"], se = { key: 0 }, ue = ["d", "fill"], re = ["d", "fill"], ie = ["d", "stroke", "stroke-width", "stroke-linecap", "stroke-linejoin"], de = ["d", "stroke", "stroke-width", "stroke-linecap", "stroke-linejoin"], ve = ["height", "width", "x"], ce = { style: { width: "100%" } }, he = ["x", "y", "fill", "font-size", "font-weight"], ye = ["stroke", "cx", "cy", "fill"], fe = ["x", "y", "font-size", "fill", "font-weight"], pe = {
|
|
8
|
+
__name: "vue-ui-spark-trend",
|
|
9
|
+
props: {
|
|
10
|
+
config: {
|
|
11
|
+
type: Object,
|
|
12
|
+
default() {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
dataset: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default() {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setup(V) {
|
|
24
|
+
const s = V, { vue_ui_spark_trend: D } = X(), G = u(() => !!s.dataset && s.dataset.length), m = p(Z()), e = u(() => {
|
|
25
|
+
const t = E({
|
|
26
|
+
userConfig: s.config,
|
|
27
|
+
defaultConfig: D
|
|
28
|
+
});
|
|
29
|
+
return t.theme ? {
|
|
30
|
+
...E({
|
|
31
|
+
userConfig: R.vue_ui_spark_trend[t.theme] || s.config,
|
|
32
|
+
defaultConfig: t
|
|
33
|
+
})
|
|
34
|
+
} : t;
|
|
35
|
+
});
|
|
36
|
+
function C(t) {
|
|
37
|
+
return t.map((o) => [void 0].includes(o) ? null : o);
|
|
38
|
+
}
|
|
39
|
+
const k = p(s.dataset.map((t) => e.value.style.animation.show || [void 0].includes(t) ? null : t)), f = p(!1), L = p(null);
|
|
40
|
+
W(() => {
|
|
41
|
+
H(s.dataset) && J({
|
|
42
|
+
componentName: "VueUiTrendPill",
|
|
43
|
+
type: "dataset"
|
|
44
|
+
});
|
|
45
|
+
let o = 1e3 / e.value.style.animation.animationFrames, d = performance.now();
|
|
46
|
+
if (e.value.style.animation.show && e.value.style.animation.animationFrames && s.dataset.length > 1) {
|
|
47
|
+
let T = function() {
|
|
48
|
+
f.value = !0;
|
|
49
|
+
let S = performance.now(), F = S - d;
|
|
50
|
+
F > o ? (d = S - F % o, y < s.dataset.length ? (k.value.push(s.dataset[y]), y += 1, L.value = requestAnimationFrame(T)) : (cancelAnimationFrame(L.value), k.value = C(s.dataset), f.value = !1)) : L.value = requestAnimationFrame(T);
|
|
51
|
+
};
|
|
52
|
+
k.value = [];
|
|
53
|
+
let y = 0;
|
|
54
|
+
T();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const a = p({
|
|
58
|
+
height: 80,
|
|
59
|
+
width: 300
|
|
60
|
+
}), h = u(() => ({
|
|
61
|
+
top: e.value.style.padding.top,
|
|
62
|
+
left: e.value.style.padding.left,
|
|
63
|
+
right: a.value.width - e.value.style.padding.right,
|
|
64
|
+
bottom: a.value.height - e.value.style.padding.bottom,
|
|
65
|
+
height: a.value.height - (e.value.style.padding.top + e.value.style.padding.bottom) - (e.value.style.dataLabel.show ? e.value.style.dataLabel.fontSize : 0),
|
|
66
|
+
width: a.value.width - (e.value.style.padding.left + e.value.style.padding.right)
|
|
67
|
+
})), $ = u(() => {
|
|
68
|
+
const t = C(s.dataset);
|
|
69
|
+
return {
|
|
70
|
+
max: Math.max(...t),
|
|
71
|
+
min: Math.min(...t)
|
|
72
|
+
};
|
|
73
|
+
}), _ = u(() => {
|
|
74
|
+
const t = $.value.min >= 0 ? 0 : $.value.min;
|
|
75
|
+
return Math.abs(t);
|
|
76
|
+
}), O = u(() => $.value.max + _.value);
|
|
77
|
+
function M(t) {
|
|
78
|
+
return t / O.value;
|
|
79
|
+
}
|
|
80
|
+
const P = u(() => s.dataset.length), l = u(() => k.value.map((t, o) => {
|
|
81
|
+
const d = isNaN(t) || [void 0, null, "NaN", NaN, 1 / 0, -1 / 0].includes(t) ? 0 : t || 0;
|
|
82
|
+
return {
|
|
83
|
+
value: t,
|
|
84
|
+
absoluteValue: d,
|
|
85
|
+
plotValue: d + _.value,
|
|
86
|
+
toMax: M(d + _.value),
|
|
87
|
+
x: h.value.left + o * (h.value.width / (P.value - 1)) - e.value.style.padding.right,
|
|
88
|
+
y: h.value.bottom - h.value.height * M(d + _.value)
|
|
89
|
+
};
|
|
90
|
+
})), b = u(() => {
|
|
91
|
+
const t = C(s.dataset);
|
|
92
|
+
return e.value.style.trendLabel.trendType === "global" ? K(t) : e.value.style.trendLabel.trendType === "n-1" && t.length > 1 ? (t.at(-1) / t.at(-2) - 1) * 100 : e.value.style.trendLabel.trendType === "lastToFirst" ? (t.at(-1) / t[0] - 1) * 100 : 0;
|
|
93
|
+
}), x = u(() => f.value || b.value === 0 ? "neutral" : b.value > 0 ? "positive" : "negative"), r = u(() => e.value.style.arrow.colors[x.value]), U = u(() => {
|
|
94
|
+
const t = { x: l.value[0].x, y: a.value.height - 6 }, o = { x: l.value[l.value.length - 1].x, y: a.value.height - 6 }, d = [];
|
|
95
|
+
return l.value.forEach((y) => {
|
|
96
|
+
d.push(`${y.x},${y.y} `);
|
|
97
|
+
}), [t.x, t.y, ...d, o.x, o.y].toString();
|
|
98
|
+
}), q = u(() => {
|
|
99
|
+
let t = [];
|
|
100
|
+
return l.value.forEach((o) => {
|
|
101
|
+
t.push(`${o.x},${o.y} `);
|
|
102
|
+
}), `M ${t.toString()}`;
|
|
103
|
+
});
|
|
104
|
+
return (t, o) => (n(), i("div", {
|
|
105
|
+
class: "vue-ui-spark-trend",
|
|
106
|
+
id: m.value,
|
|
107
|
+
style: j(`width:100%;font-family:${e.value.style.fontFamily};backgroundColor:${e.value.style.backgroundColor}`)
|
|
108
|
+
}, [
|
|
109
|
+
G.value ? (n(), i("svg", {
|
|
110
|
+
key: 1,
|
|
111
|
+
xmlns: c(Q),
|
|
112
|
+
viewBox: `0 0 ${a.value.width} ${a.value.height}`,
|
|
113
|
+
style: j(`width:100%;background:${e.value.style.backgroundColor};overflow:visible`)
|
|
114
|
+
}, [
|
|
115
|
+
g("defs", null, [
|
|
116
|
+
g("linearGradient", {
|
|
117
|
+
x1: "0%",
|
|
118
|
+
y1: "0%",
|
|
119
|
+
x2: "0%",
|
|
120
|
+
y2: "100%",
|
|
121
|
+
id: `pill_gradient_${m.value}`
|
|
122
|
+
}, [
|
|
123
|
+
g("stop", {
|
|
124
|
+
offset: "0%",
|
|
125
|
+
"stop-color": (e.value.style.line.useColorTrend ? r.value : e.value.style.line.stroke) + c(z)[e.value.style.area.opacity]
|
|
126
|
+
}, null, 8, ne),
|
|
127
|
+
g("stop", {
|
|
128
|
+
offset: "100%",
|
|
129
|
+
"stop-color": e.value.style.backgroundColor
|
|
130
|
+
}, null, 8, oe)
|
|
131
|
+
], 8, ae)
|
|
132
|
+
]),
|
|
133
|
+
e.value.style.area.show && l.value[0] ? (n(), i("g", se, [
|
|
134
|
+
e.value.style.line.smooth ? (n(), i("path", {
|
|
135
|
+
key: 0,
|
|
136
|
+
d: `M ${l.value[0].x},${h.value.bottom} ${c(I)(l.value)} L ${l.value.at(-1).x},${h.value.bottom} Z`,
|
|
137
|
+
fill: e.value.style.area.useGradient ? `url(#pill_gradient_${m.value})` : `${e.value.style.line.useColorTrend ? r.value : e.value.style.line.stroke}${c(z)[e.value.style.area.opacity]}`,
|
|
138
|
+
stroke: "none"
|
|
139
|
+
}, null, 8, ue)) : (n(), i("path", {
|
|
140
|
+
key: 1,
|
|
141
|
+
d: `M${U.value}Z`,
|
|
142
|
+
fill: e.value.style.area.useGradient ? `url(#pill_gradient_${m.value})` : `${e.value.style.line.useColorTrend ? r.value : e.value.style.line.stroke}${c(z)[e.value.style.area.opacity]}`,
|
|
143
|
+
stroke: "none"
|
|
144
|
+
}, null, 8, re))
|
|
145
|
+
])) : v("", !0),
|
|
146
|
+
e.value.style.line.smooth && l.value.length ? (n(), i("path", {
|
|
147
|
+
key: 1,
|
|
148
|
+
d: `M ${c(I)(l.value)}`,
|
|
149
|
+
stroke: e.value.style.line.useColorTrend ? r.value : e.value.style.line.stroke,
|
|
150
|
+
fill: "none",
|
|
151
|
+
"stroke-width": e.value.style.line.strokeWidth,
|
|
152
|
+
"stroke-linecap": e.value.style.line.strokeLinecap,
|
|
153
|
+
"stroke-linejoin": e.value.style.line.strokeLinejoin
|
|
154
|
+
}, null, 8, ie)) : v("", !0),
|
|
155
|
+
!e.value.style.line.smooth && l.value.length ? (n(), i("path", {
|
|
156
|
+
key: 2,
|
|
157
|
+
d: q.value,
|
|
158
|
+
stroke: e.value.style.line.useColorTrend ? r.value : e.value.style.line.stroke,
|
|
159
|
+
fill: "none",
|
|
160
|
+
"stroke-width": e.value.style.line.strokeWidth,
|
|
161
|
+
"stroke-linecap": e.value.style.line.strokeLinecap,
|
|
162
|
+
"stroke-linejoin": e.value.style.line.strokeLinejoin
|
|
163
|
+
}, null, 8, de)) : v("", !0),
|
|
164
|
+
f.value ? v("", !0) : (n(), i("foreignObject", {
|
|
165
|
+
key: 3,
|
|
166
|
+
height: a.value.height / 2,
|
|
167
|
+
width: a.value.height / 2,
|
|
168
|
+
x: a.value.height / 5,
|
|
169
|
+
y: 8
|
|
170
|
+
}, [
|
|
171
|
+
g("div", ce, [
|
|
172
|
+
x.value === "positive" ? (n(), w(N, {
|
|
173
|
+
key: 0,
|
|
174
|
+
stroke: r.value,
|
|
175
|
+
name: "arrowTop",
|
|
176
|
+
size: a.value.height / 2
|
|
177
|
+
}, null, 8, ["stroke", "size"])) : v("", !0),
|
|
178
|
+
x.value === "negative" ? (n(), w(N, {
|
|
179
|
+
key: 1,
|
|
180
|
+
stroke: r.value,
|
|
181
|
+
name: "arrowBottom",
|
|
182
|
+
size: a.value.height / 2
|
|
183
|
+
}, null, 8, ["stroke", "size"])) : v("", !0),
|
|
184
|
+
x.value === "neutral" ? (n(), w(N, {
|
|
185
|
+
key: 2,
|
|
186
|
+
stroke: r.value,
|
|
187
|
+
name: "arrowRight",
|
|
188
|
+
size: a.value.height / 2
|
|
189
|
+
}, null, 8, ["stroke", "size"])) : v("", !0)
|
|
190
|
+
])
|
|
191
|
+
], 8, ve)),
|
|
192
|
+
f.value ? v("", !0) : (n(), i("text", {
|
|
193
|
+
key: 4,
|
|
194
|
+
x: a.value.height / 2 - a.value.height / 20,
|
|
195
|
+
y: h.value.bottom,
|
|
196
|
+
"text-anchor": "middle",
|
|
197
|
+
fill: e.value.style.trendLabel.useColorTrend ? r.value : e.value.style.trendLabel.color,
|
|
198
|
+
"font-size": e.value.style.trendLabel.fontSize,
|
|
199
|
+
"font-weight": e.value.style.trendLabel.bold ? "bold" : "normal"
|
|
200
|
+
}, A(c(B)({
|
|
201
|
+
p: b.value > 0 ? "+" : "",
|
|
202
|
+
v: b.value,
|
|
203
|
+
s: "%",
|
|
204
|
+
r: e.value.style.trendLabel.rounding
|
|
205
|
+
})), 9, he)),
|
|
206
|
+
l.value.length && l.value.at(-1).x !== void 0 ? (n(), i("circle", {
|
|
207
|
+
key: 5,
|
|
208
|
+
stroke: e.value.style.backgroundColor,
|
|
209
|
+
"stroke-width": 2,
|
|
210
|
+
cx: l.value.at(-1).x,
|
|
211
|
+
cy: l.value.at(-1).y,
|
|
212
|
+
r: 4,
|
|
213
|
+
fill: r.value
|
|
214
|
+
}, null, 8, ye)) : v("", !0),
|
|
215
|
+
l.value.length && l.value.at(-1).x !== void 0 && e.value.style.dataLabel.show ? (n(), i("text", {
|
|
216
|
+
key: 6,
|
|
217
|
+
"text-anchor": "middle",
|
|
218
|
+
x: l.value.at(-1).x,
|
|
219
|
+
y: l.value.at(-1).y - e.value.style.dataLabel.fontSize / 1.5,
|
|
220
|
+
"font-size": e.value.style.dataLabel.fontSize,
|
|
221
|
+
fill: e.value.style.dataLabel.useColorTrend ? r.value : e.value.style.dataLabel.color,
|
|
222
|
+
"font-weight": e.value.style.dataLabel.bold ? "bold" : "normal"
|
|
223
|
+
}, A(c(B)({
|
|
224
|
+
p: e.value.style.dataLabel.prefix,
|
|
225
|
+
v: l.value.at(-1).value,
|
|
226
|
+
s: e.value.style.dataLabel.suffix,
|
|
227
|
+
r: e.value.style.dataLabel.rounding
|
|
228
|
+
})), 9, fe)) : v("", !0)
|
|
229
|
+
], 12, le)) : (n(), w(Y, {
|
|
230
|
+
key: 0,
|
|
231
|
+
config: {
|
|
232
|
+
type: "sparkline",
|
|
233
|
+
style: {
|
|
234
|
+
backgroundColor: e.value.style.backgroundColor,
|
|
235
|
+
sparkline: {
|
|
236
|
+
color: "#CCCCCC"
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}, null, 8, ["config"]))
|
|
241
|
+
], 12, te));
|
|
242
|
+
}
|
|
243
|
+
}, we = /* @__PURE__ */ ee(pe, [["__scopeId", "data-v-456001fa"]]);
|
|
244
|
+
export {
|
|
245
|
+
we as default
|
|
246
|
+
};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { computed as p, ref as w, onMounted as I, openBlock as i, createElementBlock as r, normalizeStyle as y, unref as n, renderSlot as A, normalizeProps as D, mergeProps as U, createCommentVNode as c, createElementVNode as v, toDisplayString as g, Fragment as F, renderList as j, guardReactiveProps as G, createBlock as q } from "vue";
|
|
2
|
+
import { u as H, c as W, t as X, a as R, p as m, b as J, o as K, e as P, g as Q, d as Y, r as C, f as x, X as Z, s as ee } from "./index-BMCvLyab.js";
|
|
3
|
+
import { u as z } from "./useNestedProp-CkP8xhG_.js";
|
|
4
|
+
import te from "./vue-ui-skeleton-BisWX1sO.js";
|
|
5
|
+
const le = ["onClick"], ae = { key: 1 }, oe = ["xmlns", "viewBox"], se = ["id"], ie = ["stop-color"], ue = ["stop-color"], re = ["height", "width", "fill", "rx"], ne = ["height", "width", "fill", "rx"], ve = ["height", "width", "fill", "rx"], pe = {
|
|
6
|
+
__name: "vue-ui-sparkbar",
|
|
7
|
+
props: {
|
|
8
|
+
config: {
|
|
9
|
+
type: Object,
|
|
10
|
+
default() {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
dataset: {
|
|
15
|
+
type: Array,
|
|
16
|
+
default() {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* Used in VueUiRadar's tooltip exclusively
|
|
22
|
+
*/
|
|
23
|
+
backgroundOpacity: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 100
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
emits: ["selectDatapoint"],
|
|
29
|
+
setup(k, { emit: L }) {
|
|
30
|
+
const a = k, { vue_ui_sparkbar: T } = H(), _ = p(() => !!a.dataset && a.dataset.length), $ = w(W()), e = p(() => {
|
|
31
|
+
const t = z({
|
|
32
|
+
userConfig: a.config,
|
|
33
|
+
defaultConfig: T
|
|
34
|
+
});
|
|
35
|
+
return t.theme ? {
|
|
36
|
+
...z({
|
|
37
|
+
userConfig: X.vue_ui_sparkbar[t.theme] || a.config,
|
|
38
|
+
defaultConfig: t
|
|
39
|
+
}),
|
|
40
|
+
customPalette: R[t.theme] || m
|
|
41
|
+
} : t;
|
|
42
|
+
}), E = p(() => J(e.value.customPalette)), f = w(a.dataset.map((t) => ({
|
|
43
|
+
...t,
|
|
44
|
+
value: e.value.style.animation.show ? 0 : t.value || 0
|
|
45
|
+
})));
|
|
46
|
+
I(() => {
|
|
47
|
+
if (K(a.dataset) && P({
|
|
48
|
+
componentName: "VueUiSparkbar",
|
|
49
|
+
type: "dataset"
|
|
50
|
+
}), e.value.style.animation.show) {
|
|
51
|
+
let N = function() {
|
|
52
|
+
d += l / t, d < l ? (f.value = f.value.map((s, h) => ({
|
|
53
|
+
...s,
|
|
54
|
+
value: s.value += u[h]
|
|
55
|
+
})), requestAnimationFrame(N)) : f.value = a.dataset.map((s) => ({
|
|
56
|
+
...s,
|
|
57
|
+
value: s.value || 0
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
const t = e.value.style.animation.animationFrames, u = a.dataset.map((s, h) => s.value / t), l = a.dataset.map((s) => s.value || 0).reduce((s, h) => s + h, 0);
|
|
61
|
+
let d = 0;
|
|
62
|
+
N();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const o = w({
|
|
66
|
+
width: 500,
|
|
67
|
+
height: 16
|
|
68
|
+
}), O = p(() => Math.max(...a.dataset.map((t) => t.value))), V = p(() => (a.dataset.forEach((t, u) => {
|
|
69
|
+
Q({
|
|
70
|
+
datasetObject: t,
|
|
71
|
+
requiredAttributes: ["name", "value"]
|
|
72
|
+
}).forEach((l) => {
|
|
73
|
+
P({
|
|
74
|
+
componentName: "VueUiSparkbar",
|
|
75
|
+
type: "datasetSerieAttribute",
|
|
76
|
+
property: l,
|
|
77
|
+
index: u
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}), f.value.map((t, u) => ({
|
|
81
|
+
...t,
|
|
82
|
+
value: t.value || 0,
|
|
83
|
+
color: Y(t.color) || E.value[u] || m[u] || m[u % m.length]
|
|
84
|
+
}))));
|
|
85
|
+
function B(t) {
|
|
86
|
+
return t / O.value;
|
|
87
|
+
}
|
|
88
|
+
function S(t) {
|
|
89
|
+
return e.value.style.layout.independant ? t.target ? t.value / t.target : e.value.style.layout.percentage ? t.value / 100 : e.value.style.layout.target === 0 ? 1 : t.value / e.value.style.layout.target : B(t.value);
|
|
90
|
+
}
|
|
91
|
+
function b(t) {
|
|
92
|
+
return e.value.style.layout.independant && t.target || e.value.style.layout.target;
|
|
93
|
+
}
|
|
94
|
+
function M(t, u) {
|
|
95
|
+
L("selectDatapoint", { datapoint: t, index: u });
|
|
96
|
+
}
|
|
97
|
+
return (t, u) => (i(), r("div", {
|
|
98
|
+
style: y({
|
|
99
|
+
width: "100%",
|
|
100
|
+
fontFamily: e.value.style.fontFamily,
|
|
101
|
+
background: e.value.style.backgroundColor + n(C)[a.backgroundOpacity]
|
|
102
|
+
})
|
|
103
|
+
}, [
|
|
104
|
+
t.$slots.title ? A(t.$slots, "title", D(U({ key: 0 }, { title: { ...t.title, title: e.value.style.title.text, subtitle: e.value.style.title.subtitle.text } }))) : c("", !0),
|
|
105
|
+
!t.$slots.title && e.value.style.title.text ? (i(), r("div", {
|
|
106
|
+
key: 1,
|
|
107
|
+
class: "vue-ui-sparkbar-title-container",
|
|
108
|
+
style: y({
|
|
109
|
+
background: e.value.style.title.backgroundColor,
|
|
110
|
+
margin: e.value.style.title.margin,
|
|
111
|
+
textAlign: e.value.style.title.textAlign
|
|
112
|
+
})
|
|
113
|
+
}, [
|
|
114
|
+
v("div", {
|
|
115
|
+
class: "vue-ui-sparkbar-title",
|
|
116
|
+
style: y({
|
|
117
|
+
fontSize: e.value.style.title.fontSize + "px",
|
|
118
|
+
color: e.value.style.title.color,
|
|
119
|
+
fontWeight: e.value.style.title.bold ? "bold" : "normal"
|
|
120
|
+
})
|
|
121
|
+
}, g(e.value.style.title.text), 5),
|
|
122
|
+
e.value.style.title.subtitle.text ? (i(), r("div", {
|
|
123
|
+
key: 0,
|
|
124
|
+
class: "vue-ui-sparkbar-subtitle",
|
|
125
|
+
style: y({
|
|
126
|
+
fontSize: e.value.style.title.subtitle.fontSize + "px",
|
|
127
|
+
color: e.value.style.title.subtitle.color,
|
|
128
|
+
fontWeight: e.value.style.title.subtitle.bold ? "bold" : "normal"
|
|
129
|
+
})
|
|
130
|
+
}, g(e.value.style.title.subtitle.text), 5)) : c("", !0)
|
|
131
|
+
], 4)) : c("", !0),
|
|
132
|
+
(i(!0), r(F, null, j(V.value, (l, d) => (i(), r(F, null, [
|
|
133
|
+
_.value ? (i(), r("div", {
|
|
134
|
+
key: 0,
|
|
135
|
+
style: y(`display:flex !important;${["left", "right"].includes(e.value.style.labels.name.position) ? "flex-direction:row !important" : "flex-direction:column !important"};gap:${e.value.style.gap}px !important;${e.value.style.labels.name.position === "right" ? "row-reverse !important" : ""};align-items:center;${k.dataset.length > 0 && d !== k.dataset.length - 1 ? "margin-bottom:6px" : ""}`),
|
|
136
|
+
onClick: () => M(l, d)
|
|
137
|
+
}, [
|
|
138
|
+
A(t.$slots, "data-label", D(G({ bar: {
|
|
139
|
+
...l,
|
|
140
|
+
target: b(l),
|
|
141
|
+
valueLabel: n(x)({
|
|
142
|
+
p: l.prefix || "",
|
|
143
|
+
v: l.value,
|
|
144
|
+
s: l.suffix || "",
|
|
145
|
+
r: l.rounding || 0
|
|
146
|
+
}),
|
|
147
|
+
targetLabel: n(x)({
|
|
148
|
+
p: l.prefix || "",
|
|
149
|
+
v: b(l),
|
|
150
|
+
s: l.suffix || "",
|
|
151
|
+
r: l.rounding || 0
|
|
152
|
+
})
|
|
153
|
+
} }))),
|
|
154
|
+
t.$slots["data-label"] ? c("", !0) : (i(), r("div", {
|
|
155
|
+
key: 0,
|
|
156
|
+
style: y(`width:${e.value.style.labels.name.width};${["right", "top"].includes(e.value.style.labels.name.position) ? "text-align:left" : "text-align:right"};color:${e.value.style.labels.name.color};font-size:${e.value.style.labels.fontSize}px;font-weight:${e.value.style.labels.name.bold ? "bold" : "normal"}`)
|
|
157
|
+
}, [
|
|
158
|
+
v("span", null, g(l.name), 1),
|
|
159
|
+
e.value.style.labels.value.show ? (i(), r("span", {
|
|
160
|
+
key: 0,
|
|
161
|
+
style: y(`font-weight:${e.value.style.labels.value.bold ? "bold" : "normal"}`)
|
|
162
|
+
}, ": " + g(n(x)({
|
|
163
|
+
p: l.prefix || "",
|
|
164
|
+
v: l.value,
|
|
165
|
+
s: l.suffix || "",
|
|
166
|
+
r: l.rounding || 0
|
|
167
|
+
})), 5)) : c("", !0),
|
|
168
|
+
e.value.style.layout.showTargetValue ? (i(), r("span", ae, g(" " + e.value.style.layout.targetValueText) + " " + g(n(x)({
|
|
169
|
+
p: l.prefix || "",
|
|
170
|
+
v: b(l),
|
|
171
|
+
s: l.suffix || "",
|
|
172
|
+
r: l.rounding || 0
|
|
173
|
+
})), 1)) : c("", !0)
|
|
174
|
+
], 4)),
|
|
175
|
+
(i(), r("svg", {
|
|
176
|
+
xmlns: n(Z),
|
|
177
|
+
viewBox: `0 0 ${o.value.width} ${o.value.height}`,
|
|
178
|
+
width: "100%"
|
|
179
|
+
}, [
|
|
180
|
+
v("defs", null, [
|
|
181
|
+
v("linearGradient", {
|
|
182
|
+
x1: "0%",
|
|
183
|
+
y1: "0%",
|
|
184
|
+
x2: "100%",
|
|
185
|
+
y2: "0%",
|
|
186
|
+
id: `sparkbar_gradient_${d}_${$.value}`
|
|
187
|
+
}, [
|
|
188
|
+
v("stop", {
|
|
189
|
+
offset: "0%",
|
|
190
|
+
"stop-color": `${n(ee)(l.color, 0.03)}${n(C)[100 - e.value.style.bar.gradient.intensity]}`
|
|
191
|
+
}, null, 8, ie),
|
|
192
|
+
v("stop", {
|
|
193
|
+
offset: "100%",
|
|
194
|
+
"stop-color": l.color
|
|
195
|
+
}, null, 8, ue)
|
|
196
|
+
], 8, se)
|
|
197
|
+
]),
|
|
198
|
+
v("rect", {
|
|
199
|
+
height: o.value.height,
|
|
200
|
+
width: o.value.width,
|
|
201
|
+
x: 0,
|
|
202
|
+
y: 0,
|
|
203
|
+
fill: `${e.value.style.gutter.backgroundColor}${n(C)[e.value.style.gutter.opacity]}`,
|
|
204
|
+
rx: o.value.height / 2
|
|
205
|
+
}, null, 8, re),
|
|
206
|
+
v("rect", {
|
|
207
|
+
height: o.value.height,
|
|
208
|
+
width: o.value.width * S(l),
|
|
209
|
+
x: 0,
|
|
210
|
+
y: 0,
|
|
211
|
+
fill: e.value.style.bar.gradient.underlayerColor,
|
|
212
|
+
rx: o.value.height / 2
|
|
213
|
+
}, null, 8, ne),
|
|
214
|
+
v("rect", {
|
|
215
|
+
height: o.value.height,
|
|
216
|
+
width: o.value.width * S(l),
|
|
217
|
+
x: 0,
|
|
218
|
+
y: 0,
|
|
219
|
+
fill: e.value.style.bar.gradient.show ? `url(#sparkbar_gradient_${d}_${$.value})` : l.color,
|
|
220
|
+
rx: o.value.height / 2
|
|
221
|
+
}, null, 8, ve)
|
|
222
|
+
], 8, oe))
|
|
223
|
+
], 12, le)) : c("", !0)
|
|
224
|
+
], 64))), 256)),
|
|
225
|
+
_.value ? c("", !0) : (i(), q(te, {
|
|
226
|
+
key: 2,
|
|
227
|
+
config: {
|
|
228
|
+
type: "sparkbar",
|
|
229
|
+
style: {
|
|
230
|
+
backgroundColor: e.value.style.backgroundColor,
|
|
231
|
+
sparkbar: {
|
|
232
|
+
color: "#CCCCCC"
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}, null, 8, ["config"]))
|
|
237
|
+
], 4));
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
export {
|
|
241
|
+
pe as default
|
|
242
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("./index-BkomIE9L.cjs"),h=require("./useNestedProp-BMxXyPbW.cjs"),_=require("./vue-ui-skeleton-JmGp11-u.cjs"),$=["onClick"],B={key:1},E=["xmlns","viewBox"],V=["id"],z=["stop-color"],D=["stop-color"],P=["height","width","fill","rx"],F=["height","width","fill","rx"],L=["height","width","fill","rx"],A={__name:"vue-ui-sparkbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}},backgroundOpacity:{type:Number,default:100}},emits:["selectDatapoint"],setup(m,{emit:k}){const n=m,{vue_ui_sparkbar:x}=o.useConfig(),p=e.computed(()=>!!n.dataset&&n.dataset.length),y=e.ref(o.createUid()),t=e.computed(()=>{const l=h.useNestedProp({userConfig:n.config,defaultConfig:x});return l.theme?{...h.useNestedProp({userConfig:o.themes.vue_ui_sparkbar[l.theme]||n.config,defaultConfig:l}),customPalette:o.themePalettes[l.theme]||o.palette}:l}),b=e.computed(()=>o.convertCustomPalette(t.value.customPalette)),c=e.ref(n.dataset.map(l=>({...l,value:t.value.style.animation.show?0:l.value||0})));e.onMounted(()=>{if(o.objectIsEmpty(n.dataset)&&o.error({componentName:"VueUiSparkbar",type:"dataset"}),t.value.style.animation.show){let f=function(){s+=a/l,s<a?(c.value=c.value.map((i,d)=>({...i,value:i.value+=u[d]})),requestAnimationFrame(f)):c.value=n.dataset.map(i=>({...i,value:i.value||0}))};const l=t.value.style.animation.animationFrames,u=n.dataset.map((i,d)=>i.value/l),a=n.dataset.map(i=>i.value||0).reduce((i,d)=>i+d,0);let s=0;f()}});const r=e.ref({width:500,height:16}),C=e.computed(()=>Math.max(...n.dataset.map(l=>l.value))),S=e.computed(()=>(n.dataset.forEach((l,u)=>{o.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","value"]}).forEach(a=>{o.error({componentName:"VueUiSparkbar",type:"datasetSerieAttribute",property:a,index:u})})}),c.value.map((l,u)=>({...l,value:l.value||0,color:o.convertColorToHex(l.color)||b.value[u]||o.palette[u]||o.palette[u%o.palette.length]}))));function w(l){return l/C.value}function g(l){return t.value.style.layout.independant?l.target?l.value/l.target:t.value.style.layout.percentage?l.value/100:t.value.style.layout.target===0?1:l.value/t.value.style.layout.target:w(l.value)}function v(l){return t.value.style.layout.independant&&l.target||t.value.style.layout.target}function N(l,u){k("selectDatapoint",{datapoint:l,index:u})}return(l,u)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle({width:"100%",fontFamily:t.value.style.fontFamily,background:t.value.style.backgroundColor+e.unref(o.opacity)[n.backgroundOpacity]})},[l.$slots.title?e.renderSlot(l.$slots,"title",e.normalizeProps(e.mergeProps({key:0},{title:{...l.title,title:t.value.style.title.text,subtitle:t.value.style.title.subtitle.text}}))):e.createCommentVNode("",!0),!l.$slots.title&&t.value.style.title.text?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vue-ui-sparkbar-title-container",style:e.normalizeStyle({background:t.value.style.title.backgroundColor,margin:t.value.style.title.margin,textAlign:t.value.style.title.textAlign})},[e.createElementVNode("div",{class:"vue-ui-sparkbar-title",style:e.normalizeStyle({fontSize:t.value.style.title.fontSize+"px",color:t.value.style.title.color,fontWeight:t.value.style.title.bold?"bold":"normal"})},e.toDisplayString(t.value.style.title.text),5),t.value.style.title.subtitle.text?(e.openBlock(),e.createElementBlock("div",{key:0,class:"vue-ui-sparkbar-subtitle",style:e.normalizeStyle({fontSize:t.value.style.title.subtitle.fontSize+"px",color:t.value.style.title.subtitle.color,fontWeight:t.value.style.title.subtitle.bold?"bold":"normal"})},e.toDisplayString(t.value.style.title.subtitle.text),5)):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,(a,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[p.value?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`display:flex !important;${["left","right"].includes(t.value.style.labels.name.position)?"flex-direction:row !important":"flex-direction:column !important"};gap:${t.value.style.gap}px !important;${t.value.style.labels.name.position==="right"?"row-reverse !important":""};align-items:center;${m.dataset.length>0&&s!==m.dataset.length-1?"margin-bottom:6px":""}`),onClick:()=>N(a,s)},[e.renderSlot(l.$slots,"data-label",e.normalizeProps(e.guardReactiveProps({bar:{...a,target:v(a),valueLabel:e.unref(o.dataLabel)({p:a.prefix||"",v:a.value,s:a.suffix||"",r:a.rounding||0}),targetLabel:e.unref(o.dataLabel)({p:a.prefix||"",v:v(a),s:a.suffix||"",r:a.rounding||0})}}))),l.$slots["data-label"]?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`width:${t.value.style.labels.name.width};${["right","top"].includes(t.value.style.labels.name.position)?"text-align:left":"text-align:right"};color:${t.value.style.labels.name.color};font-size:${t.value.style.labels.fontSize}px;font-weight:${t.value.style.labels.name.bold?"bold":"normal"}`)},[e.createElementVNode("span",null,e.toDisplayString(a.name),1),t.value.style.labels.value.show?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(`font-weight:${t.value.style.labels.value.bold?"bold":"normal"}`)},": "+e.toDisplayString(e.unref(o.dataLabel)({p:a.prefix||"",v:a.value,s:a.suffix||"",r:a.rounding||0})),5)):e.createCommentVNode("",!0),t.value.style.layout.showTargetValue?(e.openBlock(),e.createElementBlock("span",B,e.toDisplayString(" "+t.value.style.layout.targetValueText)+" "+e.toDisplayString(e.unref(o.dataLabel)({p:a.prefix||"",v:v(a),s:a.suffix||"",r:a.rounding||0})),1)):e.createCommentVNode("",!0)],4)),(e.openBlock(),e.createElementBlock("svg",{xmlns:e.unref(o.XMLNS),viewBox:`0 0 ${r.value.width} ${r.value.height}`,width:"100%"},[e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{x1:"0%",y1:"0%",x2:"100%",y2:"0%",id:`sparkbar_gradient_${s}_${y.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":`${e.unref(o.shiftHue)(a.color,.03)}${e.unref(o.opacity)[100-t.value.style.bar.gradient.intensity]}`},null,8,z),e.createElementVNode("stop",{offset:"100%","stop-color":a.color},null,8,D)],8,V)]),e.createElementVNode("rect",{height:r.value.height,width:r.value.width,x:0,y:0,fill:`${t.value.style.gutter.backgroundColor}${e.unref(o.opacity)[t.value.style.gutter.opacity]}`,rx:r.value.height/2},null,8,P),e.createElementVNode("rect",{height:r.value.height,width:r.value.width*g(a),x:0,y:0,fill:t.value.style.bar.gradient.underlayerColor,rx:r.value.height/2},null,8,F),e.createElementVNode("rect",{height:r.value.height,width:r.value.width*g(a),x:0,y:0,fill:t.value.style.bar.gradient.show?`url(#sparkbar_gradient_${s}_${y.value})`:a.color,rx:r.value.height/2},null,8,L)],8,E))],12,$)):e.createCommentVNode("",!0)],64))),256)),p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(_.default,{key:2,config:{type:"sparkbar",style:{backgroundColor:t.value.style.backgroundColor,sparkbar:{color:"#CCCCCC"}}}},null,8,["config"]))],4))}};exports.default=A;
|