Skip to content

Commit

Permalink
webpack build
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Lustosa Madureira authored and simonbengtsson committed Dec 6, 2023
1 parent b3147a2 commit 525357f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
24 changes: 16 additions & 8 deletions dist/jspdf.plugin.autotable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,9 @@ function printTableWithHorizontalPageBreak(doc, table, startPos, cursor) {
doc.applyStyles(doc.userStyles);
// add page to print next columns in new page
if (index > 0) {
addPage(doc, table, startPos, cursor, colsAndIndexes.columns);
// When adding a page here, make sure not to print the footers
// because they were already printed before on this same loop
addPage(doc, table, startPos, cursor, colsAndIndexes.columns, true);
}
else {
// print head for selected columns
Expand All @@ -1705,21 +1707,26 @@ function printTableWithHorizontalPageBreak(doc, table, startPos, cursor) {
var lastPrintedRowIndex = lastRowIndexOfLastPage_1;
if (firstColumnsToFitResult) {
doc.applyStyles(doc.userStyles);
var firstColumnsToFit = firstColumnsToFitResult.columns;
if (lastRowIndexOfLastPage_1 >= 0) {
addPage(doc, table, startPos, cursor, firstColumnsToFitResult.columns);
// When adding a page here, make sure not to print the footers
// because they were already printed before on this same loop
addPage(doc, table, startPos, cursor, firstColumnsToFit, true);
}
else {
printHead(doc, table, cursor, firstColumnsToFitResult.columns);
printHead(doc, table, cursor, firstColumnsToFit);
}
lastPrintedRowIndex = printBodyWithoutPageBreaks(doc, table, lastRowIndexOfLastPage_1 + 1, cursor, firstColumnsToFitResult.columns);
printFoot(doc, table, cursor, firstColumnsToFitResult.columns);
lastPrintedRowIndex = printBodyWithoutPageBreaks(doc, table, lastRowIndexOfLastPage_1 + 1, cursor, firstColumnsToFit);
printFoot(doc, table, cursor, firstColumnsToFit);
}
// Check how many rows were printed, so that the next columns would not print more rows than that
var maxNumberOfRows = lastPrintedRowIndex - lastRowIndexOfLastPage_1;
// Print the next columns, never exceding maxNumberOfRows
allColumnsCanFitResult.slice(1).forEach(function (colsAndIndexes) {
doc.applyStyles(doc.userStyles);
addPage(doc, table, startPos, cursor, colsAndIndexes.columns);
// When adding a page here, make sure not to print the footers
// because they were already printed before on this same loop
addPage(doc, table, startPos, cursor, colsAndIndexes.columns, true);
printBodyWithoutPageBreaks(doc, table, lastRowIndexOfLastPage_1 + 1, cursor, colsAndIndexes.columns, maxNumberOfRows);
printFoot(doc, table, cursor, colsAndIndexes.columns);
});
Expand Down Expand Up @@ -2006,10 +2013,11 @@ function getRemainingPageSpace(doc, table, isLastRow, cursor) {
}
return doc.pageSize().height - cursor.y - bottomContentHeight;
}
function addPage(doc, table, startPos, cursor, columns) {
function addPage(doc, table, startPos, cursor, columns, suppressFooter) {
if (columns === void 0) { columns = []; }
if (suppressFooter === void 0) { suppressFooter = false; }
doc.applyStyles(doc.userStyles);
if (table.settings.showFoot === 'everyPage') {
if (table.settings.showFoot === 'everyPage' && !suppressFooter) {
table.foot.forEach(function (row) { return printRow(doc, table, row, cursor, columns); });
}
// Add user content just before adding new page ensure it will
Expand Down
Loading

0 comments on commit 525357f

Please sign in to comment.