UNPKG

vue-data-ui

Version:

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

1,050 lines (1,045 loc) • 43.9 kB
import { useCssVars as zt, defineAsyncComponent as H, ref as d, shallowRef as et, toRefs as Xt, watch as tt, computed as M, onMounted as at, onBeforeUnmount as ot, createElementBlock as i, openBlock as r, unref as v, normalizeStyle as D, normalizeClass as F, createBlock as V, createCommentVNode as h, renderSlot as $, createElementVNode as T, createSlots as lt, withCtx as S, normalizeProps as ie, guardReactiveProps as ce, withModifiers as nt, createVNode as ke, Fragment as z, renderList as G, mergeProps as Ut, toDisplayString as Q, Teleport as Vt, createTextVNode as jt, nextTick as Yt } from "vue"; import { u as Gt, c as $e, t as Wt, a as qt, p as ve, b as Ht, o as Qt, f as st, g as Zt, d as Jt, e as Kt, X as ea, F as ta, i as we, a0 as aa, ab as oa, v as la, w as na, k as sa } from "./index-q-LPw2IT.js"; import { u as ra } from "./useUserOptionState-BIvW1Kz7.js"; import { u as rt } from "./useNestedProp-04aFeUYu.js"; import { u as ua } from "./useChartAccessibility-9icAAmYg.js"; import { u as ia } from "./usePrinter-DX7efa1s.js"; import { t as ca, u as va } from "./useResponsive-DfdjqQps.js"; import da from "./Legend-DcDSkq99.js"; import ha from "./Title-B55R8CAZ.js"; import { _ as fa } from "./Shape-DHIaJs9G.js"; import ga from "./img-Ctts6JQb.js"; import { u as pa, B as ba } from "./useLoading-D7YHNtLX.js"; import { _ as ma } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const ya = ["id"], ka = ["id"], $a = ["xmlns", "viewBox"], wa = ["width", "height"], Ca = { key: 1 }, Ma = ["id", "d"], xa = { key: 2 }, Aa = ["transform"], Ia = ["d", "fill", "stroke", "stroke-width", "onMouseenter", "onMouseleave", "onClick"], _a = ["d", "fill", "stroke", "stroke-width"], Pa = ["d", "fill"], Ta = ["d", "fill", "stroke", "stroke-width", "onMouseenter", "onClick", "onMouseleave"], Sa = ["d", "fill", "stroke", "stroke-width"], Ba = ["d", "fill", "stroke", "stroke-width"], La = ["d", "fill", "stroke", "stroke-width"], Oa = { key: 0 }, Ea = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], Na = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], Ra = ["cx", "cy", "r", "stroke", "stroke-width", "fill"], Da = ["transform", "fill", "text-anchor", "font-size", "font-weight"], Fa = { key: 1 }, za = ["font-size", "font-weight", "fill"], Xa = ["href"], Ua = ["transform", "text-anchor", "font-size", "font-weight", "fill", "innerHTML"], Va = { key: 4, class: "vue-data-ui-watermark" }, ja = ["id"], Ya = ["onClick"], Ga = { key: 7, "data-dom-to-png-ignore": "", class: "reset-wrapper" }, Wa = { style: { "text-align": "right", width: "100%" } }, qa = { __name: "vue-ui-chord", props: { dataset: { type: Object, default() { return {}; } }, config: { type: Object, default() { return {}; } } }, emits: ["selectLegend", "selectGroup", "selectRibbon"], setup(ut, { expose: it, emit: ct }) { zt((e) => ({ "82435eb8": e.slicerColor })); const vt = H(() => import("./vue-ui-accordion-D46i_gkB.js")), dt = H(() => import("./BaseIcon-CCivwZUq.js")), ht = H(() => import("./DataTable-rj9-mAwF.js")), ft = H(() => import("./PackageVersion-5ZjKSIei.js")), gt = H(() => import("./PenAndPaper-BJ0hcgsa.js")), pt = H(() => import("./UserOptions-DVzyjG-W.js")), { vue_ui_chord: bt } = Gt(), B = ut, oe = ct, E = d(!!B.dataset && Object.hasOwn(B.dataset, "matrix")), k = d($e()), w = d(null), b = d(null), g = d(null), Ce = d(0), N = d(null), Me = d(null), xe = d(null), Ae = d(null), Ie = d(null), de = d(0), he = d(0), fe = d(0), W = d(!1), X = et(null), q = et(null), _e = d(!1), a = d(pe()), { loading: Pe, FINAL_DATASET: C, manualLoading: Z } = pa({ ...Xt(B), FINAL_CONFIG: a, prepareConfig: pe, skeletonDataset: { matrix: [ [12e3, 6e3, 9e3, 3e3], [2e3, 1e4, 2e3, 6001], [8e3, 1600, 8e3, 8001], [1e3, 1e3, 1e3, 7001] ], labels: [], colors: ["#DBDBDB", "#C4C4C4", "#ADADAD", "#969696"] }, skeletonConfig: Wt({ defaultConfig: a.value, userConfig: { useCssAnimation: !1, userOptions: { show: !1 }, table: { show: !1 }, style: { chart: { backgroundColor: "#99999930", legend: { backgroundColor: "transparent" }, arcs: { stroke: "#6A6A6A", labels: { show: !1 } }, ribbons: { stroke: "#6A6A6A", underlayerOpacity: 0, labels: { show: !1 } } } } } }) }), { userOptionsVisible: ge, setUserOptionsVisibility: Te, keepUserOptionState: Se } = ra({ config: a.value }), { svgRef: J } = ua({ config: a.value.style.chart.title }), { isPrinting: Be, isImaging: Le, generatePdf: Oe, generateImage: Ee } = ia({ elementId: `chord_${k.value}`, fileName: a.value.style.chart.title.text || "vue-ui-chord", options: a.value.userOptions.print }), K = d({ showTable: a.value.table.show }); function pe() { const e = rt({ userConfig: B.config, defaultConfig: bt }); return e.theme ? { ...rt({ userConfig: Ht.vue_ui_chord[e.theme] || B.config, defaultConfig: e }), customPalette: qt[e.theme] || ve } : e; } tt(() => B.config, (e) => { Pe.value || (a.value = pe()), ge.value = !a.value.userOptions.showOnChartHover, be(), de.value += 1, he.value += 1, fe.value += 1, A.value = a.value.initialRotation, K.value.showTable = a.value.table.show; }, { deep: !0 }); const Ne = M(() => a.value.debug); tt(() => B.dataset, () => { Re(), be(), de.value += 1, he.value += 1, fe.value += 1; }); function Re() { if (Qt(B.dataset)) { st({ componentName: "VueUiChord", type: "dataset", debug: Ne.value }), E.value = !1, Z.value = !0; return; } const e = Zt({ datasetObject: B.dataset, requiredAttributes: ["matrix"] }); if (e.length) { e.forEach((s) => { st({ componentName: "VueUiChord", type: "datasetAttribute", property: s, debug: Ne.value }); }), E.value = !1, Z.value = !0; return; } const o = B.dataset.matrix; if (!Array.isArray(o) || o.length < 2) { console.warn(`VueUiChord: dataset.matrix requires a minimum of 2 datapoints, for example: matrix:[ [1, 1], [1, 1] ]`), E.value = !1, Z.value = !0; return; } const t = o.length, l = o.findIndex((s) => !Array.isArray(s) || s.length !== t); if (l !== -1) { console.warn( `VueUiChord - Invalid matrix: dataset.matrix at index ${l} has ${Array.isArray(o[l]) ? o[l].length : "NaN"} elements instead of the required ${t} dataset.matrix[${l}] = [${Array.isArray(o[l]) ? o[l].toString() : "invalid"}]` ), E.value = !1, Z.value = !0; return; } E.value = !0, Z.value = !1; } function be() { if (Re(), a.value.responsive) { const e = ca(() => { const { width: o, height: t, heightNoTitle: l, heightSource: s, heightTitle: n, heightLegend: u } = va({ chart: N.value, title: a.value.style.chart.title.text ? Me.value : null, legend: a.value.style.chart.legend.show ? xe.value : null, source: Ae.value, noTitle: Ie.value }), f = n + u + s + l; o < t ? N.value.style.width = "100%" : (N.value.style.height = "100%", J.value.style.height = `calc(100% - ${f}px)`); }, 100); X.value && (q.value && X.value.unobserve(q.value), X.value.disconnect()), X.value = new ResizeObserver(e), q.value = N.value.parentNode, X.value.observe(q.value), e(); } De.value = setTimeout(() => { W.value = !0; }, 500); } function mt() { if (!C.value || !Object.hasOwn(C.value, "matrix") || C.value.matrix.length < 2) { console.warn(`VueUiChord: dataset.matrix requires a minimum of 2 datapoints, for example: matrix:[ [1, 1], [1, 1] ]`), E.value = !1; return; } C.value.matrix.forEach((e, o) => { e.length !== C.value.matrix.length && (console.warn(`VueUiChord - Invalid matrix: dataset.matrix at index ${o} has ${e.length} elements instead of the required ${C.value.matrix.length} dataset.matrix[${o}] = [${e.toString()}] has a length of ${e.length} but should have the same length as the matrix itself (${C.value.matrix.length})`), E.value = !1); }); } const De = d(null); at(() => { _e.value = !0, be(); }); const L = d({ height: 600, width: 600 }), yt = M(() => a.value.userOptions.show && !a.value.style.chart.title.text), kt = M(() => Jt(a.value.customPalette)), p = M(() => ({ inner: L.value.width * 0.3 * a.value.style.chart.arcs.innerRadiusRatio, outer: L.value.width * 0.34 * a.value.style.chart.arcs.outerRadiusRatio })), $t = M(() => a.value.style.chart.arcs.padAngle / 100), m = M(() => ({ matrix: C.value.matrix ?? [[0]], labels: C.value.labels ?? [""], colors: C.value.colors && Array.isArray(C.value.colors) && C.value.colors.length ? C.value.colors.map((e) => Kt(e)) : C.value.matrix.map((e, o) => kt.value[o] || ve[o] || ve[o % ve.length]) })); function wt(e, o) { const t = e.length, l = p.value.inner, s = new Array(t).fill(0); let n = 0; for (let c = 0; c < t; c += 1) for (let y = 0; y < t; y += 1) s[c] += e[c][y], n += e[c][y]; const u = (2 * Math.PI - o * t) / n, f = []; let I = 0; for (let c = 0; c < t; c += 1) { const y = I, P = y + s[c] * u; f.push({ index: c, pattern: `pattern_${k.value}_${c}`, startAngle: y, endAngle: P, name: m.value.labels[c], id: $e(), color: m.value.colors[c], proportion: s[c] / n }), I = P + o; } const _ = []; for (let c = 0; c < t; c += 1) { const y = e[c].map((O, U) => ({ j: U, v: O })); y.sort((O, U) => U.v - O.v); let P = f[c].startAngle; for (const { j: O, v: U } of y) { const Y = P, ae = Y + U * u; _.push({ index: c, subIndex: O, pattern: `pattern_${k.value}_${c}`, startAngle: Y, endAngle: ae, value: U, groupName: m.value.labels[c], groupId: f[c].id, groupColor: m.value.colors[c], midAngle: (Y + ae) / 2, midBaseX: Math.cos((Y + ae) / 2 - Math.PI / 2) * l, midBaseY: Math.sin((Y + ae) / 2 - Math.PI / 2) * l }), P = ae; } } const R = []; for (const c of _) { const y = _.find( (P) => P.index === c.subIndex && P.subIndex === c.index ); R.push({ source: c, target: y, id: $e() }); } return { groups: f, chords: R }; } const x = M(() => { const e = wt(m.value.matrix, $t.value); return mt(), e.chords.sort( (o, t) => Math.max(t.source.value, t.target.value) - Math.max(o.source.value, o.target.value) ), e; }), Ct = M(() => { const e = p.value.outer + a.value.style.chart.ribbons.labels.offset + 12, t = a.value.style.chart.ribbons.labels.fontSize * 0.6, l = []; if (b.value) { const n = b.value; if (n.source.value) { const u = String(n.source.value); l.push({ id: n.id + "-src", theta: n.source.midAngle, w: u.length * t / e, midBaseX: n.source.midBaseX, midBaseY: n.source.midBaseY, groupColor: n.source.groupColor, value: n.source.value }); } if (n.target && n.target.value && n.target.value !== n.source.value) { const u = String(n.target.value); l.push({ id: n.id + "-tgt", theta: n.target.midAngle, w: u.length * t / e, midBaseX: n.target.midBaseX, midBaseY: n.target.midBaseY, groupColor: n.target.groupColor, value: n.target.value }); } return l; } function s(n) { x.value.chords.filter((u) => u.source.groupId === n && u.source.value).forEach((u) => { { const f = String(u.source.value); l.push({ id: u.id + "-src", theta: u.source.midAngle, w: f.length * t / e, midBaseX: u.source.midBaseX, midBaseY: u.source.midBaseY, groupColor: u.source.groupColor, value: u.source.value }); } if (u.target && u.target.value && u.target.value !== u.source.value) { const f = String(u.target.value); l.push({ id: u.id + "-tgt", theta: u.target.midAngle, w: f.length * t / e, midBaseX: u.target.midBaseX, midBaseY: u.target.midBaseY, groupColor: u.target.groupColor, value: u.target.value }); } }); } return g.value && s(g.value), w.value && s(w.value.id), l; }), Mt = M(() => { const e = Ct.value.map((s) => ({ ...s })).sort((s, n) => s.theta - n.theta), o = a.value.style.chart.ribbons.labels.minSeparationDeg * Math.PI / 180; let t = !0, l = 0; for (; t && l++ < 10; ) { t = !1; for (let f = 1; f < e.length; f += 1) { const I = e[f - 1], _ = e[f], R = I.theta + I.w + o; _.theta < R && (_.theta = R, t = !0); } const s = e[0], n = e[e.length - 1], u = n.theta + n.w + o - 2 * Math.PI; s.theta < u && (s.theta = u, t = !0); } return e; }); function Fe(e, o, t, l) { const s = e - Math.PI / 2, n = o - Math.PI / 2, u = Math.cos(s) * t, f = Math.sin(s) * t, I = Math.cos(n) * t, _ = Math.sin(n) * t, R = Math.cos(n) * l, c = Math.sin(n) * l, y = Math.cos(s) * l, P = Math.sin(s) * l, O = o - e > Math.PI ? 1 : 0; return `M${u},${f} A${t},${t} 0 ${O} 1 ${I},${_} L${R},${c} A${l},${l} 0 ${O} 0 ${y},${P} Z`; } function le(e, o) { const t = p.value.inner, l = e.startAngle - Math.PI / 2, s = e.endAngle - Math.PI / 2, n = o.startAngle - Math.PI / 2, u = o.endAngle - Math.PI / 2, f = Math.cos(l) * t, I = Math.sin(l) * t, _ = Math.cos(s) * t, R = Math.sin(s) * t, c = Math.cos(n) * t, y = Math.sin(n) * t, P = Math.cos(u) * t, O = Math.sin(u) * t, U = e.endAngle - e.startAngle > Math.PI ? 1 : 0, Y = o.endAngle - o.startAngle > Math.PI ? 1 : 0; return `M${f},${I}A${t},${t} 0 ${U} 1 ${_},${R}Q0,0 ${c},${y}A${t},${t} 0 ${Y} 1 ${P},${O}Q0,0 ${f},${I}Z`; } const ze = M(() => A.value * Math.PI / 180); function xt(e) { return (e.startAngle + e.endAngle) / 2; } function At(e) { return ((xt(e) + ze.value) % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI); } function It(e) { let o = e + ze.value; return o = (o % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI), o > Math.PI ? "end" : "start"; } function _t(e) { const o = e - Math.PI / 2, t = Math.cos(o) * (p.value.outer + a.value.style.chart.arcs.labels.offset + 24), l = Math.sin(o) * (p.value.outer + a.value.style.chart.arcs.labels.offset + 24); return `translate(${t},${l})`; } function Pt(e, o, t) { const l = e - Math.PI / 2, s = o - Math.PI / 2, n = Math.cos(l) * t, u = Math.sin(l) * t, f = Math.cos(s) * t, I = Math.sin(s) * t, _ = o - e > Math.PI ? 1 : 0; return `M${n},${u} A${t},${t} 0 ${_} 1 ${f},${I}`; } const A = d(a.value.initialRotation), ee = d(!1); let Xe = 0, Ue = 0; function Ve(e) { const o = J.value.getBoundingClientRect(), t = o.left + o.width / 2, l = o.top + o.height / 2, s = e.clientX ?? e.touches[0].clientX, n = e.clientY ?? e.touches[0].clientY; return Math.atan2(n - l, s - t); } function je(e) { !a.value.enableRotation || te.value || (e.preventDefault(), ee.value = !0, Xe = A.value, Ue = Ve(e)); } function ne(e) { if (!ee.value) return; const o = Ve(e); A.value = Xe + (o - Ue) * 180 / Math.PI; } function se() { ee.value = !1; } function Ye(e) { return sa( a.value.style.chart.ribbons.labels.formatter, e, we({ p: a.value.style.chart.ribbons.labels.prefix, v: e, s: a.value.style.chart.ribbons.labels.suffix, r: a.value.style.chart.ribbons.labels.rounding }) ); } at(() => { window.addEventListener("mousemove", ne), window.addEventListener("mouseup", se), window.addEventListener("touchmove", ne, { passive: !1 }), window.addEventListener("touchend", se); }), ot(() => { window.removeEventListener("mousemove", ne), window.removeEventListener("mouseup", se), window.removeEventListener("touchmove", ne), window.removeEventListener("touchend", se), clearTimeout(De.value), X.value && (q.value && X.value.unobserve(q.value), X.value.disconnect()); }); const me = d(!1); function Ge(e) { me.value = e, Ce.value += 1; } function Tt(e, o) { a.value.events.datapointEnter && a.value.events.datapointEnter({ datapoint: e, seriesIndex: o }), !g.value && (w.value = e); } function St(e, o) { w.value = null, a.value.events.datapointLeave && a.value.events.datapointLeave({ datapoint: e, seriesIndex: o }); } function Bt(e, o) { oe("selectGroup", e), a.value.events.datapointClick && a.value.events.datapointClick({ datapoint: e, seriesIndex: o }); } function Lt(e, o) { a.value.events.datapointEnter && a.value.events.datapointEnter({ datapoint: e, seriesIndex: o }), !g.value && (b.value = e); } function Ot(e, o) { b.value = null, a.value.events.datapointLeave && a.value.events.datapointLeave({ datapoint: e, seriesIndex: o }); } function Et(e, o) { oe("selectRibbon", e), a.value.events.datapointClick && a.value.events.datapointClick({ datapoint: e, seriesIndex: o }); } function We(e) { return !g.value && !w.value && !b.value ? 0.8 : (g.value ? g.value === e.source.groupId : w.value ? w.value.id === e.source.groupId : b.value?.id === e.id) ? 1 : 0.1; } function qe(e) { return !g.value && !w.value && !b.value || (g.value ? g.value === e.id : w.value ? w.value.id === e.id : [b.value?.source.groupId, b.value?.target.groupId].includes(e.id)) ? 1 : 0.3; } const te = d(!1); function ye() { te.value = !te.value; } function He() { K.value.showTable = !K.value.showTable; } function Nt() { return x.value; } const j = d(null); function Qe() { const e = a.value.initialRotation; j.value !== null && cancelAnimationFrame(j.value); const o = () => { A.value += (e - A.value) * 0.05, Math.abs(A.value - e) < 0.1 ? (A.value = e, j.value = null) : j.value = requestAnimationFrame(o); }; j.value = requestAnimationFrame(o); } ot(() => { j.value !== null && cancelAnimationFrame(j.value); }); function Ze(e) { e === g.value ? (g.value = null, oe("selectLegend", null)) : (g.value = e, oe("selectLegend", x.value.groups.find((o) => o.id === e))); } const Je = M(() => x.value.groups.map((e, o) => ({ name: e.name, color: e.color, shape: "circle", patternIndex: o, pattern: `pattern_${k.value}_${o}`, id: e.id, select: () => Ze(e.id), opacity: g.value ? g.value === e.id ? 1 : 0.3 : 1 }))), Rt = M(() => ({ cy: "chord-div-legend", backgroundColor: a.value.style.chart.legend.backgroundColor, color: a.value.style.chart.legend.color, fontSize: a.value.style.chart.legend.fontSize, paddingBottom: 12, fontWeight: a.value.style.chart.legend.bold ? "bold" : "" })), re = M(() => { const e = x.value.groups.map((t, l) => ({ name: t.name || l, color: t.color })), o = m.value.matrix; return { head: e, body: o }; }), ue = M(() => { const e = [{ name: "", color: null }, ...re.value.head], o = re.value.body.map((s, n) => [ re.value.head[n], ...re.value.body[n] ]), t = { th: { backgroundColor: a.value.table.th.backgroundColor, color: a.value.table.th.color, outline: a.value.table.th.outline }, td: { backgroundColor: a.value.table.td.backgroundColor, color: a.value.table.td.color, outline: a.value.table.td.outline }, breakpoint: a.value.table.responsiveBreakpoint }; return { colNames: e, head: e, body: o, config: t }; }); function Ke(e = null) { Yt(() => { const o = m.value.matrix.map((s, n) => [ [m.value.labels[n] || n], s ]), t = [ [a.value.style.chart.title.text], [a.value.style.chart.title.subtitle.text], [ [""], ...m.value.labels.map((s, n) => [s || n]) ] ].concat(o), l = la(t); e ? e(l) : na({ csvContent: l, title: a.value.style.chart.title.text || "vue-ui-chord" }); }); } async function Dt({ scale: e = 2 } = {}) { if (!N.value) return; const { width: o, height: t } = N.value.getBoundingClientRect(), l = o / t, { imageUri: s, base64: n } = await ga({ domElement: N.value, base64: !0, img: !0, scale: e }); return { imageUri: s, base64: n, title: a.value.style.chart.title.text, width: o, height: t, aspectRatio: l }; } function Ft(e, o) { return `${m.value.labels[o]}${a.value.style.chart.arcs.labels.showPercentage ? we({ p: " (", v: isNaN(e.proportion) ? 0 : e.proportion * 100, s: "%)", r: a.value.style.chart.arcs.labels.roundingPercentage }) : ""}`; } return it({ getData: Nt, getImage: Dt, generateCsv: Ke, generateImage: Ee, generatePdf: Oe, toggleAnnotator: ye, toggleTable: He, toggleFullscreen: Ge }), (e, o) => (r(), i("div", { ref_key: "chordChart", ref: N, class: F({ "vue-ui-chord": !0, "vue-data-ui-wrapper-fullscreen": me.value, "vue-data-ui-responsive": a.value.responsive }), style: D(`font-family:${a.value.style.fontFamily};width:100%; text-align:center;background:${a.value.style.chart.backgroundColor}`), id: `chord_${k.value}`, onMouseenter: o[2] || (o[2] = () => v(Te)(!0)), onMouseleave: o[3] || (o[3] = () => v(Te)(!1)) }, [ a.value.userOptions.buttons.annotator && v(J) ? (r(), V(v(gt), { key: 0, color: a.value.style.chart.color, backgroundColor: a.value.style.chart.backgroundColor, active: te.value, svgRef: v(J), onClose: ye }, null, 8, ["color", "backgroundColor", "active", "svgRef"])) : h("", !0), $(e.$slots, "userConfig", {}, void 0, !0), yt.value ? (r(), i("div", { key: 1, ref_key: "noTitle", ref: Ie, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : h("", !0), a.value.style.chart.title.text ? (r(), i("div", { key: 2, ref_key: "chartTitle", ref: Me, style: "width:100%;background:transparent;padding-bottom:24px" }, [ (r(), V(ha, { key: `title_${de.value}`, config: { title: { cy: "chord-div-title", ...a.value.style.chart.title }, subtitle: { cy: "chord-div-subtitle", ...a.value.style.chart.title.subtitle } } }, null, 8, ["config"])) ], 512)) : h("", !0), T("div", { id: `legend-top-${k.value}` }, null, 8, ka), a.value.userOptions.show && E.value && (v(Se) || v(ge)) ? (r(), V(v(pt), { ref: "details", key: `user_option_${Ce.value}`, backgroundColor: a.value.style.chart.backgroundColor, color: a.value.style.chart.color, isPrinting: v(Be), isImaging: v(Le), uid: k.value, hasTooltip: !1, hasPdf: a.value.userOptions.buttons.pdf, hasImg: a.value.userOptions.buttons.img, hasXls: a.value.userOptions.buttons.csv, hasTable: a.value.userOptions.buttons.table, hasLabel: !1, hasFullscreen: a.value.userOptions.buttons.fullscreen, isFullscreen: me.value, chartElement: N.value, position: a.value.userOptions.position, titles: { ...a.value.userOptions.buttonTitles }, hasAnnotator: a.value.userOptions.buttons.annotator, isAnnotation: te.value, callbacks: a.value.userOptions.callbacks, printScale: a.value.userOptions.print.scale, onToggleFullscreen: Ge, onGeneratePdf: v(Oe), onGenerateCsv: Ke, onGenerateImage: v(Ee), onToggleTable: He, onToggleAnnotator: ye, style: D({ visibility: v(Se) ? v(ge) ? "visible" : "hidden" : "visible" }) }, lt({ _: 2 }, [ e.$slots.menuIcon ? { name: "menuIcon", fn: S(({ isOpen: t, color: l }) => [ $(e.$slots, "menuIcon", ie(ce({ isOpen: t, color: l })), void 0, !0) ]), key: "0" } : void 0, e.$slots.optionPdf ? { name: "optionPdf", fn: S(() => [ $(e.$slots, "optionPdf", {}, void 0, !0) ]), key: "1" } : void 0, e.$slots.optionCsv ? { name: "optionCsv", fn: S(() => [ $(e.$slots, "optionCsv", {}, void 0, !0) ]), key: "2" } : void 0, e.$slots.optionImg ? { name: "optionImg", fn: S(() => [ $(e.$slots, "optionImg", {}, void 0, !0) ]), key: "3" } : void 0, e.$slots.optionTable ? { name: "optionTable", fn: S(() => [ $(e.$slots, "optionTable", {}, void 0, !0) ]), key: "4" } : void 0, e.$slots.optionFullscreen ? { name: "optionFullscreen", fn: S(({ toggleFullscreen: t, isFullscreen: l }) => [ $(e.$slots, "optionFullscreen", ie(ce({ toggleFullscreen: t, isFullscreen: l })), void 0, !0) ]), key: "5" } : void 0, e.$slots.optionAnnotator ? { name: "optionAnnotator", fn: S(({ toggleAnnotator: t, isAnnotator: l }) => [ $(e.$slots, "optionAnnotator", ie(ce({ toggleAnnotator: t, isAnnotator: l })), void 0, !0) ]), key: "6" } : void 0 ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "chartElement", "position", "titles", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "onGeneratePdf", "onGenerateImage", "style"])) : h("", !0), (r(), i("svg", { xmlns: v(ea), ref_key: "svgRef", ref: J, viewBox: `0 0 ${L.value.width} ${L.value.height}`, preserveAspectRatio: "xMidYMid meet", style: { overflow: "visible" }, class: F({ "vue-ui-chord-rotating": ee.value, "vue-ui-chord-idle": !ee.value }), onMousedown: nt(je, ["prevent"]), onTouchstart: nt(je, ["prevent"]) }, [ ke(v(ft)), e.$slots["chart-background"] ? (r(), i("foreignObject", { key: 0, x: 0, y: 0, width: L.value.width <= 0 ? 10 : L.value.width, height: L.value.height <= 0 ? 10 : L.value.height, style: { pointerEvents: "none" } }, [ $(e.$slots, "chart-background", {}, void 0, !0) ], 8, wa)) : h("", !0), a.value.style.chart.arcs.labels.curved ? (r(), i("defs", Ca, [ (r(!0), i(z, null, G(x.value.groups, (t, l) => (r(), i("path", { key: `labelPath-${l}`, id: `labelPath-${l}_${k.value}`, d: Pt( t.startAngle, t.endAngle, (p.value.inner + p.value.outer) / 2 + a.value.style.chart.arcs.labels.offset ), fill: "none" }, null, 8, Ma))), 128)) ])) : h("", !0), e.$slots.pattern ? (r(), i("g", xa, [ (r(!0), i(z, null, G(x.value.groups, (t, l) => (r(), i("defs", null, [ $(e.$slots, "pattern", Ut({ ref_for: !0 }, { seriesIndex: t.index, patternId: `pattern_${k.value}_${l}` }), void 0, !0) ]))), 256)) ])) : h("", !0), T("g", { transform: `translate(${L.value.width / 2}, ${L.value.height / 2}) rotate(${A.value})` }, [ (r(!0), i(z, null, G(x.value.groups, (t, l) => (r(), i("g", null, [ (r(), i("path", { class: F({ "vue-ui-chord-arc": !0, "vue-ui-chord-arc-animated": a.value.useCssAnimation && !W.value }), key: `arc-${l}`, d: Fe( t.startAngle, t.endAngle, p.value.outer, p.value.inner ), fill: m.value.colors[l], stroke: a.value.style.chart.arcs.stroke, "stroke-width": a.value.style.chart.arcs.strokeWidth, "stroke-linecap": "round", "stroke-linejoin": "round", style: D({ opacity: qe(t) }), onMouseenter: (s) => Tt(t, l), onMouseleave: (s) => St(t, l), onClick: (s) => Bt(t, l) }, null, 46, Ia)), e.$slots.pattern ? (r(), i("path", { class: F({ "vue-ui-chord-arc": !0, "vue-ui-chord-arc-animated": a.value.useCssAnimation && !W.value }), key: `arc-${l}`, d: Fe( t.startAngle, t.endAngle, p.value.outer, p.value.inner ), fill: `url(#${t.pattern})`, stroke: a.value.style.chart.arcs.stroke, "stroke-width": a.value.style.chart.arcs.strokeWidth, "stroke-linecap": "round", "stroke-linejoin": "round", style: D({ opacity: qe(t), pointerEvents: "none" }) }, null, 14, _a)) : h("", !0) ]))), 256)), T("g", null, [ (r(!0), i(z, null, G(w.value ? x.value.chords.filter((t) => t.source.groupId === w.value.id) : g.value ? x.value.chords.filter((t) => t.source.groupId === g.value) : x.value.chords, (t, l) => (r(), i(z, { key: `ribbon-${t.id}` }, [ t.source.value ? (r(), i("path", { key: 0, class: F({ "vue-ui-chord-ribbon": !0, "vue-ui-chord-ribbon-animated": a.value.useCssAnimation && !W.value }), d: le(t.source, t.target), fill: a.value.style.chart.backgroundColor, style: D({ opacity: a.value.style.chart.ribbons.underlayerOpacity }) }, null, 14, Pa)) : h("", !0), t.source.value ? (r(), i("path", { key: 1, class: F({ "vue-ui-chord-ribbon": !0, "vue-ui-chord-ribbon-animated": a.value.useCssAnimation && !W.value }), d: le(t.source, t.target), fill: m.value.colors[t.source.index], stroke: a.value.style.chart.ribbons.stroke, "stroke-width": a.value.style.chart.ribbons.strokeWidth, "stroke-linecap": "round", "stroke-linejoin": "round", style: D({ opacity: We(t) }), onMouseenter: (s) => Lt({ ...t, path: le(t.source, t.target), color: m.value.colors[t.source.index] }, l), onClick: (s) => Et({ ...t, color: m.value.colors[t.source.index] }, l), onMouseleave: (s) => Ot({ ...t, color: m.value.colors[t.source.index] }, l) }, null, 46, Ta)) : h("", !0), t.source.value && e.$slots.pattern ? (r(), i("path", { key: 2, class: F({ "vue-ui-chord-ribbon": !0, "vue-ui-chord-ribbon-animated": a.value.useCssAnimation && !W.value }), d: le(t.source, t.target), fill: `url(#pattern_${k.value}_${t.source.index})`, stroke: a.value.style.chart.ribbons.stroke, "stroke-width": a.value.style.chart.ribbons.strokeWidth, "stroke-linecap": "round", "stroke-linejoin": "round", style: D({ opacity: We(t), pointerEvents: "none" }) }, null, 14, Sa)) : h("", !0) ], 64))), 128)), b.value ? (r(), i("path", { key: 0, d: b.value.path, fill: b.value.color, stroke: a.value.style.chart.ribbons.stroke, "stroke-width": a.value.style.chart.ribbons.strokeWidth, "stroke-linecap": "round", "stroke-linejoin": "round", class: F({ "vue-ui-chord-ribbon": !0 }), style: { pointerEvents: "none" } }, null, 8, Ba)) : h("", !0), b.value && e.$slots.pattern ? (r(), i("path", { key: 1, d: b.value.path, fill: `url(#${b.value.source.pattern})`, stroke: a.value.style.chart.ribbons.stroke, "stroke-width": a.value.style.chart.ribbons.strokeWidth, "stroke-linecap": "round", "stroke-linejoin": "round", class: F({ "vue-ui-chord-ribbon": !0 }), style: { pointerEvents: "none" } }, null, 8, La)) : h("", !0) ]), (w.value || b.value || g.value) && a.value.style.chart.ribbons.labels.show ? (r(), i("g", Oa, [ (r(!0), i(z, null, G(Mt.value, (t) => (r(), i(z, { key: t.id }, [ T("line", { x1: t.midBaseX, y1: t.midBaseY, x2: Math.cos(t.theta - Math.PI / 2) * (p.value.outer + a.value.style.chart.ribbons.labels.offset + 12), y2: Math.sin(t.theta - Math.PI / 2) * (p.value.outer + a.value.style.chart.ribbons.labels.offset + 12), stroke: a.value.style.chart.backgroundColor, "stroke-width": a.value.style.chart.ribbons.labels.connector.strokeWidth * 3, "pointer-events": "none" }, null, 8, Ea), T("line", { x1: t.midBaseX, y1: t.midBaseY, x2: Math.cos(t.theta - Math.PI / 2) * (p.value.outer + a.value.style.chart.ribbons.labels.offset + 12), y2: Math.sin(t.theta - Math.PI / 2) * (p.value.outer + a.value.style.chart.ribbons.labels.offset + 12), stroke: a.value.style.chart.ribbons.labels.connector.stroke, "stroke-width": a.value.style.chart.ribbons.labels.connector.strokeWidth, "pointer-events": "none" }, null, 8, Na), a.value.style.chart.ribbons.labels.marker.show ? (r(), i("circle", { key: 0, cx: Math.cos(t.theta - Math.PI / 2) * (p.value.outer + a.value.style.chart.ribbons.labels.offset + 12), cy: Math.sin(t.theta - Math.PI / 2) * (p.value.outer + a.value.style.chart.ribbons.labels.offset + 12), r: a.value.style.chart.ribbons.labels.marker.radius, stroke: a.value.style.chart.ribbons.labels.marker.stroke, "stroke-width": a.value.style.chart.ribbons.labels.marker.strokeWidth, fill: t.groupColor, "pointer-events": "none" }, null, 8, Ra)) : h("", !0), T("text", { transform: ` translate( ${Math.cos(t.theta - Math.PI / 2) * (p.value.outer + a.value.style.chart.ribbons.labels.offset + 24)}, ${Math.sin(t.theta - Math.PI / 2) * (p.value.outer + a.value.style.chart.ribbons.labels.offset + 24)} ) rotate(${-A.value}) `, fill: a.value.style.chart.ribbons.labels.useSerieColor ? t.groupColor : a.value.style.chart.ribbons.labels.color, "text-anchor": It(t.theta), "font-size": a.value.style.chart.ribbons.labels.fontSize, "font-weight": a.value.style.chart.ribbons.labels.bold ? "bold" : "normal", dy: ".35em", "pointer-events": "none" }, Q(Ye(t.value)), 9, Da) ], 64))), 128)) ])) : h("", !0), a.value.style.chart.arcs.labels.show ? (r(), i("g", Fa, [ a.value.style.chart.arcs.labels.curved ? (r(!0), i(z, { key: 0 }, G(x.value.groups, (t, l) => (r(), i("text", { class: "vue-ui-chord-label-curved", key: `curved-label-${l}`, "font-size": a.value.style.chart.arcs.labels.fontSize, "font-weight": a.value.style.chart.arcs.labels.bold ? "bold" : "normal", fill: a.value.style.chart.arcs.labels.adaptColorToBackground ? v(ta)(m.value.colors[l]) : a.value.style.chart.arcs.labels.color }, [ T("textPath", { href: `#labelPath-${l}_${k.value}`, startOffset: "50%", "text-anchor": "middle" }, Q(m.value.labels[l]) + Q(a.value.style.chart.arcs.labels.showPercentage ? v(we)({ p: " (", v: isNaN(t.proportion) ? 0 : t.proportion * 100, s: "%)", r: a.value.style.chart.arcs.labels.roundingPercentage }) : ""), 9, Xa) ], 8, za))), 128)) : !w.value && !b.value && !g.value ? (r(!0), i(z, { key: 1 }, G(x.value.groups, (t, l) => (r(), i("text", { class: "vue-ui-chord-label-straight", key: `label-${l}`, transform: ` ${_t((t.startAngle + t.endAngle) / 2)} rotate(${-A.value}) `, dy: ".35em", "text-anchor": At(t) > Math.PI ? "end" : "start", "font-size": a.value.style.chart.arcs.labels.fontSize, "font-weight": a.value.style.chart.arcs.labels.bold ? "bold" : "normal", fill: a.value.style.chart.arcs.labels.color, innerHTML: v(aa)({ content: v(oa)(Ft(t, l)), fontSize: a.value.style.chart.arcs.labels.fontSize, fill: a.value.style.chart.arcs.labels.color, x: 0, y: 0 }) }, null, 8, Ua))), 128)) : h("", !0) ])) : h("", !0) ], 8, Aa), $(e.$slots, "svg", { svg: { height: 600, width: 600 } }, void 0, !0) ], 42, $a)), e.$slots.watermark ? (r(), i("div", Va, [ $(e.$slots, "watermark", ie(ce({ isPrinting: v(Be) || v(Le) })), void 0, !0) ])) : h("", !0), T("div", { id: `legend-bottom-${k.value}` }, null, 8, ja), _e.value ? (r(), V(Vt, { key: 5, to: a.value.style.chart.legend.position === "top" ? `#legend-top-${k.value}` : `#legend-bottom-${k.value}` }, [ T("div", { ref_key: "chartLegend", ref: xe }, [ a.value.style.chart.legend.show ? (r(), V(da, { key: `legend_${fe.value}`, legendSet: Je.value, config: Rt.value, onClickMarker: o[0] || (o[0] = ({ legend: t }) => Ze(t.id)) }, lt({ item: S(({ legend: t }) => [ T("div", { style: D({ opacity: g.value ? g.value === t.id ? 1 : 0.3 : 1 }), onClick: (l) => t.select() }, Q(t.name), 13, Ya) ]), _: 2 }, [ e.$slots.pattern ? { name: "legend-pattern", fn: S(({ legend: t, index: l }) => [ ke(fa, { shape: t.shape, radius: 30, stroke: "none", plot: { x: 30, y: 30 }, fill: `url(#pattern_${k.value}_${l})` }, null, 8, ["shape", "fill"]) ]), key: "0" } : void 0 ]), 1032, ["legendSet", "config"])) : h("", !0), $(e.$slots, "legend", { legend: Je.value }, void 0, !0) ], 512) ], 8, ["to"])) : h("", !0), e.$slots.source ? (r(), i("div", { key: 6, ref_key: "source", ref: Ae, dir: "auto" }, [ $(e.$slots, "source", {}, void 0, !0) ], 512)) : h("", !0), A.value !== a.value.initialRotation ? (r(), i("div", Ga, [ $(e.$slots, "reset-action", { reset: Qe }, () => [ T("button", { "data-cy-reset": "", tabindex: "0", role: "button", class: "vue-data-ui-refresh-button", style: D({ background: a.value.style.chart.backgroundColor }), onClick: Qe }, [ ke(v(dt), { name: "refresh", stroke: a.value.style.chart.color }, null, 8, ["stroke"]) ], 4) ], !0) ])) : h("", !0), E.value ? (r(), V(v(vt), { key: 8, hideDetails: "", config: { open: K.value.showTable, maxHeight: 1e4, body: { backgroundColor: a.value.style.chart.backgroundColor, color: a.value.style.chart.color }, head: { backgroundColor: a.value.style.chart.backgroundColor, color: a.value.style.chart.color } } }, { content: S(() => [ (r(), V(v(ht), { key: `table_${he.value}`, colNames: ue.value.colNames, head: ue.value.head, body: ue.value.body, config: ue.value.config, title: `${a.value.style.chart.title.text}${a.value.style.chart.title.subtitle.text ? ` : ${a.value.style.chart.title.subtitle.text}` : ""}`, onClose: o[1] || (o[1] = (t) => K.value.showTable = !1) }, { th: S(({ th: t }) => [ jt(Q(t.name), 1) ]), td: S(({ td: t }) => [ T("div", Wa, Q(t.name ? t.name : Ye(t)), 1) ]), _: 1 }, 8, ["colNames", "head", "body", "config", "title"])) ]), _: 1 }, 8, ["config"])) : h("", !0), v(Pe) ? (r(), V(ba, { key: 9 })) : h("", !0) ], 46, ya)); } }, uo = /* @__PURE__ */ ma(qa, [["__scopeId", "data-v-a189383f"]]); export { uo as default };