UNPKG

vue-data-ui

Version:

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

1,278 lines (1,277 loc) 44.1 kB
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js"; import { $ as t, Bt as n, D as r, G as i, Jt as a, Kt as ee, Pt as o, Rt as te, S as ne, Vt as re, X as s, b as ie, ct as ae, i as oe, jt as se, pt as ce, q as le, t as ue, tt as de, w as fe, xt as pe } from "./lib-Bttd6u5E.js"; import { n as me, t as he } from "./useHints-Dq_w2E8B.js"; import { t as ge } from "./useConfig-D3scuR88.js"; import { t as _e } from "./usePrinter-DN5bYhTG.js"; import { n as ve, t as ye } from "./BaseScanner-DZvpgOjM.js"; import { t as be } from "./useSvgExport-DH-FfcqQ.js"; import { t as xe } from "./useNestedProp-vPNvh7rV.js"; import { t as Se } from "./useThemeCheck-C43Tcqmk.js"; import { t as Ce } from "./useTransitions-g_zBREk2.js"; import { t as we } from "./img-Bnokohej.js"; import { n as Te } from "./Title-BE3qg9xl.js"; import { t as Ee } from "./Shape-C21CMlWS.js"; import { t as De } from "./_plugin-vue_export-helper-B3ysoDQm.js"; import { l as Oe, t as ke } from "./useResponsive-ZtArZtUf.js"; import { t as Ae } from "./DefGrad-DVBqDjhO.js"; import { t as je } from "./BaseLegendToggle-DZVucLnv.js"; import { t as Me } from "./A11yDataTable-DdRsVULz.js"; import { t as Ne } from "./useUserOptionState-DK-_1ddE.js"; import { t as Pe } from "./useChartAccessibility-DYqac8yF.js"; import { t as Fe } from "./labelUtils-BeVpDvTJ.js"; import { t as Ie } from "./Legend-CQxUgOd-.js"; import { t as Le } from "./vue_ui_rings-BVgD2aMn.js"; import { Fragment as Re, Teleport as ze, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createSlots as Be, createTextVNode as Ve, createVNode as He, defineAsyncComponent as p, guardReactiveProps as m, mergeProps as Ue, nextTick as We, normalizeClass as h, normalizeProps as g, normalizeStyle as _, onBeforeUnmount as Ge, onMounted as Ke, openBlock as v, ref as y, renderList as qe, renderSlot as b, resolveDynamicComponent as Je, shallowRef as Ye, toDisplayString as Xe, toRefs as Ze, unref as x, useSlots as Qe, watch as $e, withCtx as S } from "vue"; //#region src/components/vue-ui-rings.vue var et = /* @__PURE__ */ e({ default: () => bt }), tt = ["id"], nt = ["id"], rt = ["id"], it = { style: { position: "relative" } }, at = [ "xmlns", "viewBox", "aria-describedby" ], ot = ["width", "height"], st = { key: 1 }, ct = [ "stroke", "cx", "cy", "r", "fill" ], lt = [ "stroke", "stroke-width", "cx", "cy", "r", "fill" ], ut = [ "stroke", "stroke-width", "cx", "cy", "r", "fill" ], dt = [ "cx", "cy", "r", "onMouseenter", "onMouseleave", "onClick" ], ft = [ "x", "y", "width", "height", "fill", "rx" ], pt = [ "cx", "cy", "r", "fill", "stroke" ], mt = [ "text-anchor", "font-size", "fill", "font-weight", "transform", "onMouseenter", "onMouseleave", "onClick", "innerHTML" ], ht = { key: 0, style: { position: "absolute", top: "100%", left: "0", width: "100%" }, "data-dom-to-png-ignore": "", "aria-hidden": "true" }, gt = { key: 5, class: "vue-data-ui-watermark" }, _t = ["id"], vt = ["onClick"], yt = ["innerHTML"], bt = /*#__PURE__*/ De({ __name: "vue-ui-rings", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Array, default() { return []; } } }, emits: ["selectLegend", "copyAlt"], setup(e, { expose: De, emit: et }) { let bt = p(() => import("./Tooltip-DhjyfHwz.js")), xt = p(() => import("./BaseIcon-BfndwIWE.js").then((e) => e.n)), St = p(() => import("./vue-ui-accordion-BxGriZik.js").then((e) => e.n)), Ct = p(() => import("./DataTable-BbKgJ5UI.js")), wt = p(() => import("./PenAndPaper-DAE-tnEQ.js").then((e) => e.t)), Tt = p(() => import("./UserOptions-Dt98of5H.js").then((e) => e.n)), Et = p(() => import("./PackageVersion-D6d8SCp9.js").then((e) => e.t)), Dt = p(() => import("./BaseDraggableDialog-LoqqwRtV.js").then((e) => e.n)), { vue_ui_rings: Ot } = ge(), { isThemeValid: kt, warnInvalidTheme: At } = Se(), jt = Qe(), C = e, w = y(!1), Mt = c(() => !!C.dataset && C.dataset.length), T = y(le()), E = y(!1), Nt = y(""), D = y(null), Pt = y(0), O = y(null), Ft = y(null), It = y(null), Lt = y(null), Rt = y(null), zt = y(0), Bt = y(0), Vt = y(0), Ht = y(!1), Ut = y(!1), k = y(null), Wt = y(null), Gt = y(!1), Kt = y(!1), A = y(null), qt = y({ x: 0, y: 0 }), j = y("pointer"), Jt = y(!1), M = y(tn()); me({ config: () => M.value, dataset: () => C.dataset, component: "VueUiRings", rules: [ he.singleSeries, he.emptyArray, { test: (e) => e.length > 6, message: [ "👀 The number of series is > 6. Consider:", "", "▶️ Grouping small values dynamically into a single \"Other\" series.", "", "▶️ Using filters to let users choose a maximum number of series to display.", "", "▶️ Using VueUiHorizontalBar instead to make the dataset breakdown easier to read." ] } ] }); let { transitionEnabled: N } = Ce({ config: () => M.value.transitions, dataset: () => C.dataset }), P = c(() => M.value.userOptions.useCursorPointer), Yt = c(() => a({ defaultConfig: { userOptions: { show: !1 }, table: { show: !1 }, style: { chart: { backgroundColor: "#99999930", layout: { rings: { stroke: "#6A6A6A", gradient: { underlayerColor: "#FFFFFF" } }, labels: { dataLabels: { show: !1 } } }, legend: { backgroundColor: "transparent" } } } }, userConfig: M.value.skeletonConfig ?? {} })), { loading: F, FINAL_DATASET: Xt, manualLoading: Zt } = ve({ ...Ze(C), FINAL_CONFIG: M, prepareConfig: tn, skeletonDataset: C.config?.skeletonDataset ?? [ { name: "_", values: [13], color: "#808080" }, { name: "_", values: [8], color: "#969696" }, { name: "_", values: [5], color: "#ADADAD" }, { name: "_", values: [3], color: "#C4C4C4" }, { name: "_", values: [2], color: "#DBDBDB" } ], skeletonConfig: a({ defaultConfig: M.value, userConfig: Yt.value }) }), { userOptionsVisible: Qt, setUserOptionsVisibility: $t, keepUserOptionState: en } = Ne({ config: M.value }), { svgRef: I } = Pe({ config: M.value.style.chart.title }); function tn() { let e = xe({ userConfig: C.config, defaultConfig: Ot }), t = e.theme; if (!t) return e; if (!kt.value(e)) return At(e), e; let n = xe({ userConfig: Le[t] || C.config, defaultConfig: e }); return { ...xe({ userConfig: C.config, defaultConfig: n }), customPalette: e.customPalette.length ? e.customPalette : ee[e.theme] || o }; } $e(() => C.config, (e) => { F.value || (M.value = tn()), Qt.value = !M.value.userOptions.showOnChartHover, an(), zt.value += 1, Bt.value += 1, Vt.value += 1, B.value.showTable = M.value.table.show, B.value.showTooltip = M.value.style.chart.tooltip.show, B.value.showLabels = M.value.style.chart.layout.labels.dataLabels.show, V.value.width = M.value.style.chart.size, V.value.height = M.value.style.chart.size; }, { deep: !0 }); let nn = c(() => { let { markers: e } = M.value.style.chart.layout.labels.dataLabels, t = J.value / 2, n = B.value.showLabels ? e.position === "left" ? t : -t : 0, r = B.value.showLabels ? V.value.width / 2 - t : 0, i = e.position === "left" ? r : -r; return { x: M.value.responsive ? i : n / M.value.style.chart.size * V.value.width, y: 0 / M.value.style.chart.size * V.value.height }; }), L = c(() => ({ x: V.value.width / 2 + nn.value.x, y: V.value.height / 2 + nn.value.y })); $e(() => C.dataset, (e) => { Array.isArray(e) && e.length > 0 && (Zt.value = !1); }, { deep: !0 }); let R = Ye(null), z = Ye(null); Ke(() => { Ut.value = !0, an(); }); let rn = c(() => !!M.value.debug); function an() { if (se(C.dataset) ? (de({ componentName: "VueUiRings", type: "dataset", debug: rn.value }), Zt.value = !0) : C.dataset.forEach((e, t) => { e.values.length || (de({ componentName: "VueUiRings", type: "dataset", debug: rn.value }), Zt.value = !0), ce({ datasetObject: e, requiredAttributes: ["name", "values"] }).forEach((e) => { de({ componentName: "VueUiRings", type: "datasetSerieAttribute", property: e, index: t, debug: rn.value }); }); }), se(C.dataset) || (Zt.value = M.value.loading), M.value.responsive) { let e = Oe(() => { Ht.value = !0; let { width: e, height: t } = ke({ chart: O.value, title: M.value.style.chart.title.text ? Ft.value : null, legend: M.value.style.chart.legend.show ? It.value : null, source: Lt.value, noTitle: Rt.value }); requestAnimationFrame(() => { V.value.width = e, V.value.height = t - 12, Ht.value = !1; }); }); R.value && (z.value && R.value.unobserve(z.value), R.value.disconnect()), R.value = new ResizeObserver(e), z.value = O.value.parentNode, R.value.observe(z.value); } setTimeout(() => { w.value = !0; }, 600); } Ge(() => { R.value && (z.value && R.value.unobserve(z.value), R.value.disconnect()); }); let { isPrinting: on, isImaging: sn, generatePdf: cn, generateImage: ln } = _e({ elementId: `rings_${T.value}`, fileName: M.value.style.chart.title.text || "vue-ui-rings", options: M.value.userOptions.print }), un = c(() => M.value.userOptions.show && !M.value.style.chart.title.text), dn = c(() => fe(M.value.customPalette)), B = y({ showTable: M.value.table.show, showTooltip: M.value.style.chart.tooltip.show, showLabels: M.value.style.chart.layout.labels.dataLabels.show }); $e(M, () => { B.value = { showTable: M.value.table.show, showTooltip: M.value.style.chart.tooltip.show, showLabels: M.value.style.chart.layout.labels.dataLabels.show }; }, { immediate: !0 }); let V = y({ height: M.value.style.chart.size, width: M.value.style.chart.size }), fn = c(() => Math.min(V.value.height, V.value.width)), pn = et, H = y([]); function mn() { H.value.length ? H.value = [] : G.value.forEach((e) => { H.value.push(e.uid); }), hn(); } function hn() { pn("selectLegend", q.value.map((e) => ({ name: e.name, color: e.color, value: e.value }))); } function U(e) { if (H.value.includes(e)) H.value = H.value.filter((t) => t !== e); else { if (H.value.length === W.value.length - 1) return; H.value.push(e); } hn(); } function gn(e) { return W.value.length ? W.value.find((t) => t.name === e) || (M.value.debug && console.warn(`VueUiRings - Series name not found "${e}"`), null) : (M.value.debug && console.warn("VueUiRings - There are no series to show."), null); } function _n(e) { let t = gn(e); t !== null && H.value.includes(t.uid) && U(t.uid); } function vn(e) { let t = gn(e); t !== null && (H.value.includes(t.uid) || U(t.uid)); } let yn = c(() => Math.max(...W.value.filter((e) => !H.value.includes(e.uid)).map(({ value: e }) => e))); function bn(e) { return e / yn.value; } let W = c(() => Xt.value.map(({ values: e, name: t, color: n = null }, r) => { let i = te(e).reduce((e, t) => e + t, 0); return { name: t, color: n || ne(n) || dn.value[r] || o[r] || o[r % o.length], value: i, proportion: i / Xt.value.map((e) => (e.values || []).reduce((e, t) => e + t, 0)).reduce((e, t) => e + t, 0), uid: le(), absoluteIndex: r }; })), G = c(() => W.value.map((e, t) => { let n = oe(M.value.style.chart.layout.labels.dataLabels.formatter, e.value, s({ p: M.value.style.chart.layout.labels.dataLabels.prefix, v: e.value, s: M.value.style.chart.layout.labels.dataLabels.suffix, r: M.value.style.chart.legend.roundingValue }), { datapoint: e, index: t }), r = isNaN(e.value / K.value) ? "-" : s({ v: e.value / K.value * 100, s: "%", r: M.value.style.chart.legend.roundingPercentage }), i = Tn({ showVal: M.value.style.chart.legend.showValue, showPercentage: M.value.style.chart.legend.showPercentage, val: n, percentage: H.value.includes(e.uid) ? "-%" : r }); return { ...e, shape: "circle", opacity: H.value.includes(e.uid) ? .5 : 1, segregate: () => U(e.uid), isSegregated: H.value.includes(e.uid), display: `${e.name}${M.value.style.chart.legend.showPercentage || M.value.style.chart.legend.showValue ? ": " : ""}${i}` }; }).toSorted((e, t) => t.value - e.value)), xn = c(() => ({ cy: "rings-div-legend", backgroundColor: M.value.style.chart.legend.backgroundColor, color: M.value.style.chart.legend.color, fontSize: M.value.style.chart.legend.fontSize, paddingBottom: 12, fontWeight: M.value.style.chart.legend.bold ? "bold" : "" })), K = c(() => W.value.filter((e) => !H.value.includes(e.uid)).map(({ value: e }) => e).reduce((e, t) => e + t, 0)), q = c(() => W.value.filter((e) => !H.value.includes(e.uid)).map(({ name: e, value: t, color: n = null, uid: r, absoluteIndex: i }, a) => ({ absoluteIndex: i, uid: r, name: e, color: n || ne(n) || dn.value[a] || o[a] || o[a % o.length], value: t, proportion: bn(t), percentage: t / K.value * 100, strokeWidth: M.value.style.chart.layout.rings.strokeWidth * bn(t) })).toSorted((e, t) => t.value - e.value)); function Sn() { return q.value.map(({ name: e, color: t, value: n, absoluteValues: r, percentage: i }) => ({ name: e, color: t, value: n, absoluteValues: r, percentage: i })); } let J = c(() => fn.value - M.value.style.chart.layout.rings.strokeWidth * 2); function Cn(e, t) { M.value.events.datapointClick && M.value.events.datapointClick({ datapoint: e, seriesIndex: t }); } function wn(e, t) { D.value = null, E.value = !1, A.value = null, j.value = "pointer", M.value.events.datapointLeave && M.value.events.datapointLeave({ datapoint: e, seriesIndex: t }); } function Tn({ val: e, percentage: t, showVal: n, showPercentage: r }) { let i = M.value.style.chart.layout.labels.dataLabels; return Fe({ config: i, val: e, percentage: t, showVal: n, showPercentage: r }); } function En(e) { let t = M.value.style.chart.layout.labels.dataLabels, n = oe(t.formatter, e.value, s({ p: t.prefix, v: e.value, s: t.suffix, r: t.roundingValue })), r = s({ v: e.percentage, s: "%", r: t.roundingPercentage }); return `${e.name}\n${Tn({ val: n, percentage: r, showVal: t.showValue, showPercentage: t.showPercentage })}`; } function Y(e) { return ie(J.value * e.proportion / 2 * .9 <= 0 ? 1e-4 : J.value * e.proportion / 2 * .9); } function Dn(e, t) { return t === 0 ? L.value.y : L.value.y + J.value * q.value[0].proportion / 2 - J.value * e.proportion / 2 - 2 * (t + 1); } function X(e, t) { let n = M.value.style.chart.layout.labels.dataLabels.markers.position === "left" ? -(J.value / 2) : J.value / 2; return { x: L.value.x + n, y: Dn(e, t) - Y(e) }; } let On = y(null); function kn(e, t, n = "pointer") { if (M.value.events.datapointEnter && M.value.events.datapointEnter({ datapoint: e, seriesIndex: t }), H.value.length === C.dataset.length) return; On.value = { datapoint: e, seriesIndex: t, series: q.value, config: M.value }, D.value = t, A.value = t, j.value = n; let r = q.value[t], i = M.value.style.chart.tooltip.customFormat; if (pe(i) && ae(() => i({ seriesIndex: t, datapoint: e, series: q.value, config: M.value }))) Nt.value = i({ seriesIndex: t, datapoint: e, series: q.value, config: M.value }); else { let n = ""; n += `<div style="width:100%;text-align:center;border-bottom:1px solid ${M.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${r.name}</div>`, n += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 60 60" height="14" width="14"><circle cx="30" cy="30" r="30" stroke="none" fill="${r.color}" />${jt.pattern ? `<circle cx="30" cy="30" r="30" stroke="none" fill="url(#pattern_${T.value}_${e.absoluteIndex})" />` : ""}</svg>`, n += `<b>${Tn({ showVal: M.value.style.chart.tooltip.showValue, showPercentage: M.value.style.chart.tooltip.showPercentage, val: `<span>${oe(M.value.style.chart.layout.labels.dataLabels.formatter, r.value, s({ p: M.value.style.chart.layout.labels.dataLabels.prefix, v: r.value, s: M.value.style.chart.layout.labels.dataLabels.suffix, r: M.value.style.chart.tooltip.roundingValue }), { datapoint: e, seriesIndex: t })}</span>`, percentage: s({ v: r.value / K.value * 100, s: "%", r: M.value.style.chart.tooltip.roundingPercentage }) })}</b></div>`, Nt.value = n; } E.value = !0; } let Z = c(() => ({ head: q.value.map((e) => ({ name: e.name, color: e.color })), body: q.value.map((e) => e.value) })), Q = c(() => { let e = [ " <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2\" /></svg>", s({ p: M.value.style.chart.layout.labels.dataLabels.prefix, v: K.value, s: M.value.style.chart.layout.labels.dataLabels.suffix, r: M.value.table.td.roundingValue }), "100%" ], t = Z.value.head.map((e, t) => [ { color: e.color, name: e.name }, s({ p: M.value.style.chart.layout.labels.dataLabels.prefix, v: Z.value.body[t], s: M.value.style.chart.layout.labels.dataLabels.suffix, r: M.value.table.td.roundingValue }), isNaN(Z.value.body[t] / K.value) ? "-" : (Z.value.body[t] / K.value * 100).toFixed(M.value.table.td.roundingPercentage) + "%" ]); return { head: e, body: t, a11yBody: t.map((e) => e.map((e, t) => t === 0 ? e.name : e)), config: { th: { backgroundColor: M.value.table.th.backgroundColor, color: M.value.table.th.color, outline: M.value.table.th.outline }, td: { backgroundColor: M.value.table.td.backgroundColor, color: M.value.table.td.color, outline: M.value.table.td.outline }, breakpoint: M.value.table.responsiveBreakpoint }, colNames: [ M.value.table.columnNames.series, M.value.table.columnNames.value, M.value.table.columnNames.percentage ] }; }); function An(e = null) { We(() => { let n = Z.value.head.map((e, t) => [ [e.name], [Z.value.body[t]], [isNaN(Z.value.body[t] / K.value) ? "-" : Z.value.body[t] / K.value * 100] ]), i = [ [M.value.style.chart.title.text], [M.value.style.chart.title.subtitle.text], [ [""], ["val"], ["%"] ] ].concat(n), a = r(i); e ? e(a) : t({ csvContent: a, title: M.value.style.chart.title.text || "vue-ui-rings" }); }); } let $ = y(!1); function jn(e) { $.value = e, Pt.value += 1; } function Mn() { B.value.showTable = !B.value.showTable; } function Nn() { B.value.showTooltip = !B.value.showTooltip; } function Pn() { B.value.showLabels = !B.value.showLabels; } let Fn = y(!1); function In() { Fn.value = !Fn.value; } async function Ln({ scale: e = 2 } = {}) { if (!O.value) return; let { width: t, height: n } = O.value.getBoundingClientRect(), r = t / n, { imageUri: i, base64: a } = await we({ domElement: O.value, base64: !0, img: !0, scale: e }); return { imageUri: i, base64: a, title: M.value.style.chart.title.text, width: t, height: n, aspectRatio: r }; } let Rn = c(() => { let e = M.value.table.useDialog && !M.value.table.show, t = B.value.showTable; return { component: e ? Dt : St, title: `${M.value.style.chart.title.text}${M.value.style.chart.title.subtitle.text ? `: ${M.value.style.chart.title.subtitle.text}` : ""}`, props: e ? { backgroundColor: M.value.table.th.backgroundColor, color: M.value.table.th.color, headerColor: M.value.table.th.color, headerBg: M.value.table.th.backgroundColor, isFullscreen: $.value, fullscreenParent: O.value, forcedWidth: Math.min(800, window.innerWidth * .8), isCursorPointer: P.value } : { hideDetails: !0, config: { open: t, maxHeight: 1e4, body: { backgroundColor: M.value.style.chart.backgroundColor, color: M.value.style.chart.color }, head: { backgroundColor: M.value.style.chart.backgroundColor, color: M.value.style.chart.color } } } }; }); $e(() => B.value.showTable, (e) => { M.value.table.show || (e && M.value.table.useDialog && k.value ? k.value.open() : "close" in k.value && k.value.close()); }); function zn() { B.value.showTable = !1, Wt.value && Wt.value.setTableIconState(!1); } let Bn = c(() => G.value.map((e) => ({ ...e, name: e.display }))), Vn = c(() => M.value.style.chart.backgroundColor), Hn = c(() => M.value.style.chart.legend), Un = c(() => M.value.style.chart.title), { exportSvg: Wn, getSvg: Gn } = be({ svg: I, title: Un, legend: Hn, legendItems: Bn, backgroundColor: Vn }); async function Kn({ isCb: e }) { Kt.value = !0, await We(); try { if (e) { let { blob: e, url: t, text: n, dataUrl: r } = await Gn(); await Promise.resolve(M.value.userOptions.callbacks.svg({ blob: e, url: t, text: n, dataUrl: r })); } else await Promise.resolve(Wn()); } finally { Kt.value = !1; } } function qn(e) { if (e?.stage === "start") { Gt.value = !0; return; } if (e?.stage === "end") { Gt.value = !1; return; } ln(); } async function Jn() { if (pn("copyAlt", { config: M.value, dataset: q.value }), !M.value.userOptions.callbacks.altCopy) { console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions."); return; } await Promise.resolve(M.value.userOptions.callbacks.altCopy({ config: M.value, dataset: q.value })); } function Yn() { A.value = null, Jt.value = !0; } function Xn() { A.value = null, j.value = "pointer", E.value = !1, D.value = null, Jt.value = !1; } function Zn(e) { if (!I.value || Fn.value || document.activeElement !== I.value || !q.value.length || H.value.length === C.dataset.length) return; let t = ["ArrowLeft", "ArrowUp"].includes(e.key), n = ["ArrowRight", "ArrowDown"].includes(e.key), r = e.key === "Enter" || e.key === " ", i = e.key === "Escape"; if (!t && !n && !r && !i) return; if (e.preventDefault(), e.stopPropagation(), i) { A.value = null, j.value = "pointer", E.value = !1, D.value = null; return; } if (r) { if (A.value === null) return; let e = q.value[A.value]; if (!e) return; Cn(e, A.value); return; } let a = A.value; a === null || a < 0 || a >= q.value.length ? a = n ? 0 : q.value.length - 1 : n ? (a += 1, a >= q.value.length && (a = 0)) : t && (--a, a < 0 && (a = q.value.length - 1)); let ee = q.value[a]; ee && (Qn(a), kn(ee, a, "keyboard")); } function Qn(e) { if (!Number.isFinite(e) || !I.value) return; let t = q.value[e]; if (!t) return; let n = X(t, e), r = I.value.getBoundingClientRect(); qt.value = { x: r.left + n.x / V.value.width * r.width, y: r.top + n.y / V.value.height * r.height }; } let $n = c(() => ({ headers: Q.value?.colNames ?? [], rows: Q.value?.a11yBody ?? [] })); return De({ getData: Sn, getImage: Ln, generatePdf: cn, generateCsv: An, generateImage: ln, generateSvg: Kn, hideSeries: vn, showSeries: _n, toggleTable: Mn, toggleTooltip: Nn, toggleAnnotator: In, toggleFullscreen: jn, toggleLabels: Pn, copyAlt: Jn }), (e, t) => (v(), d("div", { ref_key: "ringsChart", ref: O, class: h(`vue-data-ui-component vue-ui-rings ${$.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${M.value.useCssAnimation ? "" : "vue-ui-dna"}`), style: _(`font-family:${M.value.style.fontFamily};text-align:center;width:100%;background:${M.value.style.chart.backgroundColor};${M.value.responsive ? "height: 100%" : ""}`), id: `rings_${T.value}`, onMouseleave: t[2] ||= (e) => { D.value = null, E.value = !1, x($t)(!1); }, onMouseenter: t[3] ||= () => x($t)(!0) }, [ f("div", { id: `chart-instructions-${T.value}`, class: "sr-only" }, [f("p", null, Xe(M.value.a11y.translations.keyboardNavigation), 1)], 8, nt), $n.value?.rows?.length ? (v(), l(Me, { key: 0, uid: T.value, head: $n.value.headers, body: $n.value.rows, notice: M.value.a11y.translations.tableAvailable, caption: M.value.a11y.translations.tableCaption }, null, 8, [ "uid", "head", "body", "notice", "caption" ])) : u("", !0), M.value.userOptions.buttons.annotator ? (v(), l(x(wt), { key: 1, svgRef: x(I), backgroundColor: M.value.style.chart.backgroundColor, color: M.value.style.chart.color, active: Fn.value, isCursorPointer: P.value, onClose: In }, { "annotator-action-close": S(() => [b(e.$slots, "annotator-action-close", {}, void 0, !0)]), "annotator-action-color": S(({ color: t }) => [b(e.$slots, "annotator-action-color", g(m({ color: t })), void 0, !0)]), "annotator-action-draw": S(({ mode: t }) => [b(e.$slots, "annotator-action-draw", g(m({ mode: t })), void 0, !0)]), "annotator-action-undo": S(({ disabled: t }) => [b(e.$slots, "annotator-action-undo", g(m({ disabled: t })), void 0, !0)]), "annotator-action-redo": S(({ disabled: t }) => [b(e.$slots, "annotator-action-redo", g(m({ disabled: t })), void 0, !0)]), "annotator-action-delete": S(({ disabled: t }) => [b(e.$slots, "annotator-action-delete", g(m({ disabled: t })), void 0, !0)]), _: 3 }, 8, [ "svgRef", "backgroundColor", "color", "active", "isCursorPointer" ])) : u("", !0), un.value ? (v(), d("div", { key: 2, ref_key: "noTitle", ref: Rt, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : u("", !0), M.value.style.chart.title.text ? (v(), d("div", { key: 3, ref_key: "chartTitle", ref: Ft, style: "width:100%;background:transparent" }, [(v(), l(Te, { key: `title_${zt.value}`, config: { title: { cy: "rings-div-title", ...M.value.style.chart.title }, subtitle: { cy: "rings-div-subtitle", ...M.value.style.chart.title.subtitle } } }, null, 8, ["config"]))], 512)) : u("", !0), f("div", { id: `legend-top-${T.value}` }, null, 8, rt), M.value.userOptions.show && Mt.value && (x(en) || x(Qt)) ? (v(), l(x(Tt), { ref_key: "userOptionsRef", ref: Wt, key: `user_options_${Pt.value}`, backgroundColor: M.value.style.chart.backgroundColor, color: M.value.style.chart.color, isPrinting: x(on), isImaging: x(sn), uid: T.value, hasTooltip: M.value.userOptions.buttons.tooltip && M.value.style.chart.tooltip.show, hasPdf: M.value.userOptions.buttons.pdf, hasXls: M.value.userOptions.buttons.csv, hasImg: M.value.userOptions.buttons.img, hasSvg: M.value.userOptions.buttons.svg, hasTable: M.value.userOptions.buttons.table, hasFullscreen: M.value.userOptions.buttons.fullscreen, hasAltCopy: M.value.userOptions.buttons.altCopy, hasLabel: M.value.userOptions.buttons.labels, isTooltip: B.value.showTooltip, isFullscreen: $.value, titles: { ...M.value.userOptions.buttonTitles }, chartElement: O.value, position: M.value.userOptions.position, hasAnnotator: M.value.userOptions.buttons.annotator, isAnnotation: Fn.value, callbacks: M.value.userOptions.callbacks, printScale: M.value.userOptions.print.scale, tableDialog: M.value.table.useDialog, isCursorPointer: P.value, onToggleFullscreen: jn, onGeneratePdf: x(cn), onGenerateCsv: An, onGenerateImage: qn, onGenerateSvg: Kn, onToggleTable: Mn, onToggleTooltip: Nn, onToggleAnnotator: In, onToggleLabels: Pn, onCopyAlt: Jn, style: _({ visibility: x(en) ? x(Qt) ? "visible" : "hidden" : "visible" }) }, Be({ _: 2 }, [ e.$slots.menuIcon ? { name: "menuIcon", fn: S(({ isOpen: t, color: n }) => [b(e.$slots, "menuIcon", g(m({ isOpen: t, color: n })), void 0, !0)]), key: "0" } : void 0, e.$slots.optionTooltip ? { name: "optionTooltip", fn: S(() => [b(e.$slots, "optionTooltip", {}, void 0, !0)]), key: "1" } : void 0, e.$slots.optionPdf ? { name: "optionPdf", fn: S(() => [b(e.$slots, "optionPdf", {}, void 0, !0)]), key: "2" } : void 0, e.$slots.optionCsv ? { name: "optionCsv", fn: S(() => [b(e.$slots, "optionCsv", {}, void 0, !0)]), key: "3" } : void 0, e.$slots.optionImg ? { name: "optionImg", fn: S(() => [b(e.$slots, "optionImg", {}, void 0, !0)]), key: "4" } : void 0, e.$slots.optionSvg ? { name: "optionSvg", fn: S(() => [b(e.$slots, "optionSvg", {}, void 0, !0)]), key: "5" } : void 0, e.$slots.optionTable ? { name: "optionTable", fn: S(() => [b(e.$slots, "optionTable", {}, void 0, !0)]), key: "6" } : void 0, e.$slots.optionLabels ? { name: "optionLabels", fn: S(() => [b(e.$slots, "optionLabels", {}, void 0, !0)]), key: "7" } : void 0, e.$slots.optionFullscreen ? { name: "optionFullscreen", fn: S(({ toggleFullscreen: t, isFullscreen: n }) => [b(e.$slots, "optionFullscreen", g(m({ toggleFullscreen: t, isFullscreen: n })), void 0, !0)]), key: "8" } : void 0, e.$slots.optionAnnotator ? { name: "optionAnnotator", fn: S(({ toggleAnnotator: t, isAnnotator: n }) => [b(e.$slots, "optionAnnotator", g(m({ toggleAnnotator: t, isAnnotator: n })), void 0, !0)]), key: "9" } : void 0, e.$slots.optionAltCopy ? { name: "optionAltCopy", fn: S(({ altCopy: t }) => [b(e.$slots, "optionAltCopy", g(m({ altCopy: t })), void 0, !0)]), key: "10" } : void 0, e.$slots["custom-menu-before"] ? { name: "custom-menu-before", fn: S(() => [b(e.$slots, "custom-menu-before", {}, void 0, !0)]), key: "11" } : void 0, e.$slots["custom-menu-after"] ? { name: "custom-menu-after", fn: S(() => [b(e.$slots, "custom-menu-after", {}, void 0, !0)]), key: "12" } : void 0 ]), 1032, /* @__PURE__ */ "backgroundColor.color.isPrinting.isImaging.uid.hasTooltip.hasPdf.hasXls.hasImg.hasSvg.hasTable.hasFullscreen.hasAltCopy.hasLabel.isTooltip.isFullscreen.titles.chartElement.position.hasAnnotator.isAnnotation.callbacks.printScale.tableDialog.isCursorPointer.onGeneratePdf.style".split("."))) : u("", !0), f("div", it, [(v(), d("svg", { ref_key: "svgRef", ref: I, xmlns: x(ue), class: h({ "vue-data-ui-fullscreen--on": $.value, "vue-data-ui-fulscreen--off": !$.value, resizing: Ht.value || x(F), "vue-data-ui-no-transition": !x(N) }), viewBox: `0 0 ${V.value.width <= 0 ? 10 : V.value.width} ${V.value.height <= 0 ? 10 : V.value.height}`, style: _(`max-width:100%;overflow:hidden;background:transparent;color:${M.value.style.chart.color}`), "aria-describedby": `chart-instructions-${T.value}`, tabindex: "0", onFocus: Yn, onBlur: Xn, onKeydown: Zn }, [ He(x(Et)), e.$slots["chart-background"] ? (v(), d("foreignObject", { key: 0, x: 0, y: 0, width: V.value.width <= 0 ? 10 : V.value.width, height: V.value.height <= 0 ? 10 : V.value.height, style: { pointerEvents: "none" } }, [b(e.$slots, "chart-background", {}, void 0, !0)], 8, ot)) : u("", !0), f("defs", null, [(v(!0), d(Re, null, qe(q.value, (e, t) => (v(), l(Ae, { t: "radial", cx: "50%", cy: "30%", r: "50%", fx: "50%", fy: "50%", id: `gradient_${T.value}_${t}`, key: `gradient_${T.value}_${t}`, stops: [[ "0%", x(n)(x(re)(e.color, .05), 100 - M.value.style.chart.layout.rings.gradient.intensity), 1 ], [ "100%", e.color, 1 ]] }, null, 8, ["id", "stops"]))), 128))]), e.$slots.pattern ? (v(), d("g", st, [(v(!0), d(Re, null, qe(q.value, (t) => (v(), d("defs", null, [b(e.$slots, "pattern", Ue({ ref_for: !0 }, { seriesIndex: t.absoluteIndex, patternId: `pattern_${T.value}_${t.absoluteIndex}` }), void 0, !0)]))), 256))])) : u("", !0), (v(!0), d(Re, null, qe(q.value, (t, n) => (v(), d("g", { key: `r_${t.uid}` }, [ f("circle", { class: h({ "vue-data-ui-transition": w.value && x(N), "vue-rings-item-onload": !w.value && M.value.useCssAnimation && !x(F), "vue-ui-rings-opacity": D.value !== null && D.value !== n }), style: _(`animation-delay:${n * 100}ms`), stroke: M.value.style.chart.layout.rings.stroke, cx: L.value.x, cy: Dn(t, n), r: Y(t), fill: M.value.style.chart.layout.rings.gradient.underlayerColor }, null, 14, ct), f("circle", { class: h({ "vue-data-ui-transition": w.value && x(N), "vue-rings-item-onload": !w.value && M.value.useCssAnimation && !x(F), "vue-ui-rings-shadow": M.value.style.chart.layout.rings.useShadow, "vue-ui-rings-blur": D.value !== null && D.value !== n }), style: _(`animation-delay:${n * 100}ms`), stroke: M.value.style.chart.layout.rings.stroke, "stroke-width": t.strokeWidth < .5 ? .5 : t.strokeWidth, cx: L.value.x, cy: Dn(t, n), r: Y(t), fill: M.value.style.chart.layout.rings.gradient.show ? `url(#gradient_${T.value}_${n})` : t.color }, null, 14, lt), e.$slots.pattern ? (v(), d("circle", { key: 0, class: h({ "vue-data-ui-transition": w.value && x(N), "vue-rings-item-onload": !w.value && M.value.useCssAnimation && !x(F), "vue-ui-rings-shadow": M.value.style.chart.layout.rings.useShadow, "vue-ui-rings-blur": D.value !== null && D.value !== n }), style: _(`animation-delay:${n * 100}ms`), stroke: M.value.style.chart.layout.rings.stroke, "stroke-width": t.strokeWidth < .5 ? .5 : t.strokeWidth, cx: L.value.x, cy: Dn(t, n), r: Y(t), fill: `url(#pattern_${T.value}_${t.absoluteIndex})` }, null, 14, ut)) : u("", !0), f("circle", { stroke: "none", cx: L.value.x, cy: Dn(t, n), r: Y(t), fill: "transparent", onMouseenter: (e) => kn(t, n, "pointer"), onMouseleave: (e) => wn(t, n), onClick: (e) => Cn(t, n) }, null, 40, dt), B.value.showLabels ? (v(), d(Re, { key: 1 }, [ f("rect", { x: M.value.style.chart.layout.labels.dataLabels.markers.position === "left" ? X(t, n).x : L.value.x, y: X(t, n).y - M.value.style.chart.layout.labels.dataLabels.markers.strokeWidth / 2, width: Math.abs(L.value.x - X(t, n).x), height: M.value.style.chart.layout.labels.dataLabels.markers.strokeWidth, fill: M.value.style.chart.layout.labels.dataLabels.markers.stroke, rx: M.value.style.chart.layout.labels.dataLabels.markers.strokeWidth, class: h({ "vue-data-ui-transition": w.value && x(N), "vue-rings-item-onload": !w.value && M.value.useCssAnimation && !x(F), "vue-ui-rings-shadow": M.value.style.chart.layout.rings.useShadow, "vue-ui-rings-blur": D.value !== null && D.value !== n }) }, null, 10, ft), f("circle", { cx: X(t, n).x, cy: X(t, n).y, r: M.value.style.chart.layout.labels.dataLabels.markers.radius, fill: t.color, stroke: M.value.style.chart.backgroundColor, class: h({ "vue-data-ui-transition": w.value && x(N), "vue-rings-item-onload": !w.value && M.value.useCssAnimation && !x(F), "vue-ui-rings-shadow": M.value.style.chart.layout.rings.useShadow, "vue-ui-rings-blur": D.value !== null && D.value !== n }) }, null, 10, pt), f("text", { "text-anchor": M.value.style.chart.layout.labels.dataLabels.markers.position === "left" ? "end" : "start", "font-size": M.value.style.chart.layout.labels.dataLabels.fontSize, fill: M.value.style.chart.layout.labels.dataLabels.color, "font-weight": M.value.style.chart.layout.labels.dataLabels.bold ? "bold" : "normal", class: h({ "vue-data-ui-transition": w.value && x(N), "vue-rings-item-onload": !w.value && M.value.useCssAnimation && !x(F), "vue-ui-rings-shadow": M.value.style.chart.layout.rings.useShadow, "vue-ui-rings-blur": D.value !== null && D.value !== n }), transform: `translate(${X(t, n).x + (M.value.style.chart.layout.labels.dataLabels.markers.position === "left" ? -M.value.style.chart.layout.labels.dataLabels.offsetX - 6 : M.value.style.chart.layout.labels.dataLabels.offsetX) + 6}, ${X(t, n).y + M.value.style.chart.layout.labels.dataLabels.fontSize / 3})`, onMouseenter: (e) => kn(t, n, "pointer"), onMouseleave: (e) => wn(t, n), onClick: (e) => Cn(t, n), innerHTML: x(i)({ content: En(t), fontSize: M.value.style.chart.layout.labels.dataLabels.fontSize, fill: M.value.style.chart.layout.labels.dataLabels.color, x: 0, y: 0, translateY: !0 }) }, null, 42, mt) ], 64)) : u("", !0) ]))), 128)), b(e.$slots, "svg", { svg: { ...V.value, isPrintingImg: x(on) || x(sn) || Gt.value, isPrintingSvg: Kt.value } }, void 0, !0) ], 46, at)), e.$slots.hint ? (v(), d("div", ht, [b(e.$slots, "hint", g(m({ hint: M.value.a11y.translations.keyboardNavigation, isVisible: Jt.value })), void 0, !0)])) : u("", !0)]), e.$slots.watermark ? (v(), d("div", gt, [b(e.$slots, "watermark", g(m({ isPrinting: x(on) || x(sn) || Gt.value || Kt.value })), void 0, !0)])) : u("", !0), f("div", { id: `legend-bottom-${T.value}` }, null, 8, _t), Ut.value && (M.value.style.chart.legend.show || e.$slots.legend) ? (v(), l(ze, { key: 6, to: M.value.style.chart.legend.position === "top" ? `#legend-top-${T.value}` : `#legend-bottom-${T.value}` }, [f("div", { ref_key: "chartLegend", ref: It }, [b(e.$slots, "legend", { legend: G.value }, () => [M.value.style.chart.legend.show ? (v(), l(Ie, { key: `legend_${Vt.value}`, legendSet: G.value, config: xn.value, isCursorPointer: P.value, onClickMarker: t[0] ||= ({ legend: e }) => U(e.uid) }, Be({ item: S(({ legend: e, index: t }) => [x(F) ? u("", !0) : (v(), d("div", { key: 0, onClick: (t) => U(e.uid), style: _(`opacity:${H.value.includes(e.uid) ? .5 : 1}`) }, Xe(e.display), 13, vt))]), legendToggle: S(() => [G.value.length > 2 && M.value.style.chart.legend.selectAllToggle.show && !x(F) ? (v(), l(je, { key: 0, backgroundColor: M.value.style.chart.legend.selectAllToggle.backgroundColor, color: M.value.style.chart.legend.selectAllToggle.color, fontSize: M.value.style.chart.legend.fontSize, checked: H.value.length > 0, isCursorPointer: P.value, onToggle: mn }, null, 8, [ "backgroundColor", "color", "fontSize", "checked", "isCursorPointer" ])) : u("", !0)]), _: 2 }, [e.$slots.pattern ? { name: "legend-pattern", fn: S(({ legend: e, index: t }) => [He(Ee, { shape: e.shape, radius: 30, stroke: "none", plot: { x: 30, y: 30 }, fill: `url(#pattern_${T.value}_${t})` }, null, 8, ["shape", "fill"])]), key: "0" } : void 0]), 1032, [ "legendSet", "config", "isCursorPointer" ])) : u("", !0)], !0)], 512)], 8, ["to"])) : u("", !0), e.$slots.source ? (v(), d("div", { key: 7, ref_key: "source", ref: Lt, dir: "auto" }, [b(e.$slots, "source", {}, void 0, !0)], 512)) : u("", !0), He(x(bt), { teleportTo: M.value.style.chart.tooltip.teleportTo, show: B.value.showTooltip && E.value && H.value.length < C.dataset.length, backgroundColor: M.value.style.chart.tooltip.backgroundColor, color: M.value.style.chart.tooltip.color, borderRadius: M.value.style.chart.tooltip.borderRadius, borderColor: M.value.style.chart.tooltip.borderColor, borderWidth: M.value.style.chart.tooltip.borderWidth, fontSize: M.value.style.chart.tooltip.fontSize, backgroundOpacity: M.value.style.chart.tooltip.backgroundOpacity, position: M.value.style.chart.tooltip.position, offsetX: M.value.style.chart.tooltip.offsetX, offsetY: M.value.style.chart.tooltip.offsetY, parent: O.value, content: Nt.value, isFullscreen: $.value, isCustom: M.value.style.chart.tooltip.customFormat && typeof M.value.style.chart.tooltip.customFormat == "function", smooth: M.value.style.chart.tooltip.smooth, backdropFilter: M.value.style.chart.tooltip.backdropFilter, smoothForce: M.value.style.chart.tooltip.smoothForce, smoothSnapThreshold: M.value.style.chart.tooltip.smoothSnapThreshold, isA11yMode: j.value === "keyboard", a11yPosition: qt.value }, { "tooltip-before": S(() => [b(e.$slots, "tooltip-before", g(m({ ...On.value })), void 0, !0)]), tooltip: S(() => [b(e.$slots, "tooltip", g(m({ ...On.value })), void 0, !0)]), "tooltip-after": S(() => [b(e.$slots, "tooltip-after", g(m({ ...On.value })), void 0, !0)]), _: 3 }, 8, [ "teleportTo", "show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetX", "offsetY", "parent", "content", "isFullscreen", "isCustom", "smooth", "backdropFilter", "smoothForce", "smoothSnapThreshold", "isA11yMode", "a11yPosition" ]), Mt.value && M.value.userOptions.buttons.table ? (v(), l(Je(Rn.value.component), Ue({ key: 8 }, Rn.value.props, { ref_key: "tableUnit", ref: k, onClose: zn }), Be({ content: S(() => [(v(), l(x(Ct), { key: `table_${Bt.value}`, colNames: Q.value.colNames, head: Q.value.head, body: Q.value.body, config: Q.value.config, title: M.value.table.useDialog ? "" : Rn.value.title, withCloseButton: !M.value.table.useDialog, isCursorPointer: P.value, onClose: zn }, { th: S(({ th: e }) => [f("div", { innerHTML: e, style: { display: "flex", "align-items": "center" } }, null, 8, yt)]), td: S(({ td: e }) => [Ve(Xe(e.name || e), 1)]), _: 1 }, 8, [ "colNames", "head", "body", "config", "title", "withCloseButton", "isCursorPointer" ]))]), _: 2 }, [M.value.table.useDialog ? { name: "title", fn: S(() => [Ve(Xe(Rn.value.title), 1)]), key: "0" } : void 0, M.value.table.useDialog ? { name: "actions", fn: S(() => [f("button", { tabindex: "0", class: "vue-ui-user-options-button", onClick: t[1] ||= (e) => An(M.value.userOptions.callbacks.csv), style: _({ cursor: P.value ? "pointer" : "default" }) }, [He(x(xt), { name: "fileCsv", stroke: Rn.value.props.color }, null, 8, ["stroke"])], 4)]), key: "1" } : void 0]), 1040)) : u("", !0), b(e.$slots, "skeleton", {}, () => [x(F) ? (v(), l(ye, { key: 0 })) : u("", !0)], !0) ], 46, tt)); } }, [["__scopeId", "data-v-31e09f14"]]); //#endregion export { et as n, bt as t };