pdfkit-table
Advanced tools
Comparing version 0.1.93 to 0.1.94
40
index.js
@@ -84,2 +84,3 @@ // jshint esversion: 6 | ||
options.minRowHeight || (options.minRowHeight = 0); | ||
// TODO options.hyperlink || (options.hyperlink = { urlToLink: false, description: null }); | ||
@@ -128,4 +129,6 @@ // divider lines | ||
let titleHeight = 0; | ||
let headerHeight = 0; | ||
this.headerHeight = 0; | ||
let firstLineHeight = 0; | ||
this.datasIndex = 0; | ||
this.rowsIndex = 0 ; | ||
let lockAddTitles = false; // to addd title one time | ||
@@ -367,4 +370,4 @@ let lockAddPage = false; | ||
// cell padding | ||
// cellp = prepareCellPadding(table.headers[i].padding || options.padding || 0); | ||
cellp = prepareCellPadding(options.padding || 0); | ||
cellp = prepareCellPadding(table.headers[i].padding || options.padding || 0); | ||
// cellp = prepareCellPadding(options.padding || 0); | ||
// - (cellp.left + cellp.right + (columnSpacing * 2)) | ||
@@ -455,5 +458,5 @@ // console.log(cellp); | ||
// calc header height | ||
if(headerHeight === 0){ | ||
headerHeight = computeRowHeight(table.headers, true); | ||
this.logg(headerHeight, 'headers'); | ||
if(this.headerHeight === 0){ | ||
this.headerHeight = computeRowHeight(table.headers, true); | ||
this.logg(this.headerHeight, 'headers'); | ||
} | ||
@@ -467,3 +470,3 @@ | ||
} | ||
else if(table.rows.length > 0){ | ||
if(table.rows.length > 0){ | ||
firstLineHeight = computeRowHeight(table.rows[0], true); | ||
@@ -477,3 +480,3 @@ this.logg(firstLineHeight, 'rows'); | ||
// calc if header + first line fit on last page | ||
const calc = startY + titleHeight + firstLineHeight + headerHeight + safelyMarginBottom// * 1.3; | ||
const calc = startY + titleHeight + firstLineHeight + this.headerHeight + safelyMarginBottom// * 1.3; | ||
@@ -520,3 +523,3 @@ // content is big text (crazy!) | ||
// Check to have enough room for header and first rows. default 3 | ||
// if (startY + 2 * headerHeight >= maxY) this.emitter.emit('addPage'); //this.addPage(); | ||
// if (startY + 2 * this.headerHeight >= maxY) this.emitter.emit('addPage'); //this.addPage(); | ||
@@ -533,3 +536,3 @@ if(!options.hideHeader && table.headers.length > 0) { | ||
// width: columnWidth, | ||
// height: headerHeight + columnSpacing, | ||
// height: this.headerHeight + columnSpacing, | ||
// }; | ||
@@ -548,3 +551,3 @@ | ||
width: columnSizes[i], | ||
height: headerHeight + columnSpacing, | ||
height: this.headerHeight + columnSpacing, | ||
}; | ||
@@ -610,3 +613,3 @@ | ||
width: width, | ||
height: headerHeight + columnSpacing, | ||
height: this.headerHeight + columnSpacing, | ||
}; | ||
@@ -657,2 +660,3 @@ | ||
this.datasIndex = i; | ||
const rowHeight = computeRowHeight(row, false); | ||
@@ -706,3 +710,3 @@ this.logg(rowHeight); | ||
prepareRowOptions(row); | ||
prepareRow(row, index, i, rectRow, rectCell); | ||
prepareRow(row, index, i, rectRow, rectCell,); | ||
@@ -749,3 +753,3 @@ let text = row[property]; | ||
if(typeof renderer === 'function'){ | ||
text = renderer(text, index, i, row, rectRow, rectCell); // value, index-column, index-row, row | ||
text = renderer(text, index, i, row, rectRow, rectCell, this); // value, index-column, index-row, row, doc[this] | ||
} | ||
@@ -772,3 +776,3 @@ | ||
align: align, | ||
}); | ||
}); | ||
@@ -810,2 +814,3 @@ lastPositionX += width; | ||
this.rowsIndex = i; | ||
const rowHeight = computeRowHeight(row, false); | ||
@@ -859,3 +864,3 @@ this.logg(rowHeight); | ||
// renderer column | ||
table.headers[index].renderer && (cell = table.headers[index].renderer(cell, index, i, row, rectRow, rectCell)); // text-cell, index-column, index-line, row | ||
table.headers[index].renderer && (cell = table.headers[index].renderer(cell, index, i, row, rectRow, rectCell, this)); // text-cell, index-column, index-line, row, doc[this] | ||
// align | ||
@@ -950,3 +955,4 @@ table.headers[index].align && (align = table.headers[index].align); | ||
typeof callback === 'function' && callback(this); | ||
// donw! | ||
resolve(); | ||
} catch (error) { | ||
@@ -953,0 +959,0 @@ reject(error); |
{ | ||
"name": "pdfkit-table", | ||
"version": "0.1.93", | ||
"version": "0.1.94", | ||
"description": "PdfKit Table. Helps to draw informations in simple tables using pdfkit. #server-side. Generate pdf tables with javascript (PDFKIT plugin) ", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
@@ -7,0 +8,0 @@ "test": "echo \"Error: no test specified\" && exit 1", |
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
11798723
6
808