vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
1,413 lines (1,412 loc) • 49.9 kB
JavaScript
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
import { $ as t, Bt as n, D as r, Jt as i, Kt as a, Pt as o, S as ee, Vt as te, X as s, ct as ne, i as re, jt as ie, n as ae, pt as oe, q as se, r as ce, t as le, tt as ue, w as de, xt as fe } from "./lib-Bttd6u5E.js";
import { n as pe, t as me } from "./useHints-Dq_w2E8B.js";
import { t as he } from "./useConfig-D3scuR88.js";
import { t as ge } from "./usePrinter-DN5bYhTG.js";
import { n as _e, t as ve } from "./BaseScanner-DZvpgOjM.js";
import { t as ye } from "./useSvgExport-DH-FfcqQ.js";
import { t as be } from "./useNestedProp-vPNvh7rV.js";
import { t as xe } from "./useThemeCheck-C43Tcqmk.js";
import { t as Se } from "./img-Bnokohej.js";
import { n as Ce } from "./Title-BE3qg9xl.js";
import { t as we } from "./Shape-C21CMlWS.js";
import { t as Te } from "./_plugin-vue_export-helper-B3ysoDQm.js";
import { l as Ee, t as De } from "./useResponsive-ZtArZtUf.js";
import { t as Oe } from "./DefGrad-DVBqDjhO.js";
import { t as ke } from "./BaseLegendToggle-DZVucLnv.js";
import { t as Ae } from "./A11yDataTable-DdRsVULz.js";
import { t as je } from "./useUserOptionState-DK-_1ddE.js";
import { t as Me } from "./useChartAccessibility-DYqac8yF.js";
import { t as Ne } from "./labelUtils-BeVpDvTJ.js";
import { t as Pe } from "./Legend-CQxUgOd-.js";
import { t as Fe } from "./usePrefersMotion-BC-CsqR1.js";
import { t as Ie } from "./vue_ui_waffle-DIARFc7g.js";
import { Fragment as c, Teleport as Le, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createSlots as Re, createTextVNode as ze, createVNode as Be, defineAsyncComponent as m, guardReactiveProps as h, mergeProps as Ve, nextTick as He, normalizeClass as Ue, normalizeProps as g, normalizeStyle as We, onBeforeUnmount as Ge, onMounted as Ke, openBlock as _, ref as v, renderList as y, renderSlot as b, resolveDynamicComponent as qe, shallowRef as Je, toDisplayString as Ye, toRefs as Xe, unref as x, useSlots as Ze, watch as Qe, withCtx as S } from "vue";
//#region src/components/vue-ui-waffle.vue
var $e = /* @__PURE__ */ e({ default: () => bt }), et = ["id"], tt = ["id"], nt = ["id"], rt = { style: { position: "relative" } }, it = [
"xmlns",
"aria-describedby",
"viewBox"
], at = ["id"], ot = [
"x",
"y",
"height",
"width"
], st = ["height", "width"], ct = { key: 0 }, lt = [
"rx",
"x",
"y",
"height",
"width",
"stroke",
"stroke-width",
"filter"
], ut = [
"rx",
"x",
"y",
"height",
"width",
"fill",
"stroke",
"stroke-width",
"filter"
], dt = { key: 1 }, ft = [
"rx",
"x",
"y",
"height",
"width",
"fill",
"filter"
], pt = [
"textContent",
"x",
"y",
"font-size",
"fill",
"filter"
], mt = [
"x",
"y",
"height",
"width",
"onMouseover",
"onMouseleave",
"onClick"
], 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__*/ Te({
__name: "vue-ui-waffle",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectLegend", "copyAlt"],
setup(e, { expose: Te, emit: $e }) {
let bt = m(() => import("./Tooltip-DhjyfHwz.js")), xt = m(() => import("./BaseIcon-BfndwIWE.js").then((e) => e.n)), St = m(() => import("./DataTable-BbKgJ5UI.js")), Ct = m(() => import("./vue-ui-accordion-BxGriZik.js").then((e) => e.n)), wt = m(() => import("./UserOptions-Dt98of5H.js").then((e) => e.n)), Tt = m(() => import("./PenAndPaper-DAE-tnEQ.js").then((e) => e.t)), Et = m(() => import("./PackageVersion-D6d8SCp9.js").then((e) => e.t)), Dt = m(() => import("./BaseDraggableDialog-LoqqwRtV.js").then((e) => e.n)), { vue_ui_waffle: Ot } = he(), { isThemeValid: kt, warnInvalidTheme: At } = xe(), jt = Fe(), C = e, Mt = Ze(), Nt = l({
get() {
return !!C.dataset && C.dataset.length;
},
set(e) {
return e;
}
}), w = v(se()), Pt = v(!1), Ft = v(""), T = v(null), It = v(0), E = v(null), Lt = v(null), Rt = v(null), zt = v(null), Bt = v(null), Vt = v(0), Ht = v(0), Ut = v(0), Wt = v(!1), Gt = v(null), Kt = v(null), qt = v(!1), Jt = v(!1), D = v(null), Yt = v({
x: 0,
y: 0
}), Xt = v("pointer"), Zt = v(!1), O = v(on());
pe({
config: () => O.value,
dataset: () => C.dataset,
component: "VueUiWaffle",
rules: [
me.singleSeries,
me.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 k = l(() => O.value.userOptions.useCursorPointer), Qt = l(() => i({
defaultConfig: {
useCustomCells: !1,
userOptions: { show: !1 },
table: { show: !1 },
style: { chart: {
backgroundColor: "#99999930",
layout: {
labels: { captions: { show: !1 } },
rect: { stroke: "#999999" }
},
legend: {
backgroundColor: "transparent",
showValue: !1,
showPercentage: !1
}
} }
},
userConfig: O.value.skeletonConfig ?? {}
})), { loading: $t, FINAL_DATASET: en, manualLoading: tn } = _e({
...Xe(C),
FINAL_CONFIG: O,
prepareConfig: on,
callback: () => {
Promise.resolve().then(async () => {
R.value = yn();
});
},
skeletonDataset: C.config?.skeletonDataset ?? [
{
name: "",
values: [1],
color: "#AAAAAA"
},
{
name: "",
values: [1],
color: "#BABABA"
},
{
name: "",
values: [1],
color: "#CACACA"
}
],
skeletonConfig: i({
defaultConfig: O.value,
userConfig: Qt.value
})
}), { userOptionsVisible: nn, setUserOptionsVisibility: rn, keepUserOptionState: an } = je({ config: O.value }), { svgRef: A } = Me({ config: O.value.style.chart.title });
function on() {
let e = be({
userConfig: C.config,
defaultConfig: Ot
}), t = e.theme;
if (!t) return e;
if (!kt.value(e)) return At(e), e;
let n = be({
userConfig: Ie[t] || C.config,
defaultConfig: e
}), r = be({
userConfig: C.config,
defaultConfig: n
});
return {
...r,
customPalette: r.customPalette.length ? r.customPalette : a[t] || o
};
}
Qe(() => C.config, (e) => {
$t.value || (O.value = on()), nn.value = !O.value.userOptions.showOnChartHover, cn(), Vt.value += 1, Ht.value += 1, Ut.value += 1, N.value.showTable = O.value.table.show, N.value.showTooltip = O.value.style.chart.tooltip.show;
}, { deep: !0 });
let j = Je(null), M = Je(null), sn = l(() => !!O.value.debug);
function cn() {
if (ie(C.dataset) ? (ue({
componentName: "VueUiWaffle",
type: "dataset",
debug: sn.value
}), Nt.value = !1, tn.value = !0) : C.dataset.forEach((e, t) => {
oe({
datasetObject: e,
requiredAttributes: ["name", "values"]
}).forEach((e) => {
ue({
componentName: "VueUiWaffle",
type: "datasetSerieAttribute",
property: e,
index: t,
debug: sn.value
});
});
}), ie(C.dataset) || (tn.value = O.value.loading), O.value.responsive) {
let e = Ee(() => {
let { width: e, height: t } = De({
chart: E.value,
title: O.value.style.chart.title.text ? Lt.value : null,
legend: O.value.style.chart.legend.show ? Rt.value : null,
source: zt.value,
noTitle: Bt.value
});
requestAnimationFrame(() => {
P.value.width = e, P.value.height = t, F.value.width = e, F.value.height = t;
});
});
j.value && (M.value && j.value.unobserve(M.value), j.value.disconnect()), j.value = new ResizeObserver(e), M.value = E.value.parentNode, j.value.observe(M.value);
}
}
Ke(() => {
Wt.value = !0, cn();
}), Ge(() => {
j.value && (M.value && j.value.unobserve(M.value), j.value.disconnect());
});
let { isPrinting: ln, isImaging: un, generatePdf: dn, generateImage: fn } = ge({
elementId: `vue-ui-waffle_${w.value}`,
fileName: O.value.style.chart.title.text || "vue-ui-waffle",
options: O.value.userOptions.print
}), pn = l(() => O.value.userOptions.show && !O.value.style.chart.title.text), mn = l(() => de(O.value.customPalette)), N = v({
showTable: O.value.table.show,
showTooltip: O.value.style.chart.tooltip.show
});
Qe(O, () => {
N.value = {
showTable: O.value.table.show,
showTooltip: O.value.style.chart.tooltip.show
};
}, { immediate: !0 });
let P = v({
height: 512,
width: 512
}), F = v({
top: 0,
left: 0,
height: 512,
width: 512
}), I = l(() => (F.value.width - O.value.style.chart.layout.grid.size * O.value.style.chart.layout.grid.spaceBetween) / O.value.style.chart.layout.grid.size), L = l(() => (F.value.height - O.value.style.chart.layout.grid.size * O.value.style.chart.layout.grid.spaceBetween) / O.value.style.chart.layout.grid.size), hn = l(() => Math.max(1e-4, F.value.width / O.value.style.chart.layout.grid.size)), gn = l(() => Math.max(1e-4, F.value.height / O.value.style.chart.layout.grid.size));
function _n(e) {
let t = O.value.style.chart.layout.grid.size * O.value.style.chart.layout.grid.size, n = e.reduce((e, t) => e + t, 0), r = e.map((e) => e / n * t), i = r.map(Math.floor), a = r.map((e) => e % 1), o = t - i.reduce((e, t) => e + t, 0);
for (; o > 0;) {
let e = a.indexOf(Math.max(...a));
i[e] += 1, a[e] = 0, --o;
}
return i;
}
let vn = v(!1);
function yn() {
return vn.value = en.value.flatMap((e) => e.values.reduce((e, t) => e + t, 0)).reduce((e, t) => e + t, 0) === 0, en.value.map((e, t) => ({
...e,
color: ee(e.color) || mn.value[t] || o[t] || o[t % o.length],
uid: `serie_${t}`,
absoluteIndex: t
}));
}
let bn = l(() => yn()), R = v(bn.value);
Qe(() => C.dataset, (e) => {
Array.isArray(e) && e.length > 0 && (tn.value = !1);
}, { immediate: !0 }), Qe(() => C.dataset, (e) => {
R.value = yn();
}, { deep: !0 });
let xn = l(() => _n(R.value.filter((e, t) => !U.value.includes(e.uid)).map((e, t) => vn.value ? 1 : (e.values || []).reduce((e, t) => e + t, 0)))), Sn = l(() => _n(R.value.map((e, t) => vn.value ? 1 : (e.values || []).reduce((e, t) => e + t)))), z = l(() => (en.value.forEach((e, t) => {
[null, void 0].includes(e.values) && ue({
componentName: "VueUiWaffle",
type: "datasetSerieAttribute",
property: "values (number[])",
index: t
});
}), R.value.filter((e, t) => !U.value.includes(e.uid)).map((e, t) => ({
absoluteIndex: e.absoluteIndex,
uid: e.uid,
name: e.name,
color: e.color,
value: (e.values || []).reduce((e, t) => e + t, 0),
absoluteValues: e.values || [],
proportion: xn.value[t]
})))), B = l(() => R.value.map((e, t) => ({
absoluteIndex: e.absoluteIndex,
uid: e.uid,
name: e.name,
color: e.color,
value: (e.values || []).reduce((e, t) => e + t, 0),
absoluteValues: e.values || [],
proportion: Sn.value[t]
})));
function Cn() {
return B.value.map((e) => ({
name: e.name,
color: e.color,
value: e.value,
proportion: e.proportion
}));
}
let wn = l(() => {
let e = 0;
return z.value.map((t, n) => {
let r = e, i = r + t.proportion, a = [];
for (let e = Math.floor(r); e < Math.floor(i); e += 1) a.push(e);
return e = i, {
...t,
start: r,
rects: a
};
});
}), V = l(() => wn.value.flatMap((e, t) => e.rects.map((n, r) => ({
isFirst: r === 0,
isLongEnough: n.length > 2,
name: e.name,
color: e.color,
value: e.value,
serieIndex: t,
absoluteStartIndex: r < 3,
serieId: e.uid,
...e
}))).map((e, t) => ({
...e,
isAbsoluteFirst: t % O.value.style.chart.layout.grid.size === 0
}))), H = l(() => {
let e = [];
for (let t = 0; t < O.value.style.chart.layout.grid.size; t += 1) for (let n = 0; n < O.value.style.chart.layout.grid.size; n += 1) e.push({
isStartOfLine: n === 0,
position: O.value.style.chart.layout.grid.vertical ? t : n,
x: (O.value.style.chart.layout.grid.vertical ? t : n) * (I.value + O.value.style.chart.layout.grid.spaceBetween),
y: (O.value.style.chart.layout.grid.vertical ? n : t) * (L.value + O.value.style.chart.layout.grid.spaceBetween) + F.value.top
});
return e;
}), U = v([]), Tn = v(!1), En = v(Object.create(null)), Dn = v(Object.create(null)), W = v(0);
function G(e, t) {
R.value = R.value.map((n) => n.uid === e ? {
...n,
values: [t]
} : n);
}
function On(e, t) {
let n = t.find((t) => t.uid === e);
return n ? (n.values || []).reduce((e, t) => e + t, 0) : 0;
}
function kn(e) {
let t = !1;
En.value[e] && (cancelAnimationFrame(En.value[e]), delete En.value[e], t = !0), Dn.value[e] && (cancelAnimationFrame(Dn.value[e]), delete Dn.value[e], t = !0), t && (W.value = Math.max(0, W.value - 1), Tn.value = W.value > 0);
}
function An({ seriesId: e, fromValue: t, toValue: n, mode: r }) {
kn(e), W.value += 1, Tn.value = !0;
let i = t;
return new Promise((a) => {
function o() {
if (r === "increase") {
if (i >= n) {
G(e, n), --W.value, W.value <= 0 && (Tn.value = !1), delete En.value[e], a();
return;
}
i += n * .025, i > n && (i = n), G(e, i), En.value[e] = requestAnimationFrame(o);
} else {
if (i <= t / 100) {
G(e, 0), --W.value, W.value <= 0 && (Tn.value = !1), delete Dn.value[e], a();
return;
}
i /= 1.15, G(e, i), Dn.value[e] = requestAnimationFrame(o);
}
}
o();
});
}
function jn() {
R.value = bn.value;
let e = U.value.length > 0;
if (!O.value.useAnimation) {
e ? U.value = [] : U.value = q.value.map((e) => e.uid);
return;
}
e ? [...U.value].forEach((e) => {
K(e, !0);
}) : q.value.map((e) => e.uid).forEach((e) => {
K(e, !0);
});
}
function K(e, t = !1) {
if (vn.value && !t) return;
let n = t || U.value.length < q.value.length - 1 && q.value.length > 1;
if (!O.value.useAnimation) {
U.value.includes(e) ? U.value = U.value.filter((t) => t !== e) : n && U.value.push(e);
return;
}
let r = On(e, bn.value), i = On(e, R.value);
if (i !== 0 || r !== 0) {
if (U.value.includes(e)) {
if (U.value = U.value.filter((t) => t !== e), jt.value) {
kn(e), G(e, r), Wn("selectLegend", z.value.map((e) => ({
name: e.name,
color: e.color,
value: e.value,
proportion: e.proportion / O.value.style.chart.layout.grid.size ** 2
})));
return;
}
An({
seriesId: e,
fromValue: i,
toValue: r,
mode: "increase"
}).then(() => {
Wn("selectLegend", z.value.map((e) => ({
name: e.name,
color: e.color,
value: e.value,
proportion: e.proportion / O.value.style.chart.layout.grid.size ** 2
})));
});
return;
}
if (n) {
if (jt.value) {
kn(e), U.value.includes(e) || U.value.push(e), G(e, 0), Wn("selectLegend", z.value.map((e) => ({
name: e.name,
color: e.color,
value: e.value,
proportion: e.proportion / O.value.style.chart.layout.grid.size ** 2
})));
return;
}
An({
seriesId: e,
fromValue: i,
toValue: 0,
mode: "decrease"
}).then(() => {
U.value.includes(e) || U.value.push(e), G(e, 0), Wn("selectLegend", z.value.map((e) => ({
name: e.name,
color: e.color,
value: e.value,
proportion: e.proportion / O.value.style.chart.layout.grid.size ** 2
})));
});
}
}
}
function Mn(e) {
return B.value.length ? B.value.find((t) => t.name === e) || (O.value.debug && console.warn(`VueUiWaffle - Series name not found "${e}"`), null) : (O.value.debug && console.warn("VueUiWaffle - There are no series to show."), null);
}
function Nn(e) {
let t = Mn(e);
t !== null && U.value.includes(t.uid) && K(t.uid);
}
function Pn(e) {
let t = Mn(e);
t !== null && (U.value.includes(t.uid) || K(t.uid));
}
function Fn({ val: e, percentage: t, showVal: n, showPercentage: r, config: i }) {
return Ne({
config: i,
val: e,
percentage: t,
showVal: n,
showPercentage: r
});
}
let q = l(() => R.value.map((e, t) => {
let n = (e.values || []).reduce((e, t) => e + t, 0), r = n / R.value.map((e) => (e.values || []).reduce((e, t) => e + t, 0)).reduce((e, t) => e + t, 0);
return {
name: e.name,
color: e.color || mn[t] || o[t] || o[t % o.length],
value: n,
proportion: r,
uid: e.uid,
shape: "square"
};
}).map((e, t) => {
let n = Fn({
val: re(O.value.style.chart.layout.labels.dataLabels.formatter, e.value, s({
p: O.value.style.chart.layout.labels.dataLabels.prefix,
v: e.value,
s: O.value.style.chart.layout.labels.dataLabels.suffix,
r: O.value.style.chart.legend.roundingValue
}), {
datapoint: e,
index: t
}),
percentage: isNaN(e.value / J.value) ? "-" : s({
v: e.value / J.value * 100,
s: "%",
r: O.value.style.chart.legend.roundingPercentage
}),
showVal: O.value.style.chart.legend.showValue,
showPercentage: O.value.style.chart.legend.showPercentage,
config: O.value.style.chart.legend
});
return {
...e,
opacity: U.value.includes(e.uid) ? .5 : 1,
segregate: () => K(e.uid),
isSegregated: U.value.includes(e.uid),
display: `${e.name}${O.value.style.chart.legend.showPercentage || O.value.style.chart.legend.showValue ? ": " : ""}${n}`
};
})), In = l(() => ({
cy: "waffle-div-legend",
backgroundColor: O.value.style.chart.legend.backgroundColor,
color: O.value.style.chart.legend.color,
fontSize: O.value.style.chart.legend.fontSize,
paddingBottom: 12,
fontWeight: O.value.style.chart.legend.bold ? "bold" : ""
})), J = l(() => z.value.map((e) => e.value).reduce((e, t) => e + t, 0)), Ln = v(null), Rn = v(null), Y = l(() => {
let e = /* @__PURE__ */ new Map();
return V.value.forEach((t, n) => {
e.has(t.serieIndex) ? e.get(t.serieIndex).rectIndexes.push(n) : e.set(t.serieIndex, {
serieIndex: t.serieIndex,
absoluteIndex: t.absoluteIndex,
serieId: t.serieId,
name: t.name,
color: t.color,
value: t.value,
proportion: t.proportion,
rectIndexes: [n]
});
}), Array.from(e.values()).sort((e, t) => e.serieIndex - t.serieIndex);
});
function zn(e) {
return Y.value.find((t) => t.serieIndex === e) || null;
}
function Bn(e) {
let t = zn(e);
return !t || !t.rectIndexes.length ? null : t.rectIndexes[0];
}
function Vn(e) {
let t = V.value[e];
O.value.events.datapointClick && O.value.events.datapointClick({
datapoint: t,
seriesIndex: t.serieIndex
});
}
function Hn(e) {
let t = V.value[e];
O.value.events.datapointLeave && O.value.events.datapointLeave({
datapoint: t,
seriesIndex: t.serieIndex
}), Rn.value = null, Pt.value = !1, T.value = null, D.value = null, Xt.value = "pointer";
}
function Un(e, t = "pointer") {
if (U.value.length === C.dataset.length) return;
let n = V.value[e];
if (!n) return;
Xt.value = t, D.value = n.serieIndex, Ln.value = {
datapoint: n,
seriesIndex: n.absoluteIndex,
series: R.value,
config: O.value
}, O.value.events.datapointEnter && Rn.value !== n.serieIndex && O.value.events.datapointEnter({
datapoint: n,
seriesIndex: n.serieIndex
}), Rn.value = n.serieIndex, Pt.value = !0, T.value = n.serieIndex;
let r = O.value.style.chart.tooltip.customFormat;
if (fe(r) && ne(() => r({
seriesIndex: n.absoluteIndex,
datapoint: n,
series: R.value,
config: O.value
}))) Ft.value = r({
seriesIndex: n.absoluteIndex,
datapoint: n,
series: R.value,
config: O.value
});
else {
let e = "";
e += `<div style="width:100%;text-align:center;border-bottom:1px solid ${O.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${n.name}</div>`, e += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 60 60" height="14" width="14"><rect x="0" y="0" height="60" width="60" stroke="none" rx="1" fill="${n.color}" />${Mt.pattern ? `<rect x="0" y="0" height="60" width="60" stroke="none" rx="1" stroke="none" fill="url(#pattern_${w.value}_${n.absoluteIndex})"/>` : ""}</svg>`, e += `<b>${Fn({
config: O.value.style.chart.tooltip,
showVal: O.value.style.chart.tooltip.showValue,
showPercentage: O.value.style.chart.tooltip.showPercentage,
val: `<span>${re(O.value.style.chart.layout.labels.dataLabels.formatter, n.value, s({
p: O.value.style.chart.layout.labels.dataLabels.prefix,
v: n.value,
s: O.value.style.chart.layout.labels.dataLabels.suffix,
r: O.value.style.chart.tooltip.roundingValue
}), {
datapoint: n,
seriesIndex: n.absoluteIndex,
series: R.value
})}</span>`,
percentage: `<span>${s({
v: vn.value ? 1 / en.value.length * 100 : n.value / J.value * 100,
s: "%",
r: O.value.style.chart.tooltip.roundingPercentage
})}</span>`
})}</b></div>`, Ft.value = e;
}
}
let Wn = $e, X = l(() => ({
head: z.value.map((e) => ({
name: e.name,
color: e.color
})),
body: z.value.map((e) => e.value)
}));
function Gn(e) {
return O.value.useBlurOnHover && ![null, void 0].includes(T.value) && T.value !== e ? `url(#blur_${w.value})` : "";
}
function Kn(e, t) {
return O.value.style.chart.layout.labels.captions.show ? V.value.length && !Tn.value && !O.value.style.chart.layout.grid.vertical && (V.value[e].isFirst && t.position < O.value.style.chart.layout.grid.size - 2 || V.value[e].isAbsoluteFirst && e % O.value.style.chart.layout.grid.size === 0 && V.value[e].absoluteStartIndex) : !1;
}
function qn(e, t = null) {
let n = re(O.value.style.chart.layout.labels.dataLabels.formatter, V.value[e].value, s({
p: O.value.style.chart.layout.labels.dataLabels.prefix,
v: V.value[e].value,
s: O.value.style.chart.layout.labels.dataLabels.suffix,
r: O.value.style.chart.layout.labels.captions.roundingValue
}), {
datapoint: V.value[e],
position: t
}), r = s({
v: V.value[e].proportion,
s: "%",
r: O.value.style.chart.layout.labels.captions.roundingPercentage
}), i = (O.value.style.chart.layout.labels.captions.serieNameAbbreviation ? ae({
source: V.value[e].name,
length: O.value.style.chart.layout.labels.captions.serieNameMaxAbbreviationSize
}) : V.value[e].name) + (O.value.style.chart.layout.labels.captions.showPercentage || O.value.style.chart.layout.labels.captions.showValue ? ":" : "");
return `${O.value.style.chart.layout.labels.captions.showSerieName ? i : ""} ${Fn({
val: n,
percentage: r,
showVal: O.value.style.chart.layout.labels.captions.showValue,
showPercentage: O.value.style.chart.layout.labels.captions.showPercentage,
config: O.value.style.chart.layout.labels.dataLabels
})}`;
}
function Jn(e = null) {
He(() => {
let n = X.value.head.map((e, t) => [
[e.name],
[X.value.body[t]],
[isNaN(X.value.body[t] / J.value) ? "-" : X.value.body[t] / J.value * 100]
]), i = [
[O.value.style.chart.title.text],
[O.value.style.chart.title.subtitle.text],
[
[""],
["val"],
["%"]
]
].concat(n), a = r(i);
e ? e(a) : t({
csvContent: a,
title: O.value.style.chart.title.text || "vue-ui-waffle"
});
});
}
let Z = l(() => ({
head: [
" <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>",
re(O.value.style.chart.layout.labels.dataLabels.formatter, J.value, s({
p: O.value.style.chart.layout.labels.dataLabels.prefix,
v: J.value,
s: O.value.style.chart.layout.labels.dataLabels.suffix,
r: O.value.table.td.roundingValue
})),
"100%"
],
body: X.value.head.map((e, t) => [
{
color: e.color,
name: e.name
},
re(O.value.style.chart.layout.labels.dataLabels.formatter, X.value.body[t], s({
p: O.value.style.chart.layout.labels.dataLabels.prefix,
v: X.value.body[t],
s: O.value.style.chart.layout.labels.dataLabels.suffix,
r: O.value.table.td.roundingValue
})),
isNaN(X.value.body[t] / J.value) ? "-" : s({
v: X.value.body[t] / J.value * 100,
s: "%",
r: O.value.table.td.roundingPercentage
})
]),
config: {
th: {
backgroundColor: O.value.table.th.backgroundColor,
color: O.value.table.th.color,
outline: O.value.table.th.outline
},
td: {
backgroundColor: O.value.table.td.backgroundColor,
color: O.value.table.td.color,
outline: O.value.table.td.outline
},
shape: "square",
breakpoint: O.value.table.responsiveBreakpoint
},
colNames: [
O.value.table.columnNames.series,
O.value.table.columnNames.value,
O.value.table.columnNames.percentage
]
})), Q = v(!1);
function Yn(e) {
Q.value = e, It.value += 1;
}
function Xn() {
N.value.showTable = !N.value.showTable;
}
function Zn() {
N.value.showTooltip = !N.value.showTooltip;
}
let Qn = v(!1);
function $n() {
Qn.value = !Qn.value;
}
async function er({ scale: e = 2 } = {}) {
if (!E.value) return;
let { width: t, height: n } = E.value.getBoundingClientRect(), r = t / n, { imageUri: i, base64: a } = await Se({
domElement: E.value,
base64: !0,
img: !0,
scale: e
});
return {
imageUri: i,
base64: a,
title: O.value.style.chart.title.text,
width: t,
height: n,
aspectRatio: r
};
}
let $ = l(() => {
let e = O.value.table.useDialog && !O.value.table.show, t = N.value.showTable;
return {
component: e ? Dt : Ct,
title: `${O.value.style.chart.title.text}${O.value.style.chart.title.subtitle.text ? `: ${O.value.style.chart.title.subtitle.text}` : ""}`,
props: e ? {
backgroundColor: O.value.table.th.backgroundColor,
color: O.value.table.th.color,
headerColor: O.value.table.th.color,
headerBg: O.value.table.th.backgroundColor,
isFullscreen: Q.value,
fullscreenParent: E.value,
forcedWidth: Math.min(500, window.innerWidth * .8),
isCursorPointer: k.value
} : {
hideDetails: !0,
config: {
open: t,
maxHeight: 1e4,
body: {
backgroundColor: O.value.style.chart.backgroundColor,
color: O.value.style.chart.color
},
head: {
backgroundColor: O.value.style.chart.backgroundColor,
color: O.value.style.chart.color
}
}
}
};
});
Qe(() => N.value.showTable, (e) => {
O.value.table.show || (e && O.value.table.useDialog && Gt.value ? Gt.value.open() : "close" in Gt.value && Gt.value.close());
});
function tr() {
N.value.showTable = !1, Kt.value && Kt.value.setTableIconState(!1);
}
let nr = l(() => q.value.map((e) => ({
...e,
name: e.display
}))), rr = l(() => O.value.style.chart.backgroundColor), ir = l(() => O.value.style.chart.legend), ar = l(() => O.value.style.chart.title), { exportSvg: or, getSvg: sr } = ye({
svg: A,
title: ar,
legend: ir,
legendItems: nr,
backgroundColor: rr
});
async function cr({ isCb: e }) {
Jt.value = !0, await He();
try {
if (e) {
let { blob: e, url: t, text: n, dataUrl: r } = await sr();
await Promise.resolve(O.value.userOptions.callbacks.svg({
blob: e,
url: t,
text: n,
dataUrl: r
}));
} else await Promise.resolve(or());
} finally {
Jt.value = !1;
}
}
function lr(e) {
if (e?.stage === "start") {
qt.value = !0;
return;
}
if (e?.stage === "end") {
qt.value = !1;
return;
}
fn();
}
async function ur() {
if (Wn("copyAlt", {
config: O.value,
dataset: B.value
}), !O.value.userOptions.callbacks.altCopy) {
console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.");
return;
}
await Promise.resolve(O.value.userOptions.callbacks.altCopy({
config: O.value,
dataset: B.value
}));
}
function dr() {
D.value = null, Zt.value = !0;
}
function fr() {
D.value = null, Xt.value = "pointer", Pt.value = !1, T.value = null, Rn.value = null, Zt.value = !1;
}
function pr(e) {
if (!A.value || Qn.value || document.activeElement !== A.value || !Y.value.length || U.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) {
D.value = null, Xt.value = "pointer", Pt.value = !1, T.value = null, Rn.value = null;
return;
}
if (r) {
if (D.value === null) return;
let e = Bn(D.value);
if (e === null) return;
Vn(e);
return;
}
let a = Y.value.findIndex((e) => e.serieIndex === D.value), o = null;
if (o = a === -1 ? n ? Y.value[0] : Y.value[Y.value.length - 1] : n ? Y.value[(a + 1) % Y.value.length] : Y.value[(a - 1 + Y.value.length) % Y.value.length], !o) return;
let ee = Bn(o.serieIndex);
ee !== null && (mr(o.serieIndex), Un(ee, "keyboard"));
}
function mr(e) {
if (!Number.isFinite(e) || !A.value) return;
let t = zn(e);
if (!t || !t.rectIndexes.length) return;
let n = t.rectIndexes.map((e) => {
let t = H.value[e];
return t ? {
x: t.x + O.value.style.chart.layout.grid.spaceBetween / 2 + hn.value / 2,
y: t.y + O.value.style.chart.layout.grid.spaceBetween / 2 + gn.value / 2
} : null;
}).filter(Boolean);
if (!n.length) return;
let r = Math.min(...n.map((e) => e.x)), i = Math.max(...n.map((e) => e.x)), a = Math.min(...n.map((e) => e.y)), o = Math.max(...n.map((e) => e.y)), ee = (r + i) / 2, te = (a + o) / 2, s = A.value.getBoundingClientRect();
Yt.value = {
x: s.left + ee / P.value.width * s.width,
y: s.top + te / P.value.height * s.height
};
}
let hr = l(() => ({
headers: Z.value?.colNames ?? [],
rows: Z.value?.body ?? []
}));
return Te({
getData: Cn,
getImage: er,
generatePdf: dn,
generateCsv: Jn,
generateImage: fn,
generateSvg: cr,
hideSeries: Pn,
showSeries: Nn,
toggleTable: Xn,
toggleTooltip: Zn,
toggleAnnotator: $n,
toggleFullscreen: Yn,
copyAlt: ur
}), (e, t) => (_(), f("div", {
class: Ue(`vue-data-ui-component vue-ui-waffle ${Q.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
ref_key: "waffleChart",
ref: E,
id: `vue-ui-waffle_${w.value}`,
style: We(`font-family:${O.value.style.fontFamily};width:100%; text-align:center;background:${O.value.style.chart.backgroundColor};${O.value.responsive ? "height: 100%" : ""}`),
onMouseenter: t[2] ||= () => x(rn)(!0),
onMouseleave: t[3] ||= () => x(rn)(!1)
}, [
p("div", {
id: `chart-instructions-${w.value}`,
class: "sr-only"
}, [p("p", null, Ye(O.value.a11y.translations.keyboardNavigation), 1)], 8, tt),
hr.value?.rows?.length ? (_(), u(Ae, {
key: 0,
uid: w.value,
head: hr.value.headers,
body: hr.value.rows,
notice: O.value.a11y.translations.tableAvailable,
caption: O.value.a11y.translations.tableCaption
}, null, 8, [
"uid",
"head",
"body",
"notice",
"caption"
])) : d("", !0),
O.value.userOptions.buttons.annotator ? (_(), u(x(Tt), {
key: 1,
svgRef: x(A),
backgroundColor: O.value.style.chart.backgroundColor,
color: O.value.style.chart.color,
active: Qn.value,
isCursorPointer: k.value,
onClose: $n
}, {
"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(h({ color: t })), void 0, !0)]),
"annotator-action-draw": S(({ mode: t }) => [b(e.$slots, "annotator-action-draw", g(h({ mode: t })), void 0, !0)]),
"annotator-action-undo": S(({ disabled: t }) => [b(e.$slots, "annotator-action-undo", g(h({ disabled: t })), void 0, !0)]),
"annotator-action-redo": S(({ disabled: t }) => [b(e.$slots, "annotator-action-redo", g(h({ disabled: t })), void 0, !0)]),
"annotator-action-delete": S(({ disabled: t }) => [b(e.$slots, "annotator-action-delete", g(h({ disabled: t })), void 0, !0)]),
_: 3
}, 8, [
"svgRef",
"backgroundColor",
"color",
"active",
"isCursorPointer"
])) : d("", !0),
pn.value ? (_(), f("div", {
key: 2,
ref_key: "noTitle",
ref: Bt,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : d("", !0),
O.value.style.chart.title.text ? (_(), f("div", {
key: 3,
ref_key: "chartTitle",
ref: Lt,
style: "width:100%;background:transparent;padding-bottom:12px"
}, [(_(), u(Ce, {
key: `title_${Vt.value}`,
config: {
title: {
cy: "waffle-title",
...O.value.style.chart.title
},
subtitle: {
cy: "waffle-subtitle",
...O.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))], 512)) : d("", !0),
p("div", { id: `legend-top-${w.value}` }, null, 8, nt),
O.value.userOptions.show && Nt.value && (x(an) || x(nn)) ? (_(), u(x(wt), {
ref_key: "userOptionsRef",
ref: Kt,
key: `user_options_${It.value}`,
backgroundColor: O.value.style.chart.backgroundColor,
color: O.value.style.chart.color,
isPrinting: x(ln),
isImaging: x(un),
uid: w.value,
hasTooltip: O.value.userOptions.buttons.tooltip && O.value.style.chart.tooltip.show,
hasPdf: O.value.userOptions.buttons.pdf,
hasImg: O.value.userOptions.buttons.img,
hasSvg: O.value.userOptions.buttons.svg,
hasXls: O.value.userOptions.buttons.csv,
hasTable: O.value.userOptions.buttons.table,
hasFullscreen: O.value.userOptions.buttons.fullscreen,
hasAltCopy: O.value.userOptions.buttons.altCopy,
isFullscreen: Q.value,
isTooltip: N.value.showTooltip,
titles: { ...O.value.userOptions.buttonTitles },
chartElement: E.value,
position: O.value.userOptions.position,
hasAnnotator: O.value.userOptions.buttons.annotator,
isAnnotation: Qn.value,
callbacks: O.value.userOptions.callbacks,
printScale: O.value.userOptions.print.scale,
tableDialog: O.value.table.useDialog,
isCursorPointer: k.value,
onToggleFullscreen: Yn,
onGeneratePdf: x(dn),
onGenerateCsv: Jn,
onGenerateImage: lr,
onGenerateSvg: cr,
onToggleTable: Xn,
onToggleTooltip: Zn,
onToggleAnnotator: $n,
onCopyAlt: ur,
style: We({ visibility: x(an) ? x(nn) ? "visible" : "hidden" : "visible" })
}, Re({ _: 2 }, [
e.$slots.menuIcon ? {
name: "menuIcon",
fn: S(({ isOpen: t, color: n }) => [b(e.$slots, "menuIcon", g(h({
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.optionFullscreen ? {
name: "optionFullscreen",
fn: S(({ toggleFullscreen: t, isFullscreen: n }) => [b(e.$slots, "optionFullscreen", g(h({
toggleFullscreen: t,
isFullscreen: n
})), void 0, !0)]),
key: "7"
} : void 0,
e.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: S(({ toggleAnnotator: t, isAnnotator: n }) => [b(e.$slots, "optionAnnotator", g(h({
toggleAnnotator: t,
isAnnotator: n
})), void 0, !0)]),
key: "8"
} : void 0,
e.$slots.optionAltCopy ? {
name: "optionAltCopy",
fn: S(({ altCopy: t }) => [b(e.$slots, "optionAltCopy", g(h({ altCopy: t })), void 0, !0)]),
key: "9"
} : void 0,
e.$slots["custom-menu-before"] ? {
name: "custom-menu-before",
fn: S(() => [b(e.$slots, "custom-menu-before", {}, void 0, !0)]),
key: "10"
} : void 0,
e.$slots["custom-menu-after"] ? {
name: "custom-menu-after",
fn: S(() => [b(e.$slots, "custom-menu-after", {}, void 0, !0)]),
key: "11"
} : void 0
]), 1032, /* @__PURE__ */ "backgroundColor.color.isPrinting.isImaging.uid.hasTooltip.hasPdf.hasImg.hasSvg.hasXls.hasTable.hasFullscreen.hasAltCopy.isFullscreen.isTooltip.titles.chartElement.position.hasAnnotator.isAnnotation.callbacks.printScale.tableDialog.isCursorPointer.onGeneratePdf.style".split("."))) : d("", !0),
p("div", rt, [(_(), f("svg", {
ref_key: "svgRef",
ref: A,
xmlns: x(le),
"aria-describedby": `chart-instructions-${w.value}`,
class: Ue({
"vue-data-ui-fullscreen--on": Q.value,
"vue-data-ui-fulscreen--off": !Q.value
}),
tabindex: "0",
viewBox: `0 0 ${P.value.width <= 0 ? 10 : P.value.width} ${P.value.height <= 0 ? 10 : P.value.height}`,
style: We(`max-width:100%;overflow:visible;background:transparent;color:${O.value.style.chart.color}`),
onFocus: dr,
onBlur: fr,
onKeydown: pr
}, [
Be(x(Et)),
p("defs", null, [(_(!0), f(c, null, y(V.value, (e, t) => (_(), u(Oe, {
t: "radial",
cx: "50%",
cy: "50%",
r: "50%",
fx: "50%",
fy: "50%",
id: `gradient_${w.value}_${t}`,
key: `gradient_${w.value}_${t}`,
stops: [[
"0%",
x(n)(x(te)(e.color, .05), 100 - O.value.style.chart.layout.rect.gradientIntensity),
1
], [
"100%",
e.color,
1
]]
}, null, 8, ["id", "stops"]))), 128))]),
p("defs", null, [p("filter", {
id: `blur_${w.value}`,
x: "-50%",
y: "-50%",
width: "200%",
height: "200%"
}, [...t[4] ||= [p("feGaussianBlur", {
in: "SourceGraphic",
stdDeviation: 2
}, null, -1), p("feColorMatrix", {
type: "saturate",
values: "0"
}, null, -1)]], 8, at)]),
O.value.useCustomCells && V.value.length && e.$slots.cell ? (_(!0), f(c, { key: 0 }, y(H.value, (t, n) => (_(), f("foreignObject", {
x: t.x,
y: t.y,
height: L.value <= 0 ? 1e-4 : L.value,
width: I.value <= 0 ? 1e-4 : I.value,
class: "vue-ui-waffle-custom-cell-foreignObject"
}, [b(e.$slots, "cell", Ve({ ref_for: !0 }, {
cell: {
...t,
color: V.value[n].color,
height: Math.max(0, L.value),
width: Math.max(0, I.value),
...V.value[n]
},
isSelected: [null, void 0].includes(T.value) ? !0 : V.value[n].serieIndex === T.value
}), void 0, !0)], 8, ot))), 256)) : d("", !0),
!V.value.length && !O.value.useCustomCells ? (_(), f("rect", {
key: 1,
x: 12,
y: 12,
height: F.value.height - 24,
width: F.value.width - 24,
rx: 3,
fill: "none",
stroke: "black"
}, null, 8, st)) : V.value.length && !O.value.useCustomCells ? (_(), f(c, { key: 2 }, [
e.$slots.pattern ? (_(), f("g", ct, [(_(!0), f(c, null, y(bn.value, (t) => (_(), f("defs", null, [b(e.$slots, "pattern", Ve({ ref_for: !0 }, {
seriesIndex: t.absoluteIndex,
patternId: `pattern_${w.value}_${t.absoluteIndex}`
}), void 0, !0)]))), 256))])) : d("", !0),
(_(!0), f(c, null, y(H.value, (e, t) => (_(), f("rect", {
rx: O.value.style.chart.layout.rect.rounded ? O.value.style.chart.layout.rect.rounding : 0,
x: e.x + O.value.style.chart.layout.grid.spaceBetween / 2,
y: e.y + O.value.style.chart.layout.grid.spaceBetween / 2,
height: L.value <= 0 ? 1e-4 : L.value,
width: I.value <= 0 ? 1e-4 : I.value,
fill: "white",
stroke: O.value.style.chart.layout.rect.stroke,
"stroke-width": O.value.style.chart.layout.rect.strokeWidth,
filter: Gn(V.value[t].serieIndex)
}, null, 8, lt))), 256)),
(_(!0), f(c, null, y(H.value, (e, t) => (_(), f("rect", {
rx: O.value.style.chart.layout.rect.rounded ? O.value.style.chart.layout.rect.rounding : 0,
x: e.x + O.value.style.chart.layout.grid.spaceBetween / 2,
y: e.y + O.value.style.chart.layout.grid.spaceBetween / 2,
height: L.value <= 0 ? 1e-4 : L.value,
width: I.value <= 0 ? 1e-4 : I.value,
fill: O.value.style.chart.layout.rect.useGradient && O.value.style.chart.layout.rect.gradientIntensity > 0 ? `url(#gradient_${w.value}_${t})` : V.value[t].color,
stroke: O.value.style.chart.layout.rect.stroke,
"stroke-width": O.value.style.chart.layout.rect.strokeWidth,
filter: Gn(V.value[t].serieIndex)
}, null, 8, ut))), 256)),
e.$slots.pattern ? (_(), f("g", dt, [(_(!0), f(c, null, y(H.value, (e, t) => (_(), f("rect", {
rx: O.value.style.chart.layout.rect.rounded ? O.value.style.chart.layout.rect.rounding : 0,
x: e.x + O.value.style.chart.layout.grid.spaceBetween / 2,
y: e.y + O.value.style.chart.layout.grid.spaceBetween / 2,
height: L.value <= 0 ? 1e-4 : L.value,
width: I.value <= 0 ? 1e-4 : I.value,
fill: `url(#pattern_${w.value}_${V.value[t].absoluteIndex})`,
stroke: "none",
filter: Gn(V.value[t].serieIndex)
}, null, 8, ft))), 256))])) : d("", !0)
], 64)) : d("", !0),
e.$slots.cellSvg ? (_(!0), f(c, { key: 3 }, y(H.value, (t, n) => (_(), f("g", null, [b(e.$slots, "cellSvg", Ve({ ref_for: !0 }, {
cell: {
...t,
color: V.value[n].color,
height: Math.max(0, L.value),
width: Math.max(0, I.value),
...V.value[n]
},
isSelected: [null, void 0].includes(T.value) ? !0 : V.value[n].serieIndex === T.value
}), void 0, !0)]))), 256)) : d("", !0),
(_(!0), f(c, null, y(H.value, (e, t) => (_(), f(c, null, [Kn(t, e) ? (_(), f("text", {
key: `datalabel_${t}`,
textContent: Ye(qn(t, e)),
x: e.x + O.value.style.chart.layout.labels.captions.offsetX + O.value.style.chart.layout.grid.spaceBetween / 2 + 6,
y: e.y + O.value.style.chart.layout.labels.captions.offsetY + O.value.style.chart.layout.grid.spaceBetween / 2 + gn.value / 2 + O.value.style.chart.layout.labels.captions.fontSize / 3,
"font-size": O.value.style.chart.layout.labels.captions.fontSize,
fill: x(ce)(V.value[t].color),
filter: Gn(V.value[t].serieIndex)
}, null, 8, pt)) : d("", !0)], 64))), 256)),
(_(!0), f(c, null, y(H.value, (e, t) => (_(), f("rect", {
x: e.x + O.value.style.chart.layout.grid.spaceBetween / 2,
y: e.y + O.value.style.chart.layout.grid.spaceBetween / 2,
height: gn.value,
width: hn.value,
fill: "transparent",
stroke: "none",
onMouseover: (e) => Un(t),
onMouseleave: (e) => Hn(t),
onClick: (e) => Vn(t)
}, null, 40, mt))), 256)),
b(e.$slots, "svg", { svg: {
...P.value,
isPrintingImg: x(ln) || x(un) || qt.value,
isPrintingSvg: Jt.value
} }, void 0, !0)
], 46, it)), e.$slots.hint ? (_(), f("div", ht, [b(e.$slots, "hint", g(h({
hint: O.value.a11y.translations.keyboardNavigation,
isVisible: Zt.value
})), void 0, !0)])) : d("", !0)]),
e.$slots.watermark ? (_(), f("div", gt, [b(e.$slots, "watermark", g(h({ isPrinting: x(ln) || x(un) || qt.value || Jt.value })), void 0, !0)])) : d("", !0),
p("div", { id: `legend-bottom-${w.value}` }, null, 8, _t),
Wt.value && (O.value.style.chart.legend.show || e.$slots.legend) ? (_(), u(Le, {
key: 6,
to: O.value.style.chart.legend.position === "top" ? `#legend-top-${w.value}` : `#legend-bottom-${w.value}`
}, [p("div", {
ref_key: "chartLegend",
ref: Rt
}, [b(e.$slots, "legend", { legend: q.value }, () => [O.value.style.chart.legend.show ? (_(), u(Pe, {
key: `legend_${Ut.value}`,
legendSet: q.value,
config: In.value,
isCursorPointer: k.value,
onClickMarker: t[0] ||= ({ legend: e }) => K(e.uid)
}, Re({
item: S(({ legend: e }) => [p("div", {
onClick: (t) => e.segregate(),
style: We(`opacity:${U.value.includes(e.uid) ? .5 : 1}`)
}, Ye(e.display), 13, vt)]),
legendToggle: S(() => [q.value.length > 2 && O.value.style.chart.legend.selectAllToggle.show && !x($t) ? (_(), u(ke, {
key: 0,
backgroundColor: O.value.style.chart.legend.selectAllToggle.backgroundColor,
color: O.value.style.chart.legend.selectAllToggle.color,
fontSize: O.value.style.chart.legend.fontSize,
checked: U.value.length > 0,
isCursorPointer: k.value,
onToggle: jn
}, null, 8, [
"backgroundColor",
"color",
"fontSize",
"checked",
"isCursorPointer"
])) : d("", !0)]),
_: 2
}, [e.$slots.pattern ? {
name: "legend-pattern",
fn: S(({ legend: e, index: t }) => [Be(we, {
shape: e.shape,
radius: 30,
stroke: "none",
plot: {
x: 30,
y: 30
},
fill: `url(#pattern_${w.value}_${t})`
}, null, 8, ["shape", "fill"])]),
key: "0"
} : void 0]), 1032, [
"legendSet",
"config",
"isCursorPointer"
])) : d("", !0)], !0)], 512)], 8, ["to"])) : d("", !0),
e.$slots.source ? (_(), f("div", {
key: 7,
ref_key: "source",
ref: zt,
dir: "auto"
}, [b(e.$slots, "source", {}, void 0, !0)], 512)) : d("", !0),
Be(x(bt), {
teleportTo: O.value.style.chart.tooltip.teleportTo,
show: N.value.showTooltip && Pt.value && U.value.length < C.dataset.length,
backgroundColor: O.value.style.chart.tooltip.backgroundColor,
color: O.value.style.chart.tooltip.color,
borderRadius: O.value.style.chart.tooltip.borderRadius,
borderColor: O.value.style.chart.tooltip.borderColor,
borderWidth: O.value.style.chart.tooltip.borderWidth,
backgroundOpacity: O.value.style.chart.tooltip.backgroundOpacity,
position: O.value.style.chart.tooltip.position,
offsetX: O.value.style.chart.tooltip.offsetX,
offsetY: O.value.style.chart.tooltip.offsetY,
parent: E.value,
content: Ft.value,
isCustom: O.value.style.chart.tooltip.customFormat && typeof O.value.style.chart.tooltip.customFormat == "function",
fontSize: O.value.style.chart.tooltip.fontSize,
isFullscreen: Q.value,
smooth: O.value.style.chart.tooltip.smooth,
backdropFilter: O.value.style.chart.tooltip.backdropFilter,
smoothForce: O.value.style.chart.tooltip.smoothForce,
smoothSnapThreshold: O.value.style.chart.tooltip.smoothSnapThreshold,
isA11yMode: Xt.value === "keyboard",
a11yPosition: Yt.value
}, {
"tooltip-before": S(() => [b(e.$slots, "tooltip-before", g(h({ ...Ln.value })), void 0, !0)]),
tooltip: S(() => [b(e.$slots, "tooltip", g(h({ ...Ln.value })), void 0, !0)]),
"tooltip-after": S(() => [b(e.$slots, "tooltip-after", g(h({ ...Ln.value })), void 0, !0)]),
_: 3
}, 8, [
"teleportTo",
"show",
"backgroundColor",
"color",
"borderRadius",
"borderColor",
"borderWidth",
"backgroundOpacity",
"position",
"offsetX",
"offsetY",
"parent",
"content",
"isCustom",
"fontSize",
"isFullscreen",
"smooth",
"backdropFilter",
"smoothForce",
"smoothSnapThreshold",
"isA11yMode",
"a11yPosition"
]),
Nt.value && O.value.userOptions.buttons.table ? (_(), u(qe($.value.component), Ve({ key: 8 }, $.value.props, {
ref_key: "tableUnit",
ref: Gt,
onClose: tr
}), Re({
content: S(() => [(_(), u(x(St), {
key: `table_${Ht.value}`,
colNames: Z.value.colNames,
head: Z.value.head,
body: Z.value.body,
config: Z.value.config,
title: O.value.table.useDialog ? "" : $.value.title,
withCloseButton: !O.value.table.useDialog,
isCursorPointer: k.value,
onClose: tr
}, {
th: S(({ th: e }) => [p("div", {
innerHTML: e,
style: {
display: "flex",
"align-items": "center"
}
}, null, 8, yt)]),
td: S(({ td: e }) => [ze(Ye(e.name || e), 1)]),
_: 1
}, 8, [
"colNames",
"head",
"body",
"config",
"title",
"withCloseButton",
"isCursorPointer"
]))]),
_: 2
}, [O.value.table.useDialog ? {
name: "title",
fn: S(() => [ze(Ye($.value.title), 1)]),
key: "0"
} : void 0, O.value.table.useDialog ? {
name: "actions",
fn: S(() => [p("button", {
tabindex: "0",
class: "vue-ui-user-options-button",
onClick: t[1] ||= (e) => Jn(O.value.userOptions.callbacks.csv),
style: We({ cursor: k.value ? "pointer" : "default" })
}, [Be(x(xt), {
name: "fileCsv",
stroke: $.value.props.color
}, null, 8, ["stroke"])], 4)]),
key: "1"
} : void 0]), 1040)) : d("", !0),
b(e.$slots, "skeleton", {}, () => [x($t) ? (_(), u(ve, { key: 0 })) : d("", !0)], !0)
], 46, et));
}
}, [["__scopeId", "data-v-0f0995dd"]]);
//#endregion
export { $e as n, bt as t };