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

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/index.d.ts ADDED
@@ -0,0 +1,241 @@
1
+ import * as i0 from '@angular/core';
2
+ import * as rxjs from 'rxjs';
3
+ import { Subject } from 'rxjs';
4
+
5
+ declare class PrintOptions {
6
+ printSectionId: string;
7
+ printTitle: string;
8
+ useExistingCss: boolean;
9
+ bodyClass: string;
10
+ openNewTab: boolean;
11
+ previewOnly: boolean;
12
+ closeWindow: boolean;
13
+ printDelay: number;
14
+ constructor(options?: Partial<PrintOptions>);
15
+ }
16
+
17
+ declare class PrintBase {
18
+ private nonce;
19
+ private _printStyle;
20
+ private _styleSheetFile;
21
+ protected printComplete: Subject<void>;
22
+ /**
23
+ * Sets the print styles based on the provided values.
24
+ *
25
+ * @param {Object} values - Key-value pairs representing print styles.
26
+ * @protected
27
+ */
28
+ protected setPrintStyle(values: {
29
+ [key: string]: {
30
+ [key: string]: string;
31
+ };
32
+ }): void;
33
+ /**
34
+ *
35
+ *
36
+ * @returns the string that create the stylesheet which will be injected
37
+ * later within <style></style> tag.
38
+ *
39
+ * -join/replace to transform an array objects to css-styled string
40
+ */
41
+ returnStyleValues(): string;
42
+ /**
43
+ * @returns string which contains the link tags containing the css which will
44
+ * be injected later within <head></head> tag.
45
+ *
46
+ */
47
+ private returnStyleSheetLinkTags;
48
+ /**
49
+ * Sets the style sheet file based on the provided CSS list.
50
+ *
51
+ * @param {string} cssList - CSS file or list of CSS files.
52
+ * @protected
53
+ */
54
+ protected setStyleSheetFile(cssList: string): void;
55
+ /**
56
+ * Updates the default values for input elements.
57
+ *
58
+ * @param {HTMLCollectionOf<HTMLInputElement>} elements - Collection of input elements.
59
+ * @private
60
+ */
61
+ private updateInputDefaults;
62
+ /**
63
+ * Updates the default values for select elements.
64
+ *
65
+ * @param {HTMLCollectionOf<HTMLSelectElement>} elements - Collection of select elements.
66
+ * @private
67
+ */
68
+ private updateSelectDefaults;
69
+ /**
70
+ * Updates the default values for textarea elements.
71
+ *
72
+ * @param {HTMLCollectionOf<HTMLTextAreaElement>} elements - Collection of textarea elements.
73
+ * @private
74
+ */
75
+ private updateTextAreaDefaults;
76
+ /**
77
+ * Converts a canvas element to an image and returns its HTML string.
78
+ *
79
+ * @param {HTMLCanvasElement} element - The canvas element to convert.
80
+ * @returns {string} - HTML string of the image.
81
+ * @private
82
+ */
83
+ private canvasToImageHtml;
84
+ /**
85
+ * Includes canvas contents in the print section via img tags.
86
+ *
87
+ * @param {HTMLCollectionOf<HTMLCanvasElement>} elements - Collection of canvas elements.
88
+ * @private
89
+ */
90
+ private updateCanvasToImage;
91
+ /**
92
+ * Retrieves the HTML content of a specified printing section.
93
+ *
94
+ * @param {string} printSectionId - Id of the printing section.
95
+ * @returns {string | null} - HTML content of the printing section, or null if not found.
96
+ * @private
97
+ */
98
+ private getHtmlContents;
99
+ /**
100
+ * Retrieves the HTML content of elements with the specified tag.
101
+ *
102
+ * @param {keyof HTMLElementTagNameMap} tag - HTML tag name.
103
+ * @returns {string} - Concatenated outerHTML of elements with the specified tag.
104
+ * @private
105
+ */
106
+ private getElementTag;
107
+ protected notifyPrintComplete(): void;
108
+ /**
109
+ * Prints the specified content using the provided print options.
110
+ *
111
+ * @param {PrintOptions} printOptions - Options for printing.
112
+ * @public
113
+ */
114
+ protected print(printOptions: PrintOptions): void;
115
+ static ɵfac: i0.ɵɵFactoryDeclaration<PrintBase, never>;
116
+ static ɵprov: i0.ɵɵInjectableDeclaration<PrintBase>;
117
+ }
118
+
119
+ declare class NgxPrintDirective extends PrintBase {
120
+ private printOptions;
121
+ /**
122
+ * Prevents the print dialog from opening on the window
123
+ *
124
+ * @memberof NgxPrintDirective
125
+ */
126
+ set previewOnly(value: boolean);
127
+ /**
128
+ *
129
+ *
130
+ * @memberof NgxPrintDirective
131
+ */
132
+ set printSectionId(value: string);
133
+ /**
134
+ *
135
+ *
136
+ * @memberof NgxPrintDirective
137
+ */
138
+ set printTitle(value: string);
139
+ /**
140
+ *
141
+ *
142
+ * @memberof NgxPrintDirective
143
+ */
144
+ set useExistingCss(value: boolean);
145
+ /**
146
+ * A delay in milliseconds to force the print dialog to wait before opened. Default: 0
147
+ *
148
+ * @memberof NgxPrintDirective
149
+ */
150
+ set printDelay(value: number);
151
+ /**
152
+ * Whether to close the window after print() returns.
153
+ *
154
+ */
155
+ set closeWindow(value: boolean);
156
+ /**
157
+ * Class attribute to apply to the body element.
158
+ *
159
+ */
160
+ set bodyClass(value: string);
161
+ /**
162
+ * Whether to open a new window or default to new window.
163
+ *
164
+ */
165
+ set openNewTab(value: boolean);
166
+ /**
167
+ *
168
+ *
169
+ * @memberof NgxPrintDirective
170
+ */
171
+ set printStyle(values: {
172
+ [key: string]: {
173
+ [key: string]: string;
174
+ };
175
+ });
176
+ /**
177
+ * @memberof NgxPrintDirective
178
+ * @param cssList
179
+ */
180
+ set styleSheetFile(cssList: string);
181
+ /**
182
+ *
183
+ *
184
+ * @memberof NgxPrintDirective
185
+ */
186
+ print(): void;
187
+ readonly printCompleted: i0.OutputEmitterRef<void>;
188
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxPrintDirective, never>;
189
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgxPrintDirective, "[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; }; "openNewTab": { "alias": "openNewTab"; "required": false; }; "printStyle": { "alias": "printStyle"; "required": false; }; "styleSheetFile": { "alias": "styleSheetFile"; "required": false; }; }, { "printCompleted": "printCompleted"; }, never, never, true, never>;
190
+ }
191
+
192
+ declare class NgxPrintModule {
193
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxPrintModule, never>;
194
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxPrintModule, never, [typeof NgxPrintDirective], [typeof NgxPrintDirective]>;
195
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgxPrintModule>;
196
+ }
197
+
198
+ /**
199
+ * Service for handling printing functionality in Angular applications.
200
+ * Extends the base printing class (PrintBase).
201
+ *
202
+ * @export
203
+ * @class NgxPrintService
204
+ * @extends {PrintBase}
205
+ */
206
+ declare class NgxPrintService extends PrintBase {
207
+ printComplete$: rxjs.Observable<void>;
208
+ /**
209
+ * Initiates the printing process using the provided print options.
210
+ *
211
+ * @param {PrintOptions} printOptions - Options for configuring the printing process.
212
+ * @memberof NgxPrintService
213
+ * @returns {void}
214
+ */
215
+ print(printOptions: PrintOptions): void;
216
+ /**
217
+ * Sets the print style for the printing process.
218
+ *
219
+ * @param {{ [key: string]: { [key: string]: string } }} values - A dictionary representing the print styles.
220
+ * @memberof NgxPrintService
221
+ * @setter
222
+ */
223
+ set printStyle(values: {
224
+ [key: string]: {
225
+ [key: string]: string;
226
+ };
227
+ });
228
+ /**
229
+ * Sets the stylesheet file for the printing process.
230
+ *
231
+ * @param {string} cssList - A string representing the path to the stylesheet file.
232
+ * @memberof NgxPrintService
233
+ * @setter
234
+ */
235
+ set styleSheetFile(cssList: string);
236
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxPrintService, never>;
237
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxPrintService>;
238
+ }
239
+
240
+ export { NgxPrintDirective, NgxPrintModule, NgxPrintService, PrintOptions };
241
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["../../src/lib/print-options.ts","../../src/lib/ngx-print.base.ts","../../src/lib/ngx-print.directive.ts","../../src/lib/ngx-print.module.ts","../../src/lib/ngx-print.service.ts"],"sourcesContent":[null,null,null,null,null],"names":["_angular_core"],"mappings":";;;;AAAA,cAAA,YAAA;;;;;;;;;AAUc,0BAAA,OAAA,CAAA,YAAA;AAKb;;ACXD,cAAA,SAAA;;;;;AAWE;;;;;AAKG;AACH;;AAAmD;;AAAyB;AAS5E;;;;;;;AAOG;;AAMH;;;;AAIG;AACH;AAIA;;;;;AAKG;AACH;AAiBA;;;;;AAKG;AACH;AAQA;;;;;AAKG;AACH;AAUA;;;;;AAKG;AACH;AAOA;;;;;;AAMG;AACH;AAKA;;;;;AAKG;AACH;AAQA;;;;;;AAMG;AACH;AAiBA;;;;;;AAMG;AACH;AAUA;AAIA;;;;;AAKG;AACH,kCAAA,YAAA;;;AA4HD;;AC3TD,cAAA,iBAAA,SAAA,SAAA;;AAME;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;;AAIG;AACH;AAIA;;;AAGG;AACH;AAIA;;;AAGG;AACH;AAIA;;;AAGG;AACH;AAIA;;;;AAIG;;;AAEuC;;;AAI1C;;;AAGG;AACH;AAKA;;;;AAIG;AAEI;6BAOgBA,EAAA,CAAA,gBAAA;;;AACxB;;AC7GD,cAAA,cAAA;;;;AAI8B;;ACH9B;;;;;;;AAOG;AACH,cAAA,eAAA,SAAA,SAAA;AAIE,oBAAc,IAAA,CAAA,UAAA;AACd;;;;;;AAMG;AACI,wBAAA,YAAA;AAKP;;;;;;AAMG;;;AACuC;;;AAI1C;;;;;;AAMG;AACH;;;AAGD;;;;"}
package/package.json CHANGED
@@ -1,68 +1,43 @@
1
- {
2
- "name": "ngx-print",
3
- "version": "20.1.0-beta.4",
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
- "lint": "ng lint"
30
- },
31
- "devDependencies": {
32
- "@angular-devkit/build-angular": "^20.1.0",
33
- "@angular-eslint/builder": "20.2.0",
34
- "@angular-eslint/eslint-plugin": "20.2.0",
35
- "@angular-eslint/eslint-plugin-template": "20.2.0",
36
- "@angular-eslint/schematics": "20.2.0",
37
- "@angular-eslint/template-parser": "20.2.0",
38
- "@angular/build": "^20.1.0",
39
- "@angular/cli": "^20.1.0",
40
- "@angular/common": "^20.1.0",
41
- "@angular/compiler": "^20.1.0",
42
- "@angular/compiler-cli": "^20.1.0",
43
- "@angular/core": "^20.1.0",
44
- "@angular/platform-browser": "20.2.1",
45
- "@angular/platform-browser-dynamic": "20.2.1",
46
- "@types/jasmine": "~5.1.4",
47
- "@typescript-eslint/eslint-plugin": "^8.33.1",
48
- "@typescript-eslint/parser": "^8.33.1",
49
- "@typescript-eslint/types": "^8.36.0",
50
- "@typescript-eslint/utils": "^8.33.1",
51
- "eslint": "^9.28.0",
52
- "eslint-config-prettier": "^9.1.0",
53
- "eslint-plugin-prettier": "^5.4.1",
54
- "jasmine-core": "~5.9.0",
55
- "karma": "~6.4.0",
56
- "karma-chrome-launcher": "~3.2.0",
57
- "karma-coverage": "~2.2.0",
58
- "karma-jasmine": "~5.1.0",
59
- "karma-jasmine-html-reporter": "~2.1.0",
60
- "ng-packagr": "^20.1.0",
61
- "prettier": "^3.3.3",
62
- "prettier-eslint": "^16.3.0",
63
- "typescript": "~5.9.2"
64
- },
65
- "peerDependencies": {
66
- "rxjs": "^7.4.0"
67
- }
68
- }
1
+ {
2
+ "name": "ngx-print",
3
+ "version": "20.1.0-beta.5",
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
+ "peerDependencies": {
26
+ "rxjs": "^7.4.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
+ "default": "./fesm2022/ngx-print.mjs"
37
+ }
38
+ },
39
+ "sideEffects": false,
40
+ "dependencies": {
41
+ "tslib": "^2.3.0"
42
+ }
43
+ }
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
package/.eslintrc.json DELETED
@@ -1,50 +0,0 @@
1
- {
2
- "root": true,
3
- "ignorePatterns": ["projects/**/*"],
4
- "overrides": [
5
- {
6
- "files": ["*.ts"],
7
- "extends": [
8
- "eslint:recommended",
9
- "plugin:@typescript-eslint/recommended",
10
- "plugin:@angular-eslint/recommended",
11
- "plugin:@angular-eslint/template/process-inline-templates",
12
- "plugin:prettier/recommended"
13
- ],
14
- "rules": {
15
- "@typescript-eslint/no-unused-vars": "off",
16
- "@typescript-eslint/no-explicit-any": "off",
17
- "@typescript-eslint/no-unused-expressions": "off",
18
- "@angular-eslint/directive-selector": [
19
- "off",
20
- {
21
- "type": "attribute",
22
- "prefix": "app",
23
- "style": "camelCase"
24
- }
25
- ],
26
- "@angular-eslint/component-selector": [
27
- "error",
28
- {
29
- "type": "element",
30
- "prefix": "app",
31
- "style": "kebab-case"
32
- }
33
- ]
34
- }
35
- },
36
- {
37
- "files": ["*.html"],
38
- "excludedFiles": ["*inline-template-*.component.html"],
39
- "extends": ["plugin:@angular-eslint/template/recommended", "plugin:prettier/recommended"],
40
- "rules": {
41
- "prettier/prettier": [
42
- "error",
43
- {
44
- "parser": "angular"
45
- }
46
- ]
47
- }
48
- }
49
- ]
50
- }
@@ -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.
@@ -1,17 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: "npm"
4
- directory: "/"
5
- schedule:
6
- interval: "weekly"
7
- day: "monday"
8
- time: "10:00"
9
- timezone: "America/New_York"
10
- open-pull-requests-limit: 5
11
- groups:
12
- npm-dependencies:
13
- patterns:
14
- - "*"
15
- ignore:
16
- - dependency-name: "*"
17
- update-types: ["version-update:semver-major"]
@@ -1,32 +0,0 @@
1
- name: Pull Request Checker
2
-
3
- on:
4
- pull_request:
5
- branches:
6
- - main
7
-
8
- concurrency:
9
- group: ${{github.repository_id}}-${{ github.workflow }}-${{ github.ref }}
10
- cancel-in-progress: true
11
-
12
- jobs:
13
- build-npm:
14
- runs-on: ubuntu-latest
15
-
16
- steps:
17
- - uses: actions/checkout@v4
18
-
19
- - name: Setup Node.js
20
- uses: actions/setup-node@v4
21
- with:
22
- node-version: 24.0.0
23
-
24
- - name: Install npm dependencies
25
- run: npm ci
26
-
27
- # Run linting
28
- - name: Run lint
29
- run: npm run lint
30
-
31
- - name: Run tests
32
- run: npm run test
@@ -1,26 +0,0 @@
1
- name: Mark stale issues and pull requests
2
-
3
- on:
4
- schedule:
5
- - cron: '0 2 * * *'
6
- workflow_dispatch:
7
-
8
- permissions:
9
- issues: write
10
- pull-requests: write
11
-
12
- jobs:
13
- stale:
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: actions/stale@v9
17
- with:
18
- repo-token: ${{ secrets.GITHUB_TOKEN }}
19
- stale-issue-message: 'This issue has been automatically marked as stale due to inactivity. Please comment if you want to keep it open.'
20
- stale-pr-message: 'This pull request has been automatically marked as stale due to inactivity.'
21
- close-issue-message: 'Closing this issue due to prolonged inactivity.'
22
- close-pr-message: 'Closing this pull request due to inactivity.'
23
- days-before-stale: 30
24
- days-before-close: 7
25
- exempt-issue-labels: 'inspecting'
26
-
package/.prettierignore DELETED
@@ -1,42 +0,0 @@
1
- # See http://help.github.com/ignore-files/ for more about ignoring files.
2
-
3
- # Compiled output
4
- /dist
5
- /tmp
6
- /out-tsc
7
- /bazel-out
8
-
9
- # Node
10
- /node_modules
11
- npm-debug.log
12
- yarn-error.log
13
-
14
- # IDEs and editors
15
- .idea/
16
- .project
17
- .classpath
18
- .c9/
19
- *.launch
20
- .settings/
21
- *.sublime-workspace
22
-
23
- # Visual Studio Code
24
- .vscode/*
25
- !.vscode/settings.json
26
- !.vscode/tasks.json
27
- !.vscode/launch.json
28
- !.vscode/extensions.json
29
- .history/*
30
-
31
- # Miscellaneous
32
- /.angular/cache
33
- .sass-cache/
34
- /connect.lock
35
- /coverage
36
- /libpeerconnection.log
37
- testem.log
38
- /typings
39
-
40
- # System files
41
- .DS_Store
42
- Thumbs.db
package/.prettierrc.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "tabWidth": 2,
3
- "useTabs": false,
4
- "singleQuote": true,
5
- "semi": true,
6
- "bracketSpacing": true,
7
- "arrowParens": "avoid",
8
- "trailingComma": "es5",
9
- "bracketSameLine": true,
10
- "printWidth": 150,
11
- "endOfLine": "auto",
12
- "htmlWhitespaceSensitivity": "ignore",
13
- "quoteProps": "preserve"
14
- }
package/CHANGELOG.md DELETED
@@ -1,17 +0,0 @@
1
- # 1.5.0 (2023-11-29)
2
- * Now supports Angular 17
3
- * Added printService
4
-
5
- # 1.4.0 (2023-11-29)
6
- * Now supports Angular 16
7
-
8
- # 1.3.0 (2022-12-20)
9
- ### New features
10
- * Supports previewOnly tag, allowing for the print preview to show without the print dialog
11
- ### Dependency Updates
12
- * Angular Ivy support with Angular 15
13
-
14
- # 1.1.0 (2018-12-04)
15
- ### New features
16
- * Support styles (CSS) ([#5](https://github.com/selemxmn/ngx-print/issues/5)) ([71cefdf](https://github.com/selemxmn/ngx-print/commit/71cefdf))
17
- * 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