jspdf-autotable
Advanced tools
Comparing version 2.0.22 to 2.0.23
@@ -26,3 +26,3 @@ var fs = require('fs'); | ||
var code = bundle.generate({ | ||
format: 'iife', | ||
format: 'umd', | ||
banner: '/** \n' + | ||
@@ -29,0 +29,0 @@ ' * jsPDF AutoTable plugin v' + require('./package.json').version + '\n' + |
/** | ||
* jsPDF AutoTable plugin v2.0.22 | ||
* jsPDF AutoTable plugin v2.0.23 | ||
* Copyright (c) 2014 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable | ||
@@ -10,2 +10,2 @@ * | ||
*/ | ||
!function(){"use strict";function t(){return{theme:"striped",styles:{},headerStyles:{},bodyStyles:{},alternateRowStyles:{},columnStyles:{},startY:!1,margin:40,pageBreak:"auto",tableWidth:"auto",createdHeaderCell:function(t,e){},createdCell:function(t,e){},drawHeaderRow:function(t,e){},drawRow:function(t,e){},drawHeaderCell:function(t,e){},drawCell:function(t,e){},beforePageContent:function(t){},afterPageContent:function(t){}}}function e(){return{cellPadding:5,fontSize:10,font:"helvetica",lineColor:200,lineWidth:.1,fontStyle:"normal",overflow:"ellipsize",fillColor:255,textColor:20,halign:"left",valign:"top",fillStyle:"F",rowHeight:20,columnWidth:"auto"}}var n={};n["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},n.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n.createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var o=function d(){n.classCallCheck(this,d),this.height=0,this.width=0,this.contentWidth=0,this.rows=[],this.columns=[],this.headerRow=null,this.settings={},this.pageCount=1},i=function f(t){n.classCallCheck(this,f),this.raw=t||{},this.index=0,this.styles={},this.cells={},this.height=0,this.y=0},r=function c(t){n.classCallCheck(this,c),this.raw=t,this.styles={},this.text="",this.contentWidth=0,this.textPos={},this.height=0,this.width=0,this.x=0,this.y=0},l=function y(t){n.classCallCheck(this,y),this.dataKey=t,this.options={},this.styles={},this.contentWidth=0,this.width=0,this.x=0},a=1.15,s={striped:{table:{fillColor:255,textColor:80,fontStyle:"normal",fillStyle:"F"},header:{textColor:255,fillColor:[41,128,185],rowHeight:23,fontStyle:"bold"},body:{},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1,fillStyle:"DF"},header:{textColor:255,fillColor:[26,188,156],rowHeight:23,fillStyle:"F",fontStyle:"bold"},body:{},alternateRow:{}},plain:{header:{fontStyle:"bold"}}},h=function(){function o(){n.classCallCheck(this,o)}return n.createClass(o,null,[{key:"initSettings",value:function(e){var n=Object.assign({},t(),e);"undefined"!=typeof n.extendWidth&&(n.tableWidth=n.extendWidth?"auto":"wrap",console.error("Use of deprecated option: extendWidth, use tableWidth instead.")),"undefined"!=typeof n.margins&&("undefined"==typeof n.margin&&(n.margin=n.margins),console.error("Use of deprecated option: margins, use margin instead.")),[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach(function(t){var e="string"==typeof t?t:t[0],o="string"==typeof t?t:t[1];"undefined"!=typeof n[e]&&("undefined"==typeof n.styles[o]&&(n.styles[o]=n[e]),console.error("Use of deprecated option: "+e+", use the style "+o+" instead."))});var o=n.margin;return n.margin={},"number"==typeof o.horizontal&&(o.right=o.horizontal,o.left=o.horizontal),"number"==typeof o.vertical&&(o.top=o.vertical,o.bottom=o.vertical),["top","right","bottom","left"].forEach(function(t,e){if("number"==typeof o)n.margin[t]=o;else{var i=Array.isArray(o)?e:t;n.margin[t]="number"==typeof o[i]?o[i]:40}}),n}},{key:"styles",value:function(t){return t.unshift(e()),t.unshift({}),Object.assign.apply(this,t)}}]),o}();!function(t){function e(t,e,o){t&&"object"===("undefined"==typeof t?"undefined":n["typeof"](t))||console.error("The headers should be an object or array, is: "+("undefined"==typeof t?"undefined":n["typeof"](t))),e&&"object"===("undefined"==typeof e?"undefined":n["typeof"](e))||console.error("The data should be an object or array, is: "+("undefined"==typeof e?"undefined":n["typeof"](e))),o&&"object"!==("undefined"==typeof o?"undefined":n["typeof"](o))&&console.error("The data should be an object or array, is: "+("undefined"==typeof e?"undefined":n["typeof"](e))),Array.prototype.forEach||console.error("The current browser does not support Array.prototype.forEach which is required for jsPDF-AutoTable. You can try polyfilling it by including this script https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill")}function d(t,e){j=new o;var a=/\r\n|\r|\n/g,d=new i(t);d.index=-1;var f=h.styles([s[P.theme].table,s[P.theme].header]);d.styles=Object.assign({},f,P.styles,P.headerStyles),t.forEach(function(t,e){"object"===("undefined"==typeof t?"undefined":n["typeof"](t))&&(e="undefined"!=typeof t.dataKey?t.dataKey:t.key),"undefined"!=typeof t.width&&console.error("Use of deprecated option: column.width, use column.styles.columnWidth instead.");var o=new l(e);o.styles=P.columnStyles[o.dataKey]||{},j.columns.push(o);var i=new r;i.raw="object"===("undefined"==typeof t?"undefined":n["typeof"](t))?t.title:t,i.styles=Object.assign({},d.styles),i.text=""+i.raw,i.contentWidth=2*i.styles.cellPadding+m(i.text,i.styles),i.text=i.text.split(a),d.cells[e]=i,P.createdHeaderCell(i,{column:o,row:d,settings:P})}),j.headerRow=d,e.forEach(function(t,e){var n=new i(t),o=e%2===0,l=h.styles([s[P.theme].table,o?s[P.theme].alternateRow:{}]),d=Object.assign({},P.styles,P.bodyStyles,o?P.alternateRowStyles:{});n.styles=Object.assign({},l,d),n.index=e,j.columns.forEach(function(e){var o=new r;o.raw=t[e.dataKey],o.styles=Object.assign({},n.styles,e.styles),o.text="undefined"!=typeof o.raw?""+o.raw:"",n.cells[e.dataKey]=o,P.createdCell(o,b({column:e,row:n})),o.contentWidth=2*o.styles.cellPadding+m(o.text,o.styles),o.text=o.text.split(a)}),j.rows.push(n)})}function f(t,e){var n=0;j.columns.forEach(function(t){t.contentWidth=j.headerRow.cells[t.dataKey].contentWidth,j.rows.forEach(function(e){var n=e.cells[t.dataKey].contentWidth;n>t.contentWidth&&(t.contentWidth=n)}),t.width=t.contentWidth,n+=t.contentWidth}),j.contentWidth=n;var o=e-P.margin.left-P.margin.right,i=o;"number"==typeof P.tableWidth?i=P.tableWidth:"wrap"===P.tableWidth&&(i=j.contentWidth),j.width=o>i?i:o;var r=[],l=0,d=j.width/j.columns.length,f=0;j.columns.forEach(function(t){var e=h.styles([s[P.theme].table,P.styles,t.styles]);"wrap"===e.columnWidth?t.width=t.contentWidth:"number"==typeof e.columnWidth?t.width=e.columnWidth:("auto"===e.columnWidth,t.contentWidth<=d&&j.contentWidth>j.width?t.width=t.contentWidth:(r.push(t),l+=t.contentWidth,t.width=0)),f+=t.width}),c(r,f,l,d),j.height=0;var y=j.rows.concat(j.headerRow);y.forEach(function(e,n){var o=0;j.columns.forEach(function(n){var i=e.cells[n.dataKey];w(i.styles);var r=n.width-2*i.styles.cellPadding;if("linebreak"===i.styles.overflow)try{i.text=t.splitTextToSize(i.text,r+1,{fontSize:i.styles.fontSize})}catch(l){if(!(l instanceof TypeError&&Array.isArray(i.text)))throw l;i.text=t.splitTextToSize(i.text.join(" "),r+1,{fontSize:i.styles.fontSize})}else"ellipsize"===i.styles.overflow?i.text=v(i.text,r,i.styles):"visible"===i.styles.overflow||("hidden"===i.styles.overflow?i.text=v(i.text,r,i.styles,""):"function"==typeof i.styles.overflow?i.text=i.styles.overflow(i.text,r):console.error("Unrecognized overflow type: "+i.styles.overflow));var a=Array.isArray(i.text)?i.text.length-1:0;a>o&&(o=a)}),e.heightStyle=e.styles.rowHeight,e.height=e.heightStyle+o*e.styles.fontSize*a,j.height+=e.height})}function c(t,e,n,o){for(var i=j.width-e-n,r=0;r<t.length;r++){var l=t[r],a=l.contentWidth/n,s=l.contentWidth+i*a<o;if(0>i&&s){t.splice(r,1),n-=l.contentWidth,l.width=o,e+=l.width,c(t,e,n,o);break}l.width=l.contentWidth+i*a}}function y(t){P.afterPageContent(b()),t(),j.pageCount++,C={x:P.margin.left,y:P.margin.top},P.beforePageContent(b()),P.drawHeaderRow(j.headerRow,b({row:j.headerRow}))!==!1&&p(j.headerRow,P.drawHeaderCell)}function u(t){var e=C.y+t+P.margin.bottom;return e>=W.height}function g(t){j.rows.forEach(function(e,n){if(u(e.height)){y(t)}e.y=C.y,P.drawRow(e,b({row:e}))!==!1&&p(e,P.drawCell)})}function p(t,e){C.x=P.margin.left;for(var n=0;n<j.columns.length;n++){var o=j.columns[n],i=t.cells[o.dataKey];if(i){w(i.styles),i.x=C.x,i.y=C.y,i.height=t.height,i.width=o.width,"top"===i.styles.valign?i.textPos.y=C.y+i.styles.cellPadding:"bottom"===i.styles.valign?i.textPos.y=C.y+t.height-i.styles.cellPadding:i.textPos.y=C.y+t.height/2,"right"===i.styles.halign?i.textPos.x=i.x+i.width-i.styles.cellPadding:"center"===i.styles.halign?i.textPos.x=i.x+i.width/2:i.textPos.x=i.x+i.styles.cellPadding;var r=b({column:o,row:t});e(i,r)!==!1&&(x.rect(i.x,i.y,i.width,i.height,i.styles.fillStyle),x.autoTableText(i.text,i.textPos.x,i.textPos.y,{halign:i.styles.halign,valign:i.styles.valign})),C.x+=i.width}}C.y+=t.height}function w(t){Object.keys(S).forEach(function(e){var n=t[e],o=S[e];"undefined"!=typeof n&&(n.constructor===Array?o.apply(this,n):o(n))})}function b(t){return Object.assign({pageCount:j.pageCount,settings:P,table:j,cursor:C},t||{})}function m(t,e){w(e);var n=x.getStringUnitWidth(t);return n*e.fontSize}function v(t,e,n,o){if(o="undefined"!=typeof o?o:"...",Array.isArray(t))return t.forEach(function(i,r){t[r]=v(i,e,n,o)}),t;if(e>=m(t,n))return t;for(;e<m(t+o,n)&&!(t.length<2);)t=t.substring(0,t.length-1);return t.trim()+o}var x,C,S,W,P,j;t.autoTable=function(t,n,o){e(t,n,o),x=this,W=x.internal.pageSize,S={fillColor:x.setFillColor,textColor:x.setTextColor,fontStyle:x.setFontStyle,lineColor:x.setDrawColor,lineWidth:x.setLineWidth,font:x.setFont,fontSize:x.setFontSize},P=h.initSettings(o||{}),C={x:P.margin.left,y:P.startY===!1?P.margin.top:P.startY};var i={textColor:30,fontSize:x.internal.getFontSize(),fontStyle:x.internal.getFont().fontStyle};d(t,n),f(this,W.width);var r=j.rows[0]&&"auto"===P.pageBreak?j.rows[0].height:0,l=P.startY+P.margin.bottom+j.headerRow.height+r;return"avoid"===P.pageBreak&&(l+=j.height),("always"===P.pageBreak&&P.startY!==!1||P.startY!==!1&&l>W.height)&&(this.addPage(this.addPage),C.y=P.margin.top),w(i),P.beforePageContent(b()),P.drawHeaderRow(j.headerRow,b({row:j.headerRow}))!==!1&&p(j.headerRow,P.drawHeaderCell),w(i),g(this.addPage),P.afterPageContent(b()),w(i),this},t.autoTableEndPosY=function(){return"undefined"==typeof C||"undefined"==typeof C.y?0:C.y},t.autoTableHtmlToJson=function(t,e){e=e||!1;for(var n=t.rows[0],o={columns:[],rows:[]},i=0;i<n.cells.length;i++){var r=n.cells[i],l=r?r.textContent.trim():"";o.columns.push(l)}for(var a=1;a<t.rows.length;a++){var s=t.rows[a],h=window.getComputedStyle(s);if(e||"none"!==h.display){for(var d=[],f=0;f<n.cells.length;f++){var r=s.cells[f],l=r?r.textContent.trim():"";d.push(l)}o.rows.push(d)}}return o.data=o.rows,o},t.autoTableText=function(t,e,n,o){"number"==typeof e&&"number"==typeof n||console.error("The x and y parameters are required. Missing for the text: ",t);var i=this.internal.getFontSize()/this.internal.scaleFactor,r=a,l=/\r\n|\r|\n/g,s=null,h=1;if("middle"!==o.valign&&"bottom"!==o.valign&&"center"!==o.halign&&"right"!==o.halign||(s="string"==typeof t?t.split(l):t,h=s.length||1),n+=i*(2-r),"middle"===o.valign?n-=h/2*i:"bottom"===o.valign&&(n-=h*i),"center"===o.halign||"right"===o.halign){var d=i;if("center"===o.halign&&(d*=.5),h>=1){for(var f=0;f<s.length;f++)this.text(s[f],e-this.getStringUnitWidth(s[f])*d,n),n+=i;return x}e-=this.getStringUnitWidth(t)*d}return this.text(t,e,n),this}}(jsPDF.API),"function"!=typeof Object.assign&&!function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var o=arguments[n];if(void 0!==o&&null!==o)for(var i in o)o.hasOwnProperty(i)&&(e[i]=o[i])}return e}}(),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)})}(); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e():"function"==typeof define&&define.amd?define(e):e()}(this,function(){"use strict";function t(){return{theme:"striped",styles:{},headerStyles:{},bodyStyles:{},alternateRowStyles:{},columnStyles:{},startY:!1,margin:40,pageBreak:"auto",tableWidth:"auto",createdHeaderCell:function(t,e){},createdCell:function(t,e){},drawHeaderRow:function(t,e){},drawRow:function(t,e){},drawHeaderCell:function(t,e){},drawCell:function(t,e){},beforePageContent:function(t){},afterPageContent:function(t){}}}function e(){return{cellPadding:5,fontSize:10,font:"helvetica",lineColor:200,lineWidth:.1,fontStyle:"normal",overflow:"ellipsize",fillColor:255,textColor:20,halign:"left",valign:"top",fillStyle:"F",rowHeight:20,columnWidth:"auto"}}var n={};n["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},n.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n.createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var o=function d(){n.classCallCheck(this,d),this.height=0,this.width=0,this.contentWidth=0,this.rows=[],this.columns=[],this.headerRow=null,this.settings={},this.pageCount=1},i=function f(t){n.classCallCheck(this,f),this.raw=t||{},this.index=0,this.styles={},this.cells={},this.height=0,this.y=0},r=function c(t){n.classCallCheck(this,c),this.raw=t,this.styles={},this.text="",this.contentWidth=0,this.textPos={},this.height=0,this.width=0,this.x=0,this.y=0},l=function y(t){n.classCallCheck(this,y),this.dataKey=t,this.options={},this.styles={},this.contentWidth=0,this.width=0,this.x=0},a=1.15,s={striped:{table:{fillColor:255,textColor:80,fontStyle:"normal",fillStyle:"F"},header:{textColor:255,fillColor:[41,128,185],rowHeight:23,fontStyle:"bold"},body:{},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1,fillStyle:"DF"},header:{textColor:255,fillColor:[26,188,156],rowHeight:23,fillStyle:"F",fontStyle:"bold"},body:{},alternateRow:{}},plain:{header:{fontStyle:"bold"}}},h=function(){function o(){n.classCallCheck(this,o)}return n.createClass(o,null,[{key:"initSettings",value:function(e){var n=Object.assign({},t(),e);"undefined"!=typeof n.extendWidth&&(n.tableWidth=n.extendWidth?"auto":"wrap",console.error("Use of deprecated option: extendWidth, use tableWidth instead.")),"undefined"!=typeof n.margins&&("undefined"==typeof n.margin&&(n.margin=n.margins),console.error("Use of deprecated option: margins, use margin instead.")),[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach(function(t){var e="string"==typeof t?t:t[0],o="string"==typeof t?t:t[1];"undefined"!=typeof n[e]&&("undefined"==typeof n.styles[o]&&(n.styles[o]=n[e]),console.error("Use of deprecated option: "+e+", use the style "+o+" instead."))});var o=n.margin;return n.margin={},"number"==typeof o.horizontal&&(o.right=o.horizontal,o.left=o.horizontal),"number"==typeof o.vertical&&(o.top=o.vertical,o.bottom=o.vertical),["top","right","bottom","left"].forEach(function(t,e){if("number"==typeof o)n.margin[t]=o;else{var i=Array.isArray(o)?e:t;n.margin[t]="number"==typeof o[i]?o[i]:40}}),n}},{key:"styles",value:function(t){return t.unshift(e()),t.unshift({}),Object.assign.apply(this,t)}}]),o}();!function(t){function e(t,e,o){t&&"object"===("undefined"==typeof t?"undefined":n["typeof"](t))||console.error("The headers should be an object or array, is: "+("undefined"==typeof t?"undefined":n["typeof"](t))),e&&"object"===("undefined"==typeof e?"undefined":n["typeof"](e))||console.error("The data should be an object or array, is: "+("undefined"==typeof e?"undefined":n["typeof"](e))),o&&"object"!==("undefined"==typeof o?"undefined":n["typeof"](o))&&console.error("The data should be an object or array, is: "+("undefined"==typeof e?"undefined":n["typeof"](e))),Array.prototype.forEach||console.error("The current browser does not support Array.prototype.forEach which is required for jsPDF-AutoTable. You can try polyfilling it by including this script https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill")}function d(t,e){j=new o;var a=/\r\n|\r|\n/g,d=new i(t);d.index=-1;var f=h.styles([s[P.theme].table,s[P.theme].header]);d.styles=Object.assign({},f,P.styles,P.headerStyles),t.forEach(function(t,e){"object"===("undefined"==typeof t?"undefined":n["typeof"](t))&&(e="undefined"!=typeof t.dataKey?t.dataKey:t.key),"undefined"!=typeof t.width&&console.error("Use of deprecated option: column.width, use column.styles.columnWidth instead.");var o=new l(e);o.styles=P.columnStyles[o.dataKey]||{},j.columns.push(o);var i=new r;i.raw="object"===("undefined"==typeof t?"undefined":n["typeof"](t))?t.title:t,i.styles=Object.assign({},d.styles),i.text=""+i.raw,i.contentWidth=2*i.styles.cellPadding+m(i.text,i.styles),i.text=i.text.split(a),d.cells[e]=i,P.createdHeaderCell(i,{column:o,row:d,settings:P})}),j.headerRow=d,e.forEach(function(t,e){var n=new i(t),o=e%2===0,l=h.styles([s[P.theme].table,o?s[P.theme].alternateRow:{}]),d=Object.assign({},P.styles,P.bodyStyles,o?P.alternateRowStyles:{});n.styles=Object.assign({},l,d),n.index=e,j.columns.forEach(function(e){var o=new r;o.raw=t[e.dataKey],o.styles=Object.assign({},n.styles,e.styles),o.text="undefined"!=typeof o.raw?""+o.raw:"",n.cells[e.dataKey]=o,P.createdCell(o,b({column:e,row:n})),o.contentWidth=2*o.styles.cellPadding+m(o.text,o.styles),o.text=o.text.split(a)}),j.rows.push(n)})}function f(t,e){var n=0;j.columns.forEach(function(t){t.contentWidth=j.headerRow.cells[t.dataKey].contentWidth,j.rows.forEach(function(e){var n=e.cells[t.dataKey].contentWidth;n>t.contentWidth&&(t.contentWidth=n)}),t.width=t.contentWidth,n+=t.contentWidth}),j.contentWidth=n;var o=e-P.margin.left-P.margin.right,i=o;"number"==typeof P.tableWidth?i=P.tableWidth:"wrap"===P.tableWidth&&(i=j.contentWidth),j.width=o>i?i:o;var r=[],l=0,d=j.width/j.columns.length,f=0;j.columns.forEach(function(t){var e=h.styles([s[P.theme].table,P.styles,t.styles]);"wrap"===e.columnWidth?t.width=t.contentWidth:"number"==typeof e.columnWidth?t.width=e.columnWidth:("auto"===e.columnWidth,t.contentWidth<=d&&j.contentWidth>j.width?t.width=t.contentWidth:(r.push(t),l+=t.contentWidth,t.width=0)),f+=t.width}),c(r,f,l,d),j.height=0;var y=j.rows.concat(j.headerRow);y.forEach(function(e,n){var o=0;j.columns.forEach(function(n){var i=e.cells[n.dataKey];w(i.styles);var r=n.width-2*i.styles.cellPadding;if("linebreak"===i.styles.overflow)try{i.text=t.splitTextToSize(i.text,r+1,{fontSize:i.styles.fontSize})}catch(l){if(!(l instanceof TypeError&&Array.isArray(i.text)))throw l;i.text=t.splitTextToSize(i.text.join(" "),r+1,{fontSize:i.styles.fontSize})}else"ellipsize"===i.styles.overflow?i.text=v(i.text,r,i.styles):"visible"===i.styles.overflow||("hidden"===i.styles.overflow?i.text=v(i.text,r,i.styles,""):"function"==typeof i.styles.overflow?i.text=i.styles.overflow(i.text,r):console.error("Unrecognized overflow type: "+i.styles.overflow));var a=Array.isArray(i.text)?i.text.length-1:0;a>o&&(o=a)}),e.heightStyle=e.styles.rowHeight,e.height=e.heightStyle+o*e.styles.fontSize*a,j.height+=e.height})}function c(t,e,n,o){for(var i=j.width-e-n,r=0;r<t.length;r++){var l=t[r],a=l.contentWidth/n,s=l.contentWidth+i*a<o;if(0>i&&s){t.splice(r,1),n-=l.contentWidth,l.width=o,e+=l.width,c(t,e,n,o);break}l.width=l.contentWidth+i*a}}function y(t){P.afterPageContent(b()),t(),j.pageCount++,C={x:P.margin.left,y:P.margin.top},P.beforePageContent(b()),P.drawHeaderRow(j.headerRow,b({row:j.headerRow}))!==!1&&p(j.headerRow,P.drawHeaderCell)}function u(t){var e=C.y+t+P.margin.bottom;return e>=W.height}function g(t){j.rows.forEach(function(e,n){if(u(e.height)){y(t)}e.y=C.y,P.drawRow(e,b({row:e}))!==!1&&p(e,P.drawCell)})}function p(t,e){C.x=P.margin.left;for(var n=0;n<j.columns.length;n++){var o=j.columns[n],i=t.cells[o.dataKey];if(i){w(i.styles),i.x=C.x,i.y=C.y,i.height=t.height,i.width=o.width,"top"===i.styles.valign?i.textPos.y=C.y+i.styles.cellPadding:"bottom"===i.styles.valign?i.textPos.y=C.y+t.height-i.styles.cellPadding:i.textPos.y=C.y+t.height/2,"right"===i.styles.halign?i.textPos.x=i.x+i.width-i.styles.cellPadding:"center"===i.styles.halign?i.textPos.x=i.x+i.width/2:i.textPos.x=i.x+i.styles.cellPadding;var r=b({column:o,row:t});e(i,r)!==!1&&(x.rect(i.x,i.y,i.width,i.height,i.styles.fillStyle),x.autoTableText(i.text,i.textPos.x,i.textPos.y,{halign:i.styles.halign,valign:i.styles.valign})),C.x+=i.width}}C.y+=t.height}function w(t){Object.keys(S).forEach(function(e){var n=t[e],o=S[e];"undefined"!=typeof n&&(n.constructor===Array?o.apply(this,n):o(n))})}function b(t){return Object.assign({pageCount:j.pageCount,settings:P,table:j,cursor:C},t||{})}function m(t,e){w(e);var n=x.getStringUnitWidth(t);return n*e.fontSize}function v(t,e,n,o){if(o="undefined"!=typeof o?o:"...",Array.isArray(t))return t.forEach(function(i,r){t[r]=v(i,e,n,o)}),t;if(e>=m(t,n))return t;for(;e<m(t+o,n)&&!(t.length<2);)t=t.substring(0,t.length-1);return t.trim()+o}var x,C,S,W,P,j;t.autoTable=function(t,n,o){e(t,n,o),x=this,W=x.internal.pageSize,S={fillColor:x.setFillColor,textColor:x.setTextColor,fontStyle:x.setFontStyle,lineColor:x.setDrawColor,lineWidth:x.setLineWidth,font:x.setFont,fontSize:x.setFontSize},P=h.initSettings(o||{}),C={x:P.margin.left,y:P.startY===!1?P.margin.top:P.startY};var i={textColor:30,fontSize:x.internal.getFontSize(),fontStyle:x.internal.getFont().fontStyle};d(t,n),f(this,W.width);var r=j.rows[0]&&"auto"===P.pageBreak?j.rows[0].height:0,l=P.startY+P.margin.bottom+j.headerRow.height+r;return"avoid"===P.pageBreak&&(l+=j.height),("always"===P.pageBreak&&P.startY!==!1||P.startY!==!1&&l>W.height)&&(this.addPage(this.addPage),C.y=P.margin.top),w(i),P.beforePageContent(b()),P.drawHeaderRow(j.headerRow,b({row:j.headerRow}))!==!1&&p(j.headerRow,P.drawHeaderCell),w(i),g(this.addPage),P.afterPageContent(b()),w(i),this},t.autoTableEndPosY=function(){return"undefined"==typeof C||"undefined"==typeof C.y?0:C.y},t.autoTableHtmlToJson=function(t,e){e=e||!1;for(var n=t.rows[0],o={columns:[],rows:[]},i=0;i<n.cells.length;i++){var r=n.cells[i],l=r?r.textContent.trim():"";o.columns.push(l)}for(var a=1;a<t.rows.length;a++){var s=t.rows[a],h=window.getComputedStyle(s);if(e||"none"!==h.display){for(var d=[],f=0;f<n.cells.length;f++){var r=s.cells[f],l=r?r.textContent.trim():"";d.push(l)}o.rows.push(d)}}return o.data=o.rows,o},t.autoTableText=function(t,e,n,o){"number"==typeof e&&"number"==typeof n||console.error("The x and y parameters are required. Missing for the text: ",t);var i=this.internal.getFontSize()/this.internal.scaleFactor,r=a,l=/\r\n|\r|\n/g,s=null,h=1;if("middle"!==o.valign&&"bottom"!==o.valign&&"center"!==o.halign&&"right"!==o.halign||(s="string"==typeof t?t.split(l):t,h=s.length||1),n+=i*(2-r),"middle"===o.valign?n-=h/2*i:"bottom"===o.valign&&(n-=h*i),"center"===o.halign||"right"===o.halign){var d=i;if("center"===o.halign&&(d*=.5),h>=1){for(var f=0;f<s.length;f++)this.text(s[f],e-this.getStringUnitWidth(s[f])*d,n),n+=i;return x}e-=this.getStringUnitWidth(t)*d}return this.text(t,e,n),this}}(jsPDF.API),"function"!=typeof Object.assign&&!function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var o=arguments[n];if(void 0!==o&&null!==o)for(var i in o)o.hasOwnProperty(i)&&(e[i]=o[i])}return e}}(),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)})}); |
/** | ||
* jsPDF AutoTable plugin v2.0.22 | ||
* jsPDF AutoTable plugin v2.0.23 | ||
* Copyright (c) 2014 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable | ||
@@ -10,4 +10,7 @@ * | ||
*/ | ||
(function () { | ||
'use strict'; | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(factory()); | ||
}(this, function () { 'use strict'; | ||
@@ -785,2 +788,2 @@ var babelHelpers = {}; | ||
}()); | ||
})); |
/** | ||
* jsPDF AutoTable plugin v2.0.22 | ||
* jsPDF AutoTable plugin v2.0.23 | ||
* Copyright (c) 2014 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable | ||
@@ -10,4 +10,7 @@ * | ||
*/ | ||
(function () { | ||
'use strict'; | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(factory()); | ||
}(this, function () { 'use strict'; | ||
@@ -785,2 +788,2 @@ var babelHelpers = {}; | ||
}()); | ||
})); |
{ | ||
"name": "jspdf-autotable", | ||
"version": "2.0.22", | ||
"version": "2.0.23", | ||
"description": "Generate pdf tables with javascript (jsPDF plugin)", | ||
@@ -10,3 +10,3 @@ "main": "dist/jspdf.plugin.autotable.js", | ||
"dependencies": { | ||
"jspdf": "^1.2.61" | ||
"jspdf": "<1.3" | ||
}, | ||
@@ -13,0 +13,0 @@ "devDependencies": { |
@@ -193,5 +193,12 @@ # AutoTable - Table plugin for jsPDF | ||
### Release (write access to repo required) | ||
- Build with `npm version <semver|major|minor|patch> -m <optional-commit-message>` | ||
- Manually check files and look over the examples | ||
### Contributing workflow | ||
- Make code changes | ||
- Build with `npm run build` | ||
- Test that the examples works | ||
- Commit and submit pull request | ||
### Release workflow (write access to repo required) | ||
- Test and commit code changes | ||
- Run `npm version <semver|major|minor|patch> -m <optional-commit-message>` | ||
- Manually verify files and look over the examples | ||
- Deploy with `npm run deploy` | ||
@@ -198,0 +205,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1309236
6293
213
+ Addedjspdf@1.2.61(transitive)
- Removedabab@1.0.4(transitive)
- Removedacorn@2.7.0(transitive)
- Removedacorn-globals@1.0.9(transitive)
- Removedajv@6.12.6(transitive)
- Removedarray-equal@1.0.2(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbase64-arraybuffer@0.1.5(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcanvg@1.5.3(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removedcss-line-break@1.0.1(transitive)
- Removedcssom@0.3.8(transitive)
- Removedcssstyle@0.2.37(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedescodegen@1.14.3(transitive)
- Removedesprima@4.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhtml2canvas@1.0.0-alpha.12(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjsdom@8.5.0(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjspdf@1.5.3(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlevn@0.3.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednwmatcher@1.4.4(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedomggif@1.0.7(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedparse5@1.5.1(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedpromise-polyfill@8.1.0(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedrgbcolor@1.0.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsax@1.4.1(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstackblur-canvas@1.4.12.2.0(transitive)
- Removedsymbol-tree@3.2.4(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedtype-check@0.3.2(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@2.0.1(transitive)
- Removedword-wrap@1.2.5(transitive)
- Removedxml-name-validator@2.0.1(transitive)
- Removedxmldom@0.1.31(transitive)
Updatedjspdf@<1.3