@progress/kendo-react-pdf 7.2.4-develop.3 → 7.3.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.
Files changed (56) hide show
  1. package/KendoDrawingAdapter.js +8 -0
  2. package/KendoDrawingAdapter.mjs +65 -0
  3. package/PDFExport.js +8 -0
  4. package/PDFExport.mjs +79 -0
  5. package/PDFMargin.js +8 -0
  6. package/PDFMargin.mjs +25 -0
  7. package/common/dom-queries.js +8 -0
  8. package/common/dom-queries.mjs +31 -0
  9. package/common/table-query.js +8 -0
  10. package/common/table-query.mjs +32 -0
  11. package/common/utils.js +8 -0
  12. package/common/utils.mjs +46 -0
  13. package/dist/cdn/js/kendo-react-pdf.js +8 -5
  14. package/getPageMargin.js +8 -0
  15. package/getPageMargin.mjs +26 -0
  16. package/grid/GridPDFExport.js +8 -0
  17. package/grid/GridPDFExport.mjs +83 -0
  18. package/grid/export-element.js +8 -0
  19. package/grid/export-element.mjs +23 -0
  20. package/grid/grid-query.js +8 -0
  21. package/grid/grid-query.mjs +32 -0
  22. package/grid/provideSaveGridPDF.js +8 -0
  23. package/grid/provideSaveGridPDF.mjs +53 -0
  24. package/index.d.mts +439 -5
  25. package/index.d.ts +439 -14
  26. package/index.js +8 -5
  27. package/index.mjs +21 -476
  28. package/package-metadata.js +8 -0
  29. package/package-metadata.mjs +19 -0
  30. package/package.json +2 -2
  31. package/savePDF.js +8 -0
  32. package/savePDF.mjs +23 -0
  33. package/treelist/TreeListPDFExport.js +8 -0
  34. package/treelist/TreeListPDFExport.mjs +84 -0
  35. package/treelist/export-element.js +8 -0
  36. package/treelist/export-element.mjs +23 -0
  37. package/treelist/provideSaveTreeListPDF.js +8 -0
  38. package/treelist/provideSaveTreeListPDF.mjs +46 -0
  39. package/KendoDrawingAdapter.d.ts +0 -24
  40. package/PDFExport.d.ts +0 -57
  41. package/PDFExportProps.d.ts +0 -127
  42. package/PDFMargin.d.ts +0 -71
  43. package/PageTemplateProps.d.ts +0 -17
  44. package/common/dom-queries.d.ts +0 -48
  45. package/common/table-query.d.ts +0 -26
  46. package/common/utils.d.ts +0 -24
  47. package/getPageMargin.d.ts +0 -10
  48. package/grid/GridPDFExport.d.ts +0 -70
  49. package/grid/export-element.d.ts +0 -8
  50. package/grid/grid-query.d.ts +0 -26
  51. package/grid/provideSaveGridPDF.d.ts +0 -9
  52. package/package-metadata.d.ts +0 -9
  53. package/savePDF.d.ts +0 -13
  54. package/treelist/TreeListPDFExport.d.ts +0 -75
  55. package/treelist/export-element.d.ts +0 -8
  56. package/treelist/provideSaveTreeListPDF.d.ts +0 -9
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";const p=require("react"),c=require("react-dom/server");function a(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>s[e]})}}return t.default=s,Object.freeze(t)}const h=a(p),l=a(c),g="export.pdf",u="KendoReact PDF Generator";class m{constructor(t,e,o,r,n={}){this.drawDOM=t,this.exportPDF=e,this.saveAs=o,this.domElement=r,this.options=n,this.convertPageTemplateToHtml=i=>`<span>${l.renderToStaticMarkup(h.createElement(this.options.pageTemplate,{pageNum:i.pageNum,totalPages:i.totalPages}))}</span>`}savePDF(t){const e=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||g,this.getSaveOptions()));t&&e.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||u,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}}}module.exports=m;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as p from "react";
10
+ import * as r from "react-dom/server";
11
+ const n = "export.pdf", h = "KendoReact PDF Generator";
12
+ class c {
13
+ constructor(t, o, e, i, a = {}) {
14
+ this.drawDOM = t, this.exportPDF = o, this.saveAs = e, this.domElement = i, this.options = a, this.convertPageTemplateToHtml = (s) => `<span>${r.renderToStaticMarkup(
15
+ p.createElement(this.options.pageTemplate, {
16
+ pageNum: s.pageNum,
17
+ totalPages: s.totalPages
18
+ })
19
+ )}</span>`;
20
+ }
21
+ savePDF(t) {
22
+ const o = this.drawDOM(this.domElement, this.getDrawOptions()).then((e) => this.exportPDF(e, this.getPDFOptions())).then((e) => this.saveAs(e, this.options.fileName || n, this.getSaveOptions()));
23
+ t && o.then(t, t);
24
+ }
25
+ getDrawOptions() {
26
+ return {
27
+ avoidLinks: this.options.avoidLinks,
28
+ forcePageBreak: this.options.forcePageBreak,
29
+ keepTogether: this.options.keepTogether,
30
+ margin: this.options.margin,
31
+ paperSize: this.options.paperSize,
32
+ landscape: this.options.landscape,
33
+ repeatHeaders: this.options.repeatHeaders,
34
+ scale: this.options.scale,
35
+ template: this.options.pageTemplate && this.convertPageTemplateToHtml
36
+ };
37
+ }
38
+ getPDFOptions() {
39
+ return {
40
+ author: this.options.author,
41
+ creator: this.options.creator || h,
42
+ date: this.options.date,
43
+ imgDPI: this.options.imageResolution,
44
+ keywords: this.options.keywords,
45
+ landscape: this.options.landscape,
46
+ margin: this.options.margin,
47
+ multiPage: !0,
48
+ paperSize: this.options.paperSize,
49
+ producer: this.options.producer,
50
+ subject: this.options.subject,
51
+ title: this.options.title
52
+ };
53
+ }
54
+ getSaveOptions() {
55
+ return {
56
+ forceProxy: this.options.forceProxy,
57
+ proxyData: this.options.proxyData,
58
+ proxyTarget: this.options.proxyTarget,
59
+ proxyURL: this.options.proxyURL
60
+ };
61
+ }
62
+ }
63
+ export {
64
+ c as default
65
+ };
package/PDFExport.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),e=require("prop-types"),i=require("@progress/kendo-drawing"),p=require("@progress/kendo-file-saver"),u=require("./getPageMargin.js"),l=require("./KendoDrawingAdapter.js"),d=require("@progress/kendo-react-common"),b=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 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=f(c),a=class a extends g.Component{constructor(t){super(t),this.rootElForPDF=null,d.validatePackage(b.packageMetadata)}render(){return g.createElement("div",{ref:t=>{this.rootElForPDF=t}},this.props.children)}save(t){new l(i.drawDOM,i.exportPDF,p.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 ADDED
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as o from "react";
10
+ import e from "prop-types";
11
+ import { drawDOM as s, exportPDF as i } from "@progress/kendo-drawing";
12
+ import { saveAs as a } from "@progress/kendo-file-saver";
13
+ import { getPageMargin as p } from "./getPageMargin.mjs";
14
+ import g from "./KendoDrawingAdapter.mjs";
15
+ import { validatePackage as m } from "@progress/kendo-react-common";
16
+ import { packageMetadata as l } from "./package-metadata.mjs";
17
+ const t = class t extends o.Component {
18
+ constructor(r) {
19
+ super(r), this.rootElForPDF = null, m(l);
20
+ }
21
+ /**
22
+ * @hidden
23
+ */
24
+ render() {
25
+ return /* @__PURE__ */ o.createElement("div", { ref: (r) => {
26
+ this.rootElForPDF = r;
27
+ } }, this.props.children);
28
+ }
29
+ /**
30
+ * Saves the content as a PDF file.
31
+ *
32
+ * @param callback - The callback to be executed after the PDF is saved.
33
+ */
34
+ save(r) {
35
+ new g(
36
+ s,
37
+ i,
38
+ a,
39
+ this.rootElForPDF,
40
+ this.getOptions()
41
+ ).savePDF(r);
42
+ }
43
+ getOptions() {
44
+ return Object.assign({}, this.props, { margin: p(this.props) });
45
+ }
46
+ };
47
+ t.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([e.string, e.number, e.shape({
60
+ left: e.oneOfType([e.number, e.string]),
61
+ top: e.oneOfType([e.number, e.string]),
62
+ right: e.oneOfType([e.number, e.string]),
63
+ bottom: e.oneOfType([e.number, e.string])
64
+ })]),
65
+ pageTemplate: e.any,
66
+ paperSize: e.any,
67
+ repeatHeaders: e.bool,
68
+ scale: e.number,
69
+ proxyData: e.any,
70
+ proxyURL: e.string,
71
+ proxyTarget: e.string,
72
+ producer: e.string,
73
+ subject: e.string,
74
+ title: e.string
75
+ };
76
+ let n = t;
77
+ export {
78
+ n as PDFExport
79
+ };
package/PDFMargin.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),e=require("prop-types");function i(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,c.get?c:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const p=i(u),s=class s extends p.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])};let o=s;exports.PDFMargin=o;
package/PDFMargin.mjs ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as n from "react";
10
+ import e from "prop-types";
11
+ const t = class t extends n.Component {
12
+ render() {
13
+ return null;
14
+ }
15
+ };
16
+ t.propTypes = {
17
+ left: e.oneOfType([e.number, e.string]),
18
+ top: e.oneOfType([e.number, e.string]),
19
+ right: e.oneOfType([e.number, e.string]),
20
+ bottom: e.oneOfType([e.number, e.string])
21
+ };
22
+ let r = t;
23
+ export {
24
+ r as PDFMargin
25
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r={},n=s=>String(s).trim().split(" "),a=(s,t)=>{const i=n(t);return!!n(s.className).find(e=>i.indexOf(e)>=0)},c=s=>t=>a(t,s),f=s=>(r[s]||(r[s]=t=>String(t.nodeName).toLowerCase()===s.toLowerCase()),r[s]),l=(s,t,i=!0)=>{if(s){if(i&&t(s))return s;for(s=s.firstChild;s;){if(s.nodeType===1){const e=l(s,t);if(e)return e}s=s.nextSibling}}};exports.findElement=l;exports.hasClasses=a;exports.matchesClasses=c;exports.matchesNodeName=f;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ const r = {}, n = (t) => String(t).trim().split(" "), l = (t, s) => {
10
+ const e = n(s);
11
+ return !!n(t.className).find((i) => e.indexOf(i) >= 0);
12
+ }, a = (t) => (s) => l(s, t), f = (t) => (r[t] || (r[t] = (s) => String(s.nodeName).toLowerCase() === t.toLowerCase()), r[t]), c = (t, s, e = !0) => {
13
+ if (t) {
14
+ if (e && s(t))
15
+ return t;
16
+ for (t = t.firstChild; t; ) {
17
+ if (t.nodeType === 1) {
18
+ const i = c(t, s);
19
+ if (i)
20
+ return i;
21
+ }
22
+ t = t.nextSibling;
23
+ }
24
+ }
25
+ };
26
+ export {
27
+ c as findElement,
28
+ l as hasClasses,
29
+ a as matchesClasses,
30
+ f as matchesNodeName
31
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dom-queries.js"),t="k-grid-header",s="k-grid-footer",i="TABLE",n=e.matchesNodeName(i);class a{constructor(r){this.element=r,this.list=e.findElement(r,e.matchesClasses("k-grid"))}content(){return e.findElement(this.list,e.matchesClasses("k-grid"))}header(){return this.headerWrap=this.headerWrap||e.findElement(this.element,e.matchesClasses(t)),e.findElement(this.headerWrap,e.matchesClasses(`${t}`))}footer(){return this.footerWrap=this.footerWrap||e.findElement(this.element,e.matchesClasses(s)),e.findElement(this.footerWrap,e.matchesClasses(`${s}`))}table(){return e.findElement(this.element,n)}}exports.FOOTER_CLASS=s;exports.GridQuery=a;exports.HEADER_CLASS=t;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import { matchesNodeName as o, findElement as e, matchesClasses as t } from "./dom-queries.mjs";
10
+ const s = "k-grid-header", i = "k-grid-footer", h = "TABLE", a = o(h);
11
+ class d {
12
+ constructor(r) {
13
+ this.element = r, this.list = e(r, t("k-grid"));
14
+ }
15
+ content() {
16
+ return e(this.list, t("k-grid"));
17
+ }
18
+ header() {
19
+ return this.headerWrap = this.headerWrap || e(this.element, t(s)), e(this.headerWrap, t(`${s}`));
20
+ }
21
+ footer() {
22
+ return this.footerWrap = this.footerWrap || e(this.element, t(i)), e(this.footerWrap, t(`${i}`));
23
+ }
24
+ table() {
25
+ return e(this.element, a);
26
+ }
27
+ }
28
+ export {
29
+ i as FOOTER_CLASS,
30
+ d as GridQuery,
31
+ s as HEADER_CLASS
32
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i="k-first",f="k-grid-header",h="k-grid-footer",d=(e,t)=>{const n=t.length;for(let o=0;o<n;o++)e.appendChild(t[o].cloneNode(!0))},p=e=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(e),t},c=e=>{const t=e.length,n=e[0].cloneNode(!0),o=n.rows.length;if(t>1)for(let l=0;l<o;l++)for(let s=1;s<t;s++)d(n.rows[l],e[s].rows[l].cells);return n},g=(e,t)=>{if(t.length>1&&e.rows.length>1)for(let n=1;n<e.rows.length;n++){const o=t[0].rows[n].cells.length,l=e.rows[n].cells[o];String(l.className).indexOf(i)===-1&&(l.className+=` ${i}`)}},m=(e,t,n,o)=>{const l=document.createElement("table"),s=e[0].cloneNode(!0);for(let r=1;r<e.length;r++)d(s,e[r].querySelectorAll("col"));const a=c(t),C=c(n);if(a.className=f,g(a,t),l.appendChild(s),l.appendChild(a),l.appendChild(C),o.length){const r=c(o);r.className=h,l.appendChild(r)}return p(l)};exports.appendNodes=d;exports.createTable=m;exports.createTableElement=c;exports.setFirstCellClass=g;exports.wrapTable=p;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ const a = "k-first", g = "k-grid-header", h = "k-grid-footer", i = (e, t) => {
10
+ const n = t.length;
11
+ for (let o = 0; o < n; o++)
12
+ e.appendChild(t[o].cloneNode(!0));
13
+ }, C = (e) => {
14
+ const t = document.createElement("div");
15
+ return t.className = "k-grid k-grid-md", t.appendChild(e), t;
16
+ }, d = (e) => {
17
+ const t = e.length, n = e[0].cloneNode(!0), o = n.rows.length;
18
+ if (t > 1)
19
+ for (let l = 0; l < o; l++)
20
+ for (let s = 1; s < t; s++)
21
+ i(n.rows[l], e[s].rows[l].cells);
22
+ return n;
23
+ }, f = (e, t) => {
24
+ if (t.length > 1 && e.rows.length > 1)
25
+ for (let n = 1; n < e.rows.length; n++) {
26
+ const o = t[0].rows[n].cells.length, l = e.rows[n].cells[o];
27
+ String(l.className).indexOf(a) === -1 && (l.className += ` ${a}`);
28
+ }
29
+ }, m = (e, t, n, o) => {
30
+ const l = document.createElement("table"), s = e[0].cloneNode(!0);
31
+ for (let c = 1; c < e.length; c++)
32
+ i(s, e[c].querySelectorAll("col"));
33
+ const r = d(t), p = d(n);
34
+ if (r.className = g, f(r, t), l.appendChild(s), l.appendChild(r), l.appendChild(p), o.length) {
35
+ const c = d(o);
36
+ c.className = h, l.appendChild(c);
37
+ }
38
+ return C(l);
39
+ };
40
+ export {
41
+ i as appendNodes,
42
+ m as createTable,
43
+ d as createTableElement,
44
+ f as setFirstCellClass,
45
+ C as wrapTable
46
+ };
@@ -1,5 +1,8 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- (function(l,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("react"),require("prop-types"),require("@progress/kendo-drawing"),require("@progress/kendo-file-saver"),require("react-dom/server"),require("@progress/kendo-react-common"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","@progress/kendo-drawing","@progress/kendo-file-saver","react-dom/server","@progress/kendo-react-common","react-dom"],f):(l=typeof globalThis!="undefined"?globalThis:l||self,f(l.KendoReactPdf={},l.React,l.PropTypes,l.KendoDrawing,l.KendoFileSaver,l.ReactDOMServer,l.KendoReactCommon,l.ReactDOM))})(this,function(l,f,e,C,G,J,Y,Z){"use strict";"use client";function D(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>n[r]})}}return t.default=n,Object.freeze(t)}const g=D(f),y=D(J),M=D(Z);class v extends g.Component{render(){return null}}v.propTypes={left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])};const j=["bottom","left","right","top"];function O(n){const t=g.Children.toArray(n.children).find(r=>r&&r.type===v);return t?T(t):n.margin}function T(n){const t={};for(let r=0;r<j.length;r++){const o=j[r],i=n.props[o];i!==void 0&&(t[o]=i)}return t}const P="export.pdf",ee="KendoReact PDF Generator";class E{constructor(t,r,o,i,s={}){this.drawDOM=t,this.exportPDF=r,this.saveAs=o,this.domElement=i,this.options=s,this.convertPageTemplateToHtml=c=>`<span>${y.renderToStaticMarkup(g.createElement(this.options.pageTemplate,{pageNum:c.pageNum,totalPages:c.totalPages}))}</span>`}savePDF(t){const r=this.drawDOM(this.domElement,this.getDrawOptions()).then(o=>this.exportPDF(o,this.getPDFOptions())).then(o=>this.saveAs(o,this.options.fileName||P,this.getSaveOptions()));t&&r.then(t,t)}getDrawOptions(){return{avoidLinks:this.options.avoidLinks,forcePageBreak:this.options.forcePageBreak,keepTogether:this.options.keepTogether,margin:this.options.margin,paperSize:this.options.paperSize,landscape:this.options.landscape,repeatHeaders:this.options.repeatHeaders,scale:this.options.scale,template:this.options.pageTemplate&&this.convertPageTemplateToHtml}}getPDFOptions(){return{author:this.options.author,creator:this.options.creator||ee,date:this.options.date,imgDPI:this.options.imageResolution,keywords:this.options.keywords,landscape:this.options.landscape,margin:this.options.margin,multiPage:!0,paperSize:this.options.paperSize,producer:this.options.producer,subject:this.options.subject,title:this.options.title}}getSaveOptions(){return{forceProxy:this.options.forceProxy,proxyData:this.options.proxyData,proxyTarget:this.options.proxyTarget,proxyURL:this.options.proxyURL}}}const te={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};class $ extends g.Component{constructor(t){super(t),this.rootElForPDF=null,Y.validatePackage(te)}render(){return g.createElement("div",{ref:t=>{this.rootElForPDF=t}},this.props.children)}save(t){new E(C.drawDOM,C.exportPDF,G.saveAs,this.rootElForPDF,this.getOptions()).savePDF(t)}getOptions(){return Object.assign({},this.props,{margin:O(this.props)})}}$.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};function x(n,t={},r){new E(C.drawDOM,C.exportPDF,G.saveAs,n,t).savePDF(r)}const S={},q=n=>String(n).trim().split(" "),ne=(n,t)=>{const r=q(t);return!!q(n.className).find(o=>r.indexOf(o)>=0)},h=n=>t=>ne(t,n),W=n=>(S[n]||(S[n]=t=>String(t.nodeName).toLowerCase()===n.toLowerCase()),S[n]),u=(n,t,r=!0)=>{if(n){if(r&&t(n))return n;for(n=n.firstChild;n;){if(n.nodeType===1){const o=u(n,t);if(o)return o}n=n.nextSibling}}},_="k-grid-header",K="k-grid-footer",re=W("TABLE"),B=n=>n?"locked":"wrap";let oe=class{constructor(t){this.element=t,this.list=u(t,h("k-grid-container"))}content(t){return u(this.list,h(`k-grid-content${t?"-locked":""}`))}header(t){return this.headerWrap=this.headerWrap||u(this.element,h(_)),u(this.headerWrap,h(`${_}-${B(t)}`))}footer(t){return this.footerWrap=this.footerWrap||u(this.element,h(K)),u(this.footerWrap,h(`${K}-${B(t)}`))}table(){return u(this.element,re)}};const I="k-first",ie="k-grid-header",se="k-grid-footer",U=(n,t)=>{const r=t.length;for(let o=0;o<r;o++)n.appendChild(t[o].cloneNode(!0))},F=n=>{const t=document.createElement("div");return t.className="k-grid k-grid-md",t.appendChild(n),t},k=n=>{const t=n.length,r=n[0].cloneNode(!0),o=r.rows.length;if(t>1)for(let i=0;i<o;i++)for(let s=1;s<t;s++)U(r.rows[i],n[s].rows[i].cells);return r},ae=(n,t)=>{if(t.length>1&&n.rows.length>1)for(let r=1;r<n.rows.length;r++){const o=t[0].rows[r].cells.length,i=n.rows[r].cells[o];String(i.className).indexOf(I)===-1&&(i.className+=` ${I}`)}},H=(n,t,r,o)=>{const i=document.createElement("table"),s=n[0].cloneNode(!0);for(let a=1;a<n.length;a++)U(s,n[a].querySelectorAll("col"));const c=k(t),d=k(r);if(c.className=ie,ae(c,t),i.appendChild(s),i.appendChild(c),i.appendChild(d),o.length){const a=k(o);a.className=se,i.appendChild(a)}return F(i)},ce=n=>{const t=new oe(n),r=t.content();let o;if(r){const i=[r.querySelector("colgroup")],s=[t.header().querySelector("thead")],c=[r.querySelector("tbody")],d=t.footer(),a=d?[d.querySelector("tfoot")]:[];o=H(i,s,c,a)}else o=F(t.table().cloneNode(!0));return o};function le(n){return(t,r={},o,i,s)=>de(n,t,r,o,i,s)}function de(n,t,r={},o,i,s){let c,d,a;b();function b(){c=document.createElement("div"),c.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),d=document.createElement("div"),c.appendChild(d),document.body.appendChild(c),M.render(A(),d,w)}function w(){n(N(),r,L)}function L(){document.body.removeChild(c),document.body.removeChild(a),c=a=void 0,o&&o()}function N(){a=document.createElement("div"),a.className="k-grid-pdf-export-element";const m=ce(d);return a.appendChild(m),document.body.appendChild(a),m}function A(){const m=i&&{data:i,total:i.length,pageSize:i.length,skip:0},R={style:Object.assign({},t.props.style,{width:"1000px"})},p=Object.assign({},m,R);if(s&&s.length>0){const pe=ue(t);return g.cloneElement(t,p,s.concat(pe))}else return g.cloneElement(t,p)}}function ue(n){return g.Children.toArray(n.props.children).filter(t=>t&&t.type&&t.type.displayName!=="KendoReactGridColumn")}class z extends g.Component{constructor(t){super(t),this.saveGridPDF=le(this.getSavePDF())}render(){return null}save(t,r){this.saveGridPDF(this.getGrid(),Object.assign({},this.props,{margin:O(this.props)}),r,t,this.getCustomColumns())}getSavePDF(){return x}getGrid(){return g.Children.toArray(this.props.children).find(t=>t&&t.type.displayName==="KendoReactGrid")}getCustomColumns(){return g.Children.toArray(this.props.children).filter(t=>t&&t.type.displayName==="KendoReactGridColumn")}}z.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string};const Q="k-grid-header",V="k-grid-footer",ge=W("TABLE");class he{constructor(t){this.element=t,this.list=u(t,h("k-grid"))}content(){return u(this.list,h("k-grid"))}header(){return this.headerWrap=this.headerWrap||u(this.element,h(Q)),u(this.headerWrap,h(`${Q}`))}footer(){return this.footerWrap=this.footerWrap||u(this.element,h(V)),u(this.footerWrap,h(`${V}`))}table(){return u(this.element,ge)}}const me=n=>{const t=new he(n),r=t.content();let o,i=t.header();if(i.childNodes.length>1&&i.removeChild(i.childNodes[1]),i.childNodes[0].childNodes.forEach(s=>s.style.top=0),r){const s=[r.querySelector("colgroup")],c=[i],d=[r.querySelector("tbody")],a=t.footer(),b=a?[a.querySelector("tfoot")]:[];o=H(s,c,d,b)}else o=F(t.table().cloneNode(!0));return o};function fe(n){return(t,r={},o,i,s)=>be(n,t,r,o,i,s)}function be(n,t,r={},o,i,s){let c,d,a;b();function b(){c=document.createElement("div"),c.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),d=document.createElement("div"),c.appendChild(d),document.body.appendChild(c),M.render(A(),d,w)}function w(){n(N(),r,L)}function L(){document.body.removeChild(c),document.body.removeChild(a),c=a=void 0,o&&o()}function N(){a=document.createElement("div"),a.className="k-treelist-pdf-export-element";const m=me(d);return a.appendChild(m),document.body.appendChild(a),a}function A(){const m=r.allPages&&i?{data:i,take:Number.MAX_VALUE,skip:0}:{},R={style:Object.assign({},t.props.style,{width:"1000px"})},p=Object.assign({},m,R);return s&&s.length>0?g.cloneElement(t,Object.assign({},p,{columns:s})):g.cloneElement(t,p)}}class X extends g.Component{constructor(t){super(t),this.saveTreeListPDF=fe(this.getSavePDF())}render(){return null}save(t,r,o){this.saveTreeListPDF(this.getTreeList(),Object.assign({},this.props,{margin:O(this.props)}),o,t,r||[])}getSavePDF(){return x}getTreeList(){const t=this.props.children;if(t&&t.props.data&&t.props.columns)return this.props.children}}X.propTypes={author:e.string,avoidLinks:e.oneOfType([e.bool,e.string]),forcePageBreak:e.string,keepTogether:e.string,creator:e.string,date:e.instanceOf(Date),imageResolution:e.number,fileName:e.string,forceProxy:e.bool,keywords:e.string,landscape:e.bool,margin:e.oneOfType([e.string,e.number,e.shape({left:e.oneOfType([e.number,e.string]),top:e.oneOfType([e.number,e.string]),right:e.oneOfType([e.number,e.string]),bottom:e.oneOfType([e.number,e.string])})]),pageTemplate:e.any,paperSize:e.any,repeatHeaders:e.bool,scale:e.number,proxyData:e.any,proxyURL:e.string,proxyTarget:e.string,producer:e.string,subject:e.string,title:e.string,allPages:e.bool},l.GridPDFExport=z,l.KendoDrawingAdapter=E,l.PDFExport=$,l.PDFMargin=v,l.TreeListPDFExport=X,l.getPageMargin=O,l.savePDF=x,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ !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,n,s,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(s),d=p(a);const g=class extends l.Component{render(){return null}};g.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 u=g;const h=["bottom","left","right","top"];function m(e){const t=l.Children.toArray(e.children).find((e=>e&&e.type===u));return t?function(e){const t={};for(let r=0;r<h.length;r++){const o=h[r],n=e.props[o];void 0!==n&&(t[o]=n)}return t}(t):e.margin}let f=class{constructor(e,t,r,o,n={}){this.drawDOM=e,this.exportPDF=t,this.saveAs=r,this.domElement=o,this.options=n,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 y={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},b=class extends l.Component{constructor(e){super(e),this.rootElForPDF=null,i.validatePackage(y)}render(){return l.createElement("div",{ref:e=>{this.rootElForPDF=e}},this.props.children)}save(e){new f(o.drawDOM,o.exportPDF,n.saveAs,this.rootElForPDF,this.getOptions()).savePDF(e)}getOptions(){return Object.assign({},this.props,{margin:m(this.props)})}};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};let T=b;function O(e,t={},r){new f(o.drawDOM,o.exportPDF,n.saveAs,e,t).savePDF(r)}const v={},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),D=e=>(v[e]||(v[e]=t=>String(t.nodeName).toLowerCase()===e.toLowerCase()),v[e]),x=(e,t,r=!0)=>{if(e){if(r&&t(e))return e;for(e=e.firstChild;e;){if(1===e.nodeType){const r=x(e,t);if(r)return r}e=e.nextSibling}}},C="k-grid-header",w="k-grid-footer",E=D("TABLE"),N=e=>e?"locked":"wrap";class F{constructor(e){this.element=e,this.list=x(e,P("k-grid-container"))}content(e){return x(this.list,P("k-grid-content"+(e?"-locked":"")))}header(e){return this.headerWrap=this.headerWrap||x(this.element,P(C)),x(this.headerWrap,P(`${C}-${N(e)}`))}footer(e){return this.footerWrap=this.footerWrap||x(this.element,P(w)),x(this.footerWrap,P(`${w}-${N(e)}`))}table(){return x(this.element,E)}}const S="k-first",L=(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},j=e=>{const t=e.length,r=e[0].cloneNode(!0),o=r.rows.length;if(t>1)for(let n=0;n<o;n++)for(let o=1;o<t;o++)L(r.rows[n],e[o].rows[n].cells);return r},A=(e,t,r,o)=>{const n=document.createElement("table"),s=e[0].cloneNode(!0);for(let t=1;t<e.length;t++)L(s,e[t].querySelectorAll("col"));const i=j(t),a=j(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,n=e.rows[r].cells[o];-1===String(n.className).indexOf(S)&&(n.className+=` ${S}`)}})(i,t),n.appendChild(s),n.appendChild(i),n.appendChild(a),o.length){const e=j(o);e.className="k-grid-footer",n.appendChild(e)}return R(n)},q=e=>{const t=new F(e),r=t.content();let o;if(r){const e=[r.querySelector("colgroup")],n=[t.header().querySelector("thead")],s=[r.querySelector("tbody")],i=t.footer(),a=i?[i.querySelector("tfoot")]:[];o=A(e,n,s,a)}else o=R(t.table().cloneNode(!0));return o};function K(e){return(t,r={},o,n,s)=>function(e,t,r={},o,n,s){let i,a,p;function c(){i=document.createElement("div"),i.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),a=document.createElement("div"),i.appendChild(a),document.body.appendChild(i),d.render(m(),a,g)}function g(){e(h(),r,u)}function u(){document.body.removeChild(i),document.body.removeChild(p),i=p=void 0,o&&o()}function h(){p=document.createElement("div"),p.className="k-grid-pdf-export-element";const e=q(a);return p.appendChild(e),document.body.appendChild(p),e}function m(){const e=n&&{data:n,total:n.length,pageSize:n.length,skip:0},r={style:Object.assign({},t.props.style,{width:"1000px"})},o=Object.assign({},e,r);if(s&&s.length>0){const e=function(e){return l.Children.toArray(e.props.children).filter((e=>e&&e.type&&"KendoReactGridColumn"!==e.type.displayName))}(t);return l.cloneElement(t,o,s.concat(e))}return l.cloneElement(t,o)}c()}(e,t,r,o,n,s)}const W=class extends l.Component{constructor(e){super(e),this.saveGridPDF=K(this.getSavePDF())}render(){return null}save(e,t){this.saveGridPDF(this.getGrid(),Object.assign({},this.props,{margin:m(this.props)}),t,e,this.getCustomColumns())}getSavePDF(){return O}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))}};W.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 M=W;const z="k-grid-header",G="k-grid-footer",U=D("TABLE");class ${constructor(e){this.element=e,this.list=x(e,P("k-grid"))}content(){return x(this.list,P("k-grid"))}header(){return this.headerWrap=this.headerWrap||x(this.element,P(z)),x(this.headerWrap,P(`${z}`))}footer(){return this.footerWrap=this.footerWrap||x(this.element,P(G)),x(this.footerWrap,P(`${G}`))}table(){return x(this.element,U)}}const B=e=>{const t=new $(e),r=t.content();let o,n=t.header();if(n.childNodes.length>1&&n.removeChild(n.childNodes[1]),n.childNodes[0].childNodes.forEach((e=>e.style.top=0)),r){const e=[r.querySelector("colgroup")],s=[n],i=[r.querySelector("tbody")],a=t.footer(),p=a?[a.querySelector("tfoot")]:[];o=A(e,s,i,p)}else o=R(t.table().cloneNode(!0));return o};function H(e){return(t,r={},o,n,s)=>function(e,t,r={},o,n,s){let i,a,p;function c(){i=document.createElement("div"),i.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),a=document.createElement("div"),i.appendChild(a),document.body.appendChild(i),d.render(m(),a,g)}function g(){e(h(),r,u)}function u(){document.body.removeChild(i),document.body.removeChild(p),i=p=void 0,o&&o()}function h(){p=document.createElement("div"),p.className="k-treelist-pdf-export-element";const e=B(a);return p.appendChild(e),document.body.appendChild(p),p}function m(){const e=r.allPages&&n?{data:n,take:Number.MAX_VALUE,skip:0}:{},o={style:Object.assign({},t.props.style,{width:"1000px"})},i=Object.assign({},e,o);return s&&s.length>0?l.cloneElement(t,Object.assign({},i,{columns:s})):l.cloneElement(t,i)}c()}(e,t,r,o,n,s)}const I=class extends l.Component{constructor(e){super(e),this.saveTreeListPDF=H(this.getSavePDF())}render(){return null}save(e,t,r){this.saveTreeListPDF(this.getTreeList(),Object.assign({},this.props,{margin:m(this.props)}),r,e,t||[])}getSavePDF(){return O}getTreeList(){const e=this.props.children;if(e&&e.props.data&&e.props.columns)return this.props.children}};I.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 V=I;e.GridPDFExport=M,e.KendoDrawingAdapter=f,e.PDFExport=T,e.PDFMargin=u,e.TreeListPDFExport=V,e.getPageMargin=m,e.savePDF=O}));
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),c=require("./PDFMargin.js");function l(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const u=l(a),i=["bottom","left","right","top"];function g(t){const n=u.Children.toArray(t.children).find(e=>e&&e.type===c.PDFMargin);return n?s(n):t.margin}function s(t){const n={};for(let e=0;e<i.length;e++){const r=i[e],o=t.props[r];o!==void 0&&(n[r]=o)}return n}exports.getPageMargin=g;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as a from "react";
10
+ import { PDFMargin as s } from "./PDFMargin.mjs";
11
+ const i = ["bottom", "left", "right", "top"];
12
+ function l(e) {
13
+ const n = a.Children.toArray(e.children).find((t) => t && t.type === s);
14
+ return n ? f(n) : e.margin;
15
+ }
16
+ function f(e) {
17
+ const n = {};
18
+ for (let t = 0; t < i.length; t++) {
19
+ const r = i[t], o = e.props[r];
20
+ o !== void 0 && (n[r] = o);
21
+ }
22
+ return n;
23
+ }
24
+ export {
25
+ l as getPageMargin
26
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),e=require("prop-types"),g=require("../getPageMargin.js"),u=require("../savePDF.js"),c=require("./provideSaveGridPDF.js");function l(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>n[t]})}}return r.default=n,Object.freeze(r)}const s=l(p),o=class o extends s.Component{constructor(r){super(r),this.saveGridPDF=c.provideSaveGridPDF(this.getSavePDF())}render(){return null}save(r,t){this.saveGridPDF(this.getGrid(),Object.assign({},this.props,{margin:g.getPageMargin(this.props)}),t,r,this.getCustomColumns())}getSavePDF(){return u.savePDF}getGrid(){return s.Children.toArray(this.props.children).find(r=>r&&r.type.displayName==="KendoReactGrid")}getCustomColumns(){return s.Children.toArray(this.props.children).filter(r=>r&&r.type.displayName==="KendoReactGridColumn")}};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};let i=o;exports.GridPDFExport=i;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as t from "react";
10
+ import e from "prop-types";
11
+ import { getPageMargin as i } from "../getPageMargin.mjs";
12
+ import { savePDF as a } from "../savePDF.mjs";
13
+ import { provideSaveGridPDF as p } from "./provideSaveGridPDF.mjs";
14
+ const n = class n extends t.Component {
15
+ constructor(r) {
16
+ super(r), this.saveGridPDF = p(this.getSavePDF());
17
+ }
18
+ /**
19
+ * @hidden
20
+ */
21
+ render() {
22
+ return null;
23
+ }
24
+ /* eslint-disable max-len */
25
+ /**
26
+ * Saves the content of the Grid as a PDF file.
27
+ *
28
+ * @param data - The data can be different from the currently displayed data in the Grid. Can be used to export all Grid pages.
29
+ * @param callback - The callback that will be executed after the PDF is saved.
30
+ */
31
+ // tslint:enable:max-line-length
32
+ save(r, o) {
33
+ this.saveGridPDF(
34
+ this.getGrid(),
35
+ Object.assign({}, this.props, { margin: i(this.props) }),
36
+ o,
37
+ r,
38
+ this.getCustomColumns()
39
+ );
40
+ }
41
+ getSavePDF() {
42
+ return a;
43
+ }
44
+ getGrid() {
45
+ return t.Children.toArray(this.props.children).find((r) => r && r.type.displayName === "KendoReactGrid");
46
+ }
47
+ getCustomColumns() {
48
+ return t.Children.toArray(this.props.children).filter((r) => r && r.type.displayName === "KendoReactGridColumn");
49
+ }
50
+ };
51
+ n.propTypes = {
52
+ author: e.string,
53
+ avoidLinks: e.oneOfType([e.bool, e.string]),
54
+ forcePageBreak: e.string,
55
+ keepTogether: e.string,
56
+ creator: e.string,
57
+ date: e.instanceOf(Date),
58
+ imageResolution: e.number,
59
+ fileName: e.string,
60
+ forceProxy: e.bool,
61
+ keywords: e.string,
62
+ landscape: e.bool,
63
+ margin: e.oneOfType([e.string, e.number, e.shape({
64
+ left: e.oneOfType([e.number, e.string]),
65
+ top: e.oneOfType([e.number, e.string]),
66
+ right: e.oneOfType([e.number, e.string]),
67
+ bottom: e.oneOfType([e.number, e.string])
68
+ })]),
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
79
+ };
80
+ let s = n;
81
+ export {
82
+ s as GridPDFExport
83
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./grid-query.js"),c=require("../common/utils.js"),d=n=>{const e=new a.GridQuery(n),t=e.content();let o;if(t){const l=[t.querySelector("colgroup")],s=[e.header().querySelector("thead")],u=[t.querySelector("tbody")],r=e.footer(),i=r?[r.querySelector("tfoot")]:[];o=c.createTable(l,s,u,i)}else o=c.wrapTable(e.table().cloneNode(!0));return o};exports.exportElement=d;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import { GridQuery as a } from "./grid-query.mjs";
10
+ import { createTable as d, wrapTable as f } from "../common/utils.mjs";
11
+ const i = (c) => {
12
+ const e = new a(c), o = e.content();
13
+ let t;
14
+ if (o) {
15
+ const n = [o.querySelector("colgroup")], l = [e.header().querySelector("thead")], s = [o.querySelector("tbody")], r = e.footer(), u = r ? [r.querySelector("tfoot")] : [];
16
+ t = d(n, l, s, u);
17
+ } else
18
+ t = f(e.table().cloneNode(!0));
19
+ return t;
20
+ };
21
+ export {
22
+ i as exportElement
23
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../common/dom-queries.js"),s="k-grid-header",r="k-grid-footer",a="TABLE",o=e.matchesNodeName(a),i=n=>n?"locked":"wrap";class l{constructor(t){this.element=t,this.list=e.findElement(t,e.matchesClasses("k-grid-container"))}content(t){return e.findElement(this.list,e.matchesClasses(`k-grid-content${t?"-locked":""}`))}header(t){return this.headerWrap=this.headerWrap||e.findElement(this.element,e.matchesClasses(s)),e.findElement(this.headerWrap,e.matchesClasses(`${s}-${i(t)}`))}footer(t){return this.footerWrap=this.footerWrap||e.findElement(this.element,e.matchesClasses(r)),e.findElement(this.footerWrap,e.matchesClasses(`${r}-${i(t)}`))}table(){return e.findElement(this.element,o)}}exports.FOOTER_CLASS=r;exports.GridQuery=l;exports.HEADER_CLASS=s;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import { matchesNodeName as a, findElement as t, matchesClasses as r } from "../common/dom-queries.mjs";
10
+ const o = "k-grid-header", i = "k-grid-footer", h = "TABLE", c = a(h), n = (s) => s ? "locked" : "wrap";
11
+ class l {
12
+ constructor(e) {
13
+ this.element = e, this.list = t(e, r("k-grid-container"));
14
+ }
15
+ content(e) {
16
+ return t(this.list, r(`k-grid-content${e ? "-locked" : ""}`));
17
+ }
18
+ header(e) {
19
+ return this.headerWrap = this.headerWrap || t(this.element, r(o)), t(this.headerWrap, r(`${o}-${n(e)}`));
20
+ }
21
+ footer(e) {
22
+ return this.footerWrap = this.footerWrap || t(this.element, r(i)), t(this.footerWrap, r(`${i}-${n(e)}`));
23
+ }
24
+ table() {
25
+ return t(this.element, c);
26
+ }
27
+ }
28
+ export {
29
+ i as FOOTER_CLASS,
30
+ l as GridQuery,
31
+ o as HEADER_CLASS
32
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react-dom"),O=require("react"),E=require("./export-element.js");function s(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const P=s(h),a=s(O);function x(t){return(e,n={},r,o,l)=>D(t,e,n,r,o,l)}function D(t,e,n={},r,o,l){let i,d,c;m();function m(){i=document.createElement("div"),i.setAttribute("style","position:absolute; left: -5000px; top: 0px;"),d=document.createElement("div"),i.appendChild(d),document.body.appendChild(i),P.render(g(),d,f)}function f(){t(b(),n,y)}function y(){document.body.removeChild(i),document.body.removeChild(c),i=c=void 0,r&&r()}function b(){c=document.createElement("div"),c.className="k-grid-pdf-export-element";const p=E.exportElement(d);return c.appendChild(p),document.body.appendChild(c),p}function g(){const p=o&&{data:o,total:o.length,pageSize:o.length,skip:0},v={style:Object.assign({},e.props.style,{width:"1000px"})},u=Object.assign({},p,v);if(l&&l.length>0){const C=G(e);return a.cloneElement(e,u,l.concat(C))}else return a.cloneElement(e,u)}}function G(t){return a.Children.toArray(t.props.children).filter(e=>e&&e.type&&e.type.displayName!=="KendoReactGridColumn")}exports.provideSaveGridPDF=x;