@progress/kendo-react-pdf 7.0.2-develop.1 → 7.0.2-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PDFExport.d.ts +1 -1
- package/PDFMargin.d.ts +1 -1
- package/dist/cdn/js/kendo-react-pdf.js +1 -4
- package/grid/GridPDFExport.d.ts +1 -1
- package/index.d.mts +5 -0
- package/index.js +1 -4
- package/index.mjs +67 -75
- package/package.json +11 -5
- package/treelist/TreeListPDFExport.d.ts +1 -1
package/PDFExport.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
7
|
import { PDFExportProps } from './PDFExportProps';
|
|
8
8
|
/**
|
|
9
9
|
* Represents the KendoReact PDFExport component.
|
package/PDFMargin.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
7
|
/**
|
|
8
8
|
* Represents the props of the KendoReact PDFMargin component.
|
|
9
9
|
*/
|
|
@@ -2,7 +2,4 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
(function(c,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("prop-types"),require("@progress/kendo-drawing"),require("@progress/kendo-file-saver"),require("react-dom/server"),require("@progress/kendo-licensing"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","@progress/kendo-drawing","@progress/kendo-file-saver","react-dom/server","@progress/kendo-licensing","react-dom"],m):(c=typeof globalThis<"u"?globalThis:c||self,m(c.KendoReactPdf={},c.React,c.PropTypes,c.KendoDrawing,c.KendoFileSaver,c.ReactDOMServer,c.KendoLicensing,c.ReactDOM))})(this,function(c,m,X,T,A,J,Y,Z){"use strict";"use client";function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>r[n]})}}return t.default=r,Object.freeze(t)}const u=f(m),e=f(X),ee=f(J),R=f(Y),_=f(Z);class D extends u.Component{render(){return null}}D.propTypes={left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])};const G=["bottom","left","right","top"];function P(r){const t=u.Children.toArray(r.children).find(n=>n&&n.type===D);return t?te(t):r.margin}function te(r){const t={};for(let n=0;n<G.length;n++){const o=G[n],s=r.props[o];s!==void 0&&(t[o]=s)}return t}const re="export.pdf",ne="KendoReact PDF Generator";class O{constructor(t,n,o,s,i={}){this.drawDOM=t,this.exportPDF=n,this.saveAs=o,this.domElement=s,this.options=i,this.convertPageTemplateToHtml=p=>`<span>${ee.renderToStaticMarkup(u.createElement(this.options.pageTemplate,{pageNum:p.pageNum,totalPages:p.totalPages}))}</span>`}savePDF(t){const n=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||re,this.getSaveOptions()));t&&n.then(t,t)}getDrawOptions(){return{avoidLinks:this.options.avoidLinks,forcePageBreak:this.options.forcePageBreak,keepTogether:this.options.keepTogether,margin:this.options.margin,paperSize:this.options.paperSize,landscape:this.options.landscape,repeatHeaders:this.options.repeatHeaders,scale:this.options.scale,template:this.options.pageTemplate&&this.convertPageTemplateToHtml}}getPDFOptions(){return{author:this.options.author,creator:this.options.creator||ne,date:this.options.date,imgDPI:this.options.imageResolution,keywords:this.options.keywords,landscape:this.options.landscape,margin:this.options.margin,multiPage:!0,paperSize:this.options.paperSize,producer:this.options.producer,subject:this.options.subject,title:this.options.title}}getSaveOptions(){return{forceProxy:this.options.forceProxy,proxyData:this.options.proxyData,proxyTarget:this.options.proxyTarget,proxyURL:this.options.proxyURL}}}const C={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class M extends u.Component{constructor(t){if(super(t),this.rootElForPDF=null,typeof R<"u")R.validatePackage(C);else{let n=`License activation failed for ${C.name}
|
|
6
|
-
`;n+=`The @progress/kendo-licensing script is not loaded.
|
|
7
|
-
`,n+=`See ${C.licensingDocsUrl} for more information.
|
|
8
|
-
`,console.warn(n)}}render(){return u.createElement("div",{ref:t=>{this.rootElForPDF=t}},this.props.children)}save(t){new O(T.drawDOM,T.exportPDF,A.saveAs,this.rootElForPDF,this.getOptions()).savePDF(t)}getOptions(){return Object.assign({},this.props,{margin:P(this.props)})}}M.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};function v(r,t={},n){new O(T.drawDOM,T.exportPDF,A.saveAs,r,t).savePDF(n)}const E={},$=r=>String(r).trim().split(" "),oe=(r,t)=>{const n=$(t);return!!$(r.className).find(o=>n.indexOf(o)>=0)},g=r=>t=>oe(t,r),j=r=>(E[r]||(E[r]=t=>String(t.nodeName).toLowerCase()===r.toLowerCase()),E[r]),d=(r,t,n=!0)=>{if(r){if(n&&t(r))return r;for(r=r.firstChild;r;){if(r.nodeType===1){const o=d(r,t);if(o)return o}r=r.nextSibling}}},q="k-grid-header",W="k-grid-footer",se=j("TABLE"),K=r=>r?"locked":"wrap";let ie=class{constructor(t){this.element=t,this.list=d(t,g("k-grid-container"))}content(t){return d(this.list,g(`k-grid-content${t?"-locked":""}`))}header(t){return this.headerWrap=this.headerWrap||d(this.element,g(q)),d(this.headerWrap,g(`${q}-${K(t)}`))}footer(t){return this.footerWrap=this.footerWrap||d(this.element,g(W)),d(this.footerWrap,g(`${W}-${K(t)}`))}table(){return d(this.element,se)}};const B="k-first",ae="k-grid-header",pe="k-grid-footer",I=(r,t)=>{const n=t.length;for(let o=0;o<n;o++)r.appendChild(t[o].cloneNode(!0))},x=r=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(r),t},S=r=>{const t=r.length,n=r[0].cloneNode(!0),o=n.rows.length;if(t>1)for(let s=0;s<o;s++)for(let i=1;i<t;i++)I(n.rows[s],r[i].rows[s].cells);return n},ce=(r,t)=>{if(t.length>1&&r.rows.length>1)for(let n=1;n<r.rows.length;n++){const o=t[0].rows[n].cells.length,s=r.rows[n].cells[o];String(s.className).indexOf(B)===-1&&(s.className+=` ${B}`)}},U=(r,t,n,o)=>{const s=document.createElement("table"),i=r[0].cloneNode(!0);for(let a=1;a<r.length;a++)I(i,r[a].querySelectorAll("col"));const p=S(t),l=S(n);if(p.className=ae,ce(p,t),s.appendChild(i),s.appendChild(p),s.appendChild(l),o.length){const a=S(o);a.className=pe,s.appendChild(a)}return x(s)},le=r=>{const t=new ie(r),n=t.content();let o;if(n){const s=[n.querySelector("colgroup")],i=[t.header().querySelector("thead")],p=[n.querySelector("tbody")],l=t.footer(),a=l?[l.querySelector("tfoot")]:[];o=U(s,i,p,a)}else o=x(t.table().cloneNode(!0));return o};function de(r){return(t,n={},o,s,i)=>ue(r,t,n,o,s,i)}function ue(r,t,n={},o,s,i){let p,l,a;y();function y(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),_.render(w(),l,F)}function F(){r(L(),n,k)}function k(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function L(){a=document.createElement("div"),a.className="k-grid-pdf-export-element";const h=le(l);return a.appendChild(h),document.body.appendChild(a),h}function w(){const h=s&&{data:s,total:s.length,pageSize:s.length,skip:0},N={style:Object.assign({},t.props.style,{width:"1000px"})},b=Object.assign({},h,N);if(i&&i.length>0){const Te=ge(t);return u.cloneElement(t,b,i.concat(Te))}else return u.cloneElement(t,b)}}function ge(r){return u.Children.toArray(r.props.children).filter(t=>t&&t.type&&t.type.displayName!=="KendoReactGridColumn")}class H extends u.Component{constructor(t){super(t),this.saveGridPDF=de(this.getSavePDF())}render(){return null}save(t,n){this.saveGridPDF(this.getGrid(),Object.assign({},this.props,{margin:P(this.props)}),n,t,this.getCustomColumns())}getSavePDF(){return v}getGrid(){return u.Children.toArray(this.props.children).find(t=>t&&t.type.displayName==="KendoReactGrid")}getCustomColumns(){return u.Children.toArray(this.props.children).filter(t=>t&&t.type.displayName==="KendoReactGridColumn")}}H.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};const z="k-grid-header",Q="k-grid-footer",he=j("TABLE");class me{constructor(t){this.element=t,this.list=d(t,g("k-grid"))}content(){return d(this.list,g("k-grid"))}header(){return this.headerWrap=this.headerWrap||d(this.element,g(z)),d(this.headerWrap,g(`${z}`))}footer(){return this.footerWrap=this.footerWrap||d(this.element,g(Q)),d(this.footerWrap,g(`${Q}`))}table(){return d(this.element,he)}}const fe=r=>{const t=new me(r),n=t.content();let o,s=t.header();if(s.childNodes.length>1&&s.removeChild(s.childNodes[1]),s.childNodes[0].childNodes.forEach(i=>i.style.top=0),n){const i=[n.querySelector("colgroup")],p=[s],l=[n.querySelector("tbody")],a=t.footer(),y=a?[a.querySelector("tfoot")]:[];o=U(i,p,l,y)}else o=x(t.table().cloneNode(!0));return o};function ye(r){return(t,n={},o,s,i)=>be(r,t,n,o,s,i)}function be(r,t,n={},o,s,i){let p,l,a;y();function y(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),_.render(w(),l,F)}function F(){r(L(),n,k)}function k(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function L(){a=document.createElement("div"),a.className="k-treelist-pdf-export-element";const h=fe(l);return a.appendChild(h),document.body.appendChild(a),a}function w(){const h=n.allPages&&s?{data:s,take:Number.MAX_VALUE,skip:0}:{},N={style:Object.assign({},t.props.style,{width:"1000px"})},b=Object.assign({},h,N);return i&&i.length>0?u.cloneElement(t,Object.assign({},b,{columns:i})):u.cloneElement(t,b)}}class V extends u.Component{constructor(t){super(t),this.saveTreeListPDF=ye(this.getSavePDF())}render(){return null}save(t,n,o){this.saveTreeListPDF(this.getTreeList(),Object.assign({},this.props,{margin:P(this.props)}),o,t,n||[])}getSavePDF(){return v}getTreeList(){const t=this.props.children;if(t&&t.props.data&&t.props.columns)return this.props.children}}V.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string,allPages:e.bool},c.GridPDFExport=H,c.KendoDrawingAdapter=O,c.PDFExport=M,c.PDFMargin=D,c.TreeListPDFExport=V,c.getPageMargin=P,c.savePDF=v,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
5
|
+
(function(l,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react"),require("prop-types"),require("@progress/kendo-drawing"),require("@progress/kendo-file-saver"),require("react-dom/server"),require("@progress/kendo-react-common"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","@progress/kendo-drawing","@progress/kendo-file-saver","react-dom/server","@progress/kendo-react-common","react-dom"],f):(l=typeof globalThis<"u"?globalThis:l||self,f(l.KendoReactPdf={},l.React,l.PropTypes,l.KendoDrawing,l.KendoFileSaver,l.ReactDOMServer,l.KendoReactCommon,l.ReactDOM))})(this,function(l,f,e,C,G,J,Y,Z){"use strict";"use client";function D(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>n[r]})}}return t.default=n,Object.freeze(t)}const g=D(f),y=D(J),M=D(Z);class v extends g.Component{render(){return null}}v.propTypes={left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])};const j=["bottom","left","right","top"];function O(n){const t=g.Children.toArray(n.children).find(r=>r&&r.type===v);return t?T(t):n.margin}function T(n){const t={};for(let r=0;r<j.length;r++){const o=j[r],i=n.props[o];i!==void 0&&(t[o]=i)}return t}const P="export.pdf",ee="KendoReact PDF Generator";class E{constructor(t,r,o,i,s={}){this.drawDOM=t,this.exportPDF=r,this.saveAs=o,this.domElement=i,this.options=s,this.convertPageTemplateToHtml=c=>`<span>${y.renderToStaticMarkup(g.createElement(this.options.pageTemplate,{pageNum:c.pageNum,totalPages:c.totalPages}))}</span>`}savePDF(t){const r=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||P,this.getSaveOptions()));t&&r.then(t,t)}getDrawOptions(){return{avoidLinks:this.options.avoidLinks,forcePageBreak:this.options.forcePageBreak,keepTogether:this.options.keepTogether,margin:this.options.margin,paperSize:this.options.paperSize,landscape:this.options.landscape,repeatHeaders:this.options.repeatHeaders,scale:this.options.scale,template:this.options.pageTemplate&&this.convertPageTemplateToHtml}}getPDFOptions(){return{author:this.options.author,creator:this.options.creator||ee,date:this.options.date,imgDPI:this.options.imageResolution,keywords:this.options.keywords,landscape:this.options.landscape,margin:this.options.margin,multiPage:!0,paperSize:this.options.paperSize,producer:this.options.producer,subject:this.options.subject,title:this.options.title}}getSaveOptions(){return{forceProxy:this.options.forceProxy,proxyData:this.options.proxyData,proxyTarget:this.options.proxyTarget,proxyURL:this.options.proxyURL}}}const te={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class $ extends g.Component{constructor(t){super(t),this.rootElForPDF=null,Y.validatePackage(te)}render(){return g.createElement("div",{ref:t=>{this.rootElForPDF=t}},this.props.children)}save(t){new E(C.drawDOM,C.exportPDF,G.saveAs,this.rootElForPDF,this.getOptions()).savePDF(t)}getOptions(){return Object.assign({},this.props,{margin:O(this.props)})}}$.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};function x(n,t={},r){new E(C.drawDOM,C.exportPDF,G.saveAs,n,t).savePDF(r)}const S={},q=n=>String(n).trim().split(" "),ne=(n,t)=>{const r=q(t);return!!q(n.className).find(o=>r.indexOf(o)>=0)},h=n=>t=>ne(t,n),W=n=>(S[n]||(S[n]=t=>String(t.nodeName).toLowerCase()===n.toLowerCase()),S[n]),u=(n,t,r=!0)=>{if(n){if(r&&t(n))return n;for(n=n.firstChild;n;){if(n.nodeType===1){const o=u(n,t);if(o)return o}n=n.nextSibling}}},_="k-grid-header",K="k-grid-footer",re=W("TABLE"),B=n=>n?"locked":"wrap";let oe=class{constructor(t){this.element=t,this.list=u(t,h("k-grid-container"))}content(t){return u(this.list,h(`k-grid-content${t?"-locked":""}`))}header(t){return this.headerWrap=this.headerWrap||u(this.element,h(_)),u(this.headerWrap,h(`${_}-${B(t)}`))}footer(t){return this.footerWrap=this.footerWrap||u(this.element,h(K)),u(this.footerWrap,h(`${K}-${B(t)}`))}table(){return u(this.element,re)}};const I="k-first",ie="k-grid-header",se="k-grid-footer",U=(n,t)=>{const r=t.length;for(let o=0;o<r;o++)n.appendChild(t[o].cloneNode(!0))},F=n=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(n),t},k=n=>{const t=n.length,r=n[0].cloneNode(!0),o=r.rows.length;if(t>1)for(let i=0;i<o;i++)for(let s=1;s<t;s++)U(r.rows[i],n[s].rows[i].cells);return r},ae=(n,t)=>{if(t.length>1&&n.rows.length>1)for(let r=1;r<n.rows.length;r++){const o=t[0].rows[r].cells.length,i=n.rows[r].cells[o];String(i.className).indexOf(I)===-1&&(i.className+=` ${I}`)}},H=(n,t,r,o)=>{const i=document.createElement("table"),s=n[0].cloneNode(!0);for(let a=1;a<n.length;a++)U(s,n[a].querySelectorAll("col"));const c=k(t),d=k(r);if(c.className=ie,ae(c,t),i.appendChild(s),i.appendChild(c),i.appendChild(d),o.length){const a=k(o);a.className=se,i.appendChild(a)}return F(i)},ce=n=>{const t=new oe(n),r=t.content();let o;if(r){const i=[r.querySelector("colgroup")],s=[t.header().querySelector("thead")],c=[r.querySelector("tbody")],d=t.footer(),a=d?[d.querySelector("tfoot")]:[];o=H(i,s,c,a)}else o=F(t.table().cloneNode(!0));return o};function le(n){return(t,r={},o,i,s)=>de(n,t,r,o,i,s)}function de(n,t,r={},o,i,s){let c,d,a;b();function b(){c=document.createElement("div"),c.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),d=document.createElement("div"),c.appendChild(d),document.body.appendChild(c),M.render(A(),d,w)}function w(){n(N(),r,L)}function L(){document.body.removeChild(c),document.body.removeChild(a),c=a=void 0,o&&o()}function N(){a=document.createElement("div"),a.className="k-grid-pdf-export-element";const m=ce(d);return a.appendChild(m),document.body.appendChild(a),m}function A(){const m=i&&{data:i,total:i.length,pageSize:i.length,skip:0},R={style:Object.assign({},t.props.style,{width:"1000px"})},p=Object.assign({},m,R);if(s&&s.length>0){const pe=ue(t);return g.cloneElement(t,p,s.concat(pe))}else return g.cloneElement(t,p)}}function ue(n){return g.Children.toArray(n.props.children).filter(t=>t&&t.type&&t.type.displayName!=="KendoReactGridColumn")}class z extends g.Component{constructor(t){super(t),this.saveGridPDF=le(this.getSavePDF())}render(){return null}save(t,r){this.saveGridPDF(this.getGrid(),Object.assign({},this.props,{margin:O(this.props)}),r,t,this.getCustomColumns())}getSavePDF(){return x}getGrid(){return g.Children.toArray(this.props.children).find(t=>t&&t.type.displayName==="KendoReactGrid")}getCustomColumns(){return g.Children.toArray(this.props.children).filter(t=>t&&t.type.displayName==="KendoReactGridColumn")}}z.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};const Q="k-grid-header",V="k-grid-footer",ge=W("TABLE");class he{constructor(t){this.element=t,this.list=u(t,h("k-grid"))}content(){return u(this.list,h("k-grid"))}header(){return this.headerWrap=this.headerWrap||u(this.element,h(Q)),u(this.headerWrap,h(`${Q}`))}footer(){return this.footerWrap=this.footerWrap||u(this.element,h(V)),u(this.footerWrap,h(`${V}`))}table(){return u(this.element,ge)}}const me=n=>{const t=new he(n),r=t.content();let o,i=t.header();if(i.childNodes.length>1&&i.removeChild(i.childNodes[1]),i.childNodes[0].childNodes.forEach(s=>s.style.top=0),r){const s=[r.querySelector("colgroup")],c=[i],d=[r.querySelector("tbody")],a=t.footer(),b=a?[a.querySelector("tfoot")]:[];o=H(s,c,d,b)}else o=F(t.table().cloneNode(!0));return o};function fe(n){return(t,r={},o,i,s)=>be(n,t,r,o,i,s)}function be(n,t,r={},o,i,s){let c,d,a;b();function b(){c=document.createElement("div"),c.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),d=document.createElement("div"),c.appendChild(d),document.body.appendChild(c),M.render(A(),d,w)}function w(){n(N(),r,L)}function L(){document.body.removeChild(c),document.body.removeChild(a),c=a=void 0,o&&o()}function N(){a=document.createElement("div"),a.className="k-treelist-pdf-export-element";const m=me(d);return a.appendChild(m),document.body.appendChild(a),a}function A(){const m=r.allPages&&i?{data:i,take:Number.MAX_VALUE,skip:0}:{},R={style:Object.assign({},t.props.style,{width:"1000px"})},p=Object.assign({},m,R);return s&&s.length>0?g.cloneElement(t,Object.assign({},p,{columns:s})):g.cloneElement(t,p)}}class X extends g.Component{constructor(t){super(t),this.saveTreeListPDF=fe(this.getSavePDF())}render(){return null}save(t,r,o){this.saveTreeListPDF(this.getTreeList(),Object.assign({},this.props,{margin:O(this.props)}),o,t,r||[])}getSavePDF(){return x}getTreeList(){const t=this.props.children;if(t&&t.props.data&&t.props.columns)return this.props.children}}X.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string,allPages:e.bool},l.GridPDFExport=z,l.KendoDrawingAdapter=E,l.PDFExport=$,l.PDFMargin=v,l.TreeListPDFExport=X,l.getPageMargin=O,l.savePDF=x,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
package/grid/GridPDFExport.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
7
|
import { savePDF } from '../savePDF';
|
|
8
8
|
import { PDFExportProps } from '../PDFExportProps';
|
|
9
9
|
/**
|
package/index.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export * from './index';
|
package/index.js
CHANGED
|
@@ -2,7 +2,4 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),X=require("prop-types"),y=require("@progress/kendo-drawing"),q=require("@progress/kendo-file-saver"),J=require("react-dom/server"),Y=require("@progress/kendo-licensing"),Z=require("react-dom");function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>r[n]})}}return t.default=r,Object.freeze(t)}const d=f(V),e=f(X),ee=f(J),L=f(Y),W=f(Z);class S extends d.Component{render(){return null}}S.propTypes={left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])};const N=["bottom","left","right","top"];function b(r){const t=d.Children.toArray(r.children).find(n=>n&&n.type===S);return t?te(t):r.margin}function te(r){const t={};for(let n=0;n<N.length;n++){const o=N[n],s=r.props[o];s!==void 0&&(t[o]=s)}return t}const re="export.pdf",ne="KendoReact PDF Generator";class F{constructor(t,n,o,s,i={}){this.drawDOM=t,this.exportPDF=n,this.saveAs=o,this.domElement=s,this.options=i,this.convertPageTemplateToHtml=p=>`<span>${ee.renderToStaticMarkup(d.createElement(this.options.pageTemplate,{pageNum:p.pageNum,totalPages:p.totalPages}))}</span>`}savePDF(t){const n=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||re,this.getSaveOptions()));t&&n.then(t,t)}getDrawOptions(){return{avoidLinks:this.options.avoidLinks,forcePageBreak:this.options.forcePageBreak,keepTogether:this.options.keepTogether,margin:this.options.margin,paperSize:this.options.paperSize,landscape:this.options.landscape,repeatHeaders:this.options.repeatHeaders,scale:this.options.scale,template:this.options.pageTemplate&&this.convertPageTemplateToHtml}}getPDFOptions(){return{author:this.options.author,creator:this.options.creator||ne,date:this.options.date,imgDPI:this.options.imageResolution,keywords:this.options.keywords,landscape:this.options.landscape,margin:this.options.margin,multiPage:!0,paperSize:this.options.paperSize,producer:this.options.producer,subject:this.options.subject,title:this.options.title}}getSaveOptions(){return{forceProxy:this.options.forceProxy,proxyData:this.options.proxyData,proxyTarget:this.options.proxyTarget,proxyURL:this.options.proxyURL}}}const v={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class I extends d.Component{constructor(t){if(super(t),this.rootElForPDF=null,typeof L<"u")L.validatePackage(v);else{let n=`License activation failed for ${v.name}
|
|
6
|
-
`;n+=`The @progress/kendo-licensing script is not loaded.
|
|
7
|
-
`,n+=`See ${v.licensingDocsUrl} for more information.
|
|
8
|
-
`,console.warn(n)}}render(){return d.createElement("div",{ref:t=>{this.rootElForPDF=t}},this.props.children)}save(t){new F(y.drawDOM,y.exportPDF,q.saveAs,this.rootElForPDF,this.getOptions()).savePDF(t)}getOptions(){return Object.assign({},this.props,{margin:b(this.props)})}}I.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};function k(r,t={},n){new F(y.drawDOM,y.exportPDF,q.saveAs,r,t).savePDF(n)}const x={},A=r=>String(r).trim().split(" "),oe=(r,t)=>{const n=A(t);return!!A(r.className).find(o=>n.indexOf(o)>=0)},u=r=>t=>oe(t,r),U=r=>(x[r]||(x[r]=t=>String(t.nodeName).toLowerCase()===r.toLowerCase()),x[r]),c=(r,t,n=!0)=>{if(r){if(n&&t(r))return r;for(r=r.firstChild;r;){if(r.nodeType===1){const o=c(r,t);if(o)return o}r=r.nextSibling}}},R="k-grid-header",_="k-grid-footer",se="TABLE",ie=U(se),G=r=>r?"locked":"wrap";let ae=class{constructor(t){this.element=t,this.list=c(t,u("k-grid-container"))}content(t){return c(this.list,u(`k-grid-content${t?"-locked":""}`))}header(t){return this.headerWrap=this.headerWrap||c(this.element,u(R)),c(this.headerWrap,u(`${R}-${G(t)}`))}footer(t){return this.footerWrap=this.footerWrap||c(this.element,u(_)),c(this.footerWrap,u(`${_}-${G(t)}`))}table(){return c(this.element,ie)}};const M="k-first",pe="k-grid-header",le="k-grid-footer",B=(r,t)=>{const n=t.length;for(let o=0;o<n;o++)r.appendChild(t[o].cloneNode(!0))},w=r=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(r),t},E=r=>{const t=r.length,n=r[0].cloneNode(!0),o=n.rows.length;if(t>1)for(let s=0;s<o;s++)for(let i=1;i<t;i++)B(n.rows[s],r[i].rows[s].cells);return n},ce=(r,t)=>{if(t.length>1&&r.rows.length>1)for(let n=1;n<r.rows.length;n++){const o=t[0].rows[n].cells.length,s=r.rows[n].cells[o];String(s.className).indexOf(M)===-1&&(s.className+=` ${M}`)}},H=(r,t,n,o)=>{const s=document.createElement("table"),i=r[0].cloneNode(!0);for(let a=1;a<r.length;a++)B(i,r[a].querySelectorAll("col"));const p=E(t),l=E(n);if(p.className=pe,ce(p,t),s.appendChild(i),s.appendChild(p),s.appendChild(l),o.length){const a=E(o);a.className=le,s.appendChild(a)}return w(s)},de=r=>{const t=new ae(r),n=t.content();let o;if(n){const s=[n.querySelector("colgroup")],i=[t.header().querySelector("thead")],p=[n.querySelector("tbody")],l=t.footer(),a=l?[l.querySelector("tfoot")]:[];o=H(s,i,p,a)}else o=w(t.table().cloneNode(!0));return o};function ue(r){return(t,n={},o,s,i)=>ge(r,t,n,o,s,i)}function ge(r,t,n={},o,s,i){let p,l,a;h();function h(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),W.render(O(),l,T)}function T(){r(P(),n,D)}function D(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function P(){a=document.createElement("div"),a.className="k-grid-pdf-export-element";const g=de(l);return a.appendChild(g),document.body.appendChild(a),g}function O(){const g=s&&{data:s,total:s.length,pageSize:s.length,skip:0},C={style:Object.assign({},t.props.style,{width:"1000px"})},m=Object.assign({},g,C);if(i&&i.length>0){const Q=he(t);return d.cloneElement(t,m,i.concat(Q))}else return d.cloneElement(t,m)}}function he(r){return d.Children.toArray(r.props.children).filter(t=>t&&t.type&&t.type.displayName!=="KendoReactGridColumn")}class z extends d.Component{constructor(t){super(t),this.saveGridPDF=ue(this.getSavePDF())}render(){return null}save(t,n){this.saveGridPDF(this.getGrid(),Object.assign({},this.props,{margin:b(this.props)}),n,t,this.getCustomColumns())}getSavePDF(){return k}getGrid(){return d.Children.toArray(this.props.children).find(t=>t&&t.type.displayName==="KendoReactGrid")}getCustomColumns(){return d.Children.toArray(this.props.children).filter(t=>t&&t.type.displayName==="KendoReactGridColumn")}}z.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};const $="k-grid-header",j="k-grid-footer",me="TABLE",fe=U(me);class ye{constructor(t){this.element=t,this.list=c(t,u("k-grid"))}content(){return c(this.list,u("k-grid"))}header(){return this.headerWrap=this.headerWrap||c(this.element,u($)),c(this.headerWrap,u(`${$}`))}footer(){return this.footerWrap=this.footerWrap||c(this.element,u(j)),c(this.footerWrap,u(`${j}`))}table(){return c(this.element,fe)}}const be=r=>{const t=new ye(r),n=t.content();let o,s=t.header();if(s.childNodes.length>1&&s.removeChild(s.childNodes[1]),s.childNodes[0].childNodes.forEach(i=>i.style.top=0),n){const i=[n.querySelector("colgroup")],p=[s],l=[n.querySelector("tbody")],a=t.footer(),h=a?[a.querySelector("tfoot")]:[];o=H(i,p,l,h)}else o=w(t.table().cloneNode(!0));return o};function Te(r){return(t,n={},o,s,i)=>De(r,t,n,o,s,i)}function De(r,t,n={},o,s,i){let p,l,a;h();function h(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),W.render(O(),l,T)}function T(){r(P(),n,D)}function D(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function P(){a=document.createElement("div"),a.className="k-treelist-pdf-export-element";const g=be(l);return a.appendChild(g),document.body.appendChild(a),a}function O(){const g=n.allPages&&s?{data:s,take:Number.MAX_VALUE,skip:0}:{},C={style:Object.assign({},t.props.style,{width:"1000px"})},m=Object.assign({},g,C);return i&&i.length>0?d.cloneElement(t,Object.assign({},m,{columns:i})):d.cloneElement(t,m)}}class K extends d.Component{constructor(t){super(t),this.saveTreeListPDF=Te(this.getSavePDF())}render(){return null}save(t,n,o){this.saveTreeListPDF(this.getTreeList(),Object.assign({},this.props,{margin:b(this.props)}),o,t,n||[])}getSavePDF(){return k}getTreeList(){const t=this.props.children;if(t&&t.props.data&&t.props.columns)return this.props.children}}K.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string,allPages:e.bool};exports.GridPDFExport=z;exports.KendoDrawingAdapter=F;exports.PDFExport=I;exports.PDFMargin=S;exports.TreeListPDFExport=K;exports.getPageMargin=b;exports.savePDF=k;
|
|
5
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react"),e=require("prop-types"),f=require("@progress/kendo-drawing"),q=require("@progress/kendo-file-saver"),Q=require("react-dom/server"),V=require("@progress/kendo-react-common"),X=require("react-dom");function x(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>r[n]})}}return t.default=r,Object.freeze(t)}const d=x(K),J=x(Q),W=x(X);class E extends d.Component{render(){return null}}E.propTypes={left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])};const w=["bottom","left","right","top"];function y(r){const t=d.Children.toArray(r.children).find(n=>n&&n.type===E);return t?Y(t):r.margin}function Y(r){const t={};for(let n=0;n<w.length;n++){const o=w[n],s=r.props[o];s!==void 0&&(t[o]=s)}return t}const Z="export.pdf",ee="KendoReact PDF Generator";class S{constructor(t,n,o,s,i={}){this.drawDOM=t,this.exportPDF=n,this.saveAs=o,this.domElement=s,this.options=i,this.convertPageTemplateToHtml=p=>`<span>${J.renderToStaticMarkup(d.createElement(this.options.pageTemplate,{pageNum:p.pageNum,totalPages:p.totalPages}))}</span>`}savePDF(t){const n=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||Z,this.getSaveOptions()));t&&n.then(t,t)}getDrawOptions(){return{avoidLinks:this.options.avoidLinks,forcePageBreak:this.options.forcePageBreak,keepTogether:this.options.keepTogether,margin:this.options.margin,paperSize:this.options.paperSize,landscape:this.options.landscape,repeatHeaders:this.options.repeatHeaders,scale:this.options.scale,template:this.options.pageTemplate&&this.convertPageTemplateToHtml}}getPDFOptions(){return{author:this.options.author,creator:this.options.creator||ee,date:this.options.date,imgDPI:this.options.imageResolution,keywords:this.options.keywords,landscape:this.options.landscape,margin:this.options.margin,multiPage:!0,paperSize:this.options.paperSize,producer:this.options.producer,subject:this.options.subject,title:this.options.title}}getSaveOptions(){return{forceProxy:this.options.forceProxy,proxyData:this.options.proxyData,proxyTarget:this.options.proxyTarget,proxyURL:this.options.proxyURL}}}const te={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class _ extends d.Component{constructor(t){super(t),this.rootElForPDF=null,V.validatePackage(te)}render(){return d.createElement("div",{ref:t=>{this.rootElForPDF=t}},this.props.children)}save(t){new S(f.drawDOM,f.exportPDF,q.saveAs,this.rootElForPDF,this.getOptions()).savePDF(t)}getOptions(){return Object.assign({},this.props,{margin:y(this.props)})}}_.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};function F(r,t={},n){new S(f.drawDOM,f.exportPDF,q.saveAs,r,t).savePDF(n)}const O={},L=r=>String(r).trim().split(" "),re=(r,t)=>{const n=L(t);return!!L(r.className).find(o=>n.indexOf(o)>=0)},u=r=>t=>re(t,r),$=r=>(O[r]||(O[r]=t=>String(t.nodeName).toLowerCase()===r.toLowerCase()),O[r]),c=(r,t,n=!0)=>{if(r){if(n&&t(r))return r;for(r=r.firstChild;r;){if(r.nodeType===1){const o=c(r,t);if(o)return o}r=r.nextSibling}}},N="k-grid-header",A="k-grid-footer",ne="TABLE",oe=$(ne),R=r=>r?"locked":"wrap";let se=class{constructor(t){this.element=t,this.list=c(t,u("k-grid-container"))}content(t){return c(this.list,u(`k-grid-content${t?"-locked":""}`))}header(t){return this.headerWrap=this.headerWrap||c(this.element,u(N)),c(this.headerWrap,u(`${N}-${R(t)}`))}footer(t){return this.footerWrap=this.footerWrap||c(this.element,u(A)),c(this.footerWrap,u(`${A}-${R(t)}`))}table(){return c(this.element,oe)}};const G="k-first",ie="k-grid-header",ae="k-grid-footer",I=(r,t)=>{const n=t.length;for(let o=0;o<n;o++)r.appendChild(t[o].cloneNode(!0))},k=r=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(r),t},v=r=>{const t=r.length,n=r[0].cloneNode(!0),o=n.rows.length;if(t>1)for(let s=0;s<o;s++)for(let i=1;i<t;i++)I(n.rows[s],r[i].rows[s].cells);return n},pe=(r,t)=>{if(t.length>1&&r.rows.length>1)for(let n=1;n<r.rows.length;n++){const o=t[0].rows[n].cells.length,s=r.rows[n].cells[o];String(s.className).indexOf(G)===-1&&(s.className+=` ${G}`)}},U=(r,t,n,o)=>{const s=document.createElement("table"),i=r[0].cloneNode(!0);for(let a=1;a<r.length;a++)I(i,r[a].querySelectorAll("col"));const p=v(t),l=v(n);if(p.className=ie,pe(p,t),s.appendChild(i),s.appendChild(p),s.appendChild(l),o.length){const a=v(o);a.className=ae,s.appendChild(a)}return k(s)},le=r=>{const t=new se(r),n=t.content();let o;if(n){const s=[n.querySelector("colgroup")],i=[t.header().querySelector("thead")],p=[n.querySelector("tbody")],l=t.footer(),a=l?[l.querySelector("tfoot")]:[];o=U(s,i,p,a)}else o=k(t.table().cloneNode(!0));return o};function ce(r){return(t,n={},o,s,i)=>de(r,t,n,o,s,i)}function de(r,t,n={},o,s,i){let p,l,a;h();function h(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),W.render(P(),l,b)}function b(){r(D(),n,T)}function T(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function D(){a=document.createElement("div"),a.className="k-grid-pdf-export-element";const g=le(l);return a.appendChild(g),document.body.appendChild(a),g}function P(){const g=s&&{data:s,total:s.length,pageSize:s.length,skip:0},C={style:Object.assign({},t.props.style,{width:"1000px"})},m=Object.assign({},g,C);if(i&&i.length>0){const z=ue(t);return d.cloneElement(t,m,i.concat(z))}else return d.cloneElement(t,m)}}function ue(r){return d.Children.toArray(r.props.children).filter(t=>t&&t.type&&t.type.displayName!=="KendoReactGridColumn")}class B extends d.Component{constructor(t){super(t),this.saveGridPDF=ce(this.getSavePDF())}render(){return null}save(t,n){this.saveGridPDF(this.getGrid(),Object.assign({},this.props,{margin:y(this.props)}),n,t,this.getCustomColumns())}getSavePDF(){return F}getGrid(){return d.Children.toArray(this.props.children).find(t=>t&&t.type.displayName==="KendoReactGrid")}getCustomColumns(){return d.Children.toArray(this.props.children).filter(t=>t&&t.type.displayName==="KendoReactGridColumn")}}B.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};const M="k-grid-header",j="k-grid-footer",ge="TABLE",he=$(ge);class me{constructor(t){this.element=t,this.list=c(t,u("k-grid"))}content(){return c(this.list,u("k-grid"))}header(){return this.headerWrap=this.headerWrap||c(this.element,u(M)),c(this.headerWrap,u(`${M}`))}footer(){return this.footerWrap=this.footerWrap||c(this.element,u(j)),c(this.footerWrap,u(`${j}`))}table(){return c(this.element,he)}}const fe=r=>{const t=new me(r),n=t.content();let o,s=t.header();if(s.childNodes.length>1&&s.removeChild(s.childNodes[1]),s.childNodes[0].childNodes.forEach(i=>i.style.top=0),n){const i=[n.querySelector("colgroup")],p=[s],l=[n.querySelector("tbody")],a=t.footer(),h=a?[a.querySelector("tfoot")]:[];o=U(i,p,l,h)}else o=k(t.table().cloneNode(!0));return o};function ye(r){return(t,n={},o,s,i)=>be(r,t,n,o,s,i)}function be(r,t,n={},o,s,i){let p,l,a;h();function h(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),W.render(P(),l,b)}function b(){r(D(),n,T)}function T(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function D(){a=document.createElement("div"),a.className="k-treelist-pdf-export-element";const g=fe(l);return a.appendChild(g),document.body.appendChild(a),a}function P(){const g=n.allPages&&s?{data:s,take:Number.MAX_VALUE,skip:0}:{},C={style:Object.assign({},t.props.style,{width:"1000px"})},m=Object.assign({},g,C);return i&&i.length>0?d.cloneElement(t,Object.assign({},m,{columns:i})):d.cloneElement(t,m)}}class H extends d.Component{constructor(t){super(t),this.saveTreeListPDF=ye(this.getSavePDF())}render(){return null}save(t,n,o){this.saveTreeListPDF(this.getTreeList(),Object.assign({},this.props,{margin:y(this.props)}),o,t,n||[])}getSavePDF(){return F}getTreeList(){const t=this.props.children;if(t&&t.props.data&&t.props.columns)return this.props.children}}H.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string,allPages:e.bool};exports.GridPDFExport=B;exports.KendoDrawingAdapter=S;exports.PDFExport=_;exports.PDFMargin=E;exports.TreeListPDFExport=H;exports.getPageMargin=y;exports.savePDF=F;
|
package/index.mjs
CHANGED
|
@@ -4,40 +4,40 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
"use client";
|
|
6
6
|
import * as d from "react";
|
|
7
|
-
import
|
|
8
|
-
import { drawDOM as
|
|
9
|
-
import { saveAs as
|
|
10
|
-
import * as
|
|
11
|
-
import
|
|
12
|
-
import * as
|
|
13
|
-
class
|
|
7
|
+
import e from "prop-types";
|
|
8
|
+
import { drawDOM as A, exportPDF as R } from "@progress/kendo-drawing";
|
|
9
|
+
import { saveAs as G } from "@progress/kendo-file-saver";
|
|
10
|
+
import * as H from "react-dom/server";
|
|
11
|
+
import { validatePackage as _ } from "@progress/kendo-react-common";
|
|
12
|
+
import * as W from "react-dom";
|
|
13
|
+
class $ extends d.Component {
|
|
14
14
|
render() {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
$.propTypes = {
|
|
19
19
|
left: e.oneOfType([e.number, e.string]),
|
|
20
20
|
top: e.oneOfType([e.number, e.string]),
|
|
21
21
|
right: e.oneOfType([e.number, e.string]),
|
|
22
22
|
bottom: e.oneOfType([e.number, e.string])
|
|
23
23
|
};
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
const t = d.Children.toArray(r.children).find((o) => o && o.type ===
|
|
27
|
-
return t ?
|
|
24
|
+
const x = ["bottom", "left", "right", "top"];
|
|
25
|
+
function D(r) {
|
|
26
|
+
const t = d.Children.toArray(r.children).find((o) => o && o.type === $);
|
|
27
|
+
return t ? z(t) : r.margin;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function z(r) {
|
|
30
30
|
const t = {};
|
|
31
|
-
for (let o = 0; o <
|
|
32
|
-
const n =
|
|
31
|
+
for (let o = 0; o < x.length; o++) {
|
|
32
|
+
const n = x[o], s = r.props[n];
|
|
33
33
|
s !== void 0 && (t[n] = s);
|
|
34
34
|
}
|
|
35
35
|
return t;
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
class
|
|
37
|
+
const K = "export.pdf", Q = "KendoReact PDF Generator";
|
|
38
|
+
class j {
|
|
39
39
|
constructor(t, o, n, s, i = {}) {
|
|
40
|
-
this.drawDOM = t, this.exportPDF = o, this.saveAs = n, this.domElement = s, this.options = i, this.convertPageTemplateToHtml = (p) => `<span>${
|
|
40
|
+
this.drawDOM = t, this.exportPDF = o, this.saveAs = n, this.domElement = s, this.options = i, this.convertPageTemplateToHtml = (p) => `<span>${H.renderToStaticMarkup(
|
|
41
41
|
d.createElement(this.options.pageTemplate, {
|
|
42
42
|
pageNum: p.pageNum,
|
|
43
43
|
totalPages: p.totalPages
|
|
@@ -45,7 +45,7 @@ class I {
|
|
|
45
45
|
)}</span>`;
|
|
46
46
|
}
|
|
47
47
|
savePDF(t) {
|
|
48
|
-
const o = this.drawDOM(this.domElement, this.getDrawOptions()).then((n) => this.exportPDF(n, this.getPDFOptions())).then((n) => this.saveAs(n, this.options.fileName ||
|
|
48
|
+
const o = this.drawDOM(this.domElement, this.getDrawOptions()).then((n) => this.exportPDF(n, this.getPDFOptions())).then((n) => this.saveAs(n, this.options.fileName || K, this.getSaveOptions()));
|
|
49
49
|
t && o.then(t, t);
|
|
50
50
|
}
|
|
51
51
|
getDrawOptions() {
|
|
@@ -64,7 +64,7 @@ class I {
|
|
|
64
64
|
getPDFOptions() {
|
|
65
65
|
return {
|
|
66
66
|
author: this.options.author,
|
|
67
|
-
creator: this.options.creator ||
|
|
67
|
+
creator: this.options.creator || Q,
|
|
68
68
|
date: this.options.date,
|
|
69
69
|
imgDPI: this.options.imageResolution,
|
|
70
70
|
keywords: this.options.keywords,
|
|
@@ -86,25 +86,17 @@ class I {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const V = {
|
|
90
90
|
name: "@progress/kendo-react-pdf",
|
|
91
91
|
productName: "KendoReact",
|
|
92
92
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
93
|
-
publishDate:
|
|
93
|
+
publishDate: 1702631527,
|
|
94
94
|
version: "",
|
|
95
95
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
96
96
|
};
|
|
97
97
|
class X extends d.Component {
|
|
98
98
|
constructor(t) {
|
|
99
|
-
|
|
100
|
-
E.validatePackage(P);
|
|
101
|
-
else {
|
|
102
|
-
let o = `License activation failed for ${P.name}
|
|
103
|
-
`;
|
|
104
|
-
o += `The @progress/kendo-licensing script is not loaded.
|
|
105
|
-
`, o += `See ${P.licensingDocsUrl} for more information.
|
|
106
|
-
`, console.warn(o);
|
|
107
|
-
}
|
|
99
|
+
super(t), this.rootElForPDF = null, _(V);
|
|
108
100
|
}
|
|
109
101
|
/**
|
|
110
102
|
* @hidden
|
|
@@ -120,16 +112,16 @@ class X extends d.Component {
|
|
|
120
112
|
* @param callback - The callback to be executed after the PDF is saved.
|
|
121
113
|
*/
|
|
122
114
|
save(t) {
|
|
123
|
-
new
|
|
115
|
+
new j(
|
|
116
|
+
A,
|
|
117
|
+
R,
|
|
124
118
|
G,
|
|
125
|
-
$,
|
|
126
|
-
W,
|
|
127
119
|
this.rootElForPDF,
|
|
128
120
|
this.getOptions()
|
|
129
121
|
).savePDF(t);
|
|
130
122
|
}
|
|
131
123
|
getOptions() {
|
|
132
|
-
return Object.assign({}, this.props, { margin:
|
|
124
|
+
return Object.assign({}, this.props, { margin: D(this.props) });
|
|
133
125
|
}
|
|
134
126
|
}
|
|
135
127
|
X.propTypes = {
|
|
@@ -161,19 +153,19 @@ X.propTypes = {
|
|
|
161
153
|
subject: e.string,
|
|
162
154
|
title: e.string
|
|
163
155
|
};
|
|
164
|
-
function
|
|
165
|
-
new
|
|
156
|
+
function M(r, t = {}, o) {
|
|
157
|
+
new j(
|
|
158
|
+
A,
|
|
159
|
+
R,
|
|
166
160
|
G,
|
|
167
|
-
$,
|
|
168
|
-
W,
|
|
169
161
|
r,
|
|
170
162
|
t
|
|
171
163
|
).savePDF(o);
|
|
172
164
|
}
|
|
173
|
-
const
|
|
174
|
-
const o =
|
|
175
|
-
return !!
|
|
176
|
-
}, u = (r) => (t) => J(t, r),
|
|
165
|
+
const P = {}, E = (r) => String(r).trim().split(" "), J = (r, t) => {
|
|
166
|
+
const o = E(t);
|
|
167
|
+
return !!E(r.className).find((n) => o.indexOf(n) >= 0);
|
|
168
|
+
}, u = (r) => (t) => J(t, r), I = (r) => (P[r] || (P[r] = (t) => String(t.nodeName).toLowerCase() === r.toLowerCase()), P[r]), c = (r, t, o = !0) => {
|
|
177
169
|
if (r) {
|
|
178
170
|
if (o && t(r))
|
|
179
171
|
return r;
|
|
@@ -186,7 +178,7 @@ const O = {}, k = (r) => String(r).trim().split(" "), J = (r, t) => {
|
|
|
186
178
|
r = r.nextSibling;
|
|
187
179
|
}
|
|
188
180
|
}
|
|
189
|
-
},
|
|
181
|
+
}, S = "k-grid-header", k = "k-grid-footer", Y = "TABLE", Z = I(Y), F = (r) => r ? "locked" : "wrap";
|
|
190
182
|
let ee = class {
|
|
191
183
|
constructor(t) {
|
|
192
184
|
this.element = t, this.list = c(t, u("k-grid-container"));
|
|
@@ -195,53 +187,53 @@ let ee = class {
|
|
|
195
187
|
return c(this.list, u(`k-grid-content${t ? "-locked" : ""}`));
|
|
196
188
|
}
|
|
197
189
|
header(t) {
|
|
198
|
-
return this.headerWrap = this.headerWrap || c(this.element, u(
|
|
190
|
+
return this.headerWrap = this.headerWrap || c(this.element, u(S)), c(this.headerWrap, u(`${S}-${F(t)}`));
|
|
199
191
|
}
|
|
200
192
|
footer(t) {
|
|
201
|
-
return this.footerWrap = this.footerWrap || c(this.element, u(
|
|
193
|
+
return this.footerWrap = this.footerWrap || c(this.element, u(k)), c(this.footerWrap, u(`${k}-${F(t)}`));
|
|
202
194
|
}
|
|
203
195
|
table() {
|
|
204
196
|
return c(this.element, Z);
|
|
205
197
|
}
|
|
206
198
|
};
|
|
207
|
-
const
|
|
199
|
+
const w = "k-first", te = "k-grid-header", re = "k-grid-footer", U = (r, t) => {
|
|
208
200
|
const o = t.length;
|
|
209
201
|
for (let n = 0; n < o; n++)
|
|
210
202
|
r.appendChild(t[n].cloneNode(!0));
|
|
211
|
-
},
|
|
203
|
+
}, v = (r) => {
|
|
212
204
|
const t = document.createElement("div");
|
|
213
205
|
return t.className = "k-grid k-grid-md", t.appendChild(r), t;
|
|
214
|
-
},
|
|
206
|
+
}, O = (r) => {
|
|
215
207
|
const t = r.length, o = r[0].cloneNode(!0), n = o.rows.length;
|
|
216
208
|
if (t > 1)
|
|
217
209
|
for (let s = 0; s < n; s++)
|
|
218
210
|
for (let i = 1; i < t; i++)
|
|
219
|
-
|
|
211
|
+
U(o.rows[s], r[i].rows[s].cells);
|
|
220
212
|
return o;
|
|
221
213
|
}, oe = (r, t) => {
|
|
222
214
|
if (t.length > 1 && r.rows.length > 1)
|
|
223
215
|
for (let o = 1; o < r.rows.length; o++) {
|
|
224
216
|
const n = t[0].rows[o].cells.length, s = r.rows[o].cells[n];
|
|
225
|
-
String(s.className).indexOf(
|
|
217
|
+
String(s.className).indexOf(w) === -1 && (s.className += ` ${w}`);
|
|
226
218
|
}
|
|
227
|
-
},
|
|
219
|
+
}, q = (r, t, o, n) => {
|
|
228
220
|
const s = document.createElement("table"), i = r[0].cloneNode(!0);
|
|
229
221
|
for (let a = 1; a < r.length; a++)
|
|
230
|
-
|
|
231
|
-
const p =
|
|
222
|
+
U(i, r[a].querySelectorAll("col"));
|
|
223
|
+
const p = O(t), l = O(o);
|
|
232
224
|
if (p.className = te, oe(p, t), s.appendChild(i), s.appendChild(p), s.appendChild(l), n.length) {
|
|
233
|
-
const a =
|
|
225
|
+
const a = O(n);
|
|
234
226
|
a.className = re, s.appendChild(a);
|
|
235
227
|
}
|
|
236
|
-
return
|
|
228
|
+
return v(s);
|
|
237
229
|
}, ne = (r) => {
|
|
238
230
|
const t = new ee(r), o = t.content();
|
|
239
231
|
let n;
|
|
240
232
|
if (o) {
|
|
241
233
|
const s = [o.querySelector("colgroup")], i = [t.header().querySelector("thead")], p = [o.querySelector("tbody")], l = t.footer(), a = l ? [l.querySelector("tfoot")] : [];
|
|
242
|
-
n =
|
|
234
|
+
n = q(s, i, p, a);
|
|
243
235
|
} else
|
|
244
|
-
n =
|
|
236
|
+
n = v(t.table().cloneNode(!0));
|
|
245
237
|
return n;
|
|
246
238
|
};
|
|
247
239
|
function se(r) {
|
|
@@ -258,7 +250,7 @@ function ie(r, t, o = {}, n, s, i) {
|
|
|
258
250
|
let p, l, a;
|
|
259
251
|
g();
|
|
260
252
|
function g() {
|
|
261
|
-
p = document.createElement("div"), p.setAttribute("style", "position:absolute; left: -5000px; top: 0px;"), l = document.createElement("div"), p.appendChild(l), document.body.appendChild(p),
|
|
253
|
+
p = document.createElement("div"), p.setAttribute("style", "position:absolute; left: -5000px; top: 0px;"), l = document.createElement("div"), p.appendChild(l), document.body.appendChild(p), W.render(T(), l, f);
|
|
262
254
|
}
|
|
263
255
|
function f() {
|
|
264
256
|
r(b(), o, y);
|
|
@@ -274,8 +266,8 @@ function ie(r, t, o = {}, n, s, i) {
|
|
|
274
266
|
function T() {
|
|
275
267
|
const h = s && { data: s, total: s.length, pageSize: s.length, skip: 0 }, C = { style: Object.assign({}, t.props.style, { width: "1000px" }) }, m = Object.assign({}, h, C);
|
|
276
268
|
if (i && i.length > 0) {
|
|
277
|
-
const
|
|
278
|
-
return d.cloneElement(t, m, i.concat(
|
|
269
|
+
const B = ae(t);
|
|
270
|
+
return d.cloneElement(t, m, i.concat(B));
|
|
279
271
|
} else
|
|
280
272
|
return d.cloneElement(t, m);
|
|
281
273
|
}
|
|
@@ -304,14 +296,14 @@ class pe extends d.Component {
|
|
|
304
296
|
save(t, o) {
|
|
305
297
|
this.saveGridPDF(
|
|
306
298
|
this.getGrid(),
|
|
307
|
-
Object.assign({}, this.props, { margin:
|
|
299
|
+
Object.assign({}, this.props, { margin: D(this.props) }),
|
|
308
300
|
o,
|
|
309
301
|
t,
|
|
310
302
|
this.getCustomColumns()
|
|
311
303
|
);
|
|
312
304
|
}
|
|
313
305
|
getSavePDF() {
|
|
314
|
-
return
|
|
306
|
+
return M;
|
|
315
307
|
}
|
|
316
308
|
getGrid() {
|
|
317
309
|
return d.Children.toArray(this.props.children).find((t) => t && t.type.displayName === "KendoReactGrid");
|
|
@@ -349,7 +341,7 @@ pe.propTypes = {
|
|
|
349
341
|
subject: e.string,
|
|
350
342
|
title: e.string
|
|
351
343
|
};
|
|
352
|
-
const
|
|
344
|
+
const L = "k-grid-header", N = "k-grid-footer", le = "TABLE", ce = I(le);
|
|
353
345
|
class de {
|
|
354
346
|
constructor(t) {
|
|
355
347
|
this.element = t, this.list = c(t, u("k-grid"));
|
|
@@ -358,10 +350,10 @@ class de {
|
|
|
358
350
|
return c(this.list, u("k-grid"));
|
|
359
351
|
}
|
|
360
352
|
header() {
|
|
361
|
-
return this.headerWrap = this.headerWrap || c(this.element, u(
|
|
353
|
+
return this.headerWrap = this.headerWrap || c(this.element, u(L)), c(this.headerWrap, u(`${L}`));
|
|
362
354
|
}
|
|
363
355
|
footer() {
|
|
364
|
-
return this.footerWrap = this.footerWrap || c(this.element, u(
|
|
356
|
+
return this.footerWrap = this.footerWrap || c(this.element, u(N)), c(this.footerWrap, u(`${N}`));
|
|
365
357
|
}
|
|
366
358
|
table() {
|
|
367
359
|
return c(this.element, ce);
|
|
@@ -372,9 +364,9 @@ const ue = (r) => {
|
|
|
372
364
|
let n, s = t.header();
|
|
373
365
|
if (s.childNodes.length > 1 && s.removeChild(s.childNodes[1]), s.childNodes[0].childNodes.forEach((i) => i.style.top = 0), o) {
|
|
374
366
|
const i = [o.querySelector("colgroup")], p = [s], l = [o.querySelector("tbody")], a = t.footer(), g = a ? [a.querySelector("tfoot")] : [];
|
|
375
|
-
n =
|
|
367
|
+
n = q(i, p, l, g);
|
|
376
368
|
} else
|
|
377
|
-
n =
|
|
369
|
+
n = v(t.table().cloneNode(!0));
|
|
378
370
|
return n;
|
|
379
371
|
};
|
|
380
372
|
function he(r) {
|
|
@@ -391,7 +383,7 @@ function ge(r, t, o = {}, n, s, i) {
|
|
|
391
383
|
let p, l, a;
|
|
392
384
|
g();
|
|
393
385
|
function g() {
|
|
394
|
-
p = document.createElement("div"), p.setAttribute("style", "position:absolute; left: -5000px; top: 0px;"), l = document.createElement("div"), p.appendChild(l), document.body.appendChild(p),
|
|
386
|
+
p = document.createElement("div"), p.setAttribute("style", "position:absolute; left: -5000px; top: 0px;"), l = document.createElement("div"), p.appendChild(l), document.body.appendChild(p), W.render(T(), l, f);
|
|
395
387
|
}
|
|
396
388
|
function f() {
|
|
397
389
|
r(b(), o, y);
|
|
@@ -431,14 +423,14 @@ class me extends d.Component {
|
|
|
431
423
|
save(t, o, n) {
|
|
432
424
|
this.saveTreeListPDF(
|
|
433
425
|
this.getTreeList(),
|
|
434
|
-
Object.assign({}, this.props, { margin:
|
|
426
|
+
Object.assign({}, this.props, { margin: D(this.props) }),
|
|
435
427
|
n,
|
|
436
428
|
t,
|
|
437
429
|
o || []
|
|
438
430
|
);
|
|
439
431
|
}
|
|
440
432
|
getSavePDF() {
|
|
441
|
-
return
|
|
433
|
+
return M;
|
|
442
434
|
}
|
|
443
435
|
getTreeList() {
|
|
444
436
|
const t = this.props.children;
|
|
@@ -478,10 +470,10 @@ me.propTypes = {
|
|
|
478
470
|
};
|
|
479
471
|
export {
|
|
480
472
|
pe as GridPDFExport,
|
|
481
|
-
|
|
473
|
+
j as KendoDrawingAdapter,
|
|
482
474
|
X as PDFExport,
|
|
483
|
-
|
|
475
|
+
$ as PDFMargin,
|
|
484
476
|
me as TreeListPDFExport,
|
|
485
|
-
|
|
486
|
-
|
|
477
|
+
D as getPageMargin,
|
|
478
|
+
M as savePDF
|
|
487
479
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-pdf",
|
|
3
|
-
"version": "7.0.2-develop.
|
|
3
|
+
"version": "7.0.2-develop.2",
|
|
4
4
|
"description": "React PDF Processing enables you to export single- and multi-page content in PDF. KendoReact PDF Processing package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -10,16 +10,22 @@
|
|
|
10
10
|
"types": "./index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"import":
|
|
14
|
-
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./index.d.mts",
|
|
15
|
+
"default": "./index.mjs"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
|
+
"default": "./index.js"
|
|
20
|
+
}
|
|
15
21
|
}
|
|
16
22
|
},
|
|
17
23
|
"sideEffects": false,
|
|
18
24
|
"peerDependencies": {
|
|
19
25
|
"@progress/kendo-drawing": "^1.17.2",
|
|
20
26
|
"@progress/kendo-file-saver": "^1.0.1",
|
|
21
|
-
"@progress/kendo-licensing": "^1.3.
|
|
22
|
-
"@progress/kendo-react-common": "7.0.2-develop.
|
|
27
|
+
"@progress/kendo-licensing": "^1.3.4",
|
|
28
|
+
"@progress/kendo-react-common": "7.0.2-develop.2",
|
|
23
29
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
24
30
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
25
31
|
},
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
7
|
import { savePDF } from '../savePDF';
|
|
8
8
|
import { PDFExportProps } from '../PDFExportProps';
|
|
9
9
|
/**
|