@progress/kendo-react-pdf 9.5.0 → 10.0.0-develop.1
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.js +1 -1
- package/PDFExport.mjs +48 -47
- package/dist/cdn/js/kendo-react-pdf.js +1 -1
- package/grid/GridPDFExport.js +1 -1
- package/grid/GridPDFExport.mjs +26 -24
- package/index.d.mts +5 -2
- package/index.d.ts +5 -2
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +3 -3
- package/treelist/TreeListPDFExport.js +1 -1
- package/treelist/TreeListPDFExport.mjs +10 -8
package/PDFExport.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),e=require("prop-types"),c=require("@progress/kendo-drawing"),l=require("@progress/kendo-file-saver"),u=require("./getPageMargin.js"),m=require("./KendoDrawingAdapter.js"),g=require("@progress/kendo-react-common"),d=require("./package-metadata.js");function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>r[n]})}}return t.default=r,Object.freeze(t)}const o=f(p),s=class s extends o.Component{constructor(t){super(t),this.rootElForPDF=null,this.showLicenseWatermark=!1,this.showLicenseWatermark=!g.validatePackage(d.packageMetadata,{component:"PDFExport"})}render(){return o.createElement("div",{ref:t=>{this.rootElForPDF=t}},this.props.children,this.showLicenseWatermark&&o.createElement(g.WatermarkOverlay,null))}save(t){new m(c.drawDOM,c.exportPDF,l.saveAs,this.rootElForPDF,this.getOptions()).savePDF(t)}getOptions(){return Object.assign({},this.props,{margin:u.getPageMargin(this.props)})}};s.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};let a=s;exports.PDFExport=a;
|
package/PDFExport.mjs
CHANGED
|
@@ -5,30 +5,31 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
import { drawDOM as s, exportPDF as
|
|
11
|
-
import { saveAs as
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import e from "prop-types";
|
|
10
|
+
import { drawDOM as s, exportPDF as a } from "@progress/kendo-drawing";
|
|
11
|
+
import { saveAs as i } from "@progress/kendo-file-saver";
|
|
12
12
|
import { getPageMargin as p } from "./getPageMargin.mjs";
|
|
13
|
-
import
|
|
14
|
-
import { validatePackage as
|
|
15
|
-
import { packageMetadata as
|
|
16
|
-
const
|
|
17
|
-
constructor(
|
|
18
|
-
super(
|
|
13
|
+
import m from "./KendoDrawingAdapter.mjs";
|
|
14
|
+
import { validatePackage as g, WatermarkOverlay as l } from "@progress/kendo-react-common";
|
|
15
|
+
import { packageMetadata as c } from "./package-metadata.mjs";
|
|
16
|
+
const o = class o extends t.Component {
|
|
17
|
+
constructor(r) {
|
|
18
|
+
super(r), this.rootElForPDF = null, this.showLicenseWatermark = !1, this.showLicenseWatermark = !g(c, { component: "PDFExport" });
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* @hidden
|
|
22
22
|
*/
|
|
23
23
|
render() {
|
|
24
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ t.createElement(
|
|
25
25
|
"div",
|
|
26
26
|
{
|
|
27
|
-
ref: (
|
|
28
|
-
this.rootElForPDF =
|
|
27
|
+
ref: (r) => {
|
|
28
|
+
this.rootElForPDF = r;
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
this.props.children
|
|
31
|
+
this.props.children,
|
|
32
|
+
this.showLicenseWatermark && /* @__PURE__ */ t.createElement(l, null)
|
|
32
33
|
);
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
@@ -36,47 +37,47 @@ const t = class t extends o.Component {
|
|
|
36
37
|
*
|
|
37
38
|
* @param callback - The callback to be executed after the PDF is saved.
|
|
38
39
|
*/
|
|
39
|
-
save(
|
|
40
|
-
new
|
|
40
|
+
save(r) {
|
|
41
|
+
new m(s, a, i, this.rootElForPDF, this.getOptions()).savePDF(r);
|
|
41
42
|
}
|
|
42
43
|
getOptions() {
|
|
43
44
|
return Object.assign({}, this.props, { margin: p(this.props) });
|
|
44
45
|
}
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
-
author:
|
|
48
|
-
avoidLinks:
|
|
49
|
-
forcePageBreak:
|
|
50
|
-
keepTogether:
|
|
51
|
-
creator:
|
|
52
|
-
date:
|
|
53
|
-
imageResolution:
|
|
54
|
-
fileName:
|
|
55
|
-
forceProxy:
|
|
56
|
-
keywords:
|
|
57
|
-
landscape:
|
|
58
|
-
margin:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
left:
|
|
63
|
-
top:
|
|
64
|
-
right:
|
|
65
|
-
bottom:
|
|
47
|
+
o.propTypes = {
|
|
48
|
+
author: e.string,
|
|
49
|
+
avoidLinks: e.oneOfType([e.bool, e.string]),
|
|
50
|
+
forcePageBreak: e.string,
|
|
51
|
+
keepTogether: e.string,
|
|
52
|
+
creator: e.string,
|
|
53
|
+
date: e.instanceOf(Date),
|
|
54
|
+
imageResolution: e.number,
|
|
55
|
+
fileName: e.string,
|
|
56
|
+
forceProxy: e.bool,
|
|
57
|
+
keywords: e.string,
|
|
58
|
+
landscape: e.bool,
|
|
59
|
+
margin: e.oneOfType([
|
|
60
|
+
e.string,
|
|
61
|
+
e.number,
|
|
62
|
+
e.shape({
|
|
63
|
+
left: e.oneOfType([e.number, e.string]),
|
|
64
|
+
top: e.oneOfType([e.number, e.string]),
|
|
65
|
+
right: e.oneOfType([e.number, e.string]),
|
|
66
|
+
bottom: e.oneOfType([e.number, e.string])
|
|
66
67
|
})
|
|
67
68
|
]),
|
|
68
|
-
pageTemplate:
|
|
69
|
-
paperSize:
|
|
70
|
-
repeatHeaders:
|
|
71
|
-
scale:
|
|
72
|
-
proxyData:
|
|
73
|
-
proxyURL:
|
|
74
|
-
proxyTarget:
|
|
75
|
-
producer:
|
|
76
|
-
subject:
|
|
77
|
-
title:
|
|
69
|
+
pageTemplate: e.any,
|
|
70
|
+
paperSize: e.any,
|
|
71
|
+
repeatHeaders: e.bool,
|
|
72
|
+
scale: e.number,
|
|
73
|
+
proxyData: e.any,
|
|
74
|
+
proxyURL: e.string,
|
|
75
|
+
proxyTarget: e.string,
|
|
76
|
+
producer: e.string,
|
|
77
|
+
subject: e.string,
|
|
78
|
+
title: e.string
|
|
78
79
|
};
|
|
79
|
-
let n =
|
|
80
|
+
let n = o;
|
|
80
81
|
export {
|
|
81
82
|
n as PDFExport
|
|
82
83
|
};
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(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")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-drawing","@progress/kendo-file-saver","react-dom/server","@progress/kendo-react-common","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactPdf={},e.React,e.PropTypes,e.KendoDrawing,e.KendoFileSaver,e.ReactDOMServer,e.KendoReactCommon,e.ReactDOM)}(this,(function(e,t,r,o,s,n,i,a){"use strict";function p(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=p(t),c=p(n);const d=class extends l.Component{render(){return null}};d.propTypes={left:r.oneOfType([r.number,r.string]),top:r.oneOfType([r.number,r.string]),right:r.oneOfType([r.number,r.string]),bottom:r.oneOfType([r.number,r.string])};let h=d;const g=["bottom","left","right","top"];function u(e){const t=l.Children.toArray(e.children).find((e=>e&&e.type===h));return t?function(e){const t={};for(let r=0;r<g.length;r++){const o=g[r],s=e.props[o];void 0!==s&&(t[o]=s)}return t}(t):e.margin}let m=class{constructor(e,t,r,o,s={}){this.drawDOM=e,this.exportPDF=t,this.saveAs=r,this.domElement=o,this.options=s,this.convertPageTemplateToHtml=e=>`<span>${c.renderToStaticMarkup(l.createElement(this.options.pageTemplate,{pageNum:e.pageNum,totalPages:e.totalPages}))}</span>`}savePDF(e){const t=this.drawDOM(this.domElement,this.getDrawOptions()).then((e=>this.exportPDF(e,this.getPDFOptions()))).then((e=>this.saveAs(e,this.options.fileName||"export.pdf",this.getSaveOptions())));e&&t.then(e,e)}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||"KendoReact PDF Generator",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 f={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"$VERSION",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},y=class extends l.Component{constructor(e){super(e),this.rootElForPDF=null,i.validatePackage(f)}render(){return l.createElement("div",{ref:e=>{this.rootElForPDF=e}},this.props.children)}save(e){new m(o.drawDOM,o.exportPDF,s.saveAs,this.rootElForPDF,this.getOptions()).savePDF(e)}getOptions(){return Object.assign({},this.props,{margin:u(this.props)})}};y.propTypes={author:r.string,avoidLinks:r.oneOfType([r.bool,r.string]),forcePageBreak:r.string,keepTogether:r.string,creator:r.string,date:r.instanceOf(Date),imageResolution:r.number,fileName:r.string,forceProxy:r.bool,keywords:r.string,landscape:r.bool,margin:r.oneOfType([r.string,r.number,r.shape({left:r.oneOfType([r.number,r.string]),top:r.oneOfType([r.number,r.string]),right:r.oneOfType([r.number,r.string]),bottom:r.oneOfType([r.number,r.string])})]),pageTemplate:r.any,paperSize:r.any,repeatHeaders:r.bool,scale:r.number,proxyData:r.any,proxyURL:r.string,proxyTarget:r.string,producer:r.string,subject:r.string,title:r.string};let b=y;function T(e,t={},r){new m(o.drawDOM,o.exportPDF,s.saveAs,e,t).savePDF(r)}const O={},k=e=>String(e).trim().split(" "),v=e=>t=>((e,t)=>{const r=k(t);return!!k(e.className).find((e=>r.indexOf(e)>=0))})(t,e),w=e=>(O[e]||(O[e]=t=>String(t.nodeName).toLowerCase()===e.toLowerCase()),O[e]),D=(e,t,r=!0)=>{if(e){if(r&&t(e))return e;for(e=e.firstChild;e;){if(1===e.nodeType){const r=D(e,t);if(r)return r}e=e.nextSibling}}},P="k-grid-header",x="k-grid-footer",C=w("TABLE"),E=e=>e?"locked":"wrap";class F{constructor(e){this.element=e,this.list=D(e,v("k-grid-container"))}content(e){return D(this.list,v("k-grid-content"+(e?"-locked":"")))}header(e){return this.headerWrap=this.headerWrap||D(this.element,v(P)),D(this.headerWrap,v(`${P}-${E(e)}`))}footer(e){return this.footerWrap=this.footerWrap||D(this.element,v(x)),D(this.footerWrap,v(`${x}-${E(e)}`))}table(){return D(this.element,C)}}const N="k-first",R=(e,t)=>{const r=t.length;for(let o=0;o<r;o++)e.appendChild(t[o].cloneNode(!0))},S=e=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(e),t},L=e=>{const t=e.length,r=e[0].cloneNode(!0),o=r.rows.length;if(t>1)for(let s=0;s<o;s++)for(let o=1;o<t;o++)R(r.rows[s],e[o].rows[s].cells);return r},j=(e,t,r,o)=>{const s=document.createElement("table"),n=e[0].cloneNode(!0);for(let t=1;t<e.length;t++)R(n,e[t].querySelectorAll("col"));const i=L(t),a=L(r);if(i.className="k-grid-header",((e,t)=>{if(t.length>1&&e.rows.length>1)for(let r=1;r<e.rows.length;r++){const o=t[0].rows[r].cells.length,s=e.rows[r].cells[o];-1===String(s.className).indexOf(N)&&(s.className+=` ${N}`)}})(i,t),s.appendChild(n),s.appendChild(i),s.appendChild(a),o.length){const e=L(o);e.className="k-grid-footer",s.appendChild(e)}return S(s)},W=e=>{const t=new F(e),r=t.content();let o;if(r){const e=[r.querySelector("colgroup")],s=[t.header().querySelector("thead")],n=[r.querySelector("tbody")],i=t.footer(),a=i?[i.querySelector("tfoot")]:[];o=j(e,s,n,a)}else o=S(t.table().cloneNode(!0));return o};function A(e){return(t,r={},o)=>function(e,t,r={},o){let s;function n(){e(a(),r,i)}function i(){document.body.removeChild(s),s=void 0,o&&o()}function a(){s=document.createElement("div"),s.className="k-grid-pdf-export-element";const e=W(t);return s.appendChild(e),document.body.appendChild(s),e}n()}(e,t,r,o)}const q=class extends l.Component{constructor(e){super(e),this.state={show:!1},this.saveGridPDF=A(this.getSavePDF()),this.gridInnerWrapperRef=l.createRef()}componentDidUpdate(e,t){this.state.show&&this.state.show!==t.show&&this.saveGridPDF(this.gridInnerWrapperRef.current,Object.assign({},this.props,{margin:u(this.props)}),this.callback)}render(){return this.state.show&&a.createPortal(l.createElement("div",{style:{position:"absolute",left:"-5000px",top:"0px"}},l.createElement("div",{ref:this.gridInnerWrapperRef},this.prepareRawGridForExport(this.data))),document.body)}save(e,t){this.grid=this.getGrid(),this.columns=this.getCustomColumns(),this.data=e,this.callback=()=>{this.setState({show:!1}),t&&t()},this.setState({show:!0})}getSavePDF(){return T}getGrid(){return l.Children.toArray(this.props.children).find((e=>e&&"KendoReactGrid"===e.type.displayName))}getCustomColumns(){return l.Children.toArray(this.props.children).filter((e=>e&&"KendoReactGridColumn"===e.type.displayName))}prepareRawGridForExport(e){const t=e&&{data:e,total:e.length,pageSize:e.length,skip:0},r={style:Object.assign({},this.grid.props.style,{width:"1000px"})},o=Object.assign({},t,r);if(this.columns&&this.columns.length>0){const e=this.getGridNotColumnChildren(this.grid);return l.cloneElement(this.grid,o,this.columns.concat(e))}return l.cloneElement(this.grid,o)}getGridNotColumnChildren(e){return l.Children.toArray(e.props.children).filter((e=>e&&e.type&&"KendoReactGridColumn"!==e.type.displayName))}};q.propTypes={author:r.string,avoidLinks:r.oneOfType([r.bool,r.string]),forcePageBreak:r.string,keepTogether:r.string,creator:r.string,date:r.instanceOf(Date),imageResolution:r.number,fileName:r.string,forceProxy:r.bool,keywords:r.string,landscape:r.bool,margin:r.oneOfType([r.string,r.number,r.shape({left:r.oneOfType([r.number,r.string]),top:r.oneOfType([r.number,r.string]),right:r.oneOfType([r.number,r.string]),bottom:r.oneOfType([r.number,r.string])})]),pageTemplate:r.any,paperSize:r.any,repeatHeaders:r.bool,scale:r.number,proxyData:r.any,proxyURL:r.string,proxyTarget:r.string,producer:r.string,subject:r.string,title:r.string};let G=q;const K="k-grid-header",U="k-grid-footer",I=w("TABLE");class M{constructor(e){this.element=e,this.list=D(e,v("k-grid"))}content(){return D(this.list,v("k-grid"))}header(){return this.headerWrap=this.headerWrap||D(this.element,v(K)),D(this.headerWrap,v(`${K}`))}footer(){return this.footerWrap=this.footerWrap||D(this.element,v(U)),D(this.footerWrap,v(`${U}`))}table(){return D(this.element,I)}}const z=e=>{const t=new M(e),r=t.content();let o;const s=t.header();if(s.childNodes.length>1&&s.removeChild(s.childNodes[1]),s.childNodes[0].childNodes.forEach((e=>e.style.top=0)),r){const e=[r.querySelector("colgroup")],n=[s],i=[r.querySelector("tbody")],a=t.footer(),p=a?[a.querySelector("tfoot")]:[];o=j(e,n,i,p)}else o=S(t.table().cloneNode(!0));return o};function $(e){return(t,r={},o)=>function(e,t,r={},o){let s;function n(){e(a(),r,i)}function i(){document.body.removeChild(s),s=void 0,o&&o()}function a(){s=document.createElement("div"),s.className="k-treelist-pdf-export-element";const e=z(t);return s.appendChild(e),document.body.appendChild(s),s}n()}(e,t,r,o)}const B=class extends l.Component{constructor(e){super(e),this.state={show:!1},this.saveTreeListPDF=$(this.getSavePDF()),this.treeListInnerWrapperRef=l.createRef()}componentDidUpdate(e,t){this.state.show&&this.state.show!==t.show&&this.saveTreeListPDF(this.treeListInnerWrapperRef.current,Object.assign({},this.props,{margin:u(this.props)}),this.callback)}render(){return this.state.show&&a.createPortal(l.createElement("div",{style:{position:"absolute",left:"-5000px",top:"0px"}},l.createElement("div",{ref:this.treeListInnerWrapperRef},this.prepareRawTreeListForExport())),document.body)}save(e,t,r){this.treeList=this.getTreeList(),this.columns=t||[],this.data=e,this.callback=()=>{this.setState({show:!1}),r&&r()},this.setState({show:!0})}getSavePDF(){return T}getTreeList(){const e=this.props.children;if(e&&e.props.data&&e.props.columns)return this.props.children}prepareRawTreeListForExport(){const e=this.props.allPages&&this.data?{data:this.data,take:Number.MAX_VALUE,skip:0}:{},t={style:Object.assign({},this.treeList.props.style,{width:"1000px"})},r=Object.assign({},e,t);return this.columns&&this.columns.length>0?l.cloneElement(this.treeList,Object.assign({},r,{columns:this.columns})):l.cloneElement(this.treeList,r)}};B.propTypes={author:r.string,avoidLinks:r.oneOfType([r.bool,r.string]),forcePageBreak:r.string,keepTogether:r.string,creator:r.string,date:r.instanceOf(Date),imageResolution:r.number,fileName:r.string,forceProxy:r.bool,keywords:r.string,landscape:r.bool,margin:r.oneOfType([r.string,r.number,r.shape({left:r.oneOfType([r.number,r.string]),top:r.oneOfType([r.number,r.string]),right:r.oneOfType([r.number,r.string]),bottom:r.oneOfType([r.number,r.string])})]),pageTemplate:r.any,paperSize:r.any,repeatHeaders:r.bool,scale:r.number,proxyData:r.any,proxyURL:r.string,proxyTarget:r.string,producer:r.string,subject:r.string,title:r.string,allPages:r.bool};let H=B;e.GridPDFExport=G,e.KendoDrawingAdapter=m,e.PDFExport=b,e.PDFMargin=h,e.TreeListPDFExport=H,e.getPageMargin=u,e.savePDF=T}));
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(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")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-drawing","@progress/kendo-file-saver","react-dom/server","@progress/kendo-react-common","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactPdf={},e.React,e.PropTypes,e.KendoDrawing,e.KendoFileSaver,e.ReactDOMServer,e.KendoReactCommon,e.ReactDOM)}(this,(function(e,t,r,o,s,n,i,a){"use strict";function p(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=p(t),c=p(n);const h=class extends l.Component{render(){return null}};h.propTypes={left:r.oneOfType([r.number,r.string]),top:r.oneOfType([r.number,r.string]),right:r.oneOfType([r.number,r.string]),bottom:r.oneOfType([r.number,r.string])};let d=h;const g=["bottom","left","right","top"];function u(e){const t=l.Children.toArray(e.children).find((e=>e&&e.type===d));return t?function(e){const t={};for(let r=0;r<g.length;r++){const o=g[r],s=e.props[o];void 0!==s&&(t[o]=s)}return t}(t):e.margin}let m=class{constructor(e,t,r,o,s={}){this.drawDOM=e,this.exportPDF=t,this.saveAs=r,this.domElement=o,this.options=s,this.convertPageTemplateToHtml=e=>`<span>${c.renderToStaticMarkup(l.createElement(this.options.pageTemplate,{pageNum:e.pageNum,totalPages:e.totalPages}))}</span>`}savePDF(e){const t=this.drawDOM(this.domElement,this.getDrawOptions()).then((e=>this.exportPDF(e,this.getPDFOptions()))).then((e=>this.saveAs(e,this.options.fileName||"export.pdf",this.getSaveOptions())));e&&t.then(e,e)}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||"KendoReact PDF Generator",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 f={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"$VERSION",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},y=class extends l.Component{constructor(e){super(e),this.rootElForPDF=null,this.showLicenseWatermark=!1,this.showLicenseWatermark=!i.validatePackage(f,{component:"PDFExport"})}render(){return l.createElement("div",{ref:e=>{this.rootElForPDF=e}},this.props.children,this.showLicenseWatermark&&l.createElement(i.WatermarkOverlay,null))}save(e){new m(o.drawDOM,o.exportPDF,s.saveAs,this.rootElForPDF,this.getOptions()).savePDF(e)}getOptions(){return Object.assign({},this.props,{margin:u(this.props)})}};y.propTypes={author:r.string,avoidLinks:r.oneOfType([r.bool,r.string]),forcePageBreak:r.string,keepTogether:r.string,creator:r.string,date:r.instanceOf(Date),imageResolution:r.number,fileName:r.string,forceProxy:r.bool,keywords:r.string,landscape:r.bool,margin:r.oneOfType([r.string,r.number,r.shape({left:r.oneOfType([r.number,r.string]),top:r.oneOfType([r.number,r.string]),right:r.oneOfType([r.number,r.string]),bottom:r.oneOfType([r.number,r.string])})]),pageTemplate:r.any,paperSize:r.any,repeatHeaders:r.bool,scale:r.number,proxyData:r.any,proxyURL:r.string,proxyTarget:r.string,producer:r.string,subject:r.string,title:r.string};let b=y;function k(e,t={},r){new m(o.drawDOM,o.exportPDF,s.saveAs,e,t).savePDF(r)}const w={},T=e=>String(e).trim().split(" "),O=e=>t=>((e,t)=>{const r=T(t);return!!T(e.className).find((e=>r.indexOf(e)>=0))})(t,e),v=e=>(w[e]||(w[e]=t=>String(t.nodeName).toLowerCase()===e.toLowerCase()),w[e]),P=(e,t,r=!0)=>{if(e){if(r&&t(e))return e;for(e=e.firstChild;e;){if(1===e.nodeType){const r=P(e,t);if(r)return r}e=e.nextSibling}}},D="k-grid-header",x="k-grid-footer",E=v("TABLE"),C=e=>e?"locked":"wrap";class F{constructor(e){this.element=e,this.list=P(e,O("k-grid-container"))}content(e){return P(this.list,O("k-grid-content"+(e?"-locked":"")))}header(e){return this.headerWrap=this.headerWrap||P(this.element,O(D)),P(this.headerWrap,O(`${D}-${C(e)}`))}footer(e){return this.footerWrap=this.footerWrap||P(this.element,O(x)),P(this.footerWrap,O(`${x}-${C(e)}`))}table(){return P(this.element,E)}}const L="k-first",N=(e,t)=>{const r=t.length;for(let o=0;o<r;o++)e.appendChild(t[o].cloneNode(!0))},R=e=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(e),t},S=e=>{const t=e.length,r=e[0].cloneNode(!0),o=r.rows.length;if(t>1)for(let s=0;s<o;s++)for(let o=1;o<t;o++)N(r.rows[s],e[o].rows[s].cells);return r},W=(e,t,r,o)=>{const s=document.createElement("table"),n=e[0].cloneNode(!0);for(let t=1;t<e.length;t++)N(n,e[t].querySelectorAll("col"));const i=S(t),a=S(r);if(i.className="k-grid-header",((e,t)=>{if(t.length>1&&e.rows.length>1)for(let r=1;r<e.rows.length;r++){const o=t[0].rows[r].cells.length,s=e.rows[r].cells[o];-1===String(s.className).indexOf(L)&&(s.className+=` ${L}`)}})(i,t),s.appendChild(n),s.appendChild(i),s.appendChild(a),o.length){const e=S(o);e.className="k-grid-footer",s.appendChild(e)}return R(s)},j=e=>{const t=new F(e),r=t.content();let o;if(r){const e=[r.querySelector("colgroup")],s=[t.header().querySelector("thead")],n=[r.querySelector("tbody")],i=t.footer(),a=i?[i.querySelector("tfoot")]:[];o=W(e,s,n,a)}else o=R(t.table().cloneNode(!0));return o};function A(e){return(t,r={},o)=>function(e,t,r={},o){let s;function n(){e(a(),r,i)}function i(){document.body.removeChild(s),s=void 0,o&&o()}function a(){s=document.createElement("div"),s.className="k-grid-pdf-export-element";const e=j(t);return s.appendChild(e),document.body.appendChild(s),e}n()}(e,t,r,o)}const q=class extends l.Component{constructor(e){super(e),this.state={show:!1},this.showLicenseWatermark=!1,this.showLicenseWatermark=!i.validatePackage(f,{component:"GridPDFExport"}),this.saveGridPDF=A(this.getSavePDF()),this.gridInnerWrapperRef=l.createRef()}componentDidUpdate(e,t){this.state.show&&this.state.show!==t.show&&this.saveGridPDF(this.gridInnerWrapperRef.current,Object.assign({},this.props,{margin:u(this.props)}),this.callback)}render(){return l.createElement(l.Fragment,null,this.state.show&&a.createPortal(l.createElement("div",{style:{position:"absolute",left:"-5000px",top:"0px"}},l.createElement("div",{ref:this.gridInnerWrapperRef},this.prepareRawGridForExport(this.data))),document.body),this.showLicenseWatermark&&l.createElement(i.WatermarkOverlay,null))}save(e,t){this.grid=this.getGrid(),this.columns=this.getCustomColumns(),this.data=e,this.callback=()=>{this.setState({show:!1}),t&&t()},this.setState({show:!0})}getSavePDF(){return k}getGrid(){return l.Children.toArray(this.props.children).find((e=>e&&"KendoReactGrid"===e.type.displayName))}getCustomColumns(){return l.Children.toArray(this.props.children).filter((e=>e&&"KendoReactGridColumn"===e.type.displayName))}prepareRawGridForExport(e){const t=e&&{data:e,total:e.length,pageSize:e.length,skip:0},r={style:Object.assign({},this.grid.props.style,{width:"1000px"})},o=Object.assign({},t,r);if(this.columns&&this.columns.length>0){const e=this.getGridNotColumnChildren(this.grid);return l.cloneElement(this.grid,o,this.columns.concat(e))}return l.cloneElement(this.grid,o)}getGridNotColumnChildren(e){return l.Children.toArray(e.props.children).filter((e=>e&&e.type&&"KendoReactGridColumn"!==e.type.displayName))}};q.propTypes={author:r.string,avoidLinks:r.oneOfType([r.bool,r.string]),forcePageBreak:r.string,keepTogether:r.string,creator:r.string,date:r.instanceOf(Date),imageResolution:r.number,fileName:r.string,forceProxy:r.bool,keywords:r.string,landscape:r.bool,margin:r.oneOfType([r.string,r.number,r.shape({left:r.oneOfType([r.number,r.string]),top:r.oneOfType([r.number,r.string]),right:r.oneOfType([r.number,r.string]),bottom:r.oneOfType([r.number,r.string])})]),pageTemplate:r.any,paperSize:r.any,repeatHeaders:r.bool,scale:r.number,proxyData:r.any,proxyURL:r.string,proxyTarget:r.string,producer:r.string,subject:r.string,title:r.string};let G=q;const K="k-grid-header",U="k-grid-footer",I=v("TABLE");class M{constructor(e){this.element=e,this.list=P(e,O("k-grid"))}content(){return P(this.list,O("k-grid"))}header(){return this.headerWrap=this.headerWrap||P(this.element,O(K)),P(this.headerWrap,O(`${K}`))}footer(){return this.footerWrap=this.footerWrap||P(this.element,O(U)),P(this.footerWrap,O(`${U}`))}table(){return P(this.element,I)}}const z=e=>{const t=new M(e),r=t.content();let o;const s=t.header();if(s.childNodes.length>1&&s.removeChild(s.childNodes[1]),s.childNodes[0].childNodes.forEach((e=>e.style.top=0)),r){const e=[r.querySelector("colgroup")],n=[s],i=[r.querySelector("tbody")],a=t.footer(),p=a?[a.querySelector("tfoot")]:[];o=W(e,n,i,p)}else o=R(t.table().cloneNode(!0));return o};function $(e){return(t,r={},o)=>function(e,t,r={},o){let s;function n(){e(a(),r,i)}function i(){document.body.removeChild(s),s=void 0,o&&o()}function a(){s=document.createElement("div"),s.className="k-treelist-pdf-export-element";const e=z(t);return s.appendChild(e),document.body.appendChild(s),s}n()}(e,t,r,o)}const B=class extends l.Component{constructor(e){super(e),this.state={show:!1},this.showLicenseWatermark=!1,this.showLicenseWatermark=!i.validatePackage(f,{component:"TreeListPDFExport"}),this.saveTreeListPDF=$(this.getSavePDF()),this.treeListInnerWrapperRef=l.createRef()}componentDidUpdate(e,t){this.state.show&&this.state.show!==t.show&&this.saveTreeListPDF(this.treeListInnerWrapperRef.current,Object.assign({},this.props,{margin:u(this.props)}),this.callback)}render(){return l.createElement(l.Fragment,null,this.state.show&&a.createPortal(l.createElement("div",{style:{position:"absolute",left:"-5000px",top:"0px"}},l.createElement("div",{ref:this.treeListInnerWrapperRef},this.prepareRawTreeListForExport())),document.body),this.showLicenseWatermark&&l.createElement(i.WatermarkOverlay,null))}save(e,t,r){this.treeList=this.getTreeList(),this.columns=t||[],this.data=e,this.callback=()=>{this.setState({show:!1}),r&&r()},this.setState({show:!0})}getSavePDF(){return k}getTreeList(){const e=this.props.children;if(e&&e.props.data&&e.props.columns)return this.props.children}prepareRawTreeListForExport(){const e=this.props.allPages&&this.data?{data:this.data,take:Number.MAX_VALUE,skip:0}:{},t={style:Object.assign({},this.treeList.props.style,{width:"1000px"})},r=Object.assign({},e,t);return this.columns&&this.columns.length>0?l.cloneElement(this.treeList,Object.assign({},r,{columns:this.columns})):l.cloneElement(this.treeList,r)}};B.propTypes={author:r.string,avoidLinks:r.oneOfType([r.bool,r.string]),forcePageBreak:r.string,keepTogether:r.string,creator:r.string,date:r.instanceOf(Date),imageResolution:r.number,fileName:r.string,forceProxy:r.bool,keywords:r.string,landscape:r.bool,margin:r.oneOfType([r.string,r.number,r.shape({left:r.oneOfType([r.number,r.string]),top:r.oneOfType([r.number,r.string]),right:r.oneOfType([r.number,r.string]),bottom:r.oneOfType([r.number,r.string])})]),pageTemplate:r.any,paperSize:r.any,repeatHeaders:r.bool,scale:r.number,proxyData:r.any,proxyURL:r.string,proxyTarget:r.string,producer:r.string,subject:r.string,title:r.string,allPages:r.bool};let H=B;e.GridPDFExport=G,e.KendoDrawingAdapter=m,e.PDFExport=b,e.PDFMargin=d,e.TreeListPDFExport=H,e.getPageMargin=u,e.savePDF=k}));
|
package/grid/GridPDFExport.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),e=require("prop-types"),u=require("../getPageMargin.js"),d=require("../savePDF.js"),h=require("./provideSaveGridPDF.js"),m=require("react-dom"),c=require("@progress/kendo-react-common"),y=require("../package-metadata.js");function f(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>n[r]})}}return t.default=n,Object.freeze(t)}const s=f(g),a=class a extends s.Component{constructor(t){super(t),this.state={show:!1},this.showLicenseWatermark=!1,this.showLicenseWatermark=!c.validatePackage(y.packageMetadata,{component:"GridPDFExport"}),this.saveGridPDF=h.provideSaveGridPDF(this.getSavePDF()),this.gridInnerWrapperRef=s.createRef()}componentDidUpdate(t,r){this.state.show&&this.state.show!==r.show&&this.saveGridPDF(this.gridInnerWrapperRef.current,Object.assign({},this.props,{margin:u.getPageMargin(this.props)}),this.callback)}render(){return s.createElement(s.Fragment,null,this.state.show&&m.createPortal(s.createElement("div",{style:{position:"absolute",left:"-5000px",top:"0px"}},s.createElement("div",{ref:this.gridInnerWrapperRef},this.prepareRawGridForExport(this.data))),document.body),this.showLicenseWatermark&&s.createElement(c.WatermarkOverlay,null))}save(t,r){this.grid=this.getGrid(),this.columns=this.getCustomColumns(),this.data=t,this.callback=()=>{this.setState({show:!1}),r&&r()},this.setState({show:!0})}getSavePDF(){return d.savePDF}getGrid(){return s.Children.toArray(this.props.children).find(t=>t&&t.type.displayName==="KendoReactGrid")}getCustomColumns(){return s.Children.toArray(this.props.children).filter(t=>t&&t.type.displayName==="KendoReactGridColumn")}prepareRawGridForExport(t){const r=t&&{data:t,total:t.length,pageSize:t.length,skip:0},i={style:Object.assign({},this.grid.props.style,{width:"1000px"})},p=Object.assign({},r,i);if(this.columns&&this.columns.length>0){const l=this.getGridNotColumnChildren(this.grid);return s.cloneElement(this.grid,p,this.columns.concat(l))}return s.cloneElement(this.grid,p)}getGridNotColumnChildren(t){return s.Children.toArray(t.props.children).filter(r=>r&&r.type&&r.type.displayName!=="KendoReactGridColumn")}};a.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};let o=a;exports.GridPDFExport=o;
|
package/grid/GridPDFExport.mjs
CHANGED
|
@@ -5,25 +5,27 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as r from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
|
-
import { getPageMargin as
|
|
11
|
-
import { savePDF as
|
|
12
|
-
import { provideSaveGridPDF as
|
|
13
|
-
import { createPortal as
|
|
14
|
-
|
|
10
|
+
import { getPageMargin as l } from "../getPageMargin.mjs";
|
|
11
|
+
import { savePDF as m } from "../savePDF.mjs";
|
|
12
|
+
import { provideSaveGridPDF as h } from "./provideSaveGridPDF.mjs";
|
|
13
|
+
import { createPortal as g } from "react-dom";
|
|
14
|
+
import { validatePackage as c, WatermarkOverlay as d } from "@progress/kendo-react-common";
|
|
15
|
+
import { packageMetadata as u } from "../package-metadata.mjs";
|
|
16
|
+
const i = class i extends r.Component {
|
|
15
17
|
constructor(t) {
|
|
16
18
|
super(t), this.state = {
|
|
17
19
|
show: !1
|
|
18
|
-
}, this.saveGridPDF =
|
|
20
|
+
}, this.showLicenseWatermark = !1, this.showLicenseWatermark = !c(u, { component: "GridPDFExport" }), this.saveGridPDF = h(this.getSavePDF()), this.gridInnerWrapperRef = r.createRef();
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* @hidden
|
|
22
24
|
*/
|
|
23
|
-
componentDidUpdate(t,
|
|
24
|
-
this.state.show && this.state.show !==
|
|
25
|
+
componentDidUpdate(t, s) {
|
|
26
|
+
this.state.show && this.state.show !== s.show && this.saveGridPDF(
|
|
25
27
|
this.gridInnerWrapperRef.current,
|
|
26
|
-
Object.assign({}, this.props, { margin:
|
|
28
|
+
Object.assign({}, this.props, { margin: l(this.props) }),
|
|
27
29
|
this.callback
|
|
28
30
|
);
|
|
29
31
|
}
|
|
@@ -31,8 +33,8 @@ const i = class i extends s.Component {
|
|
|
31
33
|
* @hidden
|
|
32
34
|
*/
|
|
33
35
|
render() {
|
|
34
|
-
return this.state.show &&
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ r.createElement(r.Fragment, null, this.state.show && g(
|
|
37
|
+
/* @__PURE__ */ r.createElement(
|
|
36
38
|
"div",
|
|
37
39
|
{
|
|
38
40
|
style: {
|
|
@@ -41,10 +43,10 @@ const i = class i extends s.Component {
|
|
|
41
43
|
top: "0px"
|
|
42
44
|
}
|
|
43
45
|
},
|
|
44
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ r.createElement("div", { ref: this.gridInnerWrapperRef }, this.prepareRawGridForExport(this.data))
|
|
45
47
|
),
|
|
46
48
|
document.body
|
|
47
|
-
);
|
|
49
|
+
), this.showLicenseWatermark && /* @__PURE__ */ r.createElement(d, null));
|
|
48
50
|
}
|
|
49
51
|
/* eslint-disable max-len */
|
|
50
52
|
/**
|
|
@@ -54,35 +56,35 @@ const i = class i extends s.Component {
|
|
|
54
56
|
* @param callback - The callback that will be executed after the PDF is saved.
|
|
55
57
|
*/
|
|
56
58
|
// tslint:enable:max-line-length
|
|
57
|
-
save(t,
|
|
59
|
+
save(t, s) {
|
|
58
60
|
this.grid = this.getGrid(), this.columns = this.getCustomColumns(), this.data = t, this.callback = () => {
|
|
59
|
-
this.setState({ show: !1 }),
|
|
61
|
+
this.setState({ show: !1 }), s && s();
|
|
60
62
|
}, this.setState({ show: !0 });
|
|
61
63
|
}
|
|
62
64
|
getSavePDF() {
|
|
63
|
-
return
|
|
65
|
+
return m;
|
|
64
66
|
}
|
|
65
67
|
getGrid() {
|
|
66
|
-
return
|
|
68
|
+
return r.Children.toArray(this.props.children).find(
|
|
67
69
|
(t) => t && t.type.displayName === "KendoReactGrid"
|
|
68
70
|
);
|
|
69
71
|
}
|
|
70
72
|
getCustomColumns() {
|
|
71
|
-
return
|
|
73
|
+
return r.Children.toArray(this.props.children).filter(
|
|
72
74
|
(t) => t && t.type.displayName === "KendoReactGridColumn"
|
|
73
75
|
);
|
|
74
76
|
}
|
|
75
77
|
prepareRawGridForExport(t) {
|
|
76
|
-
const
|
|
78
|
+
const s = t && { data: t, total: t.length, pageSize: t.length, skip: 0 }, a = { style: Object.assign({}, this.grid.props.style, { width: "1000px" }) }, o = Object.assign({}, s, a);
|
|
77
79
|
if (this.columns && this.columns.length > 0) {
|
|
78
80
|
const p = this.getGridNotColumnChildren(this.grid);
|
|
79
|
-
return
|
|
81
|
+
return r.cloneElement(this.grid, o, this.columns.concat(p));
|
|
80
82
|
}
|
|
81
|
-
return
|
|
83
|
+
return r.cloneElement(this.grid, o);
|
|
82
84
|
}
|
|
83
85
|
getGridNotColumnChildren(t) {
|
|
84
|
-
return
|
|
85
|
-
(
|
|
86
|
+
return r.Children.toArray(t.props.children).filter(
|
|
87
|
+
(s) => s && s.type && s.type.displayName !== "KendoReactGridColumn"
|
|
86
88
|
);
|
|
87
89
|
}
|
|
88
90
|
};
|
package/index.d.mts
CHANGED
|
@@ -88,6 +88,7 @@ export declare class GridPDFExport extends React_2.Component<GridPDFExportProps,
|
|
|
88
88
|
readonly state: {
|
|
89
89
|
show: boolean;
|
|
90
90
|
};
|
|
91
|
+
private readonly showLicenseWatermark;
|
|
91
92
|
constructor(props: any);
|
|
92
93
|
/**
|
|
93
94
|
* @hidden
|
|
@@ -96,7 +97,7 @@ export declare class GridPDFExport extends React_2.Component<GridPDFExportProps,
|
|
|
96
97
|
/**
|
|
97
98
|
* @hidden
|
|
98
99
|
*/
|
|
99
|
-
render():
|
|
100
|
+
render(): JSX_2.Element;
|
|
100
101
|
/**
|
|
101
102
|
* Saves the content of the Grid as a PDF file.
|
|
102
103
|
*
|
|
@@ -193,6 +194,7 @@ export declare class PDFExport extends React_2.Component<PDFExportProps, {}> {
|
|
|
193
194
|
title: default_2.Requireable<string>;
|
|
194
195
|
};
|
|
195
196
|
private rootElForPDF;
|
|
197
|
+
private readonly showLicenseWatermark;
|
|
196
198
|
constructor(props: PDFExportProps);
|
|
197
199
|
/**
|
|
198
200
|
* @hidden
|
|
@@ -473,6 +475,7 @@ export declare class TreeListPDFExport extends React_2.Component<TreeListPDFExpo
|
|
|
473
475
|
readonly state: {
|
|
474
476
|
show: boolean;
|
|
475
477
|
};
|
|
478
|
+
private readonly showLicenseWatermark;
|
|
476
479
|
constructor(props: any);
|
|
477
480
|
/**
|
|
478
481
|
* @hidden
|
|
@@ -481,7 +484,7 @@ export declare class TreeListPDFExport extends React_2.Component<TreeListPDFExpo
|
|
|
481
484
|
/**
|
|
482
485
|
* @hidden
|
|
483
486
|
*/
|
|
484
|
-
render():
|
|
487
|
+
render(): JSX_2.Element;
|
|
485
488
|
/**
|
|
486
489
|
* Saves the content of the TreeList as a PDF file.
|
|
487
490
|
*
|
package/index.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export declare class GridPDFExport extends React_2.Component<GridPDFExportProps,
|
|
|
88
88
|
readonly state: {
|
|
89
89
|
show: boolean;
|
|
90
90
|
};
|
|
91
|
+
private readonly showLicenseWatermark;
|
|
91
92
|
constructor(props: any);
|
|
92
93
|
/**
|
|
93
94
|
* @hidden
|
|
@@ -96,7 +97,7 @@ export declare class GridPDFExport extends React_2.Component<GridPDFExportProps,
|
|
|
96
97
|
/**
|
|
97
98
|
* @hidden
|
|
98
99
|
*/
|
|
99
|
-
render():
|
|
100
|
+
render(): JSX_2.Element;
|
|
100
101
|
/**
|
|
101
102
|
* Saves the content of the Grid as a PDF file.
|
|
102
103
|
*
|
|
@@ -193,6 +194,7 @@ export declare class PDFExport extends React_2.Component<PDFExportProps, {}> {
|
|
|
193
194
|
title: default_2.Requireable<string>;
|
|
194
195
|
};
|
|
195
196
|
private rootElForPDF;
|
|
197
|
+
private readonly showLicenseWatermark;
|
|
196
198
|
constructor(props: PDFExportProps);
|
|
197
199
|
/**
|
|
198
200
|
* @hidden
|
|
@@ -473,6 +475,7 @@ export declare class TreeListPDFExport extends React_2.Component<TreeListPDFExpo
|
|
|
473
475
|
readonly state: {
|
|
474
476
|
show: boolean;
|
|
475
477
|
};
|
|
478
|
+
private readonly showLicenseWatermark;
|
|
476
479
|
constructor(props: any);
|
|
477
480
|
/**
|
|
478
481
|
* @hidden
|
|
@@ -481,7 +484,7 @@ export declare class TreeListPDFExport extends React_2.Component<TreeListPDFExpo
|
|
|
481
484
|
/**
|
|
482
485
|
* @hidden
|
|
483
486
|
*/
|
|
484
|
-
render():
|
|
487
|
+
render(): JSX_2.Element;
|
|
485
488
|
/**
|
|
486
489
|
* Saves the content of the TreeList as a PDF file.
|
|
487
490
|
*
|
package/package-metadata.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1741180427,version:"10.0.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,8 +10,8 @@ const e = {
|
|
|
10
10
|
productName: "KendoReact",
|
|
11
11
|
productCode: "KENDOUIREACT",
|
|
12
12
|
productCodes: ["KENDOUIREACT"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "
|
|
13
|
+
publishDate: 1741180427,
|
|
14
|
+
version: "10.0.0-develop.1",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
|
17
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-pdf",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-develop.1",
|
|
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",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@progress/kendo-drawing": "^1.21.2",
|
|
29
29
|
"@progress/kendo-file-saver": "^1.0.1",
|
|
30
30
|
"@progress/kendo-licensing": "^1.5.0",
|
|
31
|
-
"@progress/kendo-react-common": "
|
|
31
|
+
"@progress/kendo-react-common": "10.0.0-develop.1",
|
|
32
32
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
33
33
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
34
34
|
},
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"package": {
|
|
55
55
|
"productName": "KendoReact",
|
|
56
56
|
"productCode": "KENDOUIREACT",
|
|
57
|
-
"publishDate":
|
|
57
|
+
"publishDate": 1741180427,
|
|
58
58
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
59
59
|
}
|
|
60
60
|
},
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),e=require("prop-types"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),e=require("prop-types"),l=require("../getPageMargin.js"),h=require("../savePDF.js"),u=require("./provideSaveTreeListPDF.js"),g=require("react-dom"),m=require("../package-metadata.js"),c=require("@progress/kendo-react-common");function d(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const r in i)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>i[r]})}}return t.default=i,Object.freeze(t)}const s=d(p),o=class o extends s.Component{constructor(t){super(t),this.state={show:!1},this.showLicenseWatermark=!1,this.showLicenseWatermark=!c.validatePackage(m.packageMetadata,{component:"TreeListPDFExport"}),this.saveTreeListPDF=u.provideSaveTreeListPDF(this.getSavePDF()),this.treeListInnerWrapperRef=s.createRef()}componentDidUpdate(t,r){this.state.show&&this.state.show!==r.show&&this.saveTreeListPDF(this.treeListInnerWrapperRef.current,Object.assign({},this.props,{margin:l.getPageMargin(this.props)}),this.callback)}render(){return s.createElement(s.Fragment,null,this.state.show&&g.createPortal(s.createElement("div",{style:{position:"absolute",left:"-5000px",top:"0px"}},s.createElement("div",{ref:this.treeListInnerWrapperRef},this.prepareRawTreeListForExport())),document.body),this.showLicenseWatermark&&s.createElement(c.WatermarkOverlay,null))}save(t,r,a){this.treeList=this.getTreeList(),this.columns=r||[],this.data=t,this.callback=()=>{this.setState({show:!1}),a&&a()},this.setState({show:!0})}getSavePDF(){return h.savePDF}getTreeList(){const t=this.props.children;if(t&&t.props.data&&t.props.columns)return this.props.children}prepareRawTreeListForExport(){const t=this.props.allPages&&this.data?{data:this.data,take:Number.MAX_VALUE,skip:0}:{},r={style:Object.assign({},this.treeList.props.style,{width:"1000px"})},a=Object.assign({},t,r);return this.columns&&this.columns.length>0?s.cloneElement(this.treeList,Object.assign({},a,{columns:this.columns})):s.cloneElement(this.treeList,a)}};o.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};let n=o;exports.TreeListPDFExport=n;
|
|
@@ -7,15 +7,17 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as s from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
|
-
import { getPageMargin as
|
|
10
|
+
import { getPageMargin as n } from "../getPageMargin.mjs";
|
|
11
11
|
import { savePDF as p } from "../savePDF.mjs";
|
|
12
12
|
import { provideSaveTreeListPDF as h } from "./provideSaveTreeListPDF.mjs";
|
|
13
|
-
import { createPortal as
|
|
13
|
+
import { createPortal as m } from "react-dom";
|
|
14
|
+
import { packageMetadata as l } from "../package-metadata.mjs";
|
|
15
|
+
import { validatePackage as c, WatermarkOverlay as g } from "@progress/kendo-react-common";
|
|
14
16
|
const o = class o extends s.Component {
|
|
15
17
|
constructor(t) {
|
|
16
18
|
super(t), this.state = {
|
|
17
19
|
show: !1
|
|
18
|
-
}, this.saveTreeListPDF = h(this.getSavePDF()), this.treeListInnerWrapperRef = s.createRef();
|
|
20
|
+
}, this.showLicenseWatermark = !1, this.showLicenseWatermark = !c(l, { component: "TreeListPDFExport" }), this.saveTreeListPDF = h(this.getSavePDF()), this.treeListInnerWrapperRef = s.createRef();
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* @hidden
|
|
@@ -23,7 +25,7 @@ const o = class o extends s.Component {
|
|
|
23
25
|
componentDidUpdate(t, r) {
|
|
24
26
|
this.state.show && this.state.show !== r.show && this.saveTreeListPDF(
|
|
25
27
|
this.treeListInnerWrapperRef.current,
|
|
26
|
-
Object.assign({}, this.props, { margin:
|
|
28
|
+
Object.assign({}, this.props, { margin: n(this.props) }),
|
|
27
29
|
this.callback
|
|
28
30
|
);
|
|
29
31
|
}
|
|
@@ -31,7 +33,7 @@ const o = class o extends s.Component {
|
|
|
31
33
|
* @hidden
|
|
32
34
|
*/
|
|
33
35
|
render() {
|
|
34
|
-
return this.state.show &&
|
|
36
|
+
return /* @__PURE__ */ s.createElement(s.Fragment, null, this.state.show && m(
|
|
35
37
|
/* @__PURE__ */ s.createElement(
|
|
36
38
|
"div",
|
|
37
39
|
{
|
|
@@ -44,7 +46,7 @@ const o = class o extends s.Component {
|
|
|
44
46
|
/* @__PURE__ */ s.createElement("div", { ref: this.treeListInnerWrapperRef }, this.prepareRawTreeListForExport())
|
|
45
47
|
),
|
|
46
48
|
document.body
|
|
47
|
-
);
|
|
49
|
+
), this.showLicenseWatermark && /* @__PURE__ */ s.createElement(g, null));
|
|
48
50
|
}
|
|
49
51
|
/* eslint-disable max-len */
|
|
50
52
|
/**
|
|
@@ -107,7 +109,7 @@ o.propTypes = {
|
|
|
107
109
|
title: e.string,
|
|
108
110
|
allPages: e.bool
|
|
109
111
|
};
|
|
110
|
-
let
|
|
112
|
+
let a = o;
|
|
111
113
|
export {
|
|
112
|
-
|
|
114
|
+
a as TreeListPDFExport
|
|
113
115
|
};
|