ngx-print 20.1.0-beta.4 → 20.1.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,502 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, CSP_NONCE, Injectable, output, HostListener, Input, Directive, NgModule } from '@angular/core';
3
+ import { Subject, take } from 'rxjs';
4
+
5
+ class PrintBase {
6
+ nonce = inject(CSP_NONCE, { optional: true });
7
+ _printStyle = [];
8
+ _styleSheetFile = '';
9
+ printComplete = new Subject();
10
+ //#region Getters and Setters
11
+ /**
12
+ * Sets the print styles based on the provided values.
13
+ *
14
+ * @param {Object} values - Key-value pairs representing print styles.
15
+ * @protected
16
+ */
17
+ setPrintStyle(values) {
18
+ this._printStyle = [];
19
+ for (const key in values) {
20
+ if (Object.prototype.hasOwnProperty.call(values, key)) {
21
+ this._printStyle.push((key + JSON.stringify(values[key])).replace(/['"]+/g, ''));
22
+ }
23
+ }
24
+ }
25
+ /**
26
+ *
27
+ *
28
+ * @returns the string that create the stylesheet which will be injected
29
+ * later within <style></style> tag.
30
+ *
31
+ * -join/replace to transform an array objects to css-styled string
32
+ */
33
+ returnStyleValues() {
34
+ const styleNonce = this.nonce ? ` nonce="${this.nonce}"` : '';
35
+ return `<style${styleNonce}> ${this._printStyle.join(' ').replace(/,/g, ';')} </style>`;
36
+ }
37
+ /**
38
+ * @returns string which contains the link tags containing the css which will
39
+ * be injected later within <head></head> tag.
40
+ *
41
+ */
42
+ returnStyleSheetLinkTags() {
43
+ return this._styleSheetFile;
44
+ }
45
+ /**
46
+ * Sets the style sheet file based on the provided CSS list.
47
+ *
48
+ * @param {string} cssList - CSS file or list of CSS files.
49
+ * @protected
50
+ */
51
+ setStyleSheetFile(cssList) {
52
+ const linkTagFn = function (cssFileName) {
53
+ return `<link rel="stylesheet" type="text/css" href="${cssFileName}">`;
54
+ };
55
+ if (cssList.indexOf(',') !== -1) {
56
+ const valueArr = cssList.split(',');
57
+ this._styleSheetFile = valueArr.map(val => linkTagFn(val)).join('');
58
+ }
59
+ else {
60
+ this._styleSheetFile = linkTagFn(cssList);
61
+ }
62
+ }
63
+ //#endregion
64
+ //#region Private methods used by PrintBase
65
+ /**
66
+ * Updates the default values for input elements.
67
+ *
68
+ * @param {HTMLCollectionOf<HTMLInputElement>} elements - Collection of input elements.
69
+ * @private
70
+ */
71
+ updateInputDefaults(elements) {
72
+ for (let i = 0; i < elements.length; i++) {
73
+ const element = elements[i];
74
+ element['defaultValue'] = element.value;
75
+ if (element['checked'])
76
+ element['defaultChecked'] = true;
77
+ }
78
+ }
79
+ /**
80
+ * Updates the default values for select elements.
81
+ *
82
+ * @param {HTMLCollectionOf<HTMLSelectElement>} elements - Collection of select elements.
83
+ * @private
84
+ */
85
+ updateSelectDefaults(elements) {
86
+ for (let i = 0; i < elements.length; i++) {
87
+ const element = elements[i];
88
+ const selectedIdx = element.selectedIndex;
89
+ const selectedOption = element.options[selectedIdx];
90
+ selectedOption.defaultSelected = true;
91
+ }
92
+ }
93
+ /**
94
+ * Updates the default values for textarea elements.
95
+ *
96
+ * @param {HTMLCollectionOf<HTMLTextAreaElement>} elements - Collection of textarea elements.
97
+ * @private
98
+ */
99
+ updateTextAreaDefaults(elements) {
100
+ for (let i = 0; i < elements.length; i++) {
101
+ const element = elements[i];
102
+ element['defaultValue'] = element.value;
103
+ }
104
+ }
105
+ /**
106
+ * Converts a canvas element to an image and returns its HTML string.
107
+ *
108
+ * @param {HTMLCanvasElement} element - The canvas element to convert.
109
+ * @returns {string} - HTML string of the image.
110
+ * @private
111
+ */
112
+ canvasToImageHtml(element) {
113
+ const dataUrl = element.toDataURL();
114
+ return `<img src="${dataUrl}" style="max-width: 100%;">`;
115
+ }
116
+ /**
117
+ * Includes canvas contents in the print section via img tags.
118
+ *
119
+ * @param {HTMLCollectionOf<HTMLCanvasElement>} elements - Collection of canvas elements.
120
+ * @private
121
+ */
122
+ updateCanvasToImage(elements) {
123
+ for (let i = 0; i < elements.length; i++) {
124
+ const element = this.canvasToImageHtml(elements[i]);
125
+ elements[i].insertAdjacentHTML('afterend', element);
126
+ elements[i].remove();
127
+ }
128
+ }
129
+ /**
130
+ * Retrieves the HTML content of a specified printing section.
131
+ *
132
+ * @param {string} printSectionId - Id of the printing section.
133
+ * @returns {string | null} - HTML content of the printing section, or null if not found.
134
+ * @private
135
+ */
136
+ getHtmlContents(printSectionId) {
137
+ const printContents = document.getElementById(printSectionId);
138
+ if (!printContents)
139
+ return null;
140
+ const inputEls = printContents.getElementsByTagName('input');
141
+ const selectEls = printContents.getElementsByTagName('select');
142
+ const textAreaEls = printContents.getElementsByTagName('textarea');
143
+ const canvasEls = printContents.getElementsByTagName('canvas');
144
+ this.updateInputDefaults(inputEls);
145
+ this.updateSelectDefaults(selectEls);
146
+ this.updateTextAreaDefaults(textAreaEls);
147
+ this.updateCanvasToImage(canvasEls);
148
+ return printContents.innerHTML;
149
+ }
150
+ /**
151
+ * Retrieves the HTML content of elements with the specified tag.
152
+ *
153
+ * @param {keyof HTMLElementTagNameMap} tag - HTML tag name.
154
+ * @returns {string} - Concatenated outerHTML of elements with the specified tag.
155
+ * @private
156
+ */
157
+ getElementTag(tag) {
158
+ const html = [];
159
+ const elements = document.getElementsByTagName(tag);
160
+ for (let index = 0; index < elements.length; index++) {
161
+ html.push(elements[index].outerHTML);
162
+ }
163
+ return html.join('\r\n');
164
+ }
165
+ //#endregion
166
+ notifyPrintComplete() {
167
+ this.printComplete.next();
168
+ }
169
+ /**
170
+ * Prints the specified content using the provided print options.
171
+ *
172
+ * @param {PrintOptions} printOptions - Options for printing.
173
+ * @public
174
+ */
175
+ print(printOptions) {
176
+ let styles = '', links = '', popOut = 'top=0,left=0,height=auto,width=auto';
177
+ const baseTag = this.getElementTag('base');
178
+ if (printOptions.useExistingCss) {
179
+ styles = this.getElementTag('style');
180
+ links = this.getElementTag('link');
181
+ }
182
+ // If the openNewTab option is set to true, then set the popOut option to an empty string.
183
+ // This will cause the print dialog to open in a new tab.
184
+ if (printOptions.openNewTab) {
185
+ popOut = '';
186
+ }
187
+ const printContents = this.getHtmlContents(printOptions.printSectionId);
188
+ if (!printContents) {
189
+ // Handle the case where the specified print section is not found.
190
+ console.error(`Print section with id ${printOptions.printSectionId} not found.`);
191
+ return;
192
+ }
193
+ const popupWin = window.open('', '_blank', popOut);
194
+ if (!popupWin) {
195
+ // the popup window could not be opened.
196
+ console.error('Could not open print window.');
197
+ return;
198
+ }
199
+ popupWin.document.open();
200
+ // Create the HTML structure
201
+ const doc = popupWin.document;
202
+ // Set up the basic HTML structure
203
+ const html = doc.createElement('html');
204
+ const head = doc.createElement('head');
205
+ const body = doc.createElement('body');
206
+ // Set title
207
+ const title = doc.createElement('title');
208
+ title.textContent = printOptions.printTitle || '';
209
+ head.appendChild(title);
210
+ // Add base tag, styles, and links
211
+ if (baseTag) {
212
+ head.innerHTML += baseTag;
213
+ }
214
+ head.innerHTML += this.returnStyleValues();
215
+ head.innerHTML += this.returnStyleSheetLinkTags();
216
+ head.innerHTML += styles;
217
+ head.innerHTML += links;
218
+ // Set body class if provided
219
+ if (printOptions.bodyClass) {
220
+ body.className = printOptions.bodyClass;
221
+ }
222
+ // Insert print contents
223
+ body.innerHTML += printContents;
224
+ // Assemble the document
225
+ html.appendChild(head);
226
+ html.appendChild(body);
227
+ doc.appendChild(html);
228
+ popupWin.document.close();
229
+ // Listen for the print-complete message
230
+ const handleMessage = (event) => {
231
+ if (event.data?.type === 'print-complete') {
232
+ this.notifyPrintComplete();
233
+ window.removeEventListener('message', handleMessage);
234
+ }
235
+ };
236
+ window.addEventListener('message', handleMessage);
237
+ // Post the print options to the new window after it loads
238
+ popupWin.addEventListener('load', () => {
239
+ if (popupWin.initPrintWindow) {
240
+ popupWin.initPrintWindow(popupWin, printOptions);
241
+ }
242
+ else {
243
+ popupWin.postMessage({ type: 'init-print', options: printOptions }, '*');
244
+ }
245
+ });
246
+ }
247
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: PrintBase, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
248
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: PrintBase, providedIn: 'root' });
249
+ }
250
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: PrintBase, decorators: [{
251
+ type: Injectable,
252
+ args: [{
253
+ providedIn: 'root',
254
+ }]
255
+ }] });
256
+
257
+ class PrintOptions {
258
+ printSectionId = '';
259
+ printTitle = '';
260
+ useExistingCss = false;
261
+ bodyClass = '';
262
+ openNewTab = false;
263
+ previewOnly = false;
264
+ closeWindow = true;
265
+ printDelay = 0;
266
+ constructor(options) {
267
+ if (options) {
268
+ Object.assign(this, options);
269
+ }
270
+ }
271
+ }
272
+
273
+ class NgxPrintDirective extends PrintBase {
274
+ printOptions = new PrintOptions();
275
+ /**
276
+ * Prevents the print dialog from opening on the window
277
+ *
278
+ * @memberof NgxPrintDirective
279
+ */
280
+ set previewOnly(value) {
281
+ this.printOptions = { ...this.printOptions, previewOnly: value };
282
+ }
283
+ /**
284
+ *
285
+ *
286
+ * @memberof NgxPrintDirective
287
+ */
288
+ set printSectionId(value) {
289
+ this.printOptions = { ...this.printOptions, printSectionId: value };
290
+ }
291
+ /**
292
+ *
293
+ *
294
+ * @memberof NgxPrintDirective
295
+ */
296
+ set printTitle(value) {
297
+ this.printOptions = { ...this.printOptions, printTitle: value };
298
+ }
299
+ /**
300
+ *
301
+ *
302
+ * @memberof NgxPrintDirective
303
+ */
304
+ set useExistingCss(value) {
305
+ this.printOptions = { ...this.printOptions, useExistingCss: value };
306
+ }
307
+ /**
308
+ * A delay in milliseconds to force the print dialog to wait before opened. Default: 0
309
+ *
310
+ * @memberof NgxPrintDirective
311
+ */
312
+ set printDelay(value) {
313
+ this.printOptions = { ...this.printOptions, printDelay: value };
314
+ }
315
+ /**
316
+ * Whether to close the window after print() returns.
317
+ *
318
+ */
319
+ set closeWindow(value) {
320
+ this.printOptions = { ...this.printOptions, closeWindow: value };
321
+ }
322
+ /**
323
+ * Class attribute to apply to the body element.
324
+ *
325
+ */
326
+ set bodyClass(value) {
327
+ this.printOptions = { ...this.printOptions, bodyClass: value };
328
+ }
329
+ /**
330
+ * Whether to open a new window or default to new window.
331
+ *
332
+ */
333
+ set openNewTab(value) {
334
+ this.printOptions = { ...this.printOptions, openNewTab: value };
335
+ }
336
+ /**
337
+ *
338
+ *
339
+ * @memberof NgxPrintDirective
340
+ */
341
+ set printStyle(values) {
342
+ super.setPrintStyle(values);
343
+ }
344
+ /**
345
+ * @memberof NgxPrintDirective
346
+ * @param cssList
347
+ */
348
+ set styleSheetFile(cssList) {
349
+ super.setStyleSheetFile(cssList);
350
+ }
351
+ /**
352
+ *
353
+ *
354
+ * @memberof NgxPrintDirective
355
+ */
356
+ print() {
357
+ super.print(this.printOptions);
358
+ this.printComplete.pipe(take(1)).subscribe(() => {
359
+ this.printCompleted.emit(undefined);
360
+ });
361
+ }
362
+ printCompleted = output();
363
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NgxPrintDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
364
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.3", type: NgxPrintDirective, isStandalone: true, selector: "[ngxPrint]", inputs: { previewOnly: "previewOnly", printSectionId: "printSectionId", printTitle: "printTitle", useExistingCss: "useExistingCss", printDelay: "printDelay", closeWindow: "closeWindow", bodyClass: "bodyClass", openNewTab: "openNewTab", printStyle: "printStyle", styleSheetFile: "styleSheetFile" }, outputs: { printCompleted: "printCompleted" }, host: { listeners: { "click": "print()" } }, usesInheritance: true, ngImport: i0 });
365
+ }
366
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NgxPrintDirective, decorators: [{
367
+ type: Directive,
368
+ args: [{
369
+ selector: '[ngxPrint]',
370
+ standalone: true,
371
+ }]
372
+ }], propDecorators: { previewOnly: [{
373
+ type: Input
374
+ }], printSectionId: [{
375
+ type: Input
376
+ }], printTitle: [{
377
+ type: Input
378
+ }], useExistingCss: [{
379
+ type: Input
380
+ }], printDelay: [{
381
+ type: Input
382
+ }], closeWindow: [{
383
+ type: Input
384
+ }], bodyClass: [{
385
+ type: Input
386
+ }], openNewTab: [{
387
+ type: Input
388
+ }], printStyle: [{
389
+ type: Input
390
+ }], styleSheetFile: [{
391
+ type: Input
392
+ }], print: [{
393
+ type: HostListener,
394
+ args: ['click']
395
+ }] } });
396
+
397
+ class NgxPrintModule {
398
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NgxPrintModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
399
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.3", ngImport: i0, type: NgxPrintModule, imports: [NgxPrintDirective], exports: [NgxPrintDirective] });
400
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NgxPrintModule });
401
+ }
402
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NgxPrintModule, decorators: [{
403
+ type: NgModule,
404
+ args: [{
405
+ imports: [NgxPrintDirective],
406
+ exports: [NgxPrintDirective],
407
+ }]
408
+ }] });
409
+
410
+ /**
411
+ * Service for handling printing functionality in Angular applications.
412
+ * Extends the base printing class (PrintBase).
413
+ *
414
+ * @export
415
+ * @class NgxPrintService
416
+ * @extends {PrintBase}
417
+ */
418
+ class NgxPrintService extends PrintBase {
419
+ printComplete$ = this.printComplete.asObservable();
420
+ /**
421
+ * Initiates the printing process using the provided print options.
422
+ *
423
+ * @param {PrintOptions} printOptions - Options for configuring the printing process.
424
+ * @memberof NgxPrintService
425
+ * @returns {void}
426
+ */
427
+ print(printOptions) {
428
+ // Call the print method in the parent class
429
+ super.print(printOptions);
430
+ }
431
+ /**
432
+ * Sets the print style for the printing process.
433
+ *
434
+ * @param {{ [key: string]: { [key: string]: string } }} values - A dictionary representing the print styles.
435
+ * @memberof NgxPrintService
436
+ * @setter
437
+ */
438
+ set printStyle(values) {
439
+ super.setPrintStyle(values);
440
+ }
441
+ /**
442
+ * Sets the stylesheet file for the printing process.
443
+ *
444
+ * @param {string} cssList - A string representing the path to the stylesheet file.
445
+ * @memberof NgxPrintService
446
+ * @setter
447
+ */
448
+ set styleSheetFile(cssList) {
449
+ super.setStyleSheetFile(cssList);
450
+ }
451
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NgxPrintService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
452
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NgxPrintService, providedIn: 'root' });
453
+ }
454
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NgxPrintService, decorators: [{
455
+ type: Injectable,
456
+ args: [{
457
+ providedIn: 'root',
458
+ }]
459
+ }] });
460
+
461
+ function initPrintWindow(windowRef, printOptions) {
462
+ function triggerPrint() {
463
+ windowRef.removeEventListener('load', triggerPrint, false);
464
+ if (!printOptions.previewOnly) {
465
+ setTimeout(() => {
466
+ windowRef.print();
467
+ if (printOptions.closeWindow)
468
+ windowRef.close();
469
+ }, printOptions.printDelay || 0);
470
+ }
471
+ }
472
+ function afterPrint() {
473
+ if (windowRef.opener) {
474
+ windowRef.opener.postMessage({ type: 'print-complete' }, '*');
475
+ }
476
+ if (printOptions.closeWindow)
477
+ windowRef.close();
478
+ }
479
+ windowRef.addEventListener('load', triggerPrint, false);
480
+ windowRef.addEventListener('afterprint', afterPrint, { once: true });
481
+ }
482
+
483
+ /*
484
+ * Public API Surface of ngx-print
485
+ */
486
+ // Expose globally for popup windows
487
+ if (!window.initPrintWindow) {
488
+ window.initPrintWindow = initPrintWindow;
489
+ }
490
+ // listen for postMessage from child window
491
+ window.addEventListener('message', (event) => {
492
+ if (event.data?.type === 'init-print') {
493
+ initPrintWindow(window, event.data.options);
494
+ }
495
+ });
496
+
497
+ /**
498
+ * Generated bundle index. Do not edit.
499
+ */
500
+
501
+ export { NgxPrintDirective, NgxPrintModule, NgxPrintService, PrintOptions };
502
+ //# sourceMappingURL=ngx-print.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-print.mjs","sources":["../../../src/lib/ngx-print.base.ts","../../../src/lib/print-options.ts","../../../src/lib/ngx-print.directive.ts","../../../src/lib/ngx-print.module.ts","../../../src/lib/ngx-print.service.ts","../../../src/lib/print-helper.ts","../../../src/public_api.ts","../../../src/ngx-print.ts"],"sourcesContent":["import { CSP_NONCE, Injectable, inject } from '@angular/core';\r\nimport { Subject } from 'rxjs';\r\nimport { PrintOptions } from './print-options';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class PrintBase {\r\n private nonce = inject(CSP_NONCE, { optional: true });\r\n\r\n private _printStyle: string[] = [];\r\n private _styleSheetFile: string = '';\r\n protected printComplete = new Subject<void>();\r\n\r\n //#region Getters and Setters\r\n /**\r\n * Sets the print styles based on the provided values.\r\n *\r\n * @param {Object} values - Key-value pairs representing print styles.\r\n * @protected\r\n */\r\n protected setPrintStyle(values: { [key: string]: { [key: string]: string } }) {\r\n this._printStyle = [];\r\n for (const key in values) {\r\n if (Object.prototype.hasOwnProperty.call(values, key)) {\r\n this._printStyle.push((key + JSON.stringify(values[key])).replace(/['\"]+/g, ''));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @returns the string that create the stylesheet which will be injected\r\n * later within <style></style> tag.\r\n *\r\n * -join/replace to transform an array objects to css-styled string\r\n */\r\n public returnStyleValues() {\r\n const styleNonce = this.nonce ? ` nonce=\"${this.nonce}\"` : '';\r\n return `<style${styleNonce}> ${this._printStyle.join(' ').replace(/,/g, ';')} </style>`;\r\n }\r\n\r\n /**\r\n * @returns string which contains the link tags containing the css which will\r\n * be injected later within <head></head> tag.\r\n *\r\n */\r\n private returnStyleSheetLinkTags() {\r\n return this._styleSheetFile;\r\n }\r\n\r\n /**\r\n * Sets the style sheet file based on the provided CSS list.\r\n *\r\n * @param {string} cssList - CSS file or list of CSS files.\r\n * @protected\r\n */\r\n protected setStyleSheetFile(cssList: string) {\r\n const linkTagFn = function (cssFileName: string) {\r\n return `<link rel=\"stylesheet\" type=\"text/css\" href=\"${cssFileName}\">`;\r\n };\r\n\r\n if (cssList.indexOf(',') !== -1) {\r\n const valueArr = cssList.split(',');\r\n this._styleSheetFile = valueArr.map(val => linkTagFn(val)).join('');\r\n } else {\r\n this._styleSheetFile = linkTagFn(cssList);\r\n }\r\n }\r\n\r\n //#endregion\r\n\r\n //#region Private methods used by PrintBase\r\n\r\n /**\r\n * Updates the default values for input elements.\r\n *\r\n * @param {HTMLCollectionOf<HTMLInputElement>} elements - Collection of input elements.\r\n * @private\r\n */\r\n private updateInputDefaults(elements: HTMLCollectionOf<HTMLInputElement>): void {\r\n for (let i = 0; i < elements.length; i++) {\r\n const element = elements[i];\r\n element['defaultValue'] = element.value;\r\n if (element['checked']) element['defaultChecked'] = true;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the default values for select elements.\r\n *\r\n * @param {HTMLCollectionOf<HTMLSelectElement>} elements - Collection of select elements.\r\n * @private\r\n */\r\n private updateSelectDefaults(elements: HTMLCollectionOf<HTMLSelectElement>): void {\r\n for (let i = 0; i < elements.length; i++) {\r\n const element = elements[i];\r\n const selectedIdx = element.selectedIndex;\r\n const selectedOption: HTMLOptionElement = element.options[selectedIdx];\r\n\r\n selectedOption.defaultSelected = true;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the default values for textarea elements.\r\n *\r\n * @param {HTMLCollectionOf<HTMLTextAreaElement>} elements - Collection of textarea elements.\r\n * @private\r\n */\r\n private updateTextAreaDefaults(elements: HTMLCollectionOf<HTMLTextAreaElement>): void {\r\n for (let i = 0; i < elements.length; i++) {\r\n const element = elements[i];\r\n element['defaultValue'] = element.value;\r\n }\r\n }\r\n\r\n /**\r\n * Converts a canvas element to an image and returns its HTML string.\r\n *\r\n * @param {HTMLCanvasElement} element - The canvas element to convert.\r\n * @returns {string} - HTML string of the image.\r\n * @private\r\n */\r\n private canvasToImageHtml(element: HTMLCanvasElement): string {\r\n const dataUrl = element.toDataURL();\r\n return `<img src=\"${dataUrl}\" style=\"max-width: 100%;\">`;\r\n }\r\n\r\n /**\r\n * Includes canvas contents in the print section via img tags.\r\n *\r\n * @param {HTMLCollectionOf<HTMLCanvasElement>} elements - Collection of canvas elements.\r\n * @private\r\n */\r\n private updateCanvasToImage(elements: HTMLCollectionOf<HTMLCanvasElement>): void {\r\n for (let i = 0; i < elements.length; i++) {\r\n const element = this.canvasToImageHtml(elements[i]);\r\n elements[i].insertAdjacentHTML('afterend', element);\r\n elements[i].remove();\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves the HTML content of a specified printing section.\r\n *\r\n * @param {string} printSectionId - Id of the printing section.\r\n * @returns {string | null} - HTML content of the printing section, or null if not found.\r\n * @private\r\n */\r\n private getHtmlContents(printSectionId: string): string | null {\r\n const printContents = document.getElementById(printSectionId);\r\n if (!printContents) return null;\r\n\r\n const inputEls = printContents.getElementsByTagName('input');\r\n const selectEls = printContents.getElementsByTagName('select');\r\n const textAreaEls = printContents.getElementsByTagName('textarea');\r\n const canvasEls = printContents.getElementsByTagName('canvas');\r\n\r\n this.updateInputDefaults(inputEls);\r\n this.updateSelectDefaults(selectEls);\r\n this.updateTextAreaDefaults(textAreaEls);\r\n this.updateCanvasToImage(canvasEls);\r\n\r\n return printContents.innerHTML;\r\n }\r\n\r\n /**\r\n * Retrieves the HTML content of elements with the specified tag.\r\n *\r\n * @param {keyof HTMLElementTagNameMap} tag - HTML tag name.\r\n * @returns {string} - Concatenated outerHTML of elements with the specified tag.\r\n * @private\r\n */\r\n private getElementTag(tag: keyof HTMLElementTagNameMap): string {\r\n const html: string[] = [];\r\n const elements = document.getElementsByTagName(tag);\r\n for (let index = 0; index < elements.length; index++) {\r\n html.push(elements[index].outerHTML);\r\n }\r\n return html.join('\\r\\n');\r\n }\r\n //#endregion\r\n\r\n protected notifyPrintComplete() {\r\n this.printComplete.next();\r\n }\r\n\r\n /**\r\n * Prints the specified content using the provided print options.\r\n *\r\n * @param {PrintOptions} printOptions - Options for printing.\r\n * @public\r\n */\r\n protected print(printOptions: PrintOptions): void {\r\n let styles = '',\r\n links = '',\r\n popOut = 'top=0,left=0,height=auto,width=auto';\r\n const baseTag = this.getElementTag('base');\r\n\r\n if (printOptions.useExistingCss) {\r\n styles = this.getElementTag('style');\r\n links = this.getElementTag('link');\r\n }\r\n\r\n // If the openNewTab option is set to true, then set the popOut option to an empty string.\r\n // This will cause the print dialog to open in a new tab.\r\n if (printOptions.openNewTab) {\r\n popOut = '';\r\n }\r\n\r\n const printContents = this.getHtmlContents(printOptions.printSectionId);\r\n if (!printContents) {\r\n // Handle the case where the specified print section is not found.\r\n console.error(`Print section with id ${printOptions.printSectionId} not found.`);\r\n return;\r\n }\r\n\r\n const popupWin = window.open('', '_blank', popOut);\r\n\r\n if (!popupWin) {\r\n // the popup window could not be opened.\r\n console.error('Could not open print window.');\r\n return;\r\n }\r\n\r\n popupWin.document.open();\r\n\r\n // Create the HTML structure\r\n const doc = popupWin.document;\r\n\r\n // Set up the basic HTML structure\r\n const html = doc.createElement('html');\r\n const head = doc.createElement('head');\r\n const body = doc.createElement('body');\r\n\r\n // Set title\r\n const title = doc.createElement('title');\r\n title.textContent = printOptions.printTitle || '';\r\n head.appendChild(title);\r\n\r\n // Add base tag, styles, and links\r\n if (baseTag) {\r\n head.innerHTML += baseTag;\r\n }\r\n head.innerHTML += this.returnStyleValues();\r\n head.innerHTML += this.returnStyleSheetLinkTags();\r\n head.innerHTML += styles;\r\n head.innerHTML += links;\r\n\r\n // Set body class if provided\r\n if (printOptions.bodyClass) {\r\n body.className = printOptions.bodyClass;\r\n }\r\n\r\n // Insert print contents\r\n body.innerHTML += printContents;\r\n\r\n // Assemble the document\r\n html.appendChild(head);\r\n html.appendChild(body);\r\n doc.appendChild(html);\r\n\r\n popupWin.document.close();\r\n\r\n // Listen for the print-complete message\r\n const handleMessage = (event: MessageEvent) => {\r\n if (event.data?.type === 'print-complete') {\r\n this.notifyPrintComplete();\r\n window.removeEventListener('message', handleMessage);\r\n }\r\n };\r\n window.addEventListener('message', handleMessage);\r\n\r\n // Post the print options to the new window after it loads\r\n popupWin.addEventListener('load', () => {\r\n if ((popupWin as any).initPrintWindow) {\r\n (popupWin as any).initPrintWindow(popupWin, printOptions);\r\n } else {\r\n popupWin.postMessage({ type: 'init-print', options: printOptions }, '*');\r\n }\r\n });\r\n }\r\n}\r\n","export class PrintOptions {\r\n printSectionId: string = '';\r\n printTitle: string = '';\r\n useExistingCss: boolean = false;\r\n bodyClass: string = '';\r\n openNewTab: boolean = false;\r\n previewOnly: boolean = false;\r\n closeWindow: boolean = true;\r\n printDelay: number = 0;\r\n\r\n constructor(options?: Partial<PrintOptions>) {\r\n if (options) {\r\n Object.assign(this, options);\r\n }\r\n }\r\n}\r\n","import { Directive, HostListener, Input, output } from '@angular/core';\r\nimport { PrintBase } from './ngx-print.base';\r\nimport { PrintOptions } from './print-options';\r\nimport { take } from 'rxjs';\r\n@Directive({\r\n selector: '[ngxPrint]',\r\n standalone: true,\r\n})\r\nexport class NgxPrintDirective extends PrintBase {\r\n private printOptions = new PrintOptions();\r\n /**\r\n * Prevents the print dialog from opening on the window\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set previewOnly(value: boolean) {\r\n this.printOptions = { ...this.printOptions, previewOnly: value };\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set printSectionId(value: string) {\r\n this.printOptions = { ...this.printOptions, printSectionId: value };\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set printTitle(value: string) {\r\n this.printOptions = { ...this.printOptions, printTitle: value };\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set useExistingCss(value: boolean) {\r\n this.printOptions = { ...this.printOptions, useExistingCss: value };\r\n }\r\n\r\n /**\r\n * A delay in milliseconds to force the print dialog to wait before opened. Default: 0\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() set printDelay(value: number) {\r\n this.printOptions = { ...this.printOptions, printDelay: value };\r\n }\r\n\r\n /**\r\n * Whether to close the window after print() returns.\r\n *\r\n */\r\n @Input() set closeWindow(value: boolean) {\r\n this.printOptions = { ...this.printOptions, closeWindow: value };\r\n }\r\n\r\n /**\r\n * Class attribute to apply to the body element.\r\n *\r\n */\r\n @Input() set bodyClass(value: string) {\r\n this.printOptions = { ...this.printOptions, bodyClass: value };\r\n }\r\n\r\n /**\r\n * Whether to open a new window or default to new window.\r\n *\r\n */\r\n @Input() set openNewTab(value: boolean) {\r\n this.printOptions = { ...this.printOptions, openNewTab: value };\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input()\r\n set printStyle(values: { [key: string]: { [key: string]: string } }) {\r\n super.setPrintStyle(values);\r\n }\r\n\r\n /**\r\n * @memberof NgxPrintDirective\r\n * @param cssList\r\n */\r\n @Input()\r\n set styleSheetFile(cssList: string) {\r\n super.setStyleSheetFile(cssList);\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @HostListener('click')\r\n public print(): void {\r\n super.print(this.printOptions);\r\n this.printComplete.pipe(take(1)).subscribe(() => {\r\n this.printCompleted.emit(undefined);\r\n });\r\n }\r\n\r\n readonly printCompleted = output<void>();\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { NgxPrintDirective } from './ngx-print.directive';\r\n\r\n@NgModule({\r\n imports: [NgxPrintDirective],\r\n exports: [NgxPrintDirective],\r\n})\r\nexport class NgxPrintModule {}\r\n","import { Injectable } from '@angular/core';\r\nimport { PrintBase } from './ngx-print.base';\r\nimport { PrintOptions } from './print-options';\r\n\r\n/**\r\n * Service for handling printing functionality in Angular applications.\r\n * Extends the base printing class (PrintBase).\r\n *\r\n * @export\r\n * @class NgxPrintService\r\n * @extends {PrintBase}\r\n */\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class NgxPrintService extends PrintBase {\r\n printComplete$ = this.printComplete.asObservable();\r\n /**\r\n * Initiates the printing process using the provided print options.\r\n *\r\n * @param {PrintOptions} printOptions - Options for configuring the printing process.\r\n * @memberof NgxPrintService\r\n * @returns {void}\r\n */\r\n public print(printOptions: PrintOptions): void {\r\n // Call the print method in the parent class\r\n super.print(printOptions);\r\n }\r\n\r\n /**\r\n * Sets the print style for the printing process.\r\n *\r\n * @param {{ [key: string]: { [key: string]: string } }} values - A dictionary representing the print styles.\r\n * @memberof NgxPrintService\r\n * @setter\r\n */\r\n set printStyle(values: { [key: string]: { [key: string]: string } }) {\r\n super.setPrintStyle(values);\r\n }\r\n\r\n /**\r\n * Sets the stylesheet file for the printing process.\r\n *\r\n * @param {string} cssList - A string representing the path to the stylesheet file.\r\n * @memberof NgxPrintService\r\n * @setter\r\n */\r\n set styleSheetFile(cssList: string) {\r\n super.setStyleSheetFile(cssList);\r\n }\r\n}\r\n","import { PrintOptions } from './print-options';\r\n\r\nexport function initPrintWindow(windowRef: Window, printOptions: PrintOptions) {\r\n function triggerPrint() {\r\n windowRef.removeEventListener('load', triggerPrint, false);\r\n if (!printOptions.previewOnly) {\r\n setTimeout(() => {\r\n windowRef.print();\r\n if (printOptions.closeWindow) windowRef.close();\r\n }, printOptions.printDelay || 0);\r\n }\r\n }\r\n\r\n function afterPrint() {\r\n if (windowRef.opener) {\r\n windowRef.opener.postMessage({ type: 'print-complete' }, '*');\r\n }\r\n if (printOptions.closeWindow) windowRef.close();\r\n }\r\n\r\n windowRef.addEventListener('load', triggerPrint, false);\r\n windowRef.addEventListener('afterprint', afterPrint, { once: true });\r\n}\r\n","/*\r\n * Public API Surface of ngx-print\r\n */\r\nexport { NgxPrintDirective } from './lib/ngx-print.directive';\r\nexport { NgxPrintModule } from './lib/ngx-print.module';\r\nexport { NgxPrintService } from './lib/ngx-print.service';\r\nexport { PrintOptions } from './lib/print-options';\r\nimport { initPrintWindow } from './lib/print-helper';\r\n\r\n// Expose globally for popup windows\r\nif (!(window as any).initPrintWindow) {\r\n (window as any).initPrintWindow = initPrintWindow;\r\n}\r\n\r\n// listen for postMessage from child window\r\nwindow.addEventListener('message', (event: MessageEvent) => {\r\n if (event.data?.type === 'init-print') {\r\n initPrintWindow(window, event.data.options);\r\n }\r\n});\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAOa,SAAS,CAAA;IACZ,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAE7C,WAAW,GAAa,EAAE;IAC1B,eAAe,GAAW,EAAE;AAC1B,IAAA,aAAa,GAAG,IAAI,OAAO,EAAQ;;AAG7C;;;;;AAKG;AACO,IAAA,aAAa,CAAC,MAAoD,EAAA;AAC1E,QAAA,IAAI,CAAC,WAAW,GAAG,EAAE;AACrB,QAAA,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;AACxB,YAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;gBACrD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAClF;QACF;IACF;AAEA;;;;;;;AAOG;IACI,iBAAiB,GAAA;AACt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