UNPKG

vue-data-ui

Version:

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

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