ngx-print 1.2.0 → 1.3.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 1.3.0 (2022-12-20)
2
+ ### New features
3
+ * Supports previewOnly tag, allowing for the print preview to show without the print dialog
4
+ ### Dependency Updates
5
+ * Angular Ivy support with Angular 15
6
+
1
7
  # 1.1.0 (2018-12-04)
2
8
  ### New features
3
9
  * Support styles (CSS) ([#5](https://github.com/selemxmn/ngx-print/issues/5)) ([71cefdf](https://github.com/selemxmn/ngx-print/commit/71cefdf))
package/README.md CHANGED
@@ -3,6 +3,11 @@
3
3
  # ngx-print : *plug n' play Angular (2++) directive to print your stuff*
4
4
  This directive makes printing your HTML sections smooth and easy in your Angular application. It is inspired from the old [AngularJS ngPrint](https://github.com/gilf/ngPrint) directive, thus it is intendend to be used with the new Angular -2/4/5/6/7-... ***Enjoy ! contributions are so welcomed :)***
5
5
 
6
+ ## Dependencies
7
+ | ngx-print | Angular |
8
+ | ------------ | ------------ |
9
+ | 1.2.1 | 7.0.0 - 14.1.0 |
10
+ | 1.3.x | 15.0.0 |
6
11
  ## Setup
7
12
 
8
13
  **1-** In your root application folder run:
@@ -127,6 +132,24 @@ Here some simple styles were added to every `h1` & `h2` tags within the `div` wh
127
132
  printSectionId="print-section"
128
133
  ngxPrint>print</button>
129
134
 
135
+ ```
136
+
137
+ - If you would like to show a preview without a print dialog use
138
+ `previewOnly`:
139
+
140
+ ```html
141
+
142
+ <div id="print-section">
143
+
144
+ <!-- ... -->
145
+
146
+ </div>
147
+
148
+ <button
149
+ [previewOnly]="true"
150
+ printSectionId="print-section"
151
+ ngxPrint>print</button>
152
+
130
153
  ```
131
154
  ## Contributors :1st_place_medal:
132
155
 
package/angular.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prefix": "lib",
11
11
  "architect": {
12
12
  "build": {
13
- "builder": "@angular-devkit/build-ng-packagr:build",
13
+ "builder": "@angular-devkit/build-angular:ng-packagr",
14
14
  "options": {
15
15
  "tsConfig": "tsconfig.lib.json",
16
16
  "project": "ng-package.json"
@@ -19,10 +19,12 @@
19
19
  "test": {
20
20
  "builder": "@angular-devkit/build-angular:karma",
21
21
  "options": {
22
- "main": "src/test.ts",
22
+ "polyfills": [
23
+ "zone.js",
24
+ "zone.js/testing"
25
+ ],
23
26
  "tsConfig": "tsconfig.spec.json",
24
- "karmaConfig": "karma.conf.js",
25
- "codeCoverage": true
27
+ "karmaConfig": "karma.conf.js"
26
28
  }
27
29
  },
28
30
  "lint": {
@@ -40,5 +42,7 @@
40
42
  }
41
43
  }
42
44
  },
43
- "defaultProject": "ngx-print"
45
+ "cli": {
46
+ "analytics": false
47
+ }
44
48
  }
package/karma.conf.js CHANGED
@@ -9,18 +9,28 @@ module.exports = function (config) {
9
9
  require('karma-jasmine'),
10
10
  require('karma-chrome-launcher'),
11
11
  require('karma-jasmine-html-reporter'),
12
- require('karma-coverage-istanbul-reporter'),
12
+ require('karma-coverage'),
13
13
  require('@angular-devkit/build-angular/plugins/karma')
14
14
  ],
15
15
  client: {
16
16
  clearContext: false // leave Jasmine Spec Runner output visible in browser
17
17
  },
18
- coverageIstanbulReporter: {
19
- dir: require('path').join(__dirname, './dist/coverage'),
20
- reports: ['html', 'lcovonly'],
21
- fixWebpackSourcePaths: true
18
+ ccoverageReporter: {
19
+ dir: require('path').join(__dirname, './coverage/<project-name>'),
20
+ subdir: '.',
21
+ reporters: [
22
+ { type: 'html' },
23
+ { type: 'text-summary' }
24
+ ],
25
+ check: {
26
+ global: {
27
+ statements: 80,
28
+ branches: 80,
29
+ functions: 80,
30
+ lines: 80
31
+ }
32
+ }
22
33
  },
23
- reporters: ['progress', 'kjhtml'],
24
34
  port: 9876,
25
35
  colors: true,
26
36
  logLevel: config.LOG_INFO,
package/ng-package.json CHANGED
@@ -4,6 +4,5 @@
4
4
  "lib": {
5
5
  "entryFile": "src/public_api.ts"
6
6
 
7
- },
8
- "whitelistedNonPeerDependencies": ["."]
7
+ }
9
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-print",
3
- "version": "1.2.0",
3
+ "version": "1.3.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": {
@@ -25,42 +25,23 @@
25
25
  "scripts": {
26
26
  "ng": "ng",
27
27
  "build": "ng build",
28
- "test": "ng test -- --no-watch --code-coverage --no-progress --browsers=ChromeHeadlessCI"
28
+ "test": "ng test --no-watch --code-coverage --no-progress --browsers=ChromeHeadlessCI"
29
29
  },
30
30
  "dependencies": {
31
- "tslib": "^1.9.3"
31
+ "tslib": "^2.3.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@angular-devkit/build-angular": "^0.11.1",
35
- "@angular-devkit/build-ng-packagr": "^0.11.0",
36
- "@angular/cli": "^7.1.0",
37
- "@angular/common": "^7.1.3",
38
- "@angular/compiler": "^7.1.1",
39
- "@angular/compiler-cli": "^7.1.1",
40
- "@angular/core": "^7.1.1",
41
- "@angular/platform-browser": "^7.1.3",
42
- "@angular/platform-browser-dynamic": "^7.1.1",
43
- "@types/jasmine": "^3.3.1",
44
- "@types/node": "^10.12.12",
45
- "codelyzer": "^4.5.0",
46
- "coveralls": "^3.0.2",
47
- "jasmine-core": "^3.3.0",
48
- "jasmine-spec-reporter": "^4.2.1",
49
- "karma": "^3.1.3",
50
- "karma-chrome-launcher": "^2.2.0",
51
- "karma-coverage-istanbul-reporter": "^2.0.4",
52
- "karma-jasmine": "^2.0.1",
53
- "karma-jasmine-html-reporter": "^1.4.0",
54
- "ng-packagr": "^4.4.0",
55
- "nyc": "^14.1.1",
56
- "rxjs": "^6.3.3",
57
- "ts-node": "^7.0.1",
58
- "tsickle": "^0.34.0",
59
- "typescript": "3.2.4",
60
- "zone.js": "^0.8.26"
61
- },
62
- "peerDependencies": {
63
- "@angular/common": "*",
64
- "@angular/core": "*"
34
+ "@angular-devkit/build-angular": "^15.0.4",
35
+ "@angular/cli": "~15.0.4",
36
+ "@angular/compiler-cli": "^15.0.0",
37
+ "@types/jasmine": "~4.3.0",
38
+ "jasmine-core": "~4.5.0",
39
+ "karma": "~6.4.0",
40
+ "karma-chrome-launcher": "~3.1.0",
41
+ "karma-coverage": "~2.2.0",
42
+ "karma-jasmine": "~5.1.0",
43
+ "karma-jasmine-html-reporter": "~2.0.0",
44
+ "ng-packagr": "^15.0.0",
45
+ "typescript": "~4.8.2"
65
46
  }
66
47
  }
@@ -6,6 +6,13 @@ export class NgxPrintDirective {
6
6
 
7
7
  public _printStyle = [];
8
8
 
9
+ /**
10
+ * Prevents the print dialog from opening on the window
11
+ *
12
+ * @memberof NgxPrintDirective
13
+ */
14
+ @Input() previewOnly: boolean = false;
15
+
9
16
  /**
10
17
  *
11
18
  *
@@ -170,9 +177,9 @@ public returnStyleValues() {
170
177
  <script defer>
171
178
  function triggerPrint(event) {
172
179
  window.removeEventListener('load', triggerPrint, false);
173
- setTimeout(function() {
180
+ ${this.previewOnly ? '' : `setTimeout(function() {
174
181
  closeWindow(window.print());
175
- }, ${this.printDelay});
182
+ }, ${this.printDelay});`}
176
183
  }
177
184
  function closeWindow(){
178
185
  window.close();
package/tsconfig.json CHANGED
@@ -5,16 +5,16 @@
5
5
  "outDir": "./dist/out-tsc",
6
6
  "sourceMap": true,
7
7
  "declaration": false,
8
- "module": "es2015",
8
+ "module": "ES2022",
9
9
  "moduleResolution": "node",
10
10
  "emitDecoratorMetadata": true,
11
11
  "experimentalDecorators": true,
12
- "target": "es5",
12
+ "target": "ES2022",
13
13
  "typeRoots": [
14
14
  "node_modules/@types"
15
15
  ],
16
16
  "lib": [
17
- "es2018",
17
+ "ES2022",
18
18
  "dom"
19
19
  ],
20
20
  "paths": {
package/tsconfig.lib.json CHANGED
@@ -1,29 +1,11 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
3
  "compilerOptions": {
4
- "outDir": "./out-tsc/lib",
5
- "target": "es2015",
6
- "module": "es2015",
7
- "moduleResolution": "node",
4
+ "outDir": "../../out-tsc/lib",
8
5
  "declaration": true,
9
- "sourceMap": true,
6
+ "declarationMap": true,
10
7
  "inlineSources": true,
11
- "emitDecoratorMetadata": true,
12
- "experimentalDecorators": true,
13
- "importHelpers": true,
14
- "types": [],
15
- "lib": [
16
- "dom",
17
- "es2018"
18
- ]
19
- },
20
- "angularCompilerOptions": {
21
- "annotateForClosureCompiler": true,
22
- "skipTemplateCodegen": true,
23
- "strictMetadataEmit": true,
24
- "fullTemplateTypeCheck": true,
25
- "strictInjectionParameters": true,
26
- "enableResourceInlining": true
8
+ "types": []
27
9
  },
28
10
  "exclude": [
29
11
  "src/test.ts",
@@ -8,10 +8,10 @@
8
8
  ]
9
9
  },
10
10
  "files": [
11
- "src/test.ts"
12
11
  ],
13
12
  "include": [
14
- "**/*.spec.ts",
15
- "**/*.d.ts"
13
+ "**/*.spec.ts",
14
+ "**/*.d.ts",
15
+ "**/*.ts"
16
16
  ]
17
17
  }
package/src/test.ts DELETED
@@ -1,22 +0,0 @@
1
- // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
-
3
- import 'core-js/es7/reflect';
4
- import 'zone.js/dist/zone';
5
- import 'zone.js/dist/zone-testing';
6
- import { getTestBed } from '@angular/core/testing';
7
- import {
8
- BrowserDynamicTestingModule,
9
- platformBrowserDynamicTesting
10
- } from '@angular/platform-browser-dynamic/testing';
11
-
12
- declare const require: any;
13
-
14
- // First, initialize the Angular testing environment.
15
- getTestBed().initTestEnvironment(
16
- BrowserDynamicTestingModule,
17
- platformBrowserDynamicTesting()
18
- );
19
- // Then we find all the tests.
20
- const context = require.context('./', true, /\.spec\.ts$/);
21
- // And load the modules.
22
- context.keys().map(context);