1
1
/*!
2
2
*
3
- * jsPDF AutoTable plugin v4 .0.0
3
+ * jsPDF AutoTable plugin v5 .0.0
4
4
*
5
5
* Copyright (c) 2025 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
6
6
* Licensed under the MIT License.
9
9
*/
10
10
( function webpackUniversalModuleDefinition ( root , factory ) {
11
11
if ( typeof exports === 'object' && typeof module === 'object' )
12
- module . exports = factory ( ( function webpackLoadOptionalExternalModule ( ) { try { return require ( "jspdf" ) ; } catch ( e ) { } } ( ) ) ) ;
12
+ module . exports = factory ( ) ;
13
13
else if ( typeof define === 'function' && define . amd )
14
- define ( [ "jspdf" ] , factory ) ;
14
+ define ( [ ] , factory ) ;
15
15
else {
16
- var a = typeof exports === 'object' ? factory ( ( function webpackLoadOptionalExternalModule ( ) { try { return require ( "jspdf" ) ; } catch ( e ) { } } ( ) ) ) : factory ( root [ "jspdf" ] ) ;
16
+ var a = factory ( ) ;
17
17
for ( var i in a ) ( typeof exports === 'object' ? exports : root ) [ i ] = a [ i ] ;
18
18
}
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 ( ) {
20
20
return /******/ ( function ( ) { // webpackBootstrap
21
21
/******/ "use strict" ;
22
22
/******/ var __webpack_modules__ = ( {
@@ -899,15 +899,6 @@ function cellStyles(sectionName, column, rowIndex, themeName, styles, scaleFacto
899
899
}
900
900
901
901
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
-
911
902
/***/ } ) ,
912
903
913
904
/***/ 460 :
@@ -1417,14 +1408,14 @@ function calculateAllColumnsCanFitInPage(doc, table) {
1417
1408
1418
1409
1419
1410
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
1420
- exports [ "default" ] = default_1 ;
1411
+ exports . applyPlugin = applyPlugin ;
1421
1412
var autoTableText_1 = __webpack_require__ ( 150 ) ;
1422
1413
var documentHandler_1 = __webpack_require__ ( 643 ) ;
1423
1414
var htmlParser_1 = __webpack_require__ ( 660 ) ;
1424
1415
var inputParser_1 = __webpack_require__ ( 371 ) ;
1425
1416
var tableCalculator_1 = __webpack_require__ ( 376 ) ;
1426
1417
var tableDrawer_1 = __webpack_require__ ( 789 ) ;
1427
- function default_1 ( jsPDF ) {
1418
+ function applyPlugin ( jsPDF ) {
1428
1419
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1429
1420
jsPDF . API . autoTable = function ( ) {
1430
1421
var args = [ ] ;
@@ -2299,13 +2290,14 @@ var __webpack_exports__ = {};
2299
2290
! function ( ) {
2300
2291
var exports = __webpack_exports__ ;
2301
2292
2293
+ var _a ;
2302
2294
Object . 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 ;
2305
2296
exports . autoTable = autoTable ;
2306
2297
exports . __createTable = __createTable ;
2307
2298
exports . __drawTable = __drawTable ;
2308
2299
var applyPlugin_1 = __webpack_require__ ( 639 ) ;
2300
+ Object . defineProperty ( exports , "applyPlugin" , ( { enumerable : true , get : function ( ) { return applyPlugin_1 . applyPlugin ; } } ) ) ;
2309
2301
var HookData_1 = __webpack_require__ ( 601 ) ;
2310
2302
Object . defineProperty ( exports , "CellHookData" , ( { enumerable : true , get : function ( ) { return HookData_1 . CellHookData ; } } ) ) ;
2311
2303
var inputParser_1 = __webpack_require__ ( 371 ) ;
@@ -2316,11 +2308,6 @@ Object.defineProperty(exports, "Row", ({ enumerable: true, get: function () { re
2316
2308
Object . defineProperty ( exports , "Table" , ( { enumerable : true , get : function ( ) { return models_1 . Table ; } } ) ) ;
2317
2309
var tableCalculator_1 = __webpack_require__ ( 376 ) ;
2318
2310
var 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
- }
2324
2311
function autoTable ( d , options ) {
2325
2312
var input = ( 0 , inputParser_1 . parseInput ) ( d , options ) ;
2326
2313
var table = ( 0 , tableCalculator_1 . createTable ) ( d , input ) ;
@@ -2335,19 +2322,17 @@ function __drawTable(d, table) {
2335
2322
( 0 , tableDrawer_1 . drawTable ) ( d , table ) ;
2336
2323
}
2337
2324
try {
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
+ }
2346
2333
}
2347
2334
catch ( 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 ) ;
2351
2336
}
2352
2337
exports [ "default" ] = autoTable ;
2353
2338
0 commit comments