1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86 | 1×
1×
1×
1×
1×
13×
13×
13×
13×
13×
13×
12×
1×
13×
13×
13×
13×
13×
13×
13×
13×
2×
11×
3×
13×
1×
2×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
13×
4×
2×
4×
2×
1×
1×
9×
13×
1×
3430×
1×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "../utils/helper", "../model/constants"], function (require, exports, ej2_base_1, helper_1, constants_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Print = (function () {
function Print(control) {
}
Print.prototype.print = function (maps, elements) {
var printWindow = window.open('', 'print', 'height=' + window.outerHeight + ',width=' + window.outerWidth + ',tabbar=no');
printWindow.moveTo(0, 0);
printWindow.resizeTo(screen.availWidth, screen.availHeight);
var argsData = {
cancel: false, htmlContent: this.getHTMLContent(maps, elements), name: constants_1.beforePrint
};
maps.trigger('beforePrint', argsData, function (beforePrintArgs) {
if (!argsData.cancel) {
ej2_base_1.print(argsData.htmlContent, printWindow);
}
});
};
Print.prototype.getHTMLContent = function (maps, elements) {
var div = ej2_base_1.createElement('div');
var divElement = maps.element.cloneNode(true);
var backgroundElement = (!maps.isTileMap ? divElement.getElementsByTagName('svg')[0] : divElement.getElementsByTagName('svg')[1]);
Eif (!ej2_base_1.isNullOrUndefined(backgroundElement)) {
backgroundElement = backgroundElement.childNodes[0];
Eif (!ej2_base_1.isNullOrUndefined(backgroundElement)) {
var backgroundColor = backgroundElement.getAttribute('fill');
if ((maps.theme === 'Tailwind' || maps.theme === 'Bootstrap5' || maps.theme === 'Fluent' || maps.theme === 'Material3' ||
maps.theme === 'Fluent2')
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
backgroundElement.setAttribute('fill', 'rgba(255,255,255, 1)');
}
else if ((maps.theme === 'TailwindDark' || maps.theme === 'Bootstrap5Dark' || maps.theme === 'FluentDark' || maps.theme === 'Material3Dark' ||
maps.theme === 'Fluent2Dark' || maps.theme === 'Fluent2HighContrast')
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
backgroundElement.setAttribute('fill', 'rgba(0, 0, 0, 1)');
}
}
}
if (maps.isTileMap) {
for (var i = 0; i < divElement.childElementCount; i++) {
if (divElement.children[i].id === maps.element.id + '_tile_parent') {
divElement.children[i].style.removeProperty('height');
divElement.children[i].style.removeProperty('width');
divElement.children[i].style.removeProperty('top');
divElement.children[i].style.removeProperty('left');
divElement.children[i].style.removeProperty('right');
divElement.children[i].style.removeProperty('overflow');
var svgElement = document.getElementById(maps.element.id + '_Tile_SVG_Parent');
divElement.children[i].children[0].style.overflow = 'hidden';
divElement.children[i].children[0].style.position = 'absolute';
divElement.children[i].children[0].style.height = svgElement.style.height;
divElement.children[i].children[0].style.width = svgElement.style.width;
divElement.children[i].children[0].style.left = svgElement.style.left;
divElement.children[i].children[0].style.top = svgElement.style.top;
break;
}
}
}
if (elements) {
if (elements instanceof Array) {
Array.prototype.forEach.call(elements, function (value) {
div.appendChild(helper_1.getElement(value).cloneNode(true));
});
}
else if (elements instanceof Element) {
div.appendChild(elements.cloneNode(true));
}
else {
div.appendChild(helper_1.getElement(elements).cloneNode(true));
}
}
else {
div.appendChild(divElement);
}
return div;
};
Print.prototype.getModuleName = function () {
return 'Print';
};
Print.prototype.destroy = function () { };
return Print;
}());
exports.Print = Print;
});
|