av6-pdf-engine 1.1.0 → 1.2.0
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.
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +92 -8
- package/dist/index.mjs +92 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -72,7 +72,7 @@ interface TableBlock extends BaseBlock {
|
|
|
72
72
|
type: "table";
|
|
73
73
|
headerRows?: number;
|
|
74
74
|
widths: Width[];
|
|
75
|
-
body: TableCell[][]
|
|
75
|
+
body: TableCell[][] | TableBodyIterable[] | Array<TableCell[] | TableBodyIterable>;
|
|
76
76
|
layout?: {
|
|
77
77
|
border?: "all" | "none";
|
|
78
78
|
hLineColor?: string;
|
|
@@ -83,6 +83,12 @@ interface TableBlock extends BaseBlock {
|
|
|
83
83
|
marginBottom?: number;
|
|
84
84
|
marginLeft?: number;
|
|
85
85
|
marginRight?: number;
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
}
|
|
88
|
+
interface TableBodyIterable {
|
|
89
|
+
isIterable: boolean;
|
|
90
|
+
iterableKey: string;
|
|
91
|
+
content: Array<TableCell>;
|
|
86
92
|
}
|
|
87
93
|
interface PlacedCell {
|
|
88
94
|
cell: TableCell;
|
|
@@ -352,4 +358,4 @@ declare function toPdfEngineError(cause: unknown, fallback: {
|
|
|
352
358
|
declare function renderCustomPdf(def: CustomDocDefinition, outputPath: string): Promise<void>;
|
|
353
359
|
declare function renderCustomPdfToBuffer(def: CustomDocDefinition): Promise<Buffer>;
|
|
354
360
|
|
|
355
|
-
export { type Alignment, BARCODE_TYPES, type BarcodeBlock, type BarcodeType, type BaseBlock, type Block, type BuiltInFont, type ColumnsBlock, type CustomDocDefinition, type FontName, type FontRegistration, type FooterDef, type FooterInput, type HeaderDef, type ImageBlock, type InlineTextStyle, type KeyValueGridBlock, type KeyValueItem, type LineBlock, type Orientation, type PDFDoc, type PageBackgroundDef, type PageBreakBlock, type PageContext, type PageMargins, PdfEngineError, PdfEngineErrorCode, type PlacedCell, type QRErrorLevel, QR_ERROR_LEVEL, type QrCodeBlock, type RenderEnv, type SignatureBlock, type StyleDef, type StyleRef, type TableBlock, type TableCell, type TextBlock, type WatermarkDef, type WatermarkMode, type Width, isPdfEngineError, renderCustomPdf, renderCustomPdfToBuffer, toPdfEngineError };
|
|
361
|
+
export { type Alignment, BARCODE_TYPES, type BarcodeBlock, type BarcodeType, type BaseBlock, type Block, type BuiltInFont, type ColumnsBlock, type CustomDocDefinition, type FontName, type FontRegistration, type FooterDef, type FooterInput, type HeaderDef, type ImageBlock, type InlineTextStyle, type KeyValueGridBlock, type KeyValueItem, type LineBlock, type Orientation, type PDFDoc, type PageBackgroundDef, type PageBreakBlock, type PageContext, type PageMargins, PdfEngineError, PdfEngineErrorCode, type PlacedCell, type QRErrorLevel, QR_ERROR_LEVEL, type QrCodeBlock, type RenderEnv, type SignatureBlock, type StyleDef, type StyleRef, type TableBlock, type TableBodyIterable, type TableCell, type TextBlock, type WatermarkDef, type WatermarkMode, type Width, isPdfEngineError, renderCustomPdf, renderCustomPdfToBuffer, toPdfEngineError };
|
package/dist/index.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ interface TableBlock extends BaseBlock {
|
|
|
72
72
|
type: "table";
|
|
73
73
|
headerRows?: number;
|
|
74
74
|
widths: Width[];
|
|
75
|
-
body: TableCell[][]
|
|
75
|
+
body: TableCell[][] | TableBodyIterable[] | Array<TableCell[] | TableBodyIterable>;
|
|
76
76
|
layout?: {
|
|
77
77
|
border?: "all" | "none";
|
|
78
78
|
hLineColor?: string;
|
|
@@ -83,6 +83,12 @@ interface TableBlock extends BaseBlock {
|
|
|
83
83
|
marginBottom?: number;
|
|
84
84
|
marginLeft?: number;
|
|
85
85
|
marginRight?: number;
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
}
|
|
88
|
+
interface TableBodyIterable {
|
|
89
|
+
isIterable: boolean;
|
|
90
|
+
iterableKey: string;
|
|
91
|
+
content: Array<TableCell>;
|
|
86
92
|
}
|
|
87
93
|
interface PlacedCell {
|
|
88
94
|
cell: TableCell;
|
|
@@ -352,4 +358,4 @@ declare function toPdfEngineError(cause: unknown, fallback: {
|
|
|
352
358
|
declare function renderCustomPdf(def: CustomDocDefinition, outputPath: string): Promise<void>;
|
|
353
359
|
declare function renderCustomPdfToBuffer(def: CustomDocDefinition): Promise<Buffer>;
|
|
354
360
|
|
|
355
|
-
export { type Alignment, BARCODE_TYPES, type BarcodeBlock, type BarcodeType, type BaseBlock, type Block, type BuiltInFont, type ColumnsBlock, type CustomDocDefinition, type FontName, type FontRegistration, type FooterDef, type FooterInput, type HeaderDef, type ImageBlock, type InlineTextStyle, type KeyValueGridBlock, type KeyValueItem, type LineBlock, type Orientation, type PDFDoc, type PageBackgroundDef, type PageBreakBlock, type PageContext, type PageMargins, PdfEngineError, PdfEngineErrorCode, type PlacedCell, type QRErrorLevel, QR_ERROR_LEVEL, type QrCodeBlock, type RenderEnv, type SignatureBlock, type StyleDef, type StyleRef, type TableBlock, type TableCell, type TextBlock, type WatermarkDef, type WatermarkMode, type Width, isPdfEngineError, renderCustomPdf, renderCustomPdfToBuffer, toPdfEngineError };
|
|
361
|
+
export { type Alignment, BARCODE_TYPES, type BarcodeBlock, type BarcodeType, type BaseBlock, type Block, type BuiltInFont, type ColumnsBlock, type CustomDocDefinition, type FontName, type FontRegistration, type FooterDef, type FooterInput, type HeaderDef, type ImageBlock, type InlineTextStyle, type KeyValueGridBlock, type KeyValueItem, type LineBlock, type Orientation, type PDFDoc, type PageBackgroundDef, type PageBreakBlock, type PageContext, type PageMargins, PdfEngineError, PdfEngineErrorCode, type PlacedCell, type QRErrorLevel, QR_ERROR_LEVEL, type QrCodeBlock, type RenderEnv, type SignatureBlock, type StyleDef, type StyleRef, type TableBlock, type TableBodyIterable, type TableCell, type TextBlock, type WatermarkDef, type WatermarkMode, type Width, isPdfEngineError, renderCustomPdf, renderCustomPdfToBuffer, toPdfEngineError };
|
package/dist/index.js
CHANGED
|
@@ -576,17 +576,100 @@ var getPlacedCellWidth = (colWidths, startCol, colSpan) => {
|
|
|
576
576
|
var getRowSpanGroupHeight = (rowHeights, rowIndex, rowSpan) => {
|
|
577
577
|
return sum(rowHeights.slice(rowIndex, rowIndex + rowSpan));
|
|
578
578
|
};
|
|
579
|
+
var isTableBodyIterableEntry = (entry) => {
|
|
580
|
+
if (!entry || typeof entry !== "object") return false;
|
|
581
|
+
const row = entry;
|
|
582
|
+
return typeof row.isIterable === "boolean" && typeof row.iterableKey === "string" && Array.isArray(row.content);
|
|
583
|
+
};
|
|
584
|
+
var isTableCellInput = (rawBlock) => !("type" in rawBlock);
|
|
585
|
+
var toTableCell = (rawBlock) => {
|
|
586
|
+
if ("type" in rawBlock && rawBlock.type !== "text") {
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
const tableCellInput = isTableCellInput(rawBlock) ? rawBlock : void 0;
|
|
590
|
+
return {
|
|
591
|
+
text: rawBlock.text,
|
|
592
|
+
italic: rawBlock.italic,
|
|
593
|
+
underline: rawBlock.underline,
|
|
594
|
+
link: rawBlock.link,
|
|
595
|
+
strike: rawBlock.strike,
|
|
596
|
+
bold: rawBlock.bold,
|
|
597
|
+
fontSize: rawBlock.fontSize,
|
|
598
|
+
font: rawBlock.font,
|
|
599
|
+
align: rawBlock.align,
|
|
600
|
+
color: rawBlock.color,
|
|
601
|
+
fillColor: tableCellInput?.fillColor,
|
|
602
|
+
style: rawBlock.style,
|
|
603
|
+
colSpan: tableCellInput?.colSpan,
|
|
604
|
+
rowSpan: tableCellInput?.rowSpan,
|
|
605
|
+
paddingTop: tableCellInput?.paddingTop,
|
|
606
|
+
paddingRight: tableCellInput?.paddingRight,
|
|
607
|
+
paddingBottom: tableCellInput?.paddingBottom,
|
|
608
|
+
paddingLeft: tableCellInput?.paddingLeft
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
var resolvePathValue = (obj, dottedPath) => {
|
|
612
|
+
if (!obj || typeof obj !== "object") return void 0;
|
|
613
|
+
return dottedPath.split(".").reduce((acc, key) => {
|
|
614
|
+
if (!acc || typeof acc !== "object") return void 0;
|
|
615
|
+
return acc[key];
|
|
616
|
+
}, obj);
|
|
617
|
+
};
|
|
618
|
+
var interpolateCellText = (text, item, rowIndex) => {
|
|
619
|
+
return text.replace(/\{\{\s*([^}]+)\s*\}\}/g, (_match, tokenRaw) => {
|
|
620
|
+
const token = tokenRaw.trim();
|
|
621
|
+
if (!token) return "";
|
|
622
|
+
if (token === "index") return String(rowIndex + 1);
|
|
623
|
+
const normalizedPath = token.startsWith("item.") ? token.slice(5) : token;
|
|
624
|
+
const value = resolvePathValue(item, normalizedPath);
|
|
625
|
+
if (value === void 0 || value === null) return "";
|
|
626
|
+
return typeof value === "string" ? value : String(value);
|
|
627
|
+
});
|
|
628
|
+
};
|
|
629
|
+
var applyIterableData = (cell, item, rowIndex) => ({
|
|
630
|
+
...cell,
|
|
631
|
+
text: interpolateCellText(cell.text, item, rowIndex)
|
|
632
|
+
});
|
|
633
|
+
var expandIterableRow = (table, bodyDef) => {
|
|
634
|
+
const templateRow = bodyDef.content.map(toTableCell).filter((cell) => cell !== null);
|
|
635
|
+
if (!templateRow.length) {
|
|
636
|
+
return [];
|
|
637
|
+
}
|
|
638
|
+
if (!bodyDef.isIterable) {
|
|
639
|
+
return [templateRow];
|
|
640
|
+
}
|
|
641
|
+
const iterableSource = table[bodyDef.iterableKey];
|
|
642
|
+
if (!Array.isArray(iterableSource) || !iterableSource.length) {
|
|
643
|
+
return [templateRow];
|
|
644
|
+
}
|
|
645
|
+
return iterableSource.map((item, rowIndex) => templateRow.map((cell) => applyIterableData(cell, item, rowIndex)));
|
|
646
|
+
};
|
|
647
|
+
var normalizeTableRows = (table) => {
|
|
648
|
+
if (!Array.isArray(table.body)) return [];
|
|
649
|
+
const rows = [];
|
|
650
|
+
for (const entry of table.body) {
|
|
651
|
+
if (Array.isArray(entry)) {
|
|
652
|
+
rows.push(entry);
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
if (isTableBodyIterableEntry(entry)) {
|
|
656
|
+
rows.push(...expandIterableRow(table, entry));
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return rows;
|
|
660
|
+
};
|
|
579
661
|
var measureTableHeight = (doc, table, env, styles, computeColumnPixelWidths2) => {
|
|
580
662
|
const localLeft = table.marginLeft ?? 0;
|
|
581
663
|
const localRight = table.marginRight ?? 0;
|
|
582
664
|
const width = Math.max(env.innerWidth - localLeft - localRight, 1);
|
|
665
|
+
const rows = normalizeTableRows(table);
|
|
583
666
|
const totalCols = table.widths.length;
|
|
584
667
|
const colWidths = computeColumnPixelWidths2(table.widths, width);
|
|
585
668
|
const rowHeights = [];
|
|
586
669
|
const activeRowSpans = Array(totalCols).fill(0);
|
|
587
670
|
const placedRows = [];
|
|
588
|
-
for (let rowIndex = 0; rowIndex <
|
|
589
|
-
const row =
|
|
671
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
672
|
+
const row = rows[rowIndex];
|
|
590
673
|
const placedRow = buildPlacedRow(row, totalCols, activeRowSpans);
|
|
591
674
|
placedRows.push(placedRow);
|
|
592
675
|
let rowHeight = 12;
|
|
@@ -652,12 +735,13 @@ var processTableBlock = (doc, ctx, styles, table, y, env, computeColumnPixelWidt
|
|
|
652
735
|
};
|
|
653
736
|
const borderAll = layout.border !== "none";
|
|
654
737
|
const headerRows = table.headerRows ?? 0;
|
|
655
|
-
const
|
|
738
|
+
const rows = normalizeTableRows(table);
|
|
739
|
+
const buildPlacementAndHeights = (rows2) => {
|
|
656
740
|
const placedRows = [];
|
|
657
741
|
const rowHeights = [];
|
|
658
742
|
const activeRowSpans = Array(totalCols).fill(0);
|
|
659
|
-
for (let rowIndex = 0; rowIndex <
|
|
660
|
-
const row =
|
|
743
|
+
for (let rowIndex = 0; rowIndex < rows2.length; rowIndex++) {
|
|
744
|
+
const row = rows2[rowIndex];
|
|
661
745
|
const placedRow = buildPlacedRow(row, totalCols, activeRowSpans);
|
|
662
746
|
placedRows.push(placedRow);
|
|
663
747
|
let rowHeight = 12;
|
|
@@ -700,7 +784,7 @@ var processTableBlock = (doc, ctx, styles, table, y, env, computeColumnPixelWidt
|
|
|
700
784
|
}
|
|
701
785
|
return { placedRows, rowHeights };
|
|
702
786
|
};
|
|
703
|
-
const allLayout = buildPlacementAndHeights(
|
|
787
|
+
const allLayout = buildPlacementAndHeights(rows);
|
|
704
788
|
const drawPlacedRow = (placedRow, rowTop2, rowHeight, rowIndex, rowHeights, isHeaderRow, drawTopBorder) => {
|
|
705
789
|
placedRow.forEach(({ cell: rawCell, startCol, colSpan, rowSpan }) => {
|
|
706
790
|
const cell = resolveTableCell(styles, rawCell);
|
|
@@ -757,7 +841,7 @@ var processTableBlock = (doc, ctx, styles, table, y, env, computeColumnPixelWidt
|
|
|
757
841
|
});
|
|
758
842
|
return rowTop2 + rowHeight;
|
|
759
843
|
};
|
|
760
|
-
const headerRowsSource =
|
|
844
|
+
const headerRowsSource = rows.slice(0, headerRows);
|
|
761
845
|
const drawHeaderRowsOnNewPage = () => {
|
|
762
846
|
if (!headerRows) return doc.page.margins.top + mt;
|
|
763
847
|
const headerLayout = buildPlacementAndHeights(headerRowsSource);
|
|
@@ -776,7 +860,7 @@ var processTableBlock = (doc, ctx, styles, table, y, env, computeColumnPixelWidt
|
|
|
776
860
|
return rowTop2;
|
|
777
861
|
};
|
|
778
862
|
let rowTop = startY;
|
|
779
|
-
for (let rowIndex = 0; rowIndex <
|
|
863
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
780
864
|
const isHeaderRow = rowIndex < headerRows;
|
|
781
865
|
const placedRow = allLayout.placedRows[rowIndex];
|
|
782
866
|
const rowHeight = allLayout.rowHeights[rowIndex];
|
package/dist/index.mjs
CHANGED
|
@@ -533,17 +533,100 @@ var getPlacedCellWidth = (colWidths, startCol, colSpan) => {
|
|
|
533
533
|
var getRowSpanGroupHeight = (rowHeights, rowIndex, rowSpan) => {
|
|
534
534
|
return sum(rowHeights.slice(rowIndex, rowIndex + rowSpan));
|
|
535
535
|
};
|
|
536
|
+
var isTableBodyIterableEntry = (entry) => {
|
|
537
|
+
if (!entry || typeof entry !== "object") return false;
|
|
538
|
+
const row = entry;
|
|
539
|
+
return typeof row.isIterable === "boolean" && typeof row.iterableKey === "string" && Array.isArray(row.content);
|
|
540
|
+
};
|
|
541
|
+
var isTableCellInput = (rawBlock) => !("type" in rawBlock);
|
|
542
|
+
var toTableCell = (rawBlock) => {
|
|
543
|
+
if ("type" in rawBlock && rawBlock.type !== "text") {
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
546
|
+
const tableCellInput = isTableCellInput(rawBlock) ? rawBlock : void 0;
|
|
547
|
+
return {
|
|
548
|
+
text: rawBlock.text,
|
|
549
|
+
italic: rawBlock.italic,
|
|
550
|
+
underline: rawBlock.underline,
|
|
551
|
+
link: rawBlock.link,
|
|
552
|
+
strike: rawBlock.strike,
|
|
553
|
+
bold: rawBlock.bold,
|
|
554
|
+
fontSize: rawBlock.fontSize,
|
|
555
|
+
font: rawBlock.font,
|
|
556
|
+
align: rawBlock.align,
|
|
557
|
+
color: rawBlock.color,
|
|
558
|
+
fillColor: tableCellInput?.fillColor,
|
|
559
|
+
style: rawBlock.style,
|
|
560
|
+
colSpan: tableCellInput?.colSpan,
|
|
561
|
+
rowSpan: tableCellInput?.rowSpan,
|
|
562
|
+
paddingTop: tableCellInput?.paddingTop,
|
|
563
|
+
paddingRight: tableCellInput?.paddingRight,
|
|
564
|
+
paddingBottom: tableCellInput?.paddingBottom,
|
|
565
|
+
paddingLeft: tableCellInput?.paddingLeft
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
var resolvePathValue = (obj, dottedPath) => {
|
|
569
|
+
if (!obj || typeof obj !== "object") return void 0;
|
|
570
|
+
return dottedPath.split(".").reduce((acc, key) => {
|
|
571
|
+
if (!acc || typeof acc !== "object") return void 0;
|
|
572
|
+
return acc[key];
|
|
573
|
+
}, obj);
|
|
574
|
+
};
|
|
575
|
+
var interpolateCellText = (text, item, rowIndex) => {
|
|
576
|
+
return text.replace(/\{\{\s*([^}]+)\s*\}\}/g, (_match, tokenRaw) => {
|
|
577
|
+
const token = tokenRaw.trim();
|
|
578
|
+
if (!token) return "";
|
|
579
|
+
if (token === "index") return String(rowIndex + 1);
|
|
580
|
+
const normalizedPath = token.startsWith("item.") ? token.slice(5) : token;
|
|
581
|
+
const value = resolvePathValue(item, normalizedPath);
|
|
582
|
+
if (value === void 0 || value === null) return "";
|
|
583
|
+
return typeof value === "string" ? value : String(value);
|
|
584
|
+
});
|
|
585
|
+
};
|
|
586
|
+
var applyIterableData = (cell, item, rowIndex) => ({
|
|
587
|
+
...cell,
|
|
588
|
+
text: interpolateCellText(cell.text, item, rowIndex)
|
|
589
|
+
});
|
|
590
|
+
var expandIterableRow = (table, bodyDef) => {
|
|
591
|
+
const templateRow = bodyDef.content.map(toTableCell).filter((cell) => cell !== null);
|
|
592
|
+
if (!templateRow.length) {
|
|
593
|
+
return [];
|
|
594
|
+
}
|
|
595
|
+
if (!bodyDef.isIterable) {
|
|
596
|
+
return [templateRow];
|
|
597
|
+
}
|
|
598
|
+
const iterableSource = table[bodyDef.iterableKey];
|
|
599
|
+
if (!Array.isArray(iterableSource) || !iterableSource.length) {
|
|
600
|
+
return [templateRow];
|
|
601
|
+
}
|
|
602
|
+
return iterableSource.map((item, rowIndex) => templateRow.map((cell) => applyIterableData(cell, item, rowIndex)));
|
|
603
|
+
};
|
|
604
|
+
var normalizeTableRows = (table) => {
|
|
605
|
+
if (!Array.isArray(table.body)) return [];
|
|
606
|
+
const rows = [];
|
|
607
|
+
for (const entry of table.body) {
|
|
608
|
+
if (Array.isArray(entry)) {
|
|
609
|
+
rows.push(entry);
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
if (isTableBodyIterableEntry(entry)) {
|
|
613
|
+
rows.push(...expandIterableRow(table, entry));
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return rows;
|
|
617
|
+
};
|
|
536
618
|
var measureTableHeight = (doc, table, env, styles, computeColumnPixelWidths2) => {
|
|
537
619
|
const localLeft = table.marginLeft ?? 0;
|
|
538
620
|
const localRight = table.marginRight ?? 0;
|
|
539
621
|
const width = Math.max(env.innerWidth - localLeft - localRight, 1);
|
|
622
|
+
const rows = normalizeTableRows(table);
|
|
540
623
|
const totalCols = table.widths.length;
|
|
541
624
|
const colWidths = computeColumnPixelWidths2(table.widths, width);
|
|
542
625
|
const rowHeights = [];
|
|
543
626
|
const activeRowSpans = Array(totalCols).fill(0);
|
|
544
627
|
const placedRows = [];
|
|
545
|
-
for (let rowIndex = 0; rowIndex <
|
|
546
|
-
const row =
|
|
628
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
629
|
+
const row = rows[rowIndex];
|
|
547
630
|
const placedRow = buildPlacedRow(row, totalCols, activeRowSpans);
|
|
548
631
|
placedRows.push(placedRow);
|
|
549
632
|
let rowHeight = 12;
|
|
@@ -609,12 +692,13 @@ var processTableBlock = (doc, ctx, styles, table, y, env, computeColumnPixelWidt
|
|
|
609
692
|
};
|
|
610
693
|
const borderAll = layout.border !== "none";
|
|
611
694
|
const headerRows = table.headerRows ?? 0;
|
|
612
|
-
const
|
|
695
|
+
const rows = normalizeTableRows(table);
|
|
696
|
+
const buildPlacementAndHeights = (rows2) => {
|
|
613
697
|
const placedRows = [];
|
|
614
698
|
const rowHeights = [];
|
|
615
699
|
const activeRowSpans = Array(totalCols).fill(0);
|
|
616
|
-
for (let rowIndex = 0; rowIndex <
|
|
617
|
-
const row =
|
|
700
|
+
for (let rowIndex = 0; rowIndex < rows2.length; rowIndex++) {
|
|
701
|
+
const row = rows2[rowIndex];
|
|
618
702
|
const placedRow = buildPlacedRow(row, totalCols, activeRowSpans);
|
|
619
703
|
placedRows.push(placedRow);
|
|
620
704
|
let rowHeight = 12;
|
|
@@ -657,7 +741,7 @@ var processTableBlock = (doc, ctx, styles, table, y, env, computeColumnPixelWidt
|
|
|
657
741
|
}
|
|
658
742
|
return { placedRows, rowHeights };
|
|
659
743
|
};
|
|
660
|
-
const allLayout = buildPlacementAndHeights(
|
|
744
|
+
const allLayout = buildPlacementAndHeights(rows);
|
|
661
745
|
const drawPlacedRow = (placedRow, rowTop2, rowHeight, rowIndex, rowHeights, isHeaderRow, drawTopBorder) => {
|
|
662
746
|
placedRow.forEach(({ cell: rawCell, startCol, colSpan, rowSpan }) => {
|
|
663
747
|
const cell = resolveTableCell(styles, rawCell);
|
|
@@ -714,7 +798,7 @@ var processTableBlock = (doc, ctx, styles, table, y, env, computeColumnPixelWidt
|
|
|
714
798
|
});
|
|
715
799
|
return rowTop2 + rowHeight;
|
|
716
800
|
};
|
|
717
|
-
const headerRowsSource =
|
|
801
|
+
const headerRowsSource = rows.slice(0, headerRows);
|
|
718
802
|
const drawHeaderRowsOnNewPage = () => {
|
|
719
803
|
if (!headerRows) return doc.page.margins.top + mt;
|
|
720
804
|
const headerLayout = buildPlacementAndHeights(headerRowsSource);
|
|
@@ -733,7 +817,7 @@ var processTableBlock = (doc, ctx, styles, table, y, env, computeColumnPixelWidt
|
|
|
733
817
|
return rowTop2;
|
|
734
818
|
};
|
|
735
819
|
let rowTop = startY;
|
|
736
|
-
for (let rowIndex = 0; rowIndex <
|
|
820
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
737
821
|
const isHeaderRow = rowIndex < headerRows;
|
|
738
822
|
const placedRow = allLayout.placedRows[rowIndex];
|
|
739
823
|
const rowHeight = allLayout.rowHeights[rowIndex];
|