UNPKG

vue-data-ui

Version:

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

57 lines (56 loc) 1.43 kB
import { ref as n } from "vue"; function m({ elementId: u, fileName: i, canPrint: a = !0, options: t }) { const r = n(!1), o = n(!1), l = n(null); async function c() { !a || r.value || (r.value = !0, clearTimeout(l.value), l.value = setTimeout(async () => { if (a) try { const { default: e } = await import("./pdf-BHGnVnBG.js"); await e({ domElement: document.getElementById(u), fileName: i, orientation: t.orientation, overflowTolerance: t.overflowTolerance, scale: t.scale, aspectRatio: t.aspectRatio ?? null }); } catch (e) { console.error("Error generating PDF:", e); } finally { r.value = !1; } }, 100)); } async function f() { !a || o.value || (o.value = !0, clearTimeout(l.value), l.value = setTimeout(async () => { if (a) try { const { default: e } = await import("./img-DKigoPDs.js"); await e({ domElement: document.getElementById(u), fileName: i, format: "png", options: t }); } catch (e) { console.error("Error generating image:", e); } finally { o.value = !1; } }, 100)); } return { generatePdf: c, generateImage: f, isPrinting: r, isImaging: o }; } export { m as u };