11/*!
22 *
3- * jsPDF AutoTable plugin v4 .0.0
3+ * jsPDF AutoTable plugin v5 .0.0
44 *
55 * Copyright (c) 2025 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
66 * Licensed under the MIT License.
99 */
1010( function webpackUniversalModuleDefinition ( root , factory ) {
1111 if ( typeof exports === 'object' && typeof module === 'object' )
12- module . exports = factory ( ( function webpackLoadOptionalExternalModule ( ) { try { return require ( "jspdf" ) ; } catch ( e ) { } } ( ) ) ) ;
12+ module . exports = factory ( ) ;
1313 else if ( typeof define === 'function' && define . amd )
14- define ( [ "jspdf" ] , factory ) ;
14+ define ( [ ] , factory ) ;
1515 else {
16- var a = typeof exports === 'object' ? factory ( ( function webpackLoadOptionalExternalModule ( ) { try { return require ( "jspdf" ) ; } catch ( e ) { } } ( ) ) ) : factory ( root [ "jspdf" ] ) ;
16+ var a = factory ( ) ;
1717 for ( var i in a ) ( typeof exports === 'object' ? exports : root ) [ i ] = a [ i ] ;
1818 }
19- } ) ( typeof globalThis !== 'undefined' ? globalThis : typeof this !== 'undefined' ? this : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : global , function ( __WEBPACK_EXTERNAL_MODULE__396__ ) {
19+ } ) ( typeof globalThis !== 'undefined' ? globalThis : typeof this !== 'undefined' ? this : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : global , function ( ) {
2020return /******/ ( function ( ) { // webpackBootstrap
2121/******/ "use strict" ;
2222/******/ var __webpack_modules__ = ( {
@@ -899,15 +899,6 @@ function cellStyles(sectionName, column, rowIndex, themeName, styles, scaleFacto
899899}
900900
901901
902- /***/ } ) ,
903-
904- /***/ 396 :
905- /***/ ( function ( module ) {
906-
907- if ( typeof __WEBPACK_EXTERNAL_MODULE__396__ === 'undefined' ) { var e = new Error ( "Cannot find module 'undefined'" ) ; e . code = 'MODULE_NOT_FOUND' ; throw e ; }
908-
909- module . exports = __WEBPACK_EXTERNAL_MODULE__396__ ;
910-
911902/***/ } ) ,
912903
913904/***/ 460 :
@@ -1417,14 +1408,14 @@ function calculateAllColumnsCanFitInPage(doc, table) {
14171408
14181409
14191410Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
1420- exports [ "default" ] = default_1 ;
1411+ exports . applyPlugin = applyPlugin ;
14211412var autoTableText_1 = __webpack_require__ ( 150 ) ;
14221413var documentHandler_1 = __webpack_require__ ( 643 ) ;
14231414var htmlParser_1 = __webpack_require__ ( 660 ) ;
14241415var inputParser_1 = __webpack_require__ ( 371 ) ;
14251416var tableCalculator_1 = __webpack_require__ ( 376 ) ;
14261417var tableDrawer_1 = __webpack_require__ ( 789 ) ;
1427- function default_1 ( jsPDF ) {
1418+ function applyPlugin ( jsPDF ) {
14281419 // eslint-disable-next-line @typescript-eslint/no-explicit-any
14291420 jsPDF . API . autoTable = function ( ) {
14301421 var args = [ ] ;
@@ -2299,13 +2290,14 @@ var __webpack_exports__ = {};
22992290! function ( ) {
23002291var exports = __webpack_exports__ ;
23012292
2293+ var _a ;
23022294Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
2303- exports . Table = exports . Row = exports . Column = exports . CellHookData = exports . Cell = void 0 ;
2304- exports . applyPlugin = applyPlugin ;
2295+ exports . Table = exports . Row = exports . Column = exports . CellHookData = exports . Cell = exports . applyPlugin = void 0 ;
23052296exports . autoTable = autoTable ;
23062297exports . __createTable = __createTable ;
23072298exports . __drawTable = __drawTable ;
23082299var applyPlugin_1 = __webpack_require__ ( 639 ) ;
2300+ Object . defineProperty ( exports , "applyPlugin" , ( { enumerable : true , get : function ( ) { return applyPlugin_1 . applyPlugin ; } } ) ) ;
23092301var HookData_1 = __webpack_require__ ( 601 ) ;
23102302Object . defineProperty ( exports , "CellHookData" , ( { enumerable : true , get : function ( ) { return HookData_1 . CellHookData ; } } ) ) ;
23112303var inputParser_1 = __webpack_require__ ( 371 ) ;
@@ -2316,11 +2308,6 @@ Object.defineProperty(exports, "Row", ({ enumerable: true, get: function () { re
23162308Object . defineProperty ( exports , "Table" , ( { enumerable : true , get : function ( ) { return models_1 . Table ; } } ) ) ;
23172309var tableCalculator_1 = __webpack_require__ ( 376 ) ;
23182310var tableDrawer_1 = __webpack_require__ ( 789 ) ;
2319- // export { applyPlugin } didn't export applyPlugin
2320- // to index.d.ts for some reason
2321- function applyPlugin ( jsPDF ) {
2322- ( 0 , applyPlugin_1 . default ) ( jsPDF ) ;
2323- }
23242311function autoTable ( d , options ) {
23252312 var input = ( 0 , inputParser_1 . parseInput ) ( d , options ) ;
23262313 var table = ( 0 , tableCalculator_1 . createTable ) ( d , input ) ;
@@ -2335,19 +2322,17 @@ function __drawTable(d, table) {
23352322 ( 0 , tableDrawer_1 . drawTable ) ( d , table ) ;
23362323}
23372324try {
2338- // eslint-disable-next-line @typescript-eslint/no-require-imports
2339- var jsPDF = __webpack_require__ ( 396 ) ;
2340- // Webpack imported jspdf instead of jsPDF for some reason
2341- // while it seemed to work everywhere else.
2342- if ( jsPDF . jsPDF )
2343- jsPDF = jsPDF . jsPDF ;
2344- applyPlugin ( jsPDF ) ;
2345- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2325+ if ( typeof window !== 'undefined' && window ) {
2326+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2327+ var anyWindow = window ;
2328+ var jsPDF = anyWindow . jsPDF || ( ( _a = anyWindow . jspdf ) === null || _a === void 0 ? void 0 : _a . jsPDF ) ;
2329+ if ( jsPDF ) {
2330+ ( 0 , applyPlugin_1 . applyPlugin ) ( jsPDF ) ;
2331+ }
2332+ }
23462333}
23472334catch ( error ) {
2348- // Importing jspdf in nodejs environments does not work as of jspdf
2349- // 1.5.3 so we need to silence potential errors to support using for example
2350- // the nodejs jspdf dist files with the exported applyPlugin
2335+ console . error ( 'Could not apply autoTable plugin' , error ) ;
23512336}
23522337exports [ "default" ] = autoTable ;
23532338
0 commit comments