diff --git a/dist/index.d.ts b/dist/index.d.ts index eecf7035..45364472 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -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 {}; diff --git a/dist/jspdf.plugin.autotable.js b/dist/jspdf.plugin.autotable.js index f470137c..9019ff0a 100644 --- a/dist/jspdf.plugin.autotable.js +++ b/dist/jspdf.plugin.autotable.js @@ -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. @@ -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; /***/ }), @@ -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); @@ -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 diff --git a/dist/jspdf.plugin.autotable.min.js b/dist/jspdf.plugin.autotable.min.js index d71d8d7b..c67f98cc 100644 --- a/dist/jspdf.plugin.autotable.min.js +++ b/dist/jspdf.plugin.autotable.min.js @@ -1,10 +1,10 @@ /*! * - * 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. * http://opensource.org/licenses/mit-license * */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(function(){try{return require("jspdf")}catch(t){}}());else if("function"==typeof define&&define.amd)define(["jspdf"],e);else{var n="object"==typeof exports?e(function(){try{return require("jspdf")}catch(t){}}()):e(t.jsPDF);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(function(t){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=8)}([function(t,e,n){"use strict";function o(t,e){var n=t>0,o=e||0===e;return n&&o?"DF":n?"S":o?"F":null}Object.defineProperty(e,"__esModule",{value:!0}),e.getStringWidth=function(t,e,n){return n.applyStyles(e,!0),(Array.isArray(t)?t:[t]).map((function(t){return n.getTextWidth(t)})).reduce((function(t,e){return Math.max(t,e)}),0)},e.addTableBorder=function(t,e){var n=t.settings.tableLineWidth,r=t.settings.tableLineColor;e.applyStyles({lineWidth:n,lineColor:r});var i=o(n,!1);i&&e.rect(t.pageStartX,t.pageStartY,t.width,t.cursor.y-t.pageStartY,i)},e.getFillStyle=o,e.marginOrPadding=function(t,e){var n,o,r,i;if(t=t||e,Array.isArray(t)){if(t.length>=4)return{top:t[0],right:t[1],bottom:t[2],left:t[3]};if(3===t.length)return{top:t[0],right:t[1],bottom:t[2],left:t[1]};if(2===t.length)return{top:t[0],right:t[1],bottom:t[0],left:t[1]};t=1===t.length?t[0]:e}return"object"==typeof t?("number"==typeof t.vertical&&(t.top=t.vertical,t.bottom=t.vertical),"number"==typeof t.horizontal&&(t.right=t.horizontal,t.left=t.horizontal),{left:null!==(n=t.left)&&void 0!==n?n:e,top:null!==(o=t.top)&&void 0!==o?o:e,right:null!==(r=t.right)&&void 0!==r?r:e,bottom:null!==(i=t.bottom)&&void 0!==i?i:e}):("number"!=typeof t&&(t=e),{top:t,right:t,bottom:t,left:t})}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.FONT_ROW_RATIO=1.15;var i=function(t){function e(e){var n=t.call(this)||this;return n._element=e,n}return r(e,t),e}(Array);e.HtmlRowInput=i,e.defaultStyles=function(t){return{font:"helvetica",fontStyle:"normal",overflow:"linebreak",fillColor:!1,textColor:20,halign:"left",valign:"top",fontSize:10,cellPadding:5/t,lineColor:200,lineWidth:0,cellWidth:"auto",minCellHeight:0,minCellWidth:0}},e.getTheme=function(t){return{striped:{table:{fillColor:255,textColor:80,fontStyle:"normal"},head:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},body:{},foot:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1},head:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},body:{},foot:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},alternateRow:{}},plain:{head:{fontStyle:"bold"},foot:{fontStyle:"bold"}}}[t]}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(10),r=n(1);function i(t,e,n,i,a,s){for(var u=new r.HtmlRowInput(i),d=0;d0&&(a||"none"!==g.display))return u}function l(t){var e=t.cloneNode(!0);return e.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/ +/g," "),e.innerHTML=e.innerHTML.split("
").map((function(t){return t.trim()})).join("\n"),e.innerText||e.textContent||""}e.parseHtml=function(t,e,n,o,r){var l,a,s;void 0===o&&(o=!1),void 0===r&&(r=!1),s="string"==typeof e?n.document.querySelector(e):e;var u=Object.keys(t.getFontList()),d=t.scaleFactor(),h=[],c=[],f=[];if(!s)return console.error("Html table could not be found with input: ",e),{head:h,body:c,foot:f};for(var g=0;g=1){for(var d=0;d1})).length>0},t.prototype.canEntireRowFit=function(t){return this.maxCellHeight<=t},t.prototype.getMinimumRowHeight=function(t,e){var n=this;return t.reduce((function(t,r){var i=n.cells[r.index];if(!i)return 0;var l=i.styles.fontSize/e.scaleFactor()*o.FONT_ROW_RATIO,a=i.padding("vertical")+l;return a>t?a:t}),0)},t}();e.Row=a;var s=function(){function t(t,e,n){var o,r;this.contentHeight=0,this.contentWidth=0,this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.height=0,this.textPos={y:0,x:0},this.x=0,this.y=0,this.colSpan=1,this.rowSpan=1,this.styles=e,this.section=n,this.raw=t;var i=t;null==t||"object"!=typeof t||Array.isArray(t)||(this.rowSpan=t.rowSpan||1,this.colSpan=t.colSpan||1,i=null!==(r=null!==(o=t.content)&&void 0!==o?o:t.title)&&void 0!==r?r:t,t._element&&(this.raw=t._element));var l=null!=i?""+i:"";this.text=l.split(/\r\n|\r|\n/g)}return t.prototype.getContentHeight=function(t){return(Array.isArray(this.text)?this.text.length:1)*(this.styles.fontSize/t.scaleFactor()*o.FONT_ROW_RATIO)+this.padding("vertical")},t.prototype.padding=function(t){var e=i.marginOrPadding(this.styles.cellPadding,0);return"vertical"===t?e.top+e.bottom:"horizontal"===t?e.left+e.right:e[t]},t}();e.Cell=s;var u=function(){function t(t,e,n){this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.dataKey=t,this.raw=e,this.index=n}return t.prototype.getMaxCustomCellWidth=function(t){for(var e=0,n=0,o=t.allRows();n {}}) instead."),t.API.autoTable.globalDefaults||(t.API.autoTable.globalDefaults={}),t.API.autoTable.globalDefaults.addPageContent=e,this},t.API.autoTableAddPage=function(){return console.error("Use of deprecated function: autoTableAddPage. Use doc.addPage()"),this.addPage(),this}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);function r(t,e){var n=function t(e,n){var o=n(e);return"rgba(0, 0, 0, 0)"===o||"transparent"===o||"initial"===o||"inherit"===o?null==e.parentElement?null:t(e.parentElement,n):o}(t,e);if(!n)return null;var o=n.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);if(!o||!Array.isArray(o))return null;var r=[parseInt(o[1]),parseInt(o[2]),parseInt(o[3])];return 0===parseInt(o[4])||isNaN(r[0])||isNaN(r[1])||isNaN(r[2])?null:r}e.parseCss=function(t,e,n,i,l){var a={},s=r(e,(function(t){return l.getComputedStyle(t).backgroundColor}));null!=s&&(a.fillColor=s),null!=(s=r(e,(function(t){return l.getComputedStyle(t).color})))&&(a.textColor=s),null!=(s=r(e,(function(t){return l.getComputedStyle(t).borderTopColor})))&&(a.lineColor=s);var u=function(t,e){var n=[t.paddingTop,t.paddingRight,t.paddingBottom,t.paddingLeft],r=96/(72/e),i=(parseInt(t.lineHeight)-parseInt(t.fontSize))/e/2,l=n.map((function(t){return parseInt(t)/r})),a=o.marginOrPadding(l,0);i>a.top&&(a.top=i);i>a.bottom&&(a.bottom=i);return a}(i,n);u&&(a.cellPadding=u);var d=parseInt(i.borderTopWidth||"");(d=d/(96/72)/n)&&(a.lineWidth=d);var h=["left","right","center","justify"];-1!==h.indexOf(i.textAlign)&&(a.halign=i.textAlign),-1!==(h=["middle","bottom","top"]).indexOf(i.verticalAlign)&&(a.valign=i.verticalAlign);var c=parseInt(i.fontSize||"");isNaN(c)||(a.fontSize=c/(96/72));var f=function(t){var e="";("bold"===t.fontWeight||"bolder"===t.fontWeight||parseInt(t.fontWeight)>=700)&&(e="bold");"italic"!==t.fontStyle&&"oblique"!==t.fontStyle||(e+="italic");return e}(i);f&&(a.fontStyle=f);var g=(i.fontFamily||"").toLowerCase();return-1!==t.indexOf(g)&&(a.font=g),a}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(2),i=n(6),l=n(0),a=n(12),s=n(7);function u(t,e,n,o,r,i,l){var a={};return e.map((function(e,n){for(var u=0,d=new s.Row(e,n,t),c=0,f=0,g=0,p=o;g0?n:null}function h(t,e,n,r,l,a,s){var u,d=o.getTheme(r);"head"===t?u=l.headStyles:"body"===t?u=l.bodyStyles:"foot"===t&&(u=l.footStyles);var h=i.assign({},d.table,d[t],l.styles,u),c=l.columnStyles[e.dataKey]||l.columnStyles[e.index]||{},f="body"===t?c:{},g="body"===t&&n%2==0?i.assign({},d.alternateRow,l.alternateRowStyles):{},p=o.defaultStyles(a),y=i.assign({},p,h,g,f);return i.assign(y,s)}e.createTable=function(t,e,n){var o=e.getDocumentOptions(),h=e.getGlobalOptions();a.default(h,o,t,e);var c=i.assign({},h,o,t),f=e.getPreviousAutoTable(),g=e.scaleFactor(),p=l.marginOrPadding(c.margin,40/g),y=function(t,e,n,o){var r,i,l,a,s,u,d,h,c,f,g;f=!0===t.showFoot?"everyPage":!1===t.showFoot?"never":null!==(r=t.showFoot)&&void 0!==r?r:"everyPage";g=!0===t.showHead?"everyPage":!1===t.showHead?"never":null!==(i=t.showHead)&&void 0!==i?i:"everyPage";var p=null!==(l=t.useCss)&&void 0!==l&&l,y=t.theme||(p?"plain":"striped");return{includeHiddenHtml:null!==(a=t.includeHiddenHtml)&&void 0!==a&&a,useCss:p,theme:y,startY:n,margin:o,pageBreak:null!==(s=t.pageBreak)&&void 0!==s?s:"auto",rowPageBreak:null!==(u=t.rowPageBreak)&&void 0!==u?u:"auto",tableWidth:null!==(d=t.tableWidth)&&void 0!==d?d:"auto",showHead:g,showFoot:f,tableLineWidth:null!==(h=t.tableLineWidth)&&void 0!==h?h:0,tableLineColor:null!==(c=t.tableLineColor)&&void 0!==c?c:200}}(c,0,function(t,e,n,o,r){var i=!1;if(t){var l=t.startPageNumber+t.pageNumber-1;i=l===n}var a=o.startY;null!=a&&!1!==a||i&&(a=t.finalY+20/e);return a||r}(f,g,e.pageNumber(),c,p.top),p),v=function(t,e,n){for(var o={styles:{},headStyles:{},bodyStyles:{},footStyles:{},alternateRowStyles:{},columnStyles:{}},r=function(r){if("columnStyles"===r){var l=t[r],a=e[r],s=n[r];o.columnStyles=i.assign({},l,a,s)}else{var u=[t,e,n].map((function(t){return t[r]||{}}));o[r]=i.assign({},u[0],u[1],u[2])}},l=0,a=Object.keys(o);l0?"_"+o:""),i.push(new s.Column(l,null,i.length))}})),i}(e,a,h,c);if(0===a.length&&e.columns){(y=d(p,"head"))&&a.push(y)}if(0===c.length&&e.columns){var y;(y=d(p,"foot"))&&c.push(y)}return{columns:p,head:u("head",a,e,p,n,o,i),body:u("body",h,e,p,n,o,i),foot:u("foot",c,e,p,n,o,i)}}(e,c,v,y.theme,g,n),b=new s.Table(t.tableId,y,v,function(t,e,n){for(var o={didParseCell:[],willDrawCell:[],didDrawCell:[],didDrawPage:[]},r=0,i=[t,e,n];rs.wrappedWidth&&(s.wrappedWidth=s.minWidth)}}}})),t.allRows().forEach((function(e){for(var n=0,o=t.columns;n1&&!r.minWidth&&(r.minWidth=i.minWidth),i.colSpan>1&&!r.wrappedWidth&&(r.wrappedWidth=i.minWidth))}}))}(b,g,e),b.minWidth=b.columns.reduce((function(t,e){return t+e.minWidth}),0),b.wrappedWidth=b.columns.reduce((function(t,e){return t+e.wrappedWidth}),0),"number"==typeof b.settings.tableWidth?b.width=b.settings.tableWidth:"wrap"===b.settings.tableWidth?b.width=b.wrappedWidth:b.width=e.pageSize().width-p.left-p.right,b}},function(t,e,n){"use strict";function o(t){t.rowHeight?(console.error("Use of deprecated style rowHeight. It is renamed to minCellHeight."),t.minCellHeight||(t.minCellHeight=t.rowHeight)):t.columnWidth&&(console.error("Use of deprecated style columnWidth. It is renamed to cellWidth."),t.cellWidth||(t.cellWidth=t.columnWidth))}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n,r){for(var i=function(t){t&&"object"!=typeof t&&console.error("The options parameter should be of type object, is: "+typeof t),void 0!==t.extendWidth&&(t.tableWidth=t.extendWidth?"auto":"wrap",console.error("Use of deprecated option: extendWidth, use tableWidth instead.")),void 0!==t.margins&&(void 0===t.margin&&(t.margin=t.margins),console.error("Use of deprecated option: margins, use margin instead.")),t.startY&&"number"!=typeof t.startY&&(console.error("Invalid value for startY option",t.startY),delete t.startY),!t.didDrawPage&&(t.afterPageContent||t.beforePageContent||t.afterPageAdd)&&(console.error("The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use didDrawPage instead"),t.didDrawPage=function(e){r.applyStyles(r.userStyles),t.beforePageContent&&t.beforePageContent(e),r.applyStyles(r.userStyles),t.afterPageContent&&t.afterPageContent(e),r.applyStyles(r.userStyles),t.afterPageAdd&&e.pageNumber>1&&e.afterPageAdd(e),r.applyStyles(r.userStyles)}),["createdHeaderCell","drawHeaderRow","drawRow","drawHeaderCell"].forEach((function(e){t[e]&&console.error('The "'+e+'" hook has changed in version 3.0, check the changelog for how to migrate.')})),[["showFoot","showFooter"],["showHead","showHeader"],["didDrawPage","addPageContent"],["didParseCell","createdCell"],["headStyles","headerStyles"]].forEach((function(e){var n=e[0],o=e[1];t[o]&&(console.error("Use of deprecated option "+o+". Use "+n+" instead"),t[n]=t[o])})),[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach((function(e){var n="string"==typeof e?e:e[0],o="string"==typeof e?e:e[1];void 0!==t[n]&&(void 0===t.styles[o]&&(t.styles[o]=t[n]),console.error("Use of deprecated option: "+n+", use the style "+o+" instead."))}));for(var e=0,n=["styles","bodyStyles","headStyles","footStyles"];en(t)}));c.length&&(e=r(c,e,n))}return e}function i(t,e,n,r,i){return t.map((function(t){return function(t,e,n,r,i){var l=1e4*r.scaleFactor();if((e=Math.ceil(e*l)/l)>=o.getStringWidth(t,n,r))return t;for(;e1e-10&&(l=l<1?l:Math.round(l),console.error("Of the table content, "+l+" units width could not fit page")),function(t){for(var e=t.allRows(),n=0;n1&&t.columns[a+1])i+=s.width,delete o.cells[s.index];else if(r){var u=r;delete o.cells[s.index],r=null,u.width=s.width+i}else{if(!(u=o.cells[s.index]))continue;if(l=u.colSpan,i=0,u.colSpan>1){r=u,i+=s.width;continue}u.width=s.width+i}}}(t),function(t,e){for(var n={count:0,height:0},o=0,r=t.allRows();od.contentHeight&&(d.contentHeight=d.styles.minCellHeight);var c=d.contentHeight/d.rowSpan;d.rowSpan>1&&n.count*n.height0&&n.height>c&&(c=n.height),c>l.height&&(l.height=c,l.maxCellHeight=c)}}n.count--}}(t,e),function(t){for(var e={},n=1,o=t.allRows(),r=0;r1)n--,delete i.cells[s.index];else if(u)u.cell.height+=i.height,u.cell.height>i.maxCellHeight&&(u.row.maxCellHeight=u.cell.height),n=u.cell.colSpan,delete i.cells[s.index],u.left--,u.left<=1&&delete e[s.index];else{var d=i.cells[s.index];if(!d)continue;if(d.height=i.height,d.rowSpan>1){var h=o.length-r,c=d.rowSpan>h?h:d.rowSpan;e[s.index]={cell:d,left:c,row:i}}}}"head"===i.section&&(t.headHeight+=i.maxCellHeight),"foot"===i.section&&(t.footHeight+=i.maxCellHeight),t.height+=i.height}}(t)},e.resizeColumns=r,e.ellipsize=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(0),i=n(7),l=n(6),a=n(3);function s(t,e,n){var r=t.styles.fontSize/n.scaleFactor()*o.FONT_ROW_RATIO,i=t.padding("vertical"),l=Math.floor((e-i)/r);return Math.max(0,l)}function u(t,e,n){t.cursor.x=t.settings.margin.left,e.y=t.cursor.y,e.x=t.cursor.x;for(var o=0,i=t.columns;oe.pageSize().height)&&(h(e),t.cursor.y=a.top),t.pageStartX=t.cursor.x,t.pageStartY=t.cursor.y,t.startPageNumber=e.pageNumber(),e.applyStyles(e.userStyles),"firstPage"!==n.showHead&&"everyPage"!==n.showHead||t.head.forEach((function(n){return u(t,n,e)})),e.applyStyles(e.userStyles),t.body.forEach((function(n,o){!function t(e,n,o,r){var a=function(t,e,n){var o=t.settings.margin.bottom,r=t.settings.showFoot;("everyPage"===r||"lastPage"===r&&e)&&(o+=t.footHeight);return n.pageSize().height-t.cursor.y-o}(e,o,r);if(n.canEntireRowFit(a))u(e,n,r);else if(function(t,e,n,o){var r=t.pageSize().height,i=o.settings.margin,l=i.top+i.bottom,a=r-l;"body"===e.section&&(a-=o.headHeight+o.footHeight);var s=e.getMinimumRowHeight(o.columns,t),u=sa)return console.error("Will not be able to print row "+e.index+" correctly since it's minimum height is larger than page height"),!0;if(!u)return!1;var d=e.hasRowSpan(o.columns);if(e.maxCellHeight>a)return d&&console.error("The content of row "+e.index+" will not be drawn correctly since drawing rows with a height larger than the page height and has cells with rowspans is not supported."),!0;if(d)return!1;if("avoid"===o.settings.rowPageBreak)return!1;return!0}(r,n,a,e)){var h=function(t,e,n,o){var r=new i.Row(t.raw,-1,t.section);r.spansMultiplePages=!0,t.spansMultiplePages=!0,t.height=0,t.maxCellHeight=0;for(var a=0,u=n.columns;ac&&(h.text=p.text.splice(c,p.text.length)),p.contentHeight=p.getContentHeight(o),p.contentHeight>t.height&&(t.height=p.contentHeight,t.maxCellHeight=p.contentHeight),h.contentHeight=h.getContentHeight(o),h.contentHeight>r.height&&(r.height=h.contentHeight,r.maxCellHeight=h.contentHeight),r.cells[d.index]=h}}for(var f=0,g=n.columns;f0,o=e||0===e;return n&&o?"DF":n?"S":o?"F":null}Object.defineProperty(e,"__esModule",{value:!0}),e.getStringWidth=function(t,e,n){return n.applyStyles(e,!0),(Array.isArray(t)?t:[t]).map((function(t){return n.getTextWidth(t)})).reduce((function(t,e){return Math.max(t,e)}),0)},e.addTableBorder=function(t,e){var n=t.settings.tableLineWidth,r=t.settings.tableLineColor;e.applyStyles({lineWidth:n,lineColor:r});var i=o(n,!1);i&&e.rect(t.pageStartX,t.pageStartY,t.width,t.cursor.y-t.pageStartY,i)},e.getFillStyle=o,e.marginOrPadding=function(t,e){var n,o,r,i;if(t=t||e,Array.isArray(t)){if(t.length>=4)return{top:t[0],right:t[1],bottom:t[2],left:t[3]};if(3===t.length)return{top:t[0],right:t[1],bottom:t[2],left:t[1]};if(2===t.length)return{top:t[0],right:t[1],bottom:t[0],left:t[1]};t=1===t.length?t[0]:e}return"object"==typeof t?("number"==typeof t.vertical&&(t.top=t.vertical,t.bottom=t.vertical),"number"==typeof t.horizontal&&(t.right=t.horizontal,t.left=t.horizontal),{left:null!==(n=t.left)&&void 0!==n?n:e,top:null!==(o=t.top)&&void 0!==o?o:e,right:null!==(r=t.right)&&void 0!==r?r:e,bottom:null!==(i=t.bottom)&&void 0!==i?i:e}):("number"!=typeof t&&(t=e),{top:t,right:t,bottom:t,left:t})}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.FONT_ROW_RATIO=1.15;var i=function(t){function e(e){var n=t.call(this)||this;return n._element=e,n}return r(e,t),e}(Array);e.HtmlRowInput=i,e.defaultStyles=function(t){return{font:"helvetica",fontStyle:"normal",overflow:"linebreak",fillColor:!1,textColor:20,halign:"left",valign:"top",fontSize:10,cellPadding:5/t,lineColor:200,lineWidth:0,cellWidth:"auto",minCellHeight:0,minCellWidth:0}},e.getTheme=function(t){return{striped:{table:{fillColor:255,textColor:80,fontStyle:"normal"},head:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},body:{},foot:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1},head:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},body:{},foot:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},alternateRow:{}},plain:{head:{fontStyle:"bold"},foot:{fontStyle:"bold"}}}[t]}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(10),r=n(1);function i(t,e,n,i,a,s){for(var u=new r.HtmlRowInput(i),d=0;d0&&(a||"none"!==g.display))return u}function l(t){var e=t.cloneNode(!0);return e.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/ +/g," "),e.innerHTML=e.innerHTML.split("
").map((function(t){return t.trim()})).join("\n"),e.innerText||e.textContent||""}e.parseHtml=function(t,e,n,o,r){var l,a,s;void 0===o&&(o=!1),void 0===r&&(r=!1),s="string"==typeof e?n.document.querySelector(e):e;var u=Object.keys(t.getFontList()),d=t.scaleFactor(),h=[],c=[],f=[];if(!s)return console.error("Html table could not be found with input: ",e),{head:h,body:c,foot:f};for(var g=0;g=1){for(var d=0;d1})).length>0},t.prototype.canEntireRowFit=function(t){return this.maxCellHeight<=t},t.prototype.getMinimumRowHeight=function(t,e){var n=this;return t.reduce((function(t,r){var i=n.cells[r.index];if(!i)return 0;var l=i.styles.fontSize/e.scaleFactor()*o.FONT_ROW_RATIO,a=i.padding("vertical")+l;return a>t?a:t}),0)},t}();e.Row=a;var s=function(){function t(t,e,n){var o,r;this.contentHeight=0,this.contentWidth=0,this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.height=0,this.textPos={y:0,x:0},this.x=0,this.y=0,this.colSpan=1,this.rowSpan=1,this.styles=e,this.section=n,this.raw=t;var i=t;null==t||"object"!=typeof t||Array.isArray(t)||(this.rowSpan=t.rowSpan||1,this.colSpan=t.colSpan||1,i=null!==(r=null!==(o=t.content)&&void 0!==o?o:t.title)&&void 0!==r?r:t,t._element&&(this.raw=t._element));var l=null!=i?""+i:"";this.text=l.split(/\r\n|\r|\n/g)}return t.prototype.getContentHeight=function(t){return(Array.isArray(this.text)?this.text.length:1)*(this.styles.fontSize/t.scaleFactor()*o.FONT_ROW_RATIO)+this.padding("vertical")},t.prototype.padding=function(t){var e=i.marginOrPadding(this.styles.cellPadding,0);return"vertical"===t?e.top+e.bottom:"horizontal"===t?e.left+e.right:e[t]},t}();e.Cell=s;var u=function(){function t(t,e,n){this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.dataKey=t,this.raw=e,this.index=n}return t.prototype.getMaxCustomCellWidth=function(t){for(var e=0,n=0,o=t.allRows();n {}}) instead."),t.API.autoTable.globalDefaults||(t.API.autoTable.globalDefaults={}),t.API.autoTable.globalDefaults.addPageContent=e,this},t.API.autoTableAddPage=function(){return console.error("Use of deprecated function: autoTableAddPage. Use doc.addPage()"),this.addPage(),this}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);function r(t,e){var n=function t(e,n){var o=n(e);return"rgba(0, 0, 0, 0)"===o||"transparent"===o||"initial"===o||"inherit"===o?null==e.parentElement?null:t(e.parentElement,n):o}(t,e);if(!n)return null;var o=n.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);if(!o||!Array.isArray(o))return null;var r=[parseInt(o[1]),parseInt(o[2]),parseInt(o[3])];return 0===parseInt(o[4])||isNaN(r[0])||isNaN(r[1])||isNaN(r[2])?null:r}e.parseCss=function(t,e,n,i,l){var a={},s=r(e,(function(t){return l.getComputedStyle(t).backgroundColor}));null!=s&&(a.fillColor=s),null!=(s=r(e,(function(t){return l.getComputedStyle(t).color})))&&(a.textColor=s),null!=(s=r(e,(function(t){return l.getComputedStyle(t).borderTopColor})))&&(a.lineColor=s);var u=function(t,e){var n=[t.paddingTop,t.paddingRight,t.paddingBottom,t.paddingLeft],r=96/(72/e),i=(parseInt(t.lineHeight)-parseInt(t.fontSize))/e/2,l=n.map((function(t){return parseInt(t)/r})),a=o.marginOrPadding(l,0);i>a.top&&(a.top=i);i>a.bottom&&(a.bottom=i);return a}(i,n);u&&(a.cellPadding=u);var d=parseInt(i.borderTopWidth||"");(d=d/(96/72)/n)&&(a.lineWidth=d);var h=["left","right","center","justify"];-1!==h.indexOf(i.textAlign)&&(a.halign=i.textAlign),-1!==(h=["middle","bottom","top"]).indexOf(i.verticalAlign)&&(a.valign=i.verticalAlign);var c=parseInt(i.fontSize||"");isNaN(c)||(a.fontSize=c/(96/72));var f=function(t){var e="";("bold"===t.fontWeight||"bolder"===t.fontWeight||parseInt(t.fontWeight)>=700)&&(e="bold");"italic"!==t.fontStyle&&"oblique"!==t.fontStyle||(e+="italic");return e}(i);f&&(a.fontStyle=f);var g=(i.fontFamily||"").toLowerCase();return-1!==t.indexOf(g)&&(a.font=g),a}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(2),i=n(6),l=n(0),a=n(12),s=n(7);function u(t,e,n,o,r,i,l){var a={};return e.map((function(e,n){for(var u=0,d=new s.Row(e,n,t),c=0,f=0,g=0,p=o;g0?n:null}function h(t,e,n,r,l,a,s){var u,d=o.getTheme(r);"head"===t?u=l.headStyles:"body"===t?u=l.bodyStyles:"foot"===t&&(u=l.footStyles);var h=i.assign({},d.table,d[t],l.styles,u),c=l.columnStyles[e.dataKey]||l.columnStyles[e.index]||{},f="body"===t?c:{},g="body"===t&&n%2==0?i.assign({},d.alternateRow,l.alternateRowStyles):{},p=o.defaultStyles(a),y=i.assign({},p,h,g,f);return i.assign(y,s)}e.createTable=function(t,e,n){var o=e.getDocumentOptions(),h=e.getGlobalOptions();a.default(h,o,t,e);var c=i.assign({},h,o,t),f=e.getPreviousAutoTable(),g=e.scaleFactor(),p=l.marginOrPadding(c.margin,40/g),y=function(t,e,n,o){var r,i,l,a,s,u,d,h,c,f,g;f=!0===t.showFoot?"everyPage":!1===t.showFoot?"never":null!==(r=t.showFoot)&&void 0!==r?r:"everyPage";g=!0===t.showHead?"everyPage":!1===t.showHead?"never":null!==(i=t.showHead)&&void 0!==i?i:"everyPage";var p=null!==(l=t.useCss)&&void 0!==l&&l,y=t.theme||(p?"plain":"striped");return{includeHiddenHtml:null!==(a=t.includeHiddenHtml)&&void 0!==a&&a,useCss:p,theme:y,startY:n,margin:o,pageBreak:null!==(s=t.pageBreak)&&void 0!==s?s:"auto",rowPageBreak:null!==(u=t.rowPageBreak)&&void 0!==u?u:"auto",tableWidth:null!==(d=t.tableWidth)&&void 0!==d?d:"auto",showHead:g,showFoot:f,tableLineWidth:null!==(h=t.tableLineWidth)&&void 0!==h?h:0,tableLineColor:null!==(c=t.tableLineColor)&&void 0!==c?c:200}}(c,0,function(t,e,n,o,r){var i=!1;if(t){var l=t.startPageNumber+t.pageNumber-1;i=l===n}var a=o.startY;null!=a&&!1!==a||i&&(a=t.finalY+20/e);return a||r}(f,g,e.pageNumber(),c,p.top),p),v=function(t,e,n){for(var o={styles:{},headStyles:{},bodyStyles:{},footStyles:{},alternateRowStyles:{},columnStyles:{}},r=function(r){if("columnStyles"===r){var l=t[r],a=e[r],s=n[r];o.columnStyles=i.assign({},l,a,s)}else{var u=[t,e,n].map((function(t){return t[r]||{}}));o[r]=i.assign({},u[0],u[1],u[2])}},l=0,a=Object.keys(o);l0?"_"+o:""),i.push(new s.Column(l,null,i.length))}})),i}(e,a,h,c);if(0===a.length&&e.columns){(y=d(p,"head"))&&a.push(y)}if(0===c.length&&e.columns){var y;(y=d(p,"foot"))&&c.push(y)}return{columns:p,head:u("head",a,e,p,n,o,i),body:u("body",h,e,p,n,o,i),foot:u("foot",c,e,p,n,o,i)}}(e,c,v,y.theme,g,n),b=new s.Table(t.tableId,y,v,function(t,e,n){for(var o={didParseCell:[],willDrawCell:[],didDrawCell:[],didDrawPage:[]},r=0,i=[t,e,n];rs.wrappedWidth&&(s.wrappedWidth=s.minWidth)}}}})),t.allRows().forEach((function(e){for(var n=0,o=t.columns;n1&&!r.minWidth&&(r.minWidth=i.minWidth),i.colSpan>1&&!r.wrappedWidth&&(r.wrappedWidth=i.minWidth))}}))}(b,g,e),b.minWidth=b.columns.reduce((function(t,e){return t+e.minWidth}),0),b.wrappedWidth=b.columns.reduce((function(t,e){return t+e.wrappedWidth}),0),"number"==typeof b.settings.tableWidth?b.width=b.settings.tableWidth:"wrap"===b.settings.tableWidth?b.width=b.wrappedWidth:b.width=e.pageSize().width-p.left-p.right,b}},function(t,e,n){"use strict";function o(t){t.rowHeight?(console.error("Use of deprecated style rowHeight. It is renamed to minCellHeight."),t.minCellHeight||(t.minCellHeight=t.rowHeight)):t.columnWidth&&(console.error("Use of deprecated style columnWidth. It is renamed to cellWidth."),t.cellWidth||(t.cellWidth=t.columnWidth))}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n,r){for(var i=function(t){t&&"object"!=typeof t&&console.error("The options parameter should be of type object, is: "+typeof t),void 0!==t.extendWidth&&(t.tableWidth=t.extendWidth?"auto":"wrap",console.error("Use of deprecated option: extendWidth, use tableWidth instead.")),void 0!==t.margins&&(void 0===t.margin&&(t.margin=t.margins),console.error("Use of deprecated option: margins, use margin instead.")),t.startY&&"number"!=typeof t.startY&&(console.error("Invalid value for startY option",t.startY),delete t.startY),!t.didDrawPage&&(t.afterPageContent||t.beforePageContent||t.afterPageAdd)&&(console.error("The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use didDrawPage instead"),t.didDrawPage=function(e){r.applyStyles(r.userStyles),t.beforePageContent&&t.beforePageContent(e),r.applyStyles(r.userStyles),t.afterPageContent&&t.afterPageContent(e),r.applyStyles(r.userStyles),t.afterPageAdd&&e.pageNumber>1&&e.afterPageAdd(e),r.applyStyles(r.userStyles)}),["createdHeaderCell","drawHeaderRow","drawRow","drawHeaderCell"].forEach((function(e){t[e]&&console.error('The "'+e+'" hook has changed in version 3.0, check the changelog for how to migrate.')})),[["showFoot","showFooter"],["showHead","showHeader"],["didDrawPage","addPageContent"],["didParseCell","createdCell"],["headStyles","headerStyles"]].forEach((function(e){var n=e[0],o=e[1];t[o]&&(console.error("Use of deprecated option "+o+". Use "+n+" instead"),t[n]=t[o])})),[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach((function(e){var n="string"==typeof e?e:e[0],o="string"==typeof e?e:e[1];void 0!==t[n]&&(void 0===t.styles[o]&&(t.styles[o]=t[n]),console.error("Use of deprecated option: "+n+", use the style "+o+" instead."))}));for(var e=0,n=["styles","bodyStyles","headStyles","footStyles"];en(t)}));c.length&&(e=r(c,e,n))}return e}function i(t,e,n,r,i){return t.map((function(t){return function(t,e,n,r,i){var l=1e4*r.scaleFactor();if((e=Math.ceil(e*l)/l)>=o.getStringWidth(t,n,r))return t;for(;e1e-10&&(l=l<1?l:Math.round(l),console.error("Of the table content, "+l+" units width could not fit page")),function(t){for(var e=t.allRows(),n=0;n1&&t.columns[a+1])i+=s.width,delete o.cells[s.index];else if(r){var u=r;delete o.cells[s.index],r=null,u.width=s.width+i}else{if(!(u=o.cells[s.index]))continue;if(l=u.colSpan,i=0,u.colSpan>1){r=u,i+=s.width;continue}u.width=s.width+i}}}(t),function(t,e){for(var n={count:0,height:0},o=0,r=t.allRows();od.contentHeight&&(d.contentHeight=d.styles.minCellHeight);var c=d.contentHeight/d.rowSpan;d.rowSpan>1&&n.count*n.height0&&n.height>c&&(c=n.height),c>l.height&&(l.height=c,l.maxCellHeight=c)}}n.count--}}(t,e),function(t){for(var e={},n=1,o=t.allRows(),r=0;r1)n--,delete i.cells[s.index];else if(u)u.cell.height+=i.height,u.cell.height>i.maxCellHeight&&(u.row.maxCellHeight=u.cell.height),n=u.cell.colSpan,delete i.cells[s.index],u.left--,u.left<=1&&delete e[s.index];else{var d=i.cells[s.index];if(!d)continue;if(d.height=i.height,d.rowSpan>1){var h=o.length-r,c=d.rowSpan>h?h:d.rowSpan;e[s.index]={cell:d,left:c,row:i}}}}"head"===i.section&&(t.headHeight+=i.maxCellHeight),"foot"===i.section&&(t.footHeight+=i.maxCellHeight),t.height+=i.height}}(t)},e.resizeColumns=r,e.ellipsize=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(0),i=n(7),l=n(6),a=n(3);function s(t,e,n){var r=t.styles.fontSize/n.scaleFactor()*o.FONT_ROW_RATIO,i=t.padding("vertical"),l=Math.floor((e-i)/r);return Math.max(0,l)}function u(t,e,n){t.cursor.x=t.settings.margin.left,e.y=t.cursor.y,e.x=t.cursor.x;for(var o=0,i=t.columns;oe.pageSize().height)&&(h(e),t.cursor.y=a.top),t.pageStartX=t.cursor.x,t.pageStartY=t.cursor.y,t.startPageNumber=e.pageNumber(),e.applyStyles(e.userStyles),"firstPage"!==n.showHead&&"everyPage"!==n.showHead||t.head.forEach((function(n){return u(t,n,e)})),e.applyStyles(e.userStyles),t.body.forEach((function(n,o){!function t(e,n,o,r){var a=function(t,e,n){var o=t.settings.margin.bottom,r=t.settings.showFoot;("everyPage"===r||"lastPage"===r&&e)&&(o+=t.footHeight);return n.pageSize().height-t.cursor.y-o}(e,o,r);if(n.canEntireRowFit(a))u(e,n,r);else if(function(t,e,n,o){var r=t.pageSize().height,i=o.settings.margin,l=i.top+i.bottom,a=r-l;"body"===e.section&&(a-=o.headHeight+o.footHeight);var s=e.getMinimumRowHeight(o.columns,t),u=sa)return console.error("Will not be able to print row "+e.index+" correctly since it's minimum height is larger than page height"),!0;if(!u)return!1;var d=e.hasRowSpan(o.columns);if(e.maxCellHeight>a)return d&&console.error("The content of row "+e.index+" will not be drawn correctly since drawing rows with a height larger than the page height and has cells with rowspans is not supported."),!0;if(d)return!1;if("avoid"===o.settings.rowPageBreak)return!1;return!0}(r,n,a,e)){var h=function(t,e,n,o){var r=new i.Row(t.raw,-1,t.section);r.spansMultiplePages=!0,t.spansMultiplePages=!0,t.height=0,t.maxCellHeight=0;for(var a=0,u=n.columns;ac&&(h.text=p.text.splice(c,p.text.length)),p.contentHeight=p.getContentHeight(o),p.contentHeight>t.height&&(t.height=p.contentHeight,t.maxCellHeight=p.contentHeight),h.contentHeight=h.getContentHeight(o),h.contentHeight>r.height&&(r.height=h.contentHeight,r.maxCellHeight=h.contentHeight),r.cells[d.index]=h}}for(var f=0,g=n.columns;f