@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.
- package/KendoDrawingAdapter.js +8 -0
- package/KendoDrawingAdapter.mjs +65 -0
- package/PDFExport.js +8 -0
- package/PDFExport.mjs +79 -0
- package/PDFMargin.js +8 -0
- package/PDFMargin.mjs +25 -0
- package/common/dom-queries.js +8 -0
- package/common/dom-queries.mjs +31 -0
- package/common/table-query.js +8 -0
- package/common/table-query.mjs +32 -0
- package/common/utils.js +8 -0
- package/common/utils.mjs +46 -0
- package/dist/cdn/js/kendo-react-pdf.js +8 -5
- package/getPageMargin.js +8 -0
- package/getPageMargin.mjs +26 -0
- package/grid/GridPDFExport.js +8 -0
- package/grid/GridPDFExport.mjs +83 -0
- package/grid/export-element.js +8 -0
- package/grid/export-element.mjs +23 -0
- package/grid/grid-query.js +8 -0
- package/grid/grid-query.mjs +32 -0
- package/grid/provideSaveGridPDF.js +8 -0
- package/grid/provideSaveGridPDF.mjs +53 -0
- package/index.d.mts +439 -5
- package/index.d.ts +439 -14
- package/index.js +8 -5
- package/index.mjs +21 -476
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +2 -2
- package/savePDF.js +8 -0
- package/savePDF.mjs +23 -0
- package/treelist/TreeListPDFExport.js +8 -0
- package/treelist/TreeListPDFExport.mjs +84 -0
- package/treelist/export-element.js +8 -0
- package/treelist/export-element.mjs +23 -0
- package/treelist/provideSaveTreeListPDF.js +8 -0
- package/treelist/provideSaveTreeListPDF.mjs +46 -0
- package/KendoDrawingAdapter.d.ts +0 -24
- package/PDFExport.d.ts +0 -57
- package/PDFExportProps.d.ts +0 -127
- package/PDFMargin.d.ts +0 -71
- package/PageTemplateProps.d.ts +0 -17
- package/common/dom-queries.d.ts +0 -48
- package/common/table-query.d.ts +0 -26
- package/common/utils.d.ts +0 -24
- package/getPageMargin.d.ts +0 -10
- package/grid/GridPDFExport.d.ts +0 -70
- package/grid/export-element.d.ts +0 -8
- package/grid/grid-query.d.ts +0 -26
- package/grid/provideSaveGridPDF.d.ts +0 -9
- package/package-metadata.d.ts +0 -9
- package/savePDF.d.ts +0 -13
- package/treelist/TreeListPDFExport.d.ts +0 -75
- package/treelist/export-element.d.ts +0 -8
- package/treelist/provideSaveTreeListPDF.d.ts +0 -9
package/index.mjs
CHANGED
|
@@ -1,479 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
*/
|
|
5
8
|
"use client";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
class $ extends d.Component {
|
|
14
|
-
render() {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
$.propTypes = {
|
|
19
|
-
left: e.oneOfType([e.number, e.string]),
|
|
20
|
-
top: e.oneOfType([e.number, e.string]),
|
|
21
|
-
right: e.oneOfType([e.number, e.string]),
|
|
22
|
-
bottom: e.oneOfType([e.number, e.string])
|
|
23
|
-
};
|
|
24
|
-
const x = ["bottom", "left", "right", "top"];
|
|
25
|
-
function D(r) {
|
|
26
|
-
const t = d.Children.toArray(r.children).find((o) => o && o.type === $);
|
|
27
|
-
return t ? z(t) : r.margin;
|
|
28
|
-
}
|
|
29
|
-
function z(r) {
|
|
30
|
-
const t = {};
|
|
31
|
-
for (let o = 0; o < x.length; o++) {
|
|
32
|
-
const n = x[o], s = r.props[n];
|
|
33
|
-
s !== void 0 && (t[n] = s);
|
|
34
|
-
}
|
|
35
|
-
return t;
|
|
36
|
-
}
|
|
37
|
-
const K = "export.pdf", Q = "KendoReact PDF Generator";
|
|
38
|
-
class j {
|
|
39
|
-
constructor(t, o, n, s, i = {}) {
|
|
40
|
-
this.drawDOM = t, this.exportPDF = o, this.saveAs = n, this.domElement = s, this.options = i, this.convertPageTemplateToHtml = (p) => `<span>${H.renderToStaticMarkup(
|
|
41
|
-
d.createElement(this.options.pageTemplate, {
|
|
42
|
-
pageNum: p.pageNum,
|
|
43
|
-
totalPages: p.totalPages
|
|
44
|
-
})
|
|
45
|
-
)}</span>`;
|
|
46
|
-
}
|
|
47
|
-
savePDF(t) {
|
|
48
|
-
const o = this.drawDOM(this.domElement, this.getDrawOptions()).then((n) => this.exportPDF(n, this.getPDFOptions())).then((n) => this.saveAs(n, this.options.fileName || K, this.getSaveOptions()));
|
|
49
|
-
t && o.then(t, t);
|
|
50
|
-
}
|
|
51
|
-
getDrawOptions() {
|
|
52
|
-
return {
|
|
53
|
-
avoidLinks: this.options.avoidLinks,
|
|
54
|
-
forcePageBreak: this.options.forcePageBreak,
|
|
55
|
-
keepTogether: this.options.keepTogether,
|
|
56
|
-
margin: this.options.margin,
|
|
57
|
-
paperSize: this.options.paperSize,
|
|
58
|
-
landscape: this.options.landscape,
|
|
59
|
-
repeatHeaders: this.options.repeatHeaders,
|
|
60
|
-
scale: this.options.scale,
|
|
61
|
-
template: this.options.pageTemplate && this.convertPageTemplateToHtml
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
getPDFOptions() {
|
|
65
|
-
return {
|
|
66
|
-
author: this.options.author,
|
|
67
|
-
creator: this.options.creator || Q,
|
|
68
|
-
date: this.options.date,
|
|
69
|
-
imgDPI: this.options.imageResolution,
|
|
70
|
-
keywords: this.options.keywords,
|
|
71
|
-
landscape: this.options.landscape,
|
|
72
|
-
margin: this.options.margin,
|
|
73
|
-
multiPage: !0,
|
|
74
|
-
paperSize: this.options.paperSize,
|
|
75
|
-
producer: this.options.producer,
|
|
76
|
-
subject: this.options.subject,
|
|
77
|
-
title: this.options.title
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
getSaveOptions() {
|
|
81
|
-
return {
|
|
82
|
-
forceProxy: this.options.forceProxy,
|
|
83
|
-
proxyData: this.options.proxyData,
|
|
84
|
-
proxyTarget: this.options.proxyTarget,
|
|
85
|
-
proxyURL: this.options.proxyURL
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const V = {
|
|
90
|
-
name: "@progress/kendo-react-pdf",
|
|
91
|
-
productName: "KendoReact",
|
|
92
|
-
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
93
|
-
publishDate: 1709631957,
|
|
94
|
-
version: "",
|
|
95
|
-
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
96
|
-
};
|
|
97
|
-
class X extends d.Component {
|
|
98
|
-
constructor(t) {
|
|
99
|
-
super(t), this.rootElForPDF = null, _(V);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* @hidden
|
|
103
|
-
*/
|
|
104
|
-
render() {
|
|
105
|
-
return /* @__PURE__ */ d.createElement("div", { ref: (t) => {
|
|
106
|
-
this.rootElForPDF = t;
|
|
107
|
-
} }, this.props.children);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Saves the content as a PDF file.
|
|
111
|
-
*
|
|
112
|
-
* @param callback - The callback to be executed after the PDF is saved.
|
|
113
|
-
*/
|
|
114
|
-
save(t) {
|
|
115
|
-
new j(
|
|
116
|
-
A,
|
|
117
|
-
R,
|
|
118
|
-
G,
|
|
119
|
-
this.rootElForPDF,
|
|
120
|
-
this.getOptions()
|
|
121
|
-
).savePDF(t);
|
|
122
|
-
}
|
|
123
|
-
getOptions() {
|
|
124
|
-
return Object.assign({}, this.props, { margin: D(this.props) });
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
X.propTypes = {
|
|
128
|
-
author: e.string,
|
|
129
|
-
avoidLinks: e.oneOfType([e.bool, e.string]),
|
|
130
|
-
forcePageBreak: e.string,
|
|
131
|
-
keepTogether: e.string,
|
|
132
|
-
creator: e.string,
|
|
133
|
-
date: e.instanceOf(Date),
|
|
134
|
-
imageResolution: e.number,
|
|
135
|
-
fileName: e.string,
|
|
136
|
-
forceProxy: e.bool,
|
|
137
|
-
keywords: e.string,
|
|
138
|
-
landscape: e.bool,
|
|
139
|
-
margin: e.oneOfType([e.string, e.number, e.shape({
|
|
140
|
-
left: e.oneOfType([e.number, e.string]),
|
|
141
|
-
top: e.oneOfType([e.number, e.string]),
|
|
142
|
-
right: e.oneOfType([e.number, e.string]),
|
|
143
|
-
bottom: e.oneOfType([e.number, e.string])
|
|
144
|
-
})]),
|
|
145
|
-
pageTemplate: e.any,
|
|
146
|
-
paperSize: e.any,
|
|
147
|
-
repeatHeaders: e.bool,
|
|
148
|
-
scale: e.number,
|
|
149
|
-
proxyData: e.any,
|
|
150
|
-
proxyURL: e.string,
|
|
151
|
-
proxyTarget: e.string,
|
|
152
|
-
producer: e.string,
|
|
153
|
-
subject: e.string,
|
|
154
|
-
title: e.string
|
|
155
|
-
};
|
|
156
|
-
function M(r, t = {}, o) {
|
|
157
|
-
new j(
|
|
158
|
-
A,
|
|
159
|
-
R,
|
|
160
|
-
G,
|
|
161
|
-
r,
|
|
162
|
-
t
|
|
163
|
-
).savePDF(o);
|
|
164
|
-
}
|
|
165
|
-
const P = {}, E = (r) => String(r).trim().split(" "), J = (r, t) => {
|
|
166
|
-
const o = E(t);
|
|
167
|
-
return !!E(r.className).find((n) => o.indexOf(n) >= 0);
|
|
168
|
-
}, u = (r) => (t) => J(t, r), I = (r) => (P[r] || (P[r] = (t) => String(t.nodeName).toLowerCase() === r.toLowerCase()), P[r]), c = (r, t, o = !0) => {
|
|
169
|
-
if (r) {
|
|
170
|
-
if (o && t(r))
|
|
171
|
-
return r;
|
|
172
|
-
for (r = r.firstChild; r; ) {
|
|
173
|
-
if (r.nodeType === 1) {
|
|
174
|
-
const n = c(r, t);
|
|
175
|
-
if (n)
|
|
176
|
-
return n;
|
|
177
|
-
}
|
|
178
|
-
r = r.nextSibling;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}, S = "k-grid-header", k = "k-grid-footer", Y = "TABLE", Z = I(Y), F = (r) => r ? "locked" : "wrap";
|
|
182
|
-
let ee = class {
|
|
183
|
-
constructor(t) {
|
|
184
|
-
this.element = t, this.list = c(t, u("k-grid-container"));
|
|
185
|
-
}
|
|
186
|
-
content(t) {
|
|
187
|
-
return c(this.list, u(`k-grid-content${t ? "-locked" : ""}`));
|
|
188
|
-
}
|
|
189
|
-
header(t) {
|
|
190
|
-
return this.headerWrap = this.headerWrap || c(this.element, u(S)), c(this.headerWrap, u(`${S}-${F(t)}`));
|
|
191
|
-
}
|
|
192
|
-
footer(t) {
|
|
193
|
-
return this.footerWrap = this.footerWrap || c(this.element, u(k)), c(this.footerWrap, u(`${k}-${F(t)}`));
|
|
194
|
-
}
|
|
195
|
-
table() {
|
|
196
|
-
return c(this.element, Z);
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
const w = "k-first", te = "k-grid-header", re = "k-grid-footer", U = (r, t) => {
|
|
200
|
-
const o = t.length;
|
|
201
|
-
for (let n = 0; n < o; n++)
|
|
202
|
-
r.appendChild(t[n].cloneNode(!0));
|
|
203
|
-
}, v = (r) => {
|
|
204
|
-
const t = document.createElement("div");
|
|
205
|
-
return t.className = "k-grid k-grid-md", t.appendChild(r), t;
|
|
206
|
-
}, O = (r) => {
|
|
207
|
-
const t = r.length, o = r[0].cloneNode(!0), n = o.rows.length;
|
|
208
|
-
if (t > 1)
|
|
209
|
-
for (let s = 0; s < n; s++)
|
|
210
|
-
for (let i = 1; i < t; i++)
|
|
211
|
-
U(o.rows[s], r[i].rows[s].cells);
|
|
212
|
-
return o;
|
|
213
|
-
}, oe = (r, t) => {
|
|
214
|
-
if (t.length > 1 && r.rows.length > 1)
|
|
215
|
-
for (let o = 1; o < r.rows.length; o++) {
|
|
216
|
-
const n = t[0].rows[o].cells.length, s = r.rows[o].cells[n];
|
|
217
|
-
String(s.className).indexOf(w) === -1 && (s.className += ` ${w}`);
|
|
218
|
-
}
|
|
219
|
-
}, q = (r, t, o, n) => {
|
|
220
|
-
const s = document.createElement("table"), i = r[0].cloneNode(!0);
|
|
221
|
-
for (let a = 1; a < r.length; a++)
|
|
222
|
-
U(i, r[a].querySelectorAll("col"));
|
|
223
|
-
const p = O(t), l = O(o);
|
|
224
|
-
if (p.className = te, oe(p, t), s.appendChild(i), s.appendChild(p), s.appendChild(l), n.length) {
|
|
225
|
-
const a = O(n);
|
|
226
|
-
a.className = re, s.appendChild(a);
|
|
227
|
-
}
|
|
228
|
-
return v(s);
|
|
229
|
-
}, ne = (r) => {
|
|
230
|
-
const t = new ee(r), o = t.content();
|
|
231
|
-
let n;
|
|
232
|
-
if (o) {
|
|
233
|
-
const s = [o.querySelector("colgroup")], i = [t.header().querySelector("thead")], p = [o.querySelector("tbody")], l = t.footer(), a = l ? [l.querySelector("tfoot")] : [];
|
|
234
|
-
n = q(s, i, p, a);
|
|
235
|
-
} else
|
|
236
|
-
n = v(t.table().cloneNode(!0));
|
|
237
|
-
return n;
|
|
238
|
-
};
|
|
239
|
-
function se(r) {
|
|
240
|
-
return (t, o = {}, n, s, i) => ie(
|
|
241
|
-
r,
|
|
242
|
-
t,
|
|
243
|
-
o,
|
|
244
|
-
n,
|
|
245
|
-
s,
|
|
246
|
-
i
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
function ie(r, t, o = {}, n, s, i) {
|
|
250
|
-
let p, l, a;
|
|
251
|
-
g();
|
|
252
|
-
function g() {
|
|
253
|
-
p = document.createElement("div"), p.setAttribute("style", "position:absolute; left: -5000px; top: 0px;"), l = document.createElement("div"), p.appendChild(l), document.body.appendChild(p), W.render(T(), l, f);
|
|
254
|
-
}
|
|
255
|
-
function f() {
|
|
256
|
-
r(b(), o, y);
|
|
257
|
-
}
|
|
258
|
-
function y() {
|
|
259
|
-
document.body.removeChild(p), document.body.removeChild(a), p = a = void 0, n && n();
|
|
260
|
-
}
|
|
261
|
-
function b() {
|
|
262
|
-
a = document.createElement("div"), a.className = "k-grid-pdf-export-element";
|
|
263
|
-
const h = ne(l);
|
|
264
|
-
return a.appendChild(h), document.body.appendChild(a), h;
|
|
265
|
-
}
|
|
266
|
-
function T() {
|
|
267
|
-
const h = s && { data: s, total: s.length, pageSize: s.length, skip: 0 }, C = { style: Object.assign({}, t.props.style, { width: "1000px" }) }, m = Object.assign({}, h, C);
|
|
268
|
-
if (i && i.length > 0) {
|
|
269
|
-
const B = ae(t);
|
|
270
|
-
return d.cloneElement(t, m, i.concat(B));
|
|
271
|
-
} else
|
|
272
|
-
return d.cloneElement(t, m);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
function ae(r) {
|
|
276
|
-
return d.Children.toArray(r.props.children).filter((t) => t && t.type && t.type.displayName !== "KendoReactGridColumn");
|
|
277
|
-
}
|
|
278
|
-
class pe extends d.Component {
|
|
279
|
-
constructor(t) {
|
|
280
|
-
super(t), this.saveGridPDF = se(this.getSavePDF());
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* @hidden
|
|
284
|
-
*/
|
|
285
|
-
render() {
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
/* eslint-disable max-len */
|
|
289
|
-
/**
|
|
290
|
-
* Saves the content of the Grid as a PDF file.
|
|
291
|
-
*
|
|
292
|
-
* @param data - The data can be different from the currently displayed data in the Grid. Can be used to export all Grid pages.
|
|
293
|
-
* @param callback - The callback that will be executed after the PDF is saved.
|
|
294
|
-
*/
|
|
295
|
-
// tslint:enable:max-line-length
|
|
296
|
-
save(t, o) {
|
|
297
|
-
this.saveGridPDF(
|
|
298
|
-
this.getGrid(),
|
|
299
|
-
Object.assign({}, this.props, { margin: D(this.props) }),
|
|
300
|
-
o,
|
|
301
|
-
t,
|
|
302
|
-
this.getCustomColumns()
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
getSavePDF() {
|
|
306
|
-
return M;
|
|
307
|
-
}
|
|
308
|
-
getGrid() {
|
|
309
|
-
return d.Children.toArray(this.props.children).find((t) => t && t.type.displayName === "KendoReactGrid");
|
|
310
|
-
}
|
|
311
|
-
getCustomColumns() {
|
|
312
|
-
return d.Children.toArray(this.props.children).filter((t) => t && t.type.displayName === "KendoReactGridColumn");
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
pe.propTypes = {
|
|
316
|
-
author: e.string,
|
|
317
|
-
avoidLinks: e.oneOfType([e.bool, e.string]),
|
|
318
|
-
forcePageBreak: e.string,
|
|
319
|
-
keepTogether: e.string,
|
|
320
|
-
creator: e.string,
|
|
321
|
-
date: e.instanceOf(Date),
|
|
322
|
-
imageResolution: e.number,
|
|
323
|
-
fileName: e.string,
|
|
324
|
-
forceProxy: e.bool,
|
|
325
|
-
keywords: e.string,
|
|
326
|
-
landscape: e.bool,
|
|
327
|
-
margin: e.oneOfType([e.string, e.number, e.shape({
|
|
328
|
-
left: e.oneOfType([e.number, e.string]),
|
|
329
|
-
top: e.oneOfType([e.number, e.string]),
|
|
330
|
-
right: e.oneOfType([e.number, e.string]),
|
|
331
|
-
bottom: e.oneOfType([e.number, e.string])
|
|
332
|
-
})]),
|
|
333
|
-
pageTemplate: e.any,
|
|
334
|
-
paperSize: e.any,
|
|
335
|
-
repeatHeaders: e.bool,
|
|
336
|
-
scale: e.number,
|
|
337
|
-
proxyData: e.any,
|
|
338
|
-
proxyURL: e.string,
|
|
339
|
-
proxyTarget: e.string,
|
|
340
|
-
producer: e.string,
|
|
341
|
-
subject: e.string,
|
|
342
|
-
title: e.string
|
|
343
|
-
};
|
|
344
|
-
const L = "k-grid-header", N = "k-grid-footer", le = "TABLE", ce = I(le);
|
|
345
|
-
class de {
|
|
346
|
-
constructor(t) {
|
|
347
|
-
this.element = t, this.list = c(t, u("k-grid"));
|
|
348
|
-
}
|
|
349
|
-
content() {
|
|
350
|
-
return c(this.list, u("k-grid"));
|
|
351
|
-
}
|
|
352
|
-
header() {
|
|
353
|
-
return this.headerWrap = this.headerWrap || c(this.element, u(L)), c(this.headerWrap, u(`${L}`));
|
|
354
|
-
}
|
|
355
|
-
footer() {
|
|
356
|
-
return this.footerWrap = this.footerWrap || c(this.element, u(N)), c(this.footerWrap, u(`${N}`));
|
|
357
|
-
}
|
|
358
|
-
table() {
|
|
359
|
-
return c(this.element, ce);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
const ue = (r) => {
|
|
363
|
-
const t = new de(r), o = t.content();
|
|
364
|
-
let n, s = t.header();
|
|
365
|
-
if (s.childNodes.length > 1 && s.removeChild(s.childNodes[1]), s.childNodes[0].childNodes.forEach((i) => i.style.top = 0), o) {
|
|
366
|
-
const i = [o.querySelector("colgroup")], p = [s], l = [o.querySelector("tbody")], a = t.footer(), g = a ? [a.querySelector("tfoot")] : [];
|
|
367
|
-
n = q(i, p, l, g);
|
|
368
|
-
} else
|
|
369
|
-
n = v(t.table().cloneNode(!0));
|
|
370
|
-
return n;
|
|
371
|
-
};
|
|
372
|
-
function he(r) {
|
|
373
|
-
return (t, o = {}, n, s, i) => ge(
|
|
374
|
-
r,
|
|
375
|
-
t,
|
|
376
|
-
o,
|
|
377
|
-
n,
|
|
378
|
-
s,
|
|
379
|
-
i
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
function ge(r, t, o = {}, n, s, i) {
|
|
383
|
-
let p, l, a;
|
|
384
|
-
g();
|
|
385
|
-
function g() {
|
|
386
|
-
p = document.createElement("div"), p.setAttribute("style", "position:absolute; left: -5000px; top: 0px;"), l = document.createElement("div"), p.appendChild(l), document.body.appendChild(p), W.render(T(), l, f);
|
|
387
|
-
}
|
|
388
|
-
function f() {
|
|
389
|
-
r(b(), o, y);
|
|
390
|
-
}
|
|
391
|
-
function y() {
|
|
392
|
-
document.body.removeChild(p), document.body.removeChild(a), p = a = void 0, n && n();
|
|
393
|
-
}
|
|
394
|
-
function b() {
|
|
395
|
-
a = document.createElement("div"), a.className = "k-treelist-pdf-export-element";
|
|
396
|
-
const h = ue(l);
|
|
397
|
-
return a.appendChild(h), document.body.appendChild(a), a;
|
|
398
|
-
}
|
|
399
|
-
function T() {
|
|
400
|
-
const h = o.allPages && s ? { data: s, take: Number.MAX_VALUE, skip: 0 } : {}, C = { style: Object.assign({}, t.props.style, { width: "1000px" }) }, m = Object.assign({}, h, C);
|
|
401
|
-
return i && i.length > 0 ? d.cloneElement(t, Object.assign({}, m, { columns: i })) : d.cloneElement(t, m);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
class me extends d.Component {
|
|
405
|
-
constructor(t) {
|
|
406
|
-
super(t), this.saveTreeListPDF = he(this.getSavePDF());
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* @hidden
|
|
410
|
-
*/
|
|
411
|
-
render() {
|
|
412
|
-
return null;
|
|
413
|
-
}
|
|
414
|
-
/* eslint-disable max-len */
|
|
415
|
-
/**
|
|
416
|
-
* Saves the content of the TreeList as a PDF file.
|
|
417
|
-
*
|
|
418
|
-
* @param data - The data that will be exported to the PDF. The data can be different from the currently displayed data in the TreeList.
|
|
419
|
-
* @param columns - The columns that will be exported to the PDF. The columns collection can be different from the currently displayed in the TreeList.
|
|
420
|
-
* @param callback - The callback that will be executed after the PDF is saved.
|
|
421
|
-
*/
|
|
422
|
-
// tslint:enable:max-line-length
|
|
423
|
-
save(t, o, n) {
|
|
424
|
-
this.saveTreeListPDF(
|
|
425
|
-
this.getTreeList(),
|
|
426
|
-
Object.assign({}, this.props, { margin: D(this.props) }),
|
|
427
|
-
n,
|
|
428
|
-
t,
|
|
429
|
-
o || []
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
getSavePDF() {
|
|
433
|
-
return M;
|
|
434
|
-
}
|
|
435
|
-
getTreeList() {
|
|
436
|
-
const t = this.props.children;
|
|
437
|
-
if (t && t.props.data && t.props.columns)
|
|
438
|
-
return this.props.children;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
me.propTypes = {
|
|
442
|
-
author: e.string,
|
|
443
|
-
avoidLinks: e.oneOfType([e.bool, e.string]),
|
|
444
|
-
forcePageBreak: e.string,
|
|
445
|
-
keepTogether: e.string,
|
|
446
|
-
creator: e.string,
|
|
447
|
-
date: e.instanceOf(Date),
|
|
448
|
-
imageResolution: e.number,
|
|
449
|
-
fileName: e.string,
|
|
450
|
-
forceProxy: e.bool,
|
|
451
|
-
keywords: e.string,
|
|
452
|
-
landscape: e.bool,
|
|
453
|
-
margin: e.oneOfType([e.string, e.number, e.shape({
|
|
454
|
-
left: e.oneOfType([e.number, e.string]),
|
|
455
|
-
top: e.oneOfType([e.number, e.string]),
|
|
456
|
-
right: e.oneOfType([e.number, e.string]),
|
|
457
|
-
bottom: e.oneOfType([e.number, e.string])
|
|
458
|
-
})]),
|
|
459
|
-
pageTemplate: e.any,
|
|
460
|
-
paperSize: e.any,
|
|
461
|
-
repeatHeaders: e.bool,
|
|
462
|
-
scale: e.number,
|
|
463
|
-
proxyData: e.any,
|
|
464
|
-
proxyURL: e.string,
|
|
465
|
-
proxyTarget: e.string,
|
|
466
|
-
producer: e.string,
|
|
467
|
-
subject: e.string,
|
|
468
|
-
title: e.string,
|
|
469
|
-
allPages: e.bool
|
|
470
|
-
};
|
|
9
|
+
import { PDFExport as e } from "./PDFExport.mjs";
|
|
10
|
+
import { PDFMargin as p } from "./PDFMargin.mjs";
|
|
11
|
+
import { savePDF as a } from "./savePDF.mjs";
|
|
12
|
+
import { getPageMargin as m } from "./getPageMargin.mjs";
|
|
13
|
+
import { GridPDFExport as D } from "./grid/GridPDFExport.mjs";
|
|
14
|
+
import { TreeListPDFExport as g } from "./treelist/TreeListPDFExport.mjs";
|
|
15
|
+
import { default as F } from "./KendoDrawingAdapter.mjs";
|
|
471
16
|
export {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
17
|
+
D as GridPDFExport,
|
|
18
|
+
F as KendoDrawingAdapter,
|
|
19
|
+
e as PDFExport,
|
|
20
|
+
p as PDFMargin,
|
|
21
|
+
g as TreeListPDFExport,
|
|
22
|
+
m as getPageMargin,
|
|
23
|
+
a as savePDF
|
|
479
24
|
};
|
|
@@ -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={name:"@progress/kendo-react-pdf",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 e = {
|
|
10
|
+
name: "@progress/kendo-react-pdf",
|
|
11
|
+
productName: "KendoReact",
|
|
12
|
+
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
+
publishDate: 1709715408,
|
|
14
|
+
version: "",
|
|
15
|
+
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
e as packageMetadata
|
|
19
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-pdf",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0-develop.1",
|
|
4
4
|
"description": "React PDF Processing enables you to export single- and multi-page content in PDF. KendoReact PDF Processing package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@progress/kendo-drawing": "^1.19.0",
|
|
26
26
|
"@progress/kendo-file-saver": "^1.0.1",
|
|
27
27
|
"@progress/kendo-licensing": "^1.3.4",
|
|
28
|
-
"@progress/kendo-react-common": "7.
|
|
28
|
+
"@progress/kendo-react-common": "7.3.0-develop.1",
|
|
29
29
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
30
30
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
31
31
|
},
|
package/savePDF.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 e=require("@progress/kendo-drawing"),o=require("@progress/kendo-file-saver"),a=require("./KendoDrawingAdapter.js");function i(r,n={},t){new a(e.drawDOM,e.exportPDF,o.saveAs,r,n).savePDF(t)}exports.savePDF=i;
|
package/savePDF.mjs
ADDED
|
@@ -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 { drawDOM as t, exportPDF as a } from "@progress/kendo-drawing";
|
|
10
|
+
import { saveAs as i } from "@progress/kendo-file-saver";
|
|
11
|
+
import m from "./KendoDrawingAdapter.mjs";
|
|
12
|
+
function D(r, e = {}, o) {
|
|
13
|
+
new m(
|
|
14
|
+
t,
|
|
15
|
+
a,
|
|
16
|
+
i,
|
|
17
|
+
r,
|
|
18
|
+
e
|
|
19
|
+
).savePDF(o);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
D as savePDF
|
|
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 a=require("react"),e=require("prop-types"),p=require("../getPageMargin.js"),g=require("../savePDF.js"),c=require("./provideSaveTreeListPDF.js");function u(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>n[r]})}}return t.default=n,Object.freeze(t)}const l=u(a),i=class i extends l.Component{constructor(t){super(t),this.saveTreeListPDF=c.provideSaveTreeListPDF(this.getSavePDF())}render(){return null}save(t,r,s){this.saveTreeListPDF(this.getTreeList(),Object.assign({},this.props,{margin:p.getPageMargin(this.props)}),s,t,r||[])}getSavePDF(){return g.savePDF}getTreeList(){const t=this.props.children;if(t&&t.props.data&&t.props.columns)return this.props.children}};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,allPages:e.bool};let o=i;exports.TreeListPDFExport=o;
|
|
@@ -0,0 +1,84 @@
|
|
|
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 i from "react";
|
|
10
|
+
import e from "prop-types";
|
|
11
|
+
import { getPageMargin as a } from "../getPageMargin.mjs";
|
|
12
|
+
import { savePDF as p } from "../savePDF.mjs";
|
|
13
|
+
import { provideSaveTreeListPDF as g } from "./provideSaveTreeListPDF.mjs";
|
|
14
|
+
const t = class t extends i.Component {
|
|
15
|
+
constructor(r) {
|
|
16
|
+
super(r), this.saveTreeListPDF = g(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 TreeList as a PDF file.
|
|
27
|
+
*
|
|
28
|
+
* @param data - The data that will be exported to the PDF. The data can be different from the currently displayed data in the TreeList.
|
|
29
|
+
* @param columns - The columns that will be exported to the PDF. The columns collection can be different from the currently displayed in the TreeList.
|
|
30
|
+
* @param callback - The callback that will be executed after the PDF is saved.
|
|
31
|
+
*/
|
|
32
|
+
// tslint:enable:max-line-length
|
|
33
|
+
save(r, n, o) {
|
|
34
|
+
this.saveTreeListPDF(
|
|
35
|
+
this.getTreeList(),
|
|
36
|
+
Object.assign({}, this.props, { margin: a(this.props) }),
|
|
37
|
+
o,
|
|
38
|
+
r,
|
|
39
|
+
n || []
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
getSavePDF() {
|
|
43
|
+
return p;
|
|
44
|
+
}
|
|
45
|
+
getTreeList() {
|
|
46
|
+
const r = this.props.children;
|
|
47
|
+
if (r && r.props.data && r.props.columns)
|
|
48
|
+
return this.props.children;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
t.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
|
+
allPages: e.bool
|
|
80
|
+
};
|
|
81
|
+
let s = t;
|
|
82
|
+
export {
|
|
83
|
+
s as TreeListPDFExport
|
|
84
|
+
};
|
|
@@ -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("../common/table-query.js"),s=require("../common/utils.js"),h=n=>{const t=new a.GridQuery(n),o=t.content();let r,e=t.header();if(e.childNodes.length>1&&e.removeChild(e.childNodes[1]),e.childNodes[0].childNodes.forEach(l=>l.style.top=0),o){const l=[o.querySelector("colgroup")],u=[e],d=[o.querySelector("tbody")],c=t.footer(),i=c?[c.querySelector("tfoot")]:[];r=s.createTable(l,u,d,i)}else r=s.wrapTable(t.table().cloneNode(!0));return r};exports.exportElement=h;
|