@progress/kendo-react-pdf 7.0.0-develop.8 → 7.0.0
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/dist/cdn/js/kendo-react-pdf.js +1 -1
- package/index.js +1 -1
- package/index.mjs +2 -1
- package/package.json +3 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
(function(c,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("prop-types"),require("@progress/kendo-drawing"),require("@progress/kendo-file-saver"),require("react-dom/server"),require("@progress/kendo-licensing"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","@progress/kendo-drawing","@progress/kendo-file-saver","react-dom/server","@progress/kendo-licensing","react-dom"],m):(c=typeof globalThis<"u"?globalThis:c||self,m(c.KendoReactPdf={},c.React,c.PropTypes,c.KendoDrawing,c.KendoFileSaver,c.ReactDOMServer,c.KendoLicensing,c.ReactDOM))})(this,function(c,m,X,T,A,J,Y,Z){"use strict";function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>r[n]})}}return t.default=r,Object.freeze(t)}const u=f(m),e=f(X),ee=f(J),R=f(Y),_=f(Z);class D extends u.Component{render(){return null}}D.propTypes={left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])};const G=["bottom","left","right","top"];function P(r){const t=u.Children.toArray(r.children).find(n=>n&&n.type===D);return t?te(t):r.margin}function te(r){const t={};for(let n=0;n<G.length;n++){const o=G[n],s=r.props[o];s!==void 0&&(t[o]=s)}return t}const re="export.pdf",ne="KendoReact PDF Generator";class O{constructor(t,n,o,s,i={}){this.drawDOM=t,this.exportPDF=n,this.saveAs=o,this.domElement=s,this.options=i,this.convertPageTemplateToHtml=p=>`<span>${ee.renderToStaticMarkup(u.createElement(this.options.pageTemplate,{pageNum:p.pageNum,totalPages:p.totalPages}))}</span>`}savePDF(t){const n=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||re,this.getSaveOptions()));t&&n.then(t,t)}getDrawOptions(){return{avoidLinks:this.options.avoidLinks,forcePageBreak:this.options.forcePageBreak,keepTogether:this.options.keepTogether,margin:this.options.margin,paperSize:this.options.paperSize,landscape:this.options.landscape,repeatHeaders:this.options.repeatHeaders,scale:this.options.scale,template:this.options.pageTemplate&&this.convertPageTemplateToHtml}}getPDFOptions(){return{author:this.options.author,creator:this.options.creator||ne,date:this.options.date,imgDPI:this.options.imageResolution,keywords:this.options.keywords,landscape:this.options.landscape,margin:this.options.margin,multiPage:!0,paperSize:this.options.paperSize,producer:this.options.producer,subject:this.options.subject,title:this.options.title}}getSaveOptions(){return{forceProxy:this.options.forceProxy,proxyData:this.options.proxyData,proxyTarget:this.options.proxyTarget,proxyURL:this.options.proxyURL}}}const C={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class M extends u.Component{constructor(t){if(super(t),this.rootElForPDF=null,typeof R<"u")R.validatePackage(C);else{let n=`License activation failed for ${C.name}
|
|
5
|
+
(function(c,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("prop-types"),require("@progress/kendo-drawing"),require("@progress/kendo-file-saver"),require("react-dom/server"),require("@progress/kendo-licensing"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","@progress/kendo-drawing","@progress/kendo-file-saver","react-dom/server","@progress/kendo-licensing","react-dom"],m):(c=typeof globalThis<"u"?globalThis:c||self,m(c.KendoReactPdf={},c.React,c.PropTypes,c.KendoDrawing,c.KendoFileSaver,c.ReactDOMServer,c.KendoLicensing,c.ReactDOM))})(this,function(c,m,X,T,A,J,Y,Z){"use strict";"use client";function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>r[n]})}}return t.default=r,Object.freeze(t)}const u=f(m),e=f(X),ee=f(J),R=f(Y),_=f(Z);class D extends u.Component{render(){return null}}D.propTypes={left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])};const G=["bottom","left","right","top"];function P(r){const t=u.Children.toArray(r.children).find(n=>n&&n.type===D);return t?te(t):r.margin}function te(r){const t={};for(let n=0;n<G.length;n++){const o=G[n],s=r.props[o];s!==void 0&&(t[o]=s)}return t}const re="export.pdf",ne="KendoReact PDF Generator";class O{constructor(t,n,o,s,i={}){this.drawDOM=t,this.exportPDF=n,this.saveAs=o,this.domElement=s,this.options=i,this.convertPageTemplateToHtml=p=>`<span>${ee.renderToStaticMarkup(u.createElement(this.options.pageTemplate,{pageNum:p.pageNum,totalPages:p.totalPages}))}</span>`}savePDF(t){const n=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||re,this.getSaveOptions()));t&&n.then(t,t)}getDrawOptions(){return{avoidLinks:this.options.avoidLinks,forcePageBreak:this.options.forcePageBreak,keepTogether:this.options.keepTogether,margin:this.options.margin,paperSize:this.options.paperSize,landscape:this.options.landscape,repeatHeaders:this.options.repeatHeaders,scale:this.options.scale,template:this.options.pageTemplate&&this.convertPageTemplateToHtml}}getPDFOptions(){return{author:this.options.author,creator:this.options.creator||ne,date:this.options.date,imgDPI:this.options.imageResolution,keywords:this.options.keywords,landscape:this.options.landscape,margin:this.options.margin,multiPage:!0,paperSize:this.options.paperSize,producer:this.options.producer,subject:this.options.subject,title:this.options.title}}getSaveOptions(){return{forceProxy:this.options.forceProxy,proxyData:this.options.proxyData,proxyTarget:this.options.proxyTarget,proxyURL:this.options.proxyURL}}}const C={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class M extends u.Component{constructor(t){if(super(t),this.rootElForPDF=null,typeof R<"u")R.validatePackage(C);else{let n=`License activation failed for ${C.name}
|
|
6
6
|
`;n+=`The @progress/kendo-licensing script is not loaded.
|
|
7
7
|
`,n+=`See ${C.licensingDocsUrl} for more information.
|
|
8
8
|
`,console.warn(n)}}render(){return u.createElement("div",{ref:t=>{this.rootElForPDF=t}},this.props.children)}save(t){new O(T.drawDOM,T.exportPDF,A.saveAs,this.rootElForPDF,this.getOptions()).savePDF(t)}getOptions(){return Object.assign({},this.props,{margin:P(this.props)})}}M.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};function v(r,t={},n){new O(T.drawDOM,T.exportPDF,A.saveAs,r,t).savePDF(n)}const E={},$=r=>String(r).trim().split(" "),oe=(r,t)=>{const n=$(t);return!!$(r.className).find(o=>n.indexOf(o)>=0)},g=r=>t=>oe(t,r),j=r=>(E[r]||(E[r]=t=>String(t.nodeName).toLowerCase()===r.toLowerCase()),E[r]),d=(r,t,n=!0)=>{if(r){if(n&&t(r))return r;for(r=r.firstChild;r;){if(r.nodeType===1){const o=d(r,t);if(o)return o}r=r.nextSibling}}},q="k-grid-header",W="k-grid-footer",se=j("TABLE"),K=r=>r?"locked":"wrap";let ie=class{constructor(t){this.element=t,this.list=d(t,g("k-grid-container"))}content(t){return d(this.list,g(`k-grid-content${t?"-locked":""}`))}header(t){return this.headerWrap=this.headerWrap||d(this.element,g(q)),d(this.headerWrap,g(`${q}-${K(t)}`))}footer(t){return this.footerWrap=this.footerWrap||d(this.element,g(W)),d(this.footerWrap,g(`${W}-${K(t)}`))}table(){return d(this.element,se)}};const B="k-first",ae="k-grid-header",pe="k-grid-footer",I=(r,t)=>{const n=t.length;for(let o=0;o<n;o++)r.appendChild(t[o].cloneNode(!0))},x=r=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(r),t},S=r=>{const t=r.length,n=r[0].cloneNode(!0),o=n.rows.length;if(t>1)for(let s=0;s<o;s++)for(let i=1;i<t;i++)I(n.rows[s],r[i].rows[s].cells);return n},ce=(r,t)=>{if(t.length>1&&r.rows.length>1)for(let n=1;n<r.rows.length;n++){const o=t[0].rows[n].cells.length,s=r.rows[n].cells[o];String(s.className).indexOf(B)===-1&&(s.className+=` ${B}`)}},U=(r,t,n,o)=>{const s=document.createElement("table"),i=r[0].cloneNode(!0);for(let a=1;a<r.length;a++)I(i,r[a].querySelectorAll("col"));const p=S(t),l=S(n);if(p.className=ae,ce(p,t),s.appendChild(i),s.appendChild(p),s.appendChild(l),o.length){const a=S(o);a.className=pe,s.appendChild(a)}return x(s)},le=r=>{const t=new ie(r),n=t.content();let o;if(n){const s=[n.querySelector("colgroup")],i=[t.header().querySelector("thead")],p=[n.querySelector("tbody")],l=t.footer(),a=l?[l.querySelector("tfoot")]:[];o=U(s,i,p,a)}else o=x(t.table().cloneNode(!0));return o};function de(r){return(t,n={},o,s,i)=>ue(r,t,n,o,s,i)}function ue(r,t,n={},o,s,i){let p,l,a;y();function y(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),_.render(w(),l,F)}function F(){r(L(),n,k)}function k(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function L(){a=document.createElement("div"),a.className="k-grid-pdf-export-element";const h=le(l);return a.appendChild(h),document.body.appendChild(a),h}function w(){const h=s&&{data:s,total:s.length,pageSize:s.length,skip:0},N={style:Object.assign({},t.props.style,{width:"1000px"})},b=Object.assign({},h,N);if(i&&i.length>0){const Te=ge(t);return u.cloneElement(t,b,i.concat(Te))}else return u.cloneElement(t,b)}}function ge(r){return u.Children.toArray(r.props.children).filter(t=>t&&t.type&&t.type.displayName!=="KendoReactGridColumn")}class H extends u.Component{constructor(t){super(t),this.saveGridPDF=de(this.getSavePDF())}render(){return null}save(t,n){this.saveGridPDF(this.getGrid(),Object.assign({},this.props,{margin:P(this.props)}),n,t,this.getCustomColumns())}getSavePDF(){return v}getGrid(){return u.Children.toArray(this.props.children).find(t=>t&&t.type.displayName==="KendoReactGrid")}getCustomColumns(){return u.Children.toArray(this.props.children).filter(t=>t&&t.type.displayName==="KendoReactGridColumn")}}H.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};const z="k-grid-header",Q="k-grid-footer",he=j("TABLE");class me{constructor(t){this.element=t,this.list=d(t,g("k-grid"))}content(){return d(this.list,g("k-grid"))}header(){return this.headerWrap=this.headerWrap||d(this.element,g(z)),d(this.headerWrap,g(`${z}`))}footer(){return this.footerWrap=this.footerWrap||d(this.element,g(Q)),d(this.footerWrap,g(`${Q}`))}table(){return d(this.element,he)}}const fe=r=>{const t=new me(r),n=t.content();let o,s=t.header();if(s.childNodes.length>1&&s.removeChild(s.childNodes[1]),s.childNodes[0].childNodes.forEach(i=>i.style.top=0),n){const i=[n.querySelector("colgroup")],p=[s],l=[n.querySelector("tbody")],a=t.footer(),y=a?[a.querySelector("tfoot")]:[];o=U(i,p,l,y)}else o=x(t.table().cloneNode(!0));return o};function ye(r){return(t,n={},o,s,i)=>be(r,t,n,o,s,i)}function be(r,t,n={},o,s,i){let p,l,a;y();function y(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),_.render(w(),l,F)}function F(){r(L(),n,k)}function k(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function L(){a=document.createElement("div"),a.className="k-treelist-pdf-export-element";const h=fe(l);return a.appendChild(h),document.body.appendChild(a),a}function w(){const h=n.allPages&&s?{data:s,take:Number.MAX_VALUE,skip:0}:{},N={style:Object.assign({},t.props.style,{width:"1000px"})},b=Object.assign({},h,N);return i&&i.length>0?u.cloneElement(t,Object.assign({},b,{columns:i})):u.cloneElement(t,b)}}class V extends u.Component{constructor(t){super(t),this.saveTreeListPDF=ye(this.getSavePDF())}render(){return null}save(t,n,o){this.saveTreeListPDF(this.getTreeList(),Object.assign({},this.props,{margin:P(this.props)}),o,t,n||[])}getSavePDF(){return v}getTreeList(){const t=this.props.children;if(t&&t.props.data&&t.props.columns)return this.props.children}}V.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string,allPages:e.bool},c.GridPDFExport=H,c.KendoDrawingAdapter=O,c.PDFExport=M,c.PDFMargin=D,c.TreeListPDFExport=V,c.getPageMargin=P,c.savePDF=v,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),X=require("prop-types"),y=require("@progress/kendo-drawing"),q=require("@progress/kendo-file-saver"),J=require("react-dom/server"),Y=require("@progress/kendo-licensing"),Z=require("react-dom");function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>r[n]})}}return t.default=r,Object.freeze(t)}const d=f(V),e=f(X),ee=f(J),L=f(Y),W=f(Z);class S extends d.Component{render(){return null}}S.propTypes={left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])};const N=["bottom","left","right","top"];function b(r){const t=d.Children.toArray(r.children).find(n=>n&&n.type===S);return t?te(t):r.margin}function te(r){const t={};for(let n=0;n<N.length;n++){const o=N[n],s=r.props[o];s!==void 0&&(t[o]=s)}return t}const re="export.pdf",ne="KendoReact PDF Generator";class F{constructor(t,n,o,s,i={}){this.drawDOM=t,this.exportPDF=n,this.saveAs=o,this.domElement=s,this.options=i,this.convertPageTemplateToHtml=p=>`<span>${ee.renderToStaticMarkup(d.createElement(this.options.pageTemplate,{pageNum:p.pageNum,totalPages:p.totalPages}))}</span>`}savePDF(t){const n=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||re,this.getSaveOptions()));t&&n.then(t,t)}getDrawOptions(){return{avoidLinks:this.options.avoidLinks,forcePageBreak:this.options.forcePageBreak,keepTogether:this.options.keepTogether,margin:this.options.margin,paperSize:this.options.paperSize,landscape:this.options.landscape,repeatHeaders:this.options.repeatHeaders,scale:this.options.scale,template:this.options.pageTemplate&&this.convertPageTemplateToHtml}}getPDFOptions(){return{author:this.options.author,creator:this.options.creator||ne,date:this.options.date,imgDPI:this.options.imageResolution,keywords:this.options.keywords,landscape:this.options.landscape,margin:this.options.margin,multiPage:!0,paperSize:this.options.paperSize,producer:this.options.producer,subject:this.options.subject,title:this.options.title}}getSaveOptions(){return{forceProxy:this.options.forceProxy,proxyData:this.options.proxyData,proxyTarget:this.options.proxyTarget,proxyURL:this.options.proxyURL}}}const v={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class I extends d.Component{constructor(t){if(super(t),this.rootElForPDF=null,typeof L<"u")L.validatePackage(v);else{let n=`License activation failed for ${v.name}
|
|
5
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),X=require("prop-types"),y=require("@progress/kendo-drawing"),q=require("@progress/kendo-file-saver"),J=require("react-dom/server"),Y=require("@progress/kendo-licensing"),Z=require("react-dom");function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>r[n]})}}return t.default=r,Object.freeze(t)}const d=f(V),e=f(X),ee=f(J),L=f(Y),W=f(Z);class S extends d.Component{render(){return null}}S.propTypes={left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])};const N=["bottom","left","right","top"];function b(r){const t=d.Children.toArray(r.children).find(n=>n&&n.type===S);return t?te(t):r.margin}function te(r){const t={};for(let n=0;n<N.length;n++){const o=N[n],s=r.props[o];s!==void 0&&(t[o]=s)}return t}const re="export.pdf",ne="KendoReact PDF Generator";class F{constructor(t,n,o,s,i={}){this.drawDOM=t,this.exportPDF=n,this.saveAs=o,this.domElement=s,this.options=i,this.convertPageTemplateToHtml=p=>`<span>${ee.renderToStaticMarkup(d.createElement(this.options.pageTemplate,{pageNum:p.pageNum,totalPages:p.totalPages}))}</span>`}savePDF(t){const n=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||re,this.getSaveOptions()));t&&n.then(t,t)}getDrawOptions(){return{avoidLinks:this.options.avoidLinks,forcePageBreak:this.options.forcePageBreak,keepTogether:this.options.keepTogether,margin:this.options.margin,paperSize:this.options.paperSize,landscape:this.options.landscape,repeatHeaders:this.options.repeatHeaders,scale:this.options.scale,template:this.options.pageTemplate&&this.convertPageTemplateToHtml}}getPDFOptions(){return{author:this.options.author,creator:this.options.creator||ne,date:this.options.date,imgDPI:this.options.imageResolution,keywords:this.options.keywords,landscape:this.options.landscape,margin:this.options.margin,multiPage:!0,paperSize:this.options.paperSize,producer:this.options.producer,subject:this.options.subject,title:this.options.title}}getSaveOptions(){return{forceProxy:this.options.forceProxy,proxyData:this.options.proxyData,proxyTarget:this.options.proxyTarget,proxyURL:this.options.proxyURL}}}const v={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class I extends d.Component{constructor(t){if(super(t),this.rootElForPDF=null,typeof L<"u")L.validatePackage(v);else{let n=`License activation failed for ${v.name}
|
|
6
6
|
`;n+=`The @progress/kendo-licensing script is not loaded.
|
|
7
7
|
`,n+=`See ${v.licensingDocsUrl} for more information.
|
|
8
8
|
`,console.warn(n)}}render(){return d.createElement("div",{ref:t=>{this.rootElForPDF=t}},this.props.children)}save(t){new F(y.drawDOM,y.exportPDF,q.saveAs,this.rootElForPDF,this.getOptions()).savePDF(t)}getOptions(){return Object.assign({},this.props,{margin:b(this.props)})}}I.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};function k(r,t={},n){new F(y.drawDOM,y.exportPDF,q.saveAs,r,t).savePDF(n)}const x={},A=r=>String(r).trim().split(" "),oe=(r,t)=>{const n=A(t);return!!A(r.className).find(o=>n.indexOf(o)>=0)},u=r=>t=>oe(t,r),U=r=>(x[r]||(x[r]=t=>String(t.nodeName).toLowerCase()===r.toLowerCase()),x[r]),c=(r,t,n=!0)=>{if(r){if(n&&t(r))return r;for(r=r.firstChild;r;){if(r.nodeType===1){const o=c(r,t);if(o)return o}r=r.nextSibling}}},R="k-grid-header",_="k-grid-footer",se="TABLE",ie=U(se),G=r=>r?"locked":"wrap";let ae=class{constructor(t){this.element=t,this.list=c(t,u("k-grid-container"))}content(t){return c(this.list,u(`k-grid-content${t?"-locked":""}`))}header(t){return this.headerWrap=this.headerWrap||c(this.element,u(R)),c(this.headerWrap,u(`${R}-${G(t)}`))}footer(t){return this.footerWrap=this.footerWrap||c(this.element,u(_)),c(this.footerWrap,u(`${_}-${G(t)}`))}table(){return c(this.element,ie)}};const M="k-first",pe="k-grid-header",le="k-grid-footer",B=(r,t)=>{const n=t.length;for(let o=0;o<n;o++)r.appendChild(t[o].cloneNode(!0))},w=r=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(r),t},E=r=>{const t=r.length,n=r[0].cloneNode(!0),o=n.rows.length;if(t>1)for(let s=0;s<o;s++)for(let i=1;i<t;i++)B(n.rows[s],r[i].rows[s].cells);return n},ce=(r,t)=>{if(t.length>1&&r.rows.length>1)for(let n=1;n<r.rows.length;n++){const o=t[0].rows[n].cells.length,s=r.rows[n].cells[o];String(s.className).indexOf(M)===-1&&(s.className+=` ${M}`)}},H=(r,t,n,o)=>{const s=document.createElement("table"),i=r[0].cloneNode(!0);for(let a=1;a<r.length;a++)B(i,r[a].querySelectorAll("col"));const p=E(t),l=E(n);if(p.className=pe,ce(p,t),s.appendChild(i),s.appendChild(p),s.appendChild(l),o.length){const a=E(o);a.className=le,s.appendChild(a)}return w(s)},de=r=>{const t=new ae(r),n=t.content();let o;if(n){const s=[n.querySelector("colgroup")],i=[t.header().querySelector("thead")],p=[n.querySelector("tbody")],l=t.footer(),a=l?[l.querySelector("tfoot")]:[];o=H(s,i,p,a)}else o=w(t.table().cloneNode(!0));return o};function ue(r){return(t,n={},o,s,i)=>ge(r,t,n,o,s,i)}function ge(r,t,n={},o,s,i){let p,l,a;h();function h(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),W.render(O(),l,T)}function T(){r(P(),n,D)}function D(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function P(){a=document.createElement("div"),a.className="k-grid-pdf-export-element";const g=de(l);return a.appendChild(g),document.body.appendChild(a),g}function O(){const g=s&&{data:s,total:s.length,pageSize:s.length,skip:0},C={style:Object.assign({},t.props.style,{width:"1000px"})},m=Object.assign({},g,C);if(i&&i.length>0){const Q=he(t);return d.cloneElement(t,m,i.concat(Q))}else return d.cloneElement(t,m)}}function he(r){return d.Children.toArray(r.props.children).filter(t=>t&&t.type&&t.type.displayName!=="KendoReactGridColumn")}class z extends d.Component{constructor(t){super(t),this.saveGridPDF=ue(this.getSavePDF())}render(){return null}save(t,n){this.saveGridPDF(this.getGrid(),Object.assign({},this.props,{margin:b(this.props)}),n,t,this.getCustomColumns())}getSavePDF(){return k}getGrid(){return d.Children.toArray(this.props.children).find(t=>t&&t.type.displayName==="KendoReactGrid")}getCustomColumns(){return d.Children.toArray(this.props.children).filter(t=>t&&t.type.displayName==="KendoReactGridColumn")}}z.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};const $="k-grid-header",j="k-grid-footer",me="TABLE",fe=U(me);class ye{constructor(t){this.element=t,this.list=c(t,u("k-grid"))}content(){return c(this.list,u("k-grid"))}header(){return this.headerWrap=this.headerWrap||c(this.element,u($)),c(this.headerWrap,u(`${$}`))}footer(){return this.footerWrap=this.footerWrap||c(this.element,u(j)),c(this.footerWrap,u(`${j}`))}table(){return c(this.element,fe)}}const be=r=>{const t=new ye(r),n=t.content();let o,s=t.header();if(s.childNodes.length>1&&s.removeChild(s.childNodes[1]),s.childNodes[0].childNodes.forEach(i=>i.style.top=0),n){const i=[n.querySelector("colgroup")],p=[s],l=[n.querySelector("tbody")],a=t.footer(),h=a?[a.querySelector("tfoot")]:[];o=H(i,p,l,h)}else o=w(t.table().cloneNode(!0));return o};function Te(r){return(t,n={},o,s,i)=>De(r,t,n,o,s,i)}function De(r,t,n={},o,s,i){let p,l,a;h();function h(){p=document.createElement("div"),p.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),l=document.createElement("div"),p.appendChild(l),document.body.appendChild(p),W.render(O(),l,T)}function T(){r(P(),n,D)}function D(){document.body.removeChild(p),document.body.removeChild(a),p=a=void 0,o&&o()}function P(){a=document.createElement("div"),a.className="k-treelist-pdf-export-element";const g=be(l);return a.appendChild(g),document.body.appendChild(a),a}function O(){const g=n.allPages&&s?{data:s,take:Number.MAX_VALUE,skip:0}:{},C={style:Object.assign({},t.props.style,{width:"1000px"})},m=Object.assign({},g,C);return i&&i.length>0?d.cloneElement(t,Object.assign({},m,{columns:i})):d.cloneElement(t,m)}}class K extends d.Component{constructor(t){super(t),this.saveTreeListPDF=Te(this.getSavePDF())}render(){return null}save(t,n,o){this.saveTreeListPDF(this.getTreeList(),Object.assign({},this.props,{margin:b(this.props)}),o,t,n||[])}getSavePDF(){return k}getTreeList(){const t=this.props.children;if(t&&t.props.data&&t.props.columns)return this.props.children}}K.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string,allPages:e.bool};exports.GridPDFExport=z;exports.KendoDrawingAdapter=F;exports.PDFExport=I;exports.PDFMargin=S;exports.TreeListPDFExport=K;exports.getPageMargin=b;exports.savePDF=k;
|
package/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
"use client";
|
|
5
6
|
import * as d from "react";
|
|
6
7
|
import * as e from "prop-types";
|
|
7
8
|
import { drawDOM as G, exportPDF as $ } from "@progress/kendo-drawing";
|
|
@@ -89,7 +90,7 @@ const P = {
|
|
|
89
90
|
name: "@progress/kendo-react-pdf",
|
|
90
91
|
productName: "KendoReact",
|
|
91
92
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
92
|
-
publishDate:
|
|
93
|
+
publishDate: 1702304873,
|
|
93
94
|
version: "",
|
|
94
95
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
95
96
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-pdf",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
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",
|
|
7
7
|
"homepage": "https://www.telerik.com/kendo-react-ui",
|
|
8
8
|
"main": "./index.js",
|
|
9
|
+
"module": "./index.mjs",
|
|
9
10
|
"types": "./index.d.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
"@progress/kendo-drawing": "^1.17.2",
|
|
19
20
|
"@progress/kendo-file-saver": "^1.0.1",
|
|
20
21
|
"@progress/kendo-licensing": "^1.3.0",
|
|
21
|
-
"@progress/kendo-react-common": "7.0.0
|
|
22
|
+
"@progress/kendo-react-common": "7.0.0",
|
|
22
23
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
23
24
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
24
25
|
},
|