ngx-print 1.4.0 → 1.5.0

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,86 @@
1
+ import { PrintOptions } from "./print-options";
2
+ import * as i0 from "@angular/core";
3
+ export declare class PrintBase {
4
+ private _printStyle;
5
+ private _styleSheetFile;
6
+ /**
7
+ * Sets the print styles based on the provided values.
8
+ *
9
+ * @param {Object} values - Key-value pairs representing print styles.
10
+ * @protected
11
+ */
12
+ protected setPrintStyle(values: {
13
+ [key: string]: {
14
+ [key: string]: string;
15
+ };
16
+ }): void;
17
+ /**
18
+ *
19
+ *
20
+ * @returns the string that create the stylesheet which will be injected
21
+ * later within <style></style> tag.
22
+ *
23
+ * -join/replace to transform an array objects to css-styled string
24
+ */
25
+ returnStyleValues(): string;
26
+ /**
27
+ * @returns string which contains the link tags containing the css which will
28
+ * be injected later within <head></head> tag.
29
+ *
30
+ */
31
+ private returnStyleSheetLinkTags;
32
+ /**
33
+ * Sets the style sheet file based on the provided CSS list.
34
+ *
35
+ * @param {string} cssList - CSS file or list of CSS files.
36
+ * @protected
37
+ */
38
+ protected setStyleSheetFile(cssList: string): void;
39
+ /**
40
+ * Updates the default values for input elements.
41
+ *
42
+ * @param {HTMLCollectionOf<HTMLInputElement>} elements - Collection of input elements.
43
+ * @private
44
+ */
45
+ private updateInputDefaults;
46
+ /**
47
+ * Updates the default values for select elements.
48
+ *
49
+ * @param {HTMLCollectionOf<HTMLSelectElement>} elements - Collection of select elements.
50
+ * @private
51
+ */
52
+ private updateSelectDefaults;
53
+ /**
54
+ * Updates the default values for textarea elements.
55
+ *
56
+ * @param {HTMLCollectionOf<HTMLTextAreaElement>} elements - Collection of textarea elements.
57
+ * @private
58
+ */
59
+ private updateTextAreaDefaults;
60
+ /**
61
+ * Retrieves the HTML content of a specified printing section.
62
+ *
63
+ * @param {string} printSectionId - Id of the printing section.
64
+ * @returns {string | null} - HTML content of the printing section, or null if not found.
65
+ * @private
66
+ */
67
+ private getHtmlContents;
68
+ /**
69
+ * Retrieves the HTML content of elements with the specified tag.
70
+ *
71
+ * @param {keyof HTMLElementTagNameMap} tag - HTML tag name.
72
+ * @returns {string} - Concatenated outerHTML of elements with the specified tag.
73
+ * @private
74
+ */
75
+ private getElementTag;
76
+ /**
77
+ * Prints the specified content using the provided print options.
78
+ *
79
+ * @param {PrintOptions} printOptions - Options for printing.
80
+ * @public
81
+ */
82
+ protected print(printOptions: PrintOptions): void;
83
+ static ɵfac: i0.ɵɵFactoryDeclaration<PrintBase, never>;
84
+ static ɵprov: i0.ɵɵInjectableDeclaration<PrintBase>;
85
+ }
86
+ //# sourceMappingURL=ngx-print.base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-print.base.d.ts","sourceRoot":"","sources":["../../../src/lib/ngx-print.base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;;AAE/C,qBAGa,SAAS;IAElB,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,eAAe,CAAc;IAGrC;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;KAAE;IAS5E;;;;;;;OAOG;IACI,iBAAiB;IAIxB;;;;KAIC;IACD,OAAO,CAAC,wBAAwB;IAIhC;;;;;OAKG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM;IAiB3C;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IAevB;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAWrB;;;;;OAKG;IACH,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;yCA1JxC,SAAS;6CAAT,SAAS;CAyMrB"}
@@ -1,46 +1,47 @@
1
+ import { PrintBase } from './ngx-print.base';
1
2
  import * as i0 from "@angular/core";
2
- export declare class NgxPrintDirective {
3
- _printStyle: any[];
3
+ export declare class NgxPrintDirective extends PrintBase {
4
+ private printOptions;
4
5
  /**
5
6
  * Prevents the print dialog from opening on the window
6
7
  *
7
8
  * @memberof NgxPrintDirective
8
9
  */
9
- previewOnly: boolean;
10
+ set previewOnly(value: boolean);
10
11
  /**
11
12
  *
12
13
  *
13
14
  * @memberof NgxPrintDirective
14
15
  */
15
- printSectionId: string;
16
+ set printSectionId(value: string);
16
17
  /**
17
18
  *
18
19
  *
19
20
  * @memberof NgxPrintDirective
20
21
  */
21
- printTitle: string;
22
+ set printTitle(value: string);
22
23
  /**
23
24
  *
24
25
  *
25
26
  * @memberof NgxPrintDirective
26
27
  */
27
- useExistingCss: boolean;
28
+ set useExistingCss(value: boolean);
28
29
  /**
29
30
  * A delay in milliseconds to force the print dialog to wait before opened. Default: 0
30
31
  *
31
32
  * @memberof NgxPrintDirective
32
33
  */
33
- printDelay: number;
34
+ set printDelay(value: number);
34
35
  /**
35
36
  * Whether to close the window after print() returns.
36
37
  *
37
38
  */
38
- closeWindow: boolean;
39
+ set closeWindow(value: boolean);
39
40
  /**
40
41
  * Class attribute to apply to the body element.
41
42
  *
42
43
  */
43
- bodyClass: string;
44
+ set bodyClass(value: string);
44
45
  /**
45
46
  *
46
47
  *
@@ -51,56 +52,11 @@ export declare class NgxPrintDirective {
51
52
  [key: string]: string;
52
53
  };
53
54
  });
54
- /**
55
- *
56
- *
57
- * @returns the string that create the stylesheet which will be injected
58
- * later within <style></style> tag.
59
- *
60
- * -join/replace to transform an array objects to css-styled string
61
- *
62
- * @memberof NgxPrintDirective
63
- */
64
- returnStyleValues(): string;
65
- /**
66
- *
67
- *
68
- * @returns html for the given tag
69
- *
70
- * @memberof NgxPrintDirective
71
- */
72
- private _styleSheetFile;
73
55
  /**
74
56
  * @memberof NgxPrintDirective
75
57
  * @param cssList
76
58
  */
77
59
  set styleSheetFile(cssList: string);
78
- /**
79
- * @returns string which contains the link tags containing the css which will
80
- * be injected later within <head></head> tag.
81
- *
82
- */
83
- private returnStyleSheetLinkTags;
84
- private getElementTag;
85
- /**
86
- *
87
- * @description When printing, the default option of form elements are printed.
88
- * Here we update what that default is to print the current values.
89
- *
90
- * @param elements the html element collection to save defaults to
91
- *
92
- */
93
- private updateInputDefaults;
94
- private updateSelectDefaults;
95
- private updateTextAreaDefaults;
96
- /**
97
- * @description Retrieves the html contents of the print section id.
98
- * Updates the html elements to default their form values to the current form values
99
- *
100
- * @returns {string | null} html section to be printed
101
- *
102
- */
103
- private getHtmlContents;
104
60
  /**
105
61
  *
106
62
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-print.directive.d.ts","sourceRoot":"","sources":["../../../src/lib/ngx-print.directive.ts"],"names":[],"mappings":";AACA,qBAIa,iBAAiB;IAErB,WAAW,QAAM;IAExB;;;;OAIG;IACM,WAAW,EAAE,OAAO,CAAS;IAEtC;;;;OAIG;IACM,cAAc,EAAE,MAAM,CAAC;IAEhC;;;;OAIG;IACM,UAAU,EAAE,MAAM,CAAC;IAE5B;;;;OAIG;IACM,cAAc,UAAS;IAEhC;;;;OAIG;IACM,UAAU,EAAE,MAAM,CAAK;IAEhC;;;OAGG;IACM,WAAW,EAAE,OAAO,CAAQ;IAErC;;;OAGG;IACM,SAAS,EAAE,MAAM,CAAM;IAEhC;;;;OAIG;IACH,IACI,UAAU,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;KAAE,EAOlE;IAED;;;;;;;;;OASG;IACI,iBAAiB;IAIxB;;;;;;OAMG;IACH,OAAO,CAAC,eAAe,CAAM;IAE7B;;;OAGG;IACH,IACI,c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FT,iBAAiB;2CAAjB,iBAAiB;CA4F7B"}
@@ -0,0 +1,44 @@
1
+ import { PrintBase } from "./ngx-print.base";
2
+ import { PrintOptions } from "./print-options";
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Service for handling printing functionality in Angular applications.
6
+ * Extends the base printing class (PrintBase).
7
+ *
8
+ * @export
9
+ * @class NgxPrintService
10
+ * @extends {PrintBase}
11
+ */
12
+ export declare class NgxPrintService extends PrintBase {
13
+ /**
14
+ * Initiates the printing process using the provided print options.
15
+ *
16
+ * @param {PrintOptions} printOptions - Options for configuring the printing process.
17
+ * @memberof NgxPrintService
18
+ * @returns {void}
19
+ */
20
+ print(printOptions: PrintOptions): void;
21
+ /**
22
+ * Sets the print style for the printing process.
23
+ *
24
+ * @param {{ [key: string]: { [key: string]: string } }} values - A dictionary representing the print styles.
25
+ * @memberof NgxPrintService
26
+ * @setter
27
+ */
28
+ set printStyle(values: {
29
+ [key: string]: {
30
+ [key: string]: string;
31
+ };
32
+ });
33
+ /**
34
+ * Sets the stylesheet file for the printing process.
35
+ *
36
+ * @param {string} cssList - A string representing the path to the stylesheet file.
37
+ * @memberof NgxPrintService
38
+ * @setter
39
+ */
40
+ set styleSheetFile(cssList: string);
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxPrintService, never>;
42
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxPrintService>;
43
+ }
44
+ //# sourceMappingURL=ngx-print.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-print.service.d.ts","sourceRoot":"","sources":["../../../src/lib/ngx-print.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;;AAE/C;;;;;;;GAOG;AACH,qBAGa,eAAgB,SAAQ,SAAS;IAE5C;;;;;;OAMG;IACI,KAAK,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAK9C;;;;;;OAMG;IACH,IAAI,UAAU,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;KAAE,EAElE;IAGD;;;;;;OAMG;IACH,IAAI,cAAc,CAAC,OAAO,EAAE,MAAM,EAEjC;yCAnCU,eAAe;6CAAf,eAAe;CAoC3B"}
@@ -0,0 +1,11 @@
1
+ export declare class PrintOptions {
2
+ printSectionId: string;
3
+ printTitle: string;
4
+ useExistingCss: boolean;
5
+ bodyClass: string;
6
+ previewOnly: boolean;
7
+ closeWindow: boolean;
8
+ printDelay: number;
9
+ constructor(options?: Partial<PrintOptions>);
10
+ }
11
+ //# sourceMappingURL=print-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-options.d.ts","sourceRoot":"","sources":["../../../src/lib/print-options.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IACvB,cAAc,EAAE,MAAM,CAAQ;IAC9B,UAAU,EAAE,MAAM,CAAQ;IAC1B,cAAc,EAAE,OAAO,CAAS;IAChC,SAAS,EAAE,MAAM,CAAM;IACvB,WAAW,EAAE,OAAO,CAAS;IAC7B,WAAW,EAAE,OAAO,CAAQ;IAC5B,UAAU,EAAE,MAAM,CAAK;gBAEX,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;CAK5C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-print",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Plug n' Play Angular (2++) directive to print your stuff",
5
5
  "author": "https://github.com/selemxmn/ngx-print/graphs/contributors",
6
6
  "repository": {
package/public_api.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './lib/ngx-print.service';
1
2
  export * from './lib/ngx-print.directive';
2
3
  export * from './lib/ngx-print.module';
4
+ export * from './lib/print-options';
3
5
  //# sourceMappingURL=public_api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../src/public_api.ts"],"names":[],"mappings":"AAIA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../src/public_api.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}