UNPKG

@devgateway/dvz-ui-react

Version:

A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.

25 lines (24 loc) 1.08 kB
import { jsx as t } from "react/jsx-runtime"; import l, { useRef as m, useState as u } from "react"; import { Container as w, Button as b } from "semantic-ui-react"; l.forwardRef((d, o) => /* @__PURE__ */ t("div", { id: "divIdToPrint", ref: o, children: d.children })); const L = (d) => { m(); const [o, n] = u(!1), { childContent: g, "data-height": p, "data-button-label": i = "Download PDF", "data-file-label": r, "data-url": c, editing: s } = d, f = () => { n(!0), fetch("/pdf/" + c).then((a) => a.blob()).then((a) => { const h = window.URL.createObjectURL(a), e = document.createElement("a"); e.href = h, e.download = r, document.body.appendChild(e), e.click(), n(!1), e.remove(); }); }; return /* @__PURE__ */ t(w, { className: `viz download ${s ? "editing" : ""}`, fluid: !0, children: /* @__PURE__ */ t(l.Fragment, { children: /* @__PURE__ */ t("div", { className: "downloadPdf", children: /* @__PURE__ */ t(b, { loading: o, className: "download", onClick: f, children: i }) }) }) }); }; export { L as default };