UNPKG

vue-data-ui

Version:

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

853 lines (852 loc) 33.6 kB
import { defineAsyncComponent as J, ref as v, computed as m, onMounted as Gt, toRefs as jt, watch as Ie, createElementBlock as p, openBlock as i, unref as r, normalizeStyle as D, normalizeClass as mt, createBlock as U, createCommentVNode as T, createElementVNode as V, createVNode as Le, createSlots as Ut, withCtx as $, renderSlot as C, normalizeProps as Q, guardReactiveProps as ee, Fragment as ie, renderList as ce, toDisplayString as ve, Teleport as Vt, createTextVNode as Xt, nextTick as qt } from "vue"; import { u as Kt, c as ze, t as Zt, o as yt, f as Jt, a as Qt, p as L, b as eo, d as to, h as x, e as oo, i as de, X as lo, F as bt, L as ao, k as Be, v as no, w as so, y as ro } from "./index-q-LPw2IT.js"; import { u as Ct } from "./useNestedProp-04aFeUYu.js"; import { u as uo } from "./usePrinter-DX7efa1s.js"; import { u as io } from "./useUserOptionState-BIvW1Kz7.js"; import { u as co } from "./useChartAccessibility-9icAAmYg.js"; import vo from "./Legend-DcDSkq99.js"; import ho from "./Title-B55R8CAZ.js"; import fo from "./img-Ctts6JQb.js"; import { t as po, u as go } from "./useResponsive-DfdjqQps.js"; import { u as mo, B as yo } from "./useLoading-D7YHNtLX.js"; import { _ as bo } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const Co = ["id"], ko = { key: 1, ref: "noTitle", class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, wo = ["id"], $o = ["xmlns", "viewBox"], Ao = ["width", "height"], To = ["id"], xo = ["stop-color"], _o = ["stop-color"], So = ["d", "fill", "stroke", "stroke-width"], Oo = ["x", "y", "height", "width", "fill", "stroke", "stroke-width", "onMouseenter", "onMouseleave", "onClick"], No = { key: 1 }, Fo = ["x", "y", "font-size", "fill"], Eo = ["x", "y", "font-size", "fill"], Mo = { key: 4, class: "vue-data-ui-watermark" }, Po = ["id"], Io = ["onClick"], Lo = ["innerHTML"], zo = { __name: "vue-ui-flow", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Array, default() { return []; } } }, setup(kt, { expose: wt }) { const $t = J(() => import("./vue-ui-accordion-D46i_gkB.js")), At = J(() => import("./DataTable-rj9-mAwF.js")), Tt = J(() => import("./PackageVersion-5ZjKSIei.js")), xt = J(() => import("./PenAndPaper-BJ0hcgsa.js")), _t = J(() => import("./Tooltip-BMOddG-M.js")), St = J(() => import("./UserOptions-DVzyjG-W.js")), { vue_ui_flow: Ot } = Kt(), F = kt, W = v(ze()), z = v(null), He = v(0), Re = v(0), $e = v(!1), Ae = v(""), De = v(null), We = v(null), Ye = v(null), te = v(null), he = v(null), Ge = v(!1), je = m(() => !!F.dataset && F.dataset.length); Gt(() => { Ge.value = !0, Ve(); }); const X = v(!1); function Ue(o) { X.value = o, He.value += 1; } const e = v(Se()), { loading: Te, FINAL_DATASET: fe, manualLoading: xe } = mo({ ...jt(F), FINAL_CONFIG: e, prepareConfig: Se, skeletonDataset: [ ["A", "B", 2, "#CACACA"], ["B", "C", 1, "#CACACA"], ["C", "D", 0.5, "#CACACA"], ["E", "F", 1, "#AAAAAA"], ["F", "G", 0.5, "#AAAAAA"], ["G", "H", 0.25, "#AAAAAA"] ], skeletonConfig: Zt({ defaultConfig: e.value, userConfig: { userOptions: { show: !1 }, nodeCategories: { B: "A", C: "B" }, nodeCategoryColors: { A: "#CACACA", B: "#AAAAAA" }, table: { show: !1 }, style: { chart: { backgroundColor: "#99999930", legend: { backgroundColor: "transparent" }, nodes: { labels: { show: !1 }, stroke: "#666666" }, links: { stroke: "#666666" } } } } }) }), Nt = m(() => !!e.value.debug); function Ve() { if (yt(F.dataset) && (Jt({ componentName: "VueUiFlow", type: "dataset", debug: Nt.value }), xe.value = !0), yt(F.dataset) || (xe.value = e.value.loading), e.value.responsive) { const o = po(() => { const { width: l, height: t } = go({ chart: z.value, title: e.value.style.chart.title.text ? We.value : null, legend: e.value.style.chart.legend.show ? De.value : null, source: Ye.value }); requestAnimationFrame(() => { Ze.value = l, Je.value = t; }); }); te.value && (he.value && te.value.unobserve(he.value), te.value.disconnect()), te.value = new ResizeObserver(o), he.value = z.value.parentNode, te.value.observe(he.value); } } const { userOptionsVisible: _e, setUserOptionsVisibility: Xe, keepUserOptionState: qe } = io({ config: e.value }), { svgRef: Ke } = co({ config: e.value.style.chart.title }); function Se() { const o = Ct({ userConfig: F.config, defaultConfig: Ot }); let l = o; return o.theme ? l = { ...Ct({ userConfig: eo.vue_ui_flow[o.theme] || F.config, defaultConfig: o }), customPalette: Qt[o.theme] || L } : l = o, l.nodeCategories = F.config.nodeCategories || {}, l.nodeCategoryColors = F.config.nodeCategoryColors || {}, l; } const Ze = v(e.value.style.chart.width), Je = v(e.value.style.chart.height); Ie( () => F.config, (o) => { Te.value || (e.value = Se()), _e.value = !e.value.userOptions.showOnChartHover, Ve(), Re.value += 1, M.value.showTable = e.value.table.show; }, { deep: !0 } ), Ie(() => F.dataset, (o) => { Array.isArray(o) && o.length > 0 && (xe.value = !1); }, { deep: !0 }); const { isPrinting: Qe, isImaging: et, generatePdf: tt, generateImage: ot } = uo({ elementId: `flow_${W.value}`, fileName: e.value.style.chart.title.text || "vue-ui-flow", options: e.value.userOptions.print }), Ft = m(() => e.value.userOptions.show && !e.value.style.chart.title.text), pe = m(() => to(e.value.customPalette)), ge = m(() => e.value.style.chart.nodes.width), M = v({ showTable: e.value.table.show, showTooltip: e.value.style.chart.tooltip.show }); Ie(e, () => { M.value = { showTable: e.value.table.show, showTooltip: e.value.style.chart.tooltip.show }; }, { immediate: !0 }); const lt = m(() => !fe.value || !fe.value.length ? [] : fe.value.map((o, l) => [ o[0], o[1], x(o[2]), o[3] ? oo(o[3]) : pe.value[l] || pe.value[l % pe.value.length] || L[l] || L[l % L.length] ])); function Et(o) { const l = {}, t = {}; function n(a, u) { l[a] || (l[a] = { level: null, inflow: 0, outflow: 0, children: [], color: null, uid: ze() }), l[a].level === null && (l[a].level = u), t[u] || (t[u] = []), t[u].includes(a) || t[u].push(a); } o.forEach(([a, u, d]) => { const h = l[a]?.level ?? 0, S = h + 1; n(a, h), n(u, S), l[a].children.push({ target: u, value: d }), l[a].outflow += d, l[u].inflow += d; }); const s = new Set(o.map(([a]) => a)), w = new Set(o.map(([, a]) => a)), K = Array.from(s).filter((a) => !w.has(a)), ne = {}; K.forEach((a, u) => { ne[a] = pe.value[u] || L[u % L.length]; }); const se = {}; o.forEach(([a, u, d, h]) => { h && (se[a] = h, se[u] = h); }), Object.keys(l).forEach((a, u) => { const d = e.value.nodeCategories?.[a], h = d ? e.value.nodeCategoryColors?.[d] : null; l[a].color = se[a] || h || (K.includes(a) ? ne[a] : null) || L[u % L.length]; }), Object.keys(l).forEach((a) => { l[a].value = Math.max(l[a].inflow, l[a].outflow); }); const Ce = oe.value, Fe = st.value.width, Z = st.value.height, I = Object.keys(t).map(Number).sort((a, u) => a - u), ke = I.length || 1, Ee = ke > 1 ? Fe / (ke - 1) : 0, A = Number(ge.value), P = Number( e.value.style.chart.nodes.gapPx ?? e.value.style.chart.nodes.gap ?? 8 ), re = Number(e.value.style.chart.nodes.minHeight || 0); function c(a) { const u = t[a], d = u.length; if (!d) return 1 / 0; const h = Math.max(0, (d - 1) * P), S = Math.max(0, Z - h), B = Math.min(re, d ? S / d : 0); let b = 0, O = u.map((f) => l[f].value || 0), y = O.reduce((f, N) => f + N, 0); for (let f = 0; f < 12; f += 1) { const N = y > 0 ? (S - b) / y : 0, H = []; for (let E = 0; E < O.length; E += 1) { const R = O[E]; R < 0 || R * N < B && H.push(E); } if (!H.length) return Math.max(0, N); for (const E of H) b += B, y -= O[E], O[E] = -1; if (y <= 0) return 0; } return y > 0 ? Math.max(0, (S - b) / y) : 0; } const g = I.map(c), G = g.length ? Math.min(...g) : 0, j = {}; I.forEach((a) => { const u = t[a], d = u.length, h = Math.max(0, (d - 1) * P), S = Math.max(0, Z - h), B = Math.min(re, d ? S / d : 0), b = u.map( (f) => Math.max(B, (l[f].value || 0) * G) ), O = b.reduce((f, N) => f + N, 0) + h; let y = Math.max(0, (Z - O) / 2); u.forEach((f, N) => { const H = b[N], E = Ce.left + a * Ee, R = y; j[f] = { x: E, y: R, absoluteY: R, height: H, i: N, color: l[f].color, value: l[f].value }, y += H, N < d - 1 && (y += P); }); }); const ft = [], ue = Ce.top, Me = {}, Pe = {}; Object.keys(l).forEach((a) => { Me[a] = j[a]?.y ?? 0, Pe[a] = 0; }); const Ht = 1e-6, Rt = 0.25; return I.forEach((a) => { t[a].forEach((d) => { const h = l[d], S = j[d]; if (!h.children || !h.children.length) return; let B = S.y; h.children.forEach(({ target: b, value: O }) => { const y = j[b], f = l[b], N = h.outflow > 0 ? O / h.outflow : 0, H = f.inflow > 0 ? O / f.inflow : 0, E = x(B + ue), R = x(B + N * S.height + ue), pt = Me[b]; let we = pt + H * y.height; Pe[b] += O; const Dt = f.inflow > 0 && Pe[b] >= f.inflow - Ht, gt = y.y + y.height; (Dt || we > gt - Rt) && (we = gt); const Wt = x(pt + ue), Yt = x(we + ue); ft.push({ id: ze(), source: d, target: b, path: `M ${x(S.x + A)} ${E} L ${x(S.x + A)} ${R} L ${x(y.x)} ${Yt} L ${x(y.x)} ${Wt} Z`, value: O, sourceColor: h.color, targetColor: l[b].color }), B = R - ue, Me[b] = we; }); }); }), { nodeCoordinates: j, links: ft }; } const _ = m(() => { const o = Et(fe.value); return { nodes: Object.keys(o.nodeCoordinates).map((l, t) => ({ ...o.nodeCoordinates[l], name: l })), links: o.links }; }), at = m(() => Ze.value), nt = m(() => Je.value), oe = m(() => e.value.style.chart.padding), st = m(() => ({ width: Math.max(0, at.value - 40 - oe.value.right - oe.value.left), height: Math.max(0, nt.value - oe.value.top - oe.value.bottom) })), le = m(() => ({ width: at.value, height: nt.value })); function Mt(o) { const l = {}, t = {}, n = /* @__PURE__ */ new Set(); return lt.value.forEach(([s, w, K]) => { l[s] || (l[s] = []), t[w] || (t[w] = []), l[s].push(w), t[w].push(s); }), l[o] && l[o].forEach((s) => n.add(s)), t[o] && t[o].forEach((s) => n.add(s)), Array.from(n).concat(o); } const k = v(null), q = v(null), ae = v(null), me = v(!1); function Pt(o, l) { Y.value = [], k.value = Mt(o.name), q.value = o.name; const t = o.name, n = lt.value; let s = 0, w = 0, K = [], ne = []; const se = new Set(n.map(([c]) => c)), Ce = new Set(n.map(([, c]) => c)), Fe = Array.from(se).filter((c) => !Ce.has(c)), Z = n.filter(([c]) => Fe.includes(c)).reduce((c, [g, G, j]) => c + j, 0), I = {}; _.value.nodes.forEach((c) => { I[c.name] = c.color; }), n.forEach(([c, g, G]) => { g === t && (s += G, K.push({ source: c, value: G, color: I[c] })), c === t && (w += G, ne.push({ target: g, value: G, color: I[g] })); }); const ke = Math.max(s, w), Ee = Z > 0 ? ke / Z * 100 : 0, A = { name: t, inflow: s, outflow: w, from: K, to: ne, percentOfTotal: Ee, color: I[t] || "#000000" }; e.value.events.datapointEnter && e.value.events.datapointEnter({ datapoint: A, seriesIndex: l }), ae.value = { datapoint: A }, $e.value = !0; let P = ""; const re = e.value.style.chart.tooltip.customFormat; if (me.value = !1, ro(re)) try { const c = re({ datapoint: A, series: _.value, config: e.value }); typeof c == "string" && (Ae.value = c, me.value = !0); } catch { console.warn("Custom format cannot be applied."); } if (!me.value) { const c = e.value.style.chart.tooltip.showPercentage ? `<div>${de({ p: e.value.style.chart.tooltip.translations.percentOfTotal, v: A.percentOfTotal, s: "%", r: e.value.style.chart.tooltip.roundingPercentage })}</div>` : ""; P += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;"><span style="margin-right:4px; color:${A.color}">⏹</span>${A.name}${c}</div>`, A.from.length && (P += `<div>${e.value.style.chart.tooltip.translations.from}</div>`, A.from.forEach((g) => { P += `<div><span style="color:${g.color}">⏹←</span> ${g.source}: ${Be( e.value.style.chart.nodes.labels.formatter, g.value, de({ p: e.value.style.chart.nodes.labels.prefix, v: g.value, s: e.value.style.chart.nodes.labels.suffix, r: e.value.style.chart.nodes.labels.rounding }) )}</div>`; })), A.to.length && (P += `<div style="margin-top:6px;">${e.value.style.chart.tooltip.translations.to}</div>`, A.to.forEach((g) => { P += `<div><span style="color:${g.color}">⏹→</span> ${g.target}: ${Be( e.value.style.chart.nodes.labels.formatter, g.value, de({ p: e.value.style.chart.nodes.labels.prefix, v: g.value, s: e.value.style.chart.nodes.labels.suffix, r: e.value.style.chart.nodes.labels.rounding }) )}</div>`; })), Ae.value = P; } } function rt(o) { const l = ae.value; e.value.events.datapointLeave && e.value.events.datapointLeave({ datapoint: l, seriesIndex: o }), k.value = null, q.value = null, $e.value = !1; } function It(o) { const l = ae.value; e.value.events.datapointClick && e.value.events.datapointClick({ datapoint: l, seriesIndex: o }); } const ut = m(() => _.value.links.map( ({ source: o, target: l, sourceColor: t, targetColor: n, value: s }) => ({ source: o, target: l, sourceColor: t, targetColor: n, value: s }) )); function it(o = null) { qt(() => { const l = ut.value.map((s, w) => [[s.source], [s.target], [s.value]]), t = [ [e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [ [e.value.table.columnNames.source], [e.value.table.columnNames.target], [e.value.table.columnNames.value] ] ].concat(l), n = no(t); o ? o(n) : so({ csvContent: n, title: e.value.style.chart.title.text || "vue-ui-flow" }); }); } const ye = m(() => { const o = [ e.value.table.columnNames.source, e.value.table.columnNames.target, e.value.table.columnNames.value ], l = ut.value.map((s, w) => [ { color: s.sourceColor, name: s.source }, { color: s.targetColor, name: s.target }, de({ p: e.value.style.chart.nodes.labels.prefix, v: s.value, s: e.value.style.chart.nodes.labels.suffix, r: e.value.style.chart.nodes.labels.rounding }) ]), t = { th: { backgroundColor: e.value.table.th.backgroundColor, color: e.value.table.th.color, outline: e.value.table.th.outline }, td: { backgroundColor: e.value.table.td.backgroundColor, color: e.value.table.td.color, outline: e.value.table.td.outline }, breakpoint: e.value.table.responsiveBreakpoint }; return { colNames: [ e.value.table.columnNames.source, e.value.table.columnNames.target, e.value.table.columnNames.value ], head: o, body: l, config: t }; }); function Lt() { return _.value; } function ct() { M.value.showTable = !M.value.showTable; } const be = v(!1); function Oe() { be.value = !be.value; } function vt() { M.value.showTooltip = !M.value.showTooltip; } const dt = m(() => { const o = new Set( _.value.nodes.map( (l) => e.value.nodeCategories[l.name] || "__uncategorized__" ) ); return Array.from(o).map((l) => ({ name: l, color: e.value.nodeCategoryColors[l] || L[0], shape: "square", count: _.value.nodes.filter( (t) => (e.value.nodeCategories[t.name] || "__uncategorized__") === l ).length })).map((l, t) => ({ ...l, segregate: () => Ne({ legend: l, i: t }), opacity: Y.value.length ? Y.value.includes(t) ? 1 : 0.5 : 1 })); }), ht = m( () => dt.value.filter((o) => o.name !== "__uncategorized__") ), Y = v([]); function Ne({ legend: o, i: l }) { const t = o.name; if (k.value?.every( (n) => e.value.nodeCategories[n] === t )) { k.value = null, q.value = null, Y.value = []; return; } Y.value = [l], k.value = _.value.nodes.filter((n) => e.value.nodeCategories[n.name] === t).map((n) => n.name), q.value = null; } const zt = m(() => ({ cy: "flow-legend", backgroundColor: e.value.style.chart.legend.backgroundColor, color: e.value.style.chart.legend.color, fontSize: e.value.style.chart.legend.fontSize, paddingBottom: e.value.style.chart.legend.paddingBottom, fontWeight: e.value.style.chart.legend.bold ? "bold" : "normal" })); async function Bt({ scale: o = 2 } = {}) { if (!z.value) return; const { width: l, height: t } = z.value.getBoundingClientRect(), n = l / t, { imageUri: s, base64: w } = await fo({ domElement: z.value, base64: !0, img: !0, scale: o }); return { imageUri: s, base64: w, title: e.value.style.chart.title.text, width: l, height: t, aspectRatio: n }; } return wt({ getData: Lt, getImage: Bt, generateCsv: it, generateImage: ot, generatePdf: tt, toggleTable: ct, toggleAnnotator: Oe, toggleTooltip: vt, drillCategory: Ne, unselectNode: rt, toggleFullscreen: Ue }), (o, l) => (i(), p("div", { ref_key: "flowChart", ref: z, class: mt(`vue-ui-flow ${X.value ? "vue-data-ui-wrapper-fullscreen" : ""}`), style: D(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor}`), id: `flow_${W.value}`, onMouseenter: l[2] || (l[2] = () => r(Xe)(!0)), onMouseleave: l[3] || (l[3] = () => r(Xe)(!1)) }, [ e.value.userOptions.buttons.annotator ? (i(), U(r(xt), { key: 0, svgRef: r(Ke), backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, active: be.value, onClose: Oe }, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : T("", !0), Ft.value ? (i(), p("div", ko, null, 512)) : T("", !0), e.value.style.chart.title.text ? (i(), p("div", { key: 2, ref_key: "chartTitle", ref: We, style: "width:100%;background:transparent;padding-bottom:24px" }, [ (i(), U(ho, { key: `title_${Re.value}`, config: { title: { cy: "flow-title", ...e.value.style.chart.title }, subtitle: { cy: "flow-subtitle", ...e.value.style.chart.title.subtitle } } }, null, 8, ["config"])) ], 512)) : T("", !0), V("div", { id: `legend-top-${W.value}` }, null, 8, wo), e.value.userOptions.show && je.value && (r(qe) || r(_e)) ? (i(), U(r(St), { ref: "details", key: `user_option_${He.value}`, backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, isPrinting: r(Qe), isImaging: r(et), uid: W.value, hasPdf: e.value.userOptions.buttons.pdf, hasXls: e.value.userOptions.buttons.csv, hasImg: e.value.userOptions.buttons.img, hasTable: e.value.userOptions.buttons.table, callbacks: e.value.userOptions.callbacks, hasFullscreen: e.value.userOptions.buttons.fullscreen, isFullscreen: X.value, titles: { ...e.value.userOptions.buttonTitles }, chartElement: z.value, position: e.value.userOptions.position, hasAnnotator: e.value.userOptions.buttons.annotator, printScale: e.value.userOptions.print.scale, isAnnotation: be.value, hasTooltip: e.value.style.chart.tooltip.show && e.value.userOptions.buttons.tooltip, isTooltip: M.value.showTooltip, onToggleTooltip: vt, onToggleFullscreen: Ue, onGeneratePdf: r(tt), onGenerateCsv: it, onGenerateImage: r(ot), onToggleTable: ct, onToggleAnnotator: Oe, style: D({ visibility: r(qe) ? r(_e) ? "visible" : "hidden" : "visible" }) }, Ut({ _: 2 }, [ o.$slots.menuIcon ? { name: "menuIcon", fn: $(({ isOpen: t, color: n }) => [ C(o.$slots, "menuIcon", Q(ee({ isOpen: t, color: n })), void 0, !0) ]), key: "0" } : void 0, o.$slots.optionTooltip ? { name: "optionTooltip", fn: $(() => [ C(o.$slots, "optionTooltip", {}, void 0, !0) ]), key: "1" } : void 0, o.$slots.optionPdf ? { name: "optionPdf", fn: $(() => [ C(o.$slots, "optionPdf", {}, void 0, !0) ]), key: "2" } : void 0, o.$slots.optionCsv ? { name: "optionCsv", fn: $(() => [ C(o.$slots, "optionCsv", {}, void 0, !0) ]), key: "3" } : void 0, o.$slots.optionImg ? { name: "optionImg", fn: $(() => [ C(o.$slots, "optionImg", {}, void 0, !0) ]), key: "4" } : void 0, o.$slots.optionTable ? { name: "optionTable", fn: $(() => [ C(o.$slots, "optionTable", {}, void 0, !0) ]), key: "5" } : void 0, o.$slots.optionFullscreen ? { name: "optionFullscreen", fn: $(({ toggleFullscreen: t, isFullscreen: n }) => [ C(o.$slots, "optionFullscreen", Q(ee({ toggleFullscreen: t, isFullscreen: n })), void 0, !0) ]), key: "6" } : void 0, o.$slots.optionAnnotator ? { name: "optionAnnotator", fn: $(({ toggleAnnotator: t, isAnnotator: n }) => [ C(o.$slots, "optionAnnotator", Q(ee({ toggleAnnotator: t, isAnnotator: n })), void 0, !0) ]), key: "7" } : void 0 ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasXls", "hasImg", "hasTable", "callbacks", "hasFullscreen", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "printScale", "isAnnotation", "hasTooltip", "isTooltip", "onGeneratePdf", "onGenerateImage", "style"])) : T("", !0), (i(), p("svg", { ref_key: "svgRef", ref: Ke, xmlns: r(lo), viewBox: `0 0 ${le.value.width} ${le.value.height}`, class: mt({ "vue-data-ui-fullscreen--on": X.value, "vue-data-ui-fulscreen--off": !X.value }), style: D({ maxWidth: "100%", overflow: "visible", background: "transparent", color: e.value.style.chart.color }) }, [ Le(r(Tt)), o.$slots["chart-background"] ? (i(), p("foreignObject", { key: 0, x: 0, y: 0, width: le.value.width, height: le.value.height, style: { pointerEvents: "none" } }, [ C(o.$slots, "chart-background", {}, void 0, !0) ], 8, Ao)) : T("", !0), V("defs", null, [ (i(!0), p(ie, null, ce(_.value.links, (t, n) => (i(), p("linearGradient", { id: t.id, x1: "0%", y1: "0%", x2: "100%", y2: "0%" }, [ V("stop", { offset: "0%", "stop-color": t.sourceColor }, null, 8, xo), V("stop", { offset: "100%", "stop-color": t.targetColor }, null, 8, _o) ], 8, To))), 256)) ]), (i(!0), p(ie, null, ce(_.value.links, (t) => (i(), p("path", { class: "vue-ui-flow-link", d: t.path, "stroke-linejoin": "round", "stroke-miterlimit": "1", fill: `url(#${t.id})`, stroke: e.value.style.chart.links.stroke, "stroke-width": e.value.style.chart.links.strokeWidth, style: D(` opacity:${k.value ? k.value.includes(t.source) && k.value.includes(t.target) ? 1 : 0.3 : q.value ? [t.target, t.source].includes(q.value) ? 1 : 0.3 : e.value.style.chart.links.opacity} `) }, null, 12, So))), 256)), (i(!0), p(ie, null, ce(_.value.nodes, (t, n) => (i(), p("rect", { class: "vue-ui-flow-node", x: t.x, y: r(x)(t.absoluteY) + e.value.style.chart.padding.top, height: r(x)(t.height), width: ge.value, fill: t.color, stroke: e.value.style.chart.nodes.stroke, "stroke-width": e.value.style.chart.nodes.strokeWidth, onMouseenter: (s) => Pt(t, n), onMouseleave: (s) => rt(n), style: D(`opacity:${k.value ? k.value.includes(t.name) ? 1 : 0.3 : 1}`), onClick: (s) => It(n) }, null, 44, Oo))), 256)), e.value.style.chart.nodes.labels.show ? (i(), p("g", No, [ (i(!0), p(ie, null, ce(_.value.nodes, (t, n) => (i(), p("text", { x: t.x + ge.value / 2, y: r(x)( t.absoluteY + t.height / 2 - e.value.style.chart.nodes.labels.fontSize / 4 ) + e.value.style.chart.padding.top, "font-size": e.value.style.chart.nodes.labels.fontSize, fill: r(bt)(t.color), "text-anchor": "middle", style: D(`pointer-events: none; opacity:${k.value ? k.value.includes(t.name) ? 1 : 0 : 1}`) }, ve(e.value.style.chart.nodes.labels.abbreviation.use ? r(ao)({ source: t.name, length: e.value.style.chart.nodes.labels.abbreviation.length }) : t.name), 13, Fo))), 256)), (i(!0), p(ie, null, ce(_.value.nodes, (t, n) => (i(), p("text", { x: t.x + ge.value / 2, y: r(x)( t.absoluteY + t.height / 2 + e.value.style.chart.nodes.labels.fontSize ) + e.value.style.chart.padding.top, "font-size": e.value.style.chart.nodes.labels.fontSize, fill: r(bt)(t.color), "text-anchor": "middle", style: D(`pointer-events: none; opacity:${k.value ? k.value.includes(t.name) ? 1 : 0 : 1}`) }, ve(r(Be)( e.value.style.chart.nodes.labels.formatter, t.value, r(de)({ p: e.value.style.chart.nodes.labels.prefix, v: t.value, s: e.value.style.chart.nodes.labels.suffix, r: e.value.style.chart.nodes.labels.rounding }), { datapoint: t, seriesIndex: n } )), 13, Eo))), 256)) ])) : T("", !0), C(o.$slots, "svg", { svg: le.value }, void 0, !0) ], 14, $o)), o.$slots.watermark ? (i(), p("div", Mo, [ C(o.$slots, "watermark", Q(ee({ isPrinting: r(Qe) || r(et) })), void 0, !0) ])) : T("", !0), V("div", { id: `legend-bottom-${W.value}` }, null, 8, Po), Ge.value ? (i(), U(Vt, { key: 5, to: e.value.style.chart.legend.position === "top" ? `#legend-top-${W.value}` : `#legend-bottom-${W.value}` }, [ V("div", { ref_key: "chartLegend", ref: De }, [ e.value.style.chart.legend.show && ht.value.length ? (i(), U(vo, { key: 0, legendSet: ht.value, config: zt.value, onClickMarker: l[0] || (l[0] = (t) => Ne(t)) }, { item: $(({ legend: t, index: n }) => [ r(Te) ? T("", !0) : (i(), p("div", { key: 0, onClick: (s) => t.segregate(), style: D(`opacity:${Y.value.length ? Y.value.includes(n) ? 1 : 0.5 : 1}`) }, ve(t.name) + " (" + ve(t.count) + ") ", 13, Io)) ]), _: 1 }, 8, ["legendSet", "config"])) : T("", !0), C(o.$slots, "legend", { legend: dt.value }, void 0, !0) ], 512) ], 8, ["to"])) : T("", !0), o.$slots.source ? (i(), p("div", { key: 6, ref_key: "source", ref: Ye, dir: "auto" }, [ C(o.$slots, "source", {}, void 0, !0) ], 512)) : T("", !0), Le(r(_t), { show: M.value.showTooltip && $e.value, backgroundColor: e.value.style.chart.tooltip.backgroundColor, color: e.value.style.chart.tooltip.color, fontSize: e.value.style.chart.tooltip.fontSize, borderRadius: e.value.style.chart.tooltip.borderRadius, borderColor: e.value.style.chart.tooltip.borderColor, borderWidth: e.value.style.chart.tooltip.borderWidth, backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity, position: e.value.style.chart.tooltip.position, offsetY: e.value.style.chart.tooltip.offsetY, parent: z.value, content: Ae.value, isCustom: me.value, isFullscreen: X.value, smooth: e.value.style.chart.tooltip.smooth, backdropFilter: e.value.style.chart.tooltip.backdropFilter }, { "tooltip-before": $(() => [ C(o.$slots, "tooltip-before", Q(ee({ ...ae.value })), void 0, !0) ]), "tooltip-after": $(() => [ C(o.$slots, "tooltip-after", Q(ee({ ...ae.value })), void 0, !0) ]), _: 3 }, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isCustom", "isFullscreen", "smooth", "backdropFilter"]), je.value ? (i(), U(r($t), { key: 7, hideDetails: "", config: { open: M.value.showTable, maxHeight: 1e4, body: { backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color }, head: { backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color } } }, { content: $(() => [ Le(r(At), { colNames: ye.value.colNames, head: ye.value.head, body: ye.value.body, config: ye.value.config, title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`, onClose: l[1] || (l[1] = (t) => M.value.showTable = !1) }, { th: $(({ th: t }) => [ V("div", { innerHTML: t, style: { display: "flex", "align-items": "center" } }, null, 8, Lo) ]), td: $(({ td: t }) => [ Xt(ve(t.name || t), 1) ]), _: 1 }, 8, ["colNames", "head", "body", "config", "title"]) ]), _: 1 }, 8, ["config"])) : T("", !0), r(Te) ? (i(), U(yo, { key: 8 })) : T("", !0) ], 46, Co)); } }, Ko = /* @__PURE__ */ bo(zo, [["__scopeId", "data-v-8feb3ba3"]]); export { Ko as default };