ngx-print 1.2.1 → 1.3.1

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,212 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Directive, Input, HostListener, NgModule } from '@angular/core';
3
+
4
+ class NgxPrintDirective {
5
+ constructor() {
6
+ this._printStyle = [];
7
+ /**
8
+ * Prevents the print dialog from opening on the window
9
+ *
10
+ * @memberof NgxPrintDirective
11
+ */
12
+ this.previewOnly = false;
13
+ /**
14
+ *
15
+ *
16
+ * @memberof NgxPrintDirective
17
+ */
18
+ this.useExistingCss = false;
19
+ /**
20
+ * A delay in milliseconds to force the print dialog to wait before opened. Default: 0
21
+ *
22
+ * @memberof NgxPrintDirective
23
+ */
24
+ this.printDelay = 0;
25
+ /**
26
+ *
27
+ *
28
+ * @returns html for the given tag
29
+ *
30
+ * @memberof NgxPrintDirective
31
+ */
32
+ this._styleSheetFile = '';
33
+ }
34
+ /**
35
+ *
36
+ *
37
+ * @memberof NgxPrintDirective
38
+ */
39
+ set printStyle(values) {
40
+ for (let key in values) {
41
+ if (values.hasOwnProperty(key)) {
42
+ this._printStyle.push((key + JSON.stringify(values[key])).replace(/['"]+/g, ''));
43
+ }
44
+ }
45
+ this.returnStyleValues();
46
+ }
47
+ /**
48
+ *
49
+ *
50
+ * @returns the string that create the stylesheet which will be injected
51
+ * later within <style></style> tag.
52
+ *
53
+ * -join/replace to transform an array objects to css-styled string
54
+ *
55
+ * @memberof NgxPrintDirective
56
+ */
57
+ returnStyleValues() {
58
+ return `<style> ${this._printStyle.join(' ').replace(/,/g, ';')} </style>`;
59
+ }
60
+ /**
61
+ * @memberof NgxPrintDirective
62
+ * @param cssList
63
+ */
64
+ set styleSheetFile(cssList) {
65
+ let linkTagFn = function (cssFileName) {
66
+ return `<link rel="stylesheet" type="text/css" href="${cssFileName}">`;
67
+ };
68
+ if (cssList.indexOf(',') !== -1) {
69
+ const valueArr = cssList.split(',');
70
+ for (let val of valueArr) {
71
+ this._styleSheetFile = this._styleSheetFile + linkTagFn(val);
72
+ }
73
+ }
74
+ else {
75
+ this._styleSheetFile = linkTagFn(cssList);
76
+ }
77
+ }
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
+ returnStyleSheetLinkTags() {
84
+ return this._styleSheetFile;
85
+ }
86
+ getElementTag(tag) {
87
+ const html = [];
88
+ const elements = document.getElementsByTagName(tag);
89
+ for (let index = 0; index < elements.length; index++) {
90
+ html.push(elements[index].outerHTML);
91
+ }
92
+ return html.join('\r\n');
93
+ }
94
+ /**
95
+ *
96
+ * @param data the html element collection to save defaults to
97
+ *
98
+ */
99
+ getFormData(data) {
100
+ for (var i = 0; i < data.length; i++) {
101
+ data[i].defaultValue = data[i].value;
102
+ if (data[i].checked) {
103
+ data[i].defaultChecked = true;
104
+ }
105
+ }
106
+ }
107
+ /**
108
+ * @returns html section to be printed along with some associated inputs
109
+ *
110
+ */
111
+ getHtmlContents() {
112
+ let printContents = document.getElementById(this.printSectionId);
113
+ let innards = printContents.getElementsByTagName('input');
114
+ this.getFormData(innards);
115
+ let txt = printContents.getElementsByTagName('textarea');
116
+ this.getFormData(txt);
117
+ return printContents.innerHTML;
118
+ }
119
+ /**
120
+ *
121
+ *
122
+ * @memberof NgxPrintDirective
123
+ */
124
+ print() {
125
+ let printContents, popupWin, styles = '', links = '';
126
+ const baseTag = this.getElementTag('base');
127
+ if (this.useExistingCss) {
128
+ styles = this.getElementTag('style');
129
+ links = this.getElementTag('link');
130
+ }
131
+ printContents = this.getHtmlContents();
132
+ popupWin = window.open("", "_blank", "top=0,left=0,height=auto,width=auto");
133
+ popupWin.document.open();
134
+ popupWin.document.write(`
135
+ <html>
136
+ <head>
137
+ <title>${this.printTitle ? this.printTitle : ""}</title>
138
+ ${baseTag}
139
+ ${this.returnStyleValues()}
140
+ ${this.returnStyleSheetLinkTags()}
141
+ ${styles}
142
+ ${links}
143
+ </head>
144
+ <body>
145
+ ${printContents}
146
+ <script defer>
147
+ function triggerPrint(event) {
148
+ window.removeEventListener('load', triggerPrint, false);
149
+ ${this.previewOnly ? '' : `setTimeout(function() {
150
+ closeWindow(window.print());
151
+ }, ${this.printDelay});`}
152
+ }
153
+ function closeWindow(){
154
+ window.close();
155
+ }
156
+ window.addEventListener('load', triggerPrint, false);
157
+ </script>
158
+ </body>
159
+ </html>`);
160
+ popupWin.document.close();
161
+ }
162
+ }
163
+ NgxPrintDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgxPrintDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
164
+ NgxPrintDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: NgxPrintDirective, selector: "button[ngxPrint]", inputs: { previewOnly: "previewOnly", printSectionId: "printSectionId", printTitle: "printTitle", useExistingCss: "useExistingCss", printDelay: "printDelay", printStyle: "printStyle", styleSheetFile: "styleSheetFile" }, host: { listeners: { "click": "print()" } }, ngImport: i0 });
165
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgxPrintDirective, decorators: [{
166
+ type: Directive,
167
+ args: [{
168
+ selector: "button[ngxPrint]"
169
+ }]
170
+ }], propDecorators: { previewOnly: [{
171
+ type: Input
172
+ }], printSectionId: [{
173
+ type: Input
174
+ }], printTitle: [{
175
+ type: Input
176
+ }], useExistingCss: [{
177
+ type: Input
178
+ }], printDelay: [{
179
+ type: Input
180
+ }], printStyle: [{
181
+ type: Input
182
+ }], styleSheetFile: [{
183
+ type: Input
184
+ }], print: [{
185
+ type: HostListener,
186
+ args: ['click']
187
+ }] } });
188
+
189
+ class NgxPrintModule {
190
+ }
191
+ NgxPrintModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgxPrintModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
192
+ NgxPrintModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: NgxPrintModule, declarations: [NgxPrintDirective], exports: [NgxPrintDirective] });
193
+ NgxPrintModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgxPrintModule });
194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NgxPrintModule, decorators: [{
195
+ type: NgModule,
196
+ args: [{
197
+ declarations: [NgxPrintDirective],
198
+ imports: [],
199
+ exports: [NgxPrintDirective]
200
+ }]
201
+ }] });
202
+
203
+ /*
204
+ * Public API Surface of ngx-print
205
+ */
206
+
207
+ /**
208
+ * Generated bundle index. Do not edit.
209
+ */
210
+
211
+ export { NgxPrintDirective, NgxPrintModule };
212
+ //# sourceMappingURL=ngx-print.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-print.mjs","sources":["../../../src/lib/ngx-print.directive.ts","../../../src/lib/ngx-print.module.ts","../../../src/public_api.ts","../../../src/ngx-print.ts"],"sourcesContent":["import { Directive, HostListener, Input } from '@angular/core';\r\n@Directive({\r\n selector: \"button[ngxPrint]\"\r\n})\r\nexport class NgxPrintDirective {\r\n\r\n public _printStyle = [];\r\n\r\n /**\r\n * Prevents the print dialog from opening on the window\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() previewOnly: boolean = false;\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() printSectionId: string;\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() printTitle: string;\r\n\r\n /**\r\n *\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n @Input() useExistingCss = false;\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() printDelay: number = 0;\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 for (let key in values) {\r\n if (values.hasOwnProperty(key)) {\r\n this._printStyle.push((key + JSON.stringify(values[key])).replace(/['\"]+/g, ''));\r\n }\r\n }\r\n this.returnStyleValues();\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 * @memberof NgxPrintDirective\r\n */\r\npublic returnStyleValues() {\r\n return `<style> ${this._printStyle.join(' ').replace(/,/g,';')} </style>`;\r\n }\r\n\r\n /**\r\n *\r\n *\r\n * @returns html for the given tag\r\n *\r\n * @memberof NgxPrintDirective\r\n */\r\n private _styleSheetFile = '';\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 let linkTagFn = function(cssFileName) {\r\n return `<link rel=\"stylesheet\" type=\"text/css\" href=\"${cssFileName}\">`;\r\n }\r\n if (cssList.indexOf(',') !== -1) {\r\n const valueArr = cssList.split(',');\r\n for (let val of valueArr) {\r\n this._styleSheetFile = this._styleSheetFile + linkTagFn(val);\r\n }\r\n } else {\r\n this._styleSheetFile = linkTagFn(cssList);\r\n }\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 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\r\n /**\r\n * \r\n * @param data the html element collection to save defaults to\r\n * \r\n */\r\n private getFormData(data: any) {\r\n for (var i = 0; i < data.length; i++) {\r\n data[i].defaultValue = data[i].value;\r\n if(data[i].checked) {\r\n data[i].defaultChecked = true;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @returns html section to be printed along with some associated inputs\r\n * \r\n */\r\n private getHtmlContents() {\r\n let printContents = document.getElementById(this.printSectionId);\r\n let innards = printContents.getElementsByTagName('input');\r\n this.getFormData(innards);\r\n\r\n let txt = printContents.getElementsByTagName('textarea');\r\n this.getFormData(txt);\r\n \r\n return printContents.innerHTML;\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 let printContents, popupWin, styles = '', links = '';\r\n const baseTag = this.getElementTag('base');\r\n\r\n if(this.useExistingCss) {\r\n styles = this.getElementTag('style');\r\n links = this.getElementTag('link');\r\n }\r\n\r\n printContents = this.getHtmlContents();\r\n popupWin = window.open(\"\", \"_blank\", \"top=0,left=0,height=auto,width=auto\");\r\n popupWin.document.open();\r\n popupWin.document.write(`\r\n <html>\r\n <head>\r\n <title>${this.printTitle ? this.printTitle : \"\"}</title>\r\n ${baseTag}\r\n ${this.returnStyleValues()}\r\n ${this.returnStyleSheetLinkTags()}\r\n ${styles}\r\n ${links}\r\n </head>\r\n <body>\r\n ${printContents}\r\n <script defer>\r\n function triggerPrint(event) {\r\n window.removeEventListener('load', triggerPrint, false);\r\n ${this.previewOnly ? '' : `setTimeout(function() {\r\n closeWindow(window.print());\r\n }, ${this.printDelay});`}\r\n }\r\n function closeWindow(){\r\n window.close();\r\n }\r\n window.addEventListener('load', triggerPrint, false);\r\n </script>\r\n </body>\r\n </html>`);\r\n popupWin.document.close();\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { NgxPrintDirective } from './ngx-print.directive';\r\n\r\n@NgModule({\r\n declarations: [NgxPrintDirective],\r\n imports: [\r\n ],\r\n exports: [NgxPrintDirective]\r\n})\r\nexport class NgxPrintModule { }\r\n","/*\r\n * Public API Surface of ngx-print\r\n */\r\n\r\nexport * from './lib/ngx-print.directive';\r\nexport * from './lib/ngx-print.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;MAIa,iBAAiB,CAAA;AAH9B,IAAA,WAAA,GAAA;QAKS,IAAW,CAAA,WAAA,GAAG,EAAE,CAAC;AAExB;;;;AAIG;QACM,IAAW,CAAA,WAAA,GAAY,KAAK,CAAC;AAgBtC;;;;AAIG;QACM,IAAc,CAAA,cAAA,GAAG,KAAK,CAAC;AAEhC;;;;AAIG;QACM,IAAU,CAAA,UAAA,GAAW,CAAC,CAAC;AA+BhC;;;;;;AAMG;QACK,IAAe,CAAA,eAAA,GAAG,EAAE,CAAC;AAiH9B,KAAA;AArJC;;;;AAIG;IACH,IACI,UAAU,CAAC,MAAoD,EAAA;AACjE,QAAA,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE;AACtB,YAAA,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;gBAChC,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,CAAC;AAChF,aAAA;AACF,SAAA;QACD,IAAI,CAAC,iBAAiB,EAAE,CAAC;KAC1B;AAEH;;;;;;;;;AASG;IACI,iBAAiB,GAAA;AACtB,QAAA,OAAO,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAC,GAAG,CAAC,WAAW,CAAC;KACzE;AAWD;;;AAGG;IACH,IACI,cAAc,CAAC,OAAe,EAAA;QAChC,IAAI,SAAS,GAAG,UAAS,WAAW,EAAA;YAClC,OAAO,CAAA,6CAAA,EAAgD,WAAW,CAAA,EAAA,CAAI,CAAC;AACzE,SAAC,CAAA;QACD,IAAI,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,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;4GAAd,cAAc,EAAA,YAAA,EAAA,CALV,iBAAiB,CAAA,EAAA,OAAA,EAAA,CAGtB,iBAAiB,CAAA,EAAA,CAAA,CAAA;4GAEhB,cAAc,EAAA,CAAA,CAAA;2FAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAN1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,iBAAiB,CAAC;AACjC,oBAAA,OAAO,EAAE,EACR;oBACD,OAAO,EAAE,CAAC,iBAAiB,CAAC;AAC7B,iBAAA,CAAA;;;ACRD;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="ngx-print" />
5
+ export * from './public_api';
6
+ //# sourceMappingURL=ngx-print.d.ts.map
@@ -1,5 +1,12 @@
1
+ import * as i0 from "@angular/core";
1
2
  export declare class NgxPrintDirective {
2
3
  _printStyle: any[];
4
+ /**
5
+ * Prevents the print dialog from opening on the window
6
+ *
7
+ * @memberof NgxPrintDirective
8
+ */
9
+ previewOnly: boolean;
3
10
  /**
4
11
  *
5
12
  *
@@ -29,11 +36,11 @@ export declare class NgxPrintDirective {
29
36
  *
30
37
  * @memberof NgxPrintDirective
31
38
  */
32
- printStyle: {
39
+ set printStyle(values: {
33
40
  [key: string]: {
34
41
  [key: string]: string;
35
42
  };
36
- };
43
+ });
37
44
  /**
38
45
  *
39
46
  *
@@ -57,7 +64,7 @@ export declare class NgxPrintDirective {
57
64
  * @memberof NgxPrintDirective
58
65
  * @param cssList
59
66
  */
60
- styleSheetFile: string;
67
+ set styleSheetFile(cssList: string);
61
68
  /**
62
69
  * @returns string which contains the link tags containing the css which will
63
70
  * be injected later within <head></head> tag.
@@ -82,4 +89,7 @@ export declare class NgxPrintDirective {
82
89
  * @memberof NgxPrintDirective
83
90
  */
84
91
  print(): void;
92
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxPrintDirective, never>;
93
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgxPrintDirective, "button[ngxPrint]", never, { "previewOnly": "previewOnly"; "printSectionId": "printSectionId"; "printTitle": "printTitle"; "useExistingCss": "useExistingCss"; "printDelay": "printDelay"; "printStyle": "printStyle"; "styleSheetFile": "styleSheetFile"; }, {}, never, never, false, never>;
85
94
  }
95
+ //# sourceMappingURL=ngx-print.directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-print.directive.d.ts","sourceRoot":"","sources":["../../../src/lib/ngx-print.directive.ts"],"names":[],"mappings":";AACA,qBAGa,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;;;;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;IAEH;;;;;;;;;OASG;IACI,iBAAiB;IAItB;;;;;;OAMG;IACH,OAAO,CAAC,eAAe,CAAM;IAE7B;;;OAGG;IACH,IACI,cAAc,CAAC,OAAO,EAAE,MAAM,EAYjC;IAED;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAGhC,OAAO,CAAC,aAAa;IASrB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IASnB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAWvB;;;;OAIG;IAEI,KAAK,IAAI,IAAI;yCApJT,iBAAiB;2CAAjB,iBAAiB;CA4L7B"}
@@ -1,2 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./ngx-print.directive";
1
3
  export declare class NgxPrintModule {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxPrintModule, never>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxPrintModule, [typeof i1.NgxPrintDirective], never, [typeof i1.NgxPrintDirective]>;
6
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgxPrintModule>;
2
7
  }
8
+ //# sourceMappingURL=ngx-print.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-print.module.d.ts","sourceRoot":"","sources":["../../../src/lib/ngx-print.module.ts"],"names":[],"mappings":";;AAGA,qBAMa,cAAc;yCAAd,cAAc;0CAAd,cAAc;0CAAd,cAAc;CAAI"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-print.d.ts","sourceRoot":"","sources":["../../src/ngx-print.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-print",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
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": {
@@ -23,49 +23,26 @@
23
23
  "angular-print"
24
24
  ],
25
25
  "dependencies": {
26
- "tslib": "^1.9.3"
26
+ "tslib": "^2.3.0"
27
27
  },
28
- "devDependencies": {
29
- "@angular-devkit/build-angular": "^0.11.1",
30
- "@angular-devkit/build-ng-packagr": "^0.11.0",
31
- "@angular/cli": "^7.1.0",
32
- "@angular/common": "^7.1.3",
33
- "@angular/compiler": "^7.1.1",
34
- "@angular/compiler-cli": "^7.1.1",
35
- "@angular/core": "^7.1.1",
36
- "@angular/platform-browser": "^7.1.3",
37
- "@angular/platform-browser-dynamic": "^7.1.1",
38
- "@types/jasmine": "^3.3.1",
39
- "@types/node": "^10.12.12",
40
- "codelyzer": "^4.5.0",
41
- "coveralls": "^3.0.2",
42
- "jasmine-core": "^3.3.0",
43
- "jasmine-spec-reporter": "^4.2.1",
44
- "karma": "^3.1.3",
45
- "karma-chrome-launcher": "^2.2.0",
46
- "karma-coverage-istanbul-reporter": "^2.0.4",
47
- "karma-jasmine": "^2.0.1",
48
- "karma-jasmine-html-reporter": "^1.4.0",
49
- "ng-packagr": "^4.4.0",
50
- "nyc": "^14.1.1",
51
- "rxjs": "^6.3.3",
52
- "ts-node": "^7.0.1",
53
- "tsickle": "^0.34.0",
54
- "typescript": "3.2.4",
55
- "zone.js": "^0.8.26"
28
+ "module": "fesm2015/ngx-print.mjs",
29
+ "es2020": "fesm2020/ngx-print.mjs",
30
+ "esm2020": "esm2020/ngx-print.mjs",
31
+ "fesm2020": "fesm2020/ngx-print.mjs",
32
+ "fesm2015": "fesm2015/ngx-print.mjs",
33
+ "typings": "index.d.ts",
34
+ "exports": {
35
+ "./package.json": {
36
+ "default": "./package.json"
37
+ },
38
+ ".": {
39
+ "types": "./index.d.ts",
40
+ "esm2020": "./esm2020/ngx-print.mjs",
41
+ "es2020": "./fesm2020/ngx-print.mjs",
42
+ "es2015": "./fesm2015/ngx-print.mjs",
43
+ "node": "./fesm2015/ngx-print.mjs",
44
+ "default": "./fesm2020/ngx-print.mjs"
45
+ }
56
46
  },
57
- "peerDependencies": {
58
- "@angular/common": "*",
59
- "@angular/core": "*"
60
- },
61
- "main": "bundles/ngx-print.umd.js",
62
- "module": "fesm5/ngx-print.js",
63
- "es2015": "fesm2015/ngx-print.js",
64
- "esm5": "esm5/ngx-print.js",
65
- "esm2015": "esm2015/ngx-print.js",
66
- "fesm5": "fesm5/ngx-print.js",
67
- "fesm2015": "fesm2015/ngx-print.js",
68
- "typings": "ngx-print.d.ts",
69
- "metadata": "ngx-print.metadata.json",
70
47
  "sideEffects": false
71
- }
48
+ }
package/public_api.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './lib/ngx-print.directive';
2
2
  export * from './lib/ngx-print.module';
3
+ //# sourceMappingURL=public_api.d.ts.map
@@ -0,0 +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"}