1 | (() => {
|
2 | var __webpack_modules__ = ({
|
3 |
|
4 | "./src/index.js":
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
13 |
|
14 | "use strict";
|
15 | __webpack_require__.r(__webpack_exports__);
|
16 | __webpack_require__.d(__webpack_exports__, {
|
17 | "default": () => __WEBPACK_DEFAULT_EXPORT__
|
18 | });
|
19 | var _js_init__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/js/init.js");
|
20 |
|
21 | var objectExporter = _js_init__WEBPACK_IMPORTED_MODULE_0__.default.init;
|
22 |
|
23 | if (typeof window !== 'undefined') {
|
24 | window.objectExporter = objectExporter;
|
25 | }
|
26 |
|
27 | const __WEBPACK_DEFAULT_EXPORT__ = (objectExporter);
|
28 |
|
29 | }),
|
30 |
|
31 | "./src/js/csv.js":
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
40 |
|
41 | "use strict";
|
42 | __webpack_require__.r(__webpack_exports__);
|
43 | __webpack_require__.d(__webpack_exports__, {
|
44 | "default": () => __WEBPACK_DEFAULT_EXPORT__
|
45 | });
|
46 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
47 |
|
48 | const __WEBPACK_DEFAULT_EXPORT__ = ({
|
49 | "export": function _export(params) {
|
50 | exportObject2CSV(params.headers, params.exportable, params.fileName, params.columnSeparator);
|
51 | }
|
52 | });
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | function exportObject2CSV(headers, exportable, fileName, columnSeparator) {
|
62 |
|
63 | if (headers) {
|
64 |
|
65 | if (_typeof(headers[0]) !== 'object') {
|
66 | exportable.unshift(headers);
|
67 | } else {
|
68 | var headerDataset = {};
|
69 |
|
70 | for (var i = 0; i < headers.length; i++) {
|
71 | headerDataset[headers[i].name] = headers[i].alias;
|
72 | }
|
73 |
|
74 | exportable.unshift(headerDataset);
|
75 | }
|
76 | }
|
77 |
|
78 |
|
79 | var jsonObject = JSON.stringify(exportable);
|
80 | var csv = convert2csv(jsonObject, columnSeparator);
|
81 | var exportFileName = fileName + '.csv';
|
82 | var blob = new Blob([csv], {
|
83 | type: 'text/csv;charset=utf-8;'
|
84 | });
|
85 |
|
86 | if (navigator.msSaveBlob) {
|
87 |
|
88 | navigator.msSaveBlob(blob, exportFileName);
|
89 | } else {
|
90 | var link = document.createElement('a');
|
91 |
|
92 | if (link.download !== undefined) {
|
93 |
|
94 | var url = URL.createObjectURL(blob);
|
95 | link.setAttribute('href', url);
|
96 | link.setAttribute('download', exportFileName);
|
97 | link.style.visibility = 'hidden';
|
98 | document.body.appendChild(link);
|
99 | link.click();
|
100 | document.body.removeChild(link);
|
101 | }
|
102 | }
|
103 | }
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | function convert2csv(objArray, columnSeparator) {
|
112 | var array = _typeof(objArray) !== 'object' ? JSON.parse(objArray) : objArray;
|
113 | var str = '';
|
114 |
|
115 | for (var i = 0; i < array.length; i++) {
|
116 | var line = '';
|
117 |
|
118 | for (var index in array[i]) {
|
119 | line += array[i][index] + columnSeparator;
|
120 | }
|
121 |
|
122 | line = line.substring(0, line.length - 1);
|
123 | str += line + '\r\n';
|
124 | }
|
125 |
|
126 | return str;
|
127 | }
|
128 |
|
129 | }),
|
130 |
|
131 | "./src/js/doc.js":
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
140 |
|
141 | "use strict";
|
142 | __webpack_require__.r(__webpack_exports__);
|
143 | __webpack_require__.d(__webpack_exports__, {
|
144 | "default": () => __WEBPACK_DEFAULT_EXPORT__
|
145 | });
|
146 | var file_saver__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./node_modules/file-saver/dist/FileSaver.min.js");
|
147 | var file_saver__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(file_saver__WEBPACK_IMPORTED_MODULE_0__);
|
148 | var _el__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./src/js/el.js");
|
149 |
|
150 |
|
151 | const __WEBPACK_DEFAULT_EXPORT__ = ({
|
152 | "export": function _export(params) {
|
153 | exportObject2Doc(params.headers, params.exportable, params.fileName, params.headerStyle, params.cellStyle, params.repeatHeader);
|
154 | }
|
155 | });
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 | function exportObject2Doc(headers, exportable, fileName, headerStyle, cellStyle, repeatHeader) {
|
167 |
|
168 | var dataset = (0,_el__WEBPACK_IMPORTED_MODULE_1__.htmlTblCreater)('doc', headers, exportable, headerStyle, cellStyle, repeatHeader);
|
169 | var htmlString = '<html><body>' + dataset + '</body></html>';
|
170 |
|
171 | var bytes = new Uint8Array(htmlString.length);
|
172 |
|
173 | for (var i = 0; i < htmlString.length; i++) {
|
174 | bytes[i] = htmlString.charCodeAt(i);
|
175 | }
|
176 |
|
177 |
|
178 | var blob = new Blob([bytes], {
|
179 | type: 'text/html'
|
180 | });
|
181 |
|
182 | (0,file_saver__WEBPACK_IMPORTED_MODULE_0__.saveAs)(blob, fileName + '.doc');
|
183 | }
|
184 |
|
185 | }),
|
186 |
|
187 | "./src/js/el.js":
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
196 |
|
197 | "use strict";
|
198 | __webpack_require__.r(__webpack_exports__);
|
199 | __webpack_require__.d(__webpack_exports__, {
|
200 | "htmlTblCreater": () => htmlTblCreater
|
201 | });
|
202 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
203 |
|
204 | function htmlTblCreater(type, headers, exportable, headerStyle, cellStyle, repeatHeader) {
|
205 |
|
206 | var dataset = '<table style="border-collapse: collapse;" width="100%;">';
|
207 |
|
208 | if (repeatHeader === true) {
|
209 | dataset += '<thead>';
|
210 | }
|
211 |
|
212 |
|
213 | var columnFlex = 0;
|
214 |
|
215 | if (_typeof(headers[0]) !== 'object') {
|
216 |
|
217 | dataset += '<tr>';
|
218 |
|
219 | for (var j = 0; j < headers.length; j++) {
|
220 | dataset += '<th style="' + headerStyle + '" >' + headers[j] + '</th>';
|
221 | }
|
222 |
|
223 | dataset += '</tr>';
|
224 |
|
225 | if (repeatHeader === true) {
|
226 | dataset += '</thead>';
|
227 | }
|
228 |
|
229 |
|
230 | for (var _j = 0; _j < exportable.length; _j++) {
|
231 | dataset += '<tr style="' + cellStyle + '">';
|
232 |
|
233 | var _loop = function _loop(k) {
|
234 |
|
235 | var cellContents = exportable[_j][Object.keys(exportable[_j])[k]];
|
236 |
|
237 | if (/<[a-z][\s\S]*>/i.test(cellContents) === true) {
|
238 | dataset += cellContents;
|
239 | } else {
|
240 | dataset += '<td style="' + cellStyle + '" ' + function () {
|
241 | return type.toLowerCase() === 'csv' ? 'width="' + headers[k].flex / columnFlex * 100 + '%;"' : '';
|
242 | }() + ' >' + cellContents + '</td>';
|
243 | }
|
244 | };
|
245 |
|
246 | for (var k = 0; k < Object.keys(exportable[_j]).length - 1; k++) {
|
247 | _loop(k);
|
248 | }
|
249 |
|
250 | dataset += '</tr>';
|
251 | }
|
252 |
|
253 | dataset += '</table>';
|
254 | } else {
|
255 | var _loop2 = function _loop2(i) {
|
256 |
|
257 | columnFlex += function () {
|
258 | return 'flex' in headers[i] ? headers[i].flex : 1;
|
259 | }();
|
260 | };
|
261 |
|
262 | for (var i = 0; i < headers.length; i++) {
|
263 | _loop2(i);
|
264 | }
|
265 |
|
266 |
|
267 | dataset += '<tr>';
|
268 |
|
269 | for (var _j2 = 0; _j2 < headers.length; _j2++) {
|
270 | dataset += '<th style="' + headerStyle + '" width="' + headers[_j2].flex / columnFlex * 100 + '%;" >' + headers[_j2].alias + '</th>';
|
271 | }
|
272 |
|
273 | dataset += '</tr>';
|
274 |
|
275 | if (repeatHeader === true) {
|
276 | dataset += '</thead>';
|
277 | }
|
278 |
|
279 |
|
280 | for (var _j3 = 0; _j3 < exportable.length; _j3++) {
|
281 | dataset += '<tr style="' + cellStyle + '">';
|
282 |
|
283 | var _loop3 = function _loop3(_k) {
|
284 |
|
285 | var cellContents = exportable[_j3][headers[_k].name];
|
286 |
|
287 | if (/<[a-z][\s\S]*>/i.test(cellContents) === true) {
|
288 | dataset += cellContents;
|
289 | } else {
|
290 | dataset += '<td style="' + cellStyle + '" ' + function () {
|
291 | return type.toLowerCase() === 'csv' ? 'width="' + headers[_k].flex / columnFlex * 100 + '%;"' : '';
|
292 | }() + ' >' + cellContents + '</td>';
|
293 | }
|
294 | };
|
295 |
|
296 | for (var _k = 0; _k < headers.length; _k++) {
|
297 | _loop3(_k);
|
298 | }
|
299 |
|
300 | dataset += '</tr>';
|
301 | }
|
302 | }
|
303 |
|
304 |
|
305 | return dataset;
|
306 | }
|
307 |
|
308 | }),
|
309 |
|
310 | "./src/js/html.js":
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
319 |
|
320 | "use strict";
|
321 | __webpack_require__.r(__webpack_exports__);
|
322 | __webpack_require__.d(__webpack_exports__, {
|
323 | "default": () => __WEBPACK_DEFAULT_EXPORT__
|
324 | });
|
325 | var _placeholder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/js/placeholder.js");
|
326 |
|
327 |
|
328 | var _require = __webpack_require__( "./node_modules/detect-browser/es/index.js"),
|
329 | detect = _require.detect;
|
330 |
|
331 | const __WEBPACK_DEFAULT_EXPORT__ = ({
|
332 | "export": function _export(params) {
|
333 |
|
334 | var browser = detect();
|
335 |
|
336 | var elementDom = document.getElementById(params.exportable);
|
337 |
|
338 | if (typeof elementDom === 'undefined') {
|
339 | throw new Error('There is no DOM object available for the requested id.');
|
340 | }
|
341 |
|
342 |
|
343 | var exportableFrame = _placeholder__WEBPACK_IMPORTED_MODULE_0__.default.generateFrame(params, elementDom.innerHTML);
|
344 |
|
345 | if (document.getElementById('jsObjExporterFrameId')) document.getElementById('jsObjExporterFrameId').remove();
|
346 |
|
347 | document.getElementsByTagName('body')[0].appendChild(exportableFrame);
|
348 |
|
349 | var iframeElement = document.getElementById('jsObjExporterFrameId');
|
350 |
|
351 | exportableFrame.onload = function () {
|
352 |
|
353 | iframeElement.focus();
|
354 |
|
355 | if (browser.name === 'edge' || browser.name === 'ie') {
|
356 | iframeElement.contentWindow.document.execCommand('print', false, null);
|
357 | } else {
|
358 |
|
359 | iframeElement.contentWindow.print();
|
360 | }
|
361 | };
|
362 | }
|
363 | });
|
364 |
|
365 | }),
|
366 |
|
367 | "./src/js/init.js":
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
376 |
|
377 | "use strict";
|
378 | __webpack_require__.r(__webpack_exports__);
|
379 | __webpack_require__.d(__webpack_exports__, {
|
380 | "default": () => __WEBPACK_DEFAULT_EXPORT__
|
381 | });
|
382 | var _csv__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/js/csv.js");
|
383 | var _xls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./src/js/xls.js");
|
384 | var _pdf__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( "./src/js/pdf.js");
|
385 | var _doc__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( "./src/js/doc.js");
|
386 | var _html__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( "./src/js/html.js");
|
387 |
|
388 |
|
389 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 | const __WEBPACK_DEFAULT_EXPORT__ = ({
|
397 | init: function init() {
|
398 | var params = {
|
399 | type: 'object',
|
400 | headers: null,
|
401 | exportable: null,
|
402 | fileName: 'export',
|
403 | headerStyle: 'font-size:16px; font-weight:bold;',
|
404 | cellStyle: 'font-size:14px;',
|
405 | sheetName: 'worksheet',
|
406 | documentTitle: 'test document title',
|
407 | documentTitleStyle: 'color:red;',
|
408 | repeatHeader: true,
|
409 | columnSeparator: ','
|
410 | };
|
411 |
|
412 | var args = arguments[0];
|
413 | if (args === undefined) throw new Error('obj2csv expects at least 1 exportable!');
|
414 |
|
415 | switch (_typeof(args)) {
|
416 | case 'object':
|
417 | params.exportable = args.exportable;
|
418 | params.type = typeof args.type !== 'undefined' ? args.type : params.type;
|
419 | params.headers = typeof args.headers !== 'undefined' ? args.headers : params.headers;
|
420 | params.fileName = typeof args.fileName !== 'undefined' ? args.fileName : params.fileName;
|
421 | params.headerStyle = typeof args.headerStyle !== 'undefined' ? args.headerStyle : params.headerStyle;
|
422 | params.cellStyle = typeof args.cellStyle !== 'undefined' ? args.cellStyle : params.cellStyle;
|
423 | params.sheetName = typeof args.sheetName !== 'undefined' ? args.sheetName : params.sheetName;
|
424 | params.documentTitle = typeof args.documentTitle !== 'undefined' ? args.documentTitle : params.documentTitle;
|
425 | params.documentTitleStyle = typeof args.documentTitleStyle !== 'undefined' ? args.documentTitleStyle : params.documentTitleStyle;
|
426 | params.repeatHeader = typeof args.repeatHeader !== 'undefined' ? args.repeatHeader : params.repeatHeader;
|
427 | params.columnSeparator = typeof args.columnSeparator !== 'undefined' ? args.columnSeparator : params.columnSeparator;
|
428 | break;
|
429 |
|
430 | default:
|
431 | throw new Error('Unexpected argument type! Expected "object", got ' + _typeof(args));
|
432 | }
|
433 |
|
434 |
|
435 | if (!params.exportable) {
|
436 | throw new Error('Invalid exportable!');
|
437 | }
|
438 |
|
439 | if (!params.type || typeof params.type !== 'string') {
|
440 | throw new Error('Invalid exportable type! only string type is acceptable!');
|
441 | }
|
442 |
|
443 | if (['csv', 'xls', 'pdf', 'doc', 'html'].indexOf(params.type.toLowerCase()) === -1) {
|
444 | throw new Error('Invalid exportable type. Available types are "CSV", "XLS", "pdf" and "DOC".');
|
445 | }
|
446 |
|
447 | if (typeof params.repeatHeader !== 'boolean' && typeof params.repeatHeader !== 'undefined') {
|
448 | throw new Error('Invalid value for the repeat header parameter. Available types are "true" and "false".');
|
449 | }
|
450 |
|
451 |
|
452 | switch (params.type) {
|
453 | case 'csv':
|
454 | _csv__WEBPACK_IMPORTED_MODULE_0__.default.export(params);
|
455 | break;
|
456 |
|
457 | case 'xls':
|
458 | _xls__WEBPACK_IMPORTED_MODULE_1__.default.export(params);
|
459 | break;
|
460 |
|
461 | case 'pdf':
|
462 | _pdf__WEBPACK_IMPORTED_MODULE_2__.default.export(params);
|
463 | break;
|
464 |
|
465 | case 'doc':
|
466 | _doc__WEBPACK_IMPORTED_MODULE_3__.default.export(params);
|
467 | break;
|
468 |
|
469 | case 'html':
|
470 | _html__WEBPACK_IMPORTED_MODULE_4__.default.export(params);
|
471 | break;
|
472 | }
|
473 | }
|
474 | });
|
475 |
|
476 | }),
|
477 |
|
478 | "./src/js/pdf.js":
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
487 |
|
488 | "use strict";
|
489 | __webpack_require__.r(__webpack_exports__);
|
490 | __webpack_require__.d(__webpack_exports__, {
|
491 | "default": () => __WEBPACK_DEFAULT_EXPORT__
|
492 | });
|
493 | var _el__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/js/el.js");
|
494 |
|
495 |
|
496 | var _require = __webpack_require__( "./node_modules/detect-browser/es/index.js"),
|
497 | detect = _require.detect;
|
498 |
|
499 | const __WEBPACK_DEFAULT_EXPORT__ = ({
|
500 | "export": function _export(params) {
|
501 | exportObject2PDF(params.documentTitle, params.documentTitleStyle, params.headers, params.exportable, params.headerStyle, params.cellStyle, params.repeatHeader);
|
502 | }
|
503 | });
|
504 |
|
505 | function exportObject2PDF(documentTitle, documentTitleStyle, headers, exportable, headerStyle, cellStyle, repeatHeader) {
|
506 |
|
507 | var printableBody = document.createElement('iframe');
|
508 |
|
509 | printableBody.setAttribute('style', 'visibility: hidden; height: 0; width: 0; position: absolute;');
|
510 | printableBody.setAttribute('id', 'objectExporterPrintableBodyId');
|
511 |
|
512 | printableBody.srcdoc = '<html></html>';
|
513 |
|
514 | document.getElementsByTagName('body')[0].appendChild(printableBody);
|
515 |
|
516 | var printableElements = document.getElementById('objectExporterPrintableBodyId');
|
517 |
|
518 | printableBody.onload = function () {
|
519 |
|
520 | var browser = detect();
|
521 |
|
522 | var printableDocument = printableElements.contentWindow || printableElements.contentDocument;
|
523 |
|
524 | if (printableDocument.document) printableDocument = printableDocument.document;
|
525 | var printableDocumentContents = '<span style="' + documentTitleStyle + '">' + documentTitle + '</span><br>';
|
526 | printableDocumentContents += (0,_el__WEBPACK_IMPORTED_MODULE_0__.htmlTblCreater)('pdf', headers, exportable, headerStyle, cellStyle, repeatHeader);
|
527 | printableDocument.body.innerHTML = printableDocumentContents;
|
528 |
|
529 | var style = document.createElement('style');
|
530 | style.innerHTML = '';
|
531 | printableDocument.head.appendChild(style);
|
532 |
|
533 | printableElements.focus();
|
534 |
|
535 | if (browser.name === 'edge' || browser.name === 'ie') {
|
536 | printableElements.contentWindow.document.execCommand('print', false, null);
|
537 | } else {
|
538 |
|
539 | printableElements.contentWindow.print();
|
540 | }
|
541 | };
|
542 | }
|
543 |
|
544 | }),
|
545 |
|
546 | "./src/js/placeholder.js":
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
555 |
|
556 | "use strict";
|
557 | __webpack_require__.r(__webpack_exports__);
|
558 | __webpack_require__.d(__webpack_exports__, {
|
559 | "default": () => __WEBPACK_DEFAULT_EXPORT__
|
560 | });
|
561 | var placeholder = {
|
562 | |
563 |
|
564 |
|
565 |
|
566 |
|
567 | generateFrame: function generateFrame(params, body) {
|
568 | var printFrame = document.createElement('iframe');
|
569 | printFrame.setAttribute('style', 'visibility: hidden; height: 0; width: 0; position: absolute;');
|
570 | printFrame.setAttribute('id', 'jsObjExporterFrameId');
|
571 | printFrame.srcdoc = '</head><body>' + body + '</body></html>';
|
572 | return printFrame;
|
573 | }
|
574 | };
|
575 |
|
576 | const __WEBPACK_DEFAULT_EXPORT__ = (placeholder);
|
577 |
|
578 | }),
|
579 |
|
580 | "./src/js/xls.js":
|
581 |
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
589 |
|
590 | "use strict";
|
591 | __webpack_require__.r(__webpack_exports__);
|
592 | __webpack_require__.d(__webpack_exports__, {
|
593 | "default": () => __WEBPACK_DEFAULT_EXPORT__
|
594 | });
|
595 | var _el__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/js/el.js");
|
596 |
|
597 |
|
598 | var _require = __webpack_require__( "./node_modules/detect-browser/es/index.js"),
|
599 | detect = _require.detect;
|
600 |
|
601 | const __WEBPACK_DEFAULT_EXPORT__ = ({
|
602 | "export": function _export(params) {
|
603 | exportObject2XLS(params.headers, params.exportable, params.fileName, params.headerStyle, params.cellStyle, params.sheetName, params.documentTitle, params.documentTitleStyle);
|
604 | }
|
605 | });
|
606 |
|
607 | var base64 = function base64(s) {
|
608 | return window.btoa(unescape(encodeURIComponent(s)));
|
609 | };
|
610 |
|
611 | var format = function format(s, c) {
|
612 | return s.replace(/{(\w+)}/g, function (m, p) {
|
613 | return c[p];
|
614 | });
|
615 | };
|
616 |
|
617 | var uri = 'data:application/vnd.ms-excel;base64,';
|
618 | var template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>';
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 | function exportObject2XLS(headers, exportable, fileName, headerStyle, cellStyle, sheetName, documentTitle, documentTitleStyle) {
|
632 |
|
633 | var dataset = '<span style="' + documentTitleStyle + '">' + documentTitle + '</span><br>';
|
634 | dataset += (0,_el__WEBPACK_IMPORTED_MODULE_0__.htmlTblCreater)('xls', headers, exportable, headerStyle, cellStyle, false);
|
635 |
|
636 | var ctx = {
|
637 | worksheet: sheetName,
|
638 | table: dataset
|
639 | };
|
640 | var link = document.createElement('a');
|
641 | var exportFileName = fileName + '.xls';
|
642 | link.setAttribute('href', uri + base64(format(template, ctx)));
|
643 | link.setAttribute('download', exportFileName);
|
644 | link.style.visibility = 'hidden';
|
645 |
|
646 | var browser = detect();
|
647 |
|
648 | if (browser.name === 'edge' || browser.name === 'ie') {
|
649 | if (window.navigator.msSaveBlob) {
|
650 | var blob = new Blob([dataset], {
|
651 | type: 'data:application/vnd.ms-excel;'
|
652 | });
|
653 | navigator.msSaveBlob(blob, exportFileName);
|
654 | }
|
655 | } else {
|
656 |
|
657 | document.body.appendChild(link);
|
658 | link.click();
|
659 | document.body.removeChild(link);
|
660 | }
|
661 | }
|
662 |
|
663 | }),
|
664 |
|
665 | "./node_modules/detect-browser/es/index.js":
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 | ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
683 |
|
684 | "use strict";
|
685 | __webpack_require__.r(__webpack_exports__);
|
686 | __webpack_require__.d(__webpack_exports__, {
|
687 | "BrowserInfo": () => BrowserInfo,
|
688 | "NodeInfo": () => NodeInfo,
|
689 | "SearchBotDeviceInfo": () => SearchBotDeviceInfo,
|
690 | "BotInfo": () => BotInfo,
|
691 | "ReactNativeInfo": () => ReactNativeInfo,
|
692 | "detect": () => detect,
|
693 | "browserName": () => browserName,
|
694 | "parseUserAgent": () => parseUserAgent,
|
695 | "detectOS": () => detectOS,
|
696 | "getNodeVersion": () => getNodeVersion
|
697 | });
|
698 | var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
699 | for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
700 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
701 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
702 | r[k] = a[j];
|
703 | return r;
|
704 | };
|
705 | var BrowserInfo = (function () {
|
706 | function BrowserInfo(name, version, os) {
|
707 | this.name = name;
|
708 | this.version = version;
|
709 | this.os = os;
|
710 | this.type = 'browser';
|
711 | }
|
712 | return BrowserInfo;
|
713 | }());
|
714 |
|
715 | var NodeInfo = (function () {
|
716 | function NodeInfo(version) {
|
717 | this.version = version;
|
718 | this.type = 'node';
|
719 | this.name = 'node';
|
720 | this.os = process.platform;
|
721 | }
|
722 | return NodeInfo;
|
723 | }());
|
724 |
|
725 | var SearchBotDeviceInfo = (function () {
|
726 | function SearchBotDeviceInfo(name, version, os, bot) {
|
727 | this.name = name;
|
728 | this.version = version;
|
729 | this.os = os;
|
730 | this.bot = bot;
|
731 | this.type = 'bot-device';
|
732 | }
|
733 | return SearchBotDeviceInfo;
|
734 | }());
|
735 |
|
736 | var BotInfo = (function () {
|
737 | function BotInfo() {
|
738 | this.type = 'bot';
|
739 | this.bot = true;
|
740 | this.name = 'bot';
|
741 | this.version = null;
|
742 | this.os = null;
|
743 | }
|
744 | return BotInfo;
|
745 | }());
|
746 |
|
747 | var ReactNativeInfo = (function () {
|
748 | function ReactNativeInfo() {
|
749 | this.type = 'react-native';
|
750 | this.name = 'react-native';
|
751 | this.version = null;
|
752 | this.os = null;
|
753 | }
|
754 | return ReactNativeInfo;
|
755 | }());
|
756 |
|
757 |
|
758 | var SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/;
|
759 | var SEARCHBOT_OS_REGEX = /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/;
|
760 | var REQUIRED_VERSION_PARTS = 3;
|
761 | var userAgentRules = [
|
762 | ['aol', /AOLShield\/([0-9\._]+)/],
|
763 | ['edge', /Edge\/([0-9\._]+)/],
|
764 | ['edge-ios', /EdgiOS\/([0-9\._]+)/],
|
765 | ['yandexbrowser', /YaBrowser\/([0-9\._]+)/],
|
766 | ['kakaotalk', /KAKAOTALK\s([0-9\.]+)/],
|
767 | ['samsung', /SamsungBrowser\/([0-9\.]+)/],
|
768 | ['silk', /\bSilk\/([0-9._-]+)\b/],
|
769 | ['miui', /MiuiBrowser\/([0-9\.]+)$/],
|
770 | ['beaker', /BeakerBrowser\/([0-9\.]+)/],
|
771 | ['edge-chromium', /EdgA?\/([0-9\.]+)/],
|
772 | [
|
773 | 'chromium-webview',
|
774 | /(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/,
|
775 | ],
|
776 | ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],
|
777 | ['phantomjs', /PhantomJS\/([0-9\.]+)(:?\s|$)/],
|
778 | ['crios', /CriOS\/([0-9\.]+)(:?\s|$)/],
|
779 | ['firefox', /Firefox\/([0-9\.]+)(?:\s|$)/],
|
780 | ['fxios', /FxiOS\/([0-9\.]+)/],
|
781 | ['opera-mini', /Opera Mini.*Version\/([0-9\.]+)/],
|
782 | ['opera', /Opera\/([0-9\.]+)(?:\s|$)/],
|
783 | ['opera', /OPR\/([0-9\.]+)(:?\s|$)/],
|
784 | ['ie', /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],
|
785 | ['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],
|
786 | ['ie', /MSIE\s(7\.0)/],
|
787 | ['bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/],
|
788 | ['android', /Android\s([0-9\.]+)/],
|
789 | ['ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/],
|
790 | ['safari', /Version\/([0-9\._]+).*Safari/],
|
791 | ['facebook', /FBAV\/([0-9\.]+)/],
|
792 | ['instagram', /Instagram\s([0-9\.]+)/],
|
793 | ['ios-webview', /AppleWebKit\/([0-9\.]+).*Mobile/],
|
794 | ['ios-webview', /AppleWebKit\/([0-9\.]+).*Gecko\)$/],
|
795 | ['searchbot', SEARCHBOX_UA_REGEX],
|
796 | ];
|
797 | var operatingSystemRules = [
|
798 | ['iOS', /iP(hone|od|ad)/],
|
799 | ['Android OS', /Android/],
|
800 | ['BlackBerry OS', /BlackBerry|BB10/],
|
801 | ['Windows Mobile', /IEMobile/],
|
802 | ['Amazon OS', /Kindle/],
|
803 | ['Windows 3.11', /Win16/],
|
804 | ['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/],
|
805 | ['Windows 98', /(Windows 98)|(Win98)/],
|
806 | ['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/],
|
807 | ['Windows XP', /(Windows NT 5.1)|(Windows XP)/],
|
808 | ['Windows Server 2003', /(Windows NT 5.2)/],
|
809 | ['Windows Vista', /(Windows NT 6.0)/],
|
810 | ['Windows 7', /(Windows NT 6.1)/],
|
811 | ['Windows 8', /(Windows NT 6.2)/],
|
812 | ['Windows 8.1', /(Windows NT 6.3)/],
|
813 | ['Windows 10', /(Windows NT 10.0)/],
|
814 | ['Windows ME', /Windows ME/],
|
815 | ['Open BSD', /OpenBSD/],
|
816 | ['Sun OS', /SunOS/],
|
817 | ['Chrome OS', /CrOS/],
|
818 | ['Linux', /(Linux)|(X11)/],
|
819 | ['Mac OS', /(Mac_PowerPC)|(Macintosh)/],
|
820 | ['QNX', /QNX/],
|
821 | ['BeOS', /BeOS/],
|
822 | ['OS/2', /OS\/2/],
|
823 | ];
|
824 | function detect(userAgent) {
|
825 | if (!!userAgent) {
|
826 | return parseUserAgent(userAgent);
|
827 | }
|
828 | if (typeof document === 'undefined' &&
|
829 | typeof navigator !== 'undefined' &&
|
830 | navigator.product === 'ReactNative') {
|
831 | return new ReactNativeInfo();
|
832 | }
|
833 | if (typeof navigator !== 'undefined') {
|
834 | return parseUserAgent(navigator.userAgent);
|
835 | }
|
836 | return getNodeVersion();
|
837 | }
|
838 | function matchUserAgent(ua) {
|
839 |
|
840 |
|
841 |
|
842 |
|
843 | return (ua !== '' &&
|
844 | userAgentRules.reduce(function (matched, _a) {
|
845 | var browser = _a[0], regex = _a[1];
|
846 | if (matched) {
|
847 | return matched;
|
848 | }
|
849 | var uaMatch = regex.exec(ua);
|
850 | return !!uaMatch && [browser, uaMatch];
|
851 | }, false));
|
852 | }
|
853 | function browserName(ua) {
|
854 | var data = matchUserAgent(ua);
|
855 | return data ? data[0] : null;
|
856 | }
|
857 | function parseUserAgent(ua) {
|
858 | var matchedRule = matchUserAgent(ua);
|
859 | if (!matchedRule) {
|
860 | return null;
|
861 | }
|
862 | var name = matchedRule[0], match = matchedRule[1];
|
863 | if (name === 'searchbot') {
|
864 | return new BotInfo();
|
865 | }
|
866 | var versionParts = match[1] && match[1].split(/[._]/).slice(0, 3);
|
867 | if (versionParts) {
|
868 | if (versionParts.length < REQUIRED_VERSION_PARTS) {
|
869 | versionParts = __spreadArrays(versionParts, createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length));
|
870 | }
|
871 | }
|
872 | else {
|
873 | versionParts = [];
|
874 | }
|
875 | var version = versionParts.join('.');
|
876 | var os = detectOS(ua);
|
877 | var searchBotMatch = SEARCHBOT_OS_REGEX.exec(ua);
|
878 | if (searchBotMatch && searchBotMatch[1]) {
|
879 | return new SearchBotDeviceInfo(name, version, os, searchBotMatch[1]);
|
880 | }
|
881 | return new BrowserInfo(name, version, os);
|
882 | }
|
883 | function detectOS(ua) {
|
884 | for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) {
|
885 | var _a = operatingSystemRules[ii], os = _a[0], regex = _a[1];
|
886 | var match = regex.exec(ua);
|
887 | if (match) {
|
888 | return os;
|
889 | }
|
890 | }
|
891 | return null;
|
892 | }
|
893 | function getNodeVersion() {
|
894 | var isNode = typeof process !== 'undefined' && process.version;
|
895 | return isNode ? new NodeInfo(process.version.slice(1)) : null;
|
896 | }
|
897 | function createVersionParts(count) {
|
898 | var output = [];
|
899 | for (var ii = 0; ii < count; ii++) {
|
900 | output.push('0');
|
901 | }
|
902 | return output;
|
903 | }
|
904 |
|
905 |
|
906 | }),
|
907 |
|
908 | "./node_modules/file-saver/dist/FileSaver.min.js":
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 | (function(module, exports, __webpack_require__) {
|
917 |
|
918 | var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(a,b){if(true)!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (b),
|
919 | __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
920 | (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
921 | __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}})(this,function(){"use strict";function b(a,b){return"undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(b,c,d){var e=new XMLHttpRequest;e.open("GET",b),e.responseType="blob",e.onload=function(){a(e.response,c,d)},e.onerror=function(){console.error("could not download file")},e.send()}function d(a){var b=new XMLHttpRequest;b.open("HEAD",a,!1);try{b.send()}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof __webpack_require__.g&&__webpack_require__.g.global===__webpack_require__.g?__webpack_require__.g:void 0,a=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4E4),setTimeout(function(){e(j)},0))}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else{var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i)})}}:function(a,b,d,e){if(e=e||open("","_blank"),e&&(e.document.title=e.document.body.innerText="downloading..."),"string"==typeof a)return c(a,b,d);var g="application/octet-stream"===a.type,h=/constructor/i.test(f.HTMLElement)||f.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent);if((i||g&&h)&&"object"==typeof FileReader){var j=new FileReader;j.onloadend=function(){var a=j.result;a=i?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),e?e.location.href=a:location=a,e=null},j.readAsDataURL(a)}else{var k=f.URL||f.webkitURL,l=k.createObjectURL(a);e?e.location=l:location.href=l,e=null,setTimeout(function(){k.revokeObjectURL(l)},4E4)}});f.saveAs=a.saveAs=a, true&&(module.exports=a)});
|
922 |
|
923 |
|
924 |
|
925 | })
|
926 |
|
927 | });
|
928 |
|
929 |
|
930 | var __webpack_module_cache__ = {};
|
931 |
|
932 |
|
933 | function __webpack_require__(moduleId) {
|
934 |
|
935 | if(__webpack_module_cache__[moduleId]) {
|
936 | return __webpack_module_cache__[moduleId].exports;
|
937 | }
|
938 |
|
939 | var module = __webpack_module_cache__[moduleId] = {
|
940 |
|
941 |
|
942 | exports: {}
|
943 | };
|
944 |
|
945 |
|
946 | __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
947 |
|
948 |
|
949 | return module.exports;
|
950 | }
|
951 |
|
952 |
|
953 |
|
954 | (() => {
|
955 |
|
956 | __webpack_require__.n = (module) => {
|
957 | var getter = module && module.__esModule ?
|
958 | () => module['default'] :
|
959 | () => module;
|
960 | __webpack_require__.d(getter, { a: getter });
|
961 | return getter;
|
962 | };
|
963 | })();
|
964 |
|
965 |
|
966 | (() => {
|
967 |
|
968 | __webpack_require__.d = (exports, definition) => {
|
969 | for(var key in definition) {
|
970 | if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
971 | Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
972 | }
|
973 | }
|
974 | };
|
975 | })();
|
976 |
|
977 |
|
978 | (() => {
|
979 | __webpack_require__.g = (function() {
|
980 | if (typeof globalThis === 'object') return globalThis;
|
981 | try {
|
982 | return this || new Function('return this')();
|
983 | } catch (e) {
|
984 | if (typeof window === 'object') return window;
|
985 | }
|
986 | })();
|
987 | })();
|
988 |
|
989 |
|
990 | (() => {
|
991 | __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
|
992 | })();
|
993 |
|
994 |
|
995 | (() => {
|
996 |
|
997 | __webpack_require__.r = (exports) => {
|
998 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
999 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
1000 | }
|
1001 | Object.defineProperty(exports, '__esModule', { value: true });
|
1002 | };
|
1003 | })();
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 | __webpack_require__("./src/index.js");
|
1009 |
|
1010 | })()
|
1011 | ;
|
1012 |
|
\ | No newline at end of file |