@progress/kendo-react-pdf 6.1.1 → 7.0.0-develop.2
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/npm/KendoDrawingAdapter.d.ts → KendoDrawingAdapter.d.ts} +4 -0
- package/LICENSE.md +1 -1
- package/{dist/npm/PDFExport.d.ts → PDFExport.d.ts} +5 -1
- package/{dist/es/PDFExportProps.d.ts → PDFExportProps.d.ts} +4 -1
- package/{dist/npm/PDFMargin.d.ts → PDFMargin.d.ts} +4 -0
- package/PageTemplateProps.d.ts +17 -0
- package/{dist/npm/common → common}/dom-queries.d.ts +4 -0
- package/{dist/npm/common → common}/table-query.d.ts +4 -0
- package/{dist/es/common → common}/utils.d.ts +4 -0
- package/dist/cdn/js/kendo-react-pdf.js +8 -1
- package/getPageMargin.d.ts +10 -0
- package/{dist/npm/grid → grid}/GridPDFExport.d.ts +4 -0
- package/grid/export-element.d.ts +8 -0
- package/{dist/es/grid → grid}/grid-query.d.ts +4 -0
- package/grid/provideSaveGridPDF.d.ts +9 -0
- package/index.d.ts +14 -0
- package/index.js +8 -0
- package/index.mjs +486 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +28 -35
- package/{dist/npm/savePDF.d.ts → savePDF.d.ts} +4 -0
- package/{dist/es/treelist → treelist}/TreeListPDFExport.d.ts +4 -0
- package/treelist/export-element.d.ts +8 -0
- package/treelist/provideSaveTreeListPDF.d.ts +9 -0
- package/about.md +0 -3
- package/dist/es/KendoDrawingAdapter.d.ts +0 -20
- package/dist/es/KendoDrawingAdapter.js +0 -72
- package/dist/es/PDFExport.d.ts +0 -53
- package/dist/es/PDFExport.js +0 -95
- package/dist/es/PDFExportProps.js +0 -2
- package/dist/es/PDFMargin.d.ts +0 -67
- package/dist/es/PDFMargin.js +0 -37
- package/dist/es/PageTemplateProps.d.ts +0 -13
- package/dist/es/PageTemplateProps.js +0 -1
- package/dist/es/common/dom-queries.d.ts +0 -44
- package/dist/es/common/dom-queries.js +0 -123
- package/dist/es/common/table-query.d.ts +0 -22
- package/dist/es/common/table-query.js +0 -36
- package/dist/es/common/utils.js +0 -74
- package/dist/es/getPageMargin.d.ts +0 -6
- package/dist/es/getPageMargin.js +0 -25
- package/dist/es/grid/GridPDFExport.d.ts +0 -66
- package/dist/es/grid/GridPDFExport.js +0 -97
- package/dist/es/grid/export-element.d.ts +0 -4
- package/dist/es/grid/export-element.js +0 -22
- package/dist/es/grid/grid-query.js +0 -37
- package/dist/es/grid/provideSaveGridPDF.d.ts +0 -5
- package/dist/es/grid/provideSaveGridPDF.js +0 -69
- package/dist/es/main.d.ts +0 -10
- package/dist/es/main.js +0 -8
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/savePDF.d.ts +0 -9
- package/dist/es/savePDF.js +0 -14
- package/dist/es/treelist/TreeListPDFExport.js +0 -93
- package/dist/es/treelist/export-element.d.ts +0 -4
- package/dist/es/treelist/export-element.js +0 -27
- package/dist/es/treelist/provideSaveTreeListPDF.d.ts +0 -5
- package/dist/es/treelist/provideSaveTreeListPDF.js +0 -62
- package/dist/npm/KendoDrawingAdapter.js +0 -74
- package/dist/npm/PDFExport.js +0 -98
- package/dist/npm/PDFExportProps.d.ts +0 -124
- package/dist/npm/PDFExportProps.js +0 -3
- package/dist/npm/PDFMargin.js +0 -40
- package/dist/npm/PageTemplateProps.d.ts +0 -13
- package/dist/npm/PageTemplateProps.js +0 -2
- package/dist/npm/common/dom-queries.js +0 -137
- package/dist/npm/common/table-query.js +0 -39
- package/dist/npm/common/utils.d.ts +0 -20
- package/dist/npm/common/utils.js +0 -82
- package/dist/npm/getPageMargin.d.ts +0 -6
- package/dist/npm/getPageMargin.js +0 -29
- package/dist/npm/grid/GridPDFExport.js +0 -100
- package/dist/npm/grid/export-element.d.ts +0 -4
- package/dist/npm/grid/export-element.js +0 -26
- package/dist/npm/grid/grid-query.d.ts +0 -22
- package/dist/npm/grid/grid-query.js +0 -40
- package/dist/npm/grid/provideSaveGridPDF.d.ts +0 -5
- package/dist/npm/grid/provideSaveGridPDF.js +0 -73
- package/dist/npm/main.d.ts +0 -10
- package/dist/npm/main.js +0 -17
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/savePDF.js +0 -18
- package/dist/npm/treelist/TreeListPDFExport.d.ts +0 -71
- package/dist/npm/treelist/TreeListPDFExport.js +0 -96
- package/dist/npm/treelist/export-element.d.ts +0 -4
- package/dist/npm/treelist/export-element.js +0 -31
- package/dist/npm/treelist/provideSaveTreeListPDF.d.ts +0 -5
- package/dist/npm/treelist/provideSaveTreeListPDF.js +0 -66
- package/dist/systemjs/kendo-react-pdf.js +0 -1
- package/e2e-next/basic.tests.ts +0 -23
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.GridPDFExport = void 0;
|
|
19
|
-
var React = require("react");
|
|
20
|
-
var PropTypes = require("prop-types");
|
|
21
|
-
var getPageMargin_1 = require("../getPageMargin");
|
|
22
|
-
var savePDF_1 = require("../savePDF");
|
|
23
|
-
var provideSaveGridPDF_1 = require("./provideSaveGridPDF");
|
|
24
|
-
/**
|
|
25
|
-
* A React component which facilitates the PDF export of the Grid.
|
|
26
|
-
*/
|
|
27
|
-
var GridPDFExport = /** @class */ (function (_super) {
|
|
28
|
-
__extends(GridPDFExport, _super);
|
|
29
|
-
function GridPDFExport(props) {
|
|
30
|
-
var _this = _super.call(this, props) || this;
|
|
31
|
-
_this.saveGridPDF = (0, provideSaveGridPDF_1.provideSaveGridPDF)(_this.getSavePDF());
|
|
32
|
-
return _this;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @hidden
|
|
36
|
-
*/
|
|
37
|
-
GridPDFExport.prototype.render = function () {
|
|
38
|
-
return null;
|
|
39
|
-
};
|
|
40
|
-
/* eslint-disable max-len */
|
|
41
|
-
/**
|
|
42
|
-
* Saves the content of the Grid as a PDF file.
|
|
43
|
-
*
|
|
44
|
-
* @param data - The data can be different from the currently displayed data in the Grid. Can be used to export all Grid pages.
|
|
45
|
-
* @param callback - The callback that will be executed after the PDF is saved.
|
|
46
|
-
*/
|
|
47
|
-
// tslint:enable:max-line-length
|
|
48
|
-
GridPDFExport.prototype.save = function (data, callback) {
|
|
49
|
-
this.saveGridPDF(this.getGrid(), Object.assign({}, this.props, { margin: (0, getPageMargin_1.getPageMargin)(this.props) }), callback, data, this.getCustomColumns());
|
|
50
|
-
};
|
|
51
|
-
GridPDFExport.prototype.getSavePDF = function () {
|
|
52
|
-
return savePDF_1.savePDF;
|
|
53
|
-
};
|
|
54
|
-
GridPDFExport.prototype.getGrid = function () {
|
|
55
|
-
return React.Children
|
|
56
|
-
.toArray(this.props.children)
|
|
57
|
-
.find(function (child) { return child &&
|
|
58
|
-
child.type.displayName === 'KendoReactGrid'; });
|
|
59
|
-
};
|
|
60
|
-
GridPDFExport.prototype.getCustomColumns = function () {
|
|
61
|
-
return React.Children
|
|
62
|
-
.toArray(this.props.children)
|
|
63
|
-
.filter(function (child) { return child &&
|
|
64
|
-
child.type.displayName === 'KendoReactGridColumn'; });
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* @hidden
|
|
68
|
-
*/
|
|
69
|
-
GridPDFExport.propTypes = {
|
|
70
|
-
author: PropTypes.string,
|
|
71
|
-
avoidLinks: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
72
|
-
forcePageBreak: PropTypes.string,
|
|
73
|
-
keepTogether: PropTypes.string,
|
|
74
|
-
creator: PropTypes.string,
|
|
75
|
-
date: PropTypes.instanceOf(Date),
|
|
76
|
-
imageResolution: PropTypes.number,
|
|
77
|
-
fileName: PropTypes.string,
|
|
78
|
-
forceProxy: PropTypes.bool,
|
|
79
|
-
keywords: PropTypes.string,
|
|
80
|
-
landscape: PropTypes.bool,
|
|
81
|
-
margin: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.shape({
|
|
82
|
-
left: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
83
|
-
top: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
84
|
-
right: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
85
|
-
bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
86
|
-
})]),
|
|
87
|
-
pageTemplate: PropTypes.any,
|
|
88
|
-
paperSize: PropTypes.any,
|
|
89
|
-
repeatHeaders: PropTypes.bool,
|
|
90
|
-
scale: PropTypes.number,
|
|
91
|
-
proxyData: PropTypes.any,
|
|
92
|
-
proxyURL: PropTypes.string,
|
|
93
|
-
proxyTarget: PropTypes.string,
|
|
94
|
-
producer: PropTypes.string,
|
|
95
|
-
subject: PropTypes.string,
|
|
96
|
-
title: PropTypes.string
|
|
97
|
-
};
|
|
98
|
-
return GridPDFExport;
|
|
99
|
-
}(React.Component));
|
|
100
|
-
exports.GridPDFExport = GridPDFExport;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.exportElement = void 0;
|
|
4
|
-
var grid_query_1 = require("./grid-query");
|
|
5
|
-
var utils_1 = require("../common/utils");
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
var exportElement = function (wrapper) {
|
|
10
|
-
var query = new grid_query_1.GridQuery(wrapper);
|
|
11
|
-
var content = query.content();
|
|
12
|
-
var result;
|
|
13
|
-
if (content) {
|
|
14
|
-
var colGroups = [content.querySelector('colgroup')];
|
|
15
|
-
var headers = [query.header().querySelector('thead')];
|
|
16
|
-
var bodies = [content.querySelector('tbody')];
|
|
17
|
-
var footer = query.footer();
|
|
18
|
-
var footers = footer ? [footer.querySelector('tfoot')] : [];
|
|
19
|
-
result = (0, utils_1.createTable)(colGroups, headers, bodies, footers);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
result = (0, utils_1.wrapTable)(query.table().cloneNode(true));
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
exports.exportElement = exportElement;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @hidden
|
|
3
|
-
*/
|
|
4
|
-
export declare const HEADER_CLASS: string;
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
export declare const FOOTER_CLASS: string;
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
export declare class GridQuery {
|
|
13
|
-
private element;
|
|
14
|
-
private headerWrap;
|
|
15
|
-
private list;
|
|
16
|
-
private footerWrap;
|
|
17
|
-
constructor(element: HTMLElement);
|
|
18
|
-
content(locked?: boolean): Element;
|
|
19
|
-
header(locked?: boolean): Element;
|
|
20
|
-
footer(locked?: boolean): Element;
|
|
21
|
-
table(): Node;
|
|
22
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GridQuery = exports.FOOTER_CLASS = exports.HEADER_CLASS = void 0;
|
|
4
|
-
var dom_queries_1 = require("../common/dom-queries");
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
exports.HEADER_CLASS = 'k-grid-header';
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
exports.FOOTER_CLASS = 'k-grid-footer';
|
|
13
|
-
var TABLE = 'TABLE';
|
|
14
|
-
var matchesTable = (0, dom_queries_1.matchesNodeName)(TABLE);
|
|
15
|
-
var suffix = function (locked) { return locked ? 'locked' : 'wrap'; };
|
|
16
|
-
/**
|
|
17
|
-
* @hidden
|
|
18
|
-
*/
|
|
19
|
-
var GridQuery = /** @class */ (function () {
|
|
20
|
-
function GridQuery(element) {
|
|
21
|
-
this.element = element;
|
|
22
|
-
this.list = (0, dom_queries_1.findElement)(element, (0, dom_queries_1.matchesClasses)('k-grid-container'));
|
|
23
|
-
}
|
|
24
|
-
GridQuery.prototype.content = function (locked) {
|
|
25
|
-
return (0, dom_queries_1.findElement)(this.list, (0, dom_queries_1.matchesClasses)("k-grid-content".concat(locked ? '-locked' : '')));
|
|
26
|
-
};
|
|
27
|
-
GridQuery.prototype.header = function (locked) {
|
|
28
|
-
this.headerWrap = this.headerWrap || (0, dom_queries_1.findElement)(this.element, (0, dom_queries_1.matchesClasses)(exports.HEADER_CLASS));
|
|
29
|
-
return (0, dom_queries_1.findElement)(this.headerWrap, (0, dom_queries_1.matchesClasses)("".concat(exports.HEADER_CLASS, "-").concat(suffix(locked))));
|
|
30
|
-
};
|
|
31
|
-
GridQuery.prototype.footer = function (locked) {
|
|
32
|
-
this.footerWrap = this.footerWrap || (0, dom_queries_1.findElement)(this.element, (0, dom_queries_1.matchesClasses)(exports.FOOTER_CLASS));
|
|
33
|
-
return (0, dom_queries_1.findElement)(this.footerWrap, (0, dom_queries_1.matchesClasses)("".concat(exports.FOOTER_CLASS, "-").concat(suffix(locked))));
|
|
34
|
-
};
|
|
35
|
-
GridQuery.prototype.table = function () {
|
|
36
|
-
return (0, dom_queries_1.findElement)(this.element, matchesTable);
|
|
37
|
-
};
|
|
38
|
-
return GridQuery;
|
|
39
|
-
}());
|
|
40
|
-
exports.GridQuery = GridQuery;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PDFExportProps } from '../PDFExportProps';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export declare function provideSaveGridPDF(savePDF: (domElement: HTMLElement, options?: PDFExportProps, callback?: () => void) => void): (grid: any, pdfExportOptions?: PDFExportProps, callback?: () => void, data?: any, columns?: any) => void;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.provideSaveGridPDF = void 0;
|
|
4
|
-
var ReactDOM = require("react-dom");
|
|
5
|
-
var React = require("react");
|
|
6
|
-
var export_element_1 = require("./export-element");
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
function provideSaveGridPDF(savePDF) {
|
|
11
|
-
return function (grid, pdfExportOptions, callback, data, columns) {
|
|
12
|
-
if (pdfExportOptions === void 0) { pdfExportOptions = {}; }
|
|
13
|
-
return saveGridPDF(savePDF, grid, pdfExportOptions, callback, data, columns);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
exports.provideSaveGridPDF = provideSaveGridPDF;
|
|
17
|
-
function saveGridPDF(savePDF, grid, pdfExportOptions, callback, data, columns) {
|
|
18
|
-
if (pdfExportOptions === void 0) { pdfExportOptions = {}; }
|
|
19
|
-
renderGrid();
|
|
20
|
-
var gridOuterWrapper;
|
|
21
|
-
var gridInnerWrapper;
|
|
22
|
-
var finalContainer;
|
|
23
|
-
function renderGrid() {
|
|
24
|
-
gridOuterWrapper = document.createElement('div');
|
|
25
|
-
gridOuterWrapper.setAttribute('style', 'position:absolute; left: -5000px; top: 0px;');
|
|
26
|
-
gridInnerWrapper = document.createElement('div');
|
|
27
|
-
gridOuterWrapper.appendChild(gridInnerWrapper);
|
|
28
|
-
document.body.appendChild(gridOuterWrapper);
|
|
29
|
-
ReactDOM.render(prepareRawGridForExport(), gridInnerWrapper, onGridRendered);
|
|
30
|
-
}
|
|
31
|
-
function onGridRendered() {
|
|
32
|
-
savePDF(prepareFinalElementForExport(), pdfExportOptions, cleanUpAndInvokeCallback);
|
|
33
|
-
}
|
|
34
|
-
function cleanUpAndInvokeCallback() {
|
|
35
|
-
document.body.removeChild(gridOuterWrapper);
|
|
36
|
-
document.body.removeChild(finalContainer);
|
|
37
|
-
gridOuterWrapper = finalContainer = undefined;
|
|
38
|
-
if (callback) {
|
|
39
|
-
callback();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function prepareFinalElementForExport() {
|
|
43
|
-
/* Ultimatelly, there is no need for double DOM-copying of the grid.
|
|
44
|
-
The one in this method is a copied Angular implementation
|
|
45
|
-
that has been plugged almost seemlessly. */
|
|
46
|
-
finalContainer = document.createElement('div');
|
|
47
|
-
finalContainer.className = 'k-grid-pdf-export-element';
|
|
48
|
-
var result = (0, export_element_1.exportElement)(gridInnerWrapper);
|
|
49
|
-
finalContainer.appendChild(result);
|
|
50
|
-
document.body.appendChild(finalContainer);
|
|
51
|
-
return result;
|
|
52
|
-
}
|
|
53
|
-
function prepareRawGridForExport() {
|
|
54
|
-
var customDataProps = data && { data: data, total: data.length, pageSize: data.length, skip: 0 };
|
|
55
|
-
// A custom width is needed because otherwise when all pages are exported,
|
|
56
|
-
// the "hidden" PDF grid will be visible.
|
|
57
|
-
var customStyleProp = { style: Object.assign({}, grid.props.style, { width: '1000px' }) };
|
|
58
|
-
var customProps = Object.assign({}, customDataProps, customStyleProp);
|
|
59
|
-
if (columns && columns.length > 0) {
|
|
60
|
-
var notColumnChildren = getGridNotColumnChildren(grid);
|
|
61
|
-
return React.cloneElement(grid, customProps, columns.concat(notColumnChildren));
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
return React.cloneElement(grid, customProps);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function getGridNotColumnChildren(grid) {
|
|
69
|
-
return React.Children
|
|
70
|
-
.toArray(grid.props.children)
|
|
71
|
-
.filter(function (child) { return child && child.type &&
|
|
72
|
-
child.type.displayName !== 'KendoReactGridColumn'; });
|
|
73
|
-
}
|
package/dist/npm/main.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PDFExport } from './PDFExport';
|
|
2
|
-
import { PDFExportProps } from './PDFExportProps';
|
|
3
|
-
import { PageTemplateProps } from './PageTemplateProps';
|
|
4
|
-
import { PDFMargin, PDFMarginProps } from './PDFMargin';
|
|
5
|
-
import { savePDF } from './savePDF';
|
|
6
|
-
import { getPageMargin } from './getPageMargin';
|
|
7
|
-
import { GridPDFExport, GridPDFExportProps } from './grid/GridPDFExport';
|
|
8
|
-
import { TreeListPDFExport, TreeListPDFExportProps } from './treelist/TreeListPDFExport';
|
|
9
|
-
import KendoDrawingAdapter from './KendoDrawingAdapter';
|
|
10
|
-
export { PDFExport, PDFExportProps, PageTemplateProps, PDFMargin, PDFMarginProps, savePDF, getPageMargin, GridPDFExport, GridPDFExportProps, TreeListPDFExport, TreeListPDFExportProps, KendoDrawingAdapter };
|
package/dist/npm/main.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KendoDrawingAdapter = exports.TreeListPDFExport = exports.GridPDFExport = exports.getPageMargin = exports.savePDF = exports.PDFMargin = exports.PDFExport = void 0;
|
|
4
|
-
var PDFExport_1 = require("./PDFExport");
|
|
5
|
-
Object.defineProperty(exports, "PDFExport", { enumerable: true, get: function () { return PDFExport_1.PDFExport; } });
|
|
6
|
-
var PDFMargin_1 = require("./PDFMargin");
|
|
7
|
-
Object.defineProperty(exports, "PDFMargin", { enumerable: true, get: function () { return PDFMargin_1.PDFMargin; } });
|
|
8
|
-
var savePDF_1 = require("./savePDF");
|
|
9
|
-
Object.defineProperty(exports, "savePDF", { enumerable: true, get: function () { return savePDF_1.savePDF; } });
|
|
10
|
-
var getPageMargin_1 = require("./getPageMargin");
|
|
11
|
-
Object.defineProperty(exports, "getPageMargin", { enumerable: true, get: function () { return getPageMargin_1.getPageMargin; } });
|
|
12
|
-
var GridPDFExport_1 = require("./grid/GridPDFExport");
|
|
13
|
-
Object.defineProperty(exports, "GridPDFExport", { enumerable: true, get: function () { return GridPDFExport_1.GridPDFExport; } });
|
|
14
|
-
var TreeListPDFExport_1 = require("./treelist/TreeListPDFExport");
|
|
15
|
-
Object.defineProperty(exports, "TreeListPDFExport", { enumerable: true, get: function () { return TreeListPDFExport_1.TreeListPDFExport; } });
|
|
16
|
-
var KendoDrawingAdapter_1 = require("./KendoDrawingAdapter");
|
|
17
|
-
exports.KendoDrawingAdapter = KendoDrawingAdapter_1.default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.packageMetadata = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @hidden
|
|
6
|
-
*/
|
|
7
|
-
exports.packageMetadata = {
|
|
8
|
-
name: '@progress/kendo-react-pdf',
|
|
9
|
-
productName: 'KendoReact',
|
|
10
|
-
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate: 1700064286,
|
|
12
|
-
version: '',
|
|
13
|
-
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
14
|
-
};
|
package/dist/npm/savePDF.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.savePDF = void 0;
|
|
4
|
-
var kendo_drawing_1 = require("@progress/kendo-drawing");
|
|
5
|
-
var kendo_file_saver_1 = require("@progress/kendo-file-saver");
|
|
6
|
-
var KendoDrawingAdapter_1 = require("./KendoDrawingAdapter");
|
|
7
|
-
/**
|
|
8
|
-
* Saves the content of a DOM element to a PDF file.
|
|
9
|
-
*
|
|
10
|
-
* @param domElement - The root DOM element to save to a PDF file.
|
|
11
|
-
* @param options - The export options.
|
|
12
|
-
* @param callback - The callback to be executed after the PDF is saved.
|
|
13
|
-
*/
|
|
14
|
-
function savePDF(domElement, options, callback) {
|
|
15
|
-
if (options === void 0) { options = {}; }
|
|
16
|
-
new KendoDrawingAdapter_1.default(kendo_drawing_1.drawDOM, kendo_drawing_1.exportPDF, kendo_file_saver_1.saveAs, domElement, options).savePDF(callback);
|
|
17
|
-
}
|
|
18
|
-
exports.savePDF = savePDF;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as PropTypes from 'prop-types';
|
|
3
|
-
import { savePDF } from '../savePDF';
|
|
4
|
-
import { PDFExportProps } from '../PDFExportProps';
|
|
5
|
-
/**
|
|
6
|
-
* The props of the TreeListPDFExport component
|
|
7
|
-
* ([more information and examples in the documentation on PDF export]({% slug overview_pdfexport_treelist %})).
|
|
8
|
-
*/
|
|
9
|
-
export interface TreeListPDFExportProps extends PDFExportProps {
|
|
10
|
-
/**
|
|
11
|
-
* If set to true it will export all pages of the TreeList data. By default allPages is set to `false`.
|
|
12
|
-
*/
|
|
13
|
-
allPages?: boolean;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* A React component which facilitates the PDF export of the TreeList.
|
|
17
|
-
*/
|
|
18
|
-
export declare class TreeListPDFExport extends React.Component<TreeListPDFExportProps, {}> {
|
|
19
|
-
/**
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
|
-
static propTypes: {
|
|
23
|
-
author: PropTypes.Requireable<string>;
|
|
24
|
-
avoidLinks: PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
|
|
25
|
-
forcePageBreak: PropTypes.Requireable<string>;
|
|
26
|
-
keepTogether: PropTypes.Requireable<string>;
|
|
27
|
-
creator: PropTypes.Requireable<string>;
|
|
28
|
-
date: PropTypes.Requireable<Date>;
|
|
29
|
-
imageResolution: PropTypes.Requireable<number>;
|
|
30
|
-
fileName: PropTypes.Requireable<string>;
|
|
31
|
-
forceProxy: PropTypes.Requireable<boolean>;
|
|
32
|
-
keywords: PropTypes.Requireable<string>;
|
|
33
|
-
landscape: PropTypes.Requireable<boolean>;
|
|
34
|
-
margin: PropTypes.Requireable<NonNullable<string | number | PropTypes.InferProps<{
|
|
35
|
-
left: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
36
|
-
top: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
37
|
-
right: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
38
|
-
bottom: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
39
|
-
}> | null | undefined>>;
|
|
40
|
-
pageTemplate: PropTypes.Requireable<any>;
|
|
41
|
-
paperSize: PropTypes.Requireable<any>;
|
|
42
|
-
repeatHeaders: PropTypes.Requireable<boolean>;
|
|
43
|
-
scale: PropTypes.Requireable<number>;
|
|
44
|
-
proxyData: PropTypes.Requireable<any>;
|
|
45
|
-
proxyURL: PropTypes.Requireable<string>;
|
|
46
|
-
proxyTarget: PropTypes.Requireable<string>;
|
|
47
|
-
producer: PropTypes.Requireable<string>;
|
|
48
|
-
subject: PropTypes.Requireable<string>;
|
|
49
|
-
title: PropTypes.Requireable<string>;
|
|
50
|
-
allPages: PropTypes.Requireable<boolean>;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* @hidden
|
|
54
|
-
*/
|
|
55
|
-
saveTreeListPDF: any;
|
|
56
|
-
constructor(props: any);
|
|
57
|
-
/**
|
|
58
|
-
* @hidden
|
|
59
|
-
*/
|
|
60
|
-
render(): null;
|
|
61
|
-
/**
|
|
62
|
-
* Saves the content of the TreeList as a PDF file.
|
|
63
|
-
*
|
|
64
|
-
* @param data - The data that will be exported to the PDF. The data can be different from the currently displayed data in the TreeList.
|
|
65
|
-
* @param columns - The columns that will be exported to the PDF. The columns collection can be different from the currently displayed in the TreeList.
|
|
66
|
-
* @param callback - The callback that will be executed after the PDF is saved.
|
|
67
|
-
*/
|
|
68
|
-
save(data?: any[], columns?: any[], callback?: () => void): void;
|
|
69
|
-
protected getSavePDF(): typeof savePDF;
|
|
70
|
-
private getTreeList;
|
|
71
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TreeListPDFExport = void 0;
|
|
19
|
-
var React = require("react");
|
|
20
|
-
var PropTypes = require("prop-types");
|
|
21
|
-
var getPageMargin_1 = require("../getPageMargin");
|
|
22
|
-
var savePDF_1 = require("../savePDF");
|
|
23
|
-
var provideSaveTreeListPDF_1 = require("./provideSaveTreeListPDF");
|
|
24
|
-
/**
|
|
25
|
-
* A React component which facilitates the PDF export of the TreeList.
|
|
26
|
-
*/
|
|
27
|
-
var TreeListPDFExport = /** @class */ (function (_super) {
|
|
28
|
-
__extends(TreeListPDFExport, _super);
|
|
29
|
-
function TreeListPDFExport(props) {
|
|
30
|
-
var _this = _super.call(this, props) || this;
|
|
31
|
-
_this.saveTreeListPDF = (0, provideSaveTreeListPDF_1.provideSaveTreeListPDF)(_this.getSavePDF());
|
|
32
|
-
return _this;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @hidden
|
|
36
|
-
*/
|
|
37
|
-
TreeListPDFExport.prototype.render = function () {
|
|
38
|
-
return null;
|
|
39
|
-
};
|
|
40
|
-
/* eslint-disable max-len */
|
|
41
|
-
/**
|
|
42
|
-
* Saves the content of the TreeList as a PDF file.
|
|
43
|
-
*
|
|
44
|
-
* @param data - The data that will be exported to the PDF. The data can be different from the currently displayed data in the TreeList.
|
|
45
|
-
* @param columns - The columns that will be exported to the PDF. The columns collection can be different from the currently displayed in the TreeList.
|
|
46
|
-
* @param callback - The callback that will be executed after the PDF is saved.
|
|
47
|
-
*/
|
|
48
|
-
// tslint:enable:max-line-length
|
|
49
|
-
TreeListPDFExport.prototype.save = function (data, columns, callback) {
|
|
50
|
-
this.saveTreeListPDF(this.getTreeList(), Object.assign({}, this.props, { margin: (0, getPageMargin_1.getPageMargin)(this.props) }), callback, data, columns || []);
|
|
51
|
-
};
|
|
52
|
-
TreeListPDFExport.prototype.getSavePDF = function () {
|
|
53
|
-
return savePDF_1.savePDF;
|
|
54
|
-
};
|
|
55
|
-
TreeListPDFExport.prototype.getTreeList = function () {
|
|
56
|
-
var children = this.props.children;
|
|
57
|
-
if (children && children.props.data && children.props.columns) {
|
|
58
|
-
return this.props.children;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* @hidden
|
|
63
|
-
*/
|
|
64
|
-
TreeListPDFExport.propTypes = {
|
|
65
|
-
author: PropTypes.string,
|
|
66
|
-
avoidLinks: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
67
|
-
forcePageBreak: PropTypes.string,
|
|
68
|
-
keepTogether: PropTypes.string,
|
|
69
|
-
creator: PropTypes.string,
|
|
70
|
-
date: PropTypes.instanceOf(Date),
|
|
71
|
-
imageResolution: PropTypes.number,
|
|
72
|
-
fileName: PropTypes.string,
|
|
73
|
-
forceProxy: PropTypes.bool,
|
|
74
|
-
keywords: PropTypes.string,
|
|
75
|
-
landscape: PropTypes.bool,
|
|
76
|
-
margin: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.shape({
|
|
77
|
-
left: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
78
|
-
top: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
79
|
-
right: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
80
|
-
bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
81
|
-
})]),
|
|
82
|
-
pageTemplate: PropTypes.any,
|
|
83
|
-
paperSize: PropTypes.any,
|
|
84
|
-
repeatHeaders: PropTypes.bool,
|
|
85
|
-
scale: PropTypes.number,
|
|
86
|
-
proxyData: PropTypes.any,
|
|
87
|
-
proxyURL: PropTypes.string,
|
|
88
|
-
proxyTarget: PropTypes.string,
|
|
89
|
-
producer: PropTypes.string,
|
|
90
|
-
subject: PropTypes.string,
|
|
91
|
-
title: PropTypes.string,
|
|
92
|
-
allPages: PropTypes.bool
|
|
93
|
-
};
|
|
94
|
-
return TreeListPDFExport;
|
|
95
|
-
}(React.Component));
|
|
96
|
-
exports.TreeListPDFExport = TreeListPDFExport;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.exportElement = void 0;
|
|
4
|
-
var table_query_1 = require("../common/table-query");
|
|
5
|
-
var utils_1 = require("../common/utils");
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
var exportElement = function (wrapper) {
|
|
10
|
-
var query = new table_query_1.GridQuery(wrapper);
|
|
11
|
-
var content = query.content();
|
|
12
|
-
var result;
|
|
13
|
-
var headerWithoutFilter = query.header();
|
|
14
|
-
if (headerWithoutFilter.childNodes.length > 1) {
|
|
15
|
-
headerWithoutFilter.removeChild(headerWithoutFilter.childNodes[1]);
|
|
16
|
-
}
|
|
17
|
-
headerWithoutFilter.childNodes[0].childNodes.forEach(function (headerCell) { return headerCell.style.top = 0; });
|
|
18
|
-
if (content) {
|
|
19
|
-
var colGroups = [content.querySelector('colgroup')];
|
|
20
|
-
var headers = [headerWithoutFilter];
|
|
21
|
-
var bodies = [content.querySelector('tbody')];
|
|
22
|
-
var footer = query.footer();
|
|
23
|
-
var footers = footer ? [footer.querySelector('tfoot')] : [];
|
|
24
|
-
result = (0, utils_1.createTable)(colGroups, headers, bodies, footers);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
result = (0, utils_1.wrapTable)(query.table().cloneNode(true));
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
exports.exportElement = exportElement;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { TreeListPDFExportProps } from './TreeListPDFExport';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export declare function provideSaveTreeListPDF(savePDF: (domElement: HTMLElement, options?: TreeListPDFExportProps, callback?: () => void) => void): (treeList: any, pdfExportOptions?: TreeListPDFExportProps, callback?: () => void, data?: any, columns?: any) => void;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.provideSaveTreeListPDF = void 0;
|
|
4
|
-
var ReactDOM = require("react-dom");
|
|
5
|
-
var React = require("react");
|
|
6
|
-
var export_element_1 = require("./export-element");
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
function provideSaveTreeListPDF(savePDF) {
|
|
11
|
-
return function (treeList, pdfExportOptions, callback, data, columns) {
|
|
12
|
-
if (pdfExportOptions === void 0) { pdfExportOptions = {}; }
|
|
13
|
-
return saveTreeListPDF(savePDF, treeList, pdfExportOptions, callback, data, columns);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
exports.provideSaveTreeListPDF = provideSaveTreeListPDF;
|
|
17
|
-
function saveTreeListPDF(savePDF, treeList, pdfExportOptions, callback, data, columns) {
|
|
18
|
-
if (pdfExportOptions === void 0) { pdfExportOptions = {}; }
|
|
19
|
-
rendertreeList();
|
|
20
|
-
var treeListOuterWrapper;
|
|
21
|
-
var treeListInnerWrapper;
|
|
22
|
-
var finalContainer;
|
|
23
|
-
function rendertreeList() {
|
|
24
|
-
treeListOuterWrapper = document.createElement('div');
|
|
25
|
-
treeListOuterWrapper.setAttribute('style', 'position:absolute; left: -5000px; top: 0px;');
|
|
26
|
-
treeListInnerWrapper = document.createElement('div');
|
|
27
|
-
treeListOuterWrapper.appendChild(treeListInnerWrapper);
|
|
28
|
-
document.body.appendChild(treeListOuterWrapper);
|
|
29
|
-
ReactDOM.render(prepareRawTreeListForExport(), treeListInnerWrapper, ontreeListRendered);
|
|
30
|
-
}
|
|
31
|
-
function ontreeListRendered() {
|
|
32
|
-
savePDF(prepareFinalElementForExport(), pdfExportOptions, cleanUpAndInvokeCallback);
|
|
33
|
-
}
|
|
34
|
-
function cleanUpAndInvokeCallback() {
|
|
35
|
-
document.body.removeChild(treeListOuterWrapper);
|
|
36
|
-
document.body.removeChild(finalContainer);
|
|
37
|
-
treeListOuterWrapper = finalContainer = undefined;
|
|
38
|
-
if (callback) {
|
|
39
|
-
callback();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function prepareFinalElementForExport() {
|
|
43
|
-
/* Ultimatelly, there is no need for double DOM-copying of the treeList.
|
|
44
|
-
The one in this method is a copied Angular implementation
|
|
45
|
-
that has been plugged almost seemlessly. */
|
|
46
|
-
finalContainer = document.createElement('div');
|
|
47
|
-
finalContainer.className = 'k-treelist-pdf-export-element';
|
|
48
|
-
var result = (0, export_element_1.exportElement)(treeListInnerWrapper);
|
|
49
|
-
finalContainer.appendChild(result);
|
|
50
|
-
document.body.appendChild(finalContainer);
|
|
51
|
-
return finalContainer;
|
|
52
|
-
}
|
|
53
|
-
function prepareRawTreeListForExport() {
|
|
54
|
-
var customDataProps = pdfExportOptions.allPages && data ? { data: data, take: Number.MAX_VALUE, skip: 0 } : {};
|
|
55
|
-
// A custom width is needed because otherwise when all pages are exported,
|
|
56
|
-
// the "hidden" PDF treeList will be visible.
|
|
57
|
-
var customStyleProp = { style: Object.assign({}, treeList.props.style, { width: '1000px' }) };
|
|
58
|
-
var customProps = Object.assign({}, customDataProps, customStyleProp);
|
|
59
|
-
if (columns && columns.length > 0) {
|
|
60
|
-
return React.cloneElement(treeList, Object.assign({}, customProps, { columns: columns }));
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return React.cloneElement(treeList, customProps);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|