pdfkit-table
Advanced tools
Comparing version 0.1.64 to 0.1.65
35
index.js
@@ -76,4 +76,4 @@ // jshint esversion: 6 | ||
const title = table.title ? table.title : ( options.title ? options.title : '' ) ; | ||
const subtitle = table.subtitle ? table.subtitle : ( options.subtitle ? options.subtitle : '' ) ; | ||
const title = table.title ? table.title : ( options.title || '' ) ; | ||
const subtitle = table.subtitle ? table.subtitle : ( options.subtitle || '' ) ; | ||
@@ -243,15 +243,28 @@ // const columnIsDefined = options.columnsSize.length ? true : false; | ||
let { fill, opac } = {}; | ||
// add backgroundColor | ||
if(row.hasOwnProperty('backgroundColor')){ | ||
if(row.hasOwnProperty('columnColor')){ // ^0.1.70 | ||
const { columnColor, columnOpacity } = row; | ||
fill = columnColor; | ||
opac = columnOpacity; | ||
} else if(row.hasOwnProperty('backgroundColor')){ // ~0.1.65 old | ||
const { backgroundColor, backgroundOpacity } = row; | ||
// add background | ||
this.addBackground(rect, backgroundColor, backgroundOpacity); | ||
fill = backgroundColor; | ||
opac = backgroundOpacity; | ||
} else if(row.hasOwnProperty('background')){ // dont remove | ||
if(typeof row.background === 'object'){ | ||
let { color, opacity } = row.background; | ||
fill = color; | ||
opac = opacity; | ||
} | ||
} | ||
// add background | ||
if(row.hasOwnProperty('background')){ | ||
const { color, opacity } = row.background; | ||
// add background | ||
this.addBackground(rect, color, opacity); | ||
} | ||
fill && this.addBackground(rect, fill, opac); | ||
@@ -258,0 +271,0 @@ }; |
{ | ||
"name": "pdfkit-table", | ||
"version": "0.1.64", | ||
"version": "0.1.65", | ||
"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", |
@@ -244,5 +244,4 @@ <img src="https://github.com/natancabral/pdfkit-table/blob/main/example/logo.png"/> | ||
| **headerAlign** | <code>String</code> | left | only header | | ||
| **background** | <code>Object</code> | undefined | background of column, sample: {"color": "grey", "opacity": 0.5} | | ||
| **backgroundColor** | <code>String</code> | undefined | color of column | | ||
| **backgroundOpacity**| <code>Number</code> | undefined | opacity of column | | ||
| **columnColor / backgroundColor** | <code>String</code> | undefined | color of column | | ||
| **columnOpacity / backgroundOpacity**| <code>Number</code> | undefined | opacity of column | | ||
| **renderer** | <code>Function</code> | Function | function( value, indexColumn, indexRow, row, rectRow, rectCell ) { return value } | | ||
@@ -249,0 +248,0 @@ |
38534
562
561