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) 805 B
"use strict";const t=require("react/jsx-runtime"),n=require("react"),l=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,i]=n.useState(!1),{childContent:w,"data-height":b,"data-button-label":c="Download PDF","data-file-label":r,"data-url":s,editing:u}=d,h=()=>{i(!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(),i(!1),e.remove()})};return t.jsx(l.Container,{className:`viz download ${u?"editing":""}`,fluid:!0,children:t.jsx(n.Fragment,{children:t.jsx("div",{className:"downloadPdf",children:t.jsx(l.Button,{loading:a,className:"download",onClick:h,children:c})})})})};module.exports=m;