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.

2 lines (1 loc) 901 B
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),n=require("react"),i=require("semantic-ui-react");n.forwardRef((d,a)=>t.jsx("div",{id:"divIdToPrint",ref:a,children:d.children}));const m=d=>{n.useRef();const[a,l]=n.useState(!1),{childContent:b,"data-height":w,"data-button-label":c="Download PDF","data-file-label":r,"data-url":s,editing:u}=d,h=()=>{l(!0),fetch("/pdf/"+s).then(o=>o.blob()).then(o=>{const f=window.URL.createObjectURL(o),e=document.createElement("a");e.href=f,e.download=r,document.body.appendChild(e),e.click(),l(!1),e.remove()})};return t.jsx(i.Container,{className:`viz download ${u?"editing":""}`,fluid:!0,children:t.jsx(n.Fragment,{children:t.jsx("div",{className:"downloadPdf",children:t.jsx(i.Button,{loading:a,className:"download",onClick:h,children:c})})})})};exports.default=m;