UNPKG

98.9 kBJavaScriptView Raw
1/*!
2 *
3 * jsPDF AutoTable plugin v3.8.4
4 *
5 * Copyright (c) 2024 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
6 * Licensed under the MIT License.
7 * http://opensource.org/licenses/mit-license
8 *
9 */
10(function webpackUniversalModuleDefinition(root, factory) {
11 if(typeof exports === 'object' && typeof module === 'object')
12 module.exports = factory((function webpackLoadOptionalExternalModule() { try { return require("jspdf"); } catch(e) {} }()));
13 else if(typeof define === 'function' && define.amd)
14 define(["jspdf"], factory);
15 else {
16 var a = typeof exports === 'object' ? factory((function webpackLoadOptionalExternalModule() { try { return require("jspdf"); } catch(e) {} }())) : factory(root["jspdf"]);
17 for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
18 }
19})(typeof globalThis !== 'undefined' ? globalThis : typeof this !== 'undefined' ? this : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : global , function(__WEBPACK_EXTERNAL_MODULE__964__) {
20return /******/ (function() { // webpackBootstrap
21/******/ "use strict";
22/******/ var __webpack_modules__ = ({
23
24/***/ 172:
25/***/ (function(__unused_webpack_module, exports) {
26
27
28var __extends = (this && this.__extends) || (function () {
29 var extendStatics = function (d, b) {
30 extendStatics = Object.setPrototypeOf ||
31 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
33 return extendStatics(d, b);
34 };
35 return function (d, b) {
36 if (typeof b !== "function" && b !== null)
37 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
38 extendStatics(d, b);
39 function __() { this.constructor = d; }
40 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41 };
42})();
43Object.defineProperty(exports, "__esModule", ({ value: true }));
44exports.CellHookData = exports.HookData = void 0;
45var HookData = /** @class */ (function () {
46 function HookData(doc, table, cursor) {
47 this.table = table;
48 this.pageNumber = table.pageNumber;
49 this.pageCount = this.pageNumber;
50 this.settings = table.settings;
51 this.cursor = cursor;
52 this.doc = doc.getDocument();
53 }
54 return HookData;
55}());
56exports.HookData = HookData;
57var CellHookData = /** @class */ (function (_super) {
58 __extends(CellHookData, _super);
59 function CellHookData(doc, table, cell, row, column, cursor) {
60 var _this = _super.call(this, doc, table, cursor) || this;
61 _this.cell = cell;
62 _this.row = row;
63 _this.column = column;
64 _this.section = row.section;
65 return _this;
66 }
67 return CellHookData;
68}(HookData));
69exports.CellHookData = CellHookData;
70
71
72/***/ }),
73
74/***/ 340:
75/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
76
77
78Object.defineProperty(exports, "__esModule", ({ value: true }));
79var htmlParser_1 = __webpack_require__(4);
80var autoTableText_1 = __webpack_require__(136);
81var documentHandler_1 = __webpack_require__(744);
82var inputParser_1 = __webpack_require__(776);
83var tableDrawer_1 = __webpack_require__(664);
84var tableCalculator_1 = __webpack_require__(972);
85function default_1(jsPDF) {
86 // eslint-disable-next-line @typescript-eslint/no-explicit-any
87 jsPDF.API.autoTable = function () {
88 var args = [];
89 for (var _i = 0; _i < arguments.length; _i++) {
90 args[_i] = arguments[_i];
91 }
92 var options;
93 if (args.length === 1) {
94 options = args[0];
95 }
96 else {
97 console.error('Use of deprecated autoTable initiation');
98 options = args[2] || {};
99 options.columns = args[0];
100 options.body = args[1];
101 }
102 var input = (0, inputParser_1.parseInput)(this, options);
103 var table = (0, tableCalculator_1.createTable)(this, input);
104 (0, tableDrawer_1.drawTable)(this, table);
105 return this;
106 };
107 // Assign false to enable `doc.lastAutoTable.finalY || 40` sugar
108 jsPDF.API.lastAutoTable = false;
109 jsPDF.API.previousAutoTable = false; // deprecated in v3
110 jsPDF.API.autoTable.previous = false; // deprecated in v3
111 jsPDF.API.autoTableText = function (text, x, y, styles) {
112 (0, autoTableText_1.default)(text, x, y, styles, this);
113 };
114 jsPDF.API.autoTableSetDefaults = function (defaults) {
115 documentHandler_1.DocHandler.setDefaults(defaults, this);
116 return this;
117 };
118 jsPDF.autoTableSetDefaults = function (defaults, doc) {
119 documentHandler_1.DocHandler.setDefaults(defaults, doc);
120 };
121 jsPDF.API.autoTableHtmlToJson = function (tableElem, includeHiddenElements) {
122 var _a;
123 if (includeHiddenElements === void 0) { includeHiddenElements = false; }
124 if (typeof window === 'undefined') {
125 console.error('Cannot run autoTableHtmlToJson in non browser environment');
126 return null;
127 }
128 var doc = new documentHandler_1.DocHandler(this);
129 var _b = (0, htmlParser_1.parseHtml)(doc, tableElem, window, includeHiddenElements, false), head = _b.head, body = _b.body;
130 var columns = ((_a = head[0]) === null || _a === void 0 ? void 0 : _a.map(function (c) { return c.content; })) || [];
131 return { columns: columns, rows: body, data: body };
132 };
133 /**
134 * @deprecated
135 */
136 jsPDF.API.autoTableEndPosY = function () {
137 console.error('Use of deprecated function: autoTableEndPosY. Use doc.lastAutoTable.finalY instead.');
138 var prev = this.lastAutoTable;
139 if (prev && prev.finalY) {
140 return prev.finalY;
141 }
142 else {
143 return 0;
144 }
145 };
146 /**
147 * @deprecated
148 */
149 jsPDF.API.autoTableAddPageContent = function (hook) {
150 console.error('Use of deprecated function: autoTableAddPageContent. Use jsPDF.autoTableSetDefaults({didDrawPage: () => {}}) instead.');
151 if (!jsPDF.API.autoTable.globalDefaults) {
152 jsPDF.API.autoTable.globalDefaults = {};
153 }
154 jsPDF.API.autoTable.globalDefaults.addPageContent = hook;
155 return this;
156 };
157 /**
158 * @deprecated
159 */
160 jsPDF.API.autoTableAddPage = function () {
161 console.error('Use of deprecated function: autoTableAddPage. Use doc.addPage()');
162 this.addPage();
163 return this;
164 };
165}
166exports["default"] = default_1;
167
168
169/***/ }),
170
171/***/ 136:
172/***/ (function(__unused_webpack_module, exports) {
173
174
175Object.defineProperty(exports, "__esModule", ({ value: true }));
176/**
177 * Improved text function with halign and valign support
178 * Inspiration from: http://stackoverflow.com/questions/28327510/align-text-right-using-jspdf/28433113#28433113
179 */
180function default_1(text, x, y, styles, doc) {
181 styles = styles || {};
182 var PHYSICAL_LINE_HEIGHT = 1.15;
183 var k = doc.internal.scaleFactor;
184 var fontSize = doc.internal.getFontSize() / k;
185 var lineHeightFactor = doc.getLineHeightFactor
186 ? doc.getLineHeightFactor()
187 : PHYSICAL_LINE_HEIGHT;
188 var lineHeight = fontSize * lineHeightFactor;
189 var splitRegex = /\r\n|\r|\n/g;
190 var splitText = '';
191 var lineCount = 1;
192 if (styles.valign === 'middle' ||
193 styles.valign === 'bottom' ||
194 styles.halign === 'center' ||
195 styles.halign === 'right') {
196 splitText = typeof text === 'string' ? text.split(splitRegex) : text;
197 lineCount = splitText.length || 1;
198 }
199 // Align the top
200 y += fontSize * (2 - PHYSICAL_LINE_HEIGHT);
201 if (styles.valign === 'middle')
202 y -= (lineCount / 2) * lineHeight;
203 else if (styles.valign === 'bottom')
204 y -= lineCount * lineHeight;
205 if (styles.halign === 'center' || styles.halign === 'right') {
206 var alignSize = fontSize;
207 if (styles.halign === 'center')
208 alignSize *= 0.5;
209 if (splitText && lineCount >= 1) {
210 for (var iLine = 0; iLine < splitText.length; iLine++) {
211 doc.text(splitText[iLine], x - doc.getStringUnitWidth(splitText[iLine]) * alignSize, y);
212 y += lineHeight;
213 }
214 return doc;
215 }
216 x -= doc.getStringUnitWidth(text) * alignSize;
217 }
218 if (styles.halign === 'justify') {
219 doc.text(text, x, y, {
220 maxWidth: styles.maxWidth || 100,
221 align: 'justify',
222 });
223 }
224 else {
225 doc.text(text, x, y);
226 }
227 return doc;
228}
229exports["default"] = default_1;
230
231
232/***/ }),
233
234/***/ 420:
235/***/ (function(__unused_webpack_module, exports) {
236
237
238Object.defineProperty(exports, "__esModule", ({ value: true }));
239exports.getPageAvailableWidth = exports.parseSpacing = exports.getFillStyle = exports.addTableBorder = exports.getStringWidth = void 0;
240function getStringWidth(text, styles, doc) {
241 doc.applyStyles(styles, true);
242 var textArr = Array.isArray(text) ? text : [text];
243 var widestLineWidth = textArr
244 .map(function (text) { return doc.getTextWidth(text); })
245 .reduce(function (a, b) { return Math.max(a, b); }, 0);
246 return widestLineWidth;
247}
248exports.getStringWidth = getStringWidth;
249function addTableBorder(doc, table, startPos, cursor) {
250 var lineWidth = table.settings.tableLineWidth;
251 var lineColor = table.settings.tableLineColor;
252 doc.applyStyles({ lineWidth: lineWidth, lineColor: lineColor });
253 var fillStyle = getFillStyle(lineWidth, false);
254 if (fillStyle) {
255 doc.rect(startPos.x, startPos.y, table.getWidth(doc.pageSize().width), cursor.y - startPos.y, fillStyle);
256 }
257}
258exports.addTableBorder = addTableBorder;
259function getFillStyle(lineWidth, fillColor) {
260 var drawLine = lineWidth > 0;
261 var drawBackground = fillColor || fillColor === 0;
262 if (drawLine && drawBackground) {
263 return 'DF'; // Fill then stroke
264 }
265 else if (drawLine) {
266 return 'S'; // Only stroke (transparent background)
267 }
268 else if (drawBackground) {
269 return 'F'; // Only fill, no stroke
270 }
271 else {
272 return null;
273 }
274}
275exports.getFillStyle = getFillStyle;
276function parseSpacing(value, defaultValue) {
277 var _a, _b, _c, _d;
278 value = value || defaultValue;
279 if (Array.isArray(value)) {
280 if (value.length >= 4) {
281 return {
282 top: value[0],
283 right: value[1],
284 bottom: value[2],
285 left: value[3],
286 };
287 }
288 else if (value.length === 3) {
289 return {
290 top: value[0],
291 right: value[1],
292 bottom: value[2],
293 left: value[1],
294 };
295 }
296 else if (value.length === 2) {
297 return {
298 top: value[0],
299 right: value[1],
300 bottom: value[0],
301 left: value[1],
302 };
303 }
304 else if (value.length === 1) {
305 value = value[0];
306 }
307 else {
308 value = defaultValue;
309 }
310 }
311 if (typeof value === 'object') {
312 if (typeof value.vertical === 'number') {
313 value.top = value.vertical;
314 value.bottom = value.vertical;
315 }
316 if (typeof value.horizontal === 'number') {
317 value.right = value.horizontal;
318 value.left = value.horizontal;
319 }
320 return {
321 left: (_a = value.left) !== null && _a !== void 0 ? _a : defaultValue,
322 top: (_b = value.top) !== null && _b !== void 0 ? _b : defaultValue,
323 right: (_c = value.right) !== null && _c !== void 0 ? _c : defaultValue,
324 bottom: (_d = value.bottom) !== null && _d !== void 0 ? _d : defaultValue,
325 };
326 }
327 if (typeof value !== 'number') {
328 value = defaultValue;
329 }
330 return { top: value, right: value, bottom: value, left: value };
331}
332exports.parseSpacing = parseSpacing;
333function getPageAvailableWidth(doc, table) {
334 var margins = parseSpacing(table.settings.margin, 0);
335 return doc.pageSize().width - (margins.left + margins.right);
336}
337exports.getPageAvailableWidth = getPageAvailableWidth;
338
339
340/***/ }),
341
342/***/ 796:
343/***/ (function(__unused_webpack_module, exports) {
344
345
346var __extends = (this && this.__extends) || (function () {
347 var extendStatics = function (d, b) {
348 extendStatics = Object.setPrototypeOf ||
349 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
350 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
351 return extendStatics(d, b);
352 };
353 return function (d, b) {
354 if (typeof b !== "function" && b !== null)
355 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
356 extendStatics(d, b);
357 function __() { this.constructor = d; }
358 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
359 };
360})();
361Object.defineProperty(exports, "__esModule", ({ value: true }));
362exports.getTheme = exports.defaultStyles = exports.HtmlRowInput = void 0;
363var HtmlRowInput = /** @class */ (function (_super) {
364 __extends(HtmlRowInput, _super);
365 function HtmlRowInput(element) {
366 var _this = _super.call(this) || this;
367 _this._element = element;
368 return _this;
369 }
370 return HtmlRowInput;
371}(Array));
372exports.HtmlRowInput = HtmlRowInput;
373// Base style for all themes
374function defaultStyles(scaleFactor) {
375 return {
376 font: 'helvetica', // helvetica, times, courier
377 fontStyle: 'normal', // normal, bold, italic, bolditalic
378 overflow: 'linebreak', // linebreak, ellipsize, visible or hidden
379 fillColor: false, // Either false for transparent, rbg array e.g. [255, 255, 255] or gray level e.g 200
380 textColor: 20,
381 halign: 'left', // left, center, right, justify
382 valign: 'top', // top, middle, bottom
383 fontSize: 10,
384 cellPadding: 5 / scaleFactor, // number or {top,left,right,left,vertical,horizontal}
385 lineColor: 200,
386 lineWidth: 0,
387 cellWidth: 'auto', // 'auto'|'wrap'|number
388 minCellHeight: 0,
389 minCellWidth: 0,
390 };
391}
392exports.defaultStyles = defaultStyles;
393function getTheme(name) {
394 var themes = {
395 striped: {
396 table: { fillColor: 255, textColor: 80, fontStyle: 'normal' },
397 head: { textColor: 255, fillColor: [41, 128, 185], fontStyle: 'bold' },
398 body: {},
399 foot: { textColor: 255, fillColor: [41, 128, 185], fontStyle: 'bold' },
400 alternateRow: { fillColor: 245 },
401 },
402 grid: {
403 table: {
404 fillColor: 255,
405 textColor: 80,
406 fontStyle: 'normal',
407 lineWidth: 0.1,
408 },
409 head: {
410 textColor: 255,
411 fillColor: [26, 188, 156],
412 fontStyle: 'bold',
413 lineWidth: 0,
414 },
415 body: {},
416 foot: {
417 textColor: 255,
418 fillColor: [26, 188, 156],
419 fontStyle: 'bold',
420 lineWidth: 0,
421 },
422 alternateRow: {},
423 },
424 plain: {
425 head: { fontStyle: 'bold' },
426 foot: { fontStyle: 'bold' },
427 },
428 };
429 return themes[name];
430}
431exports.getTheme = getTheme;
432
433
434/***/ }),
435
436/***/ 903:
437/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
438
439
440Object.defineProperty(exports, "__esModule", ({ value: true }));
441exports.parseCss = void 0;
442// Limitations
443// - No support for border spacing
444// - No support for transparency
445var common_1 = __webpack_require__(420);
446function parseCss(supportedFonts, element, scaleFactor, style, window) {
447 var result = {};
448 var pxScaleFactor = 96 / 72;
449 var backgroundColor = parseColor(element, function (elem) {
450 return window.getComputedStyle(elem)['backgroundColor'];
451 });
452 if (backgroundColor != null)
453 result.fillColor = backgroundColor;
454 var textColor = parseColor(element, function (elem) {
455 return window.getComputedStyle(elem)['color'];
456 });
457 if (textColor != null)
458 result.textColor = textColor;
459 var padding = parsePadding(style, scaleFactor);
460 if (padding)
461 result.cellPadding = padding;
462 var borderColorSide = 'borderTopColor';
463 var finalScaleFactor = pxScaleFactor * scaleFactor;
464 var btw = style.borderTopWidth;
465 if (style.borderBottomWidth === btw &&
466 style.borderRightWidth === btw &&
467 style.borderLeftWidth === btw) {
468 var borderWidth = (parseFloat(btw) || 0) / finalScaleFactor;
469 if (borderWidth)
470 result.lineWidth = borderWidth;
471 }
472 else {
473 result.lineWidth = {
474 top: (parseFloat(style.borderTopWidth) || 0) / finalScaleFactor,
475 right: (parseFloat(style.borderRightWidth) || 0) / finalScaleFactor,
476 bottom: (parseFloat(style.borderBottomWidth) || 0) / finalScaleFactor,
477 left: (parseFloat(style.borderLeftWidth) || 0) / finalScaleFactor,
478 };
479 // Choose border color of first available side
480 // could be improved by supporting object as lineColor
481 if (!result.lineWidth.top) {
482 if (result.lineWidth.right) {
483 borderColorSide = 'borderRightColor';
484 }
485 else if (result.lineWidth.bottom) {
486 borderColorSide = 'borderBottomColor';
487 }
488 else if (result.lineWidth.left) {
489 borderColorSide = 'borderLeftColor';
490 }
491 }
492 }
493 var borderColor = parseColor(element, function (elem) {
494 return window.getComputedStyle(elem)[borderColorSide];
495 });
496 if (borderColor != null)
497 result.lineColor = borderColor;
498 var accepted = ['left', 'right', 'center', 'justify'];
499 if (accepted.indexOf(style.textAlign) !== -1) {
500 result.halign = style.textAlign;
501 }
502 accepted = ['middle', 'bottom', 'top'];
503 if (accepted.indexOf(style.verticalAlign) !== -1) {
504 result.valign = style.verticalAlign;
505 }
506 var res = parseInt(style.fontSize || '');
507 if (!isNaN(res))
508 result.fontSize = res / pxScaleFactor;
509 var fontStyle = parseFontStyle(style);
510 if (fontStyle)
511 result.fontStyle = fontStyle;
512 var font = (style.fontFamily || '').toLowerCase();
513 if (supportedFonts.indexOf(font) !== -1) {
514 result.font = font;
515 }
516 return result;
517}
518exports.parseCss = parseCss;
519function parseFontStyle(style) {
520 var res = '';
521 if (style.fontWeight === 'bold' ||
522 style.fontWeight === 'bolder' ||
523 parseInt(style.fontWeight) >= 700) {
524 res = 'bold';
525 }
526 if (style.fontStyle === 'italic' || style.fontStyle === 'oblique') {
527 res += 'italic';
528 }
529 return res;
530}
531function parseColor(element, styleGetter) {
532 var cssColor = realColor(element, styleGetter);
533 if (!cssColor)
534 return null;
535 var rgba = cssColor.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);
536 if (!rgba || !Array.isArray(rgba)) {
537 return null;
538 }
539 var color = [
540 parseInt(rgba[1]),
541 parseInt(rgba[2]),
542 parseInt(rgba[3]),
543 ];
544 var alpha = parseInt(rgba[4]);
545 if (alpha === 0 || isNaN(color[0]) || isNaN(color[1]) || isNaN(color[2])) {
546 return null;
547 }
548 return color;
549}
550function realColor(elem, styleGetter) {
551 var bg = styleGetter(elem);
552 if (bg === 'rgba(0, 0, 0, 0)' ||
553 bg === 'transparent' ||
554 bg === 'initial' ||
555 bg === 'inherit') {
556 if (elem.parentElement == null) {
557 return null;
558 }
559 return realColor(elem.parentElement, styleGetter);
560 }
561 else {
562 return bg;
563 }
564}
565function parsePadding(style, scaleFactor) {
566 var val = [
567 style.paddingTop,
568 style.paddingRight,
569 style.paddingBottom,
570 style.paddingLeft,
571 ];
572 var pxScaleFactor = 96 / (72 / scaleFactor);
573 var linePadding = (parseInt(style.lineHeight) - parseInt(style.fontSize)) / scaleFactor / 2;
574 var inputPadding = val.map(function (n) {
575 return parseInt(n || '0') / pxScaleFactor;
576 });
577 var padding = (0, common_1.parseSpacing)(inputPadding, 0);
578 if (linePadding > padding.top) {
579 padding.top = linePadding;
580 }
581 if (linePadding > padding.bottom) {
582 padding.bottom = linePadding;
583 }
584 return padding;
585}
586
587
588/***/ }),
589
590/***/ 744:
591/***/ (function(__unused_webpack_module, exports) {
592
593
594Object.defineProperty(exports, "__esModule", ({ value: true }));
595exports.DocHandler = void 0;
596var globalDefaults = {};
597var DocHandler = /** @class */ (function () {
598 function DocHandler(jsPDFDocument) {
599 this.jsPDFDocument = jsPDFDocument;
600 this.userStyles = {
601 // Black for versions of jspdf without getTextColor
602 textColor: jsPDFDocument.getTextColor
603 ? this.jsPDFDocument.getTextColor()
604 : 0,
605 fontSize: jsPDFDocument.internal.getFontSize(),
606 fontStyle: jsPDFDocument.internal.getFont().fontStyle,
607 font: jsPDFDocument.internal.getFont().fontName,
608 // 0 for versions of jspdf without getLineWidth
609 lineWidth: jsPDFDocument.getLineWidth
610 ? this.jsPDFDocument.getLineWidth()
611 : 0,
612 // Black for versions of jspdf without getDrawColor
613 lineColor: jsPDFDocument.getDrawColor
614 ? this.jsPDFDocument.getDrawColor()
615 : 0,
616 };
617 }
618 DocHandler.setDefaults = function (defaults, doc) {
619 if (doc === void 0) { doc = null; }
620 if (doc) {
621 doc.__autoTableDocumentDefaults = defaults;
622 }
623 else {
624 globalDefaults = defaults;
625 }
626 };
627 DocHandler.unifyColor = function (c) {
628 if (Array.isArray(c)) {
629 return c;
630 }
631 else if (typeof c === 'number') {
632 return [c, c, c];
633 }
634 else if (typeof c === 'string') {
635 return [c];
636 }
637 else {
638 return null;
639 }
640 };
641 DocHandler.prototype.applyStyles = function (styles, fontOnly) {
642 // Font style needs to be applied before font
643 // https://github.com/simonbengtsson/jsPDF-AutoTable/issues/632
644 var _a, _b, _c;
645 if (fontOnly === void 0) { fontOnly = false; }
646 if (styles.fontStyle)
647 this.jsPDFDocument.setFontStyle &&
648 this.jsPDFDocument.setFontStyle(styles.fontStyle);
649 var _d = this.jsPDFDocument.internal.getFont(), fontStyle = _d.fontStyle, fontName = _d.fontName;
650 if (styles.font)
651 fontName = styles.font;
652 if (styles.fontStyle) {
653 fontStyle = styles.fontStyle;
654 var availableFontStyles = this.getFontList()[fontName];
655 if (availableFontStyles &&
656 availableFontStyles.indexOf(fontStyle) === -1) {
657 // Common issue was that the default bold in headers
658 // made custom fonts not work. For example:
659 // https://github.com/simonbengtsson/jsPDF-AutoTable/issues/653
660 this.jsPDFDocument.setFontStyle &&
661 this.jsPDFDocument.setFontStyle(availableFontStyles[0]);
662 fontStyle = availableFontStyles[0];
663 }
664 }
665 this.jsPDFDocument.setFont(fontName, fontStyle);
666 if (styles.fontSize)
667 this.jsPDFDocument.setFontSize(styles.fontSize);
668 if (fontOnly) {
669 return; // Performance improvement
670 }
671 var color = DocHandler.unifyColor(styles.fillColor);
672 if (color)
673 (_a = this.jsPDFDocument).setFillColor.apply(_a, color);
674 color = DocHandler.unifyColor(styles.textColor);
675 if (color)
676 (_b = this.jsPDFDocument).setTextColor.apply(_b, color);
677 color = DocHandler.unifyColor(styles.lineColor);
678 if (color)
679 (_c = this.jsPDFDocument).setDrawColor.apply(_c, color);
680 if (typeof styles.lineWidth === 'number') {
681 this.jsPDFDocument.setLineWidth(styles.lineWidth);
682 }
683 };
684 DocHandler.prototype.splitTextToSize = function (text, size, opts) {
685 return this.jsPDFDocument.splitTextToSize(text, size, opts);
686 };
687 /**
688 * Adds a rectangle to the PDF
689 * @param x Coordinate (in units declared at inception of PDF document) against left edge of the page
690 * @param y Coordinate (in units declared at inception of PDF document) against upper edge of the page
691 * @param width Width (in units declared at inception of PDF document)
692 * @param height Height (in units declared at inception of PDF document)
693 * @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.
694 */
695 DocHandler.prototype.rect = function (x, y, width, height, fillStyle) {
696 // null is excluded from fillStyle possible values because it isn't needed
697 // and is prone to bugs as it's used to postpone setting the style
698 // https://rawgit.com/MrRio/jsPDF/master/docs/jsPDF.html#rect
699 return this.jsPDFDocument.rect(x, y, width, height, fillStyle);
700 };
701 DocHandler.prototype.getLastAutoTable = function () {
702 return this.jsPDFDocument.lastAutoTable || null;
703 };
704 DocHandler.prototype.getTextWidth = function (text) {
705 return this.jsPDFDocument.getTextWidth(text);
706 };
707 DocHandler.prototype.getDocument = function () {
708 return this.jsPDFDocument;
709 };
710 DocHandler.prototype.setPage = function (page) {
711 this.jsPDFDocument.setPage(page);
712 };
713 DocHandler.prototype.addPage = function () {
714 return this.jsPDFDocument.addPage();
715 };
716 DocHandler.prototype.getFontList = function () {
717 return this.jsPDFDocument.getFontList();
718 };
719 DocHandler.prototype.getGlobalOptions = function () {
720 return globalDefaults || {};
721 };
722 DocHandler.prototype.getDocumentOptions = function () {
723 return this.jsPDFDocument.__autoTableDocumentDefaults || {};
724 };
725 DocHandler.prototype.pageSize = function () {
726 var pageSize = this.jsPDFDocument.internal.pageSize;
727 // JSPDF 1.4 uses get functions instead of properties on pageSize
728 if (pageSize.width == null) {
729 pageSize = {
730 width: pageSize.getWidth(),
731 height: pageSize.getHeight(),
732 };
733 }
734 return pageSize;
735 };
736 DocHandler.prototype.scaleFactor = function () {
737 return this.jsPDFDocument.internal.scaleFactor;
738 };
739 DocHandler.prototype.getLineHeightFactor = function () {
740 var doc = this.jsPDFDocument;
741 return doc.getLineHeightFactor ? doc.getLineHeightFactor() : 1.15;
742 };
743 DocHandler.prototype.getLineHeight = function (fontSize) {
744 return (fontSize / this.scaleFactor()) * this.getLineHeightFactor();
745 };
746 DocHandler.prototype.pageNumber = function () {
747 var pageInfo = this.jsPDFDocument.internal.getCurrentPageInfo();
748 if (!pageInfo) {
749 // Only recent versions of jspdf has pageInfo
750 return this.jsPDFDocument.internal.getNumberOfPages();
751 }
752 return pageInfo.pageNumber;
753 };
754 return DocHandler;
755}());
756exports.DocHandler = DocHandler;
757
758
759/***/ }),
760
761/***/ 4:
762/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
763
764
765Object.defineProperty(exports, "__esModule", ({ value: true }));
766exports.parseHtml = void 0;
767var cssParser_1 = __webpack_require__(903);
768var config_1 = __webpack_require__(796);
769function parseHtml(doc, input, window, includeHiddenHtml, useCss) {
770 var _a, _b;
771 if (includeHiddenHtml === void 0) { includeHiddenHtml = false; }
772 if (useCss === void 0) { useCss = false; }
773 var tableElement;
774 if (typeof input === 'string') {
775 tableElement = window.document.querySelector(input);
776 }
777 else {
778 tableElement = input;
779 }
780 var supportedFonts = Object.keys(doc.getFontList());
781 var scaleFactor = doc.scaleFactor();
782 var head = [], body = [], foot = [];
783 if (!tableElement) {
784 console.error('Html table could not be found with input: ', input);
785 return { head: head, body: body, foot: foot };
786 }
787 for (var i = 0; i < tableElement.rows.length; i++) {
788 var element = tableElement.rows[i];
789 var tagName = (_b = (_a = element === null || element === void 0 ? void 0 : element.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) === null || _b === void 0 ? void 0 : _b.toLowerCase();
790 var row = parseRowContent(supportedFonts, scaleFactor, window, element, includeHiddenHtml, useCss);
791 if (!row)
792 continue;
793 if (tagName === 'thead') {
794 head.push(row);
795 }
796 else if (tagName === 'tfoot') {
797 foot.push(row);
798 }
799 else {
800 // Add to body both if parent is tbody or table
801 body.push(row);
802 }
803 }
804 return { head: head, body: body, foot: foot };
805}
806exports.parseHtml = parseHtml;
807function parseRowContent(supportedFonts, scaleFactor, window, row, includeHidden, useCss) {
808 var resultRow = new config_1.HtmlRowInput(row);
809 for (var i = 0; i < row.cells.length; i++) {
810 var cell = row.cells[i];
811 var style_1 = window.getComputedStyle(cell);
812 if (includeHidden || style_1.display !== 'none') {
813 var cellStyles = void 0;
814 if (useCss) {
815 cellStyles = (0, cssParser_1.parseCss)(supportedFonts, cell, scaleFactor, style_1, window);
816 }
817 resultRow.push({
818 rowSpan: cell.rowSpan,
819 colSpan: cell.colSpan,
820 styles: cellStyles,
821 _element: cell,
822 content: parseCellContent(cell),
823 });
824 }
825 }
826 var style = window.getComputedStyle(row);
827 if (resultRow.length > 0 && (includeHidden || style.display !== 'none')) {
828 return resultRow;
829 }
830}
831function parseCellContent(orgCell) {
832 // Work on cloned node to make sure no changes are applied to html table
833 var cell = orgCell.cloneNode(true);
834 // Remove extra space and line breaks in markup to make it more similar to
835 // what would be shown in html
836 cell.innerHTML = cell.innerHTML.replace(/\n/g, '').replace(/ +/g, ' ');
837 // Preserve <br> tags as line breaks in the pdf
838 cell.innerHTML = cell.innerHTML
839 .split(/<br.*?>/) //start with '<br' and ends with '>'.
840 .map(function (part) { return part.trim(); })
841 .join('\n');
842 // innerText for ie
843 return cell.innerText || cell.textContent || '';
844}
845
846
847/***/ }),
848
849/***/ 776:
850/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
851
852
853Object.defineProperty(exports, "__esModule", ({ value: true }));
854exports.parseInput = void 0;
855var htmlParser_1 = __webpack_require__(4);
856var polyfills_1 = __webpack_require__(356);
857var common_1 = __webpack_require__(420);
858var documentHandler_1 = __webpack_require__(744);
859var inputValidator_1 = __webpack_require__(792);
860function parseInput(d, current) {
861 var doc = new documentHandler_1.DocHandler(d);
862 var document = doc.getDocumentOptions();
863 var global = doc.getGlobalOptions();
864 (0, inputValidator_1.default)(doc, global, document, current);
865 var options = (0, polyfills_1.assign)({}, global, document, current);
866 var win;
867 if (typeof window !== 'undefined') {
868 win = window;
869 }
870 var styles = parseStyles(global, document, current);
871 var hooks = parseHooks(global, document, current);
872 var settings = parseSettings(doc, options);
873 var content = parseContent(doc, options, win);
874 return {
875 id: current.tableId,
876 content: content,
877 hooks: hooks,
878 styles: styles,
879 settings: settings,
880 };
881}
882exports.parseInput = parseInput;
883function parseStyles(gInput, dInput, cInput) {
884 var styleOptions = {
885 styles: {},
886 headStyles: {},
887 bodyStyles: {},
888 footStyles: {},
889 alternateRowStyles: {},
890 columnStyles: {},
891 };
892 var _loop_1 = function (prop) {
893 if (prop === 'columnStyles') {
894 var global_1 = gInput[prop];
895 var document_1 = dInput[prop];
896 var current = cInput[prop];
897 styleOptions.columnStyles = (0, polyfills_1.assign)({}, global_1, document_1, current);
898 }
899 else {
900 var allOptions = [gInput, dInput, cInput];
901 var styles = allOptions.map(function (opts) { return opts[prop] || {}; });
902 styleOptions[prop] = (0, polyfills_1.assign)({}, styles[0], styles[1], styles[2]);
903 }
904 };
905 for (var _i = 0, _a = Object.keys(styleOptions); _i < _a.length; _i++) {
906 var prop = _a[_i];
907 _loop_1(prop);
908 }
909 return styleOptions;
910}
911function parseHooks(global, document, current) {
912 var allOptions = [global, document, current];
913 var result = {
914 didParseCell: [],
915 willDrawCell: [],
916 didDrawCell: [],
917 willDrawPage: [],
918 didDrawPage: [],
919 };
920 for (var _i = 0, allOptions_1 = allOptions; _i < allOptions_1.length; _i++) {
921 var options = allOptions_1[_i];
922 if (options.didParseCell)
923 result.didParseCell.push(options.didParseCell);
924 if (options.willDrawCell)
925 result.willDrawCell.push(options.willDrawCell);
926 if (options.didDrawCell)
927 result.didDrawCell.push(options.didDrawCell);
928 if (options.willDrawPage)
929 result.willDrawPage.push(options.willDrawPage);
930 if (options.didDrawPage)
931 result.didDrawPage.push(options.didDrawPage);
932 }
933 return result;
934}
935function parseSettings(doc, options) {
936 var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
937 var margin = (0, common_1.parseSpacing)(options.margin, 40 / doc.scaleFactor());
938 var startY = (_a = getStartY(doc, options.startY)) !== null && _a !== void 0 ? _a : margin.top;
939 var showFoot;
940 if (options.showFoot === true) {
941 showFoot = 'everyPage';
942 }
943 else if (options.showFoot === false) {
944 showFoot = 'never';
945 }
946 else {
947 showFoot = (_b = options.showFoot) !== null && _b !== void 0 ? _b : 'everyPage';
948 }
949 var showHead;
950 if (options.showHead === true) {
951 showHead = 'everyPage';
952 }
953 else if (options.showHead === false) {
954 showHead = 'never';
955 }
956 else {
957 showHead = (_c = options.showHead) !== null && _c !== void 0 ? _c : 'everyPage';
958 }
959 var useCss = (_d = options.useCss) !== null && _d !== void 0 ? _d : false;
960 var theme = options.theme || (useCss ? 'plain' : 'striped');
961 var horizontalPageBreak = !!options.horizontalPageBreak;
962 var horizontalPageBreakRepeat = (_e = options.horizontalPageBreakRepeat) !== null && _e !== void 0 ? _e : null;
963 return {
964 includeHiddenHtml: (_f = options.includeHiddenHtml) !== null && _f !== void 0 ? _f : false,
965 useCss: useCss,
966 theme: theme,
967 startY: startY,
968 margin: margin,
969 pageBreak: (_g = options.pageBreak) !== null && _g !== void 0 ? _g : 'auto',
970 rowPageBreak: (_h = options.rowPageBreak) !== null && _h !== void 0 ? _h : 'auto',
971 tableWidth: (_j = options.tableWidth) !== null && _j !== void 0 ? _j : 'auto',
972 showHead: showHead,
973 showFoot: showFoot,
974 tableLineWidth: (_k = options.tableLineWidth) !== null && _k !== void 0 ? _k : 0,
975 tableLineColor: (_l = options.tableLineColor) !== null && _l !== void 0 ? _l : 200,
976 horizontalPageBreak: horizontalPageBreak,
977 horizontalPageBreakRepeat: horizontalPageBreakRepeat,
978 horizontalPageBreakBehaviour: (_m = options.horizontalPageBreakBehaviour) !== null && _m !== void 0 ? _m : 'afterAllRows',
979 };
980}
981function getStartY(doc, userStartY) {
982 var previous = doc.getLastAutoTable();
983 var sf = doc.scaleFactor();
984 var currentPage = doc.pageNumber();
985 var isSamePageAsPreviousTable = false;
986 if (previous && previous.startPageNumber) {
987 var endingPage = previous.startPageNumber + previous.pageNumber - 1;
988 isSamePageAsPreviousTable = endingPage === currentPage;
989 }
990 if (typeof userStartY === 'number') {
991 return userStartY;
992 }
993 else if (userStartY == null || userStartY === false) {
994 if (isSamePageAsPreviousTable && (previous === null || previous === void 0 ? void 0 : previous.finalY) != null) {
995 // Some users had issues with overlapping tables when they used multiple
996 // tables without setting startY so setting it here to a sensible default.
997 return previous.finalY + 20 / sf;
998 }
999 }
1000 return null;
1001}
1002function parseContent(doc, options, window) {
1003 var head = options.head || [];
1004 var body = options.body || [];
1005 var foot = options.foot || [];
1006 if (options.html) {
1007 var hidden = options.includeHiddenHtml;
1008 if (window) {
1009 var htmlContent = (0, htmlParser_1.parseHtml)(doc, options.html, window, hidden, options.useCss) || {};
1010 head = htmlContent.head || head;
1011 body = htmlContent.body || head;
1012 foot = htmlContent.foot || head;
1013 }
1014 else {
1015 console.error('Cannot parse html in non browser environment');
1016 }
1017 }
1018 var columns = options.columns || parseColumns(head, body, foot);
1019 return {
1020 columns: columns,
1021 head: head,
1022 body: body,
1023 foot: foot,
1024 };
1025}
1026function parseColumns(head, body, foot) {
1027 var firstRow = head[0] || body[0] || foot[0] || [];
1028 var result = [];
1029 Object.keys(firstRow)
1030 .filter(function (key) { return key !== '_element'; })
1031 .forEach(function (key) {
1032 var colSpan = 1;
1033 var input;
1034 if (Array.isArray(firstRow)) {
1035 input = firstRow[parseInt(key)];
1036 }
1037 else {
1038 input = firstRow[key];
1039 }
1040 if (typeof input === 'object' && !Array.isArray(input)) {
1041 colSpan = (input === null || input === void 0 ? void 0 : input.colSpan) || 1;
1042 }
1043 for (var i = 0; i < colSpan; i++) {
1044 var id = void 0;
1045 if (Array.isArray(firstRow)) {
1046 id = result.length;
1047 }
1048 else {
1049 id = key + (i > 0 ? "_".concat(i) : '');
1050 }
1051 var rowResult = { dataKey: id };
1052 result.push(rowResult);
1053 }
1054 });
1055 return result;
1056}
1057
1058
1059/***/ }),
1060
1061/***/ 792:
1062/***/ (function(__unused_webpack_module, exports) {
1063
1064
1065Object.defineProperty(exports, "__esModule", ({ value: true }));
1066function default_1(doc, global, document, current) {
1067 var _loop_1 = function (options) {
1068 if (options && typeof options !== 'object') {
1069 console.error('The options parameter should be of type object, is: ' + typeof options);
1070 }
1071 if (typeof options.extendWidth !== 'undefined') {
1072 options.tableWidth = options.extendWidth ? 'auto' : 'wrap';
1073 console.error('Use of deprecated option: extendWidth, use tableWidth instead.');
1074 }
1075 if (typeof options.margins !== 'undefined') {
1076 if (typeof options.margin === 'undefined')
1077 options.margin = options.margins;
1078 console.error('Use of deprecated option: margins, use margin instead.');
1079 }
1080 if (options.startY && typeof options.startY !== 'number') {
1081 console.error('Invalid value for startY option', options.startY);
1082 delete options.startY;
1083 }
1084 if (!options.didDrawPage &&
1085 (options.afterPageContent ||
1086 options.beforePageContent ||
1087 options.afterPageAdd)) {
1088 console.error('The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use didDrawPage instead');
1089 options.didDrawPage = function (data) {
1090 doc.applyStyles(doc.userStyles);
1091 if (options.beforePageContent)
1092 options.beforePageContent(data);
1093 doc.applyStyles(doc.userStyles);
1094 if (options.afterPageContent)
1095 options.afterPageContent(data);
1096 doc.applyStyles(doc.userStyles);
1097 if (options.afterPageAdd && data.pageNumber > 1) {
1098 ;
1099 data.afterPageAdd(data);
1100 }
1101 doc.applyStyles(doc.userStyles);
1102 };
1103 }
1104 ;
1105 [
1106 'createdHeaderCell',
1107 'drawHeaderRow',
1108 'drawRow',
1109 'drawHeaderCell',
1110 ].forEach(function (name) {
1111 if (options[name]) {
1112 console.error("The \"".concat(name, "\" hook has changed in version 3.0, check the changelog for how to migrate."));
1113 }
1114 });
1115 [
1116 ['showFoot', 'showFooter'],
1117 ['showHead', 'showHeader'],
1118 ['didDrawPage', 'addPageContent'],
1119 ['didParseCell', 'createdCell'],
1120 ['headStyles', 'headerStyles'],
1121 ].forEach(function (_a) {
1122 var current = _a[0], deprecated = _a[1];
1123 if (options[deprecated]) {
1124 console.error("Use of deprecated option ".concat(deprecated, ". Use ").concat(current, " instead"));
1125 options[current] = options[deprecated];
1126 }
1127 });
1128 [
1129 ['padding', 'cellPadding'],
1130 ['lineHeight', 'rowHeight'],
1131 'fontSize',
1132 'overflow',
1133 ].forEach(function (o) {
1134 var deprecatedOption = typeof o === 'string' ? o : o[0];
1135 var style = typeof o === 'string' ? o : o[1];
1136 if (typeof options[deprecatedOption] !== 'undefined') {
1137 if (typeof options.styles[style] === 'undefined') {
1138 options.styles[style] = options[deprecatedOption];
1139 }
1140 console.error('Use of deprecated option: ' +
1141 deprecatedOption +
1142 ', use the style ' +
1143 style +
1144 ' instead.');
1145 }
1146 });
1147 for (var _b = 0, _c = [
1148 'styles',
1149 'bodyStyles',
1150 'headStyles',
1151 'footStyles',
1152 ]; _b < _c.length; _b++) {
1153 var styleProp = _c[_b];
1154 checkStyles(options[styleProp] || {});
1155 }
1156 var columnStyles = options['columnStyles'] || {};
1157 for (var _d = 0, _e = Object.keys(columnStyles); _d < _e.length; _d++) {
1158 var key = _e[_d];
1159 checkStyles(columnStyles[key] || {});
1160 }
1161 };
1162 for (var _i = 0, _a = [global, document, current]; _i < _a.length; _i++) {
1163 var options = _a[_i];
1164 _loop_1(options);
1165 }
1166}
1167exports["default"] = default_1;
1168function checkStyles(styles) {
1169 if (styles.rowHeight) {
1170 console.error('Use of deprecated style rowHeight. It is renamed to minCellHeight.');
1171 if (!styles.minCellHeight) {
1172 styles.minCellHeight = styles.rowHeight;
1173 }
1174 }
1175 else if (styles.columnWidth) {
1176 console.error('Use of deprecated style columnWidth. It is renamed to cellWidth.');
1177 if (!styles.cellWidth) {
1178 styles.cellWidth = styles.columnWidth;
1179 }
1180 }
1181}
1182
1183
1184/***/ }),
1185
1186/***/ 260:
1187/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1188
1189
1190Object.defineProperty(exports, "__esModule", ({ value: true }));
1191exports.Column = exports.Cell = exports.Row = exports.Table = void 0;
1192var config_1 = __webpack_require__(796);
1193var HookData_1 = __webpack_require__(172);
1194var common_1 = __webpack_require__(420);
1195var Table = /** @class */ (function () {
1196 function Table(input, content) {
1197 this.pageNumber = 1;
1198 // Deprecated, use pageNumber instead
1199 // Not using getter since:
1200 // https://github.com/simonbengtsson/jsPDF-AutoTable/issues/596
1201 this.pageCount = 1;
1202 this.id = input.id;
1203 this.settings = input.settings;
1204 this.styles = input.styles;
1205 this.hooks = input.hooks;
1206 this.columns = content.columns;
1207 this.head = content.head;
1208 this.body = content.body;
1209 this.foot = content.foot;
1210 }
1211 Table.prototype.getHeadHeight = function (columns) {
1212 return this.head.reduce(function (acc, row) { return acc + row.getMaxCellHeight(columns); }, 0);
1213 };
1214 Table.prototype.getFootHeight = function (columns) {
1215 return this.foot.reduce(function (acc, row) { return acc + row.getMaxCellHeight(columns); }, 0);
1216 };
1217 Table.prototype.allRows = function () {
1218 return this.head.concat(this.body).concat(this.foot);
1219 };
1220 Table.prototype.callCellHooks = function (doc, handlers, cell, row, column, cursor) {
1221 for (var _i = 0, handlers_1 = handlers; _i < handlers_1.length; _i++) {
1222 var handler = handlers_1[_i];
1223 var data = new HookData_1.CellHookData(doc, this, cell, row, column, cursor);
1224 var result = handler(data) === false;
1225 // Make sure text is always string[] since user can assign string
1226 cell.text = Array.isArray(cell.text) ? cell.text : [cell.text];
1227 if (result) {
1228 return false;
1229 }
1230 }
1231 return true;
1232 };
1233 Table.prototype.callEndPageHooks = function (doc, cursor) {
1234 doc.applyStyles(doc.userStyles);
1235 for (var _i = 0, _a = this.hooks.didDrawPage; _i < _a.length; _i++) {
1236 var handler = _a[_i];
1237 handler(new HookData_1.HookData(doc, this, cursor));
1238 }
1239 };
1240 Table.prototype.callWillDrawPageHooks = function (doc, cursor) {
1241 for (var _i = 0, _a = this.hooks.willDrawPage; _i < _a.length; _i++) {
1242 var handler = _a[_i];
1243 handler(new HookData_1.HookData(doc, this, cursor));
1244 }
1245 };
1246 Table.prototype.getWidth = function (pageWidth) {
1247 if (typeof this.settings.tableWidth === 'number') {
1248 return this.settings.tableWidth;
1249 }
1250 else if (this.settings.tableWidth === 'wrap') {
1251 var wrappedWidth = this.columns.reduce(function (total, col) { return total + col.wrappedWidth; }, 0);
1252 return wrappedWidth;
1253 }
1254 else {
1255 var margin = this.settings.margin;
1256 return pageWidth - margin.left - margin.right;
1257 }
1258 };
1259 return Table;
1260}());
1261exports.Table = Table;
1262var Row = /** @class */ (function () {
1263 function Row(raw, index, section, cells, spansMultiplePages) {
1264 if (spansMultiplePages === void 0) { spansMultiplePages = false; }
1265 this.height = 0;
1266 this.raw = raw;
1267 if (raw instanceof config_1.HtmlRowInput) {
1268 this.raw = raw._element;
1269 this.element = raw._element;
1270 }
1271 this.index = index;
1272 this.section = section;
1273 this.cells = cells;
1274 this.spansMultiplePages = spansMultiplePages;
1275 }
1276 Row.prototype.getMaxCellHeight = function (columns) {
1277 var _this = this;
1278 return columns.reduce(function (acc, column) { var _a; return Math.max(acc, ((_a = _this.cells[column.index]) === null || _a === void 0 ? void 0 : _a.height) || 0); }, 0);
1279 };
1280 Row.prototype.hasRowSpan = function (columns) {
1281 var _this = this;
1282 return (columns.filter(function (column) {
1283 var cell = _this.cells[column.index];
1284 if (!cell)
1285 return false;
1286 return cell.rowSpan > 1;
1287 }).length > 0);
1288 };
1289 Row.prototype.canEntireRowFit = function (height, columns) {
1290 return this.getMaxCellHeight(columns) <= height;
1291 };
1292 Row.prototype.getMinimumRowHeight = function (columns, doc) {
1293 var _this = this;
1294 return columns.reduce(function (acc, column) {
1295 var cell = _this.cells[column.index];
1296 if (!cell)
1297 return 0;
1298 var lineHeight = doc.getLineHeight(cell.styles.fontSize);
1299 var vPadding = cell.padding('vertical');
1300 var oneRowHeight = vPadding + lineHeight;
1301 return oneRowHeight > acc ? oneRowHeight : acc;
1302 }, 0);
1303 };
1304 return Row;
1305}());
1306exports.Row = Row;
1307var Cell = /** @class */ (function () {
1308 function Cell(raw, styles, section) {
1309 var _a, _b;
1310 this.contentHeight = 0;
1311 this.contentWidth = 0;
1312 this.wrappedWidth = 0;
1313 this.minReadableWidth = 0;
1314 this.minWidth = 0;
1315 this.width = 0;
1316 this.height = 0;
1317 this.x = 0;
1318 this.y = 0;
1319 this.styles = styles;
1320 this.section = section;
1321 this.raw = raw;
1322 var content = raw;
1323 if (raw != null && typeof raw === 'object' && !Array.isArray(raw)) {
1324 this.rowSpan = raw.rowSpan || 1;
1325 this.colSpan = raw.colSpan || 1;
1326 content = (_b = (_a = raw.content) !== null && _a !== void 0 ? _a : raw.title) !== null && _b !== void 0 ? _b : raw;
1327 if (raw._element) {
1328 this.raw = raw._element;
1329 }
1330 }
1331 else {
1332 this.rowSpan = 1;
1333 this.colSpan = 1;
1334 }
1335 // Stringify 0 and false, but not undefined or null
1336 var text = content != null ? '' + content : '';
1337 var splitRegex = /\r\n|\r|\n/g;
1338 this.text = text.split(splitRegex);
1339 }
1340 Cell.prototype.getTextPos = function () {
1341 var y;
1342 if (this.styles.valign === 'top') {
1343 y = this.y + this.padding('top');
1344 }
1345 else if (this.styles.valign === 'bottom') {
1346 y = this.y + this.height - this.padding('bottom');
1347 }
1348 else {
1349 var netHeight = this.height - this.padding('vertical');
1350 y = this.y + netHeight / 2 + this.padding('top');
1351 }
1352 var x;
1353 if (this.styles.halign === 'right') {
1354 x = this.x + this.width - this.padding('right');
1355 }
1356 else if (this.styles.halign === 'center') {
1357 var netWidth = this.width - this.padding('horizontal');
1358 x = this.x + netWidth / 2 + this.padding('left');
1359 }
1360 else {
1361 x = this.x + this.padding('left');
1362 }
1363 return { x: x, y: y };
1364 };
1365 // TODO (v4): replace parameters with only (lineHeight)
1366 Cell.prototype.getContentHeight = function (scaleFactor, lineHeightFactor) {
1367 if (lineHeightFactor === void 0) { lineHeightFactor = 1.15; }
1368 var lineCount = Array.isArray(this.text) ? this.text.length : 1;
1369 var lineHeight = (this.styles.fontSize / scaleFactor) * lineHeightFactor;
1370 var height = lineCount * lineHeight + this.padding('vertical');
1371 return Math.max(height, this.styles.minCellHeight);
1372 };
1373 Cell.prototype.padding = function (name) {
1374 var padding = (0, common_1.parseSpacing)(this.styles.cellPadding, 0);
1375 if (name === 'vertical') {
1376 return padding.top + padding.bottom;
1377 }
1378 else if (name === 'horizontal') {
1379 return padding.left + padding.right;
1380 }
1381 else {
1382 return padding[name];
1383 }
1384 };
1385 return Cell;
1386}());
1387exports.Cell = Cell;
1388var Column = /** @class */ (function () {
1389 function Column(dataKey, raw, index) {
1390 this.wrappedWidth = 0;
1391 this.minReadableWidth = 0;
1392 this.minWidth = 0;
1393 this.width = 0;
1394 this.dataKey = dataKey;
1395 this.raw = raw;
1396 this.index = index;
1397 }
1398 Column.prototype.getMaxCustomCellWidth = function (table) {
1399 var max = 0;
1400 for (var _i = 0, _a = table.allRows(); _i < _a.length; _i++) {
1401 var row = _a[_i];
1402 var cell = row.cells[this.index];
1403 if (cell && typeof cell.styles.cellWidth === 'number') {
1404 max = Math.max(max, cell.styles.cellWidth);
1405 }
1406 }
1407 return max;
1408 };
1409 return Column;
1410}());
1411exports.Column = Column;
1412
1413
1414/***/ }),
1415
1416/***/ 356:
1417/***/ (function(__unused_webpack_module, exports) {
1418
1419
1420/* eslint-disable @typescript-eslint/no-unused-vars */
1421Object.defineProperty(exports, "__esModule", ({ value: true }));
1422exports.assign = void 0;
1423// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
1424function assign(target, s, s1, s2, s3) {
1425 if (target == null) {
1426 throw new TypeError('Cannot convert undefined or null to object');
1427 }
1428 var to = Object(target);
1429 for (var index = 1; index < arguments.length; index++) {
1430 // eslint-disable-next-line prefer-rest-params
1431 var nextSource = arguments[index];
1432 if (nextSource != null) {
1433 // Skip over if undefined or null
1434 for (var nextKey in nextSource) {
1435 // Avoid bugs when hasOwnProperty is shadowed
1436 if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
1437 to[nextKey] = nextSource[nextKey];
1438 }
1439 }
1440 }
1441 }
1442 return to;
1443}
1444exports.assign = assign;
1445
1446
1447/***/ }),
1448
1449/***/ 972:
1450/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1451
1452
1453Object.defineProperty(exports, "__esModule", ({ value: true }));
1454exports.createTable = void 0;
1455var documentHandler_1 = __webpack_require__(744);
1456var models_1 = __webpack_require__(260);
1457var widthCalculator_1 = __webpack_require__(324);
1458var config_1 = __webpack_require__(796);
1459var polyfills_1 = __webpack_require__(356);
1460function createTable(jsPDFDoc, input) {
1461 var doc = new documentHandler_1.DocHandler(jsPDFDoc);
1462 var content = parseContent(input, doc.scaleFactor());
1463 var table = new models_1.Table(input, content);
1464 (0, widthCalculator_1.calculateWidths)(doc, table);
1465 doc.applyStyles(doc.userStyles);
1466 return table;
1467}
1468exports.createTable = createTable;
1469function parseContent(input, sf) {
1470 var content = input.content;
1471 var columns = createColumns(content.columns);
1472 // If no head or foot is set, try generating it with content from columns
1473 if (content.head.length === 0) {
1474 var sectionRow = generateSectionRow(columns, 'head');
1475 if (sectionRow)
1476 content.head.push(sectionRow);
1477 }
1478 if (content.foot.length === 0) {
1479 var sectionRow = generateSectionRow(columns, 'foot');
1480 if (sectionRow)
1481 content.foot.push(sectionRow);
1482 }
1483 var theme = input.settings.theme;
1484 var styles = input.styles;
1485 return {
1486 columns: columns,
1487 head: parseSection('head', content.head, columns, styles, theme, sf),
1488 body: parseSection('body', content.body, columns, styles, theme, sf),
1489 foot: parseSection('foot', content.foot, columns, styles, theme, sf),
1490 };
1491}
1492function parseSection(sectionName, sectionRows, columns, styleProps, theme, scaleFactor) {
1493 var rowSpansLeftForColumn = {};
1494 var result = sectionRows.map(function (rawRow, rowIndex) {
1495 var skippedRowForRowSpans = 0;
1496 var cells = {};
1497 var colSpansAdded = 0;
1498 var columnSpansLeft = 0;
1499 for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
1500 var column = columns_1[_i];
1501 if (rowSpansLeftForColumn[column.index] == null ||
1502 rowSpansLeftForColumn[column.index].left === 0) {
1503 if (columnSpansLeft === 0) {
1504 var rawCell = void 0;
1505 if (Array.isArray(rawRow)) {
1506 rawCell =
1507 rawRow[column.index - colSpansAdded - skippedRowForRowSpans];
1508 }
1509 else {
1510 rawCell = rawRow[column.dataKey];
1511 }
1512 var cellInputStyles = {};
1513 if (typeof rawCell === 'object' && !Array.isArray(rawCell)) {
1514 cellInputStyles = (rawCell === null || rawCell === void 0 ? void 0 : rawCell.styles) || {};
1515 }
1516 var styles = cellStyles(sectionName, column, rowIndex, theme, styleProps, scaleFactor, cellInputStyles);
1517 var cell = new models_1.Cell(rawCell, styles, sectionName);
1518 // dataKey is not used internally no more but keep for
1519 // backwards compat in hooks
1520 cells[column.dataKey] = cell;
1521 cells[column.index] = cell;
1522 columnSpansLeft = cell.colSpan - 1;
1523 rowSpansLeftForColumn[column.index] = {
1524 left: cell.rowSpan - 1,
1525 times: columnSpansLeft,
1526 };
1527 }
1528 else {
1529 columnSpansLeft--;
1530 colSpansAdded++;
1531 }
1532 }
1533 else {
1534 rowSpansLeftForColumn[column.index].left--;
1535 columnSpansLeft = rowSpansLeftForColumn[column.index].times;
1536 skippedRowForRowSpans++;
1537 }
1538 }
1539 return new models_1.Row(rawRow, rowIndex, sectionName, cells);
1540 });
1541 return result;
1542}
1543function generateSectionRow(columns, section) {
1544 var sectionRow = {};
1545 columns.forEach(function (col) {
1546 if (col.raw != null) {
1547 var title = getSectionTitle(section, col.raw);
1548 if (title != null)
1549 sectionRow[col.dataKey] = title;
1550 }
1551 });
1552 return Object.keys(sectionRow).length > 0 ? sectionRow : null;
1553}
1554function getSectionTitle(section, column) {
1555 if (section === 'head') {
1556 if (typeof column === 'object') {
1557 return column.header || column.title || null;
1558 }
1559 else if (typeof column === 'string' || typeof column === 'number') {
1560 return column;
1561 }
1562 }
1563 else if (section === 'foot' && typeof column === 'object') {
1564 return column.footer;
1565 }
1566 return null;
1567}
1568function createColumns(columns) {
1569 return columns.map(function (input, index) {
1570 var _a, _b;
1571 var key;
1572 if (typeof input === 'object') {
1573 key = (_b = (_a = input.dataKey) !== null && _a !== void 0 ? _a : input.key) !== null && _b !== void 0 ? _b : index;
1574 }
1575 else {
1576 key = index;
1577 }
1578 return new models_1.Column(key, input, index);
1579 });
1580}
1581function cellStyles(sectionName, column, rowIndex, themeName, styles, scaleFactor, cellInputStyles) {
1582 var theme = (0, config_1.getTheme)(themeName);
1583 var sectionStyles;
1584 if (sectionName === 'head') {
1585 sectionStyles = styles.headStyles;
1586 }
1587 else if (sectionName === 'body') {
1588 sectionStyles = styles.bodyStyles;
1589 }
1590 else if (sectionName === 'foot') {
1591 sectionStyles = styles.footStyles;
1592 }
1593 var otherStyles = (0, polyfills_1.assign)({}, theme.table, theme[sectionName], styles.styles, sectionStyles);
1594 var columnStyles = styles.columnStyles[column.dataKey] ||
1595 styles.columnStyles[column.index] ||
1596 {};
1597 var colStyles = sectionName === 'body' ? columnStyles : {};
1598 var rowStyles = sectionName === 'body' && rowIndex % 2 === 0
1599 ? (0, polyfills_1.assign)({}, theme.alternateRow, styles.alternateRowStyles)
1600 : {};
1601 var defaultStyle = (0, config_1.defaultStyles)(scaleFactor);
1602 var themeStyles = (0, polyfills_1.assign)({}, defaultStyle, otherStyles, rowStyles, colStyles);
1603 return (0, polyfills_1.assign)(themeStyles, cellInputStyles);
1604}
1605
1606
1607/***/ }),
1608
1609/***/ 664:
1610/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1611
1612
1613Object.defineProperty(exports, "__esModule", ({ value: true }));
1614exports.addPage = exports.drawTable = void 0;
1615var common_1 = __webpack_require__(420);
1616var models_1 = __webpack_require__(260);
1617var documentHandler_1 = __webpack_require__(744);
1618var polyfills_1 = __webpack_require__(356);
1619var autoTableText_1 = __webpack_require__(136);
1620var tablePrinter_1 = __webpack_require__(224);
1621function drawTable(jsPDFDoc, table) {
1622 var settings = table.settings;
1623 var startY = settings.startY;
1624 var margin = settings.margin;
1625 var cursor = {
1626 x: margin.left,
1627 y: startY,
1628 };
1629 var sectionsHeight = table.getHeadHeight(table.columns) + table.getFootHeight(table.columns);
1630 var minTableBottomPos = startY + margin.bottom + sectionsHeight;
1631 if (settings.pageBreak === 'avoid') {
1632 var rows = table.body;
1633 var tableHeight = rows.reduce(function (acc, row) { return acc + row.height; }, 0);
1634 minTableBottomPos += tableHeight;
1635 }
1636 var doc = new documentHandler_1.DocHandler(jsPDFDoc);
1637 if (settings.pageBreak === 'always' ||
1638 (settings.startY != null && minTableBottomPos > doc.pageSize().height)) {
1639 nextPage(doc);
1640 cursor.y = margin.top;
1641 }
1642 table.callWillDrawPageHooks(doc, cursor);
1643 var startPos = (0, polyfills_1.assign)({}, cursor);
1644 table.startPageNumber = doc.pageNumber();
1645 if (settings.horizontalPageBreak) {
1646 // managed flow for split columns
1647 printTableWithHorizontalPageBreak(doc, table, startPos, cursor);
1648 }
1649 else {
1650 // normal flow
1651 doc.applyStyles(doc.userStyles);
1652 if (settings.showHead === 'firstPage' ||
1653 settings.showHead === 'everyPage') {
1654 table.head.forEach(function (row) {
1655 return printRow(doc, table, row, cursor, table.columns);
1656 });
1657 }
1658 doc.applyStyles(doc.userStyles);
1659 table.body.forEach(function (row, index) {
1660 var isLastRow = index === table.body.length - 1;
1661 printFullRow(doc, table, row, isLastRow, startPos, cursor, table.columns);
1662 });
1663 doc.applyStyles(doc.userStyles);
1664 if (settings.showFoot === 'lastPage' || settings.showFoot === 'everyPage') {
1665 table.foot.forEach(function (row) {
1666 return printRow(doc, table, row, cursor, table.columns);
1667 });
1668 }
1669 }
1670 (0, common_1.addTableBorder)(doc, table, startPos, cursor);
1671 table.callEndPageHooks(doc, cursor);
1672 table.finalY = cursor.y;
1673 jsPDFDoc.lastAutoTable = table;
1674 jsPDFDoc.previousAutoTable = table; // Deprecated
1675 if (jsPDFDoc.autoTable)
1676 jsPDFDoc.autoTable.previous = table; // Deprecated
1677 doc.applyStyles(doc.userStyles);
1678}
1679exports.drawTable = drawTable;
1680function printTableWithHorizontalPageBreak(doc, table, startPos, cursor) {
1681 // calculate width of columns and render only those which can fit into page
1682 var allColumnsCanFitResult = (0, tablePrinter_1.calculateAllColumnsCanFitInPage)(doc, table);
1683 var settings = table.settings;
1684 if (settings.horizontalPageBreakBehaviour === 'afterAllRows') {
1685 allColumnsCanFitResult.forEach(function (colsAndIndexes, index) {
1686 doc.applyStyles(doc.userStyles);
1687 // add page to print next columns in new page
1688 if (index > 0) {
1689 // When adding a page here, make sure not to print the footers
1690 // because they were already printed before on this same loop
1691 addPage(doc, table, startPos, cursor, colsAndIndexes.columns, true);
1692 }
1693 else {
1694 // print head for selected columns
1695 printHead(doc, table, cursor, colsAndIndexes.columns);
1696 }
1697 // print body & footer for selected columns
1698 printBody(doc, table, startPos, cursor, colsAndIndexes.columns);
1699 printFoot(doc, table, cursor, colsAndIndexes.columns);
1700 });
1701 }
1702 else {
1703 var lastRowIndexOfLastPage_1 = -1;
1704 var firstColumnsToFitResult = allColumnsCanFitResult[0];
1705 var _loop_1 = function () {
1706 // Print the first columns, taking note of the last row printed
1707 var lastPrintedRowIndex = lastRowIndexOfLastPage_1;
1708 if (firstColumnsToFitResult) {
1709 doc.applyStyles(doc.userStyles);
1710 var firstColumnsToFit = firstColumnsToFitResult.columns;
1711 if (lastRowIndexOfLastPage_1 >= 0) {
1712 // When adding a page here, make sure not to print the footers
1713 // because they were already printed before on this same loop
1714 addPage(doc, table, startPos, cursor, firstColumnsToFit, true);
1715 }
1716 else {
1717 printHead(doc, table, cursor, firstColumnsToFit);
1718 }
1719 lastPrintedRowIndex = printBodyWithoutPageBreaks(doc, table, lastRowIndexOfLastPage_1 + 1, cursor, firstColumnsToFit);
1720 printFoot(doc, table, cursor, firstColumnsToFit);
1721 }
1722 // Check how many rows were printed, so that the next columns would not print more rows than that
1723 var maxNumberOfRows = lastPrintedRowIndex - lastRowIndexOfLastPage_1;
1724 // Print the next columns, never exceding maxNumberOfRows
1725 allColumnsCanFitResult.slice(1).forEach(function (colsAndIndexes) {
1726 doc.applyStyles(doc.userStyles);
1727 // When adding a page here, make sure not to print the footers
1728 // because they were already printed before on this same loop
1729 addPage(doc, table, startPos, cursor, colsAndIndexes.columns, true);
1730 printBodyWithoutPageBreaks(doc, table, lastRowIndexOfLastPage_1 + 1, cursor, colsAndIndexes.columns, maxNumberOfRows);
1731 printFoot(doc, table, cursor, colsAndIndexes.columns);
1732 });
1733 lastRowIndexOfLastPage_1 = lastPrintedRowIndex;
1734 };
1735 while (lastRowIndexOfLastPage_1 < table.body.length - 1) {
1736 _loop_1();
1737 }
1738 }
1739}
1740function printHead(doc, table, cursor, columns) {
1741 var settings = table.settings;
1742 doc.applyStyles(doc.userStyles);
1743 if (settings.showHead === 'firstPage' || settings.showHead === 'everyPage') {
1744 table.head.forEach(function (row) { return printRow(doc, table, row, cursor, columns); });
1745 }
1746}
1747function printBody(doc, table, startPos, cursor, columns) {
1748 doc.applyStyles(doc.userStyles);
1749 table.body.forEach(function (row, index) {
1750 var isLastRow = index === table.body.length - 1;
1751 printFullRow(doc, table, row, isLastRow, startPos, cursor, columns);
1752 });
1753}
1754function printBodyWithoutPageBreaks(doc, table, startRowIndex, cursor, columns, maxNumberOfRows) {
1755 doc.applyStyles(doc.userStyles);
1756 maxNumberOfRows = maxNumberOfRows !== null && maxNumberOfRows !== void 0 ? maxNumberOfRows : table.body.length;
1757 var endRowIndex = Math.min(startRowIndex + maxNumberOfRows, table.body.length);
1758 var lastPrintedRowIndex = -1;
1759 table.body.slice(startRowIndex, endRowIndex).forEach(function (row, index) {
1760 var isLastRow = startRowIndex + index === table.body.length - 1;
1761 var remainingSpace = getRemainingPageSpace(doc, table, isLastRow, cursor);
1762 if (row.canEntireRowFit(remainingSpace, columns)) {
1763 printRow(doc, table, row, cursor, columns);
1764 lastPrintedRowIndex = startRowIndex + index;
1765 }
1766 });
1767 return lastPrintedRowIndex;
1768}
1769function printFoot(doc, table, cursor, columns) {
1770 var settings = table.settings;
1771 doc.applyStyles(doc.userStyles);
1772 if (settings.showFoot === 'lastPage' || settings.showFoot === 'everyPage') {
1773 table.foot.forEach(function (row) { return printRow(doc, table, row, cursor, columns); });
1774 }
1775}
1776function getRemainingLineCount(cell, remainingPageSpace, doc) {
1777 var lineHeight = doc.getLineHeight(cell.styles.fontSize);
1778 var vPadding = cell.padding('vertical');
1779 var remainingLines = Math.floor((remainingPageSpace - vPadding) / lineHeight);
1780 return Math.max(0, remainingLines);
1781}
1782function modifyRowToFit(row, remainingPageSpace, table, doc) {
1783 var cells = {};
1784 row.spansMultiplePages = true;
1785 row.height = 0;
1786 var rowHeight = 0;
1787 for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {
1788 var column = _a[_i];
1789 var cell = row.cells[column.index];
1790 if (!cell)
1791 continue;
1792 if (!Array.isArray(cell.text)) {
1793 cell.text = [cell.text];
1794 }
1795 var remainderCell = new models_1.Cell(cell.raw, cell.styles, cell.section);
1796 remainderCell = (0, polyfills_1.assign)(remainderCell, cell);
1797 remainderCell.text = [];
1798 var remainingLineCount = getRemainingLineCount(cell, remainingPageSpace, doc);
1799 if (cell.text.length > remainingLineCount) {
1800 remainderCell.text = cell.text.splice(remainingLineCount, cell.text.length);
1801 }
1802 var scaleFactor = doc.scaleFactor();
1803 var lineHeightFactor = doc.getLineHeightFactor();
1804 cell.contentHeight = cell.getContentHeight(scaleFactor, lineHeightFactor);
1805 if (cell.contentHeight >= remainingPageSpace) {
1806 cell.contentHeight = remainingPageSpace;
1807 remainderCell.styles.minCellHeight -= remainingPageSpace;
1808 }
1809 if (cell.contentHeight > row.height) {
1810 row.height = cell.contentHeight;
1811 }
1812 remainderCell.contentHeight = remainderCell.getContentHeight(scaleFactor, lineHeightFactor);
1813 if (remainderCell.contentHeight > rowHeight) {
1814 rowHeight = remainderCell.contentHeight;
1815 }
1816 cells[column.index] = remainderCell;
1817 }
1818 var remainderRow = new models_1.Row(row.raw, -1, row.section, cells, true);
1819 remainderRow.height = rowHeight;
1820 for (var _b = 0, _c = table.columns; _b < _c.length; _b++) {
1821 var column = _c[_b];
1822 var remainderCell = remainderRow.cells[column.index];
1823 if (remainderCell) {
1824 remainderCell.height = remainderRow.height;
1825 }
1826 var cell = row.cells[column.index];
1827 if (cell) {
1828 cell.height = row.height;
1829 }
1830 }
1831 return remainderRow;
1832}
1833function shouldPrintOnCurrentPage(doc, row, remainingPageSpace, table) {
1834 var pageHeight = doc.pageSize().height;
1835 var margin = table.settings.margin;
1836 var marginHeight = margin.top + margin.bottom;
1837 var maxRowHeight = pageHeight - marginHeight;
1838 if (row.section === 'body') {
1839 // Should also take into account that head and foot is not
1840 // on every page with some settings
1841 maxRowHeight -=
1842 table.getHeadHeight(table.columns) + table.getFootHeight(table.columns);
1843 }
1844 var minRowHeight = row.getMinimumRowHeight(table.columns, doc);
1845 var minRowFits = minRowHeight < remainingPageSpace;
1846 if (minRowHeight > maxRowHeight) {
1847 console.error("Will not be able to print row ".concat(row.index, " correctly since it's minimum height is larger than page height"));
1848 return true;
1849 }
1850 if (!minRowFits) {
1851 return false;
1852 }
1853 var rowHasRowSpanCell = row.hasRowSpan(table.columns);
1854 var rowHigherThanPage = row.getMaxCellHeight(table.columns) > maxRowHeight;
1855 if (rowHigherThanPage) {
1856 if (rowHasRowSpanCell) {
1857 console.error("The content of row ".concat(row.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."));
1858 }
1859 return true;
1860 }
1861 if (rowHasRowSpanCell) {
1862 // Currently a new page is required whenever a rowspan row don't fit a page.
1863 return false;
1864 }
1865 if (table.settings.rowPageBreak === 'avoid') {
1866 return false;
1867 }
1868 // In all other cases print the row on current page
1869 return true;
1870}
1871function printFullRow(doc, table, row, isLastRow, startPos, cursor, columns) {
1872 var remainingSpace = getRemainingPageSpace(doc, table, isLastRow, cursor);
1873 if (row.canEntireRowFit(remainingSpace, columns)) {
1874 // The row fits in the current page
1875 printRow(doc, table, row, cursor, columns);
1876 }
1877 else if (shouldPrintOnCurrentPage(doc, row, remainingSpace, table)) {
1878 // The row gets split in two here, each piece in one page
1879 var remainderRow = modifyRowToFit(row, remainingSpace, table, doc);
1880 printRow(doc, table, row, cursor, columns);
1881 addPage(doc, table, startPos, cursor, columns);
1882 printFullRow(doc, table, remainderRow, isLastRow, startPos, cursor, columns);
1883 }
1884 else {
1885 // The row get printed entirelly on the next page
1886 addPage(doc, table, startPos, cursor, columns);
1887 printFullRow(doc, table, row, isLastRow, startPos, cursor, columns);
1888 }
1889}
1890function printRow(doc, table, row, cursor, columns) {
1891 cursor.x = table.settings.margin.left;
1892 for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
1893 var column = columns_1[_i];
1894 var cell = row.cells[column.index];
1895 if (!cell) {
1896 cursor.x += column.width;
1897 continue;
1898 }
1899 doc.applyStyles(cell.styles);
1900 cell.x = cursor.x;
1901 cell.y = cursor.y;
1902 var result = table.callCellHooks(doc, table.hooks.willDrawCell, cell, row, column, cursor);
1903 if (result === false) {
1904 cursor.x += column.width;
1905 continue;
1906 }
1907 drawCellRect(doc, cell, cursor);
1908 var textPos = cell.getTextPos();
1909 (0, autoTableText_1.default)(cell.text, textPos.x, textPos.y, {
1910 halign: cell.styles.halign,
1911 valign: cell.styles.valign,
1912 maxWidth: Math.ceil(cell.width - cell.padding('left') - cell.padding('right')),
1913 }, doc.getDocument());
1914 table.callCellHooks(doc, table.hooks.didDrawCell, cell, row, column, cursor);
1915 cursor.x += column.width;
1916 }
1917 cursor.y += row.height;
1918}
1919function drawCellRect(doc, cell, cursor) {
1920 var cellStyles = cell.styles;
1921 // https://github.com/simonbengtsson/jsPDF-AutoTable/issues/774
1922 // TODO (v4): better solution?
1923 doc.getDocument().setFillColor(doc.getDocument().getFillColor());
1924 if (typeof cellStyles.lineWidth === 'number') {
1925 // Draw cell background with normal borders
1926 var fillStyle = (0, common_1.getFillStyle)(cellStyles.lineWidth, cellStyles.fillColor);
1927 if (fillStyle) {
1928 doc.rect(cell.x, cursor.y, cell.width, cell.height, fillStyle);
1929 }
1930 }
1931 else if (typeof cellStyles.lineWidth === 'object') {
1932 // Draw cell background
1933 if (cellStyles.fillColor) {
1934 doc.rect(cell.x, cursor.y, cell.width, cell.height, 'F');
1935 }
1936 // Draw cell individual borders
1937 drawCellBorders(doc, cell, cursor, cellStyles.lineWidth);
1938 }
1939}
1940/**
1941 * Draw all specified borders. Borders are centered on cell's edge and lengthened
1942 * to overlap with neighbours to create sharp corners.
1943 * @param doc
1944 * @param cell
1945 * @param cursor
1946 * @param fillColor
1947 * @param lineWidth
1948 */
1949function drawCellBorders(doc, cell, cursor, lineWidth) {
1950 var x1, y1, x2, y2;
1951 if (lineWidth.top) {
1952 x1 = cursor.x;
1953 y1 = cursor.y;
1954 x2 = cursor.x + cell.width;
1955 y2 = cursor.y;
1956 if (lineWidth.right) {
1957 x2 += 0.5 * lineWidth.right;
1958 }
1959 if (lineWidth.left) {
1960 x1 -= 0.5 * lineWidth.left;
1961 }
1962 drawLine(lineWidth.top, x1, y1, x2, y2);
1963 }
1964 if (lineWidth.bottom) {
1965 x1 = cursor.x;
1966 y1 = cursor.y + cell.height;
1967 x2 = cursor.x + cell.width;
1968 y2 = cursor.y + cell.height;
1969 if (lineWidth.right) {
1970 x2 += 0.5 * lineWidth.right;
1971 }
1972 if (lineWidth.left) {
1973 x1 -= 0.5 * lineWidth.left;
1974 }
1975 drawLine(lineWidth.bottom, x1, y1, x2, y2);
1976 }
1977 if (lineWidth.left) {
1978 x1 = cursor.x;
1979 y1 = cursor.y;
1980 x2 = cursor.x;
1981 y2 = cursor.y + cell.height;
1982 if (lineWidth.top) {
1983 y1 -= 0.5 * lineWidth.top;
1984 }
1985 if (lineWidth.bottom) {
1986 y2 += 0.5 * lineWidth.bottom;
1987 }
1988 drawLine(lineWidth.left, x1, y1, x2, y2);
1989 }
1990 if (lineWidth.right) {
1991 x1 = cursor.x + cell.width;
1992 y1 = cursor.y;
1993 x2 = cursor.x + cell.width;
1994 y2 = cursor.y + cell.height;
1995 if (lineWidth.top) {
1996 y1 -= 0.5 * lineWidth.top;
1997 }
1998 if (lineWidth.bottom) {
1999 y2 += 0.5 * lineWidth.bottom;
2000 }
2001 drawLine(lineWidth.right, x1, y1, x2, y2);
2002 }
2003 function drawLine(width, x1, y1, x2, y2) {
2004 doc.getDocument().setLineWidth(width);
2005 doc.getDocument().line(x1, y1, x2, y2, 'S');
2006 }
2007}
2008function getRemainingPageSpace(doc, table, isLastRow, cursor) {
2009 var bottomContentHeight = table.settings.margin.bottom;
2010 var showFoot = table.settings.showFoot;
2011 if (showFoot === 'everyPage' || (showFoot === 'lastPage' && isLastRow)) {
2012 bottomContentHeight += table.getFootHeight(table.columns);
2013 }
2014 return doc.pageSize().height - cursor.y - bottomContentHeight;
2015}
2016function addPage(doc, table, startPos, cursor, columns, suppressFooter) {
2017 if (columns === void 0) { columns = []; }
2018 if (suppressFooter === void 0) { suppressFooter = false; }
2019 doc.applyStyles(doc.userStyles);
2020 if (table.settings.showFoot === 'everyPage' && !suppressFooter) {
2021 table.foot.forEach(function (row) { return printRow(doc, table, row, cursor, columns); });
2022 }
2023 // Add user content just before adding new page ensure it will
2024 // be drawn above other things on the page
2025 table.callEndPageHooks(doc, cursor);
2026 var margin = table.settings.margin;
2027 (0, common_1.addTableBorder)(doc, table, startPos, cursor);
2028 nextPage(doc);
2029 table.pageNumber++;
2030 table.pageCount++;
2031 cursor.x = margin.left;
2032 cursor.y = margin.top;
2033 startPos.y = margin.top;
2034 // call didAddPage hooks before any content is added to the page
2035 table.callWillDrawPageHooks(doc, cursor);
2036 if (table.settings.showHead === 'everyPage') {
2037 table.head.forEach(function (row) { return printRow(doc, table, row, cursor, columns); });
2038 doc.applyStyles(doc.userStyles);
2039 }
2040}
2041exports.addPage = addPage;
2042function nextPage(doc) {
2043 var current = doc.pageNumber();
2044 doc.setPage(current + 1);
2045 var newCurrent = doc.pageNumber();
2046 if (newCurrent === current) {
2047 doc.addPage();
2048 return true;
2049 }
2050 return false;
2051}
2052
2053
2054/***/ }),
2055
2056/***/ 224:
2057/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2058
2059
2060Object.defineProperty(exports, "__esModule", ({ value: true }));
2061exports.calculateAllColumnsCanFitInPage = void 0;
2062var common_1 = __webpack_require__(420);
2063// get columns can be fit into page
2064function getColumnsCanFitInPage(doc, table, config) {
2065 var _a;
2066 if (config === void 0) { config = {}; }
2067 // Get page width
2068 var remainingWidth = (0, common_1.getPageAvailableWidth)(doc, table);
2069 // Get column data key to repeat
2070 var repeatColumnsMap = new Map();
2071 var colIndexes = [];
2072 var columns = [];
2073 var horizontalPageBreakRepeat = [];
2074 table.settings.horizontalPageBreakRepeat;
2075 if (Array.isArray(table.settings.horizontalPageBreakRepeat)) {
2076 horizontalPageBreakRepeat = table.settings.horizontalPageBreakRepeat;
2077 // It can be a single value of type string or number (even number: 0)
2078 }
2079 else if (typeof table.settings.horizontalPageBreakRepeat === 'string' ||
2080 typeof table.settings.horizontalPageBreakRepeat === 'number') {
2081 horizontalPageBreakRepeat = [table.settings.horizontalPageBreakRepeat];
2082 }
2083 // Code to repeat the given column in split pages
2084 horizontalPageBreakRepeat.forEach(function (field) {
2085 var col = table.columns.find(function (item) { return item.dataKey === field || item.index === field; });
2086 if (col && !repeatColumnsMap.has(col.index)) {
2087 repeatColumnsMap.set(col.index, true);
2088 colIndexes.push(col.index);
2089 columns.push(table.columns[col.index]);
2090 remainingWidth -= col.wrappedWidth;
2091 }
2092 });
2093 var first = true;
2094 var i = (_a = config === null || config === void 0 ? void 0 : config.start) !== null && _a !== void 0 ? _a : 0; // make sure couter is initiated outside the loop
2095 while (i < table.columns.length) {
2096 // Prevent duplicates
2097 if (repeatColumnsMap.has(i)) {
2098 i++;
2099 continue;
2100 }
2101 var colWidth = table.columns[i].wrappedWidth;
2102 // Take at least one column even if it doesn't fit
2103 if (first || remainingWidth >= colWidth) {
2104 first = false;
2105 colIndexes.push(i);
2106 columns.push(table.columns[i]);
2107 remainingWidth -= colWidth;
2108 }
2109 else {
2110 break;
2111 }
2112 i++;
2113 }
2114 return { colIndexes: colIndexes, columns: columns, lastIndex: i - 1 };
2115}
2116function calculateAllColumnsCanFitInPage(doc, table) {
2117 var allResults = [];
2118 for (var i = 0; i < table.columns.length; i++) {
2119 var result = getColumnsCanFitInPage(doc, table, { start: i });
2120 if (result.columns.length) {
2121 allResults.push(result);
2122 i = result.lastIndex;
2123 }
2124 }
2125 return allResults;
2126}
2127exports.calculateAllColumnsCanFitInPage = calculateAllColumnsCanFitInPage;
2128
2129
2130/***/ }),
2131
2132/***/ 324:
2133/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2134
2135
2136Object.defineProperty(exports, "__esModule", ({ value: true }));
2137exports.ellipsize = exports.resizeColumns = exports.calculateWidths = void 0;
2138var common_1 = __webpack_require__(420);
2139/**
2140 * Calculate the column widths
2141 */
2142function calculateWidths(doc, table) {
2143 calculate(doc, table);
2144 var resizableColumns = [];
2145 var initialTableWidth = 0;
2146 table.columns.forEach(function (column) {
2147 var customWidth = column.getMaxCustomCellWidth(table);
2148 if (customWidth) {
2149 // final column width
2150 column.width = customWidth;
2151 }
2152 else {
2153 // initial column width (will be resized)
2154 column.width = column.wrappedWidth;
2155 resizableColumns.push(column);
2156 }
2157 initialTableWidth += column.width;
2158 });
2159 // width difference that needs to be distributed
2160 var resizeWidth = table.getWidth(doc.pageSize().width) - initialTableWidth;
2161 // first resize attempt: with respect to minReadableWidth and minWidth
2162 if (resizeWidth) {
2163 resizeWidth = resizeColumns(resizableColumns, resizeWidth, function (column) {
2164 return Math.max(column.minReadableWidth, column.minWidth);
2165 });
2166 }
2167 // second resize attempt: ignore minReadableWidth but respect minWidth
2168 if (resizeWidth) {
2169 resizeWidth = resizeColumns(resizableColumns, resizeWidth, function (column) { return column.minWidth; });
2170 }
2171 resizeWidth = Math.abs(resizeWidth);
2172 if (!table.settings.horizontalPageBreak &&
2173 resizeWidth > 0.1 / doc.scaleFactor()) {
2174 // Table can't get smaller due to custom-width or minWidth restrictions
2175 // We can't really do much here. Up to user to for example
2176 // reduce font size, increase page size or remove custom cell widths
2177 // to allow more columns to be reduced in size
2178 resizeWidth = resizeWidth < 1 ? resizeWidth : Math.round(resizeWidth);
2179 console.warn("Of the table content, ".concat(resizeWidth, " units width could not fit page"));
2180 }
2181 applyColSpans(table);
2182 fitContent(table, doc);
2183 applyRowSpans(table);
2184}
2185exports.calculateWidths = calculateWidths;
2186function calculate(doc, table) {
2187 var sf = doc.scaleFactor();
2188 var horizontalPageBreak = table.settings.horizontalPageBreak;
2189 var availablePageWidth = (0, common_1.getPageAvailableWidth)(doc, table);
2190 table.allRows().forEach(function (row) {
2191 for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {
2192 var column = _a[_i];
2193 var cell = row.cells[column.index];
2194 if (!cell)
2195 continue;
2196 var hooks = table.hooks.didParseCell;
2197 table.callCellHooks(doc, hooks, cell, row, column, null);
2198 var padding = cell.padding('horizontal');
2199 cell.contentWidth = (0, common_1.getStringWidth)(cell.text, cell.styles, doc) + padding;
2200 // Using [^\S\u00A0] instead of \s ensures that we split the text on all
2201 // whitespace except non-breaking spaces (\u00A0). We need to preserve
2202 // them in the split process to ensure correct word separation and width
2203 // calculation.
2204 var longestWordWidth = (0, common_1.getStringWidth)(cell.text.join(' ').split(/[^\S\u00A0]+/), cell.styles, doc);
2205 cell.minReadableWidth = longestWordWidth + cell.padding('horizontal');
2206 if (typeof cell.styles.cellWidth === 'number') {
2207 cell.minWidth = cell.styles.cellWidth;
2208 cell.wrappedWidth = cell.styles.cellWidth;
2209 }
2210 else if (cell.styles.cellWidth === 'wrap' ||
2211 horizontalPageBreak === true) {
2212 // cell width should not be more than available page width
2213 if (cell.contentWidth > availablePageWidth) {
2214 cell.minWidth = availablePageWidth;
2215 cell.wrappedWidth = availablePageWidth;
2216 }
2217 else {
2218 cell.minWidth = cell.contentWidth;
2219 cell.wrappedWidth = cell.contentWidth;
2220 }
2221 }
2222 else {
2223 // auto
2224 var defaultMinWidth = 10 / sf;
2225 cell.minWidth = cell.styles.minCellWidth || defaultMinWidth;
2226 cell.wrappedWidth = cell.contentWidth;
2227 if (cell.minWidth > cell.wrappedWidth) {
2228 cell.wrappedWidth = cell.minWidth;
2229 }
2230 }
2231 }
2232 });
2233 table.allRows().forEach(function (row) {
2234 for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {
2235 var column = _a[_i];
2236 var cell = row.cells[column.index];
2237 // For now we ignore the minWidth and wrappedWidth of colspan cells when calculating colspan widths.
2238 // Could probably be improved upon however.
2239 if (cell && cell.colSpan === 1) {
2240 column.wrappedWidth = Math.max(column.wrappedWidth, cell.wrappedWidth);
2241 column.minWidth = Math.max(column.minWidth, cell.minWidth);
2242 column.minReadableWidth = Math.max(column.minReadableWidth, cell.minReadableWidth);
2243 }
2244 else {
2245 // Respect cellWidth set in columnStyles even if there is no cells for this column
2246 // or if the column only have colspan cells. Since the width of colspan cells
2247 // does not affect the width of columns, setting columnStyles cellWidth enables the
2248 // user to at least do it manually.
2249 // Note that this is not perfect for now since for example row and table styles are
2250 // not accounted for
2251 var columnStyles = table.styles.columnStyles[column.dataKey] ||
2252 table.styles.columnStyles[column.index] ||
2253 {};
2254 var cellWidth = columnStyles.cellWidth || columnStyles.minCellWidth;
2255 if (cellWidth && typeof cellWidth === 'number') {
2256 column.minWidth = cellWidth;
2257 column.wrappedWidth = cellWidth;
2258 }
2259 }
2260 if (cell) {
2261 // Make sure all columns get at least min width even though width calculations are not based on them
2262 if (cell.colSpan > 1 && !column.minWidth) {
2263 column.minWidth = cell.minWidth;
2264 }
2265 if (cell.colSpan > 1 && !column.wrappedWidth) {
2266 column.wrappedWidth = cell.minWidth;
2267 }
2268 }
2269 }
2270 });
2271}
2272/**
2273 * Distribute resizeWidth on passed resizable columns
2274 */
2275function resizeColumns(columns, resizeWidth, getMinWidth) {
2276 var initialResizeWidth = resizeWidth;
2277 var sumWrappedWidth = columns.reduce(function (acc, column) { return acc + column.wrappedWidth; }, 0);
2278 for (var i = 0; i < columns.length; i++) {
2279 var column = columns[i];
2280 var ratio = column.wrappedWidth / sumWrappedWidth;
2281 var suggestedChange = initialResizeWidth * ratio;
2282 var suggestedWidth = column.width + suggestedChange;
2283 var minWidth = getMinWidth(column);
2284 var newWidth = suggestedWidth < minWidth ? minWidth : suggestedWidth;
2285 resizeWidth -= newWidth - column.width;
2286 column.width = newWidth;
2287 }
2288 resizeWidth = Math.round(resizeWidth * 1e10) / 1e10;
2289 // Run the resizer again if there's remaining width needs
2290 // to be distributed and there're columns that can be resized
2291 if (resizeWidth) {
2292 var resizableColumns = columns.filter(function (column) {
2293 return resizeWidth < 0
2294 ? column.width > getMinWidth(column) // check if column can shrink
2295 : true; // check if column can grow
2296 });
2297 if (resizableColumns.length) {
2298 resizeWidth = resizeColumns(resizableColumns, resizeWidth, getMinWidth);
2299 }
2300 }
2301 return resizeWidth;
2302}
2303exports.resizeColumns = resizeColumns;
2304function applyRowSpans(table) {
2305 var rowSpanCells = {};
2306 var colRowSpansLeft = 1;
2307 var all = table.allRows();
2308 for (var rowIndex = 0; rowIndex < all.length; rowIndex++) {
2309 var row = all[rowIndex];
2310 for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {
2311 var column = _a[_i];
2312 var data = rowSpanCells[column.index];
2313 if (colRowSpansLeft > 1) {
2314 colRowSpansLeft--;
2315 delete row.cells[column.index];
2316 }
2317 else if (data) {
2318 data.cell.height += row.height;
2319 colRowSpansLeft = data.cell.colSpan;
2320 delete row.cells[column.index];
2321 data.left--;
2322 if (data.left <= 1) {
2323 delete rowSpanCells[column.index];
2324 }
2325 }
2326 else {
2327 var cell = row.cells[column.index];
2328 if (!cell) {
2329 continue;
2330 }
2331 cell.height = row.height;
2332 if (cell.rowSpan > 1) {
2333 var remaining = all.length - rowIndex;
2334 var left = cell.rowSpan > remaining ? remaining : cell.rowSpan;
2335 rowSpanCells[column.index] = { cell: cell, left: left, row: row };
2336 }
2337 }
2338 }
2339 }
2340}
2341function applyColSpans(table) {
2342 var all = table.allRows();
2343 for (var rowIndex = 0; rowIndex < all.length; rowIndex++) {
2344 var row = all[rowIndex];
2345 var colSpanCell = null;
2346 var combinedColSpanWidth = 0;
2347 var colSpansLeft = 0;
2348 for (var columnIndex = 0; columnIndex < table.columns.length; columnIndex++) {
2349 var column = table.columns[columnIndex];
2350 // Width and colspan
2351 colSpansLeft -= 1;
2352 if (colSpansLeft > 1 && table.columns[columnIndex + 1]) {
2353 combinedColSpanWidth += column.width;
2354 delete row.cells[column.index];
2355 }
2356 else if (colSpanCell) {
2357 var cell = colSpanCell;
2358 delete row.cells[column.index];
2359 colSpanCell = null;
2360 cell.width = column.width + combinedColSpanWidth;
2361 }
2362 else {
2363 var cell = row.cells[column.index];
2364 if (!cell)
2365 continue;
2366 colSpansLeft = cell.colSpan;
2367 combinedColSpanWidth = 0;
2368 if (cell.colSpan > 1) {
2369 colSpanCell = cell;
2370 combinedColSpanWidth += column.width;
2371 continue;
2372 }
2373 cell.width = column.width + combinedColSpanWidth;
2374 }
2375 }
2376 }
2377}
2378function fitContent(table, doc) {
2379 var rowSpanHeight = { count: 0, height: 0 };
2380 for (var _i = 0, _a = table.allRows(); _i < _a.length; _i++) {
2381 var row = _a[_i];
2382 for (var _b = 0, _c = table.columns; _b < _c.length; _b++) {
2383 var column = _c[_b];
2384 var cell = row.cells[column.index];
2385 if (!cell)
2386 continue;
2387 doc.applyStyles(cell.styles, true);
2388 var textSpace = cell.width - cell.padding('horizontal');
2389 if (cell.styles.overflow === 'linebreak') {
2390 // Add one pt to textSpace to fix rounding error
2391 cell.text = doc.splitTextToSize(cell.text, textSpace + 1 / doc.scaleFactor(), { fontSize: cell.styles.fontSize });
2392 }
2393 else if (cell.styles.overflow === 'ellipsize') {
2394 cell.text = ellipsize(cell.text, textSpace, cell.styles, doc, '...');
2395 }
2396 else if (cell.styles.overflow === 'hidden') {
2397 cell.text = ellipsize(cell.text, textSpace, cell.styles, doc, '');
2398 }
2399 else if (typeof cell.styles.overflow === 'function') {
2400 var result = cell.styles.overflow(cell.text, textSpace);
2401 if (typeof result === 'string') {
2402 cell.text = [result];
2403 }
2404 else {
2405 cell.text = result;
2406 }
2407 }
2408 cell.contentHeight = cell.getContentHeight(doc.scaleFactor(), doc.getLineHeightFactor());
2409 var realContentHeight = cell.contentHeight / cell.rowSpan;
2410 if (cell.rowSpan > 1 &&
2411 rowSpanHeight.count * rowSpanHeight.height <
2412 realContentHeight * cell.rowSpan) {
2413 rowSpanHeight = { height: realContentHeight, count: cell.rowSpan };
2414 }
2415 else if (rowSpanHeight && rowSpanHeight.count > 0) {
2416 if (rowSpanHeight.height > realContentHeight) {
2417 realContentHeight = rowSpanHeight.height;
2418 }
2419 }
2420 if (realContentHeight > row.height) {
2421 row.height = realContentHeight;
2422 }
2423 }
2424 rowSpanHeight.count--;
2425 }
2426}
2427function ellipsize(text, width, styles, doc, overflow) {
2428 return text.map(function (str) { return ellipsizeStr(str, width, styles, doc, overflow); });
2429}
2430exports.ellipsize = ellipsize;
2431function ellipsizeStr(text, width, styles, doc, overflow) {
2432 var precision = 10000 * doc.scaleFactor();
2433 width = Math.ceil(width * precision) / precision;
2434 if (width >= (0, common_1.getStringWidth)(text, styles, doc)) {
2435 return text;
2436 }
2437 while (width < (0, common_1.getStringWidth)(text + overflow, styles, doc)) {
2438 if (text.length <= 1) {
2439 break;
2440 }
2441 text = text.substring(0, text.length - 1);
2442 }
2443 return text.trim() + overflow;
2444}
2445
2446
2447/***/ }),
2448
2449/***/ 964:
2450/***/ (function(module) {
2451
2452if(typeof __WEBPACK_EXTERNAL_MODULE__964__ === 'undefined') { var e = new Error("Cannot find module 'undefined'"); e.code = 'MODULE_NOT_FOUND'; throw e; }
2453
2454module.exports = __WEBPACK_EXTERNAL_MODULE__964__;
2455
2456/***/ })
2457
2458/******/ });
2459/************************************************************************/
2460/******/ // The module cache
2461/******/ var __webpack_module_cache__ = {};
2462/******/
2463/******/ // The require function
2464/******/ function __webpack_require__(moduleId) {
2465/******/ // Check if module is in cache
2466/******/ var cachedModule = __webpack_module_cache__[moduleId];
2467/******/ if (cachedModule !== undefined) {
2468/******/ return cachedModule.exports;
2469/******/ }
2470/******/ // Create a new module (and put it into the cache)
2471/******/ var module = __webpack_module_cache__[moduleId] = {
2472/******/ // no module.id needed
2473/******/ // no module.loaded needed
2474/******/ exports: {}
2475/******/ };
2476/******/
2477/******/ // Execute the module function
2478/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2479/******/
2480/******/ // Return the exports of the module
2481/******/ return module.exports;
2482/******/ }
2483/******/
2484/************************************************************************/
2485var __webpack_exports__ = {};
2486// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
2487!function() {
2488var exports = __webpack_exports__;
2489
2490Object.defineProperty(exports, "__esModule", ({ value: true }));
2491exports.Cell = exports.Column = exports.Row = exports.Table = exports.CellHookData = exports.__drawTable = exports.__createTable = exports.applyPlugin = void 0;
2492var applyPlugin_1 = __webpack_require__(340);
2493var inputParser_1 = __webpack_require__(776);
2494var tableDrawer_1 = __webpack_require__(664);
2495var tableCalculator_1 = __webpack_require__(972);
2496var models_1 = __webpack_require__(260);
2497Object.defineProperty(exports, "Table", ({ enumerable: true, get: function () { return models_1.Table; } }));
2498var HookData_1 = __webpack_require__(172);
2499Object.defineProperty(exports, "CellHookData", ({ enumerable: true, get: function () { return HookData_1.CellHookData; } }));
2500var models_2 = __webpack_require__(260);
2501Object.defineProperty(exports, "Cell", ({ enumerable: true, get: function () { return models_2.Cell; } }));
2502Object.defineProperty(exports, "Column", ({ enumerable: true, get: function () { return models_2.Column; } }));
2503Object.defineProperty(exports, "Row", ({ enumerable: true, get: function () { return models_2.Row; } }));
2504// export { applyPlugin } didn't export applyPlugin
2505// to index.d.ts for some reason
2506function applyPlugin(jsPDF) {
2507 (0, applyPlugin_1.default)(jsPDF);
2508}
2509exports.applyPlugin = applyPlugin;
2510function autoTable(d, options) {
2511 var input = (0, inputParser_1.parseInput)(d, options);
2512 var table = (0, tableCalculator_1.createTable)(d, input);
2513 (0, tableDrawer_1.drawTable)(d, table);
2514}
2515// Experimental export
2516function __createTable(d, options) {
2517 var input = (0, inputParser_1.parseInput)(d, options);
2518 return (0, tableCalculator_1.createTable)(d, input);
2519}
2520exports.__createTable = __createTable;
2521function __drawTable(d, table) {
2522 (0, tableDrawer_1.drawTable)(d, table);
2523}
2524exports.__drawTable = __drawTable;
2525try {
2526 // eslint-disable-next-line @typescript-eslint/no-var-requires
2527 var jsPDF = __webpack_require__(964);
2528 // Webpack imported jspdf instead of jsPDF for some reason
2529 // while it seemed to work everywhere else.
2530 if (jsPDF.jsPDF)
2531 jsPDF = jsPDF.jsPDF;
2532 applyPlugin(jsPDF);
2533}
2534catch (error) {
2535 // Importing jspdf in nodejs environments does not work as of jspdf
2536 // 1.5.3 so we need to silence potential errors to support using for example
2537 // the nodejs jspdf dist files with the exported applyPlugin
2538}
2539exports["default"] = autoTable;
2540
2541}();
2542/******/ return __webpack_exports__;
2543/******/ })()
2544;
2545});
\No newline at end of file