jspdf-autotable
Advanced tools
Comparing version 3.0.4 to 3.0.5
/*! | ||
* | ||
* jsPDF AutoTable plugin v3.0.4 | ||
* jsPDF AutoTable plugin v3.0.5 | ||
* | ||
@@ -17,2 +17,2 @@ * Copyright (c) 2014 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable | ||
@license MIT | ||
*/var s=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},o=0;o<10;o++)e["_"+String.fromCharCode(o)]=o;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var o,n,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),a=1;a<arguments.length;a++){for(var l in o=Object(arguments[a]))d.call(o,l)&&(r[l]=o[l]);if(s){n=s(o);for(var i=0;i<n.length;i++)u.call(o,n[i])&&(r[n[i]]=o[n[i]])}}return r}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var h=o(13),g=o(0),p=o(3);function i(t,e,o,n){var r=[];if(!e)return r;for(var a=0;a<e.rows.length;a++){for(var l=e.rows[a],i=[],s=n?h.parseCss(l,g.default().scaleFactor(),["cellPadding","lineWidth","lineColor"]):{},d=0;d<l.cells.length;d++){var u=l.cells[d],c=t.getComputedStyle(u);if(o||"none"!==c.display){var f=n?h.parseCss(u,g.default().scaleFactor()):{};i.push({rowSpan:u.rowSpan,colSpan:u.colSpan,styles:n?p.assign(s,f):null,content:u})}}0<i.length&&(o||"none"!==s.display)&&(i._element=l,r.push(i))}return r}e.parseHtml=function(t,e,o){var n;if(void 0===e&&(e=!1),void 0===o&&(o=!1),n="string"==typeof t?window.document.querySelector(t):t){for(var r=i(window,n.tHead,e,o),a=[],l=0;l<n.tBodies.length;l++)a=a.concat(i(window,n.tBodies[l],e,o));return{head:r,body:a,foot:i(window,n.tFoot,e,o)}}console.error("Html table could not be found with input: ",t)}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(1);function d(t,e){var o=function t(e,o){if(!e)return null;var n=window.getComputedStyle(e)[o];return"rgba(0, 0, 0, 0)"===n||"transparent"===n||"initial"===n||"inherit"===n?t(e.parentElement,o):n}(t,e);if(!o)return null;var n=o.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);if(!n||!Array.isArray(n))return null;var r=[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])];return 0===parseInt(n[4])||isNaN(r[0])||isNaN(r[1])||isNaN(r[2])?null:r}e.parseCss=function(t,e,n){void 0===n&&(n=[]);var r={},o=window.getComputedStyle(t);function a(t,e,o){void 0===o&&(o=[]),0!==o.length&&-1===o.indexOf(e)||-1!==n.indexOf(t)||(0===e||e)&&(r[t]=e)}return a("fillColor",d(t,"backgroundColor")||255),a("lineColor",d(t,"borderColor")),a("fontStyle",(l=o,i="",("bold"===l.fontWeight||"bolder"===l.fontWeight||700<=parseInt(l.fontWeight))&&(i+="bold"),"italic"!==l.fontStyle&&"oblique"!==l.fontStyle||(i+="italic"),i)),a("textColor",d(t,"color")),a("halign",o.textAlign,["left","right","center","justify"]),a("valign",o.verticalAlign,["middle","bottom","top"]),a("fontSize",parseInt(o.fontSize||"")/(96/72)),a("cellPadding",function(t,e,o,n){if(!t)return null;var r=96/(72/n),a=(parseInt(o)-parseInt(e))/n/2,l=t.split(" ").map(function(t){return parseInt(t)/r});return l=s.marginOrPadding(l,0),a>l.top&&(l.top=a),a>l.bottom&&(l.bottom=a),l}(o.padding,o.fontSize,o.lineHeight,e)),a("lineWidth",parseInt(o.borderWidth||"")/(96/72)/e),a("font",(o.fontFamily||"").toLowerCase()),r;var l,i}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=o(1);function i(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))}e.default=function(t){for(var e=function(n){n&&"object"!=typeof n&&console.error("The options parameter should be of type object, is: "+typeof n),void 0!==n.extendWidth&&(n.tableWidth=n.extendWidth?"auto":"wrap",console.error("Use of deprecated option: extendWidth, use tableWidth instead.")),void 0!==n.margins&&(void 0===n.margin&&(n.margin=n.margins),console.error("Use of deprecated option: margins, use margin instead.")),!n.didDrawPage&&(n.afterPageContent||n.beforePageContent||n.afterPageAdd)&&(console.error("The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use didDrawPage instead"),n.didDrawPage=function(t){l.applyUserStyles(),n.beforePageContent&&n.beforePageContent(t),l.applyUserStyles(),n.afterPageContent&&n.afterPageContent(t),l.applyUserStyles(),n.afterPageAdd&&1<t.pageNumber&&t.afterPageAdd(t),l.applyUserStyles()}),["createdHeaderCell","drawHeaderRow","drawRow","drawHeaderCell"].forEach(function(t){n[t]&&console.error('The "'+t+'" 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(t){var e=t[0],o=t[1];n[o]&&(console.error("Use of deprecated option "+o+". Use "+e+" instead"),n[e]=n[o])}),[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach(function(t){var e="string"==typeof t?t:t[0],o="string"==typeof t?t:t[1];void 0!==n[e]&&(void 0===n.styles[o]&&(n.styles[o]=n[e]),console.error("Use of deprecated option: "+e+", use the style "+o+" instead."))});for(var t=0,e=["styles","bodyStyles","headStyles","footStyles"];t<e.length;t++)i(n[e[t]]||{});for(var o=n.columnStyles||{},r=0,a=Object.keys(o);r<a.length;r++)i(o[a[r]]||{})},o=0,n=t;o<n.length;o++)e(n[o])}},function(t,e,o){o(4).API.autoTableText=function(t,e,o,n){n=n||{};"number"==typeof e&&"number"==typeof o||console.error("The x and y parameters are required. Missing for text: ",t);var r=this.internal.scaleFactor,a=this.internal.getFontSize()/r,l=null,i=1;if("middle"!==n.valign&&"bottom"!==n.valign&&"center"!==n.halign&&"right"!==n.halign||(i=(l="string"==typeof t?t.split(/\r\n|\r|\n/g):t).length||1),o+=a*(2-1.15),"middle"===n.valign?o-=i/2*a*1.15:"bottom"===n.valign&&(o-=i*a*1.15),"center"===n.halign||"right"===n.halign){var s=a;if("center"===n.halign&&(s*=.5),1<=i){for(var d=0;d<l.length;d++)this.text(l[d],e-this.getStringUnitWidth(l[d])*s,o),o+=a;return this}e-=this.getStringUnitWidth(t)*s}return"justify"===n.halign?this.text(t,e,o,{maxWidth:n.maxWidth||100,align:"justify"}):this.text(t,e,o),this}}])}); | ||
*/var s=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},o=0;o<10;o++)e["_"+String.fromCharCode(o)]=o;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var o,n,r=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),a=1;a<arguments.length;a++){for(var l in o=Object(arguments[a]))d.call(o,l)&&(r[l]=o[l]);if(s){n=s(o);for(var i=0;i<n.length;i++)u.call(o,n[i])&&(r[n[i]]=o[n[i]])}}return r}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var h=o(13),g=o(0);function i(t,e,o,n){var r=[];if(!e)return r;for(var a=0;a<e.rows.length;a++){for(var l=e.rows[a],i=[],s=n?h.parseCss(l,g.default().scaleFactor(),["cellPadding","lineWidth","lineColor"]):{},d=0;d<l.cells.length;d++){var u=l.cells[d],c=t.getComputedStyle(u);if(o||"none"!==c.display){var f=n?h.parseCss(u,g.default().scaleFactor()):{};i.push({rowSpan:u.rowSpan,colSpan:u.colSpan,styles:n?f:null,content:u})}}0<i.length&&(o||"none"!==s.display)&&(i._element=l,r.push(i))}return r}e.parseHtml=function(t,e,o){var n;if(void 0===e&&(e=!1),void 0===o&&(o=!1),n="string"==typeof t?window.document.querySelector(t):t){for(var r=i(window,n.tHead,e,o),a=[],l=0;l<n.tBodies.length;l++)a=a.concat(i(window,n.tBodies[l],e,o));return{head:r,body:a,foot:i(window,n.tFoot,e,o)}}console.error("Html table could not be found with input: ",t)}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(1);function d(t,e){var o=function t(e,o){if(!e)return null;var n=window.getComputedStyle(e)[o];return"rgba(0, 0, 0, 0)"===n||"transparent"===n||"initial"===n||"inherit"===n?t(e.parentElement,o):n}(t,e);if(!o)return null;var n=o.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);if(!n||!Array.isArray(n))return null;var r=[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])];return 0===parseInt(n[4])||isNaN(r[0])||isNaN(r[1])||isNaN(r[2])?null:r}e.parseCss=function(t,e,n){void 0===n&&(n=[]);var r={},o=window.getComputedStyle(t);function a(t,e,o){void 0===o&&(o=[]),0!==o.length&&-1===o.indexOf(e)||-1!==n.indexOf(t)||(0===e||e)&&(r[t]=e)}return a("fillColor",d(t,"backgroundColor")||255),a("lineColor",d(t,"borderColor")),a("fontStyle",(l=o,i="",("bold"===l.fontWeight||"bolder"===l.fontWeight||700<=parseInt(l.fontWeight))&&(i+="bold"),"italic"!==l.fontStyle&&"oblique"!==l.fontStyle||(i+="italic"),i)),a("textColor",d(t,"color")),a("halign",o.textAlign,["left","right","center","justify"]),a("valign",o.verticalAlign,["middle","bottom","top"]),a("fontSize",parseInt(o.fontSize||"")/(96/72)),a("cellPadding",function(t,e,o,n){if(!t)return null;var r=96/(72/n),a=(parseInt(o)-parseInt(e))/n/2,l=t.split(" ").map(function(t){return parseInt(t)/r});return l=s.marginOrPadding(l,0),a>l.top&&(l.top=a),a>l.bottom&&(l.bottom=a),l}(o.padding,o.fontSize,o.lineHeight,e)),a("lineWidth",parseInt(o.borderWidth||"")/(96/72)/e),a("font",(o.fontFamily||"").toLowerCase()),r;var l,i}},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=o(1);function i(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))}e.default=function(t){for(var e=function(n){n&&"object"!=typeof n&&console.error("The options parameter should be of type object, is: "+typeof n),void 0!==n.extendWidth&&(n.tableWidth=n.extendWidth?"auto":"wrap",console.error("Use of deprecated option: extendWidth, use tableWidth instead.")),void 0!==n.margins&&(void 0===n.margin&&(n.margin=n.margins),console.error("Use of deprecated option: margins, use margin instead.")),!n.didDrawPage&&(n.afterPageContent||n.beforePageContent||n.afterPageAdd)&&(console.error("The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use didDrawPage instead"),n.didDrawPage=function(t){l.applyUserStyles(),n.beforePageContent&&n.beforePageContent(t),l.applyUserStyles(),n.afterPageContent&&n.afterPageContent(t),l.applyUserStyles(),n.afterPageAdd&&1<t.pageNumber&&t.afterPageAdd(t),l.applyUserStyles()}),["createdHeaderCell","drawHeaderRow","drawRow","drawHeaderCell"].forEach(function(t){n[t]&&console.error('The "'+t+'" 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(t){var e=t[0],o=t[1];n[o]&&(console.error("Use of deprecated option "+o+". Use "+e+" instead"),n[e]=n[o])}),[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach(function(t){var e="string"==typeof t?t:t[0],o="string"==typeof t?t:t[1];void 0!==n[e]&&(void 0===n.styles[o]&&(n.styles[o]=n[e]),console.error("Use of deprecated option: "+e+", use the style "+o+" instead."))});for(var t=0,e=["styles","bodyStyles","headStyles","footStyles"];t<e.length;t++)i(n[e[t]]||{});for(var o=n.columnStyles||{},r=0,a=Object.keys(o);r<a.length;r++)i(o[a[r]]||{})},o=0,n=t;o<n.length;o++)e(n[o])}},function(t,e,o){o(4).API.autoTableText=function(t,e,o,n){n=n||{};"number"==typeof e&&"number"==typeof o||console.error("The x and y parameters are required. Missing for text: ",t);var r=this.internal.scaleFactor,a=this.internal.getFontSize()/r,l=null,i=1;if("middle"!==n.valign&&"bottom"!==n.valign&&"center"!==n.halign&&"right"!==n.halign||(i=(l="string"==typeof t?t.split(/\r\n|\r|\n/g):t).length||1),o+=a*(2-1.15),"middle"===n.valign?o-=i/2*a*1.15:"bottom"===n.valign&&(o-=i*a*1.15),"center"===n.halign||"right"===n.halign){var s=a;if("center"===n.halign&&(s*=.5),1<=i){for(var d=0;d<l.length;d++)this.text(l[d],e-this.getStringUnitWidth(l[d])*s,o),o+=a;return this}e-=this.getStringUnitWidth(t)*s}return"justify"===n.halign?this.text(t,e,o,{maxWidth:n.maxWidth||100,align:"justify"}):this.text(t,e,o),this}}])}); |
{ | ||
"name": "jspdf-autotable", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "Generate pdf tables with javascript (jsPDF plugin)", | ||
@@ -10,3 +10,3 @@ "main": "dist/jspdf.plugin.autotable.js", | ||
"peerDependencies": { | ||
"jspdf": "<=1.5.x" | ||
"jspdf": "^1.5.3" | ||
}, | ||
@@ -18,12 +18,12 @@ "devDependencies": { | ||
"mock-browser": "0.92.14", | ||
"mock-require": "3.0.2", | ||
"mock-require": "3.0.3", | ||
"object-assign": "4.1.1", | ||
"object.entries": "1.1.0", | ||
"ts-loader": "5.3.2", | ||
"ts-node": "7.0.1", | ||
"typedoc": "0.14.0", | ||
"typescript": "3.2.2", | ||
"ts-loader": "5.3.3", | ||
"ts-node": "8.0.2", | ||
"typedoc": "0.14.2", | ||
"typescript": "3.2.4", | ||
"uglifyjs-webpack-plugin": "2.1.1", | ||
"webpack": "4.28.3", | ||
"webpack-cli": "3.2.0", | ||
"webpack": "4.29.0", | ||
"webpack-cli": "3.2.1", | ||
"webpack-dev-server": "3.1.14" | ||
@@ -30,0 +30,0 @@ }, |
@@ -45,3 +45,3 @@ import {parseCss} from "./cssParser"; | ||
colSpan: cell.colSpan, | ||
styles: useCss ? assign(rowStyles, cellStyles) : null, | ||
styles: useCss ? cellStyles : null, | ||
content: cell | ||
@@ -48,0 +48,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
4040783
76764