ngx-print 1.3.0 → 1.4.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,113 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class NgxPrintDirective {
3
+ _printStyle: any[];
4
+ /**
5
+ * Prevents the print dialog from opening on the window
6
+ *
7
+ * @memberof NgxPrintDirective
8
+ */
9
+ previewOnly: boolean;
10
+ /**
11
+ *
12
+ *
13
+ * @memberof NgxPrintDirective
14
+ */
15
+ printSectionId: string;
16
+ /**
17
+ *
18
+ *
19
+ * @memberof NgxPrintDirective
20
+ */
21
+ printTitle: string;
22
+ /**
23
+ *
24
+ *
25
+ * @memberof NgxPrintDirective
26
+ */
27
+ useExistingCss: boolean;
28
+ /**
29
+ * A delay in milliseconds to force the print dialog to wait before opened. Default: 0
30
+ *
31
+ * @memberof NgxPrintDirective
32
+ */
33
+ printDelay: number;
34
+ /**
35
+ * Whether to close the window after print() returns.
36
+ *
37
+ */
38
+ closeWindow: boolean;
39
+ /**
40
+ * Class attribute to apply to the body element.
41
+ *
42
+ */
43
+ bodyClass: string;
44
+ /**
45
+ *
46
+ *
47
+ * @memberof NgxPrintDirective
48
+ */
49
+ set printStyle(values: {
50
+ [key: string]: {
51
+ [key: string]: string;
52
+ };
53
+ });
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
+ /**
74
+ * @memberof NgxPrintDirective
75
+ * @param cssList
76
+ */
77
+ 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
+ /**
105
+ *
106
+ *
107
+ * @memberof NgxPrintDirective
108
+ */
109
+ print(): void;
110
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxPrintDirective, never>;
111
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgxPrintDirective, "button[ngxPrint]", never, { "previewOnly": { "alias": "previewOnly"; "required": false; }; "printSectionId": { "alias": "printSectionId"; "required": false; }; "printTitle": { "alias": "printTitle"; "required": false; }; "useExistingCss": { "alias": "useExistingCss"; "required": false; }; "printDelay": { "alias": "printDelay"; "required": false; }; "closeWindow": { "alias": "closeWindow"; "required": false; }; "bodyClass": { "alias": "bodyClass"; "required": false; }; "printStyle": { "alias": "printStyle"; "required": false; }; "styleSheetFile": { "alias": "styleSheetFile"; "required": false; }; }, {}, never, never, true, never>;
112
+ }
113
+ //# 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,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,cAAc,CAAC,OAAO,EAAE,MAAM,EAYjC;IAED;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAGhC,OAAO,CAAC,aAAa;IASrB;;;;;;;KAOC;IACD,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,sBAAsB;IAO9B;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IAevB;;;;OAIG;IAEI,KAAK,IAAI,IAAI;yCAxLT,iBAAiB;2CAAjB,iBAAiB;CAgO7B"}
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./ngx-print.directive";
3
+ export declare class NgxPrintModule {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxPrintModule, never>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxPrintModule, never, [typeof i1.NgxPrintDirective], [typeof i1.NgxPrintDirective]>;
6
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgxPrintModule>;
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,qBAIa,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,47 +1,42 @@
1
- {
2
- "name": "ngx-print",
3
- "version": "1.3.0",
4
- "description": "Plug n' Play Angular (2++) directive to print your stuff",
5
- "author": "https://github.com/selemxmn/ngx-print/graphs/contributors",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/selemxmn/ngx-print.git"
9
- },
10
- "license": "MIT",
11
- "bugs": {
12
- "url": "https://github.com/selemxmn/ngx-print/issues"
13
- },
14
- "homepage": "https://github.com/selemxmn/ngx-print#readme",
15
- "keywords": [
16
- "print",
17
- "angular",
18
- "library",
19
- "ng-print",
20
- "ngx-print",
21
- "directive",
22
- "dependency",
23
- "angular-print"
24
- ],
25
- "scripts": {
26
- "ng": "ng",
27
- "build": "ng build",
28
- "test": "ng test --no-watch --code-coverage --no-progress --browsers=ChromeHeadlessCI"
29
- },
30
- "dependencies": {
31
- "tslib": "^2.3.0"
32
- },
33
- "devDependencies": {
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"
46
- }
47
- }
1
+ {
2
+ "name": "ngx-print",
3
+ "version": "1.4.0",
4
+ "description": "Plug n' Play Angular (2++) directive to print your stuff",
5
+ "author": "https://github.com/selemxmn/ngx-print/graphs/contributors",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/selemxmn/ngx-print.git"
9
+ },
10
+ "license": "MIT",
11
+ "bugs": {
12
+ "url": "https://github.com/selemxmn/ngx-print/issues"
13
+ },
14
+ "homepage": "https://github.com/selemxmn/ngx-print#readme",
15
+ "keywords": [
16
+ "print",
17
+ "angular",
18
+ "library",
19
+ "ng-print",
20
+ "ngx-print",
21
+ "directive",
22
+ "dependency",
23
+ "angular-print"
24
+ ],
25
+ "dependencies": {
26
+ "tslib": "^2.3.0"
27
+ },
28
+ "module": "fesm2022/ngx-print.mjs",
29
+ "typings": "index.d.ts",
30
+ "exports": {
31
+ "./package.json": {
32
+ "default": "./package.json"
33
+ },
34
+ ".": {
35
+ "types": "./index.d.ts",
36
+ "esm2022": "./esm2022/ngx-print.mjs",
37
+ "esm": "./esm2022/ngx-print.mjs",
38
+ "default": "./fesm2022/ngx-print.mjs"
39
+ }
40
+ },
41
+ "sideEffects": false
42
+ }
@@ -1,6 +1,3 @@
1
- /*
2
- * Public API Surface of ngx-print
3
- */
4
-
5
- export * from './lib/ngx-print.directive';
6
- export * from './lib/ngx-print.module';
1
+ export * from './lib/ngx-print.directive';
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"}
package/.editorconfig DELETED
@@ -1,13 +0,0 @@
1
- # Editor configuration, see https://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- charset = utf-8
6
- indent_style = space
7
- indent_size = 2
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
10
-
11
- [*.md]
12
- max_line_length = off
13
- trim_trailing_whitespace = false
@@ -1,31 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Describe the bug**
11
- A clear and concise description of what the bug is.
12
-
13
- **To Reproduce**
14
- Steps to reproduce the behavior.
15
-
16
- **Expected behavior**
17
- A clear and concise description of what you expected to happen.
18
-
19
- **Screenshots**
20
- If applicable, add screenshots to help explain your problem.
21
-
22
- **Ngx-Print Version**
23
- Include the current affected version.
24
-
25
- **Desktop (please complete the following information):**
26
- - OS: [e.g. iOS]
27
- - Browser [e.g. chrome, safari]
28
- - Version [e.g. 22]
29
-
30
- **Additional context**
31
- Add any other context about the problem here.
@@ -1,20 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Is your feature request related to a problem? Please describe.**
11
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
-
13
- **Describe the solution you'd like**
14
- A clear and concise description of what you want to happen.
15
-
16
- **Describe alternatives you've considered**
17
- A clear and concise description of any alternative solutions or features you've considered.
18
-
19
- **Additional context**
20
- Add any other context or screenshots about the feature request here.
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- 10.14.2
package/.travis.yml DELETED
@@ -1,40 +0,0 @@
1
- language: node_js
2
- sudo: false
3
- dist: trusty
4
- node_js:
5
- - '10.14.2'
6
-
7
- addons:
8
- packages:
9
- - unzip
10
- - google-chrome-stable
11
-
12
- cache:
13
- yarn: true
14
- directories:
15
- - node_modules
16
-
17
- before_install:
18
- - sudo apt-get clean
19
- - sudo apt-get update
20
- - sudo apt-get install dpkg
21
- - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
22
- - sudo dpkg -i google-chrome*.deb
23
- - export CHROME_BIN=/usr/bin/google-chrome
24
- - export DISPLAY=:99.0
25
- - sh -e /etc/init.d/xvfb start
26
-
27
- before_script:
28
- - yarn install
29
-
30
- after_failure:
31
- - cat /home/travis/build/selemxmn/ngx-print/yarn-error.log
32
-
33
- after_success:
34
- - cat ./dist/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
35
-
36
- notifications:
37
- email: false
38
-
39
- script:
40
- - yarn run test && yarn run build
package/CHANGELOG.md DELETED
@@ -1,10 +0,0 @@
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
-
7
- # 1.1.0 (2018-12-04)
8
- ### New features
9
- * Support styles (CSS) ([#5](https://github.com/selemxmn/ngx-print/issues/5)) ([71cefdf](https://github.com/selemxmn/ngx-print/commit/71cefdf))
10
- * Permit a dynamic title of printing window instead of the old static `Print tab` ([2098f3e](https://github.com/selemxmn/ngx-print/commit/2098f3e))
package/_config.yml DELETED
@@ -1 +0,0 @@
1
- theme: jekyll-theme-cayman
package/angular.json DELETED
@@ -1,48 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
- "version": 1,
4
- "newProjectRoot": "projects",
5
- "projects": {
6
- "ngx-print": {
7
- "root": "",
8
- "sourceRoot": "src",
9
- "projectType": "library",
10
- "prefix": "lib",
11
- "architect": {
12
- "build": {
13
- "builder": "@angular-devkit/build-angular:ng-packagr",
14
- "options": {
15
- "tsConfig": "tsconfig.lib.json",
16
- "project": "ng-package.json"
17
- }
18
- },
19
- "test": {
20
- "builder": "@angular-devkit/build-angular:karma",
21
- "options": {
22
- "polyfills": [
23
- "zone.js",
24
- "zone.js/testing"
25
- ],
26
- "tsConfig": "tsconfig.spec.json",
27
- "karmaConfig": "karma.conf.js"
28
- }
29
- },
30
- "lint": {
31
- "builder": "@angular-devkit/build-angular:tslint",
32
- "options": {
33
- "tsConfig": [
34
- "tsconfig.lib.json",
35
- "tsconfig.spec.json"
36
- ],
37
- "exclude": [
38
- "**/node_modules/**"
39
- ]
40
- }
41
- }
42
- }
43
- }
44
- },
45
- "cli": {
46
- "analytics": false
47
- }
48
- }
package/karma.conf.js DELETED
@@ -1,47 +0,0 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage'),
13
- require('@angular-devkit/build-angular/plugins/karma')
14
- ],
15
- client: {
16
- clearContext: false // leave Jasmine Spec Runner output visible in browser
17
- },
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
- }
33
- },
34
- port: 9876,
35
- colors: true,
36
- logLevel: config.LOG_INFO,
37
- autoWatch: true,
38
- browsers: ['Chrome'],
39
- customLaunchers: {
40
- ChromeHeadlessCI: {
41
- base: 'ChromeHeadless',
42
- flags: ['--no-sandbox']
43
- }
44
- },
45
- singleRun: true
46
- });
47
- };
package/ng-package.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "./dist/ngx-print",
4
- "lib": {
5
- "entryFile": "src/public_api.ts"
6
-
7
- }
8
- }
@@ -1,112 +0,0 @@
1
- import {Component, DebugElement} from "@angular/core";
2
- import {TestBed, ComponentFixture} from '@angular/core/testing';
3
- import {By} from "@angular/platform-browser";
4
-
5
- import { NgxPrintDirective } from './ngx-print.directive';
6
-
7
- @Component({
8
- template: `
9
- <div id="print-section">
10
- <h1>
11
- Welcome to ngx-print
12
- </h1>
13
- <img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
14
- <h2>Here are some links to help you start: </h2>
15
- <ul >
16
- <li>
17
- <h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
18
- </li>
19
- <li>
20
- <h2><a target="_blank" rel="noopener" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2>
21
- </li>
22
- <li>
23
- <h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
24
- </li>
25
- </ul>
26
- <table border = "1">
27
- <tr>
28
- <td>Row 1, Column 1</td>
29
- <td>Row 1, Column 2</td>
30
- </tr>
31
- <tr>
32
- <td>Row 2, Column 1</td>
33
- <td>Row 2, Column 2</td>
34
- </tr>
35
- </table>
36
- </div>
37
- <button printSectionId="print-section" ngxPrint></button>
38
- `
39
- })
40
- class TestNgxPrintComponent {
41
- }
42
-
43
- describe('NgxPrintDirective', () => {
44
-
45
- let buttonEl: DebugElement;
46
- let component: TestNgxPrintComponent;
47
- let fixture: ComponentFixture<TestNgxPrintComponent>;
48
-
49
- // To change this later, so it'll depend on TestNgxPrintComponent
50
- let styleSheet: {[key: string]: {[key: string]: string}}
51
- = {
52
- 'h2' : {'border': 'solid 1px'},
53
- 'h1' : {'color': 'red', 'border': '1px solid'}
54
- };
55
-
56
- beforeEach(() => {
57
-
58
- // Configure a NgModule-like decorator metadata
59
- TestBed.configureTestingModule({
60
- declarations: [TestNgxPrintComponent, NgxPrintDirective]
61
- });
62
-
63
- // Create a fixture object (that is going to allows us to create an instance of that component)
64
- fixture = TestBed.createComponent(TestNgxPrintComponent);
65
-
66
- // Create a component instance ( ~ new Component)
67
- component = fixture.componentInstance;
68
-
69
- // Get the button element (on which we tag the directive) to simulate clicks on it
70
- buttonEl = fixture.debugElement.query(By.directive(NgxPrintDirective));
71
-
72
- fixture.detectChanges();
73
- });
74
-
75
- it('should create an instance', () => {
76
- const directive = new NgxPrintDirective();
77
- expect(directive).toBeTruthy();
78
- });
79
-
80
- // it('should test the @Input printStyle', () => {
81
- // const directive = new NgxPrintDirective();
82
- // directive.printStyle = styleSheet;
83
- // for (var key in directive.printStyle) {
84
- // if (directive.printStyle.hasOwnProperty(key)) {
85
- // directive._printStyle.push((key + JSON.stringify(directive.printStyle[key])).replace(/['"]+/g, ''));
86
- // }
87
- // }
88
- // directive.returnStyleValues();
89
-
90
- // expect(directive.returnStyleValues).toHaveBeenCalled();
91
- // });
92
-
93
- // it('should returns a string from array of objects', () => {
94
- // const directive = new NgxPrintDirective();
95
- // directive._printStyle = [
96
- // "h2{border:solid 1px}",
97
- // "h1{color:red,border:1px solid}"
98
- // ];
99
- // // let returnedString = directive.returnStyleValues();
100
-
101
- // // immediately invoked arrow function, else you can uncomment `returnedString` and use it instead
102
- // expect((() => {return directive.returnStyleValues()})()).toEqual('h2{border:solid 1px} h1{color:red,border:1px solid}');
103
- // });
104
-
105
- it(`should popup a new window`, ()=> {
106
- spyOn(window, 'open');
107
- // simulate click
108
- buttonEl.triggerEventHandler('click', {});
109
- expect(window.open).toHaveBeenCalled();
110
- });
111
-
112
- });