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