Skip to content

Commit

Permalink
3.5.31
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbengtsson committed Jul 14, 2023
1 parent b1ef364 commit 56a045e
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 13 deletions.
10 changes: 9 additions & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ declare class DocHandler {
private static unifyColor;
applyStyles(styles: Partial<Styles>, fontOnly?: boolean): void;
splitTextToSize(text: string | string[], size: number, opts: Opts): string[];
rect(x: number, y: number, width: number, height: number, fillStyle: string | null): any;
/**
* Adds a rectangle to the PDF
* @param x Coordinate (in units declared at inception of PDF document) against left edge of the page
* @param y Coordinate (in units declared at inception of PDF document) against upper edge of the page
* @param width Width (in units declared at inception of PDF document)
* @param height Height (in units declared at inception of PDF document)
* @param fillStyle A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. In "compat" API mode, a null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument. **In "advanced" API mode this parameter is deprecated.**
*/
rect(x: number, y: number, width: number, height: number, fillStyle: "S" | "F" | "DF" | "FD" | null): any;
getLastAutoTable(): Table | null;
getTextWidth(text: string | string[]): number;
getDocument(): any;
Expand Down
19 changes: 15 additions & 4 deletions dist/jspdf.plugin.autotable.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
*
* jsPDF AutoTable plugin v3.5.30
* jsPDF AutoTable plugin v3.5.31
*
* Copyright (c) 2023 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
* Licensed under the MIT License.
Expand Down Expand Up @@ -652,7 +652,18 @@ var DocHandler = /** @class */ (function () {
DocHandler.prototype.splitTextToSize = function (text, size, opts) {
return this.jsPDFDocument.splitTextToSize(text, size, opts);
};
/**
* Adds a rectangle to the PDF
* @param x Coordinate (in units declared at inception of PDF document) against left edge of the page
* @param y Coordinate (in units declared at inception of PDF document) against upper edge of the page
* @param width Width (in units declared at inception of PDF document)
* @param height Height (in units declared at inception of PDF document)
* @param fillStyle A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. In "compat" API mode, a null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument. **In "advanced" API mode this parameter is deprecated.**
*/
DocHandler.prototype.rect = function (x, y, width, height, fillStyle) {
if (!['S', 'F', 'DF', 'FD', null].some(function (v) { return v === fillStyle; })) {
throw new TypeError("Invalid value '".concat(fillStyle, "' passed to rect. Allowed values are: 'S', 'F', 'DF', 'FD', null"));
}
return this.jsPDFDocument.rect(x, y, width, height, fillStyle);
};
DocHandler.prototype.getLastAutoTable = function () {
Expand Down Expand Up @@ -1837,11 +1848,11 @@ function drawCellBorders(doc, cell, cursor) {
* @param doc
* @param cell
* @param cursor
* @param fillColor - `false` for transparent, `string` for color, other types will use "F" from jsPDF.rect
* @param fillColor - passed to getFillStyle; `false` will map to transparent, `truthy` values to 'F' from jsPDF.rect
*/
function drawCellBackground(doc, cell, cursor, fillColor) {
var cellFillColor = fillColor === false ? null : typeof fillColor !== 'string' ? 'F' : fillColor;
doc.rect(cell.x, cursor.y, cell.width, cell.height, cellFillColor);
var fillStyle = (0, common_1.getFillStyle)(0, fillColor);
doc.rect(cell.x, cursor.y, cell.width, cell.height, fillStyle);
}
/**
* Draw all specified borders. Borders are centered on cell's edge and lengthened
Expand Down
4 changes: 2 additions & 2 deletions dist/jspdf.plugin.autotable.min.js

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions dist/jspdf.plugin.autotable.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,18 @@ var DocHandler = /** @class */ (function () {
DocHandler.prototype.splitTextToSize = function (text, size, opts) {
return this.jsPDFDocument.splitTextToSize(text, size, opts);
};
/**
* Adds a rectangle to the PDF
* @param x Coordinate (in units declared at inception of PDF document) against left edge of the page
* @param y Coordinate (in units declared at inception of PDF document) against upper edge of the page
* @param width Width (in units declared at inception of PDF document)
* @param height Height (in units declared at inception of PDF document)
* @param fillStyle A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. In "compat" API mode, a null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument. **In "advanced" API mode this parameter is deprecated.**
*/
DocHandler.prototype.rect = function (x, y, width, height, fillStyle) {
if (!['S', 'F', 'DF', 'FD', null].some(function (v) { return v === fillStyle; })) {
throw new TypeError("Invalid value '".concat(fillStyle, "' passed to rect. Allowed values are: 'S', 'F', 'DF', 'FD', null"));
}
return this.jsPDFDocument.rect(x, y, width, height, fillStyle);
};
DocHandler.prototype.getLastAutoTable = function () {
Expand Down Expand Up @@ -1502,11 +1513,11 @@ function drawCellBorders(doc, cell, cursor) {
* @param doc
* @param cell
* @param cursor
* @param fillColor - `false` for transparent, `string` for color, other types will use "F" from jsPDF.rect
* @param fillColor - passed to getFillStyle; `false` will map to transparent, `truthy` values to 'F' from jsPDF.rect
*/
function drawCellBackground(doc, cell, cursor, fillColor) {
var cellFillColor = fillColor === false ? null : typeof fillColor !== 'string' ? 'F' : fillColor;
doc.rect(cell.x, cursor.y, cell.width, cell.height, cellFillColor);
var fillStyle = getFillStyle(0, fillColor);
doc.rect(cell.x, cursor.y, cell.width, cell.height, fillStyle);
}
/**
* Draw all specified borders. Borders are centered on cell's edge and lengthened
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jspdf-autotable",
"version": "3.5.30",
"version": "3.5.31",
"description": "Generate pdf tables with javascript (jsPDF plugin)",
"main": "dist/jspdf.plugin.autotable.js",
"exports": {
Expand Down

0 comments on commit 56a045e

Please sign in to comment.