@progress/kendo-react-pdf 6.1.1 → 7.0.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/{dist/npm/KendoDrawingAdapter.d.ts → KendoDrawingAdapter.d.ts} +4 -0
  2. package/LICENSE.md +1 -1
  3. package/{dist/npm/PDFExport.d.ts → PDFExport.d.ts} +5 -1
  4. package/{dist/es/PDFExportProps.d.ts → PDFExportProps.d.ts} +4 -1
  5. package/{dist/npm/PDFMargin.d.ts → PDFMargin.d.ts} +4 -0
  6. package/PageTemplateProps.d.ts +17 -0
  7. package/{dist/npm/common → common}/dom-queries.d.ts +4 -0
  8. package/{dist/npm/common → common}/table-query.d.ts +4 -0
  9. package/{dist/es/common → common}/utils.d.ts +4 -0
  10. package/dist/cdn/js/kendo-react-pdf.js +8 -1
  11. package/getPageMargin.d.ts +10 -0
  12. package/{dist/npm/grid → grid}/GridPDFExport.d.ts +4 -0
  13. package/grid/export-element.d.ts +8 -0
  14. package/{dist/es/grid → grid}/grid-query.d.ts +4 -0
  15. package/grid/provideSaveGridPDF.d.ts +9 -0
  16. package/index.d.ts +14 -0
  17. package/index.js +8 -0
  18. package/index.mjs +486 -0
  19. package/package-metadata.d.ts +9 -0
  20. package/package.json +28 -35
  21. package/{dist/npm/savePDF.d.ts → savePDF.d.ts} +4 -0
  22. package/{dist/es/treelist → treelist}/TreeListPDFExport.d.ts +4 -0
  23. package/treelist/export-element.d.ts +8 -0
  24. package/treelist/provideSaveTreeListPDF.d.ts +9 -0
  25. package/about.md +0 -3
  26. package/dist/es/KendoDrawingAdapter.d.ts +0 -20
  27. package/dist/es/KendoDrawingAdapter.js +0 -72
  28. package/dist/es/PDFExport.d.ts +0 -53
  29. package/dist/es/PDFExport.js +0 -95
  30. package/dist/es/PDFExportProps.js +0 -2
  31. package/dist/es/PDFMargin.d.ts +0 -67
  32. package/dist/es/PDFMargin.js +0 -37
  33. package/dist/es/PageTemplateProps.d.ts +0 -13
  34. package/dist/es/PageTemplateProps.js +0 -1
  35. package/dist/es/common/dom-queries.d.ts +0 -44
  36. package/dist/es/common/dom-queries.js +0 -123
  37. package/dist/es/common/table-query.d.ts +0 -22
  38. package/dist/es/common/table-query.js +0 -36
  39. package/dist/es/common/utils.js +0 -74
  40. package/dist/es/getPageMargin.d.ts +0 -6
  41. package/dist/es/getPageMargin.js +0 -25
  42. package/dist/es/grid/GridPDFExport.d.ts +0 -66
  43. package/dist/es/grid/GridPDFExport.js +0 -97
  44. package/dist/es/grid/export-element.d.ts +0 -4
  45. package/dist/es/grid/export-element.js +0 -22
  46. package/dist/es/grid/grid-query.js +0 -37
  47. package/dist/es/grid/provideSaveGridPDF.d.ts +0 -5
  48. package/dist/es/grid/provideSaveGridPDF.js +0 -69
  49. package/dist/es/main.d.ts +0 -10
  50. package/dist/es/main.js +0 -8
  51. package/dist/es/package-metadata.d.ts +0 -5
  52. package/dist/es/package-metadata.js +0 -11
  53. package/dist/es/savePDF.d.ts +0 -9
  54. package/dist/es/savePDF.js +0 -14
  55. package/dist/es/treelist/TreeListPDFExport.js +0 -93
  56. package/dist/es/treelist/export-element.d.ts +0 -4
  57. package/dist/es/treelist/export-element.js +0 -27
  58. package/dist/es/treelist/provideSaveTreeListPDF.d.ts +0 -5
  59. package/dist/es/treelist/provideSaveTreeListPDF.js +0 -62
  60. package/dist/npm/KendoDrawingAdapter.js +0 -74
  61. package/dist/npm/PDFExport.js +0 -98
  62. package/dist/npm/PDFExportProps.d.ts +0 -124
  63. package/dist/npm/PDFExportProps.js +0 -3
  64. package/dist/npm/PDFMargin.js +0 -40
  65. package/dist/npm/PageTemplateProps.d.ts +0 -13
  66. package/dist/npm/PageTemplateProps.js +0 -2
  67. package/dist/npm/common/dom-queries.js +0 -137
  68. package/dist/npm/common/table-query.js +0 -39
  69. package/dist/npm/common/utils.d.ts +0 -20
  70. package/dist/npm/common/utils.js +0 -82
  71. package/dist/npm/getPageMargin.d.ts +0 -6
  72. package/dist/npm/getPageMargin.js +0 -29
  73. package/dist/npm/grid/GridPDFExport.js +0 -100
  74. package/dist/npm/grid/export-element.d.ts +0 -4
  75. package/dist/npm/grid/export-element.js +0 -26
  76. package/dist/npm/grid/grid-query.d.ts +0 -22
  77. package/dist/npm/grid/grid-query.js +0 -40
  78. package/dist/npm/grid/provideSaveGridPDF.d.ts +0 -5
  79. package/dist/npm/grid/provideSaveGridPDF.js +0 -73
  80. package/dist/npm/main.d.ts +0 -10
  81. package/dist/npm/main.js +0 -17
  82. package/dist/npm/package-metadata.d.ts +0 -5
  83. package/dist/npm/package-metadata.js +0 -14
  84. package/dist/npm/savePDF.js +0 -18
  85. package/dist/npm/treelist/TreeListPDFExport.d.ts +0 -71
  86. package/dist/npm/treelist/TreeListPDFExport.js +0 -96
  87. package/dist/npm/treelist/export-element.d.ts +0 -4
  88. package/dist/npm/treelist/export-element.js +0 -31
  89. package/dist/npm/treelist/provideSaveTreeListPDF.d.ts +0 -5
  90. package/dist/npm/treelist/provideSaveTreeListPDF.js +0 -66
  91. package/dist/systemjs/kendo-react-pdf.js +0 -1
  92. package/e2e-next/basic.tests.ts +0 -23
@@ -1,72 +0,0 @@
1
- import * as React from 'react';
2
- import * as ReactDOMServer from 'react-dom/server';
3
- var defaultFileName = 'export.pdf';
4
- var defaultCreator = 'KendoReact PDF Generator';
5
- /**
6
- * @hidden
7
- */
8
- var KendoDrawingAdapter = /** @class */ (function () {
9
- function KendoDrawingAdapter(drawDOM, exportPDF, saveAs, domElement, options) {
10
- if (options === void 0) { options = {}; }
11
- var _this = this;
12
- this.drawDOM = drawDOM;
13
- this.exportPDF = exportPDF;
14
- this.saveAs = saveAs;
15
- this.domElement = domElement;
16
- this.options = options;
17
- this.convertPageTemplateToHtml = function (pageContext) {
18
- var pageTemplateContent = ReactDOMServer.renderToStaticMarkup(React.createElement(_this.options.pageTemplate, {
19
- pageNum: pageContext.pageNum, totalPages: pageContext.totalPages
20
- }));
21
- return "<span>".concat(pageTemplateContent, "</span>");
22
- };
23
- }
24
- KendoDrawingAdapter.prototype.savePDF = function (callback) {
25
- var _this = this;
26
- var savePromise = this.drawDOM(this.domElement, this.getDrawOptions())
27
- .then(function (group) { return _this.exportPDF(group, _this.getPDFOptions()); })
28
- .then(function (dataUri) { return _this.saveAs(dataUri, _this.options.fileName || defaultFileName, _this.getSaveOptions()); });
29
- if (callback) {
30
- savePromise.then(callback, callback);
31
- }
32
- };
33
- KendoDrawingAdapter.prototype.getDrawOptions = function () {
34
- return {
35
- avoidLinks: this.options.avoidLinks,
36
- forcePageBreak: this.options.forcePageBreak,
37
- keepTogether: this.options.keepTogether,
38
- margin: this.options.margin,
39
- paperSize: this.options.paperSize,
40
- landscape: this.options.landscape,
41
- repeatHeaders: this.options.repeatHeaders,
42
- scale: this.options.scale,
43
- template: this.options.pageTemplate && this.convertPageTemplateToHtml
44
- };
45
- };
46
- KendoDrawingAdapter.prototype.getPDFOptions = function () {
47
- return {
48
- author: this.options.author,
49
- creator: this.options.creator || defaultCreator,
50
- date: this.options.date,
51
- imgDPI: this.options.imageResolution,
52
- keywords: this.options.keywords,
53
- landscape: this.options.landscape,
54
- margin: this.options.margin,
55
- multiPage: true,
56
- paperSize: this.options.paperSize,
57
- producer: this.options.producer,
58
- subject: this.options.subject,
59
- title: this.options.title
60
- };
61
- };
62
- KendoDrawingAdapter.prototype.getSaveOptions = function () {
63
- return {
64
- forceProxy: this.options.forceProxy,
65
- proxyData: this.options.proxyData,
66
- proxyTarget: this.options.proxyTarget,
67
- proxyURL: this.options.proxyURL
68
- };
69
- };
70
- return KendoDrawingAdapter;
71
- }());
72
- export default KendoDrawingAdapter;
@@ -1,53 +0,0 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
- import { PDFExportProps } from './PDFExportProps';
4
- /**
5
- * Represents the KendoReact PDFExport component.
6
- */
7
- export declare class PDFExport extends React.Component<PDFExportProps, {}> {
8
- /**
9
- * @hidden
10
- */
11
- static propTypes: {
12
- author: PropTypes.Requireable<string>;
13
- avoidLinks: PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
14
- forcePageBreak: PropTypes.Requireable<string>;
15
- keepTogether: PropTypes.Requireable<string>;
16
- creator: PropTypes.Requireable<string>;
17
- date: PropTypes.Requireable<Date>;
18
- imageResolution: PropTypes.Requireable<number>;
19
- fileName: PropTypes.Requireable<string>;
20
- forceProxy: PropTypes.Requireable<boolean>;
21
- keywords: PropTypes.Requireable<string>;
22
- landscape: PropTypes.Requireable<boolean>;
23
- margin: PropTypes.Requireable<NonNullable<string | number | PropTypes.InferProps<{
24
- left: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
25
- top: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
26
- right: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
27
- bottom: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
28
- }> | null | undefined>>;
29
- pageTemplate: PropTypes.Requireable<any>;
30
- paperSize: PropTypes.Requireable<any>;
31
- repeatHeaders: PropTypes.Requireable<boolean>;
32
- scale: PropTypes.Requireable<number>;
33
- proxyData: PropTypes.Requireable<any>;
34
- proxyURL: PropTypes.Requireable<string>;
35
- proxyTarget: PropTypes.Requireable<string>;
36
- producer: PropTypes.Requireable<string>;
37
- subject: PropTypes.Requireable<string>;
38
- title: PropTypes.Requireable<string>;
39
- };
40
- private rootElForPDF;
41
- constructor(props: PDFExportProps);
42
- /**
43
- * @hidden
44
- */
45
- render(): JSX.Element;
46
- /**
47
- * Saves the content as a PDF file.
48
- *
49
- * @param callback - The callback to be executed after the PDF is saved.
50
- */
51
- save(callback?: () => void): void;
52
- private getOptions;
53
- }
@@ -1,95 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import * as React from 'react';
17
- import * as PropTypes from 'prop-types';
18
- import { drawDOM, exportPDF } from '@progress/kendo-drawing';
19
- import { saveAs } from '@progress/kendo-file-saver';
20
- import { getPageMargin } from './getPageMargin';
21
- import KendoDrawingAdapter from './KendoDrawingAdapter';
22
- import * as licensing from '@progress/kendo-licensing';
23
- import { packageMetadata } from './package-metadata';
24
- /**
25
- * Represents the KendoReact PDFExport component.
26
- */
27
- var PDFExport = /** @class */ (function (_super) {
28
- __extends(PDFExport, _super);
29
- function PDFExport(props) {
30
- var _this = _super.call(this, props) || this;
31
- _this.rootElForPDF = null;
32
- if (typeof licensing !== 'undefined') {
33
- licensing.validatePackage(packageMetadata);
34
- }
35
- else {
36
- var message = "License activation failed for ".concat(packageMetadata.name, "\n");
37
- message += 'The @progress/kendo-licensing script is not loaded.\n';
38
- message += "See ".concat(packageMetadata.licensingDocsUrl, " for more information.\n");
39
- console.warn(message);
40
- }
41
- return _this;
42
- }
43
- /**
44
- * @hidden
45
- */
46
- PDFExport.prototype.render = function () {
47
- var _this = this;
48
- return (React.createElement("div", { ref: function (el) { _this.rootElForPDF = el; } }, this.props.children));
49
- };
50
- /**
51
- * Saves the content as a PDF file.
52
- *
53
- * @param callback - The callback to be executed after the PDF is saved.
54
- */
55
- PDFExport.prototype.save = function (callback) {
56
- new KendoDrawingAdapter(drawDOM, exportPDF, saveAs, this.rootElForPDF, this.getOptions()).savePDF(callback);
57
- };
58
- PDFExport.prototype.getOptions = function () {
59
- return Object.assign({}, this.props, { margin: getPageMargin(this.props) });
60
- };
61
- /**
62
- * @hidden
63
- */
64
- PDFExport.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
- };
93
- return PDFExport;
94
- }(React.Component));
95
- export { PDFExport };
@@ -1,2 +0,0 @@
1
- export {};
2
- // tslint:enable:max-line-length
@@ -1,67 +0,0 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
- /**
4
- * Represents the props of the KendoReact PDFMargin component.
5
- */
6
- export interface PDFMarginProps {
7
- /**
8
- * The bottom margin.
9
- *
10
- * The supported units are:
11
- * * `"mm"`
12
- * * `"cm"`
13
- * * `"in"`
14
- * * `"pt"` (default).
15
- *
16
- * > Numbers are considered to be points (`"pt"`).
17
- */
18
- left?: number | string;
19
- /**
20
- * The top margin.
21
- *
22
- * The supported units are:
23
- * * `"mm"`
24
- * * `"cm"`
25
- * * `"in"`
26
- * * `"pt"` (default).
27
- *
28
- * > Numbers are considered to be points (`"pt"`).
29
- */
30
- top?: number | string;
31
- /**
32
- * The right margin.
33
- *
34
- * The supported units are:
35
- * * `"mm"`
36
- * * `"cm"`
37
- * * `"in"`
38
- * * `"pt"` (default).
39
- *
40
- * > Numbers are considered to be points (`"pt"`).
41
- */
42
- right?: number | string;
43
- /**
44
- * The bottom margin.
45
- *
46
- * The supported units are:
47
- * * `"mm"`
48
- * * `"cm"`
49
- * * `"in"`
50
- * * `"pt"` (default).
51
- *
52
- * > Numbers are considered to be points (`"pt"`).
53
- */
54
- bottom?: number | string;
55
- }
56
- /**
57
- * @hidden
58
- */
59
- export declare class PDFMargin extends React.Component<PDFMarginProps, {}> {
60
- static propTypes: {
61
- left: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
62
- top: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
63
- right: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
64
- bottom: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
65
- };
66
- render(): null;
67
- }
@@ -1,37 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import * as React from 'react';
17
- import * as PropTypes from 'prop-types';
18
- /**
19
- * @hidden
20
- */
21
- var PDFMargin = /** @class */ (function (_super) {
22
- __extends(PDFMargin, _super);
23
- function PDFMargin() {
24
- return _super !== null && _super.apply(this, arguments) || this;
25
- }
26
- PDFMargin.prototype.render = function () {
27
- return null;
28
- };
29
- PDFMargin.propTypes = {
30
- left: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
31
- top: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
32
- right: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
33
- bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
34
- };
35
- return PDFMargin;
36
- }(React.Component));
37
- export { 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 +0,0 @@
1
- export {};
@@ -1,44 +0,0 @@
1
- /**
2
- * @hidden
3
- */
4
- export declare const hasClasses: (element: HTMLElement, classNames: string) => boolean;
5
- /**
6
- * @hidden
7
- */
8
- export declare const matchesClasses: (classNames: string) => (element: HTMLElement) => boolean;
9
- /**
10
- * @hidden
11
- */
12
- export declare const matchesNodeName: (nodeName: string) => any;
13
- /**
14
- * @hidden
15
- */
16
- export declare const closest: (node: any, predicate: any) => any;
17
- /**
18
- * @hidden
19
- */
20
- export declare const closestInScope: (node: any, predicate: any, scope: any) => any;
21
- /**
22
- * @hidden
23
- */
24
- export declare const contains: (parent: any, node: any, matchSelf?: boolean) => any;
25
- /**
26
- * @hidden
27
- */
28
- export declare const isVisible: (element: any) => boolean;
29
- /**
30
- * @hidden
31
- */
32
- export declare const isFocusable: (element: any, checkVisibility?: boolean) => boolean;
33
- /**
34
- * @hidden
35
- */
36
- export declare const findElement: (node: any, predicate: (element: any) => boolean, matchSelf?: boolean) => any;
37
- /**
38
- * @hidden
39
- */
40
- export declare const findFocusable: (element: any, checkVisibility?: boolean) => any;
41
- /**
42
- * @hidden
43
- */
44
- export declare const findFocusableChild: (element: any, checkVisibility?: boolean) => any;
@@ -1,123 +0,0 @@
1
- var focusableRegex = /^(?:a|input|select|option|textarea|button|object)$/i;
2
- var NODE_NAME_PREDICATES = {};
3
- var toClassList = function (classNames) { return String(classNames).trim().split(' '); };
4
- /**
5
- * @hidden
6
- */
7
- export var hasClasses = function (element, classNames) {
8
- var namesList = toClassList(classNames);
9
- return Boolean(toClassList(element.className).find(function (className) { return namesList.indexOf(className) >= 0; }));
10
- };
11
- /**
12
- * @hidden
13
- */
14
- export var matchesClasses = function (classNames) {
15
- return function (element) { return hasClasses(element, classNames); };
16
- };
17
- /**
18
- * @hidden
19
- */
20
- export var matchesNodeName = function (nodeName) {
21
- if (!NODE_NAME_PREDICATES[nodeName]) {
22
- NODE_NAME_PREDICATES[nodeName] = function (element) {
23
- return String(element.nodeName).toLowerCase() === nodeName.toLowerCase();
24
- };
25
- }
26
- return NODE_NAME_PREDICATES[nodeName];
27
- };
28
- /**
29
- * @hidden
30
- */
31
- export var closest = function (node, predicate) {
32
- while (node && !predicate(node)) {
33
- node = node.parentNode;
34
- }
35
- return node;
36
- };
37
- /**
38
- * @hidden
39
- */
40
- export var closestInScope = function (node, predicate, scope) {
41
- while (node && node !== scope && !predicate(node)) {
42
- node = node.parentNode;
43
- }
44
- if (node !== scope) {
45
- return node;
46
- }
47
- };
48
- /**
49
- * @hidden
50
- */
51
- export var contains = function (parent, node, matchSelf) {
52
- if (matchSelf === void 0) { matchSelf = false; }
53
- var outside = !closest(node, function (child) { return child === parent; });
54
- if (outside) {
55
- return false;
56
- }
57
- var el = closest(node, function (child) { return child === node; });
58
- return el && (matchSelf || el !== parent);
59
- };
60
- /**
61
- * @hidden
62
- */
63
- export var isVisible = function (element) {
64
- var rect = element.getBoundingClientRect();
65
- var hasSize = rect.width > 0 && rect.height > 0;
66
- var hasPosition = rect.x !== 0 && rect.y !== 0;
67
- // Elements can have zero size due to styling, but they still count as visible.
68
- // For example, the selection checkbox has no size, but is made visible through styling.
69
- return (hasSize || hasPosition) && window.getComputedStyle(element).visibility !== 'hidden';
70
- };
71
- /**
72
- * @hidden
73
- */
74
- export var isFocusable = function (element, checkVisibility) {
75
- if (checkVisibility === void 0) { checkVisibility = true; }
76
- if (element.tagName) {
77
- var tagName = element.tagName.toLowerCase();
78
- var tabIndex = element.getAttribute('tabIndex');
79
- var skipTab = tabIndex === '-1';
80
- var focusable = tabIndex !== null && !skipTab;
81
- if (focusableRegex.test(tagName)) {
82
- focusable = !element.disabled && !skipTab;
83
- }
84
- return focusable && (!checkVisibility || isVisible(element));
85
- }
86
- return false;
87
- };
88
- /**
89
- * @hidden
90
- */
91
- export var findElement = function (node, predicate, matchSelf) {
92
- if (matchSelf === void 0) { matchSelf = true; }
93
- if (!node) {
94
- return;
95
- }
96
- if (matchSelf && predicate(node)) {
97
- return node;
98
- }
99
- node = node.firstChild;
100
- while (node) {
101
- if (node.nodeType === 1) {
102
- var element = findElement(node, predicate);
103
- if (element) {
104
- return element;
105
- }
106
- }
107
- node = node.nextSibling;
108
- }
109
- };
110
- /**
111
- * @hidden
112
- */
113
- export var findFocusable = function (element, checkVisibility) {
114
- if (checkVisibility === void 0) { checkVisibility = true; }
115
- return findElement(element, function (node) { return isFocusable(node, checkVisibility); });
116
- };
117
- /**
118
- * @hidden
119
- */
120
- export var findFocusableChild = function (element, checkVisibility) {
121
- if (checkVisibility === void 0) { checkVisibility = true; }
122
- return findElement(element, function (node) { return isFocusable(node, checkVisibility); }, false);
123
- };
@@ -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(): Element;
19
- header(): Element;
20
- footer(): Element;
21
- table(): Node;
22
- }
@@ -1,36 +0,0 @@
1
- import { matchesClasses, matchesNodeName, findElement } from './dom-queries';
2
- /**
3
- * @hidden
4
- */
5
- export var HEADER_CLASS = 'k-grid-header';
6
- /**
7
- * @hidden
8
- */
9
- export var FOOTER_CLASS = 'k-grid-footer';
10
- var TABLE = 'TABLE';
11
- var matchesTable = matchesNodeName(TABLE);
12
- /**
13
- * @hidden
14
- */
15
- var GridQuery = /** @class */ (function () {
16
- function GridQuery(element) {
17
- this.element = element;
18
- this.list = findElement(element, matchesClasses('k-grid'));
19
- }
20
- GridQuery.prototype.content = function () {
21
- return findElement(this.list, matchesClasses('k-grid'));
22
- };
23
- GridQuery.prototype.header = function () {
24
- this.headerWrap = this.headerWrap || findElement(this.element, matchesClasses(HEADER_CLASS));
25
- return findElement(this.headerWrap, matchesClasses("".concat(HEADER_CLASS)));
26
- };
27
- GridQuery.prototype.footer = function () {
28
- this.footerWrap = this.footerWrap || findElement(this.element, matchesClasses(FOOTER_CLASS));
29
- return findElement(this.footerWrap, matchesClasses("".concat(FOOTER_CLASS)));
30
- };
31
- GridQuery.prototype.table = function () {
32
- return findElement(this.element, matchesTable);
33
- };
34
- return GridQuery;
35
- }());
36
- export { GridQuery };
@@ -1,74 +0,0 @@
1
- var FIRST_CLASS = 'k-first';
2
- var HEADER_CLASS = 'k-grid-header';
3
- var FOOTER_CLASS = 'k-grid-footer';
4
- /**
5
- * @hidden
6
- */
7
- export var appendNodes = function (element, nodes) {
8
- var length = nodes.length;
9
- for (var idx = 0; idx < length; idx++) {
10
- element.appendChild(nodes[idx].cloneNode(true));
11
- }
12
- };
13
- /**
14
- * @hidden
15
- */
16
- export var wrapTable = function (table) {
17
- var wrapper = document.createElement('div');
18
- wrapper.className = 'k-grid k-grid-md';
19
- wrapper.appendChild(table);
20
- return wrapper;
21
- };
22
- /**
23
- * @hidden
24
- */
25
- export var createTableElement = function (sources) {
26
- var sourceCount = sources.length;
27
- var element = sources[0].cloneNode(true);
28
- var rowsCount = element.rows.length;
29
- if (sourceCount > 1) {
30
- for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
31
- for (var sourceIdx = 1; sourceIdx < sourceCount; sourceIdx++) {
32
- appendNodes(element.rows[rowIdx], sources[sourceIdx].rows[rowIdx].cells);
33
- }
34
- }
35
- }
36
- return element;
37
- };
38
- /**
39
- * @hidden
40
- */
41
- export var setFirstCellClass = function (header, headers) {
42
- if (headers.length > 1 && header.rows.length > 1) {
43
- for (var idx = 1; idx < header.rows.length; idx++) {
44
- var firstCellIndex = headers[0].rows[idx].cells.length;
45
- var cell = header.rows[idx].cells[firstCellIndex];
46
- if (String(cell.className).indexOf(FIRST_CLASS) === -1) {
47
- cell.className += " ".concat(FIRST_CLASS);
48
- }
49
- }
50
- }
51
- };
52
- /**
53
- * @hidden
54
- */
55
- export var createTable = function (colGroups, headers, bodies, footers) {
56
- var table = document.createElement('table');
57
- var colGroup = colGroups[0].cloneNode(true);
58
- for (var idx = 1; idx < colGroups.length; idx++) {
59
- appendNodes(colGroup, colGroups[idx].querySelectorAll('col'));
60
- }
61
- var header = createTableElement(headers);
62
- var body = createTableElement(bodies);
63
- header.className = HEADER_CLASS;
64
- setFirstCellClass(header, headers);
65
- table.appendChild(colGroup);
66
- table.appendChild(header);
67
- table.appendChild(body);
68
- if (footers.length) {
69
- var footer = createTableElement(footers);
70
- footer.className = FOOTER_CLASS;
71
- table.appendChild(footer);
72
- }
73
- return wrapTable(table);
74
- };
@@ -1,6 +0,0 @@
1
- /**
2
- * @hidden
3
- * Returns the margin options by reading the props of he component and the `PDFMargin` child.
4
- * The props of the `PDFMargin` child are with greater priority.
5
- */
6
- export declare function getPageMargin(props: any): any;
@@ -1,25 +0,0 @@
1
- import * as React from 'react';
2
- import { PDFMargin } from './PDFMargin';
3
- var fieldsNames = ['bottom', 'left', 'right', 'top'];
4
- /**
5
- * @hidden
6
- * Returns the margin options by reading the props of he component and the `PDFMargin` child.
7
- * The props of the `PDFMargin` child are with greater priority.
8
- */
9
- export function getPageMargin(props) {
10
- var marginChild = React.Children
11
- .toArray(props.children)
12
- .find(function (child) { return child && child.type === PDFMargin; });
13
- return marginChild ? getMarginComponentProps(marginChild) : props.margin;
14
- }
15
- function getMarginComponentProps(marginComponent) {
16
- var result = {};
17
- for (var idx = 0; idx < fieldsNames.length; idx++) {
18
- var fieldName = fieldsNames[idx];
19
- var value = marginComponent.props[fieldName];
20
- if (value !== undefined) {
21
- result[fieldName] = value;
22
- }
23
- }
24
- return result;
25
- }