@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
53 lines (52 loc) • 1.51 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import * as e from "react";
import { createPortal as x } from "react-dom";
import o from "prop-types";
const l = e.forwardRef((t, d) => {
const { gridProps: p, pdf: f } = t, n = { ...p, ...f }, [r, a] = e.useState(!1), s = e.useRef(null);
e.useEffect(() => {
async function i() {
await t.onPdfExport({ target: s.current }), a(!1);
}
r && i();
}, [r, t.onPdfExport]);
const c = () => {
a(!0);
};
e.useImperativeHandle(d, () => ({
save: c
}));
const u = (i) => {
const m = { style: { ...n.style, width: "1000px" } };
return t.innerGrid ? /* @__PURE__ */ e.createElement(t.innerGrid, { ...m, ...n, scrollable: "scrollable" }) : null;
};
return r && x(
/* @__PURE__ */ e.createElement(
"div",
{
style: {
position: "absolute",
left: "-5000px",
top: "0px"
}
},
/* @__PURE__ */ e.createElement("div", { ref: s }, u())
),
document.body
);
});
l.displayName = "BasePDFExport";
l.propTypes = {
grid: o.element.isRequired,
pdf: o.object,
onPdfExport: o.func.isRequired
};
export {
l as BasePDFExport
};