@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
package/dist/npm/PDFExport.js
DELETED
|
@@ -1,98 +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.PDFExport = void 0;
|
|
19
|
-
var React = require("react");
|
|
20
|
-
var PropTypes = require("prop-types");
|
|
21
|
-
var kendo_drawing_1 = require("@progress/kendo-drawing");
|
|
22
|
-
var kendo_file_saver_1 = require("@progress/kendo-file-saver");
|
|
23
|
-
var getPageMargin_1 = require("./getPageMargin");
|
|
24
|
-
var KendoDrawingAdapter_1 = require("./KendoDrawingAdapter");
|
|
25
|
-
var licensing = require("@progress/kendo-licensing");
|
|
26
|
-
var package_metadata_1 = require("./package-metadata");
|
|
27
|
-
/**
|
|
28
|
-
* Represents the KendoReact PDFExport component.
|
|
29
|
-
*/
|
|
30
|
-
var PDFExport = /** @class */ (function (_super) {
|
|
31
|
-
__extends(PDFExport, _super);
|
|
32
|
-
function PDFExport(props) {
|
|
33
|
-
var _this = _super.call(this, props) || this;
|
|
34
|
-
_this.rootElForPDF = null;
|
|
35
|
-
if (typeof licensing !== 'undefined') {
|
|
36
|
-
licensing.validatePackage(package_metadata_1.packageMetadata);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
var message = "License activation failed for ".concat(package_metadata_1.packageMetadata.name, "\n");
|
|
40
|
-
message += 'The @progress/kendo-licensing script is not loaded.\n';
|
|
41
|
-
message += "See ".concat(package_metadata_1.packageMetadata.licensingDocsUrl, " for more information.\n");
|
|
42
|
-
console.warn(message);
|
|
43
|
-
}
|
|
44
|
-
return _this;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @hidden
|
|
48
|
-
*/
|
|
49
|
-
PDFExport.prototype.render = function () {
|
|
50
|
-
var _this = this;
|
|
51
|
-
return (React.createElement("div", { ref: function (el) { _this.rootElForPDF = el; } }, this.props.children));
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Saves the content as a PDF file.
|
|
55
|
-
*
|
|
56
|
-
* @param callback - The callback to be executed after the PDF is saved.
|
|
57
|
-
*/
|
|
58
|
-
PDFExport.prototype.save = function (callback) {
|
|
59
|
-
new KendoDrawingAdapter_1.default(kendo_drawing_1.drawDOM, kendo_drawing_1.exportPDF, kendo_file_saver_1.saveAs, this.rootElForPDF, this.getOptions()).savePDF(callback);
|
|
60
|
-
};
|
|
61
|
-
PDFExport.prototype.getOptions = function () {
|
|
62
|
-
return Object.assign({}, this.props, { margin: (0, getPageMargin_1.getPageMargin)(this.props) });
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* @hidden
|
|
66
|
-
*/
|
|
67
|
-
PDFExport.propTypes = {
|
|
68
|
-
author: PropTypes.string,
|
|
69
|
-
avoidLinks: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
70
|
-
forcePageBreak: PropTypes.string,
|
|
71
|
-
keepTogether: PropTypes.string,
|
|
72
|
-
creator: PropTypes.string,
|
|
73
|
-
date: PropTypes.instanceOf(Date),
|
|
74
|
-
imageResolution: PropTypes.number,
|
|
75
|
-
fileName: PropTypes.string,
|
|
76
|
-
forceProxy: PropTypes.bool,
|
|
77
|
-
keywords: PropTypes.string,
|
|
78
|
-
landscape: PropTypes.bool,
|
|
79
|
-
margin: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.shape({
|
|
80
|
-
left: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
81
|
-
top: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
82
|
-
right: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
83
|
-
bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
84
|
-
})]),
|
|
85
|
-
pageTemplate: PropTypes.any,
|
|
86
|
-
paperSize: PropTypes.any,
|
|
87
|
-
repeatHeaders: PropTypes.bool,
|
|
88
|
-
scale: PropTypes.number,
|
|
89
|
-
proxyData: PropTypes.any,
|
|
90
|
-
proxyURL: PropTypes.string,
|
|
91
|
-
proxyTarget: PropTypes.string,
|
|
92
|
-
producer: PropTypes.string,
|
|
93
|
-
subject: PropTypes.string,
|
|
94
|
-
title: PropTypes.string
|
|
95
|
-
};
|
|
96
|
-
return PDFExport;
|
|
97
|
-
}(React.Component));
|
|
98
|
-
exports.PDFExport = PDFExport;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PaperSize, PageMargin } from '@progress/kendo-drawing/pdf';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the props of the KendoReact PDFExport component.
|
|
5
|
-
*/
|
|
6
|
-
export interface PDFExportProps {
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* The author (metadata) of the PDF document.
|
|
13
|
-
*/
|
|
14
|
-
author?: string;
|
|
15
|
-
/**
|
|
16
|
-
* A flag that indicates whether to produce actual hyperlinks in the exported PDF file. It is also possible to set a CSS selector. All matching links will be ignored.
|
|
17
|
-
*/
|
|
18
|
-
avoidLinks?: boolean | string;
|
|
19
|
-
/**
|
|
20
|
-
* An optional CSS selector that specifies the elements which cause the page breaks.
|
|
21
|
-
*/
|
|
22
|
-
forcePageBreak?: string;
|
|
23
|
-
/**
|
|
24
|
-
* An optional CSS selector that specifies the elements which should not be split across the pages.
|
|
25
|
-
*/
|
|
26
|
-
keepTogether?: string;
|
|
27
|
-
/**
|
|
28
|
-
* The creator of the PDF document. Defaults to `KendoReact PDF Generator`.
|
|
29
|
-
*/
|
|
30
|
-
creator?: string;
|
|
31
|
-
/**
|
|
32
|
-
* The date when the PDF document is created. Defaults to `new Date()`.
|
|
33
|
-
*/
|
|
34
|
-
date?: Date;
|
|
35
|
-
/**
|
|
36
|
-
* The forced resolution of the images in the exported PDF document. By default, the images are exported at their full resolution.
|
|
37
|
-
*/
|
|
38
|
-
imageResolution?: number;
|
|
39
|
-
/**
|
|
40
|
-
* Specifies the name of the exported PDF file. Defaults to `export.pdf`.
|
|
41
|
-
*/
|
|
42
|
-
fileName?: string;
|
|
43
|
-
/**
|
|
44
|
-
* If set to `true`, the content is forwarded to `proxyURL` even if the browser supports local saving of files.
|
|
45
|
-
*/
|
|
46
|
-
forceProxy?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* The keywords (metadata) of the PDF document.
|
|
49
|
-
*/
|
|
50
|
-
keywords?: string;
|
|
51
|
-
/**
|
|
52
|
-
* A flag that indicates if the page will be in a landscape orientation. By default, the page is in a portrait orientation. Defaults to `false`.
|
|
53
|
-
*/
|
|
54
|
-
landscape?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Specifies the margins of the page.
|
|
57
|
-
*
|
|
58
|
-
* The supported units are:
|
|
59
|
-
* * `"mm"`
|
|
60
|
-
* * `"cm"`
|
|
61
|
-
* * `"in"`
|
|
62
|
-
* * `"pt"` (default).
|
|
63
|
-
*
|
|
64
|
-
* > Numbers are considered to be points (`"pt"`).
|
|
65
|
-
*/
|
|
66
|
-
margin?: string | number | PageMargin;
|
|
67
|
-
/**
|
|
68
|
-
* A React functional or class component which is used as a template that is inserted into each page of the PDF document. The number of the current page (`pageNum`) and the total number of pages (`totalPages`) are passed to the component as properties.
|
|
69
|
-
*/
|
|
70
|
-
pageTemplate?: any;
|
|
71
|
-
/**
|
|
72
|
-
* Specifies the paper size of the PDF document. Defaults to `"auto"` which means that the paper size is determined by the content. The size of the content in pixels matches the size of the output in points (1 pixel = 1/72 inch).
|
|
73
|
-
*
|
|
74
|
-
* If set, the content will be split across multiple pages. This enables the `repeatHeaders` and `scale` options, and allows you to specify a template.
|
|
75
|
-
*
|
|
76
|
-
* The supported values are:
|
|
77
|
-
* * A predefined size. The supported paper sizes are: `A0-A10`, `B0-B10`, `C0-C10`, `Executive`, `Folio`, `Legal`, `Letter`, `Tabloid`.
|
|
78
|
-
* * An array of two numbers which specify the width and height in points (1pt = 1/72in).
|
|
79
|
-
* * An array of two strings which specify the width and height in units. The supported units are `"mm"`, `"cm"`, `"in"`, and `"pt"`.
|
|
80
|
-
*/
|
|
81
|
-
paperSize?: PaperSize;
|
|
82
|
-
/**
|
|
83
|
-
* Specifies if the `<thead>` elements of the tables will be repeated on each page.
|
|
84
|
-
*/
|
|
85
|
-
repeatHeaders?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* A scale factor. The text size on the screen might be too big for printing. To scale down the output in PDF, use this option. Defaults to `1`.
|
|
88
|
-
*/
|
|
89
|
-
scale?: number;
|
|
90
|
-
/**
|
|
91
|
-
* A key/value dictionary of form values which will be sent to the proxy. Can be used to submit Anti-Forgery tokens and other metadata.
|
|
92
|
-
*/
|
|
93
|
-
proxyData?: {
|
|
94
|
-
[key: string]: string;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* The URL of the server-side proxy which streams the file to the end user. You need to use a proxy if the browser is not capable of saving files locally—for example, Internet Explorer 9 and Safari. It is your responsibility to implement the server-side proxy.
|
|
98
|
-
*
|
|
99
|
-
* In the request body, the proxy receives a `POST` request with the following parameters:
|
|
100
|
-
* - `"contentType"`—The MIME type of the file.
|
|
101
|
-
* - `"base64"`—The base-64 encoded file content.
|
|
102
|
-
* - `"fileName"`—The file name, as requested by the caller.
|
|
103
|
-
*
|
|
104
|
-
* The proxy returns the decoded file with the `"Content-Disposition"` header set to `attachment;
|
|
105
|
-
* filename="<fileName.pdf>"`.
|
|
106
|
-
*/
|
|
107
|
-
proxyURL?: string;
|
|
108
|
-
/**
|
|
109
|
-
* A name or keyword which indicates where to display the document that is returned from the proxy. To display the document in a new window or iframe, the proxy has to have the `"Content-Disposition"` header set to `inline; filename="<fileName.pdf>"`. Defaults to `_self`.
|
|
110
|
-
*/
|
|
111
|
-
proxyTarget?: string;
|
|
112
|
-
/**
|
|
113
|
-
* The producer (metadata) of the PDF document.
|
|
114
|
-
*/
|
|
115
|
-
producer?: string;
|
|
116
|
-
/**
|
|
117
|
-
* The subject (metadata) of the PDF document.
|
|
118
|
-
*/
|
|
119
|
-
subject?: string;
|
|
120
|
-
/**
|
|
121
|
-
* The title (metadata) of the PDF document.
|
|
122
|
-
*/
|
|
123
|
-
title?: string;
|
|
124
|
-
}
|
package/dist/npm/PDFMargin.js
DELETED
|
@@ -1,40 +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.PDFMargin = void 0;
|
|
19
|
-
var React = require("react");
|
|
20
|
-
var PropTypes = require("prop-types");
|
|
21
|
-
/**
|
|
22
|
-
* @hidden
|
|
23
|
-
*/
|
|
24
|
-
var PDFMargin = /** @class */ (function (_super) {
|
|
25
|
-
__extends(PDFMargin, _super);
|
|
26
|
-
function PDFMargin() {
|
|
27
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
-
}
|
|
29
|
-
PDFMargin.prototype.render = function () {
|
|
30
|
-
return null;
|
|
31
|
-
};
|
|
32
|
-
PDFMargin.propTypes = {
|
|
33
|
-
left: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
34
|
-
top: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
35
|
-
right: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
36
|
-
bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
37
|
-
};
|
|
38
|
-
return PDFMargin;
|
|
39
|
-
}(React.Component));
|
|
40
|
-
exports.PDFMargin = PDFMargin;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents the props of a page template component that can be added to the PDFExport component.
|
|
3
|
-
*/
|
|
4
|
-
export interface PageTemplateProps {
|
|
5
|
-
/**
|
|
6
|
-
* The number of the current page.
|
|
7
|
-
*/
|
|
8
|
-
pageNum: number;
|
|
9
|
-
/**
|
|
10
|
-
* The total number of pages.
|
|
11
|
-
*/
|
|
12
|
-
totalPages: number;
|
|
13
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findFocusableChild = exports.findFocusable = exports.findElement = exports.isFocusable = exports.isVisible = exports.contains = exports.closestInScope = exports.closest = exports.matchesNodeName = exports.matchesClasses = exports.hasClasses = void 0;
|
|
4
|
-
var focusableRegex = /^(?:a|input|select|option|textarea|button|object)$/i;
|
|
5
|
-
var NODE_NAME_PREDICATES = {};
|
|
6
|
-
var toClassList = function (classNames) { return String(classNames).trim().split(' '); };
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
var hasClasses = function (element, classNames) {
|
|
11
|
-
var namesList = toClassList(classNames);
|
|
12
|
-
return Boolean(toClassList(element.className).find(function (className) { return namesList.indexOf(className) >= 0; }));
|
|
13
|
-
};
|
|
14
|
-
exports.hasClasses = hasClasses;
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
*/
|
|
18
|
-
var matchesClasses = function (classNames) {
|
|
19
|
-
return function (element) { return (0, exports.hasClasses)(element, classNames); };
|
|
20
|
-
};
|
|
21
|
-
exports.matchesClasses = matchesClasses;
|
|
22
|
-
/**
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
var matchesNodeName = function (nodeName) {
|
|
26
|
-
if (!NODE_NAME_PREDICATES[nodeName]) {
|
|
27
|
-
NODE_NAME_PREDICATES[nodeName] = function (element) {
|
|
28
|
-
return String(element.nodeName).toLowerCase() === nodeName.toLowerCase();
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return NODE_NAME_PREDICATES[nodeName];
|
|
32
|
-
};
|
|
33
|
-
exports.matchesNodeName = matchesNodeName;
|
|
34
|
-
/**
|
|
35
|
-
* @hidden
|
|
36
|
-
*/
|
|
37
|
-
var closest = function (node, predicate) {
|
|
38
|
-
while (node && !predicate(node)) {
|
|
39
|
-
node = node.parentNode;
|
|
40
|
-
}
|
|
41
|
-
return node;
|
|
42
|
-
};
|
|
43
|
-
exports.closest = closest;
|
|
44
|
-
/**
|
|
45
|
-
* @hidden
|
|
46
|
-
*/
|
|
47
|
-
var closestInScope = function (node, predicate, scope) {
|
|
48
|
-
while (node && node !== scope && !predicate(node)) {
|
|
49
|
-
node = node.parentNode;
|
|
50
|
-
}
|
|
51
|
-
if (node !== scope) {
|
|
52
|
-
return node;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
exports.closestInScope = closestInScope;
|
|
56
|
-
/**
|
|
57
|
-
* @hidden
|
|
58
|
-
*/
|
|
59
|
-
var contains = function (parent, node, matchSelf) {
|
|
60
|
-
if (matchSelf === void 0) { matchSelf = false; }
|
|
61
|
-
var outside = !(0, exports.closest)(node, function (child) { return child === parent; });
|
|
62
|
-
if (outside) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
var el = (0, exports.closest)(node, function (child) { return child === node; });
|
|
66
|
-
return el && (matchSelf || el !== parent);
|
|
67
|
-
};
|
|
68
|
-
exports.contains = contains;
|
|
69
|
-
/**
|
|
70
|
-
* @hidden
|
|
71
|
-
*/
|
|
72
|
-
var isVisible = function (element) {
|
|
73
|
-
var rect = element.getBoundingClientRect();
|
|
74
|
-
var hasSize = rect.width > 0 && rect.height > 0;
|
|
75
|
-
var hasPosition = rect.x !== 0 && rect.y !== 0;
|
|
76
|
-
// Elements can have zero size due to styling, but they still count as visible.
|
|
77
|
-
// For example, the selection checkbox has no size, but is made visible through styling.
|
|
78
|
-
return (hasSize || hasPosition) && window.getComputedStyle(element).visibility !== 'hidden';
|
|
79
|
-
};
|
|
80
|
-
exports.isVisible = isVisible;
|
|
81
|
-
/**
|
|
82
|
-
* @hidden
|
|
83
|
-
*/
|
|
84
|
-
var isFocusable = function (element, checkVisibility) {
|
|
85
|
-
if (checkVisibility === void 0) { checkVisibility = true; }
|
|
86
|
-
if (element.tagName) {
|
|
87
|
-
var tagName = element.tagName.toLowerCase();
|
|
88
|
-
var tabIndex = element.getAttribute('tabIndex');
|
|
89
|
-
var skipTab = tabIndex === '-1';
|
|
90
|
-
var focusable = tabIndex !== null && !skipTab;
|
|
91
|
-
if (focusableRegex.test(tagName)) {
|
|
92
|
-
focusable = !element.disabled && !skipTab;
|
|
93
|
-
}
|
|
94
|
-
return focusable && (!checkVisibility || (0, exports.isVisible)(element));
|
|
95
|
-
}
|
|
96
|
-
return false;
|
|
97
|
-
};
|
|
98
|
-
exports.isFocusable = isFocusable;
|
|
99
|
-
/**
|
|
100
|
-
* @hidden
|
|
101
|
-
*/
|
|
102
|
-
var findElement = function (node, predicate, matchSelf) {
|
|
103
|
-
if (matchSelf === void 0) { matchSelf = true; }
|
|
104
|
-
if (!node) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (matchSelf && predicate(node)) {
|
|
108
|
-
return node;
|
|
109
|
-
}
|
|
110
|
-
node = node.firstChild;
|
|
111
|
-
while (node) {
|
|
112
|
-
if (node.nodeType === 1) {
|
|
113
|
-
var element = (0, exports.findElement)(node, predicate);
|
|
114
|
-
if (element) {
|
|
115
|
-
return element;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
node = node.nextSibling;
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
exports.findElement = findElement;
|
|
122
|
-
/**
|
|
123
|
-
* @hidden
|
|
124
|
-
*/
|
|
125
|
-
var findFocusable = function (element, checkVisibility) {
|
|
126
|
-
if (checkVisibility === void 0) { checkVisibility = true; }
|
|
127
|
-
return (0, exports.findElement)(element, function (node) { return (0, exports.isFocusable)(node, checkVisibility); });
|
|
128
|
-
};
|
|
129
|
-
exports.findFocusable = findFocusable;
|
|
130
|
-
/**
|
|
131
|
-
* @hidden
|
|
132
|
-
*/
|
|
133
|
-
var findFocusableChild = function (element, checkVisibility) {
|
|
134
|
-
if (checkVisibility === void 0) { checkVisibility = true; }
|
|
135
|
-
return (0, exports.findElement)(element, function (node) { return (0, exports.isFocusable)(node, checkVisibility); }, false);
|
|
136
|
-
};
|
|
137
|
-
exports.findFocusableChild = findFocusableChild;
|
|
@@ -1,39 +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("./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
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
*/
|
|
18
|
-
var GridQuery = /** @class */ (function () {
|
|
19
|
-
function GridQuery(element) {
|
|
20
|
-
this.element = element;
|
|
21
|
-
this.list = (0, dom_queries_1.findElement)(element, (0, dom_queries_1.matchesClasses)('k-grid'));
|
|
22
|
-
}
|
|
23
|
-
GridQuery.prototype.content = function () {
|
|
24
|
-
return (0, dom_queries_1.findElement)(this.list, (0, dom_queries_1.matchesClasses)('k-grid'));
|
|
25
|
-
};
|
|
26
|
-
GridQuery.prototype.header = function () {
|
|
27
|
-
this.headerWrap = this.headerWrap || (0, dom_queries_1.findElement)(this.element, (0, dom_queries_1.matchesClasses)(exports.HEADER_CLASS));
|
|
28
|
-
return (0, dom_queries_1.findElement)(this.headerWrap, (0, dom_queries_1.matchesClasses)("".concat(exports.HEADER_CLASS)));
|
|
29
|
-
};
|
|
30
|
-
GridQuery.prototype.footer = function () {
|
|
31
|
-
this.footerWrap = this.footerWrap || (0, dom_queries_1.findElement)(this.element, (0, dom_queries_1.matchesClasses)(exports.FOOTER_CLASS));
|
|
32
|
-
return (0, dom_queries_1.findElement)(this.footerWrap, (0, dom_queries_1.matchesClasses)("".concat(exports.FOOTER_CLASS)));
|
|
33
|
-
};
|
|
34
|
-
GridQuery.prototype.table = function () {
|
|
35
|
-
return (0, dom_queries_1.findElement)(this.element, matchesTable);
|
|
36
|
-
};
|
|
37
|
-
return GridQuery;
|
|
38
|
-
}());
|
|
39
|
-
exports.GridQuery = GridQuery;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @hidden
|
|
3
|
-
*/
|
|
4
|
-
export declare const appendNodes: (element: any, nodes: any[]) => void;
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
export declare const wrapTable: (table: any) => any;
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
export declare const createTableElement: (sources: any) => any;
|
|
13
|
-
/**
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
export declare const setFirstCellClass: (header: any, headers: any) => void;
|
|
17
|
-
/**
|
|
18
|
-
* @hidden
|
|
19
|
-
*/
|
|
20
|
-
export declare const createTable: (colGroups: any[], headers: any[], bodies: any[], footers: any[]) => any;
|
package/dist/npm/common/utils.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTable = exports.setFirstCellClass = exports.createTableElement = exports.wrapTable = exports.appendNodes = void 0;
|
|
4
|
-
var FIRST_CLASS = 'k-first';
|
|
5
|
-
var HEADER_CLASS = 'k-grid-header';
|
|
6
|
-
var FOOTER_CLASS = 'k-grid-footer';
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
var appendNodes = function (element, nodes) {
|
|
11
|
-
var length = nodes.length;
|
|
12
|
-
for (var idx = 0; idx < length; idx++) {
|
|
13
|
-
element.appendChild(nodes[idx].cloneNode(true));
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
exports.appendNodes = appendNodes;
|
|
17
|
-
/**
|
|
18
|
-
* @hidden
|
|
19
|
-
*/
|
|
20
|
-
var wrapTable = function (table) {
|
|
21
|
-
var wrapper = document.createElement('div');
|
|
22
|
-
wrapper.className = 'k-grid k-grid-md';
|
|
23
|
-
wrapper.appendChild(table);
|
|
24
|
-
return wrapper;
|
|
25
|
-
};
|
|
26
|
-
exports.wrapTable = wrapTable;
|
|
27
|
-
/**
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
var createTableElement = function (sources) {
|
|
31
|
-
var sourceCount = sources.length;
|
|
32
|
-
var element = sources[0].cloneNode(true);
|
|
33
|
-
var rowsCount = element.rows.length;
|
|
34
|
-
if (sourceCount > 1) {
|
|
35
|
-
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
|
|
36
|
-
for (var sourceIdx = 1; sourceIdx < sourceCount; sourceIdx++) {
|
|
37
|
-
(0, exports.appendNodes)(element.rows[rowIdx], sources[sourceIdx].rows[rowIdx].cells);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return element;
|
|
42
|
-
};
|
|
43
|
-
exports.createTableElement = createTableElement;
|
|
44
|
-
/**
|
|
45
|
-
* @hidden
|
|
46
|
-
*/
|
|
47
|
-
var setFirstCellClass = function (header, headers) {
|
|
48
|
-
if (headers.length > 1 && header.rows.length > 1) {
|
|
49
|
-
for (var idx = 1; idx < header.rows.length; idx++) {
|
|
50
|
-
var firstCellIndex = headers[0].rows[idx].cells.length;
|
|
51
|
-
var cell = header.rows[idx].cells[firstCellIndex];
|
|
52
|
-
if (String(cell.className).indexOf(FIRST_CLASS) === -1) {
|
|
53
|
-
cell.className += " ".concat(FIRST_CLASS);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
exports.setFirstCellClass = setFirstCellClass;
|
|
59
|
-
/**
|
|
60
|
-
* @hidden
|
|
61
|
-
*/
|
|
62
|
-
var createTable = function (colGroups, headers, bodies, footers) {
|
|
63
|
-
var table = document.createElement('table');
|
|
64
|
-
var colGroup = colGroups[0].cloneNode(true);
|
|
65
|
-
for (var idx = 1; idx < colGroups.length; idx++) {
|
|
66
|
-
(0, exports.appendNodes)(colGroup, colGroups[idx].querySelectorAll('col'));
|
|
67
|
-
}
|
|
68
|
-
var header = (0, exports.createTableElement)(headers);
|
|
69
|
-
var body = (0, exports.createTableElement)(bodies);
|
|
70
|
-
header.className = HEADER_CLASS;
|
|
71
|
-
(0, exports.setFirstCellClass)(header, headers);
|
|
72
|
-
table.appendChild(colGroup);
|
|
73
|
-
table.appendChild(header);
|
|
74
|
-
table.appendChild(body);
|
|
75
|
-
if (footers.length) {
|
|
76
|
-
var footer = (0, exports.createTableElement)(footers);
|
|
77
|
-
footer.className = FOOTER_CLASS;
|
|
78
|
-
table.appendChild(footer);
|
|
79
|
-
}
|
|
80
|
-
return (0, exports.wrapTable)(table);
|
|
81
|
-
};
|
|
82
|
-
exports.createTable = createTable;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPageMargin = void 0;
|
|
4
|
-
var React = require("react");
|
|
5
|
-
var PDFMargin_1 = require("./PDFMargin");
|
|
6
|
-
var fieldsNames = ['bottom', 'left', 'right', 'top'];
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
* Returns the margin options by reading the props of he component and the `PDFMargin` child.
|
|
10
|
-
* The props of the `PDFMargin` child are with greater priority.
|
|
11
|
-
*/
|
|
12
|
-
function getPageMargin(props) {
|
|
13
|
-
var marginChild = React.Children
|
|
14
|
-
.toArray(props.children)
|
|
15
|
-
.find(function (child) { return child && child.type === PDFMargin_1.PDFMargin; });
|
|
16
|
-
return marginChild ? getMarginComponentProps(marginChild) : props.margin;
|
|
17
|
-
}
|
|
18
|
-
exports.getPageMargin = getPageMargin;
|
|
19
|
-
function getMarginComponentProps(marginComponent) {
|
|
20
|
-
var result = {};
|
|
21
|
-
for (var idx = 0; idx < fieldsNames.length; idx++) {
|
|
22
|
-
var fieldName = fieldsNames[idx];
|
|
23
|
-
var value = marginComponent.props[fieldName];
|
|
24
|
-
if (value !== undefined) {
|
|
25
|
-
result[fieldName] = value;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return result;
|
|
29
|
-
}
|