| 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153 |
1×
1×
1×
1×
1×
1×
1×
29×
29×
29×
1×
1×
1×
1×
1×
155×
155×
155×
155×
155×
155×
155×
155×
155×
155×
155×
155×
1×
6×
6×
6×
1×
156×
1×
155×
1×
154×
1×
153×
1×
152×
1×
1×
1×
151×
1×
150×
1×
166×
91×
91×
505×
1×
75×
75×
75×
75×
75×
75×
344×
344×
2985×
2984×
2984×
2984×
2984×
692×
343×
67×
276×
343×
343×
74×
342×
1×
1×
6×
6×
6×
6×
6×
1×
149×
149×
149×
1×
156×
156×
156×
156×
156×
154×
1×
1×
| /* istanbul ignore next */
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
define(["require", "exports", "@syncfusion/ej2-base", "./pdf-base/index", "./pdf-base/index", "@syncfusion/ej2-pdf-export"], function (require, exports, ej2_base_1, index_1, index_2, ej2_pdf_export_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PdfTreeGrid = (function (_super) {
__extends(PdfTreeGrid, _super);
function PdfTreeGrid() {
var _this = _super.call(this) || this;
_this.treeGridSize = new ej2_pdf_export_1.SizeF(0, 0);
_this.treeColumnIndex = 0;
_this.allowRowBreakAcrossPages = true;
_this.enableHeader = true;
_this.isFitToWidth = false;
_this.columns = new index_1.PdfTreeGridColumnCollection(_this);
_this.rows = new index_1.PdfTreeGridRowCollection(_this);
_this.headers = new index_1.PdfTreeGridHeaderCollection(_this);
_this.style = new index_2.PdfTreeGridStyle();
_this.rowHeight = 0;
return _this;
}
Object.defineProperty(PdfTreeGrid.prototype, "size", {
get: function () {
Eif ((this.treeGridSize.width === 0 && this.treeGridSize.height === 0)) {
this.treeGridSize = this.calculateTreeGridSize();
}
return this.treeGridSize;
},
set: function (value) {
this.treeGridSize = value;
},
enumerable: true,
configurable: true
});
PdfTreeGrid.prototype.draw = function (arg1, arg2, arg3, arg4) {
if (arg2 instanceof ej2_pdf_export_1.PointF && typeof arg2.width === 'undefined' && typeof arg3 === 'undefined') {
return this.drawHelper(arg1, arg2.x, arg2.y);
}
else if (typeof arg2 === 'number' && typeof arg3 === 'number' && typeof arg4 === 'undefined') {
return this.drawHelper(arg1, arg2, arg3, null);
}
else if (arg2 instanceof ej2_pdf_export_1.RectangleF && typeof arg2.width !== 'undefined' && typeof arg3 === 'undefined') {
return this.drawHelper(arg1, arg2, null);
}
else if (arg2 instanceof ej2_pdf_export_1.PointF && typeof arg2.width === 'undefined' && arg3 instanceof ej2_pdf_export_1.PdfLayoutFormat) {
return this.drawHelper(arg1, arg2.x, arg2.y, arg3);
}
else if (typeof arg2 === 'number' && typeof arg3 === 'number' && (arg4 instanceof ej2_pdf_export_1.PdfLayoutFormat || arg4 === null)) {
var width = (arg1.graphics.clientSize.width - arg2);
var layoutRectangle = new ej2_pdf_export_1.RectangleF(arg2, arg3, width, 0);
return this.drawHelper(arg1, layoutRectangle, arg4);
}
else if (arg2 instanceof ej2_pdf_export_1.RectangleF && typeof arg2.width !== 'undefined' && typeof arg3 === 'boolean') {
return this.drawHelper(arg1, arg2, null);
}
else {
return this.drawHelper(arg1, arg2, arg3);
}
};
PdfTreeGrid.prototype.measureColumnsWidth = function (bounds) {
if (typeof bounds !== 'undefined') {
var widths = this.columns.getDefaultWidths(bounds.width - bounds.x);
for (var i = 0; i < this.columns.count; i++) {
if (this.columns.getColumn(i).width < 0) {
this.columns.getColumn(i).width = widths[i];
}
}
}
else {
var widths = [];
var cellWidth = 0;
var totalWidth = 0;
var rowLevel = 0;
var colCount = this.columns.count;
for (var i = 0; i < colCount; i++) {
var rowCount = this.rows.count;
for (var j = 0; j < rowCount; j++) {
var tempWidth = this.rows.getRow(j).cells.getCell(i).width;
var rowWidth = this.initialWidth > 0 ? Math.min(this.initialWidth, tempWidth) : tempWidth;
cellWidth = Math.max(cellWidth, rowWidth);
cellWidth = Math.max(this.columns.getColumn(i).width, cellWidth);
if (this.columns.getColumn(i).isTreeColumn) {
rowLevel = Math.max(rowLevel, this.rows.getRow(j).level);
}
}
if (this.columns.getColumn(i).isTreeColumn) {
widths.push(cellWidth + (rowLevel * 10));
}
else {
widths.push(cellWidth);
}
totalWidth += cellWidth;
cellWidth = 0;
}
for (var i = 0; i < this.columns.count; i++) {
if (this.columns.getColumn(i).width < 0) {
this.columns.getColumn(i).width = widths[i];
}
}
}
};
PdfTreeGrid.prototype.calculateTreeGridSize = function () {
var height = 0;
var width = this.columns.width;
for (var i = 0; i < this.headers.count; i++) {
var row = this.headers.getHeader(i);
height += row.height;
}
for (var i = 0; i < this.rows.count; i++) {
var row = this.rows.getRow(i);
height += row.height;
}
return new ej2_pdf_export_1.SizeF(width, height);
};
PdfTreeGrid.prototype.drawGrid = function (page, x, y, format) {
this.initialWidth = page.graphics.clientSize.width;
var layout = new ej2_pdf_export_1.RectangleF(0, 0, page.getClientSize().height, 0);
return this.draw(page, layout, format);
};
PdfTreeGrid.prototype.layout = function (param) {
Eif (this.rows.count !== 0) {
var style = (this.rows.getRow(0).cells.count !== 0) ? this.rows.getRow(0).cells.getCell(0).style : null;
Iif (!ej2_base_1.isNullOrUndefined(style) && style.borders.left.width !== 1) {
var x = style.borders.left.width / 2;
var y = style.borders.top.width / 2;
if (param.bounds.x === index_2.PdfBorders.default.right.width / 2 &&
param.bounds.y === index_2.PdfBorders.default.right.width / 2) {
var newBound = new ej2_pdf_export_1.RectangleF(new ej2_pdf_export_1.PointF(x, y), new ej2_pdf_export_1.SizeF(this.size.width, this.size.height));
param.bounds = newBound;
}
}
}
this.layouter = new index_2.PdfTreeGridLayouter(this);
var result = this.layouter.layoutInternal(param);
return result;
};
return PdfTreeGrid;
}(ej2_pdf_export_1.PdfLayoutElement));
exports.PdfTreeGrid = PdfTreeGrid;
});
|