Skip to content

Commit

Permalink
3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbengtsson committed Apr 28, 2020
1 parent 156a60f commit fc4abec
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 45 deletions.
4 changes: 2 additions & 2 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ export declare type CellInput = null | string | string[] | number | boolean | Ce
export declare type RowInput = {
[key: string]: CellInput;
} | HtmlRowInput | CellInput[];
export declare function applyPlugin(jsPDF: jsPDFConstructor): void;
export declare type autoTable = (options: UserOptions) => void;
export declare function autoTable(jsPDF: jsPDFConstructor, options: UserOptions): void;
export declare function applyPlugin(jsPDF: jsPDFConstructor): void;
export default function autoTable(doc: jsPDFDocument, options: UserOptions): void;

export {};
72 changes: 33 additions & 39 deletions dist/jspdf.plugin.autotable.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
*
* jsPDF AutoTable plugin v3.4.6
* jsPDF AutoTable plugin v3.5.0
*
* Copyright (c) 2020 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
* Licensed under the MIT License.
Expand Down Expand Up @@ -457,45 +457,22 @@ var documentHandler_1 = __webpack_require__(5);
var inputParser_1 = __webpack_require__(11);
var widthCalculator_1 = __webpack_require__(14);
var tableDrawer_1 = __webpack_require__(15);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function autoTable() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var doc = new documentHandler_1.DocHandler(this);
function autoTable(doc, options) {
var docHandler = new documentHandler_1.DocHandler(doc);
var win;
if (typeof window !== 'undefined') {
win = window;
}
// 1. Parse user input
var options = parseUserInput(args);
var table = inputParser_1.createTable(options, doc, win);
// 2. Calculate preliminary table, column, row and cell dimensions
widthCalculator_1.calculateWidths(table, doc);
// 3. Output table to pdf
tableDrawer_1.drawTable(table, doc);
var table = inputParser_1.createTable(options, docHandler, win);
widthCalculator_1.calculateWidths(table, docHandler);
tableDrawer_1.drawTable(table, docHandler);
table.finalY = table.cursor.y;
this.previousAutoTable = table;
this.lastAutoTable = table; // Deprecated
this.autoTable.previous = table; // Deprecated
doc.applyStyles(doc.userStyles);
return this;
}
exports.autoTable = autoTable;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function parseUserInput(args) {
if (args.length === 1) {
return args[0];
}
else {
console.error("Use of deprecated initiation format, use the new autoTable({/* options */}) instead");
var opts = args[2] || {};
opts.columns = args[0];
opts.body = args[1];
return opts;
}
doc.previousAutoTable = table;
doc.lastAutoTable = table; // Deprecated
doc.autoTable.previous = table; // Deprecated
docHandler.applyStyles(docHandler.userStyles);
}
exports.default = autoTable;


/***/ }),
Expand Down Expand Up @@ -861,11 +838,10 @@ function applyPlugin(jsPDF) {
applyPlugin_1.default(jsPDF);
}
exports.applyPlugin = applyPlugin;
function autoTable(jsPDF, options) {
applyPlugin_1.default(jsPDF);
autoTable_1.autoTable(options);
function autoTable(doc, options) {
autoTable_1.default(doc, options);
}
exports.autoTable = autoTable;
exports.default = autoTable;
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
var jsPDF = __webpack_require__(16);
Expand All @@ -890,7 +866,25 @@ var autoTableText_1 = __webpack_require__(3);
var autoTable_1 = __webpack_require__(4);
var documentHandler_1 = __webpack_require__(5);
function default_1(jsPDF) {
jsPDF.API.autoTable = autoTable_1.autoTable;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
jsPDF.API.autoTable = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var options;
if (args.length === 1) {
options = args[0];
}
else {
console.error('Use of deprecated autoTable initiation');
options = args[2] || {};
options.columns = args[0];
options.body = args[1];
}
autoTable_1.default(this, options);
return this;
};
// Assign false to enable `doc.lastAutoTable.finalY || 40` sugar
jsPDF.API.lastAutoTable = false;
jsPDF.API.previousAutoTable = false; // deprecated in v3
Expand Down
4 changes: 2 additions & 2 deletions dist/jspdf.plugin.autotable.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 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.4.6",
"version": "3.5.0",
"description": "Generate pdf tables with javascript (jsPDF plugin)",
"main": "dist/jspdf.plugin.autotable.js",
"types": "dist/index",
Expand Down

0 comments on commit fc4abec

Please sign in to comment.