UNPKG

vue-data-ui

Version:

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

1,265 lines (1,264 loc) 42.5 kB
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js"; import { $ as t, Bt as n, D as r, Gt as i, Jt as a, Vt as o, X as s, b as c, ct as ee, i as l, jt as te, q as ne, t as re, tt as ie, xt as ae } from "./lib-Bttd6u5E.js"; import { n as oe, t as se } from "./useHints-Dq_w2E8B.js"; import { t as ce } from "./useConfig-D3scuR88.js"; import { t as le } from "./usePrinter-DN5bYhTG.js"; import { n as ue, t as de } from "./BaseScanner-DZvpgOjM.js"; import { t as fe } from "./useSvgExport-DH-FfcqQ.js"; import { t as pe } from "./useNestedProp-vPNvh7rV.js"; import { t as me } from "./useThemeCheck-C43Tcqmk.js"; import { t as he } from "./useTimeLabelCollider-AEcY4Ioe.js"; import { t as ge } from "./img-Bnokohej.js"; import { n as _e } from "./Title-BE3qg9xl.js"; import { t as ve } from "./_plugin-vue_export-helper-B3ysoDQm.js"; import { l as ye, t as be } from "./useResponsive-ZtArZtUf.js"; import { t as xe } from "./DefGrad-DVBqDjhO.js"; import { t as Se } from "./A11yDataTable-DdRsVULz.js"; import { t as Ce } from "./useUserOptionState-DK-_1ddE.js"; import { t as we } from "./useChartAccessibility-DYqac8yF.js"; import { t as Te } from "./vue_ui_age_pyramid-BY6c-oX_.js"; import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createSlots as Ee, createTextVNode as De, createVNode as g, defineAsyncComponent as _, guardReactiveProps as v, mergeProps as Oe, nextTick as ke, normalizeClass as Ae, normalizeProps as y, normalizeStyle as b, onBeforeUnmount as je, onMounted as Me, openBlock as x, ref as S, renderList as C, renderSlot as w, resolveDynamicComponent as Ne, shallowRef as Pe, toDisplayString as T, toRefs as Fe, unref as E, watch as D, watchEffect as Ie, withCtx as O } from "vue"; //#region src/components/vue-ui-age-pyramid.vue var Le = /* @__PURE__ */ e({ default: () => ut }), Re = ["id"], ze = ["id"], Be = { style: { position: "relative" } }, Ve = [ "xmlns", "viewBox", "aria-describedby" ], He = [ "x", "y", "width", "height" ], Ue = [ "x", "y", "width", "height", "fill", "rx" ], We = [ "x", "y", "width", "height", "fill", "rx" ], Ge = [ "x", "y", "width", "height", "fill", "rx" ], Ke = [ "x", "y", "width", "height", "fill", "rx" ], qe = { key: 0 }, Je = [ "x", "y", "fill", "font-size", "font-weight" ], Ye = [ "x", "y", "fill", "font-size", "font-weight" ], Xe = { key: 1 }, Ze = [ "x", "y", "font-size", "fill", "font-weight" ], Qe = { key: 2 }, $e = { key: 0 }, et = [ "x1", "x2", "y1", "y2", "stroke", "stroke-width" ], tt = [ "x1", "x2", "y1", "y2", "stroke", "stroke-width" ], nt = [ "x1", "x2", "y1", "y2", "stroke", "stroke-width" ], rt = [ "x1", "x2", "y1", "y2", "stroke", "stroke-width" ], it = [ "font-size", "fill", "text-anchor", "font-weight", "transform" ], at = [ "font-size", "fill", "text-anchor", "font-weight", "transform" ], ot = [ "x", "y", "font-size", "fill", "font-weight" ], st = [ "x", "y", "width", "height", "fill", "onMouseover", "onMouseleave", "onClick" ], ct = { key: 0, style: { position: "absolute", top: "100%", left: "0", width: "100%" }, "data-dom-to-png-ignore": "", "aria-hidden": "true" }, lt = { key: 5, class: "vue-data-ui-watermark" }, ut = /*#__PURE__*/ ve({ __name: "vue-ui-age-pyramid", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Array, default() { return []; } } }, emits: ["copyAlt"], setup(e, { expose: ve, emit: Le }) { let ut = _(() => import("./Tooltip-DhjyfHwz.js")), dt = _(() => import("./BaseIcon-BfndwIWE.js").then((e) => e.n)), ft = _(() => import("./vue-ui-accordion-BxGriZik.js").then((e) => e.n)), pt = _(() => import("./DataTable-BbKgJ5UI.js")), mt = _(() => import("./PenAndPaper-DAE-tnEQ.js").then((e) => e.t)), ht = _(() => import("./UserOptions-Dt98of5H.js").then((e) => e.n)), gt = _(() => import("./PackageVersion-D6d8SCp9.js").then((e) => e.t)), _t = _(() => import("./BaseDraggableDialog-LoqqwRtV.js").then((e) => e.n)), { vue_ui_age_pyramid: vt } = ce(), { isThemeValid: yt, warnInvalidTheme: bt } = me(), k = e, xt = Le, St = d(() => !!k.dataset && k.dataset.length), A = S(ne()), j = S(!1), Ct = S(""), M = S(null), wt = S(0), N = S(null), Tt = S(null), Et = S(null), Dt = S(null), Ot = S(0), kt = S(0), At = S(null), P = S(null), jt = S(null), Mt = S(!1), Nt = S(!1), F = S(null), Pt = S({ x: 0, y: 0 }), I = S("pointer"), Ft = S(!1), L = S(Ut()); oe({ config: () => L.value, dataset: () => k.dataset, component: "VueUiAgePyramid", rules: [se.emptyArray, { test: (e) => e.length > 130, message: [ "👀 Dataset has > 130 points. Consider:", "", "▶️ Grouping small values into aggregated categories.", "", "▶️ Using VueUiStackline to display data in a more compact way." ] }] }); let R = d(() => L.value.userOptions.useCursorPointer), It = d(() => a({ defaultConfig: { userOptions: { show: !1 }, table: { show: !1 }, translations: { male: "", female: "" }, style: { backgroundColor: "#99999930", layout: { bars: { left: { color: "#CACACA" }, right: { color: "#999999" } }, dataLabels: { xAxis: { fontSize: 0, scale: 1e3, translation: "" }, yAxis: { show: !1 } }, grid: { stroke: "#6A6A6A" } } } }, userConfig: L.value.skeletonConfig ?? {} })), { loading: Lt, FINAL_DATASET: Rt, manualLoading: zt } = ue({ ...Fe(k), FINAL_CONFIG: L, prepareConfig: Ut, skeletonDataset: k.config?.skeletonDataset ?? [ [ "_", 9, 2, 2 ], [ "_", 8, 3, 3 ], [ "_", 7, 5, 5 ], [ "_", 6, 8, 8 ], [ "_", 5, 13, 13 ], [ "_", 4, 21, 21 ], [ "_", 3, 34, 34 ], [ "_", 2, 55, 55 ], [ "_", 1, 89, 89 ], [ "_", 0, 144, 144 ] ], skeletonConfig: a({ defaultConfig: L.value, userConfig: It.value }) }), { userOptionsVisible: Bt, setUserOptionsVisibility: Vt, keepUserOptionState: Ht } = Ce({ config: L.value }), { svgRef: z } = we({ config: L.value.style.title }); function Ut() { let e = pe({ userConfig: k.config, defaultConfig: vt }), t = e.theme; if (!t) return e; if (!yt.value(e)) return bt(e), e; let n = pe({ userConfig: Te[t] || k.config, defaultConfig: e }); return pe({ userConfig: k.config, defaultConfig: n }); } D(() => k.config, (e) => { Lt.value || (L.value = Ut()), Bt.value = !L.value.userOptions.showOnChartHover, Gt(), Ot.value += 1, kt.value += 1, H.value.showTable = L.value.table.show, H.value.showTooltip = L.value.style.tooltip.show; }, { deep: !0 }), D(() => k.dataset, (e) => { Array.isArray(e) && e.length > 0 && (zt.value = !1); }, { deep: !0 }); let B = Pe(null), V = Pe(null); Me(() => { Gt(); }); let Wt = d(() => !!L.value.debug); function Gt() { if (te(k.dataset) && (ie({ componentName: "VueUiAgePyramid", type: "dataset", debug: Wt.value }), zt.value = !0), te(k.dataset) || (zt.value = L.value.loading), L.value.responsive) { let e = ye(() => { let { width: e, height: t } = be({ chart: N.value, title: L.value.style.title.text ? Tt.value : null, source: Et.value, noTitle: Dt.value }); requestAnimationFrame(() => { U.value.width = e, U.value.height = t; }); }); B.value && (V.value && B.value.unobserve(V.value), B.value.disconnect()), B.value = new ResizeObserver(e), V.value = N.value.parentNode, B.value.observe(V.value); } } je(() => { B.value && (V.value && B.value.unobserve(V.value), B.value.disconnect()); }); let { isPrinting: Kt, isImaging: qt, generatePdf: Jt, generateImage: Yt } = le({ elementId: `vue-ui-age-pyramid_${A.value}`, fileName: L.value.style.title.text || "vue-ui-age-pyramid", options: L.value.userOptions.print }), Xt = d(() => L.value.userOptions.show && !L.value.style.title.text), H = S({ showTable: L.value.table.show, showTooltip: L.value.style.tooltip.show }); D(L, () => { H.value = { showTable: L.value.table.show, showTooltip: L.value.style.tooltip.show }; }, { immediate: !0 }); let U = S({ height: L.value.style.height, width: L.value.style.width }), Zt = d(() => U.value.width), Qt = d(() => U.value.height), $t = S(0), en = ye((e) => { $t.value = e; }, 100); Ie((e) => { let t = At.value; if (!t) return; let n = new ResizeObserver((e) => { en(e[0].contentRect.height); }); n.observe(t), e(() => n.disconnect()); }), je(() => { $t.value = 0; }); let W = d(() => { let e = U.value.width - L.value.style.layout.padding.right - L.value.style.layout.padding.left, t = L.value.style.layout.padding.left, n = U.value.width - L.value.style.layout.padding.right; return { top: L.value.style.layout.padding.top + L.value.style.layout.dataLabels.sideTitles.fontSize + L.value.style.layout.dataLabels.sideTitles.offsetY + 12, left: t, right: n, bottom: U.value.height - L.value.style.layout.padding.bottom - $t.value, width: e, height: U.value.height - L.value.style.layout.padding.top - L.value.style.layout.padding.bottom - $t.value - L.value.style.layout.dataLabels.sideTitles.fontSize - L.value.style.layout.dataLabels.sideTitles.offsetY - 12, centerX: L.value.style.layout.padding.left + e / 2, leftChart: { width: e / 2 - L.value.style.layout.centerSlit.width, right: t + e / 2 - L.value.style.layout.centerSlit.width }, rightChart: { width: e / 2 - L.value.style.layout.centerSlit.width, left: t + e / 2 + L.value.style.layout.centerSlit.width } }; }), tn = d(() => Rt.value.map((e) => L.value.style.layout.dataLabels.yAxis.display === "age" ? e[1] : e[0])), G = d(() => { let e = nn(K.value / 5), t = [], n = []; for (let r = 0; r <= 5; r += 1) { let i = e * r, a = e * (r - 5); t.push({ value: i, x: W.value.left + W.value.width / 2 + L.value.style.layout.centerSlit.width + i / K.value * W.value.leftChart.width }), n.push({ value: Math.abs(a), x: W.value.left + W.value.width / 2 + a / K.value * W.value.leftChart.width - L.value.style.layout.centerSlit.width }); } return { right: t, left: n }; }); function nn(e) { if (e === 0) return 0; let t = 10 ** Math.floor(Math.log10(Math.abs(e))), n; return n = Math.round(e / t) * t, n; } let K = d(() => Math.max(...Rt.value.flatMap((e) => e.slice(-2).map((e) => c(e))))), q = d(() => Rt.value.length), rn = d(() => Rt.value.map((e) => ({ segment: e[0], age: e[1], left: { value: e[2], proportionToMax: e[2] / K.value }, right: { value: e[3], proportionToMax: e[3] / K.value } }))), J = d(() => rn.value.map((e, t) => { let n = W.value.top + W.value.height / q.value * t, r = W.value.height / q.value - L.value.style.layout.bars.gap; return { segment: e.segment, age: e.age, left: { ...e.left, y: n, color: L.value.style.layout.bars.left.color, x: W.value.leftChart.right - e.left.proportionToMax * W.value.leftChart.width, width: c(e.left.proportionToMax * W.value.leftChart.width), height: r }, right: { ...e.right, y: n, color: L.value.style.layout.bars.right.color, x: W.value.rightChart.left, width: c(e.right.proportionToMax * W.value.rightChart.width), height: r } }; })), Y = S(null); function an(e) { let [t, n, r, i] = e; return { segment: t, index: n, left: r, right: i }; } function on(e, t) { L.value.events.datapointClick && L.value.events.datapointClick({ datapoint: an(t), seriesIndex: e }); } function sn(e, t) { L.value.events.datapointLeave && L.value.events.datapointLeave({ datapoint: an(t), seriesIndex: e }), (I.value !== "keyboard" || F.value !== e) && (M.value = null, j.value = !1); } function cn(e) { if (!z.value) return; let t = J.value[e]; if (!t) return; let n = i(W.value.left + W.value.width / 2, t.left.y + t.left.height / 2, z.value); n && (Pt.value = n); } function ln(e, t, n = "pointer") { L.value.events.datapointEnter && L.value.events.datapointEnter({ datapoint: an(t), seriesIndex: e }), M.value = e, F.value = e, I.value = n, Y.value = { datapoint: t, seriesIndex: e, series: J.value, config: L.value }; let r = L.value.style.tooltip.customFormat; if (ae(r) && ee(() => r({ seriesIndex: e, datapoint: { segment: t[0], index: t[1], left: t[2], right: t[3] }, series: J.value, config: L.value }))) Ct.value = r({ seriesIndex: e, datapoint: { segment: t[0], index: t[1], left: t[2], right: t[3] }, series: J.value, config: L.value }); else { let n = "", r = J.value[e]; n += `<div><b>${r.segment}</b></div>`, n += `<div>${L.value.translations.age}: ${l(L.value.style.layout.dataLabels.yAxis.formatter, c(r.age), s({ v: c(r.age) }), { datapoint: t, seriesIndex: e })}</div>`, n += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${L.value.style.tooltip.borderColor}">`, n += "<div style=\"display:flex; flex-direction:row;gap:12px\">", n += `<div style="display:flex;flex-direction:column;align-items:center;justify-content:center"><svg viewBox="0 0 12 12" height="12" width="12"><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${L.value.style.layout.bars.gradient.underlayer}"/><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${L.value.style.layout.bars.gradient.show ? `url(#age_pyramid_left_${A.value})` : L.value.style.layout.bars.left.color}"/></svg><div>${L.value.translations.female}</div><div><b>${l(L.value.style.layout.dataLabels.xAxis.formatter, c(r.left.value), s({ v: c(r.left.value) }), { datapoint: t, seriesIndex: e })}</b></div></div>`, n += `<div style="display:flex;flex-direction:column;align-items:center;justify-content:center"><svg viewBox="0 0 12 12" height="12" width="12"><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${L.value.style.layout.bars.gradient.underlayer}"/><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${L.value.style.layout.bars.gradient.show ? `url(#age_pyramid_right_${A.value})` : L.value.style.layout.bars.right.color}"/></svg><div>${L.value.translations.male}</div><div><b>${l(L.value.style.layout.dataLabels.xAxis.formatter, c(r.right.value), s({ v: c(r.right.value) }), { datapoint: t, seriesIndex: e })}</b></div></div>`, n += "</div>", n += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${L.value.style.tooltip.borderColor}"><div>${L.value.translations.total}</div><div><b>${l(L.value.style.layout.dataLabels.xAxis.formatter, c(r.right.value) + c(r.left.value), s({ v: c(r.right.value) + c(r.left.value) }), { datapoint: t, seriesIndex: e })}</b></div></div>`, n += "</div>", Ct.value = `<div>${n}</div>`; } j.value = !0, n === "keyboard" && ke(() => { cn(e); }); } function un(e = null) { ke(() => { let n = [ L.value.translations.year, L.value.translations.age, L.value.translations.female, L.value.translations.male, L.value.translations.total ], i = k.dataset.map((e) => [ e[0], e[1], e[2], e[3], e[2] ?? 0 + e[3] ?? 0 ]), a = [ [L.value.style.title.text], [L.value.style.title.subtitle.text], [ [""], [""], [""] ], n ].concat(i), o = r(a); e ? e(o) : t({ csvContent: o, title: L.value.style.title.text || "vue-ui-heatmap" }); }); } let X = d(() => { let e = [ L.value.translations.year, L.value.translations.age, L.value.translations.female, L.value.translations.male, L.value.translations.total ]; return { head: e, body: k.dataset.map((e) => [ e[0], e[1], e[2] == null ? "" : e[2].toLocaleString(), e[3] == null ? "" : e[3].toLocaleString(), (e[2] ?? 0 + e[3] ?? 0).toLocaleString() ]), config: { th: { backgroundColor: L.value.table.th.backgroundColor, color: L.value.table.th.color, outline: L.value.table.th.outline }, td: { backgroundColor: L.value.table.td.backgroundColor, color: L.value.table.td.color, outline: L.value.table.td.outline }, breakpoint: L.value.table.responsiveBreakpoint }, colNames: e }; }), Z = S(!1); function dn(e) { Z.value = e, wt.value += 1; } function fn() { H.value.showTable = !H.value.showTable; } function pn() { H.value.showTooltip = !H.value.showTooltip; } let Q = S(!1); function mn() { Q.value = !Q.value; } async function hn({ scale: e = 2 } = {}) { if (!N.value) return; let { width: t, height: n } = N.value.getBoundingClientRect(), r = t / n, { imageUri: i, base64: a } = await ge({ domElement: N.value, base64: !0, img: !0, scale: e }); return { imageUri: i, base64: a, title: L.value.style.title.text, width: t, height: n, aspectRatio: r }; } let gn = S([]), _n = S({ start: 0, end: J.value.length }); he({ timeLabelsEls: At, timeLabels: gn, slicer: _n, configRef: L, rotationPath: [ "style", "layout", "dataLabels", "xAxis", "rotation" ], autoRotatePath: [ "style", "layout", "dataLabels", "xAxis", "autoRotate", "enable" ], isAutoSize: !1, width: Zt, height: Qt, targetClass: ".vue-ui-age-pyramid-x-axis-label", rotation: L.value.style.layout.dataLabels.xAxis.autoRotate.angle }); let $ = d(() => { let e = L.value.table.useDialog && !L.value.table.show, t = H.value.showTable; return { component: e ? _t : ft, title: `${L.value.style.title.text}${L.value.style.title.subtitle.text ? `: ${L.value.style.title.subtitle.text}` : ""}`, props: e ? { backgroundColor: L.value.table.th.backgroundColor, color: L.value.table.th.color, headerColor: L.value.table.th.color, headerBg: L.value.table.th.backgroundColor, isFullscreen: Z.value, fullscreenParent: N.value, forcedWidth: Math.min(800, window.innerWidth * .8), isCursorPointer: R.value } : { hideDetails: !0, config: { open: t, maxHeight: 1e4, body: { backgroundColor: L.value.style.backgroundColor, color: L.value.style.color }, head: { backgroundColor: L.value.style.backgroundColor, color: L.value.style.color } } } }; }); D(() => H.value.showTable, (e) => { L.value.table.show || (e && L.value.table.useDialog && P.value ? P.value.open() : "close" in P.value && P.value.close()); }); function vn() { H.value.showTable = !1, jt.value && jt.value.setTableIconState(!1); } let yn = d(() => L.value.style.backgroundColor), bn = d(() => L.value.style.title), { exportSvg: xn, getSvg: Sn } = fe({ svg: z, title: bn, backgroundColor: yn }); async function Cn({ isCb: e }) { Nt.value = !0, await ke(); try { if (e) { let { blob: e, url: t, text: n, dataUrl: r } = await Sn(); await Promise.resolve(L.value.userOptions.callbacks.svg({ blob: e, url: t, text: n, dataUrl: r })); } else await Promise.resolve(xn()); } finally { Nt.value = !1; } } function wn(e) { if (e?.stage === "start") { Mt.value = !0; return; } if (e?.stage === "end") { Mt.value = !1; return; } Yt(); } async function Tn() { if (xt("copyAlt", { config: L.value, dataset: J.value }), !L.value.userOptions.callbacks.altCopy) { console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions."); return; } await Promise.resolve(L.value.userOptions.callbacks.altCopy({ config: L.value, dataset: J.value })); } function En() { Ft.value = !0; } function Dn() { M.value = null, F.value = null, I.value = "pointer", j.value = !1, Ft.value = !1; } function On(e) { if (!z.value || Q.value || document.activeElement !== z.value || !J.value.length) return; let t = ["ArrowUp", "ArrowLeft"].includes(e.key), n = ["ArrowDown", "ArrowRight"].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) { M.value = null, F.value = null, I.value = "pointer", j.value = !1; return; } if (r) { if (F.value === null) return; let e = k.dataset[F.value]; if (!e) return; on(F.value, e); return; } let a = F.value, o = M.value, s = a !== null && a >= 0 && a < J.value.length, c = o !== null && o >= 0 && o < J.value.length; s ? t ? a = a - 1 < 0 ? J.value.length - 1 : a - 1 : n && (a = a + 1 > J.value.length - 1 ? 0 : a + 1) : c ? (a = n ? o + 1 : o - 1, a >= J.value.length && (a = 0), a < 0 && (a = J.value.length - 1)) : a = n ? 0 : J.value.length - 1; let ee = k.dataset[a]; ee && ln(a, ee, "keyboard"); } return ve({ getImage: hn, generatePdf: Jt, generateCsv: un, generateImage: Yt, generateSvg: Cn, toggleTable: fn, toggleTooltip: pn, toggleAnnotator: mn, toggleFullscreen: dn, copyAlt: Tn }), (t, r) => (x(), m("div", { class: Ae(`vue-data-ui-component vue-ui-age-pyramid ${Z.value ? "vue-data-ui-wrapper-fullscreen" : ""}`), ref_key: "agePyramid", ref: N, id: `vue-ui-age-pyramid_${A.value}`, style: b(`font-family:${L.value.style.fontFamily};width:100%; text-align:center;background:${L.value.style.backgroundColor};${L.value.responsive ? "height:100%" : ""}`), onMouseenter: r[1] ||= () => E(Vt)(!0), onMouseleave: r[2] ||= () => E(Vt)(!1) }, [ h("div", { id: `chart-instructions-${A.value}`, class: "sr-only" }, [h("p", null, T(L.value.a11y.translations.keyboardNavigation), 1)], 8, ze), X.value?.body?.length ? (x(), f(Se, { key: 0, uid: A.value, head: X.value.head, body: X.value.body, notice: L.value.a11y.translations.tableAvailable, caption: L.value.a11y.translations.tableCaption }, null, 8, [ "uid", "head", "body", "notice", "caption" ])) : p("", !0), L.value.userOptions.buttons.annotator ? (x(), f(E(mt), { key: 1, svgRef: E(z), backgroundColor: L.value.style.backgroundColor, color: L.value.style.color, active: Q.value, isCursorPointer: R.value, onClose: mn }, { "annotator-action-close": O(() => [w(t.$slots, "annotator-action-close", {}, void 0, !0)]), "annotator-action-color": O(({ color: e }) => [w(t.$slots, "annotator-action-color", y(v({ color: e })), void 0, !0)]), "annotator-action-draw": O(({ mode: e }) => [w(t.$slots, "annotator-action-draw", y(v({ mode: e })), void 0, !0)]), "annotator-action-undo": O(({ disabled: e }) => [w(t.$slots, "annotator-action-undo", y(v({ disabled: e })), void 0, !0)]), "annotator-action-redo": O(({ disabled: e }) => [w(t.$slots, "annotator-action-redo", y(v({ disabled: e })), void 0, !0)]), "annotator-action-delete": O(({ disabled: e }) => [w(t.$slots, "annotator-action-delete", y(v({ disabled: e })), void 0, !0)]), _: 3 }, 8, [ "svgRef", "backgroundColor", "color", "active", "isCursorPointer" ])) : p("", !0), Xt.value ? (x(), m("div", { key: 2, ref_key: "noTitle", ref: Dt, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : p("", !0), L.value.style.title.text ? (x(), m("div", { key: 3, ref_key: "chartTitle", ref: Tt, style: "width:100%;background:transparent" }, [(x(), f(_e, { key: `title_${Ot.value}`, config: { title: { cy: "pyramid-div-title", ...L.value.style.title }, subtitle: { cy: "pyramid-div-subtitle", ...L.value.style.title.subtitle } } }, null, 8, ["config"]))], 512)) : p("", !0), L.value.userOptions.show && St.value && (E(Ht) || E(Bt)) ? (x(), f(E(ht), { ref_key: "userOptionsRef", ref: jt, key: `user_options_${wt.value}`, backgroundColor: L.value.style.backgroundColor, color: L.value.style.color, isImaging: E(qt), isPrinting: E(Kt), uid: A.value, hasTooltip: L.value.userOptions.buttons.tooltip && L.value.style.tooltip.show, hasPdf: L.value.userOptions.buttons.pdf, hasXls: L.value.userOptions.buttons.csv, hasImg: L.value.userOptions.buttons.img, hasSvg: L.value.userOptions.buttons.svg, hasTable: L.value.userOptions.buttons.table, hasFullscreen: L.value.userOptions.buttons.fullscreen, hasAltCopy: L.value.userOptions.buttons.altCopy, isFullscreen: Z.value, isTooltip: H.value.showTooltip, titles: { ...L.value.userOptions.buttonTitles }, chartElement: N.value, position: L.value.userOptions.position, hasAnnotator: L.value.userOptions.buttons.annotator, isAnnotation: Q.value, callbacks: L.value.userOptions.callbacks, printScale: L.value.userOptions.print.scale, tableDialog: L.value.table.useDialog, isCursorPointer: R.value, onToggleFullscreen: dn, onGeneratePdf: E(Jt), onGenerateCsv: un, onGenerateImage: wn, onGenerateSvg: Cn, onToggleTable: fn, onToggleTooltip: pn, onToggleAnnotator: mn, onCopyAlt: Tn, style: b({ visibility: E(Ht) ? E(Bt) ? "visible" : "hidden" : "visible" }) }, Ee({ _: 2 }, [ t.$slots.menuIcon ? { name: "menuIcon", fn: O(({ isOpen: e, color: n }) => [w(t.$slots, "menuIcon", y(v({ isOpen: e, color: n })), void 0, !0)]), key: "0" } : void 0, t.$slots.optionTooltip ? { name: "optionTooltip", fn: O(() => [w(t.$slots, "optionTooltip", {}, void 0, !0)]), key: "1" } : void 0, t.$slots.optionPdf ? { name: "optionPdf", fn: O(() => [w(t.$slots, "optionPdf", {}, void 0, !0)]), key: "2" } : void 0, t.$slots.optionCsv ? { name: "optionCsv", fn: O(() => [w(t.$slots, "optionCsv", {}, void 0, !0)]), key: "3" } : void 0, t.$slots.optionImg ? { name: "optionImg", fn: O(() => [w(t.$slots, "optionImg", {}, void 0, !0)]), key: "4" } : void 0, t.$slots.optionSvg ? { name: "optionSvg", fn: O(() => [w(t.$slots, "optionSvg", {}, void 0, !0)]), key: "5" } : void 0, t.$slots.optionTable ? { name: "optionTable", fn: O(() => [w(t.$slots, "optionTable", {}, void 0, !0)]), key: "6" } : void 0, t.$slots.optionFullscreen ? { name: "optionFullscreen", fn: O(({ toggleFullscreen: e, isFullscreen: n }) => [w(t.$slots, "optionFullscreen", y(v({ toggleFullscreen: e, isFullscreen: n })), void 0, !0)]), key: "7" } : void 0, t.$slots.optionAnnotator ? { name: "optionAnnotator", fn: O(({ toggleAnnotator: e, isAnnotator: n }) => [w(t.$slots, "optionAnnotator", y(v({ toggleAnnotator: e, isAnnotator: n })), void 0, !0)]), key: "8" } : void 0, t.$slots.optionAltCopy ? { name: "optionAltCopy", fn: O(({ altCopy: e }) => [w(t.$slots, "optionAltCopy", y(v({ altCopy: e })), void 0, !0)]), key: "9" } : void 0, t.$slots["custom-menu-before"] ? { name: "custom-menu-before", fn: O(() => [w(t.$slots, "custom-menu-before", {}, void 0, !0)]), key: "10" } : void 0, t.$slots["custom-menu-after"] ? { name: "custom-menu-after", fn: O(() => [w(t.$slots, "custom-menu-after", {}, void 0, !0)]), key: "11" } : void 0 ]), 1032, /* @__PURE__ */ "backgroundColor.color.isImaging.isPrinting.uid.hasTooltip.hasPdf.hasXls.hasImg.hasSvg.hasTable.hasFullscreen.hasAltCopy.isFullscreen.isTooltip.titles.chartElement.position.hasAnnotator.isAnnotation.callbacks.printScale.tableDialog.isCursorPointer.onGeneratePdf.style".split("."))) : p("", !0), h("div", Be, [(x(), m("svg", { ref_key: "svgRef", ref: z, xmlns: E(re), class: Ae({ "vue-data-ui-fullscreen--on": Z.value, "vue-data-ui-fulscreen--off": !Z.value }), viewBox: `0 0 ${U.value.width <= 0 ? 10 : U.value.width} ${U.value.height <= 0 ? 10 : U.value.height}`, style: b(`max-width:100%;overflow:visible;background:transparent;color:${L.value.style.color}`), tabindex: "0", "aria-describedby": `chart-instructions-${A.value}`, onFocus: En, onBlur: Dn, onKeydown: On }, [ g(E(gt)), t.$slots["chart-background"] ? (x(), m("foreignObject", { key: 0, x: W.value.left, y: W.value.top, width: Math.max(.1, W.value.width), height: Math.max(.1, W.value.height), style: { pointerEvents: "none" } }, [w(t.$slots, "chart-background", {}, void 0, !0)], 8, He)) : p("", !0), h("defs", null, [g(xe, { t: "linear", id: `age_pyramid_left_${A.value}`, x1: "0%", y1: "0%", x2: "100%", y2: "0%", stops: [[ "0%", L.value.style.layout.bars.left.color, 1 ], [ "100%", E(n)(E(o)(L.value.style.layout.bars.left.color, L.value.style.layout.bars.gradient.shiftHue), 100 - L.value.style.layout.bars.gradient.intensity), 1 ]] }, null, 8, ["id", "stops"]), g(xe, { t: "linear", id: `age_pyramid_right_${A.value}`, x1: "0%", y1: "0%", x2: "100%", y2: "0%", stops: [[ "0%", E(n)(E(o)(L.value.style.layout.bars.right.color, L.value.style.layout.bars.gradient.shiftHue), 100 - L.value.style.layout.bars.gradient.intensity), 1 ], [ "100%", L.value.style.layout.bars.right.color, 1 ]] }, null, 8, ["id", "stops"])]), (x(!0), m(u, null, C(J.value, (e, t) => (x(), m("g", null, [ h("rect", { x: e.left.x, y: e.left.y, width: E(c)(e.left.width <= 0 ? 1e-4 : e.left.width), height: e.left.height <= 0 ? 1e-4 : e.left.height, fill: L.value.style.layout.bars.gradient.underlayer, rx: L.value.style.layout.bars.borderRadius }, null, 8, Ue), h("rect", { x: e.left.x, y: e.left.y, width: e.left.width <= 0 ? 1e-4 : e.left.width, height: e.left.height <= 0 ? 1e-4 : e.left.height, fill: L.value.style.layout.bars.gradient.show ? `url(#age_pyramid_left_${A.value})` : e.left.color, rx: L.value.style.layout.bars.borderRadius }, null, 8, We), h("rect", { x: e.right.x, y: e.right.y, width: e.right.width <= 0 ? 1e-4 : e.right.width, height: e.right.height <= 0 ? 1e-4 : e.right.height, fill: L.value.style.layout.bars.gradient.underlayer, rx: L.value.style.layout.bars.borderRadius }, null, 8, Ge), h("rect", { x: e.right.x, y: e.right.y, width: e.right.width <= 0 ? 1e-4 : e.right.width, height: e.right.height <= 0 ? 1e-4 : e.right.height, fill: L.value.style.layout.bars.gradient.show ? `url(#age_pyramid_right_${A.value})` : e.right.color, rx: L.value.style.layout.bars.borderRadius }, null, 8, Ke) ]))), 256)), h("g", null, [ L.value.style.layout.dataLabels.sideTitles.show ? (x(), m("g", qe, [h("text", { x: W.value.left, y: L.value.style.layout.dataLabels.sideTitles.fontSize, fill: L.value.style.layout.dataLabels.sideTitles.useSideColor ? L.value.style.layout.bars.left.color : L.value.style.layout.dataLabels.sideTitles.color, "font-size": L.value.style.layout.dataLabels.sideTitles.fontSize, "text-anchor": "start", "font-weight": L.value.style.layout.dataLabels.sideTitles.bold ? "bold" : "normal" }, T(L.value.translations.female), 9, Je), h("text", { x: W.value.right, y: L.value.style.layout.dataLabels.sideTitles.fontSize, fill: L.value.style.layout.dataLabels.sideTitles.useSideColor ? L.value.style.layout.bars.right.color : L.value.style.layout.dataLabels.sideTitles.color, "font-size": L.value.style.layout.dataLabels.sideTitles.fontSize, "text-anchor": "end", "font-weight": L.value.style.layout.dataLabels.sideTitles.bold ? "bold" : "normal" }, T(L.value.translations.male), 9, Ye)])) : p("", !0), L.value.style.layout.dataLabels.yAxis.show ? (x(), m("g", Xe, [(x(!0), m(u, null, C(tn.value, (e, t) => (x(), m(u, null, [t % L.value.style.layout.dataLabels.yAxis.showEvery === 0 ? (x(), m("text", { key: 0, x: W.value.centerX, y: W.value.top + W.value.height / q.value * t + L.value.style.layout.dataLabels.yAxis.fontSize / 3, "text-anchor": "middle", "font-size": L.value.style.layout.dataLabels.yAxis.fontSize, fill: L.value.style.layout.dataLabels.yAxis.color, "font-weight": L.value.style.layout.dataLabels.yAxis.bold ? "bold" : "normal" }, T(E(l)(L.value.style.layout.dataLabels.yAxis.formatter, e, E(s)({ v: e }), { datapoint: e, seriesIndex: t })), 9, Ze)) : p("", !0)], 64))), 256))])) : p("", !0), L.value.style.layout.dataLabels.xAxis.show ? (x(), m("g", Qe, [ L.value.style.layout.grid.show ? (x(), m("g", $e, [h("line", { x1: G.value.right[0].x, x2: G.value.right.at(-1).x, y1: W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize / 2, y2: W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize / 2, stroke: L.value.style.layout.grid.stroke, "stroke-width": L.value.style.layout.grid.strokeWidth, "stroke-linecap": "round" }, null, 8, et), h("line", { x1: G.value.left[0].x, x2: G.value.left.at(-1).x, y1: W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize / 2, y2: W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize / 2, stroke: L.value.style.layout.grid.stroke, "stroke-width": L.value.style.layout.grid.strokeWidth, "stroke-linecap": "round" }, null, 8, tt)])) : p("", !0), (x(!0), m(u, null, C(G.value.right, (e, t) => (x(), m("g", null, [L.value.style.layout.grid.show ? (x(), m("line", { key: 0, x1: e.x, x2: e.x, y1: W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize / 2, y2: W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize / 2 + 4, stroke: L.value.style.layout.grid.stroke, "stroke-width": L.value.style.layout.grid.strokeWidth, "stroke-linecap": "round" }, null, 8, nt)) : p("", !0)]))), 256)), (x(!0), m(u, null, C(G.value.left, (e, t) => (x(), m("g", null, [L.value.style.layout.grid.show ? (x(), m("line", { key: 0, x1: e.x, x2: e.x, y1: W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize / 2, y2: W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize / 2 + 4, stroke: L.value.style.layout.grid.stroke, "stroke-width": L.value.style.layout.grid.strokeWidth, "stroke-linecap": "round" }, null, 8, rt)) : p("", !0)]))), 256)), h("g", { ref_key: "xAxisLabels", ref: At }, [(x(!0), m(u, null, C(G.value.right, (e, t) => (x(), m("text", { class: "vue-ui-age-pyramid-x-axis-label", "font-size": L.value.style.layout.dataLabels.xAxis.fontSize, fill: L.value.style.layout.dataLabels.xAxis.color, "text-anchor": L.value.style.layout.dataLabels.xAxis.rotation > 0 ? "start" : L.value.style.layout.dataLabels.xAxis.rotation < 0 ? "end" : "middle", "font-weight": L.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal", transform: `translate(${e.x}, ${W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize * 2}) rotate(${L.value.style.layout.dataLabels.xAxis.rotation})` }, T(E(l)(L.value.style.layout.dataLabels.xAxis.formatter, e.value / L.value.style.layout.dataLabels.xAxis.scale, E(s)({ v: e.value / L.value.style.layout.dataLabels.xAxis.scale }), { datapoint: e, seriesIndex: t })), 9, it))), 256)), (x(!0), m(u, null, C(G.value.left, (e, t) => (x(), m("text", { class: "vue-ui-age-pyramid-x-axis-label", "font-size": L.value.style.layout.dataLabels.xAxis.fontSize, fill: L.value.style.layout.dataLabels.xAxis.color, "text-anchor": L.value.style.layout.dataLabels.xAxis.rotation > 0 ? "start" : L.value.style.layout.dataLabels.xAxis.rotation < 0 ? "end" : "middle", "font-weight": L.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal", transform: `translate(${e.x}, ${W.value.bottom + L.value.style.layout.dataLabels.xAxis.fontSize * 2}) rotate(${L.value.style.layout.dataLabels.xAxis.rotation})` }, T(E(l)(L.value.style.layout.dataLabels.xAxis.formatter, e.value / L.value.style.layout.dataLabels.xAxis.scale, E(s)({ v: e.value / L.value.style.layout.dataLabels.xAxis.scale }), { datapoint: e, seriesIndex: t })), 9, at))), 256))], 512), h("text", { x: W.value.right, y: U.value.height, "text-anchor": "end", "font-size": L.value.style.layout.dataLabels.xAxis.fontSize, fill: L.value.style.layout.dataLabels.xAxis.color, "font-weight": L.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal" }, T(L.value.style.layout.dataLabels.xAxis.translation), 9, ot) ])) : p("", !0) ]), (x(!0), m(u, null, C(e.dataset, (e, t) => (x(), m("g", null, [h("rect", { x: W.value.left, y: W.value.top + W.value.height / q.value * t - L.value.style.layout.bars.gap / 2, width: W.value.width <= 0 ? 1e-4 : W.value.width, height: W.value.height / q.value <= 0 ? 1e-4 : W.value.height / q.value, fill: M.value !== null && M.value === t ? E(n)(L.value.style.highlighter.color, L.value.style.highlighter.opacity) : "transparent", onMouseover: (n) => ln(t, e, "pointer"), onMouseleave: (n) => sn(t, e), onClick: (n) => on(t, e) }, null, 40, st)]))), 256)), w(t.$slots, "svg", { svg: { ...U.value, drawingArea: W.value, isPrintingImg: E(Kt) || E(qt) || Mt.value, isPrintingSvg: Nt.value } }, void 0, !0) ], 46, Ve)), t.$slots.hint ? (x(), m("div", ct, [w(t.$slots, "hint", y(v({ hint: L.value.a11y.translations.keyboardNavigation, isVisible: Ft.value })), void 0, !0)])) : p("", !0)]), t.$slots.watermark ? (x(), m("div", lt, [w(t.$slots, "watermark", y(v({ isPrinting: E(Kt) || E(qt) || Mt.value || Nt.value })), void 0, !0)])) : p("", !0), w(t.$slots, "legend", { legend: J.value }, void 0, !0), t.$slots.source ? (x(), m("div", { key: 6, ref_key: "source", ref: Et, dir: "auto" }, [w(t.$slots, "source", {}, void 0, !0)], 512)) : p("", !0), g(E(ut), { teleportTo: L.value.style.tooltip.teleportTo, show: H.value.showTooltip && j.value, backgroundColor: L.value.style.tooltip.backgroundColor, color: L.value.style.tooltip.color, borderRadius: L.value.style.tooltip.borderRadius, borderColor: L.value.style.tooltip.borderColor, borderWidth: L.value.style.tooltip.borderWidth, fontSize: L.value.style.tooltip.fontSize, backgroundOpacity: L.value.style.tooltip.backgroundOpacity, position: L.value.style.tooltip.position, offsetX: L.value.style.tooltip.offsetX, offsetY: L.value.style.tooltip.offsetY, parent: N.value, content: Ct.value, isFullscreen: Z.value, isCustom: L.value.style.tooltip.customFormat && typeof L.value.style.tooltip.customFormat == "function", smooth: L.value.style.tooltip.smooth, backdropFilter: L.value.style.tooltip.backdropFilter, smoothForce: L.value.style.tooltip.smoothForce, smoothSnapThreshold: L.value.style.tooltip.smoothSnapThreshold, isA11yMode: I.value === "keyboard", a11yPosition: Pt.value }, { "tooltip-before": O(() => [w(t.$slots, "tooltip-before", y(v({ ...Y.value })), void 0, !0)]), tooltip: O(() => [w(t.$slots, "tooltip", y(v({ ...Y.value })), void 0, !0)]), "tooltip-after": O(() => [w(t.$slots, "tooltip-after", y(v({ ...Y.value })), void 0, !0)]), _: 3 }, 8, [ "teleportTo", "show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetX", "offsetY", "parent", "content", "isFullscreen", "isCustom", "smooth", "backdropFilter", "smoothForce", "smoothSnapThreshold", "isA11yMode", "a11yPosition" ]), St.value && L.value.userOptions.buttons.table ? (x(), f(Ne($.value.component), Oe({ key: 7 }, $.value.props, { ref_key: "tableUnit", ref: P, onClose: vn }), Ee({ content: O(() => [(x(), f(E(pt), { key: `table_${kt.value}`, colNames: X.value.colNames, head: X.value.head, body: X.value.body, config: X.value.config, title: L.value.table.useDialog ? "" : $.value.title, withCloseButton: !L.value.table.useDialog, isCursorPointer: R.value, onClose: vn }, { th: O(({ th: e }) => [De(T(e), 1)]), td: O(({ td: e }) => [De(T(e), 1)]), _: 1 }, 8, [ "colNames", "head", "body", "config", "title", "withCloseButton", "isCursorPointer" ]))]), _: 2 }, [L.value.table.useDialog ? { name: "title", fn: O(() => [De(T($.value.title), 1)]), key: "0" } : void 0, L.value.table.useDialog ? { name: "actions", fn: O(() => [h("button", { tabindex: "0", class: "vue-ui-user-options-button", onClick: r[0] ||= (e) => un(L.value.userOptions.callbacks.csv), style: b({ cursor: R.value ? "pointer" : "default" }) }, [g(E(dt), { name: "fileCsv", stroke: $.value.props.color }, null, 8, ["stroke"])], 4)]), key: "1" } : void 0]), 1040)) : p("", !0), w(t.$slots, "skeleton", {}, () => [E(Lt) ? (x(), f(de, { key: 0 })) : p("", !0)], !0) ], 46, Re)); } }, [["__scopeId", "data-v-dee20652"]]); //#endregion export { Le as n, ut as t };