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 | 1×
1×
1×
1×
1×
15×
15×
15×
15×
15×
15×
13×
1×
15×
15×
3×
1×
2×
2×
1×
1×
12×
12×
12×
12×
12×
12×
12×
4×
8×
4×
12×
12×
12×
15×
1×
386×
1×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "../utils/helper", "../model/constant"], function (require, exports, ej2_base_1, helper_1, constant_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Print = (function () {
function Print(control) {
}
Print.prototype.print = function (gauge, 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(gauge, elements), name: constant_1.beforePrint
};
gauge.trigger('beforePrint', argsData, function () {
if (!argsData.cancel) {
ej2_base_1.print(argsData.htmlContent, printWindow);
}
});
};
Print.prototype.getHTMLContent = function (gauge, elements) {
var div = ej2_base_1.createElement('div');
if (elements) {
if (elements instanceof Array) {
elements.forEach(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 {
var exportElement = gauge.element.cloneNode(true);
var backgroundElement = exportElement.getElementsByTagName('svg')[0];
Eif (!ej2_base_1.isNullOrUndefined(backgroundElement)) {
backgroundElement = backgroundElement.childNodes[0];
Eif (!ej2_base_1.isNullOrUndefined(backgroundElement)) {
var backgroundColor = backgroundElement.getAttribute('fill');
if ((gauge.theme === 'Tailwind' || gauge.theme === 'Bootstrap5' || gauge.theme === 'Fluent' || gauge.theme === 'Material3' ||
gauge.theme === 'Fluent2')
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
backgroundElement.setAttribute('fill', 'rgba(255,255,255, 1)');
}
else if ((gauge.theme === 'TailwindDark' || gauge.theme === 'Bootstrap5Dark' || gauge.theme === 'FluentDark' || gauge.theme === 'Material3Dark' ||
gauge.theme === 'Fluent2Dark' || gauge.theme === 'Fluent2HighContrast')
&& (backgroundColor === 'rgba(255,255,255, 0.0)' || backgroundColor === 'transparent')) {
backgroundElement.setAttribute('fill', 'rgba(0, 0, 0, 1)');
}
Eif (backgroundElement.getAttribute('stroke') === '') {
backgroundElement.setAttribute('stroke', 'transparent');
}
}
}
div.appendChild(exportElement);
}
return div;
};
Print.prototype.getModuleName = function () {
return 'Print';
};
Print.prototype.destroy = function () {
};
return Print;
}());
exports.Print = Print;
});
|