pdfkit-table
Advanced tools
Comparing version 0.1.91 to 0.1.92
42
index.js
@@ -123,3 +123,3 @@ // jshint esversion: 6 | ||
let lastPositionX = 0; | ||
let rowBottomY = 0; | ||
this.positionY = 0; | ||
@@ -190,3 +190,3 @@ //------------ experimental fast variables | ||
startY = this.page.margins.top; | ||
rowBottomY = 0; | ||
this.positionY = 0; | ||
// lockAddPage || this.addPage(this.options); | ||
@@ -632,7 +632,7 @@ lockAddPage || this.addPage({ | ||
// Refresh the y coordinate of the bottom of the headers row | ||
rowBottomY = Math.max(startY + computeRowHeight(table.headers, true), rowBottomY); | ||
this.positionY = Math.max(startY + computeRowHeight(table.headers, true), this.positionY); | ||
// Separation line between headers and rows | ||
separationsRow('header', startX, rowBottomY); | ||
separationsRow('header', startX, this.positionY); | ||
} else { | ||
rowBottomY = startY; | ||
this.positionY = startY; | ||
} | ||
@@ -653,3 +653,3 @@ | ||
// For safety, consider 3 rows margin instead of just one | ||
// if (startY + 2 * rowHeight < maxY) startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows | ||
// if (startY + 2 * rowHeight < maxY) startY = this.positionY + columnSpacing + rowDistance; // 0.5 is spacing rows | ||
// else this.emitter.emit('addPage'); //this.addPage(); | ||
@@ -659,3 +659,3 @@ if(options.useSafelyMarginBottom && this.y + safelyMarginBottom + rowHeight >= maxY && !lockAddPage) onFirePageAdded(); // this.emitter.emit('addPage'); //this.addPage(); | ||
// calc position | ||
startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows | ||
startY = this.positionY + columnSpacing + rowDistance; // 0.5 is spacing rows | ||
@@ -774,12 +774,12 @@ // unlock add page function | ||
// Refresh the y coordinate of the bottom of this row | ||
rowBottomY = Math.max(startY + rowHeight, rowBottomY); | ||
this.positionY = Math.max(startY + rowHeight, this.positionY); | ||
// console.log(this.page.height, rowBottomY, this.y); | ||
// console.log(this.page.height, this.positionY, this.y); | ||
// text is so big as page (crazy!) | ||
if(rowBottomY > this.page.height) { | ||
rowBottomY = this.y + columnSpacing + (rowDistance * 2); | ||
if(this.positionY > this.page.height) { | ||
this.positionY = this.y + columnSpacing + (rowDistance * 2); | ||
} | ||
// Separation line between rows | ||
separationsRow('horizontal', startX, rowBottomY); | ||
separationsRow('horizontal', startX, this.positionY); | ||
@@ -790,3 +790,3 @@ // review this code | ||
// Separation line between rows | ||
separationsRow('horizontal',startX, rowBottomY, 1, 1); | ||
separationsRow('horizontal',startX, this.positionY, 1, 1); | ||
} | ||
@@ -806,3 +806,3 @@ } | ||
// For safety, consider 3 rows margin instead of just one | ||
// if (startY + 3 * rowHeight < maxY) startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows | ||
// if (startY + 3 * rowHeight < maxY) startY = this.positionY + columnSpacing + rowDistance; // 0.5 is spacing rows | ||
// else this.emitter.emit('addPage'); //this.addPage(); | ||
@@ -812,3 +812,3 @@ if(options.useSafelyMarginBottom && this.y + safelyMarginBottom + rowHeight >= maxY && !lockAddPage) onFirePageAdded(); // this.emitter.emit('addPage'); //this.addPage(); | ||
// calc position | ||
startY = rowBottomY + columnSpacing + rowDistance; // 0.5 is spacing rows | ||
startY = this.positionY + columnSpacing + rowDistance; // 0.5 is spacing rows | ||
@@ -886,12 +886,12 @@ // unlock add page function | ||
// Refresh the y coordinate of the bottom of this row | ||
rowBottomY = Math.max(startY + rowHeight, rowBottomY); | ||
this.positionY = Math.max(startY + rowHeight, this.positionY); | ||
// console.log(this.page.height, rowBottomY, this.y); | ||
// console.log(this.page.height, this.positionY, this.y); | ||
// text is so big as page (crazy!) | ||
if(rowBottomY > this.page.height) { | ||
rowBottomY = this.y + columnSpacing + (rowDistance * 2); | ||
if(this.positionY > this.page.height) { | ||
this.positionY = this.y + columnSpacing + (rowDistance * 2); | ||
} | ||
// Separation line between rows | ||
separationsRow('horizontal', startX, rowBottomY); | ||
separationsRow('horizontal', startX, this.positionY); | ||
@@ -903,3 +903,3 @@ }); | ||
this.x = startX; | ||
this.y = rowBottomY; // position y final; | ||
this.y = this.positionY; // position y final; | ||
this.moveDown(); // break | ||
@@ -906,0 +906,0 @@ |
{ | ||
"name": "pdfkit-table", | ||
"version": "0.1.91", | ||
"version": "0.1.92", | ||
"description": "PdfKit Table. Helps to draw informations in simple tables using pdfkit. #server-side. Generate pdf tables with javascript (PDFKIT plugin) ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -128,3 +128,3 @@ <p align="center"> | ||
{ label: "Price 4", property: 'price4', width: 43, | ||
renderer: (value, indexColumn, indexRow, row) => { return `U$ ${Number(value).toFixed(2)}` } | ||
renderer: (value, indexColumn, indexRow, row, rectRow, rectCell) => { return `U$ ${Number(value).toFixed(2)}` } | ||
}, | ||
@@ -131,0 +131,0 @@ ], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54842