From e58ea032f6264f25d657920b2a8ca28715a6f39d Mon Sep 17 00:00:00 2001 From: Arno Teigseth Date: Thu, 30 Mar 2023 23:29:43 -0500 Subject: [PATCH 1/2] small fix/hints on examples: fillColor, hLineColor and vLineColor gets 3 arguments (rowIndex, node, columnIndex) --- dev-playground/public/samples/tables | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dev-playground/public/samples/tables b/dev-playground/public/samples/tables index a88372282..9e54046bd 100644 --- a/dev-playground/public/samples/tables +++ b/dev-playground/public/samples/tables @@ -247,11 +247,11 @@ content: [ vLineWidth: function (i, node) { return (i === 0 || i === node.table.widths.length) ? 2 : 1; }, - hLineColor: function (i, node) { - return (i === 0 || i === node.table.body.length) ? 'black' : 'gray'; + hLineColor: function (rowIndex, node, columnIndex) { + return (rowIndex === 0 || rowIndex === node.table.body.length) ? 'black' : 'gray'; }, - vLineColor: function (i, node) { - return (i === 0 || i === node.table.widths.length) ? 'black' : 'gray'; + vLineColor: function (rowIndex, node, columnIndex) { + return (rowIndex === 0 || rowIndex === node.table.widths.length) ? 'black' : 'gray'; }, // hLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; }, // vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; }, @@ -259,7 +259,7 @@ content: [ // paddingRight: function(i, node) { return 4; }, // paddingTop: function(i, node) { return 2; }, // paddingBottom: function(i, node) { return 2; }, - // fillColor: function (i, node) { return null; } + // fillColor: function (rowIndex, node, columnIndex) { return null; } } }, {text: 'zebra style', margin: [0, 20, 0, 8]}, @@ -295,7 +295,7 @@ content: [ ['Sample value 1', 'Sample value 2', 'Sample value 3'] ] }, - }, + }, {text: '... using a custom styler and overriding it in the second row', margin: [0, 20, 0, 8]}, { style: 'tableOpacityExample', @@ -354,10 +354,10 @@ content: [ vLineWidth: function (i, node) { return (i === 0 || i === node.table.widths.length) ? 2 : 1; }, - hLineColor: function (i, node) { + hLineColor: function (rowIndex, node, columnIndex) { return 'black'; }, - vLineColor: function (i, node) { + vLineColor: function (rowIndex, node, columnIndex) { return 'black'; }, hLineStyle: function (i, node) { @@ -376,7 +376,7 @@ content: [ // paddingRight: function(i, node) { return 4; }, // paddingTop: function(i, node) { return 2; }, // paddingBottom: function(i, node) { return 2; }, - // fillColor: function (i, node) { return null; } + // fillColor: function (rowIndex, node, columnIndex) { return null; } } }, {text: 'Optional border', fontSize: 14, bold: true, pageBreak: 'before', margin: [0, 0, 0, 8]}, From b41765014344835b2c0bbcf10f6291736e481195 Mon Sep 17 00:00:00 2001 From: Arno Teigseth Date: Thu, 30 Mar 2023 23:32:07 -0500 Subject: [PATCH 2/2] more of same fixes --- examples/tables.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/tables.js b/examples/tables.js index c1a42e585..7677c15fa 100644 --- a/examples/tables.js +++ b/examples/tables.js @@ -259,11 +259,11 @@ var docDefinition = { vLineWidth: function (i, node) { return (i === 0 || i === node.table.widths.length) ? 2 : 1; }, - hLineColor: function (i, node) { - return (i === 0 || i === node.table.body.length) ? 'black' : 'gray'; + hLineColor: function (rowIndex, node, columnIndex) { + return (rowIndex === 0 || rowIndex === node.table.body.length) ? 'black' : 'gray'; }, - vLineColor: function (i, node) { - return (i === 0 || i === node.table.widths.length) ? 'black' : 'gray'; + vLineColor: function (rowIndex, node, columnIndex) { + return (rowIndex === 0 || rowIndex === node.table.widths.length) ? 'black' : 'gray'; }, // hLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; }, // vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; }, @@ -376,10 +376,10 @@ var docDefinition = { vLineWidth: function (i, node) { return (i === 0 || i === node.table.widths.length) ? 2 : 1; }, - hLineColor: function (i, node) { + hLineColor: function (rowIndex, node, columnIndex) { return 'black'; }, - vLineColor: function (i, node) { + vLineColor: function (rowIndex, node, columnIndex) { return 'black'; }, hLineStyle: function (i, node) { @@ -398,7 +398,7 @@ var docDefinition = { // paddingRight: function(i, node) { return 4; }, // paddingTop: function(i, node) { return 2; }, // paddingBottom: function(i, node) { return 2; }, - // fillColor: function (i, node) { return null; } + // fillColor: function (rowIndex, node, columnIndex) { return null; } } }, { text: 'Optional border', fontSize: 14, bold: true, pageBreak: 'before', margin: [0, 0, 0, 8] },