Skip to content

Commit deca50c

Browse files
committed
chore(*): addressing build error
1 parent 95095de commit deca50c

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

projects/igniteui-angular/src/lib/services/pdf/pdf-exporter.ts

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ export class IgxPdfExporterService extends IgxBaseExporter {
4949

5050
protected exportDataImplementation(data: IExportRecord[], options: IgxPdfExporterOptions, done: () => void): void {
5151
const defaultOwner = this._ownersMap.get(DEFAULT_OWNER);
52-
52+
5353
// Get all columns (including multi-column headers)
5454
const allColumns = defaultOwner?.columns.filter(col => !col.skip) || [];
55-
55+
5656
// Get leaf columns (actual data columns)
5757
const leafColumns = allColumns.filter(col => col.field && col.headerType === ExportHeaderType.ColumnHeader);
58-
58+
5959
// Check if we have multi-level headers
6060
const maxLevel = defaultOwner?.maxLevel || 0;
6161
const hasMultiColumnHeaders = maxLevel > 0 && allColumns.some(col => col.headerType === ExportHeaderType.MultiColumnHeader);
@@ -64,7 +64,7 @@ export class IgxPdfExporterService extends IgxBaseExporter {
6464
// If no columns are defined, use the keys from the first data record
6565
const firstDataElement = data[0];
6666
const keys = Object.keys(firstDataElement.data);
67-
67+
6868
keys.forEach((key) => {
6969
leafColumns.push({
7070
header: key,
@@ -88,14 +88,14 @@ export class IgxPdfExporterService extends IgxBaseExporter {
8888
const pageHeight = pdf.internal.pageSize.getHeight();
8989
const margin = 40;
9090
const usableWidth = pageWidth - (2 * margin);
91-
91+
9292
// Calculate column widths based on leaf columns
9393
const columnWidth = usableWidth / leafColumns.length;
9494
const rowHeight = 20;
9595
const headerHeight = 25;
9696
const indentSize = 15; // Indentation per level for hierarchical data
9797
const childTableIndent = 30; // Indent for child tables
98-
98+
9999
let yPosition = margin;
100100

101101
// Set font
@@ -127,7 +127,7 @@ export class IgxPdfExporterService extends IgxBaseExporter {
127127
if (yPosition + rowHeight > pageHeight - margin) {
128128
pdf.addPage();
129129
yPosition = margin;
130-
130+
131131
// Redraw headers on new page
132132
if (hasMultiColumnHeaders) {
133133
yPosition = this.drawMultiLevelHeaders(pdf, allColumns, maxLevel, margin, yPosition, columnWidth, headerHeight, usableWidth, options);
@@ -153,7 +153,7 @@ export class IgxPdfExporterService extends IgxBaseExporter {
153153
if (isHierarchicalGrid) {
154154
const childRecords = [];
155155
let childOwner = null;
156-
156+
157157
// Collect only direct child records (next level) that belong to this parent
158158
let j = i + 1;
159159
while (j < data.length && data[j].owner !== DEFAULT_OWNER && data[j].level > record.level) {
@@ -170,17 +170,17 @@ export class IgxPdfExporterService extends IgxBaseExporter {
170170
// If there are child records, draw a child table
171171
if (childRecords.length > 0 && childOwner) {
172172
yPosition = this.drawHierarchicalChildren(
173-
pdf,
174-
data,
175-
childRecords,
176-
childOwner,
177-
yPosition,
178-
margin,
179-
childTableIndent,
180-
usableWidth,
181-
pageHeight,
182-
headerHeight,
183-
rowHeight,
173+
pdf,
174+
data,
175+
childRecords,
176+
childOwner,
177+
yPosition,
178+
margin,
179+
childTableIndent,
180+
usableWidth,
181+
pageHeight,
182+
headerHeight,
183+
rowHeight,
184184
options
185185
);
186186

@@ -255,15 +255,15 @@ export class IgxPdfExporterService extends IgxBaseExporter {
255255
// Center text in cell with truncation if needed
256256
let headerText = col.header || col.field || '';
257257
const maxTextWidth = width - 10; // Leave 5px padding on each side
258-
258+
259259
// Truncate text if it's too long
260260
if (pdf.getTextWidth(headerText) > maxTextWidth) {
261261
while (pdf.getTextWidth(headerText + '...') > maxTextWidth && headerText.length > 0) {
262262
headerText = headerText.substring(0, headerText.length - 1);
263263
}
264264
headerText += '...';
265265
}
266-
266+
267267
const textWidth = pdf.getTextWidth(headerText);
268268
const textX = xPosition + (width - textWidth) / 2;
269269
const textY = yPosition + headerHeight / 2 + options.fontSize / 3;
@@ -323,7 +323,7 @@ export class IgxPdfExporterService extends IgxBaseExporter {
323323
let childIndex = 0;
324324
while (childIndex < childRecords.length) {
325325
const childRecord = childRecords[childIndex];
326-
326+
327327
// Check if we need a new page
328328
if (yPosition + rowHeight > pageHeight - margin) {
329329
pdf.addPage();
@@ -350,7 +350,7 @@ export class IgxPdfExporterService extends IgxBaseExporter {
350350
if (allData[k].level === childRecord.level + 1 && !allData[k].hidden) {
351351
grandchildRecords.push(allData[k]);
352352
if (!grandchildOwner) {
353-
grandchildOwner = allData[k].owner;
353+
grandchildOwner = allData[k].owner.toString();
354354
}
355355
}
356356
k++;
@@ -396,19 +396,19 @@ export class IgxPdfExporterService extends IgxBaseExporter {
396396
): void {
397397
pdf.setFont('helvetica', 'bold');
398398
pdf.setFillColor(240, 240, 240);
399-
399+
400400
if (options.showTableBorders) {
401401
pdf.rect(xStart, yPosition, tableWidth, headerHeight, 'F');
402402
}
403403

404404
columns.forEach((col, index) => {
405405
const xPosition = xStart + (index * columnWidth);
406406
let headerText = col.header || col.field;
407-
407+
408408
if (options.showTableBorders) {
409409
pdf.rect(xPosition, yPosition, columnWidth, headerHeight);
410410
}
411-
411+
412412
// Truncate text if it's too long
413413
const maxTextWidth = columnWidth - 10; // Leave 5px padding on each side
414414
if (pdf.getTextWidth(headerText) > maxTextWidth) {
@@ -417,12 +417,12 @@ export class IgxPdfExporterService extends IgxBaseExporter {
417417
}
418418
headerText += '...';
419419
}
420-
420+
421421
// Center text in cell
422422
const textWidth = pdf.getTextWidth(headerText);
423423
const textX = xPosition + (columnWidth - textWidth) / 2;
424424
const textY = yPosition + headerHeight / 2 + options.fontSize / 3;
425-
425+
426426
pdf.text(headerText, textX, textY);
427427
});
428428

@@ -441,11 +441,11 @@ export class IgxPdfExporterService extends IgxBaseExporter {
441441
options: IgxPdfExporterOptions
442442
): void {
443443
const isSummaryRecord = record.type === 'SummaryRecord';
444-
444+
445445
columns.forEach((col, index) => {
446446
const xPosition = xStart + (index * columnWidth);
447447
let cellValue = record.data[col.field];
448-
448+
449449
// Handle summary records - cellValue is an IgxSummaryResult object
450450
if (isSummaryRecord && cellValue) {
451451
// For summary records, the cellValue has label and value properties
@@ -466,7 +466,7 @@ export class IgxPdfExporterService extends IgxBaseExporter {
466466
cellValue = cellValue.summaryResult;
467467
}
468468
}
469-
469+
470470
// Convert value to string
471471
if (cellValue === null || cellValue === undefined) {
472472
cellValue = '';
@@ -482,11 +482,11 @@ export class IgxPdfExporterService extends IgxBaseExporter {
482482

483483
// Apply indentation to the first column for hierarchical data
484484
const textIndent = (index === 0) ? indent : 0;
485-
485+
486486
// Truncate text if it's too long, accounting for indentation
487487
const maxTextWidth = columnWidth - 10 - textIndent;
488488
let displayText = cellValue;
489-
489+
490490
if (pdf.getTextWidth(displayText) > maxTextWidth) {
491491
while (pdf.getTextWidth(displayText + '...') > maxTextWidth && displayText.length > 0) {
492492
displayText = displayText.substring(0, displayText.length - 1);

0 commit comments

Comments
 (0)