vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
869 lines (868 loc) • 36.1 kB
JavaScript
import { defineAsyncComponent as E, computed as w, ref as f, toRefs as St, watch as le, onMounted as Ot, onBeforeUnmount as Dt, createElementBlock as g, openBlock as h, unref as i, normalizeStyle as ae, normalizeClass as ge, createBlock as V, createCommentVNode as x, renderSlot as b, createElementVNode as S, createVNode as ke, withCtx as m, normalizeProps as _, guardReactiveProps as F, createSlots as Ze, Fragment as j, renderList as Ce, mergeProps as we, toDisplayString as ne, resolveDynamicComponent as Pt, createTextVNode as Je, nextTick as It } from "vue";
import { u as Et, a as xe } from "./useNestedProp-2p4Tjzc8.js";
import { c as Ke, t as Bt, i as $e, j as se, o as Mt, g as Nt, k as Rt, m as zt, d as Qe, X as Lt, q as Ut, u as Vt, x as Ae, H as jt, v as Gt, r as Yt, y as Xt, a as qt } from "./lib-2iaAPQ_c.js";
import { u as Ht } from "./usePrinter-ChVMpU2f.js";
import { u as Wt, B as Zt } from "./BaseScanner-BMpwQAfz.js";
import { u as Jt } from "./useSvgExport-ByUukOZt.js";
import { u as Kt } from "./useThemeCheck-DGJ31Vi5.js";
import { u as Qt } from "./useUserOptionState-BIvW1Kz7.js";
import { u as eo } from "./useChartAccessibility-9icAAmYg.js";
import { t as to, u as oo } from "./useResponsive-DfdjqQps.js";
import lo from "./img-CqYIrJ8I.js";
import ao from "./Title-DSOZzIrU.js";
import { _ as no } from "./_plugin-vue_export-helper-CHgC5LLL.js";
function so(u, c = 0) {
const p = u.reduce((a, { x: s, r: d }) => Math.min(a, s - d - c), 1 / 0), y = u.reduce((a, { x: s, r: d }) => Math.max(a, s + d + c), -1 / 0), v = u.reduce((a, { y: s, r: d }) => Math.min(a, s - d - c), 1 / 0), n = u.reduce((a, { y: s, r: d }) => Math.max(a, s + d + c), -1 / 0);
return [p, v, y - p, n - v];
}
function ro(u, c, p) {
const y = u._, v = u.next._, n = y.r + v.r, a = (y.x * v.r + v.x * y.r) / n, s = (y.y * v.r + v.y * y.r) / n;
return Math.max(Math.abs(a * p), Math.abs(s * c));
}
function uo(u, c, p) {
const y = ro, v = u.length;
if (!v) return u;
let n, a, s;
if (n = u[0], n.x = 0, n.y = 0, !(v > 1) || (a = u[1], n.x = -a.r, a.x = n.r, a.y = 0, !(v > 2))) return u;
et(a, n, s = u[2]), n = new re(n), a = new re(a), s = new re(s), n.next = s.previous = a, a.next = n.previous = s, s.next = a.previous = n;
e: for (let d = 3; d < v; ++d) {
et(n._, a._, s = u[d]), s = new re(s);
let k = a.next, D = n.previous, $ = a._.r, J = n._.r;
do
if ($ <= J) {
if (tt(k._, s._)) {
a = k, n.next = a, a.previous = n, --d;
continue e;
}
$ += k._.r, k = k.next;
} else {
if (tt(D._, s._)) {
n = D, n.next = a, a.previous = n, --d;
continue e;
}
J += D._.r, D = D.previous;
}
while (k !== D.next);
s.previous = n, s.next = a, n.next = a.previous = a = s;
let K = y(n, p, c), Q;
for (; (s = s.next) !== a; )
(Q = y(s, p, c)) < K && (n = s, K = Q);
a = n.next;
}
return u;
}
function et(u, c, p) {
const y = u.x - c.x, v = u.y - c.y, n = y * y + v * v;
if (n) {
const a = (c.r + p.r) ** 2, s = (u.r + p.r) ** 2;
if (a > s) {
const d = (n + s - a) / (2 * n), k = Math.sqrt(Math.max(0, s / n - d * d));
p.x = u.x - d * y - k * v, p.y = u.y - d * v + k * y;
} else {
const d = (n + a - s) / (2 * n), k = Math.sqrt(Math.max(0, a / n - d * d));
p.x = c.x + d * y - k * v, p.y = c.y + d * v + k * y;
}
} else
p.x = c.x + p.r, p.y = c.y;
}
function tt(u, c) {
const p = u.r + c.r - 1e-6, y = c.x - u.x, v = c.y - u.y;
return p > 0 && p * p > y * y + v * v;
}
class re {
constructor(c) {
this._ = c, this.next = null, this.previous = null;
}
}
const ot = { style: { chart: { backgroundColor: "#1A1A1A", color: "#CCCCCC", circles: { stroke: "#1A1A1A", selectedShadowColor: "#CCCCCC" }, title: { color: "#CCCCCC", subtitle: { color: "#757575" } }, tooltip: { backgroundColor: "#1A1A1A", backgroundOpacity: 70, color: "#CCCCCC", borderColor: "#5A5A5A" } } } }, lt = { style: { chart: { backgroundColor: "#FFF8E1", color: "#424242", title: { color: "#424242", subtitle: { color: "#757575" } }, tooltip: { backgroundColor: "#FFECB3", backgroundOpacity: 30, color: "#424242", borderColor: "#FF8A65" } } } }, at = { style: { chart: { backgroundColor: "#1E1E1E", color: "#BDBDBD", title: { color: "#FFF8E1", subtitle: { color: "#BDBDBD" } }, circles: { stroke: "#3A3A3A", selectedShadowColor: "#FFF8E1" }, tooltip: { backgroundColor: "#1E1E1E", backgroundOpacity: 30, color: "#FFF8E1", borderColor: "#FF8A65" } } } }, nt = { style: { chart: { backgroundColor: "#1A1A1A", color: "#99AA99", title: { color: "#66CC66", subtitle: { color: "#99AA99" } }, circles: { stroke: "#3A3A3A", selectedShadowColor: "#66CC66" }, tooltip: { backgroundColor: "#2A2F2A", color: "#AACCAA", borderColor: "#66CC66" } } } }, st = { style: { chart: { backgroundColor: "#fbfafa", color: "#8A9892", title: { color: "#8A9892", subtitle: { color: "#99AA99" } }, tooltip: { backgroundColor: "#fbfafa", color: "#8A9892" } } } }, rt = { style: { chart: { backgroundColor: "#f6f6fb", color: "#50606C", title: { color: "#50606C", subtitle: { color: "#718890" } }, tooltip: { backgroundColor: "#f6f6fb", color: "#50606C" } } } }, ut = {
default: {},
dark: ot,
celebration: lt,
celebrationNight: at,
hack: nt,
zen: st,
concrete: rt
}, Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
celebration: lt,
celebrationNight: at,
concrete: rt,
dark: ot,
default: ut,
hack: nt,
zen: st
}, Symbol.toStringTag, { value: "Module" })), io = ["id"], co = ["xmlns", "viewBox"], vo = ["x", "y", "width", "height"], fo = ["id"], ho = ["stop-color"], po = ["stop-color"], bo = ["stop-color"], yo = { key: 0 }, mo = ["x", "y", "width", "height", "stroke", "stroke-width", "fill", "rx", "onMouseenter", "onMouseout", "onClick"], go = ["x", "y", "width", "height", "stroke", "stroke-width", "fill", "rx"], ko = ["x", "y", "width", "height", "fill", "rx"], Co = ["x", "y", "font-size", "fill", "font-weight"], wo = ["x", "y", "font-size", "fill", "font-weight"], xo = {
key: 4,
class: "vue-data-ui-watermark"
}, $o = ["innerHTML"], Ao = {
__name: "vue-ui-circle-pack",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectDatapoint"],
setup(u, { expose: c, emit: p }) {
const y = E(() => import("./Tooltip-D0pGX8qz.js")), v = E(() => import("./BaseIcon-CbVDYv89.js")), n = E(() => import("./vue-ui-accordion-Dm0mNNKQ.js")), a = E(() => import("./DataTable-BT_IeqPe.js")), s = E(() => import("./UserOptions-BQO4YFrn.js")), d = E(() => import("./PenAndPaper-CvyKWfNl.js")), k = E(() => import("./PackageVersion-Br3DrrFh.js")), D = E(() => import("./BaseDraggableDialog-Z5LfhW87.js")), $ = u, J = p, { vue_ui_circle_pack: K } = Et(), { isThemeValid: Q, warnInvalidTheme: it } = Kt(), Te = w(() => !!$.dataset && $.dataset.length), G = f(Ke()), A = f(null), _e = f(null), Fe = f(null), Se = f(0), Oe = f(0), De = f(0), Pe = f(null), z = f(null), ue = f(null), ie = f(!1), ce = f(""), B = f(null), e = f(de()), { loading: Ie, FINAL_DATASET: Ee } = Wt({
...St($),
FINAL_CONFIG: e,
prepareConfig: de,
skeletonDataset: [
{ name: "_", value: 13, color: "#F2F2F2" },
{ name: "_", value: 8, color: "#DBDBDB" },
{ name: "_", value: 5, color: "#ADADAD" },
{ name: "_", value: 3, color: "#969696" },
{ name: "_", value: 2, color: "#808080" },
{ name: "_", value: 1, color: "#696969" }
],
skeletonConfig: Bt({
defaultConfig: e.value,
userConfig: {
userOptions: { show: !1 },
table: { show: !1 },
style: {
chart: {
backgroundColor: "#99999930",
circles: {
stroke: "#6A6A6A",
labels: {
name: { show: !1 },
value: { show: !1 }
}
}
}
}
}
})
}), { svgRef: L } = eo({ config: e.value.style.chart.title }), {
userOptionsVisible: ve,
setUserOptionsVisibility: Be,
keepUserOptionState: Me
} = Qt({ config: e.value });
function de() {
const t = xe({
userConfig: $.config,
defaultConfig: K
}), l = t.theme;
if (!l) return t;
if (!Q.value(t))
return it(t), t;
const o = xe({
userConfig: ut[l] || $.config,
defaultConfig: t
}), r = xe({
userConfig: $.config,
defaultConfig: o
});
return {
...r,
customPalette: r.customPalette.length ? r.customPalette : $e[l] || se
};
}
le(() => $.config, (t) => {
e.value = de(), ve.value = !e.value.userOptions.showOnChartHover, fe(), Se.value += 1, Oe.value += 1, T.value.showTable = e.value.table.show;
}, { deep: !0 });
const { isPrinting: Ne, isImaging: Re, generatePdf: ze, generateImage: Le } = Ht({
elementId: `vue-ui-circle-pack_${G.value}`,
fileName: e.value.style.chart.title.text || "vue-ui-circle-pack",
options: e.value.userOptions.print
}), ct = w(() => e.value.userOptions.show && !e.value.style.chart.title.text), T = f({
showTable: e.value.table.show,
showTooltip: e.value.style.chart.tooltip.show
});
le(e, () => {
T.value = {
showTable: e.value.table.show,
showTooltip: e.value.style.chart.tooltip.show
};
}, { immediate: !0 });
const vt = f({ h: 10, w: 10 }), Ue = f([0, 0, 100, 100]), dt = w(() => e.value.debug), ft = w(() => {
const t = e.value.style?.chart || {};
return t.dimensions && typeof t.dimensions.width == "number" ? t.dimensions.width : typeof t.width == "number" ? t.width : 300;
}), ht = w(() => {
const t = e.value.style?.chart || {};
return t.dimensions && typeof t.dimensions.height == "number" ? t.dimensions.height : typeof t.height == "number" ? t.height : 300;
}), M = f([]), P = f("0 0 100 100"), O = f(null), I = f(null);
function Ve(t, l) {
vt.value = {
w: t,
h: l
};
const o = Y.value.map((U) => ({ ...U }));
if (!o.length) {
M.value = [], Ue.value = [0, 0, t, l], P.value = `0 0 ${t} ${l}`;
return;
}
const r = uo(o, l, t), [C, R, W, me] = so(r, 1), Z = Math.min(
W ? t / W : 1,
me ? l / me : 1
), _t = (t - W * Z) / 2, Ft = (l - me * Z) / 2;
M.value = r.map((U) => ({
...U,
x: (U.x - C) * Z + _t,
y: (U.y - R) * Z + Ft,
r: U.r * Z
})), Ue.value = [0, 0, t, l], P.value = `0 0 ${t} ${l}`;
}
function pt() {
if (!e.value.responsive || !A.value) return;
const t = to(() => {
const { width: l, height: o } = oo({
chart: A.value,
title: e.value.style.chart.title.text ? _e.value : null,
legend: null,
source: Pe.value,
noTitle: Fe.value
});
requestAnimationFrame(() => {
!l || !o || (L.value && (L.value.setAttribute("width", l), L.value.setAttribute("height", o)), Ve(l, o));
});
});
O.value && (I.value && O.value.unobserve(I.value), O.value.disconnect()), O.value = new ResizeObserver(t), I.value = A.value.parentNode || A.value, I.value && O.value.observe(I.value), t();
}
function je() {
O.value && (I.value && O.value.unobserve(I.value), O.value.disconnect(), O.value = null, I.value = null);
}
async function fe() {
Mt($.dataset) && Nt({
componentName: "VueUiCirclePack",
type: "dataset",
debug: dt.value
});
const t = ft.value, l = ht.value;
Ve(t, l), e.value.responsive ? pt() : je();
}
Ot(fe), Dt(() => {
je();
}), le(() => Ee.value, async (t) => {
await fe();
}, { deep: !0 });
const bt = w(() => Rt(e.value.customPalette)), Y = w(() => Ee.value.map((t, l) => {
const o = zt(t.color) || bt.value[l] || $e[e.value.theme || "default"][l % $e[e.value.theme || "default"].length] || se[l] || se[l % se.length];
return {
...t,
r: t.value,
id: Ke(),
color: o
};
}).filter((t) => ![null, void 0, 1 / 0, -1 / 0].includes(t.value))), X = w(() => M.value.length ? Math.max(...M.value.map((t) => t.r)) : 0);
function Ge(t, l) {
return X.value ? l / X.value * t : 0;
}
function yt(t, l) {
ie.value = !1, B.value = null, e.value.events.datapointLeave && e.value.events.datapointLeave({ datapoint: t, seriesIndex: l });
}
function mt(t, l) {
J("selectDatapoint", t), e.value.events.datapointClick && e.value.events.datapointClick({ datapoint: t, seriesIndex: l });
}
const he = f(null), q = f(!1);
function gt(t, l) {
B.value = t, e.value.events.datapointEnter && e.value.events.datapointEnter({ datapoint: t, seriesIndex: l }), he.value = { datapoint: t, seriesIndex: l, config: e.value, series: Y.value }, ie.value = !0;
const o = e.value.style.chart.tooltip.customFormat;
if (q.value = !1, Xt(o))
try {
const r = o({
seriesIndex: l,
datapoint: t,
series: Y.value,
config: e.value
});
typeof r == "string" && (ce.value = r, q.value = !0);
} catch {
console.warn("Custom format cannot be applied."), q.value = !1;
}
if (!q.value) {
let r = "";
r += `
<div style="display:flex;align-items:center;gap:4px;">
<svg viewBox="0 0 10 10" height="${e.value.style.chart.tooltip.fontSize}" width="${e.value.style.chart.tooltip.fontSize}">
<circle
cx="5"
cy="5"
r="5"
fill="${e.value.style.chart.circles.gradient.show ? `url(#${t.id})` : t.color}"
/>
</svg>
<span>${t.name}: <b>${pe(t)}</b></span>
</div>
`, ce.value = r;
}
}
function pe(t) {
return qt(
e.value.style.chart.circles.labels.value.formatter,
t.value,
Qe({
p: e.value.style.chart.circles.labels.value.prefix,
v: t.value,
s: e.value.style.chart.circles.labels.value.suffix,
r: e.value.style.chart.circles.labels.value.rounding
})
);
}
function Ye(t) {
if (!t)
return 0;
const l = pe(t), o = t.r / (l.length || 1) * (l.length === 1 ? 1 : 2);
return Math.min(t.r / 2.5, o);
}
const N = f(!1);
function Xe(t) {
N.value = t, De.value += 1;
}
const ee = f(!1);
function be() {
ee.value = !ee.value;
}
const te = w(() => {
const t = Y.value.map((o) => ({
name: o.name,
value: o.value,
color: o.color
})).toSorted((o, r) => r.value - o.value), l = t.map((o) => o.value);
return { head: t, body: l };
});
function ye(t = null) {
It(() => {
const l = te.value.head.map((C, R) => [[C.name], [te.value.body[R]]]), o = [
[e.value.style.chart.title.text],
[e.value.style.chart.title.subtitle.text],
[[""], [e.value.table.columnNames.value]]
].concat(l), r = Gt(o);
t ? t(r) : Yt({ csvContent: r, title: e.value.style.chart.title.text || "vue-ui-circle-pack" });
});
}
const oe = w(() => {
const t = [
e.value.table.columnNames.datapoint,
e.value.table.columnNames.value
], l = te.value.head.map((C, R) => {
const W = Qe({
p: e.value.style.chart.circles.labels.value.prefix,
v: te.value.body[R],
s: e.value.style.chart.circles.labels.value.suffix,
r: e.value.style.chart.circles.labels.value.rounding
});
return [
{
color: C.color,
name: C.name
},
W
];
}), o = {
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.datapoint,
e.value.table.columnNames.value
],
head: t,
body: l,
config: o
};
});
function qe() {
T.value.showTable = !T.value.showTable;
}
function kt() {
T.value.showTooltip = !T.value.showTooltip;
}
function Ct() {
return Y.value;
}
async function wt({ scale: t = 2 } = {}) {
if (!A.value) return;
const { width: l, height: o } = A.value.getBoundingClientRect(), r = l / o, { imageUri: C, base64: R } = await lo({ domElement: A.value, base64: !0, img: !0, scale: t });
return {
imageUri: C,
base64: R,
title: e.value.style.chart.title.text,
width: l,
height: o,
aspectRatio: r
};
}
const H = w(() => {
const t = e.value.table.useDialog && !e.value.table.show, l = T.value.showTable;
return {
component: t ? D : n,
title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? `: ${e.value.style.chart.title.subtitle.text}` : ""}`,
props: t ? {
backgroundColor: e.value.table.th.backgroundColor,
color: e.value.table.th.color,
headerColor: e.value.table.th.color,
headerBg: e.value.table.th.backgroundColor,
isFullscreen: N.value,
fullscreenParent: A.value,
forcedWidth: Math.min(500, window.innerWidth * 0.8)
} : {
hideDetails: !0,
config: {
open: l,
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
}
}
}
};
});
le(() => T.value.showTable, (t) => {
e.value.table.show || (t && e.value.table.useDialog && z.value ? z.value.open() : z.value && "close" in z.value && z.value.close());
});
function He() {
T.value.showTable = !1, ue.value && ue.value.setTableIconState(!1);
}
const xt = w(() => e.value.style.chart.backgroundColor), $t = w(() => e.value.style.chart.title), { exportSvg: At, getSvg: Tt } = Jt({
svg: L,
title: $t,
backgroundColor: xt
});
async function We({ isCb: t }) {
if (t) {
const { blob: l, url: o, text: r, dataUrl: C } = await Tt();
e.value.userOptions.callbacks.svg({ blob: l, url: o, text: r, dataUrl: C });
} else
At();
}
return c({
getData: Ct,
getImage: wt,
generateCsv: ye,
generatePdf: ze,
generateImage: Le,
generateSvg: We,
toggleTable: qe,
toggleAnnotator: be,
toggleFullscreen: Xe
}), (t, l) => (h(), g("div", {
id: `vue-ui-circle-pack_${G.value}`,
class: ge(`vue-data-ui-component vue-ui-circle-pack ${N.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${i(Ie) ? "loading" : ""}`),
ref_key: "circlePackChart",
ref: A,
style: ae(`font-family:${e.value.style.fontFamily};text-align:center;background:${e.value.style.chart.backgroundColor};`),
onMouseenter: l[1] || (l[1] = () => i(Be)(!0)),
onMouseleave: l[2] || (l[2] = () => i(Be)(!1))
}, [
e.value.userOptions.buttons.annotator ? (h(), V(i(d), {
key: 0,
svgRef: i(L),
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
active: ee.value,
scale: X.value / 100,
onClose: be
}, {
"annotator-action-close": m(() => [
b(t.$slots, "annotator-action-close", {}, void 0, !0)
]),
"annotator-action-color": m(({ color: o }) => [
b(t.$slots, "annotator-action-color", _(F({ color: o })), void 0, !0)
]),
"annotator-action-draw": m(({ mode: o }) => [
b(t.$slots, "annotator-action-draw", _(F({ mode: o })), void 0, !0)
]),
"annotator-action-undo": m(({ disabled: o }) => [
b(t.$slots, "annotator-action-undo", _(F({ disabled: o })), void 0, !0)
]),
"annotator-action-redo": m(({ disabled: o }) => [
b(t.$slots, "annotator-action-redo", _(F({ disabled: o })), void 0, !0)
]),
"annotator-action-delete": m(({ disabled: o }) => [
b(t.$slots, "annotator-action-delete", _(F({ disabled: o })), void 0, !0)
]),
_: 3
}, 8, ["svgRef", "backgroundColor", "color", "active", "scale"])) : x("", !0),
b(t.$slots, "userConfig", {}, void 0, !0),
ct.value ? (h(), g("div", {
key: 1,
ref_key: "noTitle",
ref: Fe,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : x("", !0),
e.value.style.chart.title.text ? (h(), g("div", {
key: 2,
ref_key: "chartTitle",
ref: _e,
style: "width:100%;background:transparent;padding-bottom:12px"
}, [
(h(), V(ao, {
key: `title_${Se.value}`,
config: {
title: {
cy: "donut-div-title",
...e.value.style.chart.title
},
subtitle: {
cy: "donut-div-subtitle",
...e.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))
], 512)) : x("", !0),
e.value.userOptions.show && Te.value && (i(Me) || i(ve)) ? (h(), V(i(s), {
ref_key: "userOptionsRef",
ref: ue,
key: `user_option_${De.value}`,
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
isPrinting: i(Ne),
isImaging: i(Re),
uid: G.value,
hasTooltip: e.value.userOptions.buttons.tooltip,
isTooltip: T.value.showTooltip,
hasLabel: !1,
hasPdf: e.value.userOptions.buttons.pdf,
hasImg: e.value.userOptions.buttons.img,
hasSvg: e.value.userOptions.buttons.svg,
hasXls: e.value.userOptions.buttons.csv,
hasTable: e.value.userOptions.buttons.table,
hasFullscreen: e.value.userOptions.buttons.fullscreen,
isFullscreen: N.value,
chartElement: A.value,
position: e.value.userOptions.position,
callbacks: e.value.userOptions.callbacks,
printScale: e.value.userOptions.print.scale,
titles: { ...e.value.userOptions.buttonTitles },
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: ee.value,
tableDialog: e.value.table.useDialog,
onToggleFullscreen: Xe,
onGeneratePdf: i(ze),
onGenerateCsv: ye,
onGenerateImage: i(Le),
onGenerateSvg: We,
onToggleTable: qe,
onToggleTooltip: kt,
onToggleAnnotator: be,
style: ae({ visibility: i(Me) ? i(ve) ? "visible" : "hidden" : "visible" })
}, Ze({ _: 2 }, [
t.$slots.menuIcon ? {
name: "menuIcon",
fn: m(({ isOpen: o, color: r }) => [
b(t.$slots, "menuIcon", _(F({ isOpen: o, color: r })), void 0, !0)
]),
key: "0"
} : void 0,
t.$slots.optionPdf ? {
name: "optionPdf",
fn: m(() => [
b(t.$slots, "optionPdf", {}, void 0, !0)
]),
key: "1"
} : void 0,
t.$slots.optionCsv ? {
name: "optionCsv",
fn: m(() => [
b(t.$slots, "optionCsv", {}, void 0, !0)
]),
key: "2"
} : void 0,
t.$slots.optionImg ? {
name: "optionImg",
fn: m(() => [
b(t.$slots, "optionImg", {}, void 0, !0)
]),
key: "3"
} : void 0,
t.$slots.optionSvg ? {
name: "optionSvg",
fn: m(() => [
b(t.$slots, "optionSvg", {}, void 0, !0)
]),
key: "4"
} : void 0,
t.$slots.optionTable ? {
name: "optionTable",
fn: m(() => [
b(t.$slots, "optionTable", {}, void 0, !0)
]),
key: "5"
} : void 0,
t.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: m(({ toggleFullscreen: o, isFullscreen: r }) => [
b(t.$slots, "optionFullscreen", _(F({ toggleFullscreen: o, isFullscreen: r })), void 0, !0)
]),
key: "6"
} : void 0,
t.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: m(({ toggleAnnotator: o, isAnnotator: r }) => [
b(t.$slots, "optionAnnotator", _(F({ toggleAnnotator: o, isAnnotator: r })), void 0, !0)
]),
key: "7"
} : void 0
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "isTooltip", "hasPdf", "hasImg", "hasSvg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "chartElement", "position", "callbacks", "printScale", "titles", "hasAnnotator", "isAnnotation", "tableDialog", "onGeneratePdf", "onGenerateImage", "style"])) : x("", !0),
S("div", {
class: ge({ "vue-ui-circle-pack-svg-container": !0, "not-responsive": !e.value.responsive })
}, [
(h(), g("svg", {
ref_key: "svgRef",
ref: L,
xmlns: i(Lt),
viewBox: P.value,
preserveAspectRatio: "xMidYMid meet",
class: ge({ "vue-data-ui-fullscreen--on": N.value, "vue-data-ui-fulscreen--off": !N.value, "not-responsive": !e.value.responsive }),
style: ae(`display:block;${e.value.responsive ? "width:100%;height:auto" : "height:100%;"};overflow:visible;background:transparent;color:${e.value.style.chart.color};background:${e.value.style.chart.backgroundColor};`)
}, [
ke(i(k)),
t.$slots["chart-background"] ? (h(), g("foreignObject", {
key: 0,
x: P.value.x,
y: P.value.y,
width: P.value.width,
height: P.value.height,
style: { pointerEvents: "none" }
}, [
b(t.$slots, "chart-background", {}, void 0, !0)
], 8, vo)) : x("", !0),
(h(!0), g(j, null, Ce(M.value, (o, r) => (h(), g(j, {
key: o.id
}, [
S("defs", null, [
S("radialGradient", {
id: o.id,
fy: "30%"
}, [
S("stop", {
offset: "10%",
"stop-color": i(Ut)(o.color, e.value.style.chart.circles.gradient.intensity / 100)
}, null, 8, ho),
S("stop", {
offset: "90%",
"stop-color": i(Vt)(o.color, 0.1)
}, null, 8, po),
S("stop", {
offset: "100%",
"stop-color": o.color
}, null, 8, bo)
], 8, fo)
]),
t.$slots.pattern ? (h(), g("g", yo, [
S("defs", null, [
b(t.$slots, "pattern", we({ ref_for: !0 }, { ...o, patternId: `pattern_${G.value}_${o.id}` }), void 0, !0)
])
])) : x("", !0),
S("rect", {
x: o.x - o.r,
y: o.y - o.r,
width: o.r * 2,
height: o.r * 2,
stroke: e.value.style.chart.circles.stroke,
"stroke-width": e.value.style.chart.circles.strokeWidth * (X.value || 1) / 100,
fill: e.value.style.chart.circles.gradient.show ? `url(#${o.id})` : o.color,
rx: o.r,
onMouseenter: (C) => gt(o, r),
onMouseout: (C) => yt(o, r),
onClick: (C) => mt(o, r)
}, null, 40, mo),
t.$slots.pattern ? (h(), g("rect", {
key: 1,
x: o.x - o.r,
y: o.y - o.r,
width: o.r * 2,
height: o.r * 2,
stroke: e.value.style.chart.circles.stroke,
"stroke-width": e.value.style.chart.circles.strokeWidth * (X.value || 1) / 100,
fill: `url(#pattern_${G.value}_${o.id})`,
rx: o.r,
style: { pointerEvents: "none" }
}, null, 8, go)) : x("", !0)
], 64))), 128)),
(h(!0), g(j, null, Ce(M.value, (o, r) => (h(), g("rect", {
key: o.id,
x: o.x - o.r,
y: o.y - o.r,
width: o.r * 2,
height: o.r * 2,
stroke: "none",
fill: B.value && B.value.id === o.id ? e.value.style.chart.circles.gradient.show ? `url(#${o.id})` : o.color : "transparent",
rx: o.r,
style: ae({
filter: B.value && B.value.id === o.id ? `drop-shadow(0px 0px 6px ${e.value.style.chart.circles.selectedShadowColor})` : "none",
opacity: B.value ? 1 : 0,
pointerEvents: "none",
transition: "opacity 0.2s ease-in-out"
})
}, null, 12, ko))), 128)),
(h(!0), g(j, null, Ce(M.value, (o, r) => (h(), g(j, {
key: o.id
}, [
t.$slots["data-label"] ? b(t.$slots, "data-label", we({
key: 0,
ref_for: !0
}, {
...o,
createTSpans: i(jt),
fontSize: {
name: o.r / 3 * e.value.style.chart.circles.labels.name.fontSizeRatio,
value: Ye(o) * e.value.style.chart.circles.labels.value.fontSizeRatio
},
color: e.value.style.chart.circles.labels.name.color ? e.value.style.chart.circles.labels.name.color : i(Ae)(o.color)
}), void 0, !0) : (h(), g(j, { key: 1 }, [
e.value.style.chart.circles.labels.name.show && o.name ? (h(), g("text", {
key: 0,
style: {
pointerEvents: "none",
transition: "opacity 0.2s ease-in-out"
},
x: o.x,
y: o.y + Ge(o.r, e.value.style.chart.circles.labels.name.offsetY) - o.r / 10,
"font-size": o.r / 3 * e.value.style.chart.circles.labels.name.fontSizeRatio,
fill: e.value.style.chart.circles.labels.name.color === "auto" ? i(Ae)(o.color) : e.value.style.chart.circles.labels.name.color,
"font-weight": e.value.style.chart.circles.labels.name.bold ? "bold" : "normal",
"text-anchor": "middle"
}, ne(o.name), 9, Co)) : x("", !0),
e.value.style.chart.circles.labels.value.show ? (h(), g("text", {
key: 1,
style: {
pointerEvents: "none",
transition: "opacity 0.2s ease-in-out"
},
x: o.x,
y: o.y + Ge(o.r, e.value.style.chart.circles.labels.value.offsetY) + o.r / 2.5,
"font-size": Ye(o) * e.value.style.chart.circles.labels.value.fontSizeRatio,
fill: e.value.style.chart.circles.labels.value.color === "auto" ? i(Ae)(o.color) : e.value.style.chart.circles.labels.value.color,
"font-weight": e.value.style.chart.circles.labels.value.bold ? "bold" : "normal",
"text-anchor": "middle"
}, ne(pe(o)), 9, wo)) : x("", !0)
], 64))
], 64))), 128)),
b(t.$slots, "svg", {
svg: { ...P.value }
}, void 0, !0)
], 14, co))
], 2),
t.$slots.watermark ? (h(), g("div", xo, [
b(t.$slots, "watermark", _(F({ isPrinting: i(Ne) || i(Re) })), void 0, !0)
])) : x("", !0),
t.$slots.source ? (h(), g("div", {
key: 5,
ref_key: "source",
ref: Pe,
dir: "auto"
}, [
b(t.$slots, "source", {}, void 0, !0)
], 512)) : x("", !0),
ke(i(y), {
show: T.value.showTooltip && ie.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: A.value,
content: ce.value,
isCustom: q.value,
isFullscreen: N.value,
smooth: e.value.style.chart.tooltip.smooth,
backdropFilter: e.value.style.chart.tooltip.backdropFilter,
smoothForce: e.value.style.chart.tooltip.smoothForce,
smoothSnapThreshold: e.value.style.chart.tooltip.smoothSnapThrehsold
}, {
"tooltip-before": m(() => [
b(t.$slots, "tooltip-before", _(F({ ...he.value })), void 0, !0)
]),
"tooltip-after": m(() => [
b(t.$slots, "tooltip-after", _(F({ ...he.value })), void 0, !0)
]),
_: 3
}, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isCustom", "isFullscreen", "smooth", "backdropFilter", "smoothForce", "smoothSnapThreshold"]),
Te.value && e.value.userOptions.buttons.table ? (h(), V(Pt(H.value.component), we({ key: 6 }, H.value.props, {
ref_key: "tableUnit",
ref: z,
onClose: He
}), Ze({
content: m(() => [
(h(), V(i(a), {
key: `table_${Oe.value}`,
colNames: oe.value.colNames,
head: oe.value.head,
body: oe.value.body,
config: oe.value.config,
title: e.value.table.useDialog ? "" : H.value.title,
withCloseButton: !e.value.table.useDialog,
onClose: He
}, {
th: m(({ th: o }) => [
S("div", {
innerHTML: o,
style: { display: "flex", "align-items": "center" }
}, null, 8, $o)
]),
td: m(({ td: o }) => [
Je(ne(o.name || o), 1)
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title", "withCloseButton"]))
]),
_: 2
}, [
e.value.table.useDialog ? {
name: "title",
fn: m(() => [
Je(ne(H.value.title), 1)
]),
key: "0"
} : void 0,
e.value.table.useDialog ? {
name: "actions",
fn: m(() => [
S("button", {
tabindex: "0",
class: "vue-ui-user-options-button",
onClick: l[0] || (l[0] = (o) => ye(e.value.userOptions.callbacks.csv))
}, [
ke(i(v), {
name: "excel",
stroke: H.value.props.color
}, null, 8, ["stroke"])
])
]),
key: "1"
} : void 0
]), 1040)) : x("", !0),
i(Ie) ? (h(), V(Zt, { key: 7 })) : x("", !0)
], 46, io));
}
}, To = /* @__PURE__ */ no(Ao, [["__scopeId", "data-v-5e1a54cd"]]), Uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: To
}, Symbol.toStringTag, { value: "Module" }));
export {
Lo as a,
Uo as b,
To as v
};